|
|
@@ -8,6 +8,7 @@ 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.UserAXQInfoRepository;
|
|
|
import me.zhengjie.dao.mybatis.entity.*;
|
|
|
import me.zhengjie.dao.mybatis.mapper.*;
|
|
|
import me.zhengjie.domain.order.OrderConstant;
|
|
|
@@ -34,6 +35,8 @@ public class ModelSynthesizerDomain {
|
|
|
private final CityMapper cityMapper;
|
|
|
private final ProvinceMapper provinceMapper;
|
|
|
private final ApplicationContextUtil contextUtil;
|
|
|
+ private final UserAXQInfoRepository userAXQInfoRepository;
|
|
|
+ private final FileInfoMapper fileInfoMapper;
|
|
|
|
|
|
/**
|
|
|
* 生成普通公证文书
|
|
|
@@ -51,7 +54,7 @@ public class ModelSynthesizerDomain {
|
|
|
fileEntity.setBusinessNo(businessNo);
|
|
|
fileEntity.setCode(m.getCode());
|
|
|
fileEntity.setSortNum(m.getSort());
|
|
|
- String html = composeCommonTemplateWithData(businessNo, m.getContent(), "");
|
|
|
+ String html = composeCommonTemplateWithData(businessNo, m.getContent(), "", false);
|
|
|
String htmlPath = FileUploadUtil.saveHtml(html, businessNo);
|
|
|
String pdfPath = FileUploadUtil.savePdf(html, businessNo);
|
|
|
fileEntity.setHtmlUrl(htmlPath);
|
|
|
@@ -76,7 +79,7 @@ public class ModelSynthesizerDomain {
|
|
|
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 html = composeCommonTemplateWithData(businessNo, m.getContent(), contextUtil.getCurrentUser().getNickName(), true);
|
|
|
String htmlPath = FileUploadUtil.saveHtml(html, businessNo);
|
|
|
String pdfPath = FileUploadUtil.savePdf(html, businessNo);
|
|
|
saveFile.setHtmlUrl(htmlPath);
|
|
|
@@ -424,8 +427,8 @@ public class ModelSynthesizerDomain {
|
|
|
* @param content
|
|
|
* @return
|
|
|
*/
|
|
|
- public String composeCommonTemplateWithData(String businessNo, String content, String userName) {
|
|
|
- String replaceContent = TextTempletUtil.replaceContent(content, prepareCommonTemplateData(businessNo, content, userName));
|
|
|
+ private String composeCommonTemplateWithData(String businessNo, String content, String userName, boolean hasSignImg) {
|
|
|
+ String replaceContent = TextTempletUtil.replaceContent(content, prepareCommonTemplateData(businessNo, userName, hasSignImg));
|
|
|
String result = "";
|
|
|
try {
|
|
|
InputStream inputStream = ModelSynthesizerDomain.class.getClassLoader().getResourceAsStream("template/note/notary-model.html");
|
|
|
@@ -440,11 +443,11 @@ public class ModelSynthesizerDomain {
|
|
|
* 准备通用模板替换数据
|
|
|
*
|
|
|
* @param businessNo
|
|
|
- * @param contractNo
|
|
|
* @param userName
|
|
|
+ * @param hasSignImg
|
|
|
* @return
|
|
|
*/
|
|
|
- private Map<String, String> prepareCommonTemplateData(String businessNo, String contractNo,String userName) {
|
|
|
+ private Map<String, String> prepareCommonTemplateData(String businessNo, String userName, boolean hasSignImg) {
|
|
|
ContractOrderEntity contractOrderEntity = contractOrderRepository.getContractOrderWithBizNo(businessNo);
|
|
|
//
|
|
|
Map<String, String> map = new HashMap<>();
|
|
|
@@ -490,6 +493,25 @@ public class ModelSynthesizerDomain {
|
|
|
map.put("$PBName$", user.getNickName());
|
|
|
map.put("$PBSex$", user.getGender());
|
|
|
map.put("$PBPhone$", user.getPhone());
|
|
|
+ //
|
|
|
+ if (hasSignImg) {
|
|
|
+ List<String> imgIdList = new ArrayList<>();
|
|
|
+ Map<String,String> imgTypeMap = new HashMap<>();
|
|
|
+ imgIdList.add(user.getSignImgId());
|
|
|
+ imgTypeMap.put(user.getSignImgId(),"customer");
|
|
|
+ //
|
|
|
+ String userSignImgId = String.valueOf(userAXQInfoRepository.getUserAXQInfoWithIdcard(contractOrderEntity.getIdCard()).getImgSealId());
|
|
|
+ imgIdList.add(userSignImgId);
|
|
|
+ imgTypeMap.put(userSignImgId, "user");
|
|
|
+ //
|
|
|
+ if (contractOrderEntity.getJointFlag() == OrderConstant.JOINT_FLAG_TRUE) {
|
|
|
+ userSignImgId = String.valueOf(userAXQInfoRepository.getUserAXQInfoWithIdcard(contractOrderEntity.getJointIdCard()).getImgSealId());
|
|
|
+ imgIdList.add(userSignImgId);
|
|
|
+ imgTypeMap.put(userSignImgId, "user");
|
|
|
+ }
|
|
|
+ List<FileInfoEntity> fileList = fileInfoMapper.selectBatchIds(imgIdList);
|
|
|
+ map.put("photograph", generateSignImgHtml(fileList, imgTypeMap));
|
|
|
+ }
|
|
|
// 准备公证处信息
|
|
|
NotaryOfficeEntity office = notaryOfficeMapper.selectById(contractOrderEntity.getNotaryOfficeId());
|
|
|
String[] areas = office.getAreaCodesStr().split(",");
|
|
|
@@ -513,6 +535,24 @@ public class ModelSynthesizerDomain {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * 生成签名图片html文本
|
|
|
+ *
|
|
|
+ * @param fileInfoList
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private String generateSignImgHtml(List<FileInfoEntity> fileInfoList, Map<String, String> imgTypeMap) {
|
|
|
+ String signImgHtml = "";
|
|
|
+ for (FileInfoEntity fileInfo : fileInfoList) {
|
|
|
+ if ("customer".equals(imgTypeMap.get(String.valueOf(fileInfo.getId())))) {
|
|
|
+ signImgHtml += "<img style=\"width: 160px;height: 60px;margin-right: 8px;\" title=\"客户经理签名\" src=\"" + FileUploadUtil.getPreviewUrl(fileInfo.getPath()) + "\"/>";
|
|
|
+ } else {
|
|
|
+ signImgHtml += "<img style=\"width: 80px;height: 40px;margin-right: 8px;\" title=\"当事人签名\" src=\"" + FileUploadUtil.getPreviewUrl(fileInfo.getPath()) + "\"/>";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return signImgHtml;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* 获取合同月份
|
|
|
*
|
|
|
* @param contractOrderEntity
|