Commit 706ef0b7 by 毛树良

[chg]:百货:支持通过场所id统计场所下所有门店的批次/接待数据

1 parent 377cf53b
package com.viontech.keliu.dao;
import com.viontech.keliu.entity.BMall;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;
import jakarta.annotation.Resource;
import java.util.List;
/**
* Created with IntelliJ IDEA.
*/
@Repository
public class BMallDao {
@Resource
private JdbcTemplate jdbcTemplate;
/**
* 查询门店
* @param mallId
* @return
*/
public BMall getMallById(Long mallId) {
String sql = "select id,name,parent_id,unid,status,external_id,group_id from b_mall where id = ?;";
List<BMall> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(BMall.class), mallId);
if (list == null || list.size() == 0) {
return null;
}
return list.get(0);
}
/**
* 查询场所下的门店
* @param locationMallId
* @return
*/
public List<Long> getMallByLocationMallId(Long locationMallId) {
String sql = "select id from b_mall where parent_id = ?;";
return jdbcTemplate.queryForList(sql, Long.class, locationMallId);
}
/**
* 查询门店的出入口通道id
* @param storeId
* @return
*/
public List<Long> getStoreInOutChannelIds(Long storeId) {
String sql = "SELECT channel_id FROM r_mall_gate WHERE mall_id = ? and is_mall_gate = 1 and in_out = 1;";
return jdbcTemplate.queryForList(sql, Long.class, storeId);
}
}
\ No newline at end of file \ No newline at end of file
...@@ -59,6 +59,46 @@ public class FaceRecognitionDao { ...@@ -59,6 +59,46 @@ public class FaceRecognitionDao {
return namedParameterJdbcTemplate.query(sql, queryMap, new BeanPropertyRowMapper<>(Person.class)); return namedParameterJdbcTemplate.query(sql, queryMap, new BeanPropertyRowMapper<>(Person.class));
} }
/**
* 查询门店数据
* select * from d_face_recognition
* where countdate between :startDate and :endDate and counttime >= :startTime and counttime < :endTime and person_type = 0
*
* and ((mall_id = :mallId and direction in(-1,1) and channel_id IN ( SELECT channel_id FROM r_mall_gate WHERE mall_id = :storeId and is_mall_gate = 1 and in_out = 1))
* or (mall_id = :storeId and direction=6))
*
* order by person_unid asc, counttime asc;
*
* @param mallId
* @param countDate
* @return
*/
public List<Person> queryFaceRecognitionList(Long mallId, Long storeId, Date countDate) {
DateTimeParam dateTimeParam = dateTimeParamService.getDateTimeParam(mallId, countDate);
String sql = "select account_id,mall_id,gate_id,person_unid,direction,track_time,countdate as countDate,person_type,age,gender,channel_id," +
"counttime as countTime from d_face_recognition where mall_id = :mallId and countdate between :startDate and :endDate and counttime >= :startTime and counttime < :endTime and person_type = 0 " +
"and ((mall_id = :mallId and direction in(-1,1) and channel_id IN ( SELECT channel_id FROM r_mall_gate WHERE mall_id = :storeId and is_mall_gate = 1 and in_out = 1)) " +
"or (mall_id = :storeId and direction=6)) " +
"order by person_unid asc, counttime asc;";
String sqlNoMultipleDay = "select account_id,mall_id,gate_id,person_unid,direction,track_time,countdate as countDate,person_type,age,gender,channel_id," +
"counttime as countTime from d_face_recognition where mall_id = :mallId and countdate = :startDate and counttime >= :startTime and counttime < :endTime and person_type = 0 " +
"and ((mall_id = :mallId and direction in(-1,1) and channel_id IN ( SELECT channel_id FROM r_mall_gate WHERE mall_id = :storeId and is_mall_gate = 1 and in_out = 1)) " +
"or (mall_id = :storeId and direction=6)) " +
"order by person_unid asc, counttime asc;";
Map<String, Object> queryMap = new HashMap<>();
queryMap.put("mallId", mallId);
queryMap.put("storeId", storeId);
queryMap.put("startDate", dateTimeParam.getStartDate());
queryMap.put("endDate", dateTimeParam.getEndDate());
queryMap.put("startTime", dateTimeParam.getStartDateTime());
queryMap.put("endTime", dateTimeParam.getEndDateTime());
if (DateUtil.isSameDay(dateTimeParam.getStartDate(), dateTimeParam.getEndDate())) {
return namedParameterJdbcTemplate.query(sqlNoMultipleDay, queryMap, new BeanPropertyRowMapper<>(Person.class));
}
return namedParameterJdbcTemplate.query(sql, queryMap, new BeanPropertyRowMapper<>(Person.class));
}
public List<Person> queryFaceRecognitionList(Long mallId, Date countDate) { public List<Person> queryFaceRecognitionList(Long mallId, Date countDate) {
DateTimeParam dateTimeParam = dateTimeParamService.getDateTimeParam(mallId, countDate); DateTimeParam dateTimeParam = dateTimeParamService.getDateTimeParam(mallId, countDate);
String sql = "select account_id,mall_id,gate_id,person_unid,direction,track_time,countdate as countDate,person_type,age,gender," + String sql = "select account_id,mall_id,gate_id,person_unid,direction,track_time,countdate as countDate,person_type,age,gender," +
......
package com.viontech.keliu.entity;
import lombok.Data;
/**
* @author: msl
* Date: 2025/10/28
*/
@Data
public class BMall {
private Long id;
private String name;
private Integer status;
private Long groupId;
private String externalId;
private String unid;
private Long parentId;
}
\ No newline at end of file \ No newline at end of file
...@@ -25,5 +25,6 @@ public class Person { ...@@ -25,5 +25,6 @@ public class Person {
private Integer age; private Integer age;
private Integer gender; private Integer gender;
private Integer trackTime; private Integer trackTime;
private Long channelId;
} }
\ No newline at end of file \ No newline at end of file
...@@ -15,4 +15,12 @@ import java.util.List; ...@@ -15,4 +15,12 @@ import java.util.List;
public interface PersonRecordService { public interface PersonRecordService {
void handlePersonRecord(Long mallId, Date countDate); void handlePersonRecord(Long mallId, Date countDate);
/**
*
* @param mallId 场所id
* @param storeId 门店id
* @param countDate 统计日期
*/
void handlePersonRecord(Long mallId, Long storeId, Date countDate);
} }
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!