1.数据完整性列表筛选条件调整
2.管理员新增装置自动生成装置名称
This commit is contained in:
@@ -70,4 +70,6 @@ public interface DeviceMapper extends Mapper<Device>{
|
||||
List<Integer> getDevIndex(@Param("list") List<Integer> dataType);
|
||||
|
||||
DeviceDetail getDevAndParent(@Param("devIndex")String devIndex);
|
||||
|
||||
String findMaxDeviceName(@Param("gdIndex")Long gdIndex);
|
||||
}
|
||||
|
||||
@@ -53,6 +53,8 @@ public interface LineMapper extends Mapper<Line> {
|
||||
//根据现有的监测点筛选出国网监测点
|
||||
List<Integer> getGWLines(@Param("list") List<Integer> subList);
|
||||
|
||||
List<Integer> getAllGWLines(@Param("list") List<Integer> subList);
|
||||
|
||||
String selectLineName(String name);
|
||||
|
||||
//获取该表所有数据,提供excel导出
|
||||
|
||||
@@ -340,7 +340,7 @@ public class DeviceServiceImpl implements DeviceService {
|
||||
}
|
||||
intergralityData.setAllNets(list1);
|
||||
//国网监测点
|
||||
List<Integer> countryLineIndexs = getGwLine(lineIndexs);
|
||||
List<Integer> countryLineIndexs = getAllGwLine(lineIndexs);
|
||||
if (!CollectionUtils.isEmpty(countryLineIndexs)) {
|
||||
List<IntergralityTable> list2 = getGWIntegralityTable(startTime, endTime, countryLineIndexs);
|
||||
if (CollUtil.isNotEmpty(list2)){
|
||||
@@ -1085,6 +1085,30 @@ public class DeviceServiceImpl implements DeviceService {
|
||||
return tempLine;
|
||||
}
|
||||
|
||||
private List<Integer> getAllGwLine(List<Integer> lines) {
|
||||
if (CollectionUtils.isEmpty(lines)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
List<Integer> lineTemp = new ArrayList<>(lines);
|
||||
List<Integer> tempLine = new ArrayList<>();
|
||||
if (lineTemp.size() > 1000) {
|
||||
int times = lineTemp.size() / 1000 + 1;
|
||||
for (int i = 0; i < times; i++) {
|
||||
if (lineTemp.size() > 1000) {
|
||||
List<Integer> subList = lineTemp.subList(0, 1000);
|
||||
List<Integer> temp = lineMapper.getAllGWLines(subList);
|
||||
subList.clear();
|
||||
tempLine.addAll(temp);
|
||||
} else {
|
||||
tempLine.addAll(lineMapper.getAllGWLines(lineTemp));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
tempLine.addAll(lineMapper.getAllGWLines(lineTemp));
|
||||
}
|
||||
return tempLine;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据监测点索引获取当前的数据完整性
|
||||
*
|
||||
|
||||
@@ -181,6 +181,24 @@
|
||||
AND T2.MONITOR_ID IS NOT NULL
|
||||
</select>
|
||||
|
||||
<select id="getAllGWLines" resultType="Integer">
|
||||
SELECT
|
||||
T2.LINE_INDEX
|
||||
FROM
|
||||
PQ_LINE t1,
|
||||
PQ_LINEDETAIL t2,
|
||||
PQ_DEVICE t3
|
||||
WHERE
|
||||
T1.LINE_INDEX = T2.LINE_INDEX
|
||||
AND T1.DEV_INDEX=T3.DEV_INDEX
|
||||
AND T1.LINE_INDEX IN
|
||||
<foreach collection="list" item="item" open="(" close=")"
|
||||
separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
AND T2.MONITOR_ID IS NOT NULL
|
||||
</select>
|
||||
|
||||
<select id="getLineByEventDetailIndex" resultType="line">
|
||||
select t1.*
|
||||
from PQ_LINE t1,
|
||||
|
||||
@@ -798,6 +798,20 @@ public class DeviceController {
|
||||
return result;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "findMaxDeviceName", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public String findMaxDeviceName(HttpServletRequest request, Long gdIndex) {
|
||||
String result;
|
||||
try {
|
||||
result = manaDevice.findMaxDeviceName(gdIndex);
|
||||
userLog.getLog("查询当前供电公司下面最大的设备名称", "成功", result, LogTypeEnum.SYSTEM.toString(), 0);
|
||||
} catch (Exception e) {
|
||||
result = null;
|
||||
userLog.getLog("查询当前供电公司下面最大的设备名称", "失败", result, LogTypeEnum.SYSTEM.toString(), 0);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "addDevice", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public HttpResult addDevice(HttpServletRequest request, HttpSession session, String devName, Long gdIndex,
|
||||
|
||||
@@ -123,4 +123,6 @@ public interface ManaDeviceService {
|
||||
*/
|
||||
int addMonitor(String monitorId);
|
||||
|
||||
String findMaxDeviceName(Long gdIndex);
|
||||
|
||||
}
|
||||
|
||||
@@ -2488,4 +2488,31 @@ public class ManaDeviceServiceImpl implements ManaDeviceService {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String findMaxDeviceName(Long gdIndex) {
|
||||
String name = deviceMapper.findMaxDeviceName(gdIndex);
|
||||
return incrementString(name);
|
||||
}
|
||||
|
||||
public String incrementString(String str) {
|
||||
// 查找最后一个非数字字符的位置
|
||||
int lastIndex = str.length() - 1;
|
||||
while (lastIndex >= 0 && Character.isDigit(str.charAt(lastIndex))) {
|
||||
lastIndex--;
|
||||
}
|
||||
// 如果没有找到非数字字符,说明整个字符串都是数字
|
||||
if (lastIndex == -1) {
|
||||
// 直接将字符串转换为整数,递增,再转回字符串
|
||||
return String.valueOf(Long.parseLong(str) + 1);
|
||||
}
|
||||
// 提取出数字部分
|
||||
String numberPart = str.substring(lastIndex + 1);
|
||||
// 将数字部分转换为整数,递增,再转回字符串
|
||||
long number = Long.parseLong(numberPart) + 1;
|
||||
String incrementedNumberPart = String.format("%0" + numberPart.length() + "d", number);
|
||||
// 将递增后的数字部分拼接到原字符串的非数字部分
|
||||
return str.substring(0, lastIndex + 1) + incrementedNumberPart;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -171,4 +171,8 @@ FROM
|
||||
WHERE
|
||||
a.dev_index = #{devIndex}
|
||||
</select>
|
||||
|
||||
<select id="findMaxDeviceName" resultType="String">
|
||||
SELECT MAX(NAME) FROM PQ_DEVICE WHERE GD_INDEX = #{gdIndex}
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -49,6 +49,20 @@
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function () {
|
||||
$("html").css("height", "100px");
|
||||
|
||||
//获取默认装置名称
|
||||
var gdIndex = $("#gdIndex").val();
|
||||
$.ajax({
|
||||
url: '/pqs9900/device/findMaxDeviceName',
|
||||
type: 'POST',
|
||||
dataType: "text",
|
||||
data: {
|
||||
gdIndex: gdIndex
|
||||
},
|
||||
success: function (data) {
|
||||
$('#devName').val(data);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
|
||||
|
||||
Reference in New Issue
Block a user