hfxc226 3 years ago
parent
commit
43eade0926

+ 6 - 0
platform-dao/src/main/java/com/platform/dao/mapper/check/CheckStandardMapper.java

@@ -24,6 +24,12 @@ public interface CheckStandardMapper extends MyMapper<CheckStandard> {
      */
     List<CheckStandardVO> selectList(CheckStandardDTO dto);
 
+    /**
+     * 查询最大的编码
+     *
+     * @return
+     */
+    String selectMaxNo();
     /**
      * 查询型号对应的点检标准
      * @param modelId

+ 113 - 28
platform-dao/src/main/java/com/platform/dao/vo/export/repair/ExportRepairApplicationFormVO.java

@@ -3,6 +3,7 @@ package com.platform.dao.vo.export.repair;
 import com.platform.office.annotation.Excel;
 import lombok.Data;
 import lombok.experimental.Accessors;
+
 import java.io.Serializable;
 import java.time.LocalDateTime;
 
@@ -27,49 +28,133 @@ public class ExportRepairApplicationFormVO implements Serializable {
     private String sbNo;
 
     /**
-   * 设备名称
-   */
-  @Excel(name = "设备名称", orderNum = "3")
-  private String sbName;
+     * 设备名称
+     */
+    @Excel(name = "设备名称", orderNum = "3")
+    private String sbName;
     /**
      * 设备名称
      */
-    @Excel(name = "故障部位", orderNum = "4")
+    @Excel(name = "工单类别", orderNum = "4", dicCode = "REPAIR_APPLICATION_FORM_CATEGORY")
+    private String category;
+    /**
+     * 设备名称
+     */
+    @Excel(name = "故障部位", orderNum = "5")
     private String partName;
-  /**
-   * 报修人id
-   */
-  @Excel(name = "报修人", orderNum = "5")
-  private String actualUser;
+    /**
+     * 报修人id
+     */
+    @Excel(name = "报修人", orderNum = "6")
+    private String actualUser;
 
     /**
-   * 问题描述
-   */
-  @Excel(name = "问题描述", orderNum = "6")
-  private String content;
+     * 维修描述
+     */
+    @Excel(name = "问题描述", orderNum = "7")
+    private String repairContent;
 
-  /**
-   * 报修状态: 1-待分配 2-已分配 3-已完成 4-已撤销
-   */
-  @Excel(name = "报修状态", orderNum = "7", dicCode="REPAIR_APPLICATION_FORM_STATUS" )
-  private Integer status;
+    /**
+     * 报修状态: 1-待分配 2-已分配 3-已完成 4-已撤销
+     */
+    @Excel(name = "报修状态", orderNum = "8", dicCode = "REPAIR_APPLICATION_FORM_STATUS")
+    private Integer status;
 
     /**
      * 报修时间
      */
-    @Excel(name = "报修时间", orderNum = "8")
+    @Excel(name = "报修时间", orderNum = "9")
     private LocalDateTime applyTime;
     /**
-   * 维修开始时间
-   */
-  @Excel(name = "维修开始时间", orderNum = "9")
-  private LocalDateTime repairStartTime;
+     * 维修开始时间
+     */
+    @Excel(name = "维修开始时间", orderNum = "10")
+    private LocalDateTime repairStartTime;
+
+    /**
+     * 维修结束时间
+     */
+    @Excel(name = "维修结束时间", orderNum = "11")
+    private LocalDateTime repairEndTime;
+
+    /**
+     * 分析时间
+     */
+    @Excel(name = "分析时间", orderNum = "12")
+    private LocalDateTime analyzeTime;
+
+    /**
+     * 问题描述
+     */
+    @Excel(name = "问题描述", orderNum = "13")
+    private String problemDesc;
+    /**
+     * 检查处理过程
+     */
+    @Excel(name = "问题描述", orderNum = "14")
+    private String checkProcess;
+    /**
+     * 原因分析
+     */
+    @Excel(name = "原因分析", orderNum = "15")
+    private String reasonAnalysis;
+
+    /**
+     * 更新维修计划
+     */
+    @Excel(name = "是否更新维修计划", orderNum = "16")
+    private String changeRepairPlan;
 
     /**
-   * 维修结束时间
-   */
-  @Excel(name = "维修结束时间", orderNum = "10")
-  private LocalDateTime repairEndTime;
+     * 更新维修计划
+     */
+    @Excel(name = "更新维修计划", orderNum = "17")
+    private String changeRepairPlanContent;
+
+    /**
+     * 更新备件计划
+     */
+    @Excel(name = "是否更新备件计划", orderNum = "18")
+    private String changeSparePlan;
+
+    /**
+     * 更新备件计划
+     */
+    @Excel(name = "更新备件计划", orderNum = "19")
+    private String changeSparePlanContent;
+
+    /**
+     * 人员培训
+     */
+    @Excel(name = "是否人员培训", orderNum = "20")
+    private String userTeach;
 
+    /**
+     * 人员培训
+     */
+    @Excel(name = "人员培训", orderNum = "21")
+    private String userTeachContent;
+    /**
+     * 设备改造升级
+     */
+    @Excel(name = "是否设备改造升级", orderNum = "22")
+    private String sbChange;
+
+    /**
+     * 设备改造升级
+     */
+    @Excel(name = "设备改造升级", orderNum = "23")
+    private String sbChangeContent;
+    /**
+     * 其他
+     */
+    @Excel(name = "是否其他", orderNum = "24")
+    private String otherChange;
+
+    /**
+     * 其他
+     */
+    @Excel(name = "其他", orderNum = "25")
+    private String otherChangeContent;
 
 }

+ 56 - 4
platform-dao/src/main/java/com/platform/dao/vo/export/repair/ExportRepairReasonVO.java

@@ -53,11 +53,63 @@ public class ExportRepairReasonVO implements Serializable {
   @Excel(name = "原因分析", orderNum = "6")
   private String reasonAnalysis;
 
-    /**
-   * 改进措施
+  /**
+   * 更新维修计划
+   */
+  @Excel(name = "是否更新维修计划", orderNum = "7")
+  private Boolean changeRepairPlan;
+
+  /**
+   * 更新维修计划
+   */
+  @Excel(name = "更新维修计划", orderNum = "8")
+  private String changeRepairPlanContent;
+
+  /**
+   * 更新备件计划
+   */
+  @Excel(name = "是否更新备件计划", orderNum = "9")
+  private Boolean changeSparePlan;
+
+  /**
+   * 更新备件计划
+   */
+  @Excel(name = "更新备件计划", orderNum = "10")
+  private String changeSparePlanContent;
+
+  /**
+   * 人员培训
+   */
+  @Excel(name = "是否人员培训", orderNum = "11")
+  private Boolean userTeach;
+
+  /**
+   * 人员培训
+   */
+  @Excel(name = "人员培训", orderNum = "12")
+  private String userTeachContent;
+  /**
+   * 设备改造升级
+   */
+  @Excel(name = "是否设备改造升级", orderNum = "13")
+  private Boolean sbChange;
+
+  /**
+   * 设备改造升级
+   */
+  @Excel(name = "设备改造升级", orderNum = "14")
+  private String sbChangeContent;
+  /**
+   * 其他
+   */
+  @Excel(name = "是否其他", orderNum = "15")
+  private Boolean otherChange;
+
+  /**
+   * 其他
    */
-  @Excel(name = "改进措施", orderNum = "7")
-  private String improveMeasure;
+  @Excel(name = "其他", orderNum = "16")
+  private String otherChangeContent;
 
   
 }

+ 2 - 1
platform-dao/src/main/java/com/platform/dao/vo/query/repair/RepairReasonVO.java

@@ -21,7 +21,8 @@ import java.time.LocalDate;
 @Data
 @Accessors(chain = true)
 @EqualsAndHashCode(callSuper = true)
-public class RepairReasonVO extends BaseVO implements Serializable {
+public class
+RepairReasonVO extends BaseVO implements Serializable {
     private Integer type;
     /**
      * 状态:1新建,2已完成

+ 63 - 0
platform-dao/src/main/java/com/platform/dao/vo/repair/RepairApplicationFormVO.java

@@ -288,4 +288,67 @@ public class RepairApplicationFormVO extends BaseVO implements Serializable {
      * 类型
      */
     private Integer type;
+    /**
+     * 分析时间
+     */
+    private LocalDate analyzeTime;
+    /**
+     * 问题描述
+     */
+    private String problemDesc;
+    /**
+     * 检查处理过程
+     */
+    private String checkProcess;
+    /**
+     * 原因分析
+     */
+    private String reasonAnalysis;
+    /**
+     * 更新维修计划
+     */
+    private String changeRepairPlan;
+
+    /**
+     * 更新维修计划
+     */
+    private String changeRepairPlanContent;
+
+    /**
+     * 更新备件计划
+     */
+    private String changeSparePlan;
+
+    /**
+     * 更新备件计划
+     */
+    private String changeSparePlanContent;
+
+    /**
+     * 人员培训
+     */
+    private String userTeach;
+
+    /**
+     * 人员培训
+     */
+    private String userTeachContent;
+    /**
+     * 设备改造升级
+     */
+    private String sbChange;
+
+    /**
+     * 设备改造升级
+     */
+    private String sbChangeContent;
+    /**
+     * 其他
+     */
+    private String otherChange;
+
+    /**
+     * 其他
+     */
+    private String otherChangeContent;
 }

+ 4 - 0
platform-dao/src/main/resources/mapper/check/CheckStandardMapper.xml

@@ -170,6 +170,10 @@ checkstandard.last_date,
         where tcppr.project_id = #{projectId}
     </select>
 
+
+    <select id="selectMaxNo" resultType="java.lang.String">
+        select max(no) from t_check_standard
+    </select>
     <update id="updateBatch" parameterType="java.util.List">
         <foreach collection="list" item="item" index="index" open="" close="" separator=";">
             update t_check_standard

+ 2 - 2
platform-rest/src/main/java/com/platform/rest/controller/repair/RepairApplicationFormController.java

@@ -250,8 +250,8 @@ public class RepairApplicationFormController {
     @SysLog("报修单导出")
     @PreAuthorize("@pms.hasPermission('repair-application-forms-export')")
     public void export(HttpServletResponse response, RepairApplicationFormDTO repairApplicationFormDTO) {
-        List<RepairApplicationForm> list = repairApplicationFormService.getModelListByDTO(repairApplicationFormDTO);
-        ExcelUtil.exportResponseDict(response, ExportRepairApplicationFormVO.class, BeanConverterUtil.copyListProperties(list, ExportRepairApplicationFormVO.class), "报修单");
+        List<RepairApplicationFormVO> list = repairApplicationFormService.getVOListByDTO(repairApplicationFormDTO);
+        ExcelUtil.exportResponseDict(response, ExportRepairApplicationFormVO.class, BeanConverterUtil.copyListProperties(list, ExportRepairApplicationFormVO.class), "单");
     }
 
 }

+ 19 - 5
platform-service/src/main/java/com/platform/service/check/impl/CheckStandardServiceImpl.java

@@ -143,6 +143,13 @@ public class CheckStandardServiceImpl extends BaseServiceImpl<CheckStandardMappe
         return pageInfo;
     }
 
+    /**
+     * 编码需要查询最大的编码,然后+1,
+     * 编码格式:五位,补零,00001
+     *
+     * @param model
+     * @return
+     */
     @Transactional(rollbackFor = Exception.class)
     @Override
     public CheckStandard saveModelByDTO(CheckStandardDTO model) {
@@ -155,9 +162,15 @@ public class CheckStandardServiceImpl extends BaseServiceImpl<CheckStandardMappe
         // 设置编码
         Weekend<CheckStandard> weekend = new Weekend<>(CheckStandard.class);
         weekend.weekendCriteria().andIsNotNull(CheckStandard::getId);
-        Integer count = mapper.selectCountByExample(weekend);
-        String str1 = String.format("%05d", count);
-        model.setNo(str1);
+        String selectMaxNo = mapper.selectMaxNo();
+        if(StringUtils.isBlank(selectMaxNo)){
+            model.setNo("00001");
+        }else{
+            String newStr = selectMaxNo.replaceFirst("^0*", "");
+            int count = Integer.valueOf(newStr) + 1;
+            String str1 = String.format("%05d", count);
+            model.setNo(str1);
+        }
 
         // 设置等级
         setLevel(model);
@@ -181,8 +194,9 @@ public class CheckStandardServiceImpl extends BaseServiceImpl<CheckStandardMappe
     }
 
     public static void main(String[] args) {
-        String str1 = String.format("%05d", 1);
-        System.out.println(str1);
+        String str = "00045";
+        String newStr = str.replaceFirst("^0*", "");
+        System.out.println(newStr);
     }
 
     public String setNo(int no){

+ 3 - 0
platform-service/src/main/java/com/platform/service/repair/RepairApplicationFormService.java

@@ -7,6 +7,7 @@ import com.platform.dao.dto.repair.RepairCheckDTO;
 import com.platform.dao.dto.repair.RepairFormDTO;
 import com.platform.dao.entity.repair.RepairApplicationForm;
 import com.platform.dao.entity.repair.RepairForm;
+import com.platform.dao.vo.query.check.CheckJobVO;
 import com.platform.dao.vo.repair.RepairApplicationFormVO;
 import com.platform.dao.vo.repair.RepairFormVO;
 import com.platform.dao.vo.report.RepairReport24VO;
@@ -24,6 +25,8 @@ import java.util.List;
  */
 public interface RepairApplicationFormService extends IBaseService<RepairApplicationForm, RepairApplicationFormDTO> {
 
+    public List<RepairApplicationFormVO> getVOListByDTO(RepairApplicationFormDTO model);
+
     /**
      * 批量删除
      *

+ 40 - 2
platform-service/src/main/java/com/platform/service/repair/impl/RepairApplicationFormServiceImpl.java

@@ -17,13 +17,16 @@ import com.platform.dao.dto.repair.RepairApplicationFormDTO;
 import com.platform.dao.dto.repair.RepairCheckDTO;
 import com.platform.dao.dto.repair.RepairFormDTO;
 import com.platform.dao.dto.sb.SbInfoDTO;
+import com.platform.dao.dto.store.InStoreDetailDTO;
 import com.platform.dao.dto.upms.SysUserDTO;
 import com.platform.dao.entity.check.CheckJob;
 import com.platform.dao.entity.repair.RepairApplicationForm;
 import com.platform.dao.entity.repair.RepairCheck;
 import com.platform.dao.entity.repair.RepairForm;
+import com.platform.dao.entity.repair.RepairReason;
 import com.platform.dao.entity.sb.SbInfo;
 import com.platform.dao.entity.sb.SbInspectionFill;
+import com.platform.dao.entity.store.InStoreDetail;
 import com.platform.dao.entity.upms.SysConfig;
 import com.platform.dao.entity.upms.SysFile;
 import com.platform.dao.entity.upms.SysUser;
@@ -31,6 +34,7 @@ import com.platform.dao.enums.*;
 import com.platform.dao.mapper.repair.RepairApplicationFormMapper;
 import com.platform.dao.mapper.repair.RepairCheckMapper;
 import com.platform.dao.mapper.repair.RepairFormMapper;
+import com.platform.dao.mapper.repair.RepairReasonMapper;
 import com.platform.dao.mapper.upms.SysFileMapper;
 import com.platform.dao.mapper.upms.SysUserMapper;
 import com.platform.dao.util.MessageTemplateUtil;
@@ -87,6 +91,7 @@ public class RepairApplicationFormServiceImpl extends BaseServiceImpl<RepairAppl
 
     private final RepairFormService repairFormService;
     private RepairFormMapper repairFormMapper;
+    private RepairReasonMapper repairReasonMapper;
     private RepairCheckMapper repairCheckMapper;
     private final SysUserService sysUserService;
     private final SysUserDeptService sysUserDeptService;
@@ -94,6 +99,39 @@ public class RepairApplicationFormServiceImpl extends BaseServiceImpl<RepairAppl
     private final SysFileMapper sysFileMapper;
     private final SysUserMapper userMapper;
 
+    @Override
+    public List<RepairApplicationFormVO> getVOListByDTO(RepairApplicationFormDTO model) {
+        List<RepairApplicationFormVO> list = mapper.selectPageList(model);
+
+        if(CollectionUtil.isNotEmpty(list)){
+            List<String> ids = list.stream().map(RepairApplicationFormVO::getId).collect(Collectors.toList());
+            Weekend<RepairReason> detailWeekend = new Weekend<>(RepairReason.class);
+            detailWeekend.weekendCriteria().andIn(RepairReason::getRepairId, ids);
+            List<RepairReason> reasonList = repairReasonMapper.selectByExample(detailWeekend);
+            for (RepairApplicationFormVO vo : list) {
+                for (RepairReason reason : reasonList) {
+                    if (vo.getId().equals(reason.getRepairId())) {
+                        vo.setAnalyzeTime(reason.getAnalyzeTime());
+                        vo.setProblemDesc(reason.getProblemDesc());
+                        vo.setCheckProcess(reason.getCheckProcess());
+                        vo.setReasonAnalysis(reason.getReasonAnalysis());
+                        vo.setChangeRepairPlan(reason.getChangeRepairPlan()?"是":"否");
+                        vo.setChangeRepairPlanContent(reason.getChangeRepairPlanContent());
+                        vo.setChangeSparePlan(reason.getChangeSparePlan()?"是":"否");
+                        vo.setChangeSparePlanContent(reason.getChangeSparePlanContent());
+                        vo.setUserTeach(reason.getUserTeach()?"是":"否");
+                        vo.setUserTeachContent(reason.getUserTeachContent());
+                        vo.setSbChange(reason.getSbChange()?"是":"否");
+                        vo.setSbChangeContent(reason.getSbChangeContent());
+                        vo.setOtherChange(reason.getOtherChange()?"是":"否");
+                        vo.setOtherChangeContent(reason.getOtherChangeContent());
+                    }
+                }
+            }
+        }
+        return list;
+    }
+
     @Override
     public int batchDelete(List<String> ids) {
         // 判断是否允许删除
@@ -438,7 +476,7 @@ public class RepairApplicationFormServiceImpl extends BaseServiceImpl<RepairAppl
             Weekend<SysFile> weekend = new Weekend<>(SysFile.class);
             weekend.weekendCriteria().andEqualTo(SysFile::getType, SysFileTypeEnum.REPAIR_APPLICATION_IMGS.getValue()).andEqualTo(SysFile::getTargetId, model.getId());
             sysFileMapper.deleteByExample(weekend);
-            List<SysFile> list = SysFileUtils.changeFileList(model.getApplicationFileList(), model.getId(),  SysFileTypeEnum.REPAIR_APPLICATION_IMGS.getValue());
+            List<SysFile> list = SysFileUtils.changeFileList(model.getApplicationFileList(), model.getId(), SysFileTypeEnum.REPAIR_APPLICATION_IMGS.getValue());
             if (CollectionUtil.isNotEmpty(list)) {
                 sysFileMapper.insertListforComplex(list);
             }
@@ -455,7 +493,7 @@ public class RepairApplicationFormServiceImpl extends BaseServiceImpl<RepairAppl
             Weekend<SysFile> weekend = new Weekend<>(SysFile.class);
             weekend.weekendCriteria().andEqualTo(SysFile::getType, SysFileTypeEnum.REPAIR_REPAIR_IMGS.getValue()).andEqualTo(SysFile::getTargetId, model.getId());
             sysFileMapper.deleteByExample(weekend);
-            List<SysFile> list = SysFileUtils.changeFileList(model.getRepairFileList(), model.getId(),  SysFileTypeEnum.REPAIR_REPAIR_IMGS.getValue());
+            List<SysFile> list = SysFileUtils.changeFileList(model.getRepairFileList(), model.getId(), SysFileTypeEnum.REPAIR_REPAIR_IMGS.getValue());
             if (CollectionUtil.isNotEmpty(list)) {
                 sysFileMapper.insertListforComplex(list);
             }

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

@@ -1,6 +1,7 @@
 package com.platform.service.repair.impl;
 import cn.hutool.core.collection.CollectionUtil;
 import com.platform.common.bean.AbstractPageResultBean;
+import com.platform.common.exception.BusinessException;
 import com.platform.common.util.IdGeneratorUtils;
 import com.platform.common.util.ListUtils;
 import com.platform.dao.bean.MyPage;
@@ -52,6 +53,12 @@ public class RepairReasonServiceImpl extends BaseServiceImpl<RepairReasonMapper,
 
     @Override
     public RepairReason saveModelByDTO(RepairReasonDTO model) {
+        Weekend<RepairReason> weekend = new Weekend<>(RepairReason.class);
+        weekend.weekendCriteria().andEqualTo(RepairReason::getRepairId, model.getFileList());
+        int count = mapper.selectCountByExample(weekend);
+        if(count != 0){
+            throw new BusinessException("已经存在维修报告,无法再添加,请修改或者删除已有报告");
+        }
         model.setId(IdGeneratorUtils.getObjectId());
         model.setStatus(RepairReasonStatusEnum.NORMAL.getValue());
         this.saveFile(model);