Browse Source

2022年10月8日20:07:52

纪新园 3 years ago
parent
commit
78ac6795f8

+ 12 - 11
blade-service-api/trade-purchase-api/src/main/java/com/trade/purchase/order/feign/IOrderDescClient.java

@@ -14,17 +14,18 @@ import org.springframework.web.bind.annotation.RequestParam;
 @FeignClient(
 	value = "trade-purchase"
 )
-public interface  IOrderDescClient {
+public interface IOrderDescClient {
 	String API_PREFIX = "/client";
-	String UPDATE_ORDER=API_PREFIX+"/updateOrder";
-	String GET_BY_ORDER_NO=API_PREFIX+"/getByOrderNo";
-	String PASS_CHECK=API_PREFIX+"/passCheck";
-	String PASS_CANCEL=API_PREFIX+"/passCancel";
-	String UNDER_REVIEW=API_PREFIX+"/underReview";
-	String ORDER_COUNT=API_PREFIX+"/orderCount";
+	String UPDATE_ORDER = API_PREFIX + "/updateOrder";
+	String GET_BY_ORDER_NO = API_PREFIX + "/getByOrderNo";
+	String PASS_CHECK = API_PREFIX + "/passCheck";
+	String PASS_CANCEL = API_PREFIX + "/passCancel";
+	String UNDER_REVIEW = API_PREFIX + "/underReview";
+	String ORDER_COUNT = API_PREFIX + "/orderCount";
 
 	/**
 	 * 修改采购订单状态
+	 *
 	 * @param order
 	 * @return
 	 */
@@ -35,15 +36,15 @@ public interface  IOrderDescClient {
 	Order getByOrder(String orderNo);
 
 	@PostMapping(PASS_CHECK)
-	R passCheck(@RequestParam("id") Long id,@RequestParam("times") int times);
+	R passCheck(@RequestParam("id") Long id, @RequestParam("times") int times);
 
 	@PostMapping(PASS_CANCEL)
-	R passCancel(@RequestParam("id") Long id,@RequestParam("times") int times);
+	R passCancel(@RequestParam("id") Long id, @RequestParam("times") int times);
 
 	@PostMapping(UNDER_REVIEW)
-	R underReview(@RequestParam("id") Long id,@RequestParam("times") int times);
+	R underReview(@RequestParam("id") Long id, @RequestParam("times") int times);
 
 	@PostMapping(ORDER_COUNT)
-	int count(@RequestParam("type") String type,@RequestParam("orderStartDate") String orderStartDate,@RequestParam("orderEndDate") String orderEndDate,@RequestParam("businessType") String businessType);
+	int countOrder(@RequestParam("type") String type, @RequestParam("orderStartDate") String orderStartDate, @RequestParam("orderEndDate") String orderEndDate, @RequestParam(value = "businessType") String businessType);
 
 }

+ 4 - 0
blade-service/blade-deliver-goods/src/main/java/org/springblade/deliver/goods/DeliverGoodsApplication.java

@@ -16,11 +16,14 @@
  */
 package org.springblade.deliver.goods;
 
+import org.mybatis.spring.annotation.MapperScan;
 import org.springblade.common.constant.LauncherConstant;
 import org.springblade.core.cloud.feign.EnableBladeFeign;
 import org.springblade.core.launch.BladeApplication;
 import org.springblade.core.transaction.annotation.SeataCloudApplication;
 import org.springframework.cloud.client.SpringCloudApplication;
+import org.springframework.cloud.openfeign.EnableFeignClients;
+import org.springframework.context.annotation.ComponentScan;
 
 /**
  * Desk启动器
@@ -34,6 +37,7 @@ import org.springframework.cloud.client.SpringCloudApplication;
 @EnableBladeFeign
 @SpringCloudApplication
 @SeataCloudApplication
+@EnableFeignClients({"org.springblade", "com.trade.purchase"})
 public class DeliverGoodsApplication {
 
 	public static void main(String[] args) {

+ 12 - 4
blade-service/trade-purchase/src/main/java/com/trade/purchase/order/feign/OrderDescClient.java

@@ -2,6 +2,7 @@ package com.trade.purchase.order.feign;
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.trade.purchase.order.entity.Order;
+import com.trade.purchase.order.entity.OrderItems;
 import com.trade.purchase.order.enums.OrderTypeEnum;
 import com.trade.purchase.order.service.IOrderService;
 import lombok.AllArgsConstructor;
@@ -10,11 +11,14 @@ import org.springblade.core.secure.utils.SecureUtil;
 import org.springblade.core.tenant.annotation.NonDS;
 import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.utils.Func;
-import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RestController;
 import springfox.documentation.annotations.ApiIgnore;
 
+import java.math.BigDecimal;
+import java.util.List;
+import java.util.Objects;
+
 @NonDS
 @ApiIgnore()
 @RestController
@@ -59,7 +63,7 @@ public class OrderDescClient implements IOrderDescClient {
 
 
 	@Override
-	public int count(String type, String orderStartDate, String orderEndDate, String businessType) {
+	public int countOrder(String type, String orderStartDate, String orderEndDate, String businessType) {
 		if ("check".equals(businessType)) {
 			if (OrderTypeEnum.WAREHOUSING.getType().equals(type)) {
 				//入库待审核
@@ -107,7 +111,9 @@ public class OrderDescClient implements IOrderDescClient {
 				RkOrderLambdaQueryWrapper.eq(Order::getBillType, type);
 				RkOrderLambdaQueryWrapper.ge(Func.isNotEmpty(orderStartDate), Order::getStockTime, orderStartDate);//订单日期开始
 				RkOrderLambdaQueryWrapper.le(Func.isNotEmpty(orderEndDate), Order::getStockTime, orderEndDate);//订单日期结束
-				return iOrderService.count(RkOrderLambdaQueryWrapper);
+				List<Order> orderList = iOrderService.list(RkOrderLambdaQueryWrapper);
+				BigDecimal amount = orderList.stream().map(Order::getStorageQuantity).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
+				return amount.intValue();
 			} else if (OrderTypeEnum.OUT_WAREHOUSING.getType().equals(type)) {
 				//出库
 				LambdaQueryWrapper<Order> CkOrderLambdaQueryWrapper = new LambdaQueryWrapper<>();
@@ -117,7 +123,9 @@ public class OrderDescClient implements IOrderDescClient {
 				CkOrderLambdaQueryWrapper.eq(Order::getBillType, type);
 				CkOrderLambdaQueryWrapper.ge(Func.isNotEmpty(orderStartDate), Order::getStockTime, orderStartDate);//订单日期开始
 				CkOrderLambdaQueryWrapper.le(Func.isNotEmpty(orderEndDate), Order::getStockTime, orderEndDate);//订单日期结束
-				return iOrderService.count(CkOrderLambdaQueryWrapper);
+				List<Order> orderList = iOrderService.list(CkOrderLambdaQueryWrapper);
+				BigDecimal amount = orderList.stream().map(Order::getStorageQuantity).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
+				return amount.intValue();
 			} else {
 				return 0;
 			}

+ 1 - 1
blade-service/trade-purchase/src/main/java/com/trade/purchase/order/service/impl/OrderServiceImpl.java

@@ -1463,7 +1463,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
 			if (CollectionUtils.isNotEmpty(orderItems)) {
 
 				order.setOrderItemsList(orderItems);
-				auditProecessDTO.setOrderQuantity(orderItems.stream().map(OrderItems::getOrderQuantity).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
+				auditProecessDTO.setOrderQuantity(orderItems.stream().map(OrderItems::getStorageInQuantity).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
 				auditProecessDTO.setAmount(orderItems.stream().map(OrderItems::getAmount).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
 
 			} else {