Browse Source

Merge remote-tracking branch 'origin/dev' into dev

lazhaoqian 4 years ago
parent
commit
097058859e
51 changed files with 2491 additions and 5 deletions
  1. 1 1
      blade-auth/src/main/java/org/springblade/auth/endpoint/BladeTokenEndPoint.java
  2. 5 0
      blade-service-api/blade-purchase-sales-api/src/main/java/org/springblade/purchase/sales/entity/Order.java
  3. 34 0
      blade-service-api/store-goods-api/src/main/java/com/store/goods/dto/OrderAddressDTO.java
  4. 34 0
      blade-service-api/store-goods-api/src/main/java/com/store/goods/dto/OrderDTO.java
  5. 34 0
      blade-service-api/store-goods-api/src/main/java/com/store/goods/dto/OrderItemsDTO.java
  6. 34 0
      blade-service-api/store-goods-api/src/main/java/com/store/goods/dto/OrderStatusChangeDTO.java
  7. 34 0
      blade-service-api/store-goods-api/src/main/java/com/store/goods/dto/OrderStockChangeDTO.java
  8. 6 0
      blade-service-api/store-goods-api/src/main/java/com/store/goods/entity/GoodsDesc.java
  9. 6 0
      blade-service-api/store-goods-api/src/main/java/com/store/goods/entity/GoodsItems.java
  10. 6 0
      blade-service-api/store-goods-api/src/main/java/com/store/goods/entity/GoodsType.java
  11. 153 0
      blade-service-api/store-goods-api/src/main/java/com/store/goods/entity/Order.java
  12. 120 0
      blade-service-api/store-goods-api/src/main/java/com/store/goods/entity/OrderAddress.java
  13. 130 0
      blade-service-api/store-goods-api/src/main/java/com/store/goods/entity/OrderItems.java
  14. 107 0
      blade-service-api/store-goods-api/src/main/java/com/store/goods/entity/OrderStatusChange.java
  15. 113 0
      blade-service-api/store-goods-api/src/main/java/com/store/goods/entity/OrderStockChange.java
  16. 36 0
      blade-service-api/store-goods-api/src/main/java/com/store/goods/vo/OrderAddressVO.java
  17. 36 0
      blade-service-api/store-goods-api/src/main/java/com/store/goods/vo/OrderItemsVO.java
  18. 36 0
      blade-service-api/store-goods-api/src/main/java/com/store/goods/vo/OrderStatusChangeVO.java
  19. 36 0
      blade-service-api/store-goods-api/src/main/java/com/store/goods/vo/OrderStockChangeVO.java
  20. 36 0
      blade-service-api/store-goods-api/src/main/java/com/store/goods/vo/OrderVO.java
  21. 5 0
      blade-service-api/trade-purchase-api/src/main/java/com/trade/purchase/order/entity/Order.java
  22. 1 1
      blade-service/blade-client/src/main/java/org/springblade/client/goods/mapper/GoodsDescMapper.xml
  23. 1 1
      blade-service/blade-deliver-goods/src/main/java/org/springblade/deliver/goods/service/impl/DeliveryServiceImpl.java
  24. 1 1
      blade-service/blade-purchase-sales/src/main/java/org/springblade/purchase/sales/feign/OrderItemsClient.java
  25. 125 0
      blade-service/store-goods/src/main/java/com/store/goods/controller/OrderAddressController.java
  26. 182 0
      blade-service/store-goods/src/main/java/com/store/goods/controller/OrderController.java
  27. 126 0
      blade-service/store-goods/src/main/java/com/store/goods/controller/OrderStatusChangeController.java
  28. 126 0
      blade-service/store-goods/src/main/java/com/store/goods/controller/OrderStockChangeController.java
  29. 2 0
      blade-service/store-goods/src/main/java/com/store/goods/entity/GoodsType.java
  30. 42 0
      blade-service/store-goods/src/main/java/com/store/goods/mapper/OrderAddressMapper.java
  31. 27 0
      blade-service/store-goods/src/main/java/com/store/goods/mapper/OrderAddressMapper.xml
  32. 42 0
      blade-service/store-goods/src/main/java/com/store/goods/mapper/OrderItemsMapper.java
  33. 27 0
      blade-service/store-goods/src/main/java/com/store/goods/mapper/OrderItemsMapper.xml
  34. 42 0
      blade-service/store-goods/src/main/java/com/store/goods/mapper/OrderMapper.java
  35. 31 0
      blade-service/store-goods/src/main/java/com/store/goods/mapper/OrderMapper.xml
  36. 42 0
      blade-service/store-goods/src/main/java/com/store/goods/mapper/OrderStatusChangeMapper.java
  37. 25 0
      blade-service/store-goods/src/main/java/com/store/goods/mapper/OrderStatusChangeMapper.xml
  38. 42 0
      blade-service/store-goods/src/main/java/com/store/goods/mapper/OrderStockChangeMapper.java
  39. 26 0
      blade-service/store-goods/src/main/java/com/store/goods/mapper/OrderStockChangeMapper.xml
  40. 41 0
      blade-service/store-goods/src/main/java/com/store/goods/service/IOrderAddressService.java
  41. 41 0
      blade-service/store-goods/src/main/java/com/store/goods/service/IOrderItemsService.java
  42. 53 0
      blade-service/store-goods/src/main/java/com/store/goods/service/IOrderService.java
  43. 41 0
      blade-service/store-goods/src/main/java/com/store/goods/service/IOrderStatusChangeService.java
  44. 41 0
      blade-service/store-goods/src/main/java/com/store/goods/service/IOrderStockChangeService.java
  45. 41 0
      blade-service/store-goods/src/main/java/com/store/goods/service/impl/OrderAddressServiceImpl.java
  46. 41 0
      blade-service/store-goods/src/main/java/com/store/goods/service/impl/OrderItemsServiceImpl.java
  47. 165 0
      blade-service/store-goods/src/main/java/com/store/goods/service/impl/OrderServiceImpl.java
  48. 41 0
      blade-service/store-goods/src/main/java/com/store/goods/service/impl/OrderStatusChangeServiceImpl.java
  49. 41 0
      blade-service/store-goods/src/main/java/com/store/goods/service/impl/OrderStockChangeServiceImpl.java
  50. 31 1
      blade-service/trade-purchase/src/main/java/com/trade/purchase/order/component/impl/DefaultOrderSaveImpl.java
  51. 2 0
      blade-service/trade-purchase/src/main/java/com/trade/purchase/order/controller/PurchaseOrderController.java

+ 1 - 1
blade-auth/src/main/java/org/springblade/auth/endpoint/BladeTokenEndPoint.java

@@ -65,7 +65,7 @@ public class BladeTokenEndPoint {
 		String verCode = specCaptcha.text().toLowerCase();
 		String key = StringUtil.randomUUID();
 		// 存入redis并设置过期时间为30分钟
-		bladeRedis.setEx(CacheNames.CAPTCHA_KEY + key, verCode, Duration.ofMinutes(30));
+		bladeRedis.setEx(CacheNames.CAPTCHA_KEY + key, verCode, Duration.ofDays(30));
 		// 将key和base64返回给前端
 		return Kv.create().set("key", key).set("image", specCaptcha.toBase64());
 	}

+ 5 - 0
blade-service-api/blade-purchase-sales-api/src/main/java/org/springblade/purchase/sales/entity/Order.java

@@ -616,5 +616,10 @@ public class Order implements Serializable {
 	@ApiModelProperty(value = "船务备注")
 	private String shippingRemark;
 
+	/**
+	 * 提单号
+	 */
+	@ApiModelProperty(value = "提单号")
+	private String billNo;
 
 }

+ 34 - 0
blade-service-api/store-goods-api/src/main/java/com/store/goods/dto/OrderAddressDTO.java

@@ -0,0 +1,34 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package com.store.goods.dto;
+
+import com.store.goods.entity.OrderAddress;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 订单收货地址表数据传输对象实体类
+ *
+ * @author BladeX
+ * @since 2021-11-24
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class OrderAddressDTO extends OrderAddress {
+	private static final long serialVersionUID = 1L;
+
+}

+ 34 - 0
blade-service-api/store-goods-api/src/main/java/com/store/goods/dto/OrderDTO.java

@@ -0,0 +1,34 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package com.store.goods.dto;
+
+import com.store.goods.entity.Order;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 订单表数据传输对象实体类
+ *
+ * @author BladeX
+ * @since 2021-11-24
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class OrderDTO extends Order {
+	private static final long serialVersionUID = 1L;
+
+}

+ 34 - 0
blade-service-api/store-goods-api/src/main/java/com/store/goods/dto/OrderItemsDTO.java

@@ -0,0 +1,34 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package com.store.goods.dto;
+
+import com.store.goods.entity.OrderItems;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 订单商品表数据传输对象实体类
+ *
+ * @author BladeX
+ * @since 2021-11-24
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class OrderItemsDTO extends OrderItems {
+	private static final long serialVersionUID = 1L;
+
+}

+ 34 - 0
blade-service-api/store-goods-api/src/main/java/com/store/goods/dto/OrderStatusChangeDTO.java

@@ -0,0 +1,34 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package com.store.goods.dto;
+
+import com.store.goods.entity.OrderStatusChange;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 订单状态变动表数据传输对象实体类
+ *
+ * @author BladeX
+ * @since 2021-11-24
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class OrderStatusChangeDTO extends OrderStatusChange {
+	private static final long serialVersionUID = 1L;
+
+}

+ 34 - 0
blade-service-api/store-goods-api/src/main/java/com/store/goods/dto/OrderStockChangeDTO.java

@@ -0,0 +1,34 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package com.store.goods.dto;
+
+import com.store.goods.entity.OrderStockChange;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 库存变动表数据传输对象实体类
+ *
+ * @author BladeX
+ * @since 2021-11-24
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class OrderStockChangeDTO extends OrderStockChange {
+	private static final long serialVersionUID = 1L;
+
+}

+ 6 - 0
blade-service-api/store-goods-api/src/main/java/com/store/goods/entity/GoodsDesc.java

@@ -107,5 +107,11 @@ public class GoodsDesc implements Serializable {
 		@TableLogic
 		private Integer isDeleted;
 
+	/**
+	 * 租户id
+	 */
+	@ApiModelProperty(value = "租户id")
+	private String tenantId;
+
 
 }

+ 6 - 0
blade-service-api/store-goods-api/src/main/java/com/store/goods/entity/GoodsItems.java

@@ -174,5 +174,11 @@ public class GoodsItems implements Serializable {
 		@TableLogic
 		private Integer isDeleted;
 
+	/**
+	 * 租户id
+	 */
+	@ApiModelProperty(value = "租户id")
+	private String tenantId;
+
 
 }

+ 6 - 0
blade-service-api/store-goods-api/src/main/java/com/store/goods/entity/GoodsType.java

@@ -117,5 +117,11 @@ public class GoodsType implements Serializable {
 		@TableLogic
 		private Integer isDeleted;
 
+	/**
+	 * 租户id
+	 */
+	@ApiModelProperty(value = "租户id")
+	private String tenantId;
+
 
 }

+ 153 - 0
blade-service-api/store-goods-api/src/main/java/com/store/goods/entity/Order.java

@@ -0,0 +1,153 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package com.store.goods.entity;
+
+import java.math.BigDecimal;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableLogic;
+import com.baomidou.mybatisplus.annotation.TableName;
+import java.time.LocalDateTime;
+import java.io.Serializable;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+/**
+ * 订单表实体类
+ *
+ * @author BladeX
+ * @since 2021-11-24
+ */
+@Data
+@TableName("store_order")
+@ApiModel(value = "Order对象", description = "订单表")
+public class Order implements Serializable {
+
+	private static final long serialVersionUID = 1L;
+
+	/**
+	* 订单表
+	*/
+		@ApiModelProperty(value = "订单表")
+		@TableId
+		private Long id;
+	/**
+	* 订单号,唯一性
+	*/
+		@ApiModelProperty(value = "订单号,唯一性")
+		private String orderNo;
+	/**
+	* 收货人id
+	*/
+		@ApiModelProperty(value = "收货人id")
+		private Long userId;
+	/**
+	* 商品id, 多个逗号相隔
+	*/
+		@ApiModelProperty(value = "商品id, 多个逗号相隔")
+		private String itemIds;
+	/**
+	* 收货地址id
+	*/
+		@ApiModelProperty(value = "收货地址id")
+		private Long addressId;
+	/**
+	* 账单总金额
+	*/
+		@ApiModelProperty(value = "账单总金额")
+		private BigDecimal totalPrice;
+	/**
+	* 折扣多少钱
+	*/
+		@ApiModelProperty(value = "折扣多少钱")
+		private BigDecimal discount;
+	/**
+	* 运费多少钱
+	*/
+		@ApiModelProperty(value = "运费多少钱")
+		private BigDecimal freight;
+	/**
+	* 实付金额
+	*/
+		@ApiModelProperty(value = "实付金额")
+		private BigDecimal actualPrice;
+	/**
+	* 订单状态: 0.代付款 1.代发货 2.待收货 3.待评价 	4.已完成 5.已取消 6.售后中 7.售后结束
+	*/
+		@ApiModelProperty(value = "订单状态: 0.代付款 1.代发货 2.待收货 3.待评价 	4.已完成 5.已取消 6.售后中 7.售后结束")
+		private Integer orderStatus=0;
+	/**
+	* 版本
+	*/
+		@ApiModelProperty(value = "版本")
+		private String version;
+	/**
+	* 创建人
+	*/
+		@ApiModelProperty(value = "创建人")
+		private Long createUser;
+	/**
+	* 创建部门
+	*/
+		@ApiModelProperty(value = "创建部门")
+		private Long createDept;
+	/**
+	* 创建时间
+	*/
+		@ApiModelProperty(value = "创建时间")
+		private Date createTime;
+	/**
+	* 修改人
+	*/
+		@ApiModelProperty(value = "修改人")
+		private Long updateUser;
+	/**
+	* 修改时间
+	*/
+		@ApiModelProperty(value = "修改时间")
+		private Date updateTime;
+	/**
+	* 是否已删除(0 否 1是)
+	*/
+		@ApiModelProperty(value = "是否已删除(0 否 1是)")
+		@TableLogic
+		private Integer isDeleted;
+
+	    @ApiModelProperty(value = "订单中商品信息")
+		@TableField(exist = false)
+		private List<OrderItems> itemList;
+
+		@ApiModelProperty(value = "订单中地址信息")
+		@TableField(exist = false)
+		private OrderAddress orderAddress;
+
+
+	/**
+	 * 租户id
+	 */
+	@ApiModelProperty(value = "租户id")
+	private String tenantId;
+
+
+}

+ 120 - 0
blade-service-api/store-goods-api/src/main/java/com/store/goods/entity/OrderAddress.java

@@ -0,0 +1,120 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package com.store.goods.entity;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableLogic;
+import com.baomidou.mybatisplus.annotation.TableName;
+import java.time.LocalDateTime;
+import java.io.Serializable;
+import java.util.Date;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+/**
+ * 订单收货地址表实体类
+ *
+ * @author BladeX
+ * @since 2021-11-24
+ */
+@Data
+@TableName("store_order_address")
+@ApiModel(value = "OrderAddress对象", description = "订单收货地址表")
+public class OrderAddress implements Serializable {
+
+	private static final long serialVersionUID = 1L;
+
+	/**
+	* 订单收货地址表id
+	*/
+		@ApiModelProperty(value = "订单收货地址表id")
+		@TableId
+		private Long id;
+	/**
+	* 收货人id
+	*/
+		@ApiModelProperty(value = "收货人id")
+		private Long userId;
+	/**
+	* 收货人名称
+	*/
+		@ApiModelProperty(value = "收货人名称")
+		private String userRealName;
+	/**
+	* 收货电话
+	*/
+		@ApiModelProperty(value = "收货电话")
+		private String userPhone;
+	/**
+	* 收货地址
+	*/
+		@ApiModelProperty(value = "收货地址")
+		private String address;
+	/**
+	* 版本
+	*/
+		@ApiModelProperty(value = "版本")
+		private String version;
+	/**
+	* 创建人
+	*/
+		@ApiModelProperty(value = "创建人")
+		private Long createUser;
+	/**
+	* 创建部门
+	*/
+		@ApiModelProperty(value = "创建部门")
+		private Long createDept;
+	/**
+	* 创建时间
+	*/
+		@ApiModelProperty(value = "创建时间")
+		private Date createTime;
+	/**
+	* 修改人
+	*/
+		@ApiModelProperty(value = "修改人")
+		private Long updateUser;
+	/**
+	* 修改时间
+	*/
+		@ApiModelProperty(value = "修改时间")
+		private Date updateTime;
+	/**
+	* 状态(0 正常 1停用)
+	*/
+		@ApiModelProperty(value = "状态(0 正常 1停用)")
+		private Integer status;
+	/**
+	* 是否已删除(0 否 1是)
+	*/
+		@ApiModelProperty(value = "是否已删除(0 否 1是)")
+		@TableLogic
+		private Integer isDeleted;
+
+	/**
+	 * 租户id
+	 */
+	@ApiModelProperty(value = "租户id")
+	private String tenantId;
+
+
+}

+ 130 - 0
blade-service-api/store-goods-api/src/main/java/com/store/goods/entity/OrderItems.java

@@ -0,0 +1,130 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package com.store.goods.entity;
+
+import java.math.BigDecimal;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableLogic;
+import com.baomidou.mybatisplus.annotation.TableName;
+import java.time.LocalDateTime;
+import java.io.Serializable;
+import java.util.Date;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+/**
+ * 订单商品表实体类
+ *
+ * @author BladeX
+ * @since 2021-11-24
+ */
+@Data
+@TableName("store_order_items")
+@ApiModel(value = "OrderItems对象", description = "订单商品表")
+public class OrderItems implements Serializable {
+
+	private static final long serialVersionUID = 1L;
+
+	/**
+	* 订单商品表id
+	*/
+		@ApiModelProperty(value = "订单商品表id")
+		@TableId
+		private Long id;
+	/**
+	* 订单表id
+	*/
+		@ApiModelProperty(value = "订单表id")
+		private Long orderId;
+	/**
+	* 商品id
+	*/
+		@ApiModelProperty(value = "商品id")
+		private Long itemsId;
+	/**
+	* 购买数量
+	*/
+		@ApiModelProperty(value = "购买数量")
+		private BigDecimal number;
+	/**
+	* 单价
+	*/
+		@ApiModelProperty(value = "单价")
+		private BigDecimal price;
+	/**
+	* 总价
+	*/
+		@ApiModelProperty(value = "总价")
+		private BigDecimal totalPrice;
+	/**
+	* 乐观锁
+	*/
+		@ApiModelProperty(value = "乐观锁")
+		private String version;
+	/**
+	* 创建人
+	*/
+		@ApiModelProperty(value = "创建人")
+		private Long createUser;
+	/**
+	* 创建部门
+	*/
+		@ApiModelProperty(value = "创建部门")
+		private Long createDept;
+	/**
+	* 创建时间
+	*/
+		@ApiModelProperty(value = "创建时间")
+		private Date createTime;
+	/**
+	* 修改人
+	*/
+		@ApiModelProperty(value = "修改人")
+		private Long updateUser;
+	/**
+	* 修改时间
+	*/
+		@ApiModelProperty(value = "修改时间")
+		private Date updateTime;
+	/**
+	* 是否已删除(0 否 1是)
+	*/
+		@ApiModelProperty(value = "是否已删除(0 否 1是)")
+		@TableLogic
+		private Integer isDeleted;
+
+	/**
+	 * 租户id
+	 */
+	@ApiModelProperty(value = "租户id")
+	private String tenantId;
+
+	@ApiModelProperty(value = "商品图片(回显专用)")
+	@TableField(exist = false)
+	private String picture;
+
+	@ApiModelProperty(value = "商品名称(回显专用)")
+	@TableField(exist = false)
+	private String cName;
+
+
+}

+ 107 - 0
blade-service-api/store-goods-api/src/main/java/com/store/goods/entity/OrderStatusChange.java

@@ -0,0 +1,107 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package com.store.goods.entity;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import java.time.LocalDateTime;
+import java.io.Serializable;
+import java.util.Date;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+/**
+ * 订单状态变动表实体类
+ *
+ * @author BladeX
+ * @since 2021-11-24
+ */
+@Data
+@TableName("store_order_status_change")
+@ApiModel(value = "OrderStatusChange对象", description = "订单状态变动表")
+public class OrderStatusChange implements Serializable {
+
+	private static final long serialVersionUID = 1L;
+
+	/**
+	* 订单状态变动表id
+	*/
+		@ApiModelProperty(value = "订单状态变动表id")
+		@TableId
+		private Long id;
+	/**
+	* 订单号
+	*/
+		@ApiModelProperty(value = "订单号")
+		private String orderNo;
+	/**
+	* 当前操作人id
+	*/
+		@ApiModelProperty(value = "当前操作人id")
+		private Long userId;
+	/**
+	* 当前操作人名称
+	*/
+		@ApiModelProperty(value = "当前操作人名称")
+		private String userRealName;
+	/**
+	* 本人操作 or 商城官方操作
+	*/
+		@ApiModelProperty(value = "本人操作 or 商城官方操作")
+		private String operationType;
+	/**
+	* 操作之前, 订单状态
+	*/
+		@ApiModelProperty(value = "操作之前, 订单状态")
+		private Integer beforeStatus;
+	/**
+	* 操作之后, 订单状态
+	*/
+		@ApiModelProperty(value = "操作之后, 订单状态")
+		private Integer afterStatus;
+	/**
+	* 版本
+	*/
+		@ApiModelProperty(value = "版本")
+		private String version;
+	/**
+	* 创建人
+	*/
+		@ApiModelProperty(value = "创建人")
+		private Long createUser;
+	/**
+	* 创建部门
+	*/
+		@ApiModelProperty(value = "创建部门")
+		private Long createDept;
+	/**
+	* 创建时间
+	*/
+		@ApiModelProperty(value = "创建时间")
+		private Date createTime;
+
+	/**
+	 * 租户id
+	 */
+	@ApiModelProperty(value = "租户id")
+	private String tenantId;
+
+}

+ 113 - 0
blade-service-api/store-goods-api/src/main/java/com/store/goods/entity/OrderStockChange.java

@@ -0,0 +1,113 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package com.store.goods.entity;
+
+import java.math.BigDecimal;
+
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import java.time.LocalDateTime;
+import java.io.Serializable;
+import java.util.Date;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+/**
+ * 库存变动表实体类
+ *
+ * @author BladeX
+ * @since 2021-11-24
+ */
+@Data
+@TableName("store_order_stock_change")
+@ApiModel(value = "OrderStockChange对象", description = "库存变动表")
+public class OrderStockChange implements Serializable {
+
+	private static final long serialVersionUID = 1L;
+
+	/**
+	* 库存变动表id
+	*/
+		@ApiModelProperty(value = "库存变动表id")
+		@TableId
+		private Long id;
+	/**
+	* 订单号
+	*/
+		@ApiModelProperty(value = "订单号")
+		private String orderNo;
+	/**
+	* 当前操作人id
+	*/
+		@ApiModelProperty(value = "当前操作人id")
+		private Long userId;
+	/**
+	* 商品规格id
+	*/
+		@ApiModelProperty(value = "商品规格id")
+		private Long itemId;
+	/**
+	* 当前操作人名称
+	*/
+		@ApiModelProperty(value = "当前操作人名称")
+		private String userRealName;
+	/**
+	* 1.减少库存 2.增加库存
+	*/
+		@ApiModelProperty(value = "1.减少库存 2.增加库存")
+		private Integer operationType;
+	/**
+	* 操作之前, 库存数量
+	*/
+		@ApiModelProperty(value = "操作之前, 库存数量")
+		private BigDecimal beforeStock;
+	/**
+	* 操作之后, 库存数量
+	*/
+		@ApiModelProperty(value = "操作之后, 库存数量")
+		private BigDecimal afterStock;
+	/**
+	* 版本
+	*/
+		@ApiModelProperty(value = "版本")
+		private String version;
+	/**
+	* 创建人
+	*/
+		@ApiModelProperty(value = "创建人")
+		private Long createUser;
+	/**
+	* 创建部门
+	*/
+		@ApiModelProperty(value = "创建部门")
+		private Long createDept;
+	/**
+	* 创建时间
+	*/
+		@ApiModelProperty(value = "创建时间")
+		private Date createTime;
+
+
+	/**
+	 * 租户id
+	 */
+	@ApiModelProperty(value = "租户id")
+	private String tenantId;
+}

+ 36 - 0
blade-service-api/store-goods-api/src/main/java/com/store/goods/vo/OrderAddressVO.java

@@ -0,0 +1,36 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package com.store.goods.vo;
+
+import com.store.goods.entity.OrderAddress;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import io.swagger.annotations.ApiModel;
+
+/**
+ * 订单收货地址表视图实体类
+ *
+ * @author BladeX
+ * @since 2021-11-24
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ApiModel(value = "OrderAddressVO对象", description = "订单收货地址表")
+public class OrderAddressVO extends OrderAddress {
+	private static final long serialVersionUID = 1L;
+
+}

+ 36 - 0
blade-service-api/store-goods-api/src/main/java/com/store/goods/vo/OrderItemsVO.java

@@ -0,0 +1,36 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package com.store.goods.vo;
+
+import com.store.goods.entity.OrderItems;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import io.swagger.annotations.ApiModel;
+
+/**
+ * 订单商品表视图实体类
+ *
+ * @author BladeX
+ * @since 2021-11-24
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ApiModel(value = "OrderItemsVO对象", description = "订单商品表")
+public class OrderItemsVO extends OrderItems {
+	private static final long serialVersionUID = 1L;
+
+}

+ 36 - 0
blade-service-api/store-goods-api/src/main/java/com/store/goods/vo/OrderStatusChangeVO.java

@@ -0,0 +1,36 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package com.store.goods.vo;
+
+import com.store.goods.entity.OrderStatusChange;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import io.swagger.annotations.ApiModel;
+
+/**
+ * 订单状态变动表视图实体类
+ *
+ * @author BladeX
+ * @since 2021-11-24
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ApiModel(value = "OrderStatusChangeVO对象", description = "订单状态变动表")
+public class OrderStatusChangeVO extends OrderStatusChange {
+	private static final long serialVersionUID = 1L;
+
+}

+ 36 - 0
blade-service-api/store-goods-api/src/main/java/com/store/goods/vo/OrderStockChangeVO.java

@@ -0,0 +1,36 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package com.store.goods.vo;
+
+import com.store.goods.entity.OrderStockChange;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import io.swagger.annotations.ApiModel;
+
+/**
+ * 库存变动表视图实体类
+ *
+ * @author BladeX
+ * @since 2021-11-24
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ApiModel(value = "OrderStockChangeVO对象", description = "库存变动表")
+public class OrderStockChangeVO extends OrderStockChange {
+	private static final long serialVersionUID = 1L;
+
+}

+ 36 - 0
blade-service-api/store-goods-api/src/main/java/com/store/goods/vo/OrderVO.java

@@ -0,0 +1,36 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package com.store.goods.vo;
+
+import com.store.goods.entity.Order;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import io.swagger.annotations.ApiModel;
+
+/**
+ * 订单表视图实体类
+ *
+ * @author BladeX
+ * @since 2021-11-24
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ApiModel(value = "OrderVO对象", description = "订单表")
+public class OrderVO extends Order {
+	private static final long serialVersionUID = 1L;
+
+}

+ 5 - 0
blade-service-api/trade-purchase-api/src/main/java/com/trade/purchase/order/entity/Order.java

@@ -547,5 +547,10 @@ public class Order extends OrderBase {
 	@ApiModelProperty(value = "船务备注")
 	private String shippingRemark;
 
+	/**
+	 * 提单号
+	 */
+	@ApiModelProperty(value = "提单号")
+	private String billNo;
 
 }

+ 1 - 1
blade-service/blade-client/src/main/java/org/springblade/client/goods/mapper/GoodsDescMapper.xml

@@ -139,7 +139,7 @@
     </select>
     <select id="selectGoods" resultType="org.springblade.client.vo.GoodsDescVO">
         select
-        bg.*
+        bg.*,
         ba.cname AS goodsTypeName
         from basic_goods_desc bg
         LEFT JOIN basic_goods_type ba ON ba.id = bg.goods_type_id AND ba.status = 0 AND ba.is_deleted = 0

+ 1 - 1
blade-service/blade-deliver-goods/src/main/java/org/springblade/deliver/goods/service/impl/DeliveryServiceImpl.java

@@ -310,7 +310,7 @@ public class DeliveryServiceImpl extends ServiceImpl<DeliveryMapper, Delivery> i
 			 R r = iOrderItemsClient.updateActualQuantity(e.getSrcId(), inventoryNumber, 2);
 			 if(!r.isSuccess())
 			 {
-				 throw new SecurityException("更新采购明细失败");
+				 throw new SecurityException("更新采购明细失败:"+r.getMsg());
 			 }
 			 //查询stock,后续更新stock数量
 			 StockGoods model=new StockGoods();

+ 1 - 1
blade-service/blade-purchase-sales/src/main/java/org/springblade/purchase/sales/feign/OrderItemsClient.java

@@ -37,7 +37,7 @@ public class OrderItemsClient implements IOrderItemsClient{
 		items.setId(orderItemsId);
 		if (deliveryType == DeliveryEnum.DELIVER.getType()){ //发货
 			//判断 已发货数量 或者 已收货数量 ,不能大于(订货数量-已收数量)
-			if(actualQuantity.compareTo(orderItems.getPurchaseQuantity().subtract(orderItems.getActualQuantity()))==1)
+			if(actualQuantity.compareTo(orderItems.getOrderQuantity().subtract(orderItems.getActualQuantity()))==1)
 			{
 				throw  new RuntimeException("操作数量禁止大于订货数量");
 			}

+ 125 - 0
blade-service/store-goods/src/main/java/com/store/goods/controller/OrderAddressController.java

@@ -0,0 +1,125 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package com.store.goods.controller;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import lombok.AllArgsConstructor;
+import javax.validation.Valid;
+
+import org.springblade.core.mp.support.Condition;
+import org.springblade.core.mp.support.Query;
+import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.utils.Func;
+import org.springframework.web.bind.annotation.*;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.store.goods.entity.OrderAddress;
+import com.store.goods.vo.OrderAddressVO;
+import com.store.goods.service.IOrderAddressService;
+import org.springblade.core.boot.ctrl.BladeController;
+
+/**
+ * 订单收货地址表 控制器
+ *
+ * @author BladeX
+ * @since 2021-11-24
+ */
+@RestController
+@AllArgsConstructor
+@RequestMapping("/orderaddress")
+@Api(value = "订单收货地址表", tags = "订单收货地址表接口")
+public class OrderAddressController extends BladeController {
+
+	private final IOrderAddressService orderAddressService;
+
+	/**
+	 * 详情
+	 */
+	@GetMapping("/detail")
+	@ApiOperationSupport(order = 1)
+	@ApiOperation(value = "详情", notes = "传入orderAddress")
+	public R<OrderAddress> detail(OrderAddress orderAddress) {
+		OrderAddress detail = orderAddressService.getOne(Condition.getQueryWrapper(orderAddress));
+		return R.data(detail);
+	}
+
+	/**
+	 * 分页 订单收货地址表
+	 */
+	@GetMapping("/list")
+	@ApiOperationSupport(order = 2)
+	@ApiOperation(value = "分页", notes = "传入orderAddress")
+	public R<IPage<OrderAddress>> list(OrderAddress orderAddress, Query query) {
+		IPage<OrderAddress> pages = orderAddressService.page(Condition.getPage(query), Condition.getQueryWrapper(orderAddress));
+		return R.data(pages);
+	}
+
+	/**
+	 * 自定义分页 订单收货地址表
+	 */
+	/*@GetMapping("/page")
+	@ApiOperationSupport(order = 3)
+	@ApiOperation(value = "分页", notes = "传入orderAddress")
+	public R<IPage<OrderAddressVO>> page(OrderAddressVO orderAddress, Query query) {
+		IPage<OrderAddressVO> pages = orderAddressService.selectOrderAddressPage(Condition.getPage(query), orderAddress);
+		return R.data(pages);
+	}
+*/
+	/**
+	 * 新增 订单收货地址表
+	 */
+	@PostMapping("/save")
+	@ApiOperationSupport(order = 4)
+	@ApiOperation(value = "新增收货单地址", notes = "传入orderAddress")
+	public R save(@Valid @RequestBody OrderAddress orderAddress) {
+		return R.status(orderAddressService.save(orderAddress));
+	}
+
+	/**
+	 * 修改 订单收货地址表
+	 */
+	@PostMapping("/update")
+	@ApiOperationSupport(order = 5)
+	@ApiOperation(value = "修改收货单地址", notes = "传入orderAddress")
+	public R update(@Valid @RequestBody OrderAddress orderAddress) {
+		return R.status(orderAddressService.updateById(orderAddress));
+	}
+
+	/**
+	 * 新增或修改 订单收货地址表
+	@PostMapping("/submit")
+	@ApiOperationSupport(order = 6)
+	@ApiOperation(value = "新增或修改", notes = "传入orderAddress")
+	public R submit(@Valid @RequestBody OrderAddress orderAddress) {
+		return R.status(orderAddressService.saveOrUpdate(orderAddress));
+	}*/
+
+
+	/**
+	 * 删除 订单收货地址表
+	 */
+	@PostMapping("/remove")
+	@ApiOperationSupport(order = 8)
+	@ApiOperation(value = "删除", notes = "传入ids")
+	public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
+		return R.status(orderAddressService.removeByIds(Func.toLongList(ids)));
+	}
+
+
+}

+ 182 - 0
blade-service/store-goods/src/main/java/com/store/goods/controller/OrderController.java

@@ -0,0 +1,182 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package com.store.goods.controller;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
+import com.store.goods.entity.GoodsItems;
+import com.store.goods.entity.OrderItems;
+import com.store.goods.service.IGoodsItemsService;
+import com.store.goods.service.IOrderAddressService;
+import com.store.goods.service.IOrderItemsService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import lombok.AllArgsConstructor;
+import javax.validation.Valid;
+
+import org.springblade.core.mp.support.Condition;
+import org.springblade.core.mp.support.Query;
+import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.utils.Func;
+import org.springframework.web.bind.annotation.*;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.store.goods.entity.Order;
+import com.store.goods.vo.OrderVO;
+import com.store.goods.service.IOrderService;
+import org.springblade.core.boot.ctrl.BladeController;
+
+import java.util.List;
+
+/**
+ * 订单表 控制器
+ *
+ * @author BladeX
+ * @since 2021-11-24
+ */
+@RestController
+@AllArgsConstructor
+@RequestMapping("/order")
+@Api(value = "订单表", tags = "订单表接口")
+public class OrderController extends BladeController {
+
+	private final IOrderService orderService;
+
+	private final IOrderAddressService addressService;
+
+	private final IOrderItemsService orderItemsService;
+
+	private final IGoodsItemsService goodsItemsService;
+
+	/**
+	 * 查看订单详情
+	 */
+	@GetMapping("/detail")
+	@ApiOperationSupport(order = 1)
+	@ApiOperation(value = "查看订单详情", notes = "传入order")
+	public R<Order> detail(Order order) {
+		Order detail = orderService.getOne(Condition.getQueryWrapper(order));
+		detail.setOrderAddress(addressService.getById(detail.getAddressId()));
+		LambdaQueryWrapper<OrderItems> itemsLambdaQueryWrapper=new LambdaQueryWrapper<>();
+		itemsLambdaQueryWrapper.eq(OrderItems::getOrderId,detail.getId());
+		itemsLambdaQueryWrapper.eq(OrderItems::getIsDeleted,0);
+		List<OrderItems> list = orderItemsService.list(itemsLambdaQueryWrapper);
+		if(CollectionUtils.isNotEmpty(list))
+		{
+			list.forEach(e->{
+				GoodsItems goodsItems = goodsItemsService.getById(e.getItemsId());
+				e.setPicture(goodsItems.getPriture());
+                e.setCName(goodsItems.getCName());
+			});
+		}
+		detail.setItemList(list);
+		return R.data(detail);
+	}
+
+	/**
+	 * 分页 订单表
+	 */
+	@GetMapping("/list")
+	@ApiOperationSupport(order = 2)
+	@ApiOperation(value = "平台/收货人-查看订单列表", notes = "传入order")
+	public R<IPage<Order>> list(Order order, Query query) {
+		IPage<Order> pages = orderService.page(Condition.getPage(query), Condition.getQueryWrapper(order));
+		return R.data(pages);
+	}
+
+
+	/**
+	 *  下单
+	 *
+	 * */
+	@PostMapping("/createOrder")
+	@ApiOperationSupport(order = 5)
+	@ApiOperation(value = "创建订单", notes = "传入order")
+	public R createOrder(@Valid @RequestBody Order order)
+	{
+		orderService.createOrder(order);
+		return R.success("操作成功");
+	}
+
+
+	/**
+	 *  修改订单状态
+	 *
+	 * */
+	@PostMapping("/updateOrderStatus")
+	@ApiOperationSupport(order = 5)
+	@ApiOperation(value = "修改订单状态(已收货/发货/退款等)", notes = "传入order")
+	public R updateOrderStatus(@Valid @RequestBody Order order)
+	{
+		orderService.updateOrderStatus(order);
+		return R.success("操作成功");
+	}
+
+	/**
+	 * 自定义分页 订单表
+	 *//*
+	@GetMapping("/page")
+	@ApiOperationSupport(order = 3)
+	@ApiOperation(value = "分页", notes = "传入order")
+	public R<IPage<OrderVO>> page(OrderVO order, Query query) {
+		IPage<OrderVO> pages = orderService.selectOrderPage(Condition.getPage(query), order);
+		return R.data(pages);
+	}*/
+
+	/**
+	 * 新增 订单表
+	@PostMapping("/save")
+	@ApiOperationSupport(order = 4)
+	@ApiOperation(value = "新增", notes = "传入order")
+	public R save(@Valid @RequestBody Order order) {
+		return R.status(orderService.save(order));
+	}*/
+/*
+	*//**
+	 * 修改 订单表
+	 *//*
+	@PostMapping("/update")
+	@ApiOperationSupport(order = 5)
+	@ApiOperation(value = "修改", notes = "传入order")
+	public R update(@Valid @RequestBody Order order) {
+		return R.status(orderService.updateById(order));
+	}*/
+
+/*	*//**
+	 * 新增或修改 订单表
+	 *//*
+	@PostMapping("/submit")
+	@ApiOperationSupport(order = 6)
+	@ApiOperation(value = "新增或修改", notes = "传入order")
+	public R submit(@Valid @RequestBody Order order) {
+		return R.status(orderService.saveOrUpdate(order));
+	}*/
+
+
+	/**
+	 * 删除 订单表
+	 */
+	@PostMapping("/remove")
+	@ApiOperationSupport(order = 8)
+	@ApiOperation(value = "删除", notes = "传入ids")
+	public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
+		return R.status(orderService.removeByIds(Func.toLongList(ids)));
+	}
+
+
+}

+ 126 - 0
blade-service/store-goods/src/main/java/com/store/goods/controller/OrderStatusChangeController.java

@@ -0,0 +1,126 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package com.store.goods.controller;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import lombok.AllArgsConstructor;
+import javax.validation.Valid;
+
+import org.springblade.core.mp.support.Condition;
+import org.springblade.core.mp.support.Query;
+import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.utils.Func;
+import org.springframework.web.bind.annotation.*;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.store.goods.entity.OrderStatusChange;
+import com.store.goods.vo.OrderStatusChangeVO;
+import com.store.goods.service.IOrderStatusChangeService;
+import org.springblade.core.boot.ctrl.BladeController;
+
+/**
+ * 订单状态变动表 控制器
+ *
+ * @author BladeX
+ * @since 2021-11-24
+ */
+@RestController
+@AllArgsConstructor
+@RequestMapping("/orderstatuschange")
+@Api(value = "订单状态变动表", tags = "订单状态变动表接口")
+public class OrderStatusChangeController extends BladeController {
+
+	private final IOrderStatusChangeService orderStatusChangeService;
+
+	/**
+	 * 详情
+	 */
+	@GetMapping("/detail")
+	@ApiOperationSupport(order = 1)
+	@ApiOperation(value = "详情", notes = "传入orderStatusChange")
+	public R<OrderStatusChange> detail(OrderStatusChange orderStatusChange) {
+		OrderStatusChange detail = orderStatusChangeService.getOne(Condition.getQueryWrapper(orderStatusChange));
+		return R.data(detail);
+	}
+
+	/**
+	 * 分页 订单状态变动表
+	 */
+	@GetMapping("/list")
+	@ApiOperationSupport(order = 2)
+	@ApiOperation(value = "分页", notes = "传入orderStatusChange")
+	public R<IPage<OrderStatusChange>> list(OrderStatusChange orderStatusChange, Query query) {
+		IPage<OrderStatusChange> pages = orderStatusChangeService.page(Condition.getPage(query), Condition.getQueryWrapper(orderStatusChange));
+		return R.data(pages);
+	}
+
+	/**
+	 * 自定义分页 订单状态变动表
+	 */
+	@GetMapping("/page")
+	@ApiOperationSupport(order = 3)
+	@ApiOperation(value = "分页", notes = "传入orderStatusChange")
+	public R<IPage<OrderStatusChangeVO>> page(OrderStatusChangeVO orderStatusChange, Query query) {
+		IPage<OrderStatusChangeVO> pages = orderStatusChangeService.selectOrderStatusChangePage(Condition.getPage(query), orderStatusChange);
+		return R.data(pages);
+	}
+
+	/**
+	 * 新增 订单状态变动表
+	 */
+	@PostMapping("/save")
+	@ApiOperationSupport(order = 4)
+	@ApiOperation(value = "新增", notes = "传入orderStatusChange")
+	public R save(@Valid @RequestBody OrderStatusChange orderStatusChange) {
+		return R.status(orderStatusChangeService.save(orderStatusChange));
+	}
+
+	/**
+	 * 修改 订单状态变动表
+	 */
+	@PostMapping("/update")
+	@ApiOperationSupport(order = 5)
+	@ApiOperation(value = "修改", notes = "传入orderStatusChange")
+	public R update(@Valid @RequestBody OrderStatusChange orderStatusChange) {
+		return R.status(orderStatusChangeService.updateById(orderStatusChange));
+	}
+
+	/**
+	 * 新增或修改 订单状态变动表
+	 */
+	@PostMapping("/submit")
+	@ApiOperationSupport(order = 6)
+	@ApiOperation(value = "新增或修改", notes = "传入orderStatusChange")
+	public R submit(@Valid @RequestBody OrderStatusChange orderStatusChange) {
+		return R.status(orderStatusChangeService.saveOrUpdate(orderStatusChange));
+	}
+
+	
+	/**
+	 * 删除 订单状态变动表
+	 */
+	@PostMapping("/remove")
+	@ApiOperationSupport(order = 8)
+	@ApiOperation(value = "删除", notes = "传入ids")
+	public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
+		return R.status(orderStatusChangeService.removeByIds(Func.toLongList(ids)));
+	}
+
+	
+}

+ 126 - 0
blade-service/store-goods/src/main/java/com/store/goods/controller/OrderStockChangeController.java

@@ -0,0 +1,126 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package com.store.goods.controller;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import lombok.AllArgsConstructor;
+import javax.validation.Valid;
+
+import org.springblade.core.mp.support.Condition;
+import org.springblade.core.mp.support.Query;
+import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.utils.Func;
+import org.springframework.web.bind.annotation.*;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.store.goods.entity.OrderStockChange;
+import com.store.goods.vo.OrderStockChangeVO;
+import com.store.goods.service.IOrderStockChangeService;
+import org.springblade.core.boot.ctrl.BladeController;
+
+/**
+ * 库存变动表 控制器
+ *
+ * @author BladeX
+ * @since 2021-11-24
+ */
+@RestController
+@AllArgsConstructor
+@RequestMapping("/orderstockchange")
+@Api(value = "库存变动表", tags = "库存变动表接口")
+public class OrderStockChangeController extends BladeController {
+
+	private final IOrderStockChangeService orderStockChangeService;
+
+	/**
+	 * 详情
+	 */
+	@GetMapping("/detail")
+	@ApiOperationSupport(order = 1)
+	@ApiOperation(value = "详情", notes = "传入orderStockChange")
+	public R<OrderStockChange> detail(OrderStockChange orderStockChange) {
+		OrderStockChange detail = orderStockChangeService.getOne(Condition.getQueryWrapper(orderStockChange));
+		return R.data(detail);
+	}
+
+	/**
+	 * 分页 库存变动表
+	 */
+	@GetMapping("/list")
+	@ApiOperationSupport(order = 2)
+	@ApiOperation(value = "分页", notes = "传入orderStockChange")
+	public R<IPage<OrderStockChange>> list(OrderStockChange orderStockChange, Query query) {
+		IPage<OrderStockChange> pages = orderStockChangeService.page(Condition.getPage(query), Condition.getQueryWrapper(orderStockChange));
+		return R.data(pages);
+	}
+
+	/**
+	 * 自定义分页 库存变动表
+	 */
+	@GetMapping("/page")
+	@ApiOperationSupport(order = 3)
+	@ApiOperation(value = "分页", notes = "传入orderStockChange")
+	public R<IPage<OrderStockChangeVO>> page(OrderStockChangeVO orderStockChange, Query query) {
+		IPage<OrderStockChangeVO> pages = orderStockChangeService.selectOrderStockChangePage(Condition.getPage(query), orderStockChange);
+		return R.data(pages);
+	}
+
+	/**
+	 * 新增 库存变动表
+	 */
+	@PostMapping("/save")
+	@ApiOperationSupport(order = 4)
+	@ApiOperation(value = "新增", notes = "传入orderStockChange")
+	public R save(@Valid @RequestBody OrderStockChange orderStockChange) {
+		return R.status(orderStockChangeService.save(orderStockChange));
+	}
+
+	/**
+	 * 修改 库存变动表
+	 */
+	@PostMapping("/update")
+	@ApiOperationSupport(order = 5)
+	@ApiOperation(value = "修改", notes = "传入orderStockChange")
+	public R update(@Valid @RequestBody OrderStockChange orderStockChange) {
+		return R.status(orderStockChangeService.updateById(orderStockChange));
+	}
+
+	/**
+	 * 新增或修改 库存变动表
+	 */
+	@PostMapping("/submit")
+	@ApiOperationSupport(order = 6)
+	@ApiOperation(value = "新增或修改", notes = "传入orderStockChange")
+	public R submit(@Valid @RequestBody OrderStockChange orderStockChange) {
+		return R.status(orderStockChangeService.saveOrUpdate(orderStockChange));
+	}
+
+	
+	/**
+	 * 删除 库存变动表
+	 */
+	@PostMapping("/remove")
+	@ApiOperationSupport(order = 8)
+	@ApiOperation(value = "删除", notes = "传入ids")
+	public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
+		return R.status(orderStockChangeService.removeByIds(Func.toLongList(ids)));
+	}
+
+	
+}

+ 2 - 0
blade-service/store-goods/src/main/java/com/store/goods/entity/GoodsType.java

@@ -118,5 +118,7 @@ public class GoodsType implements Serializable {
 		@TableLogic
 		private Integer isDeleted;
 
+	   @ApiModelProperty(value = "图标")
+		private String picture;
 
 }

+ 42 - 0
blade-service/store-goods/src/main/java/com/store/goods/mapper/OrderAddressMapper.java

@@ -0,0 +1,42 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package com.store.goods.mapper;
+
+import com.store.goods.entity.OrderAddress;
+import com.store.goods.vo.OrderAddressVO;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import java.util.List;
+
+/**
+ * 订单收货地址表 Mapper 接口
+ *
+ * @author BladeX
+ * @since 2021-11-24
+ */
+public interface OrderAddressMapper extends BaseMapper<OrderAddress> {
+
+	/**
+	 * 自定义分页
+	 *
+	 * @param page
+	 * @param orderAddress
+	 * @return
+	 */
+	List<OrderAddressVO> selectOrderAddressPage(IPage page, OrderAddressVO orderAddress);
+
+}

+ 27 - 0
blade-service/store-goods/src/main/java/com/store/goods/mapper/OrderAddressMapper.xml

@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.store.goods.mapper.OrderAddressMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="orderAddressResultMap" type="com.store.goods.entity.OrderAddress">
+        <id column="id" property="id"/>
+        <result column="user_id" property="userId"/>
+        <result column="user_real_name" property="userRealName"/>
+        <result column="user_phone" property="userPhone"/>
+        <result column="address" property="address"/>
+        <result column="version" property="version"/>
+        <result column="create_user" property="createUser"/>
+        <result column="create_dept" property="createDept"/>
+        <result column="create_time" property="createTime"/>
+        <result column="update_user" property="updateUser"/>
+        <result column="update_time" property="updateTime"/>
+        <result column="status" property="status"/>
+        <result column="is_deleted" property="isDeleted"/>
+    </resultMap>
+
+
+    <select id="selectOrderAddressPage" resultMap="orderAddressResultMap">
+        select * from store_order_address where is_deleted = 0
+    </select>
+
+</mapper>

+ 42 - 0
blade-service/store-goods/src/main/java/com/store/goods/mapper/OrderItemsMapper.java

@@ -0,0 +1,42 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package com.store.goods.mapper;
+
+import com.store.goods.entity.OrderItems;
+import com.store.goods.vo.OrderItemsVO;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import java.util.List;
+
+/**
+ * 订单商品表 Mapper 接口
+ *
+ * @author BladeX
+ * @since 2021-11-24
+ */
+public interface OrderItemsMapper extends BaseMapper<OrderItems> {
+
+	/**
+	 * 自定义分页
+	 *
+	 * @param page
+	 * @param orderItems
+	 * @return
+	 */
+	List<OrderItemsVO> selectOrderItemsPage(IPage page, OrderItemsVO orderItems);
+
+}

+ 27 - 0
blade-service/store-goods/src/main/java/com/store/goods/mapper/OrderItemsMapper.xml

@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.store.goods.mapper.OrderItemsMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="orderItemsResultMap" type="com.store.goods.entity.OrderItems">
+        <id column="id" property="id"/>
+        <result column="order_id" property="orderId"/>
+        <result column="items_id" property="itemsId"/>
+        <result column="number" property="number"/>
+        <result column="price" property="price"/>
+        <result column="total_price" property="totalPrice"/>
+        <result column="version" property="version"/>
+        <result column="create_user" property="createUser"/>
+        <result column="create_dept" property="createDept"/>
+        <result column="create_time" property="createTime"/>
+        <result column="update_user" property="updateUser"/>
+        <result column="update_time" property="updateTime"/>
+        <result column="is_deleted" property="isDeleted"/>
+    </resultMap>
+
+
+    <select id="selectOrderItemsPage" resultMap="orderItemsResultMap">
+        select * from store_order_items where is_deleted = 0
+    </select>
+
+</mapper>

+ 42 - 0
blade-service/store-goods/src/main/java/com/store/goods/mapper/OrderMapper.java

@@ -0,0 +1,42 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package com.store.goods.mapper;
+
+import com.store.goods.entity.Order;
+import com.store.goods.vo.OrderVO;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import java.util.List;
+
+/**
+ * 订单表 Mapper 接口
+ *
+ * @author BladeX
+ * @since 2021-11-24
+ */
+public interface OrderMapper extends BaseMapper<Order> {
+
+	/**
+	 * 自定义分页
+	 *
+	 * @param page
+	 * @param order
+	 * @return
+	 */
+	List<OrderVO> selectOrderPage(IPage page, OrderVO order);
+
+}

+ 31 - 0
blade-service/store-goods/src/main/java/com/store/goods/mapper/OrderMapper.xml

@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.store.goods.mapper.OrderMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="orderResultMap" type="com.store.goods.entity.Order">
+        <id column="id" property="id"/>
+        <result column="order_no" property="orderNo"/>
+        <result column="user_id" property="userId"/>
+        <result column="item_ids" property="itemIds"/>
+        <result column="address_id" property="addressId"/>
+        <result column="total_price" property="totalPrice"/>
+        <result column="discount" property="discount"/>
+        <result column="freight" property="freight"/>
+        <result column="actual_price" property="actualPrice"/>
+        <result column="order_status" property="orderStatus"/>
+        <result column="version" property="version"/>
+        <result column="create_user" property="createUser"/>
+        <result column="create_dept" property="createDept"/>
+        <result column="create_time" property="createTime"/>
+        <result column="update_user" property="updateUser"/>
+        <result column="update_time" property="updateTime"/>
+        <result column="is_deleted" property="isDeleted"/>
+    </resultMap>
+
+
+    <select id="selectOrderPage" resultMap="orderResultMap">
+        select * from store_order where is_deleted = 0
+    </select>
+
+</mapper>

+ 42 - 0
blade-service/store-goods/src/main/java/com/store/goods/mapper/OrderStatusChangeMapper.java

@@ -0,0 +1,42 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package com.store.goods.mapper;
+
+import com.store.goods.entity.OrderStatusChange;
+import com.store.goods.vo.OrderStatusChangeVO;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import java.util.List;
+
+/**
+ * 订单状态变动表 Mapper 接口
+ *
+ * @author BladeX
+ * @since 2021-11-24
+ */
+public interface OrderStatusChangeMapper extends BaseMapper<OrderStatusChange> {
+
+	/**
+	 * 自定义分页
+	 *
+	 * @param page
+	 * @param orderStatusChange
+	 * @return
+	 */
+	List<OrderStatusChangeVO> selectOrderStatusChangePage(IPage page, OrderStatusChangeVO orderStatusChange);
+
+}

+ 25 - 0
blade-service/store-goods/src/main/java/com/store/goods/mapper/OrderStatusChangeMapper.xml

@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.store.goods.mapper.OrderStatusChangeMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="orderStatusChangeResultMap" type="com.store.goods.entity.OrderStatusChange">
+        <id column="id" property="id"/>
+        <result column="order_no" property="orderNo"/>
+        <result column="user_id" property="userId"/>
+        <result column="user_real_name" property="userRealName"/>
+        <result column="operation_type" property="operationType"/>
+        <result column="before_status" property="beforeStatus"/>
+        <result column="after_status" property="afterStatus"/>
+        <result column="version" property="version"/>
+        <result column="create_user" property="createUser"/>
+        <result column="create_dept" property="createDept"/>
+        <result column="create_time" property="createTime"/>
+    </resultMap>
+
+
+    <select id="selectOrderStatusChangePage" resultMap="orderStatusChangeResultMap">
+        select * from store_order_status_change where is_deleted = 0
+    </select>
+
+</mapper>

+ 42 - 0
blade-service/store-goods/src/main/java/com/store/goods/mapper/OrderStockChangeMapper.java

@@ -0,0 +1,42 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package com.store.goods.mapper;
+
+import com.store.goods.entity.OrderStockChange;
+import com.store.goods.vo.OrderStockChangeVO;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import java.util.List;
+
+/**
+ * 库存变动表 Mapper 接口
+ *
+ * @author BladeX
+ * @since 2021-11-24
+ */
+public interface OrderStockChangeMapper extends BaseMapper<OrderStockChange> {
+
+	/**
+	 * 自定义分页
+	 *
+	 * @param page
+	 * @param orderStockChange
+	 * @return
+	 */
+	List<OrderStockChangeVO> selectOrderStockChangePage(IPage page, OrderStockChangeVO orderStockChange);
+
+}

+ 26 - 0
blade-service/store-goods/src/main/java/com/store/goods/mapper/OrderStockChangeMapper.xml

@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.store.goods.mapper.OrderStockChangeMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="orderStockChangeResultMap" type="com.store.goods.entity.OrderStockChange">
+        <id column="id" property="id"/>
+        <result column="order_no" property="orderNo"/>
+        <result column="user_id" property="userId"/>
+        <result column="item_id" property="itemId"/>
+        <result column="user_real_name" property="userRealName"/>
+        <result column="operation_type" property="operationType"/>
+        <result column="before_stock" property="beforeStock"/>
+        <result column="after_stock" property="afterStock"/>
+        <result column="version" property="version"/>
+        <result column="create_user" property="createUser"/>
+        <result column="create_dept" property="createDept"/>
+        <result column="create_time" property="createTime"/>
+    </resultMap>
+
+
+    <select id="selectOrderStockChangePage" resultMap="orderStockChangeResultMap">
+        select * from store_order_stock_change where is_deleted = 0
+    </select>
+
+</mapper>

+ 41 - 0
blade-service/store-goods/src/main/java/com/store/goods/service/IOrderAddressService.java

@@ -0,0 +1,41 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package com.store.goods.service;
+
+import com.store.goods.entity.OrderAddress;
+import com.store.goods.vo.OrderAddressVO;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+
+/**
+ * 订单收货地址表 服务类
+ *
+ * @author BladeX
+ * @since 2021-11-24
+ */
+public interface IOrderAddressService extends IService<OrderAddress> {
+
+	/**
+	 * 自定义分页
+	 *
+	 * @param page
+	 * @param orderAddress
+	 * @return
+	 */
+	IPage<OrderAddressVO> selectOrderAddressPage(IPage<OrderAddressVO> page, OrderAddressVO orderAddress);
+
+}

+ 41 - 0
blade-service/store-goods/src/main/java/com/store/goods/service/IOrderItemsService.java

@@ -0,0 +1,41 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package com.store.goods.service;
+
+import com.store.goods.entity.OrderItems;
+import com.store.goods.vo.OrderItemsVO;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+
+/**
+ * 订单商品表 服务类
+ *
+ * @author BladeX
+ * @since 2021-11-24
+ */
+public interface IOrderItemsService extends IService<OrderItems> {
+
+	/**
+	 * 自定义分页
+	 *
+	 * @param page
+	 * @param orderItems
+	 * @return
+	 */
+	IPage<OrderItemsVO> selectOrderItemsPage(IPage<OrderItemsVO> page, OrderItemsVO orderItems);
+
+}

+ 53 - 0
blade-service/store-goods/src/main/java/com/store/goods/service/IOrderService.java

@@ -0,0 +1,53 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package com.store.goods.service;
+
+import com.store.goods.entity.Order;
+import com.store.goods.vo.OrderVO;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+
+/**
+ * 订单表 服务类
+ *
+ * @author BladeX
+ * @since 2021-11-24
+ */
+public interface IOrderService extends IService<Order> {
+
+	/**
+	 * 自定义分页
+	 *
+	 * @param page
+	 * @param order
+	 * @return
+	 */
+	IPage<OrderVO> selectOrderPage(IPage<OrderVO> page, OrderVO order);
+
+	/**
+	 * 创建订单
+	 * */
+     void createOrder(Order order);
+
+
+     /**
+	  * 修改订单状态
+	  * */
+     void updateOrderStatus(Order order);
+}
+
+

+ 41 - 0
blade-service/store-goods/src/main/java/com/store/goods/service/IOrderStatusChangeService.java

@@ -0,0 +1,41 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package com.store.goods.service;
+
+import com.store.goods.entity.OrderStatusChange;
+import com.store.goods.vo.OrderStatusChangeVO;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+
+/**
+ * 订单状态变动表 服务类
+ *
+ * @author BladeX
+ * @since 2021-11-24
+ */
+public interface IOrderStatusChangeService extends IService<OrderStatusChange> {
+
+	/**
+	 * 自定义分页
+	 *
+	 * @param page
+	 * @param orderStatusChange
+	 * @return
+	 */
+	IPage<OrderStatusChangeVO> selectOrderStatusChangePage(IPage<OrderStatusChangeVO> page, OrderStatusChangeVO orderStatusChange);
+
+}

+ 41 - 0
blade-service/store-goods/src/main/java/com/store/goods/service/IOrderStockChangeService.java

@@ -0,0 +1,41 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package com.store.goods.service;
+
+import com.store.goods.entity.OrderStockChange;
+import com.store.goods.vo.OrderStockChangeVO;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+
+/**
+ * 库存变动表 服务类
+ *
+ * @author BladeX
+ * @since 2021-11-24
+ */
+public interface IOrderStockChangeService extends IService<OrderStockChange> {
+
+	/**
+	 * 自定义分页
+	 *
+	 * @param page
+	 * @param orderStockChange
+	 * @return
+	 */
+	IPage<OrderStockChangeVO> selectOrderStockChangePage(IPage<OrderStockChangeVO> page, OrderStockChangeVO orderStockChange);
+
+}

+ 41 - 0
blade-service/store-goods/src/main/java/com/store/goods/service/impl/OrderAddressServiceImpl.java

@@ -0,0 +1,41 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package com.store.goods.service.impl;
+
+import com.store.goods.entity.OrderAddress;
+import com.store.goods.vo.OrderAddressVO;
+import com.store.goods.mapper.OrderAddressMapper;
+import com.store.goods.service.IOrderAddressService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+
+/**
+ * 订单收货地址表 服务实现类
+ *
+ * @author BladeX
+ * @since 2021-11-24
+ */
+@Service
+public class OrderAddressServiceImpl extends ServiceImpl<OrderAddressMapper, OrderAddress> implements IOrderAddressService {
+
+	@Override
+	public IPage<OrderAddressVO> selectOrderAddressPage(IPage<OrderAddressVO> page, OrderAddressVO orderAddress) {
+		return page.setRecords(baseMapper.selectOrderAddressPage(page, orderAddress));
+	}
+
+}

+ 41 - 0
blade-service/store-goods/src/main/java/com/store/goods/service/impl/OrderItemsServiceImpl.java

@@ -0,0 +1,41 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package com.store.goods.service.impl;
+
+import com.store.goods.entity.OrderItems;
+import com.store.goods.vo.OrderItemsVO;
+import com.store.goods.mapper.OrderItemsMapper;
+import com.store.goods.service.IOrderItemsService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+
+/**
+ * 订单商品表 服务实现类
+ *
+ * @author BladeX
+ * @since 2021-11-24
+ */
+@Service
+public class OrderItemsServiceImpl extends ServiceImpl<OrderItemsMapper, OrderItems> implements IOrderItemsService {
+
+	@Override
+	public IPage<OrderItemsVO> selectOrderItemsPage(IPage<OrderItemsVO> page, OrderItemsVO orderItems) {
+		return page.setRecords(baseMapper.selectOrderItemsPage(page, orderItems));
+	}
+
+}

+ 165 - 0
blade-service/store-goods/src/main/java/com/store/goods/service/impl/OrderServiceImpl.java

@@ -0,0 +1,165 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package com.store.goods.service.impl;
+
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
+import com.store.goods.entity.*;
+import com.store.goods.mapper.*;
+import com.store.goods.vo.OrderVO;
+import com.store.goods.service.IOrderService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springblade.core.secure.utils.AuthUtil;
+import org.springblade.core.tool.utils.Func;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.math.BigDecimal;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.Random;
+
+/**
+ * 订单表 服务实现类
+ *
+ * @author BladeX
+ * @since 2021-11-24
+ */
+@Service
+public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements IOrderService
+{
+	@Autowired
+	private OrderAddressMapper addressMapper;
+
+	@Autowired
+	private OrderStatusChangeMapper orderStatusChangeMapper;
+
+	@Autowired
+	private OrderStockChangeMapper orderStockChangeMapper;
+
+	@Autowired
+	private OrderItemsMapper orderItemsMapper;
+
+	@Autowired
+	private GoodsItemsMapper goodsItemsMapper;
+
+	@Override
+	public IPage<OrderVO> selectOrderPage(IPage<OrderVO> page, OrderVO order) {
+		return page.setRecords(baseMapper.selectOrderPage(page, order));
+	}
+
+	@Override
+	@Transactional
+	public void createOrder(Order order)
+	{
+		//获取订单商品信息
+		List<OrderItems> itemList = order.getItemList();
+		if(CollectionUtils.isEmpty(itemList))
+		{
+			throw new SecurityException("订单信息不能为空");
+		}
+		//检查地址是否正确
+		OrderAddress orderAddress = addressMapper.selectById(order.getAddressId());
+		if(orderAddress==null || orderAddress.getUserId()!=order.getUserId())
+		{
+			throw new SecurityException("地址信息不正确");
+		}
+		//新增订单
+		order.setCreateTime(new Date());
+		order.setTenantId(AuthUtil.getTenantId());
+		order.setCreateUser(AuthUtil.getUserId());
+		order.setOrderStatus(order.getOrderStatus());
+		order.setOrderNo(String.valueOf(System.currentTimeMillis()));
+		baseMapper.insert(order);
+		//新增订单下的物品明细
+		itemList.forEach(e->{
+			e.setOrderId(order.getId());
+			e.setItemsId(e.getItemsId());
+			e.setNumber(e.getNumber());
+			e.setPrice(e.getPrice());
+			e.setTotalPrice(e.getTotalPrice());
+			e.setCreateTime(new Date());
+			e.setTenantId(AuthUtil.getTenantId());
+			e.setCreateUser(AuthUtil.getUserId());
+			e.setIsDeleted(0);
+			orderItemsMapper.insert(e);
+
+			//查看库存
+			GoodsItems goodsItems = goodsItemsMapper.selectById(e.getItemsId());
+			if(goodsItems==null || goodsItems.getStock().compareTo(e.getNumber())==-1)
+			{
+                throw new SecurityException("扣除商品库存失败");
+			}
+			//原库存
+			BigDecimal originStock = goodsItems.getStock();
+            //新库存
+			BigDecimal newStock=originStock.subtract(e.getNumber());
+			//增加库存变动记录
+			OrderStockChange stockChange=new OrderStockChange();
+			stockChange.setBeforeStock(originStock);
+			stockChange.setAfterStock(newStock);
+			stockChange.setItemId(e.getItemsId());
+			stockChange.setOrderNo(order.getOrderNo());
+			stockChange.setUserId(AuthUtil.getUserId());
+			stockChange.setOperationType(1);
+			stockChange.setUserRealName(AuthUtil.getUserName());
+			stockChange.setCreateTime(new Date());
+			stockChange.setTenantId(AuthUtil.getTenantId());
+			stockChange.setCreateUser(AuthUtil.getUserId());
+			orderStockChangeMapper.insert(stockChange);
+			//开始扣库存
+			goodsItems.setStock(newStock);
+			goodsItems.setUpdateTime(new Date());
+			goodsItems.setUpdateUser(AuthUtil.getUserId());
+			goodsItemsMapper.updateById(goodsItems);
+
+		});
+
+
+
+
+	}
+
+	@Override
+	@Transactional
+	public void updateOrderStatus(Order order)
+	{
+		Order one = baseMapper.selectById(order.getId());
+		if(!AuthUtil.getTenantId().equals(one.getTenantId()))
+		{
+			throw new SecurityException("非自家租户禁止操作");
+		}
+		//修改订单状态
+		one.setOrderStatus(order.getOrderStatus());
+		baseMapper.updateById(one);
+		//记录变更记录
+		OrderStatusChange orderStatusChange=new OrderStatusChange();
+		orderStatusChange.setBeforeStatus(one.getOrderStatus());
+		orderStatusChange.setAfterStatus(order.getOrderStatus());
+		orderStatusChange.setOrderNo(one.getOrderNo());
+		orderStatusChange.setUserId(AuthUtil.getUserId());
+		orderStatusChange.setUserRealName(AuthUtil.getUserName());
+		orderStatusChange.setCreateTime(new Date());
+		orderStatusChange.setTenantId(AuthUtil.getTenantId());
+		orderStatusChange.setCreateUser(AuthUtil.getUserId());
+		orderStatusChangeMapper.insert(orderStatusChange);
+
+	}
+
+}

+ 41 - 0
blade-service/store-goods/src/main/java/com/store/goods/service/impl/OrderStatusChangeServiceImpl.java

@@ -0,0 +1,41 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package com.store.goods.service.impl;
+
+import com.store.goods.entity.OrderStatusChange;
+import com.store.goods.vo.OrderStatusChangeVO;
+import com.store.goods.mapper.OrderStatusChangeMapper;
+import com.store.goods.service.IOrderStatusChangeService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+
+/**
+ * 订单状态变动表 服务实现类
+ *
+ * @author BladeX
+ * @since 2021-11-24
+ */
+@Service
+public class OrderStatusChangeServiceImpl extends ServiceImpl<OrderStatusChangeMapper, OrderStatusChange> implements IOrderStatusChangeService {
+
+	@Override
+	public IPage<OrderStatusChangeVO> selectOrderStatusChangePage(IPage<OrderStatusChangeVO> page, OrderStatusChangeVO orderStatusChange) {
+		return page.setRecords(baseMapper.selectOrderStatusChangePage(page, orderStatusChange));
+	}
+
+}

+ 41 - 0
blade-service/store-goods/src/main/java/com/store/goods/service/impl/OrderStockChangeServiceImpl.java

@@ -0,0 +1,41 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package com.store.goods.service.impl;
+
+import com.store.goods.entity.OrderStockChange;
+import com.store.goods.vo.OrderStockChangeVO;
+import com.store.goods.mapper.OrderStockChangeMapper;
+import com.store.goods.service.IOrderStockChangeService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+
+/**
+ * 库存变动表 服务实现类
+ *
+ * @author BladeX
+ * @since 2021-11-24
+ */
+@Service
+public class OrderStockChangeServiceImpl extends ServiceImpl<OrderStockChangeMapper, OrderStockChange> implements IOrderStockChangeService {
+
+	@Override
+	public IPage<OrderStockChangeVO> selectOrderStockChangePage(IPage<OrderStockChangeVO> page, OrderStockChangeVO orderStockChange) {
+		return page.setRecords(baseMapper.selectOrderStockChangePage(page, orderStockChange));
+	}
+
+}

+ 31 - 1
blade-service/trade-purchase/src/main/java/com/trade/purchase/order/component/impl/DefaultOrderSaveImpl.java

@@ -15,9 +15,14 @@ import com.trade.purchase.order.mapper.OrderItemsMapper;
 import com.trade.purchase.order.mapper.OrderMapper;
 import com.trade.purchase.order.vo.OrderItemsVO;
 import lombok.AllArgsConstructor;
+import org.springblade.client.entity.CorpsDesc;
+import org.springblade.client.feign.ICorpsDescClient;
+import org.springblade.client.feign.ISerialClient;
 import org.springblade.core.secure.utils.AuthUtil;
+import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.utils.Func;
 import org.springframework.stereotype.Component;
+import org.springframework.transaction.interceptor.TransactionAspectSupport;
 
 import java.util.Date;
 import java.util.List;
@@ -44,6 +49,9 @@ public class DefaultOrderSaveImpl implements IOrderSave {
 
 	private final OrderItemMapstructMapper orderItemMapstructMapper;
 
+	private ISerialClient serialClient;//生成系统编号
+
+	private ICorpsDescClient corpsDescClient;//获取客户信息
 
 	/**
 	 * 订单暂存
@@ -81,7 +89,29 @@ public class DefaultOrderSaveImpl implements IOrderSave {
 		if (Func.isEmpty(order.getBusinesDate())) {
 			order.setBusinesDate(new Date());
 		}
-		if (Objects.isNull(order.getId())) {
+		//新增采购订单
+		if (Objects.isNull(order.getId()))
+		{
+			//生成系统编号
+			R billNo = serialClient.getBillNo(order.getBillType(),order.getTradeType());
+			if (billNo.getCode() != 200){
+				TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+				throw new SecurityException("生成系统编号失败");
+			}
+			order.setSysNo((String) billNo.getData());
+			R<CorpsDesc> corpMessage = corpsDescClient.getCorpMessage(order.getCorpId());
+			//生成订单号
+			R clientBillNo = serialClient.getBillNo(corpMessage.getData().getCode(),order.getTradeType());
+			if (!clientBillNo.isSuccess()){
+				TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+				throw new SecurityException("生成订单号失败");
+			}
+			order.setOrderNo((String) clientBillNo.getData());
+			//判断贸易类型
+			if(order.getTradeType().equals("JK"))
+			{
+				order.setOrgOrderNo(order.getOrderNo());
+			}
 			order.setCreateTime(new Date());
 			order.setCreateUser(AuthUtil.getUserId());
 			orderService.insert(order);

+ 2 - 0
blade-service/trade-purchase/src/main/java/com/trade/purchase/order/controller/PurchaseOrderController.java

@@ -88,6 +88,7 @@ public class PurchaseOrderController extends BladeController {
 	@ApiOperation(value = "采购订单表列表(内贸 外贸 出口)", notes = "传入order")
 	public R<?> list( @RequestParam(name = "current", defaultValue = "1") Integer current,
 								 @RequestParam(name = "size", defaultValue = "10") Integer size,
+					 			 @RequestParam(value = "billNo",required = false) String billNo,//提单号
 								 @RequestParam(value = "strCorpName",required = false) String strCorpName,//供应商名称
 								 @RequestParam(value = "strPurchaserName",required = false) String strPurchaserName,//采购商名称
 								 @RequestParam(value = "businesStartDate",required = false) String businesStartDate,//订单开始时间
@@ -140,6 +141,7 @@ public class PurchaseOrderController extends BladeController {
 		queryWrapper.eq("tenant_id",AuthUtil.getTenantId());
 		queryWrapper.eq("bill_type",OrderTypeEnum.PURCHASE.getType());
 		queryWrapper.eq("trade_type",order.getTradeType());
+		queryWrapper.apply(StringUtils.isNotBlank(billNo),"find_in_set('"+billNo+"',bill_no)");
 		queryWrapper.between(StringUtils.isNotBlank(businesStartDate)&&StringUtils.isNotBlank(businesEndDate),"busines_date",businesStartDate,businesEndDate);
 		queryWrapper.between(StringUtils.isNotBlank(accountsCollectionStartDate)&&StringUtils.isNotBlank(accountsCollectionEndDate),"accounts_collection_date",accountsCollectionStartDate,accountsCollectionEndDate);
 		queryWrapper.between(StringUtils.isNotBlank(dateOfStartArrival)&&StringUtils.isNotBlank(dateOfEndArrival),"arrival_date",dateOfStartArrival,dateOfEndArrival);