| | |
| | | SimpleDateFormat sim = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | String end = sim.format(dd); |
| | | //把string类型转换为long类型的 |
| | | long st = sim.parse(expireTime).getTime(); |
| | | long en = sim.parse(end).getTime(); |
| | | //计算天数 |
| | | int day = (int) ((st - en) / 86400000); |
| | | if (day <= 30) { |
| | | pages.get(j).setType(1); |
| | | } else { |
| | | pages.get(j).setType(0); |
| | | if (expireTime != null) { |
| | | long st = sim.parse(expireTime).getTime(); |
| | | long en = sim.parse(end).getTime(); |
| | | //计算天数 |
| | | int day = (int) ((st - en) / 86400000); |
| | | if (day <= 30) { |
| | | pages.get(j).setType(1); |
| | | } else { |
| | | pages.get(j).setType(0); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | if (page != null){ |
| | | if (page != null) { |
| | | for (int j = 0; j < page.getRecords().size(); j++) { |
| | | String expireTime = page.getRecords().get(j).getExpireTime(); |
| | | //1.获取当前时间 |
| | |
| | | String end = sim.format(dd); |
| | | //把string类型转换为long类型的 |
| | | |
| | | if (expireTime != null){ |
| | | if (expireTime != null) { |
| | | long st = sim.parse(expireTime).getTime(); |
| | | long en = sim.parse(end).getTime(); |
| | | //计算天数 |
| | |
| | | @GetMapping("/pageDept") |
| | | @ApiOperationSupport(order = 3) |
| | | @ApiOperation(value = "分页", notes = "传入equipment") |
| | | public R<IPage<EquipmentVO>> pageDept(EquipmentVO equipment, Query query, String pid,String dxtype, HttpServletResponse response) throws ParseException { |
| | | public R<IPage<EquipmentVO>> pageDept(EquipmentVO equipment, Query query, String pid, String dxtype, HttpServletResponse response) throws ParseException { |
| | | response.setHeader("Access-Control-Allow-Origin", "*"); |
| | | response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE"); |
| | | response.setHeader("Access-Control-Allow-Credentials", "true"); |
| | | |
| | | IPage<EquipmentVO> page = equipmentService.selectDeptPages(Condition.getPage(query), equipment, pid,dxtype); |
| | | IPage<EquipmentVO> page = equipmentService.selectDeptPages(Condition.getPage(query), equipment, pid, dxtype); |
| | | |
| | | for (int j = 0; j < page.getRecords().size(); j++) { |
| | | String expireTime = page.getRecords().get(j).getExpireTime(); |
| | |
| | | String end = sim.format(dd); |
| | | //把string类型转换为long类型的 |
| | | |
| | | if (expireTime != null){ |
| | | if (expireTime != null) { |
| | | long st = sim.parse(expireTime).getTime(); |
| | | long en = sim.parse(end).getTime(); |
| | | //计算天数 |
| | |
| | | @PostMapping("/updateexpireTime") |
| | | @ApiOperationSupport(order = 5) |
| | | @ApiOperation(value = "修改", notes = "传入equipment") |
| | | public R updateexpireTime(String expireTime,String deviceNumber) { |
| | | equipmentService.updateexpireTime(expireTime,deviceNumber); |
| | | public R updateexpireTime(String expireTime, String deviceNumber) { |
| | | equipmentService.updateexpireTime(expireTime, deviceNumber); |
| | | return R.success("修改成功"); |
| | | } |
| | | |
| | |
| | | @PostMapping("/updateExstate") |
| | | @ApiOperationSupport(order = 5) |
| | | @ApiOperation(value = "修改", notes = "传入equipment") |
| | | public R updateExstate(String state,String reason, String deviceNumber) { |
| | | equipmentService.updateExstate(state,reason,deviceNumber); |
| | | public R updateExstate(String state, String reason, String deviceNumber) { |
| | | equipmentService.updateExstate(state, reason, deviceNumber); |
| | | return R.success("修改成功"); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 监控台统计 |
| | | * |
| | | * @return |
| | | */ |
| | | @PostMapping("/SeleC") |
| | |
| | | //设备故障数量 |
| | | Integer integerg = equipmentService.selectEqCg(); |
| | | Map<String, Object> map = new HashMap<String, Object>(); |
| | | map.put("zx",integerz); |
| | | map.put("dx",integerd); |
| | | map.put("yj",list.size()); |
| | | map.put("gz",integerg); |
| | | map.put("zx", integerz); |
| | | map.put("dx", integerd); |
| | | map.put("yj", list.size()); |
| | | map.put("gz", integerg); |
| | | return R.data(map); |
| | | } |
| | | |