zxl
5 小时以前 3b0516a2959e25576e4f3fda697a3b025d06c8c9
ycl-server/src/main/java/com/ycl/task/HKTask.java
@@ -9,13 +9,11 @@
import com.ycl.platform.domain.entity.TMonitor;
import com.ycl.platform.domain.param.HK.*;
import com.ycl.platform.domain.result.HK.*;
import com.ycl.platform.domain.result.UY.MonitorQualifyResult;
import com.ycl.platform.domain.result.UY.VideoOnlineResult;
import com.ycl.platform.domain.vo.UpdateOnlineVO;
import com.ycl.platform.mapper.CheckIndexCarMapper;
import com.ycl.platform.mapper.CheckIndexFaceMapper;
import com.ycl.platform.mapper.TMonitorMapper;
import com.ycl.platform.mapper.WorkOrderMapper;
import com.ycl.platform.service.*;
import com.ycl.utils.DateUtils;
import constant.ApiConstants;
@@ -78,10 +76,6 @@
    private ICheckIndexFaceService faceService;
    @Autowired
    private CheckIndexFaceMapper faceMapper;
    @Autowired
    private StringHttpMessageConverter stringHttpMessageConverter;
    @Autowired
    private LoadBalancerRequestFactory loadBalancerRequestFactory;
    //车辆设备全检指标监测结果
    public void vehicleDeviceInspectionTask() {
@@ -598,20 +592,23 @@
        JSONObject labelJson = hkClient.getGetLabel();
        Integer faceLabelId = null;
        Integer carLabelId = null;
        Integer allLabelId = null;
        if (labelJson != null) {
            String code = labelJson.getString("code");
            if (ApiConstants.HKSuccessCode.equals(code)){
                //获得label考核标签对象
                log.error("labelJson的data:{}",labelJson.get("data"));
                List<HKResultLabel> hkResultLabels = labelJson.getList("data",HKResultLabel.class);
                for (HKResultLabel label : hkResultLabels) {
                    if ("省厅人脸".equals(label.getLabelName())){
                        faceLabelId = label.getId();
                    }else if ("省厅车辆".equals(label.getLabelName())){
                        carLabelId = label.getId();
                    }else if ("全量".equals(label.getLabelName())){
                        allLabelId = label.getId();
                    }
                }
                log.error("打印hkResultLabels:{}",hkResultLabels);
            }
        }
        if (faceLabelId == null || carLabelId == null){
@@ -638,6 +635,10 @@
//        param.setLabelId();
        //------------默认参数为null请求全量数据
        if (allLabelId == null){
            allLabelId = -1;
        }
        param.setLabelId(allLabelId);
        JSONObject scoreJson = hkClient.getScoreNew(param);
        log.error("全量数据");
        if (scoreJson != null) {
@@ -653,7 +654,6 @@
                    //以批次id为key 放入 JSONObject对象
                    map.put(Integer.valueOf(batchIdKey),batch);
                    //批次id 下 各区信息集合
                    log.error("打印出data内容中批次id:{},以及对应的结果info:{}",batchIdKey,batch);
                }
                //获得最大的键值
                Optional<Integer> maxKey = map.keySet().stream()
@@ -664,6 +664,7 @@
                    //这一层为获得 data -> 中 批次数组中 -> 区域code数组的key
                    for (String areaCodeKey : map.get(id).keySet()) {
                        //存放最新批次的内容到allInfo集合中
                        log.error("打印区信息:{}",map.get(id).get(areaCodeKey));
                        allInfo.addAll(map.get(id).getList(areaCodeKey,HkResultInfo.class));
                    }
                }
@@ -671,8 +672,8 @@
                Map<String, List<HkResultInfo>> groupedByAreaName = allInfo.stream()
                        .collect(Collectors.groupingBy(HkResultInfo::getAreaCode));
                for (Map.Entry<String, List<HkResultInfo>> entry : groupedByAreaName.entrySet()) {
                    log.error("最新批次内数据:{}",groupedByAreaName.get(entry.getKey()).size());
                    log.error("最新批次内size:{}",groupedByAreaName.get(entry.getKey()));
                    log.error("最新批次内size:{}",groupedByAreaName.get(entry.getKey()).size());
                    log.error("最新批次内数据:{}",groupedByAreaName.get(entry.getKey()));
                    CheckIndexCar car = new CheckIndexCar();
                    CheckIndexFace face = new CheckIndexFace();
                    score3Index(groupedByAreaName.get(entry.getKey()), car, face,entry.getKey());
@@ -693,28 +694,24 @@
                    cars.add(car);
                    faces.add(face);
                }
                //请求省厅数据
            }else {
                log.error("调用海康全量数据api失败");
            }
        }
        //------------获取省厅数据
        List<HkResultInfo> provincialList = new ArrayList<>();
        //获取省厅人脸数据
        if (faceLabelId != null){
            ScoreParam faceParam = new ScoreParam();
            log.error("faceLabelId:{}",faceLabelId);
            param.setLabelId(faceLabelId);
            JSONObject faceJson = hkClient.getScoreNew(param);
            faceParam.setLabelId(faceLabelId);
            JSONObject faceJson = hkClient.getScoreNew(faceParam);
            log.error("省厅人脸数据");
            if (faceJson != null) {
                String code = scoreJson.getString("code");
                String code = faceJson.getString("code");
                if (ApiConstants.HKSuccessCode.equals(code)){
                    JSONObject data = scoreJson.getJSONObject("data");
                    JSONObject data = faceJson.getJSONObject("data");
                    Map<Integer,JSONObject> map = new HashMap<>();
                    //获得data 下 batchId 的批次id对象 放入map中
@@ -725,7 +722,7 @@
                        //批次id 下 各区信息集合
                        log.error("打印出省厅人脸data内容中批次id:{},以及对应的结果info:{}",batchIdKey,batch);
                    }
                    //获得最大的键值
                //获得最大的键值
                    Optional<Integer> maxKey = map.keySet().stream()
                            .max(Integer::compareTo);
                    if (maxKey.isPresent()) {
@@ -743,21 +740,20 @@
                }
            }
        }else {
            log.error("faceLabelId:为空不执行获得省厅数据");
        }
        //获取省厅车辆数据
        //获取省厅车辆数据v.
        if (carLabelId != null){
            ScoreParam carParam = new ScoreParam();
            log.error("carLabelId:{}",carLabelId);
            param.setLabelId(carLabelId);
            JSONObject carJson = hkClient.getScoreNew(param);
            carParam.setLabelId(carLabelId);
            JSONObject carJson = hkClient.getScoreNew(carParam);
            log.error("省厅车辆数据");
            if (carJson != null) {
                String code = scoreJson.getString("code");
                String code = carJson.getString("code");
                if (ApiConstants.HKSuccessCode.equals(code)){
                    JSONObject data = scoreJson.getJSONObject("data");
                    JSONObject data = carJson.getJSONObject("data");
                    Map<Integer,JSONObject> map = new HashMap<>();
                    //获得data 下 batchId 的批次id对象 放入map中
@@ -791,8 +787,6 @@
        Map<String,List<HkResultInfo>> provincialGroupedByAreaName = provincialList.stream()
                .collect(Collectors.groupingBy(HkResultInfo::getAreaCode));
        for (Map.Entry<String, List<HkResultInfo>> entry : provincialGroupedByAreaName.entrySet()) {
            log.error("最新批次内省厅数据:{}",provincialGroupedByAreaName.get(entry.getKey()).size());
            log.error("最新批次内省厅size:{}",provincialGroupedByAreaName.get(entry.getKey()));
            CheckIndexCar car = new CheckIndexCar();
            CheckIndexFace face = new CheckIndexFace();
            score3Index(provincialGroupedByAreaName.get(entry.getKey()), car, face,entry.getKey());
@@ -813,7 +807,8 @@
            cars.add(car);
            faces.add(face);
        }
        log.error("打印插入数据cars:{}",cars);
        log.error("打印插入数据faces:{}",faces);
        //存放成绩到mysql,如果存在则替换不存在就新增。
        if (!CollectionUtils.isEmpty(cars)) carService.saveOrUpdateBatch(cars);
        if (!CollectionUtils.isEmpty(faces)) faceService.saveOrUpdateBatch(faces);
@@ -911,19 +906,13 @@
        face.setFaceInformationCollectionAccuracy(new BigDecimal("1"));
        //TODO:没找到考核项 设备目录一致率
        face.setDeviceDirectoryConsistent(new BigDecimal("1"));
        //TODO:没找到考核项 车辆卡口信息采集准确率
        car.setVehicleInformationCollectionAccuracy(new BigDecimal("1"));
        //TODO:没找到考核项 联网卡口设备目录一致率
        car.setDeviceDirectoryConsistent(new BigDecimal("1"));
    }
    //解析数据
    private <T> List<T> getDataList(JSONObject jsonObject, Class<T> resultClass, String message) {