sgj
9 小时以前 ec4f4bf4db52a0c0994edfecfcd8f6e194b429d5
fzzy-igdss-web/src/main/java/com/fzzy/group/manager/GroupManager.java
@@ -17,10 +17,7 @@
import javax.annotation.Resource;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.*;
import java.util.stream.Collectors;
/**
@@ -58,6 +55,9 @@
    private PledgeContractDepotService pledgeContractDepotService;
    @Resource
    private GatewaySerService gatewaySerService;
    @Resource
    private SnapReplyService  snapReplyService;
    /**
     * 获取省及下属市州集合
@@ -526,6 +526,16 @@
                if (null == cacheSerByDeptId || (null != cacheSerByDeptId && StringUtils.isNotBlank(cacheSerByDeptId.getStatus()) && cacheSerByDeptId.getStatus().equals(Constant.YN_N))) {
                    deptData.setDailyTotal(-1);
                }
                //统计未批复的抓拍告警数量
                IgdsBaseParam replyParam = new IgdsBaseParam();
                replyParam.setDeptId(dept.getId());
                replyParam.setCompanyId(param.getCompanyId());
                replyParam.setKey(Constant.YN_N);
                List<SnapReply> listByParam = snapReplyService.getListByParam(replyParam);
                if (null != listByParam && !listByParam.isEmpty()){
                    deptData.setUnReplyAlarmNum(listByParam.size());
                }
                list.add(deptData);
            }
        }
@@ -695,4 +705,53 @@
        return new PageResponse<>(RespCodeEnum.CODE_0000, resultListSnap);
    }
    /**
     * 大屏首页-抓拍跟踪信息-展示AI时间图片
     * 展示图片的业务逻辑:每个库区展示一张,图片为当天十点以后最新的一张
     *
     * @param param
     * @return
     */
    public PageResponse<List<EventInfo>> indexEventInfoList(IgdsBaseParam param) {
//        Date start =DateUtils.setHours(DateUtil.getNewByDay(new Date(), -3), 10);
        //param.setStart(start);
//        param.setEnd(DateUtil.getNewByDay(new Date(), -3));
        Date start =DateUtil.getNewByDay(new Date(), -10);
        param.setStart(start);
        param.setEnd(new Date());
        //获取当日的抓拍信息
        List<EventInfo> listByParam = eventInfoService.getListByParam(param);
        if (null == listByParam || listByParam.isEmpty()) {
            return new PageResponse<>(RespCodeEnum.CODE_0000, new ArrayList<>());
        }
        //获取所有的库区信息
        List<Dept> deptList = deptService.getDeptByUserType(null);
        //根据库区从listByParam来获取每一个库区下,最新的一张抓拍图片
        List<EventInfo> resultList = new ArrayList<>();
        for (Dept dept : deptList) {
            EventInfo latestEvent = null;
            //从listByParam中筛选出与当前id匹配的数据
            List<EventInfo> collect = listByParam.stream().filter(info -> info.getDeptId().equals(dept.getId())).sorted(Comparator.comparing(EventInfo::getTime).reversed()).collect(Collectors.toList());
            //每个库区获取最新的3张图片
            int i = 0;
            for (EventInfo info : collect) {
                if (i > 2) break;
                resultList.add(info);
                i++;
            }
        }
        if (null != resultList && !resultList.isEmpty()) {
            //判断文件是否存在
            for (EventInfo record : resultList) {
                record.setImgName(commonManager.isImgExit(record.getImgName(), null));
            }
        }
        return new PageResponse<>(RespCodeEnum.CODE_0000, resultList);
    }
}