Kaynağa Gözat

1.任务导出添加数据权限

wuhp 1 yıl önce
ebeveyn
işleme
53ddc99eb5

+ 35 - 3
src/main/java/com/ydtech/modules/admin/controller/taskStatistics/TaskStatisticsController.java

@@ -119,7 +119,17 @@ public class TaskStatisticsController {
      **/
     @PostMapping("/electricExcel")
     @ApiOperation(value = "任务统计-电销导出")
-    public HttpResult electricExcel(@RequestBody TaskStatisticsVo taskStatisticsVo) {
+    public HttpResult electricExcel(@RequestBody TaskStatisticsVo taskStatisticsVo, HttpServletRequest httpServerRequest) {
+        taskStatisticsVo.filterTime();
+        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());
+            }
+        }
         return this.taskStatisticsService.electricExcel(taskStatisticsVo);
     }
 
@@ -183,7 +193,18 @@ public class TaskStatisticsController {
      **/
     @PostMapping("/agentExcel")
     @ApiOperation(value = "任务统计-代理人导出")
-    public HttpResult channelAgentExcel(@RequestBody TaskStatisticsVo taskStatisticsVo) {
+    public HttpResult channelAgentExcel(@RequestBody TaskStatisticsVo taskStatisticsVo, HttpServletRequest httpServerRequest) {
+        taskStatisticsVo.filterTime();
+
+        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());
+            }
+        }
         return this.taskStatisticsService.agentExcel(taskStatisticsVo);
     }
 
@@ -468,7 +489,18 @@ public class TaskStatisticsController {
      **/
     @PostMapping("/channelExcel")
     @ApiOperation(value = "任务统计-渠道导出")
-    public HttpResult channelExcel(@RequestBody TaskStatisticsVo taskStatisticsVo) {
+    public HttpResult channelExcel(@RequestBody TaskStatisticsVo taskStatisticsVo, HttpServletRequest httpServerRequest) {
+        taskStatisticsVo.filterTime();
+        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());
+            }
+        }
+
         return this.taskStatisticsService.channelExcel(taskStatisticsVo);
     }