|
|
@ -1,11 +1,15 @@ |
|
|
|
package com.web.controller; |
|
|
|
package com.web.controller; |
|
|
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
|
|
|
|
import com.github.pagehelper.PageHelper; |
|
|
|
|
|
|
|
import com.github.pagehelper.PageInfo; |
|
|
|
import com.hai.common.exception.ErrorCode; |
|
|
|
import com.hai.common.exception.ErrorCode; |
|
|
|
import com.hai.common.exception.ErrorHelp; |
|
|
|
import com.hai.common.exception.ErrorHelp; |
|
|
|
import com.hai.common.exception.SysCode; |
|
|
|
import com.hai.common.exception.SysCode; |
|
|
|
import com.hai.common.security.UserCenter; |
|
|
|
import com.hai.common.security.UserCenter; |
|
|
|
import com.hai.common.utils.ResponseMsgUtil; |
|
|
|
import com.hai.common.utils.ResponseMsgUtil; |
|
|
|
|
|
|
|
import com.hai.entity.HighChildOrder; |
|
|
|
|
|
|
|
import com.hai.entity.HighUser; |
|
|
|
import com.hai.model.HighUserModel; |
|
|
|
import com.hai.model.HighUserModel; |
|
|
|
import com.hai.model.ResponseData; |
|
|
|
import com.hai.model.ResponseData; |
|
|
|
import com.hai.order.model.CreateOrderChildModel; |
|
|
|
import com.hai.order.model.CreateOrderChildModel; |
|
|
@ -13,6 +17,7 @@ import com.hai.order.model.CreateOrderModel; |
|
|
|
import com.hai.order.service.OrderPaySuccessService; |
|
|
|
import com.hai.order.service.OrderPaySuccessService; |
|
|
|
import com.hai.order.service.OrderService; |
|
|
|
import com.hai.order.service.OrderService; |
|
|
|
import com.hai.order.type.OrderChildGoodsType; |
|
|
|
import com.hai.order.type.OrderChildGoodsType; |
|
|
|
|
|
|
|
import com.hai.order.type.OrderChildStatus; |
|
|
|
import com.hai.order.utils.OrderUtil; |
|
|
|
import com.hai.order.utils.OrderUtil; |
|
|
|
import io.swagger.annotations.Api; |
|
|
|
import io.swagger.annotations.Api; |
|
|
|
import io.swagger.annotations.ApiOperation; |
|
|
|
import io.swagger.annotations.ApiOperation; |
|
|
@ -25,6 +30,8 @@ import org.springframework.stereotype.Controller; |
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
import javax.annotation.Resource; |
|
|
|
|
|
|
|
import java.util.HashMap; |
|
|
|
|
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
|
|
|
|
@Controller |
|
|
|
@Controller |
|
|
|
@RequestMapping(value = "") |
|
|
|
@RequestMapping(value = "") |
|
|
@ -128,39 +135,54 @@ public class OrderController { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value="/refund",method = RequestMethod.POST) |
|
|
|
@RequestMapping(value="/refundOrder",method = RequestMethod.POST) |
|
|
|
@ResponseBody |
|
|
|
@ResponseBody |
|
|
|
@ApiOperation(value = "订单退款") |
|
|
|
@ApiOperation(value = "订单退款") |
|
|
|
public ResponseData refund(@RequestBody JSONObject body) { |
|
|
|
public ResponseData refundOrder(@RequestBody JSONObject body) { |
|
|
|
try { |
|
|
|
try { |
|
|
|
if (body == null || StringUtils.isBlank(body.getString("childOrderNo"))) { |
|
|
|
if (body == null || StringUtils.isBlank(body.getString("orderNo"))) { |
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到订单"); |
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到订单"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
orderService.refundOrder(body.getString("orderNo"), body.getString("remarks")); |
|
|
|
|
|
|
|
|
|
|
|
return ResponseMsgUtil.success(null); |
|
|
|
return ResponseMsgUtil.success("退款成功"); |
|
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
} catch (Exception e) { |
|
|
|
log.error("OrderController -> cancel() error!",e); |
|
|
|
log.error("OrderController -> refundOrder() error!",e); |
|
|
|
return ResponseMsgUtil.exception(e); |
|
|
|
return ResponseMsgUtil.exception(e); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
/* |
|
|
|
|
|
|
|
@RequestMapping(value="/paySuccess",method = RequestMethod.POST) |
|
|
|
@RequestMapping(value="/refundOrderChild",method = RequestMethod.POST) |
|
|
|
@ResponseBody |
|
|
|
@ResponseBody |
|
|
|
@ApiOperation(value = "支付成功") |
|
|
|
@ApiOperation(value = "子订单退款") |
|
|
|
public ResponseData paySuccess(@RequestBody JSONObject body) { |
|
|
|
public ResponseData refundOrderChild(@RequestBody JSONObject body) { |
|
|
|
try { |
|
|
|
try { |
|
|
|
if (body == null || StringUtils.isBlank(body.getString("orderNo"))) { |
|
|
|
if (body == null |
|
|
|
|
|
|
|
|| StringUtils.isBlank(body.getString("childOrderNo")) |
|
|
|
|
|
|
|
|| body.getInteger("refundGoodsNum") == null |
|
|
|
|
|
|
|
) { |
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到订单"); |
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到订单"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return ResponseMsgUtil.success(orderService.orderPaySuccessBus(orderService.getOrderDetailByNo(body.getString("orderNo")))); |
|
|
|
// 查询订单编号
|
|
|
|
|
|
|
|
HighChildOrder orderChild = orderService.getChildOrderByNo(body.getString("childOrderNo")); |
|
|
|
|
|
|
|
if (orderChild == null) { |
|
|
|
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到订单编号"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (orderChild.getChildOrderStatus().equals(OrderChildStatus.STATUS2.getNumber()) |
|
|
|
|
|
|
|
|| orderChild.getChildOrderStatus().equals(OrderChildStatus.STATUS3.getNumber())){ |
|
|
|
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "子订单状态错误"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
orderService.refundChildOrder(orderChild.getOrderNo(), body.getString("childOrderNo"), body.getInteger("refundGoodsNum"), body.getString("remarks")); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return ResponseMsgUtil.success("退款成功"); |
|
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
} catch (Exception e) { |
|
|
|
log.error("OrderController -> paySuccess() error!",e); |
|
|
|
log.error("OrderController -> refundOrderChild() error!",e); |
|
|
|
return ResponseMsgUtil.exception(e); |
|
|
|
return ResponseMsgUtil.exception(e); |
|
|
|
} |
|
|
|
} |
|
|
|
}*/ |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value="/getDetailByOrderNo",method = RequestMethod.GET) |
|
|
|
@RequestMapping(value="/getDetailByOrderNo",method = RequestMethod.GET) |
|
|
|
@ResponseBody |
|
|
|
@ResponseBody |
|
|
@ -176,4 +198,50 @@ public class OrderController { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value="/getUserOrderList",method = RequestMethod.GET) |
|
|
|
|
|
|
|
@ResponseBody |
|
|
|
|
|
|
|
@ApiOperation(value = "获取用户订单列表") |
|
|
|
|
|
|
|
public ResponseData getUserOrderList(@RequestParam(name = "orderNo", required = false) String orderNo, |
|
|
|
|
|
|
|
@RequestParam(name = "productType", required = false) Integer productType, |
|
|
|
|
|
|
|
@RequestParam(name = "status", required = false) Integer status, |
|
|
|
|
|
|
|
@RequestParam(name = "pageNum", required = true) Integer pageNum, |
|
|
|
|
|
|
|
@RequestParam(name = "pageSize", required = true) Integer pageSize) { |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
HighUserModel userModel = userCenter.getSessionModel(HighUserModel.class); |
|
|
|
|
|
|
|
if (userModel == null) { |
|
|
|
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.USE_VISIT_ILLEGAL, ""); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Map<String, Object> param = new HashMap<>(); |
|
|
|
|
|
|
|
param.put("orderNo", orderNo); |
|
|
|
|
|
|
|
param.put("productType", productType); |
|
|
|
|
|
|
|
param.put("status", status); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PageHelper.startPage(pageNum, pageSize); |
|
|
|
|
|
|
|
return ResponseMsgUtil.success(new PageInfo<>()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
log.error("OrderController -> getUserOrderList() error!",e); |
|
|
|
|
|
|
|
return ResponseMsgUtil.exception(e); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
|
|
|
|
@RequestMapping(value="/paySuccess",method = RequestMethod.POST) |
|
|
|
|
|
|
|
@ResponseBody |
|
|
|
|
|
|
|
@ApiOperation(value = "支付成功") |
|
|
|
|
|
|
|
public ResponseData paySuccess(@RequestBody JSONObject body) { |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
if (body == null || StringUtils.isBlank(body.getString("orderNo"))) { |
|
|
|
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到订单"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return ResponseMsgUtil.success(orderService.orderPaySuccessBus(orderService.getOrderDetailByNo(body.getString("orderNo")))); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
log.error("OrderController -> paySuccess() error!",e); |
|
|
|
|
|
|
|
return ResponseMsgUtil.exception(e); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}*/ |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|