Forráskód Böngészése

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

wks 2 éve
szülő
commit
735b31beb8
28 módosított fájl, 1450 hozzáadás és 181 törlés
  1. 14 1
      src/main/java/com/ydtech/modules/admin/controller/financialReceivables/FinancialReceivablesController.java
  2. 2 2
      src/main/java/com/ydtech/modules/admin/model/report/financialReceivables/FinancialReceivablesAllMonthVo.java
  3. 23 0
      src/main/java/com/ydtech/modules/admin/model/report/financialReceivables/FinancialReceivablesMonthSignleVo.java
  4. 46 2
      src/main/java/com/ydtech/modules/admin/model/report/financialReceivables/FinancialReceivablesMonthVo.java
  5. 3 0
      src/main/java/com/ydtech/modules/admin/model/report/financialReceivables/FinancialReceivablesQueryMonthVo.java
  6. 4 0
      src/main/java/com/ydtech/modules/admin/model/report/financialReceivables/FinancialReceivablesQueryVo.java
  7. 7 0
      src/main/java/com/ydtech/modules/admin/service/impl/SysAmountAuditingServiceImpl.java
  8. 4 0
      src/main/java/com/ydtech/modules/fnc/controller/CarSettleController.java
  9. 12 3
      src/main/java/com/ydtech/modules/fnc/controller/InsPlyIncomeController.java
  10. 10 2
      src/main/java/com/ydtech/modules/fnc/dao/InsPlyIncomeMapper.java
  11. 17 0
      src/main/java/com/ydtech/modules/fnc/service/InsPlyIncomeService.java
  12. 10 6
      src/main/java/com/ydtech/modules/fnc/service/impl/InsFeeAuditServiceImpl.java
  13. 188 12
      src/main/java/com/ydtech/modules/fnc/service/impl/InsPlyIncomeServiceImpl.java
  14. 22 0
      src/main/java/com/ydtech/modules/fnc/vo/InsPlyIncomeIdsVo.java
  15. 13 0
      src/main/java/com/ydtech/modules/ins/model/pingan/respose/PingAnQuoteRespVo.java
  16. 3 0
      src/main/java/com/ydtech/modules/ins/model/ya/YaQuoteInfoVo.java
  17. 1 1
      src/main/java/com/ydtech/modules/order/controller/PingAnOrderApiController.java
  18. 6 0
      src/main/java/com/ydtech/modules/order/entity/api/pingan/log/PinganApiLog.java
  19. 29 12
      src/main/java/com/ydtech/modules/order/entity/api/pingan/request/PayReturnRequest.java
  20. 190 26
      src/main/java/com/ydtech/modules/order/entity/api/pingan/request/QuoteRequest.java
  21. 40 0
      src/main/java/com/ydtech/modules/order/entity/api/pingan/response/QuoteResponse.java
  22. 3 0
      src/main/java/com/ydtech/modules/order/entity/vo/AuditOrderFeeVo.java
  23. 1 0
      src/main/java/com/ydtech/modules/order/entity/vo/BaseQuoteInfoVo.java
  24. 56 18
      src/main/java/com/ydtech/modules/order/entity/vo/pingan/InsDrivingIntentionInsuranceSonVo.java
  25. 1 2
      src/main/java/com/ydtech/modules/order/service/PingAnOrderApiService.java
  26. 323 89
      src/main/java/com/ydtech/modules/order/service/impl/PingAnOrderApiServiceImpl.java
  27. 131 0
      src/main/java/com/ydtech/modules/order/utils/MD5Util.java
  28. 291 5
      src/main/resources/mapper/modules/fnc/InsPlyIncomeMapper.xml

+ 14 - 1
src/main/java/com/ydtech/modules/admin/controller/financialReceivables/FinancialReceivablesController.java

@@ -47,12 +47,25 @@ public class FinancialReceivablesController {
         return HttpResult.ok(insPlyIncomeService.queryDateByType(financialReceivablesQueryVo));
     }
 
+    /**
+     *  @version
+     *  @author: whp
+     *  @Date: 2024/8/7 9:20
+     *  @Description:  私有 车险
+     */
+    @PostMapping("/queryPrivateCar")
+    @ApiModelProperty(value = "私有车险列表")
+    public HttpResult<FinancialReceivablesAllVo> queryPrivateCar(@RequestBody FinancialReceivablesQueryVo financialReceivablesQueryVo) {
+        return HttpResult.ok(insPlyIncomeService.queryPrivateCar(financialReceivablesQueryVo));
+    }
+
 
     @PostMapping("/queryDateByTypeByMonth")
-    @ApiModelProperty(value = "获取平台私有数据列表")
+    @ApiModelProperty(value = "获取详情列表")
     public HttpResult<FinancialReceivablesAllMonthVo> queryDateByTypeByMonth(@RequestBody FinancialReceivablesQueryMonthVo financialReceivablesQueryVo) {
         return HttpResult.ok(insPlyIncomeService.queryDateByTypeByMonth(financialReceivablesQueryVo));
     }
+
     /**
      *
      * @param insPlyIncomeVo

+ 2 - 2
src/main/java/com/ydtech/modules/admin/model/report/financialReceivables/FinancialReceivablesAllMonthVo.java

@@ -31,12 +31,12 @@ public class FinancialReceivablesAllMonthVo {
     private  String  wsSumAmount;
 
     @ApiModelProperty("数据列表")
-    private List<FinancialReceivablesMonthVo> list =new ArrayList<>();
+    private List<FinancialReceivablesMonthSignleVo> list =new ArrayList<>();
 
     public FinancialReceivablesAllMonthVo() {
     }
 
-    public FinancialReceivablesAllMonthVo(String ysSumAmount, String  yisSumAmount,String  wsSumAmount,  String yearAndMonth, List<FinancialReceivablesMonthVo> list) {
+    public FinancialReceivablesAllMonthVo(String ysSumAmount, String  yisSumAmount,String  wsSumAmount,  String yearAndMonth, List<FinancialReceivablesMonthSignleVo> list) {
         this.ysSumAmount = ysSumAmount;
         this.yisSumAmount = yisSumAmount;
         this.wsSumAmount = wsSumAmount;

+ 23 - 0
src/main/java/com/ydtech/modules/admin/model/report/financialReceivables/FinancialReceivablesMonthSignleVo.java

@@ -0,0 +1,23 @@
+package com.ydtech.modules.admin.model.report.financialReceivables;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@Data
+@ApiModel("应收月份查询参数")
+public class FinancialReceivablesMonthSignleVo {
+
+    @ApiModelProperty("公司名称")
+    private  String  companyName;
+
+    @ApiModelProperty("地区名称")
+    private  String  areaName;
+
+
+    @ApiModelProperty("数据列表")
+    private List<FinancialReceivablesMonthVo> list =new ArrayList<>();
+}

+ 46 - 2
src/main/java/com/ydtech/modules/admin/model/report/financialReceivables/FinancialReceivablesMonthVo.java

@@ -4,6 +4,10 @@ package com.ydtech.modules.admin.model.report.financialReceivables;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.ArrayList;
+import java.util.List;
 
 /**
  *  @version 
@@ -13,6 +17,7 @@ import lombok.Data;
  */
 @Data
 @ApiModel("应收月份返回参数")
+@NoArgsConstructor
 public class FinancialReceivablesMonthVo {
 
     @ApiModelProperty("年份")
@@ -27,10 +32,10 @@ public class FinancialReceivablesMonthVo {
     @ApiModelProperty("应收")
     private String  commissionFeevalue;
 
-    @ApiModelProperty("收")
+    @ApiModelProperty("收")
     private String  noInvoicCommissionFeevalue;
 
-    @ApiModelProperty("收")
+    @ApiModelProperty("收")
     private String  readyCommissionFeevalue;
 
     @ApiModelProperty("开票未结算")
@@ -39,4 +44,43 @@ public class FinancialReceivablesMonthVo {
     @ApiModelProperty("未开票金额")
     private String  noSettlementAmount;
 
+    @ApiModelProperty("手续费应收")
+    private String  handlingReceivable;
+
+    @ApiModelProperty("跟单应收")
+    private String  documentaryReceivable;
+
+    @ApiModelProperty("合作公司id")
+    private String  partnerCompaniesId;
+
+    @ApiModelProperty("地区编号")
+    private String  subPartnerCompaniesId;
+
+    @ApiModelProperty("保险公司名称")
+    private String  insuranceCompany;
+
+
+    @ApiModelProperty("未开票手续费")
+    private String  unlicensedHandlingFee;
+
+    @ApiModelProperty("未结算手续费")
+    private String  unsettledHandlingFees;
+
+    @ApiModelProperty("是否是手续费")
+    private String  isHand;
+
+
+
+
+    public FinancialReceivablesMonthVo(String yearAndMonth, String companyName, String areaName, String commissionFeevalue, String noInvoicCommissionFeevalue, String readyCommissionFeevalue, String settlementAmount, String noSettlementAmount) {
+        this.yearAndMonth = yearAndMonth;
+        this.companyName = companyName;
+        this.areaName = areaName;
+        this.commissionFeevalue = commissionFeevalue;
+        this.noInvoicCommissionFeevalue = noInvoicCommissionFeevalue;
+        this.readyCommissionFeevalue = readyCommissionFeevalue;
+        this.settlementAmount = settlementAmount;
+        this.noSettlementAmount = noSettlementAmount;
+    }
+
 }

+ 3 - 0
src/main/java/com/ydtech/modules/admin/model/report/financialReceivables/FinancialReceivablesQueryMonthVo.java

@@ -26,4 +26,7 @@ public class FinancialReceivablesQueryMonthVo {
 
     @ApiModelProperty("前台不需要传递后台使用")
     private String endDate;
+
+    @ApiModelProperty("是否是非车")
+    private String isNoCar;
 }

+ 4 - 0
src/main/java/com/ydtech/modules/admin/model/report/financialReceivables/FinancialReceivablesQueryVo.java

@@ -26,4 +26,8 @@ public class FinancialReceivablesQueryVo {
 
     @ApiModelProperty("前台不需要传递后台使用")
     private String endDate;
+
+    @ApiModelProperty("是否是非车  0  不是 1 是")
+    private String  isNotCar;
+
 }

+ 7 - 0
src/main/java/com/ydtech/modules/admin/service/impl/SysAmountAuditingServiceImpl.java

@@ -387,6 +387,13 @@ public class SysAmountAuditingServiceImpl extends ServiceImpl<SysAmountAuditingM
         if(StringUtils.isNotEmpty(sysAmountAuditingVo.getLeaderName())){
             params.put("leaderName",sysAmountAuditingVo.getLeaderName());
         }
+        if(StringUtils.isNotEmpty(sysAmountAuditingVo.getStartAuditingTime())){
+            params.put("startAuditingTime",sysAmountAuditingVo.getStartAuditingTime());
+        }
+        if(StringUtils.isNotEmpty(sysAmountAuditingVo.getEndAuditingTime())){
+            params.put("endAuditingTime",sysAmountAuditingVo.getEndAuditingTime());
+        }
+
         List<SysAmountAuditingEntity> list = baseMapper.queryPageOrderNew(params);
         return list;
     }

+ 4 - 0
src/main/java/com/ydtech/modules/fnc/controller/CarSettleController.java

@@ -91,9 +91,12 @@ public class CarSettleController extends BaseController {
     public HttpResult auditFee(@RequestBody @Valid AuditOrderFeeVo auditOrderFeeVo) {
 //        订单号
         String orderNo = auditOrderFeeVo.getOrderNo();
+        String insOrderNo = auditOrderFeeVo.getInsOrderNo();
+
         //查询改订单是已审核
         List<InsFeeAudit> feeList = insFeeAuditService.lambdaQuery()
                 .eq(InsFeeAudit::getOrderno, orderNo)
+                .eq(InsFeeAudit::getInsOrderNo, insOrderNo)
                 .eq(InsFeeAudit::getAuditstatus, FeeAuditAuditstatus.PASSED.getCode())
                 .list();
 
@@ -104,6 +107,7 @@ public class CarSettleController extends BaseController {
         //查询已承保的子订单号
         List<InsAreaCompany> areaList = insAreaCompanyService.lambdaQuery()
                 .eq(StringUtils.isNotEmpty(orderNo), InsAreaCompany::getOrderno, orderNo)
+                .eq(StringUtils.isNotEmpty(insOrderNo),InsAreaCompany::getId,insOrderNo)
                 .eq(InsAreaCompany::getOrderstatus, InsOrderStatusEnum.ACCEPT_INSURANCE.getCode())
                 .list();//3已承保
 

+ 12 - 3
src/main/java/com/ydtech/modules/fnc/controller/InsPlyIncomeController.java

@@ -3,17 +3,16 @@ package com.ydtech.modules.fnc.controller;
 import com.ydtech.core.page.HttpResult;
 import com.ydtech.modules.base.controller.BaseController;
 import com.ydtech.modules.fnc.dto.PlatformSettlementRecordDto;
-import com.ydtech.modules.fnc.dto.SumAllAmountSettlementDto;
 import com.ydtech.modules.fnc.entity.InsPlyIncome;
 import com.ydtech.modules.fnc.entity.SettlementDocumentaryFeesEntity;
 import com.ydtech.modules.fnc.service.ImportAsyncService;
 import com.ydtech.modules.fnc.service.InsPlyIncomeService;
+import com.ydtech.modules.fnc.vo.InsPlyIncomeIdsVo;
 import com.ydtech.modules.fnc.vo.InsPlyIncomeVo;
 import com.ydtech.modules.inv.model.dto.InsBxNoPlyIncomeExcelDto;
 import com.ydtech.modules.inv.model.dto.InsBxOtherExcelDto;
 import com.ydtech.modules.inv.model.dto.InsBxPlyIncomeExcelDto;
 import com.ydtech.modules.inv.model.dto.InsNoBxOtherExcelDto;
-import com.ydtech.modules.inv.utils.EasyExcelUtils;
 import com.ydtech.modules.order.entity.BasePageResult;
 import com.ydtech.utils.SnowFlakeUtil;
 import com.ydtech.utils.StringUtils;
@@ -28,7 +27,6 @@ import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import javax.validation.Valid;
 import java.io.IOException;
-import java.io.InputStream;
 import java.time.Period;
 import java.util.ArrayList;
 import java.util.HashMap;
@@ -501,6 +499,17 @@ public class InsPlyIncomeController extends BaseController {
     public HttpResult<List<HashMap<String,Object>>> monthTotalReceivables(@RequestBody InsPlyIncomeVo insPlyIncomeVo) {
         return insPlyIncomeService.monthTotalReceivables(insPlyIncomeVo);
     }
+
+    /**
+     *  添加修正数据的逻辑
+     * @param
+     * @return
+     */
+    @PostMapping("/createData")
+    @ApiModelProperty(value = "添加修正数据的逻辑")
+    public HttpResult<List<InsPlyIncome>> createData(@RequestBody InsPlyIncomeIdsVo insPlyIncomeIdsVo) {
+        return insPlyIncomeService.createData(insPlyIncomeIdsVo);
+    }
 }
 
 

+ 10 - 2
src/main/java/com/ydtech/modules/fnc/dao/InsPlyIncomeMapper.java

@@ -177,12 +177,20 @@ public interface InsPlyIncomeMapper extends BaseMapper<InsPlyIncome> {
      *  @Date: 2024/8/5 10:06
      *  @Description:  查询月份的统计数据
      */
-    FinancialReceivablesAllMonthVo queryDateByTypeByMonth(FinancialReceivablesQueryMonthVo financialReceivablesQueryVo);
+    FinancialReceivablesAllMonthVo queryDateByTypeByMonth(@Param("vo") FinancialReceivablesQueryMonthVo financialReceivablesQueryVo);
     /**
      *  @version
      *  @author: hxl
      *  @Date: 2024/8/5 10:32
      *  @Description:  查询月份统计集合数据
      */
-    List<FinancialReceivablesMonthVo> queryDateByTypeByMonthList(FinancialReceivablesQueryMonthVo financialReceivablesQueryVo);
+    List<FinancialReceivablesMonthVo> queryDateByTypeByMonthList(@Param("vo") FinancialReceivablesQueryMonthVo financialReceivablesQueryVo);
+
+    List<FinancialReceivablesMonthVo> queryDateByTypeByMonthOtherList(@Param("vo") FinancialReceivablesQueryMonthVo financialReceivablesQueryVo);
+
+    List<FinancialReceivablesMonthVo> queryPlatHanding(@Param("vo") FinancialReceivablesQueryMonthVo financialReceivablesQueryVo);
+
+
+    List<FinancialReceivablesVo> queryPrivateCar(@Param("vo") FinancialReceivablesQueryVo financialReceivablesQueryVo);
+
 }

+ 17 - 0
src/main/java/com/ydtech/modules/fnc/service/InsPlyIncomeService.java

@@ -10,6 +10,7 @@ import com.ydtech.modules.fnc.dto.PlatformSettlementRecordDto;
 import com.ydtech.modules.fnc.entity.InsAreaCompany;
 import com.ydtech.modules.fnc.entity.InsPlyIncome;
 import com.ydtech.modules.fnc.entity.SettlementDocumentaryFeesEntity;
+import com.ydtech.modules.fnc.vo.InsPlyIncomeIdsVo;
 import com.ydtech.modules.fnc.vo.InsPlyIncomeVo;
 import com.ydtech.modules.order.entity.BasePageResult;
 import com.ydtech.modules.order.entity.InsOrders;
@@ -195,4 +196,20 @@ public interface InsPlyIncomeService extends IService<InsPlyIncome> {
      *  @Description:
      */
     FinancialReceivablesAllMonthVo queryDateByTypeByMonth(FinancialReceivablesQueryMonthVo financialReceivablesQueryVo);
+    /**
+     *  @version
+     *  @author: whp
+     *  @Date: 2024/8/7 9:20
+     *  @Description:  私有 车险
+     */
+    FinancialReceivablesAllVo queryPrivateCar(FinancialReceivablesQueryVo financialReceivablesQueryVo);
+
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/8/7 11:20
+     *  @Description: 添加修正协议修改类型重新生成数据的逻辑
+     */
+    HttpResult<List<InsPlyIncome>> createData(InsPlyIncomeIdsVo insPlyIncomeIdsVo);
+
 }

+ 10 - 6
src/main/java/com/ydtech/modules/fnc/service/impl/InsFeeAuditServiceImpl.java

@@ -816,7 +816,9 @@ public class InsFeeAuditServiceImpl extends ServiceImpl<InsFeeAuditMapper, InsFe
     @Override
     public InsFeeAudit saveDefaultInsFeeAuditAndHistory(String orderNo, String insOrderNo, String auditstatus, String rejectInfo) {
         //查询费用审核表
-        InsFeeAudit insFeeAudit = getOne(new LambdaQueryWrapper<InsFeeAudit>().eq(InsFeeAudit::getOrderno, orderNo));
+        InsFeeAudit insFeeAudit = getOne(new LambdaQueryWrapper<InsFeeAudit>()
+                .eq(InsFeeAudit::getOrderno, orderNo)
+                .eq(InsFeeAudit::getInsOrderNo, insOrderNo));
 
         //添加审核轨迹表
         InsFeeAuditHistory insFeeAuditHistory = new InsFeeAuditHistory();
@@ -829,16 +831,18 @@ public class InsFeeAuditServiceImpl extends ServiceImpl<InsFeeAuditMapper, InsFe
             this.save(insFeeAudit);
         } else {
             //状态码为已审核且数据不为空,则更新审核状态
-            //如果传入的为审核驳回 则将审核状态至为0
-            if(auditstatus.equals("2")) {
-                insFeeAudit.setAuditstatus("0");
-            }else{
+            //如果审核状态为已审核则一直都是已审核
+            if(insFeeAudit.getAuditstatus().equals("1")) {
                 insFeeAudit.setAuditstatus(insFeeAudit.getAuditstatus());
+            }else{
+                insFeeAudit.setAuditstatus(auditstatus);
             }
             insFeeAudit.setAudituser(BaseController.getUser().getName());
             insFeeAudit.setAudittime(LocalDateTime.now());
             insFeeAudit.setRejectinfo(rejectInfo);
-            this.update(insFeeAudit, new LambdaUpdateWrapper<InsFeeAudit>().eq(InsFeeAudit::getOrderno, orderNo));
+            this.update(insFeeAudit, new LambdaUpdateWrapper<InsFeeAudit>()
+                    .eq(InsFeeAudit::getOrderno, orderNo)
+                    .eq(InsFeeAudit::getInsOrderNo, insOrderNo));
         }
         //复制审核对象的属性
         BeanUtils.copyProperties(insFeeAudit, insFeeAuditHistory);

+ 188 - 12
src/main/java/com/ydtech/modules/fnc/service/impl/InsPlyIncomeServiceImpl.java

@@ -4,6 +4,8 @@ import cn.afterturn.easypoi.excel.entity.ExportParams;
 import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
+import com.alipay.api.domain.VehicleIovData;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.github.pagehelper.PageHelper;
@@ -17,10 +19,12 @@ import com.ydtech.modules.admin.utils.SliceUpDateUtil;
 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.fnc.dao.FncInsAreaCompanyMapper;
 import com.ydtech.modules.fnc.dao.InsPlyIncomeMapper;
 import com.ydtech.modules.fnc.dto.PlatformSettlementRecordDto;
 import com.ydtech.modules.fnc.entity.*;
 import com.ydtech.modules.fnc.service.*;
+import com.ydtech.modules.fnc.vo.InsPlyIncomeIdsVo;
 import com.ydtech.modules.fnc.vo.InsPlyIncomeVo;
 import com.ydtech.modules.fnc.vo.SettlementDocumentaryFeesVo;
 import com.ydtech.modules.ins.model.vo.res.*;
@@ -61,6 +65,8 @@ import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
 import java.math.BigDecimal;
+import java.math.MathContext;
+import java.math.RoundingMode;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
@@ -70,6 +76,8 @@ import java.time.LocalTime;
 import java.time.YearMonth;
 import java.time.format.DateTimeFormatter;
 import java.util.*;
+import java.util.function.Function;
+import java.util.stream.Collectors;
 
 /**
  * <p>
@@ -115,6 +123,9 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
     @Value("${upload.file.url}")
     private String uploadUrl;
 
+    @Autowired
+    private FncInsAreaCompanyMapper fncInsAreaCompanyMapper;
+
 
     public HttpResult<BasePageResult<InsPlyIncome>> queryplyIncome(InsPlyIncomeVo insPlyIncomeVo) {
 
@@ -192,6 +203,7 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
         insPlyIncome.setJqEndDate(StringOperations.emptyStringToNull(insAreaCompany.getJqEndDate()));
         insPlyIncome.setSyStartDate(StringOperations.emptyStringToNull(insAreaCompany.getSyStartDate()));
         insPlyIncome.setSyEndDate(StringOperations.emptyStringToNull(insAreaCompany.getSyEndDate()));
+        insPlyIncome.setReceivableAmount(insFeeOrderNew.getNoOtherCostsPremiums());
         insPlyIncome.setAllFeeValue(insFeeOrderNew.getNoOtherCostsPremiums());
         insPlyIncome.setNoOtherCostsPremium(insFeeOrderNew.getNoOtherCostsPremiums());
         insPlyIncome.setNoOtherCostsProportion(insFeeOrderNew.getNoOtherCostsProportion());
@@ -216,7 +228,6 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
         if (StringUtils.isNotEmpty(noPolicyno)) {
             insPlyIncome.setNoPolicyno(noPolicyno); // 非车保单号
         }
-
 //        insPlyIncome.setDeptId(insFeeOrderNew.getDeptId());
         //add by hxl  2024-07-31  修改插入结算表中险种信息错误的bug  将大订单中的险种信息改为小订单的险种信息
         this.saveRiskCode(insAreaCompany.getProductid(), insPlyIncome);
@@ -245,7 +256,7 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
         insPlyIncome.setNoSuperviseCostsProportion(insFeeOrderNew.getNoSuperviseCostsProportion());
         this.getDeptId(insPlyIncome);
         this.saveByCompanyId(insFeeOrderNew, insAreaCompany.getCompanyId(), insPlyIncome);
-
+        insPlyIncome.setReceivableAmount(insFeeOrderNew.getNoSuperviseCostsPremiums());
         baseMapper.insert(insPlyIncome);
         InsPlyIncomeLog insPlyIncomeLog = new InsPlyIncomeLog();
         insPlyIncomeLog.setIncomeId(insPlyIncome.getId());
@@ -309,6 +320,7 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
         insPlyIncome.setSyEndDate(StringOperations.emptyStringToNull(insAreaCompany.getSyEndDate()));
         insPlyIncome.setUserId(insFeeOrderNew.getUserId());
         insPlyIncome.setInsuredName(order.getInsuredname());
+        insPlyIncome.setReceivableAmount(otherAmount);
         this.getDeptId(insPlyIncome);
         this.saveByCompanyId(insFeeOrderNew, insAreaCompany.getCompanyId(), insPlyIncome);
 
@@ -354,6 +366,7 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
         insPlyIncome.setJqEndDate(StringOperations.emptyStringToNull(insAreaCompany.getJqEndDate()));
         insPlyIncome.setSyStartDate(StringOperations.emptyStringToNull(insAreaCompany.getSyStartDate()));
         insPlyIncome.setSyEndDate(StringOperations.emptyStringToNull(insAreaCompany.getSyEndDate()));
+        insPlyIncome.setReceivableAmount(handlingAmount);
         this.saveByCompanyId(insFeeOrderNew, insAreaCompany.getCompanyId(), insPlyIncome);
         this.getDeptId(insPlyIncome);
         baseMapper.insert(insPlyIncome);
@@ -3302,6 +3315,35 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
 
         return new FinancialReceivablesAllVo(ptSumAmount.toString(),sySumAmount.toString(),year+"",list);
     }
+    /**
+     *  @version
+     *  @author: whp
+     *  @Date: 2024/8/7
+     *  @Description:  私有 车险
+     */
+    @Override
+    public FinancialReceivablesAllVo queryPrivateCar(FinancialReceivablesQueryVo financialReceivablesQueryVo) {
+        int year =0;
+        if(StringUtils.isBlank(financialReceivablesQueryVo.getYear())){
+            Calendar cale = Calendar.getInstance();
+            year = cale.get(Calendar.YEAR);
+        }else{
+            year = Integer.parseInt(financialReceivablesQueryVo.getYear());
+        }
+
+        FinancialReceivablesAllVo resultVo = new FinancialReceivablesAllVo();
+//      私有总金额
+        financialReceivablesQueryVo.setBeginDate(SliceUpDateUtil.getYearBeginDateStr(year)+" 00:00:00");
+        financialReceivablesQueryVo.setEndDate(SliceUpDateUtil.getYearEndDateStr(year)+" 23:59:59");
+//      私有应收
+        BigDecimal syAmount = baseMapper.queryDateByTypeSumAmount(financialReceivablesQueryVo);
+        resultVo.setSySumAmount(syAmount.toString());
+        resultVo.setYear(year+"");
+
+        List<FinancialReceivablesVo> result=  baseMapper.queryPrivateCar(financialReceivablesQueryVo);
+        resultVo.setList(result);
+        return resultVo;
+    }
     /**
      *  @version
      *  @author: hxl
@@ -3311,30 +3353,164 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
     @Override
     public FinancialReceivablesAllMonthVo queryDateByTypeByMonth(FinancialReceivablesQueryMonthVo financialReceivablesQueryVo) {
         //检查参数
-        if(StringUtils.isBlank(financialReceivablesQueryVo.getType())){
+        if (StringUtils.isBlank(financialReceivablesQueryVo.getType())) {
             throw new SystemException("应收类型不能为空,1为平台2为私有,默认传1");
         }
         //检查参数
-        if(StringUtils.isBlank(financialReceivablesQueryVo.getYearAndMonth())){
+        if (StringUtils.isBlank(financialReceivablesQueryVo.getYearAndMonth())) {
             throw new SystemException("月份不能为空");
         }
         String yearAndMonth = financialReceivablesQueryVo.getYearAndMonth();
         int year = Integer.parseInt(yearAndMonth.split("-")[0]);
         int month = Integer.parseInt(yearAndMonth.split("-")[1]);
 
-        financialReceivablesQueryVo.setBeginDate(SliceUpDateUtil.getStartOfMonth(year,month));
-        financialReceivablesQueryVo.setEndDate(SliceUpDateUtil.getEndOfMonth(year,month));
+        financialReceivablesQueryVo.setBeginDate(SliceUpDateUtil.getStartOfMonth(year, month));
+        financialReceivablesQueryVo.setEndDate(SliceUpDateUtil.getEndOfMonth(year, month));
         //查询总数
-        FinancialReceivablesAllMonthVo  vo= baseMapper.queryDateByTypeByMonth(financialReceivablesQueryVo);
+        FinancialReceivablesAllMonthVo vo = baseMapper.queryDateByTypeByMonth(financialReceivablesQueryVo);
+//      第二层数据
+        List<FinancialReceivablesMonthSignleVo> resultData = vo.getList();
         vo.setYearAndMonth(yearAndMonth);
-        //查询列表
-        List<FinancialReceivablesMonthVo> list = baseMapper.queryDateByTypeByMonthList(financialReceivablesQueryVo);
 
-        //按区域
-        //if()
+        HashMap<String, BigDecimal> amountMap;
+        if ("2".equals(financialReceivablesQueryVo.getType())) {
+             amountMap = this.privateSett(resultData, financialReceivablesQueryVo);
+        } else {
+             amountMap = this.platformSett(resultData, financialReceivablesQueryVo);
+        }
+        vo.setYisSumAmount(amountMap.get("yishouAmount").toString());
+        vo.setYsSumAmount(amountMap.get("yinshouAmount").toString());
+        vo.setWsSumAmount(amountMap.get("weishouAmount").toString());
+        return vo;
+    }
+
 
 
+    private HashMap<String, BigDecimal> platformSett(List<FinancialReceivablesMonthSignleVo> resultData, FinancialReceivablesQueryMonthVo financialReceivablesQueryVo) {
+        List<BigDecimal> yinShouAmountList = new ArrayList<>();
+        List<BigDecimal> yishouAmountList = new ArrayList<>();
+        List<BigDecimal> weishouAmountList = new ArrayList<>();
 
-        return null;
+        BigDecimal yinshouAmount = new BigDecimal("0.00");
+        BigDecimal yishouAmount = new BigDecimal("0.00");
+        BigDecimal weishouAmount = new BigDecimal("0.00");
+
+        HashMap<String, BigDecimal> resultMap = new HashMap<>();
+
+
+        //平台手续费
+        List<FinancialReceivablesMonthVo> handList = baseMapper.queryPlatHanding(financialReceivablesQueryVo);
+
+        Map<String, FinancialReceivablesMonthVo> collect = handList.stream().collect(Collectors.toMap(FinancialReceivablesMonthVo::getPartnerCompaniesId, Function.identity()));
+
+        handList.stream().filter(item -> collect.containsKey(item.getPartnerCompaniesId()))
+                .forEach(item ->{
+                    FinancialReceivablesMonthVo otherItem = collect.get(item.getPartnerCompaniesId());
+
+                    FinancialReceivablesMonthSignleVo financialReceivablesMonthSignleVo = new FinancialReceivablesMonthSignleVo();
+                    List<FinancialReceivablesMonthVo> financialReceivablesMonthVos = financialReceivablesMonthSignleVo.getList();
+                    financialReceivablesMonthSignleVo.setCompanyName(item.getCompanyName());
+                    financialReceivablesMonthSignleVo.setAreaName(item.getAreaName());
+                    financialReceivablesMonthVos.add(otherItem);
+                    financialReceivablesMonthVos.add(item);
+                    if("合计".equals(item.getIsHand())){
+                        yinShouAmountList.add(this.stringToBigdecimal(item.getCommissionFeevalue()));
+                        yishouAmountList.add(this.stringToBigdecimal(item.getReadyCommissionFeevalue()));
+                        weishouAmountList.add(this.stringToBigdecimal(item.getNoInvoicCommissionFeevalue()));
+
+                    }
+                    resultData.add(financialReceivablesMonthSignleVo);
+                });
+        yinshouAmount = yinshouAmount.add(yinShouAmountList.stream().reduce(BigDecimal.ZERO, BigDecimal::add));
+        yishouAmount = yishouAmount.add(yishouAmountList.stream().reduce(BigDecimal.ZERO, BigDecimal::add));
+        weishouAmount = weishouAmount.add(weishouAmountList.stream().reduce(BigDecimal.ZERO, BigDecimal::add));
+        resultMap.put("yinshouAmount",yinshouAmount);
+        resultMap.put("yishouAmount",yishouAmount);
+        resultMap.put("weishouAmount",weishouAmount);
+        return resultMap;
+
+    }
+
+    private HashMap<String, BigDecimal> privateSett(List<FinancialReceivablesMonthSignleVo> resultData, FinancialReceivablesQueryMonthVo financialReceivablesQueryVo) {
+        List<BigDecimal> yinShouAmountList = new ArrayList<>();
+        List<BigDecimal> yishouAmountList = new ArrayList<>();
+        List<BigDecimal> weishouAmountList = new ArrayList<>();
+
+        BigDecimal yinshouAmount = new BigDecimal("0.00");
+        BigDecimal yishouAmount = new BigDecimal("0.00");
+        BigDecimal weishouAmount = new BigDecimal("0.00");
+
+        HashMap<String, BigDecimal> resultMap = new HashMap<>();
+
+
+        //手续费未接应收
+        List<FinancialReceivablesMonthVo> list = baseMapper.queryDateByTypeByMonthList(financialReceivablesQueryVo);
+        //跟单统计
+        List<FinancialReceivablesMonthVo> otherList = baseMapper.queryDateByTypeByMonthOtherList(financialReceivablesQueryVo);
+
+        Map<String, FinancialReceivablesMonthVo> collect = otherList.stream().collect(Collectors.toMap(FinancialReceivablesMonthVo::getPartnerCompaniesId, Function.identity()));
+        list.stream()
+                .filter(item -> collect.containsKey(item.getPartnerCompaniesId()))
+                .forEach(
+                        item -> {
+                            FinancialReceivablesMonthVo otherItem = collect.get(item.getPartnerCompaniesId());
+                            FinancialReceivablesMonthSignleVo financialReceivablesMonthSignleVo = new FinancialReceivablesMonthSignleVo();
+                            List<FinancialReceivablesMonthVo> financialReceivablesMonthVos = financialReceivablesMonthSignleVo.getList();
+                            financialReceivablesMonthSignleVo.setCompanyName(item.getCompanyName());
+                            financialReceivablesMonthSignleVo.setAreaName(item.getAreaName());
+//                          合计信息
+                            FinancialReceivablesMonthVo financialReceivablesMonthVo = new FinancialReceivablesMonthVo();
+                            financialReceivablesMonthVo.setCommissionFeevalue(this.calculateTotal(this.stringToBigdecimal(item.getCommissionFeevalue()), new BigDecimal(otherItem.getCommissionFeevalue()), null).toString());
+                            financialReceivablesMonthVo.setNoInvoicCommissionFeevalue(this.calculateTotal(this.stringToBigdecimal(item.getNoInvoicCommissionFeevalue()), new BigDecimal(otherItem.getNoInvoicCommissionFeevalue()), null).toString());
+                            financialReceivablesMonthVo.setReadyCommissionFeevalue(this.calculateTotal(this.stringToBigdecimal(item.getReadyCommissionFeevalue()), new BigDecimal(otherItem.getReadyCommissionFeevalue()), null).toString());
+                            financialReceivablesMonthVo.setSettlementAmount(this.calculateTotal(this.stringToBigdecimal(item.getSettlementAmount()), new BigDecimal(otherItem.getSettlementAmount()), null).toString());
+                            financialReceivablesMonthVo.setNoSettlementAmount(this.calculateTotal(this.stringToBigdecimal(item.getNoSettlementAmount()), new BigDecimal(otherItem.getNoSettlementAmount()), null).toString());
+                            financialReceivablesMonthVo.setIsHand("合计");
+                            financialReceivablesMonthVos.add(otherItem);
+                            financialReceivablesMonthVos.add(item);
+                            financialReceivablesMonthVos.add(financialReceivablesMonthVo);
+                            yishouAmountList.add(this.stringToBigdecimal(financialReceivablesMonthVo.getReadyCommissionFeevalue()));
+                            yinShouAmountList.add(this.stringToBigdecimal(financialReceivablesMonthVo.getCommissionFeevalue()));
+                            weishouAmountList.add(this.stringToBigdecimal(financialReceivablesMonthVo.getNoInvoicCommissionFeevalue()));
+                            resultData.add(financialReceivablesMonthSignleVo);
+                        }
+                );
+        yinshouAmount = yinshouAmount.add(yinShouAmountList.stream().reduce(BigDecimal.ZERO, BigDecimal::add));
+        yishouAmount = yishouAmount.add(yishouAmountList.stream().reduce(BigDecimal.ZERO, BigDecimal::add));
+        weishouAmount = weishouAmount.add(weishouAmountList.stream().reduce(BigDecimal.ZERO, BigDecimal::add));
+        resultMap.put("yinshouAmount",yinshouAmount);
+        resultMap.put("yishouAmount",yishouAmount);
+        resultMap.put("weishouAmount",weishouAmount);
+        return resultMap;
+    }
+    private BigDecimal stringToBigdecimal(String value) {
+        return new BigDecimal(value).setScale(5, RoundingMode.DOWN);
+    }
+
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/8/7 11:20
+     *  @Description: 修正协议变动重新生成数据逻辑
+     */
+    @Override
+    public HttpResult<List<InsPlyIncome>> createData(InsPlyIncomeIdsVo insPlyIncomeIdsVo) {
+        if(insPlyIncomeIdsVo.getIds()==null || insPlyIncomeIdsVo.getIds().size()==0){
+            throw new SystemException("子订单id不能为空!!");
+        }
+        List<String> ids = insPlyIncomeIdsVo.getIds();
+        List<InsPlyIncome>  newList=new ArrayList<>();
+        for(String  subOrderId:ids){
+            //查询子订单对象   com.ydtech.modules.order.entity
+            InsAreaCompany insAreaCompany = fncInsAreaCompanyMapper.selectById(subOrderId);
+            //大订单对象
+            InsOrders order = insOrdersService.existOrder(insAreaCompany.getOrderno());
+
+            //获取该订单的费用
+            InsFeeOrderNew insFeeOrderNew = insFeeOrderNewService.getOne(new LambdaQueryWrapper<InsFeeOrderNew>()
+                    .eq(InsFeeOrderNew::getInsOrderNo, insAreaCompany.getId()));
+            saveBalanceNew(order, insFeeOrderNew,insAreaCompany) ;
+        }
+        return HttpResult.ok(newList);
     }
 }

+ 22 - 0
src/main/java/com/ydtech/modules/fnc/vo/InsPlyIncomeIdsVo.java

@@ -0,0 +1,22 @@
+package com.ydtech.modules.fnc.vo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ *  @version
+ *  @author: hxl
+ *  @Date: 2024/8/7 11:18
+ *  @Description:   修正数据vo
+ */
+@Data
+@ApiModel("修正数据vo")
+public class InsPlyIncomeIdsVo implements Serializable {
+
+    @ApiModelProperty("子订单id")
+    private List<String> ids;
+}

+ 13 - 0
src/main/java/com/ydtech/modules/ins/model/pingan/respose/PingAnQuoteRespVo.java

@@ -13,4 +13,17 @@ public class PingAnQuoteRespVo extends QuoteRespVo {
     // 小微险保费
     QuoteResponse.XwActualPremiumDTO xwActualPremium = new QuoteResponse.XwActualPremiumDTO();
 
+    /***
+     * 财意险
+     */
+    double cyPremium=0;
+    /***
+     *  小微险
+     */
+    double xwPremium=0;
+    /***
+     * 组合
+     */
+    double zhPremium=0;
+
 }

+ 3 - 0
src/main/java/com/ydtech/modules/ins/model/ya/YaQuoteInfoVo.java

@@ -51,6 +51,8 @@ public class YaQuoteInfoVo implements Serializable {
     @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     private LocalDateTime startDate;
 
+    private String userid;
+
     public YaQuoteInfoVo() {
     }
 
@@ -62,6 +64,7 @@ public class YaQuoteInfoVo implements Serializable {
         this.riskList = JSON.parseArray(JSON.toJSONString(insOrders.getRisk()), RiskInfoVo.class);
         this.kindList = JSON.parseArray(JSON.toJSONString(insOrders.getKing()), KindInfoVo.class);
         this.quoteno = insOrders.getQuoteno();
+        //this.userid = insOrders.getUserid();
     }
 
 }

+ 1 - 1
src/main/java/com/ydtech/modules/order/controller/PingAnOrderApiController.java

@@ -47,7 +47,7 @@ public class PingAnOrderApiController {
     @QuoteVerification("报价授权")
     @PostMapping("/quote")
     @ApiOperation("1报价-标的查询-车型查询-车辆确认-报价")
-    public HttpResult<QuoteRespVo> quote(@RequestBody PingAnQuoteVo<InsDrivingIntentionInsuranceSonVo> quoteVo) throws Exception {
+    public HttpResult<QuoteRespVo> quote(@RequestBody PingAnQuoteVo<Map<String,Object>> quoteVo) throws Exception {
         BaseQuoteInfoVo quoteInfo = this.insOrdersComponents.getQuoteInfo(quoteVo.getOrderNo(), quoteVo.getAgreementId());
         return this.pingAnOrderApiService.quote(quoteInfo, quoteVo);
     }

+ 6 - 0
src/main/java/com/ydtech/modules/order/entity/api/pingan/log/PinganApiLog.java

@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.annotation.TableName;
 import lombok.Data;
 
 import java.io.Serializable;
+import java.util.Date;
 
 /**
  * 
@@ -61,6 +62,11 @@ public class PinganApiLog implements Serializable {
      */
     private String responseType;
 
+    /***
+     * 创建时间
+     */
+    private Date createTime;
+
     @TableField(exist = false)
     private static final long serialVersionUID = 1L;
 

+ 29 - 12
src/main/java/com/ydtech/modules/order/entity/api/pingan/request/PayReturnRequest.java

@@ -3,6 +3,8 @@ package com.ydtech.modules.order.entity.api.pingan.request;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 
+import java.io.Serializable;
+
 /**
  *  @version
  *  @author: hxl
@@ -25,7 +27,7 @@ public class PayReturnRequest extends PingAnBaseRequest {
     /***
      *O	备注
      */
-    private String remark;
+    private RemarkInfoDto remark;
 
 
     /***
@@ -66,16 +68,31 @@ public class PayReturnRequest extends PingAnBaseRequest {
     public PayReturnRequest() {
     }
 
-    public PayReturnRequest(String businessNo, String bankOrderNo, String remark, String paymentDate, String paymentSum, String payType, String paymentState, String resultMsg, String errorMsg, String signMsg) {
-        this.businessNo = businessNo;
-        this.bankOrderNo = bankOrderNo;
-        this.remark = remark;
-        this.paymentDate = paymentDate;
-        this.paymentSum = paymentSum;
-        this.payType = payType;
-        this.paymentState = paymentState;
-        this.resultMsg = resultMsg;
-        this.errorMsg = errorMsg;
-        this.signMsg = signMsg;
+    /***
+     * 车辆信息
+     */
+    @Data
+    public static class RemarkInfoDto implements Serializable {
+        /***
+         * C	实名认证标志(Y需要实名认证N不需要实名认证。默认为Y需要认证)
+         */
+        private String autonymAuthFlag;
+        /**
+         * M	缴费方式代码
+         * POS  移动POS机
+         * EPO  EPOS机
+         * WXP  微信
+         * ALP  支付宝
+         * SCP  银行卡快捷
+         * EBK  网银
+         * NCP  无卡
+         * PPY  预付费
+         */
+        private String appType;
+        /**
+         * C
+         * (江苏)缴费方式非支付宝、微信时(其他地区传支付宝或微信ID)	银行卡号
+         */
+        private String channelSourceCode;
     }
 }

+ 190 - 26
src/main/java/com/ydtech/modules/order/entity/api/pingan/request/QuoteRequest.java

@@ -1,10 +1,10 @@
 package com.ydtech.modules.order.entity.api.pingan.request;
 
+import cn.hutool.core.bean.BeanUtil;
 import com.ydtech.constants.enums.InsurKind;
 import com.ydtech.modules.ins.model.vo.KindInfoVo;
 import com.ydtech.modules.order.entity.InsOrders;
 import com.ydtech.modules.order.entity.api.pingan.response.CarConfirmResponse;
-import com.ydtech.modules.order.entity.api.pingan.response.SearchPAVehicleListResponse;
 import com.ydtech.modules.order.entity.api.pingan.utils.checkNull.CheckNotEmpty;
 import com.ydtech.modules.order.entity.api.pingan.utils.checkNull.FieldEmptyException;
 import com.ydtech.modules.order.entity.api.pingan.utils.checkNull.Validate;
@@ -13,12 +13,11 @@ import com.ydtech.modules.order.entity.config.PingAnConfigureParameters;
 import com.ydtech.modules.order.entity.vo.BaseQuoteInfoVo;
 import com.ydtech.modules.order.entity.vo.pingan.InsDrivingIntentionInsuranceSonVo;
 import lombok.Data;
-import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.collections4.CollectionUtils;
 
 import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
+import java.util.*;
+
 /**
  *  @version
  *  @author: hxl
@@ -454,6 +453,16 @@ public class QuoteRequest extends PingAnBaseRequest {
      */
     //@CheckNotEmpty(fieldName = "是否投保小微险", message = "是否投保小微险不能为空")
     private String applyXiaoWei;
+
+
+    /***
+     * 是否投保组合产品
+     * true,false
+     * M
+     */
+    //@CheckNotEmpty(fieldName = "是否投保组合产品", message = "是否投保组合产品不能为空")
+    private String applyCombination;
+
     /***
      * 财意险列表
      */
@@ -464,6 +473,13 @@ public class QuoteRequest extends PingAnBaseRequest {
      */
     //@CheckNotEmpty(fieldName = "小微险列表")
     private List<UnAutoListInfoDTO> xiaoWeiListInfo=new ArrayList<UnAutoListInfoDTO>();
+
+    /***
+     *  组合险种
+     */
+    private List<CombinationInfoDTO> combinationInfoList=new ArrayList<CombinationInfoDTO>();
+
+
     /***
      * 非车代理人编码
      * (投保车驾意,且需要使用网点自己的非车代理需要传入。如下协议、子协议号都需要传入。)
@@ -750,8 +766,12 @@ public class QuoteRequest extends PingAnBaseRequest {
      * 【自用充电桩设备信息列表,最多3个桩】
      */
     private List<Amount23XNYChargingPostListDTO> amount23XNYChargingPostList=new ArrayList<Amount23XNYChargingPostListDTO>();
+
+    public QuoteRequest() {
+    }
+
     //todo
-    public QuoteRequest(PingAnConfigureParameters parameters, BaseQuoteInfoVo quoteInfo, SearchPAVehicleListResponse.ModelsDto modelsDto, String flowid,String accommodationFlag,String applyUnAuto,String applyXiaoWei,List<UnAutoListInfoDTO> unAutoListInfo,List<UnAutoListInfoDTO> xiaoWeiListInfo,List<Amount22XNYChargingPostListDTO> amount22XNYChargingPostList, List<Amount23XNYChargingPostListDTO> amount23XNYChargingPostList) {
+    public QuoteRequest(PingAnConfigureParameters parameters, BaseQuoteInfoVo quoteInfo,String flowid,String accommodationFlag,List<Amount22XNYChargingPostListDTO> amount22XNYChargingPostList, List<Amount23XNYChargingPostListDTO> amount23XNYChargingPostList,Map<String,Object> jymap) {
         this.setUserId(parameters.getUserId());
         this.setFlowid(flowid);
         InsOrders insOrders = new InsOrders();
@@ -764,37 +784,137 @@ public class QuoteRequest extends PingAnBaseRequest {
         this.setApplyBiz(String.valueOf(map.get("syFlag")));
         this.bizQuote=bizQuoteDto;
         this.setAccommodationFlag(accommodationFlag);
-        this.setApplyUnAuto(applyUnAuto);
-        this.setApplyXiaoWei(applyXiaoWei);
-
-        this.setIsOnlineProducts("N");
+        //处理驾意险信息
+        List<UnAutoListInfoDTO> unAutoListInfoList = getUnAutoListInfoDTOS(jymap);
+        List<UnAutoListInfoDTO> xiaoWeiListInfoList = getXiaoWeiListInfoList(jymap);
+        List<CombinationInfoDTO> combinationInfoList = getCombinationInfoDTOS(jymap);
+        if(unAutoListInfoList!=null && unAutoListInfoList.size()>0){
+            this.setApplyUnAuto("true");
+        }else{
+            this.setApplyUnAuto("false");
+        }
+        if(xiaoWeiListInfoList!=null && xiaoWeiListInfoList.size()>0){
+            this.setApplyXiaoWei("true");
+        }else{
+            this.setApplyXiaoWei("false");
+        }
+        if(xiaoWeiListInfoList!=null && xiaoWeiListInfoList.size()>0){
+            this.setApplyXiaoWei("true");
+        }else{
+            this.setApplyXiaoWei("false");
+        }
+        if(combinationInfoList!=null && combinationInfoList.size()>0){
+            this.setApplyCombination("true");
+        }else{
+            this.setApplyCombination("false");
+        }
         // 财意险列表
+        this.setUnAutoListInfo(unAutoListInfoList);
         // 小微险列表
-        this.setUnAutoListInfo(unAutoListInfo);
-        this.setXiaoWeiListInfo(xiaoWeiListInfo);
+        this.setXiaoWeiListInfo(unAutoListInfoList);
+        // 组合险列表
+        this.setCombinationInfoList(combinationInfoList);
+        this.setIsOnlineProducts("N");
         this.setAmount22XNYChargingPostList(amount22XNYChargingPostList);
         this.setAmount23XNYChargingPostList(amount23XNYChargingPostList);
     }
     /**
      *  @version
      *  @author: hxl
-     *  @Date: 2024/7/19 16:17
-     *  @Description:  处理财意险列表、小微险列表、组合险
+     *  @Date: 2024/8/8 11:21
+     *  @Description: 获取驾意险的险种信息
+     */
+    public List<Map<String,Object>> getJsonList(Map<String,Object> map,Double cyPremium,Double xwPremium,Double zhPremium){
+        List<Map<String,Object>>  list=new ArrayList<Map<String,Object>>();
+        List<QuoteRequest.UnAutoListInfoDTO> unAutoListInfoList = getUnAutoListInfoDTOS(map);
+        List<QuoteRequest.UnAutoListInfoDTO> xiaoWeiListInfoList = getXiaoWeiListInfoList(map);
+        List<QuoteRequest.CombinationInfoDTO> combinationInfoList = getCombinationInfoDTOS(map);
+
+        //赋值驾意险信息
+        Map<String,Object> jyMap=new HashMap<>();
+        Map<String,Object> xwMap=new HashMap<>();
+        Map<String,Object> zhMap=new HashMap<>();
+        if(CollectionUtils.isNotEmpty(unAutoListInfoList)){
+            jyMap.put("sumAmount",cyPremium);
+            jyMap.put("list",unAutoListInfoList);
+        }
+        if(CollectionUtils.isNotEmpty(xiaoWeiListInfoList)){
+            xwMap.put("sumAmount",xwPremium);
+            xwMap.put("list",xiaoWeiListInfoList);
+        }
+        if(CollectionUtils.isNotEmpty(combinationInfoList)){
+            zhMap.put("sumAmount",zhPremium);
+            zhMap.put("list",combinationInfoList);
+        }
+        if(jyMap!=null && jyMap.size()>0){
+            list.add(jyMap);
+        }
+        if(xwMap!=null && xwMap.size()>0){
+            list.add(xwMap);
+        }
+        if(zhMap!=null && zhMap.size()>0){
+            list.add(zhMap);
+        }
+        return list;
+    }
+
+
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/8/8 11:06
+     *  @Description:  获取组合险信息
+     */
+    public static List<CombinationInfoDTO> getCombinationInfoDTOS(Map<String, Object> jymap) {
+        List<CombinationInfoDTO>  combinationInfoList=new ArrayList<>();
+        if(jymap !=null && jymap.get("2")!=null ){;
+            List<InsDrivingIntentionInsuranceSonVo> zhlist = (List<InsDrivingIntentionInsuranceSonVo>) jymap.get("2");
+            if(zhlist!=null && zhlist.size()>0){
+                for(InsDrivingIntentionInsuranceSonVo zhVo : zhlist ){
+                    CombinationInfoDTO combinationInfo =new CombinationInfoDTO(zhVo.getProductCode(),zhVo.getCode(),zhVo.getQuantity(),zhVo.getCombineProductType());
+                    combinationInfoList.add(combinationInfo);
+                }
+            }
+        }
+        return combinationInfoList;
+    }
+
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/8/8 11:05
+     *  @Description:  获取小微险信息
+     */
+    public static List<UnAutoListInfoDTO> getXiaoWeiListInfoList(Map<String, Object> jymap) {
+        List<UnAutoListInfoDTO>  xiaoWeiListInfoList=new ArrayList<>();
+        if(jymap !=null && jymap.get("1")!=null ){
+            LinkedHashMap<String,Object> linkedMap = (LinkedHashMap<String,Object>) jymap.get("1");
+            if(linkedMap!=null && linkedMap.size()>0){
+                InsDrivingIntentionInsuranceSonVo vo = BeanUtil.mapToBean(linkedMap, InsDrivingIntentionInsuranceSonVo.class, true);
+                UnAutoListInfoDTO unAutoListInfoDTO =new UnAutoListInfoDTO(vo.getProductCode(),vo.getCode(),vo.getQuantity());
+                xiaoWeiListInfoList.add(unAutoListInfoDTO);
+            }
+        }
+        return xiaoWeiListInfoList;
+    }
+
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/8/8 11:04
+     *  @Description: 获取财意险信息
      */
-    public QuoteRequest transYJPingAnRequestMsg(InsDrivingIntentionInsuranceSonVo vo, QuoteRequest quoteRequest, String type) {
-        //处理
+    public static List<UnAutoListInfoDTO> getUnAutoListInfoDTOS(Map<String, Object> jymap) {
         List<UnAutoListInfoDTO>  unAutoListInfoList=new ArrayList<>();
-        if(vo!=null && StringUtils.isNotBlank(vo.getProductCode()) ){
-              UnAutoListInfoDTO  unAutoListInfoDTO =new  UnAutoListInfoDTO(vo.getProductCode(),vo.getCode(),"1");
-              unAutoListInfoList.add(unAutoListInfoDTO);
-        }
-        if(unAutoListInfoList!=null && unAutoListInfoList.size()>0){
-            quoteRequest.setApplyUnAuto("true");
-        }else{
-            quoteRequest.setApplyUnAuto("false");
+        if(jymap !=null && jymap.get("0")!=null ){
+            LinkedHashMap<String,Object> linkedMap = (LinkedHashMap<String,Object>) jymap.get("0");
+            if(linkedMap!=null && linkedMap.size()>0){
+                InsDrivingIntentionInsuranceSonVo vo = BeanUtil.mapToBean(linkedMap, InsDrivingIntentionInsuranceSonVo.class, true);
+                UnAutoListInfoDTO unAutoListInfoDTO =new UnAutoListInfoDTO(vo.getProductCode(),vo.getCode(),vo.getQuantity());
+                unAutoListInfoList.add(unAutoListInfoDTO);
+            }
         }
-        quoteRequest.setUnAutoListInfo(unAutoListInfoList);
-        return quoteRequest;
+        return unAutoListInfoList;
     }
 
     public QuoteRequest transferPingAnRequestMsgNY(List<KindInfoVo> kinds, QuoteRequest quoteRequest, CarConfirmResponse.BizQuoteConfigDTO bizQuoteConfig) {
@@ -1023,6 +1143,50 @@ public class QuoteRequest extends PingAnBaseRequest {
             this.sellListSize = sellListSize;
         }
     }
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/8/6 15:58
+     *  @Description:  组合险
+     */
+    @Data
+    public static class CombinationInfoDTO implements Serializable {
+
+        /***
+         * 产品编码
+         * M
+         */
+        @CheckNotEmpty(fieldName = "产品编码", message = "产品编码不能为空")
+        private String productCode;
+        /***
+         * 套餐编码
+         * M
+         */
+        @CheckNotEmpty(fieldName = "套餐编码", message = "套餐编码不能为空")
+        private String setMeal;
+        /***
+         * 购买份数
+         * M
+         */
+        @CheckNotEmpty(fieldName = "购买份数", message = "购买份数不能为空")
+        private String policyAmount;
+
+        /***
+         * 组合产品类型
+         * 11组合产品
+         * M
+         */
+        @CheckNotEmpty(fieldName = "组合产品类型", message = "组合产品类型不能为空")
+        private String productType;
+
+
+        public CombinationInfoDTO(String productCode, String setMeal, String policyAmount,String productType) {
+            this.productCode = productCode;
+            this.setMeal = setMeal;
+            this.policyAmount = policyAmount;
+            this.productType = productType;
+        }
+    }
     /***
      * 新增加设备损失险设备信息列表
      */

+ 40 - 0
src/main/java/com/ydtech/modules/order/entity/api/pingan/response/QuoteResponse.java

@@ -5,6 +5,7 @@ import lombok.Data;
 import lombok.EqualsAndHashCode;
 
 import java.io.Serializable;
+import java.util.ArrayList;
 import java.util.List;
 
 /**
@@ -88,6 +89,11 @@ public class QuoteResponse extends PingAnBaseResponse {
      */
     private XwActualPremiumDTO xwActualPremium;
 
+    /***
+     * 财产险保费
+     */
+    private CombinationPremiumDTO combinationPremium;
+
     /***
      * 商业险信息
      */
@@ -1533,5 +1539,39 @@ public class QuoteResponse extends PingAnBaseResponse {
 
     }
 
+    /***
+     * 组合险保费
+     */
+    @Data
+    public static class CombinationPremiumDTO implements Serializable {
+        /***
+         * 小微险保费
+         */
+        private List<CombinationPremiumDetaillDTO> premiumList =new ArrayList<CombinationPremiumDetaillDTO>();
+
+    }
+    @Data
+    public static class CombinationPremiumDetaillDTO implements Serializable {
+
+        /***
+         * 财意险类型
+         */
+        private String productType;
+        /***
+         * 产品编码
+         */
+        private String productCode;
+        /***
+         * 套餐编码
+         */
+        private String setMeal;
+        /***
+         * 保费
+         */
+        private String premium;
+
+    }
+
+
 
 }

+ 3 - 0
src/main/java/com/ydtech/modules/order/entity/vo/AuditOrderFeeVo.java

@@ -15,6 +15,9 @@ public class AuditOrderFeeVo {
     @ApiModelProperty(value = "订单号")
     private String orderNo;
 
+    @ApiModelProperty(value = "子订单号")
+    private String insOrderNo;
+
     @ApiModelProperty(value = "交强总费用比例")
     private String jqCostsProportionStr;
 

+ 1 - 0
src/main/java/com/ydtech/modules/order/entity/vo/BaseQuoteInfoVo.java

@@ -32,6 +32,7 @@ public class BaseQuoteInfoVo extends YaQuoteInfoVo {
 
     public BaseQuoteInfoVo(InsOrders insOrders) {
         super(insOrders);
+        this.userId = insOrders.getUserid();
         this.orderNo = insOrders.getOrderno();
         this.vehicleAndVesselTax = insOrders.getVehicleAndVesselTax().toJavaObject(VehicleAndVesselTax.class);
     }

+ 56 - 18
src/main/java/com/ydtech/modules/order/entity/vo/pingan/InsDrivingIntentionInsuranceSonVo.java

@@ -1,5 +1,6 @@
 package com.ydtech.modules.order.entity.vo.pingan;
 
+import io.swagger.annotations.ApiModel;
 import lombok.Data;
 
 import java.io.Serializable;
@@ -9,41 +10,78 @@ import java.io.Serializable;
  */
 
 @Data
+@ApiModel(value = "驾意险")
 public class InsDrivingIntentionInsuranceSonVo implements Serializable {
 
 
     private Integer id;
-
+    /***
+     *
+     * 02财产险
+     * 03意外险
+     * 10 小微险
+     */
     private String drivingCodeId;
-
+    /***
+     * 保险公司id
+     */
     private String companyId;
-
+    /***
+     *  packageCode   套餐编码
+     */
     private String code;
-
-    private String name;
-
+    /***
+     *  套餐名称
+     */
+    private String projectName;
+    /***
+     *  保额
+     */
     private String amount;
-
+    /***
+     *  保费
+     */
     private String premium;
-
+    /***
+     *  折扣
+     */
     private String discount;
-
+    /***
+     *   保费说明   每份保费或每份保费*座位数
+     */
     private String insuredAmountTips;
-
+    /***
+     * 最小购买年龄
+     */
     private String leastAcceptInsureAge;
-
+    /***
+     * 最大购买年龄
+     */
     private String topAcceptInsureAge;
-
+    /***
+     * 版本
+     */
     private String version;
-
+    /***
+     * 最大购买次数
+     */
     private String sellListSize;
-
+    /***
+     * 组合产品标识	02-组合必选
+     * 01-不可单独销售
+     */
     private String  combineProductType;
-
+    /***
+     * 产品编码
+     */
     private String productCode;
 
-    private String projectName;
-
+    /***
+     *  产品名称
+     */
+    private String name;
+    /***
+     *  份数
+     */
     private String quantity;
-
 }

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

@@ -10,7 +10,6 @@ import com.ydtech.modules.order.entity.vo.BaseQuoteInfoVo;
 import com.ydtech.modules.order.entity.vo.InsDrivingIntentionInsuranceVo;
 import com.ydtech.modules.order.entity.vo.SpecialAuditVo;
 import com.ydtech.modules.order.entity.vo.bohai.ProductDetailsQueryVo;
-import com.ydtech.modules.order.entity.vo.pingan.InsDrivingIntentionInsuranceSonVo;
 import com.ydtech.modules.order.entity.vo.pingan.PingAnQuoteVo;
 import com.ydtech.modules.order.entity.vo.pingan.RenewalConfirmVo;
 import com.ydtech.modules.order.entity.vo.pingan.StorefrontQueryVo;
@@ -40,7 +39,7 @@ public interface PingAnOrderApiService {
      * @param quoteVo
      * @return
      */
-    HttpResult<QuoteRespVo> quote(BaseQuoteInfoVo quoteInfo, PingAnQuoteVo<InsDrivingIntentionInsuranceSonVo> quoteVo) throws Exception;
+    HttpResult<QuoteRespVo> quote(BaseQuoteInfoVo quoteInfo, PingAnQuoteVo<Map<String,Object>> quoteVo) throws Exception;
 
     /**
      * 提交影像

+ 323 - 89
src/main/java/com/ydtech/modules/order/service/impl/PingAnOrderApiServiceImpl.java

@@ -1,8 +1,11 @@
 package com.ydtech.modules.order.service.impl;
 
+import cn.hutool.core.bean.BeanUtil;
 import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.google.gson.Gson;
 import com.ydtech.config.properties.PingAnApiConfigurationProperties;
+import com.ydtech.constants.enums.InsurKind;
 import com.ydtech.constants.enums.dict.InsOrderStatusEnum;
 import com.ydtech.core.page.HttpResult;
 import com.ydtech.exception.SystemException;
@@ -34,7 +37,6 @@ import com.ydtech.modules.order.entity.config.PingAnConfigureParameters;
 import com.ydtech.modules.order.entity.crawler.vo.CrawlerPolicyPrintVo;
 import com.ydtech.modules.order.entity.dto.InsUploadImagesDto;
 import com.ydtech.modules.order.entity.po.InsTaskImages;
-import com.ydtech.modules.order.entity.po.InsTaskImagesBase64;
 import com.ydtech.modules.order.entity.po.InsUploadFiles;
 import com.ydtech.modules.order.entity.vo.BaseQuoteInfoVo;
 import com.ydtech.modules.order.entity.vo.InsDrivingIntentionInsuranceVo;
@@ -45,12 +47,14 @@ import com.ydtech.modules.order.entity.vo.pingan.PingAnQuoteVo;
 import com.ydtech.modules.order.entity.vo.pingan.RenewalConfirmVo;
 import com.ydtech.modules.order.entity.vo.pingan.StorefrontQueryVo;
 import com.ydtech.modules.order.service.*;
+import com.ydtech.modules.order.utils.MD5Util;
 import com.ydtech.modules.order.utils.PingAnUpLoadUtils;
 import com.ydtech.modules.protocol.entity.po.PtlAgreementAttribution;
 import com.ydtech.modules.protocol.service.PtlAgreementAttributionService;
 import com.ydtech.utils.CalculateUtils;
 import com.ydtech.utils.StringUtils;
 import lombok.RequiredArgsConstructor;
+import org.apache.commons.collections4.CollectionUtils;
 import org.springframework.stereotype.Service;
 import org.springframework.util.ObjectUtils;
 
@@ -198,8 +202,10 @@ public class PingAnOrderApiServiceImpl implements PingAnOrderApiService {
      * @Exception
      */
     @Override
-    public HttpResult<QuoteRespVo> quote(BaseQuoteInfoVo quoteInfo, PingAnQuoteVo<InsDrivingIntentionInsuranceSonVo> quoteVo) throws Exception {
+    public HttpResult<QuoteRespVo> quote(BaseQuoteInfoVo quoteInfo, PingAnQuoteVo<Map<String,Object>> quoteVo) throws Exception {
 
+        //验证参数
+        checkData(quoteVo);
         // 车型查询
         CarInfoVo carInfo = quoteInfo.getCarInfo();
         PinganApiLog pinganApiLog = new PinganApiLog(quoteVo.getOrderNo(),null,quoteVo.getAgreementId());
@@ -208,8 +214,6 @@ public class PingAnOrderApiServiceImpl implements PingAnOrderApiService {
         // 通过 协议id获取配置实体
         PingAnConfigureParameters parameters = configureParametersComponents.toEntity(PingAnConfigureParameters.class,
                 ptlAgreementAttribution);
-
-
         try {
             // 1. 标的信息
             IndexRequest indexRequest = new IndexRequest(parameters, carInfo);
@@ -249,15 +253,15 @@ public class PingAnOrderApiServiceImpl implements PingAnOrderApiService {
             }
             //4.报价  使用车辆确认返回的流程id
             pinganApiLog.setId(null);
-            QuoteRequest quoteRequest = new QuoteRequest(parameters, quoteInfo, model, carConfirmResponse.getFlowid(), quoteVo.getAccommodationFlag(), quoteVo.getApplyUnAuto(), quoteVo.getApplyXiaoWei(), quoteVo.getUnAutoListInfo(), quoteVo.getXiaoWeiListInfo(), quoteVo.getAmount22XNYChargingPostList(), quoteVo.getAmount23XNYChargingPostList());
+            QuoteRequest quoteRequest = new QuoteRequest(parameters, quoteInfo,carConfirmResponse.getFlowid(), quoteVo.getAccommodationFlag(), quoteVo.getAmount22XNYChargingPostList(), quoteVo.getAmount23XNYChargingPostList(),quoteVo.getAccidentalDrivingVo());
             //能源车 判断 赋值能源参数
             if("1,2,3,".contains(carInfo.getEnergyType())){
+                //新能源参数传递
                 quoteRequest = quoteRequest.transferPingAnRequestMsgNY(quoteInfo.getKindList(), quoteRequest,carConfirmResponse.getBizQuoteConfig());
             }else{
+                //客车、货车传递
                 quoteRequest = quoteRequest.transferPingAnRequestMsg(quoteInfo.getKindList(), quoteRequest,carConfirmResponse.getBizQuoteConfig());
             }
-
-            quoteRequest = quoteRequest.transYJPingAnRequestMsg(quoteVo.getAccidentalDrivingVo(), quoteRequest,"1");
             QuoteResponse quoteResponse = null;
             try {
                 quoteResponse = pinganRequestApiComponents.quote(quoteRequest,pinganApiLog);
@@ -266,7 +270,7 @@ public class PingAnOrderApiServiceImpl implements PingAnOrderApiService {
             }
             if (quoteResponse != null && "0".equals(quoteResponse.getResultCode())) {
                 //5.组装返回的报价信息
-                return getQuoteRespVo(quoteResponse, quoteInfo, ptlAgreementAttribution, model,parameters.getUserId(),pinganApiLog,carConfirmResponse);
+                return getQuoteRespVo(quoteResponse, quoteInfo, ptlAgreementAttribution, model,parameters.getUserId(),pinganApiLog,carConfirmResponse,quoteVo);
             }else{
                 throw new SystemException(quoteResponse.getResultMessage());
             }
@@ -274,13 +278,41 @@ public class PingAnOrderApiServiceImpl implements PingAnOrderApiService {
             throw new SystemException(e.getMessage());
         }
     }
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/8/6 16:21
+     *  @Description:  验证参数是否正确
+     */
+    private static void checkData(PingAnQuoteVo<Map<String, Object>> quoteVo) {
+        String agreementId = quoteVo.getAgreementId();
+        if(StringUtils.isBlank(agreementId)){
+            throw new SystemException("未选择协议不能报价");
+        }
+        Map<String, Object> map = quoteVo.getAccidentalDrivingVo();
+        if(map!=null && map.get("2")!=null){
+            List<InsDrivingIntentionInsuranceSonVo> zhlist = (List<InsDrivingIntentionInsuranceSonVo>) map.get("2");
+            int  count =0;
+            if(zhlist!=null && zhlist.size()>0){
+                for(InsDrivingIntentionInsuranceSonVo zhVo : zhlist ){
+                    if("01".equals(zhVo.getCombineProductType())){
+                        count++;
+                    }
+                }
+            }
+            if(count==1){
+                throw new SystemException("组合险不能只选择不可单独销售的产品");
+            }
+        }
+    }
 
     public HttpResult<QuoteRespVo> getQuoteRespVo(QuoteResponse response,
                                                   BaseQuoteInfoVo yaQuoteInfoVo,
                                                   PtlAgreementAttribution ptlAgreementAttribution,
                                                   SearchPAVehicleListResponse.ModelsDto modelsDto,String userId,
                                                   PinganApiLog pinganApiLog,
-                                                  CarConfirmResponse carConfirmResponse
+                                                  CarConfirmResponse carConfirmResponse,
+                                                  PingAnQuoteVo<Map<String,Object>> quoteVo
     ) {
 
         PingAnQuoteRespVo quoteRespVo = new PingAnQuoteRespVo();
@@ -320,8 +352,6 @@ public class PingAnOrderApiServiceImpl implements PingAnOrderApiService {
             syPremium = Double.parseDouble(bizQuoteResult.getPremiumTotal() == null ? "0" : bizQuoteResult.getPremiumTotal());
             //商业险保费
             quoteRespVo.setSyPremium(syPremium);
-            //商业险保单号
-            quoteRespVo.setSyApplyNo(bizQuoteResult.getQueryRequestCode());
             QuoteResponse.QuoteDTO bizQuote = response.getBizQuote();
             // 交强
             quoteRespVo.setStartDateJq(forceQuote.getBeginDate());
@@ -330,19 +360,20 @@ public class PingAnOrderApiServiceImpl implements PingAnOrderApiService {
             quoteRespVo.setStartDateSy(bizQuote.getBeginDate());
             quoteRespVo.setEndDateSy(bizQuote.getEndDate());
             // 商业险险种
-            List<QuoteResponse.ClauseCaseListDTO> clauseCaseList = bizQuoteResult.getClauseCaseList();
+            List<KindInfoVo> kindList = yaQuoteInfoVo.getKindList();
             QuoteKindRespVo kind;
-            if(clauseCaseList!=null && clauseCaseList.size()>0){
-                for (QuoteResponse.ClauseCaseListDTO clauseCaseListDTO : clauseCaseList) {
+            if(kindList!=null && kindList.size()>0){
+                for (KindInfoVo kindInfoVo : kindList) {
                     kind = new QuoteKindRespVo();
-                    kind.setKindCode(clauseCaseListDTO.getProductCode());
-                    kind.setKindName(clauseCaseListDTO.getProductName());
-                    double amount = Double.parseDouble(clauseCaseListDTO.getAmount() == null ? "0" : clauseCaseListDTO.getAmount());
-                    kind.setAmount(amount);
-                    double count = Double.parseDouble(clauseCaseListDTO.getCount() == null ? "0" : clauseCaseListDTO.getCount());
-                    kind.setUnitAmount(count);
-                    //保费
-                    kind.setCoveragePremium(amount * count);
+                    kind.setKindCode(kindInfoVo.getKindCode());
+                    kind.setKindName(kindInfoVo.getKindName());
+                    kind.setAmount(kindInfoVo.getAmount());
+                    kind.setCoveragePremium(getPremium(bizQuoteResult,xnyFlag,kindInfoVo.getKindCode()));
+                    kind.setUnitAmount(kindInfoVo.getUnitAmount());
+                    kind.setServiceTimes(String.valueOf(kindInfoVo.getServiceTimes()));
+                    if (!ObjectUtils.isEmpty(kindInfoVo.getDeductibleRate())) {
+                        kind.setDeductibleRate(Double.parseDouble(kindInfoVo.getDeductibleRate()));
+                    }
                     kindList1.add(kind);
                 }
             }
@@ -352,6 +383,15 @@ public class PingAnOrderApiServiceImpl implements PingAnOrderApiService {
         QuoteResponse.AhsUpcActualPremiumDTO ahsUpcActualPremium = response.getAhsUpcActualPremium();
         // 小微险保费
         QuoteResponse.XwActualPremiumDTO xwActualPremium = response.getXwActualPremium();
+        double zhAmount=0;
+        //组合险保费
+        QuoteResponse.CombinationPremiumDTO combinationPremium = response.getCombinationPremium();
+        if(combinationPremium!=null && combinationPremium.getPremiumList()!=null && combinationPremium.getPremiumList().size()>0){
+            List<QuoteResponse.CombinationPremiumDetaillDTO> premiumList = combinationPremium.getPremiumList();
+            for(QuoteResponse.CombinationPremiumDetaillDTO vo :premiumList){
+                zhAmount+=StringUtils.isBlank(vo.getPremium())?0:Double.parseDouble(vo.getPremium());
+            }
+        }
         //小微险保费
         quoteRespVo.setAhsUpcActualPremium(ahsUpcActualPremium);
         quoteRespVo.setXwActualPremium(xwActualPremium);
@@ -362,14 +402,17 @@ public class PingAnOrderApiServiceImpl implements PingAnOrderApiService {
             //   财意险总保费
             double ahsUpcTotalPremium = Double.parseDouble(ahsUpcActualPremium.getAhsUpcTotalPremium() == null ? "0" : ahsUpcActualPremium.getAhsUpcTotalPremium());;
             jyPremium += ahsUpcTotalPremium;
+            quoteRespVo.setCyPremium(ahsUpcTotalPremium);
         }
         if (!ObjectUtils.isEmpty(xwActualPremium)) {
             double xwPremium = Double.parseDouble(xwActualPremium.getXwPremium() == null ? "0" : xwActualPremium.getXwPremium());
             jyPremium += xwPremium;
+            quoteRespVo.setXwPremium(xwPremium);
         }
+        jyPremium += zhAmount;
+        quoteRespVo.setZhPremium(zhAmount);
         //  报价险种放入保费
         List<QuoteRiskRespVo> riskList1 = QuoteRiskRespVo.toQuoteRiskRespVoList(riskList, jqPremium, syPremium);
-
         quoteRespVo.setRiskList(riskList1);
         quoteRespVo.setJqPremium(jqPremium);
         quoteRespVo.setSyPremium(syPremium);
@@ -383,40 +426,197 @@ public class PingAnOrderApiServiceImpl implements PingAnOrderApiService {
         //订单号
         quoteRespVo.setOrderno(yaQuoteInfoVo.getOrderNo());
         quoteRespVo.setCoreModels(modelsDto.toCoreModelsVo());
-        String orderId = yaQuoteInfoVo.getOrderNo();
-        return responseOrder(response, quoteRespVo, ptlAgreementAttribution, orderId,userId,pinganApiLog,carConfirmResponse);
+        return responseOrder(response, quoteRespVo, ptlAgreementAttribution, carConfirmResponse,quoteVo);
+    }
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/8/6 17:46
+     *  @Description:  赋值新能源、非新能源的商业险信息
+     */
+    private double getPremium(QuoteResponse.BizQuoteResultDTO bizQuoteResult, Boolean xnyFlag,String code) {
+        double val=0;
+        //机动车损失保险保费
+        if (InsurKind.A.getCode().equalsIgnoreCase(code)) {
+            //能源车
+            if(xnyFlag){
+                //premium01XNY	C	新能源汽车损失保险保费
+                val = StringUtils.isBlank(bizQuoteResult.getPremium01XNY())?0:Double.parseDouble(bizQuoteResult.getPremium01XNY());
+            }else{
+                // premium01	C	机动车损失保险保费
+                val = StringUtils.isBlank(bizQuoteResult.getPremium01())?0:Double.parseDouble(bizQuoteResult.getPremium01());
+            }
+        }
+        //三者险
+        if (InsurKind.B.getCode().equalsIgnoreCase(code)) {
+            if(xnyFlag){
+                //premium02XNY	C	新能源汽车第三者责任保险保费
+                val = StringUtils.isBlank(bizQuoteResult.getPremium02XNY())?0:Double.parseDouble(bizQuoteResult.getPremium02XNY());
+            }else{
+                // premium02	C	机动车第三者责任保险保费
+                val = StringUtils.isBlank(bizQuoteResult.getPremium02())?0:Double.parseDouble(bizQuoteResult.getPremium02());
+            }
+        }
+        //乘客责任险
+        if (InsurKind.D4.getCode().equalsIgnoreCase(code)) {
+            if(xnyFlag){
+                //premium03XNY	C	新能源汽车车上人员责任保险(司机)保费
+                val = StringUtils.isBlank(bizQuoteResult.getPremium03XNY())?0:Double.parseDouble(bizQuoteResult.getPremium03XNY());
+            }else{
+                //premium04	C	机动车车上人员责任保险(司机)保费
+                val = StringUtils.isBlank(bizQuoteResult.getPremium04())?0:Double.parseDouble(bizQuoteResult.getPremium04());
+            }
+        }
+        //司机责任险
+        if (InsurKind.D3.getCode().equalsIgnoreCase(code)) {
+            if(xnyFlag){
+                // premium04XNY	C单座保费*乘客座位数	新能源汽车车上人员责任保险(乘客)保费
+                val = StringUtils.isBlank(bizQuoteResult.getPremium04XNY())?0:Double.parseDouble(bizQuoteResult.getPremium04XNY());
+            }else{
+                //premium05	C单座保费*乘客座位数	机动车车上人员责任保险(乘客)保费
+                val = StringUtils.isBlank(bizQuoteResult.getPremium05())?0:Double.parseDouble(bizQuoteResult.getPremium05());
+            }
+        }
+        //  客车  premium06	C      * 	附加车上货物责任险保费   能源无
+        //  附加医保外用药责任险(第三者责任保险)
+        if (InsurKind.SY_FJ_YBW1.getCode().equalsIgnoreCase(code)) {
+            if(xnyFlag){
+                //  premium18XNY	C	附加医保外用药责任险保额(三者)保费
+                val = StringUtils.isBlank(bizQuoteResult.getPremium18XNY())?0:Double.parseDouble(bizQuoteResult.getPremium18XNY());
+            }else{
+                // premium07	C	附加医保外用药责任险保费(三者)
+                val = StringUtils.isBlank(bizQuoteResult.getPremium07())?0:Double.parseDouble(bizQuoteResult.getPremium07());
+            }
+        }
+        // 附加医保外用药责任险(车上人员责任保险(乘客))
+        if (InsurKind.SY_FJ_YBW2.getCode().equalsIgnoreCase(code)) {
+            if(xnyFlag){
+                //  premium19XNY	C	附加医保外用药责任险保额(司机)保费
+                val = StringUtils.isBlank(bizQuoteResult.getPremium19XNY())?0:Double.parseDouble(bizQuoteResult.getPremium19XNY());
+            }else{
+                // premium08	C	附加医保外用药责任险保费(司机)
+                val = StringUtils.isBlank(bizQuoteResult.getPremium08())?0:Double.parseDouble(bizQuoteResult.getPremium08());
+            }
+        }
+        // 附加医保外用药责任险(车上人员责任保险(司机))
+        if (InsurKind.SY_FJ_YBW3.getCode().equalsIgnoreCase(code)) {
+            if(xnyFlag){
+                //   premium20XNY	C	附加医保外用药责任险保额(乘客)保费
+                val = StringUtils.isBlank(bizQuoteResult.getPremium20XNY())?0:Double.parseDouble(bizQuoteResult.getPremium20XNY());
+            }else{
+                // premium09	C	附加医保外用药责任险保费(乘客)
+                val = StringUtils.isBlank(bizQuoteResult.getPremium09())?0:Double.parseDouble(bizQuoteResult.getPremium09());
+            }
+        }
+        // 附加绝对免赔率特约条款(车损)
+        if (InsurKind.MJ1.getCode().equalsIgnoreCase(code)) {
+            if(xnyFlag){
+                // premium05XNY	C     * 	附加绝对免赔率特约险(车损)保费   能源车
+                val = StringUtils.isBlank(bizQuoteResult.getPremium05XNY())?0:Double.parseDouble(bizQuoteResult.getPremium05XNY());
+            }else{
+                //premium53	C	附加绝对免赔率特约险(车损)保费
+                val = StringUtils.isBlank(bizQuoteResult.getPremium53())?0:Double.parseDouble(bizQuoteResult.getPremium53());
+            }
+        }
+        // 附加绝对免赔率特约条款(机动车第三者责任保险)
+        if (InsurKind.MJ2.getCode().equalsIgnoreCase(code)) {
+            if(xnyFlag){
+                //   premium06XNY	C	附加绝对免赔率特约险(三者)保费
+                val = StringUtils.isBlank(bizQuoteResult.getPremium06XNY())?0:Double.parseDouble(bizQuoteResult.getPremium06XNY());
+            }else{
+                // premium54	C	附加绝对免赔率特约险(三者)保费
+                val = StringUtils.isBlank(bizQuoteResult.getPremium54())?0:Double.parseDouble(bizQuoteResult.getPremium54());
+            }
+        }
+        // 附加绝对免赔率特约条款(机动车车上人员责任保险(司机))
+        if (InsurKind.MJ3.getCode().equalsIgnoreCase(code)) {
+            if(xnyFlag){
+                //  //premium07XNY	C	附加绝对免赔率特约险(车上人员司机)保费
+                val = StringUtils.isBlank(bizQuoteResult.getPremium07XNY())?0:Double.parseDouble(bizQuoteResult.getPremium07XNY());
+            }else{
+                //premium55	C	附加绝对免赔率特约险(车上人员司机)保费
+                val = StringUtils.isBlank(bizQuoteResult.getPremium55())?0:Double.parseDouble(bizQuoteResult.getPremium55());
+            }
+        }
+
+
+        // 附加绝对免赔率特约条款(机动车车上人员责任保险(乘客))
+        if (InsurKind.MJ4.getCode().equalsIgnoreCase(code)) {
+            if(xnyFlag){
+                //   premium08XNY	C	附加绝对免赔率特约险(车上人员乘客)保费
+                val = StringUtils.isBlank(bizQuoteResult.getPremium08XNY())?0:Double.parseDouble(bizQuoteResult.getPremium08XNY());
+            }else{
+                // * premium56	C	附加绝对免赔率特约险(车上人员乘客)保费
+                val = StringUtils.isBlank(bizQuoteResult.getPremium56())?0:Double.parseDouble(bizQuoteResult.getPremium56());
+            }
+        }
+        //附加修理期间费用补偿险  premium10	C	附加修理期间费用补偿险保费   非能源  无
+        // premium09XNY	C	附加车轮单独损失险保费   能源车  无
+        // premium10XNY	C	附加新增加设备损失险保费    能源车  无
+        //  premium11	C	附加新增加设备损失险保费    非能源  无
+        // 附加新增加设备损失险   暂时没有
+        //附加车身划痕损失险
+        if (InsurKind.L.getCode().equalsIgnoreCase(code)) {
+            if(xnyFlag){
+                //premium11XNY	C	附加车身划痕损失险保费
+                val = StringUtils.isBlank(bizQuoteResult.getPremium11XNY())?0:Double.parseDouble(bizQuoteResult.getPremium11XNY());
+            }else{
+                //premium17	C	附加车身划痕损失险保费
+                val = StringUtils.isBlank(bizQuoteResult.getPremium17())?0:Double.parseDouble(bizQuoteResult.getPremium17());
+            }
+        }
+        //附加法定节假日限额翻倍险
+        if (InsurKind.BD.getCode().equalsIgnoreCase(code)) {
+            if(xnyFlag){
+                //        * premium17XNY	C	附加法定节假日限额翻倍险保费
+                val = StringUtils.isBlank(bizQuoteResult.getPremium17XNY())?0:Double.parseDouble(bizQuoteResult.getPremium17XNY());
+            }else{
+                //premium74	C	附加法定节假日限额翻倍险保费    能源无
+                val = StringUtils.isBlank(bizQuoteResult.getPremium74())?0:Double.parseDouble(bizQuoteResult.getPremium74());
+            }
+        }
+        //premium32	C	附加精神损害抚慰金责任险(三者)保费    能源无
+        //premium30	C	附加精神损害抚慰金责任险(司机)保费      能源无
+        //         * premium31	C	附加精神损害抚慰金责任险(乘客)保费   能源无
+        //         * premium52	C	附加车轮单独损失险保费      能源无
+        //         * premium73	C	机动车钥匙丢失或损坏费用补偿险保费   能源无
+        //         *
+        //         * premium75	C	附加发动机损坏除外特约条款保费    能源无
+        // premium12XNY	C	附加修理期间费用补偿险保费    新能源  无
+        //premium13XNY	C	附加车上货物责任险保费
+        // * premium14XNY	C	附加精神损害抚慰金责任险(三者保费
+        // * premium15XNY	C	附加精神损害抚慰金责任险(司机保费
+        //* premium16XNY	C	附加精神损害抚慰金责任险(乘客保费
+        //* premium21XNY	C	附加外部电网故障损失险保费
+        //  * premium22XNY	C	附加自用充电桩损失保险保费
+        // * premium23XNY	C	附加自用充电桩责任保险保费
+        return val;
     }
 
     public HttpResult<QuoteRespVo> responseOrder(QuoteResponse response,
-                                                 QuoteRespVo quoteRespVo,
+                                                 PingAnQuoteRespVo quoteRespVo,
                                                  PtlAgreementAttribution ptlAgreementAttribution,
-                                                 String orderId,
-                                                 String userId,
-                                                 PinganApiLog pinganApiLog,
-                                                 CarConfirmResponse carConfirmResponse
+                                                 CarConfirmResponse carConfirmResponse,
+                                                 PingAnQuoteVo<Map<String,Object>> quoteVo
+
     ) {
         // 保存订单信息
         InsAreaCompany insAreaCompany = new InsAreaCompany(quoteRespVo, ptlAgreementAttribution);
-        //平安业务id
-        String flowid = response.getFlowid();
-        insAreaCompany.setReptxt(JSON.parseObject(JSON.toJSONString(response)));
+        //报价状态
         insAreaCompany.setOrderstatus(InsOrderStatusEnum.QUOTE_ING.getCode());
-        insAreaCompany.setInsOrderNo(flowid);
-        Map<String, Object> map = new HashMap<>();
-        QuoteResponse.AhsUpcActualPremiumDTO ahsUpcActualPremium = response.getAhsUpcActualPremium();
-        // 小微险保费
-        QuoteResponse.XwActualPremiumDTO xwActualPremium = response.getXwActualPremium();
-        map.put("xwActualPremium", xwActualPremium);
-        map.put("ahsUpcActualPremium", ahsUpcActualPremium);
-        //赋值驾意险信息
-        //insAreaCompany.setPingAnAccidentInfo(JSON.parseObject(JSON.toJSONString(map)));
+        //流程id
+        insAreaCompany.setFlowid(response.getFlowid());
+        //获取驾意险列表
+        List<Map<String, Object>> yjList = new QuoteRequest().getJsonList(quoteVo.getAccidentalDrivingVo(), quoteRespVo.getCyPremium(), quoteRespVo.getXwPremium(), quoteRespVo.getZhPremium());
+        if(CollectionUtils.isNotEmpty(yjList)){
+            insAreaCompany.setAccidentInfo(JSON.parseArray(JSON.toJSONString(yjList)));
+        }
         // 车船税
         QuoteResponse.ForceQuoteResultDTO.TaxDTO tax = response.getForceQuoteResult().getTax();
         TaxArrears taxArrears = new TaxArrears("往年欠税", Double.parseDouble(tax.getLastYearPay()),
                 Double.parseDouble(tax.getDelayPayMoney()));
         List<TaxArrears> taxArrearsList = Collections.singletonList(taxArrears);
         insAreaCompany.setTaxArrears(JSON.parseArray(JSON.toJSONString(taxArrearsList)));
-        insAreaCompany.setFlowid(flowid);
         // centile  商业险评分      商业险出现次数
         //商业出险次数
         if(response.getBizQuoteResult()!=null && response.getBizQuoteResult().getClaimNumber()!=null){
@@ -429,7 +629,6 @@ public class PingAnOrderApiServiceImpl implements PingAnOrderApiService {
         insAreaCompany.setSyRenewal("2".equals(carConfirmResponse.getBizRenewalType())?"1":carConfirmResponse.getBizRenewalType());
         insAreaCompanyService.insertCompanyAndOrders(insAreaCompany);
         quoteRespVo.setCompanyId(insAreaCompany.getId());
-
         return HttpResult.ok("报价成功", quoteRespVo);
     }
 
@@ -456,8 +655,8 @@ public class PingAnOrderApiServiceImpl implements PingAnOrderApiService {
         //图片
         List<InsUploadImagesDto> imgList = insTaskImagesMapper.getByOrderNoInsUploadImagesDtoList(insAreaCompany.getOrderno());
 
-       // List<InsTaskImagesBase64> insTaskImagesBase64s = insTaskImagesService.findByOrderNo(insOrders.getOrderno(),
-       //         insAreaCompany.getId(), true);
+        // List<InsTaskImagesBase64> insTaskImagesBase64s = insTaskImagesService.findByOrderNo(insOrders.getOrderno(),
+        //         insAreaCompany.getId(), true);
         if (imgList.isEmpty()) {
             return HttpResult.error("影像集合为空");
         } else {
@@ -483,7 +682,7 @@ public class PingAnOrderApiServiceImpl implements PingAnOrderApiService {
                 String documentFormat = fileName.split("\\.")[1];
                 boolean upLoadFileFlag = PingAnUpLoadUtils.getUpLoadFile(properties.getHost(), properties.getBucket(), properties.getAk(), properties.getSk(), file, key);
                 if(!upLoadFileFlag){
-                    throw new SystemException("上传影像文件失败");
+                    // throw new SystemException("上传影像文件失败");
                 }
                 UploadFilesRequest.DocListDTO docListDTO = new UploadFilesRequest.DocListDTO(key, documentClass, documentType, documentName,documentFormat ,
                         null, insAreaCompany.getJqapplyno(),null, parameters.getUserId(), "openApi");
@@ -750,8 +949,8 @@ public class PingAnOrderApiServiceImpl implements PingAnOrderApiService {
         PingAnConfigureParameters parameters = configureParametersComponents.toEntity(PingAnConfigureParameters.class,
                 ptlAgreementAttribution);
         List<String> list=new ArrayList<>();
-        String bizApplyNo = insAreaCompany.getJqpolicyno();
-        String forceApplyNo = insAreaCompany.getSypolicyno();
+        String bizApplyNo = insAreaCompany.getSyapplyno();
+        String forceApplyNo = insAreaCompany.getJqapplyno();
         if (StringUtils.isNotBlank(bizApplyNo)) {
             list.add(bizApplyNo);
         }
@@ -1082,16 +1281,18 @@ public class PingAnOrderApiServiceImpl implements PingAnOrderApiService {
                 } else if (("单商".equals(insAreaCompany.getProduct()) || "单三".equals(insAreaCompany.getProduct())) && sqflag) {
                     insAreaCompany.setSypolicyno(sypolicyno);
                 }
-                if(OrderStatusCodeEnum.ORDER_STATUS_CODE_B2.getCode().equals(status)){
+                String orderstatus = insAreaCompany.getOrderstatus();
+                if(OrderStatusCodeEnum.ORDER_STATUS_CODE_B2.getCode().equals(status)  && ("0".equals(orderstatus) || "1".equals(orderstatus))  ){
                     //已核保待缴费
                     insAreaCompany.setOrderstatus(InsOrderStatusEnum.WAIT_PAY.getCode());
-                }else if(OrderStatusCodeEnum.ORDER_STATUS_CODE_B5.getCode().equals(status)){
+                }else if(OrderStatusCodeEnum.ORDER_STATUS_CODE_B5.getCode().equals(status) && ("0".equals(orderstatus) || "1".equals(orderstatus) || "2".equals(orderstatus))  ){
                     //说明核保成功,更新大订单和小订单的状态为3  更新为已承保
                     if(StringUtils.isNotBlank(noticeNo)){
                         insAreaCompany.setNoticeNo(noticeNo);
                     }
                     insAreaCompany.setOrderstatus(InsOrderStatusEnum.ACCEPT_INSURANCE.getCode());
                 }
+
                 insAreaCompanyService.updateCompanyAndOrders(insAreaCompany);
                 return HttpResult.ok("更新状态成功");
 
@@ -1270,7 +1471,7 @@ public class PingAnOrderApiServiceImpl implements PingAnOrderApiService {
         } catch (Exception e) {
             throw new SystemException(e.getMessage());
         }
-        if (recoverApplyVerifyCodeResponse != null && "0".equals(recoverApplyVerifyCodeResponse.getResultCode())) {
+        if (recoverApplyVerifyCodeResponse != null && "0".equals(recoverApplyVerifyCodeResponse.getResultCode())  || (recoverApplyVerifyCodeResponse != null  && recoverApplyVerifyCodeResponse.getResultMessage().contains("已成功采集验证码"))) {
             return createNotice(companyId);
         }else{
             throw new SystemException(recoverApplyVerifyCodeResponse.getResultMessage());
@@ -1290,51 +1491,74 @@ public class PingAnOrderApiServiceImpl implements PingAnOrderApiService {
         // 通过 协议id获取配置实体
         PingAnConfigureParameters parameters = configureParametersComponents.toEntity(PingAnConfigureParameters.class,
                 ptlAgreementAttribution);
-        String forceApplyNo= insAreaCompany.getJqapplyno();
-        String  bizApplyNo = insAreaCompany.getSyapplyno();
         //生成通知单号
         ArrayList<String>  noticelist =new ArrayList<String>();
+        String bizApplyNo = insAreaCompany.getSyapplyno();
+        String forceApplyNo = insAreaCompany.getJqapplyno();
         if (StringUtils.isNotBlank(bizApplyNo)) {
             noticelist.add(bizApplyNo);
         }
         if (StringUtils.isNotBlank(forceApplyNo)) {
             noticelist.add(forceApplyNo);
         }
-        //生成通知单号
-        NoticeDoRequest noticeDoRequest = new NoticeDoRequest(parameters.getUserId(), noticelist);
-        NoticeDoResponse noticeDoResponse = null;
+        String noticeNo="";
         PinganApiLog pinganApiLog = new PinganApiLog(insAreaCompany.getOrderno(),companyId,insAreaCompany.getAgreementId());
-        try {
-            noticeDoResponse = pinganRequestApiComponents.createNoticeNo(noticeDoRequest,pinganApiLog);
-        } catch (Exception e) {
-            throw new SystemException(e.getMessage());
-        }
-        String noticeNo = noticeDoResponse.getNoticeNo();
-        ScanCodeURLRequest.DocumentDTO  noticeNoeDto=new  ScanCodeURLRequest.DocumentDTO(noticeNo,"07");
-        ArrayList<ScanCodeURLRequest.DocumentDTO>  scancodelist =new ArrayList<ScanCodeURLRequest.DocumentDTO>();
-        if (StringUtils.isNotBlank(noticeNo)) {
-            scancodelist.add(noticeNoeDto);
+        if(StringUtils.isNotBlank(insAreaCompany.getNoticeNo())){
+            noticeNo = insAreaCompany.getNoticeNo();
+        }else{
+            //生成通知单号
+            NoticeDoRequest noticeDoRequest = new NoticeDoRequest(parameters.getUserId(), noticelist);
+            NoticeDoResponse noticeDoResponse = null;
+            try {
+                noticeDoResponse = pinganRequestApiComponents.createNoticeNo(noticeDoRequest,pinganApiLog);
+            } catch (Exception e) {
+                throw new SystemException(e.getMessage());
+            }
+            noticeNo = noticeDoResponse.getNoticeNo();
         }
+
         // 获取支付的链接 只支持通知单号类型07    单证类型(01投保单02保单03批改申请单04批单05赔案号06报案号07通知单号)
         pinganApiLog.setId(null);
-        ScanCodeURLRequest scanCodeURLRequest = new ScanCodeURLRequest(scancodelist, "68",parameters.getUserId());
-        ScanCodeURLResponse scanCodeURLResponse = null;
+        ChexianStandardPrePaymentResponse chexianStandardPrePaymentResponse = null;
+        long currentTimeMillis = System.currentTimeMillis();
+        // 转换为秒,并去掉前10位(即 Tue Aug 20 18:26:39 GMT+08:00 2019 对应的秒数)
+        long seconds = currentTimeMillis / 1000L;
+        // 保留后13位
+        long l = seconds % 1000000000000L;
+        String tradeNo=properties.getClientId()+l ;
+        String clientId=properties.getClientId();
+        String mingwen=clientId +noticeNo+"CNY" +insAreaCompany.getSumpremium();
+        String signMsg = MD5Util.sha256Hex(mingwen);
+
+        ChexianStandardPrePaymentRequest  chexianStandardPrePaymentRequest =new ChexianStandardPrePaymentRequest(insAreaCompany.getSumpremium().toString(),null,null,noticeNo,null,null,tradeNo,signMsg,clientId,"CNY", properties.getClientId()+"车险保费",null);
         try {
-            scanCodeURLResponse = pinganRequestApiComponents.getScanCodeURL(scanCodeURLRequest,pinganApiLog);
+            chexianStandardPrePaymentResponse = pinganRequestApiComponents.chexianStandardPrePayment(chexianStandardPrePaymentRequest,pinganApiLog);
         } catch (Exception e) {
             throw new SystemException(e.getMessage());
         }
-        String payUrl = "";
-        //成功将支付的url链接赋值
-        if (scanCodeURLResponse != null && ScanCodeURLResponseCodeEnum.SCAN_CODE_URL_CODE_MSG_Y.getCode().equals(scanCodeURLResponse.getResultCode())) {
-            payUrl = scanCodeURLResponse.getScanCodeURLList().get(0).getScanCodeURL();
-        } else {
-            return HttpResult.error("二维码支付接口报错");
-        }
-        insAreaCompany.setPaymentLink(payUrl);
-        return HttpResult.ok(payUrl);
+        return HttpResult.ok(chexianStandardPrePaymentResponse.getPayUrl());
     }
     /**
+     *
+     *  ScanCodeURLRequest scanCodeURLRequest = new ScanCodeURLRequest(scancodelist, "68",parameters.getUserId());
+     *         ScanCodeURLResponse scanCodeURLResponse = null;
+     *         try {
+     *             scanCodeURLResponse = pinganRequestApiComponents.getScanCodeURL(scanCodeURLRequest,pinganApiLog);
+     *         } catch (Exception e) {
+     *             throw new SystemException(e.getMessage());
+     *         }
+     *         String payUrl = "";
+     *         //成功将支付的url链接赋值
+     *         if (scanCodeURLResponse != null && ScanCodeURLResponseCodeEnum.SCAN_CODE_URL_CODE_MSG_Y.getCode().equals(scanCodeURLResponse.getResultCode())) {
+     *             payUrl = scanCodeURLResponse.getScanCodeURLList().get(0).getScanCodeURL();
+     *         } else {
+     *             return HttpResult.error("二维码支付接口报错");
+     *         }
+     *         insAreaCompany.setPaymentLink(payUrl);
+     *
+     * /
+
+     /**
      *  @version
      *  @author: hxl
      *  @Date: 2024/7/22 18:57
@@ -1349,10 +1573,10 @@ public class PingAnOrderApiServiceImpl implements PingAnOrderApiService {
         PingAnConfigureParameters parameters = configureParametersComponents.toEntity(PingAnConfigureParameters.class,
                 ptlAgreementAttribution);
         PinganApiLog pinganApiLog = new PinganApiLog(insAreaCompany.getOrderno(),companyId,insAreaCompany.getAgreementId());
-        String bizApplyNo = insAreaCompany.getJqpolicyno();
-        String forceApplyNo = insAreaCompany.getSypolicyno();
         //生成通知单号
         ArrayList<String>  noticelist =new ArrayList<String>();
+        String bizApplyNo = insAreaCompany.getSyapplyno();
+        String forceApplyNo = insAreaCompany.getJqapplyno();
         if (StringUtils.isNotBlank(bizApplyNo)) {
             noticelist.add(bizApplyNo);
         }
@@ -1564,8 +1788,8 @@ public class PingAnOrderApiServiceImpl implements PingAnOrderApiService {
             pinganApiLog.setId(null);
             pinganApiLog.setRequestUrl("/payReturn");
             pinganApiLog.setRequestType("支付回调");
-            pinganApiLog.setRequestParam(payReturnRequest.toString());
-            pinganApiLog.setResponseBody(null);
+            pinganApiLog.setRequestParam(new Gson().toJson(payReturnRequest));
+            pinganApiLog.setResponseBody(payReturnRequest.getResultMsg()+"-"+payReturnRequest.getErrorMsg());
             pinganApiLogService.save(pinganApiLog);
             // 账号信息
             PtlAgreementAttribution ptlAgreementAttribution = ptlAgreementAttributionService.getById(insAreaCompany.getAgreementId());
@@ -1573,8 +1797,8 @@ public class PingAnOrderApiServiceImpl implements PingAnOrderApiService {
             PingAnConfigureParameters parameters = configureParametersComponents.toEntity(PingAnConfigureParameters.class,
                     ptlAgreementAttribution);
             List<String> list = new ArrayList<>();
-            String bizApplyNo = insAreaCompany.getJqpolicyno();
-            String forceApplyNo = insAreaCompany.getSypolicyno();
+            String bizApplyNo = insAreaCompany.getSyapplyno();
+            String forceApplyNo = insAreaCompany.getJqapplyno();
             if (StringUtils.isNotBlank(bizApplyNo)) {
                 list.add(bizApplyNo);
             }
@@ -1593,24 +1817,34 @@ public class PingAnOrderApiServiceImpl implements PingAnOrderApiService {
                 if (documentStatusListResponse != null && "0".equals(documentStatusListResponse.getResultCode())) {
                     ArrayList<DocumentStatusListResponse.DocumentDTO> documentList = documentStatusListResponse.getDocumentList();
                     String status = "";
+                    String policyNo ="";
                     if (documentList != null && documentList.size() > 0) {
                         Boolean flag = false;
-                        //B2 为 未缴费
                         for (DocumentStatusListResponse.DocumentDTO dto : documentList) {
                             status = dto.getStatus();
-                            if (!OrderStatusCodeEnum.ORDER_STATUS_CODE_B5.getCode().equals(dto.getStatus())) {
+                            policyNo = dto.getPolicyNo();
+                            if (OrderStatusCodeEnum.ORDER_STATUS_CODE_B5.getCode().equals(dto.getStatus())) {
                                 flag = false;
                             }
                         }
+                        insAreaCompany.setJqpolicyno(policyNo);
                         //已承保更新承保状态
-                        if (!flag && OrderStatusCodeEnum.ORDER_STATUS_CODE_B5.getCode().equals(status)) {
+                        if (OrderStatusCodeEnum.ORDER_STATUS_CODE_B5.getCode().equals(status) && ("0".equals(insAreaCompany.getOrderstatus()) || "1".equals(insAreaCompany.getOrderstatus()) || "2".equals(insAreaCompany.getOrderstatus())) ) {
                             insAreaCompany.setOrderstatus(InsOrderStatusEnum.ACCEPT_INSURANCE.getCode());
                             insAreaCompanyService.updateCompanyAndOrders(insAreaCompany);
-                            return HttpResult.ok("承保成功");
+                            return HttpResult.ok("支付成功");
                         }
                     }
                 }
             }
+        }else{
+            PinganApiLog pinganApiLog = new PinganApiLog(null,null,null);
+            pinganApiLog.setId(null);
+            pinganApiLog.setRequestUrl("/payReturn");
+            pinganApiLog.setRequestType("支付回调");
+            pinganApiLog.setRequestParam(new Gson().toJson(payReturnRequest));
+            pinganApiLog.setResponseBody(payReturnRequest.getResultMsg()+"-"+payReturnRequest.getErrorMsg());
+            pinganApiLogService.save(pinganApiLog);
         }
         return HttpResult.error("支付失败");
     }

+ 131 - 0
src/main/java/com/ydtech/modules/order/utils/MD5Util.java

@@ -0,0 +1,131 @@
+package com.ydtech.modules.order.utils;
+
+
+import java.io.UnsupportedEncodingException;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+
+public class MD5Util {
+
+    private static final String HEX_CHARS = "0123456789abcdef";
+    private MD5Util() {}
+
+   /**
+     * 返回 MessageDigest MD5
+     */
+   private static MessageDigest getDigest() {
+	   try {
+           return MessageDigest.getInstance("MD5");
+       } catch (NoSuchAlgorithmException e) {
+           throw new RuntimeException(e);
+       }
+    }
+   
+   /**
+    * 返回 MessageDigest MD5
+    */
+  private static MessageDigest getDigestBySha() {
+	   try {
+          return MessageDigest.getInstance("SHA-256");
+      } catch (NoSuchAlgorithmException e) {
+          throw new RuntimeException(e);
+      }
+   }
+
+    /**
+     * MD5加密,并返回作为一个十六进制字节
+     */
+    public static byte[] md5(byte[] data) {
+        return getDigest().digest(data);
+    }
+
+    /**
+     * SHA-256加密,并返回作为一个十六进制字节
+     */
+    public static byte[] sha256(byte[] data) {
+        return getDigestBySha().digest(data);
+    }
+
+    /**
+     * MD5加密,并返回作为一个十六进制字节
+     * <code>byte[]</code>.
+     * 
+     * @param data
+     *            Data to digest
+     * @return MD5 digest
+     */
+    public static byte[] md5(String data) {
+    	byte[] bytes = null;
+        try {
+        	bytes = md5(data.getBytes("UTF-8"));
+		} catch (UnsupportedEncodingException e) {
+			//LogUtil.error("MD5加密出错。",e);
+		}
+		return bytes;
+    }
+
+    /**
+     * MD5加密,并返回一个32字符的十六进制值
+     */
+    public static String md5Hex(byte[] data) {
+        return toHexString(md5(data));
+    }
+
+    /**
+     * MD5加密,并返回一个32字符的十六进制值
+     */
+    public static String md5Hex(String data) {
+        return toHexString(md5(data));
+    }
+    /**
+     * SHA256加密
+     */
+    public static String sha256Hex(String data) {
+        try {
+			return toHexString(sha256(data.getBytes("UTF-8")));
+		} catch (UnsupportedEncodingException e) {
+			//LogUtil.error("MD5加密出错。",e);
+			return null;
+		}
+    }
+    
+    private static String toHexString(byte[] b) {
+        StringBuffer stringbuffer = new StringBuffer();
+        for (int i = 0; i < b.length; i++) {
+        	stringbuffer.append(HEX_CHARS.charAt(b[i] >>> 4 & 0x0F));
+        	stringbuffer.append(HEX_CHARS.charAt(b[i] & 0x0F));
+        }
+        return stringbuffer.toString();
+    }
+
+	/**
+	 * MD5加密
+	 * @param s
+	 * @return
+	 */
+	public static String MD5(String s) {
+		char hexDigits[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9','A', 'B', 'C', 'D', 'E', 'F' };
+		try {
+			byte[] btInput = s.getBytes("UTF-8");
+			// 获得MD5摘要算法的 MessageDigest 对象
+			MessageDigest mdInst = MessageDigest.getInstance("MD5");
+			// 使用指定的字节更新摘要
+			mdInst.update(btInput);
+			// 获得密文
+			byte[] md = mdInst.digest();
+			// 把密文转换成十六进制的字符串形式
+			int j = md.length;
+			char str[] = new char[j * 2];
+			int k = 0;
+			for (int i = 0; i < j; i++) {
+				byte byte0 = md[i];
+				str[k++] = hexDigits[byte0 >>> 4 & 0xf];
+				str[k++] = hexDigits[byte0 & 0xf];
+			}
+			return new String(str);
+		} catch (Exception e) {
+			
+			return null;
+		}
+	}
+}

+ 291 - 5
src/main/resources/mapper/modules/fnc/InsPlyIncomeMapper.xml

@@ -2451,6 +2451,9 @@
             <if test="vo.type !=null  and  vo.type  !=''">
                 and pa.agreement_type =#{vo.type}
             </if>
+            <if test="vo.isNotCar !=null  and  vo.isNotCar  !=''">
+                and a.is_not_car =#{vo.isNotCar}
+            </if>
             <if test="vo.beginDate  != null  and  vo.beginDate!=''  and vo.endDate  != null  and  vo.endDate!=''">
                 AND  a.create_time  BETWEEN #{vo.beginDate} AND #{vo.endDate}
             </if>
@@ -2529,14 +2532,14 @@
             resultType="com.ydtech.modules.admin.model.report.financialReceivables.FinancialReceivablesAllMonthVo">
         SELECT
             SUM(IFNULL(a.commission_feevalue ,0 ) + IFNULL(a.other_feevalue ,0 )) AS ysSumAmount,
-            SUM(CASE WHEN a.handling_fees_status = '0' THEN IFNULL(a.commission_feevalue ,0 ) + IFNULL(a.other_feevalue ,0 ) ELSE 0 END ) AS "ysSumAmount",
+            SUM(CASE WHEN a.handling_fees_status = '0' THEN IFNULL(a.commission_feevalue ,0 ) + IFNULL(a.other_feevalue ,0 ) ELSE 0 END ) AS "yisSumAmount",
             SUM(CASE WHEN a.handling_fees_status = '1' THEN IFNULL(a.commission_feevalue ,0 ) + IFNULL(a.other_feevalue ,0 ) ELSE 0 END) AS "wsSumAmount"
         FROM
             ins_ply_income a
-                LEFT JOIN
+            LEFT JOIN
             ptl_agreement pa ON pa.id = a.agreement_id
-        where
         <where>
+            1=1
             <if test="vo.type !=null  and  vo.type  !=''">
                 and pa.agreement_type =#{vo.type}
             </if>
@@ -2545,11 +2548,294 @@
             </if>
         </where>
     </select>
-    <select id="queryDateByTypeByMonthList"
-            resultType="com.ydtech.modules.admin.model.report.financialReceivables.FinancialReceivablesMonthVo">
 
+    <select id="queryDateByTypeByMonthList"  resultType="com.ydtech.modules.admin.model.report.financialReceivables.FinancialReceivablesMonthVo">
+        SELECT
+            a.subPathner,
+            sa.area_cname as "areaName",
+            eic.namesimple as "companyName",
+            a.handlingReceivable  as "commissionFeevalue",
+            a.partnerCompaniesId  as "partnerCompaniesId",
+            a.companyId as "companyId",
+            IFNULL(a.settleAmount ,0 )   as "settlementAmount",
+            a.unlicensedHandlingFee  as "noSettlementAmount",
+            IFNULL(a.unlicensedHandlingFee ,0 ) + IFNULL(a.settleAmount,0 ) as  "noInvoicCommissionFeevalue",
+            "手续费" as  "isHand",
+            IFNULL(a.handlingReceivable ,0 ) - IFNULL((IFNULL(a.unlicensedHandlingFee ,0 ) + IFNULL(a.settleAmount,0 )),0 ) as  "readyCommissionFeevalue"
+        FROM
+            (SELECT
+                 SUBSTRING( a.partner_companies_id, 6, 11 ) AS "subPathner",
+                 a.company_id as "companyId",
+                 a.partner_companies_id as "partnerCompaniesId",
+                 sum( a.commission_feevalue ) as "handlingReceivable",
+                 SUM( CASE WHEN a.handling_fees_status = '0' THEN a.commission_feevalue ELSE 0 END ) AS "unlicensedHandlingFee",
+                 MAX(b.noSettHandlingFee) AS "settleAmount"
+             FROM
+                 ins_ply_income a
+                     LEFT JOIN ptl_agreement pa ON a.agreement_id = pa.id
+                     LEFT JOIN (
+                     SELECT
+                         sum(a.commission_feevalue)  as "invoicAmount",
+                         IFNULL(sum(a.commission_feevalue) ,0 ) - IFNULL(max(b.settlementAmount) ,0 ) as  "noSettHandlingFee",
+                         a.signdate,
+                         a.task_id as "taskId" ,
+                        a.partner_companies_id  as "subPathner"
+                     FROM
+                         ins_ply_income a
+                             LEFT JOIN ptl_agreement pa ON a.agreement_id = pa.id
+                             LEFT JOIN (
+                             select sum(settlement_amount) as "settlementAmount", a.task_id  as "taskId" from settlement_documentary_fees   a
+                             <where>
+                                 a.task_id IS NOT NULL
+                                 and a.settlement_status ='2'
+                                 <if test="vo.isNoCar !=null  and  vo.isNoCar  !=''">
+                                     and a.handling_fees_status =#{vo.isNoCar}
+                                 </if>
+                             </where>
+                             GROUP BY  a.task_id
+                         ) b  on  a.task_id=b.taskId
+                     <where>
+                         pa.agreement_type = '2'
+                         AND a.is_not_documentary = '0'
+                         AND a.task_id  is not  null
+                         <if test="vo.beginDate  != null  and  vo.beginDate!=''  and vo.endDate  != null  and  vo.endDate!=''">
+                             AND  a.signdate  BETWEEN #{vo.beginDate} AND #{vo.endDate}
+                         </if>
+                         <if test="vo.isNoCar !=null  and  vo.isNoCar  !=''">
+                             and a.is_not_car =#{vo.isNoCar}
+                         </if>
+                     </where>
+                     GROUP BY
+                         a.task_id , a.signdate,a.partner_companies_id
+                 ) b  on  b.subPathner = a.partner_companies_id
+             <where>
+                 pa.agreement_type = '2'
+                 AND a.is_not_documentary = '0'
+                 <if test="vo.beginDate  != null  and  vo.beginDate!=''  and vo.endDate  != null  and  vo.endDate!=''">
+                     AND  a.signdate  BETWEEN #{vo.beginDate} AND #{vo.endDate}
+                 </if>
+                 <if test="vo.isNoCar !=null  and  vo.isNoCar  !=''">
+                     and a.is_not_car =#{vo.isNoCar}
+                 </if>
+             </where>
+             GROUP BY
+        a.partner_companies_id ,a.company_id) a
+        LEFT JOIN esm_ins_company  eic  on eic.id = a.companyId
+        LEFT JOIN sys_area  sa  on sa.area_code = a.subPathner
+    </select>
+
+
+    <select id="queryDateByTypeByMonthOtherList"  resultType="com.ydtech.modules.admin.model.report.financialReceivables.FinancialReceivablesMonthVo">
+        SELECT
+            a.partner_companies_id,
+            sa.area_cname as "areaName",
+            eic.namesimple as "companyName",
+            sum(a.other_feevalue) as "commissionFeevalue",
+            IFNULL(max(b.invoicedSettledAmount) ,0 ) as "readyCommissionFeevalue",
+            sum(a.other_feevalue) -IFNULL(max(b.invoicedSettledAmount) ,0 ) as "noInvoicCommissionFeevalue",
+            IFNULL(max(b.invoicedNotSettledAmount) ,0 )  as "settlementAmount",
+            sum(a.other_feevalue) -IFNULL(max(b.invoicedSettledAmount) ,0 )-IFNULL(max(b.invoicedNotSettledAmount) ,0 ) as "noSettlementAmount",
+            SUBSTRING( a.partner_companies_id, 6, 11 ) AS "subPathner",
+            "跟单费" as  "isHand",
+            a.company_id AS "companyId"
+        FROM
+            ins_ply_income a
+                LEFT JOIN ptl_agreement pa ON a.agreement_id = pa.id
+                LEFT JOIN (
+                SELECT
+                    a.partner_companies_id,
+                    sum(a.invoiced_settled_amount)  as  "invoicedSettledAmount",
+                    sum(a.Invoiced_not_settled_amount)  as  "invoicedNotSettledAmount"
+                FROM
+                    settlement_documentary_fees a
+                <where>
+                    a.settlement_sum_id IS NOT NULL
+                    AND settlement_status = '1'
+                    <if test="vo.beginDate  != null  and  vo.beginDate!=''  and vo.endDate  != null  and  vo.endDate!=''">
+                        AND  a.signing_time  BETWEEN #{vo.beginDate} AND #{vo.endDate}
+                    </if>
+                    <if test="vo.isNoCar !=null  and  vo.isNoCar  !=''">
+                        and a.is_not_car =#{vo.isNoCar}
+                    </if>
+                </where>
+                GROUP BY
+                    a.partner_companies_id
+            )  b  on b.partner_companies_id =a.partner_companies_id
+                LEFT JOIN esm_ins_company  eic  on eic.id = a.company_Id
+                LEFT JOIN sys_area  sa  on sa.area_code = SUBSTRING( a.partner_companies_id, 6, 11 )
+        <where>
+            pa.agreement_type = '2'
+            AND a.is_not_documentary = '1'
+            <if test="vo.beginDate  != null  and  vo.beginDate!=''  and vo.endDate  != null  and  vo.endDate!=''">
+                AND  a.signdate  BETWEEN #{vo.beginDate} AND #{vo.endDate}
+            </if>
+            <if test="vo.isNoCar !=null  and  vo.isNoCar  !=''">
+                and a.is_not_car =#{vo.isNoCar}
+            </if>
+        </where>
+        group by
+            a.partner_companies_id,a.company_id,sa.area_cname
+    </select>
+
+
+    <select id="queryPlatHanding"  resultType="com.ydtech.modules.admin.model.report.financialReceivables.FinancialReceivablesMonthVo">
+        SELECT
+            1  as  orderNumber,
+            '手续费' AS isHand,
+            sa.area_cname AS areaName,
+            eic.namesimple AS companyName,
+            a.partner_companies_id AS partnerCompaniesId,
+            SUM(a.commission_feevalue) AS commissionFeevalue,
+            SUBSTRING( a.partner_companies_id, 6, 11 ) AS "subPathner",
+            SUM(CASE WHEN a.handling_fees_status = '1' THEN a.commission_feevalue ELSE 0 END) AS "readyCommissionFeevalue",
+            SUM(CASE WHEN a.handling_fees_status = '0' THEN a.commission_feevalue ELSE 0 END) AS "noInvoicCommissionFeevalue"
+        FROM
+            ins_ply_income a
+                LEFT JOIN ptl_agreement pa ON a.agreement_id = pa.id
+                LEFT JOIN sys_area sa ON sa.area_code = SUBSTRING(a.partner_companies_id, 6, 11)
+                LEFT JOIN esm_ins_company eic ON eic.id = a.company_id
+        <where>
+            pa.agreement_type = '1'
+            AND a.is_not_documentary = '1'
+            <if test="vo.beginDate  != null  and  vo.beginDate!=''  and vo.endDate  != null  and  vo.endDate!=''">
+                AND  a.signdate  BETWEEN #{vo.beginDate} AND #{vo.endDate}
+            </if>
+            <if test="vo.isNoCar !=null  and  vo.isNoCar  !=''">
+                and a.is_not_car =#{vo.isNoCar}
+            </if>
+        </where>
+        GROUP BY
+            a.partner_companies_id, eic.namesimple, sa.area_cname
 
+        UNION ALL
 
+        SELECT
+            2  as  orderNumber,
+            '跟单费' AS isHand,
+            sa.area_cname AS areaName,
+            eic.namesimple AS companyName,
+            a.partner_companies_id AS partnerCompaniesId,
+            SUM(a.other_feevalue) AS commissionFeevalue,
+            SUBSTRING( a.partner_companies_id, 6, 11 ) AS "subPathner",
+            SUM(CASE WHEN a.handling_fees_status = '1' THEN a.other_feevalue ELSE 0 END) AS "readyCommissionFeevalue",
+            SUM(CASE WHEN a.handling_fees_status = '0' THEN a.other_feevalue ELSE 0 END) AS "noInvoicCommissionFeevalue"
+        FROM
+            ins_ply_income a
+                LEFT JOIN ptl_agreement pa ON a.agreement_id = pa.id
+                LEFT JOIN sys_area sa ON sa.area_code = SUBSTRING(a.partner_companies_id, 6, 11)
+                LEFT JOIN esm_ins_company eic ON eic.id = a.company_id
+        <where>
+            pa.agreement_type = '1'
+            <if test="vo.beginDate  != null  and  vo.beginDate!=''  and vo.endDate  != null  and  vo.endDate!=''">
+                AND  a.signdate  BETWEEN #{vo.beginDate} AND #{vo.endDate}
+            </if>
+            <if test="vo.isNoCar !=null  and  vo.isNoCar  !=''">
+                and a.is_not_car =#{vo.isNoCar}
+            </if>
+        </where>
+        GROUP BY
+            a.partner_companies_id, eic.namesimple, sa.area_cname
+        UNION ALL
+        SELECT
+            3  as  orderNumber,
+            '合计' AS isHand,
+            sa.area_cname AS areaName,
+            eic.namesimple AS companyName,
+            a.partner_companies_id AS partnerCompaniesId,
+            SUM(a.all_fee_value) AS commissionFeevalue,
+            SUBSTRING( a.partner_companies_id, 6, 11 ) AS "subPathner",
+            SUM(CASE WHEN a.handling_fees_status = '1' THEN a.all_fee_value ELSE 0 END) AS "readyCommissionFeevalue",
+            SUM(CASE WHEN a.handling_fees_status = '0' THEN a.all_fee_value ELSE 0 END) AS "noInvoicCommissionFeevalue"
+        FROM
+            ins_ply_income a
+                LEFT JOIN ptl_agreement pa ON a.agreement_id = pa.id
+                LEFT JOIN sys_area sa ON sa.area_code = SUBSTRING(a.partner_companies_id, 6, 11)
+                LEFT JOIN esm_ins_company eic ON eic.id = a.company_id
+        <where>
+            pa.agreement_type = '1'
+            <if test="vo.beginDate  != null  and  vo.beginDate!=''  and vo.endDate  != null  and  vo.endDate!=''">
+                AND  a.signdate  BETWEEN #{vo.beginDate} AND #{vo.endDate}
+            </if>
+            <if test="vo.isNoCar !=null  and  vo.isNoCar  !=''">
+                and a.is_not_car =#{vo.isNoCar}
+            </if>
+        </where>
+        GROUP BY
+            a.partner_companies_id, eic.namesimple, sa.area_cname
+        ORDER BY
+            companyName,
+            areaName,
+            orderNumber;
+    </select>
 
+    <select id="queryPrivateCar" resultType="com.ydtech.modules.admin.model.report.financialReceivables.FinancialReceivablesVo">
+        SELECT
+            DATE_FORMAT( a.signdate, '%Y-%m' )  as "yearAndMonth" ,
+            sum(a.all_fee_value)  as "commissionFeevalue",
+            IFNULL(max(b.readyCommissionFeevalue),0) + IFNULL(max(c.readyCommissionFeevalue1),0)  as  "noInvoicCommissionFeevalue",
+            sum(a.all_fee_value) -(IFNULL(max(b.readyCommissionFeevalue),0) + IFNULL(max(c.readyCommissionFeevalue1),0)) as "readyCommissionFeevalue",
+            (IFNULL(max(b.inSettlementAmount),0) -IFNULL(sum(b.readyCommissionFeevalue),0)) +IFNULL(max(c.settlementAmount),0)  as "settlementAmount",
+            IFNULL(max(c.noInvoicCommissionFeevalue),0)  + ((SUM( CASE WHEN a.handling_fees_status = '0' and a.is_not_documentary ='0' THEN a.all_fee_value ELSE 0 END ))) as "noSettlementAmount"
+        FROM
+            ins_ply_income a
+                LEFT JOIN ptl_agreement pa ON a.agreement_id = pa.id
+                left join (
+                SELECT
+                    SUM( CASE WHEN settlement_status = '2' THEN a.settlement_amount ELSE 0 END )  as "readyCommissionFeevalue",
+                    SUM( CASE WHEN settlement_status = '1' THEN a.settlement_amount ELSE 0 END )  as "inSettlementAmount",
+                    a.task_id AS "taskId"
+                FROM
+                    settlement_documentary_fees a
+                <where>
+                    a.task_id IS NOT NULL
+                    <if test="vo.isNotCar !=null  and  vo.isNotCar  !=''">
+                        and a.is_not_car =#{vo.isNotCar}
+                    </if>
+                </where>
+                GROUP BY
+                    a.task_id
+            )  b   on  b .taskId =a.task_id
+                left  join (
+                SELECT
+                    DATE_FORMAT( a.signing_time, '%Y-%m' ) as "singDateYear",
+                    sum( a.invoiced_settled_amount ) AS "readyCommissionFeevalue1",
+                    sum( a.Invoiced_not_settled_amount ) AS "settlementAmount",
+                    SUM( CASE WHEN settlement_status = '1' THEN a.settlement_amount ELSE 0 END )  as "invoiceAmount",
+                    IFNULL(sum(b.otherallFeeValue),0) -sum( a.invoiced_settled_amount ) as "noInvoicCommissionFeevalue",
+                    IFNULL(sum(b.otherallFeeValue),0) -sum( a.invoiced_settled_amount ) - SUM( CASE WHEN settlement_status = '1' THEN a.settlement_amount ELSE 0 END ) as "noSettlementAmount"
+                FROM
+                    settlement_documentary_fees a
+                        left join  (
+                        select sum(a.all_fee_value) as "otherallFeeValue", DATE_FORMAT( a.signdate, '%Y-%m' ) as "singDateYear"  from  ins_ply_income a
+                        LEFT JOIN ptl_agreement pa ON a.agreement_id = pa.id
+                        <where>
+                            pa.agreement_type= '2'
+                            and a.is_not_documentary='1'
+                            <if test="vo.isNotCar !=null  and  vo.isNotCar  !=''">
+                                and a.is_not_car =#{vo.isNotCar}
+                            </if>
+                            <if test="vo.beginDate  != null  and  vo.beginDate!=''  and vo.endDate  != null  and  vo.endDate!=''">
+                                AND  a.signdate  BETWEEN #{vo.beginDate} AND #{vo.endDate}
+                            </if>
+                        </where>
+
+                        GROUP BY DATE_FORMAT( a.signdate, '%Y-%m' )
+                    )  b  on b.singDateYear = DATE_FORMAT( a.signing_time, '%Y-%m' )
+                <where>
+                    a.settlement_sum_id IS NOT NULL
+                    AND settlement_status = '1'
+                </where>
+                GROUP BY DATE_FORMAT( a.signing_time, '%Y-%m' )
+            )  c  on  c.singDateYear=DATE_FORMAT( a.signdate, '%Y-%m' )
+        <where>
+            pa.agreement_type ='2'
+            <if test="vo.isNotCar !=null  and  vo.isNotCar  !=''">
+                and a.is_not_car =#{vo.isNotCar}
+            </if>
+            <if test="vo.beginDate  != null  and  vo.beginDate!=''  and vo.endDate  != null  and  vo.endDate!=''">
+                AND  a.signdate  BETWEEN #{vo.beginDate} AND #{vo.endDate}
+            </if>
+        </where>
+        GROUP BY DATE_FORMAT( a.signdate, '%Y-%m' )
     </select>
 </mapper>