调整支付接口
This commit is contained in:
@@ -57,6 +57,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
|
||||
"/api/shop/payment/mp-alipay/test/**",
|
||||
"/api/shop/payment/mp-alipay/getPhoneNumber",
|
||||
"/api/shop/test/**",
|
||||
"/api/shop/order-pay/change-order-no",
|
||||
"/api/shop/wx-login/**",
|
||||
"/api/apps/hualala/**",
|
||||
"/api/apps/hualala-cart/**",
|
||||
|
||||
@@ -7,6 +7,7 @@ import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alipay.api.AlipayApiException;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.gxwebsoft.apps.entity.EquipmentGoods;
|
||||
import com.gxwebsoft.apps.service.EquipmentGoodsService;
|
||||
@@ -87,6 +88,20 @@ public class OrderPayController extends BaseController {
|
||||
//return success(orderPayService.getByIdRel(id));
|
||||
}
|
||||
|
||||
@GetMapping("/change-order-no")
|
||||
public ApiResult<?> changeOrderNo() {
|
||||
List<OrderPay> list = orderPayService.list();
|
||||
if (CollectionUtil.isNotEmpty(list)) {
|
||||
for (OrderPay orderPay : list) {
|
||||
if (!orderPay.getOrderNo().equals(orderPay.getOriginOrderNo())) {
|
||||
orderPay.setOrderNo(IdUtil.getSnowflakeNextIdStr());
|
||||
orderPayService.updateById(orderPay);
|
||||
}
|
||||
}
|
||||
}
|
||||
return success();
|
||||
}
|
||||
|
||||
@GetMapping("/getByOrderId/{id}")
|
||||
public ApiResult<?> getByOrderId(@PathVariable("id") Integer orderId) {
|
||||
OrderPay one = orderPayService.lambdaQuery()
|
||||
@@ -100,8 +115,8 @@ public class OrderPayController extends BaseController {
|
||||
EquipmentGoods eg = equipmentGoodsService.getById(order.getOrderSourceId());
|
||||
// 是否提前续租
|
||||
Integer isRenew = order.getIsRenew();
|
||||
if(one == null) {
|
||||
if(ORDER_STATUS_OVER.equals(order.getOrderStatus())) {
|
||||
if (one == null) {
|
||||
if (ORDER_STATUS_OVER.equals(order.getOrderStatus())) {
|
||||
return fail(null);
|
||||
}
|
||||
|
||||
@@ -114,7 +129,7 @@ public class OrderPayController extends BaseController {
|
||||
one.setPeriods(order.getPeriods());
|
||||
one.setRentOrderId(order.getOrderId());
|
||||
one.setStartTime(order.getExpirationTime());
|
||||
one.setExpirationTime(DateUtil.offset(order.getExpirationTime(), DateField.MONTH,1));
|
||||
one.setExpirationTime(DateUtil.offset(order.getExpirationTime(), DateField.MONTH, 1));
|
||||
one.setPayStatus(PAY_STATUS_NO_PAY);
|
||||
one.setBatteryDeposit(order.getBatteryDeposit());
|
||||
one.setBatteryInsurance(order.getBatteryInsurance());
|
||||
@@ -127,12 +142,12 @@ public class OrderPayController extends BaseController {
|
||||
one.setOutRequestNo(order.getOutRequestNo());
|
||||
one.setBatteryRent(order.getBatteryRent());
|
||||
one.setOrderSource(order.getOrderSource());
|
||||
if(order.getOrderSource() == 20) {
|
||||
if (order.getOrderSource() == 20) {
|
||||
// 每期还款+手续费
|
||||
one.setTotalPrice(eg.getRepayment().add(eg.getServiceCharges()));
|
||||
one.setOrderPrice(eg.getRepayment().add(eg.getServiceCharges()));
|
||||
one.setPayPrice(eg.getRepayment().add(eg.getServiceCharges()));
|
||||
}else if(order.getOrderSource() == 30 || order.getOrderSource() == 40) {
|
||||
} else if (order.getOrderSource() == 30 || order.getOrderSource() == 40) {
|
||||
// 月租
|
||||
BigDecimal price = eg.getBatteryRent();
|
||||
|
||||
@@ -150,20 +165,19 @@ public class OrderPayController extends BaseController {
|
||||
one.setIsFreeze(order.getIsFreeze());
|
||||
one.setIsRenew(isRenew);
|
||||
|
||||
if(isRenew == null || isRenew == 0){
|
||||
if (isRenew == null || isRenew == 0) {
|
||||
String freezeOrderNo = order.getFreezeOrderNo();
|
||||
if(StrUtil.isNotBlank(freezeOrderNo)){
|
||||
if (StrUtil.isNotBlank(freezeOrderNo)) {
|
||||
LambdaQueryWrapper<FreezeOrder> fWrapper = Wrappers.lambdaQuery();
|
||||
fWrapper.eq(FreezeOrder::getOutOrderNo, freezeOrderNo)
|
||||
.eq(FreezeOrder::getOperationType, "FREEZE")
|
||||
.eq(FreezeOrder::getStatus, "SUCCESS")
|
||||
.last("limit 1");
|
||||
int cnt = freezeOrderService.count(fWrapper);
|
||||
if(cnt > 0) {
|
||||
if (cnt > 0) {
|
||||
log.info("订单{}已支付支付押金!", orderId);
|
||||
one.setHasFreeze(1);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
log.info("订单{}未支付押金!", orderId);
|
||||
// fWrapper.clear();
|
||||
// fWrapper.eq(FreezeOrder::getOutOrderNo, freezeOrderNo)
|
||||
@@ -193,7 +207,7 @@ public class OrderPayController extends BaseController {
|
||||
// 记录当前登录用户id
|
||||
User loginUser = getLoginUser();
|
||||
if (loginUser != null) {
|
||||
orderPay.setUserId(loginUser.getUserId());
|
||||
orderPay.setUserId(loginUser.getUserId());
|
||||
}
|
||||
if (orderPayService.save(orderPay)) {
|
||||
return success("添加成功");
|
||||
|
||||
@@ -44,6 +44,9 @@ public class OrderPay implements Serializable {
|
||||
@ApiModelProperty(value = "订单号")
|
||||
private String orderNo;
|
||||
|
||||
@ApiModelProperty(value = "订单号")
|
||||
private String originOrderNo;
|
||||
|
||||
@ApiModelProperty(value = "商品总金额(不含优惠折扣)")
|
||||
private BigDecimal totalPrice;
|
||||
private Integer orderSource;
|
||||
|
||||
Reference in New Issue
Block a user