|
|
@@ -1,5 +1,6 @@
|
|
|
package org.springblade.purchase.sales.entrance;
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
|
|
@@ -15,11 +16,16 @@ import org.springblade.core.secure.utils.SecureUtil;
|
|
|
import org.springblade.core.tool.api.R;
|
|
|
import org.springblade.core.tool.utils.Func;
|
|
|
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.OrderVO;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.validation.Valid;
|
|
|
+import java.util.Collections;
|
|
|
+import java.util.List;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* 进口销售单控制器
|
|
|
@@ -32,6 +38,8 @@ public class EntranceOrderController extends BladeController {
|
|
|
|
|
|
private final IOrderService orderService;
|
|
|
|
|
|
+ private final IOrderItemsService itemsService;
|
|
|
+
|
|
|
/**
|
|
|
* 详情
|
|
|
*/
|
|
|
@@ -133,4 +141,38 @@ public class EntranceOrderController extends BladeController {
|
|
|
order.setTradeType(OrderTypeEnum.IMPORT.getType());
|
|
|
return R.data(orderService.deliverGoods(order));
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据提单号查询合同号
|
|
|
+ * @param billNo
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @GetMapping("/findContractNoByBillNo")
|
|
|
+ @ApiOperationSupport(order = 6)
|
|
|
+ @ApiOperation(value = "通过提单号查询合同号", notes = "传入提单号")
|
|
|
+ public List<Order> findContractNoByBillNo(@ApiParam(value = "billNo", required = true) @RequestParam String billNo)
|
|
|
+ {
|
|
|
+ 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))
|
|
|
+ {
|
|
|
+ return Collections.EMPTY_LIST;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ LambdaQueryWrapper<Order> orderLambdaQueryWrapper=new LambdaQueryWrapper<>();
|
|
|
+ orderLambdaQueryWrapper.in(Order::getId,pids);
|
|
|
+ return orderService.list(orderLambdaQueryWrapper);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|