Ver Fonte

获取后台扫码取车二维码

guoshuai há 1 mês atrás
pai
commit
207fa53399

+ 28 - 1
src/main/java/com/qmrb/system/controller/CaSignController.java

@@ -2444,7 +2444,34 @@ public class CaSignController {
         }
         return null;
     }
-    
+    /**
+     * 获取后台扫码取车的二维码
+     * @return
+     */
+    @GetMapping("fetchBackVehicleQrcode")
+    public Result<?> fetchBackVehicleQrcode(){
+        if(SecurityUtils.getUserId() == null){
+            return null;
+        }
+
+        Map<String,Object> map = new HashMap<>();
+
+        try {
+            String key = "fetchVehicle";
+            String redisKey = "pickUp" + RandomUtil.randomString(10);
+            //小程序跳转页面
+            String page = "pages/index/index";
+            byte[] imageBytes = iUserService.getCouponQRCodePng(toolWxConfigService.findConf(),key,redisKey,page);
+            //保存当前时间戳
+            redisTemplate.opsForValue().set(redisKey,System.currentTimeMillis(),fetchVehicleTime,TimeUnit.SECONDS);
+
+            map.put("data",new String(org.apache.commons.codec.binary.Base64.encodeBase64(imageBytes)));
+            return Result.success(map);
+        }catch (Exception e){
+            log.error(e.getMessage(),e);
+        }
+        return null;
+    }
     
     /**
      * 获取扫码取车的二维码