Quellcode durchsuchen

Merge branch 'develop' of http://132.232.206.88:3000/lift-manager/lift-server into feature-wcz

wcz vor 5 Jahren
Ursprung
Commit
330dd15314
14 geänderte Dateien mit 122 neuen und 30 gelöschten Zeilen
  1. 5 8
      lift-business-service/src/main/java/cn/com/ty/lift/business/contract/controller/ContractController.java
  2. 0 2
      lift-business-service/src/main/java/cn/com/ty/lift/business/contract/dao/entity/ContractsExtend.java
  3. 5 0
      lift-business-service/src/main/java/cn/com/ty/lift/business/contract/dao/entity/model/ContractResponse.java
  4. 2 1
      lift-business-service/src/main/java/cn/com/ty/lift/business/contract/dao/mapper/ContractsMapper.java
  5. 13 6
      lift-business-service/src/main/java/cn/com/ty/lift/business/contract/service/ContractService.java
  6. 2 2
      lift-business-service/src/main/java/cn/com/ty/lift/business/contract/service/PaymentService.java
  7. 1 6
      lift-business-service/src/main/java/cn/com/ty/lift/business/maintenance/dao/entity/MaintenanceRecord.java
  8. 6 0
      lift-business-service/src/main/java/cn/com/ty/lift/business/maintenance/service/MaintenancePlanService.java
  9. 25 4
      lift-business-service/src/main/java/cn/com/ty/lift/business/maintenance/service/MaintenanceRecordService.java
  10. 0 1
      lift-business-service/src/main/java/cn/com/ty/lift/business/project/dao/entity/model/request/ProjectRequest.java
  11. 5 0
      lift-business-service/src/main/java/cn/com/ty/lift/business/project/dao/entity/model/response/ProjectResponse.java
  12. 10 0
      lift-business-service/src/main/java/cn/com/ty/lift/business/project/service/ProjectService.java
  13. 1 0
      lift-business-service/src/main/resources/mapper/project/ProjectMapper.xml
  14. 47 0
      lift-common/src/main/java/cn.com.ty.lift.common/constants/CommonEnum.java

+ 5 - 8
lift-business-service/src/main/java/cn/com/ty/lift/business/contract/controller/ContractController.java

@@ -3,10 +3,7 @@ package cn.com.ty.lift.business.contract.controller;
 import cn.com.ty.lift.business.contract.dao.entity.Contracts;
 import cn.com.ty.lift.business.contract.dao.entity.ContractsExtend;
 import cn.com.ty.lift.business.contract.dao.entity.ContractsHistory;
-import cn.com.ty.lift.business.contract.dao.entity.model.ContractDetailRequest;
-import cn.com.ty.lift.business.contract.dao.entity.model.ContractRequest;
-import cn.com.ty.lift.business.contract.dao.entity.model.ContractsHistoryRequest;
-import cn.com.ty.lift.business.contract.dao.entity.model.PaymentRequest;
+import cn.com.ty.lift.business.contract.dao.entity.model.*;
 import cn.com.ty.lift.business.contract.service.ContractService;
 import cn.com.ty.lift.business.contract.service.PaymentService;
 import cn.com.ty.lift.business.framework.util.MessageUtils;
@@ -44,7 +41,7 @@ public class ContractController {
      */
     @PostMapping("list")
     public RestResponse list(@Valid @RequestBody ContractRequest request) {
-        IPage<Contracts> page = contractService.list(request);
+        IPage<ContractResponse> page = contractService.list(request);
         if (CollUtil.isEmpty(page.getRecords())) {
             return RestResponse.success();
         }
@@ -68,13 +65,13 @@ public class ContractController {
 
 
     /**
-     * @param contracts 新增/续签合同数据项
+     * @param contracts 新增合同数据项
      * @return 1.成功, 0.失败, 消息描述
-     * @description 新增/续签合同
+     * @description 新增合同
      * @date 2019/12/7 3:31 PM
      */
     @PostMapping("add")
-    public RestResponse add(@Valid @RequestBody ContractsExtend contracts) {
+    public RestResponse add(@RequestBody ContractsExtend contracts) {
         return contractService.add(contracts);
     }
 

+ 0 - 2
lift-business-service/src/main/java/cn/com/ty/lift/business/contract/dao/entity/ContractsExtend.java

@@ -16,13 +16,11 @@ public class ContractsExtend {
     /**
      * 收款列表
      */
-    @NotEmpty(message = "notEmpty")
     private List<Payment> paymentList;
 
     /**
      * 合同信息
      */
-    @NotNull(message = "notEmpty")
     private Contracts contracts;
 
     /**

+ 5 - 0
lift-business-service/src/main/java/cn/com/ty/lift/business/contract/dao/entity/model/ContractResponse.java

@@ -65,4 +65,9 @@ public class ContractResponse {
      * 签约合同编号
      */
     private String nextId;
+
+    /**
+     * 项目名称
+     */
+    private String projectName;
 }

+ 2 - 1
lift-business-service/src/main/java/cn/com/ty/lift/business/contract/dao/mapper/ContractsMapper.java

@@ -2,6 +2,7 @@ package cn.com.ty.lift.business.contract.dao.mapper;
 
 import cn.com.ty.lift.business.contract.dao.entity.Contracts;
 import cn.com.ty.lift.business.contract.dao.entity.model.ContractRequest;
+import cn.com.ty.lift.business.contract.dao.entity.model.ContractResponse;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import org.apache.ibatis.annotations.Param;
@@ -13,7 +14,7 @@ import org.apache.ibatis.annotations.Param;
  */
 public interface ContractsMapper extends BaseMapper<Contracts> {
 
-    IPage<Contracts> findByCondition(IPage<Contracts> page, @Param("request") ContractRequest request);
+    IPage<ContractResponse> findByCondition(IPage<ContractResponse> page, @Param("request") ContractRequest request);
 
 
 }

+ 13 - 6
lift-business-service/src/main/java/cn/com/ty/lift/business/contract/service/ContractService.java

@@ -3,7 +3,9 @@ package cn.com.ty.lift.business.contract.service;
 import cn.com.ty.lift.business.contract.dao.entity.Contracts;
 import cn.com.ty.lift.business.contract.dao.entity.ContractsExtend;
 import cn.com.ty.lift.business.contract.dao.entity.ContractsHistory;
+import cn.com.ty.lift.business.contract.dao.entity.Payment;
 import cn.com.ty.lift.business.contract.dao.entity.model.ContractRequest;
+import cn.com.ty.lift.business.contract.dao.entity.model.ContractResponse;
 import cn.com.ty.lift.business.contract.dao.entity.model.ContractsHistoryRequest;
 import cn.com.ty.lift.business.contract.dao.mapper.ContractsMapper;
 import cn.com.ty.lift.business.framework.util.MessageUtils;
@@ -24,6 +26,7 @@ import org.springframework.transaction.annotation.Transactional;
 import org.springframework.transaction.interceptor.TransactionAspectSupport;
 
 import javax.annotation.Resource;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
@@ -54,8 +57,8 @@ public class ContractService extends ServiceImpl<ContractsMapper, Contracts> {
      * @description 查询合同列表
      * @date 2019/12/7 11:53 AM
      */
-    public IPage<Contracts> list(ContractRequest request) {
-        IPage<Contracts> page = new Page<>(request.getPageNum(), request.getPageSize());
+    public IPage<ContractResponse> list(ContractRequest request) {
+        IPage<ContractResponse> page = new Page<>(request.getPageNum(), request.getPageSize());
         if (ObjectUtil.isNotEmpty(request.getContractId())) {
             request.setContractId(StrUtil.format("%{}%", request.getContractId()));
         }
@@ -164,9 +167,13 @@ public class ContractService extends ServiceImpl<ContractsMapper, Contracts> {
     public Map<String, Object> detail(Long id) {
         QueryWrapper<Contracts> queryWrapper = new QueryWrapper<>();
         queryWrapper.eq("id", id);
-        Map<String, Object> contractMap = getMap(queryWrapper);
-        List<Map<String, Object>> paymentMap = paymentService.paymentList(id);
-        contractMap.put("paymentList", paymentMap);
-        return contractMap;
+        Contracts contracts = getOne(queryWrapper);
+        List<Payment> paymentMap = paymentService.paymentList(id);
+        Map<String, Object> resultMap = new HashMap<>();
+        resultMap.put("contract", contracts);
+        resultMap.put("paymentList", paymentMap);
+        Project project = projectService.getOne(contracts.getProjectId());
+        resultMap.put("project", project);
+        return resultMap;
     }
 }

+ 2 - 2
lift-business-service/src/main/java/cn/com/ty/lift/business/contract/service/PaymentService.java

@@ -47,9 +47,9 @@ public class PaymentService extends ServiceImpl<PaymentMapper, Payment> {
      * @description 查询付款列表
      * @date 2020/1/17 2:57 下午
      */
-    public List<Map<String, Object>> paymentList(Long contractId) {
+    public List<Payment> paymentList(Long contractId) {
         QueryWrapper<Payment> queryWrapper = new QueryWrapper<>();
         queryWrapper.eq("contracts_id", contractId);
-        return listMaps(queryWrapper);
+        return list(queryWrapper);
     }
 }

+ 1 - 6
lift-business-service/src/main/java/cn/com/ty/lift/business/maintenance/dao/entity/MaintenanceRecord.java

@@ -116,15 +116,10 @@ public class MaintenanceRecord extends BaseEntity {
 	 */
 	private String position;
 
-    /**
-     * 签到时间
-     */
-	private LocalDateTime signDate;
-
 	/**
 	 * 状态 1:已签到,未完成保养,2:完成保养,未选择评价方式,3:待评价,4:完成。
 	 */
-	private Integer status;
+	private String status;
 
 	/**
 	 * 是否正常 0:正常 1:提前 2:延期

+ 6 - 0
lift-business-service/src/main/java/cn/com/ty/lift/business/maintenance/service/MaintenancePlanService.java

@@ -108,6 +108,12 @@ public class MaintenancePlanService extends ServiceImpl<MaintenancePlanMapper, M
         return true;
     }
 
+    public MaintenancePlan getOne(Long id) {
+        LambdaQueryWrapper<MaintenancePlan> lambdaQueryWrapper = new QueryWrapper<MaintenancePlan>().lambda();
+        lambdaQueryWrapper.eq(MaintenancePlan::getId, id);
+        return Optional.ofNullable(getOne(lambdaQueryWrapper)).orElse(null);
+    }
+
     /**
      * @param request 电梯列表
      * @return 是否成功

+ 25 - 4
lift-business-service/src/main/java/cn/com/ty/lift/business/maintenance/service/MaintenanceRecordService.java

@@ -3,6 +3,7 @@ package cn.com.ty.lift.business.maintenance.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.service.LiftService;
+import cn.com.ty.lift.business.maintenance.dao.entity.MaintenancePlan;
 import cn.com.ty.lift.business.maintenance.dao.entity.MaintenanceRecord;
 import cn.com.ty.lift.business.maintenance.dao.entity.MtRecordCost;
 import cn.com.ty.lift.business.maintenance.dao.entity.MtRecordImg;
@@ -12,9 +13,11 @@ import cn.com.ty.lift.business.maintenance.dao.entity.model.request.MtRecordRequ
 import cn.com.ty.lift.business.maintenance.dao.entity.model.response.MaintenanceRecordResponse;
 import cn.com.ty.lift.business.maintenance.dao.entity.model.response.MtRecordResponse;
 import cn.com.ty.lift.business.maintenance.dao.mapper.MaintenanceRecordMapper;
+import cn.com.ty.lift.common.constants.CommonEnum;
 import cn.com.ty.lift.common.utils.MapHelper;
 import cn.com.xwy.boot.web.dto.RestResponse;
 import cn.hutool.core.collection.IterUtil;
+import cn.hutool.core.util.ObjectUtil;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -23,6 +26,7 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.transaction.interceptor.TransactionAspectSupport;
 
+import java.time.LocalDateTime;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Optional;
@@ -41,6 +45,8 @@ public class MaintenanceRecordService extends ServiceImpl<MaintenanceRecordMappe
     private MtRecordCostService mtRecordCostService;
     private MtRecordImgService mtRecordImgService;
 
+    private MaintenancePlanService maintenancePlanService;
+
     /**
      * @param request 公司id和电梯id
      * @return RestResponse 保养信息
@@ -86,10 +92,23 @@ public class MaintenanceRecordService extends ServiceImpl<MaintenanceRecordMappe
         MaintenanceRecord record = request.getRecord();
         boolean result = calc(record.getLiftId(), request.getCoordinate());
         if (result) return RestResponse.fail(MessageUtils.get("msg.error.person.scope"));
-        boolean ret = save(record);
-        if (!ret) {
-            return RestResponse.fail(MessageUtils.get("msg.add.fail"));
-        }
+        Long liftId = record.getLiftId();
+        Optional<Lift> lift = liftService.getOne(null, liftId);
+        if (lift.isPresent()) {
+            Lift l = lift.get();
+            record.setCode(l.getLiftCode());
+            record.setLiftType(l.getLiftType());
+            record.setStatus(CommonEnum.MaintenanceRecordStatus.SIGN.getCode());
+            record.setWorkDate(LocalDateTime.now());
+            record.setStopDate(LocalDateTime.now());
+            MaintenancePlan plan = maintenancePlanService.getOne(record.getMtPlanId());
+            if (ObjectUtil.isEmpty(plan)) return RestResponse.fail(MessageUtils.get("msg.add.fail"));
+            record.setPlanDate(plan.getPlanDate());
+            boolean ret = save(record);
+            if (!ret) {
+                return RestResponse.fail(MessageUtils.get("msg.add.fail"));
+            }
+        } else return RestResponse.fail(MessageUtils.get("msg.add.fail"));
         return RestResponse.success(record.getId(), MessageUtils.get("msg.add.success"));
     }
 
@@ -100,6 +119,8 @@ public class MaintenanceRecordService extends ServiceImpl<MaintenanceRecordMappe
      * @date 2020/1/13 2:31 下午
      */
     public boolean modify(MaintenanceRecord record){
+        record.setRecoveryDate(LocalDateTime.now());
+        record.setStatus(CommonEnum.MaintenanceRecordStatus.EVALUATE.getCode());
         return updateById(record);
     }
 

+ 0 - 1
lift-business-service/src/main/java/cn/com/ty/lift/business/project/dao/entity/model/request/ProjectRequest.java

@@ -42,7 +42,6 @@ public class ProjectRequest extends BaseRequestModel {
     /**
      * 项目状态
      */
-    @NotNull(message = "notEmpty")
     private String projectStatus;
 
     /**

+ 5 - 0
lift-business-service/src/main/java/cn/com/ty/lift/business/project/dao/entity/model/response/ProjectResponse.java

@@ -104,4 +104,9 @@ public class ProjectResponse {
      * 是否锁定
      */
     private Integer locked;
+
+    /**
+     * 项目状态
+     */
+    private String projectStatus;
 }

+ 10 - 0
lift-business-service/src/main/java/cn/com/ty/lift/business/project/service/ProjectService.java

@@ -111,10 +111,20 @@ public class ProjectService extends ServiceImpl<ProjectMapper,Project> {
      * @date 2020/1/19 11:30 上午
      */
     public Map<String, Object> countAll(Long mtCompanyId, String projectStatus) {
+        LambdaQueryWrapper<Project> lambdaQueryWrapper = new QueryWrapper<Project>().lambda();
+        lambdaQueryWrapper.eq(Project::getMtCompanyId, mtCompanyId);
+        List<Project> projects = list(lambdaQueryWrapper);
+        Map<String, Long> collect = projects.stream().collect(Collectors.groupingBy(Project::getProjectStatus, Collectors.counting()));
+        Map<String, Integer> totalMap = new HashMap<>();
+        totalMap.put("notStart", collect.get(CommonEnum.ProjectStatus.NOT_START.getCode()).intValue());
+        totalMap.put("inService", collect.get(CommonEnum.ProjectStatus.IN_SERVICE.getCode()).intValue());
+        totalMap.put("stopService", collect.get(CommonEnum.ProjectStatus.STOP_SERVICE.getCode()).intValue());
+        totalMap.put("overdue", collect.get(CommonEnum.ProjectStatus.OVERDUE.getCode()).intValue());
         int projectCount = count(mtCompanyId, projectStatus);
         int liftCount = projectLiftRelevanceService.count(mtCompanyId, projectStatus);
         int stopLiftCount = platformCompanyService.count(mtCompanyId, projectStatus);
         Map<String, Object> resultMap = new HashMap<>();
+        resultMap.put("totalCount", totalMap);
         resultMap.put("projectCount", projectCount);
         resultMap.put("liftCount", liftCount);
         resultMap.put("stopLiftCount", stopLiftCount);

+ 1 - 0
lift-business-service/src/main/resources/mapper/project/ProjectMapper.xml

@@ -61,6 +61,7 @@
 		p.pp_contact_id AS ppContactId,
 		p.save          AS save,
 		p.locked        AS locked,
+		p.project_status AS projectStatus,
         r.area_name     AS regionName,
         ui.name         AS userName,
         pc.name         AS companyName

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

@@ -310,4 +310,51 @@ public class CommonEnum {
             return label;
         }
     }
+
+    /**
+     * 保养记录状态
+     */
+    public enum MaintenanceRecordStatus implements IEnum {
+
+        WAITING_MAINTENANCE("待保养", "0"),
+        SIGN("已签到", "1"),
+        EVALUATE("待评价", "2"),
+        COMPLETE("已完成", "3");
+
+        /**
+         * 值
+         */
+        private String label;
+
+        /**
+         * 键
+         */
+        private String code;
+
+        /**
+         * 构造函数
+         *
+         * @param label String
+         * @param code  String
+         */
+        MaintenanceRecordStatus(String label, String code) {
+            this.label = label;
+            this.code = code;
+        }
+
+        @Override
+        public String getEnumName() {
+            return "MaintenanceRecordStatus";
+        }
+
+        @Override
+        public String getCode() {
+            return code;
+        }
+
+        @Override
+        public String getLabel() {
+            return label;
+        }
+    }
 }