Pārlūkot izejas kodu

代码权限调整

user5 1 gadu atpakaļ
vecāks
revīzija
45b784c008

+ 1 - 1
jeeplus-modules/jeeplus-finance/src/main/java/com/jeeplus/finance/projectRecords/mapper/CwProjectRecordsMapper.java

@@ -28,7 +28,7 @@ public interface CwProjectRecordsMapper extends BaseMapper<CwProjectRecords> {
      * @param queryWrapper
      * @return
      */
-    @InterceptorIgnore(tenantLine = "true")
+    // @InterceptorIgnore(tenantLine = "true")
     IPage<CwProjectRecordsDTO> findList(Page<CwProjectRecordsDTO> page, @Param(Constants.WRAPPER) QueryWrapper<CwProjectRecords> queryWrapper);
     /**
      * 查询项目数据集合,和上面findList是一样的,目的是跳过findList接口的数据规则(比如仅部门可见、仅自己可见之类的)

+ 5 - 2
jeeplus-modules/jeeplus-flowable/src/main/java/com/jeeplus/flowable/listener/MyExecutionListener.java

@@ -26,8 +26,11 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
-@Component("myExecutionListener")
-public class MyExecutionListener implements ExecutionListener {
+/**
+ * 弃用的流程监听通知类
+ */
+@Component("myExecutionListenerAbandon")
+public class MyExecutionListenerAbandon implements ExecutionListener {
 
     @SneakyThrows
     public void notify(DelegateExecution delegateExecution) {

+ 81 - 0
jeeplus-modules/jeeplus-flowable/src/main/java/com/jeeplus/modules/flowable/listener/MyExecutionListener.java

@@ -0,0 +1,81 @@
+package com.jeeplus.modules.flowable.listener;
+
+import cn.hutool.extra.spring.SpringUtil;
+import com.jeeplus.common.TokenProvider;
+import com.jeeplus.flowable.model.ActRuTaskInfo;
+import com.jeeplus.flowable.model.Flow;
+import com.jeeplus.flowable.service.FlowTaskService;
+import com.jeeplus.flowable.service.MyNoticeService;
+import com.jeeplus.sys.feign.IUserApi;
+import com.jeeplus.sys.service.dto.UserDTO;
+import lombok.SneakyThrows;
+import org.flowable.engine.RuntimeService;
+import org.flowable.engine.delegate.DelegateExecution;
+import org.flowable.engine.delegate.ExecutionListener;
+import org.flowable.engine.runtime.ProcessInstance;
+import org.springframework.stereotype.Component;
+
+import java.text.SimpleDateFormat;
+import java.util.List;
+
+@Component("myExecutionListener")
+public class MyExecutionListener implements ExecutionListener {
+
+    @SneakyThrows
+    public void notify(DelegateExecution delegateExecution) {
+
+        String eventName = delegateExecution.getEventName ( );
+        System.out.println("--------- delegateExecution -----------" + delegateExecution);
+
+        if ( "start".equals ( eventName ) ) {
+            System.out.println ( "start=========" );
+        } else if ( "end".equals ( eventName ) ) {
+            //根据这里的 delegateExecution的id去act_ru_task表中查该流程的数据 对应表中的EXECUTION_ID_
+            ActRuTaskInfo task = SpringUtil.getBean(MyNoticeService.class).getTaskInfoByID(delegateExecution.getId());
+
+            List<Flow> flows = SpringUtil.getBean(FlowTaskService.class).historicTaskList(task.getProcInstId());
+            //根据PROC_DEF_ID_去act_re_deployment中查询流程的名称
+            String substring = task.getProcDefId().substring(0, task.getProcDefId().indexOf(":"));
+            String actName = SpringUtil.getBean(FlowTaskService.class).getActNameByDefId(substring);
+
+            String titleName = "";
+            // 根据流程定义ID查询流程实例
+            ProcessInstance processInstance = SpringUtil.getBean(RuntimeService.class).createProcessInstanceQuery()
+                    .processInstanceId(task.getProcInstId())
+                    .singleResult();
+
+            if (processInstance != null) {
+                // 获取流程实例标题变量名(假设标题存储在名为"title"的变量中)
+                String titleVariableName = "title";
+
+                // 查询流程实例的标题变量
+                Object title = SpringUtil.getBean(RuntimeService.class).getVariable(processInstance.getId(), titleVariableName);
+
+                if (title != null) {
+                    titleName = title.toString();
+                } else {
+                    // 如果标题变量不存在或者没有值,可以返回默认标题
+                    titleName = "";
+                }
+            }
+            Flow flow = new Flow();
+            for (int i=0;i<flows.size();i++){
+                if (flows.get(i).getComment().getMessage().equals("发起流程")){
+                     flow = flows.get(i);
+                }
+            }
+
+            SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+
+            UserDTO userDTO = SpringUtil.getBean(IUserApi.class).getByToken(TokenProvider.getCurrentToken());
+
+            SpringUtil.getBean(MyNoticeService.class).add(task.getProcInstId(),titleName,task.getProcDefId(),actName,
+                    flow.getAssigneeName(),format.format(flow.getHistIns().getEndTime()),
+                    flow.getAssigneeName(),flow.getAssigneeId(),userDTO.getId());
+
+            System.out.println ( "end=========" );
+        } else if ( "take".equals ( eventName ) ) {//连线监听
+            System.out.println ( "take=========" );
+        }
+    }
+}

+ 1 - 1
jeeplus-modules/jeeplus-public-modules/src/main/java/com/jeeplus/pubmodules/serialNumTpl/mapper/xml/TemplateMapper.xml

@@ -19,7 +19,7 @@
 	<select id="queryByComAndBizCode" resultType="com.jeeplus.pubmodules.serialNumTpl.domain.SysSerialnumTpl">
 		select	a.*
 		 from sys_serialnum_tpl a
-		where a.company_id = #{id} and a.biz_code = #{bizCode} and a.del_flag = 0
+		where a.biz_code = #{bizCode} and a.del_flag = 0
 		order by update_time desc
 		limit 1
 	</select>

+ 2 - 1
jeeplus-modules/jeeplus-public-modules/src/main/java/com/jeeplus/pubmodules/supplier/mapper/MaterialSupplierMapper.java

@@ -1,5 +1,6 @@
 package com.jeeplus.pubmodules.supplier.mapper;
 
+import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -12,7 +13,7 @@ import org.apache.ibatis.annotations.Param;
 
 @Mapper
 public interface MaterialSupplierMapper extends BaseMapper<MaterialSupplier> {
-
+    @InterceptorIgnore(tenantLine = "true")
     IPage<MaterialSupplierDTO> findList(Page<MaterialSupplierDTO> page, @Param(Constants.WRAPPER) QueryWrapper<MaterialSupplier> queryWrapper);
 
     MaterialSupplierDTO queryById(@Param("id") String id);

+ 15 - 0
jeeplus-modules/jeeplus-system/src/main/java/com/jeeplus/sys/controller/DataRuleController.java

@@ -18,11 +18,15 @@ import com.jeeplus.sys.service.DataRuleService;
 import com.jeeplus.sys.service.MenuService;
 import com.jeeplus.sys.service.dto.DataRuleDTO;
 import com.jeeplus.sys.service.dto.MenuDTO;
+import com.jeeplus.sys.service.dto.UserDTO;
+import com.jeeplus.sys.utils.UserUtils;
+import com.jeeplus.utils.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.ResponseEntity;
 import org.springframework.web.bind.annotation.*;
 
 import java.util.HashSet;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 
@@ -148,6 +152,17 @@ public class DataRuleController {
 
             boolean existDataRule = false;
             List <DataRuleDTO> dataRuleDTOList = menuDTO.getDataRuleDTOList ( );
+            //对数据作处理,根据当前登陆人所属租户,若不是该登陆人所属租户中的权限限定信息,则进行过滤
+            UserDTO userDTO = UserUtils.getCurrentUserDTO();
+            if(null != userDTO && StringUtils.isNotBlank(userDTO.getTenantDTO().getId()) && !CommonConstants.DEFAULT_TENANT_ID.equals(userDTO.getTenantDTO().getId())){
+                Iterator<DataRuleDTO> it = dataRuleDTOList.iterator();
+                while(it.hasNext()){
+                    DataRuleDTO d = it.next();
+                    if (null != d && null != d.getTenantDTO() && StringUtils.isNotBlank(d.getTenantDTO().getId()) && !userDTO.getTenantDTO().getId().equals(d.getTenantDTO().getId())) {
+                        it.remove();
+                    }
+                }
+            }
             for (DataRuleDTO dataRuleDTO : dataRuleDTOList) {
                 Map <String, Object> dataRuleMap = Maps.newHashMap ( );
                 dataRuleMap.put ( "id", "dataRule-" + dataRuleDTO.getId ( ) );

+ 7 - 0
jeeplus-modules/jeeplus-system/src/main/java/com/jeeplus/sys/mapper/DataRuleMapper.java

@@ -4,7 +4,11 @@
 package com.jeeplus.sys.mapper;
 
 import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.Constants;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.jeeplus.sys.domain.DataRule;
 import com.jeeplus.sys.service.dto.DataRuleDTO;
 import org.apache.ibatis.annotations.Param;
@@ -23,4 +27,7 @@ public interface DataRuleMapper extends BaseMapper <DataRule> {
 
     @InterceptorIgnore
     List <DataRuleDTO> findByUserId(@Param("userId") String userId);
+
+    @InterceptorIgnore(tenantLine = "true")
+    public IPage<DataRule> findList(Page<DataRule> page, @Param(Constants.WRAPPER) QueryWrapper<DataRule> queryWrapper);
 }

+ 2 - 0
jeeplus-modules/jeeplus-system/src/main/java/com/jeeplus/sys/mapper/MenuMapper.java

@@ -3,6 +3,7 @@
  */
 package com.jeeplus.sys.mapper;
 
+import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
 import com.baomidou.mybatisplus.core.conditions.Wrapper;
 import com.baomidou.mybatisplus.core.toolkit.Constants;
 import com.jeeplus.core.domain.TreeMapper;
@@ -24,6 +25,7 @@ public interface MenuMapper extends TreeMapper <Menu> {
 
     void deleteMenuRole(@Param("menuId") String menuId);
 
+    @InterceptorIgnore(tenantLine = "true")
     List <MenuDTO> findAllWithDataRuleList();
 
     List <String> mrList(@Param(Constants.WRAPPER) Wrapper wrapper);

+ 22 - 0
jeeplus-modules/jeeplus-system/src/main/java/com/jeeplus/sys/mapper/xml/DataRuleMapper.xml

@@ -35,4 +35,26 @@
         FROM sys_role_datarule
         WHERE datarule_id = #{dataRuleId}
     </delete>
+
+    <select id="findList" resultType="com.jeeplus.sys.domain.DataRule">
+        SELECT
+            id,
+            menu_id,
+            NAME,
+            class_name,
+            t_field AS field,
+            t_express AS express,
+            t_value AS VALUE,
+            sql_segment,
+            remarks,
+            create_time,
+            create_by_id,
+            update_time,
+            update_by_id,
+            del_flag,
+            tenant_id
+        FROM
+            sys_datarule
+        ${ew.customSqlSegment}
+    </select>
 </mapper>

+ 2 - 1
jeeplus-modules/jeeplus-system/src/main/java/com/jeeplus/sys/mapper/xml/MenuMapper.xml

@@ -95,7 +95,8 @@
         a.t_value AS "value",
         a.sql_segment AS "sqlSegment",
         a.remarks AS "remarks",
-        a.del_flag AS "delFlag"
+        a.del_flag AS "delFlag",
+        a.tenant_id AS "tenantDTO.id"
         FROM sys_datarule a
         <where>
             a.menu_id =#{id} and a.del_flag = 0