Selaa lähdekoodia

Merge branch 'test' into test-wks

wks 1 vuosi sitten
vanhempi
commit
36d4c6192a

+ 11 - 0
sql/Online.sql

@@ -0,0 +1,11 @@
+--  2025-4-08 BY dongxin
+INSERT INTO `agent`.`ins_driving_intention_insurance` ( `parent_id`, `type`, `company_id`, `project_name`, `project_code`, `alias`, `risk_code`, `seat_num`, `sum_amount`, `sum_premium`, `request_data`, `api_type`, `relate_code`) VALUES ( 0, 2, 'PICC1000000', '“如意行”非营运客车方案C款(山西大众版)年龄(16至60周岁)(1至1年)', 'EAD1400014', NULL, NULL, NULL, 0.00, 0.00, NULL, 2, NULL);
+INSERT INTO `agent`.`ins_driving_intention_insurance` ( `parent_id`, `type`, `company_id`, `project_name`, `project_code`, `alias`, `risk_code`, `seat_num`, `sum_amount`, `sum_premium`, `request_data`, `api_type`, `relate_code`) VALUES ( 0, 2, 'PICC1000000', '“如意行”非营运客车方案C款(豪华版)(1至1年)', 'EAD0000042', NULL, NULL, NULL, 0.00, 0.00, NULL, 2, NULL);
+INSERT INTO `agent`.`ins_driving_intention_insurance` ( `parent_id`, `type`, `company_id`, `project_name`, `project_code`, `alias`, `risk_code`, `seat_num`, `sum_amount`, `sum_premium`, `request_data`, `api_type`, `relate_code`) VALUES ( 0, 2, 'PICC1000000', '“如意行”非营运客车方案B款(尊享版)(1至1年)', 'EAD0000039', NULL, NULL, NULL, 0.00, 0.00, NULL, 2, NULL);
+INSERT INTO `agent`.`ins_driving_intention_insurance` ( `parent_id`, `type`, `company_id`, `project_name`, `project_code`, `alias`, `risk_code`, `seat_num`, `sum_amount`, `sum_premium`, `request_data`, `api_type`, `relate_code`) VALUES ( 0, 2, 'PICC1000000', '如意行驾意险非营运客车方案(随人尊享版)(1至1年)', 'EAD0000043', NULL, NULL, NULL, 0.00, 0.00, NULL, 2, NULL);
+INSERT INTO `agent`.`ins_driving_intention_insurance` ( `parent_id`, `type`, `company_id`, `project_name`, `project_code`, `alias`, `risk_code`, `seat_num`, `sum_amount`, `sum_premium`, `request_data`, `api_type`, `relate_code`) VALUES ( 0, 2, 'PICC1000000', '“如意行”非营运客车方案B款(豪华版)(1至1年)', 'EAD0000038', NULL, NULL, NULL, 0.00, 0.00, NULL, 2, NULL);
+INSERT INTO `agent`.`ins_driving_intention_insurance` ( `parent_id`, `type`, `company_id`, `project_name`, `project_code`, `alias`, `risk_code`, `seat_num`, `sum_amount`, `sum_premium`, `request_data`, `api_type`, `relate_code`) VALUES ( 0, 2, 'PICC1000000', '“如意行”非营运客车方案B款(升级版)(1至1年)', 'EAD0000037', NULL, NULL, NULL, 0.00, 0.00, NULL, 2, NULL);
+INSERT INTO `agent`.`ins_driving_intention_insurance` ( `parent_id`, `type`, `company_id`, `project_name`, `project_code`, `alias`, `risk_code`, `seat_num`, `sum_amount`, `sum_premium`, `request_data`, `api_type`, `relate_code`) VALUES ( 0, 2, 'PICC1000000', '“如意行”非营运客车方案A款(豪华版)(0至1年)', 'EAD0000035', NULL, NULL, NULL, 0.00, 0.00, NULL, 2, NULL);
+INSERT INTO `agent`.`ins_driving_intention_insurance` ( `parent_id`, `type`, `company_id`, `project_name`, `project_code`, `alias`, `risk_code`, `seat_num`, `sum_amount`, `sum_premium`, `request_data`, `api_type`, `relate_code`) VALUES ( 0, 2, 'PICC1000000', '“如意行”非营运客车方案C款(升级版)(1至1年)', 'EAD0000041', NULL, NULL, NULL, 0.00, 0.00, NULL, 2, NULL);
+
+INSERT INTO `agent`.`ins_driving_intention_insurance_type_company` ( `company_id`, `type_id`, `is_multiple`, `is_enable`, `create_time`) VALUES ( 'PICC1000000', 2, 0, 1, '2025-04-17 16:29:17');

+ 3 - 2
src/main/java/com/ydtech/modules/admin/controller/CompanyDataReportConroller.java

@@ -126,7 +126,8 @@ public class CompanyDataReportConroller {
     @PostMapping("/largeOrdersExcel")
     @ApiOperation(value = "大订单导出")
     public HttpResult largeOrdersExcel(@RequestBody OrdersDataVo ordersDataVo) {
-        String userId = BaseController.getUserId();
-        return this.companyDataReportService.largeOrdersExcel(ordersDataVo,userId);
+        String userId = ordersDataVo.getUserId();
+        String userLoginId = BaseController.getUserId();
+        return this.companyDataReportService.largeOrdersExcel(ordersDataVo,userId,userLoginId);
     }
 }

+ 2 - 0
src/main/java/com/ydtech/modules/admin/model/po/SysUserAccount.java

@@ -3,6 +3,7 @@ package com.ydtech.modules.admin.model.po;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.Version;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
@@ -126,6 +127,7 @@ public class SysUserAccount implements Serializable {
      *  账号总金额
      */
     @TableField(value = "sum_amount")
+//    @Version
     private BigDecimal sumAmount;
 
     /**

+ 9 - 0
src/main/java/com/ydtech/modules/admin/model/report/company/OrdersDataDto.java

@@ -77,4 +77,13 @@ public class OrdersDataDto  implements Serializable {
 
     @ApiModelProperty("车型")
     private String modelcname;
+
+    @ApiModelProperty("业务员id")
+    private String userId;
+
+    @ApiModelProperty("业务员名称")
+    private String userName;
+
+    @ApiModelProperty("手机号")
+    private String mobile;
 }

+ 1 - 1
src/main/java/com/ydtech/modules/admin/service/CompanyDataReportService.java

@@ -49,7 +49,7 @@ public interface CompanyDataReportService {
      * @author: whp
      * @date: 2024/9/13
      **/
-    HttpResult largeOrdersExcel(OrdersDataVo ordersDataVo,String userId);
+    HttpResult largeOrdersExcel(OrdersDataVo ordersDataVo,String userId,String userLoginId);
 
     /**
      * @description:   控制台-小定单报价明细

+ 7 - 1
src/main/java/com/ydtech/modules/admin/service/impl/CompanyDataReportServiceImpl.java

@@ -181,6 +181,9 @@ public class CompanyDataReportServiceImpl implements CompanyDataReportService {
             OrdersDataDto ordersDataDto = new OrdersDataDto();
             ordersDataDto.setBeginDate(dateMapByType.get("startDate"));
             ordersDataDto.setEndDate(dateMapByType.get("endDate"));
+            ordersDataDto.setUserId(ordersDataVo.getUserId());
+            ordersDataDto.setUserName(ordersDataVo.getUserName());
+            ordersDataDto.setMobile(ordersDataVo.getMobile());
             for (OrdersDataDto record : records) {
                 String licenseno = record.getLicenseno();  //车牌号
                 String frameno = record.getFrameno();   //车牌号
@@ -250,7 +253,7 @@ public class CompanyDataReportServiceImpl implements CompanyDataReportService {
      **/
     @Override
     @Async
-    public HttpResult largeOrdersExcel(OrdersDataVo ordersDataVo,String userId) {
+    public HttpResult largeOrdersExcel(OrdersDataVo ordersDataVo,String userId,String userLoginId) {
 
         //判断开始时间和结束时间是否为空,如果为空的走时间类型逻辑
         HashMap<String, String> dateMapByType = getDateMapByType(ordersDataVo.getDateType(), ordersDataVo.getBeginDate(), ordersDataVo.getEndDate());
@@ -276,6 +279,9 @@ public class CompanyDataReportServiceImpl implements CompanyDataReportService {
 //                }
 //            }
         dateMapByType.put("userId", userId);
+        dateMapByType.put("userName", ordersDataVo.getUserName());
+        dateMapByType.put("mobile", ordersDataVo.getMobile());
+        dateMapByType.put("userLoginId",userLoginId);
 
         this.insExcelTaskAsyncService.importasync(resultSubOrder,dateMapByType, ordersDataVo.getBeginDate(), ordersDataVo.getEndDate());
 //        String uploadPath = this.uploadPath + "/excel/";

+ 18 - 0
src/main/java/com/ydtech/modules/console/vo/BigOrderUploadVo.java

@@ -27,4 +27,22 @@ public class BigOrderUploadVo implements Serializable {
     private  String   userId;
 
 
+    @ApiModelProperty("车型")
+    private String modelcname;
+
+
+    @ApiModelProperty("业务员名称")
+    private String userName;
+
+    @ApiModelProperty("手机号")
+    private String mobile;
+
+
+    @ApiModelProperty("车架号")
+    private String frameno;
+
+
+    @ApiModelProperty("车牌号")
+    private String licenseno;
+
 }

+ 1 - 0
src/main/java/com/ydtech/modules/esm/model/EsmRetail.java

@@ -173,5 +173,6 @@ public class EsmRetail {
         this.disrate1 = disrate1;
         this.disrate2 = disrate2;
         this.disrate3 = disrate3;
+        this.status = "1";
     }
 }

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

@@ -123,6 +123,8 @@ public class RuleAttrMappingVo {
             ruleAttrMappingVoList.add(new RuleAttrMappingVo("CarOwnersAge", ownerInfo.getAge()));
             //车主 性别
             ruleAttrMappingVoList.add(new RuleAttrMappingVo("CarOwnersSex", ownerInfo.getGender().equals("男") ? "1" : "2"));
+            //车主地址
+            ruleAttrMappingVoList.add(new RuleAttrMappingVo("CarOwnersAddress", ownerInfo.getAddr()));
         }
         //车主 姓名
         ruleAttrMappingVoList.add(new RuleAttrMappingVo("CarOwnerName", ownerInfo.getName()));
@@ -135,6 +137,8 @@ public class RuleAttrMappingVo {
             ruleAttrMappingVoList.add(new RuleAttrMappingVo("ApplicantAge", policyHolderInfo.getAge()));
             //投保人 性别
             ruleAttrMappingVoList.add(new RuleAttrMappingVo("ApplicantSex", policyHolderInfo.getGender().equals("男") ? "1" : "2"));
+            //投保人地址
+            ruleAttrMappingVoList.add(new RuleAttrMappingVo("ApplicantAddress", policyHolderInfo.getAddr()));
         }
 
         CustomerInfoVo insuredPersonInfo = insOrders.getInsureinfo().toJavaObject(CustomerInfoVo.class);
@@ -145,6 +149,8 @@ public class RuleAttrMappingVo {
             ruleAttrMappingVoList.add(new RuleAttrMappingVo("InsuredAge", insuredPersonInfo.getAge()));
             //被保人 性别
             ruleAttrMappingVoList.add(new RuleAttrMappingVo("InsuredSex", insuredPersonInfo.getGender().equals("男") ? "1" : "2"));
+            //被保人地址
+            ruleAttrMappingVoList.add(new RuleAttrMappingVo("InsuredAddress", insuredPersonInfo.getAddr()));
         }
         String OPIConsistent = "0";
         if(StringUtils.isNotBlank(ownerInfo.getProperty())){

+ 3 - 1
src/main/java/com/ydtech/modules/fee/service/impl/FeeRuleSchemeServiceNewImpl.java

@@ -3221,7 +3221,9 @@ public class FeeRuleSchemeServiceNewImpl implements FeeRuleSchemeNewService {
         if(equalsMap.contains(ptlAgreementProductCostsAttrLink.getAttrCode())){
             boolean b = Arrays.stream(split).anyMatch(value::equals);
             returnBool.set(b);
-        }else if((ptlAgreementProductCostsAttrLink.getAttrCode().equals("BrandandModel") || ptlAgreementProductCostsAttrLink.getAttrCode().equals("CarOwnerName"))
+        }else if((ptlAgreementProductCostsAttrLink.getAttrCode().equals("BrandandModel") || ptlAgreementProductCostsAttrLink.getAttrCode().equals("CarOwnerName")
+                || ptlAgreementProductCostsAttrLink.getAttrCode().equals("CarOwnersAddress") || ptlAgreementProductCostsAttrLink.getAttrCode().equals("ApplicantAddress")
+                || ptlAgreementProductCostsAttrLink.getAttrCode().equals("InsuredAddress"))
                 && ptlAgreementProductCostsAttrLink.getOperator().equals("2")){
             //处理品牌型号  不包含的情况
             boolean anyMatch = Arrays.stream(split)

+ 4 - 1
src/main/java/com/ydtech/modules/fnc/service/impl/InsExcelTaskAsyncServiceImpl.java

@@ -66,7 +66,7 @@ public class InsExcelTaskAsyncServiceImpl extends ServiceImpl<InsExcelTaskAsyncM
         String taskId = String.valueOf(new SnowFlakeUtil().nextId());
         insExcelTaskEntity.setId(taskId);
         insExcelTaskEntity.setStatus("ready");
-        insExcelTaskEntity.setUserId(dateMapByType.get("userId"));
+        insExcelTaskEntity.setUserId(dateMapByType.get("userLoginId"));
         insExcelTaskEntity.setCreateTime(LocalDateTime.now());
         insExcelTaskEntity.setCreatedAt(LocalDateTime.now());
         insExcelTaskEntity.setType("1");
@@ -78,6 +78,9 @@ public class InsExcelTaskAsyncServiceImpl extends ServiceImpl<InsExcelTaskAsyncM
             OrdersDataDto ordersDataDto = new OrdersDataDto();
             ordersDataDto.setBeginDate(dateMapByType.get("startDate"));
             ordersDataDto.setEndDate(dateMapByType.get("endDate"));
+            ordersDataDto.setUserId(dateMapByType.get("userId"));
+            ordersDataDto.setUserName(dateMapByType.get("userName"));
+            ordersDataDto.setMobile(dateMapByType.get("mobile"));
             for (OrdersDataExcel record : resultSubOrder) {
                 String licenseno = record.getLicenseno();  //车牌号
                 String frameno = record.getFrameno();   //车牌号

+ 119 - 0
src/main/java/com/ydtech/modules/ins/model/guoren/PremiumReq.java

@@ -21,6 +21,7 @@ import com.ydtech.modules.order.entity.vo.guoren.GuoRenSpecialAgreementVo;
 import com.ydtech.modules.protocol.utils.AssertionUtils;
 import com.ydtech.utils.DateTimeUtil;
 import com.ydtech.utils.StringUtils;
+import lombok.AllArgsConstructor;
 import lombok.Data;
 import lombok.NoArgsConstructor;
 
@@ -58,6 +59,10 @@ public class PremiumReq {
     @JSONField(name = "uuid")
     private String uuid;
 
+    @JsonProperty(value = "bc")
+    @JSONField(name = "bc")
+    private BcDTO bc;
+
 
     /**
      * 构造保费计算请求参数
@@ -116,6 +121,9 @@ public class PremiumReq {
             quoteReq.setBi(biDto);
         }
 
+        //设置 投保人被保人信息
+        BcDTO bcDto = new BcDTO(yaQuoteInfoVo.getPolicyHolderInfo(),yaQuoteInfoVo.getInsuredPersonInfo());
+        quoteReq.setBc(bcDto);
         //车价查询uid
         quoteReq.setUuid(carPriceResult.getInputvo());
         //不超过业实际参考价格上下30%
@@ -1340,6 +1348,117 @@ public class PremiumReq {
             private String startDate;
         }
     }
+
+    @NoArgsConstructor
+    @AllArgsConstructor
+    @Data
+    public static class BcDTO{
+
+        @JsonProperty(value = "prpTinsured")
+        @JSONField(name = "prpTinsured")
+        private BcDTO.PrpTinsured prpTinsured;
+
+        @NoArgsConstructor
+        @Data
+        public static class PrpTinsured{
+
+            @JsonProperty(value = "appliName")
+            @JSONField(name = "appliName")
+            private String appliName;
+
+            @JsonProperty(value = "appliInsuredNature")
+            @JSONField(name = "appliInsuredNature")
+            private String appliInsuredNature;
+
+            @JsonProperty(value = "appliIdentifyType")
+            @JSONField(name = "appliIdentifyType")
+            private String appliIdentifyType;
+
+            @JsonProperty(value = "appliIdentifyNumber")
+            @JSONField(name = "appliIdentifyNumber")
+            private String appliIdentifyNumber;
+
+            @JsonProperty(value = "appliMobile")
+            @JSONField(name = "appliMobile")
+            private String appliMobile;
+
+            @JsonProperty(value = "appliAddress")
+            @JSONField(name = "appliAddress")
+            private String appliAddress;
+
+            @JsonProperty(value = "appliPostCode")
+            @JSONField(name = "appliPostCode")
+            private String appliPostCode;
+
+
+            @JsonProperty(value = "insuredName")
+            @JSONField(name = "insuredName")
+            private String insuredName;
+
+            @JsonProperty(value = "insuredInsuredNature")
+            @JSONField(name = "insuredInsuredNature")
+            private String insuredInsuredNature;
+
+            @JsonProperty(value = "insuredMobile")
+            @JSONField(name = "insuredMobile")
+            private String insuredMobile;
+
+            @JsonProperty(value = "insuredIdentifyType")
+            @JSONField(name = "insuredIdentifyType")
+            private String insuredIdentifyType;
+
+            @JsonProperty(value = "insuredIdentifyNumber")
+            @JSONField(name = "insuredIdentifyNumber")
+            private String insuredIdentifyNumber;
+
+            @JsonProperty(value = "insuredAddress")
+            @JSONField(name = "insuredAddress")
+            private String insuredAddress;
+
+            @JsonProperty(value = "insuredPostCode")
+            @JSONField(name = "insuredPostCode")
+            private String insuredPostCode;
+
+            @JsonProperty(value = "appliIDValidStartDate")
+            @JSONField(name = "appliIDValidStartDate")
+            private String appliIDValidStartDate;
+
+            @JsonProperty(value = "appliIDValidDate")
+            @JSONField(name = "appliIDValidDate")
+            private String appliIDValidDate;
+
+            @JsonProperty(value = "insuredIDValidStartDate")
+            @JSONField(name = "insuredIDValidStartDate")
+            private String insuredIDValidStartDate;
+
+            @JsonProperty(value = "insuredIDValidDate")
+            @JSONField(name = "insuredIDValidDate")
+            private String insuredIDValidDate;
+
+        }
+
+        public BcDTO(CustomerInfoVo app,CustomerInfoVo insurance){
+            PrpTinsured prpTinsured = new PrpTinsured();
+            prpTinsured.setAppliName(app.getName());
+            prpTinsured.setAppliInsuredNature("3");
+            prpTinsured.setAppliIdentifyType(app.getIdentifyType());
+            prpTinsured.setAppliIdentifyNumber(app.getIdentifyNumber());
+            prpTinsured.setAppliMobile(app.getMobile());
+            prpTinsured.setAppliAddress(app.getAddr());
+//            prpTinsured.setAppliPostCode(app.get);
+            prpTinsured.setAppliIDValidStartDate(app.getIdentifyValidDate());
+            prpTinsured.setAppliIDValidDate(app.getIdentifyValidEndDate());
+            prpTinsured.setInsuredName(insurance.getName());
+            prpTinsured.setInsuredInsuredNature("1");
+            prpTinsured.setInsuredMobile(insurance.getMobile());
+            prpTinsured.setInsuredIdentifyType(insurance.getIdentifyType());
+            prpTinsured.setInsuredIdentifyNumber(insurance.getIdentifyNumber());
+            prpTinsured.setInsuredAddress(insurance.getAddr());
+            prpTinsured.setInsuredIDValidStartDate(insurance.getIdentifyValidDate());
+            prpTinsured.setInsuredIDValidDate(insurance.getIdentifyValidEndDate());
+            this.setPrpTinsured(prpTinsured);
+        }
+    }
 }
 
 

+ 88 - 77
src/main/java/com/ydtech/modules/order/service/impl/InsCrawlerOrderServiceImpl.java

@@ -49,6 +49,7 @@ import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.ObjectUtils;
 
 import java.math.BigDecimal;
+import java.math.RoundingMode;
 import java.time.LocalDateTime;
 import java.time.format.DateTimeFormatter;
 import java.util.*;
@@ -150,10 +151,10 @@ public class InsCrawlerOrderServiceImpl implements InsCrawlerOrderService {
 
         // 系统类型
         List<PtlAttributionTemplateDto> ptlAttributionTemplateDtos = ptlAgreementAttribution.getFields()
-                                                                                            .toJavaList(PtlAttributionTemplateDto.class);
+                .toJavaList(PtlAttributionTemplateDto.class);
         List<PtlAttributionTemplateDto> collect = ptlAttributionTemplateDtos.stream()
-                                                                            .filter(x -> "form".equals(x.getField()))
-                                                                            .collect(Collectors.toList());
+                .filter(x -> "form".equals(x.getField()))
+                .collect(Collectors.toList());
         if (!collect.isEmpty()) {
             PtlAttributionTemplateDto ptlAttributionTemplateDto = collect.get(0);
             String value = ptlAttributionTemplateDto.getValue();
@@ -203,23 +204,23 @@ public class InsCrawlerOrderServiceImpl implements InsCrawlerOrderService {
         insAreaCompanyAccidentalDriving.convertCrawler(t);
         //如果是太平 将id 设置为 riskcode
         if (t.getAccidentalDrivingVo() != null && t.getCompanyId()
-                                                   .equals("TPIC1000000")) {
+                .equals("TPIC1000000")) {
             JSONObject jsonObject = JSON.parseObject(t.getAccidentalDrivingVo()
-                                                      .toString());
+                    .toString());
             insAreaCompanyAccidentalDriving.setRideRiskCode(jsonObject.get("id")
-                                                                      .toString());
+                    .toString());
         } else if (t.getAccidentalDrivingVo() != null && t.getCompanyId()
-                                                          .equals("TKIC1000000")) {
+                .equals("TKIC1000000")) {
             JSONObject jsonObject = JSON.parseObject(t.getAccidentalDrivingVo()
-                                                      .toString());
+                    .toString());
             insAreaCompanyAccidentalDriving.setRideRiskCode(jsonObject.getString("planCode"));
             insAreaCompanyAccidentalDriving.setRideRiskName(jsonObject.getString("planName"));
             insAreaCompanyAccidentalDriving.setCompanyId("TKIC1000000");
             insAreaCompanyAccidentalDriving.setQuantity(1);
         } else if (t.getAccidentalDrivingVo() != null && t.getCompanyId()
-                                                          .equals("DJPC1000000")) {
+                .equals("DJPC1000000")) {
             JSONObject jsonObject = JSON.parseObject(t.getAccidentalDrivingVo()
-                                                      .toString());
+                    .toString());
             InsDrivingIntentionInsurance one = insDrivingIntentionInsuranceService.getOne(new LambdaQueryWrapper<InsDrivingIntentionInsurance>()
                     .eq(InsDrivingIntentionInsurance::getCompanyId, t.getCompanyId())
                     .eq(InsDrivingIntentionInsurance::getProjectCode, jsonObject.getString("planId")));
@@ -227,28 +228,38 @@ public class InsCrawlerOrderServiceImpl implements InsCrawlerOrderService {
             insAreaCompanyAccidentalDriving.setRideRiskCode(one.getProjectCode());
             insAreaCompanyAccidentalDriving.setQuantity(1);
             insAreaCompanyAccidentalDriving.setCompanyId(t.getCompanyId());
+        } else if(t.getAccidentalDrivingVo() != null && t.getCompanyId().equals("HBIC1000000")){
+            JSONObject jsonObject = JSON.parseObject(t.getAccidentalDrivingVo()
+                    .toString());
+            Integer buynum = jsonObject.getInteger("buynum");
+            if(!quoteRespVo.getAccident().isEmpty()){
+                BigDecimal price = new BigDecimal(response.getDrivingInsurances().get(0).getPrice());
+                BigDecimal total = price.multiply(BigDecimal.valueOf(buynum));
+                BigDecimal rounded = total.setScale(2, RoundingMode.HALF_UP);
+                quoteRespVo.setJyPremium(rounded.doubleValue());
+            }
         }
 
         //处理订单信息
         QuoteRespVo responseVo = responseOrder(response, quoteRespVo, ptlAgreementAttribution, insAreaCompanyAccidentalDriving, quoteInfoVo);
         if (!Objects.isNull(response.getOther()
-                                    .getMaxQuoteNum())) {
+                .getMaxQuoteNum())) {
             int quoteNum = maxQuoteNum - Integer.parseInt(response.getOther()
-                                                                  .getMaxQuoteNum());
+                    .getMaxQuoteNum());
             for (int i = 0; i < quoteNum; i++) {
                 SysQuoteRecord sysQuoteRecord;
                 if (i == quoteNum - 1) {
                     sysQuoteRecord = new SysQuoteRecord(quoteInfoVo.getUserid(), t.getCompanyId(), quoteInfoVo.getCarInfo()
-                                                                                                              .getLicenseNo(),
+                            .getLicenseNo(),
                             QuoteNumberConstant.QuoteAction.QUOTE_SUCCESS.getCode()
-                                                                         .toString(), QuoteNumberConstant.QuoteResult.SUCCESS.getCode()
-                                                                                                                             .toString());
+                                    .toString(), QuoteNumberConstant.QuoteResult.SUCCESS.getCode()
+                            .toString());
                 } else {
                     sysQuoteRecord = new SysQuoteRecord(quoteInfoVo.getUserid(), t.getCompanyId(), quoteInfoVo.getCarInfo()
-                                                                                                              .getLicenseNo(),
+                            .getLicenseNo(),
                             QuoteNumberConstant.QuoteAction.QUOTE_FAILED.getCode()
-                                                                        .toString(), QuoteNumberConstant.QuoteResult.FAIL.getCode()
-                                                                                                                         .toString());
+                                    .toString(), QuoteNumberConstant.QuoteResult.FAIL.getCode()
+                            .toString());
                 }
 
                 sysQuoteRecords.add(sysQuoteRecord);
@@ -267,7 +278,7 @@ public class InsCrawlerOrderServiceImpl implements InsCrawlerOrderService {
     public HttpResult<Object> submitImage(String subOrderNo) {
         InsAreaCompany insAreaCompany = insAreaCompanyService.getById(subOrderNo);
         if (insAreaCompany.getCompanyId()
-                          .equals("TKIC1000000")) {
+                .equals("TKIC1000000")) {
             //泰康
             return HttpResult.ok("上传成功");
         }
@@ -285,7 +296,7 @@ public class InsCrawlerOrderServiceImpl implements InsCrawlerOrderService {
         }
 
         CrawlerImageRequest crawlerImageRequest = new CrawlerImageRequest(insAreaCompany.getInsOrderNo(),
-                CrawlerImageRequest.toB64phoListDTO(insTaskImagesBase64s),ptlAgreementAttribution.getUsername());
+                CrawlerImageRequest.toB64phoListDTO(insTaskImagesBase64s), ptlAgreementAttribution.getUsername());
         // 发送请求
         CrawlerBaseResponse response = insCrawlerOrderComponents.request(apiUrl, insAreaCompany.getCompanyId(),
                 PtlCrawlerApiType.API_3.getDesc(), crawlerImageRequest, CrawlerBaseResponse.class);
@@ -307,7 +318,7 @@ public class InsCrawlerOrderServiceImpl implements InsCrawlerOrderService {
         // 请求地址
         String apiUrl = ptlCrawlerApiService.getApiUrl(insAreaCompany.getAgreementId(), PtlCrawlerApiType.API_4);
         //组装参数
-        CrawlerBaseRequest crawlerBaseRequest = new CrawlerBaseRequest(insAreaCompany.getInsOrderNo(),ptlAgreementAttribution.getUsername());
+        CrawlerBaseRequest crawlerBaseRequest = new CrawlerBaseRequest(insAreaCompany.getInsOrderNo(), ptlAgreementAttribution.getUsername());
         CrawlerAuditResponse crawlerAuditResponse = insCrawlerOrderComponents.request(apiUrl, insAreaCompany.getCompanyId(),
                 PtlCrawlerApiType.API_4.getDesc(), crawlerBaseRequest, CrawlerAuditResponse.class);
 
@@ -348,7 +359,7 @@ public class InsCrawlerOrderServiceImpl implements InsCrawlerOrderService {
         //组装参数
         // 账号信息
         PtlAgreementAttribution ptlAgreementAttribution = ptlAgreementAttributionService.getById(insAreaCompany.getAgreementId());
-        CrawlerBaseRequest crawlerBaseRequest = new CrawlerBaseRequest(insAreaCompany.getInsOrderNo(),ptlAgreementAttribution.getUsername());
+        CrawlerBaseRequest crawlerBaseRequest = new CrawlerBaseRequest(insAreaCompany.getInsOrderNo(), ptlAgreementAttribution.getUsername());
         CrawlerVerifyPaymentResponse crawlerAuditResponse = insCrawlerOrderComponents.request(apiUrl, insAreaCompany.getCompanyId(),
                 PtlCrawlerApiType.API_5.getDesc(), crawlerBaseRequest, CrawlerVerifyPaymentResponse.class);
 
@@ -384,7 +395,7 @@ public class InsCrawlerOrderServiceImpl implements InsCrawlerOrderService {
         // 账号信息
         PtlAgreementAttribution ptlAgreementAttribution = ptlAgreementAttributionService.getById(insAreaCompany.getAgreementId());
         //组装参数
-        CrawlerBaseRequest crawlerBaseRequest = new CrawlerBaseRequest(insAreaCompany.getInsOrderNo(),ptlAgreementAttribution.getUsername());
+        CrawlerBaseRequest crawlerBaseRequest = new CrawlerBaseRequest(insAreaCompany.getInsOrderNo(), ptlAgreementAttribution.getUsername());
         CrawlerPolicyPrintResponse response = insCrawlerOrderComponents.request(apiUrl, insAreaCompany.getCompanyId(),
                 PtlCrawlerApiType.API_6.getDesc(), crawlerBaseRequest, CrawlerPolicyPrintResponse.class);
 
@@ -395,7 +406,7 @@ public class InsCrawlerOrderServiceImpl implements InsCrawlerOrderService {
         // 支付时间
         if (StringUtils.isNotEmpty(response.getPaytime())) {
             insAreaCompany.setPayDate(LocalDateTime.parse(response.getPaytime()
-                                                                  .trim(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
+                    .trim(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
             insAreaCompanyService.updateById(insAreaCompany);
         }
 
@@ -404,15 +415,15 @@ public class InsCrawlerOrderServiceImpl implements InsCrawlerOrderService {
         crawlerPolicyPrintVo.setJqxPolicyUrl(gainCarInsPolicy(response.getJqxPolicyUrl(), licensePlate + "-交强险保单.pdf", insAreaCompany.getId()));
         crawlerPolicyPrintVo.setSyxPolicyUrl(gainCarInsPolicy(response.getSyxPolicyUrl(), licensePlate + "-商业险保单.pdf", insAreaCompany.getId()));
         crawlerPolicyPrintVo.setJyxInfoList(response.getJyxInfoList()
-                                                    .stream()
-                                                    .map(x -> {
-                                                        CrawlerPolicyPrintVo.JyxInfoListDTO jyxInfoListDTO = new CrawlerPolicyPrintVo.JyxInfoListDTO();
-                                                        jyxInfoListDTO.setApplication(x.getApplication());
-                                                        jyxInfoListDTO.setJyxPolicyUrl(gainCarInsPolicy(x.getJyxPolicyUrl(), licensePlate + "-" + x.getApplication() + "-非车险保单.pdf",
-                                                                insAreaCompany.getId()));
-                                                        return jyxInfoListDTO;
-                                                    })
-                                                    .collect(Collectors.toList()));
+                .stream()
+                .map(x -> {
+                    CrawlerPolicyPrintVo.JyxInfoListDTO jyxInfoListDTO = new CrawlerPolicyPrintVo.JyxInfoListDTO();
+                    jyxInfoListDTO.setApplication(x.getApplication());
+                    jyxInfoListDTO.setJyxPolicyUrl(gainCarInsPolicy(x.getJyxPolicyUrl(), licensePlate + "-" + x.getApplication() + "-非车险保单.pdf",
+                            insAreaCompany.getId()));
+                    return jyxInfoListDTO;
+                })
+                .collect(Collectors.toList()));
         return HttpResult.ok(crawlerPolicyPrintVo);
     }
 
@@ -454,19 +465,19 @@ public class InsCrawlerOrderServiceImpl implements InsCrawlerOrderService {
             }
 
             if (InsurKind.A.getCode()
-                           .equals(kindInfoVo.getKindCode())) {
+                    .equals(kindInfoVo.getKindCode())) {
                 kind.setAmount(map.get("A_amount"));
             } else {
                 kind.setAmount(kindInfoVo.getAmount());
             }
 
             if (InsurKind.SY_WBDWGZ.getCode()
-                                   .equals(kindInfoVo.getKindCode())) {
+                    .equals(kindInfoVo.getKindCode())) {
                 KindInfoVo aKind = kindList.stream()
-                                           .filter(x -> x.getKindCode()
-                                                         .equals(InsurKind.A.getCode()))
-                                           .findFirst()
-                                           .orElse(null);
+                        .filter(x -> x.getKindCode()
+                                .equals(InsurKind.A.getCode()))
+                        .findFirst()
+                        .orElse(null);
                 if (aKind != null) {
                     kind.setAmount(map.get("A_amount"));
                 }
@@ -518,9 +529,9 @@ public class InsCrawlerOrderServiceImpl implements InsCrawlerOrderService {
 
         if (!ObjectUtils.isEmpty(other.getPredictInfo())) {
             quoteRespVo.setPredictInfo(other.getPredictInfo()
-                                            .stream()
-                                            .map(QuoteRespVo.PreUnderwritingInfoDTO::new)
-                                            .collect(Collectors.toList()));
+                    .stream()
+                    .map(QuoteRespVo.PreUnderwritingInfoDTO::new)
+                    .collect(Collectors.toList()));
         }
 
         // 起保日期和终保日期
@@ -544,10 +555,10 @@ public class InsCrawlerOrderServiceImpl implements InsCrawlerOrderService {
         quoteRespVo.setWarnMessageList(strings);
 
         List<String> infoList = response.getOther()
-                                        .getInfoList();
+                .getInfoList();
         if (!ObjectUtils.isEmpty(infoList)) {
             quoteRespVo.getWarnMessageList()
-                       .addAll(infoList);
+                    .addAll(infoList);
         }
         // 交强是否续保
         quoteRespVo.setJqRenewal(other.getJqRenewalFlag());
@@ -576,26 +587,26 @@ public class InsCrawlerOrderServiceImpl implements InsCrawlerOrderService {
 
         // 此单是否需要验车
         if (CrawlerQuoteResponse.QuoteGreenWayEnum.Q_1.getCode()
-                                                      .equals(response.getOther()
-                                                                      .getIsQuoteGreenWay())) {
+                .equals(response.getOther()
+                        .getIsQuoteGreenWay())) {
             quoteRespVo.setTips(CrawlerQuoteResponse.QuoteGreenWayEnum.Q_1.getDesc());
             quoteRespVo.setWarnMessageList(response.getOther()
-                                                   .getErrorCodeMap());
+                    .getErrorCodeMap());
         }
         // 验车支付链接
         insAreaCompany.setVehicleInspectionUrl(response.getOther()
-                                                       .getUpimageUrl());
+                .getUpimageUrl());
         quoteRespVo.setVehicleInspectionUrl(response.getOther()
-                                                    .getUpimageUrl());
+                .getUpimageUrl());
 
         if (response.getOther()
-                    .getCiMessage() != null && !response.getOther()
-                                                        .getCiMessage()
-                                                        .equals("")) {
+                .getCiMessage() != null && !response.getOther()
+                .getCiMessage()
+                .equals("")) {
             quoteRespVo.setCiMessage(response.getOther()
-                                             .getCiMessage());
+                    .getCiMessage());
             insAreaCompany.setCiMessage(response.getOther()
-                                                .getCiMessage());
+                    .getCiMessage());
         }
 
         //太平绿黄红区
@@ -606,8 +617,8 @@ public class InsCrawlerOrderServiceImpl implements InsCrawlerOrderService {
             if (matcher.find()) {
 
                 String tpColorScore = item.replace("小货车鼓励承保业务", "绿区")
-                                          .replace("小货车一般承保业务", "黄区")
-                                          .replace("小货车谨慎承保业务", "红区");
+                        .replace("小货车一般承保业务", "黄区")
+                        .replace("小货车谨慎承保业务", "红区");
 
                 insAreaCompany.setTpColorScore(tpColorScore);
                 break;
@@ -643,7 +654,7 @@ public class InsCrawlerOrderServiceImpl implements InsCrawlerOrderService {
         // 账号信息
         PtlAgreementAttribution ptlAgreementAttribution = ptlAgreementAttributionService.getById(insAreaCompany.getAgreementId());
         //组装参数
-        CrawlerBaseRequest crawlerBaseRequest = new CrawlerBaseRequest(insAreaCompany.getInsOrderNo(),ptlAgreementAttribution.getUsername());
+        CrawlerBaseRequest crawlerBaseRequest = new CrawlerBaseRequest(insAreaCompany.getInsOrderNo(), ptlAgreementAttribution.getUsername());
 
         CrawlerAuditResponse crawlerAuditResponse = insCrawlerOrderComponents.request(apiUrl, insAreaCompany.getCompanyId(),
                 PtlCrawlerApiType.API_8.getDesc(), crawlerBaseRequest, CrawlerAuditResponse.class);
@@ -681,7 +692,7 @@ public class InsCrawlerOrderServiceImpl implements InsCrawlerOrderService {
         // 账号信息
         PtlAgreementAttribution ptlAgreementAttribution = ptlAgreementAttributionService.getById(insAreaCompany.getAgreementId());
         //组装参数
-        CrawlerBaseRequest crawlerBaseRequest = new CrawlerBaseRequest(insAreaCompany.getInsOrderNo(),ptlAgreementAttribution.getUsername());
+        CrawlerBaseRequest crawlerBaseRequest = new CrawlerBaseRequest(insAreaCompany.getInsOrderNo(), ptlAgreementAttribution.getUsername());
         CrawlerVerifyPaymentResponse crawlerAuditResponse = insCrawlerOrderComponents.request(apiUrl, insAreaCompany.getCompanyId(),
                 PtlCrawlerApiType.API_5.getDesc(), crawlerBaseRequest, CrawlerVerifyPaymentResponse.class);
 
@@ -724,7 +735,7 @@ public class InsCrawlerOrderServiceImpl implements InsCrawlerOrderService {
     private boolean quashOrder(InsAreaCompany insAreaCompany) {
         // 账号信息
         PtlAgreementAttribution ptlAgreementAttribution = ptlAgreementAttributionService.getById(insAreaCompany.getAgreementId());
-        CrawlerBaseRequest crawlerBaseRequest = new CrawlerBaseRequest(insAreaCompany.getInsOrderNo(),ptlAgreementAttribution.getUsername());
+        CrawlerBaseRequest crawlerBaseRequest = new CrawlerBaseRequest(insAreaCompany.getInsOrderNo(), ptlAgreementAttribution.getUsername());
         CrawlerBaseResponse request = insCrawlerOrderComponents.request(apiUrl, insAreaCompany.getCompanyId(),
                 PtlCrawlerApiType.API_9.getDesc(), crawlerBaseRequest, CrawlerBaseResponse.class);
         if (request.getCode() == CrawlerAuditStatus.CAS_200.getCode()) {
@@ -750,9 +761,9 @@ public class InsCrawlerOrderServiceImpl implements InsCrawlerOrderService {
             throw new SystemException(e.getMessage());
         }
         String jyPath = (vo.getJyxInfoList() != null && !vo.getJyxInfoList()
-                                                           .isEmpty()) ? vo.getJyxInfoList()
-                                                                           .get(0)
-                                                                           .getJyxPolicyUrl() : null;
+                .isEmpty()) ? vo.getJyxInfoList()
+                .get(0)
+                .getJyxPolicyUrl() : null;
         InsAreaCompanyExternalPolicy insAreaCompanyExternalPolicy = new InsAreaCompanyExternalPolicy(insAreaCompany.getId(), vo.getJqxPolicyUrl(), vo.getSyxPolicyUrl(), jyPath, vo.getJqxFlagUrl());
         return new ReadPdfUrlListDto(insAreaCompanyExternalPolicy, insAreaCompany, null);
     }
@@ -767,7 +778,7 @@ public class InsCrawlerOrderServiceImpl implements InsCrawlerOrderService {
         PtlAgreementAttribution ptlAgreementAttribution = ptlAgreementAttributionService.getById(insAreaCompany.getAgreementId());
 
         //组装参数
-        CrawlerBaseRequest crawlerBaseRequest = new CrawlerBaseRequest(insAreaCompany.getInsOrderNo(),ptlAgreementAttribution.getUsername());
+        CrawlerBaseRequest crawlerBaseRequest = new CrawlerBaseRequest(insAreaCompany.getInsOrderNo(), ptlAgreementAttribution.getUsername());
         CrawlerPolicyPrintResponse response = insCrawlerOrderComponents.request(apiUrl, insAreaCompany.getCompanyId(), PtlCrawlerApiType.API_6.getDesc(), crawlerBaseRequest, CrawlerPolicyPrintResponse.class);
         if (response.getCode() == 200) {
             //交强险标志地址
@@ -782,16 +793,16 @@ public class InsCrawlerOrderServiceImpl implements InsCrawlerOrderService {
                 crawlerPolicyPrintVo.setSyxPolicyUrl(gainCarInsPolicyNew(response.getSyxPolicyUrl(), pathPrefix + insAreaCompany.getSypolicyno() + "-" + InsuranceOrderPdf.SYBD.getDesc(), insAreaCompany.getId(), flag));
             }
             if (response.getJyxInfoList() != null && !response.getJyxInfoList()
-                                                              .isEmpty()) {
+                    .isEmpty()) {
                 crawlerPolicyPrintVo.setJyxInfoList(response.getJyxInfoList()
-                                                            .stream()
-                                                            .map(x -> {
-                                                                CrawlerPolicyPrintVo.JyxInfoListDTO jyxInfoListDTO = new CrawlerPolicyPrintVo.JyxInfoListDTO();
-                                                                jyxInfoListDTO.setApplication(x.getApplication());
-                                                                jyxInfoListDTO.setJyxPolicyUrl(gainCarInsPolicyNew(x.getJyxPolicyUrl(), pathPrefix + insAreaCompany.getJyPolicyNo() + "-" + InsuranceOrderPdf.JYBD.getDesc(), insAreaCompany.getId(), flag));
-                                                                return jyxInfoListDTO;
-                                                            })
-                                                            .collect(Collectors.toList()));
+                        .stream()
+                        .map(x -> {
+                            CrawlerPolicyPrintVo.JyxInfoListDTO jyxInfoListDTO = new CrawlerPolicyPrintVo.JyxInfoListDTO();
+                            jyxInfoListDTO.setApplication(x.getApplication());
+                            jyxInfoListDTO.setJyxPolicyUrl(gainCarInsPolicyNew(x.getJyxPolicyUrl(), pathPrefix + insAreaCompany.getJyPolicyNo() + "-" + InsuranceOrderPdf.JYBD.getDesc(), insAreaCompany.getId(), flag));
+                            return jyxInfoListDTO;
+                        })
+                        .collect(Collectors.toList()));
             }
 
         } else {
@@ -822,7 +833,7 @@ public class InsCrawlerOrderServiceImpl implements InsCrawlerOrderService {
         TsCrawlerLoginRequest crawlerLoginRequest = new TsCrawlerLoginRequest(attributionDto);
         TsCrawlerBaseResponse response = insCrawlerOrderComponents.request(apiUrl, attribution.getInsCompanyId(), "获取验证码",
                 crawlerLoginRequest, TsCrawlerBaseResponse.class);
-        if(!response.getCode().equals(200)){
+        if (!response.getCode().equals(200)) {
             throw new SystemException(response.getMessage());
         }
         // 将返回参数放入redis
@@ -841,15 +852,15 @@ public class InsCrawlerOrderServiceImpl implements InsCrawlerOrderService {
         attributionDto.setFields(attributionTemplateDtos);
         String apiUrl = ptlCrawlerApiService.getByTemplateId(attribution.getTemplateId(), PtlCrawlerApiType.API_1);
         String token = redisTemplate.opsForValue().get(OrderCacheConstant.TS_ACCESS_TOKEN + attributionDto.getUsername());
-        if(StringUtils.isNotBlank(token)){
+        if (StringUtils.isNotBlank(token)) {
             TsCrawlerLoginRequest request = JSON.parseObject(token).toJavaObject(TsCrawlerLoginRequest.class);
-            TsCrawlerLoginRequest tsRequest = new TsCrawlerLoginRequest(attributionDto,smscode,request);
+            TsCrawlerLoginRequest tsRequest = new TsCrawlerLoginRequest(attributionDto, smscode, request);
             TsCrawlerBaseResponse response = insCrawlerOrderComponents.request(apiUrl, attribution.getInsCompanyId(), "登录",
                     tsRequest, TsCrawlerBaseResponse.class);
-            if(!response.getCode().equals(200)){
+            if (!response.getCode().equals(200)) {
                 throw new SystemException("泰山登录失败:" + response.getMessage());
             }
-        }else{
+        } else {
             throw new SystemException("验证码已失效!请重新发送!");
         }
 

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

@@ -1931,6 +1931,15 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
             accidentalDrivingVo.setQuantity(baseQuoteVo.getAccidentalDrivingVo().getQuantity());
             renShouBaseQuoteVo.setAccidentalDrivingVo(accidentalDrivingVo);
             return renShouBaseQuoteVo;
+        } else if (baseQuoteVo.getCompanyId().equals("PICC1000000")) {
+            //中保
+            BaseQuoteVo<AccidentalDrivingVo> zbBaseQuoteVo = new BaseQuoteVo<>();
+            BeanUtils.copyProperties(baseQuoteVo, zbBaseQuoteVo);
+            AccidentalDrivingVo accidentalDrivingVo = new AccidentalDrivingVo();
+            accidentalDrivingVo.setRideRiskName(baseQuoteVo.getAccidentalDrivingVo().getProjectName());
+            accidentalDrivingVo.setRideRiskCode(baseQuoteVo.getAccidentalDrivingVo().getProjectCode());
+            zbBaseQuoteVo.setAccidentalDrivingVo(accidentalDrivingVo);
+            return zbBaseQuoteVo;
         } else if (baseQuoteVo.getCompanyId().equals("HBIC1000000")) {
             //恒邦
             BaseQuoteVo<Object> hengBangBaseQuoteVo = new BaseQuoteVo<>();

+ 83 - 83
src/main/resources/mapper/modules/admin/TaskStatisticsMapper.xml

@@ -374,10 +374,10 @@
                   </if>
 
                   <if test="vo.signingTimeStart != null and vo.signingTimeStart!='' and vo.signingTimeEnd != null and vo.signingTimeEnd != ''">
-                      AND iac.signing_time BETWEEN #{vo.signingTimeStart} AND DATE_FORMAT(#{vo.signingTimeEnd}
+                      AND iac.signing_time BETWEEN #{vo.signingTimeStart} AND #{vo.signingTimeEnd}
                   </if>
                   <if test="vo.enterTimeStart != null and vo.enterTimeStart!='' and vo.enterTimeEnd != null and vo.enterTimeEnd != ''">
-                      AND iac.createtime BETWEEN  #{vo.enterTimeStart} AND DATE_FORMAT(#{vo.enterTimeEnd}
+                      AND iac.createtime BETWEEN  #{vo.enterTimeStart} AND #{vo.enterTimeEnd}
                   </if>
 
                   <if test="vo.managementSource !=null  and vo.managementSource!=''">
@@ -531,103 +531,103 @@
     </select>
 
     <select id="getBusinessAgentDataExcel"  resultType="com.ydtech.modules.admin.model.vo.BusinessAgentData">
-        select
+        SELECT
         a.userId as "userId",
-        a.userName as "userName",
-        a.deptId as "deptId",
-        a.leaderName as "leaderName",
-        COALESCE(a.sumpremium, 0) as "sumpremium",
-        COALESCE(a.jqpremium, 0) as "jqpremium",
-        COALESCE(a.sypremium, 0) as "sypremium",
-        COALESCE(a.taxamount, 0) as "taxamount",
-        COALESCE(a.jypremium, 0) as "jypremium",
-        COALESCE(a.riskCodeJs, 0) as "riskCodeJs",
-        COALESCE(a.riskCodeDj, 0) as "riskCodeDj",
-        COALESCE(a.riskCodeJshang, 0) as "riskCodeJshang",
-        COALESCE(a.riskCodeDs, 0) as "riskCodeDs",
-        COALESCE(a.riskCodeDsan, 0) as "riskCodeDsan",
-        a.managementSource as "managementSource",
-        COALESCE(a.entranceAllFee - a.exportAllFee, 0) as "distributionAmount",
-        CASE WHEN a.sumpremium > 0 THEN (COALESCE(a.entranceAllFee - a.exportAllFee, 0) / a.sumpremium) ELSE 0 END as "distributionAmountRate"
-        from (
-        select
-        io.userid as "userId",
-        io.username as "userName",
-        sd.id as "deptId",
-        sd.management_source as "managementSource",
-        iac.leader_name as "leaderName",
-        sum(COALESCE(jqpremium, 0) + COALESCE(sypremium, 0) + COALESCE(jypremium, 0)) as "sumpremium",
-        sum(COALESCE(jqpremium, 0)) as "jqpremium",
-        sum(COALESCE(sypremium, 0)) as "sypremium",
-        sum(COALESCE(taxamount, 0)) as "taxamount",
-        sum(COALESCE(jypremium, 0)) as "jypremium",
+        su.name AS "userName",
+        sd.id AS "deptId",
+        su.leader_name AS "leaderName",
+        a.sumpremium,
+        a.jqpremium,
+        a.sypremium,
+        a.taxamount,
+        a.jypremium,
+        a.riskCodeJs,
+        a.riskCodeDj,
+        a.riskCodeJshang,
+        a.riskCodeDs,
+        a.riskCodeDsan,
+        sd.management_source AS "managementSource",
+        a.distributionAmount,
+        CASE WHEN a.sumpremium = 0 THEN 0  ELSE a.distributionAmount / a.sumpremium  END AS "distributionAmountRate"
+        FROM (
+        SELECT
+        io.userid AS "userId",
+        SUM(IFNULL(jqpremium, 0) + IFNULL(sypremium, 0) + IFNULL(jypremium, 0)) AS "sumpremium",
+        IFNULL(SUM(jqpremium), 0) AS "jqpremium",
+        IFNULL(SUM(sypremium), 0) AS "sypremium",
+        IFNULL(SUM(taxamount), 0) AS "taxamount",
+        IFNULL(SUM(jypremium), 0) AS "jypremium",
         COUNT(CASE WHEN iac.product = '交三' THEN 1 END) AS "riskCodeJs",
         COUNT(CASE WHEN iac.product = '单交' THEN 1 END) AS "riskCodeDj",
         COUNT(CASE WHEN iac.product = '交商' THEN 1 END) AS "riskCodeJshang",
         COUNT(CASE WHEN iac.product = '单商' THEN 1 END) AS "riskCodeDs",
         COUNT(CASE WHEN iac.product = '单三' THEN 1 END) AS "riskCodeDsan",
-        ROUND(sum(COALESCE(ifon.jq_costs_premiums, 0) + COALESCE(ifon.sy_costs_premiums, 0) + COALESCE(ifon.no_costs_premiums, 0)), 2) as "entranceAllFee",
-        ROUND(sum(COALESCE(jq_export_other_costs_premiums, 0) + COALESCE(jq_export_supervise_costs_premiums, 0)
-        + COALESCE(sy_export_other_costs_premiums, 0) + COALESCE(sy_export_supervise_costs_premiums, 0)
-        + COALESCE(no_export_other_costs_premiums, 0) + COALESCE(no_export_supervise_costs_premiums, 0)), 2) as "exportAllFee"
-        from (
-        select *
-        from ins_area_company
-        where orderstatus = '3'
-        and (del_flag = '1')
+        ROUND(SUM(IFNULL(ifon.jq_costs_premiums, 0) + IFNULL(ifon.sy_costs_premiums, 0) + IFNULL(ifon.no_costs_premiums, 0)), 2) AS "entranceAllFee",
+        ROUND(SUM(IFNULL(jq_export_other_costs_premiums, 0) + IFNULL(jq_export_supervise_costs_premiums, 0) + IFNULL(sy_export_other_costs_premiums, 0) + IFNULL(sy_export_supervise_costs_premiums, 0) + IFNULL(no_export_other_costs_premiums, 0) + IFNULL(no_export_supervise_costs_premiums, 0)), 2) AS "exportAllFee",
+        IFNULL(IFNULL(SUM(IFNULL(ifon.jq_costs_premiums, 0) + IFNULL(ifon.sy_costs_premiums, 0) + IFNULL(ifon.no_costs_premiums, 0)), 0) - IFNULL(SUM(IFNULL(jq_export_other_costs_premiums, 0) + IFNULL(jq_export_supervise_costs_premiums, 0) + IFNULL(sy_export_other_costs_premiums, 0) + IFNULL(sy_export_supervise_costs_premiums, 0) + IFNULL(no_export_other_costs_premiums, 0) + IFNULL(no_export_supervise_costs_premiums, 0)), 0), 0) AS "distributionAmount"
+        FROM
+        ins_area_company iac
+        LEFT JOIN ins_orders io ON io.orderno = iac.orderno
+        LEFT JOIN sys_user su ON su.id = io.userid
+        LEFT JOIN ins_fee_order_new ifon ON iac.id = ifon.ins_order_no
+        WHERE
+        iac.orderstatus = '3'
+        AND (iac.del_flag = '1' OR io.del_flag IS NULL OR io.del_flag = 1)
         <if test="vo.signingTimeStart != null and vo.signingTimeStart!='' and vo.signingTimeEnd != null and vo.signingTimeEnd != ''">
-            AND signing_time BETWEEN #{vo.signingTimeStart} AND #{vo.signingTimeEnd}
+            AND iac.signing_time BETWEEN #{vo.signingTimeStart} AND #{vo.signingTimeEnd}
         </if>
         <if test="vo.enterTimeStart != null and vo.enterTimeStart!='' and vo.enterTimeEnd != null and vo.enterTimeEnd != ''">
-            AND createtime BETWEEN #{vo.enterTimeStart} AND #{vo.enterTimeEnd}
+            AND iac.createtime BETWEEN #{vo.enterTimeStart} AND #{vo.enterTimeEnd}
+        </if>
+
+        <if test="vo.leaderName != null and vo.leaderName!='' ">
+            AND iac.leader_name = #{vo.leaderName}
         </if>
         <if test="vo.userIds  !=null  and vo.userIds!=''  and vo.userIds.size()>0">
-            and leader_id in
+            AND su.leader_id IN
             <foreach collection="vo.userIds" item="item" open="(" separator="," close=")">
                 #{item}
             </foreach>
         </if>
-        <if test="vo.leaderName !=null  and vo.leaderName!=''">
-            and leader_name=#{vo.leaderName}
-        </if>
-        ) iac
-        left join ins_orders io on io.orderno = iac.orderno
-        LEFT JOIN ins_fee_order_new ifon ON iac.id = ifon.ins_order_no
-        left join sys_dept sd on sd.id = io.deptid
-        LEFT JOIN sys_user_role sur ON sur.user_id = io.userid
-        <where>
-            <if test="vo.userId !=null  and vo.userId!=''">
-                and io.userid=#{vo.userId}
-            </if>
-            <if test="vo.userName !=null  and vo.userName!=''">
-                and io.username=#{vo.userName}
-            </if>
-            <if test="vo.managementSource !=null  and vo.managementSource!=''">
-                and sd.management_source=#{vo.managementSource}
-            </if>
-            <choose>
-                <when test='vo.managementSource == "2"'>
-                    and (sur.role_id = 20 or sur.role_id = 21)
-                </when>
-                <when test='vo.managementSource == "1"'>
-                    and (sur.role_id = 19 or sur.role_id = 21)
-                </when>
-                <otherwise>
-                </otherwise>
-            </choose>
-            <if test="vo.deptIds != null and vo.deptIds != '' and vo.deptIds.size() > 0">
-                AND sd.id in
-                <foreach collection="vo.deptIds" item="item" open="(" separator="," close=")">
-                    #{item}
-                </foreach>
-            </if>
-            <if test="vo.deptId !=null  and vo.deptId!=''">
-                and sd.id like concat('%', #{vo.deptId}, '%')
-            </if>
-        </where>
-        group by io.userid, io.username, io.deptid, iac.leader_name, sd.management_source
+        GROUP BY
+        io.userid
         ) a
-        order by a.sumpremium desc, a.userId
+        LEFT JOIN sys_user su ON a.userId = su.id
+        LEFT JOIN sys_dept sd ON sd.id = su.dept_id
+        LEFT JOIN sys_user_role sur ON sur.user_id = su.id
+        WHERE
+        1 = 1
+        <if test="vo.userId !=null  and vo.userId!=''">
+            AND su.id = #{vo.userId}
+        </if>
+        <if test="vo.userName !=null  and vo.userName!=''">
+            AND su.name = #{vo.userName}
+        </if>
+        <if test="vo.managementSource !=null  and vo.managementSource!=''">
+            AND sd.management_source = #{vo.managementSource}
+        </if>
+        <choose>
+            <when test='vo.managementSource == "2"'>
+                AND (sur.role_id = 20 OR sur.role_id = 21)
+            </when>
+            <when test='vo.managementSource == "1"'>
+                AND (sur.role_id = 19 OR sur.role_id = 21)
+            </when>
+            <otherwise>
+            </otherwise>
+        </choose>
+        <if test="vo.deptIds != null and vo.deptIds != '' and vo.deptIds.size() > 0">
+            AND sd.id IN
+            <foreach collection="vo.deptIds" item="item" open="(" separator="," close=")">
+                #{item}
+            </foreach>
+        </if>
+        <if test="vo.deptId !=null  and vo.deptId!=''">
+            AND sd.id LIKE CONCAT('%', #{vo.deptId}, '%')
+        </if>
+        ORDER BY
+        a.sumpremium DESC,
+        a.userId
     </select>
 
     <select id="ordersDetailsExcel" resultType="com.ydtech.modules.admin.model.dto.OrdersDetailsExcel">

+ 20 - 1
src/main/resources/mapper/modules/console/UpLoadOrderMapper.xml

@@ -19,7 +19,7 @@
         ifnull( eic.NAME, '' ) AS companyName,
         io.userid  AS "userId",
         su.NAME  AS "userName",
-        iac.leader_name  AS "leaderName"
+        su.leader_name  AS "leaderName"
         FROM
         ins_orders io
         LEFT JOIN ins_area_company iac ON io.orderno = iac.orderno
@@ -30,6 +30,25 @@
             <if test="vo.beginDate  != null  and  vo.beginDate!=''  and vo.endDate  != null  and  vo.endDate!=''">
                 AND DATE_FORMAT( io.createtime, '%Y-%m-%d') BETWEEN #{vo.beginDate} AND #{vo.endDate}
             </if>
+
+            <if test="vo.licenseno !=null  and vo.licenseno!=''">
+                AND io.licenseno =#{vo.licenseno}
+            </if>
+            <if test="vo.frameno !=null  and vo.frameno!=''">
+                AND io.frameno =#{vo.frameno}
+            </if>
+
+            <if test="vo.userId !=null  and vo.userId!=''">
+                AND io.userId =#{vo.userId}
+            </if>
+
+            <if test="vo.userName  != null  and  vo.userName!=''  ">
+                AND su.name =#{vo.userName}
+            </if>
+
+            <if test="vo.mobile  != null  and  vo.mobile!=''  ">
+                AND su.mobile =#{vo.mobile}
+            </if>
         </where>
         order by io.createtime ,io.orderno
     </select>

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

@@ -3244,6 +3244,7 @@
         GROUP_CONCAT(inscompany ORDER BY inscompany SEPARATOR ',') as "namesimple"
         from ins_area_company iac
         left join ins_orders io on io.orderno = iac.orderno
+        left join sys_user  su  on su.id =io.userid
         <where>
             iac.orderstatus ='3'
             <if test="vo.licenseno !=null  and vo.licenseno!=''">
@@ -3252,6 +3253,19 @@
             <if test="vo.frameno !=null  and vo.frameno!=''">
                 AND io.frameno =#{vo.frameno}
             </if>
+
+            <if test="vo.userId !=null  and vo.userId!=''">
+                AND io.userId =#{vo.userId}
+            </if>
+
+            <if test="vo.userName  != null  and  vo.userName!=''  ">
+                AND su.name =#{vo.userName}
+            </if>
+
+            <if test="vo.mobile  != null  and  vo.mobile!=''  ">
+                AND su.mobile =#{vo.mobile}
+            </if>
+
             <if test="vo.beginDate  != null  and  vo.beginDate!=''  and vo.endDate  != null  and  vo.endDate!=''">
                 AND io.createtime BETWEEN #{vo.beginDate} AND #{vo.endDate}
             </if>