| | |
| | | import com.alibaba.excel.ExcelWriter; |
| | | import com.alibaba.excel.write.metadata.WriteSheet; |
| | | import com.github.pagehelper.PageHelper; |
| | | 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.ximon.admin.manager.iot.frame.inner.report.A5LightHeartbeatReportInnerFrame; |
| | |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.core.io.ClassPathResource; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.io.File; |
| | | import java.util.List; |
| | |
| | | public class LightReportDataService extends BaseServiceImpl<LightReportDataMapper, LightReportData> { |
| | | |
| | | private final FileProperties properties; |
| | | private final AliOssFileServiceImpl fileService; |
| | | |
| | | /** |
| | | * 保存上报的灯心跳数据 |
| | |
| | | PageHelper.startPage(pageNo, pageSize); |
| | | List<LightReportDataBo> list = baseMapper.listReportData(keyword, deviceCode); |
| | | |
| | | File file = new File(properties.getUploadRootPath() + "export" + File.separator + RandomUtil.randomString(12) + ".xlsx"); |
| | | File file = new File("./" + RandomUtil.randomString(12) + ".xlsx"); |
| | | // File file = new File(properties.getUploadRootPath() + "export" + File.separator + RandomUtil.randomString(12) + ".xlsx"); |
| | | // ClassPathResource cpr = new ClassPathResource("public/exportOrder.xlsx"); |
| | | // FileUtil.mkParentDirs(file); |
| | |
| | | // excelWriter.fill(list, writeSheet); |
| | | // excelWriter.finish(); |
| | | |
| | | EasyExcel.write(file, LightReportDataBo.class).sheet("单灯数据").doWrite(list); |
| | | String url = file.getPath().replace(properties.getUploadRootPath(), ""); |
| | | return ResUtils.addPrefix(url); |
| | | EasyExcel.write(file, LightReportDataBo.class).sheet("模版").doWrite(list); |
| | | |
| | | FileUploadDto fileUploadDto = fileService.uploadFile(file); |
| | | // String url = file.getPath().replace(properties.getUploadRootPath(), ""); |
| | | String url = fileUploadDto.getFileUrl(); |
| | | file.delete(); |
| | | return url; |
| | | |
| | | // return list; |
| | | } |