Bladeren bron

修改国资研究专题信息

yangshun 2 weken geleden
bovenliggende
commit
f19abfd047

+ 4 - 6
guoyan-module-system/src/main/java/com/cy/guoyan/admin/module/guoyan/controller/admin/researchtopicinfo/ResearchTopicInfoController.java

@@ -57,18 +57,16 @@ public class ResearchTopicInfoController {
     @PutMapping("/audit")
     @Operation(summary = "审核国资研究专题信息")
     @PreAuthorize("@ss.hasPermission('guoyan:research-topic-info:update')")
-    public CommonResult<Boolean> auditResearchTopicInfo(@RequestParam("auditStatus") String auditStatus,
-                                                        @RequestParam("id") Long id) {
-        researchTopicInfoService.auditResearchTopicInfo(id, auditStatus);
+    public CommonResult<Boolean> auditResearchTopicInfo(@RequestBody ResearchTopicInfoSaveReqVO updateReqVO) {
+        researchTopicInfoService.auditResearchTopicInfo(updateReqVO.getId(), updateReqVO.getAuditStatus());
         return success(true);
     }
 
     @PutMapping("/void")
     @Operation(summary = "作废国资研究专题信息")
     @PreAuthorize("@ss.hasPermission('guoyan:research-topic-info:update')")
-    public CommonResult<Boolean> voidResearchTopicInfo(@RequestParam("voidStatus") String voidStatus,
-                                                       @RequestParam("id") Long id) {
-        researchTopicInfoService.voidResearchTopicInfo(id, voidStatus);
+    public CommonResult<Boolean> voidResearchTopicInfo(@RequestBody ResearchTopicInfoSaveReqVO updateReqVO) {
+        researchTopicInfoService.voidResearchTopicInfo(updateReqVO.getId(), updateReqVO.getStatus());
         return success(true);
     }
 

+ 2 - 1
guoyan-module-system/src/main/java/com/cy/guoyan/admin/module/guoyan/service/researchtopiccategory/ResearchTopicCategoryServiceImpl.java

@@ -134,7 +134,7 @@ public class ResearchTopicCategoryServiceImpl implements ResearchTopicCategorySe
                             .eq(ResearchTopicCategoryDO::getParentCode, old.getCategoryCode()));
 
             if (!CollUtil.isEmpty(sub)) {
-                throw exception(RESEARCH_TOPIC_CATEGORY_HAS_CHILDREN);
+                throw exception(CATEGORY_DELETE_HAS_CHILDREN);
             }
         }
 
@@ -177,6 +177,7 @@ public class ResearchTopicCategoryServiceImpl implements ResearchTopicCategorySe
     public List<ResearchTopicCategoryDO> getResearchTopicCategoryTree(ResearchTopicCategoryPageReqVO pageReqVO) {
         List<ResearchTopicCategoryDO> categoryDOS = researchTopicCategoryMapper.selectList(new LambdaQueryWrapperX<ResearchTopicCategoryDO>()
 //                .eq(ResearchTopicCategoryDO::getStatus, "正常")
+                .likeIfPresent(ResearchTopicCategoryDO::getCategoryName, pageReqVO.getCategoryName())
                 .orderByAsc(ResearchTopicCategoryDO::getOrder1)
                 .orderByAsc(ResearchTopicCategoryDO::getOrder2)
         );

+ 1 - 1
guoyan-module-system/src/main/java/com/cy/guoyan/admin/module/guoyan/service/researchtopicinfo/ResearchTopicInfoService.java

@@ -60,5 +60,5 @@ public interface ResearchTopicInfoService {
     PageResult<ResearchTopicInfoDO> getResearchTopicInfoPage(ResearchTopicInfoPageReqVO pageReqVO);
 
     void auditResearchTopicInfo(Long id, String auditStatus);
-    void voidResearchTopicInfo(Long id, String voidStatus);
+    void voidResearchTopicInfo(Long id, String status);
 }

+ 25 - 21
guoyan-module-system/src/main/java/com/cy/guoyan/admin/module/guoyan/service/researchtopicinfo/ResearchTopicInfoServiceImpl.java

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