Selaa lähdekoodia

授权工具更新

lyhzzz 2 vuotta sitten
vanhempi
commit
aafc8a10d7

+ 3 - 0
src/main/java/com/fdkankan/manage/ManageApplication.java

@@ -31,6 +31,8 @@ public class ManageApplication implements CommandLineRunner {
     private String publicKey;
     @Value("${camera.snCode.privateKey:1}")
     private String privateKey;
+    @Value("${laser.reg.env:UAT}")
+    private String laserRegEnv;
 
     public static void main(String[] args) {
         SpringApplication.run(ManageApplication.class, args);
@@ -44,6 +46,7 @@ public class ManageApplication implements CommandLineRunner {
         CacheUtil.cameraSpaceNum = cameraSpaceNum;
         CacheUtil.publicKey = publicKey;
         CacheUtil.privateKey = privateKey;
+        CacheUtil.laserRegEnv = laserRegEnv;
 
     }
 }

+ 1 - 0
src/main/java/com/fdkankan/manage/common/CacheUtil.java

@@ -11,6 +11,7 @@ public class CacheUtil {
     public static String cameraSpaceNum;
     public static String publicKey;
     public static String privateKey;
+    public static String laserRegEnv;
     public static OrderParam orderParam = new OrderParam();
     public static AgentNewLogParam agentParam = new AgentNewLogParam();
 

+ 4 - 3
src/main/java/com/fdkankan/manage/service/impl/AuthorizeCameraServiceImpl.java

@@ -5,6 +5,7 @@ import cn.dev33.satoken.stp.StpUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.fdkankan.common.util.SecurityUtil;
+import com.fdkankan.manage.common.CacheUtil;
 import com.fdkankan.manage.common.PageInfo;
 import com.fdkankan.manage.common.ResultCode;
 import com.fdkankan.manage.entity.*;
@@ -95,7 +96,7 @@ public class AuthorizeCameraServiceImpl extends ServiceImpl<IAuthorizeCameraMapp
             //获取机器UUID,机器名称
             MachineRegDto machineRegDto = null;
             try {
-                 machineRegDto = RegCodeUtil.ParseMachineCode(param.getMachineCode());
+                 machineRegDto = RegCodeUtil.builder().env(CacheUtil.laserRegEnv).build().ParseMachineCode(param.getMachineCode());
             }catch (Exception e){
                 throw new BusinessException(ResultCode.MACHINE_CODE_ERROR);
             }
@@ -142,7 +143,7 @@ public class AuthorizeCameraServiceImpl extends ServiceImpl<IAuthorizeCameraMapp
                 }
                 param.setCameraNum(detailHashMap.size());
                 dtos.setCamRegs(camRegs);
-                String authorizeKey =  RegCodeUtil.batchGenRegeditCamCode(dtos);
+                String authorizeKey =  RegCodeUtil.builder().env(CacheUtil.laserRegEnv).build().batchGenRegeditCamCode(dtos);
                 if(StringUtils.isBlank(authorizeKey)){
                     throw new BusinessException(ResultCode.GET_MACHINE_CODE_ERROR);
                 }
@@ -201,7 +202,7 @@ public class AuthorizeCameraServiceImpl extends ServiceImpl<IAuthorizeCameraMapp
             camRegDto.setToSn(snCode);
             camRegs.add(camRegDto);
             dtos.setCamRegs(camRegs);
-            String authorizeKey =  RegCodeUtil.batchGenRegeditCamCode(dtos);
+            String authorizeKey =  RegCodeUtil.builder().env(CacheUtil.laserRegEnv).build().batchGenRegeditCamCode(dtos);
             if(StringUtils.isBlank(authorizeKey)){
                 throw new BusinessException(ResultCode.GET_MACHINE_CODE_ERROR);
             }

+ 4 - 3
src/main/java/com/fdkankan/manage/service/impl/AuthorizeInstallServiceImpl.java

@@ -3,6 +3,7 @@ package com.fdkankan.manage.service.impl;
 import cn.dev33.satoken.stp.StpUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.fdkankan.manage.common.CacheUtil;
 import com.fdkankan.manage.common.PageInfo;
 import com.fdkankan.manage.common.ResultCode;
 import com.fdkankan.manage.entity.AuthorizeInstall;
@@ -73,13 +74,13 @@ public class AuthorizeInstallServiceImpl extends ServiceImpl<IAuthorizeInstallMa
         param.setSysUserId(Long.valueOf((String) StpUtil.getLoginId()));
         if(param.getId() == null){
             //获取机器UUID,机器名称
-            MachineRegDto machineRegDto = RegCodeUtil.ParseMachineCode(param.getMachineCode());
+            MachineRegDto machineRegDto = RegCodeUtil.builder().env(CacheUtil.laserRegEnv).build().ParseMachineCode(param.getMachineCode());
             if(machineRegDto == null){
                 throw new BusinessException(ResultCode.READ_MACHINE_CODE_ERROR);
             }
             param.setMachineUuid( machineRegDto.getUuid());
             try {
-                String authorizeKey = RegCodeUtil.GenRegeditCode(param.getMachineCode());
+                String authorizeKey = RegCodeUtil.builder().env(CacheUtil.laserRegEnv).build().GenRegeditCode(param.getMachineCode());
                 if(StringUtils.isBlank(authorizeKey)){
                     throw new BusinessException(ResultCode.GET_MACHINE_CODE_ERROR);
                 }
@@ -102,7 +103,7 @@ public class AuthorizeInstallServiceImpl extends ServiceImpl<IAuthorizeInstallMa
         }
         MachineRegDto machineRegDto = null;
         try {
-            machineRegDto = RegCodeUtil.ParseMachineCode(machineCode);
+            machineRegDto = RegCodeUtil.builder().env(CacheUtil.laserRegEnv).build().ParseMachineCode(machineCode);
         }catch (Exception e){
             throw new BusinessException(ResultCode.MACHINE_CODE_ERROR);
         }