|
|
@@ -1,5 +1,7 @@
|
|
|
package com.sckw.payment.service;
|
|
|
|
|
|
+import cn.hutool.core.bean.BeanUtil;
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
|
import com.alibaba.fastjson2.JSONObject;
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
@@ -14,6 +16,7 @@ import com.sckw.manage.api.RemoteManageService;
|
|
|
import com.sckw.manage.api.model.dto.res.FindEntCooperateResVo;
|
|
|
import com.sckw.payment.api.model.constant.ChannelEnum;
|
|
|
import com.sckw.payment.api.model.dto.WalletDto;
|
|
|
+import com.sckw.payment.api.model.dto.WalletVo;
|
|
|
import com.sckw.payment.api.model.dto.common.R;
|
|
|
import com.sckw.payment.dao.KwpWalletReceiveMapper;
|
|
|
import com.sckw.payment.dao.KwpWalletRefundMapper;
|
|
|
@@ -370,6 +373,7 @@ public class WalletService {
|
|
|
channelDetail = new ChannelDetail();
|
|
|
channelDetail.setChannel(key);
|
|
|
channelDetail.setName(WalletChannelEnum.getDesc(key));
|
|
|
+ channelDetail.setUid(uid);
|
|
|
channelDetail.setMoney(String.valueOf(money / 100D));
|
|
|
channelDetail.setTotalMoney(String.valueOf(totalMoney / 100D));
|
|
|
channelDetail.setOpenFlag(true);
|
|
|
@@ -385,6 +389,7 @@ public class WalletService {
|
|
|
channelDetail = new ChannelDetail();
|
|
|
channelDetail.setChannel(channel);
|
|
|
channelDetail.setName(WalletChannelEnum.getDesc(channel));
|
|
|
+ channelDetail.setUid(uid);
|
|
|
channelDetail.setMoney("-");
|
|
|
channelDetail.setTotalMoney("-");
|
|
|
channelDetail.setOpenFlag(true);
|
|
|
@@ -699,17 +704,22 @@ public class WalletService {
|
|
|
*/
|
|
|
public Object cashOUt(CashWalletReq cashWalletReq) {
|
|
|
log.info("提现:{}", JSONObject.toJSONString(cashWalletReq));
|
|
|
- ChannelEnum byChannel = ChannelEnum.getByChannel(cashWalletReq.getChannel());
|
|
|
+ ChannelEnum byChannel = ChannelEnum.getByValue(cashWalletReq.getChannel());
|
|
|
if (Objects.isNull(byChannel)) {
|
|
|
throw new BusinessException("支付通道不存在");
|
|
|
}
|
|
|
- R<Order> payIndexR = payCenterService.withdrawTake(cashWalletReq.getUid(), byChannel, cashWalletReq.bigMoney(cashWalletReq.getMoney()), cashWalletReq.getRemark());
|
|
|
+ String uid = walletRelationService.getRelation(LoginUserHolder.getEntId());
|
|
|
+ if (StringUtils.isBlank(uid)) {
|
|
|
+ throw new BusinessException("您暂未开通电子钱包");
|
|
|
+ }
|
|
|
+ R<Order> payIndexR = payCenterService.withdrawTake(uid, byChannel, cashWalletReq.bigMoney(cashWalletReq.getMoney()), cashWalletReq.getRemark());
|
|
|
if (!payIndexR.getStatus()) {
|
|
|
throw new BusinessException(StringUtils.isNotBlank(payIndexR.getMsg()) ? payIndexR.getMsg() : "申请提现异常");
|
|
|
}
|
|
|
KwpWallet kwpWallet = new KwpWallet();
|
|
|
- kwpWallet.setUid(cashWalletReq.getUid());
|
|
|
- kwpWallet.setFilter(cashWalletReq.getFilter());
|
|
|
+ kwpWallet.setUid(uid);
|
|
|
+ //提现只需要知道收款方的uid就行。
|
|
|
+ kwpWallet.setFilter("");
|
|
|
kwpWallet.setChannel(byChannel.getChannel());
|
|
|
kwpWallet.setAction(WalletActionEnum.CASHING.getDesc());
|
|
|
kwpWallet.setActionTime(LocalDateTime.now());
|
|
|
@@ -734,8 +744,12 @@ public class WalletService {
|
|
|
if (Objects.isNull(byChannel)) {
|
|
|
throw new BusinessException("支付通道不存在");
|
|
|
}
|
|
|
+ String uid = walletRelationService.getRelation(LoginUserHolder.getEntId());
|
|
|
+ if (StringUtils.isBlank(uid)) {
|
|
|
+ throw new BusinessException("您暂未开通电子钱包");
|
|
|
+ }
|
|
|
//申请提现
|
|
|
- R<Order> orderR = payCenterService.withdrawTake(cashWalletReq.getUid(), byChannel, cashWalletReq.bigMoney(cashWalletReq.getMoney()), cashWalletReq.getRemark());
|
|
|
+ R<Order> orderR = payCenterService.withdrawTake(uid, byChannel, cashWalletReq.bigMoney(cashWalletReq.getMoney()), cashWalletReq.getRemark());
|
|
|
log.info("重新提现-申请提现:{}", JSONObject.toJSONString(orderR));
|
|
|
if (!orderR.getStatus()) {
|
|
|
throw new BusinessException(StringUtils.isNotBlank(orderR.getMsg()) ? orderR.getMsg() : "申请提现异常");
|
|
|
@@ -1415,6 +1429,7 @@ public class WalletService {
|
|
|
kwpWalletService.saveTime(uid, filter, channelEnum.getChannel());
|
|
|
return orderR.getData();
|
|
|
}
|
|
|
+
|
|
|
public Object dealQuery(OperateReq operateReq) {
|
|
|
String[] strings = new String[0];
|
|
|
if (StringUtils.isNotBlank(operateReq.getStartTime()) && StringUtils.isNotBlank(operateReq.getEndTime())) {
|
|
|
@@ -1434,7 +1449,11 @@ public class WalletService {
|
|
|
operateVo.setTypeText(row.getTypeText());
|
|
|
operateVo.setType(row.getType());
|
|
|
operateVo.setApMoney(BigDecimal.valueOf(row.getApMoney().getValue() / 100D));
|
|
|
- operateVo.setFilter(row.getFilter());
|
|
|
+ //前端取的filter作为往来单位。中台这里是uid其实代表的
|
|
|
+ Filter filter = row.getFilter();
|
|
|
+ if (Objects.nonNull(filter)) {
|
|
|
+ operateVo.setFilter(new Filter(filter.getUid(), getFirmName(filter.getUid())));
|
|
|
+ }
|
|
|
operateVo.setUid(row.getUid());
|
|
|
operateVo.setFile(row.getFile());
|
|
|
operateVo.setMoney(BigDecimal.valueOf(row.getMoney().getValue() / 100D));
|
|
|
@@ -2287,6 +2306,36 @@ public class WalletService {
|
|
|
return new PageRes<>(moneyPage.getPage(), moneyPage.getPageSize(), 0, 0, new ArrayList<>());
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 提现确认
|
|
|
+ *
|
|
|
+ * @param cashCheck
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public WalletVo cashCheck(CashCheck cashCheck) {
|
|
|
+ String uid = walletRelationService.getRelation(LoginUserHolder.getEntId());
|
|
|
+ if (StringUtils.isBlank(uid)) {
|
|
|
+ throw new BusinessException("您暂未开通电子钱包");
|
|
|
+ }
|
|
|
+ R<List<WalletDto>> wallet = payCenterService.wallet(uid, ChannelEnum.getByValue(cashCheck.getChannel()), "");
|
|
|
+ if (org.springframework.util.CollectionUtils.isEmpty(wallet.getData())) {
|
|
|
+ throw new BusinessException("交易双方暂未开通电子钱包");
|
|
|
+ }
|
|
|
+ //获取filter为空的提现钱包
|
|
|
+ List<WalletDto> data = wallet.getData();
|
|
|
+ Optional<WalletVo> first = data.stream().filter(d -> StrUtil.isBlank(d.getFilter())).map(walletDto -> {
|
|
|
+ WalletVo walletVo = BeanUtil.copyProperties(walletDto, WalletVo.class);
|
|
|
+ walletVo.setFreeze(Objects.nonNull(walletDto.getFreeze()) ? BigDecimal.valueOf(walletDto.getFreeze() / 100D) : new BigDecimal("0"));
|
|
|
+ walletVo.setApMoney(Objects.nonNull(walletDto.getApMoney()) ? BigDecimal.valueOf(walletDto.getApMoney() / 100D) : new BigDecimal("0"));
|
|
|
+ walletVo.setTotalMoney(Objects.nonNull(walletDto.getTotalMoney()) ? BigDecimal.valueOf(walletDto.getTotalMoney() / 100D) : new BigDecimal("0"));
|
|
|
+ walletVo.setMoney(Objects.nonNull(walletDto.getMoney()) ? BigDecimal.valueOf(walletDto.getMoney() / 100D) : new BigDecimal("0"));
|
|
|
+ walletVo.setChargingMoney(Objects.nonNull(walletDto.getChargingMoney()) ? BigDecimal.valueOf(walletDto.getChargingMoney() / 100D) : new BigDecimal("0"));
|
|
|
+ walletVo.setWithdrawingMoney(Objects.nonNull(walletDto.getWithdrawingMoney()) ? BigDecimal.valueOf(walletDto.getWithdrawingMoney() / 100D) : new BigDecimal("0"));
|
|
|
+ return walletVo;
|
|
|
+ }).findFirst();
|
|
|
+ return first.orElse(new WalletVo());
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 退款处理
|
|
|
*
|