Merge pull request #33 from kyw7/master

为enum添加默认的int到enum的转换方法
pull/34/head
Java3y 2 years ago committed by GitHub
commit 1514490842
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -25,6 +25,7 @@ public class AnchorInfo {
/** /**
* *
* @see com.java3y.austin.common.enums.AnchorState
*/ */
private int state; private int state;

@ -8,7 +8,18 @@ import lombok.NoArgsConstructor;
* *
* <p> * <p>
* *
* {"url":"sms.tencentcloudapi.com","region":"ap-guangzhou","secretId":"AKIDhDxxxxxxxx1WljQq","secretKey":"B4hwww39yxxxrrrrgxyi","smsSdkAppId":"1423123125","templateId":"1182097","signName":"Java3y公众号","supplierId":10,"supplierName":"腾讯云","scriptName":"TencentSmsScript"} * {
* "url": "sms.tencentcloudapi.com",
* "region": "ap-guangzhou",
* "secretId": "AKIDhDxxxxxxxx1WljQq",
* "secretKey": "B4hwww39yxxxrrrrgxyi",
* "smsSdkAppId": "1423123125",
* "templateId": "1182097",
* "signName": "Java3y公众号",
* "supplierId": 10,
* "supplierName": "腾讯云",
* "scriptName": "TencentSmsScript"
* }
* *
* @author 3y * @author 3y
*/ */

@ -13,7 +13,7 @@ import lombok.ToString;
@Getter @Getter
@ToString @ToString
@AllArgsConstructor @AllArgsConstructor
public enum AnchorState { public enum AnchorState implements PowerfulEnum {
/** /**
* *
@ -56,26 +56,10 @@ public enum AnchorState {
/** /**
* *
*/ */
CLICK(0100, "消息被点击"), CLICK(64, "消息被点击"),
; ;
private final Integer code; private final Integer code;
private final String description; private final String description;
/**
* code
*
* @param code
* @return
*/
public static String getDescriptionByCode(Integer code) {
for (AnchorState anchorState : AnchorState.values()) {
if (anchorState.getCode().equals(code)) {
return anchorState.getDescription();
}
}
return "未知点位";
}
} }

@ -12,7 +12,7 @@ import lombok.ToString;
@Getter @Getter
@ToString @ToString
@AllArgsConstructor @AllArgsConstructor
public enum AuditStatus { public enum AuditStatus implements PowerfulEnum {
/** /**
* 10. * 10.

@ -6,6 +6,9 @@ import lombok.AllArgsConstructor;
import lombok.Getter; import lombok.Getter;
import lombok.ToString; import lombok.ToString;
import java.util.Arrays;
import java.util.Objects;
/** /**
* *
* *
@ -14,7 +17,7 @@ import lombok.ToString;
@Getter @Getter
@ToString @ToString
@AllArgsConstructor @AllArgsConstructor
public enum ChannelType { public enum ChannelType implements PowerfulEnum {
/** /**
@ -94,28 +97,8 @@ public enum ChannelType {
* @return * @return
*/ */
public static Class<? extends ContentModel> getChanelModelClassByCode(Integer code) { public static Class<? extends ContentModel> getChanelModelClassByCode(Integer code) {
ChannelType[] values = values(); return Arrays.stream(values()).filter(channelType -> Objects.equals(code, channelType.getCode()))
for (ChannelType value : values) { .map(ChannelType::getContentModelClass)
if (value.getCode().equals(code)) { .findFirst().orElse(null);
return value.getContentModelClass();
}
}
return null;
}
/**
* codeenum
*
* @param code
* @return
*/
public static ChannelType getEnumByCode(Integer code) {
ChannelType[] values = values();
for (ChannelType value : values) {
if (value.getCode().equals(code)) {
return value;
}
}
return null;
} }
} }

@ -5,7 +5,9 @@ import lombok.Getter;
import lombok.ToString; import lombok.ToString;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
/** /**
* *
@ -15,7 +17,7 @@ import java.util.List;
@Getter @Getter
@ToString @ToString
@AllArgsConstructor @AllArgsConstructor
public enum DeduplicationType { public enum DeduplicationType implements PowerfulEnum {
/** /**
* *
@ -29,18 +31,4 @@ public enum DeduplicationType {
; ;
private final Integer code; private final Integer code;
private final String description; private final String description;
/**
*
*
* @return
*/
public static List<Integer> getDeduplicationList() {
ArrayList<Integer> result = new ArrayList<>();
for (DeduplicationType value : DeduplicationType.values()) {
result.add(value.getCode());
}
return result;
}
} }

@ -0,0 +1,30 @@
package com.java3y.austin.common.enums;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
public class EnumUtil {
private EnumUtil() {
}
public static <T extends PowerfulEnum> String getDescriptionByCode(Integer code, Class<T> enumClass) {
return Arrays.stream(enumClass.getEnumConstants())
.filter(e -> Objects.equals(e.getCode(), code))
.findFirst().map(PowerfulEnum::getDescription).orElse("");
}
public static <T extends PowerfulEnum> T getEnumByCode(Integer code, Class<T> enumClass) {
return Arrays.stream(enumClass.getEnumConstants())
.filter(e -> Objects.equals(e.getCode(), code))
.findFirst().orElse(null);
}
public static <T extends PowerfulEnum> List<Integer> getCodeList(Class<T> enumClass) {
return Arrays.stream(enumClass.getEnumConstants())
.map(PowerfulEnum::getCode)
.collect(Collectors.toList());
}
}

@ -13,33 +13,25 @@ import lombok.ToString;
@Getter @Getter
@ToString @ToString
@AllArgsConstructor @AllArgsConstructor
public enum FileType { public enum FileType implements PowerfulEnum {
/** /**
* *
*/ */
IMAGE("10", "image"), IMAGE(10, "image"),
/** /**
* *
*/ */
VOICE("20", "voice"), VOICE(20, "voice"),
/** /**
* *
*/ */
COMMON_FILE("30", "file"), COMMON_FILE(30, "file"),
/** /**
* *
*/ */
VIDEO("40", "video"), VIDEO(40, "video"),
; ;
private final String code; private final Integer code;
private final String name; private final String description;
public static String getNameByCode(String code) {
for (FileType fileType : FileType.values()) {
if (fileType.getCode().equals(code)) {
return fileType.getName();
}
}
return null;
}
} }

@ -13,7 +13,7 @@ import lombok.ToString;
@Getter @Getter
@ToString @ToString
@AllArgsConstructor @AllArgsConstructor
public enum IdType { public enum IdType implements PowerfulEnum {
/** /**
* userId * userId
*/ */

@ -11,7 +11,7 @@ import lombok.ToString;
@Getter @Getter
@ToString @ToString
@AllArgsConstructor @AllArgsConstructor
public enum MessageStatus { public enum MessageStatus implements PowerfulEnum {
/** /**
* 10. * 10.

@ -4,6 +4,9 @@ import lombok.AllArgsConstructor;
import lombok.Getter; import lombok.Getter;
import lombok.ToString; import lombok.ToString;
import java.util.Arrays;
import java.util.Objects;
/** /**
* *
* *
@ -12,7 +15,7 @@ import lombok.ToString;
@Getter @Getter
@ToString @ToString
@AllArgsConstructor @AllArgsConstructor
public enum MessageType { public enum MessageType implements PowerfulEnum {
/** /**
* *
@ -44,21 +47,4 @@ public enum MessageType {
private final String codeEn; private final String codeEn;
/**
* codeenum
*
* @param code
* @return
*/
public static MessageType getEnumByCode(Integer code) {
MessageType[] values = values();
for (MessageType value : values) {
if (value.getCode().equals(code)) {
return value;
}
}
return null;
}
} }

@ -0,0 +1,9 @@
package com.java3y.austin.common.enums;
public interface PowerfulEnum {
Integer getCode();
String getDescription();
}

@ -12,7 +12,7 @@ import lombok.ToString;
@Getter @Getter
@ToString @ToString
@AllArgsConstructor @AllArgsConstructor
public enum ShieldType { public enum ShieldType implements PowerfulEnum {
/** /**
@ -30,6 +30,4 @@ public enum ShieldType {
private final Integer code; private final Integer code;
private final String description; private final String description;
} }

@ -12,7 +12,7 @@ import lombok.ToString;
@Getter @Getter
@ToString @ToString
@AllArgsConstructor @AllArgsConstructor
public enum SmsStatus { public enum SmsStatus implements PowerfulEnum{
/** /**
* *
@ -33,22 +33,4 @@ public enum SmsStatus {
private final Integer code; private final Integer code;
private final String description; private final String description;
/**
*
*
* @param code
* @return
*/
public static String getDescriptionByStatus(Integer code) {
for (SmsStatus value : SmsStatus.values()) {
if (value.getCode().equals(code)) {
return value.getDescription();
}
}
return "";
}
} }

@ -13,7 +13,7 @@ import lombok.ToString;
@Getter @Getter
@ToString @ToString
@AllArgsConstructor @AllArgsConstructor
public enum SmsSupplier { public enum SmsSupplier implements PowerfulEnum {
/** /**
@ -27,19 +27,4 @@ public enum SmsSupplier {
private final Integer code; private final Integer code;
private final String description; private final String description;
/**
*
*
* @param code
* @return
*/
public static String getDescriptionByStatus(Integer code) {
for (SmsStatus value : SmsStatus.values()) {
if (value.getCode().equals(code)) {
return value.getDescription();
}
}
return "";
}
} }

@ -12,7 +12,7 @@ import lombok.ToString;
@Getter @Getter
@ToString @ToString
@AllArgsConstructor @AllArgsConstructor
public enum TemplateType { public enum TemplateType implements PowerfulEnum {
/** /**
* () * ()

@ -3,6 +3,7 @@ package com.java3y.austin.handler.deduplication;
import com.java3y.austin.common.constant.CommonConstant; import com.java3y.austin.common.constant.CommonConstant;
import com.java3y.austin.common.domain.TaskInfo; import com.java3y.austin.common.domain.TaskInfo;
import com.java3y.austin.common.enums.DeduplicationType; import com.java3y.austin.common.enums.DeduplicationType;
import com.java3y.austin.common.enums.EnumUtil;
import com.java3y.austin.support.service.ConfigService; import com.java3y.austin.support.service.ConfigService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -31,7 +32,7 @@ public class DeduplicationRuleService {
String deduplicationConfig = config.getProperty(DEDUPLICATION_RULE_KEY, CommonConstant.EMPTY_JSON_OBJECT); String deduplicationConfig = config.getProperty(DEDUPLICATION_RULE_KEY, CommonConstant.EMPTY_JSON_OBJECT);
// 去重 // 去重
List<Integer> deduplicationList = DeduplicationType.getDeduplicationList(); List<Integer> deduplicationList = EnumUtil.getCodeList(DeduplicationType.class);
for (Integer deduplicationType : deduplicationList) { for (Integer deduplicationType : deduplicationList) {
DeduplicationParam deduplicationParam = deduplicationHolder.selectBuilder(deduplicationType).build(deduplicationConfig, taskInfo); DeduplicationParam deduplicationParam = deduplicationHolder.selectBuilder(deduplicationType).build(deduplicationConfig, taskInfo);
if (Objects.nonNull(deduplicationParam)) { if (Objects.nonNull(deduplicationParam)) {

@ -6,6 +6,7 @@ import com.google.common.util.concurrent.RateLimiter;
import com.java3y.austin.common.constant.CommonConstant; import com.java3y.austin.common.constant.CommonConstant;
import com.java3y.austin.common.domain.TaskInfo; import com.java3y.austin.common.domain.TaskInfo;
import com.java3y.austin.common.enums.ChannelType; import com.java3y.austin.common.enums.ChannelType;
import com.java3y.austin.common.enums.EnumUtil;
import com.java3y.austin.handler.enums.RateLimitStrategy; import com.java3y.austin.handler.enums.RateLimitStrategy;
import com.java3y.austin.handler.flowcontrol.annotations.LocalRateLimit; import com.java3y.austin.handler.flowcontrol.annotations.LocalRateLimit;
import com.java3y.austin.support.service.ConfigService; import com.java3y.austin.support.service.ConfigService;
@ -63,7 +64,7 @@ public class FlowControlFactory implements ApplicationContextAware {
double costTime = flowControlService.flowControl(taskInfo, flowControlParam); double costTime = flowControlService.flowControl(taskInfo, flowControlParam);
if (costTime > 0) { if (costTime > 0) {
log.info("consumer {} flow control time {}", log.info("consumer {} flow control time {}",
ChannelType.getEnumByCode(taskInfo.getSendChannel()).getDescription(), costTime); EnumUtil.getEnumByCode(taskInfo.getSendChannel(), ChannelType.class).getDescription(), costTime);
} }
} }

@ -1,6 +1,5 @@
package com.java3y.austin.handler.shield.impl; package com.java3y.austin.handler.shield.impl;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializerFeature; import com.alibaba.fastjson.serializer.SerializerFeature;
import com.java3y.austin.common.domain.AnchorInfo; import com.java3y.austin.common.domain.AnchorInfo;
@ -15,7 +14,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.Date;
import java.util.HashSet; import java.util.HashSet;
/** /**
@ -28,6 +26,8 @@ import java.util.HashSet;
public class ShieldServiceImpl implements ShieldService { public class ShieldServiceImpl implements ShieldService {
private static final String NIGHT_SHIELD_BUT_NEXT_DAY_SEND_KEY = "night_shield_send"; private static final String NIGHT_SHIELD_BUT_NEXT_DAY_SEND_KEY = "night_shield_send";
private static final long SECONDS_OF_A_DAY = 86400L;
@Autowired @Autowired
private RedisUtils redisUtils; private RedisUtils redisUtils;
@Autowired @Autowired
@ -52,7 +52,7 @@ public class ShieldServiceImpl implements ShieldService {
if (ShieldType.NIGHT_SHIELD_BUT_NEXT_DAY_SEND.getCode().equals(taskInfo.getShieldType())) { if (ShieldType.NIGHT_SHIELD_BUT_NEXT_DAY_SEND.getCode().equals(taskInfo.getShieldType())) {
redisUtils.lPush(NIGHT_SHIELD_BUT_NEXT_DAY_SEND_KEY, JSON.toJSONString(taskInfo, redisUtils.lPush(NIGHT_SHIELD_BUT_NEXT_DAY_SEND_KEY, JSON.toJSONString(taskInfo,
SerializerFeature.WriteClassName), SerializerFeature.WriteClassName),
(DateUtil.offsetDay(new Date(), 1).getTime() / 1000) - DateUtil.currentSeconds()); SECONDS_OF_A_DAY);
logUtils.print(AnchorInfo.builder().state(AnchorState.NIGHT_SHIELD_NEXT_SEND.getCode()).businessId(taskInfo.getBusinessId()).ids(taskInfo.getReceiver()).build()); logUtils.print(AnchorInfo.builder().state(AnchorState.NIGHT_SHIELD_NEXT_SEND.getCode()).businessId(taskInfo.getBusinessId()).ids(taskInfo.getReceiver()).build());
} }
taskInfo.setReceiver(new HashSet<>()); taskInfo.setReceiver(new HashSet<>());

@ -3,6 +3,7 @@ package com.java3y.austin.handler.utils;
import com.java3y.austin.common.domain.TaskInfo; import com.java3y.austin.common.domain.TaskInfo;
import com.java3y.austin.common.enums.ChannelType; import com.java3y.austin.common.enums.ChannelType;
import com.java3y.austin.common.enums.EnumUtil;
import com.java3y.austin.common.enums.MessageType; import com.java3y.austin.common.enums.MessageType;
import java.util.ArrayList; import java.util.ArrayList;
@ -37,8 +38,8 @@ public class GroupIdMappingUtils {
* @return * @return
*/ */
public static String getGroupIdByTaskInfo(TaskInfo taskInfo) { public static String getGroupIdByTaskInfo(TaskInfo taskInfo) {
String channelCodeEn = ChannelType.getEnumByCode(taskInfo.getSendChannel()).getCodeEn(); String channelCodeEn = EnumUtil.getEnumByCode(taskInfo.getSendChannel(), ChannelType.class).getCodeEn();
String msgCodeEn = MessageType.getEnumByCode(taskInfo.getMsgType()).getCodeEn(); String msgCodeEn = EnumUtil.getEnumByCode(taskInfo.getMsgType(),MessageType.class).getCodeEn();
return channelCodeEn + "." + msgCodeEn; return channelCodeEn + "." + msgCodeEn;
} }
} }

@ -11,6 +11,7 @@ import com.java3y.austin.common.constant.AustinConstant;
import com.java3y.austin.common.domain.SimpleAnchorInfo; import com.java3y.austin.common.domain.SimpleAnchorInfo;
import com.java3y.austin.common.enums.AnchorState; import com.java3y.austin.common.enums.AnchorState;
import com.java3y.austin.common.enums.ChannelType; import com.java3y.austin.common.enums.ChannelType;
import com.java3y.austin.common.enums.EnumUtil;
import com.java3y.austin.support.dao.MessageTemplateDao; import com.java3y.austin.support.dao.MessageTemplateDao;
import com.java3y.austin.support.dao.SmsRecordDao; import com.java3y.austin.support.dao.SmsRecordDao;
import com.java3y.austin.support.domain.MessageTemplate; import com.java3y.austin.support.domain.MessageTemplate;
@ -83,7 +84,7 @@ public class DataServiceImpl implements DataService {
sb.append(StrPool.CRLF); sb.append(StrPool.CRLF);
} }
String startTime = DateUtil.format(new Date(simpleAnchorInfo.getTimestamp()), DatePattern.NORM_DATETIME_PATTERN); String startTime = DateUtil.format(new Date(simpleAnchorInfo.getTimestamp()), DatePattern.NORM_DATETIME_PATTERN);
String stateDescription = AnchorState.getDescriptionByCode(simpleAnchorInfo.getState()); String stateDescription = EnumUtil.getDescriptionByCode(simpleAnchorInfo.getState(), AnchorState.class);
sb.append(startTime).append(StrPool.C_COLON).append(stateDescription).append("==>"); sb.append(startTime).append(StrPool.C_COLON).append(stateDescription).append("==>");
} }
@ -91,7 +92,7 @@ public class DataServiceImpl implements DataService {
if (StrUtil.isNotBlank(detail)) { if (StrUtil.isNotBlank(detail)) {
UserTimeLineVo.ItemsVO itemsVO = UserTimeLineVo.ItemsVO.builder() UserTimeLineVo.ItemsVO itemsVO = UserTimeLineVo.ItemsVO.builder()
.businessId(entry.getKey()) .businessId(entry.getKey())
.sendType(ChannelType.getEnumByCode(messageTemplate.getSendChannel()).getDescription()) .sendType(EnumUtil.getEnumByCode(messageTemplate.getSendChannel(), ChannelType.class).getDescription())
.creator(messageTemplate.getCreator()) .creator(messageTemplate.getCreator())
.title(messageTemplate.getName()) .title(messageTemplate.getName())
.detail(detail) .detail(detail)

@ -12,6 +12,7 @@ import com.google.common.base.Throwables;
import com.java3y.austin.common.constant.CommonConstant; import com.java3y.austin.common.constant.CommonConstant;
import com.java3y.austin.common.constant.SendAccountConstant; import com.java3y.austin.common.constant.SendAccountConstant;
import com.java3y.austin.common.dto.account.EnterpriseWeChatRobotAccount; import com.java3y.austin.common.dto.account.EnterpriseWeChatRobotAccount;
import com.java3y.austin.common.enums.EnumUtil;
import com.java3y.austin.common.enums.FileType; import com.java3y.austin.common.enums.FileType;
import com.java3y.austin.common.enums.RespStatusEnum; import com.java3y.austin.common.enums.RespStatusEnum;
import com.java3y.austin.common.vo.BasicResultVO; import com.java3y.austin.common.vo.BasicResultVO;
@ -56,7 +57,7 @@ public class MaterialServiceImpl implements MaterialService {
FileItem item = new FileItem(new StringBuilder().append(IdUtil.fastSimpleUUID()).append(file.getOriginalFilename()).toString(), FileItem item = new FileItem(new StringBuilder().append(IdUtil.fastSimpleUUID()).append(file.getOriginalFilename()).toString(),
file.getInputStream()); file.getInputStream());
req.setMedia(item); req.setMedia(item);
req.setType(FileType.getNameByCode(fileType)); req.setType(EnumUtil.getDescriptionByCode(Integer.valueOf(fileType), FileType.class));
rsp = client.execute(req, accessToken); rsp = client.execute(req, accessToken);
if (rsp.getErrcode() == 0L) { if (rsp.getErrcode() == 0L) {
return new BasicResultVO(RespStatusEnum.SUCCESS, UploadResponseVo.builder().id(rsp.getMediaId()).build()); return new BasicResultVO(RespStatusEnum.SUCCESS, UploadResponseVo.builder().id(rsp.getMediaId()).build());
@ -94,7 +95,8 @@ public class MaterialServiceImpl implements MaterialService {
WxCpDefaultConfigImpl accountConfig = accountUtils.getAccountById(Integer.valueOf(sendAccount), WxCpDefaultConfigImpl.class); WxCpDefaultConfigImpl accountConfig = accountUtils.getAccountById(Integer.valueOf(sendAccount), WxCpDefaultConfigImpl.class);
WxCpServiceImpl wxCpService = new WxCpServiceImpl(); WxCpServiceImpl wxCpService = new WxCpServiceImpl();
wxCpService.setWxCpConfigStorage(accountConfig); wxCpService.setWxCpConfigStorage(accountConfig);
WxMediaUploadResult result = wxCpService.getMediaService().upload(FileType.getNameByCode(fileType), SpringFileUtils.getFile(multipartFile)); WxMediaUploadResult result = wxCpService.getMediaService()
.upload(EnumUtil.getDescriptionByCode(Integer.valueOf(fileType), FileType.class), SpringFileUtils.getFile(multipartFile));
if (StrUtil.isNotBlank(result.getMediaId())) { if (StrUtil.isNotBlank(result.getMediaId())) {
return new BasicResultVO(RespStatusEnum.SUCCESS, UploadResponseVo.builder().id(result.getMediaId()).build()); return new BasicResultVO(RespStatusEnum.SUCCESS, UploadResponseVo.builder().id(result.getMediaId()).build());
} }

@ -10,6 +10,7 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.java3y.austin.common.enums.AnchorState; import com.java3y.austin.common.enums.AnchorState;
import com.java3y.austin.common.enums.ChannelType; import com.java3y.austin.common.enums.ChannelType;
import com.java3y.austin.common.enums.EnumUtil;
import com.java3y.austin.common.enums.SmsStatus; import com.java3y.austin.common.enums.SmsStatus;
import com.java3y.austin.support.domain.ChannelAccount; import com.java3y.austin.support.domain.ChannelAccount;
import com.java3y.austin.support.domain.SmsRecord; import com.java3y.austin.support.domain.SmsRecord;
@ -389,7 +390,7 @@ public class Convert4Amis {
if (CollUtil.isNotEmpty(anchorResult)) { if (CollUtil.isNotEmpty(anchorResult)) {
anchorResult = MapUtil.sort(anchorResult); anchorResult = MapUtil.sort(anchorResult);
for (Map.Entry<Object, Object> entry : anchorResult.entrySet()) { for (Map.Entry<Object, Object> entry : anchorResult.entrySet()) {
String description = AnchorState.getDescriptionByCode(Integer.valueOf(String.valueOf(entry.getKey()))); String description = EnumUtil.getDescriptionByCode((Integer) entry.getKey(),AnchorState.class);
xAxisList.add(description); xAxisList.add(description);
actualData.add(Integer.valueOf(String.valueOf(entry.getValue()))); actualData.add(Integer.valueOf(String.valueOf(entry.getValue())));
} }
@ -426,10 +427,10 @@ public class Convert4Amis {
if (smsRecord.getMessageTemplateId() > 0) { if (smsRecord.getMessageTemplateId() > 0) {
itemsVO.setBusinessId(String.valueOf(smsRecord.getMessageTemplateId())); itemsVO.setBusinessId(String.valueOf(smsRecord.getMessageTemplateId()));
itemsVO.setContent(smsRecord.getMsgContent()); itemsVO.setContent(smsRecord.getMsgContent());
itemsVO.setSendType(SmsStatus.getDescriptionByStatus(smsRecord.getStatus())); itemsVO.setSendType(EnumUtil.getDescriptionByCode(smsRecord.getStatus(),SmsStatus.class));
itemsVO.setSendTime(DateUtil.format(new Date(Long.valueOf(smsRecord.getCreated() * 1000L)), DatePattern.NORM_DATETIME_PATTERN)); itemsVO.setSendTime(DateUtil.format(new Date(Long.valueOf(smsRecord.getCreated() * 1000L)), DatePattern.NORM_DATETIME_PATTERN));
} else { } else {
itemsVO.setReceiveType(SmsStatus.getDescriptionByStatus(smsRecord.getStatus())); itemsVO.setReceiveType(EnumUtil.getDescriptionByCode(smsRecord.getStatus(),SmsStatus.class));
itemsVO.setReceiveContent(smsRecord.getReportContent()); itemsVO.setReceiveContent(smsRecord.getReportContent());
itemsVO.setReceiveTime(DateUtil.format(new Date(Long.valueOf(smsRecord.getUpdated() * 1000L)), DatePattern.NORM_DATETIME_PATTERN)); itemsVO.setReceiveTime(DateUtil.format(new Date(Long.valueOf(smsRecord.getUpdated() * 1000L)), DatePattern.NORM_DATETIME_PATTERN));
} }

Loading…
Cancel
Save