UserProfileStampController.java 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. package com.zhongzheng.controller.base;
  2. import com.zhongzheng.common.annotation.Log;
  3. import com.zhongzheng.common.core.controller.BaseController;
  4. import com.zhongzheng.common.core.domain.AjaxResult;
  5. import com.zhongzheng.common.core.page.TableDataInfo;
  6. import com.zhongzheng.common.core.redis.RedisCache;
  7. import com.zhongzheng.common.enums.BusinessType;
  8. import com.zhongzheng.common.utils.ServletUtils;
  9. import com.zhongzheng.framework.web.service.WxTokenService;
  10. import com.zhongzheng.modules.base.bo.UserProfileAddBo;
  11. import com.zhongzheng.modules.base.bo.UserProfileEditBo;
  12. import com.zhongzheng.modules.base.bo.UserProfileQueryBo;
  13. import com.zhongzheng.modules.base.service.IUserProfileService;
  14. import com.zhongzheng.modules.base.vo.UserProfileVo;
  15. import com.zhongzheng.modules.user.entity.ClientLoginUser;
  16. import io.swagger.annotations.Api;
  17. import io.swagger.annotations.ApiOperation;
  18. import lombok.RequiredArgsConstructor;
  19. import org.springframework.beans.factory.annotation.Autowired;
  20. import org.springframework.security.access.prepost.PreAuthorize;
  21. import org.springframework.web.bind.annotation.*;
  22. import java.io.IOException;
  23. import java.util.ArrayList;
  24. import java.util.Arrays;
  25. import java.util.List;
  26. import java.util.concurrent.TimeUnit;
  27. /**
  28. * 填写资料审核Controller
  29. *
  30. * @author ruoyi
  31. * @date 2021-12-20
  32. */
  33. @Api(value = "填写盖章审核控制器", tags = {"填写盖章审核控制器"})
  34. @RequiredArgsConstructor(onConstructor_ = @Autowired)
  35. @RestController
  36. @RequestMapping("/base/profileStamp")
  37. public class UserProfileStampController extends BaseController {
  38. private final IUserProfileService iUserProfileService;
  39. private final WxTokenService wxTokenService;
  40. private final RedisCache redisCache;
  41. /**
  42. * 新增填写资料审核
  43. */
  44. @ApiOperation("新增填写盖章审核")
  45. @PostMapping()
  46. public AjaxResult<Void> add(@RequestBody UserProfileAddBo bo) {
  47. ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
  48. bo.setUserId(loginUser.getUser().getUserId());
  49. bo.setTypeStatus(2);
  50. String key = "PRSTAMP_"+loginUser.getUser().getUserId();
  51. Long value = redisCache.getCacheObject(key);
  52. if(value!=null){
  53. return toAjax(1);
  54. }
  55. if(iUserProfileService.insertByAddBo(bo)){
  56. redisCache.setCacheObject(key,1L,10, TimeUnit.SECONDS);//10秒
  57. return toAjax(1);
  58. }
  59. return toAjax(0);
  60. }
  61. /**
  62. * 修改填写资料审核
  63. */
  64. @ApiOperation("修改填写盖章审核")
  65. @PostMapping("edit")
  66. public AjaxResult<Void> edit(@RequestBody UserProfileEditBo bo) {
  67. ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
  68. bo.setUserId(loginUser.getUser().getUserId());
  69. bo.setTypeStatus(2);
  70. return toAjax(iUserProfileService.updateByEditBo(bo) ? 1 : 0);
  71. }
  72. /**
  73. * 获取填写资料审核详细信息
  74. */
  75. @ApiOperation("获取填写盖章审核详细信息")
  76. @GetMapping("/getInfo")
  77. public AjaxResult<UserProfileVo> getInfo(UserProfileQueryBo bo) {
  78. ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
  79. bo.setUserId(loginUser.getUser().getUserId());
  80. bo.setTypeStatus(2L);
  81. return AjaxResult.success(iUserProfileService.getInfo(bo));
  82. }
  83. @ApiOperation("导出盖章word")
  84. @PostMapping("/addWord")
  85. public AjaxResult<Void> addWord(@RequestBody UserProfileAddBo bo) throws IOException {
  86. ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
  87. bo.setUserId(loginUser.getUser().getUserId());
  88. String s =iUserProfileService.addWord(bo);
  89. return AjaxResult.success(s);
  90. }
  91. /**
  92. * 查询填写资料审核列表
  93. */
  94. @ApiOperation("查询填写盖章审核列表")
  95. @PreAuthorize("@ss.hasPermi('system:profile:list')")
  96. @GetMapping("/listProfile")
  97. public TableDataInfo<UserProfileVo> list(UserProfileQueryBo bo) {
  98. startPage();
  99. //2为承诺书审核
  100. bo.setTypeStatus(2L);
  101. ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
  102. bo.setUserId(loginUser.getUser().getUserId());
  103. List<UserProfileVo> list = iUserProfileService.queryList(bo);
  104. return getDataTable(list);
  105. }
  106. }