Commit 5cddd342 authored by Administrator's avatar Administrator

添加补证

parent 07e580c0
......@@ -144,10 +144,10 @@ public class FailedCardApi {
JSONObject jsonObject = (JSONObject) o;
String name = ((JSONObject) o).getString("name");
String result = failedCardService.selectSpecialCard(((JSONObject) o).getString("cardId"));
Long result = failedCardService.selectSpecialCard(((JSONObject) o).getString("cardId"));
Map<String, Object> idMap;
//判断是否是特殊证件
if (result != null && result != "") {
if (result != 0 ) {
idMap = failedCardService.selectDataById(jsonObject.getString("cardId"));
} else {
idMap = failedCardService.selectCountIdByCardId(jsonObject.getString("cardId"));
......@@ -235,6 +235,37 @@ public class FailedCardApi {
return result;
}
/**
* 添加历史回迁证
*
* @param jsonStr
* @return
*/
@RequestMapping("insertHistoryCard")
@Transactional(rollbackFor = Exception.class)
public Boolean insertHistoryCard(@RequestBody String jsonStr) {
JSONArray jsonarray = new JSONArray();
jsonarray = JSONArray.fromObject(jsonStr);
for (Object o : jsonarray) {
JSONObject jsonObject = (JSONObject) o;
String name = ((JSONObject) o).getString("name");
String workGroup = ((JSONObject) o).getString("workGroup");
String note = jsonObject.getString("note");
String failedCardReasonId = jsonObject.getString("failedCardReasonId");
Long result = failedCardService.selectSpecialCard(((JSONObject) o).getString("cardId"));
Map<String, Object> idMap;
//判断是否是特殊证件
if (result != 0 ) {
idMap = failedCardService.selectDataById(jsonObject.getString("cardId"));
} else {
idMap = failedCardService.selectCountIdByCardId(jsonObject.getString("cardId"));
}
int initiator = 5;
failedCardService.insertHistoryCard(failedCardReasonId, idMap.get("ACCEPT_NO").toString(), String.valueOf(initiator), note, workGroup, name);
}
return true;
}
/**
* 生成历史回迁证
*
......@@ -251,18 +282,10 @@ public class FailedCardApi {
try {
jsonarray = JSONArray.fromObject(jsonStr);
taskEntity = new TaskEntity();
String str2 = "";
String failedCardReasonId = "";
String workGroup = "";
String note = "";
String name = "";
String str2 = null;
for (int i = 0; i < jsonarray.size(); i++) {
JSONObject jsonObject = (JSONObject) jsonarray.get(i);
String str = jsonObject.getString("cardId");
failedCardReasonId = jsonObject.getString("failedCardReasonId");
workGroup = jsonObject.getString("workGroup");
note = jsonObject.getString("note");
name = jsonObject.getString("name");
String str = jsonObject.getString("idCard");
if (i != jsonarray.size() - 1) {
str2 += "'" + str + "',";
} else {
......@@ -275,20 +298,17 @@ public class FailedCardApi {
for (int i = 0; i < groupList.size(); i++) {
JSONObject jsonObject = (JSONObject) jsonarray.get(i);
//查询生成任务单需要的数据
Map<String, Object> dataMap = failedCardService.selectTaskListById(jsonObject.getString("cardId"));
Map<String, Object> dataMap = failedCardService.selectTaskListById(jsonObject.getString("idCard"));
String countyCode = dataMap.get("COUNTY_CODE").toString();
Long cardType = (Long) dataMap.get("CARD_TYPE_ID");
String submitName =(String) dataMap.get("INITIATOR");
taskEntity.setCountyCode(countyCode);
taskEntity.setCardType(cardType);
taskEntity.setSubmitName(submitName);
taskEntity.setTaskStateId((long) 1);
//生成任务单
taskListService.saveTask(taskEntity);
//生成新组号列表
Map<String, Object> groupDataMap = failedCardService.selectGroupDate(groupList.get(i));
failedCardService.insertGroupNo(String.valueOf(groupDataMap.get("GROUP_NO")), String.valueOf(taskEntity.getTaskId()), (Long) groupDataMap.get("VALID_COUNT"), (Long) groupDataMap.get("INVALID_COUNT"));
failedCardService.insertFailedCard(failedCardReasonId,String.valueOf(dataMap.get("ACCEPT_NO")),String.valueOf(taskEntity.getTaskId()),String.valueOf("1"),note,workGroup,name);
failedCardService.insertGroupNo(String.valueOf(groupDataMap.get("GROUP_NO")), String.valueOf(groupDataMap.get("TASK_ID")), (Long) groupDataMap.get("VALID_COUNT"), (Long) groupDataMap.get("INVALID_COUNT"));
}
} catch (NullPointerException e) {
logger.error("身份证号或受理号:" + jsonarray);
......
......@@ -64,6 +64,17 @@ public interface FailedCardMapper {
"WHERE PROD_CARD_T.ID_NO=#{cardId} or PROD_CARD_T.ACCEPT_NO=#{cardId}")
public Map<String, Object> selectCountIdByCardId(@Param("cardId") String cardId);
/**
* 生成历史回迁证
* @param failedCardReasonId
* @param acceptNo
* @param initiator
* @param note
* @return
*/
@Insert("INSERT INTO FAILED_CARD (FAILED_CARD_REASON_ID,ACCEPT_NO,STATE,INITIATOR,NOTE,work_group,name) VALUES (#{failedCardReasonId},#{acceptNo},0,#{initiator},#{note},#{workGroup},#{name})\n")
public boolean insertHistoryCard(@Param("failedCardReasonId")String failedCardReasonId,@Param("acceptNo")String acceptNo,@Param("initiator")String initiator,@Param("note")String note,@Param("workGroup")String workGroup,@Param("name")String name);
/*余证*/
@Update("update group_no \n" +
"set group_no.SPECIAL_CARD_COUNT=group_no.SPECIAL_CARD_COUNT+1 \n" +
......@@ -140,7 +151,7 @@ public interface FailedCardMapper {
@Select("select SPECIAL_CARD_ID from special_card \n" +
"left join prod_card_t@PRODYD_LINK ON PROD_CARD_T.ACCEPT_NO = SPECIAL_CARD.ACCEPT_NO\n" +
" WHERE PROD_CARD_T.ID_NO = #{id} or PROD_CARD_T.ACCEPT_NO=#{id}")
public String selectSpecialCard(String id);
public Long selectSpecialCard(String id);
/**
......
......@@ -18,6 +18,8 @@ public interface FailedCardService {
public Map<String,Object> selectCountIdByCardId(String cardId);
public boolean insertHistoryCard(String failedCardReasonId,String acceptNo,String initiator,String note,String workGroup,String name);
public boolean specialCardAdd(String acceptNo);
public boolean addSpecialCard(SpecialCardEntity specialCardEntity);
......@@ -36,7 +38,7 @@ public interface FailedCardService {
public boolean updateFailedCardState(FailedCardEntity failedCardEntity);
public String selectSpecialCard(String id);
public Long selectSpecialCard(String id);
public Map<String,Object> selectDataById(String id);
......
......@@ -51,6 +51,12 @@ public class FailedCardServiceImpl implements FailedCardService {
return true;
}
@Override
public boolean insertHistoryCard(String failedCardReasonId, String acceptNo, String initiator, String note,String workGroup,String name) {
failedCardMapper.insertHistoryCard(failedCardReasonId,acceptNo,initiator,note,workGroup,name);
return true;
}
@Override
public boolean addSpecialCard(SpecialCardEntity specialCardEntity) {
failedCardMapper.addSpecialCard(specialCardEntity);
......@@ -79,23 +85,13 @@ public class FailedCardServiceImpl implements FailedCardService {
@Override
public Map<String, Object> selectTaskListById(String id) {
Map<String,Object> resultMap= failedCardMapper.selectTaskListById(id);
Map<String,Object> resultMap1 = new HashMap <>();
resultMap1.put("SPECIAL_TYPE",Long.parseLong(resultMap.get("SPECIAL_TYPE").toString()));
resultMap1.put("CARD_TYPE_ID",Long.parseLong(resultMap.get("CARD_TYPE_ID").toString()));
resultMap1.put("ACCEPT_NO",resultMap.get("ACCEPT_NO"));
resultMap1.put("COUNTY_CODE",resultMap.get("COUNTY_CODE"));
resultMap1.put("INITIATOR",resultMap.get("INITIATOR"));
return resultMap1;
return resultMap;
}
@Override
public Map<String, Object> selectGroupDate(String groupNo) {
Map<String,Object> resultMap= failedCardMapper.selectGroupDate(groupNo);
Map<String,Object> resultMap1 = new HashMap <>();
resultMap1.put("VALID_COUNT",Long.parseLong(resultMap.get("VALID_COUNT").toString()));
resultMap1.put("INVALID_COUNT",Long.parseLong(resultMap.get("INVALID_COUNT").toString()));
resultMap1.put("GROUP_NO",groupNo);
return resultMap1;
return resultMap;
}
@Override
......@@ -132,8 +128,8 @@ public class FailedCardServiceImpl implements FailedCardService {
}
@Override
public String selectSpecialCard(String id) {
String result = failedCardMapper.selectSpecialCard(id);
public Long selectSpecialCard(String id) {
Long result = failedCardMapper.selectSpecialCard(id);
return result;
}
......
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