fix: 贷款账单,功能完善,新增时插入数据,修改明细时也进行自动转账。
This commit is contained in:
@@ -74,9 +74,9 @@ public class InstallmentHistoryDetail extends BaseEntity
|
|||||||
|
|
||||||
/** 还款期数 */
|
/** 还款期数 */
|
||||||
@ApiModelProperty(value="还款期数")
|
@ApiModelProperty(value="还款期数")
|
||||||
@Excel(name = "还款期数")
|
@Excel(name = "还款期数")
|
||||||
private Integer periods;
|
private Integer periods;
|
||||||
|
private Long repaymentAccountId;
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||||
@@ -96,6 +96,7 @@ public class InstallmentHistoryDetail extends BaseEntity
|
|||||||
.append("remark", getRemark())
|
.append("remark", getRemark())
|
||||||
.append("type", getType())
|
.append("type", getType())
|
||||||
.append("periods", getPeriods())
|
.append("periods", getPeriods())
|
||||||
|
.append("repaymentAccountId", getRepaymentAccountId())
|
||||||
.toString();
|
.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,6 @@ public class InstallmentHistoryDetailVo extends InstallmentHistoryDetail
|
|||||||
{
|
{
|
||||||
private String bankCardLendName;
|
private String bankCardLendName;
|
||||||
|
|
||||||
|
private String repaymentAccountName;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,5 +46,8 @@ public class InstallmentHistoryVo extends InstallmentHistory
|
|||||||
@ApiModelProperty(value="收款账户卡号")
|
@ApiModelProperty(value="收款账户卡号")
|
||||||
private String receivingAccountCode;
|
private String receivingAccountCode;
|
||||||
|
|
||||||
|
@ApiModelProperty(value="收款账户名称卡号")
|
||||||
|
private String receivingAccountNameCode;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -759,7 +759,7 @@ public class AccountsTransferRecordServiceImpl implements IAccountsTransferRecor
|
|||||||
}
|
}
|
||||||
|
|
||||||
AccountsDealRecord dealInterest=new AccountsDealRecord();
|
AccountsDealRecord dealInterest=new AccountsDealRecord();
|
||||||
|
dealInterest.setTransferRecordId(accountsTransferRecord.getId());
|
||||||
dealInterest.setAccountId(debitAccount.getAccountId());
|
dealInterest.setAccountId(debitAccount.getAccountId());
|
||||||
dealInterest.setId(IdWorker.getId());
|
dealInterest.setId(IdWorker.getId());
|
||||||
//支出金额
|
//支出金额
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import com.intc.common.core.utils.IdWorker;
|
|||||||
import com.intc.common.core.utils.StringUtils;
|
import com.intc.common.core.utils.StringUtils;
|
||||||
import com.intc.common.security.utils.SecurityUtils;
|
import com.intc.common.security.utils.SecurityUtils;
|
||||||
import com.intc.invest.domain.AccountsDealRecord;
|
import com.intc.invest.domain.AccountsDealRecord;
|
||||||
|
import com.intc.invest.domain.AccountsTransferRecord;
|
||||||
import com.intc.invest.domain.InstallmentHistory;
|
import com.intc.invest.domain.InstallmentHistory;
|
||||||
import com.intc.invest.domain.InstallmentHistoryDetail;
|
import com.intc.invest.domain.InstallmentHistoryDetail;
|
||||||
import com.intc.invest.domain.dto.InstallmentHistoryDetailDto;
|
import com.intc.invest.domain.dto.InstallmentHistoryDetailDto;
|
||||||
@@ -15,6 +16,7 @@ import com.intc.invest.mapper.AccountsDealRecordMapper;
|
|||||||
import com.intc.invest.mapper.AccountsMapper;
|
import com.intc.invest.mapper.AccountsMapper;
|
||||||
import com.intc.invest.mapper.InstallmentHistoryDetailMapper;
|
import com.intc.invest.mapper.InstallmentHistoryDetailMapper;
|
||||||
import com.intc.invest.mapper.InstallmentHistoryMapper;
|
import com.intc.invest.mapper.InstallmentHistoryMapper;
|
||||||
|
import com.intc.invest.service.IAccountsTransferRecordService;
|
||||||
import com.intc.invest.service.IInstallmentHistoryDetailService;
|
import com.intc.invest.service.IInstallmentHistoryDetailService;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@@ -43,6 +45,9 @@ public class InstallmentHistoryDetailServiceImpl implements IInstallmentHistoryD
|
|||||||
@Resource
|
@Resource
|
||||||
private InstallmentHistoryMapper installmentHistoryMapper;
|
private InstallmentHistoryMapper installmentHistoryMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private IAccountsTransferRecordService transferRecordService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询分期历史明细
|
* 查询分期历史明细
|
||||||
*
|
*
|
||||||
@@ -171,6 +176,21 @@ public class InstallmentHistoryDetailServiceImpl implements IInstallmentHistoryD
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//如果是贷款
|
||||||
|
if(installmentHistoryDetail.getType().equals("3")){
|
||||||
|
AccountsTransferRecord transferRecord=new AccountsTransferRecord();
|
||||||
|
transferRecord.setOutAccountId(installmentHistoryDetail.getBankCardLendId());
|
||||||
|
transferRecord.setInAccountId(installmentHistoryDetail.getRepaymentAccountId());
|
||||||
|
transferRecord.setAmount(installmentHistoryDetail.getPrincipal());
|
||||||
|
transferRecord.setCommission(installmentHistoryDetail.getInterest());
|
||||||
|
transferRecord.setId(IdWorker.getId());
|
||||||
|
transferRecord.setCreateTime(new Date());
|
||||||
|
//借贷
|
||||||
|
transferRecord.setType("5");
|
||||||
|
//还款
|
||||||
|
transferRecord.setDealType("2");
|
||||||
|
transferRecordService.insertAccountsTransferRecord(transferRecord);
|
||||||
|
}
|
||||||
//应还款金额=本金加利息
|
//应还款金额=本金加利息
|
||||||
installmentHistoryDetail.setCurrentAmount(installmentHistoryDetail.getPrincipal()+installmentHistoryDetail.getInterest());
|
installmentHistoryDetail.setCurrentAmount(installmentHistoryDetail.getPrincipal()+installmentHistoryDetail.getInterest());
|
||||||
return installmentHistoryDetailMapper.updateInstallmentHistoryDetail(installmentHistoryDetail);
|
return installmentHistoryDetailMapper.updateInstallmentHistoryDetail(installmentHistoryDetail);
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import com.intc.common.core.utils.DateUtils;
|
|||||||
import com.intc.common.core.utils.IdWorker;
|
import com.intc.common.core.utils.IdWorker;
|
||||||
import com.intc.common.core.utils.StringUtils;
|
import com.intc.common.core.utils.StringUtils;
|
||||||
import com.intc.common.security.utils.SecurityUtils;
|
import com.intc.common.security.utils.SecurityUtils;
|
||||||
|
import com.intc.invest.domain.AccountsTransferRecord;
|
||||||
import com.intc.invest.domain.InstallmentHistory;
|
import com.intc.invest.domain.InstallmentHistory;
|
||||||
import com.intc.invest.domain.InstallmentHistoryDetail;
|
import com.intc.invest.domain.InstallmentHistoryDetail;
|
||||||
import com.intc.invest.domain.dto.InstallmentHistoryDetailDto;
|
import com.intc.invest.domain.dto.InstallmentHistoryDetailDto;
|
||||||
@@ -12,6 +13,8 @@ import com.intc.invest.domain.vo.InstallmentHistoryDetailVo;
|
|||||||
import com.intc.invest.domain.vo.InstallmentHistoryVo;
|
import com.intc.invest.domain.vo.InstallmentHistoryVo;
|
||||||
import com.intc.invest.mapper.InstallmentHistoryDetailMapper;
|
import com.intc.invest.mapper.InstallmentHistoryDetailMapper;
|
||||||
import com.intc.invest.mapper.InstallmentHistoryMapper;
|
import com.intc.invest.mapper.InstallmentHistoryMapper;
|
||||||
|
import com.intc.invest.service.IAccountsTransferRecordService;
|
||||||
|
import com.intc.invest.service.ICreditCardBillService;
|
||||||
import com.intc.invest.service.IInstallmentHistoryService;
|
import com.intc.invest.service.IInstallmentHistoryService;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@@ -37,6 +40,10 @@ public class InstallmentHistoryServiceImpl implements IInstallmentHistoryService
|
|||||||
@Resource
|
@Resource
|
||||||
private InstallmentHistoryDetailMapper installmentHistoryDetailMapper;
|
private InstallmentHistoryDetailMapper installmentHistoryDetailMapper;
|
||||||
|
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private IAccountsTransferRecordService transferRecordService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询网贷及分期历史
|
* 查询网贷及分期历史
|
||||||
*
|
*
|
||||||
@@ -82,6 +89,13 @@ public class InstallmentHistoryServiceImpl implements IInstallmentHistoryService
|
|||||||
interestRate=interestRate*12/installmentHistory.getPeriod();
|
interestRate=interestRate*12/installmentHistory.getPeriod();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(installmentHistory.getReceivingAccountCode()!=null){
|
||||||
|
installmentHistory.setReceivingAccountNameCode(installmentHistory.getReceivingAccountName()+"("+ StringUtils.getLastNumberChars(4,installmentHistory.getReceivingAccountCode()+")"));
|
||||||
|
}else {
|
||||||
|
installmentHistory.setReceivingAccountNameCode(installmentHistory.getReceivingAccountName());
|
||||||
|
}
|
||||||
|
|
||||||
interestRate=interestRate*100;
|
interestRate=interestRate*100;
|
||||||
String calculateInterestRate= decimalFormat.format(interestRate)+"%";
|
String calculateInterestRate= decimalFormat.format(interestRate)+"%";
|
||||||
installmentHistory.setCalculateInterestRate(calculateInterestRate);
|
installmentHistory.setCalculateInterestRate(calculateInterestRate);
|
||||||
@@ -121,6 +135,22 @@ public class InstallmentHistoryServiceImpl implements IInstallmentHistoryService
|
|||||||
}
|
}
|
||||||
//插入分期明细
|
//插入分期明细
|
||||||
insertInstallmentHistoryDetail(installmentHistory);
|
insertInstallmentHistoryDetail(installmentHistory);
|
||||||
|
//如果是信贷账户,需要生成一条借贷信息记录
|
||||||
|
if(installmentHistory.getType().equals("3")){
|
||||||
|
|
||||||
|
AccountsTransferRecord transferRecord=new AccountsTransferRecord();
|
||||||
|
transferRecord.setOutAccountId(installmentHistory.getBankCardLendId());
|
||||||
|
transferRecord.setInAccountId(installmentHistory.getReceivingAccountId());
|
||||||
|
transferRecord.setAmount(installmentHistory.getInstallmentAmount());
|
||||||
|
transferRecord.setId(IdWorker.getId());
|
||||||
|
transferRecord.setCreateTime(installmentHistory.getCreateTime());
|
||||||
|
//借贷
|
||||||
|
transferRecord.setType("5");
|
||||||
|
//借款
|
||||||
|
transferRecord.setDealType("1");
|
||||||
|
transferRecordService.insertAccountsTransferRecord(transferRecord);
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return installmentHistoryMapper.insertInstallmentHistory(installmentHistory);
|
return installmentHistoryMapper.insertInstallmentHistory(installmentHistory);
|
||||||
@@ -169,6 +199,7 @@ public class InstallmentHistoryServiceImpl implements IInstallmentHistoryService
|
|||||||
|
|
||||||
detail.setCreateBy(SecurityUtils.getUsername());
|
detail.setCreateBy(SecurityUtils.getUsername());
|
||||||
detail.setCreateTime(DateUtils.getNowDate());
|
detail.setCreateTime(DateUtils.getNowDate());
|
||||||
|
detail.setRepaymentAccountId(installmentHistory.getReceivingAccountId());
|
||||||
installmentHistoryDetailMapper.insertInstallmentHistoryDetail(detail);
|
installmentHistoryDetailMapper.insertInstallmentHistoryDetail(detail);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -22,6 +22,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<result property="type" column="type" />
|
<result property="type" column="type" />
|
||||||
<result property="periods" column="periods" />
|
<result property="periods" column="periods" />
|
||||||
<result property="bankCardLendName" column="bank_card_lend_name" />
|
<result property="bankCardLendName" column="bank_card_lend_name" />
|
||||||
|
<result property="repaymentAccountId" column="repayment_account_id" />
|
||||||
|
<result property="repaymentAccountName" column="repayment_account_name" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectInstallmentHistoryDetailVo">
|
<sql id="selectInstallmentHistoryDetailVo">
|
||||||
@@ -42,16 +44,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
a.remark,
|
a.remark,
|
||||||
a.type,
|
a.type,
|
||||||
a.periods,
|
a.periods,
|
||||||
|
a.repayment_account_id,
|
||||||
CONCAT(bcl."name",
|
CONCAT(bcl."name",
|
||||||
'(',
|
'(',
|
||||||
right(bcl.code,
|
right(bcl.code,
|
||||||
4),
|
4),
|
||||||
')') as bank_card_lend_name
|
')') as bank_card_lend_name,
|
||||||
|
CONCAT(debit."name",
|
||||||
|
'(',
|
||||||
|
right(debit.code,
|
||||||
|
4),
|
||||||
|
')') as repayment_account_name
|
||||||
from
|
from
|
||||||
installment_history_detail a
|
installment_history_detail a
|
||||||
left join bank_card_lend bcl on
|
left join bank_card_lend bcl on
|
||||||
bcl.id = a.bank_card_lend_id
|
bcl.id = a.bank_card_lend_id
|
||||||
left join installment_history ih on ih.id=a.installment_history_id
|
left join installment_history ih on ih.id=a.installment_history_id
|
||||||
|
left join bank_card_lend debit on
|
||||||
|
debit.id = a.repayment_account_id
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="selectInstallmentHistoryDetailList" parameterType="InstallmentHistoryDetailDto" resultMap="InstallmentHistoryDetailResult">
|
<select id="selectInstallmentHistoryDetailList" parameterType="InstallmentHistoryDetailDto" resultMap="InstallmentHistoryDetailResult">
|
||||||
@@ -108,6 +118,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="remark != null">remark,</if>
|
<if test="remark != null">remark,</if>
|
||||||
<if test="type != null">type,</if>
|
<if test="type != null">type,</if>
|
||||||
<if test="periods != null">periods,</if>
|
<if test="periods != null">periods,</if>
|
||||||
|
<if test="repaymentAccountId != null">repayment_account_id,</if>
|
||||||
</trim>
|
</trim>
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
<if test="id != null">#{id},</if>
|
<if test="id != null">#{id},</if>
|
||||||
@@ -126,6 +137,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="remark != null">#{remark},</if>
|
<if test="remark != null">#{remark},</if>
|
||||||
<if test="type != null">#{type},</if>
|
<if test="type != null">#{type},</if>
|
||||||
<if test="periods != null">#{periods},</if>
|
<if test="periods != null">#{periods},</if>
|
||||||
|
<if test="repaymentAccountId != null">#{repaymentAccountId},</if>
|
||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
@@ -147,6 +159,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="remark != null">remark = #{remark},</if>
|
<if test="remark != null">remark = #{remark},</if>
|
||||||
<if test="type != null">type = #{type},</if>
|
<if test="type != null">type = #{type},</if>
|
||||||
<if test="periods != null">periods = #{periods},</if>
|
<if test="periods != null">periods = #{periods},</if>
|
||||||
|
<if test="repaymentAccountId != null">repayment_account_id = #{repaymentAccountId},</if>
|
||||||
</trim>
|
</trim>
|
||||||
where id = #{id}
|
where id = #{id}
|
||||||
</update>
|
</update>
|
||||||
|
|||||||
Reference in New Issue
Block a user