feat:更改外卖订单状态
This commit is contained in:
1 parent
c439bf4c4c
commit
a0cca668d9
6 files changed
+89
-4
No files matched your search
+6
-1
@@ -9,6 +9,7 @@ import java.util.List;
|
||||
|
||||
/**
|
||||
* 订单状态
|
||||
* 外卖状态 100(待接单(外卖))->110(配送中(外卖))-> 200(已核销(已完成))
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
@@ -18,8 +19,12 @@ public enum HardOrderStatusEnum {
|
||||
PAY("5", "已经支付"),
|
||||
OFFLINE_PAY("6", "没有网络本地支付"),
|
||||
REFUND("10", "退款"),
|
||||
CANCEL("20", "已核销"),
|
||||
CANCEL("20", "已核销(已完成)"),
|
||||
UNFOLLOW("30", "已取消(智能柜)"),
|
||||
|
||||
TAKE_OUT_AWAIT("100", "待接单(外卖)"),
|
||||
TAKE_OUT_ING("110", "配送中(外卖)"),
|
||||
|
||||
;
|
||||
private final String type;
|
||||
private final String description;
|
||||
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
package com.bsd.pjcloud.hard.api.dto.order.remote;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class HardUpdateTakeOutStatusDto {
|
||||
|
||||
@NotNull(message = "订单id不能为空")
|
||||
private Long orderId;
|
||||
|
||||
@NotNull(message = "订单id不能为空")
|
||||
private HardUpdateTakeOutStatusDto.TakeOutStatus status;
|
||||
|
||||
public enum TakeOutStatus {
|
||||
// 配送中
|
||||
TAKE_OUT_ING,
|
||||
// 已完成
|
||||
DONE,
|
||||
// 退款
|
||||
REFUND, CANCEL,
|
||||
}
|
||||
|
||||
}
|
||||
+5
@@ -5,6 +5,7 @@ import com.bsd.pjcloud.common.core.constant.ServiceNameConstants;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.feign.annotation.NoToken;
|
||||
import com.bsd.pjcloud.hard.api.dto.order.HardOrderPreferencesDto;
|
||||
import com.bsd.pjcloud.hard.api.dto.order.remote.HardUpdateTakeOutStatusDto;
|
||||
import com.bsd.pjcloud.hard.api.entity.order.HardOrderEntity;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@@ -27,4 +28,8 @@ public interface RemoteHardOrderService {
|
||||
@NoToken
|
||||
@GetMapping("/hard-order/mch-count-by-id")
|
||||
R<Long> getMchCountById(@RequestParam Long id);
|
||||
|
||||
@NoToken
|
||||
@PostMapping("/hard-order/update-take-out-status")
|
||||
R<Boolean> updateTakeOutStatus(@RequestBody HardUpdateTakeOutStatusDto dto);
|
||||
}
|
||||
+10
-2
@@ -37,6 +37,7 @@ import com.bsd.pjcloud.hard.api.dto.order.act.HardCreateActOrderDto;
|
||||
import com.bsd.pjcloud.hard.api.dto.order.app.HardAppCreateFarmerOrderDto;
|
||||
import com.bsd.pjcloud.hard.api.dto.order.app.HardAppCreateOrderDto;
|
||||
import com.bsd.pjcloud.hard.api.dto.order.app.HardAppCreateTakeOutOrderDto;
|
||||
import com.bsd.pjcloud.hard.api.dto.order.remote.HardUpdateTakeOutStatusDto;
|
||||
import com.bsd.pjcloud.hard.api.entity.order.HardOrderEntity;
|
||||
import com.bsd.pjcloud.hard.api.vo.order.HardOrderVo;
|
||||
import com.bsd.pjcloud.hard.api.vo.order.excel.HardOrderExcelVo;
|
||||
@@ -92,7 +93,7 @@ public class HardOrderController {
|
||||
|
||||
/* ************************************* start 远程调用 start ************************************* */
|
||||
@Inner
|
||||
@Operation(summary = "app查询订单列表", description = "app查询订单列表")
|
||||
@Operation(summary = "查询订单列表", description = "查询订单列表")
|
||||
@GetMapping("/get-by-ids")
|
||||
public R<List<HardOrderEntity>> getByIds(@RequestParam List<Long> ids) {
|
||||
HardOrderDto dto = new HardOrderDto();
|
||||
@@ -101,7 +102,7 @@ public class HardOrderController {
|
||||
}
|
||||
|
||||
@Inner
|
||||
@Operation(summary = "app查询订单列表", description = "app查询订单列表")
|
||||
@Operation(summary = "查询订单", description = "查询订单")
|
||||
@GetMapping("/mch-count-by-id")
|
||||
public R<Long> getMchCountById(@RequestParam Long id) {
|
||||
LambdaQueryWrapper<HardOrderEntity> query = new LambdaQueryWrapper<HardOrderEntity>().eq(HardOrderEntity::getMerchantId, id);
|
||||
@@ -109,6 +110,13 @@ public class HardOrderController {
|
||||
if (ObjectUtil.isEmpty(count)) count = 0L;
|
||||
return R.ok(count);
|
||||
}
|
||||
|
||||
@Inner
|
||||
@Operation(summary = "更改外卖订单状态", description = "更改外卖订单状态")
|
||||
@PostMapping("/update-take-out-status")
|
||||
public R<Boolean> updateTakeOutStatus(@RequestBody HardUpdateTakeOutStatusDto dto) {
|
||||
return R.ok(hardwareOrderService.updateTakeOutStatus(dto));
|
||||
}
|
||||
/* ************************************* end 远程调用 ************************************* */
|
||||
|
||||
/* ************************************* start app start ************************************* */
|
||||
|
||||
+6
@@ -18,6 +18,7 @@ import com.bsd.pjcloud.hard.api.dto.order.HardOrderDto;
|
||||
import com.bsd.pjcloud.hard.api.dto.order.act.HardCreateActOrderDto;
|
||||
import com.bsd.pjcloud.hard.api.dto.order.app.HardAppCreateFarmerOrderDto;
|
||||
import com.bsd.pjcloud.hard.api.dto.order.app.HardAppCreateOrderDto;
|
||||
import com.bsd.pjcloud.hard.api.dto.order.remote.HardUpdateTakeOutStatusDto;
|
||||
import com.bsd.pjcloud.hard.api.dto.order.xfj.HardXfjFastCreateOrderDto;
|
||||
import com.bsd.pjcloud.hard.api.entity.order.HardCarEntity;
|
||||
import com.bsd.pjcloud.hard.api.entity.order.HardOrderEntity;
|
||||
@@ -74,6 +75,11 @@ public interface HardOrderService extends IService<HardOrderEntity> {
|
||||
*/
|
||||
Long appCreateTakeOutOrder(HardAppCreateOrderDto createOrderDto);
|
||||
|
||||
/**
|
||||
* 更改外卖订单状态
|
||||
*/
|
||||
Boolean updateTakeOutStatus(HardUpdateTakeOutStatusDto dto);
|
||||
|
||||
/**
|
||||
* app创建线上超市预定订单
|
||||
*/
|
||||
|
||||
+38
-1
@@ -48,6 +48,7 @@ import com.bsd.pjcloud.hard.api.dto.order.HardOrderDto;
|
||||
import com.bsd.pjcloud.hard.api.dto.order.act.HardCreateActOrderDto;
|
||||
import com.bsd.pjcloud.hard.api.dto.order.app.HardAppCreateFarmerOrderDto;
|
||||
import com.bsd.pjcloud.hard.api.dto.order.app.HardAppCreateOrderDto;
|
||||
import com.bsd.pjcloud.hard.api.dto.order.remote.HardUpdateTakeOutStatusDto;
|
||||
import com.bsd.pjcloud.hard.api.dto.order.xfj.HardXfjFastCreateOrderDto;
|
||||
import com.bsd.pjcloud.hard.api.dto.spu.DeductionSpuStockDto;
|
||||
import com.bsd.pjcloud.hard.api.dto.wechat.WechantReverseDto;
|
||||
@@ -638,7 +639,7 @@ public class HardOrderServiceImpl extends ServiceImpl<HardOrderMapper, HardOrder
|
||||
.userDeptId(userDetail.getSysUser().getDeptId())
|
||||
.parentCarId(dto.getCarParentId())
|
||||
.sysType(dto.getHardType().getType())
|
||||
.orderStatus(HardOrderStatusEnum.CREATE.getType())
|
||||
.orderStatus(HardOrderStatusEnum.TAKE_OUT_AWAIT.getType())
|
||||
.merchantId(parentCar.getMerchantId())
|
||||
.merchantType(hardManager.getTypes())
|
||||
.merchantDeptId(hardManager.getDeptId())
|
||||
@@ -684,6 +685,42 @@ public class HardOrderServiceImpl extends ServiceImpl<HardOrderMapper, HardOrder
|
||||
return orderObj.getId();
|
||||
}
|
||||
|
||||
/**
|
||||
* 更改外卖订单状态
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateTakeOutStatus(HardUpdateTakeOutStatusDto dto) {
|
||||
// 查询订单
|
||||
HardOrderEntity order = baseMapper.selectById(dto.getOrderId());
|
||||
if (ObjectUtil.isEmpty(order)) {
|
||||
throw new RuntimeException("订单不存在");
|
||||
}
|
||||
HardOrderStatusEnum orderStatus = null;
|
||||
switch (dto.getStatus()) {
|
||||
case TAKE_OUT_ING:
|
||||
orderStatus = HardOrderStatusEnum.TAKE_OUT_ING;
|
||||
break;
|
||||
case DONE:
|
||||
orderStatus = HardOrderStatusEnum.CANCEL;
|
||||
break;
|
||||
case CANCEL:
|
||||
orderStatus = HardOrderStatusEnum.REFUND;
|
||||
break;
|
||||
}
|
||||
if (ObjectUtil.isEmpty(orderStatus)) {
|
||||
throw new RuntimeException("订单状态错误");
|
||||
}
|
||||
// 执行退款
|
||||
if (ObjectUtil.equals(orderStatus, HardOrderStatusEnum.REFUND)) {
|
||||
|
||||
}
|
||||
HardOrderEntity updateOrderObj = new HardOrderEntity();
|
||||
updateOrderObj.setId(order.getId());
|
||||
updateOrderObj.setOrderStatus(orderStatus.getType());
|
||||
baseMapper.updateById(updateOrderObj);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* app创建线上超市预定订单
|
||||
*/
|
||||
|
||||
Reference in new issue
Block a user