huangtf преди 2 години
родител
ревизия
c8435cd096

+ 13 - 0
blade-service-api/blade-archive-api/src/main/java/org/springblade/archive/dto/ArchiveInspectionDTO.java

@@ -0,0 +1,13 @@
+package org.springblade.archive.dto;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.archive.entity.ArchiveInspection;
+
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class ArchiveInspectionDTO extends ArchiveInspection {
+
+    //所有的意见
+    private String allOpinion;
+}

+ 5 - 0
blade-service-api/blade-archive-api/src/main/java/org/springblade/archive/entity/ArchiveInspection.java

@@ -38,6 +38,11 @@ public class ArchiveInspection extends BaseEntity {
      */
     private Long fileId;
 
+    /**
+     * 案卷ID
+     */
+    private Long archiveId;
+
     /**
      * 案卷题名
      */

+ 9 - 10
blade-service/blade-archive/src/main/java/org/springblade/archive/controller/ArchiveInspectionController.java → blade-service/blade-archive/src/main/java/org/springblade/archive/controller/ArchiveInspectionInfoController.java

@@ -1,9 +1,11 @@
 package org.springblade.archive.controller;
 
+
 import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.AllArgsConstructor;
+import org.springblade.archive.dto.ArchiveInspectionDTO;
 import org.springblade.archive.entity.ArchiveInspection;
 import org.springblade.archive.service.IArchiveInspectionService;
 import org.springblade.core.boot.ctrl.BladeController;
@@ -13,9 +15,9 @@ import org.springframework.web.bind.annotation.*;
 
 @RestController
 @AllArgsConstructor
-@RequestMapping("/archiveInspection")
+@RequestMapping("/archiveInspectionInfo")
 @Api(value = "档案检查信息", tags = "档案检查信息")
-public class ArchiveInspectionController extends BladeController {
+public class ArchiveInspectionInfoController {
 
     private IArchiveInspectionService archiveInspectionService;
 
@@ -31,6 +33,7 @@ public class ArchiveInspectionController extends BladeController {
     @ApiOperationSupport(order = 3)
     @ApiOperation(value = "新增档案检查", notes = "传入archiveInspection")
     public R addArchiveInspection(@RequestBody ArchiveInspection archiveInspection) {
+
         boolean success = archiveInspectionService.save(archiveInspection);
         return success ? R.success("新增成功") : R.fail("新增失败");
     }
@@ -52,15 +55,11 @@ public class ArchiveInspectionController extends BladeController {
 
     @GetMapping("/opinion")
     @ApiOperationSupport(order = 6)
-    @ApiOperation(value = "获取抽检意见", notes = "传入fileId和userId")
-    public R<String> getOpinion(@RequestParam Long fileId) {
+    @ApiOperation(value = "获取抽检意见", notes = "传入fileId")
+    public R<ArchiveInspectionDTO> getOpinion(@RequestParam Long fileId) {
         Long userId = AuthUtil.getUserId();
-        ArchiveInspection archiveInspection = archiveInspectionService.getbyFileId(fileId, userId);
-        String opinion = "";
-        if (archiveInspection != null) {
-            opinion = archiveInspection.getOpinion();
-        }
-        return R.data(opinion);
+        ArchiveInspectionDTO archiveInspectionDTO = archiveInspectionService.getbyFileId(fileId, userId);
+        return R.data(archiveInspectionDTO);
     }
 
 }

+ 1 - 0
blade-service/blade-archive/src/main/java/org/springblade/archive/mapper/ArchiveInspectionMapper.xml

@@ -10,6 +10,7 @@
         <result column="opinion" property="opinion" />
         <result column="user_id" property="userId" />
         <result column="file_id" property="fileId" />
+        <result column="archive_id" property="archiveId" />
         <result column="archive_name" property="archiveName" />
     </resultMap>
     <!-- 示例:查询所有记录 -->

+ 2 - 1
blade-service/blade-archive/src/main/java/org/springblade/archive/service/IArchiveInspectionService.java

@@ -1,8 +1,9 @@
 package org.springblade.archive.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
+import org.springblade.archive.dto.ArchiveInspectionDTO;
 import org.springblade.archive.entity.ArchiveInspection;
 
 public interface IArchiveInspectionService extends IService<ArchiveInspection> {
-    ArchiveInspection getbyFileId(Long fileId, Long userId);
+    ArchiveInspectionDTO getbyFileId(Long fileId, Long userId);
 }

+ 18 - 4
blade-service/blade-archive/src/main/java/org/springblade/archive/service/impl/ArchiveInspectionServiceImpl.java

@@ -3,10 +3,12 @@ package org.springblade.archive.service.impl;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import lombok.AllArgsConstructor;
+import org.springblade.archive.dto.ArchiveInspectionDTO;
 import org.springblade.archive.entity.ArchiveInspection;
 import org.springblade.archive.mapper.ArchiveInspectionMapper;
 import org.springblade.archive.service.IArchiveInspectionService;
 import org.springblade.core.mp.base.BaseServiceImpl;
+import org.springframework.beans.BeanUtils;
 import org.springframework.stereotype.Service;
 
 import java.util.List;
@@ -16,18 +18,30 @@ import java.util.List;
 public class ArchiveInspectionServiceImpl extends BaseServiceImpl<ArchiveInspectionMapper, ArchiveInspection> implements IArchiveInspectionService {
     private ArchiveInspectionMapper archiveInspectionMapper;
 
-    public ArchiveInspection getbyFileId(Long fileId, Long userId){
+    public ArchiveInspectionDTO getbyFileId(Long fileId, Long userId){
 
         LambdaQueryWrapper<ArchiveInspection> queryWrapper = new LambdaQueryWrapper<>();
         queryWrapper.eq(ArchiveInspection::getFileId, fileId)
-                .eq(ArchiveInspection::getUserId, userId)
                 .eq(ArchiveInspection::getIsDeleted, 0);
         List<ArchiveInspection> archiveInspectionList = archiveInspectionMapper.selectList(queryWrapper);
         if(archiveInspectionList == null || archiveInspectionList.isEmpty()) {
             return null;
-        } else {
-            return archiveInspectionList.get(0);
         }
 
+        ArchiveInspectionDTO archiveInspectionDTO = new ArchiveInspectionDTO();
+        String allOpinion = "";
+        int count = 1;
+        for (ArchiveInspection archiveInspection : archiveInspectionList) {
+            if (archiveInspection.getUserId().equals(userId)) {
+                BeanUtils.copyProperties(archiveInspection, archiveInspectionDTO);
+            }
+            String opinion = archiveInspection.getOpinion();
+            if (opinion != null && !opinion.trim().isEmpty()) {
+                allOpinion += count + ". " + opinion.trim() + " ; ";
+                count++;
+            }
+        }
+        archiveInspectionDTO.setAllOpinion(allOpinion);
+        return archiveInspectionDTO;
     }
 }