Przeglądaj źródła

红德堂-新增积分商品订单物流接口

Long 2 tygodni temu
rodzic
commit
88585b24a4

+ 28 - 0
fs-user-app/src/main/java/com/fs/app/controller/IntegralController.java

@@ -2,6 +2,7 @@ package com.fs.app.controller;
 
 
 import cn.hutool.core.lang.TypeReference;
+import cn.hutool.core.util.StrUtil;
 import cn.hutool.json.JSONUtil;
 import com.alibaba.fastjson.JSON;
 import com.fs.app.annotation.Login;
@@ -11,8 +12,10 @@ import com.fs.common.core.page.TableDataInfo;
 import com.fs.common.utils.CloudHostUtils;
 import com.fs.common.utils.StringUtils;
 import com.fs.his.domain.*;
+import com.fs.his.dto.ExpressInfoDTO;
 import com.fs.his.enums.FsUserIntegralLogTypeEnum;
 import com.fs.his.enums.PaymentMethodEnum;
+import com.fs.his.enums.ShipperCodeEnum;
 import com.fs.his.param.*;
 import com.fs.his.service.*;
 import com.fs.his.vo.*;
@@ -31,6 +34,8 @@ import javax.servlet.http.HttpServletRequest;
 import java.math.BigDecimal;
 import java.util.*;
 
+import static com.fs.his.utils.PhoneUtil.decryptPhone;
+
 
 @Slf4j
 @Api("积分接口")
@@ -54,6 +59,8 @@ public class IntegralController extends  AppBaseController {
     private ISysConfigService configService;
     @Autowired
     private IFsIntegralRedPacketLogService fsIntegralRedPacketLogService;
+    @Autowired
+    private IFsExpressService expressService;
 
     @ApiOperation("获取积分商品列表")
     @GetMapping("/getIntegralGoodsList")
@@ -369,4 +376,25 @@ public class IntegralController extends  AppBaseController {
         return R.ok().put("data", redPacketLog);
     }
 
+    @Login
+    @ApiOperation("物流信息")
+    @GetMapping(value = "/getExpress/{orderId}")
+    public R getExpress(@PathVariable Long orderId) {
+        FsIntegralOrder order = integralOrderService.selectFsIntegralOrderByOrderId(orderId);
+        if (Objects.isNull(order)) {
+            return R.error("订单不存在");
+        }
+
+        ExpressInfoDTO expressInfoDTO=null;
+        if(StringUtils.isNotEmpty(order.getDeliverySn())){
+            String lastFourNumber = "";
+            if (order.getDeliveryCode().equals(ShipperCodeEnum.SF.getValue())) {
+                lastFourNumber = order.getUserPhone().length() > 11 ? decryptPhone(order.getUserPhone()) : order.getUserPhone();
+                lastFourNumber = StrUtil.sub(lastFourNumber, lastFourNumber.length(), -4);
+            }
+            expressInfoDTO = expressService.getExpressInfo(order.getOrderCode(),order.getDeliveryCode(),order.getDeliverySn(),lastFourNumber);
+        }
+        return R.ok().put("data", expressInfoDTO).put("deliveryName", order.getDeliveryName());
+    }
+
 }