Commit 225ee1a2 by 朱海

[chg]同步数据增加方向过滤

1 parent 1d08e991
......@@ -57,7 +57,7 @@ public class KeliuController {
@GetMapping("/sendData")
public Object sendData(@RequestParam Date date, @RequestParam Long mallId, @RequestParam Long packId, @RequestParam(required = false) Long taskId,
@RequestParam(required = false, defaultValue = "1") Integer needOutSide,
@RequestParam(required = false, defaultValue = "-1,0,1") String direction,
@RequestParam(required = false,value = "deviceSerialNum") String deviceSerialNum
) {
List<Future<JsonMessageUtil.JsonMessage>> responses = new LinkedList<>();
......@@ -68,7 +68,7 @@ public class KeliuController {
ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(20, 20, 1, TimeUnit.MINUTES, new LinkedBlockingDeque<>(10000), new ThreadPoolExecutor.CallerRunsPolicy());
try {
AtomicLong count = new AtomicLong();
List<FaceRecognition> faceRecognitions = keliuRepository.getFaceRecognitionsByDateAndMallId(date, mallId, needOutSide, deviceSerialNum);
List<FaceRecognition> faceRecognitions = keliuRepository.getFaceRecognitionsByDateAndMallId(date, mallId, direction, deviceSerialNum);
log.info("上传数据量:" + faceRecognitions.size());
for (FaceRecognition faceRecognition : faceRecognitions) {
Future<JsonMessageUtil.JsonMessage> submit = threadPoolExecutor.submit(() -> {
......
......@@ -4,6 +4,7 @@ import com.viontech.label.tool.keliu.model.FaceRecognition;
import org.apache.commons.lang3.StringUtils;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
import org.springframework.stereotype.Repository;
import javax.annotation.Resource;
......@@ -24,12 +25,22 @@ public class KeliuRepository {
@Resource
private JdbcTemplate jdbcTemplate;
public List<FaceRecognition> getFaceRecognitionsByDateAndMallId(Date date, Long mallId, Integer needOutSide, String deviceSerialNum) {
public List<FaceRecognition> getFaceRecognitionsByDateAndMallId(Date date, Long mallId, String direction, String deviceSerialNum) {
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 (needOutSide == 0) {
sql = sql + " and direction != 0";
//方向过滤
if (StringUtils.isNotBlank(direction)) {
String[] directions = direction.split(",");
sql = sql + " and direction in(";
for (int i = 0; i < directions.length; i++) {
sql = sql + Integer.valueOf(directions[i]);
if (i < directions.length - 1) {
sql = sql + ",";
}
}
sql = sql + ")";
}
if (StringUtils.isNotBlank(deviceSerialNum)) {
String[] devices = deviceSerialNum.split(",");
StringBuilder sb = new StringBuilder();
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!