Selaa lähdekoodia

Merge branch 'feature-bieao' of lift-manager/lift-server into develop

bieao 5 vuotta sitten
vanhempi
commit
f0233855c0

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

@@ -1,5 +1,6 @@
 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.*;
@@ -89,6 +90,21 @@ public class ContractController {
        return contractService.modify(contracts);
     }
 
+    /**
+     * @param contracts 合同复核
+     * @return 1.成功, 0.失败, 消息描述
+     * @description 合同复核
+     * @date 2020/2/11 12:55 下午
+     */
+    @PostMapping("check")
+    public RestResponse check(@RequestBody Contracts contracts) {
+        boolean result = contractService.check(contracts);
+        if (result) {
+            return RestResponse.success(null, MessageUtils.get("msg.modify.success"));
+        }
+        return RestResponse.fail(MessageUtils.get("msg.modify.fail"));
+    }
+
     /**
      * @param request 合同id
      * @return RestResponse 合同详情

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

@@ -68,6 +68,11 @@ public class Contracts extends BaseEntity {
      */
     private Integer status;
 
+    /**
+     * 是否复核(0:未复核;1:已复核)
+     */
+    private Integer isCheck;
+
     /**
      * 签约时间
      */

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

@@ -23,6 +23,11 @@ public class ContractsExtend {
      */
     private Contracts contracts;
 
+    /**
+     * 上一个合同id
+     */
+    private String contractId;
+
     /**
      * 项目名称
      */

+ 26 - 9
lift-business-service/src/main/java/cn/com/ty/lift/business/contract/service/ContractService.java

@@ -103,15 +103,26 @@ public class ContractService extends ServiceImpl<ContractsMapper, Contracts> {
      */
     @Transactional(rollbackFor = Exception.class)
     public RestResponse add(ContractsExtend extend) {
-        Project project = new Project();
-        project.setId(IdWorker.getId());
         Contracts contracts = extend.getContracts();
+        if (ObjectUtil.isEmpty(extend.getContractId())) {
+            Project project = new Project();
+            project.setId(IdWorker.getId());
+            contracts.setProjectId(project.getId());
+            //插入项目信息
+            Project info = saveProject(contracts, extend, project);
+            if (ObjectUtil.isEmpty(info)) {
+                TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+                return RestResponse.fail(MessageUtils.get("msg.add.fail"));
+            }
+        } else {
+            //续签合同
+            contracts.setPreviousId(extend.getContractId());
+        }
         if (ObjectUtil.isEmpty(contracts.getCode())) {
             //按当前日期时间戳自动生成合同编号
             String contractId = DateUtils.generateCode();
             contracts.setCode(contractId);
         }
-        contracts.setProjectId(project.getId());
         //插入合同信息
         int result = contractsMapper.insert(contracts);
         if (result < 0) {
@@ -119,12 +130,6 @@ public class ContractService extends ServiceImpl<ContractsMapper, Contracts> {
             TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
             return RestResponse.fail(MessageUtils.get("msg.add.fail"));
         }
-        //插入项目信息
-        Project info = saveProject(contracts, extend, project);
-        if (ObjectUtil.isEmpty(info)) {
-            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
-            return RestResponse.fail(MessageUtils.get("msg.add.fail"));
-        }
         //批量插入收款信息
         boolean ret = paymentService.insertBatch(extend.getPaymentList(), contracts.getId());
         if (!ret) {
@@ -134,6 +139,17 @@ public class ContractService extends ServiceImpl<ContractsMapper, Contracts> {
         return RestResponse.success(null, MessageUtils.get("msg.add.success"));
     }
 
+    /**
+     * @param contracts 合同复核
+     * @return 1.成功, 0.失败, 消息描述
+     * @description 合同复核
+     * @date 2020/2/11 12:55 下午
+     */
+    public boolean check(Contracts contracts) {
+        contracts.setIsCheck(1);
+        return updateById(contracts);
+    }
+
     /**
      * @param extend 修改合同、项目、付款信息数据项
      * @return 1.成功, 0.失败, 消息描述
@@ -144,6 +160,7 @@ public class ContractService extends ServiceImpl<ContractsMapper, Contracts> {
     public RestResponse modify(ContractsExtend extend) {
         Contracts contracts = extend.getContracts();
         //修改合同信息
+        contracts.setIsCheck(0);
         boolean contractResult = updateById(contracts);
         if (!contractResult) {
             TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();

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

@@ -19,4 +19,9 @@ public class CompanyRequest extends BaseRequestModel {
      */
     @NotNull(message = "notEmpty")
     private Long mtCompanyId;
+
+    /**
+     * 项目名称
+     */
+    private String projectName;
 }

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

@@ -21,4 +21,10 @@ public class ProjectDetailRequest extends BaseRequestModel {
     @NotNull(message = "notEmpty")
     private Long id;
 
+    /**
+     * 电梯注册代码
+     */
+    @NotNull(message = "notEmpty")
+    private String registrationCode;
+
 }

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

@@ -9,6 +9,10 @@ import lombok.Data;
  */
 @Data
 public class ProjectLiftResponse {
+    /**
+     * 电梯id
+     */
+    private Long id;
     /**
      * 注册代码
      */

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

@@ -143,12 +143,16 @@
 		<if test="request.mtCompanyId!=null and request.mtCompanyId!=''">
 			AND plr.mt_company_id = #{request.mtCompanyId,jdbcType=VARCHAR}
 		</if>
+		<if test="request.projectName!=null and request.projectName!=''">
+			AND p.project_name LIKE CONCAT('%',#{request.projectName,jdbcType=VARCHAR},'%')
+		</if>
 	</select>
 
 	<!--app端 根据项目id查询项目下电梯列表 -->
 	<select id="findListByProjectId" parameterType="cn.com.ty.lift.business.project.dao.entity.model.request.ProjectDetailRequest"
 			resultType="cn.com.ty.lift.business.project.dao.entity.model.response.ProjectLiftResponse">
 		SELECT
+		  l.id                AS id,
 		  l.registration_code AS registrationCode,
 		  l.lift_code         AS liftCode,
 		  lb.name             AS liftBrand,
@@ -162,6 +166,9 @@
 		<if test="request.id!=null and request.id!=''">
 			AND plr.project_id = #{request.id,jdbcType=VARCHAR}
 		</if>
+		<if test="request.registrationCode!=null and request.registrationCode!=''">
+			AND l.registration_code LIKE CONCAT('%',#{request.registrationCode,jdbcType=VARCHAR},'%')
+		</if>
 	</select>
 
 	<!--app端 根据项目id查询项目详情 -->