Browse Source

企业申请修改

LIVE_YE 2 years ago
parent
commit
dda91157aa

+ 0 - 1
ruoyi-admin/src/main/java/com/ruoyi/web/controller/enterprise/EnterpriseApplyController.java

@@ -69,7 +69,6 @@ public class EnterpriseApplyController extends BaseController
     /**
     /**
      * 新增企业信息审核
      * 新增企业信息审核
      */
      */
-    @Log(title = "企业信息审核", businessType = BusinessType.INSERT)
     @PostMapping
     @PostMapping
     public AjaxResult add(@RequestBody EnterpriseApply enterpriseApply)
     public AjaxResult add(@RequestBody EnterpriseApply enterpriseApply)
     {
     {

+ 6 - 0
ruoyi-common/src/main/java/com/ruoyi/common/constant/CacheConstants.java

@@ -11,6 +11,12 @@ public class CacheConstants
      * 登录用户 redis key
      * 登录用户 redis key
      */
      */
     public static final String LOGIN_TOKEN_KEY = "login_tokens:";
     public static final String LOGIN_TOKEN_KEY = "login_tokens:";
+
+    /**
+     * 登录用户 userId key
+     */
+    public static final String LOGIN_USER_ID = "login_userId:";
+
     /**
     /**
      * 用户登录方式 1 账号密码
      * 用户登录方式 1 账号密码
      */
      */

+ 2 - 0
ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/TokenService.java

@@ -146,6 +146,8 @@ public class TokenService
         // 根据uuid将loginUser缓存
         // 根据uuid将loginUser缓存
         String userKey = getTokenKey(loginUser.getToken());
         String userKey = getTokenKey(loginUser.getToken());
         redisCache.setCacheObject(userKey, loginUser, expireTime, TimeUnit.MINUTES);
         redisCache.setCacheObject(userKey, loginUser, expireTime, TimeUnit.MINUTES);
+        //将userKey也存入redis
+        redisCache.setCacheObject(CacheConstants.LOGIN_USER_ID+String.valueOf(loginUser.getUserId()), userKey, expireTime, TimeUnit.MINUTES);
     }
     }
 
 
     /**
     /**

+ 12 - 2
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/EnterpriseApplyServiceImpl.java

@@ -3,9 +3,11 @@ package com.ruoyi.system.service.impl;
 import java.util.ArrayList;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.List;
 
 
+import com.ruoyi.common.constant.CacheConstants;
 import com.ruoyi.common.core.domain.entity.SysDept;
 import com.ruoyi.common.core.domain.entity.SysDept;
 import com.ruoyi.common.core.domain.entity.SysRole;
 import com.ruoyi.common.core.domain.entity.SysRole;
 import com.ruoyi.common.core.domain.entity.SysUser;
 import com.ruoyi.common.core.domain.entity.SysUser;
+import com.ruoyi.common.core.redis.RedisCache;
 import com.ruoyi.common.utils.DateUtils;
 import com.ruoyi.common.utils.DateUtils;
 import com.ruoyi.common.utils.SecurityUtils;
 import com.ruoyi.common.utils.SecurityUtils;
 import com.ruoyi.system.domain.EnterprisePhoto;
 import com.ruoyi.system.domain.EnterprisePhoto;
@@ -26,6 +28,9 @@ import org.springframework.transaction.annotation.Transactional;
 @Service
 @Service
 public class EnterpriseApplyServiceImpl implements IEnterpriseApplyService 
 public class EnterpriseApplyServiceImpl implements IEnterpriseApplyService 
 {
 {
+
+    @Autowired
+    private RedisCache redisCache;
     @Autowired
     @Autowired
     private EnterpriseApplyMapper enterpriseApplyMapper;
     private EnterpriseApplyMapper enterpriseApplyMapper;
 
 
@@ -51,6 +56,7 @@ public class EnterpriseApplyServiceImpl implements IEnterpriseApplyService
     private SysRoleDeptMapper sysRoleDeptMapper;
     private SysRoleDeptMapper sysRoleDeptMapper;
 
 
 
 
+
     /**
     /**
      * 查询企业信息审核
      * 查询企业信息审核
      * 
      * 
@@ -82,6 +88,7 @@ public class EnterpriseApplyServiceImpl implements IEnterpriseApplyService
      * @return 结果
      * @return 结果
      */
      */
     @Override
     @Override
+    @Transactional
     public int insertEnterpriseApply(EnterpriseApply enterpriseApply)
     public int insertEnterpriseApply(EnterpriseApply enterpriseApply)
     {
     {
         SysUser user = SecurityUtils.getLoginUser().getUser();
         SysUser user = SecurityUtils.getLoginUser().getUser();
@@ -89,6 +96,7 @@ public class EnterpriseApplyServiceImpl implements IEnterpriseApplyService
         enterpriseApply.setUserName(user.getUserName());
         enterpriseApply.setUserName(user.getUserName());
         enterpriseApply.setUserPhone(user.getPhonenumber());
         enterpriseApply.setUserPhone(user.getPhonenumber());
         enterpriseApply.setCreateTime(DateUtils.getNowDate());
         enterpriseApply.setCreateTime(DateUtils.getNowDate());
+        enterpriseApply.setUpdateTime(DateUtils.getNowDate());
         int count = enterpriseApplyMapper.insertEnterpriseApply(enterpriseApply);
         int count = enterpriseApplyMapper.insertEnterpriseApply(enterpriseApply);
         //保存图片信息
         //保存图片信息
         List<EnterprisePhoto> enterprisePhotoList  = enterpriseApply.getEnterprisePhotoList();
         List<EnterprisePhoto> enterprisePhotoList  = enterpriseApply.getEnterprisePhotoList();
@@ -158,7 +166,7 @@ public class EnterpriseApplyServiceImpl implements IEnterpriseApplyService
     @Transactional
     @Transactional
     public int edit(EnterpriseApply enterpriseApply) {
     public int edit(EnterpriseApply enterpriseApply) {
         try{
         try{
-            enterpriseApply.setUpdateTime(DateUtils.getNowDate());
+            //enterpriseApply.setUpdateTime(DateUtils.getNowDate());
             if("1".equals(enterpriseApply.getIsAudit() )){
             if("1".equals(enterpriseApply.getIsAudit() )){
                 //审核通过
                 //审核通过
                 // 删除用户与角色关联
                 // 删除用户与角色关联
@@ -202,7 +210,9 @@ public class EnterpriseApplyServiceImpl implements IEnterpriseApplyService
                 applyForUser.setDeptId(dept.getDeptId());
                 applyForUser.setDeptId(dept.getDeptId());
                 applyForUser.setApplyFor("1");
                 applyForUser.setApplyFor("1");
                 userMapper.updateUser(applyForUser);
                 userMapper.updateUser(applyForUser);
-
+                //删除登录tocken
+                String userKey = redisCache.getCacheObject(CacheConstants.LOGIN_USER_ID+String.valueOf(enterpriseApply.getUserId()));
+                redisCache.deleteObject(userKey);
             }
             }
             return enterpriseApplyMapper.updateEnterpriseApply(enterpriseApply);
             return enterpriseApplyMapper.updateEnterpriseApply(enterpriseApply);
         }catch (Exception e){
         }catch (Exception e){