feat: 删除过期方法

pull/2/head
xingyu 2022-11-23 22:54:44 +08:00
parent 824c54088b
commit 0d0f64e30a
31 changed files with 178 additions and 196 deletions

View File

@ -83,11 +83,6 @@ public class DateUtils {
return buildTime(year, mouth, day, 0, 0, 0);
}
@Deprecated
public static LocalDateTime buildLocalDateTime(int year, int mouth, int day) {
return LocalDateTime.of(year, mouth, day, 0, 0, 0);
}
/**
*
*
@ -132,11 +127,6 @@ public class DateUtils {
return a.isAfter(b) ? a : b;
}
@Deprecated
public static boolean afterNow(LocalDateTime localDateTime) {
return localDateTime.isAfter(LocalDateTime.now());
}
/**
*
*

View File

@ -39,7 +39,7 @@ public abstract class AbstractChannelMessageListener<T extends AbstractChannelMe
@SneakyThrows
protected AbstractChannelMessageListener() {
this.messageType = getMessageClass();
this.channel = messageType.newInstance().getChannel();
this.channel = messageType.getDeclaredConstructor().newInstance().getChannel();
}
/**

View File

@ -50,7 +50,7 @@ public abstract class AbstractStreamMessageListener<T extends AbstractStreamMess
@SneakyThrows
protected AbstractStreamMessageListener() {
this.messageType = getMessageClass();
this.streamKey = messageType.newInstance().getStreamKey();
this.streamKey = messageType.getDeclaredConstructor().newInstance().getStreamKey();
}
@Override

View File

@ -2,7 +2,6 @@ package cn.iocoder.yudao.module.bpm.service.definition;
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.date.DateUtils;
import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
import cn.iocoder.yudao.framework.test.core.util.AssertUtils;
import cn.iocoder.yudao.framework.test.core.util.RandomUtils;
@ -19,7 +18,7 @@ import javax.annotation.Resource;
import java.time.LocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.buildLocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildTime;
import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId;
import static cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants.USER_GROUP_NOT_EXISTS;
@ -106,7 +105,7 @@ public class BpmUserGroupServiceTest extends BaseDbUnitTest {
BpmUserGroupDO dbUserGroup = RandomUtils.randomPojo(BpmUserGroupDO.class, o -> { // 等会查询到
o.setName("芋道源码");
o.setStatus(CommonStatusEnum.ENABLE.getStatus());
o.setCreateTime(DateUtils.buildLocalDateTime(2021, 11, 11));
o.setCreateTime(buildTime(2021, 11, 11));
});
userGroupMapper.insert(dbUserGroup);
// 测试 name 不匹配
@ -114,12 +113,12 @@ public class BpmUserGroupServiceTest extends BaseDbUnitTest {
// 测试 status 不匹配
userGroupMapper.insert(cloneIgnoreId(dbUserGroup, o -> o.setStatus(CommonStatusEnum.DISABLE.getStatus())));
// 测试 createTime 不匹配
userGroupMapper.insert(cloneIgnoreId(dbUserGroup, o -> o.setCreateTime(DateUtils.buildLocalDateTime(2021, 12, 12))));
userGroupMapper.insert(cloneIgnoreId(dbUserGroup, o -> o.setCreateTime(buildTime(2021, 12, 12))));
// 准备参数
BpmUserGroupPageReqVO reqVO = new BpmUserGroupPageReqVO();
reqVO.setName("源码");
reqVO.setStatus(CommonStatusEnum.ENABLE.getStatus());
reqVO.setCreateTime((new LocalDateTime[]{buildLocalDateTime(2021, 11, 10),buildLocalDateTime(2021, 11, 12)}));
reqVO.setCreateTime((new LocalDateTime[]{buildTime(2021, 11, 10),buildTime(2021, 11, 12)}));
// 调用
PageResult<BpmUserGroupDO> pageResult = userGroupService.getUserGroupPage(reqVO);

View File

@ -22,7 +22,7 @@ import java.util.List;
import java.util.function.Consumer;
import static cn.hutool.core.util.RandomUtil.randomEle;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.buildLocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildTime;
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals;
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException;
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*;
@ -153,7 +153,7 @@ public class ConfigServiceTest extends BaseDbUnitTest {
o.setName("芋艿");
o.setConfigKey("yunai");
o.setType(ConfigTypeEnum.SYSTEM.getType());
o.setCreateTime(buildLocalDateTime(2021, 2, 1));
o.setCreateTime(buildTime(2021, 2, 1));
});
configMapper.insert(dbConfig);
// 测试 name 不匹配
@ -163,13 +163,13 @@ public class ConfigServiceTest extends BaseDbUnitTest {
// 测试 type 不匹配
configMapper.insert(ObjectUtils.cloneIgnoreId(dbConfig, o -> o.setType(ConfigTypeEnum.CUSTOM.getType())));
// 测试 createTime 不匹配
configMapper.insert(ObjectUtils.cloneIgnoreId(dbConfig, o -> o.setCreateTime(buildLocalDateTime(2021, 1, 1))));
configMapper.insert(ObjectUtils.cloneIgnoreId(dbConfig, o -> o.setCreateTime(buildTime(2021, 1, 1))));
// 准备参数
ConfigPageReqVO reqVO = new ConfigPageReqVO();
reqVO.setName("艿");
reqVO.setKey("nai");
reqVO.setType(ConfigTypeEnum.SYSTEM.getType());
reqVO.setCreateTime((new LocalDateTime[]{buildLocalDateTime(2021, 1, 15),buildLocalDateTime(2021, 2, 15)}));
reqVO.setCreateTime((new LocalDateTime[]{buildTime(2021, 1, 15),buildTime(2021, 2, 15)}));
// 调用
PageResult<ConfigDO> pageResult = configService.getConfigPage(reqVO);
@ -186,7 +186,7 @@ public class ConfigServiceTest extends BaseDbUnitTest {
o.setName("芋艿");
o.setConfigKey("yunai");
o.setType(ConfigTypeEnum.SYSTEM.getType());
o.setCreateTime(buildLocalDateTime(2021, 2, 1));
o.setCreateTime(buildTime(2021, 2, 1));
});
configMapper.insert(dbConfig);
// 测试 name 不匹配
@ -196,13 +196,13 @@ public class ConfigServiceTest extends BaseDbUnitTest {
// 测试 type 不匹配
configMapper.insert(ObjectUtils.cloneIgnoreId(dbConfig, o -> o.setType(ConfigTypeEnum.CUSTOM.getType())));
// 测试 createTime 不匹配
configMapper.insert(ObjectUtils.cloneIgnoreId(dbConfig, o -> o.setCreateTime(buildLocalDateTime(2021, 1, 1))));
configMapper.insert(ObjectUtils.cloneIgnoreId(dbConfig, o -> o.setCreateTime(buildTime(2021, 1, 1))));
// 准备参数
ConfigExportReqVO reqVO = new ConfigExportReqVO();
reqVO.setName("艿");
reqVO.setKey("nai");
reqVO.setType(ConfigTypeEnum.SYSTEM.getType());
reqVO.setCreateTime((new LocalDateTime[]{buildLocalDateTime(2021, 1, 15),buildLocalDateTime(2021, 2, 15)}));
reqVO.setCreateTime((new LocalDateTime[]{buildTime(2021, 1, 15),buildTime(2021, 2, 15)}));
// 调用
List<ConfigDO> list = configService.getConfigList(reqVO);

View File

@ -28,7 +28,7 @@ import java.time.LocalDateTime;
import java.util.Map;
import static cn.hutool.core.util.RandomUtil.randomEle;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.buildLocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildTime;
import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId;
import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.max;
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals;
@ -219,8 +219,8 @@ public class FileConfigServiceImplTest extends BaseDbUnitTest {
FileConfigPageReqVO reqVO = new FileConfigPageReqVO();
reqVO.setName("芋道");
reqVO.setStorage(FileStorageEnum.LOCAL.getStorage());
reqVO.setCreateTime((new LocalDateTime[]{buildLocalDateTime(2020, 1, 1),
buildLocalDateTime(2020, 1, 24)}));
reqVO.setCreateTime((new LocalDateTime[]{buildTime(2020, 1, 1),
buildTime(2020, 1, 24)}));
// 调用
PageResult<FileConfigDO> pageResult = fileConfigService.getFileConfigPage(reqVO);

View File

@ -17,7 +17,7 @@ import javax.annotation.Resource;
import java.time.LocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.buildLocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildTime;
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException;
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*;
import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.FILE_NOT_EXISTS;
@ -43,7 +43,7 @@ public class FileServiceTest extends BaseDbUnitTest {
FileDO dbFile = randomPojo(FileDO.class, o -> { // 等会查询到
o.setPath("yunai");
o.setType("image/jpg");
o.setCreateTime(buildLocalDateTime(2021, 1, 15));
o.setCreateTime(buildTime(2021, 1, 15));
});
fileMapper.insert(dbFile);
// 测试 path 不匹配
@ -54,13 +54,13 @@ public class FileServiceTest extends BaseDbUnitTest {
}));
// 测试 createTime 不匹配
fileMapper.insert(ObjectUtils.cloneIgnoreId(dbFile, o -> {
o.setCreateTime(buildLocalDateTime(2020, 1, 15));
o.setCreateTime(buildTime(2020, 1, 15));
}));
// 准备参数
FilePageReqVO reqVO = new FilePageReqVO();
reqVO.setPath("yunai");
reqVO.setType("jp");
reqVO.setCreateTime((new LocalDateTime[]{buildLocalDateTime(2021, 1, 10), buildLocalDateTime(2021, 1, 20)}));
reqVO.setCreateTime((new LocalDateTime[]{buildTime(2021, 1, 10), buildTime(2021, 1, 20)}));
// 调用
PageResult<FileDO> pageResult = fileService.getFilePage(reqVO);

View File

@ -16,7 +16,7 @@ import java.util.ArrayList;
import java.util.List;
import static cn.hutool.core.util.RandomUtil.randomEle;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.buildLocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildTime;
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals;
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*;
import static org.junit.jupiter.api.Assertions.assertEquals;
@ -96,8 +96,8 @@ public class JobLogServiceTest extends BaseDbUnitTest {
o.setExecuteIndex(1);
o.setHandlerName("handlerName 单元测试");
o.setStatus(JobLogStatusEnum.SUCCESS.getStatus());
o.setBeginTime(buildLocalDateTime(2021, 1, 8));
o.setEndTime(buildLocalDateTime(2021, 1, 8));
o.setBeginTime(buildTime(2021, 1, 8));
o.setEndTime(buildTime(2021, 1, 8));
});
jobLogMapper.insert(dbJobLog);
// 测试 jobId 不匹配
@ -105,9 +105,9 @@ public class JobLogServiceTest extends BaseDbUnitTest {
// 测试 handlerName 不匹配
jobLogMapper.insert(ObjectUtils.cloneIgnoreId(dbJobLog, o -> o.setHandlerName(randomString())));
// 测试 beginTime 不匹配
jobLogMapper.insert(ObjectUtils.cloneIgnoreId(dbJobLog, o -> o.setBeginTime(buildLocalDateTime(2021, 1, 7))));
jobLogMapper.insert(ObjectUtils.cloneIgnoreId(dbJobLog, o -> o.setBeginTime(buildTime(2021, 1, 7))));
// 测试 endTime 不匹配
jobLogMapper.insert(ObjectUtils.cloneIgnoreId(dbJobLog, o -> o.setEndTime(buildLocalDateTime(2021, 1, 9))));
jobLogMapper.insert(ObjectUtils.cloneIgnoreId(dbJobLog, o -> o.setEndTime(buildTime(2021, 1, 9))));
// 测试 status 不匹配
jobLogMapper.insert(ObjectUtils.cloneIgnoreId(dbJobLog, o -> o.setStatus(JobLogStatusEnum.FAILURE.getStatus())));
// 准备参数
@ -132,8 +132,8 @@ public class JobLogServiceTest extends BaseDbUnitTest {
o.setExecuteIndex(1);
o.setHandlerName("handlerName 单元测试");
o.setStatus(JobLogStatusEnum.SUCCESS.getStatus());
o.setBeginTime(buildLocalDateTime(2021, 1, 8));
o.setEndTime(buildLocalDateTime(2021, 1, 8));
o.setBeginTime(buildTime(2021, 1, 8));
o.setEndTime(buildTime(2021, 1, 8));
});
jobLogMapper.insert(dbJobLog);
// 测试 jobId 不匹配
@ -141,9 +141,9 @@ public class JobLogServiceTest extends BaseDbUnitTest {
// 测试 handlerName 不匹配
jobLogMapper.insert(ObjectUtils.cloneIgnoreId(dbJobLog, o -> o.setHandlerName(randomString())));
// 测试 beginTime 不匹配
jobLogMapper.insert(ObjectUtils.cloneIgnoreId(dbJobLog, o -> o.setBeginTime(buildLocalDateTime(2021, 1, 7))));
jobLogMapper.insert(ObjectUtils.cloneIgnoreId(dbJobLog, o -> o.setBeginTime(buildTime(2021, 1, 7))));
// 测试 endTime 不匹配
jobLogMapper.insert(ObjectUtils.cloneIgnoreId(dbJobLog, o -> o.setEndTime(buildLocalDateTime(2021, 1, 9))));
jobLogMapper.insert(ObjectUtils.cloneIgnoreId(dbJobLog, o -> o.setEndTime(buildTime(2021, 1, 9))));
// 测试 status 不匹配
jobLogMapper.insert(ObjectUtils.cloneIgnoreId(dbJobLog, o -> o.setStatus(JobLogStatusEnum.FAILURE.getStatus())));
// 准备参数

View File

@ -19,7 +19,7 @@ import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.List;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.buildLocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildTime;
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
@ -40,7 +40,7 @@ public class ApiAccessLogServiceImplTest extends BaseDbUnitTest {
int userType = UserTypeEnum.ADMIN.getValue();
String applicationName = "yudao-test";
String requestUrl = "foo";
LocalDateTime beginTime = buildLocalDateTime(2021, 3, 13);
LocalDateTime beginTime = buildTime(2021, 3, 13);
int duration = 1000;
int resultCode = GlobalErrorCodeConstants.SUCCESS.getCode();
@ -65,7 +65,7 @@ public class ApiAccessLogServiceImplTest extends BaseDbUnitTest {
// requestUrl 不同的
apiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setRequestUrl("bar")));
// 构造一个早期时间 2021-02-06 00:00:00
apiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setBeginTime(buildLocalDateTime(2021, 2, 6))));
apiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setBeginTime(buildTime(2021, 2, 6))));
// duration 不同的
apiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setDuration(100)));
// resultCode 不同的
@ -77,7 +77,7 @@ public class ApiAccessLogServiceImplTest extends BaseDbUnitTest {
reqVO.setUserType(userType);
reqVO.setApplicationName(applicationName);
reqVO.setRequestUrl(requestUrl);
reqVO.setBeginTime((new LocalDateTime[]{buildLocalDateTime(2021, 3, 12),buildLocalDateTime(2021, 3, 14)}));
reqVO.setBeginTime((new LocalDateTime[]{buildTime(2021, 3, 12),buildTime(2021, 3, 14)}));
reqVO.setDuration(duration);
reqVO.setResultCode(resultCode);
@ -97,7 +97,7 @@ public class ApiAccessLogServiceImplTest extends BaseDbUnitTest {
int userType = UserTypeEnum.ADMIN.getValue();
String applicationName = "yudao-test";
String requestUrl = "foo";
LocalDateTime beginTime = buildLocalDateTime(2021, 3, 13);
LocalDateTime beginTime = buildTime(2021, 3, 13);
int duration = 1000;
int resultCode = GlobalErrorCodeConstants.SUCCESS.getCode();
@ -122,7 +122,7 @@ public class ApiAccessLogServiceImplTest extends BaseDbUnitTest {
// requestUrl 不同的
apiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setRequestUrl("bar")));
// 构造一个早期时间 2021-02-06 00:00:00
apiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setBeginTime(buildLocalDateTime(2021, 2, 6))));
apiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setBeginTime(buildTime(2021, 2, 6))));
// duration 不同的
apiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setDuration(100)));
// resultCode 不同的
@ -134,7 +134,7 @@ public class ApiAccessLogServiceImplTest extends BaseDbUnitTest {
reqVO.setUserType(userType);
reqVO.setApplicationName(applicationName);
reqVO.setRequestUrl(requestUrl);
reqVO.setBeginTime((new LocalDateTime[]{buildLocalDateTime(2021, 3, 12),buildLocalDateTime(2021, 3, 14)}));
reqVO.setBeginTime((new LocalDateTime[]{buildTime(2021, 3, 12),buildTime(2021, 3, 14)}));
reqVO.setDuration(duration);
reqVO.setResultCode(resultCode);

View File

@ -20,7 +20,7 @@ import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.List;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.buildLocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildTime;
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals;
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException;
import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.API_ERROR_LOG_NOT_FOUND;
@ -44,7 +44,7 @@ public class ApiErrorLogServiceImplTest extends BaseDbUnitTest {
int userType = UserTypeEnum.ADMIN.getValue();
String applicationName = "yudao-test";
String requestUrl = "foo";
LocalDateTime beginTime = buildLocalDateTime(2021, 3, 13);
LocalDateTime beginTime = buildTime(2021, 3, 13);
int progressStatus = ApiErrorLogProcessStatusEnum.INIT.getStatus();
ApiErrorLogDO infApiErrorLogDO = RandomUtils.randomPojo(ApiErrorLogDO.class, logDO -> {
@ -67,7 +67,7 @@ public class ApiErrorLogServiceImplTest extends BaseDbUnitTest {
// requestUrl 不同的
infApiErrorLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiErrorLogDO, logDO -> logDO.setRequestUrl("bar")));
// 构造一个早期时间 2021-02-06 00:00:00
infApiErrorLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiErrorLogDO, logDO -> logDO.setExceptionTime(buildLocalDateTime(2021, 2, 6))));
infApiErrorLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiErrorLogDO, logDO -> logDO.setExceptionTime(buildTime(2021, 2, 6))));
// progressStatus 不同的
infApiErrorLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiErrorLogDO, logDO -> logDO.setProcessStatus(ApiErrorLogProcessStatusEnum.DONE.getStatus())));
@ -77,7 +77,7 @@ public class ApiErrorLogServiceImplTest extends BaseDbUnitTest {
reqVO.setUserType(userType);
reqVO.setApplicationName(applicationName);
reqVO.setRequestUrl(requestUrl);
reqVO.setExceptionTime((new LocalDateTime[]{buildLocalDateTime(2021, 3, 12),buildLocalDateTime(2021, 3, 14)}));
reqVO.setExceptionTime((new LocalDateTime[]{buildTime(2021, 3, 12),buildTime(2021, 3, 14)}));
reqVO.setProcessStatus(progressStatus);
// 调用service方法
@ -96,7 +96,7 @@ public class ApiErrorLogServiceImplTest extends BaseDbUnitTest {
int userType = UserTypeEnum.ADMIN.getValue();
String applicationName = "yudao-test";
String requestUrl = "foo";
LocalDateTime beginTime = buildLocalDateTime(2021, 3, 13);
LocalDateTime beginTime = buildTime(2021, 3, 13);
int progressStatus = ApiErrorLogProcessStatusEnum.INIT.getStatus();
ApiErrorLogDO infApiErrorLogDO = RandomUtils.randomPojo(ApiErrorLogDO.class, logDO -> {
@ -119,7 +119,7 @@ public class ApiErrorLogServiceImplTest extends BaseDbUnitTest {
// requestUrl 不同的
infApiErrorLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiErrorLogDO, logDO -> logDO.setRequestUrl("bar")));
// 构造一个早期时间 2021-02-06 00:00:00
infApiErrorLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiErrorLogDO, logDO -> logDO.setExceptionTime(buildLocalDateTime(2021, 2, 6))));
infApiErrorLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiErrorLogDO, logDO -> logDO.setExceptionTime(buildTime(2021, 2, 6))));
// progressStatus 不同的
infApiErrorLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiErrorLogDO, logDO -> logDO.setProcessStatus(ApiErrorLogProcessStatusEnum.DONE.getStatus())));
@ -129,7 +129,7 @@ public class ApiErrorLogServiceImplTest extends BaseDbUnitTest {
reqVO.setUserType(userType);
reqVO.setApplicationName(applicationName);
reqVO.setRequestUrl(requestUrl);
reqVO.setExceptionTime((new LocalDateTime[]{buildLocalDateTime(2021, 3, 12),buildLocalDateTime(2021, 3, 14)}));
reqVO.setExceptionTime((new LocalDateTime[]{buildTime(2021, 3, 12),buildTime(2021, 3, 14)}));
reqVO.setProcessStatus(progressStatus);
// 调用service方法

View File

@ -2,7 +2,6 @@ package cn.iocoder.yudao.module.infra.service.test;
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.date.DateUtils;
import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
import cn.iocoder.yudao.module.infra.controller.admin.test.vo.TestDemoCreateReqVO;
import cn.iocoder.yudao.module.infra.controller.admin.test.vo.TestDemoExportReqVO;
@ -17,7 +16,7 @@ import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.List;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.buildLocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildTime;
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.assertServiceException;
@ -112,7 +111,7 @@ public class TestDemoServiceImplTest extends BaseDbUnitTest {
o.setType(1);
o.setCategory(2);
o.setRemark("哈哈哈");
o.setCreateTime(DateUtils.buildLocalDateTime(2021, 11, 11));
o.setCreateTime(buildTime(2021, 11, 11));
});
testDemoMapper.insert(dbTestDemo);
// 测试 name 不匹配
@ -126,7 +125,7 @@ public class TestDemoServiceImplTest extends BaseDbUnitTest {
// 测试 remark 不匹配
testDemoMapper.insert(cloneIgnoreId(dbTestDemo, o -> o.setRemark("呵呵呵")));
// 测试 createTime 不匹配
testDemoMapper.insert(cloneIgnoreId(dbTestDemo, o -> o.setCreateTime(DateUtils.buildLocalDateTime(2021, 12, 12))));
testDemoMapper.insert(cloneIgnoreId(dbTestDemo, o -> o.setCreateTime(buildTime(2021, 12, 12))));
// 准备参数
TestDemoPageReqVO reqVO = new TestDemoPageReqVO();
reqVO.setName("芋道");
@ -134,7 +133,7 @@ public class TestDemoServiceImplTest extends BaseDbUnitTest {
reqVO.setType(1);
reqVO.setCategory(2);
reqVO.setRemark("哈哈哈");
reqVO.setCreateTime((new LocalDateTime[]{buildLocalDateTime(2021, 11, 10),buildLocalDateTime(2021, 11, 12)}));
reqVO.setCreateTime((new LocalDateTime[]{buildTime(2021, 11, 10),buildTime(2021, 11, 12)}));
// 调用
PageResult<TestDemoDO> pageResult = testDemoService.getTestDemoPage(reqVO);
@ -153,7 +152,7 @@ public class TestDemoServiceImplTest extends BaseDbUnitTest {
o.setType(1);
o.setCategory(2);
o.setRemark("哈哈哈");
o.setCreateTime(DateUtils.buildLocalDateTime(2021, 11, 11));
o.setCreateTime(buildTime(2021, 11, 11));
});
testDemoMapper.insert(dbTestDemo);
// 测试 name 不匹配
@ -167,7 +166,7 @@ public class TestDemoServiceImplTest extends BaseDbUnitTest {
// 测试 remark 不匹配
testDemoMapper.insert(cloneIgnoreId(dbTestDemo, o -> o.setRemark("呵呵呵")));
// 测试 createTime 不匹配
testDemoMapper.insert(cloneIgnoreId(dbTestDemo, o -> o.setCreateTime(DateUtils.buildLocalDateTime(2021, 12, 12))));
testDemoMapper.insert(cloneIgnoreId(dbTestDemo, o -> o.setCreateTime(buildTime(2021, 12, 12))));
// 准备参数
TestDemoExportReqVO reqVO = new TestDemoExportReqVO();
reqVO.setName("芋道");
@ -175,7 +174,7 @@ public class TestDemoServiceImplTest extends BaseDbUnitTest {
reqVO.setType(1);
reqVO.setCategory(2);
reqVO.setRemark("哈哈哈");
reqVO.setCreateTime((new LocalDateTime[]{buildLocalDateTime(2021, 11, 10),buildLocalDateTime(2021, 11, 12)}));
reqVO.setCreateTime((new LocalDateTime[]{buildTime(2021, 11, 10),buildTime(2021, 11, 12)}));
// 调用
List<TestDemoDO> list = testDemoService.getTestDemoList(reqVO);

View File

@ -15,7 +15,7 @@ import javax.annotation.Resource;
import java.time.LocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.buildLocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildTime;
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.assertServiceException;
@ -107,7 +107,7 @@ public class ProductBrandServiceImplTest extends BaseDbUnitTest {
ProductBrandDO dbBrand = randomPojo(ProductBrandDO.class, o -> { // 等会查询到
o.setName("芋道源码");
o.setStatus(CommonStatusEnum.ENABLE.getStatus());
o.setCreateTime(buildLocalDateTime(2022, 2, 1));
o.setCreateTime(buildTime(2022, 2, 1));
});
brandMapper.insert(dbBrand);
// 测试 name 不匹配
@ -115,12 +115,12 @@ public class ProductBrandServiceImplTest extends BaseDbUnitTest {
// 测试 status 不匹配
brandMapper.insert(cloneIgnoreId(dbBrand, o -> o.setStatus(CommonStatusEnum.DISABLE.getStatus())));
// 测试 createTime 不匹配
brandMapper.insert(cloneIgnoreId(dbBrand, o -> o.setCreateTime(buildLocalDateTime(2022, 3, 1))));
brandMapper.insert(cloneIgnoreId(dbBrand, o -> o.setCreateTime(buildTime(2022, 3, 1))));
// 准备参数
ProductBrandPageReqVO reqVO = new ProductBrandPageReqVO();
reqVO.setName("芋道");
reqVO.setStatus(CommonStatusEnum.ENABLE.getStatus());
reqVO.setCreateTime((new LocalDateTime[]{buildLocalDateTime(2022, 1, 1), buildLocalDateTime(2022, 2, 25)}));
reqVO.setCreateTime((new LocalDateTime[]{buildTime(2022, 1, 1), buildTime(2022, 2, 25)}));
// 调用
PageResult<ProductBrandDO> pageResult = brandService.getBrandPage(reqVO);

View File

@ -8,7 +8,7 @@ import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
import java.time.LocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@ -26,7 +26,7 @@ public class CouponPageReqVO extends PageParam {
@ApiModelProperty(value = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private Date[] createTime;
private LocalDateTime[] createTime;
@ApiModelProperty(value = "用户昵称", example = "芋艿", notes = "模糊匹配")
private String nickname;

View File

@ -1,8 +1,6 @@
package cn.iocoder.yudao.module.promotion.controller.admin.coupon.vo.template;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.validation.InEnum;
import cn.iocoder.yudao.module.promotion.enums.common.PromotionDiscountTypeEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ -10,8 +8,7 @@ import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.constraints.NotNull;
import java.util.Date;
import java.time.LocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@ -32,6 +29,6 @@ public class CouponTemplatePageReqVO extends PageParam {
@ApiModelProperty(value = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private Date[] createTime;
private LocalDateTime[] createTime;
}

View File

@ -15,11 +15,10 @@ import org.junit.jupiter.api.Test;
import org.springframework.context.annotation.Import;
import javax.annotation.Resource;
import java.util.Date;
import java.time.LocalDateTime;
import static cn.hutool.core.util.RandomUtil.randomEle;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.buildLocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.buildTime;
import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildTime;
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.assertServiceException;
@ -119,7 +118,7 @@ public class CouponTemplateServiceImplTest extends BaseDbUnitTest {
o.setName("芋艿");
o.setStatus(CommonStatusEnum.ENABLE.getStatus());
o.setDiscountType(PromotionDiscountTypeEnum.PERCENT.getType());
o.setCreateTime(buildLocalDateTime(2022, 2, 2));
o.setCreateTime(buildTime(2022, 2, 2));
});
couponTemplateMapper.insert(dbCouponTemplate);
// 测试 name 不匹配
@ -129,13 +128,13 @@ public class CouponTemplateServiceImplTest extends BaseDbUnitTest {
// 测试 type 不匹配
couponTemplateMapper.insert(cloneIgnoreId(dbCouponTemplate, o -> o.setDiscountType(PromotionDiscountTypeEnum.PRICE.getType())));
// 测试 createTime 不匹配
couponTemplateMapper.insert(cloneIgnoreId(dbCouponTemplate, o -> o.setCreateTime(buildLocalDateTime(2022, 1, 1))));
couponTemplateMapper.insert(cloneIgnoreId(dbCouponTemplate, o -> o.setCreateTime(buildTime(2022, 1, 1))));
// 准备参数
CouponTemplatePageReqVO reqVO = new CouponTemplatePageReqVO();
reqVO.setName("芋艿");
reqVO.setStatus(CommonStatusEnum.ENABLE.getStatus());
reqVO.setDiscountType(PromotionDiscountTypeEnum.PERCENT.getType());
reqVO.setCreateTime((new Date[]{buildTime(2022, 2, 1), buildTime(2022, 2, 3)}));
reqVO.setCreateTime((new LocalDateTime[]{buildTime(2022, 2, 1), buildTime(2022, 2, 3)}));
// 调用
PageResult<CouponTemplateDO> pageResult = couponTemplateService.getCouponTemplatePage(reqVO);

View File

@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.pay.service.notify;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.exceptions.ExceptionUtil;
import cn.hutool.http.HttpUtil;
import cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils;
import cn.iocoder.yudao.module.pay.dal.dataobject.notify.PayNotifyLogDO;
import cn.iocoder.yudao.module.pay.dal.dataobject.notify.PayNotifyTaskDO;
import cn.iocoder.yudao.module.pay.dal.dataobject.order.PayOrderDO;
@ -164,7 +165,7 @@ public class PayNotifyServiceImpl implements PayNotifyService {
// 校验,当前任务是否已经被通知过
// 虽然已经通过分布式加锁,但是可能同时满足通知的条件,然后都去获得锁。此时,第一个执行完后,第二个还是能拿到锁,然后会再执行一次。
PayNotifyTaskDO dbTask = payNotifyTaskCoreMapper.selectById(task.getId());
if (DateUtils.afterNow(dbTask.getNextNotifyTime())) {
if (LocalDateTimeUtils.afterNow(dbTask.getNextNotifyTime())) {
log.info("[executeNotify][dbTask({}) 任务被忽略,原因是未到达下次通知时间,可能是因为并发执行了]", JsonUtils.toJsonString(dbTask));
return;
}

View File

@ -22,7 +22,7 @@ import java.time.LocalDateTime;
import java.util.Collections;
import java.util.List;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.buildLocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildTime;
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.assertServiceException;
@ -123,7 +123,7 @@ public class PayAppServiceTest extends BaseDbUnitTest {
o.setPayNotifyUrl("https://www.hc.com");
o.setRefundNotifyUrl("https://www.xm.com");
o.setMerchantId(merchantId);
o.setCreateTime(buildLocalDateTime(2021,11,20));
o.setCreateTime(buildTime(2021,11,20));
});
// mock 数据
@ -134,7 +134,7 @@ public class PayAppServiceTest extends BaseDbUnitTest {
o.setShortName("灿灿子");
o.setStatus(CommonStatusEnum.ENABLE.getStatus());
o.setRemark("灿哥的杂货铺");
o.setCreateTime(buildLocalDateTime(2021,11,3));
o.setCreateTime(buildTime(2021,11,3));
});
Mockito.when(payMerchantMapper.getMerchantListByName(dbMerchant.getName()))
@ -154,7 +154,7 @@ public class PayAppServiceTest extends BaseDbUnitTest {
// 测试 merchantId 不匹配
appMapper.insert(cloneIgnoreId(dbApp, o -> o.setMerchantId(mismatchMerchantId)));
// 测试 createTime 不匹配
appMapper.insert(cloneIgnoreId(dbApp, o -> o.setCreateTime(buildLocalDateTime(2021,12,21))));
appMapper.insert(cloneIgnoreId(dbApp, o -> o.setCreateTime(buildTime(2021,12,21))));
// 准备参数
PayAppPageReqVO reqVO = new PayAppPageReqVO();
reqVO.setName("灿灿姐的杂货铺");
@ -163,7 +163,7 @@ public class PayAppServiceTest extends BaseDbUnitTest {
reqVO.setPayNotifyUrl("https://www.hc.com");
reqVO.setRefundNotifyUrl("https://www.xm.com");
reqVO.setMerchantName(dbMerchant.getName());
reqVO.setCreateTime((new LocalDateTime[]{buildLocalDateTime(2021,11,19),buildLocalDateTime(2021,11,21)}));
reqVO.setCreateTime((new LocalDateTime[]{buildTime(2021,11,19),buildTime(2021,11,21)}));
// 调用
PageResult<PayAppDO> pageResult = appService.getAppPage(reqVO);
@ -186,7 +186,7 @@ public class PayAppServiceTest extends BaseDbUnitTest {
o.setPayNotifyUrl("https://www.hc.com");
o.setRefundNotifyUrl("https://www.xm.com");
o.setMerchantId(merchantId);
o.setCreateTime(buildLocalDateTime(2021,11,20));
o.setCreateTime(buildTime(2021,11,20));
});
// mock 数据
@ -197,7 +197,7 @@ public class PayAppServiceTest extends BaseDbUnitTest {
o.setShortName("灿灿子");
o.setStatus(CommonStatusEnum.ENABLE.getStatus());
o.setRemark("灿哥的杂货铺");
o.setCreateTime(buildLocalDateTime(2021,11,3));
o.setCreateTime(buildTime(2021,11,3));
});
Mockito.when(payMerchantMapper.getMerchantListByName(dbMerchant.getName()))
@ -217,7 +217,7 @@ public class PayAppServiceTest extends BaseDbUnitTest {
// 测试 merchantId 不匹配
appMapper.insert(cloneIgnoreId(dbApp, o -> o.setMerchantId(mismatchMerchantId)));
// 测试 createTime 不匹配
appMapper.insert(cloneIgnoreId(dbApp, o -> o.setCreateTime(buildLocalDateTime(2021,12,21))));
appMapper.insert(cloneIgnoreId(dbApp, o -> o.setCreateTime(buildTime(2021,12,21))));
// 准备参数
PayAppExportReqVO reqVO = new PayAppExportReqVO();
reqVO.setName("灿灿姐的杂货铺");
@ -226,7 +226,7 @@ public class PayAppServiceTest extends BaseDbUnitTest {
reqVO.setPayNotifyUrl("https://www.hc.com");
reqVO.setRefundNotifyUrl("https://www.xm.com");
reqVO.setMerchantName(dbMerchant.getName());
reqVO.setCreateTime((new LocalDateTime[]{buildLocalDateTime(2021,11,19),buildLocalDateTime(2021,11,21)}));
reqVO.setCreateTime((new LocalDateTime[]{buildTime(2021,11,19),buildTime(2021,11,21)}));
// 调用
List<PayAppDO> list = appService.getAppList(reqVO);

View File

@ -23,7 +23,7 @@ import javax.validation.Validator;
import java.time.LocalDateTime;
import java.util.List;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.buildLocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildTime;
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.assertServiceException;
@ -215,7 +215,7 @@ public class PayChannelServiceTest extends BaseDbUnitTest {
o.setMerchantId(1L);
o.setAppId(1L);
o.setConfig(payClientConfig);
o.setCreateTime(buildLocalDateTime(2021,11,20));
o.setCreateTime(buildTime(2021,11,20));
});
channelMapper.insert(dbChannel);
// 执行拷贝的时候会出现异常所以在插入后要重置为null 后续在写入新的
@ -253,7 +253,7 @@ public class PayChannelServiceTest extends BaseDbUnitTest {
// 测试 createTime 不匹配
channelMapper.insert(cloneIgnoreId(dbChannel, o -> {
o.setConfig(payClientConfig);
o.setCreateTime(buildLocalDateTime(2021, 10, 20));
o.setCreateTime(buildTime(2021, 10, 20));
}));
// 准备参数
PayChannelPageReqVO reqVO = new PayChannelPageReqVO();
@ -264,7 +264,7 @@ public class PayChannelServiceTest extends BaseDbUnitTest {
reqVO.setMerchantId(1L);
reqVO.setAppId(1L);
reqVO.setConfig(JSON.toJSONString(payClientConfig));
reqVO.setCreateTime((new LocalDateTime[]{buildLocalDateTime(2021,11,19),buildLocalDateTime(2021,11,21)}));
reqVO.setCreateTime((new LocalDateTime[]{buildTime(2021,11,19),buildTime(2021,11,21)}));
// 调用
PageResult<PayChannelDO> pageResult = channelService.getChannelPage(reqVO);
@ -288,7 +288,7 @@ public class PayChannelServiceTest extends BaseDbUnitTest {
o.setMerchantId(1L);
o.setAppId(1L);
o.setConfig(payClientConfig);
o.setCreateTime(buildLocalDateTime(2021,11,20));
o.setCreateTime(buildTime(2021,11,20));
});
channelMapper.insert(dbChannel);
// 执行拷贝的时候会出现异常所以在插入后要重置为null 后续在写入新的
@ -326,7 +326,7 @@ public class PayChannelServiceTest extends BaseDbUnitTest {
// 测试 createTime 不匹配
channelMapper.insert(cloneIgnoreId(dbChannel, o -> {
o.setConfig(payClientConfig);
o.setCreateTime(buildLocalDateTime(2021, 10, 20));
o.setCreateTime(buildTime(2021, 10, 20));
}));
// 准备参数
PayChannelExportReqVO reqVO = new PayChannelExportReqVO();
@ -337,7 +337,7 @@ public class PayChannelServiceTest extends BaseDbUnitTest {
reqVO.setMerchantId(1L);
reqVO.setAppId(1L);
reqVO.setConfig(JSON.toJSONString(payClientConfig));
reqVO.setCreateTime((new LocalDateTime[]{buildLocalDateTime(2021,11,19),buildLocalDateTime(2021,11,21)}));
reqVO.setCreateTime((new LocalDateTime[]{buildTime(2021,11,19),buildTime(2021,11,21)}));
// 调用
List<PayChannelDO> list = channelService.getChannelList(reqVO);

View File

@ -17,7 +17,7 @@ import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.List;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.buildLocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildTime;
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.assertServiceException;
@ -116,7 +116,7 @@ public class PayMerchantServiceTest extends BaseDbUnitTest {
o.setShortName("灿灿子");
o.setStatus(CommonStatusEnum.ENABLE.getStatus());
o.setRemark("灿哥的杂货铺");
o.setCreateTime(buildLocalDateTime(2021,11,3));
o.setCreateTime(buildTime(2021,11,3));
});
merchantMapper.insert(dbMerchant);
// 测试 no 不匹配
@ -130,7 +130,7 @@ public class PayMerchantServiceTest extends BaseDbUnitTest {
// 测试 remark 不匹配
merchantMapper.insert(cloneIgnoreId(dbMerchant, o -> o.setRemark("斌哥的杂货铺")));
// 测试 createTime 不匹配
merchantMapper.insert(cloneIgnoreId(dbMerchant, o -> o.setCreateTime(buildLocalDateTime(2022,12,4))));
merchantMapper.insert(cloneIgnoreId(dbMerchant, o -> o.setCreateTime(buildTime(2022,12,4))));
// 准备参数
PayMerchantPageReqVO reqVO = new PayMerchantPageReqVO();
reqVO.setNo("M1008611");
@ -138,7 +138,7 @@ public class PayMerchantServiceTest extends BaseDbUnitTest {
reqVO.setShortName("灿灿子");
reqVO.setStatus(CommonStatusEnum.ENABLE.getStatus());
reqVO.setRemark("灿哥的杂货铺");
reqVO.setCreateTime((new LocalDateTime[]{buildLocalDateTime(2021,11,2),buildLocalDateTime(2021,11,4)}));
reqVO.setCreateTime((new LocalDateTime[]{buildTime(2021,11,2),buildTime(2021,11,4)}));
// 调用
PageResult<PayMerchantDO> pageResult = merchantService.getMerchantPage(reqVO);
@ -157,7 +157,7 @@ public class PayMerchantServiceTest extends BaseDbUnitTest {
o.setShortName("灿灿子");
o.setStatus(CommonStatusEnum.ENABLE.getStatus());
o.setRemark("灿哥的杂货铺");
o.setCreateTime(buildLocalDateTime(2021,11,3));
o.setCreateTime(buildTime(2021,11,3));
});
merchantMapper.insert(dbMerchant);
// 测试 no 不匹配
@ -171,7 +171,7 @@ public class PayMerchantServiceTest extends BaseDbUnitTest {
// 测试 remark 不匹配
merchantMapper.insert(cloneIgnoreId(dbMerchant, o -> o.setRemark("斌哥的杂货铺")));
// 测试 createTime 不匹配
merchantMapper.insert(cloneIgnoreId(dbMerchant, o -> o.setCreateTime(buildLocalDateTime(2022,12,4))));
merchantMapper.insert(cloneIgnoreId(dbMerchant, o -> o.setCreateTime(buildTime(2022,12,4))));
// 准备参数
PayMerchantExportReqVO reqVO = new PayMerchantExportReqVO();
reqVO.setNo("M1008611");
@ -179,7 +179,7 @@ public class PayMerchantServiceTest extends BaseDbUnitTest {
reqVO.setShortName("灿灿子");
reqVO.setStatus(CommonStatusEnum.ENABLE.getStatus());
reqVO.setRemark("灿哥的杂货铺");
reqVO.setCreateTime((new LocalDateTime[]{buildLocalDateTime(2021,11,2),buildLocalDateTime(2021,11,4)}));
reqVO.setCreateTime((new LocalDateTime[]{buildTime(2021,11,2),buildTime(2021,11,4)}));
// 调用
List<PayMerchantDO> list = merchantService.getMerchantList(reqVO);

View File

@ -24,7 +24,7 @@ import static cn.hutool.core.util.RandomUtil.randomEle;
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*;
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals;
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.buildLocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildTime;
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*;
import static org.junit.jupiter.api.Assertions.*;
import static org.mockito.ArgumentMatchers.eq;
@ -48,7 +48,7 @@ public class DictTypeServiceTest extends BaseDbUnitTest {
o.setName("yunai");
o.setType("芋艿");
o.setStatus(CommonStatusEnum.ENABLE.getStatus());
o.setCreateTime(buildLocalDateTime(2021, 1, 15));
o.setCreateTime(buildTime(2021, 1, 15));
});
dictTypeMapper.insert(dbDictType);
// 测试 name 不匹配
@ -58,13 +58,13 @@ public class DictTypeServiceTest extends BaseDbUnitTest {
// 测试 status 不匹配
dictTypeMapper.insert(ObjectUtils.cloneIgnoreId(dbDictType, o -> o.setStatus(CommonStatusEnum.DISABLE.getStatus())));
// 测试 createTime 不匹配
dictTypeMapper.insert(ObjectUtils.cloneIgnoreId(dbDictType, o -> o.setCreateTime(buildLocalDateTime(2021, 1, 1))));
dictTypeMapper.insert(ObjectUtils.cloneIgnoreId(dbDictType, o -> o.setCreateTime(buildTime(2021, 1, 1))));
// 准备参数
DictTypePageReqVO reqVO = new DictTypePageReqVO();
reqVO.setName("nai");
reqVO.setType("艿");
reqVO.setStatus(CommonStatusEnum.ENABLE.getStatus());
reqVO.setCreateTime((new LocalDateTime[]{buildLocalDateTime(2021, 1, 10),buildLocalDateTime(2021, 1, 20)}));
reqVO.setCreateTime((new LocalDateTime[]{buildTime(2021, 1, 10),buildTime(2021, 1, 20)}));
// 调用
PageResult<DictTypeDO> pageResult = dictTypeService.getDictTypePage(reqVO);
@ -81,7 +81,7 @@ public class DictTypeServiceTest extends BaseDbUnitTest {
o.setName("yunai");
o.setType("芋艿");
o.setStatus(CommonStatusEnum.ENABLE.getStatus());
o.setCreateTime(buildLocalDateTime(2021, 1, 15));
o.setCreateTime(buildTime(2021, 1, 15));
});
dictTypeMapper.insert(dbDictType);
// 测试 name 不匹配
@ -91,13 +91,13 @@ public class DictTypeServiceTest extends BaseDbUnitTest {
// 测试 status 不匹配
dictTypeMapper.insert(ObjectUtils.cloneIgnoreId(dbDictType, o -> o.setStatus(CommonStatusEnum.DISABLE.getStatus())));
// 测试 createTime 不匹配
dictTypeMapper.insert(ObjectUtils.cloneIgnoreId(dbDictType, o -> o.setCreateTime(buildLocalDateTime(2021, 1, 1))));
dictTypeMapper.insert(ObjectUtils.cloneIgnoreId(dbDictType, o -> o.setCreateTime(buildTime(2021, 1, 1))));
// 准备参数
DictTypeExportReqVO reqVO = new DictTypeExportReqVO();
reqVO.setName("nai");
reqVO.setType("艿");
reqVO.setStatus(CommonStatusEnum.ENABLE.getStatus());
reqVO.setCreateTime((new LocalDateTime[]{buildLocalDateTime(2021, 1, 10),buildLocalDateTime(2021, 1, 20)}));
reqVO.setCreateTime((new LocalDateTime[]{buildTime(2021, 1, 10),buildTime(2021, 1, 20)}));
// 调用
List<DictTypeDO> list = dictTypeService.getDictTypeList(reqVO);

View File

@ -22,7 +22,7 @@ import java.util.List;
import java.util.function.Consumer;
import static cn.hutool.core.util.RandomUtil.randomEle;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.buildLocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildTime;
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals;
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException;
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*;
@ -96,7 +96,7 @@ public class ErrorCodeServiceTest extends BaseDbUnitTest {
reqVO.setApplicationName("tu");
reqVO.setCode(1);
reqVO.setMessage("ma");
reqVO.setCreateTime((new LocalDateTime[]{buildLocalDateTime(2020, 11, 1),buildLocalDateTime(2020, 11, 30)}));
reqVO.setCreateTime((new LocalDateTime[]{buildTime(2020, 11, 1),buildTime(2020, 11, 30)}));
// 调用
PageResult<ErrorCodeDO> pageResult = errorCodeService.getErrorCodePage(reqVO);
@ -115,7 +115,7 @@ public class ErrorCodeServiceTest extends BaseDbUnitTest {
o.setApplicationName("tudou");
o.setCode(1);
o.setMessage("yuanma");
o.setCreateTime(buildLocalDateTime(2020, 11, 11));
o.setCreateTime(buildTime(2020, 11, 11));
});
errorCodeMapper.insert(dbErrorCode);
// 测试 type 不匹配
@ -127,7 +127,7 @@ public class ErrorCodeServiceTest extends BaseDbUnitTest {
// 测试 message 不匹配
errorCodeMapper.insert(ObjectUtils.cloneIgnoreId(dbErrorCode, o -> o.setMessage("nai")));
// 测试 createTime 不匹配
errorCodeMapper.insert(ObjectUtils.cloneIgnoreId(dbErrorCode, o -> o.setCreateTime(buildLocalDateTime(2020, 12, 12))));
errorCodeMapper.insert(ObjectUtils.cloneIgnoreId(dbErrorCode, o -> o.setCreateTime(buildTime(2020, 12, 12))));
return dbErrorCode;
}
@ -141,7 +141,7 @@ public class ErrorCodeServiceTest extends BaseDbUnitTest {
reqVO.setApplicationName("tu");
reqVO.setCode(1);
reqVO.setMessage("ma");
reqVO.setCreateTime((new LocalDateTime[]{buildLocalDateTime(2020, 11, 1),buildLocalDateTime(2020, 11, 30)}));
reqVO.setCreateTime((new LocalDateTime[]{buildTime(2020, 11, 1),buildTime(2020, 11, 30)}));
// 调用
List<ErrorCodeDO> list = errorCodeService.getErrorCodeList(reqVO);

View File

@ -21,7 +21,7 @@ import java.time.LocalDateTime;
import java.util.List;
import static cn.hutool.core.util.RandomUtil.randomEle;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.buildLocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildTime;
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals;
import static cn.iocoder.yudao.module.system.enums.logger.LoginResultEnum.*;
import static org.junit.jupiter.api.Assertions.assertEquals;
@ -46,7 +46,7 @@ public class LoginLogServiceImplTest extends BaseDbUnitTest {
logDO.setUserIp("192.168.199.16");
logDO.setUsername("wangkai");
logDO.setCreateTime(buildLocalDateTime(2021, 3, 6));
logDO.setCreateTime(buildTime(2021, 3, 6));
logDO.setResult(SUCCESS.getResult());
});
loginLogMapper.insert(loginLogDO);
@ -59,7 +59,7 @@ public class LoginLogServiceImplTest extends BaseDbUnitTest {
// 不同username
loginLogMapper.insert(ObjectUtils.cloneIgnoreId(loginLogDO, logDO -> logDO.setUsername("yunai")));
// 构造一个早期时间 2021-02-06 00:00:00
loginLogMapper.insert(ObjectUtils.cloneIgnoreId(loginLogDO, logDO -> logDO.setCreateTime(buildLocalDateTime(2021, 2, 6))));
loginLogMapper.insert(ObjectUtils.cloneIgnoreId(loginLogDO, logDO -> logDO.setCreateTime(buildTime(2021, 2, 6))));
// 构造调用参数
@ -67,8 +67,8 @@ public class LoginLogServiceImplTest extends BaseDbUnitTest {
reqVO.setUsername("wangkai");
reqVO.setUserIp("192.168.199");
reqVO.setStatus(true);
reqVO.setCreateTime((new LocalDateTime[]{buildLocalDateTime(2021, 3, 5),
buildLocalDateTime(2021, 3, 7)}));
reqVO.setCreateTime((new LocalDateTime[]{buildTime(2021, 3, 5),
buildTime(2021, 3, 7)}));
// 调用service方法
PageResult<LoginLogDO> pageResult = loginLogService.getLoginLogPage(reqVO);
@ -91,7 +91,7 @@ public class LoginLogServiceImplTest extends BaseDbUnitTest {
logDO.setUserIp("192.168.111.16");
logDO.setUsername("wangxiaokai");
logDO.setCreateTime(buildLocalDateTime(2021, 3, 6));
logDO.setCreateTime(buildTime(2021, 3, 6));
logDO.setResult(SUCCESS.getResult());
});
loginLogMapper.insert(loginLogDO);
@ -104,15 +104,15 @@ public class LoginLogServiceImplTest extends BaseDbUnitTest {
// 不同username
loginLogMapper.insert(ObjectUtils.cloneIgnoreId(loginLogDO, logDO -> logDO.setUsername("yunai")));
// 构造一个早期时间 2021-02-06 00:00:00
loginLogMapper.insert(ObjectUtils.cloneIgnoreId(loginLogDO, logDO -> logDO.setCreateTime(buildLocalDateTime(2021, 2, 6))));
loginLogMapper.insert(ObjectUtils.cloneIgnoreId(loginLogDO, logDO -> logDO.setCreateTime(buildTime(2021, 2, 6))));
// 构造调用参数
LoginLogExportReqVO reqVO = new LoginLogExportReqVO();
reqVO.setUsername("wangxiaokai");
reqVO.setUserIp("192.168.111");
reqVO.setStatus(true);
reqVO.setCreateTime((new LocalDateTime[]{buildLocalDateTime(2021, 3, 5),
buildLocalDateTime(2021, 3, 7)}));
reqVO.setCreateTime((new LocalDateTime[]{buildTime(2021, 3, 5),
buildTime(2021, 3, 7)}));
// 调用service方法
List<LoginLogDO> loginLogList = loginLogService.getLoginLogList(reqVO);

View File

@ -29,7 +29,7 @@ import java.util.List;
import static cn.hutool.core.util.RandomUtil.randomEle;
import static cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants.BAD_REQUEST;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.buildLocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildTime;
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals;
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomLongId;
import static org.junit.jupiter.api.Assertions.assertEquals;
@ -81,7 +81,7 @@ public class OperateLogServiceImplTest extends BaseDbUnitTest {
o.setUserType(randomEle(UserTypeEnum.values()).getValue());
o.setModule("order");
o.setType(OperateTypeEnum.CREATE.getType());
o.setStartTime(buildLocalDateTime(2021, 3, 6));
o.setStartTime(buildTime(2021, 3, 6));
o.setResultCode(GlobalErrorCodeConstants.SUCCESS.getCode());
o.setExts(MapUtil.<String, Object>builder("orderId", randomLongId()).build());
});
@ -95,7 +95,7 @@ public class OperateLogServiceImplTest extends BaseDbUnitTest {
// type 不同
operateLogMapper.insert(ObjectUtils.cloneIgnoreId(sysOperateLogDO, logDO -> logDO.setType(OperateTypeEnum.IMPORT.getType())));
// createTime 不同
operateLogMapper.insert(ObjectUtils.cloneIgnoreId(sysOperateLogDO, logDO -> logDO.setStartTime(buildLocalDateTime(2021, 2, 6))));
operateLogMapper.insert(ObjectUtils.cloneIgnoreId(sysOperateLogDO, logDO -> logDO.setStartTime(buildTime(2021, 2, 6))));
// resultCode 不同
operateLogMapper.insert(ObjectUtils.cloneIgnoreId(sysOperateLogDO, logDO -> logDO.setResultCode(BAD_REQUEST.getCode())));
@ -104,8 +104,8 @@ public class OperateLogServiceImplTest extends BaseDbUnitTest {
reqVO.setUserNickname("wangkai");
reqVO.setModule("order");
reqVO.setType(OperateTypeEnum.CREATE.getType());
reqVO.setStartTime((new LocalDateTime[]{buildLocalDateTime(2021, 3, 5),
buildLocalDateTime(2021, 3, 7)}));
reqVO.setStartTime((new LocalDateTime[]{buildTime(2021, 3, 5),
buildTime(2021, 3, 7)}));
reqVO.setSuccess(true);
// 调用service方法
@ -133,7 +133,7 @@ public class OperateLogServiceImplTest extends BaseDbUnitTest {
o.setUserType(randomEle(UserTypeEnum.values()).getValue());
o.setModule("order");
o.setType(OperateTypeEnum.CREATE.getType());
o.setStartTime(buildLocalDateTime(2021, 3, 6));
o.setStartTime(buildTime(2021, 3, 6));
o.setResultCode(GlobalErrorCodeConstants.SUCCESS.getCode());
o.setExts(MapUtil.<String, Object>builder("orderId", randomLongId()).build());
});
@ -147,7 +147,7 @@ public class OperateLogServiceImplTest extends BaseDbUnitTest {
// type 不同
operateLogMapper.insert(ObjectUtils.cloneIgnoreId(sysOperateLogDO, logDO -> logDO.setType(OperateTypeEnum.IMPORT.getType())));
// createTime 不同
operateLogMapper.insert(ObjectUtils.cloneIgnoreId(sysOperateLogDO, logDO -> logDO.setStartTime(buildLocalDateTime(2021, 2, 6))));
operateLogMapper.insert(ObjectUtils.cloneIgnoreId(sysOperateLogDO, logDO -> logDO.setStartTime(buildTime(2021, 2, 6))));
// resultCode 不同
operateLogMapper.insert(ObjectUtils.cloneIgnoreId(sysOperateLogDO, logDO -> logDO.setResultCode(BAD_REQUEST.getCode())));
@ -156,7 +156,7 @@ public class OperateLogServiceImplTest extends BaseDbUnitTest {
reqVO.setUserNickname("wangkai");
reqVO.setModule("order");
reqVO.setType(OperateTypeEnum.CREATE.getType());
reqVO.setStartTime((new LocalDateTime[]{buildLocalDateTime(2021, 3, 5),buildLocalDateTime(2021, 3, 7)}));
reqVO.setStartTime((new LocalDateTime[]{buildTime(2021, 3, 5),buildTime(2021, 3, 7)}));
reqVO.setSuccess(true);
// 调用 service 方法

View File

@ -3,7 +3,6 @@ package cn.iocoder.yudao.module.system.service.permission;
import cn.hutool.core.util.RandomUtil;
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.date.DateUtils;
import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
import cn.iocoder.yudao.module.system.controller.admin.permission.vo.role.RoleCreateReqVO;
import cn.iocoder.yudao.module.system.controller.admin.permission.vo.role.RoleExportReqVO;
@ -21,9 +20,8 @@ import org.springframework.context.annotation.Import;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.*;
import java.util.stream.Collectors;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.buildLocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildTime;
import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId;
import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.max;
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals;
@ -129,7 +127,7 @@ public class RoleServiceTest extends BaseDbUnitTest {
Long roleId = roleDO.getId();
//调用
Set<Long> deptIdSet = Arrays.asList(1L, 2L, 3L, 4L, 5L).stream().collect(Collectors.toSet());
Set<Long> deptIdSet = new HashSet<>(Arrays.asList(1L, 2L, 3L, 4L, 5L));
roleService.updateRoleDataScope(roleId, DataScopeEnum.DEPT_CUSTOM.getScope(), deptIdSet);
//断言
@ -137,7 +135,7 @@ public class RoleServiceTest extends BaseDbUnitTest {
assertEquals(DataScopeEnum.DEPT_CUSTOM.getScope(), newRoleDO.getDataScope());
Set<Long> newDeptIdSet = newRoleDO.getDataScopeDeptIds();
assertTrue(deptIdSet.size() == newDeptIdSet.size());
assertEquals(deptIdSet.size(), newDeptIdSet.size());
deptIdSet.stream().forEach(d -> assertTrue(newDeptIdSet.contains(d)));
verify(roleProducer).sendRoleRefreshMessage();
@ -166,7 +164,7 @@ public class RoleServiceTest extends BaseDbUnitTest {
o.setName("土豆");
o.setCode("tudou");
o.setStatus(CommonStatusEnum.ENABLE.getStatus());
o.setCreateTime(DateUtils.buildLocalDateTime(2022, 2, 8));
o.setCreateTime(buildTime(2022, 2, 8));
});
roleMapper.insert(dbRole);
// 测试 name 不匹配
@ -174,13 +172,13 @@ public class RoleServiceTest extends BaseDbUnitTest {
// 测试 code 不匹配
roleMapper.insert(cloneIgnoreId(dbRole, o -> o.setCode("hong")));
// 测试 createTime 不匹配
roleMapper.insert(cloneIgnoreId(dbRole, o -> o.setCreateTime(DateUtils.buildLocalDateTime(2022, 2, 16))));
roleMapper.insert(cloneIgnoreId(dbRole, o -> o.setCreateTime(buildTime(2022, 2, 16))));
// 准备参数
RoleExportReqVO reqVO = new RoleExportReqVO();
reqVO.setName("土豆");
reqVO.setCode("tu");
reqVO.setStatus(CommonStatusEnum.ENABLE.getStatus());
reqVO.setCreateTime((new LocalDateTime[]{buildLocalDateTime(2022, 2, 1),buildLocalDateTime(2022, 2, 12)}));
reqVO.setCreateTime((new LocalDateTime[]{buildTime(2022, 2, 1),buildTime(2022, 2, 12)}));
// 调用
List<RoleDO> list = roleService.getRoleList(reqVO);
@ -196,7 +194,7 @@ public class RoleServiceTest extends BaseDbUnitTest {
o.setName("土豆");
o.setCode("tudou");
o.setStatus(CommonStatusEnum.ENABLE.getStatus());
o.setCreateTime(DateUtils.buildLocalDateTime(2022, 2, 8));
o.setCreateTime(buildTime(2022, 2, 8));
});
roleMapper.insert(dbRole);
// 测试 name 不匹配
@ -204,13 +202,13 @@ public class RoleServiceTest extends BaseDbUnitTest {
// 测试 code 不匹配
roleMapper.insert(cloneIgnoreId(dbRole, o -> o.setCode("hong")));
// 测试 createTime 不匹配
roleMapper.insert(cloneIgnoreId(dbRole, o -> o.setCreateTime(DateUtils.buildLocalDateTime(2022, 2, 16))));
roleMapper.insert(cloneIgnoreId(dbRole, o -> o.setCreateTime(buildTime(2022, 2, 16))));
// 准备参数
RolePageReqVO reqVO = new RolePageReqVO();
reqVO.setName("土豆");
reqVO.setCode("tu");
reqVO.setStatus(CommonStatusEnum.ENABLE.getStatus());
reqVO.setCreateTime((new LocalDateTime[]{buildLocalDateTime(2022, 2, 1),buildLocalDateTime(2022, 2, 12)}));
reqVO.setCreateTime((new LocalDateTime[]{buildTime(2022, 2, 1),buildTime(2022, 2, 12)}));
// 调用
PageResult<RoleDO> pageResult = roleService.getRolePage(reqVO);

View File

@ -3,7 +3,6 @@ package cn.iocoder.yudao.module.system.service.sensitiveword;
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.collection.SetUtils;
import cn.iocoder.yudao.framework.common.util.date.DateUtils;
import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
import cn.iocoder.yudao.module.system.controller.admin.sensitiveword.vo.SensitiveWordCreateReqVO;
import cn.iocoder.yudao.module.system.controller.admin.sensitiveword.vo.SensitiveWordExportReqVO;
@ -21,7 +20,7 @@ import java.time.LocalDateTime;
import java.util.Arrays;
import java.util.List;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.buildLocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildTime;
import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId;
import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.max;
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals;
@ -145,7 +144,7 @@ public class SensitiveWordServiceImplTest extends BaseDbUnitTest {
o.setName("笨蛋");
o.setTags(Arrays.asList("论坛", "蔬菜"));
o.setStatus(CommonStatusEnum.ENABLE.getStatus());
o.setCreateTime(DateUtils.buildLocalDateTime(2022, 2, 8));
o.setCreateTime(buildTime(2022, 2, 8));
});
sensitiveWordMapper.insert(dbSensitiveWord);
// 测试 name 不匹配
@ -153,13 +152,13 @@ public class SensitiveWordServiceImplTest extends BaseDbUnitTest {
// 测试 tags 不匹配
sensitiveWordMapper.insert(cloneIgnoreId(dbSensitiveWord, o -> o.setTags(Arrays.asList("短信", "日用品"))));
// 测试 createTime 不匹配
sensitiveWordMapper.insert(cloneIgnoreId(dbSensitiveWord, o -> o.setCreateTime(DateUtils.buildLocalDateTime(2022, 2, 16))));
sensitiveWordMapper.insert(cloneIgnoreId(dbSensitiveWord, o -> o.setCreateTime(buildTime(2022, 2, 16))));
// 准备参数
SensitiveWordPageReqVO reqVO = new SensitiveWordPageReqVO();
reqVO.setName("笨");
reqVO.setTag("论坛");
reqVO.setStatus(CommonStatusEnum.ENABLE.getStatus());
reqVO.setCreateTime((new LocalDateTime[]{buildLocalDateTime(2022, 2, 1),buildLocalDateTime(2022, 2, 12)}));
reqVO.setCreateTime((new LocalDateTime[]{buildTime(2022, 2, 1),buildTime(2022, 2, 12)}));
// 调用
PageResult<SensitiveWordDO> pageResult = sensitiveWordService.getSensitiveWordPage(reqVO);
@ -176,7 +175,7 @@ public class SensitiveWordServiceImplTest extends BaseDbUnitTest {
o.setName("笨蛋");
o.setTags(Arrays.asList("论坛", "蔬菜"));
o.setStatus(CommonStatusEnum.ENABLE.getStatus());
o.setCreateTime(DateUtils.buildLocalDateTime(2022, 2, 8));
o.setCreateTime(buildTime(2022, 2, 8));
});
sensitiveWordMapper.insert(dbSensitiveWord);
// 测试 name 不匹配
@ -184,13 +183,13 @@ public class SensitiveWordServiceImplTest extends BaseDbUnitTest {
// 测试 tags 不匹配
sensitiveWordMapper.insert(cloneIgnoreId(dbSensitiveWord, o -> o.setTags(Arrays.asList("短信", "日用品"))));
// 测试 createTime 不匹配
sensitiveWordMapper.insert(cloneIgnoreId(dbSensitiveWord, o -> o.setCreateTime(DateUtils.buildLocalDateTime(2022, 2, 16))));
sensitiveWordMapper.insert(cloneIgnoreId(dbSensitiveWord, o -> o.setCreateTime(buildTime(2022, 2, 16))));
// 准备参数
SensitiveWordExportReqVO reqVO = new SensitiveWordExportReqVO();
reqVO.setName("笨");
reqVO.setTag("论坛");
reqVO.setStatus(CommonStatusEnum.ENABLE.getStatus());
reqVO.setCreateTime((new LocalDateTime[]{buildLocalDateTime(2022, 2, 1),buildLocalDateTime(2022, 2, 12)}));
reqVO.setCreateTime((new LocalDateTime[]{buildTime(2022, 2, 1),buildTime(2022, 2, 12)}));
// 调用
List<SensitiveWordDO> list = sensitiveWordService.getSensitiveWordList(reqVO);

View File

@ -24,7 +24,7 @@ import java.util.function.Consumer;
import static cn.hutool.core.util.RandomUtil.randomEle;
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.SMS_CHANNEL_HAS_CHILDREN;
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.SMS_CHANNEL_NOT_EXISTS;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.buildLocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildTime;
import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.max;
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.*;
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*;
@ -159,7 +159,7 @@ public class SmsChannelServiceTest extends BaseDbUnitTest {
SmsChannelDO dbSmsChannel = randomPojo(SmsChannelDO.class, o -> { // 等会查询到
o.setSignature("芋道源码");
o.setStatus(CommonStatusEnum.ENABLE.getStatus());
o.setCreateTime(buildLocalDateTime(2020, 12, 12));
o.setCreateTime(buildTime(2020, 12, 12));
});
smsChannelMapper.insert(dbSmsChannel);
// 测试 signature 不匹配
@ -167,12 +167,12 @@ public class SmsChannelServiceTest extends BaseDbUnitTest {
// 测试 status 不匹配
smsChannelMapper.insert(ObjectUtils.cloneIgnoreId(dbSmsChannel, o -> o.setStatus(CommonStatusEnum.DISABLE.getStatus())));
// 测试 createTime 不匹配
smsChannelMapper.insert(ObjectUtils.cloneIgnoreId(dbSmsChannel, o -> o.setCreateTime(buildLocalDateTime(2020, 11, 11))));
smsChannelMapper.insert(ObjectUtils.cloneIgnoreId(dbSmsChannel, o -> o.setCreateTime(buildTime(2020, 11, 11))));
// 准备参数
SmsChannelPageReqVO reqVO = new SmsChannelPageReqVO();
reqVO.setSignature("芋道");
reqVO.setStatus(CommonStatusEnum.ENABLE.getStatus());
reqVO.setCreateTime((new LocalDateTime[]{buildLocalDateTime(2020, 12, 1),buildLocalDateTime(2020, 12, 24)}));
reqVO.setCreateTime((new LocalDateTime[]{buildTime(2020, 12, 1),buildTime(2020, 12, 24)}));
// 调用
PageResult<SmsChannelDO> pageResult = smsChannelService.getSmsChannelPage(reqVO);

View File

@ -26,7 +26,7 @@ import java.util.function.Consumer;
import static cn.hutool.core.util.RandomUtil.randomBoolean;
import static cn.hutool.core.util.RandomUtil.randomEle;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.buildLocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildTime;
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals;
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*;
import static org.junit.jupiter.api.Assertions.assertEquals;
@ -49,9 +49,9 @@ public class SmsLogServiceTest extends BaseDbUnitTest {
o.setTemplateId(10L);
o.setMobile("15601691300");
o.setSendStatus(SmsSendStatusEnum.INIT.getStatus());
o.setSendTime(buildLocalDateTime(2020, 11, 11));
o.setSendTime(buildTime(2020, 11, 11));
o.setReceiveStatus(SmsReceiveStatusEnum.INIT.getStatus());
o.setReceiveTime(buildLocalDateTime(2021, 11, 11));
o.setReceiveTime(buildTime(2021, 11, 11));
});
smsLogMapper.insert(dbSmsLog);
// 测试 channelId 不匹配
@ -63,22 +63,22 @@ public class SmsLogServiceTest extends BaseDbUnitTest {
// 测试 sendStatus 不匹配
smsLogMapper.insert(ObjectUtils.cloneIgnoreId(dbSmsLog, o -> o.setSendStatus(SmsSendStatusEnum.IGNORE.getStatus())));
// 测试 sendTime 不匹配
smsLogMapper.insert(ObjectUtils.cloneIgnoreId(dbSmsLog, o -> o.setSendTime(buildLocalDateTime(2020, 12, 12))));
smsLogMapper.insert(ObjectUtils.cloneIgnoreId(dbSmsLog, o -> o.setSendTime(buildTime(2020, 12, 12))));
// 测试 receiveStatus 不匹配
smsLogMapper.insert(ObjectUtils.cloneIgnoreId(dbSmsLog, o -> o.setReceiveStatus(SmsReceiveStatusEnum.SUCCESS.getStatus())));
// 测试 receiveTime 不匹配
smsLogMapper.insert(ObjectUtils.cloneIgnoreId(dbSmsLog, o -> o.setReceiveTime(buildLocalDateTime(2021, 12, 12))));
smsLogMapper.insert(ObjectUtils.cloneIgnoreId(dbSmsLog, o -> o.setReceiveTime(buildTime(2021, 12, 12))));
// 准备参数
SmsLogPageReqVO reqVO = new SmsLogPageReqVO();
reqVO.setChannelId(1L);
reqVO.setTemplateId(10L);
reqVO.setMobile("156");
reqVO.setSendStatus(SmsSendStatusEnum.INIT.getStatus());
reqVO.setSendTime((new LocalDateTime[]{buildLocalDateTime(2020, 11, 1),
buildLocalDateTime(2020, 11, 30)}));
reqVO.setSendTime((new LocalDateTime[]{buildTime(2020, 11, 1),
buildTime(2020, 11, 30)}));
reqVO.setReceiveStatus(SmsReceiveStatusEnum.INIT.getStatus());
reqVO.setReceiveTime((new LocalDateTime[]{buildLocalDateTime(2021, 11, 1),
buildLocalDateTime(2021, 11, 30)}));
reqVO.setReceiveTime((new LocalDateTime[]{buildTime(2021, 11, 1),
buildTime(2021, 11, 30)}));
// 调用
PageResult<SmsLogDO> pageResult = smsLogService.getSmsLogPage(reqVO);
@ -96,9 +96,9 @@ public class SmsLogServiceTest extends BaseDbUnitTest {
o.setTemplateId(10L);
o.setMobile("15601691300");
o.setSendStatus(SmsSendStatusEnum.INIT.getStatus());
o.setSendTime(buildLocalDateTime(2020, 11, 11));
o.setSendTime(buildTime(2020, 11, 11));
o.setReceiveStatus(SmsReceiveStatusEnum.INIT.getStatus());
o.setReceiveTime(buildLocalDateTime(2021, 11, 11));
o.setReceiveTime(buildTime(2021, 11, 11));
});
smsLogMapper.insert(dbSmsLog);
// 测试 channelId 不匹配
@ -110,22 +110,22 @@ public class SmsLogServiceTest extends BaseDbUnitTest {
// 测试 sendStatus 不匹配
smsLogMapper.insert(ObjectUtils.cloneIgnoreId(dbSmsLog, o -> o.setSendStatus(SmsSendStatusEnum.IGNORE.getStatus())));
// 测试 sendTime 不匹配
smsLogMapper.insert(ObjectUtils.cloneIgnoreId(dbSmsLog, o -> o.setSendTime(buildLocalDateTime(2020, 12, 12))));
smsLogMapper.insert(ObjectUtils.cloneIgnoreId(dbSmsLog, o -> o.setSendTime(buildTime(2020, 12, 12))));
// 测试 receiveStatus 不匹配
smsLogMapper.insert(ObjectUtils.cloneIgnoreId(dbSmsLog, o -> o.setReceiveStatus(SmsReceiveStatusEnum.SUCCESS.getStatus())));
// 测试 receiveTime 不匹配
smsLogMapper.insert(ObjectUtils.cloneIgnoreId(dbSmsLog, o -> o.setReceiveTime(buildLocalDateTime(2021, 12, 12))));
smsLogMapper.insert(ObjectUtils.cloneIgnoreId(dbSmsLog, o -> o.setReceiveTime(buildTime(2021, 12, 12))));
// 准备参数
SmsLogExportReqVO reqVO = new SmsLogExportReqVO();
reqVO.setChannelId(1L);
reqVO.setTemplateId(10L);
reqVO.setMobile("156");
reqVO.setSendStatus(SmsSendStatusEnum.INIT.getStatus());
reqVO.setSendTime((new LocalDateTime[]{buildLocalDateTime(2020, 11, 1),
buildLocalDateTime(2020, 11, 30)}));
reqVO.setSendTime((new LocalDateTime[]{buildTime(2020, 11, 1),
buildTime(2020, 11, 30)}));
reqVO.setReceiveStatus(SmsReceiveStatusEnum.INIT.getStatus());
reqVO.setReceiveTime((new LocalDateTime[]{buildLocalDateTime(2021, 11, 1),
buildLocalDateTime(2021, 11, 30)}));
reqVO.setReceiveTime((new LocalDateTime[]{buildTime(2021, 11, 1),
buildTime(2021, 11, 30)}));
// 调用
List<SmsLogDO> list = smsLogService.getSmsLogList(reqVO);

View File

@ -34,7 +34,7 @@ import static cn.hutool.core.bean.BeanUtil.getFieldValue;
import static cn.hutool.core.util.RandomUtil.randomEle;
import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.max;
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.buildLocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildTime;
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals;
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException;
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*;
@ -205,7 +205,7 @@ public class SmsTemplateServiceTest extends BaseDbUnitTest {
o.setContent("芋道源码");
o.setApiTemplateId("yunai");
o.setChannelId(1L);
o.setCreateTime(buildLocalDateTime(2021, 11, 11));
o.setCreateTime(buildTime(2021, 11, 11));
});
smsTemplateMapper.insert(dbSmsTemplate);
// 测试 type 不匹配
@ -221,7 +221,7 @@ public class SmsTemplateServiceTest extends BaseDbUnitTest {
// 测试 channelId 不匹配
smsTemplateMapper.insert(ObjectUtils.cloneIgnoreId(dbSmsTemplate, o -> o.setChannelId(2L)));
// 测试 createTime 不匹配
smsTemplateMapper.insert(ObjectUtils.cloneIgnoreId(dbSmsTemplate, o -> o.setCreateTime(buildLocalDateTime(2021, 12, 12))));
smsTemplateMapper.insert(ObjectUtils.cloneIgnoreId(dbSmsTemplate, o -> o.setCreateTime(buildTime(2021, 12, 12))));
// 准备参数
SmsTemplatePageReqVO reqVO = new SmsTemplatePageReqVO();
reqVO.setType(SmsTemplateTypeEnum.PROMOTION.getType());
@ -230,7 +230,7 @@ public class SmsTemplateServiceTest extends BaseDbUnitTest {
reqVO.setContent("芋道");
reqVO.setApiTemplateId("yu");
reqVO.setChannelId(1L);
reqVO.setCreateTime((new LocalDateTime[]{buildLocalDateTime(2021, 11, 1),buildLocalDateTime(2021, 12, 1)}));
reqVO.setCreateTime((new LocalDateTime[]{buildTime(2021, 11, 1),buildTime(2021, 12, 1)}));
// 调用
PageResult<SmsTemplateDO> pageResult = smsTemplateService.getSmsTemplatePage(reqVO);
@ -250,7 +250,7 @@ public class SmsTemplateServiceTest extends BaseDbUnitTest {
o.setContent("芋道源码");
o.setApiTemplateId("yunai");
o.setChannelId(1L);
o.setCreateTime(buildLocalDateTime(2021, 11, 11));
o.setCreateTime(buildTime(2021, 11, 11));
});
smsTemplateMapper.insert(dbSmsTemplate);
// 测试 type 不匹配
@ -266,7 +266,7 @@ public class SmsTemplateServiceTest extends BaseDbUnitTest {
// 测试 channelId 不匹配
smsTemplateMapper.insert(ObjectUtils.cloneIgnoreId(dbSmsTemplate, o -> o.setChannelId(2L)));
// 测试 createTime 不匹配
smsTemplateMapper.insert(ObjectUtils.cloneIgnoreId(dbSmsTemplate, o -> o.setCreateTime(buildLocalDateTime(2021, 12, 12))));
smsTemplateMapper.insert(ObjectUtils.cloneIgnoreId(dbSmsTemplate, o -> o.setCreateTime(buildTime(2021, 12, 12))));
// 准备参数
SmsTemplateExportReqVO reqVO = new SmsTemplateExportReqVO();
reqVO.setType(SmsTemplateTypeEnum.PROMOTION.getType());
@ -275,7 +275,7 @@ public class SmsTemplateServiceTest extends BaseDbUnitTest {
reqVO.setContent("芋道");
reqVO.setApiTemplateId("yu");
reqVO.setChannelId(1L);
reqVO.setCreateTime((new LocalDateTime[]{buildLocalDateTime(2021, 11, 1),buildLocalDateTime(2021, 12, 1)}));
reqVO.setCreateTime((new LocalDateTime[]{buildTime(2021, 11, 1),buildTime(2021, 12, 1)}));
// 调用
List<SmsTemplateDO> list = smsTemplateService.getSmsTemplateList(reqVO);

View File

@ -17,7 +17,7 @@ import javax.annotation.Resource;
import java.time.LocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.buildLocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildTime;
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.assertServiceException;
@ -142,7 +142,7 @@ public class TenantPackageServiceImplTest extends BaseDbUnitTest {
o.setName("芋道源码");
o.setStatus(CommonStatusEnum.ENABLE.getStatus());
o.setRemark("源码解析");
o.setCreateTime(buildLocalDateTime(2022, 10, 10));
o.setCreateTime(buildTime(2022, 10, 10));
});
tenantPackageMapper.insert(dbTenantPackage);
// 测试 name 不匹配
@ -152,13 +152,13 @@ public class TenantPackageServiceImplTest extends BaseDbUnitTest {
// 测试 remark 不匹配
tenantPackageMapper.insert(cloneIgnoreId(dbTenantPackage, o -> o.setRemark("解析")));
// 测试 createTime 不匹配
tenantPackageMapper.insert(cloneIgnoreId(dbTenantPackage, o -> o.setCreateTime(buildLocalDateTime(2022, 11, 11))));
tenantPackageMapper.insert(cloneIgnoreId(dbTenantPackage, o -> o.setCreateTime(buildTime(2022, 11, 11))));
// 准备参数
TenantPackagePageReqVO reqVO = new TenantPackagePageReqVO();
reqVO.setName("芋道");
reqVO.setStatus(CommonStatusEnum.ENABLE.getStatus());
reqVO.setRemark("源码");
reqVO.setCreateTime((new LocalDateTime[]{buildLocalDateTime(2022, 10, 9),buildLocalDateTime(2022, 10, 11)}));
reqVO.setCreateTime((new LocalDateTime[]{buildTime(2022, 10, 9),buildTime(2022, 10, 11)}));
// 调用
PageResult<TenantPackageDO> pageResult = tenantPackageService.getTenantPackagePage(reqVO);

View File

@ -34,7 +34,7 @@ import java.util.Collections;
import java.util.List;
import static cn.iocoder.yudao.framework.common.util.collection.SetUtils.asSet;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.buildLocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildTime;
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.assertServiceException;
@ -110,7 +110,7 @@ public class TenantServiceImplTest extends BaseDbUnitTest {
public void testValidTenant_expired() {
// mock 数据
TenantDO tenant = randomPojo(TenantDO.class, o -> o.setId(1L).setStatus(CommonStatusEnum.ENABLE.getStatus())
.setExpireTime(buildLocalDateTime(2020, 2, 2)));
.setExpireTime(buildTime(2020, 2, 2)));
tenantMapper.insert(tenant);
// 调用,并断言业务异常
@ -291,7 +291,7 @@ public class TenantServiceImplTest extends BaseDbUnitTest {
o.setContactName("芋艿");
o.setContactMobile("15601691300");
o.setStatus(CommonStatusEnum.ENABLE.getStatus());
o.setCreateTime(buildLocalDateTime(2020, 12, 12));
o.setCreateTime(buildTime(2020, 12, 12));
});
tenantMapper.insert(dbTenant);
// 测试 name 不匹配
@ -303,14 +303,14 @@ public class TenantServiceImplTest extends BaseDbUnitTest {
// 测试 status 不匹配
tenantMapper.insert(cloneIgnoreId(dbTenant, o -> o.setStatus(CommonStatusEnum.DISABLE.getStatus())));
// 测试 createTime 不匹配
tenantMapper.insert(cloneIgnoreId(dbTenant, o -> o.setCreateTime(buildLocalDateTime(2021, 12, 12))));
tenantMapper.insert(cloneIgnoreId(dbTenant, o -> o.setCreateTime(buildTime(2021, 12, 12))));
// 准备参数
TenantPageReqVO reqVO = new TenantPageReqVO();
reqVO.setName("芋道");
reqVO.setContactName("艿");
reqVO.setContactMobile("1560");
reqVO.setStatus(CommonStatusEnum.ENABLE.getStatus());
reqVO.setCreateTime(new LocalDateTime[]{buildLocalDateTime(2020, 12, 1),buildLocalDateTime(2020, 12, 24)});
reqVO.setCreateTime(new LocalDateTime[]{buildTime(2020, 12, 1),buildTime(2020, 12, 24)});
// 调用
PageResult<TenantDO> pageResult = tenantService.getTenantPage(reqVO);
@ -328,7 +328,7 @@ public class TenantServiceImplTest extends BaseDbUnitTest {
o.setContactName("芋艿");
o.setContactMobile("15601691300");
o.setStatus(CommonStatusEnum.ENABLE.getStatus());
o.setCreateTime(buildLocalDateTime(2020, 12, 12));
o.setCreateTime(buildTime(2020, 12, 12));
});
tenantMapper.insert(dbTenant);
// 测试 name 不匹配
@ -340,14 +340,14 @@ public class TenantServiceImplTest extends BaseDbUnitTest {
// 测试 status 不匹配
tenantMapper.insert(cloneIgnoreId(dbTenant, o -> o.setStatus(CommonStatusEnum.DISABLE.getStatus())));
// 测试 createTime 不匹配
tenantMapper.insert(cloneIgnoreId(dbTenant, o -> o.setCreateTime(buildLocalDateTime(2021, 12, 12))));
tenantMapper.insert(cloneIgnoreId(dbTenant, o -> o.setCreateTime(buildTime(2021, 12, 12))));
// 准备参数
TenantExportReqVO reqVO = new TenantExportReqVO();
reqVO.setName("芋道");
reqVO.setContactName("艿");
reqVO.setContactMobile("1560");
reqVO.setStatus(CommonStatusEnum.ENABLE.getStatus());
reqVO.setCreateTime(new LocalDateTime[]{buildLocalDateTime(2020, 12, 1),buildLocalDateTime(2020, 12, 24)});
reqVO.setCreateTime(new LocalDateTime[]{buildTime(2020, 12, 1),buildTime(2020, 12, 24)});
// 调用
List<TenantDO> list = tenantService.getTenantList(reqVO);

View File

@ -40,7 +40,7 @@ import java.util.function.Consumer;
import static cn.hutool.core.util.RandomUtil.randomBytes;
import static cn.hutool.core.util.RandomUtil.randomEle;
import static cn.iocoder.yudao.framework.common.util.collection.SetUtils.asSet;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.buildLocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildTime;
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals;
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException;
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*;
@ -295,7 +295,7 @@ public class AdminUserServiceImplTest extends BaseDbUnitTest {
reqVO.setUsername("tu");
reqVO.setMobile("1560");
reqVO.setStatus(CommonStatusEnum.ENABLE.getStatus());
reqVO.setCreateTime((new LocalDateTime[]{buildLocalDateTime(2020, 12, 1),buildLocalDateTime(2020, 12, 24)}));
reqVO.setCreateTime((new LocalDateTime[]{buildTime(2020, 12, 1),buildTime(2020, 12, 24)}));
reqVO.setDeptId(1L); // 其中1L 是 2L 的父部门
// mock 方法
List<DeptDO> deptList = newArrayList(randomPojo(DeptDO.class, o -> o.setId(2L)));
@ -318,7 +318,7 @@ public class AdminUserServiceImplTest extends BaseDbUnitTest {
reqVO.setUsername("tu");
reqVO.setMobile("1560");
reqVO.setStatus(CommonStatusEnum.ENABLE.getStatus());
reqVO.setCreateTime((new LocalDateTime[]{buildLocalDateTime(2020, 12, 1),buildLocalDateTime(2020, 12, 24)}));
reqVO.setCreateTime((new LocalDateTime[]{buildTime(2020, 12, 1),buildTime(2020, 12, 24)}));
reqVO.setDeptId(1L); // 其中1L 是 2L 的父部门
// mock 方法
List<DeptDO> deptList = newArrayList(randomPojo(DeptDO.class, o -> o.setId(2L)));
@ -340,7 +340,7 @@ public class AdminUserServiceImplTest extends BaseDbUnitTest {
o.setUsername("tudou");
o.setMobile("15601691300");
o.setStatus(CommonStatusEnum.ENABLE.getStatus());
o.setCreateTime(buildLocalDateTime(2020, 12, 12));
o.setCreateTime(buildTime(2020, 12, 12));
o.setDeptId(2L);
});
userMapper.insert(dbUser);
@ -351,7 +351,7 @@ public class AdminUserServiceImplTest extends BaseDbUnitTest {
// 测试 status 不匹配
userMapper.insert(ObjectUtils.cloneIgnoreId(dbUser, o -> o.setStatus(CommonStatusEnum.DISABLE.getStatus())));
// 测试 createTime 不匹配
userMapper.insert(ObjectUtils.cloneIgnoreId(dbUser, o -> o.setCreateTime(buildLocalDateTime(2020, 11, 11))));
userMapper.insert(ObjectUtils.cloneIgnoreId(dbUser, o -> o.setCreateTime(buildTime(2020, 11, 11))));
// 测试 dept 不匹配
userMapper.insert(ObjectUtils.cloneIgnoreId(dbUser, o -> o.setDeptId(0L)));
return dbUser;