|
@@ -339,10 +339,13 @@ public class DeviceServiceImpl extends AbstractCrudService<DeviceMapper, Device>
|
|
|
ExportParams params = new ExportParams(null, "通信设备列表");
|
|
|
workbook = ExcelExportUtil.exportBigExcel(params, DeviceExportVO.class,
|
|
|
(o, i) -> {
|
|
|
-
|
|
|
Page<Device> page = new Page<>(i, 30);
|
|
|
LambdaQueryWrapper<Device> queryWrapper = Wrappers.lambdaQuery();
|
|
|
- queryWrapper.eq(Device::getSiteId, siteId).eq(Device::getEnable, 1);
|
|
|
+ queryWrapper.eq(Device::getEnable, 1);
|
|
|
+ if (siteId!=0){
|
|
|
+ queryWrapper.eq(Device::getSiteId, siteId);
|
|
|
+ }
|
|
|
+
|
|
|
if (deviceType != 0) {
|
|
|
queryWrapper.eq(Device::getDeviceType, deviceType);
|
|
|
}
|
|
@@ -377,6 +380,41 @@ public class DeviceServiceImpl extends AbstractCrudService<DeviceMapper, Device>
|
|
|
return file.getName();
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public String correspondDeviceExport(String deviceName) {
|
|
|
+ Workbook workbook = null;
|
|
|
+ File file = null;
|
|
|
+ try {
|
|
|
+ ExportParams params = new ExportParams(null, "通信设备列表");
|
|
|
+ workbook = ExcelExportUtil.exportBigExcel(params, CorrespondDeviceExportVO.class,
|
|
|
+ (o, i) -> {
|
|
|
+ int startCurrent = (i - 1) * 30;
|
|
|
+ List<CorrespondDeviceVO> correspondDeviceList = baseMapper.CorrespondDeviceList(deviceName, startCurrent, 30);
|
|
|
+ return new ArrayList<>(BeanMapperUtils.mapList(correspondDeviceList, CorrespondDeviceVO.class, CorrespondDeviceExportVO.class));
|
|
|
+ }, null);
|
|
|
+ if (null != workbook) {
|
|
|
+ file = FileUtils.getFile(GlobalUtils.getTempBaseDir(), String.format("%s-%s.xlsx", "通信设备列表", System.currentTimeMillis() + ""));
|
|
|
+ FileUtils.createFile(file.getAbsolutePath());
|
|
|
+ FileOutputStream allListingFileOutputStream = new FileOutputStream(file);
|
|
|
+ workbook.write(allListingFileOutputStream);
|
|
|
+ } else {
|
|
|
+ throw new BusinessException("表格数据为空");
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("导出文件失败", e);
|
|
|
+ throw new BusinessException("导出文件失败");
|
|
|
+ } finally {
|
|
|
+ if (workbook != null) {
|
|
|
+ try {
|
|
|
+ workbook.close();
|
|
|
+ } catch (IOException e) {
|
|
|
+ log.error("===export spec=== 关闭workbook失败", e);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return file.getName();
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
@Override
|
|
|
public void deviceImport(MultipartFile multipartFile) throws Exception {
|