From 46911004db60fd0c3ebc131509cd70ffcc5173cc Mon Sep 17 00:00:00 2001 From: Chopper711 Date: Mon, 25 Sep 2023 10:54:47 +0800 Subject: [PATCH 1/2] =?UTF-8?q?refactor:=20=E8=99=9A=E6=8B=9F=E8=AE=A2?= =?UTF-8?q?=E5=8D=95=E5=A2=9E=E5=8A=A0=E5=8F=96=E6=B6=88=E5=88=A4=E5=AE=9A?= =?UTF-8?q?=EF=BC=8C=E8=A7=A3=E5=86=B3=E8=AE=A2=E5=8D=95=E9=80=80=E6=AC=BE?= =?UTF-8?q?=EF=BC=8C=E5=BE=85=E5=AE=A1=E6=A0=B8=E8=AE=A2=E5=8D=95=E7=8A=B6?= =?UTF-8?q?=E6=80=81=E4=B8=8D=E5=8F=98=E7=9A=84=E9=97=AE=E9=A2=98=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../order/order/entity/vo/AllowOperation.java | 12 +++++--- .../order/serviceimpl/OrderServiceImpl.java | 28 ++++++++++++------- 2 files changed, 26 insertions(+), 14 deletions(-) diff --git a/framework/src/main/java/cn/lili/modules/order/order/entity/vo/AllowOperation.java b/framework/src/main/java/cn/lili/modules/order/order/entity/vo/AllowOperation.java index 0db1700c..ecd20b58 100644 --- a/framework/src/main/java/cn/lili/modules/order/order/entity/vo/AllowOperation.java +++ b/framework/src/main/java/cn/lili/modules/order/order/entity/vo/AllowOperation.java @@ -64,7 +64,8 @@ public class AllowOperation implements Serializable { } //新订单 - if (CharSequenceUtil.equalsAny(status, OrderStatusEnum.UNPAID.name(), OrderStatusEnum.PAID.name(), OrderStatusEnum.UNDELIVERED.name(), OrderStatusEnum.STAY_PICKED_UP.name())) { + if (CharSequenceUtil.equalsAny(status, OrderStatusEnum.UNPAID.name(), OrderStatusEnum.PAID.name(), OrderStatusEnum.UNDELIVERED.name(), + OrderStatusEnum.STAY_PICKED_UP.name(), OrderStatusEnum.TAKE.name())) { this.cancel = true; } //新订单,允许支付 @@ -86,7 +87,8 @@ public class AllowOperation implements Serializable { this.showLogistics = order.getDeliverStatus().equals(DeliverStatusEnum.DELIVERED.name()) && status.equals(OrderStatusEnum.DELIVERED.name()); //虚拟订单 或 自提订单可以核销 - this.take = (order.getOrderType().equals(OrderTypeEnum.VIRTUAL.name()) && order.getOrderStatus().equals(OrderStatusEnum.TAKE.name())) || (order.getDeliveryMethod().equals(DeliveryMethodEnum.SELF_PICK_UP.name()) && order.getOrderStatus().equals(OrderStatusEnum.STAY_PICKED_UP.name())); + this.take = + (order.getOrderType().equals(OrderTypeEnum.VIRTUAL.name()) && order.getOrderStatus().equals(OrderStatusEnum.TAKE.name())) || (order.getDeliveryMethod().equals(DeliveryMethodEnum.SELF_PICK_UP.name()) && order.getOrderStatus().equals(OrderStatusEnum.STAY_PICKED_UP.name())); } /** @@ -104,8 +106,10 @@ public class AllowOperation implements Serializable { this.editPrice = true; } - //新订单 - if (CharSequenceUtil.equalsAny(status, OrderStatusEnum.UNPAID.name(), OrderStatusEnum.PAID.name(), OrderStatusEnum.UNDELIVERED.name())) { + //取消判定 + if (CharSequenceUtil.equalsAny(status, OrderStatusEnum.UNPAID.name(), OrderStatusEnum.PAID.name(), OrderStatusEnum.UNDELIVERED.name(), + OrderStatusEnum.STAY_PICKED_UP.name(), + OrderStatusEnum.TAKE.name())) { this.cancel = true; } diff --git a/framework/src/main/java/cn/lili/modules/order/order/serviceimpl/OrderServiceImpl.java b/framework/src/main/java/cn/lili/modules/order/order/serviceimpl/OrderServiceImpl.java index 19c2b285..0db7e654 100644 --- a/framework/src/main/java/cn/lili/modules/order/order/serviceimpl/OrderServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/order/order/serviceimpl/OrderServiceImpl.java @@ -171,7 +171,8 @@ public class OrderServiceImpl extends ServiceImpl implements orders.add(order); String message = "订单[" + item.getSn() + "]创建"; //记录日志 - orderLogs.add(new OrderLog(item.getSn(), UserContext.getCurrentUser().getId(), UserContext.getCurrentUser().getRole().getRole(), UserContext.getCurrentUser().getUsername(), message)); + orderLogs.add(new OrderLog(item.getSn(), UserContext.getCurrentUser().getId(), UserContext.getCurrentUser().getRole().getRole(), + UserContext.getCurrentUser().getUsername(), message)); item.getCheckedSkuList().forEach( sku -> { orderItems.add(new OrderItem(sku, item, tradeDTO)); @@ -260,7 +261,8 @@ public class OrderServiceImpl extends ServiceImpl implements LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); queryWrapper.eq(Order::getOrderPromotionType, PromotionTypeEnum.PINTUAN.name()); queryWrapper.eq(Order::getPromotionId, pintuanId); - queryWrapper.nested(i -> i.eq(Order::getPayStatus, PayStatusEnum.PAID.name()).or(j -> j.eq(Order::getOrderStatus, OrderStatusEnum.PAID.name()))); + queryWrapper.nested(i -> i.eq(Order::getPayStatus, PayStatusEnum.PAID.name()).or(j -> j.eq(Order::getOrderStatus, + OrderStatusEnum.PAID.name()))); return this.list(queryWrapper); } @@ -299,7 +301,8 @@ public class OrderServiceImpl extends ServiceImpl implements OrderStatusEnum.UNDELIVERED.name(), OrderStatusEnum.UNPAID.name(), OrderStatusEnum.STAY_PICKED_UP.name(), - OrderStatusEnum.PAID.name())) { + OrderStatusEnum.PAID.name(), + OrderStatusEnum.TAKE.name())) { order.setOrderStatus(OrderStatusEnum.CANCELLED.name()); order.setCancelReason(reason); @@ -409,7 +412,8 @@ public class OrderServiceImpl extends ServiceImpl implements BeanUtil.copyProperties(memberAddressDTO, order); this.updateById(order); - OrderLog orderLog = new OrderLog(orderSn, UserContext.getCurrentUser().getId(), UserContext.getCurrentUser().getRole().getRole(), UserContext.getCurrentUser().getUsername(), message); + OrderLog orderLog = new OrderLog(orderSn, UserContext.getCurrentUser().getId(), UserContext.getCurrentUser().getRole().getRole(), + UserContext.getCurrentUser().getUsername(), message); orderLogService.save(orderLog); return order; @@ -456,8 +460,8 @@ public class OrderServiceImpl extends ServiceImpl implements public Order shunFengDelivery(String orderSn) { OrderDetailVO orderDetailVO = this.queryDetail(orderSn); String logisticsNo = logisticsService.sfCreateOrder(orderDetailVO); - Logistics logistics = logisticsService.getOne(new LambdaQueryWrapper().eq(Logistics::getCode,"SF")); - return delivery(orderSn,logisticsNo,logistics.getId()); + Logistics logistics = logisticsService.getOne(new LambdaQueryWrapper().eq(Logistics::getCode, "SF")); + return delivery(orderSn, logisticsNo, logistics.getId()); } @Override @@ -474,7 +478,8 @@ public class OrderServiceImpl extends ServiceImpl implements Order order = this.getBySn(orderSn); //获取店家信息 StoreDeliverGoodsAddressDTO storeDeliverGoodsAddressDTO = storeDetailService.getStoreDeliverGoodsAddressDto(order.getStoreId()); - String from = storeDeliverGoodsAddressDTO.getSalesConsignorAddressPath().substring(0, storeDeliverGoodsAddressDTO.getSalesConsignorAddressPath().indexOf(",") - 1); + String from = storeDeliverGoodsAddressDTO.getSalesConsignorAddressPath().substring(0, + storeDeliverGoodsAddressDTO.getSalesConsignorAddressPath().indexOf(",") - 1); String to = order.getConsigneeAddressPath().substring(0, order.getConsigneeAddressPath().indexOf(",") - 1); //获取踪迹信息 return logisticsService.getLogisticMapTrack(order.getLogisticsCode(), order.getLogisticsNo(), order.getConsigneeMobile(), from, to); @@ -582,7 +587,8 @@ public class OrderServiceImpl extends ServiceImpl implements @Override @Transactional(rollbackFor = Exception.class) public void sendUpdateStatusMessage(OrderMessage orderMessage) { - applicationEventPublisher.publishEvent(new TransactionCommitSendMQEvent("发送订单变更mq消息", rocketmqCustomProperties.getOrderTopic(), OrderTagsEnum.STATUS_CHANGE.name(), JSONUtil.toJsonStr(orderMessage))); + applicationEventPublisher.publishEvent(new TransactionCommitSendMQEvent("发送订单变更mq消息", rocketmqCustomProperties.getOrderTopic(), + OrderTagsEnum.STATUS_CHANGE.name(), JSONUtil.toJsonStr(orderMessage))); } @Override @@ -769,7 +775,8 @@ public class OrderServiceImpl extends ServiceImpl implements this.systemCancel(entry.getKey(), reason); } else { for (Order order : entry.getValue()) { - if (!CharSequenceUtil.equalsAny(order.getOrderStatus(), OrderStatusEnum.COMPLETED.name(), OrderStatusEnum.DELIVERED.name(), OrderStatusEnum.TAKE.name(), OrderStatusEnum.STAY_PICKED_UP.name())) { + if (!CharSequenceUtil.equalsAny(order.getOrderStatus(), OrderStatusEnum.COMPLETED.name(), OrderStatusEnum.DELIVERED.name(), + OrderStatusEnum.TAKE.name(), OrderStatusEnum.STAY_PICKED_UP.name())) { this.systemCancel(order.getSn(), reason); } } @@ -816,7 +823,8 @@ public class OrderServiceImpl extends ServiceImpl implements paidOrders.add(order); } for (Order paidOrder : paidOrders) { - if (!CharSequenceUtil.equalsAny(paidOrder.getOrderStatus(), OrderStatusEnum.COMPLETED.name(), OrderStatusEnum.DELIVERED.name(), OrderStatusEnum.TAKE.name(), OrderStatusEnum.STAY_PICKED_UP.name())) { + if (!CharSequenceUtil.equalsAny(paidOrder.getOrderStatus(), OrderStatusEnum.COMPLETED.name(), OrderStatusEnum.DELIVERED.name(), + OrderStatusEnum.TAKE.name(), OrderStatusEnum.STAY_PICKED_UP.name())) { if (OrderTypeEnum.NORMAL.name().equals(paidOrder.getOrderType())) { paidOrder.setOrderStatus(OrderStatusEnum.UNDELIVERED.name()); } else if (OrderTypeEnum.VIRTUAL.name().equals(paidOrder.getOrderType())) { From 01419cde157e99264e5c9f63e52dd171e0dfd0f3 Mon Sep 17 00:00:00 2001 From: Chopper711 Date: Mon, 25 Sep 2023 11:58:08 +0800 Subject: [PATCH 2/2] =?UTF-8?q?refactor:=20=E5=A2=9E=E5=8A=A0=E5=BA=97?= =?UTF-8?q?=E9=93=BA=E8=8F=9C=E5=8D=95=E7=BB=B4=E6=8A=A4=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../StoreMenuManagerController.java | 78 +++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 manager-api/src/main/java/cn/lili/controller/permission/StoreMenuManagerController.java diff --git a/manager-api/src/main/java/cn/lili/controller/permission/StoreMenuManagerController.java b/manager-api/src/main/java/cn/lili/controller/permission/StoreMenuManagerController.java new file mode 100644 index 00000000..5f8ee523 --- /dev/null +++ b/manager-api/src/main/java/cn/lili/controller/permission/StoreMenuManagerController.java @@ -0,0 +1,78 @@ +package cn.lili.controller.permission; + +import cn.lili.common.aop.annotation.DemoSite; +import cn.lili.common.enums.ResultUtil; +import cn.lili.common.vo.ResultMessage; +import cn.lili.modules.member.entity.dos.StoreMenu; +import cn.lili.modules.member.entity.vo.StoreMenuVO; +import cn.lili.modules.member.service.StoreMenuService; +import cn.lili.modules.permission.entity.dos.Menu; +import cn.lili.modules.permission.entity.dto.MenuSearchParams; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + + +/** + * 管理端,菜单管理接口 + * + * @author Chopper + * @since 2020/11/20 12:07 + */ +@Slf4j +@RestController +@Api(tags = "管理端,菜单管理接口") +@RequestMapping("/manager/permission/storeMenu") +public class StoreMenuManagerController { + + @Autowired + private StoreMenuService storeMenuService; + + @ApiOperation(value = "搜索菜单") + @GetMapping + public ResultMessage> searchPermissionList(MenuSearchParams searchParams) { + return ResultUtil.data(storeMenuService.searchList(searchParams)); + } + + @ApiOperation(value = "添加") + @PostMapping + @DemoSite + public ResultMessage add(StoreMenu menu) { + try { + storeMenuService.saveOrUpdateMenu(menu); + } catch (Exception e) { + log.error("添加菜单错误", e); + } + return ResultUtil.data(menu); + } + + @ApiImplicitParam(name = "id", value = "菜单ID", required = true, paramType = "path", dataType = "String") + @ApiOperation(value = "编辑") + @PutMapping(value = "/{id}") + @DemoSite + public ResultMessage edit(@PathVariable String id, StoreMenu menu) { + menu.setId(id); + storeMenuService.saveOrUpdateMenu(menu); + return ResultUtil.data(menu); + } + + @ApiOperation(value = "批量删除") + @DeleteMapping(value = "/{ids}") + @DemoSite + public ResultMessage delByIds(@PathVariable List ids) { + storeMenuService.deleteIds(ids); + return ResultUtil.success(); + } + + @ApiOperation(value = "获取所有菜单") + @GetMapping("/tree") + public ResultMessage> getAllMenuList() { + return ResultUtil.data(storeMenuService.tree()); + } + +}