Forráskód Böngészése

发货 销售订单接口

lazhaoqian 4 éve
szülő
commit
4dcdc2398e
23 módosított fájl, 312 hozzáadás és 409 törlés
  1. 4 0
      blade-ops-api/blade-flow-api/src/main/java/org/springblade/flow/core/constant/ProcessConstant.java
  2. 6 0
      blade-service-api/blade-client-api/src/main/java/org/springblade/client/entity/GoodsDesc.java
  3. 5 1
      blade-service-api/blade-client-api/src/main/java/org/springblade/client/vo/GoodsDescVO.java
  4. 6 0
      blade-service-api/blade-deliver-goods-api/pom.xml
  5. 10 2
      blade-service-api/blade-deliver-goods-api/src/main/java/org/springblade/deliver/goods/entity/Delivery.java
  6. 23 0
      blade-service-api/blade-deliver-goods-api/src/main/java/org/springblade/deliver/goods/feign/IDeliveryClient.java
  7. 6 0
      blade-service-api/blade-purchase-sales-api/src/main/java/org/springblade/purchase/sales/entity/Order.java
  8. 34 30
      blade-service/blade-client/src/main/java/org/springblade/client/mapper/GoodsDescMapper.xml
  9. 1 1
      blade-service/blade-client/src/main/java/org/springblade/client/service/IGoodsDescService.java
  10. 6 0
      blade-service/blade-deliver-goods/pom.xml
  11. 18 4
      blade-service/blade-deliver-goods/src/main/java/org/springblade/deliver/goods/controller/DeliveryController.java
  12. 11 2
      blade-service/blade-deliver-goods/src/main/java/org/springblade/deliver/goods/controller/DeliveryItemsController.java
  13. 0 195
      blade-service/blade-deliver-goods/src/main/java/org/springblade/deliver/goods/entity/Delivery.java
  14. 0 170
      blade-service/blade-deliver-goods/src/main/java/org/springblade/deliver/goods/entity/DeliveryItems.java
  15. 29 0
      blade-service/blade-deliver-goods/src/main/java/org/springblade/deliver/goods/feign/DeliveryClient.java
  16. 15 0
      blade-service/blade-deliver-goods/src/main/java/org/springblade/deliver/goods/service/IDeliveryService.java
  17. 69 1
      blade-service/blade-deliver-goods/src/main/java/org/springblade/deliver/goods/service/impl/DeliveryServiceImpl.java
  18. 13 0
      blade-service/blade-mocha-item/src/main/java/org/springblade/mocha/controller/SalesPolicyController.java
  19. 7 0
      blade-service/blade-mocha-item/src/main/java/org/springblade/mocha/mapper/SalesPolicyMapper.java
  20. 25 0
      blade-service/blade-mocha-item/src/main/java/org/springblade/mocha/mapper/SalesPolicyMapper.xml
  21. 9 0
      blade-service/blade-mocha-item/src/main/java/org/springblade/mocha/service/ISalesPolicyService.java
  22. 8 0
      blade-service/blade-mocha-item/src/main/java/org/springblade/mocha/service/impl/SalesPolicyServiceImpl.java
  23. 7 3
      blade-service/blade-purchase-sales/src/main/java/org/springblade/purchase/sales/service/impl/OrderServiceImpl.java

+ 4 - 0
blade-ops-api/blade-flow-api/src/main/java/org/springblade/flow/core/constant/ProcessConstant.java

@@ -32,6 +32,10 @@ public interface ProcessConstant {
 	 * 报销流程标识
 	 */
 	String EXPENSE_KEY = "Expense";
+	/**
+	 * 报销流程标识
+	 */
+	String TEST_KEY = "test";
 
 	/**
 	 * 同意标识

+ 6 - 0
blade-service-api/blade-client-api/src/main/java/org/springblade/client/entity/GoodsDesc.java

@@ -158,6 +158,12 @@ public class GoodsDesc implements Serializable {
 	@TableField(exist = false)
 	private String goodsTypeId;
 	/**
+	 *商品类别名称
+	 */
+	@ApiModelProperty(value = "商品类别名称")
+	@TableField(exist = false)
+	private String goodsTypeName;
+	/**
 	 * 规格型号
 	 */
 	@ApiModelProperty(value = "规格型号")

+ 5 - 1
blade-service-api/blade-client-api/src/main/java/org/springblade/client/vo/GoodsDescVO.java

@@ -25,10 +25,14 @@ public class GoodsDescVO extends GoodsDesc {
 	@ApiModelProperty(value = "商品类别")
 	private String goodsTypeId;
 	/**
+	 *商品类别名称
+	 */
+	@ApiModelProperty(value = "商品类别名称")
+	private String goodsTypeName;
+	/**
 	 * 规格型号
 	 */
 	@ApiModelProperty(value = "规格型号")
-	@TableField(exist = false)
 	private String specificationAndModel;
 
 }

+ 6 - 0
blade-service-api/blade-deliver-goods-api/pom.xml

@@ -12,6 +12,12 @@
     <artifactId>blade-deliver-goods-api</artifactId>
     <name>${project.artifactId}</name>
     <version>2.8.2.RELEASE</version>
+    <dependencies>
+        <dependency>
+            <groupId>org.springblade</groupId>
+            <artifactId>blade-common</artifactId>
+        </dependency>
+    </dependencies>
 
 
 </project>

+ 10 - 2
blade-service-api/blade-deliver-goods-api/src/main/java/org/springblade/deliver/goods/entity/Delivery.java

@@ -17,13 +17,14 @@
 package org.springblade.deliver.goods.entity;
 
 import java.math.BigDecimal;
+
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableName;
-import java.time.LocalDateTime;
 import java.io.Serializable;
 import java.util.Date;
+import java.util.List;
 
 import lombok.Data;
-import lombok.EqualsAndHashCode;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 
@@ -190,6 +191,13 @@ public class Delivery implements Serializable {
 	*/
 		@ApiModelProperty(value = "是否已删除(0 否 1是)")
 		private Integer isDeleted;
+	/**
+	 * 发货收货明细
+	 */
+		@ApiModelProperty(value = "发货收货明细")
+		@TableField(exist = false)
+		private List<DeliveryItems> deliveryItemsList;
+
 
 
 }

+ 23 - 0
blade-service-api/blade-deliver-goods-api/src/main/java/org/springblade/deliver/goods/feign/IDeliveryClient.java

@@ -0,0 +1,23 @@
+package org.springblade.deliver.goods.feign;
+
+import org.springblade.common.constant.LauncherConstant;
+import org.springblade.core.tool.api.R;
+import org.springblade.deliver.goods.entity.Delivery;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.PostMapping;
+
+@FeignClient(
+	value = LauncherConstant.APPLICATION_DELIVER_GOODS_NAME
+)
+public interface IDeliveryClient {
+	String API_PREFIX = "/client";
+	String CREATE_DELIVER_GOODS = API_PREFIX + "create-deliver-goods";
+
+	/**
+	 * 生成发货单
+	 * @param delivery
+	 * @return
+	 */
+	@PostMapping(CREATE_DELIVER_GOODS)
+	R createDeliverGoods(Delivery delivery);
+}

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

@@ -424,6 +424,12 @@ public class Order implements Serializable {
 		@ApiModelProperty(value = "修改人中文名")
 		@TableField(exist = false)
 		private String updateUserName;
+	/**
+	 * 客户中文名
+	 */
+		@ApiModelProperty(value = "客户中文名")
+		@TableField(exist = false)
+		private String corpName;
 
 
 

+ 34 - 30
blade-service/blade-client/src/main/java/org/springblade/client/mapper/GoodsDescMapper.xml

@@ -110,65 +110,69 @@
     </select>
     <select id="selectGoods" resultMap="goodsDescResultMap">
         select
-        id,
-        code,
-        cname,
-        typeno,
-        brand,
-        brand_item,
-        specs,
-        category,
-        providers,
-        unit,
-        packgeunit,
-        url,
-        CONCAT_WS(" ",cname,brand,specs,brand_item," ") AS specificationAndModel
-        from basic_goods_desc
-        where is_deleted = 0
+        bg.id,
+        bg.code,
+        bg.cname,
+        bg.typeno,
+        bg.brand,
+        bg.brand_item,
+        bg.specs,
+        bg.category,
+        bg.providers,
+        bg.unit,
+        bg.packgeunit,
+        bg.url,
+        CONCAT_WS(" ",bg.cname,bg.brand,bg.specs,bg.brand_item," ") AS specificationAndModel,
+        bt.goods_type_id AS goodsTypeId,
+        ba.cname AS goodsTypeName
+        from basic_goods_desc bg
+        LEFT JOIN basic_goods_type_desc bt ON bg.id = bt.goods_id AND bt.status = 0
+        LEFT JOIN basic_goods_type ba ON ba.id = bt.goods_type_id AND ba.status = 0 AND ba.is_deleted = 0
+        where bg.is_deleted = 0
         <if test="GoodsDesc.id!=null">
-            and id = #{GoodsDesc.id}
+            and bg.id = #{GoodsDesc.id}
         </if>
         <if test="GoodsDesc.cname!=null and GoodsDesc.cname != ''">
-            and cname like concat(concat('%',  #{GoodsDesc.cname}),'%')
+            and bg.cname like concat(concat('%',  #{GoodsDesc.cname}),'%')
         </if>
         <if test="GoodsDesc.code!=null and GoodsDesc.code != ''">
-            and code = #{GoodsDesc.code}
+            and bg.code = #{GoodsDesc.code}
         </if>
         <if test="GoodsDesc.typeno!=null and GoodsDesc.typeno != ''">
-            and typeno = #{GoodsDesc.typeno}
+            and bg.typeno = #{GoodsDesc.typeno}
         </if>
         <if test="GoodsDesc.brand!=null and GoodsDesc.brand != ''">
-            and brand = #{GoodsDesc.brand}
+            and bg.brand = #{GoodsDesc.brand}
         </if>
         <if test="GoodsDesc.brandItem!=null and GoodsDesc.brandItem != ''">
-            and brand_item = #{GoodsDesc.brandItem}
+            and bg.brand_item = #{GoodsDesc.brandItem}
         </if>
         <if test="GoodsDesc.specs!=null and GoodsDesc.specs != ''">
-            and specs = #{GoodsDesc.specs}
+            and bg.specs = #{GoodsDesc.specs}
         </if>
         <if test="GoodsDesc.category!=null and GoodsDesc.category != ''">
-            and category = #{GoodsDesc.category}
+            and bg.category = #{GoodsDesc.category}
         </if>
         <if test="GoodsDesc.providers!=null and GoodsDesc.providers != ''">
-            and providers = #{GoodsDesc.providers}
+            and bg.providers = #{GoodsDesc.providers}
         </if>
         <if test="GoodsDesc.unit!=null and GoodsDesc.unit != ''">
-            and unit = #{GoodsDesc.unit}
+            and bg.unit = #{GoodsDesc.unit}
         </if>
         <if test="GoodsDesc.packgeunit!=null and GoodsDesc.packgeunit != ''">
-            and packgeunit = #{GoodsDesc.packgeunit}
+            and bg.packgeunit = #{GoodsDesc.packgeunit}
         </if>
         <if test="GoodsDesc.tenantId!=null and GoodsDesc.tenantId != ''">
-            and tenant_id = #{GoodsDesc.tenantId}
+            and bg.tenant_id = #{GoodsDesc.tenantId}
         </if>
         <if test="GoodsDesc.url!=null and GoodsDesc.url != ''">
-            and url = #{GoodsDesc.url}
+            and bg.url = #{GoodsDesc.url}
         </if>
         <if test="GoodsDesc.status!=null">
-            and status = #{GoodsDesc.status}
+            and bg.status = #{GoodsDesc.status}
         </if>
         <if test='GoodsDesc.goodsTypeId!=null and GoodsDesc.goodsTypeId != ""'>
-            and id in (
+            and bg.id in (
             SELECT
             DISTINCT
             goods_id

+ 1 - 1
blade-service/blade-client/src/main/java/org/springblade/client/service/IGoodsDescService.java

@@ -73,7 +73,7 @@ public interface IGoodsDescService extends IService<GoodsDesc> {
 	IPage<GoodsDescVO> selectGoods(IPage<GoodsDescVO> page,GoodsDesc goodsDesc);
 	/**
 	 * 订单获取商品信息
-	 * @param goodsDesc
+	 * @param Id
 	 * @return
 	 */
 	GoodsDesc selectGoodsMessage(Long Id);

+ 6 - 0
blade-service/blade-deliver-goods/pom.xml

@@ -26,6 +26,12 @@
             <artifactId>blade-deliver-goods-api</artifactId>
             <version>2.8.2.RELEASE</version>
         </dependency>
+        <dependency>
+            <groupId>org.springblade</groupId>
+            <artifactId>blade-client-api</artifactId>
+            <version>2.8.2.RELEASE</version>
+            <scope>compile</scope>
+        </dependency>
     </dependencies>
 
 </project>

+ 18 - 4
blade-service/blade-deliver-goods/src/main/java/org/springblade/deliver/goods/controller/DeliveryController.java

@@ -16,6 +16,7 @@
  */
 package org.springblade.deliver.goods.controller;
 
+import com.baomidou.mybatisplus.core.toolkit.StringUtils;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
@@ -25,6 +26,7 @@ import javax.validation.Valid;
 
 import org.springblade.core.mp.support.Condition;
 import org.springblade.core.mp.support.Query;
+import org.springblade.core.secure.utils.SecureUtil;
 import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.utils.Func;
 import org.springframework.web.bind.annotation.*;
@@ -55,7 +57,7 @@ public class DeliveryController extends BladeController {
 	@ApiOperationSupport(order = 1)
 	@ApiOperation(value = "详情", notes = "传入delivery")
 	public R<Delivery> detail(Delivery delivery) {
-		Delivery detail = deliveryService.getOne(Condition.getQueryWrapper(delivery));
+		Delivery detail = deliveryService.getDeliveryMessage(delivery);
 		return R.data(detail);
 	}
 
@@ -66,6 +68,8 @@ public class DeliveryController extends BladeController {
 	@ApiOperationSupport(order = 2)
 	@ApiOperation(value = "分页", notes = "传入delivery")
 	public R<IPage<Delivery>> list(Delivery delivery, Query query) {
+		delivery.setIsDeleted(0);
+		delivery.setTenantId(SecureUtil.getTenantId());
 		IPage<Delivery> pages = deliveryService.page(Condition.getPage(query), Condition.getQueryWrapper(delivery));
 		return R.data(pages);
 	}
@@ -77,6 +81,8 @@ public class DeliveryController extends BladeController {
 	@ApiOperationSupport(order = 3)
 	@ApiOperation(value = "分页", notes = "传入delivery")
 	public R<IPage<DeliveryVO>> page(DeliveryVO delivery, Query query) {
+		delivery.setIsDeleted(0);
+		delivery.setTenantId(SecureUtil.getTenantId());
 		IPage<DeliveryVO> pages = deliveryService.selectDeliveryPage(Condition.getPage(query), delivery);
 		return R.data(pages);
 	}
@@ -98,20 +104,28 @@ public class DeliveryController extends BladeController {
 	@ApiOperationSupport(order = 5)
 	@ApiOperation(value = "修改", notes = "传入delivery")
 	public R update(@Valid @RequestBody Delivery delivery) {
+		if (delivery.getId() == null){
+			return R.fail(500,"请选择要删除的数据");
+		}
+		delivery.setIsDeleted(1);
 		return R.status(deliveryService.updateById(delivery));
 	}
 
 	/**
 	 * 新增或修改 发货通知单
+	 * billType FH 发货通知  SH 收货通知
 	 */
 	@PostMapping("/submit")
 	@ApiOperationSupport(order = 6)
 	@ApiOperation(value = "新增或修改", notes = "传入delivery")
 	public R submit(@Valid @RequestBody Delivery delivery) {
-		return R.status(deliveryService.saveOrUpdate(delivery));
+		if (StringUtils.isBlank(delivery.getOrderNo())){
+			return R.fail(500,"订单号不能为空");
+		}
+		return deliveryService.submitDelivery(delivery);
 	}
 
-	
+
 	/**
 	 * 删除 发货通知单
 	 */
@@ -122,5 +136,5 @@ public class DeliveryController extends BladeController {
 		return R.status(deliveryService.removeByIds(Func.toLongList(ids)));
 	}
 
-	
+
 }

+ 11 - 2
blade-service/blade-deliver-goods/src/main/java/org/springblade/deliver/goods/controller/DeliveryItemsController.java

@@ -25,6 +25,7 @@ import javax.validation.Valid;
 
 import org.springblade.core.mp.support.Condition;
 import org.springblade.core.mp.support.Query;
+import org.springblade.core.secure.utils.SecureUtil;
 import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.utils.Func;
 import org.springframework.web.bind.annotation.*;
@@ -66,6 +67,8 @@ public class DeliveryItemsController extends BladeController {
 	@ApiOperationSupport(order = 2)
 	@ApiOperation(value = "分页", notes = "传入deliveryItems")
 	public R<IPage<DeliveryItems>> list(DeliveryItems deliveryItems, Query query) {
+		deliveryItems.setTenantId(SecureUtil.getTenantId());
+		deliveryItems.setIsDeleted(0);
 		IPage<DeliveryItems> pages = deliveryItemsService.page(Condition.getPage(query), Condition.getQueryWrapper(deliveryItems));
 		return R.data(pages);
 	}
@@ -77,6 +80,8 @@ public class DeliveryItemsController extends BladeController {
 	@ApiOperationSupport(order = 3)
 	@ApiOperation(value = "分页", notes = "传入deliveryItems")
 	public R<IPage<DeliveryItemsVO>> page(DeliveryItemsVO deliveryItems, Query query) {
+		deliveryItems.setTenantId(SecureUtil.getTenantId());
+		deliveryItems.setIsDeleted(0);
 		IPage<DeliveryItemsVO> pages = deliveryItemsService.selectDeliveryItemsPage(Condition.getPage(query), deliveryItems);
 		return R.data(pages);
 	}
@@ -98,6 +103,10 @@ public class DeliveryItemsController extends BladeController {
 	@ApiOperationSupport(order = 5)
 	@ApiOperation(value = "修改", notes = "传入deliveryItems")
 	public R update(@Valid @RequestBody DeliveryItems deliveryItems) {
+		if (deliveryItems.getId() == null){
+			return R.fail(500,"请选择要删除的数据");
+		}
+		deliveryItems.setIsDeleted(1);
 		return R.status(deliveryItemsService.updateById(deliveryItems));
 	}
 
@@ -111,7 +120,7 @@ public class DeliveryItemsController extends BladeController {
 		return R.status(deliveryItemsService.saveOrUpdate(deliveryItems));
 	}
 
-	
+
 	/**
 	 * 删除 发货明细
 	 */
@@ -122,5 +131,5 @@ public class DeliveryItemsController extends BladeController {
 		return R.status(deliveryItemsService.removeByIds(Func.toLongList(ids)));
 	}
 
-	
+
 }

+ 0 - 195
blade-service/blade-deliver-goods/src/main/java/org/springblade/deliver/goods/entity/Delivery.java

@@ -1,195 +0,0 @@
-/*
- *      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.deliver.goods.entity;
-
-import java.math.BigDecimal;
-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-09-26
- */
-@Data
-@TableName("business_delivery")
-@ApiModel(value = "Delivery对象", description = "发货通知单")
-public class Delivery implements Serializable {
-
-	private static final long serialVersionUID = 1L;
-
-	/**
-	* 主键
-	*/
-		@ApiModelProperty(value = "主键")
-		private Long id;
-	/**
-	* 系统编号
-	*/
-		@ApiModelProperty(value = "系统编号")
-		private String sysNo;
-	/**
-	* 订单号
-	*/
-		@ApiModelProperty(value = "订单号")
-		private String orderNo;
-	/**
-	* 原始订单号
-	*/
-		@ApiModelProperty(value = "原始订单号")
-		private String orgOrderNo;
-	/**
-	* 来源订单号
-	*/
-		@ApiModelProperty(value = "来源订单号")
-		private String srcOrderNo;
-	/**
-	* 来源id
-	*/
-		@ApiModelProperty(value = "来源id")
-		private Long srcId;
-	/**
-	* 发货通知单
-	*/
-		@ApiModelProperty(value = "发货通知单")
-		private String billType;
-	/**
-	* 发货日期
-	*/
-		@ApiModelProperty(value = "发货日期")
-		private Date businessDate;
-	/**
-	* 客户id(全称)
-	*/
-		@ApiModelProperty(value = "客户id(全称)")
-		private Long corpId;
-	/**
-	* 仓库id(全称)
-	*/
-		@ApiModelProperty(value = "仓库id(全称)")
-		private Long storageId;
-	/**
-	* 仓库电话
-	*/
-		@ApiModelProperty(value = "仓库电话")
-		private String storageTel;
-	/**
-	* 收货人
-	*/
-		@ApiModelProperty(value = "收货人")
-		private String arrivalContact;
-	/**
-	* 收货地址
-	*/
-		@ApiModelProperty(value = "收货地址")
-		private String arrivalAddress;
-	/**
-	* 收货人签字
-	*/
-		@ApiModelProperty(value = "收货人签字")
-		private String arrivalSign;
-	/**
-	* 收货备注
-	*/
-		@ApiModelProperty(value = "收货备注")
-		private String otherRemarks;
-	/**
-	* 运费要求
-	*/
-		@ApiModelProperty(value = "运费要求")
-		private String freightRemarks;
-	/**
-	* 数量合计
-	*/
-		@ApiModelProperty(value = "数量合计")
-		private BigDecimal totalQuantity;
-	/**
-	* 重量合计
-	*/
-		@ApiModelProperty(value = "重量合计")
-		private BigDecimal totalWeight;
-	/**
-	* 体积合计
-	*/
-		@ApiModelProperty(value = "体积合计")
-		private BigDecimal totalVolumn;
-	/**
-	* 备注
-	*/
-		@ApiModelProperty(value = "备注")
-		private String deliveryRemarks;
-	/**
-	* 特别提醒
-	*/
-		@ApiModelProperty(value = "特别提醒")
-		private String specialRemarks;
-	/**
-	* 版本
-	*/
-		@ApiModelProperty(value = "版本")
-		private String version;
-	/**
-	 * 租户id
-	 */
-		@ApiModelProperty(value = "租户id")
-		private String tenantId;
-	/**
-	* 创建人
-	*/
-		@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是)")
-		private Integer isDeleted;
-
-
-}

+ 0 - 170
blade-service/blade-deliver-goods/src/main/java/org/springblade/deliver/goods/entity/DeliveryItems.java

@@ -1,170 +0,0 @@
-/*
- *      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.deliver.goods.entity;
-
-import java.math.BigDecimal;
-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-09-26
- */
-@Data
-@TableName("business_delivery_items")
-@ApiModel(value = "DeliveryItems对象", description = "发货明细")
-public class DeliveryItems implements Serializable {
-
-	private static final long serialVersionUID = 1L;
-
-	/**
-	* 主键
-	*/
-		@ApiModelProperty(value = "主键")
-		private Long id;
-	/**
-	* 主表id
-	*/
-		@ApiModelProperty(value = "主表id")
-		private Long pid;
-	/**
-	* 排序
-	*/
-		@ApiModelProperty(value = "排序")
-		private Integer sort;
-	/**
-	* 类型(货物,赠品)
-	*/
-		@ApiModelProperty(value = "类型(货物,赠品)")
-		private String billType;
-	/**
-	* 生产年份
-	*/
-		@ApiModelProperty(value = "生产年份")
-		private Long goodsYear;
-	/**
-	* 货物id
-	*/
-		@ApiModelProperty(value = "货物id")
-		private Long itemId;
-	/**
-	* 数量
-	*/
-		@ApiModelProperty(value = "数量")
-		private BigDecimal actualQuantity;
-	/**
-	* 箱量(基础资料带过来 可以修改)
-	*/
-		@ApiModelProperty(value = "箱量(基础资料带过来 可以修改)")
-		private BigDecimal containerQuantity;
-	/**
-	* 折合箱量(立方)
-	*/
-		@ApiModelProperty(value = "折合箱量(立方)")
-		private BigDecimal containerVolume;
-	/**
-	* 重量
-	*/
-		@ApiModelProperty(value = "重量")
-		private BigDecimal actualWeight;
-	/**
-	* 合计重量
-	*/
-		@ApiModelProperty(value = "合计重量")
-		private BigDecimal totalWeight;
-	/**
-	* 包装要求
-	*/
-		@ApiModelProperty(value = "包装要求")
-		private String packageRemarks;
-	/**
-	* 原始订单号
-	*/
-		@ApiModelProperty(value = "原始订单号")
-		private String orgOrderNo;
-	/**
-	* 来源订单号
-	*/
-		@ApiModelProperty(value = "来源订单号")
-		private String srcOrderNo;
-	/**
-	* 来源id
-	*/
-		@ApiModelProperty(value = "来源id")
-		private Long srcId;
-	/**
-	* 备注
-	*/
-		@ApiModelProperty(value = "备注")
-		private String remarks;
-	/**
-	* 版本
-	*/
-		@ApiModelProperty(value = "版本")
-		private String version;
-	/**
-	 * 租户id
-	 */
-		@ApiModelProperty(value = "租户id")
-		private String tenantId;
-	/**
-	* 创建人
-	*/
-		@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是)")
-		private Integer isDeleted;
-
-
-}

+ 29 - 0
blade-service/blade-deliver-goods/src/main/java/org/springblade/deliver/goods/feign/DeliveryClient.java

@@ -0,0 +1,29 @@
+package org.springblade.deliver.goods.feign;
+
+import lombok.AllArgsConstructor;
+import org.springblade.core.tenant.annotation.NonDS;
+import org.springblade.core.tool.api.R;
+import org.springblade.deliver.goods.entity.Delivery;
+import org.springblade.deliver.goods.service.IDeliveryService;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RestController;
+import springfox.documentation.annotations.ApiIgnore;
+
+@NonDS
+@ApiIgnore()
+@RestController
+@AllArgsConstructor
+public class DeliveryClient implements IDeliveryClient{
+	private IDeliveryService deliveryService;//发货 收货信息
+
+	/**
+	 * 生成发货信息
+	 * @param delivery
+	 * @return
+	 */
+	@Override
+	@PostMapping(CREATE_DELIVER_GOODS)
+	public R createDeliverGoods(Delivery delivery) {
+		return deliveryService.submitDelivery(delivery);
+	}
+}

+ 15 - 0
blade-service/blade-deliver-goods/src/main/java/org/springblade/deliver/goods/service/IDeliveryService.java

@@ -16,6 +16,7 @@
  */
 package org.springblade.deliver.goods.service;
 
+import org.springblade.core.tool.api.R;
 import org.springblade.deliver.goods.entity.Delivery;
 import org.springblade.deliver.goods.vo.DeliveryVO;
 import com.baomidou.mybatisplus.extension.service.IService;
@@ -38,4 +39,18 @@ public interface IDeliveryService extends IService<Delivery> {
 	 */
 	IPage<DeliveryVO> selectDeliveryPage(IPage<DeliveryVO> page, DeliveryVO delivery);
 
+	/**
+	 * 保存发货或收货明细
+	 * @param delivery
+	 * @return
+	 */
+	R submitDelivery(Delivery delivery);
+
+	/**
+	 * 获取发货 收货明细
+	 * @param delivery
+	 * @return
+	 */
+	Delivery getDeliveryMessage(Delivery delivery);
+
 }

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

@@ -16,13 +16,25 @@
  */
 package org.springblade.deliver.goods.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
+import lombok.AllArgsConstructor;
+import org.springblade.client.feign.ISerialClient;
+import org.springblade.core.secure.utils.SecureUtil;
+import org.springblade.core.tool.api.R;
 import org.springblade.deliver.goods.entity.Delivery;
+import org.springblade.deliver.goods.entity.DeliveryItems;
+import org.springblade.deliver.goods.mapper.DeliveryItemsMapper;
 import org.springblade.deliver.goods.vo.DeliveryVO;
 import org.springblade.deliver.goods.mapper.DeliveryMapper;
 import org.springblade.deliver.goods.service.IDeliveryService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.stereotype.Service;
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.Date;
+import java.util.List;
 
 /**
  * 发货通知单 服务实现类
@@ -31,11 +43,67 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
  * @since 2021-09-26
  */
 @Service
+@AllArgsConstructor
 public class DeliveryServiceImpl extends ServiceImpl<DeliveryMapper, Delivery> implements IDeliveryService {
-
+	private ISerialClient serialClient;//生成系统编号
+	private DeliveryItemsMapper deliveryItemsMapper;//发货明细
 	@Override
 	public IPage<DeliveryVO> selectDeliveryPage(IPage<DeliveryVO> page, DeliveryVO delivery) {
 		return page.setRecords(baseMapper.selectDeliveryPage(page, delivery));
 	}
 
+	/**
+	 * 保存发货通知单和发货明细
+	 * @param delivery
+	 * @return
+	 */
+	@Override
+	@Transactional
+	public R submitDelivery(Delivery delivery) {
+		if (delivery.getId() == null){
+			R billNo = serialClient.getBillNo(delivery.getBillType());
+			if (billNo.isSuccess() && billNo.getData() != null){
+				delivery.setSysNo((String) billNo.getData());
+			}else {
+				return R.fail(500,"系统编号生成失败");
+			}
+			delivery.setCreateUser(SecureUtil.getUserId());
+			delivery.setCreateTime(new Date());
+			delivery.setTenantId(SecureUtil.getTenantId());
+			baseMapper.insert(delivery);
+		}else {
+			delivery.setUpdateUser(SecureUtil.getUserId());
+			delivery.setUpdateTime(new Date());
+			baseMapper.updateById(delivery);
+		}
+		if (CollectionUtils.isNotEmpty(delivery.getDeliveryItemsList())){
+			for (DeliveryItems deliveryItems : delivery.getDeliveryItemsList()) {
+				deliveryItems.setPid(delivery.getId());//父级ID
+				deliveryItems.setBillType(delivery.getBillType());//通知单类型
+				deliveryItems.setTenantId(SecureUtil.getTenantId());//租户id
+				if (deliveryItems.getId() == null){
+					deliveryItems.setCreateUser(SecureUtil.getUserId());
+					deliveryItems.setCreateTime(new Date());
+					deliveryItemsMapper.insert(deliveryItems);
+				}else {
+					deliveryItems.setUpdateTime(new Date());
+					deliveryItems.setUpdateUser(SecureUtil.getUserId());
+					deliveryItemsMapper.updateById(deliveryItems);
+				}
+			}
+		}
+		return R.data(delivery);
+	}
+
+	@Override
+	public Delivery getDeliveryMessage(Delivery delivery) {
+		//获取发货主表数据
+		Delivery selectById = baseMapper.selectById(delivery.getId());
+		//获取明细表数据
+		List<DeliveryItems> deliveryItemsList = deliveryItemsMapper.selectList(new QueryWrapper<DeliveryItems>().eq("pid", delivery.getId())
+			.eq("", SecureUtil.getTenantId()).eq("is_deleted", 0));
+		selectById.setDeliveryItemsList(deliveryItemsList);
+		return selectById;
+	}
+
 }

+ 13 - 0
blade-service/blade-mocha-item/src/main/java/org/springblade/mocha/controller/SalesPolicyController.java

@@ -25,6 +25,7 @@ import javax.validation.Valid;
 
 import org.springblade.core.mp.support.Condition;
 import org.springblade.core.mp.support.Query;
+import org.springblade.core.secure.BladeUser;
 import org.springblade.core.secure.utils.SecureUtil;
 import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.utils.Func;
@@ -35,6 +36,8 @@ import org.springblade.mocha.vo.SalesPolicyVO;
 import org.springblade.mocha.service.ISalesPolicyService;
 import org.springblade.core.boot.ctrl.BladeController;
 
+import java.util.List;
+
 /**
  * 销售政策表 控制器
  *
@@ -130,6 +133,16 @@ public class SalesPolicyController extends BladeController {
 	public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
 		return R.status(salesPolicyService.removeByIds(Func.toLongList(ids)));
 	}
+	/**
+	 * 懒加载获取政策树形结构
+	 */
+	@GetMapping("/lazy-tree")
+	@ApiOperationSupport(order = 9)
+	@ApiOperation(value = "懒加载树形结构", notes = "树形结构")
+	public R<List<SalesPolicyVO>> lazyTree(String tenantId, BladeUser bladeUser) {
+		List<SalesPolicyVO> tree = salesPolicyService.lazyTree(Func.toStrWithEmpty(tenantId, bladeUser.getTenantId()));
+		return R.data(tree);
+	}
 
 
 }

+ 7 - 0
blade-service/blade-mocha-item/src/main/java/org/springblade/mocha/mapper/SalesPolicyMapper.java

@@ -39,5 +39,12 @@ public interface SalesPolicyMapper extends BaseMapper<SalesPolicy> {
 	 * @return
 	 */
 	List<SalesPolicy> selectSalesPolicyPage(IPage page, @Param("SalesPolicy") SalesPolicy salesPolicy);
+	/**
+	 * 懒加载
+	 * @param tenantId
+	 * @return
+	 */
+	List<SalesPolicyVO> lazyTree(String tenantId);
+
 
 }

+ 25 - 0
blade-service/blade-mocha-item/src/main/java/org/springblade/mocha/mapper/SalesPolicyMapper.xml

@@ -21,6 +21,14 @@
         <result column="status" property="status"/>
         <result column="is_deleted" property="isDeleted"/>
     </resultMap>
+    <resultMap id="treeNodeResultMap" type="org.springblade.core.tool.node.TreeNode">
+        <id column="id" property="id"/>
+        <result column="parent_id" property="parentId"/>
+        <result column="title" property="title"/>
+        <result column="value" property="value"/>
+        <result column="key" property="key"/>
+        <result column="has_children" property="hasChildren"/>
+    </resultMap>
 
 
     <select id="selectSalesPolicyPage" resultMap="salesPolicyResultMap">
@@ -59,5 +67,22 @@
             and status = #{SalesPolicy.status}
         </if>
     </select>
+    <select id="lazyTree" resultMap="treeNodeResultMap" >
+        SELECT
+        dept.id,
+        0 AS parent_id,
+        dept.cname AS title,
+        dept.id AS "value",
+        dept.id AS "key",
+        0 AS "has_children"
+        FROM
+        basic_sales_policy dept
+        WHERE
+        dept.is_deleted = 0
+        and dept.status = 0
+        <if test="param1!=null and param1!=''">
+            and dept.tenant_id = #{param1}
+        </if>
+    </select>
 
 </mapper>

+ 9 - 0
blade-service/blade-mocha-item/src/main/java/org/springblade/mocha/service/ISalesPolicyService.java

@@ -22,6 +22,8 @@ import org.springblade.mocha.vo.SalesPolicyVO;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 
+import java.util.List;
+
 /**
  * 销售政策表 服务类
  *
@@ -52,5 +54,12 @@ public interface ISalesPolicyService extends IService<SalesPolicy> {
 	 * @return
 	 */
 	SalesPolicy getSalesPolicy(SalesPolicy salesPolicy);
+	/**
+	 * 懒加载树形结构
+	 *
+	 * @param tenantId
+	 * @return
+	 */
+	List<SalesPolicyVO> lazyTree(String tenantId);
 
 }

+ 8 - 0
blade-service/blade-mocha-item/src/main/java/org/springblade/mocha/service/impl/SalesPolicyServiceImpl.java

@@ -146,6 +146,14 @@ public class SalesPolicyServiceImpl extends ServiceImpl<SalesPolicyMapper, Sales
 		}
 		return policy;
 	}
+
+	@Override
+	public List<SalesPolicyVO> lazyTree(String tenantId) {
+		if (StringUtils.isBlank(tenantId)){
+			tenantId = SecureUtil.getTenantId();
+		}
+		return baseMapper.lazyTree(tenantId);
+	}
 	private String getUserName(Long user){
 		String userName = null;
 		R<User> create = userClient.userInfoById(user);

+ 7 - 3
blade-service/blade-purchase-sales/src/main/java/org/springblade/purchase/sales/service/impl/OrderServiceImpl.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.google.protobuf.ServiceException;
 import lombok.AllArgsConstructor;
 import org.springblade.client.entity.CorpsDesc;
 import org.springblade.client.entity.FeesDesc;
@@ -40,8 +41,10 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.transaction.interceptor.TransactionAspectSupport;
 
+import java.rmi.ServerException;
 import java.util.Date;
 import java.util.List;
+import java.util.Objects;
 
 /**
  * 销售或采购订单表 服务实现类
@@ -75,7 +78,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
 			R billNo = serialClient.getBillNo(order.getBillType());
 			if (billNo.getCode() != 200){
 				TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
-				return billNo;
+				return R.fail(500,"生成系统编号失败");
 			}
 			order.setSysNo((String) billNo.getData());
 			order.setTenantId(SecureUtil.getTenantId());
@@ -130,9 +133,10 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
 		Order orderMessage = baseMapper.selectById(order.getId());
 		//获取创建人中文名
 		R<User> createUser = userClient.userInfoById(orderMessage.getCreateUser());
-		if (createUser.isSuccess()){
-			orderMessage.setCreateUserName(createUser.getData().getName());
+		if (!createUser.isSuccess() || Objects.isNull(createUser.getData())){
+			throw new RuntimeException("未找到用户信息");
 		}
+		orderMessage.setCreateUserName(createUser.getData().getName());
 		//获取订单明细信息
 		List<OrderItems> orderItemsList = this.getOrderItems(order);
 		orderMessage.setOrderItemsList(orderItemsList);