yangys
2025-02-17 74355e14088df2c60da6e9a2b026fa0513709de9
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
package com.qianwen.smartman.common.license;
 
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
 
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.JSONValidator;
import com.qianwen.license.common.LicenseExtraModel;
import com.qianwen.license.common.LicenseVerify;
 
@Component
public class LicenseWrapper {
    //@Autowired
    //private LicenseVerify licenseVerify;
    
    public long getWorkstationAmount() {
        LicenseVerify licenseVerify = new LicenseVerify();
        LicenseExtraModel model = (LicenseExtraModel)licenseVerify.getContent().getExtra();
         
        if(JSONValidator.from(model.getExtData()).validate()) {
            JSONObject jsonObj = JSONObject.parseObject(model.getExtData()) ;
            return jsonObj.getLong("workstationAmount");
        }else {
            return 0;
        }
    }
}