Commit 0c011dae authored by dahai's avatar dahai

Merge remote-tracking branch 'origin/dev' into dev

parents 776c6e99 757cae48
package com.yxproject.start.api; package com.yxproject.start.api;
import com.yxproject.start.entity.TaskEntity;
import com.yxproject.start.entity.TaskList.TaskListEntity;
import com.yxproject.start.service.FailedCardService; import com.yxproject.start.service.FailedCardService;
import net.sf.json.JSON; import com.yxproject.start.service.TaskListService;
import net.sf.json.JSONArray; import net.sf.json.JSONArray;
import net.sf.json.JSONObject; import net.sf.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
...@@ -21,6 +24,8 @@ import java.util.Map; ...@@ -21,6 +24,8 @@ import java.util.Map;
public class FailedCardApi { public class FailedCardApi {
@Autowired @Autowired
private FailedCardService failedCardService; private FailedCardService failedCardService;
@Autowired
private TaskListService taskListService;
/** /**
* 查询所有废证类型 * 查询所有废证类型
...@@ -54,13 +59,57 @@ public class FailedCardApi { ...@@ -54,13 +59,57 @@ public class FailedCardApi {
* @return * @return
*/ */
@RequestMapping("insertFailedCard") @RequestMapping("insertFailedCard")
@Transactional(rollbackFor = Exception.class)
public Boolean insertFailedCard(@RequestBody String jsonStr){ public Boolean insertFailedCard(@RequestBody String jsonStr){
JSONArray jsonarray = JSONArray.fromObject(jsonStr); JSONArray jsonarray = JSONArray.fromObject(jsonStr);
for (Object o:jsonarray){ for (Object o:jsonarray){
JSONObject jsonObject =(JSONObject)o; JSONObject jsonObject =(JSONObject)o;
Map<String,Object> idMap= failedCardService.selectCountIdByCardId(jsonObject.get("cardId").toString()); Map<String,Object> idMap= failedCardService.selectCountIdByCardId(jsonObject.getString("cardId"));
failedCardService.insertFailedCard(jsonObject.get("failedCardReasonId").toString(),idMap.get("acceptNo").toString(),idMap.get("taskId").toString(),jsonObject.get("initiator").toString(),jsonObject.get("note").toString()); failedCardService.insertFailedCard(jsonObject.getString("failedCardReasonId"),idMap.get("ACCEPT_NO").toString(),idMap.get("TASK_ID").toString(),jsonObject.getString("initiator"),jsonObject.getString("note"));
} }
return true;
}
/**
* 查询所有废证类型
* @return
*/
@RequestMapping("selectRemainingCardDic")
public List<String> selectRemainingCardDic(){
List<String> resultList= failedCardService.selectFailedCardDic();
return resultList;
}
/**
* 生成余证(每个余证生成一个任务单)
* @param jsonStr
* @return
*/
@RequestMapping("insertRemaining")
@Transactional(rollbackFor = Exception.class)
public Boolean insertRemaining(@RequestBody String jsonStr){
JSONArray jsonarray = JSONArray.fromObject(jsonStr);
TaskEntity taskEntity = new TaskEntity();
List<Object> taskEntityList = new ArrayList<>();
//TODO 多张余证可以生成一张任务单 判断是否是同一个countyCode
for (Object o:jsonarray) {
JSONObject jsonObject =(JSONObject)o;
/*查询生成任务单需要的数据*/
Map<String,Object> resultMap= failedCardService.selectTaskListDate(jsonObject.getString("ACCEPT_NO"));
String countyCode = resultMap.get("COUNTY_CODE").toString();
Long cardType = (Long) resultMap.get("CARD_TYPE_ID");
taskEntity.setCountyCode(countyCode);
taskEntity.setCardType(cardType);
taskEntity.setTaskStateId((long) 1);
taskEntityList.add(taskEntity);
taskListService.saveTask(taskEntity);
/*特证表添加特证*/
failedCardService.addSpecialCard(jsonObject.getString("ACCEPT_NO"));
/*特证数+1*/
failedCardService.specialCardAdd(jsonObject.getString("ACCEPT_NO"));
}
return true; return true;
} }
......
package com.yxproject.start.mapper; package com.yxproject.start.mapper;
import org.apache.ibatis.annotations.Insert; import org.apache.ibatis.annotations.*;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.omg.CORBA.PUBLIC_MEMBER; import org.omg.CORBA.PUBLIC_MEMBER;
import java.util.List; import java.util.List;
...@@ -44,7 +41,7 @@ public interface FailedCardMapper { ...@@ -44,7 +41,7 @@ public interface FailedCardMapper {
* @param note * @param note
* @return * @return
*/ */
@Insert("INSERT INTO FAILED_CARD (FAILED_CARD_REASON_ID,ACCEPT_NO,TASK_ID,STATE,INITIATOR,NOTE) VALUES (#{failedCardReasonId},#{acceptNo},#{taskId},0,#{initiator},#{note})\n") @Insert("INSERT INTO FAILED_CARD (FAILED_CARD_REASON_ID,ACCEPT_NO,TASK_ID,STATE,INITIATOR,NOTE) VALUES (#{failedCardReasonId},#{acceptNo},#{taskId},1,#{initiator},#{note})\n")
public boolean insertFailedCard(@Param("failedCardReasonId")String failedCardReasonId,@Param("acceptNo")String acceptNo,@Param("taskId")String taskId,@Param("initiator")String initiator,@Param("note")String note); public boolean insertFailedCard(@Param("failedCardReasonId")String failedCardReasonId,@Param("acceptNo")String acceptNo,@Param("taskId")String taskId,@Param("initiator")String initiator,@Param("note")String note);
...@@ -54,4 +51,32 @@ public interface FailedCardMapper { ...@@ -54,4 +51,32 @@ public interface FailedCardMapper {
"WHERE PROD_CARD_T.ID_NO=#{cardId} or PROD_CARD_T.ACCEPT_NO=#{cardId}") "WHERE PROD_CARD_T.ID_NO=#{cardId} or PROD_CARD_T.ACCEPT_NO=#{cardId}")
public Map<String,Object> selectCountIdByCardId(String cardId); public Map<String,Object> selectCountIdByCardId(String cardId);
/*余证*/
@Update("update group_no \n" +
"set group_no.SPECIAL_CARD_COUNT=group_no.SPECIAL_CARD_COUNT+1 \n" +
"where group_no.group_no=(select group_no from PROD_CARD_T@PROD_LINK \n" +
"left join group_no on group_no.GROUP_NO=subStr(PROD_CARD_T.ACCEPT_NO,0,8)\n" +
"where PROD_CARD_T.accept_no =#{acceptNo}) ")
public boolean specialCardAdd(@Param("acceptNo")String acceptNo);
@Insert("insert into SPECIAL_CARD (ACCEPT_NO,TASK_ID,SPECIAL_TYPE,GROUP_NO,INITIATOR,FILL_IN_DATE,REMARK)\n" +
"values(\n" +
"#{acceptNo},(select TASK_ID from group_no where group_no=subStr(#{acceptNo})),1," +
"subStr(#{acceptNo}),#{initiator},#{date},#{remark})\n")
public boolean addSpecialCard(@Param("acceptNo")String acceptNo);
@Select("select SPECIAL_CARD.SPECIAL_TYPE,subStr(prod_card_t.UPLOAD_NO,0,6),SPECIAL_CARD.INITIATOR,PREPRO_PERSON.CARD_TYPE_ID\n" +
"from prod_card_t@prod_link\n" +
"left join SPECIAL_CARD on prod_card_t.accept_no = SPECIAL_CARD.accept_no\n" +
"left join PREPRO_PERSON on PREPRO_PERSON.JMSFZSLH=prod_card_t.UPLOAD_NO\n" +
"where prod_card_t.accept_no=#{acceptNo}")
public Map<String,Object> selectTaskListDate(String acceptNo);
} }
package com.yxproject.start.service; package com.yxproject.start.service;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.omg.CORBA.PUBLIC_MEMBER;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -15,4 +14,10 @@ public interface FailedCardService { ...@@ -15,4 +14,10 @@ public interface FailedCardService {
public boolean insertFailedCard(@Param("failedCardReasonId")String failedCardReasonId,@Param("acceptNo")String acceptNo,@Param("taskId")String taskId,@Param("initiator")String initiator,@Param("note")String note); public boolean insertFailedCard(@Param("failedCardReasonId")String failedCardReasonId,@Param("acceptNo")String acceptNo,@Param("taskId")String taskId,@Param("initiator")String initiator,@Param("note")String note);
public Map<String,Object> selectCountIdByCardId(String cardId); public Map<String,Object> selectCountIdByCardId(String cardId);
public boolean specialCardAdd(@Param("acceptNo") String acceptNo);
public boolean addSpecialCard(@Param("acceptNo")String acceptNo);
public Map<String, Object> selectTaskListDate(@Param("acceptNo")String acceptNo);
} }
...@@ -35,4 +35,24 @@ public class FailedCardServiceImpl implements FailedCardService { ...@@ -35,4 +35,24 @@ public class FailedCardServiceImpl implements FailedCardService {
Map<String, Object> result= failedCardMapper.selectCountIdByCardId(cardId); Map<String, Object> result= failedCardMapper.selectCountIdByCardId(cardId);
return result; return result;
} }
@Override
public boolean specialCardAdd(String acceptNo) {
failedCardMapper.specialCardAdd(acceptNo);
return true;
}
@Override
public boolean addSpecialCard(String acceptNo) {
failedCardMapper.addSpecialCard(acceptNo);
return true;
}
@Override
public Map<String, Object> selectTaskListDate(String acceptNo) {
Map<String, Object>resultList =failedCardMapper.selectTaskListDate(acceptNo);
return resultList;
}
} }
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