关联ip不为空修改

dongdingding
dongdingding 3 days ago
parent 61b7102a3c
commit 7c03ec17b9

@ -392,9 +392,22 @@ public class AssetCurrentController extends BaseController {
for (Object o : JSONArray.parseArray(byId.getGlIp())) { for (Object o : JSONArray.parseArray(byId.getGlIp())) {
Acomma acomma = new Acomma(); Acomma acomma = new Acomma();
JSONObject jsonObject = JSONObject.parseObject(o.toString()); JSONObject jsonObject = JSONObject.parseObject(o.toString());
if (BeanUtil.isNotEmpty(jsonObject.get("key"))) {
acomma.setKey(jsonObject.get("key").toString()); acomma.setKey(jsonObject.get("key").toString());
} else {
acomma.setKey("");
}
if (BeanUtil.isNotEmpty(jsonObject.get("ipType"))) {
acomma.setIpType(jsonObject.get("ipType").toString()); acomma.setIpType(jsonObject.get("ipType").toString());
acomma.setPort(jsonObject.get("port").toString()); } else {
acomma.setIpType("");
}
Object portValue = jsonObject.get("port");
if (portValue != null && !portValue.toString().isEmpty()) {
acomma.setPort(portValue.toString());
}else{
acomma.setPort("");
}
a2.add(acomma); a2.add(acomma);
} }
byId.setGlIpList(a2); byId.setGlIpList(a2);

@ -1,5 +1,6 @@
package com.ruoyi.tc.service.impl; package com.ruoyi.tc.service.impl;
import cn.hutool.core.bean.BeanUtil;
import com.alibaba.fastjson2.JSONArray; import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject; import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@ -91,9 +92,22 @@ public class AssetCurrentServiceImpl extends ServiceImpl<AssetCurrentMapper, Ass
for (Object o : JSONArray.parseArray(byId.getGlIp())) { for (Object o : JSONArray.parseArray(byId.getGlIp())) {
Acomma acomma = new Acomma(); Acomma acomma = new Acomma();
JSONObject jsonObject = JSONObject.parseObject(o.toString()); JSONObject jsonObject = JSONObject.parseObject(o.toString());
if (BeanUtil.isNotEmpty(jsonObject.get("key"))) {
acomma.setKey(jsonObject.get("key").toString()); acomma.setKey(jsonObject.get("key").toString());
} else {
acomma.setKey("");
}
if (BeanUtil.isNotEmpty(jsonObject.get("ipType"))) {
acomma.setIpType(jsonObject.get("ipType").toString()); acomma.setIpType(jsonObject.get("ipType").toString());
acomma.setPort(jsonObject.get("port").toString()); } else {
acomma.setIpType("");
}
Object portValue = jsonObject.get("port");
if (portValue != null && !portValue.toString().isEmpty()) {
acomma.setPort(portValue.toString());
}else{
acomma.setPort("");
}
a2.add(acomma); a2.add(acomma);
} }
byId.setGlIpList(a2); byId.setGlIpList(a2);

@ -415,11 +415,21 @@ public class AssetTaskServiceImpl extends ServiceImpl<AssetTaskMapper, AssetTask
for (Object o : JSONArray.parseArray(byId.getGlIp())) { for (Object o : JSONArray.parseArray(byId.getGlIp())) {
Acomma acomma = new Acomma(); Acomma acomma = new Acomma();
JSONObject jsonObject = JSONObject.parseObject(o.toString()); JSONObject jsonObject = JSONObject.parseObject(o.toString());
if (BeanUtil.isNotEmpty(jsonObject.get("key"))) {
acomma.setKey(jsonObject.get("key").toString()); acomma.setKey(jsonObject.get("key").toString());
} else {
acomma.setKey("");
}
if (BeanUtil.isNotEmpty(jsonObject.get("ipType"))) {
acomma.setIpType(jsonObject.get("ipType").toString()); acomma.setIpType(jsonObject.get("ipType").toString());
} else {
acomma.setIpType("");
}
Object portValue = jsonObject.get("port"); Object portValue = jsonObject.get("port");
if (portValue != null && !portValue.toString().isEmpty()) { if (portValue != null && !portValue.toString().isEmpty()) {
acomma.setPort(portValue.toString()); acomma.setPort(portValue.toString());
}else{
acomma.setPort("");
} }
a2.add(acomma); a2.add(acomma);
} }

Loading…
Cancel
Save