🎨 我的钱包展示效果优化
This commit is contained in:
parent
62d67e70b6
commit
f4b776a903
@ -19,8 +19,12 @@ public class TransactionRecordDTO {
|
|||||||
private String funds;
|
private String funds;
|
||||||
/** 交易发起方 */
|
/** 交易发起方 */
|
||||||
private String formBankAccount;
|
private String formBankAccount;
|
||||||
|
/** 交易发起方 */
|
||||||
|
private BankAccountDTO formBankAccountInfo;
|
||||||
/** 交易收款方 */
|
/** 交易收款方 */
|
||||||
private String toBankAccount;
|
private String toBankAccount;
|
||||||
|
/** 交易收款方 */
|
||||||
|
private BankAccountDTO toBankAccountInfo;
|
||||||
/** 交易金额 */
|
/** 交易金额 */
|
||||||
private BigDecimal money;
|
private BigDecimal money;
|
||||||
/** 交易类型 */
|
/** 交易类型 */
|
||||||
|
@ -32,4 +32,11 @@ public interface BankAccountMapper extends Mapper<BankAccount> {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
String selectMaxBankAccount();
|
String selectMaxBankAccount();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据卡号获取银行账号信息
|
||||||
|
* @param bankAccount
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
BankAccountDTO selectByBankAccount(@Param("bankAccount") String bankAccount);
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@ public interface BankAccountService extends Service<BankAccount> {
|
|||||||
* @param bankAccount
|
* @param bankAccount
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
BankAccount findByBankAccount(String bankAccount);
|
BankAccountDTO findByBankAccount(String bankAccount);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询系统社区银行
|
* 查询系统社区银行
|
||||||
|
@ -61,10 +61,8 @@ public class BankAccountServiceImpl extends AbstractService<BankAccount> impleme
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BankAccount findByBankAccount(String bankAccount) {
|
public BankAccountDTO findByBankAccount(String bankAccount) {
|
||||||
BankAccount searchBankAccount = new BankAccount();
|
return bankAccountMapper.selectByBankAccount(bankAccount);
|
||||||
searchBankAccount.setBankAccount(bankAccount);
|
|
||||||
return bankAccountMapper.selectOne(searchBankAccount);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -4,15 +4,19 @@ import com.rymcu.forest.core.exception.TransactionException;
|
|||||||
import com.rymcu.forest.core.service.AbstractService;
|
import com.rymcu.forest.core.service.AbstractService;
|
||||||
import com.rymcu.forest.core.service.redis.RedisService;
|
import com.rymcu.forest.core.service.redis.RedisService;
|
||||||
import com.rymcu.forest.dto.BankAccountDTO;
|
import com.rymcu.forest.dto.BankAccountDTO;
|
||||||
|
import com.rymcu.forest.dto.BankAccountSearchDTO;
|
||||||
import com.rymcu.forest.dto.TransactionRecordDTO;
|
import com.rymcu.forest.dto.TransactionRecordDTO;
|
||||||
import com.rymcu.forest.entity.BankAccount;
|
import com.rymcu.forest.entity.BankAccount;
|
||||||
import com.rymcu.forest.entity.TransactionRecord;
|
import com.rymcu.forest.entity.TransactionRecord;
|
||||||
|
import com.rymcu.forest.entity.User;
|
||||||
import com.rymcu.forest.enumerate.TransactionCode;
|
import com.rymcu.forest.enumerate.TransactionCode;
|
||||||
import com.rymcu.forest.enumerate.TransactionEnum;
|
import com.rymcu.forest.enumerate.TransactionEnum;
|
||||||
import com.rymcu.forest.mapper.TransactionRecordMapper;
|
import com.rymcu.forest.mapper.TransactionRecordMapper;
|
||||||
import com.rymcu.forest.service.BankAccountService;
|
import com.rymcu.forest.service.BankAccountService;
|
||||||
import com.rymcu.forest.service.TransactionRecordService;
|
import com.rymcu.forest.service.TransactionRecordService;
|
||||||
import com.rymcu.forest.util.DateUtil;
|
import com.rymcu.forest.util.DateUtil;
|
||||||
|
import com.rymcu.forest.util.UserUtils;
|
||||||
|
import com.rymcu.forest.web.api.exception.BaseApiException;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
@ -56,7 +60,17 @@ public class TransactionRecordServiceImpl extends AbstractService<TransactionRec
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<TransactionRecordDTO> findTransactionRecords(String bankAccount) {
|
public List<TransactionRecordDTO> findTransactionRecords(String bankAccount) {
|
||||||
return transactionRecordMapper.selectTransactionRecords(bankAccount);
|
List<TransactionRecordDTO> list = transactionRecordMapper.selectTransactionRecords(bankAccount);
|
||||||
|
list.forEach(transactionRecordDTO -> genTransactionRecord(transactionRecordDTO));
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
private TransactionRecordDTO genTransactionRecord(TransactionRecordDTO transactionRecordDTO) {
|
||||||
|
BankAccountDTO toBankAccount = bankAccountService.findByBankAccount(transactionRecordDTO.getToBankAccount());
|
||||||
|
BankAccountDTO formBankAccount = bankAccountService.findByBankAccount(transactionRecordDTO.getFormBankAccount());
|
||||||
|
transactionRecordDTO.setFormBankAccountInfo(formBankAccount);
|
||||||
|
transactionRecordDTO.setToBankAccountInfo(toBankAccount);
|
||||||
|
return transactionRecordDTO;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -122,7 +136,7 @@ public class TransactionRecordServiceImpl extends AbstractService<TransactionRec
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean checkFormAccountStatus(String formBankAccount, BigDecimal money) {
|
private boolean checkFormAccountStatus(String formBankAccount, BigDecimal money) {
|
||||||
BankAccount bankAccount = bankAccountService.findByBankAccount(formBankAccount);
|
BankAccountDTO bankAccount = bankAccountService.findByBankAccount(formBankAccount);
|
||||||
if (Objects.nonNull(bankAccount)) {
|
if (Objects.nonNull(bankAccount)) {
|
||||||
if (bankAccount.getAccountBalance().compareTo(money) > 0) {
|
if (bankAccount.getAccountBalance().compareTo(money) > 0) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -12,24 +12,30 @@
|
|||||||
<result column="created_time" property="createdTime"></result>
|
<result column="created_time" property="createdTime"></result>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
<select id="selectBankAccounts" resultMap="DTOResultMap">
|
<select id="selectBankAccounts" resultMap="DTOResultMap">
|
||||||
select vb.bank_name, vu.nickname as account_owner_name, vba.* from forest_bank_account vba
|
select fb.bank_name, ifnull(fu.nickname, '系统') as account_owner_name, fba.* from forest_bank_account fba
|
||||||
join forest_bank vb on vba.id_bank = vb.id
|
join forest_bank fb on fba.id_bank = fb.id
|
||||||
join forest_user vu on vba.account_owner = vu.id where vba.account_type = 0
|
left join forest_user fu on fba.account_owner = fu.id where fba.account_type = 0
|
||||||
<if test="bankName != null and bankName != ''">
|
<if test="bankName != null and bankName != ''">
|
||||||
and vb.bank_name = #{bankName}
|
and fb.bank_name = #{bankName}
|
||||||
</if>
|
</if>
|
||||||
<if test="accountOwnerName != null and accountOwnerName != ''">
|
<if test="accountOwnerName != null and accountOwnerName != ''">
|
||||||
and vu.nickname = #{accountOwnerName}
|
and fu.nickname = #{accountOwnerName}
|
||||||
</if>
|
</if>
|
||||||
<if test="bankAccount != null and bankAccount != ''">
|
<if test="bankAccount != null and bankAccount != ''">
|
||||||
and vba.bank_account = #{bankAccount}
|
and fba.bank_account = #{bankAccount}
|
||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
<select id="selectBankAccount" resultMap="DTOResultMap">
|
<select id="selectBankAccount" resultMap="DTOResultMap">
|
||||||
select vb.bank_name, vba.* from forest_bank_account vba
|
select fb.bank_name, fu.nickname as account_owner_name, fba.* from forest_bank_account fba
|
||||||
join forest_bank vb on vba.id_bank = vb.id where vba.id = #{idBank}
|
join forest_bank fb on fba.id_bank = fb.id
|
||||||
|
join forest_user fu on fba.account_owner = fu.id where fba.id = #{idBank}
|
||||||
</select>
|
</select>
|
||||||
<select id="selectMaxBankAccount" resultType="java.lang.String">
|
<select id="selectMaxBankAccount" resultType="java.lang.String">
|
||||||
select max(bank_account) as max_bank_account from forest_bank_account where account_type = 0
|
select max(bank_account) as max_bank_account from forest_bank_account where account_type = 0
|
||||||
</select>
|
</select>
|
||||||
|
<select id="selectByBankAccount" resultMap="DTOResultMap">
|
||||||
|
select fb.bank_name, ifnull(fu.nickname, '系统') as account_owner_name, fba.bank_account from forest_bank_account fba
|
||||||
|
join forest_bank fb on fba.id_bank = fb.id
|
||||||
|
left join forest_user fu on fba.account_owner = fu.id where fba.bank_account = #{bankAccount}
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
@ -16,7 +16,7 @@
|
|||||||
update forest_bank_account set account_balance = account_balance + #{money} where bank_account = #{toBankAccount};
|
update forest_bank_account set account_balance = account_balance + #{money} where bank_account = #{toBankAccount};
|
||||||
</update>
|
</update>
|
||||||
<select id="selectTransactionRecords" resultMap="DTOResultMap">
|
<select id="selectTransactionRecords" resultMap="DTOResultMap">
|
||||||
select * from forest_transaction_record where form_bank_account = #{bankAccount} or to_bank_account = #{bankAccount} order by transaction_time desc
|
select * from forest_transaction_record ftr where form_bank_account = #{bankAccount} or to_bank_account = #{bankAccount} order by transaction_time desc
|
||||||
</select>
|
</select>
|
||||||
<select id="existsWithBankAccountAndFunds" resultType="java.lang.Boolean">
|
<select id="existsWithBankAccountAndFunds" resultType="java.lang.Boolean">
|
||||||
select ifnull((select false from forest_transaction_record where to_bank_account = #{bankAccount}
|
select ifnull((select false from forest_transaction_record where to_bank_account = #{bankAccount}
|
||||||
|
Loading…
Reference in New Issue
Block a user