Compare commits
No commits in common. "e43f3643f1e12537ed230b6837e6ac2c180e9d0b" and "bf95ef962f4835ee2e576fc6318c28a3280d40b8" have entirely different histories.
e43f3643f1
...
bf95ef962f
|
|
@ -63,11 +63,6 @@ public class HeaderFetchUtil {
|
||||||
return NumberUtil.isNumber(value) ? Integer.valueOf(value) : null;
|
return NumberUtil.isNumber(value) ? Integer.valueOf(value) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getSign(Map<String, String> headers) {
|
|
||||||
String value = getValueFromHeadersIgnoreCase(headers, "sign");
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String getValueFromHeadersIgnoreCase(Map<String, String> headers, String targetKey) {
|
public static String getValueFromHeadersIgnoreCase(Map<String, String> headers, String targetKey) {
|
||||||
if (CollUtil.isEmpty(headers)) {
|
if (CollUtil.isEmpty(headers)) {
|
||||||
return null;
|
return null;
|
||||||
|
|
|
||||||
|
|
@ -2,10 +2,8 @@ package com.bonus.canteen.core.order.common.business;
|
||||||
|
|
||||||
import com.bonus.canteen.core.order.common.constants.OrderRefundBizEnum;
|
import com.bonus.canteen.core.order.common.constants.OrderRefundBizEnum;
|
||||||
import com.bonus.canteen.core.order.common.dto.OrderRefundParam;
|
import com.bonus.canteen.core.order.common.dto.OrderRefundParam;
|
||||||
import com.bonus.canteen.core.order.common.dto.StageRefundParam;
|
|
||||||
import com.bonus.canteen.core.order.common.model.OrderInfo;
|
import com.bonus.canteen.core.order.common.model.OrderInfo;
|
||||||
import com.bonus.canteen.core.order.common.vo.OrderRefundResultVO;
|
import com.bonus.canteen.core.order.common.vo.OrderRefundResultVO;
|
||||||
import com.bonus.canteen.core.pay.api.vo.UnifyRefundVO;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
@ -23,5 +21,4 @@ public interface OrderRefundBusiness {
|
||||||
// void didEndOrderRefundFlow(Long orderRefundId, boolean isPass, String remark);
|
// void didEndOrderRefundFlow(Long orderRefundId, boolean isPass, String remark);
|
||||||
//
|
//
|
||||||
// void transferUncheckCorrectAfterOrderCreated(String macOrderId);
|
// void transferUncheckCorrectAfterOrderCreated(String macOrderId);
|
||||||
UnifyRefundVO stageRefund(StageRefundParam stageRefundParam);
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,9 +5,6 @@ import cn.hutool.core.map.MapUtil;
|
||||||
import cn.hutool.core.text.CharSequenceUtil;
|
import cn.hutool.core.text.CharSequenceUtil;
|
||||||
import cn.hutool.core.util.NumberUtil;
|
import cn.hutool.core.util.NumberUtil;
|
||||||
import com.alibaba.nacos.shaded.com.google.common.collect.Lists;
|
import com.alibaba.nacos.shaded.com.google.common.collect.Lists;
|
||||||
import com.bonus.canteen.core.order.common.dto.StageRefundParam;
|
|
||||||
import com.bonus.canteen.core.pay.common.model.TradeRecord;
|
|
||||||
import com.bonus.canteen.core.pay.common.service.TradeRecordService;
|
|
||||||
import com.bonus.common.core.exception.ServiceException;
|
import com.bonus.common.core.exception.ServiceException;
|
||||||
import com.bonus.common.security.utils.SecurityUtils;
|
import com.bonus.common.security.utils.SecurityUtils;
|
||||||
import com.bonus.common.houqin.constant.LeConstants;
|
import com.bonus.common.houqin.constant.LeConstants;
|
||||||
|
|
@ -136,9 +133,6 @@ public class OrderRefundBusinessImpl implements OrderRefundBusiness {
|
||||||
@Autowired
|
@Autowired
|
||||||
@Lazy
|
@Lazy
|
||||||
protected AllocHolidayApi allocHolidayApi;
|
protected AllocHolidayApi allocHolidayApi;
|
||||||
@Lazy
|
|
||||||
@Autowired
|
|
||||||
protected TradeRecordService tradeRecordService;
|
|
||||||
|
|
||||||
public void orderCancel(OrderInfo orderInfo) {
|
public void orderCancel(OrderInfo orderInfo) {
|
||||||
if (!this.orderCustomBusiness.refund().willCancelOrder(orderInfo)) {
|
if (!this.orderCustomBusiness.refund().willCancelOrder(orderInfo)) {
|
||||||
|
|
@ -203,21 +197,6 @@ public class OrderRefundBusinessImpl implements OrderRefundBusiness {
|
||||||
return var8;
|
return var8;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public UnifyRefundVO stageRefund(StageRefundParam stageRefundParam) {
|
|
||||||
LogUtil.printArgsIn("stagePayRefund", stageRefundParam);
|
|
||||||
TradeRecord tradeRecord = tradeRecordService.getTradeRecordById(stageRefundParam.getTradeId());
|
|
||||||
if (tradeRecord == null) {
|
|
||||||
log.error("[统一支付退款]交易记录不存在");
|
|
||||||
throw new ServiceException("交易记录不存在");
|
|
||||||
}
|
|
||||||
UnifyRefundDTO payRefundDTO = new UnifyRefundDTO();
|
|
||||||
payRefundDTO.setTradeId(stageRefundParam.getTradeId());
|
|
||||||
payRefundDTO.setRefundId(Id.next());
|
|
||||||
payRefundDTO.setRefundAmount(tradeRecord.getAmount());
|
|
||||||
return this.payApi.refund(payRefundDTO);
|
|
||||||
}
|
|
||||||
|
|
||||||
// public void orderCorrect(OrderPartRefundDTO orderPartRefundDTO, OrderRefundBizEnum biz) {
|
// public void orderCorrect(OrderPartRefundDTO orderPartRefundDTO, OrderRefundBizEnum biz) {
|
||||||
// if (CollUtil.isEmpty(orderPartRefundDTO.getDetailRefundList())) {
|
// if (CollUtil.isEmpty(orderPartRefundDTO.getDetailRefundList())) {
|
||||||
// throw new LeException(I18n.getMessage("order.buffet.correct-lack-detail", new Object[0]));
|
// throw new LeException(I18n.getMessage("order.buffet.correct-lack-detail", new Object[0]));
|
||||||
|
|
|
||||||
|
|
@ -1,5 +0,0 @@
|
||||||
package com.bonus.canteen.core.order.common.constants;
|
|
||||||
|
|
||||||
public class StageWhiteList {
|
|
||||||
public static final String STAGE_SIGN_WHITE_LIST = "f678443b-99b4-41ec-8e9a-b7a5c92367f1";
|
|
||||||
}
|
|
||||||
|
|
@ -1,17 +0,0 @@
|
||||||
package com.bonus.canteen.core.order.common.dto;
|
|
||||||
|
|
||||||
import com.bonus.canteen.core.common.utils.SysUtil;
|
|
||||||
import com.bonus.canteen.core.pay.api.dto.UnifyRefundDTO;
|
|
||||||
import com.bonus.common.houqin.constant.LeConstants;
|
|
||||||
import com.fasterxml.jackson.databind.JsonNode;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import javax.validation.constraints.Min;
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
public class StageRefundParam extends OrderRefundParam {
|
|
||||||
private Long tradeId;
|
|
||||||
}
|
|
||||||
|
|
@ -4,9 +4,7 @@ package com.bonus.canteen.core.order.mobile.business;
|
||||||
import com.bonus.canteen.core.order.common.dto.RequestHeaderDTO;
|
import com.bonus.canteen.core.order.common.dto.RequestHeaderDTO;
|
||||||
import com.bonus.canteen.core.order.mobile.dto.OrderPayMobileDTO;
|
import com.bonus.canteen.core.order.mobile.dto.OrderPayMobileDTO;
|
||||||
import com.bonus.canteen.core.order.mobile.dto.OrderReserveMealTotalDTO;
|
import com.bonus.canteen.core.order.mobile.dto.OrderReserveMealTotalDTO;
|
||||||
import com.bonus.canteen.core.order.mobile.dto.StagePayMobileDTO;
|
|
||||||
import com.bonus.canteen.core.order.mobile.vo.OrderPayMobileVO;
|
import com.bonus.canteen.core.order.mobile.vo.OrderPayMobileVO;
|
||||||
import com.bonus.canteen.core.pay.api.vo.UnifyPayVO;
|
|
||||||
|
|
||||||
public interface OrderPlaceMobileBusiness {
|
public interface OrderPlaceMobileBusiness {
|
||||||
// OrderPayMobileVO addCurrentMealOrder(RequestHeaderDTO headerDTO, OrderCurrMealTotalDTO currMealTotalDTO);
|
// OrderPayMobileVO addCurrentMealOrder(RequestHeaderDTO headerDTO, OrderCurrMealTotalDTO currMealTotalDTO);
|
||||||
|
|
@ -24,6 +22,4 @@ public interface OrderPlaceMobileBusiness {
|
||||||
// OrderPayMobileVO orderMixPayByTradeId(RequestHeaderDTO headerDTO, OrderMixPayMobileDTO orderMixPayMobileDTO);
|
// OrderPayMobileVO orderMixPayByTradeId(RequestHeaderDTO headerDTO, OrderMixPayMobileDTO orderMixPayMobileDTO);
|
||||||
//
|
//
|
||||||
// void orderPreBookAdd(RequestHeaderDTO headerDTO, OrderPreBookAddDTO addDTO);
|
// void orderPreBookAdd(RequestHeaderDTO headerDTO, OrderPreBookAddDTO addDTO);
|
||||||
|
|
||||||
UnifyPayVO stageOrderPay(RequestHeaderDTO headerDTO, StagePayMobileDTO stagePayDTO);
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -332,23 +332,6 @@ public class OrderPlaceMobileBusinessImplV3 implements OrderPlaceMobileBusiness
|
||||||
orderSavePO.setAmountChangeList(amountChangeList);
|
orderSavePO.setAmountChangeList(amountChangeList);
|
||||||
return LeConstants.COMMON_YES.equals(orderPayDTO.getIfTrial()) ? this.trialPay(orderSavePO, (OrderDeliveryResultVO)null) : this.saveAndPay(orderSavePO, false, true);
|
return LeConstants.COMMON_YES.equals(orderPayDTO.getIfTrial()) ? this.trialPay(orderSavePO, (OrderDeliveryResultVO)null) : this.saveAndPay(orderSavePO, false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public UnifyPayVO stageOrderPay(RequestHeaderDTO headerDTO, StagePayMobileDTO stagePayDTO) {
|
|
||||||
CustPayVO custInfo = this.getCustInfo(stagePayDTO.getCustId(), headerDTO.getSourceType());
|
|
||||||
UnifyPayDTO unifyPayDTO = this.createPay(stagePayDTO.getPayType(),
|
|
||||||
stagePayDTO.getCouponId(),
|
|
||||||
headerDTO.getSourceType(),
|
|
||||||
null,
|
|
||||||
null,
|
|
||||||
headerDTO.getOpenid(),
|
|
||||||
custInfo,
|
|
||||||
stagePayDTO);
|
|
||||||
unifyPayDTO.setAmount(stagePayDTO.getAmount());
|
|
||||||
unifyPayDTO.setRemark("驿站支付");
|
|
||||||
return payApi.pay(unifyPayDTO);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// public OrderPayMobileVO orderMixPayByTradeId(RequestHeaderDTO headerDTO, OrderMixPayMobileDTO orderMixPayMobileDTO) {
|
// public OrderPayMobileVO orderMixPayByTradeId(RequestHeaderDTO headerDTO, OrderMixPayMobileDTO orderMixPayMobileDTO) {
|
||||||
// LogUtil.info("订单混合支付|入参", orderMixPayMobileDTO);
|
// LogUtil.info("订单混合支付|入参", orderMixPayMobileDTO);
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,5 @@
|
||||||
package com.bonus.canteen.core.order.mobile.controller;
|
package com.bonus.canteen.core.order.mobile.controller;
|
||||||
|
|
||||||
import com.bonus.canteen.core.order.common.constants.StageWhiteList;
|
|
||||||
import com.bonus.canteen.core.order.common.dto.StageRefundParam;
|
|
||||||
import com.bonus.canteen.core.pay.api.vo.UnifyRefundVO;
|
|
||||||
import com.bonus.common.core.domain.R;
|
import com.bonus.common.core.domain.R;
|
||||||
import com.bonus.common.core.web.controller.BaseController;
|
import com.bonus.common.core.web.controller.BaseController;
|
||||||
import com.bonus.common.core.web.domain.AjaxResult;
|
import com.bonus.common.core.web.domain.AjaxResult;
|
||||||
|
|
@ -26,7 +23,6 @@ import com.bonus.canteen.core.pay.api.vo.UnifyPaySelectVO;
|
||||||
import com.bonus.common.houqin.utils.LeRequest;
|
import com.bonus.common.houqin.utils.LeRequest;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
|
@ -133,21 +129,6 @@ public class OrderInfoMobileController extends BaseController {
|
||||||
OrderRefundResultVO resultVO = this.orderRefundBusiness.orderRefund(request.convertToOrderRefundParam(), OrderRefundBizEnum.MOBILE);
|
OrderRefundResultVO resultVO = this.orderRefundBusiness.orderRefund(request.convertToOrderRefundParam(), OrderRefundBizEnum.MOBILE);
|
||||||
return resultVO.ifSuccess() ? AjaxResult.success(resultVO) : AjaxResult.error(resultVO.getResultCode(), resultVO.getResultMsg());
|
return resultVO.ifSuccess() ? AjaxResult.success(resultVO) : AjaxResult.error(resultVO.getResultCode(), resultVO.getResultMsg());
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping({"/stage/refund"})
|
|
||||||
@ApiOperation(
|
|
||||||
value = "驿站退款",
|
|
||||||
notes = "驿站退款"
|
|
||||||
)
|
|
||||||
public AjaxResult stageRefundMobile(@RequestHeader Map<String, String> headers,
|
|
||||||
@RequestBody StageRefundParam request) {
|
|
||||||
String sign = HeaderFetchUtil.getSign(headers);
|
|
||||||
if(StringUtils.isBlank(sign) || !sign.equals(StageWhiteList.STAGE_SIGN_WHITE_LIST)) {
|
|
||||||
return AjaxResult.error("签名失败");
|
|
||||||
}
|
|
||||||
UnifyRefundVO resultVO = this.orderRefundBusiness.stageRefund(request);
|
|
||||||
return AjaxResult.success(resultVO);
|
|
||||||
}
|
|
||||||
//
|
//
|
||||||
// @PostMapping({"/book/stat"})
|
// @PostMapping({"/book/stat"})
|
||||||
// public LeResponse<OrderBookStatMobileVO> orderBookStat(@RequestHeader Map<String, String> headers, @RequestBody LeRequest<?> request) {
|
// public LeResponse<OrderBookStatMobileVO> orderBookStat(@RequestHeader Map<String, String> headers, @RequestBody LeRequest<?> request) {
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,6 @@
|
||||||
package com.bonus.canteen.core.order.mobile.controller;
|
package com.bonus.canteen.core.order.mobile.controller;
|
||||||
|
|
||||||
import com.bonus.canteen.core.common.utils.HeaderFetchUtil;
|
|
||||||
import com.bonus.canteen.core.order.common.constants.StageWhiteList;
|
|
||||||
import com.bonus.canteen.core.order.mobile.dto.OrderPayMobileDTO;
|
import com.bonus.canteen.core.order.mobile.dto.OrderPayMobileDTO;
|
||||||
import com.bonus.canteen.core.order.mobile.dto.StagePayMobileDTO;
|
|
||||||
import com.bonus.canteen.core.pay.api.vo.UnifyPayVO;
|
|
||||||
import com.bonus.canteen.core.pay.common.constants.PayTypeEnum;
|
|
||||||
import com.bonus.common.core.domain.R;
|
import com.bonus.common.core.domain.R;
|
||||||
import com.bonus.common.core.web.domain.AjaxResult;
|
import com.bonus.common.core.web.domain.AjaxResult;
|
||||||
import com.bonus.common.houqin.constant.RetCodeEnum;
|
import com.bonus.common.houqin.constant.RetCodeEnum;
|
||||||
|
|
@ -18,7 +13,6 @@ import com.bonus.common.houqin.utils.LeRequest;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.apache.commons.collections4.CollectionUtils;
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
@ -133,32 +127,6 @@ public class OrderPlaceMobileController {
|
||||||
LogUtil.info("[根据订单id支付]支付耗时", System.currentTimeMillis() - startTime, mobileVO);
|
LogUtil.info("[根据订单id支付]支付耗时", System.currentTimeMillis() - startTime, mobileVO);
|
||||||
return !mobileVO.success() ? AjaxResult.error( mobileVO.getMsg(), mobileVO) : AjaxResult.success(mobileVO);
|
return !mobileVO.success() ? AjaxResult.error( mobileVO.getMsg(), mobileVO) : AjaxResult.success(mobileVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping({"/stage/pay"})
|
|
||||||
@ApiOperation(
|
|
||||||
value = "驿站付款",
|
|
||||||
notes = "驿站付款"
|
|
||||||
)
|
|
||||||
public AjaxResult stageOrderPay(@RequestHeader Map<String, String> headers,
|
|
||||||
@RequestBody StagePayMobileDTO stagePayDTO) {
|
|
||||||
String sign = HeaderFetchUtil.getSign(headers);
|
|
||||||
if(StringUtils.isBlank(sign) || !sign.equals(StageWhiteList.STAGE_SIGN_WHITE_LIST)) {
|
|
||||||
return AjaxResult.error("签名失败");
|
|
||||||
}
|
|
||||||
UnifyPayVO mobileVO = null;
|
|
||||||
try{
|
|
||||||
long startTime = System.currentTimeMillis();
|
|
||||||
RequestHeaderDTO headerDTO = RequestHeaderDTO.of(headers);
|
|
||||||
stagePayDTO.setCustId(headerDTO.getCustId());
|
|
||||||
stagePayDTO.setPayType(PayTypeEnum.MEAL_CARD.getKey());
|
|
||||||
mobileVO = this.orderPlaceMobileBusiness.stageOrderPay(headerDTO, stagePayDTO);
|
|
||||||
LogUtil.info("[驿站支付]支付耗时", System.currentTimeMillis() - startTime, mobileVO);
|
|
||||||
}catch (Exception ex) {
|
|
||||||
log.error("驿站支付异常", ex);
|
|
||||||
return AjaxResult.error("支付失败", 500);
|
|
||||||
}
|
|
||||||
return AjaxResult.success(mobileVO);
|
|
||||||
}
|
|
||||||
//
|
//
|
||||||
// @PostMapping({"/mixPay/by/orderId"})
|
// @PostMapping({"/mixPay/by/orderId"})
|
||||||
// @ApiOperation(
|
// @ApiOperation(
|
||||||
|
|
|
||||||
|
|
@ -1,19 +0,0 @@
|
||||||
package com.bonus.canteen.core.order.mobile.dto;
|
|
||||||
|
|
||||||
import com.bonus.common.houqin.constant.LeConstants;
|
|
||||||
import com.fasterxml.jackson.databind.JsonNode;
|
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import javax.validation.constraints.Min;
|
|
||||||
import javax.validation.constraints.NotNull;
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
|
|
||||||
@ApiModel("移动端根据订单号支付DTO")
|
|
||||||
@Data
|
|
||||||
public class StagePayMobileDTO extends OrderPayMobileDTO{
|
|
||||||
@ApiModelProperty("支付金额")
|
|
||||||
private @NotNull @Min(value = 0L, message = "金额不能小于0") BigDecimal amount;
|
|
||||||
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue