Эх сурвалжийг харах

获取方案 app登录租户修改

785834757 1 жил өмнө
parent
commit
332ba43206
25 өөрчлөгдсөн 735 нэмэгдсэн , 13 устгасан
  1. 17 0
      commons/src/main/java/com/jzg/commons/config/MultiTenantHandler.java
  2. 4 0
      commons/src/main/java/com/jzg/commons/entity/dto/AgreementParam.java
  3. 3 2
      commons/src/main/java/com/jzg/commons/entity/quote/vo/CarInfoVo.java
  4. 36 0
      commons/src/main/java/com/jzg/commons/entity/scheme/vo/PtlAgreementInsCompanyVo.java
  5. 8 0
      commons/src/main/java/com/jzg/commons/entity/scheme/vo/SchemeDrivingVo.java
  6. 98 0
      commons/src/main/java/com/jzg/commons/entity/scheme/vo/SchemeResultVo.java
  7. 35 0
      commons/src/main/java/com/jzg/commons/entity/scheme/vo/SchemeRuleFilterVo.java
  8. 17 0
      commons/src/main/java/com/jzg/commons/entity/user/vo/SysTennatVo.java
  9. 41 0
      tenant/costsorrule/src/main/java/com/jzg/costsorrule/model/ValidateSchemeRuleVo.java
  10. 4 1
      tenant/costsorrule/src/main/java/com/jzg/costsorrule/service/impl/RuleServiceImpl.java
  11. 20 0
      tenant/organization/src/main/java/com/jzg/organization/client/CostsRuleClient.java
  12. 18 3
      tenant/organization/src/main/java/com/jzg/organization/controller/SchemeController.java
  13. 7 0
      tenant/organization/src/main/java/com/jzg/organization/controller/UserController.java
  14. 4 0
      tenant/organization/src/main/java/com/jzg/organization/mapper/PtlAgreementMapper.java
  15. 12 0
      tenant/organization/src/main/java/com/jzg/organization/mapper/PtlSchemeMapper.java
  16. 4 0
      tenant/organization/src/main/java/com/jzg/organization/mapper/SysUserJzgInfoMapper.java
  17. 7 0
      tenant/organization/src/main/java/com/jzg/organization/service/PtlAgreementService.java
  18. 16 4
      tenant/organization/src/main/java/com/jzg/organization/service/PtlSchemeService.java
  19. 8 0
      tenant/organization/src/main/java/com/jzg/organization/service/SysUserService.java
  20. 27 0
      tenant/organization/src/main/java/com/jzg/organization/service/impl/PtlAgreementServiceImpl.java
  21. 137 1
      tenant/organization/src/main/java/com/jzg/organization/service/impl/PtlSchemeServiceImpl.java
  22. 16 0
      tenant/organization/src/main/java/com/jzg/organization/service/impl/SysUserServiceImpl.java
  23. 61 0
      tenant/organization/src/main/resources/mapper/PtlAgreementMapper.xml
  24. 114 2
      tenant/organization/src/main/resources/mapper/PtlSchemeMapper.xml
  25. 21 0
      tenant/organization/src/main/resources/mapper/SysUserJzgInfoMapper.xml

+ 17 - 0
commons/src/main/java/com/jzg/commons/config/MultiTenantHandler.java

@@ -5,13 +5,18 @@ import com.jzg.commons.constants.SystemConstants;
 import com.jzg.commons.core.base.BaseController;
 import com.jzg.commons.core.base.BaseController;
 import com.jzg.commons.core.base.TenantContext;
 import com.jzg.commons.core.base.TenantContext;
 import com.jzg.commons.entity.properties.TenantProperties;
 import com.jzg.commons.entity.properties.TenantProperties;
+import jakarta.servlet.http.HttpServletRequest;
 import jodd.util.StringUtil;
 import jodd.util.StringUtil;
 import net.sf.jsqlparser.expression.Expression;
 import net.sf.jsqlparser.expression.Expression;
 import net.sf.jsqlparser.expression.StringValue;
 import net.sf.jsqlparser.expression.StringValue;
 import net.sf.jsqlparser.schema.Column;
 import net.sf.jsqlparser.schema.Column;
 import org.springframework.core.annotation.Order;
 import org.springframework.core.annotation.Order;
+import org.springframework.web.context.request.RequestAttributes;
+import org.springframework.web.context.request.RequestContextHolder;
+import org.springframework.web.context.request.ServletRequestAttributes;
 
 
 import java.util.List;
 import java.util.List;
+import java.util.Objects;
 
 
 
 
 /**
 /**
@@ -26,6 +31,8 @@ public class MultiTenantHandler implements TenantLineHandler {
 
 
     private final BaseController controller;
     private final BaseController controller;
 
 
+
+
     public MultiTenantHandler(TenantProperties properties, BaseController controller) {
     public MultiTenantHandler(TenantProperties properties, BaseController controller) {
         this.properties = properties;
         this.properties = properties;
         this.controller = controller;
         this.controller = controller;
@@ -40,6 +47,15 @@ public class MultiTenantHandler implements TenantLineHandler {
     public Expression getTenantId() {
     public Expression getTenantId() {
         // 实际应该从用户信息中获取,框架一般都有获取用户信息的接口
         // 实际应该从用户信息中获取,框架一般都有获取用户信息的接口
         String tenant_id = controller.getUserLoginSystem();
         String tenant_id = controller.getUserLoginSystem();
+        //如果使用的是APP 则从请求头中获取租户id
+        if(tenant_id.equals("APP")){
+            RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes();
+            HttpServletRequest request = null;
+            if(Objects.nonNull(requestAttributes)){
+                request = ((ServletRequestAttributes)requestAttributes).getRequest();
+            }
+            tenant_id = request.getHeader("system_code");
+        }
         // 判空校验
         // 判空校验
         if (StringUtil.isNotEmpty(tenant_id)) {
         if (StringUtil.isNotEmpty(tenant_id)) {
             return new StringValue(tenant_id);
             return new StringValue(tenant_id);
@@ -88,6 +104,7 @@ public class MultiTenantHandler implements TenantLineHandler {
         return false;
         return false;
     }
     }
 
 
+    @Override
     public boolean ignoreInsert(List<Column> columns, String tenantIdColumn) {
     public boolean ignoreInsert(List<Column> columns, String tenantIdColumn) {
         boolean isFlag = false;
         boolean isFlag = false;
         for (Column column : columns) {
         for (Column column : columns) {

+ 4 - 0
commons/src/main/java/com/jzg/commons/entity/dto/AgreementParam.java

@@ -6,6 +6,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
 import lombok.Data;
 import lombok.Data;
 
 
 import java.time.LocalDateTime;
 import java.time.LocalDateTime;
+import java.util.List;
 
 
 @Schema(description = "协议表分页查询dto")
 @Schema(description = "协议表分页查询dto")
 @Data
 @Data
@@ -19,6 +20,9 @@ public class AgreementParam extends PageRequest {
     @Schema(description = "关联-保险公司id")
     @Schema(description = "关联-保险公司id")
     private String companyId;
     private String companyId;
 
 
+    @Schema(description = "关联-保险公司ids")
+    private List<String> companyIds;
+
     @Schema(description = "协议类型 1-平台协议-平台结算 2-私有协议-自行结算 3-网销协议-自行结算")
     @Schema(description = "协议类型 1-平台协议-平台结算 2-私有协议-自行结算 3-网销协议-自行结算")
     private Integer agreementType;
     private Integer agreementType;
 
 

+ 3 - 2
commons/src/main/java/com/jzg/commons/entity/quote/vo/CarInfoVo.java

@@ -9,6 +9,7 @@ import org.springframework.util.StringUtils;
 
 
 import java.io.Serial;
 import java.io.Serial;
 import java.io.Serializable;
 import java.io.Serializable;
+import java.util.Objects;
 
 
 /**
 /**
  * @description: 车辆信息
  * @description: 车辆信息
@@ -146,7 +147,7 @@ public class CarInfoVo implements Serializable {
      * 是否贷款车 true 贷款车
      * 是否贷款车 true 贷款车
      */
      */
     private boolean loanStatus;
     private boolean loanStatus;
-    /**
+    /* *
      * 所属性质(1个人 2企业 3机关)
      * 所属性质(1个人 2企业 3机关)
      */
      */
     private String property;
     private String property;
@@ -166,7 +167,7 @@ public class CarInfoVo implements Serializable {
      * @return 核定载质量吨位
      * @return 核定载质量吨位
      */
      */
     public String getTonCount() {
     public String getTonCount() {
-        if (StringUtils.hasLength(limitLoad)) {
+        if (StringUtils.hasLength(limitLoad) || Objects.isNull(limitLoad)) {
             return null;
             return null;
         }
         }
         double v = Double.parseDouble(limitLoad);
         double v = Double.parseDouble(limitLoad);

+ 36 - 0
commons/src/main/java/com/jzg/commons/entity/scheme/vo/PtlAgreementInsCompanyVo.java

@@ -0,0 +1,36 @@
+package com.jzg.commons.entity.scheme.vo;
+
+import com.jzg.commons.entity.po.EsmInsCompany;
+import com.jzg.commons.entity.po.PtlAgreement;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.io.Serializable;
+import java.util.List;
+
+@EqualsAndHashCode(callSuper = true)
+@Data
+public class PtlAgreementInsCompanyVo extends EsmInsCompany implements Serializable {
+
+    private static final long serialVersionUID = -5790993730287966635L;
+
+//    @Schema(description = "是否排除")
+//    private String isExclude;
+
+//    @Schema(description = "是否税源")
+//    private String isTaxSource;
+
+//    @Schema(description = "税源协议id")
+//    private String TaxSourceAgreementId;
+
+    @Schema(description = "协议信息")
+    private List<PtlAgreement> agreement;
+
+//    @Schema(description = "报价后的信息")
+//    private InsOrdersEditingVo.InsAreaCompanyEditingDto editingDto;
+
+    @Schema(description = "投保指引")
+    private String insGuide;
+
+}

+ 8 - 0
commons/src/main/java/com/jzg/commons/entity/scheme/vo/SchemeDrivingVo.java

@@ -0,0 +1,8 @@
+package com.jzg.commons.entity.scheme.vo;
+
+import lombok.Data;
+
+@Data
+public class SchemeDrivingVo {
+
+}

+ 98 - 0
commons/src/main/java/com/jzg/commons/entity/scheme/vo/SchemeResultVo.java

@@ -0,0 +1,98 @@
+package com.jzg.commons.entity.scheme.vo;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+public class SchemeResultVo {
+
+    private List<SchemeInfoVo> schemes = new ArrayList<>();
+    private SchemeInfoVo optionalScheme;
+
+    @Data
+    @NoArgsConstructor
+    @AllArgsConstructor
+    public static class SchemeVo{
+        private String id;
+        private String companyId;
+        private String productId;
+        private String schemeType;
+        List<SchemeInfoVo> infos = new ArrayList<>();
+    }
+
+    @Data
+    @NoArgsConstructor
+    @AllArgsConstructor
+    public static class SchemeInfoVo{
+        private String id;
+
+        private String schemeType;
+
+        private String SchemeName;
+
+        private String description;
+
+        private String companyId;
+
+        private String productId;
+
+        List<Kind> kinds = new ArrayList<>();
+
+        List<Driving> drivings = new ArrayList<>();
+    }
+
+    @Data
+    @NoArgsConstructor
+    @AllArgsConstructor
+    public static class Kind{
+
+        private String id;
+
+        private String kindCode;
+
+        private String kindName;
+
+        private String alias;
+
+        private String grouping;
+
+        private String amount;
+
+        private String unitAmount;
+
+        private String serviceTimes;
+
+        private List<Option> options = new ArrayList<>();
+    }
+
+    @Data
+    @NoArgsConstructor
+    @AllArgsConstructor
+    public static class Option{
+
+        private String id;
+
+        private String label;
+
+        private String value;
+    }
+
+    @Data
+    @NoArgsConstructor
+    @AllArgsConstructor
+    public static class Driving{
+        private String id;
+        private String productName;
+        private String productCode;
+        private String alias;
+        private String coverage;
+        private String premium;
+        private String quantity;
+    }
+}

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

@@ -0,0 +1,35 @@
+package com.jzg.commons.entity.scheme.vo;
+
+import com.jzg.commons.entity.quote.vo.CarInfoVo;
+import com.jzg.commons.entity.quote.vo.CustomerInfoVo;
+import io.swagger.v3.oas.annotations.media.Schema;
+import jakarta.validation.Valid;
+import lombok.Data;
+
+
+@Data
+public class SchemeRuleFilterVo {
+
+    @Schema(description = "产品id")
+    private String productId;
+
+    @Valid
+    @Schema(description =  "车辆信息")
+    private CarInfoVo carInfo;
+
+    @Valid
+    @Schema(description =  "车主信息")
+    private CustomerInfoVo ownerInfo;
+
+    @Valid
+    @Schema(description =  "投保人信息")
+    private CustomerInfoVo applyInfo;
+
+    @Valid
+    @Schema(description =  "被保人信息")
+    private CustomerInfoVo insureInfo;
+
+    @Schema(description =  "用户id")
+    private String userId;
+
+}

+ 17 - 0
commons/src/main/java/com/jzg/commons/entity/user/vo/SysTennatVo.java

@@ -0,0 +1,17 @@
+package com.jzg.commons.entity.user.vo;
+
+import lombok.Data;
+
+@Data
+public class SysTennatVo {
+
+    private String systemCode;
+
+    private String sysName;
+
+    private String sysIcon;
+
+    private String deptName;
+
+    private String iconAddress;
+}

+ 41 - 0
tenant/costsorrule/src/main/java/com/jzg/costsorrule/model/ValidateSchemeRuleVo.java

@@ -1,12 +1,23 @@
 package com.jzg.costsorrule.model;
 package com.jzg.costsorrule.model;
 
 
+import com.alibaba.fastjson.JSONObject;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.google.gson.JsonObject;
+import com.jzg.commons.entity.po.SysDict;
 import com.jzg.commons.entity.scheme.po.PtlSchemeRulesAttrLink;
 import com.jzg.commons.entity.scheme.po.PtlSchemeRulesAttrLink;
+import com.jzg.commons.entity.scheme.vo.SchemeRuleFilterVo;
 import com.jzg.quotation.commons.entity.vo.aggregated.QuoteVo;
 import com.jzg.quotation.commons.entity.vo.aggregated.QuoteVo;
 import lombok.AllArgsConstructor;
 import lombok.AllArgsConstructor;
 import lombok.Data;
 import lombok.Data;
 import lombok.NoArgsConstructor;
 import lombok.NoArgsConstructor;
+import org.redisson.api.RFunction;
+import org.redisson.api.RList;
+import org.redisson.api.RedissonClient;
 
 
 import java.util.List;
 import java.util.List;
+import java.util.Objects;
+
+import static com.jzg.commons.constants.RedisKeyConstants.DICT_REDIS_KEY;
 
 
 @AllArgsConstructor
 @AllArgsConstructor
 @NoArgsConstructor
 @NoArgsConstructor
@@ -14,4 +25,34 @@ import java.util.List;
 public class ValidateSchemeRuleVo {
 public class ValidateSchemeRuleVo {
     private QuoteVo quoteVo;
     private QuoteVo quoteVo;
     private List<PtlSchemeRulesAttrLink> attrLinks;
     private List<PtlSchemeRulesAttrLink> attrLinks;
+
+    public void builderQuoteVo(SchemeRuleFilterVo schemeRuleFilterVo, RedissonClient redissonClient){
+        if(Objects.isNull(quoteVo)){
+            quoteVo = new QuoteVo();
+        }
+        this.quoteVo.setCarInfoVo(schemeRuleFilterVo.getCarInfo());
+        this.quoteVo.setOwnersInfo(schemeRuleFilterVo.getOwnerInfo());
+        this.quoteVo.setPolicyHolderInfo(schemeRuleFilterVo.getApplyInfo());
+        this.quoteVo.setInsuredPersonInfo(schemeRuleFilterVo.getInsureInfo());
+
+        //转换字典value转成label
+        //车辆性质
+        RList<SysDict> carNatureCode = redissonClient.getList(DICT_REDIS_KEY + "car_nature_code");
+        this.quoteVo.getCarInfoVo().setCarNatureCode(
+                carNatureCode.stream().filter(x -> x.getValue().equals(this.quoteVo.getCarInfoVo().getCarNatureCode())).findFirst().get().getLabel());
+        //能源类型
+        RList<SysDict> energyTypeCode = redissonClient.getList(DICT_REDIS_KEY + "energy_type_code");
+        this.quoteVo.getCarInfoVo().setEnergyTypeCode(
+                energyTypeCode.stream().filter(x->x.getValue().equals(this.quoteVo.getCarInfoVo().getEnergyTypeCode())).findFirst().get().getLabel()
+        );
+
+        RList<SysDict> vehicleUseCode = redissonClient.getList(DICT_REDIS_KEY + "vehicle_use_code");
+        this.quoteVo.getCarInfoVo().setVehicleUseCode(
+                vehicleUseCode.stream().filter(x->x.getValue().equals(this.quoteVo.getCarInfoVo().getVehicleUseCode())).findFirst().get().getLabel()
+        );
+
+
+        System.out.printf(JSONObject.toJSONString(this.quoteVo));
+
+    }
 }
 }

+ 4 - 1
tenant/costsorrule/src/main/java/com/jzg/costsorrule/service/impl/RuleServiceImpl.java

@@ -213,7 +213,10 @@ public class RuleServiceImpl implements RuleService {
 //        } else if (linkVo.getMin().contains(value)) {
 //        } else if (linkVo.getMin().contains(value)) {
 //            return true;
 //            return true;
 //        }
 //        }
-        return linkVo.getMin().equals(value);
+        //判断如果value 是 boolean值 则将min进行转换为bool
+        boolean minValue = Boolean.valueOf(linkVo.getMin());
+        boolean valueBool = Boolean.valueOf(value);
+        return minValue == valueBool;
     }
     }
 
 
     public boolean dateTimeEqual(RuleAttrLinkVo linkVo, String value){
     public boolean dateTimeEqual(RuleAttrLinkVo linkVo, String value){

+ 20 - 0
tenant/organization/src/main/java/com/jzg/organization/client/CostsRuleClient.java

@@ -0,0 +1,20 @@
+package com.jzg.organization.client;
+
+import com.jzg.commons.core.page.HttpResult;
+import com.jzg.commons.entity.po.EsmInsCompany;
+import com.jzg.costsorrule.model.ValidateSchemeRuleVo;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestParam;
+
+import java.util.List;
+
+@FeignClient(name="jzg-costsorrule",url = "http://localhost:8001/")
+public interface CostsRuleClient {
+
+    @GetMapping("/validate/rule/validateSchemeRule")
+    public HttpResult validateSchemeRule(@RequestBody ValidateSchemeRuleVo validateSchemeRuleVo);
+
+
+}

+ 18 - 3
tenant/organization/src/main/java/com/jzg/organization/controller/SchemeController.java

@@ -1,9 +1,7 @@
 package com.jzg.organization.controller;
 package com.jzg.organization.controller;
 
 
 import com.jzg.commons.core.page.HttpResult;
 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.entity.scheme.vo.*;
 import com.jzg.commons.request.RequestSingleParam;
 import com.jzg.commons.request.RequestSingleParam;
 import com.jzg.organization.service.PtlSchemeService;
 import com.jzg.organization.service.PtlSchemeService;
 import io.swagger.v3.oas.annotations.Operation;
 import io.swagger.v3.oas.annotations.Operation;
@@ -12,6 +10,8 @@ import jakarta.validation.Valid;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.bind.annotation.*;
 
 
+import java.util.List;
+
 @Tag(name="方案管理")
 @Tag(name="方案管理")
 @RestController
 @RestController
 @RequestMapping("/scheme")
 @RequestMapping("/scheme")
@@ -67,4 +67,19 @@ public class SchemeController {
     public HttpResult getCompanyList(){
     public HttpResult getCompanyList(){
         return HttpResult.ok(ptlSchemeService.getCompanyList());
         return HttpResult.ok(ptlSchemeService.getCompanyList());
     }
     }
+
+    @Operation(summary = "规则过滤保险公司")
+    @PostMapping("/ruleFilterCompany")
+    public HttpResult ruleFilterCompany(@RequestBody SchemeRuleFilterVo schemeRuleFilterVo){
+        List<PtlAgreementInsCompanyVo> ptlAgreementInsCompanyVos = ptlSchemeService.ruleFilterCompany(schemeRuleFilterVo);
+        return HttpResult.ok(ptlAgreementInsCompanyVos);
+    }
+
+    @Operation(summary = "获取方案结果")
+    @GetMapping("/getSchemeResult")
+    public HttpResult getSchemeResult(String companyId,String productId){
+        SchemeResultVo schemeResultVo = ptlSchemeService.getSchemeResult(companyId,productId);
+        return HttpResult.ok(schemeResultVo);
+    }
+
 }
 }

+ 7 - 0
tenant/organization/src/main/java/com/jzg/organization/controller/UserController.java

@@ -1,6 +1,7 @@
 package com.jzg.organization.controller;
 package com.jzg.organization.controller;
 
 
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.jzg.commons.annotation.IgnoreTenant;
 import com.jzg.commons.core.base.BaseController;
 import com.jzg.commons.core.base.BaseController;
 import com.jzg.commons.core.page.HttpResult;
 import com.jzg.commons.core.page.HttpResult;
 import com.jzg.commons.entity.dto.SysUserInfoParam;
 import com.jzg.commons.entity.dto.SysUserInfoParam;
@@ -144,5 +145,11 @@ public class UserController extends BaseController {
         return sysUserService.salesmanAuthFailed(auditSalesmanVo)? HttpResult.ok("业务员审核成功") : HttpResult.error("业务员审核失败");
         return sysUserService.salesmanAuthFailed(auditSalesmanVo)? HttpResult.ok("业务员审核成功") : HttpResult.error("业务员审核失败");
     }
     }
 
 
+    @IgnoreTenant
+    @Operation(summary = "获取用户的租户列表",description = "获取用户的租户列表")
+    @PostMapping(value = "/getTenantList")
+    public HttpResult getTenantList(){
+        return HttpResult.ok(sysUserService.getTenantList(getUserName()));
+    }
 
 
 }
 }

+ 4 - 0
tenant/organization/src/main/java/com/jzg/organization/mapper/PtlAgreementMapper.java

@@ -8,6 +8,8 @@ import com.jzg.commons.entity.vo.AgreementVo;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Param;
 
 
+import java.util.List;
+
 /**
 /**
 * @author dongxin
 * @author dongxin
 * @description 针对表【ptl_agreement(协议信息表)】的数据库操作Mapper
 * @description 针对表【ptl_agreement(协议信息表)】的数据库操作Mapper
@@ -25,6 +27,8 @@ public interface PtlAgreementMapper extends BaseMapper<PtlAgreement> {
      */
      */
     Page<AgreementVo> queryPage( Page page, @Param("param") AgreementParam param);
     Page<AgreementVo> queryPage( Page page, @Param("param") AgreementParam param);
 
 
+    List<AgreementVo> queryList(@Param("param") AgreementParam param);
+
     /**
     /**
      * 通过id获取协议
      * 通过id获取协议
      * @param id
      * @param id

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

@@ -6,6 +6,7 @@ import com.jzg.commons.entity.po.EsmInsCompany;
 import com.jzg.commons.entity.po.SysDept;
 import com.jzg.commons.entity.po.SysDept;
 import com.jzg.commons.entity.scheme.po.PtlScheme;
 import com.jzg.commons.entity.scheme.po.PtlScheme;
 import com.jzg.commons.entity.scheme.vo.PtlSchemeVo;
 import com.jzg.commons.entity.scheme.vo.PtlSchemeVo;
+import com.jzg.commons.entity.scheme.vo.SchemeResultVo;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Param;
 
 
@@ -27,4 +28,15 @@ public interface PtlSchemeMapper extends BaseMapper<PtlScheme> {
      * @return
      * @return
      */
      */
     public List<EsmInsCompany> getCompanyList();
     public List<EsmInsCompany> getCompanyList();
+
+    /**
+     * 获取方案结果
+     * @param companyId
+     * @param productId
+     * @return
+     */
+    public List<SchemeResultVo.SchemeVo> getSchemeInsuranceInfo(@Param("companyId") String companyId, @Param("productId") String productId);
+
+    public List<SchemeResultVo.SchemeVo> getSchemeDrivingInfo(@Param("companyId") String companyId, @Param("productId") String productId);
+
 }
 }

+ 4 - 0
tenant/organization/src/main/java/com/jzg/organization/mapper/SysUserJzgInfoMapper.java

@@ -4,7 +4,9 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 
 
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.jzg.commons.entity.dto.SysUserJzgInfoDto;
 import com.jzg.commons.entity.dto.SysUserJzgInfoDto;
+import com.jzg.commons.entity.po.SysSystem;
 import com.jzg.commons.entity.po.SysUserJzgInfo;
 import com.jzg.commons.entity.po.SysUserJzgInfo;
+import com.jzg.commons.entity.user.vo.SysTennatVo;
 import com.jzg.commons.entity.vo.SysUserInfoListVo;
 import com.jzg.commons.entity.vo.SysUserInfoListVo;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Param;
@@ -19,4 +21,6 @@ public interface SysUserJzgInfoMapper extends BaseMapper<SysUserJzgInfo> {
 
 
     SysUserJzgInfo getUserByMobile(String mobile);
     SysUserJzgInfo getUserByMobile(String mobile);
 
 
+    List<SysTennatVo> getTenantList(String userId);
+
 }
 }

+ 7 - 0
tenant/organization/src/main/java/com/jzg/organization/service/PtlAgreementService.java

@@ -27,6 +27,13 @@ public interface PtlAgreementService extends IService<PtlAgreement> {
      */
      */
     Page<AgreementVo> queryPage(AgreementParam param);
     Page<AgreementVo> queryPage(AgreementParam param);
 
 
+    /**
+     * 获取协议列表
+     * @param param
+     * @return
+     */
+    List<AgreementVo> queryList(AgreementParam param);
+
     /**
     /**
      * 协议明细查询
      * 协议明细查询
      * @param id
      * @param id

+ 16 - 4
tenant/organization/src/main/java/com/jzg/organization/service/PtlSchemeService.java

@@ -6,10 +6,7 @@ import com.jzg.commons.entity.po.EsmInsCompany;
 import com.jzg.commons.entity.po.PtlAgreementUndwrtRulesAttr;
 import com.jzg.commons.entity.po.PtlAgreementUndwrtRulesAttr;
 import com.jzg.commons.entity.po.SysArea;
 import com.jzg.commons.entity.po.SysArea;
 import com.jzg.commons.entity.scheme.po.PtlScheme;
 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.scheme.vo.*;
 import com.jzg.commons.entity.vo.AgreementRulesVo;
 import com.jzg.commons.entity.vo.AgreementRulesVo;
 import com.jzg.commons.entity.vo.EsmInsCompanyResVo;
 import com.jzg.commons.entity.vo.EsmInsCompanyResVo;
 import com.jzg.commons.entity.vo.SysAreaVo;
 import com.jzg.commons.entity.vo.SysAreaVo;
@@ -71,4 +68,19 @@ public interface PtlSchemeService extends IService<PtlScheme> {
      * @return
      * @return
      */
      */
     public List<EsmInsCompanyResVo> getCompanyList();
     public List<EsmInsCompanyResVo> getCompanyList();
+
+    /**
+     * 规则过滤保险公司
+     * @param schemeRuleFilterVo
+     * @return
+     */
+    public List<PtlAgreementInsCompanyVo> ruleFilterCompany(SchemeRuleFilterVo schemeRuleFilterVo);
+
+    /**
+     * 获取方案结果
+     * @param companyId
+     * @param productId
+     * @return
+     */
+    public SchemeResultVo getSchemeResult(String companyId,String productId);
 }
 }

+ 8 - 0
tenant/organization/src/main/java/com/jzg/organization/service/SysUserService.java

@@ -5,7 +5,9 @@ import com.baomidou.mybatisplus.extension.service.IService;
 import com.jzg.commons.core.page.HttpResult;
 import com.jzg.commons.core.page.HttpResult;
 import com.jzg.commons.entity.dto.SysUserInfoParam;
 import com.jzg.commons.entity.dto.SysUserInfoParam;
 import com.jzg.commons.entity.dto.SysUserJzgInfoDto;
 import com.jzg.commons.entity.dto.SysUserJzgInfoDto;
+import com.jzg.commons.entity.po.SysSystem;
 import com.jzg.commons.entity.po.SysUser;
 import com.jzg.commons.entity.po.SysUser;
+import com.jzg.commons.entity.user.vo.SysTennatVo;
 import com.jzg.commons.entity.vo.*;
 import com.jzg.commons.entity.vo.*;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RequestParam;
@@ -109,4 +111,10 @@ public interface SysUserService extends IService<SysUser> {
      * @return
      * @return
      */
      */
     AuditCountVo getAuditCount(SysUserInfoParam sysUserInfoParam);
     AuditCountVo getAuditCount(SysUserInfoParam sysUserInfoParam);
+
+    /**
+     * 获取用户租户列表
+     * @return
+     */
+    List<SysTennatVo> getTenantList(String userId);
 }
 }

+ 27 - 0
tenant/organization/src/main/java/com/jzg/organization/service/impl/PtlAgreementServiceImpl.java

@@ -99,6 +99,33 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
         }
         }
         return page;
         return page;
     }
     }
+    
+    @Override
+    public List<AgreementVo> queryList(AgreementParam param){
+        List<AgreementVo> agreementVos = baseMapper.queryList(param);
+        if(CollUtil.isNotEmpty(agreementVos)){
+            for (AgreementVo agreementVo : agreementVos) {
+                // 获取文件外链地址
+                if(StringUtils.isNotBlank(agreementVo.getFileName())){
+                    String fileUrl = MinioUtils.getPresignedObjectUrl(bucketName,agreementVo.getFileName());
+                    agreementVo.setFileUrl(fileUrl);
+                }
+                LocalDateTime startDate = agreementVo.getStartDate();
+                LocalDateTime endDate = agreementVo.getEndDate();
+                LocalDateTime now = LocalDateTime.now();
+                PtlAgreement agreement = new PtlAgreement();
+                agreement.setId(agreementVo.getId());
+                //更新是否有效
+                if (now.isEqual(startDate) || (now.isAfter(startDate) && now.isBefore(endDate))) {
+                    agreement.setValidStatus("0");
+                } else {
+                    agreement.setValidStatus("1");
+                }
+                updateById(agreement);
+            }
+        }
+        return agreementVos;
+    }
 
 
     @Override
     @Override
     public AgreementInfoVo queryById(String id) {
     public AgreementInfoVo queryById(String id) {

+ 137 - 1
tenant/organization/src/main/java/com/jzg/organization/service/impl/PtlSchemeServiceImpl.java

@@ -4,20 +4,30 @@ import cn.hutool.core.bean.BeanUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.jzg.commons.core.page.HttpResult;
+import com.jzg.commons.entity.dto.AgreementParam;
 import com.jzg.commons.entity.po.EsmInsCompany;
 import com.jzg.commons.entity.po.EsmInsCompany;
 import com.jzg.commons.entity.po.PtlAgreementUndwrtRulesAttr;
 import com.jzg.commons.entity.po.PtlAgreementUndwrtRulesAttr;
 import com.jzg.commons.entity.po.PtlAgreementUndwrtRulesAttrLink;
 import com.jzg.commons.entity.po.PtlAgreementUndwrtRulesAttrLink;
 import com.jzg.commons.entity.po.PtlAgreementUndwrtRulesDictLabal;
 import com.jzg.commons.entity.po.PtlAgreementUndwrtRulesDictLabal;
 import com.jzg.commons.entity.scheme.po.*;
 import com.jzg.commons.entity.scheme.po.*;
 import com.jzg.commons.entity.scheme.vo.*;
 import com.jzg.commons.entity.scheme.vo.*;
+import com.jzg.commons.entity.vo.AgreementVo;
 import com.jzg.commons.entity.vo.EsmInsCompanyResVo;
 import com.jzg.commons.entity.vo.EsmInsCompanyResVo;
 import com.jzg.commons.exception.ValidateException;
 import com.jzg.commons.exception.ValidateException;
 import com.jzg.commons.util.AssertionUtils;
 import com.jzg.commons.util.AssertionUtils;
+import com.jzg.commons.util.MinioUtils;
 import com.jzg.commons.util.StringUtils;
 import com.jzg.commons.util.StringUtils;
+import com.jzg.costsorrule.model.ValidateSchemeRuleVo;
+import com.jzg.organization.client.CostsRuleClient;
 import com.jzg.organization.mapper.*;
 import com.jzg.organization.mapper.*;
+import com.jzg.organization.service.PtlAgreementService;
 import com.jzg.organization.service.PtlAgreementUndwrtRulesAttrService;
 import com.jzg.organization.service.PtlAgreementUndwrtRulesAttrService;
 import com.jzg.organization.service.PtlSchemeService;
 import com.jzg.organization.service.PtlSchemeService;
+import com.jzg.quotation.commons.entity.vo.aggregated.QuoteVo;
+import org.redisson.api.RedissonClient;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.transaction.annotation.Transactional;
 
 
@@ -32,6 +42,9 @@ import java.util.stream.Collectors;
 @Service
 @Service
 public class PtlSchemeServiceImpl extends ServiceImpl<PtlSchemeMapper, PtlScheme> implements PtlSchemeService {
 public class PtlSchemeServiceImpl extends ServiceImpl<PtlSchemeMapper, PtlScheme> implements PtlSchemeService {
 
 
+    @Value("${minio.bucket-name}")
+    private String bucketName;
+
     @Autowired
     @Autowired
     PtlSchemeMapper ptlSchemeMapper;
     PtlSchemeMapper ptlSchemeMapper;
 
 
@@ -53,6 +66,15 @@ public class PtlSchemeServiceImpl extends ServiceImpl<PtlSchemeMapper, PtlScheme
     @Autowired
     @Autowired
     PtlAgreementUndwrtRulesAttrService agreementUndwrtRulesAttrService;
     PtlAgreementUndwrtRulesAttrService agreementUndwrtRulesAttrService;
 
 
+    @Autowired
+    CostsRuleClient costsRuleClient;
+
+    @Autowired
+    RedissonClient redissonClient;
+
+    @Autowired
+    private PtlAgreementService agreementService;
+
     @Override
     @Override
     @Transactional(rollbackFor = Exception.class)
     @Transactional(rollbackFor = Exception.class)
     public boolean saveScheme(PtlSchemeSaveVo ptlSchemeSaveVo) {
     public boolean saveScheme(PtlSchemeSaveVo ptlSchemeSaveVo) {
@@ -123,7 +145,7 @@ public class PtlSchemeServiceImpl extends ServiceImpl<PtlSchemeMapper, PtlScheme
     public PtlSchemeQueryVo getScheme(String id) {
     public PtlSchemeQueryVo getScheme(String id) {
         //获取方案信息
         //获取方案信息
         PtlSchemeInfo ptlSchemeInfo = ptlSchemeInfoMapper.selectOne(new LambdaQueryWrapper<PtlSchemeInfo>()
         PtlSchemeInfo ptlSchemeInfo = ptlSchemeInfoMapper.selectOne(new LambdaQueryWrapper<PtlSchemeInfo>()
-                .eq(PtlSchemeInfo::getSchemeId, id));
+                .eq(PtlSchemeInfo::getId, id));
         AssertionUtils.isFail(Objects.isNull(ptlSchemeInfo),"方案不存在");
         AssertionUtils.isFail(Objects.isNull(ptlSchemeInfo),"方案不存在");
         //获取方案信息
         //获取方案信息
         PtlScheme ptlScheme = ptlSchemeMapper.selectOne(new LambdaQueryWrapper<PtlScheme>()
         PtlScheme ptlScheme = ptlSchemeMapper.selectOne(new LambdaQueryWrapper<PtlScheme>()
@@ -259,4 +281,118 @@ public class PtlSchemeServiceImpl extends ServiceImpl<PtlSchemeMapper, PtlScheme
         List<EsmInsCompany> companyList = ptlSchemeMapper.getCompanyList();
         List<EsmInsCompany> companyList = ptlSchemeMapper.getCompanyList();
         return BeanUtil.copyToList(companyList, EsmInsCompanyResVo.class);
         return BeanUtil.copyToList(companyList, EsmInsCompanyResVo.class);
     }
     }
+
+    @Override
+    public List<PtlAgreementInsCompanyVo> ruleFilterCompany(SchemeRuleFilterVo schemeRuleFilterVo){
+        //根据权限获取所有保司
+        List<EsmInsCompany> companyList = ptlSchemeMapper.getCompanyList();
+        //根据基本规则 能源、车辆类型、使用性质获取方案
+        List<PtlScheme> ptlSchemes = ptlSchemeMapper.selectList(new LambdaQueryWrapper<PtlScheme>()
+                .eq(PtlScheme::getEnergyType, schemeRuleFilterVo.getCarInfo().getEnergyTypeCode())
+                .eq(PtlScheme::getCarnature, schemeRuleFilterVo.getCarInfo().getCarNatureCode())
+                .eq(PtlScheme::getVehicleType, schemeRuleFilterVo.getCarInfo().getVehicleUseCode())
+                .eq(PtlScheme::getIsDelete, 0));
+
+        // 查找规则
+        List<String> ptlSchemeIds = ptlSchemes.stream().map(PtlScheme::getId).collect(Collectors.toList());
+
+        AssertionUtils.isFail(ptlSchemeIds.isEmpty(),"没有可报价的保险公司");
+
+        List<PtlSchemeRulesAttrLink> ptlSchemeRulesAttrLinks = ptlSchemeRulesAttrLinkMapper.selectList(new LambdaQueryWrapper<PtlSchemeRulesAttrLink>()
+               .in(PtlSchemeRulesAttrLink::getSchemeId, ptlSchemeIds));
+
+        // 将规则根据schemeId聚合转换成Map
+        Map<String, List<PtlSchemeRulesAttrLink>> ptlSchemeRulesAttrLinkMap = ptlSchemeRulesAttrLinks.stream()
+              .collect(Collectors.groupingBy(PtlSchemeRulesAttrLink::getSchemeId));
+
+        ValidateSchemeRuleVo validateSchemeRuleVo = new ValidateSchemeRuleVo();
+        validateSchemeRuleVo.builderQuoteVo(schemeRuleFilterVo, redissonClient);
+        validateSchemeRuleVo.setAttrLinks(ptlSchemeRulesAttrLinks);
+        HttpResult<List<String>> esmInsCompanyHttpResult = costsRuleClient.validateSchemeRule(validateSchemeRuleVo);
+        List<String> insCompanyIds = esmInsCompanyHttpResult.getData();
+        //开始过滤保险公司
+        ptlSchemes.removeIf(ptlScheme -> !insCompanyIds.contains(ptlScheme.getId()));
+        List<String> companyIds = ptlSchemes.stream().map(ptlScheme -> ptlScheme.getCompanyId()).collect(Collectors.toList());
+        companyList.removeIf(company -> !companyIds.contains(company.getId()));
+        List<PtlAgreementInsCompanyVo> resVo = new ArrayList<>();
+        companyList.forEach(company->{
+            PtlAgreementInsCompanyVo vo = new PtlAgreementInsCompanyVo();
+            BeanUtil.copyProperties(company,vo);
+            vo.setLogo(MinioUtils.getPresignedObjectUrl(bucketName,company.getLogo()));
+            resVo.add(vo);
+
+        });
+
+        AgreementParam param = new AgreementParam();
+        param.setCompanyIds(companyIds);
+//        Page<AgreementVo> agreementVoPage = agreementService.queryPage(param);
+        return resVo;
+    }
+
+    @Override
+    public SchemeResultVo getSchemeResult(String companyId,String productId){
+        List<SchemeResultVo.SchemeVo> schemeInsuranceInfo = ptlSchemeMapper.getSchemeInsuranceInfo(companyId, productId);
+        List<SchemeResultVo.SchemeVo> schemeDrivingInfo = ptlSchemeMapper.getSchemeDrivingInfo(companyId, productId);
+        // 创建一个 Map,Key: info.id, Value: List<Driving>
+        Map<String, List<SchemeResultVo.Driving>> drivingMap = new HashMap<>();
+
+        // 遍历 schemeDrivingInfo,把 drivings 存入 map
+        for (SchemeResultVo.SchemeVo drivingScheme : schemeDrivingInfo) {
+            for (SchemeResultVo.SchemeInfoVo info : drivingScheme.getInfos()) {
+                drivingMap.put(info.getId(), info.getDrivings());
+            }
+        }
+
+        // 遍历 schemeInsuranceInfo,把 drivings 合并
+        for (SchemeResultVo.SchemeVo insuranceScheme : schemeInsuranceInfo) {
+            for (SchemeResultVo.SchemeInfoVo info : insuranceScheme.getInfos()) {
+                List<SchemeResultVo.Driving> drivings = drivingMap.get(info.getId());
+                if (drivings != null) {
+                    info.getDrivings().addAll(drivings); // 合并 drivings
+                }
+            }
+        }
+
+        schemeInsuranceInfo.forEach(scheme->{
+            for (SchemeResultVo.SchemeInfoVo info : scheme.getInfos()) {
+                info.setProductId(scheme.getProductId());
+                info.setCompanyId(scheme.getCompanyId());
+            }
+        });
+
+        schemeInsuranceInfo.forEach(schemeVo -> {
+            if(!schemeVo.getInfos().isEmpty()){
+                schemeVo.setSchemeType(schemeVo.getInfos().get(0).getSchemeType());
+            }
+        });
+
+        SchemeResultVo schemeResultVo = new SchemeResultVo();
+        //基础方案
+        SchemeResultVo.SchemeVo schemeVo = schemeInsuranceInfo.stream().filter(x -> x.getSchemeType().equals("1")).findFirst().orElse(null);
+        schemeResultVo.setSchemes(schemeVo.getInfos());
+        //把基础方案的商业险的value 赋值
+        schemeResultVo.getSchemes().forEach(schemeInfoVo -> {
+            schemeInfoVo.getKinds().forEach(kind -> {
+                kind.setAmount(kind.getOptions().get(0).getValue());
+                kind.setUnitAmount(kind.getOptions().get(0).getValue());
+                kind.setServiceTimes(kind.getOptions().get(0).getValue());
+            });
+        });
+
+        //自选方案
+        SchemeResultVo.SchemeVo opSchemeVo = schemeInsuranceInfo.stream().filter(x -> x.getSchemeType().equals("2")).findFirst().orElse(null);
+        schemeResultVo.setOptionalScheme(opSchemeVo.getInfos().get(0));
+
+        //排除交强险的险种
+        schemeResultVo.getSchemes().removeIf(schemeInfoVo ->
+                schemeInfoVo.getKinds().stream().anyMatch(kind -> "J1".equals(kind.getKindCode()))
+        );
+
+        SchemeResultVo.SchemeInfoVo optionalScheme = schemeResultVo.getOptionalScheme();
+        if (optionalScheme != null && optionalScheme.getKinds() != null) {
+            optionalScheme.getKinds().removeIf(kind -> "J1".equals(kind.getKindCode()));
+        }
+
+        return schemeResultVo;
+    }
 }
 }

+ 16 - 0
tenant/organization/src/main/java/com/jzg/organization/service/impl/SysUserServiceImpl.java

@@ -9,6 +9,7 @@ import com.jzg.commons.entity.dto.SysUserInfoParam;
 import com.jzg.commons.entity.dto.SysUserJzgInfoBankCardDto;
 import com.jzg.commons.entity.dto.SysUserJzgInfoBankCardDto;
 import com.jzg.commons.entity.dto.SysUserJzgInfoDto;
 import com.jzg.commons.entity.dto.SysUserJzgInfoDto;
 import com.jzg.commons.entity.po.*;
 import com.jzg.commons.entity.po.*;
+import com.jzg.commons.entity.user.vo.SysTennatVo;
 import com.jzg.commons.entity.vo.*;
 import com.jzg.commons.entity.vo.*;
 import com.jzg.commons.exception.SystemException;
 import com.jzg.commons.exception.SystemException;
 import com.jzg.commons.exception.ValidateException;
 import com.jzg.commons.exception.ValidateException;
@@ -24,6 +25,7 @@ import com.jzg.organization.state.listener.UserStateListener;
 import jakarta.annotation.Resource;
 import jakarta.annotation.Resource;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.statemachine.StateMachine;
 import org.springframework.statemachine.StateMachine;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.transaction.annotation.Transactional;
@@ -40,6 +42,10 @@ import java.util.stream.Collectors;
  */
  */
 @Service
 @Service
 public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> implements SysUserService {
 public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> implements SysUserService {
+
+    @Value("${minio.bucket-name}")
+    private String bucketName;
+
     @Resource
     @Resource
     private SysUserJzgInfoService sysUserJzgInfoService;
     private SysUserJzgInfoService sysUserJzgInfoService;
 
 
@@ -235,6 +241,16 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
         return auditCountVo;
         return auditCountVo;
     }
     }
 
 
+    @Override
+    public List<SysTennatVo> getTenantList(String userId) {
+        List<SysTennatVo> tenantList = sysUserJzgInfoMapper.getTenantList(userId);
+        tenantList.forEach(item->{
+            String presignedObjectUrl = MinioUtils.getPresignedObjectUrl(bucketName, item.getSysIcon());
+            item.setIconAddress(presignedObjectUrl);
+        });
+        return tenantList;
+    }
+
 
 
     @Override
     @Override
     public boolean realNameAuthFailed(String userId){
     public boolean realNameAuthFailed(String userId){

+ 61 - 0
tenant/organization/src/main/resources/mapper/PtlAgreementMapper.xml

@@ -72,6 +72,66 @@
             <if test="param.companyId != null and param.companyId != ''">
             <if test="param.companyId != null and param.companyId != ''">
                 and pa.company_id = #{param.companyId}
                 and pa.company_id = #{param.companyId}
             </if>
             </if>
+            <if test="param.companyIds != null and param.companyIds != ''">
+                and pa.company_id in
+                <foreach collection="param.companyIds" item="item" index="index" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+            </if>
+            <if test="param.agreementType != null ">
+                and pa.agreement_type = #{param.agreementType}
+            </if>
+            <if test="param.validStatus != null ">
+                and pa.valid_status = #{param.validStatus}
+            </if>
+            <if test="param.isEnable != null ">
+                and pa.is_enable = #{param.isEnable}
+            </if>
+            <if test="param.withTax != null ">
+                and pa.with_tax = #{param.withTax}
+            </if>
+            <if test="param.isExternal != null ">
+                and pa.is_external = #{param.isExternal}
+            </if>
+            <if test="param.dockingPerson != null and param.dockingPerson != ''">
+                and ( pa.docking_person = #{param.dockingPerson} or pa.docking_phone = #{param.dockingPerson} )
+            </if>
+            <if test="param.attributionName != null and param.attributionName != ''">
+                and ( paa.username = #{param.attributionName} or paa.user_abbr = #{param.attributionName} )
+            </if>
+            <if test="param.takeStartDate != null and param.takeEndDate != null">
+                and DATE_FORMAT(pa.start_date, '%Y-%m-%d') between #{param.takeStartDate} AND #{param.takeEndDate}
+            </if>
+            <if test="param.loseStartDate != null and param.loseEndDate != null">
+                and DATE_FORMAT(pa.end_date, '%Y-%m-%d') between #{param.loseStartDate} AND #{param.loseEndDate}
+            </if>
+        </where>
+        ORDER BY pa.create_time DESC
+    </select>
+
+    <select id="queryList" resultType="com.jzg.commons.entity.vo.AgreementVo">
+        select <include refid="Base_Column_List"/>
+        FROM ptl_agreement pa
+        LEFT JOIN ptl_agreement_attribution paa on pa.attribution_id = paa.id
+        LEFT JOIN sys_dept sdd on pa.dept_id = sdd.id
+        LEFT JOIN sys_user_jzg_info suji on pa.custodian_id = suji.user_id
+        LEFT JOIN sys_dept sd on suji.dept_id = sd.id
+        LEFT JOIN sys_upload_files suf on pa.file_id = suf.id
+        LEFT JOIN esm_ins_company eic on pa.company_id = eic.id
+        <where>
+            pa.is_delete = 0
+            <if test="param.searchValue != null and param.searchValue != ''">
+                and ( pa.agreement_code = #{param.searchValue} or pa.agreement_title = #{param.searchValue} or pa.agreement_abbreviation = #{param.searchValue})
+            </if>
+            <if test="param.companyId != null and param.companyId != ''">
+                and pa.company_id = #{param.companyId}
+            </if>
+            <if test="param.companyIds != null and param.companyIds != ''">
+                and pa.company_id in
+                <foreach collection="param.companyIds" item="item" index="index" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+            </if>
             <if test="param.agreementType != null ">
             <if test="param.agreementType != null ">
                 and pa.agreement_type = #{param.agreementType}
                 and pa.agreement_type = #{param.agreementType}
             </if>
             </if>
@@ -102,6 +162,7 @@
         </where>
         </where>
         ORDER BY pa.create_time DESC
         ORDER BY pa.create_time DESC
     </select>
     </select>
+
     <select id="queryById" resultType="com.jzg.commons.entity.vo.AgreementVo">
     <select id="queryById" resultType="com.jzg.commons.entity.vo.AgreementVo">
         select <include refid="Base_Column_List"/>
         select <include refid="Base_Column_List"/>
         FROM ptl_agreement pa
         FROM ptl_agreement pa

+ 114 - 2
tenant/organization/src/main/resources/mapper/PtlSchemeMapper.xml

@@ -1,6 +1,51 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <?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">
 <!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">
 <mapper namespace="com.jzg.organization.mapper.PtlSchemeMapper">
+
+    <resultMap id="SchemeVo" type="com.jzg.commons.entity.scheme.vo.SchemeResultVo$SchemeVo">
+        <id column="id" property="id"/>
+        <result column="company_id" property="companyId"/>
+        <result column="product_id" property="productId"/>
+        <collection property="infos" ofType="com.jzg.commons.entity.scheme.vo.SchemeResultVo$SchemeInfoVo"  javaType="java.util.List">
+            <id column="scheme_info_id" property="id"/>
+            <result column="scheme_name" property="schemeName"/>
+            <result column="scheme_type" property="schemeType"/>
+            <result column="description" property="description"/>
+            <collection property="kinds" ofType="com.jzg.commons.entity.scheme.vo.SchemeResultVo$Kind" javaType="java.util.List">
+                <id column="kind_id" property="id"/>
+                <result column="kind_code" property="kindCode"/>
+                <result column="kind_name" property="kindName"/>
+                <result column="alias" property="alias"/>
+                <result column="grouping" property="grouping"/>
+                <collection property="options" ofType="com.jzg.commons.entity.scheme.vo.SchemeResultVo$Option" javaType="java.util.List">
+                    <id column="option_id" property="id"/>
+                    <result column="label" property="label"/>
+                    <result column="value" property="value"/>
+                </collection>
+            </collection>
+        </collection>
+    </resultMap>
+
+    <resultMap id="SchemeDrivingVo" type="com.jzg.commons.entity.scheme.vo.SchemeResultVo$SchemeVo">
+        <id column="id" property="id"/>
+        <result column="company_id" property="companyId"/>
+        <result column="product_id" property="productId"/>
+        <collection property="infos" ofType="com.jzg.commons.entity.scheme.vo.SchemeResultVo$SchemeInfoVo">
+            <id column="scheme_info_id" property="id"/>
+            <result column="scheme_name" property="schemeName"/>
+            <result column="scheme_type" property="schemeType"/>
+            <result column="description" property="description"/>
+            <collection property="drivings" ofType="com.jzg.commons.entity.scheme.vo.SchemeResultVo$Driving">
+                <result column="product_name" property="productName"/>
+                <result column="product_code" property="productCode"/>
+                <result column="alias" property="alias"/>
+                <result column="grouping" property="grouping"/>
+                <result column="premium" property="premium"/>
+                <result column="quantity" property="quantity"/>
+            </collection>
+        </collection>
+    </resultMap>
+
     <select id="getSchemePage" resultType="com.jzg.commons.entity.scheme.vo.PtlSchemeVo">
     <select id="getSchemePage" resultType="com.jzg.commons.entity.scheme.vo.PtlSchemeVo">
         SELECT
         SELECT
             psi.id,
             psi.id,
@@ -38,10 +83,21 @@
 
 
     <select id="getCompanyList" resultType="com.jzg.commons.entity.po.EsmInsCompany">
     <select id="getCompanyList" resultType="com.jzg.commons.entity.po.EsmInsCompany">
         SELECT
         SELECT
-            eic.*,
-            count(psi.id) as count
+            eic.id,
+            eic.code,
+            eic.company_code,
+            eic.name,
+            eic.parent_id,
+            eic.name_simple,
+            eic.remark,
+            eic.order_num,
+            eic.cn_name,
+            eic.type,
+            count(psi.id) as count,
+            suf.file_name as logo
         FROM
         FROM
             esm_ins_company eic
             esm_ins_company eic
+                left join sys_upload_files suf on eic.logo = suf.id
                 left join ptl_scheme ps on eic.id = ps.company_id
                 left join ptl_scheme ps on eic.id = ps.company_id
                 left join ptl_scheme_info psi on ps.id = psi.scheme_id
                 left join ptl_scheme_info psi on ps.id = psi.scheme_id
         WHERE
         WHERE
@@ -51,4 +107,60 @@
         group by eic.id
         group by eic.id
         order by count desc
         order by count desc
     </select>
     </select>
+
+    <select id="getSchemeInsuranceInfo" resultMap="SchemeVo">
+        SELECT
+            ps.id,
+            ps.company_id,
+            ps.product_id,
+            ps.product_name,
+            psi.id AS scheme_info_id,
+            psi.scheme_type,
+            psi.scheme_name,
+            psi.description,
+            ibi.id AS kind_id,
+            ibi.kind_code,
+            ibi.kind_name,
+            ibi.alias,
+            ibi.grouping,
+            ibio.id AS option_id,
+            ibio.label,
+            ibio.`value`
+        FROM
+            ptl_scheme ps
+            LEFT JOIN ptl_scheme_info psi ON ps.id = psi.scheme_id
+            left join ptl_scheme_insurance psis on psi.id = psis.scheme_info_id
+            left join ins_business_insurance ibi on psis.insurance_id = ibi.id
+            left join ins_business_insurance_option ibio on psis.option_id = ibio.id
+        WHERE
+            ps.company_id = #{companyId}
+            AND ps.product_id = #{productId}
+    </select>
+
+    <select id="getSchemeDrivingInfo" resultMap="SchemeDrivingVo">
+        SELECT
+            ps.id,
+            psi.id AS scheme_info_id,
+            psi.scheme_id,
+            psi.scheme_type,
+            psi.scheme_name,
+            jc.product_name,
+            jc.alias,
+            jc.product_code,
+            jc.coverage,
+            jc.premium,
+            psidi.quantity
+        FROM
+            ptl_scheme ps
+                INNER JOIN ptl_scheme_info psi ON ps.id = psi.scheme_id
+                INNER JOIN ptl_scheme_insurance_driving_intention psidi ON psidi.scheme_info_id = psi.id
+                INNER JOIN jyx_config jc ON psidi.driving_intention_id = jc.id
+        WHERE
+            ps.company_id = #{companyId}
+        AND
+            ps.product_id = #{productId}
+    </select>
+
+
+
 </mapper>
 </mapper>

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

@@ -118,4 +118,25 @@
                 LEFT JOIN sys_user su ON suji.user_id = su.id
                 LEFT JOIN sys_user su ON suji.user_id = su.id
         where su.mobile = #{mobile}
         where su.mobile = #{mobile}
     </select>
     </select>
+
+    <select id="getTenantList" resultType="com.jzg.commons.entity.user.vo.SysTennatVo">
+        SELECT
+            ss.sys_code as system_code,
+            ss.sys_name,
+            sd.name as dept_name,
+            suf.file_name as sys_icon
+        FROM
+            sys_user su
+                LEFT JOIN sys_user_jzg_info suji ON su.id = suji.user_id
+                LEFT JOIN sys_system ss ON suji.system_code = ss.sys_code
+                LEFT JOIN sys_dept sd ON sd.id = suji.dept_id
+                LEFT JOIN sys_upload_files suf on suf.id = ss.sys_icon
+        WHERE
+            (
+                        mobile = #{userId}
+                    OR username = #{userId})
+        AND suji.system_code != 'APP'
+    </select>
+
+
 </mapper>
 </mapper>