Commit 8ebff0ab by xmh

添加gateId

1 parent b9c4236e
......@@ -118,7 +118,7 @@
<dependency>
<groupId>com.viontech.keliu</groupId>
<artifactId>AlgApiClient</artifactId>
<version>6.0.8</version>
<version>6.0.9-SNAPSHOT</version>
<exclusions>
<exclusion>
<artifactId>tomcat-websocket</artifactId>
......
......@@ -202,12 +202,14 @@ public class ReidController {
* @param picIdArr 图片Id数组
* @param packId 图包id
* @param size 获取相似的人的数量
* @param recursion 当前用作是否限定gateId,以后用于连通图的递归次数
*/
@GetMapping("/getSimilarPerson")
public Object getSimilarPerson(@RequestParam Long[] picIdArr, @RequestParam Long packId,
@RequestParam Long size, @RequestParam(required = false) Integer timeInterval,
@RequestParam(required = false) String currentPerson) {
Map<String, Map<String, List<SubTask>>> similarPerson = reidService.getSimilarPerson(picIdArr, packId, size, timeInterval, currentPerson);
@RequestParam(required = false) String currentPerson,
@RequestParam(required = false,defaultValue = "0") Integer recursion ) {
Map<String, Map<String, List<SubTask>>> similarPerson = reidService.getSimilarPerson(picIdArr, packId, size, timeInterval, currentPerson,recursion);
return JsonMessageUtil.getSuccessJsonMsg("success", similarPerson);
}
......
......@@ -17,8 +17,9 @@
<result column="subTask_in_status" property="inStatus" />
<result column="subTask_out_status" property="outStatus" />
<result column="subTask_status" property="status" />
<result column="subTask_direction" property="direction" />
<result column="subTask_person_unid" property="personUnid" />
<result column="subTask_direction" property="direction" />
<result column="subTask_gate_id" property="gateId" />
</resultMap>
<resultMap id="BaseResultMap" type="com.viontech.label.platform.model.SubTask" extends="BaseResultMapRoot" >
<result column="pic_id" property="pic.id" />
......@@ -121,8 +122,8 @@
"subTask".out_inspector_id as subTask_out_inspector_id, "subTask".annotator_id as subTask_annotator_id,
"subTask".annotate_time as subTask_annotate_time, "subTask".label_result as subTask_label_result,
"subTask".in_status as subTask_in_status, "subTask".out_status as subTask_out_status,
"subTask"."status" as "subTask_status", "subTask".direction as subTask_direction,
"subTask".person_unid as subTask_person_unid
"subTask"."status" as "subTask_status", "subTask".person_unid as subTask_person_unid,
"subTask".direction as subTask_direction, "subTask".gate_id as subTask_gate_id
</sql>
<sql id="Base_Column_List" >
<if test="!(_parameter.getClass().getSimpleName() == 'SubTaskExample')" >
......@@ -198,14 +199,14 @@
pic_id, pack_id, task_id,
in_inspector_id, out_inspector_id, annotator_id,
annotate_time, label_result, in_status,
out_status, "status", direction,
person_unid)
out_status, "status", person_unid,
direction, gate_id)
values (#{unid,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{createUser,jdbcType=BIGINT},
#{picId,jdbcType=BIGINT}, #{packId,jdbcType=BIGINT}, #{taskId,jdbcType=BIGINT},
#{inInspectorId,jdbcType=BIGINT}, #{outInspectorId,jdbcType=BIGINT}, #{annotatorId,jdbcType=BIGINT},
#{annotateTime,jdbcType=TIMESTAMP}, #{labelResult,jdbcType=VARCHAR}, #{inStatus,jdbcType=INTEGER},
#{outStatus,jdbcType=INTEGER}, #{status,jdbcType=INTEGER}, #{direction,jdbcType=INTEGER},
#{personUnid,jdbcType=VARCHAR})
#{outStatus,jdbcType=INTEGER}, #{status,jdbcType=INTEGER}, #{personUnid,jdbcType=VARCHAR},
#{direction,jdbcType=INTEGER}, #{gateId,jdbcType=BIGINT})
</insert>
<insert id="insertSelective" parameterType="com.viontech.label.platform.model.SubTask" useGeneratedKeys="true" keyProperty="id" keyColumn="id" >
insert into "d_sub_task"
......@@ -252,11 +253,14 @@
<if test="status != null" >
"status",
</if>
<if test="personUnid != null" >
person_unid,
</if>
<if test="direction != null" >
direction,
</if>
<if test="personUnid != null" >
person_unid,
<if test="gateId != null" >
gate_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
......@@ -302,11 +306,14 @@
<if test="status != null" >
#{status,jdbcType=INTEGER},
</if>
<if test="personUnid != null" >
#{personUnid,jdbcType=VARCHAR},
</if>
<if test="direction != null" >
#{direction,jdbcType=INTEGER},
</if>
<if test="personUnid != null" >
#{personUnid,jdbcType=VARCHAR},
<if test="gateId != null" >
#{gateId,jdbcType=BIGINT},
</if>
</trim>
</insert>
......@@ -365,11 +372,14 @@
<if test="record.status != null" >
"status" = #{record.status,jdbcType=INTEGER},
</if>
<if test="record.personUnid != null" >
person_unid = #{record.personUnid,jdbcType=VARCHAR},
</if>
<if test="record.direction != null" >
direction = #{record.direction,jdbcType=INTEGER},
</if>
<if test="record.personUnid != null" >
person_unid = #{record.personUnid,jdbcType=VARCHAR},
<if test="record.gateId != null" >
gate_id = #{record.gateId,jdbcType=BIGINT},
</if>
</set>
<if test="_parameter != null" >
......@@ -393,8 +403,9 @@
in_status = #{record.inStatus,jdbcType=INTEGER},
out_status = #{record.outStatus,jdbcType=INTEGER},
"status" = #{record.status,jdbcType=INTEGER},
person_unid = #{record.personUnid,jdbcType=VARCHAR},
direction = #{record.direction,jdbcType=INTEGER},
person_unid = #{record.personUnid,jdbcType=VARCHAR}
gate_id = #{record.gateId,jdbcType=BIGINT}
<if test="_parameter != null" >
<include refid="Update_By_Example_Where_Clause" />
</if>
......@@ -444,11 +455,14 @@
<if test="status != null" >
"status" = #{status,jdbcType=INTEGER},
</if>
<if test="personUnid != null" >
person_unid = #{personUnid,jdbcType=VARCHAR},
</if>
<if test="direction != null" >
direction = #{direction,jdbcType=INTEGER},
</if>
<if test="personUnid != null" >
person_unid = #{personUnid,jdbcType=VARCHAR},
<if test="gateId != null" >
gate_id = #{gateId,jdbcType=BIGINT},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
......@@ -469,8 +483,9 @@
in_status = #{inStatus,jdbcType=INTEGER},
out_status = #{outStatus,jdbcType=INTEGER},
"status" = #{status,jdbcType=INTEGER},
person_unid = #{personUnid,jdbcType=VARCHAR},
direction = #{direction,jdbcType=INTEGER},
person_unid = #{personUnid,jdbcType=VARCHAR}
gate_id = #{gateId,jdbcType=BIGINT}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>
\ No newline at end of file
......@@ -34,9 +34,11 @@ public class SubTask extends BaseModel {
private Integer status;
private String personUnid;
private Integer direction;
private String personUnid;
private Long gateId;
private Pic pic;
......@@ -162,6 +164,14 @@ public class SubTask extends BaseModel {
this.status = status;
}
public String getPersonUnid() {
return personUnid;
}
public void setPersonUnid(String personUnid) {
this.personUnid = personUnid == null ? null : personUnid.trim();
}
public Integer getDirection() {
return direction;
}
......@@ -170,12 +180,12 @@ public class SubTask extends BaseModel {
this.direction = direction;
}
public String getPersonUnid() {
return personUnid;
public Long getGateId() {
return gateId;
}
public void setPersonUnid(String personUnid) {
this.personUnid = personUnid == null ? null : personUnid.trim();
public void setGateId(Long gateId) {
this.gateId = gateId;
}
public Pic getPic() {
......
......@@ -1093,6 +1093,76 @@ public class SubTaskExample extends BaseExample {
return (Criteria) this;
}
public Criteria andPersonUnidIsNull() {
addCriterion("\"subTask\".person_unid is null");
return (Criteria) this;
}
public Criteria andPersonUnidIsNotNull() {
addCriterion("\"subTask\".person_unid is not null");
return (Criteria) this;
}
public Criteria andPersonUnidEqualTo(String value) {
addCriterion("\"subTask\".person_unid =", value, "personUnid");
return (Criteria) this;
}
public Criteria andPersonUnidNotEqualTo(String value) {
addCriterion("\"subTask\".person_unid <>", value, "personUnid");
return (Criteria) this;
}
public Criteria andPersonUnidGreaterThan(String value) {
addCriterion("\"subTask\".person_unid >", value, "personUnid");
return (Criteria) this;
}
public Criteria andPersonUnidGreaterThanOrEqualTo(String value) {
addCriterion("\"subTask\".person_unid >=", value, "personUnid");
return (Criteria) this;
}
public Criteria andPersonUnidLessThan(String value) {
addCriterion("\"subTask\".person_unid <", value, "personUnid");
return (Criteria) this;
}
public Criteria andPersonUnidLessThanOrEqualTo(String value) {
addCriterion("\"subTask\".person_unid <=", value, "personUnid");
return (Criteria) this;
}
public Criteria andPersonUnidLike(String value) {
addCriterion("\"subTask\".person_unid like", value, "personUnid");
return (Criteria) this;
}
public Criteria andPersonUnidNotLike(String value) {
addCriterion("\"subTask\".person_unid not like", value, "personUnid");
return (Criteria) this;
}
public Criteria andPersonUnidIn(List<String> values) {
addCriterion("\"subTask\".person_unid in", values, "personUnid");
return (Criteria) this;
}
public Criteria andPersonUnidNotIn(List<String> values) {
addCriterion("\"subTask\".person_unid not in", values, "personUnid");
return (Criteria) this;
}
public Criteria andPersonUnidBetween(String value1, String value2) {
addCriterion("\"subTask\".person_unid between", value1, value2, "personUnid");
return (Criteria) this;
}
public Criteria andPersonUnidNotBetween(String value1, String value2) {
addCriterion("\"subTask\".person_unid not between", value1, value2, "personUnid");
return (Criteria) this;
}
public Criteria andDirectionIsNull() {
addCriterion("\"subTask\".direction is null");
return (Criteria) this;
......@@ -1153,73 +1223,63 @@ public class SubTaskExample extends BaseExample {
return (Criteria) this;
}
public Criteria andPersonUnidIsNull() {
addCriterion("\"subTask\".person_unid is null");
public Criteria andGateIdIsNull() {
addCriterion("\"subTask\".gate_id is null");
return (Criteria) this;
}
public Criteria andPersonUnidIsNotNull() {
addCriterion("\"subTask\".person_unid is not null");
public Criteria andGateIdIsNotNull() {
addCriterion("\"subTask\".gate_id is not null");
return (Criteria) this;
}
public Criteria andPersonUnidEqualTo(String value) {
addCriterion("\"subTask\".person_unid =", value, "personUnid");
public Criteria andGateIdEqualTo(Long value) {
addCriterion("\"subTask\".gate_id =", value, "gateId");
return (Criteria) this;
}
public Criteria andPersonUnidNotEqualTo(String value) {
addCriterion("\"subTask\".person_unid <>", value, "personUnid");
public Criteria andGateIdNotEqualTo(Long value) {
addCriterion("\"subTask\".gate_id <>", value, "gateId");
return (Criteria) this;
}
public Criteria andPersonUnidGreaterThan(String value) {
addCriterion("\"subTask\".person_unid >", value, "personUnid");
public Criteria andGateIdGreaterThan(Long value) {
addCriterion("\"subTask\".gate_id >", value, "gateId");
return (Criteria) this;
}
public Criteria andPersonUnidGreaterThanOrEqualTo(String value) {
addCriterion("\"subTask\".person_unid >=", value, "personUnid");
public Criteria andGateIdGreaterThanOrEqualTo(Long value) {
addCriterion("\"subTask\".gate_id >=", value, "gateId");
return (Criteria) this;
}
public Criteria andPersonUnidLessThan(String value) {
addCriterion("\"subTask\".person_unid <", value, "personUnid");
public Criteria andGateIdLessThan(Long value) {
addCriterion("\"subTask\".gate_id <", value, "gateId");
return (Criteria) this;
}
public Criteria andPersonUnidLessThanOrEqualTo(String value) {
addCriterion("\"subTask\".person_unid <=", value, "personUnid");
public Criteria andGateIdLessThanOrEqualTo(Long value) {
addCriterion("\"subTask\".gate_id <=", value, "gateId");
return (Criteria) this;
}
public Criteria andPersonUnidLike(String value) {
addCriterion("\"subTask\".person_unid like", value, "personUnid");
public Criteria andGateIdIn(List<Long> values) {
addCriterion("\"subTask\".gate_id in", values, "gateId");
return (Criteria) this;
}
public Criteria andPersonUnidNotLike(String value) {
addCriterion("\"subTask\".person_unid not like", value, "personUnid");
public Criteria andGateIdNotIn(List<Long> values) {
addCriterion("\"subTask\".gate_id not in", values, "gateId");
return (Criteria) this;
}
public Criteria andPersonUnidIn(List<String> values) {
addCriterion("\"subTask\".person_unid in", values, "personUnid");
public Criteria andGateIdBetween(Long value1, Long value2) {
addCriterion("\"subTask\".gate_id between", value1, value2, "gateId");
return (Criteria) this;
}
public Criteria andPersonUnidNotIn(List<String> values) {
addCriterion("\"subTask\".person_unid not in", values, "personUnid");
return (Criteria) this;
}
public Criteria andPersonUnidBetween(String value1, String value2) {
addCriterion("\"subTask\".person_unid between", value1, value2, "personUnid");
return (Criteria) this;
}
public Criteria andPersonUnidNotBetween(String value1, String value2) {
addCriterion("\"subTask\".person_unid not between", value1, value2, "personUnid");
public Criteria andGateIdNotBetween(Long value1, Long value2) {
addCriterion("\"subTask\".gate_id not between", value1, value2, "gateId");
return (Criteria) this;
}
}
......@@ -1305,13 +1365,18 @@ public class SubTaskExample extends BaseExample {
return (ColumnContainer) this;
}
public ColumnContainer hasPersonUnidColumn() {
addColumnStr("\"subTask\".person_unid as subTask_person_unid ");
return (ColumnContainer) this;
}
public ColumnContainer hasDirectionColumn() {
addColumnStr("\"subTask\".direction as subTask_direction ");
return (ColumnContainer) this;
}
public ColumnContainer hasPersonUnidColumn() {
addColumnStr("\"subTask\".person_unid as subTask_person_unid ");
public ColumnContainer hasGateIdColumn() {
addColumnStr("\"subTask\".gate_id as subTask_gate_id ");
return (ColumnContainer) this;
}
}
......
......@@ -107,6 +107,7 @@ public class ReidService {
subTask.setTaskId(taskId == null ? data.getTaskId() : taskId);
subTask.setStatus(SubTaskStatus.TO_BE_LABELED.val);
subTask.setDirection(data.getDirection());
subTask.setGateId(data.getGateId());
subTaskService.insertSelective(subTask);
......@@ -133,7 +134,7 @@ public class ReidService {
}
Feature feature = objectMapper.readValue(featureFileBytes, Feature.class);
Person person = new Person().setPersonId(data.getPersonUnid()).setBodyFeatures(getBodyFeatures(feature, data.getUnid())).setCounttime(data.getCountTime());
Person person = new Person().setPersonId(data.getPersonUnid()).setBodyFeatures(getBodyFeatures(feature, data.getUnid(), data.getGateId())).setCounttime(data.getCountTime());
CompletableFuture<AlgResult> future = matchClient.EASY_PERSON_API.addPerson(poolName, Lists.newArrayList(person));
AlgResult result1 = future.get(20, TimeUnit.SECONDS);
log.info(result1.toString());
......@@ -506,7 +507,7 @@ public class ReidService {
/**
* 根据所选择的图片获取相似的人
*/
public Map<String, Map<String, List<SubTask>>> getSimilarPerson(Long[] subTaskIdArr, Long packId, Long size, Integer timeInterval, String currentPerson) {
public Map<String, Map<String, List<SubTask>>> getSimilarPerson(Long[] subTaskIdArr, Long packId, Long size, Integer timeInterval, String currentPerson, Integer recursion) {
List<BodyFeature> bodyFeatures = new ArrayList<>();
String reidPoolName = Constants.getReidPoolName(packId);
Date countTimeGTE = null;
......@@ -515,6 +516,7 @@ public class ReidService {
List<SubTask> subTasks = subTaskService.getDataByIds(Arrays.asList(subTaskIdArr));
Set<Long> picIdSet = subTasks.stream().map(SubTask::getPicId).collect(Collectors.toSet());
Set<String> personUnidSet = subTasks.stream().map(SubTask::getPersonUnid).collect(Collectors.toSet());
List<Long> gateIdList = subTasks.stream().map(SubTask::getGateId).collect(Collectors.toList());
for (Long picId : picIdSet) {
PicVo pic = storageUtils.getPic(picId);
......@@ -540,6 +542,9 @@ public class ReidService {
}
Person person = new Person().setBodyFeatures(bodyFeatures).setCounttimeGTE(countTimeGTE).setCounttimeLTE(countTimeLTE);
if (recursion > 0) {
person.setGateIdIn(gateIdList);
}
try {
HashMap<String, Object> options = new HashMap<>(2);
options.put("size", size + 1);
......@@ -762,7 +767,7 @@ public class ReidService {
}
private List<BodyFeature> getBodyFeatures(Feature feature, String unid) {
private List<BodyFeature> getBodyFeatures(Feature feature, String unid, Long gateId) {
List<Data> datas = feature.getDatas();
if (datas == null || datas.size() == 0) {
return null;
......@@ -772,7 +777,7 @@ public class ReidService {
return null;
}
Double[] featureData = data.getData();
BodyFeature bodyFeature = new BodyFeature().setFeature(featureData).setBid(feature.getFilename()).setUnid(unid);
BodyFeature bodyFeature = new BodyFeature().setFeature(featureData).setBid(feature.getFilename()).setUnid(unid).setGateId(gateId);
return Collections.singletonList(bodyFeature);
}
......@@ -928,7 +933,7 @@ public class ReidService {
if (featureByPic == null) {
continue;
}
Person person = new Person().setPersonId(personUnid).setCounttime(item.getCreateTime()).setBodyFeatures(getBodyFeatures(featureByPic, item.getUnid()));
Person person = new Person().setPersonId(personUnid).setCounttime(item.getCreateTime()).setBodyFeatures(getBodyFeatures(featureByPic, item.getUnid(), item.getGateId()));
people.add(person);
}
try {
......
......@@ -24,5 +24,6 @@ public class ReidUploadData {
private Date countTime;
private Long taskId;
private Integer direction;
private Long gateId;
}
......@@ -131,7 +131,7 @@ public class KeliuController {
map.add("taskId", taskId);
map.add("countTime", DateUtil.format("yyyy-MM-dd HH:mm:ss", faceRecognition.getCounttime()));
map.add("direction", faceRecognition.getDirection());
map.add("gateId", faceRecognition.getGateId());
return new HttpEntity<>(map, headers);
}
}
......@@ -24,7 +24,7 @@ public class KeliuRepository {
private JdbcTemplate jdbcTemplate;
public List<FaceRecognition> getFaceRecognitionsByDateAndMallId(Date date, Long mallId) {
return jdbcTemplate.query("select unid,person_unid,channel_serialnum,body_pic,countdate,counttime,direction from d_face_recognition where countdate=? and mall_id=?", new BeanPropertyRowMapper<>(FaceRecognition.class), date, mallId);
return jdbcTemplate.query("select unid,person_unid,channel_serialnum,body_pic,countdate,counttime,direction,gate_id from d_face_recognition where countdate=? and mall_id=?", new BeanPropertyRowMapper<>(FaceRecognition.class), date, mallId);
}
public HashMap<Long, String> getMallMap() {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!