AdminCustomerApiController.java 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. package com.goafanti.admin.controller;
  2. import java.text.ParseException;
  3. import java.text.SimpleDateFormat;
  4. import java.util.UUID;
  5. import javax.annotation.Resource;
  6. import javax.servlet.http.HttpServletRequest;
  7. import org.springframework.web.bind.annotation.RequestMapping;
  8. import org.springframework.web.bind.annotation.RequestMethod;
  9. import org.springframework.web.bind.annotation.RestController;
  10. import com.goafanti.admin.service.CustomerService;
  11. import com.goafanti.common.bo.Result;
  12. import com.goafanti.common.controller.CertifyApiController;
  13. import com.goafanti.common.model.Customer;
  14. import com.goafanti.core.mybatis.page.Pagination;
  15. import com.goafanti.core.shiro.token.TokenManager;
  16. @RestController
  17. @RequestMapping(value = "/api/admin/customer")
  18. public class AdminCustomerApiController extends CertifyApiController {
  19. @Resource
  20. private CustomerService customerService;
  21. /**
  22. * 新增客户
  23. *
  24. * @return
  25. * @throws ParseException
  26. */
  27. @RequestMapping(value = "/addCustomer", method = RequestMethod.POST)
  28. public Result addCustomer(String createTime, String companyName, String companyIndustry, String companyIntention,
  29. String adress, String customerName, String mobile, String email, String qq, String wechat,
  30. String customerPosition, String remark, String province, String fllowSituation, int sex,
  31. String customerStatue, String department, int customerTyp, String telNum) throws ParseException {
  32. Customer cus = new Customer();
  33. Result res = new Result();
  34. cus.setAdress(adress);
  35. cus.setCompanyIndustry(companyIndustry);
  36. cus.setCompanyIntention(companyIntention);
  37. cus.setCompanyName(companyName);
  38. if (null != createTime && createTime != "") {
  39. cus.setCreateTime((new SimpleDateFormat("yyyy-MM-dd").parse(createTime)));
  40. }
  41. cus.setCustomerName(customerName);
  42. cus.setCustomerPosition(customerPosition);
  43. cus.setCustomerStatue(customerStatue);
  44. cus.setCustomerTyp(customerTyp);
  45. cus.setDepartment(department);
  46. cus.setEmail(email);
  47. cus.setFllowSituation(fllowSituation);
  48. cus.setId(UUID.randomUUID().toString());
  49. cus.setMobile(mobile);
  50. cus.setAid(TokenManager.getUserId());
  51. cus.setProvince(province);
  52. cus.setQq(qq);
  53. cus.setRemark(remark);
  54. cus.setSex(sex);
  55. cus.setTelNum(telNum);
  56. cus.setWechat(wechat);
  57. customerService.addCustomer(cus);
  58. return res;
  59. }
  60. /**
  61. * 删除客户信息
  62. *
  63. * @return
  64. */
  65. @RequestMapping(value = "/deleteCustomer", method = RequestMethod.GET)
  66. public int deleteCustomer(HttpServletRequest req, String id) {
  67. int res = customerService.deleteCustomer(id);
  68. return res;
  69. }
  70. /**
  71. * 查询客户信息
  72. *
  73. * @return
  74. */
  75. @RequestMapping(value = "/SearchCustomerList", method = RequestMethod.GET)
  76. public Result SearchCustomerList(String companyName, Integer customerTyp, String province,
  77. String customerName, String telNum, String customerStatue, String CompanyIntention, String fllowSituation,Integer pageNo,Integer pageSize) {
  78. Result res =new Result();
  79. res.setData(customerService.findCustomerByPage(companyName, customerTyp, province, customerName, telNum, customerStatue,
  80. CompanyIntention, fllowSituation,pageNo,pageSize));
  81. return res;
  82. }
  83. }