Commit 5c133e3e authored by dahai's avatar dahai

添加生成任务单API

parent 822cd78e
......@@ -13,6 +13,7 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletResponse;
import javax.transaction.Transactional;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
......@@ -102,17 +103,37 @@ public class TaskListApi {
/**
* 生成任务单
*
* @param process 工序
* @param date 查询时间
* @param name 提交人姓名
* @param groupList 组号列表
* @param countyList 区县列表 {typeCode:1,countyCode:'123456'}
* @param resp
* @return
*/
@RequestMapping("createTask")
public String queryByCountyAtACCU(@RequestParam("process") String process,@RequestParam("date") String date,@RequestParam("groupList") List<String> groupList,@RequestParam("countyList") String countyList, HttpServletResponse resp){
// taskListService.selectGrouoAtACCU()
return null;
@Transactional
public String queryByCountyAtACCU(@RequestParam("date") String date,@RequestParam("name") String name,@RequestParam("groupList") List<String> groupList,@RequestParam("countyList") List<Map<String,Object>> countyList, HttpServletResponse resp){
for (Map<String,Object> map :countyList){
String typeCode = map.get("typeCode").toString();
String countyCode = map.get("countyCode").toString();
List<Object> objects = taskListService.selectGroupAtACCU(date, typeCode, countyCode);
//todo 保存任务单数据
boolean b = taskListService.saveTask(objects,name);
}
//查询组号详情
String groupNo = "(";
for ( int i= 0; i<groupList.size();i++){
if (i!=groupList.size()-1){
groupNo=groupNo+groupList.get(i)+",";
}else {
groupNo=groupNo+groupList.get(i)+")";
}
}
List<Object> objects = taskListService.selectGroupAtACCU(groupNo);
boolean b = taskListService.saveTask(objects,name);
//todo 保存任务单数据
return "成功生成循环单";
}
......
......@@ -60,14 +60,31 @@ public interface TaskListMapper {
"left join county_dic on substr(PREPRO_PERSON.JMSFZSLH,0,6)= county_dic.COUNTY_CODE\n" +
"where county_dic.COUNTY_CODE is not null and ACC_GROUP_T.deal_flag =3 and to_char(ACC_GROUP_T.IMPORT_TIME,'yyyyMMdd')= #{date}\n" +
"and PREPRO_PERSON.card_type_id =#{typeCode} and substr(PREPRO_PERSON.JMSFZSLH,0,6) =#{countyCode}")
public List<Map<String,Object>> selectGrouoAtACCU(@Param("date") String date,@Param("typeCode") String typeCode,@Param("countyCode") String countyCode);
public List<Map<String,Object>> selectGroupAtACCUByCountyCode(@Param("date") String date,@Param("typeCode") String typeCode,@Param("countyCode") String countyCode);
/**
* 查询组号列表
* 受理库
* @param groupNo 组号信息
* @return
*/
@Select("select DISTINCT CARD_TYPE_DIC.card_type_id, ACC_GROUP_T.group_no ,ACC_GROUP_T.valid_count,ACC_GROUP_T.invalid_count, county_dic.county_code\n" +
"from ACC_CARD_T@ACCU_LINK \n" +
"left join PREPRO_PERSON on PREPRO_PERSON.JMSFZSLH = acc_card_t.upload_no \n" +
"left join ACC_GROUP_T@ACCU_LINK on substr(acc_card_t.accept_no,0,8) = ACC_GROUP_T.group_no\n" +
"left join CARD_TYPE_DIC on PREPRO_PERSON.card_type_id = CARD_TYPE_DIC.CARD_TYPE_ID\n" +
"left join county_dic on substr(PREPRO_PERSON.JMSFZSLH,0,6)= county_dic.COUNTY_CODE\n" +
"where county_dic.COUNTY_CODE is not null and ACC_GROUP_T.deal_flag =3 and" +
" ACC_GROUP_T in #{groupNo} ")
public List<Map<String,Object>> selectGroupAtACCUByGroupNo(@Param("groupNo") String groupNo);
/**
* 生成任务单
* @param taskEntity 任务单
* @return
*/
@Insert("insert into task (CARD_TYPE,COUNTY_CODE,SUBMIT_DATE,SUBMIT_NAME) values(#{cardType},#{countyCode},#{submitDate},#{submitName})")
@Insert("insert into task (CARD_TYPE,COUNTY_CODE,SUBMIT_DATE,SUBMIT_NAME) values(#{cardType},#{countyCode},to_date(#{submitDate},'yyyyMMddhhmmss'),#{submitName})")
@Options(useGeneratedKeys=true, keyProperty="taskId", keyColumn="TASK_ID")
public boolean saveTask(TaskEntity taskEntity);
......
......@@ -22,7 +22,11 @@ public interface TaskListService {
public List<Object> selectByCountyAtACCU(String date);
public List<Object> selectGrouoAtACCU(String date,String typeCode,String countyCode);
public List<Object> selectGroupAtACCU(String date,String typeCode,String countyCode);
public List<Object> selectGroupAtACCU(String groupNo);
public boolean saveTask(TaskEntity taskEntity);
public boolean saveTask(List<Object> list,String submitName);
}
package com.yxproject.start.service.impl;
import com.yxproject.start.entity.GroupNoEntity;
import com.yxproject.start.entity.TaskEntity;
import com.yxproject.start.entity.TaskList.CountCountyEntity;
import com.yxproject.start.entity.TaskList.CountGajgEntity;
import com.yxproject.start.entity.TaskList.TaskListEntity;
import com.yxproject.start.mapper.GroupNoMapper;
import com.yxproject.start.mapper.TaskListMapper;
import com.yxproject.start.service.TaskListService;
import org.apache.ibatis.annotations.Mapper;
......@@ -20,6 +22,8 @@ import java.util.Map;
public class TaskListServiceImpl implements TaskListService {
@Autowired
private TaskListMapper taskListMapper;
@Autowired
private GroupNoMapper groupNoMapper;
@Override
public List<CountCountyEntity> selectByCounty(String submitDate) {
......@@ -154,8 +158,19 @@ public class TaskListServiceImpl implements TaskListService {
* @return
*/
@Override
public List selectGrouoAtACCU(String date,String typeCode,String countyCode) {
return taskListMapper.selectGrouoAtACCU(date,typeCode,countyCode);
public List selectGroupAtACCU(String date,String typeCode,String countyCode) {
return taskListMapper.selectGroupAtACCUByCountyCode(date,typeCode,countyCode);
}
/**
* 查询组号信息
* 受理库
* @param groupNo 受理组号
* @return
*/
@Override
public List selectGroupAtACCU(String groupNo) {
return taskListMapper.selectGroupAtACCUByGroupNo(groupNo);
}
/**
......@@ -168,6 +183,32 @@ public class TaskListServiceImpl implements TaskListService {
return taskListMapper.saveTask(taskEntity);
}
/**
* 保存循环单
* @param list
* @return
*/
@Override
public boolean saveTask(List<Object> list,String submitName) {
Map<String,Object> stringObjectMap =(Map<String,Object>)list.get(0);
TaskEntity taskEntity = new TaskEntity();
taskEntity.setCardType(Long.valueOf(stringObjectMap.get("CARD_TYPE_ID")+""));
taskEntity.setCountyCode(stringObjectMap.get("COUNTY_CODE")+"");
taskEntity.setSubmitName(submitName);
saveTask(taskEntity);
for (Object object :list){
Map<String,Object> map =(Map<String,Object>)object;
GroupNoEntity groupNoEntity = new GroupNoEntity();
groupNoEntity.setGroupNo(map.get("GROUP_NO")+"");
groupNoEntity.setInvalidCount(Long.valueOf(map.get("INVALID_COUNT")+""));
groupNoEntity.setValidCount(Long.valueOf(map.get("VALID_COUNT")+""));
groupNoEntity.setSpecialCardCount((long)0);
groupNoEntity.setTaskId(taskEntity.getTaskId());
groupNoMapper.saveGroupNo(groupNoEntity);
}
return true;
}
private String createGroupNo(List<Integer> c, List<Integer> nsList) {
try {
String groupNo = "";
......
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