Quellcode durchsuchen

Merge remote-tracking branch 'origin/test' into test

wks vor 1 Jahr
Ursprung
Commit
86eb3d6679
47 geänderte Dateien mit 2297 neuen und 30 gelöschten Zeilen
  1. 3 0
      src/main/java/com/ydtech/modules/admin/constants/SwitchConfig.java
  2. 10 4
      src/main/java/com/ydtech/modules/admin/controller/SysUserController.java
  3. 8 1
      src/main/java/com/ydtech/modules/admin/service/SysSwitchConfigService.java
  4. 1 0
      src/main/java/com/ydtech/modules/admin/service/impl/SysPartnerServiceImpl.java
  5. 10 1
      src/main/java/com/ydtech/modules/admin/service/impl/SysSwitchConfigServiceImpl.java
  6. 11 2
      src/main/java/com/ydtech/modules/fee/service/impl/FeeRuleSchemeServiceNewImpl.java
  7. 10 4
      src/main/java/com/ydtech/modules/order/aop/aspect/QuoteVerificationAspect.java
  8. 193 0
      src/main/java/com/ydtech/modules/protocol/controller/PtlAgreementGroupController.java
  9. 53 0
      src/main/java/com/ydtech/modules/protocol/dao/PtlAgreementGroupLinkAgreementMapper.java
  10. 18 0
      src/main/java/com/ydtech/modules/protocol/dao/PtlAgreementGroupLinkAgreementRecordMapper.java
  11. 37 0
      src/main/java/com/ydtech/modules/protocol/dao/PtlAgreementGroupLinkDeptMapper.java
  12. 18 0
      src/main/java/com/ydtech/modules/protocol/dao/PtlAgreementGroupLinkDeptRecordMapper.java
  13. 24 0
      src/main/java/com/ydtech/modules/protocol/dao/PtlAgreementGroupMapper.java
  14. 38 0
      src/main/java/com/ydtech/modules/protocol/entity/dto/PtlAgreementGroupDto.java
  15. 61 0
      src/main/java/com/ydtech/modules/protocol/entity/dto/PtlAgreementGroupLinkAgreementDto.java
  16. 105 0
      src/main/java/com/ydtech/modules/protocol/entity/po/PtlAgreementGroupLinkAgreement.java
  17. 114 0
      src/main/java/com/ydtech/modules/protocol/entity/po/PtlAgreementGroupLinkAgreementRecord.java
  18. 104 0
      src/main/java/com/ydtech/modules/protocol/entity/po/PtlAgreementGroupLinkDept.java
  19. 113 0
      src/main/java/com/ydtech/modules/protocol/entity/po/PtlAgreementGroupLinkDeptRecord.java
  20. 126 0
      src/main/java/com/ydtech/modules/protocol/entity/po/PtlAgreementGroups.java
  21. 43 0
      src/main/java/com/ydtech/modules/protocol/entity/vo/PtlAgreementGroupAddVo.java
  22. 33 0
      src/main/java/com/ydtech/modules/protocol/entity/vo/PtlAgreementGroupLinkAgreementAddVo.java
  23. 27 0
      src/main/java/com/ydtech/modules/protocol/entity/vo/PtlAgreementGroupLinkAgreementDeleteVo.java
  24. 37 0
      src/main/java/com/ydtech/modules/protocol/entity/vo/PtlAgreementGroupLinkAgreementVo.java
  25. 32 0
      src/main/java/com/ydtech/modules/protocol/entity/vo/PtlAgreementGroupLinkDeptAddVo.java
  26. 37 0
      src/main/java/com/ydtech/modules/protocol/entity/vo/PtlAgreementGroupVo.java
  27. 34 0
      src/main/java/com/ydtech/modules/protocol/entity/vo/PtlAgreementLinkVo.java
  28. 43 0
      src/main/java/com/ydtech/modules/protocol/entity/vo/PtlAgreementListVo.java
  29. 13 0
      src/main/java/com/ydtech/modules/protocol/service/PtlAgreementGroupLinkAgreementRecordService.java
  30. 23 0
      src/main/java/com/ydtech/modules/protocol/service/PtlAgreementGroupLinkAgreementService.java
  31. 13 0
      src/main/java/com/ydtech/modules/protocol/service/PtlAgreementGroupLinkDeptRecordService.java
  32. 30 0
      src/main/java/com/ydtech/modules/protocol/service/PtlAgreementGroupLinkDeptService.java
  33. 98 0
      src/main/java/com/ydtech/modules/protocol/service/PtlAgreementGroupService.java
  34. 28 5
      src/main/java/com/ydtech/modules/protocol/service/impl/PtlAgreementDeptServiceImpl.java
  35. 22 0
      src/main/java/com/ydtech/modules/protocol/service/impl/PtlAgreementGroupLinkAgreementRecordServiceImpl.java
  36. 32 0
      src/main/java/com/ydtech/modules/protocol/service/impl/PtlAgreementGroupLinkAgreementServiceImpl.java
  37. 22 0
      src/main/java/com/ydtech/modules/protocol/service/impl/PtlAgreementGroupLinkDeptRecordServiceImpl.java
  38. 39 0
      src/main/java/com/ydtech/modules/protocol/service/impl/PtlAgreementGroupLinkDeptServiceImpl.java
  39. 312 0
      src/main/java/com/ydtech/modules/protocol/service/impl/PtlAgreementGroupServiceImpl.java
  40. 25 4
      src/main/java/com/ydtech/modules/protocol/service/impl/PtlAgreementServiceImpl.java
  41. 1 0
      src/main/java/com/ydtech/modules/protocol/service/impl/PtlTaxSourceServiceImpl.java
  42. 11 9
      src/main/java/com/ydtech/modules/protocol/service/impl/TaxSourceServiceImpl.java
  43. 108 0
      src/main/resources/mapper/modules/protocol/PtlAgreementGroupLinkAgreementMapper.xml
  44. 20 0
      src/main/resources/mapper/modules/protocol/PtlAgreementGroupLinkAgreementRecordMapper.xml
  45. 97 0
      src/main/resources/mapper/modules/protocol/PtlAgreementGroupLinkDeptMapper.xml
  46. 20 0
      src/main/resources/mapper/modules/protocol/PtlAgreementGroupLinkDeptRecordMapper.xml
  47. 40 0
      src/main/resources/mapper/modules/protocol/PtlAgreementGroupMapper.xml

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

@@ -22,6 +22,9 @@ public enum SwitchConfig {
     // add by  hxl  2024-09-26   电销组员提现限制
     DX_01("dxtxFlag", "电销提现(组员提现)"),
 
+    // add by  hxl  2024-09-26   协议机构授权配置开关
+    XYSQ_01("agreementFlag", "协议机构授权配置开关"),
+
     // 是否显示费用
     FDA_01("feeDisplayAgent", "费用显示(代理人启动)"),
     FDA_02("feeDisplayChannel", "费用显示(渠道启动)"),

+ 10 - 4
src/main/java/com/ydtech/modules/admin/controller/SysUserController.java

@@ -54,6 +54,7 @@ import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.models.auth.In;
 import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.redis.core.StringRedisTemplate;
 import org.springframework.transaction.annotation.Transactional;
@@ -79,6 +80,7 @@ import static com.ydtech.constants.RedisConstant.PHONE_VERIFICATION_CODE_KEY;
 @Api(tags = "用户控制器")
 @RequestMapping("user")
 @RequiredArgsConstructor
+@Slf4j
 public class SysUserController extends BaseController {
 
     private final SysUserService sysUserService;
@@ -879,9 +881,10 @@ public class SysUserController extends BaseController {
         return sysUserService.saveUserInfo(sysUserVo);
     }
 
-    @ApiOperation(value = "保存用户基本详情信息")
+    @ApiOperation(value = "保存合伙人、管理员用户基本详情信息")
     @PostMapping(value = "/saveUserInfoByPartner")
     public HttpResult saveUserInfoByPartner(@RequestBody SysUser2Vo sysUserVo) {
+        log.info("添加合伙人入参:{}",sysUserVo);
         //by gws 21	团队长 20	代理人 必须归属团队
         // 22	后线人员 必须归属部门
         SysUser sysUser = sysUserVo.getSysUser();
@@ -935,9 +938,10 @@ public class SysUserController extends BaseController {
         return sysUserService.saveUserInfoByPartner(sysUserVo);
     }
 
-    @ApiOperation(value = "保存用户基本详情信息")
+    @ApiOperation(value = "保存团队长用户基本详情信息")
     @PostMapping(value = "/saveTeamLeader")
     public HttpResult saveTeamLeader(@RequestBody SysUser2Vo sysUserVo) {
+        log.info("添加团队入参:{}",sysUserVo);
         SysUser sysUser = sysUserVo.getSysUser();
         sysUser.setType(3);
         SysUserInfo sysUserInfo = new SysUserInfo();
@@ -945,8 +949,10 @@ public class SysUserController extends BaseController {
         sysUserInfo.setBirthday(birthday);
         sysUserVo.setSysUserInfo(sysUserInfo);
         // 先创建工作室下的团队
-        List<SysDept> sysDeptList = sysDeptService.list(new LambdaQueryWrapper<SysDept>().eq(SysDept::getLeaderId, sysUser.getReferrerId()));
-        SysDept sysDept = sysDeptList.get(0);
+        SysAgencyLeader sysAgencyLeader = sysAgencyLeaderService.getOne(new LambdaQueryWrapper<SysAgencyLeader>()
+                .eq(SysAgencyLeader::getUserId, sysUser.getReferrerId()));
+        SysDept sysDept = sysDeptService.getOne(new LambdaQueryWrapper<SysDept>().eq(SysDept::getId, sysAgencyLeader.getDeptId()));
+//        SysDept sysDept = sysDeptList.get(0);
         SysDeptVo sysDeptVo = new SysDeptVo();
         sysDeptVo.setName(sysUser.getName() + "团队"); // 以人名设置工作室名称
         sysDeptVo.setDeptType("D"); // 默认为子公司

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

@@ -6,7 +6,6 @@ import com.ydtech.modules.admin.model.po.SysSwitchConfig;
 import com.ydtech.modules.admin.model.vo.SysSwitchConfigQueryVo;
 import com.ydtech.modules.admin.model.vo.SysSwitchConfigVo;
 import com.ydtech.modules.order.entity.BasePageResult;
-import com.ydtech.modules.order.entity.vo.OrderVo;
 
 import java.math.BigDecimal;
 
@@ -89,4 +88,12 @@ public interface SysSwitchConfigService extends BaseIService<SysSwitchConfig> {
      * @Description: 电销组员开关
      */
     boolean dxtxDisplaySwitches();
+
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/10/25 11:43
+     *  @Description:  协议授权开关
+     */
+    boolean xysqDisplaySwitches();
 }

+ 1 - 0
src/main/java/com/ydtech/modules/admin/service/impl/SysPartnerServiceImpl.java

@@ -1649,6 +1649,7 @@ public class SysPartnerServiceImpl extends ServiceImpl<SysPartnerMapper, SysPart
             for (SysPartnerVo partner : sysPartnerVoList) {
                 SysUser sysUser1 = sysUserMapper.selectById(partner.getUserId());
                 partner.setMobile(sysUser1.getMobile());
+                partner.setUserName(sysUser1.getName());
                 SysDept sysDept = sysDeptMapper.selectById(sysUser1.getDeptId());
                 partner.setDeptName(sysDept.getName());
                 SysDept sysDept1 = sysDeptMapper.selectById(sysDept.getParentId());

+ 10 - 1
src/main/java/com/ydtech/modules/admin/service/impl/SysSwitchConfigServiceImpl.java

@@ -18,7 +18,6 @@ import com.ydtech.modules.fee.constants.CostAllocation;
 import com.ydtech.modules.fee.dto.po.InsFeeOrderConfig;
 import com.ydtech.modules.fee.service.InsFeeOrderConfigService;
 import com.ydtech.modules.order.entity.BasePageResult;
-import com.ydtech.modules.order.entity.vo.OrderVo;
 import com.ydtech.modules.protocol.utils.AssertionUtils;
 import lombok.RequiredArgsConstructor;
 import org.apache.commons.lang3.ObjectUtils;
@@ -168,6 +167,16 @@ public class SysSwitchConfigServiceImpl extends ServiceImpl<SysSwitchConfigMappe
     public boolean dxtxDisplaySwitches() {
       return isEnabled(SwitchConfig.DX_01.getCode());
     }
+
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/10/25 11:40
+     *  @Description: 机构授权开关
+     */
+    public boolean xysqDisplaySwitches() {
+        return isEnabled(SwitchConfig.XYSQ_01.getCode());
+    }
 }
 
 

+ 11 - 2
src/main/java/com/ydtech/modules/fee/service/impl/FeeRuleSchemeServiceNewImpl.java

@@ -2873,7 +2873,12 @@ public class FeeRuleSchemeServiceNewImpl implements FeeRuleSchemeNewService {
                     .findFirst()
                     .get();
 
-            useFlag = attrEqual(ptlAgreementProductCostsAttrLink, ptlAgreementUndwrtRulesAttr, ruleAttrMappingVo.getValue());
+            if(!Objects.isNull(ruleAttrMappingVo.getValue())) {
+                useFlag = attrEqual(ptlAgreementProductCostsAttrLink, ptlAgreementUndwrtRulesAttr, ruleAttrMappingVo.getValue());
+            }else{
+                useFlag = false;
+            }
+
             if (!useFlag) {
                 log.debug("检验的值:" + ptlAgreementProductCostsAttrLink.getMin());
                 log.debug("传入的值:" + ruleAttrMappingVo.getValue());
@@ -2952,7 +2957,11 @@ public class FeeRuleSchemeServiceNewImpl implements FeeRuleSchemeNewService {
                     ruleAttrMappingVo.setValue(ptlAgreementUndwrtRulesDictLabal.getCode());
                 }
             }
-            useFlag = attrEqual(ptlAgreementUndwrtRulesAttrLinks.get(i), ptlAgreementUndwrtRulesAttr, ruleAttrMappingVo.getValue());
+            if(!Objects.isNull(ruleAttrMappingVo.getValue())) {
+                useFlag = attrEqual(ptlAgreementUndwrtRulesAttrLinks.get(i), ptlAgreementUndwrtRulesAttr, ruleAttrMappingVo.getValue());
+            }else{
+                useFlag = false;
+            }
             if (useFlag) {
                 return true;
             } else {

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

@@ -8,6 +8,7 @@ import com.ydtech.constants.sys.SystemConstant;
 import com.ydtech.core.page.HttpResult;
 import com.ydtech.modules.admin.model.SysUser;
 import com.ydtech.modules.admin.model.SysUserRole;
+import com.ydtech.modules.admin.service.SysSwitchConfigService;
 import com.ydtech.modules.admin.service.SysUserRoleService;
 import com.ydtech.modules.admin.service.SysUserService;
 import com.ydtech.modules.base.controller.BaseController;
@@ -100,6 +101,8 @@ public class QuoteVerificationAspect {
 
     private final FeeDisplayService feeDisplayService;
 
+    private  final SysSwitchConfigService sysSwitchConfigService;
+
     @AfterReturning(pointcut = "@annotation(com.ydtech.modules.order.aop.QuoteVerification)", returning = "result")
     public void doAfter(HttpResult<QuoteRespVo> result) {
         //计算费用因子
@@ -246,11 +249,14 @@ public class QuoteVerificationAspect {
                 //else{
                 //    throw new SystemException("走正常协议逻辑!");
                 // }
-                SysUserRole userRole = sysUserRoleService.selectByUserId(userId);
-                if (Arrays.asList(SystemConstant.getSysRoleTeamLeader()).contains(userRole.getRoleId().toString())) { //团队长可查询下面所有人员订单
-                    return;
+                boolean flag = sysSwitchConfigService.xysqDisplaySwitches();
+                if(!flag){
+                    SysUserRole userRole = sysUserRoleService.selectByUserId(userId);
+                    if (Arrays.asList(SystemConstant.getSysRoleTeamLeader()).contains(userRole.getRoleId().toString())) { //团队长可查询下面所有人员订单
+                        return;
+                    }
                 }
-
+                agreementId = ((BaseQuoteVo<?>) arg).getAgreementId();
                 ptlAgreementDeptService.agreementIsAuthorized(deptId, agreementId);
 
             }

+ 193 - 0
src/main/java/com/ydtech/modules/protocol/controller/PtlAgreementGroupController.java

@@ -0,0 +1,193 @@
+package com.ydtech.modules.protocol.controller;
+
+
+import com.ydtech.core.page.HttpResult;
+import com.ydtech.modules.base.controller.BaseController;
+import com.ydtech.modules.order.entity.BasePageResult;
+import com.ydtech.modules.protocol.entity.dto.PtlAgreementGroupDto;
+import com.ydtech.modules.protocol.entity.dto.PtlAgreementGroupLinkAgreementDto;
+import com.ydtech.modules.protocol.entity.po.PtlAgreementGroups;
+import com.ydtech.modules.protocol.entity.vo.*;
+import com.ydtech.modules.protocol.service.PtlAgreementGroupService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.validation.Valid;
+import java.util.List;
+
+/**
+ *  @version
+ *  @author: hxl
+ *  @Date: 2024/10/24 10:33
+ *  @Description:  协议组管理
+ */
+@Api(tags = "协议组管理")
+@RequestMapping("/ptlAgreementGroup")
+@RestController
+public class PtlAgreementGroupController extends BaseController {
+
+
+    @Autowired
+    private PtlAgreementGroupService ptlAgreementGroupService;
+
+    @PostMapping("queryPage")
+    @ApiOperation(value = "协议组管理分页")
+    public HttpResult<BasePageResult<PtlAgreementGroupDto>> queryPage(@RequestBody PtlAgreementGroupVo ptlAgreementGroupVo) {
+
+        try{
+            BasePageResult<PtlAgreementGroupDto> result = ptlAgreementGroupService.queryPage(ptlAgreementGroupVo);
+            return HttpResult.ok("查询数据成功", result);
+        }catch (Exception e){
+            return HttpResult.error("查询错误"+e.getMessage());
+        }
+    }
+
+    @PostMapping("addOrUpdate")
+    @ApiOperation("协议组管理添加修改")
+    public HttpResult<Object> addOrUpdate(@RequestBody  @Valid PtlAgreementGroupAddVo ptlAgreementGroupAddVo) {
+        try{
+            ptlAgreementGroupService.addOrUpdate(ptlAgreementGroupAddVo);
+            return HttpResult.ok("操作成功");
+        }catch (Exception e){
+            return HttpResult.error("操作失败"+e.getMessage());
+        }
+
+    }
+
+    @GetMapping("delete")
+    @ApiOperation("协议组管理删除")
+    public HttpResult<Object> delete(Long id) {
+        if(id==null){
+            return HttpResult.error("协议组id不能为空");
+        }
+        try{
+            ptlAgreementGroupService.updateByIdDelete(id);
+            return HttpResult.ok("删除成功");
+        }catch (Exception e){
+            return HttpResult.error("删除失败"+e.getMessage());
+        }
+    }
+    @GetMapping("/findById")
+    @ApiOperation(value = "协议组管理回显(编辑使用)")
+    public HttpResult<Object> findAreaListByUserId(Long id) {
+        if(id==null){
+            return HttpResult.error("协议组id不能为空");
+        }
+        try{
+            PtlAgreementGroups group = ptlAgreementGroupService.getById(id);
+            return HttpResult.ok(group);
+        }catch (Exception e){
+            return HttpResult.error("查询失败"+e.getMessage());
+        }
+    }
+
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/10/24 14:04
+     *  @Description:  协议列表
+     */
+    @PostMapping("/findAgreementList")
+    @ApiOperation(value = "协议列表")
+    public HttpResult<BasePageResult<PtlAgreementGroupLinkAgreementDto>> saveAgreementList(@RequestBody PtlAgreementListVo ptlAgreementListVo) {
+
+        try{
+            BasePageResult<PtlAgreementGroupLinkAgreementDto> basePageResult = ptlAgreementGroupService.findAgreementList(ptlAgreementListVo);
+            return HttpResult.ok(basePageResult);
+        }catch (Exception e){
+            return HttpResult.error("查询失败"+e.getMessage());
+        }
+    }
+
+
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/10/24 14:04
+     *  @Description:  配置协议
+     */
+    @PostMapping("/saveAgreementList")
+    @ApiOperation(value = "配置协议")
+    public HttpResult<Object> saveAgreementList(@RequestBody  @Valid PtlAgreementGroupLinkAgreementAddVo ptlAgreementGroupLinkAgreementAddVo) {
+
+        try{
+            ptlAgreementGroupService.saveAgreementList(ptlAgreementGroupLinkAgreementAddVo);
+            return HttpResult.ok("配置成功");
+        }catch (Exception e){
+            return HttpResult.error("配置失败"+e.getMessage());
+        }
+    }
+
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/10/24 14:04
+     *  @Description:  配置协议查看
+     */
+    @PostMapping("/findLinkAgreementList")
+    @ApiOperation(value = "查看配置协议集合")
+    public HttpResult<BasePageResult<PtlAgreementGroupLinkAgreementDto>> findLinkAgreementList(@RequestBody  @Valid PtlAgreementGroupLinkAgreementVo ptlAgreementGroupLinkAgreementVo) {
+        try{
+            BasePageResult<PtlAgreementGroupLinkAgreementDto> basePageResult = ptlAgreementGroupService.findLinkAgreementList(ptlAgreementGroupLinkAgreementVo);
+            return HttpResult.ok(basePageResult);
+        }catch (Exception e){
+            return HttpResult.error("查询失败"+e.getMessage());
+        }
+    }
+
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/10/24 14:04
+     *  @Description:  刪除配置的协议
+     */
+    @PostMapping("/deleteLinkAgreementList")
+    @ApiOperation(value = "刪除配置的协议")
+    public HttpResult<Object> deleteLinkAgreementList(@RequestBody  @Valid PtlAgreementGroupLinkAgreementDeleteVo ptlAgreementGroupLinkAgreementDeleteVo) {
+        try{
+            ptlAgreementGroupService.deleteLinkAgreementList(ptlAgreementGroupLinkAgreementDeleteVo);
+            return HttpResult.ok("删除成功");
+        }catch (Exception e){
+            return HttpResult.error("删除失败"+e.getMessage());
+        }
+    }
+
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/10/24 14:04
+     *  @Description:  授权部门
+     */
+    @PostMapping("/authorizeDeptList")
+    @ApiOperation(value = "授权部门")
+    public HttpResult<Object> authorizeDeptList(@RequestBody  @Valid PtlAgreementGroupLinkDeptAddVo ptlAgreementGroupLinkDeptAddVo) {
+        try{
+            ptlAgreementGroupService.authorizeDeptList(ptlAgreementGroupLinkDeptAddVo);
+            return HttpResult.ok("授权成功");
+        }catch (Exception e){
+            return HttpResult.error("授权失败"+e.getMessage());
+        }
+    }
+
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/10/24 14:04
+     *  @Description:  查询授权部门ids
+     */
+    @GetMapping("/findDeptIdsByPtlAgreementGroupId")
+    @ApiOperation(value = "通过协议组查询授权部门ids")
+    public HttpResult<List<String>> findDeptIdsByPtlAgreementGroupId(Long ptlAgreementGroupId) {
+        try{
+            if(ptlAgreementGroupId==null){
+                return HttpResult.error("协议组id不能为空");
+            }
+            List<String> deptIds=ptlAgreementGroupService.findDeptIdsByPtlAgreementGroupId(ptlAgreementGroupId);
+            return HttpResult.ok(deptIds);
+        }catch (Exception e){
+            return HttpResult.error("查询失败失败"+e.getMessage());
+        }
+    }
+}

+ 53 - 0
src/main/java/com/ydtech/modules/protocol/dao/PtlAgreementGroupLinkAgreementMapper.java

@@ -0,0 +1,53 @@
+package com.ydtech.modules.protocol.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ydtech.modules.protocol.entity.dto.PtlAgreementGroupLinkAgreementDto;
+import com.ydtech.modules.protocol.entity.po.PtlAgreementGroupLinkAgreement;
+import com.ydtech.modules.protocol.entity.vo.PtlAgreementGroupLinkAgreementVo;
+import com.ydtech.modules.protocol.entity.vo.PtlAgreementListVo;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+* @author Administrator
+* @description 针对表【ptl_agreement_group_link_agreement(协议组关联协议)】的数据库操作Mapper
+* @createDate 2024-10-24 09:54:37
+* @Entity generator.domain.PtlAgreementGroupLinkAgreement
+*/
+public interface PtlAgreementGroupLinkAgreementMapper extends BaseMapper<PtlAgreementGroupLinkAgreement> {
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/10/24 15:21
+     *  @Description:  查询可以使用的协议列表
+     */
+    Page<PtlAgreementGroupLinkAgreementDto> queryPage(@Param("page") Page<PtlAgreementGroupLinkAgreementDto> page, @Param("vo") PtlAgreementListVo ptlAgreementListVo);
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/10/24 15:54
+     *  @Description: 查询协议组关联的协议id
+     */
+    List<Long> findByGroupId(@Param("agreementGroupId") Long agreementGroupId);
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/10/24 18:58
+     *  @Description:  查看配置的协议
+     */
+    Page<PtlAgreementGroupLinkAgreementDto> findLinkAgreementList(@Param("page") Page<PtlAgreementGroupLinkAgreementDto> page, @Param("vo") PtlAgreementGroupLinkAgreementVo ptlAgreementGroupLinkAgreementVo);
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/10/24 19:15
+     *  @Description: 通過ids查詢數據
+     */
+    List<PtlAgreementGroupLinkAgreement> findByIds(@Param("ids") ArrayList<Long> ids);
+}
+
+
+
+

+ 18 - 0
src/main/java/com/ydtech/modules/protocol/dao/PtlAgreementGroupLinkAgreementRecordMapper.java

@@ -0,0 +1,18 @@
+package com.ydtech.modules.protocol.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ydtech.modules.protocol.entity.po.PtlAgreementGroupLinkAgreementRecord;
+
+/**
+* @author Administrator
+* @description 针对表【ptl_agreement_group_link_agreement_record(协议组关联协议)】的数据库操作Mapper
+* @createDate 2024-10-24 09:54:37
+* @Entity generator.domain.PtlAgreementGroupLinkAgreementRecord
+*/
+public interface PtlAgreementGroupLinkAgreementRecordMapper extends BaseMapper<PtlAgreementGroupLinkAgreementRecord> {
+
+}
+
+
+
+

+ 37 - 0
src/main/java/com/ydtech/modules/protocol/dao/PtlAgreementGroupLinkDeptMapper.java

@@ -0,0 +1,37 @@
+package com.ydtech.modules.protocol.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ydtech.modules.protocol.entity.dto.PtlAgreementInsCompanyDto;
+import com.ydtech.modules.protocol.entity.po.PtlAgreementGroupLinkDept;
+import org.apache.ibatis.annotations.Param;
+
+import java.time.LocalDate;
+import java.util.List;
+
+/**
+* @author Administrator
+* @description 针对表【ptl_agreement_group_link_dept(协议组关联部门)】的数据库操作Mapper
+* @createDate 2024-10-24 09:54:37
+* @Entity generator.domain.PtlAgreementGroupLinkDept
+*/
+public interface PtlAgreementGroupLinkDeptMapper extends BaseMapper<PtlAgreementGroupLinkDept> {
+
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/10/25 11:35
+     *  @Description:  查询授权的协议
+     */
+    List<PtlAgreementInsCompanyDto> getAgreementCompany(@Param("localDate") LocalDate localDate, @Param("deptId") String deptId);
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/10/25 18:04
+     *  @Description: 通過部門id和协议id判断是否授权
+     */
+    List<String> getAgreementByDeptId(@Param("agreementId") String agreementId, @Param("deptId") String deptId);
+}
+
+
+
+

+ 18 - 0
src/main/java/com/ydtech/modules/protocol/dao/PtlAgreementGroupLinkDeptRecordMapper.java

@@ -0,0 +1,18 @@
+package com.ydtech.modules.protocol.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ydtech.modules.protocol.entity.po.PtlAgreementGroupLinkDeptRecord;
+
+/**
+* @author Administrator
+* @description 针对表【ptl_agreement_group_link_dept_record(协议组关联部门)】的数据库操作Mapper
+* @createDate 2024-10-24 09:54:37
+* @Entity generator.domain.PtlAgreementGroupLinkDeptRecord
+*/
+public interface PtlAgreementGroupLinkDeptRecordMapper extends BaseMapper<PtlAgreementGroupLinkDeptRecord> {
+
+}
+
+
+
+

+ 24 - 0
src/main/java/com/ydtech/modules/protocol/dao/PtlAgreementGroupMapper.java

@@ -0,0 +1,24 @@
+package com.ydtech.modules.protocol.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ydtech.modules.protocol.entity.dto.PtlAgreementGroupDto;
+import com.ydtech.modules.protocol.entity.po.PtlAgreementGroups;
+import com.ydtech.modules.protocol.entity.vo.PtlAgreementGroupVo;
+import org.apache.ibatis.annotations.Param;
+
+/**
+ * @author Administrator
+ * @description 针对表【ptl_agreement_group(协议组)】的数据库操作Mapper
+ * @createDate 2024-10-24 09:54:37
+ * @Entity generator.domain.PtlAgreementGroup
+ */
+public interface PtlAgreementGroupMapper extends BaseMapper<PtlAgreementGroups> {
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/10/24 10:59
+     *  @Description:  分页
+     */
+    Page<PtlAgreementGroupDto> queryPage(@Param("page") Page<PtlAgreementGroupDto> page, @Param("vo") PtlAgreementGroupVo ptlAgreementGroupVo);
+}

+ 38 - 0
src/main/java/com/ydtech/modules/protocol/entity/dto/PtlAgreementGroupDto.java

@@ -0,0 +1,38 @@
+package com.ydtech.modules.protocol.entity.dto;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * 协议组
+ * @TableName ptl_agreement_group
+ */
+@Data
+@ApiModel("协议组分页返回信息")
+public class PtlAgreementGroupDto implements Serializable {
+
+    @ApiModelProperty("协议组id")
+    private Long id;
+
+    /**
+     * 协议组名称
+     */
+    @ApiModelProperty("协议组名称")
+    private String agreementGroupName;
+
+    /**
+     * 协议组描述
+     */
+    @ApiModelProperty("协议组描述")
+    private String description;
+
+    /**
+     * 是否默认1.是 0.否
+     */
+    @ApiModelProperty("是否默认1.是 0.否")
+    private Integer defaultFlag;
+
+}

+ 61 - 0
src/main/java/com/ydtech/modules/protocol/entity/dto/PtlAgreementGroupLinkAgreementDto.java

@@ -0,0 +1,61 @@
+package com.ydtech.modules.protocol.entity.dto;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * 协议组
+ * @TableName ptl_agreement_group
+ */
+@Data
+@ApiModel("配置协议集合信息")
+public class PtlAgreementGroupLinkAgreementDto implements Serializable {
+
+
+    @ApiModelProperty("关联id")
+    private Long id;
+
+    @ApiModelProperty("协议组id")
+    private Long ptlAgreementGroupId;
+    /**
+     * 协议组名称
+     */
+    @ApiModelProperty("协议组名称")
+    private String agreementGroupName;
+    /**
+     * 协议组描述
+     */
+    @ApiModelProperty("保险公司名称")
+    private String companyName;
+
+    /**
+     * 协议组描述
+     */
+    @ApiModelProperty("保险公司Id")
+    private String companyId;
+    /**
+     * 协议组描述
+     */
+    @ApiModelProperty("协议id")
+    private Long agreementId;
+    /**
+     * 协议名称
+     */
+    @ApiModelProperty("协议名称")
+    private String agreementName;
+
+    /**
+     * 是否禁用
+     */
+    @ApiModelProperty("是否禁用")
+    private String disableFlag;
+
+    /**
+     * 是否失效
+     */
+    @ApiModelProperty("是否失效")
+    private String effectiveFlag;
+}

+ 105 - 0
src/main/java/com/ydtech/modules/protocol/entity/po/PtlAgreementGroupLinkAgreement.java

@@ -0,0 +1,105 @@
+package com.ydtech.modules.protocol.entity.po;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * 协议组关联协议
+ * @TableName ptl_agreement_group_link_agreement
+ */
+@TableName(value ="ptl_agreement_group_link_agreement")
+@Data
+public class PtlAgreementGroupLinkAgreement implements Serializable {
+    /**
+     * 主键
+     */
+    @TableId(type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 协议id
+     */
+    private Long ptlAgreementId;
+
+    /**
+     * 协议组id
+     */
+    private Long ptlAgreementGroupId;
+
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+
+    /**
+     * 创建人
+     */
+    private String createUser;
+
+    @TableField(exist = false)
+    private static final long serialVersionUID = 1L;
+
+    @Override
+    public boolean equals(Object that) {
+        if (this == that) {
+            return true;
+        }
+        if (that == null) {
+            return false;
+        }
+        if (getClass() != that.getClass()) {
+            return false;
+        }
+        PtlAgreementGroupLinkAgreement other = (PtlAgreementGroupLinkAgreement) that;
+        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
+            && (this.getPtlAgreementId() == null ? other.getPtlAgreementId() == null : this.getPtlAgreementId().equals(other.getPtlAgreementId()))
+            && (this.getPtlAgreementGroupId() == null ? other.getPtlAgreementGroupId() == null : this.getPtlAgreementGroupId().equals(other.getPtlAgreementGroupId()))
+            && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
+            && (this.getCreateUser() == null ? other.getCreateUser() == null : this.getCreateUser().equals(other.getCreateUser()));
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
+        result = prime * result + ((getPtlAgreementId() == null) ? 0 : getPtlAgreementId().hashCode());
+        result = prime * result + ((getPtlAgreementGroupId() == null) ? 0 : getPtlAgreementGroupId().hashCode());
+        result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
+        result = prime * result + ((getCreateUser() == null) ? 0 : getCreateUser().hashCode());
+        return result;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder();
+        sb.append(getClass().getSimpleName());
+        sb.append(" [");
+        sb.append("Hash = ").append(hashCode());
+        sb.append(", id=").append(id);
+        sb.append(", ptlAgreementId=").append(ptlAgreementId);
+        sb.append(", ptlAgreementGroupId=").append(ptlAgreementGroupId);
+        sb.append(", createTime=").append(createTime);
+        sb.append(", createUser=").append(createUser);
+        sb.append(", serialVersionUID=").append(serialVersionUID);
+        sb.append("]");
+        return sb.toString();
+    }
+
+    public PtlAgreementGroupLinkAgreement() {
+    }
+
+    public PtlAgreementGroupLinkAgreement(Long id, Long ptlAgreementId, Long ptlAgreementGroupId, Date createTime, String createUser) {
+        this.id = id;
+        this.ptlAgreementId = ptlAgreementId;
+        this.ptlAgreementGroupId = ptlAgreementGroupId;
+        this.createTime = createTime;
+        this.createUser = createUser;
+    }
+}

+ 114 - 0
src/main/java/com/ydtech/modules/protocol/entity/po/PtlAgreementGroupLinkAgreementRecord.java

@@ -0,0 +1,114 @@
+package com.ydtech.modules.protocol.entity.po;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * 协议组关联协议
+ * @TableName ptl_agreement_group_link_agreement_record
+ */
+@TableName(value ="ptl_agreement_group_link_agreement_record")
+@Data
+public class PtlAgreementGroupLinkAgreementRecord implements Serializable {
+    /**
+     * 主键
+     */
+    @TableId(type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 协议id
+     */
+    private Long ptlAgreementId;
+
+    /**
+     * 协议组id
+     */
+    private Long ptlAgreementGroupId;
+
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+
+    /**
+     * 创建人
+     */
+    private String createUser;
+
+    /**
+     * 批次uuid
+     */
+    private String batch;
+
+    @TableField(exist = false)
+    private static final long serialVersionUID = 1L;
+
+    @Override
+    public boolean equals(Object that) {
+        if (this == that) {
+            return true;
+        }
+        if (that == null) {
+            return false;
+        }
+        if (getClass() != that.getClass()) {
+            return false;
+        }
+        PtlAgreementGroupLinkAgreementRecord other = (PtlAgreementGroupLinkAgreementRecord) that;
+        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
+            && (this.getPtlAgreementId() == null ? other.getPtlAgreementId() == null : this.getPtlAgreementId().equals(other.getPtlAgreementId()))
+            && (this.getPtlAgreementGroupId() == null ? other.getPtlAgreementGroupId() == null : this.getPtlAgreementGroupId().equals(other.getPtlAgreementGroupId()))
+            && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
+            && (this.getCreateUser() == null ? other.getCreateUser() == null : this.getCreateUser().equals(other.getCreateUser()))
+            && (this.getBatch() == null ? other.getBatch() == null : this.getBatch().equals(other.getBatch()));
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
+        result = prime * result + ((getPtlAgreementId() == null) ? 0 : getPtlAgreementId().hashCode());
+        result = prime * result + ((getPtlAgreementGroupId() == null) ? 0 : getPtlAgreementGroupId().hashCode());
+        result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
+        result = prime * result + ((getCreateUser() == null) ? 0 : getCreateUser().hashCode());
+        result = prime * result + ((getBatch() == null) ? 0 : getBatch().hashCode());
+        return result;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder();
+        sb.append(getClass().getSimpleName());
+        sb.append(" [");
+        sb.append("Hash = ").append(hashCode());
+        sb.append(", id=").append(id);
+        sb.append(", ptlAgreementId=").append(ptlAgreementId);
+        sb.append(", ptlAgreementGroupId=").append(ptlAgreementGroupId);
+        sb.append(", createTime=").append(createTime);
+        sb.append(", createUser=").append(createUser);
+        sb.append(", batch=").append(batch);
+        sb.append(", serialVersionUID=").append(serialVersionUID);
+        sb.append("]");
+        return sb.toString();
+    }
+
+    public PtlAgreementGroupLinkAgreementRecord() {
+    }
+
+    public PtlAgreementGroupLinkAgreementRecord(Long id, Long ptlAgreementId, Long ptlAgreementGroupId, Date createTime, String createUser, String batch) {
+        this.id = id;
+        this.ptlAgreementId = ptlAgreementId;
+        this.ptlAgreementGroupId = ptlAgreementGroupId;
+        this.createTime = createTime;
+        this.createUser = createUser;
+        this.batch = batch;
+    }
+}

+ 104 - 0
src/main/java/com/ydtech/modules/protocol/entity/po/PtlAgreementGroupLinkDept.java

@@ -0,0 +1,104 @@
+package com.ydtech.modules.protocol.entity.po;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * 协议组关联部门
+ * @TableName ptl_agreement_group_link_dept
+ */
+@TableName(value ="ptl_agreement_group_link_dept")
+@Data
+public class PtlAgreementGroupLinkDept implements Serializable {
+    /**
+     * 主键
+     */
+    @TableId
+    private Long id;
+
+    /**
+     * 用户组id
+     */
+    private Long ptlAgreementGroupId;
+
+    /**
+     * 六级机构id
+     */
+    private String deptId;
+
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+
+    /**
+     * 创建人
+     */
+    private String createUser;
+
+    @TableField(exist = false)
+    private static final long serialVersionUID = 1L;
+
+    @Override
+    public boolean equals(Object that) {
+        if (this == that) {
+            return true;
+        }
+        if (that == null) {
+            return false;
+        }
+        if (getClass() != that.getClass()) {
+            return false;
+        }
+        PtlAgreementGroupLinkDept other = (PtlAgreementGroupLinkDept) that;
+        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
+            && (this.getPtlAgreementGroupId() == null ? other.getPtlAgreementGroupId() == null : this.getPtlAgreementGroupId().equals(other.getPtlAgreementGroupId()))
+            && (this.getDeptId() == null ? other.getDeptId() == null : this.getDeptId().equals(other.getDeptId()))
+            && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
+            && (this.getCreateUser() == null ? other.getCreateUser() == null : this.getCreateUser().equals(other.getCreateUser()));
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
+        result = prime * result + ((getPtlAgreementGroupId() == null) ? 0 : getPtlAgreementGroupId().hashCode());
+        result = prime * result + ((getDeptId() == null) ? 0 : getDeptId().hashCode());
+        result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
+        result = prime * result + ((getCreateUser() == null) ? 0 : getCreateUser().hashCode());
+        return result;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder();
+        sb.append(getClass().getSimpleName());
+        sb.append(" [");
+        sb.append("Hash = ").append(hashCode());
+        sb.append(", id=").append(id);
+        sb.append(", ptlAgreementGroupId=").append(ptlAgreementGroupId);
+        sb.append(", deptId=").append(deptId);
+        sb.append(", createTime=").append(createTime);
+        sb.append(", createUser=").append(createUser);
+        sb.append(", serialVersionUID=").append(serialVersionUID);
+        sb.append("]");
+        return sb.toString();
+    }
+
+    public PtlAgreementGroupLinkDept() {
+    }
+
+    public PtlAgreementGroupLinkDept(Long id, Long ptlAgreementGroupId, String deptId, Date createTime, String createUser) {
+        this.id = id;
+        this.ptlAgreementGroupId = ptlAgreementGroupId;
+        this.deptId = deptId;
+        this.createTime = createTime;
+        this.createUser = createUser;
+    }
+}

+ 113 - 0
src/main/java/com/ydtech/modules/protocol/entity/po/PtlAgreementGroupLinkDeptRecord.java

@@ -0,0 +1,113 @@
+package com.ydtech.modules.protocol.entity.po;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * 协议组关联部门
+ * @TableName ptl_agreement_group_link_dept_record
+ */
+@TableName(value ="ptl_agreement_group_link_dept_record")
+@Data
+public class PtlAgreementGroupLinkDeptRecord implements Serializable {
+    /**
+     * 主键
+     */
+    @TableId
+    private Long id;
+
+    /**
+     * 用户组id
+     */
+    private Long ptlAgreementGroupId;
+
+    /**
+     * 六级机构id
+     */
+    private String deptId;
+
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+
+    /**
+     * 创建人
+     */
+    private String createUser;
+
+    /**
+     * 批次uuid
+     */
+    private String batch;
+
+    @TableField(exist = false)
+    private static final long serialVersionUID = 1L;
+
+    @Override
+    public boolean equals(Object that) {
+        if (this == that) {
+            return true;
+        }
+        if (that == null) {
+            return false;
+        }
+        if (getClass() != that.getClass()) {
+            return false;
+        }
+        PtlAgreementGroupLinkDeptRecord other = (PtlAgreementGroupLinkDeptRecord) that;
+        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
+            && (this.getPtlAgreementGroupId() == null ? other.getPtlAgreementGroupId() == null : this.getPtlAgreementGroupId().equals(other.getPtlAgreementGroupId()))
+            && (this.getDeptId() == null ? other.getDeptId() == null : this.getDeptId().equals(other.getDeptId()))
+            && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
+            && (this.getCreateUser() == null ? other.getCreateUser() == null : this.getCreateUser().equals(other.getCreateUser()))
+            && (this.getBatch() == null ? other.getBatch() == null : this.getBatch().equals(other.getBatch()));
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
+        result = prime * result + ((getPtlAgreementGroupId() == null) ? 0 : getPtlAgreementGroupId().hashCode());
+        result = prime * result + ((getDeptId() == null) ? 0 : getDeptId().hashCode());
+        result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
+        result = prime * result + ((getCreateUser() == null) ? 0 : getCreateUser().hashCode());
+        result = prime * result + ((getBatch() == null) ? 0 : getBatch().hashCode());
+        return result;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder();
+        sb.append(getClass().getSimpleName());
+        sb.append(" [");
+        sb.append("Hash = ").append(hashCode());
+        sb.append(", id=").append(id);
+        sb.append(", ptlAgreementGroupId=").append(ptlAgreementGroupId);
+        sb.append(", deptId=").append(deptId);
+        sb.append(", createTime=").append(createTime);
+        sb.append(", createUser=").append(createUser);
+        sb.append(", batch=").append(batch);
+        sb.append(", serialVersionUID=").append(serialVersionUID);
+        sb.append("]");
+        return sb.toString();
+    }
+
+    public PtlAgreementGroupLinkDeptRecord() {
+    }
+
+    public PtlAgreementGroupLinkDeptRecord(Long id, Long ptlAgreementGroupId, String deptId, Date createTime, String createUser, String batch) {
+        this.id = id;
+        this.ptlAgreementGroupId = ptlAgreementGroupId;
+        this.deptId = deptId;
+        this.createTime = createTime;
+        this.createUser = createUser;
+        this.batch = batch;
+    }
+}

+ 126 - 0
src/main/java/com/ydtech/modules/protocol/entity/po/PtlAgreementGroups.java

@@ -0,0 +1,126 @@
+package com.ydtech.modules.protocol.entity.po;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * 协议组
+ * @TableName ptl_agreement_group
+ */
+@TableName(value ="ptl_agreement_group")
+@Data
+public class PtlAgreementGroups implements Serializable {
+    /**
+     * 主键
+     */
+    @TableId(type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 协议组名称
+     */
+    private String agreementGroupName;
+
+    /**
+     * 协议组描述
+     */
+    private String description;
+
+    /**
+     * 是否默认1.是 0.否
+     */
+    private Integer defaultFlag;
+
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+
+    /**
+     * 创建人
+     */
+    private String createUser;
+
+    /**
+     * 修改时间
+     */
+    private Date updateTime;
+
+    /**
+     * 修改人
+     */
+    private String updateUser;
+
+    /**
+     * 是否删除 1.是 0 否
+     */
+    private Integer delFlag;
+
+    @TableField(exist = false)
+    private static final long serialVersionUID = 1L;
+
+    @Override
+    public boolean equals(Object that) {
+        if (this == that) {
+            return true;
+        }
+        if (that == null) {
+            return false;
+        }
+        if (getClass() != that.getClass()) {
+            return false;
+        }
+        PtlAgreementGroups other = (PtlAgreementGroups) that;
+        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
+            && (this.getAgreementGroupName() == null ? other.getAgreementGroupName() == null : this.getAgreementGroupName().equals(other.getAgreementGroupName()))
+            && (this.getDescription() == null ? other.getDescription() == null : this.getDescription().equals(other.getDescription()))
+            && (this.getDefaultFlag() == null ? other.getDefaultFlag() == null : this.getDefaultFlag().equals(other.getDefaultFlag()))
+            && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
+            && (this.getCreateUser() == null ? other.getCreateUser() == null : this.getCreateUser().equals(other.getCreateUser()))
+            && (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()))
+            && (this.getUpdateUser() == null ? other.getUpdateUser() == null : this.getUpdateUser().equals(other.getUpdateUser()))
+            && (this.getDelFlag() == null ? other.getDelFlag() == null : this.getDelFlag().equals(other.getDelFlag()));
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
+        result = prime * result + ((getAgreementGroupName() == null) ? 0 : getAgreementGroupName().hashCode());
+        result = prime * result + ((getDescription() == null) ? 0 : getDescription().hashCode());
+        result = prime * result + ((getDefaultFlag() == null) ? 0 : getDefaultFlag().hashCode());
+        result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
+        result = prime * result + ((getCreateUser() == null) ? 0 : getCreateUser().hashCode());
+        result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
+        result = prime * result + ((getUpdateUser() == null) ? 0 : getUpdateUser().hashCode());
+        result = prime * result + ((getDelFlag() == null) ? 0 : getDelFlag().hashCode());
+        return result;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder();
+        sb.append(getClass().getSimpleName());
+        sb.append(" [");
+        sb.append("Hash = ").append(hashCode());
+        sb.append(", id=").append(id);
+        sb.append(", agreementGroupName=").append(agreementGroupName);
+        sb.append(", description=").append(description);
+        sb.append(", defaultFlag=").append(defaultFlag);
+        sb.append(", createTime=").append(createTime);
+        sb.append(", createUser=").append(createUser);
+        sb.append(", updateTime=").append(updateTime);
+        sb.append(", updateUser=").append(updateUser);
+        sb.append(", delFlag=").append(delFlag);
+        sb.append(", serialVersionUID=").append(serialVersionUID);
+        sb.append("]");
+        return sb.toString();
+    }
+}

+ 43 - 0
src/main/java/com/ydtech/modules/protocol/entity/vo/PtlAgreementGroupAddVo.java

@@ -0,0 +1,43 @@
+package com.ydtech.modules.protocol.entity.vo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
+import java.io.Serializable;
+
+/**
+ * 协议组
+ * @TableName ptl_agreement_group
+ */
+@Data
+@ApiModel("协议组添加信息")
+public class PtlAgreementGroupAddVo implements Serializable {
+
+    @ApiModelProperty("协议组id")
+    private Long id;
+
+    /**
+     * 协议组名称
+     */
+    @NotBlank(message = "协议组名称不能为空")
+    @ApiModelProperty("协议组名称")
+    private String agreementGroupName;
+
+    /**
+     * 协议组描述
+     */
+    @NotBlank(message = "协议组描述不能为空")
+    @ApiModelProperty("协议组描述")
+    private String description;
+
+    /**
+     * 是否默认1.是 0.否
+     */
+    @NotNull(message = "是否默认不能为空")
+    @ApiModelProperty("是否默认1.是 0.否")
+    private Integer defaultFlag;
+
+}

+ 33 - 0
src/main/java/com/ydtech/modules/protocol/entity/vo/PtlAgreementGroupLinkAgreementAddVo.java

@@ -0,0 +1,33 @@
+package com.ydtech.modules.protocol.entity.vo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.validation.constraints.NotEmpty;
+import javax.validation.constraints.NotNull;
+import java.io.Serializable;
+import java.util.ArrayList;
+
+/**
+ *  @version
+ *  @author: hxl
+ *  @Date: 2024/10/24 14:15
+ *  @Description:  配置协议
+ */
+@Data
+@ApiModel("协议组配置协议信息")
+public class PtlAgreementGroupLinkAgreementAddVo implements Serializable {
+
+    @NotNull(message = "协议组id不能为空")
+    @ApiModelProperty("协议组id")
+    private Long agreementGroupId;
+
+    /**
+     * 协议组名称
+     */
+    @NotEmpty(message = "协议集合不能为空")
+    @ApiModelProperty("协议集合")
+    private ArrayList<Long>  agreementList =new ArrayList<Long>();
+
+}

+ 27 - 0
src/main/java/com/ydtech/modules/protocol/entity/vo/PtlAgreementGroupLinkAgreementDeleteVo.java

@@ -0,0 +1,27 @@
+package com.ydtech.modules.protocol.entity.vo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.validation.constraints.NotEmpty;
+import java.io.Serializable;
+import java.util.ArrayList;
+
+/**
+ *  @version
+ *  @author: hxl
+ *  @Date: 2024/10/24 14:15
+ *  @Description:  配置协议
+ */
+@Data
+@ApiModel("协议组配置协议删除信息")
+public class PtlAgreementGroupLinkAgreementDeleteVo implements Serializable {
+    /**
+     * 协议组名称
+     */
+    @NotEmpty(message = "协议关联Ids集合不能为空")
+    @ApiModelProperty("协议关联Ids集合")
+    private ArrayList<Long>  ids =new ArrayList<Long>();
+
+}

+ 37 - 0
src/main/java/com/ydtech/modules/protocol/entity/vo/PtlAgreementGroupLinkAgreementVo.java

@@ -0,0 +1,37 @@
+package com.ydtech.modules.protocol.entity.vo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.validation.constraints.NotNull;
+import java.io.Serializable;
+
+/**
+ *  @version
+ *  @author: hxl
+ *  @Date: 2024/10/24 14:15
+ *  @Description:  配置协议
+ */
+@Data
+@ApiModel("协议组配置协议信息")
+public class PtlAgreementGroupLinkAgreementVo implements Serializable {
+
+    @NotNull(message = "协议组id不能为空")
+    @ApiModelProperty("协议组id")
+    private Long agreementGroupId;
+
+    @ApiModelProperty("保险公司id")
+    private String companyId;
+    /**
+     * 当前页码
+     */
+    @ApiModelProperty("当前页码")
+    private Integer pageNum;
+    /**
+     * 每页数量
+     */
+    @ApiModelProperty("每页数量")
+    private Integer pageSize;
+
+}

+ 32 - 0
src/main/java/com/ydtech/modules/protocol/entity/vo/PtlAgreementGroupLinkDeptAddVo.java

@@ -0,0 +1,32 @@
+package com.ydtech.modules.protocol.entity.vo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.validation.constraints.NotNull;
+import java.io.Serializable;
+import java.util.ArrayList;
+
+/**
+ *  @version
+ *  @author: hxl
+ *  @Date: 2024/10/24 14:15
+ *  @Description:  协议组授权信息
+ */
+@Data
+@ApiModel("协议组授权信息")
+public class PtlAgreementGroupLinkDeptAddVo implements Serializable {
+
+    @NotNull(message = "协议组id不能为空")
+    @ApiModelProperty("协议组id")
+    private Long ptlAgreementGroupId;
+
+    /**
+     * 协议组名称
+     */
+    //@NotEmpty(message = "部门集合不能为空")
+    @ApiModelProperty("部门集合")
+    private ArrayList<String>  ids =new ArrayList<String>();
+
+}

+ 37 - 0
src/main/java/com/ydtech/modules/protocol/entity/vo/PtlAgreementGroupVo.java

@@ -0,0 +1,37 @@
+package com.ydtech.modules.protocol.entity.vo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.validation.constraints.NotNull;
+import java.io.Serializable;
+
+@Data
+@ApiModel("协议组分页查询")
+public class PtlAgreementGroupVo implements Serializable {
+
+    /**
+     * 协议组名称
+     */
+    @ApiModelProperty("协议组名称")
+    private String agreementGroupName;
+
+    /**
+     * 是否默认1.是 0.否
+     */
+    @NotNull(message = "是否默认不能为空")
+    @ApiModelProperty("是否默认1.是 0.否")
+    private Integer defaultFlag;
+
+    /**
+     * 当前页码
+     */
+    @ApiModelProperty("当前页码")
+    private Integer pageNum;
+    /**
+     * 每页数量
+     */
+    @ApiModelProperty("每页数量")
+    private Integer pageSize;
+}

+ 34 - 0
src/main/java/com/ydtech/modules/protocol/entity/vo/PtlAgreementLinkVo.java

@@ -0,0 +1,34 @@
+package com.ydtech.modules.protocol.entity.vo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+
+@Data
+@ApiModel("协议列表信息")
+public class PtlAgreementLinkVo implements Serializable {
+
+    /**
+     * 协议组id
+     */
+    @ApiModelProperty("协议组id")
+    private String agreementGroupId;
+    /**
+     * 协议组名称
+     */
+    @ApiModelProperty("协议组名称")
+    private String agreementGroupName;
+
+    /**
+     * 协议id
+     */
+    @ApiModelProperty("协议id")
+    private Long  agreementId;
+    /**
+     * 协议名称
+     */
+    @ApiModelProperty("协议名称")
+    private String agreementName;
+}

+ 43 - 0
src/main/java/com/ydtech/modules/protocol/entity/vo/PtlAgreementListVo.java

@@ -0,0 +1,43 @@
+package com.ydtech.modules.protocol.entity.vo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+import java.io.Serializable;
+
+/**
+ *  @version
+ *  @author: hxl
+ *  @Date: 2024/10/24 14:15
+ *  @Description:  配置协议
+ */
+@Data
+@ApiModel("协议组配置协议信息")
+public class PtlAgreementListVo implements Serializable {
+
+
+    @ApiModelProperty("保险公司id")
+    private String companyId;
+
+    @NotBlank(message = "协议组id不能为空")
+    @ApiModelProperty("协议组id")
+    private String agreementGroupId;
+
+    @NotBlank(message = "是否默认不能为空")
+    @ApiModelProperty("是否默认协议组 1. 是  0 否")
+    private String  defaultFlag;
+
+    /**
+     * 当前页码
+     */
+    @ApiModelProperty("当前页码")
+    private Integer pageNum;
+    /**
+     * 每页数量
+     */
+    @ApiModelProperty("每页数量")
+    private Integer pageSize;
+
+}

+ 13 - 0
src/main/java/com/ydtech/modules/protocol/service/PtlAgreementGroupLinkAgreementRecordService.java

@@ -0,0 +1,13 @@
+package com.ydtech.modules.protocol.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ydtech.modules.protocol.entity.po.PtlAgreementGroupLinkAgreementRecord;
+
+/**
+* @author Administrator
+* @description 针对表【ptl_agreement_group_link_agreement_record(协议组关联协议)】的数据库操作Service
+* @createDate 2024-10-24 09:54:37
+*/
+public interface PtlAgreementGroupLinkAgreementRecordService extends IService<PtlAgreementGroupLinkAgreementRecord> {
+
+}

+ 23 - 0
src/main/java/com/ydtech/modules/protocol/service/PtlAgreementGroupLinkAgreementService.java

@@ -0,0 +1,23 @@
+package com.ydtech.modules.protocol.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ydtech.modules.protocol.entity.po.PtlAgreementGroupLinkAgreement;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+* @author Administrator
+* @description 针对表【ptl_agreement_group_link_agreement(协议组关联协议)】的数据库操作Service
+* @createDate 2024-10-24 09:54:37
+*/
+public interface PtlAgreementGroupLinkAgreementService extends IService<PtlAgreementGroupLinkAgreement> {
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/10/24 19:12
+     *  @Description: 查詢數據
+     */
+    List<PtlAgreementGroupLinkAgreement> findByIds(@Param("ids") ArrayList<Long> ids);
+}

+ 13 - 0
src/main/java/com/ydtech/modules/protocol/service/PtlAgreementGroupLinkDeptRecordService.java

@@ -0,0 +1,13 @@
+package com.ydtech.modules.protocol.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ydtech.modules.protocol.entity.po.PtlAgreementGroupLinkDeptRecord;
+
+/**
+* @author Administrator
+* @description 针对表【ptl_agreement_group_link_dept_record(协议组关联部门)】的数据库操作Service
+* @createDate 2024-10-24 09:54:37
+*/
+public interface PtlAgreementGroupLinkDeptRecordService extends IService<PtlAgreementGroupLinkDeptRecord> {
+
+}

+ 30 - 0
src/main/java/com/ydtech/modules/protocol/service/PtlAgreementGroupLinkDeptService.java

@@ -0,0 +1,30 @@
+package com.ydtech.modules.protocol.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ydtech.modules.protocol.entity.po.PtlAgreementGroupLinkDept;
+
+import java.util.List;
+
+/**
+* @author Administrator
+* @description 针对表【ptl_agreement_group_link_dept(协议组关联部门)】的数据库操作Service
+* @createDate 2024-10-24 09:54:37
+*/
+public interface PtlAgreementGroupLinkDeptService extends IService<PtlAgreementGroupLinkDept> {
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/10/25 8:33
+     *  @Description: 通过协议组查询参数
+     */
+    List<PtlAgreementGroupLinkDept> findByGroupId(Long agreementGroupId);
+
+
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/10/25 8:33
+     *  @Description: 通过协议组查询参数
+     */
+    //List<PtlAgreementGroupLinkDept> findByGroupId(Long agreementGroupId);
+}

+ 98 - 0
src/main/java/com/ydtech/modules/protocol/service/PtlAgreementGroupService.java

@@ -0,0 +1,98 @@
+package com.ydtech.modules.protocol.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ydtech.modules.order.entity.BasePageResult;
+import com.ydtech.modules.protocol.entity.dto.PtlAgreementGroupDto;
+import com.ydtech.modules.protocol.entity.dto.PtlAgreementGroupLinkAgreementDto;
+import com.ydtech.modules.protocol.entity.po.PtlAgreementGroups;
+import com.ydtech.modules.protocol.entity.vo.*;
+
+import java.util.List;
+
+/**
+* @author Administrator
+* @description 针对表【ptl_agreement_group(协议组)】的数据库操作Service
+* @createDate 2024-10-24 09:54:37
+*/
+public interface PtlAgreementGroupService extends IService<PtlAgreementGroups> {
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/10/24 10:44
+     *  @Description: 分页查询
+     */
+    BasePageResult<PtlAgreementGroupDto> queryPage(PtlAgreementGroupVo ptlAgreementGroupVo);
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/10/24 11:29
+     *  @Description: 新增或者修改
+     */
+    void addOrUpdate(PtlAgreementGroupAddVo ptlAgreementGroupAddVo);
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/10/24 11:29
+     *  @Description:  逻辑删除
+     */
+    void updateByIdDelete(Long id);
+
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/10/24 11:34
+     *  @Description:  查询默认的协议组
+     */
+    PtlAgreementGroups findByDefaultFlag(Long id);
+
+
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/10/24 11:42
+     *  @Description:  判断协议组名称是否存在
+     */
+    PtlAgreementGroups findByName(String name,Long id);
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/10/24 15:14
+     *  @Description:  查询可以使用的协议
+     */
+    BasePageResult<PtlAgreementGroupLinkAgreementDto> findAgreementList(PtlAgreementListVo ptlAgreementListVo);
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/10/24 15:15
+     *  @Description: 配置协议
+     */
+    void saveAgreementList(PtlAgreementGroupLinkAgreementAddVo ptlAgreementGroupLinkAgreementAddVo);
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/10/24 15:15
+     *  @Description: 查看配置协议
+     */
+    BasePageResult<PtlAgreementGroupLinkAgreementDto> findLinkAgreementList(PtlAgreementGroupLinkAgreementVo ptlAgreementGroupLinkAgreementVo);
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/10/24 15:16
+     *  @Description:  授权部门
+     */
+    void authorizeDeptList(PtlAgreementGroupLinkDeptAddVo ptlAgreementGroupLinkDeptAddVo);
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/10/24 15:28
+     *  @Description: 删除协议组关联协议
+     */
+    void deleteLinkAgreementList(PtlAgreementGroupLinkAgreementDeleteVo ptlAgreementGroupLinkAgreementDeleteVo);
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/10/25 9:55
+     *  @Description: 通过协议组id查询授权的部门ids
+     */
+    List<String> findDeptIdsByPtlAgreementGroupId(Long ptlAgreementGroupId);
+}

+ 28 - 5
src/main/java/com/ydtech/modules/protocol/service/impl/PtlAgreementDeptServiceImpl.java

@@ -2,21 +2,23 @@ package com.ydtech.modules.protocol.service.impl;
 
 import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.util.StrUtil;
-import com.alibaba.druid.sql.visitor.functions.If;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.ydtech.exception.SystemException;
+import com.ydtech.modules.admin.service.SysSwitchConfigService;
 import com.ydtech.modules.protocol.dao.PtlAgreementDeptMapper;
+import com.ydtech.modules.protocol.dao.PtlAgreementGroupLinkDeptMapper;
 import com.ydtech.modules.protocol.entity.po.PtlAgreement;
 import com.ydtech.modules.protocol.entity.po.PtlAgreementDept;
 import com.ydtech.modules.protocol.entity.vo.PltAgreementDeptDispositionVo;
 import com.ydtech.modules.protocol.service.PtlAgreementDeptService;
 import com.ydtech.modules.protocol.utils.AssertionUtils;
+import org.apache.commons.lang3.StringUtils;
+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.stream.Collectors;
 
 /**
  * @author wenks
@@ -27,6 +29,12 @@ import java.util.stream.Collectors;
 public class PtlAgreementDeptServiceImpl extends ServiceImpl<PtlAgreementDeptMapper, PtlAgreementDept>
         implements PtlAgreementDeptService {
 
+    @Autowired
+    private PtlAgreementGroupLinkDeptMapper ptlAgreementGroupLinkDeptMapper;
+
+    @Autowired
+    private SysSwitchConfigService sysSwitchConfigService;
+
     @Override
     @Transactional
     public void saveBatchDept(String agreementId, List<String> dept) {
@@ -50,10 +58,25 @@ public class PtlAgreementDeptServiceImpl extends ServiceImpl<PtlAgreementDeptMap
 
     @Override
     public void agreementIsAuthorized(String deptId, String agreementId) {
-        List<PtlAgreementDept> list = list(byAgreementId(agreementId).eq(PtlAgreementDept::getDeptId, deptId));
-        if (list.isEmpty()) {
-            throw new SystemException("请联系团队长授权");
+        //add by  hxl  2024-10-25   注释掉从 协议调度授权部门的协议逻辑  ==================begin==================
+        boolean flag = sysSwitchConfigService.xysqDisplaySwitches();
+        if(flag){
+            //新逻辑从协议组授权获取
+            if(StringUtils.isNotBlank(deptId)){
+                List<String> ids =ptlAgreementGroupLinkDeptMapper.getAgreementByDeptId(agreementId, deptId);
+                if (ids.isEmpty()) {
+                    throw new SystemException("协议或调度协议未授权,请联系团队长授权");
+                }
+            }
+        }else{
+            //原先逻辑
+            List<PtlAgreementDept> list = list(byAgreementId(agreementId).eq(PtlAgreementDept::getDeptId, deptId));
+            //==================================================================== end==================
+            if (list.isEmpty()) {
+                throw new SystemException("请联系团队长授权");
+            }
         }
+
     }
 
     @Override

+ 22 - 0
src/main/java/com/ydtech/modules/protocol/service/impl/PtlAgreementGroupLinkAgreementRecordServiceImpl.java

@@ -0,0 +1,22 @@
+package com.ydtech.modules.protocol.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ydtech.modules.protocol.dao.PtlAgreementGroupLinkAgreementRecordMapper;
+import com.ydtech.modules.protocol.entity.po.PtlAgreementGroupLinkAgreementRecord;
+import com.ydtech.modules.protocol.service.PtlAgreementGroupLinkAgreementRecordService;
+import org.springframework.stereotype.Service;
+
+/**
+ * @author Administrator
+ * @description 针对表【ptl_agreement_group_link_agreement_record(协议组关联协议)】的数据库操作Service实现
+ * @createDate 2024-10-24 09:54:37
+ */
+@Service
+public class PtlAgreementGroupLinkAgreementRecordServiceImpl extends ServiceImpl<PtlAgreementGroupLinkAgreementRecordMapper, PtlAgreementGroupLinkAgreementRecord>
+        implements PtlAgreementGroupLinkAgreementRecordService {
+
+}
+
+
+
+

+ 32 - 0
src/main/java/com/ydtech/modules/protocol/service/impl/PtlAgreementGroupLinkAgreementServiceImpl.java

@@ -0,0 +1,32 @@
+package com.ydtech.modules.protocol.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ydtech.modules.protocol.dao.PtlAgreementGroupLinkAgreementMapper;
+import com.ydtech.modules.protocol.entity.po.PtlAgreementGroupLinkAgreement;
+import com.ydtech.modules.protocol.service.PtlAgreementGroupLinkAgreementService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+* @author Administrator
+* @description 针对表【ptl_agreement_group_link_agreement(协议组关联协议)】的数据库操作Service实现
+* @createDate 2024-10-24 09:54:37
+*/
+@Service
+public class PtlAgreementGroupLinkAgreementServiceImpl extends ServiceImpl<PtlAgreementGroupLinkAgreementMapper, PtlAgreementGroupLinkAgreement>
+    implements PtlAgreementGroupLinkAgreementService {
+
+    @Autowired
+    private PtlAgreementGroupLinkAgreementMapper  ptlAgreementGroupLinkAgreementMapper;
+    @Override
+    public List<PtlAgreementGroupLinkAgreement> findByIds(ArrayList<Long> ids) {
+        return ptlAgreementGroupLinkAgreementMapper.findByIds(ids);
+    }
+}
+
+
+
+

+ 22 - 0
src/main/java/com/ydtech/modules/protocol/service/impl/PtlAgreementGroupLinkDeptRecordServiceImpl.java

@@ -0,0 +1,22 @@
+package com.ydtech.modules.protocol.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ydtech.modules.protocol.dao.PtlAgreementGroupLinkDeptRecordMapper;
+import com.ydtech.modules.protocol.entity.po.PtlAgreementGroupLinkDeptRecord;
+import com.ydtech.modules.protocol.service.PtlAgreementGroupLinkDeptRecordService;
+import org.springframework.stereotype.Service;
+
+/**
+* @author Administrator
+* @description 针对表【ptl_agreement_group_link_dept_record(协议组关联部门)】的数据库操作Service实现
+* @createDate 2024-10-24 09:54:37
+*/
+@Service
+public class PtlAgreementGroupLinkDeptRecordServiceImpl extends ServiceImpl<PtlAgreementGroupLinkDeptRecordMapper, PtlAgreementGroupLinkDeptRecord>
+    implements PtlAgreementGroupLinkDeptRecordService {
+
+}
+
+
+
+

+ 39 - 0
src/main/java/com/ydtech/modules/protocol/service/impl/PtlAgreementGroupLinkDeptServiceImpl.java

@@ -0,0 +1,39 @@
+package com.ydtech.modules.protocol.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ydtech.modules.protocol.dao.PtlAgreementGroupLinkDeptMapper;
+import com.ydtech.modules.protocol.entity.po.PtlAgreementGroupLinkDept;
+import com.ydtech.modules.protocol.service.PtlAgreementGroupLinkDeptService;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * @author Administrator
+ * @description 针对表【ptl_agreement_group_link_dept(协议组关联部门)】的数据库操作Service实现
+ * @createDate 2024-10-24 09:54:37
+ */
+@Service
+public class PtlAgreementGroupLinkDeptServiceImpl extends ServiceImpl<PtlAgreementGroupLinkDeptMapper, PtlAgreementGroupLinkDept>
+        implements PtlAgreementGroupLinkDeptService {
+
+
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/10/25 8:59
+     *  @Description:  通过协议组id查询绑定机构
+     */
+    @Override
+    public List<PtlAgreementGroupLinkDept> findByGroupId(Long agreementGroupId) {
+        LambdaQueryWrapper<PtlAgreementGroupLinkDept> infoWapper = new LambdaQueryWrapper<>();
+        infoWapper.eq(PtlAgreementGroupLinkDept::getPtlAgreementGroupId, agreementGroupId);
+        return this.list(infoWapper);
+    }
+
+}
+
+
+
+

+ 312 - 0
src/main/java/com/ydtech/modules/protocol/service/impl/PtlAgreementGroupServiceImpl.java

@@ -0,0 +1,312 @@
+package com.ydtech.modules.protocol.service.impl;
+
+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.ydtech.exception.SystemException;
+import com.ydtech.modules.base.controller.BaseController;
+import com.ydtech.modules.order.entity.BasePageResult;
+import com.ydtech.modules.protocol.dao.PtlAgreementGroupLinkAgreementMapper;
+import com.ydtech.modules.protocol.dao.PtlAgreementGroupMapper;
+import com.ydtech.modules.protocol.entity.dto.PtlAgreementGroupDto;
+import com.ydtech.modules.protocol.entity.dto.PtlAgreementGroupLinkAgreementDto;
+import com.ydtech.modules.protocol.entity.po.*;
+import com.ydtech.modules.protocol.entity.vo.*;
+import com.ydtech.modules.protocol.service.*;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Objects;
+
+/**
+ * @author Administrator
+ * @description 针对表【ptl_agreement_group(协议组)】的数据库操作Service实现
+ * @createDate 2024-10-24 09:54:37
+ */
+@Service
+public class PtlAgreementGroupServiceImpl extends ServiceImpl<PtlAgreementGroupMapper, PtlAgreementGroups>
+        implements PtlAgreementGroupService {
+
+
+    @Autowired
+    private  PtlAgreementGroupMapper  ptlAgreementGroupMapper;
+
+    @Autowired
+    private PtlAgreementGroupLinkAgreementMapper ptlAgreementGroupLinkAgreementMapper;
+
+    @Autowired
+    private PtlAgreementGroupLinkAgreementService ptlAgreementGroupLinkAgreementService;
+
+    @Autowired
+    private PtlAgreementGroupLinkAgreementRecordService ptlAgreementGroupLinkAgreementRecordService;
+
+
+    @Autowired
+    private PtlAgreementGroupLinkDeptService ptlAgreementGroupLinkDeptService;
+
+    @Autowired
+    private PtlAgreementGroupLinkDeptRecordService ptlAgreementGroupLinkDeptRecordService;
+
+
+
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/10/24 10:56
+     *  @Description: 分页查询
+     */
+    @Override
+    public BasePageResult<PtlAgreementGroupDto> queryPage(PtlAgreementGroupVo ptlAgreementGroupVo) {
+        Page<PtlAgreementGroupDto> page = new Page<>(ptlAgreementGroupVo.getPageNum(),
+                ptlAgreementGroupVo.getPageSize());
+        Page<PtlAgreementGroupDto> pageResult = ptlAgreementGroupMapper.queryPage(page, ptlAgreementGroupVo);
+        return  new BasePageResult<>(ptlAgreementGroupVo.getPageNum(), page.getSize(), pageResult.getTotal(), page.getPages(),
+                pageResult.getRecords());
+    }
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/10/24 11:30
+     *  @Description: 新增或者修改
+     */
+    @Override
+    public void addOrUpdate(PtlAgreementGroupAddVo ptlAgreementGroupAddVo) {
+        //判断有没有默认的数据,没有必须先添加
+        PtlAgreementGroups defaultFlagGroup = this.findByDefaultFlag(ptlAgreementGroupAddVo.getId());
+        if(ptlAgreementGroupAddVo.getId()==null){
+            //如果非默认必须先添加默认
+            if(ptlAgreementGroupAddVo.getDefaultFlag()==0 && defaultFlagGroup ==null){
+                throw  new SystemException("不存在默认协议组先添加默认协议组!!");
+            }else if(ptlAgreementGroupAddVo.getDefaultFlag()==1 && defaultFlagGroup!=null){
+                if(Objects.equals(defaultFlagGroup.getId(), ptlAgreementGroupAddVo.getId() == null ? 0L : ptlAgreementGroupAddVo.getId())){
+                    throw  new SystemException("默认协议组不允许修改!!");
+                }else{
+                    throw  new SystemException("已存在默认协议组不允许添加!!");
+                }
+            }
+        }else{
+            if(Objects.equals(defaultFlagGroup.getId(), ptlAgreementGroupAddVo.getId() == null ? 0L : ptlAgreementGroupAddVo.getId())){
+                throw  new SystemException("默认协议组不允许修改!!");
+            }else{
+                if(ptlAgreementGroupAddVo.getDefaultFlag()==1){
+                    throw  new SystemException("非默认协议组不允许修改为默认!!");
+                }
+            }
+        }
+
+        //查询协议组名称是否存在
+        PtlAgreementGroups groupNames = this.findByName(ptlAgreementGroupAddVo.getAgreementGroupName(),ptlAgreementGroupAddVo.getId());
+        if(groupNames!=null){
+            throw  new SystemException("默认协议组名称已存在不允许添加!!");
+        }
+        PtlAgreementGroups groups = new PtlAgreementGroups();
+        if(ptlAgreementGroupAddVo.getId()==null){
+            BeanUtils.copyProperties(ptlAgreementGroupAddVo, groups);
+            groups.setCreateTime(new Date());
+            groups.setCreateUser(new BaseController().getUserId());
+            groups.setDelFlag(0);
+            //添加
+            this.save(groups);
+        }else{
+            PtlAgreementGroups updateData = this.getById(ptlAgreementGroupAddVo.getId());
+            BeanUtils.copyProperties(ptlAgreementGroupAddVo, updateData);
+            //修改
+            updateData.setUpdateTime(new Date());
+            updateData.setUpdateUser(new BaseController().getUserId());
+            updateData.setDelFlag(0);
+            this.updateById(updateData);
+        }
+
+    }
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/10/24 11:30
+     *  @Description:  逻辑删除
+     */
+    @Override
+    public void updateByIdDelete(Long id) {
+        PtlAgreementGroups defaultFlagGroup = this.getById(id);
+        //如果非默认必须先添加默认
+        if(defaultFlagGroup.getDefaultFlag()==1){
+            throw  new SystemException("默认协议组不允许删除");
+        }
+        defaultFlagGroup.setDelFlag(1);
+        //逻辑删除
+        this.updateById(defaultFlagGroup);
+    }
+
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/10/24 11:39
+     *  @Description:  查询默认协议
+     */
+    @Override
+    public PtlAgreementGroups findByDefaultFlag(Long id) {
+        LambdaQueryWrapper<PtlAgreementGroups> infoWapper = new LambdaQueryWrapper<>();
+        if(id!=null){
+            infoWapper.ne(PtlAgreementGroups::getId, id);
+        }
+        infoWapper.eq(PtlAgreementGroups::getDefaultFlag, 1);
+        infoWapper.eq(PtlAgreementGroups::getDelFlag, 0);
+        PtlAgreementGroups group = this.getOne(infoWapper);
+        return group;
+    }
+
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/10/24 11:39
+     *  @Description:  查询默认协议
+     */
+    @Override
+    public PtlAgreementGroups findByName(String name,Long id) {
+        LambdaQueryWrapper<PtlAgreementGroups> infoWapper = new LambdaQueryWrapper<>();
+        if(id!=null){
+            infoWapper.ne(PtlAgreementGroups::getId, id);
+        }
+        infoWapper.eq(PtlAgreementGroups::getAgreementGroupName, name);
+        infoWapper.eq(PtlAgreementGroups::getDelFlag, 0);
+        PtlAgreementGroups group = this.getOne(infoWapper);
+        return group;
+    }
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/10/24 15:18
+     *  @Description:  查询可以使用的协议
+     */
+    @Override
+    public BasePageResult<PtlAgreementGroupLinkAgreementDto> findAgreementList(PtlAgreementListVo ptlAgreementListVo) {
+        Page<PtlAgreementGroupLinkAgreementDto> page = new Page<>(ptlAgreementListVo.getPageNum(),
+                ptlAgreementListVo.getPageSize());
+        Page<PtlAgreementGroupLinkAgreementDto> pageResult = ptlAgreementGroupLinkAgreementMapper.queryPage(page, ptlAgreementListVo);
+        return  new BasePageResult<>(ptlAgreementListVo.getPageNum(), page.getSize(), pageResult.getTotal(), page.getPages(),
+                pageResult.getRecords());
+    }
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/10/24 15:23
+     *  @Description:  保存集合
+     */
+    @Override
+    public void saveAgreementList(PtlAgreementGroupLinkAgreementAddVo ptlAgreementGroupLinkAgreementAddVo) {
+          //保存协议组关联协议
+        List<Long> oldIds= ptlAgreementGroupLinkAgreementMapper.findByGroupId(ptlAgreementGroupLinkAgreementAddVo.getAgreementGroupId());
+        ArrayList<Long> agreementList = ptlAgreementGroupLinkAgreementAddVo.getAgreementList();
+        if(oldIds!=null && !oldIds.isEmpty() && agreementList!=null && !agreementList.isEmpty()){
+            agreementList.removeAll(oldIds);
+        }
+        //添加
+        List<PtlAgreementGroupLinkAgreement> addList = new ArrayList<PtlAgreementGroupLinkAgreement>();
+        List<PtlAgreementGroupLinkAgreementRecord> addRecordList = new ArrayList<PtlAgreementGroupLinkAgreementRecord>();
+        agreementList.stream().forEach(agreeId -> {
+            PtlAgreementGroupLinkAgreement  dto =new PtlAgreementGroupLinkAgreement(null,agreeId,ptlAgreementGroupLinkAgreementAddVo.getAgreementGroupId(),new Date(),new BaseController().getUserId());
+            PtlAgreementGroupLinkAgreementRecord  recordDto =new PtlAgreementGroupLinkAgreementRecord(null,agreeId,ptlAgreementGroupLinkAgreementAddVo.getAgreementGroupId(),new Date(),new BaseController().getUserId(),"add");
+            addList.add(dto);
+            addRecordList.add(recordDto);
+        });
+        ptlAgreementGroupLinkAgreementService.saveBatch(addList);
+        ptlAgreementGroupLinkAgreementRecordService.saveBatch(addRecordList);
+
+    }
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/10/24 15:24
+     *  @Description:  查询协议组关联的协议
+     */
+    @Override
+    public BasePageResult<PtlAgreementGroupLinkAgreementDto> findLinkAgreementList(PtlAgreementGroupLinkAgreementVo ptlAgreementGroupLinkAgreementVo) {
+        Page<PtlAgreementGroupLinkAgreementDto> page = new Page<>(ptlAgreementGroupLinkAgreementVo.getPageNum(),
+                ptlAgreementGroupLinkAgreementVo.getPageSize());
+        Page<PtlAgreementGroupLinkAgreementDto> pageResult = ptlAgreementGroupLinkAgreementMapper.findLinkAgreementList(page, ptlAgreementGroupLinkAgreementVo);
+        return  new BasePageResult<>(ptlAgreementGroupLinkAgreementVo.getPageNum(), page.getSize(), pageResult.getTotal(), page.getPages(),
+                pageResult.getRecords());
+    }
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/10/24 15:31
+     *  @Description:  删除协议组关联的协议
+     */
+    @Override
+    public void deleteLinkAgreementList(PtlAgreementGroupLinkAgreementDeleteVo ptlAgreementGroupLinkAgreementDeleteVo) {
+        List<PtlAgreementGroupLinkAgreement> deleteList = ptlAgreementGroupLinkAgreementService.findByIds(ptlAgreementGroupLinkAgreementDeleteVo.getIds());
+        List<PtlAgreementGroupLinkAgreementRecord> addRecordList = new ArrayList<PtlAgreementGroupLinkAgreementRecord>();
+        if(deleteList!=null && !deleteList.isEmpty()){
+            deleteList.stream().forEach(agree -> {
+                PtlAgreementGroupLinkAgreementRecord  recordDto =new PtlAgreementGroupLinkAgreementRecord(null,agree.getPtlAgreementId(),agree.getPtlAgreementGroupId(),new Date(),new BaseController().getUserId(),"delete");
+                addRecordList.add(recordDto);
+            });
+            ptlAgreementGroupLinkAgreementService.removeByIds(deleteList);
+            ptlAgreementGroupLinkAgreementRecordService.saveBatch(addRecordList);
+        }
+    }
+
+
+
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/10/24 15:24
+     *  @Description: 协议授权
+     */
+    @Override
+    public void authorizeDeptList(PtlAgreementGroupLinkDeptAddVo ptlAgreementGroupLinkDeptAddVo) {
+         //通过协议组id查詢到授权的部门删除重新添加
+         // 删除添加
+        ArrayList<PtlAgreementGroupLinkDeptRecord>   addRecordList =new ArrayList<PtlAgreementGroupLinkDeptRecord>();
+        ArrayList<PtlAgreementGroupLinkDept>   addList =new ArrayList<PtlAgreementGroupLinkDept>();
+        //查询
+        List<PtlAgreementGroupLinkDept>  deleteList = ptlAgreementGroupLinkDeptService.findByGroupId(ptlAgreementGroupLinkDeptAddVo.getPtlAgreementGroupId());
+        if(deleteList!=null && !deleteList.isEmpty()){
+            deleteList.stream().forEach(dept -> {
+                PtlAgreementGroupLinkDeptRecord recordDto =new PtlAgreementGroupLinkDeptRecord(null,dept.getPtlAgreementGroupId(),dept.getDeptId(),new Date(),new BaseController().getUserId(),"delete");
+                addRecordList.add(recordDto);
+            });
+            ptlAgreementGroupLinkDeptService.removeByIds(deleteList);
+        }
+        //查询新增的list
+        ArrayList<String> ids = ptlAgreementGroupLinkDeptAddVo.getIds();
+        if(ids!=null && !ids.isEmpty()){
+            ids.stream().forEach(deptId -> {
+                PtlAgreementGroupLinkDept dto =new PtlAgreementGroupLinkDept(null,ptlAgreementGroupLinkDeptAddVo.getPtlAgreementGroupId(),deptId,new Date(),new BaseController().getUserId());
+                PtlAgreementGroupLinkDeptRecord recordDto =new PtlAgreementGroupLinkDeptRecord(null,ptlAgreementGroupLinkDeptAddVo.getPtlAgreementGroupId(),deptId,new Date(),new BaseController().getUserId(),"add");
+                addRecordList.add(recordDto);
+                addList.add(dto);
+            });
+        }
+        if(addList!=null && !addList.isEmpty()){
+            ptlAgreementGroupLinkDeptService.saveBatch(addList);
+        }
+        if(addRecordList!=null && !addRecordList.isEmpty()){
+            ptlAgreementGroupLinkDeptRecordService.saveBatch(addRecordList);
+        }
+    }
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/10/25 9:59
+     *  @Description: 通过协议id查询授权部门ids
+     */
+    @Override
+    public List<String> findDeptIdsByPtlAgreementGroupId(Long ptlAgreementGroupId) {
+        ArrayList<String>   deptIds =new ArrayList<String>();
+        //查询
+        List<PtlAgreementGroupLinkDept>  deleteList = ptlAgreementGroupLinkDeptService.findByGroupId(ptlAgreementGroupId);
+        if(deleteList!=null && !deleteList.isEmpty()){
+            deleteList.stream().forEach(dept -> {
+                deptIds.add(dept.getDeptId());
+            });
+        }
+        return deptIds;
+    }
+
+}

+ 25 - 4
src/main/java/com/ydtech/modules/protocol/service/impl/PtlAgreementServiceImpl.java

@@ -2,7 +2,6 @@ package com.ydtech.modules.protocol.service.impl;
 
 import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.date.DateUtil;
-import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -13,14 +12,19 @@ import com.ydtech.constants.enums.dict.DictionaryData;
 import com.ydtech.constants.enums.dict.DictionaryManagement;
 import com.ydtech.core.page.HttpResult;
 import com.ydtech.exception.SystemException;
+import com.ydtech.modules.admin.service.SysSwitchConfigService;
 import com.ydtech.modules.base.controller.BaseController;
 import com.ydtech.modules.esm.model.EsmInsCompany;
 import com.ydtech.modules.esm.service.EsmInsCompanyService;
 import com.ydtech.modules.order.service.InsCrawlerOrderService;
 import com.ydtech.modules.protocol.constants.HistoryStatusConstants;
+import com.ydtech.modules.protocol.dao.PtlAgreementGroupLinkDeptMapper;
 import com.ydtech.modules.protocol.dao.PtlAgreementMapper;
 import com.ydtech.modules.protocol.entity.constants.PtlApiType;
-import com.ydtech.modules.protocol.entity.dto.*;
+import com.ydtech.modules.protocol.entity.dto.PtlAgreementAttributionDto;
+import com.ydtech.modules.protocol.entity.dto.PtlAgreementDto;
+import com.ydtech.modules.protocol.entity.dto.PtlAgreementInsCompanyDto;
+import com.ydtech.modules.protocol.entity.dto.PtlAgreementSaveDto;
 import com.ydtech.modules.protocol.entity.dto.history.PtlAgreementUndwrtRulesHistory;
 import com.ydtech.modules.protocol.entity.po.*;
 import com.ydtech.modules.protocol.entity.vo.*;
@@ -93,6 +97,12 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
     @Value("${python.check}")
     private String pythonCheck;
 
+    @Autowired
+    private PtlAgreementGroupLinkDeptMapper ptlAgreementGroupLinkDeptMapper;
+
+    @Autowired
+    private SysSwitchConfigService sysSwitchConfigService;
+
 
     public PtlAgreementServiceImpl(PtlAgreementProductCostsService ptlAgreementProductCostsService,
                                    PtlAgreementAttributionService ptlAgreementAttributionService,
@@ -128,8 +138,19 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
     @Override
     public List<PtlAgreementInsCompanyDto> getAgreementCompany(String deptId) {
         LocalDate localDate = LocalDate.now();
-        List<PtlAgreementInsCompanyDto> agreementCompany = baseMapper.getAgreementCompany(localDate, deptId);
-
+        //add by  hxl  2024-10-25   注释掉从 协议调度授权部门的协议逻辑  ==================begin==================
+        boolean flag = sysSwitchConfigService.xysqDisplaySwitches();
+        List<PtlAgreementInsCompanyDto> agreementCompany =new ArrayList<>();
+        if(flag){
+            //新逻辑从协议组授权获取
+            if(StringUtils.isNotBlank(deptId)){
+                agreementCompany =ptlAgreementGroupLinkDeptMapper.getAgreementCompany(localDate, deptId);
+            }
+        }else{
+            //原先逻辑
+            agreementCompany = baseMapper.getAgreementCompany(localDate, deptId);
+        }
+        //==================================================================== end==================
         for (PtlAgreementInsCompanyDto ptlAgreementInsCompanyDto : agreementCompany) {
             List<PtlAgreementDto> agreement = ptlAgreementInsCompanyDto.getAgreement();
             for (PtlAgreementDto ptlAgreementDto : agreement) {

+ 1 - 0
src/main/java/com/ydtech/modules/protocol/service/impl/PtlTaxSourceServiceImpl.java

@@ -530,6 +530,7 @@ public class PtlTaxSourceServiceImpl extends ServiceImpl<PtlTaxSourceNewMapper,
         //通过公司id按优先级排序获取协议规则
         List<PtlTaxSourceNew> prioritySortList = baseMapper.selectList(new LambdaQueryWrapper<PtlTaxSourceNew>()
                 .eq(PtlTaxSourceNew::getInsCompanyId,companyId)
+                .eq(PtlTaxSourceNew::getDefaultFlag,"0")
                 .orderByAsc(PtlTaxSourceNew::getPriority));
         boolean isExclude = true;
         //排除的部门信息

+ 11 - 9
src/main/java/com/ydtech/modules/protocol/service/impl/TaxSourceServiceImpl.java

@@ -2,13 +2,13 @@ package com.ydtech.modules.protocol.service.impl;
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.ydtech.constants.sys.SystemConstant;
 import com.ydtech.modules.admin.constants.RoleConstants;
 import com.ydtech.modules.admin.model.SysUser;
 import com.ydtech.modules.admin.model.SysUserRole;
+import com.ydtech.modules.admin.service.SysSwitchConfigService;
 import com.ydtech.modules.admin.service.SysUserRoleService;
 import com.ydtech.modules.admin.service.SysUserService;
 import com.ydtech.modules.esm.model.EsmInsCompany;
@@ -29,7 +29,6 @@ import com.ydtech.modules.protocol.service.ITaxSourceExcludeService;
 import com.ydtech.modules.protocol.service.ITaxSourceService;
 import com.ydtech.modules.protocol.service.PtlAgreementService;
 import com.ydtech.modules.protocol.utils.AssertionUtils;
-import com.ydtech.modules.protocols.entity.po.PtlAgreementProductCostsNew;
 import com.ydtech.utils.idgen.IdGenerate;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -65,7 +64,8 @@ public class TaxSourceServiceImpl extends ServiceImpl<TaxSourceMapper, TaxSource
     @Autowired
     private PtlTaxSourceNewMapper ptlTaxSourceNewMapper;
 
-
+    @Autowired
+    private SysSwitchConfigService sysSwitchConfigService;
 
 
     @Override
@@ -198,13 +198,15 @@ public class TaxSourceServiceImpl extends ServiceImpl<TaxSourceMapper, TaxSource
     }
 
     public List<PtlAgreementInsCompanyDto> getAgreementInsCompany(String deptId, String userId) {
-        // 领导标志
-        SysUserRole userRole = sysUserRoleService.selectByUserId(userId);
-
-        if (userRole!=null && Arrays.asList(SystemConstant.getSysRoleTeamLeader()).contains(userRole.getRoleId().toString()) && !RoleConstants.R21.getCode().equals(userRole.getRoleId().toString())) { //团队长可查询下面所有人员订单
-            deptId = null;
+        boolean flag = sysSwitchConfigService.xysqDisplaySwitches();
+        if(!flag){
+            //原先逻辑
+            // 领导标志
+            SysUserRole userRole = sysUserRoleService.selectByUserId(userId);
+            if (userRole!=null && Arrays.asList(SystemConstant.getSysRoleTeamLeader()).contains(userRole.getRoleId().toString()) && !RoleConstants.R21.getCode().equals(userRole.getRoleId().toString())) { //团队长可查询下面所有人员订单
+                deptId = null;
+            }
         }
-
         List<PtlAgreementInsCompanyDto> agreementCompany = ptlAgreementService.getAgreementCompany(deptId);
         return agreementCompany;
     }

+ 108 - 0
src/main/resources/mapper/modules/protocol/PtlAgreementGroupLinkAgreementMapper.xml

@@ -0,0 +1,108 @@
+<?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.ydtech.modules.protocol.dao.PtlAgreementGroupLinkAgreementMapper">
+
+    <resultMap id="BaseResultMap" type="com.ydtech.modules.protocol.entity.po.PtlAgreementGroupLinkAgreement">
+            <id property="id" column="id" jdbcType="BIGINT"/>
+            <result property="ptlAgreementId" column="ptl_agreement_id" jdbcType="BIGINT"/>
+            <result property="ptlAgreementGroupId" column="ptl_agreement_group_id" jdbcType="BIGINT"/>
+            <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
+            <result property="createUser" column="create_user" jdbcType="VARCHAR"/>
+    </resultMap>
+
+    <sql id="Base_Column_List">
+        id,ptl_agreement_id,ptl_agreement_group_id,
+        create_time,create_user
+    </sql>
+    <select id="queryPage"
+            resultType="com.ydtech.modules.protocol.entity.dto.PtlAgreementGroupLinkAgreementDto">
+        SELECT
+            agreement.id AS agreementId,
+            CONCAT(IFNULL(agreement.agreement_abbreviation, '' ) ,'-',IFNULL( agreement.business_description, '' ),'-' ,IFNULL( agreement.job_description, '' ))
+            AS agreementName,
+            eic.namesimple AS companyName,
+            agreement.insurance_company_id AS companyId
+        FROM
+            ptl_agreement agreement
+            LEFT JOIN esm_ins_company eic ON agreement.insurance_company_id = eic.id
+        WHERE
+            agreement.valid_status = 1
+            AND agreement.is_external = 0
+            AND date(
+            now()) BETWEEN date( agreement.start_date )
+            AND date( agreement.end_date )
+            <if test="vo.companyId != null and vo.companyId != ''">
+                AND agreement.insurance_company_id = #{vo.companyId}
+            </if>
+            <if test="vo.defaultFlag != null and vo.defaultFlag != ''">
+                AND agreement.id not in (
+                SELECT
+                link.ptl_agreement_id
+                FROM
+                ptl_agreement_group_link_agreement link
+                LEFT JOIN ptl_agreement_group pg ON link.ptl_agreement_group_id = pg.id
+                WHERE
+                <choose>
+                    <when test="vo.defaultFlag == 0">
+                        ( pg.default_flag =1 OR link.ptl_agreement_group_id =#{vo.agreementGroupId})
+                    </when>
+                    <otherwise>
+                          link.ptl_agreement_group_id =#{vo.agreementGroupId}
+                    </otherwise>
+                </choose>
+                )
+          </if>
+    </select>
+    <select id="findByGroupId" resultType="java.lang.Long">
+       select
+           ptl_agreement_id
+       from
+        ptl_agreement_group_link_agreement
+        where   ptl_agreement_group_id = #{agreementGroupId}
+    </select>
+    <select id="findLinkAgreementList"
+            resultType="com.ydtech.modules.protocol.entity.dto.PtlAgreementGroupLinkAgreementDto">
+        SELECT
+            agreement.id AS agreementId,
+              CONCAT(IFNULL(agreement.agreement_abbreviation, '' ) ,'-',IFNULL( agreement.business_description, '' ),'-' ,IFNULL( agreement.job_description, '' ))
+             AS agreementName,
+            eic.namesimple AS companyName,
+            agreement.insurance_company_id AS companyId,
+            pagla.id AS id,
+            CASE
+                agreement.valid_status
+                WHEN '1' THEN
+                    '启用' ELSE '禁用'
+                END AS disableFlag,
+            CASE
+                date(
+                now()) BETWEEN date( agreement.start_date )
+                AND date( agreement.end_date )
+                WHEN TRUE THEN
+                '有效' ELSE '无效'
+                END AS effectiveFlag
+            FROM
+                ptl_agreement_group_link_agreement pagla
+                LEFT JOIN ptl_agreement agreement ON pagla.ptl_agreement_id = agreement.id
+                LEFT JOIN esm_ins_company eic ON agreement.insurance_company_id = eic.id
+                where
+                    pagla.ptl_agreement_group_id =#{vo.agreementGroupId}
+                <if test="vo.companyId != null and vo.companyId != ''">
+                    AND agreement.insurance_company_id = #{vo.companyId}
+                </if>
+    </select>
+    <select id="findByIds" resultType="com.ydtech.modules.protocol.entity.po.PtlAgreementGroupLinkAgreement">
+        select
+            <include refid="Base_Column_List"/>
+        from
+            ptl_agreement_group_link_agreement
+       <where>
+            id IN
+           <foreach item="item" index="index" collection="ids" open="(" separator="," close=")">
+               #{item}
+           </foreach>
+       </where>
+    </select>
+</mapper>

+ 20 - 0
src/main/resources/mapper/modules/protocol/PtlAgreementGroupLinkAgreementRecordMapper.xml

@@ -0,0 +1,20 @@
+<?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.ydtech.modules.protocol.dao.PtlAgreementGroupLinkAgreementRecordMapper">
+
+    <resultMap id="BaseResultMap" type="com.ydtech.modules.protocol.entity.po.PtlAgreementGroupLinkAgreementRecord">
+            <id property="id" column="id" jdbcType="BIGINT"/>
+            <result property="ptlAgreementId" column="ptl_agreement_id" jdbcType="BIGINT"/>
+            <result property="ptlAgreementGroupId" column="ptl_agreement_group_id" jdbcType="BIGINT"/>
+            <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
+            <result property="createUser" column="create_user" jdbcType="VARCHAR"/>
+            <result property="batch" column="batch" jdbcType="VARCHAR"/>
+    </resultMap>
+
+    <sql id="Base_Column_List">
+        id,ptl_agreement_id,ptl_agreement_group_id,
+        create_time,create_user,batch
+    </sql>
+</mapper>

+ 97 - 0
src/main/resources/mapper/modules/protocol/PtlAgreementGroupLinkDeptMapper.xml

@@ -0,0 +1,97 @@
+<?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.ydtech.modules.protocol.dao.PtlAgreementGroupLinkDeptMapper">
+
+    <resultMap id="BaseResultMap" type="com.ydtech.modules.protocol.entity.po.PtlAgreementGroupLinkDept">
+            <id property="id" column="id" jdbcType="BIGINT"/>
+            <result property="ptlAgreementGroupId" column="ptl_agreement_group_id" jdbcType="BIGINT"/>
+            <result property="deptId" column="dept_id" jdbcType="VARCHAR"/>
+            <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
+            <result property="createUser" column="create_user" jdbcType="VARCHAR"/>
+    </resultMap>
+
+    <resultMap id="AgreementCompanyResultMap" type="com.ydtech.modules.protocol.entity.dto.PtlAgreementInsCompanyDto">
+        <id property="id" column="id" jdbcType="VARCHAR"/>
+        <result property="name" column="name" jdbcType="VARCHAR"/>
+        <result property="parentId" column="parent_id" jdbcType="VARCHAR"/>
+        <result property="namesimple" column="namesimple" jdbcType="VARCHAR"/>
+        <result property="remark" column="remark" jdbcType="VARCHAR"/>
+        <result property="orderNum" column="order_num" jdbcType="INTEGER"/>
+        <result property="createBy" column="create_by" jdbcType="VARCHAR"/>
+        <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
+        <result property="lastUpdateBy" column="last_update_by" jdbcType="VARCHAR"/>
+        <result property="lastUpdateTime" column="last_update_time" jdbcType="TIMESTAMP"/>
+        <result property="cnName" column="cn_name" jdbcType="VARCHAR"/>
+        <result property="logo" column="logo" jdbcType="VARCHAR"/>
+        <collection property="agreement" ofType="com.ydtech.modules.protocol.entity.dto.PtlAgreementDto">
+            <id property="id" column="agreement_id"/>
+            <result property="agreementName" column="agreement_name"/>
+            <result property="underwritingDescription" column="underwriting_description"/>
+            <result property="businessDescription" column="business_description"/>
+            <result property="jobDescription" column="job_description"/>
+            <result property="apiType" column="api_type"/>
+            <result property="productsCode" column="products_code"/>
+        </collection>
+
+    </resultMap>
+    <sql id="Base_Column_List">
+        id,ptl_agreement_group_id,dept_id,
+        create_time,create_user
+    </sql>
+
+    <select id="getAgreementCompany" resultMap="AgreementCompanyResultMap">
+        select eic.*, pa.id as agreement_id, pa.agreement_name, pa.products_code, paa.api_type, pa.underwriting_description,
+        pa.business_description,pa.job_description
+        from esm_ins_company as eic
+        left join ptl_agreement as pa on pa.insurance_company_id = eic.id
+        left join ptl_agreement_attribution as paa on paa.id = pa.id
+        where (#{localDate} between start_date and DATE_SUB(end_date, INTERVAL 1 DAY))
+        and (paa.template_id is not null)
+        and pa.valid_status = 1
+        and pa.id in (
+            SELECT
+                pagla.ptl_agreement_id
+            FROM
+                ptl_agreement_group_link_agreement  pagla
+                LEFT JOIN ptl_agreement_group  pag    on  pagla.ptl_agreement_group_id = pag.id
+            where pag.default_flag=1
+            UNION
+            SELECT
+                pagla.ptl_agreement_id
+            FROM
+                ptl_agreement_group_link_dept pagld
+                    LEFT JOIN ptl_agreement_group_link_agreement pagla ON pagld.ptl_agreement_group_id = pagla.ptl_agreement_group_id
+                    LEFT JOIN ptl_agreement pa ON pagla.ptl_agreement_id = pa.id
+                    LEFT JOIN ptl_agreement_group  pag    on  pagla.ptl_agreement_group_id = pag.id
+            where
+                pag.default_flag=0
+                and pagld.dept_id = #{deptId}
+        )
+        order by eic.order_num IS NULL, eic.order_num ASC
+    </select>
+    <select id="getAgreementByDeptId" resultType="java.lang.String">
+        select * from (
+         SELECT
+            pagla.ptl_agreement_id
+        FROM
+            ptl_agreement_group_link_agreement  pagla
+                LEFT JOIN ptl_agreement_group  pag    on  pagla.ptl_agreement_group_id = pag.id
+        where pag.default_flag=1
+        UNION
+        SELECT
+            pagla.ptl_agreement_id
+        FROM
+            ptl_agreement_group_link_dept pagld
+                LEFT JOIN ptl_agreement_group_link_agreement pagla ON pagld.ptl_agreement_group_id = pagla.ptl_agreement_group_id
+                LEFT JOIN ptl_agreement pa ON pagla.ptl_agreement_id = pa.id
+                LEFT JOIN ptl_agreement_group  pag    on  pagla.ptl_agreement_group_id = pag.id
+        where
+            pag.default_flag=0
+          and pagld.dept_id = #{deptId}
+        )  a
+        where  a.ptl_agreement_id =#{agreementId}
+    </select>
+
+</mapper>

+ 20 - 0
src/main/resources/mapper/modules/protocol/PtlAgreementGroupLinkDeptRecordMapper.xml

@@ -0,0 +1,20 @@
+<?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.ydtech.modules.protocol.dao.PtlAgreementGroupLinkDeptRecordMapper">
+
+    <resultMap id="BaseResultMap" type="com.ydtech.modules.protocol.entity.po.PtlAgreementGroupLinkDeptRecord">
+            <id property="id" column="id" jdbcType="BIGINT"/>
+            <result property="ptlAgreementGroupId" column="ptl_agreement_group_id" jdbcType="BIGINT"/>
+            <result property="deptId" column="dept_id" jdbcType="VARCHAR"/>
+            <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
+            <result property="createUser" column="create_user" jdbcType="VARCHAR"/>
+            <result property="batch" column="batch" jdbcType="VARCHAR"/>
+    </resultMap>
+
+    <sql id="Base_Column_List">
+        id,ptl_agreement_group_id,dept_id,
+        create_time,create_user,batch
+    </sql>
+</mapper>

+ 40 - 0
src/main/resources/mapper/modules/protocol/PtlAgreementGroupMapper.xml

@@ -0,0 +1,40 @@
+<?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.ydtech.modules.protocol.dao.PtlAgreementGroupMapper">
+
+    <resultMap id="BaseResultMap" type="com.ydtech.modules.protocol.entity.po.PtlAgreementGroups">
+            <id property="id" column="id" jdbcType="BIGINT"/>
+            <result property="agreementGroupName" column="agreement_group_name" jdbcType="VARCHAR"/>
+            <result property="description" column="description" jdbcType="VARCHAR"/>
+            <result property="defaultFlag" column="default_flag" jdbcType="TINYINT"/>
+            <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
+            <result property="createUser" column="create_user" jdbcType="VARCHAR"/>
+            <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
+            <result property="updateUser" column="update_user" jdbcType="VARCHAR"/>
+            <result property="delFlag" column="del_flag" jdbcType="TINYINT"/>
+    </resultMap>
+
+    <sql id="Base_Column_List">
+        id,agreement_group_name,description,
+        default_flag,create_time,create_user,
+        update_time,update_user,del_flag
+    </sql>
+    <select id="queryPage" resultType="com.ydtech.modules.protocol.entity.dto.PtlAgreementGroupDto">
+       select
+        <include refid="Base_Column_List"/>
+       from
+         ptl_agreement_group gr
+        <where>
+            gr.del_flag =0
+        <if test="vo.agreementGroupName != null and vo.agreementGroupName != ''">
+            AND gr.agreement_group_name = #{vo.agreementGroupName}
+        </if>
+        <if test="vo.defaultFlag != null and vo.defaultFlag != ''">
+            AND gr.default_flag = #{vo.defaultFlag}
+        </if>
+       </where>
+           order by create_time
+    </select>
+</mapper>