Procházet zdrojové kódy

公证员可对公证书内容编辑修改
购车合同增加抵押物字段
咨询受理号生成规则调整

sakuya před 3 roky
rodič
revize
bd23b8ebcc

+ 5 - 0
eladmin-system/src/main/java/me/zhengjie/application/admin/controller/AdminOrderController.java

@@ -187,6 +187,11 @@ public class AdminOrderController {
 		return adminOrderService.previewNotarization(req);
 	}
 
+	@RequestMapping("/saveContent")
+	public AppBaseResponse saveContent(@RequestBody NotaryOrderQueryReq req) {
+		return adminOrderService.saveContent(req);
+	}
+
 	@AnonymousPostMapping("/bankCustomer")
 	public AppBaseResponse bankCustomer(@RequestBody NotaryOrderQueryReq req) {
 		return adminOrderService.bankCustomer(req);

+ 2 - 0
eladmin-system/src/main/java/me/zhengjie/application/admin/controller/vo/NotaryOrderQueryRsp.java

@@ -50,6 +50,8 @@ public class NotaryOrderQueryRsp {
 	private String returnReason;
 	// 驳回原因
 	private String rejectReason;
+	// 受理咨询号
+	private String consultNo;
 	// 创建时间
 	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
 	private LocalDateTime createTime;

+ 11 - 0
eladmin-system/src/main/java/me/zhengjie/application/admin/controller/vo/OrderDetailDto.java

@@ -157,4 +157,15 @@ public class OrderDetailDto {
 	private String authNote;
 	private String notaryUserName;
 	private Integer notaryFee;
+
+	// 品牌型号
+	private String brandModel;
+	// 颜色
+	private String color;
+	// 所有权权属
+	private String ownership;
+	// 买价
+	private String buyingPrice;
+	// 受理咨询号
+	private String consultNo;
 }

+ 2 - 0
eladmin-system/src/main/java/me/zhengjie/application/admin/service/AdminOrderService.java

@@ -51,6 +51,8 @@ public interface AdminOrderService {
 
     AppBaseResponse<String> previewNotarization(NotaryOrderQueryReq req);
 
+    AppBaseResponse saveContent(NotaryOrderQueryReq req);
+
     AppBaseResponse<?> bankCustomer(NotaryOrderQueryReq req);
 
     AppBaseResponse uploadNotarization(FileVo file);

+ 45 - 22
eladmin-system/src/main/java/me/zhengjie/application/admin/service/impl/AdminOrderServiceImpl.java

@@ -9,6 +9,7 @@ import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
 
+import me.zhengjie.dao.mybatis.entity.*;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -45,18 +46,6 @@ import me.zhengjie.base.util.StatusEnum;
 import me.zhengjie.dao.mybatis.ContractOrderRepository;
 import me.zhengjie.dao.mybatis.ModelRepository;
 import me.zhengjie.dao.mybatis.OrderFileRepository;
-import me.zhengjie.dao.mybatis.entity.BankEntity;
-import me.zhengjie.dao.mybatis.entity.BorrowerEntity;
-import me.zhengjie.dao.mybatis.entity.ContractOrderEntity;
-import me.zhengjie.dao.mybatis.entity.FileInfoEntity;
-import me.zhengjie.dao.mybatis.entity.GuaranteeEntity;
-import me.zhengjie.dao.mybatis.entity.ModelEntity;
-import me.zhengjie.dao.mybatis.entity.MortgageEntity;
-import me.zhengjie.dao.mybatis.entity.NotarizationNoEntity;
-import me.zhengjie.dao.mybatis.entity.OrderCochainEntity;
-import me.zhengjie.dao.mybatis.entity.OrderFileEntity;
-import me.zhengjie.dao.mybatis.entity.SysUserEntity;
-import me.zhengjie.dao.mybatis.entity.User;
 import me.zhengjie.dao.mybatis.mapper.BankMapper;
 import me.zhengjie.dao.mybatis.mapper.BorrowerMapper;
 import me.zhengjie.dao.mybatis.mapper.CityMapper;
@@ -387,17 +376,16 @@ public class AdminOrderServiceImpl implements AdminOrderService {
 		String htmlPath = FileUploadUtil.saveHtml(content, contractOrderEntity.getBusinessNo());
 		String pdfPath = FileUploadUtil.savePdf(content, contractOrderEntity.getBusinessNo());
 		//
-		OrderFileEntity notaryOrderFile = new OrderFileEntity();
-		notaryOrderFile.setBusinessNo(contractOrderEntity.getBusinessNo());
-		notaryOrderFile.setCode(ModelConstant.MODEL_TYPE_NOTARIZATION);
+		OrderFileEntity notaryOrderFile = orderFileRepository.getOrderNotarization(contractOrderEntity.getBusinessNo());
+		notaryOrderFile.setContent(req.getContent());
 		notaryOrderFile.setDocNo(String.valueOf(currentNum));
 		notaryOrderFile.setHtmlUrl(htmlPath);
 		notaryOrderFile.setPdfUrl(pdfPath);
 		notaryOrderFile.setSortNum(modelEntity.getSort());
-		notaryOrderFile.setCreateTime(new Date());
-		notaryOrderFile.setCreatorId(contextUtil.getCurrentUserId());
 		notaryOrderFile.setFileName(modelEntity.getTitle());
-		orderFileMapper.insert(notaryOrderFile);
+		notaryOrderFile.setUpdateTime(new Date());
+		notaryOrderFile.setUpdaterId(contextUtil.getCurrentUserId());
+		orderFileMapper.updateById(notaryOrderFile);
 		// 更新当前公证书编号
 		NotarizationNoEntity notarizationNo = new NotarizationNoEntity();
 		notarizationNo.setId(notarizationNoEntity.getId());
@@ -441,14 +429,40 @@ public class AdminOrderServiceImpl implements AdminOrderService {
 	@Override
 	public AppBaseResponse<String> previewNotarization(NotaryOrderQueryReq req) {
 		AppBaseResponse<String> response = new AppBaseResponse<>();
-		ContractOrderEntity order = contractOrderRepository.getContractOrderWithBizNo(req.getBusinessNo());
-		ModelEntity model = modelRepository.getModelEntity(order.getProdId(), order.getContractType(),
-				order.getNotaryOfficeId(), ModelConstant.MODEL_TYPE_NOTARIZATION, "1");
-		String previewContent = modelSynthesizerDomain.composeNotarizationPreview(order, model.getContent());
+		String previewContent = "";
+		OrderFileEntity curOrderFile = orderFileRepository.getOrderNotarization(req.getBusinessNo());
+		if (curOrderFile != null && !StringUtils.isEmpty(curOrderFile.getContent())) {
+			previewContent = curOrderFile.getContent();
+		} else {
+			ContractOrderEntity order = contractOrderRepository.getContractOrderWithBizNo(req.getBusinessNo());
+			ModelEntity model = modelRepository.getModelEntity(order.getProdId(), order.getContractType(),
+					order.getNotaryOfficeId(), ModelConstant.MODEL_TYPE_NOTARIZATION, "1");
+			previewContent = modelSynthesizerDomain.composeNotarizationPreview(order, model.getContent());
+		}
 		response.setData(new AppResultData<String>(previewContent));
 		return response;
 	}
 
+	@Override
+	public AppBaseResponse saveContent(NotaryOrderQueryReq req) {
+		OrderFileEntity curOrderFile = orderFileRepository.getOrderNotarization(req.getBusinessNo());
+		OrderFileEntity saveOrderFile = new OrderFileEntity();
+		saveOrderFile.setContent(req.getContent());
+		if (curOrderFile == null) {
+			saveOrderFile.setBusinessNo(req.getBusinessNo());
+			saveOrderFile.setCode(ModelConstant.MODEL_TYPE_NOTARIZATION);
+			saveOrderFile.setCreateTime(new Date());
+			saveOrderFile.setCreatorId(contextUtil.getCurrentUserId());
+			orderFileMapper.insert(saveOrderFile);
+		} else {
+			saveOrderFile.setId(curOrderFile.getId());
+			saveOrderFile.setUpdateTime(new Date());
+			saveOrderFile.setUpdaterId(contextUtil.getCurrentUserId());
+			orderFileMapper.updateById(saveOrderFile);
+		}
+		return AppBaseResponse.success();
+	}
+
 	/**
 	 * 查询银行客户经理
 	 *
@@ -554,6 +568,15 @@ public class AdminOrderServiceImpl implements AdminOrderService {
 		QueryWrapper<ContractOrderEntity> queryWrapper = QueryWrapperUtil.convertQuery(order);
 		order = contractOrderMapper.selectOne(queryWrapper);
 		OrderDetailDto orderDetail = BeanCopyUtils.convertObj(order, OrderDetailDto.class);
+		if (OrderConstant.PROD_ID_CD.equals(order.getProdId())) {
+			CollateralInfoEntity collateralInfo = contractOrderRepository.getCollateralWithBizNo(businessNo);
+			if (collateralInfo != null) {
+				orderDetail.setBrandModel(collateralInfo.getBrandModel());
+				orderDetail.setColor(collateralInfo.getColor());
+				orderDetail.setOwnership(collateralInfo.getOwnership());
+				orderDetail.setBuyingPrice(collateralInfo.getBuyingPrice());
+			}
+		}
 		// 将所有图片查询出来
 		// 取出所有的图片
 		List<FileInfoEntity> fileInfo = getFileInfo(orderDetail);

+ 8 - 0
eladmin-system/src/main/java/me/zhengjie/application/bank/controller/vo/BankOrderVO.java

@@ -128,4 +128,12 @@ public class BankOrderVO {
     private Map<String,String> fileUrlMap;
     // 公证流程标记
     private String notarizedFlag;
+    // 品牌型号
+    private String brandModel;
+    // 颜色
+    private String color;
+    // 所有权权属
+    private String ownership;
+    // 买价
+    private String buyingPrice;
 }

+ 218 - 162
eladmin-system/src/main/java/me/zhengjie/application/bank/service/impl/BankOrderServiceImpl.java

@@ -2,6 +2,7 @@ package me.zhengjie.application.bank.service.impl;
 
 import com.alibaba.fastjson.JSONObject;
 import lombok.RequiredArgsConstructor;
+import lombok.Synchronized;
 import lombok.extern.slf4j.Slf4j;
 import me.zhengjie.application.bank.controller.vo.BankOrderVO;
 import me.zhengjie.application.bank.mq.RedisReceiver;
@@ -26,6 +27,7 @@ import org.springframework.data.redis.core.RedisTemplate;
 import org.springframework.stereotype.Service;
 import org.springframework.web.multipart.MultipartFile;
 
+import java.text.SimpleDateFormat;
 import java.util.*;
 import java.util.stream.Collectors;
 
@@ -41,175 +43,229 @@ import java.util.stream.Collectors;
 @Slf4j
 @RequiredArgsConstructor
 public class BankOrderServiceImpl implements BankOrderService {
-	private final RedisTemplate<String, String> redisTemplate;
-	private final RedisReceiver redisReceiver;
-	private final OrderOCRParserFactory orderOCRParserFactory;
-	private final FileInfoMapper fileInfoMapper;
-	private final NotaryOfficeMapper notaryOfficeMapper;
-	private final BankMapper bankMapper;
-	private final ModelRepository modelRepository;
-	private final ContractOrderRepository contractOrderRepository;
-	private final SysUserRepository sysUserRepository;
-	private final OfficeXbankRepository officeXbankRepository;
-	private final OrderFileRepository orderFileRepository;
+    private final RedisTemplate<String, String> redisTemplate;
+    private final RedisReceiver redisReceiver;
+    private final OrderOCRParserFactory orderOCRParserFactory;
+    private final FileInfoMapper fileInfoMapper;
+    private final NotaryOfficeMapper notaryOfficeMapper;
+    private final BankMapper bankMapper;
+    private final ModelRepository modelRepository;
+    private final ContractOrderRepository contractOrderRepository;
+    private final SysUserRepository sysUserRepository;
+    private final OfficeXbankRepository officeXbankRepository;
+    private final OrderFileRepository orderFileRepository;
 
-	@Override
-	public void saveContractOrder(BankOrderVO vo, SysUserEntity userEntity) {
-		BankEntity bank = bankMapper.selectById(userEntity.getOrgId().split("_")[1]);
-		OfficeXbankEntity officeXbank = officeXbankRepository.getEntityWithBankId(bank.getId());
-		NotaryOfficeEntity notaryOfficeEntity = notaryOfficeMapper.selectById(officeXbank.getNotaryOfficeId());
-		// 保存或修改借款人信息
-		ContractOrderEntity saveOrder = BeanCopyUtils.convertObj(vo, ContractOrderEntity.class);
-		saveOrder.setStartDate(DateFormatUtils.defaultFormat(vo.getStartDate()));
-		saveOrder.setEndDate(DateFormatUtils.defaultFormat(vo.getEndDate()));
-		saveOrder.setCustomerId(String.valueOf(userEntity.getUserId()));
-		saveOrder.setCustomerName(userEntity.getNickName());
-		saveOrder.setBankId(String.valueOf(bank.getId()));
-		saveOrder.setBankName(bank.getBankName());
-		saveOrder.setNotaryOfficeId(officeXbank.getNotaryOfficeId());
-		saveOrder.setAutoGenerate(notaryOfficeEntity.getAutoGenerate());
-		saveOrder.setStatus(OrderConstant.ORDER_STATUS_UNSUBMIT);
-		ContractOrderEntity curOrder = contractOrderRepository.getContractOrderWithBizNo(vo.getBusinessNo());
-		if (curOrder == null) {
-			saveOrder.setId(Long.valueOf("10" + new Date().getTime()));
-			saveOrder.setCreator(String.valueOf(userEntity.getUserId()));
-			saveOrder.setCreateTime(new Date());
-			contractOrderRepository.insert(saveOrder);
-		} else {
-			saveOrder.setId(curOrder.getId());
-			contractOrderRepository.updateWithId(saveOrder);
-		}
-	}
+    @Override
+    public void saveContractOrder(BankOrderVO vo, SysUserEntity userEntity) {
+        BankEntity bank = bankMapper.selectById(userEntity.getOrgId().split("_")[1]);
+        OfficeXbankEntity officeXbank = officeXbankRepository.getEntityWithBankId(bank.getId());
+        NotaryOfficeEntity notaryOfficeEntity = notaryOfficeMapper.selectById(officeXbank.getNotaryOfficeId());
+        // 保存或修改借款人信息
+        ContractOrderEntity saveOrder = BeanCopyUtils.convertObj(vo, ContractOrderEntity.class);
+        saveOrder.setStartDate(DateFormatUtils.defaultFormat(vo.getStartDate()));
+        saveOrder.setEndDate(DateFormatUtils.defaultFormat(vo.getEndDate()));
+        saveOrder.setCustomerId(String.valueOf(userEntity.getUserId()));
+        saveOrder.setCustomerName(userEntity.getNickName());
+        saveOrder.setBankId(String.valueOf(bank.getId()));
+        saveOrder.setBankName(bank.getBankName());
+        saveOrder.setNotaryOfficeId(officeXbank.getNotaryOfficeId());
+        saveOrder.setAutoGenerate(notaryOfficeEntity.getAutoGenerate());
+        saveOrder.setStatus(OrderConstant.ORDER_STATUS_UNSUBMIT);
+        ContractOrderEntity curOrder = contractOrderRepository.getContractOrderWithBizNo(vo.getBusinessNo());
+        if (curOrder == null) {
+            saveOrder.setId(Long.valueOf("10" + new Date().getTime()));
+            saveOrder.setConsultNo(generateConsultNo(String.valueOf(notaryOfficeEntity.getId())));
+            saveOrder.setCreator(String.valueOf(userEntity.getUserId()));
+            saveOrder.setCreateTime(new Date());
+            contractOrderRepository.insert(saveOrder);
+        } else {
+            saveOrder.setId(curOrder.getId());
+            contractOrderRepository.updateWithId(saveOrder);
+        }
+        if (OrderConstant.PROD_ID_CD.equals(vo.getProdId()) && !isCollateralInfoEmpty(vo)) {
+            CollateralInfoEntity curCollateralInfo = contractOrderRepository.getCollateralWithBizNo(vo.getBusinessNo());
+            CollateralInfoEntity saveCollateralInfo = new CollateralInfoEntity();
+            saveCollateralInfo.setBrandModel(vo.getBrandModel());
+            saveCollateralInfo.setColor(vo.getColor());
+            saveCollateralInfo.setOwnership(vo.getOwnership());
+            saveCollateralInfo.setBuyingPrice(vo.getBuyingPrice());
+            if (curCollateralInfo == null) {
+                saveCollateralInfo.setBusinessNo(vo.getBusinessNo());
+                saveCollateralInfo.setCreateTime(new Date());
+                contractOrderRepository.insertCollateral(saveCollateralInfo);
+            } else {
+                saveCollateralInfo.setId(curCollateralInfo.getId());
+                saveCollateralInfo.setUpdateTime(new Date());
+                contractOrderRepository.updateCollateralById(saveCollateralInfo);
+            }
+        }
+    }
 
-	@Override
-	public List<BankOrderVO> getContractOrderList(String contractNo, String phone, String status, Long index, Long size) {
-		SysUserEntity user = sysUserRepository.getUserWithPhone(phone);
-		List<BankOrderVO> volist = new ArrayList<>();
-		if (user != null) {
-			List<ContractOrderEntity> entiryList = contractOrderRepository.searchOrderWithContractNo(String.valueOf(user.getUserId()), status, contractNo, index, size);
-			volist = BeanCopyUtils.convertList2List(entiryList, BankOrderVO.class);
-		}
-		List<String> bizNoList = volist.stream().map(BankOrderVO::getBusinessNo).collect(Collectors.toList());
-		if (bizNoList != null && bizNoList.size() > 0) {
-			Set<String> set = new HashSet<>();
-			List<OrderFileEntity> fileList = orderFileRepository.getOrderNoteList(bizNoList);
-			if (fileList != null && fileList.size() > 0) {
-				set = fileList.stream().map(OrderFileEntity::getBusinessNo).collect(Collectors.toSet());
-			}
-			for (BankOrderVO order : volist) {
-				order.setNotarizedFlag(set.contains(order.getBusinessNo()) ? "1" : "0");
-			}
-		}
-		return volist;
-	}
+    @Synchronized
+    private String generateConsultNo(String notaryOfficeId) {
+        String consultNo = "";
+        SimpleDateFormat dateSrcFormatter = new SimpleDateFormat("yyyyMMdd");
+        String datePrefix = dateSrcFormatter.format(new Date());
+        ContractOrderEntity order = contractOrderRepository.getTodayMaxConsultNoEntity(notaryOfficeId, datePrefix);
+        if (order == null) {
+            consultNo = datePrefix + "0001";
+        } else {
+            String seqNum = String.valueOf(Integer.parseInt(order.getConsultNo().substring(8)) + 1);
+            seqNum = "0000".substring(seqNum.length()) + seqNum;
+            consultNo = datePrefix + seqNum;
+        }
+        return consultNo;
+    }
 
-	@Override
-	public BankOrderVO getContractOrderWithBizNo(String businessNo) {
-		ContractOrderEntity orderEntity = contractOrderRepository.getContractOrderWithBizNo(businessNo);
-		BankOrderVO orderVo = BeanCopyUtils.convertObj(orderEntity, BankOrderVO.class);
-		orderVo.setFileUrlMap(getFileInfo(orderEntity));
-		return orderVo;
-	}
+    /**
+     * 抵押物信息是否为空
+     *
+     * @param vo
+     * @return
+     */
+    private boolean isCollateralInfoEmpty(BankOrderVO vo) {
+        return StringUtils.isEmpty(vo.getBrandModel()) && StringUtils.isEmpty(vo.getColor()) && StringUtils.isEmpty(vo.getOwnership()) && StringUtils.isEmpty(vo.getBuyingPrice());
+    }
 
-	@Override
-	public ResponseDTO<String> submitContractOrder(String businessNo, SysUserEntity currentUser) {
-		ContractOrderEntity contractOrderEntity = contractOrderRepository.getContractOrderWithBizNo(businessNo);
-		if (modelRepository.existModelInEditing(contractOrderEntity.getProdId(), contractOrderEntity.getContractType(), contractOrderEntity.getNotaryOfficeId(), ModelConstant.MODEL_TYPE_COMMON_LIST)) {
-			return new ResponseDTO<>(OrderBizCodeMessage.MODEL_IN_EDITING.getCode(), OrderBizCodeMessage.MODEL_IN_EDITING.getMessage());
-		}
-		updateStatus(businessNo, OrderConstant.ORDER_STATUS_UNCHECKED, "");
-		// 推送创建订单文档任务消息
-		JSONObject jsonObject = new JSONObject();
-		jsonObject.put("businessNo", businessNo);
-		jsonObject.put("userId", currentUser.getUserId());
-		redisReceiver.generateCommonDoc(jsonObject);
+    @Override
+    public List<BankOrderVO> getContractOrderList(String contractNo, String phone, String status, Long index, Long size) {
+        SysUserEntity user = sysUserRepository.getUserWithPhone(phone);
+        List<BankOrderVO> volist = new ArrayList<>();
+        if (user != null) {
+            List<ContractOrderEntity> entiryList = contractOrderRepository.searchOrderWithContractNo(String.valueOf(user.getUserId()), status, contractNo, index, size);
+            volist = BeanCopyUtils.convertList2List(entiryList, BankOrderVO.class);
+        }
+        List<String> bizNoList = volist.stream().map(BankOrderVO::getBusinessNo).collect(Collectors.toList());
+        if (bizNoList != null && bizNoList.size() > 0) {
+            Set<String> set = new HashSet<>();
+            List<OrderFileEntity> fileList = orderFileRepository.getOrderNoteList(bizNoList);
+            if (fileList != null && fileList.size() > 0) {
+                set = fileList.stream().map(OrderFileEntity::getBusinessNo).collect(Collectors.toSet());
+            }
+            for (BankOrderVO order : volist) {
+                order.setNotarizedFlag(set.contains(order.getBusinessNo()) ? "1" : "0");
+            }
+        }
+        return volist;
+    }
+
+    @Override
+    public BankOrderVO getContractOrderWithBizNo(String businessNo) {
+        ContractOrderEntity orderEntity = contractOrderRepository.getContractOrderWithBizNo(businessNo);
+        BankOrderVO orderVo = BeanCopyUtils.convertObj(orderEntity, BankOrderVO.class);
+        orderVo.setFileUrlMap(getFileInfo(orderEntity));
+        if (OrderConstant.PROD_ID_CD.equals(orderEntity.getProdId())) {
+            CollateralInfoEntity collateralInfo = contractOrderRepository.getCollateralWithBizNo(businessNo);
+            if (collateralInfo != null) {
+                orderVo.setBrandModel(collateralInfo.getBrandModel());
+                orderVo.setColor(collateralInfo.getColor());
+                orderVo.setOwnership(collateralInfo.getOwnership());
+                orderVo.setBuyingPrice(collateralInfo.getBuyingPrice());
+            }
+        }
+        return orderVo;
+    }
+
+    @Override
+    public ResponseDTO<String> submitContractOrder(String businessNo, SysUserEntity currentUser) {
+        ContractOrderEntity contractOrderEntity = contractOrderRepository.getContractOrderWithBizNo(businessNo);
+        if (modelRepository.existModelInEditing(contractOrderEntity.getProdId(), contractOrderEntity.getContractType(), contractOrderEntity.getNotaryOfficeId(), ModelConstant.MODEL_TYPE_COMMON_LIST)) {
+            return new ResponseDTO<>(OrderBizCodeMessage.MODEL_IN_EDITING.getCode(), OrderBizCodeMessage.MODEL_IN_EDITING.getMessage());
+        }
+        updateStatus(businessNo, OrderConstant.ORDER_STATUS_UNCHECKED, "");
+        // 推送创建订单文档任务消息
+        JSONObject jsonObject = new JSONObject();
+        jsonObject.put("businessNo", businessNo);
+        jsonObject.put("userId", currentUser.getUserId());
+        redisReceiver.generateCommonDoc(jsonObject);
 //		redisTemplate.convertAndSend(RedisCacheConfig.CHANNEL_HTML_PDF, jsonObject.toJSONString());
-		return ResponseDTO.success();
-	}
+        return ResponseDTO.success();
+    }
 
-	@Override
-	public void updateStatus(String businessNo, String status, String message) {
-		ContractOrderEntity order = new ContractOrderEntity();
-		order.setBusinessNo(businessNo);
-		order.setStatus(status);
-		order.setUpdateTime(new Date());
-		if (OrderConstant.ORDER_STATUS_UNSUBMIT.equals(status)) {
-			order.setReturnReason(message);
-		} else if (OrderConstant.ORDER_STATUS_REJECTED.equals(status)) {
-			order.setRejectReason(message);
-		}
-		contractOrderRepository.updateWithBizNo(order);
-	}
+    @Override
+    public void updateStatus(String businessNo, String status, String message) {
+        ContractOrderEntity order = new ContractOrderEntity();
+        order.setBusinessNo(businessNo);
+        order.setStatus(status);
+        order.setUpdateTime(new Date());
+        if (OrderConstant.ORDER_STATUS_UNSUBMIT.equals(status)) {
+            order.setReturnReason(message);
+        } else if (OrderConstant.ORDER_STATUS_REJECTED.equals(status)) {
+            order.setRejectReason(message);
+        }
+        contractOrderRepository.updateWithBizNo(order);
+    }
 
-	@Override
-	public Object parseContractOrder(Integer orderType, MultipartFile file, SysUserEntity user) {
-		BankEntity bank = bankMapper.selectById(user.getOrgId().split("_")[1]);
-		try {
-			OrderOCRParser orderOCRParser = orderOCRParserFactory.generateOrderOCRParser(bank.getUscc());
-			if (orderOCRParser != null) {
-				String result = TencentServiceUtil.readInfoWithOCR(file);
-				if (OrderConstant.CONTRACT_TYPE_BORROWER == orderType) {
-					return orderOCRParser.parseBorrower(result);
-				} else if (OrderConstant.CONTRACT_TYPE_MORTGAGE == orderType) {
-					return orderOCRParser.parseMortgage(result);
-				} else if (OrderConstant.CONTRACT_TYPE_GUARANTEE == orderType) {
-					return orderOCRParser.parseGuarantee(result);
-				}
-			}
-		} catch (Exception e) {
-			e.printStackTrace();
-		}
-		return null;
-	}
+    @Override
+    public Object parseContractOrder(Integer orderType, MultipartFile file, SysUserEntity user) {
+        BankEntity bank = bankMapper.selectById(user.getOrgId().split("_")[1]);
+        try {
+            OrderOCRParser orderOCRParser = orderOCRParserFactory.generateOrderOCRParser(bank.getUscc());
+            if (orderOCRParser != null) {
+                String result = TencentServiceUtil.readInfoWithOCR(file);
+                if (OrderConstant.CONTRACT_TYPE_BORROWER == orderType) {
+                    return orderOCRParser.parseBorrower(result);
+                } else if (OrderConstant.CONTRACT_TYPE_MORTGAGE == orderType) {
+                    return orderOCRParser.parseMortgage(result);
+                } else if (OrderConstant.CONTRACT_TYPE_GUARANTEE == orderType) {
+                    return orderOCRParser.parseGuarantee(result);
+                }
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return null;
+    }
 
-	/**
-	 * 获取订单图片链接
-	 * @param contractOrder
-	 * @return
-	 */
-	private Map<String, String> getFileInfo(ContractOrderEntity contractOrder) {
-		// 合同附件:1.抵押物照片 2.合同附件
-		List<Integer> list = new ArrayList<Integer>();
-		if (StringUtils.isNotBlank(contractOrder.getMortgagePic())) {
-			list.add(Integer.parseInt(contractOrder.getMortgagePic()));
-		}
-		if (StringUtils.isNotBlank(contractOrder.getContractAttachment())) {
-			list.add(Integer.parseInt(contractOrder.getContractAttachment()));
-		}
-		// 当事人:1.身份证正面 2.身份证反面 3.结婚证 4.户口本 5.其他
-		list.add(Integer.parseInt(contractOrder.getIdcardFrontPic()));
-		list.add(Integer.parseInt(contractOrder.getIdcardBackPic()));
-		if (StringUtils.isNotBlank(contractOrder.getMarragePic())) {
-			String[] marrage = contractOrder.getMarragePic().split(",");
-			list.addAll(toIntList(marrage));
-		}
-		if (StringUtils.isNotBlank(contractOrder.getHkbPic())) {
-			String[] hkbPic = contractOrder.getHkbPic().split(",");
-			list.addAll(toIntList(hkbPic));
-		}
-		String otherUpload = contractOrder.getOtherUpload();
-		if (StringUtils.isNotBlank(otherUpload)) {
-			String[] otherArray = otherUpload.split(",");
-			list.addAll(toIntList(otherArray));
-		}
-		// 共同责任人:1.身份证正面 2.身份证反面
-		if (StringUtils.isNotBlank(contractOrder.getJointIdcardFrontPic())) {
-			list.add(Integer.parseInt(contractOrder.getJointIdcardFrontPic()));
-		}
-		if (StringUtils.isNotBlank(contractOrder.getJointIdcardBackPic())) {
-			list.add(Integer.parseInt(contractOrder.getJointIdcardBackPic()));
-		}
-		// 取出所有的图片
-		Map<String, String> fileUrlMap = new HashMap<>();
-		List<FileInfoEntity> fileInfo = fileInfoMapper.selectBatchIds(list);
-		for (FileInfoEntity file : fileInfo) {
-			fileUrlMap.put(String.valueOf(file.getId()), FileUploadUtil.getFileUrl(file.getPath()));
-		}
-		return fileUrlMap;
-	}
+    /**
+     * 获取订单图片链接
+     *
+     * @param contractOrder
+     * @return
+     */
+    private Map<String, String> getFileInfo(ContractOrderEntity contractOrder) {
+        // 合同附件:1.抵押物照片 2.合同附件
+        List<Integer> list = new ArrayList<Integer>();
+        if (StringUtils.isNotBlank(contractOrder.getMortgagePic())) {
+            list.add(Integer.parseInt(contractOrder.getMortgagePic()));
+        }
+        if (StringUtils.isNotBlank(contractOrder.getContractAttachment())) {
+            list.add(Integer.parseInt(contractOrder.getContractAttachment()));
+        }
+        // 当事人:1.身份证正面 2.身份证反面 3.结婚证 4.户口本 5.其他
+        list.add(Integer.parseInt(contractOrder.getIdcardFrontPic()));
+        list.add(Integer.parseInt(contractOrder.getIdcardBackPic()));
+        if (StringUtils.isNotBlank(contractOrder.getMarragePic())) {
+            String[] marrage = contractOrder.getMarragePic().split(",");
+            list.addAll(toIntList(marrage));
+        }
+        if (StringUtils.isNotBlank(contractOrder.getHkbPic())) {
+            String[] hkbPic = contractOrder.getHkbPic().split(",");
+            list.addAll(toIntList(hkbPic));
+        }
+        String otherUpload = contractOrder.getOtherUpload();
+        if (StringUtils.isNotBlank(otherUpload)) {
+            String[] otherArray = otherUpload.split(",");
+            list.addAll(toIntList(otherArray));
+        }
+        // 共同责任人:1.身份证正面 2.身份证反面
+        if (StringUtils.isNotBlank(contractOrder.getJointIdcardFrontPic())) {
+            list.add(Integer.parseInt(contractOrder.getJointIdcardFrontPic()));
+        }
+        if (StringUtils.isNotBlank(contractOrder.getJointIdcardBackPic())) {
+            list.add(Integer.parseInt(contractOrder.getJointIdcardBackPic()));
+        }
+        // 取出所有的图片
+        Map<String, String> fileUrlMap = new HashMap<>();
+        List<FileInfoEntity> fileInfo = fileInfoMapper.selectBatchIds(list);
+        for (FileInfoEntity file : fileInfo) {
+            fileUrlMap.put(String.valueOf(file.getId()), FileUploadUtil.getFileUrl(file.getPath()));
+        }
+        return fileUrlMap;
+    }
 
-	private List<Integer> toIntList(String[] array) {
-		Integer[] intArray = Arrays.stream(array).mapToInt(Integer::parseInt).boxed().toArray(Integer[]::new);
-		return Arrays.asList(intArray);
-	}
+    private List<Integer> toIntList(String[] array) {
+        Integer[] intArray = Arrays.stream(array).mapToInt(Integer::parseInt).boxed().toArray(Integer[]::new);
+        return Arrays.asList(intArray);
+    }
 }

+ 48 - 0
eladmin-system/src/main/java/me/zhengjie/dao/mybatis/ContractOrderRepository.java

@@ -28,6 +28,7 @@ public class ContractOrderRepository {
     private final BorrowerMapper borrowerMapper;
     private final MortgageMapper mortgageMapper;
     private final GuaranteeMapper guaranteeMapper;
+    private final CollateralInfoMapper collateralInfoMapper;
     private final JdbcTemplate jdbcTemplate;
 
     /**
@@ -237,4 +238,51 @@ public class ContractOrderRepository {
         qw.eq("contract_no", contractNo);
         return contractOrderMapper.selectOne(qw);
     }
+
+    /**
+     * 获取公证处最大受理咨询号订单
+     *
+     * @param notaryOfficeId
+     * @return
+     */
+    public ContractOrderEntity getTodayMaxConsultNoEntity(String notaryOfficeId, String date) {
+        QueryWrapper<ContractOrderEntity> qw = new QueryWrapper<>();
+        qw.eq("notary_office_id", notaryOfficeId);
+        qw.likeRight("consult_no", date);
+        qw.orderByDesc("consult_no");
+        List<ContractOrderEntity> list = contractOrderMapper.selectList(qw);
+        if (list != null && list.size() > 0) {
+            return list.get(0);
+        }
+        return null;
+    }
+
+    /**
+     * 根据订单号查找抵押物信息
+     *
+     * @param bizNo
+     * @return
+     */
+    public CollateralInfoEntity getCollateralWithBizNo(String bizNo) {
+        QueryWrapper<CollateralInfoEntity> qw = new QueryWrapper<>();
+        qw.eq("business_no", bizNo);
+        return collateralInfoMapper.selectOne(qw);
+    }
+
+    /**
+     * 插入抵押物信息
+     * @param entity
+     */
+    public void insertCollateral(CollateralInfoEntity entity) {
+        collateralInfoMapper.insert(entity);
+    }
+
+    /**
+     * 根据ID修改抵押物信息
+     *
+     * @param entity
+     */
+    public void updateCollateralById(CollateralInfoEntity entity) {
+        collateralInfoMapper.updateById(entity);
+    }
 }

+ 32 - 0
eladmin-system/src/main/java/me/zhengjie/dao/mybatis/entity/CollateralInfoEntity.java

@@ -0,0 +1,32 @@
+package me.zhengjie.dao.mybatis.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.io.Serializable;
+import java.util.Date;
+
+@Data
+@TableName("collateral_info")
+@NoArgsConstructor
+public class CollateralInfoEntity implements Serializable {
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+    private String businessNo;
+
+    private String brandModel;
+
+    private String color;
+
+    private String ownership;
+
+    private String buyingPrice;
+
+    private Date createTime;
+
+    private Date updateTime;
+}

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

@@ -172,4 +172,7 @@ public class ContractOrderEntity implements Serializable {
 
     @TableField(value = "update_time", fill = FieldFill.UPDATE)
     private Date updateTime;
+
+    @TableField("consult_no")
+    private String consultNo;
 }

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

@@ -62,4 +62,7 @@ public class OrderFileEntity implements Serializable {
 
     @TableField("file_name")
     private String fileName;
+
+    @TableField("content")
+    private String content;
 }

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

@@ -0,0 +1,9 @@
+package me.zhengjie.dao.mybatis.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import me.zhengjie.dao.mybatis.entity.CollateralInfoEntity;
+import org.apache.ibatis.annotations.Mapper;
+
+@Mapper
+public interface CollateralInfoMapper extends BaseMapper<CollateralInfoEntity> {
+}

+ 11 - 0
eladmin-system/src/main/java/me/zhengjie/domain/model/ModelSynthesizerDomain.java

@@ -336,6 +336,16 @@ public class ModelSynthesizerDomain {
         } catch (Exception e) {
             e.printStackTrace();
         }
+        // 准备抵押物信息
+        if (OrderConstant.PROD_ID_CD.equals(contractOrderEntity.getProdId())) {
+            CollateralInfoEntity collateralInfoEntity = contractOrderRepository.getCollateralWithBizNo(businessNo);
+            if (collateralInfoEntity != null) {
+                noteValue.put("$Bmodel$", collateralInfoEntity.getBrandModel());
+                noteValue.put("$Color$", collateralInfoEntity.getColor());
+                noteValue.put("$Equity$", collateralInfoEntity.getOwnership());
+                noteValue.put("$Price$", collateralInfoEntity.getBuyingPrice());
+            }
+        }
         return noteValue;
     }
 
@@ -372,6 +382,7 @@ public class ModelSynthesizerDomain {
         Map<String, String> map = new HashMap<>();
         map.put("$Greffier$", userName);
         map.put("$Date$", DateUtils.date2String(new Date(), 1));
+        map.put("$AcceptedNO$", contractOrderEntity.getConsultNo());
         map.put("$BusinessOrderNo$", contractOrderEntity.getBusinessNo());
         map.put("$Name$", contractOrderEntity.getName());
         map.put("$Sex$", StatusEnum.SexStatusEnum.getValue(contractOrderEntity.getSex()));