|
@@ -270,6 +270,9 @@ public class LedgerManagementServiceImpl implements LedgerManagementService {
|
|
@Value("${config.smbRefinancingPlanUpdate.url}")
|
|
@Value("${config.smbRefinancingPlanUpdate.url}")
|
|
private String smbRefinancingPlanUpdateUrl;
|
|
private String smbRefinancingPlanUpdateUrl;
|
|
|
|
|
|
|
|
+ @Value("${config.smbBeforeRepayPlanUpdate.url}")
|
|
|
|
+ private String smbBeforeRepayPlanUpdateUrl;
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public LedgerAccountBasicInfo get(Long id) {
|
|
public LedgerAccountBasicInfo get(Long id) {
|
|
return ledgerAccountBasicInfoMapper.getListInfo(id);
|
|
return ledgerAccountBasicInfoMapper.getListInfo(id);
|
|
@@ -525,7 +528,24 @@ public class LedgerManagementServiceImpl implements LedgerManagementService {
|
|
@Override
|
|
@Override
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
public void repayApplyBySMB(LedgerFundGoodsAssign ledgerFundGoodsAssign) {
|
|
public void repayApplyBySMB(LedgerFundGoodsAssign ledgerFundGoodsAssign) {
|
|
|
|
+
|
|
FinancingLoanInfo financingLoanInfo = getFinancingLoanInfoByAccountsReceivableId(ledgerFundGoodsAssign.getSopAccountsReceivableId());
|
|
FinancingLoanInfo financingLoanInfo = getFinancingLoanInfoByAccountsReceivableId(ledgerFundGoodsAssign.getSopAccountsReceivableId());
|
|
|
|
+
|
|
|
|
+ //还款前计划查询和更新、防止因自动批扣导致计划发生过变更
|
|
|
|
+ RepayPlanResp repayPlanResp = smbApiService.repayPlanQuery(financingLoanInfo.getOpenId(), financingLoanInfo.getDueBillNo());
|
|
|
|
+ if (repayPlanResp != null) {
|
|
|
|
+ SmbRefinancingInfo smbRefinancingInfo = new SmbRefinancingInfo();
|
|
|
|
+ smbRefinancingInfo.setContractNo(financingLoanInfo.getContractNo());
|
|
|
|
+ smbRefinancingInfo.setQuotaDisburseBatch(financingLoanInfo.getQuotaDisburseBatch());
|
|
|
|
+ smbRefinancingInfo.setRepayPlanResp(repayPlanResp);
|
|
|
|
+
|
|
|
|
+ ResponseEntity<String> responseEntity = restTemplate.postForEntity(smbBeforeRepayPlanUpdateUrl, smbRefinancingInfo, String.class);
|
|
|
|
+ ResponseJson responseJson = JSONUtil.toBean(responseEntity.getBody(), ResponseJson.class);
|
|
|
|
+ if (responseEntity.getStatusCode().value() != HttpStatus.OK.value() || !responseJson.isSuccess()) {
|
|
|
|
+ throw new BusinessException(CodeUtil.FAIL, "苏商还款计划更新推送sop失败:" + responseJson.getMsg().toString());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
RepayApply repayApply = new RepayApply();
|
|
RepayApply repayApply = new RepayApply();
|
|
if (financingLoanInfo != null) {
|
|
if (financingLoanInfo != null) {
|
|
repayApply.setDuebillNo(financingLoanInfo.getDueBillNo());
|
|
repayApply.setDuebillNo(financingLoanInfo.getDueBillNo());
|
|
@@ -545,20 +565,23 @@ public class LedgerManagementServiceImpl implements LedgerManagementService {
|
|
bizNo = bizNo.substring(0, 32);
|
|
bizNo = bizNo.substring(0, 32);
|
|
}
|
|
}
|
|
repayApply.setBizNo(bizNo);
|
|
repayApply.setBizNo(bizNo);
|
|
|
|
+ //提交还款申请
|
|
RepayStatusResp repayStatusResp = smbApiService.repayApply(repayApply, financingLoanInfo.getOpenId());
|
|
RepayStatusResp repayStatusResp = smbApiService.repayApply(repayApply, financingLoanInfo.getOpenId());
|
|
if (repayStatusResp != null) {
|
|
if (repayStatusResp != null) {
|
|
//保存资方还款信息
|
|
//保存资方还款信息
|
|
- saveFinancingLoanInfo(financingLoanInfo, repayStatusResp, bizNo);
|
|
|
|
|
|
+ saveFinancingPaymentInfo(financingLoanInfo, repayStatusResp, bizNo);
|
|
if ("01".equals(repayStatusResp.getRepayStatus())) {
|
|
if ("01".equals(repayStatusResp.getRepayStatus())) {
|
|
//如果状态为还款成功
|
|
//如果状态为还款成功
|
|
//如果还款状态由还款中->还款成功 查询最新的还款计划,同步更新到sop中
|
|
//如果还款状态由还款中->还款成功 查询最新的还款计划,同步更新到sop中
|
|
- RepayPlanResp repayPlanResp = smbApiService.repayPlanQuery(financingLoanInfo.getOpenId(), financingLoanInfo.getDueBillNo());
|
|
|
|
|
|
+ repayPlanResp = smbApiService.repayPlanQuery(financingLoanInfo.getOpenId(), financingLoanInfo.getDueBillNo());
|
|
if (repayPlanResp != null) {
|
|
if (repayPlanResp != null) {
|
|
SmbRefinancingInfo smbRefinancingInfo = new SmbRefinancingInfo();
|
|
SmbRefinancingInfo smbRefinancingInfo = new SmbRefinancingInfo();
|
|
smbRefinancingInfo.setContractNo(financingLoanInfo.getContractNo());
|
|
smbRefinancingInfo.setContractNo(financingLoanInfo.getContractNo());
|
|
smbRefinancingInfo.setQuotaDisburseBatch(financingLoanInfo.getQuotaDisburseBatch());
|
|
smbRefinancingInfo.setQuotaDisburseBatch(financingLoanInfo.getQuotaDisburseBatch());
|
|
smbRefinancingInfo.setRepayPlanResp(repayPlanResp);
|
|
smbRefinancingInfo.setRepayPlanResp(repayPlanResp);
|
|
smbRefinancingInfo.setRepaymentMethod(SmbRepaymentMethodEnum.PROACTIVE_REPAYMENT.getCode());
|
|
smbRefinancingInfo.setRepaymentMethod(SmbRepaymentMethodEnum.PROACTIVE_REPAYMENT.getCode());
|
|
|
|
+ smbRefinancingInfo.setRepayPrincipal(new BigDecimal(repayStatusResp.getHxCapi()));
|
|
|
|
+ smbRefinancingInfo.setRepayInterest(new BigDecimal(repayStatusResp.getHxInte()));
|
|
|
|
|
|
ResponseEntity<String> responseEntity = restTemplate.postForEntity(smbRefinancingPlanUpdateUrl, smbRefinancingInfo, String.class);
|
|
ResponseEntity<String> responseEntity = restTemplate.postForEntity(smbRefinancingPlanUpdateUrl, smbRefinancingInfo, String.class);
|
|
ResponseJson responseJson = JSONUtil.toBean(responseEntity.getBody(), ResponseJson.class);
|
|
ResponseJson responseJson = JSONUtil.toBean(responseEntity.getBody(), ResponseJson.class);
|
|
@@ -576,7 +599,7 @@ public class LedgerManagementServiceImpl implements LedgerManagementService {
|
|
* @param financingLoanInfo
|
|
* @param financingLoanInfo
|
|
* @param repayStatusResp
|
|
* @param repayStatusResp
|
|
*/
|
|
*/
|
|
- private void saveFinancingLoanInfo(FinancingLoanInfo financingLoanInfo, RepayStatusResp repayStatusResp, String bizNo) {
|
|
|
|
|
|
+ private void saveFinancingPaymentInfo(FinancingLoanInfo financingLoanInfo, RepayStatusResp repayStatusResp, String bizNo) {
|
|
FinancingPaymentInfo financingPaymentInfo = new FinancingPaymentInfo(financingLoanInfo);
|
|
FinancingPaymentInfo financingPaymentInfo = new FinancingPaymentInfo(financingLoanInfo);
|
|
//bizNo
|
|
//bizNo
|
|
financingPaymentInfo.setBizNo(bizNo);
|
|
financingPaymentInfo.setBizNo(bizNo);
|