Commit c0327450 authored by dahai's avatar dahai

添加查询任务单 在辅助库中

parent 79923c56
......@@ -153,7 +153,6 @@ public class TaskListApi {
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();
......@@ -162,7 +161,8 @@ public class TaskListApi {
boolean b = taskListService.saveTask(objects,name);
}
//生成某几个组的区县任务单
if (groupList.size()>0){
if (jsonGroup.size()>0){
List<String> groupList =(List<String>)jsonGroup;
//查询组号详情
String groupNo = "(";
for ( int i= 0; i<groupList.size();i++){
......
......@@ -130,13 +130,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);
......
......@@ -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;
}
/**
......@@ -275,4 +290,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