2021与蓝度共同重构项目,服务端
LHN
2022-10-20 97a90aef9561782d60546c7a2a98cb75b2fc34f4
changes
已修改5个文件
182 ■■■■ 文件已修改
dao/src/main/java/com/sandu/ximon/dao/enums/MenuEnum.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
dao/src/main/resources/mapper/LightReportErrorMapper.xml 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ximon-admin/src/main/java/com/sandu/ximon/admin/controller/AirEquipmentNongGengController.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ximon-admin/src/main/java/com/sandu/ximon/admin/service/LightReportErrorService.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ximon-admin/src/main/java/com/sandu/ximon/admin/service/PlayPlanNvService.java 169 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
dao/src/main/java/com/sandu/ximon/dao/enums/MenuEnum.java
@@ -33,6 +33,7 @@
    PLAYPLAN_LIST("播放计划列表"),
    LED_FILE_S_LIST("LED屏素材列表"),
    AIR_EQUIPMENT_LIST("大气设备列表"),
    AIR_EQUIPMENT_INFO("大气设备详情"),
    AIR_DATA_LIST("大气数据列表"),
    AIR_DATA_LIST_HISTORY("大气数据历史"),
    AIR_EQUIPMENT_NONG_GENG_LIST("大气设备农耕列表"),
dao/src/main/resources/mapper/LightReportErrorMapper.xml
@@ -52,11 +52,11 @@
        light_report_error t1
        LEFT JOIN pole t3 ON t1.device_code = t3.device_code
        WHERE
        <if test="userid != null">
            t3.client_id = #{userId} OR t3.user_id = #{userId} AND
        </if>
        t1.light_report_error_id IN ( SELECT t.max_id FROM ( SELECT Max( light_report_error.light_report_error_id ) AS
        max_id FROM light_report_error GROUP BY light_report_error.device_code ) AS t )
        <if test="userid != null">
            AND  t3.client_id = #{userId} OR t3.user_id = #{userId}
        </if>
        ORDER BY
        t1.create_time DESC
    </select>
ximon-admin/src/main/java/com/sandu/ximon/admin/controller/AirEquipmentNongGengController.java
@@ -52,6 +52,9 @@
    @GetMapping("/getAirEquipment/{mac}")
    public ResponseVO<Object> getAirEquipment(@PathVariable String mac) {
        if (!permissionConfig.check(MenuEnum.AIR_EQUIPMENT_INFO.getCode())) {
            return ResponseUtil.fail("缺少对应用户权限");
        }
        return ResponseUtil.success(airEquipmentNongGengService.getAirEquipment(mac));
    }
ximon-admin/src/main/java/com/sandu/ximon/admin/service/LightReportErrorService.java
@@ -2,15 +2,12 @@
import com.github.pagehelper.PageHelper;
import com.sandu.common.domain.CommonPage;
import com.sandu.common.execption.BusinessException;
import com.sandu.common.object.BaseConditionVO;
import com.sandu.common.service.impl.BaseServiceImpl;
import com.sandu.ximon.admin.manager.iot.frame.A5Frame;
import com.sandu.ximon.admin.manager.iot.frame.inner.report.A5C3QueryReportInnerFrame;
import com.sandu.ximon.admin.manager.iot.frame.inner.report.A5LightErrorCodeReportInnerFrame;
import com.sandu.ximon.admin.manager.iot.frame.inner.report.A5LightOperationReportInnerFrame;
import com.sandu.ximon.admin.manager.iot.frame.inner.request.A5LightCleanErrorCodeInnerFrame;
import com.sandu.ximon.admin.manager.iot.frame.inner.request.C3QueryAddressReqInnerFrame;
import com.sandu.ximon.admin.manager.iot.rrpc.dto.CommonFrame;
import com.sandu.ximon.admin.manager.iot.rrpc.enums.A5OrderEnum;
import com.sandu.ximon.admin.manager.iot.rrpc.enums.LightErrorEnum;
ximon-admin/src/main/java/com/sandu/ximon/admin/service/PlayPlanNvService.java
@@ -435,91 +435,90 @@
                && !Objects.equals(ledProgram.getUserId(), SecurityUtils.getUserId())) {
            throw new BusinessException("请不要操作其他人的节目");
        }
        return null;
//        String pages = ledProgram.getPages();
//
//
//        List<String> success = new ArrayList<>();
//        List<String> fail = new ArrayList<>();
//        //拼接成功失败的结果
//        Map<String, Object> result = new HashMap<>();
//        List<NovaPushResultVO> successList = new ArrayList<>();
//        List<NovaPushResultVO> faileList = new ArrayList<>();
//
//
//        List<List<String>> split = CollectionUtil.split(nova.stream().map(NovaPushResultVO::getPlayerId).collect(Collectors.toList()), 100);
//
//        for (List<String> playerIds : split) {
//            PlayerProgram program = new PlayerProgram();
//            List<PlayerPage> programDtos = JSON.parseArray(pages, PlayerPage.class);
//            programDtos.forEach(
//                    programDto -> {
//                        programDto.getWidgets().forEach(
//                                widget -> {
//                                    if (PlayerWidgetType.PICTURE.equals(widget.getType()) || PlayerWidgetType.VIDEO.equals(widget.getType())) {
//                                        String url = widget.getUrl();
//                                        LEDProgramFile one = fileService.getOne(Wrappers.lambdaQuery(LEDProgramFile.class).eq(LEDProgramFile::getFileUrl, url));
//                                        if (one == null) {
//                                            throw new BusinessException("节目文件已失效");
//                                        }
//                                        widget.setMd5(one.getMd5());
//                                        widget.setSize(Long.parseLong(one.getSize()));
//                                    }
//                                }
//                        );
//                    }
//            );
//            program.setPlayerIds(playerIds);
//            //获取节目实体
//            program.setPages(programDtos);
//
//            program.setNoticeUrl(VnnoxConstant.NOTIFY_URL);
//            VnnoxResultResponse vnnoxResultResponse = vnnoxProgramAPIUtil.pushProgram(program);
//
//            if (vnnoxResultResponse == null || vnnoxResultResponse.getData() == null) {
//                throw new BusinessException("推送失败");
//            }
//
//
//            if (vnnoxResultResponse.getData() != null) {
//                success = vnnoxResultResponse.getData().getSuccess();
//                fail = vnnoxResultResponse.getData().getFail();
//            }
//
//            List<String> finalSuccess = success;
//            List<String> finalFail = fail;
//            nova.forEach(n -> {
//                if (finalSuccess.contains(n.getPlayerId())) {
//                    successList.add(n);
//                } else if (finalFail.contains(n.getPlayerId())) {
//                    faileList.add(n);
//                }
//            });
//        }
//
//        result.put("success", successList);
//        result.put("fail", faileList);
//
//        /**
//         * 诺瓦推送节目日志记录开始
//         */
//        List<LedPlayerEntity> list = SpringContextHolder.getBean(LedPlayerEntityService.class)
//                .list(Wrappers.lambdaQuery(LedPlayerEntity.class).in(LedPlayerEntity::getId, nova.stream().map(NovaPushResultVO::getPlayerId).toArray()));
//        List<String> listCode = new ArrayList<>();
//        for (LedPlayerEntity temp : list) {
//            listCode.add(temp.getSn());
//        }
//
//        String content = "{节目ID:" + pid
//                + ", 节目名称:" + ledProgram.getName()
//                + "}," + " 推送结果:" + result
//                + " }";
//        StoreOperationRecordsUtils.storeOperationData(listCode, null, "诺瓦推送节目", content);
//        /**
//         * 诺瓦推送节目日志记录结束
//         */
//
//        return result;
        String pages = ledProgram.getPages();
        List<String> success = new ArrayList<>();
        List<String> fail = new ArrayList<>();
        //拼接成功失败的结果
        Map<String, Object> result = new HashMap<>();
        List<NovaPushResultVO> successList = new ArrayList<>();
        List<NovaPushResultVO> faileList = new ArrayList<>();
        List<List<String>> split = CollectionUtil.split(nova.stream().map(NovaPushResultVO::getPlayerId).collect(Collectors.toList()), 100);
        for (List<String> playerIds : split) {
            PlayerProgram program = new PlayerProgram();
            List<PlayerPage> programDtos = JSON.parseArray(pages, PlayerPage.class);
            programDtos.forEach(
                    programDto -> {
                        programDto.getWidgets().forEach(
                                widget -> {
                                    if (PlayerWidgetType.PICTURE.equals(widget.getType()) || PlayerWidgetType.VIDEO.equals(widget.getType())) {
                                        String url = widget.getUrl();
                                        LEDProgramFile one = fileService.getOne(Wrappers.lambdaQuery(LEDProgramFile.class).eq(LEDProgramFile::getFileUrl, url));
                                        if (one == null) {
                                            throw new BusinessException("节目文件已失效");
                                        }
                                        widget.setMd5(one.getMd5());
                                        widget.setSize(Long.parseLong(one.getSize()));
                                    }
                                }
                        );
                    }
            );
            program.setPlayerIds(playerIds);
            //获取节目实体
            program.setPages(programDtos);
            program.setNoticeUrl(VnnoxConstant.NOTIFY_URL);
            VnnoxResultResponse vnnoxResultResponse = vnnoxProgramAPIUtil.pushProgram(program);
            if (vnnoxResultResponse == null || vnnoxResultResponse.getData() == null) {
                throw new BusinessException("推送失败");
            }
            if (vnnoxResultResponse.getData() != null) {
                success = vnnoxResultResponse.getData().getSuccess();
                fail = vnnoxResultResponse.getData().getFail();
            }
            List<String> finalSuccess = success;
            List<String> finalFail = fail;
            nova.forEach(n -> {
                if (finalSuccess.contains(n.getPlayerId())) {
                    successList.add(n);
                } else if (finalFail.contains(n.getPlayerId())) {
                    faileList.add(n);
                }
            });
        }
        result.put("success", successList);
        result.put("fail", faileList);
        /**
         * 诺瓦推送节目日志记录开始
         */
        List<LedPlayerEntity> list = SpringContextHolder.getBean(LedPlayerEntityService.class)
                .list(Wrappers.lambdaQuery(LedPlayerEntity.class).in(LedPlayerEntity::getId, nova.stream().map(NovaPushResultVO::getPlayerId).toArray()));
        List<String> listCode = new ArrayList<>();
        for (LedPlayerEntity temp : list) {
            listCode.add(temp.getSn());
        }
        String content = "{节目ID:" + pid
                + ", 节目名称:" + ledProgram.getName()
                + "}," + " 推送结果:" + result
                + " }";
        StoreOperationRecordsUtils.storeOperationData(listCode, null, "诺瓦推送节目", content);
        /**
         * 诺瓦推送节目日志记录结束
         */
        return result;
    }