package com.qianwen.smartman.modules.notify.convert;
|
|
import java.util.ArrayList;
|
import java.util.HashMap;
|
import java.util.List;
|
import java.util.Map;
|
import com.qianwen.smartman.modules.notify.dto.NotifyHistoryDTO;
|
import com.qianwen.smartman.modules.notify.dto.NotifyHistoryQueryDTO;
|
import com.qianwen.smartman.modules.notify.entity.NotifyHistoryEntity;
|
|
/* loaded from: blade-api.jar:BOOT-INF/classes/org/springblade/modules/notify/convert/NotifyHistoryConvertImpl.class */
|
public class NotifyHistoryConvertImpl implements NotifyHistoryConvert {
|
@Override // org.springblade.modules.notify.convert.NotifyHistoryConvert
|
public NotifyHistoryEntity convertToEntity(NotifyHistoryQueryDTO sources) {
|
if (sources == null) {
|
return null;
|
}
|
NotifyHistoryEntity notifyHistoryEntity = new NotifyHistoryEntity();
|
notifyHistoryEntity.setState(sources.getState());
|
notifyHistoryEntity.setProvider(sources.getProvider());
|
notifyHistoryEntity.setNotifyType(sources.getNotifyType());
|
return notifyHistoryEntity;
|
}
|
|
@Override // org.springblade.modules.notify.convert.NotifyHistoryConvert
|
public NotifyHistoryEntity convertToEntity(NotifyHistoryDTO sources) {
|
if (sources == null) {
|
return null;
|
}
|
NotifyHistoryEntity notifyHistoryEntity = new NotifyHistoryEntity();
|
if (sources.getId() != null) {
|
notifyHistoryEntity.setId(Long.valueOf(Long.parseLong(sources.getId())));
|
}
|
notifyHistoryEntity.setTranceId(sources.getTranceId());
|
notifyHistoryEntity.setNotifierId(sources.getNotifierId());
|
notifyHistoryEntity.setState(sources.getState());
|
notifyHistoryEntity.setErrorType(sources.getErrorType());
|
notifyHistoryEntity.setErrorStack(sources.getErrorStack());
|
notifyHistoryEntity.setTemplateId(sources.getTemplateId());
|
notifyHistoryEntity.setTemplate(sources.getTemplate());
|
Map<String, Object> map = sources.getContextData();
|
if (map != null) {
|
notifyHistoryEntity.setContextData(new HashMap(map));
|
}
|
notifyHistoryEntity.setProvider(sources.getProvider());
|
notifyHistoryEntity.setNotifyType(sources.getNotifyType());
|
notifyHistoryEntity.setNotifyTime(sources.getNotifyTime());
|
notifyHistoryEntity.setRetryTimes(sources.getRetryTimes());
|
notifyHistoryEntity.setBusinessName(sources.getBusinessName());
|
notifyHistoryEntity.setNotifyTypeName(sources.getNotifyTypeName());
|
return notifyHistoryEntity;
|
}
|
|
@Override // org.springblade.modules.notify.convert.NotifyHistoryConvert
|
public NotifyHistoryDTO convertToDto(NotifyHistoryEntity sources) {
|
if (sources == null) {
|
return null;
|
}
|
NotifyHistoryDTO notifyHistoryDTO = new NotifyHistoryDTO();
|
if (sources.getId() != null) {
|
notifyHistoryDTO.setId(String.valueOf(sources.getId()));
|
}
|
notifyHistoryDTO.setTranceId(sources.getTranceId());
|
notifyHistoryDTO.setNotifierId(sources.getNotifierId());
|
notifyHistoryDTO.setState(sources.getState());
|
notifyHistoryDTO.setErrorType(sources.getErrorType());
|
notifyHistoryDTO.setErrorStack(sources.getErrorStack());
|
notifyHistoryDTO.setTemplateId(sources.getTemplateId());
|
notifyHistoryDTO.setTemplate(sources.getTemplate());
|
Map<String, Object> map = sources.getContextData();
|
if (map != null) {
|
notifyHistoryDTO.setContextData(new HashMap(map));
|
}
|
notifyHistoryDTO.setProvider(sources.getProvider());
|
notifyHistoryDTO.setNotifyType(sources.getNotifyType());
|
notifyHistoryDTO.setNotifyTime(sources.getNotifyTime());
|
notifyHistoryDTO.setRetryTimes(sources.getRetryTimes());
|
notifyHistoryDTO.setBusinessName(sources.getBusinessName());
|
notifyHistoryDTO.setNotifyTypeName(sources.getNotifyTypeName());
|
return notifyHistoryDTO;
|
}
|
|
@Override // org.springblade.modules.notify.convert.NotifyHistoryConvert
|
public List<NotifyHistoryDTO> convertToDTOList(List<NotifyHistoryEntity> sources) {
|
if (sources == null) {
|
return null;
|
}
|
List<NotifyHistoryDTO> list = new ArrayList<>(sources.size());
|
for (NotifyHistoryEntity notifyHistoryEntity : sources) {
|
list.add(convertToDto(notifyHistoryEntity));
|
}
|
return list;
|
}
|
}
|