核销增加分销与积分奖励,后台核销新增rest调用api

This commit is contained in:
hupeng
2020-04-09 13:07:31 +08:00
parent 9432d7ef54
commit 668788bd40
5 changed files with 83 additions and 5 deletions

View File

@ -75,6 +75,8 @@ public interface YxStoreOrderService extends BaseService<YxStoreOrder> {
void takeOrder(String orderId,int uid);
void verificOrder(String orderId);
List<YxStoreOrderQueryVo> orderList(int uid,int type,int page,int limit);
//@WebMethod

View File

@ -592,6 +592,30 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<YxStoreOrderMapper,
}
/**
* 核销订单
* @param orderId
*/
@Override
public void verificOrder(String orderId) {
YxStoreOrderQueryVo order = getOrderInfo(orderId,0);
if(ObjectUtil.isNull(order)) throw new ErrorRequestException("订单不存在");
YxStoreOrder storeOrder = new YxStoreOrder();
storeOrder.setStatus(OrderInfoEnum.STATUS_2.getValue());
storeOrder.setId(order.getId());
yxStoreOrderMapper.updateById(storeOrder);
//增加状态
orderStatusService.create(order.getId(),"user_take_delivery","已核销");
//奖励积分
gainUserIntegral(order);
//分销计算
userService.backOrderBrokerage(order);
}
/**
* 申请退款
* @param param

View File

@ -12,6 +12,7 @@ import cn.hutool.core.io.FileUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.extra.qrcode.QrCodeUtil;
import co.yixiang.annotation.AnonymousAccess;
import co.yixiang.aop.log.Log;
import co.yixiang.common.api.ApiResult;
import co.yixiang.common.web.controller.BaseController;
@ -757,13 +758,43 @@ public class StoreOrderController extends BaseController {
return ApiResult.ok(order);
}
order.setStatus(OrderInfoEnum.STATUS_2.getValue());
storeOrderService.updateById(order);
storeOrderService.verificOrder(order.getOrderId());
return ApiResult.ok("核销成功");
}
/**
* 后台订单核销用于远程调用
*/
@AnonymousAccess
@GetMapping("/order/admin/order_verific/{code}")
public ApiResult<Object> orderAminVerify(@PathVariable String code){
YxStoreOrder storeOrder = new YxStoreOrder();
storeOrder.setVerifyCode(code);
storeOrder.setIsDel(OrderInfoEnum.CANCEL_STATUS_0.getValue());
storeOrder.setPaid(OrderInfoEnum.PAY_STATUS_1.getValue());
storeOrder.setRefundStatus(OrderInfoEnum.REFUND_STATUS_0.getValue());
YxStoreOrder order = storeOrderService.getOne(Wrappers.query(storeOrder));
if(order == null) return ApiResult.fail("核销的订单不存在或未支付或已退款");
if(order.getStatus() > 0) return ApiResult.fail("订单已经核销");
if(order.getCombinationId() > 0 && order.getPinkId() > 0){
YxStorePinkQueryVo storePink = storePinkService.getYxStorePinkById(order.getPinkId());
if(!OrderInfoEnum.PINK_STATUS_2.getValue().equals(storePink.getStatus())){
return ApiResult.fail("拼团订单暂未成功无法核销");
}
}
storeOrderService.verificOrder(order.getOrderId());
return ApiResult.ok("核销成功");
}
}