785834757 1 年之前
父节点
当前提交
d9b090deeb
共有 44 个文件被更改,包括 1693 次插入63 次删除
  1. 1 1
      authentication/src/main/java/com/jzg/config/JzgAuthentication.java
  2. 4 4
      authentication/src/main/java/com/jzg/controller/AuthController.java
  3. 1 1
      authentication/src/main/java/com/jzg/entity/SysUser.java
  4. 0 2
      authentication/src/main/java/com/jzg/entity/vo/LoginFormVo.java
  5. 2 2
      authentication/src/main/java/com/jzg/filter/TokenAuthenticationFilter.java
  6. 4 2
      authentication/src/main/java/com/jzg/handler/JzgAuthenticationSuccessHandler.java
  7. 5 0
      authentication/src/main/java/com/jzg/mapper/SysRolePermsMapper.java
  8. 2 2
      authentication/src/main/java/com/jzg/mapper/SysUserMapper.java
  9. 5 0
      authentication/src/main/java/com/jzg/mapper/SysUserRoleMapper.java
  10. 5 0
      authentication/src/main/java/com/jzg/service/SysUserRoleService.java
  11. 1 1
      commons/src/main/java/com/jzg/commons/config/DataPermissionInterceptor.java
  12. 53 0
      commons/src/main/java/com/jzg/commons/constants/ProductsType.java
  13. 29 0
      commons/src/main/java/com/jzg/commons/entity/scheme/po/InsBusinessInsurance.java
  14. 23 0
      commons/src/main/java/com/jzg/commons/entity/scheme/po/InsBusinessInsuranceOption.java
  15. 50 0
      commons/src/main/java/com/jzg/commons/entity/scheme/po/PtlScheme.java
  16. 30 0
      commons/src/main/java/com/jzg/commons/entity/scheme/po/PtlSchemeInfo.java
  17. 31 0
      commons/src/main/java/com/jzg/commons/entity/scheme/po/PtlSchemeInsurance.java
  18. 34 0
      commons/src/main/java/com/jzg/commons/entity/scheme/po/PtlSchemeInsuranceDrivingIntention.java
  19. 39 0
      commons/src/main/java/com/jzg/commons/entity/scheme/po/PtlSchemeRulesAttrLink.java
  20. 35 0
      commons/src/main/java/com/jzg/commons/entity/scheme/vo/InsBusinessInsuranceVo.java
  21. 59 0
      commons/src/main/java/com/jzg/commons/entity/scheme/vo/PtlSchemeInsuranceVo.java
  22. 233 0
      commons/src/main/java/com/jzg/commons/entity/scheme/vo/PtlSchemeQueryVo.java
  23. 280 0
      commons/src/main/java/com/jzg/commons/entity/scheme/vo/PtlSchemeSaveVo.java
  24. 44 0
      commons/src/main/java/com/jzg/commons/entity/scheme/vo/PtlSchemeVo.java
  25. 1 1
      platform/src/main/java/com/jzg/controller/EsmInsCompanyController.java
  26. 17 24
      platform/src/main/java/com/jzg/controller/FileUploadController.java
  27. 1 0
      platform/src/main/java/com/jzg/service/impl/SysSystemServiceImpl.java
  28. 70 0
      tenant/organization/src/main/java/com/jzg/organization/controller/SchemeController.java
  29. 23 0
      tenant/organization/src/main/java/com/jzg/organization/mapper/InsBusinessInsuranceMapper.java
  30. 11 0
      tenant/organization/src/main/java/com/jzg/organization/mapper/PtlSchemeInfoMapper.java
  31. 15 0
      tenant/organization/src/main/java/com/jzg/organization/mapper/PtlSchemeInsuranceDrivingIntentionMapper.java
  32. 20 0
      tenant/organization/src/main/java/com/jzg/organization/mapper/PtlSchemeInsuranceMapper.java
  33. 30 0
      tenant/organization/src/main/java/com/jzg/organization/mapper/PtlSchemeMapper.java
  34. 11 0
      tenant/organization/src/main/java/com/jzg/organization/mapper/PtlSchemeRulesAttrLinkMapper.java
  35. 74 0
      tenant/organization/src/main/java/com/jzg/organization/service/PtlSchemeService.java
  36. 263 0
      tenant/organization/src/main/java/com/jzg/organization/service/impl/PtlSchemeServiceImpl.java
  37. 19 16
      tenant/organization/src/main/java/com/jzg/organization/service/impl/SysActivityServiceImpl.java
  38. 2 2
      tenant/organization/src/main/java/com/jzg/organization/service/impl/SysDeptServiceImpl.java
  39. 52 0
      tenant/organization/src/main/resources/mapper/InsBusinessInsuranceMapper.xml
  40. 24 0
      tenant/organization/src/main/resources/mapper/PtlSchemeInsuranceDrivingIntentionMapper.xml
  41. 34 0
      tenant/organization/src/main/resources/mapper/PtlSchemeInsuranceMapper.xml
  42. 54 0
      tenant/organization/src/main/resources/mapper/PtlSchemeMapper.xml
  43. 1 4
      tenant/organization/src/main/resources/mapper/SysDeptMapper.xml
  44. 1 1
      tenant/organization/src/main/resources/mapper/SysUserJzgInfoMapper.xml

+ 1 - 1
authentication/src/main/java/com/jzg/config/JzgAuthentication.java

@@ -20,7 +20,7 @@ public class JzgAuthentication implements Authentication {
     public JzgAuthentication(String username, String system, Collection<? extends GrantedAuthority> authorities) {
         this.username = username;
         this.system = system;
-        this.authorities = Collections.unmodifiableCollection(authorities); // Make authorities immutable
+        this.authorities = Collections.unmodifiableCollection(authorities);
     }
 
     public void setSystem(String system){

+ 4 - 4
authentication/src/main/java/com/jzg/controller/AuthController.java

@@ -150,8 +150,8 @@ public class AuthController extends BaseController {
                 .eq(SysUser::getMobile, userName));
 
         //检验密码
-        String PASSWORD_PATTERN = "^(?=.*[A-Za-z])(?=.*\\d)[A-Za-z\\d]{8,20}$";
-        Pattern pattern = Pattern.compile(PASSWORD_PATTERN);
+        String passwordPattern = "^(?=.*[A-Za-z])(?=.*\\d)[A-Za-z\\d]{8,20}$";
+        Pattern pattern = Pattern.compile(passwordPattern);
         if(!pattern.matcher(modifyPassWordFormVo.getNewPassWord()).matches()){
             throw new SystemException("密码格式错误");
         }
@@ -185,7 +185,7 @@ public class AuthController extends BaseController {
 
     @PostMapping("changeHeadSculpture")
     @Operation(summary = "修改头像")
-    public HttpResult changeHeadSculpture(@RequestSingleParam(value = "id") String id){
+    public HttpResult<String> changeHeadSculpture(@RequestSingleParam(value = "id") String id){
         String userName = getUserName();
         SysUser sysUser = sysUserService.getOne(new LambdaQueryWrapper<SysUser>()
                 .eq(SysUser::getMobile, userName));
@@ -206,7 +206,7 @@ public class AuthController extends BaseController {
 
     @Operation(summary = "获取用户权限标识")
     @GetMapping("/getUserPer")
-    public HttpResult getUserPer(){
+    public HttpResult<List<String>> getUserPer(){
         List<String> userPerms = getUserPerms();
         return HttpResult.ok(userPerms);
     }

+ 1 - 1
authentication/src/main/java/com/jzg/entity/SysUser.java

@@ -27,6 +27,6 @@ public class SysUser extends BaseModel {
     private String headSculpture;
 
     @Schema(description = "账号状态")
-    private Integer account_status;
+    private Integer accountStatus;
 
 }

+ 0 - 2
authentication/src/main/java/com/jzg/entity/vo/LoginFormVo.java

@@ -1,7 +1,5 @@
 package com.jzg.entity.vo;
 
-//import io.swagger.annotations.ApiModel;
-//import io.swagger.annotations.ApiModelProperty;
 import io.swagger.v3.oas.annotations.media.Schema;
 import lombok.Data;
 

+ 2 - 2
authentication/src/main/java/com/jzg/filter/TokenAuthenticationFilter.java

@@ -46,8 +46,8 @@ public class TokenAuthenticationFilter extends OncePerRequestFilter {
         doList.add("/webjars/");
         String path = request.getRequestURI();
         for (String pattern : doList) {
-            // 使用正则表达式匹配
-            Pattern p = Pattern.compile(pattern + ".*");  // .* 匹配所有以 pattern 开头的路径
+            // 使用正则表达式匹配  .* 匹配所有以 pattern 开头的路径
+            Pattern p = Pattern.compile(pattern + ".*");
             if (p.matcher(path).matches() || doList.contains(path)) {
                 filterChain.doFilter(request, response);
                 return;

+ 4 - 2
authentication/src/main/java/com/jzg/handler/JzgAuthenticationSuccessHandler.java

@@ -44,8 +44,10 @@ public class JzgAuthenticationSuccessHandler implements AuthenticationSuccessHan
         Collection<? extends GrantedAuthority> authorities = authentication.getAuthorities();
         redisToken.setUsername(username);
         List<JzgGrantedAuthority> jzgGrantedAuthorities = authorities.stream()
-                .filter(authority -> ((JzgGrantedAuthority)authority).getSystem().equals(system)) // 过滤出系统的权限
-                .map(authority -> (JzgGrantedAuthority) authority) // 强制转换为 SimpleGrantedAuthority
+                // 过滤出系统的权限
+                .filter(authority -> ((JzgGrantedAuthority)authority).getSystem().equals(system))
+                // 强制转换为 SimpleGrantedAuthority
+                .map(authority -> (JzgGrantedAuthority) authority)
                 .collect(Collectors.toList());
 
         redisToken.setAuths(jzgGrantedAuthorities);

+ 5 - 0
authentication/src/main/java/com/jzg/mapper/SysRolePermsMapper.java

@@ -10,5 +10,10 @@ import java.util.List;
 @Mapper
 public interface SysRolePermsMapper extends BaseMapper<SysRolePerms> {
 
+    /**
+     * 获取用户权限
+     * @param userId    用户id
+     * @param systemId  系统id
+     */
     public List<SysRolePerms> getUserPerms(String userId, String systemId);
 }

+ 2 - 2
authentication/src/main/java/com/jzg/mapper/SysUserMapper.java

@@ -11,14 +11,14 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
 
     /**
      * 获取晋掌柜用户信息
-     * @return
+     * @param userId 用户id
+     * @param system 系统id
      */
     public SysUserJzgVo getJzgUserInfo(String userId,String system);
 
     /**
      * 获取用户信息
      * @param username
-     * @return
      */
     public SysUser selectByUserName(@Param("username") String username);
 }

+ 5 - 0
authentication/src/main/java/com/jzg/mapper/SysUserRoleMapper.java

@@ -11,6 +11,11 @@ import java.util.List;
 @Mapper
 public interface SysUserRoleMapper extends BaseMapper<SysUserRole> {
 
+    /**
+     * 获取用户数据权限
+     * @param userId    用户id
+     * @return
+     */
     List<SysRoleDataPreVo> getUserRoleDataPre(String userId);
 
 }

+ 5 - 0
authentication/src/main/java/com/jzg/service/SysUserRoleService.java

@@ -10,6 +10,11 @@ import java.util.List;
 
 public interface SysUserRoleService extends IService<SysUserRole> {
 
+    /**
+     * 获取用户的角色
+     * @param userId
+     * @return
+     */
     public List<SysUserRole> getUserRole(String userId);
 
     /**

+ 1 - 1
commons/src/main/java/com/jzg/commons/config/DataPermissionInterceptor.java

@@ -89,7 +89,7 @@ import java.util.regex.Pattern;
         }
         StringBuilder additionalSql = new StringBuilder();
         String tableName = getTableName(table);
-        if(!shouldIgnoreTable(table.getName())) {
+        if(!shouldIgnoreTable(table.getName()) && !dataScope.isEmpty()) {
             String fieldName = table.getName().equals("sys_dept") ? "id" : "dept_id";
             List<String> deptIds = new ArrayList<>();
             if (dataScope.getString("dataMark").equals("2")) {

+ 53 - 0
commons/src/main/java/com/jzg/commons/constants/ProductsType.java

@@ -0,0 +1,53 @@
+package com.jzg.commons.constants;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@AllArgsConstructor
+@Getter
+public enum ProductsType {
+
+    PT_0330("0330", "单交", 1, 0),
+    PT_034001("034001", "单商", 2, 0),
+    PT_034002("034002", "单三", 3, 0),
+    PT_0330034002("0330034002", "交三", 4, 0),
+    PT_0330034001("0330034001", "交商", 5, 0);
+
+    // 编号
+    private final String code;
+    // 说明
+    private final String desc;
+    // 排序
+    private final Integer sort;
+    // 状态  0 启用  1 不启用
+    private final Integer status;
+
+    public static ProductsType getByCode(String code) {
+        for (ProductsType value : ProductsType.values()) {
+            if (value.getCode().equals(code)) {
+                return value;
+            }
+        }
+        return null;
+    }
+
+    //根据险种返回risk信息
+    public static List<String> getRisks(String productCode){
+        List<String> risks = new ArrayList<>();
+        if(ProductsType.PT_0330.getCode().equals(productCode)
+                || ProductsType.PT_0330034002.getCode().equals(productCode)
+                || ProductsType.PT_0330034001.getCode().equals(productCode)){
+            risks.add("0507");
+        }
+        if(ProductsType.PT_034002.getCode().equals(productCode)
+                || ProductsType.PT_034001.getCode().equals(productCode)
+                || ProductsType.PT_0330034002.getCode().equals(productCode)
+                || ProductsType.PT_0330034001.getCode().equals(productCode)){
+            risks.add("0510");
+        }
+        return risks;
+    }
+}

+ 29 - 0
commons/src/main/java/com/jzg/commons/entity/scheme/po/InsBusinessInsurance.java

@@ -0,0 +1,29 @@
+package com.jzg.commons.entity.scheme.po;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+@Data
+public class InsBusinessInsurance {
+
+    private String id;
+
+    @Schema(description = "主副险id")
+    private String powerId;
+
+    @Schema(description = "商业险名称")
+    private String kindName;
+
+    @Schema(description = "别名")
+    private String alias;
+
+    @Schema(description = "商业险代码")
+    private String kindCode;
+
+    @Schema(description = "描述")
+    private String desc;
+
+    @Schema(description = "分组")
+    private String grouping;
+
+}

+ 23 - 0
commons/src/main/java/com/jzg/commons/entity/scheme/po/InsBusinessInsuranceOption.java

@@ -0,0 +1,23 @@
+package com.jzg.commons.entity.scheme.po;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+@Data
+public class InsBusinessInsuranceOption {
+
+    private String id;
+
+    @Schema(description = "商业险id")
+    private String businessId;
+
+    @Schema(description = "名称")
+    private String label;
+
+    @Schema(description = "值")
+    private String value;
+
+    @Schema(description = "排序")
+    private String sort;
+
+}

+ 50 - 0
commons/src/main/java/com/jzg/commons/entity/scheme/po/PtlScheme.java

@@ -0,0 +1,50 @@
+package com.jzg.commons.entity.scheme.po;
+
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.jzg.commons.core.base.BaseModel;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class PtlScheme extends BaseModel {
+
+    @TableId(value = "id")
+    private String id;
+
+    @Schema(description = "保险公司id")
+    private String companyId;
+
+    @Schema(description = "产品id")
+    private String productId;
+
+    @Schema(description = "产品名称")
+    private String productName;
+
+    @Schema(description = "能源类型")
+    private String energyType;
+
+    @Schema(description = "车辆类型")
+    private String vehicleType;
+
+    @Schema(description = "使用性质")
+    private String carnature;
+
+    @Schema(description = "规则描述")
+    private String ruleDesc;
+
+    @Schema(description = "优先级")
+    private String priorityLevel;
+
+    @Schema(description = "系统code")
+    private String systemCode;
+
+}
+
+
+

+ 30 - 0
commons/src/main/java/com/jzg/commons/entity/scheme/po/PtlSchemeInfo.java

@@ -0,0 +1,30 @@
+package com.jzg.commons.entity.scheme.po;
+
+
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.jzg.commons.core.base.BaseModel;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+@Data
+public class PtlSchemeInfo extends BaseModel {
+
+    @TableId(value = "id")
+    private String id;
+
+    @Schema(description = "方案类型")
+    private String schemeType;
+
+    @Schema(description = "方案id")
+    private String schemeId;
+
+    @Schema(description = "方案名称")
+    private String schemeName;
+
+    @Schema(description = "描述")
+    private String description;
+
+}
+
+
+

+ 31 - 0
commons/src/main/java/com/jzg/commons/entity/scheme/po/PtlSchemeInsurance.java

@@ -0,0 +1,31 @@
+package com.jzg.commons.entity.scheme.po;
+
+
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.jzg.commons.core.base.BaseModel;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class PtlSchemeInsurance {
+
+    @TableId(value = "id")
+    private String id;
+
+    @Schema(description = "方案id")
+    private String schemeInfoId;
+
+    @Schema(description = "险种id")
+    private String insuranceId;
+
+    @Schema(description = "选项")
+    private String optionId;
+
+
+
+}
+
+
+

+ 34 - 0
commons/src/main/java/com/jzg/commons/entity/scheme/po/PtlSchemeInsuranceDrivingIntention.java

@@ -0,0 +1,34 @@
+package com.jzg.commons.entity.scheme.po;
+
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+@Data
+public class PtlSchemeInsuranceDrivingIntention {
+
+    @TableId(value = "id")
+    private String id;
+
+    @Schema(description = "方案id")
+    private String schemeInfoId;
+
+    @Schema(description = "选中类型")
+    private String selectedStatus;
+
+    @Schema(description = "驾意险id")
+    private String drivingIntentionId;
+
+    @Schema(description = "份数")
+    private String quantity;
+
+
+    @TableField(exist = false)
+    @Schema(description = "驾意险名称")
+    private String productName;
+}
+
+
+

+ 39 - 0
commons/src/main/java/com/jzg/commons/entity/scheme/po/PtlSchemeRulesAttrLink.java

@@ -0,0 +1,39 @@
+package com.jzg.commons.entity.scheme.po;
+
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.jzg.commons.core.base.BaseModel;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@Data
+public class PtlSchemeRulesAttrLink extends BaseModel {
+
+    @TableId(value = "id")
+    private String id;
+
+    @Schema(description = "方案id")
+    private String schemeId;
+
+    @Schema(description = "协议code")
+    private String attrCode;
+
+    @Schema(description = "左操作值")
+    private String min;
+
+    @Schema(description = "运算符")
+    private String operator;
+
+    @Schema(description = "右操作值")
+    private String max;
+
+    @TableField(exist = false)
+    private List<String> minArray = new ArrayList<>();
+}
+
+
+

+ 35 - 0
commons/src/main/java/com/jzg/commons/entity/scheme/vo/InsBusinessInsuranceVo.java

@@ -0,0 +1,35 @@
+package com.jzg.commons.entity.scheme.vo;
+
+import com.jzg.commons.entity.scheme.po.InsBusinessInsuranceOption;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class InsBusinessInsuranceVo {
+
+    private String id;
+
+    @Schema(description = "主副险id")
+    private String powerId;
+
+    @Schema(description = "商业险名称")
+    private String kindName;
+
+    @Schema(description = "别名")
+    private String alias;
+
+    @Schema(description = "商业险代码")
+    private String kindCode;
+
+    @Schema(description = "描述")
+    private String desc;
+
+    @Schema(description = "分组")
+    private String grouping;
+
+    @Schema(description = "")
+    private List<InsBusinessInsuranceOption> options;
+
+}

+ 59 - 0
commons/src/main/java/com/jzg/commons/entity/scheme/vo/PtlSchemeInsuranceVo.java

@@ -0,0 +1,59 @@
+package com.jzg.commons.entity.scheme.vo;
+
+
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.jzg.commons.entity.scheme.po.PtlSchemeInsurance;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@Data
+public class PtlSchemeInsuranceVo {
+
+    @TableId(value = "id")
+    private String id;
+
+    @Schema(description = "方案id")
+    private String schemeInfoId;
+
+    @Schema(description = "险种id")
+    private String insuranceId;
+
+    @Schema(description = "险种名称")
+    private String kindName;
+
+//    @Schema(description = "选项全部数据")
+//    List<PtlSchemeInsuranceOptionVo> allOptions = new ArrayList<>();
+
+
+    @Schema(description = "选项集合")
+    List<PtlSchemeInsuranceOptionVo> optionVos = new ArrayList<>();
+
+    @Schema(description = "选项ids")
+    List<String> optionId = new ArrayList<>();
+
+
+    @Data
+    @NoArgsConstructor
+    @AllArgsConstructor
+    public static class PtlSchemeInsuranceOptionVo{
+
+        @Schema(description = "选项")
+        private String optionId;
+
+        @Schema(description = "选项名称")
+        private String optionName;
+
+
+    }
+
+
+
+}
+
+
+

+ 233 - 0
commons/src/main/java/com/jzg/commons/entity/scheme/vo/PtlSchemeQueryVo.java

@@ -0,0 +1,233 @@
+package com.jzg.commons.entity.scheme.vo;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.jzg.commons.constants.ProductsType;
+import com.jzg.commons.entity.po.PtlAgreementUndwrtRulesAttr;
+import com.jzg.commons.entity.scheme.po.*;
+import com.jzg.commons.exception.ValidateException;
+import com.jzg.commons.util.idgen.IdGenerate;
+import io.swagger.v3.oas.annotations.media.Schema;
+import jakarta.validation.constraints.NotBlank;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Objects;
+import java.util.stream.Collectors;
+
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class PtlSchemeQueryVo {
+
+    private String id;
+
+    @NotBlank(message = "保险公司id不能为空")
+    @Schema(description = "保险公司id")
+    private String companyId;
+
+    @NotBlank(message = "方案类型不能为空")
+    @Schema(description = "方案类型")
+    private Integer schemeType;
+
+    @NotBlank(message = "险种类型不能为空")
+    @Schema(description = "产品id")
+    private String productId;
+
+    @Schema(description = "方案列表")
+    private List<Scheme> schemeList = new ArrayList<>();
+
+    @Schema(description = "方案规则")
+    private List<PtlSchemeRulesAttrLink> linkList = new ArrayList<>();
+
+    @Schema(description = "回显的方案规则")
+    private List<PtlAgreementUndwrtRulesAttr> ruleAttrs = new ArrayList<>();
+
+    @Data
+    public static class Scheme{
+        private String id;
+
+//        @NotBlank(message = "方案类型不能为空")
+        @Schema(description = "方案类型")
+        private String schemeType;
+
+        @Schema(description = "方案名称")
+        private String schemeName;
+
+        @Schema(description = "描述")
+        private String description;
+
+        @Schema(description = "险种列表")
+        private List<PtlSchemeInsuranceVo> schemeInsuranceList = new ArrayList<>();
+
+        @Schema(description = "驾意险列表")
+        private List<PtlSchemeInsuranceDrivingIntention> drivingIntentionList  = new ArrayList<>();
+
+    }
+
+    public PtlSchemeQueryVo(PtlScheme ptlScheme, PtlSchemeInfo ptlSchemeInfo,
+                            List<PtlSchemeInsuranceVo> insurances, List<PtlSchemeInsuranceDrivingIntention> drivingIntentionList,
+                            List<PtlSchemeRulesAttrLink> rulesAttrLinks, List<PtlAgreementUndwrtRulesAttr> agreementRulesVo){
+        if(Objects.isNull(ptlScheme))
+        {
+            ptlScheme.setId(IdGenerate.nextId());
+        }
+        this.id = ptlScheme.getId();
+        this.companyId = ptlScheme.getCompanyId();
+        this.productId = ptlScheme.getProductId();
+        this.schemeType = Integer.parseInt(ptlSchemeInfo.getSchemeType());
+        this.schemeList = new ArrayList<>();
+        Scheme scheme = new Scheme();
+        scheme.setId(ptlSchemeInfo.getId());
+        scheme.setSchemeType(ptlSchemeInfo.getSchemeType());
+        scheme.setSchemeName(ptlSchemeInfo.getSchemeName());
+        scheme.setDescription(ptlSchemeInfo.getDescription());
+        this.schemeList.add(scheme);
+        //处理商业险
+        insurances.stream().filter(insurance-> insurance.getSchemeInfoId().equals(ptlSchemeInfo.getId())).forEach(insurance -> {
+            scheme.schemeInsuranceList.add(insurance);
+        });
+        //处理驾意险
+        drivingIntentionList.stream().filter(drivingIntention -> drivingIntention.getSchemeInfoId().equals(ptlSchemeInfo.getId())).forEach(drivingIntention -> {
+            scheme.drivingIntentionList.add(drivingIntention);
+        });
+        //处理规则
+        rulesAttrLinks.stream().filter(link -> link.getSchemeId().equals(this.id)).forEach(link->{
+            this.linkList.add(link);
+        });
+        this.ruleAttrs = agreementRulesVo;
+    }
+
+
+    public PtlSchemeQueryVo(PtlScheme ptlScheme, List<PtlSchemeInfo> ptlSchemeInfos,
+                            List<PtlSchemeQueryVo.Scheme> schemes,
+                            List<PtlSchemeRulesAttrLink> rulesAttrLinks, List<PtlAgreementUndwrtRulesAttr> agreementRulesVo){
+        if(Objects.isNull(ptlScheme))
+        {
+            ptlScheme.setId(IdGenerate.nextId());
+        }
+        this.id = ptlScheme.getId();
+        this.companyId = ptlScheme.getCompanyId();
+        this.productId = ptlScheme.getProductId();
+        if(ptlSchemeInfos.size() > 0) {
+            this.schemeType = Integer.parseInt(ptlSchemeInfos.get(0).getSchemeType());
+        }
+        this.schemeList = new ArrayList<>();
+//        ptlSchemeInfos.forEach(ptlSchemeInfo -> {
+//            schemes.stream().filter(scheme->scheme.getId().equals(ptlSchemeInfo.getId())).findFirst().get()
+//        });
+        schemeList.addAll(schemes);
+        //处理规则
+        rulesAttrLinks.stream().filter(link -> link.getSchemeId().equals(this.id)).forEach(link->{
+            this.linkList.add(link);
+        });
+        this.ruleAttrs = agreementRulesVo;
+    }
+
+    @JsonIgnore
+    public PtlScheme getPtlScheme(){
+        PtlScheme ptlScheme = new PtlScheme();
+        if(Objects.isNull(this.id) || this.id.isEmpty()){
+            this.id = IdGenerate.nextId();
+        }
+        ptlScheme.setId(id);
+        ptlScheme.setCompanyId(companyId);
+        ptlScheme.setProductId(productId);
+        ptlScheme.setProductName(ProductsType.getByCode(productId).getDesc());
+        List<PtlAgreementUndwrtRulesAttr> collect = ruleAttrs.stream().filter(x ->
+                x.getAttrCode().equals("NewEnergy") ||
+                x.getAttrCode().equals("CarClass") ||
+                x.getAttrCode().equals("NatureOfUse")).collect(Collectors.toList());
+        if(collect.size() != 3){
+            throw new ValidateException("方案规则不完整");
+        }
+        ptlScheme.setEnergyType(collect.stream().filter(x->x.getAttrCode().equals("NewEnergy")).findFirst().get().getMin());
+        ptlScheme.setCarnature(collect.stream().filter(x->x.getAttrCode().equals("CarClass")).findFirst().get().getMin());
+        ptlScheme.setVehicleType(collect.stream().filter(x->x.getAttrCode().equals("NatureOfUse")).findFirst().get().getMin());
+        return ptlScheme;
+    }
+
+    @JsonIgnore
+    public List<PtlSchemeInfo> getPtlSchemeInfoList(){
+        List<PtlSchemeInfo> ptlSchemeInfoList = new ArrayList<>();
+        for (Scheme scheme : schemeList) {
+            PtlSchemeInfo ptlSchemeInfo = new PtlSchemeInfo();
+            if(Objects.isNull(scheme.getId()) || scheme.getId().isEmpty()){
+                scheme.setId(IdGenerate.nextId());
+            }
+            ptlSchemeInfo.setId(scheme.getId());
+            ptlSchemeInfo.setSchemeId(this.id);
+            ptlSchemeInfo.setSchemeType(String.valueOf(this.schemeType));
+            ptlSchemeInfo.setSchemeName(scheme.getSchemeName());
+            ptlSchemeInfo.setDescription(scheme.getDescription());
+            ptlSchemeInfoList.add(ptlSchemeInfo);
+        }
+        return ptlSchemeInfoList;
+    }
+
+    @JsonIgnore
+    public List<PtlSchemeInsurance> getPtlSchemeInsuranceList(){
+        List<PtlSchemeInsurance> ptlSchemeInsuranceList = new ArrayList<>();
+        for (Scheme scheme : schemeList) {
+            scheme.schemeInsuranceList.forEach(schemeInsurance -> {
+                PtlSchemeInsurance ptlSchemeInsurance = new PtlSchemeInsurance();
+                ptlSchemeInsurance.setId(IdGenerate.nextId());
+                ptlSchemeInsurance.setSchemeInfoId(scheme.getId());
+                ptlSchemeInsurance.setInsuranceId(schemeInsurance.getInsuranceId());
+//                ptlSchemeInsurance.setOptionId(schemeInsurance.getOptionId());
+                ptlSchemeInsuranceList.add(ptlSchemeInsurance);
+            });
+        }
+        return ptlSchemeInsuranceList;
+    }
+
+    @JsonIgnore
+    public List<PtlSchemeInsuranceDrivingIntention> getPtlSchemeInsuranceDrivingIntentionList(){
+        List<PtlSchemeInsuranceDrivingIntention> ptlSchemeInsuranceDrivingIntentionList = new ArrayList<>();
+        for (Scheme scheme : schemeList) {
+            scheme.drivingIntentionList.forEach(drivingIntention -> {
+                PtlSchemeInsuranceDrivingIntention ptlSchemeInsuranceDrivingIntention = new PtlSchemeInsuranceDrivingIntention();
+                ptlSchemeInsuranceDrivingIntention.setId(IdGenerate.nextId());
+                ptlSchemeInsuranceDrivingIntention.setSchemeInfoId(scheme.getId());
+                ptlSchemeInsuranceDrivingIntention.setDrivingIntentionId(drivingIntention.getDrivingIntentionId());
+                ptlSchemeInsuranceDrivingIntention.setQuantity(drivingIntention.getQuantity());
+                ptlSchemeInsuranceDrivingIntentionList.add(ptlSchemeInsuranceDrivingIntention);
+            });
+        }
+        return ptlSchemeInsuranceDrivingIntentionList;
+    }
+
+    @JsonIgnore
+    public List<PtlSchemeRulesAttrLink> getPtlSchemeRulesAttrLinkList(){
+        this.linkList = this.convertAttrs(this.ruleAttrs);
+        List<PtlSchemeRulesAttrLink> links = this.linkList;
+        links.forEach(item->{
+            if(Objects.isNull(item.getId()) || item.getId().isEmpty()){
+                item.setId(IdGenerate.nextId());
+            }
+            if(Objects.isNull(item.getSchemeId()) || item.getSchemeId().isEmpty()){
+                item.setSchemeId(this.id);
+            }
+        });
+        return links;
+    }
+
+
+    private List<PtlSchemeRulesAttrLink> convertAttrs(List<PtlAgreementUndwrtRulesAttr> attrs){
+        List<PtlSchemeRulesAttrLink> links = new ArrayList<>();
+        for (PtlAgreementUndwrtRulesAttr attr : attrs) {
+            PtlSchemeRulesAttrLink link = new PtlSchemeRulesAttrLink();
+            link.setId(IdGenerate.nextId());
+            link.setSchemeId(this.id);
+            link.setAttrCode(attr.getAttrCode());
+            link.setMin(attr.getMin());
+            link.setMax(attr.getMax());
+            link.setOperator(attr.getOperator());
+            links.add(link);
+        }
+        return links;
+    }
+
+}

+ 280 - 0
commons/src/main/java/com/jzg/commons/entity/scheme/vo/PtlSchemeSaveVo.java

@@ -0,0 +1,280 @@
+package com.jzg.commons.entity.scheme.vo;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.jzg.commons.constants.ProductsType;
+import com.jzg.commons.entity.po.PtlAgreementUndwrtRulesAttr;
+import com.jzg.commons.entity.po.PtlAgreementUndwrtRulesDictLabal;
+import com.jzg.commons.entity.scheme.po.*;
+import com.jzg.commons.entity.vo.AgreementRulesVo;
+import com.jzg.commons.exception.ValidateException;
+import com.jzg.commons.util.idgen.IdGenerate;
+import io.swagger.v3.oas.annotations.media.Schema;
+import jakarta.validation.constraints.Max;
+import jakarta.validation.constraints.NotBlank;
+import jakarta.validation.constraints.NotEmpty;
+import jakarta.validation.constraints.NotNull;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import org.springframework.beans.BeanUtils;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Objects;
+import java.util.stream.Collectors;
+
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class PtlSchemeSaveVo {
+
+    private String id;
+
+    @NotBlank(message = "保险公司id不能为空")
+    @Schema(description = "保险公司id")
+    private String companyId;
+    @NotBlank(message = "方案类型不能为空")
+    @Schema(description = "方案类型")
+    private String schemeType;
+
+    @NotBlank(message = "险种类型不能为空")
+    @Schema(description = "产品id")
+    private String productId;
+
+    @Schema(description = "方案列表")
+    private List<Scheme> schemeList = new ArrayList<>();
+
+    @Schema(description = "方案规则")
+    private List<PtlSchemeRulesAttrLink> linkList = new ArrayList<>();
+
+    @Schema(description = "回显的方案规则")
+    private List<PtlAgreementUndwrtRulesAttr> ruleAttrs = new ArrayList<>();
+
+    @Data
+    public static class Scheme{
+        private String id;
+
+//        @NotBlank(message = "方案类型不能为空")
+        @Schema(description = "方案类型")
+        private String schemeType;
+
+        @NotBlank(message = "方案名称不能为空")
+        @Max(message = "方案名称不能超过50个字",value = 50)
+        @Schema(description = "方案名称")
+        private String schemeName;
+
+        @Max(message = "方案描述不能超过500个字",value = 500)
+        @Schema(description = "方案描述")
+        private String description;
+
+        @Schema(description = "险种列表")
+        private List<PtlSchemeInsuranceVo> schemeInsuranceList = new ArrayList<>();
+
+        @Schema(description = "驾意险列表")
+        private List<PtlSchemeInsuranceDrivingIntention> drivingIntentionList  = new ArrayList<>();
+
+    }
+
+    public PtlSchemeSaveVo(PtlScheme ptlScheme,PtlSchemeInfo ptlSchemeInfo,
+                           List<PtlSchemeInsuranceVo> insurances,List<PtlSchemeInsuranceDrivingIntention> drivingIntentionList,
+                           List<PtlSchemeRulesAttrLink> rulesAttrLinks,List<PtlAgreementUndwrtRulesAttr> agreementRulesVo){
+        if(Objects.isNull(ptlScheme))
+        {
+            ptlScheme.setId(IdGenerate.nextId());
+        }
+        this.id = ptlScheme.getId();
+        this.companyId = ptlScheme.getCompanyId();
+        this.productId = ptlScheme.getProductId();
+        this.schemeList = new ArrayList<>();
+        Scheme scheme = new Scheme();
+        scheme.setId(ptlSchemeInfo.getId());
+        scheme.setSchemeType(ptlSchemeInfo.getSchemeType());
+        scheme.setSchemeName(ptlSchemeInfo.getSchemeName());
+        scheme.setDescription(ptlSchemeInfo.getDescription());
+        this.schemeList.add(scheme);
+        //处理商业险
+        insurances.stream().filter(insurance-> insurance.getSchemeInfoId().equals(ptlSchemeInfo.getId())).forEach(insurance -> {
+            scheme.schemeInsuranceList.add(insurance);
+        });
+        //处理驾意险
+        drivingIntentionList.stream().filter(drivingIntention -> drivingIntention.getSchemeInfoId().equals(ptlSchemeInfo.getId())).forEach(drivingIntention -> {
+            scheme.drivingIntentionList.add(drivingIntention);
+        });
+        //处理规则
+        rulesAttrLinks.stream().filter(link -> link.getSchemeId().equals(this.id)).forEach(link->{
+            this.linkList.add(link);
+        });
+        this.ruleAttrs = agreementRulesVo;
+    }
+
+    @JsonIgnore
+    public PtlScheme getPtlScheme(List<PtlAgreementUndwrtRulesAttr> undwrtRulesAttrList){
+        PtlScheme ptlScheme = new PtlScheme();
+        if(Objects.isNull(this.id) || this.id.isEmpty()){
+            this.id = IdGenerate.nextId();
+        }
+        ptlScheme.setId(id);
+        ptlScheme.setCompanyId(companyId);
+        ptlScheme.setProductId(productId);
+        ptlScheme.setProductName(ProductsType.getByCode(productId).getDesc());
+        List<PtlAgreementUndwrtRulesAttr> collect = ruleAttrs.stream().filter(x ->
+                x.getAttrCode().equals("NewEnergy") ||
+                x.getAttrCode().equals("CarClass") ||
+                x.getAttrCode().equals("NatureOfUse")).collect(Collectors.toList());
+        if(collect.size() != 3){
+            throw new ValidateException("方案规则不完整");
+        }
+        ptlScheme.setEnergyType(collect.stream().filter(x->x.getAttrCode().equals("NewEnergy")).findFirst().get().getMin());
+        ptlScheme.setCarnature(collect.stream().filter(x->x.getAttrCode().equals("CarClass")).findFirst().get().getMin());
+        ptlScheme.setVehicleType(collect.stream().filter(x->x.getAttrCode().equals("NatureOfUse")).findFirst().get().getMin());
+        ptlScheme.setRuleDesc(buildDesc(this.getRuleAttrs(), undwrtRulesAttrList));
+
+        return ptlScheme;
+    }
+
+    @JsonIgnore
+    public List<PtlSchemeInfo> getPtlSchemeInfoList(){
+        List<PtlSchemeInfo> ptlSchemeInfoList = new ArrayList<>();
+        for (Scheme scheme : schemeList) {
+            PtlSchemeInfo ptlSchemeInfo = new PtlSchemeInfo();
+            if(Objects.isNull(scheme.getId()) || scheme.getId().isEmpty()){
+                scheme.setId(IdGenerate.nextId());
+            }
+            ptlSchemeInfo.setId(scheme.getId());
+            ptlSchemeInfo.setSchemeId(this.id);
+            ptlSchemeInfo.setSchemeType(this.schemeType);
+            ptlSchemeInfo.setSchemeName(scheme.getSchemeName());
+            ptlSchemeInfo.setDescription(scheme.getDescription());
+            ptlSchemeInfoList.add(ptlSchemeInfo);
+        }
+        return ptlSchemeInfoList;
+    }
+
+    private String buildDesc(List<PtlAgreementUndwrtRulesAttr> linkList, List<PtlAgreementUndwrtRulesAttr> undwrtRulesAttrList) {
+        StringBuilder desc = new StringBuilder();
+        for (int i = 0; i < linkList.size(); i++) {
+            int finalI = i;
+            PtlAgreementUndwrtRulesAttr ptlAgreementUndwrtRulesAttr = undwrtRulesAttrList.stream()
+                    .filter(x -> x.getAttrCode().equals(linkList.get(finalI).getAttrCode()))
+                    .findAny()
+                    .get();
+            //数值范围判断
+
+            if ("inputNumber".equals(ptlAgreementUndwrtRulesAttr.getAttrType())) {
+                desc.append(inputNumberIdentifying(ptlAgreementUndwrtRulesAttr, linkList.get(i))).append("\n");
+            }
+            if ("radio".equals(ptlAgreementUndwrtRulesAttr.getAttrType())) {
+                desc.append(radioIdentifying(ptlAgreementUndwrtRulesAttr, linkList.get(i))).append("\n");
+            }
+            if ("checkbox".equals(ptlAgreementUndwrtRulesAttr.getAttrType()) || "select".equals(ptlAgreementUndwrtRulesAttr.getAttrType())) {
+                if(linkList.get(i).getMinArray() != null && linkList.get(i).getMinArray().length > 0){
+                    desc.append(ptlAgreementUndwrtRulesAttr.getAttrName()).append("包含").append(String.join(",",Arrays.asList(linkList.get(i).getMinArray()))).append("\n");
+                }else{
+                    desc.append(ptlAgreementUndwrtRulesAttr.getAttrName()).append("包含").append(linkList.get(i).getMin()).append("\n");
+                }
+            }
+            if ("inputTag".equals(ptlAgreementUndwrtRulesAttr.getAttrType())) {
+                if (linkList.get(i).getOperator() != null && linkList.get(i).getOperator().equals("1")) {
+                    desc.append(ptlAgreementUndwrtRulesAttr.getAttrName()).append("包含").append(linkList.get(i).getMin()).append("\n");
+                } else {
+                    desc.append(ptlAgreementUndwrtRulesAttr.getAttrName()).append("不包含").append(linkList.get(i).getMin()).append("\n");
+                }
+            }
+        }
+        return desc.toString();
+    }
+
+    private String radioIdentifying(PtlAgreementUndwrtRulesAttr ptlAgreementUndwrtRulesAttr, PtlAgreementUndwrtRulesAttr ptlAgreementProductCostsAttrLink) {
+        PtlAgreementUndwrtRulesDictLabal ptlAgreementUndwrtRulesDictLabal = ptlAgreementUndwrtRulesAttr.getDictLabal().stream().filter(x -> x.getCode().equals(ptlAgreementProductCostsAttrLink.getMin())).findAny().get();
+        return ptlAgreementUndwrtRulesAttr.getAttrName() + "为" + ptlAgreementUndwrtRulesDictLabal.getName();
+    }
+
+    private String inputNumberIdentifying(PtlAgreementUndwrtRulesAttr ptlAgreementUndwrtRulesAttr, PtlAgreementUndwrtRulesAttr ptlAgreementProductCostsAttrLink) {
+        if ("1".equals(ptlAgreementProductCostsAttrLink.getOperator())) {
+            return ptlAgreementUndwrtRulesAttr.getAttrCode() + "范围值" + ptlAgreementProductCostsAttrLink.getMin() + "到" + ptlAgreementProductCostsAttrLink.getMax();
+        } else if ("2".equals(ptlAgreementProductCostsAttrLink.getOperator())) {
+            return ptlAgreementUndwrtRulesAttr.getAttrName() + "小于" + ptlAgreementProductCostsAttrLink.getMin();
+        } else if ("3".equals(ptlAgreementProductCostsAttrLink.getOperator())) {
+            return ptlAgreementUndwrtRulesAttr.getAttrName() + "小于等于" + ptlAgreementProductCostsAttrLink.getMin();
+        } else if ("4".equals(ptlAgreementProductCostsAttrLink.getOperator())) {
+            return ptlAgreementUndwrtRulesAttr.getAttrName() + "大于" + ptlAgreementProductCostsAttrLink.getMax();
+        } else if ("5".equals(ptlAgreementProductCostsAttrLink.getOperator())) {
+            return ptlAgreementUndwrtRulesAttr.getAttrName() + "大于等于" + ptlAgreementProductCostsAttrLink.getMax();
+        }
+        return "";
+    }
+
+    @JsonIgnore
+    public List<PtlSchemeInsurance> getPtlSchemeInsuranceList(){
+        List<PtlSchemeInsurance> ptlSchemeInsuranceList = new ArrayList<>();
+        for (Scheme scheme : schemeList) {
+            scheme.schemeInsuranceList.forEach(schemeInsurance -> {
+                schemeInsurance.getOptionId().forEach(optionId ->{
+                    PtlSchemeInsurance ptlSchemeInsurance = new PtlSchemeInsurance();
+                    if(Objects.isNull(scheme.getId()) || scheme.getId().isEmpty()) {
+                        ptlSchemeInsurance.setId(IdGenerate.nextId());
+                    }
+                    ptlSchemeInsurance.setSchemeInfoId(scheme.getId());
+                    ptlSchemeInsurance.setInsuranceId(schemeInsurance.getInsuranceId());
+                    ptlSchemeInsurance.setOptionId(optionId);
+                    ptlSchemeInsuranceList.add(ptlSchemeInsurance);
+                });
+            });
+        }
+        return ptlSchemeInsuranceList;
+    }
+
+    @JsonIgnore
+    public List<PtlSchemeInsuranceDrivingIntention> getPtlSchemeInsuranceDrivingIntentionList(){
+        List<PtlSchemeInsuranceDrivingIntention> ptlSchemeInsuranceDrivingIntentionList = new ArrayList<>();
+        for (Scheme scheme : schemeList) {
+            scheme.drivingIntentionList.forEach(drivingIntention -> {
+                PtlSchemeInsuranceDrivingIntention ptlSchemeInsuranceDrivingIntention = new PtlSchemeInsuranceDrivingIntention();
+                ptlSchemeInsuranceDrivingIntention.setId(IdGenerate.nextId());
+                ptlSchemeInsuranceDrivingIntention.setSchemeInfoId(scheme.getId());
+                ptlSchemeInsuranceDrivingIntention.setSelectedStatus(drivingIntention.getSelectedStatus());
+                ptlSchemeInsuranceDrivingIntention.setDrivingIntentionId(drivingIntention.getDrivingIntentionId());
+                ptlSchemeInsuranceDrivingIntention.setQuantity(drivingIntention.getQuantity());
+                ptlSchemeInsuranceDrivingIntentionList.add(ptlSchemeInsuranceDrivingIntention);
+            });
+        }
+        return ptlSchemeInsuranceDrivingIntentionList;
+    }
+
+    @JsonIgnore
+    public List<PtlSchemeRulesAttrLink> getPtlSchemeRulesAttrLinkList(){
+        this.linkList = this.convertAttrs(this.ruleAttrs);
+        List<PtlSchemeRulesAttrLink> links = this.linkList;
+        links.forEach(item->{
+            if(Objects.isNull(item.getId()) || item.getId().isEmpty()){
+                item.setId(IdGenerate.nextId());
+            }
+            if(Objects.isNull(item.getSchemeId()) || item.getSchemeId().isEmpty()){
+                item.setSchemeId(this.id);
+            }
+        });
+        return links;
+    }
+
+
+    private List<PtlSchemeRulesAttrLink> convertAttrs(List<PtlAgreementUndwrtRulesAttr> attrs){
+        List<PtlSchemeRulesAttrLink> links = new ArrayList<>();
+        for (PtlAgreementUndwrtRulesAttr attr : attrs) {
+            PtlSchemeRulesAttrLink link = new PtlSchemeRulesAttrLink();
+            link.setId(IdGenerate.nextId());
+            link.setSchemeId(this.id);
+            link.setAttrCode(attr.getAttrCode());
+            if(Objects.nonNull(attr.getMinArray()) && attr.getMinArray().length > 0){
+                link.setMin(String.join(",",Arrays.asList(attr.getMinArray())));
+            }else{
+                link.setMin(attr.getMin());
+            }
+            link.setMax(attr.getMax());
+            link.setOperator(attr.getOperator());
+            links.add(link);
+        }
+        return links;
+    }
+
+}

+ 44 - 0
commons/src/main/java/com/jzg/commons/entity/scheme/vo/PtlSchemeVo.java

@@ -0,0 +1,44 @@
+package com.jzg.commons.entity.scheme.vo;
+
+import com.jzg.commons.core.base.PageRequest;
+import com.jzg.commons.entity.scheme.po.PtlScheme;
+import com.jzg.commons.entity.scheme.po.PtlSchemeInfo;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class PtlSchemeVo extends PageRequest {
+
+    private String id;
+
+    @Schema(description = "保险公司id")
+    private String companyId;
+
+    @Schema(description = "产品id")
+    private String productId;
+
+    @Schema(description = "描述")
+    private String description;
+
+    @Schema(description = "方案主id")
+    private String schemeId;
+
+    @Schema(description = "方案名称")
+    private String schemeName;
+
+    @Schema(description = "方案类型")
+    private String schemeType;
+
+    @Schema(description = "险种")
+    private String productName;
+
+    @Schema(description = "驾意险数量")
+    private String drivingIntentionNum;
+
+    @Schema(description = "规则描述")
+    private String ruleDesc;
+
+
+}

+ 1 - 1
platform/src/main/java/com/jzg/controller/EsmInsCompanyController.java

@@ -114,7 +114,7 @@ public class EsmInsCompanyController extends BaseController {
     @Operation(summary = "查询下级机构列表")
     @PostMapping(value = "/selectList")
     public HttpResult<List<EsmInsCompany>> selectList(@RequestParam String parentid) {
-        if (StringUtils.isEmpty(parentid)) parentid = "0";
+        parentid = StringUtils.isEmpty(parentid) ? "0" : parentid;
         LambdaQueryWrapper<EsmInsCompany> lqw = new LambdaQueryWrapper<>();
         lqw.eq(EsmInsCompany::getParentId, parentid);
         List<EsmInsCompany> selectList = esmInsCompanyService.list(lqw);

+ 17 - 24
platform/src/main/java/com/jzg/controller/FileUploadController.java

@@ -49,29 +49,21 @@ public class FileUploadController extends BaseController {
         System.out.printf("调用文件上传接口");
         try {
             // 获取文件原始名称和扩展名
-            System.out.printf("1111111111111");
             String originalFileName = file.getOriginalFilename();
             String extension = getFileExtension(originalFileName);
-
             // MD5,ETag
-            String fileMD5 = FileUtils.getFileMD5(file);
-            String objectName = generateObjectName(originalFileName, fileMD5, extension);
-            String fileETag = FileUtils.getFileETag(file);
-
-            System.out.printf("22222222222222222");
+            String fileMd5 = FileUtils.getFileMD5(file);
+            String objectName = generateObjectName(originalFileName, fileMd5, extension);
+            String fileEtag = FileUtils.getFileETag(file);
             // 查找文件是否已经存在于MinIO
-            if (isFileExistsInMinIO(objectName, fileETag)) {
-                return HttpResult.ok(getFileFromDatabase(fileETag,objectName, extension));
+            if (isFileExistsInMinIo(objectName, fileEtag)) {
+                return HttpResult.ok(getFileFromDatabase(fileEtag,objectName, extension));
             }
-
-            System.out.printf("333333333333333333333");
             //如果文件不存在,执行上传操作
-            SysUploadFiles sysUploadFiles = uploadFileToMinIO(file, objectName, fileETag, extension);
-            System.out.printf("444444444444444444444444444");
+            SysUploadFiles sysUploadFiles = uploadFileToMinIo(file, objectName, fileEtag, extension);
             return HttpResult.ok(sysUploadFiles);
         } catch (Exception e) {
             e.printStackTrace();
-            System.out.printf("eeeeeeeeeeeeeeeeeeeeeeeeee");
             return HttpResult.error("文件上传失败: " + e.getMessage());
         }
     }
@@ -80,11 +72,11 @@ public class FileUploadController extends BaseController {
         return fileName.substring(fileName.lastIndexOf("."));
     }
 
-    private String generateObjectName(String originalFileName, String fileMD5, String extension) {
-        return originalFileName.substring(0, originalFileName.lastIndexOf(".")) + "_" + fileMD5 + extension;
+    private String generateObjectName(String originalFileName, String fileMd5, String extension) {
+        return originalFileName.substring(0, originalFileName.lastIndexOf(".")) + "_" + fileMd5 + extension;
     }
 
-    private boolean isFileExistsInMinIO(String objectName, String fileETag) {
+    private boolean isFileExistsInMinIo(String objectName, String fileEtag) {
         try {
             StatObjectArgs statObjectArgs = StatObjectArgs.builder()
                     .bucket(bucketName)
@@ -92,17 +84,18 @@ public class FileUploadController extends BaseController {
                     .build();
 
             StatObjectResponse statObjectResponse = minioClient.statObject(statObjectArgs);
-            String minioFileETag = statObjectResponse.etag();
+            String minioFileEtag = statObjectResponse.etag();
 
-            return minioFileETag.equals(fileETag);
+            return minioFileEtag.equals(fileEtag);
         } catch (Exception e) {
-            return false; // 如果获取对象出错,认为文件不存在
+            // 如果获取对象出错,认为文件不存在
+            return false;
         }
     }
 
-    private SysUploadFiles getFileFromDatabase(String fileETag,String fileName,String fileType) {
+    private SysUploadFiles getFileFromDatabase(String fileEtag,String fileName,String fileType) {
         SysUploadFiles sysUploadFiles = sysUploadFilesMapper.selectOne(
-                new LambdaQueryWrapper<SysUploadFiles>().eq(SysUploadFiles::getEtag, fileETag));
+                new LambdaQueryWrapper<SysUploadFiles>().eq(SysUploadFiles::getEtag, fileEtag));
 
         if (sysUploadFiles == null) {
             sysUploadFiles = new SysUploadFiles();
@@ -110,7 +103,7 @@ public class FileUploadController extends BaseController {
             sysUploadFiles.setFileName(fileName);
             sysUploadFiles.setFileType(fileType);
             sysUploadFiles.setBucketName(bucketName);
-            sysUploadFiles.setEtag(fileETag);
+            sysUploadFiles.setEtag(fileEtag);
             sysUploadFiles.setCreateTime(LocalDateTime.now());
             sysUploadFiles.setCreateBy(getUserName());
             StatObjectResponse fileContent = MinioUtils.getFileStatusInfo(bucketName,fileName);
@@ -121,7 +114,7 @@ public class FileUploadController extends BaseController {
         return sysUploadFiles;
     }
 
-    private SysUploadFiles uploadFileToMinIO(MultipartFile file, String objectName, String fileETag, String extension) throws Exception {
+    private SysUploadFiles uploadFileToMinIo(MultipartFile file, String objectName, String fileEtag, String extension) throws Exception {
         // 上传到minio
         InputStream fileInputStream = file.getInputStream();
         ObjectWriteResponse objectWriteResponse = minioClient.putObject(PutObjectArgs.builder()

+ 1 - 0
platform/src/main/java/com/jzg/service/impl/SysSystemServiceImpl.java

@@ -101,6 +101,7 @@ public class SysSystemServiceImpl extends ServiceImpl<SysSystemMapper, SysSystem
      * @param sysConfig 平台配置
      * @param sysCode 系统code
      */
+    @Override
     public void saveConfig(SysConfig sysConfig, String sysCode){
         List<SysConfig> checkConfigs = sysConfigMapper.selectList(new LambdaQueryWrapper<SysConfig>()
                 .eq(SysConfig::getSystemCode,sysCode));

+ 70 - 0
tenant/organization/src/main/java/com/jzg/organization/controller/SchemeController.java

@@ -0,0 +1,70 @@
+package com.jzg.organization.controller;
+
+import com.jzg.commons.core.page.HttpResult;
+import com.jzg.commons.entity.scheme.vo.PtlSchemeQueryVo;
+import com.jzg.commons.entity.scheme.vo.PtlSchemeSaveVo;
+import com.jzg.commons.entity.scheme.vo.PtlSchemeVo;
+import com.jzg.commons.request.RequestSingleParam;
+import com.jzg.organization.service.PtlSchemeService;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.validation.Valid;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+@Tag(name="方案管理")
+@RestController
+@RequestMapping("/scheme")
+public class SchemeController {
+
+    @Autowired
+    private PtlSchemeService ptlSchemeService;
+
+    //region 基础方案配置
+    @Operation(summary = "保存方案")
+    @PostMapping("/saveScheme")
+    public HttpResult saveScheme(@RequestBody @Valid PtlSchemeSaveVo ptlSchemeSaveVo){
+        return ptlSchemeService.saveScheme(ptlSchemeSaveVo) ? HttpResult.ok("保存方案成功") : HttpResult.error("保存方案失败");
+    }
+
+    @Operation(summary = "获取方案")
+    @GetMapping("/getScheme")
+    public HttpResult getScheme(String id){
+        PtlSchemeQueryVo schemeList = ptlSchemeService.getScheme(id);
+        return HttpResult.ok(schemeList);
+    }
+
+    @Operation(summary = "根据保司、险种、方案类型获取方案")
+    @GetMapping("/getSchemeByCompany")
+    public HttpResult getSchemeAll(String companyId,String productId,String schemeType){
+        PtlSchemeQueryVo schemeList = ptlSchemeService.getSchemeAll(companyId,productId,schemeType);
+        return HttpResult.ok(schemeList);
+    }
+
+    @Operation(summary = "获取方案列表")
+    @PostMapping("/getSchemeList")
+    public HttpResult getSchemeList(@RequestBody PtlSchemeVo ptlSchemeVo){
+        return HttpResult.ok(ptlSchemeService.getSchemePage(ptlSchemeVo.getPage(),ptlSchemeVo));
+    }
+
+    @Operation(summary = "删除方案")
+    @PostMapping("/deleteScheme")
+    public HttpResult deleteScheme(@RequestSingleParam(value = "id") String id){
+        return ptlSchemeService.deleteScheme(id)? HttpResult.ok("删除方案成功") : HttpResult.error("删除方案失败");
+    }
+
+    //endregion
+
+
+    @Operation(summary = "获取商业险信息")
+    @GetMapping("/getBusinessInsurance")
+    public HttpResult getBusinessInsurance(String productId){
+        return HttpResult.ok(ptlSchemeService.getBusinessInsuranceList(productId));
+    }
+
+    @Operation(summary = "获取保司列表,用于方案排序")
+    @GetMapping("/getCompanyList")
+    public HttpResult getCompanyList(){
+        return HttpResult.ok(ptlSchemeService.getCompanyList());
+    }
+}

+ 23 - 0
tenant/organization/src/main/java/com/jzg/organization/mapper/InsBusinessInsuranceMapper.java

@@ -0,0 +1,23 @@
+package com.jzg.organization.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.jzg.commons.entity.scheme.po.InsBusinessInsurance;
+import com.jzg.commons.entity.scheme.po.InsBusinessInsuranceOption;
+import com.jzg.commons.entity.scheme.po.PtlSchemeInsurance;
+import com.jzg.commons.entity.scheme.vo.InsBusinessInsuranceVo;
+import org.apache.ibatis.annotations.Mapper;
+
+import java.util.List;
+
+@Mapper
+public interface InsBusinessInsuranceMapper extends BaseMapper<InsBusinessInsurance> {
+
+    public List<InsBusinessInsuranceVo> getBusinessInsuranceList(String productId);
+
+    /**
+     * 获取商业险选项
+     * @return
+     */
+    public List<InsBusinessInsuranceOption> getBusinessInsuranceOptionList();
+}

+ 11 - 0
tenant/organization/src/main/java/com/jzg/organization/mapper/PtlSchemeInfoMapper.java

@@ -0,0 +1,11 @@
+package com.jzg.organization.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.jzg.commons.entity.scheme.po.PtlScheme;
+import com.jzg.commons.entity.scheme.po.PtlSchemeInfo;
+import org.apache.ibatis.annotations.Mapper;
+
+@Mapper
+public interface PtlSchemeInfoMapper extends BaseMapper<PtlSchemeInfo> {
+
+}

+ 15 - 0
tenant/organization/src/main/java/com/jzg/organization/mapper/PtlSchemeInsuranceDrivingIntentionMapper.java

@@ -0,0 +1,15 @@
+package com.jzg.organization.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.jzg.commons.entity.scheme.po.PtlSchemeInsurance;
+import com.jzg.commons.entity.scheme.po.PtlSchemeInsuranceDrivingIntention;
+import org.apache.ibatis.annotations.Mapper;
+
+import java.util.List;
+
+@Mapper
+public interface PtlSchemeInsuranceDrivingIntentionMapper extends BaseMapper<PtlSchemeInsuranceDrivingIntention> {
+
+
+    public List<PtlSchemeInsuranceDrivingIntention> getSchemeDrivingIntention(String schemeInfoId);
+}

+ 20 - 0
tenant/organization/src/main/java/com/jzg/organization/mapper/PtlSchemeInsuranceMapper.java

@@ -0,0 +1,20 @@
+package com.jzg.organization.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.jzg.commons.entity.scheme.po.PtlScheme;
+import com.jzg.commons.entity.scheme.po.PtlSchemeInsurance;
+import com.jzg.commons.entity.scheme.vo.PtlSchemeInsuranceVo;
+import org.apache.ibatis.annotations.Mapper;
+
+import java.util.List;
+
+@Mapper
+public interface PtlSchemeInsuranceMapper extends BaseMapper<PtlSchemeInsurance> {
+
+    /**
+     * 获取方案险种信息
+     * @param schemeId
+     * @return
+     */
+    List<PtlSchemeInsuranceVo> getSchemeInsurance(String schemeId);
+}

+ 30 - 0
tenant/organization/src/main/java/com/jzg/organization/mapper/PtlSchemeMapper.java

@@ -0,0 +1,30 @@
+package com.jzg.organization.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.jzg.commons.entity.po.EsmInsCompany;
+import com.jzg.commons.entity.po.SysDept;
+import com.jzg.commons.entity.scheme.po.PtlScheme;
+import com.jzg.commons.entity.scheme.vo.PtlSchemeVo;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+@Mapper
+public interface PtlSchemeMapper extends BaseMapper<PtlScheme> {
+
+    /**
+     * 获取方案分页
+     * @param page
+     * @param ptlSchemeVo
+     * @return
+     */
+    public Page<PtlSchemeVo> getSchemePage(Page page,@Param("param") PtlSchemeVo ptlSchemeVo);
+
+    /**
+     * 获取保司列表
+     * @return
+     */
+    public List<EsmInsCompany> getCompanyList();
+}

+ 11 - 0
tenant/organization/src/main/java/com/jzg/organization/mapper/PtlSchemeRulesAttrLinkMapper.java

@@ -0,0 +1,11 @@
+package com.jzg.organization.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.jzg.commons.entity.scheme.po.PtlSchemeInfo;
+import com.jzg.commons.entity.scheme.po.PtlSchemeRulesAttrLink;
+import org.apache.ibatis.annotations.Mapper;
+
+@Mapper
+public interface PtlSchemeRulesAttrLinkMapper extends BaseMapper<PtlSchemeRulesAttrLink> {
+
+}

+ 74 - 0
tenant/organization/src/main/java/com/jzg/organization/service/PtlSchemeService.java

@@ -0,0 +1,74 @@
+package com.jzg.organization.service;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.jzg.commons.entity.po.EsmInsCompany;
+import com.jzg.commons.entity.po.PtlAgreementUndwrtRulesAttr;
+import com.jzg.commons.entity.po.SysArea;
+import com.jzg.commons.entity.scheme.po.PtlScheme;
+import com.jzg.commons.entity.scheme.vo.InsBusinessInsuranceVo;
+import com.jzg.commons.entity.scheme.vo.PtlSchemeQueryVo;
+import com.jzg.commons.entity.scheme.vo.PtlSchemeSaveVo;
+import com.jzg.commons.entity.scheme.vo.PtlSchemeVo;
+import com.jzg.commons.entity.vo.AgreementRulesVo;
+import com.jzg.commons.entity.vo.EsmInsCompanyResVo;
+import com.jzg.commons.entity.vo.SysAreaVo;
+
+import java.util.List;
+
+/**
+ * @author Administrator
+ * @description 针对表【ptlScheme】的数据库操作Service
+ * @createDate 2023-11-15 11:23:28
+ */
+public interface PtlSchemeService extends IService<PtlScheme> {
+
+    /**
+     * 添加方案
+     * @param ptlSchemeSaveVo
+     * @return
+     */
+    public boolean saveScheme(PtlSchemeSaveVo ptlSchemeSaveVo);
+
+    /**
+     * 获取方案
+     * @param id
+     * @return
+     */
+    public PtlSchemeQueryVo getScheme(String id);
+
+    public PtlSchemeQueryVo getSchemeAll(String companyId,String productId,String schemeType);
+
+    /**
+     * 获取方案列表
+     * @return
+     */
+    public Page<PtlSchemeVo> getSchemePage(Page page,PtlSchemeVo ptlSchemeVo);
+
+
+    /**
+     * 获取商业险信息
+     * @return
+     */
+    public List<InsBusinessInsuranceVo> getBusinessInsuranceList(String productId);
+
+    /**
+     * 删除方案
+     * @param schemeId
+     * @return
+     */
+    public boolean deleteScheme(String schemeId);
+
+    /**
+     * 获取规则信息
+     * @param schemeId
+     * @return
+     */
+    public List<PtlAgreementUndwrtRulesAttr> rulesGet(String schemeId);
+
+    /**
+     * 保司列表
+     * @return
+     */
+    public List<EsmInsCompanyResVo> getCompanyList();
+}

+ 263 - 0
tenant/organization/src/main/java/com/jzg/organization/service/impl/PtlSchemeServiceImpl.java

@@ -0,0 +1,263 @@
+package com.jzg.organization.service.impl;
+
+import cn.hutool.core.bean.BeanUtil;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.jzg.commons.entity.po.EsmInsCompany;
+import com.jzg.commons.entity.po.PtlAgreementUndwrtRulesAttr;
+import com.jzg.commons.entity.po.PtlAgreementUndwrtRulesAttrLink;
+import com.jzg.commons.entity.po.PtlAgreementUndwrtRulesDictLabal;
+import com.jzg.commons.entity.scheme.po.*;
+import com.jzg.commons.entity.scheme.vo.*;
+import com.jzg.commons.entity.vo.EsmInsCompanyResVo;
+import com.jzg.commons.exception.ValidateException;
+import com.jzg.commons.util.StringUtils;
+import com.jzg.organization.mapper.*;
+import com.jzg.organization.service.PtlAgreementUndwrtRulesAttrService;
+import com.jzg.organization.service.PtlSchemeService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.*;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+
+
+@Service
+public class PtlSchemeServiceImpl extends ServiceImpl<PtlSchemeMapper, PtlScheme> implements PtlSchemeService {
+
+    @Autowired
+    PtlSchemeMapper ptlSchemeMapper;
+
+    @Autowired
+    PtlSchemeInfoMapper ptlSchemeInfoMapper;
+
+    @Autowired
+    PtlSchemeInsuranceMapper ptlSchemeInsuranceMapper;
+
+    @Autowired
+    PtlSchemeInsuranceDrivingIntentionMapper ptlSchemeInsuranceDrivingIntentionMapper;
+
+    @Autowired
+    InsBusinessInsuranceMapper insBusinessInsuranceMapper;
+
+    @Autowired
+    PtlSchemeRulesAttrLinkMapper ptlSchemeRulesAttrLinkMapper;
+
+    @Autowired
+    PtlAgreementUndwrtRulesAttrService agreementUndwrtRulesAttrService;
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public boolean saveScheme(PtlSchemeSaveVo ptlSchemeSaveVo) {
+        //校验方案是否存在
+        List<PtlScheme> ptlSchemes = ptlSchemeMapper.selectList(new LambdaQueryWrapper<PtlScheme>()
+                .eq(PtlScheme::getCompanyId, ptlSchemeSaveVo.getCompanyId())
+                .eq(PtlScheme::getProductId, ptlSchemeSaveVo.getProductId()));
+
+        List<PtlAgreementUndwrtRulesAttr> undwrtRulesAttrList = agreementUndwrtRulesAttrService.getUndwrtRulesAttrList();
+        PtlScheme ptlScheme = ptlSchemeSaveVo.getPtlScheme(undwrtRulesAttrList);
+        ptlSchemeMapper.insertOrUpdate(ptlScheme);
+
+        //方案信息
+        List<PtlSchemeInfo> ptlSchemeInfoList = ptlSchemeSaveVo.getPtlSchemeInfoList();
+        ptlSchemeInfoMapper.insertOrUpdate(ptlSchemeInfoList);
+
+        //商业险信息
+        List<PtlSchemeInsurance> ptlSchemeInsuranceList = ptlSchemeSaveVo.getPtlSchemeInsuranceList();
+        //清空商业险信息
+        cleanInsurance(ptlSchemeInfoList);
+        ptlSchemeInsuranceMapper.insertOrUpdate(ptlSchemeInsuranceList);
+
+        //驾意险信息
+        List<PtlSchemeInsuranceDrivingIntention> ptlSchemeInsuranceDrivingIntentionList = ptlSchemeSaveVo.getPtlSchemeInsuranceDrivingIntentionList();
+        //清空驾意险信息
+        cleanDrivingIntention(ptlSchemeInfoList);
+        ptlSchemeInsuranceDrivingIntentionMapper.insertOrUpdate(ptlSchemeInsuranceDrivingIntentionList);
+
+        //规则信息
+        List<PtlSchemeRulesAttrLink> ptlSchemeRulesAttrLinkList = ptlSchemeSaveVo.getPtlSchemeRulesAttrLinkList();
+        //清除规则 重新插入
+        cleanRules(ptlScheme);
+        ptlSchemeRulesAttrLinkMapper.insertOrUpdate(ptlSchemeRulesAttrLinkList);
+
+        return true;
+    }
+
+    /**
+     * 清空驾意险数据
+     * @param ptlSchemeInfoList
+     */
+    private void cleanDrivingIntention(List<PtlSchemeInfo> ptlSchemeInfoList){
+        List<String> ids = ptlSchemeInfoList.stream().map(info -> info.getId()).collect(Collectors.toList());
+        ptlSchemeInsuranceDrivingIntentionMapper.delete(new LambdaQueryWrapper<PtlSchemeInsuranceDrivingIntention>()
+               .in(PtlSchemeInsuranceDrivingIntention::getSchemeInfoId, ids));
+    }
+
+    /**
+     * 清空险种数据
+     * @param ptlSchemeInfoList
+     */
+    private void cleanInsurance(List<PtlSchemeInfo> ptlSchemeInfoList){
+        List<String> ids = ptlSchemeInfoList.stream().map(info -> info.getId()).collect(Collectors.toList());
+        ptlSchemeInsuranceMapper.delete(new LambdaQueryWrapper<PtlSchemeInsurance>()
+               .in(PtlSchemeInsurance::getSchemeInfoId, ids));
+    }
+
+    /**
+     * 清空规则
+     * @return
+     */
+    private void cleanRules(PtlScheme ptlScheme){
+        ptlSchemeRulesAttrLinkMapper.delete(new LambdaQueryWrapper<PtlSchemeRulesAttrLink>()
+                .eq(PtlSchemeRulesAttrLink::getSchemeId, ptlScheme.getId()));
+    }
+
+    @Override
+    public PtlSchemeQueryVo getScheme(String id) {
+        //获取方案信息
+        PtlSchemeInfo ptlSchemeInfo = ptlSchemeInfoMapper.selectOne(new LambdaQueryWrapper<PtlSchemeInfo>()
+                .eq(PtlSchemeInfo::getId, id));
+
+        //获取方案信息
+        PtlScheme ptlScheme = ptlSchemeMapper.selectOne(new LambdaQueryWrapper<PtlScheme>()
+                .eq(PtlScheme::getId, ptlSchemeInfo.getSchemeId()));
+
+        if(Objects.isNull(ptlScheme)){
+            throw new ValidateException("方案不存在");
+        }
+
+        //获取商业险
+        List<PtlSchemeInsuranceVo> ptlSchemeInsurances = ptlSchemeInsuranceMapper.getSchemeInsurance(ptlSchemeInfo.getId());
+        ptlSchemeInsurances.forEach(item->{
+            item.getOptionVos().forEach(option->{
+                item.getOptionId().add(option.getOptionId());
+            });
+        });
+
+        //获取驾意险
+        List<PtlSchemeInsuranceDrivingIntention> ptlSchemeInsuranceDrivingIntentions = ptlSchemeInsuranceDrivingIntentionMapper.getSchemeDrivingIntention(ptlSchemeInfo.getId());
+
+        //获取规则
+        List<PtlSchemeRulesAttrLink> ptlSchemeRulesAttrLinks = ptlSchemeRulesAttrLinkMapper.selectList(new LambdaQueryWrapper<PtlSchemeRulesAttrLink>()
+                .eq(PtlSchemeRulesAttrLink::getSchemeId, ptlScheme.getId()));
+
+        List<PtlAgreementUndwrtRulesAttr> agreementRulesVo = rulesGet(ptlScheme.getId());
+
+        //拼装返回数据
+        PtlSchemeQueryVo vo = new PtlSchemeQueryVo(ptlScheme,ptlSchemeInfo,ptlSchemeInsurances,ptlSchemeInsuranceDrivingIntentions,ptlSchemeRulesAttrLinks,agreementRulesVo);
+
+        return vo;
+    }
+
+    @Override
+    public PtlSchemeQueryVo getSchemeAll(String companyId,String productId,String schemeType) {
+        //获取方案信息
+        PtlScheme ptlScheme = ptlSchemeMapper.selectOne(new LambdaQueryWrapper<PtlScheme>()
+                .eq(PtlScheme::getCompanyId, companyId)
+                .eq(PtlScheme::getProductId, productId));
+
+        if(Objects.isNull(ptlScheme)){
+            throw new ValidateException("方案不存在");
+        }
+
+        //获取方案信息
+        List<PtlSchemeInfo> ptlSchemeInfos = ptlSchemeInfoMapper.selectList(new LambdaQueryWrapper<PtlSchemeInfo>()
+                .eq(PtlSchemeInfo::getSchemeId, ptlScheme.getId())
+                .eq(PtlSchemeInfo::getSchemeType,  schemeType));
+
+        List<PtlSchemeQueryVo.Scheme> schemes = new ArrayList<>();
+        ptlSchemeInfos.forEach(ptlSchemeInfo -> {
+            PtlSchemeQueryVo.Scheme scheme = new PtlSchemeQueryVo.Scheme();
+            scheme.setId(ptlSchemeInfo.getId());
+            scheme.setSchemeType(ptlSchemeInfo.getSchemeType());
+            scheme.setSchemeName(ptlSchemeInfo.getSchemeName());
+            scheme.setDescription(ptlSchemeInfo.getDescription());
+
+            //获取商业险
+            List<PtlSchemeInsuranceVo> ptlSchemeInsurances = ptlSchemeInsuranceMapper.getSchemeInsurance(ptlSchemeInfo.getId());
+            ptlSchemeInsurances.forEach(item->{
+                item.getOptionVos().forEach(option->{
+                    item.getOptionId().add(option.getOptionId());
+                });
+            });
+            scheme.setSchemeInsuranceList(ptlSchemeInsurances);
+
+            //获取驾意险
+            List<PtlSchemeInsuranceDrivingIntention> ptlSchemeInsuranceDrivingIntentions = ptlSchemeInsuranceDrivingIntentionMapper.getSchemeDrivingIntention(ptlSchemeInfo.getId());
+            scheme.setDrivingIntentionList(ptlSchemeInsuranceDrivingIntentions);
+            schemes.add(scheme);
+        });
+
+        //获取规则
+        List<PtlSchemeRulesAttrLink> ptlSchemeRulesAttrLinks = ptlSchemeRulesAttrLinkMapper.selectList(new LambdaQueryWrapper<PtlSchemeRulesAttrLink>()
+                .eq(PtlSchemeRulesAttrLink::getSchemeId, ptlScheme.getId()));
+
+        List<PtlAgreementUndwrtRulesAttr> agreementRulesVo = rulesGet(ptlScheme.getId());
+
+        //拼装返回数据
+        PtlSchemeQueryVo vo = new PtlSchemeQueryVo(ptlScheme,ptlSchemeInfos,schemes,ptlSchemeRulesAttrLinks,agreementRulesVo);
+
+        return vo;
+    }
+
+    @Override
+    public Page<PtlSchemeVo> getSchemePage(Page page,PtlSchemeVo ptlSchemeVo) {
+        Page<PtlSchemeVo> schemePage = ptlSchemeMapper.getSchemePage(page, ptlSchemeVo);
+        return schemePage;
+    }
+
+    @Override
+    public List<InsBusinessInsuranceVo> getBusinessInsuranceList(String productId) {
+        return insBusinessInsuranceMapper.getBusinessInsuranceList(productId);
+    }
+
+    @Override
+    public boolean deleteScheme(String schemeId) {
+        return ptlSchemeInfoMapper.deleteById(schemeId) > 0;
+    }
+
+    @Override
+    public List<PtlAgreementUndwrtRulesAttr> rulesGet(String schemeId) {
+        List<PtlSchemeRulesAttrLink> linkList = ptlSchemeRulesAttrLinkMapper.selectList(new LambdaQueryWrapper<PtlSchemeRulesAttrLink>()
+                .eq(PtlSchemeRulesAttrLink::getSchemeId, schemeId));
+        // 获取费用因子属性
+        List<PtlAgreementUndwrtRulesAttr> attrList = agreementUndwrtRulesAttrService.getUndwrtRulesAttrList();
+        Map<String, PtlAgreementUndwrtRulesAttr> attrMap = attrList.stream()
+                .collect(Collectors.toMap(PtlAgreementUndwrtRulesAttr::getAttrCode, attr -> attr));
+        List<PtlAgreementUndwrtRulesAttr> newAttrList = new ArrayList<>();
+        linkList.forEach(link -> {
+            if(attrMap.containsKey(link.getAttrCode())) {
+                PtlAgreementUndwrtRulesAttr attr= attrMap.get(link.getAttrCode());
+                //处理多选和下拉
+                if ("checkbox".equals(attr.getAttrType()) || "select".equals(attr.getAttrType()) || "inputTag".equals(attr.getAttrType())) {
+                    if (null != link.getMin()) {
+                        attr.setId(link.getId());
+                        attr.setMinArray(link.getMin().split(","));
+                        attr.setMax(link.getMax());
+                        attr.setOperator(link.getOperator());
+                    }
+                }else{
+                    attr.setId(link.getId());
+                    attr.setMin(link.getMin());
+                    attr.setMax(link.getMax());
+                    attr.setOperator(link.getOperator());
+                }
+                newAttrList.add(attr);
+            }
+
+        });
+        return newAttrList;
+    }
+
+    @Override
+    public List<EsmInsCompanyResVo> getCompanyList() {
+        List<EsmInsCompany> companyList = ptlSchemeMapper.getCompanyList();
+        return BeanUtil.copyToList(companyList, EsmInsCompanyResVo.class);
+    }
+}

+ 19 - 16
tenant/organization/src/main/java/com/jzg/organization/service/impl/SysActivityServiceImpl.java

@@ -40,6 +40,7 @@ import java.time.format.DateTimeFormatter;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Objects;
+import java.util.Optional;
 import java.util.concurrent.atomic.AtomicInteger;
 import java.util.stream.Collectors;
 
@@ -286,23 +287,25 @@ public class SysActivityServiceImpl extends ServiceImpl<SysActivityMapper, SysAc
 
     @Override
     public Page<SysActivity> getActivityList(Page page,SysActivityVo sysActivityVo) {
-    Page<SysActivity> pages =  baseMapper.getSysActivityList(page,sysActivityVo);
-    pages.getRecords().forEach(activity -> {
-        SysDept sysDept = sysDeptService.getById(activity.getActDept());
-        AtomicInteger count = new AtomicInteger();
-        List<SysActivityDept> sysActivityDeptList = sysActivityDeptService.list(new LambdaQueryWrapper<SysActivityDept>()
-                .eq(SysActivityDept::getActivityId, activity.getId()).eq(SysActivityDept::getIsEffective, 0));
-        sysActivityDeptList.forEach(sysActivityDept -> {
-            List<SysUserJzgInfo> sysUserJzgInfo = sysUserJzgInfoService.list(new LambdaQueryWrapper<SysUserJzgInfo>().eq(SysUserJzgInfo::getDeptId, sysActivityDept.getDeptId()));
-            count.set(count.get() + sysUserJzgInfo.size());
+        Page<SysActivity> pages =  baseMapper.getSysActivityList(page,sysActivityVo);
+        pages.getRecords().forEach(activity -> {
+            SysDept sysDept = sysDeptService.getById(activity.getActDept());
+            AtomicInteger count = new AtomicInteger();
+            List<SysActivityDept> sysActivityDeptList = sysActivityDeptService.list(new LambdaQueryWrapper<SysActivityDept>()
+                    .eq(SysActivityDept::getActivityId, activity.getId()).eq(SysActivityDept::getIsEffective, 0));
+            sysActivityDeptList.forEach(sysActivityDept -> {
+                List<SysUserJzgInfo> sysUserJzgInfo = sysUserJzgInfoService.list(new LambdaQueryWrapper<SysUserJzgInfo>().eq(SysUserJzgInfo::getDeptId, sysActivityDept.getDeptId()));
+                count.set(count.get() + sysUserJzgInfo.size());
+            });
+            activity.setDeptIds(sysActivityDeptList.stream().map(SysActivityDept::getDeptId).collect(Collectors.toList()));
+            if(Objects.nonNull(sysDept)) {
+                activity.setActDeptName(sysDept.getName());
+                activity.setDepts(activity.getDeptIds().stream().map(deptId -> sysDeptService.getById(deptId).getName()).collect(Collectors.joining(",")));
+            }
+            activity.setUserCount(count);
+            checkActivityStatus(activity.getActStartTime(), activity.getActEndTime(), activity);
+            updateById(activity);
         });
-        activity.setDeptIds(sysActivityDeptList.stream().map(SysActivityDept::getDeptId).collect(Collectors.toList()));
-        activity.setActDeptName(sysDept.getName());
-        activity.setDepts(activity.getDeptIds().stream().map(deptId -> sysDeptService.getById(deptId).getName()).collect(Collectors.joining(",")));
-        activity.setUserCount(count);
-        checkActivityStatus(activity.getActStartTime(), activity.getActEndTime(), activity);
-        updateById(activity);
-    });
         return pages;
     }
 

+ 2 - 2
tenant/organization/src/main/java/com/jzg/organization/service/impl/SysDeptServiceImpl.java

@@ -167,7 +167,7 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
         SysDept sysDept = getById(deptId);
         SysDeptVo sysDeptVo = new SysDeptVo(sysDept);
 
-        List<SysDept> depts = baseMapper.selectDeptVoList(deptId, sysCode);
+        List<SysDept> depts = baseMapper.selectDeptVoList(deptId, userSystemCode);
         List<SysDeptVo> voDept = new ArrayList<>();
         depts.forEach(item->{
             SysDeptVo sysDeptv = new SysDeptVo(item);
@@ -180,7 +180,7 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
             for(int i=0;i<sysAreaVos.size();i++){
                 areaString = areaString + sysAreaVos.get(i).getAreaCname() + "-";
             }
-            if(areaString.length()>0) {
+            if(!areaString.isEmpty()) {
                 sysDeptv.setDivision(areaString.substring(0, areaString.length() - 1));
             }
             if(!Objects.isNull(item.getLeaderId())){

+ 52 - 0
tenant/organization/src/main/resources/mapper/InsBusinessInsuranceMapper.xml

@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.jzg.organization.mapper.InsBusinessInsuranceMapper">
+    <resultMap id="SchemeResultVoMap" type="com.jzg.commons.entity.scheme.vo.InsBusinessInsuranceVo">
+        <id property="id" column="business_id" />
+        <result property="powerId" column="power_id" />
+        <result property="kindName" column="kind_name" />
+        <result property="alias" column="alias" />
+        <result property="kindCode" column="kind_code" />
+        <result property="desc" column="desc" />
+        <result property="grouping" column="grouping" />
+        <collection property="options" ofType="com.jzg.commons.entity.scheme.po.InsBusinessInsuranceOption">
+            <result property="id" column="id" />
+            <result property="businessId" column="business_id" />
+            <result property="label" column="label" />
+            <result property="value" column="value" />
+            <result property="sort" column="sort" />
+        </collection>
+    </resultMap>
+
+    <select id="getBusinessInsuranceList" resultMap="SchemeResultVoMap">
+        SELECT
+            ibi.power_id,
+            ibi.kind_code,
+            ibi.kind_name,
+            ibi.alias,
+            ibi.grouping,
+            ibio.id,
+            ibio.business_id,
+            ibio.label,
+            ibio.`value`,
+            ibio.sort
+        FROM
+            ins_business_insurance ibi
+                LEFT JOIN ins_business_insurance_option ibio ON ibi.id = ibio.business_id
+        WHERE
+            1=1
+        <if test="productId == '0330'">
+            AND ibi.type = 1
+        </if>
+        <if test="productId == '0330034002' or productId == '0330034001'">
+            AND ibi.type = 1 or ibi.type = 2
+        </if>
+        <if test="productId == '034001' or productId == '034002'">
+            AND ibi.type = 2
+        </if>
+    </select>
+
+    <select id="getBusinessInsuranceOptionList" resultType="com.jzg.commons.entity.scheme.po.InsBusinessInsuranceOption">
+        select * from ins_business_insurance_option
+    </select>
+</mapper>

+ 24 - 0
tenant/organization/src/main/resources/mapper/PtlSchemeInsuranceDrivingIntentionMapper.xml

@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.jzg.organization.mapper.PtlSchemeInsuranceDrivingIntentionMapper">
+
+
+
+    <select id="getSchemeDrivingIntention" resultType="com.jzg.commons.entity.scheme.po.PtlSchemeInsuranceDrivingIntention">
+        SELECT
+        psidi.id,
+        jc.product_name,
+        psidi.selected_status,
+        psidi.quantity,
+        psidi.scheme_info_id,
+        psidi.driving_intention_id
+        FROM
+        ptl_scheme_insurance_driving_intention psidi
+        LEFT JOIN jyx_config jc ON psidi.driving_intention_id = jc.id
+        WHERE
+        1=1
+        <if test="schemeId != null and schemeId != ''">
+            AND psidi.scheme_info_id = #{schemeId}
+        </if>
+    </select>
+</mapper>

+ 34 - 0
tenant/organization/src/main/resources/mapper/PtlSchemeInsuranceMapper.xml

@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.jzg.organization.mapper.PtlSchemeInsuranceMapper">
+    <resultMap id="SchemeResultVoMap" type="com.jzg.commons.entity.scheme.vo.PtlSchemeInsuranceVo">
+        <result property="id" column="id" />
+        <result property="schemeInfoId" column="scheme_info_id" />
+        <result property="insuranceId" column="insurance_id" />
+        <result property="kindName" column="kind_name" />
+        <collection property="optionVos" ofType="com.jzg.commons.entity.scheme.vo.PtlSchemeInsuranceVo$PtlSchemeInsuranceOptionVo">
+            <result property="optionId" column="option_id" />
+            <result property="optionName" column="option_name" />
+        </collection>
+    </resultMap>
+
+
+    <select id="getSchemeInsurance" resultMap="SchemeResultVoMap">
+        SELECT
+        psi.id,
+        psi.scheme_info_id,
+        psi.insurance_id,
+        psi.option_id,
+        ibi.kind_name,
+        ibio.label as option_name
+        FROM
+        ptl_scheme_insurance psi
+        LEFT JOIN ins_business_insurance ibi ON psi.insurance_id = ibi.id
+        LEFT JOIN ins_business_insurance_option ibio ON ibio.id = psi.option_id
+        WHERE
+        1=1
+        <if test="schemeId != null and schemeId != ''">
+            AND psi.scheme_info_id = #{schemeId}
+        </if>
+    </select>
+</mapper>

+ 54 - 0
tenant/organization/src/main/resources/mapper/PtlSchemeMapper.xml

@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.jzg.organization.mapper.PtlSchemeMapper">
+    <select id="getSchemePage" resultType="com.jzg.commons.entity.scheme.vo.PtlSchemeVo">
+        SELECT
+            psi.id,
+            psi.scheme_name,
+            psi.description,
+            psi.scheme_type,
+            ps.rule_desc,
+            ps.id AS scheme_id,
+            ps.company_id,
+            ps.product_id,
+            ps.product_name,
+            count( psidi.id ) AS driving_intention_num
+        FROM
+            ptl_scheme_info psi
+                INNER JOIN ptl_scheme ps ON ps.id = psi.scheme_id
+                LEFT JOIN ptl_scheme_insurance_driving_intention psidi ON psidi.scheme_info_id = psi.id
+        WHERE
+        1=1
+          AND psi.is_delete = 0
+        <if test="param.ruleDesc != null and param.ruleDesc != ''">
+            AND ps.rule_desc LIKE CONCAT('%', #{param.ruleDesc}, '%')
+        </if>
+        <if test="param.productId != null and param.productId != ''">
+            AND ps.product_id = #{param.productId}
+        </if>
+        <if test="param.schemeType != null and param.schemeType != ''">
+            AND psi.scheme_type = #{param.schemeType}
+        </if>
+        <if test="param.companyId != null and param.companyId != ''">
+            AND ps.company_id = #{param.companyId}
+        </if>
+        GROUP BY
+            psi.id
+    </select>
+
+    <select id="getCompanyList" resultType="com.jzg.commons.entity.po.EsmInsCompany">
+        SELECT
+            eic.*,
+            count(psi.id) as count
+        FROM
+            esm_ins_company eic
+                left join ptl_scheme ps on eic.id = ps.company_id
+                left join ptl_scheme_info psi on ps.id = psi.scheme_id
+        WHERE
+            eic.parent_id = 0
+        AND
+            eic.is_delete = 0
+        group by eic.id
+        order by count desc
+    </select>
+</mapper>

+ 1 - 4
tenant/organization/src/main/resources/mapper/SysDeptMapper.xml

@@ -35,10 +35,7 @@
             sd.is_delete = 0
             <if test="deptId!=null and deptId!=''">
 
-                and route like CONCAT(#{deptId}, '%')
-            </if>
-            <if test="sysCode!=null and sysCode!=''">
-                and sd.sys_code = #{sysCode}
+                and route like CONCAT('%',#{deptId}, '%')
             </if>
 
         GROUP BY

+ 1 - 1
tenant/organization/src/main/resources/mapper/SysUserJzgInfoMapper.xml

@@ -80,7 +80,7 @@
             and suji.type_attr = #{sysUserInfoListVo.typeAttr}
         </if>
         <if test="sysUserInfoListVo.status != null and sysUserInfoListVo.status != '-1'">
-            and suji.status = #{sysUserInfoListVo.status} n
+            and suji.status = #{sysUserInfoListVo.status}
         </if>
         <if test="sysUserInfoListVo.isEnable != null and sysUserInfoListVo.isEnable != ''">
             and suji.is_enable = #{sysUserInfoListVo.isEnable}