UserFollowController.java 3.8 KB

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