Jelajahi Sumber

Merge branch 'test' into test_mq

hxl13994548489 1 tahun lalu
induk
melakukan
fb506e821a
100 mengubah file dengan 3524 tambahan dan 503 penghapusan
  1. 2 0
      README.md
  2. 12 1
      docker/shell-prod.sh
  3. 12 1
      docker/shell-test.sh
  4. 0 10
      sql/Online.sql
  5. 11 0
      src/main/java/com/ydtech/aop/GetStringBufferContent.java
  6. 223 0
      src/main/java/com/ydtech/aop/StringBufferContentAspect.java
  7. 22 2
      src/main/java/com/ydtech/components/OrderComponents.java
  8. 29 0
      src/main/java/com/ydtech/modules/admin/constants/DataPermissionsEnum.java
  9. 3 1
      src/main/java/com/ydtech/modules/admin/constants/SwitchConfig.java
  10. 83 0
      src/main/java/com/ydtech/modules/admin/controller/DataPermissionsController.java
  11. 76 0
      src/main/java/com/ydtech/modules/admin/controller/InsRolePermissionsController.java
  12. 6 0
      src/main/java/com/ydtech/modules/admin/controller/SysSwitchConfigController.java
  13. 18 2
      src/main/java/com/ydtech/modules/admin/controller/SysUserController.java
  14. 100 20
      src/main/java/com/ydtech/modules/admin/controller/taskStatistics/TaskStatisticsController.java
  15. 26 0
      src/main/java/com/ydtech/modules/admin/dao/DataPermissionsMapper.java
  16. 14 0
      src/main/java/com/ydtech/modules/admin/dao/InsRoleMenuPermissionsMapper.java
  17. 18 0
      src/main/java/com/ydtech/modules/admin/dao/InsRolePermissionsMapper.java
  18. 2 0
      src/main/java/com/ydtech/modules/admin/dao/TaskStatisticsMapper.java
  19. 112 0
      src/main/java/com/ydtech/modules/admin/model/DataPermissions.java
  20. 59 0
      src/main/java/com/ydtech/modules/admin/model/InsRoleMenuPermissions.java
  21. 75 0
      src/main/java/com/ydtech/modules/admin/model/InsRolePermissions.java
  22. 42 0
      src/main/java/com/ydtech/modules/admin/model/dto/BusinessAgentExcel.java
  23. 39 0
      src/main/java/com/ydtech/modules/admin/model/dto/BusinessCompanyExcel.java
  24. 66 0
      src/main/java/com/ydtech/modules/admin/model/dto/DataPermissionsDto.java
  25. 60 0
      src/main/java/com/ydtech/modules/admin/model/dto/GetChannelExcel.java
  26. 56 0
      src/main/java/com/ydtech/modules/admin/model/dto/InsRoleMenuPermissionsDto.java
  27. 51 0
      src/main/java/com/ydtech/modules/admin/model/dto/InsRolePermissionsDto.java
  28. 53 0
      src/main/java/com/ydtech/modules/admin/model/vo/DataPermissionsVo.java
  29. 9 0
      src/main/java/com/ydtech/modules/admin/model/vo/PersonAreaVo.java
  30. 4 0
      src/main/java/com/ydtech/modules/admin/model/vo/SysPremiumDetailsVo.java
  31. 3 0
      src/main/java/com/ydtech/modules/admin/model/vo/TaskStatisticsVo.java
  32. 38 0
      src/main/java/com/ydtech/modules/admin/service/DataPermissionsService.java
  33. 20 0
      src/main/java/com/ydtech/modules/admin/service/InsRoleMenuPermissionsService.java
  34. 40 0
      src/main/java/com/ydtech/modules/admin/service/InsRolePermissionsService.java
  35. 5 1
      src/main/java/com/ydtech/modules/admin/service/SysSwitchConfigService.java
  36. 2 0
      src/main/java/com/ydtech/modules/admin/service/SysUserService.java
  37. 29 0
      src/main/java/com/ydtech/modules/admin/service/TaskStatisticsService.java
  38. 69 0
      src/main/java/com/ydtech/modules/admin/service/impl/DataPermissionsServiceImpl.java
  39. 62 0
      src/main/java/com/ydtech/modules/admin/service/impl/InsRoleMenuPermissionsServiceImpl.java
  40. 99 0
      src/main/java/com/ydtech/modules/admin/service/impl/InsRolePermissionsServiceImpl.java
  41. 5 2
      src/main/java/com/ydtech/modules/admin/service/impl/SysPartnerServiceImpl.java
  42. 6 0
      src/main/java/com/ydtech/modules/admin/service/impl/SysSwitchConfigServiceImpl.java
  43. 87 0
      src/main/java/com/ydtech/modules/admin/service/impl/SysUserServiceImpl.java
  44. 267 17
      src/main/java/com/ydtech/modules/admin/service/impl/TaskStatisticsServiceImpl.java
  45. 11 1
      src/main/java/com/ydtech/modules/admin/service/impl/UserReportServiceImpl.java
  46. 18 0
      src/main/java/com/ydtech/modules/admin/utils/DataParams.java
  47. 21 2
      src/main/java/com/ydtech/modules/esm/controller/EsmInsCompanyController.java
  48. 11 0
      src/main/java/com/ydtech/modules/esm/dao/EsmInsCompanyMapper.java
  49. 3 1
      src/main/java/com/ydtech/modules/esm/model/vo/EsmUserCountVO.java
  50. 13 0
      src/main/java/com/ydtech/modules/esm/service/EsmInsCompanyService.java
  51. 19 1
      src/main/java/com/ydtech/modules/esm/service/impl/EsmInsCompanyServiceImpl.java
  52. 95 59
      src/main/java/com/ydtech/modules/fee/dto/vo/RuleAttrMappingVo.java
  53. 6 4
      src/main/java/com/ydtech/modules/fee/service/impl/FeeRuleSchemeServiceNewImpl.java
  54. 2 0
      src/main/java/com/ydtech/modules/fnc/controller/contract/ContractController.java
  55. 49 12
      src/main/java/com/ydtech/modules/fnc/entity/InsPlyIncome.java
  56. 1 0
      src/main/java/com/ydtech/modules/fnc/service/contract/impl/contractServiceImpl.java
  57. 124 120
      src/main/java/com/ydtech/modules/fnc/service/impl/InsPlyIncomeServiceImpl.java
  58. 6 1
      src/main/java/com/ydtech/modules/fnc/vo/ContractVo.java
  59. 3 0
      src/main/java/com/ydtech/modules/fnc/vo/InsPlyIncomeVo.java
  60. 10 3
      src/main/java/com/ydtech/modules/ins/model/vo/CustomerInfoVo.java
  61. 6 2
      src/main/java/com/ydtech/modules/ins/model/vo/QuoteRespVo.java
  62. 28 8
      src/main/java/com/ydtech/modules/ins/model/yc/audit/Audit.java
  63. 83 48
      src/main/java/com/ydtech/modules/ins/model/yc/ruote/Applicant.java
  64. 39 10
      src/main/java/com/ydtech/modules/ins/model/yc/ruote/Insured.java
  65. 15 3
      src/main/java/com/ydtech/modules/ins/model/yc/ruote/Tax.java
  66. 8 3
      src/main/java/com/ydtech/modules/ins/model/yc/ruote/Vhl.java
  67. 22 12
      src/main/java/com/ydtech/modules/ins/model/yc/ruote/Vhlowner.java
  68. 1 1
      src/main/java/com/ydtech/modules/inv/controller/InvAccountController.java
  69. 9 2
      src/main/java/com/ydtech/modules/inv/model/excel/AddTypeCXGDExcel.java
  70. 8 2
      src/main/java/com/ydtech/modules/inv/model/excel/AddTypeCXSXFExcel.java
  71. 6 1
      src/main/java/com/ydtech/modules/inv/model/excel/AddTypeFCGDExcel.java
  72. 5 1
      src/main/java/com/ydtech/modules/inv/model/excel/AddTypeFCSXFExcel.java
  73. 110 51
      src/main/java/com/ydtech/modules/inv/utils/CheckInsPlyComeUtils.java
  74. 23 4
      src/main/java/com/ydtech/modules/inv/utils/EasyExcelUtils.java
  75. 14 0
      src/main/java/com/ydtech/modules/order/aop/QuoteNumberVerification.java
  76. 42 4
      src/main/java/com/ydtech/modules/order/aop/aspect/QuoteVerificationAspect.java
  77. 1 1
      src/main/java/com/ydtech/modules/order/components/chengtai/ChengTaiRequestApiComponents.java
  78. 46 0
      src/main/java/com/ydtech/modules/order/components/gouren/GuorenDuplicateInsuranceComponent.java
  79. 37 5
      src/main/java/com/ydtech/modules/order/components/huatai/HuaTaiQuotationProcessorComponent.java
  80. 3 1
      src/main/java/com/ydtech/modules/order/components/zhongmei/ZhongmeiRepeatInsuranceComponents.java
  81. 11 3
      src/main/java/com/ydtech/modules/order/components/zijin/ZijinDuplicateInsuranceComponents.java
  82. 2 1
      src/main/java/com/ydtech/modules/order/components/zijin/ZijinRequestApiComponents.java
  83. 89 0
      src/main/java/com/ydtech/modules/order/constants/QuoteNumberConstant.java
  84. 33 2
      src/main/java/com/ydtech/modules/order/controller/ExternalOrderController.java
  85. 7 0
      src/main/java/com/ydtech/modules/order/controller/InsOrdersController.java
  86. 47 16
      src/main/java/com/ydtech/modules/order/controller/QrCodeController.java
  87. 151 0
      src/main/java/com/ydtech/modules/order/controller/QuoteConfigController.java
  88. 1 1
      src/main/java/com/ydtech/modules/order/controller/YangGuangOrderApiController.java
  89. 9 0
      src/main/java/com/ydtech/modules/order/dao/InsAreaCompanyMapper.java
  90. 26 0
      src/main/java/com/ydtech/modules/order/dao/InsOrdersMapper.java
  91. 15 0
      src/main/java/com/ydtech/modules/order/dao/SysQuoteConfigMapper.java
  92. 30 0
      src/main/java/com/ydtech/modules/order/dao/SysQuoteRecordMapper.java
  93. 21 0
      src/main/java/com/ydtech/modules/order/dao/SysQuoteUserConfigAppendMapper.java
  94. 19 0
      src/main/java/com/ydtech/modules/order/dao/SysQuoteUserMapper.java
  95. 10 2
      src/main/java/com/ydtech/modules/order/entity/InsAreaCompany.java
  96. 6 0
      src/main/java/com/ydtech/modules/order/entity/InsAreaCompanyExternalFee.java
  97. 3 3
      src/main/java/com/ydtech/modules/order/entity/api/chengtai/constants/ImageTypeEnum.java
  98. 50 21
      src/main/java/com/ydtech/modules/order/entity/api/chengtai/request/InsurePremiumRequest.java
  99. 64 25
      src/main/java/com/ydtech/modules/order/entity/api/chengtai/request/SubmitVerifyRequest.java
  100. 17 9
      src/main/java/com/ydtech/modules/order/entity/api/chengtai/request/UploadFileRequest.java

+ 2 - 0
README.md

@@ -22,7 +22,9 @@
 * 前端pc:vue-insagent-pc-prod
 
 
+```shell
 
+```
 
 
 

+ 12 - 1
docker/shell-prod.sh

@@ -32,7 +32,18 @@ function run(){
   # mypid=$(netstat -apn|grep 9001|awk '{print $7}'|cut -d/ -f1);
   # echo $mypid
   # kill -9 $mypid
-  docker run -it --name ins -p 8080:8888 -e "--spring.profiles.active=prod" -p 9999:9999 --restart=always -v /usr/local/java/insAgency:/ins --mount type=bind,source=/nasData,destination=/nasData -v /usr/local/java/insAgency/logs:/ins/logs -d ins:latest
+  docker run -it --name ins  \
+  --restart=always \
+  --log-driver json-file \
+  --log-opt max-size=100m \
+  --log-opt max-file=3 \
+  -p 8080:8888  \
+  -p 9999:9999 \
+  -e "--spring.profiles.active=prod"  \
+  -v /usr/local/java/insAgency:/ins \
+  -v /usr/local/java/insAgency/logs:/ins/logs \
+  --mount type=bind,source=/nasData,destination=/nasData \
+  -d ins:latest
 }
 
 #入口

+ 12 - 1
docker/shell-test.sh

@@ -32,7 +32,18 @@ function run(){
   # mypid=$(netstat -apn|grep 9001|awk '{print $7}'|cut -d/ -f1);
   # echo $mypid
   # kill -9 $mypid
-  docker run -it --name ins-test -p 8080:8888 -e "--spring.profiles.active=test" -p 9999:9999 --restart=always -v /usr/local/java/insAgency:/ins --mount type=bind,source=/nasData,destination=/nasData -v /usr/local/java/insAgency/logs:/ins/logs -d ins-test:latest
+  docker run -it --name ins-test \
+    --log-driver json-file \
+    --log-opt max-size=100m \
+    --log-opt max-file=3 \
+    -p 8080:8888 \
+    -e "--spring.profiles.active=test" \
+    -p 9999:9999 \
+    --restart=always \
+    -v /usr/local/java/insAgency:/ins \
+    -v /usr/local/java/insAgency/logs:/ins/logs \
+    --mount type=bind,source=/nasData,destination=/nasData \
+    -d ins-test:latest
 }
 
 #入口

+ 0 - 10
sql/Online.sql

@@ -1,10 +0,0 @@
---  2024-12-02 BY wks
-alter table sys_qy_wechat
-    drop column support_staff_url;
-
-alter table sys_qy_wechat
-    add open_kf_id varchar(256) null comment '客服账号ID';
-
-alter table sys_qy_wechat
-    add open_kf_name varchar(256) null comment '客服账号名称';
---  2024-12-02 BY wks

+ 11 - 0
src/main/java/com/ydtech/aop/GetStringBufferContent.java

@@ -0,0 +1,11 @@
+package com.ydtech.aop;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Target({ElementType.METHOD, ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+public @interface GetStringBufferContent {
+}

+ 223 - 0
src/main/java/com/ydtech/aop/StringBufferContentAspect.java

@@ -0,0 +1,223 @@
+package com.ydtech.aop;
+
+import com.ydtech.modules.admin.constants.DataPermissionsEnum;
+import com.ydtech.modules.admin.dao.DataPermissionsMapper;
+import com.ydtech.modules.admin.model.DataPermissions;
+import com.ydtech.modules.admin.model.InsRoleMenuPermissions;
+import com.ydtech.modules.admin.model.InsRolePermissions;
+import com.ydtech.modules.admin.model.SysUser;
+import com.ydtech.modules.admin.model.dto.InsRoleMenuPermissionsDto;
+import com.ydtech.modules.admin.model.dto.InsRolePermissionsDto;
+import com.ydtech.modules.admin.model.vo.DataPermissionsVo;
+import com.ydtech.modules.admin.service.DataPermissionsService;
+import com.ydtech.modules.admin.service.InsRoleMenuPermissionsService;
+import com.ydtech.modules.admin.service.InsRolePermissionsService;
+import com.ydtech.modules.admin.utils.DataParams;
+import com.ydtech.modules.base.controller.BaseController;
+import com.ydtech.modules.inv.model.vo.InvAccountQueryVo;
+import org.aspectj.lang.ProceedingJoinPoint;
+import org.aspectj.lang.annotation.Around;
+import org.aspectj.lang.annotation.Aspect;
+import org.aspectj.lang.annotation.Pointcut;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+import org.springframework.web.context.request.RequestContextHolder;
+import org.springframework.web.context.request.ServletRequestAttributes;
+
+import javax.servlet.http.HttpServletRequest;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+@Aspect
+@Component
+public class StringBufferContentAspect {
+    @Autowired
+    private HttpServletRequest request;
+
+
+    @Autowired
+    private DataPermissionsMapper dataPermissionsMapper;
+
+    @Autowired
+    private InsRoleMenuPermissionsService insRoleMenuPermissionsService;
+
+    @Autowired
+    private InsRolePermissionsService insRolePermissionsService;
+
+    @Autowired
+    private DataPermissionsService  dataPermissionsService;
+
+    @Pointcut("@annotation(GetStringBufferContent)")
+    public void getStringBufferContentPointcut() {
+    }
+
+    @Around("getStringBufferContentPointcut()")
+    public Object aroundGetStringBufferContent(ProceedingJoinPoint joinPoint) throws Throwable {
+        // 获取HttpServletRequest并添加空指针检查(这里假设已经在Spring配置中正确注入了HttpServletRequest,实际可能需要进一步处理注入问题)
+        ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
+        if (attributes == null) {
+            throw new IllegalStateException("无法获取ServletRequestAttributes");
+        }
+        HttpServletRequest request = attributes.getRequest();
+        if (request == null) {
+            throw new IllegalStateException("无法获取HttpServletRequest");
+        }
+        String string = request.getRequestURL().toString();
+        URI uri = new URI(string);
+        String path = uri.getPath();
+
+        DataParams invAccountQueryVo = (DataParams) joinPoint.getArgs()[0];
+        // 假设这里通过某种业务逻辑生成了stringBufferContent的值
+        this.buildStringBufferBasedOnDataPermissions(path, invAccountQueryVo);
+
+        // 继续执行被注解标注的方法或类的原有逻辑e
+        return joinPoint.proceed();
+    }
+
+    private void buildStringBufferBasedOnDataPermissions(String path, DataParams invAccountQueryVo) {
+        StringBuilder stringBuffer = new StringBuilder();
+        List<DataPermissions> operatorList = dataPermissionsMapper.getByPath(path);
+
+        List<DataPermissions> cheList = this.checkData(operatorList);
+        if(!cheList.isEmpty()){
+            Map<String, List<DataPermissions>> groupedMap = cheList.stream()
+                    .collect(Collectors.groupingBy(DataPermissions::getRuleField));
+            if (operatorList.size() == 1) {
+
+                handleSingleDataPermission(cheList.get(0), stringBuffer, invAccountQueryVo);
+            } else {
+                handleMultipleDataPermissions(groupedMap, stringBuffer, invAccountQueryVo);
+            }
+        }
+    }
+
+    /**
+     * @param operatorList
+     * @return 校验数据
+     */
+    private List<DataPermissions> checkData(List<DataPermissions> operatorList) {
+        SysUser user = BaseController.getUser();
+        String roleId = user.getRoleId();  // 角色id
+
+        // 提取该接口配置的菜单id列表,去重
+        List<String> menuIdList = operatorList.stream()
+                .map(DataPermissions::getMenuId)
+                .distinct()
+                .collect(Collectors.toList());
+
+        if (menuIdList.isEmpty()) {
+            // 如果没有配置菜单,直接返回空的DataPermissions列表
+            return new ArrayList<DataPermissions>();
+        }
+
+        // 创建用于查询角色菜单权限的对象,在循环中只需设置具体属性即可
+        InsRoleMenuPermissionsDto insRoleMenuPermissionsDto = new InsRoleMenuPermissionsDto();
+        insRoleMenuPermissionsDto.setRoleId(roleId);
+
+        // 创建用于查询角色权限的对象,同样在循环中设置具体属性
+        InsRolePermissionsDto insRolePermissionsDto = new InsRolePermissionsDto();
+        insRolePermissionsDto.setRoleId(roleId);
+
+        for (String menuId : menuIdList) {
+            // 设置当前循环中菜单id到相应查询对象中
+            insRoleMenuPermissionsDto.setMenuId(menuId);
+            insRolePermissionsDto.setMenuId(menuId);
+
+            // 通过角色id和菜单id查询是否配置了该菜单权限
+            List<InsRoleMenuPermissionsDto> roleMenuPermissionsList = insRoleMenuPermissionsService.getRoleMenuPermissionsList(insRoleMenuPermissionsDto);
+            if (!roleMenuPermissionsList.isEmpty()) {
+                // 如果存在该菜单权限,则查询该角色下的权限规则有哪些
+                List<InsRolePermissions> InsRolePermissionsServiceList = insRolePermissionsService.getInsRolePermissionsServiceList(insRolePermissionsDto);
+                if (!InsRolePermissionsServiceList.isEmpty()) {
+                    List<String> permissionsList = InsRolePermissionsServiceList.stream()
+                            .map(InsRolePermissions::getPermissionsId)
+                            .collect(Collectors.toList());
+
+                    DataPermissionsVo dataPermissionsVo = new DataPermissionsVo();
+                    dataPermissionsVo.setPermissionsList(permissionsList);
+                    // 执行查询并返回结果,一旦找到符合条件的权限并查询到对应数据权限,直接返回
+                    return dataPermissionsService.queryList(dataPermissionsVo);
+                }
+            }
+        }
+        // 如果遍历完所有菜单都没有符合条件的权限,返回空的DataPermissions列表
+        return new ArrayList<DataPermissions>();
+    }
+    private void handleSingleDataPermission(DataPermissions dataPermissions, StringBuilder stringBuffer,
+                                            DataParams invAccountQueryVo) {
+        HashMap<String, String> sqlMap = new HashMap<>();
+        String ruleCondition = dataPermissions.getRuleCondition();
+        String descByCode = DataPermissionsEnum.getDescByCode(ruleCondition);
+        String ruleField = dataPermissions.getRuleField();
+        String ruleValue = dataPermissions.getRuleValue();
+
+        sqlMap.put(ruleField, ruleValue);
+        buildStringBuffer(stringBuffer, ruleField, descByCode, ruleValue);
+
+        invAccountQueryVo.setStringBufferContent(stringBuffer.toString());
+        invAccountQueryVo.setStringBufferContentMap(sqlMap);
+    }
+
+    private void handleMultipleDataPermissions(Map<String, List<DataPermissions>> groupedMap, StringBuilder stringBuffer, DataParams invAccountQueryVo) {
+        HashMap<String, String> sqlMap = new HashMap<>();
+        for (Map.Entry<String, List<DataPermissions>> entry : groupedMap.entrySet()) {
+            List<DataPermissions> dataPermissionsList = entry.getValue();
+            int index = 0;
+            for (DataPermissions dataPermissions : dataPermissionsList) {
+                String ruleCondition = dataPermissions.getRuleCondition();
+                String descByCode = DataPermissionsEnum.getDescByCode(ruleCondition);
+                String ruleField = dataPermissions.getRuleField();
+                String ruleValue = dataPermissions.getRuleValue();
+                StringBuilder stringBuilder = new StringBuilder();
+                if(ruleValue.contains(",")){
+                    String[] split = ruleValue.split(",");
+                    int  indexNumber  =0;
+                    for (String s : split) {
+                        stringBuilder.append("'").append(s).append("'").append(",");
+                        indexNumber++;
+                    }
+                    stringBuilder.deleteCharAt(stringBuilder.length() - 1);
+                    ruleValue =stringBuilder.toString();
+
+                }
+                if (index >= 1) {
+                    sqlMap.put(ruleField + index, ruleValue);
+                } else {
+                    sqlMap.put(ruleField, ruleValue);
+                }
+                buildStringBuffer(stringBuffer, ruleField, descByCode, ruleValue, index);
+                index++;
+            }
+        }
+        invAccountQueryVo.setStringBufferContent(stringBuffer.toString());
+    }
+
+    private void buildStringBuffer(StringBuilder stringBuffer, String ruleField, String descByCode, String ruleValue) {
+        buildStringBuffer(stringBuffer, ruleField, descByCode, ruleValue, 0);
+    }
+
+    private void buildStringBuffer(StringBuilder stringBuffer, String ruleField, String descByCode, String ruleValue, int index) {
+        // 根据索引构建用于从map取值的键
+        String mapValueKey = index >= 1 ? ruleField + index : ruleField;
+        // 构建公共的SQL语句前缀部分
+        String commonSqlPrefix = String.format(" and %s %s", ruleField, descByCode);
+        String sqlFragment;
+        if (descByCode.contains("in")) {
+            if(!ruleValue.contains(",")){
+                sqlFragment = commonSqlPrefix + " ('"+ruleValue+"') ";
+
+            }else {
+                // 如果是in的情况,添加括号包裹map取值部分
+                sqlFragment = commonSqlPrefix + " ("+ruleValue+") ";
+            }
+        } else {
+            // 其他情况直接拼接map取值部分
+            sqlFragment = commonSqlPrefix +  " '"+ruleValue+"' ";
+        }
+        stringBuffer.append(sqlFragment);
+    }
+}

+ 22 - 2
src/main/java/com/ydtech/components/OrderComponents.java

@@ -287,6 +287,26 @@ public class OrderComponents {
             throw new SystemException("被保人信息 / 被保人信息 不能为空!");
         }
 
+        if (StringUtils.isEmpty(yaQuoteInfoVo.getOwnerInfo().getIdentifyType())) {
+            yaQuoteInfoVo.getOwnerInfo().setIdentifyType("1");
+        }
+        if (StringUtils.isEmpty(yaQuoteInfoVo.getInsuredPersonInfo().getIdentifyType())) {
+            yaQuoteInfoVo.getInsuredPersonInfo().setIdentifyType("1");
+        }
+        if (StringUtils.isEmpty(yaQuoteInfoVo.getPolicyHolderInfo().getIdentifyType())) {
+            yaQuoteInfoVo.getPolicyHolderInfo().setIdentifyType("1");
+        }
+
+        if (StringUtils.isEmpty(yaQuoteInfoVo.getOwnerInfo().getProperty())) {
+            yaQuoteInfoVo.getOwnerInfo().setProperty("1");
+        }
+        if (StringUtils.isEmpty(yaQuoteInfoVo.getInsuredPersonInfo().getProperty())) {
+            yaQuoteInfoVo.getInsuredPersonInfo().setProperty("1");
+        }
+        if (StringUtils.isEmpty(yaQuoteInfoVo.getPolicyHolderInfo().getProperty())) {
+            yaQuoteInfoVo.getPolicyHolderInfo().setProperty("1");
+        }
+
         if (StringUtils.isEmpty(yaQuoteInfoVo.getCarInfo().getFrameNo())) {
             throw new SystemException("车架号不能为空");
         }
@@ -382,7 +402,8 @@ public class OrderComponents {
 //        insOrder.setUsername(user.getName());
 //        insOrder.setDeptid(user.getDeptId());
 //        SysDept dept = sysDeptService.getById(user.getDeptId());
-////        SysDept dept = sysDeptService.selectByPk(user.getDeptId());
+
+    /// /        SysDept dept = sysDeptService.selectByPk(user.getDeptId());
 //        insOrder.setDeptname(dept == null ? "" : dept.getName());
 //
 //        double retailRate = countRetail(user.getDeptId(), user.getId());
@@ -475,7 +496,6 @@ public class OrderComponents {
 //        return insOrder;
 //
 //    }
-
     public InsOrder orderExists(String orderNo) {
         InsOrder insOrder = insOrderService.selectByPk(orderNo);
         if (ObjectUtils.isEmpty(insOrder)) {

+ 29 - 0
src/main/java/com/ydtech/modules/admin/constants/DataPermissionsEnum.java

@@ -0,0 +1,29 @@
+package com.ydtech.modules.admin.constants;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+/**
+ * 数据权限条件枚举
+ */
+@Getter
+@AllArgsConstructor
+public enum DataPermissionsEnum {
+    DATA_01("1", "="),
+    DATA_02("2", "!="),
+    DATA_03("3", "in"),
+    DATA_04("4", "not in"),
+    DATA_05("5", "sql");
+
+    private final String code;
+
+    private final String desc;
+    public static String getDescByCode(String code){
+        for (DataPermissionsEnum value : DataPermissionsEnum.values()) {
+            if(value.getCode().equals(code)){
+                return value.getDesc();
+            }
+        }
+        return null;
+    }
+}

+ 3 - 1
src/main/java/com/ydtech/modules/admin/constants/SwitchConfig.java

@@ -34,7 +34,9 @@ public enum SwitchConfig {
     WCQCA_02("weComQRCodeChannel", "企业微信二维码显示(渠道)"),
     WCQCA_03("weComQRCodeOther", "企业微信二维码显示(其他)"),
     //余额提现控制
-    YETX_01("balanceExtract","提现控制(线上或线下)")
+    YETX_01("balanceExtract","提现控制(线上或线下)"),
+
+    APP_UNDEVELOPED("appUndeveloped", "app未开发完功能隐藏"),
     ;
 
 

+ 83 - 0
src/main/java/com/ydtech/modules/admin/controller/DataPermissionsController.java

@@ -0,0 +1,83 @@
+package com.ydtech.modules.admin.controller;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.ydtech.core.page.HttpResult;
+import com.ydtech.modules.admin.model.DataPermissions;
+import com.ydtech.modules.admin.model.dto.DataPermissionsDto;
+import com.ydtech.modules.admin.model.vo.DataPermissionsVo;
+import com.ydtech.modules.admin.service.DataPermissionsService;
+import com.ydtech.modules.base.controller.BaseController;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+@Api(tags = "数据权限")
+@RequestMapping("/dataPermissions")
+@RestController
+public class DataPermissionsController extends BaseController {
+
+    @Autowired
+    private DataPermissionsService  dataPermissionsService;
+
+    /**
+     * @param dataPermissionsDto
+     * @return 新增数据权限
+     */
+    @PostMapping("saveAndUpdate")
+    @ApiOperation("新增修改")
+    public HttpResult insertInsAccount(@RequestBody DataPermissionsDto dataPermissionsDto) {
+        dataPermissionsService.saveAndUpdate(dataPermissionsDto);
+        return HttpResult.ok(StringUtils.isNotBlank(dataPermissionsDto.getId()) ? "编辑成功" : "新增成功");
+    }
+
+
+    /**
+     * @description: 分页查询
+     * @author: whp
+     **/
+    @PostMapping("queryPage")
+    @ApiOperation(value = "分页查询")
+    public HttpResult<IPage<DataPermissions>> queryPage(@RequestBody DataPermissionsVo dataPermissionsVo) {
+        try {
+            IPage<DataPermissions> result = dataPermissionsService.queryPage(dataPermissionsVo);
+            return HttpResult.ok("查询数据成功", result);
+        } catch (Exception e) {
+            return HttpResult.error("查询错误" + e.getMessage());
+        }
+    }
+
+    /**
+     * @description: 回显
+     * @author: whp
+     **/
+    @GetMapping("{id}")
+    @ApiOperation(value = "回显")
+        public HttpResult<DataPermissions> getById(@PathVariable("id") String id ) {
+        try {
+            DataPermissions result = dataPermissionsService.getSelectById(id);
+            return HttpResult.ok("查询数据成功", result);
+        } catch (Exception e) {
+            return HttpResult.error("查询错误" + e.getMessage());
+        }
+    }
+
+    /**
+     * @description: 查询List
+     * @author: whp
+     **/
+    @PostMapping("queryList")
+    @ApiOperation(value = "分页查询")
+    public HttpResult<List<DataPermissions>> queryList(@RequestBody DataPermissionsVo dataPermissionsVo) {
+        try {
+            List<DataPermissions> result = dataPermissionsService.queryList(dataPermissionsVo);
+            return HttpResult.ok("查询数据成功", result);
+        } catch (Exception e) {
+            return HttpResult.error("查询错误" + e.getMessage());
+        }
+    }
+
+}

+ 76 - 0
src/main/java/com/ydtech/modules/admin/controller/InsRolePermissionsController.java

@@ -0,0 +1,76 @@
+package com.ydtech.modules.admin.controller;
+
+
+import com.ydtech.core.page.HttpResult;
+import com.ydtech.modules.admin.model.InsRoleMenuPermissions;
+import com.ydtech.modules.admin.model.InsRolePermissions;
+import com.ydtech.modules.admin.model.dto.InsRoleMenuPermissionsDto;
+import com.ydtech.modules.admin.model.dto.InsRolePermissionsDto;
+import com.ydtech.modules.admin.service.InsRolePermissionsService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+@Api(tags = "角色菜单数据权限")
+@RequestMapping("/insRolePermissions")
+@RestController
+public class InsRolePermissionsController {
+    @Autowired
+    private InsRolePermissionsService insRolePermissionsService;
+
+    /**
+     * @param insRolePermissionsDto
+     * @return 新增数据权限
+     */
+    @PostMapping("saveAndUpdate")
+    @ApiOperation("新增修改")
+    public HttpResult insertRolePermissions(@RequestBody InsRolePermissionsDto insRolePermissionsDto) {
+        insRolePermissionsService.insertAndUpdate(insRolePermissionsDto);
+        return HttpResult.ok(StringUtils.isNotBlank(insRolePermissionsDto.getId()) ? "编辑成功" : "新增成功");
+    }
+
+
+    /**
+     * @param insRoleMenuPermissionsDto
+     * @return 菜单角色数据权限关联
+     */
+    @PostMapping("saveAndUpdateRuleMenu")
+    @ApiOperation("新增修改")
+    public HttpResult saveAndUpdateRuleMenu(@RequestBody InsRoleMenuPermissionsDto insRoleMenuPermissionsDto) {
+        insRolePermissionsService.saveAndUpdateRuleMenu(insRoleMenuPermissionsDto);
+        return HttpResult.ok(StringUtils.isNotBlank(insRoleMenuPermissionsDto.getId()) ? "编辑成功" : "新增成功");
+    }
+
+
+    /**
+     * @param
+     * @return 获取数据权限菜单列表
+     */
+    @PostMapping("getInsRoleMenuPermissions")
+    @ApiOperation("获取数据权限菜单列表")
+    public HttpResult<List<InsRoleMenuPermissions>> getInsRoleMenuPermissions(@RequestBody InsRoleMenuPermissionsDto insRoleMenuPermissionsDto) {
+        List<InsRoleMenuPermissions> insRoleMenuPermissionsList = insRolePermissionsService.getInsRoleMenuPermissions(insRoleMenuPermissionsDto);
+        return HttpResult.ok(insRoleMenuPermissionsList);
+    }
+
+
+
+
+    /**
+     * @param
+     * @return 获取菜单数据权限
+     */
+    @PostMapping("getInsRolePermissionsDtoList")
+    @ApiOperation("获取菜单数据权限")
+    public HttpResult<List<InsRolePermissions>> getInsRolePermissionsDtoList(@RequestBody InsRolePermissionsDto insRolePermissionsDto) {
+        List<InsRolePermissions> insRoleMenuPermissionsList = insRolePermissionsService.getInsRolePermissionsDtoList(insRolePermissionsDto);
+        return HttpResult.ok(insRoleMenuPermissionsList);
+    }
+}

+ 6 - 0
src/main/java/com/ydtech/modules/admin/controller/SysSwitchConfigController.java

@@ -50,5 +50,11 @@ public class SysSwitchConfigController {
         return HttpResult.ok();
     }
 
+    @GetMapping("/appUndeveloped/display")
+    @ApiOperation(value = "app未开发完功能隐藏")
+    public HttpResult<Boolean> appUndeveloped() {
+        boolean display = sysSwitchConfigService.appUndeveloped();
+        return HttpResult.ok(display);
+    }
 
 }

+ 18 - 2
src/main/java/com/ydtech/modules/admin/controller/SysUserController.java

@@ -148,18 +148,20 @@ public class SysUserController extends BaseController {
      */
     @PostMapping(value = "/queryPage")
     public HttpResult queryPage(@RequestBody PageRequest pageRequest) {
-        String deptid = pageRequest.getColumnFilterValue(pageRequest, "deptid");
+        String deptId = pageRequest.getColumnFilterValue(pageRequest, "deptId");
         String name = pageRequest.getColumnFilterValue(pageRequest, "name");
         String containsSubDept = pageRequest.getColumnFilterValue(pageRequest, "containsSubDept");
         String mobile = pageRequest.getColumnFilterValue(pageRequest, "mobile");
         String roleId = pageRequest.getColumnFilterValue(pageRequest, "roleId");
         String deptName = pageRequest.getColumnFilterValue(pageRequest, "deptName");
+        String id = pageRequest.getColumnFilterValue(pageRequest,"id");
         SysUser sysUser = new SysUser();
-        sysUser.setDeptId(deptid);
+        sysUser.setDeptId(deptId);
         sysUser.setName(name);
         sysUser.setMobile(mobile);
         sysUser.setRoleId(roleId);
         sysUser.setDeptName(deptName);
+        sysUser.setId(id);
         Page page = PageRequest.buildPageRequest(pageRequest);
         IPage<SysUser> pResult = sysUserService.selectUserPage(page, sysUser, containsSubDept);
         //传入查询条件
@@ -1057,6 +1059,20 @@ public class SysUserController extends BaseController {
         return HttpResult.ok(list);
     }
 
+
+    /**
+     *
+     *
+     * @return 获取用户下级是否有  电销  代理人 渠道   如果有则返回  没有则 不返回
+     */
+    @ApiOperation(value = "获取当前用户的下级")
+    @GetMapping(value = "/findNextTreeContain")
+    public HttpResult<List<SysUser>> findNextTreeContain(String managementSource) {
+        List<SysUser> list = sysUserService.findNextTreeContain(managementSource);
+        return HttpResult.ok(list);
+    }
+
+
     /**
      * 获取当前用户的所有代理人
      *

+ 100 - 20
src/main/java/com/ydtech/modules/admin/controller/taskStatistics/TaskStatisticsController.java

@@ -14,6 +14,7 @@ import com.ydtech.modules.admin.service.TaskStatisticsService;
 import com.ydtech.modules.admin.utils.KztGetDeptUtils;
 import io.swagger.annotations.*;
 import org.apache.commons.lang3.ObjectUtils;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
@@ -332,6 +333,26 @@ public class TaskStatisticsController {
         }
     }
 
+    /**
+     * @description:   控制台 - 业务数据 -保险公司导出
+     * @author: whp
+     * @date: 2024/12/13
+     **/
+    @PostMapping("/getBusinessDataExcel")
+    @ApiOperation(value = "任务统计-保险公司导出")
+    public HttpResult getBusinessDataExcel(@RequestBody TaskStatisticsVo taskStatisticsVo, HttpServletRequest httpServerRequest) {
+        KztGetDeptUtils kztGetDeptUtils = new KztGetDeptUtils();
+        KztGetDeptUtilsDto kztGetDeptUtilsDto = kztGetDeptUtils.KztGetDeptIds(httpServerRequest.getRequestURL().toString());
+        if(ObjectUtils.isNotEmpty(kztGetDeptUtilsDto)){
+            if("1".equals(kztGetDeptUtilsDto.getType())){
+                taskStatisticsVo.setDeptIds(kztGetDeptUtilsDto.getIds());
+            } else if ("2".equals(kztGetDeptUtilsDto.getType())) {
+                taskStatisticsVo.setUserIds(kztGetDeptUtilsDto.getIds());
+            }
+        }
+        return this.taskStatisticsService.getBusinessDataExcel(taskStatisticsVo);
+    }
+
     /**
      * @description:   控制台-业务数据-统计
      * @author: whp
@@ -399,17 +420,9 @@ public class TaskStatisticsController {
      **/
     @PostMapping("getBusinessAgentData")
     @ApiOperation(value = "控制台-业务数据-代理人")
-    public HttpResult<IPage<BusinessAgentData>> getBusinessAgentData(@RequestBody TaskStatisticsVo taskStatisticsVo, HttpServletRequest httpServerRequest) {
+    public HttpResult<IPage<BusinessAgentData>> getBusinessAgentData(@RequestBody TaskStatisticsVo taskStatisticsVo) {
         try{
-            KztGetDeptUtils kztGetDeptUtils = new KztGetDeptUtils();
-            KztGetDeptUtilsDto kztGetDeptUtilsDto = kztGetDeptUtils.KztGetDeptIds(httpServerRequest.getRequestURL().toString());
-            if(ObjectUtils.isNotEmpty(kztGetDeptUtilsDto)){
-                if("1".equals(kztGetDeptUtilsDto.getType())){
-                    taskStatisticsVo.setDeptIds(kztGetDeptUtilsDto.getIds());
-                } else if ("2".equals(kztGetDeptUtilsDto.getType())) {
-                    taskStatisticsVo.setUserIds(kztGetDeptUtilsDto.getIds());
-                }
-            }
+
             IPage<BusinessAgentData> result = taskStatisticsService.getBusinessAgentData(taskStatisticsVo);
             return HttpResult.ok("查询数据成功", result);
         }catch (Exception e){
@@ -417,6 +430,66 @@ public class TaskStatisticsController {
         }
     }
 
+    /**
+     * @description:   控制台 - 业务数据 -代理人导出
+     * @author: whp
+     * @date: 2024/12/13
+     **/
+    @PostMapping("/getBusinessAgentExcel")
+    @ApiOperation(value = "任务统计-代理人导出")
+    public HttpResult getBusinessAgentExcel(@RequestBody TaskStatisticsVo taskStatisticsVo, HttpServletRequest httpServerRequest) {
+        KztGetDeptUtils kztGetDeptUtils = new KztGetDeptUtils();
+        KztGetDeptUtilsDto kztGetDeptUtilsDto = kztGetDeptUtils.KztGetDeptIds(httpServerRequest.getRequestURL().toString());
+        if(ObjectUtils.isNotEmpty(kztGetDeptUtilsDto)){
+            if("1".equals(kztGetDeptUtilsDto.getType())){
+                taskStatisticsVo.setDeptIds(kztGetDeptUtilsDto.getIds());
+            } else if ("2".equals(kztGetDeptUtilsDto.getType())) {
+                taskStatisticsVo.setUserIds(kztGetDeptUtilsDto.getIds());
+            }
+        }
+        return this.taskStatisticsService.getBusinessAgentExcel(taskStatisticsVo);
+    }
+
+
+    /**
+     * @description:   控制台 - 业务数据 -渠道导出
+     * @author: whp
+     * @date: 2024/12/13
+     **/
+    @PostMapping("/getChannelExcel")
+    @ApiOperation(value = "任务统计-渠道导出")
+    public HttpResult getChannelExcel(@RequestBody TaskStatisticsVo taskStatisticsVo, HttpServletRequest httpServerRequest) {
+        KztGetDeptUtils kztGetDeptUtils = new KztGetDeptUtils();
+        KztGetDeptUtilsDto kztGetDeptUtilsDto = kztGetDeptUtils.KztGetDeptIds(httpServerRequest.getRequestURL().toString());
+        if(ObjectUtils.isNotEmpty(kztGetDeptUtilsDto)){
+            if("1".equals(kztGetDeptUtilsDto.getType())){
+                taskStatisticsVo.setDeptIds(kztGetDeptUtilsDto.getIds());
+            } else if ("2".equals(kztGetDeptUtilsDto.getType())) {
+                taskStatisticsVo.setUserIds(kztGetDeptUtilsDto.getIds());
+            }
+        }
+        return this.taskStatisticsService.getChannelExcel(taskStatisticsVo);
+    }
+
+
+
+    /**
+     * @description:   任控制台-业务数据-渠道
+     * @author: whp
+     * @date: 2024/12/05
+     **/
+    @PostMapping("getBusinessElectricData")
+    @ApiOperation(value = "任控制台-业务数据-渠道")
+    public HttpResult<IPage<BusinessAgentData>> getBusinessElectricData(@RequestBody TaskStatisticsVo taskStatisticsVo) {
+        try{
+
+            IPage<BusinessAgentData> result = taskStatisticsService.getBusinessElectricData(taskStatisticsVo);
+            return HttpResult.ok("查询数据成功", result);
+        }catch (Exception e){
+            return HttpResult.error("查询错误"+e.getMessage());
+        }
+    }
+
     /**
      * @description:   任控制台-业务数据-代理人-合计
      * @author: whp
@@ -424,17 +497,8 @@ public class TaskStatisticsController {
      **/
     @PostMapping("getBusinessAgentDataTotal")
     @ApiOperation(value = "控制台-业务数据-代理人-合计")
-    public HttpResult<BusinessAgentData> getBusinessAgentDataTotal(@RequestBody TaskStatisticsVo taskStatisticsVo, HttpServletRequest httpServerRequest) {
+    public HttpResult<BusinessAgentData> getBusinessAgentDataTotal(@RequestBody TaskStatisticsVo taskStatisticsVo) {
         try{
-            KztGetDeptUtils kztGetDeptUtils = new KztGetDeptUtils();
-            KztGetDeptUtilsDto kztGetDeptUtilsDto = kztGetDeptUtils.KztGetDeptIds(httpServerRequest.getRequestURL().toString());
-            if(ObjectUtils.isNotEmpty(kztGetDeptUtilsDto)){
-                if("1".equals(kztGetDeptUtilsDto.getType())){
-                    taskStatisticsVo.setDeptIds(kztGetDeptUtilsDto.getIds());
-                } else if ("2".equals(kztGetDeptUtilsDto.getType())) {
-                    taskStatisticsVo.setUserIds(kztGetDeptUtilsDto.getIds());
-                }
-            }
             BusinessAgentData result = taskStatisticsService.getBusinessAgentDataTotal(taskStatisticsVo);
             return HttpResult.ok("查询数据成功", result);
         }catch (Exception e){
@@ -442,6 +506,22 @@ public class TaskStatisticsController {
         }
     }
 
+    /**
+     * @description:   任控制台-业务数据-代理人-合计
+     * @author: whp
+     *
+     **/
+    @PostMapping("getBusinessElectricDataTotal")
+    @ApiOperation(value = "控制台-业务数据-渠道-合计")
+    public HttpResult<BusinessAgentData> getBusinesElectricDataTotal(@RequestBody TaskStatisticsVo taskStatisticsVo) {
+        try{
+            BusinessAgentData result = taskStatisticsService.getBusinessElectricDataTotal(taskStatisticsVo);
+            return HttpResult.ok("查询数据成功", result);
+        }catch (Exception e){
+            return HttpResult.error("查询错误"+e.getMessage());
+        }
+    }
+
     /**
      * @description:   任控制台-业务数据-代理人-详情
      * @author: whp

+ 26 - 0
src/main/java/com/ydtech/modules/admin/dao/DataPermissionsMapper.java

@@ -0,0 +1,26 @@
+package com.ydtech.modules.admin.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ydtech.modules.admin.model.DataPermissions;
+import com.ydtech.modules.admin.model.vo.DataPermissionsVo;
+import com.ydtech.modules.fnc.entity.ContractEntity;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+@Mapper
+public interface DataPermissionsMapper   extends BaseMapper<DataPermissions> {
+
+    IPage<DataPermissions> queryPage(@Param("page") Page page, @Param("vo") DataPermissionsVo dataPermissionsVo);
+
+    List<DataPermissions> getByPath(String path);
+    /**
+     *
+     * @param dataPermissionsVo
+     * @return  菜单数据权限查询
+     */
+    List<DataPermissions> queryList(@Param("vo") DataPermissionsVo dataPermissionsVo);
+}

+ 14 - 0
src/main/java/com/ydtech/modules/admin/dao/InsRoleMenuPermissionsMapper.java

@@ -0,0 +1,14 @@
+package com.ydtech.modules.admin.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ydtech.modules.admin.model.InsRoleMenuPermissions;
+import com.ydtech.modules.admin.model.dto.InsRoleMenuPermissionsDto;
+import org.apache.ibatis.annotations.Mapper;
+
+import java.util.List;
+
+@Mapper
+public interface InsRoleMenuPermissionsMapper extends BaseMapper<InsRoleMenuPermissions> {
+    List<InsRoleMenuPermissionsDto> getRoleMenuPermissionsList(InsRoleMenuPermissionsDto insRoleMenuPermissionsDto);
+
+}

+ 18 - 0
src/main/java/com/ydtech/modules/admin/dao/InsRolePermissionsMapper.java

@@ -0,0 +1,18 @@
+package com.ydtech.modules.admin.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ydtech.modules.admin.model.InsRolePermissions;
+import com.ydtech.modules.admin.model.dto.InsRolePermissionsDto;
+import org.apache.ibatis.annotations.Mapper;
+
+import java.util.List;
+
+@Mapper
+public interface InsRolePermissionsMapper  extends BaseMapper<InsRolePermissions> {
+    /**
+     *
+     * @param insRolePermissionsDto
+     * @return  通过角色 菜单id  获取 权限规则
+     */
+    List<InsRolePermissions> getInsRolePermissionsServiceList(InsRolePermissionsDto insRolePermissionsDto);
+}

+ 2 - 0
src/main/java/com/ydtech/modules/admin/dao/TaskStatisticsMapper.java

@@ -55,4 +55,6 @@ public interface TaskStatisticsMapper extends BaseMapper<TaskStatisticsDto> {
      **/
     BusinessOrderData getBusinessOrderDataTotal(@Param("vo") TaskStatisticsVo taskStatisticsVo);
 
+    List<BusinessAgentData> getBusinessAgentDataExcel(@Param("vo") TaskStatisticsVo taskStatisticsVo);
+
 }

+ 112 - 0
src/main/java/com/ydtech/modules/admin/model/DataPermissions.java

@@ -0,0 +1,112 @@
+package com.ydtech.modules.admin.model;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.ydtech.modules.base.model.BaseEntity;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+/**
+ * 数据权限
+ */
+@ApiModel
+@Data
+@TableName(value = "ins_data_permissions")
+public class DataPermissions implements Serializable {
+    private static final long serialVersionUID = 1L;
+    /**
+     * 编号
+     */
+    @ApiModelProperty(value = "id")
+    @TableId(value = "id")
+    private String id;
+
+    /**
+     * 用户ID
+     */
+    @ApiModelProperty(value = "用户ID")
+    @TableField(value = "user_id")
+    private String userId;
+
+    /**
+     * 部门ID
+     */
+    @ApiModelProperty(value = "部门ID")
+    @TableField(value = "dept_id")
+    private String deptId;
+
+
+    /**
+     * 规则名称
+     */
+    @ApiModelProperty(value = "规则名称")
+    @TableField(value = "rule_name")
+    private String ruleName;
+
+
+    /**
+     * 规则字段
+     */
+    @ApiModelProperty(value = "规则字段")
+    @TableField(value = "rule_field")
+    private String ruleField;
+
+
+    /**
+     * 条件规则
+     */
+    @ApiModelProperty(value = "条件规则")
+    @TableField(value = "rule_condition")
+    private String ruleCondition;
+
+    /**
+     * 规则值
+     */
+    @ApiModelProperty(value = "规则值")
+    @TableField(value = "rule_value")
+    private String ruleValue;
+
+
+    /**
+     * 状态
+     */
+    @ApiModelProperty(value = "状态")
+    @TableField(value = "status")
+    private String status;
+
+    /**
+     * 创建日期
+     */
+    @ApiModelProperty(value = "创建日期")
+    @TableField(value = "create_time")
+    private LocalDateTime createTime;
+
+    /**
+     * 菜单id
+     */
+    @ApiModelProperty(value = "菜单id")
+    @TableField(value = "menu_id")
+    private String menuId;
+
+    /**
+     * 接口路径
+     */
+    @ApiModelProperty(value = "接口路径")
+    @TableField(value = "interface_url")
+    private String interfaceUrl;
+
+
+    /**
+     * 接口路径
+     */
+    @ApiModelProperty(value = "自定义sql")
+    @TableField(value = "custom_sql")
+    private String customSql;
+
+
+}

+ 59 - 0
src/main/java/com/ydtech/modules/admin/model/InsRoleMenuPermissions.java

@@ -0,0 +1,59 @@
+package com.ydtech.modules.admin.model;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+/**
+ * 角色菜单数据权限
+ */
+@ApiModel
+@Data
+@TableName(value = "ins_role_menu_permissions")
+public class InsRoleMenuPermissions implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+    /**
+     * 编号
+     */
+    @ApiModelProperty(value = "id")
+    @TableId(value = "id")
+    private String id;
+
+    /**
+     * 角色id
+     */
+    @ApiModelProperty(value = "角色id")
+    @TableField(value = "role_id")
+    private String roleId;
+
+    /**
+     * 用户id
+     */
+    @ApiModelProperty(value = "用户id")
+    @TableField(value = "user_id")
+    private String userId;
+
+
+    /**
+     * 创建日期
+     */
+    @ApiModelProperty(value = "创建日期")
+    @TableField(value = "create_time")
+    private LocalDateTime createTime;
+
+
+    /**
+     * 菜单id
+     */
+    @ApiModelProperty(value = "菜单id")
+    @TableField(value = "menu_id")
+    private String menuId;
+
+}

+ 75 - 0
src/main/java/com/ydtech/modules/admin/model/InsRolePermissions.java

@@ -0,0 +1,75 @@
+package com.ydtech.modules.admin.model;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+/**
+ * 角色数据权限
+ */
+@ApiModel
+@Data
+@TableName(value = "ins_role_permissions")
+public class InsRolePermissions implements Serializable {
+    private static final long serialVersionUID = 1L;
+    /**
+     * 编号
+     */
+    @ApiModelProperty(value = "id")
+    @TableId(value = "id")
+    private String id;
+
+    /**
+     * 角色id
+     */
+    @ApiModelProperty(value = "角色id")
+    @TableField(value = "role_id")
+    private String roleId;
+
+    /**
+     * 用户id
+     */
+    @ApiModelProperty(value = "用户id")
+    @TableField(value = "user_id")
+    private String userId;
+
+
+    /**
+     * 规则id
+     */
+    @ApiModelProperty(value = "规则id")
+    @TableField(value = "permissions_id")
+    private String permissionsId;
+
+    /**
+     * 状态
+     */
+    @ApiModelProperty(value = "状态")
+    @TableField(value = "status")
+    private String status;
+
+
+    /**
+     * 创建日期
+     */
+    @ApiModelProperty(value = "创建日期")
+    @TableField(value = "create_time")
+    private LocalDateTime createTime;
+
+
+    /**
+     * 菜单id
+     */
+    @ApiModelProperty(value = "菜单id")
+    @TableField(value = "menu_id")
+    private String menuId;
+
+
+
+}

+ 42 - 0
src/main/java/com/ydtech/modules/admin/model/dto/BusinessAgentExcel.java

@@ -0,0 +1,42 @@
+package com.ydtech.modules.admin.model.dto;
+
+import com.alibaba.excel.annotation.ExcelProperty;
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+@Data
+public class BusinessAgentExcel {
+    @ExcelProperty(value = "姓名", index = 0)
+    private String userName;
+
+    @ExcelProperty(value = "工号", index = 1)
+    private String userId;
+
+    @ExcelProperty(value = "归属机构", index = 2)
+    private String deptName;
+
+    @ExcelProperty(value = "管理人", index = 3)
+    private String leaderName;
+
+    @ExcelProperty(value = "机构来源", index = 4)
+    private String managementSource;
+
+    @ExcelProperty(value = "签单保费", index = 5)
+    private BigDecimal sumPremium;
+
+
+    @ExcelProperty(value = "交强险保费", index = 6)
+    private BigDecimal jqpremium;
+
+
+    @ExcelProperty(value = "车船税", index = 7)
+    private BigDecimal taxamount;
+
+    @ExcelProperty(value = "商业险保费", index = 8)
+    private BigDecimal sypremium;
+
+
+    @ExcelProperty(value = "非车险保费", index = 9)
+    private BigDecimal jypremium;
+}

+ 39 - 0
src/main/java/com/ydtech/modules/admin/model/dto/BusinessCompanyExcel.java

@@ -0,0 +1,39 @@
+package com.ydtech.modules.admin.model.dto;
+
+import com.alibaba.excel.annotation.ExcelProperty;
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+@Data
+public class BusinessCompanyExcel {
+    @ExcelProperty(value = "保险公司", index = 0)
+    private String insuranceCompanyName;
+
+    @ExcelProperty(value = "协议类型", index = 1)
+    private String agreementType;
+
+    @ExcelProperty(value = "合作公司", index = 2)
+    private String partnerCompaniesName;
+
+    @ExcelProperty(value = "对接人", index = 3)
+    private String dockingPerson;
+
+    @ExcelProperty(value = "对接人联系方式", index = 4)
+    private String dockingPhone;
+
+    @ExcelProperty(value = "总保费", index = 5)
+    private String totalPremium;
+
+    @ExcelProperty(value = "出单笔数", index = 6)
+    private BigDecimal qutationInsureCount;
+
+    @ExcelProperty(value = "单均保费", index = 7)
+    private BigDecimal averagePremium;
+
+    @ExcelProperty(value = "人员数量", index = 8)
+    private BigDecimal userNumber;
+
+    @ExcelProperty(value = "人均产能", index = 9)
+    private BigDecimal perCapitaAmount;
+}

+ 66 - 0
src/main/java/com/ydtech/modules/admin/model/dto/DataPermissionsDto.java

@@ -0,0 +1,66 @@
+package com.ydtech.modules.admin.model.dto;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+/**
+ * 数据权限实体
+ */
+@Data
+@ApiModel("数据权限实体")
+public class DataPermissionsDto implements Serializable {
+
+
+    @ApiModelProperty(value = "id")
+    private String id;
+
+    @ApiModelProperty(value = "用户ID")
+    private String userId;
+
+    @ApiModelProperty(value = "部门ID")
+    private String deptId;
+
+    @ApiModelProperty(value = "规则名称")
+    private String ruleName;
+
+    @ApiModelProperty(value = "规则字段")
+    private String ruleField;
+
+    @ApiModelProperty(value = "条件规则")
+    private String ruleCondition;
+
+    @ApiModelProperty(value = "规则值")
+    private String ruleValue;
+
+    @ApiModelProperty(value = "状态")
+    private String status;
+
+    @ApiModelProperty(value = "创建日期")
+    private LocalDateTime createTime;
+
+    /**
+     * 菜单id
+     */
+    @ApiModelProperty(value = "菜单id")
+    private String menuId;
+
+    /**
+     * 接口路径
+     */
+    @ApiModelProperty(value = "接口路径")
+    private String interfaceUrl;
+
+    /**
+     * 接口路径
+     */
+    @ApiModelProperty(value = "自定义sql")
+    private String customSql;
+
+
+
+}

+ 60 - 0
src/main/java/com/ydtech/modules/admin/model/dto/GetChannelExcel.java

@@ -0,0 +1,60 @@
+package com.ydtech.modules.admin.model.dto;
+
+import com.alibaba.excel.annotation.ExcelProperty;
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+@Data
+public class GetChannelExcel {
+
+    @ExcelProperty(value = "姓名", index = 0)
+    private String userName;
+
+    @ExcelProperty(value = "工号", index = 1)
+    private String userId;
+
+    @ExcelProperty(value = "归属机构", index = 2)
+    private String deptName;
+
+    @ExcelProperty(value = "管理人", index = 3)
+    private String leaderName;
+
+    @ExcelProperty(value = "机构来源", index = 4)
+    private String managementSource;
+
+    @ExcelProperty(value = "签单保费", index = 5)
+    private BigDecimal sumPremium;
+
+
+    @ExcelProperty(value = "交强险保费", index = 6)
+    private BigDecimal jqpremium;
+
+
+    @ExcelProperty(value = "车船税", index = 7)
+    private BigDecimal taxamount;
+
+    @ExcelProperty(value = "商业险保费", index = 8)
+    private BigDecimal sypremium;
+
+
+    @ExcelProperty(value = "非车险保费", index = 9)
+    private BigDecimal jypremium;
+
+
+    @ExcelProperty(value = "单交订单数", index = 10)
+    private String riskCodeDj;
+
+    @ExcelProperty(value = "单商订单数", index = 11)
+    private String riskCodeDs;
+
+
+    @ExcelProperty(value = "单三订单数", index = 12)
+    private String riskCodeDsan;
+
+    @ExcelProperty(value = "交三订单数", index = 13)
+    private String riskCodeJs;
+
+    @ExcelProperty(value = "交商订单数", index = 14)
+    private String riskCodeJshang;
+}

+ 56 - 0
src/main/java/com/ydtech/modules/admin/model/dto/InsRoleMenuPermissionsDto.java

@@ -0,0 +1,56 @@
+package com.ydtech.modules.admin.model.dto;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.time.LocalDateTime;
+import java.util.List;
+
+/**
+ * 数据权限角色关联实体
+ */
+@Data
+@ApiModel("数据权限角色菜单关联表")
+public class InsRoleMenuPermissionsDto {
+    /**
+     * 编号
+     */
+    @ApiModelProperty(value = "id")
+    private String id;
+
+    /**
+     * 角色id
+     */
+    @ApiModelProperty(value = "角色id")
+    private String roleId;
+
+    /**
+     * 用户id
+     */
+    @ApiModelProperty(value = "用户id")
+    private String userId;
+
+
+    /**
+     * 创建日期
+     */
+    @ApiModelProperty(value = "创建日期")
+    private LocalDateTime createTime;
+
+
+    /**
+     * 菜单id
+     */
+    @ApiModelProperty(value = "菜单id")
+    private String menuId;
+
+    /**
+     * 菜单id
+     */
+    @ApiModelProperty(value = "菜单idList")
+    private List<String> menuIdList;
+
+}

+ 51 - 0
src/main/java/com/ydtech/modules/admin/model/dto/InsRolePermissionsDto.java

@@ -0,0 +1,51 @@
+package com.ydtech.modules.admin.model.dto;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.time.LocalDateTime;
+import java.util.List;
+
+/**
+ * 数据权限角色关联实体
+ */
+@Data
+@ApiModel("数据权限角色关联实体")
+public class InsRolePermissionsDto {
+
+    @ApiModelProperty(value = "id")
+    private String id;
+
+
+    @ApiModelProperty(value = "角色id")
+    private String roleId;
+
+
+    @ApiModelProperty(value = "用户id")
+    private String userId;
+
+
+    @ApiModelProperty(value = "规则id")
+    private String permissionsId;
+
+
+    @ApiModelProperty(value = "状态")
+    private String status;
+
+
+    @ApiModelProperty(value = "创建日期")
+    private LocalDateTime createTime;
+
+
+    @ApiModelProperty(value = "菜单id")
+    private String menuId;
+
+
+    @ApiModelProperty(value = "规则idList")
+    private List<String> permissionsIdList;
+
+
+}

+ 53 - 0
src/main/java/com/ydtech/modules/admin/model/vo/DataPermissionsVo.java

@@ -0,0 +1,53 @@
+package com.ydtech.modules.admin.model.vo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.validation.constraints.Min;
+import java.util.List;
+
+@Data
+public class DataPermissionsVo {
+    @ApiModelProperty(value = "id")
+    private String id;
+
+    @ApiModelProperty(value = "用户ID")
+    private String userId;
+
+    @ApiModelProperty(value = "部门ID")
+    private String deptId;
+
+    @ApiModelProperty(value = "规则名称")
+    private String ruleName;
+
+    @ApiModelProperty(value = "规则字段")
+    private String ruleField;
+
+    @ApiModelProperty(value = "条件规则")
+    private String ruleCondition;
+
+    @ApiModelProperty(value = "规则值")
+    private String ruleValue;
+
+    @ApiModelProperty(value = "状态")
+    private String status;
+
+    @ApiModelProperty(value = "创建日期")
+    private String createTime;
+    @ApiModelProperty(value = "每页页数")
+    private int pageSize;
+
+    @ApiModelProperty(value = "页数")
+    @Min(value = 1, message = "页数最小为1")
+    private int pageNum;
+
+    @ApiModelProperty(value = "菜单id")
+    private String menuId;
+
+    @ApiModelProperty(value = "permissionsIdList")
+    private List<String> permissionsList;
+
+
+
+}

+ 9 - 0
src/main/java/com/ydtech/modules/admin/model/vo/PersonAreaVo.java

@@ -1,11 +1,14 @@
 package com.ydtech.modules.admin.model.vo;
 
+import com.ydtech.modules.ins.model.vo.CustomerInfoVo;
 import lombok.Data;
+import lombok.NoArgsConstructor;
 
 import java.io.Serializable;
 
 
 @Data
+@NoArgsConstructor
 public class PersonAreaVo implements Serializable {
 
     private static final long serialVersionUID = -8235445978142897003L;
@@ -24,4 +27,10 @@ public class PersonAreaVo implements Serializable {
     private String countyName;
 
 
+
+    public PersonAreaVo(CustomerInfoVo customerInfoVo) {
+        this.provinceCode = customerInfoVo.getProvince();
+        this.cityCode = customerInfoVo.getCity();
+        this.countyCode = customerInfoVo.getCounty();
+    }
 }

+ 4 - 0
src/main/java/com/ydtech/modules/admin/model/vo/SysPremiumDetailsVo.java

@@ -69,6 +69,10 @@ public class SysPremiumDetailsVo {
     @ApiModelProperty(value = "贡献合伙人名称")
     private String profferName;
 
+    @ApiModelProperty(value = "贡献人名称")
+    private String workName;
+
+
     /**
      * 存放贡献费用每集合伙人的等级和比例
      */

+ 3 - 0
src/main/java/com/ydtech/modules/admin/model/vo/TaskStatisticsVo.java

@@ -163,4 +163,7 @@ public class TaskStatisticsVo implements Serializable {
 
     @ApiModelProperty(value = "筛选录单开始时间")
     private String enterTimeEnd;
+
+    @ApiModelProperty(value = "时间类型")
+    private String timeType;
 }

+ 38 - 0
src/main/java/com/ydtech/modules/admin/service/DataPermissionsService.java

@@ -0,0 +1,38 @@
+package com.ydtech.modules.admin.service;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.ydtech.extension.BaseIService;
+import com.ydtech.modules.admin.model.DataPermissions;
+import com.ydtech.modules.admin.model.dto.DataPermissionsDto;
+import com.ydtech.modules.admin.model.vo.DataPermissionsVo;
+
+import java.util.List;
+
+public interface DataPermissionsService  extends BaseIService<DataPermissions> {
+    /**
+     * @param dataPermissionsDto
+     * @return 新增数据权限
+     */
+    void saveAndUpdate(DataPermissionsDto dataPermissionsDto);
+
+    /**
+     * @description: 分页查询
+     * @author: whp
+     **/
+    IPage<DataPermissions> queryPage(DataPermissionsVo dataPermissionsVo);
+
+    /**
+     *
+     * @param id
+     * @return  回显
+     */
+    DataPermissions getSelectById(String id);
+
+    /**
+     *
+     * @param dataPermissionsVo
+     * @return  菜单数据权限查询
+     */
+    List<DataPermissions> queryList(DataPermissionsVo dataPermissionsVo);
+
+}

+ 20 - 0
src/main/java/com/ydtech/modules/admin/service/InsRoleMenuPermissionsService.java

@@ -0,0 +1,20 @@
+package com.ydtech.modules.admin.service;
+
+import com.ydtech.modules.admin.model.InsRoleMenuPermissions;
+import com.ydtech.modules.admin.model.dto.InsRoleMenuPermissionsDto;
+
+import java.util.List;
+
+public interface InsRoleMenuPermissionsService {
+    void saveAndUpdateRuleMenu(InsRoleMenuPermissionsDto insRoleMenuPermissionsDto);
+
+    List<InsRoleMenuPermissions> getInsRoleMenuPermissions(InsRoleMenuPermissionsDto insRoleMenuPermissionsDto);
+
+    /**
+     *
+     * @param insRoleMenuPermissionsDto
+     * @return  查询角色菜单
+     */
+    List<InsRoleMenuPermissionsDto> getRoleMenuPermissionsList(InsRoleMenuPermissionsDto insRoleMenuPermissionsDto);
+
+}

+ 40 - 0
src/main/java/com/ydtech/modules/admin/service/InsRolePermissionsService.java

@@ -0,0 +1,40 @@
+package com.ydtech.modules.admin.service;
+
+import com.ydtech.extension.BaseIService;
+import com.ydtech.modules.admin.model.InsRoleMenuPermissions;
+import com.ydtech.modules.admin.model.InsRolePermissions;
+import com.ydtech.modules.admin.model.dto.InsRoleMenuPermissionsDto;
+import com.ydtech.modules.admin.model.dto.InsRolePermissionsDto;
+
+import java.util.List;
+
+public interface InsRolePermissionsService extends BaseIService<InsRolePermissions> {
+
+    void insertAndUpdate(InsRolePermissionsDto insRolePermissionsDto);
+
+    /**
+     * 权限角色关联表
+     * @param insRoleMenuPermissionsDto
+     */
+    void saveAndUpdateRuleMenu(InsRoleMenuPermissionsDto insRoleMenuPermissionsDto);
+
+    /**
+     *
+     * @param insRoleMenuPermissionsDto
+     * @return  获取数据权限菜单列表
+     */
+    List<InsRoleMenuPermissions> getInsRoleMenuPermissions(InsRoleMenuPermissionsDto insRoleMenuPermissionsDto);
+    /**
+     * @param
+     * @return 获取菜单数据权限
+     */
+    List<InsRolePermissions> getInsRolePermissionsDtoList(InsRolePermissionsDto insRolePermissionsDto);
+
+    /**
+     *
+     * @param insRolePermissionsDto
+     * @return  通过角色 菜单id  获取 权限规则
+     */
+    List<InsRolePermissions> getInsRolePermissionsServiceList(InsRolePermissionsDto insRolePermissionsDto);
+
+}

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

@@ -105,5 +105,9 @@ public interface SysSwitchConfigService extends BaseIService<SysSwitchConfig> {
      */
     boolean getBalanceExtractStatus();
 
-
+    /**
+     * app未开发完功能隐藏
+     * @return
+     */
+    boolean appUndeveloped();
 }

+ 2 - 0
src/main/java/com/ydtech/modules/admin/service/SysUserService.java

@@ -343,6 +343,8 @@ public interface SysUserService extends BaseIService<SysUser> {
      */
     SysUser getByRoleIdAndDeptId(String roleId, String deptId);
 
+    List<SysUser> findNextTreeContain(String managementSource);
+
 }
 
 

+ 29 - 0
src/main/java/com/ydtech/modules/admin/service/TaskStatisticsService.java

@@ -159,4 +159,33 @@ public interface TaskStatisticsService {
      **/
     BusinessOrderData getBusinessOrderDataTotal(TaskStatisticsVo taskStatisticsVo);
 
+    IPage<BusinessAgentData> getBusinessElectricData(TaskStatisticsVo taskStatisticsVo);
+
+
+    /**
+     *  任控制台-业务数据-电销-合计
+     * @param taskStatisticsVo
+     * @return
+     */
+    BusinessAgentData getBusinessElectricDataTotal(TaskStatisticsVo taskStatisticsVo);
+
+    /**
+     * @description:   控制台 - 业务数据 -保险公司导出
+     * @author: whp
+     * @date: 2024/12/13
+     **/
+    HttpResult getBusinessDataExcel(TaskStatisticsVo taskStatisticsVo);
+    /**
+     * @description:   控制台 - 业务数据 -代理人导出
+     * @author: whp
+     * @date: 2024/12/13
+     **/
+    HttpResult getBusinessAgentExcel(TaskStatisticsVo taskStatisticsVo);
+    /**
+     * @description:   控制台 - 业务数据 -渠道导出
+     * @author: whp
+     * @date: 2024/12/13
+     **/
+    HttpResult getChannelExcel(TaskStatisticsVo taskStatisticsVo);
+
 }

+ 69 - 0
src/main/java/com/ydtech/modules/admin/service/impl/DataPermissionsServiceImpl.java

@@ -0,0 +1,69 @@
+package com.ydtech.modules.admin.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ydtech.modules.admin.dao.DataPermissionsMapper;
+import com.ydtech.modules.admin.model.DataPermissions;
+import com.ydtech.modules.admin.model.dto.DataPermissionsDto;
+import com.ydtech.modules.admin.model.vo.DataPermissionsVo;
+import com.ydtech.modules.admin.service.DataPermissionsService;
+import com.ydtech.modules.base.controller.BaseController;
+import com.ydtech.modules.base.model.vo.PageVo;
+import com.ydtech.modules.fnc.entity.ContractEntity;
+import com.ydtech.modules.fnc.vo.ContractVo;
+import com.ydtech.utils.StringUtils;
+import org.springframework.beans.BeanUtils;
+import org.springframework.stereotype.Service;
+
+import java.time.LocalDateTime;
+import java.util.List;
+
+@Service
+public class DataPermissionsServiceImpl   extends ServiceImpl<DataPermissionsMapper, DataPermissions>  implements DataPermissionsService {
+    /**
+     * 新增或修改数据权限
+     * @param dataPermissionsDto
+     */
+    @Override
+    public void saveAndUpdate(DataPermissionsDto dataPermissionsDto) {
+        String id = dataPermissionsDto.getId();
+        if(StringUtils.isEmpty(id)){
+            DataPermissions dataPermissions = new DataPermissions();
+            BeanUtils.copyProperties(dataPermissionsDto, dataPermissions);
+            dataPermissions.setUserId(BaseController.getUserId());
+            dataPermissions.setDeptId(BaseController.getDeptId());
+            dataPermissions.setCreateTime(LocalDateTime.now());
+            baseMapper.insert(dataPermissions);
+        }else {
+            DataPermissions dataPermissions = new DataPermissions();
+            BeanUtils.copyProperties(dataPermissionsDto,dataPermissions);
+            baseMapper.updateById(dataPermissions);
+        }
+    }
+
+    @Override
+    public IPage<DataPermissions> queryPage(DataPermissionsVo dataPermissionsVo) {
+        PageVo<DataPermissionsVo> pageVo = new PageVo<>();
+        Page page = new Page(dataPermissionsVo.getPageNum(), dataPermissionsVo.getPageSize());
+        pageVo.setPageNum(dataPermissionsVo.getPageNum());
+        pageVo.setPageSize(dataPermissionsVo.getPageSize());
+        IPage<DataPermissions> queriedPage = baseMapper.queryPage(page, dataPermissionsVo);
+        return queriedPage;
+    }
+
+    @Override
+    public DataPermissions getSelectById(String id) {
+        return baseMapper.selectById(id);
+    }
+    /**
+     *
+     * @param dataPermissionsVo
+     * @return  菜单数据权限查询
+     */
+    @Override
+    public List<DataPermissions> queryList(DataPermissionsVo dataPermissionsVo) {
+        return baseMapper.queryList(dataPermissionsVo);
+    }
+}

+ 62 - 0
src/main/java/com/ydtech/modules/admin/service/impl/InsRoleMenuPermissionsServiceImpl.java

@@ -0,0 +1,62 @@
+package com.ydtech.modules.admin.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ydtech.exception.SystemException;
+import com.ydtech.modules.admin.dao.InsRoleMenuPermissionsMapper;
+import com.ydtech.modules.admin.model.InsRoleMenuPermissions;
+import com.ydtech.modules.admin.model.dto.InsRoleMenuPermissionsDto;
+import com.ydtech.modules.admin.service.InsRoleMenuPermissionsService;
+import com.ydtech.modules.base.controller.BaseController;
+import com.ydtech.utils.StringUtils;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.time.LocalDateTime;
+import java.util.ArrayList;
+import java.util.List;
+
+@Service
+@Transactional
+public class InsRoleMenuPermissionsServiceImpl  extends ServiceImpl<InsRoleMenuPermissionsMapper, InsRoleMenuPermissions> implements InsRoleMenuPermissionsService {
+    @Override
+    public void saveAndUpdateRuleMenu(InsRoleMenuPermissionsDto insRoleMenuPermissionsDto) {
+        String roleId = insRoleMenuPermissionsDto.getRoleId();
+        ArrayList<InsRoleMenuPermissions> insertList = new ArrayList<>();
+        List<String> menuIdList = insRoleMenuPermissionsDto.getMenuIdList();
+        if(StringUtils.isEmpty(roleId)){
+            throw new SystemException("角色id不能为null");
+        }
+        //通过角色id查询
+        QueryWrapper<InsRoleMenuPermissions> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("role_id",roleId);
+        List<InsRoleMenuPermissions> insRoleMenuPermissions = baseMapper.selectList(queryWrapper);
+        if(!insRoleMenuPermissions.isEmpty()){
+            baseMapper.deleteBatchIds(insRoleMenuPermissions);
+        }
+
+        for (String s : menuIdList) {
+            InsRoleMenuPermissions insRoleMenuPermissions1 = new InsRoleMenuPermissions();
+            insRoleMenuPermissions1.setMenuId(s);
+            insRoleMenuPermissions1.setRoleId(roleId);
+            insRoleMenuPermissions1.setUserId(BaseController.getUserId());
+            insRoleMenuPermissions1.setCreateTime(LocalDateTime.now());
+            insertList.add(insRoleMenuPermissions1);
+        }
+        this.saveBatch(insertList);
+
+
+    }
+
+    @Override
+    public List<InsRoleMenuPermissions> getInsRoleMenuPermissions(InsRoleMenuPermissionsDto insRoleMenuPermissionsDto) {
+        QueryWrapper<InsRoleMenuPermissions> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("role_id",insRoleMenuPermissionsDto.getRoleId());
+        return baseMapper.selectList(queryWrapper);
+    }
+
+    @Override
+    public List<InsRoleMenuPermissionsDto> getRoleMenuPermissionsList(InsRoleMenuPermissionsDto insRoleMenuPermissionsDto) {
+        return baseMapper.getRoleMenuPermissionsList(insRoleMenuPermissionsDto);
+    }
+}

+ 99 - 0
src/main/java/com/ydtech/modules/admin/service/impl/InsRolePermissionsServiceImpl.java

@@ -0,0 +1,99 @@
+package com.ydtech.modules.admin.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ydtech.modules.admin.dao.InsRolePermissionsMapper;
+import com.ydtech.modules.admin.model.InsRoleMenuPermissions;
+import com.ydtech.modules.admin.model.InsRolePermissions;
+import com.ydtech.modules.admin.model.dto.InsRoleMenuPermissionsDto;
+import com.ydtech.modules.admin.model.dto.InsRolePermissionsDto;
+import com.ydtech.modules.admin.service.InsRoleMenuPermissionsService;
+import com.ydtech.modules.admin.service.InsRolePermissionsService;
+import com.ydtech.modules.base.controller.BaseController;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.time.LocalDateTime;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+
+@Service
+public class InsRolePermissionsServiceImpl extends ServiceImpl<InsRolePermissionsMapper, InsRolePermissions> implements InsRolePermissionsService {
+    @Autowired
+    private InsRoleMenuPermissionsService insRoleMenuPermissionsService;
+    /**
+     * 新增角色关联权限
+     *
+     * @param insRolePermissionsDto
+     */
+    @Override
+    @Transactional
+    public void insertAndUpdate(InsRolePermissionsDto insRolePermissionsDto) {
+        ArrayList<InsRolePermissions> insRolePermissionsArrayList = new ArrayList<>();
+        //先查看是否存在已配置该权限
+        QueryWrapper<InsRolePermissions> queryWrapper = new QueryWrapper<>();
+
+        queryWrapper.eq("role_id", insRolePermissionsDto.getRoleId())
+                .eq("menu_id", insRolePermissionsDto.getMenuId());
+
+        List<InsRolePermissions> insRolePermissions = baseMapper.selectList(queryWrapper);
+        List<String> ids = insRolePermissions.stream().map(InsRolePermissions::getId).collect(Collectors.toList());
+
+        //删除已配置的权限
+        if(!ids.isEmpty()){
+            baseMapper.deleteBatchIds(ids);
+        }
+
+        List<String> permissionsIdList = insRolePermissionsDto.getPermissionsIdList();
+        for (String s : permissionsIdList) {
+            InsRolePermissions insRolePermissions1 = new InsRolePermissions();
+            String userId = BaseController.getUserId();
+            insRolePermissions1.setUserId(userId);
+            insRolePermissions1.setRoleId(insRolePermissionsDto.getRoleId());
+            insRolePermissions1.setMenuId(insRolePermissionsDto.getMenuId());
+            insRolePermissions1.setPermissionsId(s);
+            insRolePermissions1.setCreateTime(LocalDateTime.now());
+            insRolePermissionsArrayList.add(insRolePermissions1);
+        }
+        this.saveBatch(insRolePermissionsArrayList);
+    }
+
+    @Override
+    @Transactional
+    public void saveAndUpdateRuleMenu(InsRoleMenuPermissionsDto insRoleMenuPermissionsDto) {
+        insRoleMenuPermissionsService.saveAndUpdateRuleMenu(insRoleMenuPermissionsDto);
+
+    }
+
+    /**
+     * @param
+     * @return 获取数据权限菜单列表
+     */
+    @Override
+    public List<InsRoleMenuPermissions> getInsRoleMenuPermissions(InsRoleMenuPermissionsDto insRoleMenuPermissionsDto) {
+
+        return insRoleMenuPermissionsService.getInsRoleMenuPermissions(insRoleMenuPermissionsDto);
+    }
+    /**
+     * @param
+     * @return 获取菜单数据权限
+     */
+    @Override
+    public List<InsRolePermissions> getInsRolePermissionsDtoList(InsRolePermissionsDto insRolePermissionsDto) {
+        QueryWrapper<InsRolePermissions> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("menu_id",insRolePermissionsDto.getMenuId())
+                .eq("role_id",insRolePermissionsDto.getRoleId());
+        return  baseMapper.selectList(queryWrapper);
+    }
+    /**
+     *
+     * @param insRolePermissionsDto
+     * @return  通过角色 菜单id  获取 权限规则
+     */
+    @Override
+    public List<InsRolePermissions> getInsRolePermissionsServiceList(InsRolePermissionsDto insRolePermissionsDto) {
+        return baseMapper.getInsRolePermissionsServiceList(insRolePermissionsDto);
+    }
+}

+ 5 - 2
src/main/java/com/ydtech/modules/admin/service/impl/SysPartnerServiceImpl.java

@@ -1448,6 +1448,9 @@ public class SysPartnerServiceImpl extends ServiceImpl<SysPartnerMapper, SysPart
                 sysPremiumDetailsVo.setProfferLevel(sysPartner.getType());
                 SysUser sysUser = sysUserMapper.selectById(sysPartner.getUserId());
                 sysPremiumDetailsVo.setProfferName(sysUser.getName());
+                //直接工作室产生费用,显示工作室名称
+                SysDept sysDept1 = sysDeptMapper.selectById(sysAgencyLeader.getDeptId());
+                sysPremiumDetailsVo.setWorkName(sysDept1.getName());
             }
             sysPremiumDetailsVo.setSumpremium(sysPremiumDetails1.getSumpremium());
             SysUser sysUser = sysUserMapper.selectById(sysPremiumDetails1.getIssuerId());
@@ -1471,7 +1474,7 @@ public class SysPartnerServiceImpl extends ServiceImpl<SysPartnerMapper, SysPart
 
             list.add(sysPremiumDetailsVo);
         }
-
+        list =list.stream().sorted(Comparator.comparing(SysPremiumDetailsVo::getCreateTime).reversed()).collect(Collectors.toList());
 //        long l = (list.size()+pageNum-1)/commissionInfoDto.getPageSize();
         return new BasePageResult<>(pageNum, commissionInfoDto.getPageSize(), stringObjectList.getTotal(), page.getPages(),
                 list);
@@ -1866,7 +1869,7 @@ public class SysPartnerServiceImpl extends ServiceImpl<SysPartnerMapper, SysPart
     @Override
     public List<SysPartnerVo> getRelationInfo(String userId) {
         List<SysPartnerVo> sysPartners = new ArrayList<>();
-        //登陆人的上级合伙人信息
+        //登陆人的上级合伙人信息
         SysPartner sysPartner = sysPartnerMapper.selectOne(new LambdaQueryWrapper<SysPartner>()
                 .eq(SysPartner::getUserId, userId).eq(SysPartner::getDelFlag, 1));
         SysPartnerVo sysPartnerVo = BeanUtil.copyProperties(sysPartner, SysPartnerVo.class);

+ 6 - 0
src/main/java/com/ydtech/modules/admin/service/impl/SysSwitchConfigServiceImpl.java

@@ -197,6 +197,12 @@ public class SysSwitchConfigServiceImpl extends ServiceImpl<SysSwitchConfigMappe
         }
         return false;
     }
+
+    @Override
+    public boolean appUndeveloped() {
+        return isEnabled(SwitchConfig.APP_UNDEVELOPED.getCode());
+    }
+
 }
 
 

+ 87 - 0
src/main/java/com/ydtech/modules/admin/service/impl/SysUserServiceImpl.java

@@ -2795,4 +2795,91 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
     public SysUser getByRoleIdAndDeptId(String roleId, String deptId) {
         return baseMapper.getByRoleIdAndDeptId(roleId, deptId);
     }
+
+    /**
+     *
+     * @param managementSource
+     * @return  该人员下 的子集如果是电销 或者 代理人 或者 渠道则 显示
+     */
+    @Override
+    public List<SysUser> findNextTreeContain(String managementSource) {
+
+        String userId = BaseController.getUserId();
+        SysUser sysUser = sysUserMapper.getByUserId(userId);
+
+        //获取领导字段不为空的人的ID
+        QueryWrapper<SysUser> queryWrapper = new QueryWrapper<>();
+        queryWrapper.isNotNull("leader_id");
+
+        HashMap<String, Object> params = new HashMap<>();
+        params.put("managementSource",managementSource);
+        List<SysUser> users = sysUserMapper.selectByParams(params);
+
+        for (SysUser user : users) {
+            this.appendName(user);
+        }
+        if (users == null || users.isEmpty()) {
+            return new ArrayList<>();
+        }
+        List<SysUser> topUsers = new ArrayList<>(); //存放1级用户,即没有直接上级的用户
+        // 根据组织结构展示级别,筛选顶层节点并构建组织结构树
+        if("admin".equals(sysUser.getName())){
+            topUsers.add(sysUserMapper.selectById("99D1501"));
+        }else {
+            this.appendName(sysUser);
+            topUsers.add(sysUser);
+        }
+        // 递归构建用户树结构
+        buildUserTreeContain(topUsers, users,managementSource);
+        return topUsers;
+
+    }
+
+    /**
+     * 拼接机构来源
+     * @param users
+     */
+    private void appendName(SysUser user) {
+        StringBuilder stringBuilder = new StringBuilder();
+        String deptId = user.getDeptId();
+        if (StringUtils.isNotEmpty(deptId)) {
+            int length = deptId.length();
+            if (length > 0) {
+                if (length <= 5) {
+                    String dept = deptId.replaceAll("[^\\d]*(\\d+).*", "$1");
+                    SysDept cityName = sysDeptMapper.selectById(dept);
+                    String name = cityName.getName();
+                    stringBuilder.append("(").append(name).append(")");
+                } else if (length > 5) {
+                    String dept = deptId.replaceAll("[^\\d]*(\\d+).*", "$1");
+                    if (dept.length() < 5) {
+                        SysDept dept1 = sysDeptMapper.selectById(dept);
+                        SysDept cityName = sysDeptMapper.selectById(deptId);
+                        stringBuilder.append("(").append(dept1.getName()).append(cityName.getName()).append(")");
+                    } else {
+                        String deptIdTwo = dept.substring(0, 4);
+
+                        SysDept dept1 = sysDeptMapper.selectById(deptIdTwo);
+                        SysDept dept2 = sysDeptMapper.selectById(dept);
+                        stringBuilder.append("(").append(dept1.getName()).append(dept2.getName()).append(")");
+                    }
+                }
+                user.setName(user.getName()+stringBuilder.toString());
+            }
+        }
+    }
+    private void buildUserTreeContain(List<SysUser> topUsers, List<SysUser> users, String managementSource) {
+        for (SysUser user : topUsers) {
+            List<SysUser> children = new ArrayList<>();
+            for (SysUser childUser : users) {
+                if (user.getId().equals(childUser.getLeaderId())) {
+                    children.add(childUser);
+                    // 递归查找下一级
+                    buildUserTreeContain(children, users,managementSource);
+                }
+            }
+            user.setChildren(children);
+        }
+    }
+
 }

+ 267 - 17
src/main/java/com/ydtech/modules/admin/service/impl/TaskStatisticsServiceImpl.java

@@ -1,5 +1,6 @@
 package com.ydtech.modules.admin.service.impl;
 
+import cn.hutool.core.bean.BeanUtil;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -19,6 +20,7 @@ import com.ydtech.modules.admin.model.SysUser;
 import com.ydtech.modules.admin.model.dto.*;
 import com.ydtech.modules.admin.model.vo.BusinessAgentData;
 import com.ydtech.modules.admin.model.vo.BusinessOrderData;
+import com.ydtech.modules.admin.model.vo.SysUserPartner;
 import com.ydtech.modules.admin.model.vo.TaskStatisticsVo;
 import com.ydtech.modules.admin.service.SysDeptService;
 import com.ydtech.modules.admin.service.TaskStatisticsService;
@@ -30,9 +32,11 @@ import com.ydtech.modules.order.dao.InsAreaCompanyMapper;
 import com.ydtech.modules.order.dao.InsOrdersMapper;
 import org.apache.commons.lang3.ObjectUtils;
 import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
+import org.springframework.util.CollectionUtils;
 
 import java.io.File;
 import java.io.IOException;
@@ -669,8 +673,8 @@ public class TaskStatisticsServiceImpl  implements TaskStatisticsService {
      **/
     @Override
     public IPage<BusinessAgentData> getBusinessAgentData(TaskStatisticsVo taskStatisticsVo) {
-        if(StringUtils.isNotEmpty(taskStatisticsVo.getTreeType()) || "3".equals(taskStatisticsVo.getManagementSource())){
-            if((StringUtils.isNotEmpty(taskStatisticsVo.getTreeUserId()) && "2".equals(taskStatisticsVo.getTreeType())) ||"3".equals(taskStatisticsVo.getManagementSource()) ){
+        if(StringUtils.isNotEmpty(taskStatisticsVo.getTreeType()) ){
+            if((StringUtils.isNotEmpty(taskStatisticsVo.getTreeUserId()) && "2".equals(taskStatisticsVo.getTreeType()))){
                 List<String> userIds=this.getNextLevel(taskStatisticsVo.getTreeUserId());
                 if(!userIds.isEmpty() && userIds.get(0)!=null){
                     taskStatisticsVo.setUserIds(userIds);
@@ -689,6 +693,9 @@ public class TaskStatisticsServiceImpl  implements TaskStatisticsService {
         pageVo.setPageNum(taskStatisticsVo.getPageNum());
         pageVo.setPageSize(taskStatisticsVo.getPageSize());
 
+        if(StringUtils.isNotEmpty(taskStatisticsVo.getTreeType()) &&  (StringUtils.isEmpty(taskStatisticsVo.getTreeUserId()) &&  StringUtils.isEmpty(taskStatisticsVo.getDeptId()) ) ){
+            return new Page<>(taskStatisticsVo.getPageNum(), taskStatisticsVo.getPageNum());
+        }
 
         HashMap<String, String> dateMapByType = getDateMapByTypeNew(taskStatisticsVo.getDateType(), taskStatisticsVo.getCreatetimeStart(), taskStatisticsVo.getCreatetimeEnd());
         taskStatisticsVo.setCreatetimeStart(dateMapByType.get("startDate"));
@@ -848,7 +855,7 @@ public class TaskStatisticsServiceImpl  implements TaskStatisticsService {
 
 
         if(StringUtils.isNotEmpty(taskStatisticsVo.getTreeType()) || "3".equals(taskStatisticsVo.getManagementSource())){
-            if((StringUtils.isNotEmpty(taskStatisticsVo.getTreeUserId()) && "2".equals(taskStatisticsVo.getTreeType())) ||"3".equals(taskStatisticsVo.getManagementSource()) ){
+            if((StringUtils.isNotEmpty(taskStatisticsVo.getTreeUserId()) && "2".equals(taskStatisticsVo.getTreeType()))){
                 List<String> userIds=this.getNextLevel(taskStatisticsVo.getTreeUserId());
                 if(!userIds.isEmpty() && userIds.get(0)!=null){
                          taskStatisticsVo.setUserIds(userIds);
@@ -861,6 +868,9 @@ public class TaskStatisticsServiceImpl  implements TaskStatisticsService {
                 taskStatisticsVo.setUserIds(new ArrayList<>());
             }
         }
+        if (StringUtils.isNotEmpty(taskStatisticsVo.getTreeType()) && (StringUtils.isEmpty(taskStatisticsVo.getTreeUserId()) && StringUtils.isEmpty(taskStatisticsVo.getDeptId()))) {
+            return new BusinessAgentData();
+        }
 
         String deptId = BaseController.getDeptId();
         BusinessAgentData result = this.taskStatisticsMapper.getBusinessAgentDataTotalAdd(taskStatisticsVo);
@@ -882,7 +892,7 @@ public class TaskStatisticsServiceImpl  implements TaskStatisticsService {
         BigDecimal subtract = entranceAllFee.subtract(exportAllFee);
         result.setDistributionAmount(subtract); //毛利润
         if(subtract.compareTo(BigDecimal.ZERO)>0){
-            BigDecimal resultDivided = subtract.divide(sumPremium, 2, RoundingMode.HALF_UP); //人均产能
+            BigDecimal resultDivided = subtract.divide(sumPremium, 4, RoundingMode.HALF_UP); //人均产能
             result.setDistributionAmountRate(resultDivided);
         }else {
             result.setDistributionAmountRate(BigDecimal.ZERO);
@@ -1129,6 +1139,239 @@ public class TaskStatisticsServiceImpl  implements TaskStatisticsService {
         return result;
     }
 
+    /**
+     * 任控制台-业务数据-渠道"
+     * @param taskStatisticsVo
+     * @return
+     */
+    @Override
+    public IPage<BusinessAgentData> getBusinessElectricData(TaskStatisticsVo taskStatisticsVo) {
+        PageVo<TaskStatisticsVo> pageVo = new PageVo<>();
+        Page page = new Page(taskStatisticsVo.getPageNum(), taskStatisticsVo.getPageSize());
+        page.setSearchCount(false).setOptimizeCountSql(false);//关闭count查询
+        pageVo.setPageNum(taskStatisticsVo.getPageNum());
+        pageVo.setPageSize(taskStatisticsVo.getPageSize());
+        if(StringUtils.isNotEmpty(taskStatisticsVo.getTreeUserId())){
+            List<String> userIds=this.getNextLevel(taskStatisticsVo.getTreeUserId());
+            taskStatisticsVo.setUserIds(userIds);
+        }
+
+        if(StringUtils.isNotEmpty(taskStatisticsVo.getTreeType()) &&  (StringUtils.isEmpty(taskStatisticsVo.getTreeUserId()) &&  StringUtils.isEmpty(taskStatisticsVo.getDeptId()) ) ){
+            return new Page<>(taskStatisticsVo.getPageNum(), taskStatisticsVo.getPageNum());
+        }
+        HashMap<String, String> dateMapByType = getDateMapByTypeNew(taskStatisticsVo.getDateType(), taskStatisticsVo.getCreatetimeStart(), taskStatisticsVo.getCreatetimeEnd());
+        taskStatisticsVo.setCreatetimeStart(dateMapByType.get("startDate"));
+        taskStatisticsVo.setCreatetimeEnd(dateMapByType.get("endDate"));
+        getDateByType(taskStatisticsVo.getDateType(), taskStatisticsVo);
+
+        IPage<BusinessAgentData> list = this.taskStatisticsMapper.getBusinessAgentData(page,taskStatisticsVo);
+        List<BusinessAgentData> records = list.getRecords();
+        for (BusinessAgentData record : records) {
+            this.appendName(record);
+            if (record.getDistributionAmountRate() == null) {
+                record.setDistributionAmountRate(new BigDecimal("0.0000"));
+            }
+        }
+        Long  total = this.taskStatisticsMapper.getBusinessAgentDataTotal(taskStatisticsVo);
+        list.setTotal(total);
+        return list;
+    }
+
+    /**
+     * 任控制台-业务数据-电销-合计
+     * @param taskStatisticsVo
+     * @return
+     */
+    @Override
+    public BusinessAgentData getBusinessElectricDataTotal(TaskStatisticsVo taskStatisticsVo) {
+
+        if(StringUtils.isNotEmpty(taskStatisticsVo.getTreeUserId())){
+            List<String> userIds=this.getNextLevel(taskStatisticsVo.getTreeUserId());
+            taskStatisticsVo.setUserIds(userIds);
+        }
+        HashMap<String, String> dateMapByType = getDateMapByTypeNew(taskStatisticsVo.getDateType(), taskStatisticsVo.getCreatetimeStart(), taskStatisticsVo.getCreatetimeEnd());
+        taskStatisticsVo.setCreatetimeStart(dateMapByType.get("startDate"));
+        taskStatisticsVo.setCreatetimeEnd(dateMapByType.get("endDate"));
+        getDateByType(taskStatisticsVo.getDateType(), taskStatisticsVo);
+        if (StringUtils.isNotEmpty(taskStatisticsVo.getTreeType()) && (StringUtils.isEmpty(taskStatisticsVo.getTreeUserId()) && StringUtils.isEmpty(taskStatisticsVo.getDeptId()))) {
+            return new BusinessAgentData();
+        }
+        String deptId = BaseController.getDeptId();
+        BusinessAgentData result = this.taskStatisticsMapper.getBusinessAgentDataTotalAdd(taskStatisticsVo);
+        Long  total = this.taskStatisticsMapper.getBusinessAgentDataTotal(taskStatisticsVo);
+        result.setTotalNumber(total.toString());
+        BigDecimal sumPremium = result.getSumPremium();
+        BusinessAgentData allsumPremium = this.taskStatisticsMapper.getAllsumPremium(taskStatisticsVo);
+        if(ObjectUtils.isNotEmpty(sumPremium)){
+            BigDecimal sumPremium1 = allsumPremium.getSumPremium();
+            if(sumPremium.compareTo(BigDecimal.ZERO) ==1){
+                BigDecimal multiply = sumPremium.divide(sumPremium1, 4, BigDecimal.ROUND_DOWN);
+                result.setSumPremiumProportion(multiply);
+            }
+        }else {
+            result.setSumPremiumProportion(BigDecimal.ZERO);
+        }
+        BigDecimal entranceAllFee = result.getEntranceAllFee() != null ? result.getEntranceAllFee() : BigDecimal.ZERO;
+        BigDecimal exportAllFee = result.getExportAllFee() != null ? result.getExportAllFee() : BigDecimal.ZERO;
+        BigDecimal subtract = entranceAllFee.subtract(exportAllFee);
+        result.setDistributionAmount(subtract); //毛利润
+        if(subtract.compareTo(BigDecimal.ZERO)>0){
+            BigDecimal resultDivided = subtract.divide(sumPremium, 4, RoundingMode.HALF_UP); //人均产能
+            result.setDistributionAmountRate(resultDivided);
+        }else {
+            result.setDistributionAmountRate(BigDecimal.ZERO);
+        }
+        return result;
+    }
+
+    @Override
+    public HttpResult getBusinessDataExcel(TaskStatisticsVo taskStatisticsVo) {
+        if (StringUtils.isNotEmpty(taskStatisticsVo.getDays())) {
+            if ("7".equals(taskStatisticsVo.getDays())) {
+                taskStatisticsVo.setDateType("2");
+            } else if ("30".equals(taskStatisticsVo.getDays())) {
+                taskStatisticsVo.setDateType("3");
+            } else if ("1".equals(taskStatisticsVo.getDays())) {
+                taskStatisticsVo.setDateType("1");
+            }
+        }
+
+        if (com.ydtech.utils.StringUtils.isNotEmpty(taskStatisticsVo.getParterProvinceId())) {
+            String provinceId = this.removeTrailingZeros(taskStatisticsVo.getParterProvinceId());
+            taskStatisticsVo.setParterProvinceId(provinceId);
+        }
+
+        if (com.ydtech.utils.StringUtils.isNotEmpty(taskStatisticsVo.getParterCityId())) {
+            String cityId = this.removeTrailingZeros(taskStatisticsVo.getParterCityId());
+            taskStatisticsVo.setParterCityId(cityId);
+        }
+
+        if (com.ydtech.utils.StringUtils.isNotEmpty(taskStatisticsVo.getParterCountyId())) {
+            String countyId = this.removeTrailingZeros(taskStatisticsVo.getParterCountyId());
+            taskStatisticsVo.setParterCountyId(countyId);
+        }
+
+        HashMap<String, String> dateMapByType = getDateMapByTypeNew(taskStatisticsVo.getDateType(), taskStatisticsVo.getCreatetimeStart(), taskStatisticsVo.getCreatetimeEnd());
+        taskStatisticsVo.setCreatetimeStart(dateMapByType.get("startDate"));
+        taskStatisticsVo.setCreatetimeEnd(dateMapByType.get("endDate"));
+
+        List<TaskStatisticsDto> list = this.insAreaCompanyMapper.getBusinessDataList(taskStatisticsVo);
+        List<BusinessCompanyExcel> sysUserPartners = BeanUtil.copyToList(list, BusinessCompanyExcel.class);
+        String uploadPath = this.uploadPath + "/excel/";
+        Path path = Paths.get(uploadPath);
+        if (!Files.exists(path)) {
+            try {
+                Files.createDirectories(path);
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+        String fileName = EasyExcelUtils.downExcel(uploadPath, "业务数据保险公司导出", BusinessCompanyExcel.class, sysUserPartners);
+        return HttpResult.ok("", uploadUrl + "excel/" + fileName);
+    }
+
+    /**
+     * @description:   控制台 - 业务数据 - 代理人导出
+     * @author: whp
+     * @date: 2024/12/13
+     **/
+    @Override
+    public HttpResult getBusinessAgentExcel(TaskStatisticsVo taskStatisticsVo) {
+        if(StringUtils.isNotEmpty(taskStatisticsVo.getTreeType()) ){
+            if((StringUtils.isNotEmpty(taskStatisticsVo.getTreeUserId()) && "2".equals(taskStatisticsVo.getTreeType()))){
+                List<String> userIds=this.getNextLevel(taskStatisticsVo.getTreeUserId());
+                if(!userIds.isEmpty() && userIds.get(0)!=null){
+                    taskStatisticsVo.setUserIds(userIds);
+                }else {
+                    taskStatisticsVo.setUserId(taskStatisticsVo.getTreeUserId());
+                }
+            }else if (StringUtils.isNotEmpty(taskStatisticsVo.getTreeUserId()) && "1".equals(taskStatisticsVo.getTreeType())){
+                taskStatisticsVo.setDeptId(taskStatisticsVo.getTreeUserId());
+                taskStatisticsVo.setTreeUserId(null);
+                taskStatisticsVo.setUserIds(new ArrayList<>());
+            }
+        }
+
+        HashMap<String, String> dateMapByType = getDateMapByTypeNew(taskStatisticsVo.getDateType(), taskStatisticsVo.getCreatetimeStart(), taskStatisticsVo.getCreatetimeEnd());
+        taskStatisticsVo.setCreatetimeStart(dateMapByType.get("startDate"));
+        taskStatisticsVo.setCreatetimeEnd(dateMapByType.get("endDate"));
+        getDateByType(taskStatisticsVo.getDateType(), taskStatisticsVo);
+        List<BusinessAgentData> list = this.taskStatisticsMapper.getBusinessAgentDataExcel(taskStatisticsVo);
+        for (BusinessAgentData record : list) {
+            this.appendName(record);
+            if (record.getDistributionAmountRate() == null) {
+                record.setDistributionAmountRate(new BigDecimal("0.0000"));
+            }
+            if(record.getManagementSource().equals("2")){
+                record.setManagementSource("代理人");
+            }
+        }
+        List<BusinessAgentExcel> sysUserPartners = BeanUtil.copyToList(list, BusinessAgentExcel.class);
+
+        String uploadPath = this.uploadPath + "/excel/";
+        Path path = Paths.get(uploadPath);
+        if (!Files.exists(path)) {
+            try {
+                Files.createDirectories(path);
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+        String fileName = EasyExcelUtils.downExcel(uploadPath, "业务数据代理人导出", BusinessAgentExcel.class, sysUserPartners);
+        return HttpResult.ok("", uploadUrl + "excel/" + fileName);
+    }
+    /**
+     * @description:   控制台 - 业务数据 -渠道导出
+     * @author: whp
+     * @date: 2024/12/13
+     **/
+    @Override
+    public HttpResult getChannelExcel(TaskStatisticsVo taskStatisticsVo) {
+        if(StringUtils.isNotEmpty(taskStatisticsVo.getTreeType()) ){
+            if((StringUtils.isNotEmpty(taskStatisticsVo.getTreeUserId()) && "2".equals(taskStatisticsVo.getTreeType()))){
+                List<String> userIds=this.getNextLevel(taskStatisticsVo.getTreeUserId());
+                if(!userIds.isEmpty() && userIds.get(0)!=null){
+                    taskStatisticsVo.setUserIds(userIds);
+                }else {
+                    taskStatisticsVo.setUserId(taskStatisticsVo.getTreeUserId());
+                }
+            }else if (StringUtils.isNotEmpty(taskStatisticsVo.getTreeUserId()) && "1".equals(taskStatisticsVo.getTreeType())){
+                taskStatisticsVo.setDeptId(taskStatisticsVo.getTreeUserId());
+                taskStatisticsVo.setTreeUserId(null);
+                taskStatisticsVo.setUserIds(new ArrayList<>());
+            }
+        }
+
+        HashMap<String, String> dateMapByType = getDateMapByTypeNew(taskStatisticsVo.getDateType(), taskStatisticsVo.getCreatetimeStart(), taskStatisticsVo.getCreatetimeEnd());
+        taskStatisticsVo.setCreatetimeStart(dateMapByType.get("startDate"));
+        taskStatisticsVo.setCreatetimeEnd(dateMapByType.get("endDate"));
+        getDateByType(taskStatisticsVo.getDateType(), taskStatisticsVo);
+        List<BusinessAgentData> list = this.taskStatisticsMapper.getBusinessAgentDataExcel(taskStatisticsVo);
+        for (BusinessAgentData record : list) {
+            this.appendName(record);
+            if (record.getDistributionAmountRate() == null) {
+                record.setDistributionAmountRate(new BigDecimal("0.0000"));
+            }
+            if(record.getManagementSource().equals("1")){
+                record.setManagementSource("渠道");
+
+            }
+        }
+        List<GetChannelExcel> sysUserPartners = BeanUtil.copyToList(list, GetChannelExcel.class);
+
+        String uploadPath = this.uploadPath + "/excel/";
+        Path path = Paths.get(uploadPath);
+        if (!Files.exists(path)) {
+            try {
+                Files.createDirectories(path);
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+        String fileName = EasyExcelUtils.downExcel(uploadPath, "业务数据渠道导出", GetChannelExcel.class, sysUserPartners);
+        return HttpResult.ok("", uploadUrl + "excel/" + fileName);
+    }
+
     /**
      *  @version
      *  @author: hh
@@ -1140,20 +1383,27 @@ public class TaskStatisticsServiceImpl  implements TaskStatisticsService {
         String  endDateStr = new String();
         if (StringUtils.isNotEmpty(type)) {
             switch (type) {
-                case "1" : startDateStr= SliceUpDateUtil.getBeforeDay(new Date(),0) + " 00:00:00";
-                           endDateStr=SliceUpDateUtil.getBeforeDay(new Date(),0) + " 23:59:59";
-                           break;
-                case "2" : startDateStr= SliceUpDateUtil.getBeforeDay(new Date(),1) + " 00:00:00";
-                           endDateStr=SliceUpDateUtil.getBeforeDay(new Date(),0) + " 23:59:59";
-                           break;
-                case "3" : startDateStr= SliceUpDateUtil.getBeforeDay(new Date(),6) + " 00:00:00";
-                           endDateStr=SliceUpDateUtil.getBeforeDay(new Date(),0) + " 23:59:59";
-                           break;
+                case "1" :  startDateStr = SliceUpDateUtil.getBeforeDay(new Date(),0) + " 00:00:00";
+                    endDateStr = SliceUpDateUtil.getBeforeDay(new Date(),0) + " 23:59:59";
+                    break;
+                case "2" :  startDateStr = SliceUpDateUtil.getBeforeDay(new Date(),1) + " 00:00:00";
+                    endDateStr = SliceUpDateUtil.getBeforeDay(new Date(),0) + " 23:59:59";
+                    break;
+                case "3" :  startDateStr = SliceUpDateUtil.getBeforeDay(new Date(),6) + " 00:00:00";
+                    endDateStr = SliceUpDateUtil.getBeforeDay(new Date(),0) + " 23:59:59";
+                    break;
+            }
+            if (StringUtils.isNotEmpty(taskStatisticsVo.getTimeType())) {
+                switch (taskStatisticsVo.getTimeType()) {
+                    case "1" :  taskStatisticsVo.setEnterTimeStart(startDateStr);
+                        taskStatisticsVo.setEnterTimeEnd(endDateStr);
+                        break;
+                    case "2" :  taskStatisticsVo.setSigningTimeStart(startDateStr);
+                        taskStatisticsVo.setSigningTimeEnd(endDateStr);
+                        break;
+                }
             }
-            taskStatisticsVo.setSigningTimeStart(startDateStr);
-            taskStatisticsVo.setSigningTimeEnd(endDateStr);
-            taskStatisticsVo.setEnterTimeStart(startDateStr);
-            taskStatisticsVo.setEnterTimeEnd(endDateStr);
         }
     }
+
 }

+ 11 - 1
src/main/java/com/ydtech/modules/admin/service/impl/UserReportServiceImpl.java

@@ -340,6 +340,7 @@ public class UserReportServiceImpl implements UserReportService {
             List<QxFrontlineAgentDto> getQxFrontlineAgentList = sysUserMapper.getQxFrontlineAgentList(qxFrontlineAgentVo);
             if (qxFrontlineAgentVo.getManagementSource().equals("1")) {// 渠道
                 getQxFrontlineAgentList .clear();
+
                 getQxFrontlineAgentList.addAll(userReportMapper.selectChannelPersonOld(qxFrontlineAgentVo));
             } else if (qxFrontlineAgentVo.getManagementSource().equals("2")) {// 代理人
                 this.agentPerson(getQxFrontlineAgentList, qxFrontlineAgentVo);
@@ -399,8 +400,17 @@ public class UserReportServiceImpl implements UserReportService {
 
     @Override
     public HttpResult agentExcel(QxFrontlineAgentVo qxFrontlineAgentVo) {
-//        QxFrontlineAgentExcel
 
+        String leaderId = qxFrontlineAgentVo.getLeaderId();
+        if(StringUtils.isNotEmpty(leaderId)) {
+            //获取领导人下级所有
+            List<String> ids = new ArrayList<>();
+            List<String> userList = this.getUserTreeHx(leaderId, ids);
+            userList.add(leaderId);
+            if (userList.size() > 0) {
+                qxFrontlineAgentVo.setLeaderIds(userList);
+            }
+        }
         HashMap<String, String> map = getDateMapByType(qxFrontlineAgentVo.getDays(), qxFrontlineAgentVo.getCreatetimeStart(), qxFrontlineAgentVo.getCreatetimeEnd());
         qxFrontlineAgentVo.setCreatetimeStart(map.get("startDate"));
         qxFrontlineAgentVo.setCreatetimeEnd(map.get("endDate"));

+ 18 - 0
src/main/java/com/ydtech/modules/admin/utils/DataParams.java

@@ -0,0 +1,18 @@
+package com.ydtech.modules.admin.utils;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.HashMap;
+@Data
+public class DataParams {
+
+    @ApiModelProperty(value = "权限sql")
+    private String stringBufferContent;
+
+
+    @ApiModelProperty(value = "权限Map")
+    private HashMap<String,String> stringBufferContentMap;
+
+
+}

+ 21 - 2
src/main/java/com/ydtech/modules/esm/controller/EsmInsCompanyController.java

@@ -12,7 +12,6 @@ import com.ydtech.core.page.HttpResult;
 import com.ydtech.core.page.PageRequest;
 import com.ydtech.core.page.PageResult;
 import com.ydtech.exception.SystemException;
-import com.ydtech.modules.admin.model.SysDept;
 import com.ydtech.modules.base.controller.BaseController;
 import com.ydtech.modules.esm.model.EsmInsCompany;
 import com.ydtech.modules.esm.model.vo.req.EsmInsCompanyReq;
@@ -21,7 +20,6 @@ import com.ydtech.modules.esm.service.EsmInsCompanyService;
 import com.ydtech.modules.protocol.entity.po.PtlAgreement;
 import com.ydtech.modules.protocol.entity.vo.PtlAgreementPageVo;
 import com.ydtech.modules.protocol.service.PtlAgreementService;
-import com.ydtech.modules.protocol.service.impl.PtlAgreementServiceImpl;
 import com.ydtech.modules.protocol.utils.AssertionUtils;
 import com.ydtech.utils.StringUtils;
 import io.swagger.annotations.Api;
@@ -289,4 +287,25 @@ public class EsmInsCompanyController extends BaseController {
         List<EsmInsCompanyResVo> esmInsCompanyList = esmInsCompanyService.findOrderCompanyList();
         return HttpResult.ok(esmInsCompanyList);
     }
+
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/12/12 14:29
+     *  @Description:  获取外部协议的保险公司的集合
+     */
+    @PostMapping("/getExternalAgreementCompanyList")
+    @ApiOperation("获取外部协议的保险公司的集合")
+    public HttpResult<List<EsmInsCompanyResVo>> getExternalAgreementCompanyList(@RequestSingleParam("name") String name) {
+        List<EsmInsCompanyResVo> lst = esmInsCompanyService.getExternalAgreementCompanyList(name);
+        return HttpResult.ok(lst);
+    }
+
+
+    @ApiOperation(value = "查找存在协议的保险公司列表")
+    @GetMapping(value = "/liveCompanyList")
+    public HttpResult liveCompanyList(){
+        List<EsmInsCompanyResVo> list = esmInsCompanyService.liveCompanyList();
+        return HttpResult.ok(list);
+    }
 }

+ 11 - 0
src/main/java/com/ydtech/modules/esm/dao/EsmInsCompanyMapper.java

@@ -36,4 +36,15 @@ public interface EsmInsCompanyMapper extends BaseMapper<EsmInsCompany> {
      *  @Description: 查询订单下的保险公司列表
      */
     List<EsmInsCompanyResVo> findOrderCompanyList();
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/12/12 14:34
+     *  @Description:  获取外部协议的公司列表
+     */
+    List<EsmInsCompanyResVo> getExternalAgreementCompanyList( @Param("name")  String name);
+
+
+    List<EsmInsCompanyResVo> liveCompanyList();
+
 }

+ 3 - 1
src/main/java/com/ydtech/modules/esm/model/vo/EsmUserCountVO.java

@@ -1,5 +1,6 @@
 package com.ydtech.modules.esm.model.vo;
 
+import com.ydtech.utils.BigDecimalUtils;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.AllArgsConstructor;
@@ -53,7 +54,8 @@ public class EsmUserCountVO implements Serializable {
             userPolicyList.forEach(x->{
                 aggregateDataO.setOrdernum(aggregateDataO.getOrdernum() + x.getOrdernum());
                 aggregateDataO.setPolicynum(aggregateDataO.getPolicynum() + x.getPolicynum());
-                aggregateDataO.setSumpremium(aggregateDataO.getSumpremium() + x.getSumpremium());
+                double sumPremium = BigDecimalUtils.addDouble(aggregateDataO.getSumpremium(), x.getSumpremium());
+                aggregateDataO.setSumpremium(sumPremium);
                 aggregateDataO.setBjpolicynum(aggregateDataO.getBjpolicynum() + x.getBjpolicynum());
                 aggregateDataO.setBjsumpremium(aggregateDataO.getBjsumpremium() + x.getBjpolicynum());
             });

+ 13 - 0
src/main/java/com/ydtech/modules/esm/service/EsmInsCompanyService.java

@@ -84,6 +84,19 @@ public interface EsmInsCompanyService extends IService<EsmInsCompany> {
      *  @Description:  通过保险公司名称或简称查询
      */
     public EsmInsCompany findInsCompanyByNameOrNamesimple(String companyName);
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/12/12 14:32
+     *  @Description:  获取外部协议的保险公司列表
+     */
+    List<EsmInsCompanyResVo> getExternalAgreementCompanyList(String name);
+
+    /**
+     * 获取已经存在协议的保险公司列表
+     * @return
+     */
+    public List<EsmInsCompanyResVo> liveCompanyList();
 }
 
 

+ 19 - 1
src/main/java/com/ydtech/modules/esm/service/impl/EsmInsCompanyServiceImpl.java

@@ -10,7 +10,6 @@ import com.ydtech.modules.esm.model.vo.res.EsmInsCompanyResVo;
 import com.ydtech.modules.esm.service.EsmInsCompanyService;
 import com.ydtech.modules.protocol.utils.AssertionUtils;
 import com.ydtech.utils.StringUtils;
-import org.springframework.beans.BeanUtils;
 import org.springframework.stereotype.Service;
 
 import java.util.ArrayList;
@@ -198,6 +197,25 @@ public class EsmInsCompanyServiceImpl extends ServiceImpl<EsmInsCompanyMapper, E
         }
         return null;
     }
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/12/12 14:33
+     *  @Description: 获取外部协议的保险公司列表
+     */
+    @Override
+    public List<EsmInsCompanyResVo> getExternalAgreementCompanyList(String name) {
+        return baseMapper.getExternalAgreementCompanyList(name);
+    }
+
+    /**
+     * 获取已经存在协议的保险公司列表
+     * @return
+     */
+    @Override
+    public List<EsmInsCompanyResVo> liveCompanyList() {
+        return baseMapper.liveCompanyList();
+    }
 }
 
 

+ 95 - 59
src/main/java/com/ydtech/modules/fee/dto/vo/RuleAttrMappingVo.java

@@ -11,6 +11,7 @@ import com.ydtech.modules.order.entity.api.bohai.constants.VehicleUsage;
 import com.ydtech.modules.order.entity.api.dajia.constants.TypeVehicleMapping;
 import com.ydtech.modules.protocol.entity.po.PtlNewCarJudgeRules;
 import com.ydtech.modules.protocols.entity.po.PtlAgreementUndwrtRulesAttr;
+import com.ydtech.utils.StringUtils;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
@@ -75,10 +76,10 @@ public class RuleAttrMappingVo {
         LocalDate currentDate = LocalDate.now();
 
         //交强起保日期
-        ruleAttrMappingVoList.add(new RuleAttrMappingVo("JqStartTime",insOrders.getJqstartdate()));
+        ruleAttrMappingVoList.add(new RuleAttrMappingVo("JqStartTime", insAreaCompany.getJqStartDate()));
 
         //商业起保日期
-        ruleAttrMappingVoList.add(new RuleAttrMappingVo("SyStartTime",insOrders.getSystartdate()));
+        ruleAttrMappingVoList.add(new RuleAttrMappingVo("SyStartTime", insAreaCompany.getSyStartDate()));
 
         boolean isNoLicenseFlag = false;
         if (carJudgeRule != null) {
@@ -100,7 +101,7 @@ public class RuleAttrMappingVo {
 
         //车龄
         long between = ChronoUnit.YEARS.between(registrationDate, currentDate) + 1;
-        ruleAttrMappingVoList.add(new RuleAttrMappingVo("VehicleAge",String.valueOf(between)));
+        ruleAttrMappingVoList.add(new RuleAttrMappingVo("VehicleAge", String.valueOf(between)));
 
 
         //发证日期
@@ -113,52 +114,90 @@ public class RuleAttrMappingVo {
         ruleAttrMappingVoList.add(new RuleAttrMappingVo("SyRenewalOfInsurance", insAreaCompany.getSyRenewal()));
 
         CustomerInfoVo ownerInfo = insOrders.getOwnerinfo().toJavaObject(CustomerInfoVo.class);
-        //车主 证件号码(前6位)
-        ruleAttrMappingVoList.add(new RuleAttrMappingVo("CarOwnersIDNumber", ownerInfo.getIdentifyNumber()));
-        //车主 年龄
-        ruleAttrMappingVoList.add(new RuleAttrMappingVo("CarOwnersAge", ownerInfo.getAge()));
-        //车主 性别
-        ruleAttrMappingVoList.add(new RuleAttrMappingVo("CarOwnersSex", ownerInfo.getGender().equals("男") ? "1" : "2"));
+        if(StringUtils.isBlank(ownerInfo.getProperty()) || !"0".equals(ownerInfo.getProperty())) {
+            //车主 证件号码(前6位)
+            ruleAttrMappingVoList.add(new RuleAttrMappingVo("CarOwnersIDNumber", ownerInfo.getIdentifyNumber()));
+            //车主 年龄
+            ruleAttrMappingVoList.add(new RuleAttrMappingVo("CarOwnersAge", ownerInfo.getAge()));
+            //车主 性别
+            ruleAttrMappingVoList.add(new RuleAttrMappingVo("CarOwnersSex", ownerInfo.getGender().equals("男") ? "1" : "2"));
+        }
         //车主 姓名
         ruleAttrMappingVoList.add(new RuleAttrMappingVo("CarOwnerName", ownerInfo.getName()));
 
         CustomerInfoVo policyHolderInfo = insOrders.getApplyinfo().toJavaObject(CustomerInfoVo.class);
-        //投保人 证件号码(前6位)
-        ruleAttrMappingVoList.add(new RuleAttrMappingVo("ApplicantIDNumber", policyHolderInfo.getIdentifyNumber()));
-        //投保人 年龄
-        ruleAttrMappingVoList.add(new RuleAttrMappingVo("ApplicantAge", policyHolderInfo.getAge()));
-        //投保人 性别
-        ruleAttrMappingVoList.add(new RuleAttrMappingVo("ApplicantSex", policyHolderInfo.getGender().equals("男") ? "1" : "2"));
+        if(StringUtils.isBlank(policyHolderInfo.getProperty()) || !"0".equals(policyHolderInfo.getProperty())) {
+            //投保人 证件号码(前6位)
+            ruleAttrMappingVoList.add(new RuleAttrMappingVo("ApplicantIDNumber", policyHolderInfo.getIdentifyNumber()));
+            //投保人 年龄
+            ruleAttrMappingVoList.add(new RuleAttrMappingVo("ApplicantAge", policyHolderInfo.getAge()));
+            //投保人 性别
+            ruleAttrMappingVoList.add(new RuleAttrMappingVo("ApplicantSex", policyHolderInfo.getGender().equals("男") ? "1" : "2"));
+        }
 
         CustomerInfoVo insuredPersonInfo = insOrders.getInsureinfo().toJavaObject(CustomerInfoVo.class);
-        //被保人 证件号码(前6位)
-        ruleAttrMappingVoList.add(new RuleAttrMappingVo("InsuredIDNumber", insuredPersonInfo.getIdentifyNumber()));
-        //被保人 年龄
-        ruleAttrMappingVoList.add(new RuleAttrMappingVo("InsuredAge", insuredPersonInfo.getAge()));
-        //被保人 性别
-        ruleAttrMappingVoList.add(new RuleAttrMappingVo("InsuredSex", insuredPersonInfo.getGender().equals("男") ? "1" : "2"));
-
+        if(StringUtils.isBlank(insuredPersonInfo.getProperty()) || !"0".equals(insuredPersonInfo.getProperty())) {
+            //被保人 证件号码(前6位)
+            ruleAttrMappingVoList.add(new RuleAttrMappingVo("InsuredIDNumber", insuredPersonInfo.getIdentifyNumber()));
+            //被保人 年龄
+            ruleAttrMappingVoList.add(new RuleAttrMappingVo("InsuredAge", insuredPersonInfo.getAge()));
+            //被保人 性别
+            ruleAttrMappingVoList.add(new RuleAttrMappingVo("InsuredSex", insuredPersonInfo.getGender().equals("男") ? "1" : "2"));
+        }
         String OPIConsistent = "0";
-        //车主 投被保人是否一致
-        if((ownerInfo.getName().equals(insuredPersonInfo.getName()) && insuredPersonInfo.getName().equals(policyHolderInfo.getName())) &&
-                (ownerInfo.getIdentifyNumber().equals(insuredPersonInfo.getIdentifyNumber()) && insuredPersonInfo.getIdentifyNumber().equals(policyHolderInfo.getIdentifyNumber()))){
-            OPIConsistent = "1";
+        if(StringUtils.isNotBlank(ownerInfo.getProperty())){
+            boolean boo = ownerInfo.getProperty().equals(insuredPersonInfo.getProperty()) && insuredPersonInfo.getProperty().equals(policyHolderInfo.getProperty());
+            if(boo){
+                if("0".equals(ownerInfo.getProperty())){
+                    if((ownerInfo.getName().equals(insuredPersonInfo.getName()) && insuredPersonInfo.getName().equals(policyHolderInfo.getName())) &&
+                            (ownerInfo.getOrganizationCode().equals(insuredPersonInfo.getOrganizationCode()) && insuredPersonInfo.getOrganizationCode().equals(policyHolderInfo.getOrganizationCode()))){
+                        OPIConsistent = "1";
+                    }
+                }else{
+                    if((ownerInfo.getName().equals(insuredPersonInfo.getName()) && insuredPersonInfo.getName().equals(policyHolderInfo.getName())) &&
+                            (ownerInfo.getIdentifyNumber().equals(insuredPersonInfo.getIdentifyNumber()) && insuredPersonInfo.getIdentifyNumber().equals(policyHolderInfo.getIdentifyNumber()))){
+                        OPIConsistent = "1";
+                    }
+                }
+            }
+        }else {
+            if ((ownerInfo.getName().equals(insuredPersonInfo.getName()) && insuredPersonInfo.getName().equals(policyHolderInfo.getName())) &&
+                    (ownerInfo.getIdentifyNumber().equals(insuredPersonInfo.getIdentifyNumber()) && insuredPersonInfo.getIdentifyNumber().equals(policyHolderInfo.getIdentifyNumber()))) {
+                OPIConsistent = "1";
+            }
         }
         ruleAttrMappingVoList.add(new RuleAttrMappingVo("OPIConsistent",OPIConsistent));
-
         String PIConsistent = "0";
-        //投被保人是否一致
-        if(insuredPersonInfo.getName().equals(policyHolderInfo.getName()) && insuredPersonInfo.getIdentifyNumber().equals(policyHolderInfo.getIdentifyNumber())){
-            PIConsistent = "1";
-        }
+
+        if(StringUtils.isNotBlank(insuredPersonInfo.getProperty())){
+            boolean boo = insuredPersonInfo.getProperty().equals(policyHolderInfo.getProperty());
+            if(boo){
+                if("0".equals(insuredPersonInfo.getProperty())){
+                    //投被保人是否一致
+                    if(insuredPersonInfo.getName().equals(policyHolderInfo.getName()) && insuredPersonInfo.getOrganizationCode().equals(policyHolderInfo.getOrganizationCode())){
+                        PIConsistent = "1";
+                    }
+                }else{
+                    //投被保人是否一致
+                    if(insuredPersonInfo.getName().equals(policyHolderInfo.getName()) && insuredPersonInfo.getIdentifyNumber().equals(policyHolderInfo.getIdentifyNumber())){
+                        PIConsistent = "1";
+                    }
+                }
+            }
+        }else{
+            //投被保人是否一致
+            if(insuredPersonInfo.getName().equals(policyHolderInfo.getName()) && insuredPersonInfo.getIdentifyNumber().equals(policyHolderInfo.getIdentifyNumber())){
+                PIConsistent = "1";
+            }
+       }
         ruleAttrMappingVoList.add(new RuleAttrMappingVo("PIConsistent",PIConsistent));
 
         //2024-06-20 起保日期 月份判断
-        if(insAreaCompany.getJqStartDate() != null && !insAreaCompany.getJqStartDate().equals("")){
+        if (insAreaCompany.getJqStartDate() != null && !insAreaCompany.getJqStartDate().equals("")) {
             LocalDateTime jqStartDate = LocalDateTime.parse(insAreaCompany.getJqStartDate(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
             ruleAttrMappingVoList.add(new RuleAttrMappingVo("JqStartMonth", String.valueOf(jqStartDate.getMonthValue())));
         }
-        if(insAreaCompany.getSyStartDate() != null && !insAreaCompany.getSyStartDate().equals("")) {
+        if (insAreaCompany.getSyStartDate() != null && !insAreaCompany.getSyStartDate().equals("")) {
             LocalDateTime syStartDate = LocalDateTime.parse(insAreaCompany.getSyStartDate(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
             ruleAttrMappingVoList.add(new RuleAttrMappingVo("SyStartMonth", String.valueOf(syStartDate.getMonthValue())));
         }
@@ -303,73 +342,70 @@ public class RuleAttrMappingVo {
         // 商业出险次数
         ruleAttrMappingVoList.add(new RuleAttrMappingVo("SyNumberOfClaims", insAreaCompany.getSyClaims() == null ? "0" : insAreaCompany.getSyClaims()));
         // 车牌地区
-        ruleAttrMappingVoList.add(new RuleAttrMappingVo("LicenseArea", insOrders.getLicenseno().substring(0,1)));
+        ruleAttrMappingVoList.add(new RuleAttrMappingVo("LicenseArea", insOrders.getLicenseno().substring(0, 1)));
         // 系数
-        ruleAttrMappingVoList.add(new RuleAttrMappingVo("Coefficient", getCoefficient(carInfo,insAreaCompany).toString()));
+        ruleAttrMappingVoList.add(new RuleAttrMappingVo("Coefficient", getCoefficient(carInfo, insAreaCompany).toString()));
         // 商业是否有费用
         ruleAttrMappingVoList.add(new RuleAttrMappingVo("CiMessage", (insAreaCompany.getCiMessage() == null || "".equals(insAreaCompany.getCiMessage())) ? "0" : "1"));
         return ruleAttrMappingVoList;
     }
 
-    private static Float getCoefficient(CarInfoVo carInfo,InsAreaCompany insAreaCompany){
+    private static Float getCoefficient(CarInfoVo carInfo, InsAreaCompany insAreaCompany) {
         Integer seatCount = Integer.parseInt(carInfo.getSeatCount());
         Float coefficient = 1.00f;
 
         //        ruleAttrMappingVoList.add(new RuleAttrMappingVo())
         //家庭自用车
-        if(carInfo.getCimodelclass().equals(VehicleType.VT_A0.getCode()) &&
-                carInfo.getVehicleUse().equals(TypeVehicleMapping.TM_05.getCode())){
+        if (carInfo.getCimodelclass().equals(VehicleType.VT_A0.getCode()) &&
+                carInfo.getVehicleUse().equals(TypeVehicleMapping.TM_05.getCode())) {
             //2-5座
-            if(seatCount >= 2 && seatCount <=5) {
+            if (seatCount >= 2 && seatCount <= 5) {
                 coefficient = Float.parseFloat(insAreaCompany.getJqpremium().toString()) / 950;
             }
             //6-9座
-            if(seatCount >= 6 && seatCount <=9){
+            if (seatCount >= 6 && seatCount <= 9) {
                 coefficient = Float.parseFloat(insAreaCompany.getJqpremium().toString()) / 1100;
             }
-        }else
+        } else
             //非营业机关、企业
-            if(carInfo.getCimodelclass().equals(VehicleType.VT_A0.getCode()) &&
+            if (carInfo.getCimodelclass().equals(VehicleType.VT_A0.getCode()) &&
                     (carInfo.getVehicleUse().equals(TypeVehicleMapping.TM_06.getCode()) ||
-                            carInfo.getVehicleUse().equals(TypeVehicleMapping.TM_07.getCode()))){
+                            carInfo.getVehicleUse().equals(TypeVehicleMapping.TM_07.getCode()))) {
                 //2-5座
-                if(seatCount >= 2 && seatCount <=5) {
+                if (seatCount >= 2 && seatCount <= 5) {
                     coefficient = Float.parseFloat(insAreaCompany.getJqpremium().toString()) / 1000;
                 }
                 //6-9座
-                if(seatCount >= 6 && seatCount <=9){
+                if (seatCount >= 6 && seatCount <= 9) {
                     coefficient = Float.parseFloat(insAreaCompany.getJqpremium().toString()) / 1130;
                 }
-            }
-            else
+            } else
                 //货车
-                if(carInfo.getCimodelclass().equals(VehicleType.VT_A1.getCode()))
-                {
+                if (carInfo.getCimodelclass().equals(VehicleType.VT_A1.getCode())) {
                     //营业货运 2吨
-                    if(carInfo.getVehicleUse().equals(TypeVehicleMapping.TM_04.getCode()) &&
-                            Integer.parseInt(carInfo.getLimitLoad()) < 2000){
+                    if (carInfo.getVehicleUse().equals(TypeVehicleMapping.TM_04.getCode()) &&
+                            Integer.parseInt(carInfo.getLimitLoad()) < 2000) {
                         coefficient = Float.parseFloat(insAreaCompany.getJqpremium().toString()) / 1850;
                     }
 
                     //非营业货运 2吨
-                    if(carInfo.getVehicleUse().equals(TypeVehicleMapping.TM_08.getCode()) &&
-                            Integer.parseInt(carInfo.getLimitLoad()) < 2000){
+                    if (carInfo.getVehicleUse().equals(TypeVehicleMapping.TM_08.getCode()) &&
+                            Integer.parseInt(carInfo.getLimitLoad()) < 2000) {
                         coefficient = Float.parseFloat(insAreaCompany.getJqpremium().toString()) / 1200;
                     }
 
                     //大吨位
-                    if(Integer.parseInt(carInfo.getLimitLoad()) > 2000){
+                    if (Integer.parseInt(carInfo.getLimitLoad()) > 2000) {
                         coefficient = Float.parseFloat(insAreaCompany.getJqpremium().toString()) / 4480;
                     }
-                }
-                else
+                } else
                     //出租车 网约车
-                    if(carInfo.getCimodelclass().equals(VehicleType.VT_A0.getCode()) &&
-                            carInfo.getVehicleUse().equals(TypeVehicleMapping.TM_01.getCode())){
+                    if (carInfo.getCimodelclass().equals(VehicleType.VT_A0.getCode()) &&
+                            carInfo.getVehicleUse().equals(TypeVehicleMapping.TM_01.getCode())) {
                         coefficient = Float.parseFloat(insAreaCompany.getJqpremium().toString()) / 1800;
                     }
 
-                    return coefficient;
+        return coefficient;
     }
 
 }

+ 6 - 4
src/main/java/com/ydtech/modules/fee/service/impl/FeeRuleSchemeServiceNewImpl.java

@@ -2,7 +2,6 @@ package com.ydtech.modules.fee.service.impl;
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.ydtech.constants.enums.dict.insurance.EnergyType;
-import com.ydtech.constants.enums.dict.insurance.NatureOfVehicleUse;
 import com.ydtech.constants.enums.dict.insurance.VehicleType;
 import com.ydtech.exception.SystemException;
 import com.ydtech.modules.admin.model.SysUser;
@@ -47,7 +46,6 @@ import org.springframework.stereotype.Service;
 import javax.annotation.Resource;
 import java.math.BigDecimal;
 import java.math.RoundingMode;
-import java.time.LocalDate;
 import java.time.LocalDateTime;
 import java.time.format.DateTimeFormatter;
 import java.util.*;
@@ -1623,6 +1621,10 @@ public class FeeRuleSchemeServiceNewImpl implements FeeRuleSchemeNewService {
         //默认分销比例设置
         RetailProportion retailProportion = new RetailProportion();
         if (!Objects.isNull(esmRetailList) && !esmRetailList.isEmpty()) {
+            //处理数据空指针异常   add by hxl  2024-12-19
+            if(esmRetailList.get(0).getRetailtype()==null){
+                esmRetailList.get(0).setRetailtype("0");
+            }
             retailLevel = Integer.parseInt(esmRetailList.get(0).getRetailtype());
             //赋值默认的分销比例
             retailProportion.setProportion(esmRetailList.get(0).getDisrate1(), esmRetailList.get(0).getDisrate2(), esmRetailList.get(0).getDisrate3());
@@ -3336,7 +3338,7 @@ public class FeeRuleSchemeServiceNewImpl implements FeeRuleSchemeNewService {
                 return true;
             }
         } else if ("3".equals(ptlAgreementProductCostsAttrLink.getOperator())) {
-            if (v.isBefore(min)) {
+            if (v.isBefore(min) || v.isEqual(min)) {
                 return true;
             }
         } else if ("4".equals(ptlAgreementProductCostsAttrLink.getOperator())) {
@@ -3344,7 +3346,7 @@ public class FeeRuleSchemeServiceNewImpl implements FeeRuleSchemeNewService {
                 return true;
             }
         } else if ("5".equals(ptlAgreementProductCostsAttrLink.getOperator())) {
-            if (v.isAfter(max)) {
+            if (v.isAfter(max) || v.isEqual(max)) {
                 return true;
             }
         }

+ 2 - 0
src/main/java/com/ydtech/modules/fnc/controller/contract/ContractController.java

@@ -1,6 +1,7 @@
 package com.ydtech.modules.fnc.controller.contract;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.ydtech.aop.GetStringBufferContent;
 import com.ydtech.core.page.HttpResult;
 import com.ydtech.modules.admin.model.dto.TaskStatisticsDto;
 import com.ydtech.modules.admin.model.vo.KztGetDeptUtilsDto;
@@ -47,6 +48,7 @@ public class ContractController extends BaseController {
      **/
     @PostMapping("queryPage")
     @ApiOperation(value = "合同分页查询")
+    @GetStringBufferContent
     public HttpResult<IPage<ContractEntity>> queryPage(@RequestBody ContractVo contractVO) {
         try {
             IPage<ContractEntity> result = contractService.queryPage(contractVO);

+ 49 - 12
src/main/java/com/ydtech/modules/fnc/entity/InsPlyIncome.java

@@ -9,6 +9,7 @@ import java.time.LocalDateTime;
 import java.time.LocalTime;
 import java.time.format.DateTimeFormatter;
 
+import com.ydtech.utils.StringUtils;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Getter;
@@ -545,12 +546,30 @@ public class InsPlyIncome implements Serializable {
         this.insuredName = insuredName;
         this.policyno  = policyno;
         this.syPolicyno = syPolicyno;
-        this.jqPremium = new BigDecimal(jqPremium);
-        this.syPremium = new BigDecimal(syPremium);
-        this.taxamount = new BigDecimal(taxamount);
-        this.jqSuperviseCostsProportion = new BigDecimal(jqSuperviseCostsProportion);
-        this.sySuperviseCostsProportion = new BigDecimal(sySuperviseCostsProportion);
-        this.commissionFeevalue =  new BigDecimal(commissionFeevalue);;
+        if(StringUtils.isNotEmpty(jqPremium)){
+            this.jqPremium = new BigDecimal(jqPremium);
+        }
+        if(StringUtils.isNotEmpty(syPremium)){
+            this.syPremium = new BigDecimal(syPremium);
+        }
+
+        if(StringUtils.isNotEmpty(taxamount)){
+            this.taxamount = new BigDecimal(taxamount);
+        }
+
+        if(StringUtils.isNotEmpty(jqSuperviseCostsProportion)){
+            this.jqSuperviseCostsProportion = new BigDecimal(jqSuperviseCostsProportion);
+        }
+
+        if(StringUtils.isNotEmpty(sySuperviseCostsProportion)){
+            this.sySuperviseCostsProportion = new BigDecimal(sySuperviseCostsProportion);
+        }
+
+
+        if(StringUtils.isNotEmpty(commissionFeevalue)){
+            this.commissionFeevalue =  new BigDecimal(commissionFeevalue);
+        }
+
         this.addType  = addType;
         this.createTime = LocalDateTime.now();
         this.handlingFeesStatus = "0";
@@ -579,12 +598,30 @@ public class InsPlyIncome implements Serializable {
         this.insuredName = insuredName;
         this.policyno  = policyno;
         this.syPolicyno = syPolicyno;
-        this.jqPremium = new BigDecimal(jqPremium);
-        this.syPremium = new BigDecimal(syPremium);
-        this.taxamount = new BigDecimal(taxamount);
-        this.jqOtherCostsProportion = new BigDecimal(jqOtherCostsProportion);
-        this.syOtherCostsProportion = new BigDecimal(syOtherCostsProportion);
-        this.otherFeevalue =  new BigDecimal(otherFeevalue);;
+        if(StringUtils.isNotEmpty(jqPremium)){
+            this.jqPremium = new BigDecimal(jqPremium);
+        }
+
+        if(StringUtils.isNotEmpty(syPremium)){
+            this.syPremium = new BigDecimal(syPremium);
+        }
+
+        if(StringUtils.isNotEmpty(taxamount)){
+            this.taxamount = new BigDecimal(taxamount);
+        }
+
+        if(StringUtils.isNotEmpty(jqOtherCostsProportion)){
+            this.jqOtherCostsProportion = new BigDecimal(jqOtherCostsProportion);
+        }
+
+        if(StringUtils.isNotEmpty(syOtherCostsProportion)){
+            this.syOtherCostsProportion = new BigDecimal(syOtherCostsProportion);
+        }
+
+        if(StringUtils.isNotEmpty(otherFeevalue)){
+            this.otherFeevalue =  new BigDecimal(otherFeevalue);
+        }
+
         this.addType  = addType;
         this.createTime = LocalDateTime.now();
         this.handlingFeesStatus = "0";

+ 1 - 0
src/main/java/com/ydtech/modules/fnc/service/contract/impl/contractServiceImpl.java

@@ -34,6 +34,7 @@ import net.sourceforge.pinyin4j.format.HanyuPinyinVCharType;
 import net.sourceforge.pinyin4j.format.exception.BadHanyuPinyinOutputFormatCombination;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.autoconfigure.cache.CacheProperties;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.CollectionUtils;

+ 124 - 120
src/main/java/com/ydtech/modules/fnc/service/impl/InsPlyIncomeServiceImpl.java

@@ -80,10 +80,7 @@ import java.math.RoundingMode;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
-import java.time.LocalDate;
-import java.time.LocalDateTime;
-import java.time.LocalTime;
-import java.time.YearMonth;
+import java.time.*;
 import java.time.format.DateTimeFormatter;
 import java.util.*;
 import java.util.function.BinaryOperator;
@@ -3952,6 +3949,7 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
                 }
             }
         }else if("2".equals(type)){
+
             int index=1;
             //车险跟单
             if(cxgdList!=null && cxgdList.size()>0){
@@ -4029,168 +4027,174 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
     @Override
     @Transactional
     public void correctData(InsPlyIncomeVo insPlyIncomeVo) {
-        String licenseno = insPlyIncomeVo.getLicenseno();
-        HashMap<String, Object> params = new HashMap<>();
-        params.put("licenseno", licenseno);
-        List<InsPlyIncome> insPlyIncomes = baseMapper.queryNew(params);
-        if (insPlyIncomes.isEmpty()) {
-            throw new SystemException("该车牌号不存在");
-        }
+        List<String> licensenoList = insPlyIncomeVo.getLicensenoList();
+        for (String s : licensenoList) {
+            HashMap<String, Object> params = new HashMap<>();
+            params.put("licenseno", s);
+            List<InsPlyIncome> insPlyIncomes = baseMapper.queryNew(params);
+            if (insPlyIncomes.isEmpty()) {
+                throw new SystemException("该车牌号不存在");
+            }
 //      如果 该数据是平台  则转为私有 如果是私有则转为 平台
-        InsPlyIncome insPlyIncome1 = insPlyIncomes.get(0);
-        if ("1".equals(insPlyIncome1.getAgreementType())) { //平台转私有
-            BigDecimal jqPremium = insPlyIncome1.getJqPremium();  //交强保费
-            BigDecimal syPremium = insPlyIncome1.getSyPremium();  //商业保费
-            BigDecimal noPremium = insPlyIncome1.getNoPremium();  //非车保费
+            InsPlyIncome insPlyIncome1 = insPlyIncomes.get(0);
+            if ("1".equals(insPlyIncome1.getAgreementType())) { //平台转私有
+                BigDecimal jqPremium = insPlyIncome1.getJqPremium();  //交强保费
+                BigDecimal syPremium = insPlyIncome1.getSyPremium();  //商业保费
+                BigDecimal noPremium = insPlyIncome1.getNoPremium();  //非车保费
 
-            BigDecimal jqSuperviseCostsProportion = insPlyIncome1.getJqSuperviseCostsProportion();//交强手续费比例
-            BigDecimal sySuperviseCostsProportion = insPlyIncome1.getSySuperviseCostsProportion(); //商业手续费比例
-            BigDecimal noSuperviseCostsProportion = insPlyIncome1.getNoSuperviseCostsProportion(); //非车手续费比例
+                BigDecimal jqSuperviseCostsProportion = insPlyIncome1.getJqSuperviseCostsProportion();//交强手续费比例
+                BigDecimal sySuperviseCostsProportion = insPlyIncome1.getSySuperviseCostsProportion(); //商业手续费比例
+                BigDecimal noSuperviseCostsProportion = insPlyIncome1.getNoSuperviseCostsProportion(); //非车手续费比例
 
-            BigDecimal jqOtherCostsProportion = insPlyIncome1.getJqOtherCostsProportion(); //交强跟单比例
-            BigDecimal syOtherCostsProportion = insPlyIncome1.getSyOtherCostsProportion(); // 商业跟单比例
-            BigDecimal noOtherCostsProportion = insPlyIncome1.getNoOtherCostsProportion(); // 非车跟单比例
+                BigDecimal jqOtherCostsProportion = insPlyIncome1.getJqOtherCostsProportion(); //交强跟单比例
+                BigDecimal syOtherCostsProportion = insPlyIncome1.getSyOtherCostsProportion(); // 商业跟单比例
+                BigDecimal noOtherCostsProportion = insPlyIncome1.getNoOtherCostsProportion(); // 非车跟单比例
 
-            if ((jqSuperviseCostsProportion.compareTo(BigDecimal.ZERO) > 0 || sySuperviseCostsProportion.compareTo(BigDecimal.ZERO) > 0) && jqPremium.compareTo(BigDecimal.ZERO)>0 || syPremium.compareTo(BigDecimal.ZERO)>0) {  //私有手续费
-                BigDecimal commissionFeerate = this.calculateTotal(insPlyIncome1.getJqSuperviseCostsProportion(), insPlyIncome1.getSySuperviseCostsProportion(), null);
-                BigDecimal commissionFeevalue = this.calculateTotal(insPlyIncome1.getJqSuperviseCostsPremiums(), insPlyIncome1.getSySuperviseCostsPremiums(), null);
+                if ((jqSuperviseCostsProportion.compareTo(BigDecimal.ZERO) > 0 || sySuperviseCostsProportion.compareTo(BigDecimal.ZERO) > 0) && jqPremium.compareTo(BigDecimal.ZERO)>0 || syPremium.compareTo(BigDecimal.ZERO)>0) {  //私有手续费
+                    BigDecimal commissionFeerate = this.calculateTotal(insPlyIncome1.getJqSuperviseCostsProportion(), insPlyIncome1.getSySuperviseCostsProportion(), null);
+                    BigDecimal commissionFeevalue = this.calculateTotal(insPlyIncome1.getJqSuperviseCostsPremiums(), insPlyIncome1.getSySuperviseCostsPremiums(), null);
 
-                InsPlyIncome insPlyIncome = new InsPlyIncome();
-                BeanUtils.copyProperties(insPlyIncome1, insPlyIncome);
+                    InsPlyIncome insPlyIncome = new InsPlyIncome();
+                    BeanUtils.copyProperties(insPlyIncome1, insPlyIncome);
 
-                insPlyIncome.setJqOtherCostsProportion(null);
-                insPlyIncome.setJqOtherCostsPremium(null);
 
-                insPlyIncome.setSyOtherCostsProportion(null);
-                insPlyIncome.setSyOtherCostsPremium(null);
+                    insPlyIncome.setJqOtherCostsProportion(null);
+                    insPlyIncome.setJqOtherCostsPremium(null);
 
-                insPlyIncome.setNoOtherCostsProportion(null);
-                insPlyIncome.setNoOtherCostsPremium(null);
+                    insPlyIncome.setSyOtherCostsProportion(null);
+                    insPlyIncome.setSyOtherCostsPremium(null);
 
-                insPlyIncome.setNoSuperviseCostsPremiums(null);
-                insPlyIncome.setNoSuperviseCostsProportion(null);
+                    insPlyIncome.setNoOtherCostsProportion(null);
+                    insPlyIncome.setNoOtherCostsPremium(null);
 
-                insPlyIncome.setOtherFeerate(null);
-                insPlyIncome.setOtherFeevalue(null);
+                    insPlyIncome.setNoSuperviseCostsPremiums(null);
+                    insPlyIncome.setNoSuperviseCostsProportion(null);
 
-                insPlyIncome.setCommissionFeerate(commissionFeerate);
-                insPlyIncome.setCommissionFeevalue(commissionFeevalue);
-                insPlyIncome.setAllFeeValue(commissionFeevalue);
-                insPlyIncome.setAgreementId(insPlyIncomeVo.getAgreementId());
-                insPlyIncome.setId(null);
+                    insPlyIncome.setOtherFeerate(null);
+                    insPlyIncome.setOtherFeevalue(null);
 
-                baseMapper.insert(insPlyIncome);
-            }
+                    insPlyIncome.setCommissionFeerate(commissionFeerate);
+                    insPlyIncome.setCommissionFeevalue(commissionFeevalue);
+                    insPlyIncome.setAllFeeValue(commissionFeevalue);
+                    insPlyIncome.setReceivableAmount(commissionFeevalue);
+                    insPlyIncome.setAgreementId(insPlyIncomeVo.getAgreementId());
+                    insPlyIncome.setId(null);
 
-            if ((jqOtherCostsProportion.compareTo(BigDecimal.ZERO) > 0 || syOtherCostsProportion.compareTo(BigDecimal.ZERO) > 0) && jqPremium.compareTo(BigDecimal.ZERO)>0 || syPremium.compareTo(BigDecimal.ZERO)>0) {
+                    baseMapper.insert(insPlyIncome);
+                }
 
-                BigDecimal syOtherAmount = algorithmAmount(insPlyIncome1.getSyPremium(), insPlyIncome1.getSyOtherCostsProportion());
-                BigDecimal jqOtherAmount = algorithmAmount(insPlyIncome1.getJqPremium(), insPlyIncome1.getJqOtherCostsProportion());
+                if ((jqOtherCostsProportion.compareTo(BigDecimal.ZERO) > 0 || syOtherCostsProportion.compareTo(BigDecimal.ZERO) > 0) && jqPremium.compareTo(BigDecimal.ZERO)>0 || syPremium.compareTo(BigDecimal.ZERO)>0) {
 
+                    BigDecimal syOtherAmount = algorithmAmount(insPlyIncome1.getSyPremium(), insPlyIncome1.getSyOtherCostsProportion());
+                    BigDecimal jqOtherAmount = algorithmAmount(insPlyIncome1.getJqPremium(), insPlyIncome1.getJqOtherCostsProportion());
 
-                BigDecimal otherFvalue = this.calculateTotal(syOtherAmount, jqOtherAmount, null);
-                BigDecimal otherFeet = this.calculateTotal(insPlyIncome1.getJqOtherCostsProportion(), insPlyIncome1.getSyOtherCostsProportion(), null);
 
-                InsPlyIncome insPlyIncome = new InsPlyIncome();
-                BeanUtils.copyProperties(insPlyIncome1, insPlyIncome);
+                    BigDecimal otherFvalue = this.calculateTotal(syOtherAmount, jqOtherAmount, null);
+                    BigDecimal otherFeet = this.calculateTotal(insPlyIncome1.getJqOtherCostsProportion(), insPlyIncome1.getSyOtherCostsProportion(), null);
 
-                insPlyIncome.setNoOtherCostsProportion(null);
-                insPlyIncome.setNoOtherCostsPremium(null);
+                    InsPlyIncome insPlyIncome = new InsPlyIncome();
+                    BeanUtils.copyProperties(insPlyIncome1, insPlyIncome);
 
-                insPlyIncome.setNoSuperviseCostsPremiums(null);
-                insPlyIncome.setNoSuperviseCostsProportion(null);
+                    insPlyIncome.setNoOtherCostsProportion(null);
+                    insPlyIncome.setNoOtherCostsPremium(null);
 
-                insPlyIncome.setJqSuperviseCostsProportion(null);
-                insPlyIncome.setJqSuperviseCostsPremiums(null);
+                    insPlyIncome.setNoSuperviseCostsPremiums(null);
+                    insPlyIncome.setNoSuperviseCostsProportion(null);
 
-                insPlyIncome.setSySuperviseCostsPremiums(null);
-                insPlyIncome.setSySuperviseCostsProportion(null);
+                    insPlyIncome.setJqSuperviseCostsProportion(null);
+                    insPlyIncome.setJqSuperviseCostsPremiums(null);
 
-                insPlyIncome.setCommissionFeevalue(null);
-                insPlyIncome.setCommissionFeerate(null);
+                    insPlyIncome.setSySuperviseCostsPremiums(null);
+                    insPlyIncome.setSySuperviseCostsProportion(null);
 
-                insPlyIncome.setJqOtherCostsPremium(jqOtherAmount);
-                insPlyIncome.setSyOtherCostsPremium(syOtherAmount);
-                insPlyIncome.setOtherFeevalue(otherFvalue);
-                insPlyIncome.setOtherFeerate(otherFeet);
-                insPlyIncome.setAllFeeValue(otherFvalue);
-                insPlyIncome.setAgreementId(insPlyIncomeVo.getAgreementId());
-                insPlyIncome.setIsNotDocumentary("1");
-                insPlyIncome.setId(null);
+                    insPlyIncome.setCommissionFeevalue(null);
+                    insPlyIncome.setCommissionFeerate(null);
 
-                baseMapper.insert(insPlyIncome);
-            }
+                    insPlyIncome.setJqOtherCostsPremium(jqOtherAmount);
+                    insPlyIncome.setSyOtherCostsPremium(syOtherAmount);
+                    insPlyIncome.setOtherFeevalue(otherFvalue);
+                    insPlyIncome.setOtherFeerate(otherFeet);
+                    insPlyIncome.setAllFeeValue(otherFvalue);
+                    insPlyIncome.setReceivableAmount(otherFvalue);
+                    insPlyIncome.setAgreementId(insPlyIncomeVo.getAgreementId());
+                    insPlyIncome.setIsNotDocumentary("1");
+                    insPlyIncome.setId(null);
 
-            if (noSuperviseCostsProportion.compareTo(BigDecimal.ZERO)>0 &&  noPremium.compareTo(BigDecimal.ZERO)>0) {  //非车手续费
-                InsPlyIncome insPlyIncome = new InsPlyIncome();
-                BeanUtils.copyProperties(insPlyIncome1, insPlyIncome);
+                    baseMapper.insert(insPlyIncome);
+                }
 
-                insPlyIncome.setJqSuperviseCostsPremiums(null);
-                insPlyIncome.setJqSuperviseCostsProportion(null);
+                if (noSuperviseCostsProportion.compareTo(BigDecimal.ZERO)>0 &&  noPremium.compareTo(BigDecimal.ZERO)>0) {  //非车手续费
+                    InsPlyIncome insPlyIncome = new InsPlyIncome();
+                    BeanUtils.copyProperties(insPlyIncome1, insPlyIncome);
 
-                insPlyIncome.setSySuperviseCostsPremiums(null);
-                insPlyIncome.setSySuperviseCostsProportion(null);
+                    insPlyIncome.setJqSuperviseCostsPremiums(null);
+                    insPlyIncome.setJqSuperviseCostsProportion(null);
 
-                insPlyIncome.setJqOtherCostsPremium(null);
-                insPlyIncome.setJqOtherCostsProportion(null);
+                    insPlyIncome.setSySuperviseCostsPremiums(null);
+                    insPlyIncome.setSySuperviseCostsProportion(null);
 
-                insPlyIncome.setSyOtherCostsProportion(null);
-                insPlyIncome.setSyOtherCostsPremium(null);
+                    insPlyIncome.setJqOtherCostsPremium(null);
+                    insPlyIncome.setJqOtherCostsProportion(null);
 
-                insPlyIncome.setNoOtherCostsProportion(null);
-                insPlyIncome.setNoOtherCostsPremium(null);
+                    insPlyIncome.setSyOtherCostsProportion(null);
+                    insPlyIncome.setSyOtherCostsPremium(null);
 
+                    insPlyIncome.setNoOtherCostsProportion(null);
+                    insPlyIncome.setNoOtherCostsPremium(null);
 
-                insPlyIncome.setOtherFeevalue(null);
-                insPlyIncome.setOtherFeerate(null);
 
-                insPlyIncome.setCommissionFeevalue(insPlyIncome1.getNoSuperviseCostsPremiums());
-                insPlyIncome.setCommissionFeerate(insPlyIncome1.getNoSuperviseCostsProportion());
-                insPlyIncome.setAllFeeValue(insPlyIncome1.getNoSuperviseCostsPremiums());
+                    insPlyIncome.setOtherFeevalue(null);
+                    insPlyIncome.setOtherFeerate(null);
 
-                insPlyIncome.setAgreementId(insPlyIncomeVo.getAgreementId());
-                insPlyIncome.setId(null);
-                insPlyIncome.setIsNotCar("1");
-                baseMapper.insert(insPlyIncome);
-            }
+                    insPlyIncome.setCommissionFeevalue(insPlyIncome1.getNoSuperviseCostsPremiums());
+                    insPlyIncome.setCommissionFeerate(insPlyIncome1.getNoSuperviseCostsProportion());
+                    insPlyIncome.setAllFeeValue(insPlyIncome1.getNoSuperviseCostsPremiums());
 
-            if (noOtherCostsProportion .compareTo(BigDecimal.ZERO) >0 && noPremium.compareTo(BigDecimal.ZERO)>0) {
+                    insPlyIncome.setAgreementId(insPlyIncomeVo.getAgreementId());
+                    insPlyIncome.setId(null);
+                    insPlyIncome.setIsNotCar("1");
+                    insPlyIncome.setReceivableAmount(insPlyIncome1.getNoSuperviseCostsPremiums());
+                    baseMapper.insert(insPlyIncome);
+                }
 
-                //                algorithmAmount(syPremium, syOtherCostsProportion)
-                BigDecimal noOtherAmount = algorithmAmount(insPlyIncome1.getNoPremium(), insPlyIncome1.getNoOtherCostsProportion());
+                if (noOtherCostsProportion .compareTo(BigDecimal.ZERO) >0 && noPremium.compareTo(BigDecimal.ZERO)>0) {
 
+                    //                algorithmAmount(syPremium, syOtherCostsProportion)
+                    BigDecimal noOtherAmount = algorithmAmount(insPlyIncome1.getNoPremium(), insPlyIncome1.getNoOtherCostsProportion());
 
-                InsPlyIncome insPlyIncome = new InsPlyIncome();
-                BeanUtils.copyProperties(insPlyIncome1, insPlyIncome);
 
-                insPlyIncome.setJqSuperviseCostsPremiums(null);
-                insPlyIncome.setJqSuperviseCostsProportion(null);
+                    InsPlyIncome insPlyIncome = new InsPlyIncome();
+                    BeanUtils.copyProperties(insPlyIncome1, insPlyIncome);
 
-                insPlyIncome.setSySuperviseCostsPremiums(null);
-                insPlyIncome.setSySuperviseCostsProportion(null);
+                    insPlyIncome.setJqSuperviseCostsPremiums(null);
+                    insPlyIncome.setJqSuperviseCostsProportion(null);
 
-                insPlyIncome.setJqOtherCostsPremium(null);
-                insPlyIncome.setJqOtherCostsProportion(null);
+                    insPlyIncome.setSySuperviseCostsPremiums(null);
+                    insPlyIncome.setSySuperviseCostsProportion(null);
 
-                insPlyIncome.setSyOtherCostsProportion(null);
-                insPlyIncome.setSyOtherCostsPremium(null);
+                    insPlyIncome.setJqOtherCostsPremium(null);
+                    insPlyIncome.setJqOtherCostsProportion(null);
 
-                insPlyIncome.setNoSuperviseCostsPremiums(null);
-                insPlyIncome.setNoSuperviseCostsProportion(null);
+                    insPlyIncome.setSyOtherCostsProportion(null);
+                    insPlyIncome.setSyOtherCostsPremium(null);
 
-                insPlyIncome.setCommissionFeerate(null);
-                insPlyIncome.setCommissionFeevalue(null);
+                    insPlyIncome.setNoSuperviseCostsPremiums(null);
+                    insPlyIncome.setNoSuperviseCostsProportion(null);
 
-                insPlyIncome.setOtherFeevalue(noOtherAmount);
-                insPlyIncome.setOtherFeerate(insPlyIncome1.getNoOtherCostsProportion());
+                    insPlyIncome.setCommissionFeerate(null);
+                    insPlyIncome.setCommissionFeevalue(null);
 
-                insPlyIncome.setNoOtherCostsPremium(noOtherAmount);
-                insPlyIncome.setAgreementId(insPlyIncomeVo.getAgreementId());
-                insPlyIncome.setAllFeeValue(insPlyIncome1.getNoOtherCostsPremium());
-                insPlyIncome.setId(null);
-                insPlyIncome.setIsNotCar("1");
-                insPlyIncome.setIsNotDocumentary("1");
-                baseMapper.insert(insPlyIncome);
+                    insPlyIncome.setOtherFeevalue(noOtherAmount);
+                    insPlyIncome.setOtherFeerate(insPlyIncome1.getNoOtherCostsProportion());
+
+                    insPlyIncome.setNoOtherCostsPremium(noOtherAmount);
+                    insPlyIncome.setAgreementId(insPlyIncomeVo.getAgreementId());
+                    insPlyIncome.setAllFeeValue(insPlyIncome1.getNoOtherCostsPremium());
+                    insPlyIncome.setId(null);
+                    insPlyIncome.setIsNotCar("1");
+                    insPlyIncome.setIsNotDocumentary("1");
+                    baseMapper.insert(insPlyIncome);
+                }
             }
         }
     }

+ 6 - 1
src/main/java/com/ydtech/modules/fnc/vo/ContractVo.java

@@ -3,6 +3,7 @@ package com.ydtech.modules.fnc.vo;
 
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
+import com.ydtech.modules.admin.utils.DataParams;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
@@ -10,11 +11,12 @@ import lombok.Data;
 import javax.validation.constraints.Min;
 import java.io.Serializable;
 import java.time.LocalDateTime;
+import java.util.HashMap;
 import java.util.List;
 
 @Data
 @ApiModel("合同查询vo")
-public class ContractVo implements Serializable {
+public class ContractVo  extends DataParams implements Serializable {
     @ApiModelProperty("主键")
     private String id;
 
@@ -120,4 +122,7 @@ public class ContractVo implements Serializable {
 
     @ApiModelProperty("是否是查看详情")
     private String isView;
+
+    @ApiModelProperty("是否是查看详情")
+    private String inValue;
 }

+ 3 - 0
src/main/java/com/ydtech/modules/fnc/vo/InsPlyIncomeVo.java

@@ -429,4 +429,7 @@ public class InsPlyIncomeVo implements Serializable {
     private String status;
 
 
+
+    @ApiModelProperty(value = "车牌号list")
+    private List<String> licensenoList;
 }

+ 10 - 3
src/main/java/com/ydtech/modules/ins/model/vo/CustomerInfoVo.java

@@ -1,7 +1,8 @@
 package com.ydtech.modules.ins.model.vo;
 
 import com.ydtech.validation.annotation.CheckDateTime;
-import com.ydtech.validation.annotation.CheckIdentifyNumber;
+import com.ydtech.validation.annotation.CheckIdentifyNumberClass;
+import com.ydtech.validation.annotation.CodeNotNull;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.AllArgsConstructor;
@@ -22,17 +23,17 @@ import javax.validation.constraints.NotNull;
 @NoArgsConstructor
 @AllArgsConstructor
 @ApiModel(value = "人员信息")
+@CodeNotNull
+@CheckIdentifyNumberClass
 public class CustomerInfoVo {
 
     @NotNull(message = "车主、投保人、被保人姓名不能为空")
     @ApiModelProperty("姓名")
     private String name;
 
-    @NotNull(message = "车主、投保人、被保人身份证号不能为空")
     @ApiModelProperty("身份证号")
     private String identifyNumber;
 
-//    @NotNull(message = "(企业)车主、投保人、被保人组织机构代码不能为空")
     @ApiModelProperty("组织机构代码")
     private String organizationCode;
 
@@ -57,6 +58,9 @@ public class CustomerInfoVo {
     @ApiModelProperty("手机号")
     private String mobile;
 
+    @ApiModelProperty("固定电话")
+    private String tel;
+
     @ApiModelProperty(value = "有效时间开始")
     @CheckDateTime(format = "yyyy-MM-dd", message = "请检查身份证的开始有效时间")
     @NotBlank(message = "请检车有效时间开始是否填写")
@@ -90,6 +94,9 @@ public class CustomerInfoVo {
     @ApiModelProperty(value = "经营范围")
     private String scope;
 
+    @ApiModelProperty(value = "联系人")
+    private String legalPerson;
+
 
     public boolean contrastInfo(CustomerInfoVo customerInfoVo) {
         if (!ObjectUtils.nullSafeEquals(this.name, customerInfoVo.getName())) {

+ 6 - 2
src/main/java/com/ydtech/modules/ins/model/vo/QuoteRespVo.java

@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.annotation.TableField;
 import com.fasterxml.jackson.annotation.JsonProperty;
 import com.ydtech.modules.order.entity.TaxArrears;
 import com.ydtech.modules.order.entity.crawler.response.CrawlerQuoteResponse;
+import com.ydtech.modules.order.entity.po.SysQuoteRecord;
 import com.ydtech.modules.order.entity.vo.CoreModelsVo;
 import com.ydtech.utils.BigDecimalUtils;
 import com.ydtech.utils.StringUtils;
@@ -129,7 +130,7 @@ public class QuoteRespVo {
     private double syLossRation;
 
     @ApiModelProperty("阳光 交商含增值服务合并经营成本率")
-    private double margeCostRate;
+    private String mergeCostRate;
 
     @ApiModelProperty("核心返回车型")
     private CoreModelsVo coreModels;
@@ -216,12 +217,15 @@ public class QuoteRespVo {
     @TableField(value = "syappoint")
     private String syappoint;
 
+    @ApiModelProperty("报价记录")
+    private List<SysQuoteRecord> quoteRecords;
+
     public void setJqClaims(String jqClaims) {
         this.jqClaims = StringUtils.isEmpty(jqClaims) ? null : jqClaims;
     }
 
     public void setSyClaims(String syClaims) {
-        this.syClaims = StringUtils.isEmpty(jqClaims) ? null : syClaims;
+        this.syClaims = StringUtils.isEmpty(syClaims) ? null : syClaims;
     }
 
     public List<AccidentResponseVo> getAccidentInfo() {

+ 28 - 8
src/main/java/com/ydtech/modules/ins/model/yc/audit/Audit.java

@@ -10,6 +10,7 @@ import com.ydtech.modules.ins.model.yc.YcConfigureParameters;
 import com.ydtech.modules.order.entity.InsAreaCompany;
 import com.ydtech.modules.order.entity.InsOrders;
 import com.ydtech.utils.IDCardUtils;
+import com.ydtech.utils.StringUtils;
 import lombok.Data;
 
 import javax.validation.Valid;
@@ -260,12 +261,21 @@ public class Audit {
         customer.setOwnerAddress(ownerInfo.getAddr());
         customer.setAppcIncome("0");
         customer.setInsuredcIncome("0");
-        customer.setBenefitCustType("1");
-        customer.setBenefitCertiType("120001");
-        customer.setBenefitCertiCode(insureInfo.getIdentifyNumber());
-        customer.setBenefitAge(IDCardUtils.GetBirthday(insureInfo.getIdentifyNumber()));
-        customer.setBenefitSex(IDCardUtils.GetYcSex(insureInfo.getIdentifyNumber()));
-        customer.setBenefitName(insureInfo.getName());
+        String property1 = insureInfo.getProperty();
+        if (StringUtils.isNotEmpty(property1) && "0".equals(property1)) {
+            customer.setBenefitCustType("0");
+            customer.setBenefitCertiType("110004");
+            customer.setBenefitCertiCode(insureInfo.getOrganizationCode());
+            customer.setBenefitName(insureInfo.getName());
+        }else {
+
+            customer.setBenefitCustType("1");
+            customer.setBenefitCertiType("120001");
+            customer.setBenefitCertiCode(insureInfo.getIdentifyNumber());
+            customer.setBenefitAge(IDCardUtils.GetBirthday(insureInfo.getIdentifyNumber()));
+            customer.setBenefitSex(IDCardUtils.GetYcSex(insureInfo.getIdentifyNumber()));
+            customer.setBenefitName(insureInfo.getName());
+        }
         customer.setBnfctcertfclsvalidate(YcBuildData.ID_CARD_INDATE);
 //        customer.setCProvince(Province.buildProvince(insureInfo.getAddr()));
 //        customer.setCCity(City.buildCity(insureInfo.getAddr()));
@@ -274,10 +284,20 @@ public class Audit {
 
         //<taxATion>
         TaxATion taxATion = new TaxATion();
-        taxATion.setCTaxType("338001");
+        //0:法人 1个人
+        String property = applyInfo.getProperty();
+        if (StringUtils.isNotEmpty(property) && "0".equals(property)) {
+            taxATion.setCTaxType("338003");
+            taxATion.setTaxpayerComid(applyInfo.getOrganizationCode());
+        }else {
+            taxATion.setCTaxType("338001");
+            taxATion.setTaxpayerComid(applyInfo.getIdentifyNumber());
+        }
+        //ceshi
+//        taxATion.setCTaxType("338001");
 //        taxATion.setClntMark("1");
         taxATion.setClntMark("3");
-        taxATion.setTaxpayerComid(applyInfo.getIdentifyNumber());
+//        taxATion.setTaxpayerComid(applyInfo.getIdentifyNumber());
         taxATion.setTaxName(applyInfo.getName());
         taxATion.setClntAddress(applyInfo.getAddr());
         taxATion.setMobile(applyInfo.getMobile());

+ 83 - 48
src/main/java/com/ydtech/modules/ins/model/yc/ruote/Applicant.java

@@ -1,6 +1,7 @@
 package com.ydtech.modules.ins.model.yc.ruote;
 
 import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
+import com.ydtech.exception.SystemException;
 import com.ydtech.modules.ins.model.vo.CustomerInfoVo;
 import com.ydtech.modules.ins.model.yc.YcConfigureParameters;
 import com.ydtech.utils.IDCardUtils;
@@ -139,13 +140,13 @@ public class Applicant {
      */
     @JacksonXmlProperty(localName = "CResvTxt5")
     private String CResvTxt5;
-//
-//    /**
-//     * 单位性质
-//     * 代码表
-//     */
-//    @JacksonXmlProperty(localName = "CWorkDpt")
-//    private String CWorkDpt;
+
+    /**
+     * 单位性质
+     * 代码表
+     */
+    @JacksonXmlProperty(localName = "CWorkDpt")
+    private String CWorkDpt;
 //
 //    /**
 //     * 民族
@@ -167,27 +168,27 @@ public class Applicant {
 //     */
 //    @JacksonXmlProperty(localName = "TEffectedDate")
 //    private String TEffectedDate;
-//
-//    /**
-//     * 行业
-//     * 法人场景,代码表
-//     */
-//    @JacksonXmlProperty(localName = "CTrdCde")
-//    private String CTrdCde;
-//
-//    /**
-//     * 经营范围
-//     * 法人场景
-//     */
-//    @JacksonXmlProperty(localName = "COccupation")
-//    private String COccupation;
-//
-//    /**
-//     * 注册资本金
-//     * 单位万元/法人场景
-//     */
-//    @JacksonXmlProperty(localName = "NResvNum3")
-//    private String NResvNum3;
+
+    /**
+     * 行业
+     * 法人场景,代码表
+     */
+    @JacksonXmlProperty(localName = "CTrdCde")
+    private String CTrdCde;
+
+    /**
+     * 经营范围
+     * 法人场景
+     */
+    @JacksonXmlProperty(localName = "COccupation")
+    private String COccupation;
+
+    /**
+     * 注册资本金
+     * 单位万元/法人场景
+     */
+    @JacksonXmlProperty(localName = "NResvNum3")
+    private String NResvNum3;
 
     /**
      * 所在省
@@ -210,12 +211,12 @@ public class Applicant {
     @JacksonXmlProperty(localName = "CCounty")
     private String CCounty;
 
-//    /**
-//     * 注册资本金币种
-//     * 代码表
-//     */
-//    @JacksonXmlProperty(localName = "NResvNum3Cur")
-//    private String NResvNum3Cur;
+    /**
+     * 注册资本金币种
+     * 代码表
+     */
+    @JacksonXmlProperty(localName = "NResvNum3Cur")
+    private String NResvNum3Cur;
 
     /**
      * 国家/地区
@@ -236,28 +237,62 @@ public class Applicant {
 //        CustomerInfoVo ownerInfo = yaQuoteInfoVo.getOwnerInfo();
 //        CustomerInfoVo policyHolderInfo = yaQuoteInfoVo.getPolicyHolderInfo();
         Applicant applicant = new Applicant();
+        //投保人类型: 0:法人 1:个人(中国籍) 2: 个人(非中国籍)
+        String property = policyHolderInfo.getProperty();
+        String name;
+        if ("0".equals(property)) {
+            //投保人证件类型
+            applicant.setCCertfCls("110004");
+            //投保人证件号
+            applicant.setCCertfCde(policyHolderInfo.getOrganizationCode());
+            applicant.setCClntAddr(policyHolderInfo.getAddr());
+            if (StringUtils.isEmpty(ownerInfo.getProvince()) || StringUtils.isEmpty(ownerInfo.getCity()) || StringUtils.isEmpty(ownerInfo.getCounty())) {
+                throw new SystemException("企业车省市区必填");
+            }
+            applicant.setCProvince(policyHolderInfo.getProvince());
+            applicant.setCCity(policyHolderInfo.getCity());
+            applicant.setCCounty(policyHolderInfo.getCounty());
+            //行业
+            applicant.setCTrdCde("201799");
+//            applicant.setCOccupation(policyHolderInfo.getScope());
+            applicant.setNResvNum3(policyHolderInfo.getRegisteredCapital());
+            applicant.setNResvNum3Cur("01");
+            applicant.setCWorkDpt("900");
+            //联系人
+            applicant.setCCntrNme(policyHolderInfo.getLegalPerson());
+            name = policyHolderInfo.getName();
+            if (name.contains("(") || name.contains("(")) {
+                name=name.replace("(","");
+                name=name.replace(")","");
+            }
+            applicant.setCClntMrk("0");
+        }else{
+            applicant.setCClntAddr(policyHolderInfo.getAddr());
+            applicant.setCCertfCde(policyHolderInfo.getIdentifyNumber());
+            applicant.setCCertfCls("120001");
+            applicant.setTBirthday(IDCardUtils.GetBirthday(policyHolderInfo.getIdentifyNumber()));
+            applicant.setCSex(IDCardUtils.GetYcSex(policyHolderInfo.getIdentifyNumber()));
+            applicant.setCCntrNme(policyHolderInfo.getName());
+            // 增加团车标志
+            applicant.setCMassCarMrk(ycConfigureParameters.getCCntrNme());
+            name = policyHolderInfo.getName();
+            //投保人客户分类
+            applicant.setCClntMrk("1");
+        }
 
-        applicant.setCAppNme(policyHolderInfo.getName());
-        applicant.setCClntAddr(policyHolderInfo.getAddr());
-        applicant.setCMobile(policyHolderInfo.getMobile());
-        applicant.setCCertfCde(policyHolderInfo.getIdentifyNumber());
-        applicant.setCCertfCls("120001");
         applicant.setCResvTxt5("000");
-        applicant.setCClntMrk("1");
+        applicant.setCMobile(policyHolderInfo.getMobile());
         applicant.setCAreaCde("103132");
-        applicant.setTBirthday(IDCardUtils.GetBirthday(policyHolderInfo.getIdentifyNumber()));
-        applicant.setCSex(IDCardUtils.GetYcSex(policyHolderInfo.getIdentifyNumber()));
-        applicant.setCCntrNme(policyHolderInfo.getName());
+
+        //投保人姓名
+        applicant.setCAppNme(name);
+
         if(StringUtils.isNullOrEmpty(applicant.getCCntrNme())){
             applicant.setCCntrNme(policyHolderInfo.getName());
         }
-        // 增加团车标志
-        applicant.setCMassCarMrk(ycConfigureParameters.getCCntrNme());
-
-//        applicant.setCProvince(Province.buildProvince(policyHolderInfo.getAddr()));
-//        applicant.setCCity(City.buildCity(policyHolderInfo.getAddr()));
         applicant.setCRelCde(ownerInfo.getName().equals(policyHolderInfo.getName()) ? "601005" : "601008");
         applicant.setTCertfClsValiDate(policyHolderInfo.getIdentifyValidEndDate());
+
         return applicant;
     }
 

+ 39 - 10
src/main/java/com/ydtech/modules/ins/model/yc/ruote/Insured.java

@@ -1,8 +1,10 @@
 package com.ydtech.modules.ins.model.yc.ruote;
 
 import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
+import com.ydtech.exception.SystemException;
 import com.ydtech.modules.ins.model.vo.CustomerInfoVo;
 import com.ydtech.utils.IDCardUtils;
+import com.ydtech.utils.StringUtils;
 import lombok.Data;
 
 
@@ -251,26 +253,53 @@ public class Insured {
     @JacksonXmlProperty(localName = "CRelApplicantDesc")
     private String CRelApplicantDesc;
 
+    /**
+     * 行业
+     * 法人场景,代码表
+     */
+    @JacksonXmlProperty(localName = "CTrdCde")
+    private String CTrdCde;
+
 
     public static Insured buildApplicant(CustomerInfoVo ownerInfo, CustomerInfoVo insuredPersonInfo) {
 
         Insured insured = new Insured();
-
+        //被保人类型: 0:法人 1:个人(中国籍) 2: 个人(非中国籍)
+        String property = insuredPersonInfo.getProperty();
+        if ("0".equals(property)) {
+            insured.setCCertfCls("110004");
+            insured.setCCertfCde(insuredPersonInfo.getOrganizationCode());
+            if (StringUtils.isEmpty(ownerInfo.getProvince()) || StringUtils.isEmpty(ownerInfo.getCity()) || StringUtils.isEmpty(ownerInfo.getCounty())) {
+                throw new SystemException("企业车省市区必填");
+            }
+            insured.setCProvince(insuredPersonInfo.getProvince());
+            insured.setCCity(insuredPersonInfo.getCity());
+            insured.setCCounty(insuredPersonInfo.getCounty());
+            //经营范围
+//            insured.setCWorkCtt(insuredPersonInfo.getScope());
+            insured.setNResvNum3(insuredPersonInfo.getRegisteredCapital());
+            insured.setNResvNum3Cur("01");
+            insured.setCCntrNme(insuredPersonInfo.getLegalPerson());
+            insured.setCClntMrk("0");
+        } else {
+            insured.setCCertfCls("120001");
+            insured.setCCertfCde(insuredPersonInfo.getIdentifyNumber());
+            insured.setTBirthday(IDCardUtils.GetBirthday(insuredPersonInfo.getIdentifyNumber()));
+            insured.setCSex(IDCardUtils.GetYcSex(insuredPersonInfo.getIdentifyNumber()));
+            insured.setCCntrNme(insuredPersonInfo.getName());
+            insured.setCClntMrk("1");
+        }
+
+        insured.setCWorkDpt("900");
+        insured.setCTrdCde("201799");
+        insured.setCResvTxt5("000");
         insured.setCInsuredNme(insuredPersonInfo.getName());
         insured.setCClntAddr(insuredPersonInfo.getAddr());
         insured.setCMobile(insuredPersonInfo.getMobile());
-        insured.setCCertfCde(insuredPersonInfo.getIdentifyNumber());
-        insured.setCCertfCls("120001");
-        insured.setCClntMrk("1");
         insured.setCAreaCde("103132");
-        insured.setTBirthday(IDCardUtils.GetBirthday(insuredPersonInfo.getIdentifyNumber()));
-        insured.setCSex(IDCardUtils.GetYcSex(insuredPersonInfo.getIdentifyNumber()));
-
-//        insured.setCProvince(Province.buildProvince(insuredPersonInfo.getAddr()));
-//        insured.setCCity(City.buildCity(insuredPersonInfo.getAddr()));
 
         insured.setTCertfClsValiDate(insuredPersonInfo.getIdentifyValidEndDate());
-
+//        insured.setCCntrNme(insuredPersonInfo.getName());
         insured.setCRelCdes(ownerInfo.getName().equals(insuredPersonInfo.getName()) ? "601005" : "601008");
 
 

+ 15 - 3
src/main/java/com/ydtech/modules/ins/model/yc/ruote/Tax.java

@@ -139,16 +139,28 @@ public class Tax {
         tax.setTaxPayerName(policyHolderInfo.getName());
         //补交上年
         tax.setPayLastYear("0");
-        tax.setIdType("120001");
+        //0:法人 1:个人(中国籍) 2: 个人(非中国籍)
+        String property = policyHolderInfo.getProperty();
+        if (property.equals("0")) {
+            tax.setIdType("110004");
+            tax.setTaxpayerType("338003");
+            tax.setTaxpayerNO(policyHolderInfo.getOrganizationCode());
+        }else {
+            tax.setIdType("120001");
+            tax.setTaxpayerType("338001");
+            //纳税人识别号 =  投保人身份证号
+            tax.setTaxpayerNO(policyHolderInfo.getIdentifyNumber());
+        }
+//        tax.setIdType("120001");
         tax.setCalculatedType("349003001");
         tax.setVehecleTypeDetail("3490010013");
         tax.setTaxpayerAddress(policyHolderInfo.getAddr());
         tax.setVehicleQuality(extracted(carInfo.getCompleteKerbMass()));
         //纳税人识别号 =  投保人身份证号
-        tax.setTaxpayerNO(policyHolderInfo.getIdentifyNumber());
+//        tax.setTaxpayerNO(policyHolderInfo.getIdentifyNumber());
 
         tax.setVehicleType("349001001");
-        tax.setTaxpayerType("338001");
+//        tax.setTaxpayerType("338001");
         tax.setConruty("156");
         tax.setTel(policyHolderInfo.getMobile());
         tax.setExhaust(carInfo.getEnginedesc());

+ 8 - 3
src/main/java/com/ydtech/modules/ins/model/yc/ruote/Vhl.java

@@ -400,13 +400,18 @@ public class Vhl {
         vhl.setCEngNo(carInfo.getEngineNo());
         vhl.setCFrmNo(carInfo.getVinNo());
         vhl.setCPlateTyp(carInfo.getLicenseTypeCode());
-        vhl.setCUsageCde("336001");
+        if (carInfo.getCarnature().equals("01")) {
+            vhl.setCUsageCde("336002");
+        } else if (carInfo.getCarnature().equals("02")) {
+            vhl.setCUsageCde("336001");
+        }
+        //vhl.setCUsageCde("336001");
         //所属性质(1个人 2企业 3机关)
         if (carInfo.getProperty().equals("1")) {
             vhl.setCBizMrk("338001");
-        } else if (carInfo.getCarnature().equals("2")) {
+        } else if (carInfo.getProperty().equals("2")) {
             vhl.setCBizMrk("338003");
-        } else if (carInfo.getCarnature().equals("3")) {
+        } else if (carInfo.getProperty().equals("3")) {
             vhl.setCBizMrk("338002");
         }
 

+ 22 - 12
src/main/java/com/ydtech/modules/ins/model/yc/ruote/Vhlowner.java

@@ -1,8 +1,10 @@
 package com.ydtech.modules.ins.model.yc.ruote;
 
 import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
+import com.ydtech.exception.SystemException;
 import com.ydtech.modules.ins.model.vo.CustomerInfoVo;
 import com.ydtech.utils.IDCardUtils;
+import com.ydtech.utils.StringUtils;
 import lombok.Data;
 
 
@@ -107,20 +109,28 @@ public class Vhlowner {
 
         Vhlowner vhlowner = new Vhlowner();
         vhlowner.setCOwnerNme(ownerInfo.getName());
-
-        vhlowner.setTBirthday(IDCardUtils.GetBirthday(ownerInfo.getIdentifyNumber()));
-        vhlowner.setCSex(IDCardUtils.GetYcSex(ownerInfo.getIdentifyNumber()));
-
-        vhlowner.setDrvOwnerCertiCode(ownerInfo.getIdentifyNumber());
-        vhlowner.setDrvOwnerCeritType("120001");
+        //0:法人 1:个人(中国籍) 2: 个人(非中国籍)
+        String property = ownerInfo.getProperty() ;
+        if ("0".equals(property)) {
+            vhlowner.setDrvOwnerCeritType("110004");
+            vhlowner.setDrvOwnerCertiCode(ownerInfo.getOrganizationCode());
+            if (StringUtils.isEmpty(ownerInfo.getProvince()) || StringUtils.isEmpty(ownerInfo.getCity()) || StringUtils.isEmpty(ownerInfo.getCounty())) {
+                throw new SystemException("企业车省市区必填");
+            }
+            vhlowner.setCProvince(ownerInfo.getProvince());
+            vhlowner.setCCity(ownerInfo.getCity());
+            vhlowner.setCCounty(ownerInfo.getCounty());
+            vhlowner.setCOwnerCls("0");
+        }else{
+            vhlowner.setTBirthday(IDCardUtils.GetBirthday(ownerInfo.getIdentifyNumber()));
+            vhlowner.setCSex(IDCardUtils.GetYcSex(ownerInfo.getIdentifyNumber()));
+            vhlowner.setDrvOwnerCeritType("120001");
+            vhlowner.setDrvOwnerCertiCode(ownerInfo.getIdentifyNumber());
+            vhlowner.setCOwnerCls("1");
+        }
+//        vhlowner.setDrvOwnerCeritType("120001");
         vhlowner.setCAreaCde("103132");
         vhlowner.setCMobile(ownerInfo.getMobile());
-
-        vhlowner.setCOwnerCls("1");
-
-//        vhlowner.setCProvince(Province.buildProvince(ownerInfo.getAddr()));
-//        vhlowner.setCCity(City.buildCity(ownerInfo.getAddr()));
-
         vhlowner.setCWorkdptKind("900");
         //地址  自建
         vhlowner.setCWaddress(ownerInfo.getAddr());

+ 1 - 1
src/main/java/com/ydtech/modules/inv/controller/InvAccountController.java

@@ -107,7 +107,7 @@ public class InvAccountController {
     @PostMapping("insertAccount")
     public HttpResult insertInsAccount(@RequestBody InvAccount invAccount) {
         if (invAccountService.save(invAccount)) {
-            return HttpResult.ok();
+            return HttpResult.ok(invAccount);
         } else {
             return HttpResult.error();
         }

+ 9 - 2
src/main/java/com/ydtech/modules/inv/model/excel/AddTypeCXGDExcel.java

@@ -1,6 +1,7 @@
 package com.ydtech.modules.inv.model.excel;
 
 import cn.afterturn.easypoi.excel.annotation.Excel;
+import cn.afterturn.easypoi.excel.annotation.ExcelIgnore;
 import com.alibaba.excel.annotation.ExcelProperty;
 import com.baomidou.mybatisplus.annotation.TableField;
 import io.swagger.annotations.ApiModelProperty;
@@ -8,6 +9,7 @@ import lombok.Data;
 
 import java.io.Serializable;
 import java.math.BigDecimal;
+import java.util.Date;
 
 /**
  *  @version
@@ -18,8 +20,9 @@ import java.math.BigDecimal;
 @Data
 public class AddTypeCXGDExcel implements Serializable {
 
-    @Excel(name = "签单日期",isImportField = "true")
-    private String signDate;
+
+    @Excel(name = "签单日期",isImportField = "true", databaseFormat = "yyyy/MM/dd")
+    private Date signDateNew;
 
     @Excel(name = "车牌号",isImportField = "true")
     private String licenseno;
@@ -68,4 +71,8 @@ public class AddTypeCXGDExcel implements Serializable {
     @Excel(name = "类型",isImportField = "true")
     private String addType;
 
+
+    @ExcelIgnore
+    private String signDate;
+
 }

+ 8 - 2
src/main/java/com/ydtech/modules/inv/model/excel/AddTypeCXSXFExcel.java

@@ -1,6 +1,7 @@
 package com.ydtech.modules.inv.model.excel;
 
 import cn.afterturn.easypoi.excel.annotation.Excel;
+import cn.afterturn.easypoi.excel.annotation.ExcelIgnore;
 import com.alibaba.excel.annotation.ExcelProperty;
 import com.baomidou.mybatisplus.annotation.TableField;
 import io.swagger.annotations.ApiModelProperty;
@@ -10,6 +11,7 @@ import java.io.Serializable;
 import java.math.BigDecimal;
 import java.time.LocalDate;
 import java.time.LocalDateTime;
+import java.util.Date;
 
 /**
  *  @version
@@ -21,8 +23,8 @@ import java.time.LocalDateTime;
 public class AddTypeCXSXFExcel implements Serializable {
 
 
-    @Excel(name = "签单日期",isImportField = "true")
-    private String signDate;
+    @Excel(name = "签单日期",isImportField = "true", databaseFormat = "yyyy/MM/dd")
+    private Date signDateNew;
 
     @Excel(name = "车牌号",isImportField = "true")
     private String licenseno;
@@ -71,4 +73,8 @@ public class AddTypeCXSXFExcel implements Serializable {
     @Excel(name = "类型",isImportField = "true")
     private String addType;
 
+
+    @ExcelIgnore
+    private String signDate;
+
 }

+ 6 - 1
src/main/java/com/ydtech/modules/inv/model/excel/AddTypeFCGDExcel.java

@@ -1,6 +1,7 @@
 package com.ydtech.modules.inv.model.excel;
 
 import cn.afterturn.easypoi.excel.annotation.Excel;
+import cn.afterturn.easypoi.excel.annotation.ExcelIgnore;
 import com.alibaba.excel.annotation.ExcelProperty;
 import com.baomidou.mybatisplus.annotation.TableField;
 import io.swagger.annotations.ApiModelProperty;
@@ -8,6 +9,7 @@ import lombok.Data;
 
 import java.io.Serializable;
 import java.math.BigDecimal;
+import java.util.Date;
 
 /**
  *  @version
@@ -19,7 +21,7 @@ import java.math.BigDecimal;
 public class AddTypeFCGDExcel implements Serializable {
 
     @Excel(name = "签单日期",isImportField = "true")
-    private String signDate;
+    private Date signDateNew;
 
     @Excel(name = "车牌号",isImportField = "true")
     private String licenseno;
@@ -53,4 +55,7 @@ public class AddTypeFCGDExcel implements Serializable {
 
     @Excel(name = "类型",isImportField = "true")
     private String addType;
+
+    @ExcelIgnore
+    private String signDate;
 }

+ 5 - 1
src/main/java/com/ydtech/modules/inv/model/excel/AddTypeFCSXFExcel.java

@@ -1,6 +1,7 @@
 package com.ydtech.modules.inv.model.excel;
 
 import cn.afterturn.easypoi.excel.annotation.Excel;
+import cn.afterturn.easypoi.excel.annotation.ExcelIgnore;
 import com.alibaba.excel.annotation.ExcelProperty;
 import com.baomidou.mybatisplus.annotation.TableField;
 import io.swagger.annotations.ApiModelProperty;
@@ -8,6 +9,7 @@ import lombok.Data;
 
 import java.io.Serializable;
 import java.math.BigDecimal;
+import java.util.Date;
 
 /**
  *  @version
@@ -19,7 +21,7 @@ import java.math.BigDecimal;
 public class AddTypeFCSXFExcel implements Serializable {
 
     @Excel(name = "签单日期",isImportField = "true")
-    private String signDate;
+    private Date signDateNew;
 
     @Excel(name = "车牌号",isImportField = "true")
     private String licenseno;
@@ -57,4 +59,6 @@ public class AddTypeFCSXFExcel implements Serializable {
     @Excel(name = "类型",isImportField = "true")
     private String addType;
 
+    @ExcelIgnore
+    private String signDate;
 }

+ 110 - 51
src/main/java/com/ydtech/modules/inv/utils/CheckInsPlyComeUtils.java

@@ -18,9 +18,9 @@ import java.math.BigDecimal;
 import java.text.DateFormat;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
-import java.time.LocalDate;
-import java.time.LocalDateTime;
+import java.time.*;
 import java.time.format.DateTimeFormatter;
+import java.util.Date;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -183,16 +183,16 @@ public class CheckInsPlyComeUtils {
 
         Map<String,Object>  map =new HashMap<String,Object>();
         String errorMsg ="";
-        if(checkSignDate(dto.getSignDate(), "签单时间")!=null){
-            errorMsg+=checkSignDate(dto.getSignDate(), "签单时间")+"; ";
+//        if(checkSignDate(dto.getSignDate(), "签单时间")!=null){
+//            errorMsg+=checkSignDate(dto.getSignDate(), "签单时间")+"; ";
+//        }
+        if(dto.getSignDateNew()==null){
+            errorMsg+="签单日期 不能为空或格式错误,格式为yyyy-MM-dd";
         }
         //签单日期转换为 yyyy-MM-dd HH:mm:ss
-        if(StringUtils.isNotEmpty(dto.getSignDate())){
-            String singTime = pareTimeLocalDate(dto.getSignDate());
-            dto.setSignDate(singTime);
+        if(dto.getSignDateNew()!=null){
+            dto.setSignDate( pareDateToLocalTime(dto.getSignDateNew()));
         }
-
-
         if(checkIsNull(dto.getLicenseno(), "车牌号")!=null){
             errorMsg+=checkIsNull(dto.getSignDate(), "车牌号")+"; ";
         }
@@ -238,24 +238,24 @@ public class CheckInsPlyComeUtils {
         if(checkIsNull(dto.getPolicyno(), "交强保单号")!=null){
             errorMsg+=checkIsNull(dto.getPolicyno(), "交强保单号")+"; ";
         }
-        if(checkIsNull(dto.getSyPolicyno(), "商业保单号")!=null){
-            errorMsg+=checkIsNull(dto.getSyPolicyno(), "商业保单号")+"; ";
-        }
+//        if(checkIsNull(dto.getSyPolicyno(), "商业保单号")!=null){
+//            errorMsg+=checkIsNull(dto.getSyPolicyno(), "商业保单号")+"; ";
+//        }
         if(isNumeric(dto.getJqPremium(), "交强险保费")!=null){
             errorMsg+=isNumeric(dto.getJqPremium(), "交强险保费")+"; ";
         }
-        if(isNumeric(dto.getSyPremium(), "商业险保费")!=null){
-            errorMsg+=isNumeric(dto.getSyPremium(), "商业险保费")+"; ";
-        }
+//        if(isNumeric(dto.getSyPremium(), "商业险保费")!=null){
+//            errorMsg+=isNumeric(dto.getSyPremium(), "商业险保费")+"; ";
+//        }
         if(isNumeric(dto.getTaxamount(), "车船税")!=null){
             errorMsg+=isNumeric(dto.getTaxamount(), "车船税")+"; ";
         }
         if(isNumeric(dto.getJqSuperviseCostsProportion(), "交强手续费比例")!=null){
             errorMsg+=isNumeric(dto.getJqSuperviseCostsProportion(), "交强手续费比例")+"; ";
         }
-        if(isNumeric(dto.getSySuperviseCostsProportion(), "商业手续费比例")!=null){
-            errorMsg+=isNumeric(dto.getSySuperviseCostsProportion(), "商业手续费比例")+"; ";
-        }
+//        if(isNumeric(dto.getSySuperviseCostsProportion(), "商业手续费比例")!=null){
+//            errorMsg+=isNumeric(dto.getSySuperviseCostsProportion(), "商业手续费比例")+"; ";
+//        }
         if(isNumeric(dto.getCommissionFeevalue(), "手续费金额")!=null){
             errorMsg+=isNumeric(dto.getCommissionFeevalue(), "手续费金额")+"; ";
         }
@@ -283,14 +283,47 @@ public class CheckInsPlyComeUtils {
         return map;
     }
 
+    private static String pareDateToLocalTime(Date getSignDateNew) {
+        if (getSignDateNew == null) {
+            // 对传入的Date对象做判空处理,避免空指针异常,这里简单返回null,可根据实际需求调整
+            return null;
+        }
+        Instant instant = getSignDateNew.toInstant();
+        ZoneId zoneId = ZoneId.systemDefault();
+        LocalDateTime localDateTime = instant.atZone(zoneId).toLocalDateTime();
+        // 通过判断LocalDateTime的时间部分是否都是0来确定是否只包含日期(即没有时分秒)
+        boolean isOnlyDate = localDateTime.toLocalTime().equals(java.time.LocalTime.of(0, 0, 0));
+
+        if (isOnlyDate) {
+            // 说明没有时分秒,只有日期部分,按原逻辑格式化日期
+            DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+            String formattedDate = localDateTime.toLocalDate().format(dateFormatter);
+            return pareTimeLocalDate(formattedDate);
+        } else {
+            // 带有时分秒,使用包含时分秒的格式化方式,这里可以根据需求调整格式,比如"yyyy-MM-dd HH:mm:ss"
+            DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+            return localDateTime.format(dateTimeFormatter);
+        }
+    }
+
     private static String pareTimeLocalDate(String signDate) {
-        DateTimeFormatter originalFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
-        DateTimeFormatter targetFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
-        // 解析原始字符串日期为 LocalDateTime
-        LocalDateTime originalDateTime = LocalDateTime.parse(signDate, originalFormatter);
+        // 定义输入格式(仅日期)
+        DateTimeFormatter inputFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+
+        // 解析原始字符串日期为 LocalDate
+        LocalDate localDate = LocalDate.parse(signDate, inputFormatter);
+
+        // 创建一个表示午夜的 LocalTime
+        LocalTime localTime = LocalTime.MIDNIGHT; // 或者 LocalTime.of(0, 0, 0)
+
+        // 将 LocalDate 和 LocalTime 合并为 LocalDateTime
+        LocalDateTime localDateTime = localDate.atTime(localTime);
+
+        // 定义输出格式(日期和时间)
+        DateTimeFormatter outputFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+
         // 将 LocalDateTime 转换为目标格式的字符串
-        String b = originalDateTime.format(targetFormatter);
-        return b;
+        return localDateTime.format(outputFormatter);
     }
 
     /**
@@ -304,13 +337,21 @@ public class CheckInsPlyComeUtils {
 
         Map<String,Object>  map =new HashMap<String,Object>();
         String errorMsg ="";
-        if(checkSignDate(dto.getSignDate(), "签单时间")!=null){
-            errorMsg+=checkSignDate(dto.getSignDate(), "签单时间")+"; ";
+//        if(checkSignDate(dto.getSignDate(), "签单时间")!=null){
+//            errorMsg+=checkSignDate(dto.getSignDate(), "签单时间")+"; ";
+//        }
+//        //签单日期转换为 yyyy-MM-dd HH:mm:ss
+//        if(StringUtils.isNotEmpty(dto.getSignDate())){
+//            String singTime = pareTimeLocalDate(dto.getSignDate());
+//            dto.setSignDate(singTime);
+//        }
+
+        if(dto.getSignDateNew()==null){
+            errorMsg+="签单日期 不能为空或格式错误,格式为yyyy-MM-dd";
         }
         //签单日期转换为 yyyy-MM-dd HH:mm:ss
-        if(StringUtils.isNotEmpty(dto.getSignDate())){
-            String singTime = pareTimeLocalDate(dto.getSignDate());
-            dto.setSignDate(singTime);
+        if(dto.getSignDateNew()!=null){
+            dto.setSignDate( pareDateToLocalTime(dto.getSignDateNew()));
         }
 
         if(checkIsNull(dto.getLicenseno(), "车牌号")!=null){
@@ -359,24 +400,24 @@ public class CheckInsPlyComeUtils {
         if(checkIsNull(dto.getPolicyno(), "交强保单号")!=null){
             errorMsg+=checkIsNull(dto.getPolicyno(), "交强保单号")+"; ";
         }
-        if(checkIsNull(dto.getSyPolicyno(), "商业保单号")!=null){
-            errorMsg+=checkIsNull(dto.getSyPolicyno(), "商业保单号")+"; ";
-        }
+//        if(checkIsNull(dto.getSyPolicyno(), "商业保单号")!=null){
+//            errorMsg+=checkIsNull(dto.getSyPolicyno(), "商业保单号")+"; ";
+//        }
         if(isNumeric(dto.getJqPremium(), "交强险保费")!=null){
             errorMsg+=isNumeric(dto.getJqPremium(), "交强险保费")+"; ";
         }
-        if(isNumeric(dto.getSyPremium(), "商业险保费")!=null){
-            errorMsg+=isNumeric(dto.getSyPremium(), "商业险保费")+"; ";
-        }
+//        if(isNumeric(dto.getSyPremium(), "商业险保费")!=null){
+//            errorMsg+=isNumeric(dto.getSyPremium(), "商业险保费")+"; ";
+//        }
         if(isNumeric(dto.getTaxamount(), "车船税")!=null){
             errorMsg+=isNumeric(dto.getTaxamount(), "车船税")+"; ";
         }
         if(isNumeric(dto.getJqOtherCostsProportion(), "交强跟单比例")!=null){
             errorMsg+=isNumeric(dto.getJqOtherCostsProportion(), "交强跟单比例")+"; ";
         }
-        if(isNumeric(dto.getSyOtherCostsProportion(), "商业跟单比例")!=null){
-            errorMsg+=isNumeric(dto.getSyOtherCostsProportion(), "商业跟单比例")+"; ";
-        }
+//        if(isNumeric(dto.getSyOtherCostsProportion(), "商业跟单比例")!=null){
+//            errorMsg+=isNumeric(dto.getSyOtherCostsProportion(), "商业跟单比例")+"; ";
+//        }
         if(isNumeric(dto.getOtherFeevalue(), "跟单费金额")!=null){
             errorMsg+=isNumeric(dto.getOtherFeevalue(), "跟单费金额")+"; ";
         }
@@ -411,15 +452,24 @@ public class CheckInsPlyComeUtils {
      */
     public static Map<String, Object> checkDataDto3(AddTypeFCSXFExcel dto) {
 
+
         Map<String,Object>  map =new HashMap<String,Object>();
         String errorMsg ="";
-        if(checkSignDate(dto.getSignDate(), "签单时间")!=null){
-            errorMsg+=checkSignDate(dto.getSignDate(), "签单时间")+"; ";
+//        if(checkSignDate(dto.getSignDate(), "签单时间")!=null){
+//            errorMsg+=checkSignDate(dto.getSignDate(), "签单时间")+"; ";
+//        }
+//        //签单日期转换为 yyyy-MM-dd HH:mm:ss
+//        if(StringUtils.isNotEmpty(dto.getSignDate())){
+//            String singTime = pareTimeLocalDate(dto.getSignDate());
+//            dto.setSignDate(singTime);
+//        }
+
+        if(dto.getSignDateNew()==null){
+            errorMsg+="签单日期 不能为空或格式错误,格式为yyyy-MM-dd";
         }
         //签单日期转换为 yyyy-MM-dd HH:mm:ss
-        if(StringUtils.isNotEmpty(dto.getSignDate())){
-            String singTime = pareTimeLocalDate(dto.getSignDate());
-            dto.setSignDate(singTime);
+        if(dto.getSignDateNew()!=null){
+            dto.setSignDate( pareDateToLocalTime(dto.getSignDateNew()));
         }
 
         if(checkIsNull(dto.getLicenseno(), "车牌号")!=null){
@@ -506,14 +556,23 @@ public class CheckInsPlyComeUtils {
     public static Map<String, Object> checkDataDto4(AddTypeFCGDExcel dto) {
         Map<String,Object>  map =new HashMap<String,Object>();
         String errorMsg ="";
-        if(checkSignDate(dto.getSignDate(), "签单时间")!=null){
-            errorMsg+=checkSignDate(dto.getSignDate(), "签单时间")+"; ";
+//        if(checkSignDate(dto.getSignDate(), "签单时间")!=null){
+//            errorMsg+=checkSignDate(dto.getSignDate(), "签单时间")+"; ";
+//        }
+//
+//        //签单日期转换为 yyyy-MM-dd HH:mm:ss
+//        if(StringUtils.isNotEmpty(dto.getSignDate())){
+//            String singTime = pareTimeLocalDate(dto.getSignDate());
+//            dto.setSignDate(singTime);
+//        }
+        if(dto.getSignDateNew()==null){
+            errorMsg+="签单日期 不能为空或格式错误,格式为yyyy-MM-dd";
         }
         //签单日期转换为 yyyy-MM-dd HH:mm:ss
-        if(StringUtils.isNotEmpty(dto.getSignDate())){
-            String singTime = pareTimeLocalDate(dto.getSignDate());
-            dto.setSignDate(singTime);
+        if(dto.getSignDateNew()!=null){
+            dto.setSignDate( pareDateToLocalTime(dto.getSignDateNew()));
         }
+
         if(checkIsNull(dto.getLicenseno(), "车牌号")!=null){
             errorMsg+=checkIsNull(dto.getSignDate(), "车牌号")+"; ";
         }
@@ -651,9 +710,9 @@ public class CheckInsPlyComeUtils {
         if(checkIsNull(dto.getPolicyno(), "交强保单号")!=null){
             errorMsg+=checkIsNull(dto.getPolicyno(), "交强保单号")+"; ";
         }
-        if(checkIsNull(dto.getSyPolicyno(), "商业保单号")!=null){
-            errorMsg+=checkIsNull(dto.getSyPolicyno(), "商业保单号")+"; ";
-        }
+//        if(checkIsNull(dto.getSyPolicyno(), "商业保单号")!=null){
+//            errorMsg+=checkIsNull(dto.getSyPolicyno(), "商业保单号")+"; ";
+//        }
         if(checkIsNull(dto.getNoPolicyno(), "非车保单号")!=null){
             errorMsg+=checkIsNull(dto.getNoPolicyno(), "非车保单号")+"; ";
         }

+ 23 - 4
src/main/java/com/ydtech/modules/inv/utils/EasyExcelUtils.java

@@ -16,6 +16,7 @@ import com.ydtech.modules.inv.utils.excel.InvSettlementSourceDataListener;
 import com.ydtech.modules.inv.utils.excel.InvSourceDataListener;
 import lombok.SneakyThrows;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Component;
 
 import java.io.*;
@@ -40,13 +41,32 @@ public class EasyExcelUtils {
 
     //通用写入
     public static String downExcel(String uploadFilePath, Class clz, List<?> list) {
-
         String file = System.currentTimeMillis() + ".xlsx";
         String fileName = uploadFilePath + file;
         EasyExcel.write(fileName, clz).sheet("1").doWrite(list);
         return file;
     }
 
+    /**
+     * @param uploadFilePath 路劲
+     * @param fileName       文件名称
+     * @param sheetName      sheet 名称
+     * @param clz            写入类型
+     * @param list           写入数据类型
+     * @return 文件路劲
+     */
+    public static String downExcel(String uploadFilePath, String fileName, String sheetName, Class<?> clz, List<?> list) {
+        File f = new File(uploadFilePath);
+        if(!f.exists()) {
+            f.mkdirs();
+        }
+
+        String file = fileName + System.currentTimeMillis() + ".xlsx";
+        String filePath = uploadFilePath + file;
+        EasyExcel.write(filePath, clz).sheet(sheetName).doWrite(list);
+        return filePath;
+    }
+
     /**
      * 不创建对象的写
      */
@@ -202,7 +222,6 @@ public class EasyExcelUtils {
         return list;
     }
 
-
     public static String downExcel(String uploadFilePath, String fileName, Class clz, List<?> list) {
 
         String file = fileName + System.currentTimeMillis() + ".xlsx";
@@ -342,10 +361,10 @@ public class EasyExcelUtils {
 
 
     //保存流对象(输入流在第二次使用的时候会失效)
-    public byte[] saveIns(InputStream ins){
+    public byte[] saveIns(InputStream ins) {
         byte[] buf = null;
         try {
-            if(ins!=null){
+            if (ins != null) {
                 buf = org.apache.commons.io.IOUtils.toByteArray(ins);//ins为InputStream流
             }
         } catch (IOException e) {

+ 14 - 0
src/main/java/com/ydtech/modules/order/aop/QuoteNumberVerification.java

@@ -0,0 +1,14 @@
+package com.ydtech.modules.order.aop;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+@Retention(RetentionPolicy.RUNTIME)
+public @interface QuoteNumberVerification {
+
+    String value() default "";
+
+}
+
+
+

+ 42 - 4
src/main/java/com/ydtech/modules/order/aop/aspect/QuoteVerificationAspect.java

@@ -6,6 +6,7 @@ import com.ydtech.constants.enums.InsuranceRisk;
 import com.ydtech.constants.enums.dict.agreement.ProductsType;
 import com.ydtech.constants.sys.SystemConstant;
 import com.ydtech.core.page.HttpResult;
+import com.ydtech.exception.SystemException;
 import com.ydtech.modules.admin.model.SysUser;
 import com.ydtech.modules.admin.model.SysUserRole;
 import com.ydtech.modules.admin.service.SysSwitchConfigService;
@@ -21,17 +22,16 @@ import com.ydtech.modules.ins.model.vo.KindInfoVo;
 import com.ydtech.modules.ins.model.vo.QuoteRespVo;
 import com.ydtech.modules.ins.model.vo.RiskInfoVo;
 import com.ydtech.modules.order.components.InsOrdersComponents;
+import com.ydtech.modules.order.constants.QuoteNumberConstant;
 import com.ydtech.modules.order.entity.InsAreaCompany;
 import com.ydtech.modules.order.entity.InsAreaCompanyAccidentalDriving;
 import com.ydtech.modules.order.entity.InsOrders;
 import com.ydtech.modules.order.entity.po.InsAreaCompanyError;
 import com.ydtech.modules.order.entity.vo.BaseQuoteInfoVo;
 import com.ydtech.modules.order.entity.vo.BaseQuoteVo;
+import com.ydtech.modules.order.entity.vo.QuoteNumRedisVo;
 import com.ydtech.modules.order.entity.vo.SubOrderExportFeeVo;
-import com.ydtech.modules.order.service.InsAreaCompanyAccidentalDrivingService;
-import com.ydtech.modules.order.service.InsAreaCompanyErrorService;
-import com.ydtech.modules.order.service.InsAreaCompanyService;
-import com.ydtech.modules.order.service.InsOrdersService;
+import com.ydtech.modules.order.service.*;
 import com.ydtech.modules.protocol.constants.TaxSourceStatusConstants;
 import com.ydtech.modules.protocol.dao.PtlTaxSourceNewMapper;
 import com.ydtech.modules.protocol.entity.dto.TaxSourceExcludeDto;
@@ -54,8 +54,11 @@ import org.aspectj.lang.annotation.Aspect;
 import org.aspectj.lang.annotation.Before;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.data.redis.core.StringRedisTemplate;
 import org.springframework.stereotype.Component;
 
+import java.math.BigDecimal;
+import java.math.BigInteger;
 import java.util.*;
 
 @Aspect
@@ -103,6 +106,12 @@ public class QuoteVerificationAspect {
 
     private  final SysSwitchConfigService sysSwitchConfigService;
 
+    private final StringRedisTemplate redisTemplate;
+
+    private final SysQuoteConfigService sysQuoteConfigService;
+
+    private final SysQuoteRedisService sysQuoteRedisService;
+
     @AfterReturning(pointcut = "@annotation(com.ydtech.modules.order.aop.QuoteVerification)", returning = "result")
     public void doAfter(HttpResult<QuoteRespVo> result) {
         //计算费用因子
@@ -164,6 +173,35 @@ public class QuoteVerificationAspect {
                 String companyId = ((BaseQuoteVo<?>) arg).getCompanyId();
                 String agreementId = ((BaseQuoteVo<?>) arg).getAgreementId();
                 String orderno = ((BaseQuoteVo<?>) arg).getOrderNo();
+                InsOrders insOrders = insOrdersService.getById(orderno);
+                //获取用户在保险公司的报价次数
+                boolean checkQuoteLimitation = sysQuoteConfigService.checkQuoteLimitation(insOrders.getUserid(), companyId, insOrders.getLicenseno());
+                BigDecimal quoteRatio = sysQuoteRedisService.getQuoteRatio(companyId, insOrders.getUserid());
+                if(Objects.isNull(quoteRatio)){
+                    quoteRatio = new BigDecimal(BigInteger.ZERO);
+                }
+                if(checkQuoteLimitation){
+                    Integer maxQuoteNum = sysQuoteRedisService.getMaxQuoteNum(companyId, insOrders.getUserid(), insOrders.getLicenseno());
+                    System.out.printf("返回可报价次数:" + maxQuoteNum.toString());
+                    //设置最大报价次数
+                    ((BaseQuoteVo<?>) arg).setMaxQuoteNum(maxQuoteNum);
+                    ((BaseQuoteVo<?>) arg).setQuoteRatio(quoteRatio);
+                }else{
+                    //如果次数为0 则 获取出单比
+                    QuoteNumRedisVo quoteNumberRedisData = sysQuoteRedisService.getQuoteNumberRedisData(insOrders.getUserid());
+                    QuoteNumRedisVo.QuoteNumberCompanyVo quoteNumberCompanyVo = quoteNumberRedisData.getOriginalCompanyList().stream().filter(item -> item.getCompanyId().equals(companyId)).findFirst().orElse(null);
+                    if(!Objects.isNull(quoteNumberCompanyVo) && (quoteRatio.equals(BigDecimal.ZERO) || quoteNumberCompanyVo.getOrderRatio().compareTo(quoteRatio) < 0))
+                    {
+                        System.out.printf("报价比例成功:");
+                        //还可以报价 设置最大报价次数为5  报价比例为100%
+                        ((BaseQuoteVo<?>) arg).setMaxQuoteNum(5);
+                        ((BaseQuoteVo<?>) arg).setQuoteRatio(new BigDecimal(100));
+                    }else{
+                        throw new SystemException("报价次数限制!");
+                    }
+                }
+
+
                 //由于前台未传userid判断不了,从主订单表获取用户id和机构id保证待客录单和录单员录单的信息一致
                 /**
                  String deptId = ((BaseQuoteVo<?>) arg).getDeptId();

+ 1 - 1
src/main/java/com/ydtech/modules/order/components/chengtai/ChengTaiRequestApiComponents.java

@@ -211,7 +211,7 @@ public class ChengTaiRequestApiComponents {
      */
     private void verificationResponseCode(String responseCode, boolean flag, String responseMsg) {
         if (!flag){
-            throw new SystemException("验签失败");
+            throw new SystemException(responseMsg);
         }
         if (!ResponseCode.R_000.getCode().equals(responseCode) && !responseMsg.contains("重复投保") && !responseMsg.contains("录入的校验码有误")) {
             throw new SystemException(responseMsg);

+ 46 - 0
src/main/java/com/ydtech/modules/order/components/gouren/GuorenDuplicateInsuranceComponent.java

@@ -63,6 +63,14 @@ public class GuorenDuplicateInsuranceComponent {
         return "";
     }
 
+    public static String getTimelyEndDate(String rtnMsg, String regex) {
+        String endDate = getTimelyTheExpiryDate(rtnMsg, regex);
+        if (!endDate.isEmpty()) {
+            return endDate;
+        }
+        return "";
+    }
+
     /**
      * 获取终保日期
      *
@@ -84,6 +92,7 @@ public class GuorenDuplicateInsuranceComponent {
                 SimpleDateFormat dateFormat = new SimpleDateFormat(string);
                 SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
                 Date parse = dateFormat.parse(startDate);
+
                 return simpleDateFormat.format(parse);
 
             } catch (Exception e) {
@@ -93,6 +102,43 @@ public class GuorenDuplicateInsuranceComponent {
         return "";
     }
 
+
+    public static String getTimelyTheExpiryDate(String message, String regex) {
+        Pattern pattern = Pattern.compile(regex);
+        String replace = message.replace("\r", ";").replace("\n", ";").replace(" ", "");
+        Matcher m = pattern.matcher(replace);
+
+        boolean b = m.find();
+        if (b) {
+            try {
+                String startDate = "";
+                String group = m.group(2);
+                String groupRegex = "终保日期(\\d{4}-\\d{2}-\\d{2})";
+                Pattern groupPattern = Pattern.compile(groupRegex);
+                Matcher groupMatcher = groupPattern.matcher(group);
+                if(groupMatcher.find()) {
+                    startDate = groupMatcher.group(1);
+                }else{
+                    return "";
+                }
+                String string = "yyyy-MM-dd";
+                SimpleDateFormat dateFormat = new SimpleDateFormat(string);
+                SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+                Date parse = dateFormat.parse(startDate);
+                Calendar calendar = Calendar.getInstance();
+                calendar.setTime(parse);
+                calendar.add(Calendar.DAY_OF_MONTH, 1); // 加一天
+                // 获取增加一天后的日期
+                Date newDate = calendar.getTime();
+                return simpleDateFormat.format(newDate);
+
+            } catch (Exception e) {
+                throw new SystemException(message);
+            }
+        }
+        return "";
+    }
+
     /**
      * 重复投保
      *

+ 37 - 5
src/main/java/com/ydtech/modules/order/components/huatai/HuaTaiQuotationProcessorComponent.java

@@ -1,8 +1,12 @@
 package com.ydtech.modules.order.components.huatai;
 
 
+import com.ydtech.modules.order.constants.QuoteNumberConstant;
 import com.ydtech.modules.order.entity.api.huatai.request.HuaTaiQuotedPriceRequest;
 import com.ydtech.modules.order.entity.api.huatai.response.HuaTaiQuotedPriceResponse;
+import com.ydtech.modules.order.entity.po.SysQuoteRecord;
+import com.ydtech.modules.order.entity.vo.BaseQuoteInfoVo;
+import com.ydtech.modules.order.entity.vo.BaseQuoteVo;
 import lombok.RequiredArgsConstructor;
 import org.springframework.stereotype.Component;
 
@@ -25,10 +29,12 @@ public class HuaTaiQuotationProcessorComponent {
 
     private final HuaTaiRepeatInsuranceComponents huaTaiRepeatInsuranceComponents;
 
-    public HuaTaiQuotedPriceResponse handler(HuaTaiQuotedPriceRequest quotedPriceRequest, List<String> warnMessageList, String insuredCode) {
+    public HuaTaiQuotedPriceResponse handler(BaseQuoteInfoVo quoteInfoVo, HuaTaiQuotedPriceRequest quotedPriceRequest, List<String> warnMessageList, String insuredCode,
+                                             String companyId,Integer maxQuoteNum, List<SysQuoteRecord> sysQuoteRecords) {
         boolean b;
         HuaTaiQuotedPriceResponse quotedPriceResponse = huaTaiRequestApiComponents.quotedPrice(quotedPriceRequest,
                 HuaTaiQuotedPriceResponse.class,  insuredCode);
+        maxQuoteNum--;
 
         // 将报价号和校验码置空
         List<HuaTaiQuotedPriceRequest.ContractDto> contract1 = quotedPriceRequest.getBusinessData().getContract();
@@ -40,25 +46,51 @@ public class HuaTaiQuotationProcessorComponent {
         // 交强险重复投保
         b = huaTaiRepeatInsuranceComponents.compulsoryInsurance(quotedPriceRequest, quotedPriceResponse, warnMessageList);
         if (b) {
-            quotedPriceResponse = handler(quotedPriceRequest, warnMessageList, insuredCode);
+            SysQuoteRecord sysQuoteRecord = new SysQuoteRecord(quoteInfoVo.getUserid(),companyId ,quoteInfoVo.getCarInfo().getLicenseNo(),
+                    QuoteNumberConstant.QuoteAction.DATE_DEAL.getCode().toString(),QuoteNumberConstant.QuoteResult.FAIL.getCode().toString());
+            sysQuoteRecords.add(sysQuoteRecord);
+            if(maxQuoteNum <= 0){
+                return quotedPriceResponse;
+            }
+            quotedPriceResponse = handler(quoteInfoVo,quotedPriceRequest, warnMessageList, insuredCode, companyId,maxQuoteNum, sysQuoteRecords);
+
         }
 
         // 商业险重复投保
         b = huaTaiRepeatInsuranceComponents.commercialInsurance(quotedPriceRequest, quotedPriceResponse, warnMessageList);
         if (b) {
-            quotedPriceResponse = handler(quotedPriceRequest, warnMessageList, insuredCode);
+            SysQuoteRecord sysQuoteRecord = new SysQuoteRecord(quoteInfoVo.getUserid(),companyId ,quoteInfoVo.getCarInfo().getLicenseNo(),
+                    QuoteNumberConstant.QuoteAction.DATE_DEAL.getCode().toString(),QuoteNumberConstant.QuoteResult.FAIL.getCode().toString());
+            sysQuoteRecords.add(sysQuoteRecord);
+            if(maxQuoteNum <= 0){
+                return quotedPriceResponse;
+            }
+            quotedPriceResponse = handler(quoteInfoVo,quotedPriceRequest, warnMessageList, insuredCode,companyId, maxQuoteNum, sysQuoteRecords);
         }
 
         // 校验码
         b = huaTaiReinsuranceComponents.processor(quotedPriceResponse, quotedPriceRequest);
         if (b) {
-            quotedPriceResponse = handler(quotedPriceRequest, warnMessageList, insuredCode);
+            SysQuoteRecord sysQuoteRecord = new SysQuoteRecord(quoteInfoVo.getUserid(),companyId ,quoteInfoVo.getCarInfo().getLicenseNo(),
+                    QuoteNumberConstant.QuoteAction.TRANSFER_INSRUANCE.getCode().toString(),QuoteNumberConstant.QuoteResult.FAIL.getCode().toString());
+            sysQuoteRecords.add(sysQuoteRecord);
+            if(maxQuoteNum <= 0){
+                return quotedPriceResponse;
+            }
+            quotedPriceResponse = handler(quoteInfoVo,quotedPriceRequest, warnMessageList, insuredCode, companyId,maxQuoteNum, sysQuoteRecords);
         }
 
         // 校验码有误
         b = huaTaiReinsuranceComponents.processor(quotedPriceResponse);
         if (b) {
-            quotedPriceResponse = handler(quotedPriceRequest, warnMessageList, insuredCode);
+            SysQuoteRecord sysQuoteRecord = new SysQuoteRecord(quoteInfoVo.getUserid(),companyId ,quoteInfoVo.getCarInfo().getLicenseNo(),
+                    QuoteNumberConstant.QuoteAction.TRANSFER_INSRUANCE.getCode().toString(),QuoteNumberConstant.QuoteResult.FAIL.getCode().toString());
+            sysQuoteRecords.add(sysQuoteRecord);
+            if(maxQuoteNum <= 0){
+                return quotedPriceResponse;
+            }
+            quotedPriceResponse = handler(quoteInfoVo,quotedPriceRequest, warnMessageList, insuredCode, companyId,maxQuoteNum, sysQuoteRecords);
+
         }
 
 

+ 3 - 1
src/main/java/com/ydtech/modules/order/components/zhongmei/ZhongmeiRepeatInsuranceComponents.java

@@ -202,7 +202,9 @@ public class ZhongmeiRepeatInsuranceComponents {
             }
         }
 
-        return zhongmeiRequestApiComponents.quotedPrice(quotedPriceRequest, QuotedPriceResponse.class);
+        quotedPriceResponse = zhongmeiRequestApiComponents.quotedPrice(quotedPriceRequest, QuotedPriceResponse.class);
+
+        return quotedPriceResponse;
     }
 
     private QuotedPriceRequest.ContractDTO.ContractMainDTO getPeriodDate(String startDate,

+ 11 - 3
src/main/java/com/ydtech/modules/order/components/zijin/ZijinDuplicateInsuranceComponents.java

@@ -39,6 +39,8 @@ public class ZijinDuplicateInsuranceComponents extends ResponseMessageAbstractHa
 
     public static final String SY = "商业险";
 
+    public static final String TIMELY_JQ_REGEX = "(终保日期[::\\\\s]?[0-9\\\\-]+).*?(终保日期[::\\\\s]?([0-9\\\\-]+))";
+
     private final ZijinRequestApiComponents zijinRequestApiComponents;
 
 
@@ -74,10 +76,16 @@ public class ZijinDuplicateInsuranceComponents extends ResponseMessageAbstractHa
         // 关联单标识
         String calculateFlag = calculatePremiumRequest.getBaseInfo().getCalculateFlag();
 
-        // 单交强
-        if (CalculateFlagEnum.CF_2.getCode().equals(calculateFlag)) {
-            jqEndDate = GuorenDuplicateInsuranceComponent.getEndDate(rtnMsg, DAN_JQ_REGEX);
+        //及时起保的
+        if(CalculateFlagEnum.CF_2.getCode().equals(calculateFlag)){
+            jqEndDate = GuorenDuplicateInsuranceComponent.getTimelyEndDate(rtnMsg, TIMELY_JQ_REGEX);
+            if(jqEndDate.equals("")){
+                //正常的日期
+                jqEndDate = GuorenDuplicateInsuranceComponent.getEndDate(rtnMsg, DAN_JQ_REGEX);
+
+            }
         }
+
         // 交强险
         else if (rtnMsg.contains(JQ)) {
             jqEndDate = GuorenDuplicateInsuranceComponent.getEndDate(rtnMsg, JQ_REGEX);

+ 2 - 1
src/main/java/com/ydtech/modules/order/components/zijin/ZijinRequestApiComponents.java

@@ -265,7 +265,8 @@ public class ZijinRequestApiComponents {
                 Optional.ofNullable(calculatePremiumResponse.getBasePart()).map(CalculatePremiumResponse.BasePartDTO::getReinsureMessage).orElse("");
 
         if (calculatePremiumResponse.getRtnMsg().contains(HOUR_RULE) && calculatePremiumResponse.getRtnMsg().contains(MINUTE_RULE)) {
-            throw new SystemException(calculatePremiumResponse.getRtnMsg());
+            calculatePremiumResponse.setRtnCode(ResultEnum.C_4001);
+            calculatePremiumResponse.setRtnMsg(calculatePremiumResponse.getRtnMsg());
         }
 
         if (StringUtils.isNotEmpty(reinsureMessage) && !(reinsureMessage.contains(HOUR_RULE) && reinsureMessage.contains(MINUTE_RULE))) {

+ 89 - 0
src/main/java/com/ydtech/modules/order/constants/QuoteNumberConstant.java

@@ -0,0 +1,89 @@
+package com.ydtech.modules.order.constants;
+
+import com.alibaba.fastjson.JSONObject;
+import com.ydtech.modules.order.entity.po.SysQuoteConfig;
+import com.ydtech.modules.order.entity.vo.QuoteNumRedisVo;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+import lombok.var;
+import net.minidev.json.JSONArray;
+import org.springframework.data.redis.core.RedisCallback;
+import org.springframework.data.redis.core.RedisTemplate;
+import org.springframework.data.redis.core.ScanOptions;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class QuoteNumberConstant {
+    public static final String QUOTE_NUMBER_KEY = "QUOTE_NUMBER_";
+
+
+    //region 维护redis中的用户报价次数数据
+
+    @AllArgsConstructor
+    @Getter
+    public enum QuoteAuthorizeType{
+        ALL(0,"全部代理人"),
+        PART(1,"部分代理人");
+        private Integer code;
+        private String desc;
+    }
+
+
+    @AllArgsConstructor
+    @Getter
+    public enum QuoteAction{
+        QUOTE_FAILED(0,"报价失败"),
+        QUOTE_SUCCESS(1,"报价成功"),
+        DATE_DEAL(2,"重复投保处理"),
+        TRANSFER_INSRUANCE(3,"转投保");
+        private Integer code;
+        private String desc;
+
+        public static String getByCode(String code){
+            for(var item : values()){
+                if(item.getCode().toString().equals(code)){
+                    return item.desc;
+                }
+            }
+            return "";
+        }
+    }
+
+    @AllArgsConstructor
+    @Getter
+    public enum QuoteResult{
+        FAIL(0,"报价失败"),
+        SUCCESS(1,"报价成功"),
+        QUOTE_NUM_NOT_ENOUGH(2,"次数不足"),;
+        private Integer code;
+        private String desc;
+        public static String getByCode(String code){
+            for(var item : values()){
+                if(item.getCode().toString().equals(code)){
+                    return item.desc;
+                }
+            }
+            return "";
+        }
+    }
+
+    @AllArgsConstructor
+    @Getter
+    public enum QuoteStatus{
+        FAIL(0,"报价失败"),
+        SUCCESS(1,"重复投保"),
+        QUOTE_NUM_NOT_ENOUGH(2,"次数不足"),;
+        private Integer code;
+        private String desc;
+        public static String getByCode(String code){
+            for(var item : values()){
+                if(item.getCode().toString().equals(code)){
+                    return item.desc;
+                }
+            }
+            return "";
+        }
+    }
+
+}

+ 33 - 2
src/main/java/com/ydtech/modules/order/controller/ExternalOrderController.java

@@ -20,6 +20,7 @@ import com.ydtech.modules.order.service.InsTaskImagesService;
 import com.ydtech.modules.protocol.entity.po.PtlAgreement;
 import com.ydtech.modules.protocol.service.PtlAgreementService;
 import com.ydtech.modules.protocols.entity.po.PtlAgreementProductCostsNew;
+import com.ydtech.modules.protocols.entity.vo.InquiryNowFeeQueryVo;
 import com.ydtech.modules.protocols.service.PtlAgreementProductCostsNewService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -28,6 +29,7 @@ import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
+import java.util.List;
 import java.util.Objects;
 
 import static com.ydtech.modules.base.model.vo.PageVo.buildPageRequest;
@@ -194,17 +196,19 @@ public class ExternalOrderController {
     @PostMapping("/externalOrderFee")
     @ApiOperation("外部订单费用")
     public HttpResult<Object> externalOrderFee(@RequestBody ExternalOrderFeeVo externalOrderFeeVo){
-        //校验是否是外部订单的现询协议
+        //校验是否是外部订单的现询协议
         PtlAgreement ptlAgreement = ptlAgreementService.getById(externalOrderFeeVo.getAgreementId());
         ProductsType productsType = InsuranceRisk.determineInsuranceInformation(externalOrderFeeVo.getKinds(), externalOrderFeeVo.getRisks());
         externalOrderFeeVo.setProductCode(productsType.getCode());
         PtlAgreementProductCostsNew noInquiryNowFee = ptlAgreementProductCostsNewService.getNoInquiryNowFee(externalOrderFeeVo.getAgreementId(), externalOrderFeeVo.getProductCode());
         if(Objects.isNull(noInquiryNowFee)){
-            throw new SystemException("不存在该协议");
+            throw new SystemException("不存在现询费用");
         }
         externalOrderFeeVo.blank();
         ExternalOrderFeeVo resultExternalOrderFeeVo = feeRuleSchemeNewService.calcCostsExternalExportData(ptlAgreement, noInquiryNowFee, externalOrderFeeVo);
 
+        resultExternalOrderFeeVo.setCostId(noInquiryNowFee!=null?noInquiryNowFee.getId():"");
+
         return HttpResult.ok(resultExternalOrderFeeVo);
     }
 
@@ -214,4 +218,31 @@ public class ExternalOrderController {
 
         return insOrdersService.delExternalOrder(insOrdersEditingVo)? HttpResult.ok("删除成功") : HttpResult.error("删除失败");
     }
+
+    /**
+     * 外部订单非现询费用
+     */
+    @PostMapping("/externalInquiryNowFeeOrderFee")
+    @ApiOperation("外部订单非现询费用")
+    public HttpResult<Object> externalInquiryNowFeeOrderFee(@RequestBody ExternalOrderFeeVo externalOrderFeeVo){
+        PtlAgreement ptlAgreement = ptlAgreementService.getById(externalOrderFeeVo.getAgreementId());
+        ProductsType productsType = InsuranceRisk.determineInsuranceInformation(externalOrderFeeVo.getKinds(), externalOrderFeeVo.getRisks());
+        externalOrderFeeVo.setProductCode(productsType.getCode());
+        InquiryNowFeeQueryVo inquiryNowFeeQueryVo =new InquiryNowFeeQueryVo();
+        inquiryNowFeeQueryVo.setAgreementId(externalOrderFeeVo.getAgreementId());
+        inquiryNowFeeQueryVo.setProductId(productsType.getCode());
+        List<PtlAgreementProductCostsNew> inquiryNowFeeList = ptlAgreementProductCostsNewService.getInquiryNowFee(inquiryNowFeeQueryVo);
+        PtlAgreementProductCostsNew noInquiryNowFee =  new PtlAgreementProductCostsNew();
+        if(inquiryNowFeeList == null || inquiryNowFeeList.size()==0){
+            throw new SystemException("不存在非现询费用");
+        }else{
+            noInquiryNowFee = inquiryNowFeeList.get(0);
+        }
+        externalOrderFeeVo.blank();
+        ExternalOrderFeeVo resultExternalOrderFeeVo = feeRuleSchemeNewService.calcCostsExternalExportData(ptlAgreement, noInquiryNowFee, externalOrderFeeVo);
+
+        resultExternalOrderFeeVo.setCostId(noInquiryNowFee!=null?noInquiryNowFee.getId():"");
+
+        return HttpResult.ok(resultExternalOrderFeeVo);
+    }
 }

+ 7 - 0
src/main/java/com/ydtech/modules/order/controller/InsOrdersController.java

@@ -294,6 +294,13 @@ public class InsOrdersController extends BaseController {
         }
     }
 
+    @PostMapping("/exportHospitalityByChannel")
+    @ApiOperation(value = "导出用户id和订单状态查询关联渠道的订单数据")
+    public HttpResult<String> exportHospitalityByChannel(@RequestBody OrderQueryVo orderQueryVo) {
+        String downloadLink = this.insOrdersService.exportTaskPoolData(orderQueryVo, OrderLinkTypeConstants.ORDER_LINK_TYPE_CONSTANTS_1);
+        return HttpResult.ok("success", downloadLink);
+    }
+
     /**
      * @version
      * @author: hxl

+ 47 - 16
src/main/java/com/ydtech/modules/order/controller/QrCodeController.java

@@ -2,17 +2,14 @@ package com.ydtech.modules.order.controller;
 
 import cn.dev33.satoken.annotation.SaIgnore;
 import cn.hutool.core.collection.CollUtil;
-import cn.hutool.core.util.StrUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.ydtech.exception.SystemException;
 import com.ydtech.modules.admin.constants.UserConstants;
 import com.ydtech.modules.admin.model.po.SysBarcodeConfig;
 import com.ydtech.modules.admin.service.SysBarcodeConfigService;
 import com.ydtech.modules.admin.service.SysQRCodeRelationService;
-import com.ydtech.modules.admin.service.impl.SysBarcodeConfigServiceImpl;
 import com.ydtech.modules.esm.model.EsmInsCompany;
 import com.ydtech.modules.esm.service.EsmInsCompanyService;
-import com.ydtech.modules.esm.service.impl.EsmInsCompanyServiceImpl;
 import com.ydtech.modules.order.entity.InsAreaCompany;
 import com.ydtech.modules.order.entity.InsOrderQrCode;
 import com.ydtech.modules.order.entity.InsOrders;
@@ -20,7 +17,10 @@ import com.ydtech.modules.order.entity.vo.QrCodeVo;
 import com.ydtech.modules.order.service.InsAreaCompanyService;
 import com.ydtech.modules.order.service.InsOrderQrCodeService;
 import com.ydtech.modules.order.service.InsOrdersService;
-import com.ydtech.modules.protocol.entity.constants.PtlApiType;
+import com.ydtech.modules.protocol.constants.ValidStatus;
+import com.ydtech.modules.protocol.entity.po.PtlAgreement;
+import com.ydtech.modules.protocol.service.PtlAgreementService;
+import com.ydtech.utils.StringUtils;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -34,10 +34,10 @@ import org.springframework.web.servlet.view.json.MappingJackson2JsonView;
 
 import javax.annotation.Resource;
 import java.io.IOException;
-import java.text.SimpleDateFormat;
 import java.time.LocalDate;
 import java.time.LocalDateTime;
 import java.util.Date;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Objects;
 
@@ -61,6 +61,9 @@ public class QrCodeController {
     @Resource
     InsOrdersService insOrdersService;
 
+    @Resource
+    private PtlAgreementService ptlAgreementService;
+
     //二维码生成地址
     @Value("${qrcode.genAddress}")
     private String qrCodeGenAddress;
@@ -68,6 +71,7 @@ public class QrCodeController {
     //二维码生成地址
     @Value("${qrcode.imageSrc}")
     private String imageSrc;
+
     @Autowired
     private EsmInsCompanyService esmInsCompanyService;
 
@@ -133,21 +137,23 @@ public class QrCodeController {
     public Object index(String areaCompanyId) throws IOException {
         InsOrderQrCode insOrderQrCode = insOrderQrCodeService.getOne(areaCompanyId);
         InsAreaCompany insAreaCompany = insAreaCompanyService.getById(areaCompanyId);
+        if (ValidStatus.AVS_0.getCode().equals(Integer.parseInt(insAreaCompany.getCodeValidStatus()))) {
+            //重定向到错误页面中
+            return getModelAndView("费用失效,请重新报价。");
+        }
         // 根据保险公司获取二维码配置方式
         LambdaQueryWrapper<SysBarcodeConfig> wrapper = new LambdaQueryWrapper<>();
         wrapper.eq(SysBarcodeConfig::getCompanyId, insAreaCompany.getCompanyId())
                 .eq(SysBarcodeConfig::getApiType, insAreaCompany.getApiType());
         List<SysBarcodeConfig> configs = sysBarcodeConfigService.list(wrapper);
-        if (CollUtil.isEmpty(configs) || configs.size() > 1) {
+        if (CollUtil.isEmpty(getConfigs(configs)) || configs.size() > 1) {
             //重定向到错误页面中
-            ModelAndView modelAndView = new ModelAndView("qrcode_error");
-            return modelAndView;
+            return getModelAndView("配置已失效,请联系客服处理");
         }
         Integer configType = configs.get(0).getType();
         if (insOrderQrCode == null) {
             //重定向到错误页面中
-            ModelAndView modelAndView = new ModelAndView("qrcode_error");
-            return modelAndView;
+            return getModelAndView("");
         }
 
         //更新二维码扫描时间
@@ -158,8 +164,20 @@ public class QrCodeController {
         LocalDate currentDate = LocalDate.now();
         if (Math.abs(currentDate.toEpochDay() - qrcodeCreateTime.toEpochDay()) >= 1) {
             //重定向到错误页面中
-            ModelAndView modelAndView = new ModelAndView("qrcode_error");
-            return modelAndView;
+            return getModelAndView("二维码仅当天支付有效");
+        }
+
+        PtlAgreement ptlAgreement = ptlAgreementService.getById(insAreaCompany.getAgreementId());
+        // 禁用状态
+        if (ValidStatus.AVS_0.getCode().equals(Integer.parseInt(ptlAgreement.getValidStatus()))) {
+            //重定向到错误页面中
+            return getModelAndView("");
+        }
+
+        LocalDateTime endDate = ptlAgreement.getEndDate();
+        // 订单创建时间在协议失效时间之后提示错误
+        if (insAreaCompany.getCreatetime().isAfter(endDate)) {
+            return getModelAndView("");
         }
 
         if (UserConstants.CONFIG_TYPE_2.equals(configType) || UserConstants.CONFIG_TYPE_1.equals(configType)) {
@@ -199,12 +217,26 @@ public class QrCodeController {
         } else if (UserConstants.CONFIG_TYPE_0.equals(configType)) {
             return "redirect:" + insOrderQrCode.getJumpUrl();
         } else {
-            //重定向到错误页面中
-            ModelAndView modelAndView = new ModelAndView("qrcode_error");
-            return modelAndView;
+            return getModelAndView("配置已失效,请联系客服处理");
         }
     }
 
+    private static List<SysBarcodeConfig> getConfigs(List<SysBarcodeConfig> configs) {
+        return configs;
+    }
+
+    private static ModelAndView getModelAndView(String message) {
+        //重定向到错误页面中
+        ModelAndView modelAndView = new ModelAndView("qrcode_error");
+        HashMap<String, Object> map = new HashMap<>();
+        if (StringUtils.isNotEmpty(message)) {
+            map.put("message", message);
+        } else {
+            map.put("message", "协议已失效,请联系客服处理");
+        }
+        modelAndView.addAllObjects(map);
+        return modelAndView;
+    }
 
     @GetMapping(value = "/error")
     @ApiOperation(value = "错误页面显示")
@@ -212,5 +244,4 @@ public class QrCodeController {
         return "qrcode_error";
     }
 
-
 }

+ 151 - 0
src/main/java/com/ydtech/modules/order/controller/QuoteConfigController.java

@@ -0,0 +1,151 @@
+package com.ydtech.modules.order.controller;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ydtech.core.page.HttpResult;
+import com.ydtech.modules.base.controller.BaseController;
+import com.ydtech.modules.esm.model.vo.res.EsmInsCompanyResVo;
+import com.ydtech.modules.esm.service.EsmInsCompanyService;
+import com.ydtech.modules.order.constants.QuoteNumberConstant;
+import com.ydtech.modules.order.entity.po.SysQuoteConfig;
+import com.ydtech.modules.order.entity.po.SysQuoteRecord;
+import com.ydtech.modules.order.entity.po.SysQuoteUserConfigAppend;
+import com.ydtech.modules.order.entity.vo.QuoteDetailsQueryVo;
+import com.ydtech.modules.order.entity.vo.QuoteDetailsVo;
+import com.ydtech.modules.order.entity.vo.QuoteNumRedisVo;
+import com.ydtech.modules.order.service.SysQuoteConfigService;
+import com.ydtech.modules.order.service.SysQuoteRedisService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiModelProperty;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.HashMap;
+import java.util.List;
+
+@Api(tags = "报价次数配置")
+@RestController
+@RequestMapping(value = "/quoteConfig")
+public class QuoteConfigController extends BaseController {
+
+    @Autowired
+    SysQuoteConfigService sysQuoteConfigService;
+
+    @Autowired
+    SysQuoteRedisService sysQuoteRedisService;
+
+    @Autowired
+    EsmInsCompanyService esmInsCompanyService;
+
+    @GetMapping(value = "/getQuoteConfigInfo")
+    @ApiOperation(value = "获取报价配置信息")
+    public HttpResult getQuoteConfigInfo(String companyId){
+        SysQuoteConfig quoteConfigInfo = sysQuoteConfigService.getQuoteConfigInfo(companyId);
+        return HttpResult.ok(quoteConfigInfo);
+    }
+
+    @PostMapping(value = "setQuoteInfo")
+    @ApiOperation(value = "设置报价配置信息")
+    public HttpResult setQuoteInfo(@RequestBody SysQuoteConfig sysQuoteConfig){
+
+        return sysQuoteConfigService.setQuoteInfo(sysQuoteConfig) ? HttpResult.ok("设置报价配置成功") : HttpResult.error("设置报价配置失败");
+    }
+
+    @PostMapping(value = "syncQuoteInfo")
+    @ApiOperation(value = "同步报价配置信息")
+    public HttpResult syncQuoteInfo(@RequestBody SysQuoteConfig sysQuoteConfig){
+        List<EsmInsCompanyResVo> esmInsCompanyResVos = esmInsCompanyService.liveCompanyList();
+        esmInsCompanyResVos.forEach(item->{
+            sysQuoteConfig.setCompanyId(item.getId());
+            sysQuoteConfigService.setQuoteInfo(sysQuoteConfig);
+        });
+        return HttpResult.ok("同步配置成功");
+    }
+
+    @PostMapping(value = "appendUserConfig")
+    @ApiOperation(value = "用户配置追加配置信息")
+    public HttpResult appendUserCOnfig(@RequestBody SysQuoteUserConfigAppend sysQuoteUserConfigAppend){
+        return sysQuoteConfigService.quoteConfigAppend(sysQuoteUserConfigAppend)? HttpResult.ok("设置用户配置成功") : HttpResult.error("设置用户配置失败");
+    }
+
+    @PostMapping(value = "quoteDetails")
+    @ApiOperation(value = "报价明细")
+    public HttpResult quoteDetails(@RequestBody QuoteDetailsQueryVo quoteDetailsQueryVo){
+        Page page = buildPageRequest(quoteDetailsQueryVo.getPageDto());
+        Page<QuoteDetailsVo> quoteRecordPage = sysQuoteConfigService.getQuoteRecordPage(page, quoteDetailsQueryVo);
+        return HttpResult.ok(quoteRecordPage);
+    }
+
+    @PostMapping(value = "quoteUserDetails")
+    @ApiOperation(value = "报价信息")
+    public HttpResult quoteUserDetails(@RequestBody QuoteDetailsQueryVo quoteDetailsQueryVo){
+        Page page = buildPageRequest(quoteDetailsQueryVo.getPageDto());
+        Page<QuoteDetailsVo> quoteDetails = sysQuoteConfigService.getQuoteDetails(page, quoteDetailsQueryVo);
+        return HttpResult.ok(quoteDetails);
+    }
+
+    @PostMapping(value = "quoteRequestDetail")
+    @ApiOperation(value = "报价请求明细")
+    public HttpResult quoteRequestDetail(@RequestBody QuoteDetailsQueryVo quoteDetailsQueryVo){
+        Page page = buildPageRequest(quoteDetailsQueryVo.getPageDto());
+        Page<QuoteDetailsVo> quoteRecordPage = sysQuoteConfigService.getQuoteRecordPage(page, quoteDetailsQueryVo);
+        return HttpResult.ok(quoteRecordPage);
+    }
+
+    @PostMapping(value = "getAppendUserQuotePage")
+    @ApiOperation(value = "用户追加报价次数信息")
+    public HttpResult getAppendUserQuotePage(@RequestBody QuoteDetailsQueryVo quoteDetailsQueryVo){
+        Page page = buildPageRequest(quoteDetailsQueryVo.getPageDto());
+        Page<QuoteDetailsVo> quoteDetails = sysQuoteConfigService.getAppendUserQuote(page, quoteDetailsQueryVo);
+        return HttpResult.ok(quoteDetails);
+    }
+
+    @GetMapping(value = "getQuoteAction")
+    @ApiModelProperty(value = "获取报价动作字典")
+    public HttpResult getQuoteAction(){
+        JSONArray resultArray = new JSONArray();
+        for (QuoteNumberConstant.QuoteAction value : QuoteNumberConstant.QuoteAction.values()) {
+            JSONObject jsonObject = new JSONObject();
+            jsonObject.put("code",value.getCode());
+            jsonObject.put("desc",value.getDesc());
+            resultArray.add(jsonObject);
+        }
+        return HttpResult.ok(resultArray);
+    }
+
+    @GetMapping(value = "getQuoteResult")
+    @ApiModelProperty(value = "获取报价结果字典")
+    public HttpResult getQuoteResult(){
+        JSONArray resultArray = new JSONArray();
+        for (QuoteNumberConstant.QuoteResult value : QuoteNumberConstant.QuoteResult.values()) {
+            JSONObject jsonObject = new JSONObject();
+            jsonObject.put("code",value.getCode());
+            jsonObject.put("desc",value.getDesc());
+            resultArray.add(jsonObject);
+        }
+        return HttpResult.ok(resultArray);
+    }
+
+    @GetMapping(value = "getRedisData")
+    public HttpResult getRedisData(String userId) {
+        QuoteNumRedisVo quoteNumberRedisData = sysQuoteRedisService.getQuoteNumberRedisData(userId);
+        return HttpResult.ok(JSONObject.toJSON(quoteNumberRedisData));
+    }
+
+    @PostMapping(value = "setRedisData")
+    public HttpResult setRedisData(@RequestBody JSONObject jsonObject) {
+        String userId = jsonObject.getString("userId");
+        QuoteNumRedisVo data = jsonObject.getJSONObject("data").toJavaObject(QuoteNumRedisVo.class);
+        sysQuoteRedisService.setQuoteRecordRedis(userId,data);
+        return HttpResult.ok("设置成功");
+    }
+
+    @GetMapping(value = "delRedisData")
+    public HttpResult delRedisData(String userId){
+        sysQuoteRedisService.delQuoteRedis(userId);
+        return HttpResult.ok("");
+    }
+
+}

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

@@ -87,7 +87,7 @@ public class YangGuangOrderApiController {
 
     @PostMapping("/autoWriteOff")
     @ApiOperation("投保单撤销")
-    public boolean autoWriteOff(@RequestSingleParam(value = "companyId") String companyId) throws Exception {
+    public HttpResult<Object> autoWriteOff(@RequestSingleParam(value = "companyId") String companyId) throws Exception {
         return this.yangGuangOrderApiService.autoWriteOff(companyId);
     }
 

+ 9 - 0
src/main/java/com/ydtech/modules/order/dao/InsAreaCompanyMapper.java

@@ -420,6 +420,15 @@ public interface InsAreaCompanyMapper extends BaseMapper<InsAreaCompany> {
      * @return  代课录单数
      */
     HashMap<String,Object> getSumEntryStatus(@Param("taskStatisticsVo") TaskStatisticsVo taskStatisticsVo);
+
+    /**
+     *
+     * @param taskStatisticsVo
+     * @return  业务 数据保险公司
+     */
+    List<TaskStatisticsDto> getBusinessDataList(@Param("vo") TaskStatisticsVo taskStatisticsVo);
+
+
 }
 
 

+ 26 - 0
src/main/java/com/ydtech/modules/order/dao/InsOrdersMapper.java

@@ -135,6 +135,7 @@ public interface InsOrdersMapper extends BaseMapper<InsOrders> {
 
     /**
      * 查找未删除的外部订单
+     *
      * @param insOrdersEditingVo
      * @return
      */
@@ -165,4 +166,29 @@ public interface InsOrdersMapper extends BaseMapper<InsOrders> {
      * @return 被保人列表
      */
     List<String> queryInsured(@Param("queryInsuredInOrderVo") QueryLicenseInOrderVo queryInsuredInOrderVo, String userId);
+
+    /**
+     * 根据业务类型查询数据
+     *
+     * @param orderQueryVo 订单查询信息
+     * @param agentUserIds 管理人员列表
+     * @param agreeIds     管理区域
+     * @param code         业务类型
+     * @return
+     */
+    List<InsOrders> queryOrderByLinkType(
+            @Param("orderQueryVo") OrderQueryVo orderQueryVo,
+            @Param("agentUserIds") List<String> agentUserIds,
+            @Param("agreeIds") List<String> agreeIds,
+            @Param("type") Integer code,
+            @Param("flag") Boolean flag
+    );
+
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/12/16 10:34
+     *  @Description: 更新空值
+     */
+    boolean updateWithNull(InsOrders insOrders);
 }

+ 15 - 0
src/main/java/com/ydtech/modules/order/dao/SysQuoteConfigMapper.java

@@ -0,0 +1,15 @@
+package com.ydtech.modules.order.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ydtech.modules.order.entity.po.SysQuoteConfig;
+import com.ydtech.modules.order.entity.vo.dajia.InsAccidentalDrivingDajia;
+
+/**
+ * @author Administrator
+ * @description 针对表【ins_accidental_driving(驾意险)】的数据库操作Mapper
+ * @createDate 2023-03-09 14:45:58
+ * @Entity generator.domain.InsAccidentalDriving
+ */
+public interface SysQuoteConfigMapper extends BaseMapper<SysQuoteConfig> {
+
+}

+ 30 - 0
src/main/java/com/ydtech/modules/order/dao/SysQuoteRecordMapper.java

@@ -0,0 +1,30 @@
+package com.ydtech.modules.order.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ydtech.modules.order.entity.po.SysQuoteRecord;
+import com.ydtech.modules.order.entity.po.SysQuoteUser;
+import com.ydtech.modules.order.entity.vo.QuoteDetailsQueryVo;
+import com.ydtech.modules.order.entity.vo.QuoteDetailsVo;
+import org.apache.ibatis.annotations.Param;
+
+import java.math.BigDecimal;
+import java.util.List;
+
+/**
+ * @author Administrator
+ * @description 针对表【ins_accidental_driving(驾意险)】的数据库操作Mapper
+ * @createDate 2023-03-09 14:45:58
+ * @Entity generator.domain.InsAccidentalDriving
+ */
+public interface SysQuoteRecordMapper extends BaseMapper<SysQuoteRecord> {
+    public boolean insertBatch(List<SysQuoteRecord> list);
+
+    public Page<QuoteDetailsVo> getQuoteRecordPage(Page page, @Param("param") QuoteDetailsQueryVo quoteDetailsQueryVo);
+
+    public Page<QuoteDetailsVo> getQuoteRequestRecordPage(Page page,@Param("param") QuoteDetailsQueryVo quoteDetailsQueryVo);
+
+    public Page<QuoteDetailsVo> getQuoteDetails(Page page, @Param("param") QuoteDetailsQueryVo quoteDetailsQueryVo);
+
+    public BigDecimal getQuoteRatio(@Param("userId") String userId, @Param("companyId") String companyId);
+}

+ 21 - 0
src/main/java/com/ydtech/modules/order/dao/SysQuoteUserConfigAppendMapper.java

@@ -0,0 +1,21 @@
+package com.ydtech.modules.order.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ydtech.modules.order.entity.po.SysQuoteConfig;
+import com.ydtech.modules.order.entity.po.SysQuoteUserConfigAppend;
+import com.ydtech.modules.order.entity.vo.QuoteDetailsQueryVo;
+import com.ydtech.modules.order.entity.vo.QuoteDetailsVo;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * @author Administrator
+ * @description 针对表【ins_accidental_driving(驾意险)】的数据库操作Mapper
+ * @createDate 2023-03-09 14:45:58
+ * @Entity generator.domain.InsAccidentalDriving
+ */
+public interface SysQuoteUserConfigAppendMapper extends BaseMapper<SysQuoteUserConfigAppend> {
+    public Page<QuoteDetailsVo> getAppendUserQuote(Page page,@Param("param") QuoteDetailsQueryVo quoteDetailsQueryVo);
+}

+ 19 - 0
src/main/java/com/ydtech/modules/order/dao/SysQuoteUserMapper.java

@@ -0,0 +1,19 @@
+package com.ydtech.modules.order.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ydtech.modules.order.entity.po.SysQuoteConfig;
+import com.ydtech.modules.order.entity.po.SysQuoteUser;
+
+import java.util.List;
+
+/**
+ * @author Administrator
+ * @description 针对表【ins_accidental_driving(驾意险)】的数据库操作Mapper
+ * @createDate 2023-03-09 14:45:58
+ * @Entity generator.domain.InsAccidentalDriving
+ */
+public interface SysQuoteUserMapper extends BaseMapper<SysQuoteUser> {
+    public boolean insertBatch(List<SysQuoteUser> list);
+
+    public List<SysQuoteConfig> getQuoteUserConfig(String userId);
+}

+ 10 - 2
src/main/java/com/ydtech/modules/order/entity/InsAreaCompany.java

@@ -79,6 +79,14 @@ public class InsAreaCompany implements Serializable {
      */
     @TableField(value = "reqtxt", typeHandler = FastjsonTypeHandler.class)
     private JSONObject reqtxt;
+
+    /**
+     * 二维码有效状态
+     * @see com.ydtech.modules.protocol.constants.ValidStatus
+     */
+    @TableField(value = "code_valid_status")
+    private String codeValidStatus;
+
     /**
      * 响应报文
      */
@@ -573,7 +581,7 @@ public class InsAreaCompany implements Serializable {
      * 交商含增值服务合并经营成本率 阳光使用
      */
     @TableField(value = "merge_cost_rate")
-    private Double mergeCostRate;
+    private String mergeCostRate;
 
     //入口总金额
     @TableField(exist = false)
@@ -627,7 +635,7 @@ public class InsAreaCompany implements Serializable {
         this.lossRation = quoteRespVo.getLossRation();
         this.jqLossRation = quoteRespVo.getJqLossRation();
         this.syLossRation = quoteRespVo.getSyLossRation();
-        this.mergeCostRate = quoteRespVo.getMargeCostRate();
+        this.mergeCostRate = quoteRespVo.getMergeCostRate();
         // 保单号
         this.jqapplyno = quoteRespVo.getJqApplyNo();
         this.syapplyno = quoteRespVo.getSyApplyNo();

+ 6 - 0
src/main/java/com/ydtech/modules/order/entity/InsAreaCompanyExternalFee.java

@@ -49,6 +49,12 @@ public class InsAreaCompanyExternalFee implements Serializable {
     @TableField(value = "no_other_costs_proportion")
     private BigDecimal noOtherCostsProportion;
 
+    @TableField(value = "cost_id")
+    private String  costId;
+
+    @TableField(value = "cost_flag")
+    private String  costFlag;
+
 
     public BigDecimal getJqSuperviseCostsProportion() {
         return jqSuperviseCostsProportion == null ? BigDecimal.ZERO : jqSuperviseCostsProportion;

+ 3 - 3
src/main/java/com/ydtech/modules/order/entity/api/chengtai/constants/ImageTypeEnum.java

@@ -19,21 +19,21 @@ public enum ImageTypeEnum {
     }),
 
     IT_2("2", "车主身份证正面",new String[]{
-            InsuranceImageEnum.C02.getCode(),
+            InsuranceImageEnum.C02.getCode(), InsuranceImageEnum.Y02.getCode()
     }),
     IT_3("3", "车主身份证反面",new String[]{
             InsuranceImageEnum.D02.getCode(),
     }),
 
     IT_4("4", "投保人身份证正面",new String[]{
-            InsuranceImageEnum.C03.getCode(),
+            InsuranceImageEnum.C03.getCode(), InsuranceImageEnum.Y03.getCode()
     }),
     IT_5("5", "投保人身份证反面",new String[]{
             InsuranceImageEnum.D03.getCode(),
     }),
 
     IT_6("6", "被保人身份证正面",new String[]{
-            InsuranceImageEnum.C04.getCode(),
+            InsuranceImageEnum.C04.getCode(), InsuranceImageEnum.Y04.getCode()
     }),
     IT_7("7", "被保人身份证反面",new String[]{
             InsuranceImageEnum.D04.getCode(),

+ 50 - 21
src/main/java/com/ydtech/modules/order/entity/api/chengtai/request/InsurePremiumRequest.java

@@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.util.ArrayUtil;
 import com.fasterxml.jackson.annotation.JsonProperty;
 import com.ydtech.constants.enums.InsuranceRisk;
+import com.ydtech.exception.SystemException;
 import com.ydtech.modules.admin.model.vo.PersonAreaVo;
 import com.ydtech.modules.ins.model.vo.CarInfoVo;
 import com.ydtech.modules.ins.model.vo.CustomerInfoVo;
@@ -54,7 +55,6 @@ public class InsurePremiumRequest extends ChengTaiBaseRequest{
     public InsurePremiumRequest(BaseQuoteInfoVo quoteInfoVo,
                                 CarInfoResponse.CarModelListDTO carModelListDTO,
                                 QueryCarActualValueResponse carActualValueResponse,
-                                PersonAreaVo personAreaVo,
                                 ChengTaiConfigureParameters parameters,
                                 BaseQuoteVo<InsDrivingIntentionInsurance> quoteVo){
         super(parameters.getPartnerCode());
@@ -62,8 +62,20 @@ public class InsurePremiumRequest extends ChengTaiBaseRequest{
         InsuredObjectDTO insuredObject = new InsuredObjectDTO(quoteInfoVo, carModelListDTO,carActualValueResponse);
         this.insuredObject = insuredObject;
         // 客户信息
-        OwnerDTO owner = new OwnerDTO(quoteInfoVo.getOwnerInfo(), personAreaVo);
+        OwnerDTO owner = new OwnerDTO(quoteInfoVo.getOwnerInfo());
         this.owner = owner;
+        CustomerInfoVo policyHolderInfo = quoteInfoVo.getPolicyHolderInfo();
+        CustomerInfoVo insuredPersonInfo = quoteInfoVo.getInsuredPersonInfo();
+        if ("0".equals(policyHolderInfo.getProperty())){
+            if (StringUtils.isBlank(policyHolderInfo.getTel())){
+                throw new SystemException("诚泰公司企业报价固定电话必填!");
+            }
+        }
+        if ("0".equals(insuredPersonInfo.getProperty())){
+            if (StringUtils.isBlank(insuredPersonInfo.getTel())){
+                throw new SystemException("诚泰公司企业报价固定电话必填!");
+            }
+        }
         // 交强险
         Boolean isJq = InsuranceRisk.getFlagByTRAFFIC(quoteInfoVo.getRiskList());
         if (isJq){
@@ -646,25 +658,36 @@ public class InsurePremiumRequest extends ChengTaiBaseRequest{
         @JsonProperty("relationWithCar")
         private String relationWithCar;
 
-        public OwnerDTO(CustomerInfoVo ownerInfo, PersonAreaVo personAreaVo){
-            this.type = "1";
+        public OwnerDTO(CustomerInfoVo ownerInfo){
+            if ("1".equals(ownerInfo.getProperty())){
+                this.type = "1"; // 个人
+                this.identifyTypeCode = "01";
+                this.identifyTypeName = "居民身份证";
+                this.identifyNumber = ownerInfo.getIdentifyNumber();
+                this.sex = "男".equals(ownerInfo.getGender()) ? "1" : "2";
+                this.age = IDCardUtils.getAgeFromIDCard(ownerInfo.getIdentifyNumber());
+                this.birthday = IDCardUtils.GetBirthday(ownerInfo.getIdentifyNumber());
+                this.identifyValidDate = ownerInfo.getIdentifyValidDate();
+                this.identifyValidEndDate = ownerInfo.getIdentifyValidEndDate();
+                this.longTerm = "0";
+            }else{
+                if (StringUtils.isBlank(ownerInfo.getTel())){
+                    throw new SystemException("诚泰公司企业报价固定电话必填!");
+                }
+                this.type = "2"; // 机构
+                this.identifyTypeCode = "4";
+                this.identifyTypeName = "统一社会信用代码";
+                this.identifyNumber = ownerInfo.getOrganizationCode();
+            }
             this.isTerror = "0";
             this.name = ownerInfo.getName();
-            this.identifyTypeCode = "01";
-            this.identifyTypeName = "居民身份证";
-            this.identifyNumber = ownerInfo.getIdentifyNumber();
-            this.province = personAreaVo.getProvinceCode();
-            this.city = personAreaVo.getCityCode();
-            this.district = personAreaVo.getCountyCode();
-            this.addr = ownerInfo.getAddr();
-            this.mobile = ownerInfo.getMobile();
-            this.identifyValidDate = ownerInfo.getIdentifyValidDate();
-            this.identifyValidEndDate = ownerInfo.getIdentifyValidEndDate();
-            this.longTerm = "0";
-            this.sex = "男".equals(ownerInfo.getGender()) ? "1" : "2";
-            this.birthday = IDCardUtils.GetBirthday(ownerInfo.getIdentifyNumber());
-            this.relationWithInsured = "0";
-            this.relationWithCar = "1";
+//            this.province = personAreaVo.getProvinceCode();
+//            this.city = personAreaVo.getCityCode();
+//            this.district = personAreaVo.getCountyCode();
+//            this.addr = ownerInfo.getAddr();
+//            this.mobile = ownerInfo.getMobile();
+//            this.relationWithInsured = "0";
+//            this.relationWithCar = "1";
 
         }
     }
@@ -819,6 +842,7 @@ public class InsurePremiumRequest extends ChengTaiBaseRequest{
 
             public TaxDTO(BaseQuoteInfoVo quoteInfoVo){
 
+                CustomerInfoVo ownerInfo = quoteInfoVo.getOwnerInfo();
                 VehicleAndVesselTax vehicleAndVesselTax = quoteInfoVo.getVehicleAndVesselTax();
                 TaxConditionCodeEnum taxConditionCodeEnum = Enum.valueOf(TaxConditionCodeEnum.class, "T_" + vehicleAndVesselTax.getTaxRelifFlag());
                 this.taxConditionCode = taxConditionCodeEnum.getCode();
@@ -830,8 +854,13 @@ public class InsurePremiumRequest extends ChengTaiBaseRequest{
                     }
                 }
                 this.calculateMode = "1";
-                this.taxPayerIdentityNo = vehicleAndVesselTax.getIdentifyNumber();
-                this.taxPayerIdentificationCode = vehicleAndVesselTax.getIdentifyNumber();
+                if(StringUtils.isBlank(ownerInfo.getProperty()) || !"0".equals(ownerInfo.getProperty())){
+                    this.taxPayerIdentityNo = vehicleAndVesselTax.getIdentifyNumber();
+                    this.taxPayerIdentificationCode = vehicleAndVesselTax.getIdentifyNumber();
+                }else{
+                    this.taxPayerIdentityNo = vehicleAndVesselTax.getOrganizationCode();
+                    this.taxPayerIdentificationCode = vehicleAndVesselTax.getOrganizationCode();
+                }
                 this.taxPayerName = vehicleAndVesselTax.getTaxpayerName();
                 Calendar calendar = Calendar.getInstance();
                 int year = calendar.get(Calendar.YEAR);

+ 64 - 25
src/main/java/com/ydtech/modules/order/entity/api/chengtai/request/SubmitVerifyRequest.java

@@ -1,8 +1,10 @@
 package com.ydtech.modules.order.entity.api.chengtai.request;
 
+import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.fasterxml.jackson.annotation.JsonProperty;
 import com.ydtech.modules.admin.model.vo.PersonAreaVo;
+import com.ydtech.modules.ins.model.vo.CustomerInfoVo;
 import com.ydtech.modules.order.entity.InsAreaCompany;
 import com.ydtech.modules.order.entity.InsOrders;
 import com.ydtech.modules.order.entity.config.ChengTaiConfigureParameters;
@@ -83,25 +85,43 @@ public class SubmitVerifyRequest extends ChengTaiBaseRequest{
         private String addr;
         @JsonProperty("mobile")
         private String mobile;
+        @JsonProperty("organizationCode")
+        private String organizationCode;
+        @JsonProperty("tel")
+        private String tel;
+        @JsonProperty("linkerName")
+        private String linkerName;
+        @JsonProperty("unitTypeCode")
+        private String unitTypeCode;
+
 
         public ApplicantDTO(InsOrders insOrders, PersonAreaVo applyPersonAreaVo){
             // 获取投保人信息
-            JSONObject applyInfo = insOrders.getApplyinfo();
-            this.type = "1";
-            this.name = applyInfo.getString("name");
-            this.identifyTypeCode = "01";
-            this.identifyTypeName = "居民身份证";
-            this.identifyNumber = applyInfo.getString("identifyNumber");
+            CustomerInfoVo applyInfo = JSON.toJavaObject(insOrders.getApplyinfo(),CustomerInfoVo.class);
+            if("0".equals(applyInfo.getProperty())){
+                this.type = "2";
+                this.identifyTypeCode = "4";
+                this.identifyNumber = applyInfo.getOrganizationCode();
+                this.organizationCode = applyInfo.getOrganizationCode();
+                this.tel = applyInfo.getTel();
+                this.linkerName = applyInfo.getName();
+                this.unitTypeCode = "900"; // 单位性质 900:其他
+            }else{
+                this.type = "1";
+                this.identifyTypeCode = "01";
+                this.identifyNumber = applyInfo.getIdentifyNumber();
+                this.sex = IDCardUtils.GetSex(identifyNumber).equalsIgnoreCase("FEMALE") ? "2" : "1";
+                this.birthday = IDCardUtils.GetBirthday(applyInfo.getIdentifyNumber());
+            }
+            this.name = applyInfo.getName();
             this.province = applyPersonAreaVo.getProvinceCode();
             this.city = applyPersonAreaVo.getCityCode();
             this.district = applyPersonAreaVo.getCountyCode();
-            this.addr = applyInfo.getString("addr");
-            this.mobile = applyInfo.getString("mobile");
-            this.sex = IDCardUtils.GetSex(identifyNumber).equalsIgnoreCase("FEMALE") ? "2" : "1";
-            this.identifyValidDate = applyInfo.getString("identifyValidDate");
-            this.identifyValidEndDate = applyInfo.getString("identifyValidEndDate");
+            this.addr = applyInfo.getAddr();
+            this.mobile = applyInfo.getMobile();
+            this.identifyValidDate = applyInfo.getIdentifyValidDate();
+            this.identifyValidEndDate = applyInfo.getIdentifyValidEndDate();
             this.longTerm = "0";
-            this.birthday = IDCardUtils.GetBirthday(applyInfo.getString("identifyNumber"));
         }
     }
 
@@ -143,25 +163,44 @@ public class SubmitVerifyRequest extends ChengTaiBaseRequest{
         private String relationWithInsured;
         @JsonProperty("relationWithCar")
         private String relationWithCar;
+        @JsonProperty("organizationCode")
+        private String organizationCode;
+        @JsonProperty("tel")
+        private String tel;
+        @JsonProperty("linkerName")
+        private String linkerName;
+        @JsonProperty("unitTypeCode")
+        private String unitTypeCode;
 
         public InsuredDTO(InsOrders insOrders, PersonAreaVo personAreaVo){
-            // 获取被保人信息
-            JSONObject insureinfo = insOrders.getInsureinfo();
-            this.type = "1";
-            this.name = insureinfo.getString("name");
-            this.identifyTypeCode = "01";
-            this.identifyTypeName = "居民身份证";
-            this.identifyNumber = insureinfo.getString("identifyNumber");
+            // 获取投保人信息
+            CustomerInfoVo insureInfo = JSON.toJavaObject(insOrders.getInsureinfo(),CustomerInfoVo.class);
+            if("0".equals(insureInfo.getProperty())){
+                this.type = "2";
+                this.identifyTypeCode = "4";
+                this.identifyNumber = insureInfo.getOrganizationCode();
+                this.organizationCode = insureInfo.getOrganizationCode();
+                this.tel = insureInfo.getTel();
+                this.linkerName = insureInfo.getName();
+                this.unitTypeCode = "900"; // 单位性质 900:其他
+            }else{
+                this.type = "1";
+                this.identifyTypeCode = "01";
+                this.identifyNumber = insureInfo.getIdentifyNumber();
+                this.sex = IDCardUtils.GetSex(identifyNumber).equalsIgnoreCase("FEMALE") ? "2" : "1";
+                this.birthday = IDCardUtils.GetBirthday(insureInfo.getIdentifyNumber());
+                this.relationWithInsured = "0";
+                this.relationWithCar = "1";
+            }
+            this.name = insureInfo.getName();
             this.province = personAreaVo.getProvinceCode();
             this.city = personAreaVo.getCityCode();
             this.district = personAreaVo.getCountyCode();
-            this.addr = insureinfo.getString("addr");
-            this.mobile = insureinfo.getString("mobile");
-            this.sex = IDCardUtils.GetSex(identifyNumber).equalsIgnoreCase("FEMALE") ? "2" : "1";
-            this.identifyValidDate = insureinfo.getString("identifyValidDate");
-            this.identifyValidEndDate = insureinfo.getString("identifyValidEndDate");
+            this.addr = insureInfo.getAddr();
+            this.mobile = insureInfo.getMobile();
+            this.identifyValidDate = insureInfo.getIdentifyValidDate();
+            this.identifyValidEndDate = insureInfo.getIdentifyValidEndDate();
             this.longTerm = "0";
-            this.birthday = IDCardUtils.GetBirthday(insureinfo.getString("identifyNumber"));
         }
     }
 

+ 17 - 9
src/main/java/com/ydtech/modules/order/entity/api/chengtai/request/UploadFileRequest.java

@@ -46,20 +46,28 @@ public class UploadFileRequest extends ChengTaiBaseRequest{
             if(contains){
                 this.imageType = imageTypeEnum.getCode();
                 this.fileList = Arrays.asList(new FileListDTO(insTaskImagesBase64, imageTypeEnum));
-                if(InsuranceImageEnum.C01.getCode().equals(this.imageType)
-                        || InsuranceImageEnum.D01.getCode().equals(this.imageType)
-                        || InsuranceImageEnum.C02.getCode().equals(this.imageType)
-                        || InsuranceImageEnum.D02.getCode().equals(this.imageType)
-                ){
+                if(InsuranceImageEnum.C01.getCode().equals(this.imageType)){
                     this.imageObjType = "1";
-                }else if(InsuranceImageEnum.C03.getCode().equals(this.imageType)
-                        || InsuranceImageEnum.D03.getCode().equals(this.imageType)
+                }else if(InsuranceImageEnum.D01.getCode().equals(this.imageType)){
+                    this.imageObjType = "11";
+                }else if(InsuranceImageEnum.C02.getCode().equals(this.imageType)
+                    || InsuranceImageEnum.Y02.getCode().equals(this.imageType)
                 ){
                     this.imageObjType = "2";
+                } else if(InsuranceImageEnum.D02.getCode().equals(this.imageType)){
+                    this.imageObjType = "3";
+                } else if(InsuranceImageEnum.C03.getCode().equals(this.imageType)
+                        || InsuranceImageEnum.Y03.getCode().equals(this.imageType)
+                ){
+                    this.imageObjType = "4";
+                } else if(InsuranceImageEnum.D03.getCode().equals(this.imageType)){
+                    this.imageObjType = "5";
                 } else if(InsuranceImageEnum.C04.getCode().equals(this.imageType)
-                        || InsuranceImageEnum.D04.getCode().equals(this.imageType)
+                        || InsuranceImageEnum.Y04.getCode().equals(this.imageType)
                 ){
-                    this.imageObjType = "3";
+                    this.imageObjType = "6";
+                } else if(InsuranceImageEnum.D04.getCode().equals(this.imageType)){
+                    this.imageObjType = "7";
                 }
                 break;
             }

Beberapa file tidak ditampilkan karena terlalu banyak file yang berubah dalam diff ini