| | |
| | | package com.sandu.ximon.admin.service; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | 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.LEDProgramFileParam; |
| | | import com.sandu.ximon.admin.security.SecurityUtils; |
| | | import com.sandu.ximon.admin.utils.StoreOperationRecordsUtils; |
| | | import com.sandu.ximon.dao.domain.LEDProgramFile; |
| | | import com.sandu.ximon.dao.mapper.LEDProgramFileMapper; |
| | | import lombok.AllArgsConstructor; |
| | |
| | | public boolean addProgramFile(LEDProgramFileParam param) { |
| | | LEDProgramFile file = new LEDProgramFile(); |
| | | BeanUtils.copyProperties(param, file); |
| | | file.setUserId(SecurityUtils.getClientId()); |
| | | if (SecurityUtils.getClientId() != null) { |
| | | file.setUserId(SecurityUtils.getUserId()); |
| | | file.setUserName(SecurityUtils.getUsername()); |
| | | if (clientService.findClientId()) { |
| | | file.setClientId(clientService.getClientId()); |
| | | } |
| | | } |
| | | // if("mp4".equals(fileUploadDto.getFileType())){ |
| | | // fileUploadDto.setScreenShot(fileUploadDto.getFileUrl()+"?x-oss-process=video/snapshot,t_10000,m_fast"); |
| | | // } |
| | | |
| | | /** |
| | | * 诺瓦文件新增 日志记录开始 |
| | | */ |
| | | String content = "文件内容:"+ JSON.toJSONString(file); |
| | | StoreOperationRecordsUtils.storeOperationData(null, null, "诺瓦文件新增", content); |
| | | /** |
| | | * 诺瓦文件新增 日志记录结束 |
| | | */ |
| | | return save(file); |
| | | } |
| | | |
| | |
| | | if (byId == null) { |
| | | throw new BusinessException("未找到该节目"); |
| | | } |
| | | /** |
| | | * 诺瓦文件删除 日志记录开始 |
| | | */ |
| | | String content = "文件id:"+id+"文件内容:"+ JSON.toJSONString(byId); |
| | | StoreOperationRecordsUtils.storeOperationData(null, null, "诺瓦文件删除", content); |
| | | /** |
| | | * 诺瓦文件删除 日志记录结束 |
| | | */ |
| | | return removeById(id); |
| | | } |
| | | |
| | | public LambdaQueryWrapper<LEDProgramFile> listFile(){ |
| | | public LambdaQueryWrapper<LEDProgramFile> listFile() { |
| | | LambdaQueryWrapper<LEDProgramFile> ledProgramFileLambdaQueryWrapper = Wrappers.lambdaQuery(LEDProgramFile.class); |
| | | if(SecurityUtils.getClientId()!=null){ |
| | | return ledProgramFileLambdaQueryWrapper.eq(LEDProgramFile::getUserId,SecurityUtils.getUserId()); |
| | | }else { |
| | | if (SecurityUtils.getClientId() != null) { |
| | | return ledProgramFileLambdaQueryWrapper.eq(LEDProgramFile::getUserId, SecurityUtils.getUserId()).or(w -> { |
| | | w.eq(LEDProgramFile::getClientId, SecurityUtils.getUserId()); |
| | | }); |
| | | } else { |
| | | return ledProgramFileLambdaQueryWrapper; |
| | | } |
| | | |