mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 02:55:04 +08:00
update 新增小程序关闭待支付订单接口
This commit is contained in:
@@ -14,6 +14,7 @@ import com.jsowell.common.util.StringUtils;
|
||||
import com.jsowell.pile.dto.*;
|
||||
import com.jsowell.pile.service.CarCouponRecordService;
|
||||
import com.jsowell.pile.service.ChargeAlgorithmRecordService;
|
||||
import com.jsowell.pile.service.OrderBasicInfoService;
|
||||
import com.jsowell.pile.vo.base.StationInfoVO;
|
||||
import com.jsowell.pile.vo.uniapp.customer.ChargeAlgorithmRecordVO;
|
||||
import com.jsowell.pile.vo.uniapp.customer.OrderVO;
|
||||
@@ -50,6 +51,9 @@ public class OrderController extends BaseController {
|
||||
@Autowired
|
||||
private CarCouponRecordService carCouponRecordService;
|
||||
|
||||
@Autowired
|
||||
private OrderBasicInfoService orderBasicInfoService;
|
||||
|
||||
/**
|
||||
* 生成订单/创建订单
|
||||
* http://localhost:8080/uniapp/order/generateOrder
|
||||
@@ -436,4 +440,23 @@ public class OrderController extends BaseController {
|
||||
logger.info("查询停车优免订单 memberId:{}, result:{}", memberId, response);
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭待支付的订单
|
||||
* @param orderCode
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/closeUnPayOder/{orderCode}")
|
||||
public RestApiResponse<?> closeUnPayOder(@PathVariable("orderCode") String orderCode) {
|
||||
RestApiResponse<?> response = null;
|
||||
try {
|
||||
orderBasicInfoService.closeUnPayOder(orderCode);
|
||||
response = new RestApiResponse<>();
|
||||
} catch (Exception e) {
|
||||
logger.error("关闭订单号:{} 的订单失败, error:", orderCode, e);
|
||||
response = new RestApiResponse<>(e);
|
||||
}
|
||||
logger.info("关闭订单:{}", orderCode);
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -539,10 +539,10 @@ public class PaymentTestController {
|
||||
*/
|
||||
@Test
|
||||
public void createPaymentReverseRequestTest() {
|
||||
String paymentId = "002212025091910192610814936868000780288";
|
||||
BigDecimal refundAmount = new BigDecimal("0.02");
|
||||
String paymentId = "002212025092509265410817097978174926848";
|
||||
BigDecimal refundAmount = new BigDecimal("0.5");
|
||||
String memberId = "65622699";
|
||||
String orderCode = "C48996543963";
|
||||
String orderCode = "C23464104497";
|
||||
|
||||
// 延迟分账未确认调撤销调撤销接口退款
|
||||
PaymentReverseOperation operation = new PaymentReverseOperation();
|
||||
|
||||
@@ -14,7 +14,7 @@ public enum OrderStatusEnum {
|
||||
ABNORMAL("4", "异常"),
|
||||
SUSPICIOUS("5", "可疑"),
|
||||
ORDER_COMPLETE("6", "订单完成"),
|
||||
ORDER_CLOSE_TIMEOUT("7", "超时关闭"),
|
||||
ORDER_CLOSE_TIMEOUT("7", "订单关闭"),
|
||||
;
|
||||
|
||||
private String value;
|
||||
|
||||
@@ -598,4 +598,10 @@ public interface OrderBasicInfoService{
|
||||
* @param connectorMark 主辅枪标记
|
||||
*/
|
||||
void chargingPileStartedSuccessfully(String transactionCode, String pileConnectorCode, String connectorMark);
|
||||
|
||||
/**
|
||||
* 关闭某笔待支付订单
|
||||
* @param orderCode
|
||||
*/
|
||||
void closeUnPayOder(String orderCode);
|
||||
}
|
||||
|
||||
@@ -5543,5 +5543,23 @@ public class OrderBasicInfoServiceImpl implements OrderBasicInfoService {
|
||||
public List<SupStationStatsVO> queryOrderListByStationIdAndTime(String stationId , String startTime , String endTime) {
|
||||
return orderBasicInfoMapper.queryOrderListByStationIdAndTime(stationId, startTime, endTime);
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭某笔待支付订单
|
||||
* @param orderCode
|
||||
*/
|
||||
@Override
|
||||
public void closeUnPayOder(String orderCode) {
|
||||
// 查询订单信息
|
||||
OrderBasicInfo orderBasicInfo = getOrderInfoByOrderCode(orderCode);
|
||||
String payStatus = orderBasicInfo.getPayStatus();
|
||||
if (!StringUtils.equals(OrderPayStatusEnum.unpaid.getValue(), payStatus)) {
|
||||
// 不是待支付状态
|
||||
throw new BusinessException(ReturnCodeEnum.CODE_ORDER_INFO_ERROR);
|
||||
}
|
||||
// 订单状态改为 7-订单关闭
|
||||
orderBasicInfo.setOrderStatus(OrderStatusEnum.ORDER_CLOSE_TIMEOUT.getValue());
|
||||
updateOrderBasicInfo(orderBasicInfo);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user