|
|
|
@@ -176,115 +176,115 @@ public class WxOrderController extends BaseController { |
|
|
|
return new ResultData(); |
|
|
|
} |
|
|
|
|
|
|
|
@ApiOperation("分页订单列表接口") |
|
|
|
@GetMapping("list") |
|
|
|
@ApiImplicitParams({ |
|
|
|
@ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), |
|
|
|
@ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true), |
|
|
|
}) |
|
|
|
public ResultData list(@ModelAttribute WxOrder wxOrder, Integer pageNum, Integer pageSize) { |
|
|
|
// c端用户应该只能看到自己的订单 |
|
|
|
if (wxOrder == null){ |
|
|
|
wxOrder = new WxOrder(); |
|
|
|
} |
|
|
|
Long memberId; |
|
|
|
try { |
|
|
|
memberId = getMemberId(); |
|
|
|
} catch (Exception e) { |
|
|
|
return new ResultData(Result.ERROR,e.getMessage()); |
|
|
|
} |
|
|
|
wxOrder.setCUserId(memberId); |
|
|
|
wxOrder.setSortColumns(BaseEntity.SortField.UpdateDate_DESC); |
|
|
|
wxOrder.updateTenantInfo(getTenantInfo()); |
|
|
|
final PageInfo<WxOrderCouponVo> page = wxOrderService.listCUserVoAsPage(wxOrder, pageNum, pageSize,false); |
|
|
|
|
|
|
|
Date now = new Date(); |
|
|
|
page.getList().stream().forEach(oc->{ |
|
|
|
if (oc.getValidStartDate() != null && oc.getValidEndDate() != null ) { |
|
|
|
if (oc.getValidStartDate().getTime() > now.getTime()) { |
|
|
|
oc.setValidStatus(EnumCouponOrderValidStatus.PREPARED.getCode()); |
|
|
|
} else if (oc.getValidEndDate().getTime() < now.getTime()) { |
|
|
|
oc.setValidStatus(EnumCouponOrderValidStatus.ENDED.getCode()); |
|
|
|
} else { |
|
|
|
oc.setValidStatus(EnumCouponChannelActivityStatus.STARTED.getCode()); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
return new ResultData(page); |
|
|
|
} |
|
|
|
|
|
|
|
@ApiOperation("订单详情接口") |
|
|
|
@GetMapping("detail") |
|
|
|
@ApiImplicitParams({ |
|
|
|
@ApiImplicitParam(name = "orderId", value = "订单id", dataType = "String", paramType = "query", required = true) |
|
|
|
}) |
|
|
|
public ResultData detail(String orderId) { |
|
|
|
if (StringUtils.isBlank(orderId) || orderId.equalsIgnoreCase(Constant.UNDEFINED)) { |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); |
|
|
|
} |
|
|
|
// c端用户应该只能看到自己的订单细节 |
|
|
|
WxOrder wxOrder = new WxOrder(); |
|
|
|
Long id = 0L; |
|
|
|
try { |
|
|
|
id = Long.valueOf(orderId); |
|
|
|
} catch (NumberFormatException e) { |
|
|
|
logger.error("parse orderId failed"); |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "订单ID转换异常:"+orderId); |
|
|
|
} |
|
|
|
wxOrder.setId(id); |
|
|
|
Long memberId; |
|
|
|
try { |
|
|
|
memberId = getMemberId(); |
|
|
|
} catch (Exception e) { |
|
|
|
return new ResultData(Result.ERROR,e.getMessage()); |
|
|
|
} |
|
|
|
wxOrder.setCUserId(memberId); |
|
|
|
wxOrder.updateTenantInfo(getTenantInfo()); |
|
|
|
WxOrderCouponVo wxOrderCVo = wxOrderService.detailCUserVo(wxOrder); |
|
|
|
if (wxOrderCVo == null) |
|
|
|
return new ResultData(ErrorCode.ORDER_IS_NOT_FIND); |
|
|
|
|
|
|
|
Date now = new Date(); |
|
|
|
|
|
|
|
if (wxOrderCVo.getValidStartDate() != null && wxOrderCVo.getValidEndDate() != null |
|
|
|
&& !wxOrderCVo.getType().equals(EnumCouponType.COUPON_PREORDER.getCode())) { |
|
|
|
if (wxOrderCVo.getValidStartDate().getTime() > now.getTime()) { |
|
|
|
wxOrderCVo.setValidStatus(EnumCouponOrderValidStatus.PREPARED.getCode()); |
|
|
|
} else if (wxOrderCVo.getValidEndDate().getTime() < now.getTime()) { |
|
|
|
wxOrderCVo.setValidStatus(EnumCouponOrderValidStatus.ENDED.getCode()); |
|
|
|
} else { |
|
|
|
wxOrderCVo.setValidStatus(EnumCouponChannelActivityStatus.STARTED.getCode()); |
|
|
|
} |
|
|
|
} |
|
|
|
if(wxOrderCVo.getType().equals(EnumCouponType.COUPON_PREORDER.getCode()) |
|
|
|
&& wxOrderCVo.getPickStartDate() != null && wxOrderCVo.getPickEndDate() != null){ |
|
|
|
// wxOrderCVo.setValidStartDate(wxOrderCVo.getPickStartDate()); |
|
|
|
// wxOrderCVo.setValidEndDate(wxOrderCVo.getPickEndDate()); |
|
|
|
if (wxOrderCVo.getPickStartDate().getTime() > now.getTime()) { |
|
|
|
wxOrderCVo.setValidStatus(EnumCouponOrderValidStatus.PREPARED.getCode()); |
|
|
|
} else if (wxOrderCVo.getPickEndDate().getTime() < now.getTime()) { |
|
|
|
wxOrderCVo.setValidStatus(EnumCouponOrderValidStatus.ENDED.getCode()); |
|
|
|
} else { |
|
|
|
wxOrderCVo.setValidStatus(EnumCouponChannelActivityStatus.STARTED.getCode()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return new ResultData(wxOrderCVo); |
|
|
|
} |
|
|
|
// @ApiOperation("分页订单列表接口") |
|
|
|
// @GetMapping("list") |
|
|
|
// @ApiImplicitParams({ |
|
|
|
// @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), |
|
|
|
// @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true), |
|
|
|
// }) |
|
|
|
// public ResultData list(@ModelAttribute WxOrder wxOrder, Integer pageNum, Integer pageSize) { |
|
|
|
// // c端用户应该只能看到自己的订单 |
|
|
|
// if (wxOrder == null){ |
|
|
|
// wxOrder = new WxOrder(); |
|
|
|
// } |
|
|
|
// Long memberId; |
|
|
|
// try { |
|
|
|
// memberId = getMemberId(); |
|
|
|
// } catch (Exception e) { |
|
|
|
// return new ResultData(Result.ERROR,e.getMessage()); |
|
|
|
// } |
|
|
|
// wxOrder.setCUserId(memberId); |
|
|
|
// wxOrder.setSortColumns(BaseEntity.SortField.UpdateDate_DESC); |
|
|
|
// wxOrder.updateTenantInfo(getTenantInfo()); |
|
|
|
// final PageInfo<WxOrderCouponVo> page = wxOrderService.listCUserVoAsPage(wxOrder, pageNum, pageSize,false); |
|
|
|
// |
|
|
|
// Date now = new Date(); |
|
|
|
// page.getList().stream().forEach(oc->{ |
|
|
|
// if (oc.getValidStartDate() != null && oc.getValidEndDate() != null ) { |
|
|
|
// if (oc.getValidStartDate().getTime() > now.getTime()) { |
|
|
|
// oc.setValidStatus(EnumCouponOrderValidStatus.PREPARED.getCode()); |
|
|
|
// } else if (oc.getValidEndDate().getTime() < now.getTime()) { |
|
|
|
// oc.setValidStatus(EnumCouponOrderValidStatus.ENDED.getCode()); |
|
|
|
// } else { |
|
|
|
// oc.setValidStatus(EnumCouponChannelActivityStatus.STARTED.getCode()); |
|
|
|
// } |
|
|
|
// } |
|
|
|
// }); |
|
|
|
// |
|
|
|
// |
|
|
|
// return new ResultData(page); |
|
|
|
// } |
|
|
|
|
|
|
|
// @ApiOperation("订单详情接口") |
|
|
|
// @GetMapping("detail") |
|
|
|
// @ApiImplicitParams({ |
|
|
|
// @ApiImplicitParam(name = "orderId", value = "订单id", dataType = "String", paramType = "query", required = true) |
|
|
|
// }) |
|
|
|
// public ResultData detail(String orderId) { |
|
|
|
// if (StringUtils.isBlank(orderId) || orderId.equalsIgnoreCase(Constant.UNDEFINED)) { |
|
|
|
// return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); |
|
|
|
// } |
|
|
|
// // c端用户应该只能看到自己的订单细节 |
|
|
|
// WxOrder wxOrder = new WxOrder(); |
|
|
|
// Long id = 0L; |
|
|
|
// try { |
|
|
|
// id = Long.valueOf(orderId); |
|
|
|
// } catch (NumberFormatException e) { |
|
|
|
// logger.error("parse orderId failed"); |
|
|
|
// return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "订单ID转换异常:"+orderId); |
|
|
|
// } |
|
|
|
// wxOrder.setId(id); |
|
|
|
// Long memberId; |
|
|
|
// try { |
|
|
|
// memberId = getMemberId(); |
|
|
|
// } catch (Exception e) { |
|
|
|
// return new ResultData(Result.ERROR,e.getMessage()); |
|
|
|
// } |
|
|
|
// wxOrder.setCUserId(memberId); |
|
|
|
// wxOrder.updateTenantInfo(getTenantInfo()); |
|
|
|
// WxOrderCouponVo wxOrderCVo = wxOrderService.detailCUserVo(wxOrder); |
|
|
|
// if (wxOrderCVo == null) |
|
|
|
// return new ResultData(ErrorCode.ORDER_IS_NOT_FIND); |
|
|
|
// |
|
|
|
// Date now = new Date(); |
|
|
|
// |
|
|
|
// if (wxOrderCVo.getValidStartDate() != null && wxOrderCVo.getValidEndDate() != null |
|
|
|
// && !wxOrderCVo.getType().equals(EnumCouponType.COUPON_PREORDER.getCode())) { |
|
|
|
// if (wxOrderCVo.getValidStartDate().getTime() > now.getTime()) { |
|
|
|
// wxOrderCVo.setValidStatus(EnumCouponOrderValidStatus.PREPARED.getCode()); |
|
|
|
// } else if (wxOrderCVo.getValidEndDate().getTime() < now.getTime()) { |
|
|
|
// wxOrderCVo.setValidStatus(EnumCouponOrderValidStatus.ENDED.getCode()); |
|
|
|
// } else { |
|
|
|
// wxOrderCVo.setValidStatus(EnumCouponChannelActivityStatus.STARTED.getCode()); |
|
|
|
// } |
|
|
|
// } |
|
|
|
// if(wxOrderCVo.getType().equals(EnumCouponType.COUPON_PREORDER.getCode()) |
|
|
|
// && wxOrderCVo.getPickStartDate() != null && wxOrderCVo.getPickEndDate() != null){ |
|
|
|
//// wxOrderCVo.setValidStartDate(wxOrderCVo.getPickStartDate()); |
|
|
|
//// wxOrderCVo.setValidEndDate(wxOrderCVo.getPickEndDate()); |
|
|
|
// if (wxOrderCVo.getPickStartDate().getTime() > now.getTime()) { |
|
|
|
// wxOrderCVo.setValidStatus(EnumCouponOrderValidStatus.PREPARED.getCode()); |
|
|
|
// } else if (wxOrderCVo.getPickEndDate().getTime() < now.getTime()) { |
|
|
|
// wxOrderCVo.setValidStatus(EnumCouponOrderValidStatus.ENDED.getCode()); |
|
|
|
// } else { |
|
|
|
// wxOrderCVo.setValidStatus(EnumCouponChannelActivityStatus.STARTED.getCode()); |
|
|
|
// } |
|
|
|
// } |
|
|
|
// |
|
|
|
// return new ResultData(wxOrderCVo); |
|
|
|
// } |
|
|
|
|
|
|
|
@ApiOperation("订单详情接口") |
|
|
|
@GetMapping("detail_v1") |
|
|
|
@ApiImplicitParams({ |
|
|
|
@ApiImplicitParam(name = "orderId", value = "订单id", dataType = "String", paramType = "query", required = true) |
|
|
|
@ApiImplicitParam(name = "orderId", value = "订单composeOrderId", dataType = "String", paramType = "query", required = true) |
|
|
|
}) |
|
|
|
public ResultData detail_v1(String orderId) { |
|
|
|
if (StringUtils.isBlank(orderId) || orderId.equalsIgnoreCase(Constant.UNDEFINED)) { |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); |
|
|
|
} |
|
|
|
// c端用户应该只能看到自己的订单细节 |
|
|
|
WxOrder wxOrder = new WxOrder(); |
|
|
|
// WxOrder wxOrder = new WxOrder(); |
|
|
|
Long id = 0L; |
|
|
|
try { |
|
|
|
id = Long.valueOf(orderId); |
|
|
|
@@ -292,95 +292,75 @@ public class WxOrderController extends BaseController { |
|
|
|
logger.error("parse orderId failed"); |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "订单ID转换异常:"+orderId); |
|
|
|
} |
|
|
|
wxOrder.setId(id); |
|
|
|
Long memberId; |
|
|
|
try { |
|
|
|
memberId = getMemberId(); |
|
|
|
} catch (Exception e) { |
|
|
|
return new ResultData(Result.ERROR,e.getMessage()); |
|
|
|
} |
|
|
|
wxOrder.setCUserId(memberId); |
|
|
|
wxOrder.updateTenantInfo(getTenantInfo()); |
|
|
|
WxOrderCouponVo wxOrderCVo = wxOrderService.detailCUserVo(wxOrder); |
|
|
|
if (wxOrderCVo == null){ |
|
|
|
wxOrderCVo = new WxOrderCouponVo(); |
|
|
|
wxOrderCVo.setLevel(1); |
|
|
|
|
|
|
|
wxOrder.setComposeOrderId(wxOrder.getId()); |
|
|
|
wxOrder.setId(null); |
|
|
|
List<WxOrderCouponVo> wxOrders = wxOrderService.goodsDetailCUserVo(wxOrder); |
|
|
|
if(wxOrders != null && wxOrders.size() > 0){ |
|
|
|
wxOrderCVo.setOrderCouponVoList(wxOrders); |
|
|
|
|
|
|
|
WxOrderCouponVo wxOrderCouponVo = wxOrders.get(0); |
|
|
|
wxOrderCVo.setComposeOrderType(wxOrderCouponVo.getComposeOrderType()); |
|
|
|
wxOrderCVo.setComposeOrderId(wxOrderCouponVo.getCouponOrderId()); |
|
|
|
wxOrderCVo.setOrderStatus(wxOrderCouponVo.getOrderStatus()); |
|
|
|
wxOrderCVo.setCreateDate(wxOrderCouponVo.getCreateDate()); |
|
|
|
wxOrderCVo.setPayment(wxOrders.stream().mapToInt(o -> o.getPayment()).sum()); |
|
|
|
|
|
|
|
}else{ |
|
|
|
return new ResultData(ErrorCode.ORDER_IS_NOT_FIND); |
|
|
|
} |
|
|
|
}else{ |
|
|
|
wxOrderCVo.setLevel(0); |
|
|
|
WxBatchOrder border = new WxBatchOrder(); |
|
|
|
border.updateTenantInfo(getTenantInfo()); |
|
|
|
border.setId(id); |
|
|
|
border.setCUserId(memberId); |
|
|
|
WxBatchOrder wxBatchOrder = wxOrderService.batchOrderDetail(border); |
|
|
|
if(wxBatchOrder != null){ |
|
|
|
Date now = new Date(); |
|
|
|
if (wxOrderCVo.getValidStartDate() != null && wxOrderCVo.getValidEndDate() != null |
|
|
|
&& !wxOrderCVo.getType().equals(EnumCouponType.COUPON_PREORDER.getCode())) { |
|
|
|
if (wxOrderCVo.getValidStartDate().getTime() > now.getTime()) { |
|
|
|
wxOrderCVo.setValidStatus(EnumCouponOrderValidStatus.PREPARED.getCode()); |
|
|
|
} else if (wxOrderCVo.getValidEndDate().getTime() < now.getTime()) { |
|
|
|
wxOrderCVo.setValidStatus(EnumCouponOrderValidStatus.ENDED.getCode()); |
|
|
|
} else { |
|
|
|
wxOrderCVo.setValidStatus(EnumCouponChannelActivityStatus.STARTED.getCode()); |
|
|
|
for (WxOrderCouponVo ocvo:wxBatchOrder.getOrders()) { |
|
|
|
if (ocvo.getValidStartDate() != null && ocvo.getValidEndDate() != null |
|
|
|
&& !ocvo.getType().equals(EnumCouponType.COUPON_PREORDER.getCode())) { |
|
|
|
if (ocvo.getValidStartDate().getTime() > now.getTime()) { |
|
|
|
ocvo.setValidStatus(EnumCouponOrderValidStatus.PREPARED.getCode()); |
|
|
|
} else if (ocvo.getValidEndDate().getTime() < now.getTime()) { |
|
|
|
ocvo.setValidStatus(EnumCouponOrderValidStatus.ENDED.getCode()); |
|
|
|
} else { |
|
|
|
ocvo.setValidStatus(EnumCouponChannelActivityStatus.STARTED.getCode()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if(wxOrderCVo.getType().equals(EnumCouponType.COUPON_PREORDER.getCode()) |
|
|
|
&& wxOrderCVo.getPickStartDate() != null && wxOrderCVo.getPickEndDate() != null){ |
|
|
|
// wxOrderCVo.setValidStartDate(wxOrderCVo.getPickStartDate()); |
|
|
|
// wxOrderCVo.setValidEndDate(wxOrderCVo.getPickEndDate()); |
|
|
|
if (wxOrderCVo.getPickStartDate().getTime() > now.getTime()) { |
|
|
|
wxOrderCVo.setValidStatus(EnumCouponOrderValidStatus.PREPARED.getCode()); |
|
|
|
} else if (wxOrderCVo.getPickEndDate().getTime() < now.getTime()) { |
|
|
|
wxOrderCVo.setValidStatus(EnumCouponOrderValidStatus.ENDED.getCode()); |
|
|
|
} else { |
|
|
|
wxOrderCVo.setValidStatus(EnumCouponChannelActivityStatus.STARTED.getCode()); |
|
|
|
if(ocvo.getType().equals(EnumCouponType.COUPON_PREORDER.getCode()) |
|
|
|
&& ocvo.getPickStartDate() != null && ocvo.getPickEndDate() != null){ |
|
|
|
if (ocvo.getPickStartDate().getTime() > now.getTime()) { |
|
|
|
ocvo.setValidStatus(EnumCouponOrderValidStatus.PREPARED.getCode()); |
|
|
|
} else if (ocvo.getPickEndDate().getTime() < now.getTime()) { |
|
|
|
ocvo.setValidStatus(EnumCouponOrderValidStatus.ENDED.getCode()); |
|
|
|
} else { |
|
|
|
ocvo.setValidStatus(EnumCouponChannelActivityStatus.STARTED.getCode()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return new ResultData(wxOrderCVo); |
|
|
|
return new ResultData(wxBatchOrder); |
|
|
|
} |
|
|
|
|
|
|
|
@ApiOperation(value = "根据orderId查询接口", notes = "{\"orderId\":\"string\"}") |
|
|
|
@GetMapping("/findById") |
|
|
|
@ApiImplicitParams({ |
|
|
|
@ApiImplicitParam(name = "orderId", value = "订单id", dataType = "String", paramType = "query", required = true) |
|
|
|
}) |
|
|
|
public ResultData findById(String orderId) { |
|
|
|
if (orderId == null || orderId.equalsIgnoreCase(Constant.UNDEFINED)) { |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); |
|
|
|
} |
|
|
|
Long id = 0L; |
|
|
|
try { |
|
|
|
id = Long.valueOf(orderId); |
|
|
|
} catch (NumberFormatException e) { |
|
|
|
logger.error("parse orderId failed"); |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "订单ID转换异常:"+orderId); |
|
|
|
} |
|
|
|
WxOrder order = null; |
|
|
|
try { |
|
|
|
order = wxOrderService.getById(id,getTenantInfo().getTenantId()); |
|
|
|
if (order != null) { |
|
|
|
return new ResultData(Result.SUCCESS, "查询成功", order); |
|
|
|
} else { |
|
|
|
return new ResultData(ErrorCode.ORDER_IS_NOT_FIND); |
|
|
|
} |
|
|
|
} catch (Exception e) { |
|
|
|
logger.error("parse orderId failed"); |
|
|
|
return new ResultData(ErrorCode.DB_FAIL.getCode(), "订单查询未成功,e:" + e.getMessage()); |
|
|
|
} |
|
|
|
} |
|
|
|
// @ApiOperation(value = "根据orderId查询接口", notes = "{\"orderId\":\"string\"}") |
|
|
|
// @GetMapping("/findById") |
|
|
|
// @ApiImplicitParams({ |
|
|
|
// @ApiImplicitParam(name = "orderId", value = "订单id", dataType = "String", paramType = "query", required = true) |
|
|
|
// }) |
|
|
|
// public ResultData findById(String orderId) { |
|
|
|
// if (orderId == null || orderId.equalsIgnoreCase(Constant.UNDEFINED)) { |
|
|
|
// return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); |
|
|
|
// } |
|
|
|
// Long id = 0L; |
|
|
|
// try { |
|
|
|
// id = Long.valueOf(orderId); |
|
|
|
// } catch (NumberFormatException e) { |
|
|
|
// logger.error("parse orderId failed"); |
|
|
|
// return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "订单ID转换异常:"+orderId); |
|
|
|
// } |
|
|
|
// WxOrder order = null; |
|
|
|
// try { |
|
|
|
// order = wxOrderService.getById(id,getTenantInfo().getTenantId()); |
|
|
|
// if (order != null) { |
|
|
|
// return new ResultData(Result.SUCCESS, "查询成功", order); |
|
|
|
// } else { |
|
|
|
// return new ResultData(ErrorCode.ORDER_IS_NOT_FIND); |
|
|
|
// } |
|
|
|
// } catch (Exception e) { |
|
|
|
// logger.error("parse orderId failed"); |
|
|
|
// return new ResultData(ErrorCode.DB_FAIL.getCode(), "订单查询未成功,e:" + e.getMessage()); |
|
|
|
// } |
|
|
|
// } |
|
|
|
|
|
|
|
@ApiOperation(value = "获取未支付订单", notes = "{\"couponId\":\"string\"}") |
|
|
|
@GetMapping("getUnPaidOrder") |
|
|
|
@@ -482,65 +462,65 @@ public class WxOrderController extends BaseController { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ApiOperation("购物车订单详情接口") |
|
|
|
@GetMapping("goodsDetail") |
|
|
|
@ApiImplicitParams({ |
|
|
|
@ApiImplicitParam(name = "orderId", value = "订单id", dataType = "String", paramType = "query", required = true) |
|
|
|
}) |
|
|
|
public ResultData goodsDetail(String mainOrderId) { |
|
|
|
if (StringUtils.isBlank(mainOrderId) || mainOrderId.equalsIgnoreCase(Constant.UNDEFINED)) { |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); |
|
|
|
} |
|
|
|
// c端用户应该只能看到自己的订单细节 |
|
|
|
WxOrder wxOrder = new WxOrder(); |
|
|
|
Long composeOrderId = 0L; |
|
|
|
try { |
|
|
|
composeOrderId = Long.valueOf(mainOrderId); |
|
|
|
} catch (NumberFormatException e) { |
|
|
|
logger.error("parse composeOrderId failed"); |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "订单ID转换异常:"+mainOrderId); |
|
|
|
} |
|
|
|
wxOrder.setComposeOrderId(composeOrderId); |
|
|
|
Long memberId; |
|
|
|
try { |
|
|
|
memberId = getMemberId(); |
|
|
|
} catch (Exception e) { |
|
|
|
return new ResultData(Result.ERROR,e.getMessage()); |
|
|
|
} |
|
|
|
wxOrder.setCUserId(memberId); |
|
|
|
wxOrder.updateTenantInfo(getTenantInfo()); |
|
|
|
List<WxOrderCouponVo> wxOrders = wxOrderService.goodsDetailCUserVo(wxOrder); |
|
|
|
if (wxOrders == null) |
|
|
|
return new ResultData(ErrorCode.ORDER_IS_NOT_FIND); |
|
|
|
|
|
|
|
return new ResultData(wxOrders); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ApiOperation("分页订单列表接口") |
|
|
|
@GetMapping("listGoods") |
|
|
|
@ApiImplicitParams({ |
|
|
|
@ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), |
|
|
|
@ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true), |
|
|
|
}) |
|
|
|
public ResultData listGoods(@ModelAttribute WxOrder wxOrder, Integer pageNum, Integer pageSize) { |
|
|
|
// c端用户应该只能看到自己的订单 |
|
|
|
if (wxOrder == null){ |
|
|
|
wxOrder = new WxOrder(); |
|
|
|
} |
|
|
|
Long memberId; |
|
|
|
try { |
|
|
|
memberId = getMemberId(); |
|
|
|
} catch (Exception e) { |
|
|
|
return new ResultData(Result.ERROR,e.getMessage()); |
|
|
|
} |
|
|
|
wxOrder.setCUserId(memberId); |
|
|
|
wxOrder.setSortColumns(BaseEntity.SortField.UpdateDate_DESC); |
|
|
|
wxOrder.updateTenantInfo(getTenantInfo()); |
|
|
|
final PageInfo<WxOrderCouponVo> page = wxOrderService.listGoodsCAsPage(wxOrder, pageNum, pageSize); |
|
|
|
|
|
|
|
return new ResultData(page); |
|
|
|
} |
|
|
|
// @ApiOperation("购物车订单详情接口") |
|
|
|
// @GetMapping("goodsDetail") |
|
|
|
// @ApiImplicitParams({ |
|
|
|
// @ApiImplicitParam(name = "orderId", value = "订单id", dataType = "String", paramType = "query", required = true) |
|
|
|
// }) |
|
|
|
// public ResultData goodsDetail(String mainOrderId) { |
|
|
|
// if (StringUtils.isBlank(mainOrderId) || mainOrderId.equalsIgnoreCase(Constant.UNDEFINED)) { |
|
|
|
// return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); |
|
|
|
// } |
|
|
|
// // c端用户应该只能看到自己的订单细节 |
|
|
|
// WxOrder wxOrder = new WxOrder(); |
|
|
|
// Long composeOrderId = 0L; |
|
|
|
// try { |
|
|
|
// composeOrderId = Long.valueOf(mainOrderId); |
|
|
|
// } catch (NumberFormatException e) { |
|
|
|
// logger.error("parse composeOrderId failed"); |
|
|
|
// return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "订单ID转换异常:"+mainOrderId); |
|
|
|
// } |
|
|
|
// wxOrder.setComposeOrderId(composeOrderId); |
|
|
|
// Long memberId; |
|
|
|
// try { |
|
|
|
// memberId = getMemberId(); |
|
|
|
// } catch (Exception e) { |
|
|
|
// return new ResultData(Result.ERROR,e.getMessage()); |
|
|
|
// } |
|
|
|
// wxOrder.setCUserId(memberId); |
|
|
|
// wxOrder.updateTenantInfo(getTenantInfo()); |
|
|
|
// List<WxOrderCouponVo> wxOrders = wxOrderService.goodsDetailCUserVo(wxOrder); |
|
|
|
// if (wxOrders == null) |
|
|
|
// return new ResultData(ErrorCode.ORDER_IS_NOT_FIND); |
|
|
|
// |
|
|
|
// return new ResultData(wxOrders); |
|
|
|
// } |
|
|
|
|
|
|
|
|
|
|
|
// @ApiOperation("分页订单列表接口") |
|
|
|
// @GetMapping("listGoods") |
|
|
|
// @ApiImplicitParams({ |
|
|
|
// @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), |
|
|
|
// @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true), |
|
|
|
// }) |
|
|
|
// public ResultData listGoods(@ModelAttribute WxOrder wxOrder, Integer pageNum, Integer pageSize) { |
|
|
|
// // c端用户应该只能看到自己的订单 |
|
|
|
// if (wxOrder == null){ |
|
|
|
// wxOrder = new WxOrder(); |
|
|
|
// } |
|
|
|
// Long memberId; |
|
|
|
// try { |
|
|
|
// memberId = getMemberId(); |
|
|
|
// } catch (Exception e) { |
|
|
|
// return new ResultData(Result.ERROR,e.getMessage()); |
|
|
|
// } |
|
|
|
// wxOrder.setCUserId(memberId); |
|
|
|
// wxOrder.setSortColumns(BaseEntity.SortField.UpdateDate_DESC); |
|
|
|
// wxOrder.updateTenantInfo(getTenantInfo()); |
|
|
|
// final PageInfo<WxOrderCouponVo> page = wxOrderService.listGoodsCAsPage(wxOrder, pageNum, pageSize); |
|
|
|
// |
|
|
|
// return new ResultData(page); |
|
|
|
// } |
|
|
|
|
|
|
|
@ApiOperation("分页订单列表接口") |
|
|
|
@GetMapping("listGoods_v1") |
|
|
|
|