| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206 |
- 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<HashMap<String,Object>> queryHXReportDataNew(@RequestBody HouLinePersonnelReportVo houLinePersonnelReportVo) {
- try{
- HashMap<String,Object> 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<PageResult<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<PageResult<QxFrontlineAgentDto>> 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<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){
- return HttpResult.error("查询错误"+e.getMessage());
- }
- }
- /**
- * @version
- * @author: whp
- * @Date: 2024/8/07
- * @Description: 人员统计-前线人员-代理人统计-详情
- */
- @PostMapping("queryQxFrontlineDetails")
- @ApiOperation(value = "人员统计-前线人员-代理人统计-团队管理")
- public HttpResult<EsmUserCountVO> queryQxFrontlineDetails(@RequestBody QxFrontlineAgentVo qxFrontlineAgentVo) {
- HttpResult<EsmUserCountVO> result = userReportService.queryQxFrontlineDetails(qxFrontlineAgentVo);
- return result;
- }
- /**
- * @version
- * @author: whp
- * @Date: 2024/8/07
- * @Description: 人员统计-前线人员-渠道-详情
- */
- @PostMapping("queryChannelDetails")
- @ApiOperation(value = "人员统计-前线人员-渠道明细")
- 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;
- }
- /**
- * @version
- * @author: whp
- * @Date: 2024/8/07
- * @Description: 人员统计-前线人员-代理人统计-详情
- */
- @PostMapping("queryQxFrontlineDetailsUser")
- @ApiOperation(value = "人员统计-前线人员-代理人统计")
- public HttpResult<IPage<QxFrontlineAgentDto>> queryQxFrontlineDetailsUser(@RequestBody QxFrontlineAgentVo qxFrontlineAgentVo) {
- HttpResult<IPage<QxFrontlineAgentDto>> result = userReportService.queryQxFrontlineDetailsUser(qxFrontlineAgentVo);
- return result;
- }
- /**
- * @version
- * @author: whp
- * @Date: 2024/8/07
- * @Description: 人员统计-前线人员-代理人统计 -人员详情
- */
- @GetMapping("getByUserId/{userId}")
- @ApiOperation(value = "人员统计-前线人员-代理人统计-团队排名")
- public HttpResult<QxFrontlineAgentDto> 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<List<EsmUserReferrerDTO>> agentTreeStructure(@RequestBody QxFrontlineAgentVo qxFrontlineAgentVo) {
- try{
- List<EsmUserReferrerDTO> result= userReportService.agentTreeStructure(qxFrontlineAgentVo);
- return HttpResult.ok("查询数据成功", result);
- }catch (Exception e){
- return HttpResult.error("查询错误"+e.getMessage());
- }
- }
- }
|