package com.goafanti.user.controller; import com.goafanti.common.bo.Result; import com.goafanti.common.controller.BaseApiController; import com.goafanti.common.utils.excel.NewExcelUtil; import com.goafanti.user.bo.InputUserFollowList; import com.goafanti.user.bo.outFollowStatisticsList; import com.goafanti.user.bo.outProvinceFollowStatistic; import com.goafanti.user.bo.outUserFollowList; import com.goafanti.user.service.UserFollowService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; import java.util.List; @RestController @RequestMapping(value = "/api/admin") public class UserFollowController extends BaseApiController { @Autowired private UserFollowService userFollowService; @Value(value = "${upload.path}") private String uploadPath = null; /** * 用户跟进列表 * @param in * @return */ @RequestMapping(value = "/userFollowList", method = RequestMethod.GET) public Result userFollowList(InputUserFollowList in){ Result res =new Result(); res.data(userFollowService.userFollowList(in)); return res; } /** * 导出用户跟进列表 * @param in * @return */ @RequestMapping(value = "/userFollowListExport", method = RequestMethod.GET) public Result userFollowListExport(InputUserFollowList in){ Result res =new Result(); List list= userFollowService.userFollowListExport(in); NewExcelUtil excel=new NewExcelUtil<>(outUserFollowList.class); return excel.exportExcel(list,"客户跟进列表",uploadPath); } /** * 面谈跟进统计 * @return */ @RequestMapping(value = "/followStatisticsList", method = RequestMethod.GET) public Result followStatisticsList(String depId,String date,Integer province,Integer sort){ Result res =new Result(); return res.data(userFollowService.followStatisticsList(depId,date,province,sort)); } /** * 面谈跟进统计导出 * @return */ @RequestMapping(value = "/followStatisticsListExport", method = RequestMethod.GET) public Result followStatisticsListExport(String depId,String date,Integer province,Integer sort,String depName,String provinceName){ Result res =new Result(); List list=userFollowService.followStatisticsList(depId,date,province,sort); NewExcelUtilexcelUtil =new NewExcelUtil<>(outFollowStatisticsList.class); StringBuffer sb=new StringBuffer("搜索条件=》"); if (depName!=null)sb=sb.append("部门:").append(depName).append(","); if(provinceName!=null)sb=sb.append("省份:").append(provinceName).append(","); if(sort!=null){ sb=sb.append("排序:"); if (sort==0)sb=sb.append("按总数量"); else if (sort==1)sb=sb.append("按总金额"); else if (sort==2)sb=sb.append("按总面谈"); sb=sb.append(","); } if (date!=null){ sb=sb.append("时间:").append(date).append(","); } return excelUtil.exportExcel(list,"面谈跟进统计",uploadPath,sb.substring(0,sb.toString().length()-1)); } /** * 省份面谈跟进统计 * @return */ @RequestMapping(value = "/provinceFollowStatisticsList", method = RequestMethod.GET) public Result provinceFollowStatisticsList(String depId,String date,Integer province,Integer sort){ Result res =new Result(); return res.data(userFollowService.provinceFollowStatisticsList(depId,date,province,sort)); } /** * 省份面谈跟进统计 * @return */ @RequestMapping(value = "/provinceFollowStatisticsListExport", method = RequestMethod.GET) public Result provinceFollowStatisticsListExport(String depId,String depName,String date,Integer province,String provinceName,Integer sort){ List list = userFollowService.provinceFollowStatisticsList(depId, date, province, sort); NewExcelUtilexcelUtil =new NewExcelUtil<>(outProvinceFollowStatistic.class); StringBuffer sb=new StringBuffer("搜索条件=》"); if (depName!=null)sb=sb.append("部门:").append(depName).append(","); if(provinceName!=null)sb=sb.append("省份:").append(provinceName).append(","); if(sort!=null){ sb=sb.append("排序:"); if (sort==0)sb=sb.append("按签单"); else if (sort==1)sb=sb.append("按面谈"); sb=sb.append(","); } if (date!=null){ sb=sb.append("时间:").append(date).append(","); } return excelUtil.exportExcel(list,"省份面谈跟进统计",uploadPath,sb.substring(0,sb.toString().length()-1)); } }