|
@@ -19,23 +19,22 @@ import com.hotent.project.dao.CostProjectDocumentDao;
|
|
|
import com.hotent.project.manager.CostProjectDocumentManager;
|
|
import com.hotent.project.manager.CostProjectDocumentManager;
|
|
|
import com.hotent.base.manager.impl.BaseManagerImpl;
|
|
import com.hotent.base.manager.impl.BaseManagerImpl;
|
|
|
import com.hotent.project.model.CostProjectDocumentFile;
|
|
import com.hotent.project.model.CostProjectDocumentFile;
|
|
|
-import com.hotent.project.req.CostProjectBasePageReq;
|
|
|
|
|
import com.hotent.project.req.CostProjectDocumentPageReq;
|
|
import com.hotent.project.req.CostProjectDocumentPageReq;
|
|
|
import com.hotent.project.req.CostProjectDocumentReq;
|
|
import com.hotent.project.req.CostProjectDocumentReq;
|
|
|
import com.hotent.project.resp.CostProjectDocumentResp;
|
|
import com.hotent.project.resp.CostProjectDocumentResp;
|
|
|
-import com.hotent.req.PageReq;
|
|
|
|
|
import com.hotent.uc.exception.BaseException;
|
|
import com.hotent.uc.exception.BaseException;
|
|
|
|
|
+import com.hotent.util.wordexcelutils.DocumentProcessor;
|
|
|
|
|
+import org.apache.commons.lang.StringUtils;
|
|
|
|
|
+import org.apache.tools.ant.util.DateUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
|
|
|
|
|
|
import java.time.LocalDateTime;
|
|
import java.time.LocalDateTime;
|
|
|
-import java.util.ArrayList;
|
|
|
|
|
-import java.util.List;
|
|
|
|
|
-import javax.annotation.Resource;
|
|
|
|
|
|
|
+import java.util.*;
|
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
-import com.hotent.base.util.BeanUtils;
|
|
|
|
|
|
|
+import com.hotent.util.FileUploadUtil;
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -60,6 +59,8 @@ public class CostProjectDocumentManagerImpl extends BaseManagerImpl<CostProjectD
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private CostDocumentWhManager costDocumentWhManager;
|
|
private CostDocumentWhManager costDocumentWhManager;
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
@Override
|
|
@Override
|
|
|
public CostProjectDocument getDetail(String id) {
|
|
public CostProjectDocument getDetail(String id) {
|
|
|
CostProjectDocument costProjectDocument = this.get(id);
|
|
CostProjectDocument costProjectDocument = this.get(id);
|
|
@@ -199,6 +200,28 @@ public class CostProjectDocumentManagerImpl extends BaseManagerImpl<CostProjectD
|
|
|
req.getCostProjectDocumentFiles().forEach(costProjectDocumentFile -> {
|
|
req.getCostProjectDocumentFiles().forEach(costProjectDocumentFile -> {
|
|
|
costProjectDocumentFile.setDocumentId(costProjectDocument.getDocumentId());
|
|
costProjectDocumentFile.setDocumentId(costProjectDocument.getDocumentId());
|
|
|
costProjectDocumentFile.setProjectId(costProjectDocument.getProjectId());
|
|
costProjectDocumentFile.setProjectId(costProjectDocument.getProjectId());
|
|
|
|
|
+ //送达回证特殊处理字段 后期在说
|
|
|
|
|
+ if ("送达回证".equals(costProjectDocument.getDocumentName())) {
|
|
|
|
|
+ if (costProjectDocumentFile.getPinyin().equals("SongDaWenShuMingCheng")){
|
|
|
|
|
+ costProjectDocumentFile.setDataValue(costDocumentTemplate.getDocumentName());
|
|
|
|
|
+ }
|
|
|
|
|
+ if (costProjectDocumentFile.getPinyin().equals("SongDaWenShuWenHao")){
|
|
|
|
|
+ costProjectDocumentFile.setDataValue(whNo);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (costProjectDocumentFile.getPinyin().equals("SongDaWenShuMingCheng")){
|
|
|
|
|
+ costProjectDocumentFile.setDataValue(costDocumentTemplate.getDocumentName());
|
|
|
|
|
+ }
|
|
|
|
|
+ if (costProjectDocumentFile.getPinyin().equals("TongZhiSongDaShiJian")){
|
|
|
|
|
+ costProjectDocumentFile.setDataValue(DateUtils.format(new Date(),"yyyy-MM-dd"));
|
|
|
|
|
+ }
|
|
|
|
|
+ if (costProjectDocumentFile.getPinyin().equals("BeiJianShenDanWeiBanGongDiDian")){
|
|
|
|
|
+ costProjectDocumentFile.setDataValue(auditedUnit.getAddress());
|
|
|
|
|
+ }
|
|
|
|
|
+ if (costProjectDocumentFile.getPinyin().equals("ShouSongDaRen")){
|
|
|
|
|
+ costProjectDocumentFile.setDataValue(auditedUnit.getContactName());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
});
|
|
});
|
|
|
//保存解析出的文件内容
|
|
//保存解析出的文件内容
|
|
|
costProjectDocumentFileManager.saveBatch(req.getCostProjectDocumentFiles());
|
|
costProjectDocumentFileManager.saveBatch(req.getCostProjectDocumentFiles());
|
|
@@ -270,6 +293,7 @@ public class CostProjectDocumentManagerImpl extends BaseManagerImpl<CostProjectD
|
|
|
selectCostProjectDocument.setDocumentWhId(req.getDocumentWhId());
|
|
selectCostProjectDocument.setDocumentWhId(req.getDocumentWhId());
|
|
|
selectCostProjectDocument.setDocumentId(req.getDocumentId());
|
|
selectCostProjectDocument.setDocumentId(req.getDocumentId());
|
|
|
selectCostProjectDocument.setEnterpriseId(req.getEnterpriseId());
|
|
selectCostProjectDocument.setEnterpriseId(req.getEnterpriseId());
|
|
|
|
|
+ selectCostProjectDocument.setElectronicDocumentUrl("");
|
|
|
// 类型转换
|
|
// 类型转换
|
|
|
BeanUtil.copyProperties(req,selectCostProjectDocument);
|
|
BeanUtil.copyProperties(req,selectCostProjectDocument);
|
|
|
super.update(selectCostProjectDocument);
|
|
super.update(selectCostProjectDocument);
|
|
@@ -317,4 +341,25 @@ public class CostProjectDocumentManagerImpl extends BaseManagerImpl<CostProjectD
|
|
|
return costProjectDocumentResp;
|
|
return costProjectDocumentResp;
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public String createDocument(String id) {
|
|
|
|
|
+ CostProjectDocument costProjectDocument = this.getDetail(id);
|
|
|
|
|
+ List<CostProjectDocumentFile> list = costProjectDocumentFileManager.getCostProjectDocumentFiles(costProjectDocument.getProjectId(),costProjectDocument.getDocumentId());
|
|
|
|
|
+ CostDocumentTemplate costDocumentTemplate = this.costDocumentTemplateManager.get(costProjectDocument.getDocumentId());
|
|
|
|
|
+ //生成文书
|
|
|
|
|
+ Map<String,String> map = new HashMap<>();
|
|
|
|
|
+ list.stream().forEach(p->{
|
|
|
|
|
+ map.put("{"+p.getOriginalText()+"}",p.getDataValue());
|
|
|
|
|
+ });
|
|
|
|
|
+ //先处理一种文件
|
|
|
|
|
+ String templatePath = costDocumentTemplate.getFileUrl().replace(BaseConstant.RESOURCE_PREFIX,"");
|
|
|
|
|
+ templatePath = EipConfig.getProfile()+templatePath;
|
|
|
|
|
+
|
|
|
|
|
+ String fileExtension = FileUploadUtil.getFileExtension(costDocumentTemplate.getFileUrl());
|
|
|
|
|
+ String fileName = FileUploadUtil.generateFileName(costDocumentTemplate.getDocumentName()+"."+fileExtension);
|
|
|
|
|
+ String outputPath = FileUploadUtil.generateSavePath(EipConfig.getUploadPath(), fileName, fileExtension);
|
|
|
|
|
+ DocumentProcessor.processWordDocument(templatePath,outputPath,map,new LinkedHashMap<>());
|
|
|
|
|
+ return EipConfig.getImgUrl()+FileUploadUtil.getPathFileName(outputPath,fileName);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|