fix:账户交易记录,增加类别子类字段,用于日常支出统计明细。

This commit is contained in:
tianyongbao
2024-07-15 22:37:00 +08:00
parent 3904e7ed9b
commit c9062f21e7
6 changed files with 44 additions and 1 deletions

View File

@@ -69,6 +69,11 @@ public class AccountsDealRecord extends BaseEntity
@Excel(name = "当前余额")
private Double currentBalance;
/** 交易类别 */
@ApiModelProperty(value="交易子类别)")
@Excel(name = "交易子类别")
private String childCategory;
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
@@ -87,6 +92,7 @@ public class AccountsDealRecord extends BaseEntity
.append("dealCategory", getDealCategory())
.append("transferRecordId", getTransferRecordId())
.append("currentBalance", getCurrentBalance())
.append("childCategory", getChildCategory())
.toString();
}
}

View File

@@ -61,4 +61,8 @@ public class AccountsDealRecordDto extends BaseEntity implements Serializable
@ApiModelProperty(value="信用卡账单")
private String creditBill;
/** 交易子类别 */
@ApiModelProperty(value="交易子类别")
private String childCategory;
}

View File

@@ -24,4 +24,6 @@ public class AccountsDealRecordVo extends AccountsDealRecord
private String dealCategoryName;
private String childCategoryName;
}

View File

@@ -3,6 +3,7 @@ package com.ruoyi.invest.service.impl;
import com.ruoyi.common.core.utils.DateUtils;
import com.ruoyi.common.core.utils.IdWorker;
import com.ruoyi.common.core.utils.StringUtils;
import com.ruoyi.common.security.utils.DictUtils;
import com.ruoyi.common.security.utils.SecurityUtils;
import com.ruoyi.invest.domain.AccountsDealRecord;
import com.ruoyi.invest.domain.dto.AccountsDealRecordDto;
@@ -55,6 +56,18 @@ public class AccountsDealRecordServiceImpl implements IAccountsDealRecordService
public List<AccountsDealRecordVo> selectAccountsDealRecordList(AccountsDealRecordDto accountsDealRecordDto)
{
List<AccountsDealRecordVo> list=accountsDealRecordMapper.selectAccountsDealRecordList(accountsDealRecordDto);
//修改子类别
for (AccountsDealRecordVo accountDeal : list) {
if(accountDeal.getDealCategory().equals("1")){
String childCategoryName = DictUtils.getDictLabel("daily_expenses", accountDeal.getChildCategory());
accountDeal.setChildCategoryName(childCategoryName);
}
else {
String childCategoryName = DictUtils.getDictLabel("deal_category", accountDeal.getChildCategory());
accountDeal.setChildCategoryName(childCategoryName);
}
}
return list;
}

View File

@@ -195,6 +195,7 @@ public class AccountsTransferRecordServiceImpl implements IAccountsTransferRecor
creditDeal.setDealType("2");
//POS机刷卡
creditDeal.setDealCategory("5");
creditDeal.setChildCategory(creditDeal.getDealCategory());
//POS机名称+商户名称
creditDeal.setName(pos.getName()+"-"+pos.getMerchantName());
creditDeal.setRemark("交易商户:"+pos.getName()+"-"+pos.getMerchantName());
@@ -222,6 +223,7 @@ public class AccountsTransferRecordServiceImpl implements IAccountsTransferRecor
creditDeal.setDealType("1");
//POS机刷卡
creditDeal.setDealCategory("5");
creditDeal.setChildCategory(creditDeal.getDealCategory());
//POS机名称+信用卡+商户名称
creditDeal.setName(pos.getName()+"-"+creditAccount.getName()+""+ StringUtils.getLastNumberChars(3,creditAccount.getCode())+""+"-"+pos.getMerchantName());
creditDeal.setRemark("刷卡金额");
@@ -244,6 +246,7 @@ public class AccountsTransferRecordServiceImpl implements IAccountsTransferRecor
creditDeal.setDealType("2");
//POS机刷卡手续费
creditDeal.setDealCategory("13");
creditDeal.setChildCategory(creditDeal.getDealCategory());
//POS机名称+信用卡+商户名称
creditDeal.setName(pos.getName()+"-"+creditAccount.getName()+""+ StringUtils.getLastNumberChars(3,creditAccount.getCode())+""+"-"+pos.getMerchantName());
creditDeal.setRemark("刷卡手续费");
@@ -294,6 +297,7 @@ public class AccountsTransferRecordServiceImpl implements IAccountsTransferRecor
creditDeal.setDealType("1");
//信用卡还款6,0账单还款12
creditDeal.setDealCategory(accountsTransferRecord.getDealType());
creditDeal.setChildCategory(creditDeal.getDealCategory());
//储蓄卡还款至信用卡
creditDeal.setName(debitCardVo.getName()+""+StringUtils.getLastNumberChars(3,debitCardVo.getCode())+")还款至"+creditVo.getName()+""+StringUtils.getLastNumberChars(3,creditVo.getCode())+"");
creditDeal.setRemark("信用卡还款");
@@ -325,6 +329,7 @@ public class AccountsTransferRecordServiceImpl implements IAccountsTransferRecor
creditDeal.setDealType("2");
//信用卡还款
creditDeal.setDealCategory("6");
creditDeal.setChildCategory(creditDeal.getDealCategory());
//储蓄卡还款至信用卡
creditDeal.setName(debitCardVo.getName()+""+StringUtils.getLastNumberChars(3,debitCardVo.getCode())+")还款至"+creditVo.getName()+""+StringUtils.getLastNumberChars(3,creditVo.getCode())+"");
creditDeal.setRemark("信用卡还款");
@@ -394,6 +399,7 @@ public class AccountsTransferRecordServiceImpl implements IAccountsTransferRecor
}
//投资账户转账
dealRecord.setDealCategory("7");
dealRecord.setChildCategory(dealRecord.getDealCategory());
dealRecord.setRemark("投资账户转账");
dealRecord.setCreateBy(SecurityUtils.getUsername());
dealRecord.setCreateTime(accountsTransferRecord.getCreateTime());
@@ -434,6 +440,7 @@ public class AccountsTransferRecordServiceImpl implements IAccountsTransferRecor
}
//投资账户转账
dealRecord.setDealCategory("7");
dealRecord.setChildCategory(dealRecord.getDealCategory());
dealRecord.setRemark("投资账户转账");
dealRecord.setCreateBy(SecurityUtils.getUsername());
dealRecord.setCreateTime(accountsTransferRecord.getCreateTime());
@@ -479,6 +486,7 @@ public class AccountsTransferRecordServiceImpl implements IAccountsTransferRecor
creditDeal.setDealType("2");
//储蓄卡转账
creditDeal.setDealCategory("8");
creditDeal.setChildCategory(creditDeal.getDealCategory());
//储蓄卡转账
creditDeal.setName(outDebitCardVo.getName()+""+StringUtils.getLastNumberChars(3,outDebitCardVo.getCode())+")转账至"+inDebitCardVo.getName()+""+StringUtils.getLastNumberChars(3,inDebitCardVo.getCode())+"");
creditDeal.setRemark("储蓄卡转账");
@@ -508,6 +516,7 @@ public class AccountsTransferRecordServiceImpl implements IAccountsTransferRecor
creditDeal.setDealType("1");
//储蓄卡转账
creditDeal.setDealCategory("8");
creditDeal.setChildCategory(creditDeal.getDealCategory());
//储蓄卡转账
creditDeal.setName(outDebitCardVo.getName()+""+StringUtils.getLastNumberChars(3,outDebitCardVo.getCode())+")转账至"+inDebitCardVo.getName()+""+StringUtils.getLastNumberChars(3,inDebitCardVo.getCode())+"");
creditDeal.setRemark("储蓄卡转账");
@@ -578,6 +587,7 @@ public class AccountsTransferRecordServiceImpl implements IAccountsTransferRecor
}
//借贷
dealRecord.setDealCategory("9");
dealRecord.setChildCategory(dealRecord.getDealCategory());
dealRecord.setRemark("借贷记账");
dealRecord.setCreateBy(SecurityUtils.getUsername());
dealRecord.setCreateTime(accountsTransferRecord.getCreateTime());
@@ -616,6 +626,7 @@ public class AccountsTransferRecordServiceImpl implements IAccountsTransferRecor
dealRecord.setName(lendVo.getName()+""+StringUtils.getLastNumberChars(3,lendVo.getCode())+")借款至"+debitCardVo.getName()+""+StringUtils.getLastNumberChars(3,debitCardVo.getCode())+"");
//借贷账户转账
dealRecord.setDealCategory("9");
dealRecord.setChildCategory(dealRecord.getDealCategory());
dealRecord.setCreateBy(SecurityUtils.getUsername());
dealRecord.setCreateTime(accountsTransferRecord.getCreateTime());
//重新计算余额
@@ -632,6 +643,7 @@ public class AccountsTransferRecordServiceImpl implements IAccountsTransferRecor
//借贷账户转账
dealRecord.setDealCategory("9");
dealRecord.setChildCategory(dealRecord.getDealCategory());
dealRecord.setCreateBy(SecurityUtils.getUsername());
dealRecord.setCreateTime(accountsTransferRecord.getCreateTime());
//重新计算余额
@@ -655,6 +667,7 @@ public class AccountsTransferRecordServiceImpl implements IAccountsTransferRecor
dealInterest.setName(debitCardVo.getName()+""+StringUtils.getLastNumberChars(3,debitCardVo.getCode())+")还款至"+lendVo.getName()+""+StringUtils.getLastNumberChars(3,lendVo.getCode())+"");
//借贷账户转账利息
dealInterest.setDealCategory("15");
dealInterest.setChildCategory(dealInterest.getDealCategory());
dealInterest.setCreateBy(SecurityUtils.getUsername());
Date currentDate = accountsTransferRecord.getCreateTime();
long millis = currentDate.getTime(); // 获取当前时间的毫秒数

View File

@@ -21,6 +21,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="accountName" column="account_name" />
<result property="transferRecordId" column="transfer_record_id" />
<result property="currentBalance" column="current_balance" />
<result property="childCategory" column="child_category" />
</resultMap>
<sql id="selectAccountsDealRecordVo">
@@ -40,6 +41,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
a.remark,
a.deal_category,
a.current_balance,
a.child_category,
CONCAT(a2."name", '', right(a2.code, 4), '') as account_name
from
accounts_deal_record a
@@ -56,7 +58,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="accountId != null and accountId != ''"> and a.account_id = #{accountId}</if>
<if test="dealType != null and dealType != ''"> and a.deal_type = #{dealType}</if>
<if test="dealCategory != null and dealCategory != ''"> and a.deal_category = #{dealCategory}</if>
<if test="childCategory != null and childCategory != ''"> and a.child_category = #{childCategory}</if>
<if test="endTime!=null and endTime !=''">
and #{endTime}>=to_char(a.create_time, 'yyyy-MM-dd')
</if>
@@ -102,6 +104,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="dealCategory != null and dealCategory != ''">deal_category,</if>
<if test="transferRecordId != null and transferRecordId != ''">transfer_record_id,</if>
<if test="currentBalance != null">current_balance,</if>
<if test="childCategory != null">child_category,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
@@ -119,6 +122,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="dealCategory != null and dealCategory != ''">#{dealCategory},</if>
<if test="transferRecordId != null and transferRecordId != ''">#{transferRecordId},</if>
<if test="currentBalance != null">#{currentBalance},</if>
<if test="childCategory != null">#{childCategory},</if>
</trim>
</insert>
@@ -139,6 +143,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="dealCategory != null and dealCategory != ''">deal_category = #{dealCategory},</if>
<if test="transferRecordId != null and transferRecordId != ''">transfer_record_id = #{transferRecordId},</if>
<if test="currentBalance != null ">current_balance = #{currentBalance},</if>
<if test="childCategory != null ">child_category = #{childCategory},</if>
</trim>
where id = #{id}
</update>