Ver Fonte

1.控制台业务数据权限查询问题

wuhp há 1 ano atrás
pai
commit
8f2d3d84d7

+ 4 - 20
src/main/java/com/ydtech/modules/admin/controller/taskStatistics/TaskStatisticsController.java

@@ -14,6 +14,7 @@ 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.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
@@ -399,17 +400,9 @@ public class TaskStatisticsController {
      **/
     @PostMapping("getBusinessAgentData")
     @ApiOperation(value = "控制台-业务数据-代理人")
-    public HttpResult<IPage<BusinessAgentData>> getBusinessAgentData(@RequestBody TaskStatisticsVo taskStatisticsVo, HttpServletRequest httpServerRequest) {
+    public HttpResult<IPage<BusinessAgentData>> getBusinessAgentData(@RequestBody TaskStatisticsVo taskStatisticsVo) {
         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){
@@ -424,17 +417,8 @@ public class TaskStatisticsController {
      **/
     @PostMapping("getBusinessAgentDataTotal")
     @ApiOperation(value = "控制台-业务数据-代理人-合计")
-    public HttpResult<BusinessAgentData> getBusinessAgentDataTotal(@RequestBody TaskStatisticsVo taskStatisticsVo, HttpServletRequest httpServerRequest) {
+    public HttpResult<BusinessAgentData> getBusinessAgentDataTotal(@RequestBody TaskStatisticsVo taskStatisticsVo) {
         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 - 1
src/main/java/com/ydtech/modules/admin/service/impl/TaskStatisticsServiceImpl.java

@@ -689,6 +689,9 @@ public class TaskStatisticsServiceImpl  implements TaskStatisticsService {
         pageVo.setPageNum(taskStatisticsVo.getPageNum());
         pageVo.setPageSize(taskStatisticsVo.getPageSize());
 
+        if(StringUtils.isNotEmpty(taskStatisticsVo.getTreeType()) &&  (StringUtils.isEmpty(taskStatisticsVo.getTreeUserId()) &&  StringUtils.isEmpty(taskStatisticsVo.getDeptId()) ) ){
+            return new Page<>(taskStatisticsVo.getPageNum(), taskStatisticsVo.getPageNum());
+        }
 
         HashMap<String, String> dateMapByType = getDateMapByTypeNew(taskStatisticsVo.getDateType(), taskStatisticsVo.getCreatetimeStart(), taskStatisticsVo.getCreatetimeEnd());
         taskStatisticsVo.setCreatetimeStart(dateMapByType.get("startDate"));
@@ -861,6 +864,9 @@ public class TaskStatisticsServiceImpl  implements TaskStatisticsService {
                 taskStatisticsVo.setUserIds(new ArrayList<>());
             }
         }
+        if (StringUtils.isNotEmpty(taskStatisticsVo.getTreeType()) && (StringUtils.isEmpty(taskStatisticsVo.getTreeUserId()) && StringUtils.isEmpty(taskStatisticsVo.getDeptId()))) {
+            return new BusinessAgentData();
+        }
 
         String deptId = BaseController.getDeptId();
         BusinessAgentData result = this.taskStatisticsMapper.getBusinessAgentDataTotalAdd(taskStatisticsVo);
@@ -882,7 +888,7 @@ public class TaskStatisticsServiceImpl  implements TaskStatisticsService {
         BigDecimal subtract = entranceAllFee.subtract(exportAllFee);
         result.setDistributionAmount(subtract); //毛利润
         if(subtract.compareTo(BigDecimal.ZERO)>0){
-            BigDecimal resultDivided = subtract.divide(sumPremium, 2, RoundingMode.HALF_UP); //人均产能
+            BigDecimal resultDivided = subtract.divide(sumPremium, 4, RoundingMode.HALF_UP); //人均产能
             result.setDistributionAmountRate(resultDivided);
         }else {
             result.setDistributionAmountRate(BigDecimal.ZERO);

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

@@ -340,6 +340,7 @@ public class UserReportServiceImpl implements UserReportService {
             List<QxFrontlineAgentDto> getQxFrontlineAgentList = sysUserMapper.getQxFrontlineAgentList(qxFrontlineAgentVo);
             if (qxFrontlineAgentVo.getManagementSource().equals("1")) {// 渠道
                 getQxFrontlineAgentList .clear();
+
                 getQxFrontlineAgentList.addAll(userReportMapper.selectChannelPersonOld(qxFrontlineAgentVo));
             } else if (qxFrontlineAgentVo.getManagementSource().equals("2")) {// 代理人
                 this.agentPerson(getQxFrontlineAgentList, qxFrontlineAgentVo);
@@ -399,8 +400,17 @@ public class UserReportServiceImpl implements UserReportService {
 
     @Override
     public HttpResult agentExcel(QxFrontlineAgentVo qxFrontlineAgentVo) {
-//        QxFrontlineAgentExcel
 
+        String leaderId = qxFrontlineAgentVo.getLeaderId();
+        if(StringUtils.isNotEmpty(leaderId)) {
+            //获取领导人下级所有
+            List<String> ids = new ArrayList<>();
+            List<String> userList = this.getUserTreeHx(leaderId, ids);
+            userList.add(leaderId);
+            if (userList.size() > 0) {
+                qxFrontlineAgentVo.setLeaderIds(userList);
+            }
+        }
         HashMap<String, String> map = getDateMapByType(qxFrontlineAgentVo.getDays(), qxFrontlineAgentVo.getCreatetimeStart(), qxFrontlineAgentVo.getCreatetimeEnd());
         qxFrontlineAgentVo.setCreatetimeStart(map.get("startDate"));
         qxFrontlineAgentVo.setCreatetimeEnd(map.get("endDate"));