123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116 |
- package com.zhongzheng.controller.base;
- import com.zhongzheng.common.annotation.Log;
- import com.zhongzheng.common.core.controller.BaseController;
- import com.zhongzheng.common.core.domain.AjaxResult;
- import com.zhongzheng.common.core.page.TableDataInfo;
- import com.zhongzheng.common.core.redis.RedisCache;
- import com.zhongzheng.common.enums.BusinessType;
- import com.zhongzheng.common.utils.ServletUtils;
- import com.zhongzheng.framework.web.service.WxTokenService;
- import com.zhongzheng.modules.base.bo.UserProfileAddBo;
- import com.zhongzheng.modules.base.bo.UserProfileEditBo;
- import com.zhongzheng.modules.base.bo.UserProfileQueryBo;
- import com.zhongzheng.modules.base.service.IUserProfileService;
- import com.zhongzheng.modules.base.vo.UserProfileVo;
- import com.zhongzheng.modules.user.entity.ClientLoginUser;
- import io.swagger.annotations.Api;
- import io.swagger.annotations.ApiOperation;
- import lombok.RequiredArgsConstructor;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.security.access.prepost.PreAuthorize;
- import org.springframework.web.bind.annotation.*;
- import java.io.IOException;
- import java.util.ArrayList;
- import java.util.Arrays;
- import java.util.List;
- import java.util.concurrent.TimeUnit;
- /**
- * 填写资料审核Controller
- *
- * @author ruoyi
- * @date 2021-12-20
- */
- @Api(value = "填写盖章审核控制器", tags = {"填写盖章审核控制器"})
- @RequiredArgsConstructor(onConstructor_ = @Autowired)
- @RestController
- @RequestMapping("/base/profileStamp")
- public class UserProfileStampController extends BaseController {
- private final IUserProfileService iUserProfileService;
- private final WxTokenService wxTokenService;
- private final RedisCache redisCache;
- /**
- * 新增填写资料审核
- */
- @ApiOperation("新增填写盖章审核")
- @PostMapping()
- public AjaxResult<Void> add(@RequestBody UserProfileAddBo bo) {
- ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
- bo.setUserId(loginUser.getUser().getUserId());
- bo.setTypeStatus(2);
- String key = "PRSTAMP_"+loginUser.getUser().getUserId();
- Long value = redisCache.getCacheObject(key);
- if(value!=null){
- return toAjax(1);
- }
- if(iUserProfileService.insertByAddBo(bo)){
- redisCache.setCacheObject(key,1L,10, TimeUnit.SECONDS);//10秒
- return toAjax(1);
- }
- return toAjax(0);
- }
- /**
- * 修改填写资料审核
- */
- @ApiOperation("修改填写盖章审核")
- @PostMapping("edit")
- public AjaxResult<Void> edit(@RequestBody UserProfileEditBo bo) {
- ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
- bo.setUserId(loginUser.getUser().getUserId());
- bo.setTypeStatus(2);
- return toAjax(iUserProfileService.updateByEditBo(bo) ? 1 : 0);
- }
- /**
- * 获取填写资料审核详细信息
- */
- @ApiOperation("获取填写盖章审核详细信息")
- @GetMapping("/getInfo")
- public AjaxResult<UserProfileVo> getInfo(UserProfileQueryBo bo) {
- ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
- bo.setUserId(loginUser.getUser().getUserId());
- bo.setTypeStatus(2L);
- return AjaxResult.success(iUserProfileService.getInfo(bo));
- }
- @ApiOperation("导出盖章word")
- @PostMapping("/addWord")
- public AjaxResult<Void> addWord(@RequestBody UserProfileAddBo bo) throws IOException {
- ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
- bo.setUserId(loginUser.getUser().getUserId());
- String s =iUserProfileService.addWord(bo);
- return AjaxResult.success(s);
- }
- /**
- * 查询填写资料审核列表
- */
- @ApiOperation("查询填写盖章审核列表")
- @PreAuthorize("@ss.hasPermi('system:profile:list')")
- @GetMapping("/listProfile")
- public TableDataInfo<UserProfileVo> list(UserProfileQueryBo bo) {
- startPage();
- //2为承诺书审核
- bo.setTypeStatus(2L);
- ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
- bo.setUserId(loginUser.getUser().getUserId());
- List<UserProfileVo> list = iUserProfileService.queryList(bo);
- return getDataTable(list);
- }
- }
|