2021与蓝度共同重构项目,服务端
fix
zhanzhiqin
2022-04-14 1c30a4f6ef5fd2ec3bac0f51f945e369fcf5745d
ximon-admin/src/main/java/com/sandu/ximon/admin/service/C3ChargingService.java
@@ -95,15 +95,6 @@
                c3mChargingChargeService.initCharge((c3mCharging1.getC3Id()).intValue());
            }
            //添加绑定关系
            Pole pole = poleService.getOne(Wrappers.lambdaQuery(Pole.class).eq(Pole::getDeviceCode, deviceName));
            if(pole != null){
                PoleBindingParam poleBindingParam = new PoleBindingParam();
                poleBindingParam.setDeviceType(2);
                poleBindingParam.setDeviceCode(mcuUdid);
                bindingService.bindPole(pole.getId(), poleBindingParam);
            }
        } else {
            //将设备信息添加到充电桩设备表
            one.setPoleDevicesCode(deviceName);
@@ -116,6 +107,28 @@
                c3mChargingChargeService.initCharge((c3mCharging1.getC3Id()).intValue());
            }
        }
        /**
         * 添加绑定关系开始
         */
        Pole pole = poleService.getOne(Wrappers.lambdaQuery(Pole.class).eq(Pole::getDeviceCode, deviceName));
        if (pole == null) {
            Pole pole1 = new Pole();
            pole1.setDeviceCode(deviceName);
            pole1.setPoleName(deviceName);
            pole1.setPoleCode(poleService.generatePoleCode());
            poleService.save(pole1);
        }
        Long poleId = poleService.getOne(Wrappers.lambdaQuery(Pole.class).eq(Pole::getDeviceCode, deviceName)).getId();
        PoleBindingParam poleBindingParam = new PoleBindingParam();
        poleBindingParam.setDeviceType(2);
        poleBindingParam.setDeviceCode(mcuUdid);
        bindingService.bindPole(poleId, poleBindingParam);
        /**
         * 添加绑定关系结束
         */
        //同步时间戳
        String date = new SimpleDateFormat("yyMMddHHmmss").format(new Date());
        String s = SetCalendar(c3Mac, Integer.parseInt(date.substring(0, 2)), Integer.parseInt(date.substring(2, 4)),
@@ -183,9 +196,9 @@
        List<C3ChargingBo> c3ChargingBoList = c3mChargingMapper.listC3mChargingDto(c3ChargingParam.getKeyword());
        for (C3ChargingBo one : c3ChargingBoList) {
            String s = RedisUtils.getBean().get(C3mRedisConstant.C3_STATUS.getCode() + one.getC3Mac());
            if(s != null){
            if (s != null) {
                one.setStatusBit(1);
            }else{
            } else {
                one.setStatusBit(0);
            }
@@ -195,14 +208,15 @@
    /**
     * 查询充电桩
     *
     * @return
     */
    public C3mCharging getByC3Mac(String c3Mac){
    public C3mCharging getByC3Mac(String c3Mac) {
        C3mCharging one = getOne(Wrappers.lambdaQuery(C3mCharging.class).eq(C3mCharging::getC3Mac, c3Mac));
        String s = RedisUtils.getBean().get(C3mRedisConstant.C3_STATUS.getCode() + one.getC3Mac());
        if(s != null){
        if (s != null) {
            one.setStatusBit(1);
        }else{
        } else {
            one.setStatusBit(0);
        }
        return one;