|
@@ -138,9 +138,6 @@ public class ParkUtils {
|
|
|
if (result.containsKey(parkCode)) {
|
|
|
maps = result.get(parkCode);
|
|
|
}
|
|
|
-// if (StringUtils.isNotBlank(image)) {
|
|
|
-// x.put("imageUrl", getImgUrlById(x.get(image).toString()));
|
|
|
-// }
|
|
|
maps.add(x);
|
|
|
maps.forEach(y -> {
|
|
|
y.put("sn", params.get("sn").toString());
|
|
@@ -192,7 +189,7 @@ public class ParkUtils {
|
|
|
update.set("count", maps.size());
|
|
|
mongoTemplate.upsert(query, update, "parkCarList");
|
|
|
// 校验是否存在异常数据
|
|
|
- insertException(key, maps, type.getNo().toString());
|
|
|
+ insertException(key, insertMap.get(key), type.getNo().toString());
|
|
|
});
|
|
|
}
|
|
|
}
|
|
@@ -257,8 +254,12 @@ public class ParkUtils {
|
|
|
return new ArrayList<>();
|
|
|
}
|
|
|
int i = flag ? 1 : -1;
|
|
|
+ if (sortKey.equals(ParkType.EXCEPTION.getSort())) {
|
|
|
+ Collections.sort(maps, (m1, m2) -> ((m1.get(sortKey) == null ? 0 : Integer.parseInt(m1.get(sortKey).toString())) > (m2.get(sortKey) == null ? 0 : Integer.parseInt(m2.get(sortKey).toString()))) ? 1 * i : -1 * i);
|
|
|
+ return maps;
|
|
|
+ }
|
|
|
if (StringUtils.isNotBlank(sortKey)) {
|
|
|
- Collections.sort(maps, (m1, m2) -> LocalDateTimeUtil.parse(m1.get(sortKey).toString(), DatePattern.NORM_DATETIME_PATTERN).isAfter(LocalDateTimeUtil.parse(m2.get(sortKey).toString(), DatePattern.NORM_DATETIME_PATTERN)) ? 1 * i : -1 * i);
|
|
|
+ Collections.sort(maps, (m1, m2) -> (m1.get(sortKey) == null ? LocalDateTime.now() : LocalDateTimeUtil.parse(m1.get(sortKey).toString(), DatePattern.NORM_DATETIME_PATTERN)).isAfter(m2.get(sortKey) == null ? LocalDateTime.now() : LocalDateTimeUtil.parse(m2.get(sortKey).toString(), DatePattern.NORM_DATETIME_PATTERN)) ? 1 * i : -1 * i);
|
|
|
}
|
|
|
return maps;
|
|
|
}
|
|
@@ -351,12 +352,10 @@ public class ParkUtils {
|
|
|
.header("content-type", "application/json")
|
|
|
.body(getCommonParams(Levi.by("filePath", photo)))
|
|
|
.execute().body();
|
|
|
- System.out.println("photo查询结果:" + str);
|
|
|
JSONArray dataItems = JSON.parseObject(str).getJSONArray("dataItems");
|
|
|
System.out.println("getImgUrlById:" + dataItems);
|
|
|
if (dataItems != null) {
|
|
|
String image = dataItems.toJavaList(Map.class).get(0).get("image").toString();
|
|
|
- System.out.println("getImgUrlById:" + str);
|
|
|
return image;
|
|
|
}
|
|
|
return null;
|
|
@@ -377,9 +376,17 @@ public class ParkUtils {
|
|
|
if (CommonConstants.SERVICE_IN.equals(type)) {
|
|
|
// 车牌无法识别
|
|
|
List<Map> list = params.stream().filter(x -> x.get("carNumber").toString().startsWith("无")).collect(Collectors.toList());
|
|
|
- List<Map> maps = data.getJSONArray(ParkExceptionType.A.getCode()).toJavaList(Map.class);
|
|
|
+ List<Map> maps = data.getJSONArray(ParkExceptionType.A.getCode()) == null ? new ArrayList<>() : data.getJSONArray(ParkExceptionType.A.getCode()).toJavaList(Map.class);
|
|
|
maps.addAll(list);
|
|
|
+ System.out.println("异常处理之前:" + JSON.toJSONString(maps));
|
|
|
List<Map> feesTime = ParkUtils.sortDateList(maps, ParkType.IN.getSort(), true);
|
|
|
+ if (CollUtil.isNotEmpty(feesTime)) {
|
|
|
+ feesTime.forEach(x -> {
|
|
|
+ x.put("imageUrl", x.get(ParkType.IN.getImage()));
|
|
|
+ x.put("operator", x.get("inOperator"));
|
|
|
+ });
|
|
|
+ }
|
|
|
+ System.out.println("异常处理之后:" + JSON.toJSONString(feesTime));
|
|
|
data.put(ParkExceptionType.A.getCode(), feesTime);
|
|
|
update.set("data", data);
|
|
|
update.set(ParkExceptionType.A.getCode() + "Count", feesTime.size());
|
|
@@ -387,23 +394,44 @@ public class ParkUtils {
|
|
|
} else if (CommonConstants.SERVICE_OUT.equals(type)) {
|
|
|
// 车牌无法识别
|
|
|
List<Map> list = params.stream().filter(x -> x.get("carNumber").toString().startsWith("无")).collect(Collectors.toList());
|
|
|
- List<Map> maps = data.getJSONArray(ParkExceptionType.A.getCode()).toJavaList(Map.class);
|
|
|
+ List<Map> maps = data.getJSONArray(ParkExceptionType.A.getCode()) == null ? new ArrayList<>() : data.getJSONArray(ParkExceptionType.A.getCode()).toJavaList(Map.class);
|
|
|
maps.addAll(list);
|
|
|
List<Map> feesTime = ParkUtils.sortDateList(maps, ParkType.OUT.getSort(), true);
|
|
|
+ if (CollUtil.isNotEmpty(feesTime)) {
|
|
|
+ feesTime.forEach(x -> {
|
|
|
+ x.put("imageUrl", x.get(ParkType.OUT.getImage()));
|
|
|
+ x.put("operator", x.get("outOperator"));
|
|
|
+ x.put("equipName", x.get("outEquipName"));
|
|
|
+ });
|
|
|
+ }
|
|
|
data.put(ParkExceptionType.A.getCode(), feesTime);
|
|
|
// 支付时间过长
|
|
|
String now = LocalDateTimeUtil.format(LocalDateTime.now(), DatePattern.NORM_DATETIME_PATTERN);
|
|
|
List<Map> list2 = params.stream().filter(x -> getDimSS(x.get("outTime") == null ? now : x.get("outTime").toString(), x.get("openDoor") == null ? now : x.get("openDoor").toString()) > 60
|
|
|
).collect(Collectors.toList());
|
|
|
- List<Map> maps2 = data.getJSONArray(ParkExceptionType.B.getCode()).toJavaList(Map.class);
|
|
|
+ List<Map> maps2 = data.getJSONArray(ParkExceptionType.B.getCode()) == null ? new ArrayList<>() : data.getJSONArray(ParkExceptionType.B.getCode()).toJavaList(Map.class);
|
|
|
maps2.addAll(list2);
|
|
|
List<Map> feesTime2 = ParkUtils.sortDateList(maps2, ParkType.OUT.getSort(), true);
|
|
|
+ if (CollUtil.isNotEmpty(feesTime2)) {
|
|
|
+ feesTime2.forEach(x -> {
|
|
|
+ x.put("imageUrl", x.get(ParkType.OUT.getImage()));
|
|
|
+ x.put("operator", x.get("outOperator"));
|
|
|
+ x.put("equipName", x.get("outEquipName"));
|
|
|
+ });
|
|
|
+ }
|
|
|
data.put(ParkExceptionType.B.getCode(), feesTime2);
|
|
|
// 判断是否撞杆
|
|
|
List<Map> list3 = params.stream().filter(x -> x.get("remark") != null && x.get("remark").toString().contains("撞杆")).collect(Collectors.toList());
|
|
|
- List<Map> maps3 = data.getJSONArray(ParkExceptionType.D.getCode()).toJavaList(Map.class);
|
|
|
+ List<Map> maps3 = data.getJSONArray(ParkExceptionType.D.getCode()) == null ? new ArrayList<>() : data.getJSONArray(ParkExceptionType.D.getCode()).toJavaList(Map.class);
|
|
|
maps3.addAll(list3);
|
|
|
List<Map> feesTime3 = ParkUtils.sortDateList(maps3, ParkType.OUT.getSort(), true);
|
|
|
+ if (CollUtil.isNotEmpty(feesTime3)) {
|
|
|
+ feesTime3.forEach(x -> {
|
|
|
+ x.put("imageUrl", x.get(ParkType.OUT.getImage()));
|
|
|
+ x.put("operator", x.get("outOperator"));
|
|
|
+ x.put("equipName", x.get("outEquipName"));
|
|
|
+ });
|
|
|
+ }
|
|
|
data.put(ParkExceptionType.D.getCode(), feesTime3);
|
|
|
update.set("data", data);
|
|
|
update.set(ParkExceptionType.B.getCode() + "Count", feesTime2.size());
|
|
@@ -414,10 +442,16 @@ public class ParkUtils {
|
|
|
List<Map> list = params.stream().filter(x ->
|
|
|
Duration.between(LocalDateTime.now(), x.get("endTime") == null ? LocalDateTime.now() : LocalDateTimeUtil.parse(x.get("endTime").toString(), DatePattern.NORM_DATETIME_PATTERN)).getSeconds() < 0
|
|
|
).collect(Collectors.toList());
|
|
|
- List<Map> maps = data.getJSONArray(ParkExceptionType.C.getCode()).toJavaList(Map.class);
|
|
|
+ List<Map> maps = data.getJSONArray(ParkExceptionType.C.getCode()) == null ? new ArrayList<>() : data.getJSONArray(ParkExceptionType.C.getCode()).toJavaList(Map.class);
|
|
|
maps.addAll(list);
|
|
|
List<Map> feesTime = ParkUtils.sortDateList(maps, "operateTime", true);
|
|
|
data.put(ParkExceptionType.C.getCode(), feesTime);
|
|
|
+ if (CollUtil.isNotEmpty(feesTime)) {
|
|
|
+ feesTime.forEach(x -> {
|
|
|
+ x.put("operator", x.get("operateName"));
|
|
|
+ x.put("equipName", x.get("cardTypeName"));
|
|
|
+ });
|
|
|
+ }
|
|
|
update.set("data", data);
|
|
|
update.set(ParkExceptionType.C.getCode() + "Count", feesTime.size());
|
|
|
mongoTemplate.upsert(query, update, ParkType.EXCEPTION.getCode());
|
|
@@ -451,7 +485,7 @@ public class ParkUtils {
|
|
|
return new ArrayList<>();
|
|
|
}
|
|
|
String format = String.format("%02d", timeIndex);
|
|
|
- return dataList.stream().filter(x -> x.get("homra").toString().equals(format)).collect(Collectors.toList());
|
|
|
+ return dataList.stream().filter(x -> (x.get("homra") == null ? "" : x.get("homra").toString()).equals(format)).collect(Collectors.toList());
|
|
|
}
|
|
|
}
|
|
|
|