|
|
@@ -1,7 +1,11 @@ |
|
|
package com.simple.controller; |
|
|
package com.simple.controller; |
|
|
|
|
|
|
|
|
|
|
|
import com.simple.common.ErrorCode; |
|
|
|
|
|
import com.simple.domain.po.WxMerchantBUser; |
|
|
import com.simple.domain.vo.OrderVo; |
|
|
import com.simple.domain.vo.OrderVo; |
|
|
import com.simple.enums.EnumOrderStatus; |
|
|
import com.simple.enums.EnumOrderStatus; |
|
|
|
|
|
import io.swagger.models.auth.In; |
|
|
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
import org.apache.log4j.Logger; |
|
|
import org.apache.log4j.Logger; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.util.Assert; |
|
|
import org.springframework.util.Assert; |
|
|
@@ -32,45 +36,71 @@ public class WxOrderController extends BaseController { |
|
|
@ApiImplicitParams({ |
|
|
@ApiImplicitParams({ |
|
|
@ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), |
|
|
@ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), |
|
|
@ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true), |
|
|
@ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true), |
|
|
@ApiImplicitParam(name = "merchantId", value = "B端用户ID", dataType = "Long", paramType = "query", required = true), |
|
|
|
|
|
@ApiImplicitParam(name = "cUserId", value = "C端用户ID", dataType = "Long", paramType = "query", required = false), |
|
|
|
|
|
@ApiImplicitParam(name = "orderId", value = "订单ID", dataType = "Long", paramType = "query", required = false), |
|
|
|
|
|
@ApiImplicitParam(name = "couponId", value = "券ID", dataType = "Long", paramType = "query", required = false), |
|
|
|
|
|
@ApiImplicitParam(name = "status", value = "订单状态:-1全部;0-已下单/待付款;1-已支付;2-已取消(限定时间内未付款);3-未退款/待退款;4-已退款;5-退款失败", required = false, dataType = "Integer"), |
|
|
|
|
|
|
|
|
@ApiImplicitParam(name = "orderStatus", value = "订单状态:-1全部;0-已下单/待付款;1-已支付;2-已取消(限定时间内未付款);3-未退款/待退款;4-已退款;5-退款失败", required = false, dataType = "Integer"), |
|
|
@ApiImplicitParam(name = "couponStatus", value = "券状态:-1全部;3:已领取/已购买/未核销/未使用,4:已核销/已使用,5:已过期,6:已退券", required = false, dataType = "Integer") |
|
|
@ApiImplicitParam(name = "couponStatus", value = "券状态:-1全部;3:已领取/已购买/未核销/未使用,4:已核销/已使用,5:已过期,6:已退券", required = false, dataType = "Integer") |
|
|
}) |
|
|
}) |
|
|
public ResultData list(@ModelAttribute OrderVo orderVo, Integer pageNum, Integer pageSize) { |
|
|
|
|
|
|
|
|
public ResultData list(Integer orderStatus, Integer couponStatus, Integer pageNum, Integer pageSize) { |
|
|
|
|
|
WxMerchantBUser user = getUser(); |
|
|
|
|
|
OrderVo orderVo = new OrderVo(); |
|
|
|
|
|
orderVo.setbUserId(user.getId()); |
|
|
|
|
|
if (orderStatus != -1) |
|
|
|
|
|
orderVo.setOrderStatus(orderStatus); |
|
|
|
|
|
if (couponStatus != -1) |
|
|
|
|
|
orderVo.setCouponStatus(couponStatus); |
|
|
final PageInfo<Map<String,Object>> page = wxOrderService.bQueryListMap(orderVo, pageNum, pageSize); |
|
|
final PageInfo<Map<String,Object>> page = wxOrderService.bQueryListMap(orderVo, pageNum, pageSize); |
|
|
return new ResultData(page); |
|
|
return new ResultData(page); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ApiOperation("订单详情") |
|
|
|
|
|
|
|
|
@ApiOperation(value = "订单详情", notes = "{\"couponOrderId\":\"String\",\"orderId\":\"String\",\"couponId\":\"String\"}") |
|
|
@GetMapping("detail") |
|
|
@GetMapping("detail") |
|
|
@ApiImplicitParams({ |
|
|
|
|
|
@ApiImplicitParam(name = "merchantId", value = "B端用户ID", dataType = "Long", paramType = "query", required = true), |
|
|
|
|
|
@ApiImplicitParam(name = "cUserId", value = "C端用户ID", dataType = "Long", paramType = "query", required = false), |
|
|
|
|
|
@ApiImplicitParam(name = "orderId", value = "订单ID", dataType = "Long", paramType = "query", required = false), |
|
|
|
|
|
@ApiImplicitParam(name = "couponId", value = "券ID", dataType = "Long", paramType = "query", required = false), |
|
|
|
|
|
@ApiImplicitParam(name = "status", value = "订单状态:-1全部;0-已下单/待付款;1-已支付;2-已取消(限定时间内未付款);3-未退款/待退款;4-已退款;5-退款失败", required = false, dataType = "Integer"), |
|
|
|
|
|
@ApiImplicitParam(name = "couponStatus", value = "券状态:-1全部;3:已领取/已购买/未核销/未使用,4:已核销/已使用,5:已过期,6:已退券", required = false, dataType = "Integer") |
|
|
|
|
|
}) |
|
|
|
|
|
public ResultData orderDetail(@ModelAttribute OrderVo orderVo) { |
|
|
|
|
|
|
|
|
public ResultData orderDetail(@RequestBody Map<String, String> paramMap) { |
|
|
//Assert.notNull(wxOrders.getName(), "角色名不能为空"); |
|
|
//Assert.notNull(wxOrders.getName(), "角色名不能为空"); |
|
|
//Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); |
|
|
//Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); |
|
|
|
|
|
String couponOrderIdStr = paramMap.get("couponOrderId"); |
|
|
|
|
|
String orderIdStr = paramMap.get("orderId"); |
|
|
|
|
|
String couponIdStr = paramMap.get("couponId"); |
|
|
|
|
|
if (StringUtils.isBlank(couponOrderIdStr)) { |
|
|
|
|
|
return new ResultData(ErrorCode.PARAMETER_NOT_NULL.getCode(), "couponOrderId不能为空"); |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isBlank(orderIdStr)) { |
|
|
|
|
|
return new ResultData(ErrorCode.PARAMETER_NOT_NULL.getCode(), "orderId不能为空"); |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isBlank(couponIdStr)) { |
|
|
|
|
|
return new ResultData(ErrorCode.PARAMETER_NOT_NULL.getCode(), "couponId不能为空"); |
|
|
|
|
|
} |
|
|
|
|
|
Long couponOrderId = 0L, orderId = 0L, couponId = 0L; |
|
|
|
|
|
try { |
|
|
|
|
|
couponOrderId = Long.valueOf(couponOrderIdStr); |
|
|
|
|
|
orderId = Long.valueOf(orderIdStr); |
|
|
|
|
|
couponId = Long.valueOf(couponIdStr); |
|
|
|
|
|
} catch (NumberFormatException e) { |
|
|
|
|
|
logger.error("couponOrderId " + couponOrderIdStr + ", e:" + e.getMessage()); |
|
|
|
|
|
} |
|
|
|
|
|
WxMerchantBUser user = getUser(); |
|
|
|
|
|
OrderVo orderVo = new OrderVo(); |
|
|
|
|
|
orderVo.setbUserId(user.getId()); |
|
|
|
|
|
orderVo.setOrderId(orderId); |
|
|
|
|
|
orderVo.setCouponId(couponId); |
|
|
Map<String,Object> map = wxOrderService.queryObject(orderVo); |
|
|
Map<String,Object> map = wxOrderService.queryObject(orderVo); |
|
|
return new ResultData(map); |
|
|
return new ResultData(map); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ApiOperation("手工退款") |
|
|
|
|
|
|
|
|
@ApiOperation(value = "手工退款", notes = "{\"orderId\":\"string\"}") |
|
|
@PostMapping("refund") |
|
|
@PostMapping("refund") |
|
|
@ApiImplicitParams({ |
|
|
|
|
|
@ApiImplicitParam(name = "id", value = "订单ID", required = true, dataType = "Long") |
|
|
|
|
|
}) |
|
|
|
|
|
public ResultData expiringOrder(@RequestBody WxOrder wxOrder) { |
|
|
|
|
|
|
|
|
public ResultData expiringOrder(@RequestBody Map<String, String> paramMap) { |
|
|
//Assert.notNull(wxOrders.getName(), "角色名不能为空"); |
|
|
//Assert.notNull(wxOrders.getName(), "角色名不能为空"); |
|
|
//Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); |
|
|
//Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); |
|
|
// 1. |
|
|
|
|
|
//wxOrderService.updateOrderStatus(wxOrder.getId(), EnumOrderStatus.ORDER_STATUS_PENDING_REFUND); |
|
|
|
|
|
|
|
|
String orderIdStr = paramMap.get("orderId"); |
|
|
|
|
|
if (StringUtils.isBlank(orderIdStr)) { |
|
|
|
|
|
return new ResultData(ErrorCode.PARAMETER_NOT_NULL.getCode(), "orderId不能为空"); |
|
|
|
|
|
} |
|
|
|
|
|
Long orderId = 0L; |
|
|
|
|
|
try { |
|
|
|
|
|
orderId = Long.valueOf(orderIdStr); |
|
|
|
|
|
} catch (NumberFormatException e) { |
|
|
|
|
|
logger.error("orderId " + orderIdStr + ", e:" + e.getMessage()); |
|
|
|
|
|
} |
|
|
|
|
|
wxOrderService.updateOrderStatus(orderId, EnumOrderStatus.ORDER_STATUS_PENDING_REFUND); |
|
|
return new ResultData(); |
|
|
return new ResultData(); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |