hfxc226 3 年之前
父节点
当前提交
bf43173632

+ 525 - 0
platform-dao/src/main/java/com/platform/dao/dto/sb/SbInfoMeasureDTO.java

@@ -0,0 +1,525 @@
+package com.platform.dao.dto.sb;
+
+import com.platform.common.bean.BaseDTO;
+import com.platform.common.validation.group.UpdateGroup;
+import com.platform.dao.entity.sb.SbModelSpareBom;
+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.math.BigDecimal;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.util.List;
+
+/**
+ * @Description 设备基础信息DTO
+ * @Author liuyu
+ * @Date 2020-04-21 21:05:46
+ * @Version Copyright (c) 2019,北京乾元坤和科技有限公司 All rights reserved.
+ */
+@Data
+@Accessors(chain = true)
+@EqualsAndHashCode(callSuper = true)
+public class SbInfoMeasureDTO extends BaseDTO implements Serializable {
+    /**
+     * 状态变更原因
+     */
+    @Transient
+    private String changeReason;
+
+    /**
+     * 状态变更实际操作人姓名
+     */
+    @Transient
+    private String actualUser;
+
+    /**
+     * 验收单id
+     */
+    private String checkId;
+    /**
+     * 卡片编号
+     */
+    private String cardNo;
+    /**
+     * 自定义参数列表
+     */
+    private String paramList;
+    /**
+     * 是否子设备:0 父设备,1 子设备
+     */
+    private Integer isChild;
+    /**
+     * 是否在大屏显示设备:0 不显示,1 显示
+     */
+    private Integer isShow;
+    /**
+     * 是否固定资产:0 否1 是
+     */
+    private Integer isFinancing;
+    /**
+     * 主键
+     */
+    @NotNull(groups = {UpdateGroup.class}, message = "ID不能为空")
+    private String id;
+
+    /**
+     * 设备编号/设备(新号)
+     */
+    private String no;
+    /**
+     * 自编号/设备(旧号)
+     */
+    private String zbh;
+
+    /**
+     * 财务编码
+     */
+    private String financingNo;
+    /**
+     * 财务编码/固定资产编号
+     */
+    private String financingNoTwo;
+    /**
+     * 财务编码/固定资产编号
+     */
+    private String financingNoThird;
+    /**
+     * 财务编码/固定资产编号
+     */
+    private String financingNoFour;
+    /**
+     * 财务编码/固定资产编号
+     */
+    private String financingNoFive;
+    /**
+     * 设备名称
+     */
+    private String name;
+    /**
+     * 型号
+     */
+    private String model;
+    /**
+     * 名称型号
+     */
+    private String nameModel;
+    /**
+     * 设备型号
+     */
+    private String modelId;
+
+    /**
+     * 设备类别
+     */
+    private String typeId;
+
+    /**
+     * 设备等级
+     */
+    private Integer level;
+    /**
+     * 净残值率
+     */
+    private BigDecimal rate;
+    /**
+     * 折旧总计月份
+     */
+    private BigDecimal month;
+    /**
+     * 已计提月份
+     */
+    private BigDecimal usedMonth;
+    /**
+     * 设备原值
+     */
+    private BigDecimal initialValue;
+
+    /**
+     * 当前价值
+     */
+    private Double currentValue;
+
+    /**
+     * 已折旧价值
+     */
+    private Double cutValue;
+
+    /**
+     * 生产商
+     */
+    private String producerId;
+
+    /**
+     * 设备来源方式
+     */
+    private Integer sourceType;
+
+    /**
+     * 来源设备id
+     */
+    private String sourceSbId;
+
+    /**
+     *
+     */
+    private String parentId;
+    /**
+     * 上层设备id
+     */
+    @Transient
+    private String parentSbName;
+    /**
+     * 计量单位
+     */
+    private String unit;
+
+    /**
+     * 所属车间
+     */
+    private String positionId;
+
+    /**
+     * 规格型号
+     */
+    private String guigeId;
+    /**
+     * 使用区域
+     */
+    private String useArea;
+    /**
+     * 使用公司
+     */
+    private String useCompany;
+    /**
+     * 使用项目部
+     */
+    private String useProject;
+    /**
+     * 使用部门
+     */
+    private String useDept;
+    /**
+     * 使用施工组
+     */
+    private String useGroup;
+    /**
+     * 使用人
+     */
+    private String useUser;
+    /**
+     * 保管部门-跟超哥确认,该字段没用了
+     */
+    private String saveDept;
+    /**
+     * 保管人-跟超哥确认,该字段没用了
+     */
+    private String saveUser;
+    /**
+     * 维修人员
+     */
+    private String repairUser;
+    /**
+     * 维修人员
+     */
+    @Transient
+    private String repairUserSearch;
+    /**
+     * 使用公司
+     */
+    @Transient
+    private String useCompanyName;
+    /**
+     * 使用项目部
+     */
+    @Transient
+    private String useProjectName;
+    /**
+     * 使用部门
+     */
+    @Transient
+    private String useDeptName;
+    /**
+     * 使用施工组
+     */
+    @Transient
+    private String useGroupName;
+    /**
+     * 使用人
+     */
+    @Transient
+    private String useUserName;
+    /**
+     * 保管部门
+     */
+    @Transient
+    private String saveDeptName;
+    /**
+     * 保管人
+     */
+    @Transient
+    private String saveUserName;
+
+    /**
+     * 购置日期
+     */
+    private LocalDate buyDate;
+
+    /**
+     * 投用日期
+     */
+    private LocalDate startDate;
+
+    /**
+     * 下次检定日期
+     */
+    private LocalDate nextCheckDate;
+
+    /**
+     * 保修截至日期
+     */
+    private LocalDate guaranteeDate;
+
+    /**
+     * 预计工作年限
+     */
+    private Double workYear;
+
+    /**
+     * 预计报废日期
+     */
+    private LocalDate retirementDate;
+
+    /**
+     * 折旧方式
+     */
+    private Integer depreciationType;
+
+    /**
+     * 维保手册
+     */
+    private String wbFile;
+
+    /**
+     * 使用手册
+     */
+    private String useFile;
+
+    /**
+     * 验收文件
+     */
+    private String checkFile;
+
+    /**
+     * 设备图片
+     */
+    private String sbImage;
+
+    /**
+     * 二维码
+     */
+    private String qrCode;
+
+    /**
+     * 状态
+     */
+    private Integer status;
+
+    /**
+     * 维修单状态
+     */
+    @Transient
+    private Integer repairStatus;
+
+    /**
+     * 备注
+     */
+    private String remark;
+
+    /**
+     * 创建人
+     */
+    private String createdUserId;
+
+    /**
+     * 创建日期
+     */
+    private LocalDateTime createdTime;
+
+    /**
+     * 更新日期
+     */
+    private LocalDateTime updateTime;
+
+    /**
+     * 位置
+     */
+    private List<String> positionIds;
+
+    /**
+     *测量设备相关参数
+     */
+    private String zzh;//制造号(车架号)/系列号(出厂编号)
+    private String fdjxh;//发动机型号/准确度等级
+    private LocalDate checkDate;//检定日期(新增字段)
+    private Integer checkPeriod;//检定周期(新增字段),以月为单位
+    private String dph;//检定单位
+    private String zaiz;//检定人
+    private Integer rlType;//检定结论:合格不合格
+    private Integer color;//是否周检查
+    private String sbdh;//检定证书编号
+    private Integer seatNumber;//预警天数,默认45天
+
+    //private Integer financingFlag;//是否固定资产/这个通过financingNo是否为空判断,不需要单独字段,暂时不新增
+
+    /**
+     * 特种设备相关参数
+     */
+    private String registerNo;//注册代码(新增字段)
+    private String characterType;//介质属性(新增字段)
+    private String usedNo;//使用登记证编号(新增字段)
+    private String supplier;//维护供应商(新增字段)
+    private String repairUserSecond;//第二维修人员(新增字段)
+    private String batchNo;//设备批号(新增字段)
+    private LocalDate registerDate;// 登记日期(新增字段)
+
+    /**
+     * 维保手册
+     */
+    private List<SysFile> repairFileList;
+
+    /**
+     * 维保手册
+     */
+    private List<SysFile> useFileList;
+
+    /**
+     * 维保手册
+     */
+    private List<SysFile> recheckFileList;
+
+    /**
+     * 备件BOM列表
+     */
+    private List<SbModelSpareBom> sparePartInfoList;
+
+    /**
+     * 维保手册
+     */
+    private List<SysFile> sbFileList;
+
+    private String fdjh;//发动机号
+    private String cph;//车牌号
+    private String zz;//自重
+    private String zjm;//助记码
+    private String jbdh;//交保单号
+    private String bxgs;//保险公司
+
+    private BigDecimal totalMiles;//总行驶里程
+    private BigDecimal totalHours;//总行驶小时
+    private Integer useType;//自定义类型
+    private LocalDate lastRepaireTime;//最近维修时间
+    private Integer repaireTimes;//维修次数
+
+    private LocalDate lastBaoyangTime;//最近保养时间
+    private double lastBaoyangMiles;//最近保养里程
+    private double lastBaoyangHours;//最近保养台时
+    private Integer baoyangTimes;//保养次数
+
+    private LocalDate jbdDate;//交保到期日
+    private LocalDate sbdDate;//商报到期日
+    private LocalDate spDate;//上牌日期
+    private LocalDate sbDate;//首保日期
+
+    /**
+     * 查询-强制归属部门
+     */
+    private Boolean ascriptionDept;
+
+    /**
+     * 不等于状态
+     */
+    private List<Integer> notStatusList;
+
+
+    /**
+     * 不等于状态
+     */
+    private List<Integer> statusList;
+
+    /**
+     * 设备主键
+     */
+    private List<String> sbIds;
+
+    /**
+     * 保存 saveUser 为空
+     */
+    private Boolean saveUserNull;
+
+    /**
+     * 部门code
+     */
+    private String likeDeptCode;
+
+    /**
+     * 是否过滤数据,查询主子数据
+     */
+    private Boolean parentSearch;
+
+    /**
+     * 有效期搜索开始时间
+     */
+    private LocalDate nextCheckDateStart;
+
+    /**
+     * 有效期搜索结束时间
+     */
+    private LocalDate nextCheckDateEnd;
+
+    /**
+     * 申请时间
+     */
+    private LocalDateTime applyTime;
+    /**
+     * 审核时间
+     */
+    private LocalDateTime auditTime;
+    /**
+     * 提交审核时间
+     */
+    private LocalDateTime submitTime;
+    /**
+     * 关闭时间
+     */
+    private LocalDateTime closeTime;
+    /**
+     * 关闭描述
+     */
+    private String closeDesc;
+    /**
+     * 工作流实例ID
+     */
+    private String processInstanceId;
+
+    private Integer auditNode;
+
+    /**
+     * 拒绝原因
+     */
+    private String refuseReason;
+
+    /**
+     * 报废创建人
+     */
+    private String scrapUserId;
+    /**
+     * 报废创建人
+     */
+    private String scrapUserName;
+}

+ 421 - 0
platform-dao/src/main/java/com/platform/dao/entity/sb/SbInfoMeasure.java

@@ -0,0 +1,421 @@
+package com.platform.dao.entity.sb;
+
+import com.platform.common.bean.DataScope;
+import lombok.Data;
+
+import javax.persistence.Id;
+import javax.persistence.Table;
+import javax.persistence.Transient;
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+
+/**
+ * @Description 设备基础信息实体类
+ * @Author liuyu
+ * @Date 2020-04-21 21:05:46
+ * @Version Copyright (c) 2019,北京乾元坤和科技有限公司 All rights reserved.
+ */
+@Table(name = "t_sb_info_measure")
+@Data
+public class SbInfoMeasure implements Serializable {
+    /**
+     * 自定义参数列表
+     */
+    private String paramList;
+    /**
+     * 验收单id
+     */
+    private String checkId;
+    /**
+     * 主键
+     */
+    @Id
+    private String id;
+    /**
+     * 设备编号/设备(新号)
+     */
+    private String no;
+    /**
+     * 自编号/设备(旧号)
+     */
+    private String zbh;
+    /**
+     * 设备名称/描述
+     */
+    private String name;
+    /**
+     * 型号
+     */
+    private String model;
+    /**
+     * 设备等级/ABC 标识
+     */
+    private Integer level;
+    /**
+     * 设备类别
+     */
+    private String typeId;
+    /**
+     * 自重/大小/尺寸
+     */
+    private String zz;
+    /**
+     * 车牌号/使用位置
+     */
+    private String cph;
+    /**
+     * 助记码/位置x坐标
+     */
+    private String zjm;
+    /**
+     * 交保单号/位置y坐标
+     */
+    private String jbdh;
+    /**
+     * 状态
+     */
+    private Integer status;
+    /**
+     * 发动机号/技术标识号
+     */
+    private String fdjh;
+    /**
+     * 投用日期
+     */
+    private LocalDate startDate;
+    /**
+     * 财务编码/固定资产编号
+     */
+    private String financingNo;
+    /**
+     * 财务编码/固定资产编号
+     */
+    private String financingNoTwo;
+    /**
+     * 财务编码/固定资产编号
+     */
+    private String financingNoThird;
+    /**
+     * 财务编码/固定资产编号
+     */
+    private String financingNoFour;
+    /**
+     * 财务编码/固定资产编号
+     */
+    private String financingNoFive;
+    /**
+     * 设备原值/购置价值
+     */
+    private Double initialValue;
+    /**
+     * 生产商/制造商(直接存名称)
+     */
+    private String producerId;
+    /**
+     * 备注
+     */
+    private String remark;
+    /**
+     * 保管人/车间使用人员(车间登录账号)
+     */
+    private String saveUser;
+    /**
+     * 维修人员/绑定的维修人员
+     */
+    private String repairUser;
+    /**
+     * 自定义类型
+     */
+    private Integer useType;
+
+    /**
+     * 使用部门/工位生产线(直接填写内容的)
+     */
+    private String useDept;
+
+    /**
+     * 使用人:暂时没用
+     */
+    private String useUser;
+    /**
+     * 保管部门
+     */
+    private String saveDept;
+    /**
+     * 名称型号
+     */
+    private String nameModel;
+    /**
+     * 设备型号
+     */
+    private String modelId;
+    /**
+     * 当前价值
+     */
+    private Double currentValue;
+    /**
+     * 净残值率
+     */
+    private BigDecimal rate;
+    /**
+     * 折旧总计月份
+     */
+    private BigDecimal month;
+    /**
+     * 已计提月份
+     */
+    private BigDecimal usedMonth;
+    /**
+     * 已折旧价值
+     */
+    private Double cutValue;
+    /**
+     * 设备来源方式
+     */
+    private Integer sourceType;
+    /**
+     * 来源设备id
+     */
+    private String sourceSbId;
+    /**
+     * 上层设备id
+     */
+    private String parentId;
+    /**
+     * 上层设备id
+     */
+    @Transient
+    private String parentSbName;
+    /**
+     * 是否子设备:0 父设备,1 子设备
+     */
+    private Integer isChild;
+    /**
+     * 是否在大屏显示设备:0 不显示,1 显示
+     */
+    private Integer isShow;
+    /**
+     * 是否固定资产:0 否1 是
+     */
+    private Integer isFinancing;
+    /**
+     * 计量单位
+     */
+    private String unit;
+    /**
+     * 存放位置/(使用地点,计量信息携带,应该和设备一样的)设备也可以填写,计量也可以修改
+     */
+    private String positionId;
+    /**
+     * 规格型号/(系统主键,计量信息携带,对应计量在原计量系统中的值)
+     */
+    private String guigeId;
+    /**
+     * 使用区域
+     */
+    private String  useArea;
+    /**
+     * 使用公司
+     */
+    private String useCompany;
+    /**
+     * 使用项目部
+     */
+    private String useProject;
+    /**
+     * 使用施工组
+     */
+    private String useGroup;
+    /**
+     * 使用公司
+     */
+    @Transient
+    private String useCompanyName;
+    /**
+     * 使用项目部
+     */
+    @Transient
+    private String useProjectName;
+    /**
+     * 使用部门
+     */
+    @Transient
+    private String useDeptName;
+    /**
+     * 使用施工组
+     */
+    @Transient
+    private String useGroupName;
+    /**
+     * 使用人
+     */
+    @Transient
+    private String useUserName;
+    /**
+     * 保管部门
+     */
+    @Transient
+    private String saveDeptName;
+    /**
+     * 保管人
+     */
+    @Transient
+    private String saveUserName;
+    /**
+     * 购置日期
+     */
+    private LocalDate buyDate;
+    /**
+     * 保修截至日期
+     */
+    private LocalDate guaranteeDate;
+
+    /**
+     * 折旧方式
+     */
+    private Integer depreciationType;
+    /**
+     * 维保手册
+     */
+    private String wbFile;
+    /**
+     * 使用手册
+     */
+    private String useFile;
+    /**
+     * 验收文件
+     */
+    private String checkFile;
+    /**
+     * 设备图片
+     */
+    private String sbImage;
+    /**
+     * 二维码
+     */
+    private String qrCode;
+    /**
+     * 创建人
+     */
+    private String createdUserId;
+    /**
+     * 修改人
+     */
+    private String updateUserId;
+    /**
+     * 创建日期
+     */
+    private LocalDateTime createdTime;
+    /**
+     * 更新日期
+     */
+    private LocalDateTime updateTime;
+    /**
+     * 创建人姓名
+     */
+    private String createdUserName;
+
+    private String updateUserName;
+
+    /**
+     *测量设备相关参数
+     */
+    private String cardNo;// 卡片编号/测量设备编号
+    private String zzh;//制造号(车架号)/系列号(出厂编号)
+    private String fdjxh;//发动机型号/准确度等级
+    private LocalDate checkDate;//检定日期(新增字段)
+    private Integer checkPeriod;//检定周期(新增字段),以月为单位
+    private LocalDate nextCheckDate;//有效日期(下次鉴定日期)
+    private String dph;//检定单位
+    private String zaiz;//检定人
+    private Integer rlType;//检定结论:合格不合格
+    private Integer color;//是否周检查
+    private String sbdh;//检定证书编号
+    private Integer seatNumber;//预警天数,默认45天
+
+    //private Integer financingFlag;//是否固定资产/这个通过financingNo是否为空判断,不需要单独字段,暂时不新增
+
+    /**
+     * 特种设备相关参数
+     */
+    private String registerNo;//注册代码(新增字段)
+    private String characterType;//介质属性(新增字段)
+    private String usedNo;//使用登记证编号(新增字段)
+    private String supplier;//维护供应商(新增字段)
+    private String repairUserSecond;//第二维修人员(新增字段)
+    private String batchNo;//设备批号(新增字段)
+    private Double workYear;// 预计工作年限(年为单位)
+    private LocalDate retirementDate;// 设计到期年限
+    private LocalDate registerDate;// 登记日期(新增字段)
+
+
+
+
+    private LocalDate lastRepaireTime;//最近维修时间
+    private Integer repaireTimes;//维修次数
+
+
+
+    private LocalDate lastBaoyangTime;//最近保养时间
+    private double lastBaoyangMiles;//最近保养里程
+    private double lastBaoyangHours;//最近保养台时
+    private Integer baoyangTimes;//保养次数
+
+
+    private LocalDate spDate;//上牌日期
+    private LocalDate jbdDate;//交保到期日
+    private LocalDate sbdDate;//商报到期日
+    private String bxgs;//保险公司
+    private LocalDate sbDate;//首保日期
+    private BigDecimal totalMiles;//总行驶里程
+    private BigDecimal totalHours;//总行驶小时
+
+    /**
+     * 数据权限
+     */
+    @Transient
+    private DataScope dataScope;
+
+    /**
+     * 申请时间
+     */
+    private LocalDateTime applyTime;
+    /**
+     * 审核时间
+     */
+    private LocalDateTime auditTime;
+    /**
+     * 提交审核时间
+     */
+    private LocalDateTime submitTime;
+    /**
+     * 关闭时间
+     */
+    private LocalDateTime closeTime;
+    /**
+     * 关闭描述
+     */
+    private String closeDesc;
+    /**
+     * 工作流实例ID
+     */
+    private String processInstanceId;
+
+    private Integer auditNode;
+
+    /**
+     * 拒绝原因
+     */
+    private String refuseReason;
+
+    /**
+     * 报废创建人
+     */
+    private String scrapUserId;
+    /**
+     * 报废创建人
+     */
+    private String scrapUserName;
+}

+ 74 - 0
platform-dao/src/main/java/com/platform/dao/mapper/sb/SbInfoMeasureMapper.java

@@ -0,0 +1,74 @@
+package com.platform.dao.mapper.sb;
+
+import com.platform.dao.config.MyMapper;
+import com.platform.dao.dto.sb.SbInfoMeasureDTO;
+import com.platform.dao.entity.sb.SbInfoMeasure;
+import com.platform.dao.vo.sb.SbInfoMeasureVO;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+
+
+/**
+ * @Description 设备基础信息 mapper
+ * @Author liuyu
+ * @Date 2020-04-21 21:05:46
+ * @Version Copyright (c) 2019,北京乾元坤和科技有限公司 All rights reserved.
+ */
+@Component
+public interface SbInfoMeasureMapper extends MyMapper<SbInfoMeasure> {
+    /**
+     * 分页查询
+     *
+     * @param dto
+     * @return
+     */
+    List<SbInfoMeasureVO> selectVOList(SbInfoMeasureDTO dto);
+    /**
+     * 分页查询
+     *
+     * @param dto
+     * @return
+     */
+    List<SbInfoMeasureVO> selectVOListStandard(SbInfoMeasureDTO dto);
+
+    /**
+     * 批量更新,用于定时任务生成后更新设备的保养、润换时间
+     *
+     * @param list
+     * @return
+     */
+    void updateBatch(List<SbInfoMeasureVO> list);
+
+    /**
+     * 根据主键查询
+     *
+     * @param id
+     * @return
+     */
+    SbInfoMeasureVO getById(Object id);
+
+    /**
+     * 根据编号查询
+     *
+     * @param no
+     * @return
+     */
+    SbInfoMeasureVO getByNo(String no);
+
+    /**
+     * 根据主键查询
+     *
+     * @param ids :
+     * @return
+     */
+    List<SbInfoMeasureVO> getByIds(List<String> ids);
+
+    /**
+     * 根据主键查询
+     *
+     * @return
+     */
+    List selectPageInfoForWarn(SbInfoMeasureDTO record);
+
+}

+ 162 - 2
platform-dao/src/main/java/com/platform/dao/util/CustomExcelImportUtil.java

@@ -13,6 +13,7 @@ import com.platform.dao.entity.store.SpareStore;
 import com.platform.dao.enums.*;
 import com.platform.dao.vo.export.sb.ExportSbInfoVO;
 import com.platform.dao.vo.query.sparepartmanage.SparePartInfoVO;
+import com.platform.dao.vo.sb.SbInfoMeasureVO;
 import com.platform.dao.vo.sb.SbInfoVO;
 import com.platform.office.poi.excel.ExcelImportUtil;
 import com.platform.office.poi.excel.entity.ImportParams;
@@ -460,13 +461,13 @@ public class CustomExcelImportUtil {
     public static void main(String[] args) throws IOException, InvalidFormatException {
         //String path = "C:\\Users\\cyz\\Downloads\\老版维保计划\\noperson";
         //File dirFile = new File("C:\\Users\\cyz\\Downloads\\老版维保计划\\noperson");
-        String[] files = {"C:\\Users\\cyz\\\\Downloads\\2021.9.14 保养标准 保养时间 去除指定 (1).xls"};
+        String[] files = {"C:\\Users\\LTKJ\\Downloads\\计量设备基础信息20211128205448123.xls"};
         for(String fileStr:files){
             System.out.println(fileStr);
             InputStream inputstream = new FileInputStream(fileStr);
             LocalDateTime now = LocalDateTime.now();
             //List<SbInfoVO> list = importSbInfoList(inputstream);
-            List<CheckStandard> list = importCheckStandardListByUpdate(inputstream);
+            List<SbInfoMeasureVO> list = importListByUpdateALlMeasure(inputstream);
             list.forEach(item -> {
                 System.out.println(item.toString());
             });
@@ -614,6 +615,36 @@ public class CustomExcelImportUtil {
         }
     }
 
+    private static Integer getRlType(String stringCellValue) {
+        if ("合格".equals(stringCellValue)) {
+            return 1;
+        } else if ("不合格".equals(stringCellValue)) {
+            return 2;
+        } else if ("已校准".equals(stringCellValue)) {
+            return 3;
+        } else{
+            throw new BusinessException("检定结论未配置,请配置:" + stringCellValue);
+        }
+    }
+
+    private static Integer getSbMeasureInfoStatus(String stringCellValue) {
+        if ("在用".equals(stringCellValue)) {
+            return 1;
+        } else if ("检定".equals(stringCellValue)) {
+            return 2;
+        } else if ("备用".equals(stringCellValue)) {
+            return 3;
+        } else if ("维修".equals(stringCellValue)) {
+            return 4;
+        }else if ("停用".equals(stringCellValue)) {
+            return 5;
+        } else if ("丢失".equals(stringCellValue)){
+            return 6;
+        }else{
+            throw new BusinessException("管理状态未配置,请配置:" + stringCellValue);
+        }
+    }
+
     private static Integer getLevel(String stringCellValue) {
         if ("A".equals(stringCellValue) || "A级".equals(stringCellValue)) {
             return 1;
@@ -920,6 +951,135 @@ public class CustomExcelImportUtil {
         return result;
     }
 
+    public static List<SbInfoMeasureVO> importSbInfoMeasureList(InputStream inputstream) throws IOException, InvalidFormatException {
+        if (inputstream == null) {
+            return Collections.emptyList();
+        }
+        Workbook book = null;
+        if (!(inputstream.markSupported())) {
+            inputstream = new PushbackInputStream(inputstream, 8);
+        }
+        if (POIFSFileSystem.hasPOIFSHeader(inputstream)) {
+            book = new HSSFWorkbook(inputstream);
+        } else if (POIXMLDocument.hasOOXMLHeader(inputstream)) {
+            book = new XSSFWorkbook(OPCPackage.open(inputstream));
+        }
+        Sheet sheet = book.getSheetAt(0);
+        int rowCounts = sheet.getLastRowNum();
+        List<SbInfoMeasureVO> result = new ArrayList<>(rowCounts);
+        SbInfoMeasureVO record = null;
+
+        StringBuffer error = new StringBuffer();
+        for (int i = 2; i <= rowCounts; i++) {
+            record = new SbInfoMeasureVO();
+            Row row = sheet.getRow(i);
+            if(isRowEmpty(row)){
+                continue;
+            }
+            String index = row.getCell(0).getStringCellValue() + "";
+            try {
+                //i,j i:行 j:列
+                record.setCardNo(row.getCell(1).getStringCellValue().trim());
+                record.setNo(row.getCell(2).getStringCellValue().trim());
+                record.setName(row.getCell(3).getStringCellValue().trim().replace("'", ""));
+                record.setZz(getCellValue(row.getCell(4)));
+                record.setModel(getCellValue(row.getCell(5)).trim());
+                record.setFdjxh(row.getCell(6).getStringCellValue().trim());
+                record.setUseDept(row.getCell(7).getStringCellValue().trim());
+                record.setCph(row.getCell(8).getStringCellValue().trim());
+                record.setCheckDate(DateUtils.strToLocalDate(row.getCell(9).getStringCellValue().trim(), DateUtils.PATTERN_YMD));
+                record.setCheckPeriod(Double.valueOf(row.getCell(10).getNumericCellValue()).intValue());
+                record.setNextCheckDate(DateUtils.strToLocalDate(row.getCell(11).getStringCellValue().trim(), DateUtils.PATTERN_YMD));
+                record.setProducerId(row.getCell(12).getStringCellValue().trim());
+                record.setDph(row.getCell(13).getStringCellValue().trim());
+                record.setZaiz(row.getCell(14).getStringCellValue().trim());
+                record.setRlType(getRlType(row.getCell(15).getStringCellValue()));
+                record.setColor(row.getCell(16).getStringCellValue().trim().equals("是")?1:0);
+                record.setSbdh(row.getCell(17).getStringCellValue().trim());
+                record.setRemark(row.getCell(18).getStringCellValue().trim());
+                record.setSeatNumber(Double.valueOf(row.getCell(19).getNumericCellValue()).intValue());
+                record.setIsFinancing(row.getCell(20).getStringCellValue().trim().equals("是")?1:0);
+                record.setFinancingNo(row.getCell(21).getStringCellValue().trim());
+                record.setStatus(getSbMeasureInfoStatus(row.getCell(22).getStringCellValue()));
+
+            } catch (Exception e) {
+                error.append(index).append(",");
+            }
+            result.add(record);
+        }
+
+        String errorStr = error.toString();
+        if (StringUtils.isNotEmpty(errorStr)) {
+            throw new BusinessException(String.format("导入异常,以下行数据有问题:%s", errorStr.substring(0, errorStr.length())));
+        }
+        return result;
+    }
+
+    public static List<SbInfoMeasureVO> importListByUpdateALlMeasure(InputStream inputstream) throws IOException, InvalidFormatException {
+        if (inputstream == null) {
+            return Collections.emptyList();
+        }
+        Workbook book = null;
+        if (!(inputstream.markSupported())) {
+            inputstream = new PushbackInputStream(inputstream, 8);
+        }
+        if (POIFSFileSystem.hasPOIFSHeader(inputstream)) {
+            book = new HSSFWorkbook(inputstream);
+        } else if (POIXMLDocument.hasOOXMLHeader(inputstream)) {
+            book = new XSSFWorkbook(OPCPackage.open(inputstream));
+        }
+        Sheet sheet = book.getSheetAt(0);
+        int rowCounts = sheet.getLastRowNum();
+        List<SbInfoMeasureVO> result = new ArrayList<>(rowCounts);
+        SbInfoMeasureVO record = null;
+
+        StringBuffer error = new StringBuffer();
+        for (int i = 2; i <= rowCounts; i++) {
+            record = new SbInfoMeasureVO();
+            Row row = sheet.getRow(i);
+            if(isRowEmpty(row)){
+                continue;
+            }
+            String index = row.getCell(0).getStringCellValue() + "";
+            try {
+                //i,j i:行 j:列
+                record.setId(row.getCell(0).getStringCellValue().trim());
+                record.setCardNo(row.getCell(1).getStringCellValue().trim());
+                record.setNo(row.getCell(2).getStringCellValue().trim());
+                record.setName(row.getCell(3).getStringCellValue().trim().replace("'", ""));
+                record.setZz(getCellValue(row.getCell(4)));
+                record.setModel(getCellValue(row.getCell(5)).trim());
+                record.setFdjxh(row.getCell(6).getStringCellValue().trim());
+                record.setUseDept(row.getCell(7).getStringCellValue().trim());
+                record.setCph(row.getCell(8).getStringCellValue().trim());
+                record.setCheckDate(DateUtils.strToLocalDate(row.getCell(9).getStringCellValue().trim(), DateUtils.PATTERN_YMD));
+                record.setCheckPeriod(Double.valueOf(row.getCell(10).getStringCellValue()).intValue());
+                record.setNextCheckDate(DateUtils.strToLocalDate(row.getCell(11).getStringCellValue().trim(), DateUtils.PATTERN_YMD));
+                record.setProducerId(row.getCell(12).getStringCellValue().trim());
+                record.setDph(row.getCell(13).getStringCellValue().trim());
+                record.setZaiz(row.getCell(14).getStringCellValue().trim());
+                record.setRlType(getRlType(row.getCell(15).getStringCellValue()));
+                record.setColor(row.getCell(16).getStringCellValue().trim().equals("是")?1:0);
+                record.setSbdh(row.getCell(17).getStringCellValue().trim());
+                record.setRemark(row.getCell(18).getStringCellValue().trim());
+                record.setSeatNumber(Double.valueOf(row.getCell(19).getStringCellValue()).intValue());
+                record.setIsFinancing(row.getCell(20).getStringCellValue().trim().equals("是")?1:0);
+                record.setFinancingNo(row.getCell(21).getStringCellValue().trim());
+                record.setStatus(getSbMeasureInfoStatus(row.getCell(22).getStringCellValue()));
+
+            } catch (Exception e) {
+                error.append(index).append(",");
+            }
+            result.add(record);
+        }
+
+        String errorStr = error.toString();
+        if (StringUtils.isNotEmpty(errorStr)) {
+            throw new BusinessException(String.format("导入异常,以下行数据有问题:%s", errorStr.substring(0, errorStr.length())));
+        }
+        return result;
+    }
+
     private static Integer getChild(String trim) {
         if(StringUtils.isBlank(trim)){
             return SbInfoChildEnum.IS_NORMAL.getValue();

+ 65 - 20
platform-dao/src/main/java/com/platform/dao/vo/export/sb/ExportSbInfoMeasureVO.java

@@ -23,57 +23,57 @@ public class ExportSbInfoMeasureVO implements Serializable {
     @Excel(name = "主键", orderNum = "1")
     private String id;
     /**
-     * 主键
+     * 测量设备编号
      */
     @Excel(name = "测量设备编号", orderNum = "2")
     private String cardNo;
     /**
-     * 设备
+     * 设备新号设备新
      */
-    @Excel(name = "设备新号", orderNum = "3")
+    @Excel(name = "设备新号", orderNum = "3")
     private String no;
     /**
-     * 设备编号
+     * 测量设备名称
      */
-    @Excel(name = "出厂编号", orderNum = "4")
-    private String zzh;
+    @Excel(name = "测量设备名称", orderNum = "4")
+    private String name;
     /**
-     * 设备名称
+     * 出厂编号
      */
-    @Excel(name = "测量设备名称", orderNum = "5")
-    private String name;
+    @Excel(name = "出厂编号", orderNum = "5")
+    private String zzh;
     /**
-     * 设备名称
+     * 规格型号
      */
     @Excel(name = "规格型号", orderNum = "6")
     private String model;
     /**
-     * 设备等级
+     * 准确度等级
      */
     @Excel(name = "准确度等级", orderNum = "7")
     private String fdjxh;
     /**
-     * 设备原值
+     * 使用部门
      */
     @Excel(name = "使用部门", orderNum = "8")
-    private String saveUserName;
+    private String useDept;
     /**
-     * 设备类别
+     * 使用地点
      */
-    @Excel(name = "使用位置", orderNum = "9")
+    @Excel(name = "使用地点", orderNum = "9")
     private String cph;
     /**
-     * 自定义类型
+     * 检定日期
      */
     @Excel(name = "检定日期", orderNum = "10")
     private LocalDate checkDate;
     /**
-     * 大小/尺寸
+     * 检定周期
      */
     @Excel(name = "检定周期", orderNum = "11")
     private Integer checkPeriod;
     /**
-     * 使用位置
+     * 有效日期
      */
     @Excel(name = "有效日期", orderNum = "12")
     private LocalDate nextCheckDate;
@@ -81,11 +81,56 @@ public class ExportSbInfoMeasureVO implements Serializable {
      * 生产商
      */
     @Excel(name = "生产商", orderNum = "13")
-    private String producerName;
+    private String producerId;
     /**
-     * 使用施工组名称
+     * 检定单位
      */
     @Excel(name = "检定单位", orderNum = "14")
     private String dph;
+    /**
+     * 检定人
+     */
+    @Excel(name = "检定人", orderNum = "15")
+    private String zaiz;
+    /**
+     * 检定结论
+     */
+    @Excel(name = "检定结论", orderNum = "16", dicCode="SB_MEASURE_RESULT")
+    private String rlType;
+    /**
+     * 是否周检
+     */
+    @Excel(name = "是否周检", orderNum = "17")
+    private String color;
+    /**
+     * 检定证书编号
+     */
+    @Excel(name = "检定证书编号", orderNum = "18")
+    private String sbdh;
+    /**
+     * 备注
+     */
+    @Excel(name = "备注", orderNum = "19")
+    private String remark;
+    /**
+     * 预警天数
+     */
+    @Excel(name = "预警天数", orderNum = "20")
+    private String seatNumber;
+    /**
+     * 是否固定资产
+     */
+    @Excel(name = "是否固定资产", orderNum = "21")
+    private String isFinancing;
+    /**
+     * 固定资产编号
+     */
+    @Excel(name = "固定资产编号", orderNum = "22")
+    private String financingNo;
+    /**
+     * 管理状态
+     */
+    @Excel(name = "管理状态", orderNum = "23", dicCode="SB_MEASURE_STATUS")
+    private String status;
 
 }

+ 480 - 0
platform-dao/src/main/java/com/platform/dao/vo/sb/SbInfoMeasureVO.java

@@ -0,0 +1,480 @@
+package com.platform.dao.vo.sb;
+
+import com.platform.common.bean.BaseVO;
+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.math.BigDecimal;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.util.List;
+
+/**
+ * @Description
+ * @Author chenli
+ * @Date 2019/8/5
+ * @Version Copyright (c) 2019,北京乾元坤和科技有限公司 All rights reserved.
+ */
+@Data
+@Accessors(chain = true)
+@EqualsAndHashCode(callSuper = true)
+public class SbInfoMeasureVO extends BaseVO implements Serializable {
+    /**
+     * 自定义参数列表:[{name:name1, content:content1},{name:name2, content:content2}]
+     */
+    private String paramList;
+    /**
+     * 验收单id
+     */
+    private String checkId;
+    /**
+     * 维修单状态
+     */
+    @Transient
+    private Integer repairStatus;
+    /**
+     * 报修时间
+     */
+    @Transient
+    private LocalDateTime repairApplyTime;
+    /**
+     * 保养数目
+     */
+    private Integer standardNum;
+    /**
+     * 是否子设备:0 父设备,1 子设备
+     */
+    private Integer isChild;
+    /**
+     * 是否在大屏显示设备:0 不显示,1 显示
+     */
+    private Integer isShow;
+    /**
+     * 是否固定资产:0 否1 是
+     */
+    private Integer isFinancing;
+    /**
+    * 卡片编号
+     */
+    private String cardNo;
+    /**
+     * 主键
+     */
+    private String id;
+    /**
+     * 设备编号
+     */
+    private String no;
+    /**
+     * 财务编码
+     */
+    private String financingNo;
+    /**
+     * 财务编码/固定资产编号
+     */
+    private String financingNoTwo;
+    /**
+     * 财务编码/固定资产编号
+     */
+    private String financingNoThird;
+    /**
+     * 财务编码/固定资产编号
+     */
+    private String financingNoFour;
+    /**
+     * 财务编码/固定资产编号
+     */
+    private String financingNoFive;
+    /**
+     * 设备型号
+     */
+    private String modelId;
+    /**
+     * 设备名称
+     */
+    private String name;
+    private String model;
+    private String nameModel;
+
+    private String unitName;
+    /**
+     * 设备类别
+     */
+    private String typeId;
+    /**
+     * 设备等级
+     */
+    private Integer level;
+    /**
+     * 净残值率
+     */
+    private BigDecimal rate;
+    /**
+     * 折旧总计月份
+     */
+    private BigDecimal month;
+    /**
+     * 已计提月份
+     */
+    private BigDecimal usedMonth;
+    /**
+     * 设备原值
+     */
+    private Double initialValue;
+    /**
+     * 当前价值
+     */
+    private Double currentValue;
+    /**
+     * 已折旧价值
+     */
+    private Double cutValue;
+    /**
+     * 生产商
+     */
+    private String producerId;
+    /**
+     * 设备来源方式
+     */
+    private Integer sourceType;
+    /**
+     * 来源设备id
+     */
+    private String sourceSbId;
+    /**
+     * 上层设备id
+     */
+    private String parentId;
+    /**
+     * 上层设备id
+     */
+    @Transient
+    private String parentSbName;
+    /**
+     * 计量单位
+     */
+    private String unit;
+    /**
+     * 所属车间
+     */
+    private String positionId;
+    /**
+     * 规格型号
+     */
+    private String guigeId;
+    /**
+     * 使用区域
+     */
+    private String useArea;
+    /**
+     * 使用公司
+     */
+    private String useCompany;
+    /**
+     * 使用项目部
+     */
+    private String useProject;
+    /**
+     * 使用部门
+     */
+    private String useDept;
+    /**
+     * 使用施工组
+     */
+    private String useGroup;
+    /**
+     * 使用人
+     */
+    private String useUser;
+    /**
+     * 保管部门
+     */
+    private String saveDept;
+    /**
+     * 保管人
+     */
+    private String saveUser;
+    /**
+     * 维修人员
+     */
+    private String repairUser;
+    /**
+     * 使用集团/区域
+     */
+    private String useAreaName;
+    /**
+     * 使用公司
+     */
+    private String useCompanyName;
+    /**
+     * 使用项目部
+     */
+    private String useProjectName;
+    /**
+     * 使用部门
+     */
+    private String useDeptName;
+    /**
+     * 使用施工组
+     */
+    private String useGroupName;
+    /**
+     * 使用人
+     */
+    private String useUserName;
+    /**
+     * 保管部门
+     */
+    private String saveDeptName;
+    /**
+     * 保管人
+     */
+    private String saveUserName;
+    /**
+     * 维修人
+     */
+    private String repairUserName;
+    /**
+     * 第二维修人
+     */
+    private String repairUserNameSecond;
+    /**
+     * 购置日期
+     */
+    private LocalDate buyDate;
+    /**
+     * 投用日期
+     */
+    private LocalDate startDate;
+    /**
+     * 下次检定日期
+     */
+    private LocalDate nextCheckDate;
+    /**
+     * 保修截至日期
+     */
+    private LocalDate guaranteeDate;
+    /**
+     * 预计工作年限
+     */
+    private Double workYear;
+    /**
+     * 预计报废日期
+     */
+    private LocalDate retirementDate;
+    /**
+     * 折旧方式
+     */
+    private Integer depreciationType;
+    /**
+     * 维保手册
+     */
+    private String wbFile;
+    /**
+     * 使用手册
+     */
+    private String useFile;
+    /**
+     * 验收文件
+     */
+    private String checkFile;
+    /**
+     * 设备图片
+     */
+    private String sbImage;
+    /**
+     * 自编号/设备(旧号)
+     */
+    private String zbh;
+    /**
+     * 二维码
+     */
+    private String qrCode;
+    /**
+     * 状态
+     */
+    private Integer status;
+    /**
+     * 备注
+     */
+    private String remark;
+    /**
+     * 创建人
+     */
+    private String createdUserId;
+    /**
+     * 修改人
+     */
+    private String updateUserId;
+    /**
+     * 创建日期
+     */
+    private LocalDateTime createdTime;
+    /**
+     * 更新日期
+     */
+    private LocalDateTime updateTime;
+    /**
+     * 创建人姓名
+     */
+    private String createdUserName;
+    /**
+     * 修改人姓名
+     */
+    private String updateUserName;
+
+    /**
+     *测量设备相关参数
+     */
+    private String zzh;//制造号(车架号)/系列号(出厂编号)
+    private String fdjxh;//发动机型号/准确度等级
+    private LocalDate checkDate;//检定日期(新增字段)
+    private Integer checkPeriod;//检定周期(新增字段),以月为单位
+    private String dph;//检定单位
+    private String zaiz;//检定人
+    private Integer rlType;//检定结论:合格不合格
+    private Integer color;//是否周检查
+    private String sbdh;//检定证书编号
+    private Integer seatNumber;//预警天数,默认45天
+
+   // private Integer financingFlag;//是否固定资产/这个通过financingNo是否为空判断,不需要单独字段,暂时不新增
+
+    /**
+     * 特种设备相关参数
+     */
+    private String registerNo;//注册代码(新增字段)
+    private String characterType;//介质属性(新增字段)
+    private String usedNo;//使用登记证编号(新增字段)
+    private String supplier;//维护供应商(新增字段)
+    private String repairUserSecond;//第二维修人员(新增字段)
+    private String batchNo;//设备批号(新增字段)
+    private LocalDate registerDate;// 登记日期(新增字段)
+
+    /**
+     * 上层类型名称
+     */
+    private String parentName;
+    /**
+     * 来源设备名称
+     */
+    private String sourceSbName;
+    /**
+     * 设备类型名称
+     */
+    private String typeName;
+    /**
+     * 供应商名称
+     */
+    private String producerName;
+    /**
+     * 规格名称
+     */
+    private String guigeName;
+
+    /**
+     * 所属车间
+     */
+    private String positionName;
+
+    /**
+     * 维保手册
+     */
+    private SbModelVO modelVO;
+
+    /**
+     * 维保手册
+     */
+    private List<SysFile> repairFileList;
+
+    /**
+     * 维保手册
+     */
+    private List<SysFile> useFileList;
+
+    /**
+     * 维保手册
+     */
+    private List<SysFile> recheckFileList;
+
+    /**
+     * 维保手册
+     */
+    private List<SysFile> sbFileList;
+    private String fdjh;//发动机号
+    private String cph;//车牌号
+    private String zz;//自重
+    private LocalDate lastRepaireTime;//最近维修时间
+    private Integer repaireTimes;//维修次数
+
+    private LocalDate lastBaoyangTime;//最近保养时间
+    private double lastBaoyangMiles;//最近保养里程
+    private double lastBaoyangHours;//最近保养台时
+    private Integer baoyangTimes;//保养次数
+
+    private String zjm;//助记码
+    private LocalDate spDate;//上牌日期
+    private String jbdh;//交保单号
+    private LocalDate jbdDate;//交保到期日
+    private LocalDate sbdDate;//商报到期日
+    private String bxgs;//保险公司
+    private LocalDate sbDate;//首保日期
+    private BigDecimal totalMiles;//总行驶里程
+    private BigDecimal totalHours;//总行驶小时
+    private Integer useType;//自定义类型
+
+    private List<SbInfoMeasureVO> children;
+
+    /**
+     * 申请时间
+     */
+    private LocalDateTime applyTime;
+    /**
+     * 审核时间
+     */
+    private LocalDateTime auditTime;
+    /**
+     * 提交审核时间
+     */
+    private LocalDateTime submitTime;
+    /**
+     * 关闭时间
+     */
+    private LocalDateTime closeTime;
+    /**
+     * 关闭描述
+     */
+    private String closeDesc;
+    /**
+     * 工作流实例ID
+     */
+    private String processInstanceId;
+
+    private Integer auditNode;
+
+    /**
+     * 拒绝原因
+     */
+    private String refuseReason;
+    /**
+     * 当前审批用户
+     */
+    @Transient
+    private String currentAuditUserName;
+    /**
+     * 报废创建人
+     */
+    private String scrapUserId;
+    /**
+     * 报废创建人
+     */
+    private String scrapUserName;
+
+    /**
+     * 申请意见
+     */
+    private String applyComment;
+}

+ 710 - 0
platform-dao/src/main/resources/mapper/sb/SbInfoMeasureMapper.xml

@@ -0,0 +1,710 @@
+<?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.SbInfoMeasureMapper">
+    <sql id="Base_Column_List">
+        id
+        , no,
+financing_no,
+financing_no_two,
+financing_no_third,
+financing_no_four,
+financing_no_five,
+param_list,
+name, model_id,
+        is_child,
+        is_show,
+        is_financing,
+        type_id, level, initial_value, current_value, cut_value,
+        producer_id, source_type, source_sb_id, parent_id, unit, position_id,
+        use_area,
+        check_id,
+        rate,
+        month,
+        used_month,
+        card_no,
+        use_company,
+        use_project,
+        use_dept,
+        use_group,
+        use_user,
+        save_dept,
+        save_user,
+        repair_user,
+        buy_date, start_date, next_check_date, guarantee_date, work_year, retirement_date,
+        depreciation_type, wb_file, use_file, check_file, sb_image, qr_code, status, remark,
+        created_user_id, update_user_id, created_time, update_time,
+        zzh,
+        fdjxh,
+        fdjh,
+        cph,
+        dph,
+        zz,
+        zaiz,
+        last_repaire_time,
+        repaire_times,
+        last_baoyang_time,
+        last_baoyang_hours,
+        last_baoyang_miles,
+        baoyang_times,
+        rl_type,
+        color,
+        use_type,
+        seat_number,
+        zjm,
+        sp_date,
+        jbdh,
+        sbdh,
+        jbd_date,
+        sbd_date,
+        bxgs,
+        sb_date,
+        check_date,
+        check_period,
+        register_no,
+        character_type,
+        used_no,
+        supplier,
+        repair_user_second,
+        batch_no,
+        register_date,
+zbh,
+refuse_reason,
+apply_time,
+                                     audit_time,
+                                     submit_time,
+                                     process_instance_id,
+                                     audit_node,
+                                     remark,
+                                     apply_comment,
+scrap_user_id,
+scrap_user_name
+    </sql>
+
+    <sql id="Left_Column">
+        sb
+        .
+        id
+        , sb.no,
+sb.financing_no_two,
+sb.financing_no_third,
+sb.financing_no_four,
+sb.financing_no_five,
+sb.financing_no,
+sb.name,  sb.initial_value,
+        sb.current_value, sb.cut_value,
+        sb.is_child,
+        sb.is_financing,
+        sb.parent_id,
+sb.param_list,
+        sb.is_show,
+        sb.unit, sb.position_id,
+        sb.use_area,
+        sb.rate,
+        sb.month,
+        sb.used_month,
+        sb.card_no,
+        sb.check_id,
+        sb.use_company,
+        sb.use_project,
+        sb.use_dept,
+        sb.use_group,
+        sb.use_user,
+        sb.save_dept,
+        sb.save_user,
+        sb.repair_user,
+        sb.buy_date, sb.start_date, sb.next_check_date, sb.guarantee_date, sb.work_year,
+        sb.retirement_date,
+        sb.depreciation_type, sb.wb_file, sb.use_file, sb.check_file, sb.sb_image, sb.qr_code, sb.status, sb.remark,
+        sb.created_user_id, sb.update_user_id, sb.created_time, sb.update_time,
+        sb.model_id,
+        sb.zzh,
+        sb.fdjxh,
+        sb.fdjh,
+        sb.cph,
+        sb.dph,
+        sb.zz,
+        sb.zaiz,
+        sb.last_repaire_time,
+        sb.repaire_times,
+        sb.last_baoyang_time,
+        sb.last_baoyang_hours,
+        sb.last_baoyang_miles,
+        sb.use_type,
+        sb.baoyang_times,
+        sb.rl_type,
+        sb.color,
+        sb.seat_number,
+        sb.zjm,
+        sb.sp_date,
+        sb.jbdh,
+        sb.sbdh,
+        sb.total_hours,
+        sb.total_miles,
+        sb.jbd_date,
+        sb.sbd_date,
+        sb.bxgs,
+        sb.sb_date,
+        sb.type_id as typeId,
+        sb.name_model as nameModel,
+        sb.model,
+        sb.producer_id as producerId,
+        sb.level,
+        sb.unit,
+        sb.use_type as useType,
+        sbType.name as typeName,producer.name as producerName,
+        position.name as positionName,
+        sb.check_date,
+        sb.check_period,
+        sb.register_no,
+        sb.character_type,
+        sb.used_no,
+sb.zbh,
+        sb.supplier,
+        sb.repair_user_second,
+        sb.batch_no,
+        sb.register_date,
+sb.refuse_reason,
+sb.apply_time,
+                                     sb.audit_time,
+                                     sb.submit_time,
+                                     sb.process_instance_id,
+                                     sb.audit_node,
+                                     sb.remark,
+                                     sb.apply_comment,
+sb.scrap_user_id,
+sb.scrap_user_name,
+user.real_name as saveUserName
+    </sql>
+
+    <sql id="deptSql">
+        <if test="saveDept != null and saveDept != ''">
+            and sb.save_dept = #{saveDept}
+        </if>
+    </sql>
+
+    <select id="selectVOList" parameterType="com.platform.dao.dto.sb.SbInfoMeasureDTO"
+            resultType="com.platform.dao.vo.sb.SbInfoMeasureVO">
+        select
+        <include refid="Left_Column"/>
+        from t_sb_info_measure 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_user user on sb.save_user = user.user_id
+        left join t_sys_dept sdDept on sb.save_dept = sdDept.dept_id
+        where
+        1 = 1
+        <if test="keyword != null and keyword != ''">
+            and sb.name like concat('%',#{keyword},'%')
+        </if>
+        <if test="cardNo != null and cardNo!=''">
+            and sb.cardNo like concat('%',#{cardNo},'%')
+        </if>
+        <if test="no != null and no!=''">
+            and sb.no like concat('%',#{no},'%')
+        </if>
+        <if test="zbh != null and zbh!=''">
+            and sb.zbh like concat('%',#{zbh},'%')
+        </if>
+        <if test="likeDeptCode != null and likeDeptCode!=''">
+            and sdDept.dept_code like concat(#{likeDeptCode},'%')
+        </if>
+        <if test="financingNo != null and financingNo!=''">
+            and sb.financing_no like concat(#{financingNo},'%')
+        </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="isFinancing != null">
+            and sb.is_financing = #{isFinancing}
+        </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="parentId != null">
+            and sb.parent_id = #{parentId}
+        </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="nextCheckDateStart != null">
+            and sb.next_check_date <![CDATA[ >= ]]> #{nextCheckDateStart}
+        </if>
+        <if test="nextCheckDateEnd != null">
+            and sb.next_check_date <![CDATA[ <= ]]> #{nextCheckDateEnd}
+        </if>
+        <if test="repairUser != null">
+            and sb.repair_user = #{repairUser}
+        </if>
+        <if test="repairUserSecond != null">
+            and sb.repair_user_second = #{repairUserSecond}
+        </if>
+        <if test="repairUserSearch != null">
+            and (
+            sb.repair_user = #{repairUserSearch}
+            or
+            sb.repair_user_second = #{repairUserSearch}
+            )
+        </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="selectVOListStandard" parameterType="com.platform.dao.dto.sb.SbInfoMeasureDTO"
+            resultType="com.platform.dao.vo.sb.SbInfoMeasureVO">
+        SELECT
+        sb.id,
+        sb.no,
+        sbType.name as typeName,
+        sb.NAME,
+        sb.zbh,
+        sb.status,
+        sb.use_type,
+        sb.type_id,
+        count( standard.id ) as standardNum
+        FROM
+        t_sb_info_measure sb
+        LEFT JOIN t_check_standard standard ON sb.id = standard.sb_id
+        left join t_sb_type sbType on sb.type_id = sbType.id
+        where
+        1 = 1
+        <if test="keyword != null and keyword != ''">
+            and (
+            sb.name like concat('%',#{keyword},'%')
+            or
+            sb.no like concat('%',#{keyword},'%')
+            )
+        </if>
+        <if test="zbh != null and zbh!=''">
+            and sb.zbh like concat('%',#{zbh},'%')
+        </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="isFinancing != null">
+            and sb.is_financing = #{isFinancing}
+        </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="parentId != null">
+            and sb.parent_id = #{parentId}
+        </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="nextCheckDateStart != null">
+            and sb.next_check_date <![CDATA[ >= ]]> #{nextCheckDateStart}
+        </if>
+        <if test="nextCheckDateEnd != null">
+            and sb.next_check_date <![CDATA[ <= ]]> #{nextCheckDateEnd}
+        </if>
+        <if test="status != null">
+            and sb.status = #{status}
+        </if>
+        <if test="modelId != null">
+            and sb.model_id = #{modelId}
+        </if>
+        group by sb.id
+    </select>
+
+    <select id="selectScreenDetailVOList"
+            parameterType="com.platform.dao.dto.sb.SbInfoMeasureDTO"
+            resultType="com.platform.dao.vo.sb.SbInfoScreenDetailVO">
+        select
+        sb.id, sb.no, sb.zjm, sb.jbdh, sb.level
+        from t_sb_info_measure sb
+        <where>
+            sb.zjm is not null
+            and sb.jbdh is not null
+            and is_show = true
+        </where>
+    </select>
+
+    <select id="selectPageInfoForWarn" parameterType="com.platform.dao.dto.sb.SbInfoMeasureDTO"
+            resultType="com.platform.dao.vo.sb.SbInfoMeasureVO">
+        select
+        <include refid="Left_Column"/>
+        from t_sb_info_measure 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_user user on sb.save_user = user.user_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="financingNo != null and financingNo!=''">
+            and sb.financing_no like concat(#{financingNo},'%')
+        </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="isFinancing != null">
+            and sb.is_financing = #{isFinancing}
+        </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="nextCheckDateStart != null">
+            and sb.next_check_date <![CDATA[ >= ]]> #{nextCheckDateStart}
+        </if>
+        <if test="nextCheckDateEnd != null">
+            and sb.next_check_date <![CDATA[ <= ]]> #{nextCheckDateEnd}
+        </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.SbInfoMeasureVO">
+        select
+        <include refid="Left_Column"/>
+        from t_sb_info_measure 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_user user on sb.save_user = user.user_id
+        where sb.id = #{value}
+    </select>
+    <select id="getByNo" parameterType="java.lang.Object" resultType="com.platform.dao.vo.sb.SbInfoMeasureVO">
+        select
+        <include refid="Left_Column"/>
+        from t_sb_info_measure 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_user user on sb.save_user = user.user_id
+        where sb.no = #{value}
+    </select>
+
+    <select id="getByIds" parameterType="java.util.List" resultType="com.platform.dao.vo.sb.SbInfoMeasureVO">
+        select
+        <include refid="Left_Column"/>
+        from t_sb_info_measure sb
+        where sb.id in
+        <foreach item="item" index="index" collection="ids" open="(" close=")" separator=",">
+            #{item}
+        </foreach>
+    </select>
+
+    <select id="selectNameById" parameterType="Object" resultType="java.lang.String">
+        select name
+        from t_sb_info_measure
+        where id = #{value}
+    </select>
+
+    <select id="selectNoById" parameterType="Object" resultType="java.lang.String">
+        select no
+        from t_sb_info_measure
+        where id = #{value}
+    </select>
+
+    <update id="updateBatch" parameterType="java.util.List">
+        <foreach collection="list" item="item" index="index" open="" close="" separator=";">
+            update t_sb_info_measure
+            <set>
+                last_baoyang_time=#{item.lastBaoyangTimes},
+                last_baoyang_hours=#{item.lastBaoyangHours},
+                last_baoyang_miles=#{item.lastBaoyangMiles}
+            </set>
+            where id = #{item.id}
+        </foreach>
+    </update>
+
+    <update id="updateBatchQrCode" parameterType="java.util.List">
+        <foreach collection="list" item="item" index="index" open="" close="" separator=";">
+            update t_sb_info_measure
+            <set>
+                qr_code=#{item.qrCode}
+            </set>
+            where id = #{item.id}
+        </foreach>
+    </update>
+
+    <update id="updateBatchChild" parameterType="java.util.List">
+        <foreach collection="list" item="item" index="index" open="" close="" separator=";">
+            update t_sb_info_measure
+            <set>
+                parent_id = #{item.parentId}
+            </set>
+            where id = #{item.id}
+        </foreach>
+    </update>
+
+    <update id="updateBatchValue" parameterType="java.util.List">
+        <foreach collection="list" item="item" index="index" open="" close="" separator=";">
+            update t_sb_info_measure
+            <set>
+                initial_value=#{item.initialValue},
+                current_value=#{item.currentValue},
+                cut_value=#{item.cutValue},
+                month=#{item.month},
+                rate=#{item.rate},
+                used_month=#{item.usedMonth}
+            </set>
+            where id = #{item.id}
+        </foreach>
+    </update>
+
+    <update id="updateStatusByIds" parameterType="com.platform.dao.dto.sb.SbInfoMeasureDTO">
+        update t_sb_info_measure
+        <set>
+            status=${status}, update_time=#{updateTime,jdbcType=TIMESTAMP}
+        </set>
+        where
+        id in
+        <foreach item="item" index="index" collection="sbIds" open="(" close=")" separator=",">
+            #{item}
+        </foreach>
+    </update>
+
+    <update id="updateTotalById" parameterType="java.util.List">
+        <foreach collection="sbInfos" item="item" index="index" open="" close="" separator=";">
+            update t_sb_info_measure
+            <set>
+                <if test="item.totalHours != null">
+                    total_hours= total_hours+#{item.totalHours},
+                </if>
+                <if test="item.totalMiles != null">
+                    total_miles=total_miles+#{item.totalMiles},
+                </if>
+            </set>
+            where id = #{item.id}
+        </foreach>
+    </update>
+
+    <update id="updateBySbIds" parameterType="com.platform.dao.dto.sb.SbInfoMeasureDTO">
+        update t_sb_info_measure
+        <set>
+            <if test="useArea != null">
+                use_area = #{useArea},
+            </if>
+            <if test="useCompany != null">
+                use_company = #{useCompany},
+            </if>
+            <if test="useCompanyName != null">
+                use_company_name = #{useCompanyName},
+            </if>
+            <if test="useProject != null">
+                use_project = #{useProject},
+            </if>
+            <if test="useProjectName != null">
+                use_project_name = #{useProjectName},
+            </if>
+            <if test="useDept != null">
+                use_dept = #{useDept},
+            </if>
+            <if test="useDeptName != null">
+                use_dept_name = #{useDeptName},
+            </if>
+            <if test="useGroup != null">
+                use_group = #{useGroup},
+            </if>
+            <if test="useGroupName != null">
+                use_group_name = #{useGroupName},
+            </if>
+            <if test="saveDept != null">
+                save_dept = #{saveDept},
+            </if>
+            <if test="saveDeptName != null">
+                save_dept_name = #{saveDeptName},
+            </if>
+            <if test="saveUser != null">
+                save_user = #{saveUser},
+            </if>
+            <if test="status != null">
+                status = #{status},
+            </if>
+            <if test="updateTime != null">
+                update_time=#{updateTime,jdbcType=TIMESTAMP},
+            </if>
+            <if test="updateUserId != null">
+                update_user_id = #{updateUserId},
+            </if>
+            <if test="updateUserName != null">
+                update_user_name = #{updateUserName},
+            </if>
+            <if test="saveUserNull != null and saveUserNull">
+                save_user = null,
+            </if>
+        </set>
+        where
+        id in
+        <foreach item="item" index="index" collection="sbIds" open="(" close=")" separator=",">
+            #{item}
+        </foreach>
+    </update>
+</mapper>

+ 251 - 0
platform-rest/src/main/java/com/platform/rest/controller/sb/SbInfoMeasureController.java

@@ -0,0 +1,251 @@
+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.util.StringUtils;
+import com.platform.common.validation.group.AddGroup;
+import com.platform.common.validation.group.UpdateGroup;
+import com.platform.dao.dto.sb.SbInfoMeasureDTO;
+import com.platform.dao.entity.sb.SbInfo;
+import com.platform.dao.entity.sb.SbInfoMeasure;
+import com.platform.dao.util.ExcelUtil;
+import com.platform.dao.util.TreeUtil;
+import com.platform.dao.vo.export.sb.ExportSbInfoMeasureVO;
+import com.platform.dao.vo.export.sb.ExportSbInfoVO;
+import com.platform.dao.vo.sb.SbInfoMeasureVO;
+import com.platform.office.poi.excel.ExcelImportUtil;
+import com.platform.office.poi.excel.entity.ImportParams;
+import com.platform.rest.log.annotation.SysLog;
+import com.platform.service.sb.SbInfoMeasureService;
+import com.platform.service.sb.SbInfoService;
+import lombok.AllArgsConstructor;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.servlet.http.HttpServletResponse;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * @Description 设备基础信息 控制器
+ * @Author liuyu
+ * @Date 2020-04-21 21:05:46
+ * @Version Copyright (c) 2019,北京乾元坤和科技有限公司 All rights reserved.
+ */
+@RestController
+@AllArgsConstructor
+@RequestMapping("/sb/info/measures")
+public class SbInfoMeasureController {
+
+    private final SbInfoMeasureService sbInfoService;
+
+    /**
+     * 通过id查询单条记录
+     *
+     * @param id 主键
+     * @return R
+     */
+    @GetMapping("/{id}")
+    public R<SbInfoMeasureVO> getById(@PathVariable("id") String id) {
+        return new R<>(sbInfoService.getById(id));
+    }
+
+    /**
+     * 通过id查询单条记录
+     *
+     * @param sbInfo 主键
+     * @return R
+     */
+    @GetMapping("/model")
+    public R getModelByModel(SbInfoMeasure sbInfo) {
+        return new R<>(sbInfoService.getModelByModel(sbInfo));
+    }
+
+    /**
+     * 新增记录
+     *
+     * @param sbInfoDTO 设备基础信息DTO
+     * @return R
+     */
+    @SysLog("新增设备基础信息")
+    @PostMapping
+    @PreAuthorize("@pms.hasPermission('sb-infos-add')")
+    public R save(@Validated({AddGroup.class}) @RequestBody SbInfoMeasureDTO sbInfoDTO) {
+        return new R<>(sbInfoService.saveModelByDTO(sbInfoDTO));
+    }
+
+    /**
+     * 新增记录
+     *
+     * @param sbInfoDTO 设备基础信息DTO
+     * @return R
+     */
+    @SysLog("复制设备基础信息")
+    @PostMapping("/copy")
+    @PreAuthorize("@pms.hasPermission('sb-infos-add')")
+    public R copy(@Validated({AddGroup.class}) @RequestBody SbInfoMeasureDTO sbInfoDTO) {
+        return new R<>(sbInfoService.saveModelByDTOCopy(sbInfoDTO));
+    }
+
+    /**
+     * 修改记录
+     *
+     * @param sbInfoDTO 设备基础信息DTO
+     * @return R
+     */
+    @SysLog("修改设备基础信息")
+    @PutMapping("/{id}")
+    @PreAuthorize("@pms.hasPermission('sb-infos-edit')")
+    public R update(@PathVariable("id") String id, @Validated({UpdateGroup.class}) @RequestBody SbInfoMeasureDTO sbInfoDTO) {
+        sbInfoService.modModelByDTO(sbInfoDTO);
+        return new R<>();
+    }
+
+    /**
+     * 更新设备状态:位置等其他信息
+     *
+     * @param sbInfoDTO 设备基础信息DTO
+     * @return R
+     */
+    @SysLog("修改设备状态基础信息")
+    @PutMapping("/status/{id}")
+    @PreAuthorize("@pms.hasPermission('sb-infos-edit')")
+    public R updateStatus(@PathVariable("id") String id, @Validated({UpdateGroup.class}) @RequestBody SbInfoMeasureDTO sbInfoDTO) {
+        sbInfoService.updateStatus(sbInfoDTO);
+        return new R<>();
+    }
+
+    /**
+     * 通过id删除一条记录
+     *
+     * @param id 主键
+     * @return R
+     */
+    @SysLog("删除设备基础信息")
+    @DeleteMapping("/{id}")
+    @PreAuthorize("@pms.hasPermission('sb-infos-del')")
+    public R removeById(@PathVariable String id) {
+        sbInfoService.deleteByPrimaryKey(id);
+        return new R<>();
+    }
+
+    /**
+     * 批量记录
+     *
+     * @param ids 主键
+     * @return R
+     */
+    @SysLog("批量删除设备基础信息")
+    @DeleteMapping("")
+    @PreAuthorize("@pms.hasPermission('sb-infos-del')")
+    public R removeIds(@RequestBody List<String> ids) {
+        sbInfoService.batchDelete(ids);
+        return new R<>();
+    }
+
+    /**
+     * 获取分页
+     *
+     * @param pageNum   当前页码
+     * @param pageSize  每页条数
+     * @param sbInfoDTO 设备基础信息DTO
+     * @return R
+     */
+    @GetMapping("/page")
+    public R<AbstractPageResultBean<SbInfoMeasureVO>> query(SbInfoMeasureDTO sbInfoDTO, @RequestParam(defaultValue = "1") int pageNum, @RequestParam(defaultValue = "20") int pageSize) {
+        return new R<>(sbInfoService.selectVOPage(sbInfoDTO, pageNum, pageSize));
+    }
+
+    /**
+     * 获取检定预警分页
+     *
+     * @param pageNum   当前页码
+     * @param pageSize  每页条数
+     * @param sbInfoDTO 设备基础信息DTO
+     * @return R
+     */
+    @GetMapping("warn/page")
+    public R<AbstractPageResultBean<SbInfoMeasureVO>> queryMeasureWarn(SbInfoMeasureDTO sbInfoDTO, @RequestParam(defaultValue = "1") int pageNum, @RequestParam(defaultValue = "20") int pageSize) {
+        return new R<>(sbInfoService.selectPageInfoForWarn(sbInfoDTO, pageNum, pageSize));
+    }
+
+    /**
+     * 获取列表
+     *
+     * @param sbInfoDTO 设备基础信息DTO
+     * @return R
+     */
+    @GetMapping("")
+    public R query(SbInfoMeasureDTO sbInfoDTO) {
+        return new R<>(sbInfoService.selectVOList(sbInfoDTO));
+    }
+
+    /**
+     * 设备基础信息导出
+     *
+     * @param sbInfoDTO 设备基础信息DTO
+     * @return R
+     */
+    @GetMapping("/export")
+    @SysLog("设备基础信息导出")
+    @PreAuthorize("@pms.hasPermission('sb-infos-export')")
+    public void export(HttpServletResponse response, SbInfoMeasureDTO sbInfoDTO) {
+        List<SbInfoMeasureVO> list = sbInfoService.selectExportVOList(sbInfoDTO);
+        List<ExportSbInfoMeasureVO> sbInfoMeasureVOS = BeanConverterUtil.copyListProperties(list, ExportSbInfoMeasureVO.class);
+        for(ExportSbInfoMeasureVO vo: sbInfoMeasureVOS){
+            if(StringUtils.isNotBlank(vo.getColor())){
+                if(vo.getColor().equals("0")) {
+                    vo.setColor("否");
+                }else{
+                    vo.setColor("是");
+                }
+            }
+            if(StringUtils.isNotBlank(vo.getIsFinancing())){
+                if(vo.getIsFinancing().equals("0")) {
+                    vo.setIsFinancing("否");
+                }else{
+                    vo.setIsFinancing("是");
+                }
+            }
+        }
+        ExcelUtil.exportResponseDict(response, ExportSbInfoMeasureVO.class, sbInfoMeasureVOS, "计量设备基础信息");
+    }
+
+    /**
+     * 导入设备:
+     * 新增导入,且对应的供应商、类型、等级等都已经在数据库添加好了
+     * 主要用途:初始化导入的时候数据比较多,需要用户批量导入
+     *
+     * @param file bom excel文件
+     *
+     * @return R
+     */
+    @SysLog("新增导入设备")
+    @PostMapping("/import")
+    public R importExcel(@RequestParam("type") Integer type, @RequestParam("file") MultipartFile file) throws Exception {
+        String result = "";
+        if(type == 1){
+            result = sbInfoService.importListByAdd( file);
+        }else if(type == 2){
+            result = sbInfoService.importListByUpdateALl(file);
+        }
+        return new R<>(result);
+    }
+
+    /**
+     * 子设备数量
+     *
+     * @param sbInfoDTO
+     * @return R
+     */
+    @GetMapping("/child/num")
+    public R getNum(SbInfoMeasureDTO sbInfoDTO) {
+        return new R<>(sbInfoService.getCountByDTO(sbInfoDTO));
+    }
+
+}

+ 1 - 0
platform-service/src/main/java/com/platform/service/bean/ScheduleUtils.java

@@ -45,6 +45,7 @@ public class ScheduleUtils {
      * 创建定时任务
      */
     public static void createScheduleJob(Scheduler scheduler, ScheduleJob scheduleJob) {
+
         try {
             //构建job信息
             JobDetail jobDetail = JobBuilder.newJob(ScheduleJobBean.class).withIdentity(getJobKey(scheduleJob.getJobId())).build();

+ 101 - 0
platform-service/src/main/java/com/platform/service/sb/SbInfoMeasureService.java

@@ -0,0 +1,101 @@
+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.dto.sb.SbInfoMeasureDTO;
+import com.platform.dao.entity.sb.SbInfo;
+import com.platform.dao.entity.sb.SbInfoMeasure;
+import com.platform.dao.vo.sb.SbInfoMeasureVO;
+import com.platform.dao.vo.sb.SbInfoScreenDetailVO;
+import com.platform.dao.vo.sb.SbInfoScreenVO;
+import com.platform.dao.vo.sb.SbInfoVO;
+import com.platform.service.base.IBaseService;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.util.List;
+
+/**
+ * @Description 设备基础信息 service
+ * @Author liuyu
+ * @Date 2020-04-21 21:05:46
+ * @Version Copyright (c) 2019,北京乾元坤和科技有限公司 All rights reserved.
+ */
+public interface SbInfoMeasureService extends IBaseService<SbInfoMeasure, SbInfoMeasureDTO> {
+
+    /**
+     * 批量删除
+     *
+     * @param ids :
+     * @return :
+     */
+    int batchDelete(List<String> ids);
+
+    /**
+     * 分页查询
+     *
+     * @param dto :
+     * @return :
+     */
+    List<SbInfoMeasureVO> selectVOList(SbInfoMeasureDTO dto);
+
+    /**
+     * 导出查询
+     *
+     * @param dto :
+     * @return :
+     */
+    List<SbInfoMeasureVO> selectExportVOList(SbInfoMeasureDTO dto);
+
+    /**
+     * 分页查询
+     *
+     * @param dto      :
+     * @param pageNum  :
+     * @param pageSize :
+     * @return :
+     */
+    MyVOPage<SbInfoMeasureVO> selectVOPage(SbInfoMeasureDTO dto, int pageNum, int pageSize);
+
+    /**
+     * 根据主键查询
+     *
+     * @param id :
+     * @return :
+     */
+    SbInfoMeasureVO getById(Object id);
+
+    /**
+     * 复制设备信息
+     *
+     * @param model
+     * @return
+     */
+    public SbInfoMeasure saveModelByDTOCopy(SbInfoMeasureDTO model);
+    /**
+     * 通过状态统计
+     *
+     * @return :
+     */
+    int countByStatus(Integer... status);
+
+    /**
+     * 改变设备状态
+     *
+     * @param model :
+     */
+    void updateStatus(SbInfoMeasureDTO model);
+
+    String importListByAdd(MultipartFile file);
+    String importListByUpdateALl(MultipartFile file);
+
+    /**
+     * 选择已经到了预警期限内的设备列表
+     *
+     * @param record
+     * @param pageNum
+     * @param pageSize
+     * @return
+     */
+    public AbstractPageResultBean<SbInfoMeasureVO> selectPageInfoForWarn(SbInfoMeasureDTO record, int pageNum, int pageSize);
+}

+ 477 - 0
platform-service/src/main/java/com/platform/service/sb/impl/SbInfoMeasureServiceImpl.java

@@ -0,0 +1,477 @@
+package com.platform.service.sb.impl;
+
+import cn.hutool.core.collection.CollectionUtil;
+import cn.hutool.core.date.DateUtil;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.github.pagehelper.PageHelper;
+import com.platform.activiti.bean.ActObj;
+import com.platform.activiti.enums.ActApplyEnum;
+import com.platform.common.bean.AbstractPageResultBean;
+import com.platform.common.cache.ConfigCache;
+import com.platform.common.constant.CommonConstants;
+import com.platform.common.enums.DataFilterTypeEnum;
+import com.platform.common.enums.ResultCode;
+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.check.CheckStandardDTO;
+import com.platform.dao.dto.part.PartInfoDTO;
+import com.platform.dao.dto.sb.SbInfoMeasureDTO;
+import com.platform.dao.dto.sb.SbModelSpareBomDTO;
+import com.platform.dao.dto.upms.SysDeptDTO;
+import com.platform.dao.dto.upms.SysUserDeptDTO;
+import com.platform.dao.dto.workplace.WorkplaceBacklogDTO;
+import com.platform.dao.dto.workplace.WorkplaceBacklogUserDTO;
+import com.platform.dao.entity.firm.FirmProducer;
+import com.platform.dao.entity.repair.RepairApplicationForm;
+import com.platform.dao.entity.sb.*;
+import com.platform.dao.entity.upms.SysDept;
+import com.platform.dao.entity.upms.SysFile;
+import com.platform.dao.entity.upms.SysUser;
+import com.platform.dao.entity.upms.SysUserDept;
+import com.platform.dao.enums.*;
+import com.platform.dao.mapper.firm.FirmProducerMapper;
+import com.platform.dao.mapper.repair.RepairApplicationFormMapper;
+import com.platform.dao.mapper.sb.*;
+import com.platform.dao.mapper.upms.SysDeptMapper;
+import com.platform.dao.mapper.upms.SysFileMapper;
+import com.platform.dao.mapper.upms.SysUserDeptMapper;
+import com.platform.dao.mapper.upms.SysUserMapper;
+import com.platform.dao.mapper.workplace.WorkplaceBacklogUserMapper;
+import com.platform.dao.util.CustomExcelImportUtil;
+import com.platform.dao.util.MessageTemplateUtil;
+import com.platform.dao.util.UserUtil;
+import com.platform.dao.vo.SysUserDeptVO;
+import com.platform.dao.vo.SysUserVO;
+import com.platform.dao.vo.query.upms.SysDeptVO;
+import com.platform.dao.vo.sb.SbInfoScreenDetailVO;
+import com.platform.dao.vo.sb.SbInfoScreenVO;
+import com.platform.dao.vo.sb.SbInfoMeasureVO;
+import com.platform.service.base.impl.BaseServiceImpl;
+import com.platform.service.business.ActivitiBusinessService;
+import com.platform.service.check.CheckStandardService;
+import com.platform.service.event.WorkplaceBacklogEvent;
+import com.platform.service.part.PartInfoService;
+import com.platform.service.sb.SbInfoMeasureService;
+import com.platform.service.sb.SbModelSpareBomService;
+import com.platform.service.upms.SysDeptRelationService;
+import com.platform.service.upms.SysDeptService;
+import com.platform.service.upms.SysUserDeptService;
+import com.platform.service.util.CodeFileUtils;
+import com.platform.service.util.ExecuteSql;
+import com.platform.service.util.SysFileUtils;
+import lombok.AllArgsConstructor;
+import org.springframework.core.env.Environment;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Isolation;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.CollectionUtils;
+import org.springframework.web.multipart.MultipartFile;
+import tk.mybatis.mapper.weekend.Weekend;
+import tk.mybatis.mapper.weekend.WeekendCriteria;
+
+import java.math.BigDecimal;
+import java.time.LocalDateTime;
+import java.util.*;
+import java.util.stream.Collectors;
+
+/**
+ * @Description 设备基础信息 service 实现类
+ * @Author liuyu
+ * @Date 2020-04-21 21:05:46
+ * @Version Copyright (c) 2019,北京乾元坤和科技有限公司 All rights reserved.
+ */
+@AllArgsConstructor
+@Service("sbInfoMeasureService")
+public class SbInfoMeasureServiceImpl extends BaseServiceImpl<SbInfoMeasureMapper, SbInfoMeasure, SbInfoMeasureDTO> implements SbInfoMeasureService {
+
+    private final Environment environment;
+    private final SysDeptMapper deptMapper;
+    private final SbStatusLogMapper sbStatusLogMapper;
+    private final SbStopLogMapper sbStopLogMapper;
+    private final SysUserMapper sysUserMapper;
+    private final SbTypeMapper sbTypeMapper;
+    private final SbPositionMapper sbPositionMapper;
+    private final SysFileMapper sysFileMapper;
+    private final SysUserDeptService sysUserDeptService;
+    private final SysDeptService sysDeptService;
+    private final FirmProducerMapper firmProducerMapper;
+
+    @Override
+    public int batchDelete(List<String> ids) {
+        Weekend<SbInfoMeasure> weekend = new Weekend<>(SbInfoMeasure.class);
+        WeekendCriteria<SbInfoMeasure, Object> weekendCriteria = weekend.weekendCriteria();
+        weekendCriteria.andIn(SbInfoMeasure::getId, ids);
+        mapper.deleteByExample(weekend);
+        return 1;
+    }
+
+    @Override
+    public SbInfoMeasure saveModelByDTO(SbInfoMeasureDTO model) {
+
+        if (model.getIsFinancing() == null) {
+            model.setIsFinancing(SbInfoFinancingEnum.NOT.getValue());
+        }
+
+        model.setId(IdGeneratorUtils.getObjectId());
+        if (model.getIsChild() == null) {
+            model.setIsChild(SbInfoChildEnum.IS_NORMAL.getValue());
+        }
+        if (model.getIsShow() == null) {
+            model.setIsChild(SbInfoShowEnum.NOT_SHOW.getValue());
+        }
+        return super.saveModelHaveCreateInfo(model);
+    }
+
+    /**
+     * 复制设备信息
+     * 重新设置二维码
+     * 页面重新设置编号,
+     * 代码重新设置id
+     * 1:复制设备基础信息
+     * 2:复制部位
+     * 3:复制保养内容
+     * 4:复制bom
+     * 5:复制图片和文件
+     *
+     * @param model
+     * @return
+     */
+    @Override
+    public SbInfoMeasure saveModelByDTOCopy(SbInfoMeasureDTO model) {
+
+        String oldId = model.getId();
+        model.setId(IdGeneratorUtils.getObjectId());
+        if (model.getIsChild() == null) {
+            model.setIsChild(SbInfoChildEnum.IS_NORMAL.getValue());
+        }
+        if (model.getIsShow() == null) {
+            model.setIsChild(SbInfoShowEnum.NOT_SHOW.getValue());
+        }
+        if (model.getIsFinancing() == null) {
+            model.setIsFinancing(SbInfoFinancingEnum.NOT.getValue());
+        }
+        return super.saveModelHaveCreateInfo(model);
+    }
+
+    @Override
+    public void modModelByDTO(SbInfoMeasureDTO model) {
+        super.modModelByDTO(model);
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public void updateStatus(SbInfoMeasureDTO model) {
+        setSbStatusLogAndStopLogIgnore(model);
+        SbInfoMeasure info = new SbInfoMeasure();
+        info.setId(model.getId());
+        info.setCph(model.getCph());
+        info.setStatus(model.getStatus());
+        mapper.updateByPrimaryKeySelective(info);
+    }
+
+    /**
+     * 如果是未登录的时候,变更了状态,需要记录状态变更表,人员默认都是管理员操作的
+     * 如果是启用,则要更新停机记录表数据
+     *
+     * @param model
+     */
+    private void setSbStatusLogAndStopLogIgnore(SbInfoMeasureDTO model) {
+        SbInfoMeasure old = mapper.selectByPrimaryKey(model.getId());
+        if (old.getStatus() != null && old.getStatus().equals(model.getStatus())) {
+            return;
+        }
+        String userId = model.getSaveUser();
+        String actualUser = model.getActualUser();
+        if (StringUtils.isBlank(actualUser)) {
+            actualUser = sysUserMapper.selectByPrimaryKey(userId).getRealName();
+        }
+        LocalDateTime now = LocalDateTime.now();
+        SbStatusLog log = new SbStatusLog();
+        log.setSbId(model.getId());
+        log.setId(IdGeneratorUtils.getObjectId());
+        log.setChangeReason(model.getChangeReason());
+        log.setActualUser(actualUser);
+        log.setAfterStatus(model.getStatus());
+        log.setPreStatus(old.getStatus());
+        log.setChangeTime(now);
+        log.setChangeUserId(userId);
+        log.setCreatedTime(now);
+        log.setCreatedUserId(userId);
+        log.setUpdateTime(now);
+        log.setUpdateUserId(userId);
+        log.setRemark("");
+        sbStatusLogMapper.insert(log);
+
+        // 新增停机记录
+        if (model.getStatus() != null && model.getStatus().equals(SbInfoStatusEnum.IN_STOP.getValue())) {
+            SbStopLog stopLog = new SbStopLog();
+            stopLog.setStopUserId(actualUser);
+            stopLog.setId(IdGeneratorUtils.getObjectId());
+            stopLog.setSbId(model.getId());
+            stopLog.setStopTime(now);
+            stopLog.setStopReason(model.getChangeReason());
+            stopLog.setCreatedTime(now);
+            stopLog.setCreatedUserId(userId);
+            stopLog.setUpdateTime(now);
+            stopLog.setStatus(0);
+            stopLog.setUpdateUserId(userId);
+            sbStopLogMapper.insert(stopLog);
+        }
+
+        // 更新开机记录,并记录时长
+        if (model.getStatus() != null && model.getStatus().equals(SbInfoStatusEnum.IN_USE.getValue())) {
+            Weekend<SbStopLog> weekend = new Weekend<>(SbStopLog.class);
+            weekend.weekendCriteria().andEqualTo(SbStopLog::getSbId, model.getId()).andEqualTo(SbStopLog::getStatus, 0);
+            SbStopLog stopLog = sbStopLogMapper.selectOneByExample(weekend);
+            // 创建新的记录,直接跳过,不记录了
+            if (stopLog == null) {
+                return;
+            }
+            stopLog.setStartUserId(actualUser);
+            stopLog.setStartTime(now);
+            stopLog.setStartReason(model.getChangeReason());
+            stopLog.setStatus(1);
+            stopLog.setStopDuration(new BigDecimal(DateUtils.getDurationMinutes(stopLog.getStopTime(), stopLog.getStartTime())));
+            stopLog.setUpdateTime(now);
+            stopLog.setUpdateUserId(userId);
+            sbStopLogMapper.updateByPrimaryKey(stopLog);
+        }
+    }
+
+    @Override
+    public List<SbInfoMeasureVO> selectVOList(SbInfoMeasureDTO model) {
+        return mapper.selectVOList(model);
+    }
+
+    @Override
+    public List<SbInfoMeasureVO> selectExportVOList(SbInfoMeasureDTO model) {
+        List<SbInfoMeasureVO> vos = mapper.selectVOList(model);
+
+        return vos;
+    }
+
+    /**
+     * 系统管理员查询全部
+     *
+     * @param model
+     * @param pageNum  :
+     * @param pageSize :
+     * @return
+     */
+    @Override
+    public MyVOPage<SbInfoMeasureVO> selectVOPage(SbInfoMeasureDTO model, int pageNum, int pageSize) {
+
+        // 选择该用户的设备
+        PageHelper.startPage(pageNum, pageSize);
+        List<SbInfoMeasureVO> sbList = mapper.selectVOList(model);
+        return new MyVOPage<>(sbList);
+    }
+
+    @Override
+    public SbInfoMeasureVO getById(Object id) {
+        SbInfoMeasureVO vo = mapper.getById(id);
+        if (StringUtils.isNotBlank(vo.getParentId())) {
+            SbInfoMeasureVO parentVo = mapper.getById(vo.getParentId());
+            vo.setParentSbName(parentVo.getName());
+        }
+
+        Weekend<SysFile> weekend = new Weekend<>(SysFile.class);
+        weekend.weekendCriteria().andEqualTo(SysFile::getTargetId, vo.getId());
+        List<SysFile> sysFiles = sysFileMapper.selectByExample(weekend);
+        List<SysFile> repairFileList = ListUtils.newArrayList();
+        List<SysFile> useFileList = ListUtils.newArrayList();
+        List<SysFile> recheckFileList = ListUtils.newArrayList();
+        List<SysFile> sbFileList = ListUtils.newArrayList();
+        sysFiles.forEach(item -> {
+            if (item.getType().equals(SysFileTypeEnum.SB_WX_FILE.getValue())) {
+                repairFileList.add(item);
+            }
+            if (item.getType().equals(SysFileTypeEnum.SB_USE_FILE.getValue())) {
+                useFileList.add(item);
+            }
+            if (item.getType().equals(SysFileTypeEnum.SB_WB_FILE.getValue())) {
+                recheckFileList.add(item);
+            }
+            if (item.getType().equals(SysFileTypeEnum.SB_IMG.getValue())) {
+                sbFileList.add(item);
+            }
+        });
+        vo.setRepairFileList(repairFileList);
+        vo.setUseFileList(useFileList);
+        vo.setRecheckFileList(recheckFileList);
+        vo.setSbFileList(sbFileList);
+
+        if (vo.getSaveUser() != null) {
+            Weekend<SysUser> weekend2 = new Weekend<>(SysUser.class);
+            weekend2.weekendCriteria().andEqualTo(SysUser::getUserId, vo.getSaveUser());
+            SysUser saveUser = sysUserMapper.selectOneByExample(weekend2);
+            if (saveUser != null) {
+                vo.setSaveUserName(saveUser.getRealName());
+            }
+        }
+        if (vo.getRepairUser() != null) {
+            Weekend<SysUser> weekend2 = new Weekend<>(SysUser.class);
+            weekend2.weekendCriteria().andEqualTo(SysUser::getUserId, vo.getRepairUser());
+            SysUser repairUser = sysUserMapper.selectOneByExample(weekend2);
+            if (repairUser != null) {
+                vo.setRepairUserName(repairUser.getRealName());
+            }
+        }
+
+        if (vo.getRepairUserSecond() != null) {
+            Weekend<SysUser> weekend2 = new Weekend<>(SysUser.class);
+            weekend2.weekendCriteria().andEqualTo(SysUser::getUserId, vo.getRepairUserSecond());
+            SysUser repairUser = sysUserMapper.selectOneByExample(weekend2);
+            if (repairUser != null) {
+                vo.setRepairUserNameSecond(repairUser.getRealName());
+            }
+        }
+
+        List<String> deptIdList = new ArrayList<String>();
+        if (vo.getUseArea() != null) {
+            deptIdList.add(vo.getUseArea());
+        }
+        if (vo.getUseCompany() != null) {
+            deptIdList.add(vo.getUseCompany());
+        }
+        if (vo.getUseProject() != null) {
+            deptIdList.add(vo.getUseProject());
+        }
+        if (vo.getUseGroup() != null) {
+            deptIdList.add(vo.getUseGroup());
+        }
+        if (vo.getUseDept() != null) {
+            deptIdList.add(vo.getUseDept());
+        }
+        if (vo.getSaveDept() != null) {
+            deptIdList.add(vo.getSaveDept());
+        }
+        int num = deptIdList.size();
+        if (num > 0) {
+            Weekend<SysDept> weekend3 = new Weekend<>(SysDept.class);
+            weekend3.weekendCriteria().andIn(SysDept::getDeptId, deptIdList);
+            List<SysDept> deptList = deptMapper.selectByExample(weekend3);
+            if (vo.getUseArea() != null) {
+                deptList.forEach(sysDept -> {
+                    if (sysDept.getDeptId().equals(vo.getUseArea())) {
+                        vo.setUseAreaName(sysDept.getName());
+                        return;
+                    }
+                });
+            }
+            if (vo.getUseCompany() != null) {
+                deptList.forEach(sysDept -> {
+                    if (sysDept.getDeptId().equals(vo.getUseCompany())) {
+                        vo.setUseCompanyName(sysDept.getName());
+                        return;
+                    }
+                });
+            }
+            if (vo.getUseProject() != null) {
+                deptList.forEach(sysDept -> {
+                    if (sysDept.getDeptId().equals(vo.getUseProject())) {
+                        vo.setUseProjectName(sysDept.getName());
+                        return;
+                    }
+                });
+            }
+            if (vo.getUseDept() != null) {
+                deptList.forEach(sysDept -> {
+                    if (sysDept.getDeptId().equals(vo.getUseDept())) {
+                        vo.setUseDeptName(sysDept.getName());
+                        return;
+                    }
+                });
+            }
+            if (vo.getUseGroup() != null) {
+                deptList.forEach(sysDept -> {
+                    if (sysDept.getDeptId().equals(vo.getUseGroup())) {
+                        vo.setUseGroupName(sysDept.getName());
+                        return;
+                    }
+                });
+            }
+            if (vo.getSaveDept() != null) {
+                deptList.forEach(sysDept -> {
+                    if (sysDept.getDeptId().equals(vo.getSaveDept())) {
+                        vo.setSaveDeptName(sysDept.getName());
+                        return;
+                    }
+                });
+            }
+        }
+        // vo.setCurrentAuditUserName(activitiBusinessService.getCurrentAuditUserName(vo.getProcessInstanceId()));
+        return vo;
+    }
+
+    @Override
+    public int countByStatus(Integer... status) {
+        if (status == null || status.length == 0) {
+            return mapper.selectCount(new SbInfoMeasure());
+        }
+        List<Integer> statusList = ListUtils.newArrayList(status.length);
+        Collections.addAll(statusList, status);
+        Weekend<SbInfoMeasure> weekend = new Weekend<>(SbInfoMeasure.class);
+        WeekendCriteria<SbInfoMeasure, Object> weekendCriteria = weekend.weekendCriteria();
+        weekendCriteria.andIn(SbInfoMeasure::getStatus, statusList);
+        return mapper.selectCountByExample(weekend);
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public String importListByAdd(MultipartFile file) {
+        int addNum = 0;
+        List<String> modelError = new ArrayList<String>();
+        try {
+            List<SbInfoMeasureVO> items = CustomExcelImportUtil.importSbInfoMeasureList(file.getInputStream());
+            if (!CollectionUtils.isEmpty(items)) {
+                if (!CollectionUtils.isEmpty(items)) {
+                    List<SbInfoMeasure> itemsAdd = BeanConverterUtil.copyListProperties(items, SbInfoMeasure.class);
+                    mapper.insertListforComplex(itemsAdd);
+                }
+            }
+            return "总计新增导入:" + (items.size());
+        } catch (Exception e) {
+            throw new BusinessException(e.getMessage());
+        }
+    }
+
+    /**
+     * 全部参数修改
+     *
+     * @param file
+     * @return
+     */
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public String importListByUpdateALl(MultipartFile file) {
+
+        try {
+            List<SbInfoMeasureVO> items = CustomExcelImportUtil.importListByUpdateALlMeasure(file.getInputStream());
+            if (!CollectionUtils.isEmpty(items)) {
+                if (!CollectionUtils.isEmpty(items)) {
+                    LocalDateTime now = LocalDateTime.now();
+                    for (SbInfoMeasureVO item : items) {
+                        mapper.updateByPrimaryKeySelective(BeanConverterUtil.copyObjectProperties(item, SbInfoMeasure.class));
+                    }
+                }
+            }
+            return "总计更新:" + (items.size());
+        } catch (Exception e) {
+            throw new BusinessException(e.getMessage());
+        }
+    }
+
+    @Override
+    public AbstractPageResultBean<SbInfoMeasureVO> selectPageInfoForWarn(SbInfoMeasureDTO record, int pageNum, int pageSize) {
+        PageHelper.startPage(pageNum, pageSize);
+        record.setUseType(SbUseType.BGCL.getValue());
+        AbstractPageResultBean<SbInfoMeasureVO> pageInfo = new MyPage(mapper.selectPageInfoForWarn(record));
+        return pageInfo;
+    }
+
+}

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

@@ -826,7 +826,7 @@ public class SbInfoServiceImpl extends BaseServiceImpl<SbInfoMapper, SbInfo, SbI
             }
 
             // 自定义参数
-            if(StringUtils.isNotBlank(sbInfo.getParamList())){
+            if(StringUtils.isNotBlank(sbInfo.getParamList()) && sbInfo.getParamList() != ""){
                 JSONArray jsonArray = JSONArray.parseArray(sbInfo.getParamList());
                 StringBuffer sBuffer = new StringBuffer();
                 for(int i = 0; i < jsonArray.size(); i++) {

+ 8 - 6
platform-service/src/main/java/com/platform/service/sb/impl/SbMeasureLogServiceImpl.java

@@ -19,6 +19,7 @@ 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.SbInfoMeasure;
 import com.platform.dao.entity.sb.SbMeasureLog;
 import com.platform.dao.entity.upms.SysFile;
 import com.platform.dao.enums.CheckJobStatusEnum;
@@ -29,6 +30,7 @@ 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.SbInfoMeasureMapper;
 import com.platform.dao.mapper.sb.SbMeasureLogMapper;
 import com.platform.dao.mapper.upms.SysFileMapper;
 import com.platform.dao.vo.query.check.CheckStandardVO;
@@ -58,7 +60,7 @@ import java.util.List;
 @AllArgsConstructor
 @Service("sbMeasureLogService")
 public class SbMeasureLogServiceImpl extends BaseServiceImpl<SbMeasureLogMapper, SbMeasureLog, SbMeasureLogDTO> implements SbMeasureLogService {
-    private SbInfoMapper sbInfoMapper;
+    private SbInfoMeasureMapper sbInfoMeasureMapper;
     private final SysFileMapper sysFileMapper;
     @Override
     public boolean cascadingDeleteByKey(String id) {
@@ -96,7 +98,7 @@ public class SbMeasureLogServiceImpl extends BaseServiceImpl<SbMeasureLogMapper,
         SbMeasureLog sbMeasureLog = super.saveModelByDTO(model);
 
         // 更新设备下次检定日期
-        SbInfo sbInfo = sbInfoMapper.selectByPrimaryKey(model.getSbId());
+        SbInfoMeasure sbInfo = sbInfoMeasureMapper.selectByPrimaryKey(model.getSbId());
         sbInfo.setCheckDate(model.getLastDate());
         Integer checkPeriod = 12;// 默认12个月
         if(sbInfo.getCheckPeriod() != null){
@@ -110,7 +112,7 @@ public class SbMeasureLogServiceImpl extends BaseServiceImpl<SbMeasureLogMapper,
             sbInfo.setCardNo(model.getCardNo());
         }
         sbInfo.setNextCheckDate(model.getLastDate().minusMonths(-checkPeriod));
-        sbInfoMapper.updateByPrimaryKey(sbInfo);
+        sbInfoMeasureMapper.updateByPrimaryKey(sbInfo);
 
         // 保存文件
         this.saveFile(model);
@@ -128,7 +130,7 @@ public class SbMeasureLogServiceImpl extends BaseServiceImpl<SbMeasureLogMapper,
     public void modModelByDTO(SbMeasureLogDTO model) {
         super.modModelByDTO(model);
         // 更新设备下次检定日期
-        SbInfo sbInfo = sbInfoMapper.selectByPrimaryKeyForUpdate(model.getSbId());
+        SbInfoMeasure sbInfo = sbInfoMeasureMapper.selectByPrimaryKeyForUpdate(model.getSbId());
         sbInfo.setCheckDate(model.getLastDate());
 
         Integer checkPeriod = 12;// 默认12个月
@@ -143,7 +145,7 @@ public class SbMeasureLogServiceImpl extends BaseServiceImpl<SbMeasureLogMapper,
             sbInfo.setCardNo(model.getCardNo());
         }
         sbInfo.setNextCheckDate(model.getLastDate().minusDays(sbInfo.getCheckPeriod()));
-        sbInfoMapper.updateByPrimaryKey(sbInfo);
+        sbInfoMeasureMapper.updateByPrimaryKey(sbInfo);
 
         // 保存文件
         this.saveFile(model);
@@ -191,7 +193,7 @@ public class SbMeasureLogServiceImpl extends BaseServiceImpl<SbMeasureLogMapper,
         List<CheckStandardParam> paramList = paramMapper.selectByExample(weekend);
         checkStandard.setParamList(paramList);*/
 
-        SbInfo sbInfo = sbInfoMapper.selectByPrimaryKey(checkStandard.getSbId());
+        SbInfoMeasure sbInfo = sbInfoMeasureMapper.selectByPrimaryKey(checkStandard.getSbId());
         checkStandard.setSbNo(sbInfo.getNo());
         checkStandard.setSbModel(sbInfo.getModel());
         checkStandard.setSbName(sbInfo.getName());