|
|
@@ -3,17 +3,23 @@ package com.hotent.project.manager.impl;
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
+import com.hotent.base.util.UniqueIdUtil;
|
|
|
import com.hotent.baseInfo.manager.AuditedUnitManager;
|
|
|
+import com.hotent.baseInfo.manager.CostDocumentTemplateFileManager;
|
|
|
import com.hotent.baseInfo.manager.CostDocumentTemplateManager;
|
|
|
import com.hotent.baseInfo.manager.CostDocumentWhManager;
|
|
|
import com.hotent.baseInfo.model.AuditedUnit;
|
|
|
import com.hotent.baseInfo.model.CostDocumentTemplate;
|
|
|
+import com.hotent.baseInfo.model.CostDocumentTemplateFile;
|
|
|
import com.hotent.baseInfo.model.CostDocumentWh;
|
|
|
import com.hotent.config.EipConfig;
|
|
|
import com.hotent.constant.BaseConstant;
|
|
|
+import com.hotent.project.manager.CostProjectApprovalManager;
|
|
|
import com.hotent.project.manager.CostProjectDocumentFileManager;
|
|
|
+import com.hotent.project.model.CostProjectApproval;
|
|
|
import com.hotent.project.model.CostProjectDocument;
|
|
|
import com.hotent.project.dao.CostProjectDocumentDao;
|
|
|
import com.hotent.project.manager.CostProjectDocumentManager;
|
|
|
@@ -22,10 +28,15 @@ import com.hotent.project.model.CostProjectDocumentFile;
|
|
|
import com.hotent.project.req.CostProjectDocumentPageReq;
|
|
|
import com.hotent.project.req.CostProjectDocumentReq;
|
|
|
import com.hotent.project.resp.CostProjectDocumentResp;
|
|
|
+import com.hotent.uc.api.model.IUser;
|
|
|
import com.hotent.uc.exception.BaseException;
|
|
|
+import com.hotent.uc.manager.UserManager;
|
|
|
+import com.hotent.uc.model.User;
|
|
|
+import com.hotent.uc.util.ContextUtil;
|
|
|
import com.hotent.util.wordexcelutils.DocumentProcessor;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
import org.apache.tools.ant.util.DateUtils;
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
@@ -57,9 +68,16 @@ public class CostProjectDocumentManagerImpl extends BaseManagerImpl<CostProjectD
|
|
|
private AuditedUnitManager auditedUnitManager;
|
|
|
|
|
|
@Autowired
|
|
|
+ private CostDocumentTemplateFileManager costDocumentTemplateFileManager;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
private CostDocumentWhManager costDocumentWhManager;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private CostProjectApprovalManager costProjectApprovalManager;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private UserManager userService;
|
|
|
|
|
|
@Override
|
|
|
public CostProjectDocument getDetail(String id) {
|
|
|
@@ -149,7 +167,8 @@ public class CostProjectDocumentManagerImpl extends BaseManagerImpl<CostProjectD
|
|
|
|
|
|
|
|
|
@Override
|
|
|
- public void create(CostProjectDocumentReq req) {
|
|
|
+ @Transactional
|
|
|
+ public void create(CostProjectDocumentReq req) throws Exception {
|
|
|
if (ObjectUtil.isEmpty(req.getDocumentId())) {
|
|
|
throw new BaseException("请选择文书模板");
|
|
|
}
|
|
|
@@ -189,15 +208,85 @@ public class CostProjectDocumentManagerImpl extends BaseManagerImpl<CostProjectD
|
|
|
if (this.count(qw) > 0) {
|
|
|
throw new BaseException("该项目监审单位已存在此文书");
|
|
|
}
|
|
|
+ CostProjectApproval costProjectApproval = costProjectApprovalManager.get(req.getProjectId());
|
|
|
//类型转换
|
|
|
CostProjectDocument costProjectDocument = new CostProjectDocument();
|
|
|
BeanUtil.copyProperties(req, costProjectDocument);
|
|
|
costProjectDocument.setDocumentNumber(whNo);
|
|
|
costProjectDocument.setDocumentName(costDocumentTemplate.getDocumentName());
|
|
|
costProjectDocument.setDocumentType(costDocumentTemplate.getType());
|
|
|
+ costProjectDocument.setProjectId(costProjectApproval.getProjectId());
|
|
|
super.create(costProjectDocument);
|
|
|
+ if (costProjectDocument.getDocumentAlias().equals("cbjstzs")) {
|
|
|
+
|
|
|
+ CostDocumentTemplate templateManagerById = costDocumentTemplateManager.getByAlias("sdhz");
|
|
|
+ if (templateManagerById==null) {
|
|
|
+ throw new BaseException("未查询到送达回证文书模板信息,请先添加");
|
|
|
+ }
|
|
|
+
|
|
|
+ IUser iUser = ContextUtil.getCurrentUser();
|
|
|
+ User user = userService.getByAccount(iUser.getAccount());
|
|
|
+ ArrayList<CostProjectDocumentFile> arrayList = new ArrayList<>();
|
|
|
+ CostProjectDocument projectDocument = new CostProjectDocument();
|
|
|
+ BeanUtil.copyProperties(costProjectDocument, projectDocument);
|
|
|
+ projectDocument.setId(UniqueIdUtil.getSuid());
|
|
|
+ projectDocument.setCreateBy(user.getAccount());
|
|
|
+ projectDocument.setCreateTime(LocalDateTime.now());
|
|
|
+ QueryWrapper<CostDocumentWh> wrapper = new QueryWrapper<>();
|
|
|
+ wrapper.eq("wh_type","187");
|
|
|
+ List<CostDocumentWh> list = costDocumentWhManager.list(wrapper);
|
|
|
+
|
|
|
+ if (list == null || list.isEmpty()) {
|
|
|
+ throw new BaseException("文书文号不存在");
|
|
|
+ }
|
|
|
+ CostDocumentWh costDocument = list.get(0);
|
|
|
+ projectDocument.setDocumentNumber(costDocument.getRulePattern().replace("{prefixText}", costDocument.getPrefixText())
|
|
|
+ .replace("{year}", costDocument.getYear()).replace("{currentValue}", costDocument.getCurrentValue().toString()));
|
|
|
+ projectDocument.setElectronicDocumentUrl(templateManagerById.getFileUrl());
|
|
|
+ projectDocument.setDocumentWhId(costDocument.getId());
|
|
|
+ projectDocument.setDocumentId(String.valueOf(templateManagerById.getId()));
|
|
|
+ projectDocument.setDocumentName(templateManagerById.getDocumentName());
|
|
|
+ projectDocument.setDocumentType(templateManagerById.getType());
|
|
|
+ projectDocument.setDocumentAlias(templateManagerById.getAlias());
|
|
|
+ //super.create(projectDocument);
|
|
|
+ this.save(projectDocument);
|
|
|
+
|
|
|
+
|
|
|
+ List<CostDocumentTemplateFile> documentFileList = costDocumentTemplateFileManager.getDocumentFileList(String.valueOf(templateManagerById.getId()));
|
|
|
+ documentFileList.forEach(f->{
|
|
|
+ CostProjectDocumentFile costProjectDocumentFile = new CostProjectDocumentFile();
|
|
|
+ BeanUtils.copyProperties(f,costProjectDocumentFile);
|
|
|
+ costProjectDocumentFile.setId(UniqueIdUtil.getUId());
|
|
|
+ costProjectDocumentFile.setCreateBy(user.getAccount());
|
|
|
+ costProjectDocumentFile.setCreateTime(LocalDateTime.now());
|
|
|
+ costProjectDocumentFile.setProjectId(costProjectApproval.getProjectId());
|
|
|
+ costProjectDocumentFile.setProjectId(costProjectDocument.getProjectId());
|
|
|
+ switch (f.getPinyin()) {
|
|
|
+ case "JiaGeZhuGuanBuMenHuoChengBenDiaoChaJiGou":
|
|
|
+ costProjectDocumentFile.setDataValue(costProjectApproval.getOrgName());
|
|
|
+ break;
|
|
|
+ case "SongDaWenShuMingCheng":
|
|
|
+ costProjectDocumentFile.setDataValue(costDocument.getWhName());
|
|
|
+ break;
|
|
|
+ case "SongDaWenShuWenHao":
|
|
|
+ costProjectDocumentFile.setDataValue(projectDocument.getDocumentNumber());
|
|
|
+ break;
|
|
|
+ case "ShouSongDaRen":
|
|
|
+ costProjectDocumentFile.setDataValue(auditedUnit.getContactName());
|
|
|
+ break;
|
|
|
+ case "BeiJianShenDanWeiBanGongDiDian":
|
|
|
+ costProjectDocumentFile.setDataValue(auditedUnit.getAddress());
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ costProjectDocumentFile.setDataValue("");
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ arrayList.add(costProjectDocumentFile);
|
|
|
+ });
|
|
|
+ costProjectDocumentFileManager.saveBatch(arrayList);
|
|
|
+ }
|
|
|
//文件关联信息赋值
|
|
|
- req.getCostProjectDocumentFiles().forEach(costProjectDocumentFile -> {
|
|
|
+ /*req.getCostProjectDocumentFiles().forEach(costProjectDocumentFile -> {
|
|
|
costProjectDocumentFile.setDocumentId(costProjectDocument.getDocumentId());
|
|
|
costProjectDocumentFile.setProjectId(costProjectDocument.getProjectId());
|
|
|
//送达回证特殊处理字段 后期在说
|
|
|
@@ -222,7 +311,7 @@ public class CostProjectDocumentManagerImpl extends BaseManagerImpl<CostProjectD
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- });
|
|
|
+ });*/
|
|
|
//保存解析出的文件内容
|
|
|
costProjectDocumentFileManager.saveBatch(req.getCostProjectDocumentFiles());
|
|
|
|