Przeglądaj źródła

维保根据最新原型修改

yejian016332 4 lat temu
rodzic
commit
698983224a
13 zmienionych plików z 49 dodań i 101 usunięć
  1. 19 1
      imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/productionResourceCenter/service/impl/MaintenanceLogServiceImpl.java
  2. 2 0
      imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/productionResourceCenter/service/impl/RepairServiceImpl.java
  3. 2 3
      imcs-admin-boot/imcs-business-biz/src/main/resources/mapper_business/base/productionResourceCenter/MaintenceLogMapper.xml
  4. 9 16
      imcs-admin-boot/imcs-business-biz/src/main/resources/mapper_business/base/productionResourceCenter/RepairMapper.xml
  5. 0 1
      imcs-admin-boot/imcs-business-controller/src/main/java/com/github/zuihou/business/controller/productionResourceCenter/RepairController.java
  6. 2 13
      imcs-admin-boot/imcs-business-entity/src/main/java/com/github/zuihou/business/productionResourceCenter/dto/MaintenanceLogPageDTO.java
  7. 2 13
      imcs-admin-boot/imcs-business-entity/src/main/java/com/github/zuihou/business/productionResourceCenter/dto/MaintenanceLogSaveDTO.java
  8. 2 8
      imcs-admin-boot/imcs-business-entity/src/main/java/com/github/zuihou/business/productionResourceCenter/dto/MaintenanceLogUpdateDTO.java
  9. 0 8
      imcs-admin-boot/imcs-business-entity/src/main/java/com/github/zuihou/business/productionResourceCenter/dto/RepairPageDTO.java
  10. 0 7
      imcs-admin-boot/imcs-business-entity/src/main/java/com/github/zuihou/business/productionResourceCenter/dto/RepairSaveDTO.java
  11. 0 7
      imcs-admin-boot/imcs-business-entity/src/main/java/com/github/zuihou/business/productionResourceCenter/dto/RepairUpdateDTO.java
  12. 4 15
      imcs-admin-boot/imcs-business-entity/src/main/java/com/github/zuihou/business/productionResourceCenter/entity/MaintenanceLog.java
  13. 7 9
      imcs-admin-boot/imcs-business-entity/src/main/java/com/github/zuihou/business/productionResourceCenter/entity/Repair.java

+ 19 - 1
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/productionResourceCenter/service/impl/MaintenanceLogServiceImpl.java

@@ -7,15 +7,19 @@ import com.github.zuihou.business.productionResourceCenter.dto.MaintenanceLogPag
 import com.github.zuihou.business.productionResourceCenter.dto.MaintenanceLogSaveDTO;
 import com.github.zuihou.business.productionResourceCenter.dto.MaintenanceLogUpdateDTO;
 import com.github.zuihou.business.productionResourceCenter.entity.MaintenanceLog;
+import com.github.zuihou.business.productionResourceCenter.entity.Repair;
 import com.github.zuihou.business.productionResourceCenter.service.MaintenanceLogService;
+import com.github.zuihou.business.productionResourceCenter.service.RepairService;
 import com.github.zuihou.database.mybatis.conditions.Wraps;
 import com.github.zuihou.database.mybatis.conditions.query.LbqWrapper;
 import com.github.zuihou.injection.annonation.InjectionField;
 import com.github.zuihou.utils.BeanPlusUtil;
 import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.time.LocalDateTime;
 import java.util.List;
 
 import static com.github.zuihou.utils.BizAssert.isFalse;
@@ -28,10 +32,14 @@ import static com.github.zuihou.utils.BizAssert.isFalse;
 @Slf4j
 @Service
 public class MaintenanceLogServiceImpl extends SuperServiceImpl<MaintenanceLogMapper, MaintenanceLog> implements MaintenanceLogService {
+    @Autowired
+    private RepairService repairService;
+
     @Override
     @InjectionField
     public IPage<MaintenanceLog> pageList(IPage page, LbqWrapper<MaintenanceLog> wrapper) {
-        return baseMapper.pageList(page, wrapper);
+        IPage<MaintenanceLog> data =  baseMapper.pageList(page, wrapper);
+        return data;
     }
 
     @Override
@@ -52,6 +60,11 @@ public class MaintenanceLogServiceImpl extends SuperServiceImpl<MaintenanceLogMa
 //        isFalse(check(data),"设备已在维保,请重新输入!");
         MaintenanceLog maintenanceLog = BeanPlusUtil.toBean(data, MaintenanceLog.class);
         save(maintenanceLog);
+        Repair repair = repairService.getById(maintenanceLog.getRepairId());
+        repair.setRepairStatus(maintenanceLog.getStatus());
+        repair.setUpdateTime(LocalDateTime.now());
+        repair.setUpdateUser(maintenanceLog.getUpdateUser());
+        repairService.updateAllById(repair);
         return maintenanceLog;
     }
 
@@ -59,6 +72,11 @@ public class MaintenanceLogServiceImpl extends SuperServiceImpl<MaintenanceLogMa
     public MaintenanceLog update(MaintenanceLogUpdateDTO data) {
         MaintenanceLog maintenanceLog = BeanPlusUtil.toBean(data, MaintenanceLog.class);
         updateById(maintenanceLog);
+        Repair repair = repairService.getById(maintenanceLog.getRepairId());
+        repair.setRepairStatus(maintenanceLog.getStatus());
+        repair.setUpdateTime(LocalDateTime.now());
+        repair.setUpdateUser(maintenanceLog.getUpdateUser());
+        repairService.updateAllById(repair);
         return maintenanceLog;
     }
 

+ 2 - 0
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/productionResourceCenter/service/impl/RepairServiceImpl.java

@@ -56,6 +56,7 @@ public class RepairServiceImpl extends SuperServiceImpl<RepairMapper, Repair> im
         //检查
         isFalse(check(data),"设备已在维保,请重新输入!");
         Repair repair = BeanPlusUtil.toBean(data, Repair.class);
+        repair.setRepairStatus("1");
         repair.setRepairStartTime(LocalDateTime.now());
         save(repair);
         return repair;
@@ -64,6 +65,7 @@ public class RepairServiceImpl extends SuperServiceImpl<RepairMapper, Repair> im
     @Override
     public Repair update(RepairUpdateDTO data) {
         Repair repair = BeanPlusUtil.toBean(data, Repair.class);
+        repair.setRepairStartTime(LocalDateTime.now());
         updateById(repair);
         return repair;
     }

+ 2 - 3
imcs-admin-boot/imcs-business-biz/src/main/resources/mapper_business/base/productionResourceCenter/MaintenceLogMapper.xml

@@ -12,8 +12,7 @@
         <result column="repair_id" jdbcType="BIGINT" property="repairId"/>
         <result column="maintenance_user" jdbcType="BIGINT" property="maintenanceUser"/>
         <result column="maintenance_name" jdbcType="VARCHAR" property="maintenanceName"/>
-        <result column="maintenance_start_time" jdbcType="TIMESTAMP" property="maintenanceStartTime"/>
-        <result column="maintenance_end_time" jdbcType="TIMESTAMP" property="maintenanceEndTime"/>
+        <result column="maintenance_time" jdbcType="TIMESTAMP" property="maintenanceTime"/>
         <result column="status" jdbcType="VARCHAR" property="status"/>
         <result column="remark" jdbcType="VARCHAR" property="remark"/>
     </resultMap>
@@ -21,7 +20,7 @@
     <!-- 通用查询结果列 -->
     <sql id="Base_Column_List">
         id,create_time,create_user,update_time,update_user,
-        repair_id,maintenance_start_time,maintenance_end_time,concat(maintenance_start_time,'-',maintenance_end_time) AS maintenanceTime,maintenance_user,maintenance_name, status,remark
+        repair_id,maintenance_time,maintenance_user,maintenance_name, status,remark
     </sql>
 
     <!-- 分页 -->

+ 9 - 16
imcs-admin-boot/imcs-business-biz/src/main/resources/mapper_business/base/productionResourceCenter/RepairMapper.xml

@@ -14,14 +14,13 @@
         <result column="repair_end_time" jdbcType="TIMESTAMP" property="repairEndTime"/>
         <result column="repair_status" jdbcType="VARCHAR" property="repairStatus"/>
         <result column="status" jdbcType="VARCHAR" property="status"/>
-        <result column="weight" jdbcType="BIGINT" property="weight"/>
         <result column="remark" jdbcType="VARCHAR" property="remark"/>
     </resultMap>
 
     <!-- 通用查询结果列 -->
     <sql id="Base_Column_List">
         id,create_time,create_user,update_time,update_user,
-        productionresource_id,repair_start_time,repair_end_time, weight,repair_status,status,remark,code,productionresourceName,lineDesc,process,downTime
+        productionresource_id,repair_end_time,repair_status,status,remark,code,productionresourceName,lineDesc,process,downTime,operationName,expireFlag
     </sql>
 
     <!-- 分页 -->
@@ -30,7 +29,7 @@
         <include refid="Base_Column_List"/>
         from (
         SELECT
-        a.*,
+        a.id,a.repair_end_time,a.status,a.repair_status,a.create_time,a.create_user,a.update_user,a.update_time, (select d.name from c_auth_user d where d.id = a.update_user) as operationName,a.productionresource_id,a.remark,
         case when timestampdiff( MINUTE, now(), a.repair_end_time ) > 0 then  CONCAT(
         TRUNCATE ( timestampdiff( MINUTE, now(), a.repair_end_time ) / 1440, 0 ),
         '天',
@@ -41,20 +40,14 @@
         ) else '已到维保时间' end  AS downTime,
         IF
         (
-        ROUND(
-        timestampdiff( MINUTE, now(), a.repair_end_time ) / timestampdiff( MINUTE, a.repair_start_time, a.repair_end_time ) * 100,
-        2
-        )<![CDATA[ <= ]]>0,
-        0,
-        ROUND(
-        timestampdiff( MINUTE, now(), a.repair_end_time ) / timestampdiff( MINUTE, a.repair_start_time, a.repair_end_time ) * 100,
-        2
-        )
+        timestampdiff( SECOND, now(), a.repair_end_time ) <![CDATA[ <= ]]> 0,
+        100,
+        convert(
+        timestampdiff( SECOND, now(), a.repair_end_time ) / timestampdiff( SECOND, a.repair_start_time, a.repair_end_time ) ,decimal(30,28)
+        ) * 100
         ) AS process,
-        if(ROUND(
-        timestampdiff( MINUTE, now(), a.repair_end_time ) / timestampdiff( MINUTE, a.repair_start_time, a.repair_end_time ) * 100,
-        2
-        ) <![CDATA[ <= ]]> 0,'0','1') as repair_status,
+        IF
+        (timestampdiff( SECOND, now(), a.repair_end_time ) <![CDATA[ <= ]]> 0,1,0) AS expireFlag,
         b.CODE,
         b.NAME AS productionresourceName,
         c.NAME AS lineDesc

+ 0 - 1
imcs-admin-boot/imcs-business-controller/src/main/java/com/github/zuihou/business/controller/productionResourceCenter/RepairController.java

@@ -53,7 +53,6 @@ public class RepairController extends SuperController<RepairService,Long, Repair
         Repair repair = BeanUtil.toBean(data, Repair.class);
         //Wraps.lbQ(station); 这种写法值 不能和  ${ew.customSqlSegment} 一起使用
         // ${ew.customSqlSegment} 语法一定要手动eq like 等
-        wrapper.orderByAsc(Repair::getWeight);
         baseService.pageList(page, wrapper);
     }
 

+ 2 - 13
imcs-admin-boot/imcs-business-entity/src/main/java/com/github/zuihou/business/productionResourceCenter/dto/MaintenanceLogPageDTO.java

@@ -33,19 +33,8 @@ public class MaintenanceLogPageDTO {
     @ApiModelProperty(value = "维保计划id")
     private Long repairId;
 
-
-
-    /**
-     * 维保记录开始时间
-     */
-    @ApiModelProperty("维保记录开始时间")
-    protected LocalDateTime maintenanceStartTime;
-
-    /**
-     * 维保记录结束时间
-     */
-    @ApiModelProperty("维保记录结束时间")
-    protected LocalDateTime maintenanceEndTime;
+    @ApiModelProperty("维保记录时间")
+    protected LocalDateTime maintenanceTime;
 
     /**
      * 维保人员

+ 2 - 13
imcs-admin-boot/imcs-business-entity/src/main/java/com/github/zuihou/business/productionResourceCenter/dto/MaintenanceLogSaveDTO.java

@@ -33,19 +33,8 @@ public class MaintenanceLogSaveDTO {
     @ApiModelProperty(value = "维保计划id")
     private Long repairId;
 
-
-
-    /**
-     *
-     */
-    @ApiModelProperty("维保记录开始时间")
-    protected LocalDateTime maintenanceStartTime;
-
-    /**
-     *
-     */
-    @ApiModelProperty("维保记录结束时间")
-    protected LocalDateTime maintenanceEndTime;
+    @ApiModelProperty("维保记录时间")
+    protected LocalDateTime maintenanceTime;
 
     /**
      * 维保人员

+ 2 - 8
imcs-admin-boot/imcs-business-entity/src/main/java/com/github/zuihou/business/productionResourceCenter/dto/MaintenanceLogUpdateDTO.java

@@ -42,14 +42,8 @@ public class MaintenanceLogUpdateDTO {
     /**
      *
      */
-    @ApiModelProperty("维保记录开始时间")
-    protected LocalDateTime maintenanceStartTime;
-
-    /**
-     *
-     */
-    @ApiModelProperty("维保记录结束时间")
-    protected LocalDateTime maintenanceEndTime;
+    @ApiModelProperty("维保记录时间")
+    protected LocalDateTime maintenanceTime;
 
     /**
      * 维保人员

+ 0 - 8
imcs-admin-boot/imcs-business-entity/src/main/java/com/github/zuihou/business/productionResourceCenter/dto/RepairPageDTO.java

@@ -76,14 +76,6 @@ public class RepairPageDTO {
     @Excel(name = "产线名称")
     private String lineDesc;
 
-    /**
-     * 排序(从小至大)
-     */
-    @ApiModelProperty(value = "排序(从小至大)")
-    @Excel(name = "排序(从小至大)")
-    private Long weight;
-
-
     /**
      * 生产资源编号
      */

+ 0 - 7
imcs-admin-boot/imcs-business-entity/src/main/java/com/github/zuihou/business/productionResourceCenter/dto/RepairSaveDTO.java

@@ -58,13 +58,6 @@ public class RepairSaveDTO {
     @Length(max = 255, message = "备注长度不能超过255")
     private String remark;
 
-    /**
-     * 排序(从小至大)
-     */
-    @ApiModelProperty(value = "排序(从小至大)")
-    @Excel(name = "排序(从小至大)")
-    private Long weight;
-
     /**
      * 启用状态(1-启用0-冻结)
      */

+ 0 - 7
imcs-admin-boot/imcs-business-entity/src/main/java/com/github/zuihou/business/productionResourceCenter/dto/RepairUpdateDTO.java

@@ -50,13 +50,6 @@ public class RepairUpdateDTO {
     @ApiModelProperty("维保结束时间")
     protected LocalDateTime repairEndTime;
 
-    /**
-     * 排序(从小至大)
-     */
-    @ApiModelProperty(value = "排序(从小至大)")
-    @Excel(name = "排序(从小至大)")
-    private Long weight;
-
     /**
      * 维保状态(1-正常 0-待维修)
      */

+ 4 - 15
imcs-admin-boot/imcs-business-entity/src/main/java/com/github/zuihou/business/productionResourceCenter/entity/MaintenanceLog.java

@@ -40,23 +40,12 @@ public class MaintenanceLog extends Entity<Long> {
     private Long repairId;
 
     /**
-     * 维保记录开始时间
+     * 维保记录时间
      */
-    @ApiModelProperty("维保记录开始时间")
-    @TableField(value = "maintenance_start_time")
+    @ApiModelProperty("维保记录时间")
+    @TableField(value = "maintenance_time")
     @Excel(name = "维保记录开始时间")
-    protected LocalDateTime maintenanceStartTime;
-
-    /**
-     * 维保记录结束时间
-     */
-    @ApiModelProperty("维保记录结束时间")
-    @TableField(value = "maintenance_end_time")
-    @Excel(name = "维保记录结束时间")
-    protected LocalDateTime maintenanceEndTime;
-
-    @TableField(exist = false)
-    protected String maintenanceTime;
+    protected LocalDateTime maintenanceTime;
 
     /**
      * 维保后状态(1-正常 0-暂停使用)

+ 7 - 9
imcs-admin-boot/imcs-business-entity/src/main/java/com/github/zuihou/business/productionResourceCenter/entity/Repair.java

@@ -69,7 +69,6 @@ public class Repair extends Entity<Long> {
      */
     @ApiModelProperty(value = "维保状态(1-正常 0-待维修)")
     @Length(max = 4, message = "维保状态(1-正常 0-待维修)长度不能超过4")
-    @TableField(exist = false)
     @Excel(name = "维保状态(1-正常 0-待维修))")
     private String repairStatus;
 
@@ -91,14 +90,6 @@ public class Repair extends Entity<Long> {
     @Excel(name = "启用状态(1-启用0-冻结)")
     private String status;
 
-    /**
-     * 排序(从小至大)
-     */
-    @ApiModelProperty(value = "排序(从小至大)")
-    @Length(max = 4, message = "排序(从小至大)")
-    @TableField(value = "weight", condition = EQUAL)
-    @Excel(name = "排序(从小至大)")
-    private Long weight;
 
     /**
      * 产线名称
@@ -133,4 +124,11 @@ public class Repair extends Entity<Long> {
     @TableField(exist = false)
     private String downTime;
 
+    @ApiModelProperty(value = "操作人")
+    @TableField(exist = false)
+    private String operationName;
+
+    @TableField(exist = false)
+    private String expireFlag;
+
 }