Explorar el Código

搜索条件新增

change hace 3 años
padre
commit
a66b727ee0

+ 6 - 1
zhongzheng-admin/src/main/java/com/zhongzheng/controller/base/UserProfileController.java

@@ -3,6 +3,9 @@ package com.zhongzheng.controller.base;
 import java.util.List;
 import java.util.Arrays;
 
+import com.zhongzheng.common.core.domain.model.LoginUser;
+import com.zhongzheng.common.utils.ServletUtils;
+import com.zhongzheng.framework.web.service.TokenService;
 import lombok.RequiredArgsConstructor;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -42,6 +45,7 @@ public class UserProfileController extends BaseController {
 
     private final IUserProfileService iUserProfileService;
 
+    private final TokenService tokenService;
     /**
      * 查询填写资料审核列表
      */
@@ -86,7 +90,8 @@ public class UserProfileController extends BaseController {
     @Log(title = "填写资料审核", businessType = BusinessType.UPDATE)
     @PostMapping()
     public AjaxResult<Void> edit(@RequestBody UserProfileEditBo bo) {
-        return toAjax(iUserProfileService.updateAuditByEditBo(bo) ? 1 : 0);
+        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+        return toAjax(iUserProfileService.updateAuditByEditBo(bo,loginUser) ? 1 : 0);
     }
 
 }

+ 6 - 1
zhongzheng-admin/src/main/java/com/zhongzheng/controller/base/UserProfileStampController.java

@@ -3,8 +3,11 @@ 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.domain.model.LoginUser;
 import com.zhongzheng.common.core.page.TableDataInfo;
 import com.zhongzheng.common.enums.BusinessType;
+import com.zhongzheng.common.utils.ServletUtils;
+import com.zhongzheng.framework.web.service.TokenService;
 import com.zhongzheng.modules.base.bo.UserProfileEditBo;
 import com.zhongzheng.modules.base.bo.UserProfileQueryBo;
 import com.zhongzheng.modules.base.service.IUserProfileService;
@@ -32,6 +35,7 @@ public class UserProfileStampController extends BaseController {
 
     private final IUserProfileService iUserProfileService;
 
+    private final TokenService tokenService;
     /**
      * 查询填写资料审核列表
      */
@@ -76,7 +80,8 @@ public class UserProfileStampController extends BaseController {
     @Log(title = "填写盖章审核", businessType = BusinessType.UPDATE)
     @PostMapping()
     public AjaxResult<Void> edit(@RequestBody UserProfileEditBo bo) {
-        return toAjax(iUserProfileService.updateAuditByEditBo(bo) ? 1 : 0);
+        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+        return toAjax(iUserProfileService.updateAuditByEditBo(bo,loginUser) ? 1 : 0);
     }
 
 }

+ 3 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/base/mapper/UserProfileMapper.java

@@ -4,6 +4,7 @@ import com.zhongzheng.modules.base.bo.UserProfileQueryBo;
 import com.zhongzheng.modules.base.domain.UserProfile;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.zhongzheng.modules.base.vo.UserProfileVo;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 
@@ -20,4 +21,6 @@ public interface UserProfileMapper extends BaseMapper<UserProfile> {
     UserProfileVo getInfo(UserProfileQueryBo bo);
 
     List<UserProfileVo> listRecord(UserProfileQueryBo bo);
+
+    Long selectCountProfile(@Param("userId") Long userId,@Param("goodsId") Long goodsId);
 }

+ 2 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/base/service/IUserProfileService.java

@@ -1,5 +1,6 @@
 package com.zhongzheng.modules.base.service;
 
+import com.zhongzheng.common.core.domain.model.LoginUser;
 import com.zhongzheng.modules.base.domain.UserProfile;
 import com.zhongzheng.modules.base.vo.UserProfileVo;
 import com.zhongzheng.modules.base.bo.UserProfileQueryBo;
@@ -57,7 +58,7 @@ public interface IUserProfileService extends IService<UserProfile> {
 
 	UserProfileVo getInfo(UserProfileQueryBo bo);
 
-	boolean updateAuditByEditBo(UserProfileEditBo bo);
+	boolean updateAuditByEditBo(UserProfileEditBo bo, LoginUser loginUser);
 
 	List<UserProfileVo> listRecord(UserProfileQueryBo bo);
 }

+ 8 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/base/service/impl/UserProfileServiceImpl.java

@@ -10,8 +10,10 @@ import com.alibaba.fastjson.JSONObject;
 import com.fasterxml.jackson.databind.exc.InvalidFormatException;
 import com.openhtmltopdf.swing.Java2DRenderer;
 import com.openhtmltopdf.util.FSImageWriter;
+import com.zhongzheng.common.core.domain.model.LoginUser;
 import com.zhongzheng.common.utils.DateUtils;
 import com.zhongzheng.common.utils.SecurityUtils;
+import com.zhongzheng.common.utils.ServletUtils;
 import com.zhongzheng.modules.alioss.bo.OssRequest;
 import com.zhongzheng.modules.alioss.service.impl.OssServiceImpl;
 import com.zhongzheng.modules.alisms.service.IAliSmsService;
@@ -262,8 +264,13 @@ public class UserProfileServiceImpl extends ServiceImpl<UserProfileMapper, UserP
     }
 
     @Override
-    public boolean updateAuditByEditBo(UserProfileEditBo bo) {
+    public boolean updateAuditByEditBo(UserProfileEditBo bo,LoginUser loginUser) {
         UserProfile update = BeanUtil.toBean(bo,UserProfile.class);
+        UserProfileVo userProfileVo1 = this.queryById(bo.getId());
+
+        if (baseMapper.selectCountProfile(loginUser.getUser().getUserId(),userProfileVo1.getGoodsId()) > 0){
+            throw new IllegalArgumentException("您没有审核权限");
+        }
         update.setId(bo.getId());
         update.setCreateByName("SAAS-"+ SecurityUtils.getUsername());
         update.setUpdateTime(DateUtils.getNowTime());

+ 11 - 0
zhongzheng-system/src/main/resources/mapper/modules/base/UserProfileMapper.xml

@@ -190,4 +190,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </if>
         order by up.create_time desc
     </select>
+
+    <select id="selectCountProfile" parameterType="map" resultType="Long">
+        SELECT
+            COUNT(1)
+        FROM
+            profile_tp p
+        WHERE
+            1 = 1
+          AND FIND_IN_SET(#{goodsId},p.goods_ids)
+          and FIND_IN_SET(#{userId},p.user_ids)
+    </select>
 </mapper>