Browse Source

巡检计划调整

pra 3 years ago
parent
commit
3a50ec8091

+ 12 - 4
src/main/java/com/tofly/zmrq/controller/ConstructionSiteController.java

@@ -4,10 +4,18 @@
  */
 package com.tofly.zmrq.controller;
 
+import com.tofly.common.core.entity.ResultRespone;
+import com.tofly.common.log.annotation.ToFlyAppLog;
+import com.tofly.zmrq.service.ConstructionSiteService;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
 import lombok.AllArgsConstructor;
 import org.springframework.web.bind.annotation.*;
 import io.swagger.annotations.Api;
 
+import java.util.Arrays;
+
 /**
  * 工地监护工单表
  *
@@ -19,9 +27,9 @@ import io.swagger.annotations.Api;
 @RequestMapping("/constructionsite")
 @Api(tags="工地监护工单表接口")
 public class ConstructionSiteController {
-/*
-    private final  ConstructionSiteService constructionSiteService;
 
+    private final ConstructionSiteService constructionSiteService;
+    /*
     *//**
     * 分页查询
     * @param page 分页对象
@@ -92,7 +100,7 @@ public class ConstructionSiteController {
      * 通过id批量删除工地监护工单表
      * @param ids id
      * @return ResultRespone
-     *//*
+     */
     @ToFlyAppLog(title="通过id批量删除工地监护工单表" )
     @ApiOperation(value = "通过ID批量删除工地监护工单表")
     @ApiImplicitParams({
@@ -101,5 +109,5 @@ public class ConstructionSiteController {
     @DeleteMapping("/deleteByIds" )
     public ResultRespone removeById(String ids) {
         return ResultRespone.success(constructionSiteService.removeByIds(Arrays.asList(ids.split(","))));
-    }*/
+    }
 }

+ 3 - 3
src/main/java/com/tofly/zmrq/custom/controller/CustomPlanController.java

@@ -80,9 +80,9 @@ public class CustomPlanController {
         if (customPlan.getPlanMode() == null) {
             throw new ToflyDeniedException("请添加PlanMode");
         }
-        if (customPlan.getUserIds() == null) {
-            throw new ToflyDeniedException("请添加UserIds");
-        }
+//        if (customPlan.getUserIds() == null) {
+//            throw new ToflyDeniedException("请添加UserIds");
+//        }
         if (customPlan.getDeviceTypeId() == null) {
             throw new ToflyDeniedException("请添加DeviceTypeId");
         }

+ 160 - 175
src/main/java/com/tofly/zmrq/custom/service/impl/CustomPlanServiceImpl.java

@@ -145,190 +145,138 @@ public class CustomPlanServiceImpl implements CustomPlanService {
         planService.save(customPlan);
         //存巡检点和线到TF_PLAN_POINT_TEMP,TF_PLAN_PATH_TEMP存的是巡检线的各个线上的点
         // 增加所有子计划
-        List<Long> idList = new ArrayList<>();
-        if (StringUtil.isNotEmpty(customPlan.getUserIds())){
-            Arrays.asList(customPlan.getUserIds().split(",")).forEach(k -> {
-                idList.add(Long.parseLong(k));
-            });
-        }
-        else{
-            idList.add(userId);
+        int childPlanNums = 1;
+        if (customPlan.getPeriodId() != 1) {
+            PlanPeriodType planPeriodType = planPeriodTypeService.getOne(Wrappers.<PlanPeriodType>lambdaQuery().eq(PlanPeriodType::getId, customPlan.getPeriodId()));
+            IntervalDays = planPeriodType.getIntervalDays().intValue();
+            childPlanNums = (getTimeDistance(customPlan.getPlanBegindate(), customPlan.getPlanEnddate()) + 1) / IntervalDays;
+        } else {
+            IntervalDays = getTimeDistance(customPlan.getPlanBegindate(), customPlan.getPlanEnddate()) + 1;
         }
-        //根据多人生成多个计划
-        for (Long userIdNew : idList) {
-
-
-            int childPlanNums = 1;
-            if (customPlan.getPeriodId() != 1) {
-                PlanPeriodType planPeriodType = planPeriodTypeService.getOne(Wrappers.<PlanPeriodType>lambdaQuery().eq(PlanPeriodType::getId, customPlan.getPeriodId()));
-                IntervalDays = planPeriodType.getIntervalDays().intValue();
-                childPlanNums = (getTimeDistance(customPlan.getPlanBegindate(), customPlan.getPlanEnddate()) + 1) / IntervalDays;
-            } else {
-                IntervalDays = getTimeDistance(customPlan.getPlanBegindate(), customPlan.getPlanEnddate()) + 1;
-            }
-            Date beginDate = customPlan.getPlanBegindate();
-            Calendar cal = Calendar.getInstance();
-            Date now = cal.getTime();
-            cal.setTime(beginDate);
-
-            tf_plan_point_tempId = Math.max(tf_plan_point_tempId, customPlanMapper.getPlanTempMaxId("TF_PLAN_POINT_TEMP"));
-            tf_plan_path_tempId = Math.max(tf_plan_path_tempId, customPlanMapper.getPlanTempMaxId("TF_PLAN_PATH_TEMP"));
-            List<PlanPointTemp> pointTempList = new ArrayList<>();
-            List<TfPlanPathTemp> pathTempList = new ArrayList<>();
-
-            for (int i = 1; i <= childPlanNums; i++) {
-                PlanChild planChild = new PlanChild();
-                int pointNum = 0;
-                cal.set(Calendar.HOUR_OF_DAY, 0);
-                cal.set(Calendar.MINUTE, 0);
-                cal.set(Calendar.SECOND, 0);
-                planChild.setChildBeginDate(cal.getTime());
-                cal.add(Calendar.DATE, IntervalDays - 1);
-                cal.set(Calendar.HOUR_OF_DAY, 23);
-                cal.set(Calendar.MINUTE, 59);
-                cal.set(Calendar.SECOND, 59);
-                planChild.setChildEndDate(cal.getTime());
-                planChild.setChildPlanState("1");
-                planChild.setMainPlanId(customPlan.getId());
-                planChild.setChildNum(new BigDecimal(i));
-                planChild.setPeriodId(customPlan.getPeriodId());
-                planChild.setDeviceTypeId(customPlan.getDeviceTypeId());
-                planChild.setLastTime(now);
-                planChild.setRegionId(customPlan.getRegionId());
-                planChild.setUserId(userIdNew);
-                planChild.setPlanRate(customPlan.getPlanRate());
-                planChild.setCompanyId(customPlan.getCompanyId());
-                planChild.setDeptId(deptId);
-
-
-                //下个子计划日期加1
-                cal.add(Calendar.DATE, 1);
-
-                //存巡检点数据到临时记录表
-                //巡检点
-                if (type.equals("0")) {
-                    planChild.setPointNum(Long.valueOf(geo.size()));
-                    planChildService.save(planChild);
-                    for (int j = 0; j < geo.size(); j++) {
-                        PlanPointTemp planPointTemp = new PlanPointTemp();
+        Date beginDate = customPlan.getPlanBegindate();
+        Calendar cal = Calendar.getInstance();
+        Date now = cal.getTime();
+        cal.setTime(beginDate);
+
+        tf_plan_point_tempId = Math.max(tf_plan_point_tempId, customPlanMapper.getPlanTempMaxId("TF_PLAN_POINT_TEMP"));
+        tf_plan_path_tempId = Math.max(tf_plan_path_tempId, customPlanMapper.getPlanTempMaxId("TF_PLAN_PATH_TEMP"));
+        List<PlanPointTemp> pointTempList = new ArrayList<>();
+        List<TfPlanPathTemp> pathTempList = new ArrayList<>();
+
+        for (int i = 1; i <= childPlanNums; i++) {
+            PlanChild planChild = new PlanChild();
+            int pointNum = 0;
+            cal.set(Calendar.HOUR_OF_DAY, 0);
+            cal.set(Calendar.MINUTE, 0);
+            cal.set(Calendar.SECOND, 0);
+            planChild.setChildBeginDate(cal.getTime());
+            cal.add(Calendar.DATE, IntervalDays - 1);
+            cal.set(Calendar.HOUR_OF_DAY, 23);
+            cal.set(Calendar.MINUTE, 59);
+            cal.set(Calendar.SECOND, 59);
+            planChild.setChildEndDate(cal.getTime());
+            planChild.setChildPlanState("1");
+            planChild.setMainPlanId(customPlan.getId());
+            planChild.setChildNum(new BigDecimal(i));
+            planChild.setPeriodId(customPlan.getPeriodId());
+            planChild.setDeviceTypeId(customPlan.getDeviceTypeId());
+            planChild.setLastTime(now);
+            planChild.setRegionId(customPlan.getRegionId());
+            planChild.setUserId(userId);
+            planChild.setPlanRate(customPlan.getPlanRate());
+            planChild.setCompanyId(customPlan.getCompanyId());
+            planChild.setDeptId(deptId);
+
+
+            //下个子计划日期加1
+            cal.add(Calendar.DATE, 1);
+
+            //存巡检点数据到临时记录表
+            //巡检点
+            if (type.equals("0")) {
+                planChild.setPointNum(Long.valueOf(geo.size()));
+                planChildService.save(planChild);
+                for (int j = 0; j < geo.size(); j++) {
+                    PlanPointTemp planPointTemp = new PlanPointTemp();
+                    planPointTemp.setPlanId(customPlan.getId());
+                    planPointTemp.setPeriodId(customPlan.getPeriodId());
+                    planPointTemp.setUserId(userId);
+                    planPointTemp.setCompanyId(companyId);
+                    planPointTemp.setIsover("0");
+                    planPointTemp.setChildPlanId(planChild.getId());
+                    planPointTemp.setRegionId(customPlan.getRegionId());
+                    planPointTemp.setDeviceTypeId(customPlan.getDeviceTypeId());
+                    if (gisUrl == null) {
+                        planPointTemp.setPointId(geo.getJSONObject(j).getLong("sid"));
+                        planPointTemp.setGeometry(geo.getJSONObject(j).getString("geometry"));
+                        planPointTemp.setContent(geo.getJSONObject(j).getString("content"));
+                        planPointTemp.setName(geo.getJSONObject(j).getString("name"));
+                        planPointTemp.setAddress(geo.getJSONObject(j).getString("address"));
+                        planPointTemp.setCode(geo.getJSONObject(j).getString("code"));
+                        planPointTemp.setLat(geo.getJSONObject(j).getJSONObject("geometry").getBigDecimal("y"));
+                        planPointTemp.setLng(geo.getJSONObject(j).getJSONObject("geometry").getBigDecimal("x"));
+                        planPointTemp.setPipeLength("0");
+                    } else {
                         planPointTemp.setPlanId(customPlan.getId());
-                        planPointTemp.setPeriodId(customPlan.getPeriodId());
-                        planPointTemp.setUserId(userIdNew);
-                        planPointTemp.setCompanyId(companyId);
-                        planPointTemp.setIsover("0");
-                        planPointTemp.setChildPlanId(planChild.getId());
-                        planPointTemp.setRegionId(customPlan.getRegionId());
-                        planPointTemp.setDeviceTypeId(customPlan.getDeviceTypeId());
-                        if (gisUrl == null) {
-                            planPointTemp.setPointId(geo.getJSONObject(j).getLong("sid"));
-                            planPointTemp.setGeometry(geo.getJSONObject(j).getString("geometry"));
-                            planPointTemp.setContent(geo.getJSONObject(j).getString("content"));
-                            planPointTemp.setName(geo.getJSONObject(j).getString("name"));
-                            planPointTemp.setAddress(geo.getJSONObject(j).getString("address"));
-                            planPointTemp.setCode(geo.getJSONObject(j).getString("code"));
-                            planPointTemp.setLat(geo.getJSONObject(j).getJSONObject("geometry").getBigDecimal("y"));
-                            planPointTemp.setLng(geo.getJSONObject(j).getJSONObject("geometry").getBigDecimal("x"));
-                            planPointTemp.setPipeLength("0");
-                        } else {
-                            planPointTemp.setPlanId(customPlan.getId());
-                            planPointTemp.setPointId(geo.getJSONObject(j).getJSONObject("attributes").getLong("OBJECTID"));
-                            planPointTemp.setGeometry(geo.getJSONObject(j).getString("geometry"));
-                            planPointTemp.setLat(geo.getJSONObject(j).getJSONObject("geometry").getBigDecimal("y"));
-                            planPointTemp.setLng(geo.getJSONObject(j).getJSONObject("geometry").getBigDecimal("x"));
-                            planPointTemp.setPipeLength("0");
-                        }
-                        //planPointTempService.save(planPointTemp);
-                        planPointTemp.setId(tf_plan_point_tempId);
-                        pointTempList.add(planPointTemp);
-                        tf_plan_point_tempId++;
-                        //pointNum++;
+                        planPointTemp.setPointId(geo.getJSONObject(j).getJSONObject("attributes").getLong("OBJECTID"));
+                        planPointTemp.setGeometry(geo.getJSONObject(j).getString("geometry"));
+                        planPointTemp.setLat(geo.getJSONObject(j).getJSONObject("geometry").getBigDecimal("y"));
+                        planPointTemp.setLng(geo.getJSONObject(j).getJSONObject("geometry").getBigDecimal("x"));
+                        planPointTemp.setPipeLength("0");
                     }
+                    //planPointTempService.save(planPointTemp);
+                    planPointTemp.setId(tf_plan_point_tempId);
+                    pointTempList.add(planPointTemp);
+                    tf_plan_point_tempId++;
+                    //pointNum++;
                 }
-                //巡检线
-                else {
-                    planChildService.save(planChild);
-                    BigDecimal pipeLengthTotal = BigDecimal.ZERO;
-                    for (int j = 0; j < geo.size(); j++) {
-                        JSONArray paths;
-                        //巡检线
-                        if (gisUrl == null) {
+            }
+            //巡检线
+            else {
+                planChildService.save(planChild);
+                BigDecimal pipeLengthTotal = BigDecimal.ZERO;
+                for (int j = 0; j < geo.size(); j++) {
+                    JSONArray paths;
+                    //巡检线
+                    if (gisUrl == null) {
 //                        paths = geo.getJSONObject(j).getJSONObject("geometry").getJSONArray("paths").getJSONArray(0);
-                            JSONArray pipe;
-                            pipe = geo.getJSONObject(j).getJSONArray("pipe");
-
-                            for (int w = 0; w < pipe.size(); w++) {
-                                PlanPointTemp planPointTemp = new PlanPointTemp();
-                                planPointTemp.setPlanId(customPlan.getId());
-                                planPointTemp.setPeriodId(customPlan.getPeriodId());
-                                planPointTemp.setRegionId(customPlan.getRegionId());
-                                planPointTemp.setDeviceTypeId(customPlan.getDeviceTypeId());
-                                planPointTemp.setChildPlanId(planChild.getId());
-                                planPointTemp.setUserId(userIdNew);
-                                planPointTemp.setCompanyId(companyId);
-                                planPointTemp.setIsover("0");
-
-                                planPointTemp.setPointId(geo.getJSONObject(j).getLong("sid"));
-                                planPointTemp.setGeometry(pipe.getJSONObject(w).getString("geometry"));
-                                planPointTemp.setContent(geo.getJSONObject(j).getString("content"));
-                                planPointTemp.setName(geo.getJSONObject(j).getString("name"));
-                                planPointTemp.setAddress(geo.getJSONObject(j).getString("address"));
-                                planPointTemp.setCode(geo.getJSONObject(j).getString("code"));
-
-                                planPointTemp.setPipeLength(pipe.getJSONObject(w).getString("length"));
-                                pipeLengthTotal = pipeLengthTotal.add(new BigDecimal(pipe.getJSONObject(w).getString("length")));
-                                planPointTemp.setId(tf_plan_point_tempId);
-                                pointTempList.add(planPointTemp);
-                                tf_plan_point_tempId++;
-
-                                //巡检线paths分段成两个点
-                                paths = pipe.getJSONObject(w).getJSONObject("geometry").getJSONArray("paths").getJSONArray(0);
-                                for (int e = 0; e < paths.size(); e++) {
-                                    TfPlanPathTemp tfPlanPathTemp = new TfPlanPathTemp();
-                                    tfPlanPathTemp.setTempId(planPointTemp.getId());
-                                    tfPlanPathTemp.setPointId(planPointTemp.getPointId());
-                                    tfPlanPathTemp.setLat(new BigDecimal(paths.getJSONArray(e).get(1).toString()));
-                                    tfPlanPathTemp.setLng(new BigDecimal(paths.getJSONArray(e).get(0).toString()));
-                                    tfPlanPathTemp.setIsover(new BigDecimal(0));
-                                    tfPlanPathTemp.setNum(new BigDecimal(e + 1));
-                                    tfPlanPathTemp.setChildPlanId(planChild.getId());
-                                    //planPathTempService.save(tfPlanPathTemp);
-                                    tfPlanPathTemp.setId(tf_plan_path_tempId);
-                                    pathTempList.add(tfPlanPathTemp);
-                                    tf_plan_path_tempId++;
-                                    pointNum++;
-                                }
-                            }
-                        } else {
+                        JSONArray pipe;
+                        pipe = geo.getJSONObject(j).getJSONArray("pipe");
+
+                        for (int w = 0; w < pipe.size(); w++) {
                             PlanPointTemp planPointTemp = new PlanPointTemp();
                             planPointTemp.setPlanId(customPlan.getId());
                             planPointTemp.setPeriodId(customPlan.getPeriodId());
                             planPointTemp.setRegionId(customPlan.getRegionId());
                             planPointTemp.setDeviceTypeId(customPlan.getDeviceTypeId());
                             planPointTemp.setChildPlanId(planChild.getId());
-                            planPointTemp.setUserId(userIdNew);
+                            planPointTemp.setUserId(userId);
                             planPointTemp.setCompanyId(companyId);
                             planPointTemp.setIsover("0");
 
-                            planPointTemp.setPointId(geo.getJSONObject(j).getJSONObject("attributes").getLong("OBJECTID"));
-                            planPointTemp.setGeometry(geo.getJSONObject(j).getString("geometry"));
-                            planPointTemp.setPipeLength(geo.getJSONObject(j).getJSONObject("attributes").getString("PIPELENGTH"));
-                            if (geo.getJSONObject(j).getJSONObject("attributes").getString("PIPELENGTH") != null) {
-                                pipeLengthTotal = pipeLengthTotal.add(new BigDecimal(geo.getJSONObject(j).getJSONObject("attributes").getString("PIPELENGTH")));
-                            }
-                            paths = geo.getJSONObject(j).getJSONObject("geometry").getJSONArray("paths").getJSONArray(0);
+                            planPointTemp.setPointId(geo.getJSONObject(j).getLong("sid"));
+                            planPointTemp.setGeometry(pipe.getJSONObject(w).getString("geometry"));
+                            planPointTemp.setContent(geo.getJSONObject(j).getString("content"));
+                            planPointTemp.setName(geo.getJSONObject(j).getString("name"));
+                            planPointTemp.setAddress(geo.getJSONObject(j).getString("address"));
+                            planPointTemp.setCode(geo.getJSONObject(j).getString("code"));
+
+                            planPointTemp.setPipeLength(pipe.getJSONObject(w).getString("length"));
+                            pipeLengthTotal = pipeLengthTotal.add(new BigDecimal(pipe.getJSONObject(w).getString("length")));
                             planPointTemp.setId(tf_plan_point_tempId);
                             pointTempList.add(planPointTemp);
                             tf_plan_point_tempId++;
 
-                            //巡检线信息存入
-                            for (int k = 0; k < paths.size(); k++) {
+                            //巡检线paths分段成两个点
+                            paths = pipe.getJSONObject(w).getJSONObject("geometry").getJSONArray("paths").getJSONArray(0);
+                            for (int e = 0; e < paths.size(); e++) {
                                 TfPlanPathTemp tfPlanPathTemp = new TfPlanPathTemp();
                                 tfPlanPathTemp.setTempId(planPointTemp.getId());
                                 tfPlanPathTemp.setPointId(planPointTemp.getPointId());
-                                tfPlanPathTemp.setLat(new BigDecimal(paths.getJSONArray(k).get(1).toString()));
-                                tfPlanPathTemp.setLng(new BigDecimal(paths.getJSONArray(k).get(0).toString()));
+                                tfPlanPathTemp.setLat(new BigDecimal(paths.getJSONArray(e).get(1).toString()));
+                                tfPlanPathTemp.setLng(new BigDecimal(paths.getJSONArray(e).get(0).toString()));
                                 tfPlanPathTemp.setIsover(new BigDecimal(0));
-                                tfPlanPathTemp.setNum(new BigDecimal(k + 1));
+                                tfPlanPathTemp.setNum(new BigDecimal(e + 1));
                                 tfPlanPathTemp.setChildPlanId(planChild.getId());
                                 //planPathTempService.save(tfPlanPathTemp);
                                 tfPlanPathTemp.setId(tf_plan_path_tempId);
@@ -337,7 +285,46 @@ public class CustomPlanServiceImpl implements CustomPlanService {
                                 pointNum++;
                             }
                         }
-                        //planPointTempService.save(planPointTemp);
+                    } else {
+                        PlanPointTemp planPointTemp = new PlanPointTemp();
+                        planPointTemp.setPlanId(customPlan.getId());
+                        planPointTemp.setPeriodId(customPlan.getPeriodId());
+                        planPointTemp.setRegionId(customPlan.getRegionId());
+                        planPointTemp.setDeviceTypeId(customPlan.getDeviceTypeId());
+                        planPointTemp.setChildPlanId(planChild.getId());
+                        planPointTemp.setUserId(userId);
+                        planPointTemp.setCompanyId(companyId);
+                        planPointTemp.setIsover("0");
+
+                        planPointTemp.setPointId(geo.getJSONObject(j).getJSONObject("attributes").getLong("OBJECTID"));
+                        planPointTemp.setGeometry(geo.getJSONObject(j).getString("geometry"));
+                        planPointTemp.setPipeLength(geo.getJSONObject(j).getJSONObject("attributes").getString("PIPELENGTH"));
+                        if (geo.getJSONObject(j).getJSONObject("attributes").getString("PIPELENGTH") != null) {
+                            pipeLengthTotal = pipeLengthTotal.add(new BigDecimal(geo.getJSONObject(j).getJSONObject("attributes").getString("PIPELENGTH")));
+                        }
+                        paths = geo.getJSONObject(j).getJSONObject("geometry").getJSONArray("paths").getJSONArray(0);
+                        planPointTemp.setId(tf_plan_point_tempId);
+                        pointTempList.add(planPointTemp);
+                        tf_plan_point_tempId++;
+
+                        //巡检线信息存入
+                        for (int k = 0; k < paths.size(); k++) {
+                            TfPlanPathTemp tfPlanPathTemp = new TfPlanPathTemp();
+                            tfPlanPathTemp.setTempId(planPointTemp.getId());
+                            tfPlanPathTemp.setPointId(planPointTemp.getPointId());
+                            tfPlanPathTemp.setLat(new BigDecimal(paths.getJSONArray(k).get(1).toString()));
+                            tfPlanPathTemp.setLng(new BigDecimal(paths.getJSONArray(k).get(0).toString()));
+                            tfPlanPathTemp.setIsover(new BigDecimal(0));
+                            tfPlanPathTemp.setNum(new BigDecimal(k + 1));
+                            tfPlanPathTemp.setChildPlanId(planChild.getId());
+                            //planPathTempService.save(tfPlanPathTemp);
+                            tfPlanPathTemp.setId(tf_plan_path_tempId);
+                            pathTempList.add(tfPlanPathTemp);
+                            tf_plan_path_tempId++;
+                            pointNum++;
+                        }
+                    }
+                    //planPointTempService.save(planPointTemp);
 //                    planPointTemp.setId(tf_plan_point_tempId);
 //                    pointTempList.add(planPointTemp);
 //                    tf_plan_point_tempId++;
@@ -359,20 +346,19 @@ public class CustomPlanServiceImpl implements CustomPlanService {
 //                        tf_plan_path_tempId++;
 //                        pointNum++;
 //                    }
-                    }
-                    //添加巡检点数
-                    planChildService.update(Wrappers.<PlanChild>lambdaUpdate()
-                            .eq(PlanChild::getId, planChild.getId())
-                            .set(PlanChild::getPointNum, pointNum)
-                            .set(PlanChild::getTotal, pipeLengthTotal));
                 }
-
+                //添加巡检点数
+                planChildService.update(Wrappers.<PlanChild>lambdaUpdate()
+                        .eq(PlanChild::getId, planChild.getId())
+                        .set(PlanChild::getPointNum, pointNum)
+                        .set(PlanChild::getTotal, pipeLengthTotal));
             }
-            //更新计划状态
-            uploadPlanState();
 
+        }
+        //更新计划状态
+        uploadPlanState();
 
-            //处理详细信息,为了防止异步时ID冲突,在这里加入一条最大数据,后面处理的时候删除该数据
+        //处理详细信息,为了防止异步时ID冲突,在这里加入一条最大数据,后面处理的时候删除该数据
 //        PlanPointTemp planPointTemp = new PlanPointTemp();
 //        planPointTemp.setId(tf_plan_point_tempId);
 //        planPointTempService.save(planPointTemp);
@@ -380,8 +366,7 @@ public class CustomPlanServiceImpl implements CustomPlanService {
 //        tfPlanPathTemp.setId(tf_plan_path_tempId);
 //        planPathTempService.save(tfPlanPathTemp);
 //        SpringContextHolder.publishEvent(new PlanDetailEvent(this,pointTempList,pathTempList));
-            handler(pointTempList, pathTempList);
-        }
+        handler(pointTempList, pathTempList);
         return true;
     }
 

+ 2 - 2
src/main/java/com/tofly/zmrq/entity/Plan.java

@@ -208,7 +208,7 @@ public class Plan extends Model<Plan> {
     private Long companyId;
     @TableField(exist = false)
     private String companyName;
-    @ApiModelProperty(value = "计划多人时填写用逗号隔开")
-    private String userIds;
+//    @ApiModelProperty(value = "计划多人时填写用逗号隔开")
+//    private String userIds;
 
 }

+ 65 - 23
src/main/resources/customMapper/CustomPlanMapper.xml

@@ -27,7 +27,7 @@
         <result property="planMode" column="PLAN_MODE"/>
         <result property="objectIds" column="OBJECT_IDS"/>
         <result property="companyId" column="COMPANY_ID"/>
-        <result property="userIds" column="USER_IDS"/>
+        <result property="userId" column="USER_ID"/>
         <association property="companyName" column="COMPANY_ID"
                      select="com.tofly.common.mapper.ToflyCodeCommonMapper.getCompanyName"></association>
         <association property="regionName" column="REGION_ID" select="getregionName"></association>
@@ -513,27 +513,69 @@
     </select>
 
 <!-- 新增计划批量插入-->
+<!--    <insert id="insertBacthPointTemp">-->
+<!--        insert into tf_plan_point_temp(id,-->
+<!--        plan_id,-->
+<!--        point_id,-->
+<!--        child_plan_id,-->
+<!--        user_id,-->
+<!--        company_id,-->
+<!--        region_id,-->
+<!--        device_type_id,-->
+<!--        period_id,-->
+<!--        geometry,-->
+<!--        name,-->
+<!--        address,-->
+<!--        code,-->
+<!--        content,-->
+<!--        pipe_length,-->
+<!--        lat,-->
+<!--        lng-->
+<!--        )-->
+<!--        <foreach close=")" collection="pointTempList" item="point" index="index" open="(" separator="union">-->
+<!--            select-->
+<!--            #{point.id,jdbcType=NUMERIC},-->
+<!--            #{point.planId,jdbcType=NUMERIC},-->
+<!--            #{point.pointId,jdbcType=NUMERIC},-->
+<!--            #{point.childPlanId,jdbcType=NUMERIC},-->
+<!--            #{point.userId,jdbcType=NUMERIC},-->
+<!--            #{point.companyId,jdbcType=NUMERIC},-->
+<!--            #{point.regionId,jdbcType=NUMERIC},-->
+<!--            #{point.deviceTypeId,jdbcType=NUMERIC},-->
+<!--            #{point.periodId,jdbcType=NUMERIC},-->
+<!--            #{point.geometry,jdbcType=VARCHAR},-->
+<!--            #{point.name,jdbcType=VARCHAR},-->
+<!--            #{point.address,jdbcType=VARCHAR},-->
+<!--            #{point.code,jdbcType=VARCHAR},-->
+<!--            #{point.content,jdbcType=VARCHAR},-->
+<!--            #{point.pipeLength,jdbcType=VARCHAR},-->
+<!--            #{point.lat,jdbcType=NUMERIC},-->
+<!--            #{point.lng,jdbcType=NUMERIC}-->
+<!--            from dual-->
+<!--        </foreach>-->
+<!--    </insert>-->
+
     <insert id="insertBacthPointTemp">
-        insert into tf_plan_point_temp(id,
-        plan_id,
-        point_id,
-        child_plan_id,
-        user_id,
-        company_id,
-        region_id,
-        device_type_id,
-        period_id,
-        geometry,
-        name,
-        address,
-        code,
-        content,
-        pipe_length,
-        lat,
-        lng
-        )
-        <foreach close=")" collection="pointTempList" item="point" index="index" open="(" separator="union">
-            select
+        begin
+        <foreach collection="pointTempList" item="point" index="index" separator=";">
+            insert into tf_plan_point_temp(id,
+            plan_id,
+            point_id,
+            child_plan_id,
+            user_id,
+            company_id,
+            region_id,
+            device_type_id,
+            period_id,
+            geometry,
+            name,
+            address,
+            code,
+            content,
+            pipe_length,
+            lat,
+            lng
+            ) values (
             #{point.id,jdbcType=NUMERIC},
             #{point.planId,jdbcType=NUMERIC},
             #{point.pointId,jdbcType=NUMERIC},
@@ -550,9 +592,9 @@
             #{point.content,jdbcType=VARCHAR},
             #{point.pipeLength,jdbcType=VARCHAR},
             #{point.lat,jdbcType=NUMERIC},
-            #{point.lng,jdbcType=NUMERIC}
-            from dual
+            #{point.lng,jdbcType=NUMERIC})
         </foreach>
+        ;end;
     </insert>
 
     <insert id="insertBacthPathTemp">

+ 1 - 1
src/main/resources/mapper/PlanMapper.xml

@@ -30,7 +30,7 @@
         <result property="pointNum" column="POINT_NUM"/>
         <result property="objectIds" column="OBJECT_IDS"/>
         <result property="companyId" column="COMPANY_ID"/>
-        <result property="userIds" column="USER_IDS"/>
+        <result property="userId" column="USER_ID"/>
         <association property="companyName" column="COMPANY_ID"
                      select="com.tofly.common.mapper.ToflyCodeCommonMapper.getCompanyName"></association>
         <association property="regionName" column="REGION_ID" select="getregionName"></association>