Commit 9e8ff74c authored by suichenguang's avatar suichenguang

添加余证

parent 6c885d7a
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.entity.TaskList.TaskListEntity;
import com.yxproject.start.service.FailedCardService; import com.yxproject.start.service.FailedCardService;
import com.yxproject.start.service.TaskListService; 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;
...@@ -57,6 +59,7 @@ public class FailedCardApi { ...@@ -57,6 +59,7 @@ 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){
...@@ -69,25 +72,33 @@ public class FailedCardApi { ...@@ -69,25 +72,33 @@ public class FailedCardApi {
/** /**
* 生成余证 * 生成余证(每个余证生成一个任务单)
* @param jsonStr * @param jsonStr
* @return * @return
*/ */
@RequestMapping("insertRemaining") @RequestMapping("insertRemaining")
@Transactional(rollbackFor = Exception.class)
public Boolean insertRemaining(@RequestBody String jsonStr){ public Boolean insertRemaining(@RequestBody String jsonStr){
JSONArray jsonarray = JSONArray.fromObject(jsonStr); JSONArray jsonarray = JSONArray.fromObject(jsonStr);
for (Object o:jsonarray) { TaskEntity taskEntity = new TaskEntity();
JSONObject jsonObject =(JSONObject)o; List<Object> taskEntityList = new ArrayList<>();
//TODO 多张余证可以生成一张任务单 判断是否是同一个countyCode
// failedCardService.addSpecialCard(acceptNo); for (Object o:jsonarray) {
// failedCardService.specialCardAdd(acceptNo); JSONObject jsonObject =(JSONObject)o;
// taskListService.createTaskList(submitDate,countyCode,Gajg); /*查询生成任务单需要的数据*/
// List<TaskListEntity> resultList= taskListService.selectACCU(submitDate,countyCode,Gajg); Map<String,Object> resultMap= failedCardService.selectTaskListDate(jsonObject.getString("ACCEPT_NO"));
// taskListService.createTaskList(resultList); 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;
} }
......
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