| | |
| | | package com.sandu.ximon.admin.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.sandu.common.execption.BusinessException; |
| | | import com.sandu.common.service.impl.BaseServiceImpl; |
| | | import com.sandu.ximon.admin.param.LEDProgramParam; |
| | | import com.sandu.ximon.admin.security.SecurityUtils; |
| | | import com.sandu.ximon.dao.domain.LEDProgram; |
| | | import com.sandu.ximon.dao.enums.AdministratorEnums; |
| | | import com.sandu.ximon.dao.mapper.LEDProgramMapper; |
| | | import lombok.AllArgsConstructor; |
| | | import nova.traffic.utils.NovaTraffic; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | @Service |
| | |
| | | private final LEDProgramMapper ledProgramMapper; |
| | | |
| | | public boolean addProgram(LEDProgramParam receiveParam) { |
| | | // public boolean addProgram(String name,Integer kind,String url ) { |
| | | |
| | | LEDProgram led = new LEDProgram(); |
| | | if (AdministratorEnums.CUSTOMER.getCode().equals(SecurityUtils.getClientId())) { |
| | | led.setUserId(SecurityUtils.getUserId()); |
| | | } |
| | | led.setUserId(SecurityUtils.getClientId()); |
| | | led.setPixel(receiveParam.getPixel()); |
| | | led.setSize(receiveParam.getSize()); |
| | | led.setName(receiveParam.getName()); |
| | | led.setKind(receiveParam.getKind()); |
| | | led.setProgramBase64(receiveParam.getProgramBase64()); |
| | | /* LEDProgram led = new LEDProgram(); |
| | | led.setUserId(SecurityUtils.getClientId()); |
| | | led.setName(name); |
| | | led.setKind(kind); |
| | | led.setProgramBase64(url);*/ |
| | | |
| | | return save(led); |
| | | } |
| | |
| | | |
| | | LEDProgram led = new LEDProgram(); |
| | | led.setId(receiveParam.getId()); |
| | | led.setUserId(SecurityUtils.getClientId()); |
| | | //led.setUserId(SecurityUtils.getClientId()); |
| | | led.setPixel(receiveParam.getPixel()); |
| | | led.setSize(receiveParam.getSize()); |
| | | led.setName(receiveParam.getName()); |
| | | led.setKind(receiveParam.getKind()); |
| | | if (receiveParam.getPixel() != null) { |
| | | led.setPixel(receiveParam.getPixel()); |
| | | } |
| | | if (receiveParam.getSize() != null) { |
| | | led.setSize(receiveParam.getSize()); |
| | | } |
| | | led.setProgramBase64(receiveParam.getProgramBase64()); |
| | | return updateById(led); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | public LambdaQueryWrapper<LEDProgram> listProgram() { |
| | | // LambdaQueryWrapper<LEDProgram> wrapper= new LambdaQueryWrapper<>(); |
| | | /* if(SecurityUtils.getClientId()!=null){ |
| | | return list(Wrappers.lambdaQuery(LEDProgram.class).eq(LEDProgram::getUserId, SecurityUtils.getClientId())); |
| | | }else { |
| | | return list(Wrappers.lambdaQuery(LEDProgram.class)); |
| | | }*/ |
| | | if(SecurityUtils.getClientId()!=null){ |
| | | return Wrappers.lambdaQuery(LEDProgram.class).eq(LEDProgram::getUserId,SecurityUtils.getClientId()); |
| | | }else { |
| | | return Wrappers.lambdaQuery(LEDProgram.class); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | public void NovaTraffic(String ip, int port){ |
| | | NovaTraffic novaTraffic = new NovaTraffic("192.168.0.220", 5000); |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | } |