RabbitMqErrorLogConfig.java 4.18 KB
package com.topdraw.config;

import lombok.Data;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

import java.util.List;
import java.util.Map;

/**
 * @author :
 * @description:
 * @function :
 * @date :Created in 2022/5/12 12:37
 * @version: :
 * @modified By:
 * @since : modified in 2022/5/12 12:37
 */
@Data
//@Configuration
//@ConfigurationProperties(prefix = "service.mq.error.logs")
public class RabbitMqErrorLogConfig {

    private List<Map<String, String>> list;

    /**
     * uce
     * @return
     */
    public Map<String, String> getWechatError() {

        if (CollectionUtils.isNotEmpty(list)) {

            for (Map<String, String> map : list) {
                String type = map.get("type");
                if (type.equalsIgnoreCase("wechat")) {
                    return map;
                }
            }

        }

        return null;
    }

    /**
     * uce
     * @return
     */
    public Map<String, String> getUceError() {

        if (CollectionUtils.isNotEmpty(list)) {

            for (Map<String, String> map : list) {
                String type = map.get("type");
                if (type.equalsIgnoreCase("uce")) {
                    return map;
                }
            }

        }

        return null;
    }

    /**
     * ucg
     * @return
     */
    public Map<String, String> getUcgError() {

        if (CollectionUtils.isNotEmpty(list)) {

            for (Map<String, String> map : list) {
                String type = map.get("type");
                if (type.equalsIgnoreCase("ucg")) {
                    return map;
                }
            }

        }

        return null;
    }

    /**
     * 数据总线
     * @return
     */
    public Map<String, String> getEventBusError() {

        if (CollectionUtils.isNotEmpty(list)) {

            for (Map<String, String> map : list) {
                String type = map.get("type");
                if (type.equalsIgnoreCase("eventBus")) {
                    return map;
                }
            }

        }

        return null;
    }

    /**
     * 个人信息完善
     * @return
     */
    public Map<String, String> getCompleteInfoError() {

        if (CollectionUtils.isNotEmpty(list)) {

            for (Map<String, String> map : list) {
                String type = map.get("type");
                if (type.equalsIgnoreCase("completeInfo")) {
                    return map;
                }
            }

        }

        return null;
    }

    /**
     * 订购
     * @return
     */
    public Map<String, String> getOrderError() {

        if (CollectionUtils.isNotEmpty(list)) {

            for (Map<String, String> map : list) {
                String type = map.get("type");
                if (type.equalsIgnoreCase("order")) {
                    return map;
                }
            }

        }

        return null;
    }

    /**
     * 参加活动
     * @return
     */
    public Map<String, String> getActivityError() {

        if (CollectionUtils.isNotEmpty(list)) {

            for (Map<String, String> map : list) {
                String type = map.get("type");
                if (type.equalsIgnoreCase("activity")) {
                    return map;
                }
            }

        }

        return null;
    }

    /**
     * 签到
     * @return
     */
    public Map<String, String> getSignError() {

        if (CollectionUtils.isNotEmpty(list)) {

            for (Map<String, String> map : list) {
                String type = map.get("type");
                if (type.equalsIgnoreCase("sign")) {
                    return map;
                }
            }

        }

        return null;
    }

    /**
     * 观影、播放记录
     * @return
     */
    public Map<String, String> getPlayError() {

        if (CollectionUtils.isNotEmpty(list)) {

            for (Map<String, String> map : list) {
                String type = map.get("type");
                if (type.equalsIgnoreCase("play")) {
                    return map;
                }
            }

        }

        return null;
    }


}