<file_sep>package com.fy.springmiracledemo2.util;

/**
 * @Description   :  java类作用描述
 * @author        :  fuhw
 * @CreateDate    :  2020/7/7 16:15
 * @UpdateUser    :  fuhw
 * @UpdateDate    :  2020/7/7 16:15
 * @UpdateRemark  :  修改内容
 * @Version       :  1.0
 */
public class ResultMsg {
    /**
     * 响应编码，0是正常，其他异常，详细看msg
     */
    private int statusCode = 0;

    /**
     * 响应信息
     */
    private String message;

    private Object data;

    public ResultMsg(){

    }

    ResultMsg(int code, String msg){
        this.statusCode =code;
        this.message = msg;
    }

    public int getStatusCode() {
        return statusCode;
    }

    public void setStatusCode(int statusCode) {
        this.statusCode = statusCode;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public static ResultMsg ok(){
        return new ResultMsg(0,"success");
    }

    public static ResultMsg error(int code,String msg){
        return new ResultMsg(code,msg);
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }
}
<file_sep>/*
package com.fy.springmiracledemo.rocket;

import org.apache.rocketmq.common.message.MessageExt;

import java.util.List;

*/
/**
  * @author fuhw
  * @date 2019/12/10 9:59
  * @ClassName MQMsgProcessor
  * @Description 
  *//*

public interface MQMsgProcessor {

    */
/**
     * 消息处理<br/>
     * 如果没有return true ，consumer会重新消费该消息，直到return true<br/>
     * consumer可能重复消费该消息，请在业务端自己做是否重复调用处理，该接口设计为幂等接口
     *
     * @param topic 消息主题
     * @param tag   消息标签
     * @param msgs  消息
     * @return 2019年12月10日 fuhw
     *//*

    MQConsumeResult handle(String topic, String tag, List<MessageExt> msgs);
}

*/
<file_sep>package com.fy.springmiracledemo;

import com.ctrip.framework.apollo.Config;
import com.ctrip.framework.apollo.ConfigService;
import com.ctrip.framework.apollo.spring.annotation.EnableApolloConfig;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;

@SpringBootApplication
@EnableEurekaClient
//@EnableApolloConfig
public class SpringMiracleDemoApplication {

    public static void main(String[] args) {
        SpringApplication.run(SpringMiracleDemoApplication.class, args);
//        Config config = ConfigService.getAppConfig();
//        String fuhognwei = config.getProperty("fuhongwei", "defaultValue");
//        System.out.println(fuhognwei);
    }

}
<file_sep>package com.fy.springmiracledemo2.util;

import com.alibaba.fastjson.JSONObject;

/**
 * @Description   :  java类作用描述
 * @author        :  fuhw
 * @CreateDate    :  2020/7/7 16:16
 * @UpdateUser    :  fuhw
 * @UpdateDate    :  2020/7/7 16:16
 * @UpdateRemark  :  修改内容
 * @Version       :  1.0
 */
public class RequestMsg {

    /**
     * 基础授权信息
     */
    private JSONObject authInfo;

    /**
     * 业务数据
     */
    private JSONObject data;

    public JSONObject getAuthInfo() {
        return authInfo;
    }

    public void setAuthInfo(JSONObject authInfo) {
        this.authInfo = authInfo;
    }

    public JSONObject getData() {
        return data;
    }

    public void setData(JSONObject data) {
        this.data = data;
    }
}
<file_sep>package com.fy.springmiracledemo2.util;

import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.data.redis.core.ValueOperations;

import java.util.concurrent.TimeUnit;

/**
 * @Description   :  java类作用描述
 * @author        :  fuhw
 * @CreateDate    :  2020/7/7 16:15
 * @UpdateUser    :  fuhw
 * @UpdateDate    :  2020/7/7 16:15
 * @UpdateRemark  :  修改内容
 * @Version       :  1.0
 */
public class RedisClient {

	private StringRedisTemplate redisTemplate;
	
	public void setRedisTemplate(StringRedisTemplate redisTemplate) {
		this.redisTemplate = redisTemplate;
	}

	public RedisTemplate<String, String> getRedisTemplate() {
		return redisTemplate;
	}

	public void set(String key, String val) throws Exception {
		 ValueOperations<String, String> ops = redisTemplate.opsForValue();
		 ops.set(key, val);
	}

	public Boolean set(String key, String val, long expireSecond) throws Exception {
		 ValueOperations<String, String> ops = redisTemplate.opsForValue();
		 ops.set(key, val);
		 return redisTemplate.expire(key, expireSecond, TimeUnit.SECONDS);
	}
	
	public String get(String key) throws Exception {
		 ValueOperations<String, String> ops = redisTemplate.opsForValue();
		 return ops.get(key);
	}
	
	public Boolean exists(String key) throws Exception {
		return redisTemplate.hasKey(key);
	}
	
}

<file_sep>package com.fy.springmiracledemo2;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class SpringMiracleDemo2Application {

    public static void main(String[] args) {
        SpringApplication.run(SpringMiracleDemo2Application.class, args);
    }

}
