Sfoglia il codice sorgente

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

Qchen 2 anni fa
parent
commit
0d976c33db
30 ha cambiato i file con 1091 aggiunte e 36 eliminazioni
  1. 47 0
      src/main/java/com/ydtech/modules/admin/controller/AgreeReportConroller.java
  2. 21 2
      src/main/java/com/ydtech/modules/admin/controller/SysUserLinkDeptInternalAgentController.java
  3. 7 8
      src/main/java/com/ydtech/modules/admin/dao/SysUserLinkDeptInternalAgentMapper.java
  4. 50 0
      src/main/java/com/ydtech/modules/admin/model/dto/AgreeReportQueryDto.java
  5. 3 0
      src/main/java/com/ydtech/modules/admin/model/dto/SysUserDto.java
  6. 80 0
      src/main/java/com/ydtech/modules/admin/model/report/user/agree/AgreeReportDto.java
  7. 3 2
      src/main/java/com/ydtech/modules/admin/model/vo/SysUserLinkDeptInternalAgentQueryVo.java
  8. 26 0
      src/main/java/com/ydtech/modules/admin/service/AgreeReportService.java
  9. 11 2
      src/main/java/com/ydtech/modules/admin/service/SysUserLinkDeptInternalAgentService.java
  10. 9 4
      src/main/java/com/ydtech/modules/admin/service/SysUserLinkFrontLineDeptService.java
  11. 42 0
      src/main/java/com/ydtech/modules/admin/service/impl/AgreeReportServiceImpl.java
  12. 3 3
      src/main/java/com/ydtech/modules/admin/service/impl/SysUserBankCardServiceImpl.java
  13. 21 7
      src/main/java/com/ydtech/modules/admin/service/impl/SysUserLinkDeptInternalAgentServiceImpl.java
  14. 7 4
      src/main/java/com/ydtech/modules/admin/service/impl/SysUserLinkFrontLineDeptServiceImpl.java
  15. 22 0
      src/main/java/com/ydtech/modules/fnc/controller/InsPlyIncomeController.java
  16. 16 0
      src/main/java/com/ydtech/modules/fnc/dao/InsPlyIncomeMapper.java
  17. 2 0
      src/main/java/com/ydtech/modules/fnc/dao/SettlementDocumentaryFeesMapper.java
  18. 33 0
      src/main/java/com/ydtech/modules/fnc/dto/SumAllAmountSettlementDto.java
  19. 7 0
      src/main/java/com/ydtech/modules/fnc/service/InsPlyIncomeService.java
  20. 7 0
      src/main/java/com/ydtech/modules/fnc/service/SettlementDocumentaryFeesService.java
  21. 1 1
      src/main/java/com/ydtech/modules/fnc/service/impl/InsFeeAuditServiceImpl.java
  22. 117 1
      src/main/java/com/ydtech/modules/fnc/service/impl/InsPlyIncomeServiceImpl.java
  23. 10 0
      src/main/java/com/ydtech/modules/fnc/service/impl/SettlementDocumentaryFeesServiceImpl.java
  24. 5 0
      src/main/java/com/ydtech/modules/ins/model/vo/res/SettlementFeesExcel.java
  25. 10 0
      src/main/java/com/ydtech/modules/protocol/dao/PtlAgreementMapper.java
  26. 38 1
      src/main/resources/mapper/modules/admin/SysUserLinkDeptInternalAgentMapper.xml
  27. 395 1
      src/main/resources/mapper/modules/fnc/InsPlyIncomeMapper.xml
  28. 37 0
      src/main/resources/mapper/modules/fnc/SettlementDocumentaryFeesMapper.xml
  29. 1 0
      src/main/resources/mapper/modules/order/InsOrdersMapper.xml
  30. 60 0
      src/main/resources/mapper/modules/protocol/PtlAgreementMapper.xml

+ 47 - 0
src/main/java/com/ydtech/modules/admin/controller/AgreeReportConroller.java

@@ -0,0 +1,47 @@
+package com.ydtech.modules.admin.controller;
+
+import com.ydtech.core.page.HttpResult;
+import com.ydtech.modules.admin.model.dto.AgreeReportQueryDto;
+import com.ydtech.modules.admin.model.report.user.agree.AgreeReportDto;
+import com.ydtech.modules.admin.service.AgreeReportService;
+import com.ydtech.modules.order.entity.BasePageResult;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ *  @version
+ *  @author: hxl
+ *  @Date: 2024/6/28 8:36
+ *  @Description:  控制台战略合作单位统计
+ */
+@Api(tags = "控制台战略合作单位统计")
+@RequestMapping("/agreeReport")
+@RestController
+public class AgreeReportConroller {
+
+    @Autowired
+    private AgreeReportService agreeReportService;
+
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/6/28 8:36
+     *  @Description:  查询后线人员的机构
+     */
+    @PostMapping("queryPage")
+    @ApiOperation(value = "查询后线人员的机构")
+    public HttpResult<BasePageResult<AgreeReportDto>> queryPage(@RequestBody AgreeReportQueryDto agreeReportQueryDto) {
+
+        try{
+            BasePageResult<AgreeReportDto> result = agreeReportService.queryPage(agreeReportQueryDto);
+            return HttpResult.ok("查询数据成功", result);
+        }catch (Exception e){
+            return HttpResult.error("查询错误"+e.getMessage());
+        }
+    }
+}

+ 21 - 2
src/main/java/com/ydtech/modules/admin/controller/SysUserLinkDeptInternalAgentController.java

@@ -2,11 +2,13 @@ package com.ydtech.modules.admin.controller;
 
 
 import com.ydtech.core.page.HttpResult;
+import com.ydtech.modules.admin.model.dto.SysUserDto;
 import com.ydtech.modules.admin.model.dto.SysUserLinkDeptInternalAgentDto;
 import com.ydtech.modules.admin.model.po.SysDeptInternalAgent;
-import com.ydtech.modules.admin.model.vo.SysDeptInternalAgentQueryVo;
+import com.ydtech.modules.admin.model.vo.SysUserBaseVO;
 import com.ydtech.modules.admin.model.vo.SysUserLinkDeptInternalAgentAddVo;
 import com.ydtech.modules.admin.model.vo.SysUserLinkDeptInternalAgentIdsVo;
+import com.ydtech.modules.admin.model.vo.SysUserLinkDeptInternalAgentQueryVo;
 import com.ydtech.modules.admin.service.SysUserLinkDeptInternalAgentService;
 import com.ydtech.modules.base.controller.BaseController;
 import com.ydtech.modules.order.entity.BasePageResult;
@@ -83,7 +85,7 @@ public class SysUserLinkDeptInternalAgentController extends BaseController {
      */
     @PostMapping("queryPage")
     @ApiOperation("查询后线人员配置内部机构列表+分页")
-    public HttpResult<BasePageResult<SysUserLinkDeptInternalAgentDto>> queryPage(@RequestBody SysDeptInternalAgentQueryVo sysDeptInternalAgentQueryVo) {
+    public HttpResult<BasePageResult<SysUserLinkDeptInternalAgentDto>> queryPage(@RequestBody SysUserLinkDeptInternalAgentQueryVo sysDeptInternalAgentQueryVo) {
         try{
             BasePageResult<SysUserLinkDeptInternalAgentDto> result = sysUserLinkDeptInternalAgentService.queryPage(sysDeptInternalAgentQueryVo);
             return HttpResult.ok("查询数据成功", result);
@@ -91,4 +93,21 @@ public class SysUserLinkDeptInternalAgentController extends BaseController {
             return HttpResult.error("查询错误"+e.getMessage());
         }
     }
+
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/4/26 17:44
+     *  @Description: 查询所有的后线人员列表+分页
+     */
+    @PostMapping("findAllUserList")
+    @ApiOperation("查询所有的后线人员列表+分页+标红显示")
+    public HttpResult<BasePageResult<SysUserBaseVO>> findUserList(@RequestBody SysUserDto sysUserDto) {
+        try{
+            BasePageResult<SysUserBaseVO> result = sysUserLinkDeptInternalAgentService.findUserListByPage(sysUserDto);
+            return HttpResult.ok("查询数据成功", result);
+        }catch (Exception e){
+            return HttpResult.error("查询错误"+e.getMessage());
+        }
+    }
 }

+ 7 - 8
src/main/java/com/ydtech/modules/admin/dao/SysUserLinkDeptInternalAgentMapper.java

@@ -2,15 +2,14 @@ package com.ydtech.modules.admin.dao;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ydtech.modules.admin.model.dto.SysUserDto;
 import com.ydtech.modules.admin.model.dto.SysUserLinkDeptInternalAgentDto;
 import com.ydtech.modules.admin.model.dto.SysUserLinkPtlAgreementDto;
-import com.ydtech.modules.admin.model.po.SysDeptInternalAgent;
 import com.ydtech.modules.admin.model.po.SysUserLinkDeptInternalAgent;
-import com.ydtech.modules.admin.model.vo.SysDeptInternalAgentQueryVo;
+import com.ydtech.modules.admin.model.vo.SysUserBaseVO;
+import com.ydtech.modules.admin.model.vo.SysUserLinkDeptInternalAgentQueryVo;
 import org.apache.ibatis.annotations.Param;
 
-import java.util.List;
-
 /**
 * @author Administrator
 * @description 针对表【sys_user_link_dept_internal_agent(后线人员配置内部机构表)】的数据库操作Mapper
@@ -24,7 +23,7 @@ public interface SysUserLinkDeptInternalAgentMapper extends BaseMapper<SysUserLi
      *  @Date: 2024/6/26 19:10
      *  @Description: 查询分页数据
      */
-    Page<SysUserLinkDeptInternalAgentDto> queryPage(@Param("page") Page<SysUserLinkPtlAgreementDto> page,@Param("vo")  SysDeptInternalAgentQueryVo sysDeptInternalAgentQueryVo);
+    Page<SysUserLinkDeptInternalAgentDto> queryPage(@Param("page") Page<SysUserLinkPtlAgreementDto> page,@Param("vo") SysUserLinkDeptInternalAgentQueryVo sysUserLinkDeptInternalAgentQueryVo);
 
 
     /**
@@ -37,10 +36,10 @@ public interface SysUserLinkDeptInternalAgentMapper extends BaseMapper<SysUserLi
     /**
      *  @version
      *  @author: hxl
-     *  @Date: 2024/6/27 11:21
-     *  @Description: 查询用户
+     *  @Date: 2024/6/28 14:46
+     *  @Description: 查询后线人员+回显
      */
-    List<SysDeptInternalAgent> findDeptListByUserId(String userId);
+    Page<SysUserBaseVO> findUserListByDeptPage(@Param("page") Page<SysUserBaseVO> page, @Param("user") SysUserDto sysUserDto);
 }
 
 

+ 50 - 0
src/main/java/com/ydtech/modules/admin/model/dto/AgreeReportQueryDto.java

@@ -0,0 +1,50 @@
+package com.ydtech.modules.admin.model.dto;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ *  @version
+ *  @author: hxl
+ *  @Date: 2024/6/28 11:07
+ *  @Description:
+ */
+@Data
+@ApiModel("战略合作单位查询对象")
+public class AgreeReportQueryDto {
+
+    /***
+     *  部门id  按权限统计
+     */
+    @ApiModelProperty(value = "部门id")
+    private  String  deptId;
+    /***
+     *  预警天数  1. 30   2. 60
+     */
+    @ApiModelProperty(value = "预警天数   1. 提前30   2. 提前30")
+    private  String  warningDay;
+
+    /***
+     *  预警状态   1. 临近到期  2 正常
+     */
+    @ApiModelProperty(value = "预警状态   1. 临近到期  2 正常")
+    private  String warningStatus;
+
+    /***
+     * 合作公司id
+     */
+    @ApiModelProperty("合作公司id")
+    private String partnerCompaniesId;
+
+    @ApiModelProperty("地区")
+    private String areaId;
+
+    @ApiModelProperty(value = "每页页数")
+    private int pageSize;
+
+    @ApiModelProperty(value = "页数")
+    private int pageNum;
+
+
+}

+ 3 - 0
src/main/java/com/ydtech/modules/admin/model/dto/SysUserDto.java

@@ -43,4 +43,7 @@ public class SysUserDto extends PageRequest {
     private int pageNum;
 
     private int pageSize;
+
+    @ApiModelProperty("内部机构id")
+    private String  deptNBId;
 }

+ 80 - 0
src/main/java/com/ydtech/modules/admin/model/report/user/agree/AgreeReportDto.java

@@ -0,0 +1,80 @@
+package com.ydtech.modules.admin.model.report.user.agree;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ *  @version
+ *  @author: hxl
+ *  @Date: 2024/6/28 9:14
+ *  @Description: 战略合作单位统计数据
+ */
+@Data
+@ApiModel("战略合作单位统计数据")
+public class AgreeReportDto {
+
+    /***
+     * 部门id
+     */
+    @ApiModelProperty("部门id")
+    private String deptId;
+
+    /***
+     * 合作公司id
+     */
+    @ApiModelProperty("保险公司id")
+    private String companyId;
+    /***
+     * 合作公司名称
+     */
+    @ApiModelProperty("保险公司名称")
+    private String companyName;
+
+    /***
+     * 协议Id
+     */
+    @ApiModelProperty(value = "协议Id")
+    private String agreeId;
+
+    /***
+     * 协议名称
+     */
+    @ApiModelProperty(value = "协议名称")
+    private String agreeName;
+
+    /***
+     * 协议简称
+     */
+    @ApiModelProperty(value = "协议简称")
+    private String agreeSimpleName;
+    /***
+     * 合作公司id
+     */
+    @ApiModelProperty("合作公司id")
+    private String partnerCompaniesId;
+    /***
+     * 合作公司名称
+     */
+    @ApiModelProperty("合作公司名称")
+    private String partnerCompaniesName;
+
+    /***
+     * 地区分布
+     */
+    @ApiModelProperty(value = "地区分布")
+    private String areaName;
+    /***
+     * 协议开始日期
+     */
+    @ApiModelProperty(value = "协议开始日期")
+    private String agreeStartDate;
+    /***
+     * 协议结束日期
+     */
+    @ApiModelProperty(value = "协议结束日期")
+    private String agreeEndDate;
+
+    @ApiModelProperty(value = "临期天数")
+    private String dayStr;
+}

+ 3 - 2
src/main/java/com/ydtech/modules/admin/model/vo/SysUserLinkDeptInternalAgentQueryVo.java

@@ -1,5 +1,6 @@
 package com.ydtech.modules.admin.model.vo;
 
+import com.ydtech.core.page.BasePageVO;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
@@ -12,9 +13,9 @@ import lombok.Data;
  */
 @Data
 @ApiModel("后线人员配置内部机构的查询vo")
-public class SysUserLinkDeptInternalAgentQueryVo {
+public class SysUserLinkDeptInternalAgentQueryVo extends BasePageVO {
 
-    @ApiModelProperty("内部机构id")
+    @ApiModelProperty("后线机构id")
     private String deptId;
 
     @ApiModelProperty("后线人员名称")

+ 26 - 0
src/main/java/com/ydtech/modules/admin/service/AgreeReportService.java

@@ -0,0 +1,26 @@
+package com.ydtech.modules.admin.service;
+
+
+import com.ydtech.modules.admin.model.dto.AgreeReportQueryDto;
+import com.ydtech.modules.admin.model.report.user.agree.AgreeReportDto;
+import com.ydtech.modules.order.entity.BasePageResult;
+
+/**
+ *  @version
+ *  @author: hxl
+ *  @Date: 2024/6/28 9:24
+ *  @Description:  战略合作单位统计的service
+ */
+public interface AgreeReportService {
+
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/6/28 11:14
+     *  @Description:  查询战略合作单位统计
+     */
+    BasePageResult<AgreeReportDto> queryPage(AgreeReportQueryDto agreeReportQueryDto);
+}
+
+
+

+ 11 - 2
src/main/java/com/ydtech/modules/admin/service/SysUserLinkDeptInternalAgentService.java

@@ -1,11 +1,13 @@
 package com.ydtech.modules.admin.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.ydtech.modules.admin.model.dto.SysUserDto;
 import com.ydtech.modules.admin.model.dto.SysUserLinkDeptInternalAgentDto;
 import com.ydtech.modules.admin.model.po.SysDeptInternalAgent;
 import com.ydtech.modules.admin.model.po.SysUserLinkDeptInternalAgent;
-import com.ydtech.modules.admin.model.vo.SysDeptInternalAgentQueryVo;
+import com.ydtech.modules.admin.model.vo.SysUserBaseVO;
 import com.ydtech.modules.admin.model.vo.SysUserLinkDeptInternalAgentAddVo;
+import com.ydtech.modules.admin.model.vo.SysUserLinkDeptInternalAgentQueryVo;
 import com.ydtech.modules.order.entity.BasePageResult;
 
 import java.util.List;
@@ -43,7 +45,7 @@ public interface SysUserLinkDeptInternalAgentService extends IService<SysUserLin
      *  @Date: 2024/6/26 18:43
      *  @Description:  分页接口
      */
-    BasePageResult<SysUserLinkDeptInternalAgentDto> queryPage(SysDeptInternalAgentQueryVo sysDeptInternalAgentQueryVo);
+    BasePageResult<SysUserLinkDeptInternalAgentDto> queryPage(SysUserLinkDeptInternalAgentQueryVo sysUserLinkDeptInternalAgentQueryVo);
 
     /**
      * 根据userid获取对象
@@ -51,4 +53,11 @@ public interface SysUserLinkDeptInternalAgentService extends IService<SysUserLin
      * @return
      */
     SysUserLinkDeptInternalAgent getByUserId(String userId);
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/6/28 14:45
+     *  @Description: 查询后线人员以及回显数据
+     */
+    BasePageResult<SysUserBaseVO> findUserListByPage(SysUserDto sysUserDto);
 }

+ 9 - 4
src/main/java/com/ydtech/modules/admin/service/SysUserLinkFrontLineDeptService.java

@@ -3,12 +3,10 @@ package com.ydtech.modules.admin.service;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.ydtech.modules.admin.model.SysDept;
 import com.ydtech.modules.admin.model.dto.SysUserDto;
+import com.ydtech.modules.admin.model.dto.SysUserLinkDeptInternalAgentDto;
 import com.ydtech.modules.admin.model.dto.SysUserLinkFrontLineDeptDto;
 import com.ydtech.modules.admin.model.po.SysUserLinkFrontLineDept;
-import com.ydtech.modules.admin.model.vo.SysAreaVo;
-import com.ydtech.modules.admin.model.vo.SysUserBaseVO;
-import com.ydtech.modules.admin.model.vo.SysUserLinkFrontLineDeptAddVo;
-import com.ydtech.modules.admin.model.vo.SysUserLinkFrontLineDeptQueryVo;
+import com.ydtech.modules.admin.model.vo.*;
 import com.ydtech.modules.order.entity.BasePageResult;
 
 import java.util.List;
@@ -62,4 +60,11 @@ public interface SysUserLinkFrontLineDeptService extends IService<SysUserLinkFro
      *  @Description: 查询后线人员加标红
      */
     BasePageResult<SysUserBaseVO> findUserListByPage(SysUserDto sysUserDto);
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/6/28 14:41
+     *  @Description:  通过部门id查询绑定的用户
+     */
+    BasePageResult<SysUserLinkDeptInternalAgentDto> queryUserPage(SysUserLinkDeptInternalAgentQueryVo sysUserLinkDeptInternalAgentQueryVo);
 }

+ 42 - 0
src/main/java/com/ydtech/modules/admin/service/impl/AgreeReportServiceImpl.java

@@ -0,0 +1,42 @@
+package com.ydtech.modules.admin.service.impl;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ydtech.modules.admin.model.dto.AgreeReportQueryDto;
+import com.ydtech.modules.admin.model.report.user.agree.AgreeReportDto;
+import com.ydtech.modules.admin.service.AgreeReportService;
+import com.ydtech.modules.order.entity.BasePageResult;
+import com.ydtech.modules.protocol.dao.PtlAgreementMapper;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+/**
+ *  @version
+ *  @author: hxl
+ *  @Date: 2024/6/28 9:27
+ *  @Description:  战略合作单位报表
+ */
+@Service
+public class AgreeReportServiceImpl implements AgreeReportService {
+
+
+    @Autowired
+    private PtlAgreementMapper ptlAgreementMapper;
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/6/28 11:18
+     *  @Description:  查询临期数据
+     */
+    @Override
+    public BasePageResult<AgreeReportDto> queryPage(AgreeReportQueryDto agreeReportQueryDto) {
+        Page<AgreeReportDto> page = new Page<>(agreeReportQueryDto.getPageNum(),
+                agreeReportQueryDto.getPageSize());
+
+        Page<AgreeReportDto> result = ptlAgreementMapper.queryReportPage(page, agreeReportQueryDto);
+        return  new BasePageResult<>(agreeReportQueryDto.getPageNum(), page.getSize(), result.getTotal(), page.getPages(),
+                result.getRecords());
+    }
+}
+
+
+

+ 3 - 3
src/main/java/com/ydtech/modules/admin/service/impl/SysUserBankCardServiceImpl.java

@@ -7,14 +7,12 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.ydtech.core.page.HttpResult;
 import com.ydtech.exception.SystemException;
 import com.ydtech.modules.admin.dao.SysUserBankCardMapper;
-import com.ydtech.modules.admin.model.SysPassword;
 import com.ydtech.modules.admin.model.po.SysUserBankCard;
 import com.ydtech.modules.admin.model.vo.SysUserBankCardVO;
 import com.ydtech.modules.admin.service.SysUserBankCardService;
 import com.ydtech.modules.base.controller.BaseController;
 import com.ydtech.modules.order.entity.BasePageResult;
 import com.ydtech.modules.protocol.utils.AssertionUtils;
-import org.apache.commons.lang3.ObjectUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.stereotype.Service;
@@ -22,7 +20,6 @@ import org.springframework.transaction.annotation.Transactional;
 
 import javax.annotation.Resource;
 import java.util.Date;
-import java.util.HashMap;
 import java.util.List;
 
 /**
@@ -120,6 +117,9 @@ public class SysUserBankCardServiceImpl extends ServiceImpl<SysUserBankCardMappe
     @Transactional
     public void auditByBankNumber(SysUserBankCardVO sysUserBankCardVO) {
         SysUserBankCard sysUserBankCard =  sysUserBankCardService.getById(sysUserBankCardVO.getId());
+        if(sysUserBankCard!=null && StringUtils.isNotBlank(sysUserBankCard.getAuditStatus()) && !"0".equals(sysUserBankCard.getAuditStatus())){
+            throw new SystemException("账户已审核不能重复审核");
+        }
         sysUserBankCard.setAuditStatus(sysUserBankCardVO.getAuditStatus());
         sysUserBankCard.setAuditTime(new Date());
         sysUserBankCard.setAuditUserId(BaseController.getUser().getId());

+ 21 - 7
src/main/java/com/ydtech/modules/admin/service/impl/SysUserLinkDeptInternalAgentServiceImpl.java

@@ -3,15 +3,17 @@ package com.ydtech.modules.admin.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.admin.dao.SysDeptInternalAgentMapper;
 import com.ydtech.modules.admin.dao.SysUserLinkDeptInternalAgentMapper;
-import com.ydtech.modules.admin.model.SysDept;
+import com.ydtech.modules.admin.model.dto.SysUserDto;
 import com.ydtech.modules.admin.model.dto.SysUserLinkDeptInternalAgentDto;
 import com.ydtech.modules.admin.model.dto.SysUserLinkPtlAgreementDto;
 import com.ydtech.modules.admin.model.po.SysDeptInternalAgent;
 import com.ydtech.modules.admin.model.po.SysUserLinkDeptInternalAgent;
-import com.ydtech.modules.admin.model.vo.SysDeptInternalAgentQueryVo;
+import com.ydtech.modules.admin.model.vo.SysUserBaseVO;
 import com.ydtech.modules.admin.model.vo.SysUserLinkDeptInternalAgentAddVo;
+import com.ydtech.modules.admin.model.vo.SysUserLinkDeptInternalAgentQueryVo;
 import com.ydtech.modules.admin.service.SysUserLinkDeptInternalAgentService;
 import com.ydtech.modules.base.controller.BaseController;
 import com.ydtech.modules.order.entity.BasePageResult;
@@ -116,11 +118,11 @@ public class SysUserLinkDeptInternalAgentServiceImpl extends ServiceImpl<SysUser
      *  @Description: 分页
      */
     @Override
-    public BasePageResult<SysUserLinkDeptInternalAgentDto> queryPage(SysDeptInternalAgentQueryVo sysDeptInternalAgentQueryVo) {
-        Page<SysUserLinkPtlAgreementDto> page = new Page<>(sysDeptInternalAgentQueryVo.getPageNum(),
-                sysDeptInternalAgentQueryVo.getPageSize());
-        Page<SysUserLinkDeptInternalAgentDto> pageResult = sysUserLinkDeptInternalAgentMapper.queryPage(page, sysDeptInternalAgentQueryVo);
-        return  new BasePageResult<>(sysDeptInternalAgentQueryVo.getPageNum(), page.getSize(), pageResult.getTotal(), page.getPages(),
+    public BasePageResult<SysUserLinkDeptInternalAgentDto> queryPage(SysUserLinkDeptInternalAgentQueryVo sysUserLinkDeptInternalAgentQueryVo) {
+        Page<SysUserLinkPtlAgreementDto> page = new Page<>(sysUserLinkDeptInternalAgentQueryVo.getPageNum(),
+                sysUserLinkDeptInternalAgentQueryVo.getPageSize());
+        Page<SysUserLinkDeptInternalAgentDto> pageResult = sysUserLinkDeptInternalAgentMapper.queryPage(page, sysUserLinkDeptInternalAgentQueryVo);
+        return  new BasePageResult<>(sysUserLinkDeptInternalAgentQueryVo.getPageNum(), page.getSize(), pageResult.getTotal(), page.getPages(),
                 pageResult.getRecords());
     }
 
@@ -136,6 +138,18 @@ public class SysUserLinkDeptInternalAgentServiceImpl extends ServiceImpl<SysUser
         SysUserLinkDeptInternalAgent sysUserLinkDeptInternalAgent = sysUserLinkDeptInternalAgentMapper.selectOne(sysUserLinkDeptInternalAgentLambdaQueryWrapper);
         return sysUserLinkDeptInternalAgent;
     }
+
+    @Override
+    public BasePageResult<SysUserBaseVO> findUserListByPage(SysUserDto sysUserDto) {
+        if(StringUtils.isBlank(sysUserDto.getDeptNBId())){
+            throw new SystemException("deptNBId内部机构不能为空");
+        }
+        Page<SysUserBaseVO> page = new Page<>(sysUserDto.getPageNum(),
+                sysUserDto.getPageSize());
+        Page<SysUserBaseVO> userPageResult = sysUserLinkDeptInternalAgentMapper.findUserListByDeptPage(page, sysUserDto);
+        return  new BasePageResult<>(sysUserDto.getPageNum(), page.getSize(), userPageResult.getTotal(), page.getPages(),
+                userPageResult.getRecords());
+    }
 }
 
 

+ 7 - 4
src/main/java/com/ydtech/modules/admin/service/impl/SysUserLinkFrontLineDeptServiceImpl.java

@@ -6,12 +6,10 @@ import com.ydtech.modules.admin.dao.SysDeptMapper;
 import com.ydtech.modules.admin.dao.SysUserLinkFrontLineDeptMapper;
 import com.ydtech.modules.admin.model.SysDept;
 import com.ydtech.modules.admin.model.dto.SysUserDto;
+import com.ydtech.modules.admin.model.dto.SysUserLinkDeptInternalAgentDto;
 import com.ydtech.modules.admin.model.dto.SysUserLinkFrontLineDeptDto;
 import com.ydtech.modules.admin.model.po.SysUserLinkFrontLineDept;
-import com.ydtech.modules.admin.model.vo.SysAreaVo;
-import com.ydtech.modules.admin.model.vo.SysUserBaseVO;
-import com.ydtech.modules.admin.model.vo.SysUserLinkFrontLineDeptAddVo;
-import com.ydtech.modules.admin.model.vo.SysUserLinkFrontLineDeptQueryVo;
+import com.ydtech.modules.admin.model.vo.*;
 import com.ydtech.modules.admin.service.SysUserLinkFrontLineDeptService;
 import com.ydtech.modules.base.controller.BaseController;
 import com.ydtech.modules.order.entity.BasePageResult;
@@ -149,6 +147,11 @@ public class SysUserLinkFrontLineDeptServiceImpl extends ServiceImpl<SysUserLink
         return  new BasePageResult<>(sysUserDto.getPageNum(), page.getSize(), userPageResult.getTotal(), page.getPages(),
                 userPageResult.getRecords());
     }
+
+    @Override
+    public BasePageResult<SysUserLinkDeptInternalAgentDto> queryUserPage(SysUserLinkDeptInternalAgentQueryVo sysUserLinkDeptInternalAgentQueryVo) {
+        return null;
+    }
 }
 
 

+ 22 - 0
src/main/java/com/ydtech/modules/fnc/controller/InsPlyIncomeController.java

@@ -3,6 +3,7 @@ package com.ydtech.modules.fnc.controller;
 import com.ydtech.core.page.HttpResult;
 import com.ydtech.modules.base.controller.BaseController;
 import com.ydtech.modules.fnc.dto.PlatformSettlementRecordDto;
+import com.ydtech.modules.fnc.dto.SumAllAmountSettlementDto;
 import com.ydtech.modules.fnc.entity.InsPlyIncome;
 import com.ydtech.modules.fnc.entity.SettlementDocumentaryFeesEntity;
 import com.ydtech.modules.fnc.service.ImportAsyncService;
@@ -454,6 +455,27 @@ public class InsPlyIncomeController extends BaseController {
     public HttpResult<Object> batchPinBalanceNew(@RequestBody InsPlyIncomeVo insPlyIncomeVo) {
         return insPlyIncomeService.batchPinBalanceNew(insPlyIncomeVo);
     }
+    /**
+     *
+     * @param insPlyIncomeVo
+     * @return  返回私有 平台  应收 已收  未收
+     */
+    @PostMapping("/totalReceivables")
+    @ApiModelProperty(value = "平台 私有 应收未收 金额")
+    public HttpResult<HashMap<String,Object>> totalReceivables(@RequestBody InsPlyIncomeVo insPlyIncomeVo) {
+        return insPlyIncomeService.totalReceivables(insPlyIncomeVo);
+    }
+
+    /**
+     *
+     * @param insPlyIncomeVo
+     * @return  返回私有   1   到 12  月   应收 已收
+     */
+    @PostMapping("/monthTotalReceivables")
+    @ApiModelProperty(value = "私有平台 已收未收金额")
+    public HttpResult<List<HashMap<String,Object>>> monthTotalReceivables(@RequestBody InsPlyIncomeVo insPlyIncomeVo) {
+        return insPlyIncomeService.monthTotalReceivables(insPlyIncomeVo);
+    }
 }
 
 

+ 16 - 0
src/main/java/com/ydtech/modules/fnc/dao/InsPlyIncomeMapper.java

@@ -130,4 +130,20 @@ public interface InsPlyIncomeMapper extends BaseMapper<InsPlyIncome> {
      *  @Description: 根据合作公司id和结算状态查询数据
      */
     List<PlatformSettlementRecordDto> platformSettlementRecord(@Param("partnerCompaniesId") String partnerCompaniesId, @Param("handlingFeesStatus") String handlingFeesStatus);
+
+
+    /***
+     *
+     * @param insPlyIncomeVo
+     * @return  返回私有 平台  应收 已收  未收
+     */
+    InsPlyIncome getTotalPtReceivables(InsPlyIncomeVo insPlyIncomeVo);
+
+    /**
+     *  根据签单日期月份分组
+     * @param insPlyIncomeVo
+     * @return   平台 私有  应收   已收
+     */
+
+    List<HashMap<String, Object>> ptSumGroupByMonth(HashMap<String, Object> params);
 }

+ 2 - 0
src/main/java/com/ydtech/modules/fnc/dao/SettlementDocumentaryFeesMapper.java

@@ -39,4 +39,6 @@ public interface SettlementDocumentaryFeesMapper  extends BaseMapper<SettlementD
     List<SettlementDocumentaryFeesEntity> getRecord(@Param("id") String id);
 
     List<SettlementDocumentaryFeesEntity> queryRecord(SettlementDocumentaryFeesVo settlementDocumentaryFeesVo);
+
+    List<HashMap<String, Object>> bxSumGroupByMonth(HashMap<String, Object> params);
 }

+ 33 - 0
src/main/java/com/ydtech/modules/fnc/dto/SumAllAmountSettlementDto.java

@@ -0,0 +1,33 @@
+package com.ydtech.modules.fnc.dto;
+
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+
+@Data
+@ApiModel("结算统计")
+public class SumAllAmountSettlementDto implements Serializable {
+
+
+    @ApiModelProperty("协议类型")
+    private String agreementType;
+
+    @ApiModelProperty("应收金额")
+    private  BigDecimal totAmount;
+
+    @ApiModelProperty("已收金额")
+    private  BigDecimal receivedAmount;
+
+
+    @ApiModelProperty("已收金额")
+    private  BigDecimal unReceivedAmount;
+
+
+
+
+}

+ 7 - 0
src/main/java/com/ydtech/modules/fnc/service/InsPlyIncomeService.java

@@ -156,5 +156,12 @@ public interface InsPlyIncomeService extends IService<InsPlyIncome> {
     void updateNoHand(InsPlyIncomeVo insPlyIncomeVo);
 
     HttpResult<Object> batchPinBalanceNew(InsPlyIncomeVo insPlyIncomeVo);
+    /***
+     *
+     * @param insPlyIncomeVo
+     * @return  返回私有 平台  应收 已收  未收
+     */
+    HttpResult<HashMap<String, Object>> totalReceivables(InsPlyIncomeVo insPlyIncomeVo);
 
+    HttpResult<List<HashMap<String,Object>>> monthTotalReceivables(InsPlyIncomeVo insPlyIncomeVo);
 }

+ 7 - 0
src/main/java/com/ydtech/modules/fnc/service/SettlementDocumentaryFeesService.java

@@ -38,4 +38,11 @@ public interface SettlementDocumentaryFeesService extends IService<SettlementDoc
     HttpResult<List<SettlementDocumentaryFeesEntity>> getRecord(String id);
 
     HttpResult<List<SettlementDocumentaryFeesEntity>> queryRecord(SettlementDocumentaryFeesVo settlementDocumentaryFeesVo);
+    /**
+     *
+     * @param params   settlementStatus  2   已结算
+     * @return   按照月分组  已收款金额
+     */
+    List<HashMap<String, Object>> bxSumGroupByMonth(HashMap<String, Object> params);
+
 }

+ 1 - 1
src/main/java/com/ydtech/modules/fnc/service/impl/InsFeeAuditServiceImpl.java

@@ -231,7 +231,7 @@ public class InsFeeAuditServiceImpl extends ServiceImpl<InsFeeAuditMapper, InsFe
                     sumManagementFee = sumManagementFee.add(jqDeptPremiumsLevels[i - 1])
                             .add(syDeptPremiumsLevels[i - 1])
                             .add(noDeptPremiumsLevels[i - 1]);
-                    if (i == 5) {
+                    if (i == 1) {
                         sumManagementFee = sumManagementFee.add(distributionFee);
                     }
 

+ 117 - 1
src/main/java/com/ydtech/modules/fnc/service/impl/InsPlyIncomeServiceImpl.java

@@ -2328,7 +2328,9 @@ handlingProportion,
             params.remove("handlingFeesStatus");
             List<InsPlyIncome> insPlyIncomes = baseMapper.queryNew(params);  //金额总数
             for (InsPlyIncome all : insPlyIncomes) {
-                commissionFeevalue = commissionFeevalue.add(all.getCommissionFeevalue());
+                if(ObjectUtils.isNotEmpty(all)){
+                    commissionFeevalue = commissionFeevalue.add(all.getCommissionFeevalue());
+                }
             }
             //已开票金额  =  开票未结算+  开票已结算
             params.put("handlingFeesStatus", "0"); // 开票
@@ -2637,6 +2639,8 @@ handlingProportion,
                     map.put("syPolicyno", item.getSyPolicyno());
                     map.put("jqOtherCostsPremium", jqOtherAmount);
                     map.put("syOtherCostsPremium", syOtherAmount);
+                    map.put("jqOtherCostsProportion", jqOtherCostsProportion);
+                    map.put("syOtherCostsProportion", syOtherCostsProportion);
 
                     map.put("otherFeevalue", byBxLicenseno.getOtherFeevalue());
                     map.put("otherFeerate", byBxLicenseno.getOtherFeerate());
@@ -2833,6 +2837,11 @@ handlingProportion,
         insPlyIncome.setSyReceivableProportion(this.calculateTotal(insPlyIncome.getSySuperviseCostsProportion(),insPlyIncome.getNoOtherCostsProportion(),null));
         insPlyIncome.setNoReceivableProportion(this.calculateTotal(insPlyIncome.getNoSuperviseCostsProportion(),insPlyIncome.getNoOtherCostsProportion(),null));
         insPlyIncome.setCreateTime(LocalDate.now());
+        insPlyIncome.setCommissionFeerate(this.calculateTotal(insPlyIncome.getJqSuperviseCostsProportion(),insPlyIncome.getSySuperviseCostsProportion(),insPlyIncome.getNoSuperviseCostsPremiums()));
+        insPlyIncome.setCommissionFeevalue(this.calculateTotal(insPlyIncome.getJqSuperviseCostsPremiums(),insPlyIncome.getSySuperviseCostsPremiums(),insPlyIncome.getNoSuperviseCostsPremiums()));
+        insPlyIncome.setOtherFeerate(this.calculateTotal(insPlyIncome.getJqOtherCostsProportion(),insPlyIncome.getSyOtherCostsProportion(),insPlyIncome.getNoOtherCostsProportion()));
+        insPlyIncome.setOtherFeevalue(this.calculateTotal(insPlyIncome.getJqOtherCostsPremium(),insPlyIncome.getSyOtherCostsPremium(),insPlyIncome.getNoOtherCostsPremium()));
+        insPlyIncome.setAllFeeValue(this.calculateTotal(insPlyIncome.getCommissionFeevalue(),insPlyIncome.getOtherFeevalue(),null));
         insPlyIncome.setAgreementType("1");
         insPlyIncome.setHandlingFeesStatus("0");
         insPlyIncome.setIsNotCar("0");
@@ -2852,6 +2861,113 @@ handlingProportion,
         baseMapper.insert(insPlyIncome);
         return HttpResult.ok();
     }
+    /***
+     *
+     * @param insPlyIncomeVo
+     * @return  返回私有 平台  应收 已收  未收
+     */
+    @Override
+    public HttpResult<HashMap<String, Object>> totalReceivables(InsPlyIncomeVo insPlyIncomeVo) {
+        ArrayList<Map<String,Object>> resultList = new ArrayList<>();
+        BigDecimal bxhandAmount = BigDecimal.ZERO;   //保险手续费应收
+        BigDecimal receivedAmount = BigDecimal.ZERO;   //保险手续费应收
+        HashMap<String, Object> ptParams = new HashMap<>();
+        ptParams.put("agreementType","1");
+        InsPlyIncome totalledAmount = baseMapper.ptTotalAmount(ptParams);  //应收 未收 已收
+        ptParams.clear();
+        ptParams.put("commissionFeevalue",totalledAmount.getCommissionFeevalue());
+        ptParams.put("noInvoicCommissionFeevalue",totalledAmount.getNoInvoicCommissionFeevalue());
+        ptParams.put("readyCommissionFeevalue",totalledAmount.getReadyCommissionFeevalue());
+        resultList.add(ptParams);
+        //手续费应收
+        HashMap<String, Object>  privateParams= new HashMap<>();
+        privateParams.put("agreementType","2");
+        List<InsPlyIncome> bxHandList = baseMapper.queryNew(privateParams);
+        for (InsPlyIncome bxhandItem : bxHandList){
+            bxhandAmount=bxhandAmount.add(bxhandItem.getAllFeeValue());
+        }
+        privateParams.clear();
+        //已开票金额  =  开票未结算+  开票已结算
+        privateParams.put("settlementStatus", "2"); // 结算
+        List<SettlementDocumentaryFeesEntity> invoicInsPlyIncomes = settlementDocumentaryFeesService.queryNew(privateParams);  //金额总数
+        for (SettlementDocumentaryFeesEntity invoicInsPlyIncome : invoicInsPlyIncomes) {
+            receivedAmount =receivedAmount.add(invoicInsPlyIncome.getSettlementAmount());
+        }
+        BigDecimal subtract = bxhandAmount.subtract(receivedAmount);
+        privateParams.clear();
+        privateParams.put("commissionFeevalue",bxhandAmount);
+        privateParams.put("noInvoicCommissionFeevalue",receivedAmount);
+        privateParams.put("readyCommissionFeevalue",subtract);
+        resultList.add(privateParams);
+        return HttpResult.ok();
+    }
 
+    /**
+     *  根据签单日期月份分组
+     * @param insPlyIncomeVo
+     * @return   平台 私有  应收   已收
+     */
 
+    @Override
+    public HttpResult<List<HashMap<String, Object>>> monthTotalReceivables(InsPlyIncomeVo insPlyIncomeVo) {
+        HashMap<String, Object> params = new HashMap<>();
+        params.put("agreementType", insPlyIncomeVo.getAgreementType());
+        if ("1".equals(insPlyIncomeVo.getAgreementType())) {  //平台
+            params.put("year", insPlyIncomeVo.getYear());
+            List<HashMap<String, Object>> ptResultList = baseMapper.ptSumGroupByMonth(params);
+            params.put("handlingFeesStatus", "1");
+            List<HashMap<String, Object>> ptSettleResultList = baseMapper.ptSumGroupByMonth(params);
+            Map<String, BigDecimal> ptMap = new HashMap<>(); // 假设commissionFeevalue是BigDecimal类型
+            for (HashMap<String, Object> ptSettleResultListItem : ptSettleResultList) {
+                String month = (String) ptSettleResultListItem.get("month");
+                if (month == null) {
+                    // 处理month为null的情况
+                    continue;
+                }
+                BigDecimal commissionFeevalue = (BigDecimal) ptSettleResultListItem.get("commissionFeevalue");
+                if (commissionFeevalue == null) {
+                    // 处理commissionFeevalue为null的情况
+                    continue;
+                }
+                ptMap.put(month, commissionFeevalue);
+            }
+            for (HashMap<String, Object> ptResultListItem : ptResultList) {
+                BigDecimal bigDecimal1 = ptMap.get(ptResultListItem.get("year"));
+                ptResultListItem.put("readyCommissionFeevalue", bigDecimal1);
+                BigDecimal commissionFeevalue = BigDecimal.valueOf(Long.valueOf(ptResultListItem.get("commissionFeevalue").toString()));
+                BigDecimal subtract = commissionFeevalue.subtract(bigDecimal1);
+                ptResultListItem.put("noInvoicCommissionFeevalue", subtract);
+            }
+            return HttpResult.ok(ptResultList);
+        } else if ("2".equals(insPlyIncomeVo.getAgreementType())) {
+            params.put("year", insPlyIncomeVo.getYear());
+            List<HashMap<String, Object>> bxResultList = baseMapper.ptSumGroupByMonth(params);
+            params.clear();
+            params.put("settlementStatus", "2");
+            List<HashMap<String, Object>> bxReadyCommissionFeevalue = settlementDocumentaryFeesService.bxSumGroupByMonth(params);
+            Map<String, BigDecimal> bxMap = new HashMap<>(); // 假设commissionFeevalue是BigDecimal类型
+            for (HashMap<String, Object> bxSettleResultListItem : bxReadyCommissionFeevalue) {
+                String month = (String) bxSettleResultListItem.get("month");
+                if (month == null) {
+                    // 处理month为null的情况
+                    continue;
+                }
+                BigDecimal commissionFeevalue = (BigDecimal) bxSettleResultListItem.get("commissionFeevalue");
+                if (commissionFeevalue == null) {
+                    // 处理commissionFeevalue为null的情况
+                    continue;
+                }
+                bxMap.put(month, commissionFeevalue);
+            }
+            for (HashMap<String, Object> bxResultListItem : bxResultList) {
+                BigDecimal bigDecimal1 = bxMap.get(bxResultListItem.get("year"));
+                bxResultListItem.put("readyCommissionFeevalue", bigDecimal1);
+                BigDecimal commissionFeevalue = BigDecimal.valueOf(Long.valueOf(bxResultListItem.get("commissionFeevalue").toString()));
+                BigDecimal subtract = commissionFeevalue.subtract(bigDecimal1);
+                bxResultListItem.put("noInvoicCommissionFeevalue", subtract);
+            }
+            return HttpResult.ok(bxReadyCommissionFeevalue);
+        }
+        return HttpResult.ok();
+    }
 }

+ 10 - 0
src/main/java/com/ydtech/modules/fnc/service/impl/SettlementDocumentaryFeesServiceImpl.java

@@ -253,6 +253,16 @@ public class SettlementDocumentaryFeesServiceImpl extends ServiceImpl<Settlement
         return  HttpResult.ok(settlementDocumentaryFeesEntities);
     }
 
+    /**
+     *
+     * @param params   settlementStatus  2   已结算
+     * @return   按照月分组  已收款金额
+     */
+    @Override
+    public List<HashMap<String, Object>> bxSumGroupByMonth(HashMap<String, Object> params) {
+        return  baseMapper.bxSumGroupByMonth(params);
+    }
+
     private int compareAmount(BigDecimal settlementAmount, BigDecimal settlementAmount1) {
 
         return settlementAmount.compareTo(settlementAmount1);

+ 5 - 0
src/main/java/com/ydtech/modules/ins/model/vo/res/SettlementFeesExcel.java

@@ -1,6 +1,7 @@
 package com.ydtech.modules.ins.model.vo.res;
 
 import com.alibaba.excel.annotation.ExcelProperty;
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import com.ydtech.modules.inv.utils.excel.DateConverter;
 import io.swagger.annotations.ApiModelProperty;
@@ -53,6 +54,10 @@ public class SettlementFeesExcel implements Serializable {
     @ExcelProperty("协议号")
     private String agreementId;
 
+    @ApiModelProperty("对接人")
+    @ExcelProperty("对接人")
+    private String dockingPerson;
+
     @ApiModelProperty("交强保单号")
     @ExcelProperty("交强保单号")
     private String policyno;

+ 10 - 0
src/main/java/com/ydtech/modules/protocol/dao/PtlAgreementMapper.java

@@ -1,6 +1,9 @@
 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.admin.model.dto.AgreeReportQueryDto;
+import com.ydtech.modules.admin.model.report.user.agree.AgreeReportDto;
 import com.ydtech.modules.protocol.entity.dto.PtlAgreementInsCompanyDto;
 import com.ydtech.modules.protocol.entity.po.PtlAgreement;
 import org.apache.ibatis.annotations.Param;
@@ -33,6 +36,13 @@ public interface PtlAgreementMapper extends BaseMapper<PtlAgreement> {
 
 
     boolean updateWithNull(PtlAgreement obj);
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/6/28 11:29
+     *  @Description: 查询分页统计
+     */
+    Page<AgreeReportDto> queryReportPage(Page<AgreeReportDto> page, AgreeReportQueryDto agreeReportQueryDto);
 }
 
 

+ 38 - 1
src/main/resources/mapper/modules/admin/SysUserLinkDeptInternalAgentMapper.xml

@@ -21,7 +21,7 @@
     </sql>
     <delete id="deleteByDeptId">
         delete from  sys_user_link_dept_internal_agent
-        where dept_id =#{deptId}
+        where sys_dept_internal_agent_id =#{deptId}
     </delete>
 
     <select id="queryPage" resultType="com.ydtech.modules.admin.model.dto.SysUserLinkDeptInternalAgentDto">
@@ -49,4 +49,41 @@
             </where>
             order by link.create_time desc
     </select>
+    <select id="findUserListByDeptPage" resultType="com.ydtech.modules.admin.model.vo.SysUserBaseVO">
+        SELECT
+        t1.id AS userId,
+        t1.NAME AS NAME,
+        t1.mobile AS mobile,
+        t1.`status` AS `status`,
+        t2.id AS deptId,
+        t2.`name` AS deptName,
+        sd2.id AS pDeptId,
+        sd2.`name` AS pDeptName,
+        CASE
+        WHEN ( SELECT count( 0 ) FROM sys_user_link_dept_internal_agent link WHERE link.user_id = t1.id  and link.sys_dept_internal_agent_id = #{user.deptNBId}) > 0 THEN
+        true ELSE false
+        END AS flag
+        FROM
+        sys_user t1
+        LEFT JOIN sys_dept t2 ON t1.dept_id = t2.id
+        LEFT JOIN sys_dept sd2 ON sd2.id = t2.parent_id
+        WHERE
+        t1.`status` = 1
+        AND t1.id NOT LIKE '%M%'
+        <if test='user !=null  '>
+            <if test='user.name !=null and user.name!="" '>
+                and t1.name like CONCAT('%', #{user.name}, '%')
+            </if>
+            <if test='user.userId !=null and user.userId!="" '>
+                and t1.id = #{user.userId}
+            </if>
+            <if test='user.mobile !=null and user.mobile!=""  '>
+                and t1.mobile = #{user.mobile}
+            </if>
+            <if test='user.deptId !=null and user.deptId!=""  '>
+                and t2.id like CONCAT('', #{user.deptId}, '%')
+            </if>
+        </if>
+        order by flag desc
+    </select>
 </mapper>

+ 395 - 1
src/main/resources/mapper/modules/fnc/InsPlyIncomeMapper.xml

@@ -812,7 +812,7 @@
     <select id="ptTotalAmount" resultType="com.ydtech.modules.fnc.entity.InsPlyIncome">
             SELECT
             SUM(IFNULL(a.commission_feevalue ,0 ) + IFNULL(a.other_feevalue ,0 )) AS commissionFeevalue,
-            SUM( CASE WHEN a.handling_fees_status = '0' THEN IFNULL(a.commission_feevalue ,0 ) + IFNULL(a.other_feevalue ,0 ) ELSE 0 END ) AS "noInvoicCommissionFeevalue",
+            SUM(CASE WHEN a.handling_fees_status = '0' THEN IFNULL(a.commission_feevalue ,0 ) + IFNULL(a.other_feevalue ,0 ) ELSE 0 END ) AS "noInvoicCommissionFeevalue",
             SUM(CASE WHEN a.handling_fees_status = '1' THEN IFNULL(a.commission_feevalue ,0 ) + IFNULL(a.other_feevalue ,0 ) ELSE 0 END) AS "readyCommissionFeevalue"
             FROM
             ins_ply_income a
@@ -1518,6 +1518,8 @@
             <if test="isNotCar !=null  and  isNotCar  !=''">
                 and a.is_not_car =#{isNotCar}
             </if>
+
+
             <if test="handlingFeesStatus !=null  and  handlingFeesStatus  !=''">
                 and a.handling_fees_status =#{handlingFeesStatus}
             </if>
@@ -1762,4 +1764,396 @@
         group  by  a.settlement_time
     </select>
 
+    <select id="getTotalPtReceivables"  resultType="com.ydtech.modules.fnc.entity.InsPlyIncome">
+        select
+        pa.agreement_type as   "agreementType",
+        sum(a.all_fee_value) as "allFeeValue"
+        from  ins_ply_income a
+        LEFT  JOIN  ptl_agreement  pa  on  a.agreement_id  = pa.id
+        LEFT  JOIN  sys_user   su  on su.id=a.user_id
+        LEFT  JOIN  sys_user   su1  on su1.id=a.settlement_user_id
+        LEFT  JOIN  sys_user   su2  on su2.id=a.update_user_id
+        LEFT  JOIN   ins_upload_files  upf   on  a.settlement_image_id=upf.id
+        LEFT  JOIN   esm_ins_company  eic   on  eic.id=a.partner_companies_id
+        LEFT  JOIN   sys_dept b on pa.dept_id=b.id
+        <where>
+            <if test="startDate !=null  and  startDate!='' and  endDate !=null and endDate !=''">
+                and DATE_FORMAT( a.signdate, '%Y-%m-%d')  between DATE_FORMAT(#{startDate}, '%Y-%m-%d') and DATE_FORMAT(#{endDate}, '%Y-%m-%d')
+            </if>
+            <if test="agreementType !=null  and  agreementType  !=''">
+                and pa.agreement_type =#{agreementType}
+            </if>
+
+            <if test="signDateEnd !=null  and  signDateEnd!='' and  signDateStart !=null and signDateStart !=''">
+                and a.signdate   between #{signDateStart} and #{signDateEnd}
+            </if>
+
+            <if test="handlingFeesStatus !=null  and  handlingFeesStatus  !=''">
+                and a.handling_fees_status =#{handlingFeesStatus}
+            </if>
+            <if test="jqReceivableProportion !=null  and  jqReceivableProportion  !=''">
+                and a.jq_receivable_proportion =#{jqReceivableProportion}
+            </if>
+
+            <if test="syReceivableProportion !=null  and  syReceivableProportion  !=''">
+                and a.sy_receivable_proportion =#{syReceivableProportion}
+            </if>
+            <if test="noReceivableProportion !=null  and  noReceivableProportion  !=''">
+                and a.no_receivable_proportion =#{noReceivableProportion}
+            </if>
+
+            <if test="id !=null  and  id  !=''">
+                and a.id =#{id}
+            </if>
+
+            <if test="allPartnerCompaniesId !=null  and  allPartnerCompaniesId  !=''">
+                AND eic.parent_id LIKE CONCAT(#{allPartnerCompaniesId}, '%')
+            </if>
+
+            <if test="provincePartnerCompaniesId !=null  and  provincePartnerCompaniesId  !=''">
+                and eic.parent_id LIKE CONCAT(#{provincePartnerCompaniesId}, '%')
+            </if>
+
+            <if test="dockingPerson !=null  and  dockingPerson  !=''">
+                and  pa.docking_person  =#{dockingPerson}
+            </if>
+
+            <if test="provinceId != null and provinceId != ''">
+                and pa.dept_id  LIKE CONCAT(#{provinceId}, '%')
+            </if>
+
+            <if test="cityId != null and cityId != ''">
+                and pa.dept_id  LIKE CONCAT(#{cityId}, '%')
+            </if>
+
+            <if test="createTimeQuery != null and createTimeQuery != ''">
+                and DATE_FORMAT( a.create_time, '%Y-%m-%d')   =#{createTimeQuery}
+            </if>
+
+            <if test="countyId != null and countyId != ''">
+                and pa.dept_id   LIKE CONCAT(#{countyId}, '%')
+            </if>
+            <if test="taskId != null and taskId != ''">
+                and a.task_id = #{taskId}
+            </if>
+            <if test="orderno !=null  and  orderno  !=''">
+                and a.orderno =#{orderno}
+            </if>
+            <if test="companyName !=null  and  companyName  !=''">
+                and a.company_id =#{companyName}
+            </if>
+
+            <if test="policyno !=null  and  policyno  !=''">
+                and a.policyno =#{policyno}
+            </if>
+            <if test="documentaryFeesStatus !=null  and  documentaryFeesStatus  !=''">
+                and a.documentary_fees_status =#{documentaryFeesStatus}
+            </if>
+
+            <if test="isNotCar !=null  and  isNotCar  !=''">
+                and a.is_not_car =#{isNotCar}
+            </if>
+
+            <if test="deptId !=null  and  deptId  !=''">
+                and pa.dept_id =#{deptId}
+            </if>
+
+
+            <if test="ids != null and ids != '' and ids.length > 0">
+                and a.id in
+                <foreach collection="ids" item="item" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+            </if>
+            <if test="incomeIds != null and incomeIds != '' and incomeIds.size() > 0">
+                and a.id in
+                <foreach collection="incomeIds" item="item" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+            </if>
+
+            <if test="selectIds != null and selectIds != '' and selectIds.size() > 0">
+                and a.id in
+                <foreach collection="selectIds" item="item" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+            </if>
+
+            <if test="partnerCompaniesIdList != null and partnerCompaniesIdList != '' and partnerCompaniesIdList.size() > 0">
+                and a.partner_companies_id in
+                <foreach collection="partnerCompaniesIdList" item="item" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+            </if>
+
+            <if test="isOther !=null  and  isOther  !=''">
+                and a.is_not_documentary   =#{isOther}
+            </if>
+            <if test="licenseno != null and licenseno != ''">
+                and a.licenseno  =#{licenseno}
+            </if>
+            <if test="syPolicyno != null and syPolicyno != ''">
+                and a.sy_policyno  =#{syPolicyno}
+            </if>
+
+            <if test="noPolicyno != null and noPolicyno != ''">
+                and a.no_policyno =#{noPolicyno}
+            </if>
+            <if test="signdate !=null  and  signdate  !=''">
+                AND  a.signdate =#{signdate}
+            </if>
+            <if test="partnerCompaniesId !=null  and  partnerCompaniesId  !=''">
+                AND a.partner_companies_id =#{partnerCompaniesId}
+            </if>
+
+            <if test="partnerCompaniesName !=null  and  partnerCompaniesName  !=''">
+                AND   a.partner_companies_name =#{partnerCompaniesName}
+            </if>
+
+            <if test="createTime !=null  and  createTime  !=''">
+                AND  a.create_time =#{createTime}
+            </if>
+            <if test="settlementTime !=null  and  settlementTime  !=''">
+                AND a.settlement_time =#{settlementTime}
+            </if>
+
+            <if test="settlementDate !=null  and  settlementDate  !=''">
+                AND a.settlement_time =#{settlementDate}
+            </if>
+
+            <if test="userId !=null  and  userId  !=''">
+                and a.userId   =#{userId}
+            </if>
+            <if test="companyId !=null  and  companyId  !=''">
+                and a.company_id   =#{companyId}
+            </if>
+            <if test="riskcode !=null  and  riskcode  !=''">
+                and a.riskcode   =#{riskcode}
+            </if>
+            <if test="year !=null  and  year  !=''">
+                AND YEAR(a.signdate) =#{year}
+            </if>
+            <if test="month !=null  and  month !=''">
+                AND month(a.signdate) =#{month}
+            </if>
+            <if test="day !=null  and  day !=''">
+                AND day(a.signdate) =#{day}
+            </if>
+            <if test="insuredName !=null  and  insuredName !=''">
+                AND  a.insured_name =#{insuredName}
+            </if>
+            <if test="jqStartDate  !=null  and  jqStartDate  != ''  and  jqEndDate   != null  and  jqEndDate   !=''">
+                AND DATE(a.jq_start_date) BETWEEN #{jqStartDate} AND #{jqEndDate}
+
+            </if>
+            <if test="syStartDate  !=null  and  syStartDate  != ''  and  syEndDate   != null  and  syEndDate   !=''">
+                AND DATE(a.sy_start_date) BETWEEN #{syStartDate} AND #{syEndDate}
+
+            </if>
+
+            <if test="yearStrat  !=null  and  yearStrat  != ''  and  yearEnd   != null  and  yearEnd   !=''">
+                AND DATE(a.signdate) BETWEEN #{yearStrat} AND #{yearEnd}
+            </if>
+        </where>
+         group  by   pa.agreement_type
+    </select>
+
+    <select id="ptSumGroupByMonth" resultType="java.util.HashMap">
+        SELECT
+            DATE_FORMAT( a.signdate, '%m') as "month",
+            sum(a.all_fee_value) as "commissionFeevalue"
+        FROM
+            ins_ply_income a
+                LEFT JOIN ptl_agreement pa ON a.agreement_id = pa.id
+                LEFT JOIN sys_user su ON su.id = a.user_id
+                LEFT JOIN sys_user su1 ON su1.id = a.settlement_user_id
+                LEFT JOIN sys_user su2 ON su2.id = a.update_user_id
+                LEFT JOIN ins_upload_files upf ON a.settlement_image_id = upf.id
+                LEFT JOIN esm_ins_company eic ON eic.id = a.partner_companies_id
+                LEFT JOIN sys_dept b ON pa.dept_id = b.id
+        <where>
+            1=1
+            <if test="startDate !=null  and  startDate!='' and  endDate !=null and endDate !=''">
+                and DATE_FORMAT( a.signdate, '%Y-%m-%d')  between DATE_FORMAT(#{startDate}, '%Y-%m-%d') and DATE_FORMAT(#{endDate}, '%Y-%m-%d')
+            </if>
+            <if test="agreementType !=null  and  agreementType  !=''">
+                and pa.agreement_type =#{agreementType}
+            </if>
+
+            <if test="signDateEnd !=null  and  signDateEnd!='' and  signDateStart !=null and signDateStart !=''">
+                and a.signdate   between #{signDateStart} and #{signDateEnd}
+            </if>
+
+            <if test="handlingFeesStatus !=null  and  handlingFeesStatus  !=''">
+                and a.handling_fees_status =#{handlingFeesStatus}
+            </if>
+            <if test="jqReceivableProportion !=null  and  jqReceivableProportion  !=''">
+                and a.jq_receivable_proportion =#{jqReceivableProportion}
+            </if>
+
+            <if test="syReceivableProportion !=null  and  syReceivableProportion  !=''">
+                and a.sy_receivable_proportion =#{syReceivableProportion}
+            </if>
+            <if test="noReceivableProportion !=null  and  noReceivableProportion  !=''">
+                and a.no_receivable_proportion =#{noReceivableProportion}
+            </if>
+            <if test="id !=null  and  id  !=''">
+                and a.id =#{id}
+            </if>
+
+            <if test="allPartnerCompaniesId !=null  and  allPartnerCompaniesId  !=''">
+                AND eic.parent_id LIKE CONCAT(#{allPartnerCompaniesId}, '%')
+            </if>
+
+            <if test="provincePartnerCompaniesId !=null  and  provincePartnerCompaniesId  !=''">
+                and eic.parent_id LIKE CONCAT(#{provincePartnerCompaniesId}, '%')
+            </if>
+
+            <if test="dockingPerson !=null  and  dockingPerson  !=''">
+                and  pa.docking_person  =#{dockingPerson}
+            </if>
+
+            <if test="provinceId != null and provinceId != ''">
+                and pa.dept_id  LIKE CONCAT(#{provinceId}, '%')
+            </if>
+
+            <if test="cityId != null and cityId != ''">
+                and pa.dept_id  LIKE CONCAT(#{cityId}, '%')
+            </if>
+
+            <if test="createTimeQuery != null and createTimeQuery != ''">
+                and DATE_FORMAT( a.create_time, '%Y-%m-%d')   =#{createTimeQuery}
+            </if>
+
+            <if test="countyId != null and countyId != ''">
+                and pa.dept_id   LIKE CONCAT(#{countyId}, '%')
+            </if>
+            <if test="taskId != null and taskId != ''">
+                and a.task_id = #{taskId}
+            </if>
+            <if test="orderno !=null  and  orderno  !=''">
+                and a.orderno =#{orderno}
+            </if>
+            <if test="companyName !=null  and  companyName  !=''">
+                and a.company_id =#{companyName}
+            </if>
+
+            <if test="policyno !=null  and  policyno  !=''">
+                and a.policyno =#{policyno}
+            </if>
+            <if test="documentaryFeesStatus !=null  and  documentaryFeesStatus  !=''">
+                and a.documentary_fees_status =#{documentaryFeesStatus}
+            </if>
+
+            <if test="isNotCar !=null  and  isNotCar  !=''">
+                and a.is_not_car =#{isNotCar}
+            </if>
+
+            <if test="deptId !=null  and  deptId  !=''">
+                and pa.dept_id =#{deptId}
+            </if>
+
+
+            <if test="ids != null and ids != '' and ids.length > 0">
+                and a.id in
+                <foreach collection="ids" item="item" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+            </if>
+            <if test="incomeIds != null and incomeIds != '' and incomeIds.size() > 0">
+                and a.id in
+                <foreach collection="incomeIds" item="item" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+            </if>
+
+            <if test="selectIds != null and selectIds != '' and selectIds.size() > 0">
+                and a.id in
+                <foreach collection="selectIds" item="item" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+            </if>
+
+            <if test="partnerCompaniesIdList != null and partnerCompaniesIdList != '' and partnerCompaniesIdList.size() > 0">
+                and a.partner_companies_id in
+                <foreach collection="partnerCompaniesIdList" item="item" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+            </if>
+
+            <if test="isOther !=null  and  isOther  !=''">
+                and a.is_not_documentary   =#{isOther}
+            </if>
+            <if test="licenseno != null and licenseno != ''">
+                and a.licenseno  =#{licenseno}
+            </if>
+            <if test="syPolicyno != null and syPolicyno != ''">
+                and a.sy_policyno  =#{syPolicyno}
+            </if>
+
+            <if test="noPolicyno != null and noPolicyno != ''">
+                and a.no_policyno =#{noPolicyno}
+            </if>
+            <if test="signdate !=null  and  signdate  !=''">
+                AND  a.signdate =#{signdate}
+            </if>
+            <if test="partnerCompaniesId !=null  and  partnerCompaniesId  !=''">
+                AND a.partner_companies_id =#{partnerCompaniesId}
+            </if>
+
+            <if test="partnerCompaniesName !=null  and  partnerCompaniesName  !=''">
+                AND   a.partner_companies_name =#{partnerCompaniesName}
+            </if>
+
+            <if test="createTime !=null  and  createTime  !=''">
+                AND  a.create_time =#{createTime}
+            </if>
+            <if test="settlementTime !=null  and  settlementTime  !=''">
+                AND a.settlement_time =#{settlementTime}
+            </if>
+
+            <if test="settlementDate !=null  and  settlementDate  !=''">
+                AND a.settlement_time =#{settlementDate}
+            </if>
+
+            <if test="userId !=null  and  userId  !=''">
+                and a.userId   =#{userId}
+            </if>
+            <if test="companyId !=null  and  companyId  !=''">
+                and a.company_id   =#{companyId}
+            </if>
+            <if test="riskcode !=null  and  riskcode  !=''">
+                and a.riskcode   =#{riskcode}
+            </if>
+            <if test="year !=null  and  year  !=''">
+                AND YEAR(a.signdate) =#{year}
+            </if>
+            <if test="month !=null  and  month !=''">
+                AND month(a.signdate) =#{month}
+            </if>
+            <if test="day !=null  and  day !=''">
+                AND day(a.signdate) =#{day}
+            </if>
+            <if test="insuredName !=null  and  insuredName !=''">
+                AND  a.insured_name =#{insuredName}
+            </if>
+            <if test="jqStartDate  !=null  and  jqStartDate  != ''  and  jqEndDate   != null  and  jqEndDate   !=''">
+                AND DATE(a.jq_start_date) BETWEEN #{jqStartDate} AND #{jqEndDate}
+
+            </if>
+            <if test="syStartDate  !=null  and  syStartDate  != ''  and  syEndDate   != null  and  syEndDate   !=''">
+                AND DATE(a.sy_start_date) BETWEEN #{syStartDate} AND #{syEndDate}
+
+            </if>
+
+            <if test="yearStrat  !=null  and  yearStrat  != ''  and  yearEnd   != null  and  yearEnd   !=''">
+                AND DATE(a.signdate) BETWEEN #{yearStrat} AND #{yearEnd}
+            </if>
+        </where>
+        GROUP BY
+        DATE_FORMAT( a.signdate, '%m')
+    </select>
+
+
+
 </mapper>

+ 37 - 0
src/main/resources/mapper/modules/fnc/SettlementDocumentaryFeesMapper.xml

@@ -397,6 +397,43 @@
     </select>
 
 
+    <select id="bxSumGroupByMonth" resultType="java.util.HashMap">
+        SELECT
+        DATE_FORMAT( a.signing_time, '%m') as "month",
+        sum(a.settlement_amount) as "commissionFeevalue"
+        from  settlement_documentary_fees  a
+        LEFT  JOIN   ins_upload_files  upf   on  a.settlement_image_id=upf.id
+        <where>
+            1=1
+            <if test="partnerCompaniesId !=null  and  partnerCompaniesId  !=''">
+                and a.partner_companies_id =#{partnerCompaniesId}
+            </if>
+            <if test="handlingFeesStatus !=null  and  handlingFeesStatus  !=''">
+                and a.handling_fees_status =#{handlingFeesStatus}
+            </if>
+            <if test="isNotCar !=null  and  isNotCar  !=''">
+                and a.is_not_car =#{isNotCar}
+            </if>
+            <if test="agreementType !=null  and  agreementType  !=''">
+                and a.agreement_type =#{agreementType}
+            </if>
+            <if test="parentId !=null  and  parentId  !=''">
+                and a.parent_id =#{parentId}
+            </if>
+            <if test="settlementStatus !=null  and  settlementStatus  !=''">
+                and a.settlement_status =#{settlementStatus}
+            </if>
+            <if test="completionStatus !=null  and  completionStatus  !=''">
+                and a.completion_status =#{completionStatus}
+            </if>
+            <if test="settlementSumId !=null  and  settlementSumId  !=''">
+                and a.settlement_sum_id =#{settlementSumId}
+            </if>
+        </where>
+        GROUP BY
+        DATE_FORMAT( a.signing_time, '%m')
+    </select>
+
 
 
 

+ 1 - 0
src/main/resources/mapper/modules/order/InsOrdersMapper.xml

@@ -1340,6 +1340,7 @@
         WHERE
             io.userid = #{userId}
           AND io.orderstatus = 3
+          AND iac.orderstatus = 3
           AND iac.signing_time BETWEEN #{param.signStartDate} and #{param.signEndDate}
     </select>
 

+ 60 - 0
src/main/resources/mapper/modules/protocol/PtlAgreementMapper.xml

@@ -157,4 +157,64 @@
         </where>
         limit  1
     </select>
+
+    <select id="queryReportPage" resultType="com.ydtech.modules.admin.model.report.user.agree.AgreeReportDto">
+        SELECT
+        eic.id AS companyId,
+        eic.NAME AS companyName,
+        pa.id AS agreeId,
+        eic_hz.id AS partnerCompaniesId,
+        eic_hz.NAME AS partnerCompaniesName,
+        pa.partner_companies_id,
+        pa.agreement_name AS agreeName,
+        pa.agreement_abbreviation AS agreeSimpleName,
+        pa.start_date AS agreeStartDate,
+        pa.end_date AS agreeEndDate,
+        DATEDIFF(
+        end_date,
+        NOW()) AS dayStr,
+        area.area_cname as areaName
+        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
+        LEFT JOIN esm_ins_company eic_hz ON pa.partner_companies_id = eic_hz.id
+        left join sys_area area on  RPAD(SUBSTRING( pa.partner_companies_id, 6, 4 ),6,0)= area.area_code
+        <where>
+        ( now() BETWEEN pa.start_date AND pa.end_date )
+        AND ( paa.template_id IS NOT NULL )
+        AND pa.valid_status = 1
+        <if test="vo.deptId  !=null  and   vo.deptId  !=''" >
+            AND pa.id IN ( SELECT DISTINCT agreement_id FROM ptl_agreement_dept WHERE dept_id LIKE concat(#{vo.deptId},'%') )
+        </if>
+        <if test="vo.warningDay  !=null  and   vo.warningDay  !=''" >
+            <choose>
+                <when test="warningDay==1">
+                    DATEDIFF(pa.end_date,NOW()) &lt;= 30
+                </when>
+                <when test="warningDay==2">
+                    DATEDIFF(pa.end_date,NOW()) &lt;= 60
+                </when>
+            </choose>
+        </if>
+        <if test="vo.warningStatus  !=null  and   vo.warningStatus  !=''" >
+            <choose>
+                <when test="warningStatus==1">
+                    DATEDIFF(pa.end_date,NOW()) &lt;=  30
+                </when>
+                <when test="warningStatus==2">
+                    DATEDIFF(pa.end_date,NOW()) >  30
+                </when>
+            </choose>
+        </if>
+        <if test="vo.areaId  !=null  and   vo.areaId  !=''" >
+             AND ( pa.companies_type = 1 AND  RPAD(SUBSTRING( pa.partner_companies_id, 6, 4 ),6,0) = #{vo.areaId})
+        </if>
+        <if test="vo.partnerCompaniesId  !=null  and   vo.partnerCompaniesId  !=''" >
+            and   pa.partner_companies_id =#{vo.partnerCompaniesId}
+        </if>
+        </where>
+        ORDER BY
+        pa.serial_number
+    </select>
 </mapper>