| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * @author kdq |
| | |
| | | private DongHuanBaoJingService dongHuanBaoJingService; |
| | | @Autowired |
| | | private WarnService warnService; |
| | | @Value("${donghuan.ip}") |
| | | private String ip; |
| | | @Value("${donghuan.loginUrl}") |
| | | private String loginUrl; |
| | | @Value("${donghuan.deviceClassUrl}") |
| | | private String deviceClassUrl; |
| | | @Value("${donghuan.intelligentUrl}") |
| | | private String intelligentUrl; |
| | | @Value("${donghuan.findDevice}") |
| | | private String findDevice; |
| | | @Value("${donghuan.findDeviceVar}") |
| | | private String findDeviceVar; |
| | | @Value("${donghuan.findControlByDeviceId}") |
| | | private String findControlByDeviceId; |
| | | @Value("${donghuan.control}") |
| | | private String control; |
| | | @Value("${donghuan.findValueByDeviceId}") |
| | | private String findValueByDeviceId; |
| | | @Value("${donghuan.findValueByIntelligentId}") |
| | | private String findValueByIntelligentId; |
| | | @Value("${donghuan.findValueByStationId}") |
| | | private String findValueByStationId; |
| | | @Value("${donghuan.meterDatas}") |
| | | private String meterDatas; |
| | | @Value("${donghuan.varDatas}") |
| | | private String varDatas; |
| | | @Value("${donghuan.alarm}") |
| | | private String alarm; |
| | | @Value("${license.year}") |
| | | private String Lyear; |
| | | @Value("${license.month}") |
| | | private String Lmonth; |
| | | |
| | | private String token; |
| | | 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(Lyear)){ |
| | | if(month>=Integer.parseInt(Lmonth)){ |
| | | return false; |
| | | }else { |
| | | return true; |
| | | } |
| | | }else { |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | @GetMapping("/getLicense") |
| | | public R getLicense(){ |
| | | Boolean october = isOctober(); |
| | | return R.ok(october); |
| | | } |
| | | |
| | | @GetMapping("/getHost") |
| | | public R getServer(){ |
| | |
| | | for (SystemInfo systemInfo : list) { |
| | | Map<String,Object> map = new HashMap<>(); |
| | | map.put("name",systemInfo.getHostName()); |
| | | map.put("runDate",systemInfo.getUptime()); |
| | | map.put("runDate",systemInfo.getUptime()==0?"0分钟":getHourAndMinute(systemInfo.getUptime())); |
| | | map.put("isRun",systemInfo.getState()); |
| | | map.put("remark",systemInfo.getRemark()); |
| | | resultList.add(map); |
| | |
| | | return R.ok(resultList); |
| | | } |
| | | |
| | | String getHourAndMinute(Long time){ |
| | | long hours = time / 3600; |
| | | long hours2 = hours; |
| | | String s = ""; |
| | | if(hours!=0){ |
| | | long day = hours/24; |
| | | if(day!=0){ |
| | | s+=day+"天 "; |
| | | hours = hours - day*24; |
| | | } |
| | | s+=hours+"小时 "; |
| | | long minutes = (time - hours2*3600)/60; |
| | | if(minutes != 0){ |
| | | s+=minutes+"分钟"; |
| | | } |
| | | }else { |
| | | long minutes = time / 60; |
| | | s+=minutes+"分钟"; |
| | | } |
| | | return s; |
| | | } |
| | | |
| | | @GetMapping("/getSnmp") |
| | | public R getSnmp(){ |
| | | Map<String,Object> map = new HashMap<>(); |