|
|
@@ -7,10 +7,7 @@ import com.sckw.core.common.enums.NumberConstant;
|
|
|
import com.sckw.core.exception.BusinessException;
|
|
|
import com.sckw.core.model.constant.Global;
|
|
|
import com.sckw.core.model.page.PageRes;
|
|
|
-import com.sckw.core.utils.CollectionUtils;
|
|
|
-import com.sckw.core.utils.IdWorker;
|
|
|
-import com.sckw.core.utils.OrderUtils;
|
|
|
-import com.sckw.core.utils.StringTimeUtil;
|
|
|
+import com.sckw.core.utils.*;
|
|
|
import com.sckw.core.web.context.LoginUserHolder;
|
|
|
import com.sckw.core.web.response.HttpResult;
|
|
|
import com.sckw.manage.api.RemoteManageService;
|
|
|
@@ -21,13 +18,11 @@ import com.sckw.payment.api.model.dto.common.R;
|
|
|
import com.sckw.payment.dao.KwpWalletRefundMapper;
|
|
|
import com.sckw.payment.dao.KwpWalletTransferMapper;
|
|
|
import com.sckw.payment.job.AsyncPool;
|
|
|
+import com.sckw.payment.model.KwpWallet;
|
|
|
import com.sckw.payment.model.KwpWalletRefund;
|
|
|
import com.sckw.payment.model.KwpWalletRelation;
|
|
|
import com.sckw.payment.model.KwpWalletTransfer;
|
|
|
-import com.sckw.payment.model.constant.PrePayEnum;
|
|
|
-import com.sckw.payment.model.constant.RefundEnum;
|
|
|
-import com.sckw.payment.model.constant.TransferEnum;
|
|
|
-import com.sckw.payment.model.constant.WalletChannelEnum;
|
|
|
+import com.sckw.payment.model.constant.*;
|
|
|
import com.sckw.payment.model.dto.WalletInfoDto;
|
|
|
import com.sckw.payment.model.dto.WalletRelationDto;
|
|
|
import com.sckw.payment.model.dto.common.BusinessNo;
|
|
|
@@ -41,7 +36,6 @@ import com.sckw.payment.model.vo.req.page.MoneyPage;
|
|
|
import com.sckw.payment.model.vo.req.page.PrePayPage;
|
|
|
import com.sckw.payment.model.vo.req.page.RefundPage;
|
|
|
import com.sckw.payment.model.vo.res.*;
|
|
|
-import com.sckw.core.utils.DateTimeUtil;
|
|
|
import com.sckw.redis.config.RedisLockUtil;
|
|
|
import com.sckw.redis.constant.RedisLockKey;
|
|
|
import com.sckw.system.api.RemoteSystemService;
|
|
|
@@ -83,6 +77,7 @@ public class WalletService {
|
|
|
private final KwpWalletTransferMapper kwpWalletTransferMapper;
|
|
|
private final RedisLockUtil redisLockUtil;
|
|
|
private final KwpWalletRefundSubService kwpWalletRefundSubService;
|
|
|
+ private final KwpWalletService kwpWalletService;
|
|
|
@DubboReference(version = "1.0.0", group = "design", check = false)
|
|
|
private RemoteSystemService remoteSystemService;
|
|
|
@DubboReference(version = "1.0.0", group = "design", check = false)
|
|
|
@@ -220,6 +215,15 @@ public class WalletService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 更新时间填充
|
|
|
+ *
|
|
|
+ * @param prePayWalletVo
|
|
|
+ */
|
|
|
+ private void time(PrePayWalletVo prePayWalletVo) {
|
|
|
+ prePayWalletVo.setUpdateTime(kwpWalletService.queryTime(prePayWalletVo.getUid(), prePayWalletVo.getFilter(), prePayWalletVo.getChannel()));
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 资金明细设置退款中金额
|
|
|
*
|
|
|
@@ -252,6 +256,19 @@ public class WalletService {
|
|
|
fundVo.setTransferMoney(df.format(bigDecimal));
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 相关操作
|
|
|
+ *
|
|
|
+ * @param fundVo
|
|
|
+ */
|
|
|
+ private void action(FundVo fundVo) {
|
|
|
+ KwpWallet kwpWallet = kwpWalletService.queryOne(fundVo.getUid(), fundVo.getFilter(), fundVo.getChannel());
|
|
|
+ if (Objects.nonNull(kwpWallet)) {
|
|
|
+ fundVo.setAction(kwpWallet.getAction());
|
|
|
+ fundVo.setUpdateTime(kwpWallet.getActionTime());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 按钱包渠道进行统计钱包清单数量
|
|
|
*
|
|
|
@@ -479,6 +496,7 @@ public class WalletService {
|
|
|
fundVo.setTotalMoney(dfMoney(re.getTotalMoney()));
|
|
|
refundMoney2(fundVo);
|
|
|
transferMoney(fundVo);
|
|
|
+ action(fundVo);
|
|
|
vo.add(fundVo);
|
|
|
}
|
|
|
DecimalFormat df = new DecimalFormat("0.00");
|
|
|
@@ -560,6 +578,7 @@ public class WalletService {
|
|
|
fundVo.setTotalMoney(dfMoney(re.getTotalMoney()));
|
|
|
refundMoney2(fundVo);
|
|
|
transferMoney(fundVo);
|
|
|
+ action(fundVo);
|
|
|
vo.add(fundVo);
|
|
|
}
|
|
|
DecimalFormat df = new DecimalFormat("0.00");
|
|
|
@@ -599,6 +618,16 @@ public class WalletService {
|
|
|
if (!payIndexR.getStatus()) {
|
|
|
throw new BusinessException(StringUtils.isBlank(payIndexR.getMsg()) ? "充值失败" : payIndexR.getMsg());
|
|
|
}
|
|
|
+ KwpWallet kwpWallet = new KwpWallet();
|
|
|
+ kwpWallet.setUid(uid);
|
|
|
+ kwpWallet.setFilter(filter);
|
|
|
+ kwpWallet.setChannel(channelEnum.getChannel());
|
|
|
+ kwpWallet.setAction(WalletActionEnum.CHARGING.getDesc());
|
|
|
+ kwpWallet.setActionTime(LocalDateTime.now());
|
|
|
+ kwpWallet.setRemark("");
|
|
|
+ kwpWallet.setOrderNo(Objects.nonNull(payIndexR.getData()) ? payIndexR.getData().getOrderNo() : "");
|
|
|
+ kwpWallet.setStatus(WalletActionEnum.CHARGING.getStatus());
|
|
|
+ kwpWalletService.saveOrUpdate(kwpWallet);
|
|
|
return payIndexR.getData();
|
|
|
}
|
|
|
|
|
|
@@ -625,6 +654,16 @@ public class WalletService {
|
|
|
if (!payIndexR.getStatus()) {
|
|
|
throw new BusinessException(StringUtils.isBlank(payIndexR.getMsg()) ? "充值失败" : payIndexR.getMsg());
|
|
|
}
|
|
|
+ KwpWallet kwpWallet = new KwpWallet();
|
|
|
+ kwpWallet.setUid(uid);
|
|
|
+ kwpWallet.setFilter(filter);
|
|
|
+ kwpWallet.setChannel(channelEnum.getChannel());
|
|
|
+ kwpWallet.setAction(WalletActionEnum.CHARGING.getDesc());
|
|
|
+ kwpWallet.setActionTime(LocalDateTime.now());
|
|
|
+ kwpWallet.setRemark("");
|
|
|
+ kwpWallet.setOrderNo(Objects.nonNull(payIndexR.getData()) ? payIndexR.getData().getOrderNo() : "");
|
|
|
+ kwpWallet.setStatus(WalletActionEnum.CHARGING.getStatus());
|
|
|
+ kwpWalletService.saveOrUpdate(kwpWallet);
|
|
|
return payIndexR.getData();
|
|
|
}
|
|
|
|
|
|
@@ -646,6 +685,16 @@ public class WalletService {
|
|
|
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.setChannel(byChannel.getChannel());
|
|
|
+ kwpWallet.setAction(WalletActionEnum.CASHING.getDesc());
|
|
|
+ kwpWallet.setActionTime(LocalDateTime.now());
|
|
|
+ kwpWallet.setRemark("");
|
|
|
+ kwpWallet.setOrderNo(Objects.nonNull(payIndexR.getData()) ? payIndexR.getData().getOrderNo() : "");
|
|
|
+ kwpWallet.setStatus(WalletActionEnum.CASHING.getStatus());
|
|
|
+ kwpWalletService.saveOrUpdate(kwpWallet);
|
|
|
return payIndexR.getData();
|
|
|
}
|
|
|
|
|
|
@@ -721,6 +770,17 @@ public class WalletService {
|
|
|
//转帐中
|
|
|
walletTransfer.setStatus(TransferEnum.TRANSFERRING.getStatus());
|
|
|
kwpWalletTransferMapper.insert(walletTransfer);
|
|
|
+
|
|
|
+ KwpWallet kwpWallet = new KwpWallet();
|
|
|
+ kwpWallet.setUid(transferReq.getUid());
|
|
|
+ kwpWallet.setFilter(transferReq.getFilter());
|
|
|
+ kwpWallet.setChannel(channelEnum.getChannel());
|
|
|
+ kwpWallet.setAction(WalletActionEnum.TRANSFERRING.getDesc());
|
|
|
+ kwpWallet.setActionTime(LocalDateTime.now());
|
|
|
+ kwpWallet.setRemark("");
|
|
|
+ kwpWallet.setOrderNo(Objects.nonNull(businessNoR1.getData()) ? businessNoR1.getData().getBusinessNo() : "");
|
|
|
+ kwpWallet.setStatus(WalletActionEnum.TRANSFERRING.getStatus());
|
|
|
+ kwpWalletService.saveOrUpdate(kwpWallet);
|
|
|
return businessNoR1.getData();
|
|
|
} finally {
|
|
|
redisLockUtil.unlock(key);
|
|
|
@@ -815,6 +875,7 @@ public class WalletService {
|
|
|
LocalDateTime parse2 = LocalDateTime.parse(c2.getCreateTime(), df);
|
|
|
return parse.compareTo(parse2);
|
|
|
});
|
|
|
+ res.forEach(a -> a.setUidName(getFirmName(a.getUid())));
|
|
|
//组装数据
|
|
|
return new MorePageRes<>(cashPageReq.getPage(), cashPageReq.getPageSize(), res, String.valueOf(sum / 100.0D));
|
|
|
}
|
|
|
@@ -882,6 +943,50 @@ public class WalletService {
|
|
|
return new ArrayList<>();
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 提现分类页签统计
|
|
|
+ *
|
|
|
+ * @param cashPageReq
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public Object cashCount2(CashPageReq cashPageReq) {
|
|
|
+ log.info("运营端提现分类页签统计:{}", JSONObject.toJSONString(cashPageReq));
|
|
|
+ List<String> all = walletRelationService.getAll();
|
|
|
+ if (CollectionUtils.isEmpty(all)) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ ChannelEnum channelEnum = null;
|
|
|
+ if (StringUtils.isNotBlank(cashPageReq.getChannel())) {
|
|
|
+ channelEnum = ChannelEnum.getByValue(cashPageReq.getChannel());
|
|
|
+ if (Objects.isNull(channelEnum)) {
|
|
|
+ throw new BusinessException("支付通道不存在");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ List<CashCount> res = new ArrayList<>();
|
|
|
+ List<CashCount> total = new ArrayList<>();
|
|
|
+ for (String uid : all) {
|
|
|
+ R<List<CashCount>> listR = payCenterService.withdrawCategory(uid, channelEnum);
|
|
|
+ if (listR.getStatus()) {
|
|
|
+ List<CashCount> data = listR.getData();
|
|
|
+ if (!CollectionUtils.isEmpty(data)) {
|
|
|
+ total.addAll(data);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ Map<String, List<CashCount>> collect = total.stream().collect(Collectors.groupingBy(CashCount::getValue, Collectors.toList()));
|
|
|
+ for (Map.Entry<String, List<CashCount>> map : collect.entrySet()) {
|
|
|
+ Map<String, Long> map1 = collect.get(map.getKey()).stream().collect(Collectors.groupingBy(CashCount::getName, Collectors.summingLong(CashCount::getTotal)));
|
|
|
+ for (Map.Entry<String, Long> one : map1.entrySet()) {
|
|
|
+ CashCount cashCount = new CashCount();
|
|
|
+ cashCount.setName(one.getKey());
|
|
|
+ cashCount.setValue(map.getKey());
|
|
|
+ cashCount.setTotal(one.getValue());
|
|
|
+ res.add(cashCount);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 预付记录
|
|
|
*
|
|
|
@@ -928,6 +1033,7 @@ public class WalletService {
|
|
|
prePayWalletVo.setSettlingApMoney(dfMoney(row.getSettlingApMoney()));
|
|
|
prePayWalletVo.setTotalApMoney(dfMoney(row.getTotalApMoney()));
|
|
|
refundMoney(row, prePayWalletVo, false);
|
|
|
+ time(prePayWalletVo);
|
|
|
list.add(prePayWalletVo);
|
|
|
}
|
|
|
}
|
|
|
@@ -975,6 +1081,7 @@ public class WalletService {
|
|
|
usingApSum += map.get("usingApSum");
|
|
|
totalApSum += map.get("totalApSum");
|
|
|
}
|
|
|
+ list.forEach(this::time);
|
|
|
ApPageRes<PrePayWalletVo> page = new ApPageRes<>(prePayPage.getPage(), prePayPage.getPageSize(), list);
|
|
|
page.setApMoney(dfMoney(apSum));
|
|
|
page.setUsingApMoney(dfMoney(usingApSum));
|
|
|
@@ -1248,6 +1355,7 @@ public class WalletService {
|
|
|
if (Objects.nonNull(orderR.getData())) {
|
|
|
kwpWalletPrepayService.savePrepay(orderR.getData().getOrderNo(), PrePayEnum.ADD);
|
|
|
}
|
|
|
+ kwpWalletService.saveTime(uid, filter, channelEnum.getChannel());
|
|
|
return orderR.getData();
|
|
|
}
|
|
|
|
|
|
@@ -1273,6 +1381,7 @@ public class WalletService {
|
|
|
if (Objects.nonNull(orderR.getData())) {
|
|
|
kwpWalletPrepayService.savePrepay(orderR.getData().getOrderNo(), PrePayEnum.APPEND);
|
|
|
}
|
|
|
+ kwpWalletService.saveTime(uid, prePay.getFilter(), channelEnum.getChannel());
|
|
|
return orderR.getData();
|
|
|
}
|
|
|
|
|
|
@@ -1374,6 +1483,8 @@ public class WalletService {
|
|
|
Long userId = LoginUserHolder.getUserId();
|
|
|
//异步提交清分退款任务
|
|
|
AsyncPool.addTask(new Refund(refundReq, kwpWalletRefund, payCenterService, kwpWalletRefundMapper, userId));
|
|
|
+ //记录操作时间
|
|
|
+ kwpWalletService.saveTime(kwpWalletRefund.getUid(), kwpWalletRefund.getFilter(), channelEnum.getChannel());
|
|
|
return businessNoR;
|
|
|
} finally {
|
|
|
redisLockUtil.unlock(key);
|
|
|
@@ -1864,7 +1975,7 @@ public class WalletService {
|
|
|
if (Objects.isNull(byChannel)) {
|
|
|
throw new BusinessException("支付通道异常");
|
|
|
}
|
|
|
- R<Page<PrePayIndex2>> pageR = payCenterService.advancePayIndex2(moneyPage.getUid(), byChannel, moneyPage.getFilter(), moneyPage.getPage(), moneyPage.getPageSize());
|
|
|
+ R<Page<PrePayIndex2>> pageR = payCenterService.advancePayIndex2(moneyPage.getUid(), byChannel, moneyPage.getFilter(), moneyPage.getPage(), moneyPage.getPageSize(), moneyPage.getKeywords());
|
|
|
if (!pageR.getStatus()) {
|
|
|
return new PageRes<>(moneyPage.getPage(), moneyPage.getPageSize(), 0, 0, new ArrayList<>());
|
|
|
}
|
|
|
@@ -1908,7 +2019,7 @@ public class WalletService {
|
|
|
if (Objects.isNull(byChannel)) {
|
|
|
throw new BusinessException("支付通道异常");
|
|
|
}
|
|
|
- R<Page<PrePayIndex2>> pageR = payCenterService.advancePayIndex2(moneyPage.getFilter(), byChannel, moneyPage.getUid(), moneyPage.getPage(), moneyPage.getPageSize());
|
|
|
+ R<Page<PrePayIndex2>> pageR = payCenterService.advancePayIndex2(moneyPage.getFilter(), byChannel, moneyPage.getUid(), moneyPage.getPage(), moneyPage.getPageSize(), moneyPage.getKeywords());
|
|
|
if (!pageR.getStatus()) {
|
|
|
return new PageRes<>(moneyPage.getPage(), moneyPage.getPageSize(), 0, 0, new ArrayList<>());
|
|
|
}
|