package com.casic.PgInterface.rs; import com.casic.PgInterface.construction.dto.PgConstructionDto; import com.casic.PgInterface.construction.dto.PgConstructionTypeNumStatisticDto; import com.casic.PgInterface.construction.manager.PgConstructionManager; import com.casic.PgInterface.devTable.dto.PgAlarmDto; import com.casic.PgInterface.devTable.dto.PgAlarmTjDto; import com.casic.PgInterface.devTable.manager.PgAlarmManager; import com.casic.PgInterface.patroler.dto.PgInPgInfoDto; import com.casic.PgInterface.patroler.manager.PgInPgPersonManager; import com.casic.PgInterface.patroler.manager.PgInPgStatusManager; import org.springframework.stereotype.Component; import javax.annotation.Resource; import javax.ws.rs.FormParam; import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; /** * Created by yxw on 2018/4/8. */ @Component @Path("pgOverViewRs") public class PgOverViewRs { @Resource private PgInPgStatusManager pgInPgStatusManager; @Resource private PgAlarmManager pgAlarmManager; @Resource private PgConstructionManager pgConstructionManager; //入廊人员 /** * 获取本月入廊人员次数 */ @POST @Path("getPersonNumInPgByMonth") @Produces(MediaType.APPLICATION_JSON) public Map<Object, String> getMonthInPgPersonNum() throws Exception { Map<Object, String> resultMap = new HashMap<>(); String msg = ""; String code="0"; int inNum = 0; try { inNum = pgInPgStatusManager.getMonthInPgPersonNum(); code="200"; msg = "本月入廊人员次数获取成功"; } catch (Exception e) { e.printStackTrace(); msg = "本月入廊人员次数获取失败"; } resultMap.put("code",code); resultMap.put("msg", msg); resultMap.put("result", String.valueOf(inNum)); return resultMap; } /** * 获取本周入廊人员次数 */ @POST @Path("getPersonNumInPgByWeek") @Produces(MediaType.APPLICATION_JSON) public Map<Object, String> getWeekInPgPersonNum() throws Exception { Map<Object, String> resultMap = new HashMap<Object, String>(); String msg = ""; String code="0"; int inNum = 0; try { inNum = pgInPgStatusManager.getWeekInPgPersonNum(); code="200"; msg = "本周入廊人员次数获取成功"; } catch (Exception e) { e.printStackTrace(); msg = "本周入廊人员次数获取失败"; } resultMap.put("code",code); resultMap.put("msg", msg); resultMap.put("result", String.valueOf(inNum)); return resultMap; } /* * 按照天统计入廊人员次数 */ @POST @Path("getDayInPgStatistic") @Produces(MediaType.APPLICATION_JSON) public Map<String, Object> getDayInPgStatistic() throws Exception { Map<String, Object> resultMap = new HashMap<>(); String msg = ""; String code="0"; List<PgInPgInfoDto> pgInPgInfoDtoList = new ArrayList<>(); try { pgInPgInfoDtoList = pgInPgStatusManager.getPgInPersonListByDay(); if (pgInPgInfoDtoList == null) msg = "信息获取失败"; else { code="200"; msg = "信息获取成功"; } } catch (Exception e) { e.printStackTrace(); msg = "信息获取失败"; } resultMap.put("code",code); resultMap.put("msg", msg); resultMap.put("result", pgInPgInfoDtoList); return resultMap; } /* * 入廊人员当天情况统计 */ @POST @Path("getTodayInPgInfo") @Produces(MediaType.APPLICATION_JSON) public Map<String, Object> getTodayInPgInfo() throws Exception { Map<String, Object> resultMap = new HashMap<String, Object>(); String msg = ""; String code="0"; List<PgInPgInfoDto> pgInPgInfoDtoList = new ArrayList<PgInPgInfoDto>(); try { pgInPgInfoDtoList = pgInPgStatusManager.getTodayInPgInfo(); if(pgInPgInfoDtoList!=null||pgInPgInfoDtoList.size()!=0) { code="200"; msg = "信息获取成功"; } else msg="当天没有入廊人员信息"; } catch (Exception e) { e.printStackTrace(); msg = "信息获取失败"; } resultMap.put("code",code); resultMap.put("msg", msg); resultMap.put("result", pgInPgInfoDtoList); return resultMap; } //报警 @POST @Path("getAlarmNum") @Produces(MediaType.APPLICATION_JSON) public Map<String, Object> getAlarmNum(@FormParam("isDevFault") String isDevFault) throws Exception { Map<String, Object> resultMap = new HashMap<String, Object>(); String msg = ""; String code="0"; int num = 0; try { if(isDevFault!=null){ num = pgAlarmManager.getAlarmNum(isDevFault); msg = "报警数量获取成功"; code="200"; } else msg="请输入统计参数"; } catch (Exception e) { e.printStackTrace(); msg = "报警数量统计失败"; } resultMap.put("code",code); resultMap.put("msg", msg); resultMap.put("result", num); return resultMap; } /** * 获取本月报警数 */ @POST @Path("getMonthAlarmNum") @Produces(MediaType.APPLICATION_JSON) public Map<Object, String> getMonthAlarmNum(@FormParam("isDevFault") String isDevFault) throws Exception { Map<Object, String> resultMap = new HashMap<Object, String>(); String msg = ""; String code="0"; int inNum = 0; try { inNum = pgAlarmManager.getMonthAlarmNum(isDevFault); code="200"; msg = "报警次数获取成功"; } catch (Exception e) { e.printStackTrace(); msg = "报警次数获取失败"; } resultMap.put("code",code); resultMap.put("msg", msg); resultMap.put("result", String.valueOf(inNum)); return resultMap; } /** * 获取本周报警数 */ @POST @Path("getWeekAlarmNum") @Produces(MediaType.APPLICATION_JSON) public Map<Object, String> getWeekAlarmNum(@FormParam("isDevFault") String isDevFault) throws Exception { Map<Object, String> resultMap = new HashMap<Object, String>(); String msg = ""; String code="0"; int inNum = 0; try { inNum = pgAlarmManager.getWeekAlarmNum(isDevFault); code="200"; msg = "报警次数获取成功"; } catch (Exception e) { e.printStackTrace(); msg = "报警次数获取失败"; } resultMap.put("code",code); resultMap.put("msg", msg); resultMap.put("result", String.valueOf(inNum)); return resultMap; } /* * 按照天统计报警次数 */ @POST @Path("getDayAlarmStatistic") @Produces(MediaType.APPLICATION_JSON) public Map<String, Object> getDayAlarmStatistic() throws Exception { Map<String, Object> resultMap = new HashMap<>(); String msg = ""; String code="0"; List<PgAlarmTjDto> pgAlarmTjDtoList = new ArrayList<PgAlarmTjDto>(); try { pgAlarmTjDtoList = pgAlarmManager.getDayAlarmStatistic(); if (pgAlarmTjDtoList == null) msg = "信息获取失败"; else { code="200"; msg = "信息获取成功"; } } catch (Exception e) { e.printStackTrace(); msg = "信息获取失败"; } resultMap.put("msg", msg); resultMap.put("result", pgAlarmTjDtoList); return resultMap; } /* * 报警列表和设备故障列表 */ @POST @Path("getAlarmList") @Produces(MediaType.APPLICATION_JSON) public Map<String, Object> getAlarmList(@FormParam("isDevFault") String isDevFault) throws Exception{ Map<String, Object> resultMap = new HashMap<>(); String msg = ""; String code="0"; List<PgAlarmDto> pgAlarmDtoList=new ArrayList<>(); try{ //pgAlarmDtoList=pgAlarmManager.getAlarmList(isDevFault); code="200"; msg="信息获取成功"; } catch(Exception e) { e.printStackTrace(); msg="信息获取失败"; } resultMap.put("code",code); resultMap.put("msg",msg); resultMap.put("result",pgAlarmDtoList); return resultMap; } //施工统计 /* 累计施工数量\在建施工数\完工施工数 */ @POST @Path("getConstructionNum") @Produces(MediaType.APPLICATION_JSON) public Map<String,Object> getConstructionNum() throws Exception{ Map<String, Object> resultMap = new HashMap<String, Object>(); String msg = ""; String code="0"; List<PgConstructionTypeNumStatisticDto> pgConstructionTypeNumDtoList=new ArrayList<PgConstructionTypeNumStatisticDto>(); try{ pgConstructionTypeNumDtoList=pgConstructionManager.getConstructionNum(); msg="施工数量获取成功"; code="200"; } catch(Exception e) { e.printStackTrace(); msg="施工数量统计"; } resultMap.put("code",code); resultMap.put("msg",msg); resultMap.put("result",pgConstructionTypeNumDtoList); return resultMap; } /* 当天在建工程 */ @POST @Path("getConstructionToday") @Produces(MediaType.APPLICATION_JSON) public Map<String,Object> getConstructionToday() throws Exception{ Map<String,Object > resultMap = new HashMap<>(); String msg = ""; String code="0"; List<PgConstructionDto> pgConstructionDtoList=new ArrayList<>(); try { pgConstructionDtoList = pgConstructionManager.getConstructionToday(); if (pgConstructionDtoList == null && pgConstructionDtoList.size() == 0) msg = "不存在施工信息"; else { code="200"; msg = "施工信息获取成功"; } } catch(Exception e) { e.printStackTrace(); msg="施工信息获取失败"; } resultMap.put("code",code); resultMap.put("msg",msg); resultMap.put("result",pgConstructionDtoList); return resultMap; } }