| | |
| | | import com.sandu.ximon.dao.domain.LEDProgram; |
| | | import com.sandu.ximon.dao.mapper.LEDProgramMapper; |
| | | import lombok.AllArgsConstructor; |
| | | import nova.traffic.utils.NovaTraffic; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | @Service |
| | | @AllArgsConstructor |
| | | public class LEDProgramService extends BaseServiceImpl<LEDProgramMapper, LEDProgram> { |
| | | |
| | | private final LEDProgramMapper ledProgramMapper; |
| | | |
| | | |
| | | public boolean addProgram(LEDProgramParam receiveParam) { |
| | | |
| | | LEDProgram led = new LEDProgram(); |
| | | led.setUserId(SecurityUtils.getClientId()); |
| | | led.setPixel(receiveParam.getPixel()); |
| | | led.setSize(receiveParam.getSize()); |
| | | if (SecurityUtils.getClientId() != null) { |
| | | led.setUserName(SecurityUtils.getUsername()); |
| | | } |
| | | led.setName(receiveParam.getName()); |
| | | led.setKind(receiveParam.getKind()); |
| | | led.setProgramBase64(receiveParam.getProgramBase64()); |
| | | |
| | | led.setPreview(receiveParam.getPreviewUrl()); |
| | | led.setPages(receiveParam.getPages()); |
| | | return save(led); |
| | | } |
| | | |
| | | |
| | | public boolean updateProgram(LEDProgramParam receiveParam) { |
| | | public boolean updateProgram(Long pid,LEDProgramParam receiveParam) { |
| | | |
| | | LEDProgram byId = getById(receiveParam.getId()); |
| | | LEDProgram byId = getById(pid); |
| | | if (byId == null) { |
| | | throw new BusinessException("未找到该节目"); |
| | | } |
| | | |
| | | LEDProgram led = new LEDProgram(); |
| | | led.setId(receiveParam.getId()); |
| | | led.setId(pid); |
| | | //led.setUserId(SecurityUtils.getClientId()); |
| | | led.setPixel(receiveParam.getPixel()); |
| | | led.setSize(receiveParam.getSize()); |
| | | led.setName(receiveParam.getName()); |
| | | led.setKind(receiveParam.getKind()); |
| | | led.setProgramBase64(receiveParam.getProgramBase64()); |
| | | led.setPreview(receiveParam.getPreviewUrl()); |
| | | led.setPages(receiveParam.getPages()); |
| | | 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); |
| | | 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); |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | } |