You've already forked FrameTour-BE
3
This commit is contained in:
@ -77,7 +77,7 @@ public class PriceBiz {
|
||||
IsBuyBatchRespVO respVO = new IsBuyBatchRespVO();
|
||||
PriceConfigEntity priceConfig = priceRepository.getPriceConfigByScenicTypeGoods(scenicId, type, goodsIds);
|
||||
if (priceConfig == null) {
|
||||
throw new RuntimeException("该套餐暂未开放购买");
|
||||
return null;
|
||||
}
|
||||
ScenicConfigEntity scenicConfig = scenicRepository.getScenicConfig(scenicId);
|
||||
if (scenicConfig != null) {
|
||||
|
@ -99,6 +99,10 @@ public class AppOrderController {
|
||||
@GetMapping("/scenic/{scenicId}/queryBatchPrice")
|
||||
public ApiResponse<IsBuyBatchRespVO> queryPrice(@PathVariable("scenicId") Long scenicId, @RequestParam("type") Integer type, @RequestParam(value = "goodsIds", required = false) String goodsIds) {
|
||||
Long userId = Long.parseLong(BaseContextHandler.getUserId());
|
||||
return ApiResponse.success(priceBiz.isBuy(userId, scenicId, type, goodsIds));
|
||||
IsBuyBatchRespVO buy = priceBiz.isBuy(userId, scenicId, type, goodsIds);
|
||||
if (buy == null) {
|
||||
return ApiResponse.fail("该套餐暂未开放购买");
|
||||
}
|
||||
return ApiResponse.success(buy);
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package com.ycwl.basic.controller.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.req.DeviceSortRequest;
|
||||
import com.ycwl.basic.model.pc.device.resp.DeviceRespVO;
|
||||
@ -62,6 +63,11 @@ public class DeviceController {
|
||||
return deviceService.sortDevice(request.getDeviceId(), request.getAfterDeviceId());
|
||||
}
|
||||
|
||||
@PostMapping("/scenic/{scenicId}/sortBatch")
|
||||
public ApiResponse<Boolean> sortDeviceBatch(@PathVariable("scenicId") Long scenicId, @RequestBody DeviceBatchSortRequest request) {
|
||||
return deviceService.batchSort(scenicId, request);
|
||||
}
|
||||
|
||||
@GetMapping("/config/{id}")
|
||||
public ApiResponse<DeviceConfigEntity> getConfig(@PathVariable("id") Long id) {
|
||||
return ApiResponse.success(deviceService.getConfig(id));
|
||||
|
@ -0,0 +1,16 @@
|
||||
package com.ycwl.basic.model.pc.device.req;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class DeviceBatchSortRequest {
|
||||
private List<SortItem> list;
|
||||
|
||||
@Data
|
||||
public static class SortItem {
|
||||
private Long id;
|
||||
private Integer sort;
|
||||
}
|
||||
}
|
@ -33,6 +33,8 @@ public class DeviceRespVO {
|
||||
private Integer online;
|
||||
private String coverUrl;
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date coverTime;
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date createAt;
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date updateAt;
|
||||
|
@ -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);
|
||||
|
@ -128,7 +128,15 @@ public class VideoPieceGetter {
|
||||
.values();
|
||||
collection.forEach(faceSampleList -> {
|
||||
executor.execute(() -> {
|
||||
faceSampleList.parallelStream().forEach(faceSample -> {
|
||||
AtomicBoolean isFirst = new AtomicBoolean(true);
|
||||
faceSampleList.forEach(faceSample -> {
|
||||
if (!isFirst.get()) {
|
||||
try {
|
||||
Thread.sleep(1000);
|
||||
} catch (InterruptedException ignore) {
|
||||
}
|
||||
}
|
||||
isFirst.set(false);
|
||||
executor.execute(() -> {
|
||||
DeviceEntity device = deviceRepository.getDevice(faceSample.getDeviceId());
|
||||
DeviceConfigEntity config = deviceRepository.getDeviceConfig(faceSample.getDeviceId());
|
||||
|
@ -62,6 +62,6 @@ public class WxMpUtil {
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
generateWXAQRCode("wxe7ff26af70bfc37c", "5252fbbc68513bc77b7cc0052b9f9695", "trial", "pages/home/index?scenicId=3946669713328836608", "cxzh_t.jpg");
|
||||
generateWXAQRCode("wxe7ff26af70bfc37c", "5252fbbc68513bc77b7cc0052b9f9695", "trial", "pages/home/index?scenicId=3955650120997015552", "sxlj_t.jpg");
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user