Parcourir la source

协议复制修改

wks il y a 1 an
Parent
commit
18f41caf63

+ 16 - 9
src/main/java/com/ydtech/modules/protocol/service/PtlAgreementService.java

@@ -12,6 +12,7 @@ import com.ydtech.modules.protocol.entity.po.PtlAgreement;
 import com.ydtech.modules.protocol.entity.po.PtlAgreementProductCosts;
 import com.ydtech.modules.protocol.entity.po.PtlAgreementUndwrtRules;
 import com.ydtech.modules.protocol.entity.vo.*;
+import com.ydtech.modules.protocols.entity.vo.AgreementAllInformationCopyVo;
 
 import java.util.HashMap;
 import java.util.List;
@@ -231,15 +232,14 @@ public interface PtlAgreementService extends IService<PtlAgreement> {
 
 
     /**
-     *  @version
-     *  @author: whp
-     *  @Date: 2024/07/23
-     *  @Description: 查询审核的所有协议  协议名称拼接
+     * @version
+     * @author: whp
+     * @Date: 2024/07/23
+     * @Description: 查询审核的所有协议  协议名称拼接
      */
     List<PtlAgreement> findCheckAgreementListNew(PtlAgreement ptlAgreement);
 
 
-
     /**
      * 获取当前费用的保险公司所有协议
      *
@@ -272,12 +272,19 @@ public interface PtlAgreementService extends IService<PtlAgreement> {
     List<PtlAgreement> getAllAgreement(String agreementId);
 
     HttpResult getAgreementCopy(PtlAgreementVo ptlAgreementVo);
+
     /**
-     *  @version
-     *  @author: hxl
-     *  @Date: 2024/9/21 15:33
-     *  @Description: 通过协议名称查询数据
+     * @version
+     * @author: hxl
+     * @Date: 2024/9/21 15:33
+     * @Description: 通过协议名称查询数据
      */
     PtlAgreement getByAgreementTitle(String title);
 
+    /**
+     * 复制协议费用承保规则
+     *
+     * @param agreementAllInformationCopyVo 复制协议对象
+     */
+    void agreementAllInformationCopyVo(AgreementAllInformationCopyVo agreementAllInformationCopyVo);
 }

+ 57 - 3
src/main/java/com/ydtech/modules/protocol/service/impl/PtlAgreementServiceImpl.java

@@ -5,6 +5,7 @@ import cn.hutool.core.date.DateUtil;
 import com.alibaba.fastjson.JSONArray;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.ydtech.config.DictEnumConfig;
@@ -32,6 +33,11 @@ import com.ydtech.modules.protocol.entity.po.*;
 import com.ydtech.modules.protocol.entity.vo.*;
 import com.ydtech.modules.protocol.service.*;
 import com.ydtech.modules.protocol.utils.AssertionUtils;
+import com.ydtech.modules.protocols.entity.po.PtlAgreementProductCostsAttrLink;
+import com.ydtech.modules.protocols.entity.po.PtlAgreementProductCostsNew;
+import com.ydtech.modules.protocols.entity.vo.AgreementAllInformationCopyVo;
+import com.ydtech.modules.protocols.service.PtlAgreementProductCostsAttrLinkService;
+import com.ydtech.modules.protocols.service.PtlAgreementProductCostsNewService;
 import com.ydtech.utils.idgen.IdGenerate;
 import org.apache.commons.lang3.ObjectUtils;
 import org.apache.commons.lang3.StringUtils;
@@ -91,7 +97,6 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
     @Autowired
     private PtlAgreementDeptHistoryService ptlAgreementDeptHistoryService;
 
-
     @Autowired
     private PtlAgreementMapper ptlAgreementMapper;
 
@@ -998,8 +1003,7 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
         return list;
     }
 
-    //    @Autowired
-//    private PtlAgreementProductCostsNewService ptlAgreementProductCostsNewService;
+
     public List<PtlAgreement> getCurrentAgreementList(String agreementId) {
         PtlAgreement ptlAgreement = this.getById(agreementId);
         String insuranceCompanyId = ptlAgreement.getInsuranceCompanyId();
@@ -1138,4 +1142,54 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
     }
 
 
+    @Autowired
+    private PtlAgreementProductCostsNewService ptlAgreementProductCostsNewService;
+
+    @Autowired
+    private PtlAgreementProductCostsAttrLinkService ptlAgreementProductCostsAttrLinkService;
+
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public void agreementAllInformationCopyVo(AgreementAllInformationCopyVo agreementAllInformationCopyVo) {
+        PtlAgreement ptlAgreement = getById(agreementAllInformationCopyVo.getAgreementId());
+        ptlAgreement.setId(null);
+        save(ptlAgreement);
+
+        AgreementAllInformationCopyVo.InformationDTO cost = agreementAllInformationCopyVo.getCost();
+        List<PtlAgreementProductCostsNew> ptlAgreementProductCostsNews = new ArrayList<>();
+        if (cost.isAll()) {
+            ptlAgreementProductCostsNews = ptlAgreementProductCostsNewService.getByAgreementId(ptlAgreement.getId());
+            ptlAgreementProductCostsNews.forEach(x -> {
+                x.setAgreementId(ptlAgreement.getId());
+                x.setId(null);
+            });
+        } else if(!cost.getInformationId().isEmpty()){
+            ptlAgreementProductCostsNews = ptlAgreementProductCostsNewService.lambdaQuery()
+                    .in(PtlAgreementProductCostsNew::getId, cost.getInformationId()).list();
+        }
+
+        if (!ptlAgreementProductCostsNews.isEmpty()) {
+            List<String> collect = ptlAgreementProductCostsNews.stream().map(PtlAgreementProductCostsNew::getId).collect(Collectors.toList());
+            List<PtlAgreementProductCostsAttrLink> ptlAgreementProductCostsAttrLinkList = ptlAgreementProductCostsAttrLinkService.lambdaQuery()
+                    .in(PtlAgreementProductCostsAttrLink::getCostsId, collect)
+                    .list();
+        }
+
+
+        AgreementAllInformationCopyVo.InformationDTO underwritingRules = agreementAllInformationCopyVo.getUnderwritingRules();
+        if (underwritingRules.isAll()) {
+
+        } else {
+
+        }
+
+    }
+
+    public static void main(String[] args) {
+        List<Object> list = new ArrayList<>();
+        int size = list.size();
+        System.out.println(size);
+    }
+
 }

+ 2 - 4
src/main/java/com/ydtech/modules/protocols/controller/PtlNewAgreementController.java

@@ -252,11 +252,9 @@ public class PtlNewAgreementController extends BaseController {
 
     @ApiOperation("复制协议费用承保规则")
     @PostMapping("/copyAgreementAllInformation")
-    public HttpResult<Object> copyAgreementAllInformation(){
-
+    public HttpResult<Object> copyAgreementAllInformation(AgreementAllInformationCopyVo agreementAllInformationCopyVo){
+        ptlAgreementService.agreementAllInformationCopyVo(agreementAllInformationCopyVo);
         return HttpResult.ok();
     }
 
-
-
 }

+ 44 - 0
src/main/java/com/ydtech/modules/protocols/entity/vo/AgreementAllInformationCopyVo.java

@@ -0,0 +1,44 @@
+package com.ydtech.modules.protocols.entity.vo;
+
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.io.Serializable;
+import java.util.List;
+
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@ApiModel("协议复制信息实体")
+public class AgreementAllInformationCopyVo implements Serializable {
+
+    private static final long serialVersionUID = -7422542310742227930L;
+
+    @ApiModelProperty("协议id")
+    private String agreementId;
+
+    @ApiModelProperty("费用")
+    private InformationDTO cost;
+
+    @ApiModelProperty("承保规则")
+    private InformationDTO underwritingRules;
+
+    @Data
+    @AllArgsConstructor
+    @NoArgsConstructor
+    @ApiModel("信息实体")
+    public static class InformationDTO{
+
+        @ApiModelProperty("是否全部")
+        private boolean isAll;
+
+        @ApiModelProperty("承保规则id列表 和 费用id列表")
+        private List<String> informationId;
+
+    }
+
+}

+ 1 - 0
src/main/java/com/ydtech/modules/protocols/entity/vo/AgreementProductQueryVo.java

@@ -20,6 +20,7 @@ public class AgreementProductQueryVo extends PageRequest {
 
     @ApiModelProperty(value = "协议id列表")
     private List<String> agreementIdList;
+
     @ApiModelProperty(value = "协议id")
     private String agreementId;
 

+ 11 - 0
src/main/java/com/ydtech/modules/protocols/service/PtlAgreementProductCostsNewService.java

@@ -32,6 +32,17 @@ public interface PtlAgreementProductCostsNewService extends IService<PtlAgreemen
 
     List<PtlAgreementProductCostsNew> getByAgreementId(AgreementProductQueryVo agreementProductQueryVo);
 
+
+    /**
+     * 通过协议id 查询 协议费用表
+     *
+     * @param agreementId 协议id
+     * @return 费用列表
+     */
+    default List<PtlAgreementProductCostsNew> getByAgreementId(String agreementId) {
+        return lambdaQuery().eq(PtlAgreementProductCostsNew::getAgreementId, agreementId).list();
+    }
+
     /**
      * 获取协议费用列表(用于分组费用关联)
      *