jiangping
2024-09-29 1a9da0b5ef171300a5f7968a8ce09b30f9d2f793
最新版本
已修改10个文件
262 ■■■■ 文件已修改
server/system_service/src/main/java/com/doumee/core/utils/Constants.java 61 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/visits/dmvisit_service/src/main/java/com/doumee/core/haikang/model/param/request/TransparentChannelSingleRequest.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/PlatformDeviceMapper.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/PlatformJobMapper.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/model/PlatformBroadcastLog.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/model/PlatformDevice.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/DeviceServiceImpl.java 51 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/PlatformServiceImpl.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/hksync/HkSyncPlatformsServiceImpl.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/hksync/HkSyncPushServiceImpl.java 127 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/system_service/src/main/java/com/doumee/core/utils/Constants.java
@@ -36,6 +36,7 @@
    public static final int ONE = 1 ;
    public static final int TWO = 2 ;
    public static final String HK_PARAM ="HK_PARAM" ;
    public static final String LED_CONTENT_SPEED ="LED_CONTENT_SPEED" ;
    public static final String HK_HOST ="HK_HOST" ;
    public static final String HK_APPKEY ="HK_APPKEY" ;
    public static final String HK_APPSECRET ="HK_APPSECRET" ;
@@ -919,6 +920,64 @@
            this.info = info;
        }
    }
    /**
     * 广播通知内容
     1. 叫号中:皖A12345请前往1号月台等待作业
     2. 作业完成:皖A12345作业完成,请尽快驶离
     3. 错误停靠:皖A12345月台停靠错误,请尽快驶离
     4. 超时停靠:皖A12345月台停靠超时,请尽快驶离请尽快驶离
     */
    public  enum PlatformBroadcastContent {
        CALLING(1, "叫号中"," ${param}请前往${param2}等待作业"),
        DONE(2, "作业完成","${param}作业完成,请尽快驶离" ),
        WRONG_IN(3, "错误停靠","${param}月台停靠错误,请尽快驶离" ),
        TIMEOUT_IN(4, "超时停靠","${param}月台停靠超时,请尽快驶离请尽快驶离" ),
        ;
        // 成员变量
        private int key;
        private String name;
        private String info;
        // 构造方法
        PlatformBroadcastContent(int key, String name,String info ) {
            this.key = key;
            this.info = info;
            this.name = name;
        }
        public static String getName(int index) {
            for (PlatformBroadcastContent c : PlatformBroadcastContent.values()) {
                if (c.getKey() == index) {
                    return c.name;
                }
            }
            return null;
        }
        public int getKey() {
            return key;
        }
        public void setKey(int key) {
            this.key = key;
        }
        public String getName() {
            return name;
        }
        public void setName(String name) {
            this.name = name;
        }
        public String getInfo() {
            return info;
        }
        public void setInfo(String info) {
            this.info = info;
        }
    }
    /**
     * 月台作业 状态
@@ -931,7 +990,7 @@
        IN_WAIT(3, "入园等待","入园等待" ),
        CALLED(4, "已叫号","已叫号" ),
        WORKING(5, "作业中","作业中" ),
        DONE(6, "作业完成 ","作业完成 " ),
        DONE(6, "作业完成 ","作业完成" ),
        TRANSFERING(7, "转移中","转移中" ),
        EXCEPTION(8, "异常挂起","异常挂起" ),
        AUTHED_LEAVE(9, "已授权离园","已授权离园" ),
server/visits/dmvisit_service/src/main/java/com/doumee/core/haikang/model/param/request/TransparentChannelSingleRequest.java
@@ -12,4 +12,6 @@
  */
 private String content    ; //String    true    内容
 private Integer deviceId; //    String    false    设备主键
 private int speed; //    播放速度
 private int color; // 字体颜色(1:红色,2:绿色,4:黄色,8:蓝色,16:紫色,32:青色,64:白色)
}
server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/PlatformDeviceMapper.java
@@ -2,11 +2,12 @@
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.doumee.dao.business.model.PlatformDevice;
import com.github.yulichang.base.MPJBaseMapper;
/**
 * @author 江蹄蹄
 * @date 2024/06/28 10:03
 */
public interface PlatformDeviceMapper extends BaseMapper<PlatformDevice> {
public interface PlatformDeviceMapper extends MPJBaseMapper<PlatformDevice> {
}
server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/PlatformJobMapper.java
@@ -2,11 +2,12 @@
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.doumee.dao.business.model.PlatformJob;
import com.github.yulichang.base.MPJBaseMapper;
/**
 * @author 江蹄蹄
 * @date 2024/06/28 10:03
 */
public interface PlatformJobMapper extends BaseMapper<PlatformJob> {
public interface PlatformJobMapper extends MPJBaseMapper<PlatformJob> {
}
server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/model/PlatformBroadcastLog.java
@@ -59,8 +59,8 @@
    @ExcelColumn(name="关联对象编码")
    private String objId;
    @ApiModelProperty(value = "关联对象类型 0月台作业", example = "1")
    @ExcelColumn(name="关联对象类型 0月台作业")
    @ApiModelProperty(value = "关联对象类型 0月台作业 1其他", example = "1")
    @ExcelColumn(name="关联对象类型 0月台作业 1其他")
    private Integer objType;
    @ApiModelProperty(value = "提醒次数", example = "1")
server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/model/PlatformDevice.java
@@ -78,5 +78,8 @@
    @ApiModelProperty(value = "设备状态 0在线 1离线", example = "1")
    @ExcelColumn(name="设备状态 0在线 1离线")
    private Integer status;
    @ApiModelProperty(value = "设备編碼")
    @ExcelColumn(name="设备編碼")
    private String hkNo;
}
server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/DeviceServiceImpl.java
@@ -1,6 +1,8 @@
package com.doumee.service.business.impl;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.doumee.biz.system.SystemDictDataBiz;
import com.doumee.core.constants.ResponseStatus;
import com.doumee.core.exception.BusinessException;
import com.doumee.core.haikang.model.HKConstants;
@@ -12,21 +14,21 @@
import com.doumee.core.utils.Constants;
import com.doumee.core.utils.Utils;
import com.doumee.dao.business.DeviceMapper;
import com.doumee.dao.business.PlatformBroadcastLogMapper;
import com.doumee.dao.business.model.Device;
import com.doumee.dao.business.model.PlatformBroadcastLog;
import com.doumee.service.business.DeviceService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.doumee.service.business.impl.hksync.HkSyncPushServiceImpl;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
/**
 * 设备信息表Service实现
@@ -38,6 +40,10 @@
    @Autowired
    private DeviceMapper deviceMapper;
    @Autowired
    private SystemDictDataBiz systemDictDataBiz;
    @Autowired
    private PlatformBroadcastLogMapper platformBroadcastLogMapper;
    @Override
@@ -230,15 +236,15 @@
                || !Constants.equalsInteger(device.getType(),Constants.TWO)){
            throw new BusinessException(ResponseStatus.DATA_EMPTY);
        }
        TransparentChannelBodyRequest body = new TransparentChannelBodyRequest();
/*      TransparentChannelBodyRequest body = new TransparentChannelBodyRequest();
        TransparentChannelHeadRequest head = new TransparentChannelHeadRequest();
        TransparentChannelBodyParamRequest request = new TransparentChannelBodyParamRequest();
        TransparentChannelBodyRegionRequest regions = new TransparentChannelBodyRegionRequest();
        head.setAbility("cld");//固定值
        head.setTreatyType("haixuan_led_net");//固定值
        head.setDeviceIndexCode(device.getHkId());
        head.setDeviceIndexCode(device.getNo());
        body.setMethod("ControlLedGereral");//固定值
        request.setIndexCode(device.getHkId());
        request.setIndexCode(device.getNo());
        request.setOperationType(219);//固定值
        regions.setActionType(32);
        regions.setContent(model.getContent());
@@ -254,9 +260,36 @@
        regions.setRegionRightBottomYPos(31);
        request.setRegions(new ArrayList<>());
        request.getRegions().add(regions);
        regions.setSpeed(13);
        regions.setSpeed(8);
        body.setParams(request);
        BaseResponse response =  HKService.transparentchannel(head,body);
        BaseResponse response =  HKService.transparentchannel(head,body);*/
        if(model.getSpeed()<=0){
            int speed = 13;
            try {
                speed = Integer.parseInt(systemDictDataBiz.queryByCode(Constants.HK_PARAM,Constants.LED_CONTENT_SPEED).getCode());
            }catch (Exception e){
            }
            model.setSpeed(speed);
        }
        BaseResponse response =  HkSyncPushServiceImpl.dealLedContentBiz(device.getNo(),model.getContent(),model.getSpeed(),1);
        PlatformBroadcastLog log = new PlatformBroadcastLog();
        log.setCreateDate(new Date());
        log.setBizType(Constants.ONE);
        log.setHkDate(new Date());
        log.setDeviceType(Constants.ONE);
        log.setObjType(Constants.ONE);
        log.setHkId(device.getHkId());
        if(response == null || !StringUtils.equals(response.getCode(), HKConstants.RESPONSE_SUCCEE)){
            log.setHkInfo("请求失败:"+JSONObject.toJSONString(response));
            log.setHkStatus(Constants.THREE);
        }else{
            log.setHkInfo("请求成功");
            log.setHkStatus(Constants.TWO);
        }
        log.setName("设置LED屏显内容");
        log.setInfo(model.getContent());
        log.setNum(Constants.ONE);
        platformBroadcastLogMapper.insert(log);
        if(response == null || !StringUtils.equals(response.getCode(), HKConstants.RESPONSE_SUCCEE)){
            throw  new BusinessException(ResponseStatus.SERVER_ERROR.getCode(), "对不起,屏幕内容设置失败"+(response!=null?response.getMsg():""));
        }
server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/PlatformServiceImpl.java
@@ -79,6 +79,7 @@
                platformDevice.setType(Constants.ZERO);
                platformDevice.setDeviceId(ledId.toString());
                platformDevice.setHkId(device.getHkId());
                platformDevice.setHkNo(device.getNo());
                platformDevice.setName(device.getName());
                platformDeviceList.add(platformDevice);
            }
@@ -100,6 +101,7 @@
                platformDevice.setType(Constants.TWO);
                platformDevice.setDeviceId(broadcastId.toString());
                platformDevice.setHkId(device.getHkId());
                platformDevice.setHkNo(device.getNo());
                platformDevice.setName(device.getName());
                platformDeviceList.add(platformDevice);
            }
@@ -154,6 +156,7 @@
                platformDevice.setType(Constants.ZERO);
                platformDevice.setDeviceId(ledId.toString());
                platformDevice.setHkId(device.getHkId());
                platformDevice.setHkNo(device.getNo());
                platformDevice.setName(device.getName());
                platformDeviceList.add(platformDevice);
            }
@@ -177,6 +180,7 @@
                platformDevice.setType(Constants.TWO);
                platformDevice.setDeviceId(broadcastId.toString());
                platformDevice.setHkId(device.getHkId());
                platformDevice.setHkNo(device.getNo());
                platformDevice.setName(device.getName());
                platformDeviceList.add(platformDevice);
            }
server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/hksync/HkSyncPlatformsServiceImpl.java
@@ -165,7 +165,9 @@
                    editList.add(model);
                    //清空监控点数据
                    platformDeviceMapper.delete(new UpdateWrapper<PlatformDevice>().lambda()
                            .eq(PlatformDevice::getPlatformId,model.getId()));
                            .eq(PlatformDevice::getPlatformId,model.getId())
                            .eq(PlatformDevice::getType,Constants.ONE)
                    );
                    deviceList.addAll(getCameraList(device.getCameras(),model));
                }else{
                    //如果不存在,则新增数据
server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/hksync/HkSyncPushServiceImpl.java
@@ -3,10 +3,12 @@
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.doumee.biz.system.SystemDictDataBiz;
import com.doumee.config.DataSyncConfig;
import com.doumee.config.SpringContextUtil;
import com.doumee.core.exception.BusinessException;
import com.doumee.core.haikang.model.HKConstants;
import com.doumee.core.haikang.model.param.BaseResponse;
import com.doumee.core.haikang.model.param.request.*;
import com.doumee.core.haikang.model.param.request.event.acs.EventAcsInfoRequest;
import com.doumee.core.haikang.model.param.request.event.acs.EventAcsRequest;
@@ -75,7 +77,11 @@
    @Autowired
    private PlatformMapper platformMapper;
    @Autowired
    private SystemDictDataBiz systemDictDataBiz;
    @Autowired
    private PlatformDeviceMapper platformDeviceMapper;
    @Autowired
    private PlatformBroadcastLogMapper platformBroadcastLogMapper;
    @Autowired
    private PlatformJobMapper platformJobMapper;
    @Autowired
@@ -886,7 +892,10 @@
                        if(StringUtils.isBlank(status.getPlateNo())){
                            continue;//如果车辆信息为空,不处理直接跳过
                        }
                        PlatformJob job = platformJobMapper.selectOne(new QueryWrapper<PlatformJob>().lambda()
                        PlatformJob job = platformJobMapper.selectJoinOne(PlatformJob.class, new MPJLambdaWrapper<PlatformJob>()
                                .selectAll(PlatformJob.class)
                                .selectAs(Platform::getName,PlatformJob::getPlatformName)
                                .leftJoin(Platform.class,Platform::getId,PlatformJob::getPlatformId)
                                .eq(StringUtils.equals(status.getStockStatus(),"front"),PlatformJob::getCarCodeFront,status.getPlateNo() )//前车牌号
                                .eq(!StringUtils.equals(status.getStockStatus(),"front"),PlatformJob::getCarCodeBack,status.getPlateNo() )//后车牌号
                                .eq(PlatformJob::getIsdeleted,Constants.ZERO )
@@ -1039,62 +1048,118 @@
        savePlatformWarnEventDTO.setEventType(Constants.PlatformWarnEvent.STOP_ERROR.getKey());
        platformWarnEventService.savePlatformWarnEvent(savePlatformWarnEventDTO);
        int speed = 13;
        try {
            speed = Integer.parseInt(systemDictDataBiz.queryByCode(Constants.HK_PARAM,Constants.LED_CONTENT_SPEED).getCode());
        }catch (Exception e){
        }
        List<PlatformDevice> deviceList = platformDeviceMapper.selectList(new QueryWrapper<PlatformDevice>().lambda()
                .eq(PlatformDevice::getPlatformId,model.getPlatformId())
                .eq(PlatformDevice::getIsdeleted,Constants.ZERO));
        if(deviceList ==null || deviceList.size() == 0){
            return;
        }
        String content ="车辆"+model.getCarCodeFront()+"停错月台了";
        String content =Constants.PlatformLedContent.WRONG_IN.getInfo();
        content = content.replace("${param}",model.getPlatformName());
        content = content.replace("${param2}",model.getCarCodeFront());
        List<String> broadcastList = new ArrayList<>();
        List<String> ledList = new ArrayList<>();
        List<PlatformBroadcastLog> logList = new ArrayList<>();
        for(PlatformDevice device : deviceList){
            if(StringUtils.isNotBlank(device.getHkId())){
                continue;
            }
            if(Constants.equalsInteger(device.getType(),Constants.ZERO)){
                //如果是LED
                TransparentChannelBodyRequest body = new TransparentChannelBodyRequest();
                TransparentChannelHeadRequest head = new TransparentChannelHeadRequest();
                TransparentChannelBodyParamRequest request = new TransparentChannelBodyParamRequest();
                TransparentChannelBodyRegionRequest regions = new TransparentChannelBodyRegionRequest();
                head.setAbility("cld");//固定值
                head.setTreatyType("haixuan_led_net");//固定值
                head.setDeviceIndexCode(device.getHkId());
                body.setMethod("ControlLedGereral");//固定值
                request.setIndexCode(device.getHkId());
                request.setOperationType(219);//固定值
                regions.setActionType(32);
                regions.setContent(content);
                regions.setRegionNo(1);
                regions.setRegionType(14);
                regions.setFontColor(1);
                regions.setCircleTimes(1);//循环次数
                regions.setFontSize(32);//
                regions.setStayTime(1);//单位??
                regions.setRegionLeftTopXPos(0);
                regions.setRegionLeftTopYPos(0);
                regions.setRegionRightBottomXPos(255);
                regions.setRegionRightBottomYPos(31);
                request.setRegions(new ArrayList<>());
                request.getRegions().add(regions);
                regions.setSpeed(13);
                body.setParams(request);
                HKService.transparentchannel(head,body);
                PlatformBroadcastLog log = new PlatformBroadcastLog();
                log.setCreateDate(new Date());
                log.setBizType(Constants.ONE);
                log.setHkDate(new Date());
                log.setObjType(Constants.ONE);
                log.setIds(device.getHkNo());
                log.setInfo(content);
                log.setNum(Constants.ONE);
                BaseResponse response = dealLedContentBiz(device.getHkNo(),content,speed,1);
                if(response == null || !StringUtils.equals(response.getCode(), HKConstants.RESPONSE_SUCCEE)){
                    log.setHkInfo("请求失败:"+JSONObject.toJSONString(response));
                    log.setHkStatus(Constants.THREE);
                }else{
                    log.setHkInfo("请求成功");
                    log.setHkStatus(Constants.TWO);
                }
                log.setDeviceType(Constants.ONE);
                log.setName("设置LED屏显内容");
                logList.add(log);
                ledList.add(device.getHkId());
            }else  if(Constants.equalsInteger(device.getType(),Constants.ZERO)){
                //如果是广播点
                broadcastList.add(device.getHkId());
            }
        }
        if(broadcastList.size()>0){
            String content1 =Constants.PlatformBroadcastContent.WRONG_IN.getInfo();
            content1 = content1.replace("${param}",model.getCarCodeFront());
            PlatformBroadcastLog log = new PlatformBroadcastLog();
            log.setCreateDate(new Date());
            log.setBizType(Constants.ONE);
            log.setHkDate(new Date());
            log.setObjType(Constants.ONE);
            log.setInfo(content1);
            log.setNum(Constants.ONE);
            log.setIds(String.join(",",broadcastList));
            CustomBroadcastRequest request = new CustomBroadcastRequest();
            request.setAudioPointIndexCode(broadcastList);
            request.setPlayDuration(15);//单位秒
            request.setBroadCastMode("tts");
            request.setPriority(1);
            request.setState(1);//播放/停止标识 1-播放,0-停止
            request.setPlayTtsContent(content);
            HKService.customBroadcast(request);
            request.setPlayTtsContent(content1);
            BaseResponse response =  HKService.customBroadcast(request);
            if(response == null || !StringUtils.equals(response.getCode(), HKConstants.RESPONSE_SUCCEE)){
                log.setHkInfo("请求失败:"+JSONObject.toJSONString(response));
                log.setHkStatus(Constants.THREE);
            }else{
                log.setHkInfo("请求成功");
                log.setHkStatus(Constants.TWO);
            }
            log.setDeviceType(Constants.ONE);
            log.setName("发送广播播报内容");
            logList.add(log);
        }
        if(logList.size()>0){
            platformBroadcastLogMapper.insert(logList);
        }
    }
    public static BaseResponse dealLedContentBiz(String hkNo, String content,int speed,int color) {
        TransparentChannelBodyRequest body = new TransparentChannelBodyRequest();
        TransparentChannelHeadRequest head = new TransparentChannelHeadRequest();
        TransparentChannelBodyParamRequest request = new TransparentChannelBodyParamRequest();
        TransparentChannelBodyRegionRequest regions = new TransparentChannelBodyRegionRequest();
        head.setAbility("cld");//固定值
        head.setTreatyType("haixuan_led_net");//固定值
        head.setDeviceIndexCode(hkNo);
        body.setMethod("ControlLedGereral");//固定值
        request.setIndexCode(hkNo);
        request.setOperationType(219);//固定值
        regions.setActionType(32);
        regions.setContent(content);
        regions.setRegionNo(1);
        regions.setRegionType(14);
        regions.setFontColor(color>0?color:1);
        regions.setCircleTimes(1);//循环次数
        regions.setFontSize(32);//
        regions.setStayTime(1);//单位??
        regions.setRegionLeftTopXPos(0);
        regions.setRegionLeftTopYPos(0);
        regions.setRegionRightBottomXPos(255);
        regions.setRegionRightBottomYPos(31);
        request.setRegions(new ArrayList<>());
        request.getRegions().add(regions);
        regions.setSpeed(speed>0?speed:13);
        body.setParams(request);
       return HKService.transparentchannel(head,body);
    }
}