guarantee-lsq 2 жил өмнө
parent
commit
e2ebd6f468

+ 8 - 8
platform-dao/src/main/java/com/platform/dao/entity/repair/RepairScheme.java

@@ -37,14 +37,6 @@ public class RepairScheme implements Serializable {
      * 维修意见
      */
     private String opinion;
-    /**
-     * 维修意见图
-     */
-    //private String imageList;
-    /**
-     * 维修方案文件
-     */
-    //private String opinionFile;
     /**
      * 方案提供者ID
      */
@@ -83,5 +75,13 @@ public class RepairScheme implements Serializable {
      */
     @Transient
     private DataScope dataScope;
+    // 新增字段
+    private String sbId; // 维修设备ID
+
+    private String sbPartId; // 维修设备部位ID
+
+    private String errorTypeId; // 异常类别
+
+    private String errorContent; // 故障描述
 
 }

+ 2 - 2
platform-dao/src/main/resources/mapper/repair/RepairSchemeMapper.xml

@@ -43,7 +43,7 @@
             and repair.update_user_name = #{updateUserName}
         </if>
         <if test="createdTimeStart != null">
-            and repair.created_time <![CDATA[>=]]>; #{createdTimeStart}
+            and repair.created_time <![CDATA[>=]]> #{createdTimeStart}
         </if>
         <if test="createdTimeEnd != null">
             and repair.created_time <![CDATA[<=]]> #{createdTimeEnd}
@@ -52,7 +52,7 @@
             and repair.created_time = #{createdTime}
         </if>
         <if test="updateTimeStart != null">
-            and repair.update_time <![CDATA[>=]]>; #{updateTimeStart}
+            and repair.update_time <![CDATA[>=]]>#{updateTimeStart}
         </if>
         <if test="updateTimeEnd != null">
             and repair.update_time <![CDATA[<=]]> #{updateTimeEnd}

+ 10 - 0
platform-rest/src/main/java/com/platform/rest/controller/repair/RepairSchemeController.java

@@ -71,6 +71,16 @@ public class RepairSchemeController {
       return new R<>();
   }
 
+  /**
+   * 复制方案
+   * @return R
+   */
+  @SysLog("复制维修方案")
+  @PutMapping("/{id}/{repairId}")
+  public R copy(@PathVariable("id") String id, @PathVariable("repairId") String repairId) {
+    repairSchemeService.copyScheme(id,repairId);
+    return new R<>("获取成功");
+  }
 
 
   /**

+ 7 - 0
platform-service/src/main/java/com/platform/service/repair/RepairSchemeService.java

@@ -48,4 +48,11 @@ public interface RepairSchemeService extends IBaseService<RepairScheme, RepairSc
     void updateByDTO(RepairSchemeDTO model);
 
     RepairSchemeVO getVOById(String id);
+
+ /**
+  * 方案复制
+  * @param id 被复制方案ID
+  * @param repairId
+  */
+ void copyScheme(String id,String repairId);
 }

+ 21 - 0
platform-service/src/main/java/com/platform/service/repair/impl/RepairSchemeServiceImpl.java

@@ -2,6 +2,7 @@ package com.platform.service.repair.impl;
 
 import com.github.pagehelper.PageHelper;
 import com.platform.common.bean.AbstractPageResultBean;
+import com.platform.common.exception.DeniedException;
 import com.platform.common.util.BeanConverterUtil;
 import com.platform.common.util.IdGeneratorUtils;
 import com.platform.common.util.ListUtils;
@@ -97,6 +98,26 @@ public class RepairSchemeServiceImpl extends BaseServiceImpl<RepairSchemeMapper,
         return model;
     }
 
+    @Override
+    public void copyScheme(String id, String repairId) {
+        RepairScheme scheme = mapper.selectByPrimaryKey(id);
+        if(scheme == null){
+            throw new DeniedException("待获取方案失败,该方案不存在");
+        }
+        RepairScheme copyScheme = BeanConverterUtil.copyObjectProperties(scheme,RepairScheme.class);
+        copyScheme.setId(IdGeneratorUtils.getObjectId());
+        copyScheme.setRepairId(repairId);
+        copyScheme.setCreatedTime(LocalDateTime.now());
+        copyScheme.setCreatedUserId(SecurityUtils.getUserInfo().getUserId());
+        copyScheme.setCreatedUserName(SecurityUtils.getUserInfo().getUsername());
+        copyScheme.setUpdateTime(null);
+        copyScheme.setUpdateUserId(null);
+        copyScheme.setUpdateUserName(null);
+        RepairApplicationForm form = repairApplicationFormMapper.selectByPrimaryKey(repairId);
+        copyScheme.setSbId(form.getSbId());
+        mapper.insert(copyScheme);
+    }
+
     @Override
     public AbstractPageResultBean<RepairScheme> selectPageInfo(RepairSchemeDTO record, int pageNum, int pageSize) {
         PageHelper.startPage(pageNum, pageSize);