Commit c22b869b by hweeeeeei

编码优化

parent 60209023
...@@ -103,7 +103,7 @@ public class NettyApiRequest { ...@@ -103,7 +103,7 @@ public class NettyApiRequest {
} }
// 从redis获取jwt的token 验签token // 从redis获取jwt的token 验签token
JwtToken jwtToken = shiroLoginService.getTJwtTokenForRedis(token); JwtToken jwtToken = shiroLoginService.getJwtTokenForRedis(token);
if (jwtToken == null) { if (jwtToken == null) {
log.info("jwtToken == null ,token和redis不一致, clientId:" + clientId + ",token:" + token); log.info("jwtToken == null ,token和redis不一致, clientId:" + clientId + ",token:" + token);
......
...@@ -203,6 +203,7 @@ public abstract class AndroidNotification extends UmengNotification { ...@@ -203,6 +203,7 @@ public abstract class AndroidNotification extends UmengNotification {
setPredefinedKeyValue("custom", custom); setPredefinedKeyValue("custom", custom);
} }
@SuppressWarnings("AliMissingOverrideAnnotation")
public enum DisplayType { public enum DisplayType {
NOTIFICATION { NOTIFICATION {
public String getValue() { public String getValue() {
......
...@@ -15,20 +15,21 @@ import java.nio.charset.StandardCharsets; ...@@ -15,20 +15,21 @@ import java.nio.charset.StandardCharsets;
public class PushClient { public class PushClient {
// The host // The host
protected static final String host = "http://msg.umeng.com"; protected static final String HOST = "http://msg.umeng.com";
// The upload path // The upload path
protected static final String uploadPath = "/upload"; protected static final String UPLOAD_PATH = "/upload";
// The post path // The post path
protected static final String postPath = "/api/send"; protected static final String POST_PATH = "/api/send";
// The user agent // The user agent
protected final String USER_AGENT = "Mozilla/5.0"; protected final String USER_AGENT = "Mozilla/5.0";
// This object is used for sending the post request to Umeng // This object is used for sending the post request to Umeng
@SuppressWarnings("AliDeprecation")
protected HttpClient client = new DefaultHttpClient(); protected HttpClient client = new DefaultHttpClient();
public boolean send(UmengNotification msg) throws Exception { public boolean send(UmengNotification msg) throws Exception {
String timestamp = Integer.toString((int) (System.currentTimeMillis() / 1000)); String timestamp = Integer.toString((int) (System.currentTimeMillis() / 1000));
msg.setPredefinedKeyValue("timestamp", timestamp); msg.setPredefinedKeyValue("timestamp", timestamp);
String url = host + postPath; String url = HOST + POST_PATH;
String postBody = msg.getPostBody(); String postBody = msg.getPostBody();
String sign = DigestUtils.md5Hex(("POST" + url + postBody + msg.getAppMasterSecret()).getBytes(StandardCharsets.UTF_8)); String sign = DigestUtils.md5Hex(("POST" + url + postBody + msg.getAppMasterSecret()).getBytes(StandardCharsets.UTF_8));
url = url + "?sign=" + sign; url = url + "?sign=" + sign;
...@@ -64,7 +65,7 @@ public class PushClient { ...@@ -64,7 +65,7 @@ public class PushClient {
uploadJson.put("timestamp", timestamp); uploadJson.put("timestamp", timestamp);
uploadJson.put("content", contents); uploadJson.put("content", contents);
// Construct the request // Construct the request
String url = host + uploadPath; String url = HOST + UPLOAD_PATH;
String postBody = uploadJson.toString(); String postBody = uploadJson.toString();
String sign = DigestUtils.md5Hex(("POST" + url + postBody + appMasterSecret).getBytes(StandardCharsets.UTF_8)); String sign = DigestUtils.md5Hex(("POST" + url + postBody + appMasterSecret).getBytes(StandardCharsets.UTF_8));
url = url + "?sign=" + sign; url = url + "?sign=" + sign;
......
...@@ -37,7 +37,7 @@ public class GetIpUtils { ...@@ -37,7 +37,7 @@ public class GetIpUtils {
* 服务器运营商local,aws,huawei * 服务器运营商local,aws,huawei
*/ */
@Value("${load-blance.server-type}") @Value("${load-blance.server-type}")
private String SERVER_TYPE; private String serverType;
/** /**
* 判断是否为虚拟mac地址 * 判断是否为虚拟mac地址
...@@ -53,7 +53,7 @@ public class GetIpUtils { ...@@ -53,7 +53,7 @@ public class GetIpUtils {
/* /*
* 排除无效的mac地址 * 排除无效的mac地址
*/ */
byte[][] INVALID_MACS = { byte[][] invalidMacs = {
{0x00, 0x05, 0x69}, // VMWare {0x00, 0x05, 0x69}, // VMWare
{0x00, 0x1C, 0x14}, // VMWare {0x00, 0x1C, 0x14}, // VMWare
{0x00, 0x0C, 0x29}, // VMWare {0x00, 0x0C, 0x29}, // VMWare
...@@ -64,7 +64,7 @@ public class GetIpUtils { ...@@ -64,7 +64,7 @@ public class GetIpUtils {
{0x00, 0x15, 0x5D} // Hyper-V {0x00, 0x15, 0x5D} // Hyper-V
}; };
for (byte[] invalid : INVALID_MACS) { for (byte[] invalid : invalidMacs) {
if (invalid[0] == mac[0] && invalid[1] == mac[1] && invalid[2] == mac[2]) { if (invalid[0] == mac[0] && invalid[1] == mac[1] && invalid[2] == mac[2]) {
return true; return true;
} }
...@@ -133,7 +133,7 @@ public class GetIpUtils { ...@@ -133,7 +133,7 @@ public class GetIpUtils {
public String getPublicIp() { public String getPublicIp() {
if (PUBLIC_IP == null) { if (PUBLIC_IP == null) {
switch (SERVER_TYPE) { switch (serverType) {
case LOCAL: case LOCAL:
PUBLIC_IP = getlanIp(); PUBLIC_IP = getlanIp();
break; break;
...@@ -143,6 +143,7 @@ public class GetIpUtils { ...@@ -143,6 +143,7 @@ public class GetIpUtils {
case HUAWEI_CLOUD: case HUAWEI_CLOUD:
PUBLIC_IP = HttpUtil.get("http://169.254.169.254/latest/meta-data/public-ipv4", 30); PUBLIC_IP = HttpUtil.get("http://169.254.169.254/latest/meta-data/public-ipv4", 30);
break; break;
default:
} }
} }
return PUBLIC_IP; return PUBLIC_IP;
......
...@@ -4,7 +4,7 @@ import com.fasterxml.jackson.databind.json.JsonMapper; ...@@ -4,7 +4,7 @@ import com.fasterxml.jackson.databind.json.JsonMapper;
import com.wecloud.im.ws.enums.WsRequestCmdEnum; import com.wecloud.im.ws.enums.WsRequestCmdEnum;
import com.wecloud.im.ws.model.request.ReceiveModel; import com.wecloud.im.ws.model.request.ReceiveModel;
import com.wecloud.im.ws.service.WriteDataService; import com.wecloud.im.ws.service.WriteDataService;
import com.wecloud.im.ws.strategy.ImCmdAbstract; import com.wecloud.im.ws.strategy.AbstractImCmd;
import com.wecloud.im.ws.strategy.ImCmdContext; import com.wecloud.im.ws.strategy.ImCmdContext;
import io.geekidea.springbootplus.framework.common.exception.BusinessException; import io.geekidea.springbootplus.framework.common.exception.BusinessException;
import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelHandlerContext;
...@@ -51,7 +51,7 @@ public class ReadWsData { ...@@ -51,7 +51,7 @@ public class ReadWsData {
WsRequestCmdEnum wsRequestUriPathEnum = WsRequestCmdEnum.getByCode(receiveModel.getCmd()); WsRequestCmdEnum wsRequestUriPathEnum = WsRequestCmdEnum.getByCode(receiveModel.getCmd());
// 使用策略模式, 根据不同类型请求调用不同实现类 // 使用策略模式, 根据不同类型请求调用不同实现类
ImCmdAbstract cmdStrategy = receiveStrategyContext.getStrategy(wsRequestUriPathEnum); AbstractImCmd cmdStrategy = receiveStrategyContext.getStrategy(wsRequestUriPathEnum);
cmdStrategy.process(receiveModel, ctx, data, appKey, clientId); cmdStrategy.process(receiveModel, ctx, data, appKey, clientId);
} }
......
...@@ -45,8 +45,8 @@ public class PushTask { ...@@ -45,8 +45,8 @@ public class PushTask {
* 点击查看 * 点击查看
*/ */
private static final String PUSH_BODY = "Click to view"; private static final String PUSH_BODY = "Click to view";
private static final String title = "title"; private static final String TITLE = "title";
private static final String subTitle = "subTitle"; private static final String SUB_TITLE = "subTitle";
@Autowired @Autowired
private ImIosApnsService imIosApnsService; private ImIosApnsService imIosApnsService;
@Autowired @Autowired
...@@ -103,8 +103,8 @@ public class PushTask { ...@@ -103,8 +103,8 @@ public class PushTask {
pushModel.setTitle(PUSH_TITLE); pushModel.setTitle(PUSH_TITLE);
pushModel.setSubTitle(PUSH_BODY); pushModel.setSubTitle(PUSH_BODY);
} else { } else {
pushModel.setTitle(pushMap.get(title)); pushModel.setTitle(pushMap.get(TITLE));
pushModel.setSubTitle(pushMap.get(subTitle)); pushModel.setSubTitle(pushMap.get(SUB_TITLE));
} }
this.push(pushModel, imClientReceiver, imApplication); this.push(pushModel, imClientReceiver, imApplication);
...@@ -125,9 +125,9 @@ public class PushTask { ...@@ -125,9 +125,9 @@ public class PushTask {
PushUtils pushUtils = new PushUtils(imApplication.getUmengKey(), imApplication.getUmengSecret()); PushUtils pushUtils = new PushUtils(imApplication.getUmengKey(), imApplication.getUmengSecret());
// 安卓 单推 // 安卓 单推
String deviceTokenIOS = imClientReceiver.getDeviceToken(); String deviceToken = imClientReceiver.getDeviceToken();
try { try {
pushUtils.sendIOSUnicast(deviceTokenIOS, pushModel.getTitle(), pushModel.getSubTitle(), PUSH_BODY); pushUtils.sendIOSUnicast(deviceToken, pushModel.getTitle(), pushModel.getSubTitle(), PUSH_BODY);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
......
...@@ -34,7 +34,7 @@ public class MangerChannelServiceImpl implements MangerChannelService { ...@@ -34,7 +34,7 @@ public class MangerChannelServiceImpl implements MangerChannelService {
// @Override // @Override
// public NioSocketChannel get(String appKey, String clientId) { // public NioSocketChannel get(String appKey, String clientId) {
// //
// return this.CHANNEL_MAP.get(appKey + clientId); // return MangerChannelService.CHANNEL_MAP.get(appKey + clientId);
// } // }
@Override @Override
...@@ -47,7 +47,7 @@ public class MangerChannelServiceImpl implements MangerChannelService { ...@@ -47,7 +47,7 @@ public class MangerChannelServiceImpl implements MangerChannelService {
// nioSocketChannel.close(); // nioSocketChannel.close();
// } // }
// this.CHANNEL_MAP.put(appKey + clientId, channel); // MangerChannelService.CHANNEL_MAP.put(appKey + clientId, channel);
String longChannelId = channel.id().asLongText(); String longChannelId = channel.id().asLongText();
this.putClientsMap(appKey, clientId, longChannelId); this.putClientsMap(appKey, clientId, longChannelId);
...@@ -61,26 +61,26 @@ public class MangerChannelServiceImpl implements MangerChannelService { ...@@ -61,26 +61,26 @@ public class MangerChannelServiceImpl implements MangerChannelService {
clientInfo.setDeviceId(""); clientInfo.setDeviceId("");
clientInfo.setNioSocketChannel(channel); clientInfo.setNioSocketChannel(channel);
clientInfo.setToken(""); clientInfo.setToken("");
this.SESSION_INFO_MAP.put(longChannelId, clientInfo); MangerChannelService.SESSION_INFO_MAP.put(longChannelId, clientInfo);
} }
void putClientsMap(String appKey, String clientId, String longChannelId) { void putClientsMap(String appKey, String clientId, String longChannelId) {
Set<String> set = this.CLIENTS_MAP.get(appKey + ":" + clientId); Set<String> set = MangerChannelService.CLIENTS_MAP.get(appKey + ":" + clientId);
if (set == null || set.isEmpty()) { if (set == null || set.isEmpty()) {
HashSet<String> hashSet = new HashSet<>(); HashSet<String> hashSet = new HashSet<>();
hashSet.add(longChannelId); hashSet.add(longChannelId);
this.CLIENTS_MAP.put(appKey + ":" + clientId, hashSet); MangerChannelService.CLIENTS_MAP.put(appKey + ":" + clientId, hashSet);
} else { } else {
set.add(longChannelId); set.add(longChannelId);
} }
} }
void delSessionInfoMap(String longChannelId) { void delSessionInfoMap(String longChannelId) {
this.SESSION_INFO_MAP.remove(longChannelId); MangerChannelService.SESSION_INFO_MAP.remove(longChannelId);
} }
void delClientsMap(String appKey, String clientId, String longChannelId) { void delClientsMap(String appKey, String clientId, String longChannelId) {
Set<String> set = this.CLIENTS_MAP.get(appKey + ":" + clientId); Set<String> set = MangerChannelService.CLIENTS_MAP.get(appKey + ":" + clientId);
if (set != null) { if (set != null) {
set.remove(longChannelId); set.remove(longChannelId);
} }
...@@ -121,7 +121,7 @@ public class MangerChannelServiceImpl implements MangerChannelService { ...@@ -121,7 +121,7 @@ public class MangerChannelServiceImpl implements MangerChannelService {
// @Override // @Override
// public Boolean isOnLocal(Long userId) { // public Boolean isOnLocal(Long userId) {
// NioSocketChannel nioSocketChannel = this.get(String.valueOf(userId)); // NioSocketChannel nioSocketChannel = MangerChannelService.get(String.valueOf(userId));
// return null != nioSocketChannel; // return null != nioSocketChannel;
// } // }
......
...@@ -11,7 +11,7 @@ import io.netty.channel.ChannelHandlerContext; ...@@ -11,7 +11,7 @@ import io.netty.channel.ChannelHandlerContext;
* @Author hewei hwei1233@163.com * @Author hewei hwei1233@163.com
* @Date 2020-01-02 * @Date 2020-01-02
*/ */
public abstract class ImCmdAbstract { public abstract class AbstractImCmd {
/** /**
* 处理业务流程 * 处理业务流程
......
...@@ -19,7 +19,7 @@ public class ImCmdContext { ...@@ -19,7 +19,7 @@ public class ImCmdContext {
this.strategyMap = strategyMap; this.strategyMap = strategyMap;
} }
public ImCmdAbstract getStrategy(WsRequestCmdEnum wsRequestPathEnum) { public AbstractImCmd getStrategy(WsRequestCmdEnum wsRequestPathEnum) {
if (wsRequestPathEnum == null) { if (wsRequestPathEnum == null) {
throw new IllegalArgumentException("not fond enum"); throw new IllegalArgumentException("not fond enum");
...@@ -35,6 +35,6 @@ public class ImCmdContext { ...@@ -35,6 +35,6 @@ public class ImCmdContext {
throw new IllegalArgumentException("not fond strategy for type:" + wsRequestPathEnum.getCmdCode()); throw new IllegalArgumentException("not fond strategy for type:" + wsRequestPathEnum.getCmdCode());
} }
return (ImCmdAbstract) SpringBeanUtils.getBean(aClass); return (AbstractImCmd) SpringBeanUtils.getBean(aClass);
} }
} }
...@@ -22,7 +22,7 @@ import com.wecloud.im.ws.model.WsResponseModel; ...@@ -22,7 +22,7 @@ import com.wecloud.im.ws.model.WsResponseModel;
import com.wecloud.im.ws.model.request.ReceiveModel; import com.wecloud.im.ws.model.request.ReceiveModel;
import com.wecloud.im.ws.sender.PushTask; import com.wecloud.im.ws.sender.PushTask;
import com.wecloud.im.ws.service.WriteDataService; import com.wecloud.im.ws.service.WriteDataService;
import com.wecloud.im.ws.strategy.ImCmdAbstract; import com.wecloud.im.ws.strategy.AbstractImCmd;
import io.geekidea.springbootplus.framework.common.api.ApiCode; import io.geekidea.springbootplus.framework.common.api.ApiCode;
import io.geekidea.springbootplus.framework.common.api.ApiResult; import io.geekidea.springbootplus.framework.common.api.ApiResult;
import io.geekidea.springbootplus.framework.shiro.util.SnowflakeUtil; import io.geekidea.springbootplus.framework.shiro.util.SnowflakeUtil;
...@@ -43,7 +43,7 @@ import java.util.List; ...@@ -43,7 +43,7 @@ import java.util.List;
@CmdTypeAnnotation(type = WsRequestCmdEnum.DATA) @CmdTypeAnnotation(type = WsRequestCmdEnum.DATA)
@Service @Service
@Slf4j @Slf4j
public class ImChatConcrete extends ImCmdAbstract { public class ImChatConcrete extends AbstractImCmd {
public static final String PUSH_KEY = "push"; public static final String PUSH_KEY = "push";
public static final String MSG_ID = "msgId"; public static final String MSG_ID = "msgId";
......
...@@ -30,13 +30,13 @@ public class KeyGenerator { ...@@ -30,13 +30,13 @@ public class KeyGenerator {
//生成32位appSecret //生成32位appSecret
public static String getAppSecret(String appId) { public static String getAppSecret(String appId) {
String EncryoAppSecret = ""; String encryoAppSecret = "";
try { try {
EncrypDES des1 = new EncrypDES();// 使用默认密钥 EncrypDES des1 = new EncrypDES();// 使用默认密钥
EncryoAppSecret = des1.encrypt(appId); encryoAppSecret = des1.encrypt(appId);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
return EncryoAppSecret; return encryoAppSecret;
} }
} }
...@@ -18,7 +18,7 @@ public class I18nMessageUtil { ...@@ -18,7 +18,7 @@ public class I18nMessageUtil {
// 后缀 // 后缀
private static final String SUFFIX = ".properties"; private static final String SUFFIX = ".properties";
// 分解器 // 分解器
private static final ResourcePatternResolver resourcePatternResolver = new PathMatchingResourcePatternResolver(); private static final ResourcePatternResolver RESOURCE_PATTERN_RESOLVER = new PathMatchingResourcePatternResolver();
// 存取器 // 存取器
private static MessageSourceAccessor accessor; private static MessageSourceAccessor accessor;
...@@ -35,7 +35,7 @@ public class I18nMessageUtil { ...@@ -35,7 +35,7 @@ public class I18nMessageUtil {
/* /*
* 获取配置文件名 * 获取配置文件名
*/ */
Resource resource = resourcePatternResolver.getResource(PATH_PARENT + language + SUFFIX); Resource resource = RESOURCE_PATTERN_RESOLVER.getResource(PATH_PARENT + language + SUFFIX);
String fileName = resource.getURL().toString(); String fileName = resource.getURL().toString();
int lastIndex = fileName.lastIndexOf("."); int lastIndex = fileName.lastIndexOf(".");
String baseName = fileName.substring(0, lastIndex); String baseName = fileName.substring(0, lastIndex);
......
...@@ -26,13 +26,13 @@ import io.geekidea.springbootplus.framework.core.bean.RequestDetail; ...@@ -26,13 +26,13 @@ import io.geekidea.springbootplus.framework.core.bean.RequestDetail;
**/ **/
public class RequestDetailThreadLocal { public class RequestDetailThreadLocal {
private static final ThreadLocal<RequestDetail> threadLocal = new ThreadLocal<>(); private static final ThreadLocal<RequestDetail> THREAD_LOCAL = new ThreadLocal<>();
/** /**
* 从当前线程中获取请求信息 * 从当前线程中获取请求信息
*/ */
public static RequestDetail getRequestDetail() { public static RequestDetail getRequestDetail() {
return threadLocal.get(); return THREAD_LOCAL.get();
} }
/** /**
...@@ -41,14 +41,14 @@ public class RequestDetailThreadLocal { ...@@ -41,14 +41,14 @@ public class RequestDetailThreadLocal {
* @param requestDetail * @param requestDetail
*/ */
public static void setRequestDetail(RequestDetail requestDetail) { public static void setRequestDetail(RequestDetail requestDetail) {
threadLocal.set(requestDetail); THREAD_LOCAL.set(requestDetail);
} }
/** /**
* 销毁 * 销毁
*/ */
public static void remove() { public static void remove() {
threadLocal.remove(); THREAD_LOCAL.remove();
} }
} }
...@@ -72,7 +72,7 @@ public class JwtFilter extends AuthenticatingFilter { ...@@ -72,7 +72,7 @@ public class JwtFilter extends AuthenticatingFilter {
} }
// 从redis 获取jwt数据 // 从redis 获取jwt数据
JwtToken jwtToken = shiroLoginService.getTJwtTokenForRedis(token); JwtToken jwtToken = shiroLoginService.getJwtTokenForRedis(token);
if (jwtToken == null) { if (jwtToken == null) {
throw new AuthenticationException("Redis Token不存在,token:" + token); throw new AuthenticationException("Redis Token不存在,token:" + token);
} }
......
...@@ -53,7 +53,7 @@ public interface ShiroLoginService { ...@@ -53,7 +53,7 @@ public interface ShiroLoginService {
/** /**
* 从redis获取token信息 * 从redis获取token信息
*/ */
JwtToken getTJwtTokenForRedis(String token); JwtToken getJwtTokenForRedis(String token);
/** /**
* 获取盐 * 获取盐
......
...@@ -128,7 +128,7 @@ public class ShiroLoginServiceImpl implements ShiroLoginService { ...@@ -128,7 +128,7 @@ public class ShiroLoginServiceImpl implements ShiroLoginService {
} }
@Override @Override
public JwtToken getTJwtTokenForRedis(String token) { public JwtToken getJwtTokenForRedis(String token) {
Object jwtTokenRedisVo = null; Object jwtTokenRedisVo = null;
......
...@@ -27,7 +27,7 @@ import org.springframework.core.env.Environment; ...@@ -27,7 +27,7 @@ import org.springframework.core.env.Environment;
@Slf4j @Slf4j
public class AnsiUtil { public class AnsiUtil {
private static final boolean enableAnsi; private static final boolean ENABLE_ANSI;
static { static {
Boolean value = false; Boolean value = false;
...@@ -38,12 +38,12 @@ public class AnsiUtil { ...@@ -38,12 +38,12 @@ public class AnsiUtil {
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
enableAnsi = value; ENABLE_ANSI = value;
} }
public static String getAnsi(Ansi.Color color, String text) { public static String getAnsi(Ansi.Color color, String text) {
if (enableAnsi) { if (ENABLE_ANSI) {
return Ansi.ansi().eraseScreen().fg(color).a(text).reset().toString(); return Ansi.ansi().eraseScreen().fg(color).a(text).reset().toString();
} }
return text; return text;
......
...@@ -34,7 +34,7 @@ public class Jackson { ...@@ -34,7 +34,7 @@ public class Jackson {
/** /**
* 时区 * 时区
*/ */
private static final TimeZone timeZone = TimeZone.getTimeZone("GMT"); private static final TimeZone TIME_ZONE = TimeZone.getTimeZone("GMT");
/** /**
* 键按自然顺序输出 * 键按自然顺序输出
...@@ -64,7 +64,7 @@ public class Jackson { ...@@ -64,7 +64,7 @@ public class Jackson {
// 键按自然顺序输出 // 键按自然顺序输出
objectMapper.configure(SerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS, true); objectMapper.configure(SerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS, true);
// 设置时区 // 设置时区
objectMapper.setTimeZone(timeZone); objectMapper.setTimeZone(TIME_ZONE);
return objectMapper.writeValueAsString(object); return objectMapper.writeValueAsString(object);
} catch (JsonProcessingException e) { } catch (JsonProcessingException e) {
e.printStackTrace(); e.printStackTrace();
...@@ -103,7 +103,7 @@ public class Jackson { ...@@ -103,7 +103,7 @@ public class Jackson {
// 为空的序列化 // 为空的序列化
objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
// 设置时区 // 设置时区
objectMapper.setTimeZone(timeZone); objectMapper.setTimeZone(TIME_ZONE);
return objectMapper.writeValueAsString(object); return objectMapper.writeValueAsString(object);
} catch (JsonProcessingException e) { } catch (JsonProcessingException e) {
e.printStackTrace(); e.printStackTrace();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment