Commit 77941d3c authored by suichenguang's avatar suichenguang

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

parents ed41c098 ba70812b
......@@ -150,19 +150,20 @@ public class TaskListApi {
JSONObject jsonObject = JSONObject.fromObject(str);
String date = jsonObject.getString("date");
String name = jsonObject.getString("name");
// String process = jsonObject.getString("tag");
JSONArray jsonCounty = jsonObject.getJSONArray("countyList");
JSONArray jsonGroup = jsonObject.getJSONArray("groupList");
List<Map<String,Object>> countyList =(List<Map<String,Object>>)jsonCounty;
List<String> groupList =(List<String>)jsonGroup;
//正常生成区县任务单
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);
boolean b = taskListService.saveTask(objects,name);
List<Object> objects = taskListService.selectGroupAtACCU(replaceDate(date), typeCode, countyCode);
boolean b = taskListService.saveTask(objects,name,0+"");
}
//生成某几个组的区县任务单
if (groupList.size()>0){
if (jsonGroup.size()>0){
List<String> groupList =(List<String>)jsonGroup;
//查询组号详情
String groupNo = "(";
for ( int i= 0; i<groupList.size();i++){
......@@ -173,7 +174,7 @@ public class TaskListApi {
}
}
List<Object> objects = taskListService.selectGroupAtACCU(groupNo);
boolean b = taskListService.saveTask(objects,name);
boolean b = taskListService.saveTask(objects,name,0+"");
}
//todo 保存任务单数据
return "成功生成循环单";
......
......@@ -40,7 +40,9 @@ public interface TaskListMapper {
"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 to_char(ACC_GROUP_T.IMPORT_TIME,'yyyyMMdd')=#{submitDate}")
"where county_dic.COUNTY_CODE is not null " +
"and ACC_GROUP_T.group_no not in (select group_no from group_no)" +
" and to_char(ACC_GROUP_T.IMPORT_TIME,'yyyyMMdd')=#{submitDate}")
public List<Map<String,Object>> selectByCountyAtACCU(@Param("submitDate") String submitDate);
/**
......@@ -58,7 +60,9 @@ public interface TaskListMapper {
"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 = #{countyCode} and to_char(ACC_GROUP_T.IMPORT_TIME,'yyyyMMdd')=#{date}" +
"where county_dic.COUNTY_CODE = #{countyCode} and " +
" and ACC_GROUP_T.group_no not in (select group_no from group_no) " +
"to_char(ACC_GROUP_T.IMPORT_TIME,'yyyyMMdd')=#{date}" +
" and PREPRO_PERSON.card_type_id = #{typeCode}" +
") a ) where rn BETWEEN #{minNum} and #{maxNum}")
public List<Map<String,Object>> selectByGroupNoAtACCU(@Param("date") String date,@Param("typeCode")String typeCode,@Param("countyCode")String countyCode,@Param("maxNum")long maxNum,@Param("minNum")long minNum );
......@@ -122,7 +126,7 @@ public interface TaskListMapper {
* @param taskEntity 任务单
* @return
*/
@Insert("insert into task (CARD_TYPE,COUNTY_CODE,SUBMIT_NAME) values(#{cardType},#{countyCode},#{submitName})")
@Insert("insert into task (CARD_TYPE,COUNTY_CODE,SUBMIT_NAME,TASK_STATE_ID) values(#{cardType},#{countyCode},#{submitName},#{taskStateId})")
@Options(useGeneratedKeys=true, keyProperty="taskId", keyColumn="TASK_ID")
public boolean saveTask(TaskEntity taskEntity);
......@@ -130,13 +134,48 @@ public interface TaskListMapper {
/**
* 循环单查询
* 辅助库
* @param date 查询时间
* 辅助库 大批证
* @param process 工序
* @return
*/
@Select("select task.task_id,CARD_TYPE_DIC.CARD_TYPE,CARD_TYPE_DIC.CARD_TYPE_ID,COUNTY_DIC.COUNTY_CODE,\n" +
"COUNTY_DIC.COUNTYNAME, group_no.VALID_COUNT,group_no.INVALID_COUNT,group_no.SPECIAL_CARD_COUNT,group_no.GROUP_NO, nvl(fc.faileCount,0) faileCount\n" +
"from group_no left join task on group_no.task_id= task.TASK_ID\n" +
"left join CARD_TYPE_DIC on CARD_TYPE_DIC.CARD_TYPE_ID = task.CARD_TYPE\n" +
"left join COUNTY_DIC on COUNTY_DIC.COUNTY_CODE = task.COUNTY_CODE\n" +
"left join (select task_id, nvl(count(*),0) faileCount from FAILED_CARD group by task_id ) fc on fc.TASK_ID = task.TASK_ID\n" +
"where task.TASK_STATE_ID = #{process}")
public List<Map<String,Object>> selectByCountyAtAuxiliary_common(@Param("process") String process);
/**
* 循环单查询
* 辅助库 快证
* @param process 工序
* @return
*/
@Select("select SPECIAL_CARD.task_id,'快证' CARD_TYPE,'1' CARD_TYPE_ID,COUNTY_DIC.COUNTY_CODE,\n" +
"COUNTY_DIC.COUNTYNAME, 1 VALID_COUNT, 0 INVALID_COUNT,0 SPECIAL_CARD_COUNT,SPECIAL_CARD.ACCEPT_NO, nvl(fc.faileCount,0) faileCount\n" +
"from SPECIAL_CARD left join task on SPECIAL_CARD.task_id= task.TASK_ID\n" +
"left join CARD_TYPE_DIC on CARD_TYPE_DIC.CARD_TYPE_ID = task.CARD_TYPE\n" +
"left join COUNTY_DIC on COUNTY_DIC.COUNTY_CODE = task.COUNTY_CODE\n" +
"left join (select task_id,nvl(count(*),0) faileCount from FAILED_CARD group by task_id ) fc on fc.TASK_ID = task.TASK_ID\n" +
"where SPECIAL_CARD.SPECIAL_TYPE =2 and task.TASK_STATE_ID = #{process}")
public List<Map<String,Object>> selectByCountyAtAuxiliary_fast(@Param("process") String process);
/**
* 循环单查询
* 辅助库 余证
* @param process 工序
* @return
*/
@Select("")
public List<Map<String,Object>> selectByCountyAtAuxiliary(@Param("date") String date,@Param("process") String process);
@Select("select SPECIAL_CARD.task_id,'余证' CARD_TYPE,'99' CARD_TYPE_ID,COUNTY_DIC.COUNTY_CODE,\n" +
"COUNTY_DIC.COUNTYNAME, 1 VALID_COUNT, 0 INVALID_COUNT,0 SPECIAL_CARD_COUNT,SPECIAL_CARD.ACCEPT_NO, nvl(fc.faileCount,0) faileCount\n" +
"from SPECIAL_CARD left join task on SPECIAL_CARD.task_id= task.TASK_ID\n" +
"left join CARD_TYPE_DIC on CARD_TYPE_DIC.CARD_TYPE_ID = task.CARD_TYPE\n" +
"left join COUNTY_DIC on COUNTY_DIC.COUNTY_CODE = task.COUNTY_CODE\n" +
"left join (select task_id,nvl(count(*),0) faileCount from FAILED_CARD group by task_id ) fc on fc.TASK_ID = task.TASK_ID\n" +
"where SPECIAL_CARD.SPECIAL_TYPE =1 and task.TASK_STATE_ID = #{process}")
public List<Map<String,Object>> selectByCountyAtAuxiliary_remaind(@Param("process") String process);
......@@ -159,21 +198,22 @@ public interface TaskListMapper {
public List<TaskListEntity> selectACCU(@Param("submitDate") String submitDate,@Param("countyCode") String countyCode,@Param("Gajg_dm") String Gajg);
/**
* 生成任务单
* @param taskListEntityMap
* @return
*/
@Insert("INSERT INTO TASK (CARD_TYPE,OLD_CARD_TYPE,COUNTY_CODE,TASK_STATE_ID)VALUES(1,1,#{countyCode},0)")
public boolean createTaskList(List<TaskListEntity> taskListEntityMap);
// /**
// * 生成任务单
// * @param taskListEntityMap
// * @return
// */
// @Insert("INSERT INTO TASK (CARD_TYPE,OLD_CARD_TYPE,COUNTY_CODE,TASK_STATE_ID)VALUES(1,1,#{countyCode},0)")
// public boolean createTaskList(List<TaskListEntity> taskListEntityMap);
/**
*下发任务单
*更改任务单状态
* @param taskId
* @return
*/
//todo 更改状态
@Update("UPDATE TASK SET TASK_STATE_ID=1 WHERE TASK_ID = #{taskId} ")
public boolean updateState(@Param("taskId") String taskId);
public boolean updateState(@Param("taskId") String taskId,@Param("process") String process,@Param("name") String name);
}
......@@ -32,5 +32,5 @@ public interface TaskListService {
public boolean saveTask(TaskEntity taskEntity);
public boolean saveTask(List<Object> list,String submitName);
public boolean saveTask(List<Object> list,String submitName,String process);
}
......@@ -46,13 +46,13 @@ public class TaskListServiceImpl implements TaskListService {
@Override
public boolean createTaskList(List<TaskListEntity> resultList) {
taskListMapper.createTaskList(resultList);
// taskListMapper.createTaskList(resultList);
return true;
}
@Override
public boolean updateState(String taskId) {
taskListMapper.updateState(taskId);
// taskListMapper.updateState(taskId);
return true;
}
......@@ -97,8 +97,9 @@ public class TaskListServiceImpl implements TaskListService {
Integer invalid_count = Integer.valueOf(o.get("INVALID_COUNT") + "");
invalid_count+=Integer.valueOf(countyMap.get("countyInvalidCount").toString());
countyMap.put(o.get("COUNTYNAME")+"",countyList);
countyMap.put("countyCode",o.get("ADMINISTRATIVE_CODE"));
countyMap.put("countyCode",o.get("COUNTY_CODE"));
countyMap.put("groupCount",countyList.size());
countyMap.put("typeCode",typeCode);
countyMap.put("countyValidCount",valid_count);
countyMap.put("countyInvalidCount",invalid_count);
}else {
......@@ -106,8 +107,9 @@ public class TaskListServiceImpl implements TaskListService {
countyList.add(o);
countyMap.put(o.get("COUNTYNAME")+"",countyList);
countyMap.put("groupList",countyList);
countyMap.put("countyCode",o.get("ADMINISTRATIVE_CODE"));
countyMap.put("countyCode",o.get("COUNTY_CODE"));
countyMap.put("groupCount",countyList.size());
countyMap.put("typeCode",typeCode);
countyMap.put("countyValidCount",Integer.valueOf(o.get("VALID_COUNT")+""));
countyMap.put("countyInvalidCount",Integer.valueOf(o.get("INVALID_COUNT")+""));
}
......@@ -137,7 +139,7 @@ public class TaskListServiceImpl implements TaskListService {
}
countyMap.put("groupNum",createGroupNo(c, nsList));
}
// countyMap.remove("groupList");
countyMap.remove("groupList");
typeList.add(countyMap);
}
typeMapList.put("typeName",type);
......@@ -177,9 +179,22 @@ public class TaskListServiceImpl implements TaskListService {
*/
@Override
public List<Object> selectByCountyAtAuxiliary(String process) {
// taskListMapper
//todo 写逻辑0.0........
return null;
//查询普通组号列表 在辅助库中
List<Map<String, Object>> mapList_common = taskListMapper.selectByCountyAtAuxiliary_common(process);
//查询快证组号列表 在辅助库中
List<Map<String, Object>> mapList_fast = taskListMapper.selectByCountyAtAuxiliary_fast(process);
//查询余证组号列表 在辅助库中
List<Map<String, Object>> mapList_remaind = taskListMapper.selectByCountyAtAuxiliary_remaind(process);
List list = new ArrayList();
list = formateMap(mapList_common);
list.addAll(mapList_fast);
list.addAll(mapList_remaind);
//todo 写逻辑0.0........
return list;
}
/**
......@@ -222,12 +237,13 @@ public class TaskListServiceImpl implements TaskListService {
* @return
*/
@Override
public boolean saveTask(List<Object> list,String submitName) {
public boolean saveTask(List<Object> list,String submitName,String process) {
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);
taskEntity.setTaskStateId(Long.valueOf(process));
saveTask(taskEntity);
for (Object object :list){
Map<String,Object> map =(Map<String,Object>)object;
......@@ -275,4 +291,97 @@ public class TaskListServiceImpl implements TaskListService {
}
private List formateMap(List<Map<String, Object>> maplist){
List list = new ArrayList();
Map<String,Object> typeMap = new LinkedHashMap<>();
for (Map o :maplist){
// 组合JSON
if (typeMap!=null&typeMap.containsKey(o.get("CARD_TYPE")+"")){
List<Map<String,Object>> mapList= (List<Map<String,Object>>)typeMap.get(o.get("CARD_TYPE"));
mapList.add(o);
typeMap.put(o.get("CARD_TYPE")+"",mapList);
}else {
List<Map<String,Object>> mapList = new ArrayList<>();
mapList.add(o);
typeMap.put(o.get("CARD_TYPE")+"",mapList);
}
}
for (String type:typeMap.keySet()){
Map<String,Object> typeMapList = new LinkedHashMap<>();
List<Map<String,Object>> typeList = new ArrayList<>();
List<Map<String,Object>> mapList = (List<Map<String,Object>>)typeMap.get(type);
int typeSum =0;
String typeCode = null;
for (Map o:mapList) {
typeCode=o.get("CARD_TYPE_ID").toString();
typeSum+=Integer.valueOf(o.get("VALID_COUNT") + "");
Map<String,Object> countyMap = new LinkedHashMap<>();
if (countyMap !=null&countyMap.containsKey(o.get("COUNTYNAME")+"")){
List<Map<String,Object>> countyList= (List<Map<String,Object>>)countyMap.get(o.get("CARD_TYPE"));
countyList.add(o);
Integer valid_count = Integer.valueOf(o.get("VALID_COUNT") + "");
valid_count+=Integer.valueOf(countyMap.get("countyValidCount").toString());
Integer invalid_count = Integer.valueOf(o.get("INVALID_COUNT") + "");
invalid_count+=Integer.valueOf(countyMap.get("countyInvalidCount").toString());
Integer FAILECOUNT = Integer.valueOf(o.get("FAILECOUNT") + "");
FAILECOUNT+=Integer.valueOf(countyMap.get("faileCount").toString());
countyMap.put("faileCount",FAILECOUNT);
Integer SPECIAL_CARD_COUNT = Integer.valueOf(o.get("SPECIAL_CARD_COUNT") + "");
SPECIAL_CARD_COUNT+=Integer.valueOf(countyMap.get("specialCount").toString());
countyMap.put("specialCount",SPECIAL_CARD_COUNT);
countyMap.put(o.get("COUNTYNAME")+"",countyList);
countyMap.put("countyCode",o.get("COUNTY_CODE"));
countyMap.put("groupCount",countyList.size());
countyMap.put("typeCode",typeCode);
countyMap.put("countyValidCount",valid_count);
countyMap.put("countyInvalidCount",invalid_count);
}else {
List<Map<String,Object>> countyList = new ArrayList<>();
countyList.add(o);
countyMap.put(o.get("COUNTYNAME")+"",countyList);
countyMap.put("groupList",countyList);
countyMap.put("countyCode",o.get("COUNTY_CODE"));
countyMap.put("groupCount",countyList.size());
countyMap.put("typeCode",typeCode);
countyMap.put("faileCount",o.get("FAILECOUNT"));
countyMap.put("specialCount",o.get("SPECIAL_CARD_COUNT"));
countyMap.put("countyValidCount",Integer.valueOf(o.get("VALID_COUNT")+""));
countyMap.put("countyInvalidCount",Integer.valueOf(o.get("INVALID_COUNT")+""));
}
countyMap.put("countyName",o.get("COUNTYNAME"));
countyMap.remove(o.get("COUNTYNAME"));
List<Map<String,Object>> mapList1 = (List<Map<String,Object>>)countyMap.get("groupList");
if (mapList1.size()==1){
countyMap.put("groupNum",mapList1.get(0).get("GROUP_NO"));
}else {
List<Integer> c = new ArrayList<>();
List<Integer> nsList = new ArrayList<>();
for (int i = 0; i < mapList1.size(); i++) {
/**
* 判断组号中时候含有历史回迁组
*/
if (((( mapList1.get(i)).get("GROUP_NO")) + "").contains("L")) {
if ((((mapList1.get(i)).get("GROUP_NO")) + "").length() == 8) {
nsList.add(Integer.parseInt(((( mapList1.get(i)).get("GROUP_NO")) + "").substring(1, ((( mapList1.get(i)).get("GROUP_NO")) + "").length())));
}
} else {
if (((( mapList1.get(i)).get("GROUP_NO")) + "").length() == 8) {
nsList.add(Integer.parseInt(((( mapList1.get(i)).get("GROUP_NO")) + "")));
}
}
}
countyMap.put("groupNum",createGroupNo(c, nsList));
}
countyMap.remove("groupList");
typeList.add(countyMap);
}
typeMapList.put("typeName",type);
typeMapList.put("typeCode",typeCode);
typeMapList.put("typeSum",typeSum);
typeMapList.put("countyList",typeList);
list.add(typeMapList);
}
return list;
}
}
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