|
@@ -15,11 +15,14 @@ import com.tofly.dyrq.service.PlanPointTempService;
|
|
|
import com.tofly.dyrq.service.SysDeviceTypeService;
|
|
|
import com.tofly.dyrq.service.TfPlanPathTempService;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
+import org.apache.commons.lang.StringUtils;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
import java.util.*;
|
|
|
+import java.util.concurrent.ExecutorService;
|
|
|
+import java.util.concurrent.Executors;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
@Service
|
|
@@ -34,8 +37,8 @@ public class CustomPointServiceImpl implements CustomPointService {
|
|
|
private final SysDeviceTypeService sysDeviceTypeService;
|
|
|
|
|
|
@Override
|
|
|
- public Map<String,Long> updatePointOrPathIsover(List<UpdatePoint> updatePoints) {
|
|
|
- Map<String,Long> transfer = new HashMap<>();
|
|
|
+ public Map<String, Long> updatePointOrPathIsover(List<UpdatePoint> updatePoints) {
|
|
|
+ Map<String, Long> transfer = new HashMap<>();
|
|
|
List<Long> childList = new ArrayList<>();
|
|
|
HashSet<Long> childIds = new HashSet();
|
|
|
for (UpdatePoint u : updatePoints) {
|
|
@@ -43,7 +46,7 @@ public class CustomPointServiceImpl implements CustomPointService {
|
|
|
if ("0".equals(u.getType())) {
|
|
|
String pointChildPlanState = customPointMapper.getStateByPointId(u.getTempId());
|
|
|
if ("7".equals(pointChildPlanState)) {
|
|
|
- transfer.put("pointTempId",u.getTempId());
|
|
|
+ transfer.put("pointTempId", u.getTempId());
|
|
|
continue;
|
|
|
}
|
|
|
planPointTempService.update(Wrappers.<PlanPointTemp>lambdaUpdate()
|
|
@@ -54,7 +57,7 @@ public class CustomPointServiceImpl implements CustomPointService {
|
|
|
} else if ("1".equals(u.getType())) {
|
|
|
String childPlanState = customPointMapper.getStateByPath(u.getTempId());
|
|
|
if ("7".equals(childPlanState)) {
|
|
|
- transfer.put("pathTempId",u.getTempId());
|
|
|
+ transfer.put("pathTempId", u.getTempId());
|
|
|
continue;
|
|
|
} else {
|
|
|
if (!childList.contains(u.getPlanChildId())) {
|
|
@@ -71,9 +74,14 @@ public class CustomPointServiceImpl implements CustomPointService {
|
|
|
childIds.add(u.getPlanChildId());
|
|
|
}
|
|
|
|
|
|
- for (Long childId :childIds){
|
|
|
- this.percentUpdate(childId);
|
|
|
- }
|
|
|
+ ExecutorService executorService = Executors.newSingleThreadExecutor();
|
|
|
+ executorService.execute(new Runnable() {
|
|
|
+ @Override
|
|
|
+ public void run() {
|
|
|
+ String ids = StringUtils.join(childIds, ",");
|
|
|
+ percentUpdate(ids);
|
|
|
+ }
|
|
|
+ });
|
|
|
|
|
|
|
|
|
|
|
@@ -90,7 +98,10 @@ public class CustomPointServiceImpl implements CustomPointService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public Boolean percentUpdate(Long childPlanId){
|
|
|
+ public void percentUpdate(String childPlanIds) {
|
|
|
+ List<String> list = Arrays.asList(childPlanIds.split(","));
|
|
|
+ for (String sid : list) {
|
|
|
+ Long childPlanId = Long.parseLong(sid);
|
|
|
Date now = Date8Util.getCurrentDate();
|
|
|
|
|
|
Map param1 = new HashMap();
|
|
@@ -179,9 +190,7 @@ public class CustomPointServiceImpl implements CustomPointService {
|
|
|
|
|
|
planChildService.update(Wrappers.<PlanChild>lambdaUpdate().set(PlanChild::getChildPlanState, "3")
|
|
|
.eq(PlanChild::getPercent1, 1).eq(PlanChild::getId, childPlanId));
|
|
|
- return true;
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
+ }
|
|
|
|
|
|
}
|