Commit d9706c09 authored by dahai's avatar dahai

修改保存交接单详单

parent f6bafd24
...@@ -76,41 +76,51 @@ public class ReceiptApi { ...@@ -76,41 +76,51 @@ public class ReceiptApi {
//根据身份证号查组号 //根据身份证号查组号
String groupNo= receiptService.selectGroupNoById(id); String groupNo= receiptService.selectGroupNoById(id);
//查询交接单所需数据 //查询交接单所需数据
Map<String, Object> receiptListDate = receiptService.selectReceiptListDate2(groupNo); List<Map<String, Object>> receiptListDate = receiptService.selectReceiptListDate2(groupNo);
for (int i = 0; i<receiptListDate.size();i++){
ReceiptListEntity receiptListEntity = new ReceiptListEntity(); ReceiptListEntity receiptListEntity = new ReceiptListEntity();
receiptListEntity.setPoliceCode(receiptListDate.get("GAJG_DM").toString()); receiptListEntity.setPoliceCode(receiptListDate.get(i).get("GAJG_DM").toString());
receiptListEntity.setCardTypeId(Long.valueOf((BigDecimal)receiptListDate.get("CARD_TYPE")+"")); receiptListEntity.setCardTypeId(Long.valueOf((BigDecimal)receiptListDate.get(i).get("CARD_TYPE")+""));
if ("null".equals(receiptListDate.get("OLD_CARD_TYPE")+"")){ if ("null".equals(receiptListDate.get(i).get("OLD_CARD_TYPE")+"")){
}else { }else {
receiptListEntity.setOldCardTypeId(Long.valueOf(receiptListDate.get("OLD_CARD_TYPE")+"")); receiptListEntity.setOldCardTypeId(Long.valueOf(receiptListDate.get(i).get("OLD_CARD_TYPE")+""));
} }
receiptListEntity.setFinishCount(Long.valueOf(receiptListDate.get("VALID_COUNT").toString())); receiptListEntity.setFinishCount((long)receiptListDate.size());
receiptListEntity.setQrCode(receiptListDate.get("GROUP_NO").toString()); receiptListEntity.setQrCode(receiptListDate.get(i).get("GROUP_NO").toString());
receiptListEntity.setState((long)0); receiptListEntity.setState((long)0);
//查询这个组号是否生成了交接单 //查询这个组号是否生成了交接单
int countGroup = receiptService.selectByGroupNo(receiptListDate.get("GROUP_NO").toString()); int countGroup = receiptService.selectByGroupNo(receiptListDate.get(i).get("GROUP_NO").toString());
//没有生成交接单 //没有生成交接单
if (countGroup == 0) { if (countGroup == 0) {
//生成交接单 //生成交接单
receiptService.createReceiptList(receiptListEntity); receiptService.createReceiptList(receiptListEntity);
//todo 查询交接单对应的详单 循环遍历 是否生成对应详单 生成 不做操作 没有生成 遍历插入
for(int n =0; n< receiptListDate.size();n++){
// receiptService.
//查询这个身份证是否生成了详单 //查询这个身份证是否生成了详单
int receiptCount = receiptService.selectReceiptById(id); int receiptCount = receiptService.selectReceiptById(receiptListDate.get(n).get("ID_NO").toString());
//没有生成交接单详单 //没有生成交接单详单
if (receiptCount == 0) { if (receiptCount == 0) {
Map<String, Object> detailedData = receiptService.selectDetailedData(id); Map<String, Object> detailedData = receiptService.selectDetailedData(receiptListDate.get(n).get("ID_NO").toString());
String uploadNo = (String) detailedData.get("UPLOAD_NO"); String uploadNo = (String) detailedData.get("UPLOAD_NO");
String acceptNo2 = (String) detailedData.get("ACCEPT_NO"); String acceptNo2 = (String) detailedData.get("ACCEPT_NO");
String name = (String) detailedData.get("NAME"); String name = (String) detailedData.get("NAME");
String sex = (String) detailedData.get("SEX"); String sex = (String) detailedData.get("SEX");
String cardId = (String) detailedData.get("CARD_ID");
String gajg_dm = (String) detailedData.get("GAJG_DM"); String gajg_dm = (String) detailedData.get("GAJG_DM");
int receiptId = Integer.parseInt((BigDecimal) detailedData.get("ID") + ""); int receiptId = Integer.parseInt((BigDecimal) detailedData.get("ID") + "");
//生成详单 //生成详单
receiptService.createDetailedList(uploadNo, acceptNo2, name, id, gajg_dm, receiptId,sex); receiptService.createDetailedList(uploadNo, acceptNo2, name, receiptListDate.get(i).get("GROUP_NO").toString(), gajg_dm, receiptId,sex);
} else { } else {
//不做操作 //不做操作
} }
}
} else { } else {
//已生成交接单 //已生成交接单
//查询这个身份证是否生成了详单 //查询这个身份证是否生成了详单
...@@ -132,10 +142,14 @@ public class ReceiptApi { ...@@ -132,10 +142,14 @@ public class ReceiptApi {
} }
} }
//查询有几个特证 //查询有几个特证
int specialCardCount = receiptService.selectSpecialCard(receiptListDate.get("GROUP_NO").toString()); int specialCardCount = receiptService.selectSpecialCard(receiptListDate.get(i).get("GROUP_NO").toString());
//减去特证个数 //减去特证个数
int finishCount = receiptService.selectCount(receiptListDate.get("GROUP_NO").toString()) - specialCardCount; int finishCount = receiptService.selectCount(receiptListDate.get(i).get("GROUP_NO").toString()) - specialCardCount;
receiptService.updateFinishCount(receiptListDate.get("GROUP_NO").toString(), finishCount); receiptService.updateFinishCount(receiptListDate.get(i).get("GROUP_NO").toString(), finishCount);
}
} }
......
...@@ -26,11 +26,11 @@ public interface ReceiptMapper { ...@@ -26,11 +26,11 @@ public interface ReceiptMapper {
//根据身份证号查组号 //根据身份证号查组号
@Select("select subStr(ACCEPT_NO,0,8) as groupNo from prod_card_t@PROD_LINK where ID_NO=#{id}") @Select("select subStr(ACCEPT_NO,0,8) as groupNo from prod_card_t@PROD_LINK where ID_NO=#{id}")
public String selectGroupNoById(String id); public List<Map<String,Object>> selectGroupNoById(String id);
//根据组号查询普通证交接单信息 //根据组号查询普通证交接单信息
@Select("select prod_group_t.group_no,prod_card_t.accept_no,subStr(prod_card_t.UPLOAD_NO,0,9) as GAJG_DM,\n" + @Select("select prod_group_t.group_no,prod_card_t.accept_no,subStr(prod_card_t.UPLOAD_NO,0,9) as GAJG_DM,\n" +
"count(prod_card_t.accept_no) valid_count,GAJG_DM.GAJG_MC, task.CARD_TYPE,task.OLD_CARD_TYPE \n" + "count(prod_card_t.accept_no) valid_count,GAJG_DM.GAJG_MC, task.CARD_TYPE,task.OLD_CARD_TYPE,prod_card_t.id_no,prod_card_t.sex_no,prod_card_t.upload_no \n" +
"from prod_card_t@PROD_LINK \n" + "from prod_card_t@PROD_LINK \n" +
"left join prod_group_t@PROD_LINK on subStr(prod_card_t.accept_no,0,8)= prod_group_t.group_no \n" + "left join prod_group_t@PROD_LINK on subStr(prod_card_t.accept_no,0,8)= prod_group_t.group_no \n" +
"left join group_no on group_no.group_no = prod_group_t.group_no \n" + "left join group_no on group_no.group_no = prod_group_t.group_no \n" +
...@@ -38,8 +38,8 @@ public interface ReceiptMapper { ...@@ -38,8 +38,8 @@ public interface ReceiptMapper {
"left join GAJG_DM on subStr(prod_card_t.UPLOAD_NO,0,9)= GAJG_DM.GAJG_DM \n" + "left join GAJG_DM on subStr(prod_card_t.UPLOAD_NO,0,9)= GAJG_DM.GAJG_DM \n" +
"where prod_group_t.group_no=#{id} and prod_card_t.accept_no not in (select accept_no from SPECIAL_CARD ) \n" + "where prod_group_t.group_no=#{id} and prod_card_t.accept_no not in (select accept_no from SPECIAL_CARD ) \n" +
"group by prod_group_t.group_no, prod_card_t.accept_no, subStr(prod_card_t.UPLOAD_NO,0,9), GAJG_DM.GAJG_MC, task.CARD_TYPE, \n" + "group by prod_group_t.group_no, prod_card_t.accept_no, subStr(prod_card_t.UPLOAD_NO,0,9), GAJG_DM.GAJG_MC, task.CARD_TYPE, \n" +
"task.OLD_CARD_TYPE ") "task.OLD_CARD_TYPE,prod_card_t.id_no,prod_card_t.sex_no,prod_card_t.upload_no ")
public Map<String,Object> selectReceiptListDate2(String id); public List<Map<String,Object>> selectReceiptListDate2(String id);
......
...@@ -67,7 +67,7 @@ public interface ReceiptService { ...@@ -67,7 +67,7 @@ public interface ReceiptService {
public Map<String,Object>selectDetailedData2(String id); public Map<String,Object>selectDetailedData2(String id);
public Map<String,Object> selectReceiptListDate2(String id); public List<Map<String, Object>> selectReceiptListDate2(String id);
public String selectGroupNoById(String id); public String selectGroupNoById(String id);
......
...@@ -175,15 +175,15 @@ public class ReceiptServiceImpl implements ReceiptService { ...@@ -175,15 +175,15 @@ public class ReceiptServiceImpl implements ReceiptService {
} }
@Override @Override
public Map<String, Object> selectReceiptListDate2(String id) { public List<Map<String, Object>> selectReceiptListDate2(String id) {
Map<String,Object> resultMap = receiptMapper.selectReceiptListDate2(id); List<Map<String, Object>> mapList = receiptMapper.selectReceiptListDate2(id);
return resultMap; return mapList;
} }
@Override @Override
public String selectGroupNoById(String id) { public String selectGroupNoById(String id) {
String groupNo=receiptMapper.selectGroupNoById(id); List<Map<String, Object>> mapList = receiptMapper.selectGroupNoById(id);
return groupNo; return mapList.get(0).get("GROUPNO").toString();
} }
private List<Map<String, Object>> formateMap(List<Map<String, Object>> maplist) { private List<Map<String, Object>> formateMap(List<Map<String, Object>> maplist) {
......
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