|
|
@@ -1,14 +1,19 @@
|
|
|
package org.dromara.backstage.business.payments;
|
|
|
|
|
|
+import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
import cn.hutool.core.util.ObjUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import cn.hutool.json.JSONUtil;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
import org.dromara.backstage.basics.domain.vo.PtWorkstationVo;
|
|
|
import org.dromara.backstage.basics.service.IPtWorkstationService;
|
|
|
+import org.dromara.backstage.cardCenter.domain.bo.PtSubsidyitemBo;
|
|
|
import org.dromara.backstage.cardCenter.domain.vo.PtCardVo;
|
|
|
+import org.dromara.backstage.cardCenter.domain.vo.PtSubsidyitemVo;
|
|
|
import org.dromara.backstage.cardCenter.service.IPtCardService;
|
|
|
+import org.dromara.backstage.cardCenter.service.IPtSubsidyitemService;
|
|
|
import org.dromara.backstage.consumption.domain.bo.XfCreditAccountBackBo;
|
|
|
import org.dromara.backstage.consumption.domain.bo.XfCreditAccountBo;
|
|
|
import org.dromara.backstage.consumption.domain.bo.XfUserTotalBo;
|
|
|
@@ -21,29 +26,31 @@ import org.dromara.backstage.consumption.service.IXfCreditAccountService;
|
|
|
import org.dromara.backstage.consumption.service.IXfTermService;
|
|
|
import org.dromara.backstage.consumption.service.IXfUserTotalService;
|
|
|
import org.dromara.backstage.payment.domain.bo.PtBagBo;
|
|
|
+import org.dromara.backstage.payment.domain.bo.PurseInOutBo;
|
|
|
import org.dromara.backstage.payment.domain.vo.PtBagVo;
|
|
|
import org.dromara.backstage.payment.domain.vo.PtUserAccountVo;
|
|
|
import org.dromara.backstage.payment.service.IPtBagService;
|
|
|
import org.dromara.backstage.payment.service.IPtUserAccountService;
|
|
|
+import org.dromara.common.core.constant.Constants;
|
|
|
import org.dromara.common.core.enums.CreditStatusEnum;
|
|
|
+import org.dromara.common.core.enums.CreditTypeEnum;
|
|
|
import org.dromara.common.core.exception.payments.PaymentsException;
|
|
|
import org.dromara.common.core.utils.MessageUtils;
|
|
|
import org.dromara.common.core.utils.RecordIdUtils;
|
|
|
import org.jetbrains.annotations.NotNull;
|
|
|
-import org.slf4j.Logger;
|
|
|
-import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
-import java.util.ArrayList;
|
|
|
+import java.text.MessageFormat;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
+import java.util.Objects;
|
|
|
|
|
|
/**
|
|
|
- * name: PaymentsBusiness
|
|
|
- * package: org.dromara.backstage.business.payments.strategy
|
|
|
- * description: 资金收支业务处理类
|
|
|
- * date: 2024-08-20 20:21:39 20:21
|
|
|
+ * name: PayBaseBusiness
|
|
|
+ * package: org.dromara.backstage.business.payments
|
|
|
+ * description: 资金收支业务基础逻辑处理
|
|
|
+ * date: 2024-10-30 07:42:46 07:42
|
|
|
*
|
|
|
* @author luoyibo
|
|
|
* @version 0.1
|
|
|
@@ -51,8 +58,8 @@ import java.util.List;
|
|
|
*/
|
|
|
@RequiredArgsConstructor
|
|
|
@Service
|
|
|
-public class PaymentsBusiness {
|
|
|
- private static final Logger log = LoggerFactory.getLogger(PaymentsBusiness.class);
|
|
|
+@Slf4j
|
|
|
+public class PayBaseBusiness {
|
|
|
private final IPtWorkstationService workstationService;
|
|
|
private final IPtUserAccountService userAccountService;
|
|
|
private final IXfTermService termService;
|
|
|
@@ -61,41 +68,136 @@ public class PaymentsBusiness {
|
|
|
private final IXfCreditAccountBackService creditAccountBackService;
|
|
|
private final IXfCreditAccountService creditAccountService;
|
|
|
private final IXfUserTotalService userTotalService;
|
|
|
+ private final IPtSubsidyitemService subsidyItemService;
|
|
|
+ /**
|
|
|
+ * 检查资金收支的账户信息,资金收支必须有对应的收支账户
|
|
|
+ * @param orderBo 资金收支业务对象
|
|
|
+ * @return 账户信息
|
|
|
+ */
|
|
|
+ public PtUserAccountVo checkUserAccount(PurseInOutBo orderBo){
|
|
|
+ PtUserAccountVo userAccountVo = userAccountService.queryById(orderBo.getUserId());
|
|
|
+ if(ObjUtil.isEmpty(userAccountVo)){
|
|
|
+ throw new PaymentsException(MessageFormat.format("无此账户信息,账户Id:{0}",orderBo.getUserId()));
|
|
|
+ }
|
|
|
+ return userAccountVo;
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
- * 账户资金收支时获取必要的辅助信息
|
|
|
- *
|
|
|
- * @param bo 资金收支信息
|
|
|
- * @return 辅助信息列表
|
|
|
+ * 检查资金收支对应的卡片信息,只要开通了一卡通账户就可以资金收支,因此卡片信息是可能为空的
|
|
|
+ * @param orderBo 资金收支业务对象
|
|
|
+ * @return 卡片信息
|
|
|
*/
|
|
|
- public List<Object> getOtherInfo(PtBagBo bo) {
|
|
|
- List<Object> list = new ArrayList<>();
|
|
|
- //1.人员辅助信息
|
|
|
- PtUserAccountVo userAccountVo = userAccountService.queryById(bo.getUserId());
|
|
|
- list.add(userAccountVo);
|
|
|
- //2.卡片辅助信息
|
|
|
+ public PtCardVo checkUserCard(PurseInOutBo orderBo){
|
|
|
PtCardVo ptCardVo;
|
|
|
- if (bo.getCardId() != null && bo.getCardId() > 0) {
|
|
|
+ if (orderBo.getCardId() != null && orderBo.getCardId() > 0) {
|
|
|
//如果传入了cardId,根据cardId查询卡片信息
|
|
|
- ptCardVo = cardService.queryById(bo.getCardId());
|
|
|
+ ptCardVo = cardService.queryById(orderBo.getCardId());
|
|
|
} else {
|
|
|
//查询当前人的正常主卡
|
|
|
- ptCardVo = cardService.queryMainCardByUserId(bo.getUserId());
|
|
|
+ ptCardVo = cardService.queryMainCardByUserId(orderBo.getUserId());
|
|
|
}
|
|
|
- list.add(ptCardVo);
|
|
|
- //3.钱包辅助信息
|
|
|
- PtBagVo ptBagVo = bagService.queryByUserBagCode(bo.getUserId(), bo.getBagCode());
|
|
|
- list.add(ptBagVo);
|
|
|
- //4.设备辅助信息
|
|
|
- XfTermVo xfTermVo = termService.queryByNo(bo.getTermNo() == null ? 0 : bo.getTermNo());
|
|
|
- list.add(xfTermVo);
|
|
|
- //5.工作站辅助信息
|
|
|
- PtWorkstationVo ptWorkstationVo = workstationService.queryById(bo.getStationId());
|
|
|
- list.add(ptWorkstationVo);
|
|
|
+ return ptCardVo;
|
|
|
+ }
|
|
|
|
|
|
- return list;
|
|
|
+ /**
|
|
|
+ * 检查资金收支钱包信息,资金收支必须有对应的收支钱包
|
|
|
+ * @param orderBo 资金收支业务对象
|
|
|
+ * @return 钱包信息
|
|
|
+ */
|
|
|
+ public PtBagVo checkUserBag(PurseInOutBo orderBo){
|
|
|
+ PtBagVo ptBagVo = bagService.queryByUserBagCode(orderBo.getUserId(), orderBo.getBagCode());
|
|
|
+ if(ObjUtil.isEmpty(ptBagVo)){
|
|
|
+ throw new PaymentsException(MessageFormat.format("无此账户钱包信息,账户Id:{0},钱包代码:{1}",orderBo.getUserId(),orderBo.getBagCode()));
|
|
|
+ }
|
|
|
+ return ptBagVo;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 检查资金收支消费设备信息,有些收支操作是通过专用消费机操作的,设备信息有可能为空
|
|
|
+ * @param orderBo 资金收支业务对象
|
|
|
+ * @return 设备信息
|
|
|
+ */
|
|
|
+ public XfTermVo checkTerm(PurseInOutBo orderBo){
|
|
|
+ if(orderBo.getTermNo()==null || orderBo.getTermNo()==0L){
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ return termService.queryByNo(orderBo.getTermNo());
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 检查资金收支消费工作站信息,有些收支操作是通过工作站操作,工作站信息有可能为空
|
|
|
+ * @param orderBo 资金收支业务对象
|
|
|
+ * @return 工作站信息
|
|
|
+ */
|
|
|
+ public PtWorkstationVo checkWorkStation(PurseInOutBo orderBo){
|
|
|
+ if(orderBo.getStationId()==null || orderBo.getStationId()==0L){
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ //这里的工作站Id实际上对应的是工作站的编号
|
|
|
+ return workstationService.queryById(orderBo.getStationId());
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 计算收支操作后的钱包余额
|
|
|
+ * @param bagVo 钱包信息
|
|
|
+ * @param orderBo 收支订单业务对象
|
|
|
+ */
|
|
|
+ public void calculateBalance(PtBagVo bagVo,PurseInOutBo orderBo){
|
|
|
+ if (Objects.requireNonNull(orderBo.getCreditType()) == CreditTypeEnum.COMMISSION_CHARGE) {
|
|
|
+ //管理费实际是不扣钱包余额的
|
|
|
+ orderBo.setBalance(bagVo.getBalance());
|
|
|
+ } else {
|
|
|
+ orderBo.setBalance(bagVo.getBalance().add(orderBo.getReceiptMoney()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 收支入账前校验收支原始记录
|
|
|
+ *
|
|
|
+ * @param originalId 原始记录Id
|
|
|
+ */
|
|
|
+ public void ValidOriginalRecord(String originalId) {
|
|
|
+ String message;
|
|
|
+ XfCreditAccountBackVo xfCreditaccountbackVo = creditAccountBackService.queryById(originalId);
|
|
|
+ if (ObjUtil.isEmpty(xfCreditaccountbackVo)) {
|
|
|
+ message = MessageUtils.message("payments.OriginalRecord.get", originalId);
|
|
|
+ throw new PaymentsException(message);
|
|
|
+ }
|
|
|
+ String accountId = xfCreditaccountbackVo.getCreditId();
|
|
|
+ if (StrUtil.isNotEmpty(accountId)) {
|
|
|
+ message = MessageUtils.message("payments.OriginalRecord.isPost", originalId, accountId);
|
|
|
+ throw new PaymentsException(message);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 资金收支时计算管理费
|
|
|
+ * @param bo 资金收支业务对象
|
|
|
+ * @return 管理费收支业务对象
|
|
|
+ */
|
|
|
+ public PurseInOutBo computeCommission(PurseInOutBo bo) {
|
|
|
+ if (bo.getTakeCommission().equals(Constants.TAKE_COMMISSION)) {
|
|
|
+ Long cardType = bo.getCardTypeId();
|
|
|
+ if (bo.getCardTypeId() == null) {
|
|
|
+ PtUserAccountVo accountVo = userAccountService.queryById(bo.getUserId());
|
|
|
+ cardType = accountVo.getCardType();
|
|
|
+ }
|
|
|
+ bo.setCardTypeId(cardType);
|
|
|
+ //如果要收管理费,则计算管理费
|
|
|
+ PtBagBo bagBo = BeanUtil.copyProperties(bo, PtBagBo.class);
|
|
|
+ BigDecimal commission = cardService.computeCommission(bagBo);
|
|
|
+ if (commission.compareTo(BigDecimal.ZERO) > 0) {
|
|
|
+ //如果管理费>0,是要入资金收支记录的
|
|
|
+ PurseInOutBo commissionBo = new PurseInOutBo();
|
|
|
+ BeanUtil.copyProperties(bo, commissionBo);
|
|
|
+ commissionBo.setReceiptMoney(commission);
|
|
|
+ commissionBo.setCreditType(CreditTypeEnum.COMMISSION_CHARGE);
|
|
|
+ //个人收支入账的金额要减去收掉的管理费
|
|
|
+ bo.setReceiptMoney(bo.getReceiptMoney().subtract(commission));
|
|
|
+ return commissionBo;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
/**
|
|
|
* 生成原始收支记录(收支流水备份表)
|
|
|
*
|
|
|
@@ -106,7 +208,7 @@ public class PaymentsBusiness {
|
|
|
* @param workstationVo 资金收支工作站信息
|
|
|
* @return 原始收支记录
|
|
|
*/
|
|
|
- public XfCreditAccountBackVo createOriginalRecord(PtBagBo bo, PtUserAccountVo accountVo, PtCardVo cardVo, PtBagVo bagVo, XfTermVo termVo, PtWorkstationVo workstationVo) {
|
|
|
+ public XfCreditAccountBackVo createOriginalRecord(PurseInOutBo bo, PtUserAccountVo accountVo, PtCardVo cardVo, PtBagVo bagVo, XfTermVo termVo, PtWorkstationVo workstationVo) {
|
|
|
XfCreditAccountBackBo xfCreditaccountbackBo = new XfCreditAccountBackBo();
|
|
|
String backId = getRecordKeyId(bo, accountVo, bagVo);
|
|
|
xfCreditaccountbackBo.setBackId(backId);
|
|
|
@@ -126,11 +228,10 @@ public class PaymentsBusiness {
|
|
|
//设置交易卡片数据mq
|
|
|
if (ObjUtil.isNotEmpty(cardVo)) {
|
|
|
xfCreditaccountbackBo.setCardNo(cardVo.getCardNo());
|
|
|
- xfCreditaccountbackBo.setMainCard(cardVo.getMainCard());
|
|
|
}
|
|
|
//设置账户钱包信息
|
|
|
xfCreditaccountbackBo.setBagType(bagVo.getBagCode());
|
|
|
- xfCreditaccountbackBo.setCardValue(bagVo.getBalance());
|
|
|
+ xfCreditaccountbackBo.setCardValue(bo.getBalance());
|
|
|
|
|
|
//设置交易设备信息
|
|
|
if (ObjUtil.isNotEmpty(termVo)) {
|
|
|
@@ -142,11 +243,11 @@ public class PaymentsBusiness {
|
|
|
if (ObjUtil.isNotEmpty(workstationVo)) {
|
|
|
xfCreditaccountbackBo.setStationId(workstationVo.getStationId());
|
|
|
}
|
|
|
-
|
|
|
+ //原始订单入库
|
|
|
XfCreditAccountBackVo creditAccountBackVo = creditAccountBackService.createOriginalRecord(xfCreditaccountbackBo);
|
|
|
if (ObjUtil.isEmpty(creditAccountBackVo)) {
|
|
|
String message = MessageUtils.message("payments.OriginalRecord.create", JSONUtil.parse(bo));
|
|
|
- throw new PaymentsException("资金收支-原始记录", message);
|
|
|
+ throw new PaymentsException(message);
|
|
|
}
|
|
|
return creditAccountBackVo;
|
|
|
}
|
|
|
@@ -162,9 +263,7 @@ public class PaymentsBusiness {
|
|
|
* @param originalId 原始收支记录Id(收支备份表主键)
|
|
|
* @return 正式收支记录
|
|
|
*/
|
|
|
- public XfCreditAccountVo keepAccounts(PtBagBo bo, PtUserAccountVo accountVo, PtCardVo cardVo, PtBagVo bagVo, XfTermVo termVo, PtWorkstationVo workstationVo, String originalId) {
|
|
|
- //校验要处理的原始收支记录
|
|
|
- ValidOriginalRecord(originalId);
|
|
|
+ public XfCreditAccountVo keepAccounts(PurseInOutBo bo, PtUserAccountVo accountVo, PtCardVo cardVo, PtBagVo bagVo, XfTermVo termVo, PtWorkstationVo workstationVo, String originalId) {
|
|
|
XfCreditAccountBo xfCreditaccountbo = new XfCreditAccountBo();
|
|
|
String accountId = getRecordKeyId(bo, accountVo, bagVo);
|
|
|
xfCreditaccountbo.setCreditId(accountId);
|
|
|
@@ -183,36 +282,46 @@ public class PaymentsBusiness {
|
|
|
xfCreditaccountbo.setDeptId(accountVo.getDeptId());
|
|
|
xfCreditaccountbo.setDeptName(accountVo.getDeptName());
|
|
|
//设置设备信息
|
|
|
- xfCreditaccountbo.setTermNo(termVo.getTermNo());
|
|
|
- xfCreditaccountbo.setTermName(termVo.getTermName());
|
|
|
- xfCreditaccountbo.setTermRecordId(bo.getTermRecordId());
|
|
|
- //设置工作站信息
|
|
|
- xfCreditaccountbo.setStationNumb(workstationVo.getStationNumb());
|
|
|
- xfCreditaccountbo.setStationName(workstationVo.getStationName());
|
|
|
+ if(ObjUtil.isNotEmpty(termVo)) {
|
|
|
+ xfCreditaccountbo.setTermNo(termVo.getTermNo());
|
|
|
+ xfCreditaccountbo.setTermName(termVo.getTermName());
|
|
|
+ xfCreditaccountbo.setTermRecordId(bo.getTermRecordId());
|
|
|
+ }
|
|
|
+ if(ObjUtil.isNotEmpty(workstationVo)) {
|
|
|
+ //设置工作站信息
|
|
|
+ xfCreditaccountbo.setStationNumb(workstationVo.getStationNumb());
|
|
|
+ xfCreditaccountbo.setStationName(workstationVo.getStationName());
|
|
|
+ }
|
|
|
//设置卡片信息
|
|
|
xfCreditaccountbo.setCardNo(cardVo.getCardNo());
|
|
|
- xfCreditaccountbo.setCardValue(bagVo.getBalance());
|
|
|
xfCreditaccountbo.setCardType(cardVo.getCardType());
|
|
|
xfCreditaccountbo.setCardCount(bagVo.getRechargeCount() + 1);
|
|
|
xfCreditaccountbo.setCardTypeName(cardVo.getCardTypeName());
|
|
|
xfCreditaccountbo.setMainCard(cardVo.getMainCard());
|
|
|
//设置钱包信息
|
|
|
xfCreditaccountbo.setBagType(bagVo.getBagCode());
|
|
|
+ xfCreditaccountbo.setCardValue(bo.getBalance());
|
|
|
// 设置操作员信息
|
|
|
- xfCreditaccountbo.setOperatorId(bo.getOperatorId());
|
|
|
xfCreditaccountbo.setOperatorName(bo.getOperatorName());
|
|
|
+ xfCreditaccountbo.setOperatorId(bo.getOperatorId());
|
|
|
|
|
|
xfCreditaccountbo.setOriginalId(originalId);
|
|
|
|
|
|
XfCreditAccountVo creditAccountVo = creditAccountService.keepAccounts(xfCreditaccountbo);
|
|
|
if (ObjUtil.isEmpty(creditAccountVo)) {
|
|
|
String message = MessageUtils.message("payments.keepAccounts.create", originalId);
|
|
|
- throw new PaymentsException("资金收支-收支入账", message);
|
|
|
+ throw new PaymentsException(message);
|
|
|
}
|
|
|
return creditAccountVo;
|
|
|
}
|
|
|
|
|
|
- public XfUserTotalVo createOrUpdateUserTotal(PtBagBo bo, PtUserAccountVo accountVo, PtCardVo cardVo) {
|
|
|
+ /**
|
|
|
+ * 处理个人日统计表
|
|
|
+ * @param bo 收支信息
|
|
|
+ * @param accountVo 账户信息
|
|
|
+ * @param cardVo 账户卡片信息
|
|
|
+ */
|
|
|
+ public void createOrUpdateUserTotal(PurseInOutBo bo, PtUserAccountVo accountVo, PtCardVo cardVo) {
|
|
|
XfUserTotalBo xfUserTotalBo = new XfUserTotalBo();
|
|
|
xfUserTotalBo.setUserId(accountVo.getUserId());
|
|
|
xfUserTotalBo.setUserNumb(accountVo.getUserNumb());
|
|
|
@@ -223,80 +332,49 @@ public class PaymentsBusiness {
|
|
|
xfUserTotalBo.setUseType(bo.getUseType().code());
|
|
|
xfUserTotalBo.setCreditMoney(bo.getReceiptMoney());
|
|
|
|
|
|
- return userTotalService.createOrUpdateUserTotal(xfUserTotalBo);
|
|
|
+ XfUserTotalVo vo = userTotalService.createOrUpdateUserTotal(xfUserTotalBo);
|
|
|
+ if (ObjUtil.isEmpty(vo)) {
|
|
|
+ String message = MessageUtils.message("payments.userTotal.failure", bo.getOriginalId());
|
|
|
+ throw new PaymentsException(message);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- public PtBagVo updateBalance(PtBagBo bagBo) {
|
|
|
+ /**
|
|
|
+ * 更新钱包余额
|
|
|
+ * @param bo 收支业务对象
|
|
|
+ * @return 更新后钱包余额
|
|
|
+ */
|
|
|
+ public PtBagVo updateBalance(PurseInOutBo bo) {
|
|
|
+ PtBagBo bagBo = BeanUtil.copyProperties(bo, PtBagBo.class);
|
|
|
return bagService.updateBalanceByBo(bagBo);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 通用收支入账处理逻辑
|
|
|
- * 这里主要是处理一次性完成的原始订单生成、收支记账
|
|
|
- *
|
|
|
- * @param bo 资金收支信息
|
|
|
- * @return 辅助信息
|
|
|
+ * 更新原始订单的入账状态
|
|
|
+ * @param bo 收支信息
|
|
|
+ * @param status 入账状态
|
|
|
+ * @param cardValue 入账后账户余额
|
|
|
*/
|
|
|
- public List<Object> createOrderMin(PtBagBo bo) {
|
|
|
- log.info("[开始生成{}订单]-{}", bo.getCreditType().message(), JSONUtil.toJsonStr(bo));
|
|
|
- //1.处理入账需要的其它信息
|
|
|
- List<Object> list = getOtherInfo(bo);
|
|
|
- PtUserAccountVo accountVo = list.get(0) == null ? new PtUserAccountVo() : (PtUserAccountVo) list.get(0);
|
|
|
- PtCardVo cardVo = list.get(1) == null ? new PtCardVo() : (PtCardVo) list.get(1);
|
|
|
- PtBagVo bagVo = list.get(2) == null ? new PtBagVo() : (PtBagVo) list.get(2);
|
|
|
- XfTermVo termVo = list.get(3) == null ? new XfTermVo() : (XfTermVo) list.get(3);
|
|
|
- PtWorkstationVo workstationVo = list.get(4) == null ? new PtWorkstationVo() : (PtWorkstationVo) list.get(4);
|
|
|
-
|
|
|
- //2.创建收支订单
|
|
|
- XfCreditAccountBackVo creditBackVo = createOriginalRecord(bo, (PtUserAccountVo) list.get(0),
|
|
|
- (PtCardVo) list.get(1), (PtBagVo) list.get(2), (XfTermVo) list.get(3), (PtWorkstationVo) list.get(4));
|
|
|
- bo.setOriginalId(creditBackVo.getBackId());
|
|
|
- //3.收支入账,此处只需要入收支明细表就可以了
|
|
|
- log.info("[{}订单生成完成,开始生成{}收支记录]-{}", bo.getCreditType().message(), bo.getCreditType().message(), JSONUtil.toJsonStr(bo));
|
|
|
- XfCreditAccountVo creditVo = keepAccounts(bo, accountVo, cardVo, bagVo, termVo, workstationVo, creditBackVo.getBackId());
|
|
|
- bo.setCreditId(creditVo.getCreditId());
|
|
|
- return list;
|
|
|
+ public void updateOriginalOrderStatus(PurseInOutBo bo, Integer status, BigDecimal cardValue) {
|
|
|
+ creditAccountBackService.updateStatusById(bo.getOriginalId(), status, bo.getCreditId(), cardValue);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 通用收支入账处理逻辑
|
|
|
- * 这里主要是处理一次性完成的原始订单生成、收支记账和更新个人日统计表功能
|
|
|
- *
|
|
|
- * @param bo 资金收支信息
|
|
|
+ * 获取待入账的补助明细
|
|
|
+ * @return 补助明细
|
|
|
*/
|
|
|
- public void createOrderNormal(PtBagBo bo) {
|
|
|
- List<Object> list = createOrderMin(bo);
|
|
|
- PtUserAccountVo accountVo = list.get(0) == null ? new PtUserAccountVo() : (PtUserAccountVo) list.get(0);
|
|
|
- PtCardVo cardVo = list.get(1) == null ? new PtCardVo() : (PtCardVo) list.get(1);
|
|
|
-
|
|
|
- //4.写日统计表
|
|
|
- log.info("[收支记录生成完成,开始写个人日统计表]-{}", JSONUtil.toJsonStr(bo));
|
|
|
- createOrUpdateUserTotal(bo, accountVo, cardVo);
|
|
|
- }
|
|
|
-
|
|
|
- public void updateOrderStatus(PtBagBo bo, Integer status, BigDecimal cardValue) {
|
|
|
- creditAccountBackService.updateStatusById(bo.getOriginalId(), status, bo.getCreditId(), cardValue);
|
|
|
+ public List<PtSubsidyitemVo> selectPostSubsidyItem(){
|
|
|
+ return subsidyItemService.selectPostSubsidyItem();
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 收支入账前校验收支原始记录
|
|
|
- *
|
|
|
- * @param originalId 原始记录Id
|
|
|
+ * 更新补助明细的到账状态
|
|
|
+ * @param bo 补助明细
|
|
|
+ * @return 更新状态
|
|
|
*/
|
|
|
- private void ValidOriginalRecord(String originalId) {
|
|
|
- String message;
|
|
|
- XfCreditAccountBackVo xfCreditaccountbackVo = creditAccountBackService.queryById(originalId);
|
|
|
- if (ObjUtil.isEmpty(xfCreditaccountbackVo)) {
|
|
|
- message = MessageUtils.message("payments.OriginalRecord.get", originalId);
|
|
|
- throw new PaymentsException("资金收支-原始记录", message);
|
|
|
- }
|
|
|
- String accountId = xfCreditaccountbackVo.getCreditId();
|
|
|
- if (StrUtil.isNotEmpty(accountId)) {
|
|
|
- message = MessageUtils.message("payments.OriginalRecord.isPost", originalId, accountId);
|
|
|
- throw new PaymentsException("资金收支-原始记录", message);
|
|
|
- }
|
|
|
+ public boolean updatePostSubsidyItemStatus(PtSubsidyitemBo bo){
|
|
|
+ return subsidyItemService.updateByBo(bo);
|
|
|
}
|
|
|
-
|
|
|
/**
|
|
|
* 生成资金收支备份表和收支表的32位主键Id
|
|
|
*
|
|
|
@@ -306,7 +384,7 @@ public class PaymentsBusiness {
|
|
|
* @return 生成的记录Id
|
|
|
*/
|
|
|
@NotNull
|
|
|
- private String getRecordKeyId(PtBagBo bo, PtUserAccountVo accountVo, PtBagVo bagVo) {
|
|
|
+ private String getRecordKeyId(PurseInOutBo bo, PtUserAccountVo accountVo, PtBagVo bagVo) {
|
|
|
BigDecimal a = new BigDecimal(100);
|
|
|
int key3 = 0;
|
|
|
if (bo.getReceiptMoney().compareTo(BigDecimal.ZERO) > 0) {
|