| | |
| | | private SystemDictDataBiz systemDictDataBiz; |
| | | @Autowired |
| | | private PlatformBroadcastLogMapper platformBroadcastLogMapper; |
| | | @Autowired |
| | | private InterfaceLogMapper interfaceLogMapper; |
| | | |
| | | |
| | | @Override |
| | |
| | | |
| | | @Override |
| | | public List<Device> findList(Device device) { |
| | | device.setIsdeleted(Constants.ZERO); |
| | | QueryWrapper<Device> wrapper = new QueryWrapper<>(device); |
| | | return deviceMapper.selectList(wrapper); |
| | | } |
| | |
| | | } |
| | | @Override |
| | | public String setBroadcaseBobaoHttp(Device param){ |
| | | /* Device model = deviceMapper.selectById(param.getId()); |
| | | Device model = deviceMapper.selectById(param.getId()); |
| | | if(model ==null && Constants.equalsInteger(param.getType(),Constants.FOUR)){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY); |
| | | } |
| | | String input = ""; |
| | | JSONObject objext = new JSONObject(); |
| | | |
| | | model.setSendInfo(param.getSendInfo()); |
| | | return sendBroadcaseBobaoHttpBiz(model,interfaceLogMapper); |
| | | } |
| | | public static String sendBroadcaseBobaoHttpBiz(Device model,InterfaceLogMapper interfaceLogMapper){ |
| | | //重新下发计划 |
| | | JSONObject jsonObject = new JSONObject(); |
| | | //第一层 |
| | | JSONArray firstJsonArray = new JSONArray(); |
| | | JSONObject downJson = new JSONObject(); |
| | | downJson.put("terminalID",1); |
| | | //不填默认对所有通道下发 |
| | | JSONArray audioJsonArray = new JSONArray(); |
| | | audioJsonArray.add(1); |
| | | downJson.put("audioOutID",audioJsonArray); |
| | | firstJsonArray.add(downJson); |
| | | jsonObject.put("TerminalInfoList",firstJsonArray); |
| | | //第一层数组 |
| | | JSONArray allJsonArray = new JSONArray(); |
| | | //数组中对象 |
| | | for (WaterTimingBroadcastDO waterTimingBroadcastDO : searchList) { |
| | | JSONObject downArrayData = new JSONObject(); |
| | | downArrayData.put("audioOutID",audioJsonArray); |
| | | downArrayData.put("enabled",true); |
| | | downArrayData.put("planSchemeID",waterTimingBroadcastDO.getName()); |
| | | JSONObject executeJson = new JSONObject(); |
| | | executeJson.put("startTime", getDateStringByZones(waterTimingBroadcastDO.getStartDate())); |
| | | executeJson.put("stopTime",getDateStringByZones(waterTimingBroadcastDO.getEndDate())); |
| | | if (Constant.ONE.equals(waterTimingBroadcastDO.getPeriodType())){ |
| | | //日计划 |
| | | JSONArray executeJsonArray = new JSONArray(); |
| | | JSONObject executeJsonDataItem = new JSONObject(); |
| | | executeJsonDataItem.put("beginTime",waterTimingBroadcastDO.getStartTime()+"+08:00"); |
| | | executeJsonDataItem.put("endTime",waterTimingBroadcastDO.getEndTime()+"+08:00"); |
| | | executeJsonDataItem.put("playMode","loop"); |
| | | executeJsonDataItem.put("playNowTime",""); |
| | | executeJsonDataItem.put("planSchemeExecID",0); |
| | | JSONObject secondDownOperationJson = new JSONObject(); |
| | | if (Constant.ONE.equals(waterTimingBroadcastDO.getContentType())){ |
| | | //文本 |
| | | secondDownOperationJson.put("audioSource","speechSynthesis"); |
| | | secondDownOperationJson.put("speechSynthesisContent",waterTimingBroadcastDO.getContent()); |
| | | }else if (Constant.TWO.equals(waterTimingBroadcastDO.getContentType())){ |
| | | //音频 |
| | | secondDownOperationJson.put("audioSource","customAudio"); |
| | | String json = waterTimingBroadcastDO.getJson(); |
| | | JSONObject jsonData = JSONObject.parseObject(json); |
| | | List<Integer> hkAudioIds = new ArrayList<>(); |
| | | hkAudioIds.add(jsonData.getIntValue(waterDeviceDO.getIp())); |
| | | secondDownOperationJson.put("customAudioID",hkAudioIds); |
| | | } |
| | | secondDownOperationJson.put("audioLevel",5); |
| | | //语言类型 |
| | | secondDownOperationJson.put("TTSLanguageType","chinese"); |
| | | secondDownOperationJson.put("voiceType","female"); |
| | | secondDownOperationJson.put("audioVolume",100); |
| | | executeJsonDataItem.put("Operation",secondDownOperationJson); |
| | | executeJsonArray.add(executeJsonDataItem); |
| | | executeJson.put("dailyScheduleList",executeJsonArray); |
| | | }else { |
| | | //周计划 |
| | | JSONArray executeJsonArray = new JSONArray(); |
| | | List<String> executeTime = new ArrayList<>(); |
| | | if (Constant.ONE.equals(waterTimingBroadcastDO.getPeriodType())){ |
| | | //日计划 循环一次 |
| | | executeTime.add("1"); |
| | | }else if (Constant.TWO.equals(waterTimingBroadcastDO.getPeriodType())){ |
| | | //周计划多一个周几 |
| | | executeTime = Arrays.asList(waterTimingBroadcastDO.getExecuteTime().split(",")); |
| | | } |
| | | for (String s : executeTime) { |
| | | JSONObject executeJsonData = new JSONObject(); |
| | | if (Constant.TWO.equals(waterTimingBroadcastDO.getPeriodType())){ |
| | | //周计划多一个周几 |
| | | executeJsonData.put("dayOfWeek",Integer.parseInt(s)); |
| | | } |
| | | JSONArray executeJsonDataArray = new JSONArray(); |
| | | JSONObject executeJsonDataItem = new JSONObject(); |
| | | executeJsonDataItem.put("beginTime",waterTimingBroadcastDO.getStartTime()+"+08:00"); |
| | | executeJsonDataItem.put("endTime",waterTimingBroadcastDO.getEndTime()+"+08:00"); |
| | | executeJsonDataItem.put("playMode","loop"); |
| | | executeJsonDataItem.put("playNowTime",""); |
| | | executeJsonDataItem.put("planSchemeExecID",0); |
| | | JSONObject secondDownOperationJson = new JSONObject(); |
| | | if (Constant.ONE.equals(waterTimingBroadcastDO.getContentType())){ |
| | | //文本 |
| | | secondDownOperationJson.put("audioSource","speechSynthesis"); |
| | | secondDownOperationJson.put("speechSynthesisContent",waterTimingBroadcastDO.getContent()); |
| | | }else if (Constant.TWO.equals(waterTimingBroadcastDO.getContentType())){ |
| | | //音频 |
| | | secondDownOperationJson.put("audioSource","customAudio"); |
| | | String json = waterTimingBroadcastDO.getJson(); |
| | | JSONObject jsonData = JSONObject.parseObject(json); |
| | | List<Integer> hkAudioIds = new ArrayList<>(); |
| | | hkAudioIds.add(jsonData.getIntValue(waterDeviceDO.getIp())); |
| | | secondDownOperationJson.put("customAudioID",hkAudioIds); |
| | | } |
| | | secondDownOperationJson.put("audioLevel",5); |
| | | //语言类型 |
| | | secondDownOperationJson.put("TTSLanguageType","chinese"); |
| | | secondDownOperationJson.put("voiceType","female"); |
| | | secondDownOperationJson.put("audioVolume",10); |
| | | executeJsonDataItem.put("Operation",secondDownOperationJson); |
| | | executeJsonDataArray.add(executeJsonDataItem); |
| | | executeJsonData.put("scheduleList",executeJsonDataArray); |
| | | executeJsonArray.add(executeJsonData); |
| | | jsonObject.put("command","start"); |
| | | jsonObject.put("TTSContent",model.getSendInfo()); |
| | | jsonObject.put("audioLevel",6); |
| | | jsonObject.put("audioVolume",100); |
| | | jsonObject.put("TTSLanguageType","chinese"); |
| | | jsonObject.put("voiceType","female"); |
| | | jsonObject.put("pace",50); |
| | | JSONArray a = new JSONArray(); |
| | | a.add(1); |
| | | jsonObject.put("audioOutID",a); |
| | | String params =jsonObject.toJSONString(); |
| | | log.error("========海康广播播放入参内容 : " + params); |
| | | String result = HttpsUtil.doPutHk(model.getIp(),Integer.parseInt(StringUtils.defaultString(model.getPort(),"80")),model.getDoorId(), model.getDoorName() |
| | | ,"/ISAPI/AccessControl/EventCardLinkageCfg/TTSAudio?format=json",params); |
| | | log.error("========海康广播播放返回内容 : " + result); |
| | | |
| | | } |
| | | executeJson.put("weeklyScheduleList",executeJsonArray); |
| | | } |
| | | |
| | | if (Constant.ONE.equals(waterTimingBroadcastDO.getPeriodType())){ |
| | | //日计划 |
| | | downArrayData.put("dailyScheduleInfo",executeJson); |
| | | }else { |
| | | //周计划 |
| | | downArrayData.put("weklyScheduleInfo",executeJson); |
| | | } |
| | | allJsonArray.add(downArrayData); |
| | | JSONObject resultJson = JSONObject.parseObject(result); |
| | | Boolean success = false; |
| | | if(Constants.equalsInteger(resultJson.getInteger("statusCode"),Constants.ONE)){ |
| | | success = true; |
| | | } |
| | | jsonObject.put("broadcastPlanSchemeList",allJsonArray); |
| | | log.info("海康播放计划下发入参内容 : " + jsonObject); |
| | | InterfaceLog log = new InterfaceLog(); |
| | | log.setCreateDate(new Date()); |
| | | log.setUrl("/ISAPI/AccessControl/EventCardLinkageCfg/TTSAudio?format=json"); |
| | | log.setEditDate(log.getCreateDate()); |
| | | log.setPlat(Constants.ZERO); |
| | | log.setName("海康广播播放"); |
| | | log.setIsdeleted(Constants.ZERO); |
| | | log.setRequest(params); |
| | | log.setType(Constants.ZERO); |
| | | log.setSuccess(success?Constants.ZERO:Constants.ONE); |
| | | log.setRepose(result); |
| | | interfaceLogMapper.insert(log); |
| | | |
| | | String result = HttpsUtil.doPostHk(param.getIp(),Integer.parseInt(StringUtils.defaultString(param.getPort(),"80")) |
| | | ,"/ISAPI/VideoIntercom/broadcast/AddPlanScheme?format=json",param.getDoorId(), param.getDoorName(),jsonObject.toJSONString()); |
| | | return result;*/ |
| | | return null; |
| | | |
| | | return result; |
| | | } |
| | | @Override |
| | | public void setLedContent(TransparentChannelSingleRequest model) { |
| | |
| | | }catch (Exception e){ |
| | | log.error( "对不起,屏幕内容设置异常"+ device.getName()); |
| | | } |
| | | |
| | | } |
| | | log.error( "屏幕内容设置=======================结束========" ); |
| | | } |