From 83f424b80f48e9433efc8abccde9986c653dd9d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A8=8B=E5=BA=8F=E5=91=98=E5=B0=8F=E5=A2=A8?= <2291200076@qq.com> Date: Sun, 23 Apr 2023 00:52:43 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=8E=E5=8F=B0=E7=AE=A1=E7=90=86=20->=20?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E7=AE=A1=E7=90=86=E5=AE=8C=E6=88=90=EF=BC=9B?= =?UTF-8?q?nginx=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6=E9=99=90=E5=88=B6ip?= =?UTF-8?q?=E5=B9=B6=E5=8F=91=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 7 + .../epp/common/enums/OrderStatus.java | 2 +- .../com/cxyxiaomo/epp/common/pojo/Good.java | 4 +- .../epp/common/pojo/GoodCategory.java | 4 +- .../com/cxyxiaomo/epp/common/pojo/Order.java | 3 +- .../epp/common/pojo/OrderDetail.java | 4 +- .../epp/common/query/OrderQuery.java | 18 + .../com/cxyxiaomo/epp/common/vo/OrderVO.java | 6 +- .../epp/shop/controller/OrderController.java | 309 +++++++++++++++++- .../com/cxyxiaomo/epp/shop/dao/GoodDao.java | 8 +- .../com/cxyxiaomo/epp/shop/dao/OrderDao.java | 16 +- .../epp/shop/service/OrderService.java | 12 + .../resources/mybatis/mapper/OrderMapper.xml | 37 ++- frontend/components.d.ts | 1 + frontend/src/api/shop-order.js | 64 ++++ frontend/src/components/manage-list.vue | 39 ++- frontend/src/components/sidebar.vue | 5 + frontend/src/router/index.ts | 9 + frontend/src/store/permiss.ts | 2 + frontend/src/views/shop-order-setting.vue | 165 ++++++++++ nginx-conf/nginx.conf | 7 + weixin-miniprogram/pages/shop/myOrder.js | 4 +- weixin-miniprogram/pages/shop/orderDetail.js | 2 +- 23 files changed, 696 insertions(+), 32 deletions(-) create mode 100644 backend/microservice-common/src/main/java/com/cxyxiaomo/epp/common/query/OrderQuery.java create mode 100644 frontend/src/api/shop-order.js create mode 100644 frontend/src/views/shop-order-setting.vue diff --git a/README.md b/README.md index d12c5ef..a812447 100644 --- a/README.md +++ b/README.md @@ -424,6 +424,13 @@ server listen 80; listen 443 ssl http2; + # 并发限制 限制当前站点最大并发数 + limit_conn perserver 50; + # 单IP限制 限制单个IP访问最大并发数 + limit_conn perip 10; + # 流量限制 限制每个请求的流量上限(单位:KB) + limit_rate 8192k; + # 核心配置 location / { proxy_pass http://127.0.0.1:5203; # ⚠ Gateway 微服务项目本地运行的端口 diff --git a/backend/microservice-common/src/main/java/com/cxyxiaomo/epp/common/enums/OrderStatus.java b/backend/microservice-common/src/main/java/com/cxyxiaomo/epp/common/enums/OrderStatus.java index e9751b1..3606ef2 100644 --- a/backend/microservice-common/src/main/java/com/cxyxiaomo/epp/common/enums/OrderStatus.java +++ b/backend/microservice-common/src/main/java/com/cxyxiaomo/epp/common/enums/OrderStatus.java @@ -4,7 +4,7 @@ import java.util.Arrays; import java.util.Optional; public enum OrderStatus { - PENDING("Pending", "等待确认"), + PENDING("Pending", "等待支付"), PROCESSING("Processing", "已支付,等待发货中"), SHIPPED("Shipped", "已发货,等待确认收货"), DELIVERED("Delivered", "已送达"), diff --git a/backend/microservice-common/src/main/java/com/cxyxiaomo/epp/common/pojo/Good.java b/backend/microservice-common/src/main/java/com/cxyxiaomo/epp/common/pojo/Good.java index 9362289..747109b 100644 --- a/backend/microservice-common/src/main/java/com/cxyxiaomo/epp/common/pojo/Good.java +++ b/backend/microservice-common/src/main/java/com/cxyxiaomo/epp/common/pojo/Good.java @@ -4,10 +4,12 @@ import lombok.Data; import lombok.NoArgsConstructor; import lombok.experimental.Accessors; +import java.io.Serializable; + @Data @NoArgsConstructor @Accessors(chain = true) // 链式写法 -public class Good { +public class Good implements Serializable { Long id; String goodsName; Integer categoryId; diff --git a/backend/microservice-common/src/main/java/com/cxyxiaomo/epp/common/pojo/GoodCategory.java b/backend/microservice-common/src/main/java/com/cxyxiaomo/epp/common/pojo/GoodCategory.java index a826fc9..593bf97 100644 --- a/backend/microservice-common/src/main/java/com/cxyxiaomo/epp/common/pojo/GoodCategory.java +++ b/backend/microservice-common/src/main/java/com/cxyxiaomo/epp/common/pojo/GoodCategory.java @@ -4,10 +4,12 @@ import lombok.Data; import lombok.NoArgsConstructor; import lombok.experimental.Accessors; +import java.io.Serializable; + @Data @NoArgsConstructor @Accessors(chain = true) // 链式写法 -public class GoodCategory { +public class GoodCategory implements Serializable { Long id; String categoryName; Integer order; diff --git a/backend/microservice-common/src/main/java/com/cxyxiaomo/epp/common/pojo/Order.java b/backend/microservice-common/src/main/java/com/cxyxiaomo/epp/common/pojo/Order.java index 3d78e52..7c44535 100644 --- a/backend/microservice-common/src/main/java/com/cxyxiaomo/epp/common/pojo/Order.java +++ b/backend/microservice-common/src/main/java/com/cxyxiaomo/epp/common/pojo/Order.java @@ -4,13 +4,14 @@ import lombok.Data; import lombok.NoArgsConstructor; import lombok.experimental.Accessors; +import java.io.Serializable; import java.math.BigDecimal; import java.time.LocalDateTime; @Data @NoArgsConstructor @Accessors(chain = true) // 链式写法 -public class Order { +public class Order implements Serializable { private Long id; private Integer userId; private LocalDateTime orderDate; diff --git a/backend/microservice-common/src/main/java/com/cxyxiaomo/epp/common/pojo/OrderDetail.java b/backend/microservice-common/src/main/java/com/cxyxiaomo/epp/common/pojo/OrderDetail.java index 4dac6ac..a2d1a77 100644 --- a/backend/microservice-common/src/main/java/com/cxyxiaomo/epp/common/pojo/OrderDetail.java +++ b/backend/microservice-common/src/main/java/com/cxyxiaomo/epp/common/pojo/OrderDetail.java @@ -4,10 +4,12 @@ import lombok.Data; import lombok.NoArgsConstructor; import lombok.experimental.Accessors; +import java.io.Serializable; + @Data @NoArgsConstructor @Accessors(chain = true) // 链式写法 -public class OrderDetail { +public class OrderDetail implements Serializable { private Long id; private Long orderId; private Long goodId; diff --git a/backend/microservice-common/src/main/java/com/cxyxiaomo/epp/common/query/OrderQuery.java b/backend/microservice-common/src/main/java/com/cxyxiaomo/epp/common/query/OrderQuery.java new file mode 100644 index 0000000..9d84970 --- /dev/null +++ b/backend/microservice-common/src/main/java/com/cxyxiaomo/epp/common/query/OrderQuery.java @@ -0,0 +1,18 @@ +package com.cxyxiaomo.epp.common.query; + +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.Accessors; + +import java.io.Serializable; + +@Data +@NoArgsConstructor +@Accessors(chain = true) // 链式写法 +// 微服务必须要实现Serializable +public class OrderQuery implements Serializable { + private Long id; + private Integer userId; + private String orderStatusCode; + private String expressId; +} diff --git a/backend/microservice-common/src/main/java/com/cxyxiaomo/epp/common/vo/OrderVO.java b/backend/microservice-common/src/main/java/com/cxyxiaomo/epp/common/vo/OrderVO.java index b2bc585..c68d983 100644 --- a/backend/microservice-common/src/main/java/com/cxyxiaomo/epp/common/vo/OrderVO.java +++ b/backend/microservice-common/src/main/java/com/cxyxiaomo/epp/common/vo/OrderVO.java @@ -9,7 +9,6 @@ import org.springframework.beans.BeanUtils; import java.io.Serializable; import java.math.RoundingMode; -import java.time.LocalDateTime; import java.util.List; import java.util.stream.Collectors; @@ -22,10 +21,10 @@ import java.util.stream.Collectors; public class OrderVO implements Serializable { private String id; private Integer userId; - private LocalDateTime orderDate; private String orderStatus; private String orderStatusCode; private String orderPrice; + private String orderDate; private String payDate; private String cancelDate; private String shipDate; @@ -47,6 +46,9 @@ public class OrderVO implements Serializable { String price = order.getOrderPrice().setScale(2, RoundingMode.FLOOR).toPlainString(); orderVO.setOrderPrice(price); + if (order.getOrderDate() != null) { + orderVO.setOrderDate(order.getOrderDate().toString().replace("T", " ")); + } if (order.getPayDate() != null) { orderVO.setPayDate(order.getPayDate().toString().replace("T", " ")); } diff --git a/backend/microservice-provider-shop-8003/src/main/java/com/cxyxiaomo/epp/shop/controller/OrderController.java b/backend/microservice-provider-shop-8003/src/main/java/com/cxyxiaomo/epp/shop/controller/OrderController.java index 4af3a5d..b73b860 100644 --- a/backend/microservice-provider-shop-8003/src/main/java/com/cxyxiaomo/epp/shop/controller/OrderController.java +++ b/backend/microservice-provider-shop-8003/src/main/java/com/cxyxiaomo/epp/shop/controller/OrderController.java @@ -2,18 +2,31 @@ package com.cxyxiaomo.epp.shop.controller; import com.alibaba.fastjson2.JSONArray; import com.alibaba.fastjson2.JSONObject; +import com.cxyxiaomo.epp.PageTable.enums.AddType; +import com.cxyxiaomo.epp.PageTable.enums.EditType; +import com.cxyxiaomo.epp.PageTable.enums.FieldType; +import com.cxyxiaomo.epp.PageTable.enums.SearchType; +import com.cxyxiaomo.epp.PageTable.query.PageQuery; +import com.cxyxiaomo.epp.PageTable.utils.FieldBuilder; +import com.cxyxiaomo.epp.PageTable.utils.FieldMapperBuilder; +import com.cxyxiaomo.epp.PageTable.utils.FieldRuleBuilder; +import com.cxyxiaomo.epp.PageTable.utils.FieldRuleListBuilder; import com.cxyxiaomo.epp.common.enums.OrderStatus; import com.cxyxiaomo.epp.common.pojo.Order; import com.cxyxiaomo.epp.common.pojo.OrderDetail; +import com.cxyxiaomo.epp.common.query.OrderQuery; import com.cxyxiaomo.epp.common.response.Res; import com.cxyxiaomo.epp.common.vo.GoodVO; import com.cxyxiaomo.epp.common.vo.OrderDetailVO; import com.cxyxiaomo.epp.common.vo.OrderVO; import com.cxyxiaomo.epp.shop.service.GoodService; import com.cxyxiaomo.epp.shop.service.OrderService; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; +import java.text.SimpleDateFormat; import java.util.*; import java.util.stream.Collectors; @@ -30,8 +43,8 @@ public class OrderController { /** * 小程序端创建订单 * - * @param userId 下单用户 - * @param orderList 下单商品 [ { goodId, count }, ... ] + * @param params userId 下单用户 + * @param params orderList 下单商品 [ { goodId, count }, ... ] * @return */ @PostMapping("/miniprogram/createOrder") @@ -184,6 +197,12 @@ public class OrderController { return Res.success(success ? "支付成功" : "支付失败"); } + /** + * 用户取消订单 + * + * @param params + * @return + */ @PostMapping("/miniprogram/cancelOrder") @ResponseBody public Res cancelOrder(@RequestBody JSONObject params) { @@ -224,6 +243,107 @@ public class OrderController { return Res.success(success ? "取消成功" : "取消失败"); } + /** + * 订单发货 + * + * @param orderId + * @param expressId + * @param comment + * @return + */ + @PostMapping("/manage/deliverOrder") + @ResponseBody + public Res deliverOrder(Long orderId, String expressId, String comment) { + if (orderId == null || expressId == null || comment == null) { + return Res.error("参数错误"); + } + + if (expressId.equals("") && comment.equals("")) { + return Res.error("运单号 和 发货备注 不可同时为空"); + } + + // 查询订单详情 + Order order = orderService.getOrderById(orderId); + if (order == null) { + return Res.error("订单不存在"); + } + + //判断是否可以发货 + OrderStatus orderStatus = OrderStatus.get(order.getOrderStatus()); + switch (orderStatus) { + case PENDING: + return Res.error("订单尚未支付,不可发货"); + case PROCESSING: // 订单未发货 + // 更新订单发货信息 + orderService.updateOrderShipInfo(orderId, expressId, comment); + // 更新支付信息 + orderService.updateOrderStatus(orderId, OrderStatus.SHIPPED); + return Res.success("发货成功"); + case SHIPPED: // 订单已发货,修改发货信息 + // 更新订单发货信息 + orderService.updateOrderShipInfo(orderId, expressId, comment); + return Res.success("发货信息修改成功"); + case DELIVERED: + return Res.error("订单已完成,无法再次发货"); + case CANCELLED: + return Res.error("订单已取消,不可发货"); + default: + return Res.error("当前订单状态不可发货"); + } + } + + /** + * 管理员取消订单 + * + * @param params + * @return + */ + @PostMapping("/manage/cancelOrder") + @ResponseBody + public Res cancelOrderByManager(@RequestBody JSONObject params) { + Long orderId = params.getLong("orderId"); + if (orderId == null) { + return Res.error("参数错误"); + } + + // 查询订单详情 + Order order = orderService.getOrderById(orderId); + if (order == null) { + return Res.error("订单不存在"); + } + + //判断是否可以取消 + OrderStatus orderStatus = OrderStatus.get(order.getOrderStatus()); + switch (orderStatus) { + case PENDING: + // 更新订单发货信息 + orderService.updateOrderShipInfo(orderId, "", "管理员取消了您的订单,如有疑问请联系管理员"); + // 更新支付信息 + orderService.updateOrderStatus(orderId, OrderStatus.CANCELLED); + return Res.success("操作成功"); + case PROCESSING: + // 更新订单发货信息 + orderService.updateOrderShipInfo(orderId, "", "管理员取消了您的订单,费用已退回至您的帐户,如有疑问请联系管理员"); + // 更新支付信息 + orderService.updateOrderStatus(orderId, OrderStatus.CANCELLED); + return Res.success("操作成功"); + case SHIPPED: + return Res.error("订单已发货,不可取消"); + case DELIVERED: + return Res.error("订单已送达,不可取消"); + case CANCELLED: + return Res.error("订单已取消"); + default: + return Res.error("当前订单状态无法取消"); + } + } + + /** + * 订单确认收货 + * + * @param params + * @return + */ @PostMapping("/miniprogram/confirmOrder") @ResponseBody public Res confirmOrder(@RequestBody JSONObject params) { @@ -261,4 +381,189 @@ public class OrderController { return Res.success(success ? "确认收货成功" : "确认收货失败"); } + + + /** + * 获取订单列表 + * + * @return + */ + @GetMapping("/manage/getOrderList") + @ResponseBody + public Res getOrderList(PageQuery pageQuery, OrderQuery orderQuery) { + // 查询分页数据 + PageHelper.startPage(pageQuery.getPageIndex(), pageQuery.getPageSize()); + List orderList = orderService.getOrderList(orderQuery); + PageInfo orderPageInfo = new PageInfo<>(orderList); + List list = orderPageInfo.getList(); + List voList = OrderVO.convertFrom(list); + + // id列 字段名(区分大小写;以VO中的变量名为准) + // 新增、修改弹窗时,使用该列作为主键列进行操作 + String idFieldName = "id"; + + // 当前管理页面 + String pageName = "订单管理"; + + // 指定前端表格显示列 + JSONArray columns = FieldBuilder.create() + .add("userId", "userId", "用户ID", "", + FieldType.TEXT, SearchType.INPUT, AddType.CAN_NOT_ADD, EditType.CAN_NOT_EDIT, + FieldBuilder.SEARCH_PLACEHOLDER_SAME_AS_FIELDNAME, + null, null, null, null + ) + .add("orderStatusCode", "orderStatusName", "订单状态", true, + FieldType.TEXT, SearchType.SELECT, AddType.CAN_NOT_ADD, EditType.SELECT, + FieldBuilder.SEARCH_PLACEHOLDER_SAME_AS_FIELDNAME, + null, "订单状态", + FieldRuleListBuilder.create() + .add(FieldRuleBuilder.create("订单状态").required()), + null + ) + .add("orderPrice", "orderPrice", "订单价格", "", + FieldType.TEXT, SearchType.CAN_NOT_SEARCH, AddType.CAN_NOT_ADD, EditType.CAN_NOT_EDIT, + FieldBuilder.SEARCH_PLACEHOLDER_SAME_AS_FIELDNAME, + null, null, null, null + ) + .add("orderDate", "orderDate", "下单时间", "", + FieldType.TEXT, SearchType.CAN_NOT_SEARCH, AddType.CAN_NOT_ADD, EditType.CAN_NOT_EDIT, + FieldBuilder.SEARCH_PLACEHOLDER_SAME_AS_FIELDNAME, + null, null, null, null + ) + .add("payDate", "payDate", "支付时间", "", + FieldType.TEXT, SearchType.CAN_NOT_SEARCH, AddType.CAN_NOT_ADD, EditType.CAN_NOT_EDIT, + FieldBuilder.SEARCH_PLACEHOLDER_SAME_AS_FIELDNAME, + null, null, null, null + ) + .add("cancelDate", "cancelDate", "取消时间", "", + FieldType.TEXT, SearchType.CAN_NOT_SEARCH, AddType.CAN_NOT_ADD, EditType.CAN_NOT_EDIT, + FieldBuilder.SEARCH_PLACEHOLDER_SAME_AS_FIELDNAME, + null, null, null, null + ) + .add("shipDate", "shipDate", "发货时间", "", + FieldType.TEXT, SearchType.CAN_NOT_SEARCH, AddType.CAN_NOT_ADD, EditType.CAN_NOT_EDIT, + FieldBuilder.SEARCH_PLACEHOLDER_SAME_AS_FIELDNAME, + null, null, null, null + ) + .add("deliverDate", "deliverDate", "送达时间", "", + FieldType.TEXT, SearchType.CAN_NOT_SEARCH, AddType.CAN_NOT_ADD, EditType.CAN_NOT_EDIT, + FieldBuilder.SEARCH_PLACEHOLDER_SAME_AS_FIELDNAME, + null, null, null, null + ) + .add("expressId", "expressId", "运单号", "", + FieldType.TEXT, SearchType.INPUT, AddType.CAN_NOT_ADD, EditType.CAN_NOT_EDIT, + FieldBuilder.SEARCH_PLACEHOLDER_SAME_AS_FIELDNAME, + null, null, null, null + ) + .add("comment", "comment", "发货备注", "", + FieldType.LONG_TEXT, SearchType.CAN_NOT_SEARCH, AddType.CAN_NOT_ADD, EditType.CAN_NOT_EDIT, + FieldBuilder.SEARCH_PLACEHOLDER_SAME_AS_FIELDNAME, + null, null, null, null + ) + .build(); + + // 指定需要翻译的字段 + OrderStatus[] orderStatusList = OrderStatus.values(); + HashMap orderStatusMap = new HashMap<>(orderStatusList.length); + for (OrderStatus orderStatus : orderStatusList) { + orderStatusMap.put(orderStatus.getValue(), orderStatus.toString()); + } + // build + JSONArray fieldMapper = FieldMapperBuilder.create() + .add("orderStatusCode", "orderStatusName", orderStatusMap) + .build(); + + // 拼装返回结果 + JSONObject map = new JSONObject(6); + map.put("total", orderPageInfo.getTotal()); + map.put("list", voList); + map.put("columns", columns); + map.put("fieldMapper", fieldMapper); + map.put("idFieldName", idFieldName); + map.put("pageName", pageName); + + // 返回结果 + return Res.success(map); + } + + // /** + // * 编辑订单 + // * + // * @return + // */ + // @PostMapping("/manage/editOrder") + // @ResponseBody + // public Res editOrder(@ModelAttribute OrderVO OrderVO) { + // Order Order = OrderVO.convertTo(OrderVO); + // + // // 先查询订单是否存在 + // Order existOrder = orderService.getOrderById(Order.getId()); + // + // if (Order.getId() == null || Order.getId() < 1) { + // // 新增订单 + // if (existOrder != null) { + // return Res.error("订单已存在,操作失败"); + // } + // + // if (Order.getOrdersName() == null || "".equals(Order.getOrdersName())) { + // return Res.error("订单名称不能为空"); + // } + // Order.setId(null); + // orderService.addOrder(Order); + // } else { + // // 修改订单 + // if (existOrder == null) { + // return Res.error("订单不存在,操作失败"); + // } + // + // orderService.updateOrder(Order); + // } + // return Res.success(true); + // } + // + // /** + // * 关闭订单 + // * + // * @param id + // * @return + // */ + // @PostMapping("/manage/deleteOrder") + // @ResponseBody + // public Res deleteOrder(Long id) { + // if (id == null || id <= 0) { + // return Res.error("订单不存在,删除失败"); + // } + // // 先查询订单是否存在 + // Order existOrder = orderService.getOrderById(id); + // if (existOrder == null) { + // return Res.error("订单不存在,删除失败"); + // } + // boolean b = orderService.deleteOrder(existOrder.getId()); + // return Res.success(b); + // } + + /** + * 导出订单列表 + * + * @return + */ + @GetMapping("/manage/exportOrderList") + @ResponseBody + public Res exportOrderList(OrderQuery orderQuery) { + List orderList = orderService.getOrderList(orderQuery); + List orderVOList = OrderVO.convertFrom(orderList); + + // 当前时间 + Date now = Calendar.getInstance().getTime(); + SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd_HHmmss"); + String dateTime = format.format(now); + + HashMap map = new HashMap<>(); + map.put("list", orderVOList); + map.put("sheetName", "订单表-" + System.currentTimeMillis()); + map.put("fileName", "订单表_导出时间_" + dateTime); + + return Res.success(map); + } + } diff --git a/backend/microservice-provider-shop-8003/src/main/java/com/cxyxiaomo/epp/shop/dao/GoodDao.java b/backend/microservice-provider-shop-8003/src/main/java/com/cxyxiaomo/epp/shop/dao/GoodDao.java index bed9c63..2386525 100644 --- a/backend/microservice-provider-shop-8003/src/main/java/com/cxyxiaomo/epp/shop/dao/GoodDao.java +++ b/backend/microservice-provider-shop-8003/src/main/java/com/cxyxiaomo/epp/shop/dao/GoodDao.java @@ -27,13 +27,7 @@ public interface GoodDao { Integer deleteById(Integer id); - - - - - - - + // Manage public boolean addGood(Good good); public boolean updateGood(Good good); diff --git a/backend/microservice-provider-shop-8003/src/main/java/com/cxyxiaomo/epp/shop/dao/OrderDao.java b/backend/microservice-provider-shop-8003/src/main/java/com/cxyxiaomo/epp/shop/dao/OrderDao.java index 37ef678..f3b010f 100644 --- a/backend/microservice-provider-shop-8003/src/main/java/com/cxyxiaomo/epp/shop/dao/OrderDao.java +++ b/backend/microservice-provider-shop-8003/src/main/java/com/cxyxiaomo/epp/shop/dao/OrderDao.java @@ -2,6 +2,7 @@ package com.cxyxiaomo.epp.shop.dao; import com.cxyxiaomo.epp.common.pojo.Order; import com.cxyxiaomo.epp.common.pojo.OrderDetail; +import com.cxyxiaomo.epp.common.query.OrderQuery; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; import org.springframework.stereotype.Repository; @@ -62,6 +63,19 @@ public interface OrderDao { */ int updateOrderStatus(@Param("orderId") Long orderId, @Param("orderStatus") String orderStatus); + /** + * 更新订单发货信息 + * + * @param orderId + * @param expressId + * @param comment + * @return + */ + int updateOrderShipInfo(@Param("orderId") Long orderId, @Param("expressId") String expressId, @Param("comment") String comment); + // 根据订单 ID 删除订单信息及订单详情信息 - int deleteOrderById(Long orderId); + boolean deleteOrderById(Long orderId); + + + public List getOrderList(OrderQuery orderQuery); } diff --git a/backend/microservice-provider-shop-8003/src/main/java/com/cxyxiaomo/epp/shop/service/OrderService.java b/backend/microservice-provider-shop-8003/src/main/java/com/cxyxiaomo/epp/shop/service/OrderService.java index dd7c495..d98f879 100644 --- a/backend/microservice-provider-shop-8003/src/main/java/com/cxyxiaomo/epp/shop/service/OrderService.java +++ b/backend/microservice-provider-shop-8003/src/main/java/com/cxyxiaomo/epp/shop/service/OrderService.java @@ -4,6 +4,7 @@ import com.cxyxiaomo.epp.common.enums.OrderStatus; import com.cxyxiaomo.epp.common.pojo.Good; import com.cxyxiaomo.epp.common.pojo.Order; import com.cxyxiaomo.epp.common.pojo.OrderDetail; +import com.cxyxiaomo.epp.common.query.OrderQuery; import com.cxyxiaomo.epp.common.utils.SnowflakeManager; import com.cxyxiaomo.epp.common.vo.OrderDetailVO; import com.cxyxiaomo.epp.shop.dao.GoodDao; @@ -132,4 +133,15 @@ public class OrderService { int affectRows = orderDao.updateOrderStatus(orderId, orderStatus.getValue()); return affectRows > 0; } + + public Boolean updateOrderShipInfo(Long orderId, String expressId, String comment) { + int affectRows = orderDao.updateOrderShipInfo(orderId, expressId, comment); + return affectRows > 0; + } + + + public List getOrderList(OrderQuery orderQuery) { + return orderDao.getOrderList(orderQuery); + } + } diff --git a/backend/microservice-provider-shop-8003/src/main/resources/mybatis/mapper/OrderMapper.xml b/backend/microservice-provider-shop-8003/src/main/resources/mybatis/mapper/OrderMapper.xml index 902e6ba..c8d8e96 100644 --- a/backend/microservice-provider-shop-8003/src/main/resources/mybatis/mapper/OrderMapper.xml +++ b/backend/microservice-provider-shop-8003/src/main/resources/mybatis/mapper/OrderMapper.xml @@ -95,7 +95,7 @@ - + DELETE FROM `order` WHERE id = #{orderId}; @@ -104,4 +104,39 @@ -- FROM goods_order_details -- WHERE order_id = #{orderId}; + + + + + + + + UPDATE `order` + + + express_id = #{expressId}, + + + `comment` = #{comment}, + + + WHERE id = #{orderId} + diff --git a/frontend/components.d.ts b/frontend/components.d.ts index 2157dac..596831f 100644 --- a/frontend/components.d.ts +++ b/frontend/components.d.ts @@ -35,6 +35,7 @@ declare module '@vue/runtime-core' { ElSubMenu: typeof import('element-plus/es')['ElSubMenu'] ElTable: typeof import('element-plus/es')['ElTable'] ElTableColumn: typeof import('element-plus/es')['ElTableColumn'] + ElTag: typeof import('element-plus/es')['ElTag'] ElTooltip: typeof import('element-plus/es')['ElTooltip'] ElUpload: typeof import('element-plus/es')['ElUpload'] Header: typeof import('./src/components/header.vue')['default'] diff --git a/frontend/src/api/shop-order.js b/frontend/src/api/shop-order.js new file mode 100644 index 0000000..975025c --- /dev/null +++ b/frontend/src/api/shop-order.js @@ -0,0 +1,64 @@ +import send_request from '../utils/send_request'; + +/** + * 获取订单列表 + * @returns + */ +export function getOrderList(params) { + return send_request({ + url: '/shop/order/manage/getOrderList', + method: 'GET', + params: params, + }); +}; + +/** + * 获取订单详情 + * @returns + */ +export function getOrderDetail(params) { + return send_request({ + url: '/shop/order/miniprogram/orderDetail', + method: 'GET', + params: params, + }); +}; + +/** + * 订单发货 + * @returns + */ +export function deliverOrder(params) { + console.log("params", params) + return send_request({ + url: '/shop/order/manage/deliverOrder', + method: 'POST', + useQS: true, + params: params, + }); +}; + +/** + * 关闭订单 + * @returns + */ +export function cancelOrder(params) { + return send_request({ + url: '/shop/order/manage/cancelOrder', + method: 'POST', + useQS: true, + params: params, + }); +}; + +/** + * 导出订单列表 + * @returns + */ +export function exportOrderList(params) { + return send_request({ + url: '/shop/order/manage/exportOrderList', + method: 'GET', + params: params, + }); +}; diff --git a/frontend/src/components/manage-list.vue b/frontend/src/components/manage-list.vue index 88b46de..c77e8b4 100644 --- a/frontend/src/components/manage-list.vue +++ b/frontend/src/components/manage-list.vue @@ -56,16 +56,27 @@ - + @@ -141,7 +152,7 @@ + + diff --git a/nginx-conf/nginx.conf b/nginx-conf/nginx.conf index 5f2754c..4029619 100644 --- a/nginx-conf/nginx.conf +++ b/nginx-conf/nginx.conf @@ -4,6 +4,13 @@ server listen 80; listen 443 ssl http2; + # 并发限制 限制当前站点最大并发数 + limit_conn perserver 50; + # 单IP限制 限制单个IP访问最大并发数 + limit_conn perip 10; + # 流量限制 限制每个请求的流量上限(单位:KB) + limit_rate 8192k; + location / { proxy_pass http://127.0.0.1:5203; diff --git a/weixin-miniprogram/pages/shop/myOrder.js b/weixin-miniprogram/pages/shop/myOrder.js index e0a3f0b..5ed63bb 100644 --- a/weixin-miniprogram/pages/shop/myOrder.js +++ b/weixin-miniprogram/pages/shop/myOrder.js @@ -137,7 +137,7 @@ Page({ filterList: filterList, filterActiveName: "全部", orderList: userOrder.orders.map(order => { - order.displayDate = order.orderDate.replace("T", " ") + order.displayDate = order.orderDate return order }) }) @@ -153,7 +153,7 @@ Page({ console.log("userOrder", userOrder) this.setData({ orderList: userOrder.orders.map(order => { - order.displayDate = order.orderDate.replace("T", " ") + order.displayDate = order.orderDate return order }) }) diff --git a/weixin-miniprogram/pages/shop/orderDetail.js b/weixin-miniprogram/pages/shop/orderDetail.js index 6ec80d4..da70332 100644 --- a/weixin-miniprogram/pages/shop/orderDetail.js +++ b/weixin-miniprogram/pages/shop/orderDetail.js @@ -259,7 +259,7 @@ Page({ this.setData({ order: orderDetail.order, orderGoodList: orderGoodList, - orderTime: orderDetail.order.orderDate.replace("T", " "), + orderTime: orderDetail.order.orderDate, orderStatusCode: orderStatusCode, orderPrice: orderPrice, })