ljy121 1 vuosi sitten
vanhempi
commit
bc702becef

+ 2 - 1
zjugis-business/src/main/java/com/zjugis/business/bean/entity/Project.java

@@ -107,7 +107,8 @@ public class Project extends BaseEntity {
 //总合同额
     @TableField(exist = false)
     private BigDecimal contractAmount;
-
+    @TableField(exist = false)
+    private BigDecimal virtualAmount;
     @TableField(exist = false)
     private BigDecimal receivableAmount;
     @TableField(exist = false)

+ 22 - 13
zjugis-business/src/main/java/com/zjugis/business/flow/contractinvoice/service/FlowContractInvoiceService.java

@@ -21,6 +21,7 @@ import com.zjugis.module.system.api.user.AdminUserApi;
 import com.zjugis.module.system.api.user.dto.AdminUserRespDTO;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 
 import java.math.BigDecimal;
 import java.time.LocalDate;
@@ -66,18 +67,18 @@ public class FlowContractInvoiceService {
         CommonResult<IFlowInstance> flowResult = workflowClient.flowInstance(flowInstanceId);
         if(flowResult.isSuccess()){
             ContractInvoice entity = contractInvoiceService.selectByInstanceId(flowInstanceId);
-                if(Objects.isNull(entity)){
-                    entity = new ContractInvoice();
-                    entity.setInstanceId(flowInstanceId);
-                    entity.setWorkerId(userId);
-                    entity.setApplyDate(LocalDate.now());
-                    entity.setFlowStatus(FlowStatusConstants.FLOW_NOT_START);
-                    CommonResult<AdminUserRespDTO> result = adminUserApi.getUser(userId);
-                    entity.setApplyWorkerName(result.getCheckedData().getNickname());
-                    entity.setApplyWorkerDept(result.getCheckedData().getDeptName());
-                    entity.setApplyWorkerDeptId(result.getCheckedData().getDeptId());
-                    contractInvoiceService.insert(entity);
-                }
+            if(Objects.isNull(entity)){
+                entity = new ContractInvoice();
+                entity.setInstanceId(flowInstanceId);
+                entity.setWorkerId(userId);
+                entity.setApplyDate(LocalDate.now());
+                entity.setFlowStatus(FlowStatusConstants.FLOW_NOT_START);
+                CommonResult<AdminUserRespDTO> result = adminUserApi.getUser(userId);
+                entity.setApplyWorkerName(result.getCheckedData().getNickname());
+                entity.setApplyWorkerDept(result.getCheckedData().getDeptName());
+                entity.setApplyWorkerDeptId(result.getCheckedData().getDeptId());
+                contractInvoiceService.insert(entity);
+            }
             return createMap(entity);
         }
         return createModelMap();
@@ -131,7 +132,15 @@ public class FlowContractInvoiceService {
         return map;
     }
 
+    @Transactional
     public int updateById(ContractInvoice entity) {
-        return contractInvoiceMapper.updateById(entity);
+        int res = contractInvoiceMapper.updateById(entity);
+        List<ContractInvoiceRelation> relations = contractInvoiceRelationService.selectDOByInvoiceId(entity.getId());
+        if(relations.size() == 1){
+            ContractInvoiceRelation relation = relations.get(0);
+            relation.setInvoiceAmount(entity.getInvoiceAmount());
+            contractInvoiceRelationService.updateById(relation);
+        }
+        return res;
     }
 }

+ 4 - 0
zjugis-business/src/main/java/com/zjugis/business/service/ContractInvoiceRelationService.java

@@ -18,10 +18,14 @@ public interface ContractInvoiceRelationService {
 
     List<ContractInvoiceRelationDto> selectByInvoiceId(String id);
 
+    List<ContractInvoiceRelation> selectDOByInvoiceId(String id);
+
     void updateAmount(List<ContractInvoiceRelation> relationList);
 
     void updateAmount(ContractInvoiceRelation relation);
 
     List<ContractInvoiceRelation> selectAmountByProjectIds(List<String> projectIds);
+
+    void updateById(ContractInvoiceRelation relation);
 }
 

+ 16 - 0
zjugis-business/src/main/java/com/zjugis/business/service/impl/ContractInvoiceRelationServiceImpl.java

@@ -1,5 +1,6 @@
 package com.zjugis.business.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.zjugis.business.bean.dto.ContractInvoiceRelationDto;
 import com.zjugis.business.bean.entity.ContractInvoiceRelation;
 import com.zjugis.business.mapper.ContractInvoiceRelationMapper;
@@ -39,6 +40,13 @@ public class ContractInvoiceRelationServiceImpl implements ContractInvoiceRelati
         return contractInvoiceRelationMapper.selectByInvoiceId(id);
     }
 
+    @Override
+    public List<ContractInvoiceRelation> selectDOByInvoiceId(String id) {
+        QueryWrapper<ContractInvoiceRelation> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("CONTRACT_INVOICE_ID",id);
+        return contractInvoiceRelationMapper.selectList(queryWrapper);
+    }
+
     /**
      * @param relationList
      */
@@ -66,4 +74,12 @@ public class ContractInvoiceRelationServiceImpl implements ContractInvoiceRelati
         List<ContractInvoiceRelation> contractInvoiceRelations = contractInvoiceRelationMapper.selectAmountByProjectIds(projectIds);
         return contractInvoiceRelations;
     }
+
+    /**
+     * @param relation
+     */
+    @Override
+    public void updateById(ContractInvoiceRelation relation) {
+        contractInvoiceRelationMapper.updateById(relation);
+    }
 }

+ 1 - 1
zjugis-business/src/main/java/com/zjugis/business/service/impl/ContractServiceImpl.java

@@ -219,7 +219,7 @@ public class ContractServiceImpl implements ContractService{
                     serial = Math.max(serial,i);
                 }
             }
-            contract.setContractNumber(mainContract.getContractNumber() + (serial+1));
+            contract.setContractNumber(mainContract.getContractNumber() + "-" + (serial+1));
         } else {
             contract.setVirtualAmount(BigDecimal.ZERO);
             contract.setContractAmount(BigDecimal.ZERO);

+ 1 - 1
zjugis-business/src/main/resources/mapper/oracle/ProjectMapper.xml

@@ -23,7 +23,7 @@
     </select>
 
     <select id="page" resultType="com.zjugis.business.bean.entity.Project">
-        SELECT P.*,D.NAME as zrbm,PA.CONTRACT_AMOUNT,PA.RECEIVABLE_AMOUNT,PA.CONTRACT_BALANCE,PA.PROJECT_COST
+        SELECT P.*,D.NAME as zrbm,PA.CONTRACT_AMOUNT,PA.RECEIVABLE_AMOUNT,PA.CONTRACT_BALANCE,PA.PROJECT_COST,PA.VIRTUAL_AMOUNT
         <if test="params != null and params.isRelContract != null and params.isRelContract == 1">
             ,C.contractNumber as contractNumber
         </if>