Merge remote-tracking branch 'origin/master'
23 files modified
1 files added
| | |
| | | <artifactId>javacv</artifactId> |
| | | <version>1.4.3</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>org.bytedeco.javacpp-presets</groupId> |
| | | <artifactId>ffmpeg-platform</artifactId> |
| New file |
| | |
| | | package org.springblade.jfpt.alarm.constant; |
| | | |
| | | /** |
| | | * 警情处理时间常量 |
| | | */ |
| | | public interface AlarmTimeConstant { |
| | | int ZERO = 0; |
| | | int TWO = 2; |
| | | int FOUR = 4; |
| | | int SIX = 6; |
| | | int EIGHT = 8; |
| | | int TEN = 10; |
| | | int TWEKVE = 12; |
| | | int FOURTEEN = 14; |
| | | int SIXTEEN = 16; |
| | | int EIGHTEEN = 18; |
| | | int TWENTY = 20; |
| | | int TWENTY_TWO = 22; |
| | | int TWENTY_FOUR = 24; |
| | | int FIVE_TIME = 5*60; |
| | | int TEN_TIME = 10*60; |
| | | int THIRTY_TIME = 30*60; |
| | | |
| | | |
| | | } |
| | |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import lombok.AllArgsConstructor; |
| | | import org.aspectj.weaver.patterns.Declare; |
| | | import org.springblade.core.boot.ctrl.BladeController; |
| | | import org.springblade.core.mp.support.Condition; |
| | | import org.springblade.core.mp.support.Query; |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/selectAlertScount") |
| | | public R selectAlertScount(HttpServletResponse response) { |
| | | public R selectAlertScount(HttpServletResponse response,ConditionVo conditionVo) { |
| | | response.setHeader("Access-Control-Allow-Origin", "*"); |
| | | response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE"); |
| | | response.setHeader("Access-Control-Allow-Credentials","true"); |
| | |
| | | //获取类型集合数据 |
| | | String [] type = {"一键求助","违禁品","红色健康码","体温异常"}; |
| | | types = Arrays.asList(type); |
| | | //获取时间集合数据(今天及今天之前6天的日期) |
| | | times = DateUtils.pastDay(new SimpleDateFormat("yyyy-MM-dd").format(new Date())); |
| | | //1.统计7天内一键求助警情数量数据 3-20 修改展示紧急求助 |
| | | Map<String,Object> alarmData = alarmService.selectAlarmData(); |
| | | alarmData.put("name","一键求助"); |
| | | //2.统计7天内违禁品的数量数据 |
| | | Map<String,Object> parcelData = parcelService.selectParcelData(); |
| | | parcelData.put("name","违禁品"); |
| | | //3.统计7天内红色健康码人数数量数据 |
| | | Map<String,Object> healthcodeData = ihealthcodeService.selectHealthcodeData(); |
| | | healthcodeData.put("name","红色健康码"); |
| | | //4.统计7天内体温异常人数数量数据 |
| | | Map<String,Object> animalData = animalHeatService.selectAnimalData(); |
| | | animalData.put("name","体温异常"); |
| | | //封装数据 |
| | | dataList.add(alarmData); |
| | | dataList.add(parcelData); |
| | | dataList.add(healthcodeData); |
| | | dataList.add(animalData); |
| | | if (null!=conditionVo){ |
| | | //获取时间集合数据 |
| | | times = DateUtils.getTimeOverOneDate(conditionVo.getStartTime(), conditionVo.getEndTime()); |
| | | //1.统计时间段内一键求助警情数量数据 3-20 修改展示紧急求助 |
| | | Map<String, Object> alarmData = alarmService.selectAlarmData(); |
| | | alarmData.put("name", "一键求助"); |
| | | //2.统计时间段内违禁品的数量数据 |
| | | Map<String, Object> parcelData = parcelService.selectParcelData(conditionVo); |
| | | parcelData.put("name", "违禁品"); |
| | | //3.统计时间段内红色健康码人数数量数据 |
| | | Map<String, Object> healthcodeData = ihealthcodeService.selectHealthcodeData(); |
| | | healthcodeData.put("name", "红色健康码"); |
| | | //4.统计时间段内体温异常人数数量数据 |
| | | Map<String, Object> animalData = animalHeatService.selectAnimalData(); |
| | | animalData.put("name", "体温异常"); |
| | | //封装数据 |
| | | dataList.add(alarmData); |
| | | dataList.add(parcelData); |
| | | dataList.add(healthcodeData); |
| | | dataList.add(animalData); |
| | | }else { |
| | | //获取时间集合数据(今天及今天之前6天的日期) |
| | | times = DateUtils.pastDay(new SimpleDateFormat("yyyy-MM-dd").format(new Date())); |
| | | //1.统计7天内一键求助警情数量数据 3-20 修改展示紧急求助 |
| | | Map<String, Object> alarmData = alarmService.selectAlarmData(); |
| | | alarmData.put("name", "一键求助"); |
| | | //2.统计7天内违禁品的数量数据 |
| | | conditionVo.setStatus(1); |
| | | Map<String, Object> parcelData = parcelService.selectParcelData(conditionVo); |
| | | parcelData.put("name", "违禁品"); |
| | | //3.统计7天内红色健康码人数数量数据 |
| | | Map<String, Object> healthcodeData = ihealthcodeService.selectHealthcodeData(); |
| | | healthcodeData.put("name", "红色健康码"); |
| | | //4.统计7天内体温异常人数数量数据 |
| | | Map<String, Object> animalData = animalHeatService.selectAnimalData(); |
| | | animalData.put("name", "体温异常"); |
| | | //封装数据 |
| | | dataList.add(alarmData); |
| | | dataList.add(parcelData); |
| | | dataList.add(healthcodeData); |
| | | dataList.add(animalData); |
| | | } |
| | | map.put("types",types); |
| | | map.put("times",times); |
| | | map.put("dataList",dataList); |
| | |
| | | return R.data(lists); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 警情日平均占比 |
| | | * @param response 跨域配置 |
| | | * @param conditionVo 条件 |
| | | * @return |
| | | */ |
| | | @GetMapping("/selAlarmDayAveragePro") |
| | | public R selAlarmDayAveragePro(HttpServletResponse response,ConditionVo conditionVo) { |
| | | response.setHeader("Access-Control-Allow-Origin", "*"); |
| | | response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE"); |
| | | response.setHeader("Access-Control-Allow-Credentials","true"); |
| | | List<Integer> list = new ArrayList<>(); |
| | | //获取时间天数 |
| | | if (null!= conditionVo.getStartTime() && conditionVo.getStartTime()!="" |
| | | && null!=conditionVo.getEndTime() && conditionVo.getEndTime()!="") { |
| | | int times = DateUtils.getTimeOverOneDate(conditionVo.getStartTime(), conditionVo.getEndTime()).size(); |
| | | //查询当前时间段一键求助报警总次数 |
| | | int alarmTimeCount = alarmService.selAlarmTimeCount(conditionVo); |
| | | //查询当前时间段违禁品总个数 |
| | | int parcelTimeCount = parcelService.selParcelTimeCount(conditionVo); |
| | | //查询当前时间段红色健康码总个数 |
| | | int healthcodeTimeCount = ihealthcodeService.selHealthcodeTimeCount(conditionVo); |
| | | //查询当前时间段体温异常总次数 |
| | | int animalTimeCount = animalHeatService.selAnimalTimeCount(conditionVo); |
| | | //封装数据 |
| | | list.add(alarmTimeCount); |
| | | list.add(parcelTimeCount); |
| | | list.add(healthcodeTimeCount); |
| | | list.add(animalTimeCount); |
| | | //返回数据 |
| | | return R.data(list); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 一键求助报警确认时间占比 |
| | | * @param response 跨域配置 |
| | | * @param conditionVo 条件 |
| | | * @return |
| | | */ |
| | | @GetMapping("/selConfirmTimePro") |
| | | public R selConfirmTimePro(HttpServletResponse response,ConditionVo conditionVo){ |
| | | response.setHeader("Access-Control-Allow-Origin", "*"); |
| | | response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE"); |
| | | response.setHeader("Access-Control-Allow-Credentials","true"); |
| | | if (null!= conditionVo.getStartTime() && conditionVo.getStartTime()!="" |
| | | && null!=conditionVo.getEndTime() && conditionVo.getEndTime()!="") { |
| | | return R.data(alarmService.selConfirmTimePro(conditionVo)); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 警情时间分布 0-2 2-4 4-6 6-8 .... 22-24 |
| | | * @param response 跨域配置 |
| | | * @param conditionVo 条件 |
| | | * @return |
| | | */ |
| | | @GetMapping("/selAlarmTimeDis") |
| | | public R selAlarmTimeDis(HttpServletResponse response,ConditionVo conditionVo) { |
| | | response.setHeader("Access-Control-Allow-Origin", "*"); |
| | | response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE"); |
| | | response.setHeader("Access-Control-Allow-Credentials","true"); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | //获取时间天数 |
| | | if (null!= conditionVo.getStartTime() && conditionVo.getStartTime()!="" |
| | | && null!=conditionVo.getEndTime() && conditionVo.getEndTime()!="") { |
| | | int times = DateUtils.getTimeOverOneDate(conditionVo.getStartTime(), conditionVo.getEndTime()).size(); |
| | | //查询当前时间段区间时间一键求助报警个数 |
| | | List<Integer> alarmTimeDis = alarmService.selAlarmTimeDis(conditionVo); |
| | | //查询当前时间段区间时间违禁品个数 |
| | | List<Integer> parcelTimeDis = parcelService.selParcelTimeDis(conditionVo); |
| | | |
| | | //查询当前时间段区间时间红色健康码个数 |
| | | List<Integer> healthcodeTimeDis = ihealthcodeService.selHealthcodeTimeDis(conditionVo); |
| | | //查询当前时间段区间时间体温异常次数 |
| | | List<Integer> animalTimeDis = animalHeatService.selAnimalTimeDis(conditionVo); |
| | | //封装数据 |
| | | map.put("alarmTimeDis",alarmTimeDis); |
| | | map.put("parcelTimeDis",parcelTimeDis); |
| | | map.put("healthcodeTimeDis",healthcodeTimeDis); |
| | | map.put("animalTimeDis",animalTimeDis); |
| | | //返回数据 |
| | | return R.data(map); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | } |
| | |
| | | * 查询警情总数 |
| | | * @return |
| | | */ |
| | | Integer selectAlarmCount(); |
| | | Integer selectAlarmCount(@Param("conditionVo") ConditionVo conditionVo); |
| | | |
| | | /** |
| | | * 查询7天内主动报警(紧急求助)每天的数量 |
| | |
| | | List<Map<String, Object>> queryPoliceTime(List policeIdArr); |
| | | |
| | | List<Map<String, Object>> queryBa(); |
| | | |
| | | /** |
| | | * 查询当前时间段一键求助报警总次数 |
| | | * @param conditionVo |
| | | * @return |
| | | */ |
| | | Integer selAlarmTimeCount(@Param("conditionVo") ConditionVo conditionVo); |
| | | |
| | | /** |
| | | * 查询当前时间段内一键求助报警的数据集合 |
| | | * @param conditionVo |
| | | * @return |
| | | */ |
| | | List<Alarm> selectAlarmList(@Param("conditionVo")ConditionVo conditionVo); |
| | | } |
| | |
| | | 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> |
| | | |
| | | <!-- <!–查询本日,本周,本月 主动报警的数量–>--> |
| | | <!-- <select id="selectAlarmSum" resultType="java.util.HashMap">--> |
| | |
| | | <select id="selectEq" resultType="java.util.HashMap"> |
| | | SELECT COUNT(deviceNumber) as cou,deviceNumber FROM `sys_alarm` WHERE alarmTime like concat(concat('%', #{time}), '%') and waringType NOT IN("系统测试","主机重新上电") group by deviceNumber |
| | | </select> |
| | | |
| | | <select id="selAlarmTimeCount" resultType="java.lang.Integer"> |
| | | select count(*) from sys_alarm |
| | | where waringType = '紧急求救' |
| | | <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> |
| | | |
| | | <!--查询当前时间段内一键求助报警的数据集合--> |
| | | <select id="selectAlarmList" resultType="org.springblade.jfpt.alarm.entity.Alarm"> |
| | | SELECT waringType,alarmTime,alarmId,alarmPeople,jtype,czTime FROM `sys_alarm` |
| | | where waringType='紧急求救' |
| | | and alarmTime between #{conditionVo.startTime} and #{conditionVo.endTime} |
| | | </select> |
| | | </mapper> |
| | |
| | | |
| | | /** |
| | | * 查询警情总数 |
| | | * @param status 0:本日 1:本周 2:本月 3:近7天 |
| | | * @param conditionVo status 0:本日 1:本周 2:本月 3:近7天 |
| | | * @return |
| | | */ |
| | | Integer selectAlarmCount(Integer status); |
| | | Integer selectAlarmCount(ConditionVo conditionVo); |
| | | |
| | | /** |
| | | * 查询7天内主动报警(紧急求助)每天的数量 |
| | |
| | | |
| | | List<Map<String, Object>> queryBa(); |
| | | |
| | | /** |
| | | * 查询当前时间段一键求助报警总次数 |
| | | * @param conditionVo |
| | | * @return |
| | | */ |
| | | Integer selAlarmTimeCount(ConditionVo conditionVo); |
| | | |
| | | |
| | | /** |
| | | * 一键求助报警确认时间占比 |
| | | * @param conditionVo 条件 |
| | | * @return |
| | | */ |
| | | Object selConfirmTimePro(ConditionVo conditionVo); |
| | | |
| | | /** |
| | | * 查询当前时间段区间时间一键求助报警个数 |
| | | * @param conditionVo |
| | | * @return |
| | | */ |
| | | List<Integer> selAlarmTimeDis(ConditionVo conditionVo); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springblade.jfpt.alarm.constant.AlarmTimeConstant; |
| | | import org.springblade.jfpt.alarm.entity.Alarm; |
| | | import org.springblade.jfpt.alarm.mapper.AlarmMapper; |
| | | import org.springblade.jfpt.alarm.service.IAlarmService; |
| | | import org.springblade.jfpt.alarm.vo.AlarmVO; |
| | | import org.springblade.jfpt.parcel.util.DateUtils; |
| | | import org.springblade.jfpt.parcel.vo.ConditionVo; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * 服务实现类 |
| | |
| | | |
| | | /** |
| | | * 查询警情总数 |
| | | * @param status 0:本日 1:本周 2:本月 |
| | | * @param conditionVo status 0:本日 1:本周 2:本月 |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Integer selectAlarmCount(Integer status) { |
| | | return baseMapper.selectAlarmCount(); |
| | | public Integer selectAlarmCount(ConditionVo conditionVo) { |
| | | return baseMapper.selectAlarmCount(conditionVo); |
| | | } |
| | | |
| | | /** |
| | |
| | | public List<Map<String, Object>> queryBa() { |
| | | return baseMapper.queryBa(); |
| | | } |
| | | |
| | | /** |
| | | * 查询当前时间段一键求助报警总次数 |
| | | * @param conditionVo |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Integer selAlarmTimeCount(ConditionVo conditionVo) { |
| | | return baseMapper.selAlarmTimeCount(conditionVo); |
| | | } |
| | | |
| | | /** |
| | | * 一键求助报警确认时间占比 |
| | | * @param conditionVo 条件 |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Object selConfirmTimePro(ConditionVo conditionVo) { |
| | | //查询当前时间段内一键求助报警的数据集合 |
| | | List<Alarm> alarmList = baseMapper.selectAlarmList(conditionVo); |
| | | List<Integer> list = new ArrayList<>(); |
| | | //一键求助报警总数 |
| | | int count = alarmList.size(); |
| | | int count05 = 0; |
| | | int count0510 = 0; |
| | | int count1030 = 0; |
| | | int count30 = 0; |
| | | //遍历集合 |
| | | for (Alarm alarm:alarmList) { |
| | | if (null!=alarm.getCzTime() && alarm.getCzTime()!=""){ |
| | | try { |
| | | long czTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(alarm.getCzTime()).getTime(); |
| | | long alarmTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(alarm.getAlarmTime()).getTime(); |
| | | //0-5分钟 |
| | | if (czTime-alarmTime>0 && czTime-alarmTime<AlarmTimeConstant.FIVE_TIME){ |
| | | count05+=1; |
| | | } |
| | | //5-10分钟 |
| | | if (czTime-alarmTime>=AlarmTimeConstant.FIVE_TIME && czTime-alarmTime<AlarmTimeConstant.TEN_TIME){ |
| | | count0510+=1; |
| | | } |
| | | //10-30分钟 |
| | | if (czTime-alarmTime>=AlarmTimeConstant.TEN_TIME && czTime-alarmTime<AlarmTimeConstant.THIRTY_TIME){ |
| | | count1030+=1; |
| | | } |
| | | //30分钟以上 |
| | | if (czTime-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); |
| | | list.add(count0510); |
| | | list.add(count1030); |
| | | list.add(count30); |
| | | //返回数据 |
| | | return list; |
| | | } |
| | | |
| | | /** |
| | | * 查询当前时间段区间时间一键求助报警个数 |
| | | * @param conditionVo |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<Integer> selAlarmTimeDis(ConditionVo conditionVo) { |
| | | //查询当前时间段内一键求助报警的数据集合 |
| | | List<Alarm> alarmList = baseMapper.selectAlarmList(conditionVo); |
| | | if (alarmList.size()>0) { |
| | | List<Integer> list = new ArrayList<>(); |
| | | int count02 = 0; |
| | | int count0204 = 0; |
| | | int count0406 = 0; |
| | | int count0608 = 0; |
| | | int count0810 = 0; |
| | | int count1012 = 0; |
| | | int count1214 = 0; |
| | | int count1416 = 0; |
| | | int count1618 = 0; |
| | | int count1820 = 0; |
| | | int count2022 = 0; |
| | | int count2224 = 0; |
| | | //遍历集合 |
| | | for (Alarm alarm : alarmList) { |
| | | try { |
| | | int hours = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(alarm.getAlarmTime()).getHours(); |
| | | if (hours > 0 && hours < AlarmTimeConstant.TWO) { |
| | | count02 += 1; |
| | | } |
| | | if (hours >= AlarmTimeConstant.TWO && hours < AlarmTimeConstant.FOUR) { |
| | | count0204 += 1; |
| | | } |
| | | if (hours >= AlarmTimeConstant.FOUR && hours < AlarmTimeConstant.SIX) { |
| | | count0406 += 1; |
| | | } |
| | | if (hours >= AlarmTimeConstant.SIX && hours < AlarmTimeConstant.EIGHT) { |
| | | count0608 += 1; |
| | | } |
| | | if (hours >= AlarmTimeConstant.EIGHT && hours < AlarmTimeConstant.TEN) { |
| | | count0810 += 1; |
| | | } |
| | | if (hours >= AlarmTimeConstant.TEN && hours < AlarmTimeConstant.TWEKVE) { |
| | | count1012 += 1; |
| | | } |
| | | if (hours >= AlarmTimeConstant.TWEKVE && hours < AlarmTimeConstant.FOURTEEN) { |
| | | count1214 += 1; |
| | | } |
| | | if (hours >= AlarmTimeConstant.FOURTEEN && hours < AlarmTimeConstant.SIXTEEN) { |
| | | count1416 += 1; |
| | | } |
| | | if (hours >= AlarmTimeConstant.SIXTEEN && hours < AlarmTimeConstant.EIGHTEEN) { |
| | | count1618 += 1; |
| | | } |
| | | if (hours >= AlarmTimeConstant.EIGHTEEN && hours < AlarmTimeConstant.TWENTY) { |
| | | count1820 += 1; |
| | | } |
| | | if (hours >= AlarmTimeConstant.TWENTY && hours < AlarmTimeConstant.TWENTY_TWO) { |
| | | count2022 += 1; |
| | | } |
| | | if (hours >= AlarmTimeConstant.TWENTY_TWO && hours < AlarmTimeConstant.TWENTY_FOUR) { |
| | | count2224 += 1; |
| | | } |
| | | } catch (ParseException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | //封装数据 |
| | | list.add(count02); |
| | | list.add(count0204); |
| | | list.add(count0406); |
| | | list.add(count0608); |
| | | list.add(count0810); |
| | | list.add(count1012); |
| | | list.add(count1214); |
| | | list.add(count1416); |
| | | list.add(count1618); |
| | | list.add(count1820); |
| | | list.add(count2022); |
| | | list.add(count2224); |
| | | //返回数据 |
| | | return list; |
| | | } |
| | | return Arrays.asList(0,0,0,0,0,0,0,0,0,0,0,0); |
| | | } |
| | | } |
| | |
| | | import org.springblade.jfpt.animalheat.entity.BladeAnimalHeat; |
| | | import org.springblade.jfpt.animalheat.vo.AnimalHeatVo; |
| | | import org.springblade.jfpt.animalheat.vo.StatisVo; |
| | | import org.springblade.jfpt.parcel.vo.ConditionVo; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | * @return |
| | | */ |
| | | List<Integer> selectAnimalHeatDataStatis(); |
| | | |
| | | /** |
| | | * 查询当前时间段体温异常总次数 |
| | | * @param conditionVo |
| | | * @return |
| | | */ |
| | | Integer selAnimalTimeCount(@Param("conditionVo") ConditionVo conditionVo); |
| | | |
| | | /** |
| | | * 查询当前时间段区间时间体温异常次数 |
| | | * @param conditionVo |
| | | * @return |
| | | */ |
| | | List<BladeAnimalHeat> selAnimalTimeData(@Param("conditionVo")ConditionVo conditionVo); |
| | | } |
| | |
| | | a.click_date = b.datetime |
| | | order by a.click_date asc |
| | | </select> |
| | | |
| | | <!--查询当前时间段体温异常总次数--> |
| | | <select id="selAnimalTimeCount" resultType="java.lang.Integer"> |
| | | select count(*) from blade_animal_heat |
| | | where status=1 |
| | | <if test="conditionVo.startTime!=null and conditionVo.startTime!='' and conditionVo.endTime!=null and conditionVo.endTime!=''"> |
| | | and create_time between #{conditionVo.startTime} and #{conditionVo.endTime} |
| | | </if> |
| | | </select> |
| | | |
| | | <!--查询当前时间段区间时间体温异常次数--> |
| | | <select id="selAnimalTimeData" resultType="org.springblade.jfpt.animalheat.entity.BladeAnimalHeat"> |
| | | select status,create_time from blade_animal_heat |
| | | where status=1 |
| | | and create_time between #{conditionVo.startTime} and #{conditionVo.endTime} |
| | | </select> |
| | | </mapper> |
| | |
| | | import org.springblade.jfpt.animalheat.entity.BladeAnimalHeat; |
| | | import org.springblade.jfpt.animalheat.vo.AnimalHeatVo; |
| | | import org.springblade.jfpt.animalheat.vo.StatisVo; |
| | | import org.springblade.jfpt.parcel.vo.ConditionVo; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | * @return |
| | | */ |
| | | Map<String, Object> selectAnimalData(); |
| | | |
| | | /** |
| | | * 查询当前时间段体温异常总次数 |
| | | * @param conditionVo |
| | | * @return |
| | | */ |
| | | Integer selAnimalTimeCount(ConditionVo conditionVo); |
| | | |
| | | /** |
| | | * 查询当前时间段区间时间体温异常次数 |
| | | * @param conditionVo |
| | | * @return |
| | | */ |
| | | List<Integer> selAnimalTimeDis(ConditionVo conditionVo); |
| | | } |
| | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springblade.jfpt.alarm.constant.AlarmTimeConstant; |
| | | import org.springblade.jfpt.animalheat.entity.BladeAnimalHeat; |
| | | import org.springblade.jfpt.animalheat.mapper.AnimalHeatMapper; |
| | | import org.springblade.jfpt.animalheat.service.AnimalHeatService; |
| | | import org.springblade.jfpt.animalheat.util.ImageUtil; |
| | | import org.springblade.jfpt.animalheat.vo.AnimalHeatVo; |
| | | import org.springblade.jfpt.animalheat.vo.StatisVo; |
| | | import org.springblade.jfpt.healthcode.entity.Healthcode; |
| | | import org.springblade.jfpt.parcel.vo.ConditionVo; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.validation.Valid; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | |
| | | import static org.springblade.core.tool.utils.DateUtil.now; |
| | | |
| | | /** |
| | |
| | | //返回数据 |
| | | return map; |
| | | } |
| | | |
| | | /** |
| | | * 查询当前时间段体温异常总次数 |
| | | * @param conditionVo |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Integer selAnimalTimeCount(ConditionVo conditionVo) { |
| | | return baseMapper.selAnimalTimeCount(conditionVo); |
| | | } |
| | | |
| | | /** |
| | | * 查询当前时间段区间时间体温异常次数 |
| | | * @param conditionVo |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<Integer> selAnimalTimeDis(ConditionVo conditionVo) { |
| | | //获取当前时间段内异常体温数据集合 |
| | | List<BladeAnimalHeat> animalHeats = baseMapper.selAnimalTimeData(conditionVo); |
| | | if (animalHeats.size()>0){ |
| | | return getHealthcodeTimeDis(animalHeats); |
| | | } |
| | | return Arrays.asList(0,0,0,0,0,0,0,0,0,0,0,0); |
| | | } |
| | | |
| | | /** |
| | | * 筛选数据,分类返回 |
| | | * @param collect 集合数据 |
| | | * @return |
| | | */ |
| | | private List<Integer> getHealthcodeTimeDis(List<BladeAnimalHeat> collect) { |
| | | List<Integer> list = new ArrayList<>(); |
| | | int count02 = 0; |
| | | int count0204 = 0; |
| | | int count0406 = 0; |
| | | int count0608 = 0; |
| | | int count0810 = 0; |
| | | int count1012 = 0; |
| | | int count1214 = 0; |
| | | int count1416 = 0; |
| | | int count1618 = 0; |
| | | int count1820 = 0; |
| | | int count2022 = 0; |
| | | int count2224 = 0; |
| | | //遍历集合 |
| | | for (BladeAnimalHeat animalHeat:collect) { |
| | | try { |
| | | long hours = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(animalHeat.getCreateTime().toString()).getHours(); |
| | | if (hours>0 && hours< AlarmTimeConstant.TWO){ |
| | | count02+=1; |
| | | } |
| | | if (hours>=AlarmTimeConstant.TWO && hours<AlarmTimeConstant.FOUR){ |
| | | count0204+=1; |
| | | } |
| | | if (hours>=AlarmTimeConstant.FOUR && hours<AlarmTimeConstant.SIX){ |
| | | count0406+=1; |
| | | } |
| | | if (hours>=AlarmTimeConstant.SIX && hours<AlarmTimeConstant.EIGHT){ |
| | | count0608+=1; |
| | | } |
| | | if (hours>=AlarmTimeConstant.EIGHT && hours<AlarmTimeConstant.TEN){ |
| | | count0810+=1; |
| | | } |
| | | if (hours>=AlarmTimeConstant.TEN && hours<AlarmTimeConstant.TWEKVE){ |
| | | count1012+=1; |
| | | } |
| | | if (hours>=AlarmTimeConstant.TWEKVE && hours<AlarmTimeConstant.FOURTEEN){ |
| | | count1214+=1; |
| | | } |
| | | if (hours>=AlarmTimeConstant.FOURTEEN && hours<AlarmTimeConstant.SIXTEEN){ |
| | | count1416+=1; |
| | | } |
| | | if (hours>=AlarmTimeConstant.SIXTEEN && hours<AlarmTimeConstant.EIGHTEEN){ |
| | | count1618+=1; |
| | | } |
| | | if (hours>=AlarmTimeConstant.EIGHTEEN && hours<AlarmTimeConstant.TWENTY){ |
| | | count1820+=1; |
| | | } |
| | | if (hours>=AlarmTimeConstant.TWENTY && hours<AlarmTimeConstant.TWENTY_TWO){ |
| | | count2022+=1; |
| | | } |
| | | if (hours>=AlarmTimeConstant.TWENTY_TWO && hours<AlarmTimeConstant.TWENTY_FOUR){ |
| | | count2224+=1; |
| | | } |
| | | } catch (ParseException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | //封装数据 |
| | | list.add(count02); |
| | | list.add(count0204); |
| | | list.add(count0406); |
| | | list.add(count0608); |
| | | list.add(count0810); |
| | | list.add(count1012); |
| | | list.add(count1214); |
| | | list.add(count1416); |
| | | list.add(count1618); |
| | | list.add(count1820); |
| | | list.add(count2022); |
| | | list.add(count2224); |
| | | //返回数据 |
| | | return list; |
| | | } |
| | | } |
| | |
| | | response.setHeader("Access-Control-Allow-Origin", "*"); |
| | | response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE"); |
| | | response.setHeader("Access-Control-Allow-Credentials","true"); |
| | | if (conditionVo.getStatus()!=null){ |
| | | //数据返回 |
| | | return R.data(getIndexCountData(conditionVo)); |
| | | } |
| | | //数据返回 |
| | | return null; |
| | | return R.data(getIndexCountData(conditionVo)); |
| | | } |
| | | |
| | | /** |
| | | * 按时间条件查询统计数据 |
| | | * @param conditionVo 条件 status 0:本日 1:本周 2:本月 |
| | | * @param conditionVo 条件 status 0:本日 1:本周 2:本月 startTime endTime时间条件查询 |
| | | * @return |
| | | */ |
| | | private List<Map<String, Object>> getIndexCountData(ConditionVo conditionVo) { |
| | |
| | | Map<String, Object> mapsu = new HashMap<String, Object>(); |
| | | Integer alarmCount = null; |
| | | List<Integer> parcelCount = new ArrayList<>(); |
| | | Integer contrabandCount = null; |
| | | Integer equipmentCount = null; |
| | | Integer suserCount = null; |
| | | Integer status = conditionVo.getStatus(); |
| | | if (conditionVo.getStatus()==0){ |
| | | //1.查询警情总数 |
| | | alarmCount = iAlarmService.selectAlarmCount(status); |
| | | //2.查询包裹总数,违禁品总数 |
| | | parcelCount = parcelService.selectParcelCount(status); |
| | | //3.查询在线设备总数 |
| | | equipmentCount = iEquipmentService.selectEquipmentCount(status); |
| | | |
| | | } |
| | | //查询今日警情 |
| | | //1.查询警情总数 |
| | | alarmCount = iAlarmService.selectAlarmCount(conditionVo); |
| | | //2.查询包裹总数,违禁品总数 |
| | | parcelCount = parcelService.selectParcelCount(conditionVo); |
| | | //3.查询在线设备总数 |
| | | equipmentCount = iEquipmentService.selectEquipmentCount(conditionVo); |
| | | //4.查询业主总数 |
| | | suserCount = iSuserService.selectSuserCount(); |
| | | suserCount = iSuserService.selectSuserCount(conditionVo); |
| | | |
| | | //1.警情总数 |
| | | mapa.put("value",alarmCount); |
| | |
| | | import org.springblade.jfpt.equipment.entity.Equipment; |
| | | import org.springblade.jfpt.equipment.vo.EquipmentVO; |
| | | import org.springblade.jfpt.equipment.vo.EquipmentVOS; |
| | | import org.springblade.jfpt.parcel.vo.ConditionVo; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | |
| | | /** |
| | | * 查询在线设备总数 |
| | | * @param status 状态码 0:本日 1:本周 2:本月 |
| | | * @param conditionVo status 状态码 0:本日 1:本周 2:本月 |
| | | * @return |
| | | */ |
| | | Integer selectEquipmentCount(Integer status); |
| | | Integer selectEquipmentCount(ConditionVo conditionVo); |
| | | void updateexpireTime(String expireTime, String deviceNumber); |
| | | void updateExstate(String state,String reason, String deviceNumber); |
| | | |
| | |
| | | import org.springblade.jfpt.equipment.service.IEquipmentService; |
| | | import org.springblade.jfpt.equipment.vo.EquipmentVO; |
| | | import org.springblade.jfpt.equipment.vo.EquipmentVOS; |
| | | import org.springblade.jfpt.parcel.vo.ConditionVo; |
| | | import org.springblade.system.cache.SysCache; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | |
| | | /** |
| | | * 查询在线设备总数 |
| | | * @param status 状态码 0:本日 1:本周 2:本月 |
| | | * @param conditionVo status 状态码 0:本日 1:本周 2:本月 |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Integer selectEquipmentCount(Integer status) { |
| | | public Integer selectEquipmentCount(ConditionVo conditionVo) { |
| | | //先查询所有的设备 |
| | | List<EquipmentVO> equipmentVOS = baseMapper.listAll(); |
| | | long time = new Date().getTime(); |
| | | int equipmentCount = 0; |
| | | long hearbeat = 0; |
| | | //遍历集合数据,对比心跳时间,得出在线的设备数量 |
| | | int status =0; |
| | | if (status==0 && equipmentVOS.size()>0){ |
| | | for (EquipmentVO e:equipmentVOS) { |
| | | try { |
| | |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.springblade.jfpt.healthcode.entity.Healthcode; |
| | | import org.springblade.jfpt.healthcode.vo.HealthcodeVO; |
| | | import org.springblade.jfpt.parcel.vo.ConditionVo; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | * @return |
| | | */ |
| | | List<Healthcode> selectHealthcodeListPage(IPage<Healthcode> page,@Param("healthcodeVO") HealthcodeVO healthcodeVO); |
| | | |
| | | /** |
| | | * 查询当前时间段红色健康码总个数 |
| | | * @param conditionVo |
| | | * @return |
| | | */ |
| | | Integer selHealthcodeTimeCount(@Param("conditionVo")ConditionVo conditionVo); |
| | | |
| | | /** |
| | | * 查询当前时间段区间时间红色健康码个数 |
| | | * @param conditionVo |
| | | * @return |
| | | */ |
| | | List<Healthcode> selRedCodeTimeData(@Param("conditionVo")ConditionVo conditionVo); |
| | | } |
| | |
| | | ORDER BY dtime desc |
| | | </select> |
| | | |
| | | <!--查询当前时间段红色健康码总个数--> |
| | | <select id="selHealthcodeTimeCount" resultType="java.lang.Integer"> |
| | | select count(*) from healthcode |
| | | where type = 3 |
| | | <if test="conditionVo.startTime!=null and conditionVo.startTime!='' and conditionVo.endTime!=null and conditionVo.endTime!=''"> |
| | | and dtime between #{conditionVo.startTime} and #{conditionVo.endTime} |
| | | </if> |
| | | </select> |
| | | |
| | | <!--查询当前时间段区间时间红色健康码个数--> |
| | | <select id="selRedCodeTimeData" resultType="org.springblade.jfpt.healthcode.entity.Healthcode"> |
| | | SELECT type,dtime FROM healthcode |
| | | where type =3 |
| | | and dtime between #{conditionVo.startTime} and #{conditionVo.endTime} |
| | | </select> |
| | | </mapper> |
| | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import org.springblade.jfpt.healthcode.entity.Healthcode; |
| | | import org.springblade.jfpt.healthcode.vo.HealthcodeVO; |
| | | import org.springblade.jfpt.parcel.vo.ConditionVo; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | * @return |
| | | */ |
| | | IPage<Healthcode> selectHealthcodeListPage(IPage<Healthcode> page, HealthcodeVO healthcodeVO); |
| | | |
| | | /** |
| | | * 查询当前时间段红色健康码总个数 |
| | | * @param conditionVo |
| | | * @return |
| | | */ |
| | | Integer selHealthcodeTimeCount(ConditionVo conditionVo); |
| | | |
| | | /** |
| | | * 查询当前时间段区间时间红色健康码个数 |
| | | * @param conditionVo |
| | | * @return |
| | | */ |
| | | List<Integer> selHealthcodeTimeDis(ConditionVo conditionVo); |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springblade.jfpt.alarm.constant.AlarmTimeConstant; |
| | | import org.springblade.jfpt.healthcode.entity.Healthcode; |
| | | import org.springblade.jfpt.healthcode.mapper.healthcodeMapper; |
| | | import org.springblade.jfpt.healthcode.service.IhealthcodeService; |
| | | import org.springblade.jfpt.healthcode.vo.HealthcodeVO; |
| | | import org.springblade.jfpt.parcel.vo.ConditionVo; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * 服务实现类 |
| | |
| | | public IPage<Healthcode> selectHealthcodeListPage(IPage<Healthcode> page, HealthcodeVO healthcodeVO) { |
| | | return page.setRecords(baseMapper.selectHealthcodeListPage(page,healthcodeVO)); |
| | | } |
| | | |
| | | /** |
| | | * 查询当前时间段红色健康码总个数 |
| | | * @param conditionVo |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Integer selHealthcodeTimeCount(ConditionVo conditionVo) { |
| | | return baseMapper.selHealthcodeTimeCount(conditionVo); |
| | | } |
| | | |
| | | /** |
| | | * 查询当前时间段区间时间红色健康码个数 |
| | | * @param conditionVo |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<Integer> selHealthcodeTimeDis(ConditionVo conditionVo) { |
| | | //查询当前时间段内的红色健康码数据集合 |
| | | List<Healthcode> healthcodeList = baseMapper.selRedCodeTimeData(conditionVo); |
| | | if (healthcodeList.size()>0){ |
| | | return getHealthcodeTimeDis(healthcodeList); |
| | | } |
| | | return Arrays.asList(0,0,0,0,0,0,0,0,0,0,0,0); |
| | | } |
| | | |
| | | /** |
| | | * 筛选数据,分类返回 |
| | | * @param collect 集合数据 |
| | | * @return |
| | | */ |
| | | private List<Integer> getHealthcodeTimeDis(List<Healthcode> collect) { |
| | | List<Integer> list = new ArrayList<>(); |
| | | int count02 = 0; |
| | | int count0204 = 0; |
| | | int count0406 = 0; |
| | | int count0608 = 0; |
| | | int count0810 = 0; |
| | | int count1012 = 0; |
| | | int count1214 = 0; |
| | | int count1416 = 0; |
| | | int count1618 = 0; |
| | | int count1820 = 0; |
| | | int count2022 = 0; |
| | | int count2224 = 0; |
| | | //遍历集合 |
| | | for (Healthcode healthcode:collect) { |
| | | try { |
| | | long hours = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(healthcode.getDtime()).getHours(); |
| | | if (hours>0 && hours< AlarmTimeConstant.TWO){ |
| | | count02+=1; |
| | | } |
| | | if (hours>=AlarmTimeConstant.TWO && hours<AlarmTimeConstant.FOUR){ |
| | | count0204+=1; |
| | | } |
| | | if (hours>=AlarmTimeConstant.FOUR && hours<AlarmTimeConstant.SIX){ |
| | | count0406+=1; |
| | | } |
| | | if (hours>=AlarmTimeConstant.SIX && hours<AlarmTimeConstant.EIGHT){ |
| | | count0608+=1; |
| | | } |
| | | if (hours>=AlarmTimeConstant.EIGHT && hours<AlarmTimeConstant.TEN){ |
| | | count0810+=1; |
| | | } |
| | | if (hours>=AlarmTimeConstant.TEN && hours<AlarmTimeConstant.TWEKVE){ |
| | | count1012+=1; |
| | | } |
| | | if (hours>=AlarmTimeConstant.TWEKVE && hours<AlarmTimeConstant.FOURTEEN){ |
| | | count1214+=1; |
| | | } |
| | | if (hours>=AlarmTimeConstant.FOURTEEN && hours<AlarmTimeConstant.SIXTEEN){ |
| | | count1416+=1; |
| | | } |
| | | if (hours>=AlarmTimeConstant.SIXTEEN && hours<AlarmTimeConstant.EIGHTEEN){ |
| | | count1618+=1; |
| | | } |
| | | if (hours>=AlarmTimeConstant.EIGHTEEN && hours<AlarmTimeConstant.TWENTY){ |
| | | count1820+=1; |
| | | } |
| | | if (hours>=AlarmTimeConstant.TWENTY && hours<AlarmTimeConstant.TWENTY_TWO){ |
| | | count2022+=1; |
| | | } |
| | | if (hours>=AlarmTimeConstant.TWENTY_TWO && hours<AlarmTimeConstant.TWENTY_FOUR){ |
| | | count2224+=1; |
| | | } |
| | | } catch (ParseException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | //封装数据 |
| | | list.add(count02); |
| | | list.add(count0204); |
| | | list.add(count0406); |
| | | list.add(count0608); |
| | | list.add(count0810); |
| | | list.add(count1012); |
| | | list.add(count1214); |
| | | list.add(count1416); |
| | | list.add(count1618); |
| | | list.add(count1820); |
| | | list.add(count2022); |
| | | list.add(count2224); |
| | | //返回数据 |
| | | return list; |
| | | } |
| | | } |
| | |
| | | |
| | | /** |
| | | * 查询包裹总数,违禁品总数 |
| | | * @param status 状态码 0:本天 1:本周 2:本月 |
| | | * @param conditionVo status 状态码 0:本天 1:本周 2:本月 |
| | | * @return |
| | | */ |
| | | List<Integer> selectParcelCount(Integer status); |
| | | List<Integer> selectParcelCount(ConditionVo conditionVo); |
| | | |
| | | /** |
| | | * 查询7天内违禁品每天的数量 |
| | | * @return |
| | | */ |
| | | Map<String, Object> selectParcelData(); |
| | | Map<String, Object> selectParcelData(ConditionVo conditionVo); |
| | | |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | Object getParcelkindDetailPage(ConditionVo conditionVo); |
| | | |
| | | /** |
| | | * 查询当前时间段违禁品总个数 |
| | | * @param conditionVo |
| | | * @return |
| | | */ |
| | | Integer selParcelTimeCount(ConditionVo conditionVo); |
| | | |
| | | /** |
| | | *查询当前时间段区间时间违禁品个数 |
| | | * @param conditionVo |
| | | * @return |
| | | */ |
| | | List<Integer> selParcelTimeDis(ConditionVo conditionVo); |
| | | } |
| | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import io.swagger.models.auth.In; |
| | | import org.springblade.jfpt.alarm.constant.AlarmTimeConstant; |
| | | import org.springblade.jfpt.animalheat.util.ImageUtil; |
| | | import org.springblade.jfpt.parcel.service.ParcelService; |
| | | import org.springblade.jfpt.parcel.util.DateUtils; |
| | |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import static org.springblade.core.tool.utils.DateUtil.now; |
| | | |
| | |
| | | //将所有的违禁包裹编码存起来 |
| | | mapCode.put(objectMap.get("objCode").toString(),objectMap.get("objCode").toString()); |
| | | } |
| | | System.out.println("mapCode = " + mapCode); |
| | | //遍历违禁编码map数据 |
| | | List<Map<String,Object>> list = new ArrayList<>(); |
| | | for (String value:mapCode.values()) { |
| | |
| | | //12.封装数据 |
| | | list.add(listTime); |
| | | list.add(parcelList); |
| | | list.add(getKindServenDataList()); |
| | | list.add(getKindServenDataList(conditionVo)); |
| | | //13.返回 |
| | | return list; |
| | | } |
| | |
| | | String startDate = null; |
| | | String endDate = null; |
| | | //2.2查询本天的数据 |
| | | if (conditionVo.getStatus() == 0) { |
| | | //3.获取本天开始时间和结束时间 |
| | | startDate = DateUtils.getToday(); |
| | | endDate = DateUtils.getToday(); |
| | | if (null!=conditionVo.getStatus()) { |
| | | if (conditionVo.getStatus() == 0) { |
| | | //3.获取本天开始时间和结束时间 |
| | | startDate = DateUtils.getToday(); |
| | | endDate = DateUtils.getToday(); |
| | | } |
| | | //2.2查询过去6天及当天的的数据 |
| | | if (conditionVo.getStatus() == 1) { |
| | | //3.获取过去6天及当天开始时间和结束时间 |
| | | startDate = DateUtils.getPastDate(6, now()); |
| | | endDate = DateUtils.getToday(); |
| | | } |
| | | //2.4查询本周的数据 |
| | | if (conditionVo.getStatus() == 3) { |
| | | //3.获取过去6天及当天开始时间和结束时间 |
| | | startDate = DateUtils.getWeekStart(); |
| | | endDate = DateUtils.getWeekEnd(); |
| | | } |
| | | //2.2查询本月的数据 |
| | | if (conditionVo.getStatus() == 2) { |
| | | //3.获取本月开始时间和结束时间 |
| | | startDate = DateUtils.getMonthStart(); |
| | | endDate = DateUtils.getMonthEnd(); |
| | | } |
| | | } |
| | | //2.2查询过去6天及当天的的数据 |
| | | if (conditionVo.getStatus() == 1) { |
| | | //3.获取过去6天及当天开始时间和结束时间 |
| | | startDate = DateUtils.getPastDate(6,now()); |
| | | endDate = DateUtils.getToday(); |
| | | } |
| | | //2.4查询本周的数据 |
| | | if (conditionVo.getStatus() == 3) { |
| | | //3.获取过去6天及当天开始时间和结束时间 |
| | | startDate = DateUtils.getWeekStart(); |
| | | endDate = DateUtils.getWeekEnd(); |
| | | } |
| | | //2.2查询本月的数据 |
| | | if (conditionVo.getStatus() == 2) { |
| | | //3.获取本月开始时间和结束时间 |
| | | startDate = DateUtils.getMonthStart(); |
| | | endDate = DateUtils.getMonthEnd(); |
| | | //2.5 按时间条件查询 |
| | | if (null!=conditionVo.getStartTime() && conditionVo.getStartTime()!="" |
| | | && null != conditionVo.getEndTime() && conditionVo.getEndTime()!=""){ |
| | | startDate = conditionVo.getStartTime().substring(0,10); |
| | | System.out.println("startDate = " + startDate); |
| | | endDate = conditionVo.getEndTime().substring(0,10); |
| | | System.out.println("endDate = " + endDate); |
| | | } |
| | | map.put("startDate", startDate); |
| | | map.put("endDate", endDate); |
| | |
| | | |
| | | /** |
| | | * 查询包裹,违禁品总数 |
| | | * @param status 状态码 0:本天 1:本周 2:本月 |
| | | * @param conditionVo status 状态码 0:本天 1:本周 2:本月 |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<Integer> selectParcelCount(Integer status) { |
| | | public List<Integer> selectParcelCount(ConditionVo conditionVo) { |
| | | List<Integer> list = new ArrayList<>(); |
| | | ConditionVo conditionVo = new ConditionVo(); |
| | | conditionVo.setStatus(status); |
| | | //获取包裹数据 |
| | | List<Object> parcelData = getParcelData(conditionVo, PARCEL_URL, PARCEL_KEY, PARCEL_SECRET); |
| | | if (null!=parcelData) { |
| | | //查询当天的包裹总数 |
| | | Integer dangerCount = null; |
| | | Integer contrabandCount = null; |
| | | if (status == 0) { |
| | | conditionVo.setStatus(0); |
| | | if (conditionVo.getStatus() == 0) { |
| | | for (Object object : parcelData) { |
| | | //取出list里面的值转为map |
| | | Map<String, Object> objectMap = (Map<String, Object>) object; |
| | |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Map<String, Object> selectParcelData() { |
| | | public Map<String, Object> selectParcelData(ConditionVo conditionVo) { |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | map.put("parcelData",getKindServenDataList()); |
| | | map.put("parcelData",getKindServenDataList(conditionVo)); |
| | | return map; |
| | | } |
| | | |
| | |
| | | * 获取危险违禁品7天内每天的数量集合 |
| | | * @return |
| | | */ |
| | | public List<Integer> getKindServenDataList(){ |
| | | ConditionVo conditionVo = new ConditionVo(); |
| | | conditionVo.setStatus(1);//近7天status 为 1 |
| | | public List<Integer> getKindServenDataList(ConditionVo conditionVo){ |
| | | if (null==conditionVo){ |
| | | conditionVo.setStatus(1);//近7天status 为 1 |
| | | } |
| | | //获取数据 |
| | | List<Object> objectList = getParcelData(conditionVo,PARCEL_CONTRABAND_URL,PARCEL_KEY,PARCEL_SECRET); |
| | | if (null!=objectList) { |
| | |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * 查询当前时间段违禁品总个数 |
| | | * @param conditionVo |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Integer selParcelTimeCount(ConditionVo conditionVo) { |
| | | return selectParcelCount(conditionVo).get(1); |
| | | } |
| | | |
| | | /** |
| | | *查询当前时间段区间时间违禁品个数 |
| | | * @param conditionVo |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<Integer> selParcelTimeDis(ConditionVo conditionVo) { |
| | | ArrayList<List<Object>> objectArrayList = new ArrayList<>(); |
| | | //设置页码数 |
| | | conditionVo.setCurrentPage(1); |
| | | conditionVo.setPageSize(100); |
| | | //获取数据 |
| | | Map<String,Object> result =(Map<String,Object>) getParcelDataPageList(conditionVo, PARCEL_KIND_URL, PARCEL_KEY, PARCEL_SECRET).get("result"); |
| | | if (null!=result) { |
| | | List<Object> dataList = JSONArray.parseArray(result.get("data").toString()); |
| | | objectArrayList.add(dataList); |
| | | //取第一次获取到的数据总数,每次取100条,多于100分批次取 |
| | | int totalSize = Integer.parseInt(result.get("totalSize").toString()); |
| | | int i = totalSize/100+1; |
| | | if (i>1){ |
| | | for (int j=1;j<i;j++) { |
| | | conditionVo.setCurrentPage(j+1); |
| | | //获取数据 |
| | | Map<String,Object> result0 =(Map<String,Object>) getParcelDataPageList(conditionVo, PARCEL_KIND_URL, PARCEL_KEY, PARCEL_SECRET).get("result"); |
| | | List<Object> dataLists = JSONArray.parseArray(result0.get("data").toString()); |
| | | objectArrayList.add(dataLists); |
| | | } |
| | | } |
| | | //合并集合 |
| | | List<Object> collect = objectArrayList.stream().flatMap(List::stream).collect(Collectors.toList()); |
| | | //筛选数据,返回数据 |
| | | return getParcelTimeDis(collect); |
| | | } |
| | | return Arrays.asList(0,0,0,0,0,0,0,0,0,0,0,0); |
| | | } |
| | | |
| | | /** |
| | | * 筛选数据,分类返回 |
| | | * @param collect 集合数据 |
| | | * @return |
| | | */ |
| | | private List<Integer> getParcelTimeDis(List<Object> collect) { |
| | | List<Integer> list = new ArrayList<>(); |
| | | int count02 = 0; |
| | | int count0204 = 0; |
| | | int count0406 = 0; |
| | | int count0608 = 0; |
| | | int count0810 = 0; |
| | | int count1012 = 0; |
| | | int count1214 = 0; |
| | | int count1416 = 0; |
| | | int count1618 = 0; |
| | | int count1820 = 0; |
| | | int count2022 = 0; |
| | | int count2224 = 0; |
| | | //遍历集合 |
| | | for (Object data:collect) { |
| | | Map<String,Object> parcelData =(Map<String,Object>)data; |
| | | try { |
| | | long hours = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(parcelData.get("createTime").toString()).getHours(); |
| | | if (hours>0 && hours< AlarmTimeConstant.TWO){ |
| | | count02+=1; |
| | | } |
| | | if (hours>=AlarmTimeConstant.TWO && hours<AlarmTimeConstant.FOUR){ |
| | | count0204+=1; |
| | | } |
| | | if (hours>=AlarmTimeConstant.FOUR && hours<AlarmTimeConstant.SIX){ |
| | | count0406+=1; |
| | | } |
| | | if (hours>=AlarmTimeConstant.SIX && hours<AlarmTimeConstant.EIGHT){ |
| | | count0608+=1; |
| | | } |
| | | if (hours>=AlarmTimeConstant.EIGHT && hours<AlarmTimeConstant.TEN){ |
| | | count0810+=1; |
| | | } |
| | | if (hours>=AlarmTimeConstant.TEN && hours<AlarmTimeConstant.TWEKVE){ |
| | | count1012+=1; |
| | | } |
| | | if (hours>=AlarmTimeConstant.TWEKVE && hours<AlarmTimeConstant.FOURTEEN){ |
| | | count1214+=1; |
| | | } |
| | | if (hours>=AlarmTimeConstant.FOURTEEN && hours<AlarmTimeConstant.SIXTEEN){ |
| | | count1416+=1; |
| | | } |
| | | if (hours>=AlarmTimeConstant.SIXTEEN && hours<AlarmTimeConstant.EIGHTEEN){ |
| | | count1618+=1; |
| | | } |
| | | if (hours>=AlarmTimeConstant.EIGHTEEN && hours<AlarmTimeConstant.TWENTY){ |
| | | count1820+=1; |
| | | } |
| | | if (hours>=AlarmTimeConstant.TWENTY && hours<AlarmTimeConstant.TWENTY_TWO){ |
| | | count2022+=1; |
| | | } |
| | | if (hours>=AlarmTimeConstant.TWENTY_TWO && hours<AlarmTimeConstant.TWENTY_FOUR){ |
| | | count2224+=1; |
| | | } |
| | | } catch (ParseException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | //封装数据 |
| | | list.add(count02); |
| | | list.add(count0204); |
| | | list.add(count0406); |
| | | list.add(count0608); |
| | | list.add(count0810); |
| | | list.add(count1012); |
| | | list.add(count1214); |
| | | list.add(count1416); |
| | | list.add(count1618); |
| | | list.add(count1820); |
| | | list.add(count2022); |
| | | list.add(count2224); |
| | | //返回数据 |
| | | return list; |
| | | } |
| | | } |
| | |
| | | import java.util.ArrayList; |
| | | import java.util.Calendar; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 日期工具类 |
| | |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| | | return sdf.format(today); |
| | | } |
| | | |
| | | /** |
| | | * 获取时间段内每天的日期 |
| | | * |
| | | * @param startDate 开始日期 yyyy-MM-dd HH:mm:ss |
| | | * @param endDate 结束日期 yyyy-MM-dd HH:mm:ss |
| | | * @return |
| | | */ |
| | | public static List<String> getTimeOverOneDate(String startDate, String endDate) { |
| | | List<String> times = new ArrayList<>(); |
| | | try { |
| | | Date startTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(startDate); |
| | | Date endTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(endDate); |
| | | int gap = (int) ((endTime.getTime() - startTime.getTime()) / (24*60*60*1000)); |
| | | times.clear(); |
| | | Calendar cld = Calendar.getInstance(); |
| | | cld.setTime(startTime); |
| | | for (int i = 0; i < gap +1; i++) { |
| | | times.add(new SimpleDateFormat("yyyy-MM-dd").format(cld.getTime())); |
| | | cld.add(Calendar.DATE,1); |
| | | } |
| | | return times; |
| | | } catch (ParseException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | } |
| | |
| | | * Javacv录制视频 |
| | | */ |
| | | @PostMapping("/rVoids") |
| | | public void rVoids() { |
| | | public void rVoids(String url) { |
| | | String UUID = DateUtil.time(); |
| | | UUIDs=UUID; |
| | | RecordVideoThread recordVideoThread = new RecordVideoThread(); |
| | | recordVideoThread.filePath = "D:\\software\\minio\\data\\jfpt\\void\\"+UUID + ".mp4"; |
| | | recordVideoThread.timesSec = 0L; |
| | | recordVideoThread.streamURL = "https://web.byisf.com:18000/live?port=1935&app=live&stream=0012415A75C6-1";// 最好设置结束时长 如直接停止程序会造成输出文件的损坏无法正常播放 |
| | | String newJson = StringEscapeUtils.unescapeHtml4(url); |
| | | recordVideoThread.streamURL =newJson;// 最好设置结束时长 如直接停止程序会造成输出文件的损坏无法正常播放 |
| | | recordVideoThread.isAudio = true; |
| | | thread = new Thread(recordVideoThread); |
| | | thread.start(); |
| | |
| | | |
| | | |
| | | @PostMapping("/stop") |
| | | public void stop(String jid) throws FrameGrabber.Exception { |
| | | public String stop(String jid) throws FrameGrabber.Exception { |
| | | //返回前端路径 |
| | | String vaddress = null; |
| | | thread.stop(); |
| | |
| | | vaddress = "https://web.byisf.com/" + PRF_MINIO_URL + UUIDs + ".mp4"; |
| | | //把路径通过警情id添加到警情信息 |
| | | alarmService.updateVaddress(vaddress,jid); |
| | | return vaddress; |
| | | |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import org.springblade.jfpt.parcel.vo.ConditionVo; |
| | | import org.springblade.jfpt.suser.entity.Suser; |
| | | import org.springblade.jfpt.suser.vo.SuserVOs; |
| | | |
| | |
| | | * 查询业主总数 |
| | | * @return |
| | | */ |
| | | Integer selectSuserCount(); |
| | | Integer selectSuserCount(ConditionVo conditionVo); |
| | | } |
| | |
| | | import com.baomidou.dynamic.datasource.annotation.DS; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springblade.jfpt.parcel.vo.ConditionVo; |
| | | import org.springblade.jfpt.suser.entity.Suser; |
| | | import org.springblade.jfpt.suser.mapper.SuserMapper; |
| | | import org.springblade.jfpt.suser.service.ISuserService; |
| | |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Integer selectSuserCount() { |
| | | public Integer selectSuserCount(ConditionVo conditionVo) { |
| | | return baseMapper.selectSuserCount(); |
| | | } |
| | | } |