Commit 2d5b3747 by 朱海

[chg]去掉直接显示头脚连线

1 parent 34bbb1b2
...@@ -122,7 +122,7 @@ public class ReidController { ...@@ -122,7 +122,7 @@ public class ReidController {
, @RequestParam(required = false) Integer status, @RequestParam Integer type , @RequestParam(required = false) Integer status, @RequestParam Integer type
, @RequestParam(defaultValue = "1") Integer countGTE, @RequestParam(defaultValue = "10000") Integer countLTE) { , @RequestParam(defaultValue = "1") Integer countGTE, @RequestParam(defaultValue = "10000") Integer countLTE) {
SubTaskMapper mapper = (SubTaskMapper) subTaskService.getMapper(); SubTaskMapper mapper = (SubTaskMapper) subTaskService.getMapper();
List<SubTask> pics = mapper.getOtherPeople(packId, status, personUnid, type == 0 ? ">" : "<", type == 0 ? "" : "desc", countGTE, countLTE); List<SubTask> pics = mapper.getOtherPeople(packId, status, personUnid, type == 0 ? "<" : ">", type == 0 ? "desc" : "asc", countGTE, countLTE);
if (pics.size() == 0) { if (pics.size() == 0) {
return JsonMessageUtil.getSuccessJsonMsg("没有数据了"); return JsonMessageUtil.getSuccessJsonMsg("没有数据了");
} }
...@@ -223,6 +223,13 @@ public class ReidController { ...@@ -223,6 +223,13 @@ public class ReidController {
return JsonMessageUtil.getSuccessJsonMsg("success"); return JsonMessageUtil.getSuccessJsonMsg("success");
} }
@RequestMapping("/setFlag")
public Object setPackFlag(@RequestParam String personUnid, @RequestParam Long packId, @RequestParam(required = false) String flag) {
reidService.setPersonFlag(personUnid, packId, flag);
return JsonMessageUtil.getSuccessJsonMsg("success");
}
/** /**
* 根据图片查找相似的人 * 根据图片查找相似的人
* *
......
...@@ -75,7 +75,7 @@ public interface SubTaskMapper extends BaseMapper { ...@@ -75,7 +75,7 @@ public interface SubTaskMapper extends BaseMapper {
"<if test = 'startTime != null &amp;&amp; endTime != null'> and annotate_time between #{startTime} and #{endTime}</if>" + "<if test = 'startTime != null &amp;&amp; endTime != null'> and annotate_time between #{startTime} and #{endTime}</if>" +
"group by person_unid " + "group by person_unid " +
" having count(*) between #{countGTE} and #{countLTE} " + " having count(*) between #{countGTE} and #{countLTE} " +
" order by min(create_time), person_unid " + " order by max(annotate_time) desc nulls last, person_unid desc " +
"<if test='offset != null'> offset #{offset} limit #{limit}</if>" + "<if test='offset != null'> offset #{offset} limit #{limit}</if>" +
"</script>") "</script>")
List<String> getPersonUnids(Long packId, Integer status, Long offset, Long limit, Long annotatorId, Integer countGTE, Integer countLTE, Date startTime, Date endTime); List<String> getPersonUnids(Long packId, Integer status, Long offset, Long limit, Long annotatorId, Integer countGTE, Integer countLTE, Date startTime, Date endTime);
...@@ -102,7 +102,7 @@ public interface SubTaskMapper extends BaseMapper { ...@@ -102,7 +102,7 @@ public interface SubTaskMapper extends BaseMapper {
" <if test = 'status == null'> and status != -1</if> " + " <if test = 'status == null'> and status != -1</if> " +
" and person_unid ${type} #{personUnid} group by person_unid " + " and person_unid ${type} #{personUnid} group by person_unid " +
" having count(*) between #{countGTE} and #{countLTE} " + " having count(*) between #{countGTE} and #{countLTE} " +
" order by person_unid ${sort} limit 1) order by id" + " order by max(annotate_time) ${sort}, person_unid ${sort} limit 1) order by id" +
"</script>") "</script>")
List<SubTask> getOtherPeople(Long packId, Integer status, String personUnid, String type, String sort, Integer countGTE, Integer countLTE); List<SubTask> getOtherPeople(Long packId, Integer status, String personUnid, String type, String sort, Integer countGTE, Integer countLTE);
} }
\ No newline at end of file \ No newline at end of file
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
<result column="subTask_person_unid" property="personUnid" /> <result column="subTask_person_unid" property="personUnid" />
<result column="subTask_direction" property="direction" /> <result column="subTask_direction" property="direction" />
<result column="subTask_gate_id" property="gateId" /> <result column="subTask_gate_id" property="gateId" />
<result column="subTask_person_flag" property="personFlag"/>
</resultMap> </resultMap>
<resultMap id="BaseResultMap" type="com.viontech.label.platform.model.SubTask" extends="BaseResultMapRoot" > <resultMap id="BaseResultMap" type="com.viontech.label.platform.model.SubTask" extends="BaseResultMapRoot" >
<result column="pic_id" property="pic.id" /> <result column="pic_id" property="pic.id" />
...@@ -123,7 +124,7 @@ ...@@ -123,7 +124,7 @@
"subTask".annotate_time as subTask_annotate_time, "subTask".label_result as subTask_label_result, "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".in_status as subTask_in_status, "subTask".out_status as subTask_out_status,
"subTask"."status" as "subTask_status", "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 "subTask".direction as subTask_direction, "subTask".gate_id as subTask_gate_id, "subTask".person_flag as subTask_person_flag
</sql> </sql>
<sql id="Base_Column_List" > <sql id="Base_Column_List" >
<if test="!(_parameter.getClass().getSimpleName() == 'SubTaskExample')" > <if test="!(_parameter.getClass().getSimpleName() == 'SubTaskExample')" >
...@@ -262,6 +263,9 @@ ...@@ -262,6 +263,9 @@
<if test="gateId != null" > <if test="gateId != null" >
gate_id, gate_id,
</if> </if>
<if test="personFlag != null">
person_flag,
</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides="," > <trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="unid != null" > <if test="unid != null" >
...@@ -315,6 +319,9 @@ ...@@ -315,6 +319,9 @@
<if test="gateId != null" > <if test="gateId != null" >
#{gateId,jdbcType=BIGINT}, #{gateId,jdbcType=BIGINT},
</if> </if>
<if test="personFlag != null" >
#{personFlag,jdbcType=VARCHAR},
</if>
</trim> </trim>
</insert> </insert>
<select id="countByExample" parameterType="com.viontech.label.platform.model.SubTaskExample" resultType="java.lang.Integer" > <select id="countByExample" parameterType="com.viontech.label.platform.model.SubTaskExample" resultType="java.lang.Integer" >
...@@ -381,6 +388,9 @@ ...@@ -381,6 +388,9 @@
<if test="record.gateId != null" > <if test="record.gateId != null" >
gate_id = #{record.gateId,jdbcType=BIGINT}, gate_id = #{record.gateId,jdbcType=BIGINT},
</if> </if>
<if test="record.personFlag != null" >
person_flag = #{record.personFlag,jdbcType=VARCHAR},
</if>
</set> </set>
<if test="_parameter != null" > <if test="_parameter != null" >
<include refid="Update_By_Example_Where_Clause" /> <include refid="Update_By_Example_Where_Clause" />
...@@ -405,7 +415,8 @@ ...@@ -405,7 +415,8 @@
"status" = #{record.status,jdbcType=INTEGER}, "status" = #{record.status,jdbcType=INTEGER},
person_unid = #{record.personUnid,jdbcType=VARCHAR}, person_unid = #{record.personUnid,jdbcType=VARCHAR},
direction = #{record.direction,jdbcType=INTEGER}, direction = #{record.direction,jdbcType=INTEGER},
gate_id = #{record.gateId,jdbcType=BIGINT} gate_id = #{record.gateId,jdbcType=BIGINT},
person_flag = #{record.personFlag,jdbcType=VARCHAR}
<if test="_parameter != null" > <if test="_parameter != null" >
<include refid="Update_By_Example_Where_Clause" /> <include refid="Update_By_Example_Where_Clause" />
</if> </if>
...@@ -464,6 +475,9 @@ ...@@ -464,6 +475,9 @@
<if test="gateId != null" > <if test="gateId != null" >
gate_id = #{gateId,jdbcType=BIGINT}, gate_id = #{gateId,jdbcType=BIGINT},
</if> </if>
<if test="personFlag != null" >"
person_flag = #{personFlag,jdbcType=VARCHAR},
</if>
</set> </set>
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
</update> </update>
...@@ -485,7 +499,8 @@ ...@@ -485,7 +499,8 @@
"status" = #{status,jdbcType=INTEGER}, "status" = #{status,jdbcType=INTEGER},
person_unid = #{personUnid,jdbcType=VARCHAR}, person_unid = #{personUnid,jdbcType=VARCHAR},
direction = #{direction,jdbcType=INTEGER}, direction = #{direction,jdbcType=INTEGER},
gate_id = #{gateId,jdbcType=BIGINT} gate_id = #{gateId,jdbcType=BIGINT},
person_flag = #{record.personFlag,jdbcType=VARCHAR}
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
</update> </update>
</mapper> </mapper>
\ No newline at end of file \ No newline at end of file
...@@ -2,6 +2,7 @@ package com.viontech.label.platform.model; ...@@ -2,6 +2,7 @@ package com.viontech.label.platform.model;
import com.viontech.label.platform.base.BaseModel; import com.viontech.label.platform.base.BaseModel;
import java.util.Date; import java.util.Date;
import java.util.Map;
public class SubTask extends BaseModel { public class SubTask extends BaseModel {
private Long id; private Long id;
...@@ -44,6 +45,10 @@ public class SubTask extends BaseModel { ...@@ -44,6 +45,10 @@ public class SubTask extends BaseModel {
private Task task; private Task task;
private Map<String, Integer> bodyPoint;
private String personFlag;
public Long getId() { public Long getId() {
return id; return id;
} }
...@@ -203,4 +208,20 @@ public class SubTask extends BaseModel { ...@@ -203,4 +208,20 @@ public class SubTask extends BaseModel {
public void setTask(Task task) { public void setTask(Task task) {
this.task = task; this.task = task;
} }
public Map<String, Integer> getBodyPoint() {
return bodyPoint;
}
public void setBodyPoint(Map<String, Integer> bodyPoint) {
this.bodyPoint = bodyPoint;
}
public String getPersonFlag() {
return personFlag;
}
public void setPersonFlag(String personFlag) {
this.personFlag = personFlag;
}
} }
\ No newline at end of file \ No newline at end of file
package com.viontech.label.platform.service.impl; package com.viontech.label.platform.service.impl;
import com.viontech.keliu.model.Feature;
import com.viontech.keliu.util.JsonMessageUtil;
import com.viontech.label.platform.base.BaseExample;
import com.viontech.label.platform.base.BaseMapper; import com.viontech.label.platform.base.BaseMapper;
import com.viontech.label.platform.base.BaseServiceImpl; import com.viontech.label.platform.base.BaseServiceImpl;
import com.viontech.label.platform.mapper.SubTaskMapper; import com.viontech.label.platform.mapper.SubTaskMapper;
import com.viontech.label.platform.model.SubTask; import com.viontech.label.platform.model.SubTask;
import com.viontech.label.platform.model.SubTaskExample; import com.viontech.label.platform.model.SubTaskExample;
import com.viontech.label.platform.service.adapter.SubTaskService; import com.viontech.label.platform.service.adapter.SubTaskService;
import com.viontech.label.platform.utils.StorageUtils;
import org.redisson.mapreduce.SubTasksExecutor; import org.redisson.mapreduce.SubTasksExecutor;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
@Service @Service
public class SubTaskServiceImpl extends BaseServiceImpl<SubTask> implements SubTaskService { public class SubTaskServiceImpl extends BaseServiceImpl<SubTask> implements SubTaskService {
@Resource @Resource
private SubTaskMapper subTaskMapper; private SubTaskMapper subTaskMapper;
@Resource
private StorageUtils storageUtils;
@Override @Override
public BaseMapper<SubTask> getMapper() { public BaseMapper<SubTask> getMapper() {
return subTaskMapper; return subTaskMapper;
...@@ -54,4 +63,58 @@ public class SubTaskServiceImpl extends BaseServiceImpl<SubTask> implements SubT ...@@ -54,4 +63,58 @@ public class SubTaskServiceImpl extends BaseServiceImpl<SubTask> implements SubT
return selectByExample(subTaskExample); return selectByExample(subTaskExample);
} }
@Override
public List<SubTask> selectByExample(BaseExample example) {
List<SubTask> subTasks = super.selectByExample(example);
/*for (SubTask subTask : subTasks) {
Map<String, Integer> bodyPoint = getBodyPoint(subTask.getPicId());
subTask.setBodyPoint(bodyPoint);
}*/
return subTasks;
}
public Map<String, Integer> getBodyPoint(Long picId) {
try {
Feature feature = storageUtils.getFeatureByPic(picId);
if (null == feature) {
return null;
}
double cx = feature.getFace_roi().get(0).getX();
double cy = feature.getFace_roi().get(0).getY();
double foot_x = feature.getFace_roi().get(0).getW();
double foot_y = feature.getFace_roi().get(0).getH();
Integer img_type = feature.getBody_roi().get(0).getX();
Integer quadrant = feature.getBody_roi().get(0).getY();
double lefttop_x = feature.getBody_roi().get(0).getW();
double lefttop_y = feature.getBody_roi().get(0).getH();
Integer head_x_inSmall = new Double(Math.abs(cx - lefttop_x)).intValue();
Integer head_y_inSmall = new Double(Math.abs(cy - lefttop_y)).intValue();
Integer foot_x_inSmall = new Double(Math.abs(foot_x - lefttop_x)).intValue();
Integer foot_y_inSmall = new Double(Math.abs(foot_y - lefttop_y)).intValue();
if (quadrant == 1 || quadrant == 3) {
int temp;
temp = head_x_inSmall;
head_x_inSmall = head_y_inSmall;
head_y_inSmall = temp;
temp = foot_x_inSmall;
foot_x_inSmall = foot_y_inSmall;
foot_y_inSmall = temp;
}
Map<String, Integer> resultMap = new HashMap<>(4);
resultMap.put("head_x_inSmall", head_x_inSmall);
resultMap.put("head_y_inSmall", head_y_inSmall);
resultMap.put("foot_x_inSmall", foot_x_inSmall);
resultMap.put("foot_y_inSmall", foot_y_inSmall);
return resultMap;
} catch (Exception e) {
logger.error("获取坐标失败:{}", e.getMessage());
return null;
}
}
} }
\ No newline at end of file \ No newline at end of file
...@@ -38,6 +38,7 @@ import org.apache.commons.compress.archivers.zip.ZipArchiveEntry; ...@@ -38,6 +38,7 @@ import org.apache.commons.compress.archivers.zip.ZipArchiveEntry;
import org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream; import org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream;
import org.apache.commons.compress.parallel.InputStreamSupplier; import org.apache.commons.compress.parallel.InputStreamSupplier;
import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;
import org.redisson.api.RMap; import org.redisson.api.RMap;
import org.redisson.api.RSet; import org.redisson.api.RSet;
import org.redisson.api.RedissonClient; import org.redisson.api.RedissonClient;
...@@ -45,6 +46,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -45,6 +46,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StopWatch; import org.springframework.util.StopWatch;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
...@@ -438,6 +440,8 @@ public class ReidService { ...@@ -438,6 +440,8 @@ public class ReidService {
subTaskExample.createCriteria().andPersonUnidEqualTo(personUnid).andPackIdEqualTo(packId); subTaskExample.createCriteria().andPersonUnidEqualTo(personUnid).andPackIdEqualTo(packId);
SubTask subTask = new SubTask(); SubTask subTask = new SubTask();
subTask.setStatus(SubTaskStatus.TODO.val); subTask.setStatus(SubTaskStatus.TODO.val);
subTask.setAnnotatorId(StpUtil.getLoginIdAsLong());
subTask.setAnnotateTime(new Date());
subTaskService.updateByExampleSelective(subTask, subTaskExample); subTaskService.updateByExampleSelective(subTask, subTaskExample);
} }
...@@ -495,6 +499,8 @@ public class ReidService { ...@@ -495,6 +499,8 @@ public class ReidService {
subTaskExample.createCriteria().andPersonUnidEqualTo(personUnid).andPackIdEqualTo(packId); subTaskExample.createCriteria().andPersonUnidEqualTo(personUnid).andPackIdEqualTo(packId);
SubTask subTask = new SubTask(); SubTask subTask = new SubTask();
subTask.setStatus(SubTaskStatus.LOW_QUALITY.val); subTask.setStatus(SubTaskStatus.LOW_QUALITY.val);
subTask.setAnnotatorId(StpUtil.getLoginIdAsLong());
subTask.setAnnotateTime(new Date());
subTaskService.updateByExampleSelective(subTask, subTaskExample); subTaskService.updateByExampleSelective(subTask, subTaskExample);
String reidPoolName = Constants.getReidPoolName(packId); String reidPoolName = Constants.getReidPoolName(packId);
...@@ -518,6 +524,7 @@ public class ReidService { ...@@ -518,6 +524,7 @@ public class ReidService {
if (subTasks.size() == 0) { if (subTasks.size() == 0) {
return; return;
} }
List<SubTask> unAnnotatorList = subTasks.stream().filter(t -> t.getAnnotatorId() == null).collect(Collectors.toList());
Set<Integer> status = subTasks.stream().map(SubTask::getStatus).collect(Collectors.toSet()); Set<Integer> status = subTasks.stream().map(SubTask::getStatus).collect(Collectors.toSet());
SubTask subTask = new SubTask(); SubTask subTask = new SubTask();
subTask.setStatus(SubTaskStatus.FINISH_LABELING.val); subTask.setStatus(SubTaskStatus.FINISH_LABELING.val);
...@@ -531,10 +538,14 @@ public class ReidService { ...@@ -531,10 +538,14 @@ public class ReidService {
} else if (status.contains(SubTaskStatus.recycled.val)) { } else if (status.contains(SubTaskStatus.recycled.val)) {
return; return;
} }
subTaskService.updateByExampleSelective(subTask, subTaskExample);
//更新标注人为空的信息
if (!CollectionUtils.isEmpty(unAnnotatorList)) {
subTask.setAnnotatorId(StpUtil.getLoginIdAsLong()); subTask.setAnnotatorId(StpUtil.getLoginIdAsLong());
subTask.setAnnotateTime(new Date()); subTask.setAnnotateTime(new Date());
subTaskExample.createCriteria().andAnnotatorIdIsNull();
subTaskService.updateByExampleSelective(subTask, subTaskExample); subTaskService.updateByExampleSelective(subTask, subTaskExample);
}
//删除缓存 //删除缓存
RMap<String, User> labelingSet = redissonClient.getMap("labeling:" + packId); RMap<String, User> labelingSet = redissonClient.getMap("labeling:" + packId);
...@@ -546,6 +557,31 @@ public class ReidService { ...@@ -546,6 +557,31 @@ public class ReidService {
} }
/** /**
* 设置标识
* @param personUnid
* @param packId
* @param personFlag
*/
public void setPersonFlag(String personUnid, Long packId, String personFlag) {
if (personFlag == null) {
return;
}
User currentUser = userService.getCurrentUser();
if (currentUser.isInspector()) {
return;
}
SubTaskExample subTaskExample = new SubTaskExample();
subTaskExample.createCriteria().andPersonUnidEqualTo(personUnid).andPackIdEqualTo(packId);
SubTask subTask = new SubTask();
subTask.setPersonFlag(personFlag);
subTaskService.updateByExampleSelective(subTask, subTaskExample);
}
/**
* 根据所选择的图片获取相似的人 * 根据所选择的图片获取相似的人
*/ */
public Map<String, Map<String, List<SubTask>>> getSimilarPerson(Long[] subTaskIdArr, Long packId, Long size, Integer timeInterval, String currentPerson, Integer recursion,Integer score) { public Map<String, Map<String, List<SubTask>>> getSimilarPerson(Long[] subTaskIdArr, Long packId, Long size, Integer timeInterval, String currentPerson, Integer recursion,Integer score) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!