mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-22 15:21:53 +08:00
解决MapStruct的时区问题
This commit is contained in:
parent
287a17a9ff
commit
eb4434ecbc
@ -36,6 +36,9 @@ public class DateUtils {
|
|||||||
* @return LocalDateTime
|
* @return LocalDateTime
|
||||||
*/
|
*/
|
||||||
public static Date of(LocalDateTime date) {
|
public static Date of(LocalDateTime date) {
|
||||||
|
if (date == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
// 将此日期时间与时区相结合以创建 ZonedDateTime
|
// 将此日期时间与时区相结合以创建 ZonedDateTime
|
||||||
ZonedDateTime zonedDateTime = date.atZone(ZoneId.systemDefault());
|
ZonedDateTime zonedDateTime = date.atZone(ZoneId.systemDefault());
|
||||||
// 本地时间线 LocalDateTime 到即时时间线 Instant 时间戳
|
// 本地时间线 LocalDateTime 到即时时间线 Instant 时间戳
|
||||||
@ -51,6 +54,9 @@ public class DateUtils {
|
|||||||
* @return LocalDateTime
|
* @return LocalDateTime
|
||||||
*/
|
*/
|
||||||
public static LocalDateTime of(Date date) {
|
public static LocalDateTime of(Date date) {
|
||||||
|
if (date == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
// 转为时间戳
|
// 转为时间戳
|
||||||
Instant instant = date.toInstant();
|
Instant instant = date.toInstant();
|
||||||
// UTC时间(世界协调时间,UTC + 00:00)转北京(北京,UTC + 8:00)时间
|
// UTC时间(世界协调时间,UTC + 00:00)转北京(北京,UTC + 8:00)时间
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package cn.iocoder.yudao.module.bpm.convert.task;
|
package cn.iocoder.yudao.module.bpm.convert.task;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.util.date.DateUtils;
|
||||||
import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.activity.BpmActivityRespVO;
|
import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.activity.BpmActivityRespVO;
|
||||||
import org.flowable.engine.history.HistoricActivityInstance;
|
import org.flowable.engine.history.HistoricActivityInstance;
|
||||||
import org.mapstruct.Mapper;
|
import org.mapstruct.Mapper;
|
||||||
@ -14,7 +15,7 @@ import java.util.List;
|
|||||||
*
|
*
|
||||||
* @author 芋道源码
|
* @author 芋道源码
|
||||||
*/
|
*/
|
||||||
@Mapper
|
@Mapper(uses = DateUtils.class)
|
||||||
public interface BpmActivityConvert {
|
public interface BpmActivityConvert {
|
||||||
|
|
||||||
BpmActivityConvert INSTANCE = Mappers.getMapper(BpmActivityConvert.class);
|
BpmActivityConvert INSTANCE = Mappers.getMapper(BpmActivityConvert.class);
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package cn.iocoder.yudao.module.bpm.convert.task;
|
package cn.iocoder.yudao.module.bpm.convert.task;
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.util.date.DateUtils;
|
||||||
import cn.iocoder.yudao.framework.common.util.number.NumberUtils;
|
import cn.iocoder.yudao.framework.common.util.number.NumberUtils;
|
||||||
import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.instance.BpmProcessInstancePageItemRespVO;
|
import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.instance.BpmProcessInstancePageItemRespVO;
|
||||||
import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.instance.BpmProcessInstanceRespVO;
|
import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.instance.BpmProcessInstanceRespVO;
|
||||||
@ -28,7 +29,7 @@ import java.util.Map;
|
|||||||
*
|
*
|
||||||
* @author 芋道源码
|
* @author 芋道源码
|
||||||
*/
|
*/
|
||||||
@Mapper
|
@Mapper(uses = DateUtils.class)
|
||||||
public interface BpmProcessInstanceConvert {
|
public interface BpmProcessInstanceConvert {
|
||||||
|
|
||||||
BpmProcessInstanceConvert INSTANCE = Mappers.getMapper(BpmProcessInstanceConvert.class);
|
BpmProcessInstanceConvert INSTANCE = Mappers.getMapper(BpmProcessInstanceConvert.class);
|
||||||
|
@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.bpm.convert.task;
|
|||||||
|
|
||||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||||
import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
|
import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
|
||||||
|
import cn.iocoder.yudao.framework.common.util.date.DateUtils;
|
||||||
import cn.iocoder.yudao.framework.common.util.number.NumberUtils;
|
import cn.iocoder.yudao.framework.common.util.number.NumberUtils;
|
||||||
import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.task.BpmTaskDonePageItemRespVO;
|
import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.task.BpmTaskDonePageItemRespVO;
|
||||||
import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.task.BpmTaskRespVO;
|
import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.task.BpmTaskRespVO;
|
||||||
@ -26,7 +27,7 @@ import java.util.Map;
|
|||||||
*
|
*
|
||||||
* @author 芋道源码
|
* @author 芋道源码
|
||||||
*/
|
*/
|
||||||
@Mapper
|
@Mapper(uses = DateUtils.class)
|
||||||
public interface BpmTaskConvert {
|
public interface BpmTaskConvert {
|
||||||
|
|
||||||
BpmTaskConvert INSTANCE = Mappers.getMapper(BpmTaskConvert.class);
|
BpmTaskConvert INSTANCE = Mappers.getMapper(BpmTaskConvert.class);
|
||||||
@ -46,8 +47,8 @@ public interface BpmTaskConvert {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Mapping(source = "suspended", target = "suspensionState", qualifiedByName = "convertSuspendedToSuspensionState")
|
@Mapping(source = "suspended", target = "suspensionState", qualifiedByName = "convertSuspendedToSuspensionState")
|
||||||
@Mapping(target = "claimTime", expression = "java(bean.getClaimTime()==null?null: LocalDateTime.ofInstant(bean.getClaimTime().toInstant(),ZoneId.systemDefault()))")
|
// @Mapping(target = "claimTime", expression = "java(bean.getClaimTime()==null?null: LocalDateTime.ofInstant(bean.getClaimTime().toInstant(),ZoneId.systemDefault()))")
|
||||||
@Mapping(target = "createTime", expression = "java(bean.getCreateTime()==null?null:LocalDateTime.ofInstant(bean.getCreateTime().toInstant(),ZoneId.systemDefault()))")
|
// @Mapping(target = "createTime", expression = "java(bean.getCreateTime()==null?null:LocalDateTime.ofInstant(bean.getCreateTime().toInstant(),ZoneId.systemDefault()))")
|
||||||
BpmTaskTodoPageItemRespVO convert1(Task bean);
|
BpmTaskTodoPageItemRespVO convert1(Task bean);
|
||||||
|
|
||||||
@Named("convertSuspendedToSuspensionState")
|
@Named("convertSuspendedToSuspensionState")
|
||||||
@ -106,8 +107,8 @@ public interface BpmTaskConvert {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Mapping(source = "taskDefinitionKey", target = "definitionKey")
|
@Mapping(source = "taskDefinitionKey", target = "definitionKey")
|
||||||
@Mapping(target = "createTime", expression = "java(bean.getCreateTime() == null ? null : LocalDateTime.ofInstant(bean.getCreateTime().toInstant(), ZoneId.systemDefault()))")
|
// @Mapping(target = "createTime", expression = "java(bean.getCreateTime() == null ? null : LocalDateTime.ofInstant(bean.getCreateTime().toInstant(), ZoneId.systemDefault()))")
|
||||||
@Mapping(target = "endTime", expression = "java(bean.getEndTime() == null ? null : LocalDateTime.ofInstant(bean.getEndTime().toInstant(), ZoneId.systemDefault()))")
|
// @Mapping(target = "endTime", expression = "java(bean.getEndTime() == null ? null : LocalDateTime.ofInstant(bean.getEndTime().toInstant(), ZoneId.systemDefault()))")
|
||||||
BpmTaskRespVO convert3(HistoricTaskInstance bean);
|
BpmTaskRespVO convert3(HistoricTaskInstance bean);
|
||||||
|
|
||||||
BpmTaskRespVO.User convert3(AdminUserRespDTO bean);
|
BpmTaskRespVO.User convert3(AdminUserRespDTO bean);
|
||||||
|
@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollUtil;
|
|||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
|
import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
|
||||||
|
import cn.iocoder.yudao.framework.common.util.date.DateUtils;
|
||||||
import cn.iocoder.yudao.framework.dict.core.util.DictFrameworkUtils;
|
import cn.iocoder.yudao.framework.dict.core.util.DictFrameworkUtils;
|
||||||
import cn.iocoder.yudao.framework.ip.core.utils.AreaUtils;
|
import cn.iocoder.yudao.framework.ip.core.utils.AreaUtils;
|
||||||
import cn.iocoder.yudao.module.member.api.address.dto.AddressRespDTO;
|
import cn.iocoder.yudao.module.member.api.address.dto.AddressRespDTO;
|
||||||
@ -44,7 +45,7 @@ import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.
|
|||||||
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMultiMap;
|
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMultiMap;
|
||||||
import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.addTime;
|
import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.addTime;
|
||||||
|
|
||||||
@Mapper
|
@Mapper(uses = DateUtils.class)
|
||||||
public interface TradeOrderConvert {
|
public interface TradeOrderConvert {
|
||||||
|
|
||||||
TradeOrderConvert INSTANCE = Mappers.getMapper(TradeOrderConvert.class);
|
TradeOrderConvert INSTANCE = Mappers.getMapper(TradeOrderConvert.class);
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package cn.iocoder.yudao.module.system.convert.notify;
|
package cn.iocoder.yudao.module.system.convert.notify;
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.util.date.DateUtils;
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.notify.vo.message.NotifyMessageRespVO;
|
import cn.iocoder.yudao.module.system.controller.admin.notify.vo.message.NotifyMessageRespVO;
|
||||||
import cn.iocoder.yudao.module.system.dal.dataobject.notify.NotifyMessageDO;
|
import cn.iocoder.yudao.module.system.dal.dataobject.notify.NotifyMessageDO;
|
||||||
import org.mapstruct.Mapper;
|
import org.mapstruct.Mapper;
|
||||||
@ -13,7 +14,7 @@ import java.util.List;
|
|||||||
*
|
*
|
||||||
* @author xrcoder
|
* @author xrcoder
|
||||||
*/
|
*/
|
||||||
@Mapper
|
@Mapper(uses = DateUtils.class)
|
||||||
public interface NotifyMessageConvert {
|
public interface NotifyMessageConvert {
|
||||||
|
|
||||||
NotifyMessageConvert INSTANCE = Mappers.getMapper(NotifyMessageConvert.class);
|
NotifyMessageConvert INSTANCE = Mappers.getMapper(NotifyMessageConvert.class);
|
||||||
@ -24,5 +25,4 @@ public interface NotifyMessageConvert {
|
|||||||
|
|
||||||
PageResult<NotifyMessageRespVO> convertPage(PageResult<NotifyMessageDO> page);
|
PageResult<NotifyMessageRespVO> convertPage(PageResult<NotifyMessageDO> page);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ import java.util.*;
|
|||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.util.date.DateUtils;
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.notify.vo.template.NotifyTemplateCreateReqVO;
|
import cn.iocoder.yudao.module.system.controller.admin.notify.vo.template.NotifyTemplateCreateReqVO;
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.notify.vo.template.NotifyTemplateRespVO;
|
import cn.iocoder.yudao.module.system.controller.admin.notify.vo.template.NotifyTemplateRespVO;
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.notify.vo.template.NotifyTemplateUpdateReqVO;
|
import cn.iocoder.yudao.module.system.controller.admin.notify.vo.template.NotifyTemplateUpdateReqVO;
|
||||||
@ -16,7 +17,7 @@ import cn.iocoder.yudao.module.system.dal.dataobject.notify.NotifyTemplateDO;
|
|||||||
*
|
*
|
||||||
* @author xrcoder
|
* @author xrcoder
|
||||||
*/
|
*/
|
||||||
@Mapper
|
@Mapper(uses = DateUtils.class)
|
||||||
public interface NotifyTemplateConvert {
|
public interface NotifyTemplateConvert {
|
||||||
|
|
||||||
NotifyTemplateConvert INSTANCE = Mappers.getMapper(NotifyTemplateConvert.class);
|
NotifyTemplateConvert INSTANCE = Mappers.getMapper(NotifyTemplateConvert.class);
|
||||||
|
Loading…
Reference in New Issue
Block a user