yangys
2024-09-27 26f8e5990686bdba2119024a260d986266506757
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package com.qianwen.mdc.collect.service.feedback;
 
import com.google.common.collect.ImmutableMap;
import java.util.Map;
import com.qianwen.core.tool.utils.SpringUtil;
import com.qianwen.mdc.collect.enums.FeedbackTypeEnum;
 
public class WorkstationFeedbackHandlerFactory {
    static Map<Integer, WorkstationFeedbackHandlerStrategy> handlerStrategyMap = new ImmutableMap.Builder<Integer, WorkstationFeedbackHandlerStrategy>().put(FeedbackTypeEnum.TIME_RANGE_FEEDBACK.getType(), SpringUtil.getBean(NoImmediateFeedbackHandlerStrategy.class)).put(FeedbackTypeEnum.IMMEDIATE_FEEDBACK.getType(), SpringUtil.getBean(ImmediateFeedbackHandlerStrategy.class)).put(FeedbackTypeEnum.CANCEL_FEEDBACK.getType(), SpringUtil.getBean(CancelFeedbackHandlerStrategy.class)).build();
 
    public static class SingletonHolder {
        public static WorkstationFeedbackHandlerFactory feedbackHandlerFactory = new WorkstationFeedbackHandlerFactory();
    }
 
    public static WorkstationFeedbackHandlerFactory getInstance() {
        return SingletonHolder.feedbackHandlerFactory;
    }
 
    public WorkstationFeedbackHandlerStrategy getConcreteStrategy(Integer feedbackType) {
        return handlerStrategyMap.get(feedbackType);
    }
}