Quellcode durchsuchen

1.控制台数据权限
2.掌柜结算作废调整

wuhp vor 1 Jahr
Ursprung
Commit
2d1fb0cd07
47 geänderte Dateien mit 1142 neuen und 123 gelöschten Zeilen
  1. 15 2
      src/main/java/com/ydtech/modules/admin/controller/AgreeReportConroller.java
  2. 25 2
      src/main/java/com/ydtech/modules/admin/controller/CompanyDataReportConroller.java
  3. 22 0
      src/main/java/com/ydtech/modules/admin/controller/SysDeptController.java
  4. 12 0
      src/main/java/com/ydtech/modules/admin/controller/SysUserController.java
  5. 34 3
      src/main/java/com/ydtech/modules/admin/controller/deptBalance/DeptBalanceController.java
  6. 14 1
      src/main/java/com/ydtech/modules/admin/controller/financialReceivables/FinancialReceivablesController.java
  7. 14 5
      src/main/java/com/ydtech/modules/admin/controller/khgl/KhglDataController.java
  8. 34 4
      src/main/java/com/ydtech/modules/admin/controller/personnelStatistics/PersonnelStatisticsController.java
  9. 15 4
      src/main/java/com/ydtech/modules/admin/controller/quoteCount/QuoteCountController.java
  10. 84 8
      src/main/java/com/ydtech/modules/admin/controller/taskStatistics/TaskStatisticsController.java
  11. 7 0
      src/main/java/com/ydtech/modules/admin/model/dto/AgreeReportQueryDto.java
  12. 4 0
      src/main/java/com/ydtech/modules/admin/model/dto/QxFrontlineAgentDto.java
  13. 8 0
      src/main/java/com/ydtech/modules/admin/model/report/company/CompanyQutationCountDataQueryDto.java
  14. 9 0
      src/main/java/com/ydtech/modules/admin/model/report/financialReceivables/FinancialReceivablesQueryVo.java
  15. 6 0
      src/main/java/com/ydtech/modules/admin/model/vo/DeptBalanceVo.java
  16. 7 0
      src/main/java/com/ydtech/modules/admin/model/vo/DxQueryVo.java
  17. 15 0
      src/main/java/com/ydtech/modules/admin/model/vo/KztGetDeptUtilsDto.java
  18. 7 0
      src/main/java/com/ydtech/modules/admin/model/vo/OrdersDataVo.java
  19. 6 0
      src/main/java/com/ydtech/modules/admin/model/vo/QxFrontlineAgentVo.java
  20. 2 1
      src/main/java/com/ydtech/modules/admin/model/vo/TaskStatisticsVo.java
  21. 5 1
      src/main/java/com/ydtech/modules/admin/service/SysDeptService.java
  22. 5 0
      src/main/java/com/ydtech/modules/admin/service/SysUserService.java
  23. 90 0
      src/main/java/com/ydtech/modules/admin/service/impl/SysDeptServiceImpl.java
  24. 21 0
      src/main/java/com/ydtech/modules/admin/service/impl/SysUserServiceImpl.java
  25. 1 1
      src/main/java/com/ydtech/modules/admin/service/impl/TaskStatisticsServiceImpl.java
  26. 44 23
      src/main/java/com/ydtech/modules/admin/utils/KztGetDeptUtils.java
  27. 8 1
      src/main/java/com/ydtech/modules/fnc/dao/InsPlyIncomeMapper.java
  28. 10 0
      src/main/java/com/ydtech/modules/fnc/dao/InsuranceHandlingSettlementMonthMapper.java
  29. 4 0
      src/main/java/com/ydtech/modules/fnc/entity/InsPlyIncome.java
  30. 2 0
      src/main/java/com/ydtech/modules/fnc/entity/InsuranceHandlingSettlementMonthEntity.java
  31. 10 0
      src/main/java/com/ydtech/modules/fnc/service/InsuranceHandlingSettlementMonthService.java
  32. 2 48
      src/main/java/com/ydtech/modules/fnc/service/impl/InsPlyIncomeServiceImpl.java
  33. 12 0
      src/main/java/com/ydtech/modules/fnc/service/impl/InsuranceHandlingSettlementMonthServiceImpl.java
  34. 1 1
      src/main/java/com/ydtech/modules/fnc/service/impl/SettlementDocumentaryFeesServiceImpl.java
  35. 24 0
      src/main/resources/mapper/modules/admin/CompanyDataReport.xml
  36. 13 0
      src/main/resources/mapper/modules/admin/DeptBalanceMapper.xml
  37. 13 0
      src/main/resources/mapper/modules/admin/SysAgencyLeaderMapper.xml
  38. 3 1
      src/main/resources/mapper/modules/admin/SysDeptMapper.xml
  39. 13 0
      src/main/resources/mapper/modules/admin/SysPartnerMapper.xml
  40. 13 0
      src/main/resources/mapper/modules/admin/SysTelemarketingWechatDataMapper.xml
  41. 26 0
      src/main/resources/mapper/modules/admin/SysUserMapper.xml
  42. 53 0
      src/main/resources/mapper/modules/admin/TaskStatisticsMapper.xml
  43. 211 16
      src/main/resources/mapper/modules/fnc/InsPlyIncomeMapper.xml
  44. 9 0
      src/main/resources/mapper/modules/fnc/SettlementDocumentaryFeesMapper.xml
  45. 33 0
      src/main/resources/mapper/modules/insuranceHandlingSettlementMonth/InsuranceHandlingSettlementMonthMapper.xml
  46. 169 1
      src/main/resources/mapper/modules/order/InsAreaCompanyMapper.xml
  47. 7 0
      src/main/resources/mapper/modules/protocol/PtlAgreementMapper.xml

+ 15 - 2
src/main/java/com/ydtech/modules/admin/controller/AgreeReportConroller.java

@@ -1,18 +1,23 @@
 package com.ydtech.modules.admin.controller;
 
+import cn.hutool.http.server.HttpServerRequest;
 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.model.vo.KztGetDeptUtilsDto;
 import com.ydtech.modules.admin.service.AgreeReportService;
+import com.ydtech.modules.admin.utils.KztGetDeptUtils;
 import com.ydtech.modules.order.entity.BasePageResult;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
+import org.apache.commons.lang3.ObjectUtils;
 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;
 
+import javax.servlet.http.HttpServletRequest;
 import java.util.List;
 
 /**
@@ -37,9 +42,17 @@ public class AgreeReportConroller {
      */
     @PostMapping("queryPage")
     @ApiOperation(value = "控制台战略合作单位统计")
-    public HttpResult<BasePageResult<AgreeReportDto>> queryPage(@RequestBody AgreeReportQueryDto agreeReportQueryDto) {
-
+    public HttpResult<BasePageResult<AgreeReportDto>> queryPage(@RequestBody AgreeReportQueryDto agreeReportQueryDto, HttpServletRequest httpServerRequest) {
         try{
+            KztGetDeptUtils kztGetDeptUtils = new KztGetDeptUtils();
+            KztGetDeptUtilsDto kztGetDeptUtilsDto = kztGetDeptUtils.KztGetDeptIds(httpServerRequest.getRequestURL().toString());
+            if(ObjectUtils.isNotEmpty(kztGetDeptUtilsDto)){
+                if("1".equals(kztGetDeptUtilsDto.getType())){
+                    agreeReportQueryDto.setDeptIds(kztGetDeptUtilsDto.getIds());
+                } else if ("2".equals(kztGetDeptUtilsDto.getType())) {
+                    agreeReportQueryDto.setUserIds(kztGetDeptUtilsDto.getIds());
+                }
+            }
             BasePageResult<AgreeReportDto> result = agreeReportService.queryPage(agreeReportQueryDto);
             return HttpResult.ok("查询数据成功", result);
         }catch (Exception e){

+ 25 - 2
src/main/java/com/ydtech/modules/admin/controller/CompanyDataReportConroller.java

@@ -2,18 +2,23 @@ package com.ydtech.modules.admin.controller;
 
 import com.ydtech.core.page.HttpResult;
 import com.ydtech.modules.admin.model.report.company.*;
+import com.ydtech.modules.admin.model.vo.KztGetDeptUtilsDto;
 import com.ydtech.modules.admin.model.vo.OrdersDataVo;
 import com.ydtech.modules.admin.model.vo.TaskStatisticsVo;
 import com.ydtech.modules.admin.service.CompanyDataReportService;
+import com.ydtech.modules.admin.utils.KztGetDeptUtils;
 import com.ydtech.modules.order.entity.BasePageResult;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
+import org.apache.commons.lang3.ObjectUtils;
 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;
 
+import javax.servlet.http.HttpServletRequest;
+
 /**
  *  @version
  *  @author: hxl
@@ -69,8 +74,17 @@ public class CompanyDataReportConroller {
      */
     @PostMapping("querOrdersDataPage")
     @ApiOperation(value = "查询控制台大订单")
-    public HttpResult<BasePageResult<OrdersDataDto>> querOrdersDataPage(@RequestBody OrdersDataVo ordersDataVo) {
+    public HttpResult<BasePageResult<OrdersDataDto>> querOrdersDataPage(@RequestBody OrdersDataVo ordersDataVo, HttpServletRequest httpServerRequest) {
         try{
+            KztGetDeptUtils kztGetDeptUtils = new KztGetDeptUtils();
+            KztGetDeptUtilsDto kztGetDeptUtilsDto = kztGetDeptUtils.KztGetDeptIds(httpServerRequest.getRequestURL().toString());
+            if(ObjectUtils.isNotEmpty(kztGetDeptUtilsDto)){
+                if("1".equals(kztGetDeptUtilsDto.getType())){
+                    ordersDataVo.setDeptIds(kztGetDeptUtilsDto.getIds());
+                } else if ("2".equals(kztGetDeptUtilsDto.getType())) {
+                    ordersDataVo.setUserIds(kztGetDeptUtilsDto.getIds());
+                }
+            }
             BasePageResult<OrdersDataDto> result = companyDataReportService.querOrdersDataPage(ordersDataVo);
             return HttpResult.ok("查询数据成功", result);
         }catch (Exception e){
@@ -85,8 +99,17 @@ public class CompanyDataReportConroller {
      */
     @PostMapping("querOrdersamountTo")
     @ApiOperation(value = "查询控制台大订单合计")
-    public HttpResult<OrdersDataDto> querOrdersamountTo(@RequestBody OrdersDataVo ordersDataVo) {
+    public HttpResult<OrdersDataDto> querOrdersamountTo(@RequestBody OrdersDataVo ordersDataVo, HttpServletRequest httpServerRequest) {
         try{
+            KztGetDeptUtils kztGetDeptUtils = new KztGetDeptUtils();
+            KztGetDeptUtilsDto kztGetDeptUtilsDto = kztGetDeptUtils.KztGetDeptIds(httpServerRequest.getRequestURL().toString());
+            if(ObjectUtils.isNotEmpty(kztGetDeptUtilsDto)){
+                if("1".equals(kztGetDeptUtilsDto.getType())){
+                    ordersDataVo.setDeptIds(kztGetDeptUtilsDto.getIds());
+                } else if ("2".equals(kztGetDeptUtilsDto.getType())) {
+                    ordersDataVo.setUserIds(kztGetDeptUtilsDto.getIds());
+                }
+            }
             OrdersDataDto result = companyDataReportService.querOrdersamountTo(ordersDataVo);
             return HttpResult.ok("查询数据成功", result);
         }catch (Exception e){

+ 22 - 0
src/main/java/com/ydtech/modules/admin/controller/SysDeptController.java

@@ -8,21 +8,26 @@ import com.ydtech.core.page.PageRequest;
 import com.ydtech.modules.admin.model.SysDept;
 import com.ydtech.modules.admin.model.SysPassword;
 import com.ydtech.modules.admin.model.SysUser;
+import com.ydtech.modules.admin.model.vo.KztGetDeptUtilsDto;
 import com.ydtech.modules.admin.model.vo.SysDeptRemoveVo;
 import com.ydtech.modules.admin.model.vo.SysDeptTreeVo;
 import com.ydtech.modules.admin.model.vo.SysDeptVo;
 import com.ydtech.modules.admin.service.SysDeptService;
 import com.ydtech.modules.admin.service.SysPasswordService;
+import com.ydtech.modules.admin.utils.KztGetDeptUtils;
 import com.ydtech.modules.base.controller.BaseController;
 import com.ydtech.security.utils.PasswordUtils;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.ObjectUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.web.bind.annotation.*;
 
+import javax.servlet.http.HttpServletRequest;
+import java.util.ArrayList;
 import java.util.List;
 
 
@@ -204,5 +209,22 @@ public class SysDeptController extends BaseController {
     }
 
 
+    /**
+     * 数据权限机构数
+     * @return
+     */
+    @ApiOperation(value = "数据权限机构数")
+    @GetMapping(value = "/getDataDeptTree")
+    public HttpResult<List<SysDept>> getDataDeptTree(HttpServletRequest httpServerRequest) {
+        List<String> deptIds = new ArrayList<>();
+        KztGetDeptUtils kztGetDeptUtils = new KztGetDeptUtils();
+        KztGetDeptUtilsDto kztGetDeptUtilsDto = kztGetDeptUtils.KztGetDeptIds(httpServerRequest.getRequestURL().toString());
+        if(ObjectUtils.isNotEmpty(kztGetDeptUtilsDto)){
+            if("1".equals(kztGetDeptUtilsDto.getType())){
+                deptIds = kztGetDeptUtilsDto.getIds();
+            }
+        }
+        return HttpResult.ok(sysDeptService.getDataDeptTree(deptIds));
+    }
 
 }

+ 12 - 0
src/main/java/com/ydtech/modules/admin/controller/SysUserController.java

@@ -841,6 +841,18 @@ public class SysUserController extends BaseController {
         return HttpResult.ok(list);
     }
 
+    /**
+     * 获取当前用户的下级所有人员
+     * @return
+     */
+    @ApiOperation(value = "获取当前用户的下级所有人员")
+    @GetMapping(value = "/findNextTree")
+    public HttpResult<List<SysUser>> findNextTree() {
+        List<SysUser> list = sysUserService.findNextTree();
+        return HttpResult.ok(list);
+    }
+
+
     @ApiOperation(value = "渠道区域业绩管理")
     @PostMapping(value = "/quUserNum")
     public HttpResult quUserNum(@RequestBody QuUserNumDto quUserNumDto) {

+ 34 - 3
src/main/java/com/ydtech/modules/admin/controller/deptBalance/DeptBalanceController.java

@@ -6,14 +6,18 @@ import com.ydtech.core.page.HttpResult;
 import com.ydtech.modules.admin.model.dto.DeptBalanceDto;
 import com.ydtech.modules.admin.model.dto.SysPartnerConsoleDto;
 import com.ydtech.modules.admin.model.vo.DeptBalanceVo;
+import com.ydtech.modules.admin.model.vo.KztGetDeptUtilsDto;
 import com.ydtech.modules.admin.model.vo.PartnerBalanceVo;
 import com.ydtech.modules.admin.service.DeptBalanceService;
+import com.ydtech.modules.admin.utils.KztGetDeptUtils;
 import com.ydtech.modules.admin.utils.SliceUpDateUtil;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
+import org.apache.commons.lang3.ObjectUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
+import javax.servlet.http.HttpServletRequest;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
@@ -35,10 +39,19 @@ public class DeptBalanceController {
      */
     @PostMapping("deptLeaderStatistics")
     @ApiOperation(value = "机构负责人统计")
-    public HttpResult<IPage<DeptBalanceDto>> queryDeptLeaderStatistics(@RequestBody DeptBalanceVo deptBalanceVo) {
+    public HttpResult<IPage<DeptBalanceDto>> queryDeptLeaderStatistics(@RequestBody DeptBalanceVo deptBalanceVo, HttpServletRequest httpServerRequest) {
         HashMap<String, String> map = getDateMapByType(deptBalanceVo.getDays(), deptBalanceVo.getBeginDate(), deptBalanceVo.getEndDate());
         deptBalanceVo.setBeginDate(map.get("startDate"));
         deptBalanceVo.setEndDate(map.get("endDate"));
+        KztGetDeptUtils kztGetDeptUtils = new KztGetDeptUtils();
+        KztGetDeptUtilsDto kztGetDeptUtilsDto = kztGetDeptUtils.KztGetDeptIds(httpServerRequest.getRequestURL().toString());
+        if(ObjectUtils.isNotEmpty(kztGetDeptUtilsDto)){
+            if("1".equals(kztGetDeptUtilsDto.getType())){
+                deptBalanceVo.setDeptIds(kztGetDeptUtilsDto.getIds());
+            } else if ("2".equals(kztGetDeptUtilsDto.getType())) {
+                deptBalanceVo.setUserIds(kztGetDeptUtilsDto.getIds());
+            }
+        }
         HttpResult<IPage<DeptBalanceDto>> result = deptBalanceService.queryDeptLeaderStatistics(deptBalanceVo);
         return result;
     }
@@ -51,10 +64,19 @@ public class DeptBalanceController {
      */
     @PostMapping("queryPartnerStatistics")
     @ApiOperation(value = "合伙人统计")
-    public HttpResult<IPage<SysPartnerConsoleDto>> queryPartnerStatistics(@RequestBody DeptBalanceVo deptBalanceVo) {
+    public HttpResult<IPage<SysPartnerConsoleDto>> queryPartnerStatistics(@RequestBody DeptBalanceVo deptBalanceVo, HttpServletRequest httpServerRequest) {
         HashMap<String, String> map = getDateMapByType(deptBalanceVo.getDays(), deptBalanceVo.getBeginDate(), deptBalanceVo.getEndDate());
         deptBalanceVo.setBeginDate(map.get("startDate"));
         deptBalanceVo.setEndDate(map.get("endDate"));
+        KztGetDeptUtils kztGetDeptUtils = new KztGetDeptUtils();
+        KztGetDeptUtilsDto kztGetDeptUtilsDto = kztGetDeptUtils.KztGetDeptIds(httpServerRequest.getRequestURL().toString());
+        if(ObjectUtils.isNotEmpty(kztGetDeptUtilsDto)){
+            if("1".equals(kztGetDeptUtilsDto.getType())){
+                deptBalanceVo.setDeptIds(kztGetDeptUtilsDto.getIds());
+            } else if ("2".equals(kztGetDeptUtilsDto.getType())) {
+                deptBalanceVo.setUserIds(kztGetDeptUtilsDto.getIds());
+            }
+        }
         HttpResult<IPage<SysPartnerConsoleDto>> result = deptBalanceService.queryPartnerStatistics(deptBalanceVo);
         return result;
     }
@@ -83,10 +105,19 @@ public class DeptBalanceController {
      */
     @PostMapping("walletAgent")
     @ApiOperation(value = "钱包代理人")
-    public HttpResult<IPage<SysPartnerConsoleDto>> getWalletAgent(@RequestBody DeptBalanceVo deptBalanceVo) {
+    public HttpResult<IPage<SysPartnerConsoleDto>> getWalletAgent(@RequestBody DeptBalanceVo deptBalanceVo, HttpServletRequest httpServerRequest) {
         HashMap<String, String> map = getDateMapByType(deptBalanceVo.getDays(), deptBalanceVo.getBeginDate(), deptBalanceVo.getEndDate());
         deptBalanceVo.setBeginDate(map.get("startDate"));
         deptBalanceVo.setEndDate(map.get("endDate"));
+        KztGetDeptUtils kztGetDeptUtils = new KztGetDeptUtils();
+        KztGetDeptUtilsDto kztGetDeptUtilsDto = kztGetDeptUtils.KztGetDeptIds(httpServerRequest.getRequestURL().toString());
+        if(ObjectUtils.isNotEmpty(kztGetDeptUtilsDto)){
+            if("1".equals(kztGetDeptUtilsDto.getType())){
+                deptBalanceVo.setDeptIds(kztGetDeptUtilsDto.getIds());
+            } else if ("2".equals(kztGetDeptUtilsDto.getType())) {
+                deptBalanceVo.setUserIds(kztGetDeptUtilsDto.getIds());
+            }
+        }
         IPage<SysPartnerConsoleDto> result = deptBalanceService.getWalletAgent(deptBalanceVo);
         return HttpResult.ok(result);
     }

+ 14 - 1
src/main/java/com/ydtech/modules/admin/controller/financialReceivables/FinancialReceivablesController.java

@@ -5,16 +5,20 @@ import com.ydtech.modules.admin.model.report.financialReceivables.FinancialRecei
 import com.ydtech.modules.admin.model.report.financialReceivables.FinancialReceivablesAllVo;
 import com.ydtech.modules.admin.model.report.financialReceivables.FinancialReceivablesQueryMonthVo;
 import com.ydtech.modules.admin.model.report.financialReceivables.FinancialReceivablesQueryVo;
+import com.ydtech.modules.admin.model.vo.KztGetDeptUtilsDto;
+import com.ydtech.modules.admin.utils.KztGetDeptUtils;
 import com.ydtech.modules.fnc.service.InsPlyIncomeService;
 import com.ydtech.modules.fnc.vo.InsPlyIncomeVo;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiModelProperty;
+import org.apache.commons.lang3.ObjectUtils;
 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;
 
+import javax.servlet.http.HttpServletRequest;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
@@ -43,7 +47,16 @@ public class FinancialReceivablesController {
     */
     @PostMapping("/queryDateByType")
     @ApiModelProperty(value = "获取平台私有数据列表")
-    public HttpResult<FinancialReceivablesAllVo> queryDateByType(@RequestBody FinancialReceivablesQueryVo financialReceivablesQueryVo) {
+    public HttpResult<FinancialReceivablesAllVo> queryDateByType(@RequestBody FinancialReceivablesQueryVo financialReceivablesQueryVo, HttpServletRequest httpServerRequest) {
+        KztGetDeptUtils kztGetDeptUtils = new KztGetDeptUtils();
+        KztGetDeptUtilsDto kztGetDeptUtilsDto = kztGetDeptUtils.KztGetDeptIds(httpServerRequest.getRequestURL().toString());
+        if(ObjectUtils.isNotEmpty(kztGetDeptUtilsDto)){
+            if("1".equals(kztGetDeptUtilsDto.getType())){
+                financialReceivablesQueryVo.setDeptIds(kztGetDeptUtilsDto.getIds());
+            } else if ("2".equals(kztGetDeptUtilsDto.getType())) {
+                financialReceivablesQueryVo.setUserIds(kztGetDeptUtilsDto.getIds());
+            }
+        }
         return HttpResult.ok(insPlyIncomeService.queryDateByType(financialReceivablesQueryVo));
     }
 

+ 14 - 5
src/main/java/com/ydtech/modules/admin/controller/khgl/KhglDataController.java

@@ -7,21 +7,21 @@ import com.ydtech.modules.admin.model.dto.DxReportDataDto;
 import com.ydtech.modules.admin.model.dto.GroupDto;
 import com.ydtech.modules.admin.model.dto.KhglDataDto;
 import com.ydtech.modules.admin.model.po.KztDataPermission;
-import com.ydtech.modules.admin.model.vo.DxDataVo;
-import com.ydtech.modules.admin.model.vo.DxQueryVo;
-import com.ydtech.modules.admin.model.vo.KhglDataVo;
-import com.ydtech.modules.admin.model.vo.KztDataPermissionVo;
+import com.ydtech.modules.admin.model.vo.*;
 import com.ydtech.modules.admin.service.DxDataService;
 import com.ydtech.modules.admin.service.KhglZgdDataService;
 import com.ydtech.modules.admin.service.KhglZzbDataService;
+import com.ydtech.modules.admin.utils.KztGetDeptUtils;
 import com.ydtech.modules.admin.utils.SliceUpDateUtil;
 import com.ydtech.modules.order.entity.BasePageResult;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
+import org.apache.commons.lang3.ObjectUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
+import javax.servlet.http.HttpServletRequest;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.HashMap;
@@ -126,7 +126,16 @@ public class KhglDataController {
      */
     @PostMapping("/queryDxDataPage")
     @ApiOperation(value = "查询用户所有的数据分页")
-    public HttpResult<BasePageResult<DxReportDataDto>> queryDxDataPage(@RequestBody DxQueryVo dxQueryVo){
+    public HttpResult<BasePageResult<DxReportDataDto>> queryDxDataPage(@RequestBody DxQueryVo dxQueryVo, HttpServletRequest httpServerRequest){
+        KztGetDeptUtils kztGetDeptUtils = new KztGetDeptUtils();
+        KztGetDeptUtilsDto kztGetDeptUtilsDto = kztGetDeptUtils.KztGetDeptIds(httpServerRequest.getRequestURL().toString());
+        if(ObjectUtils.isNotEmpty(kztGetDeptUtilsDto)){
+            if("1".equals(kztGetDeptUtilsDto.getType())){
+                dxQueryVo.setDeptIds(kztGetDeptUtilsDto.getIds());
+            } else if ("2".equals(kztGetDeptUtilsDto.getType())) {
+                dxQueryVo.setUserIds(kztGetDeptUtilsDto.getIds());
+            }
+        }
         HashMap<String, String> map = getDateMapByType(dxQueryVo.getType(), dxQueryVo.getBeginDate(), dxQueryVo.getEndDate(),"2");
         dxQueryVo.setBeginDate(map.get("startDate"));
         dxQueryVo.setEndDate(map.get("endDate"));

+ 34 - 4
src/main/java/com/ydtech/modules/admin/controller/personnelStatistics/PersonnelStatisticsController.java

@@ -6,15 +6,19 @@ import com.ydtech.modules.admin.model.dto.EsmUserReferrerDTO;
 import com.ydtech.modules.admin.model.dto.QxFrontlineAgentDto;
 import com.ydtech.modules.admin.model.dto.TeamManagementDto;
 import com.ydtech.modules.admin.model.vo.HouLinePersonnelReportVo;
+import com.ydtech.modules.admin.model.vo.KztGetDeptUtilsDto;
 import com.ydtech.modules.admin.model.vo.QxFrontlineAgentVo;
 import com.ydtech.modules.admin.service.SysDeptService;
 import com.ydtech.modules.admin.service.UserReportService;
+import com.ydtech.modules.admin.utils.KztGetDeptUtils;
 import com.ydtech.modules.esm.model.vo.EsmUserCountVO;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
+import org.apache.commons.lang3.ObjectUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
+import javax.servlet.http.HttpServletRequest;
 import java.util.HashMap;
 import java.util.List;
 
@@ -59,8 +63,16 @@ public class PersonnelStatisticsController {
      */
     @PostMapping("queryQxFrontlineAgent")
     @ApiOperation(value = "人员统计-前线人员-代理人统计")
-    public HttpResult<IPage<QxFrontlineAgentDto>> queryQxFrontlineAgent(@RequestBody QxFrontlineAgentVo qxFrontlineAgentVo) {
-
+    public HttpResult<IPage<QxFrontlineAgentDto>> queryQxFrontlineAgent(@RequestBody QxFrontlineAgentVo qxFrontlineAgentVo, HttpServletRequest httpServerRequest) {
+        KztGetDeptUtils kztGetDeptUtils = new KztGetDeptUtils();
+        KztGetDeptUtilsDto kztGetDeptUtilsDto = kztGetDeptUtils.KztGetDeptIds(httpServerRequest.getRequestURL().toString());
+        if(ObjectUtils.isNotEmpty(kztGetDeptUtilsDto)){
+            if("1".equals(kztGetDeptUtilsDto.getType())){
+                qxFrontlineAgentVo.setDeptIds(kztGetDeptUtilsDto.getIds());
+            } else if ("2".equals(kztGetDeptUtilsDto.getType())) {
+                qxFrontlineAgentVo.setUserIds(kztGetDeptUtilsDto.getIds());
+            }
+        }
         HttpResult<IPage<QxFrontlineAgentDto>> result = userReportService.queryQxFrontlineAgent(qxFrontlineAgentVo);
         return result;
     }
@@ -73,8 +85,17 @@ public class PersonnelStatisticsController {
      */
     @PostMapping("queryQxFrontlineAgentRanking")
     @ApiOperation(value = "人员统计-前线人员-代理人统计-团队排名")
-    public HttpResult<List<QxFrontlineAgentDto>> queryQxFrontlineAgentRanking(@RequestBody QxFrontlineAgentVo qxFrontlineAgentVo) {
+    public HttpResult<List<QxFrontlineAgentDto>> queryQxFrontlineAgentRanking(@RequestBody QxFrontlineAgentVo qxFrontlineAgentVo, HttpServletRequest httpServerRequest) {
         try{
+            KztGetDeptUtils kztGetDeptUtils = new KztGetDeptUtils();
+            KztGetDeptUtilsDto kztGetDeptUtilsDto = kztGetDeptUtils.KztGetDeptIds(httpServerRequest.getRequestURL().toString());
+            if(ObjectUtils.isNotEmpty(kztGetDeptUtilsDto)){
+                if("1".equals(kztGetDeptUtilsDto.getType())){
+                    qxFrontlineAgentVo.setDeptIds(kztGetDeptUtilsDto.getIds());
+                } else if ("2".equals(kztGetDeptUtilsDto.getType())) {
+                    qxFrontlineAgentVo.setUserIds(kztGetDeptUtilsDto.getIds());
+                }
+            }
             List<QxFrontlineAgentDto> result = userReportService.queryQxFrontlineAgentRanking(qxFrontlineAgentVo);
             return HttpResult.ok("查询数据成功", result);
         }catch (Exception e){
@@ -103,7 +124,16 @@ public class PersonnelStatisticsController {
      */
     @PostMapping("queryChannelDetails")
     @ApiOperation(value = "人员统计-前线人员-渠道明细")
-    public HttpResult<List<QxFrontlineAgentDto>> queryChannelDetails(@RequestBody QxFrontlineAgentVo qxFrontlineAgentVo) {
+    public HttpResult<List<QxFrontlineAgentDto>> queryChannelDetails(@RequestBody QxFrontlineAgentVo qxFrontlineAgentVo,HttpServletRequest httpServerRequest) {
+        KztGetDeptUtils kztGetDeptUtils = new KztGetDeptUtils();
+        KztGetDeptUtilsDto kztGetDeptUtilsDto = kztGetDeptUtils.KztGetDeptIds(httpServerRequest.getRequestURL().toString());
+        if(ObjectUtils.isNotEmpty(kztGetDeptUtilsDto)){
+            if("1".equals(kztGetDeptUtilsDto.getType())){
+                qxFrontlineAgentVo.setDeptIds(kztGetDeptUtilsDto.getIds());
+            } else if ("2".equals(kztGetDeptUtilsDto.getType())) {
+                qxFrontlineAgentVo.setUserIds(kztGetDeptUtilsDto.getIds());
+            }
+        }
         HttpResult<List<QxFrontlineAgentDto>> result = userReportService.queryChannelDetails(qxFrontlineAgentVo);
         return result;
     }

+ 15 - 4
src/main/java/com/ydtech/modules/admin/controller/quoteCount/QuoteCountController.java

@@ -3,16 +3,21 @@ package com.ydtech.modules.admin.controller.quoteCount;
 import com.ydtech.core.page.HttpResult;
 import com.ydtech.modules.admin.model.report.company.CompanyQutationCountDataDto;
 import com.ydtech.modules.admin.model.report.company.CompanyQutationCountDataQueryDto;
+import com.ydtech.modules.admin.model.vo.KztGetDeptUtilsDto;
 import com.ydtech.modules.admin.service.CompanyDataReportService;
+import com.ydtech.modules.admin.utils.KztGetDeptUtils;
 import com.ydtech.modules.order.entity.BasePageResult;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
+import org.apache.commons.lang3.ObjectUtils;
 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;
 
+import javax.servlet.http.HttpServletRequest;
+
 /**
  *  @version
  *  @author: hxl
@@ -35,15 +40,21 @@ public class QuoteCountController {
      */
     @PostMapping("queryCompanyQutationCountDataPage")
     @ApiOperation(value = "查询报价次数数据")
-    public HttpResult<BasePageResult<CompanyQutationCountDataDto>> queryCompanyQutationCountDataPage(@RequestBody CompanyQutationCountDataQueryDto companyQutationCountDataQueryDto) {
+    public HttpResult<BasePageResult<CompanyQutationCountDataDto>> queryCompanyQutationCountDataPage(@RequestBody CompanyQutationCountDataQueryDto companyQutationCountDataQueryDto, HttpServletRequest httpServerRequest) {
         try{
+            KztGetDeptUtils kztGetDeptUtils = new KztGetDeptUtils();
+            KztGetDeptUtilsDto kztGetDeptUtilsDto = kztGetDeptUtils.KztGetDeptIds(httpServerRequest.getRequestURL().toString());
+            if(ObjectUtils.isNotEmpty(kztGetDeptUtilsDto)){
+                if("1".equals(kztGetDeptUtilsDto.getType())){
+                    companyQutationCountDataQueryDto.setDeptIds(kztGetDeptUtilsDto.getIds());
+                } else if ("2".equals(kztGetDeptUtilsDto.getType())) {
+                    companyQutationCountDataQueryDto.setUserIds(kztGetDeptUtilsDto.getIds());
+                }
+            }
             BasePageResult<CompanyQutationCountDataDto> result = companyDataReportService.queryCompanyQutationCountDataPage(companyQutationCountDataQueryDto);
             return HttpResult.ok("查询数据成功", result);
         }catch (Exception e){
             return HttpResult.error("查询错误"+e.getMessage());
         }
     }
-
-
-
 }

+ 84 - 8
src/main/java/com/ydtech/modules/admin/controller/taskStatistics/TaskStatisticsController.java

@@ -5,15 +5,19 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.ydtech.core.page.HttpResult;
 import com.ydtech.modules.admin.model.dto.TaskStatisticsDto;
 import com.ydtech.modules.admin.model.vo.BusinessAgentData;
+import com.ydtech.modules.admin.model.vo.KztGetDeptUtilsDto;
 import com.ydtech.modules.admin.model.vo.TaskStatisticsVo;
 import com.ydtech.modules.admin.service.TaskStatisticsService;
+import com.ydtech.modules.admin.utils.KztGetDeptUtils;
 import io.swagger.annotations.*;
+import org.apache.commons.lang3.ObjectUtils;
 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;
 
+import javax.servlet.http.HttpServletRequest;
 import java.util.List;
 
 /**
@@ -35,8 +39,17 @@ public class TaskStatisticsController {
      **/
     @PostMapping("queryPage")
     @ApiOperation(value = "控制台-渠道任务统计查询")
-    public HttpResult<IPage<TaskStatisticsDto>> queryPage(@RequestBody TaskStatisticsVo taskStatisticsVo) {
+    public HttpResult<IPage<TaskStatisticsDto>> queryPage(@RequestBody TaskStatisticsVo taskStatisticsVo, HttpServletRequest httpServerRequest) {
         try{
+            KztGetDeptUtils kztGetDeptUtils = new KztGetDeptUtils();
+            KztGetDeptUtilsDto kztGetDeptUtilsDto = kztGetDeptUtils.KztGetDeptIds(httpServerRequest.getRequestURL().toString());
+            if(ObjectUtils.isNotEmpty(kztGetDeptUtilsDto)){
+                if("1".equals(kztGetDeptUtilsDto.getType())){
+                    taskStatisticsVo.setDeptIds(kztGetDeptUtilsDto.getIds());
+                } else if ("2".equals(kztGetDeptUtilsDto.getType())) {
+                    taskStatisticsVo.setUserIds(kztGetDeptUtilsDto.getIds());
+                }
+            }
             IPage<TaskStatisticsDto> result = taskStatisticsService.queryPage(taskStatisticsVo);
             return HttpResult.ok("查询数据成功", result);
         }catch (Exception e){
@@ -51,8 +64,17 @@ public class TaskStatisticsController {
      **/
     @PostMapping("insuranceCompanyQueryPage")
     @ApiOperation(value = "控制台-保险公司统计查询")
-    public HttpResult<IPage<TaskStatisticsDto>> insuranceCompanyQueryPage(@RequestBody TaskStatisticsVo taskStatisticsVo) {
+    public HttpResult<IPage<TaskStatisticsDto>> insuranceCompanyQueryPage(@RequestBody TaskStatisticsVo taskStatisticsVo, HttpServletRequest httpServerRequest) {
         try{
+            KztGetDeptUtils kztGetDeptUtils = new KztGetDeptUtils();
+            KztGetDeptUtilsDto kztGetDeptUtilsDto = kztGetDeptUtils.KztGetDeptIds(httpServerRequest.getRequestURL().toString());
+            if(ObjectUtils.isNotEmpty(kztGetDeptUtilsDto)){
+                if("1".equals(kztGetDeptUtilsDto.getType())){
+                    taskStatisticsVo.setDeptIds(kztGetDeptUtilsDto.getIds());
+                } else if ("2".equals(kztGetDeptUtilsDto.getType())) {
+                    taskStatisticsVo.setUserIds(kztGetDeptUtilsDto.getIds());
+                }
+            }
             IPage<TaskStatisticsDto> result = taskStatisticsService.insuranceCompanyQueryPage(taskStatisticsVo);
             return HttpResult.ok("查询数据成功", result);
         }catch (Exception e){
@@ -67,8 +89,17 @@ public class TaskStatisticsController {
      **/
     @PostMapping("agentStatisticsQueryPage")
     @ApiOperation(value = "控制台-代理人统计查询")
-    public HttpResult<IPage<TaskStatisticsDto>> agentStatisticsQueryPage(@RequestBody TaskStatisticsVo taskStatisticsVo) {
+    public HttpResult<IPage<TaskStatisticsDto>> agentStatisticsQueryPage(@RequestBody TaskStatisticsVo taskStatisticsVo, HttpServletRequest httpServerRequest) {
         try{
+            KztGetDeptUtils kztGetDeptUtils = new KztGetDeptUtils();
+            KztGetDeptUtilsDto kztGetDeptUtilsDto = kztGetDeptUtils.KztGetDeptIds(httpServerRequest.getRequestURL().toString());
+            if(ObjectUtils.isNotEmpty(kztGetDeptUtilsDto)){
+                if("1".equals(kztGetDeptUtilsDto.getType())){
+                    taskStatisticsVo.setDeptIds(kztGetDeptUtilsDto.getIds());
+                } else if ("2".equals(kztGetDeptUtilsDto.getType())) {
+                    taskStatisticsVo.setUserIds(kztGetDeptUtilsDto.getIds());
+                }
+            }
             IPage<TaskStatisticsDto> result = taskStatisticsService.agentStatisticsQueryPage(taskStatisticsVo);
             return HttpResult.ok("查询数据成功", result);
         }catch (Exception e){
@@ -95,8 +126,17 @@ public class TaskStatisticsController {
      **/
     @PostMapping("costCenter")
     @ApiOperation(value = "控制台-财务中心-费用校验")
-    public HttpResult<IPage<TaskStatisticsDto>> costCenter(@RequestBody TaskStatisticsVo taskStatisticsVo) {
+    public HttpResult<IPage<TaskStatisticsDto>> costCenter(@RequestBody TaskStatisticsVo taskStatisticsVo, HttpServletRequest httpServerRequest) {
         try{
+            KztGetDeptUtils kztGetDeptUtils = new KztGetDeptUtils();
+            KztGetDeptUtilsDto kztGetDeptUtilsDto = kztGetDeptUtils.KztGetDeptIds(httpServerRequest.getRequestURL().toString());
+            if(ObjectUtils.isNotEmpty(kztGetDeptUtilsDto)){
+                if("1".equals(kztGetDeptUtilsDto.getType())){
+                    taskStatisticsVo.setDeptIds(kztGetDeptUtilsDto.getIds());
+                } else if ("2".equals(kztGetDeptUtilsDto.getType())) {
+                    taskStatisticsVo.setUserIds(kztGetDeptUtilsDto.getIds());
+                }
+            }
             IPage<TaskStatisticsDto> result = taskStatisticsService.costCenter(taskStatisticsVo);
             return HttpResult.ok("查询数据成功", result);
         }catch (Exception e){
@@ -139,8 +179,17 @@ public class TaskStatisticsController {
      **/
     @PostMapping("getBusinessData")
     @ApiOperation(value = "控制台-业务数据")
-    public HttpResult<IPage<TaskStatisticsDto>> getBusinessData(@RequestBody TaskStatisticsVo taskStatisticsVo) {
+    public HttpResult<IPage<TaskStatisticsDto>> getBusinessData(@RequestBody TaskStatisticsVo taskStatisticsVo, HttpServletRequest httpServerRequest) {
         try{
+            KztGetDeptUtils kztGetDeptUtils = new KztGetDeptUtils();
+            KztGetDeptUtilsDto kztGetDeptUtilsDto = kztGetDeptUtils.KztGetDeptIds(httpServerRequest.getRequestURL().toString());
+            if(ObjectUtils.isNotEmpty(kztGetDeptUtilsDto)){
+                if("1".equals(kztGetDeptUtilsDto.getType())){
+                    taskStatisticsVo.setDeptIds(kztGetDeptUtilsDto.getIds());
+                } else if ("2".equals(kztGetDeptUtilsDto.getType())) {
+                    taskStatisticsVo.setUserIds(kztGetDeptUtilsDto.getIds());
+                }
+            }
             IPage<TaskStatisticsDto> result = taskStatisticsService.getBusinessData(taskStatisticsVo);
             return HttpResult.ok("查询数据成功", result);
         }catch (Exception e){
@@ -155,8 +204,17 @@ public class TaskStatisticsController {
      **/
     @PostMapping("getDistribution")
     @ApiOperation(value = "控制台-业务数据-保险分布")
-    public HttpResult<List<TaskStatisticsDto>> getDistribution(@RequestBody TaskStatisticsVo taskStatisticsVo) {
+    public HttpResult<List<TaskStatisticsDto>> getDistribution(@RequestBody TaskStatisticsVo taskStatisticsVo, HttpServletRequest httpServerRequest) {
         try{
+            KztGetDeptUtils kztGetDeptUtils = new KztGetDeptUtils();
+            KztGetDeptUtilsDto kztGetDeptUtilsDto = kztGetDeptUtils.KztGetDeptIds(httpServerRequest.getRequestURL().toString());
+            if(ObjectUtils.isNotEmpty(kztGetDeptUtilsDto)){
+                if("1".equals(kztGetDeptUtilsDto.getType())){
+                    taskStatisticsVo.setDeptIds(kztGetDeptUtilsDto.getIds());
+                } else if ("2".equals(kztGetDeptUtilsDto.getType())) {
+                    taskStatisticsVo.setUserIds(kztGetDeptUtilsDto.getIds());
+                }
+            }
             List<TaskStatisticsDto> result = taskStatisticsService.getDistribution(taskStatisticsVo);
             return HttpResult.ok("查询数据成功", result);
         }catch (Exception e){
@@ -181,8 +239,17 @@ public class TaskStatisticsController {
      **/
     @PostMapping("getBusinessAgentData")
     @ApiOperation(value = "控制台-业务数据-代理人")
-    public HttpResult<IPage<BusinessAgentData>> getBusinessAgentData(@RequestBody TaskStatisticsVo taskStatisticsVo) {
+    public HttpResult<IPage<BusinessAgentData>> getBusinessAgentData(@RequestBody TaskStatisticsVo taskStatisticsVo, HttpServletRequest httpServerRequest) {
         try{
+            KztGetDeptUtils kztGetDeptUtils = new KztGetDeptUtils();
+            KztGetDeptUtilsDto kztGetDeptUtilsDto = kztGetDeptUtils.KztGetDeptIds(httpServerRequest.getRequestURL().toString());
+            if(ObjectUtils.isNotEmpty(kztGetDeptUtilsDto)){
+                if("1".equals(kztGetDeptUtilsDto.getType())){
+                    taskStatisticsVo.setDeptIds(kztGetDeptUtilsDto.getIds());
+                } else if ("2".equals(kztGetDeptUtilsDto.getType())) {
+                    taskStatisticsVo.setUserIds(kztGetDeptUtilsDto.getIds());
+                }
+            }
             IPage<BusinessAgentData> result = taskStatisticsService.getBusinessAgentData(taskStatisticsVo);
             return HttpResult.ok("查询数据成功", result);
         }catch (Exception e){
@@ -197,8 +264,17 @@ public class TaskStatisticsController {
      **/
     @PostMapping("getBusinessAgentDataTotal")
     @ApiOperation(value = "控制台-业务数据-代理人-合计")
-    public HttpResult<BusinessAgentData> getBusinessAgentDataTotal(@RequestBody TaskStatisticsVo taskStatisticsVo) {
+    public HttpResult<BusinessAgentData> getBusinessAgentDataTotal(@RequestBody TaskStatisticsVo taskStatisticsVo, HttpServletRequest httpServerRequest) {
         try{
+            KztGetDeptUtils kztGetDeptUtils = new KztGetDeptUtils();
+            KztGetDeptUtilsDto kztGetDeptUtilsDto = kztGetDeptUtils.KztGetDeptIds(httpServerRequest.getRequestURL().toString());
+            if(ObjectUtils.isNotEmpty(kztGetDeptUtilsDto)){
+                if("1".equals(kztGetDeptUtilsDto.getType())){
+                    taskStatisticsVo.setDeptIds(kztGetDeptUtilsDto.getIds());
+                } else if ("2".equals(kztGetDeptUtilsDto.getType())) {
+                    taskStatisticsVo.setUserIds(kztGetDeptUtilsDto.getIds());
+                }
+            }
             BusinessAgentData result = taskStatisticsService.getBusinessAgentDataTotal(taskStatisticsVo);
             return HttpResult.ok("查询数据成功", result);
         }catch (Exception e){

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

@@ -4,6 +4,8 @@ import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
+import java.util.List;
+
 /**
  *  @version
  *  @author: hxl
@@ -65,5 +67,10 @@ public class AgreeReportQueryDto {
     @ApiModelProperty(value = "门店机构id")
     private String houseId;
 
+    @ApiModelProperty(value = "用户ids")
+    private List<String> userIds;
+
+    @ApiModelProperty(value = "部门ids")
+    private List<String> deptIds;
 
 }

+ 4 - 0
src/main/java/com/ydtech/modules/admin/model/dto/QxFrontlineAgentDto.java

@@ -120,7 +120,11 @@ public class QxFrontlineAgentDto implements Serializable {
     @ApiModelProperty(value = "省部门名称")
     private String provinceName;
 
+    @ApiModelProperty(value = "部门ids")
+    private List<String> deptIds;
 
+    @ApiModelProperty(value = "用户ids")
+    private List<String> userIds;
 
     private Integer totalManpowerNum;
 

+ 8 - 0
src/main/java/com/ydtech/modules/admin/model/report/company/CompanyQutationCountDataQueryDto.java

@@ -4,6 +4,8 @@ import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
+import java.util.List;
+
 /**
  *  @version
  *  @author: hxl
@@ -55,5 +57,11 @@ public class CompanyQutationCountDataQueryDto {
     @ApiModelProperty("部门id")
     private String  deptId;
 
+    @ApiModelProperty(value = "部门ids")
+    private List<String> deptIds;
+
+    @ApiModelProperty(value = "用户ids")
+    private List<String> userIds;
+
 
 }

+ 9 - 0
src/main/java/com/ydtech/modules/admin/model/report/financialReceivables/FinancialReceivablesQueryVo.java

@@ -5,6 +5,8 @@ import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
+import java.util.List;
+
 /**
  *  @version 
  *  @author: hxl
@@ -30,4 +32,11 @@ public class FinancialReceivablesQueryVo {
     @ApiModelProperty("是否是非车  0  不是 1 是")
     private String  isNotCar;
 
+    @ApiModelProperty(value = "部门ids")
+    private List<String> deptIds;
+
+    @ApiModelProperty(value = "用户ids")
+    private List<String> userIds;
+
+
 }

+ 6 - 0
src/main/java/com/ydtech/modules/admin/model/vo/DeptBalanceVo.java

@@ -60,6 +60,12 @@ public class DeptBalanceVo implements Serializable {
     @ApiModelProperty(value = "天数")
     private String  days;
 
+    @ApiModelProperty(value = "部门ids")
+    private List<String> deptIds;
+
+    @ApiModelProperty(value = "用户ids")
+    private List<String> userIds;
+
 
 
 }

+ 7 - 0
src/main/java/com/ydtech/modules/admin/model/vo/DxQueryVo.java

@@ -4,6 +4,7 @@ import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
 import javax.validation.constraints.Min;
+import java.util.List;
 
 /**
  *  @version
@@ -44,4 +45,10 @@ public class DxQueryVo {
     @ApiModelProperty(value = "页数")
     @Min(value = 1, message = "页数最小为1")
     private int pageNum;
+
+    @ApiModelProperty(value = "部门ids")
+    private List<String> deptIds;
+
+    @ApiModelProperty(value = "用户ids")
+    private List<String> userIds;
 }

+ 15 - 0
src/main/java/com/ydtech/modules/admin/model/vo/KztGetDeptUtilsDto.java

@@ -0,0 +1,15 @@
+package com.ydtech.modules.admin.model.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.List;
+
+@Data
+public class KztGetDeptUtilsDto  implements Serializable {
+    @ApiModelProperty(value = "返回类型")
+    private String type;
+    @ApiModelProperty
+    private List<String> ids;
+}

+ 7 - 0
src/main/java/com/ydtech/modules/admin/model/vo/OrdersDataVo.java

@@ -5,6 +5,8 @@ import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
+import java.util.List;
+
 /**
  *  @version
  *  @author: whp
@@ -67,4 +69,9 @@ public class OrdersDataVo {
 
     @ApiModelProperty("年份")
     private String year;
+
+    @ApiModelProperty(value = "部门ids")
+    private List<String> deptIds;
+    @ApiModelProperty(value = "用户ids")
+    private List<String> userIds;
 }

+ 6 - 0
src/main/java/com/ydtech/modules/admin/model/vo/QxFrontlineAgentVo.java

@@ -81,5 +81,11 @@ public class QxFrontlineAgentVo implements Serializable {
     @ApiModelProperty(value = "层级类型  0 汇总  1.本人  2. 一级团队 3. 二级团队  4 三级团队  5 临时团队")
     private String type;
 
+    @ApiModelProperty(value = "用户ids")
+    private List<String> userIds;
+
+    @ApiModelProperty(value = "部门ids")
+    private List<String> deptIds;
+
 
 }

+ 2 - 1
src/main/java/com/ydtech/modules/admin/model/vo/TaskStatisticsVo.java

@@ -96,7 +96,8 @@ public class TaskStatisticsVo implements Serializable {
 
     @ApiModelProperty(value = "是否app,pc报价")
     private String orderSource;
-
+    @ApiModelProperty(value = "部门ids")
+    private List<String> deptIds;
 
 
 

+ 5 - 1
src/main/java/com/ydtech/modules/admin/service/SysDeptService.java

@@ -125,7 +125,11 @@ public interface SysDeptService extends IService<SysDept> {
      * @return ture 一致 false 不一致
      */
     boolean contrastiveManagementSource(String orderNo, String managementSource);
-
+    /**
+     * 数据权限机构数
+     * @return
+     */
+    List<SysDept> getDataDeptTree(List<String> deptIds);
 }
 
 

+ 5 - 0
src/main/java/com/ydtech/modules/admin/service/SysUserService.java

@@ -242,6 +242,11 @@ public interface SysUserService extends BaseIService<SysUser> {
      * @return
      */
     List<String> getTelemarketingPersonnelData();
+    /**
+     * 获取当前用户的下级所有人员
+     * @return
+     */
+    List<SysUser> findNextTree();
 
 
 }

+ 90 - 0
src/main/java/com/ydtech/modules/admin/service/impl/SysDeptServiceImpl.java

@@ -14,6 +14,7 @@ import com.ydtech.modules.admin.dao.SysAreaMapper;
 import com.ydtech.modules.admin.dao.SysDeptMapper;
 import com.ydtech.modules.admin.model.SysArea;
 import com.ydtech.modules.admin.model.SysDept;
+import com.ydtech.modules.admin.model.report.financialReceivables.FinancialReceivablesMonthVo;
 import com.ydtech.modules.admin.model.vo.SysDeptRemoveVo;
 import com.ydtech.modules.admin.model.SysUser;
 import com.ydtech.modules.admin.model.po.SysUserTreeShowLevel;
@@ -33,6 +34,7 @@ import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.ObjectUtils;
 
 import java.util.*;
+import java.util.function.Function;
 import java.util.stream.Collectors;
 
 
@@ -649,7 +651,95 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept>
         String managementSourceDept = sysDeptMapper.getByOrderNoQueryManagementSource(orderNo);
         return managementSource.equals(managementSourceDept);
     }
+    /**
+     * 数据权限机构数
+     * @return
+     */
+    @Override
+    public List<SysDept> getDataDeptTree(List<String> deptIds) {
+        String name = BaseController.getUser().getName();
+        List<SysDept> result = new ArrayList<>();
+        if(!deptIds.isEmpty()){
+            List<SysDept> deptList = sysDeptMapper.getListByIds(deptIds);
+            // 使用一个Map来快速查找部门节点
+            Map<String, SysDept> deptMap = new HashMap<>();
+            for (SysDept dept : deptList) {
+                deptMap.put(dept.getId(), dept);
+            }
+            // 找出顶级部门(即没有父部门的部门)
+            for (SysDept dept : deptList) {
+                if (dept.getParentId() == null || deptMap.get(dept.getParentId()) == null) {
+                    // 添加到结果列表并构建其子树
+                    buildDeptTree(dept, deptMap);
+                    result.add(dept);
+                }
+            }
 
+        } else if ("admin".equals(name)) {
+           String  deptId ="9";
+            if(deptId==null || "".equals(deptId)){
+                deptId="9";
+            }else{
+                //如果是平台下判断包含D的查询上级id
+                if(deptId.contains("D")){
+                    SysDept dept = baseMapper.selectById(deptId);
+                    deptId =dept==null?"":dept.getParentId();
+                }
+            }
+            LambdaQueryWrapper<SysDept> queryWrapper = new LambdaQueryWrapper<>();
+            queryWrapper.eq(SysDept::getDelFlag, 0);
+            // 获取当前操作用户
+            SysUser user = BaseController.getUser();
+            String userId = user.getId();
+
+            // 根据用户ID查询用户的部门树展示级别
+            LambdaQueryWrapper<SysUserTreeShowLevel> lambdaQueryWrapper = new LambdaQueryWrapper<>();
+            lambdaQueryWrapper.eq(SysUserTreeShowLevel::getUserId, userId);
+            SysUserTreeShowLevel treeShowLevel = sysUserTreeShowLevelService.getOne(lambdaQueryWrapper);
+
+            List<SysDept> treeByShowLevel = new ArrayList<>();
+            //如果当前用户未配置树展示等级,则默认为查询全部
+            if (Objects.isNull(treeShowLevel)) {
+                treeShowLevel = new SysUserTreeShowLevel();
+                treeShowLevel.setShowLevel("subordinate");
+            }
+            // 如果指定的部门ID为空或特定值,则使用当前用户所在部门ID
+            if (null == deptId || "".equals(deptId) || "undefined".equals(deptId)) {
+                if (!treeShowLevel.getShowLevel().equals("all")) {
+                    deptId = user.getDeptId();
+                } else {
+                    deptId = "9";
+                }
+            }
+            // 根据用户的部门树展示级别查询相应的部门树
+            switch (treeShowLevel.getShowLevel()) {
+                case "all":
+                    treeByShowLevel = findTreeByShowLevel(deptId, null, "all");
+                    break;
+                case "same":
+                    treeByShowLevel = findTreeByShowLevel(deptId, null, "same");
+                    break;
+                case "subordinate":
+                    treeByShowLevel = findTreeByShowLevel(deptId, null, "subordinate");
+                    break;
+            }
+            return treeByShowLevel;
+        }
+        return result;
+    }
+
+    private void buildDeptTree(SysDept dept, Map<String, SysDept> deptMap) {
+        List<SysDept> children = new ArrayList<>();
+        dept.setChildren(children);
+
+        // 查找并添加子部门
+        for (SysDept potentialChild : deptMap.values()) {
+            if (potentialChild.getParentId() != null && potentialChild.getParentId().equals(dept.getId())) {
+                children.add(potentialChild);
+                buildDeptTree(potentialChild, deptMap); // 递归构建子部门的子树
+            }
+        }
+    }
 }
 
 

+ 21 - 0
src/main/java/com/ydtech/modules/admin/service/impl/SysUserServiceImpl.java

@@ -1611,4 +1611,25 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
         return baseMapper.getTelemarketingPersonnelUserId();
     }
 
+    @Override
+    public List<SysUser> findNextTree() {
+//        findTree
+        // 获取当前登录用户
+        SysUser user = BaseController.getUser();
+        if ("admin".equals(user.getName())) {
+            return this.findTree();
+        } else {
+            //获取领导字段不为空的人的ID
+            List<SysUser> users = lambdaQuery().isNotNull(SysUser::getLeaderId).list();
+            if (users == null || users.size() == 0) {
+                return new ArrayList<>();
+            }
+            List<SysUser> topUsers = new ArrayList<>(); //存放1级用户,即没有直接上级的用户
+            // 根据组织结构展示级别,筛选顶层节点并构建组织结构树
+            topUsers.add(user);
+            // 递归构建用户树结构
+            buildUserTree(topUsers, users);
+            return topUsers;
+        }
+    }
 }

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

@@ -270,7 +270,7 @@ public class TaskStatisticsServiceImpl  implements TaskStatisticsService {
                 taskStatisticsVo.setDateType("2");
             } else if ("30".equals(taskStatisticsVo.getDays())) {
                 taskStatisticsVo.setDateType("3");
-            } else {
+            } else if ("1".equals(taskStatisticsVo.getDays())){
                 taskStatisticsVo.setDateType("1");
             }
         }

+ 44 - 23
src/main/java/com/ydtech/modules/admin/utils/KztGetDeptUtils.java

@@ -5,7 +5,11 @@ import com.ydtech.modules.admin.dao.KztDataPermissionMapper;
 import com.ydtech.modules.admin.dao.SysUserDeptRelationshipMapper;
 import com.ydtech.modules.admin.model.po.KztDataPermission;
 import com.ydtech.modules.admin.model.po.SysUserDeptRelationship;
+import com.ydtech.modules.admin.model.po.SysUserTreeShowLevel;
+import com.ydtech.modules.admin.model.vo.KztGetDeptUtilsDto;
+import com.ydtech.modules.admin.service.SysUserService;
 import com.ydtech.modules.base.controller.BaseController;
+import com.ydtech.modules.esm.service.EsmUserReferrerService;
 import com.ydtech.utils.StringUtils;
 import org.apache.commons.lang3.ObjectUtils;
 import org.springframework.beans.BeanUtils;
@@ -28,42 +32,59 @@ public class KztGetDeptUtils {
     private SysUserDeptRelationshipMapper sysUserDeptRelationshipMapper;
     @Autowired
     private KztDataPermissionMapper kztDataPermissionMapper;
+    @Autowired
+    private SysUserService sysUserService;
+    @Autowired
+    private EsmUserReferrerService  esmUserReferrerService;
 
 
 
-    public List<String> KztGetDeptIds(String requestURL) {
+    public KztGetDeptUtilsDto KztGetDeptIds(String requestURL) {
         try {
             ApplicationContext applicationContext = SpringContextUtil.getApplicationContext();
-            SysUserDeptRelationshipMapper bean = applicationContext.getBean(SysUserDeptRelationshipMapper.class);
-            ApplicationContext applicationContext2 = SpringContextUtil.getApplicationContext();
-            KztDataPermissionMapper bean1 = applicationContext2.getBean(KztDataPermissionMapper.class);
-
+            SysUserDeptRelationshipMapper userDeptMapper = applicationContext.getBean(SysUserDeptRelationshipMapper.class);
+            KztDataPermissionMapper dataPermissionMapper = applicationContext.getBean(KztDataPermissionMapper.class);
 
             URI uri = new URI(requestURL);
             String path = uri.getPath();
-            QueryWrapper<KztDataPermission> queryWrapper = new QueryWrapper<>();
-            queryWrapper.eq("url", path);
+            KztDataPermission kztDataPermissions = dataPermissionMapper.selectOne(new QueryWrapper<KztDataPermission>().eq("url", path));
 
-            KztDataPermission kztDataPermissions = bean1.selectOne(queryWrapper);
-            String userId = BaseController.getUserId();
-            if (ObjectUtils.isNotEmpty(kztDataPermissions)) {
-                QueryWrapper<SysUserDeptRelationship> relationshipQueryWrapper = new QueryWrapper<>();//用户权限关系表
-                relationshipQueryWrapper.eq("user_id", userId);
-                List<SysUserDeptRelationship> sysUserDeptRelationships = bean.selectList(relationshipQueryWrapper);
-                if (sysUserDeptRelationships.isEmpty()) {
-                    return new ArrayList<>();
-                }
-                String dataPermissionId = kztDataPermissions.getDataPermissionId();
-                if (StringUtils.isNotEmpty(dataPermissionId)) {
-                    if ("1".equals(dataPermissionId)) {
-                        List<String> collect = sysUserDeptRelationships.stream().map(SysUserDeptRelationship::getDeptId).collect(Collectors.toList());
-                        return collect;
-                    }
+            if (kztDataPermissions != null) {
+                String userId = BaseController.getUserId();
+                String userName = BaseController.getUserName();
+                if(!"admin".equals(userName)){
+                    String dataPermissionId = kztDataPermissions.getDataPermissionId();
+                    KztGetDeptUtilsDto resultDto = handleDataPermission(userId, dataPermissionId, userDeptMapper);
+                    return resultDto;
                 }
             }
         } catch (URISyntaxException e) {
+            // 可以选择抛出自定义异常或记录更详细的日志
             e.printStackTrace();
         }
-        return new ArrayList<>();
+        return new KztGetDeptUtilsDto(); // 返回一个空的DTO或设置默认值的DTO
+    }
+
+    private KztGetDeptUtilsDto handleDataPermission(String userId, String dataPermissionId, SysUserDeptRelationshipMapper userDeptMapper) {
+        KztGetDeptUtilsDto resultDto = new KztGetDeptUtilsDto();
+        if ("1".equals(dataPermissionId)) {
+            List<SysUserDeptRelationship> relationships = userDeptMapper.selectList(new QueryWrapper<SysUserDeptRelationship>().eq("user_id", userId));
+            if (!relationships.isEmpty()) {
+                List<String> deptIds = relationships.stream().map(SysUserDeptRelationship::getDeptId).collect(Collectors.toList());
+                resultDto.setIds(deptIds);
+                resultDto.setType("1");
+            }
+        } else if ("3".equals(dataPermissionId)) {
+            ApplicationContext applicationContext = SpringContextUtil.getApplicationContext();
+            EsmUserReferrerService dataPermissionMapper = applicationContext.getBean(EsmUserReferrerService.class);
+
+            List<String> ids = new ArrayList<>();
+            List<String> userList = dataPermissionMapper.getUpUser(userId,ids); // 假设此方法直接返回用户列表
+            if (!userList.isEmpty()) {
+                resultDto.setIds(userList);
+                resultDto.setType("2");
+            }
+        }
+        return resultDto;
     }
 }

+ 8 - 1
src/main/java/com/ydtech/modules/fnc/dao/InsPlyIncomeMapper.java

@@ -217,5 +217,12 @@ public interface InsPlyIncomeMapper extends BaseMapper<InsPlyIncome> {
      *  @Date: 2024/9/20 11:04
      *  @Description: 通过对接人查询数据
      */
-    List<InsPlyIncomePTCompanyDto>  findListByDockingPerson(@Param("vo")  InsPlyIncomeQueryPTVo insPlyIncomeVo);
+    List<InsPlyIncomePTCompanyDto>  findListByDockingPerson(@Param("vo") InsPlyIncomeQueryPTVo insPlyIncomeVo);
+
+    /**
+     *
+     * @param params
+     * @return  合计金额
+     */
+    List<InsPlyIncome> totalBxAmountNew(HashMap<String, Object> params);
 }

+ 10 - 0
src/main/java/com/ydtech/modules/fnc/dao/InsuranceHandlingSettlementMonthMapper.java

@@ -7,6 +7,8 @@ import com.ydtech.modules.fnc.vo.InsuranceHandlingSettlementMonthVo;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 
+import java.math.BigDecimal;
+import java.util.HashMap;
 import java.util.List;
 
 /**
@@ -23,4 +25,12 @@ public interface InsuranceHandlingSettlementMonthMapper extends BaseMapper<Insur
     List<InsuranceHandlingSettlementMonthDto> queryListNew( @Param("vo") InsuranceHandlingSettlementMonthVo insuranceHandlingSettlementMonthVo);
 
 
+    /**
+     *
+     * @param insuranceHandlingSettlementMonthDto
+     * @return    返回结算金额  未结算 开票金额
+     */
+
+    HashMap<String, BigDecimal> getSumAmount(InsuranceHandlingSettlementMonthDto insuranceHandlingSettlementMonthDto);
+
 }

+ 4 - 0
src/main/java/com/ydtech/modules/fnc/entity/InsPlyIncome.java

@@ -336,6 +336,10 @@ public class InsPlyIncome implements Serializable {
     @TableField("task_id")
     private String taskId;
 
+    @ApiModelProperty("开票方式 0 保司开票 1掌柜开票")
+    @TableField("invoicing_method")
+    private String invoicingMethod;
+
 
     @ApiModelProperty("总单数")
     @TableField(exist = false)

+ 2 - 0
src/main/java/com/ydtech/modules/fnc/entity/InsuranceHandlingSettlementMonthEntity.java

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableName;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
 import lombok.Getter;
 import lombok.NoArgsConstructor;
 import lombok.Setter;
@@ -20,6 +21,7 @@ import java.time.LocalDateTime;
 @TableName("sys_insurance_handling_settlement_month")
 @ApiModel(value = "InsuranceHandlingSettlementMonthEntity对象", description = "保险手续费结算关联表")
 @NoArgsConstructor
+@Data
 public class InsuranceHandlingSettlementMonthEntity implements Serializable {
     private static final long serialVersionUID = 1L;
 

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

@@ -7,6 +7,8 @@ import com.ydtech.modules.fnc.dto.InsuranceHandlingSettlementMonthDto;
 import com.ydtech.modules.fnc.entity.InsuranceHandlingSettlementMonthEntity;
 import com.ydtech.modules.fnc.vo.InsuranceHandlingSettlementMonthVo;
 
+import java.math.BigDecimal;
+import java.util.HashMap;
 import java.util.List;
 
 /**
@@ -30,5 +32,13 @@ public interface InsuranceHandlingSettlementMonthService  extends IService<Insur
 
     List<InsuranceHandlingSettlementMonthDto> getQueryLists(InsuranceHandlingSettlementMonthVo insuranceHandlingSettlementMonthVo);
 
+    /**
+     *
+     * @param insuranceHandlingSettlementMonthDto
+     * @return    返回结算金额  未结算 开票金额
+     */
+
+    HashMap<String, BigDecimal> getSumAmount(InsuranceHandlingSettlementMonthDto insuranceHandlingSettlementMonthDto);
+
 
 }

+ 2 - 48
src/main/java/com/ydtech/modules/fnc/service/impl/InsPlyIncomeServiceImpl.java

@@ -15,6 +15,7 @@ import com.ydtech.constants.InsuranceEnum;
 import com.ydtech.constants.enums.dict.agreement.ProductsType;
 import com.ydtech.core.page.HttpResult;
 import com.ydtech.exception.SystemException;
+import com.ydtech.modules.admin.model.SysDept;
 import com.ydtech.modules.admin.model.report.financialReceivables.*;
 import com.ydtech.modules.admin.utils.SliceUpDateUtil;
 import com.ydtech.modules.base.controller.BaseController;
@@ -1885,54 +1886,7 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
         HashMap<String, Object> params = new HashMap<>();
         params = this.saveParams(insPlyIncomeVo, params);
         params.remove("handlingFeesStatus");
-        List<InsPlyIncome> resultList = baseMapper.totalBxAmount(params);
-        for (InsPlyIncome item : resultList) {
-            BigDecimal commissionFeevalue = BigDecimal.ZERO;  //总金额
-            BigDecimal invoicCommissionFeevalue = BigDecimal.ZERO; //开票未结算
-            BigDecimal readyCommissionFeevalue = BigDecimal.ZERO; // 已开票已结算
-            BigDecimal noInvoicCommissionFeevalue = BigDecimal.ZERO; //未开票金额
-            BigDecimal unSettledAmount; //未结算金额
-            params.put("partnerCompaniesId", item.getPartnerCompaniesId());
-            params.remove("handlingFeesStatus");
-            List<InsPlyIncome> insPlyIncomes = baseMapper.queryNew(params);  //金额总数
-            for (InsPlyIncome all : insPlyIncomes) {
-                commissionFeevalue = commissionFeevalue.add(all.getCommissionFeevalue());
-            }
-            //已开票金额  =  开票未结算+  开票已结算
-            params.put("handlingFeesStatus", "0"); // 开票
-            params.put("settlementStatus", "1"); // 开票
-            List<SettlementDocumentaryFeesEntity> invoicInsPlyIncomes = settlementDocumentaryFeesService.queryNew(params);  //金额总数
-            for (SettlementDocumentaryFeesEntity invoicInsPlyIncome : invoicInsPlyIncomes) {
-                BigDecimal invoicIcommissionFeevalue = invoicInsPlyIncome.getSettlementAmount();// 已经开票金额
-                invoicCommissionFeevalue = invoicCommissionFeevalue.add(invoicIcommissionFeevalue);  //开票金额
-
-            }
-            params.put("settlementStatus", "2"); // 结算
-            List<SettlementDocumentaryFeesEntity> settleInsPlyIncomes = settlementDocumentaryFeesService.queryNew(params);  //金额总数
-            for (SettlementDocumentaryFeesEntity settleInsPlyIncome : settleInsPlyIncomes) {
-                BigDecimal settleIcommissionFeevalue = settleInsPlyIncome.getSettlementAmount();// 已结算金额
-                readyCommissionFeevalue = readyCommissionFeevalue.add(settleIcommissionFeevalue);  //已结算总
-            }
-            params.put("settlementStatus", 0);  //未开票金额
-            List<SettlementDocumentaryFeesEntity> noInvoicInsPlyIncomes = settlementDocumentaryFeesService.queryNew(params);  //金额总数
-            for (SettlementDocumentaryFeesEntity noInvoicInsPlyIncome : noInvoicInsPlyIncomes) {
-                BigDecimal noInvoicIcommissionFeevalue = noInvoicInsPlyIncome.getSettlementAmount();// 未开票金额
-                noInvoicCommissionFeevalue = noInvoicCommissionFeevalue.add(noInvoicIcommissionFeevalue);  //未开票总金额
-            }
-
-            noInvoicCommissionFeevalue = commissionFeevalue.subtract(invoicCommissionFeevalue);// 未开票
-            unSettledAmount = commissionFeevalue.subtract(readyCommissionFeevalue);   //未结算
-            //已开票金额
-
-            item.setCommissionFeevalue(commissionFeevalue);  //总手续费
-            item.setAllInvoicCommissionFeevalue(invoicCommissionFeevalue);  //总开票金额
-            //  开票未结算   = 开票金额 -  已开票已结算
-            invoicCommissionFeevalue = invoicCommissionFeevalue.subtract(readyCommissionFeevalue);
-            item.setInvoicCommissionFeevalue(invoicCommissionFeevalue); //开票未结算
-            item.setReadyCommissionFeevalue(readyCommissionFeevalue);  //已开票已结算
-            item.setNoInvoicCommissionFeevalue(noInvoicCommissionFeevalue);   //未开票金额
-            item.setUnSettledAmount(unSettledAmount);   // 未结算金额
-        }
+        List<InsPlyIncome> resultList = baseMapper.totalBxAmountNew(params);
         return resultList;
     }
 

+ 12 - 0
src/main/java/com/ydtech/modules/fnc/service/impl/InsuranceHandlingSettlementMonthServiceImpl.java

@@ -112,4 +112,16 @@ public class InsuranceHandlingSettlementMonthServiceImpl extends ServiceImpl<Ins
         List<InsuranceHandlingSettlementMonthDto> resultList = baseMapper.queryList(insuranceHandlingSettlementMonthVo);
         return resultList;
     }
+
+    /**
+     *
+     * @param insuranceHandlingSettlementMonthDto
+     * @return    返回结算金额  未结算 开票金额
+     */
+
+    @Override
+    public HashMap<String, BigDecimal> getSumAmount(InsuranceHandlingSettlementMonthDto insuranceHandlingSettlementMonthDto) {
+        return   baseMapper.getSumAmount(insuranceHandlingSettlementMonthDto);
+
+    }
 }

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

@@ -215,7 +215,7 @@ public class SettlementDocumentaryFeesServiceImpl extends ServiceImpl<Settlement
             wrapper.set(InsPlyIncome::getSettlementTime, null);
             insPlyIncomeMapper.update(item, wrapper);
 
-            incomeTaskRelationshipService.deleteByIncomeId(item.getId());  //作废后删除关系任务表
+//          incomeTaskRelationshipService.deleteByIncomeId(item.getId());  //作废后删除关系任务表
         }
 
 

+ 24 - 0
src/main/resources/mapper/modules/admin/CompanyDataReport.xml

@@ -102,6 +102,18 @@
             <if test="vo.deptId  != null  and  vo.deptId!=''  ">
                 and io.deptid like concat('%', #{vo.deptId}, '%')
             </if>
+            <if test="vo.deptIds != null and vo.deptIds != '' and vo.deptIds.size() > 0">
+                AND io.deptid  in
+                <foreach collection="vo.deptIds" item="item" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+            </if>
+            <if test="vo.userIds != null and vo.userIds != '' and vo.userIds.size() > 0">
+                AND io.userid  in
+                <foreach collection="vo.userIds" item="item" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+            </if>
         </where>
         ) b
         GROUP BY
@@ -147,6 +159,18 @@
                 <if test="vo.year  != null  and  vo.year!='' ">
                     AND DATE_FORMAT( io.createtime, '%Y') =#{vo.year}
                 </if>
+                <if test="vo.deptIds != null and vo.deptIds != '' and vo.deptIds.size() > 0">
+                    AND io.deptid  in
+                    <foreach collection="vo.deptIds" item="item" open="(" separator="," close=")">
+                        #{item}
+                    </foreach>
+                </if>
+                <if test="vo.userIds != null and vo.userIds != '' and vo.userIds.size() > 0">
+                    AND io.userid  in
+                    <foreach collection="vo.userIds" item="item" open="(" separator="," close=")">
+                        #{item}
+                    </foreach>
+                </if>
             </where>
 
     </select>

+ 13 - 0
src/main/resources/mapper/modules/admin/DeptBalanceMapper.xml

@@ -142,6 +142,19 @@
             <if test="vo.userCode !=null  and  vo.userCode !=''">
                 and su.id= #{vo.userCode}
             </if>
+            <if test="vo.deptIds != null and vo.deptIds != '' and vo.deptIds.size() > 0">
+                AND sd.id  in
+                <foreach collection="vo.deptIds" item="item" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+            </if>
+
+            <if test="vo.userIds != null and vo.userIds != '' and vo.userIds.size() > 0">
+                AND su.id  in
+                <foreach collection="vo.userIds" item="item" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+            </if>
         </where>
     </select>
 

+ 13 - 0
src/main/resources/mapper/modules/admin/SysAgencyLeaderMapper.xml

@@ -66,6 +66,19 @@
             <if test="vo.userCode !=null  and  vo.userCode !=''">
                 and su.id= #{vo.userCode}
             </if>
+            <if test="vo.deptIds != null and vo.deptIds != '' and vo.deptIds.size() > 0">
+                AND sd.id  in
+                <foreach collection="vo.deptIds" item="item" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+            </if>
+
+            <if test="vo.userIds != null and vo.userIds != '' and vo.userIds.size() > 0">
+                AND su.id  in
+                <foreach collection="vo.userIds" item="item" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+            </if>
         </where>
     </select>
 

+ 3 - 1
src/main/resources/mapper/modules/admin/SysDeptMapper.xml

@@ -121,7 +121,9 @@
     </select>
     <select id="getListByIds" resultType="com.ydtech.modules.admin.model.SysDept">
         SELECT sd.id        AS id,
-               sd.NAME      AS NAME
+               sd.NAME      AS NAME,
+               sd.parent_id  AS parentId,
+               sd.comlevel  AS comlevel
         FROM sys_dept sd
         WHERE sd.id  in
         <foreach collection="ids" item="item" open="(" close=")" separator=",">

+ 13 - 0
src/main/resources/mapper/modules/admin/SysPartnerMapper.xml

@@ -45,6 +45,19 @@
             <if test="vo.userCode !=null  and  vo.userCode !=''">
                 and su.id= #{vo.userCode}
             </if>
+            <if test="vo.deptIds != null and vo.deptIds != '' and vo.deptIds.size() > 0">
+                AND sd.id  in
+                <foreach collection="vo.deptIds" item="item" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+            </if>
+
+            <if test="vo.userIds != null and vo.userIds != '' and vo.userIds.size() > 0">
+                AND su.id  in
+                <foreach collection="vo.userIds" item="item" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+            </if>
         </where>
     </select>
 

+ 13 - 0
src/main/resources/mapper/modules/admin/SysTelemarketingWechatDataMapper.xml

@@ -59,6 +59,19 @@
             <if test='vo.groupId !=null and vo.groupId!=""  '>
                 and t5.id like CONCAT('', #{vo.groupId}, '%')
             </if>
+            <if test="vo.deptIds != null and vo.deptIds != '' and vo.deptIds.size() > 0">
+                AND t2.id  in
+                <foreach collection="vo.deptIds" item="item" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+            </if>
+
+            <if test="vo.userIds != null and vo.userIds != '' and vo.userIds.size() > 0">
+                AND t1.id  in
+                <foreach collection="vo.userIds" item="item" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+            </if>
         </if>
         order by t1.id
     </select>

+ 26 - 0
src/main/resources/mapper/modules/admin/SysUserMapper.xml

@@ -1395,6 +1395,20 @@
             <if test="vo.leaderId != null and vo.leaderId != ''">
                 and su.leader_id   =#{vo.leaderId}
             </if>
+
+            <if test="vo.deptIds != null and vo.deptIds != '' and vo.deptIds.size() > 0">
+                AND sd.id  in
+                <foreach collection="vo.deptIds" item="item" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+            </if>
+
+            <if test="vo.userIds != null and vo.userIds != '' and vo.userIds.size() > 0">
+                AND su.id  in
+                <foreach collection="vo.userIds" item="item" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+            </if>
         </where>
     </select>
 
@@ -1465,6 +1479,18 @@
             <if test="vo.countyId != null and vo.countyId != ''">
                 and sd.id like concat('%',#{vo.countyId},'%')
             </if>
+            <if test="vo.deptIds != null and vo.deptIds != '' and vo.deptIds.size() > 0">
+                AND sd.id  in
+                <foreach collection="vo.deptIds" item="item" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+            </if>
+            <if test="vo.userIds != null and vo.userIds != '' and vo.userIds.size() > 0">
+                AND su.id  in
+                <foreach collection="vo.userIds" item="item" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+            </if>
         </where>
     </select>
 

+ 53 - 0
src/main/resources/mapper/modules/admin/TaskStatisticsMapper.xml

@@ -42,6 +42,19 @@
                     #{item}
                 </foreach>
             </if>
+            <if test="vo.deptIds != null and vo.deptIds != '' and vo.deptIds.size() > 0">
+                AND io.deptid  in
+                <foreach collection="vo.deptIds" item="item" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+            </if>
+
+            <if test="vo.userIds != null and vo.userIds != '' and vo.userIds.size() > 0">
+                AND io.userid  in
+                <foreach collection="vo.userIds" item="item" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+            </if>
 
             <if test="vo.userName !=null  and vo.userName!=''">
                 and su.name=#{vo.userName}
@@ -90,6 +103,19 @@
             <if test="vo.managementSource !=null  and vo.managementSource!=''">
                 and sd.management_source=#{vo.managementSource}
             </if>
+            <if test="vo.deptIds != null and vo.deptIds != '' and vo.deptIds.size() > 0">
+                AND io.deptid  in
+                <foreach collection="vo.deptIds" item="item" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+            </if>
+
+            <if test="vo.userIds != null and vo.userIds != '' and vo.userIds.size() > 0">
+                AND io.userid  in
+                <foreach collection="vo.userIds" item="item" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+            </if>
         </where>
         group by io.userid
               ) a
@@ -137,6 +163,20 @@
             <if test="vo.managementSource !=null  and vo.managementSource!=''">
                 and sd.management_source=#{vo.managementSource}
             </if>
+
+            <if test="vo.deptIds != null and vo.deptIds != '' and vo.deptIds.size() > 0">
+                AND io.deptid  in
+                <foreach collection="vo.deptIds" item="item" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+            </if>
+
+            <if test="vo.userIds != null and vo.userIds != '' and vo.userIds.size() > 0">
+                AND io.userid  in
+                <foreach collection="vo.userIds" item="item" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+            </if>
         </where>
     </select>
 
@@ -173,6 +213,19 @@
             <if test="vo.managementSource !=null  and vo.managementSource!=''">
                 and sd.management_source=#{vo.managementSource}
             </if>
+            <if test="vo.deptIds != null and vo.deptIds != '' and vo.deptIds.size() > 0">
+                AND io.deptid  in
+                <foreach collection="vo.deptIds" item="item" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+            </if>
+
+            <if test="vo.userIds != null and vo.userIds != '' and vo.userIds.size() > 0">
+                AND io.userid  in
+                <foreach collection="vo.userIds" item="item" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+            </if>
         </where>
     </select>
 

+ 211 - 16
src/main/resources/mapper/modules/fnc/InsPlyIncomeMapper.xml

@@ -2832,22 +2832,6 @@
             order by    a.subSigndate
     </select>
 
-    <select id="queryDateByTypeMonthSumAmount" resultType="java.math.BigDecimal">
-        SELECT
-        SUM(IFNULL(a.commission_feevalue ,0 ) + IFNULL(a.other_feevalue ,0 ))
-        FROM
-        ins_ply_income a
-        LEFT JOIN
-        ptl_agreement pa ON pa.id = a.agreement_id
-        <where>
-            <if test="vo.type !=null  and  vo.type  !=''">
-                and pa.agreement_type =#{vo.type}
-            </if>
-            <if test="vo.beginDate  != null  and  vo.beginDate!=''  and vo.endDate  != null  and  vo.endDate!=''">
-                AND  a.create_time  BETWEEN #{vo.beginDate} AND #{vo.endDate}
-            </if>
-        </where>
-    </select>
     <select id="getProfitAnalysisQueryList" resultType="com.ydtech.modules.admin.model.report.profitAnalysis.ProfitAnalysisDto">
         SELECT
             a.signingTime as "yearAndMonth",
@@ -3153,6 +3137,217 @@
         eic.namesimple,
         sa.area_cname
     </select>
+    <select id="totalBxAmountNew" resultType="com.ydtech.modules.fnc.entity.InsPlyIncome">
+        select
+        a.companyId as "companyId",
+        a.companyName as "companyName",
+        a.partnerCompaniesName as "partnerCompaniesName",
+        a.partner_companies_id as "partnerCompaniesId",
+        IFNULL(a.allInvoicCommissionFeevalue,0) AS "allInvoicCommissionFeevalue",
+        IFNULL(a.commissionFeevalue,0) as "commissionFeevalue",
+        IFNULL(b.settlementAmount,0)   as "readyCommissionFeevalue",
+        IFNULL(a.allInvoicCommissionFeevalue,0) -IFNULL(b.settlementAmount,0) as "invoicCommissionFeevalue",
+        IFNULL(a.commissionFeevalue,0) - IFNULL(a.allInvoicCommissionFeevalue,0) as "noInvoicCommissionFeevalue",
+        (IFNULL(a.allInvoicCommissionFeevalue,0) -IFNULL(b.settlementAmount,0)) +(IFNULL(a.commissionFeevalue,0) - IFNULL(a.allInvoicCommissionFeevalue,0)) as "unSettledAmount"
+        from (
+        select a.partner_companies_id,
+        sum(a.commission_feevalue) as "commissionFeevalue",
+        SUM(CASE WHEN a.handling_fees_status != '0' and a.task_id  is  not  null  THEN IFNULL(a.commission_feevalue, 0) ELSE 0 END)   AS "allInvoicCommissionFeevalue",
+        MAX( a.company_name ) AS "companyName",
+        MAX( a.company_id ) AS "companyId",
+        MAX( a.partner_companies_name ) AS "partnerCompaniesName"
+        from ins_ply_income a
+        LEFT JOIN ptl_agreement pa ON a.agreement_id = pa.id
+        LEFT JOIN esm_ins_company eic on eic.id = a.partner_companies_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="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="createTimeStart  !=null  and  createTimeStart  != ''  and  createTimeEnd   != null  and  createTimeEnd   !=''">
+                AND DATE(a.create_time) BETWEEN #{createTimeStart} AND #{createTimeEnd}
+            </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="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="isExternal  !=null  and  isExternal  != ''">
+                AND pa.is_external =#{isExternal}
+            </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="createTimeQuery != null and createTimeQuery != ''">
+                and DATE_FORMAT( a.create_time, '%Y-%m-%d')   =#{createTimeQuery}
+            </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="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 a.partner_companies_id) a
+        left join (select sum(settlement_amount) as "settlementAmount",
+        a.partner_companies_id
+        from sys_insurance_handling_settlement_month a
+        <where>
+            1=1
+            <if test="year !=null  and  year  !=''">
+                AND YEAR(a.signing_time) =#{year}
+            </if>
+            <if test="month !=null  and  month !=''">
+                AND month(a.signing_time) =#{month}
+            </if>
+            <if test="day !=null  and  day !=''">
+                AND day(a.signing_time) =#{day}
+            </if>
+            <if test="isNotCar !=null  and  isNotCar  !=''">
+                and a.is_not_car =#{isNotCar}
+            </if>
+        </where>
+        group by a.partner_companies_id) b on b.partner_companies_id = a.partner_companies_id
+    </select>
 
     <select id="totalPTAmount" resultType="com.ydtech.modules.fnc.dto.InsPlyIncomePTDto">
         SELECT

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

@@ -295,6 +295,15 @@
             <if test="completionStatus !=null  and  completionStatus  !=''">
                 and a.completion_status =#{completionStatus}
             </if>
+            <if test="year !=null  and  year  !=''">
+                AND YEAR(a.signing_time) =#{year}
+            </if>
+            <if test="month !=null  and  month !=''">
+                AND month(a.signing_time) =#{month}
+            </if>
+            <if test="day !=null  and  day !=''">
+                AND day(a.signing_time) =#{day}
+            </if>
         </where>
         ORDER  BY  a.create_time desc
 

+ 33 - 0
src/main/resources/mapper/modules/insuranceHandlingSettlementMonth/InsuranceHandlingSettlementMonthMapper.xml

@@ -62,6 +62,39 @@
     </select>
 
 
+    <select id="getSumAmount" resultType="java.util.HashMap">
+        select
+            sum(settlement_amount)  as "settlementAmount",
+            sum(total_amount) as "invoicAmount",
+            sum(remaining_amount) as "notSettleAmount"
+        from  sys_insurance_handling_settlement_month a
+        <where>
+            1=1
+            <if test="vo.partnerCompaniesId  !=null  and  vo.partnerCompaniesId!=''">
+                AND  a.partner_companies_id=#{vo.partnerCompaniesId}
+            </if>
+            <if test="vo.taskId  !=null  and  vo.taskId!=''">
+                AND  a.task_id=#{vo.taskId}
+            </if>
 
+            <if test="vo.settlementDocumentaryFeesId  !=null  and  vo.settlementDocumentaryFeesId!=''">
+                AND  a.settlement_documentary_fees_id=#{vo.settlementDocumentaryFeesId}
+            </if>
+
+            <if test="vo.isNotCar  !=null  and  vo.isNotCar!=''">
+                AND  a.is_not_car=#{vo.isNotCar}
+            </if>
+            <if test="vo.year !=null  and  vo.year  !=''">
+                AND YEAR(a.signing_time) =#{vo.year}
+            </if>
+            <if test="vo.month !=null  and  vo.month !=''">
+                AND month(a.signing_time) =#{vo.month}
+            </if>
+            <if test="vo.day !=null  and  vo.day !=''">
+                AND day(a.signing_time) =#{vo.day}
+            </if>
+
+        </where>
+    </select>
 
 </mapper>

+ 169 - 1
src/main/resources/mapper/modules/order/InsAreaCompanyMapper.xml

@@ -894,11 +894,24 @@
         <if test="vo.deptId  != null  and vo.deptId !=''">
             AND  io.deptId  like concat('%',#{vo.leaderName},'%')
         </if>
+        <if test="vo.deptIds != null and vo.deptIds != '' and vo.deptIds.size() > 0">
+            AND sd.id  in
+            <foreach collection="vo.deptIds" item="item" open="(" separator="," close=")">
+                #{item}
+            </foreach>
+        </if>
+        <if test="vo.userIds != null and vo.userIds != '' and vo.userIds.size() > 0">
+            AND io.userid  in
+            <foreach collection="taskStatisticsVo.userIds" item="item" open="(" separator="," close=")">
+                #{item}
+            </foreach>
+        </if>
         GROUP BY
         agree.insurance_company,
         iac.company_id,
         agree.partner_companies_id
         ) a
+        order  by a.parterCompanyId
     </select>
 
     <select id="getInsAreaCompanyError"
@@ -919,6 +932,21 @@
             <if test="vo.userId != null  and  vo.userId!=''">
                 AND iace.user_id  =#{vo.userId}
             </if>
+            <if test="vo.beginDate  != null  and  vo.beginDate!=''  and vo.endDate  != null  and  vo.endDate!=''">
+                AND iace.create_time BETWEEN #{vo.beginDate} AND #{vo.endDate}
+            </if>
+            <if test="vo.deptIds != null and vo.deptIds != '' and vo.deptIds.size() > 0">
+                AND iace.dept_id  in
+                <foreach collection="vo.deptIds" item="item" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+            </if>
+            <if test="vo.userIds != null and vo.userIds != '' and vo.userIds.size() > 0">
+                AND iace.user_id  in
+                <foreach collection="taskStatisticsVo.userIds" item="item" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+            </if>
         </where>
 
     </select>
@@ -956,6 +984,18 @@
         <if test="vo.deptId  != null  and vo.deptId !=''">
             AND  io.deptId  like concat('%',#{vo.leaderName},'%')
         </if>
+        <if test="vo.deptIds != null and vo.deptIds != '' and vo.deptIds.size() > 0">
+            AND sd.id  in
+            <foreach collection="vo.deptIds" item="item" open="(" separator="," close=")">
+                #{item}
+            </foreach>
+        </if>
+        <if test="vo.userIds != null and vo.userIds != '' and vo.userIds.size() > 0">
+            AND io.userid  in
+            <foreach collection="taskStatisticsVo.userIds" item="item" open="(" separator="," close=")">
+                #{item}
+            </foreach>
+        </if>
         GROUP BY
         agree.partner_companies_id
         ) a
@@ -1046,6 +1086,19 @@
                 and iac.createtime >= DATE_SUB(NOW(), INTERVAL #{taskStatisticsVo.days} DAY)
             </if>
 
+            <if test="taskStatisticsVo.deptIds != null and taskStatisticsVo.deptIds != '' and taskStatisticsVo.deptIds.size() > 0">
+                AND sd.id  in
+                <foreach collection="taskStatisticsVo.deptIds" item="item" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+            </if>
+            <if test="taskStatisticsVo.userIds != null and taskStatisticsVo.userIds != '' and taskStatisticsVo.userIds.size() > 0">
+                AND io.userid  in
+                <foreach collection="taskStatisticsVo.userIds" item="item" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+            </if>
+
             <if test="taskStatisticsVo.days !=null  and taskStatisticsVo.days !='' ">
                 <choose>
                     <when test="taskStatisticsVo.days =='1'">
@@ -1109,6 +1162,19 @@
                 and io.userid =#{taskStatisticsVo.userId}
             </if>
 
+            <if test="taskStatisticsVo.deptIds != null and taskStatisticsVo.deptIds != '' and taskStatisticsVo.deptIds.size() > 0">
+                AND sd.id  in
+                <foreach collection="taskStatisticsVo.deptIds" item="item" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+            </if>
+            <if test="taskStatisticsVo.userIds != null and taskStatisticsVo.userIds != '' and taskStatisticsVo.userIds.size() > 0">
+                AND io.userid  in
+                <foreach collection="taskStatisticsVo.userIds" item="item" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+            </if>
+
             <if test="taskStatisticsVo.days !=null  and taskStatisticsVo.days !='' ">
                 <choose>
                     <when test="taskStatisticsVo.days =='1'">
@@ -1187,6 +1253,18 @@
             <if test="taskStatisticsVo.days !=null  and taskStatisticsVo.days !='' ">
                 and iac.createtime >= DATE_SUB(NOW(), INTERVAL #{taskStatisticsVo.days} DAY)
             </if>
+            <if test="taskStatisticsVo.deptIds != null and taskStatisticsVo.deptIds != '' and taskStatisticsVo.deptIds.size() > 0">
+                AND io.deptid  in
+                <foreach collection="taskStatisticsVo.deptIds" item="item" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+            </if>
+            <if test="taskStatisticsVo.userIds != null and taskStatisticsVo.userIds != '' and taskStatisticsVo.userIds.size() > 0">
+                AND io.userid  in
+                <foreach collection="taskStatisticsVo.userIds" item="item" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+            </if>
         </where>
         GROUP BY
         pa.insurance_company_id,
@@ -1235,6 +1313,18 @@
             <if test="taskStatisticsVo.days !=null  and taskStatisticsVo.days !='' ">
                 and iac.createtime >= DATE_SUB(NOW(), INTERVAL #{taskStatisticsVo.days} DAY)
             </if>
+            <if test="taskStatisticsVo.deptIds != null and taskStatisticsVo.deptIds != '' and taskStatisticsVo.deptIds.size() > 0">
+                AND io.deptid  in
+                <foreach collection="taskStatisticsVo.deptIds" item="item" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+            </if>
+            <if test="taskStatisticsVo.userIds != null and taskStatisticsVo.userIds != '' and taskStatisticsVo.userIds.size() > 0">
+                AND io.userid  in
+                <foreach collection="taskStatisticsVo.userIds" item="item" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+            </if>
         </where>
         GROUP BY
         pa.insurance_company_id,
@@ -1292,6 +1382,19 @@
                 and iac.createtime >= DATE_SUB(NOW(), INTERVAL #{taskStatisticsVo.days} DAY)
             </if>
 
+            <if test="taskStatisticsVo.deptIds != null and taskStatisticsVo.deptIds != '' and taskStatisticsVo.deptIds.size() > 0">
+                AND sd.id  in
+                <foreach collection="taskStatisticsVo.deptIds" item="item" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+            </if>
+            <if test="taskStatisticsVo.userIds != null and taskStatisticsVo.userIds != '' and taskStatisticsVo.userIds.size() > 0">
+                AND io.userid  in
+                <foreach collection="taskStatisticsVo.userIds" item="item" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+            </if>
+
             <if test="taskStatisticsVo.days !=null  and taskStatisticsVo.days !='' ">
                 <choose>
                     <when test="taskStatisticsVo.days =='1'">
@@ -1398,6 +1501,19 @@
             <if test="taskStatisticsVo.beginDate !=null and taskStatisticsVo.beginDate != '' and taskStatisticsVo.endDate !=null and taskStatisticsVo.endDate != ''">
                 AND   DATE_FORMAT( ifa.audittime, '%Y-%m-%d')   BETWEEN  DATE_FORMAT( #{taskStatisticsVo.beginDate}, '%Y-%m-%d')   AND  DATE_FORMAT( #{taskStatisticsVo.endDate}, '%Y-%m-%d')
             </if>
+            <if test="taskStatisticsVo.deptIds != null and taskStatisticsVo.deptIds != '' and taskStatisticsVo.deptIds.size() > 0">
+                AND io.deptid  in
+                <foreach collection="taskStatisticsVo.deptIds" item="item" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+            </if>
+
+            <if test="taskStatisticsVo.userIds != null and taskStatisticsVo.userIds != '' and taskStatisticsVo.userIds.size() > 0">
+                AND su.id  in
+                <foreach collection="taskStatisticsVo.userIds" item="item" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+            </if>
             <choose>
                 <when test="taskStatisticsVo.riskCode != null and taskStatisticsVo.riskCode != '' and  taskStatisticsVo.riskCode != 'all' ">
                     and iac.product = #{taskStatisticsVo.riskCode}
@@ -1512,9 +1628,22 @@
             <if test="vo.createtimeStart  != null  and  vo.createtimeStart!=''  and vo.createtimeEnd  != null  and  vo.createtimeEnd!=''">
                 AND iac.createtime BETWEEN #{vo.createtimeStart} AND #{vo.createtimeEnd}
             </if>
-        <if test="vo.beginDate  != null  and  vo.beginDate!=''  and vo.endDate  != null  and  vo.endDate!=''">
+            <if test="vo.beginDate  != null  and  vo.beginDate!=''  and vo.endDate  != null  and  vo.endDate!=''">
                 AND iac.createtime BETWEEN #{vo.beginDate} AND #{vo.endDate}
             </if>
+            <if test="vo.deptIds != null and vo.deptIds != '' and vo.deptIds.size() > 0">
+                AND io.deptid  in
+                <foreach collection="vo.deptIds" item="item" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+            </if>
+
+            <if test="vo.userIds != null and vo.userIds != '' and vo.userIds.size() > 0">
+                AND io.userid  in
+                <foreach collection="vo.userIds" item="item" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+            </if>
         </where>
         GROUP BY
         io.userid,
@@ -1653,6 +1782,19 @@
         <if test="vo.houseId != null and vo.houseId != ''">
             and io.deptid like "${vo.houseId}%"
         </if>
+        <if test="vo.deptIds != null and vo.deptIds != '' and vo.deptIds.size() > 0">
+            AND io.deptid  in
+            <foreach collection="vo.deptIds" item="item" open="(" separator="," close=")">
+                #{item}
+            </foreach>
+        </if>
+
+        <if test="vo.userIds != null and vo.userIds != '' and vo.userIds.size() > 0">
+            AND io.userid  in
+            <foreach collection="vo.userIds" item="item" open="(" separator="," close=")">
+                #{item}
+            </foreach>
+        </if>
         GROUP BY
         agree.insurance_company_id,
         agree.insurance_company,
@@ -1723,6 +1865,19 @@
         <if test="vo.quotationStatus != null and vo.quotationStatus != ''">
             and iac.orderstatus  =#{vo.quotationStatus}
         </if>
+        <if test="vo.deptIds != null and vo.deptIds != '' and vo.deptIds.size() > 0">
+            AND io.deptid  in
+            <foreach collection="vo.deptIds" item="item" open="(" separator="," close=")">
+                #{item}
+            </foreach>
+        </if>
+
+        <if test="vo.userIds != null and vo.userIds != '' and vo.userIds.size() > 0">
+            AND io.userid  in
+            <foreach collection="vo.userIds" item="item" open="(" separator="," close=")">
+                #{item}
+            </foreach>
+        </if>
         GROUP BY
         agree.insurance_company_id,
         agree.insurance_company,
@@ -1798,6 +1953,19 @@
             <if test="vo.year  != null  and  vo.year!='' ">
                 AND DATE_FORMAT( io.createtime, '%Y') =#{vo.year}
             </if>
+            <if test="vo.deptIds != null and vo.deptIds != '' and vo.deptIds.size() > 0">
+                AND io.deptid  in
+                <foreach collection="vo.deptIds" item="item" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+            </if>
+
+            <if test="vo.userIds != null and vo.userIds != '' and vo.userIds.size() > 0">
+                AND io.userid  in
+                <foreach collection="vo.userIds" item="item" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+            </if>
         </where>
         ) b
         GROUP  BY

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

@@ -196,6 +196,13 @@
                 AND pa.id IN ( SELECT DISTINCT agreement_id FROM ptl_agreement_dept WHERE dept_id LIKE
                 concat(#{vo.deptId},'%') )
             </if>
+
+            <if test="vo.deptIds != null and vo.deptIds != '' and vo.deptIds.size() > 0">
+                AND pa.id IN ( SELECT DISTINCT agreement_id FROM ptl_agreement_dept WHERE dept_id  in
+                 <foreach collection="vo.deptIds" item="item" open="(" separator="," close=")">
+                #{item}
+                </foreach>)
+            </if>
             <if test="vo.warningDay  !=null  and   vo.warningDay  !=''">
                 <choose>
                     <when test="warningDay==1">