Qchen 1 год назад
Родитель
Сommit
c798f9eda0
24 измененных файлов с 741 добавлено и 8 удалено
  1. 141 0
      commons/src/main/java/com/jzg/commons/entity/agreement/po/PtlAgreementAttribution.java
  2. 40 0
      commons/src/main/java/com/jzg/commons/entity/agreement/po/PtlAgreementUrl.java
  3. 32 0
      commons/src/main/java/com/jzg/commons/entity/agreement/vo/PtlAgreementAttributionQueryVo.java
  4. 61 0
      commons/src/main/java/com/jzg/commons/entity/agreement/vo/PtlAgreementAttributionSaveVo.java
  5. 20 0
      commons/src/main/java/com/jzg/commons/entity/agreement/vo/PtlAgreementUrlVo.java
  6. 4 0
      commons/src/main/java/com/jzg/commons/entity/po/SysActivity.java
  7. 1 1
      gateway/src/main/resources/application-test.yml
  8. 6 0
      platform/pom.xml
  9. 81 0
      platform/src/main/java/com/jzg/controller/AgreementAttributionController.java
  10. 8 1
      platform/src/main/java/com/jzg/controller/AttributionTemplateController.java
  11. 15 0
      platform/src/main/java/com/jzg/mapper/PtlAgreementAttributionMapper.java
  12. 9 0
      platform/src/main/java/com/jzg/mapper/PtlAgreementUrlMapper.java
  13. 31 0
      platform/src/main/java/com/jzg/service/PtlAgreementAttributionService.java
  14. 8 0
      platform/src/main/java/com/jzg/service/PtlAgreementUrlService.java
  15. 6 0
      platform/src/main/java/com/jzg/service/PtlInsAttributionTemplateService.java
  16. 160 0
      platform/src/main/java/com/jzg/service/impl/PtlAgreementAttributionImpl.java
  17. 17 0
      platform/src/main/java/com/jzg/service/impl/PtlAgreementUrlServiceImpl.java
  18. 25 0
      platform/src/main/java/com/jzg/service/impl/PtlInsAttributionTemplateServiceImpl.java
  19. 4 0
      platform/src/main/resources/application.yml
  20. 55 0
      platform/src/main/resources/mapper/PtlAgreementAttributionMapper.xml
  21. 3 0
      tenant/organization/src/main/java/com/jzg/organization/service/SysUserJzgInfoService.java
  22. 1 1
      tenant/organization/src/main/java/com/jzg/organization/service/impl/SysActivityServiceImpl.java
  23. 5 1
      tenant/organization/src/main/java/com/jzg/organization/service/impl/SysUserJzgInfoServiceImpl.java
  24. 8 4
      tenant/organization/src/main/java/com/jzg/organization/service/impl/SysUserServiceImpl.java

+ 141 - 0
commons/src/main/java/com/jzg/commons/entity/agreement/po/PtlAgreementAttribution.java

@@ -0,0 +1,141 @@
+package com.jzg.commons.entity.agreement.po;
+
+
+import com.alibaba.fastjson.JSONArray;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler;
+import com.jzg.commons.entity.agreement.vo.PtlAgreementAttributionSaveVo;
+import com.jzg.commons.util.idgen.IdGenerate;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.NoArgsConstructor;
+
+import java.io.Serializable;
+
+/**
+ * @author quchen
+ * @date 2025/2/18 11:09
+ */
+
+@Data
+@Schema(description = "保险公司归属信息账号")
+@NoArgsConstructor
+@EqualsAndHashCode
+@AllArgsConstructor
+@TableName(value = "ptl_agreement_attribution", autoResultMap = true)
+public class PtlAgreementAttribution implements Serializable {
+    @Schema(description = "id")
+    @TableId(value = "id")
+    private String id;
+
+    @Schema(description = "账号归属")
+    @TableField(value = "user_dept")
+    private String userDept;
+
+    @Schema(description = "保险公司id")
+    @TableField(value = "ins_company_id")
+    private String insCompanyId;
+
+    @Schema(description = "保险公司名称")
+    @TableField(value = "ins_company_name")
+    private String insCompanyName;
+
+    @Schema(description = "模版id")
+    @TableField(value = "template_id")
+    private String templateId;
+
+    @Schema(description = "api类型 1 api 2 python")
+    @TableField(value = "api_type")
+    private String apiType;
+
+    @Schema(description = "字段集")
+    @TableField(value = "fields", typeHandler = FastjsonTypeHandler.class)
+    private JSONArray fields;
+
+    @Schema(description = "保险公司账号")
+    @TableField(value = "username")
+    private String username;
+
+    @Schema(description = "保险公司密码")
+    @TableField(value = "password")
+    private String password;
+
+    @Schema(description = "保险公司账号简称")
+    @TableField(value = "user_abbr")
+    private String userAbbr;
+
+    @Schema(description = "保险公司账号登录地址")
+    @TableField(value = "login_url")
+    private String loginUrl;
+
+    @Schema(description = "保险公司账号描述")
+    @TableField(value = "user_desc")
+    private String userDesc;
+
+    @Schema(description = "可用状态 0 正常 1 不可用 2 未知")
+    @TableField(value = "use_status")
+    private String useStatus;
+
+    @Schema(description = "报价状态 0 启用 1 禁用")
+    @TableField(value = "quote_status")
+    private String quoteStatus;
+
+    @Schema(description = "是否删除 1 是 0 否")
+    @TableField(value = "is_delete")
+    private String isDelete;
+
+    @TableField(exist = false)
+    private String url;
+
+    @TableField(exist = false)
+    private String deptName;
+
+    public PtlAgreementAttribution(PtlAgreementAttributionSaveVo ptlAgreementAttributionSaveVo,PtlInsAttributionTemplate ptlInsAttributionTemplate) {
+        this.id = IdGenerate.nextId();
+        this.userDept = ptlAgreementAttributionSaveVo.getUserDept();
+        this.insCompanyId = ptlInsAttributionTemplate.getInsCompanyId();
+        this.insCompanyName = ptlInsAttributionTemplate.getInsCompanyName();
+        this.templateId = ptlInsAttributionTemplate.getId();
+        this.apiType = ptlAgreementAttributionSaveVo.getApiType();
+        this.fields = JSONArray.parseArray(JSONArray.toJSONString(ptlAgreementAttributionSaveVo.getFields()));
+        this.username = ptlAgreementAttributionSaveVo.getUsername();
+        this.password = ptlAgreementAttributionSaveVo.getPassword();
+        if (ptlAgreementAttributionSaveVo.getUserAbbr() == null || !ptlAgreementAttributionSaveVo.getUserAbbr().equals("")) {
+            this.userAbbr = ptlAgreementAttributionSaveVo.getUserAbbr();
+        } else {
+            this.userAbbr = "账号简称"+ptlAgreementAttributionSaveVo.getUsername();
+        }
+        this.loginUrl = ptlAgreementAttributionSaveVo.getLoginUrl();
+    }
+
+    /**
+     * 过滤模版信息
+     *
+     * @param ptlAgreementAttribution   协议归属
+     * @param ptlInsAttributionTemplate 协议归属模版
+     */
+//    public static void filterTemplates(PtlAgreementAttribution ptlAgreementAttribution, PtlInsAttributionTemplate ptlInsAttributionTemplate) {
+//        if (ObjectUtils.isEmpty(ptlInsAttributionTemplate)) {
+//            return;
+//        }
+//
+//        List<PtlAttributionTemplateDto> ptlAttributionTemplateDtoList = ptlAgreementAttribution.getFields().toJavaList(PtlAttributionTemplateDto.class);
+//        // 信息
+//        Map<String, String> map = ptlAttributionTemplateDtoList.stream()
+//                .filter(dto->dto.getValue() != null)
+//                .collect(Collectors.toMap(PtlAttributionTemplateDto::getField, PtlAttributionTemplateDto::getValue, (v1, v2) -> v1));
+//        // 模版中的数据
+//
+//        List<PtlAttributionTemplateDto> ptlAttributionTemplate = ptlInsAttributionTemplate.getFields().toJavaList(PtlAttributionTemplateDto.class);
+//        ptlAttributionTemplate.forEach(x -> {
+//            String s = map.get(x.getField());
+//            x.setValue(s);
+//        });
+//        ptlAgreementAttribution.setFields(JSON.parseArray(JSON.toJSONString(ptlAttributionTemplate)));
+//    }
+
+}

+ 40 - 0
commons/src/main/java/com/jzg/commons/entity/agreement/po/PtlAgreementUrl.java

@@ -0,0 +1,40 @@
+package com.jzg.commons.entity.agreement.po;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.jzg.commons.entity.agreement.vo.PtlAgreementUrlVo;
+import com.jzg.commons.util.idgen.IdGenerate;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * @author quchen
+ * @date 2025/2/18 16:32
+ */
+
+@Data
+@TableName(value = "ptl_agreement_url")
+@Schema(description = "保险公司归属登录地址")
+@NoArgsConstructor
+public class PtlAgreementUrl {
+
+    @Schema(description = "id")
+    private String id;
+
+    @Schema(description = "账号归属名称")
+    private String name;
+
+    @Schema(description = "登录地址")
+    private String url;
+
+    @Schema(description = "保险公司id")
+    private String companyId;
+
+    public PtlAgreementUrl(PtlAgreementUrlVo ptlAgreementUrlVo) {
+        this.id = IdGenerate.nextId();
+        this.name = ptlAgreementUrlVo.getName();
+        this.url = ptlAgreementUrlVo.getUrl();
+        this.companyId = ptlAgreementUrlVo.getCompanyId();
+    }
+
+}

+ 32 - 0
commons/src/main/java/com/jzg/commons/entity/agreement/vo/PtlAgreementAttributionQueryVo.java

@@ -0,0 +1,32 @@
+package com.jzg.commons.entity.agreement.vo;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.jzg.commons.core.base.PageRequest;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+/**
+ * @author quchen
+ * @date 2025/2/18 18:12
+ */
+
+@Data
+public class PtlAgreementAttributionQueryVo extends PageRequest {
+    @Schema(description = "账号信息")
+    private String username;
+
+    @Schema(description = "保险公司id")
+    private String insCompanyId;
+
+    @Schema(description = "保险公司账号归属")
+    private String userDept;
+
+    @Schema(description = "可用状态 0 正常 1 不可用 2 未知")
+    @TableField(value = "use_status")
+    private String useStatus;
+
+    @Schema(description = "报价状态 0 启用 1 禁用")
+    @TableField(value = "quote_status")
+    private String quoteStatus;
+
+}

+ 61 - 0
commons/src/main/java/com/jzg/commons/entity/agreement/vo/PtlAgreementAttributionSaveVo.java

@@ -0,0 +1,61 @@
+package com.jzg.commons.entity.agreement.vo;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.jzg.commons.entity.agreement.dto.PtlAttributionTemplateDto;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * @author quchen
+ * @date 2025/2/18 14:48
+ */
+
+@Data
+public class PtlAgreementAttributionSaveVo {
+    @Schema(description = "id")
+    private String id;
+
+    @Schema(description = "账号归属")
+    private String userDept;
+
+    @Schema(description = "保险公司id")
+    private String insCompanyId;
+
+    @Schema(description = "保险公司名称")
+    private String insCompanyName;
+
+    @Schema(description = "模版id")
+    private String templateId;
+
+    @Schema(description = "api类型 1 api 2 python")
+    private String apiType;
+
+    @Schema(description = "字段集")
+    private List<PtlAttributionTemplateDto> fields;
+
+    @Schema(description = "保险公司账号")
+    private String username;
+
+    @Schema(description = "保险公司密码")
+    private String password;
+
+    @Schema(description = "保险公司账号简称")
+    private String userAbbr;
+
+    @Schema(description = "保险公司账号登录地址")
+    private String loginUrl;
+
+    @Schema(description = "保险公司账号描述")
+    private String userDesc;
+
+    @Schema(description = "可用状态 0 正常 1 不可用 2 未知")
+    @TableField(value = "use_status")
+    private String useStatus;
+
+    @Schema(description = "报价状态 0 启用 1 禁用")
+    @TableField(value = "quote_status")
+    private String quoteStatus;
+
+}

+ 20 - 0
commons/src/main/java/com/jzg/commons/entity/agreement/vo/PtlAgreementUrlVo.java

@@ -0,0 +1,20 @@
+package com.jzg.commons.entity.agreement.vo;
+
+import lombok.Data;
+
+/**
+ * @author quchen
+ * @date 2025/2/18 16:35
+ */
+
+@Data
+public class PtlAgreementUrlVo {
+
+    private String id;
+
+    private String name;
+
+    private String url;
+
+    private String companyId;
+}

+ 4 - 0
commons/src/main/java/com/jzg/commons/entity/po/SysActivity.java

@@ -72,6 +72,10 @@ public class SysActivity implements Serializable {
     @Schema(description = "奖项列表")
     private List<SysActivityAward> awardList;
 
+    @TableField(exist = false)
+    @Schema(description = "机构列表")
+    private String actDeptName;
+
     @TableField(exist = false)
     @Schema(description = "机构列表ids")
     private List<String> deptIds;

+ 1 - 1
gateway/src/main/resources/application-test.yml

@@ -23,7 +23,7 @@ spring:
         - id: platform_route
           uri: lb://jzg-platform
           predicates:
-            - Path=/userRole/**,/system/**,/file/**,/user/**,/esmInsCompany/**,/jyxConfig/**,/qrBarcode/**,/sysDept/**
+            - Path=/userRole/**,/system/**,/file/**,/user/**,/esmInsCompany/**,/jyxConfig/**,/qrBarcode/**,/sysDept/**,/manager/**,
 
         - id: tenant_route
           uri: lb://jzg-organization

+ 6 - 0
platform/pom.xml

@@ -86,6 +86,12 @@
             <groupId>org.redisson</groupId>
             <artifactId>redisson-spring-data-27</artifactId>
         </dependency>
+        <dependency>
+            <groupId>com.jzg</groupId>
+            <artifactId>organization</artifactId>
+            <version>1.0-SNAPSHOT</version>
+            <scope>compile</scope>
+        </dependency>
     </dependencies>
     <build>
         <plugins>

+ 81 - 0
platform/src/main/java/com/jzg/controller/AgreementAttributionController.java

@@ -0,0 +1,81 @@
+package com.jzg.controller;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.jzg.commons.core.page.HttpResult;
+import com.jzg.commons.entity.agreement.vo.PtlAgreementAttributionQueryVo;
+import com.jzg.commons.entity.agreement.vo.PtlAgreementAttributionSaveVo;
+import com.jzg.commons.request.RequestSingleParam;
+import com.jzg.service.PtlAgreementAttributionService;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.annotation.Resource;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+/**
+ * @author quchen
+ * @date 2025/2/18 10:33
+ */
+
+@RestController
+@RequestMapping("/manager/attribution")
+@Tag(name="保险公司归属账号配置")
+public class AgreementAttributionController {
+
+    @Resource
+    private PtlAgreementAttributionService agreementAttributionService;
+
+    @Operation(summary = "添加保险公司账号接口", description = "添加保险公司账号接口")
+    @PostMapping(value = "/addAgreementAttribution")
+    public HttpResult<Object> addAgreementAttribution(@RequestBody PtlAgreementAttributionSaveVo agreementAttributionSaveVo){
+        return agreementAttributionService.addAgreementAttribution(agreementAttributionSaveVo) ? HttpResult.ok("添加保险公司账号成功") : HttpResult.error("添加保险公司账号失败");
+    }
+
+    @Operation(summary = "保险公司账号详情接口", description = "保险公司账号接口")
+    @PostMapping(value = "/getAgreementAttribution")
+    public HttpResult<Object> getAgreementAttribution(@RequestSingleParam(value = "id") String id) {
+        return agreementAttributionService.getAgreementAttribution(id);
+    }
+
+    @Operation(summary = "查询保险公司账号列表接口", description = "查询保险公司账号列表接口")
+    @PostMapping(value = "/getAgreementAttributionList")
+    public HttpResult getActivityList(@RequestBody PtlAgreementAttributionQueryVo ptlAgreementAttributionQueryVo) {
+        Page page = ptlAgreementAttributionQueryVo.getPage();
+        return HttpResult.ok(agreementAttributionService.getAgreementAttributionList(page,ptlAgreementAttributionQueryVo));
+    }
+
+    @Operation(summary = "修改保险公司账号接口", description = "修改保险公司账号接口")
+    @PostMapping(value = "/updateAgreementAttribution")
+    public HttpResult updateAgreementAttribution(@RequestBody PtlAgreementAttributionSaveVo agreementAttributionSaveVo){
+        return agreementAttributionService.updateAgreementAttribution(agreementAttributionSaveVo) ? HttpResult.ok("修改保险公司账号成功") : HttpResult.error("修改保险公司账号失败");
+    }
+
+    @Operation(summary = "获取账号登录地址接口", description = "获取账号登录地址接口")
+    @PostMapping(value = "/getLoginUrl")
+    public HttpResult getLoginUrl(@RequestSingleParam(value = "companyId") String companyId){
+        return HttpResult.ok(agreementAttributionService.getAgreementUrlList(companyId));
+    }
+
+    @Operation(summary = "批量删除保险公司账号接口", description = "批量删除保险公司账号接口")
+    @PostMapping(value = "/deleteAgreementAttribution")
+    public HttpResult deleteAgreementAttribution(@RequestSingleParam(value = "ids") List<String> ids){
+        return agreementAttributionService.deleteAgreementAttribution(ids) ? HttpResult.ok("删除成功") : HttpResult.error("删除失败");
+    }
+
+    @Operation(summary = "批量启用保险公司账号接口", description = "批量启用保险公司账号接口")
+    @PostMapping(value = "/enableAgreementAttribution")
+    public HttpResult enableAgreementAttribution(@RequestSingleParam(value = "ids") List<String> ids){
+        return agreementAttributionService.enableAgreementAttribution(ids) ? HttpResult.ok("启用成功") : HttpResult.error("启用失败");
+    }
+
+    @Operation(summary = "批量禁用保险公司账号接口", description = "批量禁用保险公司账号接口")
+    @PostMapping(value = "/disableAgreementAttribution")
+    public HttpResult disableAgreementAttribution(@RequestSingleParam(value = "ids") List<String> ids){
+        return agreementAttributionService.disableAgreementAttribution(ids) ? HttpResult.ok("禁用成功") : HttpResult.error("禁用失败");
+    }
+
+}

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

@@ -1,6 +1,7 @@
 package com.jzg.controller;
 
 import com.jzg.commons.core.page.HttpResult;
+import com.jzg.commons.entity.agreement.po.PtlAgreementAttribution;
 import com.jzg.commons.entity.agreement.po.PtlInsAttributionTemplate;
 import com.jzg.commons.entity.agreement.vo.PtlInsAttributionTemplateQueryVo;
 import com.jzg.commons.entity.agreement.vo.PtlInsAttributionTemplateSaveVo;
@@ -17,7 +18,7 @@ import java.util.List;
 
 @RestController
 @RequestMapping("/manager/attributionTemplate")
-@Tag(name="账号归属配置")
+@Tag(name="账号归属配置模版")
 public class AttributionTemplateController {
 
     @Autowired
@@ -41,4 +42,10 @@ public class AttributionTemplateController {
         return ptlInsAttributionTemplateService.submit(ptlInsAttributionTemplateSaveVo) ? HttpResult.ok("提交模版信息成功") : HttpResult.error("提交模版信息失败");
     }
 
+    @PostMapping("/getPtlInsAttributionTemplate")
+    @Operation(summary = "通过保险公司id查询请求模板", description = "修改保险公司账号接口")
+    public HttpResult<PtlInsAttributionTemplate> getPtlInsAttributionTemplate(@RequestBody PtlInsAttributionTemplateVo ptlInsAttributionTemplateVo) {
+        return ptlInsAttributionTemplateService.getPtlInsAttributionTemplate(ptlInsAttributionTemplateVo);
+    }
+
 }

+ 15 - 0
platform/src/main/java/com/jzg/mapper/PtlAgreementAttributionMapper.java

@@ -0,0 +1,15 @@
+package com.jzg.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.jzg.commons.entity.agreement.po.PtlAgreementAttribution;
+import com.jzg.commons.entity.agreement.vo.PtlAgreementAttributionQueryVo;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+@Mapper
+public interface PtlAgreementAttributionMapper extends BaseMapper<PtlAgreementAttribution> {
+    Page<PtlAgreementAttribution> getAgreementAttributionList(Page page, @Param("ptlAgreementAttributionQueryVo") PtlAgreementAttributionQueryVo ptlAgreementAttributionQueryVo);
+
+    PtlAgreementAttribution getAgreementAttribution(@Param("id") String id);
+}

+ 9 - 0
platform/src/main/java/com/jzg/mapper/PtlAgreementUrlMapper.java

@@ -0,0 +1,9 @@
+package com.jzg.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.jzg.commons.entity.agreement.po.PtlAgreementUrl;
+import org.apache.ibatis.annotations.Mapper;
+
+@Mapper
+public interface PtlAgreementUrlMapper extends BaseMapper<PtlAgreementUrl> {
+}

+ 31 - 0
platform/src/main/java/com/jzg/service/PtlAgreementAttributionService.java

@@ -0,0 +1,31 @@
+package com.jzg.service;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.jzg.commons.core.page.HttpResult;
+import com.jzg.commons.entity.agreement.po.PtlAgreementAttribution;
+import com.jzg.commons.entity.agreement.po.PtlAgreementUrl;
+import com.jzg.commons.entity.agreement.vo.PtlAgreementAttributionQueryVo;
+import com.jzg.commons.entity.agreement.vo.PtlAgreementAttributionSaveVo;
+
+import java.util.List;
+
+public interface PtlAgreementAttributionService extends IService<PtlAgreementAttribution> {
+
+    boolean addAgreementAttribution(PtlAgreementAttributionSaveVo ptlAgreementAttributionSaveVo);
+
+    HttpResult<Object> getAgreementAttribution(String id);
+
+    Page<PtlAgreementAttribution> getAgreementAttributionList(Page page, PtlAgreementAttributionQueryVo ptlAgreementAttributionQueryVo);
+
+    boolean updateAgreementAttribution(PtlAgreementAttributionSaveVo ptlAgreementAttributionSaveVo);
+
+    List<PtlAgreementUrl> getAgreementUrlList(String companyId);
+
+    boolean deleteAgreementAttribution(List<String> ids);
+
+    boolean enableAgreementAttribution(List<String> ids);
+
+    boolean disableAgreementAttribution(List<String> ids);
+
+}

+ 8 - 0
platform/src/main/java/com/jzg/service/PtlAgreementUrlService.java

@@ -0,0 +1,8 @@
+package com.jzg.service;
+
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.jzg.commons.entity.agreement.po.PtlAgreementUrl;
+
+public interface PtlAgreementUrlService extends IService<PtlAgreementUrl> {
+}

+ 6 - 0
platform/src/main/java/com/jzg/service/PtlInsAttributionTemplateService.java

@@ -2,6 +2,8 @@ package com.jzg.service;
 
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.jzg.commons.core.page.HttpResult;
+import com.jzg.commons.entity.agreement.po.PtlAgreementAttribution;
 import com.jzg.commons.entity.agreement.po.PtlInsAttributionTemplate;
 import com.jzg.commons.entity.agreement.vo.PtlInsAttributionTemplateQueryVo;
 import com.jzg.commons.entity.agreement.vo.PtlInsAttributionTemplateSaveVo;
@@ -24,10 +26,14 @@ public interface PtlInsAttributionTemplateService extends IService<PtlInsAttribu
      */
     public List<PtlInsAttributionTemplateVo> getList(PtlInsAttributionTemplateQueryVo ptlInsAttributionTemplateVo);
 
+    public PtlInsAttributionTemplate getByCompanyId(String companyId);
+
     /**
      * 保存 保险公司归属信息模版
      * @param ptlInsAttributionTemplateSaveVo
      * @return
      */
     public boolean submit(List<PtlInsAttributionTemplateSaveVo> ptlInsAttributionTemplateSaveVo);
+
+    HttpResult<PtlInsAttributionTemplate> getPtlInsAttributionTemplate(PtlInsAttributionTemplateVo ptlInsAttributionTemplateVo);
 }

+ 160 - 0
platform/src/main/java/com/jzg/service/impl/PtlAgreementAttributionImpl.java

@@ -0,0 +1,160 @@
+package com.jzg.service.impl;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+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.core.page.HttpResult;
+import com.jzg.commons.entity.agreement.po.PtlAgreementAttribution;
+import com.jzg.commons.entity.agreement.po.PtlAgreementUrl;
+import com.jzg.commons.entity.agreement.po.PtlInsAttributionTemplate;
+import com.jzg.commons.entity.agreement.vo.PtlAgreementAttributionQueryVo;
+import com.jzg.commons.entity.agreement.vo.PtlAgreementAttributionSaveVo;
+import com.jzg.commons.entity.po.PtlAgreement;
+import com.jzg.commons.entity.po.SysDept;
+import com.jzg.commons.exception.SystemException;
+import com.jzg.mapper.PtlAgreementAttributionMapper;
+import com.jzg.organization.service.PtlAgreementService;
+import com.jzg.service.PtlAgreementAttributionService;
+import com.jzg.service.PtlAgreementUrlService;
+import com.jzg.service.PtlInsAttributionTemplateService;
+import com.jzg.service.SysDeptService;
+import jakarta.annotation.Resource;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
+import java.util.Objects;
+
+/**
+ * @author quchen
+ * @date 2025/2/18 17:07
+ */
+
+@Service
+public class PtlAgreementAttributionImpl extends ServiceImpl<PtlAgreementAttributionMapper, PtlAgreementAttribution> implements PtlAgreementAttributionService {
+    @Resource
+    private PtlInsAttributionTemplateService ptlInsAttributionTemplateService;
+
+    @Resource
+    private PtlAgreementAttributionService ptlAgreementAttributionService;
+
+    @Resource
+    private PtlAgreementUrlService ptlAgreementUrlService;
+
+    @Resource
+    private PtlAgreementService ptlAgreementService;
+
+    @Autowired
+    private SysDeptService sysDeptService;
+
+    @Override
+    public boolean addAgreementAttribution(PtlAgreementAttributionSaveVo ptlAgreementAttributionSaveVo) {
+        PtlInsAttributionTemplate ptlInsAttributionTemplate = ptlInsAttributionTemplateService.getByCompanyId(ptlAgreementAttributionSaveVo.getInsCompanyId());
+        if (ptlInsAttributionTemplate == null) {
+            throw new RuntimeException("该保险公司模版不存在");
+        }
+        verifyAgreeAttribution(ptlAgreementAttributionSaveVo.getUserDept(),ptlAgreementAttributionSaveVo.getUsername());
+        PtlAgreementAttribution ptlAgreementAttribution = new PtlAgreementAttribution(ptlAgreementAttributionSaveVo,ptlInsAttributionTemplate);
+        save(ptlAgreementAttribution);
+        return true;
+    }
+
+    @Override
+    public HttpResult<Object> getAgreementAttribution(String id) {
+        PtlAgreementAttribution ptlAgreementAttribution = baseMapper.getAgreementAttribution(id);
+        if (Objects.isNull(ptlAgreementAttribution)) {
+            throw new RuntimeException("该保险公司账号不存在");
+        }
+//        PtlInsAttributionTemplate ptlInsAttributionTemplate = ptlInsAttributionTemplateService.lambdaQuery()
+//                .eq(PtlInsAttributionTemplate::getInsCompanyId, ptlAgreementAttribution.getInsCompanyId())
+//                .one();
+//        PtlAgreementAttribution.filterTemplates(ptlAgreementAttribution,ptlInsAttributionTemplate);
+        return HttpResult.ok("",ptlAgreementAttribution);
+    }
+
+
+    @Override
+    public Page<PtlAgreementAttribution> getAgreementAttributionList(Page page, PtlAgreementAttributionQueryVo ptlAgreementAttributionQueryVo) {
+        return baseMapper.getAgreementAttributionList(page,ptlAgreementAttributionQueryVo);
+    }
+
+    @Override
+    public boolean updateAgreementAttribution(PtlAgreementAttributionSaveVo ptlAgreementAttributionSaveVo) {
+        PtlAgreementAttribution ptlAgreementAttribution = ptlAgreementAttributionService.getById(ptlAgreementAttributionSaveVo.getId());
+        if (Objects.isNull(ptlAgreementAttribution)) {
+            throw new RuntimeException("该保险公司账号不存在");
+        }
+        BeanUtils.copyProperties(ptlAgreementAttributionSaveVo,ptlAgreementAttribution);
+        ptlAgreementAttribution.setFields(JSONArray.parseArray(JSON.toJSONString(ptlAgreementAttributionSaveVo.getFields())));
+        updateById(ptlAgreementAttribution);
+        return true;
+    }
+
+    @Override
+    public List<PtlAgreementUrl> getAgreementUrlList(String companyId) {
+        LambdaQueryWrapper<PtlAgreementUrl> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(PtlAgreementUrl::getCompanyId, companyId);
+        return ptlAgreementUrlService.list(wrapper);
+    }
+
+    @Transactional
+    @Override
+    public boolean deleteAgreementAttribution(List<String> ids) {
+        for (String id : ids) {
+            PtlAgreementAttribution ptlAgreementAttribution = ptlAgreementAttributionService.getById(id);
+            if (Objects.isNull(ptlAgreementAttribution)) {
+                throw new RuntimeException("该保险公司账号不存在");
+            }
+            List<PtlAgreement> ptlAgreements = ptlAgreementService.lambdaQuery()
+                    .eq(PtlAgreement::getAttributionId, id)
+                    .list();
+            if (!ptlAgreements.isEmpty()) {
+                throw new SystemException("当前账号有部分报价协议,请更换协议的账号后,再进行删除");
+            }
+            ptlAgreementAttribution.setIsDelete("1");
+            ptlAgreementAttributionService.updateById(ptlAgreementAttribution);
+        }
+        return true;
+    }
+
+    @Override
+    public boolean enableAgreementAttribution(List<String> ids) {
+        return updateQuoteStatus(ids,"0");
+    }
+
+    @Override
+    public boolean disableAgreementAttribution(List<String> ids) {
+        return updateQuoteStatus(ids,"1");
+    }
+
+    private boolean updateQuoteStatus(List<String> ids, String status) {
+        for (String id : ids) {
+            PtlAgreementAttribution ptlAgreementAttribution = ptlAgreementAttributionService.getById(id);
+            if (Objects.isNull(ptlAgreementAttribution)) {
+                throw new RuntimeException("该保险公司账号不存在");
+            }
+            ptlAgreementAttribution.setQuoteStatus(status);
+            ptlAgreementAttributionService.updateById(ptlAgreementAttribution);
+        }
+        return true;
+    }
+
+    private void verifyAgreeAttribution(String userDept,String username) {
+        SysDept sysDept = sysDeptService.getById(userDept);
+        if (Objects.isNull(sysDept)) {
+            throw new SystemException("归属不存在,请重新选择");
+        }
+        PtlAgreementAttribution ptlAgreementAttribution = ptlAgreementAttributionService.lambdaQuery()
+                .eq(PtlAgreementAttribution::getUserDept, userDept)
+                .eq(PtlAgreementAttribution::getUsername, username)
+                .eq(PtlAgreementAttribution::getIsDelete, "0")
+                .one();
+        if (!Objects.isNull(ptlAgreementAttribution)) {
+            throw new SystemException("该归属下账号已存在");
+        }
+    }
+}

+ 17 - 0
platform/src/main/java/com/jzg/service/impl/PtlAgreementUrlServiceImpl.java

@@ -0,0 +1,17 @@
+package com.jzg.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.jzg.commons.entity.agreement.po.PtlAgreementUrl;
+import com.jzg.mapper.PtlAgreementUrlMapper;
+import com.jzg.service.PtlAgreementUrlService;
+import org.springframework.stereotype.Service;
+
+/**
+ * @author quchen
+ * @date 2025/2/19 11:18
+ */
+
+@Service
+public class PtlAgreementUrlServiceImpl extends ServiceImpl<PtlAgreementUrlMapper, PtlAgreementUrl> implements PtlAgreementUrlService {
+
+}

+ 25 - 0
platform/src/main/java/com/jzg/service/impl/PtlInsAttributionTemplateServiceImpl.java

@@ -3,6 +3,7 @@ package com.jzg.service.impl;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.jzg.commons.constants.PtlApiType;
+import com.jzg.commons.core.page.HttpResult;
 import com.jzg.commons.entity.agreement.po.PtlCrawlerApi;
 import com.jzg.commons.entity.agreement.po.PtlInsAttributionTemplate;
 import com.jzg.commons.entity.agreement.vo.PtlInsAttributionTemplateQueryVo;
@@ -11,10 +12,12 @@ import com.jzg.commons.entity.agreement.vo.PtlInsAttributionTemplateVo;
 import com.jzg.commons.entity.po.EsmInsCompany;
 import com.jzg.commons.exception.ValidateException;
 import com.jzg.commons.util.AssertionUtils;
+import com.jzg.mapper.PtlAgreementAttributionMapper;
 import com.jzg.mapper.PtlInsAttributionTemplateMapper;
 import com.jzg.service.PtlCrawlerApiService;
 import com.jzg.service.EsmInsCompanyService;
 import com.jzg.service.PtlInsAttributionTemplateService;
+import jakarta.annotation.Resource;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -30,6 +33,9 @@ public class PtlInsAttributionTemplateServiceImpl extends ServiceImpl<PtlInsAttr
     @Autowired
     PtlCrawlerApiService ptlCrawlerApiService;
 
+    @Resource
+    private PtlAgreementAttributionMapper agreementAttributionMapper;
+
     @Override
     public List<PtlInsAttributionTemplateVo> getList(PtlInsAttributionTemplateQueryVo ptlInsAttributionTemplateVo) {
         LambdaQueryWrapper<PtlInsAttributionTemplate> wrapper = new LambdaQueryWrapper<PtlInsAttributionTemplate>()
@@ -44,6 +50,13 @@ public class PtlInsAttributionTemplateServiceImpl extends ServiceImpl<PtlInsAttr
         return ptlInsAttributionTemplateVos;
     }
 
+    @Override
+    public PtlInsAttributionTemplate getByCompanyId(String companyId) {
+        LambdaQueryWrapper<PtlInsAttributionTemplate> wrapper = new LambdaQueryWrapper<PtlInsAttributionTemplate>()
+                .eq(PtlInsAttributionTemplate::getInsCompanyId,companyId);
+        return baseMapper.selectOne(wrapper);
+    }
+
     @Override
     @Transactional
     public boolean submit(List<PtlInsAttributionTemplateSaveVo> ptlInsAttributionTemplateSaveVo) {
@@ -84,4 +97,16 @@ public class PtlInsAttributionTemplateServiceImpl extends ServiceImpl<PtlInsAttr
             });
         }
     }
+
+    @Override
+    public HttpResult<PtlInsAttributionTemplate> getPtlInsAttributionTemplate(PtlInsAttributionTemplateVo ptlInsAttributionTemplateVo) {
+        String code = "000000";
+        String substring = ptlInsAttributionTemplateVo.getInsCompanyId().substring(0, 5);
+        String companyId = substring + code;
+
+        PtlInsAttributionTemplate ptlInsAttributionTemplate = lambdaQuery().eq(PtlInsAttributionTemplate::getInsCompanyId, companyId)
+                .one();
+        AssertionUtils.isEmpty(ptlInsAttributionTemplate, "保险公司归属信息模板查询失败");
+        return HttpResult.ok(ptlInsAttributionTemplate);
+    }
 }

+ 4 - 0
platform/src/main/resources/application.yml

@@ -4,6 +4,8 @@ spring:
 #  sleuth:
 #    sampler:
 #      probability: 1.0
+  main:
+    allow-circular-references: true
   profiles:
     active: dev
   servlet:
@@ -44,6 +46,8 @@ tenant:
     - esm_ins_company
     - ptl_crawler_api
     - ins_company_clause
+    - ptl_agreement_attribution
+    - ptl_agreement_url
   ignoreLoginNames:
 
   ignoreFunction:

+ 55 - 0
platform/src/main/resources/mapper/PtlAgreementAttributionMapper.xml

@@ -0,0 +1,55 @@
+<?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.mapper.PtlAgreementAttributionMapper">
+    <resultMap id="BaseResultMap" type="com.jzg.commons.entity.agreement.po.PtlAgreementAttribution">
+        <result property="fields" column="fields" javaType="com.alibaba.fastjson.JSONArray"
+                typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
+    </resultMap>
+
+    <select id="getAgreementAttributionList" resultType="com.jzg.commons.entity.agreement.po.PtlAgreementAttribution">
+        select
+        *,
+        pau.url as url,
+        sd.name as deptName
+        from
+        ptl_agreement_attribution paa
+        left join ptl_agreement_url pau on paa.login_url = pau.id
+        left join sys_dept sd on paa.user_dept = sd.id
+        where
+        1=1
+            and paa.is_delete = '0'
+        <if test="ptlAgreementAttributionQueryVo.username != null and ptlAgreementAttributionQueryVo.username != ''">
+            and paa.username like concat('%',#{ptlAgreementAttributionQueryVo.username},'%')
+            or paa.user_abbr like concat('%',#{ptlAgreementAttributionQueryVo.username},'%')
+        </if>
+        <if test="ptlAgreementAttributionQueryVo.quoteStatus != null and ptlAgreementAttributionQueryVo.quoteStatus != ''">
+            and paa.quote_status = #{ptlAgreementAttributionQueryVo.quoteStatus}
+        </if>
+        <if test="ptlAgreementAttributionQueryVo.insCompanyId != null and ptlAgreementAttributionQueryVo.insCompanyId != ''">
+            and paa.ins_company_id = #{ptlAgreementAttributionQueryVo.insCompanyId}
+        </if>
+        <if test="ptlAgreementAttributionQueryVo.useStatus != null and ptlAgreementAttributionQueryVo.useStatus != ''">
+            and paa.use_status = #{ptlAgreementAttributionQueryVo.useStatus}
+        </if>
+        <if test="ptlAgreementAttributionQueryVo.userDept != null and ptlAgreementAttributionQueryVo.userDept != ''">
+            and paa.user_dept = #{ptlAgreementAttributionQueryVo.userDept}
+        </if>
+    </select>
+
+    <select id="getAgreementAttribution" resultMap="BaseResultMap">
+        select
+            *,
+            pau.url as url,
+            sd.name as deptName
+        from
+            ptl_agreement_attribution paa
+                left join ptl_agreement_url pau on paa.login_url = pau.id
+                left join sys_dept sd on paa.user_dept = sd.id
+        where
+            1=1
+          and paa.is_delete = '0'
+        <if test="id != null and id != ''">
+            and paa.id = #{id}
+        </if>
+    </select>
+</mapper>

+ 3 - 0
tenant/organization/src/main/java/com/jzg/organization/service/SysUserJzgInfoService.java

@@ -15,4 +15,7 @@ public interface SysUserJzgInfoService extends IService<SysUserJzgInfo> {
      * @return
      */
     SysUserJzgInfo getUserByUserId(String userId);
+
+    SysUserJzgInfo getUserById(String userId);
+
 }

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

@@ -244,7 +244,7 @@ public class SysActivityServiceImpl extends ServiceImpl<SysActivityMapper, SysAc
                 checkActivityDeptVo.setIsJoin("1");
             }
         }
-        return HttpResult.ok(checkActivityDeptVo.getIsJoin());
+        return HttpResult.ok("",checkActivityDeptVo.getIsJoin());
     }
 
     @Override

+ 5 - 1
tenant/organization/src/main/java/com/jzg/organization/service/impl/SysUserJzgInfoServiceImpl.java

@@ -28,5 +28,9 @@ public class SysUserJzgInfoServiceImpl extends ServiceImpl<SysUserJzgInfoMapper,
                 .eq(SysUserJzgInfo::getUserId, userId));
     }
 
-
+    @Override
+    public SysUserJzgInfo getUserById(String id) {
+        return baseMapper.selectOne(new LambdaQueryWrapper<SysUserJzgInfo>()
+                .eq(SysUserJzgInfo::getId, id));
+    }
 }

+ 8 - 4
tenant/organization/src/main/java/com/jzg/organization/service/impl/SysUserServiceImpl.java

@@ -260,7 +260,9 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
             sysUserJzgInfoService.save(sysUserJzgInfo);
             sysUserJzgInfoId = sysUserJzgInfo.getId();
             sysUserId = sysUser.getId();
-            saveOrganization(sysUserVo.getOrganizationId(), sysUserJzgInfo.getUserId());
+            if (sysUserVo.getOrganizationId() != null && !sysUserVo.getOrganizationId().equals("")) {
+                saveOrganization(sysUserVo.getOrganizationId(), sysUserJzgInfo.getUserId());
+            }
             saveFile(sysUserVo.getSfz1(), sysUserVo.getSfz2(), sysUserVo.getQualification(), sysUserVo.getContract(), sysUserVo.getApplicant(), sysUserVo.getSalaryTable(), sysUserVo.getLeaveTable(),sysUserJzgInfo.getId());
             //系统中已存在业务员
 //            throw new SystemException("用户信息已存在,无法添加");
@@ -275,7 +277,9 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
             sysUserJzgInfoId = sysUserJzgInfo.getId();
             sysUserId = sysUser1.getId();
             sysUserJzgInfoService.save(sysUserJzgInfo);
-            saveOrganization(sysUserVo.getOrganizationId(), sysUserJzgInfo.getUserId());
+            if (sysUserVo.getOrganizationId() != null && !sysUserVo.getOrganizationId().equals("")) {
+                saveOrganization(sysUserVo.getOrganizationId(), sysUserJzgInfo.getUserId());
+            }
             saveFile(sysUserVo.getSfz1(), sysUserVo.getSfz2(), sysUserVo.getQualification(), sysUserVo.getContract(), sysUserVo.getApplicant(), sysUserVo.getSalaryTable(), sysUserVo.getLeaveTable(),sysUserJzgInfo.getId());
         }
 
@@ -440,7 +444,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
 
     @Override
     public HttpResult getUserInfoById(String id) {
-        SysUserJzgInfo sysUserJzgInfo = sysUserJzgInfoService.getUserByUserId(id);
+        SysUserJzgInfo sysUserJzgInfo = sysUserJzgInfoService.getById(id);
         if (sysUserJzgInfo == null) {
             throw new SystemException("该用户不存在");
         }
@@ -500,7 +504,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
         List<String> roleIds = userRole.stream().map(u -> u.getId()).collect(Collectors.toList());
         sysUserJzgInfo.setRoleIds(roleIds);
 
-        SysUserJzgInfo byId = sysUserJzgInfoService.getUserByUserId(id);
+        SysUserJzgInfo byId = sysUserJzgInfoService.getById(id);
 
         List<SysUserJzgInfoFile> sysUserJzgInfoFile = sysUserJzgInfoFileService.list
                 (new LambdaQueryWrapper<SysUserJzgInfoFile>().eq(SysUserJzgInfoFile::getUserJzgInfoId,byId.getId()));