瀏覽代碼

巡检管理-巡检计划相关接口上传1

jichaobo 3 年之前
父節點
當前提交
187f8a9e0f

+ 68 - 0
fiveep-model/src/main/java/com/bizmatics/model/vo/PatrolInspectionRouteOneVo.java

@@ -0,0 +1,68 @@
+package com.bizmatics.model.vo;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import lombok.Builder;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author ya
+ * @since 2021-10-19
+ */
+@Data
+@Builder
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+public class PatrolInspectionRouteOneVo {
+
+    private static final long serialVersionUID=1L;
+
+    /**
+     * 巡检路线id
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    /**
+     * 站点id
+     */
+    private Integer siteId;
+
+    /**
+     * 巡检路线名称
+     */
+    private String inspectionRouteName;
+
+    /**
+     * 创建人
+     */
+    private String creator;
+
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+
+    /**
+     * 启用状态(0 未启用,1 启用)
+     */
+    private Integer status;
+
+    /**
+     * 巡检计划
+     */
+    private Integer inspectionSchemeId;
+
+    private List<PatrolRouteContentVo> patrolRouteContentVo;
+
+
+}

+ 2 - 1
fiveep-model/src/main/java/com/bizmatics/model/vo/PatrolInspectionSchemeOneVo.java

@@ -8,6 +8,7 @@ import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
 
 import java.util.Date;
+import java.util.List;
 
 /**
  * <p>
@@ -106,7 +107,7 @@ public class PatrolInspectionSchemeOneVo {
      */
     private Integer executions;
 
-    private PatrolInspectionRouteVo patrolInspectionRouteVo;
+    private List<PatrolInspectionRouteVo> patrolInspectionRouteVo;
 
     private PatrolInspectionTeamVo patrolInspectionTeamVo;
 

+ 2 - 1
fiveep-model/src/main/java/com/bizmatics/model/vo/PatrolInspectionSchemeVo.java

@@ -8,6 +8,7 @@ import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
 
 import java.util.Date;
+import java.util.List;
 
 /**
  * <p>
@@ -105,7 +106,7 @@ public class PatrolInspectionSchemeVo {
      */
     private Integer executions;
 
-    private PatrolInspectionRouteVo patrolInspectionRouteVo;
+    private List<PatrolInspectionRouteVo> patrolInspectionRouteVo;
 
     private PatrolInspectionTeamVo patrolInspectionTeamVo;
 

+ 57 - 51
fiveep-service/src/main/java/com/bizmatics/service/impl/PatrolInspectionSchemeServiceImpl.java

@@ -60,25 +60,28 @@ public class PatrolInspectionSchemeServiceImpl extends AbstractCrudService<Patro
         patrolInspectionScheme.setExecutions(0);
         this.save(patrolInspectionScheme);
         Integer inspectionSchemeId = patrolInspectionScheme.getId();
-        PatrolInspectionRoute patrolInspectionRoute = new PatrolInspectionRoute();
-
-        patrolInspectionRoute.setInspectionRouteName(patrolInspectionSchemeVo.getPatrolInspectionRouteVo().getInspectionRouteName());
-        patrolInspectionRoute.setInspectionSchemeId(inspectionSchemeId);
-        patrolInspectionRoute.setSiteId(patrolInspectionSchemeVo.getPatrolInspectionRouteVo().getSiteId());
-        patrolInspectionRoute.setCreator(user.getUserName());
-        patrolInspectionRoute.setCreateTime(new Date());
-        patrolInspectionRoute.setStatus(1);
-        patrolInspectionRouteService.save(patrolInspectionRoute);
-        Integer inspectionRouteId = patrolInspectionRoute.getId();
-        if (patrolInspectionSchemeVo.getPatrolInspectionRouteVo().getPatrolRouteContentVo().size() > 0) {
-            for (int j = 0; j < patrolInspectionSchemeVo.getPatrolInspectionRouteVo().getPatrolRouteContentVo().size(); j++) {
-                PatrolRouteContent patrolRouteContent = new PatrolRouteContent();
-                patrolRouteContent.setInspectionContentId(patrolInspectionSchemeVo.getPatrolInspectionRouteVo().getPatrolRouteContentVo().get(j).getInspectionContentId());
-                patrolRouteContent.setInspectionRouteId(inspectionRouteId);
-                patrolRouteContent.setCreator(user.getUserName());
-                patrolRouteContent.setCreateTime(new Date());
-                patrolRouteContent.setStatus(1);
-                patrolRouteContentService.save(patrolRouteContent);
+        if (patrolInspectionSchemeVo.getPatrolInspectionRouteVo().size()>0){
+            for (int i=0;i<patrolInspectionSchemeVo.getPatrolInspectionRouteVo().size();i++){
+                PatrolInspectionRoute patrolInspectionRoute = new PatrolInspectionRoute();
+                patrolInspectionRoute.setInspectionRouteName(patrolInspectionSchemeVo.getPatrolInspectionRouteVo().get(i).getInspectionRouteName());
+                patrolInspectionRoute.setInspectionSchemeId(inspectionSchemeId);
+                patrolInspectionRoute.setSiteId(patrolInspectionSchemeVo.getPatrolInspectionRouteVo().get(i).getSiteId());
+                patrolInspectionRoute.setCreator(user.getUserName());
+                patrolInspectionRoute.setCreateTime(new Date());
+                patrolInspectionRoute.setStatus(1);
+                patrolInspectionRouteService.save(patrolInspectionRoute);
+                Integer inspectionRouteId = patrolInspectionRoute.getId();
+                if (patrolInspectionSchemeVo.getPatrolInspectionRouteVo().get(i).getPatrolRouteContentVo().size() > 0) {
+                    for (int j = 0; j < patrolInspectionSchemeVo.getPatrolInspectionRouteVo().get(i).getPatrolRouteContentVo().size(); j++) {
+                        PatrolRouteContent patrolRouteContent = new PatrolRouteContent();
+                        patrolRouteContent.setInspectionContentId(patrolInspectionSchemeVo.getPatrolInspectionRouteVo().get(i).getPatrolRouteContentVo().get(j).getInspectionContentId());
+                        patrolRouteContent.setInspectionRouteId(inspectionRouteId);
+                        patrolRouteContent.setCreator(user.getUserName());
+                        patrolRouteContent.setCreateTime(new Date());
+                        patrolRouteContent.setStatus(1);
+                        patrolRouteContentService.save(patrolRouteContent);
+                    }
+                }
             }
         }
     }
@@ -128,24 +131,28 @@ public class PatrolInspectionSchemeServiceImpl extends AbstractCrudService<Patro
             }
         }
         //重新添加新数据
-        PatrolInspectionRoute patrolInspectionRoute = new PatrolInspectionRoute();
-        patrolInspectionRoute.setInspectionRouteName(patrolInspectionSchemeVo.getPatrolInspectionRouteVo().getInspectionRouteName());
-        patrolInspectionRoute.setInspectionSchemeId(inspectionSchemeId);
-        patrolInspectionRoute.setSiteId(patrolInspectionSchemeVo.getPatrolInspectionRouteVo().getSiteId());
-        patrolInspectionRoute.setCreator(user.getUserName());
-        patrolInspectionRoute.setCreateTime(new Date());
-        patrolInspectionRoute.setStatus(1);
-        patrolInspectionRouteService.save(patrolInspectionRoute);
-        Integer inspectionRouteId = patrolInspectionRoute.getId();
-        if (patrolInspectionSchemeVo.getPatrolInspectionRouteVo().getPatrolRouteContentVo().size() > 0) {
-            for (int j = 0; j < patrolInspectionSchemeVo.getPatrolInspectionRouteVo().getPatrolRouteContentVo().size(); j++) {
-                PatrolRouteContent patrolRouteContent = new PatrolRouteContent();
-                patrolRouteContent.setInspectionContentId(patrolInspectionSchemeVo.getPatrolInspectionRouteVo().getPatrolRouteContentVo().get(j).getInspectionContentId());
-                patrolRouteContent.setInspectionRouteId(inspectionRouteId);
-                patrolRouteContent.setCreator(user.getUserName());
-                patrolRouteContent.setCreateTime(new Date());
-                patrolRouteContent.setStatus(1);
-                patrolRouteContentService.save(patrolRouteContent);
+        if (patrolInspectionSchemeVo.getPatrolInspectionRouteVo().size()>0){
+            for (int i =0;i<patrolInspectionSchemeVo.getPatrolInspectionRouteVo().size();i++){
+                PatrolInspectionRoute patrolInspectionRoute = new PatrolInspectionRoute();
+                patrolInspectionRoute.setInspectionRouteName(patrolInspectionSchemeVo.getPatrolInspectionRouteVo().get(i).getInspectionRouteName());
+                patrolInspectionRoute.setInspectionSchemeId(inspectionSchemeId);
+                patrolInspectionRoute.setSiteId(patrolInspectionSchemeVo.getPatrolInspectionRouteVo().get(i).getSiteId());
+                patrolInspectionRoute.setCreator(user.getUserName());
+                patrolInspectionRoute.setCreateTime(new Date());
+                patrolInspectionRoute.setStatus(1);
+                patrolInspectionRouteService.save(patrolInspectionRoute);
+                Integer inspectionRouteId = patrolInspectionRoute.getId();
+                if (patrolInspectionSchemeVo.getPatrolInspectionRouteVo().get(i).getPatrolRouteContentVo().size() > 0) {
+                    for (int j = 0; j < patrolInspectionSchemeVo.getPatrolInspectionRouteVo().get(i).getPatrolRouteContentVo().size(); j++) {
+                        PatrolRouteContent patrolRouteContent = new PatrolRouteContent();
+                        patrolRouteContent.setInspectionContentId(patrolInspectionSchemeVo.getPatrolInspectionRouteVo().get(i).getPatrolRouteContentVo().get(j).getInspectionContentId());
+                        patrolRouteContent.setInspectionRouteId(inspectionRouteId);
+                        patrolRouteContent.setCreator(user.getUserName());
+                        patrolRouteContent.setCreateTime(new Date());
+                        patrolRouteContent.setStatus(1);
+                        patrolRouteContentService.save(patrolRouteContent);
+                    }
+                }
             }
         }
     }
@@ -176,7 +183,7 @@ public class PatrolInspectionSchemeServiceImpl extends AbstractCrudService<Patro
     @Override
     public List<PatrolInspectionSchemeOneVo> PatrolInspectionScheme(Integer id) {
 //        PatrolInspectionSchemeVo patrolInspectionSchemeVo = new PatrolInspectionSchemeVo();
-        PatrolInspectionRouteVo patrolInspectionRouteVo = new PatrolInspectionRouteVo();
+        List<PatrolInspectionRouteVo> patrolInspectionRouteVoList = new ArrayList<>();
         PatrolInspectionTeamVo patrolInspectionTeamVo = new PatrolInspectionTeamVo();
         LambdaQueryWrapper<PatrolInspectionScheme> queryWrapper = Wrappers.lambdaQuery();
         queryWrapper.eq(PatrolInspectionScheme::getId, id);
@@ -187,18 +194,19 @@ public class PatrolInspectionSchemeServiceImpl extends AbstractCrudService<Patro
         queryWrapperOne.eq(PatrolInspectionRoute::getInspectionSchemeId, id).eq(PatrolInspectionRoute::getStatus, 1);
         List<PatrolInspectionRoute> patrolInspectionRouteList = patrolInspectionRouteService.list(queryWrapperOne);
         if (patrolInspectionRouteList.size() > 0) {
-//            for (int i = 0; i < patrolInspectionRouteList.size(); i++) {
-            List<PatrolRouteContentVo> patrolRouteContentList = baseMapper.patrolRouteContent(patrolInspectionRouteList.get(0).getId());
-            Integer inspectionSchemeId = patrolInspectionRouteList.get(0).getInspectionSchemeId();
-
+            for (int i = 0; i < patrolInspectionRouteList.size(); i++) {
+            List<PatrolRouteContentVo> patrolRouteContentList = baseMapper.patrolRouteContent(patrolInspectionRouteList.get(i).getId());
+            Integer inspectionSchemeId = patrolInspectionRouteList.get(i).getInspectionSchemeId();
+            PatrolInspectionRouteVo patrolInspectionRouteVo = new PatrolInspectionRouteVo();
             patrolInspectionRouteVo.setInspectionSchemeId(inspectionSchemeId);
-            patrolInspectionRouteVo.setInspectionRouteName(patrolInspectionRouteList.get(0).getInspectionRouteName());
-            patrolInspectionRouteVo.setCreator(patrolInspectionRouteList.get(0).getCreator());
-            patrolInspectionRouteVo.setCreateTime(patrolInspectionRouteList.get(0).getCreateTime());
-            patrolInspectionRouteVo.setId(patrolInspectionRouteList.get(0).getId());
-            patrolInspectionRouteVo.setStatus(patrolInspectionRouteList.get(0).getStatus());
+            patrolInspectionRouteVo.setInspectionRouteName(patrolInspectionRouteList.get(i).getInspectionRouteName());
+            patrolInspectionRouteVo.setCreator(patrolInspectionRouteList.get(i).getCreator());
+            patrolInspectionRouteVo.setCreateTime(patrolInspectionRouteList.get(i).getCreateTime());
+            patrolInspectionRouteVo.setId(patrolInspectionRouteList.get(i).getId());
+            patrolInspectionRouteVo.setStatus(patrolInspectionRouteList.get(i).getStatus());
             patrolInspectionRouteVo.setPatrolRouteContentVo(patrolRouteContentList);
-//            }
+            patrolInspectionRouteVoList.add(patrolInspectionRouteVo);
+            }
         }
 
         //团队查询
@@ -206,7 +214,6 @@ public class PatrolInspectionSchemeServiceImpl extends AbstractCrudService<Patro
         queryWrapperTwo.eq(PatrolInspectionTeam::getId, patrolInspectionSchemeList.get(0).getInspectionTeamId()).eq(PatrolInspectionTeam::getStatus, 1);
         List<PatrolInspectionTeam> patrolInspectionTeamList = patrolInspectionTeamService.list(queryWrapperTwo);
         if (patrolInspectionTeamList.size() > 0) {
-//            for (int i = 0; i < patrolInspectionTeamList.size(); i++) {
             List<PatrolInspectors> patrolInspectorsList = baseMapper.patrolInspectorsList(patrolInspectionTeamList.get(0).getId());
             patrolInspectionTeamVo.setId(patrolInspectionTeamList.get(0).getId());
             patrolInspectionTeamVo.setTeamName(patrolInspectionTeamList.get(0).getTeamName());
@@ -218,7 +225,6 @@ public class PatrolInspectionSchemeServiceImpl extends AbstractCrudService<Patro
             patrolInspectionTeamVo.setCreateTime(patrolInspectionTeamList.get(0).getCreateTime());
             patrolInspectionTeamVo.setStatus(patrolInspectionTeamList.get(0).getStatus());
             patrolInspectionTeamVo.setPatrolInspectors(patrolInspectorsList);
-//            }
         }
 
         List<PatrolInspectionSchemeOneVo> list = new ArrayList<>();
@@ -240,7 +246,7 @@ public class PatrolInspectionSchemeServiceImpl extends AbstractCrudService<Patro
                 .executions(patrolInspectionSchemeList.get(0).getExecutions())
                 .id(patrolInspectionSchemeList.get(0).getId())
                 .patrolInspectionTeamVo(patrolInspectionTeamVo)
-                .patrolInspectionRouteVo(patrolInspectionRouteVo)
+                .patrolInspectionRouteVo(patrolInspectionRouteVoList)
                 .build()
         );
         return list;