Browse Source

出口贸易 商品信息加配件信息

lazhaoqian 4 years ago
parent
commit
89fd6a2722
18 changed files with 975 additions and 1 deletions
  1. 12 0
      blade-service-api/blade-purchase-sales-api/src/main/java/org/springblade/purchase/sales/entity/OrderItems.java
  2. 141 0
      blade-service-api/blade-purchase-sales-api/src/main/java/org/springblade/purchase/sales/entity/OrderParts.java
  3. 36 0
      blade-service-api/blade-purchase-sales-api/src/main/java/org/springblade/purchase/sales/vo/OrderPartsVO.java
  4. 12 0
      blade-service-api/trade-purchase-api/src/main/java/com/trade/purchase/order/entity/OrderItems.java
  5. 142 0
      blade-service-api/trade-purchase-api/src/main/java/com/trade/purchase/order/entity/OrderParts.java
  6. 36 0
      blade-service-api/trade-purchase-api/src/main/java/com/trade/purchase/order/vo/OrderPartsVO.java
  7. 126 0
      blade-service/blade-purchase-sales/src/main/java/org/springblade/purchase/sales/controller/OrderPartsController.java
  8. 42 0
      blade-service/blade-purchase-sales/src/main/java/org/springblade/purchase/sales/mapper/OrderPartsMapper.java
  9. 31 0
      blade-service/blade-purchase-sales/src/main/java/org/springblade/purchase/sales/mapper/OrderPartsMapper.xml
  10. 41 0
      blade-service/blade-purchase-sales/src/main/java/org/springblade/purchase/sales/service/IOrderPartsService.java
  11. 33 0
      blade-service/blade-purchase-sales/src/main/java/org/springblade/purchase/sales/service/impl/OrderItemsServiceImpl.java
  12. 41 0
      blade-service/blade-purchase-sales/src/main/java/org/springblade/purchase/sales/service/impl/OrderPartsServiceImpl.java
  13. 1 1
      blade-service/blade-purchase-sales/src/main/java/org/springblade/purchase/sales/service/impl/OrderServiceImpl.java
  14. 126 0
      blade-service/trade-purchase/src/main/java/com/trade/purchase/order/controller/OrderPartsController.java
  15. 42 0
      blade-service/trade-purchase/src/main/java/com/trade/purchase/order/mapper/OrderPartsMapper.java
  16. 31 0
      blade-service/trade-purchase/src/main/java/com/trade/purchase/order/mapper/OrderPartsMapper.xml
  17. 41 0
      blade-service/trade-purchase/src/main/java/com/trade/purchase/order/service/IOrderPartsService.java
  18. 41 0
      blade-service/trade-purchase/src/main/java/com/trade/purchase/order/service/impl/OrderPartsServiceImpl.java

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

@@ -26,6 +26,7 @@ import lombok.Data;
 import java.io.Serializable;
 import java.math.BigDecimal;
 import java.util.Date;
+import java.util.List;
 
 /**
  * 订单明细表实体类
@@ -348,5 +349,16 @@ public class OrderItems implements Serializable {
 	 */
 	@ApiModelProperty(value = "供应商名称")
 	private String corpName;
+	/**
+	 * 配件金额
+	 */
+	@ApiModelProperty(value = "配件金额")
+	private BigDecimal partsPrice;
+	/**
+	 * 配件信息
+	 */
+	@ApiModelProperty(value = "配件信息")
+	@TableField(exist = false)
+	private List<OrderParts> partsList;
 
 }

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

@@ -0,0 +1,141 @@
+/*
+ *      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 org.springblade.purchase.sales.entity;
+
+import java.math.BigDecimal;
+
+import com.baomidou.mybatisplus.annotation.TableLogic;
+import com.baomidou.mybatisplus.annotation.TableName;
+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-12-03
+ */
+@Data
+@TableName("business_order_parts")
+@ApiModel(value = "OrderParts对象", description = "订单配件表 订单明细的子表")
+public class OrderParts implements Serializable {
+
+	private static final long serialVersionUID = 1L;
+
+	/**
+	* 主键
+	*/
+		@ApiModelProperty(value = "主键")
+		private Long id;
+	/**
+	* 主表id
+	*/
+		@ApiModelProperty(value = "主表id")
+		private Long pid;
+	/**
+	* 商品id
+	*/
+		@ApiModelProperty(value = "商品id")
+		private Long goodId;
+	/**
+	* 商品名称
+	*/
+		@ApiModelProperty(value = "商品名称")
+		private String goodName;
+	/**
+	* 单价
+	*/
+		@ApiModelProperty(value = "单价")
+		private BigDecimal price;
+	/**
+	* 数量
+	*/
+		@ApiModelProperty(value = "数量")
+		private BigDecimal goodNumber;
+	/**
+	* 金额
+	*/
+		@ApiModelProperty(value = "金额")
+		private BigDecimal amout;
+	/**
+	 * 商品类型名称
+	 */
+		@ApiModelProperty(value = "商品类型名称")
+		private String goodTypeName;
+	/**
+	 * 商品类型id
+	 */
+		@ApiModelProperty(value = "商品类型id")
+		private Long goodTypeId;
+	/**
+	* 备注
+	*/
+		@ApiModelProperty(value = "备注")
+		private String remarks;
+	/**
+	* 版本
+	*/
+		@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是)
+	*/
+		@TableLogic
+		@ApiModelProperty(value = "是否已删除(0 否 1是)")
+		private Integer isDeleted;
+	/**
+	 * 租户id
+	 */
+		@ApiModelProperty(value = "租户id")
+		private String tenantId;
+
+}

+ 36 - 0
blade-service-api/blade-purchase-sales-api/src/main/java/org/springblade/purchase/sales/vo/OrderPartsVO.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 org.springblade.purchase.sales.vo;
+
+import org.springblade.purchase.sales.entity.OrderParts;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import io.swagger.annotations.ApiModel;
+
+/**
+ * 订单配件表 订单明细的子表视图实体类
+ *
+ * @author BladeX
+ * @since 2021-12-03
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ApiModel(value = "OrderPartsVO对象", description = "订单配件表 订单明细的子表")
+public class OrderPartsVO extends OrderParts {
+	private static final long serialVersionUID = 1L;
+
+}

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

@@ -11,6 +11,7 @@ import lombok.Data;
 import java.io.Serializable;
 import java.math.BigDecimal;
 import java.util.Date;
+import java.util.List;
 
 /**
  * 订单明细表实体类
@@ -327,4 +328,15 @@ public class OrderItems extends OrderBase {
 	 */
 	@ApiModelProperty(value = "供应商名称")
 	private String corpName;
+	/**
+	 * 配件金额
+	 */
+	@ApiModelProperty(value = "配件金额")
+	private BigDecimal partsPrice;
+	/**
+	 * 配件信息
+	 */
+	@ApiModelProperty(value = "配件信息")
+	@TableField(exist = false)
+	private List<OrderParts> partsList;
 }

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

@@ -0,0 +1,142 @@
+/*
+ *      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.trade.purchase.order.entity;
+
+import java.math.BigDecimal;
+
+import com.baomidou.mybatisplus.annotation.TableLogic;
+import com.baomidou.mybatisplus.annotation.TableName;
+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-12-03
+ */
+@Data
+@TableName("business_order_parts")
+@ApiModel(value = "OrderParts对象", description = "订单配件表 订单明细的子表")
+public class OrderParts implements Serializable {
+
+	private static final long serialVersionUID = 1L;
+
+	/**
+	* 主键
+	*/
+		@ApiModelProperty(value = "主键")
+		private Long id;
+	/**
+	* 主表id
+	*/
+		@ApiModelProperty(value = "主表id")
+		private Long pid;
+	/**
+	* 商品id
+	*/
+		@ApiModelProperty(value = "商品id")
+		private Long goodId;
+	/**
+	* 商品名称
+	*/
+		@ApiModelProperty(value = "商品名称")
+		private String goodName;
+	/**
+	* 单价
+	*/
+		@ApiModelProperty(value = "单价")
+		private BigDecimal price;
+	/**
+	* 数量
+	*/
+		@ApiModelProperty(value = "数量")
+		private BigDecimal goodNumber;
+	/**
+	* 金额
+	*/
+		@ApiModelProperty(value = "金额")
+		private BigDecimal amout;
+	/**
+	* 商品类型名称
+	*/
+		@ApiModelProperty(value = "商品类型名称")
+		private String goodTypeName;
+	/**
+	 * 商品类型id
+	 */
+		@ApiModelProperty(value = "商品类型id")
+		private Long goodTypeId;
+	/**
+	* 备注
+	*/
+		@ApiModelProperty(value = "备注")
+		private String remarks;
+	/**
+	* 版本
+	*/
+		@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是)
+	*/
+		@TableLogic
+		@ApiModelProperty(value = "是否已删除(0 否 1是)")
+		private Integer isDeleted;
+	/**
+	 * 租户id
+	 */
+		@ApiModelProperty(value = "租户id")
+		private String tenantId;
+
+
+}

+ 36 - 0
blade-service-api/trade-purchase-api/src/main/java/com/trade/purchase/order/vo/OrderPartsVO.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.trade.purchase.order.vo;
+
+import com.trade.purchase.order.entity.OrderParts;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import io.swagger.annotations.ApiModel;
+
+/**
+ * 订单配件表 订单明细的子表视图实体类
+ *
+ * @author BladeX
+ * @since 2021-12-03
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ApiModel(value = "OrderPartsVO对象", description = "订单配件表 订单明细的子表")
+public class OrderPartsVO extends OrderParts {
+	private static final long serialVersionUID = 1L;
+
+}

+ 126 - 0
blade-service/blade-purchase-sales/src/main/java/org/springblade/purchase/sales/controller/OrderPartsController.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 org.springblade.purchase.sales.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 org.springblade.purchase.sales.entity.OrderParts;
+import org.springblade.purchase.sales.vo.OrderPartsVO;
+import org.springblade.purchase.sales.service.IOrderPartsService;
+import org.springblade.core.boot.ctrl.BladeController;
+
+/**
+ * 订单配件表 订单明细的子表 控制器
+ *
+ * @author BladeX
+ * @since 2021-12-03
+ */
+@RestController
+@AllArgsConstructor
+@RequestMapping("/orderparts")
+@Api(value = "订单配件表 订单明细的子表", tags = "订单配件表 订单明细的子表接口")
+public class OrderPartsController extends BladeController {
+
+	private final IOrderPartsService orderPartsService;
+
+	/**
+	 * 详情
+	 */
+	@GetMapping("/detail")
+	@ApiOperationSupport(order = 1)
+	@ApiOperation(value = "详情", notes = "传入orderParts")
+	public R<OrderParts> detail(OrderParts orderParts) {
+		OrderParts detail = orderPartsService.getOne(Condition.getQueryWrapper(orderParts));
+		return R.data(detail);
+	}
+
+	/**
+	 * 分页 订单配件表 订单明细的子表
+	 */
+	@GetMapping("/list")
+	@ApiOperationSupport(order = 2)
+	@ApiOperation(value = "分页", notes = "传入orderParts")
+	public R<IPage<OrderParts>> list(OrderParts orderParts, Query query) {
+		IPage<OrderParts> pages = orderPartsService.page(Condition.getPage(query), Condition.getQueryWrapper(orderParts));
+		return R.data(pages);
+	}
+
+	/**
+	 * 自定义分页 订单配件表 订单明细的子表
+	 */
+	@GetMapping("/page")
+	@ApiOperationSupport(order = 3)
+	@ApiOperation(value = "分页", notes = "传入orderParts")
+	public R<IPage<OrderPartsVO>> page(OrderPartsVO orderParts, Query query) {
+		IPage<OrderPartsVO> pages = orderPartsService.selectOrderPartsPage(Condition.getPage(query), orderParts);
+		return R.data(pages);
+	}
+
+	/**
+	 * 新增 订单配件表 订单明细的子表
+	 */
+	@PostMapping("/save")
+	@ApiOperationSupport(order = 4)
+	@ApiOperation(value = "新增", notes = "传入orderParts")
+	public R save(@Valid @RequestBody OrderParts orderParts) {
+		return R.status(orderPartsService.save(orderParts));
+	}
+
+	/**
+	 * 修改 订单配件表 订单明细的子表
+	 */
+	@PostMapping("/update")
+	@ApiOperationSupport(order = 5)
+	@ApiOperation(value = "修改", notes = "传入orderParts")
+	public R update(@Valid @RequestBody OrderParts orderParts) {
+		return R.status(orderPartsService.updateById(orderParts));
+	}
+
+	/**
+	 * 新增或修改 订单配件表 订单明细的子表
+	 */
+	@PostMapping("/submit")
+	@ApiOperationSupport(order = 6)
+	@ApiOperation(value = "新增或修改", notes = "传入orderParts")
+	public R submit(@Valid @RequestBody OrderParts orderParts) {
+		return R.status(orderPartsService.saveOrUpdate(orderParts));
+	}
+
+	
+	/**
+	 * 删除 订单配件表 订单明细的子表
+	 */
+	@PostMapping("/remove")
+	@ApiOperationSupport(order = 8)
+	@ApiOperation(value = "删除", notes = "传入ids")
+	public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
+		return R.status(orderPartsService.removeByIds(Func.toLongList(ids)));
+	}
+
+	
+}

+ 42 - 0
blade-service/blade-purchase-sales/src/main/java/org/springblade/purchase/sales/mapper/OrderPartsMapper.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 org.springblade.purchase.sales.mapper;
+
+import org.springblade.purchase.sales.entity.OrderParts;
+import org.springblade.purchase.sales.vo.OrderPartsVO;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import java.util.List;
+
+/**
+ * 订单配件表 订单明细的子表 Mapper 接口
+ *
+ * @author BladeX
+ * @since 2021-12-03
+ */
+public interface OrderPartsMapper extends BaseMapper<OrderParts> {
+
+	/**
+	 * 自定义分页
+	 *
+	 * @param page
+	 * @param orderParts
+	 * @return
+	 */
+	List<OrderPartsVO> selectOrderPartsPage(IPage page, OrderPartsVO orderParts);
+
+}

+ 31 - 0
blade-service/blade-purchase-sales/src/main/java/org/springblade/purchase/sales/mapper/OrderPartsMapper.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="org.springblade.purchase.sales.mapper.OrderPartsMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="orderPartsResultMap" type="org.springblade.purchase.sales.entity.OrderParts">
+        <id column="id" property="id"/>
+        <result column="pid" property="pid"/>
+        <result column="good_id" property="goodId"/>
+        <result column="good_name" property="goodName"/>
+        <result column="price" property="price"/>
+        <result column="good_number" property="goodNumber"/>
+        <result column="amout" property="amout"/>
+        <result column="good_type" property="goodType"/>
+        <result column="remarks" property="remarks"/>
+        <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="selectOrderPartsPage" resultMap="orderPartsResultMap">
+        select * from business_order_parts where is_deleted = 0
+    </select>
+
+</mapper>

+ 41 - 0
blade-service/blade-purchase-sales/src/main/java/org/springblade/purchase/sales/service/IOrderPartsService.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 org.springblade.purchase.sales.service;
+
+import org.springblade.purchase.sales.entity.OrderParts;
+import org.springblade.purchase.sales.vo.OrderPartsVO;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+
+/**
+ * 订单配件表 订单明细的子表 服务类
+ *
+ * @author BladeX
+ * @since 2021-12-03
+ */
+public interface IOrderPartsService extends IService<OrderParts> {
+
+	/**
+	 * 自定义分页
+	 *
+	 * @param page
+	 * @param orderParts
+	 * @return
+	 */
+	IPage<OrderPartsVO> selectOrderPartsPage(IPage<OrderPartsVO> page, OrderPartsVO orderParts);
+
+}

+ 33 - 0
blade-service/blade-purchase-sales/src/main/java/org/springblade/purchase/sales/service/impl/OrderItemsServiceImpl.java

@@ -18,6 +18,7 @@ package org.springblade.purchase.sales.service.impl;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
+import com.trade.purchase.order.enums.OrderTypeEnum;
 import lombok.AllArgsConstructor;
 import org.aspectj.weaver.ast.Or;
 import org.springblade.client.entity.GoodsDesc;
@@ -29,6 +30,8 @@ import org.springblade.core.tool.utils.Func;
 import org.springblade.mocha.feign.IPriceItemClient;
 import org.springblade.purchase.sales.entity.Order;
 import org.springblade.purchase.sales.entity.OrderItems;
+import org.springblade.purchase.sales.entity.OrderParts;
+import org.springblade.purchase.sales.mapper.OrderPartsMapper;
 import org.springblade.purchase.sales.vo.OrderItemsVO;
 import org.springblade.purchase.sales.mapper.OrderItemsMapper;
 import org.springblade.purchase.sales.service.IOrderItemsService;
@@ -36,6 +39,8 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.stereotype.Service;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 
+import javax.annotation.Resource;
+import java.math.BigDecimal;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
@@ -51,6 +56,9 @@ import java.util.List;
 public class OrderItemsServiceImpl extends ServiceImpl<OrderItemsMapper, OrderItems> implements IOrderItemsService {
 	private IGoodsDescClient goodsDescClient;//获取商品信息
 	private IPriceItemClient priceItemClient;//价格管理对外接口
+
+	@Resource
+	private OrderPartsMapper orderPartsMapper;
 	@Override
 	public IPage<OrderItemsVO> selectOrderItemsPage(IPage<OrderItemsVO> page, OrderItemsVO orderItems) {
 		return page.setRecords(baseMapper.selectOrderItemsPage(page, orderItems));
@@ -70,6 +78,9 @@ public class OrderItemsServiceImpl extends ServiceImpl<OrderItemsMapper, OrderIt
 	 */
 	public List<OrderItems> saveOrderItemsMessage(List<OrderItems> list, Date date,Long Pid){
 			list.stream().forEach(item ->{
+				if (item.getAmount() == BigDecimal.ZERO){
+					throw new RuntimeException("金额不能为0");
+				}
 				if (item.getId() == null){
 					item.setTenantId(SecureUtil.getTenantId());
 					item.setCreateUser(SecureUtil.getUserId());
@@ -83,6 +94,23 @@ public class OrderItemsServiceImpl extends ServiceImpl<OrderItemsMapper, OrderIt
 					item.setPid(Pid);
 					baseMapper.updateById(item);
 				}
+				//保存配件明细信息
+				if (CollectionUtils.isNotEmpty(item.getPartsList())){
+					item.getPartsList().stream().forEach(parts ->{
+						if (parts.getId() == null){
+							parts.setTenantId(SecureUtil.getTenantId());
+							parts.setCreateTime(new Date());
+							parts.setCreateUser(SecureUtil.getUserId());
+							parts.setPid(item.getId());
+							orderPartsMapper.insert(parts);
+						}else {
+							parts.setUpdateTime(new Date());
+							parts.setUpdateUser(SecureUtil.getUserId());
+							parts.setPid(item.getId());
+							orderPartsMapper.updateById(parts);
+						}
+					});
+				}
 			});
 		return list;
 	}
@@ -113,6 +141,11 @@ public class OrderItemsServiceImpl extends ServiceImpl<OrderItemsMapper, OrderIt
 						item.setSpecificationAndModel(goodsMessage.getData().getSpecificationAndModel());
 					}
 				}
+				//如果是出口贸易获取订单明细的配件信息
+				if (order.getTradeType().equals(OrderTypeEnum.EXPORT.getType())){
+					List<OrderParts> orderParts = orderPartsMapper.selectList(new QueryWrapper<OrderParts>().eq("pid", item.getId()).eq("is_deleted", 0));
+					item.setPartsList(orderParts);
+				}
 			});
 		}
 		return orderItemsList;

+ 41 - 0
blade-service/blade-purchase-sales/src/main/java/org/springblade/purchase/sales/service/impl/OrderPartsServiceImpl.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 org.springblade.purchase.sales.service.impl;
+
+import org.springblade.purchase.sales.entity.OrderParts;
+import org.springblade.purchase.sales.vo.OrderPartsVO;
+import org.springblade.purchase.sales.mapper.OrderPartsMapper;
+import org.springblade.purchase.sales.service.IOrderPartsService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+
+/**
+ * 订单配件表 订单明细的子表 服务实现类
+ *
+ * @author BladeX
+ * @since 2021-12-03
+ */
+@Service
+public class OrderPartsServiceImpl extends ServiceImpl<OrderPartsMapper, OrderParts> implements IOrderPartsService {
+
+	@Override
+	public IPage<OrderPartsVO> selectOrderPartsPage(IPage<OrderPartsVO> page, OrderPartsVO orderParts) {
+		return page.setRecords(baseMapper.selectOrderPartsPage(page, orderParts));
+	}
+
+}

+ 1 - 1
blade-service/blade-purchase-sales/src/main/java/org/springblade/purchase/sales/service/impl/OrderServiceImpl.java

@@ -201,7 +201,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
 			}
 		}
 		//获取订单明细信息
-		List<OrderItems> orderItemsList = orderItemsService.getOrderItems(order);
+		List<OrderItems> orderItemsList = orderItemsService.getOrderItems(orderMessage);
 		orderMessage.setOrderItemsList(orderItemsList);
 		//获取订单费用信息
 		List<OrderFees> orderFeesList = orderFeesService.getOrderFees(order);

+ 126 - 0
blade-service/trade-purchase/src/main/java/com/trade/purchase/order/controller/OrderPartsController.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.trade.purchase.order.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.trade.purchase.order.entity.OrderParts;
+import com.trade.purchase.order.vo.OrderPartsVO;
+import com.trade.purchase.order.service.IOrderPartsService;
+import org.springblade.core.boot.ctrl.BladeController;
+
+/**
+ * 订单配件表 订单明细的子表 控制器
+ *
+ * @author BladeX
+ * @since 2021-12-03
+ */
+@RestController
+@AllArgsConstructor
+@RequestMapping("/orderparts")
+@Api(value = "订单配件表 订单明细的子表", tags = "订单配件表 订单明细的子表接口")
+public class OrderPartsController extends BladeController {
+
+	private final IOrderPartsService orderPartsService;
+
+	/**
+	 * 详情
+	 */
+	@GetMapping("/detail")
+	@ApiOperationSupport(order = 1)
+	@ApiOperation(value = "详情", notes = "传入orderParts")
+	public R<OrderParts> detail(OrderParts orderParts) {
+		OrderParts detail = orderPartsService.getOne(Condition.getQueryWrapper(orderParts));
+		return R.data(detail);
+	}
+
+	/**
+	 * 分页 订单配件表 订单明细的子表
+	 */
+	@GetMapping("/list")
+	@ApiOperationSupport(order = 2)
+	@ApiOperation(value = "分页", notes = "传入orderParts")
+	public R<IPage<OrderParts>> list(OrderParts orderParts, Query query) {
+		IPage<OrderParts> pages = orderPartsService.page(Condition.getPage(query), Condition.getQueryWrapper(orderParts));
+		return R.data(pages);
+	}
+
+	/**
+	 * 自定义分页 订单配件表 订单明细的子表
+	 */
+	@GetMapping("/page")
+	@ApiOperationSupport(order = 3)
+	@ApiOperation(value = "分页", notes = "传入orderParts")
+	public R<IPage<OrderPartsVO>> page(OrderPartsVO orderParts, Query query) {
+		IPage<OrderPartsVO> pages = orderPartsService.selectOrderPartsPage(Condition.getPage(query), orderParts);
+		return R.data(pages);
+	}
+
+	/**
+	 * 新增 订单配件表 订单明细的子表
+	 */
+	@PostMapping("/save")
+	@ApiOperationSupport(order = 4)
+	@ApiOperation(value = "新增", notes = "传入orderParts")
+	public R save(@Valid @RequestBody OrderParts orderParts) {
+		return R.status(orderPartsService.save(orderParts));
+	}
+
+	/**
+	 * 修改 订单配件表 订单明细的子表
+	 */
+	@PostMapping("/update")
+	@ApiOperationSupport(order = 5)
+	@ApiOperation(value = "修改", notes = "传入orderParts")
+	public R update(@Valid @RequestBody OrderParts orderParts) {
+		return R.status(orderPartsService.updateById(orderParts));
+	}
+
+	/**
+	 * 新增或修改 订单配件表 订单明细的子表
+	 */
+	@PostMapping("/submit")
+	@ApiOperationSupport(order = 6)
+	@ApiOperation(value = "新增或修改", notes = "传入orderParts")
+	public R submit(@Valid @RequestBody OrderParts orderParts) {
+		return R.status(orderPartsService.saveOrUpdate(orderParts));
+	}
+
+	
+	/**
+	 * 删除 订单配件表 订单明细的子表
+	 */
+	@PostMapping("/remove")
+	@ApiOperationSupport(order = 8)
+	@ApiOperation(value = "删除", notes = "传入ids")
+	public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
+		return R.status(orderPartsService.removeByIds(Func.toLongList(ids)));
+	}
+
+	
+}

+ 42 - 0
blade-service/trade-purchase/src/main/java/com/trade/purchase/order/mapper/OrderPartsMapper.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.trade.purchase.order.mapper;
+
+import com.trade.purchase.order.entity.OrderParts;
+import com.trade.purchase.order.vo.OrderPartsVO;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import java.util.List;
+
+/**
+ * 订单配件表 订单明细的子表 Mapper 接口
+ *
+ * @author BladeX
+ * @since 2021-12-03
+ */
+public interface OrderPartsMapper extends BaseMapper<OrderParts> {
+
+	/**
+	 * 自定义分页
+	 *
+	 * @param page
+	 * @param orderParts
+	 * @return
+	 */
+	List<OrderPartsVO> selectOrderPartsPage(IPage page, OrderPartsVO orderParts);
+
+}

+ 31 - 0
blade-service/trade-purchase/src/main/java/com/trade/purchase/order/mapper/OrderPartsMapper.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.trade.purchase.order.mapper.OrderPartsMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="orderPartsResultMap" type="com.trade.purchase.order.entity.OrderParts">
+        <id column="id" property="id"/>
+        <result column="pid" property="pid"/>
+        <result column="good_id" property="goodId"/>
+        <result column="good_name" property="goodName"/>
+        <result column="price" property="price"/>
+        <result column="good_number" property="goodNumber"/>
+        <result column="amout" property="amout"/>
+        <result column="good_type" property="goodType"/>
+        <result column="remarks" property="remarks"/>
+        <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="selectOrderPartsPage" resultMap="orderPartsResultMap">
+        select * from business_order_parts where is_deleted = 0
+    </select>
+
+</mapper>

+ 41 - 0
blade-service/trade-purchase/src/main/java/com/trade/purchase/order/service/IOrderPartsService.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.trade.purchase.order.service;
+
+import com.trade.purchase.order.entity.OrderParts;
+import com.trade.purchase.order.vo.OrderPartsVO;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+
+/**
+ * 订单配件表 订单明细的子表 服务类
+ *
+ * @author BladeX
+ * @since 2021-12-03
+ */
+public interface IOrderPartsService extends IService<OrderParts> {
+
+	/**
+	 * 自定义分页
+	 *
+	 * @param page
+	 * @param orderParts
+	 * @return
+	 */
+	IPage<OrderPartsVO> selectOrderPartsPage(IPage<OrderPartsVO> page, OrderPartsVO orderParts);
+
+}

+ 41 - 0
blade-service/trade-purchase/src/main/java/com/trade/purchase/order/service/impl/OrderPartsServiceImpl.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.trade.purchase.order.service.impl;
+
+import com.trade.purchase.order.entity.OrderParts;
+import com.trade.purchase.order.vo.OrderPartsVO;
+import com.trade.purchase.order.mapper.OrderPartsMapper;
+import com.trade.purchase.order.service.IOrderPartsService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+
+/**
+ * 订单配件表 订单明细的子表 服务实现类
+ *
+ * @author BladeX
+ * @since 2021-12-03
+ */
+@Service
+public class OrderPartsServiceImpl extends ServiceImpl<OrderPartsMapper, OrderParts> implements IOrderPartsService {
+
+	@Override
+	public IPage<OrderPartsVO> selectOrderPartsPage(IPage<OrderPartsVO> page, OrderPartsVO orderParts) {
+		return page.setRecords(baseMapper.selectOrderPartsPage(page, orderParts));
+	}
+
+}