xdd 2 周之前
父节点
当前提交
5ec9180af1

+ 3 - 0
deploy.sh

@@ -9,6 +9,7 @@ REMOTE_BASE_DIR="/home/software"  # 远程服务器上的部署目录,根据
 LOCAL_FS_ADMIN_JAR="./fs-admin/target/fs-admin.jar" # 假设target目录和你提供的 tree 命令显示的目录同级
 LOCAL_FS_COMPANY_JAR="./fs-company/target/fs-company.jar"
 LOCAL_FS_USER_APP_JAR="./fs-user-app/target/fs-user-app.jar"
+LOCAL_FS_API_JAR="./fs-api/target/fs-api.jar"
 
 # 函数:检查本地文件是否存在
 check_local_file() {
@@ -52,6 +53,8 @@ deploy_jar() {
 # 部署 fs-admin
 deploy_jar "$LOCAL_FS_ADMIN_JAR" "fs-admin"
 
+deploy_jar "$LOCAL_FS_API_JAR" "fs-api"
+
 # 部署 fs-company
 deploy_jar "$LOCAL_FS_COMPANY_JAR" "fs-company"
 

+ 28 - 0
fs-admin/src/main/java/com/fs/store/controller/FsStoreOrderController.java

@@ -475,6 +475,34 @@ public class FsStoreOrderController extends BaseController {
         return util.importTemplateExcel("物流回单数据");
     }
 
+    /**
+     * 导入运单号
+     * @return
+     */
+    @GetMapping("/getTemplate")
+    public AjaxResult sendExport()
+    {
+        ExcelUtil<FsStoreProductDeliverExcelVO> util = new ExcelUtil<>(FsStoreProductDeliverExcelVO.class);
+        return util.importTemplateExcel("导入运单号");
+    }
+
+    /**
+     * 导入运单号
+     * @param file
+     * @param updateSupport
+     * @return
+     * @throws Exception
+     */
+    @Log(title = "导入运单号", businessType = BusinessType.IMPORT)
+    @PostMapping("/importOrderExpressTemplate")
+    public AjaxResult importOrderExpressTemplate(MultipartFile file, boolean updateSupport) throws Exception
+    {
+        ExcelUtil<FsStoreProductDeliverExcelVO> util = new ExcelUtil<>(FsStoreProductDeliverExcelVO.class);
+        List<FsStoreProductDeliverExcelVO> list = util.importExcel(file.getInputStream());
+        String message = fsStoreOrderService.importProductDeliver(list);
+        return AjaxResult.success(message);
+    }
+
 
     @GetMapping("/getStoreOrder")
     public R getStoreOrder(@RequestParam("orderCode") String orderCode) {

+ 4 - 0
fs-service-system/src/main/java/com/fs/express/impl/FsStoreDeliversServiceImpl.java

@@ -3,6 +3,7 @@ package com.fs.express.impl;
 import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.core.util.StrUtil;
 import com.fs.common.utils.PhoneUtils;
+import com.fs.common.utils.ServletUtils;
 import com.fs.express.FsStoreDeliversService;
 import com.fs.express.IExpressService;
 import com.fs.express.dto.DeliveryDTO;
@@ -13,6 +14,7 @@ import com.fs.store.enums.ShipperCodeEnum;
 import com.fs.store.mapper.FsStoreDeliversMapper;
 import com.fs.store.service.IFsExpressService;
 import com.fs.store.service.IFsStoreOrderService;
+import com.thoughtworks.xstream.core.SecurityUtils;
 import org.apache.commons.lang.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -53,6 +55,8 @@ public class FsStoreDeliversServiceImpl implements FsStoreDeliversService {
     @Override
     @Transactional(rollbackFor = Exception.class)
     public FsStoreDelivers save(FsStoreDelivers fsStoreDelivers) {
+        fsStoreDelivers.setUpdateTime(LocalDateTime.now());
+        fsStoreDelivers.setCreateTime(LocalDateTime.now());
         if (fsStoreDelivers.getId() == null) {
             fsStoreDelivers.setCreateTime(LocalDateTime.now());
             fsStoreDeliversMapper.insert(fsStoreDelivers);

+ 4 - 1
fs-service-system/src/main/java/com/fs/store/service/IFsStoreOrderService.java

@@ -135,7 +135,9 @@ public interface IFsStoreOrderService
 
     R finishOrder(Long orderId);
 
-    String payConfirm(Integer type,Long orderId,String payCode,String tradeNo,String bankTransactionId,String bankSerialNo);
+    void updateOrderInfo(FsStoreProductDeliverExcelVO vo, FsStoreOrder order);
+
+    String payConfirm(Integer type, Long orderId, String payCode, String tradeNo, String bankTransactionId, String bankSerialNo);
 
     Integer selectFsStoreOrderCount(long userId, int status);
 
@@ -299,4 +301,5 @@ public interface IFsStoreOrderService
 
     FsStoreOrder selectOrderByUserIdLimit1(Long userId);
 
+    String importProductDeliver(List<FsStoreProductDeliverExcelVO> list);
 }

+ 97 - 3
fs-service-system/src/main/java/com/fs/store/service/impl/FsStoreOrderServiceImpl.java

@@ -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货到付款

+ 24 - 0
fs-service-system/src/main/java/com/fs/store/vo/FsStoreProductDeliverExcelVO.java

@@ -0,0 +1,24 @@
+package com.fs.store.vo;
+
+import com.fs.common.annotation.Excel;
+import lombok.Data;
+
+@Data
+public class FsStoreProductDeliverExcelVO {
+
+    @Excel(name = "订单编号")
+    private String orderCode;
+
+
+    /** 快递公司编号 */
+    @Excel(name = "快递公司编号")
+    private String deliveryCode;
+
+    /** 快递名称 */
+    @Excel(name = "快递名称")
+    private String deliveryName;
+
+    /** 快递单号 */
+    @Excel(name = "快递单号")
+    private String deliverySn;
+}

+ 10 - 0
fs-user-app/src/main/java/com/fs/app/controller/StoreOrderController.java

@@ -2,10 +2,13 @@ package com.fs.app.controller;
 
 import cn.hutool.core.util.ObjectUtil;
 import com.fs.app.annotation.Login;
+import com.fs.app.vo.FsStoreProductDeliverExcelVO;
 import com.fs.common.annotation.RepeatSubmit;
 
+import com.fs.common.core.domain.AjaxResult;
 import com.fs.common.core.domain.R;
 import com.fs.common.exception.CustomException;
+import com.fs.common.utils.poi.ExcelUtil;
 import com.fs.store.domain.*;
 import com.fs.store.dto.FsStoreOrderComputeDTO;
 
@@ -289,4 +292,11 @@ public class StoreOrderController extends  AppBaseController {
         return R.ok().put("count0",count0).put("count1",count1).put("count2",count2).put("afterSalesCount",afterSalesCount);
     }
 
+
+    @GetMapping("/importTemplate")
+    public AjaxResult sendExport()
+    {
+        ExcelUtil<FsStoreProductDeliverExcelVO> util = new ExcelUtil<>(FsStoreProductDeliverExcelVO.class);
+        return util.importTemplateExcel("导入运单号");
+    }
 }

+ 24 - 0
fs-user-app/src/main/java/com/fs/app/vo/FsStoreProductDeliverExcelVO.java

@@ -0,0 +1,24 @@
+package com.fs.app.vo;
+
+import com.fs.common.annotation.Excel;
+import lombok.Data;
+
+@Data
+public class FsStoreProductDeliverExcelVO {
+
+    @Excel(name = "订单编号")
+    private String orderCode;
+
+
+    /** 快递公司编号 */
+    @Excel(name = "快递公司编号")
+    private String deliveryCode;
+
+    /** 快递名称 */
+    @Excel(name = "快递名称")
+    private String deliveryName;
+
+    /** 快递单号 */
+    @Excel(name = "快递单号")
+    private String deliverySn;
+}