提交代码

dev-discount
胡锐 2 years ago
parent e06b245562
commit 84c1d6fbe1
  1. 94
      hai-order/src/main/java/com/web/controller/OrderController.java
  2. 2
      hai-service/src/main/java/com/hai/order/service/OrderCreateHandleService.java
  3. 5
      hai-service/src/main/java/com/hai/order/service/OrderService.java
  4. 1
      hai-service/src/main/java/com/hai/order/service/impl/OrderCreateHandleServiceImpl.java
  5. 19
      hai-service/src/main/java/com/hai/order/service/impl/OrderServiceImpl.java

@ -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);
}
}*/
} }

@ -10,7 +10,7 @@ import com.hai.order.model.CreateOrderChildModel;
import java.util.List; import java.util.List;
/** /**
* 创建订单-业务校验 * 创建订单-业务校验组装数据
* @className: CreateOrderCheckService * @className: CreateOrderCheckService
* @author: HuRui * @author: HuRui
* @date: 2022/8/25 * @date: 2022/8/25

@ -74,6 +74,11 @@ public interface OrderService {
*/ */
HighChildOrder getChildOrderByNo(String childOrderNo); HighChildOrder getChildOrderByNo(String childOrderNo);
/**
* 查询订单列表
* @param param 参数
* @return
*/
List<HighOrder> getOrderList(Map<String,Object> param); List<HighOrder> getOrderList(Map<String,Object> param);
} }

@ -261,6 +261,7 @@ public class OrderCreateHandleServiceImpl implements OrderCreateHandleService {
childOrder.setGasStaffId(gasStaff.getId()); childOrder.setGasStaffId(gasStaff.getId());
childOrder.setGasStaffName(gasStaff.getName()); childOrder.setGasStaffName(gasStaff.getName());
}*/ }*/
} }

@ -21,6 +21,7 @@ import com.hai.service.HighDiscountAgentCodeService;
import com.hai.service.HighDiscountUserRelService; import com.hai.service.HighDiscountUserRelService;
import com.hai.service.HighUserPayPasswordService; import com.hai.service.HighUserPayPasswordService;
import com.hai.service.HighUserService; import com.hai.service.HighUserService;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.rocketmq.spring.core.RocketMQTemplate; import org.apache.rocketmq.spring.core.RocketMQTemplate;
import org.springframework.integration.support.MessageBuilder; import org.springframework.integration.support.MessageBuilder;
@ -511,6 +512,22 @@ public class OrderServiceImpl implements OrderService {
@Override @Override
public List<HighOrder> getOrderList(Map<String, Object> param) { public List<HighOrder> getOrderList(Map<String, Object> param) {
return null; HighOrderExample example = new HighOrderExample();
HighOrderExample.Criteria criteria = example.createCriteria();
if (MapUtils.getLong(param, "userId") != null) {
criteria.andMemIdEqualTo(MapUtils.getLong(param, "userId"));
}
if (MapUtils.getInteger(param, "productType") != null) {
criteria.andProductTypeEqualTo(MapUtils.getInteger(param, "productType"));
}
if (MapUtils.getInteger(param, "status") != null) {
criteria.andOrderStatusEqualTo(MapUtils.getInteger(param, "status"));
}
example.setOrderByClause("createTime desc");
return orderMapper.selectByExample(example);
} }
} }

Loading…
Cancel
Save