瀏覽代碼

[chg]新增电梯修改结构

别傲 5 年之前
父節點
當前提交
52888882a4

+ 21 - 0
lift-business-service/src/main/java/cn/com/ty/lift/business/library/dao/entity/Lift.java

@@ -234,4 +234,25 @@ public class Lift {
      * 显示楼层
      */
     private Byte innerFloor;
+
+    /**
+     * 年检日期
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    private Date annualInspectionDate;
+
+    /**
+     * 行政区划代码
+     */
+    private String areaCode;
+
+    /**
+     * 设备ID
+     */
+    private String deviceId;
+
+    /**
+     * 设备类型
+     */
+    private String deviceType;
 }

+ 18 - 0
lift-business-service/src/main/java/cn/com/ty/lift/business/library/dao/entity/ProjectLiftRelevance.java

@@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableId;
 import lombok.Data;
 
+import java.util.Date;
+
 /**
  * 实体类 - 表:project_lift_relevance
  *
@@ -52,4 +54,20 @@ public class ProjectLiftRelevance {
      * 是否删除 0否 1是
      */
     private Byte deleteFlag;
+    /**
+     * 首保时间
+     */
+    private Date firstTime;
+    /**
+     * 停保日期
+     */
+    private Date outServiceDate;
+    /**
+     * 临时停梯时间
+     */
+    private Date stopDate;
+    /**
+     * 维保间隔
+     */
+    private Integer planInterval;
 }

+ 5 - 6
lift-business-service/src/main/java/cn/com/ty/lift/business/library/dao/entity/model/LiftExtensionRequest.java

@@ -3,8 +3,6 @@ package cn.com.ty.lift.business.library.dao.entity.model;
 import cn.com.ty.lift.business.library.dao.entity.Lift;
 import lombok.Data;
 
-import java.time.LocalDate;
-
 /**
  * @author bieao
  * @date 2019/12/3
@@ -12,15 +10,16 @@ import java.time.LocalDate;
  */
 @Data
 public class LiftExtensionRequest {
+
     /**
-     * 年检日期
+     * 维保工
      */
-    private LocalDate annualInspectionDate;
+    private Long workerId;
 
     /**
-     * 电梯维保负责人
+     * 项目id
      */
-    private Long workerId;
+    private Long projectId;
 
     /**
      * 新增电梯来源入口 (0:从电梯管理新增,1:从项目管理中新增)

+ 9 - 36
lift-business-service/src/main/java/cn/com/ty/lift/business/library/service/LiftService.java

@@ -2,23 +2,21 @@ package cn.com.ty.lift.business.library.service;
 
 import cn.com.ty.lift.business.framework.util.MessageUtils;
 import cn.com.ty.lift.business.library.dao.entity.Lift;
-import cn.com.ty.lift.business.library.dao.entity.LiftExtension;
 import cn.com.ty.lift.business.library.dao.entity.PlatformCompanyLiftRelevance;
 import cn.com.ty.lift.business.library.dao.entity.model.LiftExtensionRequest;
 import cn.com.ty.lift.business.library.dao.entity.model.LiftRequest;
 import cn.com.ty.lift.business.library.dao.entity.model.LiftResponse;
-import cn.com.ty.lift.business.library.dao.mapper.LiftExtensionMapper;
 import cn.com.ty.lift.business.library.dao.mapper.LiftMapper;
 import cn.com.ty.lift.business.maintenance.dao.entity.MaintenanceCompany;
 import cn.com.ty.lift.business.maintenance.service.MaintenanceService;
 import cn.com.ty.lift.common.base.ExportRequest;
 import cn.com.ty.lift.common.constants.ApiConstants;
+import cn.com.ty.lift.common.constants.CommonEnum;
 import cn.com.ty.lift.common.export.ExportUtils;
 import cn.com.ty.lift.common.utils.DateUtils;
 import cn.com.xwy.boot.web.dto.RestResponse;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import org.springframework.data.redis.core.RedisTemplate;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
@@ -36,9 +34,6 @@ public class LiftService {
     @Resource
     private LiftMapper liftMapper;
 
-    @Resource
-    private LiftExtensionMapper liftExtensionMapper;
-
     @Resource
     private PlatformCompanyLiftRelevanceService platformService;
 
@@ -48,9 +43,6 @@ public class LiftService {
     @Resource
     private MaintenanceService maintenanceService;
 
-    @Resource
-    private RedisTemplate redisTemplate;
-
     private Map<String, String> paramMap = new HashMap<String, String>() {{
         put("liftCode", "电梯号");
         put("registrationCode", "注册代码");
@@ -91,22 +83,6 @@ public class LiftService {
         return liftMapper.selectById(id);
     }
 
-    /**
-     * @param request 电梯
-     * @return 电梯扩展实体
-     * @description 初始化电梯扩展实体
-     * @date 2019/12/3 3:25 PM
-     */
-    private LiftExtension init(LiftExtensionRequest request) {
-        Long id = request.getLift().getId();
-        Date annualInspectionDate = DateUtils.localDate2Date(request.getAnnualInspectionDate());
-        LiftExtension extension = new LiftExtension();
-        extension.setId(id);
-        extension.setAnnualInspectionDate(annualInspectionDate);
-        extension.setMtCompanyId(request.getMtCompanyId());
-        return extension;
-    }
-
     /**
      * @param mtCompanyId 维保公司id
      * @return 比较结果
@@ -135,25 +111,22 @@ public class LiftService {
         Lift lift = request.getLift();
         //按当前日期时间戳自动生成电梯编号
         String liftCode = DateUtils.generateCode();
-        lift.setLiftCode("DT" + liftCode);
+        if (CommonEnum.LiftType.STRAIGHT_LADDER.getCode().equals(Objects.toString(lift.getLiftType()))) {
+            lift.setLiftCode("ZT" + liftCode);
+        } else {
+            lift.setLiftCode("FT" + liftCode);
+        }
         int liftResult = liftMapper.insert(lift);
         if (liftResult == 0) {
             return RestResponse.error(ApiConstants.RESULT_ERROR, MessageUtils.get("msg.add.fail"));
         }
-        //初始化电梯扩展实体
-        LiftExtension extension = init(request);
-        //新增电梯扩展表
-        int extensionResult = liftExtensionMapper.insert(extension);
-        if (extensionResult == 0) {
-            return RestResponse.error(ApiConstants.RESULT_ERROR, MessageUtils.get("msg.add.fail"));
-        }
         //新增电梯来源
         String source = request.getSource();
         switch (source) {
             //电梯管理入口
             case "0":
                 //新增平台企业电梯关联表
-                PlatformCompanyLiftRelevance ret = platformService.save(extension);
+                PlatformCompanyLiftRelevance ret = platformService.save(request);
                 if (ret == null) {
                     return RestResponse.error(ApiConstants.RESULT_ERROR, MessageUtils.get("msg.add.fail"));
                 }
@@ -161,12 +134,12 @@ public class LiftService {
             //项目管理入口
             case "1":
                 //新增平台企业电梯关联表
-                PlatformCompanyLiftRelevance companyLiftEntry = platformService.save(extension);
+                PlatformCompanyLiftRelevance companyLiftEntry = platformService.save(request);
                 if (companyLiftEntry == null) {
                     return RestResponse.error(ApiConstants.RESULT_ERROR, MessageUtils.get("msg.add.fail"));
                 }
                 //新增项目电梯关联表
-                boolean result = projectRelevanceService.save(extension, companyLiftEntry.getId(), request.getWorkerId());
+                boolean result = projectRelevanceService.save(request, companyLiftEntry.getId(), request.getWorkerId());
                 if (!result) {
                     return RestResponse.error(ApiConstants.RESULT_ERROR, MessageUtils.get("msg.add.fail"));
                 }

+ 7 - 5
lift-business-service/src/main/java/cn/com/ty/lift/business/library/service/PlatformCompanyLiftRelevanceService.java

@@ -1,8 +1,9 @@
 package cn.com.ty.lift.business.library.service;
 
 import cn.com.ty.lift.business.framework.util.MessageUtils;
-import cn.com.ty.lift.business.library.dao.entity.LiftExtension;
+import cn.com.ty.lift.business.library.dao.entity.Lift;
 import cn.com.ty.lift.business.library.dao.entity.PlatformCompanyLiftRelevance;
+import cn.com.ty.lift.business.library.dao.entity.model.LiftExtensionRequest;
 import cn.com.ty.lift.business.library.dao.entity.model.SelectBatchPlatformCompanyRequest;
 import cn.com.ty.lift.business.library.dao.entity.model.UpdateBatchPlatformCompanyRequest;
 import cn.com.ty.lift.business.library.dao.mapper.PlatformCompanyLiftRelevanceMapper;
@@ -35,15 +36,16 @@ public class PlatformCompanyLiftRelevanceService extends ServiceImpl<PlatformCom
     private LiftService liftService;
 
     /**
-     * @param extension
+     * @param request
      * @return PlatformCompanyLiftRelevance
      * @description 新增平台企业关联表数据
      * @date 2019/12/5 2:38 PM
      */
-    public PlatformCompanyLiftRelevance save(LiftExtension extension) {
+    public PlatformCompanyLiftRelevance save(LiftExtensionRequest request) {
         PlatformCompanyLiftRelevance companyLiftEntry = new PlatformCompanyLiftRelevance();
-        companyLiftEntry.setLiftId(extension.getId());
-        companyLiftEntry.setCompanyId(extension.getMtCompanyId());
+        Lift lift = request.getLift();
+        companyLiftEntry.setLiftId(lift.getId());
+        companyLiftEntry.setCompanyId(request.getMtCompanyId());
         if (save(companyLiftEntry)) {
             return companyLiftEntry;
         }

+ 8 - 5
lift-business-service/src/main/java/cn/com/ty/lift/business/library/service/ProjectLiftRelevanceService.java

@@ -1,9 +1,10 @@
 package cn.com.ty.lift.business.library.service;
 
 import cn.com.ty.lift.business.framework.util.MessageUtils;
-import cn.com.ty.lift.business.library.dao.entity.LiftExtension;
+import cn.com.ty.lift.business.library.dao.entity.Lift;
 import cn.com.ty.lift.business.library.dao.entity.ProjectLiftRelevance;
 import cn.com.ty.lift.business.library.dao.entity.model.BatchUpdateLiftRequest;
+import cn.com.ty.lift.business.library.dao.entity.model.LiftExtensionRequest;
 import cn.com.ty.lift.business.library.dao.mapper.ProjectLiftRelevanceMapper;
 import cn.com.ty.lift.common.constants.ApiConstants;
 import cn.com.xwy.boot.web.dto.RestResponse;
@@ -34,20 +35,22 @@ public class ProjectLiftRelevanceService extends ServiceImpl<ProjectLiftRelevanc
     }
 
     /**
-     * @param extension 电梯扩展
+     * @param request 电梯扩展请求
      * @param id        平台企业电梯主键id
      * @param workerId  维保工id
      * @return projectLiftEntry
      * @description 新增项目电梯关联数据
      * @date 2019/12/5 2:39 PM
      */
-    public boolean save(LiftExtension extension, long id, long workerId) {
+    public boolean save(LiftExtensionRequest request, long id, long workerId) {
+        Lift lift = request.getLift();
         //新增项目电梯关联表
         ProjectLiftRelevance projectLiftEntry = new ProjectLiftRelevance();
-        projectLiftEntry.setProjectId(extension.getProjectId());
-        projectLiftEntry.setLiftId(extension.getId());
+        projectLiftEntry.setProjectId(request.getProjectId());
+        projectLiftEntry.setLiftId(lift.getId());
         projectLiftEntry.setRelevanceId(id);
         projectLiftEntry.setWorkerId(workerId);
+        projectLiftEntry.setCompanyId(request.getMtCompanyId());
         return save(projectLiftEntry);
     }
 

+ 69 - 0
lift-common/src/main/java/cn.com.ty.lift.common/constants/CommonEnum.java

@@ -2,6 +2,75 @@ package cn.com.ty.lift.common.constants;
 
 public class CommonEnum {
 
+    /**
+     * 电梯类型
+     */
+    public enum LiftType implements IEnum {
+
+        STRAIGHT_LADDER("直梯", "1"),
+        STAIRCASE("扶梯", "2");
+        /**
+         * 值
+         */
+        private String label;
+
+        /**
+         * 键
+         */
+        private String code;
+
+        /**
+         * 构造函数
+         *
+         * @param label String
+         * @param code  String
+         */
+        LiftType(String label, String code) {
+            this.label = label;
+            this.code = code;
+        }
+
+        /**
+         * 取得枚举区分
+         *
+         * @return String
+         */
+        @Override
+        public String getEnumName() {
+            return "LiftType";
+        }
+
+        /**
+         * get
+         *
+         * @return String
+         */
+        @Override
+        public String getLabel() {
+            return label;
+        }
+
+        /**
+         * set
+         *
+         * @return String
+         */
+        @Override
+        public String getCode() {
+            return code;
+        }
+
+        /**
+         * String转换,中间加横杠
+         *
+         * @return String
+         */
+        @Override
+        public String toString() {
+            return this.label;
+        }
+    }
+
     /**
      * 电梯状态
      */