实体移动
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
package com.njcn.prepare.harmonic.api.liteflow;
|
||||
|
||||
|
||||
import com.njcn.common.pojo.constant.ServerInfo;
|
||||
import com.njcn.prepare.harmonic.api.liteflow.fallback.LiteFlowFeignClientFallbackFactory;
|
||||
import com.njcn.prepare.harmonic.pojo.bo.BaseParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
/**
|
||||
* @author xuyang
|
||||
*/
|
||||
@FeignClient(
|
||||
value = ServerInfo.PREPARE_BOOT,//对应模块名
|
||||
path = "/executor",//对应controller请求类
|
||||
fallbackFactory = LiteFlowFeignClientFallbackFactory.class//服务降级处理类
|
||||
)
|
||||
public interface LiteFlowFeignClient {
|
||||
|
||||
@ApiOperation("监测点算法执行链")
|
||||
@PostMapping("/measurementPointExecutor")
|
||||
void measurementPointExecutor(@RequestBody BaseParam baseParam);
|
||||
|
||||
@ApiOperation("单位监测点算法执行链")
|
||||
@PostMapping("/orgPointExecutor")
|
||||
void orgPointExecutor(@RequestBody BaseParam baseParam);
|
||||
|
||||
@ApiOperation("变电站算法执行链")
|
||||
@PostMapping("/substationExecutor")
|
||||
void substationExecutor(@RequestBody BaseParam baseParam);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.njcn.prepare.harmonic.api.liteflow.fallback;
|
||||
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.prepare.harmonic.api.liteflow.LiteFlowFeignClient;
|
||||
import com.njcn.prepare.harmonic.pojo.bo.BaseParam;
|
||||
import com.njcn.prepare.harmonic.utils.PrepareEnumUtil;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class LiteFlowFeignClientFallbackFactory implements FallbackFactory<LiteFlowFeignClient> {
|
||||
@Override
|
||||
public LiteFlowFeignClient create(Throwable throwable) {
|
||||
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
|
||||
if (throwable.getCause() instanceof BusinessException) {
|
||||
BusinessException businessException = (BusinessException)throwable.getCause();
|
||||
exceptionEnum = PrepareEnumUtil.getExceptionEnum(businessException.getResult());
|
||||
}
|
||||
|
||||
Enum<?> finalExceptionEnum = exceptionEnum;
|
||||
return new LiteFlowFeignClient() {
|
||||
@Override
|
||||
public void measurementPointExecutor(BaseParam baseParam) {
|
||||
log.error("{}异常,降级处理,异常为:{}", "监测点算法执行链: ", throwable.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void orgPointExecutor(BaseParam baseParam) {
|
||||
log.error("{}异常,降级处理,异常为:{}", "单位监测点算法执行链: ", throwable.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void substationExecutor(BaseParam baseParam) {
|
||||
log.error("{}异常,降级处理,异常为:{}", "变电站算法执行链: ", throwable.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package com.njcn.prepare.harmonic.pojo.bo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
*
|
||||
* ** 当补招表示为true时,起始时间和截止时间是必填的 **
|
||||
* @author hongawen
|
||||
* @version 1.0.0
|
||||
* @date 2023年11月01日 16:17
|
||||
*/
|
||||
@Data
|
||||
public class BaseParam implements Serializable {
|
||||
|
||||
/***
|
||||
* 是否全链路执行算法
|
||||
* 非全链路执行时,tag集合必须非空
|
||||
*/
|
||||
@ApiModelProperty(name = "fullChain",value = "是否全链执行")
|
||||
private boolean fullChain;
|
||||
|
||||
/**
|
||||
* 目前仅监测点日统计存在补招功能 by yxb
|
||||
* 是否补招标识,默认不补招
|
||||
*/
|
||||
@ApiModelProperty(name = "repair",value = "是否补招")
|
||||
private boolean repair;
|
||||
|
||||
|
||||
@ApiModelProperty(name = "beginTime",value = "补招起始日期_yyyy-MM-dd")
|
||||
private String beginTime;
|
||||
|
||||
|
||||
@ApiModelProperty(name = "endTime",value = "补招截止日期_yyyy-MM-dd")
|
||||
private String endTime;
|
||||
|
||||
|
||||
@ApiModelProperty(name = "dataDate",value = "时间日期_yyyy-MM-dd")
|
||||
private String dataDate;
|
||||
|
||||
|
||||
/***
|
||||
* 需要执行的组件
|
||||
* 当不需要全链路执行时,通过tag名称动态指定执行某个算法组件
|
||||
*/
|
||||
@ApiModelProperty(name = "tagNames",value = "待执行链节点的tag集合")
|
||||
private Set<String> tagNames;
|
||||
|
||||
|
||||
/**
|
||||
* 待计算的对象索引集合,监测点、设备、母线、变电站、单位等等
|
||||
*/
|
||||
@ApiModelProperty(name = "idList",value = "索引集合")
|
||||
private List<String> idList;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.njcn.prepare.harmonic.pojo.bo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 算法编排的计算参数
|
||||
* @author hongawen
|
||||
* @version 1.0.0
|
||||
* @date 2023年11月03日 09:21
|
||||
*/
|
||||
@Data
|
||||
public class CalculatedParam<T> implements Serializable {
|
||||
|
||||
/***
|
||||
* 是否全链路执行算法
|
||||
* 非全链路执行时,tag集合必须非空
|
||||
*/
|
||||
@ApiModelProperty(name = "repair",value = "是否全链执行")
|
||||
private boolean fullChain;
|
||||
|
||||
/**
|
||||
* 目前仅监测点日统计存在补招功能 by yxb
|
||||
* 是否补招标识,默认不补招
|
||||
*/
|
||||
@ApiModelProperty(name = "repair",value = "是否补招")
|
||||
private boolean repair;
|
||||
|
||||
/***
|
||||
* 需要执行的组件
|
||||
* 当不需要全链路执行时,通过tag名称动态指定执行某个算法组件
|
||||
*/
|
||||
@ApiModelProperty(name = "tagNames",value = "待执行链节点的tag集合")
|
||||
private Set<String> tagNames;
|
||||
|
||||
|
||||
@ApiModelProperty(name = "dataDate",value = "时间日期_yyyy-MM-dd")
|
||||
private String dataDate;
|
||||
|
||||
/**
|
||||
* 待计算的对象索引集合,监测点、设备、母线、变电站、单位下监测点等等
|
||||
*/
|
||||
@ApiModelProperty(name = "idList",value = "索引集合")
|
||||
private List<T> idList;
|
||||
}
|
||||
Reference in New Issue
Block a user