|
@@ -68,7 +68,16 @@ public class CustomPointServiceImpl implements CustomPointService {
|
|
|
.set(TfPlanPathTemp::getIsover, "1")
|
|
|
.set(TfPlanPathTemp::getOverDate, u.getCheckTime())
|
|
|
.set(TfPlanPathTemp::getGpsSpeed, u.getGpsSpeed())
|
|
|
- .eq(TfPlanPathTemp::getId, u.getTempId()));
|
|
|
+ .eq(TfPlanPathTemp::getId, u.getTempId()));
|
|
|
+
|
|
|
+ Long pointTempId =planPathTempService.getById(u.getTempId()).getTempId();
|
|
|
+ int isOverNum = planPathTempService.count(Wrappers.<TfPlanPathTemp>lambdaQuery().eq(TfPlanPathTemp::getTempId, pointTempId).eq(TfPlanPathTemp::getIsover, "1"));
|
|
|
+ int allNum = planPathTempService.count(Wrappers.<TfPlanPathTemp>lambdaQuery().eq(TfPlanPathTemp::getTempId, pointTempId));
|
|
|
+ double pathOver = new BigDecimal((float) isOverNum / allNum).setScale(4, BigDecimal.ROUND_HALF_UP).doubleValue();
|
|
|
+ PlanPointTemp one = new PlanPointTemp();
|
|
|
+ one.setId(pointTempId);
|
|
|
+ one.setPathIsover(new BigDecimal(pathOver));
|
|
|
+ planPointTempService.updateById(one);
|
|
|
}
|
|
|
}
|
|
|
childIds.add(u.getPlanChildId());
|
|
@@ -145,20 +154,20 @@ public class CustomPointServiceImpl implements CustomPointService {
|
|
|
planChildService.updateById(planChild);
|
|
|
|
|
|
|
|
|
- List<PlanPointTemp> stateList = planPointTempService.list(Wrappers.<PlanPointTemp>lambdaQuery().eq(PlanPointTemp::getChildPlanId, childPlanId)
|
|
|
- .eq(PlanPointTemp::getState, "0"));
|
|
|
+
|
|
|
+
|
|
|
List<PlanPointTemp> pointTemps = new ArrayList<>();
|
|
|
- List<TfPlanPathTemp> pathTemps = new ArrayList<>();
|
|
|
- for (PlanPointTemp pointTemp : stateList) {
|
|
|
- Long pointTempId = pointTemp.getId();
|
|
|
- int isOverNum = planPathTempService.count(Wrappers.<TfPlanPathTemp>lambdaQuery().eq(TfPlanPathTemp::getTempId, pointTempId).eq(TfPlanPathTemp::getIsover, "1"));
|
|
|
- int allNum = planPathTempService.count(Wrappers.<TfPlanPathTemp>lambdaQuery().eq(TfPlanPathTemp::getTempId, pointTempId));
|
|
|
- double pathOver = new BigDecimal((float) isOverNum / allNum).setScale(4, BigDecimal.ROUND_HALF_UP).doubleValue();
|
|
|
- PlanPointTemp one = new PlanPointTemp();
|
|
|
- one.setId(pointTempId);
|
|
|
- one.setPathIsover(new BigDecimal(pathOver));
|
|
|
- planPointTempService.updateById(one);
|
|
|
- }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
|
|
|
List<Map> pathMax = customPlanMapper.getPathMaxSpeed(childPlanId);
|
|
@@ -197,4 +206,69 @@ public class CustomPointServiceImpl implements CustomPointService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+ * 更新到位点信息
|
|
|
+ * @param childPlanId
|
|
|
+ * @param temptIds
|
|
|
+ */
|
|
|
+ public void pointPlanUpdate(Long childPlanId,List<Long> temptIds) {
|
|
|
+ int pointTotal = 0;
|
|
|
+ int pointIsoverTotal = 0;
|
|
|
+ int isOver = 0;
|
|
|
+ int total = 0;
|
|
|
+ double percent = 0;
|
|
|
+ double percent1 = 0;
|
|
|
+ Map plan = customPlanMapper.getTodayPlan(childPlanId).get(0);
|
|
|
+ PlanChild planChild= planChildService.getById(childPlanId);
|
|
|
+
|
|
|
+
|
|
|
+ List<SysDeviceType> devices = sysDeviceTypeService.list(Wrappers.<SysDeviceType>lambdaQuery().isNotNull(SysDeviceType::getCheckContent));
|
|
|
+ Set<Long> checkTypes = new HashSet<>();
|
|
|
+ devices.stream().filter(n -> !checkTypes.add(n.getPointTypeId()))
|
|
|
+ .collect(Collectors.toSet());
|
|
|
+
|
|
|
+
|
|
|
+ if ("1".equals(plan.get("type"))) {
|
|
|
+ List<Map> pathTotal = customPlanMapper.getPathTotalInfo(childPlanId);
|
|
|
+ total = Integer.valueOf(pathTotal.get(0).get("total").toString());
|
|
|
+ isOver = checkTypes.contains(plan.get("deviceTypeId")) ? Integer.valueOf(pathTotal.get(0).get("checkTotal").toString()) : Integer.valueOf(pathTotal.get(0).get("isovertotal").toString());
|
|
|
+ pointTotal = Integer.valueOf(pathTotal.get(0).get("pointTotal").toString());
|
|
|
+ pointIsoverTotal = Integer.valueOf(pathTotal.get(0).get("pointIsoverTotal").toString());
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ percent = pointTotal == 0 ? 0 : new BigDecimal((float) isOver / total).setScale(4, BigDecimal.ROUND_HALF_UP).doubleValue();
|
|
|
+ percent1 = pointTotal == 0 ? 0 : new BigDecimal ((float) pointIsoverTotal / pointTotal).setScale(4, BigDecimal.ROUND_HALF_UP).doubleValue();
|
|
|
+
|
|
|
+
|
|
|
+ PlanChild planChildUpdate = new PlanChild();
|
|
|
+ planChildUpdate.setId(childPlanId);
|
|
|
+ planChildUpdate.setPercent(percent);
|
|
|
+ planChildUpdate.setPercent1(percent1);
|
|
|
+ planChildUpdate.setTotal1(new BigDecimal(pointTotal));
|
|
|
+ planChildUpdate.setIsovertototal(percent * total);
|
|
|
+ planChildUpdate.setIsovertototal1(new BigDecimal(pointIsoverTotal));
|
|
|
+ planChildUpdate.setIsovertototal0(new BigDecimal(isOver));
|
|
|
+ planChildService.updateById(planChildUpdate);
|
|
|
+
|
|
|
+
|
|
|
+ List<PlanPointTemp> stateList = planPointTempService.list(Wrappers.<PlanPointTemp>lambdaQuery().eq(PlanPointTemp::getChildPlanId, childPlanId)
|
|
|
+ .eq(PlanPointTemp::getState, "0"));
|
|
|
+ List<PlanPointTemp> pointTemps = new ArrayList<>();
|
|
|
+ List<TfPlanPathTemp> pathTemps = new ArrayList<>();
|
|
|
+ for (PlanPointTemp pointTemp : stateList) {
|
|
|
+ Long pointTempId = pointTemp.getId();
|
|
|
+ int isOverNum = planPathTempService.count(Wrappers.<TfPlanPathTemp>lambdaQuery().eq(TfPlanPathTemp::getTempId, pointTempId).eq(TfPlanPathTemp::getIsover, "1"));
|
|
|
+ int allNum = planPathTempService.count(Wrappers.<TfPlanPathTemp>lambdaQuery().eq(TfPlanPathTemp::getTempId, pointTempId));
|
|
|
+ double pathOver = new BigDecimal((float) isOverNum / allNum).setScale(4, BigDecimal.ROUND_HALF_UP).doubleValue();
|
|
|
+ PlanPointTemp one = new PlanPointTemp();
|
|
|
+ one.setId(pointTempId);
|
|
|
+ one.setPathIsover(new BigDecimal(pathOver));
|
|
|
+ planPointTempService.updateById(one);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|