UserArchivesInterviewController.java 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. package com.goafanti.Interview.controller;
  2. import com.goafanti.Interview.bo.UpdateUserBo;
  3. import com.goafanti.Interview.service.UserArchivesInterviewService;
  4. import com.goafanti.common.bo.Result;
  5. import com.goafanti.common.constant.AFTConstants;
  6. import com.goafanti.common.controller.BaseController;
  7. import com.goafanti.common.model.UserArchivesInterview;
  8. import com.goafanti.core.shiro.token.TokenManager;
  9. import com.goafanti.customer.bo.InputUserData;
  10. import com.goafanti.customer.service.CustomerService;
  11. import org.springframework.web.bind.annotation.GetMapping;
  12. import org.springframework.web.bind.annotation.PostMapping;
  13. import org.springframework.web.bind.annotation.RequestMapping;
  14. import org.springframework.web.bind.annotation.RestController;
  15. import javax.annotation.Resource;
  16. /**
  17. * 客户档案面谈表(UserArchivesInterview)表控制层
  18. *
  19. * @author makejava
  20. * @since 2025-04-10 17:09:23
  21. */
  22. @RestController
  23. @RequestMapping("/api/admin/interview")
  24. public class UserArchivesInterviewController extends BaseController {
  25. /**
  26. * 服务对象
  27. */
  28. @Resource
  29. private UserArchivesInterviewService userArchivesInterviewService;
  30. @Resource
  31. private CustomerService customerService;
  32. /**
  33. * 新增数据
  34. *
  35. * @param in 实体
  36. * @return 新增结果
  37. */
  38. @PostMapping("/add")
  39. public Result add(UserArchivesInterview in) {
  40. Result res = new Result();
  41. if (in.getUid()==null){
  42. res.getError().add(buildError("客户ID不能为空"));
  43. return res;
  44. }
  45. return res.data(this.userArchivesInterviewService.insert(in));
  46. }
  47. /**
  48. * 通过主键查询单条数据
  49. *
  50. * @param id 主键
  51. * @return 单条数据
  52. */
  53. @GetMapping("/get")
  54. public Result<UserArchivesInterview> queryById(Integer id) {
  55. return new Result().data(this.userArchivesInterviewService.queryById(id));
  56. }
  57. /**
  58. * 编辑数据
  59. *
  60. * @param userArchivesInterview 实体
  61. * @return 编辑结果
  62. */
  63. @PostMapping("/update")
  64. public Result edit(UserArchivesInterview userArchivesInterview) {
  65. return new Result().data(this.userArchivesInterviewService.update(userArchivesInterview));
  66. }
  67. /**
  68. * 删除数据
  69. *
  70. * @param id 主键
  71. * @return 删除是否成功
  72. */
  73. @GetMapping("/delete")
  74. public Result deleteById(Integer id) {
  75. return new Result().data(this.userArchivesInterviewService.deleteById(id));
  76. }
  77. /**
  78. * 客户档案面谈表列表查询
  79. *
  80. * @param in 参数
  81. * @return
  82. */
  83. @GetMapping("/list")
  84. public Result list(UserArchivesInterview in, Integer pageNo, Integer pageSize) {
  85. Result res = new Result();
  86. if (!TokenManager.hasRole(AFTConstants.SUPERADMIN)){
  87. if (in.getUid()==null){
  88. res.getError().add(buildError("客户ID不能为空"));
  89. return res;
  90. }
  91. }
  92. return res.data(this.userArchivesInterviewService.list(in, pageNo, pageSize));
  93. }
  94. /**
  95. * 更新企业档案与面谈 /updateUser
  96. * @return
  97. */
  98. @PostMapping("/updateUser")
  99. public Result updateUser(UpdateUserBo in, InputUserData in2 ) {
  100. Result res = new Result();
  101. in.setAid(TokenManager.getAdminId());
  102. if (in2.getOrgCode()!=null){
  103. in2.setOrgCode(in2.getOrgCode().trim());
  104. if (customerService.checkOrgCode(in2.getOrgCode(),in.getUid())){
  105. res.getError().add(buildError("","统一信用代码已存在"));
  106. return res;
  107. }
  108. }
  109. if (in.getType()!=2){
  110. in2.setProvince(in.getLocationProvince());
  111. in2.setCity(in.getLocationCity());
  112. in2.setArea(in.getLocationArea());
  113. in2.setUid(in.getUid());
  114. customerService.updateUserDate(in2);
  115. }
  116. return res.data(this.userArchivesInterviewService.updateUser(in));
  117. }
  118. /**
  119. * 客户档案面谈信息及其他免谈信息
  120. *
  121. * @return
  122. */
  123. @GetMapping("/selectByPrdid")
  124. public Result selectByPrdid(Integer prdid) {
  125. Result res = new Result();
  126. if (!TokenManager.hasRole(AFTConstants.SUPERADMIN)){
  127. if (prdid==null){
  128. res.getError().add(buildError("客户ID不能为空"));
  129. return res;
  130. }
  131. }
  132. return res.data(this.userArchivesInterviewService.selectByPrdid(prdid));
  133. }
  134. }