状态统一管理,舍弃单独监听器
This commit is contained in:
@@ -1,27 +0,0 @@
|
||||
package com.njcn.bpm.listener.business;
|
||||
|
||||
import com.njcn.bpm.listener.BpmProcessInstanceStatusEvent;
|
||||
import com.njcn.bpm.listener.BpmProcessInstanceStatusEventListener;
|
||||
import com.njcn.supervision.api.DeVReportManageFeignClient;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
|
||||
@Component
|
||||
public class BpmDevReportStatusListener extends BpmProcessInstanceStatusEventListener {
|
||||
|
||||
@Resource
|
||||
private DeVReportManageFeignClient deVReportManageFeignClient;
|
||||
|
||||
@Override
|
||||
protected String getProcessDefinitionKey() {
|
||||
return "device_info_add";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onEvent(BpmProcessInstanceStatusEvent event) {
|
||||
deVReportManageFeignClient.updateStatus(event.getBusinessKey(), event.getStatus());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
package com.njcn.bpm.listener.business;
|
||||
|
||||
import com.njcn.bpm.listener.BpmProcessInstanceStatusEvent;
|
||||
import com.njcn.bpm.listener.BpmProcessInstanceStatusEventListener;
|
||||
import com.njcn.supervision.api.GeneralSurveyFeignClient;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
|
||||
@Component
|
||||
public class BpmGeneralSurveyStatusListener extends BpmProcessInstanceStatusEventListener {
|
||||
|
||||
@Resource
|
||||
private GeneralSurveyFeignClient generalSurveyFeignClient;
|
||||
|
||||
@Override
|
||||
protected String getProcessDefinitionKey() {
|
||||
return "harmonic_survey";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onEvent(BpmProcessInstanceStatusEvent event) {
|
||||
generalSurveyFeignClient.updateStatus(event.getBusinessKey(), event.getStatus());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
package com.njcn.bpm.listener.business;
|
||||
|
||||
import com.njcn.bpm.listener.BpmProcessInstanceStatusEvent;
|
||||
import com.njcn.bpm.listener.BpmProcessInstanceStatusEventListener;
|
||||
import com.njcn.supervision.api.QuitRunningDeviceFeignClient;
|
||||
import com.njcn.supervision.api.UserReportFeignClient;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
|
||||
@Component
|
||||
public class BpmQuitRunningDeviceStatusListener extends BpmProcessInstanceStatusEventListener {
|
||||
|
||||
@Resource
|
||||
private QuitRunningDeviceFeignClient quitRunningDeviceFeignClient;
|
||||
|
||||
@Override
|
||||
protected String getProcessDefinitionKey() {
|
||||
return "quit_running_device";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onEvent(BpmProcessInstanceStatusEvent event) {
|
||||
quitRunningDeviceFeignClient.updateDeviceStatus(event.getBusinessKey(), event.getStatus());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
package com.njcn.bpm.listener.business;
|
||||
|
||||
import com.njcn.bpm.listener.BpmProcessInstanceStatusEvent;
|
||||
import com.njcn.bpm.listener.BpmProcessInstanceStatusEventListener;
|
||||
import com.njcn.supervision.api.SupervisionPlanFeignClient;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
|
||||
@Component
|
||||
public class BpmSupervisionPlanStatusListener extends BpmProcessInstanceStatusEventListener {
|
||||
|
||||
@Resource
|
||||
private SupervisionPlanFeignClient supervisionPlanFeignClient;
|
||||
|
||||
@Override
|
||||
protected String getProcessDefinitionKey() {
|
||||
return "sup_plan_add";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onEvent(BpmProcessInstanceStatusEvent event) {
|
||||
supervisionPlanFeignClient.updateStatus(event.getBusinessKey(), event.getStatus());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.njcn.bpm.listener.business;
|
||||
|
||||
import com.njcn.bpm.listener.BpmProcessInstanceStatusEvent;
|
||||
import com.njcn.supervision.api.BusinessCommonFeignClient;
|
||||
import com.njcn.supervision.enums.SupervisionKeyEnum;
|
||||
import org.springframework.context.ApplicationListener;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@Component
|
||||
public class BpmSupervisionStatusListener implements ApplicationListener<BpmProcessInstanceStatusEvent> {
|
||||
|
||||
@Resource
|
||||
private BusinessCommonFeignClient businessCommonFeignClient;
|
||||
|
||||
@Override
|
||||
public final void onApplicationEvent(BpmProcessInstanceStatusEvent event) {
|
||||
System.out.println(event);
|
||||
//判断当前流程定义的key,是否包含在技术监督的枚举内,没有直接return,否则调用远程接口更新状态
|
||||
if(SupervisionKeyEnum.containBusinessKye(event.getProcessDefinitionKey())){
|
||||
onEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 处理事件
|
||||
*
|
||||
* @param event 事件
|
||||
*/
|
||||
protected void onEvent(BpmProcessInstanceStatusEvent event) {
|
||||
businessCommonFeignClient.updateProcessStatus(event.getProcessDefinitionKey(),event.getBusinessKey(), event.getStatus());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
package com.njcn.bpm.listener.business;
|
||||
|
||||
import com.njcn.bpm.listener.BpmProcessInstanceStatusEvent;
|
||||
import com.njcn.bpm.listener.BpmProcessInstanceStatusEventListener;
|
||||
import com.njcn.supervision.api.DeVReportManageFeignClient;
|
||||
import com.njcn.supervision.api.SurveyPlanFeignClient;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
|
||||
@Component
|
||||
public class BpmSurveyPlanStatusListener extends BpmProcessInstanceStatusEventListener {
|
||||
|
||||
@Resource
|
||||
private SurveyPlanFeignClient surveyPlanFeignClient;
|
||||
|
||||
@Override
|
||||
protected String getProcessDefinitionKey() {
|
||||
return "survey_plan";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onEvent(BpmProcessInstanceStatusEvent event) {
|
||||
surveyPlanFeignClient.updateStatus(event.getBusinessKey(), event.getStatus());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
package com.njcn.bpm.listener.business;
|
||||
|
||||
import com.njcn.bpm.listener.BpmProcessInstanceStatusEvent;
|
||||
import com.njcn.bpm.listener.BpmProcessInstanceStatusEventListener;
|
||||
import com.njcn.supervision.api.SurveyTestFeignClient;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
|
||||
@Component
|
||||
public class BpmSurveyTestStatusListener extends BpmProcessInstanceStatusEventListener {
|
||||
|
||||
@Resource
|
||||
private SurveyTestFeignClient surveyTestFeignClient;
|
||||
|
||||
@Override
|
||||
protected String getProcessDefinitionKey() {
|
||||
return "survey_test";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onEvent(BpmProcessInstanceStatusEvent event) {
|
||||
surveyTestFeignClient.updateStatus(event.getBusinessKey(), event.getStatus());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
package com.njcn.bpm.listener.business;
|
||||
|
||||
import com.njcn.bpm.listener.BpmProcessInstanceStatusEvent;
|
||||
import com.njcn.bpm.listener.BpmProcessInstanceStatusEventListener;
|
||||
import com.njcn.supervision.api.TempLineDebugFeignClient;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
|
||||
@Component
|
||||
public class BpmTempLineDebugStatusListener extends BpmProcessInstanceStatusEventListener {
|
||||
|
||||
@Resource
|
||||
private TempLineDebugFeignClient tempLineDebugFeignClient;
|
||||
|
||||
@Override
|
||||
protected String getProcessDefinitionKey() {
|
||||
return "temp_line_debug";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onEvent(BpmProcessInstanceStatusEvent event) {
|
||||
tempLineDebugFeignClient.updateStatus(event.getBusinessKey(), event.getStatus());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
package com.njcn.bpm.listener.business;
|
||||
|
||||
import com.njcn.bpm.listener.BpmProcessInstanceStatusEvent;
|
||||
import com.njcn.bpm.listener.BpmProcessInstanceStatusEventListener;
|
||||
import com.njcn.supervision.api.TempLineDebugFeignClient;
|
||||
import com.njcn.supervision.api.TempLineRunTestFeignClient;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
|
||||
@Component
|
||||
public class BpmTempLineRunTestStatusListener extends BpmProcessInstanceStatusEventListener {
|
||||
|
||||
@Resource
|
||||
private TempLineRunTestFeignClient tempLineRunTestFeignClient;
|
||||
|
||||
@Override
|
||||
protected String getProcessDefinitionKey() {
|
||||
return "line_run_test";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onEvent(BpmProcessInstanceStatusEvent event) {
|
||||
tempLineRunTestFeignClient.updateStatus(event.getBusinessKey(), event.getStatus());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
package com.njcn.bpm.listener.business;
|
||||
|
||||
import com.njcn.bpm.listener.BpmProcessInstanceStatusEvent;
|
||||
import com.njcn.bpm.listener.BpmProcessInstanceStatusEventListener;
|
||||
import com.njcn.supervision.api.TempLineFeignClient;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
|
||||
@Component
|
||||
public class BpmTempLineStatusListener extends BpmProcessInstanceStatusEventListener {
|
||||
|
||||
@Resource
|
||||
private TempLineFeignClient tempLineFeignClient;
|
||||
|
||||
@Override
|
||||
protected String getProcessDefinitionKey() {
|
||||
return "line_info_add";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onEvent(BpmProcessInstanceStatusEvent event) {
|
||||
tempLineFeignClient.updateStatus(event.getBusinessKey(), event.getStatus());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
package com.njcn.bpm.listener.business;
|
||||
|
||||
import com.njcn.bpm.listener.BpmProcessInstanceStatusEvent;
|
||||
import com.njcn.bpm.listener.BpmProcessInstanceStatusEventListener;
|
||||
import com.njcn.supervision.api.UserReportFeignClient;
|
||||
import com.njcn.supervision.api.UserReportNormalFeignClient;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
|
||||
@Component
|
||||
public class BpmUserReportNormalStatusListener extends BpmProcessInstanceStatusEventListener {
|
||||
|
||||
@Resource
|
||||
private UserReportNormalFeignClient userReportNormalFeignClient;
|
||||
|
||||
@Override
|
||||
protected String getProcessDefinitionKey() {
|
||||
return "user_go_net";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onEvent(BpmProcessInstanceStatusEvent event) {
|
||||
userReportNormalFeignClient.updateUserReportNormalStatus(event.getBusinessKey(), event.getStatus());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
package com.njcn.bpm.listener.business;
|
||||
|
||||
import com.njcn.bpm.listener.BpmProcessInstanceStatusEvent;
|
||||
import com.njcn.bpm.listener.BpmProcessInstanceStatusEventListener;
|
||||
import com.njcn.supervision.api.UserReportNormalFeignClient;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
|
||||
@Component
|
||||
public class BpmUserReportNormalTreatStatusListener extends BpmProcessInstanceStatusEventListener {
|
||||
|
||||
@Resource
|
||||
private UserReportNormalFeignClient userReportNormalFeignClient;
|
||||
|
||||
@Override
|
||||
protected String getProcessDefinitionKey() {
|
||||
return "user_treat_check";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onEvent(BpmProcessInstanceStatusEvent event) {
|
||||
userReportNormalFeignClient.updateUserReportNormalStatus(event.getBusinessKey(), event.getStatus());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
package com.njcn.bpm.listener.business;
|
||||
|
||||
import com.njcn.bpm.listener.BpmProcessInstanceStatusEvent;
|
||||
import com.njcn.bpm.listener.BpmProcessInstanceStatusEventListener;
|
||||
import com.njcn.supervision.api.UserReportFeignClient;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
|
||||
@Component
|
||||
public class BpmUserReportStatusListener extends BpmProcessInstanceStatusEventListener {
|
||||
|
||||
@Resource
|
||||
private UserReportFeignClient userReportFeignClient;
|
||||
|
||||
@Override
|
||||
protected String getProcessDefinitionKey() {
|
||||
return "build_user_info";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onEvent(BpmProcessInstanceStatusEvent event) {
|
||||
userReportFeignClient.updateUserReportStatus(event.getBusinessKey(), event.getStatus());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
package com.njcn.bpm.listener.business;
|
||||
|
||||
import com.njcn.bpm.listener.BpmProcessInstanceStatusEvent;
|
||||
import com.njcn.bpm.listener.BpmProcessInstanceStatusEventListener;
|
||||
import com.njcn.supervision.api.DeVReportManageFeignClient;
|
||||
import com.njcn.supervision.api.WarningLeafletFeignClient;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
|
||||
@Component
|
||||
public class BpmWarningLeafletStatusListener extends BpmProcessInstanceStatusEventListener {
|
||||
|
||||
@Resource
|
||||
private WarningLeafletFeignClient warningLeafletFeignClient;
|
||||
|
||||
@Override
|
||||
protected String getProcessDefinitionKey() {
|
||||
return "warn_leaflet";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onEvent(BpmProcessInstanceStatusEvent event) {
|
||||
warningLeafletFeignClient.updateStatus(event.getBusinessKey(), event.getStatus());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.njcn.supervision.api;
|
||||
|
||||
import com.njcn.common.pojo.constant.ServerInfo;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.supervision.api.fallback.BusinessCommonFeignClientFallbackFactory;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
|
||||
/**
|
||||
* 流程实例 Api 接口
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@FeignClient(value = ServerInfo.SUPERVISION, path = "/supervision", fallbackFactory = BusinessCommonFeignClientFallbackFactory.class)
|
||||
public interface BusinessCommonFeignClient {
|
||||
|
||||
/**
|
||||
* 根据流程key,业务id去实时更新流程状态
|
||||
* @param processKey 流程定义key
|
||||
* @param businessId 业务id
|
||||
* @param status 目标状态
|
||||
*/
|
||||
@GetMapping("/updateProcessStatus")
|
||||
HttpResult<Object> updateProcessStatus(@RequestParam("processKey") String processKey,@RequestParam("businessId") String businessId, @RequestParam("status")Integer status);
|
||||
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
package com.njcn.supervision.api;
|
||||
|
||||
import com.njcn.common.pojo.constant.ServerInfo;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.supervision.api.fallback.DeVReportManageFeignClientFallbackFactory;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
|
||||
/**
|
||||
* 流程实例 Api 接口
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@FeignClient(value = ServerInfo.SUPERVISION, path = "/deVReport", fallbackFactory = DeVReportManageFeignClientFallbackFactory.class)
|
||||
public interface DeVReportManageFeignClient {
|
||||
|
||||
@GetMapping("/updateStatus")
|
||||
HttpResult<Object> updateStatus(@RequestParam("businessKey") String businessKey, @RequestParam("status")Integer status);
|
||||
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
package com.njcn.supervision.api;
|
||||
|
||||
import com.njcn.common.pojo.constant.ServerInfo;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.supervision.api.fallback.GeneralSurveyFeignClientFallbackFactory;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
|
||||
/**
|
||||
* 流程实例 Api 接口
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@FeignClient(value = ServerInfo.SUPERVISION, path = "/generalSurvey", fallbackFactory = GeneralSurveyFeignClientFallbackFactory.class)
|
||||
public interface GeneralSurveyFeignClient {
|
||||
|
||||
@GetMapping("/updateStatus")
|
||||
HttpResult<Object> updateStatus(@RequestParam("businessKey") String businessKey, @RequestParam("status")Integer status);
|
||||
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
package com.njcn.supervision.api;
|
||||
|
||||
import com.njcn.common.pojo.constant.ServerInfo;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.supervision.api.fallback.QuitRunningDeviceFeignClientFallbackFactory;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
|
||||
/**
|
||||
* 流程实例 Api 接口
|
||||
*
|
||||
* @author hongawen
|
||||
*/
|
||||
@FeignClient(value = ServerInfo.SUPERVISION, path = "/quitRunningDevice", fallbackFactory = QuitRunningDeviceFeignClientFallbackFactory.class)
|
||||
public interface QuitRunningDeviceFeignClient {
|
||||
|
||||
@GetMapping("/updateDeviceStatus")
|
||||
HttpResult<Object> updateDeviceStatus(@RequestParam("businessKey") String businessKey, @RequestParam("status")Integer status);
|
||||
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
package com.njcn.supervision.api;
|
||||
|
||||
import com.njcn.common.pojo.constant.ServerInfo;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.supervision.api.fallback.SupervisionPlanFeignClientFallbackFactory;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
|
||||
/**
|
||||
* 流程实例 Api 接口
|
||||
*
|
||||
* @author hongawen
|
||||
*/
|
||||
@FeignClient(value = ServerInfo.SUPERVISION, path = "/superPlan", fallbackFactory = SupervisionPlanFeignClientFallbackFactory.class)
|
||||
public interface SupervisionPlanFeignClient {
|
||||
|
||||
@GetMapping("/updateStatus")
|
||||
HttpResult<Object> updateStatus(@RequestParam("businessKey") String businessKey, @RequestParam("status")Integer status);
|
||||
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
package com.njcn.supervision.api;
|
||||
|
||||
import com.njcn.common.pojo.constant.ServerInfo;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.supervision.api.fallback.SurveyPlanFeignClientFallbackFactory;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
|
||||
/**
|
||||
* 流程实例 Api 接口
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@FeignClient(value = ServerInfo.SUPERVISION, path = "/surveyPlan", fallbackFactory = SurveyPlanFeignClientFallbackFactory.class)
|
||||
public interface SurveyPlanFeignClient {
|
||||
|
||||
@GetMapping("/updateSurveyPlanStatus")
|
||||
HttpResult<Object> updateStatus(@RequestParam("businessKey") String businessKey, @RequestParam("status")Integer status);
|
||||
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
package com.njcn.supervision.api;
|
||||
|
||||
import com.njcn.common.pojo.constant.ServerInfo;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.supervision.api.fallback.SurveyPlanFeignClientFallbackFactory;
|
||||
import com.njcn.supervision.api.fallback.SurveyTestFeignClientFallbackFactory;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
|
||||
/**
|
||||
* 流程实例 Api 接口
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@FeignClient(value = ServerInfo.SUPERVISION, path = "/surveyTest", fallbackFactory = SurveyTestFeignClientFallbackFactory.class)
|
||||
public interface SurveyTestFeignClient {
|
||||
|
||||
@GetMapping("/updateSurveyTestStatus")
|
||||
HttpResult<Object> updateStatus(@RequestParam("businessKey") String businessKey, @RequestParam("status")Integer status);
|
||||
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
package com.njcn.supervision.api;
|
||||
|
||||
import com.njcn.common.pojo.constant.ServerInfo;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.supervision.api.fallback.TempLineDebugFeignClientFallbackFactory;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
|
||||
/**
|
||||
* 流程实例 Api 接口
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@FeignClient(value = ServerInfo.SUPERVISION, path = "/tempLinedebug", fallbackFactory = TempLineDebugFeignClientFallbackFactory.class)
|
||||
public interface TempLineDebugFeignClient {
|
||||
|
||||
@GetMapping("/updateStatus")
|
||||
HttpResult<Object> updateStatus(@RequestParam("businessKey") String businessKey, @RequestParam("status")Integer status);
|
||||
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
package com.njcn.supervision.api;
|
||||
|
||||
import com.njcn.common.pojo.constant.ServerInfo;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.supervision.api.fallback.TempLineFeignClientFallbackFactory;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
|
||||
/**
|
||||
* 流程实例 Api 接口
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@FeignClient(value = ServerInfo.SUPERVISION, path = "/tempLine", fallbackFactory = TempLineFeignClientFallbackFactory.class)
|
||||
public interface TempLineFeignClient {
|
||||
|
||||
@GetMapping("/updateStatus")
|
||||
HttpResult<Object> updateStatus(@RequestParam("businessKey") String businessKey, @RequestParam("status")Integer status);
|
||||
|
||||
}
|
||||
@@ -1,24 +1,18 @@
|
||||
package com.njcn.supervision.api;
|
||||
|
||||
import com.njcn.common.pojo.constant.ServerInfo;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.supervision.api.fallback.TempLineDebugFeignClientFallbackFactory;
|
||||
import com.njcn.supervision.api.fallback.TempLineRunTestFeignClientFallbackFactory;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
|
||||
/**
|
||||
* 流程实例 Api 接口
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@FeignClient(value = ServerInfo.SUPERVISION, path = "/supervisionTempLineRunTest", fallbackFactory = TempLineRunTestFeignClientFallbackFactory.class)
|
||||
public interface TempLineRunTestFeignClient {
|
||||
|
||||
@GetMapping("/updateStatus")
|
||||
HttpResult<Object> updateStatus(@RequestParam("businessKey") String businessKey, @RequestParam("status")Integer status);
|
||||
|
||||
@GetMapping("/isTestRunStartOrEnd")
|
||||
void isTestRunStartOrEnd();
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
package com.njcn.supervision.api;
|
||||
|
||||
import com.njcn.common.pojo.constant.ServerInfo;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.supervision.api.fallback.UserReportFeignClientFallbackFactory;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
|
||||
/**
|
||||
* 流程实例 Api 接口
|
||||
*
|
||||
* @author hongawen
|
||||
*/
|
||||
@FeignClient(value = ServerInfo.SUPERVISION, path = "/userReport", fallbackFactory = UserReportFeignClientFallbackFactory.class)
|
||||
public interface UserReportFeignClient {
|
||||
|
||||
@GetMapping("/updateUserReportStatus")
|
||||
HttpResult<Object> updateUserReportStatus(@RequestParam("businessKey") String businessKey, @RequestParam("status")Integer status);
|
||||
|
||||
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
package com.njcn.supervision.api;
|
||||
|
||||
import com.njcn.common.pojo.constant.ServerInfo;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.supervision.api.fallback.UserReportNoramlFeignClientFallbackFactory;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
|
||||
/**
|
||||
* 流程实例 Api 接口
|
||||
*
|
||||
* @author hongawen
|
||||
*/
|
||||
@FeignClient(value = ServerInfo.SUPERVISION, path = "/userReportNormal", fallbackFactory = UserReportNoramlFeignClientFallbackFactory.class)
|
||||
public interface UserReportNormalFeignClient {
|
||||
|
||||
@GetMapping("/updateUserReportNormalStatus")
|
||||
HttpResult<Object> updateUserReportNormalStatus(@RequestParam("businessKey") String businessKey, @RequestParam("status")Integer status);
|
||||
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
package com.njcn.supervision.api;
|
||||
|
||||
import com.njcn.common.pojo.constant.ServerInfo;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.supervision.api.fallback.DeVReportManageFeignClientFallbackFactory;
|
||||
import com.njcn.supervision.api.fallback.WarningLeafletFeignClientFallbackFactory;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
|
||||
/**
|
||||
* 流程实例 Api 接口
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@FeignClient(value = ServerInfo.SUPERVISION, path = "/warningLeaflet", fallbackFactory = WarningLeafletFeignClientFallbackFactory.class)
|
||||
public interface WarningLeafletFeignClient {
|
||||
|
||||
@GetMapping("/updateStatus")
|
||||
HttpResult<Object> updateStatus(@RequestParam("businessKey") String businessKey, @RequestParam("status")Integer status);
|
||||
|
||||
}
|
||||
@@ -3,17 +3,18 @@ package com.njcn.supervision.api.fallback;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.supervision.api.WarningLeafletFeignClient;
|
||||
import com.njcn.supervision.api.BusinessCommonFeignClient;
|
||||
import com.njcn.supervision.utils.SupervisionEnumUtil;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class WarningLeafletFeignClientFallbackFactory implements FallbackFactory<WarningLeafletFeignClient> {
|
||||
public class BusinessCommonFeignClientFallbackFactory implements FallbackFactory<BusinessCommonFeignClient> {
|
||||
@Override
|
||||
public WarningLeafletFeignClient create(Throwable throwable) {
|
||||
public BusinessCommonFeignClient create(Throwable throwable) {
|
||||
//判断抛出异常是否为解码器抛出的业务异常
|
||||
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
|
||||
if (throwable.getCause() instanceof BusinessException) {
|
||||
@@ -21,9 +22,9 @@ public class WarningLeafletFeignClientFallbackFactory implements FallbackFactory
|
||||
exceptionEnum = SupervisionEnumUtil.getExceptionEnum(businessException.getResult());
|
||||
}
|
||||
Enum<?> finalExceptionEnum = exceptionEnum;
|
||||
return new WarningLeafletFeignClient() {
|
||||
return new BusinessCommonFeignClient() {
|
||||
@Override
|
||||
public HttpResult<Object> updateStatus(String businessKey, Integer status) {
|
||||
public HttpResult<Object> updateProcessStatus(String processKey,String businessId, Integer status) {
|
||||
log.error("{}异常,降级处理,异常为:{}", "更新流程状态", throwable.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
package com.njcn.supervision.api.fallback;
|
||||
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.supervision.api.DeVReportManageFeignClient;
|
||||
import com.njcn.supervision.utils.SupervisionEnumUtil;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @author denghuajun
|
||||
* @version 1.0.0
|
||||
* @date 2022/3/16
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class DeVReportManageFeignClientFallbackFactory implements FallbackFactory<DeVReportManageFeignClient> {
|
||||
@Override
|
||||
public DeVReportManageFeignClient create(Throwable throwable) {
|
||||
//判断抛出异常是否为解码器抛出的业务异常
|
||||
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
|
||||
if (throwable.getCause() instanceof BusinessException) {
|
||||
BusinessException businessException = (BusinessException) throwable.getCause();
|
||||
exceptionEnum = SupervisionEnumUtil.getExceptionEnum(businessException.getResult());
|
||||
}
|
||||
Enum<?> finalExceptionEnum = exceptionEnum;
|
||||
return new DeVReportManageFeignClient() {
|
||||
@Override
|
||||
public HttpResult<Object> updateStatus(String businessKey, Integer status) {
|
||||
log.error("{}异常,降级处理,异常为:{}", "更新流程状态", throwable.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
package com.njcn.supervision.api.fallback;
|
||||
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.supervision.api.GeneralSurveyFeignClient;
|
||||
import com.njcn.supervision.utils.SupervisionEnumUtil;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @author denghuajun
|
||||
* @version 1.0.0
|
||||
* @date 2022/3/16
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class GeneralSurveyFeignClientFallbackFactory implements FallbackFactory<GeneralSurveyFeignClient> {
|
||||
@Override
|
||||
public GeneralSurveyFeignClient create(Throwable throwable) {
|
||||
//判断抛出异常是否为解码器抛出的业务异常
|
||||
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
|
||||
if (throwable.getCause() instanceof BusinessException) {
|
||||
BusinessException businessException = (BusinessException) throwable.getCause();
|
||||
exceptionEnum = SupervisionEnumUtil.getExceptionEnum(businessException.getResult());
|
||||
}
|
||||
Enum<?> finalExceptionEnum = exceptionEnum;
|
||||
return new GeneralSurveyFeignClient() {
|
||||
@Override
|
||||
public HttpResult<Object> updateStatus(String businessKey, Integer status) {
|
||||
log.error("{}异常,降级处理,异常为:{}", "更新普测计划流程状态", throwable.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
package com.njcn.supervision.api.fallback;
|
||||
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.supervision.api.QuitRunningDeviceFeignClient;
|
||||
import com.njcn.supervision.utils.SupervisionEnumUtil;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @author denghuajun
|
||||
* @version 1.0.0
|
||||
* @date 2022/3/16
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class QuitRunningDeviceFeignClientFallbackFactory implements FallbackFactory<QuitRunningDeviceFeignClient> {
|
||||
@Override
|
||||
public QuitRunningDeviceFeignClient create(Throwable throwable) {
|
||||
//判断抛出异常是否为解码器抛出的业务异常
|
||||
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
|
||||
if (throwable.getCause() instanceof BusinessException) {
|
||||
BusinessException businessException = (BusinessException) throwable.getCause();
|
||||
exceptionEnum = SupervisionEnumUtil.getExceptionEnum(businessException.getResult());
|
||||
}
|
||||
Enum<?> finalExceptionEnum = exceptionEnum;
|
||||
return new QuitRunningDeviceFeignClient() {
|
||||
@Override
|
||||
public HttpResult<Object> updateDeviceStatus(String businessKey, Integer status) {
|
||||
log.error("{}异常,降级处理,异常为:{}", "更新退运装置数据流程状态", throwable.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
package com.njcn.supervision.api.fallback;
|
||||
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.supervision.api.SupervisionPlanFeignClient;
|
||||
import com.njcn.supervision.utils.SupervisionEnumUtil;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @author denghuajun
|
||||
* @version 1.0.0
|
||||
* @date 2022/3/16
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class SupervisionPlanFeignClientFallbackFactory implements FallbackFactory<SupervisionPlanFeignClient> {
|
||||
@Override
|
||||
public SupervisionPlanFeignClient create(Throwable throwable) {
|
||||
//判断抛出异常是否为解码器抛出的业务异常
|
||||
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
|
||||
if (throwable.getCause() instanceof BusinessException) {
|
||||
BusinessException businessException = (BusinessException) throwable.getCause();
|
||||
exceptionEnum = SupervisionEnumUtil.getExceptionEnum(businessException.getResult());
|
||||
}
|
||||
Enum<?> finalExceptionEnum = exceptionEnum;
|
||||
return new SupervisionPlanFeignClient() {
|
||||
@Override
|
||||
public HttpResult<Object> updateStatus(String businessKey, Integer status) {
|
||||
log.error("{}异常,降级处理,异常为:{}", "更新退运装置数据流程状态", throwable.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
package com.njcn.supervision.api.fallback;
|
||||
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.supervision.api.SurveyPlanFeignClient;
|
||||
import com.njcn.supervision.utils.SupervisionEnumUtil;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @author denghuajun
|
||||
* @version 1.0.0
|
||||
* @date 2022/3/16
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class SurveyPlanFeignClientFallbackFactory implements FallbackFactory<SurveyPlanFeignClient> {
|
||||
@Override
|
||||
public SurveyPlanFeignClient create(Throwable throwable) {
|
||||
//判断抛出异常是否为解码器抛出的业务异常
|
||||
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
|
||||
if (throwable.getCause() instanceof BusinessException) {
|
||||
BusinessException businessException = (BusinessException) throwable.getCause();
|
||||
exceptionEnum = SupervisionEnumUtil.getExceptionEnum(businessException.getResult());
|
||||
}
|
||||
Enum<?> finalExceptionEnum = exceptionEnum;
|
||||
return new SurveyPlanFeignClient() {
|
||||
@Override
|
||||
public HttpResult<Object> updateStatus(String businessKey, Integer status) {
|
||||
log.error("{}异常,降级处理,异常为:{}", "更新普测计划流程状态", throwable.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
package com.njcn.supervision.api.fallback;
|
||||
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.supervision.api.SurveyTestFeignClient;
|
||||
import com.njcn.supervision.utils.SupervisionEnumUtil;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @author denghuajun
|
||||
* @version 1.0.0
|
||||
* @date 2022/3/16
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class SurveyTestFeignClientFallbackFactory implements FallbackFactory<SurveyTestFeignClient> {
|
||||
@Override
|
||||
public SurveyTestFeignClient create(Throwable throwable) {
|
||||
//判断抛出异常是否为解码器抛出的业务异常
|
||||
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
|
||||
if (throwable.getCause() instanceof BusinessException) {
|
||||
BusinessException businessException = (BusinessException) throwable.getCause();
|
||||
exceptionEnum = SupervisionEnumUtil.getExceptionEnum(businessException.getResult());
|
||||
}
|
||||
Enum<?> finalExceptionEnum = exceptionEnum;
|
||||
return new SurveyTestFeignClient() {
|
||||
@Override
|
||||
public HttpResult<Object> updateStatus(String businessKey, Integer status) {
|
||||
log.error("{}异常,降级处理,异常为:{}", "更新退运装置数据流程状态", throwable.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
package com.njcn.supervision.api.fallback;
|
||||
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.supervision.api.TempLineDebugFeignClient;
|
||||
import com.njcn.supervision.utils.SupervisionEnumUtil;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @author denghuajun
|
||||
* @version 1.0.0
|
||||
* @date 2022/3/16
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class TempLineDebugFeignClientFallbackFactory implements FallbackFactory<TempLineDebugFeignClient> {
|
||||
@Override
|
||||
public TempLineDebugFeignClient create(Throwable throwable) {
|
||||
//判断抛出异常是否为解码器抛出的业务异常
|
||||
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
|
||||
if (throwable.getCause() instanceof BusinessException) {
|
||||
BusinessException businessException = (BusinessException) throwable.getCause();
|
||||
exceptionEnum = SupervisionEnumUtil.getExceptionEnum(businessException.getResult());
|
||||
}
|
||||
Enum<?> finalExceptionEnum = exceptionEnum;
|
||||
return new TempLineDebugFeignClient() {
|
||||
@Override
|
||||
public HttpResult<Object> updateStatus(String businessKey, Integer status) {
|
||||
log.error("{}异常,降级处理,异常为:{}", "更新流程状态", throwable.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
package com.njcn.supervision.api.fallback;
|
||||
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.supervision.api.TempLineFeignClient;
|
||||
import com.njcn.supervision.utils.SupervisionEnumUtil;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @author denghuajun
|
||||
* @version 1.0.0
|
||||
* @date 2022/3/16
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class TempLineFeignClientFallbackFactory implements FallbackFactory<TempLineFeignClient> {
|
||||
@Override
|
||||
public TempLineFeignClient create(Throwable throwable) {
|
||||
//判断抛出异常是否为解码器抛出的业务异常
|
||||
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
|
||||
if (throwable.getCause() instanceof BusinessException) {
|
||||
BusinessException businessException = (BusinessException) throwable.getCause();
|
||||
exceptionEnum = SupervisionEnumUtil.getExceptionEnum(businessException.getResult());
|
||||
}
|
||||
Enum<?> finalExceptionEnum = exceptionEnum;
|
||||
return new TempLineFeignClient() {
|
||||
@Override
|
||||
public HttpResult<Object> updateStatus(String businessKey, Integer status) {
|
||||
log.error("{}异常,降级处理,异常为:{}", "更新流程状态", throwable.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -3,18 +3,13 @@ package com.njcn.supervision.api.fallback;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.supervision.api.TempLineFeignClient;
|
||||
import com.njcn.supervision.api.TempLineRunTestFeignClient;
|
||||
import com.njcn.supervision.utils.SupervisionEnumUtil;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @author denghuajun
|
||||
* @version 1.0.0
|
||||
* @date 2022/3/16
|
||||
*/
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class TempLineRunTestFeignClientFallbackFactory implements FallbackFactory<TempLineRunTestFeignClient> {
|
||||
@@ -28,11 +23,6 @@ public class TempLineRunTestFeignClientFallbackFactory implements FallbackFactor
|
||||
}
|
||||
Enum<?> finalExceptionEnum = exceptionEnum;
|
||||
return new TempLineRunTestFeignClient() {
|
||||
@Override
|
||||
public HttpResult<Object> updateStatus(String businessKey, Integer status) {
|
||||
log.error("{}异常,降级处理,异常为:{}", "更新流程状态", throwable.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void isTestRunStartOrEnd() {
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
package com.njcn.supervision.api.fallback;
|
||||
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.supervision.api.UserReportFeignClient;
|
||||
import com.njcn.supervision.utils.SupervisionEnumUtil;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @author denghuajun
|
||||
* @version 1.0.0
|
||||
* @date 2022/3/16
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class UserReportFeignClientFallbackFactory implements FallbackFactory<UserReportFeignClient> {
|
||||
@Override
|
||||
public UserReportFeignClient create(Throwable throwable) {
|
||||
//判断抛出异常是否为解码器抛出的业务异常
|
||||
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
|
||||
if (throwable.getCause() instanceof BusinessException) {
|
||||
BusinessException businessException = (BusinessException) throwable.getCause();
|
||||
exceptionEnum = SupervisionEnumUtil.getExceptionEnum(businessException.getResult());
|
||||
}
|
||||
Enum<?> finalExceptionEnum = exceptionEnum;
|
||||
return new UserReportFeignClient() {
|
||||
@Override
|
||||
public HttpResult<Object> updateUserReportStatus(String businessKey, Integer status) {
|
||||
log.error("{}异常,降级处理,异常为:{}", "更新用户数据流程状态", throwable.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
package com.njcn.supervision.api.fallback;
|
||||
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.supervision.api.UserReportNormalFeignClient;
|
||||
import com.njcn.supervision.utils.SupervisionEnumUtil;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @author denghuajun
|
||||
* @version 1.0.0
|
||||
* @date 2022/3/16
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class UserReportNoramlFeignClientFallbackFactory implements FallbackFactory<UserReportNormalFeignClient> {
|
||||
@Override
|
||||
public UserReportNormalFeignClient create(Throwable throwable) {
|
||||
//判断抛出异常是否为解码器抛出的业务异常
|
||||
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
|
||||
if (throwable.getCause() instanceof BusinessException) {
|
||||
BusinessException businessException = (BusinessException) throwable.getCause();
|
||||
exceptionEnum = SupervisionEnumUtil.getExceptionEnum(businessException.getResult());
|
||||
}
|
||||
Enum<?> finalExceptionEnum = exceptionEnum;
|
||||
return new UserReportNormalFeignClient() {
|
||||
@Override
|
||||
public HttpResult<Object> updateUserReportNormalStatus(String businessKey, Integer status) {
|
||||
log.error("{}异常,降级处理,异常为:{}", "更新用户数据流程状态", throwable.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -42,6 +42,7 @@ public enum SupervisionKeyEnum {
|
||||
}
|
||||
|
||||
private static final String packagePrefix = "com.njcn.supervision.service.";
|
||||
private static final String packageMiddle = ".impl.";
|
||||
|
||||
/**
|
||||
* 根据流程key获取类的全路径,用于获取spring中的对象
|
||||
@@ -49,9 +50,22 @@ public enum SupervisionKeyEnum {
|
||||
public static String getFullServicePathByKey(String key){
|
||||
for (SupervisionKeyEnum superviceKeyEnum : SupervisionKeyEnum.values()) {
|
||||
if (superviceKeyEnum.key.equalsIgnoreCase(key)) {
|
||||
return packagePrefix.concat(superviceKeyEnum.servicePrefix).concat(StrPool.DOT).concat(superviceKeyEnum.clazzName);
|
||||
return packagePrefix.concat(superviceKeyEnum.servicePrefix).concat(packageMiddle).concat(superviceKeyEnum.clazzName);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 判断流程key是否在当前枚举内
|
||||
*/
|
||||
public static boolean containBusinessKye(String key){
|
||||
for (SupervisionKeyEnum superviceKeyEnum : SupervisionKeyEnum.values()) {
|
||||
if (superviceKeyEnum.key.equalsIgnoreCase(key)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ public enum SupervisionResponseEnum {
|
||||
*/
|
||||
SUPERVISION_COMMON_ERROR("A00550","监督管理模块异常"),
|
||||
IMPORT_SENSITIVE_USER_ERROR("A00550","导入敏感及重要用户失败"),
|
||||
SUPERVISION_SERVICE_NOT_FOUND("A00550","业务实现类丢失,清查看类路径配置"),
|
||||
DATA_NOT_EXISTS("A00550","数据不存在"),
|
||||
NO_POWER("A00550","不能操作非自己创建的任务!")
|
||||
;
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
package com.njcn.supervision.controller;
|
||||
|
||||
import cn.hutool.extra.spring.SpringUtil;
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.supervision.enums.SupervisionKeyEnum;
|
||||
import com.njcn.supervision.enums.SupervisionResponseEnum;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import springfox.documentation.annotations.ApiIgnore;
|
||||
import com.njcn.bpm.service.IBpmService;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/supervision")
|
||||
@Api(tags = "所有业务流程公共方法管理")
|
||||
@AllArgsConstructor
|
||||
@ApiIgnore
|
||||
public class BusinessCommonController extends BaseController {
|
||||
|
||||
|
||||
@ApiIgnore
|
||||
@GetMapping("/updateProcessStatus")
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@ApiOperation("更新流程状态")
|
||||
public HttpResult<Object> updateProcessStatus(String processKey,String businessId, Integer status) {
|
||||
String methodDescribe = getMethodDescribe("updateProcessStatus");
|
||||
IBpmService iBpmService = getBpmServiceByBusinessKey(processKey);
|
||||
iBpmService.updateProcessStatus(businessId, status);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据业务流key获取实现类对象
|
||||
* @param processKey 业务流key
|
||||
*/
|
||||
private IBpmService getBpmServiceByBusinessKey(String processKey) {
|
||||
String fullServicePath = SupervisionKeyEnum.getFullServicePathByKey(processKey);
|
||||
IBpmService executor;
|
||||
try {
|
||||
executor = (IBpmService) SpringUtil.getBean(Class.forName(fullServicePath));
|
||||
} catch (ClassNotFoundException e) {
|
||||
throw new BusinessException(SupervisionResponseEnum.SUPERVISION_SERVICE_NOT_FOUND);
|
||||
}
|
||||
return executor;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -72,7 +72,7 @@ public class SurveyPlanServiceImpl extends ServiceImpl<SurveyPlanMapper, SurveyP
|
||||
QueryWrapper<SurveyPlanVO> surveyPlanVOQueryWrapper = new QueryWrapper<>();
|
||||
if (Objects.nonNull(surveyPlanQueryParam)) {
|
||||
//添加上时间范围
|
||||
surveyPlanVOQueryWrapper.between("supervision_survey_plan.Create_Time",
|
||||
surveyPlanVOQueryWrapper.between("supervision_survey_plan.plan_start_time",
|
||||
DateUtil.beginOfDay(DateUtil.parse(surveyPlanQueryParam.getSearchBeginTime())),
|
||||
DateUtil.endOfDay(DateUtil.parse(surveyPlanQueryParam.getSearchEndTime())));
|
||||
//根据工程名称模糊搜索
|
||||
|
||||
Reference in New Issue
Block a user