|  |  | 
 |  |  | package com.doumee.service.business.impl; | 
 |  |  |  | 
 |  |  | 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.AcsDeviceListRequest; | 
 |  |  | import com.doumee.core.haikang.model.param.respose.AcsDeviceInfoResponse; | 
 |  |  | import com.doumee.core.haikang.model.param.respose.AcsDeviceListResponse; | 
 |  |  | import com.doumee.core.haikang.service.HKService; | 
 |  |  | import com.doumee.core.model.PageData; | 
 |  |  | import com.doumee.core.model.PageWrap; | 
 |  |  | import com.doumee.core.haikang.model.param.request.TransparentChannelSingleRequest; | 
 |  |  | 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.model.Company; | 
 |  |  | import com.doumee.dao.business.PlatformBroadcastLogMapper; | 
 |  |  | import com.doumee.dao.business.model.Device; | 
 |  |  | import com.doumee.dao.business.model.Retention; | 
 |  |  | 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 org.apache.commons.lang3.StringUtils; | 
 |  |  | import com.doumee.service.business.impl.hksync.HkSyncPushServiceImpl; | 
 |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
 |  |  | import org.springframework.scheduling.annotation.Async; | 
 |  |  | import org.springframework.stereotype.Service; | 
 |  |  | import org.springframework.util.CollectionUtils; | 
 |  |  |  | 
 |  |  | import java.util.ArrayList; | 
 |  |  | import java.util.Date; | 
 |  |  | import java.util.List; | 
 |  |  | import java.util.Objects; | 
 |  |  | import java.util.*; | 
 |  |  |  | 
 |  |  | /** | 
 |  |  |  * 设备信息表Service实现 | 
 |  |  | 
 |  |  |  | 
 |  |  |     @Autowired | 
 |  |  |     private DeviceMapper deviceMapper; | 
 |  |  |     @Autowired | 
 |  |  |     private SystemDictDataBiz systemDictDataBiz; | 
 |  |  |     @Autowired | 
 |  |  |     private PlatformBroadcastLogMapper platformBroadcastLogMapper; | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     @Override | 
 |  |  | 
 |  |  |     public List<Device> findIdAndNameList(Device param) { | 
 |  |  |         LambdaQueryWrapper<Device> wrapper = new LambdaQueryWrapper<>(param); | 
 |  |  |         wrapper.select(Device::getId, Device::getName, Device::getDoorName,Device::getRegionPathName, Device::getRegionName); | 
 |  |  |         if(null != param.getType() && null != param.getIsdeleted() && null != param.getHkStatus()) { | 
 |  |  |             wrapper.eq(Device::getType,param.getType()) | 
 |  |  |                    .eq(Device::getIsdeleted,param.getIsdeleted()) | 
 |  |  |                    .eq(Device::getHkStatus,param.getHkStatus()); | 
 |  |  |         } | 
 |  |  |         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); | 
 |  |  |     } | 
 |  |  |    | 
 |  |  | 
 |  |  |     public PageData<Device> findPage(PageWrap<Device> pageWrap) { | 
 |  |  |         IPage<Device> page = new Page<>(pageWrap.getPage(), pageWrap.getCapacity()); | 
 |  |  |         QueryWrapper<Device> queryWrapper = new QueryWrapper<>(); | 
 |  |  |         pageWrap.getModel().setIsdeleted(Constants.ZERO); | 
 |  |  |         Utils.MP.blankToNull(pageWrap.getModel()); | 
 |  |  |         if (pageWrap.getModel().getId() != null) { | 
 |  |  |             queryWrapper.lambda().eq(Device::getId, pageWrap.getModel().getId()); | 
 |  |  | 
 |  |  |         return deviceMapper.selectCount(wrapper); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @Override | 
 |  |  |     public void setLedContent(TransparentChannelSingleRequest model) { | 
 |  |  |         Device device = findById(model.getDeviceId()); | 
 |  |  |         if(device == null | 
 |  |  |                 || Constants.equalsInteger(device.getIsdeleted(),Constants.ONE) | 
 |  |  |                 || !Constants.equalsInteger(device.getType(),Constants.TWO)){ | 
 |  |  |             throw new BusinessException(ResponseStatus.DATA_EMPTY); | 
 |  |  |         } | 
 |  |  |         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); | 
 |  |  |         } | 
 |  |  |         PlatformBroadcastLog log  =  HkSyncPushServiceImpl.dealLedContentBiz(0,device.getNo(),device.getName(),model.getContent(),model.getSpeed(),1); | 
 |  |  |         platformBroadcastLogMapper.insert(log); | 
 |  |  |         if(log.getHkStatus() == null || !Constants.equalsInteger(log.getHkStatus(), Constants.TWO)){ | 
 |  |  |             throw  new BusinessException(ResponseStatus.SERVER_ERROR.getCode(), "对不起,屏幕内容设置失败"+(log!=null?log.getHkInfo():"")); | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  | } |