|
@@ -1,5 +1,7 @@
|
|
|
package com.tofly.dyrq.custom.service.impl;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.tofly.common.core.util.Date8Util;
|
|
|
import com.tofly.dyrq.custom.entity.UpdatePoint;
|
|
@@ -15,19 +17,28 @@ import com.tofly.dyrq.service.PlanPointTempService;
|
|
|
import com.tofly.dyrq.service.SysDeviceTypeService;
|
|
|
import com.tofly.dyrq.service.TfPlanPathTempService;
|
|
|
|
|
|
+import jdk.internal.org.jline.utils.Log;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
import lombok.Synchronized;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+
|
|
|
+import org.apache.commons.collections.CollectionUtils;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
+import org.springframework.data.redis.core.RedisTemplate;
|
|
|
+import org.springframework.data.redis.core.ValueOperations;
|
|
|
+import org.springframework.scheduling.annotation.Async;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
|
import java.util.concurrent.ExecutorService;
|
|
|
import java.util.concurrent.Executors;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
+import javax.annotation.PostConstruct;
|
|
|
+
|
|
|
@Service
|
|
|
@AllArgsConstructor
|
|
|
@Slf4j
|
|
@@ -38,30 +49,25 @@ public class CustomPointServiceImpl implements CustomPointService {
|
|
|
private TfPlanPathTempService planPathTempService;
|
|
|
private final CustomPlanMapper customPlanMapper;
|
|
|
private final SysDeviceTypeService sysDeviceTypeService;
|
|
|
-
|
|
|
+ private final ValueOperations<String, String> valueOperations;
|
|
|
+ private final RedisTemplate redisTemplate;
|
|
|
+
|
|
|
@Override
|
|
|
@Transactional
|
|
|
- @Synchronized
|
|
|
public Map<String, Long> updatePointOrPathIsover(List<UpdatePoint> updatePoints) {
|
|
|
Map<String, Long> transfer = new HashMap<>();
|
|
|
List<Long> childList = new ArrayList<>();
|
|
|
HashSet<Long> childIds = new HashSet();
|
|
|
|
|
|
- log.info("#############################1");
|
|
|
for (UpdatePoint u : updatePoints) {
|
|
|
if (u.getTempId() != null && u.getCheckTime() != null && u.getGpsSpeed() != null) {
|
|
|
- if ("0".equals(u.getType())) {
|
|
|
+ if ("0".equals(u.getType())) {
|
|
|
String pointChildPlanState = customPointMapper.getStateByPointId(u.getTempId());
|
|
|
if ("7".equals(pointChildPlanState)) {
|
|
|
transfer.put("pointTempId", u.getTempId());
|
|
|
continue;
|
|
|
}
|
|
|
- log.info("#############################2");
|
|
|
- planPointTempService.update(Wrappers.<PlanPointTemp>lambdaUpdate()
|
|
|
- .set(PlanPointTemp::getIsover, "1")
|
|
|
- .set(PlanPointTemp::getOverDate, u.getCheckTime())
|
|
|
- .set(PlanPointTemp::getGpsSpeed, u.getGpsSpeed())
|
|
|
- .eq(PlanPointTemp::getId, u.getTempId()));
|
|
|
+ valueOperations.set("point_" + u.getTempId(), JSON.toJSONString(u));
|
|
|
} else if ("1".equals(u.getType())) {
|
|
|
String childPlanState = customPointMapper.getStateByPath(u.getTempId());
|
|
|
if ("7".equals(childPlanState)) {
|
|
@@ -71,218 +77,184 @@ public class CustomPointServiceImpl implements CustomPointService {
|
|
|
if (!childList.contains(u.getPlanChildId())) {
|
|
|
childList.add(u.getPlanChildId());
|
|
|
}
|
|
|
- }
|
|
|
- log.info("#############################3");
|
|
|
- planPathTempService.update(Wrappers.<TfPlanPathTemp>lambdaUpdate()
|
|
|
- .set(TfPlanPathTemp::getIsover, "1")
|
|
|
- .set(TfPlanPathTemp::getOverDate, u.getCheckTime())
|
|
|
- .set(TfPlanPathTemp::getGpsSpeed, u.getGpsSpeed())
|
|
|
- .eq(TfPlanPathTemp::getId, u.getTempId()));
|
|
|
-
|
|
|
- Long pointTempId =planPathTempService.getById(u.getTempId()).getTempId();
|
|
|
- log.info("#############################4");
|
|
|
- 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));
|
|
|
- log.info("#############################5");
|
|
|
- double pathOver = new BigDecimal((float) isOverNum / allNum).setScale(4, BigDecimal.ROUND_HALF_UP).doubleValue();
|
|
|
- log.info("#############################6");
|
|
|
- PlanPointTemp one = new PlanPointTemp();
|
|
|
- one.setId(pointTempId);
|
|
|
- one.setPathIsover(new BigDecimal(pathOver));
|
|
|
- planPointTempService.updateById(one);
|
|
|
- log.info("#############################7");
|
|
|
+ }
|
|
|
+ valueOperations.set("path_" + u.getTempId(), JSON.toJSONString(u));
|
|
|
}
|
|
|
}
|
|
|
childIds.add(u.getPlanChildId());
|
|
|
}
|
|
|
-
|
|
|
- ExecutorService executorService = Executors.newSingleThreadExecutor();
|
|
|
- executorService.execute(new Runnable() {
|
|
|
- @Override
|
|
|
- public void run() {
|
|
|
- String ids = StringUtils.join(childIds, ",");
|
|
|
- percentUpdate(ids);
|
|
|
- }
|
|
|
- });
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyMMddHHmmssSSSSSSS");
|
|
|
+ valueOperations.set("child_" + Long.parseLong(sdf.format(new Date())), StringUtils.join(childIds, ","));
|
|
|
return transfer;
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
|
|
|
- @Override
|
|
|
- public void percentUpdate(String childPlanIds) {
|
|
|
- List<String> list = Arrays.asList(childPlanIds.split(","));
|
|
|
- log.info("#############################8");
|
|
|
- for (String sid : list) {
|
|
|
- Long childPlanId = Long.parseLong(sid);
|
|
|
- Date now = Date8Util.getCurrentDate();
|
|
|
-
|
|
|
- Map param1 = new HashMap();
|
|
|
- param1.put("now", now);
|
|
|
- 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);
|
|
|
-
|
|
|
-
|
|
|
- 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 planChild = new PlanChild();
|
|
|
- planChild.setId(childPlanId);
|
|
|
- planChild.setPercent(percent);
|
|
|
- planChild.setPercent1(percent1);
|
|
|
- planChild.setTotal1(new BigDecimal(pointTotal));
|
|
|
- planChild.setIsovertototal(percent * total);
|
|
|
- planChild.setIsovertototal1(new BigDecimal(pointIsoverTotal));
|
|
|
- planChild.setIsovertototal0(new BigDecimal(isOver));
|
|
|
- planChildService.updateById(planChild);
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- List<PlanPointTemp> pointTemps = new ArrayList<>();
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- List<Map> pathMax = customPlanMapper.getPathMaxSpeed(childPlanId);
|
|
|
- for (Map i : pathMax) {
|
|
|
- PlanPointTemp planPointTemp = new PlanPointTemp();
|
|
|
- planPointTemp.setIsover("1");
|
|
|
- planPointTemp.setGpsSpeed((BigDecimal) i.get("gpsSpeed"));
|
|
|
- planPointTemp.setState("1");
|
|
|
- planPointTemp.setId(Long.parseLong(i.get("tempId").toString()));
|
|
|
- planPointTemp.setOverDate((Date) i.get("overDate"));
|
|
|
- pointTemps.add(planPointTemp);
|
|
|
-
|
|
|
- }
|
|
|
- planPointTempService.updateBatchById(pointTemps);
|
|
|
- } else {
|
|
|
-
|
|
|
- total = planPointTempService.count(Wrappers.<PlanPointTemp>lambdaQuery().eq(PlanPointTemp::getChildPlanId, childPlanId));
|
|
|
- int pointIsOver = planPointTempService.count(Wrappers.<PlanPointTemp>lambdaQuery().eq(PlanPointTemp::getChildPlanId, childPlanId).eq(PlanPointTemp::getIsover, "1"));
|
|
|
- int pointIsCheck = planPointTempService.count(Wrappers.<PlanPointTemp>lambdaQuery().eq(PlanPointTemp::getChildPlanId, childPlanId).eq(PlanPointTemp::getCheckState, "1"));
|
|
|
- isOver = checkTypes.contains(Long.parseLong(plan.get("deviceTypeId").toString())) ? pointIsCheck : pointIsOver;
|
|
|
- percent = isOver == 0 ? 0 : new BigDecimal((float) isOver / total).setScale(4, BigDecimal.ROUND_HALF_UP).doubleValue();
|
|
|
-
|
|
|
- PlanChild planChild = new PlanChild();
|
|
|
- planChild.setId(childPlanId);
|
|
|
- planChild.setPercent(percent);
|
|
|
- planChild.setPercent1(percent);
|
|
|
- planChild.setTotal(Double.valueOf(total));
|
|
|
- planChild.setTotal1(new BigDecimal(total));
|
|
|
- planChild.setIsovertototal(Double.valueOf(isOver));
|
|
|
- planChild.setIsovertototal1(new BigDecimal(isOver));
|
|
|
- planChildService.updateById(planChild);
|
|
|
- }
|
|
|
-
|
|
|
- planChildService.update(Wrappers.<PlanChild>lambdaUpdate().set(PlanChild::getChildPlanState, "3")
|
|
|
- .eq(PlanChild::getPercent1, 1).eq(PlanChild::getId, childPlanId));
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- * 更新到位点信息
|
|
|
- * @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());
|
|
|
+ @Override
|
|
|
+ @Async("asyncServiceExecutor")
|
|
|
+ @PostConstruct
|
|
|
+ public void executPoint() {
|
|
|
+ while(true) {
|
|
|
+ Set<String> pointKeys = redisTemplate.keys("point_"+"*");
|
|
|
+ log.info(pointKeys.size()+"##point_##########################");
|
|
|
+ if (CollectionUtils.isNotEmpty(pointKeys)) {
|
|
|
+ for(String pointKey : pointKeys) {
|
|
|
+ String pointValue = valueOperations.get(pointKey);
|
|
|
+ UpdatePoint u = (UpdatePoint)JSONObject.parse(pointValue);
|
|
|
+ boolean flag = planPointTempService.update(Wrappers.<PlanPointTemp>lambdaUpdate()
|
|
|
+ .set(PlanPointTemp::getIsover, "1")
|
|
|
+ .set(PlanPointTemp::getOverDate, u.getCheckTime())
|
|
|
+ .set(PlanPointTemp::getGpsSpeed, u.getGpsSpeed())
|
|
|
+ .eq(PlanPointTemp::getId, u.getTempId()));
|
|
|
+ if(flag) {
|
|
|
+ redisTemplate.delete(pointValue);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
-
|
|
|
- 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();
|
|
|
+ @Override
|
|
|
+ @Async("asyncServiceExecutor")
|
|
|
+ @PostConstruct
|
|
|
+ public void executPath() {
|
|
|
+ while(true) {
|
|
|
+ Set<String> pathkeys = redisTemplate.keys("path_"+"*");
|
|
|
+ log.info(pathkeys.size()+"##path_##########################");
|
|
|
+ if (CollectionUtils.isNotEmpty(pathkeys)) {
|
|
|
+ for(String pathKey : pathkeys) {
|
|
|
+ String pathValue = valueOperations.get(pathKey);
|
|
|
+ UpdatePoint u = (UpdatePoint)JSONObject.parse(pathValue);
|
|
|
+
|
|
|
+ boolean pathflag =planPathTempService.update(Wrappers.<TfPlanPathTemp>lambdaUpdate()
|
|
|
+ .set(TfPlanPathTemp::getIsover, "1")
|
|
|
+ .set(TfPlanPathTemp::getOverDate, u.getCheckTime())
|
|
|
+ .set(TfPlanPathTemp::getGpsSpeed, u.getGpsSpeed())
|
|
|
+ .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));
|
|
|
+
|
|
|
+ boolean ptahPointFlag = false;
|
|
|
+ if(pathflag) {
|
|
|
+ ptahPointFlag = planPointTempService.updateById(one);
|
|
|
+ }
|
|
|
+ if(pathflag&&ptahPointFlag) {
|
|
|
+ redisTemplate.delete(pathValue);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
-
|
|
|
- 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);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ @Override
|
|
|
+ @Async("asyncServiceExecutor")
|
|
|
+ @PostConstruct
|
|
|
+ public void executChild() {
|
|
|
+ Set<String> childkeys = redisTemplate.keys("child_"+"*");
|
|
|
+ log.info(childkeys.size()+"##child_##########################");
|
|
|
+ if (CollectionUtils.isNotEmpty(childkeys)) {
|
|
|
+ for(String childKey : childkeys) {
|
|
|
+ String childValue = valueOperations.get(childKey);
|
|
|
+ List<String> list = Arrays.asList(childValue.split(","));
|
|
|
+
|
|
|
+ for (String sid : list) {
|
|
|
+ Long childPlanId = Long.parseLong(sid);
|
|
|
+ Date now = Date8Util.getCurrentDate();
|
|
|
+
|
|
|
+ Map param1 = new HashMap();
|
|
|
+ param1.put("now", now);
|
|
|
+ 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);
|
|
|
+
|
|
|
+ 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 planChild = new PlanChild();
|
|
|
+ planChild.setId(childPlanId);
|
|
|
+ planChild.setPercent(percent);
|
|
|
+ planChild.setPercent1(percent1);
|
|
|
+ planChild.setTotal1(new BigDecimal(pointTotal));
|
|
|
+ planChild.setIsovertototal(percent * total);
|
|
|
+ planChild.setIsovertototal1(new BigDecimal(pointIsoverTotal));
|
|
|
+ planChild.setIsovertototal0(new BigDecimal(isOver));
|
|
|
+ planChildService.updateById(planChild);
|
|
|
|
|
|
-}
|
|
|
+ List<PlanPointTemp> pointTemps = new ArrayList<>();
|
|
|
+
|
|
|
+
|
|
|
+ List<Map> pathMax = customPlanMapper.getPathMaxSpeed(childPlanId);
|
|
|
+ for (Map i : pathMax) {
|
|
|
+ PlanPointTemp planPointTemp = new PlanPointTemp();
|
|
|
+ planPointTemp.setIsover("1");
|
|
|
+ planPointTemp.setGpsSpeed((BigDecimal) i.get("gpsSpeed"));
|
|
|
+ planPointTemp.setState("1");
|
|
|
+ planPointTemp.setId(Long.parseLong(i.get("tempId").toString()));
|
|
|
+ planPointTemp.setOverDate((Date) i.get("overDate"));
|
|
|
+ pointTemps.add(planPointTemp);
|
|
|
+ }
|
|
|
+ planPointTempService.updateBatchById(pointTemps);
|
|
|
+
|
|
|
+ } else {
|
|
|
+
|
|
|
+ total = planPointTempService.count(Wrappers.<PlanPointTemp>lambdaQuery().eq(PlanPointTemp::getChildPlanId, childPlanId));
|
|
|
+ int pointIsOver = planPointTempService.count(Wrappers.<PlanPointTemp>lambdaQuery().eq(PlanPointTemp::getChildPlanId, childPlanId).eq(PlanPointTemp::getIsover, "1"));
|
|
|
+ int pointIsCheck = planPointTempService.count(Wrappers.<PlanPointTemp>lambdaQuery().eq(PlanPointTemp::getChildPlanId, childPlanId).eq(PlanPointTemp::getCheckState, "1"));
|
|
|
+ isOver = checkTypes.contains(Long.parseLong(plan.get("deviceTypeId").toString())) ? pointIsCheck : pointIsOver;
|
|
|
+ percent = isOver == 0 ? 0 : new BigDecimal((float) isOver / total).setScale(4, BigDecimal.ROUND_HALF_UP).doubleValue();
|
|
|
+
|
|
|
+ PlanChild planChild = new PlanChild();
|
|
|
+ planChild.setId(childPlanId);
|
|
|
+ planChild.setPercent(percent);
|
|
|
+ planChild.setPercent1(percent);
|
|
|
+ planChild.setTotal(Double.valueOf(total));
|
|
|
+ planChild.setTotal1(new BigDecimal(total));
|
|
|
+ planChild.setIsovertototal(Double.valueOf(isOver));
|
|
|
+ planChild.setIsovertototal1(new BigDecimal(isOver));
|
|
|
+ planChildService.updateById(planChild);
|
|
|
+ }
|
|
|
+
|
|
|
+ planChildService.update(Wrappers.<PlanChild>lambdaUpdate().set(PlanChild::getChildPlanState, "3")
|
|
|
+ .eq(PlanChild::getPercent1, 1).eq(PlanChild::getId, childPlanId));
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+}
|