fix(接口测试): 分享永久有效排序问题
--bug=1048322 --user=宋昌昌 【接口测试】定义-分享-分享列表-截止时间排序-永久有效应该是最大的值 https://www.tapd.cn/55049933/s/1601843
This commit is contained in:
parent
c0133cc8f0
commit
277b406aff
|
@ -88,6 +88,7 @@ public class ApiDocShareService {
|
|||
docShare.setCreateTime(System.currentTimeMillis());
|
||||
docShare.setUpdateUser(currentUser);
|
||||
docShare.setUpdateTime(System.currentTimeMillis());
|
||||
docShare.setInvalidTime(request.getInvalidTime() == 0 ? Long.MAX_VALUE : request.getInvalidTime());
|
||||
apiDocShareMapper.insert(docShare);
|
||||
return docShare;
|
||||
}
|
||||
|
@ -104,6 +105,7 @@ public class ApiDocShareService {
|
|||
BeanUtils.copyBean(docShare, request);
|
||||
docShare.setUpdateUser(currentUser);
|
||||
docShare.setUpdateTime(System.currentTimeMillis());
|
||||
docShare.setInvalidTime(request.getInvalidTime() == 0 ? Long.MAX_VALUE : request.getInvalidTime());
|
||||
apiDocShareMapper.updateByPrimaryKeySelective(docShare);
|
||||
return docShare;
|
||||
}
|
||||
|
@ -138,7 +140,7 @@ public class ApiDocShareService {
|
|||
public ApiDocShareDetail detail(String id) {
|
||||
ApiDocShare docShare = checkExit(id);
|
||||
ApiDocShareDetail detail = ApiDocShareDetail.builder().allowExport(docShare.getAllowExport()).isPrivate(docShare.getIsPrivate()).build();
|
||||
if (docShare.getInvalidTime() == null || docShare.getInvalidTime() == 0) {
|
||||
if (docShare.getInvalidTime() == null || docShare.getInvalidTime() == Long.MAX_VALUE) {
|
||||
detail.setInvalid(false);
|
||||
} else {
|
||||
detail.setInvalid(docShare.getInvalidTime() < System.currentTimeMillis());
|
||||
|
@ -210,6 +212,9 @@ public class ApiDocShareService {
|
|||
List<String> distinctUpdateUserIds = docShares.stream().map(ApiDocShareDTO::getUpdateUser).distinct().toList();
|
||||
Map<String, String> userMap = userToolService.getUserMapByIds(ListUtils.union(distinctCreateUserIds, distinctUpdateUserIds));
|
||||
docShares.forEach(docShare -> {
|
||||
if (docShare.getInvalidTime() == Long.MAX_VALUE) {
|
||||
docShare.setInvalidTime(0L);
|
||||
}
|
||||
docShare.setInvalid(docShare.getInvalidTime() != null && docShare.getInvalidTime() != 0 && docShare.getInvalidTime() < System.currentTimeMillis());
|
||||
docShare.setApiShareNum(countApiShare(docShare));
|
||||
docShare.setCreateUserName(userMap.get(docShare.getCreateUser()));
|
||||
|
|
|
@ -54,6 +54,7 @@ public class ApiDocShareControllerTests extends BaseTest {
|
|||
request.setIsPrivate(false);
|
||||
request.setPassword("123456");
|
||||
request.setAllowExport(false);
|
||||
request.setInvalidTime(0L);
|
||||
MvcResult mvcResult = this.requestPostWithOk(ADD, request).andReturn();
|
||||
String returnData = mvcResult.getResponse().getContentAsString(StandardCharsets.UTF_8);
|
||||
ResultHolder resultHolder = JSON.parseObject(returnData, ResultHolder.class);
|
||||
|
|
Loading…
Reference in New Issue