Ver Fonte

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

Qchen há 2 anos atrás
pai
commit
0e394351f5
19 ficheiros alterados com 262 adições e 34 exclusões
  1. 1 0
      sql/Online.sql
  2. 1 0
      src/main/java/com/ydtech/modules/esm/service/EsmUserReferrerService.java
  3. 2 1
      src/main/java/com/ydtech/modules/esm/service/impl/EsmUserReferrerServiceImpl.java
  4. 18 13
      src/main/java/com/ydtech/modules/fee/service/impl/FeeRuleSchemeServiceImpl.java
  5. 15 5
      src/main/java/com/ydtech/modules/fee/service/impl/FeeRuleSchemeServiceNewImpl.java
  6. 12 3
      src/main/java/com/ydtech/modules/ins/model/guoren/CarPriceReq.java
  7. 3 2
      src/main/java/com/ydtech/modules/order/aop/aspect/AuditVerificationAspect.java
  8. 2 0
      src/main/java/com/ydtech/modules/order/entity/vo/FeeOrderNewVo.java
  9. 7 1
      src/main/java/com/ydtech/modules/order/service/impl/InsOrdersServiceImpl.java
  10. 4 0
      src/main/java/com/ydtech/modules/protocol/service/impl/TaxSourceServiceImpl.java
  11. 15 1
      src/main/java/com/ydtech/modules/protocols/controller/PtlNewAgreementController.java
  12. 31 0
      src/main/java/com/ydtech/modules/protocols/entity/po/PtlAgreementProductCostsNew.java
  13. 9 0
      src/main/java/com/ydtech/modules/protocols/entity/vo/AgreementProductCosts.java
  14. 9 0
      src/main/java/com/ydtech/modules/protocols/entity/vo/AgreementProductCostsSave.java
  15. 9 0
      src/main/java/com/ydtech/modules/protocols/entity/vo/AgreementProductQueryVo.java
  16. 28 0
      src/main/java/com/ydtech/modules/protocols/entity/vo/CostsAuditVo.java
  17. 19 2
      src/main/java/com/ydtech/modules/protocols/service/PtlAgreementProductCostsNewService.java
  18. 74 3
      src/main/java/com/ydtech/modules/protocols/service/impl/PtlAgreementProductCostsNewServiceImpl.java
  19. 3 3
      src/main/resources/mapper/modules/order/InsAreaCompanyMapper.xml

+ 1 - 0
sql/Online.sql

@@ -0,0 +1 @@
+

+ 1 - 0
src/main/java/com/ydtech/modules/esm/service/EsmUserReferrerService.java

@@ -58,6 +58,7 @@ public interface EsmUserReferrerService extends IService<EsmUserReferrer> {
     public Page<SysUser> getUserPage(Page page, SysUserDto dto);
 
     public Page<QueryChannel> getQueryChannelPage(Page page, QueryChannel queryChannel);
+
 }
 
 

+ 2 - 1
src/main/java/com/ydtech/modules/esm/service/impl/EsmUserReferrerServiceImpl.java

@@ -51,13 +51,14 @@ public class EsmUserReferrerServiceImpl extends ServiceImpl<EsmUserReferrerMappe
     // 递归查找节点的所有父级节点
     public List<EsmUserReferrer> findParents(String userId) {
         List<EsmUserReferrer> referrers = new ArrayList<>();
+
         EsmUserReferrer esmUserReferrer = esmUserReferrerService.getById(userId);
         //找不到用户的推荐关系
         if(esmUserReferrer == null){
             return null;
         }
         List<EsmUserReferrer> esmUserReferrers = esmUserReferrerService.list(new LambdaQueryWrapper<EsmUserReferrer>().eq(EsmUserReferrer::getAffiliation, esmUserReferrer.getAffiliation()));
-        findParentsRecursive(userId, esmUserReferrers, referrers);
+        findParentsRecursive(esmUserReferrer.getReferrerId(), esmUserReferrers, referrers);
         return referrers;
     }
 

+ 18 - 13
src/main/java/com/ydtech/modules/fee/service/impl/FeeRuleSchemeServiceImpl.java

@@ -29,6 +29,7 @@ import com.ydtech.modules.order.service.InsOrdersService;
 import com.ydtech.modules.protocol.entity.po.*;
 import com.ydtech.modules.protocol.service.*;
 import com.ydtech.modules.protocols.entity.po.InsFeeOrderNew;
+import com.ydtech.modules.protocols.entity.po.PtlAgreementProductCostsNew;
 import org.apache.commons.lang3.ObjectUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.lang3.math.NumberUtils;
@@ -2609,7 +2610,7 @@ public class FeeRuleSchemeServiceImpl implements FeeRuleSchemeService {
         return result.toString();
     }
 
-    public FeeOrderNewVo newConvertOrderFeeVoData(InsFeeOrderNew insFeeOrderNew) {
+    public FeeOrderNewVo newConvertOrderFeeVoData(InsFeeOrderNew insFeeOrderNew, PtlAgreementProductCostsNew ptlAgreementProductCostsNew) {
         FeeOrderNewVo feeOrderNewVo = new FeeOrderNewVo();
         List<FeeOrderNewVo.EntranceFee> entranceFeeList = new ArrayList<>();
         List<FeeOrderNewVo.ExportFee> exportFeeList = new ArrayList<>();
@@ -2636,6 +2637,7 @@ public class FeeRuleSchemeServiceImpl implements FeeRuleSchemeService {
         jqEntranceFee.setOtherCostsProportion(insFeeOrderNew.getJqOtherCostsProportion());   // 跟单比例
         jqEntranceFee.setOtherCostsPremiums(insFeeOrderNew.getJqOtherCostsPremiums());      // 跟单费
         jqEntranceFee.setSuperviseCosts(insFeeOrderNew.getJqSuperviseCostsProportion());  // 手续费比例
+        jqEntranceFee.setExportSuperviseCosts(new BigDecimal(ptlAgreementProductCostsNew.getJqCostsExportProportion()));  // 出口费比例
         entranceFeeList.add(jqEntranceFee);
 
 
@@ -2678,18 +2680,18 @@ public class FeeRuleSchemeServiceImpl implements FeeRuleSchemeService {
 
         //交强出口手续费比例
         BigDecimal jqExportSuperviseCosts =
-                jqExportTotalProportion.compareTo(jqEntranceFee.getSuperviseCosts()) > 0 ? jqEntranceFee.getSuperviseCosts() : jqExportTotalProportion;
+                jqExportTotalProportion.compareTo(jqEntranceFee.getExportSuperviseCosts()) > 0 ? jqEntranceFee.getExportSuperviseCosts() : jqExportTotalProportion;
 
         //交强出口其他费比例
         BigDecimal jqOtherCostsProportion =
-                jqExportTotalProportion.compareTo(jqEntranceFee.getSuperviseCosts()) > 0 ? jqExportTotalProportion.subtract(jqExportSuperviseCosts) : new BigDecimal(0);
+                jqExportTotalProportion.compareTo(jqEntranceFee.getExportSuperviseCosts()) > 0 ? jqExportTotalProportion.subtract(jqExportSuperviseCosts) : new BigDecimal(0);
 
         jqExportFee.setSuperviseCosts(jqExportSuperviseCosts);
         jqExportFee.setSuperviseCostsPremiums(insFeeOrderNew.getJqPremium().multiply(jqExportSuperviseCosts.divide(new BigDecimal(100))).setScale(2,BigDecimal.ROUND_DOWN));
         jqExportFee.setOtherCostsProportion(jqOtherCostsProportion);
         jqExportFee.setOtherCostsPremiums(insFeeOrderNew.getJqPremium().multiply(jqOtherCostsProportion.divide(new BigDecimal(100))).setScale(2,BigDecimal.ROUND_DOWN));
-        jqExportFee.setTotalProportion(jqExportFee.getSuperviseCosts().add(jqExportFee.getOtherCostsProportion()));
-        jqExportFee.setTotalAmount(jqExportFee.getSuperviseCostsPremiums().add(jqExportFee.getOtherCostsPremiums()));
+        jqExportFee.setTotalProportion(jqExportSuperviseCosts.add(jqOtherCostsProportion));
+        jqExportFee.setTotalAmount(jqExportSuperviseCosts.add(jqOtherCostsProportion));
         exportFeeList.add(jqExportFee);
 
 
@@ -2704,6 +2706,7 @@ public class FeeRuleSchemeServiceImpl implements FeeRuleSchemeService {
         syEntranceFee.setOtherCostsProportion(insFeeOrderNew.getSyOtherCostsProportion());   // 跟单比例
         syEntranceFee.setOtherCostsPremiums(insFeeOrderNew.getSyOtherCostsPremiums());      // 跟单费
         syEntranceFee.setSuperviseCosts(insFeeOrderNew.getSySuperviseCostsProportion());  // 手续费比例
+        syEntranceFee.setExportSuperviseCosts(new BigDecimal(ptlAgreementProductCostsNew.getSyCostsExportProportion()));  // 出口费比例
         entranceFeeList.add(syEntranceFee);
 
         // 商业管理费
@@ -2735,18 +2738,19 @@ public class FeeRuleSchemeServiceImpl implements FeeRuleSchemeService {
         }
         //商业出口手续费比例
         BigDecimal syExportSuperviseCosts =
-                syExportTotalProportion.compareTo(syEntranceFee.getSuperviseCosts()) > 0 ? syEntranceFee.getSuperviseCosts() : syExportTotalProportion;
+                syExportTotalProportion.compareTo(syEntranceFee.getExportSuperviseCosts()) > 0 ? syEntranceFee.getExportSuperviseCosts() : syExportTotalProportion;
 
         //商业出口其他费比例
         BigDecimal syOtherCostsProportion =
-                syExportTotalProportion.compareTo(syEntranceFee.getSuperviseCosts()) > 0 ? syExportTotalProportion.subtract(syExportSuperviseCosts) : new BigDecimal(0);
+                syExportTotalProportion.compareTo(syEntranceFee.getExportSuperviseCosts()) > 0 ? syExportTotalProportion.subtract(syExportSuperviseCosts) : new BigDecimal(0);
 
         syExportFee.setSuperviseCosts(syExportSuperviseCosts);
         syExportFee.setSuperviseCostsPremiums(insFeeOrderNew.getSyPremium().multiply(syExportSuperviseCosts.divide(new BigDecimal(100))).setScale(2,BigDecimal.ROUND_DOWN));
         syExportFee.setOtherCostsProportion(syOtherCostsProportion);
         syExportFee.setOtherCostsPremiums(insFeeOrderNew.getSyPremium().multiply(syOtherCostsProportion.divide(new BigDecimal(100))).setScale(2,BigDecimal.ROUND_DOWN));
-        syExportFee.setTotalProportion(syExportFee.getSuperviseCosts().add(syExportFee.getOtherCostsProportion()));
-        syExportFee.setTotalAmount(syExportFee.getSuperviseCostsPremiums().add(syExportFee.getOtherCostsPremiums()));
+        //如果入口的总比例等于0  则出口的总比例也等于0
+        syExportFee.setTotalProportion(syExportSuperviseCosts.add(syExportFee.getOtherCostsProportion()));
+        syExportFee.setTotalAmount(syExportSuperviseCosts.add(syExportFee.getOtherCostsPremiums()));
         exportFeeList.add(syExportFee);
 
 
@@ -2761,6 +2765,7 @@ public class FeeRuleSchemeServiceImpl implements FeeRuleSchemeService {
         nonEntranceFee.setOtherCostsProportion(insFeeOrderNew.getNoOtherCostsProportion());   // 跟单比例
         nonEntranceFee.setOtherCostsPremiums(insFeeOrderNew.getNoOtherCostsPremiums());      // 跟单费
         nonEntranceFee.setSuperviseCosts(insFeeOrderNew.getNoSuperviseCostsProportion());  // 手续费比例
+        nonEntranceFee.setExportSuperviseCosts(new BigDecimal(ptlAgreementProductCostsNew.getNoCostsExportProportion()));  // 出口费比例
         entranceFeeList.add(nonEntranceFee);
 
         // 五级管理费
@@ -2794,18 +2799,18 @@ public class FeeRuleSchemeServiceImpl implements FeeRuleSchemeService {
 
         //非车出口手续费比例
         BigDecimal nonExportSuperviseCosts =
-                nonExportTotalProportion.compareTo(nonEntranceFee.getSuperviseCosts()) > 0 ? nonEntranceFee.getSuperviseCosts() : nonExportTotalProportion;
+                nonExportTotalProportion.compareTo(nonEntranceFee.getExportSuperviseCosts()) > 0 ? nonEntranceFee.getExportSuperviseCosts() : nonExportTotalProportion;
 
         //非车出口其他费比例
         BigDecimal nonOtherCostsProportion =
-                nonExportTotalProportion.compareTo(nonEntranceFee.getSuperviseCosts()) > 0 ? nonExportTotalProportion.subtract(nonExportSuperviseCosts) : new BigDecimal(0);
+                nonExportTotalProportion.compareTo(nonEntranceFee.getExportSuperviseCosts()) > 0 ? nonExportTotalProportion.subtract(nonExportSuperviseCosts) : new BigDecimal(0);
 
         nonExportFee.setSuperviseCosts(nonExportSuperviseCosts);
         nonExportFee.setSuperviseCostsPremiums(insFeeOrderNew.getNoPremium().multiply(nonExportSuperviseCosts.divide(new BigDecimal(100))).setScale(2,BigDecimal.ROUND_DOWN));
         nonExportFee.setOtherCostsProportion(nonOtherCostsProportion);
         nonExportFee.setOtherCostsPremiums(insFeeOrderNew.getNoPremium().multiply(nonOtherCostsProportion.divide(new BigDecimal(100))).setScale(2,BigDecimal.ROUND_DOWN));
-        nonExportFee.setTotalProportion(nonExportFee.getSuperviseCosts().add(nonExportFee.getOtherCostsProportion()));
-        nonExportFee.setTotalAmount(nonExportFee.getSuperviseCostsPremiums().add(nonExportFee.getOtherCostsPremiums()));
+        nonExportFee.setTotalProportion(nonExportSuperviseCosts.add(nonOtherCostsProportion));
+        nonExportFee.setTotalAmount(nonExportSuperviseCosts.add(nonOtherCostsProportion));
         exportFeeList.add(nonExportFee);
 
         feeOrderNewVo.setEntranceFee(entranceFeeList);

+ 15 - 5
src/main/java/com/ydtech/modules/fee/service/impl/FeeRuleSchemeServiceNewImpl.java

@@ -518,12 +518,13 @@ public class FeeRuleSchemeServiceNewImpl implements FeeRuleSchemeNewService {
 
         for (int i = 0; i < ptlAgreementUndwrtRulesNews.size(); i++) {
             //判断是否匹配
-            if (judgementsRules(ptlAgreementUndwrtRulesNews.get(i).getRulesAttrList(), undwrtRulesAttrList, ruleAttrMappingVoList)) {
-                //返回 费用id   如果需要匹配非车的情况  将返回值返回list 后赛选
-                return true;
+            System.out.printf("费用因子匹配开始:" + ptlAgreementUndwrtRulesNews.get(i).getId() + "\n");
+            System.out.println("费用因子备注:" + ptlAgreementUndwrtRulesNews.get(i).getRuleDescription() + "\n");
+            if (!judgementsRules(ptlAgreementUndwrtRulesNews.get(i).getRulesAttrList(), undwrtRulesAttrList, ruleAttrMappingVoList)) {
+                throw new SystemException("承保规则校验失败");
             }
         }
-        throw new SystemException("承保规则校验失败");
+        return true;
     }
 
     /**
@@ -589,8 +590,11 @@ public class FeeRuleSchemeServiceNewImpl implements FeeRuleSchemeNewService {
                     x.getAttrCode().equals(ptlAgreementUndwrtRulesAttrLinks.get(finalI).getAttrCode())).findFirst().orElse(null);
 
             //如果查找不到 传值属性 直接费用对比失败
-            if(ruleAttrMappingVo == null)
+            if(ruleAttrMappingVo == null) {
+                System.out.printf("规则匹配失败:" + ptlAgreementUndwrtRulesAttrLinks.get(i).getAttrCode() + "\n");
+                System.out.printf("传入的值找不到该属性:" + ptlAgreementUndwrtRulesAttrLinks.get(finalI).getAttrCode() + "\n");
                 continue;
+            }
             //查找 费用因子规则
             PtlAgreementUndwrtRulesAttr ptlAgreementUndwrtRulesAttr = rulesAttrs.stream().filter(x -> x.getAttrCode().equals(ptlAgreementUndwrtRulesAttrLinks.get(finalI).getAttrCode())).findFirst().get();
             //如果是多选 对value进行转换
@@ -611,7 +615,13 @@ public class FeeRuleSchemeServiceNewImpl implements FeeRuleSchemeNewService {
             }
             useFlag = attrEqual(ptlAgreementUndwrtRulesAttrLinks.get(i), ptlAgreementUndwrtRulesAttr, ruleAttrMappingVo.getValue());
             if(!useFlag)
+            {
+                System.out.printf("规则匹配失败:" + ptlAgreementUndwrtRulesAttrLinks.get(i).getAttrCode() + "\n");
+                System.out.printf("检验的值:" + ptlAgreementUndwrtRulesAttrLinks.get(i).getMin() + "\n");
+                System.out.printf("传入的值:" + ruleAttrMappingVo.getValue() + "\n");
                 return false;
+
+            }
         }
         return useFlag;
     }

+ 12 - 3
src/main/java/com/ydtech/modules/ins/model/guoren/CarPriceReq.java

@@ -82,6 +82,7 @@ public class CarPriceReq {
         prpTmain.setEProposalFlag("1");
         //购车发票日期
         prpTmain.setBusiness(carInfo.getIssueDate());
+
         prpTmain.setAgentName(channelInfo.getAgentName());
         prpTmain.setChanneltypetwoName(channelInfo.getChannelTypeTwoName());
         prpTmain.setChanneltypeoneName(channelInfo.getChannelTypeOneName());
@@ -131,14 +132,15 @@ public class CarPriceReq {
 
         prpTitemCar.setEngineNo(carInfo.getEngineNo());
         prpTitemCar.setBrandName(vinQ.getBrandNameBC());
+        // 发证日期
         prpTitemCar.setCertifiCateDate(carInfo.getIssueDate());
 
         //使用性质  8A	家庭自用
         String vehicleUse = carInfo.getVehicleUse();
         UseNatureCodeMapping useNatureCodeMapping = UseNatureCodeMapping.valueOf(UseNatureCodeMapping.TITLE + vehicleUse);
         prpTitemCar.setUseNatureCode(useNatureCodeMapping.getUseNatureCode());
-        //初登日期
-        prpTitemCar.setEnrollDate(carInfo.getIssueDate());
+        // 初登日期
+        prpTitemCar.setEnrollDate(carInfo.getRegisterDate());
         //核定载客数
         prpTitemCar.setSeatCount(carInfo.getSeatCount());
         prpTitemCar.setFuelType(vinQ.getFuelType());
@@ -162,7 +164,8 @@ public class CarPriceReq {
         prpTitemCar.setMaincarKindCode(categoriesOfVehicles.getCode());
 
         //过户日期
-        prpTitemCar.setChgOwnerDate(carInfo.getTransferDate());
+
+        prpTitemCar.setChgOwnerDate(carInfo.getIssueDate());
         /**
          * vin car
          */
@@ -317,12 +320,18 @@ public class CarPriceReq {
             @JsonProperty(value = "brandName")
             @JSONField(name = "brandName")
             private String brandName;
+            /**
+             * 发证日期
+             */
             @JsonProperty(value = "certifiCateDate")
             @JSONField(name = "certifiCateDate")
             private String certifiCateDate;
             @JsonProperty(value = "useNatureCode")
             @JSONField(name = "useNatureCode")
             private String useNatureCode;
+            /**
+             * 初登日期
+             */
             @JsonProperty(value = "enrollDate")
             @JSONField(name = "enrollDate")
             private String enrollDate;

+ 3 - 2
src/main/java/com/ydtech/modules/order/aop/aspect/AuditVerificationAspect.java

@@ -53,10 +53,11 @@ public class AuditVerificationAspect {
             }
             InsAreaCompany insAreaCompany = insAreaCompanyService.getByIdIsExist(companyId);
             InsOrders insOrders = insOrdersService.getById(insAreaCompany.getOrderno());
-            //先进行承保规则判断
-            feeRuleSchemeNewService.verificationRuleFactor(insAreaCompany, insOrders);
+
             //再进行费用因子判断
             try {
+                //先进行承保规则判断
+                feeRuleSchemeNewService.verificationRuleFactor(insAreaCompany, insOrders);
                 feeRuleSchemeNewService.verificationCostFactor(insAreaCompany, insOrders);
             } catch (Exception ignored) {
                 System.out.printf("费用因子匹配失败:" + ignored.getMessage());

+ 2 - 0
src/main/java/com/ydtech/modules/order/entity/vo/FeeOrderNewVo.java

@@ -47,6 +47,8 @@ public class FeeOrderNewVo implements Serializable {
         private BigDecimal otherCostsProportion;
         @ApiModelProperty("跟单费")
         private BigDecimal otherCostsPremiums;
+        @ApiModelProperty("出口手续费比例")
+        private BigDecimal exportSuperviseCosts;
     }
 
     /**

+ 7 - 1
src/main/java/com/ydtech/modules/order/service/impl/InsOrdersServiceImpl.java

@@ -57,7 +57,9 @@ import com.ydtech.modules.protocol.entity.constants.PtlApiType;
 import com.ydtech.modules.protocol.entity.dto.PtlAgreementInsCompanyDto;
 import com.ydtech.modules.protocol.service.PtlAgreementService;
 import com.ydtech.modules.protocols.entity.po.InsFeeOrderNew;
+import com.ydtech.modules.protocols.entity.po.PtlAgreementProductCostsNew;
 import com.ydtech.modules.protocols.service.InsFeeOrderNewService;
+import com.ydtech.modules.protocols.service.PtlAgreementProductCostsNewService;
 import com.ydtech.utils.SnowFlakeUtil;
 import com.ydtech.utils.idgen.IdGenerate;
 import org.apache.commons.lang3.StringUtils;
@@ -113,6 +115,9 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
     @Autowired
     private InsFeeOrderNewService insFeeOrderNewService;
 
+    @Autowired
+    private PtlAgreementProductCostsNewService ptlAgreementProductCostsNewService;
+
     @Value("${upload.file.path}")
     private String uploadFilePath;
 
@@ -646,11 +651,12 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
 //            }
 //        }
         if (!Objects.isNull(insFeeOrderNew)) {
+            PtlAgreementProductCostsNew ptlAgreementProductCostsNew = ptlAgreementProductCostsNewService.getById(insFeeOrderNew.getCostsId());
             List<QueryOrderFeeResultVo> orderFeeVoList = feeRuleSchemeService.convertOrderFeeVoData(insFeeOrderNew);
             orderAndAreaCompany.setOrderFeeResult(orderFeeVoList);
 //            List<FeeOrderNewVo> feeOrderNewVoList = feeRuleSchemeService.newConvertOrderFeeVoData(insFeeOrderNew);
 //            orderAndAreaCompany.setFeeOrderNewVoList(feeOrderNewVoList);
-            FeeOrderNewVo  feeOrderNewVo =   feeRuleSchemeService.newConvertOrderFeeVoData(insFeeOrderNew);
+            FeeOrderNewVo  feeOrderNewVo =   feeRuleSchemeService.newConvertOrderFeeVoData(insFeeOrderNew,ptlAgreementProductCostsNew);
             orderAndAreaCompany.setFeeOrderNewVo(feeOrderNewVo);
             List<DistributionLevelVo> distributionLevelVoList = feeRuleSchemeService.converDistrbutionData(insFeeOrderNew);
             orderAndAreaCompany.setDistributionLevelVoList(distributionLevelVoList);

+ 4 - 0
src/main/java/com/ydtech/modules/protocol/service/impl/TaxSourceServiceImpl.java

@@ -23,7 +23,9 @@ import com.ydtech.modules.protocol.entity.vo.TaxSourceVo;
 import com.ydtech.modules.protocol.service.ITaxSourceExcludeService;
 import com.ydtech.modules.protocol.service.ITaxSourceService;
 import com.ydtech.modules.protocol.service.PtlAgreementService;
+import com.ydtech.modules.protocol.utils.AssertionUtils;
 import com.ydtech.utils.idgen.IdGenerate;
+import org.apache.commons.lang3.StringUtils;
 import org.apache.poi.ss.formula.functions.T;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -375,6 +377,8 @@ public class TaxSourceServiceImpl extends ServiceImpl<TaxSourceMapper, TaxSource
             taxSourceDtos = collect.get(0);
         }
 
+        AssertionUtils.isFail(StringUtils.isEmpty(volume), "请填写排量");
+
         if (!isExclude && (Float.parseFloat(volume) >= 1) && (taxSourceDtos != null)) {
             resultId = taxSourceDtos.getAgreementId();
         }

+ 15 - 1
src/main/java/com/ydtech/modules/protocols/controller/PtlNewAgreementController.java

@@ -56,7 +56,7 @@ public class PtlNewAgreementController extends BaseController {
     @ApiOperation("查询协议产品费用列表")
     public PageResult getProduct(@RequestBody AgreementProductQueryVo agreementProductQueryVo) {
         Page<T> page = buildPageRequest(agreementProductQueryVo.getPageDto());
-        Page<PtlAgreementProductCostsNew> schemeQueryDto = ptlAgreementProductCostsNewService.getByAgreementId(page,agreementProductQueryVo.getAgreementId());
+        Page<PtlAgreementProductCostsNew> schemeQueryDto = ptlAgreementProductCostsNewService.getByAgreementId(page,agreementProductQueryVo);
         return buildPageResponse(schemeQueryDto);
     }
 
@@ -86,6 +86,20 @@ public class PtlNewAgreementController extends BaseController {
         return ptlAgreementProductCostsNewService.costsDelete(costsId) ? HttpResult.ok("删除协议费用成功") : HttpResult.error("删除协议费用失败");
     }
 
+    @ApiOperation(value = "复制协议费用")
+    @PostMapping("/costs/copy")
+    public HttpResult costsCopy(String orgCostsId,String newAgreementId){
+        //orgCostsId:原协议费用id
+        //newAgreementId:新协议id
+        return ptlAgreementProductCostsNewService.costsCopy(orgCostsId,newAgreementId) ? HttpResult.ok("复制协议费用成功") : HttpResult.error("复制协议费用失败");
+    }
+
+    @ApiOperation(value = "费用审核")
+    @PostMapping("/costs/audit")
+    public HttpResult costsAudit(@RequestBody CostsAuditVo costsAuditVo){
+        return ptlAgreementProductCostsNewService.costsAudit(costsAuditVo) ? HttpResult.ok("费用审核成功") : HttpResult.error("费用审核失败");
+    }
+
     @ApiOperation(value = "获取承保规则列表")
     @PostMapping("/undwrt/rules/list")
     public PageResult getRulesList(@RequestBody AgreementUndwrtRulesQueryVo agreementUndwrtRulesQueryVo){

+ 31 - 0
src/main/java/com/ydtech/modules/protocols/entity/po/PtlAgreementProductCostsNew.java

@@ -8,7 +8,10 @@ import io.swagger.annotations.ApiModelProperty;
 import lombok.AllArgsConstructor;
 import lombok.Data;
 import lombok.NoArgsConstructor;
+import org.joda.time.DateTime;
 
+import javax.persistence.Table;
+import java.time.LocalDateTime;
 import java.util.List;
 
 /**
@@ -51,6 +54,10 @@ public class PtlAgreementProductCostsNew {
     @TableField(value = "jq_car_other_costs_proportion")
     private String jqCarOtherCostsProportion;
 
+    @ApiModelProperty(value = "出口手续费比例(交强)")
+    @TableField(value = "jq_costs_export_proportion")
+    private String jqCostsExportProportion;
+
     @ApiModelProperty(value = "费用比例(商业)")
     @TableField(value = "sy_car_costs_proportion")
     private String syCarCostsProportion;
@@ -67,6 +74,10 @@ public class PtlAgreementProductCostsNew {
     @TableField(value = "sy_car_other_costs_proportion")
     private String syCarOtherCostsProportion;
 
+    @ApiModelProperty(value = "出口手续费比例(商业)")
+    @TableField(value = "sy_costs_export_proportion")
+    private String syCostsExportProportion;
+
 
     @ApiModelProperty(value = "费用比例(非车)")
     @TableField(value = "no_car_costs_proportion")
@@ -80,6 +91,10 @@ public class PtlAgreementProductCostsNew {
     @TableField(value = "no_car_other_costs_proportion")
     private String noCarOtherCostsProportion;
 
+    @ApiModelProperty(value = "出口手续费比例(非车)")
+    @TableField(value = "no_costs_export_proportion")
+    private String noCostsExportProportion;
+
     @ApiModelProperty(value = "费用描述")
     @TableField(value = "costs_description")
     private String costsDescription;
@@ -96,6 +111,22 @@ public class PtlAgreementProductCostsNew {
     @TableField(value = "priority_level")
     private Integer priorityLevel;
 
+    @ApiModelProperty(value = "是否审核")
+    @TableField(value = "is_audit")
+    private Integer isAudit;
+
+    @ApiModelProperty(value = "驳回信息")
+    @TableField(value = "reject")
+    private String reject;
+
+    @ApiModelProperty(value = "审核人")
+    @TableField(value = "audit_person")
+    private String auditPerson;
+
+    @ApiModelProperty(value = "审核时间")
+    @TableField(value = "audit_time")
+    private LocalDateTime auditTime;
+
     @ApiModelProperty(value = "生成的描述")
     @TableField(exist = false)
     private String desc;

+ 9 - 0
src/main/java/com/ydtech/modules/protocols/entity/vo/AgreementProductCosts.java

@@ -33,6 +33,9 @@ public class AgreementProductCosts {
     @ApiModelProperty(value = "其他费用比例(交强)")
     private String jqCarOtherCostsProportion;
 
+    @ApiModelProperty(value = "交强出口手续费比例")
+    private String jqCostsExportProportion;
+
     @ApiModelProperty(value = "费用比例(商业)")
     private String syCarCostsProportion;
 
@@ -42,6 +45,9 @@ public class AgreementProductCosts {
     @ApiModelProperty(value = "其他费用比例(商业)")
     private String syCarOtherCostsProportion;
 
+    @ApiModelProperty(value = "商业出口手续费比例")
+    private String syCostsExportProportion;
+
     @ApiModelProperty(value = "费用比例(非车)")
     private String noCarCostsProportion;
 
@@ -51,6 +57,9 @@ public class AgreementProductCosts {
     @ApiModelProperty(value = "其他费用比例(非车)")
     private String noCarOtherCostsProportion;
 
+    @ApiModelProperty(value = "非车手续费比例")
+    private String noCostsExportProportion;
+
     @ApiModelProperty(value = "费用描述")
     private String costsDescription;
 

+ 9 - 0
src/main/java/com/ydtech/modules/protocols/entity/vo/AgreementProductCostsSave.java

@@ -96,6 +96,9 @@ public class AgreementProductCostsSave {
     @ApiModelProperty(value = "交强出口加投比例")
     private String jqExportInvestmentRadio;
 
+    @ApiModelProperty(value = "交强出口手续费比例")
+    private String jqCostsExportProportion;
+
     @ApiModelProperty(value = "商业出口比例一级")
     private String syExportRadioLevel1;
 
@@ -114,6 +117,9 @@ public class AgreementProductCostsSave {
     @ApiModelProperty(value = "商业出口加投比例")
     private String syExportInvestmentRadio;
 
+    @ApiModelProperty(value = "商业出口手续费比例")
+    private String syCostsExportProportion;
+
     @ApiModelProperty(value = "非车出口比例一级")
     private String noCarExportRadioLevel1;
 
@@ -132,6 +138,9 @@ public class AgreementProductCostsSave {
     @ApiModelProperty(value = "非车出口加投比例")
     private String noCarExportInvestmentRadio;
 
+    @ApiModelProperty(value = "非车出口手续费比例")
+    private String noCostsExportProportion;
+
 
 
 

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

@@ -1,9 +1,18 @@
 package com.ydtech.modules.protocols.entity.vo;
 
 import com.ydtech.core.page.PageRequest;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
 @Data
 public class AgreementProductQueryVo extends PageRequest {
+    @ApiModelProperty(value = "协议id")
     private String agreementId;
+
+    @ApiModelProperty(value = "是否审核")
+    private String isAudit;
+
+    @ApiModelProperty(value = "产品id")
+    private String productCode;
 }

+ 28 - 0
src/main/java/com/ydtech/modules/protocols/entity/vo/CostsAuditVo.java

@@ -0,0 +1,28 @@
+package com.ydtech.modules.protocols.entity.vo;
+
+import com.ydtech.modules.protocols.entity.po.PtlAgreementProductCostsAttrLink;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import org.joda.time.DateTime;
+
+import java.math.BigDecimal;
+import java.util.List;
+
+@Data
+public class CostsAuditVo {
+
+    @ApiModelProperty(value = "费用id")
+    private String costsId;
+
+    @ApiModelProperty(value = "是否审核")
+    private Integer isAudit;
+
+    @ApiModelProperty(value = "驳回信息")
+    private String reject;
+
+    @ApiModelProperty(value = "审核人")
+    private String auditPerson;
+
+    @ApiModelProperty(value = "审核时间")
+    private DateTime auditTime;
+}

+ 19 - 2
src/main/java/com/ydtech/modules/protocols/service/PtlAgreementProductCostsNewService.java

@@ -6,6 +6,8 @@ import com.ydtech.modules.protocols.entity.po.PtlAgreementProductCostsNew;
 import com.ydtech.modules.protocols.entity.po.PtlAgreementUndwrtRulesAttr;
 import com.ydtech.modules.protocols.entity.vo.AgreementProductCosts;
 import com.ydtech.modules.protocols.entity.vo.AgreementProductCostsSave;
+import com.ydtech.modules.protocols.entity.vo.AgreementProductQueryVo;
+import com.ydtech.modules.protocols.entity.vo.CostsAuditVo;
 
 import java.util.List;
 import java.util.Map;
@@ -20,10 +22,10 @@ public interface PtlAgreementProductCostsNewService extends IService<PtlAgreemen
     /**
      * 获取协议费用列表
      * @param page
-     * @param agreementId
+     * @param agreementProductQueryVo
      * @return
      */
-    Page<PtlAgreementProductCostsNew> getByAgreementId(Page page, String agreementId);
+    Page<PtlAgreementProductCostsNew> getByAgreementId(Page page, AgreementProductQueryVo agreementProductQueryVo);
 
     /**
      * 获取协议费用
@@ -57,4 +59,19 @@ public interface PtlAgreementProductCostsNewService extends IService<PtlAgreemen
      * @return
      */
     boolean costsDelete(String costsId);
+
+    /**
+     * 复制协议费用
+     * @param orgCostsId
+     * @param newAgreementId
+     * @return
+     */
+    boolean costsCopy(String orgCostsId,String newAgreementId);
+
+    /**
+     * 费用审核
+     * @param costsAuditVo
+     * @return
+     */
+    boolean costsAudit(CostsAuditVo costsAuditVo);
 }

+ 74 - 3
src/main/java/com/ydtech/modules/protocols/service/impl/PtlAgreementProductCostsNewServiceImpl.java

@@ -11,6 +11,8 @@ import com.ydtech.modules.protocols.dao.PtlAgreementProductCostsNewMapper;
 import com.ydtech.modules.protocols.entity.po.*;
 import com.ydtech.modules.protocols.entity.vo.AgreementProductCosts;
 import com.ydtech.modules.protocols.entity.vo.AgreementProductCostsSave;
+import com.ydtech.modules.protocols.entity.vo.AgreementProductQueryVo;
+import com.ydtech.modules.protocols.entity.vo.CostsAuditVo;
 import com.ydtech.modules.protocols.service.*;
 import com.ydtech.utils.idgen.IdGenerate;
 import org.springframework.beans.BeanUtils;
@@ -19,6 +21,7 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
 import java.util.*;
 import java.util.stream.Collectors;
 
@@ -50,14 +53,31 @@ public class PtlAgreementProductCostsNewServiceImpl extends ServiceImpl<PtlAgree
     PtlAgreementProductCostsAttrLinkHistoryService ptlAgreementProductCostsAttrLinkHistoryService;
 
     @Override
-    public Page<PtlAgreementProductCostsNew> getByAgreementId(Page page, String agreementId) {
-        Page<PtlAgreementProductCostsNew> pages = baseMapper.selectPage(page, new LambdaQueryWrapper<PtlAgreementProductCostsNew>()
-                .eq(PtlAgreementProductCostsNew::getAgreementId, agreementId));
+    public Page<PtlAgreementProductCostsNew> getByAgreementId(Page page, AgreementProductQueryVo agreementProductQueryVo) {
+        LambdaQueryWrapper<PtlAgreementProductCostsNew> ptlAgreementProductCostsNewLambdaQueryWrapper = new LambdaQueryWrapper<>();
+        ptlAgreementProductCostsNewLambdaQueryWrapper.eq(PtlAgreementProductCostsNew::getAgreementId, agreementProductQueryVo.getAgreementId());
+        //审核条件
+        if(agreementProductQueryVo.getIsAudit() != null){
+            ptlAgreementProductCostsNewLambdaQueryWrapper.eq(PtlAgreementProductCostsNew::getIsAudit, agreementProductQueryVo.getIsAudit());
+        }
+
+        //产品code
+        if(agreementProductQueryVo.getProductCode() != null){
+            ptlAgreementProductCostsNewLambdaQueryWrapper.eq(PtlAgreementProductCostsNew::getProductId, agreementProductQueryVo.getProductCode());
+        }
+
+        Page<PtlAgreementProductCostsNew> pages = baseMapper.selectPage(page, ptlAgreementProductCostsNewLambdaQueryWrapper);
+
+//                .lt(PtlAgreementProductCostsNew::getCostsStartDate, formattedDateTime)
+//                .gt(PtlAgreementProductCostsNew::getCostsEndDate, formattedDateTime));
         //遍历费用列表
         List<String> ids = new ArrayList<>();
         pages.getRecords().forEach(x -> {
             ids.add(x.getId());
         });
+        if(ids.isEmpty()){
+            return pages;
+        }
         //获取出口比例
         List<PtlAgreementProductCostsExport> ptlAgreementProductCostsExports = ptlAgreementProductCostsExportService.list(new LambdaQueryWrapper<PtlAgreementProductCostsExport>()
                 .in(PtlAgreementProductCostsExport::getCostsId, ids));
@@ -249,9 +269,16 @@ public class PtlAgreementProductCostsNewServiceImpl extends ServiceImpl<PtlAgree
     @Override
     public List<AgreementProductCosts> costsGetList(String agreementId, String productId) {
 
+        // 获取当前日期时间
+        LocalDateTime currentDateTime = LocalDateTime.now();
+        // 格式化日期时间为指定格式
+        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+        String formattedDateTime = currentDateTime.format(formatter);
         List<PtlAgreementProductCostsNew> ptlAgreementProductCostsNews = baseMapper.selectList(new LambdaQueryWrapper<PtlAgreementProductCostsNew>()
                 .eq(PtlAgreementProductCostsNew::getAgreementId, agreementId)
                 .eq(PtlAgreementProductCostsNew::getProductId, productId)
+                .lt(PtlAgreementProductCostsNew::getCostsStartDate, formattedDateTime)
+                .gt(PtlAgreementProductCostsNew::getCostsEndDate, formattedDateTime)
                 .orderBy(true, true, PtlAgreementProductCostsNew::getPriorityLevel));
 
         List<AgreementProductCosts> agreementProductCosts = new ArrayList<>();
@@ -565,4 +592,48 @@ public class PtlAgreementProductCostsNewServiceImpl extends ServiceImpl<PtlAgree
 
         return true;
     }
+
+    /**
+     * 复制协议费用
+     * @param orgCostsId  原始的费用id
+     * @param newAgreementId  需要复制的协议id
+     * @return
+     */
+    @Transactional
+    @Override
+    public boolean costsCopy(String orgCostsId, String newAgreementId) {
+        AgreementProductCosts agreementProductCosts = new AgreementProductCosts();
+        //设置主表信息
+        PtlAgreementProductCostsNew ptlAgreementProductCostsNew = baseMapper.selectById(orgCostsId);
+        ptlAgreementProductCostsNew.setAgreementId(newAgreementId);
+        BeanUtils.copyProperties(ptlAgreementProductCostsNew, agreementProductCosts);
+
+
+        //设置管理比例信息
+        PtlAgreementProductCostsExport ptlAgreementProductCostsExport = ptlAgreementProductCostsExportService.getOne(new LambdaQueryWrapper<PtlAgreementProductCostsExport>().eq(PtlAgreementProductCostsExport::getCostsId, orgCostsId));
+        BeanUtils.copyProperties(ptlAgreementProductCostsExport, agreementProductCosts);
+        ptlAgreementProductCostsExport.setId("0");
+
+        //设置费用因子信息
+        List<PtlAgreementProductCostsAttrLink> ptlAgreementProductCostsAttrLink = ptlAgreementProductCostsAttrLinkService.list(new LambdaQueryWrapper<PtlAgreementProductCostsAttrLink>().eq(PtlAgreementProductCostsAttrLink::getCostsId, orgCostsId));
+        agreementProductCosts.setCostsAttrLinks(ptlAgreementProductCostsAttrLink);
+        agreementProductCosts.setId("0");
+
+        this.costsAdd(agreementProductCosts);
+
+        return true;
+    }
+
+
+    @Override
+    public boolean costsAudit(CostsAuditVo costsAuditVo){
+        PtlAgreementProductCostsNew ptlAgreementProductCostsNew = this.getById(costsAuditVo.getCostsId());
+        if(ptlAgreementProductCostsNew == null){
+            throw new SystemException("费用不存在");
+        }
+        ptlAgreementProductCostsNew.setIsAudit(costsAuditVo.getIsAudit());
+        ptlAgreementProductCostsNew.setAuditPerson(BaseController.getUser().getId());
+        ptlAgreementProductCostsNew.setAuditTime(LocalDateTime.now());
+        return baseMapper.updateById(ptlAgreementProductCostsNew) > 0 ? true : false;
+    }
 }

+ 3 - 3
src/main/resources/mapper/modules/order/InsAreaCompanyMapper.xml

@@ -145,10 +145,10 @@
         ins_area_company
         WHERE
         id IN ( SELECT ins_order_no FROM ins_fee_order_new WHERE id NOT IN ( SELECT ins_order_no FROM ins_fee_audit ) )
-        AND orderstatus = 2
+        AND orderstatus = 3
         )
         AND
-        orderstatus= 2
+        orderstatus= 3
         <if test="params.orderNo != null and params.orderNo != ''">
             AND orderno = #{params.orderNo}
         </if>
@@ -181,7 +181,7 @@
         WHERE
         id IN ( SELECT ifon.ins_order_no FROM ins_fee_order_new ifon RIGHT JOIN ins_fee_audit ifa ON ifon.ins_order_no = ifa.ins_order_no ))
           AND
-            orderstatus = 2
+            orderstatus = 3
         <if test="params.orderNo != null and params.orderNo != ''">
             AND orderno = #{params.orderNo}
         </if>