add customerCount for list event record
This commit is contained in:
@@ -69,6 +69,7 @@ public class GaoEventRecordController {
|
||||
result.setTotal(pageResult.getTotal());
|
||||
result.setList(pageResult.getList());
|
||||
result.setNumberValueTotal(resolveNumberValueTotal(page));
|
||||
result.setCustomerCount(service.countCustomerByRange(page));
|
||||
{
|
||||
List<String> customerIdList = result.getList().stream().map(GaoEventRecord::getCustomerId).toList();
|
||||
Map<String, GaoEvent> eventMap = eventService.mapByIdList(result.getList().stream().map(GaoEventRecord::getEventId).toList());
|
||||
|
||||
@@ -87,6 +87,12 @@ public interface GaoEventRecordMapper extends BaseMapper<GaoEventRecord, String>
|
||||
/// @return 登记事件记录列表
|
||||
List<GaoEventRecord> selectByRange(GaoEventRecordPage page);
|
||||
|
||||
/// 按登记记录列表条件统计去重客户数量
|
||||
///
|
||||
/// @param page 登记记录范围查询请求
|
||||
/// @return 去重后的客户数量
|
||||
long countCustomerByRange(GaoEventRecordPage page);
|
||||
|
||||
/// 按登记记录列表条件汇总数值
|
||||
///
|
||||
/// @param page 登记记录范围查询请求
|
||||
|
||||
@@ -117,6 +117,12 @@ public interface GaoEventRecordService extends BaseService<GaoEventRecord, Strin
|
||||
/// @return 登记事件记录列表
|
||||
PageResult<GaoEventRecord> pageByRange(GaoEventRecordPage req);
|
||||
|
||||
/// 按登记记录列表条件统计去重客户数量
|
||||
///
|
||||
/// @param req 登记记录范围查询请求
|
||||
/// @return 去重后的客户数量
|
||||
long countCustomerByRange(GaoEventRecordPage req);
|
||||
|
||||
/// 按时间范围统计门店登记数
|
||||
///
|
||||
/// @param req 门店报表查询请求
|
||||
|
||||
+6
@@ -467,6 +467,12 @@ public class GaoEventRecordServiceImplement extends AbstractEntityService<GaoEve
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long countCustomerByRange(GaoEventRecordPage page) {
|
||||
TimiException.required(page.getStoreId(), "not found page.storeId");
|
||||
return mapper.countCustomerByRange(page);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<GaoEventRecordDailyStatView> stateDailyByRange(GaoStoreChartReq req) {
|
||||
return mapper.stateDailyByRange(req);
|
||||
|
||||
@@ -19,4 +19,8 @@ public class GaoEventRecordPageResult extends PageResult<GaoEventRecord> {
|
||||
/// 指定单个数值事件的登记数值合计,未指定单个 NUMBER 事件时为空
|
||||
@JsonView(ResponseView.Public.class)
|
||||
private Long numberValueTotal;
|
||||
|
||||
/// 查询条件下去重后的客户数量
|
||||
@JsonView(ResponseView.Public.class)
|
||||
private Long customerCount;
|
||||
}
|
||||
|
||||
@@ -167,6 +167,13 @@
|
||||
ORDER BY r.`registered_at` DESC, r.`created_at` DESC
|
||||
LIMIT #{offset}, #{limit}
|
||||
</select>
|
||||
<select id="countCustomerByRange" resultType="long">
|
||||
SELECT
|
||||
COUNT(DISTINCT r.`customer_id`)
|
||||
<include refid="rangeFrom"/>
|
||||
WHERE
|
||||
<include refid="rangeWhere"/>
|
||||
</select>
|
||||
<select id="sumNumberValueByRange" resultType="java.lang.Long">
|
||||
SELECT
|
||||
COALESCE(SUM(r.`number_value`), 0)
|
||||
|
||||
Reference in New Issue
Block a user