优化交换机数据入库,修改bug,增加手动计算95值接口
This commit is contained in:
@@ -0,0 +1,90 @@
|
||||
package com.ruoyi.system.controller;
|
||||
|
||||
import com.ruoyi.common.core.web.controller.BaseController;
|
||||
import com.ruoyi.system.domain.EpsInitialTrafficData;
|
||||
import com.ruoyi.system.domain.InitialSwitchInfoDetails;
|
||||
import com.ruoyi.system.service.EpsInitialTrafficDataService;
|
||||
import com.ruoyi.system.service.IInitialSwitchInfoDetailsService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("calculateBandwidth")
|
||||
public class CalculateController extends BaseController {
|
||||
|
||||
private static final DateTimeFormatter TIME_FORMAT = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
@Autowired
|
||||
private EpsInitialTrafficDataService epsInitialTrafficDataService;
|
||||
@Autowired
|
||||
private IInitialSwitchInfoDetailsService initialSwitchInfoDetailsService;
|
||||
|
||||
@GetMapping("/calculate95BandwidthDaily")
|
||||
public void calculate95BandwidthDaily(String day){
|
||||
// 获取昨天的日期范围(北京时间)
|
||||
LocalDate yesterday = LocalDate.parse(day);
|
||||
String dailyStartTime = yesterday.atStartOfDay().format(TIME_FORMAT); // 00:00:00
|
||||
String dailyEndTime = yesterday.atTime(23, 59, 59).format(TIME_FORMAT); // 23:59:59
|
||||
// 日
|
||||
String dayOrMonth = "1";
|
||||
// 95带宽值/日
|
||||
EpsInitialTrafficData queryParam = new EpsInitialTrafficData();
|
||||
queryParam.setDayOrMonth(dayOrMonth);
|
||||
InitialSwitchInfoDetails initialSwitchInfoDetails = new InitialSwitchInfoDetails();
|
||||
initialSwitchInfoDetails.setDayOrMonth(dayOrMonth);
|
||||
// epsInitialTrafficDataService.calculateBusiness95BandwidthDaily(queryParam, dailyStartTime, dailyEndTime, "1000");
|
||||
// epsInitialTrafficDataService.calculateBusiness95BandwidthDaily(queryParam, dailyStartTime, dailyEndTime, "1024");
|
||||
// initialSwitchInfoDetailsService.calculateSwitch95BandwidthDaily(initialSwitchInfoDetails, dailyStartTime, dailyEndTime, "1000");
|
||||
// initialSwitchInfoDetailsService.calculateSwitch95BandwidthDaily(initialSwitchInfoDetails, dailyStartTime, dailyEndTime, "1024");
|
||||
}
|
||||
@GetMapping("/calculateMonthlyBandwidth")
|
||||
public void calculateMonthlyBandwidth(String day){
|
||||
// 获取上个月的日期范围
|
||||
LocalDate lastMonth = LocalDate.parse(day);
|
||||
LocalDate firstDayOfMonth = lastMonth.withDayOfMonth(1);
|
||||
LocalDate lastDayOfMonth = lastMonth.withDayOfMonth(lastMonth.lengthOfMonth());
|
||||
|
||||
String monthlyStartTime = firstDayOfMonth.atStartOfDay().format(TIME_FORMAT);
|
||||
String monthlyEndTime = lastDayOfMonth.atTime(23, 59, 59).format(TIME_FORMAT);
|
||||
calculateServerMonthlyBandwidth(monthlyStartTime, monthlyEndTime, "1000");
|
||||
calculateServerMonthlyBandwidth(monthlyStartTime, monthlyEndTime, "1024");
|
||||
calculateSwitchMonthlyBandwidth(monthlyStartTime, monthlyEndTime, "1000");
|
||||
calculateSwitchMonthlyBandwidth(monthlyStartTime, monthlyEndTime, "1024");
|
||||
}
|
||||
/**
|
||||
* 计算服务器月95带宽值
|
||||
*/
|
||||
private void calculateServerMonthlyBandwidth(String monthlyStartTime, String monthlyEndTime, String calculationMode) {
|
||||
log.info("开始计算服务器月95带宽值...");
|
||||
try {
|
||||
String dayOrMonth = "2";
|
||||
EpsInitialTrafficData queryParam = new EpsInitialTrafficData();
|
||||
queryParam.setDayOrMonth(dayOrMonth);
|
||||
epsInitialTrafficDataService.calculateBusiness95BandwidthDaily(queryParam, monthlyStartTime, monthlyEndTime, calculationMode);
|
||||
log.info("服务器月95带宽值计算完成");
|
||||
} catch (Exception e) {
|
||||
log.error("计算服务器月95带宽值失败", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算交换机月95带宽值
|
||||
*/
|
||||
private void calculateSwitchMonthlyBandwidth(String monthlyStartTime, String monthlyEndTime, String calculationMode) {
|
||||
log.info("开始计算交换机月95带宽值...");
|
||||
try {
|
||||
String dayOrMonth = "2";
|
||||
InitialSwitchInfoDetails queryParam = new InitialSwitchInfoDetails();
|
||||
queryParam.setDayOrMonth(dayOrMonth);
|
||||
initialSwitchInfoDetailsService.calculateSwitch95BandwidthDaily(queryParam, monthlyStartTime, monthlyEndTime, calculationMode);
|
||||
log.info("交换机月95带宽值计算完成");
|
||||
} catch (Exception e) {
|
||||
log.error("计算交换机月95带宽值失败", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,8 @@ import com.ruoyi.system.service.IRmResourceRegistrationService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 资源监控API
|
||||
*
|
||||
@@ -58,4 +60,14 @@ public class ResourceMonitorController extends BaseController
|
||||
PageInfo<RmResourceRegistration> pageInfo = rmResourceGroupService.getRegisterList(rmResourceGroup);
|
||||
return getDataTable(pageInfo.getList(), pageInfo.getTotal());
|
||||
}
|
||||
/**
|
||||
* 获取资源列表
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/getAllRegisterListByGroupId")
|
||||
public AjaxResult getAllRegisterListByGroupId(@RequestBody RmResourceGroup rmResourceGroup){
|
||||
// 拿到注册信息
|
||||
List<RmResourceRegistration> list = rmResourceGroupService.getAllRegisterList(rmResourceGroup);
|
||||
return success(list);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,6 +63,7 @@ public interface IRmResourceGroupService
|
||||
public int deleteRmResourceGroupById(Long id);
|
||||
|
||||
PageInfo<RmResourceRegistration> getRegisterList(RmResourceGroup rmResourceGroup);
|
||||
List<RmResourceRegistration> getAllRegisterList(RmResourceGroup rmResourceGroup);
|
||||
|
||||
String exitsResourceById(RmResourceGroup rmResourceGroup);
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import com.ruoyi.system.service.IRmResourceGroupService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static com.ruoyi.common.core.utils.PageUtils.startPage;
|
||||
@@ -168,6 +169,34 @@ public class RmResourceGroupServiceImpl implements IRmResourceGroupService
|
||||
return new PageInfo<>(rmResourceRegistrationList);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 根据资源分组获取所欲资源列表
|
||||
* @param rmResourceGroup
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<RmResourceRegistration> getAllRegisterList(RmResourceGroup rmResourceGroup) {
|
||||
if(rmResourceGroup.getId() == null){
|
||||
return new ArrayList<>();
|
||||
}
|
||||
RmResourceGroup group = rmResourceGroupMapper.selectRmResourceGroupById(rmResourceGroup.getId());
|
||||
String ids = group.getIncludedDevicesId();
|
||||
String[] resourceIds = ids.split(",");
|
||||
// 拿到资源信息
|
||||
List<RmResourceRegistration> rmResourceRegistrationList = rmResourceRegistrationMapper.getRegistrationByIds(resourceIds);
|
||||
// 监控项赋值-暂时不需要
|
||||
for (RmResourceRegistration rmResourceRegistration : rmResourceRegistrationList) {
|
||||
RmResourceGroup item = rmResourceGroupMapper.selectMonitorMsgAndGroupMsg(rmResourceRegistration.getId());
|
||||
if(item != null){
|
||||
rmResourceRegistration.setMonitorItems(item.getMonitorItems());
|
||||
rmResourceRegistration.setDiscoveryRules(item.getDiscoveryRules());
|
||||
}else{
|
||||
rmResourceRegistration.setMonitorItems("0");
|
||||
rmResourceRegistration.setDiscoveryRules("0");
|
||||
}
|
||||
}
|
||||
return rmResourceRegistrationList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String exitsResourceById(RmResourceGroup rmResourceGroup) {
|
||||
|
||||
@@ -40,9 +40,49 @@ public class CalculateUtil {
|
||||
throw new UnsupportedOperationException("Unknown mode: " + mode);
|
||||
}
|
||||
}
|
||||
// 1000进制换算
|
||||
// 1000进制换算(最小单位为bit)
|
||||
// private static BigDecimal convertWithDecimalCoefficients(BigDecimal value, String unit) {
|
||||
// switch (unit) {
|
||||
// case "B/S": // bit per second
|
||||
// return value.divide(new BigDecimal("1000000000"), 2, RoundingMode.HALF_UP); // 10^9
|
||||
// case "KB/S": // Kilobit per second
|
||||
// return value.divide(new BigDecimal("1000000"), 2, RoundingMode.HALF_UP); // 10^6
|
||||
// case "MB/S": // Megabit per second
|
||||
// return value.divide(new BigDecimal("1000"), 2, RoundingMode.HALF_UP); // 10^3
|
||||
// case "GB/S": // Gigabit per second
|
||||
// return value.setScale(2, RoundingMode.HALF_UP); // 10^0
|
||||
// case "TB/S": // Terabit per second
|
||||
// return value.multiply(new BigDecimal("1000")) // 10^3
|
||||
// .setScale(2, RoundingMode.HALF_UP);
|
||||
// default:
|
||||
// throw new IllegalArgumentException("Unsupported DECIMAL unit: " + unit);
|
||||
// }
|
||||
// }
|
||||
// // 1024进制换算(最小单位为bit)
|
||||
// private static BigDecimal convertWithBinaryCoefficients(BigDecimal value, String unit) {
|
||||
// BigDecimal base1024 = new BigDecimal(1024);
|
||||
// BigDecimal base1048576 = base1024.multiply(base1024); // 1024^2 = 1048576
|
||||
// BigDecimal base1073741824 = base1048576.multiply(base1024); // 1024^3 = 1073741824
|
||||
//
|
||||
// switch (unit) {
|
||||
// case "B/S": // bit per second
|
||||
// return value.divide(base1073741824, 2, RoundingMode.HALF_UP); // 1024^3
|
||||
// case "KB/S": // Kilobit per second
|
||||
// return value.divide(base1048576, 2, RoundingMode.HALF_UP); // 1024^2
|
||||
// case "MB/S": // Megabit per second
|
||||
// return value.divide(base1024, 2, RoundingMode.HALF_UP); // 1024^1
|
||||
// case "GB/S": // Gigabit per second
|
||||
// return value.setScale(2, RoundingMode.HALF_UP); // 1024^0
|
||||
// case "TB/S": // Terabit per second
|
||||
// return value.multiply(base1024) // 1024^1
|
||||
// .setScale(2, RoundingMode.HALF_UP);
|
||||
// default:
|
||||
// throw new IllegalArgumentException("Unsupported BINARY unit: " + unit);
|
||||
// }
|
||||
// }
|
||||
// 字节1000进制换算
|
||||
private static BigDecimal convertWithDecimalCoefficients(BigDecimal value, String unit) {
|
||||
switch (unit) {
|
||||
switch (unit.toUpperCase()) {
|
||||
case "B/S":
|
||||
return value.multiply(new BigDecimal("0.000008")) // 8/1000000
|
||||
.setScale(2, RoundingMode.HALF_UP);
|
||||
@@ -62,9 +102,9 @@ public class CalculateUtil {
|
||||
}
|
||||
}
|
||||
|
||||
// 1024进制换算
|
||||
// 字节1024进制换算
|
||||
private static BigDecimal convertWithBinaryCoefficients(BigDecimal value, String unit) {
|
||||
switch (unit) {
|
||||
switch (unit.toUpperCase()) {
|
||||
case "B/S":
|
||||
return value.multiply(new BigDecimal("0.00000762939")) // 8/1048576
|
||||
.setScale(2, RoundingMode.HALF_UP);
|
||||
|
||||
@@ -77,4 +77,8 @@ public class RmDeploymentPolicy extends BaseEntity
|
||||
/** 脚本类型 */
|
||||
@Excel(name = "脚本类型")
|
||||
private String scriptType;
|
||||
/** 资源组名称 */
|
||||
private String resourceGroupName;
|
||||
/** 资源组置空 */
|
||||
private Boolean resourceGroupIdNull;
|
||||
}
|
||||
|
||||
@@ -1,8 +1,12 @@
|
||||
package com.ruoyi.rocketmq.domain.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.Instant;
|
||||
|
||||
@Data
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class RspVo {
|
||||
/**
|
||||
* 状态码,0、失败;1、成功
|
||||
@@ -21,5 +25,5 @@ public class RspVo {
|
||||
/**
|
||||
* 时间戳
|
||||
*/
|
||||
private Long timestamp;
|
||||
private Long timestamp = Instant.now().getEpochSecond();
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ import com.ruoyi.rocketmq.mapper.RmDeploymentPolicyMapper;
|
||||
import com.ruoyi.rocketmq.model.ProducerMode;
|
||||
import com.ruoyi.rocketmq.producer.MessageProducer;
|
||||
import com.ruoyi.rocketmq.service.IRmDeploymentPolicyService;
|
||||
import com.ruoyi.rocketmq.utils.DataProcessUtil;
|
||||
import com.ruoyi.system.api.RemoteRevenueConfigService;
|
||||
import com.ruoyi.system.api.domain.RmResourceRegistrationRemote;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -38,6 +39,8 @@ public class RmDeploymentPolicyServiceImpl implements IRmDeploymentPolicyService
|
||||
@Autowired
|
||||
private RemoteRevenueConfigService remoteRevenueConfigService;
|
||||
@Autowired
|
||||
private DataProcessUtil dataProcessUtil;
|
||||
@Autowired
|
||||
private ProducerMode producerMode;
|
||||
|
||||
/**
|
||||
@@ -99,6 +102,10 @@ public class RmDeploymentPolicyServiceImpl implements IRmDeploymentPolicyService
|
||||
.collect(Collectors.joining(","));
|
||||
|
||||
policy.setIncludedDevicesName(names);
|
||||
if(policy.getResourceGroupId() != null){
|
||||
String resourceGroupName = dataProcessUtil.getResourceGroupNameById(policy.getResourceGroupId());
|
||||
policy.setResourceGroupName(resourceGroupName);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -124,6 +131,11 @@ public class RmDeploymentPolicyServiceImpl implements IRmDeploymentPolicyService
|
||||
public int updateRmDeploymentPolicy(RmDeploymentPolicy rmDeploymentPolicy)
|
||||
{
|
||||
rmDeploymentPolicy.setUpdateTime(DateUtils.getNowDate());
|
||||
// 有修改就改为待下发状态
|
||||
rmDeploymentPolicy.setPolicyStatus("0");
|
||||
if(rmDeploymentPolicy.getResourceGroupId() == null){
|
||||
rmDeploymentPolicy.setResourceGroupIdNull(Boolean.TRUE);
|
||||
}
|
||||
return rmDeploymentPolicyMapper.updateRmDeploymentPolicy(rmDeploymentPolicy);
|
||||
}
|
||||
|
||||
@@ -165,7 +177,6 @@ public class RmDeploymentPolicyServiceImpl implements IRmDeploymentPolicyService
|
||||
policy.setIncludedDevicesName("");
|
||||
return 0;
|
||||
}
|
||||
|
||||
String[] ids = policy.getIncludedDevicesId().split(",");
|
||||
R<List<RmResourceRegistrationRemote>> resourceNameList =
|
||||
remoteRevenueConfigService.getRegistrationByIds(ids, SecurityConstants.INNER);
|
||||
|
||||
@@ -119,10 +119,10 @@ public class RmResourceRemoteServiceImpl implements IRmResourceRemoteService
|
||||
JSONObject jsonObject = JSONObject.parseObject(resourceRemote.getDescription());
|
||||
String command = jsonObject.getString("command");
|
||||
String resOut = jsonObject.getString("resOut");
|
||||
String sucOrFail = (!"".equals(resOut) && !"脚本执行失败".equals(resOut)) ? "\n执行成功\n":"\n执行失败\n";
|
||||
String sucOrFail = (!"".equals(resOut) && !"脚本执行失败".equals(resOut)) ? "\n执行成功,\n":"\n执行失败,\n";
|
||||
StringBuilder resultSb = new StringBuilder();
|
||||
resultSb.append("【").append(resourceRemote.getResourceName()).append("】脚本执行命令:\n")
|
||||
.append(command).append(sucOrFail).append(",执行结果如下:\n").append(resOut);
|
||||
.append(command).append(sucOrFail).append("执行结果如下:\n").append(resOut);
|
||||
Map<String,Object> map = new HashMap<>();
|
||||
Date createTime = resourceRemote.getCreateTime();
|
||||
String createTimeStr = DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss", createTime);
|
||||
|
||||
@@ -0,0 +1,149 @@
|
||||
package com.ruoyi.rocketmq.utils;
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.node.ArrayNode;
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class SwitchJsonDataParser {
|
||||
private static final ObjectMapper objectMapper = new ObjectMapper();
|
||||
|
||||
/**
|
||||
* 通用JSON解析方法(兼容对象和数组)
|
||||
* @param jsonStr JSON字符串
|
||||
* @param valueType 目标实体类类型
|
||||
* @return 实体类List集合
|
||||
*/
|
||||
public static <T> List<T> parseJsonData(String jsonStr, Class<T> valueType) {
|
||||
if (!StringUtils.hasText(jsonStr)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
try {
|
||||
JsonNode rootNode = objectMapper.readTree(jsonStr);
|
||||
|
||||
if (rootNode.isArray()) {
|
||||
// 处理数组格式JSON
|
||||
if (isStringArrayContainingJsonObjects((ArrayNode) rootNode)) {
|
||||
// 处理包含JSON对象字符串的数组 - 转换为真正的对象数组
|
||||
ArrayNode processedArray = processStringJsonArrayToObjectArray((ArrayNode) rootNode);
|
||||
return convertJsonArrayToList(processedArray, valueType);
|
||||
} else {
|
||||
// 处理普通JSON数组
|
||||
processJsonArray((ArrayNode) rootNode);
|
||||
return convertJsonArrayToList((ArrayNode) rootNode, valueType);
|
||||
}
|
||||
} else {
|
||||
// 处理单个对象格式JSON
|
||||
if (rootNode.isObject()) {
|
||||
processJsonObject((ObjectNode) rootNode);
|
||||
}
|
||||
List<T> result = new ArrayList<>(1);
|
||||
result.add(objectMapper.treeToValue(rootNode, valueType));
|
||||
return result;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("JSON解析失败: " + e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 将JsonArray转换为List<T>
|
||||
*/
|
||||
private static <T> List<T> convertJsonArrayToList(ArrayNode arrayNode, Class<T> valueType) throws Exception {
|
||||
List<T> result = new ArrayList<>();
|
||||
for (int i = 0; i < arrayNode.size(); i++) {
|
||||
JsonNode element = arrayNode.get(i);
|
||||
result.add(objectMapper.treeToValue(element, valueType));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否是包含JSON对象字符串的字符串数组
|
||||
*/
|
||||
private static boolean isStringArrayContainingJsonObjects(ArrayNode arrayNode) {
|
||||
if (arrayNode.size() == 0) return false;
|
||||
|
||||
JsonNode firstElement = arrayNode.get(0);
|
||||
if (firstElement.isTextual()) {
|
||||
try {
|
||||
String strValue = firstElement.textValue();
|
||||
// 检查是否是JSON对象格式的字符串
|
||||
if (strValue.startsWith("{") && strValue.endsWith("}")) {
|
||||
objectMapper.readTree(strValue);
|
||||
return true;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理包含JSON对象字符串的字符串数组,转换为真正的对象数组
|
||||
*/
|
||||
private static ArrayNode processStringJsonArrayToObjectArray(ArrayNode arrayNode) {
|
||||
ArrayNode resultArray = objectMapper.createArrayNode();
|
||||
|
||||
for (int i = 0; i < arrayNode.size(); i++) {
|
||||
JsonNode element = arrayNode.get(i);
|
||||
if (element.isTextual()) {
|
||||
try {
|
||||
String jsonString = element.textValue();
|
||||
JsonNode jsonNode = objectMapper.readTree(jsonString);
|
||||
|
||||
if (jsonNode.isObject()) {
|
||||
// 处理JSON对象中的 noSuchInstance
|
||||
processJsonObject((ObjectNode) jsonNode);
|
||||
resultArray.add(jsonNode);
|
||||
} else {
|
||||
resultArray.add(element);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// 如果解析失败,保持原样
|
||||
resultArray.add(element);
|
||||
}
|
||||
} else {
|
||||
resultArray.add(element);
|
||||
}
|
||||
}
|
||||
|
||||
return resultArray;
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理JSON数组
|
||||
*/
|
||||
private static void processJsonArray(ArrayNode arrayNode) {
|
||||
for (int i = 0; i < arrayNode.size(); i++) {
|
||||
JsonNode element = arrayNode.get(i);
|
||||
if (element.isObject()) {
|
||||
processJsonObject((ObjectNode) element);
|
||||
} else if (element.isArray()) {
|
||||
processJsonArray((ArrayNode) element);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理JSON对象
|
||||
*/
|
||||
private static void processJsonObject(ObjectNode objectNode) {
|
||||
objectNode.fields().forEachRemaining(entry -> {
|
||||
JsonNode value = entry.getValue();
|
||||
if (value.isTextual() && "noSuchInstance".equals(value.textValue())) {
|
||||
objectNode.putNull(entry.getKey());
|
||||
} else if (value.isObject()) {
|
||||
processJsonObject((ObjectNode) value);
|
||||
} else if (value.isArray()) {
|
||||
processJsonArray((ArrayNode) value);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -101,6 +101,7 @@
|
||||
<if test="policyName != null and policyName != ''">policy_name = #{policyName},</if>
|
||||
<if test="description != null">description = #{description},</if>
|
||||
<if test="resourceGroupId != null">resource_group_id = #{resourceGroupId},</if>
|
||||
<if test="resourceGroupIdNull != null">resource_group_id = null,</if>
|
||||
<if test="includedDevicesId != null">included_devices_id = #{includedDevicesId},</if>
|
||||
<if test="sourceFilePathType != null">source_file_path_type = #{sourceFilePathType},</if>
|
||||
<if test="sourceFilePath != null and sourceFilePath != ''">source_file_path = #{sourceFilePath},</if>
|
||||
|
||||
Reference in New Issue
Block a user