You've already forked FrameTour-BE
3
This commit is contained in:
@ -3,6 +3,7 @@ package com.ycwl.basic.service.impl.pc;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.ycwl.basic.model.pc.device.entity.DeviceEntity;
|
||||
import com.ycwl.basic.model.pc.device.req.DeviceBatchSortRequest;
|
||||
import com.ycwl.basic.model.pc.template.resp.TemplateRespVO;
|
||||
import com.ycwl.basic.model.wvp.WvpSyncReqVo;
|
||||
import com.ycwl.basic.repository.DeviceRepository;
|
||||
@ -164,4 +165,13 @@ public class DeviceServiceImpl implements DeviceService {
|
||||
});
|
||||
return ApiResponse.success(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApiResponse<Boolean> batchSort(Long scenicId, DeviceBatchSortRequest request) {
|
||||
for (DeviceBatchSortRequest.SortItem item : request.getList()) {
|
||||
deviceMapper.updateSort(item.getId(), item.getSort());
|
||||
deviceRepository.clearDeviceCache(item.getId());
|
||||
}
|
||||
return ApiResponse.success(true);
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package com.ycwl.basic.service.pc;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.ycwl.basic.model.pc.device.entity.DeviceConfigEntity;
|
||||
import com.ycwl.basic.model.pc.device.req.DeviceAddOrUpdateReq;
|
||||
import com.ycwl.basic.model.pc.device.req.DeviceBatchSortRequest;
|
||||
import com.ycwl.basic.model.pc.device.req.DeviceReqQuery;
|
||||
import com.ycwl.basic.model.pc.device.resp.DeviceRespVO;
|
||||
import com.ycwl.basic.model.wvp.WvpSyncReqVo;
|
||||
@ -29,4 +30,6 @@ public interface DeviceService {
|
||||
void updateDevices(Long scenicId, WvpSyncReqVo reqVo);
|
||||
|
||||
ApiResponse<Boolean> sortDevice(Long deviceId, Long afterDeviceId);
|
||||
|
||||
ApiResponse<Boolean> batchSort(Long scenicId, DeviceBatchSortRequest request);
|
||||
}
|
||||
|
@ -68,6 +68,7 @@ import java.util.concurrent.ArrayBlockingQueue;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.ycwl.basic.constant.FaceConstant.USER_FACE_DB_NAME;
|
||||
@ -320,10 +321,12 @@ public class TaskFaceServiceImpl implements TaskFaceService {
|
||||
|
||||
listFaceEntitiesRequest.setDbName(USER_FACE_DB_NAME + String.valueOf(scenicId));
|
||||
listFaceEntitiesRequest.setOrder("asc");
|
||||
listFaceEntitiesRequest.setLimit(200);
|
||||
try {
|
||||
AtomicInteger count = new AtomicInteger(0);
|
||||
IAcsClient client = getClient();
|
||||
AtomicBoolean flag = new AtomicBoolean(false);
|
||||
while (true) {
|
||||
listFaceEntitiesRequest.setOffset(count.getAndIncrement());
|
||||
ListFaceEntitiesResponse listFaceEntitiesResponse = client.getAcsResponse(listFaceEntitiesRequest);
|
||||
if (listFaceEntitiesResponse == null || listFaceEntitiesResponse.getData() == null || listFaceEntitiesResponse.getData().getEntities() == null || listFaceEntitiesResponse.getData().getEntities().isEmpty()) {
|
||||
break;
|
||||
@ -331,61 +334,54 @@ public class TaskFaceServiceImpl implements TaskFaceService {
|
||||
listFaceEntitiesResponse.getData().getEntities().forEach(entity -> {
|
||||
Date createdDate = new Date(entity.getCreatedAt());
|
||||
if (createdDate.before(endDate)) {
|
||||
flag.set(true);
|
||||
log.info("当前景区{},开始删除人脸样本:{}", scenicId, entity.getEntityId());
|
||||
deleteFaceSample(String.valueOf(scenicId), entity.getEntityId());
|
||||
deleteFaceSample(entity.getDbName(), entity.getEntityId());
|
||||
} else {
|
||||
count.incrementAndGet();
|
||||
log.info("当前景区{},人脸样本:{}未过期", scenicId, entity.getEntityId());
|
||||
}
|
||||
});
|
||||
if (!flag.get()) {
|
||||
break;
|
||||
} else {
|
||||
flag.set(false);
|
||||
}
|
||||
}
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
List<DeviceEntity> devices = deviceRepository.getAllDeviceByScenicId(scenicId);
|
||||
listFaceEntitiesRequest.setDbName(String.valueOf(scenicId));
|
||||
listFaceEntitiesRequest.setOrder("asc");
|
||||
try {
|
||||
IAcsClient client = getClient();
|
||||
AtomicBoolean flag = new AtomicBoolean(false);
|
||||
while (true) {
|
||||
ListFaceEntitiesResponse listFaceEntitiesResponse = client.getAcsResponse(listFaceEntitiesRequest);
|
||||
if (listFaceEntitiesResponse == null || listFaceEntitiesResponse.getData() == null || listFaceEntitiesResponse.getData().getEntities() == null || listFaceEntitiesResponse.getData().getEntities().isEmpty()) {
|
||||
break;
|
||||
}
|
||||
listFaceEntitiesResponse.getData().getEntities().forEach(entity -> {
|
||||
String entityId = entity.getEntityId();
|
||||
String[] split = entityId.split("_");
|
||||
if (split.length != 2) {
|
||||
return;
|
||||
}
|
||||
String deviceId = split[0];
|
||||
if (StringUtils.isBlank(deviceId)) {
|
||||
return;
|
||||
}
|
||||
String dateString = split[1];
|
||||
if (StringUtils.isBlank(dateString)) {
|
||||
return;
|
||||
}
|
||||
if (DateUtils.parse(dateString, DATE_FORMAT).before(endDate)) {
|
||||
flag.set(true);
|
||||
log.info("当前景区{},开始删除人脸样本:{}", scenicId, entity.getEntityId());
|
||||
deleteFaceSample(String.valueOf(scenicId), entity.getEntityId());
|
||||
} else {
|
||||
log.info("当前景区{},人脸样本:{}未过期", scenicId, entity.getEntityId());
|
||||
}
|
||||
});
|
||||
if (!flag.get()) {
|
||||
break;
|
||||
} else {
|
||||
flag.set(false);
|
||||
devices.forEach(device -> {
|
||||
AtomicInteger count = new AtomicInteger(0);
|
||||
listFaceEntitiesRequest.setEntityIdPrefix(device.getId() + "_");
|
||||
try {
|
||||
IAcsClient client = getClient();
|
||||
while (true) {
|
||||
listFaceEntitiesRequest.setOffset(count.get());
|
||||
ListFaceEntitiesResponse listFaceEntitiesResponse = client.getAcsResponse(listFaceEntitiesRequest);
|
||||
if (listFaceEntitiesResponse == null || listFaceEntitiesResponse.getData() == null || listFaceEntitiesResponse.getData().getEntities() == null || listFaceEntitiesResponse.getData().getEntities().isEmpty()) {
|
||||
break;
|
||||
}
|
||||
listFaceEntitiesResponse.getData().getEntities().forEach(entity -> {
|
||||
String entityId = entity.getEntityId();
|
||||
String[] split = entityId.split("_");
|
||||
if (split.length != 2) {
|
||||
return;
|
||||
}
|
||||
String deviceId = split[0];
|
||||
if (StringUtils.isBlank(deviceId)) {
|
||||
return;
|
||||
}
|
||||
String dateString = split[1];
|
||||
if (StringUtils.isBlank(dateString)) {
|
||||
return;
|
||||
}
|
||||
if (DateUtils.parse(dateString, DATE_FORMAT).before(endDate)) {
|
||||
deleteFaceSample(entity.getDbName(), entity.getEntityId());
|
||||
} else {
|
||||
count.incrementAndGet();
|
||||
log.info("当前景区{},人脸样本:{}未过期", scenicId, entity.getEntityId());
|
||||
}
|
||||
});
|
||||
}
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
});
|
||||
List<FaceSampleEntity> faceSampleList = faceSampleMapper.listEntityBeforeDate(scenicId, endDate);
|
||||
if (faceSampleList.isEmpty()) {
|
||||
log.info("当前景区{},人脸样本为空", scenicId);
|
||||
|
Reference in New Issue
Block a user