Просмотр исходного кода

feat: 二维码获取逻辑调整;

hanchaolong 4 дней назад
Родитель
Сommit
fa5ee3fdd0

+ 2 - 2
jd-logistics-modules/jd-logistics-system/src/main/java/com/ruoyi/front/controller/MonthQRCodeController.java

@@ -40,9 +40,9 @@ public class MonthQRCodeController extends BaseController {
      * @return
      */
     @RequestMapping
-    public AjaxResult qrcode(@RequestParam("source") Integer source) {
+    public AjaxResult qrcode(@RequestParam("source") Integer source, @RequestParam("type") Integer type) {
         try{
-            JSONObject jsonObject = logisticsOrderService.getQRCode(source);
+            JSONObject jsonObject = logisticsOrderService.getQRCode(source, type);
             // 返回完整的二维码信息,包括图片数据
             return AjaxResult.success(jsonObject);
         } catch (ServiceException e) {

+ 4 - 3
jd-logistics-modules/jd-logistics-system/src/main/java/com/ruoyi/logistics/service/LogisticsOrderService.java

@@ -52,10 +52,10 @@ public class LogisticsOrderService {
         return cancelOrder;
     }
 
-    public JSONObject getQRCode(Integer source) {
+    public JSONObject getQRCode(Integer source, Integer type) {
         // 根据订单中的物流公司类型获取对应服务
         LogisticsService logisticsService = logisticsFactory.getLogisticsService(source==1?"JD":"SF");
-        JSONObject qrCode = logisticsService.getMonthQRCode();
+        JSONObject qrCode = logisticsService.getMonthQRCode(type);
 
         if(!qrCode.getBooleanValue("success")){
             throw new ServiceException("获取二维码失败! 原因:"+qrCode.getString("msg"));
@@ -81,8 +81,9 @@ public class LogisticsOrderService {
         monthQRCodeDTO.setDeptId(SecurityUtils.getLoginUser().getSysUser().getDeptId());
         monthQRCodeDTO.setSource(source);
         monthQRCodeDTO.setCreateTime(bizMonthQrcodeRecord.getCreateTime());
+        monthQRCodeDTO.setProcessNum(0);
 
-        redisService.setCacheObject(RedisCacheConstants.MONTH_QRCODE_CACHE_KEY + bizMonthQrcodeRecord.getQrcodeId(), monthQRCodeDTO);
+        redisService.setCacheObject(RedisCacheConstants.MONTH_QRCODE_CACHE_KEY + bizMonthQrcodeRecord.getQrcodeId(), monthQRCodeDTO, 660L, TimeUnit.SECONDS);
 
         // 生成二维码图片
         String qrCodeContent = qrCode.getString("msg");

+ 1 - 1
jd-logistics-modules/jd-logistics-system/src/main/java/com/ruoyi/logistics/service/LogisticsService.java

@@ -45,7 +45,7 @@ public interface LogisticsService {
     /**
      * 获取月结二维码
      */
-    JSONObject getMonthQRCode();
+    JSONObject getMonthQRCode(Integer type);
 
     /**
      * 根据二维码查询

+ 6 - 2
jd-logistics-modules/jd-logistics-system/src/main/java/com/ruoyi/logistics/service/impl/JDLogisticsService.java

@@ -501,7 +501,7 @@ public class JDLogisticsService  implements LogisticsService {
     }
 
     @Override
-    public JSONObject getMonthQRCode() {
+    public JSONObject getMonthQRCode(Integer type) {
         JSONObject result = new JSONObject();
         try {
             //设置接口域名(有的对接方案同时支持生产和沙箱环境,有的仅支持生产,具体以对接方案中的【API文档-请求地址】为准),生产域名:https://api.jdl.com 预发环境域名:https://uat-api.jdl.com
@@ -513,7 +513,11 @@ public class JDLogisticsService  implements LogisticsService {
 
             //取消订单入参对象
             CommonBusinessGetQRCodeRequest requestDTO = new CommonBusinessGetQRCodeRequest();
-            requestDTO.setCustomerCode(sysConfigService.selectConfigByKey(SysConfigConstants.JD_LOGISTICS_CUSTOMERCODE));
+            if (type == 1) {
+                requestDTO.setCustomerCode(sysConfigService.selectConfigByKey(SysConfigConstants.JD_LOGISTICS_CUSTOMERCODE));
+            } else if (type == 2) {
+                requestDTO.setCustomerCode(sysConfigService.selectConfigByKey(SysConfigConstants.JD_LOGISTICS_BUSINESSUNITCODE));
+            }
 
             request.setRequest(requestDTO);
 

+ 1 - 1
jd-logistics-modules/jd-logistics-system/src/main/java/com/ruoyi/logistics/service/impl/SFLogisticsService.java

@@ -341,7 +341,7 @@ public class SFLogisticsService implements LogisticsService {
     }*/
 
     @Override
-    public JSONObject getMonthQRCode() {
+    public JSONObject getMonthQRCode(Integer type) {
         return null;
     }