blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/alarm/mapper/AlarmMapper.xml
@@ -93,6 +93,42 @@ <if test="alarm.timeDesc=='小于5分钟'"> and czTime-alarmTime>0 and czTime-alarmTime <300 </if> <if test="alarm.timeDesc=='0-2'"> and hour(alarmTime)>=0 and hour(alarmTime) <2 </if> <if test="alarm.timeDesc=='2-4'"> and hour(alarmTime)>=2 and hour(alarmTime) <4 </if> <if test="alarm.timeDesc=='4-6'"> and hour(alarmTime)>=4 and hour(alarmTime) <6 </if> <if test="alarm.timeDesc=='6-8'"> and hour(alarmTime)>=6 and hour(alarmTime) <8 </if> <if test="alarm.timeDesc=='8-10'"> and hour(alarmTime)>=8 and hour(alarmTime) <10 </if> <if test="alarm.timeDesc=='10-12'"> and hour(alarmTime)>=10 and hour(alarmTime) <12 </if> <if test="alarm.timeDesc=='12-14'"> and hour(alarmTime)>=12 and hour(alarmTime) <14 </if> <if test="alarm.timeDesc=='14-16'"> and hour(alarmTime)>=14 and hour(alarmTime) <16 </if> <if test="alarm.timeDesc=='16-18'"> and hour(alarmTime)>=16 and hour(alarmTime) <18 </if> <if test="alarm.timeDesc=='18-20'"> and hour(alarmTime)>=18 and hour(alarmTime) <20 </if> <if test="alarm.timeDesc=='20-22'"> and hour(alarmTime)>=20 and hour(alarmTime) <22 </if> <if test="alarm.timeDesc=='22-24'"> and hour(alarmTime)>=22 and hour(alarmTime) <24 </if> </if> and a.waringType IN("紧急求救") blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/animalheat/mapper/AnimalHeatMapper.xml
@@ -48,6 +48,44 @@ <if test="animalHeatVo.begTime!=null and animalHeatVo.begTime!='' and animalHeatVo.endTime!=null and animalHeatVo.endTime!='' "> and date(create_time) between #{animalHeatVo.begTime} and #{animalHeatVo.endTime} </if> <if test="animalHeatVo.timeDesc!=null and animalHeatVo.timeDesc!=''"> <if test="animalHeatVo.timeDesc=='0-2'"> and hour(create_time)>=0 and hour(create_time) <2 </if> <if test="animalHeatVo.timeDesc=='2-4'"> and hour(create_time)>=2 and hour(create_time) <4 </if> <if test="animalHeatVo.timeDesc=='4-6'"> and hour(create_time)>=4 and hour(create_time) <6 </if> <if test="animalHeatVo.timeDesc=='6-8'"> and hour(create_time)>=6 and hour(create_time) <8 </if> <if test="animalHeatVo.timeDesc=='8-10'"> and hour(create_time)>=8 and hour(create_time) <10 </if> <if test="animalHeatVo.timeDesc=='10-12'"> and hour(create_time)>=10 and hour(create_time) <12 </if> <if test="animalHeatVo.timeDesc=='12-14'"> and hour(create_time)>=12 and hour(create_time) <14 </if> <if test="animalHeatVo.timeDesc=='14-16'"> and hour(create_time)>=14 and hour(create_time) <16 </if> <if test="animalHeatVo.timeDesc=='16-18'"> and hour(create_time)>=16 and hour(create_time) <18 </if> <if test="animalHeatVo.timeDesc=='18-20'"> and hour(create_time)>=18 and hour(create_time) <20 </if> <if test="animalHeatVo.timeDesc=='20-22'"> and hour(create_time)>=20 and hour(create_time) <22 </if> <if test="animalHeatVo.timeDesc=='22-24'"> and hour(create_time)>=22 and hour(create_time) <24 </if> </if> ORDER BY create_time desc </select> blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/animalheat/vo/AnimalHeatVo.java
@@ -26,5 +26,10 @@ */ private Integer type; /** * 时间分布状态 */ private String timeDesc; } blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/healthcode/mapper/healthcodeMapper.xml
@@ -150,6 +150,44 @@ <if test="healthcodeVO.begTime!=null and healthcodeVO.begTime!='' and healthcodeVO.endTime!=null and healthcodeVO.endTime!='' "> and date(dtime) between #{healthcodeVO.begTime} and #{healthcodeVO.endTime} </if> <if test="healthcodeVO.timeDesc!=null and healthcodeVO.timeDesc!=''"> <if test="healthcodeVO.timeDesc=='0-2'"> and hour(dtime)>=0 and hour(dtime) <2 </if> <if test="healthcodeVO.timeDesc=='2-4'"> and hour(dtime)>=2 and hour(dtime) <4 </if> <if test="healthcodeVO.timeDesc=='4-6'"> and hour(dtime)>=4 and hour(dtime) <6 </if> <if test="healthcodeVO.timeDesc=='6-8'"> and hour(dtime)>=6 and hour(dtime) <8 </if> <if test="healthcodeVO.timeDesc=='8-10'"> and hour(dtime)>=8 and hour(dtime) <10 </if> <if test="healthcodeVO.timeDesc=='10-12'"> and hour(dtime)>=10 and hour(dtime) <12 </if> <if test="healthcodeVO.timeDesc=='12-14'"> and hour(dtime)>=12 and hour(dtime) <14 </if> <if test="healthcodeVO.timeDesc=='14-16'"> and hour(dtime)>=14 and hour(dtime) <16 </if> <if test="healthcodeVO.timeDesc=='16-18'"> and hour(dtime)>=16 and hour(dtime) <18 </if> <if test="healthcodeVO.timeDesc=='18-20'"> and hour(dtime)>=18 and hour(dtime) <20 </if> <if test="healthcodeVO.timeDesc=='20-22'"> and hour(dtime)>=20 and hour(dtime) <22 </if> <if test="healthcodeVO.timeDesc=='22-24'"> and hour(dtime)>=22 and hour(dtime) <24 </if> </if> ORDER BY dtime desc </select> blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/healthcode/vo/HealthcodeVO.java
@@ -50,4 +50,9 @@ */ private Integer status; /** * 时间分布状态 */ private String timeDesc; } blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/parcel/service/impl/ParcelServiceImpl.java
@@ -15,6 +15,7 @@ import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import java.lang.reflect.Array; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.*; @@ -33,18 +34,23 @@ @Value("${PARCEL_SECRET}") private String PARCEL_SECRET; //查询某期间的违禁物品(违禁小类)统计 @Value("${PARCEL_CONTRABAND_URL}") private String PARCEL_CONTRABAND_URL; //查询某期间的包裹统计 @Value("${PARCEL_URL}") private String PARCEL_URL; //查询安检图片 @Value("${PARCEL_PICTURE_URL}") private String PARCEL_PICTURE_URL; //查询安检明细列表 @Value("${PARCEL_DETAIL_RUL}") private String PARCEL_DETAIL_RUL; //查询安检违禁品列表 @Value("${PARCEL_KIND_URL}") private String PARCEL_KIND_URL; @@ -397,17 +403,136 @@ */ @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); if(null!=conditionVo.getTimeDesc() && conditionVo.getTimeDesc()!=""){ Map<Object, Object> map = new HashMap<>(); List<List<Object>> objectArrayList = new ArrayList<>(); List<Object> list = new ArrayList<>(); //设置页码数 ConditionVo vo = new ConditionVo(); vo.setCurrentPage(1); vo.setPageSize(100); vo.setDecisioDiagramResult(conditionVo.getDecisioDiagramResult()); vo.setStartTime(conditionVo.getStartTime()); vo.setEndTime(conditionVo.getEndTime()); Map<String,Object> result =(Map<String,Object>) getParcelDataPageList(vo, 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++) { vo.setCurrentPage(j+1); //获取数据 Map<String,Object> result0 =(Map<String,Object>) getParcelDataPageList(vo, 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()); //选出符合条件的数据 list = TimeDisData(conditionVo,collect); //分页 List<Object> listPaging = PageList.getListPaging(list, conditionVo.getCurrentPage(), conditionVo.getPageSize()); map.put("currentPage",conditionVo.getCurrentPage()); map.put("pageSize",conditionVo.getPageSize()); map.put("totalSize",list.size()); map.put("data",listPaging); //返回数据 return map; } }else { String result = getParcelDataPageList(conditionVo, PARCEL_KIND_URL, PARCEL_KEY, PARCEL_SECRET).get("result").toString(); //获取违禁品数据 if (null!=result) { return JSONObject.parse(result); } } return null; } /** * 获取符合符合时间区间的违禁品明细集合数据 * @param collect * @return */ private List<Object> TimeDisData(ConditionVo conditionVo,List<Object> collect) { List<Object> list = new ArrayList<>(); //遍历集合,选出符合条件的 for (Object object:collect) { Map<String,Object> objectMap = (Map<String, Object>) object; try { long time = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(objectMap.get("createTime").toString()).getHours(); if (conditionVo.getTimeDesc().equals("0-2")){ if (time>=0 && time<2){ list.add(objectMap); } } if (conditionVo.getTimeDesc().equals("2-4")){ if (time>=2 && time<4){ list.add(objectMap); } } if (conditionVo.getTimeDesc().equals("4-6")){ if (time>=4 && time<6){ list.add(objectMap); } } if (conditionVo.getTimeDesc().equals("6-8")){ if (time>=6 && time<8){ list.add(objectMap); } } if (conditionVo.getTimeDesc().equals("8-10")){ if (time>=8 && time<10){ list.add(objectMap); } } if (conditionVo.getTimeDesc().equals("10-12")){ if (time>=10 && time<12){ list.add(objectMap); } } if (conditionVo.getTimeDesc().equals("12-14")){ if (time>=12 && time<14){ list.add(objectMap); } } if (conditionVo.getTimeDesc().equals("14-16")){ if (time>=14 && time<16){ list.add(objectMap); } } if (conditionVo.getTimeDesc().equals("16-18")){ if (time>=16 && time<18){ list.add(objectMap); } } if (conditionVo.getTimeDesc().equals("18-20")){ if (time>=18 && time<20){ list.add(objectMap); } } if (conditionVo.getTimeDesc().equals("20-22")){ if (time>=20 && time<22){ list.add(objectMap); } } if (conditionVo.getTimeDesc().equals("22-24")){ if (time>=22 && time<24){ list.add(objectMap); } } } catch (ParseException e) { e.printStackTrace(); } } return list; } /** * 远程调用api 获取违禁品详细数据 * @param conditionVo 条件 * @param url 违禁品详细数据Url blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/parcel/vo/ConditionVo.java
@@ -49,9 +49,4 @@ * 预警确认时间描述 */ private String timeDesc; /** * 预警时间分布 */ private Integer timeNum; }