|
|
@@ -38,15 +38,15 @@ public class NotaryNoteServiceImpl extends ServiceImpl<INotaryNoteDao, NotaryNot
|
|
|
@Autowired
|
|
|
NotaryOrderMapper notaryOrderMapper;
|
|
|
@Autowired
|
|
|
- BorrowerMapper borrowerMapper;
|
|
|
+ BorrowerMapper borrowerMapper;
|
|
|
@Autowired
|
|
|
- MortgageMapper mortgageMapper;
|
|
|
+ MortgageMapper mortgageMapper;
|
|
|
@Autowired
|
|
|
- GuaranteeMapper guaranteeMapper;
|
|
|
+ GuaranteeMapper guaranteeMapper;
|
|
|
@Autowired
|
|
|
NotaryOfficeMapper notaryOfficeMapper;
|
|
|
@Autowired
|
|
|
- ModelMapper modelMapper;
|
|
|
+ ModelMapper modelMapper;
|
|
|
@Autowired
|
|
|
OrderService orderService;
|
|
|
@Autowired
|
|
|
@@ -61,10 +61,10 @@ public class NotaryNoteServiceImpl extends ServiceImpl<INotaryNoteDao, NotaryNot
|
|
|
Map<String, String> noteValue = new HashMap<String, String>();
|
|
|
// 设置默认值
|
|
|
noteValue.put("$Date$", DateUtils.date2String(new Date(), 1));
|
|
|
- noteValue.put("$Dissent$","无异议");
|
|
|
- noteValue.put("$Voluntarily$","是");
|
|
|
- noteValue.put("$Know$","知道");
|
|
|
- noteValue.put("$AdditionalContent$","没有了");
|
|
|
+ noteValue.put("$Dissent$", "无异议");
|
|
|
+ noteValue.put("$Voluntarily$", "是");
|
|
|
+ noteValue.put("$Know$", "知道");
|
|
|
+ noteValue.put("$AdditionalContent$", "没有了");
|
|
|
// 设置用户参数
|
|
|
UserDto user = contextUtil.getCurrentUser().getUser();
|
|
|
noteValue.put("$Greffier$", user.getNickName());
|
|
|
@@ -80,12 +80,12 @@ public class NotaryNoteServiceImpl extends ServiceImpl<INotaryNoteDao, NotaryNot
|
|
|
QueryWrapper<BorrowerEntity> borrowQw = new QueryWrapper<>();
|
|
|
borrowQw.eq("business_no", notary.getBusinessNo());
|
|
|
BorrowerEntity borrower = borrowerMapper.selectOne(borrowQw);
|
|
|
- noteValue.put("$LoanName$",borrower.getUsername());
|
|
|
- noteValue.put("$LoanBirthdday$",borrower.getBirth());
|
|
|
- noteValue.put("$LoanIDNo$",borrower.getIdCard());
|
|
|
- noteValue.put("$LoanAmount$",borrower.getSumMoney());
|
|
|
- noteValue.put("$LoanTerm$",borrower.getStartDate()+"~"+borrower.getEndDate());
|
|
|
- noteValue.put("$LoanRate$",borrower.getRate());
|
|
|
+ noteValue.put("$LoanName$", borrower.getUsername());
|
|
|
+ noteValue.put("$LoanBirthdday$", borrower.getBirth());
|
|
|
+ noteValue.put("$LoanIDNo$", borrower.getIdCard());
|
|
|
+ noteValue.put("$LoanAmount$", borrower.getSumMoney());
|
|
|
+ noteValue.put("$LoanTerm$", borrower.getStartDate() + "~" + borrower.getEndDate());
|
|
|
+ noteValue.put("$LoanRate$", borrower.getRate());
|
|
|
try {
|
|
|
SimpleDateFormat monthformatter = new SimpleDateFormat("yyyy-MM");
|
|
|
Date beginDate = monthformatter.parse(borrower.getStartDate());
|
|
|
@@ -99,17 +99,20 @@ public class NotaryNoteServiceImpl extends ServiceImpl<INotaryNoteDao, NotaryNot
|
|
|
QueryWrapper<MortgageEntity> mortgageQw = new QueryWrapper<>();
|
|
|
mortgageQw.eq("business_no", notary.getBusinessNo());
|
|
|
MortgageEntity mortgage = mortgageMapper.selectOne(mortgageQw);
|
|
|
- noteValue.put("$MortgagorName$",mortgage.getUsername());
|
|
|
- noteValue.put("$MortgagorBirthdday$",mortgage.getBirth());
|
|
|
- noteValue.put("$MortgagorIDNo$",mortgage.getIdCard());
|
|
|
- noteValue.put("$HouseAddr$",mortgage.getHouseLocation());
|
|
|
+ if (mortgage != null) {
|
|
|
+ noteValue.put("$MortgagorName$", mortgage.getUsername());
|
|
|
+ noteValue.put("$MortgagorBirthdday$", mortgage.getBirth());
|
|
|
+ noteValue.put("$MortgagorIDNo$", mortgage.getIdCard());
|
|
|
+ noteValue.put("$HouseAddr$", mortgage.getHouseLocation());
|
|
|
+ }
|
|
|
+
|
|
|
// 设置担保子订单参数
|
|
|
QueryWrapper<GuaranteeEntity> guaranteeQw = new QueryWrapper<>();
|
|
|
guaranteeQw.eq("business_no", notary.getBusinessNo());
|
|
|
GuaranteeEntity guarantee = guaranteeMapper.selectOne(guaranteeQw);
|
|
|
- noteValue.put("$GuaranteeName$",guarantee.getUsername());
|
|
|
- noteValue.put("$GuaranteeBirthdday$",guarantee.getBirth());
|
|
|
- noteValue.put("$GuaranteeIDNo$",guarantee.getIdCard());
|
|
|
+ noteValue.put("$GuaranteeName$", guarantee.getUsername());
|
|
|
+ noteValue.put("$GuaranteeBirthdday$", guarantee.getBirth());
|
|
|
+ noteValue.put("$GuaranteeIDNo$", guarantee.getIdCard());
|
|
|
//
|
|
|
String typePrefix = notary.getOrderId().substring(0, 2);
|
|
|
String code = "";
|
|
|
@@ -120,7 +123,8 @@ public class NotaryNoteServiceImpl extends ServiceImpl<INotaryNoteDao, NotaryNot
|
|
|
noteValue.put("$Sex$", "1".equals(borrower.getSex()) ? "男" : "女");
|
|
|
noteValue.put("$Birthdday$", borrower.getBirth());
|
|
|
noteValue.put("$HomeAddr$", borrower.getResidence());
|
|
|
- code = orderService.sameBorrowerMortgage(notary.getOrderId(), StatusEnum.NotaryNoteEnum.BORROWER_NOTE.name()) ? "9" : "6";
|
|
|
+ code = orderService.sameBorrowerMortgage(notary.getOrderId(),
|
|
|
+ StatusEnum.NotaryNoteEnum.BORROWER_NOTE.name()) ? "9" : "6";
|
|
|
} else if ("11".equals(typePrefix)) {
|
|
|
noteValue.put("$Name$", mortgage.getUsername());
|
|
|
noteValue.put("$IDNo$", mortgage.getIdCard());
|
|
|
@@ -128,7 +132,8 @@ public class NotaryNoteServiceImpl extends ServiceImpl<INotaryNoteDao, NotaryNot
|
|
|
noteValue.put("$Sex$", "1".equals(mortgage.getSex()) ? "男" : "女");
|
|
|
noteValue.put("$Birthdday$", mortgage.getBirth());
|
|
|
noteValue.put("$HomeAddr$", mortgage.getResidence());
|
|
|
- code = orderService.sameBorrowerMortgage(notary.getOrderId(), StatusEnum.NotaryNoteEnum.MORTGAGOR_NOTE.name()) ? "9" : "7";
|
|
|
+ code = orderService.sameBorrowerMortgage(notary.getOrderId(),
|
|
|
+ StatusEnum.NotaryNoteEnum.MORTGAGOR_NOTE.name()) ? "9" : "7";
|
|
|
} else if ("12".equals(typePrefix)) {
|
|
|
noteValue.put("$Name$", guarantee.getUsername());
|
|
|
noteValue.put("$IDNo$", guarantee.getIdCard());
|
|
|
@@ -150,7 +155,7 @@ public class NotaryNoteServiceImpl extends ServiceImpl<INotaryNoteDao, NotaryNot
|
|
|
List<NotaryNoteEntity> notaryNotes = list(query);
|
|
|
// 组织回传数据
|
|
|
List<NotaryNoteDto> notaryNoteDtos = new ArrayList<>();
|
|
|
- for(NotaryNoteEntity notaryNote:notaryNotes){
|
|
|
+ for (NotaryNoteEntity notaryNote : notaryNotes) {
|
|
|
NotaryNoteDto notaryNoteDto = new NotaryNoteDto();
|
|
|
notaryNoteDto.setId(notaryNote.getId());
|
|
|
notaryNoteDto.setQuestion(TextTempletUtil.replaceContent(notaryNote.getQuestion(), noteValue));
|
|
|
@@ -164,6 +169,7 @@ public class NotaryNoteServiceImpl extends ServiceImpl<INotaryNoteDao, NotaryNot
|
|
|
|
|
|
/**
|
|
|
* 保存面谈笔录
|
|
|
+ *
|
|
|
* @param notary
|
|
|
* @return
|
|
|
*/
|
|
|
@@ -174,15 +180,17 @@ public class NotaryNoteServiceImpl extends ServiceImpl<INotaryNoteDao, NotaryNot
|
|
|
String typePrefix = notary.getOrderId().substring(0, 2);
|
|
|
String code = "";
|
|
|
if ("10".equals(typePrefix)) {
|
|
|
- code = orderService.sameBorrowerMortgage(notary.getOrderId(), StatusEnum.NotaryNoteEnum.BORROWER_NOTE.name()) ? "9" : "6";
|
|
|
+ code = orderService.sameBorrowerMortgage(notary.getOrderId(),
|
|
|
+ StatusEnum.NotaryNoteEnum.BORROWER_NOTE.name()) ? "9" : "6";
|
|
|
} else if ("11".equals(typePrefix)) {
|
|
|
- code = orderService.sameBorrowerMortgage(notary.getOrderId(), StatusEnum.NotaryNoteEnum.MORTGAGOR_NOTE.name()) ? "9" : "7";
|
|
|
+ code = orderService.sameBorrowerMortgage(notary.getOrderId(),
|
|
|
+ StatusEnum.NotaryNoteEnum.MORTGAGOR_NOTE.name()) ? "9" : "7";
|
|
|
} else {
|
|
|
code = "8";
|
|
|
}
|
|
|
UserDto userDto = contextUtil.getCurrentUser().getUser();
|
|
|
String notaryOfficeId = userDto.getOrgId().split("_")[1];
|
|
|
- String[] codes = {code};
|
|
|
+ String[] codes = { code };
|
|
|
if (modelRepository.existModelInEditing(notaryOfficeId, codes)) {
|
|
|
response.fail(OrderBizCodeMessage.MODEL_IN_EDITING);
|
|
|
return response;
|
|
|
@@ -194,11 +202,13 @@ public class NotaryNoteServiceImpl extends ServiceImpl<INotaryNoteDao, NotaryNot
|
|
|
String htmlContent = "";
|
|
|
int i = 1;
|
|
|
for (NotaryNoteDto noteDto : notaryNoteDtoList) {
|
|
|
- htmlContent = htmlContent.concat("<li>").concat(String.valueOf(i++)).concat(".").concat(noteDto.getQuestion()).concat("<br>").concat(noteDto.getAnswer()).concat("</li>");
|
|
|
+ htmlContent = htmlContent.concat("<li>").concat(String.valueOf(i++)).concat(".")
|
|
|
+ .concat(noteDto.getQuestion()).concat("<br>").concat(noteDto.getAnswer()).concat("</li>");
|
|
|
}
|
|
|
- htmlContent = modelContent.replace("${QuestionAnswerList}", htmlContent).replace("${yyyyMMdd}", formatter.format(new Date()));
|
|
|
- String htmlpath = FileUploadUtil.saveHtml(htmlContent, notary.getBusinessNo(),notary.getOrderId());
|
|
|
- String pdfPath = FileUploadUtil.savePdf(htmlContent, notary.getBusinessNo(),notary.getOrderId());
|
|
|
+ htmlContent = modelContent.replace("${QuestionAnswerList}", htmlContent).replace("${yyyyMMdd}",
|
|
|
+ formatter.format(new Date()));
|
|
|
+ String htmlpath = FileUploadUtil.saveHtml(htmlContent, notary.getBusinessNo(), notary.getOrderId());
|
|
|
+ String pdfPath = FileUploadUtil.savePdf(htmlContent, notary.getBusinessNo(), notary.getOrderId());
|
|
|
//
|
|
|
ModelEntity modelEntity = modelRepository.getModelEntity(String.valueOf(officeEntity.getId()), code, "1");
|
|
|
OrderFileEntity orderFile = new OrderFileEntity();
|
|
|
@@ -218,12 +228,13 @@ public class NotaryNoteServiceImpl extends ServiceImpl<INotaryNoteDao, NotaryNot
|
|
|
|
|
|
/**
|
|
|
* 关联当前公证员ID
|
|
|
+ *
|
|
|
* @param businessNo
|
|
|
*/
|
|
|
- private void saveNotaryUserId(String businessNo){
|
|
|
+ private void saveNotaryUserId(String businessNo) {
|
|
|
String currentUserId = String.valueOf(contextUtil.getCurrentUserId());
|
|
|
QueryWrapper<BorrowerEntity> borrowerQw = new QueryWrapper<>();
|
|
|
- borrowerQw.eq("business_no",businessNo);
|
|
|
+ borrowerQw.eq("business_no", businessNo);
|
|
|
BorrowerEntity borrowerEntity = borrowerMapper.selectOne(borrowerQw);
|
|
|
BorrowerEntity saveBorrower = new BorrowerEntity();
|
|
|
saveBorrower.setId(borrowerEntity.getId());
|
|
|
@@ -240,23 +251,29 @@ public class NotaryNoteServiceImpl extends ServiceImpl<INotaryNoteDao, NotaryNot
|
|
|
guaranteeMapper.updateById(saveGuarantee);
|
|
|
QueryWrapper<MortgageEntity> mortgageQw = new QueryWrapper<>();
|
|
|
mortgageQw.eq("business_no", businessNo);
|
|
|
+ // 非空
|
|
|
MortgageEntity mortgageEntity = mortgageMapper.selectOne(mortgageQw);
|
|
|
- MortgageEntity saveMortgage = new MortgageEntity();
|
|
|
- saveMortgage.setId(mortgageEntity.getId());
|
|
|
- saveMortgage.setUpdateTime(LocalDateTime.now());
|
|
|
- saveMortgage.setNotaryUserId(currentUserId);
|
|
|
- mortgageMapper.updateById(saveMortgage);
|
|
|
+ if (mortgageEntity != null) {
|
|
|
+ MortgageEntity saveMortgage = new MortgageEntity();
|
|
|
+ saveMortgage.setId(mortgageEntity.getId());
|
|
|
+ saveMortgage.setUpdateTime(LocalDateTime.now());
|
|
|
+ saveMortgage.setNotaryUserId(currentUserId);
|
|
|
+ mortgageMapper.updateById(saveMortgage);
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 读取文件内容
|
|
|
+ *
|
|
|
* @param code
|
|
|
* @return
|
|
|
*/
|
|
|
private String readFileInString(String code) {
|
|
|
String result = "";
|
|
|
try {
|
|
|
- InputStream inputStream = NotaryNoteServiceImpl.class.getClassLoader().getResourceAsStream("template/note/notary-note.html");
|
|
|
+ InputStream inputStream = NotaryNoteServiceImpl.class.getClassLoader()
|
|
|
+ .getResourceAsStream("template/note/notary-note.html");
|
|
|
result = IOUtils.toString(inputStream, StandardCharsets.UTF_8);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|