|
@@ -55,6 +55,7 @@ import org.springblade.business.feign.TaskClient;
|
|
|
import org.springblade.common.utils.CommonUtil;
|
|
|
import org.springblade.common.utils.DeepSeekClient;
|
|
|
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;
|
|
@@ -77,15 +78,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.*;
|
|
@@ -165,6 +169,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) {
|
|
@@ -5178,15 +5184,30 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
|
|
|
@Async
|
|
|
public void reCreateArchiveAuto1(String ids) {
|
|
|
for (Long id : Func.toLongList(ids)) {
|
|
|
- //先查出勾选的案卷
|
|
|
- ArchivesAuto archivesAuto=this.getById(id);
|
|
|
- //查出所有案卷文件
|
|
|
- List<ArchiveFile>archiveFileList=archiveFileClient.getArchiveFileByArchiveIds(id+"");
|
|
|
- //设置案卷页码和四要素
|
|
|
- if (archiveFileList != null && !archiveFileList.isEmpty()) {
|
|
|
- this.reCreateArchiveAuto(archivesAuto, archiveFileList);
|
|
|
+ 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+"");
|
|
|
+ //设置案卷页码和四要素
|
|
|
+ if (archiveFileList != null && !archiveFileList.isEmpty()) {
|
|
|
+ this.reCreateArchiveAuto(archivesAuto, archiveFileList);
|
|
|
+ }
|
|
|
+ this.update(Wrappers.<ArchivesAuto>lambdaUpdate().set(ArchivesAuto::getActionType, 0).eq(ArchivesAuto::getId, id));
|
|
|
+ } 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);
|
|
|
}
|
|
|
- this.update(Wrappers.<ArchivesAuto>lambdaUpdate().set(ArchivesAuto::getActionType, 0).eq(ArchivesAuto::getId, id));
|
|
|
}
|
|
|
}
|
|
|
@Override
|
|
@@ -5232,13 +5253,18 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
|
|
|
file.setArchiveSort(i++);
|
|
|
waitArchiveFiles.add(file);
|
|
|
}
|
|
|
- archiveFileClient.updateArchiveFile(waitArchiveFiles);
|
|
|
- archivesAuto.setName(name);
|
|
|
- //删除其他案卷
|
|
|
- archivesAutoList.remove(archivesAuto);
|
|
|
- this.deleteLogic(archivesAutoList.stream().map(o->o.getId()).collect(Collectors.toList()));
|
|
|
- this.reCreateArchiveAuto(archivesAuto, archiveFileList);
|
|
|
- this.update(Wrappers.<ArchivesAuto>lambdaUpdate().set(ArchivesAuto::getActionType, 0).in(ArchivesAuto::getId, ids));
|
|
|
+ try {
|
|
|
+ archiveFileClient.updateArchiveFile(waitArchiveFiles);
|
|
|
+ archivesAuto.setName(name);
|
|
|
+ //删除其他案卷
|
|
|
+ archivesAutoList.remove(archivesAuto);
|
|
|
+ this.deleteLogic(archivesAutoList.stream().map(o->o.getId()).collect(Collectors.toList()));
|
|
|
+ this.reCreateArchiveAuto(archivesAuto, archiveFileList);
|
|
|
+ this.update(Wrappers.<ArchivesAuto>lambdaUpdate().set(ArchivesAuto::getActionType, 0).in(ArchivesAuto::getId, ids));
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("案卷并卷失败," + "案卷Ids:" + ids, e);
|
|
|
+ this.update(Wrappers.<ArchivesAuto>lambdaUpdate().set(ArchivesAuto::getActionType, -1).in(ArchivesAuto::getId, ids));
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -5324,6 +5350,37 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
|
|
|
.mapToInt(file -> file.getFilePage() != null ? file.getFilePage() : 0)
|
|
|
.sum();
|
|
|
}
|
|
|
+
|
|
|
+ @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());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|