Przeglądaj źródła

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

wcz 5 lat temu
rodzic
commit
10f75ff14e

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

@@ -2,6 +2,7 @@ package cn.com.ty.lift.business.contract.dao.entity;
 
 import java.math.BigDecimal;
 import java.time.LocalDate;
+import java.time.LocalDateTime;
 
 import cn.com.ty.lift.business.common.BaseEntity;
 import com.baomidou.mybatisplus.annotation.IdType;
@@ -71,7 +72,7 @@ public class Contracts extends BaseEntity {
     /**
      * 签约时间
      */
-    private LocalDate givenDate;
+    private LocalDateTime givenDate;
 
     /**
      * 签约人

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

@@ -16,7 +16,7 @@ public class ContractResponse {
     /**
      * 合同编号
      */
-    private String contractId;
+    private String contractCode;
     /**
      * 合同来源
      */
@@ -62,7 +62,7 @@ public class ContractResponse {
      */
     private String contractStatus;
     /**
-     * 上一个合同编号
+     * 签约合同编号
      */
-    private String previousId;
+    private String nextId;
 }

+ 5 - 3
lift-business-service/src/main/java/cn/com/ty/lift/business/contract/service/ContractService.java

@@ -14,6 +14,7 @@ import cn.com.xwy.boot.web.dto.RestResponse;
 import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.core.util.StrUtil;
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.IdWorker;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import lombok.extern.slf4j.Slf4j;
@@ -84,6 +85,7 @@ public class ContractService extends ServiceImpl<ContractsMapper, Contracts> {
         project.setNum(contracts.getLiftNum());
         project.setStartDate(contracts.getStarDate());
         project.setEndDate(contracts.getEndDate());
+        project.setMtCompanyId(contracts.getMtCompanyId());
         return projectService.saveProject(project);
     }
 
@@ -96,13 +98,13 @@ 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(contracts.getCode())) {
             //按当前日期时间戳自动生成合同编号
             String contractId = DateUtils.generateCode();
-            contracts.setNextId(contractId);
+            contracts.setCode(contractId);
         }
-        contracts.setNextId(contracts.getCode());
         contracts.setProjectId(project.getId());
         //插入合同信息
         int result = contractsMapper.insert(contracts);
@@ -118,7 +120,7 @@ public class ContractService extends ServiceImpl<ContractsMapper, Contracts> {
             return RestResponse.fail(MessageUtils.get("msg.add.fail"));
         }
         //批量插入收款信息
-        boolean ret = paymentService.insertBatch(extend.getPaymentList(), contracts.getNextId());
+        boolean ret = paymentService.insertBatch(extend.getPaymentList(), contracts.getCode());
         if (!ret) {
             TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
             return RestResponse.fail(MessageUtils.get("msg.add.batch.fail"));

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

@@ -17,14 +17,14 @@ public class PaymentService extends ServiceImpl<PaymentMapper, Payment> {
 
     /**
      * @param payments 付款信息
-     * @param nextId 合同编号
+     * @param contractId 合同编号
      * @return  是否成功
      * @description 批量插入收款信息
      * @date 2019/12/11 4:34 PM
      */
-    public boolean insertBatch(List<Payment> payments, String nextId) {
+    public boolean insertBatch(List<Payment> payments, String contractId) {
         //设置合同付款的合同编号
-        payments.forEach(entry -> entry.setContractsId(nextId));
+        payments.forEach(entry -> entry.setContractsId(contractId));
         //批量插入付款信息
         return saveBatch(payments);
     }

+ 2 - 6
lift-business-service/src/main/java/cn/com/ty/lift/business/framework/conf/MetaHandler.java

@@ -40,7 +40,7 @@ public class MetaHandler implements MetaObjectHandler {
     @Override
     public void updateFill(MetaObject metaObject) {
         //获取当前登陆用户id
-        Long userId = 100L;
+        Long userId = getUserId();
         LocalDateTime now = LocalDateTime.now();
         fill(UPDATE_ID, userId, metaObject);
         fill(UPDATE_DATE, now, metaObject);
@@ -65,12 +65,8 @@ public class MetaHandler implements MetaObjectHandler {
      * @param metaObject
      */
     private void fill(String fieldName, Object fieldVal, MetaObject metaObject) {
-        //检查getter方法
-        if (!metaObject.hasGetter(fieldName)) {
-            return;
-        }
         //检查原有的值,setter方法
-        Object value = metaObject.getValue(fieldName);
+        Object value = getFieldValByName(fieldName,metaObject);
         if (ObjectUtil.isEmpty(value) && metaObject.hasSetter(fieldName)) {
             setFieldValByName(fieldName, fieldVal, metaObject);
         }

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

@@ -185,6 +185,7 @@ public class ProjectService extends ServiceImpl<ProjectMapper,Project> {
         }
         //批量新增项目成员信息
         List<ProjectUser> users = request.getUserList();
+        users.forEach(user -> user.setProjectId(project.getId()));
         boolean result = projectUserService.saveBatch(users, users.size());
         if (!result) {
             TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();

+ 2 - 0
lift-business-service/src/main/java/cn/com/ty/lift/business/project/service/ProjectUserService.java

@@ -66,6 +66,8 @@ public class ProjectUserService extends ServiceImpl<ProjectUserMapper, ProjectUs
         queryWrapper.eq("user_id", projectUser.getUserId());
         queryWrapper.eq("project_id", projectUser.getProjectId());
         queryWrapper.eq("user_role", CommonEnum.DefaultRole.MTWORK.getCode());
+        ProjectUser user = getOne(queryWrapper);
+        projectUser.setIsMonitor("0".equals(user.getIsMonitor()) ? "1" : "0");
         return update(projectUser, queryWrapper);
     }
 

+ 2 - 2
lift-business-service/src/main/resources/mapper/contract/ContractsMapper.xml

@@ -34,8 +34,8 @@
             parameterType="cn.com.ty.lift.business.contract.dao.entity.model.ContractRequest" >
         SELECT
             c.id            AS id,
-            c.next_id       AS contractId,
-            c.previous_id   AS previousId,
+            c.code          AS contractCode,
+            c.next_id       AS nextId,
             c.source        AS contractSource,
             c.type          AS contractType,
             c.star_date     AS starDate,

+ 10 - 8
lift-business-service/src/main/resources/mapper/project/ProjectMapper.xml

@@ -165,7 +165,9 @@
 	<select id="findProjectById" parameterType="cn.com.ty.lift.business.project.dao.entity.model.request.ProjectDetailRequest"
 			resultType="cn.com.ty.lift.business.project.dao.entity.model.response.ProjectDetailResponse">
 		SELECT t.*,
-			   ui.name AS clerkName
+			   ui.name         AS clerkName,
+			   pcc.name        AS companyContact,
+			   pcc.telephone   AS telephone
 		FROM (SELECT p.project_name  AS projectName,
 					 p.project_usage AS projectUsage,
 					 p.address       AS address,
@@ -176,21 +178,21 @@
 					 p.start_date    AS startDate,
 					 p.end_date      AS endDate,
 					 pc.name         AS companyName,
-					 pcc.name        AS companyContact,
-					 pcc.telephone   AS telephone,
 					 ui.name         AS areaDirector,
 					 r.area_name     AS areaName,
-					 r.clerk         AS clerk_id
+					 r.clerk         AS clerk_id,
+		             r.id            AS regionId,
+		             p.pp_contact_id AS contact_id
 		FROM project p
-				LEFT JOIN property_company pc ON p.mt_company_id = pc.mt_company_id
-				LEFT JOIN property_contact pcc ON pc.id = pcc.pp_company_id
-				LEFT JOIN region r ON p.region_id = r.id
-				LEFT JOIN user_info ui ON r.user_id = ui.user_id
+				 LEFT JOIN region r ON p.region_id = r.id
+				 LEFT JOIN user_info ui ON r.user_id = ui.user_id
+				 LEFT JOIN property_company pc ON p.pp_company_id = pc.id
 		WHERE 1=1
 		<if test="request.id!=null and request.id!=''">
 			AND p.id = #{request.id,jdbcType=VARCHAR}
 		</if>
 		    ) t
+		LEFT JOIN property_contact pcc ON t.contact_id = pcc.id
 		LEFT JOIN user_info ui ON ui.user_id = t.clerk_id
 	</select>