feat:增加导出列装置名称

haikang
郭承 8 months ago
parent 411a933131
commit 0c71c7ea3a

@ -64,7 +64,7 @@ public class NSensorController extends BasicController {
@ApiOperation("查询全部") @ApiOperation("查询全部")
public Response<List<NSensor>> listAll(@ApiParam("主设备id") @RequestParam(value = "zsbid", required = false) Integer zsbid, public Response<List<NSensor>> listAll(@ApiParam("主设备id") @RequestParam(value = "zsbid", required = false) Integer zsbid,
@ApiParam("类型") @RequestParam(value = "typeId", required = false) Integer typeId) throws Exception { @ApiParam("类型") @RequestParam(value = "typeId", required = false) Integer typeId) throws Exception {
List<NSensor> result = service.listAll(zsbid , typeId); List<NSensor> result = service.listAll(zsbid, typeId);
return Response.success(result); return Response.success(result);
} }
@ -191,7 +191,7 @@ public class NSensorController extends BasicController {
public void exportLatest(@ApiParam("主设备id") @RequestParam(value = "zsbid", required = false) Integer zsbid, HttpServletResponse response) throws Exception { public void exportLatest(@ApiParam("主设备id") @RequestParam(value = "zsbid", required = false) Integer zsbid, HttpServletResponse response) throws Exception {
response.setContentType("application/vnd.ms-excel"); response.setContentType("application/vnd.ms-excel");
response.setCharacterEncoding("utf-8"); response.setCharacterEncoding("utf-8");
List<NSensor> result = service.listAll(zsbid , null); List<NSensor> result = service.listAll(zsbid, null);
Map<Integer, List<NSensor>> map = new HashMap<>(); Map<Integer, List<NSensor>> map = new HashMap<>();
for (NSensor nSensor : result) { for (NSensor nSensor : result) {

@ -134,6 +134,9 @@ public class ReportServiceImpl implements ReportService {
head.add("主设备名称"); head.add("主设备名称");
heads.add(head); heads.add(head);
head = new ArrayList<>(); head = new ArrayList<>();
head.add("装置名称");
heads.add(head);
head = new ArrayList<>();
head.add("时间"); head.add("时间");
heads.add(head); heads.add(head);
for (ModevTypePoint point : nSensors.get(0).getTypePoints()) { for (ModevTypePoint point : nSensors.get(0).getTypePoints()) {
@ -147,9 +150,10 @@ public class ReportServiceImpl implements ReportService {
for (NSensor nSensor : nSensors) { for (NSensor nSensor : nSensors) {
List<String> line = new ArrayList<>(); List<String> line = new ArrayList<>();
line.add(nSensor.getZsbName()); line.add(nSensor.getZsbName());
line.add(nSensor.getName());
HashMap<String, String> lastData = nSensor.getLastData(); HashMap<String, String> lastData = nSensor.getLastData();
if (null != lastData) { if (null != lastData) {
String acquisitionTime = nSensor.getLastData().get("acquisitionTime"); String acquisitionTime = lastData.get("acquisitionTime");
line.add(acquisitionTime); line.add(acquisitionTime);
for (ModevTypePoint typePoint : nSensor.getTypePoints()) { for (ModevTypePoint typePoint : nSensor.getTypePoints()) {
line.add(lastData.get(typePoint.getField())); line.add(lastData.get(typePoint.getField()));

Loading…
Cancel
Save