提现记录列表接口修改
This commit is contained in:
parent
2ae6cf63b9
commit
d5f1645375
@ -9,6 +9,9 @@ import com.red.circle.wallet.inner.model.dto.UserBankRunningWaterDTO;
|
|||||||
import com.red.circle.wallet.inner.model.dto.UserBankWithdrawGoldApplyDTO;
|
import com.red.circle.wallet.inner.model.dto.UserBankWithdrawGoldApplyDTO;
|
||||||
import com.red.circle.wallet.inner.model.dto.UserBankWithdrawMoneyApplyDTO;
|
import com.red.circle.wallet.inner.model.dto.UserBankWithdrawMoneyApplyDTO;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
@ -65,7 +68,11 @@ public interface UserBankRunningWaterClientApi {
|
|||||||
ResultResponse<List<UserBankWithdrawMoneyApplyDTO>> listBankWithdrawMoneyApply(
|
ResultResponse<List<UserBankWithdrawMoneyApplyDTO>> listBankWithdrawMoneyApply(
|
||||||
@RequestBody UserBankWithdrawMoneyApplyQryCmd query);
|
@RequestBody UserBankWithdrawMoneyApplyQryCmd query);
|
||||||
|
|
||||||
@GetMapping("/getWithdrawMoneyApplyById")
|
@PostMapping("/mapByIds")
|
||||||
|
ResultResponse<Map<Long, UserBankWithdrawMoneyApplyDTO>> mapByIds(@RequestBody Set<Long> ids);
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping("/getWithdrawMoneyApplyById")
|
||||||
ResultResponse<UserBankWithdrawMoneyApplyDTO> getWithdrawMoneyApplyById(@RequestParam("id") Long id);
|
ResultResponse<UserBankWithdrawMoneyApplyDTO> getWithdrawMoneyApplyById(@RequestParam("id") Long id);
|
||||||
|
|
||||||
@PostMapping("/approvalMoneyApply")
|
@PostMapping("/approvalMoneyApply")
|
||||||
|
|||||||
@ -3,6 +3,8 @@ package com.red.circle.wallet.inner.endpoint.freight.api;
|
|||||||
import com.red.circle.framework.dto.ResultResponse;
|
import com.red.circle.framework.dto.ResultResponse;
|
||||||
import com.red.circle.wallet.inner.model.dto.FreightBalanceRunningWaterDTO;
|
import com.red.circle.wallet.inner.model.dto.FreightBalanceRunningWaterDTO;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
@ -30,7 +32,10 @@ public interface FreightBalanceRunningWaterClientApi {
|
|||||||
@RequestParam(value = "lastId",required = false) Long lastId
|
@RequestParam(value = "lastId",required = false) Long lastId
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
@GetMapping("/listByIds")
|
||||||
|
ResultResponse<List<FreightBalanceRunningWaterDTO>> listByIds(@RequestParam("ids") Set<Long> ids);
|
||||||
|
|
||||||
|
/**
|
||||||
* 用户货运单.
|
* 用户货运单.
|
||||||
*
|
*
|
||||||
* @param sellerId 用户id
|
* @param sellerId 用户id
|
||||||
@ -64,4 +69,6 @@ public interface FreightBalanceRunningWaterClientApi {
|
|||||||
@PostMapping("/save")
|
@PostMapping("/save")
|
||||||
void save(@RequestBody FreightBalanceRunningWaterDTO dto);
|
void save(@RequestBody FreightBalanceRunningWaterDTO dto);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -23,6 +23,8 @@ public class SalaryRunningWaterDTO implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private Long userId;
|
private Long userId;
|
||||||
|
|
||||||
|
private Long acceptUserId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 收支类型 0.收入 1.支出.
|
* 收支类型 0.收入 1.支出.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
package com.red.circle.other.app.command.team.bd.query;
|
package com.red.circle.other.app.command.team.bd.query;
|
||||||
|
|
||||||
import com.red.circle.framework.dto.PageResult;
|
import com.red.circle.framework.dto.PageResult;
|
||||||
|
import com.red.circle.framework.dto.ResultResponse;
|
||||||
import com.red.circle.other.app.dto.clientobject.team.bd.BdDetailItemCO;
|
import com.red.circle.other.app.dto.clientobject.team.bd.BdDetailItemCO;
|
||||||
import com.red.circle.other.app.dto.cmd.team.bd.BdDetailsQryCmd;
|
import com.red.circle.other.app.dto.cmd.team.bd.BdDetailsQryCmd;
|
||||||
import com.red.circle.other.domain.gateway.user.UserProfileGateway;
|
import com.red.circle.other.domain.gateway.user.UserProfileGateway;
|
||||||
@ -8,9 +9,17 @@ import com.red.circle.other.domain.model.user.UserProfile;
|
|||||||
import com.red.circle.other.infra.database.mongo.entity.bd.BdLeaderSalarySettlementRecord;
|
import com.red.circle.other.infra.database.mongo.entity.bd.BdLeaderSalarySettlementRecord;
|
||||||
import com.red.circle.other.infra.database.mongo.entity.bd.BdSalarySettlementRecord;
|
import com.red.circle.other.infra.database.mongo.entity.bd.BdSalarySettlementRecord;
|
||||||
import com.red.circle.other.infra.enums.BdSettlementStatus;
|
import com.red.circle.other.infra.enums.BdSettlementStatus;
|
||||||
|
import com.red.circle.tool.core.num.NumUtils;
|
||||||
import com.red.circle.wallet.inner.endpoint.bank.UserBankRunningWaterClient;
|
import com.red.circle.wallet.inner.endpoint.bank.UserBankRunningWaterClient;
|
||||||
|
import com.red.circle.wallet.inner.endpoint.freight.FreightBalanceRunningWaterClient;
|
||||||
|
import com.red.circle.wallet.inner.endpoint.salary.UserSalaryAccountClient;
|
||||||
|
import com.red.circle.wallet.inner.model.cmd.SalaryRunningWaterQueryInnerCmd;
|
||||||
import com.red.circle.wallet.inner.model.cmd.UserBankRunningWaterQryCmd;
|
import com.red.circle.wallet.inner.model.cmd.UserBankRunningWaterQryCmd;
|
||||||
|
import com.red.circle.wallet.inner.model.cmd.UserBankWithdrawMoneyApplyQryCmd;
|
||||||
|
import com.red.circle.wallet.inner.model.dto.FreightBalanceRunningWaterDTO;
|
||||||
|
import com.red.circle.wallet.inner.model.dto.SalaryRunningWaterDTO;
|
||||||
import com.red.circle.wallet.inner.model.dto.UserBankRunningWaterDTO;
|
import com.red.circle.wallet.inner.model.dto.UserBankRunningWaterDTO;
|
||||||
|
import com.red.circle.wallet.inner.model.dto.UserBankWithdrawMoneyApplyDTO;
|
||||||
import com.red.circle.wallet.inner.model.enums.UserBankWaterEvent;
|
import com.red.circle.wallet.inner.model.enums.UserBankWaterEvent;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@ -19,9 +28,11 @@ import org.springframework.data.mongodb.core.MongoTemplate;
|
|||||||
import org.springframework.data.mongodb.core.query.Criteria;
|
import org.springframework.data.mongodb.core.query.Criteria;
|
||||||
import org.springframework.data.mongodb.core.query.Query;
|
import org.springframework.data.mongodb.core.query.Query;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.util.NumberUtils;
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.sql.Timestamp;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.LocalTime;
|
import java.time.LocalTime;
|
||||||
@ -40,9 +51,11 @@ import java.util.stream.Collectors;
|
|||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class BdDetailsQryExe {
|
public class BdDetailsQryExe {
|
||||||
|
|
||||||
private final UserBankRunningWaterClient bankRunningWaterClient;
|
private final UserSalaryAccountClient userSalaryAccountClient;
|
||||||
private final MongoTemplate mongoTemplate;
|
private final MongoTemplate mongoTemplate;
|
||||||
private final UserProfileGateway userProfileGateway;
|
private final UserProfileGateway userProfileGateway;
|
||||||
|
private final UserBankRunningWaterClient userBankRunningWaterClient;
|
||||||
|
private final FreightBalanceRunningWaterClient freightBalanceRunningWaterClient;
|
||||||
|
|
||||||
private static final DateTimeFormatter TIME_FORMATTER = DateTimeFormatter.ofPattern("yy/MM/dd HH:mm");
|
private static final DateTimeFormatter TIME_FORMATTER = DateTimeFormatter.ofPattern("yy/MM/dd HH:mm");
|
||||||
|
|
||||||
@ -75,22 +88,37 @@ public class BdDetailsQryExe {
|
|||||||
List<BdDetailItemCO> items = new ArrayList<>();
|
List<BdDetailItemCO> items = new ArrayList<>();
|
||||||
|
|
||||||
// 构建查询条件
|
// 构建查询条件
|
||||||
UserBankRunningWaterQryCmd qryCmd = new UserBankRunningWaterQryCmd();
|
SalaryRunningWaterQueryInnerCmd qryCmd = new SalaryRunningWaterQueryInnerCmd();
|
||||||
qryCmd.setUserId(userId);
|
qryCmd.setUserId(userId);
|
||||||
qryCmd.setLimit(500);
|
qryCmd.setPageSize(500);
|
||||||
qryCmd.setSysOrigin(sysOrigin);
|
|
||||||
|
|
||||||
// 调用 Wallet 服务查询流水
|
// 调用 Wallet 服务查询流水
|
||||||
var response = bankRunningWaterClient.pageRunningWater(qryCmd);
|
var response = userSalaryAccountClient.queryRunningWater(qryCmd);
|
||||||
if (response == null || !response.checkSuccess() || response.getBody() == null) {
|
if (response == null || !response.checkSuccess() || response.getBody() == null) {
|
||||||
return items;
|
return items;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<UserBankRunningWaterDTO> waterList = response.getBody();
|
PageResult<SalaryRunningWaterDTO> waterList = response.getBody();
|
||||||
|
Collection<SalaryRunningWaterDTO> records = waterList.getRecords();
|
||||||
|
|
||||||
|
Set<Long> trackIds = records.stream()
|
||||||
|
.filter(e -> "WITHDRAW".equals(e.getSalaryEvent()))
|
||||||
|
.filter(e -> StringUtils.hasText(e.getTrackId()))
|
||||||
|
.map(e -> Long.valueOf(e.getTrackId())).collect(Collectors.toSet());
|
||||||
|
Map<Long, UserBankWithdrawMoneyApplyDTO> applyDTOMap = userBankRunningWaterClient.mapByIds(trackIds).getBody();
|
||||||
|
|
||||||
|
|
||||||
|
Set<Long> acceptUserIds = records.stream()
|
||||||
|
.filter(e -> "SALARY_TRANSFER".equals(e.getSalaryEvent()))
|
||||||
|
.map(e -> Long.valueOf(e.getTrackId()))
|
||||||
|
.collect(Collectors.toSet());
|
||||||
|
Map<Long, FreightBalanceRunningWaterDTO> balanceRunningWaterDTOMap = freightBalanceRunningWaterClient.listByIds(acceptUserIds).getBody()
|
||||||
|
.stream().collect(Collectors.toMap(FreightBalanceRunningWaterDTO::getId, e -> e,
|
||||||
|
(v1, v2) -> v1));
|
||||||
|
|
||||||
// 转换为 BdDetailItemCO
|
// 转换为 BdDetailItemCO
|
||||||
for (UserBankRunningWaterDTO water : waterList) {
|
for (SalaryRunningWaterDTO water : records) {
|
||||||
BdDetailItemCO item = convertWalletRecord(water, filterType);
|
BdDetailItemCO item = convertWalletRecord(water, filterType, applyDTOMap, balanceRunningWaterDTOMap);
|
||||||
if (item != null) {
|
if (item != null) {
|
||||||
items.add(item);
|
items.add(item);
|
||||||
}
|
}
|
||||||
@ -102,8 +130,10 @@ public class BdDetailsQryExe {
|
|||||||
/**
|
/**
|
||||||
* 转换钱包流水记录
|
* 转换钱包流水记录
|
||||||
*/
|
*/
|
||||||
private BdDetailItemCO convertWalletRecord(UserBankRunningWaterDTO water, String filterType) {
|
private BdDetailItemCO convertWalletRecord(SalaryRunningWaterDTO water, String filterType,
|
||||||
String event = water.getEvent();
|
Map<Long, UserBankWithdrawMoneyApplyDTO> applyDTOMap,
|
||||||
|
Map<Long, FreightBalanceRunningWaterDTO> balanceRunningWaterDTOMap) {
|
||||||
|
String event = water.getSalaryEvent();
|
||||||
if (event == null) {
|
if (event == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -111,28 +141,53 @@ public class BdDetailsQryExe {
|
|||||||
// 根据 event 类型判断是否需要包含
|
// 根据 event 类型判断是否需要包含
|
||||||
BdDetailItemCO item = new BdDetailItemCO();
|
BdDetailItemCO item = new BdDetailItemCO();
|
||||||
item.setRecordId(water.getId());
|
item.setRecordId(water.getId());
|
||||||
item.setTime(water.getCreateTime());
|
item.setTime(Timestamp.valueOf(water.getCreatedAt()));
|
||||||
item.setTimeText(TIME_FORMATTER.format(water.getCreateTime().toLocalDateTime()));
|
item.setTimeText(TIME_FORMATTER.format(water.getCreatedAt()));
|
||||||
|
|
||||||
// Cash out (提现)
|
// Cash out (提现)
|
||||||
if (event.equals(UserBankWaterEvent.WITHDRAW.name()) ||
|
if ("WITHDRAW".equals(event)) {
|
||||||
event.equals(UserBankWaterEvent.APPLY_WITHDRAW.name())) {
|
|
||||||
if (!shouldIncludeType(filterType, "CASH_OUT")) {
|
if (!shouldIncludeType(filterType, "CASH_OUT")) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
UserBankWithdrawMoneyApplyDTO moneyApplyDTO = applyDTOMap.get(Long.parseLong(water.getTrackId()));
|
||||||
|
|
||||||
item.setType("CASH_OUT");
|
item.setType("CASH_OUT");
|
||||||
item.setTypeText("Cash out");
|
item.setTypeText("Cash out");
|
||||||
// 提现是支出,金额为负
|
// 提现是支出,金额为负
|
||||||
item.setAmount(water.getAmount().negate());
|
item.setAmount(water.getAmount());
|
||||||
item.setAmountText("$" + water.getAmount().negate().toString());
|
item.setAmountText("$" + water.getAmount().negate());
|
||||||
// 提现状态需要从额外的表查询,这里暂时设置默认值
|
|
||||||
item.setStatus("Under review");
|
// 根据审批状态设置显示状态
|
||||||
item.setStatusText("Under review");
|
String displayStatus = "Under review"; // 默认值
|
||||||
|
String displayStatusText = "Under review";
|
||||||
|
|
||||||
|
if (moneyApplyDTO != null && moneyApplyDTO.getLatestApprovalStatus() != null) {
|
||||||
|
switch (moneyApplyDTO.getLatestApprovalStatus()) {
|
||||||
|
case "SUBMIT":
|
||||||
|
displayStatus = "Under review";
|
||||||
|
displayStatusText = "Under review";
|
||||||
|
break;
|
||||||
|
case "PASS":
|
||||||
|
displayStatus = "Approved";
|
||||||
|
displayStatusText = "Approved";
|
||||||
|
break;
|
||||||
|
case "NOT_PASS":
|
||||||
|
displayStatus = "Rejection";
|
||||||
|
displayStatusText = "Rejection";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
// 可选:记录未知状态日志
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
item.setStatus(displayStatus);
|
||||||
|
item.setStatusText(displayStatusText);
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transfer (转账)
|
// Transfer (转账)
|
||||||
if (event.equals(UserBankWaterEvent.TRANSFER_GOLD.name())) {
|
if ("SALARY_TRANSFER".equals(event)) {
|
||||||
if (!shouldIncludeType(filterType, "TRANSFER")) {
|
if (!shouldIncludeType(filterType, "TRANSFER")) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -140,14 +195,19 @@ public class BdDetailsQryExe {
|
|||||||
item.setTypeText("Transfer");
|
item.setTypeText("Transfer");
|
||||||
// 转账金币,显示正值
|
// 转账金币,显示正值
|
||||||
item.setAmount(water.getAmount());
|
item.setAmount(water.getAmount());
|
||||||
item.setAmountText("+" + water.getAmount() + " coins");
|
|
||||||
item.setUserInfo(new BdDetailItemCO.BdDetailUserInfo().setUserId(Long.valueOf(water.getTrackId())));
|
FreightBalanceRunningWaterDTO runningWaterDTO = balanceRunningWaterDTOMap.get(Long.parseLong(water.getTrackId()));
|
||||||
|
if (runningWaterDTO != null) {
|
||||||
|
item.setAmountText("+" + runningWaterDTO.getQuantity() + " coins");
|
||||||
|
} else {
|
||||||
|
item.setAmountText("+" + water.getAmount() + " $");
|
||||||
|
}
|
||||||
|
item.setUserInfo(new BdDetailItemCO.BdDetailUserInfo().setUserId(water.getAcceptUserId()));
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Exchange coins (兑换金币)
|
// Exchange coins (兑换金币)
|
||||||
if (event.equals(UserBankWaterEvent.EXCHANGE_GOLD_COINS.name()) ||
|
if ("SALARY_EXCHANGE".equals(event)) {
|
||||||
event.equals(UserBankWaterEvent.BILL_EXCHANGE_GOLD_COINS.name())) {
|
|
||||||
if (!shouldIncludeType(filterType, "EXCHANGE")) {
|
if (!shouldIncludeType(filterType, "EXCHANGE")) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -160,7 +220,7 @@ public class BdDetailsQryExe {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// BD 收入
|
// BD 收入
|
||||||
if (event.equals(UserBankWaterEvent.BD_SALARY_SETTLEMENT.name())) {
|
if ("SALARY_BD".equals(event)) {
|
||||||
if (!shouldIncludeType(filterType, "BD_SALARY_SETTLEMENT")) {
|
if (!shouldIncludeType(filterType, "BD_SALARY_SETTLEMENT")) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -172,7 +232,7 @@ public class BdDetailsQryExe {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// BDLEADER 收入
|
// BDLEADER 收入
|
||||||
if (event.equals(UserBankWaterEvent.BD_LEADER_SALARY_SETTLEMENT.name())) {
|
if ("SALARY_BD_LEADER".equals(event)) {
|
||||||
if (!shouldIncludeType(filterType, "BD_LEADER_SALARY_SETTLEMENT")) {
|
if (!shouldIncludeType(filterType, "BD_LEADER_SALARY_SETTLEMENT")) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -76,24 +76,24 @@ public class UserBankWithdrawCmdExe {
|
|||||||
UserBankCard bankCard = userBankCardService.getById(cmd.getAcceptBankCardId());
|
UserBankCard bankCard = userBankCardService.getById(cmd.getAcceptBankCardId());
|
||||||
ResponseAssert.notNull(BankErrorCode.BANK_CARD_NOT_FOUND, bankCard);
|
ResponseAssert.notNull(BankErrorCode.BANK_CARD_NOT_FOUND, bankCard);
|
||||||
|
|
||||||
|
Long applyId = IdWorkerUtils.getId();
|
||||||
|
|
||||||
// 扣钱
|
// 扣钱
|
||||||
SalaryReceipt receipt = new SalaryReceipt()
|
SalaryReceipt receipt = new SalaryReceipt()
|
||||||
.setReceiptType(ReceiptType.EXPENDITURE)
|
.setReceiptType(ReceiptType.EXPENDITURE)
|
||||||
.setUserId(cmd.getReqUserId())
|
.setUserId(cmd.getReqUserId())
|
||||||
|
.setAcceptUserId(cmd.getReqUserId())
|
||||||
.setSysOrigin(cmd.getReqSysOrigin().getOrigin())
|
.setSysOrigin(cmd.getReqSysOrigin().getOrigin())
|
||||||
.setSalaryType(salaryType)
|
.setSalaryType(salaryType)
|
||||||
.setSalaryEvent(SalaryEvent.WITHDRAW)
|
.setSalaryEvent(SalaryEvent.WITHDRAW)
|
||||||
.setAmount(PennyAmount.ofDollar(cmd.getAmount()))
|
.setAmount(PennyAmount.ofDollar(cmd.getAmount()))
|
||||||
.setTrackId(IdWorkerUtils.getIdStr())
|
.setTrackId(String.valueOf(applyId))
|
||||||
.setEventDesc("提现")
|
.setEventDesc("提现")
|
||||||
.setOpUserType(OpUserType.APP)
|
.setOpUserType(OpUserType.APP)
|
||||||
.setOpUserId(cmd.getReqUserId());
|
.setOpUserId(cmd.getReqUserId());
|
||||||
SalaryReceiptRes salaryReceiptRes = salaryAccountGateway.changeBalance(receipt);
|
SalaryReceiptRes salaryReceiptRes = salaryAccountGateway.changeBalance(receipt);
|
||||||
ResponseAssert.notNull(WalletErrorCode.INSUFFICIENT_BALANCE, salaryReceiptRes);
|
ResponseAssert.notNull(WalletErrorCode.INSUFFICIENT_BALANCE, salaryReceiptRes);
|
||||||
|
|
||||||
Long bankRunWaterId = IdWorkerUtils.getId();
|
|
||||||
Long applyId = IdWorkerUtils.getId();
|
|
||||||
|
|
||||||
// 手续费
|
// 手续费
|
||||||
Long serviceCharge = getAssistDiamondConfig(cmd.requiredReqUserId());
|
Long serviceCharge = getAssistDiamondConfig(cmd.requiredReqUserId());
|
||||||
BigDecimal actualAmount = getActualAmount(cmd.getAmount(), serviceCharge);
|
BigDecimal actualAmount = getActualAmount(cmd.getAmount(), serviceCharge);
|
||||||
|
|||||||
@ -87,13 +87,14 @@ public class SalaryTransferGoldCmdExe {
|
|||||||
|
|
||||||
// 获得区域兑换比例金币比例
|
// 获得区域兑换比例金币比例
|
||||||
Double goldRatio = getExchangeGoldRatio(cmd);
|
Double goldRatio = getExchangeGoldRatio(cmd);
|
||||||
|
Long bankRunWaterId = IdWorkerUtils.getId();
|
||||||
|
|
||||||
// 扣钱
|
// 扣钱
|
||||||
|
cmd.setReqTraceId(String.valueOf(bankRunWaterId));
|
||||||
SalaryReceipt receipt = salaryAccountConvertor.toTransferReceipt(cmd);
|
SalaryReceipt receipt = salaryAccountConvertor.toTransferReceipt(cmd);
|
||||||
SalaryReceiptRes salaryReceiptRes = salaryAccountGateway.changeBalance(receipt);
|
SalaryReceiptRes salaryReceiptRes = salaryAccountGateway.changeBalance(receipt);
|
||||||
ResponseAssert.notNull(WalletErrorCode.INSUFFICIENT_BALANCE, salaryReceiptRes);
|
ResponseAssert.notNull(WalletErrorCode.INSUFFICIENT_BALANCE, salaryReceiptRes);
|
||||||
|
|
||||||
Long bankRunWaterId = IdWorkerUtils.getId();
|
|
||||||
BigDecimal goldQuantity = BigDecimal.valueOf(goldRatio).multiply(cmd.getAmount()).setScale(0, RoundingMode.DOWN);
|
BigDecimal goldQuantity = BigDecimal.valueOf(goldRatio).multiply(cmd.getAmount()).setScale(0, RoundingMode.DOWN);
|
||||||
|
|
||||||
// 发送金额
|
// 发送金额
|
||||||
@ -117,6 +118,7 @@ public class SalaryTransferGoldCmdExe {
|
|||||||
// 插入流水
|
// 插入流水
|
||||||
BigDecimal freightBalance = freightBalanceService.getAvailableBalance(cmd.getAcceptUserId());
|
BigDecimal freightBalance = freightBalanceService.getAvailableBalance(cmd.getAcceptUserId());
|
||||||
freightBalanceRunningWaterService.save(new FreightBalanceRunningWater()
|
freightBalanceRunningWaterService.save(new FreightBalanceRunningWater()
|
||||||
|
.setId(bankRunWaterId)
|
||||||
.setSysOrigin(cmd.getReqSysOrigin().getOrigin())
|
.setSysOrigin(cmd.getReqSysOrigin().getOrigin())
|
||||||
.setUserId(cmd.getReqUserId())
|
.setUserId(cmd.getReqUserId())
|
||||||
.setAcceptUserId(cmd.getAcceptUserId())
|
.setAcceptUserId(cmd.getAcceptUserId())
|
||||||
|
|||||||
@ -30,6 +30,7 @@ public class SalaryAccountConvertor {
|
|||||||
return new SalaryReceipt()
|
return new SalaryReceipt()
|
||||||
.setReceiptType(ReceiptType.INCOME)
|
.setReceiptType(ReceiptType.INCOME)
|
||||||
.setUserId(cmd.getUserId())
|
.setUserId(cmd.getUserId())
|
||||||
|
.setAcceptUserId(cmd.getUserId())
|
||||||
.setSysOrigin(cmd.getReqSysOrigin().getOrigin())
|
.setSysOrigin(cmd.getReqSysOrigin().getOrigin())
|
||||||
.setSalaryType(SalaryType.of(cmd.getSalaryType()))
|
.setSalaryType(SalaryType.of(cmd.getSalaryType()))
|
||||||
.setSalaryEvent(SalaryEvent.SALARY_ISSUE)
|
.setSalaryEvent(SalaryEvent.SALARY_ISSUE)
|
||||||
@ -75,6 +76,7 @@ public class SalaryAccountConvertor {
|
|||||||
SalaryReceipt receipt = new SalaryReceipt()
|
SalaryReceipt receipt = new SalaryReceipt()
|
||||||
.setReceiptType(ReceiptType.EXPENDITURE)
|
.setReceiptType(ReceiptType.EXPENDITURE)
|
||||||
.setUserId(cmd.getReqUserId())
|
.setUserId(cmd.getReqUserId())
|
||||||
|
.setAcceptUserId(cmd.getReqUserId())
|
||||||
.setSysOrigin(cmd.getReqSysOrigin().getOrigin())
|
.setSysOrigin(cmd.getReqSysOrigin().getOrigin())
|
||||||
.setSalaryType(SalaryType.of(cmd.getSalaryType()))
|
.setSalaryType(SalaryType.of(cmd.getSalaryType()))
|
||||||
.setSalaryEvent(SalaryEvent.SALARY_EXCHANGE)
|
.setSalaryEvent(SalaryEvent.SALARY_EXCHANGE)
|
||||||
@ -91,11 +93,12 @@ public class SalaryAccountConvertor {
|
|||||||
SalaryReceipt receipt = new SalaryReceipt()
|
SalaryReceipt receipt = new SalaryReceipt()
|
||||||
.setReceiptType(ReceiptType.EXPENDITURE)
|
.setReceiptType(ReceiptType.EXPENDITURE)
|
||||||
.setUserId(cmd.getReqUserId())
|
.setUserId(cmd.getReqUserId())
|
||||||
|
.setAcceptUserId(cmd.getAcceptUserId())
|
||||||
.setSysOrigin(cmd.getReqSysOrigin().getOrigin())
|
.setSysOrigin(cmd.getReqSysOrigin().getOrigin())
|
||||||
.setSalaryType(SalaryType.of(cmd.getSalaryType()))
|
.setSalaryType(SalaryType.of(cmd.getSalaryType()))
|
||||||
.setSalaryEvent(SalaryEvent.SALARY_TRANSFER)
|
.setSalaryEvent(SalaryEvent.SALARY_TRANSFER)
|
||||||
.setAmount(PennyAmount.ofDollar(cmd.getAmount()))
|
.setAmount(PennyAmount.ofDollar(cmd.getAmount()))
|
||||||
.setTrackId(IdWorkerUtils.getIdStr())
|
.setTrackId(cmd.getReqTraceId())
|
||||||
.setEventDesc(SalaryEvent.SALARY_TRANSFER.getDesc())
|
.setEventDesc(SalaryEvent.SALARY_TRANSFER.getDesc())
|
||||||
.setRemark(cmd.getRemark())
|
.setRemark(cmd.getRemark())
|
||||||
.setOpUserType(OpUserType.APP)
|
.setOpUserType(OpUserType.APP)
|
||||||
@ -134,6 +137,7 @@ public class SalaryAccountConvertor {
|
|||||||
SalaryRunningWaterCO co = new SalaryRunningWaterCO();
|
SalaryRunningWaterCO co = new SalaryRunningWaterCO();
|
||||||
co.setId(entity.getId());
|
co.setId(entity.getId());
|
||||||
co.setUserId(entity.getUserId());
|
co.setUserId(entity.getUserId());
|
||||||
|
co.setAcceptUserId(entity.getAcceptUserId());
|
||||||
co.setType(entity.getType());
|
co.setType(entity.getType());
|
||||||
co.setSalaryType(entity.getSalaryType());
|
co.setSalaryType(entity.getSalaryType());
|
||||||
|
|
||||||
|
|||||||
@ -20,6 +20,8 @@ public class SalaryRunningWaterCO {
|
|||||||
*/
|
*/
|
||||||
private Long userId;
|
private Long userId;
|
||||||
|
|
||||||
|
private Long acceptUserId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 收支类型 0.收入 1.支出.
|
* 收支类型 0.收入 1.支出.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -15,6 +15,10 @@ public enum SalaryEvent {
|
|||||||
*/
|
*/
|
||||||
SALARY_ISSUE("SALARY_ISSUE", "工资发放"),
|
SALARY_ISSUE("SALARY_ISSUE", "工资发放"),
|
||||||
|
|
||||||
|
SALARY_BD("SALARY_BD", "BD工资"),
|
||||||
|
|
||||||
|
SALARY_BD_LEADER("SALARY_BD_LEADER", "BD_LEADER工资"),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 工资调整.
|
* 工资调整.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -24,6 +24,8 @@ public class SalaryReceipt {
|
|||||||
*/
|
*/
|
||||||
private Long userId;
|
private Long userId;
|
||||||
|
|
||||||
|
private Long acceptUserId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 系统来源.
|
* 系统来源.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -32,6 +32,8 @@ public class SalaryAccountRunningWater extends TimestampBaseEntity {
|
|||||||
@TableField("user_id")
|
@TableField("user_id")
|
||||||
private Long userId;
|
private Long userId;
|
||||||
|
|
||||||
|
private Long acceptUserId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 系统来源.
|
* 系统来源.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -126,6 +126,7 @@ public class SalaryAccountGatewayImpl implements SalaryAccountGateway {
|
|||||||
SalaryAccountRunningWater water = new SalaryAccountRunningWater()
|
SalaryAccountRunningWater water = new SalaryAccountRunningWater()
|
||||||
.setId(recordId)
|
.setId(recordId)
|
||||||
.setUserId(receipt.getUserId())
|
.setUserId(receipt.getUserId())
|
||||||
|
.setAcceptUserId(receipt.getAcceptUserId())
|
||||||
.setSysOrigin(receipt.getSysOrigin())
|
.setSysOrigin(receipt.getSysOrigin())
|
||||||
.setType(receipt.getReceiptType().getType())
|
.setType(receipt.getReceiptType().getType())
|
||||||
.setSalaryType(receipt.getSalaryType().getCode())
|
.setSalaryType(receipt.getSalaryType().getCode())
|
||||||
|
|||||||
@ -109,6 +109,7 @@ public class SalaryAccountInnerConvertor {
|
|||||||
SalaryRunningWaterDTO dto = new SalaryRunningWaterDTO();
|
SalaryRunningWaterDTO dto = new SalaryRunningWaterDTO();
|
||||||
dto.setId(co.getId());
|
dto.setId(co.getId());
|
||||||
dto.setUserId(co.getUserId());
|
dto.setUserId(co.getUserId());
|
||||||
|
dto.setAcceptUserId(co.getAcceptUserId());
|
||||||
dto.setType(co.getType());
|
dto.setType(co.getType());
|
||||||
dto.setSalaryType(co.getSalaryType());
|
dto.setSalaryType(co.getSalaryType());
|
||||||
dto.setSalaryTypeName(co.getSalaryTypeName());
|
dto.setSalaryTypeName(co.getSalaryTypeName());
|
||||||
|
|||||||
@ -59,4 +59,6 @@ public interface UserBankInnerConvertor {
|
|||||||
Map<Long, UserWithdrawInfo> userWithdrawInfoMap);
|
Map<Long, UserWithdrawInfo> userWithdrawInfoMap);
|
||||||
|
|
||||||
UserWithdrawInfo toUserWithdrawInfo(UserWithdrawInfoCmd cmd);
|
UserWithdrawInfo toUserWithdrawInfo(UserWithdrawInfoCmd cmd);
|
||||||
|
|
||||||
|
Map<Long, UserBankWithdrawMoneyApplyDTO> toUserBankWithdrawMoneyApplyMap(Map<Long, UserBankWithdrawMoneyApply> longUserBankWithdrawMoneyApplyMap);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,6 +11,9 @@ import com.red.circle.wallet.inner.model.dto.UserBankWithdrawGoldApplyDTO;
|
|||||||
import com.red.circle.wallet.inner.model.dto.UserBankWithdrawMoneyApplyDTO;
|
import com.red.circle.wallet.inner.model.dto.UserBankWithdrawMoneyApplyDTO;
|
||||||
import com.red.circle.wallet.inner.service.bank.UserBankRunningWaterClientService;
|
import com.red.circle.wallet.inner.service.bank.UserBankRunningWaterClientService;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
@ -80,6 +83,12 @@ public class UserBankRunningWaterClientEndpoint implements UserBankRunningWaterC
|
|||||||
userBankRunningWaterClientService.listBankWithdrawMoneyApply(query));
|
userBankRunningWaterClientService.listBankWithdrawMoneyApply(query));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResultResponse<Map<Long, UserBankWithdrawMoneyApplyDTO>> mapByIds(Set<Long> ids) {
|
||||||
|
return ResultResponse.success(
|
||||||
|
userBankRunningWaterClientService.mapByIds(ids));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResultResponse<UserBankWithdrawMoneyApplyDTO> getWithdrawMoneyApplyById(Long id) {
|
public ResultResponse<UserBankWithdrawMoneyApplyDTO> getWithdrawMoneyApplyById(Long id) {
|
||||||
|
|||||||
@ -5,6 +5,8 @@ import com.red.circle.wallet.inner.endpoint.freight.api.FreightBalanceRunningWat
|
|||||||
import com.red.circle.wallet.inner.model.dto.FreightBalanceRunningWaterDTO;
|
import com.red.circle.wallet.inner.model.dto.FreightBalanceRunningWaterDTO;
|
||||||
import com.red.circle.wallet.inner.service.freight.FreightBalanceRunningWaterClientService;
|
import com.red.circle.wallet.inner.service.freight.FreightBalanceRunningWaterClientService;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
@ -33,6 +35,11 @@ public class FreightBalanceRunningWaterClientEndpoint implements
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResultResponse<List<FreightBalanceRunningWaterDTO>> listByIds(Set<Long> ids) {
|
||||||
|
return ResultResponse.success(freightBalanceRunningWaterClientService.listByIds(ids));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResultResponse<List<FreightBalanceRunningWaterDTO>> flowBySellerId(Long sellerId,
|
public ResultResponse<List<FreightBalanceRunningWaterDTO>> flowBySellerId(Long sellerId,
|
||||||
Long lastId) {
|
Long lastId) {
|
||||||
|
|||||||
@ -8,6 +8,8 @@ import com.red.circle.wallet.inner.model.dto.UserBankRunningWaterDTO;
|
|||||||
import com.red.circle.wallet.inner.model.dto.UserBankWithdrawGoldApplyDTO;
|
import com.red.circle.wallet.inner.model.dto.UserBankWithdrawGoldApplyDTO;
|
||||||
import com.red.circle.wallet.inner.model.dto.UserBankWithdrawMoneyApplyDTO;
|
import com.red.circle.wallet.inner.model.dto.UserBankWithdrawMoneyApplyDTO;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 银行卡流水.
|
* 银行卡流水.
|
||||||
@ -58,6 +60,11 @@ public interface UserBankRunningWaterClientService {
|
|||||||
List<UserBankWithdrawMoneyApplyDTO> listBankWithdrawMoneyApply(
|
List<UserBankWithdrawMoneyApplyDTO> listBankWithdrawMoneyApply(
|
||||||
UserBankWithdrawMoneyApplyQryCmd query);
|
UserBankWithdrawMoneyApplyQryCmd query);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户银行卡提现申请记录.
|
||||||
|
*/
|
||||||
|
Map<Long, UserBankWithdrawMoneyApplyDTO> mapByIds(Set<Long> ids);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获得记录.
|
* 获得记录.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -13,6 +13,9 @@ import com.red.circle.wallet.inner.model.dto.UserBankWithdrawGoldApplyDTO;
|
|||||||
import com.red.circle.wallet.inner.model.dto.UserBankWithdrawMoneyApplyDTO;
|
import com.red.circle.wallet.inner.model.dto.UserBankWithdrawMoneyApplyDTO;
|
||||||
import com.red.circle.wallet.inner.service.bank.UserBankRunningWaterClientService;
|
import com.red.circle.wallet.inner.service.bank.UserBankRunningWaterClientService;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@ -76,6 +79,12 @@ public class UserBankRunningWaterClientServiceImpl implements UserBankRunningWat
|
|||||||
bankWithdrawMoneyApplyService.listBankWithdrawMoneyApply(query));
|
bankWithdrawMoneyApplyService.listBankWithdrawMoneyApply(query));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<Long, UserBankWithdrawMoneyApplyDTO> mapByIds(Set<Long> ids) {
|
||||||
|
return userBankInnerConvertor.toUserBankWithdrawMoneyApplyMap(
|
||||||
|
bankWithdrawMoneyApplyService.mapByIds(ids));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public UserBankWithdrawMoneyApplyDTO getWithdrawMoneyApplyById(Long id) {
|
public UserBankWithdrawMoneyApplyDTO getWithdrawMoneyApplyById(Long id) {
|
||||||
|
|||||||
@ -2,6 +2,7 @@ package com.red.circle.wallet.inner.service.freight;
|
|||||||
|
|
||||||
import com.red.circle.wallet.inner.model.dto.FreightBalanceRunningWaterDTO;
|
import com.red.circle.wallet.inner.model.dto.FreightBalanceRunningWaterDTO;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户货运账户流水.
|
* 用户货运账户流水.
|
||||||
@ -19,6 +20,8 @@ public interface FreightBalanceRunningWaterClientService {
|
|||||||
*/
|
*/
|
||||||
List<FreightBalanceRunningWaterDTO> flowByUserId(Long userId, Long lastId);
|
List<FreightBalanceRunningWaterDTO> flowByUserId(Long userId, Long lastId);
|
||||||
|
|
||||||
|
List<FreightBalanceRunningWaterDTO> listByIds(Set<Long> ids);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户货运单.
|
* 用户货运单.
|
||||||
*
|
*
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
package com.red.circle.wallet.inner.service.freight.impl;
|
package com.red.circle.wallet.inner.service.freight.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import com.red.circle.other.inner.endpoint.user.user.UserProfileClient;
|
import com.red.circle.other.inner.endpoint.user.user.UserProfileClient;
|
||||||
import com.red.circle.other.inner.model.dto.user.UserProfileDTO;
|
import com.red.circle.other.inner.model.dto.user.UserProfileDTO;
|
||||||
import com.red.circle.wallet.infra.database.rds.entity.freight.FreightBalanceRunningWater;
|
import com.red.circle.wallet.infra.database.rds.entity.freight.FreightBalanceRunningWater;
|
||||||
@ -46,6 +48,13 @@ public class FreightBalanceRunningWaterClientServiceImpl implements
|
|||||||
return runningWaterDTO;
|
return runningWaterDTO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<FreightBalanceRunningWaterDTO> listByIds(Set<Long> ids) {
|
||||||
|
LambdaQueryWrapper<FreightBalanceRunningWater> in = Wrappers.lambdaQuery(FreightBalanceRunningWater.class)
|
||||||
|
.in(FreightBalanceRunningWater::getId, ids);
|
||||||
|
List<FreightBalanceRunningWater> runningWaters = freightBalanceRunningWaterService.list(in);
|
||||||
|
return freightBalanceRunningWaterInnerConvertor.toListFreightBalanceRunningWaterDTO(runningWaters);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<FreightBalanceRunningWaterDTO> flowBySellerId(Long sellerId, Long lastId) {
|
public List<FreightBalanceRunningWaterDTO> flowBySellerId(Long sellerId, Long lastId) {
|
||||||
return freightBalanceRunningWaterInnerConvertor.toListFreightBalanceRunningWaterDTO(
|
return freightBalanceRunningWaterInnerConvertor.toListFreightBalanceRunningWaterDTO(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user