退款申请10秒内只能提交1次
This commit is contained in:
parent
4501480a00
commit
9f41267206
@ -1,5 +1,6 @@
|
||||
package com.xhpc.payment.controller;
|
||||
|
||||
import com.xhpc.common.api.UserTypeService;
|
||||
import com.xhpc.common.core.annotation.NoRepeatSubmit;
|
||||
import com.xhpc.common.core.constant.HttpStatus;
|
||||
import com.xhpc.common.core.constant.StatusConstants;
|
||||
@ -8,6 +9,8 @@ import com.xhpc.common.core.web.controller.BaseController;
|
||||
import com.xhpc.common.core.web.domain.AjaxResult;
|
||||
import com.xhpc.common.core.web.page.TableDataInfo;
|
||||
import com.xhpc.common.security.service.TokenService;
|
||||
import com.xhpc.common.util.UserTypeUtil;
|
||||
import com.xhpc.payment.service.IXhpcCommonPayment;
|
||||
import com.xhpc.payment.service.IXhpcRefundOrderService;
|
||||
import com.xhpc.system.api.model.LoginUser;
|
||||
import io.swagger.annotations.Api;
|
||||
@ -31,6 +34,10 @@ public class XhpcRefundOrderController extends BaseController {
|
||||
private IXhpcRefundOrderService iXhpcRefundOrderService;
|
||||
@Autowired
|
||||
private TokenService tokenService;
|
||||
@Autowired
|
||||
private IXhpcCommonPayment xhpcCommonPayment;
|
||||
@Autowired
|
||||
private UserTypeService userTypeService;
|
||||
|
||||
/**
|
||||
* 申请退款
|
||||
@ -40,8 +47,15 @@ public class XhpcRefundOrderController extends BaseController {
|
||||
@NoRepeatSubmit
|
||||
@PostMapping("/checkOut")
|
||||
@ApiOperation(value = "申请退款")
|
||||
public AjaxResult enterpriseCheckOut(@RequestBody Map<String, Object> map) {
|
||||
public AjaxResult enterpriseCheckOut(HttpServletRequest request, @RequestBody Map<String, Object> map) {
|
||||
|
||||
LoginUser loginUser = tokenService.getLoginUser(request);
|
||||
Long userid = loginUser.getUserid();
|
||||
Integer userType = loginUser.getUserType();
|
||||
String tenantId = loginUser.getTenantId();
|
||||
if (UserTypeUtil.CUSTOMERS_TYPE.equals(userType)) {
|
||||
return AjaxResult.error(HttpStatus.ERROR_STATUS, "大客户不支持退款");
|
||||
}
|
||||
String amount = StringUtils.valueOf(map.get("amount"));
|
||||
if (StringUtils.isEmpty(amount)) {
|
||||
return AjaxResult.error(HttpStatus.NOT_NULL, "退款金额不能为空");
|
||||
@ -64,23 +78,22 @@ public class XhpcRefundOrderController extends BaseController {
|
||||
if (StringUtils.isEmpty(type)) {
|
||||
return AjaxResult.error(HttpStatus.NOT_NULL, "退款渠道不能为空");
|
||||
}
|
||||
|
||||
//是否有实时数据
|
||||
int i = iXhpcRefundOrderService.countXhpcRealTimeOrder(Long.valueOf(userId));
|
||||
int i = iXhpcRefundOrderService.countXhpcRealTimeOrder(userid, userType, tenantId);
|
||||
if (i > 0) {
|
||||
return AjaxResult.error(1103, "车辆正在充电,不能退款");
|
||||
}
|
||||
// 是否有异常订单
|
||||
int j = iXhpcRefundOrderService.countXhpcChargeOrder(Long.valueOf(userId));
|
||||
int j = iXhpcRefundOrderService.countXhpcChargeOrder(userid, userType, tenantId);
|
||||
if (j > 0) {
|
||||
return AjaxResult.error(1103, "你有异常订单未解决,请拨打客服电话进行解决");
|
||||
}
|
||||
|
||||
//生成退款订单
|
||||
String orderOutNumber = StringUtils.numFormat(Long.parseLong(userId), Integer.parseInt(type),
|
||||
String orderOutNumber = StringUtils.numFormat(userid, Integer.parseInt(type),
|
||||
StatusConstants.FLOWING_WATER_REFUND_TYPE);
|
||||
String remark = StringUtils.valueOf(map.get("remark"));
|
||||
return iXhpcRefundOrderService.addRefundOrder(userId, BigDecimal.valueOf(Double.parseDouble(amount)), type, orderOutNumber, openid, remark);
|
||||
return iXhpcRefundOrderService.addRefundOrder("" + userid, BigDecimal.valueOf(Double.parseDouble(amount)), type,
|
||||
orderOutNumber, openid, remark, userType, tenantId);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user