|  |  |  | 
|---|
|  |  |  | 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.*; | 
|---|
|  |  |  | import com.doumee.core.model.PageData; | 
|---|
|  |  |  | import com.doumee.core.model.PageWrap; | 
|---|
|  |  |  | import com.doumee.core.haikang.model.param.request.TransparentChannelSingleRequest; | 
|---|
|  |  |  | import com.doumee.dao.business.*; | 
|---|
|  |  |  | import com.doumee.dao.business.model.*; | 
|---|
|  |  |  | import com.doumee.service.business.third.model.PageData; | 
|---|
|  |  |  | import com.doumee.service.business.third.model.PageWrap; | 
|---|
|  |  |  | 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 com.github.yulichang.wrapper.MPJLambdaWrapper; | 
|---|
|  |  |  | import lombok.extern.slf4j.Slf4j; | 
|---|
|  |  |  | 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.*; | 
|---|
|  |  |  | import java.util.stream.Collectors; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 设备信息表Service实现 | 
|---|
|  |  |  | 
|---|
|  |  |  | * @date 2023/11/30 15:33 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Service | 
|---|
|  |  |  | @Slf4j | 
|---|
|  |  |  | public class DeviceServiceImpl implements DeviceService { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private DeviceMapper deviceMapper; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private PlatformMapper platformMapper; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private PlatformDeviceMapper platformDeviceMapper; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private SystemDictDataBiz systemDictDataBiz; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | 
|---|
|  |  |  | wrapper.select(Device::getId, Device::getName, Device::getDoorName,Device::getRegionPathName, Device::getRegionName); | 
|---|
|  |  |  | wrapper.eq(null != param.getType(),Device::getType,param.getType()) | 
|---|
|  |  |  | .eq(null !=param.getIsdeleted(),Device::getIsdeleted,param.getIsdeleted()) | 
|---|
|  |  |  | .eq(Objects.isNull(param.getIsdeleted()),Device::getIsdeleted,Constants.ZERO) | 
|---|
|  |  |  | .eq(null != param.getHkStatus(),Device::getHkStatus,param.getHkStatus()); | 
|---|
|  |  |  | return deviceMapper.selectList(wrapper); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | throw  new BusinessException(ResponseStatus.SERVER_ERROR.getCode(), "对不起,屏幕内容设置失败"+(log!=null?log.getHkInfo():"")); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public void allLedDefualtContent() { | 
|---|
|  |  |  | log.error( "屏幕内容设置=======================开始========" ); | 
|---|
|  |  |  | int speed = 13; | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | speed = Integer.parseInt(systemDictDataBiz.queryByCode(Constants.HK_PARAM,Constants.LED_CONTENT_SPEED).getCode()); | 
|---|
|  |  |  | }catch (Exception e){ | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //所有月台关联设备信息 | 
|---|
|  |  |  | List<PlatformDevice> list =  platformDeviceMapper.selectList(new MPJLambdaWrapper<PlatformDevice>(). | 
|---|
|  |  |  | selectAll(PlatformDevice.class) | 
|---|
|  |  |  | .selectAs(Platform::getLedContent,PlatformDevice::getLedContent) | 
|---|
|  |  |  | .leftJoin(Platform.class,Platform::getId,PlatformDevice::getPlatformId) | 
|---|
|  |  |  | .eq(PlatformDevice::getType,Constants.ZERO) | 
|---|
|  |  |  | .eq(PlatformDevice::getIsdeleted,Constants.ZERO) | 
|---|
|  |  |  | .eq(Platform::getIsdeleted,Constants.ZERO) | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | if(list==null || list.size()==0){ | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | for(PlatformDevice device :list){ | 
|---|
|  |  |  | 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()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | log.error( "屏幕内容设置=======================结束========" ); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|