|
@@ -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());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|