Merge branch 'dev' into feature-business-minigram

This commit is contained in:
Lemon
2026-01-19 13:28:10 +08:00
73 changed files with 10776 additions and 14 deletions

View File

@@ -0,0 +1,8 @@
package com.jsowell.pile.service;
import com.jsowell.pile.dto.MerchantOrderReportDTO;
import com.jsowell.pile.vo.web.MerchantOrderReportVO;
public interface BusinessFinancialService {
MerchantOrderReportVO getMyWallet(MerchantOrderReportDTO dto);
}

View File

@@ -0,0 +1,69 @@
package com.jsowell.pile.service.impl;
import com.huifu.adapay.core.exception.BaseAdaPayException;
import com.jsowell.adapay.service.AdapayService;
import com.jsowell.adapay.vo.AdapayAccountBalanceVO;
import com.jsowell.pile.dto.MerchantOrderReportDTO;
import com.jsowell.pile.service.BusinessFinancialService;
import com.jsowell.pile.service.ClearingWithdrawInfoService;
import com.jsowell.pile.service.SettleOrderReportService;
import com.jsowell.pile.vo.web.MerchantOrderReportVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
/**
* 运营端小程序财务相关Service
*/
@Slf4j
@Service
public class BusinessFinancialServiceImpl implements BusinessFinancialService {
@Autowired
private SettleOrderReportService settleOrderReportService;
@Autowired
private AdapayService adapayService;
@Autowired
private ClearingWithdrawInfoService clearingWithdrawInfoService;
/**
* 我的钱包查询
* @param dto
* @return
*/
@Override
public MerchantOrderReportVO getMyWallet(MerchantOrderReportDTO dto) {
// 查询运营商订单报表
MerchantOrderReportVO result = settleOrderReportService.getMerchantOrderReportV2(dto);
// 查询账户余额
BigDecimal acctBalance = BigDecimal.ZERO;
try {
AdapayAccountBalanceVO accountBalanceVO = adapayService.queryAdapayAccountBalance(dto.getMerchantId());
if (accountBalanceVO != null && accountBalanceVO.getAcctBalance() != null) {
acctBalance = accountBalanceVO.getAcctBalance();
}
} catch (BaseAdaPayException e) {
log.error("查询汇付账户余额异常 merchantId:{}", dto.getMerchantId(), e);
}
result.getMerchantOrderReport().setAcctBalance(acctBalance);
// 查询累计提现金额
BigDecimal totalWithdraw = BigDecimal.ZERO;
try {
BigDecimal withdraw = clearingWithdrawInfoService.queryTotalWithdraw(dto.getMerchantId());
if (withdraw != null) {
totalWithdraw = withdraw;
}
} catch (Exception e) {
log.error("查询累计提现金额异常 merchantId:{}", dto.getMerchantId(), e);
}
result.getMerchantOrderReport().setTotalWithdraw(totalWithdraw);
return result;
}
}

View File

@@ -816,6 +816,10 @@ public class OrderBasicInfoServiceImpl implements OrderBasicInfoService {
}
}
OrderBasicInfo orderInfoByOrderCode = orderBasicInfoMapper.getOrderInfoByOrderCode(orderBasicInfo.getOrderCode());
orderBasicInfo.setPayMode(orderInfoByOrderCode.getPayMode());
// 判断订单的支付方式
String payMode = orderBasicInfo.getPayMode();
if (StringUtils.equals(payMode, OrderPayModeEnum.PAYMENT_OF_PRINCIPAL_BALANCE.getValue())) {

View File

@@ -30,14 +30,32 @@ public class PileModelInfoServiceImpl implements PileModelInfoService {
private RedisCache redisCache;
/**
* 查询充电桩型号信息
* 查询充电桩型号信息(带缓存)
*
* @param id 充电桩型号信息主键
* @return 充电桩型号信息
*/
@Override
public PileModelInfo selectPileModelInfoById(Long id) {
return pileModelInfoMapper.selectPileModelInfoById(id);
if (id == null) {
return null;
}
// 1. 尝试从缓存获取
String redisKey = CacheConstants.PILE_MODEL_INFO_BY_ID + id;
PileModelInfo modelInfo = redisCache.getCacheObject(redisKey);
// 2. 缓存未命中,从数据库查询
if (modelInfo == null) {
modelInfo = pileModelInfoMapper.selectPileModelInfoById(id);
// 3. 查询结果存入缓存1天有效期
if (modelInfo != null) {
redisCache.setCacheObject(redisKey, modelInfo, CacheConstants.cache_expire_time_1d);
}
}
return modelInfo;
}
/**
@@ -135,10 +153,18 @@ public class PileModelInfoServiceImpl implements PileModelInfoService {
return modelInfoVO;
}
/**
* 清除缓存
*
* @param modelIds 型号ID数组
*/
private void cleanCache(Long[] modelIds) {
List<String> redisKeyList = Lists.newArrayList();
for (Long modelId : modelIds) {
// 清除 getPileModelInfoByModelId 的缓存
redisKeyList.add(CacheConstants.GET_PILE_MODEL_INFO_BY_MODEL_ID + modelId);
// 清除 selectPileModelInfoById 的缓存
redisKeyList.add(CacheConstants.PILE_MODEL_INFO_BY_ID + modelId);
}
redisCache.deleteObject(redisKeyList);
}