1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package com.ard.work.util;
 
import com.alibaba.fastjson2.JSONObject;
import com.ard.system.authorize.service.AuthorizeService;
 
import javax.annotation.Resource;
 
/**
 * @author: 共方法类
 * @date: 2025/3/4
 * @description:
 */
public class UtilMethod {
 
    @Resource
    private AuthorizeService authorizeService;
 
    /**
     * 根据授权数量,验证授权信息是否合规
     */
    public void authorizationVerification(int ls){
        JSONObject data = authorizeService.getAuthorizationInfo();
        if ("normal".equals(data.get("Type"))){
            int droneNum = (int) data.get("droneNum");
            if (ls > droneNum){
                throw new RuntimeException("添加无人机数量超过当前授权数量!!!");
            }
        }else if ("expired".equals(data.get("Type"))){
            throw new RuntimeException("授权文件过期!!!");
        }else if ("mismatch".equals(data.get("Type"))){
            throw new RuntimeException("授权文件不匹配!!!");
        }
    }
 
}