| | |
| | | import com.alibaba.excel.EasyExcel; |
| | | import com.alibaba.excel.ExcelWriter; |
| | | import com.alibaba.excel.write.metadata.WriteSheet; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.sandu.common.execption.BusinessException; |
| | | import com.sandu.common.file.FileUploadDto; |
| | | import com.sandu.common.file.config.FileProperties; |
| | | import com.sandu.common.file.impl.AliOssFileServiceImpl; |
| | | import com.sandu.common.service.impl.BaseServiceImpl; |
| | | import com.sandu.common.util.ResUtils; |
| | | import com.sandu.common.util.SpringContextHolder; |
| | | import com.sandu.ximon.admin.manager.iot.frame.inner.report.A5LightHeartbeatReportInnerFrame; |
| | | import com.sandu.ximon.admin.security.SecurityUtils; |
| | | import com.sandu.ximon.dao.bo.LightReportDataBo; |
| | | import com.sandu.ximon.dao.domain.LightReportData; |
| | | import com.sandu.ximon.dao.domain.Pole; |
| | | import com.sandu.ximon.dao.domain.PoleBinding; |
| | | import com.sandu.ximon.dao.mapper.LightReportDataMapper; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.SneakyThrows; |
| | |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.io.File; |
| | | import java.sql.Wrapper; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | */ |
| | | public List<LightReportDataBo> listReportData(int pageNo, int pageSize, String keyword, String deviceCode) { |
| | | PageHelper.startPage(pageNo, pageSize); |
| | | return baseMapper.listReportData(keyword, deviceCode); |
| | | //为null的话是超管 |
| | | if (SecurityUtils.getClientId() == null) { |
| | | return baseMapper.listReportData(keyword, deviceCode); |
| | | } else { |
| | | return baseMapper.listReportDataByUserid(keyword, deviceCode, SecurityUtils.getUserId()); |
| | | } |
| | | } |
| | | |
| | | @SneakyThrows |
| | | public String exportList(int pageNo, int pageSize, String keyword, String deviceCode) { |
| | | |
| | | if (SecurityUtils.getClientId() != null) { |
| | | PoleBinding one = SpringContextHolder.getBean(PoleBindingService.class).getOne(Wrappers.lambdaQuery(PoleBinding.class).eq(PoleBinding::getDeviceCode, deviceCode) |
| | | .eq(PoleBinding::getDeviceType, 0)); |
| | | if (one == null) { |
| | | throw new BusinessException("未找到绑定关系!"); |
| | | } else { |
| | | Pole pole = SpringContextHolder.getBean(PoleService.class).getOne(Wrappers.lambdaQuery(Pole.class).eq(Pole::getUserId, SecurityUtils.getUserId()).or(w -> { |
| | | w.eq(Pole::getClientId, SecurityUtils.getUserId()); |
| | | })); |
| | | if (pole == null) { |
| | | throw new BusinessException("绑定关系不正确!"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | PageHelper.startPage(pageNo, pageSize); |
| | | List<LightReportDataBo> list = baseMapper.listReportData(keyword, deviceCode); |
| | | |
| | |
| | | // String url = file.getPath().replace(properties.getUploadRootPath(), ""); |
| | | String url = fileUploadDto.getFileUrl(); |
| | | file.delete(); |
| | | return url; |
| | | return url; |
| | | |
| | | // return list; |
| | | // return list; |
| | | } |
| | | } |