|
@@ -0,0 +1,126 @@
|
|
|
+package org.springblade.business.controller;
|
|
|
+
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import io.swagger.annotations.ApiParam;
|
|
|
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
|
|
+import lombok.AllArgsConstructor;
|
|
|
+
|
|
|
+import org.apache.commons.lang.StringUtils;
|
|
|
+import org.springblade.business.feign.TaskClient;
|
|
|
+import org.springblade.business.service.IArchiveShowService;
|
|
|
+import org.springblade.business.vo.ArchiveTaskVO;
|
|
|
+import org.springblade.business.vo.TaskVO;
|
|
|
+import org.springblade.core.tool.api.R;
|
|
|
+import org.springblade.core.tool.utils.Func;
|
|
|
+import org.springblade.manager.feign.ArchiveTreeClient;
|
|
|
+import org.springblade.manager.vo.ArchiveTreeVO;
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+import org.springframework.web.bind.annotation.RequestParam;
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
+import org.springblade.business.entity.ArchiveFile;
|
|
|
+import org.springblade.business.vo.ArchiveFileVO;
|
|
|
+import org.springblade.business.service.IArchiveFileService;
|
|
|
+import org.springblade.core.boot.ctrl.BladeController;
|
|
|
+
|
|
|
+import java.util.Arrays;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 控制器
|
|
|
+ *
|
|
|
+ * @author BladeX
|
|
|
+ * @since 2022-07-08
|
|
|
+ */
|
|
|
+@RestController
|
|
|
+@AllArgsConstructor
|
|
|
+@RequestMapping("/archiveFile")
|
|
|
+@Api(value = "工程文件接口", tags = "工程文件接口")
|
|
|
+public class ArchiveFileController extends BladeController {
|
|
|
+
|
|
|
+ private final IArchiveFileService archiveFileService;
|
|
|
+
|
|
|
+ private final IArchiveShowService archiveShowService;
|
|
|
+
|
|
|
+ private final ArchiveTreeClient archiveTreeClient;
|
|
|
+
|
|
|
+ private final TaskClient taskClient;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 批量上报
|
|
|
+ */
|
|
|
+ @PostMapping("/batchApproval")
|
|
|
+ @ApiOperationSupport(order = 6)
|
|
|
+ @ApiOperation(value = "批量上报")
|
|
|
+ public R<Boolean> batchApproval(@RequestBody ArchiveTaskVO archiveTaskVO){
|
|
|
+ String archiveTaskIds = archiveTaskVO.getArchiveIds();
|
|
|
+ if(StringUtils.isNotEmpty(archiveTaskIds)){
|
|
|
+ //生成流程实体
|
|
|
+ TaskVO taskVO = new TaskVO();
|
|
|
+ BeanUtils.copyProperties(archiveTaskVO, taskVO);
|
|
|
+ taskVO.setFormDataId(archiveTaskIds);
|
|
|
+ //启动流程
|
|
|
+ this.taskClient.startTask(taskVO);
|
|
|
+ //修改状态为待审批
|
|
|
+ String[] archiveTaskIdArray = archiveTaskIds.split(",");
|
|
|
+ return R.data(this.archiveFileService.update(Wrappers.<ArchiveFile>lambdaUpdate().set(ArchiveFile::getStatus, 1).in(ArchiveFile::getId, Arrays.asList(archiveTaskIdArray))));
|
|
|
+ }
|
|
|
+ return R.data(false);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 批量编辑
|
|
|
+ */
|
|
|
+ @PostMapping("/batchEdit")
|
|
|
+ @ApiOperationSupport(order = 5)
|
|
|
+ @ApiOperation(value = "批量编辑")
|
|
|
+ public R<Boolean> batchEdit(@RequestBody ArchiveFileVO vo){
|
|
|
+ return R.data(this.archiveFileService.updateBatchById(JSONArray.parseArray(JSONObject.toJSONString(vo.getList()), ArchiveFile.class)));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 分页
|
|
|
+ */
|
|
|
+ @PostMapping("/page")
|
|
|
+ @ApiOperationSupport(order = 4)
|
|
|
+ @ApiOperation(value = "分页")
|
|
|
+ public R<IPage<ArchiveFileVO>> page(ArchiveFileVO queryVo){
|
|
|
+ return R.data(this.archiveFileService.selectArchiveFilePage(queryVo));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 批量新增
|
|
|
+ */
|
|
|
+ @PostMapping("/batchSave")
|
|
|
+ @ApiOperationSupport(order = 3)
|
|
|
+ @ApiOperation(value = "批量新增")
|
|
|
+ public R<Boolean> batchSave(@RequestBody ArchiveFileVO vo){
|
|
|
+ return R.data(this.archiveFileService.saveBatch(JSONArray.parseArray(JSONObject.toJSONString(vo.getList()), ArchiveFile.class)));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取归档划分树
|
|
|
+ */
|
|
|
+ @PostMapping("/tree")
|
|
|
+ @ApiOperationSupport(order = 2)
|
|
|
+ @ApiOperation(value = "获取归档划分树")
|
|
|
+ public R<List<ArchiveTreeVO>> tree(){
|
|
|
+ return this.archiveTreeClient.tree(1,2);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删除
|
|
|
+ */
|
|
|
+ @PostMapping("/remove")
|
|
|
+ @ApiOperationSupport(order = 1)
|
|
|
+ @ApiOperation(value = "逻辑删除", notes = "传入ids")
|
|
|
+ public R<Boolean> remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
|
|
|
+ return R.status(archiveFileService.deleteLogic(Func.toLongList(ids)));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+}
|