| | |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springblade.core.tool.constant.BladeConstant; |
| | | import org.springblade.core.tool.utils.Func; |
| | | import org.springblade.modules.catalog.entitly.catalog; |
| | | import org.springblade.modules.catalog.service.catalogService; |
| | | import org.springblade.modules.deploy.service.IDeployService; |
| | | import org.springblade.modules.equipment.vo.EquipmentVOS; |
| | |
| | | import org.springblade.core.boot.ctrl.BladeController; |
| | | import springfox.documentation.annotations.ApiIgnore; |
| | | |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | |
| | | @GetMapping("/page") |
| | | @ApiOperationSupport(order = 3) |
| | | @ApiOperation(value = "分页", notes = "传入equipment") |
| | | public R<List<Equipment>> page(EquipmentVO equipment, Query query, String pid, HttpServletResponse response) { |
| | | public R<List<EquipmentVO>> page(EquipmentVO equipment, Query query, String pid, 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"); |
| | |
| | | childMenu = new ArrayList(); |
| | | |
| | | //根据查询条件得到所有设备 |
| | | List<Equipment> pages = equipmentService.selectEquipmentPage(equipment.getDeviceName(), equipment.getAddvcd(), equipment.getDtype(), equipment.getDevicestate()); |
| | | List<EquipmentVO> pages = equipmentService.selectEquipmentPage(equipment.getDeviceName(), equipment.getAddvcd(), equipment.getDtype(), equipment.getDevicestate()); |
| | | |
| | | List<Equipment> datas = new ArrayList<>(); |
| | | List<EquipmentVO> datas = new ArrayList<>(); |
| | | |
| | | if (pid == null) { |
| | | datas = pages; |
| | |
| | | //将得到的设备与查询所得设备进行匹配 |
| | | for (int i = 0; i < childList.size(); i++) { |
| | | for (int j = 0; j < pages.size(); j++) { |
| | | |
| | | String expireTime = pages.get(j).getExpireTime(); |
| | | //1.获取当前时间 |
| | | Date dd=new Date(); |
| | | 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); |
| | | } |
| | | |
| | | |
| | | if (childList.get(i).get("eqid") != null) { |
| | | if (childList.get(i).get("eqid").equals(pages.get(j).getDeviceNumber())) { |
| | | datas.add(pages.get(j)); |