Commit 5ae287fc authored by xuzhang's avatar xuzhang

[fix][DOC]迁移类缺失问题修改

parent 224ed2bb
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
<project version="4"> <project version="4">
<component name="CompilerConfiguration"> <component name="CompilerConfiguration">
<annotationProcessing> <annotationProcessing>
<profile default="true" name="Default" enabled="true" />
<profile name="Maven default annotation processors profile" enabled="true"> <profile name="Maven default annotation processors profile" enabled="true">
<sourceOutputDir name="target/generated-sources/annotations" /> <sourceOutputDir name="target/generated-sources/annotations" />
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" /> <sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
......
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
<dependency> <dependency>
<groupId>com.yonde.dcs</groupId> <groupId>com.yonde.dcs</groupId>
<artifactId>dcs-doc-core</artifactId> <artifactId>dcs-doc-core</artifactId>
<version>4.1-RELEASE</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.yonde.dcs</groupId> <groupId>com.yonde.dcs</groupId>
......
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
<dependency> <dependency>
<groupId>com.yonde.dcs</groupId> <groupId>com.yonde.dcs</groupId>
<artifactId>dcs-doc-core</artifactId> <artifactId>dcs-doc-core</artifactId>
<version>4.1-RELEASE</version>
<exclusions> <exclusions>
<exclusion> <exclusion>
<groupId>com.yonde.dcs</groupId> <groupId>com.yonde.dcs</groupId>
...@@ -163,6 +162,21 @@ ...@@ -163,6 +162,21 @@
<groupId>com.yonde.dex</groupId> <groupId>com.yonde.dex</groupId>
<artifactId>dex-wfc-common</artifactId> <artifactId>dex-wfc-common</artifactId>
</dependency> </dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.yonde.dex</groupId>
<artifactId>dex-wfc-common</artifactId>
</dependency>
<dependency> <dependency>
<groupId>com.luhuiguo</groupId> <groupId>com.luhuiguo</groupId>
<artifactId>aspose-words</artifactId> <artifactId>aspose-words</artifactId>
......
...@@ -8,7 +8,6 @@ import com.yonde.dcs.core.constants.Constants; ...@@ -8,7 +8,6 @@ import com.yonde.dcs.core.constants.Constants;
import com.yonde.dcs.core.service.ExtAutoTaskService; import com.yonde.dcs.core.service.ExtAutoTaskService;
import com.yonde.dcs.core.service.ExtSendFormLinkService; import com.yonde.dcs.core.service.ExtSendFormLinkService;
import com.yonde.dcs.core.util.ExtDocUtil; import com.yonde.dcs.core.util.ExtDocUtil;
import com.yonde.dcs.core.util.ExtWfcUtil;
import com.yonde.dcs.document.common.entity.vo.DxDocumentVO; import com.yonde.dcs.document.common.entity.vo.DxDocumentVO;
import com.yonde.dcs.esign.plugin.message.WfcSignMessage; import com.yonde.dcs.esign.plugin.message.WfcSignMessage;
import com.yonde.dcs.plan.common.vo.ExtPlanVO; import com.yonde.dcs.plan.common.vo.ExtPlanVO;
...@@ -25,12 +24,12 @@ import com.yonde.dex.wfc.common.vo.DxWfTaskContext; ...@@ -25,12 +24,12 @@ import com.yonde.dex.wfc.common.vo.DxWfTaskContext;
import com.yonde.dex.wfc.feign.api.WfcProcessFeign; import com.yonde.dex.wfc.feign.api.WfcProcessFeign;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.SneakyThrows;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import org.springframework.transaction.annotation.Transactional; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.Map;
import javax.validation.Valid; import javax.validation.Valid;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.*; import java.util.*;
...@@ -44,8 +43,11 @@ import java.util.*; ...@@ -44,8 +43,11 @@ import java.util.*;
@RestController @RestController
@RequestMapping("/task") @RequestMapping("/task")
@Api(tags = "自动任务服务接口") @Api(tags = "自动任务服务接口")
@Controller(ExtAutoTaskController.BEAN_NAME)
public class ExtAutoTaskController { public class ExtAutoTaskController {
public static final String BEAN_NAME = "extAutoTaskController";
@Autowired @Autowired
WfcProcessFeign wfcProcessFeign; WfcProcessFeign wfcProcessFeign;
......
...@@ -27,62 +27,4 @@ ...@@ -27,62 +27,4 @@
//@Slf4j //@Slf4j
//public class DocTransactionEvent { //public class DocTransactionEvent {
// //
// @Autowired
// private ExtDocService extDocService;
//
// @Autowired
// @Qualifier("documentServiceImpl")
// DocumentService documentService;
// @Autowired
// private ExtIncomeContractServiceFeign extIncomeContractService;
// @Autowired
// private ExtSpendingContractServiceFeign extSpendingContractService;
// @Autowired
// private ExtDocUtil extDocUtil;
//
// @TransactionalEventListener(phase = TransactionPhase.AFTER_COMMIT)
// public void afterCommit(BaseService.DataChangeEvent event) {
// final String eventType = event.getEventType();
// final BaseService.ChangeType changeType = BaseService.ChangeType.valueOf(eventType);
// if (changeType == BaseService.ChangeType.POST_CREATE || changeType == BaseService.ChangeType.POST_UPDATE || changeType == BaseService.ChangeType.POST_DELETE) {
// event.getEventTargets().forEach(t -> {
// DxDocumentVO doc = new DxDocumentVO();
// if (t instanceof ExtIncomeDetailVO) {
// //刷新收入合同相关金额
// ExtIncomeDetailVO extIncomeDetailVO = (ExtIncomeDetailVO) t;
// this.refreshInContractAmount(extIncomeDetailVO.getExtIncomeContractId());
// } else if (t instanceof ExtSpendingDetailVO) {
// //刷新支出合同相关金额
// ExtSpendingDetailVO spendingDetailVO = (ExtSpendingDetailVO) t;
// this.refreshSpeContractAmount(spendingDetailVO.getExtSpendingContractId());
// }
// });
// }
// }
//
//
// /**
// * 刷新收入合同金额
// *
// * @param contractId
// */
// private void refreshInContractAmount(Long contractId) {
// //已到款
// //待拨付
// extIncomeContractService.calculateIncome(contractId);
// //XXX年到款
// extIncomeContractService.reCalculIncomeById(contractId);
// }
//
// /**
// * 刷新支出合同金额
// *
// * @param contractId
// */
// private void refreshSpeContractAmount(Long contractId) {
// //已付金额
// //未付金额
// //付款比例
// extSpendingContractService.calculateSpending(contractId);
// }
//} //}
//package com.yonde.dcs.core.events; //package com.yonde.dcs.core.events;
// //
// //
//import com.yonde.dcs.plan.common.vo.ExtPlanVO;
//import com.yonde.dex.basedata.exception.DxBusinessException; //import com.yonde.dex.basedata.exception.DxBusinessException;
//import com.yonde.dex.context.common.vo.DxContextVO; //import com.yonde.dex.context.common.vo.DxContextVO;
//import com.yonde.dex.context.feign.ContextServiceFeign; //import com.yonde.dex.context.feign.ContextServiceFeign;
...@@ -23,120 +24,8 @@ ...@@ -23,120 +24,8 @@
//@Service //@Service
//@Slf4j //@Slf4j
//public class ValidateSecretListener extends AbstractEventListener<BaseService.DataChangeEvent> { //public class ValidateSecretListener extends AbstractEventListener<BaseService.DataChangeEvent> {
// @Autowired
// private DictDataFeignService dictDataService;
// @Qualifier("com.yonde.dex.context.feign.ContextProjectServiceFeign")
// @Autowired
// //
// private ContextServiceFeign contextServiceFeign;
// //
// @Override
// public void onAsynEvent(BaseService.DataChangeEvent event) {
// //
// }
// //
// @Override
// public void onEvent(BaseService.DataChangeEvent event) {
// // 页面资源变更的时候
// switch (event.operationType) {
// case POST_CREATE:
// extValidateSecret(event.eventTargets);
// break;
// case POST_UPDATE:
// extValidateSecret(event.eventTargets);
// break;
// case POST_DELETE:
// break;
// default:
// break;
// }
// }
//
// @Transactional(rollbackFor = {Exception.class, Error.class})
// void extValidateSecret(Iterable<?> objects) {
// for (Object data : objects) {
// log.info(">>>>>extValidateSecret data:" + data);
// log.info(">>>>>extValidateSecret data.getClass:" + data.getClass());
// //校验项目中心相关对象密级和计划密级
// if (data instanceof DxContextVO) {
// String checkResultStr = checkDxObjectSecret((DxContextVO) data);
// if (!StringUtils.isEmpty(checkResultStr)) {
// throw new DxBusinessException("500", checkResultStr);
// }
// }
//
//
// }
// }
//
// /**
// * 校验计划、收入合同、支出合同密级与项目的关系
// *
// * @param dxObjectVo
// * @return
// */
// private String checkDxObjectSecret(DxContextVO dxObjectVo) {
// String checkResultStr = "";
// Boolean checkResult = true;
// //todo
//// if (dxObjectVo instanceof ExtPlanVO) {
//// checkResult = checkDxObjectVoSecret(dxObjectVo);
//// checkResultStr = "计划密级不能高于项目密级!";
//// }
//// if (dxObjectVo instanceof ExtIncomeContractVO) {
//// checkResult = checkDxObjectVoSecret(dxObjectVo);
//// checkResultStr = "收入合同密级不能高于项目密级!";
//// }
//// if (dxObjectVo instanceof ExtSpendingContractVO) {
//// checkResult = checkDxObjectVoSecret(dxObjectVo);
//// checkResultStr = "支出合同密级不能高于项目密级!";
//// }
// if (checkResult) {
// checkResultStr = "";
// }
// return checkResultStr;
// }
//
// /**
// * 校验计划、收入合同、支出合同密级与项目的关系
// *
// * @return
// */
// //todo
// private Boolean checkDxObjectVoSecret(DxContextVO dxObjectVo) {
//// if (StringUtils.isBlank(dxObjectVo.getSecretCode())) {
//// return true;
//// }
//// DxContextVO dxContextVO = contextServiceFeign.get(dxObjectVo.getDxContextId());
//// return checkTargetSecret(dxContextVO.getSecretCode(), dxObjectVo.getSecretCode());
// return false;
// }
//
// /**
// * 校验密级信息
// *
// * @param sourceSecret
// * @param targetSecret
// * @return
// */
// private Boolean checkTargetSecret(String sourceSecret, String targetSecret) {
// DictDataVO docSecretCodeDict;
// if (StringUtils.isEmpty(sourceSecret)) {
// //密级为空则获取默认密级
// docSecretCodeDict = dictDataService.getMarkDictData("SecretCode");
// } else {
// docSecretCodeDict = dictDataService.getDictCode("SecretCode", sourceSecret);
// }
// List<DictDataVO> secretCodeDictList = dictDataService.getDictDatas("SecretCode");
// if (CollectionUtils.isNotEmpty(secretCodeDictList)) {
// Set<String> enableSecretCodeSet = secretCodeDictList.stream()
// .filter(x -> x.getDictSeq() <= docSecretCodeDict.getDictSeq())
// .map(DictDataVO::getDictKey)
// .collect(Collectors.toSet());
// if (enableSecretCodeSet != null && enableSecretCodeSet.contains(targetSecret)) {
// return true;
// }
// }
// return false;
// }
//} //}
...@@ -8,11 +8,9 @@ import cn.hutool.extra.spring.SpringUtil; ...@@ -8,11 +8,9 @@ import cn.hutool.extra.spring.SpringUtil;
import cn.hutool.http.ContentType; import cn.hutool.http.ContentType;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.yonde.dcs.common.vo.*; import com.yonde.dcs.common.vo.*;
import com.yonde.dcs.core.constants.Constants; import com.yonde.dcs.core.constants.Constants;
import com.yonde.dcs.core.constants.SignConstants; import com.yonde.dcs.core.constants.SignConstants;
import com.yonde.dcs.core.events.DocBeforeCreateEvent; import com.yonde.dcs.core.event.DocumentEvent;
import com.yonde.dcs.core.events.ProcessDataUtils;
import com.yonde.dcs.core.factory.*; import com.yonde.dcs.core.factory.*;
import com.yonde.dcs.core.service.*; import com.yonde.dcs.core.service.*;
import com.yonde.dcs.core.util.*; import com.yonde.dcs.core.util.*;
...@@ -81,9 +79,12 @@ import java.util.stream.Collectors; ...@@ -81,9 +79,12 @@ import java.util.stream.Collectors;
* @author: dang wei * @author: dang wei
* @create: 2021-09-27 09:42 * @create: 2021-09-27 09:42
*/ */
@Service @Service(ExtAutoTaskServiceImpl.BEAN_NAME)
@Slf4j @Slf4j
public class ExtAutoTaskServiceImpl implements ExtAutoTaskService { public class ExtAutoTaskServiceImpl implements ExtAutoTaskService {
public static final String BEAN_NAME = "extAutoTaskServiceImpl";
@Qualifier("documentServiceImpl") @Qualifier("documentServiceImpl")
@Autowired @Autowired
private DocumentService documentService; private DocumentService documentService;
...@@ -113,6 +114,7 @@ public class ExtAutoTaskServiceImpl implements ExtAutoTaskService { ...@@ -113,6 +114,7 @@ public class ExtAutoTaskServiceImpl implements ExtAutoTaskService {
private DxPostMemberLinkFeign<DxPostMemberLinkVO> dxPostMemberLinkFeign; private DxPostMemberLinkFeign<DxPostMemberLinkVO> dxPostMemberLinkFeign;
@Resource @Resource
private ExtPlanDocLinkServiceFeign planDocLinkService; private ExtPlanDocLinkServiceFeign planDocLinkService;
@Autowired @Autowired
private ExtPlanServiceFeign extPlanService; private ExtPlanServiceFeign extPlanService;
@Autowired @Autowired
...@@ -122,7 +124,7 @@ public class ExtAutoTaskServiceImpl implements ExtAutoTaskService { ...@@ -122,7 +124,7 @@ public class ExtAutoTaskServiceImpl implements ExtAutoTaskService {
@Autowired @Autowired
private ExtInterfaceInfoLinkService interfaceInfoLinkService; private ExtInterfaceInfoLinkService interfaceInfoLinkService;
@Autowired @Autowired
private DocBeforeCreateEvent docBeforeCreateEvent; private DocumentEvent documentEvent;
@Autowired @Autowired
private FileManagerFeignService fileManagerFeignService; private FileManagerFeignService fileManagerFeignService;
@Autowired @Autowired
...@@ -643,7 +645,7 @@ public class ExtAutoTaskServiceImpl implements ExtAutoTaskService { ...@@ -643,7 +645,7 @@ public class ExtAutoTaskServiceImpl implements ExtAutoTaskService {
if (!CollectionUtils.isEmpty(interfaceInfoLinkVOS)) { if (!CollectionUtils.isEmpty(interfaceInfoLinkVOS)) {
//1、先根据提资记录生成多个文档 //1、先根据提资记录生成多个文档
interfaceInfoLinkVOS.stream().forEach(item -> { interfaceInfoLinkVOS.stream().forEach(item -> {
docBeforeCreateEvent.generateAutoInterFaceWord(docObjFile, item, wfProcessInfoVO); documentEvent.generateAutoInterFaceWord(docObjFile, item, wfProcessInfoVO);
}); });
try { try {
//2、合并生成好的文档 //2、合并生成好的文档
...@@ -968,7 +970,7 @@ public class ExtAutoTaskServiceImpl implements ExtAutoTaskService { ...@@ -968,7 +970,7 @@ public class ExtAutoTaskServiceImpl implements ExtAutoTaskService {
if (!CollectionUtils.isEmpty(interfaceInfoLinkVOS)) { if (!CollectionUtils.isEmpty(interfaceInfoLinkVOS)) {
//1、先根据提资记录生成多个文档(不需要上传到附件和主内容中) //1、先根据提资记录生成多个文档(不需要上传到附件和主内容中)
interfaceInfoLinkVOS.stream().forEach(item -> { interfaceInfoLinkVOS.stream().forEach(item -> {
docBeforeCreateEvent.generateAutoInterFaceWord(documentVO, item, wfProcessInfoVO); documentEvent.generateAutoInterFaceWord(documentVO, item, wfProcessInfoVO);
}); });
try { try {
//2、合并生成好的文档 //2、合并生成好的文档
...@@ -1000,8 +1002,8 @@ public class ExtAutoTaskServiceImpl implements ExtAutoTaskService { ...@@ -1000,8 +1002,8 @@ public class ExtAutoTaskServiceImpl implements ExtAutoTaskService {
*/ */
@Override @Override
public void generateWordByAutoMethod(DxDocumentVO documentVo) { public void generateWordByAutoMethod(DxDocumentVO documentVo) {
// DxDocumentVO dxDocumentVO = docBeforeCreateEvent.processCreateData(documentVo); DxDocumentVO dxDocumentVO = documentEvent.processCreateData(documentVo);
// documentService.saveRecursion(dxDocumentVO); documentService.saveRecursion(dxDocumentVO);
} }
/** /**
...@@ -1087,7 +1089,7 @@ public class ExtAutoTaskServiceImpl implements ExtAutoTaskService { ...@@ -1087,7 +1089,7 @@ public class ExtAutoTaskServiceImpl implements ExtAutoTaskService {
FileUtil.mkdir(outWordFilePath); FileUtil.mkdir(outWordFilePath);
try { try {
//先生成封皮数据 //先生成封皮数据
docBeforeCreateEvent.generalTechnicalWord(documentVO); documentEvent.generalTechnicalWord(documentVO);
JSONObject jsonObject = technicalFileUtils.settingData(documentVO, wfProcessInfoVO); JSONObject jsonObject = technicalFileUtils.settingData(documentVO, wfProcessInfoVO);
//生成校核、审核、审定的记录卡 //生成校核、审核、审定的记录卡
importWordService.getWordAllTable(jsonObject, Constants.TEMPLATE_PATH + "TechnicalFile/QHTemplate.docx", outWordFilePath + "/QHAuditDoc.docx"); importWordService.getWordAllTable(jsonObject, Constants.TEMPLATE_PATH + "TechnicalFile/QHTemplate.docx", outWordFilePath + "/QHAuditDoc.docx");
......
package com.yonde.dcs.core.service.impl.expand; package com.yonde.dcs.core.service.impl.expand;
import com.yonde.dcs.core.constants.Constants;
import com.yonde.dcs.core.event.DocumentEvent;
import com.yonde.dcs.core.util.ProcessDataUtils;
import com.yonde.dcs.core.util.ExtDocUtil;
import com.yonde.dex.basedata.exception.DxBusinessException;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.logging.log4j.spi.CopyOnWrite;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.Collection;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
import com.yonde.dcs.document.common.entity.vo.DxDocumentVO; import com.yonde.dcs.document.common.entity.vo.DxDocumentVO;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import com.yonde.dcs.core.service.expand.ExtDxDocumentService; import com.yonde.dcs.core.service.expand.ExtDxDocumentService;
import com.yonde.dcs.document.core.repository.DocumentRepository; import com.yonde.dcs.document.core.repository.DocumentRepository;
import com.yonde.dcs.document.entity.po.DxDocument; import com.yonde.dcs.document.entity.po.DxDocument;
import javax.annotation.Resource;
import com.yonde.dcs.document.core.service.impl.DocumentServiceImpl; import com.yonde.dcs.document.core.service.impl.DocumentServiceImpl;
/** /**
...@@ -31,16 +39,22 @@ public class ExtDxDocumentServiceImpl<V extends DxDocumentVO> extends DocumentSe ...@@ -31,16 +39,22 @@ public class ExtDxDocumentServiceImpl<V extends DxDocumentVO> extends DocumentSe
@Autowired @Autowired
DocumentRepository<DxDocument> documentRepository; DocumentRepository<DxDocument> documentRepository;
@Autowired
private DocumentEvent documentEvent;
@Override @Override
public void beforeSave(Collection<V> target) { public void beforeSave(Collection<V> target) {
//循环处理每一个文档
for (V v : target) { for (V v : target) {
documentEvent.createDocListener(v);
} }
super.beforeSave(target); super.beforeSave(target);
}
@Override
public void beforeUpdate(Collection<V> target, Collection<V> origin) {
for (V v : target) {
documentEvent.updateDocListener(v);
}
super.beforeUpdate(target,origin);
} }
} }
......
package com.yonde.dcs.core.signUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import java.util.Map;
/**
* @author wyy
* @version 1.0
* @description: pdf签名
* @date 2021/6/25 15:21
*/
@Component
@Slf4j
public class SignImageUtil {
/**
* 签图片 图片的大小为占位符的大小
*
* @param sourcePath 原文件路径
* @param targetPath 目标文件路径
* @param flagMap key:占位符 value:图片绝对路径
*/
public static void signImage(String sourcePath, String targetPath, Map<String, String> flagMap, String pictureFrame) throws Exception {
SignHelper.signImage(sourcePath, targetPath, flagMap, null, null, pictureFrame);
}
/**
* 签图片 图片的大小为占位符的大小
*
* @param sourcePath 原文件路径
* @param targetPath 目标文件路径
* @param flagMap key:占位符 value:图片绝对路径
* @param xOffSet x轴偏移量 (正数:图片向右移动, 负数:图片向左移动)
* @param yOffset y轴偏移量 (正数:图片向上移动, 负数:图片向下移动)
*/
public static void signImage(String sourcePath, String targetPath, Map<String, String> flagMap, Float xOffSet, Float yOffset, String pictureFrame) throws Exception {
SignHelper.signImage(sourcePath, targetPath, flagMap, xOffSet, yOffset, pictureFrame);
}
}
package com.yonde.dcs.core.signUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import java.util.HashMap;
import java.util.Map;
/**
* @author wyy
* @version 1.0
* @description: pdf签名
* @date 2021/6/25 15:21
*/
@Component
@Slf4j
public class SignUtil {
//word调整文字宽度(高度可改变字体大小调整):动态调整文字的宽高,鼠标右键选中-右键点击-字体-高级-字符间距-缩放
//缩放>100% 拉宽
//缩放<100% 变窄
/**
* 签字+签图片
*
* @param sourcePath 原文件路径
* @param targetPath 目标文件路径
* @param flagMap key:占位符 value:替换文本/图片路径
*/
public static void sign(String sourcePath, String targetPath, Map<String, String> flagMap, String pictureFrame) throws Exception {
Map<String, String> wordMap = new HashMap<>();
Map<String, String> imageMap = new HashMap<>();
for (Map.Entry<String, String> entry : flagMap.entrySet()) {
//判断是否为图片 适用格式: bmp/gif/jpg/png
if (SignHelper.checkImage(entry.getValue())) {
log.info("图片路径为:" + entry.getValue().toString());
imageMap.put(entry.getKey(), entry.getValue());
} else {
wordMap.put(entry.getKey(), entry.getValue());
}
}
String temPath = targetPath.replaceFirst(".pdf", "-tem.pdf");
//签文字
SignWordUtil.signWord(sourcePath, temPath, wordMap, pictureFrame);
//签图片
SignImageUtil.signImage(temPath, targetPath, imageMap, pictureFrame);
}
}
package com.yonde.dcs.core.signUtils;
import com.itextpdf.kernel.font.PdfFont;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import java.util.Map;
/**
* @author wyy
* @version 1.0
* @description: 签文字
* @date 2021/6/25 15:21
*/
@Component
@Slf4j
public class SignWordUtil {
/**
* 签文字:字体大小为占位符大小(以占位符宽度大小为准)
*
* @param sourcePath 源文件
* @param targetPath 目标文件
* @param flagMap key:占位符 value:替换文本
*/
public static void signWord(String sourcePath, String targetPath, Map<String, String> flagMap, String pictureFrame) throws Exception {
SignHelper.signWord(sourcePath, targetPath, flagMap, null, null, pictureFrame);
}
/**
* 签文字
*
* @param sourcePath 源文件
* @param targetPath 目标文件
* @param flagMap key:占位符 value:替换文本
* @param fontSize 字体大小
*/
public static void signWord(String sourcePath, String targetPath, Map<String, String> flagMap, Float fontSize, String pictureFrame) throws Exception {
SignHelper.signWord(sourcePath, targetPath, flagMap, fontSize, null, pictureFrame);
}
/**
* 签文字:字体大小为占位符大小(以占位符宽度大小为准)
*
* @param sourcePath 源文件
* @param targetPath 目标文件
* @param flagMap key:占位符 value:替换文本
* @param fontStyle 字体样式
*/
public static void signWord(String sourcePath, String targetPath, Map<String, String> flagMap, PdfFont fontStyle, String pictureFrame) throws Exception {
SignHelper.signWord(sourcePath, targetPath, flagMap, null, fontStyle, pictureFrame);
}
/**
* 签文字
*
* @param sourcePath 源文件
* @param targetPath 目标文件
* @param flagMap key:占位符 value:替换文本
* @param fontSize 字体大小
* @param fontStyle 字体样式
*/
public static void signWord(String sourcePath, String targetPath, Map<String, String> flagMap, Float fontSize, PdfFont fontStyle, String pictureFrame) throws Exception {
SignHelper.signWord(sourcePath, targetPath, flagMap, fontSize, fontStyle, pictureFrame);
}
}
...@@ -24,10 +24,8 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -24,10 +24,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.web.context.request.RequestAttributes; import org.springframework.web.context.request.RequestAttributes;
import java.util.Collections; import java.io.InputStream;
import java.util.HashMap; import java.util.*;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
...@@ -116,9 +114,9 @@ public class ExtDocUtil { ...@@ -116,9 +114,9 @@ public class ExtDocUtil {
* @param fileVO * @param fileVO
*/ */
// TODO: 2024/8/1 minioFileStoreService不存在 // TODO: 2024/8/1 minioFileStoreService不存在
// public InputStream obtainPrimaryFileInputStream(RepoFileVO fileVO) { public InputStream obtainPrimaryFileInputStream(RepoFileVO fileVO) {
// InputStream inputStream = null; InputStream inputStream = null;
// if (!ObjectUtils.isEmpty(fileVO)) { if (!ObjectUtils.isEmpty(fileVO)) {
// log.info("开始下载主内容======》" + fileVO.getId()); // log.info("开始下载主内容======》" + fileVO.getId());
// RepoFileVO fileEntity = this.fileService.findFileInfoById(fileVO.getId()); // RepoFileVO fileEntity = this.fileService.findFileInfoById(fileVO.getId());
// Site siteEntity = this.siteService.findByIsDefault(true); // Site siteEntity = this.siteService.findByIsDefault(true);
...@@ -127,11 +125,11 @@ public class ExtDocUtil { ...@@ -127,11 +125,11 @@ public class ExtDocUtil {
// } else { // } else {
// inputStream = this.minioFileStoreService.download(fileEntity.getBucketName(), fileEntity.getMinioFileName(), fileEntity.getSecretKey(), siteEntity); // inputStream = this.minioFileStoreService.download(fileEntity.getBucketName(), fileEntity.getMinioFileName(), fileEntity.getSecretKey(), siteEntity);
// } // }
// } else { } else {
// log.error("下载主内容失败======》fileVO为空!"); log.error("下载主内容失败======》fileVO为空!");
// } }
// return inputStream; return inputStream;
// } }
/** /**
* 通过id查询文档附件 * 通过id查询文档附件
......
...@@ -20,7 +20,7 @@ import java.util.stream.Collectors; ...@@ -20,7 +20,7 @@ import java.util.stream.Collectors;
* @date 2021/7/12 10:28 * @date 2021/7/12 10:28
*/ */
public class ObjFileLinkUtil { public class ObjFileLinkUtil {
//TODO 暂使用RepoFileVO替换PapersVO
public static <T extends IdVO & ContentHolder> void removeAllFile(T holder) { public static <T extends IdVO & ContentHolder> void removeAllFile(T holder) {
if (!CollectionUtils.isEmpty(((ContentHolder) holder).getObjFileLinks())) { if (!CollectionUtils.isEmpty(((ContentHolder) holder).getObjFileLinks())) {
...@@ -42,11 +42,11 @@ public class ObjFileLinkUtil { ...@@ -42,11 +42,11 @@ public class ObjFileLinkUtil {
* @param fileType * @param fileType
* @param <T> * @param <T>
*/ */
// public static <T extends IdVO & ContentHolder> void replaceFile(T holder, PapersVO fileVO, String fileType) { public static <T extends IdVO & ContentHolder> void replaceFile(T holder, RepoFileVO fileVO, String fileType) {
// removeFile(holder, fileType); removeFile(holder, fileType);
// addFile(holder, fileVO, fileType); addFile(holder, fileVO, fileType);
// } }
//
public static <T extends IdVO & ContentHolder> void addFile(T holder, RepoFileVO fileVO, String fileType) { public static <T extends IdVO & ContentHolder> void addFile(T holder, RepoFileVO fileVO, String fileType) {
if (CollectionUtils.isEmpty(((ContentHolder)holder).getObjFileLinks())) { if (CollectionUtils.isEmpty(((ContentHolder)holder).getObjFileLinks())) {
((ContentHolder)holder).setObjFileLinks(new ArrayList()); ((ContentHolder)holder).setObjFileLinks(new ArrayList());
...@@ -149,7 +149,6 @@ public class ObjFileLinkUtil { ...@@ -149,7 +149,6 @@ public class ObjFileLinkUtil {
* @param <T> * @param <T>
* @return * @return
*/ */
public static <T extends IdVO & ContentHolder> List<RepoFileVO> getAppointTypeFile(T holder, String fileType) { public static <T extends IdVO & ContentHolder> List<RepoFileVO> getAppointTypeFile(T holder, String fileType) {
if (!Objects.isNull(holder) && !CollectionUtils.isEmpty(((ContentHolder) holder).getObjFileLinks())) { if (!Objects.isNull(holder) && !CollectionUtils.isEmpty(((ContentHolder) holder).getObjFileLinks())) {
List<ObjFileLinkVO> fileLinkVOList = holder.getObjFileLinks().stream().filter(o -> o.getContentType().equalsIgnoreCase(fileType)).collect(Collectors.toList()); List<ObjFileLinkVO> fileLinkVOList = holder.getObjFileLinks().stream().filter(o -> o.getContentType().equalsIgnoreCase(fileType)).collect(Collectors.toList());
...@@ -168,15 +167,15 @@ public class ObjFileLinkUtil { ...@@ -168,15 +167,15 @@ public class ObjFileLinkUtil {
* @param <T> * @param <T>
* @return * @return
*/ */
// public static <T extends IdVO & ContentHolder> List<PapersVO> getAppointNameFile(T holder, String fileType, String fileLikeName) { public static <T extends IdVO & ContentHolder> List<RepoFileVO> getAppointNameFile(T holder, String fileType, String fileLikeName) {
// if (!Objects.isNull(holder) && !CollectionUtils.isEmpty(((ContentHolder) holder).getObjFileLinks())) { if (!Objects.isNull(holder) && !CollectionUtils.isEmpty(((ContentHolder) holder).getObjFileLinks())) {
// List<ObjFileLinkVO> fileLinkVOList = holder.getObjFileLinks().stream().filter(o -> o.getContentType().equalsIgnoreCase(fileType)).collect(Collectors.toList()); List<ObjFileLinkVO> fileLinkVOList = holder.getObjFileLinks().stream().filter(o -> o.getContentType().equalsIgnoreCase(fileType)).collect(Collectors.toList());
// if (!CollectionUtils.isEmpty(fileLinkVOList)) { if (!CollectionUtils.isEmpty(fileLinkVOList)) {
// return fileLinkVOList.stream().map(ObjFileLinkVO::getTarget).filter(o -> o.getOriginalFileName().contains(fileLikeName)).collect(Collectors.toList()); return fileLinkVOList.stream().map(ObjFileLinkVO::getTarget).filter(o -> o.getOriginalFileName().contains(fileLikeName)).collect(Collectors.toList());
// } }
// } }
// return null; return null;
// } }
} }
package com.yonde.dcs.core.events; package com.yonde.dcs.core.util;
import cn.hutool.core.io.FileUtil; import cn.hutool.core.io.FileUtil;
import cn.hutool.extra.spring.SpringUtil; import cn.hutool.extra.spring.SpringUtil;
......
package com.yonde.dcs.core.event;
import com.yonde.dcs.common.vo.ExtIncomeContractVO;
import com.yonde.dcs.common.vo.ExtSpendingContractVO;
import com.yonde.dcs.plan.common.vo.ExtPlanVO;
import org.apache.commons.compress.utils.Lists;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.springframework.test.context.junit4.SpringRunner;
import java.util.List;
//@SpringBootTest
@RunWith(SpringRunner.class)
public class DocumentEventTest {
@Mock
DocumentEvent documentEvent;
@Test
public void extValidateSecretTest() {
ExtPlanVO extPlanVO = new ExtPlanVO();
ExtIncomeContractVO extIncomeContractVO = new ExtIncomeContractVO();
ExtSpendingContractVO extSpendingContractVO = new ExtSpendingContractVO();
List objects = Lists.newArrayList();
objects.add(extPlanVO);
objects.add(extIncomeContractVO);
objects.add(extSpendingContractVO);
documentEvent.extValidateSecret(objects);
Assert.assertNotNull("1");
}
}
package com.yonde.dcs.feign;
import com.yonde.dcs.core.util.ExtDocUtil;
import com.yonde.dcs.document.common.entity.vo.DxDocumentVO;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.springframework.test.context.junit4.SpringRunner;
import java.io.File;
@RunWith(SpringRunner.class)
public class ExtAutoTaskServiceFeignTest {
@Mock
ExtAutoTaskServiceFeign extAutoTaskServiceFeign;
@Mock
ExtDocUtil extDocUtil;
@Test
public void generateNcrReviewWordTest() {
DxDocumentVO dxDocumentVO = new DxDocumentVO();
dxDocumentVO.setSubTypeName("subTypeName");
dxDocumentVO.setNumber("number");
Mockito.when(extDocUtil.findDocObjFileLinks(Mockito.any())).thenReturn(dxDocumentVO);
extAutoTaskServiceFeign.generateNcrReviewWord(1L, null);
Assert.assertNotNull(new File("D:\\InetService\\resource\\template\\words\\subTypeName\\number\\source"));
}
}
\ No newline at end of file
...@@ -9,7 +9,6 @@ import io.swagger.annotations.Api; ...@@ -9,7 +9,6 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
...@@ -23,7 +22,7 @@ import java.util.Map; ...@@ -23,7 +22,7 @@ import java.util.Map;
**/ **/
@Api(tags = "ExtAutoTask-FEIGN") @Api(tags = "ExtAutoTask-FEIGN")
@FeignClient(value = "${dcs.feign.DCS-DOC}", path = "/task") @FeignClient(value = "${dcs.feign.DCS-DOC}", path = "/task")
public interface ExtAutoTaskServiceFeign { public interface ExtAutoTaskServiceFeign{
@ApiOperation(value = "客户化文档修改状态", notes = "客户化文档修改状态", httpMethod = "POST") @ApiOperation(value = "客户化文档修改状态", notes = "客户化文档修改状态", httpMethod = "POST")
@PostMapping(value = "/extChangeDocState") @PostMapping(value = "/extChangeDocState")
void extChangeDocState(@RequestBody DxDocumentVO documentVO, @RequestParam(name = "state") String state); void extChangeDocState(@RequestBody DxDocumentVO documentVO, @RequestParam(name = "state") String state);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment