Commit 590a4f66 authored by wei's avatar wei 🎱

word模板生成

parent 400aad38
......@@ -42,7 +42,7 @@ public class ExtExpenditureContractController<V extends ExtExpenditureContractVO
@PostMapping(value = "/generateContractWordSign")
public void generateContractWordSign(@RequestParam("documentId") Long contractId,
@RequestParam("fileName") String fileName) {
autoTaskService.generateContractWordSign(contractId, fileName);
autoTaskService.generateExpenditureWordSign(contractId, fileName);
}
}
......
......@@ -2,7 +2,6 @@ package com.yonde.dcs.plan.core.factory;
import cn.hutool.core.io.FileUtil;
import com.alibaba.fastjson.JSONObject;
import com.yonde.dcs.plan.common.constants.Constants;
import com.yonde.dcs.plan.common.constants.SignConstants;
import com.yonde.dcs.plan.common.vo.ExtExpenditureContractVO;
......@@ -13,20 +12,17 @@ import com.yonde.dex.wfc.common.vo.DxWfProcessTaskVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
import java.util.List;
import java.util.Map;
import java.util.Objects;
/**
* @author weihongda
* @ClassName ContractUtils.java
* @Description 合同
* @ClassName ExpenditureContractUtils.java
* @Description 支出合同
* @createTime 2022/02/22 14:35:00
*/
@Component
public class ContractUtils {
public class ExpenditureContractUtils {
@Autowired
private ExtExpenditureContractService extExpenditureContractService;
......
package com.yonde.dcs.plan.core.factory;
import cn.hutool.core.io.FileUtil;
import com.alibaba.fastjson.JSONObject;
import com.yonde.dcs.plan.common.constants.Constants;
import com.yonde.dcs.plan.common.constants.SignConstants;
import com.yonde.dcs.plan.common.vo.ExtExpenditureContractVO;
import com.yonde.dcs.plan.common.vo.ExtInComeContractVO;
import com.yonde.dcs.plan.core.service.ExtExpenditureContractService;
import com.yonde.dcs.plan.core.word.ImportWordService;
import com.yonde.dex.wfc.common.vo.DxWfProcessInfoVO;
import com.yonde.dex.wfc.common.vo.DxWfProcessTaskVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
import java.util.List;
import java.util.Map;
import java.util.Objects;
/**
* @author weihongda
* @ClassName InComeContractUtils.java
* @Description 收入合同
* @createTime 2022/02/22 14:35:00
*/
@Component
public class InComeContractUtils {
@Autowired
private ExtExpenditureContractService extExpenditureContractService;
@Autowired
private ImportWordService importWordService;
/**
* 填充评审会议资料数据
*
* @param
* @return
*/
public JSONObject settingDocData(ExtInComeContractVO inComeContractVO, DxWfProcessInfoVO wfProcessInfoVO) {
String path = Constants.MTEMPLATE_ABSOLUTE_PATH;
String file = inComeContractVO.getSubTypeName();
String outFilePath = Constants.MERGER_FILE_ABSOLUTE_PATH + inComeContractVO.getSubTypeName()
+ "\\" + inComeContractVO.getNumber() + "\\";
//生成特定的文档目录,保存生成的word文件
FileUtil.mkdir(outFilePath);
//获取动态属性
/*Map<String, Object> dynamicAttrs = expenditureContractVO.getDynamicAttrs();
String content = Objects.isNull(dynamicAttrs.get("content")) ? "" : (String) dynamicAttrs.get("content");
String designPhase = Objects.isNull(dynamicAttrs.get("designPhase")) ? "" : (String) dynamicAttrs.get("designPhase");*/
JSONObject jsonObject = (JSONObject) JSONObject.toJSON(inComeContractVO);
//项目代号
/*String projectCode = ObjectUtils.isEmpty(v.getDxDocumentExpand().getProjectCode()) ? "" : v.getDxDocumentExpand().getProjectCode();
jsonObject.put("projectCode", extDocService.searchDictDataByDictCode(Constants.PROJECT_CODE, projectCode));
jsonObject.put("projectCode", projectCode);*/
//合同名称
//合同乙方
//合同编号
//合同金额
//合同密级
//合同乙方保密资质等级
//合同类型
//学校/院归口管理部门
//合同成果形式
//成果交付地点(样机存放地方)
//起止时间
//承办部门
//经办人
//
//页数
//jsonObject.put("pages",v.getDxDocumentExpand().getAttachPages());
//获取参与者
List<DxWfProcessTaskVO> activities = wfProcessInfoVO.getHistoryInfo();
if (!CollectionUtils.isEmpty(activities)) {
//写入签名数据
jsonObject.put("bz_photo", extExpenditureContractService.getSignImage(activities, SignConstants.SIGN_KEY_PREPARED));
jsonObject.put("bz_date", extExpenditureContractService.getEndDate(activities, SignConstants.SIGN_KEY_PREPARED));
jsonObject.put("sh_photo", extExpenditureContractService.getSignImage(activities, SignConstants.SIGN_KEY_SH));
jsonObject.put("sh_date", extExpenditureContractService.getEndDate(activities, SignConstants.SIGN_KEY_SH));
//总体室审核
jsonObject.put("zts_photo", extExpenditureContractService.getSignImage(activities, SignConstants.SIGN_KEY_ZTSSH));
jsonObject.put("zts_date", extExpenditureContractService.getEndDate(activities, SignConstants.SIGN_KEY_ZTSSH));
jsonObject.put("pz_photo", extExpenditureContractService.getSignImage(activities, SignConstants.SIGN_KEY_APPROVED));
jsonObject.put("pz_date", extExpenditureContractService.getEndDate(activities, SignConstants.SIGN_KEY_APPROVED));
}
//模板名称
importWordService.getWordAllTable(jsonObject, path + file + ".docx", outFilePath + "outFile.docx");
return jsonObject;
}
}
......@@ -20,7 +20,7 @@ public interface AutoTaskService {
* @param contractId
* @param fileName
*/
void generateContractWordSign(Long contractId, String fileName);
void generateExpenditureWordSign(Long contractId, String fileName);
void generateInComeContractWordSign(Long contractId, String fileName);
}
package com.yonde.dcs.plan.core.service;
import com.yonde.dcs.plan.common.vo.ExtExpenditureContractVO;
import com.yonde.dcs.plan.core.factory.ContractUtils;
import com.yonde.dcs.plan.core.factory.InComeContractUtils;
import com.yonde.dcs.plan.core.service.shadow.ExtExpenditureContractServiceShadow;
import com.yonde.dex.wfc.common.vo.DxWfProcessInfoVO;
import com.yonde.dex.wfc.common.vo.DxWfProcessTaskVO;
......@@ -22,7 +22,7 @@ public interface ExtExpenditureContractService<V extends ExtExpenditureContractV
ExtExpenditureContractVO findExpenditureContractObjFileLinks(Long contractId);
void generateContractWordSign(Object object, Class<ContractUtils> contractUtilsClass,
void generateContractWordSign(Object object, Class<InComeContractUtils> contractUtilsClass,
DxWfProcessInfoVO wfProcessInfoVO, String fileName);
/**
......
......@@ -2,7 +2,7 @@ package com.yonde.dcs.plan.core.service.impl;
import com.yonde.dcs.plan.common.vo.ExtExpenditureContractVO;
import com.yonde.dcs.plan.common.vo.ExtInComeContractVO;
import com.yonde.dcs.plan.core.factory.ContractUtils;
import com.yonde.dcs.plan.core.factory.InComeContractUtils;
import com.yonde.dcs.plan.core.service.AutoTaskService;
import com.yonde.dcs.plan.core.service.ExtExpenditureContractService;
import com.yonde.dcs.plan.core.service.ExtInComeContractService;
......@@ -51,7 +51,7 @@ public class AutoTaskServiceImpl implements AutoTaskService {
}
@Override
public void generateContractWordSign(Long contractId, String fileName) {
public void generateExpenditureWordSign(Long contractId, String fileName) {
//深度查询展开ObjLink
ExtExpenditureContractVO expenditureContractVO = extExpenditureContractService.findExpenditureContractObjFileLinks(contractId);
log.info("自动任务======生成word签名开始");
......@@ -59,7 +59,7 @@ public class AutoTaskServiceImpl implements AutoTaskService {
DxWfProcessInfoVO wfProcessInfoVO = workFlowUtil.getProcessInstDetail(wfProcessInstVO);
String subTypeName = expenditureContractVO.getSubTypeName();
log.info("自动任务======生成word签名进行中,文档SubTypeName:{}", subTypeName);
extExpenditureContractService.generateContractWordSign(expenditureContractVO, ContractUtils.class, wfProcessInfoVO, fileName);
extExpenditureContractService.generateContractWordSign(expenditureContractVO, ExtExpenditureContractVO.class, wfProcessInfoVO, fileName);
//保存附件
extExpenditureContractService.saveRecursion(expenditureContractVO);
log.info("自动任务======生成word签名完成");
......@@ -74,7 +74,7 @@ public class AutoTaskServiceImpl implements AutoTaskService {
DxWfProcessInfoVO wfProcessInfoVO = workFlowUtil.getProcessInstDetail(wfProcessInstVO);
String subTypeName = extInComeContractVO.getSubTypeName();
log.info("自动任务======生成word签名进行中,文档SubTypeName:{}", subTypeName);
extExpenditureContractService.generateContractWordSign(extInComeContractVO, ContractUtils.class, wfProcessInfoVO, fileName);
extExpenditureContractService.generateContractWordSign(extInComeContractVO, InComeContractUtils.class, wfProcessInfoVO, fileName);
//保存附件
extExpenditureContractService.saveRecursion(extInComeContractVO);
log.info("自动任务======生成word签名完成");
......
......@@ -9,7 +9,6 @@ import com.yonde.dcs.plan.common.constants.SignConstants;
import com.yonde.dcs.plan.common.utils.FileUtils;
import com.yonde.dcs.plan.common.vo.ExtExpenditureContractVO;
import com.yonde.dcs.plan.common.vo.ExtInComeContractVO;
import com.yonde.dcs.plan.core.factory.ContractUtils;
import com.yonde.dcs.plan.core.repository.ExtExpenditureContractRepository;
import com.yonde.dcs.plan.core.service.ExtExpenditureContractService;
import com.yonde.dcs.plan.core.util.CommonUtils;
......@@ -84,9 +83,6 @@ public class ExtExpenditureContractServiceImpl<V extends ExtExpenditureContractV
@Autowired
private DxUserInfoFeign userService;
@Autowired
private ContractUtils contractUtils;
@Override
public ExtExpenditureContractVO startWorkflow(Long id) {
ExtExpenditureContractVO extExpenditureContractVO = this.get(id);
......@@ -107,14 +103,14 @@ public class ExtExpenditureContractServiceImpl<V extends ExtExpenditureContractV
try {
if (obj instanceof ExtExpenditureContractVO) {
ExtExpenditureContractVO expenditureContractVO = (ExtExpenditureContractVO) obj;
Class<?> clazz = Class.forName("com.yonde.dcs.plan.core.factory.ContractUtils");
Class<?> clazz = Class.forName("com.yonde.dcs.plan.core.factory.ExpenditureContractUtils");
Method settingDataMethod = clazz.getMethod("settingData", ExtExpenditureContractVO.class, DxWfProcessInfoVO.class);
settingDataMethod.invoke(SpringUtil.getBean(classType), expenditureContractVO, wfProcessInfoVO);
outFilePath = outFilePath + expenditureContractVO.getSubTypeName() + "\\" + expenditureContractVO.getNumber() + "\\";
sPath = sPath + expenditureContractVO.getSubTypeName() + "\\" + expenditureContractVO.getNumber();
} else if (obj instanceof ExtInComeContractVO) {
ExtInComeContractVO extInComeContractVO = (ExtInComeContractVO) obj;
Class<?> clazz = Class.forName("com.yonde.dcs.plan.core.factory.ContractUtils");// TODO 改
Class<?> clazz = Class.forName("com.yonde.dcs.plan.core.factory.InComeContractUtils");
Method settingDataMethod = clazz.getMethod("settingData", ExtInComeContractVO.class, DxWfProcessInfoVO.class);
settingDataMethod.invoke(SpringUtil.getBean(classType), extInComeContractVO, wfProcessInfoVO);
outFilePath = outFilePath + extInComeContractVO.getSubTypeName() + "\\" + extInComeContractVO.getNumber() + "\\";
......
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