Commit f2de590c by 朱海

[chg]同步数据到标注平台增加开始时间和结束时间参数过滤条件

1 parent e1e820ff
...@@ -59,7 +59,10 @@ public class KeliuController { ...@@ -59,7 +59,10 @@ public class KeliuController {
public Object sendData(@RequestParam Date date, @RequestParam Long mallId, @RequestParam Long packId, @RequestParam(required = false) Long taskId, public Object sendData(@RequestParam Date date, @RequestParam Long mallId, @RequestParam Long packId, @RequestParam(required = false) Long taskId,
@RequestParam(required = false, defaultValue = "-1,0,1") String direction, @RequestParam(required = false, defaultValue = "-1,0,1") String direction,
@RequestParam(required = false, defaultValue = "0,1") String personType, @RequestParam(required = false, defaultValue = "0,1") String personType,
@RequestParam(required = false,value = "deviceSerialNum") String deviceSerialNum @RequestParam(required = false,value = "deviceSerialNum") String deviceSerialNum,
@RequestParam(required = false, value = "channelSerialNum") String channelSerialNum,
@RequestParam(required = false, value = "startTime") Date startTime,
@RequestParam(required = false, value = "endTime") Date endTime
) { ) {
List<Future<JsonMessageUtil.JsonMessage>> responses = new LinkedList<>(); List<Future<JsonMessageUtil.JsonMessage>> responses = new LinkedList<>();
if (SEND_DATA) { if (SEND_DATA) {
...@@ -69,7 +72,7 @@ public class KeliuController { ...@@ -69,7 +72,7 @@ public class KeliuController {
ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(20, 20, 1, TimeUnit.MINUTES, new LinkedBlockingDeque<>(10000), new ThreadPoolExecutor.CallerRunsPolicy()); ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(20, 20, 1, TimeUnit.MINUTES, new LinkedBlockingDeque<>(10000), new ThreadPoolExecutor.CallerRunsPolicy());
try { try {
AtomicLong count = new AtomicLong(); AtomicLong count = new AtomicLong();
List<FaceRecognition> faceRecognitions = keliuRepository.getFaceRecognitionsByDateAndMallId(date, mallId, direction, deviceSerialNum,personType); List<FaceRecognition> faceRecognitions = keliuRepository.getFaceRecognitionsByDateAndMallId(date, mallId, direction, deviceSerialNum,personType, channelSerialNum, startTime, endTime);
log.info("上传数据量:" + faceRecognitions.size()); log.info("上传数据量:" + faceRecognitions.size());
for (FaceRecognition faceRecognition : faceRecognitions) { for (FaceRecognition faceRecognition : faceRecognitions) {
Future<JsonMessageUtil.JsonMessage> submit = threadPoolExecutor.submit(() -> { Future<JsonMessageUtil.JsonMessage> submit = threadPoolExecutor.submit(() -> {
......
package com.viontech.label.tool.keliu.repository; package com.viontech.label.tool.keliu.repository;
import com.viontech.keliu.util.DateUtil;
import com.viontech.label.tool.keliu.model.FaceRecognition; import com.viontech.label.tool.keliu.model.FaceRecognition;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.jdbc.core.BeanPropertyRowMapper; import org.springframework.jdbc.core.BeanPropertyRowMapper;
...@@ -26,7 +27,7 @@ public class KeliuRepository { ...@@ -26,7 +27,7 @@ public class KeliuRepository {
private JdbcTemplate jdbcTemplate; private JdbcTemplate jdbcTemplate;
public List<FaceRecognition> getFaceRecognitionsByDateAndMallId(Date date, Long mallId, String direction, String deviceSerialNum,String personType) { public List<FaceRecognition> getFaceRecognitionsByDateAndMallId(Date date, Long mallId, String direction, String deviceSerialNum,String personType,String channelSerialNum, Date startTime, Date endTime) {
String sql = "select unid,person_unid,channel_serialnum,body_pic,countdate,counttime,direction,gate_id from d_face_recognition where countdate=? and mall_id=?"; String sql = "select unid,person_unid,channel_serialnum,body_pic,countdate,counttime,direction,gate_id from d_face_recognition where countdate=? and mall_id=?";
//方向过滤 //方向过滤
if (StringUtils.isNotBlank(direction)) { if (StringUtils.isNotBlank(direction)) {
...@@ -67,6 +68,28 @@ public class KeliuRepository { ...@@ -67,6 +68,28 @@ public class KeliuRepository {
} }
sql = sql + " and device_serialnum in (" + sb.toString() + ")"; sql = sql + " and device_serialnum in (" + sb.toString() + ")";
} }
if (StringUtils.isNotBlank(channelSerialNum)) {
String[] channels = channelSerialNum.split(",");
StringBuilder sb = new StringBuilder();
for (String channel : channels) {
if (sb.length() > 0) {
sb.append(",");
}
sb.append("'");
sb.append(channel);
sb.append("'");
}
sql = sql + " and channel_serialnum in (" + sb.toString() + ")";
}
if (startTime != null) {
sql = sql + " and counttime >= '" + DateUtil.format("yyyy-MM-dd HH:mm:ss", startTime) + "'";
}
if (endTime != null) {
sql = sql + " and counttime <= '" + DateUtil.format("yyyy-MM-dd HH:mm:ss", endTime) + "'";
}
return jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(FaceRecognition.class), date, mallId); return jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(FaceRecognition.class), date, mallId);
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!