package com.ydtech.modules.admin.controller.personnelStatistics; import com.baomidou.mybatisplus.core.metadata.IPage; import com.ydtech.core.page.HttpResult; import com.ydtech.core.page.PageResult; import com.ydtech.modules.admin.model.dto.EsmUserReferrerDTO; import com.ydtech.modules.admin.model.dto.QxFrontlineAgentDto; 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; /** * 人员统计 */ @Api(tags = "人员统计") @RequestMapping("/userStatistics") @RestController public class PersonnelStatisticsController { @Autowired private SysDeptService sysDeptService; @Autowired private UserReportService userReportService; /** * @version * @author: whp * @Date: 2024/7/24 9:04 * @Description: 通过后线人员机构查询统计数据 */ @PostMapping("queryHXReportData") @ApiOperation(value = "查询后线人员统计数据") public HttpResult> queryHXReportDataNew(@RequestBody HouLinePersonnelReportVo houLinePersonnelReportVo) { try{ HashMap houLinePersonnelReportDto = userReportService.queryHXReportDataNew(houLinePersonnelReportVo); return HttpResult.ok("查询数据成功", houLinePersonnelReportDto); }catch (Exception e){ return HttpResult.error("查询错误"+e.getMessage()); } } /** * @version * @author: whp * @Date: 2024/8/07 * @Description: 人员统计-前线人员-代理人统计 */ @PostMapping("queryQxFrontlineAgent") @ApiOperation(value = "人员统计-前线人员-代理人统计") public HttpResult> 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> result = userReportService.queryQxFrontlineAgent(qxFrontlineAgentVo); return result; } /** * @description: 人员统计-前线人员-代理人统计-导出 * @author: whp * @date: 2024/10/08 **/ @PostMapping("/QxFrontlineAgentExcel") @ApiOperation(value = "人员统计-前线人员-代理人统计-导出") public HttpResult channelAgentExcel(@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()); } } return this.userReportService.agentExcel(qxFrontlineAgentVo); } /** * @version * @author: whp * @Date: 2024/8/07 * @Description: 人员统计-前线人员-代理人统计 */ @PostMapping("queryQxFrontlineAgentRanking") @ApiOperation(value = "人员统计-前线人员-代理人统计-团队排名") public HttpResult> 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 result = userReportService.queryQxFrontlineAgentRanking(qxFrontlineAgentVo); return HttpResult.ok("查询数据成功", result); }catch (Exception e){ return HttpResult.error("查询错误"+e.getMessage()); } } /** * @version * @author: whp * @Date: 2024/8/07 * @Description: 人员统计-前线人员-代理人统计-详情 */ @PostMapping("queryQxFrontlineDetails") @ApiOperation(value = "人员统计-前线人员-代理人统计-团队管理") public HttpResult queryQxFrontlineDetails(@RequestBody QxFrontlineAgentVo qxFrontlineAgentVo) { HttpResult result = userReportService.queryQxFrontlineDetails(qxFrontlineAgentVo); return result; } /** * @version * @author: whp * @Date: 2024/8/07 * @Description: 人员统计-前线人员-渠道-详情 */ @PostMapping("queryChannelDetails") @ApiOperation(value = "人员统计-前线人员-渠道明细") public HttpResult> 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> result = userReportService.queryChannelDetails(qxFrontlineAgentVo); return result; } /** * @version * @author: whp * @Date: 2024/8/07 * @Description: 人员统计-前线人员-代理人统计-详情 */ @PostMapping("queryQxFrontlineDetailsUser") @ApiOperation(value = "人员统计-前线人员-代理人统计") public HttpResult> queryQxFrontlineDetailsUser(@RequestBody QxFrontlineAgentVo qxFrontlineAgentVo) { HttpResult> result = userReportService.queryQxFrontlineDetailsUser(qxFrontlineAgentVo); return result; } /** * @version * @author: whp * @Date: 2024/8/07 * @Description: 人员统计-前线人员-代理人统计 -人员详情 */ @GetMapping("getByUserId/{userId}") @ApiOperation(value = "人员统计-前线人员-代理人统计-团队排名") public HttpResult getByUserId( @PathVariable("userId") String userId) { try{ QxFrontlineAgentDto result= userReportService.getByUserId(userId); return HttpResult.ok("查询数据成功", result); }catch (Exception e){ return HttpResult.error("查询错误"+e.getMessage()); } } @PostMapping("agentTreeStructure") @ApiOperation(value = "代理人树形") public HttpResult> agentTreeStructure(@RequestBody QxFrontlineAgentVo qxFrontlineAgentVo) { try{ List result= userReportService.agentTreeStructure(qxFrontlineAgentVo); return HttpResult.ok("查询数据成功", result); }catch (Exception e){ return HttpResult.error("查询错误"+e.getMessage()); } } }