PersonnelStatisticsController.java 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. package com.ydtech.modules.admin.controller.personnelStatistics;
  2. import com.baomidou.mybatisplus.core.metadata.IPage;
  3. import com.ydtech.core.page.HttpResult;
  4. import com.ydtech.core.page.PageResult;
  5. import com.ydtech.modules.admin.model.dto.EsmUserReferrerDTO;
  6. import com.ydtech.modules.admin.model.dto.QxFrontlineAgentDto;
  7. import com.ydtech.modules.admin.model.vo.HouLinePersonnelReportVo;
  8. import com.ydtech.modules.admin.model.vo.KztGetDeptUtilsDto;
  9. import com.ydtech.modules.admin.model.vo.QxFrontlineAgentVo;
  10. import com.ydtech.modules.admin.service.SysDeptService;
  11. import com.ydtech.modules.admin.service.UserReportService;
  12. import com.ydtech.modules.admin.utils.KztGetDeptUtils;
  13. import com.ydtech.modules.esm.model.vo.EsmUserCountVO;
  14. import io.swagger.annotations.Api;
  15. import io.swagger.annotations.ApiOperation;
  16. import org.apache.commons.lang3.ObjectUtils;
  17. import org.springframework.beans.factory.annotation.Autowired;
  18. import org.springframework.web.bind.annotation.*;
  19. import javax.servlet.http.HttpServletRequest;
  20. import java.util.HashMap;
  21. import java.util.List;
  22. /**
  23. * 人员统计
  24. */
  25. @Api(tags = "人员统计")
  26. @RequestMapping("/userStatistics")
  27. @RestController
  28. public class PersonnelStatisticsController {
  29. @Autowired
  30. private SysDeptService sysDeptService;
  31. @Autowired
  32. private UserReportService userReportService;
  33. /**
  34. * @version
  35. * @author: whp
  36. * @Date: 2024/7/24 9:04
  37. * @Description: 通过后线人员机构查询统计数据
  38. */
  39. @PostMapping("queryHXReportData")
  40. @ApiOperation(value = "查询后线人员统计数据")
  41. public HttpResult<HashMap<String,Object>> queryHXReportDataNew(@RequestBody HouLinePersonnelReportVo houLinePersonnelReportVo) {
  42. try{
  43. HashMap<String,Object> houLinePersonnelReportDto = userReportService.queryHXReportDataNew(houLinePersonnelReportVo);
  44. return HttpResult.ok("查询数据成功", houLinePersonnelReportDto);
  45. }catch (Exception e){
  46. return HttpResult.error("查询错误"+e.getMessage());
  47. }
  48. }
  49. /**
  50. * @version
  51. * @author: whp
  52. * @Date: 2024/8/07
  53. * @Description: 人员统计-前线人员-代理人统计
  54. */
  55. @PostMapping("queryQxFrontlineAgent")
  56. @ApiOperation(value = "人员统计-前线人员-代理人统计")
  57. public HttpResult<PageResult<QxFrontlineAgentDto>> queryQxFrontlineAgent(@RequestBody QxFrontlineAgentVo qxFrontlineAgentVo, HttpServletRequest httpServerRequest) {
  58. KztGetDeptUtils kztGetDeptUtils = new KztGetDeptUtils();
  59. KztGetDeptUtilsDto kztGetDeptUtilsDto = kztGetDeptUtils.KztGetDeptIds(httpServerRequest.getRequestURL().toString());
  60. if(ObjectUtils.isNotEmpty(kztGetDeptUtilsDto)){
  61. if("1".equals(kztGetDeptUtilsDto.getType())){
  62. qxFrontlineAgentVo.setDeptIds(kztGetDeptUtilsDto.getIds());
  63. } else if ("2".equals(kztGetDeptUtilsDto.getType())) {
  64. qxFrontlineAgentVo.setUserIds(kztGetDeptUtilsDto.getIds());
  65. }
  66. }
  67. HttpResult<PageResult<QxFrontlineAgentDto>> result = userReportService.queryQxFrontlineAgent(qxFrontlineAgentVo);
  68. return result;
  69. }
  70. /**
  71. * @description: 人员统计-前线人员-代理人统计-导出
  72. * @author: whp
  73. * @date: 2024/10/08
  74. **/
  75. @PostMapping("/QxFrontlineAgentExcel")
  76. @ApiOperation(value = "人员统计-前线人员-代理人统计-导出")
  77. public HttpResult channelAgentExcel(@RequestBody QxFrontlineAgentVo qxFrontlineAgentVo, HttpServletRequest httpServerRequest) {
  78. KztGetDeptUtils kztGetDeptUtils = new KztGetDeptUtils();
  79. KztGetDeptUtilsDto kztGetDeptUtilsDto = kztGetDeptUtils.KztGetDeptIds(httpServerRequest.getRequestURL().toString());
  80. if(ObjectUtils.isNotEmpty(kztGetDeptUtilsDto)){
  81. if("1".equals(kztGetDeptUtilsDto.getType())){
  82. qxFrontlineAgentVo.setDeptIds(kztGetDeptUtilsDto.getIds());
  83. } else if ("2".equals(kztGetDeptUtilsDto.getType())) {
  84. qxFrontlineAgentVo.setUserIds(kztGetDeptUtilsDto.getIds());
  85. }
  86. }
  87. return this.userReportService.agentExcel(qxFrontlineAgentVo);
  88. }
  89. /**
  90. * @version
  91. * @author: whp
  92. * @Date: 2024/8/07
  93. * @Description: 人员统计-前线人员-代理人统计
  94. */
  95. @PostMapping("queryQxFrontlineAgentRanking")
  96. @ApiOperation(value = "人员统计-前线人员-代理人统计-团队排名")
  97. public HttpResult<List<QxFrontlineAgentDto>> queryQxFrontlineAgentRanking(@RequestBody QxFrontlineAgentVo qxFrontlineAgentVo, HttpServletRequest httpServerRequest) {
  98. try{
  99. KztGetDeptUtils kztGetDeptUtils = new KztGetDeptUtils();
  100. KztGetDeptUtilsDto kztGetDeptUtilsDto = kztGetDeptUtils.KztGetDeptIds(httpServerRequest.getRequestURL().toString());
  101. if(ObjectUtils.isNotEmpty(kztGetDeptUtilsDto)){
  102. if("1".equals(kztGetDeptUtilsDto.getType())){
  103. qxFrontlineAgentVo.setDeptIds(kztGetDeptUtilsDto.getIds());
  104. } else if ("2".equals(kztGetDeptUtilsDto.getType())) {
  105. qxFrontlineAgentVo.setUserIds(kztGetDeptUtilsDto.getIds());
  106. }
  107. }
  108. List<QxFrontlineAgentDto> result = userReportService.queryQxFrontlineAgentRanking(qxFrontlineAgentVo);
  109. return HttpResult.ok("查询数据成功", result);
  110. }catch (Exception e){
  111. return HttpResult.error("查询错误"+e.getMessage());
  112. }
  113. }
  114. /**
  115. * @version
  116. * @author: whp
  117. * @Date: 2024/8/07
  118. * @Description: 人员统计-前线人员-代理人统计-详情
  119. */
  120. @PostMapping("queryQxFrontlineDetails")
  121. @ApiOperation(value = "人员统计-前线人员-代理人统计-团队管理")
  122. public HttpResult<EsmUserCountVO> queryQxFrontlineDetails(@RequestBody QxFrontlineAgentVo qxFrontlineAgentVo) {
  123. HttpResult<EsmUserCountVO> result = userReportService.queryQxFrontlineDetails(qxFrontlineAgentVo);
  124. return result;
  125. }
  126. /**
  127. * @version
  128. * @author: whp
  129. * @Date: 2024/8/07
  130. * @Description: 人员统计-前线人员-渠道-详情
  131. */
  132. @PostMapping("queryChannelDetails")
  133. @ApiOperation(value = "人员统计-前线人员-渠道明细")
  134. public HttpResult<List<QxFrontlineAgentDto>> queryChannelDetails(@RequestBody QxFrontlineAgentVo qxFrontlineAgentVo,HttpServletRequest httpServerRequest) {
  135. KztGetDeptUtils kztGetDeptUtils = new KztGetDeptUtils();
  136. KztGetDeptUtilsDto kztGetDeptUtilsDto = kztGetDeptUtils.KztGetDeptIds(httpServerRequest.getRequestURL().toString());
  137. if(ObjectUtils.isNotEmpty(kztGetDeptUtilsDto)){
  138. if("1".equals(kztGetDeptUtilsDto.getType())){
  139. qxFrontlineAgentVo.setDeptIds(kztGetDeptUtilsDto.getIds());
  140. } else if ("2".equals(kztGetDeptUtilsDto.getType())) {
  141. qxFrontlineAgentVo.setUserIds(kztGetDeptUtilsDto.getIds());
  142. }
  143. }
  144. HttpResult<List<QxFrontlineAgentDto>> result = userReportService.queryChannelDetails(qxFrontlineAgentVo);
  145. return result;
  146. }
  147. /**
  148. * @version
  149. * @author: whp
  150. * @Date: 2024/8/07
  151. * @Description: 人员统计-前线人员-代理人统计-详情
  152. */
  153. @PostMapping("queryQxFrontlineDetailsUser")
  154. @ApiOperation(value = "人员统计-前线人员-代理人统计")
  155. public HttpResult<IPage<QxFrontlineAgentDto>> queryQxFrontlineDetailsUser(@RequestBody QxFrontlineAgentVo qxFrontlineAgentVo) {
  156. HttpResult<IPage<QxFrontlineAgentDto>> result = userReportService.queryQxFrontlineDetailsUser(qxFrontlineAgentVo);
  157. return result;
  158. }
  159. /**
  160. * @version
  161. * @author: whp
  162. * @Date: 2024/8/07
  163. * @Description: 人员统计-前线人员-代理人统计 -人员详情
  164. */
  165. @GetMapping("getByUserId/{userId}")
  166. @ApiOperation(value = "人员统计-前线人员-代理人统计-团队排名")
  167. public HttpResult<QxFrontlineAgentDto> getByUserId( @PathVariable("userId") String userId) {
  168. try{
  169. QxFrontlineAgentDto result= userReportService.getByUserId(userId);
  170. return HttpResult.ok("查询数据成功", result);
  171. }catch (Exception e){
  172. return HttpResult.error("查询错误"+e.getMessage());
  173. }
  174. }
  175. @PostMapping("agentTreeStructure")
  176. @ApiOperation(value = "代理人树形")
  177. public HttpResult<List<EsmUserReferrerDTO>> agentTreeStructure(@RequestBody QxFrontlineAgentVo qxFrontlineAgentVo) {
  178. try{
  179. List<EsmUserReferrerDTO> result= userReportService.agentTreeStructure(qxFrontlineAgentVo);
  180. return HttpResult.ok("查询数据成功", result);
  181. }catch (Exception e){
  182. return HttpResult.error("查询错误"+e.getMessage());
  183. }
  184. }
  185. }