Bladeren bron

Merge remote-tracking branch 'origin/dev_v2' into dev_v2

钱惠东 1 week geleden
bovenliggende
commit
89e6cccd95

+ 0 - 4
RuoYi-Vue-fast-master/src/main/java/com/ruoyi/project/business/controller/TpParaLibraryController.java

@@ -67,10 +67,6 @@ public class TpParaLibraryController extends BaseController {
         util.exportExcel(response, list, "参数数据");
     }
 
-    @GetMapping("/getParaLibraryAll")
-    public AjaxResult getParaLibraryAll(String lastUpdate) {
-        return AjaxResult.success(tpParaLibraryService.getParaLibraryAll(lastUpdate));
-    }
 
     /**
      * 获取参数详细信息

+ 2 - 0
RuoYi-Vue-fast-master/src/main/java/com/ruoyi/project/business/domain/bo/contract/TqContractLiftBo.java

@@ -317,4 +317,6 @@ public class TqContractLiftBo extends BaseEntity
 
     private String approveStatus;
 
+    private Long version;
+
 }

+ 2 - 0
RuoYi-Vue-fast-master/src/main/java/com/ruoyi/project/business/domain/vo/contract/TqContractDto.java

@@ -43,4 +43,6 @@ public class TqContractDto extends TqContract
 
     private String needFileFlag;
 
+    private String type;
+
 }

+ 1 - 1
RuoYi-Vue-fast-master/src/main/java/com/ruoyi/project/business/mapper/contract/TqContractLiftMapper.java

@@ -70,7 +70,7 @@ public interface TqContractLiftMapper
      */
     public int deleteTqContractLiftById(Long id);
 
-    public int deleteTqContractLiftByNoId(@Param("contractNo") String contractNo, List<Long> ids);
+    public int deleteTqContractLiftByNoId(@Param("contractNo") String contractNo,@Param("version") Long version, List<Long> ids);
 
     /**
      * 批量删除【请填写功能名称】

+ 28 - 7
RuoYi-Vue-fast-master/src/main/java/com/ruoyi/project/business/service/impl/TqContractServiceImpl.java

@@ -190,6 +190,8 @@ public class TqContractServiceImpl implements ITqContractService
                 Long.valueOf(tqContractDto.getCurrencyId()),
                 tqContractDto.getSigningDate()
         ));
+        //将合同的初始version设置为1
+        tqContractDto.setVersion(1L);
         Map<Long, BigDecimal> idAndRateMap = tbContractCurrencyService.selectExchangeRateByCurrencyId(contractCurrencyTimeList);
         //将签单币种汇率赋值
         if(idAndRateMap.containsKey(Long.parseLong(tqContractDto.getCurrencyId()))){
@@ -222,14 +224,33 @@ public class TqContractServiceImpl implements ITqContractService
     public int updateTqContract(TqContractDto tqContractDto)
     {
         List<TqContractLift> tqContractLiftList = tqContractDto.getTqContractLiftList();
+        String type = tqContractDto.getType();
+        //如果是变更或者作废   将版本+1
+        if("amendment".equals(type) || "toVoid".equals(type)){
+            tqContractDto.setVersion(tqContractDto.getVersion() + 1L);
+        }
+        //如果是变更的数据  先将所有的 设备数据的id清空
+        if("amendment".equals(type)){
+            List<TqContractLift> liftList = tqContractDto.getTqContractLiftList();
+            if (liftList != null) {
+                liftList.forEach(item -> item.setId(null));
+            }
+            tqContractDto.setTqContractLiftList(liftList);
+        }
         if(CollectionUtils.isNotEmpty(tqContractLiftList)){
             //获取设备更新List
             List<TqContractLift> tqContractLiftUpdateList = tqContractLiftList.stream().filter(item-> item.getId() != null).collect(Collectors.toList());
             List<Long> idList = tqContractLiftUpdateList.stream().map(item->item.getId()).collect(Collectors.toList());
-            //删除当前合同下不存在的设备番号
-            if(CollectionUtils.isNotEmpty(idList)){
-                tqContractLiftMapper.deleteTqContractLiftByNoId(tqContractDto.getContractNo(),idList);
+            //如果是变更    就不存在删除   只有新增
+            if("amendment".equals(type)){
+                //将现在的
+            }else{
+                //删除当前合同下不存在的设备番号
+                if(CollectionUtils.isNotEmpty(idList)){
+                    tqContractLiftMapper.deleteTqContractLiftByNoId(tqContractDto.getContractNo(),tqContractDto.getVersion(),idList);
+                }
             }
+            //获取update数据
             if(CollectionUtils.isNotEmpty(tqContractLiftUpdateList)){
                 tqContractLiftUpdateList = attachTqContractLift(tqContractDto,tqContractLiftUpdateList);
                 tqContractLiftMapper.updateTqContractLiftBatch(tqContractLiftUpdateList);
@@ -304,9 +325,9 @@ public class TqContractServiceImpl implements ITqContractService
                 .collect(Collectors.toList());
         Map<Long, BigDecimal> deliveryListIdAndRateMap = tbContractCurrencyService.selectExchangeRateByCurrencyId(deliveryList);
 
-        //获取版本
-        Long version = tqContractLiftHistoryMapper.selectVersionMaxFromHistory(tqContractDto.getContractNo());
-        String contractNoVersionNo = version == null ? "1": String.valueOf(version+1L);
+//        //获取版本
+//        Long version = tqContractLiftHistoryMapper.selectVersionMaxFromHistory(tqContractDto.getContractNo());
+//        String contractNoVersionNo = version == null ? "1": String.valueOf(version+1L);
         tqContractLiftList.forEach(item -> {
             item.setContractNo(tqContractDto.getContractNo());
             item.setContractName(tqContractDto.getContractName());
@@ -323,7 +344,7 @@ public class TqContractServiceImpl implements ITqContractService
             item.setSigningDate(tqContractDto.getSigningDate());
             item.setContractAmendmentDate(new Date());
             item.setPaymentRatio(tqContractDto.getPaymentRatio());
-            item.setContractNoVersionNo(tqContractDto.getContractNo()+"-"+contractNoVersionNo);
+            item.setContractNoVersionNo(tqContractDto.getContractNo()+"-"+tqContractDto.getVersion());
             item.setPermissionChar(SecurityUtils.getPermissionCharIns());
             item.setRate4SigningContracts(tqContractDto.getRate4SigningContracts());
             //将签单币种汇率赋值

+ 3 - 3
RuoYi-Vue-fast-master/src/main/resources/mybatis/business/contract/TqContractLiftMapper.xml

@@ -121,14 +121,14 @@
             LEFT JOIN tb_area area on area.area_id = l.area_id  AND l.del_flag = area.del_flag
             LEFT JOIN sys_dict_data t1 on t1.dict_type = 'elevator_type' and l.elevator_type = t1.dict_value
             LEFT JOIN tq_contract contract on contract.contract_no = l.contract_no  AND l.del_flag = contract.del_flag
-            LEFT JOIN (select count(*) as version,contract_no from tq_contract_history where del_flag = '0' group by contract_no) v on v.contract_no = l.contract_no
     </sql>
 
     <select id="selectTqContractLiftList" resultType="com.ruoyi.project.business.domain.vo.contract.TqContractLiftVo">
         <include refid="selectTqContractLiftVo"/>
         <where>
             l.del_flag != '1'
-            <if test="approveStatus != null  and approveStatus != ''"> and (contract.approve_status = #{approveStatus} or CAST(SUBSTRING_INDEX(l.contract_no_version_no, '-', -1) AS UNSIGNED) &lt; v.version)</if>
+            <if test="version != null  "> and CAST(SUBSTRING_INDEX(l.contract_no_version_no, '-', -1)  = {version}</if>
+            <if test="approveStatus != null  and approveStatus != ''"> and (contract.approve_status = #{approveStatus} or CAST(SUBSTRING_INDEX(l.contract_no_version_no, '-', -1) AS UNSIGNED) &lt; contract.version)</if>
             <if test="contractNo != null  and contractNo != ''"> and l.contract_no like concat('%', #{contractNo}, '%')</if>
             <if test="contractName != null  and contractName != ''"> and l.contract_name like concat('%', #{contractName}, '%')</if>
             <if test="areaId != null and areaId.size() > 0">
@@ -684,7 +684,7 @@
         </foreach>
     </delete>
     <delete id="deleteTqContractLiftByNoId">
-        update  tq_contract_lift set del_flag = '1' where contract_no = #{contractNo} and id not in
+        update  tq_contract_lift set del_flag = '1' where contract_no = #{contractNo} AND CAST(SUBSTRING_INDEX(contract_no_version_no, '-', -1) AS UNSIGNED) = #{version} AND  id NOT IN
         <foreach item="id" collection="ids" open="(" separator="," close=")">
             #{id}
         </foreach>

+ 4 - 2
ruoyi-ui-vue2/src/views/contract/edit.vue

@@ -1022,11 +1022,13 @@ export default {
           contract.generateTasksFlag = '1'
           contract.needFileFlag = '1'
           contract.tqContractLiftList = this.equipmentList
+          //将变更\作废type  加入
+          contract.type = this.type
           if (this.contractId != 0 && contract.id !== undefined) {
             //变更或者编辑之后     将状态设置为审批中
             contract.approveStatus =  '0'
-            if(this.type === 'amendment'  ){
-              //补充变更原因
+            if(this.type === 'amendment' || this.type === 'toVoid' ){
+              //补充变更\作废原因
               this.contractHistory.changeRemark =  this.amendmentForm.remark
               //将合同金额的千分位恢复
               this.contractHistory.amount = delcommafy(this.contractHistory.amount)