huangtf 2 năm trước cách đây
mục cha
commit
29f29ab688

+ 47 - 0
blade-service/blade-archive/src/main/java/org/springblade/archive/controller/ArchiveInspectionController.java

@@ -4,7 +4,10 @@ import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.AllArgsConstructor;
+import org.springblade.archive.entity.ArchiveInspection;
+import org.springblade.archive.service.IArchiveInspectionService;
 import org.springblade.core.boot.ctrl.BladeController;
+import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.tool.api.R;
 import org.springframework.web.bind.annotation.*;
 
@@ -14,6 +17,50 @@ import org.springframework.web.bind.annotation.*;
 @Api(value = "档案检查信息", tags = "档案检查信息")
 public class ArchiveInspectionController extends BladeController {
 
+    private IArchiveInspectionService archiveInspectionService;
 
+    @GetMapping("/detail")
+    @ApiOperationSupport(order = 2)
+    @ApiOperation(value = "获取档案检查详情", notes = "传入archiveInspection")
+    public R<ArchiveInspection> getArchiveInspectionDetail(@RequestParam Long id) {
+        ArchiveInspection archiveInspection = archiveInspectionService.getById(id);
+        return R.data(archiveInspection);
+    }
+
+    @PostMapping("/add")
+    @ApiOperationSupport(order = 3)
+    @ApiOperation(value = "新增档案检查", notes = "传入archiveInspection")
+    public R addArchiveInspection(@RequestBody ArchiveInspection archiveInspection) {
+        boolean success = archiveInspectionService.save(archiveInspection);
+        return success ? R.success("新增成功") : R.fail("新增失败");
+    }
+
+    @DeleteMapping("/delete")
+    @ApiOperationSupport(order = 4)
+    @ApiOperation(value = "删除档案检查", notes = "传入id")
+    public R deleteArchiveInspection(@RequestParam Long id) {
+        boolean success = archiveInspectionService.removeById(id);
+        return success ? R.success("删除成功") : R.fail("删除失败");
+    }
+
+    @PostMapping("/submit")
+    @ApiOperationSupport(order = 5)
+    @ApiOperation(value = "修改档案检查", notes = "传入archiveInspection")
+    public R submit(@RequestBody ArchiveInspection archiveInspection) {
+        return R.status(archiveInspectionService.saveOrUpdate(archiveInspection));
+    }
+
+    @GetMapping("/opinion")
+    @ApiOperationSupport(order = 6)
+    @ApiOperation(value = "获取抽检意见", notes = "传入fileId和userId")
+    public R<String> 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);
+    }
 
 }

+ 17 - 0
blade-service/blade-archive/src/main/java/org/springblade/archive/controller/ArchivesAutoController.java

@@ -462,4 +462,21 @@ public class ArchivesAutoController extends BladeController {
 		return R.data(archivesAutoService.getArchiveDestroyUser());
 	}
 
+
+	/**
+	 * 检阅
+	 */
+	@PostMapping("/review")
+	@ApiOperationSupport(order = 5)
+	@ApiOperation(value = "修改", notes = "传入review")
+	public R review(@RequestParam Long id) {
+		ArchivesAuto archivesAuto = archivesAutoService.getById(id);
+		if (archivesAuto == null) {
+			archivesAuto.setIsReviewed(1);
+			return R.status(archivesAutoService.updateById(archivesAuto));
+		}
+
+		return R.fail("未找到对应的Id");
+	}
+
 }

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

@@ -3,6 +3,15 @@
 <mapper namespace="org.springblade.archive.mapper.ArchiveInspectionMapper">
 
     <!-- 这里可以定义各种SQL语句 -->
+    <resultMap id="ResultMap" type="org.springblade.archive.entity.ArchiveInspection">
+        <id column="id" property="id" />
+        <result column="tenant_id" property="tenantId" />
+        <result column="project_id" property="projectId" />
+        <result column="opinion" property="opinion" />
+        <result column="user_id" property="userId" />
+        <result column="file_id" property="fileId" />
+        <result column="archive_name" property="archiveName" />
+    </resultMap>
     <!-- 示例:查询所有记录 -->
     <select id="selectAll" resultType="org.springblade.archive.entity.ArchiveInspection">
         SELECT * FROM u_archive_inspection

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

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

+ 20 - 0
blade-service/blade-archive/src/main/java/org/springblade/archive/service/impl/ArchiveInspectionServiceImpl.java

@@ -1,13 +1,33 @@
 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.entity.ArchiveInspection;
 import org.springblade.archive.mapper.ArchiveInspectionMapper;
 import org.springblade.archive.service.IArchiveInspectionService;
 import org.springblade.core.mp.base.BaseServiceImpl;
 import org.springframework.stereotype.Service;
 
+import java.util.List;
+
 @Service
+@AllArgsConstructor
 public class ArchiveInspectionServiceImpl extends BaseServiceImpl<ArchiveInspectionMapper, ArchiveInspection> implements IArchiveInspectionService {
+    private ArchiveInspectionMapper archiveInspectionMapper;
+
+    public ArchiveInspection 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);
+        }
 
+    }
 }