|
|
@@ -2,14 +2,12 @@ package me.zhengjie.domain.model;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
-import me.zhengjie.application.admin.controller.OrderCochainController;
|
|
|
-import me.zhengjie.application.admin.service.dto.UserDto;
|
|
|
import me.zhengjie.application.admin.controller.vo.NotaryNoteDto;
|
|
|
-import me.zhengjie.base.util.ApplicationContextUtil;
|
|
|
-import me.zhengjie.base.util.DateUtils;
|
|
|
-import me.zhengjie.base.util.StatusEnum;
|
|
|
-import me.zhengjie.base.util.TextTempletUtil;
|
|
|
+import me.zhengjie.application.admin.service.dto.UserDto;
|
|
|
+import me.zhengjie.base.util.*;
|
|
|
import me.zhengjie.dao.mybatis.ContractOrderRepository;
|
|
|
+import me.zhengjie.dao.mybatis.ModelRepository;
|
|
|
+import me.zhengjie.dao.mybatis.OrderFileRepository;
|
|
|
import me.zhengjie.dao.mybatis.entity.*;
|
|
|
import me.zhengjie.dao.mybatis.mapper.*;
|
|
|
import me.zhengjie.domain.order.OrderConstant;
|
|
|
@@ -28,6 +26,8 @@ import java.util.*;
|
|
|
@RequiredArgsConstructor
|
|
|
public class ModelSynthesizerDomain {
|
|
|
private final ContractOrderRepository contractOrderRepository;
|
|
|
+ private final ModelRepository modelRepository;
|
|
|
+ private final OrderFileRepository orderFileRepository;
|
|
|
private final BankMapper bankMapper;
|
|
|
private final SysUserMapper sysUserMapper;
|
|
|
private final NotaryOfficeMapper notaryOfficeMapper;
|
|
|
@@ -36,6 +36,58 @@ public class ModelSynthesizerDomain {
|
|
|
private final ApplicationContextUtil contextUtil;
|
|
|
|
|
|
/**
|
|
|
+ * 生成普通公证文书
|
|
|
+ *
|
|
|
+ * @param userId
|
|
|
+ * @param businessNo
|
|
|
+ */
|
|
|
+ public void generateCommonDoc(String userId, String businessNo) {
|
|
|
+ ContractOrderEntity contractOrderEntity = contractOrderRepository.getContractOrderWithBizNo(businessNo);
|
|
|
+ List<ModelEntity> models = modelRepository.getCommonModel(contractOrderEntity.getProdId(), contractOrderEntity.getContractType(), contractOrderEntity.getNotaryOfficeId());
|
|
|
+ // 在保存之前先删除数据
|
|
|
+ orderFileRepository.delFileWithBizNO(businessNo);
|
|
|
+ for (ModelEntity m : models) {
|
|
|
+ OrderFileEntity fileEntity = new OrderFileEntity();
|
|
|
+ fileEntity.setBusinessNo(businessNo);
|
|
|
+ fileEntity.setCode(m.getCode());
|
|
|
+ fileEntity.setSortNum(m.getSort());
|
|
|
+ String html = composeCommonTemplateWithData(businessNo, m.getContent(), "");
|
|
|
+ String htmlPath = FileUploadUtil.saveHtml(html, businessNo);
|
|
|
+ String pdfPath = FileUploadUtil.savePdf(html, businessNo);
|
|
|
+ fileEntity.setHtmlUrl(htmlPath);
|
|
|
+ fileEntity.setPdfUrl(pdfPath);
|
|
|
+ fileEntity.setCreateTime(new Date());
|
|
|
+ fileEntity.setCreatorId(Long.parseLong(userId));
|
|
|
+ fileEntity.setFileName(m.getTitle());
|
|
|
+ //
|
|
|
+ orderFileRepository.insert(fileEntity);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 重建普通公证文书
|
|
|
+ *
|
|
|
+ * @param businessNo
|
|
|
+ */
|
|
|
+ public void recreateCommonDoc(String businessNo) {
|
|
|
+ ContractOrderEntity contractOrderEntity = contractOrderRepository.getContractOrderWithBizNo(businessNo);
|
|
|
+ List<ModelEntity> models = modelRepository.getCommonModel(contractOrderEntity.getProdId(), contractOrderEntity.getContractType(), contractOrderEntity.getNotaryOfficeId());
|
|
|
+ for (ModelEntity m : models) {
|
|
|
+ OrderFileEntity fileEntity = orderFileRepository.getOrderFileWithCode(businessNo, m.getCode());
|
|
|
+ OrderFileEntity saveFile = new OrderFileEntity();
|
|
|
+ saveFile.setId(fileEntity.getId());
|
|
|
+ String html = composeCommonTemplateWithData(businessNo, m.getContent(), contextUtil.getCurrentUser().getNickName());
|
|
|
+ String htmlPath = FileUploadUtil.saveHtml(html, businessNo);
|
|
|
+ String pdfPath = FileUploadUtil.savePdf(html, businessNo);
|
|
|
+ saveFile.setHtmlUrl(htmlPath);
|
|
|
+ saveFile.setPdfUrl(pdfPath);
|
|
|
+ saveFile.setUpdateTime(new Date());
|
|
|
+ //
|
|
|
+ orderFileRepository.updateById(saveFile);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* 合成公证书预览模板
|
|
|
*
|
|
|
* @param contractOrderEntity
|