Commit 4c63aaf6 authored by xuxin's avatar xuxin

fix bug 绑定店铺且已过期的 ip 显示 grouptype为5的 ip列表中

parent e7627f40
...@@ -134,15 +134,17 @@ public class IpResourceRepositoryCustomImpl implements IpResourceRepositoryCusto ...@@ -134,15 +134,17 @@ public class IpResourceRepositoryCustomImpl implements IpResourceRepositoryCusto
public boolean updateStatus(String id, int status, Object... args) { public boolean updateStatus(String id, int status, Object... args) {
Document doc = new Document(); Document doc = new Document();
BasicQuery basicQuery = new BasicQuery(doc); BasicQuery basicQuery = new BasicQuery(doc);
basicQuery.addCriteria(where("id").is(id).and("isDeleted").is(false));
Update update = new Update();
if (args.length == 0) { if (args.length == 0) {
basicQuery.addCriteria(where("id").is(id).and("isDeleted").is(false)); update.set("status", status);
} }
if (args.length == 1) { if (args.length == 1) {
basicQuery.addCriteria(where("id").is(id).and("isDeleted").is(true)); update.set("status", status).set("isDeleted", true);
} }
Update update = new Update();
update.set("status", status);
UpdateResult result = mongoTemplate.updateFirst(basicQuery, update, IpResource.class); UpdateResult result = mongoTemplate.updateFirst(basicQuery, update, IpResource.class);
if (result.getModifiedCount() < 1) if (result.getModifiedCount() < 1)
......
...@@ -975,8 +975,11 @@ public class IpResourceServiceImpl implements IpResourceService { ...@@ -975,8 +975,11 @@ public class IpResourceServiceImpl implements IpResourceService {
} }
break; break;
case 5: case 5:
// 已分配 // 已分配且未过期
ipResources = ipResourceRepository.findShopIdInList(shopIds, false); ipResources = ipResourceRepository.findShopIdInList(shopIds, false)
.stream()
.filter(x -> x.getValidTime() > Instant.now().toEpochMilli())
.collect(Collectors.toList());
if (!isParent) if (!isParent)
notUsed = ipResourceRepository.findByOwnerAndStatusInAndIsDeletedAndBind(username, Arrays.asList(0, 2, 4, 8), false, false); notUsed = ipResourceRepository.findByOwnerAndStatusInAndIsDeletedAndBind(username, Arrays.asList(0, 2, 4, 8), false, false);
else else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment