|
|
@ -15,6 +15,9 @@ import com.psdc.service.IPsdcDeviceService; |
|
|
|
import com.psdc.service.ISysUserService; |
|
|
|
import com.psdc.service.ISysUserService; |
|
|
|
import com.psdc.utils.SecurityUtils; |
|
|
|
import com.psdc.utils.SecurityUtils; |
|
|
|
import com.psdc.utils.poi.ExcelUtil; |
|
|
|
import com.psdc.utils.poi.ExcelUtil; |
|
|
|
|
|
|
|
import org.apache.poi.xssf.usermodel.XSSFCell; |
|
|
|
|
|
|
|
import org.apache.poi.xssf.usermodel.XSSFRow; |
|
|
|
|
|
|
|
import org.apache.poi.xssf.usermodel.XSSFSheet; |
|
|
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook; |
|
|
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.security.access.prepost.PreAuthorize; |
|
|
|
import org.springframework.security.access.prepost.PreAuthorize; |
|
|
@ -141,6 +144,8 @@ public class PsdcDeviceController extends BaseController { |
|
|
|
@Log(title = "设备管理", businessType = BusinessType.EXPORT) |
|
|
|
@Log(title = "设备管理", businessType = BusinessType.EXPORT) |
|
|
|
@RequestMapping(value = "/downloadDevTemplate", method = RequestMethod.GET) |
|
|
|
@RequestMapping(value = "/downloadDevTemplate", method = RequestMethod.GET) |
|
|
|
public void downloadTemplate(HttpServletResponse response) { |
|
|
|
public void downloadTemplate(HttpServletResponse response) { |
|
|
|
|
|
|
|
List<PsdcDevice> list = psdcDeviceService.selalldevModel(); |
|
|
|
|
|
|
|
|
|
|
|
// 获取要下载的模板名称
|
|
|
|
// 获取要下载的模板名称
|
|
|
|
String fileName = "devTemplate.xlsx"; |
|
|
|
String fileName = "devTemplate.xlsx"; |
|
|
|
// 设置要下载的文件的名称
|
|
|
|
// 设置要下载的文件的名称
|
|
|
@ -162,6 +167,21 @@ public class PsdcDeviceController extends BaseController { |
|
|
|
// row1.createCell(1).setCellValue("监测设备");
|
|
|
|
// row1.createCell(1).setCellValue("监测设备");
|
|
|
|
// row2.createCell(0).setCellValue("2");
|
|
|
|
// row2.createCell(0).setCellValue("2");
|
|
|
|
// row2.createCell(1).setCellValue("运行设备");
|
|
|
|
// row2.createCell(1).setCellValue("运行设备");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
wb.setSelectedTab(1); |
|
|
|
|
|
|
|
XSSFSheet sheet = wb.createSheet("设备模型类型表"); |
|
|
|
|
|
|
|
XSSFRow row0 = sheet.createRow(0); |
|
|
|
|
|
|
|
row0.createCell(0).setCellValue("设备模型类型Id"); |
|
|
|
|
|
|
|
row0.createCell(1).setCellValue("设备模型类型名称"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < list.size(); i++) { |
|
|
|
|
|
|
|
XSSFRow row = sheet.createRow(i + 1); |
|
|
|
|
|
|
|
XSSFCell cell = row.createCell(0); |
|
|
|
|
|
|
|
cell.setCellValue(list.get(i).getDeviceId()); |
|
|
|
|
|
|
|
XSSFCell cell1 = row.createCell(1); |
|
|
|
|
|
|
|
cell1.setCellValue(list.get(i).getDeviceModel()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
OutputStream os = new BufferedOutputStream(response.getOutputStream()); |
|
|
|
OutputStream os = new BufferedOutputStream(response.getOutputStream()); |
|
|
|
wb.write(os); |
|
|
|
wb.write(os); |
|
|
|
os.flush(); |
|
|
|
os.flush(); |
|
|
|