mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 11:05:18 +08:00
update 支付回调新增占桩逻辑处理、 后管运营商订单报表新增字段
This commit is contained in:
@@ -113,7 +113,7 @@ public class AdapayService {
|
||||
createAdaPaymentParam.setGoods_title(dto.getGoodsTitle());
|
||||
createAdaPaymentParam.setGoods_desc(dto.getGoodsDesc()); // 这个字段是微信支付凭证的商品名
|
||||
Map<String, String> map = Maps.newHashMap();
|
||||
map.put("type", ScenarioEnum.ORDER.getValue());
|
||||
map.put("type", dto.getType());
|
||||
map.put("orderCode", dto.getOrderCode());
|
||||
map.put("payMode", payMode);
|
||||
map.put("memberId", dto.getMemberId());
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.jsowell.pile.dto;
|
||||
|
||||
import com.jsowell.common.enums.ykc.ScenarioEnum;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
@@ -30,6 +31,12 @@ public class PayOrderDTO {
|
||||
*/
|
||||
private BigDecimal payAmount;
|
||||
|
||||
/**
|
||||
* @see ScenarioEnum
|
||||
* 支付场景
|
||||
*/
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 微信支付需要用的code
|
||||
*/
|
||||
|
||||
@@ -11,6 +11,11 @@ public class SettleOrderReportDTO {
|
||||
*/
|
||||
private String stationId;
|
||||
|
||||
/**
|
||||
* 运营商id
|
||||
*/
|
||||
private String merchantId;
|
||||
|
||||
/**
|
||||
* 交易日期
|
||||
*/
|
||||
|
||||
@@ -2753,6 +2753,7 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
|
||||
// 2023-07-11 全部改为汇付支付
|
||||
dto.setGoodsTitle("充电费用");
|
||||
dto.setGoodsDesc("充电桩预付款金额");
|
||||
dto.setType(ScenarioEnum.ORDER.getValue());
|
||||
Map<String, Object> weixinMap = adapayService.createPayment(dto);
|
||||
|
||||
// 返回微信支付参数
|
||||
|
||||
@@ -11,6 +11,7 @@ import com.jsowell.common.enums.uniapp.OccupyOrderPayStatusEnum;
|
||||
import com.jsowell.common.enums.uniapp.OccupyOrderStatusEnum;
|
||||
import com.jsowell.common.enums.ykc.OrderPayModeEnum;
|
||||
import com.jsowell.common.enums.ykc.ReturnCodeEnum;
|
||||
import com.jsowell.common.enums.ykc.ScenarioEnum;
|
||||
import com.jsowell.common.exception.BusinessException;
|
||||
import com.jsowell.common.util.DateUtils;
|
||||
import com.jsowell.common.util.PageUtils;
|
||||
@@ -443,6 +444,7 @@ public class OrderPileOccupyServiceImpl implements OrderPileOccupyService {
|
||||
// 返回支付参数
|
||||
dto.setGoodsTitle("占桩费用");
|
||||
dto.setGoodsDesc("占桩订单金额");
|
||||
dto.setType(ScenarioEnum.OCCUPY.getValue());
|
||||
Map<String, Object> weixinMap = adapayService.createPayment(dto);
|
||||
resultMap.put("weixinMap", weixinMap);
|
||||
} else if (StringUtils.equals(dto.getPayMode(), OrderPayModeEnum.PAYMENT_OF_WHITELIST.getValue())) { // 白名单支付
|
||||
|
||||
@@ -13,26 +13,23 @@ import com.jsowell.common.util.DateUtils;
|
||||
import com.jsowell.common.util.PageUtils;
|
||||
import com.jsowell.common.util.StringUtils;
|
||||
import com.jsowell.pile.domain.ClearingBillInfo;
|
||||
import com.jsowell.pile.domain.PileBasicInfo;
|
||||
import com.jsowell.pile.domain.PileStationInfo;
|
||||
import com.jsowell.pile.domain.SettleOrderReport;
|
||||
import com.jsowell.pile.dto.GetClearingBillDTO;
|
||||
import com.jsowell.pile.dto.MerchantOrderReportDTO;
|
||||
import com.jsowell.pile.dto.SettleOrderReportDTO;
|
||||
import com.jsowell.pile.mapper.AdapayCallbackRecordMapper;
|
||||
import com.jsowell.pile.mapper.SettleOrderReportMapper;
|
||||
import com.jsowell.pile.service.ClearingBillInfoService;
|
||||
import com.jsowell.pile.service.ClearingWithdrawInfoService;
|
||||
import com.jsowell.pile.service.IPileMerchantInfoService;
|
||||
import com.jsowell.pile.service.ISettleOrderReportService;
|
||||
import com.jsowell.pile.service.*;
|
||||
import com.jsowell.pile.vo.web.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 结算订单报Service业务层处理
|
||||
@@ -60,6 +57,9 @@ public class SettleOrderReportServiceImpl implements ISettleOrderReportService {
|
||||
@Autowired
|
||||
private ClearingBillInfoService clearingBillInfoService;
|
||||
|
||||
@Autowired
|
||||
private IPileStationInfoService pileStationInfoService;
|
||||
|
||||
/**
|
||||
* 查询结算订单报
|
||||
*
|
||||
@@ -124,30 +124,23 @@ public class SettleOrderReportServiceImpl implements ISettleOrderReportService {
|
||||
*/
|
||||
@Override
|
||||
public PageResponse selectSettleOrderReportDetail(SettleOrderReportDTO dto) {
|
||||
SettleOrderReport orderReport = selectByStationIdAndDate(dto.getStationId(), dto.getTradeDate());
|
||||
if (orderReport == null) {
|
||||
return new PageResponse();
|
||||
}
|
||||
String orderCodes = orderReport.getOrderCodes();
|
||||
if (StringUtils.isBlank(orderCodes)) {
|
||||
return new PageResponse();
|
||||
}
|
||||
List<String> orderCodes = getOrderCodes(dto);
|
||||
|
||||
List<String> orderCodeList = Lists.newArrayList(StringUtils.split(orderCodes, ","));
|
||||
// 查询订单支付信息 分页
|
||||
int pageNum = dto.getPageNum() != null ? dto.getPageNum() : 1;
|
||||
int pageSize = dto.getPageSize() != null ? dto.getPageSize() : 10;
|
||||
PageHelper.startPage(pageNum, pageSize);
|
||||
List<ClearingBillVO> clearingBillVOList = clearingWithdrawInfoService.selectWithdrawInfoByOrderCodeList(orderCodeList);
|
||||
List<ClearingBillVO> clearingBillVOList = clearingWithdrawInfoService.selectWithdrawInfoByOrderCodeList(orderCodes);
|
||||
PageInfo<ClearingBillVO> pageInfo = new PageInfo<>(clearingBillVOList);
|
||||
|
||||
// 封装结果集
|
||||
List<OrderSettleDetailVO> resultList = Lists.newArrayList();
|
||||
OrderSettleDetailVO vo = null;
|
||||
String wechatAppId = pileMerchantInfoService.queryAppIdByMerchantId(orderReport.getMerchantId());
|
||||
String wechatAppId = pileMerchantInfoService.queryAppIdByMerchantId(dto.getMerchantId());
|
||||
for (ClearingBillVO clearingBillVO : pageInfo.getList()) {
|
||||
vo = new OrderSettleDetailVO();
|
||||
vo.setOrderCode(clearingBillVO.getOrderCode());
|
||||
vo.setSettleAmount(clearingBillVO.getSettleAmount());
|
||||
String paymentId = clearingBillVO.getPaymentId();
|
||||
QueryPaymentConfirmDTO build = QueryPaymentConfirmDTO.builder()
|
||||
.wechatAppId(wechatAppId)
|
||||
@@ -185,6 +178,51 @@ public class SettleOrderReportServiceImpl implements ISettleOrderReportService {
|
||||
return pageResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据 merchantId 或 stationId 以及交易日期获取订单号
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
private List<String> getOrderCodes(SettleOrderReportDTO dto) {
|
||||
List<String> orderCodeList = new ArrayList<>();
|
||||
if (StringUtils.isNotBlank(dto.getMerchantId())) {
|
||||
List<PileStationInfo> stationIdInfos = pileStationInfoService.selectStationListByMerchantId(Long.parseLong(dto.getMerchantId()));
|
||||
// 收集出站点id
|
||||
List<String> stationIds = stationIdInfos.stream()
|
||||
.map(PileStationInfo::getId)
|
||||
.collect(Collectors.toList())
|
||||
.stream()
|
||||
.map(String::valueOf)
|
||||
.collect(Collectors.toList());
|
||||
List<SettleOrderReport> list = queryOrderReport(stationIds, dto.getTradeDate(), dto.getTradeDate());
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
List<String> orderCodes = list.stream().map(SettleOrderReport::getOrderCodes)
|
||||
.filter(StringUtils::isNotBlank)
|
||||
.collect(Collectors.toList());
|
||||
if (CollectionUtils.isEmpty(orderCodes)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
for (String orderCode : orderCodes) {
|
||||
orderCodeList = Lists.newArrayList(StringUtils.split(orderCode, ","));
|
||||
}
|
||||
} else if (StringUtils.isNotBlank(dto.getStationId())){
|
||||
SettleOrderReport orderReport = selectByStationIdAndDate(dto.getStationId(), dto.getTradeDate());
|
||||
|
||||
if (orderReport == null) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
String orderCodes = orderReport.getOrderCodes();
|
||||
if (StringUtils.isBlank(orderCodes)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
orderCodeList = Lists.newArrayList(StringUtils.split(orderCodes, ","));
|
||||
dto.setMerchantId(orderReport.getMerchantId());
|
||||
}
|
||||
return orderCodeList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SettleOrderReport> selectByMerchantIdAndDate(String merchantId, String date) {
|
||||
return settleOrderReportMapper.selectByMerchantIdAndDate(merchantId, date);
|
||||
@@ -376,7 +414,7 @@ public class SettleOrderReportServiceImpl implements ISettleOrderReportService {
|
||||
PageUtils.startPage(pageNum, pageSize);
|
||||
resultList = clearingBillInfoService.getMerchantClearingBillList(dto);
|
||||
if (CollectionUtils.isEmpty(resultList)) {
|
||||
throw new BusinessException("", "获取运营商清分账单列表为空");
|
||||
return null;
|
||||
}
|
||||
PageInfo<MerchantClearingBillVO> pageInfo = new PageInfo<>(resultList);
|
||||
PageResponse response = PageResponse.builder()
|
||||
|
||||
@@ -3,6 +3,8 @@ package com.jsowell.pile.vo.web;
|
||||
import com.jsowell.adapay.response.QueryPaymentConfirmDetailResponse;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
public class ClearingBillVO {
|
||||
/**
|
||||
@@ -10,6 +12,11 @@ public class ClearingBillVO {
|
||||
*/
|
||||
private String orderCode;
|
||||
|
||||
/**
|
||||
* 结算金额
|
||||
*/
|
||||
private BigDecimal settleAmount;
|
||||
|
||||
/**
|
||||
* 支付id
|
||||
*/
|
||||
|
||||
@@ -2,6 +2,8 @@ package com.jsowell.pile.vo.web;
|
||||
|
||||
import lombok.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 订单结算详情
|
||||
*/
|
||||
@@ -19,7 +21,7 @@ public class OrderSettleDetailVO {
|
||||
/**
|
||||
* 结算金额
|
||||
*/
|
||||
private String settleAmount;
|
||||
private BigDecimal settleAmount;
|
||||
|
||||
/**
|
||||
* 清分状态
|
||||
@@ -34,7 +36,7 @@ public class OrderSettleDetailVO {
|
||||
|
||||
/**
|
||||
* 提现状态
|
||||
* 0-未提现;1-体现中;2-提现到账
|
||||
* 0-未提现;1-提现中;2-提现到账
|
||||
*/
|
||||
private String withdrawStatus;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user