xiongchao преди 3 години
родител
ревизия
d287ce9c22

+ 4 - 1
platform-dao/src/main/java/com/platform/dao/dto/sb/SbInfoDTO.java

@@ -39,11 +39,14 @@ public class SbInfoDTO extends BaseDTO implements Serializable {
      * 是否子设备:0 父设备,1 子设备
      */
     private Integer isChild;
-
     /**
      * 是否在大屏显示设备:0 不显示,1 显示
      */
     private Integer isShow;
+    /**
+     * 是否固定资产:0 否1 是
+     */
+    private Integer isFinancing;
     /**
      * 主键
      */

+ 29 - 1
platform-dao/src/main/java/com/platform/dao/dto/sb/SbMeasureLogDTO.java

@@ -33,7 +33,23 @@ public class SbMeasureLogDTO extends BaseDTO implements Serializable {
     /**
      * 设备id
      */
+    @Transient
     private String sbId;
+    /**
+     * 设备id
+     */
+    @Transient
+    private String sbNo;
+    /**
+     * 设备id
+     */
+    @Transient
+    private String sbName;
+    /**
+     * 设备id
+     */
+    @Transient
+    private String cardNo;
     /**
      * 被复制设备id
      */
@@ -48,6 +64,9 @@ public class SbMeasureLogDTO extends BaseDTO implements Serializable {
      * 编码
      */
     private String no;
+
+    @Transient
+    private Integer checkPeriod;
     /**
      * 点检人id
      */
@@ -61,7 +80,7 @@ public class SbMeasureLogDTO extends BaseDTO implements Serializable {
      */
     private Integer periodType;
     /**
-     * 上次实际执行日期
+     * 执行日期
      */
     private LocalDate lastDate;
     /**
@@ -168,4 +187,13 @@ public class SbMeasureLogDTO extends BaseDTO implements Serializable {
      */
     private List<SysFile> checkFileList;
 
+    /**
+     * 搜索开始日期
+     */
+    private LocalDate searchStartTime;
+
+    /**
+     * 搜索结束日期
+     */
+    private LocalDate searchEndTime;
 }

+ 4 - 0
platform-dao/src/main/java/com/platform/dao/entity/sb/SbInfo.java

@@ -192,6 +192,10 @@ public class SbInfo implements Serializable {
      * 是否在大屏显示设备:0 不显示,1 显示
      */
     private Integer isShow;
+    /**
+     * 是否固定资产:0 否1 是
+     */
+    private Integer isFinancing;
     /**
      * 计量单位
      */

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

@@ -4,6 +4,7 @@ import com.platform.common.bean.DataScope;
 import com.platform.dao.entity.check.CheckStandardParam;
 import com.platform.dao.entity.upms.SysFile;
 import lombok.Data;
+import org.springframework.cglib.core.Local;
 
 import javax.persistence.Id;
 import javax.persistence.Table;
@@ -148,4 +149,18 @@ public class SbMeasureLog implements Serializable {
      */
     private List<SysFile> checkFileList;
 
+    @Transient
+    private Integer checkPeriod;//检定周期(新增字段),以月为单位
+    @Transient
+    private String sbName;//
+    @Transient
+    private String sbModel;//
+    @Transient
+    private String sbNo;//
+    @Transient
+    private String cardNo;//
+    @Transient
+    private LocalDate checkDate;//
+    @Transient
+    private LocalDate nextCheckDate;//
 }

+ 27 - 0
platform-dao/src/main/java/com/platform/dao/enums/SbInfoFinancingEnum.java

@@ -0,0 +1,27 @@
+package com.platform.dao.enums;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+/**
+ * @Description 设备显示设备
+ * @Author liuyu
+ * @Date 2020/05/05
+ * @Version Copyright (c) 2019,安徽阡陌网络科技有限公司 All rights reserved.
+ */
+@Getter
+@AllArgsConstructor
+public enum SbInfoFinancingEnum {
+
+    /**
+     * 是
+     */
+    YES(1),
+    /**
+     * 否
+     */
+    NOT(0);
+
+    private final Integer value;
+
+}

+ 91 - 0
platform-dao/src/main/java/com/platform/dao/vo/export/sb/ExportSbInfoMeasureVO.java

@@ -0,0 +1,91 @@
+package com.platform.dao.vo.export.sb;
+
+import com.platform.office.annotation.Excel;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+import java.time.LocalDate;
+
+/**
+ * @Description 计量设备基础信息导出VO
+ * @Author liuyu
+ * @Date 2020-04-21 21:05:46
+ * @Version Copyright (c) 2019,北京乾元坤和科技有限公司 All rights reserved.
+ */
+@Data
+@Accessors(chain = true)
+public class ExportSbInfoMeasureVO implements Serializable {
+
+    /**
+     * 主键
+     */
+    @Excel(name = "主键", orderNum = "1")
+    private String id;
+    /**
+     * 主键
+     */
+    @Excel(name = "测量设备编号", orderNum = "2")
+    private String cardNo;
+    /**
+     * 设备编号
+     */
+    @Excel(name = "设备(新号)", orderNum = "3")
+    private String no;
+    /**
+     * 设备编号
+     */
+    @Excel(name = "出厂编号", orderNum = "4")
+    private String zzh;
+    /**
+     * 设备名称
+     */
+    @Excel(name = "测量设备名称", orderNum = "5")
+    private String name;
+    /**
+     * 设备名称
+     */
+    @Excel(name = "规格型号", orderNum = "6")
+    private String model;
+    /**
+     * 设备等级
+     */
+    @Excel(name = "准确度等级", orderNum = "7")
+    private String fdjxh;
+    /**
+     * 设备原值
+     */
+    @Excel(name = "使用部门", orderNum = "8")
+    private String saveUserName;
+    /**
+     * 设备类别
+     */
+    @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;
+    /**
+     * 生产商
+     */
+    @Excel(name = "生产商", orderNum = "13")
+    private String producerName;
+    /**
+     * 使用施工组名称
+     */
+    @Excel(name = "检定单位", orderNum = "14")
+    private String dph;
+
+}

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

@@ -32,6 +32,22 @@ public class SbMeasureLogVO extends BaseVO implements Serializable{
      * 设备id
      */
     private String sbId;
+    /**
+     * 设备名称
+     */
+    private String sbName;
+    /**
+     * 设备编号
+     */
+    private String sbNo;
+    /**
+     * 设备型号
+     */
+    private String sbModel;
+    /**
+     * 测量设备编号
+     */
+    private String cardNo;
     /**
      * 项目id
      */

+ 4 - 0
platform-dao/src/main/java/com/platform/dao/vo/sb/SbInfoVO.java

@@ -49,6 +49,10 @@ public class SbInfoVO extends BaseVO implements Serializable {
      * 是否在大屏显示设备:0 不显示,1 显示
      */
     private Integer isShow;
+    /**
+     * 是否固定资产:0 否1 是
+     */
+    private Integer isFinancing;
     /**
     * 卡片编号
      */

+ 17 - 1
platform-dao/src/main/resources/mapper/sb/SbInfoMapper.xml

@@ -11,6 +11,7 @@ sb.financing_no_five,
 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,
@@ -87,6 +88,7 @@ sb.financing_no,
 sb.name,  sb.initial_value,
         sb.current_value, sb.cut_value,
         sb.is_child,
+sb.is_financing,
         sb.parent_id,
         sb.is_show,
         sb.unit, sb.position_id,
@@ -164,7 +166,8 @@ sb.apply_time,
                                      sb.remark,
                                      sb.apply_comment,
 sb.scrap_user_id,
-sb.scrap_user_name
+sb.scrap_user_name,
+user.real_name as saveUserName
     </sql>
 
     <sql id="deptSql">
@@ -181,6 +184,7 @@ sb.scrap_user_name
         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
@@ -221,6 +225,9 @@ sb.scrap_user_name
         <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>
@@ -326,6 +333,9 @@ sb.scrap_user_name
         <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>
@@ -398,6 +408,7 @@ sb.scrap_user_name
         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
@@ -432,6 +443,9 @@ sb.scrap_user_name
         <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>
@@ -504,6 +518,7 @@ sb.scrap_user_name
         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.SbInfoVO">
@@ -513,6 +528,7 @@ sb.scrap_user_name
         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>
 

+ 18 - 1
platform-dao/src/main/resources/mapper/sb/SbMeasureLogMapper.xml

@@ -115,11 +115,28 @@
         <if test="keyword != null and keyword != ''">
             and checkstandard.name like concat('%',#{keyword},'%')
         </if>
+        <if test="searchStartTime != null">
+            and checkstandard.last_date <![CDATA[ >= ]]> #{searchStartTime}
+        </if>
+        <if test="searchEndTime != null">
+            and checkstandard.last_date <![CDATA[ <= ]]> #{searchEndTime}
+        </if>
+        <if test="keyword != null and keyword != ''">
+            and  (
+            sb.name like concat('%',#{keyword},'%')
+            or
+            sb.no like concat('%',#{keyword},'%')
+            or
+            sb.card_no like concat('%',#{keyword},'%')
+            )
+        </if>
     </sql>
     <select id="selectList" parameterType="com.platform.dao.dto.sb.SbMeasureLogDTO"
             resultType="com.platform.dao.vo.query.sb.SbMeasureLogVO">
-        select checkstandard.*
+        select checkstandard.*,
+               sb.name sbName, sb.model sbModel, sb.no sbNo, sb.card_no cardNo
         from t_sb_measure_log as checkstandard
+        LEFT JOIN t_sb_info sb on checkstandard.sb_id = sb.id
         <where>
             <include refid="List_Condition"/>
         </where>

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

@@ -11,6 +11,7 @@ import com.platform.dao.dto.sb.SbInfoDTO;
 import com.platform.dao.entity.sb.SbInfo;
 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.SbInfoVO;
 import com.platform.office.poi.excel.ExcelImportUtil;
@@ -308,6 +309,20 @@ public class SbInfoController {
         ExcelUtil.exportResponseDict(response, ExportSbInfoVO.class, BeanConverterUtil.copyListProperties(list, ExportSbInfoVO.class), "设备基础信息");
     }
 
+    /**
+     * 计量设备基础信息导出
+     *
+     * @param sbInfoDTO 设备基础信息DTO
+     * @return R
+     */
+    @GetMapping("/export/measure")
+    @SysLog("设备基础信息导出")
+    @PreAuthorize("@pms.hasPermission('sb-infos-export')")
+    public void exportMeasure(HttpServletResponse response, SbInfoDTO sbInfoDTO) {
+        List<SbInfoVO> list = sbInfoService.selectExportVOList(sbInfoDTO);
+        ExcelUtil.exportResponseDict(response, ExportSbInfoMeasureVO.class, BeanConverterUtil.copyListProperties(list, ExportSbInfoMeasureVO.class), "计量设备基础信息");
+    }
+
     /**
      * 获取设备树,有主子结构的设备
      *

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

@@ -68,7 +68,7 @@ public class SbMeasureLogController {
    */
   @SysLog("修改设备计量记录")
   @PutMapping("/{id}")
-  @PreAuthorize("@pms.hasPermission('check-spot-standards-edit')")
+  @PreAuthorize("@pms.hasPermission('measure-log-edit')")
   public R update(@PathVariable("id") String id, @Validated({UpdateGroup.class}) @RequestBody SbMeasureLogDTO checkStandardDTO) {
       checkStandardService.modModelByDTO(checkStandardDTO);
       return new R<>();
@@ -132,7 +132,7 @@ public class SbMeasureLogController {
      */
   @GetMapping("/export")
   @SysLog("设备计量记录导出")
-  @PreAuthorize("@pms.hasPermission('check-spot-standards-export') or @pms.hasPermission('check-polling-standards-export')")
+  @PreAuthorize("@pms.hasPermission('measure-log-export') or @pms.hasPermission('check-polling-standards-export')")
   public void export(HttpServletResponse response, SbMeasureLogDTO checkStandardDTO) {
     List<SbMeasureLog> list = checkStandardService.getModelListByDTO(checkStandardDTO);
     ExcelUtil.exportResponseDict(response, ExportSbMeasureLogVO.class, BeanConverterUtil.copyListProperties(list, ExportSbMeasureLogVO.class), "设备计量记录");

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

@@ -339,6 +339,9 @@ public class SbInfoServiceImpl extends BaseServiceImpl<SbInfoMapper, SbInfo, SbI
         if (model.getIsShow()==null) {
             model.setIsChild(SbInfoShowEnum.NOT_SHOW.getValue());
         }
+        if (model.getIsFinancing()==null) {
+            model.setIsFinancing(SbInfoFinancingEnum.NOT.getValue());
+        }
         // 保存二维码
         String path = CommonConstants.RESOURCE_PREFIX + "/png/" + DateUtil.formatDate(new Date()) + "/" + IdGeneratorUtils.getObjectId() + "/";
         String rootPath = environment.getProperty("upload.root-dir");
@@ -463,6 +466,9 @@ public class SbInfoServiceImpl extends BaseServiceImpl<SbInfoMapper, SbInfo, SbI
         if (model.getIsShow()==null) {
             model.setIsChild(SbInfoShowEnum.NOT_SHOW.getValue());
         }
+        if (model.getIsFinancing()==null) {
+            model.setIsFinancing(SbInfoFinancingEnum.NOT.getValue());
+        }
         this.saveFile(model);
         setSaveDept(model);
         setSbStatusLogAndStopLog(model);

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

@@ -98,10 +98,14 @@ public class SbMeasureLogServiceImpl extends BaseServiceImpl<SbMeasureLogMapper,
         // 更新设备下次检定日期
         SbInfo sbInfo = sbInfoMapper.selectByPrimaryKey(model.getSbId());
         sbInfo.setCheckDate(model.getLastDate());
-        Integer checkPeriod = 45;
+        Integer checkPeriod = 12;// 默认12个月
         if(sbInfo.getCheckPeriod() != null){
             checkPeriod = sbInfo.getCheckPeriod();
         }
+        if(model.getCheckPeriod() != null){
+            checkPeriod = model.getCheckPeriod();
+            sbInfo.setCheckPeriod(model.getCheckPeriod());
+        }
         sbInfo.setNextCheckDate(model.getLastDate().minusMonths(-checkPeriod));
         sbInfoMapper.updateByPrimaryKey(sbInfo);
 
@@ -172,6 +176,14 @@ public class SbMeasureLogServiceImpl extends BaseServiceImpl<SbMeasureLogMapper,
         List<CheckStandardParam> paramList = paramMapper.selectByExample(weekend);
         checkStandard.setParamList(paramList);*/
 
+        SbInfo sbInfo = sbInfoMapper.selectByPrimaryKey(checkStandard.getSbId());
+        checkStandard.setSbNo(sbInfo.getNo());
+        checkStandard.setSbModel(sbInfo.getModel());
+        checkStandard.setSbName(sbInfo.getName());
+        checkStandard.setCheckPeriod(sbInfo.getCheckPeriod());
+        checkStandard.setCheckDate(sbInfo.getCheckDate());
+        checkStandard.setNextCheckDate(sbInfo.getNextCheckDate());
+
         Weekend<SysFile> weekendFile = new Weekend<>(SysFile.class);
         weekendFile.weekendCriteria().andEqualTo(SysFile::getTargetId, checkStandard.getId());
         List<SysFile> sysFiles = sysFileMapper.selectByExample(weekendFile);