|
|
@@ -45,6 +45,7 @@ import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import java.math.BigDecimal;
|
|
|
import java.text.DecimalFormat;
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.util.ArrayList;
|
|
|
@@ -168,6 +169,23 @@ public class WalletService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 资金明细设置退款中金额
|
|
|
+ *
|
|
|
+ * @param fundVo 返回值vo
|
|
|
+ */
|
|
|
+ private void refundMoney2(FundVo fundVo) {
|
|
|
+ DecimalFormat df = new DecimalFormat("0.00");
|
|
|
+ LambdaQueryWrapper<KwpWalletRefund> wrapper = new LambdaQueryWrapper<>();
|
|
|
+ wrapper.eq(KwpWalletRefund::getUid, fundVo.getUid()).eq(KwpWalletRefund::getFilter, fundVo.getFilter()).eq(KwpWalletRefund::getChannel, fundVo.getChannel()).eq(KwpWalletRefund::getStatus, RefundEnum.REFUNDING.getStatus()).last("limit 1");
|
|
|
+ KwpWalletRefund kwpWalletRefund = kwpWalletRefundMapper.selectOne(wrapper);
|
|
|
+ if (Objects.nonNull(kwpWalletRefund)) {
|
|
|
+ fundVo.setRefundMoney(df.format(kwpWalletRefund.getActualMoney()));
|
|
|
+ } else {
|
|
|
+ fundVo.setRefundMoney("0.00");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 钱包总览信息
|
|
|
*
|
|
|
@@ -255,7 +273,7 @@ public class WalletService {
|
|
|
fundVo.setWithdrawingMoney(dfMoney(re.getWithdrawingMoney()));
|
|
|
fundVo.setChargingMoney(dfMoney(re.getChargingMoney()));
|
|
|
fundVo.setTotalMoney(dfMoney(re.getTotalMoney()));
|
|
|
-// fundVo.setRefundMoney(dfMoney(re.getMoney()));
|
|
|
+ refundMoney2(fundVo);
|
|
|
vo.add(fundVo);
|
|
|
}
|
|
|
DecimalFormat df = new DecimalFormat("0.00");
|
|
|
@@ -304,18 +322,14 @@ public class WalletService {
|
|
|
*
|
|
|
* @return
|
|
|
*/
|
|
|
- public Object addWalletMoney(AddWalletReq addWalletReq) {
|
|
|
+ public Object addWalletMoney(WalletAppendReq addWalletReq) {
|
|
|
log.info("账目充值:{}", JSONObject.toJSONString(addWalletReq));
|
|
|
Long entId1 = LoginUserHolder.getEntId();
|
|
|
String uid = walletRelationService.getRelation(entId1);
|
|
|
if (StringUtils.isBlank(uid)) {
|
|
|
throw new BusinessException("您暂未开通电子钱包");
|
|
|
}
|
|
|
- String entId = addWalletReq.getEntId();
|
|
|
- String filter = walletRelationService.getRelation(Long.parseLong(entId));
|
|
|
- if (StringUtils.isBlank(filter)) {
|
|
|
- throw new BusinessException("合作单位暂未开通电子钱包");
|
|
|
- }
|
|
|
+ String filter = addWalletReq.getFilter();
|
|
|
ChannelEnum channelEnum = ChannelEnum.getByChannel(addWalletReq.getChannel());
|
|
|
if (Objects.isNull(channelEnum)) {
|
|
|
throw new BusinessException("支付通道不存在");
|
|
|
@@ -648,7 +662,11 @@ public class WalletService {
|
|
|
throw new BusinessException("支付通道不存在");
|
|
|
}
|
|
|
|
|
|
- R<Order> orderR = payCenterService.advancePayApply(uid, channelEnum, prePay.getEntId(), prePay.bigMoney(prePay.getMoney()));
|
|
|
+ String filter = walletRelationService.getRelation(Long.parseLong(prePay.getEntId()));
|
|
|
+ if (StringUtils.isBlank(filter)) {
|
|
|
+ throw new BusinessException("合作企业开通电子钱包");
|
|
|
+ }
|
|
|
+ R<Order> orderR = payCenterService.advancePayApply(uid, channelEnum, filter, prePay.bigMoney(prePay.getMoney()));
|
|
|
if (!orderR.getStatus()) {
|
|
|
throw new BusinessException(StringUtils.isNotBlank(orderR.getMsg()) ? orderR.getMsg() : "预付失败");
|
|
|
}
|
|
|
@@ -702,6 +720,7 @@ public class WalletService {
|
|
|
kwpWalletRefundAdd.setToEnt(walletRelationService.getEnt(refundReq.getFilter()));
|
|
|
kwpWalletRefundAdd.setChannel(refundReq.getChannel());
|
|
|
kwpWalletRefundAdd.setMoney(refundReq.getMoney());
|
|
|
+ kwpWalletRefundAdd.setActualMoney(new BigDecimal("0.0"));
|
|
|
kwpWalletRefundAdd.setRemark(refundReq.getRemark());
|
|
|
kwpWalletRefundAdd.setCreateBy(LoginUserHolder.getUserId());
|
|
|
kwpWalletRefundAdd.setCreateTime(LocalDateTime.now());
|