1021934019@qq.com 4 年 前
コミット
bf1ff7226c

+ 20 - 0
blade-service-api/blade-purchase-sales-api/src/main/java/org/springblade/purchase/sales/vo/OrderItemBillNoVO.java

@@ -0,0 +1,20 @@
+package org.springblade.purchase.sales.vo;
+
+
+import lombok.Data;
+
+import java.util.List;
+import java.util.Map;
+
+
+@Data
+public class OrderItemBillNoVO
+{
+  private String orderNo;
+
+  private String billNo;
+
+  private Long itemId;
+
+  private List<Map<String,Object>> itemName;
+}

+ 8 - 0
blade-service-api/trade-purchase-api/src/main/java/com/trade/purchase/order/vo/OrderDTO.java

@@ -6,6 +6,8 @@ import lombok.Data;
 import lombok.EqualsAndHashCode;
 
 import java.math.BigDecimal;
+import java.util.List;
+import java.util.Map;
 
 /**
  * 订单明细表视图实体类
@@ -39,4 +41,10 @@ public class OrderDTO extends OrderItems {
 
 	private BigDecimal amount;
 
+	private List<Map<String,Object>> corpModelName;
+
+	private List<Map<String,Object>> itemName;
+
+	private Long itemId;
+
 }

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

@@ -282,7 +282,7 @@ public class DeliveryServiceImpl extends ServiceImpl<DeliveryMapper, Delivery> i
 				R r = iOrderItemsClient.updateActualQuantity(e.getSrcId(), inventoryNumber, 1);
 				if(!r.isSuccess())
 				{
-					throw new SecurityException("更新采购明细失败");
+					throw new SecurityException("更新采购明细失败:"+r.getMsg());
 				}
 			});
 		//更改收货主表状态

+ 21 - 17
blade-service/blade-purchase-sales/src/main/java/org/springblade/purchase/sales/entrance/EntranceOrderController.java

@@ -5,10 +5,13 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
 import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
 import com.trade.purchase.order.enums.OrderTypeEnum;
+import com.trade.purchase.order.vo.OrderDTO;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
 import lombok.AllArgsConstructor;
+import org.springblade.client.feign.IGoodsDescClient;
+import org.springblade.client.vo.GoodsDescVO;
 import org.springblade.core.boot.ctrl.BladeController;
 import org.springblade.core.mp.support.Condition;
 import org.springblade.core.mp.support.Query;
@@ -19,13 +22,13 @@ import org.springblade.purchase.sales.entity.Order;
 import org.springblade.purchase.sales.entity.OrderItems;
 import org.springblade.purchase.sales.service.IOrderItemsService;
 import org.springblade.purchase.sales.service.IOrderService;
+import org.springblade.purchase.sales.vo.OrderItemBillNoVO;
 import org.springblade.purchase.sales.vo.OrderItemsVO;
 import org.springblade.purchase.sales.vo.OrderVO;
 import org.springframework.web.bind.annotation.*;
 
 import javax.validation.Valid;
-import java.util.Collections;
-import java.util.List;
+import java.util.*;
 import java.util.stream.Collectors;
 
 /**
@@ -41,6 +44,8 @@ public class EntranceOrderController extends BladeController {
 
 	private final IOrderItemsService itemsService;
 
+	private IGoodsDescClient goodsDescClient;//获取商品信息
+
 	/**
 	 * 详情
 	 */
@@ -152,27 +157,26 @@ public class EntranceOrderController extends BladeController {
 	@GetMapping("/findContractNoByBillNo")
 	@ApiOperationSupport(order = 6)
 	@ApiOperation(value = "通过提单号查询合同号", notes = "传入提单号")
-	public List<Order> findContractNoByBillNo(@ApiParam(value = "billNo", required = true) @RequestParam String billNo)
+	public List<?> findContractNoByBillNo(@ApiParam(value = "billNo", required = true) @RequestParam String billNo,@ApiParam(value = "billType", required = true) @RequestParam String billType)
 	{
-		LambdaQueryWrapper<OrderItems> itemsLambdaQueryWrapper=new LambdaQueryWrapper<>();
-		itemsLambdaQueryWrapper.eq(OrderItems::getBillNo,billNo.trim());
-		List<OrderItems> orderItems = itemsService.list(itemsLambdaQueryWrapper);
-		if(CollectionUtils.isEmpty(orderItems))
-		{
-			throw new SecurityException("无此提单号的记录");
-		}
-		List<Long> pids = orderItems.stream().map(OrderItems::getPid).distinct().collect(Collectors.toList());
-		if(CollectionUtils.isEmpty(pids))
+		List<OrderItemBillNoVO> contractNoByBillNo = orderService.findContractNoByBillNo(billNo, billType);
+		if(CollectionUtils.isNotEmpty(contractNoByBillNo))
 		{
-			return Collections.EMPTY_LIST;
+			contractNoByBillNo.forEach(e->{
+				List<Map<String,Object>> list=new ArrayList<>();
+				Map<String,Object>map=new HashMap<>();
+				R<GoodsDescVO> goodsDescVOR = goodsDescClient.selectGoodsMessage(e.getItemId());
+				map.put("id",goodsDescVOR.getData().getId());
+				map.put("cname",goodsDescVOR.getData().getCname());
+				list.add(map);
+				e.setItemName(list);
+			});
+			return contractNoByBillNo;
 		}
 		else
 		{
-			LambdaQueryWrapper<Order> orderLambdaQueryWrapper=new LambdaQueryWrapper<>();
-			orderLambdaQueryWrapper.in(Order::getId,pids);
-			return orderService.list(orderLambdaQueryWrapper);
+			return Collections.EMPTY_LIST;
 		}
-
 	}
 	/**
 	 * 发货单获取订单明细

+ 4 - 0
blade-service/blade-purchase-sales/src/main/java/org/springblade/purchase/sales/mapper/OrderMapper.java

@@ -16,8 +16,10 @@
  */
 package org.springblade.purchase.sales.mapper;
 
+import com.trade.purchase.order.vo.OrderDTO;
 import org.apache.ibatis.annotations.Param;
 import org.springblade.purchase.sales.entity.Order;
+import org.springblade.purchase.sales.vo.OrderItemBillNoVO;
 import org.springblade.purchase.sales.vo.OrderVO;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -40,4 +42,6 @@ public interface OrderMapper extends BaseMapper<Order> {
 	 */
 	List<OrderVO> selectOrderPage(IPage page, @Param("Order") OrderVO order);
 
+	List<OrderItemBillNoVO> findContractNoByBillNo(@Param("billNo")String billNo, @Param("billType")String billType);
+
 }

+ 21 - 0
blade-service/blade-purchase-sales/src/main/java/org/springblade/purchase/sales/mapper/OrderMapper.xml

@@ -351,4 +351,25 @@
         order by id
     </select>
 
+    <select id="findContractNoByBillNo" resultType="org.springblade.purchase.sales.vo.OrderItemBillNoVO">
+        SELECT
+        a.order_no as orderNo,
+        b.bill_no as billNo,
+        b.item_id as itemId
+        FROM
+        business_order a,
+        business_order_items b
+        WHERE
+        b.pid = a.id
+        and a.is_deleted=0
+        and b.is_deleted=0
+        <if test='billType != null and billType!= ""'>
+            and a.bill_type = #{billType}
+        </if>
+        <if test='billNo != null and billNo!= ""'>
+            and b.bill_no = #{billNo}
+        </if>
+
+    </select>
+
 </mapper>

+ 7 - 0
blade-service/blade-purchase-sales/src/main/java/org/springblade/purchase/sales/service/IOrderService.java

@@ -16,12 +16,17 @@
  */
 package org.springblade.purchase.sales.service;
 
+import com.trade.purchase.order.vo.OrderDTO;
+import org.apache.ibatis.annotations.Param;
 import org.springblade.core.tool.api.R;
 import org.springblade.purchase.sales.entity.Order;
+import org.springblade.purchase.sales.vo.OrderItemBillNoVO;
 import org.springblade.purchase.sales.vo.OrderVO;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 
+import java.util.List;
+
 /**
  * 销售或采购订单表 服务类
  *
@@ -72,4 +77,6 @@ public interface IOrderService extends IService<Order> {
 	 */
 	R createMarket(Order order);
 
+	List<OrderItemBillNoVO> findContractNoByBillNo(@Param("billNo")String billNo, @Param("billType")String billType);
+
 }

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

@@ -19,6 +19,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 com.trade.purchase.order.vo.OrderDTO;
 import io.seata.spring.annotation.GlobalTransactional;
 import lombok.AllArgsConstructor;
 import org.springblade.client.entity.CorpsDesc;
@@ -31,6 +32,7 @@ import org.springblade.client.feign.ISerialClient;
 import org.springblade.core.secure.utils.SecureUtil;
 import org.springblade.core.tool.api.R;
 import org.springblade.purchase.sales.entity.*;
+import org.springblade.purchase.sales.vo.OrderItemBillNoVO;
 import org.springblade.purchase.sales.vo.OrderVO;
 import org.springblade.purchase.sales.mapper.OrderMapper;
 import org.springblade.purchase.sales.service.IOrderService;
@@ -64,6 +66,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
 	private ISerialClient serialClient;//生成系统编号
 	private IUserClient userClient;//获取用户信息
 	private ICorpsDescClient corpsDescClient;//获取客户信息
+	private OrderMapper orderMapper;
 	@Override
 	public IPage<OrderVO> selectOrderPage(IPage<OrderVO> page, OrderVO order) {
 		List<OrderVO> orderVOList = baseMapper.selectOrderPage(page, order);
@@ -341,4 +344,10 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
 		return R.data(order);
 	}
 
+	@Override
+	public List<OrderItemBillNoVO> findContractNoByBillNo(String billNo, String billType)
+	{
+		return orderMapper.findContractNoByBillNo(billNo,billType);
+	}
+
 }

+ 55 - 0
blade-service/store-goods/src/main/java/com/store/goods/controller/GoodsAppController.java

@@ -0,0 +1,55 @@
+package com.store.goods.controller;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import com.store.goods.entity.GoodsDesc;
+import com.store.goods.entity.GoodsItems;
+import com.store.goods.service.IGoodsDescService;
+import com.store.goods.service.IGoodsItemsService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.AllArgsConstructor;
+import org.springblade.core.mp.support.Condition;
+import org.springblade.core.secure.utils.AuthUtil;
+import org.springblade.core.tool.api.R;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+/**
+ *  控制器
+ *
+ * @author BladeX
+ * @since 2021-11-19
+ */
+@RestController
+@AllArgsConstructor
+@RequestMapping("app/goodsdesc")
+@Api(value = "商品主表", tags = "商品主表接口")
+public class GoodsAppController
+{
+	private final IGoodsDescService goodsDescService;
+
+	private final IGoodsItemsService goodsItemsService;
+
+	/**
+	 * 详情
+	 */
+	@GetMapping("/detail")
+	@ApiOperationSupport(order = 1)
+	@ApiOperation(value = "详情", notes = "传入goodsDesc")
+	public R<GoodsDesc> appDetail(GoodsDesc goodsDesc) {
+		GoodsDesc detail = goodsDescService.getOne(Condition.getQueryWrapper(goodsDesc));
+		LambdaQueryWrapper<GoodsItems> itemsLambdaQueryWrapper=new LambdaQueryWrapper<>();
+		itemsLambdaQueryWrapper
+			.eq(GoodsItems::getGoodsStatus,1)
+			.eq(GoodsItems::getIsDeleted,0)
+			.eq(GoodsItems::getPid,detail.getId())
+			.eq(GoodsItems::getTenantId, AuthUtil.getTenantId());
+		List<GoodsItems> itemsList = goodsItemsService.list(itemsLambdaQueryWrapper);
+		detail.setItemsList(itemsList);
+		return R.data(detail);
+	}
+}

+ 1 - 18
blade-service/store-goods/src/main/java/com/store/goods/controller/GoodsDescController.java

@@ -76,24 +76,7 @@ public class GoodsDescController extends BladeController {
 	}
 
 
-	/**
-	 * 详情
-	 */
-	@GetMapping("app/detail")
-	@ApiOperationSupport(order = 1)
-	@ApiOperation(value = "详情", notes = "传入goodsDesc")
-	public R<GoodsDesc> appDetail(GoodsDesc goodsDesc) {
-		GoodsDesc detail = goodsDescService.getOne(Condition.getQueryWrapper(goodsDesc));
-		LambdaQueryWrapper<GoodsItems> itemsLambdaQueryWrapper=new LambdaQueryWrapper<>();
-		itemsLambdaQueryWrapper
-			.eq(GoodsItems::getGoodsStatus,1)
-			.eq(GoodsItems::getIsDeleted,0)
-			.eq(GoodsItems::getPid,detail.getId())
-			.eq(GoodsItems::getTenantId, AuthUtil.getTenantId());
-		List<GoodsItems> itemsList = goodsItemsService.list(itemsLambdaQueryWrapper);
-		detail.setItemsList(itemsList);
-		return R.data(detail);
-	}
+
 
 
 

+ 24 - 3
blade-service/trade-purchase/src/main/java/com/trade/purchase/order/controller/PurchaseOrderController.java

@@ -27,6 +27,8 @@ import io.swagger.annotations.ApiParam;
 import lombok.AllArgsConstructor;
 import org.springblade.client.entity.CorpsDesc;
 import org.springblade.client.feign.ICorpsDescClient;
+import org.springblade.client.feign.IGoodsDescClient;
+import org.springblade.client.vo.GoodsDescVO;
 import org.springblade.core.boot.ctrl.BladeController;
 import org.springblade.core.log.exception.ServiceException;
 import org.springblade.core.mp.support.Condition;
@@ -38,9 +40,7 @@ import org.springblade.core.tool.utils.ObjectUtil;
 import org.springframework.web.bind.annotation.*;
 
 import javax.validation.Valid;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 import java.util.stream.Collectors;
 
 /**
@@ -67,6 +67,8 @@ public class PurchaseOrderController extends BladeController {
 
 	private ICorpsDescClient corpsDescClient;//获取客户信息
 
+	private IGoodsDescClient goodsDescClient;//获取商品信息
+
 
 	/**
 	 * 详情
@@ -311,6 +313,25 @@ public class PurchaseOrderController extends BladeController {
 	{
 		Page<OrderDTO> page=new Page<>(current,size);
 		IPage<OrderDTO> iPage = orderService.listOrderItem(page, tradeType, orderNo, corpId, startDate, endDate);
+		if(CollectionUtils.isNotEmpty(iPage.getRecords()))
+		{
+			iPage.getRecords().forEach(e->{
+				//商品信息
+				R<GoodsDescVO> goodsDescVOR = goodsDescClient.selectGoodsMessage(e.getItemId());
+				e.setPriceCategoryNames(goodsDescVOR.getData().getCname());
+				//供应商信息
+				if (e.getCorpId() != null){
+
+					R<CorpsDesc> corpMessage = corpsDescClient.getCorpMessage(e.getCorpId());
+					if(corpMessage.getData()!=null)
+					{
+						e.setCorpName(corpMessage.getData().getCname());
+
+					}
+
+				}
+			});
+		}
 		return R.data(iPage);
 	}
 

+ 2 - 1
blade-service/trade-purchase/src/main/java/com/trade/purchase/order/mapper/OrderItemsMapper.xml

@@ -69,7 +69,8 @@
         b.bill_weight as billWeight,
         b.invoice_weight as invoiceWeight,
         b.price as price,
-        b.amount as amount
+        b.amount as amount,
+        b.item_id as itemId
         FROM
         business_order a,
         business_order_items b