|
@@ -0,0 +1,129 @@
|
|
|
|
+package org.springblade.archive.controller;
|
|
|
|
+
|
|
|
|
+import com.alibaba.excel.util.DateUtils;
|
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
|
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
|
|
|
+import io.swagger.annotations.*;
|
|
|
|
+import lombok.AllArgsConstructor;
|
|
|
|
+import lombok.SneakyThrows;
|
|
|
|
+import org.apache.commons.lang.StringUtils;
|
|
|
|
+import org.springblade.archive.service.IArchivesAutoService;
|
|
|
|
+import org.springblade.archive.vo.ArchivesAutoVO;
|
|
|
|
+import org.springblade.business.entity.ArchiveFile;
|
|
|
|
+import org.springblade.business.feign.ArchiveFileClient;
|
|
|
|
+import org.springblade.business.vo.ArchiveFileVO;
|
|
|
|
+import org.springblade.core.boot.ctrl.BladeController;
|
|
|
|
+import org.springblade.core.oss.model.BladeFile;
|
|
|
|
+import org.springblade.core.tool.api.R;
|
|
|
|
+import org.springblade.core.tool.utils.BeanUtil;
|
|
|
|
+import org.springblade.evisa.feign.EVisaClient;
|
|
|
|
+import org.springblade.manager.entity.ArchiveTreeContract;
|
|
|
|
+import org.springblade.manager.feign.ArchiveTreeContractClient;
|
|
|
|
+import org.springblade.resource.feign.IOSSClient;
|
|
|
|
+import org.springblade.system.user.entity.UserOauth;
|
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
|
+import org.springframework.web.multipart.MultipartFile;
|
|
|
|
+
|
|
|
|
+import java.util.ArrayList;
|
|
|
|
+import java.util.Date;
|
|
|
|
+import java.util.List;
|
|
|
|
+import java.util.Map;
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * 控制器
|
|
|
|
+ *
|
|
|
|
+ * @author BladeX
|
|
|
|
+ * @since 2022-07-08
|
|
|
|
+ */
|
|
|
|
+@RestController
|
|
|
|
+@AllArgsConstructor
|
|
|
|
+@RequestMapping("/archiveFileAuto")
|
|
|
|
+@Api(value = "案卷收集接口", tags = "案卷收集接口")
|
|
|
|
+public class ArchiveFileAutoController extends BladeController {
|
|
|
|
+
|
|
|
|
+ private final ArchiveFileClient archiveFileClient;
|
|
|
|
+ private final IOSSClient iossClient;
|
|
|
|
+ private final ArchiveTreeContractClient archiveTreeContractClient;
|
|
|
|
+ private final EVisaClient eVisaClient;
|
|
|
|
+ private final IArchivesAutoService archivesAutoService;
|
|
|
|
+ /**
|
|
|
|
+ * 批量新增
|
|
|
|
+ */
|
|
|
|
+ @PostMapping("/batchSave")
|
|
|
|
+ @ApiOperationSupport(order = 2)
|
|
|
|
+ @ApiOperation(value = "批量新增")
|
|
|
|
+ public R<Boolean> batchSave(@RequestBody List<ArchivesAutoVO> archiveList){
|
|
|
|
+ try {
|
|
|
|
+ for(ArchivesAutoVO archive : archiveList) {
|
|
|
|
+ if(archive.getId() == null){
|
|
|
|
+ int l = (int) System.currentTimeMillis();
|
|
|
|
+ List<ArchivesAutoVO.ApprovalFile> saveList = archive.getApprovalFileList();
|
|
|
|
+ ArchiveFileVO saveVos = new ArchiveFileVO();
|
|
|
|
+ if (saveList != null && saveList.size() > 0) {
|
|
|
|
+ int i = 1;
|
|
|
|
+ for (ArchivesAutoVO.ApprovalFile approvalFile : saveList) {
|
|
|
|
+ ArchiveFileVO saveVo = BeanUtil.copy(approvalFile, ArchiveFileVO.class);
|
|
|
|
+ saveVo.setSort(l + i);
|
|
|
|
+ saveVo.setStatus(new Integer("0").equals(saveVo.getIsApproval()) ? 2 : 0);
|
|
|
|
+ saveVo.setIsCertification(new Integer("0").equals(saveVo.getIsNeedCertification()) ? 1 : 0);
|
|
|
|
+ saveVos.getList().add(saveVo);
|
|
|
|
+ i++;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ this.archiveFileClient.saveArchiveFile(saveVos);
|
|
|
|
+
|
|
|
|
+ String archiveId = "";
|
|
|
|
+ //获取方式
|
|
|
|
+ archiveId = "FromNode_" + archive.getNodeId();
|
|
|
|
+ archive.setId(Long.parseLong(archiveId));
|
|
|
|
+ //待修改
|
|
|
|
+ archive.setIsDeleted(0);
|
|
|
|
+ archive.setIsArchive(0);
|
|
|
|
+
|
|
|
|
+ archivesAutoService.save(archive);
|
|
|
|
+ }else{
|
|
|
|
+ archivesAutoService.updateById(archive);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ } catch (NumberFormatException e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ return R.data(false);
|
|
|
|
+ }
|
|
|
|
+ return R.data(true);
|
|
|
|
+ }
|
|
|
|
+ /**
|
|
|
|
+ * 分页
|
|
|
|
+ */
|
|
|
|
+ @PostMapping("/page")
|
|
|
|
+ @ApiOperationSupport(order = 3)
|
|
|
|
+ @ApiOperation(value = "分页")
|
|
|
|
+ public R<Object> page( ArchivesAutoVO queryVo){
|
|
|
|
+ if(queryVo.getNodeId() == null || queryVo.getNodeId().equals("")){
|
|
|
|
+ return R.data(null);
|
|
|
|
+ }
|
|
|
|
+ List<ArchiveTreeContract> archiveTreeContracts = this.archiveTreeContractClient.queryAllChildByAncestors(queryVo.getNodeIds());
|
|
|
|
+ if(archiveTreeContracts != null && archiveTreeContracts.size() > 0){
|
|
|
|
+ List<String> ids = JSONArray.parseArray(JSONObject.toJSONString(archiveTreeContracts.stream().map(ArchiveTreeContract::getId).distinct().collect(Collectors.toList())), String.class);
|
|
|
|
+ ids.add(queryVo.getNodeId().toString());
|
|
|
|
+ queryVo.setNodeIdArray(ids);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return R.data(archivesAutoService.selectArchivesAutoFilePage(queryVo));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 迁移文件
|
|
|
|
+ */
|
|
|
|
+ @PostMapping("/migrateFile")
|
|
|
|
+ @ApiOperationSupport(order = 9)
|
|
|
|
+ @ApiOperation(value = "迁移文件", notes = "传入ids")
|
|
|
|
+ public R migrateFile(@RequestParam String ids,@RequestParam String nodeId) {
|
|
|
|
+ return R.status(this.archiveFileClient.updateArchiveFileByNodeId(ids,nodeId));
|
|
|
|
+ }
|
|
|
|
+}
|