Commit 04b59381 authored by liuxinben's avatar liuxinben

修改组号的压缩方法

parent 39790f8f
...@@ -420,23 +420,23 @@ public class ReceiptServiceImpl implements ReceiptService { ...@@ -420,23 +420,23 @@ public class ReceiptServiceImpl implements ReceiptService {
if (countyMapList.size() == 1) { if (countyMapList.size() == 1) {
countyMapGroup.put("groupNum", countyMapList.get(0).get("QR_CODE")); countyMapGroup.put("groupNum", countyMapList.get(0).get("QR_CODE"));
} else { } else {
List<Integer> c = new ArrayList<>(); List<String> c = new ArrayList<>();
List<Integer> nsList = new ArrayList<>(); List<String> nsList = new ArrayList<>();
for (int i = 0; i < countyMapList.size(); i++) { for (int i = 0; i < countyMapList.size(); i++) {
/** /**
* 判断组号中时候含有历史回迁组 * 判断组号中时候含有历史回迁组
*/ */
if ((((countyMapList.get(i)).get("QR_CODE")) + "").contains("L")) { if ((((countyMapList.get(i)).get("QR_CODE")) + "").contains("L")) {
if ((((countyMapList.get(i)).get("QR_CODE")) + "").length() == 8) { if ((((countyMapList.get(i)).get("QR_CODE")) + "").length() == 8) {
nsList.add(Integer.parseInt((((countyMapList.get(i)).get("QR_CODE")) + "").substring(1, (((countyMapList.get(i)).get("QR_CODE")) + "").length()))); nsList.add((((countyMapList.get(i)).get("QR_CODE")) + "").substring(1, (((countyMapList.get(i)).get("QR_CODE")) + "").length()));
} }
} else { } else {
if ((((countyMapList.get(i)).get("QR_CODE")) + "").length() == 8) { if ((((countyMapList.get(i)).get("QR_CODE")) + "").length() == 8) {
nsList.add(Integer.parseInt((((countyMapList.get(i)).get("QR_CODE")) + "").substring(1, (((countyMapList.get(i)).get("QR_CODE")) + "").length()))); nsList.add((((countyMapList.get(i)).get("QR_CODE")) + "").substring(1, (((countyMapList.get(i)).get("QR_CODE")) + "").length()));
} }
} }
} }
countyMapGroup.put("groupNum", createGroupNo(c, nsList)); countyMapGroup.put("groupNum", createGroupNoMiss(c, nsList));
} }
countyMapGroup.put("countyCode", countyCode); countyMapGroup.put("countyCode", countyCode);
countyMapGroup.put("policeList", countyMapList); countyMapGroup.put("policeList", countyMapList);
...@@ -454,12 +454,16 @@ public class ReceiptServiceImpl implements ReceiptService { ...@@ -454,12 +454,16 @@ public class ReceiptServiceImpl implements ReceiptService {
return typeList; return typeList;
} }
private String createGroupNo(List<Integer> c, List<Integer> nsList) { private String createGroupNoMiss(List<String> c, List<String> nsList) {
try { try {
String groupNo = ""; String groupNo = "";
c.add(nsList.get(0)); c.add(nsList.get(0));
for (int i = 0; i < nsList.size() - 1; ++i) { for (int i = 0; i < nsList.size() - 1; ++i) {
if (nsList.get(i) + 1 == nsList.get(i + 1)) { String t = nsList.get(i);
String n = nsList.get(i + 1);
String l = String.valueOf(Integer.parseInt(t.substring(1,8))+1);
String m = n.substring(1,8);
if (l.equals(m)) {
c.add(nsList.get(i + 1)); c.add(nsList.get(i + 1));
} else { } else {
if (c.size() >= 1) { if (c.size() >= 1) {
......
...@@ -205,25 +205,25 @@ public class TaskListServiceImpl implements TaskListService { ...@@ -205,25 +205,25 @@ public class TaskListServiceImpl implements TaskListService {
if (countyMapList.size() == 1) { if (countyMapList.size() == 1) {
countyMapGroup.put("groupNum", countyMapList.get(0).get("GROUP_NO")); countyMapGroup.put("groupNum", countyMapList.get(0).get("GROUP_NO"));
} else { } else {
List<Integer> c = new ArrayList<>(); List<String> c = new ArrayList<>();
List<Integer> nsList = new ArrayList<>(); List<String> nsList = new ArrayList<>();
for (int i = 0; i < countyMapList.size(); i++) { for (int i = 0; i < countyMapList.size(); i++) {
/** /**
* 判断组号中时候含有历史回迁组 * 判断组号中时候含有历史回迁组
*/ */
if ((((countyMapList.get(i)).get("GROUP_NO")) + "").contains("L")) { if ((((countyMapList.get(i)).get("GROUP_NO")) + "").contains("L")) {
if ((((countyMapList.get(i)).get("GROUP_NO")) + "").length() == 8) { if ((((countyMapList.get(i)).get("GROUP_NO")) + "").length() == 8) {
nsList.add(Integer.parseInt((((countyMapList.get(i)).get("GROUP_NO")) + "").substring(1, (((countyMapList.get(i)).get("GROUP_NO")) + "").length()))); nsList.add((((countyMapList.get(i)).get("GROUP_NO")) + "").substring(1, (((countyMapList.get(i)).get("GROUP_NO")) + "").length()));
} }
} else { } else {
if ((((countyMapList.get(i)).get("GROUP_NO")) + "").length() == 8) { if ((((countyMapList.get(i)).get("GROUP_NO")) + "").length() == 8) {
nsList.add(Integer.parseInt(((((countyMapList.get(i)).get("GROUP_NO")) + "").replace("E","").replace("G","")))); nsList.add(((((countyMapList.get(i)).get("GROUP_NO")) + "").replace("E","").replace("G","")));
} }
} }
} }
countyMapGroup.put("groupNum", createGroupNo(c, nsList)); countyMapGroup.put("groupNum", createGroupNoMiss(c, nsList));
} }
countyMapGroup.put("countyCode", county); countyMapGroup.put("countyCode", county);
countyMapGroup.put("dealFlag", dealFlag); countyMapGroup.put("dealFlag", dealFlag);
...@@ -1327,38 +1327,6 @@ public class TaskListServiceImpl implements TaskListService { ...@@ -1327,38 +1327,6 @@ public class TaskListServiceImpl implements TaskListService {
return taskListMapper.deletePolice(policeCode); return taskListMapper.deletePolice(policeCode);
} }
private String createGroupNo(List<Integer> c, List<Integer> nsList) {
try {
String groupNo = "";
c.add(nsList.get(0));
for (int i = 0; i < nsList.size() - 1; ++i) {
if (nsList.get(i) + 1 == nsList.get(i + 1)) {
c.add(nsList.get(i + 1));
} else {
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));
}
}
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 "";
}
private String createGroupNoMiss(List<String> c, List<String> nsList) { private String createGroupNoMiss(List<String> c, List<String> nsList) {
try { try {
String groupNo = ""; String groupNo = "";
...@@ -1463,24 +1431,24 @@ public class TaskListServiceImpl implements TaskListService { ...@@ -1463,24 +1431,24 @@ public class TaskListServiceImpl implements TaskListService {
if (countyMapList.size() == 1) { if (countyMapList.size() == 1) {
countyMapGroup.put("groupNum", countyMapList.get(0).get("GROUP_NO")); countyMapGroup.put("groupNum", countyMapList.get(0).get("GROUP_NO"));
} else { } else {
List<Integer> c = new ArrayList<>(); List<String> c = new ArrayList<>();
List<Integer> nsList = new ArrayList<>(); List<String> nsList = new ArrayList<>();
for (int i = 0; i < countyMapList.size(); i++) { for (int i = 0; i < countyMapList.size(); i++) {
/** /**
* 判断组号中时候含有历史回迁组 * 判断组号中时候含有历史回迁组
*/ */
if ((((countyMapList.get(i)).get("GROUP_NO")) + "").contains("L")) { if ((((countyMapList.get(i)).get("GROUP_NO")) + "").contains("L")) {
if ((((countyMapList.get(i)).get("GROUP_NO")) + "").length() == 8) { if ((((countyMapList.get(i)).get("GROUP_NO")) + "").length() == 8) {
nsList.add(Integer.parseInt((((countyMapList.get(i)).get("GROUP_NO")) + "").substring(1, (((countyMapList.get(i)).get("GROUP_NO")) + "").length()))); nsList.add((((countyMapList.get(i)).get("GROUP_NO")) + "").substring(1, (((countyMapList.get(i)).get("GROUP_NO")) + "").length()));
} }
} else { } else {
if ((((countyMapList.get(i)).get("GROUP_NO")) + "").length() == 8) { if ((((countyMapList.get(i)).get("GROUP_NO")) + "").length() == 8) {
nsList.add(Integer.parseInt(((((countyMapList.get(i)).get("GROUP_NO")) + "").replace("E","").replace("G","")))); nsList.add(((((countyMapList.get(i)).get("GROUP_NO")) + "").replace("E","").replace("G","")));
// nsList.add(Integer.parseInt((((countyMapList.get(i)).get("GROUP_NO")) + ""))); // nsList.add(Integer.parseInt((((countyMapList.get(i)).get("GROUP_NO")) + "")));
} }
} }
} }
countyMapGroup.put("groupNum", createGroupNo(c, nsList)); countyMapGroup.put("groupNum", createGroupNoMiss(c, nsList));
} }
countyMapGroup.put("faileCount", faileCount); countyMapGroup.put("faileCount", faileCount);
countyMapGroup.put("specialCount", specialCount); countyMapGroup.put("specialCount", specialCount);
...@@ -1576,24 +1544,24 @@ public class TaskListServiceImpl implements TaskListService { ...@@ -1576,24 +1544,24 @@ public class TaskListServiceImpl implements TaskListService {
if (countyMapList.size() == 1) { if (countyMapList.size() == 1) {
countyMapGroup.put("groupNum", countyMapList.get(0).get("GROUP_NO")); countyMapGroup.put("groupNum", countyMapList.get(0).get("GROUP_NO"));
} else { } else {
List<Integer> c = new ArrayList<>(); List<String> c = new ArrayList<>();
List<Integer> nsList = new ArrayList<>(); List<String> nsList = new ArrayList<>();
for (int i = 0; i < countyMapList.size(); i++) { for (int i = 0; i < countyMapList.size(); i++) {
/** /**
* 判断组号中时候含有历史回迁组 * 判断组号中时候含有历史回迁组
*/ */
if ((((countyMapList.get(i)).get("GROUP_NO")) + "").contains("L")) { if ((((countyMapList.get(i)).get("GROUP_NO")) + "").contains("L")) {
if ((((countyMapList.get(i)).get("GROUP_NO")) + "").length() == 8) { if ((((countyMapList.get(i)).get("GROUP_NO")) + "").length() == 8) {
nsList.add(Integer.parseInt((((countyMapList.get(i)).get("GROUP_NO")) + "").substring(1, (((countyMapList.get(i)).get("GROUP_NO")) + "").length()))); nsList.add((((countyMapList.get(i)).get("GROUP_NO")) + "").substring(1, (((countyMapList.get(i)).get("GROUP_NO")) + "").length()));
} }
} else { } else {
if ((((countyMapList.get(i)).get("GROUP_NO")) + "").length() == 8) { if ((((countyMapList.get(i)).get("GROUP_NO")) + "").length() == 8) {
nsList.add(Integer.parseInt(((((countyMapList.get(i)).get("GROUP_NO")) + "").replace("E","").replace("G","")))); nsList.add(((((countyMapList.get(i)).get("GROUP_NO")) + "").replace("E","").replace("G","")));
// nsList.add(Integer.parseInt((((countyMapList.get(i)).get("GROUP_NO")) + ""))); // nsList.add(Integer.parseInt((((countyMapList.get(i)).get("GROUP_NO")) + "")));
} }
} }
} }
countyMapGroup.put("groupNum", createGroupNo(c, nsList)); countyMapGroup.put("groupNum", createGroupNoMiss(c, nsList));
} }
countyMapGroup.put("faileCount", faileCount); countyMapGroup.put("faileCount", faileCount);
countyMapGroup.put("specialCount", specialCount); countyMapGroup.put("specialCount", specialCount);
...@@ -1692,24 +1660,24 @@ public class TaskListServiceImpl implements TaskListService { ...@@ -1692,24 +1660,24 @@ public class TaskListServiceImpl implements TaskListService {
if (countyMapList.size() == 1) { if (countyMapList.size() == 1) {
countyMapGroup.put("groupNum", countyMapList.get(0).get("GROUP_NO")); countyMapGroup.put("groupNum", countyMapList.get(0).get("GROUP_NO"));
} else { } else {
List<Integer> c = new ArrayList<>(); List<String> c = new ArrayList<>();
List<Integer> nsList = new ArrayList<>(); List<String> nsList = new ArrayList<>();
for (int i = 0; i < countyMapList.size(); i++) { for (int i = 0; i < countyMapList.size(); i++) {
/** /**
* 判断组号中时候含有历史回迁组 * 判断组号中时候含有历史回迁组
*/ */
if ((((countyMapList.get(i)).get("GROUP_NO")) + "").contains("L")) { if ((((countyMapList.get(i)).get("GROUP_NO")) + "").contains("L")) {
if ((((countyMapList.get(i)).get("GROUP_NO")) + "").length() == 8) { if ((((countyMapList.get(i)).get("GROUP_NO")) + "").length() == 8) {
nsList.add(Integer.parseInt((((countyMapList.get(i)).get("GROUP_NO")) + "").substring(1, (((countyMapList.get(i)).get("GROUP_NO")) + "").length()))); nsList.add((((countyMapList.get(i)).get("GROUP_NO")) + "").substring(1, (((countyMapList.get(i)).get("GROUP_NO")) + "").length()));
} }
} else { } else {
if ((((countyMapList.get(i)).get("GROUP_NO")) + "").length() == 8) { if ((((countyMapList.get(i)).get("GROUP_NO")) + "").length() == 8) {
nsList.add(Integer.parseInt(((((countyMapList.get(i)).get("GROUP_NO")) + "").replace("E","").replace("G","")))); nsList.add(((((countyMapList.get(i)).get("GROUP_NO")) + "").replace("E","").replace("G","")));
// nsList.add(Integer.parseInt((((countyMapList.get(i)).get("GROUP_NO")) + ""))); // nsList.add(Integer.parseInt((((countyMapList.get(i)).get("GROUP_NO")) + "")));
} }
} }
} }
countyMapGroup.put("groupNum", createGroupNo(c, nsList)); countyMapGroup.put("groupNum", createGroupNoMiss(c, nsList));
} }
countyMapGroup.put("faileCount", faileCount); countyMapGroup.put("faileCount", faileCount);
countyMapGroup.put("specialCount", specialCount); countyMapGroup.put("specialCount", specialCount);
...@@ -1801,24 +1769,24 @@ public class TaskListServiceImpl implements TaskListService { ...@@ -1801,24 +1769,24 @@ public class TaskListServiceImpl implements TaskListService {
if (countyMapList.size() == 1) { if (countyMapList.size() == 1) {
countyMapGroup.put("groupNum", countyMapList.get(0).get("GROUP_NO")); countyMapGroup.put("groupNum", countyMapList.get(0).get("GROUP_NO"));
} else { } else {
List<Integer> c = new ArrayList<>(); List<String> c = new ArrayList<>();
List<Integer> nsList = new ArrayList<>(); List<String> nsList = new ArrayList<>();
for (int i = 0; i < countyMapList.size(); i++) { for (int i = 0; i < countyMapList.size(); i++) {
/** /**
* 判断组号中时候含有历史回迁组 * 判断组号中时候含有历史回迁组
*/ */
if ((((countyMapList.get(i)).get("GROUP_NO")) + "").contains("L")) { if ((((countyMapList.get(i)).get("GROUP_NO")) + "").contains("L")) {
if ((((countyMapList.get(i)).get("GROUP_NO")) + "").length() == 8) { if ((((countyMapList.get(i)).get("GROUP_NO")) + "").length() == 8) {
nsList.add(Integer.parseInt((((countyMapList.get(i)).get("GROUP_NO")) + "").substring(1, (((countyMapList.get(i)).get("GROUP_NO")) + "").length()))); nsList.add((((countyMapList.get(i)).get("GROUP_NO")) + "").substring(1, (((countyMapList.get(i)).get("GROUP_NO")) + "").length()));
} }
} else { } else {
if ((((countyMapList.get(i)).get("GROUP_NO")) + "").length() == 8) { if ((((countyMapList.get(i)).get("GROUP_NO")) + "").length() == 8) {
nsList.add(Integer.parseInt(((((countyMapList.get(i)).get("GROUP_NO")) + "").replace("E","").replace("G","")))); nsList.add(((((countyMapList.get(i)).get("GROUP_NO")) + "").replace("E","").replace("G","")));
// nsList.add(Integer.parseInt((((countyMapList.get(i)).get("GROUP_NO")) + ""))); // nsList.add(Integer.parseInt((((countyMapList.get(i)).get("GROUP_NO")) + "")));
} }
} }
} }
countyMapGroup.put("groupNum", createGroupNo(c, nsList)); countyMapGroup.put("groupNum", createGroupNoMiss(c, nsList));
} }
countyMapGroup.put("specialCount", specialCount); countyMapGroup.put("specialCount", specialCount);
countyMapGroup.put("countyCode", countyCode); countyMapGroup.put("countyCode", countyCode);
...@@ -1906,24 +1874,24 @@ public class TaskListServiceImpl implements TaskListService { ...@@ -1906,24 +1874,24 @@ public class TaskListServiceImpl implements TaskListService {
if (countyMapList.size() == 1) { if (countyMapList.size() == 1) {
countyMapGroup.put("groupNum", countyMapList.get(0).get("GROUP_NO")); countyMapGroup.put("groupNum", countyMapList.get(0).get("GROUP_NO"));
} else { } else {
List<Integer> c = new ArrayList<>(); List<String> c = new ArrayList<>();
List<Integer> nsList = new ArrayList<>(); List<String> nsList = new ArrayList<>();
for (int i = 0; i < countyMapList.size(); i++) { for (int i = 0; i < countyMapList.size(); i++) {
/** /**
* 判断组号中时候含有历史回迁组 * 判断组号中时候含有历史回迁组
*/ */
if ((((countyMapList.get(i)).get("GROUP_NO")) + "").contains("L")) { if ((((countyMapList.get(i)).get("GROUP_NO")) + "").contains("L")) {
if ((((countyMapList.get(i)).get("GROUP_NO")) + "").length() == 8) { if ((((countyMapList.get(i)).get("GROUP_NO")) + "").length() == 8) {
nsList.add(Integer.parseInt((((countyMapList.get(i)).get("GROUP_NO")) + "").substring(1, (((countyMapList.get(i)).get("GROUP_NO")) + "").length()))); nsList.add((((countyMapList.get(i)).get("GROUP_NO")) + "").substring(1, (((countyMapList.get(i)).get("GROUP_NO")) + "").length()));
} }
} else { } else {
if ((((countyMapList.get(i)).get("GROUP_NO")) + "").length() == 8) { if ((((countyMapList.get(i)).get("GROUP_NO")) + "").length() == 8) {
nsList.add(Integer.parseInt(((((countyMapList.get(i)).get("GROUP_NO")) + "").replace("E","").replace("G","")))); nsList.add(((((countyMapList.get(i)).get("GROUP_NO")) + "").replace("E","").replace("G","")));
//nsList.add(Integer.parseInt((((countyMapList.get(i)).get("GROUP_NO")) + ""))); //nsList.add(Integer.parseInt((((countyMapList.get(i)).get("GROUP_NO")) + "")));
} }
} }
} }
countyMapGroup.put("groupNum", createGroupNo(c, nsList)); countyMapGroup.put("groupNum", createGroupNoMiss(c, nsList));
} }
countyMapGroup.put("specialCount", specialCount); countyMapGroup.put("specialCount", specialCount);
countyMapGroup.put("countyCode", countyCode); countyMapGroup.put("countyCode", countyCode);
......
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