|
@@ -1,16 +1,8 @@
|
|
|
package cn.iocoder.yudao.module.museums.service.specimeninfo;
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
-import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
|
|
import cn.iocoder.yudao.module.infra.api.file.FileApi;
|
|
|
-import cn.iocoder.yudao.module.museums.dal.dataobject.specimenoutbound.SpecimenOutboundDO;
|
|
|
import cn.iocoder.yudao.module.museums.dal.mysql.specimenoutbound.SpecimenOutboundMapper;
|
|
|
-import cn.iocoder.yudao.module.museums.enums.social.LogRecordConstants;
|
|
|
-import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserSaveReqVO;
|
|
|
-import cn.iocoder.yudao.module.system.dal.dataobject.logger.OperateLogDO;
|
|
|
-import com.fasterxml.jackson.core.JsonProcessingException;
|
|
|
-import com.fasterxml.jackson.core.type.TypeReference;
|
|
|
-import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
import com.mzt.logapi.context.LogRecordContext;
|
|
|
import com.mzt.logapi.service.impl.DiffParseFunction;
|
|
|
import com.mzt.logapi.starter.annotation.LogRecord;
|
|
@@ -27,8 +19,6 @@ import java.io.*;
|
|
|
import java.nio.file.Files;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
-import java.util.zip.ZipEntry;
|
|
|
-import java.util.zip.ZipInputStream;
|
|
|
|
|
|
import cn.iocoder.yudao.module.museums.controller.admin.specimeninfo.vo.*;
|
|
|
import cn.iocoder.yudao.module.museums.dal.dataobject.specimeninfo.SpecimenInfoDO;
|
|
@@ -67,7 +57,7 @@ public class SpecimenInfoServiceImpl implements SpecimenInfoService {
|
|
|
@LogRecord(type = MUSEUMS_SPECIMEN_TYPE, subType = MUSEUMS_SPECIMEN_CREATE_SUB_TYPE,
|
|
|
bizNo = "{{#specimenInfo.id}}",
|
|
|
success = MUSEUMS_SPECIMEN_CREATE_SUCCESS,
|
|
|
- extra = "{{#specimenInfo.id}}")
|
|
|
+ extra = "[{{#specimenInfo.id}}]")
|
|
|
public String createSpecimenInfo(SpecimenInfoSaveReqVO createReqVO) {
|
|
|
// 校验标本编号是否已存在
|
|
|
if (specimenInfoMapper.existsByNumber(createReqVO.getSpecimenNumber())) {
|
|
@@ -85,21 +75,9 @@ public class SpecimenInfoServiceImpl implements SpecimenInfoService {
|
|
|
return "标本创建成功,标本ID:" + specimenInfo.getId();
|
|
|
}
|
|
|
|
|
|
-// @Override
|
|
|
-// @LogRecord(type = MUSEUMS_SPECIMEN_TYPE, subType = MUSEUMS_SPECIMEN_UPDATE_SUB_TYPE, bizNo = "{{#updateReqVO.id}}",
|
|
|
-// success = MUSEUMS_SPECIMEN_UPDATE_SUCCESS , extra = "{{#updateReqVO.id}}")
|
|
|
-// public void updateSpecimenInfo(SpecimenInfoSaveReqVO updateReqVO) {
|
|
|
-// // 校验存在
|
|
|
-// validateSpecimenInfoExists(updateReqVO.getId());
|
|
|
-// // 更新
|
|
|
-// SpecimenInfoDO updateObj = BeanUtils.toBean(updateReqVO, SpecimenInfoDO.class);
|
|
|
-// specimenInfoMapper.updateById(updateObj);
|
|
|
-// // 记录操作日志上下文
|
|
|
-// LogRecordContext.putVariable("update-specimen", updateObj);
|
|
|
-// }
|
|
|
@Override
|
|
|
@LogRecord(type = MUSEUMS_SPECIMEN_TYPE, subType = MUSEUMS_SPECIMEN_UPDATE_SUB_TYPE, bizNo = "{{#updateReqVO.id}}",
|
|
|
- success = MUSEUMS_SPECIMEN_UPDATE_SUCCESS , extra = "{{#updateReqVO.id}}")
|
|
|
+ success = MUSEUMS_SPECIMEN_UPDATE_SUCCESS , extra = "[{{#updateReqVO.id}}]")
|
|
|
public void updateSpecimenInfo(SpecimenInfoSaveReqVO updateReqVO) {
|
|
|
// 校验存在
|
|
|
SpecimenInfoDO specimenInfo = specimenInfoMapper.selectById(updateReqVO.getId());
|
|
@@ -216,11 +194,8 @@ public class SpecimenInfoServiceImpl implements SpecimenInfoService {
|
|
|
successfulSpecimenIds.addAll(updatedSpecimenIds);
|
|
|
|
|
|
// 记录成功导入和更新的标本ID到日志上下文
|
|
|
- LogRecordContext.putVariable("extra", successfulSpecimenIds.stream()
|
|
|
- .map(String::valueOf)
|
|
|
- .collect(Collectors.joining(", "))); // 转换为逗号分隔的字符串
|
|
|
+ LogRecordContext.putVariable("extra", successfulSpecimenIds);
|
|
|
|
|
|
- System.out.println(successfulSpecimenIds);
|
|
|
return respVO;
|
|
|
}
|
|
|
|
|
@@ -248,16 +223,13 @@ public class SpecimenInfoServiceImpl implements SpecimenInfoService {
|
|
|
// 创建临时目录存放解压后的文件
|
|
|
File tempDir = Files.createTempDirectory("specimen_images").toFile();
|
|
|
|
|
|
- // 使用 ZipArchiveInputStream 代替 ZipInputStream,并设置字符编码为 UTF-8
|
|
|
try (ZipArchiveInputStream zipInputStream = new ZipArchiveInputStream(file.getInputStream())) {
|
|
|
ZipArchiveEntry entry;
|
|
|
Set<String> imagePathsSet = new HashSet<>(); // 使用 Set 来去重
|
|
|
|
|
|
while ((entry = zipInputStream.getNextEntry()) != null) {
|
|
|
if (!entry.isDirectory()) {
|
|
|
- // 处理中文文件名问题,使用 entry.getName() 获取文件名,默认是 UTF-8 编码
|
|
|
File newFile = new File(tempDir, entry.getName());
|
|
|
- // 进行解压
|
|
|
try (BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(newFile))) {
|
|
|
byte[] buffer = new byte[1024];
|
|
|
int len;
|
|
@@ -317,8 +289,6 @@ public class SpecimenInfoServiceImpl implements SpecimenInfoService {
|
|
|
return "标本图片导入成功";
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
//工作台
|
|
|
//根据入库的登记情况统计本年标本入库信息
|
|
|
@Override
|
|
@@ -416,7 +386,7 @@ public class SpecimenInfoServiceImpl implements SpecimenInfoService {
|
|
|
}
|
|
|
// 构建最终的返回结果
|
|
|
Map<String, Object> resultMap = new HashMap<>();
|
|
|
- resultMap.put("code", 200);
|
|
|
+ resultMap.put("code", 0);
|
|
|
resultMap.put("data", yearlyStatisticsList);
|
|
|
resultMap.put("msg", "各年入库出库回库标本数");
|
|
|
|