|
@@ -4,18 +4,24 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
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.constants.SystemConfigKeyConstant;
|
|
|
import com.fjhx.entity.logistics.LogisticsInfo;
|
|
|
import com.fjhx.entity.order.OrderDetails;
|
|
|
import com.fjhx.entity.order.OrderInfo;
|
|
|
+import com.fjhx.enums.stock.OutTypeEnum;
|
|
|
import com.fjhx.mapper.order.OrderDetailsMapper;
|
|
|
import com.fjhx.params.order.IssueVo;
|
|
|
import com.fjhx.params.order.OrderDetailsEx;
|
|
|
import com.fjhx.params.order.OrderDetailsVo;
|
|
|
+import com.fjhx.params.stock.ChangeProduct;
|
|
|
import com.fjhx.params.stock.StockChangeVo;
|
|
|
+import com.fjhx.params.stock.StockTransferAddVo;
|
|
|
import com.fjhx.service.logistics.LogisticsInfoService;
|
|
|
import com.fjhx.service.order.OrderDetailsService;
|
|
|
import com.fjhx.service.order.OrderInfoService;
|
|
|
import com.fjhx.service.stock.StockService;
|
|
|
+import com.fjhx.service.stock.StockTransferService;
|
|
|
+import com.fjhx.service.system.SystemConfigService;
|
|
|
import com.fjhx.uitl.kd100.KD100Util;
|
|
|
import com.fjhx.utils.Assert;
|
|
|
import com.fjhx.utils.wrapperUtil.IWrapper;
|
|
@@ -51,6 +57,13 @@ public class OrderDetailsServiceImpl extends ServiceImpl<OrderDetailsMapper, Ord
|
|
|
@Autowired
|
|
|
private StockService stockService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private StockTransferService stockTransferService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private SystemConfigService systemConfigService;
|
|
|
+
|
|
|
+
|
|
|
@Override
|
|
|
public Page<OrderDetails> getPage(Map<String, Object> condition) {
|
|
|
|
|
@@ -118,14 +131,22 @@ public class OrderDetailsServiceImpl extends ServiceImpl<OrderDetailsMapper, Ord
|
|
|
|
|
|
|
|
|
OrderInfo orderInfo = orderInfoService.getById(orderId);
|
|
|
+
|
|
|
+
|
|
|
+ if (issueVo.getOutTypeEnum().equals(OutTypeEnum.JD)) {
|
|
|
+ orderInfo.setStatus(2);
|
|
|
+ orderInfo.setIssueStatus(3);
|
|
|
+ }
|
|
|
|
|
|
- if (orderInfo.getType() == 5) {
|
|
|
+ else if (orderInfo.getType() == 5) {
|
|
|
orderInfo.setIssueStatus(3);
|
|
|
|
|
|
if (orderInfo.getAfterSalesStatus() == 1) {
|
|
|
orderInfo.setAfterSalesStatus(2);
|
|
|
}
|
|
|
- } else if (orderInfo.getType() == 6) {
|
|
|
+ }
|
|
|
+
|
|
|
+ else if (orderInfo.getType() == 6) {
|
|
|
orderInfo.setIssueStatus(3);
|
|
|
switch (orderInfo.getAfterSalesStatus()) {
|
|
|
|
|
@@ -172,6 +193,28 @@ public class OrderDetailsServiceImpl extends ServiceImpl<OrderDetailsMapper, Ord
|
|
|
stockChangeVo.setTypeEnum(issueVo.getOutTypeEnum());
|
|
|
stockChangeVo.setChangeDetailsList(orderDetailsList);
|
|
|
|
|
|
+
|
|
|
+ if (issueVo.getOutTypeEnum().equals(OutTypeEnum.JD)) {
|
|
|
+
|
|
|
+ Long jdWarehouseId = systemConfigService.getValue(SystemConfigKeyConstant.JD_WAREHOUSE_ID, Long.class);
|
|
|
+
|
|
|
+ StockTransferAddVo stockTransferAddVo = new StockTransferAddVo();
|
|
|
+ stockTransferAddVo.setOutWarehouseId(issueVo.getWarehouseId());
|
|
|
+ stockTransferAddVo.setInWarehouseId(jdWarehouseId);
|
|
|
+ stockTransferAddVo.setRemark("京东出库");
|
|
|
+
|
|
|
+
|
|
|
+ List<ChangeProduct> changeProductList = issueVo.getOrderDetailsList().stream().map(item -> {
|
|
|
+ ChangeProduct changeProduct = new ChangeProduct();
|
|
|
+ changeProduct.setProductId(item.getProductId());
|
|
|
+ changeProduct.setQuantity(item.getChangeQuantity());
|
|
|
+ return changeProduct;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+
|
|
|
+ stockTransferAddVo.setChangeProductList(changeProductList);
|
|
|
+ stockTransferService.add(stockTransferAddVo);
|
|
|
+ }
|
|
|
+
|
|
|
stockService.changeQuantity(stockChangeVo);
|
|
|
}
|
|
|
|