| | |
| | | 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.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实现 |
| | |
| | | |
| | | @Autowired |
| | | private DeviceMapper deviceMapper; |
| | | @Autowired |
| | | private SystemDictDataBiz systemDictDataBiz; |
| | | @Autowired |
| | | private PlatformBroadcastLogMapper platformBroadcastLogMapper; |
| | | |
| | | |
| | | @Override |
| | |
| | | || !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()); |
| | |
| | | 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():"")); |
| | | } |