Commit 0298d6d4 authored by Administrator's avatar Administrator

修改了CityList的格式,将groupNo合并;

修改了countyList的FINISH_COUNT,改为(IN_STORAGE_COUNT + OUT_STORAGE_COUNT) AS FINISH_COUNT;
parent 527d107c
......@@ -32,7 +32,7 @@ public class CityListEntity {
private long printerId;
private String cityName;
private long groupCount;
private long groupNo;
private String groupNo;
private long validCount;
private long invalidCount;
......@@ -244,11 +244,11 @@ public class CityListEntity {
@Basic
@Column(name = "groupNo", nullable = true, precision = 0)
public long getGroupNo() {
public String getGroupNo() {
return groupNo;
}
public void setGroupNo(long groupNo) {
public void setGroupNo(String groupNo) {
this.groupNo = groupNo;
}
......
package com.yxproject.start.service.impl;
import com.yxproject.start.entity.CityListEntity;
import com.yxproject.start.entity.GroupListEntity;
import com.yxproject.start.mapper.GroupNoMapper;
import com.yxproject.start.mapper.TaskMapper;
import com.yxproject.start.service.CityListService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.*;
/**
* Created by Administrator on 2018/12/19.
......@@ -18,11 +18,66 @@ public class CityListServiceImpl implements CityListService {
@Autowired
public TaskMapper taskMapper;
@Autowired
public GroupNoMapper groupNoMapper;
private String createGroupNo(List<Integer> c, List<Integer> nsList) {
try {
String groupNo = "";
c.add(nsList.get(0));
Collections.sort(nsList);
for (int i = 0; i < nsList.size() - 1; ++i) {
if (nsList.get(i) + 1 == nsList.get(i + 1)) {
c.add(nsList.get(i));
} else {
Collections.sort(c);
if (c.size() >= 1) {
if (c.size() == 1) {
groupNo += c.get(0) + ",";
} else {
groupNo += c.get(0) + "-" + c.get(c.size() - 1) + ",";
}
}
c.clear();
c.add(nsList.get(i + 1));
}
}
Collections.sort(c);
if (c.size() >= 1) {
if (c.size() == 1) {
groupNo += c.get(0) + ",";
} else {
groupNo += c.get(0) + "-" + c.get(c.size() - 1) + ",";
}
}
return groupNo;
} catch (Exception e) {
}
return "";
}
@Override
public List <CityListEntity> findCityList( String taskStateId ,String cardType) {
List <CityListEntity> cityList =taskMapper.findCityList(taskStateId, cardType);
return cityList;
List<CityListEntity> list1 = taskMapper.findCityList(taskStateId,cardType);
List<CityListEntity> list2 = new ArrayList<CityListEntity>();
for (CityListEntity cityListEntity : list1) {
List <GroupListEntity> groupListEntities=groupNoMapper.findGroupListByTaskId(cityListEntity.getTaskId() + "");
if(groupListEntities.size() == 1 ){
cityListEntity.setGroupNo(String.valueOf(groupListEntities.get(0).getGroupNo()));
} else if(groupListEntities.size() > 1 ){
List<Integer> c = new ArrayList<>();
List<Integer> nsList = new ArrayList<>();
for (int i = 0; i < groupListEntities.size(); i++){
nsList.add(Integer.parseInt( groupListEntities.get(i).getGroupNo()+"" ));
}
cityListEntity.setGroupCount(nsList.size());
cityListEntity.setGroupNo(createGroupNo(c, nsList));
}else {
cityListEntity.setGroupNo("");
}
list2.add(cityListEntity);
}
return list2;
}
}
......@@ -15,9 +15,9 @@
<!--Insert into DAHAI.SYS_PERMISSION (ID,AVAILABLE,NAME,PARENT_ID,PARENT_IDS,PERMISSION,RESOURCE_TYPE,URL) values (PERMISSION_seq.nextval,0,#{name},#{parentId},#{parentIds},#{permission},#{resourceType},#{url})-->
<!--</insert>-->
<select id="findCountyList" resultType="com.yxproject.start.entity.CountyEntity" parameterType="String">
SELECT COUNTY_LIST.COUNTY_CODE,FINISH_COUNT,IN_STORAGE_COUNT,OUT_STORAGE_COUNT,COUNTY_DIC.COUNTYNAME FROM COUNTY_LIST
LEFT JOIN TASK ON COUNTY_LIST.TASK_ID = TASK.TASK_ID
LEFT JOIN COUNTY_DIC ON COUNTY_LIST.COUNTY_CODE = COUNTY_DIC.COUNTY_CODE
SELECT COUNTY_LIST.COUNTY_CODE,(IN_STORAGE_COUNT + OUT_STORAGE_COUNT) AS FINISH_COUNT,IN_STORAGE_COUNT,OUT_STORAGE_COUNT,COUNTY_DIC.COUNTYNAME FROM COUNTY_LIST
LEFT JOIN TASK ON COUNTY_LIST.TASK_ID = TASK.TASK_ID
LEFT JOIN COUNTY_DIC ON COUNTY_LIST.COUNTY_CODE = COUNTY_DIC.COUNTY_CODE
WHERE TASK.TASK_ID=#{taskId}
</select>
......
......@@ -95,13 +95,13 @@
GROUP BY CARD_TYPE_DIC.CARD_TYPE,TASK.CARD_TYPE
</select>
<select id="findCityList" resultType="com.yxproject.start.entity.CityListEntity">
SELECT CARD_TYPE AS cardType,TASK.CITYCODE AS citycode,CITYNAME AS cityName,sum(VALID_COUNT) AS validCount,sum(INVALID_COUNT) AS invalidCount,COUNT(GROUP_NO) AS groupCount,GROUP_NO AS groupNo,TASK.TASK_ID AS taskId,OLD_CARD_TYPE AS oldCardType,SUBMIT_DATE AS submitDate,ISSUED_DATE AS issuedDate,PRINT_STATE AS printState,DOWNLOAD_DATE AS downloadDate,PRINT_OUT_DATE AS printOutDate,POSITION_DATE AS positionDate,OUT_WORKSHOP_DATE AS outWorkshopDate,QUALITY_PEOPLE_NAME AS qualityPeopleName,QUALITY_TEST_DATE AS qualityTestDate,EXCEPTION_INFORMATION AS exceptionInformation,OUT_STORAGE_DATE AS outStorageDate,IN_STORAGE_DATE AS inStorageDate,TASK_STATE_ID AS taskStateId,IS_EXCEPTION AS isException,PRINTER_ID AS printerId
from (select sum(VALID_COUNT),sum(INVALID_COUNT),COUNT(GROUP_NO),TASK_ID,GROUP_NO,SPECIAL_CARD_COUNT,VALID_COUNT,INVALID_COUNT from GROUP_NO group by TASK_ID,GROUP_NO,SPECIAL_CARD_COUNT,VALID_COUNT,INVALID_COUNT ) GROUP_NO
left join TASK on GROUP_NO.TASK_ID = TASK.TASK_ID
left join (SELECT CITYCODE,CITYNAME FROM CITY_DIC) CITY_DIC on CITY_DIC.CITYCODE = TASK.CITYCODE
<select id="findCityList" resultType="com.yxproject.start.entity.CityListEntity" parameterType="String">
SELECT CARD_TYPE AS cardType,TASK.CITYCODE AS citycode,CITYNAME AS cityName,sum(VALID_COUNT) AS validCount,sum(INVALID_COUNT) AS invalidCount,COUNT(GROUP_NO) AS groupCount,TASK.TASK_ID AS taskId,OLD_CARD_TYPE AS oldCardType,SUBMIT_DATE AS submitDate,ISSUED_DATE AS issuedDate,PRINT_STATE AS printState,DOWNLOAD_DATE AS downloadDate,PRINT_OUT_DATE AS printOutDate,POSITION_DATE AS positionDate,OUT_WORKSHOP_DATE AS outWorkshopDate,QUALITY_PEOPLE_NAME AS qualityPeopleName,QUALITY_TEST_DATE AS qualityTestDate,EXCEPTION_INFORMATION AS exceptionInformation,OUT_STORAGE_DATE AS outStorageDate,IN_STORAGE_DATE AS inStorageDate,TASK_STATE_ID AS taskStateId,IS_EXCEPTION AS isException,PRINTER_ID AS printerId
from TASK
left join (select sum(VALID_COUNT),sum(INVALID_COUNT),COUNT(GROUP_NO),TASK_ID,GROUP_NO,SPECIAL_CARD_COUNT,VALID_COUNT,INVALID_COUNT from GROUP_NO group by TASK_ID,GROUP_NO,SPECIAL_CARD_COUNT,VALID_COUNT,INVALID_COUNT ) GROUP_NO on GROUP_NO.TASK_ID = TASK.TASK_ID
left join (SELECT CITYCODE,CITYNAME FROM CITY_DIC) CITY_DIC on CITY_DIC.CITYCODE = TASK.CITYCODE
where CARD_TYPE=#{cardType} and TASK_STATE_ID = #{taskStateId}
GROUP BY CARD_TYPE,TASK.CITYCODE,CITYNAME,GROUP_NO,TASK.TASK_ID,OLD_CARD_TYPE,SUBMIT_DATE,ISSUED_DATE,PRINT_STATE,DOWNLOAD_DATE,PRINT_OUT_DATE,POSITION_DATE,OUT_WORKSHOP_DATE,QUALITY_PEOPLE_NAME,QUALITY_TEST_DATE,EXCEPTION_INFORMATION,OUT_STORAGE_DATE,IN_STORAGE_DATE,TASK_STATE_ID,IS_EXCEPTION,PRINTER_ID
GROUP BY CARD_TYPE,TASK.CITYCODE,CITYNAME,TASK.TASK_ID,OLD_CARD_TYPE,SUBMIT_DATE,ISSUED_DATE,PRINT_STATE,DOWNLOAD_DATE,PRINT_OUT_DATE,POSITION_DATE,OUT_WORKSHOP_DATE,QUALITY_PEOPLE_NAME,QUALITY_TEST_DATE,EXCEPTION_INFORMATION,OUT_STORAGE_DATE,IN_STORAGE_DATE,TASK_STATE_ID,IS_EXCEPTION,PRINTER_ID
</select>
......
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