Commit 4aae6fd3 authored by duanruiming's avatar duanruiming

[add] 神思策略推送

parent c8d9c5bd
...@@ -14,7 +14,7 @@ public class DailyPlanDetails { ...@@ -14,7 +14,7 @@ public class DailyPlanDetails {
//日计划编号 //日计划编号
private int dailyPlanId; private int dailyPlanId;
//执行时间 //执行时间
private List<String> weekExecute; private List<Integer> weekExecute;
//时间详情 //时间详情
private List<TimePlanDetails> timeDetails; private List<TimePlanDetails> timeDetails;
} }
package net.wanji.opt.entity.strategy;
import lombok.Data;
import java.util.List;
/**
* @author duanruiming
* @date 2025/04/24 10:27
*/
@Data
public class StrategyPriorityGroupPushReq {
List<StrategyPriorityConfigPush> data;
}
package net.wanji.opt.entity.strategy;
import lombok.Data;
import java.util.List;
/**
* @author duanruiming
* @date 2025/04/24 10:34
*/
@Data
public class StrategyPriorityPlanPushReq {
List<StrategyPriorityPlanPush> data;
}
package net.wanji.opt.synthesis.service; package net.wanji.opt.synthesis.service;
import net.wanji.opt.entity.strategy.StrategyParameterPush; import net.wanji.opt.entity.strategy.*;
import net.wanji.opt.entity.strategy.StrategyPriorityConfigPush;
import net.wanji.opt.entity.strategy.StrategyPriorityPlanPush;
import net.wanji.opt.synthesis.pojo.Result; import net.wanji.opt.synthesis.pojo.Result;
import net.wanji.opt.synthesis.pojo.StrategyControlReq; import net.wanji.opt.synthesis.pojo.StrategyControlReq;
import net.wanji.opt.synthesis.pojo.StrategyControlSwitchReq; import net.wanji.opt.synthesis.pojo.StrategyControlSwitchReq;
...@@ -36,7 +34,7 @@ public interface PushStrategyControlService { ...@@ -36,7 +34,7 @@ public interface PushStrategyControlService {
* @return * @return
* @throws Exception * @throws Exception
*/ */
Result StartegyPriorityPush(List<StrategyPriorityConfigPush> req) throws Exception; Result StartegyPriorityPush(StrategyPriorityGroupPushReq req) throws Exception;
/** /**
* 策略管理日计划配置推送 * 策略管理日计划配置推送
...@@ -44,7 +42,7 @@ public interface PushStrategyControlService { ...@@ -44,7 +42,7 @@ public interface PushStrategyControlService {
* @return * @return
* @throws Exception * @throws Exception
*/ */
Result StartegyPriorityPlanPush(List<StrategyPriorityPlanPush> req) throws Exception; Result StartegyPriorityPlanPush(StrategyPriorityPlanPushReq req) throws Exception;
/** /**
* 策略管理参数配置推送 * 策略管理参数配置推送
......
package net.wanji.opt.synthesis.service.impl; package net.wanji.opt.synthesis.service.impl;
import com.alibaba.fastjson.JSON;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import net.wanji.common.tool.resttool.RestTemplateTool; import net.wanji.common.tool.resttool.RestTemplateTool;
import net.wanji.common.utils.tool.JacksonUtils; import net.wanji.common.utils.tool.JacksonUtils;
import net.wanji.opt.entity.strategy.StrategyParameterPush; import net.wanji.opt.entity.strategy.*;
import net.wanji.opt.entity.strategy.StrategyPriorityConfigPush;
import net.wanji.opt.entity.strategy.StrategyPriorityPlanPush;
import net.wanji.opt.synthesis.pojo.Result; import net.wanji.opt.synthesis.pojo.Result;
import net.wanji.opt.synthesis.pojo.StrategyControlReq; import net.wanji.opt.synthesis.pojo.StrategyControlReq;
import net.wanji.opt.synthesis.pojo.StrategyControlSwitchReq; import net.wanji.opt.synthesis.pojo.StrategyControlSwitchReq;
...@@ -75,21 +72,19 @@ public class PushStrategyControlServiceImpl implements PushStrategyControlServic ...@@ -75,21 +72,19 @@ public class PushStrategyControlServiceImpl implements PushStrategyControlServic
* 优先级配置推送 * 优先级配置推送
* */ * */
@Override @Override
public Result StartegyPriorityPush(List<StrategyPriorityConfigPush> req) throws Exception { public Result StartegyPriorityPush(StrategyPriorityGroupPushReq req) throws Exception {
try { try {
String priorityUrl = "http://37.12.182.50:8082/api/traffic/strategy/priority/info";
ObjectMapper mapper = JacksonUtils.getInstance(); ObjectMapper mapper = JacksonUtils.getInstance();
System.out.println("req~~"+req);
// 序列化请求参数 // 序列化请求参数
String jsonReq = mapper.writeValueAsString(req); String jsonReq = mapper.writeValueAsString(req);
//String jsonString = JSON.toJSONString(req); String resultStr = RestTemplateTool.post(priorityUrl, jsonReq);
// System.out.println("请求参数: " + jsonReq);
String resultStr = RestTemplateTool.postList(switchUrl, jsonReq);
if (StringUtils.isNotBlank(resultStr)) { if (StringUtils.isNotBlank(resultStr)) {
log.info("下发神思策略管理优先级推送成功,内容: {}", req); log.info("下发神思策略管理优先级推送成功,内容: {}", req);
Result result = mapper.readValue(resultStr, Result.class); Result result = mapper.readValue(resultStr, Result.class);
return result; return result;
} else { } else {
log.error("策略管理优先级推送url:{}失败:返回数据异常", switchUrl); log.error("策略管理优先级推送url:{}失败:返回数据异常", priorityUrl);
return new Result("500", "服务调用失败", null); return new Result("500", "服务调用失败", null);
} }
} catch (Exception e) { } catch (Exception e) {
...@@ -101,19 +96,19 @@ public class PushStrategyControlServiceImpl implements PushStrategyControlServic ...@@ -101,19 +96,19 @@ public class PushStrategyControlServiceImpl implements PushStrategyControlServic
* 日计划配置推送 * 日计划配置推送
* */ * */
@Override @Override
public Result StartegyPriorityPlanPush(List<StrategyPriorityPlanPush> req) throws Exception { public Result StartegyPriorityPlanPush(StrategyPriorityPlanPushReq req) throws Exception {
try { try {
String planUrl = "http://37.12.182.50:8082/api/traffic/strategy/priority/schedule";
ObjectMapper mapper = JacksonUtils.getInstance(); ObjectMapper mapper = JacksonUtils.getInstance();
// 序列化请求参数 // 序列化请求参数
String jsonReq = mapper.writeValueAsString(req); String jsonReq = mapper.writeValueAsString(req);
System.out.println("req~~"+jsonReq); String resultStr = RestTemplateTool.post(planUrl, jsonReq);
String resultStr = RestTemplateTool.postList(switchUrl, jsonReq);
if (StringUtils.isNotBlank(resultStr)) { if (StringUtils.isNotBlank(resultStr)) {
log.info("下发神思策略管理日计划配置推送成功,内容: {}", req); log.info("下发神思策略管理日计划配置推送成功,内容: {}", req);
Result result = mapper.readValue(resultStr, Result.class); Result result = mapper.readValue(resultStr, Result.class);
return result; return result;
} else { } else {
log.error("策略管理日计划配置推送url:{}失败:返回数据异常", switchUrl); log.error("策略管理日计划配置推送url:{}失败:返回数据异常", planUrl);
return new Result("500", "服务调用失败", null); return new Result("500", "服务调用失败", null);
} }
} catch (Exception e) { } catch (Exception e) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment