UserFollowController.java 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. package com.goafanti.user.controller;
  2. import com.goafanti.common.bo.Result;
  3. import com.goafanti.common.controller.BaseApiController;
  4. import com.goafanti.common.utils.excel.NewExcelUtil;
  5. import com.goafanti.user.bo.InputUserFollowList;
  6. import com.goafanti.user.bo.outFollowStatisticsList;
  7. import com.goafanti.user.bo.outProvinceFollowStatistic;
  8. import com.goafanti.user.bo.outUserFollowList;
  9. import com.goafanti.user.service.UserFollowService;
  10. import org.springframework.beans.factory.annotation.Autowired;
  11. import org.springframework.beans.factory.annotation.Value;
  12. import org.springframework.web.bind.annotation.RequestMapping;
  13. import org.springframework.web.bind.annotation.RequestMethod;
  14. import org.springframework.web.bind.annotation.RestController;
  15. import java.util.List;
  16. @RestController
  17. @RequestMapping(value = "/api/admin")
  18. public class UserFollowController extends BaseApiController {
  19. @Autowired
  20. private UserFollowService userFollowService;
  21. @Value(value = "${upload.path}")
  22. private String uploadPath = null;
  23. /**
  24. * 用户跟进列表
  25. * @param in
  26. * @return
  27. */
  28. @RequestMapping(value = "/userFollowList", method = RequestMethod.GET)
  29. public Result userFollowList(InputUserFollowList in){
  30. Result res =new Result();
  31. res.data(userFollowService.userFollowList(in));
  32. return res;
  33. }
  34. /**
  35. * 导出用户跟进列表
  36. * @param in
  37. * @return
  38. */
  39. @RequestMapping(value = "/userFollowListExport", method = RequestMethod.GET)
  40. public Result userFollowListExport(InputUserFollowList in){
  41. Result res =new Result();
  42. List<outUserFollowList> list= userFollowService.userFollowListExport(in);
  43. NewExcelUtil<outUserFollowList> excel=new NewExcelUtil<>(outUserFollowList.class);
  44. return excel.exportExcel(list,"客户跟进列表",uploadPath);
  45. }
  46. /**
  47. * 面谈跟进统计
  48. * @return
  49. */
  50. @RequestMapping(value = "/followStatisticsList", method = RequestMethod.GET)
  51. public Result followStatisticsList(String depId,String date,Integer province,Integer sort){
  52. Result res =new Result();
  53. return res.data(userFollowService.followStatisticsList(depId,date,province,sort));
  54. }
  55. /**
  56. * 面谈跟进统计导出
  57. * @return
  58. */
  59. @RequestMapping(value = "/followStatisticsListExport", method = RequestMethod.GET)
  60. public Result followStatisticsListExport(String depId,String date,Integer province,Integer sort,String depName,String provinceName){
  61. Result res =new Result();
  62. List<outFollowStatisticsList> list=userFollowService.followStatisticsList(depId,date,province,sort);
  63. NewExcelUtil<outFollowStatisticsList>excelUtil =new NewExcelUtil<>(outFollowStatisticsList.class);
  64. StringBuffer sb=new StringBuffer("搜索条件=》");
  65. if (depName!=null)sb=sb.append("部门:").append(depName).append(",");
  66. if(provinceName!=null)sb=sb.append("省份:").append(provinceName).append(",");
  67. if(sort!=null){
  68. sb=sb.append("排序:");
  69. if (sort==0)sb=sb.append("按总数量");
  70. else if (sort==1)sb=sb.append("按总金额");
  71. else if (sort==2)sb=sb.append("按总面谈");
  72. sb=sb.append(",");
  73. }
  74. if (date!=null){
  75. sb=sb.append("时间:").append(date).append(",");
  76. }
  77. return excelUtil.exportExcel(list,"面谈跟进统计",uploadPath,sb.substring(0,sb.toString().length()-1));
  78. }
  79. /**
  80. * 省份面谈跟进统计
  81. * @return
  82. */
  83. @RequestMapping(value = "/provinceFollowStatisticsList", method = RequestMethod.GET)
  84. public Result provinceFollowStatisticsList(String depId,String date,Integer province,Integer sort){
  85. Result res =new Result();
  86. return res.data(userFollowService.provinceFollowStatisticsList(depId,date,province,sort));
  87. }
  88. /**
  89. * 省份面谈跟进统计
  90. * @return
  91. */
  92. @RequestMapping(value = "/provinceFollowStatisticsListExport", method = RequestMethod.GET)
  93. public Result provinceFollowStatisticsListExport(String depId,String depName,String date,Integer province,String provinceName,Integer sort){
  94. List<outProvinceFollowStatistic> list = userFollowService.provinceFollowStatisticsList(depId, date, province, sort);
  95. NewExcelUtil<outProvinceFollowStatistic>excelUtil =new NewExcelUtil<>(outProvinceFollowStatistic.class);
  96. StringBuffer sb=new StringBuffer("搜索条件=》");
  97. if (depName!=null)sb=sb.append("部门:").append(depName).append(",");
  98. if(provinceName!=null)sb=sb.append("省份:").append(provinceName).append(",");
  99. if(sort!=null){
  100. sb=sb.append("排序:");
  101. if (sort==0)sb=sb.append("按签单");
  102. else if (sort==1)sb=sb.append("按面谈");
  103. sb=sb.append(",");
  104. }
  105. if (date!=null){
  106. sb=sb.append("时间:").append(date).append(",");
  107. }
  108. return excelUtil.exportExcel(list,"省份面谈跟进统计",uploadPath,sb.substring(0,sb.toString().length()-1));
  109. }
  110. }