| | |
| | | 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; |
| | | import com.doumee.core.haikang.model.param.BaseResponse; |
| | | import com.doumee.core.haikang.model.param.request.CustomBroadcastRequest; |
| | | import com.doumee.core.haikang.model.param.request.TransparentChannelSingleRequest; |
| | | import com.doumee.core.haikang.service.HKService; |
| | | import com.doumee.dao.business.*; |
| | | import com.doumee.dao.business.model.*; |
| | | import com.doumee.service.business.third.model.LoginUserInfo; |
| | | import com.doumee.service.business.third.model.PageData; |
| | | import com.doumee.service.business.third.model.PageWrap; |
| | | import com.doumee.core.utils.Constants; |
| | |
| | | |
| | | |
| | | @Override |
| | | public Integer create(Device device) { |
| | | deviceMapper.insert(device); |
| | | return device.getId(); |
| | | public Integer create(Device model) { |
| | | model.setCreator(model.getLoginUserInfo().getId()+""); |
| | | model.setEdirot(model.getCreator()); |
| | | model.setIsdeleted(Constants.ZERO); |
| | | model.setEditDate(new Date()); |
| | | model.setCreateDate(model.getEditDate()); |
| | | deviceMapper.insert(model); |
| | | return model.getId(); |
| | | } |
| | | |
| | | @Override |
| | | public void deleteById(Integer id) { |
| | | deviceMapper.deleteById(id); |
| | | public void deleteById(Integer id, LoginUserInfo userInfo) { |
| | | Device update = new Device(); |
| | | update.setEdirot(userInfo.getId()+""); |
| | | update.setEditDate(new Date()); |
| | | update.setIsdeleted(Constants.ONE); |
| | | update.setId(id); |
| | | deviceMapper.updateById(update); |
| | | } |
| | | |
| | | @Override |
| | |
| | | } |
| | | |
| | | @Override |
| | | public void deleteByIdInBatch(List<Integer> ids) { |
| | | public void deleteByIdInBatch(List<Integer> ids, LoginUserInfo userInfo) { |
| | | if (CollectionUtils.isEmpty(ids)) { |
| | | return; |
| | | } |
| | | deviceMapper.deleteBatchIds(ids); |
| | | for(Integer id :ids){ |
| | | deleteById(id,userInfo); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void updateById(Device device) { |
| | | device.setEdirot(device.getLoginUserInfo().getId()+""); |
| | | device.setEditDate(new Date()); |
| | | deviceMapper.updateById(device); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | @Override |
| | | public void setBroadcaseBobao(Device model){ |
| | | List<String> ids = new ArrayList<>(); |
| | | ids.add(model.getHkId()); |
| | | CustomBroadcastRequest request = new CustomBroadcastRequest(); |
| | | request.setAudioPointIndexCode(ids); |
| | | request.setPlayDuration(15);//单位秒 |
| | | request.setBroadCastMode("tts"); |
| | | request.setPriority(1); |
| | | request.setState(1);//播放/停止标识 1-播放,0-停止 |
| | | request.setPlayTtsContent(model.getSendInfo()); |
| | | BaseResponse response = HKService.customBroadcast(request); |
| | | if(response == null || !StringUtils.equals(response.getCode(), HKConstants.RESPONSE_SUCCEE)){ |
| | | throw new BusinessException(ResponseStatus.SERVER_ERROR.getCode(),"发送失败:"+ JSONObject.toJSONString(response)); |
| | | } |
| | | } |
| | | @Override |
| | | public void setLedContent(TransparentChannelSingleRequest model) { |
| | | Device device = findById(model.getDeviceId()); |
| | | if(device == null |
| | |
| | | } |
| | | } |
| | | @Override |
| | | public void setAllLedDefualtContent() { |
| | | public void allLedDefualtContent() { |
| | | log.error( "屏幕内容设置=======================开始========" ); |
| | | int speed = 13; |
| | | try { |
| | | speed = Integer.parseInt(systemDictDataBiz.queryByCode(Constants.HK_PARAM,Constants.LED_CONTENT_SPEED).getCode()); |
| | |
| | | } |
| | | //所有月台关联设备信息 |
| | | List<PlatformDevice> list = platformDeviceMapper.selectList(new MPJLambdaWrapper<PlatformDevice>(). |
| | | selectAll(PlatformDevice.class) |
| | | selectAll(PlatformDevice.class) |
| | | .selectAs(Platform::getLedContent,PlatformDevice::getLedContent) |
| | | .leftJoin(Platform.class,Platform::getId,PlatformDevice::getPlatformId) |
| | | .eq(PlatformDevice::getType,Constants.ZERO) |
| | |
| | | return; |
| | | } |
| | | for(PlatformDevice device :list){ |
| | | String content = device.getLedContent(); |
| | | if(StringUtils.isBlank(content)){ |
| | | continue; |
| | | try { |
| | | String content = device.getLedContent(); |
| | | if(StringUtils.isBlank(content)){ |
| | | continue; |
| | | } |
| | | PlatformBroadcastLog log1 = HkSyncPushServiceImpl.dealLedContentBiz(0,device.getHkNo(),device.getName(),content,speed,1); |
| | | platformBroadcastLogMapper.insert(log1); |
| | | if(log1.getHkStatus() == null || !Constants.equalsInteger(log1.getHkStatus(), Constants.TWO)){ |
| | | log.error( "对不起,屏幕内容设置失败"+(log1!=null?log1.getHkInfo():"")); |
| | | } |
| | | }catch (Exception e){ |
| | | log.error( "对不起,屏幕内容设置异常"+ device.getName()); |
| | | } |
| | | PlatformBroadcastLog log1 = HkSyncPushServiceImpl.dealLedContentBiz(device.getPlatformId(),device.getHkNo(),device.getName(),content,speed,1); |
| | | platformBroadcastLogMapper.insert(log1); |
| | | if(log1.getHkStatus() == null || !Constants.equalsInteger(log1.getHkStatus(), Constants.TWO)){ |
| | | log.error( "对不起,屏幕内容设置失败"+(log1!=null?log1.getHkInfo():"")); |
| | | } |
| | | |
| | | } |
| | | log.error( "屏幕内容设置=======================结束========" ); |
| | | } |
| | | } |