已经存在退款记录, 不能再次结算

This commit is contained in:
2024-02-21 15:58:33 +08:00
parent 932fc6fc11
commit b8d9226c42
4 changed files with 20 additions and 72 deletions

View File

@@ -461,6 +461,16 @@ public class OrderService {
return vo;
}
/**
* 通过orderCode获取退款明细列表
* @param orderCode
* @return
*/
private List<OrderDetailInfoVO.OrderRefundInfo> getOrderRefundInfoList(String orderCode) {
return null;
}
/**
* 获取退款明细列表
* @param orderBasicInfo
@@ -482,21 +492,6 @@ public class OrderService {
}
}
} else if (OrderPayModeEnum.PAYMENT_OF_WECHATPAY.getValue().equals(orderBasicInfo.getPayMode())) {
// List<PaymentReverseResponse> paymentReverseResponses = orderBasicInfoService.queryOrderAdapayRefund(orderBasicInfo);
// if (CollectionUtils.isNotEmpty(paymentReverseResponses)) {
// for (PaymentReverseResponse reverseResponse : paymentReverseResponses) {
// refundInfo = new OrderDetailInfoVO.OrderRefundInfo();
// refundInfo.setReverseId(reverseResponse.getId());
// refundInfo.setPaymentId(reverseResponse.getPayment_id());
// refundInfo.setReverseAmt(reverseResponse.getReverse_amt());
// LocalDateTime createdTime = DateUtils.timestampToDatetime(Long.parseLong(reverseResponse.getCreated_time()));
// refundInfo.setCreatedTime(DateUtils.formatDateTime(createdTime));
// LocalDateTime succeedTime = DateUtils.timestampToDatetime(Long.parseLong(reverseResponse.getSucceed_time()));
// refundInfo.setSucceedTime(DateUtils.formatDateTime(succeedTime));
// orderRefundInfoList.add(refundInfo);
// }
// }
// 新逻辑
String mode = pileMerchantInfoService.getDelayModeByMerchantId(orderBasicInfo.getMerchantId());
AbstractProgramLogic orderLogic = ProgramLogicFactory.getProgramLogic(mode);
@@ -695,6 +690,13 @@ public class OrderService {
List<String> merchantDeptIds = authorizedMap.getMerchantDeptIds();
}
// 查询订单退款记录,如存在退款说明已经结算过,不能再次结算
List<OrderDetailInfoVO.OrderRefundInfo> orderRefundInfoList = getOrderRefundInfoList(orderBasicInfo);
if (CollectionUtils.isNotEmpty(orderRefundInfoList)) {
log.info("订单:{}, 已经存在退款记录:{}, 不能再次结算", orderBasicInfo.getOrderCode(), JSON.toJSONString(orderRefundInfoList));
return false;
}
String chargingAmount = dto.getChargingAmount();
String chargingDegree = dto.getChargingDegree();
if (StringUtils.equals(chargingAmount, Constants.ZERO) || StringUtils.equals(chargingDegree, Constants.ZERO)) {

View File

@@ -158,7 +158,7 @@ public class OrderBasicInfoController extends BaseController {
/**
* 人工结算订单
* 人工结算订单/手动结算逻辑/手动结算按钮
* http://localhost:8080/order/manualSettlementOrder
*/
@PostMapping("/manualSettlementOrder")

View File

@@ -2,21 +2,13 @@ package com.jsowell.netty.handler;
import com.jsowell.common.core.domain.ykc.YKCDataProtocol;
import com.jsowell.common.core.domain.ykc.YKCFrameTypeCode;
import com.jsowell.common.enums.thirdparty.ThirdPlatformTypeEnum;
import com.jsowell.common.enums.ykc.OrderStatusEnum;
import com.jsowell.common.util.BytesUtil;
import com.jsowell.common.util.StringUtils;
import com.jsowell.common.util.YKCUtils;
import com.jsowell.netty.factory.YKCOperateFactory;
import com.jsowell.pile.domain.OrderBasicInfo;
import com.jsowell.pile.domain.ThirdPartyStationRelation;
import com.jsowell.pile.service.ThirdPartySettingInfoService;
import com.jsowell.pile.service.ThirdPartyStationRelationService;
import com.jsowell.pile.service.OrderBasicInfoService;
import com.jsowell.pile.vo.base.ThirdPartyStationRelationVO;
import com.jsowell.thirdparty.lianlian.service.LianLianService;
import com.jsowell.thirdparty.xindiantu.service.XDTService;
import com.jsowell.thirdparty.yongchengboche.service.YCBCService;
import io.netty.channel.Channel;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
@@ -40,21 +32,6 @@ public class ChargeEndHandler extends AbstractHandler{
@Autowired
private OrderBasicInfoService orderBasicInfoService;
@Autowired
private ThirdPartySettingInfoService thirdPartySettingInfoService;
@Autowired
private LianLianService lianLianService;
@Autowired
private YCBCService ycbcService;
@Autowired
private XDTService xdtService;
@Autowired
private ThirdPartyStationRelationService thirdPartyStationRelationService;
@Override
public void afterPropertiesSet() throws Exception {
YKCOperateFactory.register(type, this);
@@ -126,7 +103,6 @@ public class ChargeEndHandler extends AbstractHandler{
byte[] pileChargedCodeByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
// 查询订单,改为待结算 将结束soc传入
// OrderBasicInfo orderInfo = orderBasicInfoService.getOrderInfoByOrderCode(transactionCode);
OrderBasicInfo orderInfo = orderBasicInfoService.getOrderInfoByTransactionCode(transactionCode);
if (Objects.nonNull(orderInfo)) {
if (StringUtils.equals(OrderStatusEnum.IN_THE_CHARGING.getValue(), orderInfo.getOrderStatus())) {
@@ -137,38 +113,6 @@ public class ChargeEndHandler extends AbstractHandler{
orderInfo.setChargeEndTime(new Date()); // 结束充电时间
}
orderBasicInfoService.updateOrderBasicInfo(orderInfo);
// 以下推送停止充电信息逻辑已全部放到 0x3B 帧中 --2024年1月11日
// try {
// // 查询该站点是否已对接互联互通平台,如果对接则发送充电结束
// // 通过站点id查询相关配置信息
// ThirdPartyStationRelation relation = new ThirdPartyStationRelation();
// relation.setStationId(Long.parseLong(orderInfo.getStationId()));
// ThirdPartyStationRelationVO relationInfo = thirdPartyStationRelationService.selectRelationInfo(relation);
// // ThirdPartySettingInfo info = thirdPartySettingInfoService.getInfoByStationId(Long.parseLong(orderInfo.getStationId()));
// if (Objects.isNull(relationInfo)) {
// return null;
// }
// // 联联平台
// if (StringUtils.equals(ThirdPlatformTypeEnum.LIAN_LIAN_PLATFORM.getCode(), relationInfo.getThirdPartyType())) {
// // 推送停止充电结果
// lianLianService.pushStopChargeResult(orderInfo.getOrderCode());
// }
// // 新电途平台
// if (StringUtils.equals(ThirdPlatformTypeEnum.XIN_DIAN_TU.getCode(), relationInfo.getThirdPartyType())) {
// // 推送停止充电结果
// xdtService.notificationStopChargeResult(orderInfo.getOrderCode());
// }
// // 甬城泊车平台
// if (StringUtils.equals(ThirdPlatformTypeEnum.YONG_CHENG_BO_CHE.getCode(), relationInfo.getThirdPartyType())) {
// ycbcService.pushStopChargeResult(orderInfo.getOrderCode());
// }
//
// } catch (Exception e) {
// log.error("联联平台推送停止充电结果异常", e);
// }
}
return null;

View File

@@ -90,6 +90,8 @@ public class PileRemoteService {
* 远程停止充电
*/
public void remoteStopCharging(String pileSn, String connectorCode) {
// TODO 获取充电桩0x13数据校验交易流水号是否一致
StopChargingCommand command = StopChargingCommand.builder()
.pileSn(pileSn)
.connectorCode(connectorCode)