yhzafk人脸

develop
Angel 11 months ago
parent 3149599e25
commit 0200a83f24

@ -0,0 +1,128 @@
package com.ssf.mysqloracletest.domain;
import lombok.Data;
@Data
public class TStrhEntityInfoKs {
/**
* ID
*/
private String objectid;
/**
* camerIdx
*/
private String cameraidx;
/**
*
*/
private String capturetime;
/**
*
*/
private String image;
/**
* IMAGE_JPEG
*/
private String image_format;
/**
*
*/
private String vertices;
/**
*
*/
private String smalimage;
/**
* IMAGE_JPEG
*/
private String smalimage_format;
/**
* id
*/
private String objectid_old;
/**
*
*/
private String age_lower_limit;
/**
*
*/
private String age_up_limit;
private String black_type;
/**
*
*/
private String cap_style;
/**
*
*/
private String gender_code;
/**
*
*/
private String glass_style;
/**
*
*/
private String mustache_style;
/**
*
*/
private String respirator_color;
/**
*
*/
private String st_age;
/**
*
*/
private String st_age_value;
/**
*
*/
private String st_expression;
/**
*
*/
private String st_helmet_style;
/**
*
*/
private String rksj;
/**
*
*/
private String gxsj;
/**
* ID
*/
private String entityid;
/**
*
*/
private String entityupdatetime;
/**
*
*/
private String gender;
/**
*
*/
private String identityid;
/**
*
*/
private String name;
/**
*
*/
private String natives;
private String remark;
private String yxx;
/**
*
*/
private String storagepath;
private String regionid;
}

@ -0,0 +1,207 @@
package com.ssf.mysqloracletest.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
*
* @TableName transit_user_record
*/
@TableName(value ="transit_user_record")
@Data
public class TransitUserRecord implements Serializable {
/**
*
*/
@TableId(type = IdType.AUTO)
private Long id;
/**
*
*/
@TableId
private Date partitionField;
/**
*
*/
private String placeCode;
/**
*
*/
private String placeName;
/**
*
*/
private String deviceCode;
/**
*
*/
private String deviceName;
/**
*
*/
private String gbsChannelNo;
/**
*
*/
private String deviceAddress;
/**
*
*/
private Integer orientation;
/**
* ip
*/
private String deviceIp;
/**
*
*/
private String globalPic;
/**
*
*/
private String personPic;
/**
*
*/
private String bodyGlobalPic;
/**
*
*/
private String bodyPic;
/**
*
*/
private String userStandardPic;
/**
*
*/
private String userName;
/**
*
*/
private String dossierCode;
/**
*
*/
private String idCard;
/**
*
*/
private String phone;
/**
*
*/
private String recordId;
/**
*
*/
private String userVehicleRecordId;
/**
* ID
*/
private String userBodyRecordId;
/**
*
*/
private String stUserRecordId;
/**
* ID
*/
private String sourceId;
/**
* ID
*/
private String personImageId;
/**
* ID
*/
private String globalImageId;
/**
*
*/
private String similarity;
/**
*
*/
private Integer isCompare;
/**
*
*/
private Integer direction;
/**
*
*/
private Long passTime;
/**
*
*/
private String axis;
/**
*
*/
private Integer dataSrc;
/**
*
*/
private Date createTime;
/**
*
*/
private Integer createBy;
/**
*
*/
private Date updateTime;
/**
*
*/
private Integer updateBy;
/**
* 0:,1:
*/
private Integer isActive;
@TableField(exist = false)
private static final long serialVersionUID = 1L;
}

@ -0,0 +1,13 @@
package com.ssf.mysqloracletest.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ssf.mysqloracletest.domain.TStrhEntityInfoKs;
public interface TStrhEntityInfoKsMapper extends BaseMapper<TStrhEntityInfoKs> {
}

@ -0,0 +1,18 @@
package com.ssf.mysqloracletest.mapper;
import com.ssf.mysqloracletest.domain.TransitUserRecord;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* @author 10503
* @description transit_user_record()Mapper
* @createDate 2023-12-22 10:29:24
* @Entity com.ssf.mysqloracletest.domain.TransitUserRecord
*/
public interface TransitUserRecordMapper extends BaseMapper<TransitUserRecord> {
}

@ -0,0 +1,9 @@
package com.ssf.mysqloracletest.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ssf.mysqloracletest.domain.TStrhEntityInfoKs;
public interface TStrhEntityInfoKsService extends IService<TStrhEntityInfoKs> {
}

@ -0,0 +1,13 @@
package com.ssf.mysqloracletest.service;
import com.ssf.mysqloracletest.domain.TransitUserRecord;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* @author 10503
* @description transit_user_record()Service
* @createDate 2023-12-22 10:29:24
*/
public interface TransitUserRecordService extends IService<TransitUserRecord> {
}

@ -0,0 +1,21 @@
package com.ssf.mysqloracletest.service.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ssf.mysqloracletest.domain.TStrhEntityInfoKs;
import com.ssf.mysqloracletest.mapper.TStrhEntityInfoKsMapper;
import com.ssf.mysqloracletest.service.TStrhEntityInfoKsService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
@Service
@RequiredArgsConstructor
@DS("postgre")
public class TStrhEntityInfoKsServiceImpl extends ServiceImpl<TStrhEntityInfoKsMapper, TStrhEntityInfoKs>
implements TStrhEntityInfoKsService {
}

@ -0,0 +1,22 @@
package com.ssf.mysqloracletest.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ssf.mysqloracletest.domain.TransitUserRecord;
import com.ssf.mysqloracletest.service.TransitUserRecordService;
import com.ssf.mysqloracletest.mapper.TransitUserRecordMapper;
import org.springframework.stereotype.Service;
/**
* @author 10503
* @description transit_user_record()Service
* @createDate 2023-12-22 10:29:24
*/
@Service
public class TransitUserRecordServiceImpl extends ServiceImpl<TransitUserRecordMapper, TransitUserRecord>
implements TransitUserRecordService{
}

@ -0,0 +1,108 @@
package com.ssf.mysqloracletest.task;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ssf.mysqloracletest.domain.TStrhEntityInfoKs;
import com.ssf.mysqloracletest.domain.TransitUserRecord;
import com.ssf.mysqloracletest.service.TStrhEntityInfoKsService;
import com.ssf.mysqloracletest.service.TransitUserRecordService;
import com.ssf.mysqloracletest.utils.ConfigParam;
import com.ssf.mysqloracletest.utils.NumKit;
import com.ssf.mysqloracletest.utils.StringKit;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
/**
*
*/
@Component
public class TStrhEntityInfoKsTask {
private static final Logger logger = LoggerFactory.getLogger(TStrhEntityInfoKsTask.class);
@Resource
private TStrhEntityInfoKsService tStrhEntityInfoKsService;
@Resource
private TransitUserRecordService transitUserRecordService;
final int oncesCounts = NumKit.checkInt(ConfigParam.oncesCounts) == 0 ? 1000 : NumKit.checkInt(ConfigParam.oncesCounts);
String maxTime = "2023-10-01 00:00:00";
@Scheduled(initialDelay = 100, fixedDelay = 3000)
public void setTransitUserRecordService() {
if (!"true".equals(ConfigParam.TStrhEntityInfoSwitch)) {
return;
}
try {
int countTStrh = tStrhEntityInfoKsService.count();
if (countTStrh > 0) {
int count = countTStrh / oncesCounts;
CountDownLatch latch = new CountDownLatch(countTStrh);
for (int i = 0; i <= count; i++) {
try {
QueryWrapper<TStrhEntityInfoKs> queryWrapper = new QueryWrapper<>();
queryWrapper.ge("captureTime", maxTime);
Page<TStrhEntityInfoKs> page = new Page<>(i + 1, 1000);
List<TStrhEntityInfoKs> resultList = tStrhEntityInfoKsService.page(page, queryWrapper).getRecords();
for (TStrhEntityInfoKs entityInfoKs : resultList) {
TransitUserRecord transitUserRecord = new TransitUserRecord();
transitUserRecord.setDeviceCode(entityInfoKs.getCameraidx());
transitUserRecord.setPassTime(Long.parseLong(entityInfoKs.getCapturetime()));
transitUserRecord.setBodyGlobalPic(entityInfoKs.getImage());
transitUserRecord.setPersonPic(entityInfoKs.getSmalimage());
transitUserRecord.setSourceId(entityInfoKs.getEntityid());
transitUserRecord.setIdCard(entityInfoKs.getIdentityid());
transitUserRecord.setUserName(entityInfoKs.getName());
//确定一个数据是否唯一
TransitUserRecord one = transitUserRecordService.lambdaQuery().eq(TransitUserRecord::getPersonPic, entityInfoKs.getSmalimage()).one();
if (one == null) {
boolean save = transitUserRecordService.save(transitUserRecord);
if (save) {
logger.info("Face-" + entityInfoKs.getSmalimage() + ":插入成功");
}
}else {
UpdateWrapper<TransitUserRecord> wrapper = new UpdateWrapper<>();
wrapper.eq("person_pic", entityInfoKs.getSmalimage());
boolean update = transitUserRecordService.update(transitUserRecord,wrapper);
if (update){
logger.info("Face-" + entityInfoKs.getSmalimage() + ":更新成功");
}
}
}
} catch (Exception e) {
logger.info("TSInfos:" + StringKit.getTrace(e));
}
latch.countDown();
}
try {
// Wait for all threads to complete
latch.await();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
} catch (Exception e) {
logger.info(StringKit.getTrace(e));
}
}
}

@ -59,4 +59,6 @@ public class ConfigParam {
public static String wsDownloadPicPath = PropertiesUtil.queryPropertiesByKey("wsDownloadPicPath");
public static String wsDownloadPicAreaStart = PropertiesUtil.queryPropertiesByKey("wsDownloadPicAreaStart");
public static String TStrhEntityInfoSwitch = StringKit.toString(PropertiesUtil.queryPropertiesByKey("TStrhEntityInfoSwitch"));
}

Loading…
Cancel
Save