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; } } }