Parcourir la source

Merge remote-tracking branch 'origin/test-merge' into test-merge

LHB il y a 1 jour
Parent
commit
acd445e9bb

+ 47 - 0
blade-service/blade-archive/src/main/java/org/springblade/archive/service/impl/ArchivesAutoServiceImpl.java

@@ -54,6 +54,7 @@ import org.springblade.business.feign.MetadataClassificationClient;
 import org.springblade.business.feign.TaskClient;
 import org.springblade.common.utils.CommonUtil;
 import org.springblade.common.utils.SnowFlakeUtil;
+import org.springblade.common.utils.SystemUtils;
 import org.springblade.core.log.exception.ServiceException;
 import org.springblade.core.mp.base.BaseServiceImpl;
 import org.springblade.core.mp.support.Condition;
@@ -76,15 +77,18 @@ import org.springblade.system.entity.DictBiz;
 import org.springblade.system.feign.IDictBizClient;
 import org.springblade.system.user.entity.User;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.redis.core.StringRedisTemplate;
 import org.springframework.jdbc.core.BeanPropertyRowMapper;
 import org.springframework.jdbc.core.JdbcTemplate;
 import org.springframework.scheduling.annotation.Async;
+import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Service;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import org.springframework.transaction.annotation.Transactional;
 
 import org.springframework.web.multipart.MultipartFile;
 
+import javax.annotation.PostConstruct;
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletResponse;
 import java.io.*;
@@ -166,6 +170,8 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
 
 	private final ArchivesSortRuleService archivesSortRuleService;
 
+	private final StringRedisTemplate redisTemplate;
+
 
 	@Override
 	public IPage<ArchivesAutoVO> selectArchivesAutoPage(IPage<ArchivesAutoVO> page, ArchivesAutoVO archivesAuto) {
@@ -5183,6 +5189,14 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
 			try {
 				//先查出勾选的案卷
 				ArchivesAuto archivesAuto=this.getById(id);
+				if (archivesAuto == null || archivesAuto.getActionType() != 2) {
+					continue;
+				}
+				String value = redisTemplate.opsForValue().get("blade:archive:reCreateArchiveAuto1:" + archivesAuto.getId());
+				if (value != null) {
+					continue;
+				}
+				redisTemplate.opsForValue().set("blade:archive:reCreateArchiveAuto1:" + archivesAuto.getId(), "", 60 * 60 * 1000, TimeUnit.MILLISECONDS);
 				//查出所有案卷文件
 				List<ArchiveFile>archiveFileList=archiveFileClient.getArchiveFileByArchiveIds(id+"");
 				//设置案卷页码和四要素
@@ -5193,6 +5207,8 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
 			} catch (Exception e) {
 				log.error("案卷重组失败," + "案卷ID:" + id, e);
 				this.update(Wrappers.<ArchivesAuto>lambdaUpdate().set(ArchivesAuto::getActionType, -2).eq(ArchivesAuto::getId, id));
+			} finally {
+				redisTemplate.delete("blade:archive:reCreateArchiveAuto1:" + id);
 			}
 		}
 	}
@@ -5475,6 +5491,37 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
 		Type listType = new TypeToken<List<String>>(){}.getType();
 		return gson.fromJson(gson.toJson(resultMap.get("lines")), listType);
 	}
+
+	@Scheduled(fixedDelay = 1000 * 60 * 10)
+	public void reCreateArchiveAuto() {
+		if (SystemUtils.isWindows() || SystemUtils.isMacOs()) {
+			return;
+		}
+		List<ArchivesAuto> archivesAutoList = this.list(Wrappers.<ArchivesAuto>lambdaQuery().eq(ArchivesAuto::getActionType, 2));
+		if (archivesAutoList == null || archivesAutoList.isEmpty()) {
+			return;
+		}
+		archivesAutoList.forEach(archivesAuto -> {
+			String value = redisTemplate.opsForValue().get("blade:archive:reCreateArchiveAuto1:" + archivesAuto.getId());
+			if (value == null) {
+				try {
+					redisTemplate.opsForValue().set("blade:archive:reCreateArchiveAuto1:" + archivesAuto.getId(), "", 60 * 60 * 1000, TimeUnit.MILLISECONDS);
+					//查出所有案卷文件
+					List<ArchiveFile>archiveFileList=archiveFileClient.getArchiveFileByArchiveIds(archivesAuto.getId()+"");
+					//设置案卷页码和四要素
+					if (archiveFileList != null && !archiveFileList.isEmpty()) {
+						this.reCreateArchiveAuto(archivesAuto, archiveFileList);
+					}
+					this.update(Wrappers.<ArchivesAuto>lambdaUpdate().set(ArchivesAuto::getActionType, 0).eq(ArchivesAuto::getId, archivesAuto.getId()));
+				} catch (Exception e) {
+					log.error("案卷重组失败," + "案卷ID:" + archivesAuto.getId(), e);
+					this.update(Wrappers.<ArchivesAuto>lambdaUpdate().set(ArchivesAuto::getActionType, -2).eq(ArchivesAuto::getId, archivesAuto.getId()));
+				} finally {
+					redisTemplate.delete("blade:archive:reCreateArchiveAuto1:" + archivesAuto.getId());
+				}
+			}
+		});
+	}
 }
 
 

+ 42 - 38
blade-service/blade-business/src/main/java/org/springblade/business/controller/TaskController.java

@@ -1743,7 +1743,7 @@ public class TaskController extends BladeController {
             if (dto.getSelectedType().equals(1)) {
                 // 待办页面逻辑
                 if (ObjectUtil.isNotEmpty(dto.getStatusValue()) && dto.getStatusValue().equals(1)) {
-                    sqlString.append("EXISTS (SELECT 1 FROM u_task_parallel WHERE u_task.process_instance_id = u_task_parallel.process_instance_id AND u_task_parallel.status = ? AND u_task_parallel.task_user = ? AND u_task_parallel.e_visa_content!='当前等待电签的批次较多,请等待几分钟后刷新页面查看........')");
+                    sqlString.append("EXISTS (SELECT 1 FROM u_task_parallel WHERE u_task.process_instance_id = u_task_parallel.process_instance_id AND u_task_parallel.status = ? AND u_task_parallel.task_user = ? AND (u_task_parallel.e_visa_content!='当前等待电签的批次较多,请等待几分钟后刷新页面查看........' OR u_task_parallel.e_visa_content IS NULL))");
                     params.add(1);
                     params.add(SecureUtil.getUserId());
                     // 关联电签状态字段
@@ -1757,7 +1757,7 @@ public class TaskController extends BladeController {
                     return R.data(emptyPage);
                 } else {
                     // 待办页未选状态:默认查待审批
-                    sqlString.append("EXISTS (SELECT 1 FROM u_task_parallel WHERE u_task.process_instance_id = u_task_parallel.process_instance_id AND u_task_parallel.status = ? AND u_task_parallel.task_user = ? AND u_task_parallel.e_visa_content!='当前等待电签的批次较多,请等待几分钟后刷新页面查看........')");
+                    sqlString.append("EXISTS (SELECT 1 FROM u_task_parallel WHERE u_task.process_instance_id = u_task_parallel.process_instance_id AND u_task_parallel.status = ? AND u_task_parallel.task_user = ? AND (u_task_parallel.e_visa_content!='当前等待电签的批次较多,请等待几分钟后刷新页面查看........' OR u_task_parallel.e_visa_content IS NULL))");
                     params.add(1);
                     params.add(SecureUtil.getUserId());
                     sqlString.append(" AND status = 1");
@@ -1848,47 +1848,51 @@ public class TaskController extends BladeController {
             fixedsMap = new HashMap<>();
         }
         Map<String, List<TaskParallel>> finalTaskParallelGroupMap = taskParallelGroupMap;
-        List<Task> filteredList = allResultList.stream()
-                .filter(task -> {
-                    // 获取任务流程信息,判断是否是垂直签
-                    if (task.getFixedFlowId() != null && fixedsMap.containsKey(task.getFixedFlowId())) {
-                        // 预设流程
-                        List<FixedFlowLink> fixedFlowLinks = fixedsMap.get(task.getFixedFlowId());
-                        List<FixedFlowLink> linkList = fixedFlowLinks.stream().filter(link -> link.getFixedFlowLinkType() == null).collect(Collectors.toList());
-                        if (linkList.isEmpty()) {
-                            // 获取垂直流程
-                            List<FixedFlowLink> collect = fixedFlowLinks.stream().filter(link -> link.getFixedFlowLinkType() != null && link.getFixedFlowLinkType() == 1).collect(Collectors.toList());
-                            if (!collect.isEmpty()) {
-                                // 走垂直审批逻辑
-                                return handleTaskParallel(fixedFlowLinks, finalTaskParallelGroupMap.get(task.getProcessInstanceId()), SecureUtil.getUserId());
+        List<Task> filteredList=new ArrayList<>();
+        if(dto.getSelectedType()==1){
+            filteredList= allResultList.stream()
+                    .filter(task -> {
+                        // 获取任务流程信息,判断是否是垂直签
+                        if (task.getFixedFlowId() != null && fixedsMap.containsKey(task.getFixedFlowId())) {
+                            // 预设流程
+                            List<FixedFlowLink> fixedFlowLinks = fixedsMap.get(task.getFixedFlowId());
+                            List<FixedFlowLink> linkList = fixedFlowLinks.stream().filter(link -> link.getFixedFlowLinkType() == null).collect(Collectors.toList());
+                            if (linkList.isEmpty()) {
+                                // 获取垂直流程
+                                List<FixedFlowLink> collect = fixedFlowLinks.stream().filter(link -> link.getFixedFlowLinkType() != null && link.getFixedFlowLinkType() == 1).collect(Collectors.toList());
+                                if (!collect.isEmpty()) {
+                                    // 走垂直审批逻辑
+                                    return handleTaskParallel(fixedFlowLinks, finalTaskParallelGroupMap.get(task.getProcessInstanceId()), SecureUtil.getUserId());
+                                }
                             }
                         }
-                    }
-                    // 仅处理垂直签+待办页面的过滤逻辑
-                    if (((projectInfo != null && projectInfo.getApprovalType() == 1)) && dto.getSelectedType() == 1) {
-                        List<TaskParallel> parallelList = finalTaskParallelGroupMap.get(task.getProcessInstanceId());
-                        if (CollectionUtil.isEmpty(parallelList)) {
-                            return false;
-                        }
-                        boolean shouldDisplay = false;
-                        for (TaskParallel tp : parallelList) {
-                            // 当前用户是审批人:显示
-                            if (SecureUtil.getUserId().equals(Long.parseLong(tp.getTaskUser()))) {
-                                shouldDisplay = true;
-                                break;
+                        // 仅处理垂直签+待办页面的过滤逻辑
+                        if (((projectInfo != null && projectInfo.getApprovalType() == 1)) && dto.getSelectedType() == 1) {
+                            List<TaskParallel> parallelList = finalTaskParallelGroupMap.get(task.getProcessInstanceId());
+                            if (CollectionUtil.isEmpty(parallelList)) {
+                                return false;
                             }
-                            // 前序审批未完成:不显示
-                            if (tp.getStatus() != 2) {
-                                break;
+                            boolean shouldDisplay = false;
+                            for (TaskParallel tp : parallelList) {
+                                // 当前用户是审批人:显示
+                                if (SecureUtil.getUserId().equals(Long.parseLong(tp.getTaskUser()))) {
+                                    shouldDisplay = true;
+                                    break;
+                                }
+                                // 前序审批未完成:不显示
+                                if (tp.getStatus() != 2) {
+                                    break;
+                                }
                             }
+                            return shouldDisplay;
                         }
-                        return shouldDisplay;
-                    }
-                    // 其他场景:直接保留
-                    return true;
-                })
-                .collect(Collectors.toList());
-
+                        // 其他场景:直接保留
+                        return true;
+                    })
+                    .collect(Collectors.toList());
+        }else {
+            filteredList= allResultList;
+        }
         // 7. 基于过滤后的数据计算分页
         int current = dto.getCurrent();
         int size = dto.getSize();