Quellcode durchsuchen

Merge branch 'branch-nt-1.0.0' of https://git.flowbb.cn/RK-Dev/fqgz-server into branch-nt-1.0.0

everydatestudy vor 3 Jahren
Ursprung
Commit
a440b01c91

+ 40 - 0
eladmin-system/src/main/java/me/zhengjie/application/admin/controller/AdminNotarizationManageController.java

@@ -0,0 +1,40 @@
+package me.zhengjie.application.admin.controller;
+
+import lombok.RequiredArgsConstructor;
+import me.zhengjie.application.admin.service.AdminNotarizationManageService;
+import me.zhengjie.base.AppBaseResponse;
+import me.zhengjie.base.ResultCode;
+import me.zhengjie.domain.user.UserDomain;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+@RequiredArgsConstructor
+@RequestMapping("${fqgz.admin.web.url-prefix}/notarization-manage")
+public class AdminNotarizationManageController {
+    private final UserDomain userDomain;
+    private final AdminNotarizationManageService adminNotarizationManageService;
+
+    @GetMapping("/recreate-common-doc/{businessNo}")
+    public AppBaseResponse recreateCommonDoc(@PathVariable String businessNo) {
+        String maxRole = userDomain.getUserMaxRole();
+        if (!"超级管理员".equals(maxRole)) {
+            return AppBaseResponse.error(ResultCode.PERMISSION_UNAUTHORISE);
+        }
+        adminNotarizationManageService.recreateCommonDoc(businessNo);
+        return AppBaseResponse.success();
+    }
+
+
+    @GetMapping("/resign-common-doc/{businessNo}")
+    public AppBaseResponse resignCommonDoc(@PathVariable String businessNo) {
+        String maxRole = userDomain.getUserMaxRole();
+        if (!"超级管理员".equals(maxRole)) {
+            return AppBaseResponse.error(ResultCode.PERMISSION_UNAUTHORISE);
+        }
+        adminNotarizationManageService.resignCommonDoc(businessNo);
+        return AppBaseResponse.success();
+    }
+}

+ 7 - 0
eladmin-system/src/main/java/me/zhengjie/application/admin/service/AdminNotarizationManageService.java

@@ -0,0 +1,7 @@
+package me.zhengjie.application.admin.service;
+
+public interface AdminNotarizationManageService {
+    void recreateCommonDoc(String businessNo);
+
+    void resignCommonDoc(String businessNo);
+}

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

@@ -0,0 +1,80 @@
+package me.zhengjie.application.admin.service.impl;
+
+import cfca.trustsign.common.vo.cs.UploadSignInfoVO;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import lombok.RequiredArgsConstructor;
+import me.zhengjie.application.admin.service.AdminNotarizationManageService;
+import me.zhengjie.application.bank.service.UserAXQInfoService;
+import me.zhengjie.dao.mybatis.ContractOrderRepository;
+import me.zhengjie.dao.mybatis.UserAXQInfoRepository;
+import me.zhengjie.dao.mybatis.entity.ContractOrderEntity;
+import me.zhengjie.dao.mybatis.entity.SysUserEntity;
+import me.zhengjie.dao.mybatis.entity.UserAXQInfoEntity;
+import me.zhengjie.dao.mybatis.mapper.SysUserMapper;
+import me.zhengjie.domain.model.ModelSynthesizerDomain;
+import me.zhengjie.domain.order.OrderConstant;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@Service
+@RequiredArgsConstructor
+public class AdminNotarizationManageServiceImpl implements AdminNotarizationManageService {
+
+    private final ContractOrderRepository contractOrderRepository;
+    private final UserAXQInfoRepository userAXQInfoRepository;
+    private final UserAXQInfoService userAXQInfoService;
+    private final SysUserMapper userMapper;
+    private final ModelSynthesizerDomain modelSynthesizerDomain;
+
+    @Override
+    public void recreateCommonDoc(final String businessNo) {
+        ContractOrderEntity contractOrderEntity = contractOrderRepository.getContractOrderWithBizNo(businessNo);
+        JSONArray jsonArray = new JSONArray();
+        JSONObject userMain = new JSONObject();
+        userMain.put("imageId", userAXQInfoRepository.getUserAXQInfoWithIdcard(contractOrderEntity.getIdCard()).getImgSealId());
+        jsonArray.add(userMain);
+        //
+        if (contractOrderEntity.getJointFlag() == OrderConstant.JOINT_FLAG_TRUE) {
+            JSONObject userJoint = new JSONObject();
+            userJoint.put("imageId", userAXQInfoRepository.getUserAXQInfoWithIdcard(contractOrderEntity.getJointIdCard()).getImgSealId());
+            jsonArray.add(userJoint);
+        }
+        modelSynthesizerDomain.recreateCommonDoc(businessNo, jsonArray);
+    }
+
+    @Override
+    public void resignCommonDoc(final String businessNo) {
+        ContractOrderEntity contractOrderEntity = contractOrderRepository.getContractOrderWithBizNo(businessNo);
+        List<UploadSignInfoVO> signInfoList = new ArrayList<>();
+        List<String> idCardList = new ArrayList<>();
+        idCardList.add(contractOrderEntity.getIdCard());
+        if (contractOrderEntity.getJointFlag() == OrderConstant.JOINT_FLAG_TRUE) {
+            idCardList.add(contractOrderEntity.getJointIdCard());
+        }
+        for (String idCard : idCardList) {
+            UserAXQInfoEntity entity = userAXQInfoRepository.getUserAXQInfoWithIdcard(idCard);
+            UploadSignInfoVO notartyUser = new UploadSignInfoVO();
+            notartyUser.setUserId(entity.getAxqUserId());
+            notartyUser.setSealId(entity.getAxqSealId());
+            notartyUser.setLocation("210.74.41.0");
+            notartyUser.setAuthorizationTime("20220214171200");
+            signInfoList.add(notartyUser);
+        }
+        SysUserEntity customer = userMapper.selectById(contractOrderEntity.getCustomerId());
+        UploadSignInfoVO notartyUser = new UploadSignInfoVO();
+        notartyUser.setUserId(customer.getAxqUserId());
+        notartyUser.setSealId(customer.getAxqSealId());
+        notartyUser.setLocation("210.74.41.0");
+        notartyUser.setAuthorizationTime("20220214171200");
+        signInfoList.add(notartyUser);
+        //
+        try {
+            userAXQInfoService.signContract(signInfoList, businessNo);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+}

+ 5 - 0
eladmin-system/src/main/java/me/zhengjie/application/bank/service/UserAXQInfoService.java

@@ -1,8 +1,11 @@
 package me.zhengjie.application.bank.service;
 
+import cfca.trustsign.common.vo.cs.UploadSignInfoVO;
 import com.alibaba.fastjson.JSONArray;
 import me.zhengjie.base.ResponseDTO;
 
+import java.util.List;
+
 public interface UserAXQInfoService {
 
     ResponseDTO<?> registAXQUser(String idCard, String phone, String name);
@@ -14,4 +17,6 @@ public interface UserAXQInfoService {
     ResponseDTO<?> verifyAuthMessage(String idCard, String checkCode);
 
     ResponseDTO<?> getAuthStatus(String idCard);
+
+    void signContract(List<UploadSignInfoVO> signInfoList, String businessNo) throws Exception;
 }

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

@@ -104,7 +104,7 @@ public class UserAXQInfoServiceImpl implements UserAXQInfoService {
 				signInfoList.add(notartyUser);
 			}
 			// 重新生成模板
-			modelSynthesizerDomain.recreateCommonDoc(businessNo);
+			modelSynthesizerDomain.recreateCommonDoc(businessNo, jsonArray);
 			// 客户经理签名信息
 			ContractOrderEntity order = contractOrderRepository.getContractOrderWithBizNo(businessNo);
 			SysUserEntity customer = sysUserMapper.selectById(order.getCustomerId());
@@ -166,7 +166,8 @@ public class UserAXQInfoServiceImpl implements UserAXQInfoService {
 	 * @param businessNo
 	 * @throws Exception
 	 */
-	private void signContract(List<UploadSignInfoVO> signInfoList, String businessNo) throws Exception {
+	@Override
+	public void signContract(List<UploadSignInfoVO> signInfoList, String businessNo) throws Exception {
 		String[] codes = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
 		List<OrderFileEntity> orderFileList = orderFileRepository.getOrderFileListWithCodes(businessNo, codes);
 		// 取出所有的二进制流

+ 23 - 24
eladmin-system/src/main/java/me/zhengjie/domain/model/ModelSynthesizerDomain.java

@@ -1,5 +1,7 @@
 package me.zhengjie.domain.model;
 
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import lombok.RequiredArgsConstructor;
 import me.zhengjie.application.admin.controller.vo.NotaryNoteDto;
@@ -8,7 +10,6 @@ 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;
@@ -35,7 +36,6 @@ public class ModelSynthesizerDomain {
     private final CityMapper cityMapper;
     private final ProvinceMapper provinceMapper;
     private final ApplicationContextUtil contextUtil;
-    private final UserAXQInfoRepository userAXQInfoRepository;
     private final FileInfoMapper fileInfoMapper;
 
     /**
@@ -54,7 +54,7 @@ public class ModelSynthesizerDomain {
             fileEntity.setBusinessNo(businessNo);
             fileEntity.setCode(m.getCode());
             fileEntity.setSortNum(m.getSort());
-            String html = composeCommonTemplateWithData(businessNo, m.getContent(), "", false);
+            String html = composeCommonTemplateWithData(businessNo, m.getContent(), "", false, null);
             String htmlPath = FileUploadUtil.saveHtml(html, businessNo);
             String pdfPath = FileUploadUtil.savePdf(html, businessNo);
             fileEntity.setHtmlUrl(htmlPath);
@@ -71,8 +71,9 @@ public class ModelSynthesizerDomain {
      * 重建普通公证文书
      *
      * @param businessNo
+     * @param signUser
      */
-    public void recreateCommonDoc(String businessNo) {
+    public void recreateCommonDoc(String businessNo, JSONArray signUser) {
         ContractOrderEntity contractOrderEntity = contractOrderRepository.getContractOrderWithBizNo(businessNo);
         SysUserEntity notaryUser = sysUserMapper.selectById(contractOrderEntity.getNotaryUserId());
         List<ModelEntity> models = modelRepository.getCommonModel(contractOrderEntity.getProdId(), contractOrderEntity.getContractType(), contractOrderEntity.getNotaryOfficeId());
@@ -80,7 +81,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(), notaryUser.getNickName(), true);
+            String html = composeCommonTemplateWithData(businessNo, m.getContent(), notaryUser.getNickName(), true, signUser);
             String htmlPath = FileUploadUtil.saveHtml(html, businessNo);
             String pdfPath = FileUploadUtil.savePdf(html, businessNo);
             saveFile.setHtmlUrl(htmlPath);
@@ -251,7 +252,7 @@ public class ModelSynthesizerDomain {
     private String composeNotePartyList(String businessNo) {
         ContractOrderEntity order = contractOrderRepository.getContractOrderWithBizNo(businessNo);
         BankEntity bank = bankMapper.selectById(order.getBankId());
-        String lender = "贷款人:" + bank.getBankName() + ",所:" + bank.getAddress() + ",负责人:" + bank.getPrincipal() + "<br/><br/>";
+        String lender = "贷款人:" + bank.getBankName() + ",营业场所:" + bank.getAddress() + ",负责人:" + bank.getPrincipal() + "<br/><br/>";
         String template = "$Title$:$Name$,$Sex$,$Birth$出生,公民身份证号码:$IdCard$,联系电话:$Phone$<br/><br/>";
         List<Map<String, String>> userList = prepareNotePartyTemplateData(order);
         String users = lender;
@@ -428,8 +429,8 @@ public class ModelSynthesizerDomain {
      * @param content
      * @return
      */
-    private String composeCommonTemplateWithData(String businessNo, String content, String userName, boolean hasSignImg) {
-        String replaceContent = TextTempletUtil.replaceContent(content, prepareCommonTemplateData(businessNo, userName, hasSignImg));
+    private String composeCommonTemplateWithData(String businessNo, String content, String userName, boolean hasSignImg, JSONArray signUser) {
+        String replaceContent = TextTempletUtil.replaceContent(content, prepareCommonTemplateData(businessNo, userName, hasSignImg, signUser));
         String result = "";
         try {
             InputStream inputStream = ModelSynthesizerDomain.class.getClassLoader().getResourceAsStream("template/note/notary-model.html");
@@ -448,7 +449,7 @@ public class ModelSynthesizerDomain {
      * @param hasSignImg
      * @return
      */
-    private Map<String, String> prepareCommonTemplateData(String businessNo, String userName, boolean hasSignImg) {
+    private Map<String, String> prepareCommonTemplateData(String businessNo, String userName, boolean hasSignImg, JSONArray signUser) {
         ContractOrderEntity contractOrderEntity = contractOrderRepository.getContractOrderWithBizNo(businessNo);
         //
         Map<String, String> map = new HashMap<>();
@@ -496,21 +497,19 @@ public class ModelSynthesizerDomain {
         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");
+            List<FileInfoEntity> fileList = new ArrayList<>();
+            Map<String, String> imgTypeMap = new HashMap<>();
             //
-            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");
+            for (Object object : signUser) {
+                JSONObject jsonObject = (JSONObject) object;
+                String imageId = jsonObject.getString("imageId");
+                FileInfoEntity fileInfo = fileInfoMapper.selectById(imageId);
+                fileList.add(fileInfo);
+                imgTypeMap.put(imageId, "user");
             }
-            List<FileInfoEntity> fileList = fileInfoMapper.selectBatchIds(imgIdList);
+            //
+            fileList.add(fileInfoMapper.selectById(user.getSignImgId()));
+            imgTypeMap.put(user.getSignImgId(), "customer");
             map.put("photograph", generateSignImgHtml(fileList, imgTypeMap));
         }
         // 准备公证处信息
@@ -545,9 +544,9 @@ public class ModelSynthesizerDomain {
         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()) + "\"/>";
+                signImgHtml += "<img style=\"width: 48px;height: 30px;margin-right: 8px;position:relative;top:5px;\" title=\"客户经理签名\" src=\"" + FileUploadUtil.getPreviewUrl(fileInfo.getPath()) + "\"/>";
             } else {
-                signImgHtml += "<img style=\"width: 80px;height: 40px;margin-right: 8px;\" title=\"当事人签名\" src=\"" + FileUploadUtil.getPreviewUrl(fileInfo.getPath()) + "\"/>";
+                signImgHtml += "<img style=\"width: 48px;height: 30px;margin-right: 8px;position:relative;top:5px;\" title=\"当事人签名\" src=\"" + FileUploadUtil.getPreviewUrl(fileInfo.getPath()) + "\"/>";
             }
         }
         return signImgHtml;