Commit ceb2132d by wuwenlong

cancel order dev;

parent 87146584
...@@ -14,7 +14,6 @@ import share.common.core.domain.R; ...@@ -14,7 +14,6 @@ import share.common.core.domain.R;
import share.common.core.redis.RedisUtil; import share.common.core.redis.RedisUtil;
import share.common.utils.JsonConvertUtil; import share.common.utils.JsonConvertUtil;
import share.system.domain.SOrder; import share.system.domain.SOrder;
import share.system.domain.vo.MyRecord;
import share.system.request.CreateOrderRequest; import share.system.request.CreateOrderRequest;
import share.system.request.OrderComputedPriceRequest; import share.system.request.OrderComputedPriceRequest;
import share.system.response.ComputedOrderPriceResponse; import share.system.response.ComputedOrderPriceResponse;
...@@ -22,6 +21,8 @@ import share.system.response.OrderPayResultResponse; ...@@ -22,6 +21,8 @@ import share.system.response.OrderPayResultResponse;
import share.system.service.ISOrderService; import share.system.service.ISOrderService;
import share.common.core.page.TableDataInfo; import share.common.core.page.TableDataInfo;
import javax.validation.constraints.NotBlank;
/** /**
* 订单Controller * 订单Controller
* *
...@@ -86,6 +87,15 @@ public class SOrderController extends BaseController ...@@ -86,6 +87,15 @@ public class SOrderController extends BaseController
return R.ok(response); return R.ok(response);
} }
/**
* 取消订单
*/
@ApiOperation(value = "取消订单")
@RequestMapping(value = "/cancel", method = RequestMethod.POST)
public R<Boolean> cancel(@RequestBody @Validated @NotBlank(message = "订单编号不能为空") String orderNo) {
return R.ok(sOrderService.cancel(orderNo));
}
/** /**
* 根据参数计算订单价格 * 根据参数计算订单价格
......
...@@ -5,7 +5,6 @@ import java.util.List; ...@@ -5,7 +5,6 @@ import java.util.List;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import share.system.domain.SOrder; import share.system.domain.SOrder;
import share.system.domain.vo.MyRecord;
import share.system.request.CreateOrderRequest; import share.system.request.CreateOrderRequest;
import share.system.request.OrderComputedPriceRequest; import share.system.request.OrderComputedPriceRequest;
import share.system.request.OrderRefundRequest; import share.system.request.OrderRefundRequest;
...@@ -116,4 +115,11 @@ public interface ISOrderService extends IService<SOrder> ...@@ -116,4 +115,11 @@ public interface ISOrderService extends IService<SOrder>
* @return * @return
*/ */
List<SOrder> validOrder(); List<SOrder> validOrder();
/**
* 取消订单
* @param orderNo
* @return
*/
boolean cancel(String orderNo);
} }
...@@ -163,7 +163,6 @@ public class CallbackServiceImpl implements CallbackService { ...@@ -163,7 +163,6 @@ public class CallbackServiceImpl implements CallbackService {
sb.append("</xml>"); sb.append("</xml>");
return sb.toString(); return sb.toString();
} }
redisUtil.lPush(Constants.ORDER_TASK_PAY_SUCCESS_AFTER, sOrder.getOrderNo());
sb.append("<return_code><![CDATA[SUCCESS]]></return_code>"); sb.append("<return_code><![CDATA[SUCCESS]]></return_code>");
sb.append("<return_msg><![CDATA[OK]]></return_msg>"); sb.append("<return_msg><![CDATA[OK]]></return_msg>");
break; break;
......
...@@ -367,6 +367,18 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper,SOrder> implemen ...@@ -367,6 +367,18 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper,SOrder> implemen
} }
@Override @Override
public boolean cancel(String orderNo) {
SOrder order = getByOrderNo(orderNo);
if(Objects.isNull(order)){
throw new BaseException("订单不存在!");
}
order.setStatus(OrderStatusEnum.CANCEL.getCode());
order.setRefundStatus(RefundStatusEnum.APPLY.getCode());
updateById(order);
return true;
}
@Override
public String openDoor(Long id) { public String openDoor(Long id) {
SOrder sOrder = sOrderMapper.selectSOrderById(id); SOrder sOrder = sOrderMapper.selectSOrderById(id);
if (Objects.isNull(sOrder)) { if (Objects.isNull(sOrder)) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment