人脸抓拍修改

develop
hanrenchun 11 months ago
parent 9347c09ae1
commit b30fad4730

@ -18,8 +18,10 @@ import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.TimeZone;
import java.util.concurrent.CountDownLatch; import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutorService; import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
@ -38,7 +40,8 @@ public class TStrhEntityInfoKsTask {
@Resource @Resource
private TransitUserRecordService transitUserRecordService; private TransitUserRecordService transitUserRecordService;
String maxTime = "2023-10-01 00:00:00"; String maxTime = "2023-12-09 00:00:00";
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
@Scheduled(initialDelay = 100, fixedDelay = 3000) @Scheduled(initialDelay = 100, fixedDelay = 3000)
public void setTransitUserRecordService() { public void setTransitUserRecordService() {
@ -47,19 +50,20 @@ public class TStrhEntityInfoKsTask {
} }
try { try {
dateFormat.setTimeZone(TimeZone.getTimeZone("Asia/Shanghai"));
LambdaQueryWrapper<TStrhEntityInfoKs> queryWrapper = Wrappers.lambdaQuery(); LambdaQueryWrapper<TStrhEntityInfoKs> queryWrapper = Wrappers.lambdaQuery();
queryWrapper.gt(TStrhEntityInfoKs::getCapturetime, maxTime); queryWrapper.gt(TStrhEntityInfoKs::getCapturetime, maxTime);
int countTStrh = tStrhEntityInfoKsService.count(queryWrapper); int countTStrh = tStrhEntityInfoKsService.count(queryWrapper);
if (countTStrh > 0) { if (countTStrh > 0) {
int count = countTStrh / 200; int count = countTStrh / 1000;
for (int i = 0; i <= count; i++) { for (int i = 0; i <= count; i++) {
try { Page<TStrhEntityInfoKs> page = new Page<>(i + 1, 1000);
Page<TStrhEntityInfoKs> page = new Page<>(i + 1, 200); List<TStrhEntityInfoKs> resultList = tStrhEntityInfoKsService.page(page, queryWrapper).getRecords();
List<TStrhEntityInfoKs> resultList = tStrhEntityInfoKsService.page(page,queryWrapper).getRecords();
for (TStrhEntityInfoKs entityInfoKs : resultList) { for (TStrhEntityInfoKs entityInfoKs : resultList) {
TransitUserRecord transitUserRecord = new TransitUserRecord(); TransitUserRecord transitUserRecord = new TransitUserRecord();
transitUserRecord.setDeviceCode(entityInfoKs.getCameraidx()); transitUserRecord.setDeviceCode(entityInfoKs.getCameraidx());
transitUserRecord.setPassTime(Long.parseLong(entityInfoKs.getCapturetime())); transitUserRecord.setPassTime(dateFormat.parse(entityInfoKs.getCapturetime()).getTime() / 1000);
transitUserRecord.setPartitionField(dateFormat.parse(entityInfoKs.getCapturetime()));
transitUserRecord.setBodyGlobalPic(entityInfoKs.getImage()); transitUserRecord.setBodyGlobalPic(entityInfoKs.getImage());
transitUserRecord.setPersonPic(entityInfoKs.getSmalimage()); transitUserRecord.setPersonPic(entityInfoKs.getSmalimage());
transitUserRecord.setSourceId(entityInfoKs.getEntityid()); transitUserRecord.setSourceId(entityInfoKs.getEntityid());
@ -72,19 +76,16 @@ public class TStrhEntityInfoKsTask {
if (save) { if (save) {
logger.info("Face-" + entityInfoKs.getSmalimage() + ":插入成功"); logger.info("Face-" + entityInfoKs.getSmalimage() + ":插入成功");
} }
}else { } else {
UpdateWrapper<TransitUserRecord> wrapper = new UpdateWrapper<>(); UpdateWrapper<TransitUserRecord> wrapper = new UpdateWrapper<>();
wrapper.eq("person_pic", entityInfoKs.getSmalimage()); wrapper.eq("person_pic", entityInfoKs.getSmalimage());
boolean update = transitUserRecordService.update(transitUserRecord,wrapper); boolean update = transitUserRecordService.update(transitUserRecord, wrapper);
if (update){ if (update) {
logger.info("Face-" + entityInfoKs.getSmalimage() + ":更新成功"); logger.info("Face-" + entityInfoKs.getSmalimage() + ":更新成功");
} }
} }
} }
} catch (Exception e) {
logger.info("TSInfos:" + StringKit.getTrace(e));
}
} }
} }

Loading…
Cancel
Save