|
@@ -1,12 +1,16 @@
|
|
|
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.metadata.IPage;
|
|
|
+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.business.entity.ArchiveFile;
|
|
|
import org.springblade.business.feign.ArchiveFileClient;
|
|
|
import org.springblade.business.vo.ArchiveFileVO;
|
|
@@ -15,6 +19,7 @@ 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.Func;
|
|
|
+import org.springblade.evisa.feign.EVisaClient;
|
|
|
import org.springblade.manager.entity.ArchiveTree;
|
|
|
import org.springblade.manager.entity.ArchiveTreeContract;
|
|
|
import org.springblade.manager.feign.ArchiveTreeContractClient;
|
|
@@ -23,6 +28,7 @@ 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;
|
|
@@ -43,6 +49,7 @@ public class ArchiveFileController extends BladeController {
|
|
|
private final ArchiveFileClient archiveFileClient;
|
|
|
private final IOSSClient iossClient;
|
|
|
private final ArchiveTreeContractClient archiveTreeContractClient;
|
|
|
+ private final EVisaClient eVisaClient;
|
|
|
/**
|
|
|
* 上传文件
|
|
|
*
|
|
@@ -177,4 +184,47 @@ public class ArchiveFileController extends BladeController {
|
|
|
public R migrateFile(@RequestParam String ids,@RequestParam String nodeId) {
|
|
|
return R.status(this.archiveFileClient.updateArchiveFileByNodeId(ids,nodeId));
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 批量认证(特殊签章 签个透明空白图片,主要目的是在验签的时候有验签信息 )
|
|
|
+ */
|
|
|
+ @PostMapping("/batchCertification")
|
|
|
+ @ApiOperationSupport(order = 9)
|
|
|
+ @ApiOperation(value = "批量认证")
|
|
|
+ public R<Boolean> batchCertification(@RequestBody ArchiveFileVO vo){
|
|
|
+ List<String> list = new ArrayList<>();
|
|
|
+ if(vo.getIds() != null && vo.getIds().size() > 0){
|
|
|
+ //获取文件
|
|
|
+ List<ArchiveFile> archiveFileList = this.archiveFileClient.listWrappers(Wrappers.<ArchiveFile>lambdaQuery().in(ArchiveFile::getId, vo.getIds()));
|
|
|
+ if(archiveFileList != null && archiveFileList.size() > 0){
|
|
|
+ for(ArchiveFile archiveFile : archiveFileList){
|
|
|
+ //获取文件地址并调用接口认证
|
|
|
+ String result = this.eVisaClient.certification(StringUtils.isNotEmpty(archiveFile.getEVisaFile()) ? archiveFile.getEVisaFile() : archiveFile.getPdfFileUrl(), archiveFile.getFileName(), archiveFile.getContractId());
|
|
|
+ if(StringUtils.isNotEmpty(result) && result.contains("success") && result.startsWith("success")){
|
|
|
+ //成功,更改状态
|
|
|
+ //签章成功后的文件路径,如果与原pdf文件路径不匹配则更新
|
|
|
+ String newPdfUrl = null;
|
|
|
+ if(result.contains("@@@@")){
|
|
|
+ newPdfUrl = result.split("@@@@")[1];
|
|
|
+ }
|
|
|
+ LambdaUpdateWrapper<ArchiveFile> wrappers = Wrappers.lambdaUpdate();
|
|
|
+ if(StringUtils.isNotEmpty(newPdfUrl) && !archiveFile.getPdfFileUrl().equals(newPdfUrl)){
|
|
|
+ //不为空且不匹配时,更新
|
|
|
+ wrappers.set(ArchiveFile::getEVisaFile, newPdfUrl);
|
|
|
+ }
|
|
|
+ //修改认证状态为已认证
|
|
|
+ wrappers.set(ArchiveFile::getIsCertification, 1);
|
|
|
+ //添加认证时间
|
|
|
+ wrappers.set(ArchiveFile::getCertificationTime, DateUtils.format(new Date(), "yyyy-MM-dd HH:mm:ss"));
|
|
|
+
|
|
|
+ //修改状态
|
|
|
+ this.archiveFileClient.updateWrappers(wrappers.eq(ArchiveFile::getId, archiveFile.getId()));
|
|
|
+ } else {
|
|
|
+ list.add(archiveFile.getId().toString());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return list.size() == 0 ? R.data(true) : R.data(300, false, "没有找到证书文件或PDF文件");
|
|
|
+ }
|
|
|
}
|