package com.casic.PgInterface.rs; import com.casic.PgInterface.construction.dto.PgConstructionDto; 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 { private PgInPgPersonManager pgInPgPersonManager; private PgInPgStatusManager pgInPgStatusManager; private PgAlarmManager pgAlarmManager; private PgConstructionManager pgConstructionManager; @Resource public void setPgInPgPersonManager(PgInPgPersonManager pgInPgPersonManager) { this.pgInPgPersonManager = pgInPgPersonManager; } @Resource public void setPgInPgStatusManager(PgInPgStatusManager pgInPgStatusManager) { this.pgInPgStatusManager = pgInPgStatusManager; } @Resource public void setPgAlarmManager(PgAlarmManager pgAlarmManager) { this.pgAlarmManager = pgAlarmManager; } @Resource public void setPgConstructionManager(PgConstructionManager pgConstructionManager) { this.pgConstructionManager = pgConstructionManager; } //入廊人员 /** * 获取本月入廊人员次数 */ @POST @Path("getPersonNumInPgByMonth") @Produces(MediaType.APPLICATION_JSON) public Map<Object, String> getMonthInPgPersonNum() throws Exception { Map<Object, String> resultMap = new HashMap<Object, String>(); String msg = ""; int inNum = 0; try { inNum = pgInPgStatusManager.getMonthInPgPersonNum(); msg = "入廊人员次数获取成功"; } catch (Exception e) { e.printStackTrace(); msg = "入廊人员次数获取失败"; } 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 = ""; int inNum = 0; try { inNum = pgInPgStatusManager.getWeekInPgPersonNum(); msg = "入廊人员次数获取成功"; } catch (Exception e) { e.printStackTrace(); msg = "入廊人员次数获取失败"; } 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, Object>(); String msg = ""; List<PgInPgInfoDto> pgInPgInfoDtoList = new ArrayList<PgInPgInfoDto>(); try { pgInPgInfoDtoList = pgInPgStatusManager.getPgInPersonListByDay(); if (pgInPgInfoDtoList == null) msg = "信息获取失败"; else msg = "信息获取成功"; } catch (Exception e) { e.printStackTrace(); msg = "信息获取失败"; } 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 = ""; List<PgInPgInfoDto> pgInPgInfoDtoList = new ArrayList<PgInPgInfoDto>(); try { pgInPgInfoDtoList = pgInPgStatusManager.getTodayInPgInfo(); msg = "信息获取成功"; } catch (Exception e) { e.printStackTrace(); msg = "信息获取成功"; } 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 = ""; int num = 0; try { num = pgAlarmManager.getAlarmNum(isDevFault); msg = "报警数量获取成功"; } catch (Exception e) { e.printStackTrace(); msg = "报警数量统计失败"; } 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 = ""; int inNum = 0; try { inNum = pgAlarmManager.getMonthAlarmNum(isDevFault); msg = "报警次数获取成功"; } catch (Exception e) { e.printStackTrace(); msg = "报警次数获取失败"; } 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 = ""; int inNum = 0; try { inNum = pgAlarmManager.getWeekAlarmNum(isDevFault); msg = "报警次数获取成功"; } catch (Exception e) { e.printStackTrace(); msg = "报警次数获取失败"; } resultMap.put("msg", msg); resultMap.put("result", String.valueOf(inNum)); return resultMap; } /* * 按照天统计报警次数 */ @POST @Path("getDayAlarmStatistic") @Produces(MediaType.APPLICATION_JSON) public Map<String, Object> getDayAlarmStatistic(@FormParam("isDevFault") String isDevFault) throws Exception { Map<String, Object> resultMap = new HashMap<String, Object>(); String msg = ""; List<PgAlarmTjDto> pgAlarmTjDtoList = new ArrayList<PgAlarmTjDto>(); try { pgAlarmTjDtoList = pgAlarmManager.getDayAlarmStatistic(isDevFault); if (pgAlarmTjDtoList == null) msg = "信息获取失败"; else 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, Object>(); String msg = ""; List<PgAlarmDto> pgAlarmDtoList=new ArrayList<PgAlarmDto>(); try{ pgAlarmDtoList=pgAlarmManager.getAlarmList(isDevFault); msg="信息获取成功"; } catch(Exception e) { e.printStackTrace(); msg="信息获取失败"; } resultMap.put("msg",msg); resultMap.put("result",pgAlarmDtoList); return resultMap; } //施工统计 /* 累计施工数量\在建施工数\完工施工数 */ @POST @Path("getConstructionNum") @Produces(MediaType.APPLICATION_JSON) public Map<Object,String> getConstructionNum(@FormParam("constructionType") String constructionType) throws Exception{ Map<Object, String> resultMap = new HashMap<Object, String>(); String msg = ""; int constructNum=0; try{ constructNum=pgConstructionManager.getConstructionNum(constructionType); msg="施工数量获取成功"; } catch(Exception e) { e.printStackTrace(); msg="施工数量统计"; } resultMap.put("msg",msg); resultMap.put("result",String.valueOf(constructNum)); return resultMap; } /* 当天在建工程 */ @POST @Path("getConstructionToday") @Produces(MediaType.APPLICATION_JSON) public Map<String,Object> getConstructionToday() throws Exception{ Map<String,Object > resultMap = new HashMap<String,Object>(); String msg = ""; List<PgConstructionDto> pgConstructionDtoList=new ArrayList<PgConstructionDto>(); try { pgConstructionDtoList = pgConstructionManager.getConstructionToday(); if (pgConstructionDtoList == null) msg = "不存在施工信息"; else msg = "施工信息获取成功"; } catch(Exception e) { e.printStackTrace(); msg="施工信息获取失败"; } resultMap.put("msg",msg); resultMap.put("result",pgConstructionDtoList); return resultMap; } }