Pārlūkot izejas kodu

普通公证文书签名图片

sakuya 3 gadi atpakaļ
vecāks
revīzija
d69208f87a

+ 0 - 1
eladmin-system/src/main/java/me/zhengjie/application/admin/service/impl/NotaryNoteServiceImpl.java

@@ -104,7 +104,6 @@ public class NotaryNoteServiceImpl implements NotaryNoteService {
 			orderFileMapper.updateById(orderFile);
 		}
 		saveNotaryUserId(notary.getBusinessNo());
-		modelSynthesizerDomain.recreateCommonDoc(notary.getBusinessNo());
 		return response;
 	}
 

+ 18 - 15
eladmin-system/src/main/java/me/zhengjie/application/bank/service/impl/UserAXQInfoServiceImpl.java

@@ -6,23 +6,22 @@ import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import lombok.RequiredArgsConstructor;
-import me.zhengjie.base.util.ApplicationContextUtil;
-import me.zhengjie.dao.mybatis.ContractOrderRepository;
-import me.zhengjie.dao.mybatis.UserAXQInfoRepository;
-import me.zhengjie.dao.mybatis.entity.*;
-import me.zhengjie.dao.mybatis.mapper.FileInfoMapper;
-import me.zhengjie.dao.mybatis.mapper.SysUserMapper;
-import me.zhengjie.dao.mybatis.mapper.UserAXQInfoMapper;
 import me.zhengjie.application.bank.service.UserAXQInfoService;
-import me.zhengjie.base.util.FileUploadUtil;
 import me.zhengjie.base.ResponseDTO;
 import me.zhengjie.base.ResultCode;
 import me.zhengjie.base.pdf.PdfUtils;
+import me.zhengjie.base.util.CFCACertUtil;
+import me.zhengjie.base.util.FileUploadUtil;
+import me.zhengjie.dao.mybatis.ContractOrderRepository;
 import me.zhengjie.dao.mybatis.OrderFileRepository;
+import me.zhengjie.dao.mybatis.UserAXQInfoRepository;
+import me.zhengjie.dao.mybatis.entity.*;
+import me.zhengjie.dao.mybatis.mapper.FileInfoMapper;
 import me.zhengjie.dao.mybatis.mapper.OrderFileMapper;
-import me.zhengjie.base.util.CFCACertUtil;
+import me.zhengjie.dao.mybatis.mapper.SysUserMapper;
+import me.zhengjie.dao.mybatis.mapper.UserAXQInfoMapper;
+import me.zhengjie.domain.model.ModelSynthesizerDomain;
 import me.zhengjie.utils.StringUtils;
-import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 
 import java.io.ByteArrayInputStream;
@@ -46,6 +45,7 @@ public class UserAXQInfoServiceImpl implements UserAXQInfoService {
 	private final ContractOrderRepository contractOrderRepository;
 	private final SysUserMapper sysUserMapper;
 	private final CFCACertUtil cfcaCertUtil;
+	private final ModelSynthesizerDomain modelSynthesizerDomain;
 
 	@Override
 	public ResponseDTO<?> registAXQUser(String idCard, String phone, String name) {
@@ -80,19 +80,20 @@ public class UserAXQInfoServiceImpl implements UserAXQInfoService {
 				String idCard = jsonObject.getString("idCard");
 				String imageId = jsonObject.getString("imageId");
 				//
+				UserAXQInfoEntity entity = userAXQInfoRepository.getUserAXQInfoWithIdcard(idCard);
 				FileInfoEntity fileInfo = fileInfoMapper.selectById(imageId);
 				String content = inputStream2Base64(FileUploadUtil.getInputStream(fileInfo.getPath()));
-				UserAXQInfoEntity entity = userAXQInfoRepository.getUserAXQInfoWithIdcard(idCard);
+				UserAXQInfoEntity saveEntity = new UserAXQInfoEntity();
 				if (!StringUtils.isEmpty(entity.getAxqSealId())) {
 					cfcaCertUtil.updateSealWithContent(entity.getAxqUserId(), entity.getAxqSealId(), content);
 				} else {
 					String sealId = cfcaCertUtil.addSealWithContent(entity.getAxqUserId(), content);
 					entity.setAxqSealId(sealId);
-					UserAXQInfoEntity updateEntity = new UserAXQInfoEntity();
-					updateEntity.setId(entity.getId());
-					updateEntity.setAxqSealId(sealId);
-					userAXQInfoMapper.updateById(updateEntity);
+					saveEntity.setAxqSealId(sealId);
 				}
+				saveEntity.setId(entity.getId());
+				saveEntity.setImgSealId(Integer.parseInt(imageId));
+				userAXQInfoRepository.updateById(saveEntity);
 				// 签名用户信息
 				UploadSignInfoVO notartyUser = new UploadSignInfoVO();
 				notartyUser.setUserId(entity.getAxqUserId());
@@ -102,6 +103,8 @@ public class UserAXQInfoServiceImpl implements UserAXQInfoService {
 				//
 				signInfoList.add(notartyUser);
 			}
+			// 重新生成模板
+			modelSynthesizerDomain.recreateCommonDoc(businessNo);
 			// 客户经理签名信息
 			ContractOrderEntity order = contractOrderRepository.getContractOrderWithBizNo(businessNo);
 			SysUserEntity customer = sysUserMapper.selectById(order.getCustomerId());

+ 9 - 0
eladmin-system/src/main/java/me/zhengjie/dao/mybatis/UserAXQInfoRepository.java

@@ -23,4 +23,13 @@ public class UserAXQInfoRepository {
         qw.eq("user_status", "1");
         return userAXQInfoMapper.selectOne(qw);
     }
+
+    /**
+     * 根据ID更新信息
+     *
+     * @param userAXQInfo
+     */
+    public void updateById(UserAXQInfoEntity userAXQInfo) {
+        userAXQInfoMapper.updateById(userAXQInfo);
+    }
 }

+ 3 - 0
eladmin-system/src/main/java/me/zhengjie/dao/mybatis/entity/UserAXQInfoEntity.java

@@ -42,4 +42,7 @@ public class UserAXQInfoEntity implements Serializable {
 
     @TableField("create_time")
     private Date createTime;
+
+    @TableField("img_seal_id")
+    private Integer imgSealId;
 }

+ 46 - 6
eladmin-system/src/main/java/me/zhengjie/domain/model/ModelSynthesizerDomain.java

@@ -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