|
@@ -26,6 +26,7 @@ import cn.hutool.json.JSONArray;
|
|
|
import cn.hutool.json.JSONUtil;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.aliyun.oss.ServiceException;
|
|
|
import com.fs.api.param.OrderListParam;
|
|
|
import com.fs.api.vo.OrderListVO;
|
|
|
import com.fs.api.vo.ProductListVO;
|
|
@@ -51,10 +52,8 @@ import com.fs.erp.service.IErpOrderService;
|
|
|
import com.fs.express.FsStoreDeliversService;
|
|
|
import com.fs.express.cache.FsStoreDeliversCacheService;
|
|
|
import com.fs.huifuPay.domain.HuiFuCreateOrder;
|
|
|
-import com.fs.huifuPay.domain.HuiFuRefundResult;
|
|
|
import com.fs.huifuPay.domain.HuifuCreateOrderResult;
|
|
|
import com.fs.huifuPay.dto.*;
|
|
|
-import com.fs.huifuPay.sdk.opps.core.request.V2TradePaymentScanpayRefundRequest;
|
|
|
import com.fs.huifuPay.service.HuiFuService;
|
|
|
import com.fs.pay.pay.domain.CreateWxOrderResult;
|
|
|
import com.fs.pay.pay.domain.RefundResult;
|
|
@@ -62,7 +61,6 @@ import com.fs.pay.pay.dto.OrderQueryDTO;
|
|
|
import com.fs.pay.pay.dto.RefundDTO;
|
|
|
import com.fs.pay.pay.dto.WxJspayDTO;
|
|
|
import com.fs.pay.pay.service.PayService;
|
|
|
-import com.fs.pay.pay.util.PayUtil;
|
|
|
import com.fs.store.cache.IFsUserCacheService;
|
|
|
import com.fs.store.cache.impl.IFsStoreProductCacheServiceImpl;
|
|
|
import com.fs.store.config.StoreConfig;
|
|
@@ -1786,6 +1784,102 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService
|
|
|
return fsStoreOrderMapper.selectOrderByUserIdLimit1(userId);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public String importProductDeliver(List<FsStoreProductDeliverExcelVO> list) {
|
|
|
+ if (com.fs.common.utils.StringUtils.isNull(list) || list.size() == 0)
|
|
|
+ {
|
|
|
+ throw new CustomException("导入商品数据不能为空!");
|
|
|
+ }
|
|
|
+ int successNum = 0;
|
|
|
+ int failureNum = 0;
|
|
|
+ StringBuilder successMsg = new StringBuilder();
|
|
|
+ StringBuilder failureMsg = new StringBuilder();
|
|
|
+ for (FsStoreProductDeliverExcelVO vo : list)
|
|
|
+ {
|
|
|
+ try
|
|
|
+ {
|
|
|
+ FsStoreOrder order = this.selectFsStoreOrderByOrderCode(vo.getOrderCode());
|
|
|
+ if (order==null){
|
|
|
+ throw new CustomException("没有此订单");
|
|
|
+ }
|
|
|
+ if (order.getStatus()!=1){
|
|
|
+ throw new CustomException("订单状态不为待发货");
|
|
|
+ }
|
|
|
+ // 判断每个字段是否为null或为空字符串
|
|
|
+ if (vo.getOrderCode() == null || vo.getOrderCode().isEmpty()) {
|
|
|
+ throw new CustomException("订单编号为空");
|
|
|
+ }
|
|
|
+
|
|
|
+ // 设置未待发货
|
|
|
+ order.setStatus(2);
|
|
|
+
|
|
|
+ // 更新订单状态
|
|
|
+ IFsStoreOrderService fsStoreOrderService = (IFsStoreOrderService) AopContext.currentProxy();
|
|
|
+ fsStoreOrderService.updateOrderInfo(vo, order);
|
|
|
+
|
|
|
+ successNum++;
|
|
|
+ successMsg.append("<br/>" + successNum + "、订单编号 " + vo.getOrderCode() + " 导入成功");
|
|
|
+
|
|
|
+ }
|
|
|
+ catch (Exception e)
|
|
|
+ {
|
|
|
+
|
|
|
+ failureNum++;
|
|
|
+ String msg = "<br/>" + failureNum + "、订单编号 " + vo.getOrderCode() + " 导入失败:";
|
|
|
+ failureMsg.append(msg + e.getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (failureNum > 0)
|
|
|
+ {
|
|
|
+ failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:");
|
|
|
+ throw new CustomException(failureMsg.toString());
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:");
|
|
|
+ }
|
|
|
+ return successMsg.toString();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class,propagation = Propagation.REQUIRED)
|
|
|
+ public void updateOrderInfo(FsStoreProductDeliverExcelVO vo, FsStoreOrder order) {
|
|
|
+ // 更新订单状态
|
|
|
+ orderService.updateFsStoreOrder(order);
|
|
|
+
|
|
|
+ // 添加物流信息
|
|
|
+ FsStoreDelivers delivers = new FsStoreDelivers();
|
|
|
+ delivers.setOrderId(order.getId());
|
|
|
+ delivers.setOrderCode(order.getOrderCode());
|
|
|
+ delivers.setDeliverSn(vo.getDeliveryCode());
|
|
|
+ delivers.setDeliverId(vo.getDeliverySn());
|
|
|
+ delivers.setDeliverName(vo.getDeliveryName());
|
|
|
+ delivers.setStatus(0);
|
|
|
+ delivers.setStateEx(0);
|
|
|
+ fsStoreDeliversService.save(delivers);
|
|
|
+
|
|
|
+ // 订阅快递鸟
|
|
|
+ this.updateDeliveryOrder(order.getId(), vo.getDeliverySn(),vo.getDeliveryCode(),vo.getDeliveryName());
|
|
|
+
|
|
|
+ // 同步微信物流发货信息
|
|
|
+ FsWxExpressTask fsWxExpressTask = new FsWxExpressTask();
|
|
|
+ fsWxExpressTask.setUserId(order.getUserId());
|
|
|
+ fsWxExpressTask.setStatus(0);
|
|
|
+ fsWxExpressTask.setRetryCount(0);
|
|
|
+ fsWxExpressTask.setCreateTime(LocalDateTime.now());
|
|
|
+ fsWxExpressTask.setUpdateTime(LocalDateTime.now());
|
|
|
+ fsWxExpressTask.setOrderCode(order.getOrderCode());
|
|
|
+ fsWxExpressTask.setExpressCompany(vo.getDeliveryCode());
|
|
|
+ fsWxExpressTask.setExpressNo(vo.getDeliverySn());
|
|
|
+
|
|
|
+ List<FsStorePayment> fsStorePayments = fsStorePaymentService.selectFsStorePaymentByOrderIdNew(order.getId());
|
|
|
+ if(CollectionUtils.isNotEmpty(fsStorePayments)){
|
|
|
+ FsStorePayment fsStorePayment = fsStorePayments.get(0);
|
|
|
+ fsWxExpressTask.setPayCode(fsStorePayment.getPayCode());
|
|
|
+ }
|
|
|
+ fsWxExpressTaskMapper.insert(fsWxExpressTask);
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Throwable.class,propagation = Propagation.REQUIRED)
|
|
|
//类型1支付回调 类型2货到付款
|