Commit bb8667f6 authored by dahai's avatar dahai

修改添加交接单API

parent 4f40fee2
package com.yxproject.start.api;
import com.yxproject.start.entity.DetailReceiptListEntity;
import com.yxproject.start.entity.ReceiptListEntity;
import com.yxproject.start.service.ReceiptService;
import net.sf.json.JSONArray;
import org.apache.ibatis.annotations.Param;
......@@ -42,14 +43,19 @@ public class ReceiptApi {
if (countAccept == 0) {
//查询特证交接单所需数据
Map<String, Object> resultDate = receiptService.selectReceiptListDate(id);
String acceptNo = (String) resultDate.get("ACCEPT_NO");
String GAJG_DM = (String) resultDate.get("GAJG_DM");
int cardType = (int) resultDate.get("CARD_TYPE");
int oldCardType = (int) resultDate.get("OLD_CARD_TYPE");
int state = 0;
int count = (int) resultDate.get("COUNT");
ReceiptListEntity receiptListEntity = new ReceiptListEntity();
receiptListEntity.setPoliceCode(resultDate.get("GAJG_DM").toString());
receiptListEntity.setCardTypeId(Long.valueOf((BigDecimal)resultDate.get("CARD_TYPE")+""));
if ("null".equals(resultDate.get("OLD_CARD_TYPE")+"")){
}else {
receiptListEntity.setOldCardTypeId(Long.valueOf(resultDate.get("OLD_CARD_TYPE")+""));
}
receiptListEntity.setFinishCount(Long.valueOf(resultDate.get("VALID_COUNT").toString()));
receiptListEntity.setQrCode(resultDate.get("GROUP_NO").toString());
receiptListEntity.setState((long)0);
//生成特证交接单
receiptService.createReceiptList(acceptNo, GAJG_DM, count, state,cardType,oldCardType);
receiptService.createReceiptList(receiptListEntity);
//查询特证详单所需数据
Map<String, Object> detailedData = receiptService.selectDetailedData(id);
......@@ -68,18 +74,23 @@ public class ReceiptApi {
} else {
//查询交接单所需数据
Map<String, Object> receiptListDate = receiptService.selectReceiptListDate(id);
String groupNo = (String) receiptListDate.get("GROUP_NO");
String GAJG_DM = (String) receiptListDate.get("GAJG_DM");
int cardType = (int) receiptListDate.get("CARD_TYPE");
int oldCardType = (int) receiptListDate.get("OLD_CARD_TYPE");
int count = Integer.valueOf(receiptListDate.get("VALID_COUNT").toString());
int state = 0;
ReceiptListEntity receiptListEntity = new ReceiptListEntity();
receiptListEntity.setPoliceCode(receiptListDate.get("GAJG_DM").toString());
receiptListEntity.setCardTypeId(Long.valueOf((BigDecimal)receiptListDate.get("CARD_TYPE")+""));
if ("null".equals(receiptListDate.get("OLD_CARD_TYPE")+"")){
}else {
receiptListEntity.setOldCardTypeId(Long.valueOf(receiptListDate.get("OLD_CARD_TYPE")+""));
}
receiptListEntity.setFinishCount(Long.valueOf(receiptListDate.get("VALID_COUNT").toString()));
receiptListEntity.setQrCode(receiptListDate.get("GROUP_NO").toString());
receiptListEntity.setState((long)0);
//查询这个组号是否生成了交接单
int countGroup = receiptService.selectByGroupNo(groupNo);
int countGroup = receiptService.selectByGroupNo(receiptListDate.get("GROUP_NO").toString());
//没有生成交接单
if (countGroup == 0) {
//生成交接单
receiptService.createReceiptList(groupNo,GAJG_DM,count,state,cardType,oldCardType);
receiptService.createReceiptList(receiptListEntity);
//查询这个身份证是否生成了详单
int receiptCount = receiptService.selectReceiptById(id);
//没有生成交接单详单
......@@ -118,10 +129,10 @@ public class ReceiptApi {
}
}
//查询有几个特证
int specialCardCount = receiptService.selectSpecialCard(groupNo);
int specialCardCount = receiptService.selectSpecialCard(receiptListDate.get("GROUP_NO").toString());
//减去特证个数
int finishCount = receiptService.selectCount(groupNo) - specialCardCount;
receiptService.updateFinishCount(groupNo, finishCount);
int finishCount = receiptService.selectCount(receiptListDate.get("GROUP_NO").toString()) - specialCardCount;
receiptService.updateFinishCount(receiptListDate.get("GROUP_NO").toString(), finishCount);
}
......
package com.yxproject.start.mapper;
import com.yxproject.start.entity.DetailReceiptListEntity;
import com.yxproject.start.entity.ReceiptListEntity;
import org.apache.ibatis.annotations.*;
import java.util.Date;
......@@ -27,8 +28,17 @@ public interface ReceiptMapper {
public int selectByGroupNo(String groupNo);
//生成交接单
@Insert("INSERT INTO RECEIPT_LIST(QR_CODE,POLICE_CODE,FINISH_COUNT,STATE,CARD_TYPE_ID,OLD_CARD_TYPE_ID)VALUES(#{GROUP_NO},#{GAJG_DM},#{count},#{state},#{cardType},#{oldCardType})")
public boolean createReceiptList(@Param("GROUP_NO")String GROUP_NO,@Param("GAJG_DM")String GAJG_DM,@Param("count")int count,@Param("state")int state,@Param("cardType")int cardType,@Param("oldCardType")int oldCardType);
@Insert("<script>" +
" INSERT INTO RECEIPT_LIST(QR_CODE,POLICE_CODE,FINISH_COUNT,STATE,CARD_TYPE_ID" +
"<if test ='oldCardTypeId !=null'> " +
",OLD_CARD_TYPE_ID" +
"</if> " +
")VALUES(#{qrCode},#{policeCode},#{finishCount},#{state},#{cardTypeId}" +
"<if test ='oldCardTypeId !=null'> " +
",#{oldCardTypeId}" +
"</if> " +
") </script>")
public boolean createReceiptList(ReceiptListEntity receiptListEntity);
......
package com.yxproject.start.service;
import com.yxproject.start.entity.DetailReceiptListEntity;
import com.yxproject.start.entity.ReceiptListEntity;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
......@@ -11,7 +12,7 @@ public interface ReceiptService {
public Map<String,Object> selectReceiptListDate(String id);
public boolean createReceiptList(@Param("GROUP_NO")String GROUP_NO, @Param("GAJG_DM")String GAJG_DM, @Param("count")int count,@Param("state")int state,@Param("cardType")int cardType,@Param("oldCardType")int oldCardType);
public boolean createReceiptList(ReceiptListEntity receiptListEntity);
public Map<String,Object>selectDetailedData(String id);
......
package com.yxproject.start.service.impl;
import com.yxproject.start.entity.DetailReceiptListEntity;
import com.yxproject.start.entity.ReceiptListEntity;
import com.yxproject.start.mapper.ReceiptMapper;
import com.yxproject.start.service.ReceiptService;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -20,8 +21,8 @@ public class ReceiptServiceImpl implements ReceiptService {
}
@Override
public boolean createReceiptList(String GROUP_NO, String GAJG_DM, int count,int state,int cardType,int oldCardType) {
receiptMapper.createReceiptList(GROUP_NO,GAJG_DM,count,state,cardType,oldCardType);
public boolean createReceiptList(ReceiptListEntity receiptListEntity) {
receiptMapper.createReceiptList(receiptListEntity);
return true;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment