CustomerController.java 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. package com.loan.system.controller.wechat;
  2. import com.loan.system.domain.dto.CustomerDTO;
  3. import com.loan.system.domain.entity.Customer;
  4. import com.loan.system.domain.pojo.Result;
  5. import com.loan.system.service.CustomerService;
  6. import com.loan.system.utils.ResultUtil;
  7. import io.swagger.annotations.Api;
  8. import io.swagger.annotations.ApiOperation;
  9. import org.springframework.beans.factory.annotation.Autowired;
  10. import org.springframework.security.access.prepost.PreAuthorize;
  11. import org.springframework.web.bind.annotation.*;
  12. @RestController("AdminCustomerController")
  13. @RequestMapping("/wechat/customers")
  14. @Api(tags = "微信客户接口")
  15. public class CustomerController {
  16. @Autowired
  17. private CustomerService customerService;
  18. @GetMapping
  19. @ApiOperation("查询所有客户")
  20. public Result findAllCustomers(@RequestParam(defaultValue = "0") Integer pageNum, @RequestParam(defaultValue = "10") Integer pageSize){
  21. return ResultUtil.success("success", customerService.getAllCustomers(pageNum, pageSize,false));
  22. }
  23. @GetMapping("/{id}")
  24. @ApiOperation("按id选择客户")
  25. public Result findCustomerById(@PathVariable Long id){
  26. return ResultUtil.success("success", customerService.findByCustomerIdAndIsDelete( id, false));
  27. }
  28. @GetMapping("/keys/{key}")
  29. @ApiOperation("按关键字(姓名/手机号)选择客户")
  30. @PreAuthorize("@pms.hasAnyRoles('SYSTEM_ADMIN','LEAD_SALES', 'ASSIST_SALES')")
  31. public Result findCustomerByKey(@PathVariable("key") String key,@RequestParam(defaultValue = "0") Integer pageNum, @RequestParam(defaultValue = "10") Integer pageSize){
  32. return ResultUtil.success("success", customerService.getCustomerByKey(key,false , pageNum, pageSize));
  33. }
  34. @PostMapping("/confirm/main")
  35. @ApiOperation("手机号与身份证鉴权")
  36. public Result confirm(@RequestBody String mobile){
  37. return ResultUtil.success("success");
  38. }
  39. @PostMapping("/confirm/faceAuth")
  40. @ApiOperation("人脸识别鉴权")
  41. public Result faceAuth(@RequestBody String mobile){
  42. return ResultUtil.success("success");
  43. }
  44. @PostMapping("/confirm/bankAccount")
  45. @ApiOperation("银行账号鉴权")
  46. public Result bankAccount(@RequestBody String mobile){
  47. return ResultUtil.success("success");
  48. }
  49. @PostMapping("/addInfo")
  50. @ApiOperation("补充客户信息")
  51. public Result addInfo(@RequestBody CustomerDTO customerDTO){
  52. customerService.updateInfoByOpenId(customerDTO);
  53. return ResultUtil.success("success");
  54. }
  55. @GetMapping("/openId/{id}")
  56. @ApiOperation("获取客户信息")
  57. public Result getCustomerInfo(@PathVariable("id") String openId){
  58. return ResultUtil.success("success", customerService.getCustomerByOpenId(openId));
  59. }
  60. }