代码调整
This commit is contained in:
@@ -24,6 +24,6 @@ public class ThsSuperviseJob {
|
|||||||
public void thsSuperviseJob() {
|
public void thsSuperviseJob() {
|
||||||
SuperviseParam superviseParam = new SuperviseParam();
|
SuperviseParam superviseParam = new SuperviseParam();
|
||||||
superviseParam.setInitType(0);
|
superviseParam.setInitType(0);
|
||||||
thsSuperviseClient.initSupervise(superviseParam);
|
thsSuperviseClient.creatSupervise(superviseParam);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,11 +16,21 @@ import org.springframework.web.bind.annotation.RequestBody;
|
|||||||
)
|
)
|
||||||
public interface ThsSuperviseClient {
|
public interface ThsSuperviseClient {
|
||||||
/**
|
/**
|
||||||
* 预警/告警事务的生成
|
* 预警/告警事务的初始化
|
||||||
*
|
*
|
||||||
* @param superviseParam
|
* @param superviseParam
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@PostMapping("/initSupervise")
|
@PostMapping("/initSupervise")
|
||||||
HttpResult<String> initSupervise(@RequestBody @Validated SuperviseParam superviseParam);
|
HttpResult<String> initSupervise(@RequestBody @Validated SuperviseParam superviseParam);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 预警/告警事务的生成
|
||||||
|
*
|
||||||
|
* @param superviseParam
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("/creatSupervise")
|
||||||
|
HttpResult<String> creatSupervise(@RequestBody @Validated SuperviseParam superviseParam);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,6 +26,12 @@ public class ThsSuperviseClientFallbackFactory implements FallbackFactory<ThsSup
|
|||||||
return new ThsSuperviseClient() {
|
return new ThsSuperviseClient() {
|
||||||
@Override
|
@Override
|
||||||
public HttpResult<String> initSupervise(@RequestBody @Validated SuperviseParam superviseParam) {
|
public HttpResult<String> initSupervise(@RequestBody @Validated SuperviseParam superviseParam) {
|
||||||
|
log.error("{}异常,降级处理,异常为:{}", "预警/告警事务的初始化: ", throwable.toString());
|
||||||
|
throw new BusinessException(finalExceptionEnum);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HttpResult<String> creatSupervise(SuperviseParam superviseParam) {
|
||||||
log.error("{}异常,降级处理,异常为:{}", "预警/告警事务的生成: ", throwable.toString());
|
log.error("{}异常,降级处理,异常为:{}", "预警/告警事务的生成: ", throwable.toString());
|
||||||
throw new BusinessException(finalExceptionEnum);
|
throw new BusinessException(finalExceptionEnum);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
package com.njcn.prepare.harmonic.controller.line;
|
package com.njcn.prepare.harmonic.controller.line;
|
||||||
|
|
||||||
|
|
||||||
|
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||||
import com.njcn.common.pojo.response.HttpResult;
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
|
import com.njcn.common.utils.HttpResultUtil;
|
||||||
import com.njcn.prepare.harmonic.pojo.param.SuperviseParam;
|
import com.njcn.prepare.harmonic.pojo.param.SuperviseParam;
|
||||||
import com.njcn.prepare.harmonic.service.mysql.line.ThsSuperviseService;
|
import com.njcn.prepare.harmonic.service.mysql.line.ThsSuperviseService;
|
||||||
import com.njcn.web.controller.BaseController;
|
import com.njcn.web.controller.BaseController;
|
||||||
@@ -27,13 +29,23 @@ public class ThsSuperviseController extends BaseController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private ThsSuperviseService thsSuperviseService;
|
private ThsSuperviseService thsSuperviseService;
|
||||||
|
|
||||||
@ApiOperation("预警/告警事务生成")
|
@ApiOperation("预警/告警事务手动初始化")
|
||||||
@ApiImplicitParam(name = "superviseParam", value = "创建技术监督参数", required = true)
|
@ApiImplicitParam(name = "superviseParam", value = "新建技术监督参数", required = true)
|
||||||
@PostMapping("/initSupervise")
|
@PostMapping("/initSupervise")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public HttpResult<String> initSupervise(@RequestBody @Validated SuperviseParam superviseParam) {
|
public HttpResult<String> initSupervise(@RequestBody @Validated SuperviseParam superviseParam) {
|
||||||
HttpResult<String> superviceRunLogVoHttpResult = thsSuperviseService.initSupervise(superviseParam);
|
return thsSuperviseService.initSupervise(superviseParam);
|
||||||
return superviceRunLogVoHttpResult;
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ApiOperation("预警/告警事务自动生成")
|
||||||
|
@ApiImplicitParam(name = "superviseParam", value = "创建技术监督参数", required = true)
|
||||||
|
@PostMapping("/creatSupervise")
|
||||||
|
@ResponseBody
|
||||||
|
public HttpResult<String> creatSupervise(@RequestBody @Validated SuperviseParam superviseParam) {
|
||||||
|
String methodDescribe = getMethodDescribe("creatSupervise");
|
||||||
|
thsSuperviseService.creatSupervise(superviseParam);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
import org.apache.commons.collections.map.HashedMap;
|
import org.apache.commons.collections.map.HashedMap;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.scheduling.annotation.Async;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
@@ -78,6 +79,13 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
|
|||||||
private FileStorageUtil fileStorageUtil;
|
private FileStorageUtil fileStorageUtil;
|
||||||
private static final String DESCRIPTION = "description";
|
private static final String DESCRIPTION = "description";
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Async("asyncExecutor")
|
||||||
|
public void creatSupervise(SuperviseParam superviseParam) {
|
||||||
|
this.initSupervise(superviseParam);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HttpResult<String> initSupervise(SuperviseParam superviseParam) {
|
public HttpResult<String> initSupervise(SuperviseParam superviseParam) {
|
||||||
SuperviceRunLogVo superviceRunLogVo = new SuperviceRunLogVo();
|
SuperviceRunLogVo superviceRunLogVo = new SuperviceRunLogVo();
|
||||||
@@ -215,6 +223,7 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询策略列表
|
* 查询策略列表
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -88,5 +88,12 @@ public interface ThsSuperviseService extends IService<ThsSupervise> {
|
|||||||
*/
|
*/
|
||||||
void creatData(Dept dept, ThsSupervise thsSupervise, List<ThsOverRunLog> overRunLogList);
|
void creatData(Dept dept, ThsSupervise thsSupervise, List<ThsOverRunLog> overRunLogList);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建技术监督
|
||||||
|
*
|
||||||
|
* @param superviseParam
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
|
||||||
|
void creatSupervise(SuperviseParam superviseParam);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user