|
@@ -199,41 +199,76 @@ public class DeviceServiceImpl implements DeviceService {
|
|
|
String title = "设备列表";
|
|
|
//判断是否是水表场景
|
|
|
WMeterType wMeterType = wMeterTypeMapper.getChannelIdAndLevel(sysId, 2);
|
|
|
+ Channel channel = channelMapper.findById(sysId);
|
|
|
if (wMeterType != null || sysId == -99) {
|
|
|
- DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
|
|
- String[] rowsName = new String[]{"序号", "设备状态", "设备编号", "水表档案编号", "水表电子号", "集中器编码", "采集器编码", "水表厂商", "客户", "小区", "建筑", "安装地址", "故障类型", "连续故障天数", "水表当前读数", "最后一次更新时间","阀门控制","出厂时间","安装时间","验收时间"};
|
|
|
- List<Object[]> dataList = newArrayList();
|
|
|
- Object[] objs = null;
|
|
|
- for (int i = 0; i < list.size(); i++) {
|
|
|
- DeviceDto deviceDto = list.get(i);
|
|
|
- objs = new Object[rowsName.length];
|
|
|
- objs[0] = i;
|
|
|
- objs[1] = this.getDeviceStatusName(deviceDto.getDeviceStatus());
|
|
|
- objs[2] = deviceDto.getDeviceNo();
|
|
|
- objs[3] = deviceDto.getWaterMeterFileNo();
|
|
|
- objs[4] = deviceDto.getWaterMeterNo();
|
|
|
- objs[5] = deviceDto.getConcentratorName();
|
|
|
- objs[6] = deviceDto.getCollectorName();
|
|
|
- objs[7] = deviceDto.getManufacturerName();
|
|
|
- objs[8] = deviceDto.getCustomerName();
|
|
|
- objs[9] = deviceDto.getCommunityName();
|
|
|
- objs[10] = deviceDto.getBuildingName();
|
|
|
- objs[11] = deviceDto.getLocDesc();
|
|
|
- objs[12] = deviceDto.getLastErrorType();
|
|
|
- objs[13] = deviceDto.getDays();
|
|
|
- objs[14] = deviceDto.getMeterReading();
|
|
|
- objs[15] = deviceDto.getLastReceiveTime()!=null?deviceDto.getLastReceiveTime().format(df):null;
|
|
|
- objs[16] = this.getValveStatusName(deviceDto.getIsValve(),deviceDto.getValveStatus());
|
|
|
- objs[17] = deviceDto.getPlanTime()!=null?deviceDto.getPlanTime().format(df):null;
|
|
|
- objs[18] = deviceDto.getInstallTime()!=null?deviceDto.getInstallTime().format(df):null;
|
|
|
- objs[19] = deviceDto.getAcceptTime()!=null?deviceDto.getAcceptTime().format(df):null;
|
|
|
- dataList.add(objs);
|
|
|
- }
|
|
|
- ExcelUtil excelUtil = new ExcelUtil(title, rowsName, dataList);
|
|
|
- try {
|
|
|
- excelUtil.export(httpServletResponse);
|
|
|
- } catch (Exception e) {
|
|
|
- throw new ServiceException(-900, "导出异常");
|
|
|
+ if(StringUtils.equals("photoelectricMeter",channel.getChannelCode())){
|
|
|
+ DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
|
|
+ String[] rowsName = new String[]{"序号", "水表电子号", "设备类型", "客户", "设备状态", "集中器编码", "采集器编码", "下发状态", "当前读数", "建筑", "安装地址", "阀门控制", "最后一次更新时间","出厂时间","安装时间","验收时间"};
|
|
|
+ List<Object[]> dataList = newArrayList();
|
|
|
+ Object[] objs = null;
|
|
|
+ for (int i = 0; i < list.size(); i++) {
|
|
|
+ DeviceDto deviceDto = list.get(i);
|
|
|
+ objs = new Object[rowsName.length];
|
|
|
+ objs[0] = i;
|
|
|
+ objs[1] = deviceDto.getWaterMeterNo();
|
|
|
+ objs[2] = deviceDto.getManufacturerName()+"/"+deviceDto.getEquipmentType()+"/"+deviceDto.getManufacturerName();
|
|
|
+ objs[3] = deviceDto.getCustomerName();
|
|
|
+ objs[4] = this.getDeviceStatusName(deviceDto.getDeviceStatus());
|
|
|
+ objs[5] = deviceDto.getConcentratorName();
|
|
|
+ objs[6] = deviceDto.getCollectorName();
|
|
|
+ objs[7] = this.getIssueStatusName(deviceDto.getIssueStatus());
|
|
|
+ objs[8] = deviceDto.getMeterReading();
|
|
|
+ objs[9] = deviceDto.getBuildingName();
|
|
|
+ objs[10] = deviceDto.getLocDesc();
|
|
|
+ objs[11] = this.getValveStatusName(deviceDto.getIsValve(),deviceDto.getValveStatus());
|
|
|
+ objs[12] = deviceDto.getLastReceiveTime()!=null?deviceDto.getLastReceiveTime().format(df):null;
|
|
|
+ objs[13] = deviceDto.getPlanTime()!=null?deviceDto.getPlanTime().format(df):null;
|
|
|
+ objs[14] = deviceDto.getInstallTime()!=null?deviceDto.getInstallTime().format(df):null;
|
|
|
+ objs[15] = deviceDto.getAcceptTime()!=null?deviceDto.getAcceptTime().format(df):null;
|
|
|
+ dataList.add(objs);
|
|
|
+ }
|
|
|
+ ExcelUtil excelUtil = new ExcelUtil(title, rowsName, dataList);
|
|
|
+ try {
|
|
|
+ excelUtil.export(httpServletResponse);
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new ServiceException(-900, "导出异常");
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
|
|
+ String[] rowsName = new String[]{"序号", "设备状态", "设备编号", "水表档案编号", "水表电子号", "集中器编码", "采集器编码", "水表厂商", "客户", "小区", "建筑", "安装地址", "故障类型", "连续故障天数", "水表当前读数", "最后一次更新时间","阀门控制","出厂时间","安装时间","验收时间"};
|
|
|
+ List<Object[]> dataList = newArrayList();
|
|
|
+ Object[] objs = null;
|
|
|
+ for (int i = 0; i < list.size(); i++) {
|
|
|
+ DeviceDto deviceDto = list.get(i);
|
|
|
+ objs = new Object[rowsName.length];
|
|
|
+ objs[0] = i;
|
|
|
+ objs[1] = this.getDeviceStatusName(deviceDto.getDeviceStatus());
|
|
|
+ objs[2] = deviceDto.getDeviceNo();
|
|
|
+ objs[3] = deviceDto.getWaterMeterFileNo();
|
|
|
+ objs[4] = deviceDto.getWaterMeterNo();
|
|
|
+ objs[5] = deviceDto.getConcentratorName();
|
|
|
+ objs[6] = deviceDto.getCollectorName();
|
|
|
+ objs[7] = deviceDto.getManufacturerName();
|
|
|
+ objs[8] = deviceDto.getCustomerName();
|
|
|
+ objs[9] = deviceDto.getCommunityName();
|
|
|
+ objs[10] = deviceDto.getBuildingName();
|
|
|
+ objs[11] = deviceDto.getLocDesc();
|
|
|
+ objs[12] = deviceDto.getLastErrorType();
|
|
|
+ objs[13] = deviceDto.getDays();
|
|
|
+ objs[14] = deviceDto.getMeterReading();
|
|
|
+ objs[15] = deviceDto.getLastReceiveTime()!=null?deviceDto.getLastReceiveTime().format(df):null;
|
|
|
+ objs[16] = this.getValveStatusName(deviceDto.getIsValve(),deviceDto.getValveStatus());
|
|
|
+ objs[17] = deviceDto.getPlanTime()!=null?deviceDto.getPlanTime().format(df):null;
|
|
|
+ objs[18] = deviceDto.getInstallTime()!=null?deviceDto.getInstallTime().format(df):null;
|
|
|
+ objs[19] = deviceDto.getAcceptTime()!=null?deviceDto.getAcceptTime().format(df):null;
|
|
|
+ dataList.add(objs);
|
|
|
+ }
|
|
|
+ ExcelUtil excelUtil = new ExcelUtil(title, rowsName, dataList);
|
|
|
+ try {
|
|
|
+ excelUtil.export(httpServletResponse);
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new ServiceException(-900, "导出异常");
|
|
|
+ }
|
|
|
}
|
|
|
} else {
|
|
|
String[] rowsName = new String[]{"序号", "状态", "编号", "系列", "型号", "厂商", "所属建筑", "楼层", "位置"};
|
|
@@ -262,6 +297,17 @@ public class DeviceServiceImpl implements DeviceService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ protected String getIssueStatusName(Integer issueStatus){
|
|
|
+ String issueStatusName = "未下发";
|
|
|
+ if (issueStatus != null) {
|
|
|
+ if(issueStatus == 1){
|
|
|
+ issueStatusName = "已下发";
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return issueStatusName;
|
|
|
+ }
|
|
|
+
|
|
|
protected String getValveStatusName(Integer isValve, Integer valveStatus){
|
|
|
String valveStatusName = "关阀";
|
|
|
if (isValve != null) {
|