BusinessApiController.java 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. package com.goafanti.customer.controller;
  2. import java.text.SimpleDateFormat;
  3. import java.util.Date;
  4. import javax.annotation.Resource;
  5. import org.springframework.web.bind.annotation.RequestMapping;
  6. import org.springframework.web.bind.annotation.RequestMethod;
  7. import org.springframework.web.bind.annotation.RestController;
  8. import com.goafanti.common.bo.Error;
  9. import com.goafanti.common.bo.Result;
  10. import com.goafanti.common.constant.AFTConstants;
  11. import com.goafanti.common.constant.ErrorConstants;
  12. import com.goafanti.common.controller.BaseController;
  13. import com.goafanti.common.utils.StringUtils;
  14. import com.goafanti.core.shiro.token.TokenManager;
  15. import com.goafanti.customer.bo.BusinessListBo;
  16. import com.goafanti.customer.bo.BussinessFollowBo;
  17. import com.goafanti.customer.service.BusinessService;
  18. @RestController
  19. @RequestMapping("api/admin/customer")
  20. public class BusinessApiController extends BaseController{
  21. @Resource
  22. private BusinessService businessService;
  23. /** 查询业务列表 **/
  24. @RequestMapping(value = "/listBusiness", method = RequestMethod.POST)
  25. public Result listBusiness(BusinessListBo blo,Integer pageNo, Integer pageSize){
  26. Result res = new Result();
  27. res.setData(businessService.listBusiness(blo, pageNo, pageSize));
  28. return res;
  29. }
  30. /** 查询业务字典 **/
  31. @RequestMapping(value = "/findBusinessGlossory",method = RequestMethod.GET)
  32. public Result findBusinessGlossory(){
  33. Result res = new Result();
  34. res.setData(businessService.findBusinessGlossory());
  35. return res;
  36. }
  37. /** 新增客户意向 **/
  38. @RequestMapping(value = "/addBusinessAndFollow", method = RequestMethod.POST)
  39. public Result addBusinessAndFollow(BussinessFollowBo bfb){
  40. Result res = new Result();
  41. if(StringUtils.isBlank(bfb.getBusinessGlossoryId()) || StringUtils.isBlank(bfb.getUid())){
  42. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,""));
  43. return res;
  44. }
  45. if(businessService.judgeBusiness(bfb.getUid(), Integer.parseInt(bfb.getBusinessGlossoryId()))>0){
  46. res.getError().add(new Error("该项业务已经被跟进"));
  47. return res;
  48. }
  49. businessService.addBusinessAndFollow(bfb);
  50. return res;
  51. }
  52. /** 进入新增意向服务 **/
  53. @RequestMapping(value = "/toAddBusinessAndFollow", method = RequestMethod.GET)
  54. public Result toAddBusinessAndFollow(){
  55. Result res = new Result();
  56. BussinessFollowBo bo = new BussinessFollowBo();
  57. bo.setAdminName(TokenManager.getAdminToken().getName());
  58. SimpleDateFormat format = new SimpleDateFormat(AFTConstants.YYYYMMDDHHMMSS);
  59. bo.setCreateTime(format.format(new Date()));
  60. bo.setFollowTime(bo.getCreateTime());
  61. res.setData(bo);
  62. return res;
  63. }
  64. }