Преглед изворни кода

Merge branch 'test' of http://www.baoxianzhanggui.com:8090/sxzgd/java-insagent-pc into test

huihui пре 1 година
родитељ
комит
933d63a26f
36 измењених фајлова са 1323 додато и 62 уклоњено
  1. 2 0
      sql/Online.sql
  2. 11 7
      src/main/java/com/ydtech/modules/admin/controller/SysQyWeChatController.java
  3. 0 2
      src/main/java/com/ydtech/modules/admin/controller/personnelStatistics/PersonnelStatisticsController.java
  4. 6 0
      src/main/java/com/ydtech/modules/admin/model/po/SysQyWeChat.java
  5. 6 0
      src/main/java/com/ydtech/modules/fee/dto/vo/RuleAttrMappingVo.java
  6. 3 0
      src/main/java/com/ydtech/modules/fee/service/FeeRuleSchemeNewService.java
  7. 361 0
      src/main/java/com/ydtech/modules/fee/service/impl/FeeRuleSchemeServiceNewImpl.java
  8. 50 38
      src/main/java/com/ydtech/modules/fnc/service/impl/InsPlyIncomeServiceImpl.java
  9. 0 1
      src/main/java/com/ydtech/modules/ins/model/vo/CarInfoVo.java
  10. 21 0
      src/main/java/com/ydtech/modules/inv/utils/ImportObjectUtils.java
  11. 0 2
      src/main/java/com/ydtech/modules/order/controller/CarModelController.java
  12. 38 0
      src/main/java/com/ydtech/modules/order/controller/ExternalOrderController.java
  13. 20 0
      src/main/java/com/ydtech/modules/order/controller/InsOrderReadPdfController.java
  14. 15 0
      src/main/java/com/ydtech/modules/order/controller/QuoteController.java
  15. 7 1
      src/main/java/com/ydtech/modules/order/dao/InsAreaCompanyMapper.java
  16. 112 0
      src/main/java/com/ydtech/modules/order/entity/vo/ExternalOrderFeeVo.java
  17. 5 0
      src/main/java/com/ydtech/modules/order/entity/vo/InsOrdersEditingVo.java
  18. 7 0
      src/main/java/com/ydtech/modules/order/service/InsAreaCompanyService.java
  19. 7 1
      src/main/java/com/ydtech/modules/order/service/InsOrdersService.java
  20. 1 0
      src/main/java/com/ydtech/modules/order/service/impl/InsAreaCompanyServiceImpl.java
  21. 1 2
      src/main/java/com/ydtech/modules/order/service/impl/InsCrawlerOrderServiceImpl.java
  22. 24 0
      src/main/java/com/ydtech/modules/order/service/impl/InsOrdersServiceImpl.java
  23. 2 0
      src/main/java/com/ydtech/modules/protocols/service/PtlAgreementProductCostsNewService.java
  24. 18 0
      src/main/java/com/ydtech/modules/protocols/service/impl/PtlAgreementProductCostsNewServiceImpl.java
  25. 21 0
      src/main/java/com/ydtech/modules/scheme/aop/RuleTrajectory.java
  26. 197 0
      src/main/java/com/ydtech/modules/scheme/aop/aspect/RuleTrajectoryAspect.java
  27. 21 0
      src/main/java/com/ydtech/modules/scheme/constants/ExecuteStatusConstant.java
  28. 16 3
      src/main/java/com/ydtech/modules/scheme/controller/PtlSchemeController.java
  29. 35 0
      src/main/java/com/ydtech/modules/scheme/controller/SchemeTrajectoryController.java
  30. 19 0
      src/main/java/com/ydtech/modules/scheme/dao/PtlSchemeRulesTrajectoryMapper.java
  31. 81 0
      src/main/java/com/ydtech/modules/scheme/entity/po/PtlSchemeRulesTrajectory.java
  32. 1 1
      src/main/java/com/ydtech/modules/scheme/service/PtlSchemeRulesService.java
  33. 22 0
      src/main/java/com/ydtech/modules/scheme/service/PtlSchemeRulesTrajectoryService.java
  34. 2 2
      src/main/java/com/ydtech/modules/scheme/service/impl/PtlSchemeRulesServiceImpl.java
  35. 53 0
      src/main/java/com/ydtech/modules/scheme/service/impl/PtlSchemeRulesTrajectoryServiceImpl.java
  36. 138 2
      src/main/resources/mapper/modules/order/InsAreaCompanyMapper.xml

+ 2 - 0
sql/Online.sql

@@ -70,4 +70,6 @@ CREATE TABLE `sys_partner_time` (
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='抽成比例修改表';
 
 
+--  2024-10-18 BY WeiRuiJie
+ALTER TABLE `sys_qy_wechat` ADD COLUMN `support_staff_url` varchar(500) NULL COMMENT '客服URL';
 

+ 11 - 7
src/main/java/com/ydtech/modules/admin/controller/SysQyWeChatController.java

@@ -19,6 +19,7 @@ import org.springframework.web.bind.annotation.*;
 
 import java.time.LocalDateTime;
 import java.util.List;
+import java.util.Random;
 
 @RestController
 @RequestMapping("/sys/qy/wechat")
@@ -32,21 +33,24 @@ public class SysQyWeChatController {
 
     private final SysSwitchConfigService sysSwitchConfigService;
 
-    @ApiOperation(value = "配置宣传图")
+    @ApiOperation(value = "配置宣传图/客服")
     @PostMapping(value = "/save/picture")
     public HttpResult<SysQyWeChat> save(@RequestBody SysQyWeChat sysQyWeChat) {
         SysQyWeChat serviceOne = sysQyWeChatService.getOne(new LambdaQueryWrapper<SysQyWeChat>().eq(SysQyWeChat::getUserId, sysQyWeChat.getUserId()));
-        if (serviceOne != null) {
-            sysQyWeChatService.removeById(serviceOne);
-        }
+        boolean save;
         sysQyWeChat.setOperator(BaseController.getUser().getName());
         sysQyWeChat.setOperatorTime(LocalDateTime.now());
-        boolean save = sysQyWeChatService.save(sysQyWeChat);
+        if (serviceOne != null) {
+            sysQyWeChat.setId(serviceOne.getId());
+            save = sysQyWeChatService.updateById(sysQyWeChat);
+        }else{
+            save = sysQyWeChatService.save(sysQyWeChat);
+        }
         AssertionUtils.isSucceed(save, "添加失败");
         return HttpResult.ok("添加成功");
     }
 
-    @ApiOperation(value = "查询当前员工宣传图")
+    @ApiOperation(value = "查询当前员工宣传图 客服")
     @GetMapping(value = "/find/picture")
     public HttpResult<SysQyWeChat> findWechatPicture() {
         String userId = BaseController.getUser().getId();
@@ -56,7 +60,7 @@ public class SysQyWeChatController {
         boolean b = sysSwitchConfigService.weComQRCodeDisplay();
         if (sysQyWeChat == null) {
             List<SysQyWeChat> list = sysQyWeChatService.list();
-            sysQyWeChat = list.get(0);
+            sysQyWeChat = list.get(new Random().nextInt(list.size()));
         }
         sysQyWeChat.setDisplay(b);
         return HttpResult.ok(sysQyWeChat);

+ 0 - 2
src/main/java/com/ydtech/modules/admin/controller/personnelStatistics/PersonnelStatisticsController.java

@@ -5,11 +5,9 @@ import com.ydtech.core.page.HttpResult;
 import com.ydtech.core.page.PageResult;
 import com.ydtech.modules.admin.model.dto.EsmUserReferrerDTO;
 import com.ydtech.modules.admin.model.dto.QxFrontlineAgentDto;
-import com.ydtech.modules.admin.model.dto.TeamManagementDto;
 import com.ydtech.modules.admin.model.vo.HouLinePersonnelReportVo;
 import com.ydtech.modules.admin.model.vo.KztGetDeptUtilsDto;
 import com.ydtech.modules.admin.model.vo.QxFrontlineAgentVo;
-import com.ydtech.modules.admin.model.vo.TaskStatisticsVo;
 import com.ydtech.modules.admin.service.SysDeptService;
 import com.ydtech.modules.admin.service.UserReportService;
 import com.ydtech.modules.admin.utils.KztGetDeptUtils;

+ 6 - 0
src/main/java/com/ydtech/modules/admin/model/po/SysQyWeChat.java

@@ -48,6 +48,12 @@ public class SysQyWeChat {
     @TableField( "wechat_picture_url")
     private String wechatPictureUrl;
 
+    /**
+     * 企业微信客服URL
+     */
+    @ApiModelProperty("企业微信客服URL")
+    @TableField("support_staff_url")
+    private String supportStaffUrl;
 
     @ApiModelProperty("创建用户")
     @TableField("operator")

+ 6 - 0
src/main/java/com/ydtech/modules/fee/dto/vo/RuleAttrMappingVo.java

@@ -74,6 +74,12 @@ public class RuleAttrMappingVo {
         LocalDate registrationDate = LocalDate.parse(carInfo.getRegisterDate());
         LocalDate currentDate = LocalDate.now();
 
+        //交强起保日期
+        ruleAttrMappingVoList.add(new RuleAttrMappingVo("JqStartTime",insOrders.getJqstartdate()));
+
+        //商业起保日期
+        ruleAttrMappingVoList.add(new RuleAttrMappingVo("SyStartTime",insOrders.getSystartdate()));
+
         boolean isNoLicenseFlag = false;
         if (carJudgeRule != null) {
             if (carJudgeRule.getUnitTypeCode().equals("天")) {

+ 3 - 0
src/main/java/com/ydtech/modules/fee/service/FeeRuleSchemeNewService.java

@@ -5,8 +5,10 @@ import com.ydtech.modules.fee.dto.vo.ReCalcuLateProportion;
 import com.ydtech.modules.fee.dto.vo.RetailProportion;
 import com.ydtech.modules.order.entity.InsAreaCompany;
 import com.ydtech.modules.order.entity.InsOrders;
+import com.ydtech.modules.order.entity.vo.ExternalOrderFeeVo;
 import com.ydtech.modules.order.entity.vo.QueryOrderFeeResultVo;
 import com.ydtech.modules.order.entity.vo.QueryOrderFeeVo;
+import com.ydtech.modules.protocol.entity.po.PtlAgreement;
 import com.ydtech.modules.protocols.entity.po.PtlAgreementProductCostsExport;
 import com.ydtech.modules.protocols.entity.po.PtlAgreementProductCostsNew;
 
@@ -106,6 +108,7 @@ public interface FeeRuleSchemeNewService {
      */
     void calcCostsExternal(PtlAgreementProductCostsNew costsNew, InsAreaCompany insAreaCompany);
 
+    ExternalOrderFeeVo calcCostsExternalExportData(PtlAgreement ptlAgreement, PtlAgreementProductCostsNew ptlAgreementProductCostsNew, ExternalOrderFeeVo externalOrderFeeVo);
 
     void calcCostsExternalTest(PtlAgreementProductCostsNew costsNew, InsAreaCompany insAreaCompany);
 

+ 361 - 0
src/main/java/com/ydtech/modules/fee/service/impl/FeeRuleSchemeServiceNewImpl.java

@@ -26,6 +26,7 @@ import com.ydtech.modules.fee.service.InsFeeOrderNewHistoryService;
 import com.ydtech.modules.order.entity.InsAreaCompany;
 import com.ydtech.modules.order.entity.InsOrders;
 import com.ydtech.modules.order.entity.api.dajia.constants.TypeVehicleMapping;
+import com.ydtech.modules.order.entity.vo.ExternalOrderFeeVo;
 import com.ydtech.modules.order.entity.vo.FeeOrderNewVo;
 import com.ydtech.modules.order.entity.vo.QueryOrderFeeResultVo;
 import com.ydtech.modules.order.entity.vo.QueryOrderFeeVo;
@@ -46,6 +47,9 @@ import org.springframework.stereotype.Service;
 import javax.annotation.Resource;
 import java.math.BigDecimal;
 import java.math.RoundingMode;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
 import java.util.*;
 import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.stream.Collectors;
@@ -1572,6 +1576,283 @@ public class FeeRuleSchemeServiceNewImpl implements FeeRuleSchemeNewService {
     }
 
 
+
+    @Override
+    public ExternalOrderFeeVo calcCostsExternalExportData(PtlAgreement ptlAgreement, PtlAgreementProductCostsNew ptlAgreementProductCostsNew, ExternalOrderFeeVo externalOrderFeeVo) {
+        //获取协议信息
+        // 外部订单比例
+        ptlAgreementProductCostsNew.blank();
+        SysUser sysUser = sysUserService.findByUserId(externalOrderFeeVo.getUserId());
+        BigDecimal enterProportion = sysSwitchConfigService.getEnterProportion(sysUser.getDeptId(), 3);
+
+        BigDecimal taxRadio = new BigDecimal("1.00");
+        //如果是外部订单则 不含税
+        if (ptlAgreement.getWithTax().equals("否")) {
+            taxRadio = new BigDecimal("1.06");
+        }
+        //税比例 固定1.06
+        //查找入口与出口费用比例
+
+        //出口配置
+        PtlAgreementProductCostsExport ptlAgreementProductCostsExport =
+                ptlAgreementProductCostsExportService.getOne(new LambdaQueryWrapper<PtlAgreementProductCostsExport>().eq(PtlAgreementProductCostsExport::getCostsId, ptlAgreementProductCostsNew.getId()));
+
+        //不含税
+        BigDecimal bigDecimal = new BigDecimal("1.06");
+        externalOrderFeeVo.setJqNoTaxPremium(externalOrderFeeVo.getJqPremium().divide(bigDecimal, 2));
+        externalOrderFeeVo.setSyNoTaxPremium(externalOrderFeeVo.getSyPremium().divide(bigDecimal, 2));
+        externalOrderFeeVo.setNoNoTaxPremium(externalOrderFeeVo.getNoPremium().divide(bigDecimal, 2));
+
+        //region 计算入口费用
+
+        //交强入口信息
+        FeeOrderNewVo.EntranceFee jqEntranceFee = feeRuleSchemeService.calcEntranceFee(externalOrderFeeVo.getJqPremium(),
+                new BigDecimal(ptlAgreementProductCostsNew.getJqCarCostsProportion()),
+                externalOrderFeeVo.getJqRadio(), taxRadio);
+
+        //endregion
+
+
+        //region 重新计算管理费比例和分销比例
+
+        List<EsmRetail> esmRetailList = esmRetailService.selectList(" where t.deptid=? and t.status = '1' ",
+                new Object[]{sysUser.getDeptId()});
+
+        Integer retailLevel = 0;
+
+        //默认分销比例设置
+        RetailProportion retailProportion = new RetailProportion();
+        if (!Objects.isNull(esmRetailList) && !esmRetailList.isEmpty()) {
+            retailLevel = Integer.parseInt(esmRetailList.get(0).getRetailtype());
+            //赋值默认的分销比例
+            retailProportion.setProportion(esmRetailList.get(0).getDisrate1(), esmRetailList.get(0).getDisrate2(), esmRetailList.get(0).getDisrate3());
+        }
+
+
+        //获取交强机构管理费总比例
+        BigDecimal jqDeptProportion = ptlAgreementProductCostsExport.getJqExportRadioLevel1()
+                .add(ptlAgreementProductCostsExport.getJqExportRadioLevel2())
+                .add(ptlAgreementProductCostsExport.getJqExportRadioLevel3())
+                .add(ptlAgreementProductCostsExport.getJqExportRadioLevel4())
+                .add(ptlAgreementProductCostsExport.getJqExportRadioLevel5());
+        //获取商业机构管理费总比例
+        BigDecimal syDeptProportion = ptlAgreementProductCostsExport.getSyExportRadioLevel1()
+                .add(ptlAgreementProductCostsExport.getSyExportRadioLevel2())
+                .add(ptlAgreementProductCostsExport.getSyExportRadioLevel3())
+                .add(ptlAgreementProductCostsExport.getSyExportRadioLevel4())
+                .add(ptlAgreementProductCostsExport.getSyExportRadioLevel5());
+        //获取非车机构管理费总比例
+        BigDecimal noDeptProportion = ptlAgreementProductCostsExport.getNoCarExportRadioLevel1()
+                .add(ptlAgreementProductCostsExport.getNoCarExportRadioLevel2())
+                .add(ptlAgreementProductCostsExport.getNoCarExportRadioLevel3())
+                .add(ptlAgreementProductCostsExport.getNoCarExportRadioLevel4())
+                .add(ptlAgreementProductCostsExport.getNoCarExportRadioLevel5());
+
+        //获取交强分销总比例
+        BigDecimal jqRetailProportion = retailProportion.getJqRetailLevel1Proportion()
+                .add(retailProportion.getJqRetailLevel2Proportion())
+                .add(retailProportion.getJqRetailLevel3Proportion());
+
+        //获取商业分销总比例
+        BigDecimal syRetailProportion = retailProportion.getSyRetailLevel1Proportion()
+                .add(retailProportion.getSyRetailLevel2Proportion())
+                .add(retailProportion.getSyRetailLevel3Proportion());
+
+        //获取非车分销总比例
+        BigDecimal noRetailProportion = retailProportion.getNoRetailLevel1Proportion()
+                .add(retailProportion.getNoRetailLevel2Proportion())
+                .add(retailProportion.getNoRetailLevel3Proportion());
+
+        //重新计算比例  入口是否超出支付的比例
+        ReCalcuLateProportion jqReCalcuLateProportion = recalculateProportion(
+                new BigDecimal(ptlAgreementProductCostsNew.getJqCostsProportion()),
+                jqDeptProportion,
+                jqRetailProportion,
+                taxRadio,
+                retailLevel,
+                ptlAgreementProductCostsExport,
+                retailProportion,
+                "jq",
+                enterProportion
+        );
+
+        ReCalcuLateProportion syReCalcuLateProportion = recalculateProportion(
+                new BigDecimal(ptlAgreementProductCostsNew.getSyCostsProportion()),
+                syDeptProportion,
+                syRetailProportion,
+                taxRadio,
+                retailLevel,
+                ptlAgreementProductCostsExport,
+                retailProportion,
+                "sy",
+                enterProportion
+        );
+
+        ReCalcuLateProportion noReCalcuLateProportion = recalculateProportion(
+                new BigDecimal(ptlAgreementProductCostsNew.getNoCostsProportion()),
+                noDeptProportion,
+                noRetailProportion,
+                taxRadio,
+                retailLevel,
+                ptlAgreementProductCostsExport,
+                retailProportion,
+                "no",
+                enterProportion
+        );
+
+        retailProportion.setProportion(jqReCalcuLateProportion, syReCalcuLateProportion, noReCalcuLateProportion);
+//        ptlAgreementProductCostsExportService.updateById(ptlAgreementProductCostsExport);
+
+
+        //endregion
+
+        //region 计算分销费用
+
+        //分销总比例
+        BigDecimal jqRetailRadio = new BigDecimal("0");
+        BigDecimal syRetailRadio = new BigDecimal("0");
+        BigDecimal noRetailRadio = new BigDecimal("0");
+
+        FeeOrderNewVo.RetailFee retailFeeLevel3 = new FeeOrderNewVo.RetailFee();
+        FeeOrderNewVo.RetailFee retailFeeLevel2 = new FeeOrderNewVo.RetailFee();
+        FeeOrderNewVo.RetailFee retailFeeLevel1 = new FeeOrderNewVo.RetailFee();
+
+        //分销总比例
+        BigDecimal retailRadio = new BigDecimal("0");
+        if (esmRetailList != null && !esmRetailList.isEmpty()) {
+            EsmRetail esmRetail = esmRetailList.get(0);
+
+            if (esmRetail != null) {
+                BigDecimal sumPremium = externalOrderFeeVo.getJqPremium().add(externalOrderFeeVo.getSyPremium()).add(externalOrderFeeVo.getNoPremium());
+                if (Integer.parseInt(esmRetail.getRetailtype()) >= 3) {
+                    retailRadio = retailRadio.add(new BigDecimal(String.valueOf(esmRetail.getDisrate3()))).setScale(2, BigDecimal.ROUND_DOWN);
+                    retailFeeLevel3 = feeRuleSchemeService.calcRetail(
+                            externalOrderFeeVo.getJqPremium(),
+                            externalOrderFeeVo.getJqRadio(),
+                            externalOrderFeeVo.getSyPremium(),
+                            externalOrderFeeVo.getSyRadio(),
+                            externalOrderFeeVo.getNoPremium(),
+                            externalOrderFeeVo.getNoRadio(),
+                            retailProportion.getJqRetailLevel3Proportion(),
+                            retailProportion.getSyRetailLevel3Proportion(),
+                            retailProportion.getNoRetailLevel3Proportion());
+                    //三级分销费用    retailFeeLevel3.getTotalRetailPremiums()
+
+                } else {
+                    //三级分销费用为 空值0
+                }
+                if (Integer.parseInt(esmRetail.getRetailtype()) >= 2) {
+                    retailRadio = retailRadio.add(new BigDecimal(String.valueOf(esmRetail.getDisrate2()))).setScale(2, BigDecimal.ROUND_DOWN);
+                    retailFeeLevel2 = feeRuleSchemeService.calcRetail(
+                            externalOrderFeeVo.getJqPremium(),
+                            externalOrderFeeVo.getJqRadio(),
+                            externalOrderFeeVo.getSyPremium(),
+                            externalOrderFeeVo.getSyRadio(),
+                            externalOrderFeeVo.getNoPremium(),
+                            externalOrderFeeVo.getNoRadio(),
+                            retailProportion.getJqRetailLevel2Proportion(),
+                            retailProportion.getSyRetailLevel2Proportion(),
+                            retailProportion.getNoRetailLevel2Proportion());
+                    //二级分销费用  retailFeeLevel2.getTotalRetailPremiums()
+                } else {
+                    // 空的
+                }
+                if (Integer.parseInt(esmRetail.getRetailtype()) >= 1) {
+                    retailRadio = retailRadio.add(new BigDecimal(String.valueOf(esmRetail.getDisrate1()))).setScale(2, BigDecimal.ROUND_DOWN);
+                    retailFeeLevel1 = feeRuleSchemeService.calcRetail(
+                            externalOrderFeeVo.getJqPremium(),
+                            externalOrderFeeVo.getJqRadio(),
+                            externalOrderFeeVo.getSyPremium(),
+                            externalOrderFeeVo.getSyRadio(),
+                            externalOrderFeeVo.getNoPremium(),
+                            externalOrderFeeVo.getNoRadio(),
+                            retailProportion.getJqRetailLevel1Proportion(),
+                            retailProportion.getSyRetailLevel1Proportion(),
+                            retailProportion.getNoRetailLevel1Proportion());
+
+                    //一级  retailFeeLevel1.getTotalRetailPremiums()
+                } else {
+                    // 空的
+                }
+            } else {
+                //null
+            }
+        } else {
+            // null
+        }
+
+        //endregion
+
+        //region 设置机构管理费
+
+        //交强机构管理费
+        BigDecimal jqDeptRadio =
+                ptlAgreementProductCostsExport.getJqExportRadioLevel1().add(ptlAgreementProductCostsExport.getJqExportRadioLevel2()).add(ptlAgreementProductCostsExport.getJqExportRadioLevel3()).add(ptlAgreementProductCostsExport.getJqExportRadioLevel4()).add(ptlAgreementProductCostsExport.getJqExportRadioLevel5());
+        FeeOrderNewVo.DeptManagerFee jqDeptManagerFee = feeRuleSchemeService.calcDeptManagerFee(externalOrderFeeVo.getJqPremium(),
+                ptlAgreementProductCostsExport.getJqExportRadioLevel1(), ptlAgreementProductCostsExport.getJqExportRadioLevel2(),
+                ptlAgreementProductCostsExport.getJqExportRadioLevel3(), ptlAgreementProductCostsExport.getJqExportRadioLevel4(),
+                ptlAgreementProductCostsExport.getJqExportRadioLevel5());
+
+
+        BigDecimal syDeptRadio =
+                ptlAgreementProductCostsExport.getSyExportRadioLevel1().add(ptlAgreementProductCostsExport.getSyExportRadioLevel2()).add(ptlAgreementProductCostsExport.getSyExportRadioLevel3()).add(ptlAgreementProductCostsExport.getSyExportRadioLevel4()).add(ptlAgreementProductCostsExport.getSyExportRadioLevel5());
+        FeeOrderNewVo.DeptManagerFee syDeptManagerFee = feeRuleSchemeService.calcDeptManagerFee(externalOrderFeeVo.getSyPremium(),
+                ptlAgreementProductCostsExport.getSyExportRadioLevel1(), ptlAgreementProductCostsExport.getSyExportRadioLevel2(),
+                ptlAgreementProductCostsExport.getSyExportRadioLevel3(), ptlAgreementProductCostsExport.getSyExportRadioLevel4(),
+                ptlAgreementProductCostsExport.getSyExportRadioLevel5());
+
+
+        BigDecimal noDeptRadio =
+                ptlAgreementProductCostsExport.getNoCarExportRadioLevel1().add(ptlAgreementProductCostsExport.getNoCarExportRadioLevel2()).add(ptlAgreementProductCostsExport.getNoCarExportRadioLevel3()).add(ptlAgreementProductCostsExport.getNoCarExportRadioLevel4()).add(ptlAgreementProductCostsExport.getNoCarExportRadioLevel5());
+        FeeOrderNewVo.DeptManagerFee noDeptManagerFee = feeRuleSchemeService.calcDeptManagerFee(externalOrderFeeVo.getNoPremium(),
+                ptlAgreementProductCostsExport.getNoCarExportRadioLevel1(), ptlAgreementProductCostsExport.getNoCarExportRadioLevel2(),
+                ptlAgreementProductCostsExport.getNoCarExportRadioLevel3(), ptlAgreementProductCostsExport.getNoCarExportRadioLevel4(),
+                ptlAgreementProductCostsExport.getNoCarExportRadioLevel5());
+
+
+        //endregion
+
+        //region 出口费用
+
+        //交强出口手续费比例
+        FeeOrderNewVo.ExportFee jqExportFee = feeRuleSchemeService.calcExportFee(
+                externalOrderFeeVo.getJqPremium(),
+                new BigDecimal(ptlAgreementProductCostsNew.getJqCostsExportProportion()),
+                externalOrderFeeVo.getJqRadio(),
+                jqDeptRadio,
+                retailRadio,
+                taxRadio,
+                jqReCalcuLateProportion.getProxyProportion());
+
+        //商业出口手续费比例
+        FeeOrderNewVo.ExportFee syExportFee = feeRuleSchemeService.calcExportFee(
+                externalOrderFeeVo.getSyPremium(),
+                new BigDecimal(ptlAgreementProductCostsNew.getSyCostsExportProportion()),
+                externalOrderFeeVo.getSyRadio(),
+                syDeptRadio,
+                retailRadio,
+                taxRadio,
+                syReCalcuLateProportion.getProxyProportion());
+
+        //非车出口手续费比例
+        FeeOrderNewVo.ExportFee noExportFee = feeRuleSchemeService.calcExportFee(
+                externalOrderFeeVo.getNoPremium(),
+                new BigDecimal(ptlAgreementProductCostsNew.getNoCostsExportProportion()),
+                externalOrderFeeVo.getNoRadio(),
+                noDeptRadio,
+                retailRadio,
+                taxRadio,
+                noReCalcuLateProportion.getProxyProportion());
+
+        externalOrderFeeVo.setJqExportPremium(jqExportFee.getTotalAmount());
+        externalOrderFeeVo.setSyExportPremium(syExportFee.getTotalAmount());
+        externalOrderFeeVo.setNoExportPremium(noExportFee.getTotalAmount());
+        //endregion
+
+        return externalOrderFeeVo;
+
+    }
+
     @Override
     public void calcCostsExternalTest(PtlAgreementProductCostsNew ptlAgreementProductCostsNew, InsAreaCompany insAreaCompany) {
         //获取协议信息
@@ -2769,6 +3050,8 @@ public class FeeRuleSchemeServiceNewImpl implements FeeRuleSchemeNewService {
             return selectEqual(ptlAgreementProductCostsAttrLink, value);
         } else if (ptlAgreementUndwrtRulesAttr.getAttrType().equals("radio")) {
             return radioEqual(ptlAgreementProductCostsAttrLink, value);
+        } else if (ptlAgreementUndwrtRulesAttr.getAttrType().equals("datetime")){ // 时间
+            return dateTimeEqual(ptlAgreementProductCostsAttrLink, value);
         }
 
         return false;
@@ -2790,6 +3073,8 @@ public class FeeRuleSchemeServiceNewImpl implements FeeRuleSchemeNewService {
             return selectEqual(ptlAgreementUndwrtRulesAttrLink, value);
         } else if (ptlAgreementUndwrtRulesAttr.getAttrType().equals("radio")) {
             return radioEqual(ptlAgreementUndwrtRulesAttrLink, value);
+        } else if(ptlAgreementUndwrtRulesAttr.getAttrType().equals("datetime")){
+            return dateTimeEqual(ptlAgreementUndwrtRulesAttrLink, value);
         }
         return false;
     }
@@ -3011,6 +3296,82 @@ public class FeeRuleSchemeServiceNewImpl implements FeeRuleSchemeNewService {
         return true;
     }
 
+    public boolean dateTimeEqual(PtlAgreementProductCostsAttrLink ptlAgreementProductCostsAttrLink, String value){
+        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+        if(Objects.isNull(value) || value.equals("")){
+            return false;
+        }
+        LocalDateTime v = LocalDateTime.parse(value,formatter);
+        LocalDateTime min = null,max = null;
+        if(!Objects.isNull(ptlAgreementProductCostsAttrLink.getMin())){
+            min = LocalDateTime.parse(ptlAgreementProductCostsAttrLink.getMin(),formatter);
+        }
+        if(!Objects.isNull(ptlAgreementProductCostsAttrLink.getMax())){
+            max = LocalDateTime.parse(ptlAgreementProductCostsAttrLink.getMax(),formatter);
+        }
+
+        //统一处理数值
+        if ("1".equals(ptlAgreementProductCostsAttrLink.getOperator())) {
+            if (v.isAfter(min) && v.isBefore(max)) {
+                return true;
+            }
+        } else if ("2".equals(ptlAgreementProductCostsAttrLink.getOperator())) {
+            if (v.isBefore(min)) {
+                return true;
+            }
+        } else if ("3".equals(ptlAgreementProductCostsAttrLink.getOperator())) {
+            if (v.isBefore(min)) {
+                return true;
+            }
+        } else if ("4".equals(ptlAgreementProductCostsAttrLink.getOperator())) {
+            if (v.isAfter(max)) {
+                return true;
+            }
+        } else if ("5".equals(ptlAgreementProductCostsAttrLink.getOperator())) {
+            if (v.isAfter(max)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+
+    public boolean dateTimeEqual(PtlAgreementUndwrtRulesAttrLink ptlAgreementUndwrtRulesAttrLink, String value){
+        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+        LocalDateTime v = LocalDateTime.parse(value,formatter);
+        LocalDateTime min = null,max = null;
+        if(!Objects.isNull(ptlAgreementUndwrtRulesAttrLink.getMin())){
+            min = LocalDateTime.parse(ptlAgreementUndwrtRulesAttrLink.getMin(),formatter);
+        }
+        if(!Objects.isNull(ptlAgreementUndwrtRulesAttrLink.getMax())){
+            max = LocalDateTime.parse(ptlAgreementUndwrtRulesAttrLink.getMax(),formatter);
+        }
+
+        //统一处理数值
+        if ("1".equals(ptlAgreementUndwrtRulesAttrLink.getOperator())) {
+            if (!v.isAfter(min) && v.isBefore(max)) {
+                return true;
+            }
+        } else if ("2".equals(ptlAgreementUndwrtRulesAttrLink.getOperator())) {
+            if (!v.isBefore(min)) {
+                return true;
+            }
+        } else if ("3".equals(ptlAgreementUndwrtRulesAttrLink.getOperator())) {
+            if (!v.isBefore(min)) {
+                return true;
+            }
+        } else if ("4".equals(ptlAgreementUndwrtRulesAttrLink.getOperator())) {
+            if (!v.isAfter(max)) {
+                return true;
+            }
+        } else if ("5".equals(ptlAgreementUndwrtRulesAttrLink.getOperator())) {
+            if (!v.isAfter(max)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
     /**
      * 获取车辆新旧车信息
      *

+ 50 - 38
src/main/java/com/ydtech/modules/fnc/service/impl/InsPlyIncomeServiceImpl.java

@@ -38,6 +38,7 @@ import com.ydtech.modules.inv.model.dto.*;
 import com.ydtech.modules.inv.model.excel.*;
 import com.ydtech.modules.inv.utils.CheckInsPlyComeUtils;
 import com.ydtech.modules.inv.utils.EasyExcelUtils;
+import com.ydtech.modules.inv.utils.ImportObjectUtils;
 import com.ydtech.modules.order.entity.BasePageResult;
 import com.ydtech.modules.order.entity.InsOrders;
 import com.ydtech.modules.order.entity.api.dajia.response.NVHLODR1001Response;
@@ -2853,8 +2854,8 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
                 insPlyIncomeLog.setIncomeId(item.getId());
                 insPlyIncomeLogService.saveLog(insPlyIncomeLog);  //添加日志
 
-//                item.setOtherFeevalue(this.calculateTotal(item.getJqOtherCostsPremium(), item.getSyOtherCostsPremium(), null));
-//                item.setOtherFeerate(this.calculateTotal(item.getJqOtherCostsProportion(), item.getSyOtherCostsProportion(), null));
+                item.setOtherFeevalue(this.calculateTotal(item.getJqOtherCostsPremium(), item.getSyOtherCostsPremium(), null));
+                item.setOtherFeerate(this.calculateTotal(item.getJqOtherCostsProportion(), item.getSyOtherCostsProportion(), null));
                 item.setAllFeeValue(this.calculateTotal(item.getJqOtherCostsPremium(), item.getSyOtherCostsPremium(), null));
                 item.setUpdateUserId(BaseController.getUser().getId());
                 item.setUpdateUserName(BaseController.getUser().getName());
@@ -3896,13 +3897,15 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
             //车险手续费
             if(cxsxfList!=null && cxsxfList.size()>0){
                 for(AddTypeCXSXFExcel dto : cxsxfList){
-                    index++;
-                    Map<String, Object> map = CheckInsPlyComeUtils.checkDataDto1(dto);
-                    if(!"".equals(map.get("msg"))){
-                        throw new SystemException("第" + index + "行数据" + map.get("msg").toString());
-                    }else{
-                        InsPlyIncome insPlyIncome = (InsPlyIncome)map.get("dto");
-                        list.add(insPlyIncome);
+                    if(!ImportObjectUtils.allNull(dto)){
+                        index++;
+                        Map<String, Object> map = CheckInsPlyComeUtils.checkDataDto1(dto);
+                        if(!"".equals(map.get("msg"))){
+                            throw new SystemException("第" + index + "行数据" + map.get("msg").toString());
+                        }else{
+                            InsPlyIncome insPlyIncome = (InsPlyIncome)map.get("dto");
+                            list.add(insPlyIncome);
+                        }
                     }
                 }
             }
@@ -3911,13 +3914,15 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
             //车险跟单
             if(cxgdList!=null && cxgdList.size()>0){
                 for(AddTypeCXGDExcel dto : cxgdList){
-                    index++;
-                    Map<String, Object> map = CheckInsPlyComeUtils.checkDataDto2(dto);
-                    if(!"".equals(map.get("msg"))){
-                        throw new SystemException("第" + index + "行数据" + map.get("msg").toString());
-                    }else{
-                        InsPlyIncome insPlyIncome = (InsPlyIncome)map.get("dto");
-                        list.add(insPlyIncome);
+                    if(!ImportObjectUtils.allNull(dto)) {
+                        index++;
+                        Map<String, Object> map = CheckInsPlyComeUtils.checkDataDto2(dto);
+                        if (!"".equals(map.get("msg"))) {
+                            throw new SystemException("第" + index + "行数据" + map.get("msg").toString());
+                        } else {
+                            InsPlyIncome insPlyIncome = (InsPlyIncome) map.get("dto");
+                            list.add(insPlyIncome);
+                        }
                     }
                 }
             }
@@ -3925,13 +3930,15 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
             int index=1;
             if(fcsxfList!=null && fcsxfList.size()>0){
                 for(AddTypeFCSXFExcel dto : fcsxfList){
-                    index++;
-                    Map<String, Object> map = CheckInsPlyComeUtils.checkDataDto3(dto);
-                    if(!"".equals(map.get("msg"))){
-                        throw new SystemException("第" + index + "行数据" + map.get("msg").toString());
-                    }else{
-                        InsPlyIncome insPlyIncome = (InsPlyIncome)map.get("dto");
-                        list.add(insPlyIncome);
+                    if(!ImportObjectUtils.allNull(dto)) {
+                        index++;
+                        Map<String, Object> map = CheckInsPlyComeUtils.checkDataDto3(dto);
+                        if (!"".equals(map.get("msg"))) {
+                            throw new SystemException("第" + index + "行数据" + map.get("msg").toString());
+                        } else {
+                            InsPlyIncome insPlyIncome = (InsPlyIncome) map.get("dto");
+                            list.add(insPlyIncome);
+                        }
                     }
                 }
             }
@@ -3939,13 +3946,16 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
             int index=1;
             if(fcgdList!=null && fcgdList.size()>0){
                 for(AddTypeFCGDExcel dto : fcgdList){
-                    index++;
-                    Map<String, Object> map = CheckInsPlyComeUtils.checkDataDto4(dto);
-                    if(!"".equals(map.get("msg"))){
-                        throw new SystemException("第" + index + "行数据" + map.get("msg").toString());
-                    }else{
-                        InsPlyIncome insPlyIncome = (InsPlyIncome)map.get("dto");
-                        list.add(insPlyIncome);
+                    if(!ImportObjectUtils.allNull(dto)) {
+
+                        index++;
+                        Map<String, Object> map = CheckInsPlyComeUtils.checkDataDto4(dto);
+                        if (!"".equals(map.get("msg"))) {
+                            throw new SystemException("第" + index + "行数据" + map.get("msg").toString());
+                        } else {
+                            InsPlyIncome insPlyIncome = (InsPlyIncome) map.get("dto");
+                            list.add(insPlyIncome);
+                        }
                     }
                 }
             }
@@ -3953,14 +3963,16 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
         else if("5".equals(type)){
             int index=1;
             if(ptjsList!=null && ptjsList.size()>0){
-                for(AddTypePTJSExcel dto : ptjsList){
-                    index++;
-                    Map<String, Object> map = CheckInsPlyComeUtils.checkDataDto5(dto);
-                    if(!"".equals(map.get("msg"))){
-                        throw new SystemException("第" + index + "行数据" + map.get("msg").toString());
-                    }else{
-                        InsPlyIncome insPlyIncome = (InsPlyIncome)map.get("dto");
-                        list.add(insPlyIncome);
+                for(AddTypePTJSExcel dto : ptjsList) {
+                    if (!ImportObjectUtils.allNull(dto)) {
+                        index++;
+                        Map<String, Object> map = CheckInsPlyComeUtils.checkDataDto5(dto);
+                        if (!"".equals(map.get("msg"))) {
+                            throw new SystemException("第" + index + "行数据" + map.get("msg").toString());
+                        } else {
+                            InsPlyIncome insPlyIncome = (InsPlyIncome) map.get("dto");
+                            list.add(insPlyIncome);
+                        }
                     }
                 }
             }

+ 0 - 1
src/main/java/com/ydtech/modules/ins/model/vo/CarInfoVo.java

@@ -10,7 +10,6 @@ import org.hibernate.validator.constraints.Range;
 
 import javax.validation.constraints.Digits;
 import javax.validation.constraints.NotNull;
-import javax.validation.constraints.Past;
 
 /**
  * @author qinfenglong

+ 21 - 0
src/main/java/com/ydtech/modules/inv/utils/ImportObjectUtils.java

@@ -0,0 +1,21 @@
+package com.ydtech.modules.inv.utils;
+import java.lang.reflect.Field;
+public class ImportObjectUtils {
+    public static boolean allNull(Object obj)  {
+        if (obj == null) {
+            return true;
+        }
+        Field[] fields = obj.getClass().getDeclaredFields();
+        for (Field field : fields) {
+            field.setAccessible(true); // 使私有属性也可以访问
+            try {
+                if (field.get(obj) != null) {
+                    return false;
+                }
+            } catch (IllegalAccessException e) {
+                throw new RuntimeException(e);
+            }
+        }
+        return true;
+    }
+}

+ 0 - 2
src/main/java/com/ydtech/modules/order/controller/CarModelController.java

@@ -6,8 +6,6 @@ import com.ydtech.modules.ins.model.ya.CarModelDTO;
 import com.ydtech.modules.order.service.CarModelService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
-import okhttp3.Request;
-import org.apache.http.client.methods.HttpPost;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;

+ 38 - 0
src/main/java/com/ydtech/modules/order/controller/ExternalOrderController.java

@@ -1,10 +1,13 @@
 package com.ydtech.modules.order.controller;
 
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ydtech.constants.enums.InsuranceRisk;
 import com.ydtech.constants.enums.dict.FeeAuditAuditstatus;
+import com.ydtech.constants.enums.dict.agreement.ProductsType;
 import com.ydtech.core.page.HttpResult;
 import com.ydtech.exception.SystemException;
 import com.ydtech.modules.base.controller.BaseController;
+import com.ydtech.modules.fee.service.FeeRuleSchemeNewService;
 import com.ydtech.modules.fnc.entity.InsFeeAudit;
 import com.ydtech.modules.fnc.service.InsFeeAuditService;
 import com.ydtech.modules.ins.model.vo.QuoteRespVo;
@@ -13,6 +16,10 @@ import com.ydtech.modules.order.entity.vo.*;
 import com.ydtech.modules.order.service.InsAreaCompanyExternalPolicyService;
 import com.ydtech.modules.order.service.InsAreaCompanyService;
 import com.ydtech.modules.order.service.InsTaskImagesService;
+import com.ydtech.modules.protocol.entity.po.PtlAgreement;
+import com.ydtech.modules.protocol.service.PtlAgreementService;
+import com.ydtech.modules.protocols.entity.po.PtlAgreementProductCostsNew;
+import com.ydtech.modules.protocols.service.PtlAgreementProductCostsNewService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.RequiredArgsConstructor;
@@ -20,6 +27,8 @@ import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
+import java.util.Objects;
+
 import static com.ydtech.modules.base.model.vo.PageVo.buildPageRequest;
 
 @Api(tags = "外部订单 api")
@@ -43,6 +52,15 @@ public class ExternalOrderController {
     @Autowired
     private InsFeeAuditService insFeeAuditService;
 
+    @Autowired
+    private PtlAgreementService ptlAgreementService;
+
+    @Autowired
+    private PtlAgreementProductCostsNewService ptlAgreementProductCostsNewService;
+
+    @Autowired
+    private FeeRuleSchemeNewService feeRuleSchemeNewService;
+
     @PostMapping("/saveSubOrder")
     @ApiOperation("保存子订单")
     public HttpResult<QuoteRespVo> saveSubOrder(@RequestBody BaseQuoteVo<AccidentalDrivingVo> quoteVo) {
@@ -165,4 +183,24 @@ public class ExternalOrderController {
         Page page = buildPageRequest(rejectPageQueryVo.getPageDto());
         return HttpResult.ok(insAreaCompanyService.getAllRejectOrders(page, rejectPageQueryVo));
     }
+
+    /**
+     * 查询外部订单费用
+     */
+    @PostMapping("/externalOrderFee")
+    @ApiOperation("外部订单费用")
+    public HttpResult<Object> externalOrderFee(@RequestBody ExternalOrderFeeVo externalOrderFeeVo){
+        //校验是否是外部订单的非现询协议
+        PtlAgreement ptlAgreement = ptlAgreementService.getById(externalOrderFeeVo.getAgreementId());
+        ProductsType productsType = InsuranceRisk.determineInsuranceInformation(externalOrderFeeVo.getKinds(), externalOrderFeeVo.getRisks());
+        externalOrderFeeVo.setProductCode(productsType.getCode());
+        PtlAgreementProductCostsNew noInquiryNowFee = ptlAgreementProductCostsNewService.getNoInquiryNowFee(externalOrderFeeVo.getAgreementId(), externalOrderFeeVo.getProductCode());
+        if(Objects.isNull(noInquiryNowFee)){
+            throw new SystemException("不存在该协议");
+        }
+        externalOrderFeeVo.blank();
+        ExternalOrderFeeVo resultExternalOrderFeeVo = feeRuleSchemeNewService.calcCostsExternalExportData(ptlAgreement, noInquiryNowFee, externalOrderFeeVo);
+
+        return HttpResult.ok(resultExternalOrderFeeVo);
+    }
 }

+ 20 - 0
src/main/java/com/ydtech/modules/order/controller/InsOrderReadPdfController.java

@@ -8,11 +8,14 @@ import com.ydtech.modules.admin.model.vo.*;
 import com.ydtech.modules.admin.service.SysUserLinkAreaService;
 import com.ydtech.modules.base.controller.BaseController;
 import com.ydtech.modules.order.entity.BasePageResult;
+import com.ydtech.modules.order.entity.InsOrders;
 import com.ydtech.modules.order.entity.dto.InsOrderReadPdfContentDto;
 import com.ydtech.modules.order.entity.po.InsOrderReadPdf;
 import com.ydtech.modules.order.entity.vo.InsOrderReadPdfContentVo;
 import com.ydtech.modules.order.entity.vo.InsOrderReadPdfVo;
+import com.ydtech.modules.order.entity.vo.OrderQueryVo;
 import com.ydtech.modules.order.service.InsOrderReadPdfService;
+import com.ydtech.modules.order.service.InsOrdersService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiOperation;
@@ -37,6 +40,10 @@ public class InsOrderReadPdfController extends BaseController {
     @Autowired
     private InsOrderReadPdfService insOrderReadPdfService;
 
+    @Autowired
+    private InsOrdersService insOrdersService;
+
+
     @PostMapping("queryPage")
     @ApiOperation(value = "读取保单配置分页")
     public HttpResult<BasePageResult<InsOrderReadPdf>> queryPage(@RequestBody InsOrderReadPdfVo insOrderReadPdfVo) {
@@ -113,4 +120,17 @@ public class InsOrderReadPdfController extends BaseController {
         }
 
     }
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/10/17 10:51
+     *  @Description:  查询已承保的保单数据
+     */
+    @PostMapping("/queryPageOrder")
+    @ApiOperation(value = "查询已承保的保单数据口")
+    public HttpResult<BasePageResult<InsOrders>> queryPageOrderCB(@RequestBody OrderQueryVo orderQueryVo) {
+        orderQueryVo.setOrderStatus("3");//3已承保
+        BasePageResult<InsOrders> quoteResult = insOrdersService.queryPageOrderCB(orderQueryVo);
+        return HttpResult.ok("success", quoteResult);
+    }
 }

+ 15 - 0
src/main/java/com/ydtech/modules/order/controller/QuoteController.java

@@ -31,7 +31,9 @@ import com.ydtech.modules.protocol.entity.constants.PtlApiType;
 import com.ydtech.modules.protocol.entity.dto.TaxSourceExcludeDto;
 import com.ydtech.modules.protocol.entity.po.PtlAgreementAttribution;
 import com.ydtech.modules.protocol.entity.po.PtlTaxSourceNew;
+import com.ydtech.modules.protocol.entity.vo.PtlAgreementQueryVo;
 import com.ydtech.modules.protocol.service.PtlAgreementAttributionService;
+import com.ydtech.modules.protocol.service.PtlAgreementService;
 import com.ydtech.modules.protocol.service.PtlTaxSourceNewService;
 import com.ydtech.modules.protocol.service.impl.TaxSourceExcludeServiceImpl;
 import com.ydtech.utils.StringUtils;
@@ -45,6 +47,8 @@ import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.time.LocalDate;
+import java.time.format.DateTimeFormatter;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Objects;
@@ -106,6 +110,9 @@ public class QuoteController extends BaseController {
     @Autowired
     YongAnOrderService yongAnOrderService;
 
+    @Autowired
+    PtlAgreementService ptlAgreementService;
+
     @QuoteVerification("报价授权")
     @PostMapping(value = "/quote")
     public HttpResult<QuoteRespVo> quote(@RequestBody BaseQuoteVo<Object> quoteVo) throws Exception {
@@ -151,6 +158,14 @@ public class QuoteController extends BaseController {
         }
 
         HttpResult<QuoteRespVo> respVo = null;
+        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+        HttpResult<PtlAgreementQueryVo> byAgreementId = ptlAgreementService.getByAgreementId(quoteVo.getAgreementId());
+        LocalDate currentDate = LocalDate.now();
+        if(byAgreementId.getData().getAgreement().getIsValid().equals("0")  //是否有效
+                || byAgreementId.getData().getAgreement().getValidStatus().equals("0")  //是否有效
+                || !(currentDate.isAfter(byAgreementId.getData().getAgreement().getStartDate()) && currentDate.isBefore(byAgreementId.getData().getAgreement().getEndDate()))){
+            throw new SystemException("协议失效,请检查调度");
+        }
 
         PtlAgreementAttribution ptlAgreementAttribution = ptlAgreementAttributionService.getById(quoteVo.getAgreementId());
 

+ 7 - 1
src/main/java/com/ydtech/modules/order/dao/InsAreaCompanyMapper.java

@@ -377,7 +377,13 @@ public interface InsAreaCompanyMapper extends BaseMapper<InsAreaCompany> {
      * @date: 2024/10/12
      **/
     TaskStatisticsDto getCountBusinessData(@Param("vo") TaskStatisticsVo taskStatisticsVo);
-
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/10/17 10:57
+     *  @Description: 查询已承保的保单数据
+     */
+    Page<InsOrders> queryPageOrderCB(@Param("page") Page<InsAreaCompany> page, @Param("params") OrderQueryVo orderQueryVo);
 }
 
 

+ 112 - 0
src/main/java/com/ydtech/modules/order/entity/vo/ExternalOrderFeeVo.java

@@ -0,0 +1,112 @@
+package com.ydtech.modules.order.entity.vo;
+
+import com.ydtech.modules.ins.model.vo.KindInfoVo;
+import com.ydtech.modules.ins.model.vo.RiskInfoVo;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.util.List;
+import java.util.Objects;
+
+/**
+ * 外部订单费用vo
+ */
+@Data
+public class ExternalOrderFeeVo {
+
+    @ApiModelProperty(value = "协议id")
+    private String agreementId;
+
+    @ApiModelProperty(value = "产品code")
+    private String productCode;
+
+    @ApiModelProperty(value = "待客录单的用户id")
+    private String userId;
+
+    @ApiModelProperty(value = "险种大类")
+    private List<RiskInfoVo> risks;
+
+    @ApiModelProperty(value = "商业险种")
+    private List<KindInfoVo> kinds;
+
+    @ApiModelProperty(value = "交强保费")
+    private BigDecimal jqPremium;
+
+    @ApiModelProperty(value = "不含税交强保费")
+    private BigDecimal jqNoTaxPremium;
+
+    @ApiModelProperty(value = "交强总比例")
+    private BigDecimal jqRadio;
+
+    @ApiModelProperty(value = "商业保费")
+    private BigDecimal syPremium;
+
+    @ApiModelProperty(value = "不含税商业保费")
+    private BigDecimal syNoTaxPremium;
+
+    @ApiModelProperty(value = "商业总比例")
+    private BigDecimal syRadio;
+
+    @ApiModelProperty(value = "驾意保费")
+    private BigDecimal noPremium;
+
+    @ApiModelProperty(value = "不含税驾意保费")
+    private BigDecimal noNoTaxPremium;
+
+    @ApiModelProperty(value = "驾意总比例")
+    private BigDecimal noRadio;
+
+    @ApiModelProperty(value = "交强出口费用")
+    private BigDecimal jqExportPremium;
+
+    @ApiModelProperty(value = "交强出口比例")
+    private BigDecimal jqExportRadio;
+
+    @ApiModelProperty(value = "商业出口费用")
+    private BigDecimal syExportPremium;
+
+    @ApiModelProperty(value = "商业出口比例")
+    private BigDecimal syExportRadio;
+
+    @ApiModelProperty(value = "非车出口费用")
+    private BigDecimal noExportPremium;
+
+    @ApiModelProperty(value = "非车出口比例")
+    private BigDecimal noExportRadio;
+
+    @ApiModelProperty(value = "计算的交强入口比例")
+    private BigDecimal JqCostsProportion;
+
+    @ApiModelProperty(value = "计算的商业入口比例")
+    private BigDecimal syCostsProportion;
+
+    @ApiModelProperty(value = "计算的非车入口比例")
+    private BigDecimal NoCostsProportion;
+
+
+    public void blank(){
+        if(Objects.isNull(this.jqPremium)){
+            this.jqPremium = new BigDecimal(BigInteger.ZERO);
+        }
+        if(Objects.isNull(this.syPremium)){
+            this.syPremium = new BigDecimal(BigInteger.ZERO);
+        }
+        if(Objects.isNull(this.noPremium)){
+            this.noPremium = new BigDecimal(BigInteger.ZERO);
+        }
+
+        if(Objects.isNull(this.jqRadio)){
+            this.jqRadio = new BigDecimal(BigInteger.ZERO);
+        }
+        if(Objects.isNull(this.syRadio)){
+            this.syRadio = new BigDecimal(BigInteger.ZERO);
+        }
+        if(Objects.isNull(this.noRadio)){
+            this.noRadio = new BigDecimal(BigInteger.ZERO);
+        }
+
+    }
+
+}

+ 5 - 0
src/main/java/com/ydtech/modules/order/entity/vo/InsOrdersEditingVo.java

@@ -90,6 +90,9 @@ public class InsOrdersEditingVo extends InsOrders implements Serializable {
     @ApiModelProperty("规则过滤完后的保险公司")
     private List<PtlAgreementInsCompanyDto> companyDtos;
 
+    @ApiModelProperty("现询费用id")
+    private String nowCostsId;
+
     @Data
     @AllArgsConstructor
     @NoArgsConstructor
@@ -266,6 +269,8 @@ public class InsOrdersEditingVo extends InsOrders implements Serializable {
         @ApiModelProperty("接口类型")
         private String apiType;
 
+
+
         public void feeVacant() {
             this.jqExportFee = null;
             this.syExportFee = null;

+ 7 - 0
src/main/java/com/ydtech/modules/order/service/InsAreaCompanyService.java

@@ -267,4 +267,11 @@ public interface InsAreaCompanyService extends IService<InsAreaCompany> {
      * @return
      */
     boolean updateFeeMatchErrMsg(String companyId,String feeMatchErrMsg);
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/10/17 10:55
+     *  @Description: 查詢已承保的保单数据
+     */
+    Page<InsOrders> queryPageOrderCB(Page<InsAreaCompany> page, OrderQueryVo orderQueryVo);
 }

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

@@ -281,5 +281,11 @@ public interface InsOrdersService extends IService<InsOrders> {
      * @return
      */
     boolean responseFailedOrder(BaseQuoteVo quoteVo, PtlAgreementAttribution ptlAgreementAttribution, InsOrders insOrder, String errorMessage, InsOrderStatusEnum statusEnum);
-
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/10/17 10:52
+     *  @Description: 查詢已承保的保单数据
+     */
+    BasePageResult<InsOrders> queryPageOrderCB(OrderQueryVo orderQueryVo);
 }

+ 1 - 0
src/main/java/com/ydtech/modules/order/service/impl/InsAreaCompanyServiceImpl.java

@@ -846,6 +846,7 @@ public class InsAreaCompanyServiceImpl extends ServiceImpl<InsAreaCompanyMapper,
         agreementProductQueryVo.setProductCode(productId);
         agreementProductQueryVo.setIsAudit("1");
         agreementProductQueryVo.setAgreementId(ptlAgreement.getId());
+        agreementProductQueryVo.setNowCostsId(insOrdersEditingVo.getNowCostsId());
 
         List<PtlAgreementProductCostsNew> costsNews = ptlAgreementProductCostsNewService.getByAgreementId(agreementProductQueryVo);
 

+ 1 - 2
src/main/java/com/ydtech/modules/order/service/impl/InsCrawlerOrderServiceImpl.java

@@ -1,7 +1,6 @@
 package com.ydtech.modules.order.service.impl;
 
 import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.ydtech.constants.enums.InsurKind;
@@ -295,7 +294,7 @@ public class InsCrawlerOrderServiceImpl implements InsCrawlerOrderService {
 
         // 支付时间
         if (StringUtils.isNotEmpty(response.getPaytime())) {
-            insAreaCompany.setPayDate(LocalDateTime.parse(response.getPaytime(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
+            insAreaCompany.setPayDate(LocalDateTime.parse(response.getPaytime().trim(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
             insAreaCompanyService.updateById(insAreaCompany);
         }
 

+ 24 - 0
src/main/java/com/ydtech/modules/order/service/impl/InsOrdersServiceImpl.java

@@ -2168,6 +2168,30 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
         insAreaCompanyService.insertCompanyAndOrders(insAreaCompany, insAreaCompanyAccidentalDriving);
         return true;
     }
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/10/17 10:53
+     *  @Description:  查詢已承保
+     */
+    @Override
+    public BasePageResult<InsOrders> queryPageOrderCB(OrderQueryVo orderQueryVo) {
+        Page<InsAreaCompany> page = PageRequest.buildPageRequest(orderQueryVo.getPageRequest());
+        Page<InsOrders> resultOrders;
+        resultOrders = insAreaCompanyService.queryPageOrderCB(page, orderQueryVo);
+        //查找机构来源字典 遍历
+        Map<String, DictionaryManagement> m = DictEnumConfig.getDmMap();
+        DictionaryManagement organizationSource = m.get("organizationSource");
+        resultOrders.getRecords().forEach(item -> {
+            DictionaryData dictionaryData = organizationSource.getDdList().stream().filter(x -> x.getDictValue().equals(item.getManagementSource())).findFirst().orElse(null);
+            if (dictionaryData != null) {
+                item.setManagementSource(dictionaryData.getDictTag());
+            }
+        });
+        return new BasePageResult<>(resultOrders.getCurrent(), page.getSize(), resultOrders.getTotal(),
+                resultOrders.getPages(),
+                resultOrders.getRecords());
+    }
 
     /**
      * 更新订单的起保与终保时间

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

@@ -130,4 +130,6 @@ public interface PtlAgreementProductCostsNewService extends IService<PtlAgreemen
      * @return
      */
     List<PtlAgreementProductCostsNew> getInquiryNowFee(InquiryNowFeeQueryVo inquiryNowFeeQueryVo);
+
+    PtlAgreementProductCostsNew getNoInquiryNowFee(String agreementId,String productCode);
 }

+ 18 - 0
src/main/java/com/ydtech/modules/protocols/service/impl/PtlAgreementProductCostsNewServiceImpl.java

@@ -2387,4 +2387,22 @@ public class PtlAgreementProductCostsNewServiceImpl extends ServiceImpl<PtlAgree
 
         return ptlAgreementProductCostsNews;
     }
+
+    @Override
+    public PtlAgreementProductCostsNew getNoInquiryNowFee(String agreementId, String productCode) {
+
+        LambdaQueryWrapper<PtlAgreementProductCostsNew> queryWrapper = new LambdaQueryWrapper<>();
+
+        queryWrapper.lt(PtlAgreementProductCostsNew::getCostsStartDate, LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
+        queryWrapper.gt(PtlAgreementProductCostsNew::getCostsEndDate, LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
+
+        queryWrapper.eq(PtlAgreementProductCostsNew::getIsAudit, "1");
+        queryWrapper.eq(PtlAgreementProductCostsNew::getIsInquiryNow, "0");
+
+        queryWrapper.eq(PtlAgreementProductCostsNew::getAgreementId, agreementId);
+        queryWrapper.eq(PtlAgreementProductCostsNew::getProductId, productCode);
+
+        PtlAgreementProductCostsNew ptlAgreementProductCostsNews = baseMapper.selectOne(queryWrapper);
+        return ptlAgreementProductCostsNews;
+    }
 }

+ 21 - 0
src/main/java/com/ydtech/modules/scheme/aop/RuleTrajectory.java

@@ -0,0 +1,21 @@
+package com.ydtech.modules.scheme.aop;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * 规则轨迹注解
+ */
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.METHOD)
+public @interface RuleTrajectory {
+
+    String type() default "规则轨迹";
+
+}
+
+
+

+ 197 - 0
src/main/java/com/ydtech/modules/scheme/aop/aspect/RuleTrajectoryAspect.java

@@ -0,0 +1,197 @@
+package com.ydtech.modules.scheme.aop.aspect;
+
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.ydtech.constants.enums.InsuranceRisk;
+import com.ydtech.constants.enums.dict.agreement.ProductsType;
+import com.ydtech.constants.sys.SystemConstant;
+import com.ydtech.core.page.HttpResult;
+import com.ydtech.exception.SystemException;
+import com.ydtech.modules.admin.model.SysUser;
+import com.ydtech.modules.admin.model.SysUserRole;
+import com.ydtech.modules.admin.service.SysUserRoleService;
+import com.ydtech.modules.admin.service.SysUserService;
+import com.ydtech.modules.base.controller.BaseController;
+import com.ydtech.modules.esm.model.EsmInsCompany;
+import com.ydtech.modules.esm.service.EsmInsCompanyService;
+import com.ydtech.modules.fee.service.CostsCalcService;
+import com.ydtech.modules.fee.service.FeeDisplayService;
+import com.ydtech.modules.fee.service.FeeRuleSchemeNewService;
+import com.ydtech.modules.ins.model.vo.KindInfoVo;
+import com.ydtech.modules.ins.model.vo.QuoteRespVo;
+import com.ydtech.modules.ins.model.vo.RiskInfoVo;
+import com.ydtech.modules.order.components.InsOrdersComponents;
+import com.ydtech.modules.order.entity.InsAreaCompany;
+import com.ydtech.modules.order.entity.InsAreaCompanyAccidentalDriving;
+import com.ydtech.modules.order.entity.InsOrders;
+import com.ydtech.modules.order.entity.po.InsAreaCompanyError;
+import com.ydtech.modules.order.entity.vo.BaseQuoteInfoVo;
+import com.ydtech.modules.order.entity.vo.BaseQuoteVo;
+import com.ydtech.modules.order.entity.vo.SubOrderExportFeeVo;
+import com.ydtech.modules.order.service.InsAreaCompanyAccidentalDrivingService;
+import com.ydtech.modules.order.service.InsAreaCompanyErrorService;
+import com.ydtech.modules.order.service.InsAreaCompanyService;
+import com.ydtech.modules.order.service.InsOrdersService;
+import com.ydtech.modules.protocol.constants.TaxSourceStatusConstants;
+import com.ydtech.modules.protocol.dao.PtlTaxSourceNewMapper;
+import com.ydtech.modules.protocol.entity.dto.TaxSourceExcludeDto;
+import com.ydtech.modules.protocol.entity.po.PtlAgreement;
+import com.ydtech.modules.protocol.entity.po.PtlTaxSourceNew;
+import com.ydtech.modules.protocol.service.ITaxSourceExcludeService;
+import com.ydtech.modules.protocol.service.PtlAgreementDeptService;
+import com.ydtech.modules.protocol.service.PtlAgreementService;
+import com.ydtech.modules.protocol.service.PtlTaxSourceNewService;
+import com.ydtech.modules.protocol.service.impl.TaxSourceServiceImpl;
+import com.ydtech.modules.protocols.entity.po.InsFeeOrderNew;
+import com.ydtech.modules.protocols.service.InsFeeOrderNewService;
+import com.ydtech.modules.scheme.aop.RuleTrajectory;
+import com.ydtech.modules.scheme.constants.ExecuteStatusConstant;
+import com.ydtech.modules.scheme.entity.po.PtlSchemeRulesAttr;
+import com.ydtech.modules.scheme.entity.po.PtlSchemeRulesTrajectory;
+import com.ydtech.modules.scheme.entity.vo.RuleResultVo;
+import com.ydtech.modules.scheme.entity.vo.RuleSaveVo;
+import com.ydtech.modules.scheme.service.PtlSchemeRulesAttrService;
+import com.ydtech.modules.scheme.service.PtlSchemeRulesService;
+import com.ydtech.modules.scheme.service.PtlSchemeRulesTrajectoryService;
+import com.ydtech.utils.StringUtils;
+import com.ydtech.utils.idgen.IdGenerate;
+import lombok.RequiredArgsConstructor;
+import org.aspectj.lang.JoinPoint;
+import org.aspectj.lang.annotation.AfterReturning;
+import org.aspectj.lang.annotation.AfterThrowing;
+import org.aspectj.lang.annotation.Aspect;
+import org.aspectj.lang.annotation.Before;
+import org.aspectj.lang.reflect.MethodSignature;
+import org.dom4j.rule.Rule;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.time.LocalDateTime;
+import java.util.*;
+
+@Aspect
+@Component
+@RequiredArgsConstructor
+public class RuleTrajectoryAspect {
+
+    @Autowired
+    PtlSchemeRulesTrajectoryService ptlSchemeRulesTrajectoryService;
+
+    @Autowired
+    PtlSchemeRulesService ptlSchemeRulesService;
+
+    @Autowired
+    PtlSchemeRulesAttrService ptlSchemeRulesAttrService;
+
+    private ThreadLocal<MethodContext> methodContext = new ThreadLocal<>();
+
+    @AfterReturning(pointcut = "@annotation(com.ydtech.modules.scheme.aop.RuleTrajectory)",returning = "result")
+    public void doAfter(JoinPoint joinPoint,HttpResult result) {
+        MethodContext context = methodContext.get();
+        if (context != null) {
+            // 在这里验证结果
+            String methodName = context.getMethodName();
+            if(joinPoint.getSignature().getName().equals(methodName)){
+                if(Objects.isNull(context.getId())){
+                    throw new SystemException("线程上下文异常,请重试");
+                }
+                PtlSchemeRulesTrajectory byId = ptlSchemeRulesTrajectoryService.getById(context.getId());
+                if(result.getCode() == 200){
+                    if(byId.getOperatorType().equals("C")){
+                        JSONObject jsonObject = JSON.parseObject(result.getData().toString());
+                        byId.setRuleId(jsonObject.getString("ruleId"));
+                    }
+                    byId.setExecuteStatus(ExecuteStatusConstant.ES1.getCode());
+                }else{
+                    byId.setExecuteStatus(ExecuteStatusConstant.ES2.getCode());
+                    byId.setErrorMsg(result.getMsg());
+                }
+                ptlSchemeRulesTrajectoryService.updateById(byId);
+            }
+        }
+        // 清除上下文
+        methodContext.remove();
+    }
+
+    //拦截异常消息
+    @AfterThrowing(pointcut = "@annotation(com.ydtech.modules.scheme.aop.RuleTrajectory)", throwing = "ex")
+    public void doAfterThrowing(JoinPoint joinPoint, Throwable ex) {
+        MethodContext context = methodContext.get();
+        if (context != null) {
+            String methodName = context.getMethodName();
+            if(joinPoint.getSignature().getName().equals(methodName)){
+                PtlSchemeRulesTrajectory byId = ptlSchemeRulesTrajectoryService.getById(context.getId());
+                byId.setExecuteStatus(ExecuteStatusConstant.ES2.getCode());
+                byId.setErrorMsg(ex.getMessage());
+                ptlSchemeRulesTrajectoryService.updateById(byId);
+            }
+        }
+        // 清除上下文
+        methodContext.remove();
+    }
+
+    @Before("@annotation(ruleTrajectory)")
+    public void doBefore(JoinPoint point,  RuleTrajectory ruleTrajectory) {
+        RuleSaveVo ruleSaveVo = null;
+        String ruleId = null;
+        if(ruleTrajectory.type().equals("C") || ruleTrajectory.type().equals("U")) {
+            //强转参数
+            ruleSaveVo = (RuleSaveVo) point.getArgs()[0];
+        }else if(ruleTrajectory.type().equals("D")){
+            ruleId = point.getArgs()[0].toString();
+        }
+        PtlSchemeRulesTrajectory trajectory = new PtlSchemeRulesTrajectory(ruleSaveVo);
+        trajectory.setId(IdGenerate.nextId());
+        trajectory.setOperatorType(ruleTrajectory.type());
+        List<PtlSchemeRulesAttr> schemeRulesAttrs = null;
+        RuleResultVo rulesInfoById = null;
+        switch(ruleTrajectory.type()){
+            //创建
+            case "C":
+                ptlSchemeRulesTrajectoryService.save(trajectory);
+                break;
+            //更新
+            case "U":
+                schemeRulesAttrs = ptlSchemeRulesAttrService.getRulesAttrList();
+                rulesInfoById = ptlSchemeRulesAttrService.getRulesInfoById(ruleSaveVo.getRule().getId(), schemeRulesAttrs);
+                trajectory.setBeforeJson(JSON.toJSONString(rulesInfoById));
+                trajectory.setRuleId(rulesInfoById.getId());
+                ptlSchemeRulesTrajectoryService.save(trajectory);
+                break;
+            //删除
+            case "D":
+                schemeRulesAttrs = ptlSchemeRulesAttrService.getRulesAttrList();
+                rulesInfoById = ptlSchemeRulesAttrService.getRulesInfoById(ruleId, schemeRulesAttrs);
+                trajectory.setBeforeJson(JSON.toJSONString(rulesInfoById));
+                trajectory.setRuleId(rulesInfoById.getId());
+                ptlSchemeRulesTrajectoryService.save(trajectory);
+                break;
+
+        }
+        // 用于验证上下文
+        methodContext.set(new MethodContext(point.getSignature().getName(), trajectory.getId()));
+    }
+
+
+    private static class MethodContext {
+        private final String methodName;
+        private final String id;
+
+        public MethodContext(String methodName, String id) {
+            this.methodName = methodName;
+            this.id = id;
+        }
+
+        public String getMethodName() {
+            return methodName;
+        }
+
+        public String getId() {
+            return id;
+        }
+    }
+}

+ 21 - 0
src/main/java/com/ydtech/modules/scheme/constants/ExecuteStatusConstant.java

@@ -0,0 +1,21 @@
+package com.ydtech.modules.scheme.constants;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+
+@AllArgsConstructor
+@Getter
+public enum ExecuteStatusConstant {
+
+    ES0(0, "提交"),
+    ES1(1, "成功"),
+    ES2(2, "失败");
+
+    private final Integer code;
+
+    private final String desc;
+
+
+
+}

+ 16 - 3
src/main/java/com/ydtech/modules/scheme/controller/PtlSchemeController.java

@@ -20,6 +20,7 @@ import com.ydtech.modules.order.service.InsDrivingIntentionInsuranceService;
 import com.ydtech.modules.order.service.InsDrivingIntentionInsuranceTypeService;
 import com.ydtech.modules.protocol.service.ITaxSourceService;
 import com.ydtech.modules.protocols.service.PtlAgreementUndwrtRulesAttrService;
+import com.ydtech.modules.scheme.aop.RuleTrajectory;
 import com.ydtech.modules.scheme.entity.po.*;
 import com.ydtech.modules.scheme.entity.vo.*;
 import com.ydtech.modules.scheme.service.*;
@@ -107,6 +108,7 @@ public class PtlSchemeController extends BaseController {
         return HttpResult.ok(rulesInfoById);
     }
 
+    @RuleTrajectory(type="C")
     @ApiOperation(value = "添加规则")
     @PostMapping("/ruleAdd")
     public HttpResult ruleAdd(@RequestBody RuleSaveVo ruleSaveVo){
@@ -139,11 +141,21 @@ public class PtlSchemeController extends BaseController {
             newAttrs.add(PtlSchemeRulesAttrLink.carNature(ruleSaveVo.getRule().getCarnature()));
         }
         ruleSaveVo.setAttrs(newAttrs);
-        return ptlSchemeRulesService.addRules(ruleSaveVo) ?
-                HttpResult.ok("添加规则成功"):
-                HttpResult.error("添加规则成功");
+        int ruleId = ptlSchemeRulesService.addRules(ruleSaveVo);
+        HttpResult<JSONObject> httpResult;
+        JSONObject result = new JSONObject();
+        if(ruleId > 0) {
+            result.put("ruleId", ruleId);
+            result.put("msg", "添加规则成功");
+            httpResult = HttpResult.ok(result);
+        }else{
+            result.put("msg","添加规则失败");
+            httpResult = HttpResult.error(result);
+        }
+        return httpResult;
     }
 
+    @RuleTrajectory(type="U")
     @ApiOperation(value = "修改规则")
     @PostMapping("/ruleUpdate")
     public HttpResult ruleUpdate(@RequestBody RuleSaveVo ruleSaveVo){
@@ -191,6 +203,7 @@ public class PtlSchemeController extends BaseController {
                 HttpResult.error("修改规则失败");
     }
 
+    @RuleTrajectory(type="D")
     @ApiOperation(value = "删除规则")
     @PostMapping("/ruleDelete")
     public HttpResult ruleDelete(@RequestSingleParam("ruleId") String ruleId){

+ 35 - 0
src/main/java/com/ydtech/modules/scheme/controller/SchemeTrajectoryController.java

@@ -0,0 +1,35 @@
+package com.ydtech.modules.scheme.controller;
+
+
+import com.ydtech.aop.request.RequestSingleParam;
+import com.ydtech.core.page.HttpResult;
+import com.ydtech.exception.SystemException;
+import com.ydtech.modules.scheme.aop.RuleTrajectory;
+import com.ydtech.modules.scheme.service.PtlSchemeRulesTrajectoryService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.Objects;
+
+@Api(tags = "方案轨迹管理")
+@RequestMapping("/plt/scheme/trajectory")
+@RestController
+public class SchemeTrajectoryController {
+
+    @Autowired
+    PtlSchemeRulesTrajectoryService ptlSchemeRulesTrajectoryService;
+
+    @ApiOperation(value = "获取规则轨迹")
+    @PostMapping("/ruleTrajectory")
+    public HttpResult ruleTrajectory(@RequestSingleParam("ruleId") String ruleId){
+        if(Objects.isNull(ruleId) || ruleId.isEmpty()){
+            throw new SystemException("参数出错");
+        }
+        return HttpResult.ok(ptlSchemeRulesTrajectoryService.getRuleTrajectory(ruleId));
+    }
+
+}

+ 19 - 0
src/main/java/com/ydtech/modules/scheme/dao/PtlSchemeRulesTrajectoryMapper.java

@@ -0,0 +1,19 @@
+package com.ydtech.modules.scheme.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ydtech.modules.scheme.entity.po.PtlOptionalScheme;
+import com.ydtech.modules.scheme.entity.po.PtlSchemeRulesTrajectory;
+
+
+/**
+ * @author tz
+ * @description 自选方案mapper
+ * @createDate 2024年8月13日14:52:04
+ */
+public interface PtlSchemeRulesTrajectoryMapper extends BaseMapper<PtlSchemeRulesTrajectory> {
+
+}
+
+
+
+

+ 81 - 0
src/main/java/com/ydtech/modules/scheme/entity/po/PtlSchemeRulesTrajectory.java

@@ -0,0 +1,81 @@
+package com.ydtech.modules.scheme.entity.po;
+
+import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.ydtech.modules.base.controller.BaseController;
+import com.ydtech.modules.scheme.constants.ExecuteStatusConstant;
+import com.ydtech.modules.scheme.entity.vo.RuleSaveVo;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.time.LocalDateTime;
+
+/**
+ * 方案规则属性
+ */
+@TableName(value = "ptl_scheme_rules_trajectory", autoResultMap = true)
+@Data
+public class PtlSchemeRulesTrajectory {
+
+    @TableId(value = "id", type = com.baomidou.mybatisplus.annotation.IdType.AUTO)
+    private String id;
+
+    @ApiModelProperty(value = "规则id")
+    @TableField(value = "rule_id")
+    private String ruleId;
+
+    @ApiModelProperty(value = "修改之前的数据")
+    @TableField(value = "before_json")
+    private String beforeJson;
+
+    @ApiModelProperty(value = "修改之后的数据")
+    @TableField(value = "after_json")
+    private String afterJson;
+
+    @ApiModelProperty(value = "操作人id")
+    @TableField(value = "operator_user")
+    private String operatorUser;
+
+    @ApiModelProperty(value = "操作人名称")
+    @TableField(value = "operator_user_name")
+    private String operatorUserName;
+
+    @ApiModelProperty(value = "操作时间")
+    @TableField(value = "operator_time")
+    private String operatorTime;
+
+    @ApiModelProperty(value = "操作类型")
+    @TableField(value = "operator_type")
+    private String operatorType;
+
+    @ApiModelProperty(value = "操作类型名称")
+    @TableField(exist = false)
+    private String operatorTypeName;
+
+    @ApiModelProperty(value = "执行状态")
+    @TableField(value = "execute_status")
+    private Integer executeStatus;
+
+    @ApiModelProperty(value = "失败消息")
+    @TableField(value = "error_msg")
+    private String errorMsg;
+
+    public PtlSchemeRulesTrajectory(){
+        this.setOperatorUser(BaseController.getUserId());
+        this.setOperatorUserName(BaseController.getUserName());
+        this.setOperatorTime(LocalDateTime.now().toString());
+        this.setExecuteStatus(ExecuteStatusConstant.ES0.getCode());
+    }
+
+    public PtlSchemeRulesTrajectory(RuleSaveVo ruleTrajectory) {
+        this.setAfterJson(JSON.toJSONString(ruleTrajectory));
+        this.setOperatorUser(BaseController.getUserId());
+        this.setOperatorUserName(BaseController.getUserName());
+        this.setOperatorTime(LocalDateTime.now().toString());
+        this.setExecuteStatus(ExecuteStatusConstant.ES0.getCode());
+    }
+
+
+}

+ 1 - 1
src/main/java/com/ydtech/modules/scheme/service/PtlSchemeRulesService.java

@@ -24,7 +24,7 @@ public interface PtlSchemeRulesService extends IService<PtlSchemeRules> {
      * @param ruleSaveVo
      * @return
      */
-    boolean addRules(RuleSaveVo ruleSaveVo);
+    int addRules(RuleSaveVo ruleSaveVo);
 
     /**
      * 修改规则

+ 22 - 0
src/main/java/com/ydtech/modules/scheme/service/PtlSchemeRulesTrajectoryService.java

@@ -0,0 +1,22 @@
+package com.ydtech.modules.scheme.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ydtech.modules.scheme.entity.po.PtlSchemeRulesTrajectory;
+
+import java.util.List;
+
+/**
+*@author: tz
+*@description: 规则轨迹 service
+*@create: 2024-8-13 14:53:39
+*/
+public interface PtlSchemeRulesTrajectoryService extends IService<PtlSchemeRulesTrajectory> {
+
+    /**
+     * 获取规则轨迹列表
+     * @param ruleId
+     * @return
+     */
+    List<PtlSchemeRulesTrajectory> getRuleTrajectory(String ruleId);
+
+}

+ 2 - 2
src/main/java/com/ydtech/modules/scheme/service/impl/PtlSchemeRulesServiceImpl.java

@@ -66,7 +66,7 @@ public class PtlSchemeRulesServiceImpl extends ServiceImpl<PtlSchemeRulesMapper,
      */
     @Override
     @Transactional
-    public boolean addRules(RuleSaveVo ruleSaveVo){
+    public int addRules(RuleSaveVo ruleSaveVo){
         //保存 方案
         PtlSchemeRules rule = ruleSaveVo.getRule();
         this.baseMapper.insert(rule);
@@ -76,7 +76,7 @@ public class PtlSchemeRulesServiceImpl extends ServiceImpl<PtlSchemeRulesMapper,
             attr.setRulesId(String.valueOf(rule.getId()));
         });
         ptlSchemeRulesAttrLinkService.saveBatch(attrs);
-        return true;
+        return Integer.parseInt(rule.getId());
     }
 
 

+ 53 - 0
src/main/java/com/ydtech/modules/scheme/service/impl/PtlSchemeRulesTrajectoryServiceImpl.java

@@ -0,0 +1,53 @@
+package com.ydtech.modules.scheme.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ydtech.modules.ins.model.vo.KindInfoVo;
+import com.ydtech.modules.scheme.dao.PtlSchemeInsuranceMapper;
+import com.ydtech.modules.scheme.dao.PtlSchemeRulesTrajectoryMapper;
+import com.ydtech.modules.scheme.entity.po.PtlSchemeInsurance;
+import com.ydtech.modules.scheme.entity.po.PtlSchemeRulesTrajectory;
+import com.ydtech.modules.scheme.entity.vo.SchemeKindInfoVo;
+import com.ydtech.modules.scheme.entity.vo.SchemeSaveVo;
+import com.ydtech.modules.scheme.service.PtlSchemeInsuranceService;
+import com.ydtech.modules.scheme.service.PtlSchemeRulesTrajectoryService;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * @description 方案规则轨迹 service实现类
+ * @createDate 2024-10-16 17:28:20
+ * @Entity
+ */
+@Service
+public class PtlSchemeRulesTrajectoryServiceImpl extends ServiceImpl<PtlSchemeRulesTrajectoryMapper, PtlSchemeRulesTrajectory>
+        implements PtlSchemeRulesTrajectoryService {
+
+    /**
+     * 获取规则轨迹列表
+     * @param ruleId
+     * @return
+     */
+    @Override
+    public List<PtlSchemeRulesTrajectory> getRuleTrajectory(String ruleId) {
+        List<PtlSchemeRulesTrajectory> list = this.list(new LambdaQueryWrapper<PtlSchemeRulesTrajectory>()
+                .eq(PtlSchemeRulesTrajectory::getRuleId, ruleId)
+                .eq(PtlSchemeRulesTrajectory::getExecuteStatus, 1)
+                .orderByAsc(PtlSchemeRulesTrajectory::getOperatorTime));
+        //清空提交的数据
+        list.forEach(item->{
+            item.setBeforeJson(null);
+            item.setAfterJson(null);
+            if(item.getOperatorType().equals("C")){
+                item.setOperatorTypeName("创建");
+            }else if(item.getOperatorType().equals("U")){
+                item.setOperatorTypeName("修改");
+            }else if(item.getOperatorType().equals("D")){
+                item.setOperatorTypeName("删除");
+            }
+        });
+
+        return list;
+    }
+}

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

@@ -1905,8 +1905,8 @@
         SELECT
             io.licenseno as "licenseno",
             iac.createtime as "createTime",
-            iac.audittime as "auditTime",
-            IFNULL(TIMESTAMPDIFF(SECOND, iac.createtime, iac.audittime),0) as "timeDifference"
+            ifa.audittime as "auditTime",
+            IFNULL(TIMESTAMPDIFF(SECOND, iac.createtime, ifa.audittime),0) as "timeDifference"
         FROM
             ins_fee_audit ifa
             LEFT JOIN ins_orders io ON io.orderno = ifa.orderno
@@ -3146,5 +3146,141 @@
         </if>
         order by  io.createtime
     </select>
+    <select id="queryPageOrderCB" resultType="com.ydtech.modules.order.entity.InsOrders">
+        SELECT
+        iac.id as orderno,
+        io.quoteno,
+        io.orderstatus,
+        io.company_id,
+        io.ins_company,
+        io.carinfo,
+        io.userid,
+        io.username,
+        io.deptid,
+        io.deptname,
+        io.agreeid,
+        iac.productid,
+        iac.product,
+        iac.createtime,
+        io.frameno,
+        io.licenseno,
+        JSON_UNQUOTE(json_extract(io.insureinfo, '$.name')) as insuredname,
+        io.is_external,
+        iac.jq_start_date as jqstartdate,
+        iac.jq_end_date as jqenddate,
+        iac.sy_start_date as systartdate,
+        iac.sy_end_date as syenddate,
+        io.vehicle_and_vessel_tax,
+        io.operatorid,
+        iac.operator_name,
+        sd.management_source,
+        iac.problem_order,
+        eic.namesimple as partnerCompaniesName,
+        iac.id as subOrderId,
+        iac.signing_time as signingTime,
+        iac.pay_date as payDate,
+        pa.agreement_code as agreementCode,
+        pa.agreement_name as agreementName,
+        pa.business_description as businessDescription,
+        pa.job_description as jobDescription,
+        pa.agreement_title as agreementTitle,
+        pa.docking_person as dockingPerson,
+        io.entry_status
+        FROM
+        ins_area_company iac
+        LEFT JOIN ins_orders io ON iac.orderno = io.orderno
+        LEFT JOIN sys_user su ON su.id = io.userid
+        LEFT JOIN sys_dept sd ON sd.id = su.dept_id
+        LEFT JOIN ptl_agreement pa ON pa.id = iac.agreement_id
+        LEFT JOIN esm_ins_company eic ON eic.id = pa.partner_companies_id
+        WHERE
+        iac.orderstatus = 3
+        <if test="params.quoteStartDateStr != null and params.quoteStartDateStr != '' and params.quoteEndDateStr != null and params.quoteEndDateStr != ''">
+            and DATE_FORMAT(iac.createtime, '%Y-%m-%d') between #{params.quoteStartDateStr} AND
+            #{params.quoteEndDateStr}
+        </if>
+        <if test="params.orderNo != null and params.orderNo != ''">
+            AND iac.id= #{params.orderNo}
+        </if>
+        <if test="params.licenseNo != null and params.licenseNo != ''">
+            AND io.licenseno = #{params.licenseNo}
+        </if>
+        <if test="params.frameNo != null and params.frameNo != ''">
+            AND io.frameno = #{params.frameNo}
+        </if>
+        <if test="params.insuredName != null and params.insuredName != ''">
+            AND json_extract(io.insureinfo, '$.name') = #{params.insuredName}
+        </if>
+        <if test="params.companyId != null and params.companyId != ''">
+            AND io.company_id = #{params.companyId}
+        </if>
+        <if test="params.engineNo != null and params.engineNo != ''">
+            and JSON_EXTRACT( io.carinfo, '$.engineNo' ) = #{params.engineNo}
+        </if>
+        <if test="params.riskCode != null and params.riskCode != ''">
+            and iac.product = #{params.riskCode}
+        </if>
+
+        <if test="params.attachStartDateStr != null and params.attachStartDateStr != '' and params.attachStartDateStr != null and params.attachStartDateStr != '' ">
+            and ((
+            DATE_FORMAT(iac.jq_start_date, '%Y-%m-%d') BETWEEN #{params.attachStartDateStr}
+            AND #{params.attachEndDateStr}
+            )
+            OR ( DATE_FORMAT(iac.sy_start_date, '%Y-%m-%d') BETWEEN #{params.attachStartDateStr} AND
+            #{params.attachEndDateStr} )
+            )
+        </if>
+        <if test="params.provinceId != null and params.provinceId != ''">
+            and io.deptid like "${params.provinceId}%"
+        </if>
+        <if test="params.problemOrder != null and params.problemOrder != ''">
+            and iac.problem_order like "${params.problemOrder}%"
+        </if>
+        <if test="params.cityId != null and params.cityId != ''">
+            and io.deptid like "${params.cityId}%"
+        </if>
+        <if test="params.countyId != null and params.countyId != ''">
+            and io.deptid like "${params.countyId}%"
+        </if>
+        <if test="params.houseId != null and params.houseId != ''">
+            and io.deptid like "${params.houseId}%"
+        </if>
+        <if test="params.operatorId != null and params.operatorId != ''">
+            and io.userid = #{params.operatorId}
+        </if>
+        <if test="params.operatorName != null and params.operatorName != ''">
+            and io.username = #{params.operatorName}
+        </if>
+        <if test="params.auditId != null and params.auditId != ''">
+            and iac.new_operator_id = #{params.auditId}
+        </if>
+        <if test="params.agreeId != null and params.agreeId != ''">
+            and iac.agreement_id = #{params.agreeId}
+        </if>
+        <if test="params.managementSource != null and params.managementSource != ''">
+            and sd.management_source = #{params.managementSource}
+        </if>
+        <if test="params.signStartDateStr != null and params.signStartDateStr != '' and params.signEndDateStr != null and params.signEndDateStr != ''">
+            and DATE_FORMAT(iac.signing_time, '%Y-%m-%d') between #{params.signStartDateStr} AND
+            #{params.signEndDateStr}
+        </if>
+        <if test="params.payStartDateStr != null and params.payStartDateStr != '' and params.payEndDateStr != null and params.payEndDateStr != ''">
+            and iac.pay_date between #{params.payStartDateStr} AND #{params.payEndDateStr}
+        </if>
+
+        <if test="params.isExternal != null and params.isExternal != ''">
+            and io.is_external = #{params.isExternal}
+        </if>
+        <if test="params.jqPolicyNo != null and params.jqPolicyNo != ''">
+            and iac.jqpolicyno = #{params.jqPolicyNo}
+        </if>
+        <if test="params.syPolicyNo != null and params.syPolicyNo != ''">
+            and iac.sypolicyno = #{params.syPolicyNo}
+        </if>
+        <if test="params.noPolicyNo != null and params.noPolicyNo != ''">
+            and iac.cross_insurance like concat('%', #{params.noPolicyNo}, '%')
+        </if>
+        order by iac.createtime desc
+    </select>
 
 </mapper>