|
@@ -2,7 +2,6 @@ package com.fjhx.service.order.impl;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
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.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.fjhx.constants.SystemConfigKeyConstant;
|
|
import com.fjhx.constants.SystemConfigKeyConstant;
|
|
import com.fjhx.entity.logistics.LogisticsInfo;
|
|
import com.fjhx.entity.logistics.LogisticsInfo;
|
|
@@ -12,7 +11,6 @@ import com.fjhx.enums.stock.OutTypeEnum;
|
|
import com.fjhx.mapper.order.OrderDetailsMapper;
|
|
import com.fjhx.mapper.order.OrderDetailsMapper;
|
|
import com.fjhx.params.order.IssueDto;
|
|
import com.fjhx.params.order.IssueDto;
|
|
import com.fjhx.params.order.OrderDetailsEx;
|
|
import com.fjhx.params.order.OrderDetailsEx;
|
|
-import com.fjhx.params.order.OrderDetailsVo;
|
|
|
|
import com.fjhx.params.stock.ChangeProduct;
|
|
import com.fjhx.params.stock.ChangeProduct;
|
|
import com.fjhx.params.stock.StockChangeDto;
|
|
import com.fjhx.params.stock.StockChangeDto;
|
|
import com.fjhx.params.stock.StockTransferAddDto;
|
|
import com.fjhx.params.stock.StockTransferAddDto;
|
|
@@ -24,7 +22,7 @@ import com.fjhx.service.stock.StockTransferService;
|
|
import com.fjhx.service.system.SystemConfigService;
|
|
import com.fjhx.service.system.SystemConfigService;
|
|
import com.fjhx.uitl.kd100.KD100Util;
|
|
import com.fjhx.uitl.kd100.KD100Util;
|
|
import com.fjhx.utils.Assert;
|
|
import com.fjhx.utils.Assert;
|
|
-import com.fjhx.utils.wrapperUtil.IWrapper;
|
|
|
|
|
|
+import org.springblade.core.log.exception.ServiceException;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.context.annotation.Lazy;
|
|
import org.springframework.context.annotation.Lazy;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
@@ -62,30 +60,6 @@ public class OrderDetailsServiceImpl extends ServiceImpl<OrderDetailsMapper, Ord
|
|
@Autowired
|
|
@Autowired
|
|
private SystemConfigService systemConfigService;
|
|
private SystemConfigService systemConfigService;
|
|
|
|
|
|
-
|
|
|
|
- @Override
|
|
|
|
- public Page<OrderDetails> getPage(Map<String, Object> condition) {
|
|
|
|
-
|
|
|
|
- IWrapper<OrderDetails> wrapper = IWrapper.getWrapper(condition);
|
|
|
|
-
|
|
|
|
- return page(condition, wrapper);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- @Override
|
|
|
|
- public void add(OrderDetailsVo orderDetailsVo) {
|
|
|
|
- save(orderDetailsVo);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- @Override
|
|
|
|
- public void edit(OrderDetailsVo orderDetailsVo) {
|
|
|
|
- updateById(orderDetailsVo);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- @Override
|
|
|
|
- public void delete(OrderDetailsVo orderDetailsVo) {
|
|
|
|
- removeById(orderDetailsVo.getId());
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
@Override
|
|
@Override
|
|
public List<OrderDetailsEx> listByOrderSalesId(Long orderId) {
|
|
public List<OrderDetailsEx> listByOrderSalesId(Long orderId) {
|
|
Assert.notEmpty(orderId, "订单id不能为空");
|
|
Assert.notEmpty(orderId, "订单id不能为空");
|
|
@@ -108,6 +82,43 @@ public class OrderDetailsServiceImpl extends ServiceImpl<OrderDetailsMapper, Ord
|
|
updateOrderInfoStatus(list, issueDto);
|
|
updateOrderInfoStatus(list, issueDto);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ switch (issueDto.getOutTypeEnum()) {
|
|
|
|
+
|
|
|
|
+ // 销售出库添加出库记录
|
|
|
|
+ case PURCHASE:
|
|
|
|
+ StockChangeDto stockChangeDto = new StockChangeDto();
|
|
|
|
+ stockChangeDto.setDefaultWarehouseId(issueDto.getWarehouseId());
|
|
|
|
+ stockChangeDto.setTypeEnum(OutTypeEnum.PURCHASE);
|
|
|
|
+ stockChangeDto.setDefaultRemarks("销售订单出库");
|
|
|
|
+ stockChangeDto.setChangeDetailsList(issueDto.getOrderDetailsList());
|
|
|
|
+ stockService.changeQuantity(stockChangeDto);
|
|
|
|
+ break;
|
|
|
|
+
|
|
|
|
+ // 京东出库新增调仓
|
|
|
|
+ case JD:
|
|
|
|
+ // 获取京东仓库id
|
|
|
|
+ List<ChangeProduct> changeProductList = issueDto.getOrderDetailsList().stream().map(item -> {
|
|
|
|
+ ChangeProduct changeProduct = new ChangeProduct();
|
|
|
|
+ changeProduct.setProductId(item.getProductId());
|
|
|
|
+ changeProduct.setQuantity(item.getChangeQuantity());
|
|
|
|
+ return changeProduct;
|
|
|
|
+ }).collect(Collectors.toList());
|
|
|
|
+
|
|
|
|
+ StockTransferAddDto stockTransferAddDto = new StockTransferAddDto();
|
|
|
|
+ stockTransferAddDto.setJdOrderInfoId(orderId);
|
|
|
|
+ stockTransferAddDto.setOutWarehouseId(issueDto.getWarehouseId());
|
|
|
|
+ stockTransferAddDto.setInWarehouseId(systemConfigService.getValue(SystemConfigKeyConstant.JD_WAREHOUSE_ID, Long.class));
|
|
|
|
+ stockTransferAddDto.setRemark("京东订单出库");
|
|
|
|
+ stockTransferAddDto.setOutTypeEnum(OutTypeEnum.JD);
|
|
|
|
+ stockTransferAddDto.setChangeProductList(changeProductList);
|
|
|
|
+ stockTransferService.add(stockTransferAddDto);
|
|
|
|
+ break;
|
|
|
|
+
|
|
|
|
+ default:
|
|
|
|
+ throw new ServiceException("未知调仓类型");
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
// 查询快递100的物流信息
|
|
// 查询快递100的物流信息
|
|
String logisticsCompanyCode = issueDto.getLogisticsCompanyCode();
|
|
String logisticsCompanyCode = issueDto.getLogisticsCompanyCode();
|
|
String logisticsCode = issueDto.getLogisticsCode();
|
|
String logisticsCode = issueDto.getLogisticsCode();
|
|
@@ -116,42 +127,13 @@ public class OrderDetailsServiceImpl extends ServiceImpl<OrderDetailsMapper, Ord
|
|
// 保存物流消息
|
|
// 保存物流消息
|
|
LogisticsInfo logisticsInfo = new LogisticsInfo();
|
|
LogisticsInfo logisticsInfo = new LogisticsInfo();
|
|
logisticsInfo.setBusinessId(orderId);
|
|
logisticsInfo.setBusinessId(orderId);
|
|
- logisticsInfo.setBusinessType(2);
|
|
|
|
|
|
+ logisticsInfo.setBusinessType(OutTypeEnum.JD.equals(issueDto.getOutTypeEnum()) ? 2 : 3);
|
|
logisticsInfo.setCode(logisticsCode);
|
|
logisticsInfo.setCode(logisticsCode);
|
|
logisticsInfo.setLogisticsCompanyCode(logisticsCompanyCode);
|
|
logisticsInfo.setLogisticsCompanyCode(logisticsCompanyCode);
|
|
logisticsInfo.setWarehouseId(issueDto.getWarehouseId());
|
|
logisticsInfo.setWarehouseId(issueDto.getWarehouseId());
|
|
logisticsInfo.setLogisticsStatus(logisticsStatus);
|
|
logisticsInfo.setLogisticsStatus(logisticsStatus);
|
|
logisticsInfo.setStatus(0);
|
|
logisticsInfo.setStatus(0);
|
|
logisticsInfoService.save(logisticsInfo);
|
|
logisticsInfoService.save(logisticsInfo);
|
|
-
|
|
|
|
- // 京东出库新增调仓
|
|
|
|
- if (issueDto.getOutTypeEnum().equals(OutTypeEnum.JD)) {
|
|
|
|
- // 获取京东仓库id
|
|
|
|
- List<ChangeProduct> changeProductList = issueDto.getOrderDetailsList().stream().map(item -> {
|
|
|
|
- ChangeProduct changeProduct = new ChangeProduct();
|
|
|
|
- changeProduct.setProductId(item.getProductId());
|
|
|
|
- changeProduct.setQuantity(item.getChangeQuantity());
|
|
|
|
- return changeProduct;
|
|
|
|
- }).collect(Collectors.toList());
|
|
|
|
-
|
|
|
|
- StockTransferAddDto stockTransferAddDto = new StockTransferAddDto();
|
|
|
|
- stockTransferAddDto.setJdOrderInfoId(orderId);
|
|
|
|
- stockTransferAddDto.setOutWarehouseId(issueDto.getWarehouseId());
|
|
|
|
- stockTransferAddDto.setInWarehouseId(systemConfigService.getValue(SystemConfigKeyConstant.JD_WAREHOUSE_ID, Long.class));
|
|
|
|
- stockTransferAddDto.setRemark("京东订单出库");
|
|
|
|
- stockTransferAddDto.setOutTypeEnum(OutTypeEnum.JD);
|
|
|
|
- stockTransferAddDto.setChangeProductList(changeProductList);
|
|
|
|
- stockTransferService.add(stockTransferAddDto);
|
|
|
|
- }
|
|
|
|
- // 销售出库添加出库记录
|
|
|
|
- else {
|
|
|
|
- StockChangeDto stockChangeDto = new StockChangeDto();
|
|
|
|
- stockChangeDto.setDefaultWarehouseId(issueDto.getWarehouseId());
|
|
|
|
- stockChangeDto.setTypeEnum(OutTypeEnum.PURCHASE);
|
|
|
|
- stockChangeDto.setChangeDetailsList(issueDto.getOrderDetailsList());
|
|
|
|
- stockService.changeQuantity(stockChangeDto);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -182,7 +164,7 @@ public class OrderDetailsServiceImpl extends ServiceImpl<OrderDetailsMapper, Ord
|
|
private void updateOrderInfoStatus(List<OrderDetails> list, IssueDto issueDto) {
|
|
private void updateOrderInfoStatus(List<OrderDetails> list, IssueDto issueDto) {
|
|
OrderInfo orderInfo = orderInfoService.getById(issueDto.getOrderId());
|
|
OrderInfo orderInfo = orderInfoService.getById(issueDto.getOrderId());
|
|
|
|
|
|
- // 如果是京东出库,出去一次订单则完成
|
|
|
|
|
|
+ // 如果是京东出库,出去一次订单则完成(已补发已出库)
|
|
if (issueDto.getOutTypeEnum().equals(OutTypeEnum.JD)) {
|
|
if (issueDto.getOutTypeEnum().equals(OutTypeEnum.JD)) {
|
|
orderInfo.setStatus(2);
|
|
orderInfo.setStatus(2);
|
|
orderInfo.setIssueStatus(3);
|
|
orderInfo.setIssueStatus(3);
|
|
@@ -190,6 +172,7 @@ public class OrderDetailsServiceImpl extends ServiceImpl<OrderDetailsMapper, Ord
|
|
// 如果是退换货或者补发,出库一次算完成
|
|
// 如果是退换货或者补发,出库一次算完成
|
|
else if (orderInfo.getType() == 5) {
|
|
else if (orderInfo.getType() == 5) {
|
|
orderInfo.setIssueStatus(3);
|
|
orderInfo.setIssueStatus(3);
|
|
|
|
+
|
|
// 补发跟进中变已补发
|
|
// 补发跟进中变已补发
|
|
if (orderInfo.getAfterSalesStatus() == 1) {
|
|
if (orderInfo.getAfterSalesStatus() == 1) {
|
|
orderInfo.setAfterSalesStatus(2);
|
|
orderInfo.setAfterSalesStatus(2);
|