blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/alarm/mapper/AlarmMapper.xml
@@ -80,6 +80,20 @@ <if test="alarm.endTime!=null and alarm.endTime!=''"> and a.alarmTime<=#{alarm.endTime} </if> <if test="alarm.timeDesc!=null and alarm.timeDesc!=''"> <if test="alarm.timeDesc=='30分钟以上'"> and czTime-alarmTime>1800 </if> <if test="alarm.timeDesc=='10-30分钟'"> and czTime-alarmTime>600 and czTime-alarmTime <1800 </if> <if test="alarm.timeDesc=='5-10分钟'"> and czTime-alarmTime>300 and czTime-alarmTime <600 </if> <if test="alarm.timeDesc=='小于5分钟'"> and czTime-alarmTime>0 and czTime-alarmTime <300 </if> </if> and a.waringType IN("紧急求救") @@ -298,8 +312,12 @@ SELECT count(*) FROM `sys_alarm` where waringType = '紧急求救' and to_days(alarmTime) = to_days(curdate()) <if test="conditionVo.status==0"> and to_days(alarmTime) = to_days(curdate()) </if> <if test="conditionVo.startTime!=null and conditionVo.startTime!='' and conditionVo.endTime!=null and conditionVo.endTime!=''"> and alarmTime between #{conditionVo.startTime} and #{conditionVo.endTime} </if> </select> @@ -330,26 +348,6 @@ on a.click_date = b.datetime order by a.click_date asc </select> <!--查询警情当前时间段内每天的数据--> <select id="selectTimeAlarmData" resultType="java.lang.Integer"> select a.days, ifnull(count,0) count from ( SELECT @date := DATE_ADD( @date, INTERVAL + 1 DAY ) days FROM ( SELECT @date := DATE_ADD( #{conditionVo.startTime}, INTERVAL - 1 DAY ) FROM sys_date ) time WHERE to_days( @date ) < to_days( #{conditionVo.endTime} ) ) a left join ( select DATE_FORMAT(alarmTime,'%Y-%m-%d') as datetime, count(*) as count from sys_alarm where waringType = '紧急求救' group by DATE_FORMAT(alarmTime,'%Y-%m-%d') ) b on a.days = b.datetime </select> <!-- <!–查询本日,本周,本月 主动报警的数量–>--> @@ -493,28 +491,5 @@ ) b on a.days = b.datetime </select> <!--查询本年所有月份的预警数量--> <select id="queryYearAlarm" resultType="java.util.HashMap"> <if test="childList!=null and childList.size>0"> <foreach collection="childList" index="index" item="item" open="" separator="union all" close=""> SELECT #{item} as month,count(ce.id) as count FROM sys_alarm as ce WHERE YEAR ( alarmTime ) = date_format(now(),'%Y%') AND MONTH ( alarmTime ) = #{item} AND waringType = "紧急求救" AND deviceNumber = #{deviceNumber} </foreach> </if> </select> </mapper> blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/alarm/service/impl/AlarmServiceImpl.java
@@ -228,30 +228,31 @@ } catch (ParseException e) { e.printStackTrace(); } }else { long nowTime = new Date().getTime(); try { long alarmTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(alarm.getAlarmTime()).getTime(); //0-5分钟 if (nowTime-alarmTime>0 && nowTime-alarmTime<AlarmTimeConstant.FIVE_TIME){ count05+=1; } //5-10分钟 if (nowTime-alarmTime>=AlarmTimeConstant.FIVE_TIME && nowTime-alarmTime<AlarmTimeConstant.TEN_TIME){ count0510+=1; } //10-30分钟 if (nowTime-alarmTime>=AlarmTimeConstant.TEN_TIME && nowTime-alarmTime<AlarmTimeConstant.THIRTY_TIME){ count1030+=1; } //30分钟以上 if (nowTime-alarmTime>=AlarmTimeConstant.THIRTY_TIME){ count30+=1; } } catch (ParseException e) { e.printStackTrace(); } } // else { // long nowTime = new Date().getTime(); // try { // long alarmTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(alarm.getAlarmTime()).getTime(); // //0-5分钟 // if (nowTime-alarmTime>0 && nowTime-alarmTime<AlarmTimeConstant.FIVE_TIME){ // count05+=1; // } // //5-10分钟 // if (nowTime-alarmTime>=AlarmTimeConstant.FIVE_TIME && nowTime-alarmTime<AlarmTimeConstant.TEN_TIME){ // count0510+=1; // } // //10-30分钟 // if (nowTime-alarmTime>=AlarmTimeConstant.TEN_TIME && nowTime-alarmTime<AlarmTimeConstant.THIRTY_TIME){ // count1030+=1; // } // //30分钟以上 // if (nowTime-alarmTime>=AlarmTimeConstant.THIRTY_TIME){ // count30+=1; // } // } catch (ParseException e) { // e.printStackTrace(); // } // } } //封装数据 list.add(count05); blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/alarm/vo/AlarmVO.java
@@ -49,4 +49,5 @@ private String twoId; private String threeId; private String deptId; private String timeDesc; } blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/parcel/service/impl/ParcelServiceImpl.java
@@ -237,9 +237,18 @@ //获取包裹数据 List<Object> parcelData = getParcelData(conditionVo, PARCEL_URL, PARCEL_KEY, PARCEL_SECRET); if (null!=parcelData) { //声明包裹和物品数量 Integer dangerCount = 0; Integer contrabandCount = 0; if (null!=conditionVo.getStartTime()){ for (Object object : parcelData) { //取出list里面的值转为map Map<String, Object> objectMap = (Map<String, Object>) object; dangerCount += Integer.parseInt(objectMap.get("dangerCount").toString()); //违禁包裹数量 contrabandCount += Integer.parseInt(objectMap.get("contrabandCount").toString()); //违禁物品数量 } }else { //查询当天的包裹总数 Integer dangerCount = null; Integer contrabandCount = null; conditionVo.setStatus(0); if (conditionVo.getStatus() == 0) { for (Object object : parcelData) { @@ -247,6 +256,7 @@ Map<String, Object> objectMap = (Map<String, Object>) object; dangerCount = Integer.parseInt(objectMap.get("dangerCount").toString()); //违禁包裹数量 contrabandCount = Integer.parseInt(objectMap.get("contrabandCount").toString()); //违禁物品数量 } } } //封装数据 @@ -387,8 +397,10 @@ */ @Override public Object getParcelkindDetailPage(ConditionVo conditionVo) { System.out.println("conditionVo = " + conditionVo); //获取违禁品数据 String result = getParcelDataPageList(conditionVo, PARCEL_KIND_URL, PARCEL_KEY, PARCEL_SECRET).get("result").toString(); System.out.println("result = " + result); if (null!=result) { return JSONObject.parse(result); } blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/parcel/vo/ConditionVo.java
@@ -44,4 +44,14 @@ * 分页记录数 */ private Integer pageSize; /** * 预警确认时间描述 */ private String timeDesc; /** * 预警时间分布 */ private Integer timeNum; }