fix:分期历史,增加计算利率。
This commit is contained in:
@@ -103,6 +103,11 @@ public class InstallmentHistory extends BaseEntity
|
|||||||
/** 删除标志(0代表存在 1代表删除) */
|
/** 删除标志(0代表存在 1代表删除) */
|
||||||
private String delFlag;
|
private String delFlag;
|
||||||
|
|
||||||
|
/** 计算利率 */
|
||||||
|
@ApiModelProperty(value="计算利率")
|
||||||
|
@Excel(name = "计算利率")
|
||||||
|
private String calculateInterestRate;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||||
@@ -127,6 +132,7 @@ public class InstallmentHistory extends BaseEntity
|
|||||||
.append("delFlag", getDelFlag())
|
.append("delFlag", getDelFlag())
|
||||||
.append("remark", getRemark())
|
.append("remark", getRemark())
|
||||||
.append("balance", getBalance())
|
.append("balance", getBalance())
|
||||||
|
.append("calculateInterestRate", getCalculateInterestRate())
|
||||||
.toString();
|
.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,9 @@ import com.ruoyi.common.core.utils.StringUtils;
|
|||||||
import com.ruoyi.common.security.utils.SecurityUtils;
|
import com.ruoyi.common.security.utils.SecurityUtils;
|
||||||
import com.ruoyi.invest.domain.InstallmentHistory;
|
import com.ruoyi.invest.domain.InstallmentHistory;
|
||||||
import com.ruoyi.invest.domain.InstallmentHistoryDetail;
|
import com.ruoyi.invest.domain.InstallmentHistoryDetail;
|
||||||
|
import com.ruoyi.invest.domain.dto.InstallmentHistoryDetailDto;
|
||||||
import com.ruoyi.invest.domain.dto.InstallmentHistoryDto;
|
import com.ruoyi.invest.domain.dto.InstallmentHistoryDto;
|
||||||
|
import com.ruoyi.invest.domain.vo.InstallmentHistoryDetailVo;
|
||||||
import com.ruoyi.invest.domain.vo.InstallmentHistoryVo;
|
import com.ruoyi.invest.domain.vo.InstallmentHistoryVo;
|
||||||
import com.ruoyi.invest.mapper.InstallmentHistoryDetailMapper;
|
import com.ruoyi.invest.mapper.InstallmentHistoryDetailMapper;
|
||||||
import com.ruoyi.invest.mapper.InstallmentHistoryMapper;
|
import com.ruoyi.invest.mapper.InstallmentHistoryMapper;
|
||||||
@@ -57,12 +59,24 @@ public class InstallmentHistoryServiceImpl implements IInstallmentHistoryService
|
|||||||
{
|
{
|
||||||
List<InstallmentHistoryVo> installmentHistoryVoList=installmentHistoryMapper.selectInstallmentHistoryList(installmentHistoryDto);
|
List<InstallmentHistoryVo> installmentHistoryVoList=installmentHistoryMapper.selectInstallmentHistoryList(installmentHistoryDto);
|
||||||
//修改名称加卡号
|
//修改名称加卡号
|
||||||
|
DecimalFormat decimalFormat = new DecimalFormat("#.##");
|
||||||
for (InstallmentHistoryVo installmentHistory : installmentHistoryVoList) {
|
for (InstallmentHistoryVo installmentHistory : installmentHistoryVoList) {
|
||||||
if(installmentHistory.getBankCode()!=null){
|
if(installmentHistory.getBankCode()!=null){
|
||||||
installmentHistory.setBankNameCode(installmentHistory.getBankName()+"("+ StringUtils.getLastNumberChars(4,installmentHistory.getBankCode()+")"));
|
installmentHistory.setBankNameCode(installmentHistory.getBankName()+"("+ StringUtils.getLastNumberChars(4,installmentHistory.getBankCode()+")"));
|
||||||
}else {
|
}else {
|
||||||
installmentHistory.setBankNameCode(installmentHistory.getBankName());
|
installmentHistory.setBankNameCode(installmentHistory.getBankName());
|
||||||
}
|
}
|
||||||
|
double interest=installmentHistory.getTotalInterest();
|
||||||
|
double interestRate=0;
|
||||||
|
if(interest>0){
|
||||||
|
interestRate=interest/installmentHistory.getInstallmentAmount();
|
||||||
|
if(installmentHistory.getPeriod()!=null){
|
||||||
|
interestRate=interestRate*12/installmentHistory.getPeriod();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
interestRate=interestRate*100;
|
||||||
|
String calculateInterestRate= decimalFormat.format(interestRate)+"%";
|
||||||
|
installmentHistory.setCalculateInterestRate(calculateInterestRate);
|
||||||
}
|
}
|
||||||
return installmentHistoryVoList;
|
return installmentHistoryVoList;
|
||||||
}
|
}
|
||||||
@@ -173,13 +187,45 @@ public class InstallmentHistoryServiceImpl implements IInstallmentHistoryService
|
|||||||
installmentHistory.setCloseDate(calendarStart.getTime());
|
installmentHistory.setCloseDate(calendarStart.getTime());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//// //插入分期明细
|
|
||||||
// insertInstallmentHistoryDetail(installmentHistory);
|
//更新利率信息
|
||||||
|
updateInterestRate(installmentHistory);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return installmentHistoryMapper.updateInstallmentHistory(installmentHistory);
|
return installmentHistoryMapper.updateInstallmentHistory(installmentHistory);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新利率
|
||||||
|
*
|
||||||
|
* @param
|
||||||
|
*/
|
||||||
|
public void updateInterestRate(InstallmentHistory installmentHistory)
|
||||||
|
{
|
||||||
|
DecimalFormat decimalFormat = new DecimalFormat("#.##");
|
||||||
|
|
||||||
|
InstallmentHistoryDetailDto installmentHistoryDetailDto=new InstallmentHistoryDetailDto();
|
||||||
|
installmentHistoryDetailDto.setInstallmentHistoryId(installmentHistory.getId());
|
||||||
|
List<InstallmentHistoryDetailVo> detailList=installmentHistoryDetailMapper.selectInstallmentHistoryDetailList(installmentHistoryDetailDto);
|
||||||
|
double interest =0;
|
||||||
|
double interestRate=0;
|
||||||
|
if(detailList.size()>0){
|
||||||
|
interest = detailList.stream().mapToDouble(InstallmentHistoryDetailVo::getInterest).sum();
|
||||||
|
}
|
||||||
|
if(interest==0){
|
||||||
|
interest=installmentHistory.getTotalInterest();
|
||||||
|
}
|
||||||
|
if(interest>0){
|
||||||
|
interestRate=interest/installmentHistory.getInstallmentAmount();
|
||||||
|
if(installmentHistory.getPeriod()!=null){
|
||||||
|
interestRate=interestRate*12/installmentHistory.getPeriod();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
interestRate=interestRate*100;
|
||||||
|
String calculateInterestRate= decimalFormat.format(interestRate)+"%";
|
||||||
|
installmentHistory.setCalculateInterestRate(calculateInterestRate);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量删除网贷及分期历史
|
* 批量删除网贷及分期历史
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -107,10 +107,10 @@ public class InvestJobImpl implements IInvestJobService
|
|||||||
accountsDealRecordDto.setEndDateTime(endDate);
|
accountsDealRecordDto.setEndDateTime(endDate);
|
||||||
//获取所有交易记录
|
//获取所有交易记录
|
||||||
List<AccountsDealRecordVo> accountsDealRecordVoList=accountsDealRecordMapper.selectAccountsDealRecordList(accountsDealRecordDto);
|
List<AccountsDealRecordVo> accountsDealRecordVoList=accountsDealRecordMapper.selectAccountsDealRecordList(accountsDealRecordDto);
|
||||||
//支出转为负数
|
//收入转为负数
|
||||||
for (AccountsDealRecordVo vo:accountsDealRecordVoList
|
for (AccountsDealRecordVo vo:accountsDealRecordVoList
|
||||||
) {
|
) {
|
||||||
if(vo.getDealType().equals("2")){
|
if(vo.getDealType().equals("1")){
|
||||||
vo.setAmount(vo.getAmount()*(-1));
|
vo.setAmount(vo.getAmount()*(-1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -129,10 +129,15 @@ public class InvestJobImpl implements IInvestJobService
|
|||||||
creditCardBill.setUpdateTime(DateUtils.getNowDate());
|
creditCardBill.setUpdateTime(DateUtils.getNowDate());
|
||||||
creditCardBill.setId(creditCardBillVo.getId());
|
creditCardBill.setId(creditCardBillVo.getId());
|
||||||
creditCardBill.setBillAmount(billAmount);
|
creditCardBill.setBillAmount(billAmount);
|
||||||
|
//如果账单日与当前日期相同,将账单修改为已出账
|
||||||
|
if(billDateStr.equals(formatter.format(new Date()))){
|
||||||
|
creditCardBill.setBillState("1");
|
||||||
|
}
|
||||||
//更新未出账单
|
//更新未出账单
|
||||||
creditCardBillMapper.updateCreditCardBill(creditCardBill);
|
creditCardBillMapper.updateCreditCardBill(creditCardBill);
|
||||||
}else {
|
}else {
|
||||||
|
//如果账单日大于当前日期,未出账,进行插入操作
|
||||||
|
if(billDateStr.compareTo(formatter.format(new Date()))==1){
|
||||||
CreditCardBill creditCardBill=new CreditCardBill();
|
CreditCardBill creditCardBill=new CreditCardBill();
|
||||||
try {
|
try {
|
||||||
creditCardBill.setBillDate(formatter.parse(billDateStr));
|
creditCardBill.setBillDate(formatter.parse(billDateStr));
|
||||||
@@ -150,6 +155,7 @@ public class InvestJobImpl implements IInvestJobService
|
|||||||
//插入未出账单
|
//插入未出账单
|
||||||
creditCardBillMapper.insertCreditCardBill(creditCardBill);
|
creditCardBillMapper.insertCreditCardBill(creditCardBill);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<result property="bankName" column="bank_name" />
|
<result property="bankName" column="bank_name" />
|
||||||
<result property="bankCode" column="bank_code" />
|
<result property="bankCode" column="bank_code" />
|
||||||
<result property="repaymentDate" column="repayment_date" />
|
<result property="repaymentDate" column="repayment_date" />
|
||||||
|
<result property="calculateInterestRate" column="calculate_interest_rate" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectInstallmentHistoryVo">
|
<sql id="selectInstallmentHistoryVo">
|
||||||
@@ -41,6 +42,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
a.installment_amount,
|
a.installment_amount,
|
||||||
a.installment_date,
|
a.installment_date,
|
||||||
a.period,
|
a.period,
|
||||||
|
a.calculate_interest_rate,
|
||||||
(
|
(
|
||||||
select
|
select
|
||||||
CASE
|
CASE
|
||||||
@@ -129,7 +131,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="delFlag != null">del_flag,</if>
|
<if test="delFlag != null">del_flag,</if>
|
||||||
<if test="remark != null">remark,</if>
|
<if test="remark != null">remark,</if>
|
||||||
<if test="balance != null">balance,</if>
|
<if test="balance != null">balance,</if>
|
||||||
|
<if test="calculateInterestRate != null">calculate_interest_rate,</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>
|
||||||
@@ -153,7 +155,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="delFlag != null">#{delFlag},</if>
|
<if test="delFlag != null">#{delFlag},</if>
|
||||||
<if test="remark != null">#{remark},</if>
|
<if test="remark != null">#{remark},</if>
|
||||||
<if test="balance != null">#{balance},</if>
|
<if test="balance != null">#{balance},</if>
|
||||||
|
<if test="calculateInterestRate != null">#{calculateInterestRate},</if>
|
||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
@@ -180,6 +182,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="delFlag != null">del_flag = #{delFlag},</if>
|
<if test="delFlag != null">del_flag = #{delFlag},</if>
|
||||||
<if test="remark != null">remark = #{remark},</if>
|
<if test="remark != null">remark = #{remark},</if>
|
||||||
<if test="balance != null">balance = #{balance},</if>
|
<if test="balance != null">balance = #{balance},</if>
|
||||||
|
<if test="calculateInterestRate != null">calculate_interest_rate = #{calculateInterestRate},</if>
|
||||||
</trim>
|
</trim>
|
||||||
where id = #{id}
|
where id = #{id}
|
||||||
</update>
|
</update>
|
||||||
|
|||||||
Reference in New Issue
Block a user