ソースを参照

权限功能修改

liujh 3 年 前
コミット
cdbad74eca

+ 6 - 0
zd-common/zd-common-core/src/main/java/com/zd/common/core/domain/per/PerPrefix.java

@@ -609,6 +609,12 @@ public class PerPrefix {
     public static final String AIRBOTTLE_TAG= "airbottle:tag:";
 
     /**
+     * 气瓶货物
+     */
+    public static final String AIRBOTTLE_GOOGS= "airbottle:googs:";
+
+
+    /**
      * 气瓶出库
      */
     public static final String AIRBOTTLE_STORAGE_OUT= "airbottle:storageOutManage:";

+ 16 - 8
zd-common/zd-common-datascope/src/main/java/com/zd/common/datascope/aspect/DataScopeAspect.java

@@ -2,6 +2,7 @@ package com.zd.common.datascope.aspect;
 
 import java.lang.reflect.Method;
 import java.util.List;
+import java.util.function.Predicate;
 import java.util.logging.Logger;
 
 import com.zd.common.core.constant.UserConstants;
@@ -207,10 +208,13 @@ public class DataScopeAspect {
         }*/
 
         if (StringUtils.isNotBlank(sqlString.toString())) {
-            Object params = joinPoint.getArgs()[0];
-            if (StringUtils.isNotNull(params) && params instanceof BaseEntity) {
-                BaseEntity baseEntity = (BaseEntity) params;
-                baseEntity.getParams().put(DATA_SCOPE, " AND (" + sqlString.substring(4) + ")");
+            Predicate<JoinPoint> predicate = x-> x.getArgs().length>0;
+            if(predicate.test(joinPoint)) {
+                Object params = joinPoint.getArgs()[0];
+                if (StringUtils.isNotNull(params) && params instanceof BaseEntity) {
+                    BaseEntity baseEntity = (BaseEntity) params;
+                    baseEntity.getParams().put(DATA_SCOPE, " AND (" + sqlString.substring(4) + ")");
+                }
             }
         }
     }
@@ -233,10 +237,14 @@ public class DataScopeAspect {
      * 拼接权限sql前先清空params.dataScope参数防止注入
      */
     private void clearDataScope(final JoinPoint joinPoint) {
-        Object params = joinPoint.getArgs()[0];
-        if (StringUtils.isNotNull(params) && params instanceof BaseEntity) {
-            BaseEntity baseEntity = (BaseEntity) params;
-            baseEntity.getParams().put(DATA_SCOPE, "");
+        Predicate<JoinPoint> predicate = x-> x.getArgs().length>0;
+        if(predicate.test(joinPoint)){
+            Object params = joinPoint.getArgs()[0];
+            if (StringUtils.isNotNull(params) && params instanceof BaseEntity) {
+                BaseEntity baseEntity = (BaseEntity) params;
+                baseEntity.getParams().put(DATA_SCOPE, "");
+            }
         }
+
     }
 }

+ 7 - 5
zd-modules/zd-airbottle/src/main/java/com/zd/airbottle/controller/QpAirGoogsController.java

@@ -6,6 +6,8 @@ import com.zd.airbottle.domain.dto.QpAirGoogsDto;
 import com.zd.airbottle.domain.vo.QpAirGoogsVo;
 import com.zd.airbottle.service.IQpAirBottleService;
 import com.zd.airbottle.service.IQpAirGoogsService;
+import com.zd.common.core.domain.per.PerFun;
+import com.zd.common.core.domain.per.PerPrefix;
 import com.zd.common.core.web.controller.BaseController;
 import com.zd.common.core.web.page.TableDataInfo;
 import com.zd.common.log.annotation.Log;
@@ -36,7 +38,7 @@ public class QpAirGoogsController extends BaseController<QpAirGoogs> {
     /**
      * 查询气瓶货物列表
      */
-    @PreAuthorize(hasPermi = "airbottle:googs:list")
+    @PreAuthorize(hasPermi = PerPrefix.AIRBOTTLE_GOOGS+ PerFun.LIST)
     @GetMapping("/list")
     @ApiOperation(value = "查询气瓶货物列表")
     public TableDataInfo<QpAirGoogsVo> list(QpAirGoogs qpAirGoogs) {
@@ -49,7 +51,7 @@ public class QpAirGoogsController extends BaseController<QpAirGoogs> {
      * 获取气瓶货物详细信息
      */
     @ApiOperation(value = "获取气瓶货物详细信息")
-    @PreAuthorize(hasPermi = "airbottle:googs:query")
+    @PreAuthorize(hasPermi = PerPrefix.AIRBOTTLE_GOOGS+ PerFun.QUERY)
     @GetMapping(value = "/{id}")
     public ResultData<QpAirGoogsVo> getInfo(@PathVariable("id") Long id) {
         return ResultData.success(qpAirGoogsService.getById(id));
@@ -68,7 +70,7 @@ public class QpAirGoogsController extends BaseController<QpAirGoogs> {
      * 新增气瓶货物
      */
     @ApiOperation(value = "新增气瓶货物")
-    @PreAuthorize(hasPermi = "airbottle:googs:add")
+    @PreAuthorize(hasPermi = PerPrefix.AIRBOTTLE_GOOGS+ PerFun.ADD)
     @Log(title = "气瓶货物", businessType = BusinessType.INSERT)
     @PostMapping
     public ResultData<Boolean> add(@RequestBody QpAirGoogsDto googsDto) {
@@ -79,7 +81,7 @@ public class QpAirGoogsController extends BaseController<QpAirGoogs> {
      * 修改气瓶货物
      */
     @ApiOperation(value = "修改气瓶货物")
-    @PreAuthorize(hasPermi = "airbottle:googs:edit")
+    @PreAuthorize(hasPermi = PerPrefix.AIRBOTTLE_GOOGS+ PerFun.EDIT)
     @Log(title = "气瓶货物", businessType = BusinessType.UPDATE)
     @PutMapping
     public ResultData<Boolean> edit(@RequestBody QpAirGoogsDto googsDto) {
@@ -90,7 +92,7 @@ public class QpAirGoogsController extends BaseController<QpAirGoogs> {
      * 删除气瓶货物
      */
     @ApiOperation(value = "删除气瓶货物")
-    @PreAuthorize(hasPermi = "airbottle:googs:remove")
+    @PreAuthorize(hasPermi = PerPrefix.AIRBOTTLE_GOOGS+ PerFun.REMOVE)
     @Log(title = "气瓶货物", businessType = BusinessType.DELETE)
     @DeleteMapping("/{ids}")
     public ResultData<Boolean> remove(@PathVariable Long[] ids) {

+ 3 - 0
zd-modules/zd-airbottle/src/main/java/com/zd/airbottle/service/impl/QpAirGoogsServiceImpl.java

@@ -10,9 +10,11 @@ import com.zd.airbottle.domain.vo.QpAirGoogsVo;
 import com.zd.airbottle.mapper.QpAirGoogsMapper;
 import com.zd.airbottle.service.IQpAirGoodsConfigService;
 import com.zd.airbottle.service.IQpAirGoogsService;
+import com.zd.common.core.domain.per.PerPrefix;
 import com.zd.common.core.utils.DateUtils;
 import com.zd.common.core.utils.SecurityUtils;
 import com.zd.common.core.utils.bean.TransferUtils;
+import com.zd.common.datascope.annotation.DataScope;
 import com.zd.common.security.utils.SaveUtil;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -88,6 +90,7 @@ public class QpAirGoogsServiceImpl implements IQpAirGoogsService {
      * @return 气瓶货物
      */
     @Override
+    @DataScope(deptAlias = "d", userAlias = "u", permi = PerPrefix.AIRBOTTLE_GOOGS)
     public List<QpAirGoogs> selectQpAirGoogsList(QpAirGoogs qpAirGoogs) {
         return qpAirGoogsMapper.selectQpAirGoogsList(qpAirGoogs);
     }

+ 3 - 0
zd-modules/zd-airbottle/src/main/java/com/zd/airbottle/service/impl/QpTaskServiceImpl.java

@@ -15,8 +15,10 @@ import com.zd.airbottle.service.IQpSupplierService;
 import com.zd.airbottle.service.IQpTaskService;
 import com.zd.common.core.constant.HttpStatus;
 import com.zd.common.core.domain.R;
+import com.zd.common.core.domain.per.PerPrefix;
 import com.zd.common.core.exception.ServiceException;
 import com.zd.common.core.template.TemplateResult;
+import com.zd.common.datascope.annotation.DataScope;
 import com.zd.common.security.service.TokenService;
 import com.zd.common.security.utils.SaveUtil;
 import com.zd.system.api.domain.SysUser;
@@ -73,6 +75,7 @@ public class QpTaskServiceImpl implements IQpTaskService {
      * @return 待办清单表
      */
     @Override
+    @DataScope(deptAlias = "d", userAlias = "u", permi = PerPrefix.AIRBOTTLE_TASK)
     public List<QpTaskVO> selectQpTaskList(QpTaskVO qpTask) {
         return qpTaskMapper.selectQpTaskList(qpTask);
     }

+ 22 - 2
zd-modules/zd-airbottle/src/main/resources/mapper/airbottle/QpAirGoogsMapper.xml

@@ -10,6 +10,8 @@
         <result property="typeId" column="type_id"/>
         <result property="createBy" column="create_by"/>
         <result property="userId" column="user_id"/>
+        <result property="deptId" column="dept_id"/>
+        <result property="deptName" column="dept_name"/>
         <result property="updateTime" column="update_time"/>
         <result property="updateBy" column="update_by"/>
         <result property="createTime" column="create_time"/>
@@ -21,6 +23,8 @@
                type_id,
                create_by,
                user_id,
+               dept_id,
+               dept_name,
                update_time,
                update_by,
                create_time
@@ -32,19 +36,25 @@
                t.type_id,
                t.create_by,
                t.user_id,
+               t.dept_id,
+               t.dept_name,
                t.update_time,
                t.update_by,
                t.create_time
         from qp_air_googs as t
+         LEFT JOIN   sys_dept d on   t.dept_id=d.dept_id
+         LEFT JOIN sys_user u on  t.user_id=u.user_id
     </sql>
     <select id="selectQpAirGoogsList" parameterType="com.zd.airbottle.domain.QpAirGoogs" resultMap="QpAirGoogsResult">
-        <include refid="selectQpAirGoogsVo"/>
+        <include refid="selectQpAirGoogsListVo"/>
         <where>
             <if test="goodsName != null  and goodsName != ''">and goods_name like concat('%', #{goodsName}, '%')</if>
             <if test="searchValue != null  and searchValue != ''">and goods_name like concat('%', #{searchValue}, '%')
             </if>
             <if test="typeId != null ">and type_id = #{typeId}</if>
             <if test="userId != null ">and user_id = #{userId}</if>
+            <if test="deptId != null ">and dept_id = #{deptId}</if>
+            <if test="deptName != null ">and dept_name = #{deptName}</if>
             <if test="startTime != null  and endTime">
                 and date_format( create_time, '%Y-%m-%d' ) BETWEEN #{startTime} AND #{endTime}
             </if>
@@ -54,6 +64,8 @@
                     #{id}
                 </foreach>
             </if>
+            <!-- 数据范围过滤 -->
+            ${params.dataScope}
         </where>
     </select>
 
@@ -74,6 +86,10 @@
 
             <if test="userId != null">user_id,</if>
 
+            <if test="deptId != null">dept_id,</if>
+
+            <if test="deptName != null">dept_name,</if>
+
             <if test="updateTime != null">update_time,</if>
 
             <if test="updateBy != null">update_by,</if>
@@ -86,6 +102,8 @@
             <if test="typeId != null">#{typeId},</if>
             <if test="createBy != null">#{createBy},</if>
             <if test="userId != null">#{userId},</if>
+            <if test="deptId != null">#{deptId},</if>
+            <if test="deptName != null">#{deptName},</if>
             <if test="updateTime != null">#{updateTime},</if>
             <if test="updateBy != null">#{updateBy},</if>
             <if test="createTime != null">#{createTime},</if>
@@ -99,6 +117,8 @@
             <if test="typeId != null">type_id = #{typeId},</if>
             <if test="createBy != null">create_by = #{createBy},</if>
             <if test="userId != null">user_id = #{userId},</if>
+            <if test="deptId != null">dept_id = #{deptId},</if>
+            <if test="deptName != null">dept_name = #{deptName},</if>
             <if test="updateTime != null">update_time = #{updateTime},</if>
             <if test="updateBy != null">update_by = #{updateBy},</if>
             <if test="createTime != null">create_time = #{createTime},</if>
@@ -118,4 +138,4 @@
             #{id}
         </foreach>
     </delete>
-</mapper>
+</mapper>

+ 5 - 1
zd-modules/zd-airbottle/src/main/resources/mapper/airbottle/QpTaskMapper.xml

@@ -78,6 +78,8 @@
                          WHERE td.task_id = t.id
                          AND qp_status = 1),0) from dual) - (select  count(1) from qp_bottle_storage where task_id=t.id))    drkNum /** 待入库总数 **/
         from qp_task as t
+        LEFT JOIN   sys_dept d on   t.dept_id=d.dept_id
+        LEFT JOIN sys_user u on  t.user_id=u.user_id
     </sql>
     <select id="selectQpTaskList" parameterType="com.zd.airbottle.domain.vo.QpTaskVO" resultMap="QpTaskResult">
         <include refid="selectQpTaskListVo"/>
@@ -110,6 +112,8 @@
                     #{id}
                 </foreach>
             </if>
+            <!-- 数据范围过滤 -->
+            ${params.dataScope}
         </where>
         order by create_time desc
     </select>
@@ -360,4 +364,4 @@
         </where>
     </select>
 
-</mapper>
+</mapper>

+ 3 - 2
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/service/impl/LabCheckRecordReleaseServiceImpl.java

@@ -100,8 +100,9 @@ public class LabCheckRecordReleaseServiceImpl implements ILabCheckRecordReleaseS
         //获取当前登录用户信息
         SysUser sysUser = tokenService.getLoginUser().getSysUser();
         labCheckRecordRelease.setUserId(sysUser.getUserId());
-        labCheckRecordRelease.setDeptId(sysUser.getDeptId());
-        labCheckRecordRelease.setDeptName(sysUser.getDeptName());
+        labCheckRecordRelease.setCreateBy(sysUser.getNickName());
+        labCheckRecordRelease.setDeptId(sysUser.getDept().getDeptId());
+        labCheckRecordRelease.setDeptName(sysUser.getDept().getDeptName());
         labCheckRecordRelease.setCreateTime(new Date());
 
         //数据入库操作 刷新安全检查表 发布状态

+ 3 - 1
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/service/impl/LabCheckRecordServiceImpl.java

@@ -200,9 +200,11 @@ public class LabCheckRecordServiceImpl implements ILabCheckRecordService
             LabCheckRecordRelease lcrr = new LabCheckRecordRelease();
             lcrr.setCheckId(String.valueOf(labCheckRecordVo.getId()));
             lcrr.setReleaseDescribe(labCheckRecordVo.getCheckName());
+            lcrr.setCreateTime(new Date());
             lcrr.setUserId(sysUser.getUserId());
             lcrr.setCreateBy(sysUser.getNickName());
-            lcrr.setCreateTime(new Date());
+            lcrr.setDeptId(sysUser.getDept().getDeptId());
+            lcrr.setDeptName(sysUser.getDept().getDeptName());
             iLabCheckRecordReleaseService.insertLabCheckRecordRelease(lcrr);
 
         }

+ 8 - 0
zd-modules/zd-modules-laboratory/src/main/resources/mapper/laboratory/LabCheckRecordReleaseMapper.xml

@@ -65,6 +65,10 @@
 
             <if test="createBy != null">create_by,</if>
 
+            <if test="deptId != null">dept_id,</if>
+
+            <if test="deptName != null">dept_name,</if>
+
             <if test="createTime != null">create_time,</if>
 
             <if test="remark != null">remark,</if>
@@ -75,6 +79,8 @@
             <if test="releaseDescribe != null">#{releaseDescribe},</if>
             <if test="userId != null">#{userId},</if>
             <if test="createBy != null">#{createBy},</if>
+            <if test="deptId != null">#{deptId},</if>
+            <if test="deptName != null">#{deptName},</if>
             <if test="createTime != null">#{createTime},</if>
             <if test="remark != null">#{remark},</if>
         </trim>
@@ -87,6 +93,8 @@
             <if test="releaseDescribe != null">release_describe = #{releaseDescribe},</if>
             <if test="userId != null">user_id = #{userId},</if>
             <if test="createBy != null">create_by = #{createBy},</if>
+            <if test="deptId != null">dept_id = #{deptId},</if>
+            <if test="deptName != null">dept_name = #{deptName},</if>
             <if test="createTime != null">create_time = #{createTime},</if>
             <if test="remark != null">remark = #{remark},</if>
         </trim>

+ 12 - 0
zd-modules/zd-modules-system/src/main/java/com/zd/system/controller/SysDictDataController.java

@@ -128,4 +128,16 @@ public class SysDictDataController extends BaseController {
         dictDataService.deleteDictDataByIds(dictCodes);
         return success();
     }
+
+    /***
+     * 数据字典查询-无权限
+     * @param dictData
+     * @return
+     */
+    @GetMapping("/listNotPower")
+    public TableDataInfo listNotPower(SysDictData dictData) {
+        startPage();
+        List<SysDictData> list = dictDataService.selectDictDataList(dictData);
+        return getDataTable(list);
+    }
 }