|
|
@@ -13,6 +13,7 @@ import me.zhengjie.dao.mybatis.ContractOrderRepository;
|
|
|
import me.zhengjie.dao.mybatis.entity.*;
|
|
|
import me.zhengjie.dao.mybatis.mapper.*;
|
|
|
import me.zhengjie.domain.order.OrderConstant;
|
|
|
+import me.zhengjie.utils.DateUtil;
|
|
|
import org.apache.commons.io.IOUtils;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
@@ -95,33 +96,29 @@ public class ModelSynthesizerDomain {
|
|
|
map.put("$NotaryOffice$", notaryOffice.getName());
|
|
|
// 当事人信息
|
|
|
try {
|
|
|
- SimpleDateFormat yearFormatter = new SimpleDateFormat("yyyy");
|
|
|
SimpleDateFormat monthformatter = new SimpleDateFormat("yyyy-MM");
|
|
|
Date beginDate = monthformatter.parse(contractOrderEntity.getStartDate());
|
|
|
Date endDate = monthformatter.parse(contractOrderEntity.getEndDate());
|
|
|
Integer months = DateUtils.getDiffNaturalMonth(endDate, beginDate);
|
|
|
- map.put("$Year$", yearFormatter.format(new Date()));
|
|
|
+ map.put("$Year$", DateUtil.formatYearWithChineseSeparator(new Date()));
|
|
|
map.put("$Name$", contractOrderEntity.getName());
|
|
|
map.put("$Sex$", "1".equals(contractOrderEntity.getSex()) ? "男" : "女");
|
|
|
- map.put("$Birthdday$", contractOrderEntity.getBirth());
|
|
|
+ map.put("$Birthdday$", DateUtil.formatDateWithChineseSeparatorAndNoZeroFilled(contractOrderEntity.getBirth(), "yyyy/M/d"));
|
|
|
map.put("$Phone$",contractOrderEntity.getPhone());
|
|
|
map.put("$Addr$",contractOrderEntity.getResidence());
|
|
|
map.put("$IDNo$", contractOrderEntity.getIdCard());
|
|
|
map.put("$LoanRate$", contractOrderEntity.getRate());
|
|
|
- map.put("$Term$", contractOrderEntity.getStartDate().concat(" - ").concat(contractOrderEntity.getEndDate()));
|
|
|
+ map.put("$Term$", DateUtil.formatDateWithChineseSeparatorAndNoZeroFilled(contractOrderEntity.getStartDate(), "yyyy-MM-dd").concat(" - ").concat(DateUtil.formatDateWithChineseSeparatorAndNoZeroFilled(contractOrderEntity.getEndDate(), "yyyy-MM-dd")));
|
|
|
map.put("$TotalMonth$", months.toString());
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
// 客户经理
|
|
|
try {
|
|
|
- SimpleDateFormat dateSrcFormatter = new SimpleDateFormat("yyyyMMdd");
|
|
|
- SimpleDateFormat dateDestFormatter = new SimpleDateFormat("yyyy/MM/dd");
|
|
|
SysUserEntity customer = sysUserMapper.selectById(contractOrderEntity.getCustomerId());
|
|
|
- Date date = dateSrcFormatter.parse(customer.getIdCard().substring(6, 14));
|
|
|
map.put("$PBName$", customer.getNickName());
|
|
|
map.put("$PBSex$", customer.getGender());
|
|
|
- map.put("$PBBirthday$", dateDestFormatter.format(date));
|
|
|
+ map.put("$PBBirthday$", DateUtil.formatDateWithChineseSeparatorAndNoZeroFilled(customer.getIdCard().substring(6, 14), "yyyyMMdd"));
|
|
|
map.put("$PBIDNo$", customer.getIdCard());
|
|
|
map.put("$PBPhone$", customer.getPhone());
|
|
|
} catch (Exception e) {
|
|
|
@@ -132,10 +129,9 @@ public class ModelSynthesizerDomain {
|
|
|
map.put("$Bank$", bankEntity.getBankName());
|
|
|
map.put("$BankAddr$", bankEntity.getAddress());
|
|
|
map.put("$BankLeader$", bankEntity.getPrincipal());
|
|
|
- map.put("$BankPhone",bankEntity.getPhone());
|
|
|
+ map.put("$BankPhone", bankEntity.getPhone());
|
|
|
// 其他信息
|
|
|
- SimpleDateFormat dayFormatter = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
- map.put("$Date$", dayFormatter.format(new Date()));
|
|
|
+ map.put("$Date$", DateUtil.formatDateWithChineseSeparatorAndNoZeroFilled(new Date()));
|
|
|
return map;
|
|
|
}
|
|
|
|
|
|
@@ -155,9 +151,8 @@ public class ModelSynthesizerDomain {
|
|
|
htmlContent = htmlContent.concat("<li class=\"question\">问:").concat(noteDto.getQuestion()).concat("</li>")
|
|
|
.concat("<li class=\"answer\">答:").concat(noteDto.getAnswer()).concat("</li>");
|
|
|
}
|
|
|
- SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
htmlContent = modelContent.replace("${QuestionAnswerList}", htmlContent).replace("${yyyyMMdd}",
|
|
|
- formatter.format(new Date())).replace("${NotaryUserName}", userName).replace("${QueryUsers}", composeNotePartyList(businessNo));
|
|
|
+ DateUtil.formatDateWithChineseSeparatorAndNoZeroFilled(new Date())).replace("${NotaryUserName}", userName).replace("${QueryUsers}", composeNotePartyList(businessNo));
|
|
|
return htmlContent;
|
|
|
}
|
|
|
|
|
|
@@ -203,8 +198,6 @@ public class ModelSynthesizerDomain {
|
|
|
*/
|
|
|
private List<Map<String, String>> prepareNotePartyTemplateData(ContractOrderEntity order) {
|
|
|
List<Map<String, String>> userList = new ArrayList<>();
|
|
|
- SimpleDateFormat dateSrcFormatter = new SimpleDateFormat("yyyyMMdd");
|
|
|
- SimpleDateFormat dateDestFormatter = new SimpleDateFormat("yyyy/MM/dd");
|
|
|
try {
|
|
|
// 客户经理
|
|
|
SysUserEntity user = sysUserMapper.selectById(order.getCustomerId());
|
|
|
@@ -212,7 +205,7 @@ public class ModelSynthesizerDomain {
|
|
|
customerMap.put("$Title$", "委托代理人");
|
|
|
customerMap.put("$Name$", user.getNickName());
|
|
|
customerMap.put("$Sex$", user.getGender());
|
|
|
- customerMap.put("$Birth$", dateDestFormatter.format(dateSrcFormatter.parse(user.getIdCard().substring(6, 14))));
|
|
|
+ customerMap.put("$Birth$", DateUtil.formatDateWithChineseSeparatorAndNoZeroFilled(user.getIdCard().substring(6, 14), "yyyyMMdd"));
|
|
|
customerMap.put("$IdCard$", user.getIdCard());
|
|
|
customerMap.put("$Phone$", user.getPhone());
|
|
|
userList.add(customerMap);
|
|
|
@@ -233,7 +226,7 @@ public class ModelSynthesizerDomain {
|
|
|
}
|
|
|
partyMap.put("$Name$", order.getName());
|
|
|
partyMap.put("$Sex$", "1".equals(order.getSex()) ? "男" : "女");
|
|
|
- partyMap.put("$Birth$", order.getBirth());
|
|
|
+ partyMap.put("$Birth$", DateUtil.formatDateWithChineseSeparatorAndNoZeroFilled(order.getBirth(), "yyyy/M/d"));
|
|
|
partyMap.put("$IdCard$", order.getIdCard());
|
|
|
partyMap.put("$Phone$", order.getPhone());
|
|
|
userList.add(partyMap);
|
|
|
@@ -255,7 +248,7 @@ public class ModelSynthesizerDomain {
|
|
|
}
|
|
|
jointMap.put("$Name$", order.getJointName());
|
|
|
jointMap.put("$Sex$", "1".equals(order.getJointSex()) ? "男" : "女");
|
|
|
- jointMap.put("$Birth$", dateDestFormatter.format(dateSrcFormatter.parse(order.getJointIdCard().substring(6, 14))));
|
|
|
+ jointMap.put("$Birth$", DateUtil.formatDateWithChineseSeparatorAndNoZeroFilled(order.getJointIdCard().substring(6, 14), "yyyyMMdd"));
|
|
|
jointMap.put("$IdCard$", order.getJointIdCard());
|
|
|
jointMap.put("$Phone$", order.getJointPhone());
|
|
|
userList.add(jointMap);
|
|
|
@@ -275,7 +268,7 @@ public class ModelSynthesizerDomain {
|
|
|
public Map<String, String> prepareNoteTemplateData(String businessNo) {
|
|
|
Map<String, String> noteValue = new HashMap<String, String>();
|
|
|
// 设置默认值
|
|
|
- noteValue.put("$Date$", DateUtils.date2String(new Date(), 1));
|
|
|
+ noteValue.put("$Date$", DateUtil.formatDateWithChineseSeparatorAndNoZeroFilled(new Date()));
|
|
|
noteValue.put("$Dissent$", "无异议");
|
|
|
noteValue.put("$Voluntarily$", "是");
|
|
|
noteValue.put("$Know$", "知道");
|
|
|
@@ -288,17 +281,21 @@ public class ModelSynthesizerDomain {
|
|
|
noteValue.put("$NotaryOffice$", entity.getName());
|
|
|
// 设置主订单参数
|
|
|
ContractOrderEntity contractOrderEntity = contractOrderRepository.getContractOrderWithBizNo(businessNo);
|
|
|
- noteValue.put("$Bank$", contractOrderEntity.getBankName());
|
|
|
- noteValue.put("$Name$", contractOrderEntity.getName());
|
|
|
- noteValue.put("$Birthday$", contractOrderEntity.getBirth());
|
|
|
- noteValue.put("$IDNo$", contractOrderEntity.getIdCard());
|
|
|
- noteValue.put("$Phone$", contractOrderEntity.getPhone());
|
|
|
- noteValue.put("$Sex$", "1".equals(contractOrderEntity.getSex()) ? "男" : "女");
|
|
|
- noteValue.put("$Addr$", contractOrderEntity.getResidence());
|
|
|
- noteValue.put("$Amounts$", contractOrderEntity.getContractMoney());
|
|
|
- noteValue.put("$Term$", contractOrderEntity.getStartDate() + "~" + contractOrderEntity.getEndDate());
|
|
|
- noteValue.put("$LoanRate$", contractOrderEntity.getRate());
|
|
|
- noteValue.put("$McontractNO$",contractOrderEntity.getMainContractNo());
|
|
|
+ try {
|
|
|
+ noteValue.put("$Bank$", contractOrderEntity.getBankName());
|
|
|
+ noteValue.put("$Name$", contractOrderEntity.getName());
|
|
|
+ noteValue.put("$Birthday$", DateUtil.formatDateWithChineseSeparatorAndNoZeroFilled(contractOrderEntity.getBirth(), "yyyy/M/d"));
|
|
|
+ noteValue.put("$IDNo$", contractOrderEntity.getIdCard());
|
|
|
+ noteValue.put("$Phone$", contractOrderEntity.getPhone());
|
|
|
+ noteValue.put("$Sex$", "1".equals(contractOrderEntity.getSex()) ? "男" : "女");
|
|
|
+ noteValue.put("$Addr$", contractOrderEntity.getResidence());
|
|
|
+ noteValue.put("$Amounts$", contractOrderEntity.getContractMoney());
|
|
|
+ noteValue.put("$Term$", DateUtil.formatDateWithChineseSeparatorAndNoZeroFilled(contractOrderEntity.getStartDate(), "yyyy-MM-dd") + "~" + DateUtil.formatDateWithChineseSeparatorAndNoZeroFilled(contractOrderEntity.getEndDate(), "yyyy-MM-dd"));
|
|
|
+ noteValue.put("$LoanRate$", contractOrderEntity.getRate());
|
|
|
+ noteValue.put("$McontractNO$", contractOrderEntity.getMainContractNo());
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
// 抵押合同需要补充借款合同中借款人信息
|
|
|
if (contractOrderEntity.getContractType() == OrderConstant.CONTRACT_TYPE_MORTGAGE || contractOrderEntity.getContractType() == OrderConstant.CONTRACT_TYPE_GUARANTEE) {
|
|
|
ContractOrderEntity mainOrder = contractOrderRepository.getEntityWithContractNo(contractOrderEntity.getBankId(), contractOrderEntity.getProdId(), contractOrderEntity.getMainContractNo());
|
|
|
@@ -323,15 +320,13 @@ public class ModelSynthesizerDomain {
|
|
|
noteValue.put("$BankAddr$", bank.getAddress());
|
|
|
noteValue.put("$BankLeader$", bank.getPrincipal());
|
|
|
noteValue.put("$BankPhone$", bank.getPhone());
|
|
|
+ // 准备客户经理信息
|
|
|
try {
|
|
|
- // 准备客户经理信息
|
|
|
- SimpleDateFormat dateSrcFormatter = new SimpleDateFormat("yyyyMMdd");
|
|
|
- SimpleDateFormat dateDestFormatter = new SimpleDateFormat("yyyy/MM/dd");
|
|
|
SysUserEntity customer = sysUserMapper.selectById(contractOrderEntity.getCustomerId());
|
|
|
noteValue.put("$PBName$", customer.getNickName());
|
|
|
noteValue.put("$PBSex$", customer.getGender());
|
|
|
noteValue.put("$PBPhone$", customer.getPhone());
|
|
|
- noteValue.put("$PBBirthday$", dateDestFormatter.format(dateSrcFormatter.parse(customer.getIdCard().substring(6, 14))));
|
|
|
+ noteValue.put("$PBBirthday$", DateUtil.formatDateWithChineseSeparatorAndNoZeroFilled(customer.getIdCard().substring(6, 14), "yyyyMMdd"));
|
|
|
noteValue.put("$PBIDNo$", customer.getIdCard());
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
@@ -381,35 +376,32 @@ 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()));
|
|
|
- map.put("$Birthday$", contractOrderEntity.getBirth());
|
|
|
- map.put("$Addr$", contractOrderEntity.getResidence());
|
|
|
- map.put("$IDNo$", contractOrderEntity.getIdCard());
|
|
|
- map.put("$Phone$", contractOrderEntity.getPhone());
|
|
|
- if (contractOrderEntity.getJointFlag() == 1) {
|
|
|
- try {
|
|
|
- SimpleDateFormat dateSrcFormatter = new SimpleDateFormat("yyyyMMdd");
|
|
|
- SimpleDateFormat dateDestFormatter = new SimpleDateFormat("yyyy/MM/dd");
|
|
|
- Date date = dateSrcFormatter.parse(contractOrderEntity.getIdCard().substring(6, 14));
|
|
|
+ map.put("$Date$", DateUtil.formatDateWithChineseSeparatorAndNoZeroFilled(new Date()));
|
|
|
+ // 准备订单信息
|
|
|
+ try {
|
|
|
+ map.put("$AcceptedNO$", contractOrderEntity.getConsultNo());
|
|
|
+ map.put("$BusinessOrderNo$", contractOrderEntity.getBusinessNo());
|
|
|
+ map.put("$Name$", contractOrderEntity.getName());
|
|
|
+ map.put("$Sex$", StatusEnum.SexStatusEnum.getValue(contractOrderEntity.getSex()));
|
|
|
+ map.put("$Birthday$", DateUtil.formatDateWithChineseSeparatorAndNoZeroFilled(contractOrderEntity.getBirth(), "yyyy/M/d"));
|
|
|
+ map.put("$Addr$", contractOrderEntity.getResidence());
|
|
|
+ map.put("$IDNo$", contractOrderEntity.getIdCard());
|
|
|
+ map.put("$Phone$", contractOrderEntity.getPhone());
|
|
|
+ if (contractOrderEntity.getJointFlag() == 1) {
|
|
|
map.put("$MateName$", contractOrderEntity.getJointName());
|
|
|
map.put("$MateSex$", StatusEnum.SexStatusEnum.getValue(contractOrderEntity.getJointSex()));
|
|
|
- map.put("$MateBirthday$", dateDestFormatter.format(date));
|
|
|
+ map.put("$MateBirthday$", DateUtil.formatDateWithChineseSeparatorAndNoZeroFilled(contractOrderEntity.getIdCard().substring(6, 14), "yyyyMMdd"));
|
|
|
map.put("$MateAddr$", contractOrderEntity.getJointResidence());
|
|
|
map.put("$MatePhone$", contractOrderEntity.getJointPhone());
|
|
|
-
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
+ } else {
|
|
|
+ map.put("$MateName$", "无");
|
|
|
+ map.put("$MateSex$", "无");
|
|
|
+ map.put("$MateBirthday$", "无");
|
|
|
+ map.put("$MateAddr$", "无");
|
|
|
+ map.put("$MatePhone$", "无");
|
|
|
}
|
|
|
- } else {
|
|
|
- map.put("$MateName$", "无");
|
|
|
- map.put("$MateSex$", "无");
|
|
|
- map.put("$MateBirthday$", "无");
|
|
|
- map.put("$MateAddr$", "无");
|
|
|
- map.put("$MatePhone$", "无");
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
}
|
|
|
// 准备银行信息
|
|
|
BankEntity bank = bankMapper.selectById(contractOrderEntity.getBankId());
|