UserArchivesController.java 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. package com.goafanti.customer.controller;
  2. import com.goafanti.common.bo.Result;
  3. import com.goafanti.common.controller.BaseController;
  4. import com.goafanti.common.model.UserArchives;
  5. import com.goafanti.customer.bo.InputSelectUserArchives;
  6. import com.goafanti.customer.service.UserArchivesService;
  7. import org.springframework.web.bind.annotation.GetMapping;
  8. import org.springframework.web.bind.annotation.PostMapping;
  9. import org.springframework.web.bind.annotation.RequestMapping;
  10. import org.springframework.web.bind.annotation.RestController;
  11. import javax.annotation.Resource;
  12. /**
  13. * 客户档案表(UserArchives)表控制层
  14. *
  15. * @author makejava
  16. * @since 2024-07-12 11:52:01
  17. */
  18. @RestController
  19. @RequestMapping("/api/admin/userArchives")
  20. public class UserArchivesController extends BaseController {
  21. /**
  22. * 服务对象
  23. */
  24. @Resource
  25. private UserArchivesService userArchivesService;
  26. /**
  27. * 新增数据
  28. *
  29. * @param userArchives 实体
  30. * @return 新增结果
  31. */
  32. @PostMapping("/add")
  33. public Result add(UserArchives userArchives) {
  34. return new Result().data(this.userArchivesService.insert(userArchives));
  35. }
  36. /**
  37. * 通过主键查询单条数据
  38. *
  39. * @param id 主键
  40. * @return 单条数据
  41. */
  42. @GetMapping("/get")
  43. public Result<UserArchives> queryById( Integer id) {
  44. return new Result().data(this.userArchivesService.queryById(id));
  45. }
  46. /**
  47. * 编辑用户档案数据
  48. *
  49. * @param userArchives 实体
  50. * @return 编辑结果
  51. */
  52. @PostMapping("/update")
  53. public Result edit(UserArchives userArchives,Integer channelType) {
  54. return new Result().data(this.userArchivesService.update(userArchives,channelType));
  55. }
  56. /**
  57. * 删除数据
  58. *
  59. * @param id 主键
  60. * @return 删除是否成功
  61. */
  62. @GetMapping("/delete")
  63. public Result deleteById(Integer id) {
  64. return new Result().data(this.userArchivesService.deleteById(id));
  65. }
  66. /**
  67. * 列表查询
  68. * @param in 参数
  69. */
  70. @GetMapping("/list")
  71. public Result<UserArchives> list(UserArchives in, Integer pageNo, Integer pageSize) {
  72. return new Result().data(this.userArchivesService.list(in, pageNo, pageSize));
  73. }
  74. /**
  75. * 查询企业档案
  76. *
  77. * @param id 主键
  78. * @return 单条数据
  79. */
  80. @GetMapping("/queryByUid")
  81. public Result<UserArchives> queryByUid( String id) {
  82. return new Result().data(this.userArchivesService.queryByUid(id));
  83. }
  84. /**
  85. * 微信查询查询企业其他信息与档案信息 分享查看
  86. *
  87. * @param id 主键
  88. * @return 单条数据
  89. */
  90. @GetMapping("/queryByUidAll")
  91. public Result queryByUidAll( String id) {
  92. Result res = new Result();
  93. if (userArchivesService.checkPermission(id)){
  94. res.error(buildError("查看超时,请要分享人重新分享。"));
  95. return res;
  96. }
  97. res.data(this.userArchivesService.queryByUidAll(id));
  98. return res;
  99. }
  100. /**
  101. * 微信查询查询企业其他信息与档案信息 上级查看
  102. *
  103. * @param id 主键
  104. * @return 单条数据
  105. */
  106. @GetMapping("/superQueryByUidAll")
  107. public Result superQueryByUidAll( String id) {
  108. Result res = new Result();
  109. res.data(this.userArchivesService.queryByUidAll(id));
  110. return res;
  111. }
  112. /**
  113. * 客户档案汇总
  114. */
  115. @GetMapping("/selectUserArchives")
  116. public Result selectUserArchives( InputSelectUserArchives in) {
  117. Result res = new Result();
  118. if (in.getNewChannel()==null)in.setNewChannel(0);
  119. res.data(this.userArchivesService.selectUserArchives(in));
  120. return res;
  121. }
  122. /**
  123. * 客户档案汇总导出
  124. */
  125. @GetMapping("/selectUserArchives/export")
  126. public Result selectUserArchivesExport( InputSelectUserArchives in) {
  127. if (in.getNewChannel()==null)in.setNewChannel(0);
  128. return (Result) this.userArchivesService.selectUserArchivesExport(in);
  129. }
  130. /**
  131. * 发起参评客户档案汇总
  132. */
  133. @PostMapping("/addAwardsUid")
  134. public Result addAwardsUid( String uid) {
  135. Result res = new Result();
  136. res.data(this.userArchivesService.addAwards(uid,1));
  137. return res;
  138. }
  139. /**
  140. * 选择中奖客户档案
  141. */
  142. @PostMapping("/selectAwardsUid")
  143. public Result selectAwardsUid( String uid) {
  144. Result res = new Result();
  145. res.data(this.userArchivesService.updateAwards(uid,2));
  146. return res;
  147. }
  148. }