mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-30 03:01:53 +08:00
DateUtils.buildLocalDateTime ==> LocalDateTime.of
This commit is contained in:
parent
375229111e
commit
cb006ddf2b
@ -5,6 +5,7 @@ import cn.hutool.core.date.LocalDateTimeUtil;
|
|||||||
|
|
||||||
import java.time.Duration;
|
import java.time.Duration;
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
|
import java.time.LocalDate;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.ZoneId;
|
import java.time.ZoneId;
|
||||||
import java.time.ZonedDateTime;
|
import java.time.ZonedDateTime;
|
||||||
@ -77,7 +78,7 @@ public class DateUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static LocalDateTime buildLocalDateTime(int year, int mouth, int day) {
|
public static LocalDateTime buildLocalDateTime(int year, int mouth, int day) {
|
||||||
return buildLocalDateTime(year, mouth, day, 0, 0, 0);
|
return LocalDateTime.of(year, mouth, day, 0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -104,19 +105,6 @@ public class DateUtils {
|
|||||||
return calendar.getTime();
|
return calendar.getTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static LocalDateTime buildLocalDateTime(int year, int mouth, int day,
|
|
||||||
int hour, int minute, int second) {
|
|
||||||
Calendar calendar = Calendar.getInstance();
|
|
||||||
calendar.set(Calendar.YEAR, year);
|
|
||||||
calendar.set(Calendar.MONTH, mouth - 1);
|
|
||||||
calendar.set(Calendar.DAY_OF_MONTH, day);
|
|
||||||
calendar.set(Calendar.HOUR_OF_DAY, hour);
|
|
||||||
calendar.set(Calendar.MINUTE, minute);
|
|
||||||
calendar.set(Calendar.SECOND, second);
|
|
||||||
calendar.set(Calendar.MILLISECOND, 0); // 一般情况下,都是 0 毫秒
|
|
||||||
return dateToLocalDateTime(calendar.getTime());
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Date max(Date a, Date b) {
|
public static Date max(Date a, Date b) {
|
||||||
if (a == null) {
|
if (a == null) {
|
||||||
return b;
|
return b;
|
||||||
|
@ -11,7 +11,6 @@ import cn.iocoder.yudao.framework.sms.core.client.dto.SmsTemplateRespDTO;
|
|||||||
import cn.iocoder.yudao.framework.sms.core.enums.SmsTemplateAuditStatusEnum;
|
import cn.iocoder.yudao.framework.sms.core.enums.SmsTemplateAuditStatusEnum;
|
||||||
import cn.iocoder.yudao.framework.sms.core.property.SmsChannelProperties;
|
import cn.iocoder.yudao.framework.sms.core.property.SmsChannelProperties;
|
||||||
import cn.iocoder.yudao.framework.common.util.collection.MapUtils;
|
import cn.iocoder.yudao.framework.common.util.collection.MapUtils;
|
||||||
import cn.iocoder.yudao.framework.common.util.date.DateUtils;
|
|
||||||
import cn.iocoder.yudao.framework.sms.core.enums.SmsFrameworkErrorCodeConstants;
|
import cn.iocoder.yudao.framework.sms.core.enums.SmsFrameworkErrorCodeConstants;
|
||||||
import com.aliyuncs.AcsRequest;
|
import com.aliyuncs.AcsRequest;
|
||||||
import com.aliyuncs.IAcsClient;
|
import com.aliyuncs.IAcsClient;
|
||||||
@ -27,6 +26,7 @@ import org.mockito.ArgumentMatcher;
|
|||||||
import org.mockito.InjectMocks;
|
import org.mockito.InjectMocks;
|
||||||
import org.mockito.Mock;
|
import org.mockito.Mock;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
|
||||||
@ -125,7 +125,7 @@ public class AliyunSmsClientTest extends BaseMockitoUnitTest {
|
|||||||
assertEquals("DELIVERED", statuses.get(0).getErrorCode());
|
assertEquals("DELIVERED", statuses.get(0).getErrorCode());
|
||||||
assertEquals("用户接收成功", statuses.get(0).getErrorMsg());
|
assertEquals("用户接收成功", statuses.get(0).getErrorMsg());
|
||||||
assertEquals("13900000001", statuses.get(0).getMobile());
|
assertEquals("13900000001", statuses.get(0).getMobile());
|
||||||
assertEquals(DateUtils.buildLocalDateTime(2017, 2, 2, 22, 23, 24), statuses.get(0).getReceiveTime());
|
assertEquals(LocalDateTime.of(2017, 2, 2, 22, 23, 24), statuses.get(0).getReceiveTime());
|
||||||
assertEquals("12345", statuses.get(0).getSerialNo());
|
assertEquals("12345", statuses.get(0).getSerialNo());
|
||||||
assertEquals(67890L, statuses.get(0).getLogId());
|
assertEquals(67890L, statuses.get(0).getLogId());
|
||||||
}
|
}
|
||||||
@ -181,7 +181,7 @@ public class AliyunSmsClientTest extends BaseMockitoUnitTest {
|
|||||||
when(client.getAcsResponse(any(AcsRequest.class))).thenThrow(ex);
|
when(client.getAcsResponse(any(AcsRequest.class))).thenThrow(ex);
|
||||||
|
|
||||||
// 调用,并断言异常
|
// 调用,并断言异常
|
||||||
SmsCommonResult<?> result = smsClient.invoke(request,null);
|
SmsCommonResult<?> result = smsClient.invoke(request, null);
|
||||||
// 断言
|
// 断言
|
||||||
assertEquals(ex.getErrCode(), result.getApiCode());
|
assertEquals(ex.getErrCode(), result.getApiCode());
|
||||||
assertEquals(ex.getErrMsg(), result.getApiMsg());
|
assertEquals(ex.getErrMsg(), result.getApiMsg());
|
||||||
|
@ -6,7 +6,6 @@ import cn.iocoder.yudao.framework.common.core.KeyValue;
|
|||||||
import cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants;
|
import cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants;
|
||||||
import cn.iocoder.yudao.framework.common.util.collection.ArrayUtils;
|
import cn.iocoder.yudao.framework.common.util.collection.ArrayUtils;
|
||||||
import cn.iocoder.yudao.framework.common.util.collection.MapUtils;
|
import cn.iocoder.yudao.framework.common.util.collection.MapUtils;
|
||||||
import cn.iocoder.yudao.framework.common.util.date.DateUtils;
|
|
||||||
import cn.iocoder.yudao.framework.common.util.json.JsonUtils;
|
import cn.iocoder.yudao.framework.common.util.json.JsonUtils;
|
||||||
import cn.iocoder.yudao.framework.sms.core.client.SmsCommonResult;
|
import cn.iocoder.yudao.framework.sms.core.client.SmsCommonResult;
|
||||||
import cn.iocoder.yudao.framework.sms.core.client.dto.SmsReceiveRespDTO;
|
import cn.iocoder.yudao.framework.sms.core.client.dto.SmsReceiveRespDTO;
|
||||||
@ -25,6 +24,7 @@ import org.junit.jupiter.api.Test;
|
|||||||
import org.mockito.InjectMocks;
|
import org.mockito.InjectMocks;
|
||||||
import org.mockito.Mock;
|
import org.mockito.Mock;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -146,7 +146,7 @@ public class TencentSmsClientTest extends BaseMockitoUnitTest {
|
|||||||
assertEquals("DELIVRD", statuses.get(0).getErrorCode());
|
assertEquals("DELIVRD", statuses.get(0).getErrorCode());
|
||||||
assertEquals("用户短信送达成功", statuses.get(0).getErrorMsg());
|
assertEquals("用户短信送达成功", statuses.get(0).getErrorMsg());
|
||||||
assertEquals("13900000001", statuses.get(0).getMobile());
|
assertEquals("13900000001", statuses.get(0).getMobile());
|
||||||
assertEquals(DateUtils.buildLocalDateTime(2015, 10, 17, 8, 3, 4), statuses.get(0).getReceiveTime());
|
assertEquals(LocalDateTime.of(2015, 10, 17, 8, 3, 4), statuses.get(0).getReceiveTime());
|
||||||
assertEquals("12345", statuses.get(0).getSerialNo());
|
assertEquals("12345", statuses.get(0).getSerialNo());
|
||||||
assertEquals(67890L, statuses.get(0).getLogId());
|
assertEquals(67890L, statuses.get(0).getLogId());
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,6 @@ import cn.iocoder.yudao.framework.sms.core.client.dto.SmsSendRespDTO;
|
|||||||
import cn.iocoder.yudao.framework.sms.core.client.dto.SmsTemplateRespDTO;
|
import cn.iocoder.yudao.framework.sms.core.client.dto.SmsTemplateRespDTO;
|
||||||
import cn.iocoder.yudao.framework.sms.core.enums.SmsTemplateAuditStatusEnum;
|
import cn.iocoder.yudao.framework.sms.core.enums.SmsTemplateAuditStatusEnum;
|
||||||
import cn.iocoder.yudao.framework.sms.core.property.SmsChannelProperties;
|
import cn.iocoder.yudao.framework.sms.core.property.SmsChannelProperties;
|
||||||
import cn.iocoder.yudao.framework.common.util.date.DateUtils;
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.yunpian.sdk.YunpianClient;
|
import com.yunpian.sdk.YunpianClient;
|
||||||
import com.yunpian.sdk.api.SmsApi;
|
import com.yunpian.sdk.api.SmsApi;
|
||||||
@ -23,6 +22,7 @@ import org.junit.jupiter.api.Test;
|
|||||||
import org.mockito.InjectMocks;
|
import org.mockito.InjectMocks;
|
||||||
import org.mockito.Mock;
|
import org.mockito.Mock;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -115,7 +115,7 @@ public class YunpianSmsClientTest extends BaseMockitoUnitTest {
|
|||||||
assertEquals("", statuses.get(0).getErrorCode());
|
assertEquals("", statuses.get(0).getErrorCode());
|
||||||
assertNull(statuses.get(0).getErrorMsg());
|
assertNull(statuses.get(0).getErrorMsg());
|
||||||
assertEquals("15205201314", statuses.get(0).getMobile());
|
assertEquals("15205201314", statuses.get(0).getMobile());
|
||||||
assertEquals(DateUtils.buildLocalDateTime(2014, 3, 17, 22, 55, 21), statuses.get(0).getReceiveTime());
|
assertEquals(LocalDateTime.of(2014, 3, 17, 22, 55, 21), statuses.get(0).getReceiveTime());
|
||||||
assertEquals("9527", statuses.get(0).getSerialNo());
|
assertEquals("9527", statuses.get(0).getSerialNo());
|
||||||
assertEquals(1024L, statuses.get(0).getLogId());
|
assertEquals(1024L, statuses.get(0).getLogId());
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,6 @@ package cn.iocoder.yudao.module.pay.service.order;
|
|||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.util.RandomUtil;
|
import cn.hutool.core.util.RandomUtil;
|
||||||
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.pay.config.PayProperties;
|
import cn.iocoder.yudao.framework.pay.config.PayProperties;
|
||||||
import cn.iocoder.yudao.framework.pay.core.client.PayClientFactory;
|
import cn.iocoder.yudao.framework.pay.core.client.PayClientFactory;
|
||||||
import cn.iocoder.yudao.framework.pay.core.enums.PayChannelEnum;
|
import cn.iocoder.yudao.framework.pay.core.enums.PayChannelEnum;
|
||||||
@ -26,7 +25,6 @@ import javax.annotation.Resource;
|
|||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.buildLocalDateTime;
|
|
||||||
import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId;
|
import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId;
|
||||||
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals;
|
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals;
|
||||||
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo;
|
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo;
|
||||||
@ -83,17 +81,17 @@ public class PayOrderServiceTest extends BaseDbUnitTest {
|
|||||||
o.setChannelFeeAmount(1L);
|
o.setChannelFeeAmount(1L);
|
||||||
o.setStatus(PayOrderStatusEnum.SUCCESS.getStatus());
|
o.setStatus(PayOrderStatusEnum.SUCCESS.getStatus());
|
||||||
o.setUserIp("127.0.0.1");
|
o.setUserIp("127.0.0.1");
|
||||||
o.setCreateTime(DateUtils.buildLocalDateTime(2018, 1, 1, 10, 1, 0));
|
o.setCreateTime(LocalDateTime.of(2018, 1, 1, 10, 1, 0));
|
||||||
o.setExpireTime(DateUtils.buildLocalDateTime(2018, 1, 1, 10, 30, 0));
|
o.setExpireTime(LocalDateTime.of(2018, 1, 1, 10, 30, 0));
|
||||||
o.setSuccessTime(DateUtils.buildLocalDateTime(2018, 1, 1, 10, 10, 2));
|
o.setSuccessTime(LocalDateTime.of(2018, 1, 1, 10, 10, 2));
|
||||||
o.setNotifyTime(DateUtils.buildLocalDateTime(2018, 1, 1, 10, 10, 15));
|
o.setNotifyTime(LocalDateTime.of(2018, 1, 1, 10, 10, 15));
|
||||||
o.setSuccessExtensionId(1L);
|
o.setSuccessExtensionId(1L);
|
||||||
o.setRefundStatus(PayRefundTypeEnum.NO.getStatus());
|
o.setRefundStatus(PayRefundTypeEnum.NO.getStatus());
|
||||||
o.setRefundTimes(0);
|
o.setRefundTimes(0);
|
||||||
o.setRefundAmount(0L);
|
o.setRefundAmount(0L);
|
||||||
o.setChannelUserId("1008611");
|
o.setChannelUserId("1008611");
|
||||||
o.setChannelOrderNo(channelOrderId);
|
o.setChannelOrderNo(channelOrderId);
|
||||||
o.setUpdateTime(DateUtils.buildLocalDateTime(2018, 1, 1, 10, 10, 15));
|
o.setUpdateTime(LocalDateTime.of(2018, 1, 1, 10, 10, 15));
|
||||||
});
|
});
|
||||||
orderMapper.insert(dbOrder);
|
orderMapper.insert(dbOrder);
|
||||||
// 测试 merchantId 不匹配
|
// 测试 merchantId 不匹配
|
||||||
@ -113,7 +111,7 @@ public class PayOrderServiceTest extends BaseDbUnitTest {
|
|||||||
// 测试 refundStatus 不匹配
|
// 测试 refundStatus 不匹配
|
||||||
orderMapper.insert(cloneIgnoreId(dbOrder, o -> o.setRefundStatus(PayRefundTypeEnum.ALL.getStatus())));
|
orderMapper.insert(cloneIgnoreId(dbOrder, o -> o.setRefundStatus(PayRefundTypeEnum.ALL.getStatus())));
|
||||||
// 测试 createTime 不匹配
|
// 测试 createTime 不匹配
|
||||||
orderMapper.insert(cloneIgnoreId(dbOrder, o -> o.setCreateTime(DateUtils.buildLocalDateTime(2019, 1, 1, 10, 10,
|
orderMapper.insert(cloneIgnoreId(dbOrder, o -> o.setCreateTime(LocalDateTime.of(2019, 1, 1, 10, 10,
|
||||||
1))));
|
1))));
|
||||||
// 准备参数
|
// 准备参数
|
||||||
PayOrderPageReqVO reqVO = new PayOrderPageReqVO();
|
PayOrderPageReqVO reqVO = new PayOrderPageReqVO();
|
||||||
@ -125,7 +123,7 @@ public class PayOrderServiceTest extends BaseDbUnitTest {
|
|||||||
reqVO.setNotifyStatus(PayOrderNotifyStatusEnum.SUCCESS.getStatus());
|
reqVO.setNotifyStatus(PayOrderNotifyStatusEnum.SUCCESS.getStatus());
|
||||||
reqVO.setStatus(PayOrderStatusEnum.SUCCESS.getStatus());
|
reqVO.setStatus(PayOrderStatusEnum.SUCCESS.getStatus());
|
||||||
reqVO.setRefundStatus(PayRefundTypeEnum.NO.getStatus());
|
reqVO.setRefundStatus(PayRefundTypeEnum.NO.getStatus());
|
||||||
reqVO.setCreateTime((new LocalDateTime[]{buildLocalDateTime(2018, 1, 1, 10, 1, 0),buildLocalDateTime(2018, 1, 1, 10, 1, 0)}));
|
reqVO.setCreateTime((new LocalDateTime[]{LocalDateTime.of(2018, 1, 1, 10, 1, 0), LocalDateTime.of(2018, 1, 1, 10, 1, 0)}));
|
||||||
// 调用
|
// 调用
|
||||||
PageResult<PayOrderDO> pageResult = orderService.getOrderPage(reqVO);
|
PageResult<PayOrderDO> pageResult = orderService.getOrderPage(reqVO);
|
||||||
// 断言
|
// 断言
|
||||||
@ -155,17 +153,17 @@ public class PayOrderServiceTest extends BaseDbUnitTest {
|
|||||||
o.setChannelFeeAmount(1L);
|
o.setChannelFeeAmount(1L);
|
||||||
o.setStatus(PayOrderStatusEnum.SUCCESS.getStatus());
|
o.setStatus(PayOrderStatusEnum.SUCCESS.getStatus());
|
||||||
o.setUserIp("127.0.0.1");
|
o.setUserIp("127.0.0.1");
|
||||||
o.setCreateTime(DateUtils.buildLocalDateTime(2018, 1, 1, 10, 1, 0));
|
o.setCreateTime(LocalDateTime.of(2018, 1, 1, 10, 1, 0));
|
||||||
o.setExpireTime(DateUtils.buildLocalDateTime(2018, 1, 1, 10, 30, 0));
|
o.setExpireTime(LocalDateTime.of(2018, 1, 1, 10, 30, 0));
|
||||||
o.setSuccessTime(DateUtils.buildLocalDateTime(2018, 1, 1, 10, 10, 2));
|
o.setSuccessTime(LocalDateTime.of(2018, 1, 1, 10, 10, 2));
|
||||||
o.setNotifyTime(DateUtils.buildLocalDateTime(2018, 1, 1, 10, 10, 15));
|
o.setNotifyTime(LocalDateTime.of(2018, 1, 1, 10, 10, 15));
|
||||||
o.setSuccessExtensionId(1L);
|
o.setSuccessExtensionId(1L);
|
||||||
o.setRefundStatus(PayRefundTypeEnum.NO.getStatus());
|
o.setRefundStatus(PayRefundTypeEnum.NO.getStatus());
|
||||||
o.setRefundTimes(0);
|
o.setRefundTimes(0);
|
||||||
o.setRefundAmount(0L);
|
o.setRefundAmount(0L);
|
||||||
o.setChannelUserId("1008611");
|
o.setChannelUserId("1008611");
|
||||||
o.setChannelOrderNo(channelOrderId);
|
o.setChannelOrderNo(channelOrderId);
|
||||||
o.setUpdateTime(DateUtils.buildLocalDateTime(2018, 1, 1, 10, 10, 15));
|
o.setUpdateTime(LocalDateTime.of(2018, 1, 1, 10, 10, 15));
|
||||||
|
|
||||||
});
|
});
|
||||||
orderMapper.insert(dbOrder);
|
orderMapper.insert(dbOrder);
|
||||||
@ -186,7 +184,7 @@ public class PayOrderServiceTest extends BaseDbUnitTest {
|
|||||||
// 测试 refundStatus 不匹配
|
// 测试 refundStatus 不匹配
|
||||||
orderMapper.insert(cloneIgnoreId(dbOrder, o -> o.setRefundStatus(PayRefundTypeEnum.ALL.getStatus())));
|
orderMapper.insert(cloneIgnoreId(dbOrder, o -> o.setRefundStatus(PayRefundTypeEnum.ALL.getStatus())));
|
||||||
// 测试 createTime 不匹配
|
// 测试 createTime 不匹配
|
||||||
orderMapper.insert(cloneIgnoreId(dbOrder, o -> o.setCreateTime(DateUtils.buildLocalDateTime(2019, 1, 1, 10, 10,
|
orderMapper.insert(cloneIgnoreId(dbOrder, o -> o.setCreateTime(LocalDateTime.of(2019, 1, 1, 10, 10,
|
||||||
1))));
|
1))));
|
||||||
// 准备参数
|
// 准备参数
|
||||||
PayOrderExportReqVO reqVO = new PayOrderExportReqVO();
|
PayOrderExportReqVO reqVO = new PayOrderExportReqVO();
|
||||||
@ -198,7 +196,7 @@ public class PayOrderServiceTest extends BaseDbUnitTest {
|
|||||||
reqVO.setNotifyStatus(PayOrderNotifyStatusEnum.SUCCESS.getStatus());
|
reqVO.setNotifyStatus(PayOrderNotifyStatusEnum.SUCCESS.getStatus());
|
||||||
reqVO.setStatus(PayOrderStatusEnum.SUCCESS.getStatus());
|
reqVO.setStatus(PayOrderStatusEnum.SUCCESS.getStatus());
|
||||||
reqVO.setRefundStatus(PayRefundTypeEnum.NO.getStatus());
|
reqVO.setRefundStatus(PayRefundTypeEnum.NO.getStatus());
|
||||||
reqVO.setCreateTime((new LocalDateTime[]{buildLocalDateTime(2018, 1, 1, 10, 1, 0),buildLocalDateTime(2018, 1, 1, 10, 1, 0)}));
|
reqVO.setCreateTime((new LocalDateTime[]{LocalDateTime.of(2018, 1, 1, 10, 1, 0), LocalDateTime.of(2018, 1, 1, 10, 1, 0)}));
|
||||||
|
|
||||||
// 调用
|
// 调用
|
||||||
List<PayOrderDO> list = orderService.getOrderList(reqVO);
|
List<PayOrderDO> list = orderService.getOrderList(reqVO);
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package cn.iocoder.yudao.module.pay.service.refund;
|
package cn.iocoder.yudao.module.pay.service.refund;
|
||||||
|
|
||||||
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.pay.core.client.PayClientFactory;
|
import cn.iocoder.yudao.framework.pay.core.client.PayClientFactory;
|
||||||
import cn.iocoder.yudao.framework.pay.core.enums.PayChannelEnum;
|
import cn.iocoder.yudao.framework.pay.core.enums.PayChannelEnum;
|
||||||
import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
|
import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
|
||||||
@ -25,7 +24,6 @@ import javax.annotation.Resource;
|
|||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.buildLocalDateTime;
|
|
||||||
import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId;
|
import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId;
|
||||||
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals;
|
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals;
|
||||||
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo;
|
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo;
|
||||||
@ -78,11 +76,11 @@ public class PayRefundServiceTest extends BaseDbUnitTest {
|
|||||||
o.setChannelErrorCode("");
|
o.setChannelErrorCode("");
|
||||||
o.setChannelErrorMsg("");
|
o.setChannelErrorMsg("");
|
||||||
o.setChannelExtras("");
|
o.setChannelExtras("");
|
||||||
o.setExpireTime(DateUtils.buildLocalDateTime(2021, 1, 1, 10, 10, 30));
|
o.setExpireTime(LocalDateTime.of(2021, 1, 1, 10, 10, 30));
|
||||||
o.setSuccessTime(DateUtils.buildLocalDateTime(2021, 1, 1, 10, 10, 15));
|
o.setSuccessTime(LocalDateTime.of(2021, 1, 1, 10, 10, 15));
|
||||||
o.setNotifyTime(DateUtils.buildLocalDateTime(2021, 1, 1, 10, 10, 20));
|
o.setNotifyTime(LocalDateTime.of(2021, 1, 1, 10, 10, 20));
|
||||||
o.setCreateTime(DateUtils.buildLocalDateTime(2021, 1, 1, 10, 10, 10));
|
o.setCreateTime(LocalDateTime.of(2021, 1, 1, 10, 10, 10));
|
||||||
o.setUpdateTime(DateUtils.buildLocalDateTime(2021, 1, 1, 10, 10, 35));
|
o.setUpdateTime(LocalDateTime.of(2021, 1, 1, 10, 10, 35));
|
||||||
});
|
});
|
||||||
refundMapper.insert(dbRefund);
|
refundMapper.insert(dbRefund);
|
||||||
// 测试 merchantId 不匹配
|
// 测试 merchantId 不匹配
|
||||||
@ -102,7 +100,7 @@ public class PayRefundServiceTest extends BaseDbUnitTest {
|
|||||||
refundMapper.insert(cloneIgnoreId(dbRefund, o -> o.setType(PayRefundTypeEnum.ALL.getStatus())));
|
refundMapper.insert(cloneIgnoreId(dbRefund, o -> o.setType(PayRefundTypeEnum.ALL.getStatus())));
|
||||||
// 测试 createTime 不匹配
|
// 测试 createTime 不匹配
|
||||||
refundMapper.insert(cloneIgnoreId(dbRefund, o ->
|
refundMapper.insert(cloneIgnoreId(dbRefund, o ->
|
||||||
o.setCreateTime(DateUtils.buildLocalDateTime(2022, 1, 1, 10, 10, 10))));
|
o.setCreateTime(LocalDateTime.of(2022, 1, 1, 10, 10, 10))));
|
||||||
// 准备参数
|
// 准备参数
|
||||||
PayRefundPageReqVO reqVO = new PayRefundPageReqVO();
|
PayRefundPageReqVO reqVO = new PayRefundPageReqVO();
|
||||||
reqVO.setMerchantId(1L);
|
reqVO.setMerchantId(1L);
|
||||||
@ -112,7 +110,7 @@ public class PayRefundServiceTest extends BaseDbUnitTest {
|
|||||||
reqVO.setNotifyStatus(PayOrderNotifyStatusEnum.SUCCESS.getStatus());
|
reqVO.setNotifyStatus(PayOrderNotifyStatusEnum.SUCCESS.getStatus());
|
||||||
reqVO.setStatus(PayRefundStatusEnum.SUCCESS.getStatus());
|
reqVO.setStatus(PayRefundStatusEnum.SUCCESS.getStatus());
|
||||||
reqVO.setType(PayRefundTypeEnum.SOME.getStatus());
|
reqVO.setType(PayRefundTypeEnum.SOME.getStatus());
|
||||||
reqVO.setCreateTime((new LocalDateTime[]{buildLocalDateTime(2021, 1, 1, 10, 10, 10),buildLocalDateTime(2021, 1, 1, 10, 10, 12)}));
|
reqVO.setCreateTime((new LocalDateTime[]{LocalDateTime.of(2021, 1, 1, 10, 10, 10), LocalDateTime.of(2021, 1, 1, 10, 10, 12)}));
|
||||||
|
|
||||||
// 调用
|
// 调用
|
||||||
PageResult<PayRefundDO> pageResult = refundService.getRefundPage(reqVO);
|
PageResult<PayRefundDO> pageResult = refundService.getRefundPage(reqVO);
|
||||||
@ -147,11 +145,11 @@ public class PayRefundServiceTest extends BaseDbUnitTest {
|
|||||||
o.setChannelErrorCode("");
|
o.setChannelErrorCode("");
|
||||||
o.setChannelErrorMsg("");
|
o.setChannelErrorMsg("");
|
||||||
o.setChannelExtras("");
|
o.setChannelExtras("");
|
||||||
o.setExpireTime(DateUtils.buildLocalDateTime(2021, 1, 1, 10, 10, 30));
|
o.setExpireTime(LocalDateTime.of(2021, 1, 1, 10, 10, 30));
|
||||||
o.setSuccessTime(DateUtils.buildLocalDateTime(2021, 1, 1, 10, 10, 15));
|
o.setSuccessTime(LocalDateTime.of(2021, 1, 1, 10, 10, 15));
|
||||||
o.setNotifyTime(DateUtils.buildLocalDateTime(2021, 1, 1, 10, 10, 20));
|
o.setNotifyTime(LocalDateTime.of(2021, 1, 1, 10, 10, 20));
|
||||||
o.setCreateTime(DateUtils.buildLocalDateTime(2021, 1, 1, 10, 10, 10));
|
o.setCreateTime(LocalDateTime.of(2021, 1, 1, 10, 10, 10));
|
||||||
o.setUpdateTime(DateUtils.buildLocalDateTime(2021, 1, 1, 10, 10, 35));
|
o.setUpdateTime(LocalDateTime.of(2021, 1, 1, 10, 10, 35));
|
||||||
});
|
});
|
||||||
refundMapper.insert(dbRefund);
|
refundMapper.insert(dbRefund);
|
||||||
// 测试 merchantId 不匹配
|
// 测试 merchantId 不匹配
|
||||||
@ -171,7 +169,7 @@ public class PayRefundServiceTest extends BaseDbUnitTest {
|
|||||||
refundMapper.insert(cloneIgnoreId(dbRefund, o -> o.setType(PayRefundTypeEnum.ALL.getStatus())));
|
refundMapper.insert(cloneIgnoreId(dbRefund, o -> o.setType(PayRefundTypeEnum.ALL.getStatus())));
|
||||||
// 测试 createTime 不匹配
|
// 测试 createTime 不匹配
|
||||||
refundMapper.insert(cloneIgnoreId(dbRefund, o ->
|
refundMapper.insert(cloneIgnoreId(dbRefund, o ->
|
||||||
o.setCreateTime(DateUtils.buildLocalDateTime(2022, 1, 1, 10, 10, 10))));
|
o.setCreateTime(LocalDateTime.of(2022, 1, 1, 10, 10, 10))));
|
||||||
|
|
||||||
// 准备参数
|
// 准备参数
|
||||||
PayRefundExportReqVO reqVO = new PayRefundExportReqVO();
|
PayRefundExportReqVO reqVO = new PayRefundExportReqVO();
|
||||||
@ -182,7 +180,7 @@ public class PayRefundServiceTest extends BaseDbUnitTest {
|
|||||||
reqVO.setNotifyStatus(PayOrderNotifyStatusEnum.SUCCESS.getStatus());
|
reqVO.setNotifyStatus(PayOrderNotifyStatusEnum.SUCCESS.getStatus());
|
||||||
reqVO.setStatus(PayRefundStatusEnum.SUCCESS.getStatus());
|
reqVO.setStatus(PayRefundStatusEnum.SUCCESS.getStatus());
|
||||||
reqVO.setType(PayRefundTypeEnum.SOME.getStatus());
|
reqVO.setType(PayRefundTypeEnum.SOME.getStatus());
|
||||||
reqVO.setCreateTime((new LocalDateTime[]{buildLocalDateTime(2021, 1, 1, 10, 10, 10),buildLocalDateTime(2021, 1, 1, 10, 10, 12)}));
|
reqVO.setCreateTime((new LocalDateTime[]{LocalDateTime.of(2021, 1, 1, 10, 10, 10), LocalDateTime.of(2021, 1, 1, 10, 10, 12)}));
|
||||||
|
|
||||||
// 调用
|
// 调用
|
||||||
List<PayRefundDO> list = refundService.getRefundList(reqVO);
|
List<PayRefundDO> list = refundService.getRefundList(reqVO);
|
||||||
|
Loading…
Reference in New Issue
Block a user