金瑞铭需求修改

breach-zhy
zhouhy 3 months ago
parent fdd2532ced
commit 9a3cd8860b

@ -169,5 +169,5 @@ public interface HwDeviceMapper
/** /**
* id * id
* */ * */
Integer selectDeviceIfAlarm(Long deviceId); Long selectDeviceIfAlarm(Long deviceId);
} }

@ -1447,7 +1447,8 @@ public class HwDeviceServiceImpl implements IHwDeviceService {
map.put("deviceId",deviceListInMonitorUnit.get(i).getDeviceId().toString()); map.put("deviceId",deviceListInMonitorUnit.get(i).getDeviceId().toString());
//根据设备id查询该设备是否有报警信息 //根据设备id查询该设备是否有报警信息
Integer integer = hwDeviceMapper.selectDeviceIfAlarm(Long.valueOf(map.get("deviceId")));
Long integer = hwDeviceMapper.selectDeviceIfAlarm(Long.valueOf(map.get("deviceId")));
String ifAlarm = new String(); String ifAlarm = new String();
if (integer>0){ if (integer>0){
//正常 //正常

@ -305,6 +305,23 @@ public class ExcelUtils {
int rowStart = sheet.getFirstRowNum(); int rowStart = sheet.getFirstRowNum();
// 尾行下标 // 尾行下标
int rowEnd = sheet.getLastRowNum(); int rowEnd = sheet.getLastRowNum();
//行数
int lastRowNum = sheet.getLastRowNum()+1;
int row = 0;
// Row row = sheet.getRow(5);
// short lastCellNum = row.getLastCellNum();
for (int x=0;x<lastRowNum;x++){
Row row1 = sheet.getRow(x);
if (row1!=null){
//获取每一行的列数
short i = sheet.getRow(x).getLastCellNum();
if (row<i){
row=i;
}
}
}
// 获取表头行 // 获取表头行
Row headRow = sheet.getRow(rowStart); Row headRow = sheet.getRow(rowStart);
if (headRow == null) { if (headRow == null) {
@ -312,6 +329,9 @@ public class ExcelUtils {
} }
int cellStart = headRow.getFirstCellNum(); int cellStart = headRow.getFirstCellNum();
int cellEnd = headRow.getLastCellNum(); int cellEnd = headRow.getLastCellNum();
if (cellEnd<row){
cellEnd = row;
}
LinkedHashMap<Integer, String> keyMap = new LinkedHashMap<>(); LinkedHashMap<Integer, String> keyMap = new LinkedHashMap<>();
for (int j = cellStart; j < cellEnd; j++) { for (int j = cellStart; j < cellEnd; j++) {
// 获取表头数据 // 获取表头数据
@ -319,11 +339,14 @@ public class ExcelUtils {
if (val != null && val.trim().length() != 0) { if (val != null && val.trim().length() != 0) {
keyMap.put(j, val); keyMap.put(j, val);
} }
else {
keyMap.put(j,"第"+(j+1)+"列");
} }
// 如果表头没有数据则不进行解析
if (keyMap.isEmpty()) {
return (JSONArray) Collections.emptyList();
} }
// 如果表头没有数据则不进行解析
// if (keyMap.isEmpty()) {
// return (JSONArray) Collections.emptyList();
// }
// 获取每行JSON对象的值 // 获取每行JSON对象的值
JSONArray array = new JSONArray(); JSONArray array = new JSONArray();
// 如果首行与尾行相同,表明只有一行,返回表头数据 // 如果首行与尾行相同,表明只有一行,返回表头数据

@ -412,8 +412,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectFunctionNameByFunctionIdentifier" parameterType="String" resultType="String"> <select id="selectFunctionNameByFunctionIdentifier" parameterType="String" resultType="String">
select distinct function_name from hw_device_mode_function where function_identifier = #{functionIdentifier} select distinct function_name from hw_device_mode_function where function_identifier = #{functionIdentifier}
</select> </select>
<select id="selectDeviceIfAlarm" parameterType="integer" resultType="integer"> <select id="selectDeviceIfAlarm" parameterType="Long" resultType="Long">
select count(*) from (select * from hw_alarm_info hai where device_id = #{deviceId} and handle_status = 0) as a select count(*) from
(select * from hw_alarm_info where device_id = #{deviceId} and handle_status = 0) as a
</select> </select>
</mapper> </mapper>

Loading…
Cancel
Save