|
@@ -13,6 +13,7 @@ import com.cy.guoyan.admin.module.infra.dal.dataobject.file.FileDO;
|
|
|
import com.cy.guoyan.admin.module.infra.dal.mysql.file.FileMapper;
|
|
|
import com.cy.guoyan.admin.module.infra.service.file.FileService;
|
|
|
import com.cy.guoyan.admin.module.system.enums.common.JobTypeCodeConstants;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import javax.annotation.Resource;
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
@@ -66,19 +67,9 @@ public class ResearchTopicInfoServiceImpl implements ResearchTopicInfoService {
|
|
|
researchTopicInfo.setOriginalPubYear(Integer.parseInt(year));
|
|
|
}
|
|
|
researchTopicInfo.setImported("0");
|
|
|
-// if (createReqVO.getTopicCategoryList() != null) {
|
|
|
-// // 1. 主题分类使用英文分号拼接,末尾加分号
|
|
|
-// String topicCategory = String.join(";", createReqVO.getTopicCategoryList()) + ";";
|
|
|
-// researchTopicInfo.setTopicCategory(topicCategory);
|
|
|
-// }
|
|
|
-// if (createReqVO.getTopicCategoryCodeList() != null) {
|
|
|
-// // 2. 编号前后都加点,并用点连接,末尾加一个点
|
|
|
-// String topicCategoryCode = createReqVO.getTopicCategoryCodeList().stream()
|
|
|
-// .map(String::valueOf)
|
|
|
-// .collect(Collectors.joining(".", ".", "."));
|
|
|
-// researchTopicInfo.setTopicCategoryCode(topicCategoryCode);
|
|
|
-// }
|
|
|
-
|
|
|
+ if (StringUtils.isNotBlank(createReqVO.getImage())) {
|
|
|
+ createReqVO.setImageDate(extractDate(createReqVO.getImage()));
|
|
|
+ }
|
|
|
|
|
|
researchTopicInfoMapper.insert(researchTopicInfo);
|
|
|
if (createReqVO.getFileList() != null) {
|
|
@@ -141,6 +132,10 @@ public class ResearchTopicInfoServiceImpl implements ResearchTopicInfoService {
|
|
|
fileMapper.deleteByIds(removeIds);
|
|
|
}
|
|
|
|
|
|
+ if (StringUtils.isNotBlank(updateReqVO.getImage())) {
|
|
|
+ updateReqVO.setImageDate(extractDate(updateReqVO.getImage()));
|
|
|
+ }
|
|
|
+
|
|
|
// 7. 处理新增
|
|
|
if (!addIds.isEmpty()) {
|
|
|
List<FileVO> fileList = updateReqVO.getFileList().stream()
|
|
@@ -153,7 +148,7 @@ public class ResearchTopicInfoServiceImpl implements ResearchTopicInfoService {
|
|
|
});
|
|
|
|
|
|
List<FileDO> addFileList =BeanUtils.toBean(fileList, FileDO.class);
|
|
|
- fileMapper.insertBatch(addFileList);
|
|
|
+ fileMapper.updateBatch(addFileList);
|
|
|
}
|
|
|
|
|
|
|
|
@@ -244,19 +239,28 @@ public class ResearchTopicInfoServiceImpl implements ResearchTopicInfoService {
|
|
|
infoDO.setAuditTime(LocalDateTime.now());
|
|
|
researchTopicInfoMapper.updateById(infoDO);
|
|
|
}
|
|
|
-
|
|
|
@Override
|
|
|
- public void voidResearchTopicInfo(Long id, String voidStatus) {
|
|
|
+ public void voidResearchTopicInfo(Long id, String status) {
|
|
|
ResearchTopicInfoDO infoDO = researchTopicInfoMapper.selectById(id);
|
|
|
if (infoDO == null) {
|
|
|
throw exception(RESEARCH_TOPIC_INFO_NOT_EXISTS);
|
|
|
}
|
|
|
- String nickname = String.valueOf(
|
|
|
- SecurityFrameworkUtils.getLoginUser().getInfo().get("nickname"));
|
|
|
- infoDO.setAuditStatus(voidStatus);
|
|
|
- infoDO.setAuditor(nickname);
|
|
|
- infoDO.setAuditTime(LocalDateTime.now());
|
|
|
+ infoDO.setStatus(status);
|
|
|
researchTopicInfoMapper.updateById(infoDO);
|
|
|
}
|
|
|
|
|
|
+ public static String extractDate(String path) {
|
|
|
+ // 正则匹配中间的8位数字
|
|
|
+ String regex = "/(\\d{8})/";
|
|
|
+ java.util.regex.Pattern pattern = java.util.regex.Pattern.compile(regex);
|
|
|
+ java.util.regex.Matcher matcher = pattern.matcher(path);
|
|
|
+
|
|
|
+ if (matcher.find()) {
|
|
|
+ return matcher.group(1); // 返回匹配到的日期部分
|
|
|
+ }
|
|
|
+
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|