|
@@ -3,6 +3,7 @@ package com.fs.hisStore.service.impl;
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.core.date.DateTime;
|
|
|
import cn.hutool.core.util.IdUtil;
|
|
|
+import cn.hutool.core.util.ObjectUtil;
|
|
|
import cn.hutool.json.JSONUtil;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
@@ -15,8 +16,11 @@ import com.fs.common.utils.StringUtils;
|
|
|
import com.fs.company.service.ICompanyService;
|
|
|
import com.fs.core.config.WxPayProperties;
|
|
|
import com.fs.core.utils.OrderCodeUtils;
|
|
|
+import com.fs.erp.constant.AfterSalesOrderStatusEnum;
|
|
|
+import com.fs.erp.domain.FsJstAftersalePush;
|
|
|
import com.fs.erp.dto.BaseResponse;
|
|
|
import com.fs.erp.dto.ErpRefundUpdateRequest;
|
|
|
+import com.fs.erp.mapper.FsJstAftersalePushMapper;
|
|
|
import com.fs.erp.service.IErpOrderService;
|
|
|
import com.fs.his.config.FsSysConfig;
|
|
|
import com.fs.his.domain.*;
|
|
@@ -28,7 +32,7 @@ import com.fs.his.service.IFsStoreOrderLogsService;
|
|
|
import com.fs.his.utils.ConfigUtil;
|
|
|
import com.fs.his.vo.FsStoreAfterSalesExcelVO;
|
|
|
import com.fs.his.vo.FsStoreAfterSalesLogsVO;
|
|
|
-import com.fs.hisStore.enums.SysConfigEnum;
|
|
|
+import com.fs.hisStore.enums.*;
|
|
|
import com.fs.hisStore.mapper.*;
|
|
|
import com.fs.hisStore.param.*;
|
|
|
import com.fs.huifuPay.domain.HuiFuRefundResult;
|
|
@@ -38,9 +42,6 @@ import com.fs.pay.service.IPayService;
|
|
|
import com.fs.hisStore.config.StoreConfig;
|
|
|
import com.fs.hisStore.domain.*;
|
|
|
import com.fs.hisStore.dto.StoreOrderProductDTO;
|
|
|
-import com.fs.hisStore.enums.AfterSalesStatusEnum;
|
|
|
-import com.fs.hisStore.enums.AfterStatusEnum;
|
|
|
-import com.fs.hisStore.enums.OrderInfoEnum;
|
|
|
import com.fs.hisStore.service.*;
|
|
|
import com.fs.hisStore.vo.FsStoreAfterSalesQueryVO;
|
|
|
import com.fs.hisStore.vo.FsStoreAfterSalesVO;
|
|
@@ -774,6 +775,10 @@ public class FsStoreAfterSalesScrmServiceImpl implements IFsStoreAfterSalesScrmS
|
|
|
return R.ok();
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private FsJstAftersalePushMapper fsJstAftersalePushMapper;
|
|
|
+
|
|
|
//平台撤销
|
|
|
@Override
|
|
|
@Transactional
|
|
@@ -798,21 +803,35 @@ public class FsStoreAfterSalesScrmServiceImpl implements IFsStoreAfterSalesScrmS
|
|
|
storeAfterSalesStatus.setChangeTime(Timestamp.valueOf(LocalDateTime.now()));
|
|
|
storeAfterSalesStatus.setOperator(param.getOperator());
|
|
|
afterSalesStatusService.insertFsStoreAfterSalesStatus(storeAfterSalesStatus);
|
|
|
- //创建新的OMS订单
|
|
|
- if (storeAfterSales.getOrderStatus().equals(OrderInfoEnum.STATUS_1.getValue()) ) {
|
|
|
- if(StringUtils.isNotEmpty(order.getExtendOrderId())){
|
|
|
- //更新订单code
|
|
|
- String orderSn = IdUtil.getSnowflake(0, 0).nextIdStr();
|
|
|
- FsStoreOrderScrm orderMap=new FsStoreOrderScrm();
|
|
|
- orderMap.setId(order.getId());
|
|
|
- orderMap.setOrderCode(orderSn);
|
|
|
- orderService.updateFsStoreOrder(orderMap);
|
|
|
- storeAfterSales.setOrderCode(orderSn);
|
|
|
- orderItemService.updateFsStoreOrderCode(order.getId(),orderSn);
|
|
|
- //生成新的订单
|
|
|
- orderService.createOmsOrder(order.getId());
|
|
|
+
|
|
|
+ // 如果已发货走发货售后逻辑,否则直接取消
|
|
|
+ if(ObjectUtil.equal(order.getStatus(),2)){
|
|
|
+ FsJstAftersalePush fsJstAftersalePush = new FsJstAftersalePush();
|
|
|
+ fsJstAftersalePush.setOrderId(order.getOrderCode());
|
|
|
+ fsJstAftersalePush.setTaskStatus(TaskStatusEnum.PENDING.getCode());
|
|
|
+ fsJstAftersalePush.setType(String.valueOf(AfterSalesOrderStatusEnum.CLOSED.getIndex()));
|
|
|
+ fsJstAftersalePush.setRetryCount(0);
|
|
|
+ fsJstAftersalePush.setAfterSaleId(String.valueOf(storeAfterSales.getId()));
|
|
|
+ fsJstAftersalePushMapper.insert(fsJstAftersalePush);
|
|
|
+ } else {
|
|
|
+ //创建新的OMS订单
|
|
|
+ if (storeAfterSales.getOrderStatus().equals(OrderInfoEnum.STATUS_1.getValue()) ) {
|
|
|
+ if(StringUtils.isNotEmpty(order.getExtendOrderId())){
|
|
|
+ //更新订单code
|
|
|
+ String orderSn = IdUtil.getSnowflake(0, 0).nextIdStr();
|
|
|
+ FsStoreOrderScrm orderMap=new FsStoreOrderScrm();
|
|
|
+ orderMap.setId(order.getId());
|
|
|
+ orderMap.setOrderCode(orderSn);
|
|
|
+ orderService.updateFsStoreOrder(orderMap);
|
|
|
+ storeAfterSales.setOrderCode(orderSn);
|
|
|
+ orderItemService.updateFsStoreOrderCode(order.getId(),orderSn);
|
|
|
+ //生成新的订单
|
|
|
+ orderService.createOmsOrder(order.getId());
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
fsStoreAfterSalesMapper.updateFsStoreAfterSales(storeAfterSales);
|
|
|
return R.ok();
|
|
|
|