|  |  |  | 
|---|
|  |  |  | import com.zy.asrs.wms.system.license.entity.license.*; | 
|---|
|  |  |  | import com.zy.asrs.framework.common.Cools; | 
|---|
|  |  |  | import com.zy.asrs.framework.common.R; | 
|---|
|  |  |  | import com.zy.asrs.wms.system.license.timer.LicenseTimer; | 
|---|
|  |  |  | import de.schlichtherle.license.LicenseContent; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Value; | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Value("${license.licensePath}") | 
|---|
|  |  |  | private String licensePath; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private LicenseCheckListener licenseCheckListener; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private LicenseTimer licenseTimer; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 获取服务器硬件信息 | 
|---|
|  |  |  | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @RequestMapping(value = "/getLicenseDays") | 
|---|
|  |  |  | public R getLicenseDays() { | 
|---|
|  |  |  | LicenseVerify licenseVerify = new LicenseVerify(); | 
|---|
|  |  |  | LicenseContent verifyInfo = licenseVerify.getVerifyInfo(); | 
|---|
|  |  |  | if (verifyInfo == null) { | 
|---|
|  |  |  | return R.error(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Date start = new Date(); | 
|---|
|  |  |  | Date end = verifyInfo.getNotAfter(); | 
|---|
|  |  |  | Long starTime = start.getTime(); | 
|---|
|  |  |  | Long endTime = end.getTime(); | 
|---|
|  |  |  | Long num = endTime - starTime;//时间戳相差的毫秒数 | 
|---|
|  |  |  | int day = (int) (num / 24 / 60 / 60 / 1000); | 
|---|
|  |  |  | return R.ok().add(day); | 
|---|
|  |  |  | return R.ok().add(licenseTimer.getLicenseDays()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @RequestMapping(value = "/updateLicense") | 
|---|