|
@@ -2,7 +2,9 @@ package com.fjhx.service.order.impl;
|
|
|
|
|
|
import cn.hutool.core.convert.Convert;
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.fjhx.base.BaseEntity;
|
|
@@ -13,6 +15,7 @@ import com.fjhx.entity.order.OrderDetails;
|
|
|
import com.fjhx.entity.order.OrderInfo;
|
|
|
import com.fjhx.entity.product.ProductInfo;
|
|
|
import com.fjhx.mapper.order.OrderInfoMapper;
|
|
|
+import com.fjhx.params.order.OrderDetailsEx;
|
|
|
import com.fjhx.params.order.OrderInfoEx;
|
|
|
import com.fjhx.params.order.OrderInfoVo;
|
|
|
import com.fjhx.params.order.OrderJdExcelVo;
|
|
@@ -64,25 +67,31 @@ public class OrderInfoInfoServiceImpl extends ServiceImpl<OrderInfoMapper, Order
|
|
|
@Override
|
|
|
public Page<OrderInfoEx> getPage(Map<String, Object> condition) {
|
|
|
|
|
|
+
|
|
|
IWrapper<Object> wrapper = IWrapper.getWrapper(condition)
|
|
|
- .keyword(new KeywordData("oi", OrderInfo::getCode), new KeywordData("ci", CustomerInfo::getName))
|
|
|
// 京东订单销售订单
|
|
|
.func(q -> {
|
|
|
Integer type = Convert.toInt(condition.get("type"));
|
|
|
+ Boolean issue = Convert.toBool(condition.get("deliverable"), false);
|
|
|
+ // 如果类型为空,默认为销售订单
|
|
|
if (type == null) {
|
|
|
- q.in("oi", OrderInfo::getType, 1, 2);
|
|
|
+ // 如果是出货
|
|
|
+ if (issue) {
|
|
|
+ q.in("oi", OrderInfo::getType, 1, 2, 4, 5);
|
|
|
+ } else {
|
|
|
+ q.in("oi", OrderInfo::getType, 1, 2);
|
|
|
+ }
|
|
|
} else {
|
|
|
q.eq("oi", OrderInfo::getType);
|
|
|
}
|
|
|
- })
|
|
|
- // 搜索可以出库的列表
|
|
|
- .func(q -> {
|
|
|
- Boolean issue = Convert.toBool(condition.get("deliverable"));
|
|
|
- if (Boolean.TRUE.equals(issue)) {
|
|
|
+
|
|
|
+ // 如果是出货,订单状态为1进行中,出库状态为1未出库或2进行中
|
|
|
+ if (issue) {
|
|
|
q.eq("oi", OrderInfo::getStatus, 1);
|
|
|
- q.lt("oi", OrderInfo::getIssueStatus, 3);
|
|
|
+ q.in("oi", OrderInfo::getIssueStatus, 1, 2);
|
|
|
}
|
|
|
})
|
|
|
+ .keyword(new KeywordData("oi", OrderInfo::getCode), new KeywordData("ci", CustomerInfo::getName))
|
|
|
.eq("oi", OrderInfo::getStatus)
|
|
|
.like("oi", OrderInfo::getCode)
|
|
|
.like("ci", CustomerInfo::getName, condition.get("customerName"))
|
|
@@ -229,6 +238,33 @@ public class OrderInfoInfoServiceImpl extends ServiceImpl<OrderInfoMapper, Order
|
|
|
return flag;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public List<OrderInfo> getOrderByCustomerId(Long customerInfoId) {
|
|
|
+ Assert.notEmpty(customerInfoId, "客户id不能为空");
|
|
|
+
|
|
|
+ return list(q -> q
|
|
|
+ .select(BaseEntity::getId, OrderInfo::getCode)
|
|
|
+ .eq(OrderInfo::getCustomerInfoId, customerInfoId)
|
|
|
+ .in(OrderInfo::getType, 1, 2)
|
|
|
+ .orderByDesc(BaseEntity::getId)
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public OrderInfoEx getDetails(Long id) {
|
|
|
+ Assert.notEmpty(id, "订单id不能为空");
|
|
|
+ QueryWrapper<OrderInfo> wrapper = Wrappers.query();
|
|
|
+ wrapper.eq("oi.id", id);
|
|
|
+ OrderInfoEx orderInfoEx = baseMapper.getDetails(wrapper);
|
|
|
+ // 赋值国省市
|
|
|
+ RegionClientUtil.setEntityRegionName(orderInfoEx);
|
|
|
+
|
|
|
+ List<OrderDetailsEx> orderDetailsExes = orderDetailsService.listByOrderSalesId(id);
|
|
|
+
|
|
|
+ orderInfoEx.setOrderDetailsList(orderDetailsExes);
|
|
|
+ return orderInfoEx;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 验证订单编号是否重复
|
|
|
*/
|