Jelajahi Sumber

测量设备管理

xiongchao 4 tahun lalu
induk
melakukan
1d4ae07ded
19 mengubah file dengan 1273 tambahan dan 84 penghapusan
  1. 171 0
      platform-dao/src/main/java/com/platform/dao/dto/sb/SbMeasureLogDTO.java
  2. 151 0
      platform-dao/src/main/java/com/platform/dao/entity/sb/SbMeasureLog.java
  3. 5 4
      platform-dao/src/main/java/com/platform/dao/enums/SbUseType.java
  4. 3 1
      platform-dao/src/main/java/com/platform/dao/enums/SysFileTypeEnum.java
  5. 1 0
      platform-dao/src/main/java/com/platform/dao/mapper/sb/SbInfoMapper.java
  6. 31 0
      platform-dao/src/main/java/com/platform/dao/mapper/sb/SbMeasureLogMapper.java
  7. 14 3
      platform-dao/src/main/java/com/platform/dao/util/CustomExcelImportUtil.java
  8. 2 2
      platform-dao/src/main/java/com/platform/dao/vo/export/check/ExportCheckStandardVO.java
  9. 99 0
      platform-dao/src/main/java/com/platform/dao/vo/export/sb/ExportSbMeasureLogVO.java
  10. 149 0
      platform-dao/src/main/java/com/platform/dao/vo/query/sb/SbMeasureLogVO.java
  11. 108 9
      platform-dao/src/main/resources/mapper/sb/SbInfoMapper.xml
  12. 129 0
      platform-dao/src/main/resources/mapper/sb/SbMeasureLogMapper.xml
  13. 12 0
      platform-rest/src/main/java/com/platform/rest/controller/sb/SbInfoController.java
  14. 141 0
      platform-rest/src/main/java/com/platform/rest/controller/sb/SbMeasureLogController.java
  15. 0 60
      platform-rest/src/test/java/com/test/TestPython.java
  16. 13 1
      platform-service/src/main/java/com/platform/service/sb/SbInfoService.java
  17. 40 0
      platform-service/src/main/java/com/platform/service/sb/SbMeasureLogService.java
  18. 12 4
      platform-service/src/main/java/com/platform/service/sb/impl/SbInfoServiceImpl.java
  19. 192 0
      platform-service/src/main/java/com/platform/service/sb/impl/SbMeasureLogServiceImpl.java

+ 171 - 0
platform-dao/src/main/java/com/platform/dao/dto/sb/SbMeasureLogDTO.java

@@ -0,0 +1,171 @@
+package com.platform.dao.dto.sb;
+
+import com.platform.common.bean.BaseDTO;
+import com.platform.common.validation.group.UpdateGroup;
+import com.platform.dao.entity.upms.SysFile;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+import javax.persistence.Transient;
+import javax.validation.constraints.NotNull;
+import java.io.Serializable;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.util.List;
+
+/**
+ * @Description 点检标准DTO
+ * @Author liuyu
+ * @Date 2020-05-28 17:23:30
+ * @Version Copyright (c) 2020,北京乾元坤和科技有限公司 All rights reserved.
+ */
+@Data
+@Accessors(chain = true)
+@EqualsAndHashCode(callSuper = true)
+public class SbMeasureLogDTO extends BaseDTO implements Serializable {
+
+    /**
+     * 主键
+     */
+    @NotNull(groups = {UpdateGroup.class}, message = "ID不能为空")
+    private String id;
+    /**
+     * 设备id
+     */
+    private String sbId;
+    /**
+     * 被复制设备id
+     */
+    @Transient
+    private String copySbId;
+    /**
+     * 标准名称
+     */
+    private String name;
+
+    /**
+     * 编码
+     */
+    private String no;
+    /**
+     * 点检人id
+     */
+    private String checkUserId;
+    /**
+     * 计划周期
+     */
+    private Integer period;
+    /**
+     * 周期类型: 参考数据字典
+     */
+    private Integer periodType;
+    /**
+     * 上次实际执行日期
+     */
+    private LocalDate lastDate;
+    /**
+     * 上次生成时间
+     */
+    @Transient
+    private LocalDateTime lastGenerateTime;
+    /**
+     * 上次生成小时,里程
+     */
+    @Transient
+    private Integer lastNum;
+    /**
+     * 周期类型: 参考数据字典
+     */
+    private Integer actionType;
+    /**
+     * 检查类型: 1-点检 2-巡检
+     */
+    private Integer type;
+    /**
+     * 是否启用: 0-否 1-是
+     */
+    private Integer enable;
+    /**
+     * 设备部位
+     */
+    private String part;
+    /**
+     * 标准工时
+     */
+    private String standardHours;
+    /**
+     * 实际工时
+     */
+    private String realHours;
+    /**
+     * 要求
+     */
+    private String requirement;
+
+    /**
+     * 备注
+     */
+    private String remark;
+
+    /**
+     * 创建人
+     */
+    private String createdUserId;
+
+    /**
+     * 更新人
+     */
+    private String updateUserId;
+
+    /**
+     * 创建人名称
+     */
+    private String createdUserName;
+
+    /**
+     * 更新人名称
+     */
+    private String updateUserName;
+
+    /**
+     * 创建时间
+     */
+    private LocalDateTime createdTime;
+    /**
+     * 创建开始时间
+     */
+    private String createdTimeStart;
+    /**
+     * 创建结束时间
+     */
+    private String createdTimeEnd;
+
+    /**
+     * 更新时间
+     */
+    private LocalDateTime updateTime;
+    /**
+     * 更新开始时间
+     */
+    private String updateTimeStart;
+    /**
+     * 更新结束时间
+     */
+    private String updateTimeEnd;
+
+    /**
+     * 标准参数
+     */
+    /*private List<CheckStandardParamDTO> paramList;*/
+
+    /**
+     * 保养图片
+     * */
+    private List<SysFile> checkImgList;
+    /**
+     * 保养手册
+     */
+    private List<SysFile> checkFileList;
+
+}

+ 151 - 0
platform-dao/src/main/java/com/platform/dao/entity/sb/SbMeasureLog.java

@@ -0,0 +1,151 @@
+package com.platform.dao.entity.sb;
+
+import com.platform.common.bean.DataScope;
+import com.platform.dao.entity.check.CheckStandardParam;
+import com.platform.dao.entity.upms.SysFile;
+import lombok.Data;
+
+import javax.persistence.Id;
+import javax.persistence.Table;
+import javax.persistence.Transient;
+import java.io.Serializable;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.util.List;
+
+/**
+ * @Description 计量设备计量记录
+ * @Author liuyu
+ * @Date 2020-05-12 09:30:26
+ * @Version Copyright (c) 2019,北京乾元坤和科技有限公司 All rights reserved.
+ */
+@Table(name = "t_sb_measure_log")
+@Data
+public class SbMeasureLog implements Serializable {
+
+    /**
+     * 主键
+     */
+    @Id
+    private String id;
+    /**
+     * 设备id
+     */
+    private String sbId;
+    /**
+     * 标准名称
+     */
+    private String name;
+    /**
+     * 编码
+     */
+    private String no;
+    /**
+     * 检查类型: 1-点检 2-巡检
+     */
+    private Integer type;
+    /**
+     * 计划周期
+     */
+    private Integer period;
+    /**
+     * 上次实际执行日期
+     */
+    private LocalDate lastDate;
+    /**
+     * 下次预计执行日期
+     */
+    //private LocalDate nextDate;
+    /**
+     * 周期类型: 参考数据字典
+     */
+    private Integer periodType;
+    /**
+     * 周期类型: 参考数据字典
+     */
+    private Integer actionType;
+    /**
+     * 上次生成时间
+     */
+    @Transient
+    private LocalDateTime lastGenerateTime;
+    /**
+     * 上次生成小时,里程
+     */
+    @Transient
+    private Integer lastNum;
+    /**
+     * 是否启用: 0-否 1-是
+     */
+    private Integer enable;
+    /**
+     * 要求
+     */
+    private String requirement;
+    /**
+     * 设备部位
+     */
+    private String part;
+    /**
+     * 标准工时
+     */
+    private String standardHours;
+    /**
+     * 实际工时
+     */
+    private String realHours;
+    /**
+     * 备注
+     */
+    private String remark;
+    /**
+     * 创建人
+     */
+    private String createdUserId;
+    /**
+     * 更新人
+     */
+    private String updateUserId;
+    /**
+     * 创建人名称
+     */
+    private String createdUserName;
+    /**
+     * 更新人名称
+     */
+    private String updateUserName;
+    /**
+     * 点检人id
+     */
+    private String checkUserId;
+    /**
+     * 创建时间
+     */
+    private LocalDateTime createdTime;
+    /**
+     * 更新时间
+     */
+    private LocalDateTime updateTime;
+
+    /**
+     * 数据权限
+     */
+    @Transient
+    private DataScope dataScope;
+
+    /**
+     * 标准参数
+     */
+    @Transient
+    private List<CheckStandardParam> paramList;
+
+    /**
+     * 保养图片
+     * */
+    private List<SysFile> checkImgList;
+    /**
+     * 保养手册
+     */
+    private List<SysFile> checkFileList;
+
+}

+ 5 - 4
platform-dao/src/main/java/com/platform/dao/enums/SbUseType.java

@@ -4,6 +4,8 @@ import lombok.AllArgsConstructor;
 import lombok.Getter;
 
 /**
+ *
+ * 设备自定义类型
  * @Description
  * @Author future
  * @Date 2020/6/30
@@ -15,10 +17,9 @@ public enum SbUseType {
     /**
      *
      */
-    NORMAL(1, "工程设备"),
-    CAR(11, "车辆"),
-    OTHER(11, "其他设备"),
-    ;
+    OTHER(3, "一般性生产设备"),
+    BGCL(4, "计量设备"),
+    TZSB(5, "特种设备及附件");
     private final Integer value;
 
     private final String description;

+ 3 - 1
platform-dao/src/main/java/com/platform/dao/enums/SysFileTypeEnum.java

@@ -29,7 +29,9 @@ public enum SysFileTypeEnum {
     REPAIR_FEE_IMGS(18, "维修-费用图片"),
     REPAIR_FEE_FILES(19, "维修-费用文件"),
     CHECK_STANDARD_IMGS(21, "保养图片"),
-    CHECK_STANDARD_FILES(22, "保养文件");
+    CHECK_STANDARD_FILES(22, "保养文件"),
+    Sb_MEASURE_IMGS(31, "计量图片"),
+    Sb_MEASURE_FILES(32, "计量文件");
     private Integer value;
     private final String description;
 }

+ 1 - 0
platform-dao/src/main/java/com/platform/dao/mapper/sb/SbInfoMapper.java

@@ -88,4 +88,5 @@ public interface SbInfoMapper extends MyMapper<SbInfo> {
      */
     void updateBatchValue(List<SbInfo> list);
 
+    List selectPageInfoForWarn(SbInfoDTO record);
 }

+ 31 - 0
platform-dao/src/main/java/com/platform/dao/mapper/sb/SbMeasureLogMapper.java

@@ -0,0 +1,31 @@
+package com.platform.dao.mapper.sb;
+
+import com.platform.dao.config.MyMapper;
+import com.platform.dao.dto.check.CheckStandardDTO;
+import com.platform.dao.dto.sb.SbMeasureLogDTO;
+import com.platform.dao.entity.check.CheckStandard;
+import com.platform.dao.entity.sb.SbMeasureLog;
+import com.platform.dao.vo.query.check.CheckStandardVO;
+import com.platform.dao.vo.query.sb.SbMeasureLogVO;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+
+
+/**
+ * @Description 点检标准 mapper
+ * @Author liuyu
+ * @Date 2020-05-28 17:23:30
+ * @Version Copyright (c) 2020,北京乾元坤和科技有限公司 All rights reserved.
+ */
+@Component
+public interface SbMeasureLogMapper extends MyMapper<SbMeasureLog> {
+    /**
+     * 分页查询
+     * @param dto
+     * @return
+     */
+    List<SbMeasureLogVO> selectList(SbMeasureLogDTO dto);
+
+    List selectPageInfoForWarn(SbMeasureLogDTO record);
+}

+ 14 - 3
platform-dao/src/main/java/com/platform/dao/util/CustomExcelImportUtil.java

@@ -477,7 +477,7 @@ public class CustomExcelImportUtil {
                 "C:\\Users\\cyz\\Desktop\\固定资产0207(1)\\固定资产折旧明细表-2020年12月-苏丹.xls",
                 "C:\\Users\\cyz\\Desktop\\固定资产0207(1)\\固定资产折旧明细表-2020年12月-坦桑尼亚.xls",
                 "C:\\Users\\cyz\\Desktop\\固定资产0207(1)\\固定资产折旧明细表-2020年12月-苏丹.xls"};*/
-        String[] files = {"C:\\Users\\cyz\\Desktop\\新增气动平衡吊 备件导入清单.xls"};
+        String[] files = {"C:\\Users\\cyz\\Desktop\\备件基础信息 导入版.xls"};
         InputStream inputstream = new FileInputStream(files[0]);
         LocalDateTime now = LocalDateTime.now();
         List<SparePartInfoVO> list = importSparePartInfoList(now, inputstream);
@@ -993,7 +993,6 @@ public class CustomExcelImportUtil {
         return result;
     }
 
-
     public static String ExcelDoubleToDate(String strDate) {
         strDate = strDate.substring(0, 5);
         if (strDate.length() == 5) {
@@ -1014,10 +1013,19 @@ public class CustomExcelImportUtil {
         Date tDate = new Date();
         long localOffset = tDate.getTimezoneOffset() * 60000; //系统时区偏移 1900/1/1 到 1970/1/1 的 25569 天
         tDate.setTime((long) ((dVal - 25569) * 24 * 3600 * 1000 + localOffset));
-
         return tDate;
     }
 
+    public static boolean isRowEmpty(Row row) {
+        for (int c = row.getFirstCellNum(); c < row.getLastCellNum(); c++) {
+            Cell cell = row.getCell(c);
+            if (cell != null && cell.getCellType() != Cell.CELL_TYPE_BLANK){
+                return false;
+            }
+        }
+        return true;
+    }
+
     /**
      * 新增导入备件
      *
@@ -1050,6 +1058,9 @@ public class CustomExcelImportUtil {
         for (int i = 2; i <= rowCounts; i++) {
             record = new SparePartInfoVO();
             Row row = sheet.getRow(i);
+            if(isRowEmpty(row)){
+                continue;
+            }
            // String index = getCellValue(row.getCell(0));
             try {
                 record.setParentName(row.getCell(3).getStringCellValue());

+ 2 - 2
platform-dao/src/main/java/com/platform/dao/vo/export/check/ExportCheckStandardVO.java

@@ -4,6 +4,7 @@ import com.platform.office.annotation.Excel;
 import lombok.Data;
 import lombok.experimental.Accessors;
 import java.io.Serializable;
+import java.time.LocalDate;
 import java.time.LocalDateTime;
 
 /**
@@ -26,8 +27,7 @@ public class ExportCheckStandardVO implements Serializable {
    * 标准名称
    */
   @Excel(name = "标准名称", orderNum = "2")
-  private String name;
-
+  private LocalDate checkDate;//检定日期(新增字段)
     /**
    * 编码
    */

+ 99 - 0
platform-dao/src/main/java/com/platform/dao/vo/export/sb/ExportSbMeasureLogVO.java

@@ -0,0 +1,99 @@
+package com.platform.dao.vo.export.sb;
+
+import com.platform.office.annotation.Excel;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+/**
+ * @Description 点检标准导出VO
+ * @Author liuyu
+ * @Date 2020-05-28 17:23:30
+ * @Version Copyright (c) 2020,北京乾元坤和科技有限公司 All rights reserved.
+ */
+@Data
+@Accessors(chain = true)
+public class ExportSbMeasureLogVO implements Serializable {
+
+    /**
+   * 主键
+   */
+  @Excel(name = "主键", orderNum = "1")
+  private String id;
+
+    /**
+   * 标准名称
+   */
+  @Excel(name = "标准名称", orderNum = "2")
+  private String name;
+
+    /**
+   * 编码
+   */
+  @Excel(name = "编码", orderNum = "3")
+  private String no;
+
+    /**
+   * 检查类型: 1-点检 2-巡检
+   */
+  @Excel(name = "检查类型: 1-点检 2-巡检", orderNum = "4")
+  private Integer type;
+
+    /**
+   * 是否启用: 0-否 1-是
+   */
+  @Excel(name = "是否启用: 0-否 1-是", orderNum = "5")
+  private Integer enable;
+
+    /**
+   * 要求
+   */
+  @Excel(name = "要求", orderNum = "6")
+  private String requirement;
+
+    /**
+   * 备注
+   */
+  @Excel(name = "备注", orderNum = "7")
+  private String remark;
+
+    /**
+   * 创建人
+   */
+  @Excel(name = "创建人", orderNum = "8")
+  private String createdUserId;
+
+    /**
+   * 更新人
+   */
+  @Excel(name = "更新人", orderNum = "9")
+  private String updateUserId;
+
+    /**
+   * 创建人名称
+   */
+  @Excel(name = "创建人名称", orderNum = "10")
+  private String createdUserName;
+
+    /**
+   * 更新人名称
+   */
+  @Excel(name = "更新人名称", orderNum = "11")
+  private String updateUserName;
+
+    /**
+   * 创建时间
+   */
+  @Excel(name = "创建时间", orderNum = "12")
+  private LocalDateTime createdTime;
+
+    /**
+   * 更新时间
+   */
+  @Excel(name = "更新时间", orderNum = "13")
+  private LocalDateTime updateTime;
+
+
+}

+ 149 - 0
platform-dao/src/main/java/com/platform/dao/vo/query/sb/SbMeasureLogVO.java

@@ -0,0 +1,149 @@
+package com.platform.dao.vo.query.sb;
+
+import com.platform.common.bean.BaseVO;
+import com.platform.dao.entity.check.CheckStandardParam;
+import com.platform.dao.entity.upms.SysFile;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+import javax.persistence.Transient;
+import java.io.Serializable;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.util.List;
+
+/**
+ * @Description 点检标准实体类
+ * @Author liuyu
+ * @Date 2020-05-28 17:23:30
+ * @Version Copyright (c) 2020,北京乾元坤和科技有限公司 All rights reserved.
+ */
+@Data
+@Accessors(chain = true)
+@EqualsAndHashCode(callSuper = true)
+public class SbMeasureLogVO extends BaseVO implements Serializable{
+
+    /**
+     * 主键
+     */
+    private String id;
+    /**
+     * 设备id
+     */
+    private String sbId;
+    /**
+     * 项目id
+     */
+    private String projectId;
+    /**
+     * 点检人id
+     */
+    private String checkUserId;
+    /**
+     * 标准名称
+     */
+    private String name;
+    /**
+     * 编码
+     */
+    private String no;
+    /**
+     * 计划周期
+     */
+    private Integer period;
+    /**
+     * 周期类型: 参考数据字典
+     */
+    private Integer periodType;
+    /**
+     * 周期类型: 参考数据字典
+     */
+    private Integer actionType;
+    /**
+     * 检查类型: 1-点检 2-巡检
+     */
+    private Integer type;
+    /**
+     * 是否启用: 0-否 1-是
+     */
+    private Integer enable;
+    /**
+     * 设备部位Id
+     */
+    private String part;
+    /**
+     * 标准工时
+     */
+    private String standardHours;
+    /**
+     * 实际工时
+     */
+    private String realHours;
+    /**
+     * 设备部位名称
+     */
+    private String partName;
+    /**
+     * 上次实际执行日期
+     */
+    private LocalDate lastDate;
+    /**
+     * 要求
+     */
+    private String requirement;
+    /**
+     * 备注
+     */
+    private String remark;
+    /**
+     * 创建人
+     */
+    private String createdUserId;
+    /**
+     * 更新人
+     */
+    private String updateUserId;
+    /**
+     * 创建人名称
+     */
+    private String createdUserName;
+    /**
+     * 更新人名称
+     */
+    private String updateUserName;
+    /**
+     * 创建时间
+     */
+    private LocalDateTime createdTime;
+    /**
+     * 更新时间
+     */
+    private LocalDateTime updateTime;
+    /**
+     * 上次生成时间
+     */
+    private LocalDateTime lastGenerateTime;
+    /**
+     * 上次生成小时,里程
+     */
+    private Double lastNum;
+    /**
+     * 关联id
+     */
+    private String relationId;
+    /**
+     * 标准参数
+     */
+    @Transient
+    private List<CheckStandardParam> paramList;
+
+    /**
+     * 保养图片
+     * */
+    private List<SysFile> checkImgList;
+    /**
+     * 保养手册
+     */
+    private List<SysFile> checkFileList;
+}

+ 108 - 9
platform-dao/src/main/resources/mapper/sb/SbInfoMapper.xml

@@ -122,15 +122,15 @@
         sb.use_type as useType,
         sbType.name as typeName,producer.name as producerName,
         position.name as positionName,
-        check_date,
-        check_period,
-        register_no,
-        character_type,
-        used_no,
-        supplier,
-        repair_user_second,
-        batch_no,
-        register_date
+        sb.check_date,
+        sb.check_period,
+        sb.register_no,
+        sb.character_type,
+        sb.used_no,
+        sb.supplier,
+        sb.repair_user_second,
+        sb.batch_no,
+        sb.register_date
     </sql>
 
     <sql id="deptSql">
@@ -238,6 +238,105 @@
         </if>
     </select>
 
+    <select id="selectPageInfoForWarn" parameterType="com.platform.dao.dto.sb.SbInfoDTO"
+            resultType="com.platform.dao.vo.sb.SbInfoVO">
+        select
+        <include refid="Left_Column"/>
+        from t_sb_info sb
+        left join t_sb_type sbType on sb.type_id = sbType.id
+        left join t_firm_producer producer on sb.producer_id = producer.id
+        left join t_sb_position position on sb.position_id = position.id
+        left join t_sys_dept sdDept on sb.save_dept = sdDept.dept_id
+        where
+        TIMESTAMPDIFF( DAY, CURDATE( ), sb.next_check_date ) <![CDATA[ <= ]]> sb.seat_number
+        <if test="keyword != null and keyword != ''">
+            and  (
+            sb.name like concat('%',#{keyword},'%')
+            or
+            sb.no like concat('%',#{keyword},'%')
+            )
+        </if>
+        <if test="likeDeptCode != null and likeDeptCode!=''">
+            and sdDept.dept_code like concat(#{likeDeptCode},'%')
+        </if>
+
+        <if test="positionIds != null">
+            AND sb.position_id in
+            <foreach item="item" index="index" collection="positionIds" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
+        <if test="useType != null">
+            and sb.use_type = #{useType}
+        </if>
+        <if test="id != null">
+            and sb.id = #{id}
+        </if>
+        <if test="checkId != null">
+            and sb.check_id = #{checkId}
+        </if>
+        <if test="isChild != null">
+            and sb.is_child = #{isChild}
+        </if>
+        <if test="isShow != null">
+            and sb.is_show = #{isShow}
+        </if>
+        <if test="useArea != null">
+            and sb.use_area = #{useArea}
+        </if>
+        <if test="useCompany != null">
+            and sb.use_company = #{useCompany}
+        </if>
+        <if test="useProject != null">
+            and sb.use_project = #{useProject}
+        </if>
+        <if test="typeId != null">
+            and sb.type_id = #{typeId}
+        </if>
+        <if test="model != null">
+            and sb.model like concat('%',#{model},'%')
+        </if>
+        <if test="useDept != null">
+            and sb.use_dept = #{useDept}
+        </if>
+        <if test="useGroup != null">
+            and sb.use_group = #{useGroup}
+        </if>
+        <if test="saveDept != null">
+            and sb.save_dept = #{saveDept}
+        </if>
+        <if test="saveUser != null">
+            and sb.save_user = #{saveUser}
+        </if>
+        <if test="status != null">
+            and sb.status = #{status}
+        </if>
+        <if test="modelId != null">
+            and sb.model_id = #{modelId}
+        </if>
+        <if test="notStatusList != null and notStatusList.size > 0">
+            AND sb.status not in
+            <foreach item="item" index="index" collection="notStatusList" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
+        <if test="statusList != null and statusList.size > 0">
+            AND sb.status in
+            <foreach item="item" index="index" collection="statusList" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
+        <if test="sbIds != null and sbIds.size > 0">
+            AND sb.id in
+            <foreach item="item" index="index" collection="sbIds" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
+        <if test="ascriptionDept != null and ascriptionDept">
+            <include refid="deptSql"/>
+        </if>
+    </select>
+
     <select id="getById" parameterType="java.lang.Object" resultType="com.platform.dao.vo.sb.SbInfoVO">
         select
         <include refid="Left_Column"/>

+ 129 - 0
platform-dao/src/main/resources/mapper/sb/SbMeasureLogMapper.xml

@@ -0,0 +1,129 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.platform.dao.mapper.sb.SbMeasureLogMapper">
+    <sql id="Base_Column_List">
+                                     checkstandard.id,
+                                     checkstandard.sb_id,
+                                     checkstandard.standard_hours,
+                                     checkstandard.real_hours,
+                                     checkstandard.last_date,
+                                     checkstandard.check_user_id,
+                                     checkstandard.name,
+                                     checkstandard.no,
+                                     checkstandard.type,
+                                     checkstandard.period,
+                                     checkstandard.periodType,
+                                     checkstandard.actionType,
+                                     checkstandard.enable,
+                                     checkstandard.part,
+                                     checkstandard.requirement,
+                                     checkstandard.remark,
+                                     checkstandard.created_user_id,
+                                     checkstandard.update_user_id,
+                                     checkstandard.created_user_name,
+                                     checkstandard.update_user_name,
+                                     checkstandard.created_time,
+                                     checkstandard.update_time
+                        </sql>
+    <sql id="Ref_Column_List">
+                                     checkstandard.sb_id,
+                                     checkstandard.standard_hours,
+                                     checkstandard.real_hours,
+                                     checkstandard.check_user_id,
+                                     checkstandard.last_date,
+                                     checkstandard.name,
+                                     checkstandard.no,
+                                     checkstandard.type,
+                                     checkstandard.period,
+                                     checkstandard.part,
+                                     checkstandard.periodType,
+                                     checkstandard.actionType,
+                                     checkstandard.enable,
+                                     checkstandard.requirement,
+                                     checkstandard.remark,
+                                                                                                                                                                                                                                                                                                </sql>
+    <sql id="List_Condition">
+        <if test="id != null and id != ''">
+            and checkstandard.id = #{id}
+        </if>
+        <if test="sbId != null and sbId != ''">
+            and checkstandard.sb_id = #{sbId}
+        </if>
+        <if test="name != null and name != ''">
+            and checkstandard.name = #{name}
+        </if>
+        <if test="part != null and part != ''">
+            and checkstandard.part = #{part}
+        </if>
+        <if test="checkUserId != null and checkUserId != ''">
+            and checkstandard.check_user_id = #{checkUserId}
+        </if>
+        <if test="no != null and no != ''">
+            and checkstandard.no = #{no}
+        </if>
+        <if test="type != null">
+            and checkstandard.type = #{type}
+        </if>
+        <if test="period != null">
+            and checkstandard.period = #{period}
+        </if>
+        <if test="periodType != null">
+            and checkstandard.period_type = #{periodType}
+        </if>
+        <if test="actionType != null">
+            and checkstandard.action_type = #{actionType}
+        </if>
+        <if test="enable != null">
+            and checkstandard.enable = #{enable}
+        </if>
+        <if test="requirement != null and requirement != ''">
+            and checkstandard.requirement = #{requirement}
+        </if>
+        <if test="remark != null and remark != ''">
+            and checkstandard.remark = #{remark}
+        </if>
+        <if test="createdUserId != null and createdUserId != ''">
+            and checkstandard.created_user_id = #{createdUserId}
+        </if>
+        <if test="updateUserId != null and updateUserId != ''">
+            and checkstandard.update_user_id = #{updateUserId}
+        </if>
+        <if test="createdUserName != null and createdUserName != ''">
+            and checkstandard.created_user_name = #{createdUserName}
+        </if>
+        <if test="updateUserName != null and updateUserName != ''">
+            and checkstandard.update_user_name = #{updateUserName}
+        </if>
+        <if test="createdTimeStart != null">
+            and checkstandard.created_time <![CDATA[>=]]>; #{createdTimeStart}
+        </if>
+        <if test="createdTimeEnd != null">
+            and checkstandard.created_time <![CDATA[<=]]> #{createdTimeEnd}
+        </if>
+        <if test="createdTime != null">
+            and checkstandard.created_time = #{createdTime}
+        </if>
+        <if test="updateTimeStart != null">
+            and checkstandard.update_time <![CDATA[>=]]>; #{updateTimeStart}
+        </if>
+        <if test="updateTimeEnd != null">
+            and checkstandard.update_time <![CDATA[<=]]> #{updateTimeEnd}
+        </if>
+        <if test="updateTime != null">
+            and checkstandard.update_time = #{updateTime}
+        </if>
+        <if test="keyword != null and keyword != ''">
+            and checkstandard.name like concat('%',#{keyword},'%')
+        </if>
+    </sql>
+    <select id="selectList" parameterType="com.platform.dao.dto.sb.SbMeasureLogDTO"
+            resultType="com.platform.dao.vo.query.sb.SbMeasureLogVO">
+        select checkstandard.*
+        from t_sb_measure_log as checkstandard
+        <where>
+            <include refid="List_Condition"/>
+        </where>
+        order by checkstandard.created_time desc
+    </select>
+
+</mapper>

+ 12 - 0
platform-rest/src/main/java/com/platform/rest/controller/sb/SbInfoController.java

@@ -117,6 +117,18 @@ public class SbInfoController {
         return new R<>(sbInfoService.selectVOPage(sbInfoDTO, pageNum, pageSize));
     }
 
+    /**
+     * 获取检定预警分页
+     *
+     * @param pageNum   当前页码
+     * @param pageSize  每页条数
+     * @param sbInfoDTO 设备基础信息DTO
+     * @return R
+     */
+    @GetMapping("warn/page")
+    public R<AbstractPageResultBean<SbInfoVO>> queryMeasureWarn(SbInfoDTO sbInfoDTO, @RequestParam(defaultValue = "1") int pageNum, @RequestParam(defaultValue = "20") int pageSize) {
+        return new R<>(sbInfoService.selectPageInfoForWarn(sbInfoDTO, pageNum, pageSize));
+    }
 
     /**
      * 获取分页

+ 141 - 0
platform-rest/src/main/java/com/platform/rest/controller/sb/SbMeasureLogController.java

@@ -0,0 +1,141 @@
+package com.platform.rest.controller.sb;
+
+import com.platform.common.bean.AbstractPageResultBean;
+import com.platform.common.util.BeanConverterUtil;
+import com.platform.common.util.R;
+import com.platform.common.validation.group.AddGroup;
+import com.platform.common.validation.group.UpdateGroup;
+import com.platform.dao.dto.check.CheckJobDTO;
+import com.platform.dao.dto.check.CheckStandardDTO;
+import com.platform.dao.dto.sb.SbMeasureLogDTO;
+import com.platform.dao.entity.check.CheckStandard;
+import com.platform.dao.entity.sb.SbMeasureLog;
+import com.platform.dao.util.ExcelUtil;
+import com.platform.dao.vo.export.check.ExportCheckStandardVO;
+import com.platform.dao.vo.export.sb.ExportSbMeasureLogVO;
+import com.platform.rest.log.annotation.SysLog;
+import com.platform.service.check.CheckStandardService;
+import com.platform.service.sb.SbMeasureLogService;
+import lombok.AllArgsConstructor;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+
+/**
+ * @Description 设备计量记录 控制器
+ * @Author liuyu
+ * @Date 2020-05-28 17:23:30
+ * @Version Copyright (c) 2020,北京乾元坤和科技有限公司 All rights reserved.
+ */
+@RestController
+@AllArgsConstructor
+@RequestMapping("/sb/measure-logs")
+public class SbMeasureLogController {
+
+  private final SbMeasureLogService checkStandardService;
+
+    /**
+     * 通过id查询标准
+     *
+     * @param id 主键
+     * @return R
+     */
+    @GetMapping("/{id}")
+    public R<SbMeasureLog> getById(@PathVariable("id") String id){
+        return new R<>(checkStandardService.getModelById(id));
+    }
+
+  /**
+   * 新增记录
+   *
+   * @param checkStandardDTO 设备计量记录DTO
+   * @return R
+   */
+  @SysLog("新增设备计量记录")
+  @PostMapping
+  public R save(@Validated({AddGroup.class}) @RequestBody SbMeasureLogDTO checkStandardDTO) {
+      return new R<>(checkStandardService.saveModelByDTO(checkStandardDTO));
+  }
+
+  /**
+   * 修改记录
+   *
+   * @param checkStandardDTO 设备计量记录DTO
+   * @return R
+   */
+  @SysLog("修改设备计量记录")
+  @PutMapping("/{id}")
+  @PreAuthorize("@pms.hasPermission('check-spot-standards-edit')")
+  public R update(@PathVariable("id") String id, @Validated({UpdateGroup.class}) @RequestBody SbMeasureLogDTO checkStandardDTO) {
+      checkStandardService.modModelByDTO(checkStandardDTO);
+      return new R<>();
+  }
+
+  /**
+   * 通过id删除一条记录
+   *
+   * @param id 主键
+   * @return R
+   */
+  @SysLog("删除设备计量记录")
+  @DeleteMapping("/{id}")
+  public R removeById(@PathVariable String id){
+    checkStandardService.deleteByPrimaryKey(id);
+    return new R<>();
+  }
+
+    /**
+     * 批量记录
+     *
+     * @param ids 主键
+     * @return R
+     */
+    @SysLog("批量删除设备计量记录")
+    @DeleteMapping("")
+    public R removeIds(@RequestBody List<String> ids){
+        checkStandardService.batchDelete(ids);
+        return new R<>();
+    }
+
+  /**
+   * 获取分页
+   *
+   * @param pageNum 当前页码
+   * @param pageSize 每页条数
+   * @param checkStandardDTO 设备计量记录DTO
+   * @return R
+   */
+  @GetMapping("/page")
+  public R<AbstractPageResultBean<SbMeasureLog>> query(SbMeasureLogDTO checkStandardDTO, @RequestParam(defaultValue = "1") int pageNum, @RequestParam(defaultValue = "20") int pageSize) {
+      return new R<>(checkStandardService.selectPageInfo(checkStandardDTO, pageNum, pageSize));
+  }
+
+  /**
+   * 获取列表
+   *
+   * @param checkStandardDTO 设备计量记录DTO
+   * @return R
+   */
+  @GetMapping("")
+  public R query(SbMeasureLogDTO checkStandardDTO) {
+      return new R<>(checkStandardService.selectList(checkStandardDTO));
+  }
+
+  /**
+     * 设备计量记录导出
+     *
+     * @param checkStandardDTO 设备计量记录DTO
+     * @return R
+     */
+  @GetMapping("/export")
+  @SysLog("设备计量记录导出")
+  @PreAuthorize("@pms.hasPermission('check-spot-standards-export') or @pms.hasPermission('check-polling-standards-export')")
+  public void export(HttpServletResponse response, SbMeasureLogDTO checkStandardDTO) {
+    List<SbMeasureLog> list = checkStandardService.getModelListByDTO(checkStandardDTO);
+    ExcelUtil.exportResponseDict(response, ExportSbMeasureLogVO.class, BeanConverterUtil.copyListProperties(list, ExportSbMeasureLogVO.class), "设备计量记录");
+  }
+
+}

+ 0 - 60
platform-rest/src/test/java/com/test/TestPython.java

@@ -1,60 +0,0 @@
-package com.test;
-
-import org.python.core.*;
-import org.python.util.PythonInterpreter;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.util.Properties;
-
-/**
- * @Description ${DESCRIPTION}
- * @Author chenyuehu
- * @Date 2021/4/25
- * @Version Copyright (c) 2020,安徽图知天下大数据科技有限公司 All rights reserved.
- */
-public class TestPython {
-
-    public static void main(String[] args) throws IOException, InterruptedException {
-//        Properties props = new Properties();
-//        props.put("python.home", "D:\\software\\Python\\Python37-32\\Lib");
-//        props.put("python.console.encoding", "UTF-8"); // Used to prevent: console: Failed to install '': java.nio.charset.UnsupportedCharsetException: cp0.
-//        props.put("python.security.respectJavaAccessibility", "false"); //don't respect java accessibility, so that we can access protected members on subclasses
-//        props.put("python.import.site", "false");
-//        Properties preprops = System.getProperties();
-//        PythonInterpreter.initialize(preprops, props, new String[0]);
-//
-//        PythonInterpreter interpreter = new PythonInterpreter();
-//        interpreter.exec("import requests");
-////        interpreter.exec("sys.path.append('D:/software/Python/Python37-32/Lib')");//jython自己的
-//        interpreter.exec("sys.path.append('D:/software/Python/Python37-32/Lib/site-packages')");//jython自己的
-//        interpreter.execfile("F:\\gitee\\real-url\\douyin.py");
-//        PyFunction url = interpreter.get("get_real_url", PyFunction.class);
-//
-//        PyObject pyobj = url.__call__(new PyString("https://v.douyin.com/ekxYCb2/"));
-//        System.out.println("anwser = " + pyobj.toString());
-//        interpreter.close();
-
-        Process pr = Runtime.getRuntime().exec("python F:\\gitee\\real-url\\douyin2.py https://v.douyin.com/ekxYCb2/ 3");
-
-//获取python文件运行后的输出
-
-        BufferedReader in = new BufferedReader(new InputStreamReader(pr.getInputStream()));
-
-        String line;
-
-        while ((line = in.readLine()) != null) {
-
-            System.out.println(line);
-
-        }
-
-        in.close();
-
-        pr.waitFor();
-
-        System.out.println("sucecss!");
-
-    }
-}

+ 13 - 1
platform-service/src/main/java/com/platform/service/sb/SbInfoService.java

@@ -1,5 +1,6 @@
 package com.platform.service.sb;
 
+import com.platform.common.bean.AbstractPageResultBean;
 import com.platform.dao.bean.MyVOPage;
 import com.platform.dao.dto.sb.SbInfoDTO;
 import com.platform.dao.entity.sb.SbInfo;
@@ -177,4 +178,15 @@ public interface SbInfoService extends IBaseService<SbInfo, SbInfoDTO> {
     String importListByUpdateValue(MultipartFile file);
     String importListByUpdate(MultipartFile file);
     String importListByUpdateALl(MultipartFile file);
-}
+
+    /**
+     * 选择已经到了预警期限内的设备列表
+     *
+     * @param record
+     * @param pageNum
+     * @param pageSize
+     * @return
+     */
+    public AbstractPageResultBean<SbInfoVO> selectPageInfoForWarn(SbInfoDTO record, int pageNum, int pageSize);
+
+    }

+ 40 - 0
platform-service/src/main/java/com/platform/service/sb/SbMeasureLogService.java

@@ -0,0 +1,40 @@
+package com.platform.service.sb;
+
+import com.platform.dao.dto.check.CheckJobDTO;
+import com.platform.dao.dto.check.CheckStandardDTO;
+import com.platform.dao.dto.sb.SbMeasureLogDTO;
+import com.platform.dao.entity.check.CheckStandard;
+import com.platform.dao.entity.sb.SbMeasureLog;
+import com.platform.dao.vo.query.check.CheckStandardVO;
+import com.platform.dao.vo.query.sb.SbMeasureLogVO;
+import com.platform.service.base.IBaseService;
+
+import java.util.List;
+
+/**
+ * @Description 点检标准 service
+ * @Author liuyu
+ * @Date 2020-05-28 17:23:30
+ * @Version Copyright (c) 2020,北京乾元坤和科技有限公司 All rights reserved.
+ */
+public interface SbMeasureLogService extends IBaseService<SbMeasureLog, SbMeasureLogDTO> {
+    /**
+     * 级联删除
+     * 删除出库单与出库详情,同时要更新库存
+     *
+     * @param id :
+     * @return :
+     */
+    boolean cascadingDeleteByKey(String id);
+   /**
+    * 批量删除
+    *
+    * @param ids :
+    * @return :
+    */
+    int batchDelete(List<String> ids);
+
+    List<SbMeasureLogVO> selectList(SbMeasureLogDTO record);
+
+
+}

+ 12 - 4
platform-service/src/main/java/com/platform/service/sb/impl/SbInfoServiceImpl.java

@@ -3,22 +3,22 @@ package com.platform.service.sb.impl;
 import cn.hutool.core.collection.CollectionUtil;
 import cn.hutool.core.date.DateUtil;
 import com.github.pagehelper.PageHelper;
+import com.platform.common.bean.AbstractPageResultBean;
 import com.platform.common.constant.CommonConstants;
 import com.platform.common.enums.DataFilterTypeEnum;
 import com.platform.common.exception.BusinessException;
 import com.platform.common.model.UserInfo;
 import com.platform.common.util.*;
+import com.platform.dao.bean.MyPage;
 import com.platform.dao.bean.MyVOPage;
 import com.platform.dao.dto.sb.SbInfoDTO;
+import com.platform.dao.dto.sb.SbMeasureLogDTO;
 import com.platform.dao.dto.store.SpareRestoreDetailDTO;
 import com.platform.dao.dto.upms.SysDeptDTO;
 import com.platform.dao.dto.upms.SysUserDeptDTO;
 import com.platform.dao.entity.firm.FirmProducer;
 import com.platform.dao.entity.repair.RepairApplicationForm;
-import com.platform.dao.entity.sb.SbInfo;
-import com.platform.dao.entity.sb.SbModel;
-import com.platform.dao.entity.sb.SbPosition;
-import com.platform.dao.entity.sb.SbType;
+import com.platform.dao.entity.sb.*;
 import com.platform.dao.entity.store.SpareRestoreDetail;
 import com.platform.dao.entity.upms.SysDept;
 import com.platform.dao.entity.upms.SysFile;
@@ -949,4 +949,12 @@ public class SbInfoServiceImpl extends BaseServiceImpl<SbInfoMapper, SbInfo, SbI
             throw new BusinessException(e.getMessage());
         }
     }
+
+    @Override
+    public AbstractPageResultBean<SbInfoVO> selectPageInfoForWarn(SbInfoDTO record, int pageNum, int pageSize) {
+        PageHelper.startPage(pageNum, pageSize);
+        record.setUseType(SbUseType.BGCL.getValue());
+        AbstractPageResultBean<SbInfoVO> pageInfo = new MyPage(mapper.selectPageInfoForWarn(record));
+        return pageInfo;
+    }
 }

+ 192 - 0
platform-service/src/main/java/com/platform/service/sb/impl/SbMeasureLogServiceImpl.java

@@ -0,0 +1,192 @@
+package com.platform.service.sb.impl;
+
+import cn.hutool.core.collection.CollectionUtil;
+import com.github.pagehelper.PageHelper;
+import com.platform.common.bean.AbstractPageResultBean;
+import com.platform.common.exception.BusinessException;
+import com.platform.common.util.BeanConverterUtil;
+import com.platform.common.util.DateUtils;
+import com.platform.common.util.IdGeneratorUtils;
+import com.platform.common.util.ListUtils;
+import com.platform.dao.bean.MyPage;
+import com.platform.dao.dto.check.CheckJobDTO;
+import com.platform.dao.dto.check.CheckStandardDTO;
+import com.platform.dao.dto.part.PartInfoDTO;
+import com.platform.dao.dto.sb.SbMeasureLogDTO;
+import com.platform.dao.entity.check.CheckJob;
+import com.platform.dao.entity.check.CheckProjectStandardRelation;
+import com.platform.dao.entity.check.CheckStandard;
+import com.platform.dao.entity.check.CheckStandardParam;
+import com.platform.dao.entity.part.PartInfo;
+import com.platform.dao.entity.sb.SbInfo;
+import com.platform.dao.entity.sb.SbMeasureLog;
+import com.platform.dao.entity.upms.SysFile;
+import com.platform.dao.enums.CheckJobStatusEnum;
+import com.platform.dao.enums.CheckPlanPeriodTypeEnum;
+import com.platform.dao.enums.SysFileTypeEnum;
+import com.platform.dao.mapper.check.CheckJobMapper;
+import com.platform.dao.mapper.check.CheckProjectStandardRelationMapper;
+import com.platform.dao.mapper.check.CheckStandardMapper;
+import com.platform.dao.mapper.check.CheckStandardParamMapper;
+import com.platform.dao.mapper.sb.SbInfoMapper;
+import com.platform.dao.mapper.sb.SbMeasureLogMapper;
+import com.platform.dao.mapper.upms.SysFileMapper;
+import com.platform.dao.vo.query.check.CheckStandardVO;
+import com.platform.dao.vo.query.sb.SbMeasureLogVO;
+import com.platform.service.base.impl.BaseServiceImpl;
+import com.platform.service.check.CheckStandardParamService;
+import com.platform.service.check.CheckStandardService;
+import com.platform.service.part.PartInfoService;
+import com.platform.service.sb.SbMeasureLogService;
+import lombok.AllArgsConstructor;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import tk.mybatis.mapper.weekend.Weekend;
+
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.time.temporal.ChronoUnit;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @Description 点检标准 service 实现类
+ * @Author liuyu
+ * @Date 2020-05-28 17:23:30
+ * @Version Copyright (c) 2020,北京乾元坤和科技有限公司 All rights reserved.
+ */
+@AllArgsConstructor
+@Service("sbMeasureLogService")
+public class SbMeasureLogServiceImpl extends BaseServiceImpl<SbMeasureLogMapper, SbMeasureLog, SbMeasureLogDTO> implements SbMeasureLogService {
+    private SbInfoMapper sbInfoMapper;
+    private final SysFileMapper sysFileMapper;
+    @Override
+    public boolean cascadingDeleteByKey(String id) {
+        int result = mapper.deleteByPrimaryKey(id);
+        Weekend<CheckProjectStandardRelation> weekend = new Weekend<>(CheckProjectStandardRelation.class);
+        weekend.weekendCriteria().andEqualTo(CheckProjectStandardRelation::getStandardId,id);
+        return true;
+    }
+
+    @Transactional(rollbackFor = Exception.class)
+    @Override
+    public int batchDelete(List<String> ids) {
+
+        ids.forEach(id -> {
+            cascadingDeleteByKey(id);
+        });
+        return 1;
+    }
+
+    @Override
+    public List<SbMeasureLogVO> selectList(SbMeasureLogDTO record) {
+        return mapper.selectList(record);
+    }
+
+    @Override
+    public AbstractPageResultBean<SbMeasureLog> selectPageInfo(SbMeasureLogDTO record, int pageNum, int pageSize) {
+        PageHelper.startPage(pageNum, pageSize);
+        AbstractPageResultBean<SbMeasureLog> pageInfo = new MyPage(mapper.selectList(record));
+        return pageInfo;
+    }
+
+    @Transactional(rollbackFor = Exception.class)
+    @Override
+    public SbMeasureLog saveModelByDTO(SbMeasureLogDTO model) {
+        SbMeasureLog sbMeasureLog = super.saveModelByDTO(model);
+
+        // 更新设备下次检定日期
+        SbInfo sbInfo = sbInfoMapper.selectByPrimaryKey(model.getSbId());
+        sbInfo.setCheckDate(model.getLastDate());
+        Integer checkPeriod = 45;
+        if(sbInfo.getCheckPeriod() != null){
+            checkPeriod = sbInfo.getCheckPeriod();
+        }
+        sbInfo.setNextCheckDate(model.getLastDate().minusMonths(-checkPeriod));
+        sbInfoMapper.updateByPrimaryKey(sbInfo);
+
+        // 保存文件
+        this.saveFile(model);
+        // 保存参数
+       /* List<CheckStandardParamDTO> paramList = model.getParamList();
+        paramList.forEach(item -> {
+            item.setStandardId(checkStandard.getId());
+        });
+        paramService.saveModelListByDTO(paramList);*/
+        return sbMeasureLog;
+    }
+
+    @Transactional(rollbackFor = Exception.class)
+    @Override
+    public void modModelByDTO(SbMeasureLogDTO model) {
+        super.modModelByDTO(model);
+        // 更新设备下次检定日期
+        SbInfo sbInfo = sbInfoMapper.selectByPrimaryKeyForUpdate(model.getSbId());
+        sbInfo.setCheckDate(model.getLastDate());
+        sbInfo.setNextCheckDate(model.getLastDate().minusDays(sbInfo.getCheckPeriod()));
+        sbInfoMapper.updateByPrimaryKey(sbInfo);
+
+        // 保存文件
+        this.saveFile(model);
+        // 保存参数
+  /*      List<CheckStandardParamDTO> paramList = model.getParamList();
+        paramList.forEach(item -> {
+            item.setStandardId(model.getId());
+        });
+        paramService.saveModelListByDTO(paramList);*/
+    }
+
+    private void saveFile(SbMeasureLogDTO model) {
+        Weekend<SysFile> weekend = new Weekend<>(SysFile.class);
+        weekend.weekendCriteria().andEqualTo(SysFile::getTargetId, model.getId());
+        sysFileMapper.deleteByExample(weekend);
+        List<SysFile> checkImgList = model.getCheckImgList();
+        List<SysFile> checkFileList = model.getCheckFileList();
+        List<SysFile> list = ListUtils.newArrayList();
+        if (CollectionUtil.isNotEmpty(checkImgList)) {
+            checkImgList.forEach(item -> {
+                item.setType(SysFileTypeEnum.Sb_MEASURE_IMGS.getValue());
+                item.setId(IdGeneratorUtils.getObjectId());
+                item.setTargetId(model.getId());
+                list.add(item);
+            });
+        }
+        if (CollectionUtil.isNotEmpty(checkFileList)) {
+            checkFileList.forEach(item -> {
+                item.setType(SysFileTypeEnum.Sb_MEASURE_FILES.getValue());
+                item.setId(IdGeneratorUtils.getObjectId());
+                item.setTargetId(model.getId());
+                list.add(item);
+            });
+        }
+        if (CollectionUtil.isNotEmpty(list)) {
+            sysFileMapper.insertListforComplex(list);
+        }
+    }
+
+    @Override
+    public SbMeasureLog getModelById(Object id) {
+        SbMeasureLog checkStandard = super.getModelById(id);
+  /*      Weekend<CheckStandardParam> weekend = new Weekend<>(CheckStandardParam.class);
+        weekend.weekendCriteria().andEqualTo(CheckStandardParam::getStandardId, id);
+        List<CheckStandardParam> paramList = paramMapper.selectByExample(weekend);
+        checkStandard.setParamList(paramList);*/
+
+        Weekend<SysFile> weekendFile = new Weekend<>(SysFile.class);
+        weekendFile.weekendCriteria().andEqualTo(SysFile::getTargetId, checkStandard.getId());
+        List<SysFile> sysFiles = sysFileMapper.selectByExample(weekendFile);
+        List<SysFile> checkImgList = ListUtils.newArrayList();
+        List<SysFile> checkFileList = ListUtils.newArrayList();
+        sysFiles.forEach(item -> {
+            if (item.getType().equals( SysFileTypeEnum.Sb_MEASURE_IMGS.getValue())) {
+                checkImgList.add(item);
+            }
+            if (item.getType().equals( SysFileTypeEnum.Sb_MEASURE_FILES.getValue())) {
+                checkFileList.add(item);
+            }
+        });
+        checkStandard.setCheckImgList(checkImgList);
+        checkStandard.setCheckFileList(checkFileList);
+        return checkStandard;
+    }
+}