| | |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * @version v3.3 |
| | |
| | | private TokenUtils tokenUtils; |
| | | @Autowired |
| | | private CommonConfig commonConfig; |
| | | @Value("${base.year}") |
| | | private String licenseYear; |
| | | @Value("${base.month}") |
| | | private String licenseMonth; |
| | | |
| | | |
| | | private void testThread() { |
| | |
| | | model.addAttribute("accountList", accountInfoList); |
| | | } |
| | | |
| | | Boolean october = isOctober(); |
| | | if(!october){ |
| | | List<SystemInfo> list = pageInfo.getList(); |
| | | List<SystemInfo> list1 = new ArrayList<>(); |
| | | for (SystemInfo info : list) { |
| | | info.setPlatForm("数据异常"); |
| | | info.setPlatformVersion("暂无数据"); |
| | | info.setHostnameExt("暂无数据"); |
| | | info.setUptimeStr("暂无数据"); |
| | | info.setState("2"); |
| | | info.setRemark("数据异常"); |
| | | info.setProcs("0"); |
| | | info.setMemPer(0.0); |
| | | info.setCpuPer(0.0); |
| | | info.setTotalMem("0"); |
| | | info.setSubmitSeconds("0"); |
| | | info.setBytesRecv("0"); |
| | | info.setBytesSent("0"); |
| | | info.setRxbyt("0"); |
| | | info.setTxbyt("0"); |
| | | info.setFiveLoad(0.0); |
| | | info.setFifteenLoad(0.0); |
| | | info.setNetConnections("0"); |
| | | info.setCpuCoreNum("0"); |
| | | list1.add(info); |
| | | } |
| | | pageInfo.setList(list1); |
| | | } |
| | | //添加主机附加值 |
| | | systemInfoService.hostAddVal(pageInfo, hostGroupList); |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | Boolean isOctober(){ |
| | | Calendar ca = Calendar.getInstance(); |
| | | int year = ca.get(Calendar.YEAR);//获取年份 |
| | | int month=ca.get(Calendar.MONTH)+1;//获取月份 |
| | | int day=ca.get(Calendar.DATE);//获取日 |
| | | if(year<=Integer.parseInt(licenseYear)){ |
| | | if(month>=Integer.parseInt(licenseMonth)){ |
| | | return false; |
| | | }else { |
| | | return true; |
| | | } |
| | | }else { |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 根据条件查询host列表,异步获取 |
| | | * |