责任链代码风格 统一

pull/6/head
3y 3 years ago
parent 1beb92804e
commit 9420e13919

@ -18,8 +18,9 @@ import org.springframework.stereotype.Component;
/** /**
* Task * Task
* 0. * 0.
* 1. * 2.
* 2. * 2.
* 3.
* *
* @author 3y * @author 3y
*/ */

@ -13,6 +13,7 @@ import com.java3y.austin.service.api.impl.domain.SendTaskModel;
import com.java3y.austin.support.pipeline.BusinessProcess; import com.java3y.austin.support.pipeline.BusinessProcess;
import com.java3y.austin.support.pipeline.ProcessContext; import com.java3y.austin.support.pipeline.ProcessContext;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
@ -25,6 +26,7 @@ import java.util.stream.Collectors;
* *
*/ */
@Slf4j @Slf4j
@Service
public class AfterParamCheckAction implements BusinessProcess<SendTaskModel> { public class AfterParamCheckAction implements BusinessProcess<SendTaskModel> {

@ -21,6 +21,7 @@ import com.java3y.austin.support.utils.ContentHolderUtil;
import com.java3y.austin.support.utils.TaskInfoUtils; import com.java3y.austin.support.utils.TaskInfoUtils;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.util.*; import java.util.*;
@ -31,6 +32,7 @@ import java.util.*;
* @description * @description
*/ */
@Slf4j @Slf4j
@Service
public class AssembleAction implements BusinessProcess<SendTaskModel> { public class AssembleAction implements BusinessProcess<SendTaskModel> {
@Autowired @Autowired

@ -9,6 +9,7 @@ import com.java3y.austin.service.api.impl.domain.SendTaskModel;
import com.java3y.austin.support.pipeline.BusinessProcess; import com.java3y.austin.support.pipeline.BusinessProcess;
import com.java3y.austin.support.pipeline.ProcessContext; import com.java3y.austin.support.pipeline.ProcessContext;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -19,6 +20,7 @@ import java.util.stream.Collectors;
* @description * @description
*/ */
@Slf4j @Slf4j
@Service
public class PreParamCheckAction implements BusinessProcess<SendTaskModel> { public class PreParamCheckAction implements BusinessProcess<SendTaskModel> {
@Override @Override

@ -13,12 +13,14 @@ import com.java3y.austin.support.utils.KafkaUtils;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
/** /**
* @author 3y * @author 3y
* MQ * MQ
*/ */
@Slf4j @Slf4j
@Service
public class SendMqAction implements BusinessProcess<SendTaskModel> { public class SendMqAction implements BusinessProcess<SendTaskModel> {
@Autowired @Autowired

@ -6,15 +6,15 @@ import com.java3y.austin.service.api.impl.action.AfterParamCheckAction;
import com.java3y.austin.service.api.impl.action.AssembleAction; import com.java3y.austin.service.api.impl.action.AssembleAction;
import com.java3y.austin.service.api.impl.action.PreParamCheckAction; import com.java3y.austin.service.api.impl.action.PreParamCheckAction;
import com.java3y.austin.service.api.impl.action.SendMqAction; import com.java3y.austin.service.api.impl.action.SendMqAction;
import com.java3y.austin.service.api.impl.domain.SendTaskModel;
import com.java3y.austin.support.pipeline.BusinessProcess; import com.java3y.austin.support.pipeline.BusinessProcess;
import com.java3y.austin.support.pipeline.ProcessController; import com.java3y.austin.support.pipeline.ProcessController;
import com.java3y.austin.support.pipeline.ProcessTemplate; import com.java3y.austin.support.pipeline.ProcessTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import java.util.ArrayList; import java.util.*;
import java.util.HashMap;
import java.util.Map;
/** /**
* apipipeline * apipipeline
@ -23,6 +23,14 @@ import java.util.Map;
@Configuration @Configuration
public class PipelineConfig { public class PipelineConfig {
@Autowired
private PreParamCheckAction preParamCheckAction;
@Autowired
private AssembleAction assembleAction;
@Autowired
private AfterParamCheckAction afterParamCheckAction;
@Autowired
private SendMqAction sendMqAction;
/** /**
* *
@ -35,14 +43,8 @@ public class PipelineConfig {
@Bean("commonSendTemplate") @Bean("commonSendTemplate")
public ProcessTemplate commonSendTemplate() { public ProcessTemplate commonSendTemplate() {
ProcessTemplate processTemplate = new ProcessTemplate(); ProcessTemplate processTemplate = new ProcessTemplate();
ArrayList<BusinessProcess> processList = new ArrayList<>(); processTemplate.setProcessList(Arrays.asList(preParamCheckAction, assembleAction,
afterParamCheckAction, sendMqAction));
processList.add(preParamCheckAction());
processList.add(assembleAction());
processList.add(afterParamCheckAction());
processList.add(sendMqAction());
processTemplate.setProcessList(processList);
return processTemplate; return processTemplate;
} }
@ -62,45 +64,4 @@ public class PipelineConfig {
return processController; return processController;
} }
/**
* Action
*
* @return
*/
@Bean
public AssembleAction assembleAction() {
return new AssembleAction();
}
/**
* Action
*
* @return
*/
@Bean
public PreParamCheckAction preParamCheckAction() {
return new PreParamCheckAction();
}
/**
* Action
*
* @return
*/
@Bean
public AfterParamCheckAction afterParamCheckAction() {
return new AfterParamCheckAction();
}
/**
* MQAction
*
* @return
*/
@Bean
public SendMqAction sendMqAction() {
return new SendMqAction();
}
} }

Loading…
Cancel
Save