Compare commits
51
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1771bf9909 | ||
|
|
15d69f9361 | ||
|
|
2b4089ef59 | ||
|
|
20c3e1f422 | ||
|
|
3b19d9e930 | ||
|
|
5fd11e9caf | ||
|
|
0b98dcdfe9 | ||
|
|
b373cbbe46 | ||
|
|
acd97c7b9b | ||
|
|
118bdb1666 | ||
|
|
944de228f7 | ||
|
|
25c9cd4dfc | ||
|
|
882cd226ec | ||
|
|
feb4d7af66 | ||
|
|
d75ab1ed5f | ||
|
|
a501eb7443 | ||
|
|
19941d9480 | ||
|
|
cd3d522d4f | ||
|
|
181c5078e9 | ||
|
|
e97f46e6b4 | ||
|
|
c0f89deb83 | ||
|
|
ce695463d3 | ||
|
|
83c683d473 | ||
|
|
9555474b0b | ||
|
|
a150f9e017 | ||
|
|
ecd2fa1c33 | ||
|
|
e3236d262d | ||
|
|
c8e2e16ba5 | ||
|
|
99b44faf09 | ||
|
|
b3e3cbf84b | ||
|
|
0aee11d824 | ||
|
|
fcf358a768 | ||
|
|
619369104c | ||
|
|
4f1408b9d0 | ||
|
|
029eea70cc | ||
|
|
22b1e65385 | ||
|
|
2170c48763 | ||
|
|
c2d1c48aae | ||
|
|
e14958c643 | ||
|
|
da288338cd | ||
|
|
ea430f2468 | ||
|
|
f76f79744a | ||
|
|
19daaff907 | ||
|
|
db94d8f932 | ||
|
|
53618fe362 | ||
|
|
523edffc4e | ||
|
|
c7ddb1a8b0 | ||
|
|
45c9fc814a | ||
|
|
407dc13ac4 | ||
|
|
0c06bf16c2 | ||
|
|
1db39e77d3 |
@@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
<groupId>com.imyeyu.timiserverapi</groupId>
|
<groupId>com.imyeyu.timiserverapi</groupId>
|
||||||
<artifactId>TimiServerAPI</artifactId>
|
<artifactId>TimiServerAPI</artifactId>
|
||||||
<version>1.0.41</version>
|
<version>1.0.40</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<name>TimiServerAPI</name>
|
<name>TimiServerAPI</name>
|
||||||
<description>imyeyu.com API</description>
|
<description>imyeyu.com API</description>
|
||||||
@@ -215,11 +215,6 @@
|
|||||||
<artifactId>tinypinyin</artifactId>
|
<artifactId>tinypinyin</artifactId>
|
||||||
<version>2.0.3</version>
|
<version>2.0.3</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>com.hankcs</groupId>
|
|
||||||
<artifactId>hanlp</artifactId>
|
|
||||||
<version>portable-1.8.4</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.imyeyu.font.icon</groupId>
|
<groupId>com.imyeyu.font.icon</groupId>
|
||||||
<artifactId>timi-icon-font</artifactId>
|
<artifactId>timi-icon-font</artifactId>
|
||||||
|
|||||||
@@ -5,8 +5,6 @@ import com.imyeyu.api.modules.gao.bean.GaoPermissionCode;
|
|||||||
import com.imyeyu.api.modules.gao.service.GaoCustomerChartService;
|
import com.imyeyu.api.modules.gao.service.GaoCustomerChartService;
|
||||||
import com.imyeyu.api.modules.gao.service.GaoStoreScopeService;
|
import com.imyeyu.api.modules.gao.service.GaoStoreScopeService;
|
||||||
import com.imyeyu.api.modules.gao.vo.GaoCustomerChartReq;
|
import com.imyeyu.api.modules.gao.vo.GaoCustomerChartReq;
|
||||||
import com.imyeyu.api.modules.gao.vo.GaoCustomerDiseaseWordReq;
|
|
||||||
import com.imyeyu.api.modules.gao.vo.GaoCustomerDiseaseWordView;
|
|
||||||
import com.imyeyu.api.modules.gao.vo.GaoEventRecordCalendarView;
|
import com.imyeyu.api.modules.gao.vo.GaoEventRecordCalendarView;
|
||||||
import com.imyeyu.api.modules.gao.vo.GaoEventRecordDailyStatView;
|
import com.imyeyu.api.modules.gao.vo.GaoEventRecordDailyStatView;
|
||||||
import com.imyeyu.java.bean.timi.TimiException;
|
import com.imyeyu.java.bean.timi.TimiException;
|
||||||
@@ -53,15 +51,4 @@ public class GaoCustomerChartController {
|
|||||||
req.setStoreId(storeScopeService.resolveStoreId(req.getStoreId()));
|
req.setStoreId(storeScopeService.resolveStoreId(req.getStoreId()));
|
||||||
return service.eventRecordCalendar(req);
|
return service.eventRecordCalendar(req);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 查询客户病症词频
|
|
||||||
@AOPLog
|
|
||||||
@RequestRateLimit
|
|
||||||
@RequireGaoPermission(GaoPermissionCode.STAT_READ)
|
|
||||||
@PostMapping("/customer/disease/word")
|
|
||||||
public List<GaoCustomerDiseaseWordView> customerDiseaseWord(@RequestBody GaoCustomerDiseaseWordReq req) {
|
|
||||||
TimiException.required(req, "not found req");
|
|
||||||
req.setStoreId(storeScopeService.resolveStoreId(req.getStoreId()));
|
|
||||||
return service.customerDiseaseWord(req);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import com.imyeyu.api.modules.gao.annotation.RequireGaoPermission;
|
|||||||
import com.imyeyu.api.modules.gao.bean.GaoPermissionCode;
|
import com.imyeyu.api.modules.gao.bean.GaoPermissionCode;
|
||||||
import com.imyeyu.api.modules.gao.service.GaoStoreChartService;
|
import com.imyeyu.api.modules.gao.service.GaoStoreChartService;
|
||||||
import com.imyeyu.api.modules.gao.service.GaoStoreScopeService;
|
import com.imyeyu.api.modules.gao.service.GaoStoreScopeService;
|
||||||
import com.imyeyu.api.modules.gao.vo.GaoCustomerAgeStatView;
|
|
||||||
import com.imyeyu.api.modules.gao.vo.GaoCustomerDailyStateView;
|
import com.imyeyu.api.modules.gao.vo.GaoCustomerDailyStateView;
|
||||||
import com.imyeyu.api.modules.gao.vo.GaoCustomerGenderStatView;
|
import com.imyeyu.api.modules.gao.vo.GaoCustomerGenderStatView;
|
||||||
import com.imyeyu.api.modules.gao.vo.GaoEventRecordCalendarView;
|
import com.imyeyu.api.modules.gao.vo.GaoEventRecordCalendarView;
|
||||||
@@ -55,15 +54,6 @@ public class GaoStoreChartController {
|
|||||||
return service.customerGender(storeScopeService.resolveStoreId(storeId));
|
return service.customerGender(storeScopeService.resolveStoreId(storeId));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 查询客户年龄分布
|
|
||||||
@AOPLog
|
|
||||||
@RequestRateLimit
|
|
||||||
@RequireGaoPermission(GaoPermissionCode.STAT_READ)
|
|
||||||
@PostMapping("/customer/age")
|
|
||||||
public List<GaoCustomerAgeStatView> customerAge(@RequestParam String storeId) {
|
|
||||||
return service.customerAge(storeScopeService.resolveStoreId(storeId));
|
|
||||||
}
|
|
||||||
|
|
||||||
/// 查询登记事件每日统计,可同时支撑登记趋势和事件结构图表
|
/// 查询登记事件每日统计,可同时支撑登记趋势和事件结构图表
|
||||||
@AOPLog
|
@AOPLog
|
||||||
@RequestRateLimit
|
@RequestRateLimit
|
||||||
|
|||||||
@@ -1,10 +1,7 @@
|
|||||||
package com.imyeyu.api.modules.gao.mapper;
|
package com.imyeyu.api.modules.gao.mapper;
|
||||||
|
|
||||||
import com.imyeyu.api.modules.gao.entity.GaoCustomer;
|
import com.imyeyu.api.modules.gao.entity.GaoCustomer;
|
||||||
import com.imyeyu.api.modules.gao.vo.GaoCustomerAgeStatView;
|
|
||||||
import com.imyeyu.api.modules.gao.vo.GaoCustomerDailyStateView;
|
import com.imyeyu.api.modules.gao.vo.GaoCustomerDailyStateView;
|
||||||
import com.imyeyu.api.modules.gao.vo.GaoCustomerDailyStateCustomerView;
|
|
||||||
import com.imyeyu.api.modules.gao.vo.GaoCustomerDiseaseTextView;
|
|
||||||
import com.imyeyu.api.modules.gao.vo.GaoCustomerGenderStatView;
|
import com.imyeyu.api.modules.gao.vo.GaoCustomerGenderStatView;
|
||||||
import com.imyeyu.api.modules.gao.vo.GaoCustomerPage;
|
import com.imyeyu.api.modules.gao.vo.GaoCustomerPage;
|
||||||
import com.imyeyu.spring.mapper.BaseMapper;
|
import com.imyeyu.spring.mapper.BaseMapper;
|
||||||
@@ -30,14 +27,6 @@ public interface GaoCustomerMapper extends BaseMapper<GaoCustomer, String> {
|
|||||||
/// @return 每日新增客户数
|
/// @return 每日新增客户数
|
||||||
List<GaoCustomerDailyStateView> stateDailyNewCustomer(@Param("storeId") String storeId, @Param("beginCreatedAt") Long beginCreatedAt, @Param("endCreatedAt") Long endCreatedAt);
|
List<GaoCustomerDailyStateView> stateDailyNewCustomer(@Param("storeId") String storeId, @Param("beginCreatedAt") Long beginCreatedAt, @Param("endCreatedAt") Long endCreatedAt);
|
||||||
|
|
||||||
/// 查询每日新增客户摘要
|
|
||||||
///
|
|
||||||
/// @param storeId 门店 ID
|
|
||||||
/// @param beginCreatedAt 开始创建时间
|
|
||||||
/// @param endCreatedAt 结束创建时间
|
|
||||||
/// @return 每日新增客户摘要
|
|
||||||
List<GaoCustomerDailyStateCustomerView> selectDailyNewCustomer(@Param("storeId") String storeId, @Param("beginCreatedAt") Long beginCreatedAt, @Param("endCreatedAt") Long endCreatedAt);
|
|
||||||
|
|
||||||
/// 统计开始时间前客户总数
|
/// 统计开始时间前客户总数
|
||||||
///
|
///
|
||||||
/// @param beginCreatedAt 开始创建时间
|
/// @param beginCreatedAt 开始创建时间
|
||||||
@@ -49,18 +38,6 @@ public interface GaoCustomerMapper extends BaseMapper<GaoCustomer, String> {
|
|||||||
/// @return 性别统计列表
|
/// @return 性别统计列表
|
||||||
List<GaoCustomerGenderStatView> stateGender(@Param("storeId") String storeId);
|
List<GaoCustomerGenderStatView> stateGender(@Param("storeId") String storeId);
|
||||||
|
|
||||||
/// 统计客户年龄分布
|
|
||||||
///
|
|
||||||
/// @param storeId 门店 ID
|
|
||||||
/// @return 客户年龄列表
|
|
||||||
List<GaoCustomerAgeStatView> stateAge(@Param("storeId") String storeId);
|
|
||||||
|
|
||||||
/// 查询客户病症原始文本
|
|
||||||
///
|
|
||||||
/// @param storeId 门店 ID
|
|
||||||
/// @return 客户备注和病症
|
|
||||||
List<GaoCustomerDiseaseTextView> selectDiseaseTextByStoreId(@Param("storeId") String storeId);
|
|
||||||
|
|
||||||
/// 查询客户总数
|
/// 查询客户总数
|
||||||
///
|
///
|
||||||
/// @param page 查询条件
|
/// @param page 查询条件
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
package com.imyeyu.api.modules.gao.service;
|
package com.imyeyu.api.modules.gao.service;
|
||||||
|
|
||||||
import com.imyeyu.api.modules.gao.vo.GaoCustomerChartReq;
|
import com.imyeyu.api.modules.gao.vo.GaoCustomerChartReq;
|
||||||
import com.imyeyu.api.modules.gao.vo.GaoCustomerDiseaseWordReq;
|
|
||||||
import com.imyeyu.api.modules.gao.vo.GaoCustomerDiseaseWordView;
|
|
||||||
import com.imyeyu.api.modules.gao.vo.GaoEventRecordCalendarView;
|
import com.imyeyu.api.modules.gao.vo.GaoEventRecordCalendarView;
|
||||||
import com.imyeyu.api.modules.gao.vo.GaoEventRecordDailyStatView;
|
import com.imyeyu.api.modules.gao.vo.GaoEventRecordDailyStatView;
|
||||||
|
|
||||||
@@ -19,7 +17,4 @@ public interface GaoCustomerChartService {
|
|||||||
|
|
||||||
/// 查询客户登记日历记录
|
/// 查询客户登记日历记录
|
||||||
List<GaoEventRecordCalendarView> eventRecordCalendar(GaoCustomerChartReq req);
|
List<GaoEventRecordCalendarView> eventRecordCalendar(GaoCustomerChartReq req);
|
||||||
|
|
||||||
/// 查询客户病症词频
|
|
||||||
List<GaoCustomerDiseaseWordView> customerDiseaseWord(GaoCustomerDiseaseWordReq req);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package com.imyeyu.api.modules.gao.service;
|
package com.imyeyu.api.modules.gao.service;
|
||||||
|
|
||||||
import com.imyeyu.api.modules.gao.entity.GaoCustomer;
|
import com.imyeyu.api.modules.gao.entity.GaoCustomer;
|
||||||
import com.imyeyu.api.modules.gao.vo.GaoCustomerAgeStatView;
|
|
||||||
import com.imyeyu.api.modules.gao.vo.GaoCustomerDailyStateView;
|
import com.imyeyu.api.modules.gao.vo.GaoCustomerDailyStateView;
|
||||||
import com.imyeyu.api.modules.gao.vo.GaoCustomerGenderStatView;
|
import com.imyeyu.api.modules.gao.vo.GaoCustomerGenderStatView;
|
||||||
import com.imyeyu.api.modules.gao.vo.GaoCustomerPage;
|
import com.imyeyu.api.modules.gao.vo.GaoCustomerPage;
|
||||||
@@ -88,10 +87,4 @@ public interface GaoCustomerService extends BaseService<GaoCustomer, String> {
|
|||||||
/// @param storeId 门店 ID
|
/// @param storeId 门店 ID
|
||||||
/// @return 性别统计列表
|
/// @return 性别统计列表
|
||||||
List<GaoCustomerGenderStatView> stateGender(String storeId);
|
List<GaoCustomerGenderStatView> stateGender(String storeId);
|
||||||
|
|
||||||
/// 统计客户年龄分布
|
|
||||||
///
|
|
||||||
/// @param storeId 门店 ID
|
|
||||||
/// @return 客户年龄列表
|
|
||||||
List<GaoCustomerAgeStatView> stateAge(String storeId);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package com.imyeyu.api.modules.gao.service;
|
package com.imyeyu.api.modules.gao.service;
|
||||||
|
|
||||||
import com.imyeyu.api.modules.gao.vo.GaoCustomerDailyStateView;
|
import com.imyeyu.api.modules.gao.vo.GaoCustomerDailyStateView;
|
||||||
import com.imyeyu.api.modules.gao.vo.GaoCustomerAgeStatView;
|
|
||||||
import com.imyeyu.api.modules.gao.vo.GaoCustomerGenderStatView;
|
import com.imyeyu.api.modules.gao.vo.GaoCustomerGenderStatView;
|
||||||
import com.imyeyu.api.modules.gao.vo.GaoEventRecordCalendarView;
|
import com.imyeyu.api.modules.gao.vo.GaoEventRecordCalendarView;
|
||||||
import com.imyeyu.api.modules.gao.vo.GaoEventRecordDailyStatView;
|
import com.imyeyu.api.modules.gao.vo.GaoEventRecordDailyStatView;
|
||||||
@@ -22,9 +21,6 @@ public interface GaoStoreChartService {
|
|||||||
/// 查询客户性别统计
|
/// 查询客户性别统计
|
||||||
List<GaoCustomerGenderStatView> customerGender(String storeId);
|
List<GaoCustomerGenderStatView> customerGender(String storeId);
|
||||||
|
|
||||||
/// 查询客户年龄分布
|
|
||||||
List<GaoCustomerAgeStatView> customerAge(String storeId);
|
|
||||||
|
|
||||||
/// 查询登记事件每日统计
|
/// 查询登记事件每日统计
|
||||||
List<GaoEventRecordDailyStatView> eventRecordDailyStat(GaoStoreChartReq req);
|
List<GaoEventRecordDailyStatView> eventRecordDailyStat(GaoStoreChartReq req);
|
||||||
|
|
||||||
|
|||||||
-45
@@ -1,23 +1,15 @@
|
|||||||
package com.imyeyu.api.modules.gao.service.implement;
|
package com.imyeyu.api.modules.gao.service.implement;
|
||||||
|
|
||||||
import com.hankcs.hanlp.seg.common.Term;
|
|
||||||
import com.hankcs.hanlp.tokenizer.StandardTokenizer;
|
|
||||||
import com.imyeyu.api.modules.gao.mapper.GaoCustomerMapper;
|
|
||||||
import com.imyeyu.api.modules.gao.service.GaoCustomerChartService;
|
import com.imyeyu.api.modules.gao.service.GaoCustomerChartService;
|
||||||
import com.imyeyu.api.modules.gao.service.GaoEventRecordService;
|
import com.imyeyu.api.modules.gao.service.GaoEventRecordService;
|
||||||
import com.imyeyu.api.modules.gao.vo.GaoCustomerChartReq;
|
import com.imyeyu.api.modules.gao.vo.GaoCustomerChartReq;
|
||||||
import com.imyeyu.api.modules.gao.vo.GaoCustomerDiseaseTextView;
|
|
||||||
import com.imyeyu.api.modules.gao.vo.GaoCustomerDiseaseWordReq;
|
|
||||||
import com.imyeyu.api.modules.gao.vo.GaoCustomerDiseaseWordView;
|
|
||||||
import com.imyeyu.api.modules.gao.vo.GaoEventRecordCalendarView;
|
import com.imyeyu.api.modules.gao.vo.GaoEventRecordCalendarView;
|
||||||
import com.imyeyu.api.modules.gao.vo.GaoEventRecordDailyStatView;
|
import com.imyeyu.api.modules.gao.vo.GaoEventRecordDailyStatView;
|
||||||
import com.imyeyu.java.bean.timi.TimiException;
|
import com.imyeyu.java.bean.timi.TimiException;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/// 客户报表服务实现
|
/// 客户报表服务实现
|
||||||
///
|
///
|
||||||
@@ -28,7 +20,6 @@ import java.util.Map;
|
|||||||
public class GaoCustomerChartServiceImplement implements GaoCustomerChartService {
|
public class GaoCustomerChartServiceImplement implements GaoCustomerChartService {
|
||||||
|
|
||||||
private final GaoEventRecordService eventRecordService;
|
private final GaoEventRecordService eventRecordService;
|
||||||
private final GaoCustomerMapper customerMapper;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<GaoEventRecordDailyStatView> eventRecordDailyStat(GaoCustomerChartReq req) {
|
public List<GaoEventRecordDailyStatView> eventRecordDailyStat(GaoCustomerChartReq req) {
|
||||||
@@ -42,42 +33,6 @@ public class GaoCustomerChartServiceImplement implements GaoCustomerChartService
|
|||||||
return eventRecordService.calendarByCustomerRange(req);
|
return eventRecordService.calendarByCustomerRange(req);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<GaoCustomerDiseaseWordView> customerDiseaseWord(GaoCustomerDiseaseWordReq req) {
|
|
||||||
TimiException.required(req, "not found req");
|
|
||||||
TimiException.required(req.getStoreId(), "not found req.storeId");
|
|
||||||
|
|
||||||
int topN = normalizeTopN(req.getTopN());
|
|
||||||
Map<String, Long> wordCountMap = new HashMap<>();
|
|
||||||
for (GaoCustomerDiseaseTextView customer : customerMapper.selectDiseaseTextByStoreId(req.getStoreId())) {
|
|
||||||
countNounWord(customer.getDisease(), wordCountMap);
|
|
||||||
countNounWord(customer.getRemark(), wordCountMap);
|
|
||||||
}
|
|
||||||
return wordCountMap.entrySet().stream()
|
|
||||||
.sorted(Map.Entry.<String, Long>comparingByValue().reversed().thenComparing(Map.Entry.comparingByKey()))
|
|
||||||
.limit(topN)
|
|
||||||
.map(item -> new GaoCustomerDiseaseWordView(item.getKey(), item.getValue()))
|
|
||||||
.toList();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void countNounWord(String text, Map<String, Long> wordCountMap) {
|
|
||||||
if (text == null || text.isBlank()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
for (Term term : StandardTokenizer.segment(text)) {
|
|
||||||
if (term.nature != null && term.nature.toString().startsWith("n")) {
|
|
||||||
wordCountMap.merge(term.word, 1L, Long::sum);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private int normalizeTopN(Integer topN) {
|
|
||||||
if (topN == null) {
|
|
||||||
return 60;
|
|
||||||
}
|
|
||||||
return Math.clamp(topN, 1, 100);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void checkRangeReq(GaoCustomerChartReq req) {
|
private void checkRangeReq(GaoCustomerChartReq req) {
|
||||||
TimiException.required(req, "not found req");
|
TimiException.required(req, "not found req");
|
||||||
TimiException.required(req.getStoreId(), "not found req.storeId");
|
TimiException.required(req.getStoreId(), "not found req.storeId");
|
||||||
|
|||||||
-13
@@ -14,9 +14,7 @@ import com.imyeyu.api.modules.gao.service.GaoCustomerService;
|
|||||||
import com.imyeyu.api.modules.gao.service.GaoEventRecordService;
|
import com.imyeyu.api.modules.gao.service.GaoEventRecordService;
|
||||||
import com.imyeyu.api.modules.gao.service.GaoPointAccountService;
|
import com.imyeyu.api.modules.gao.service.GaoPointAccountService;
|
||||||
import com.imyeyu.api.modules.gao.util.CustomerXSSFBuilder;
|
import com.imyeyu.api.modules.gao.util.CustomerXSSFBuilder;
|
||||||
import com.imyeyu.api.modules.gao.vo.GaoCustomerAgeStatView;
|
|
||||||
import com.imyeyu.api.modules.gao.vo.GaoCustomerDailyStateView;
|
import com.imyeyu.api.modules.gao.vo.GaoCustomerDailyStateView;
|
||||||
import com.imyeyu.api.modules.gao.vo.GaoCustomerDailyStateCustomerView;
|
|
||||||
import com.imyeyu.api.modules.gao.vo.GaoCustomerGenderStatView;
|
import com.imyeyu.api.modules.gao.vo.GaoCustomerGenderStatView;
|
||||||
import com.imyeyu.api.modules.gao.vo.GaoCustomerPage;
|
import com.imyeyu.api.modules.gao.vo.GaoCustomerPage;
|
||||||
import com.imyeyu.api.modules.gao.vo.GaoCustomerTrendStateReq;
|
import com.imyeyu.api.modules.gao.vo.GaoCustomerTrendStateReq;
|
||||||
@@ -412,10 +410,6 @@ public class GaoCustomerServiceImplement extends AbstractEntityService<GaoCustom
|
|||||||
for (GaoCustomerDailyStateView view : mapper.stateDailyNewCustomer(req.getStoreId(), beginCreatedAt, endCreatedAt)) {
|
for (GaoCustomerDailyStateView view : mapper.stateDailyNewCustomer(req.getStoreId(), beginCreatedAt, endCreatedAt)) {
|
||||||
newCustomerCountMap.put(view.getDateValue(), TimiJava.defaultIfNull(view.getNewCustomerCount(), 0L));
|
newCustomerCountMap.put(view.getDateValue(), TimiJava.defaultIfNull(view.getNewCustomerCount(), 0L));
|
||||||
}
|
}
|
||||||
Map<Integer, List<GaoCustomerDailyStateCustomerView>> customerListMap = new HashMap<>();
|
|
||||||
for (GaoCustomerDailyStateCustomerView customer : mapper.selectDailyNewCustomer(req.getStoreId(), beginCreatedAt, endCreatedAt)) {
|
|
||||||
customerListMap.computeIfAbsent(customer.getDateValue(), key -> new ArrayList<>()).add(customer);
|
|
||||||
}
|
|
||||||
long totalCustomerCount = TimiJava.defaultIfNull(mapper.countCreatedBefore(req.getStoreId(), beginCreatedAt), 0L);
|
long totalCustomerCount = TimiJava.defaultIfNull(mapper.countCreatedBefore(req.getStoreId(), beginCreatedAt), 0L);
|
||||||
List<GaoCustomerDailyStateView> list = new ArrayList<>();
|
List<GaoCustomerDailyStateView> list = new ArrayList<>();
|
||||||
for (LocalDate date = beginDate; !date.isAfter(endDate); date = date.plusDays(1)) {
|
for (LocalDate date = beginDate; !date.isAfter(endDate); date = date.plusDays(1)) {
|
||||||
@@ -426,7 +420,6 @@ public class GaoCustomerServiceImplement extends AbstractEntityService<GaoCustom
|
|||||||
view.setDateValue(dateValue);
|
view.setDateValue(dateValue);
|
||||||
view.setNewCustomerCount(newCustomerCount);
|
view.setNewCustomerCount(newCustomerCount);
|
||||||
view.setTotalCustomerCount(totalCustomerCount);
|
view.setTotalCustomerCount(totalCustomerCount);
|
||||||
view.setCustomerList(customerListMap.getOrDefault(dateValue, List.of()));
|
|
||||||
list.add(view);
|
list.add(view);
|
||||||
}
|
}
|
||||||
return list;
|
return list;
|
||||||
@@ -438,12 +431,6 @@ public class GaoCustomerServiceImplement extends AbstractEntityService<GaoCustom
|
|||||||
return mapper.stateGender(storeId);
|
return mapper.stateGender(storeId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<GaoCustomerAgeStatView> stateAge(String storeId) {
|
|
||||||
TimiException.required(storeId, "not found storeId");
|
|
||||||
return mapper.stateAge(storeId);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void changeInvitedCount(String customerId, long delta) {
|
private void changeInvitedCount(String customerId, long delta) {
|
||||||
if (TimiJava.isEmpty(customerId) || delta == 0) {
|
if (TimiJava.isEmpty(customerId) || delta == 0) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
-7
@@ -3,7 +3,6 @@ package com.imyeyu.api.modules.gao.service.implement;
|
|||||||
import com.imyeyu.api.modules.gao.service.GaoCustomerService;
|
import com.imyeyu.api.modules.gao.service.GaoCustomerService;
|
||||||
import com.imyeyu.api.modules.gao.service.GaoEventRecordService;
|
import com.imyeyu.api.modules.gao.service.GaoEventRecordService;
|
||||||
import com.imyeyu.api.modules.gao.service.GaoStoreChartService;
|
import com.imyeyu.api.modules.gao.service.GaoStoreChartService;
|
||||||
import com.imyeyu.api.modules.gao.vo.GaoCustomerAgeStatView;
|
|
||||||
import com.imyeyu.api.modules.gao.vo.GaoCustomerDailyStateView;
|
import com.imyeyu.api.modules.gao.vo.GaoCustomerDailyStateView;
|
||||||
import com.imyeyu.api.modules.gao.vo.GaoCustomerGenderStatView;
|
import com.imyeyu.api.modules.gao.vo.GaoCustomerGenderStatView;
|
||||||
import com.imyeyu.api.modules.gao.vo.GaoCustomerTrendStateReq;
|
import com.imyeyu.api.modules.gao.vo.GaoCustomerTrendStateReq;
|
||||||
@@ -44,12 +43,6 @@ public class GaoStoreChartServiceImplement implements GaoStoreChartService {
|
|||||||
return customerService.stateGender(storeId);
|
return customerService.stateGender(storeId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<GaoCustomerAgeStatView> customerAge(String storeId) {
|
|
||||||
TimiException.required(storeId, "not found storeId");
|
|
||||||
return customerService.stateAge(storeId);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<GaoEventRecordDailyStatView> eventRecordDailyStat(GaoStoreChartReq req) {
|
public List<GaoEventRecordDailyStatView> eventRecordDailyStat(GaoStoreChartReq req) {
|
||||||
checkRangeReq(req);
|
checkRangeReq(req);
|
||||||
|
|||||||
@@ -1,18 +0,0 @@
|
|||||||
package com.imyeyu.api.modules.gao.vo;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
///
|
|
||||||
/// 客户年龄统计视图
|
|
||||||
///
|
|
||||||
/// @author Codex
|
|
||||||
/// @since 2026-09-11
|
|
||||||
@Data
|
|
||||||
public class GaoCustomerAgeStatView {
|
|
||||||
|
|
||||||
/// 客户年龄
|
|
||||||
private Long age;
|
|
||||||
|
|
||||||
/// 该年龄的客户数量
|
|
||||||
private Long count;
|
|
||||||
}
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
package com.imyeyu.api.modules.gao.vo;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
///
|
|
||||||
/// 客户每日统计中的客户摘要
|
|
||||||
///
|
|
||||||
/// @author Codex
|
|
||||||
/// @since 2026-09-11
|
|
||||||
@Data
|
|
||||||
public class GaoCustomerDailyStateCustomerView {
|
|
||||||
|
|
||||||
/// 用于服务层按日期分组,不返回给前端
|
|
||||||
@JsonIgnore
|
|
||||||
private Integer dateValue;
|
|
||||||
|
|
||||||
/// 客户姓名
|
|
||||||
private String name;
|
|
||||||
}
|
|
||||||
@@ -2,8 +2,6 @@ package com.imyeyu.api.modules.gao.vo;
|
|||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// 客户每日统计视图
|
/// 客户每日统计视图
|
||||||
///
|
///
|
||||||
@@ -20,7 +18,4 @@ public class GaoCustomerDailyStateView {
|
|||||||
|
|
||||||
/// 截止当日客户总数
|
/// 截止当日客户总数
|
||||||
private Long totalCustomerCount;
|
private Long totalCustomerCount;
|
||||||
|
|
||||||
/// 当日新增客户列表
|
|
||||||
private List<GaoCustomerDailyStateCustomerView> customerList;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,19 +0,0 @@
|
|||||||
package com.imyeyu.api.modules.gao.vo;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
/// 客户病症原始文本
|
|
||||||
///
|
|
||||||
/// 只用于后端分词,不对外返回。
|
|
||||||
///
|
|
||||||
/// @author Codex
|
|
||||||
/// @since 2026-09-11
|
|
||||||
@Data
|
|
||||||
public class GaoCustomerDiseaseTextView {
|
|
||||||
|
|
||||||
/// 备注
|
|
||||||
private String remark;
|
|
||||||
|
|
||||||
/// 病症
|
|
||||||
private String disease;
|
|
||||||
}
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
package com.imyeyu.api.modules.gao.vo;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
/// 客户病症词频查询请求
|
|
||||||
///
|
|
||||||
/// @author Codex
|
|
||||||
/// @since 2026-09-11
|
|
||||||
@Data
|
|
||||||
public class GaoCustomerDiseaseWordReq {
|
|
||||||
|
|
||||||
/// 门店 ID
|
|
||||||
private String storeId;
|
|
||||||
|
|
||||||
/// 返回词语数量
|
|
||||||
private Integer topN;
|
|
||||||
}
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
package com.imyeyu.api.modules.gao.vo;
|
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
/// 客户病症词频
|
|
||||||
///
|
|
||||||
/// @author Codex
|
|
||||||
/// @since 2026-09-11
|
|
||||||
@Data
|
|
||||||
@AllArgsConstructor
|
|
||||||
public class GaoCustomerDiseaseWordView {
|
|
||||||
|
|
||||||
/// 词语
|
|
||||||
private String word;
|
|
||||||
|
|
||||||
/// 词语出现次数
|
|
||||||
private Long value;
|
|
||||||
}
|
|
||||||
@@ -23,10 +23,4 @@ public class GaoCustomerPage extends Page<GaoCustomer> {
|
|||||||
|
|
||||||
/// 标签 ID 列表,客户必须同时拥有列表内全部标签
|
/// 标签 ID 列表,客户必须同时拥有列表内全部标签
|
||||||
private List<String> tagIdList;
|
private List<String> tagIdList;
|
||||||
|
|
||||||
/// 录入时间起始,包含,Unix 毫秒时间戳
|
|
||||||
private Long beginCreatedAt;
|
|
||||||
|
|
||||||
/// 录入时间结束,包含,Unix 毫秒时间戳
|
|
||||||
private Long endCreatedAt;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,12 +49,6 @@
|
|||||||
HAVING COUNT(DISTINCT `ta`.`tag_id`) = #{tagCount}
|
HAVING COUNT(DISTINCT `ta`.`tag_id`) = #{tagCount}
|
||||||
)
|
)
|
||||||
</if>
|
</if>
|
||||||
<if test="beginCreatedAt != null">
|
|
||||||
AND `c`.`created_at` >= #{beginCreatedAt}
|
|
||||||
</if>
|
|
||||||
<if test="endCreatedAt != null">
|
|
||||||
AND `c`.`created_at` <= #{endCreatedAt}
|
|
||||||
</if>
|
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="countByQuery" resultType="long">
|
<select id="countByQuery" resultType="long">
|
||||||
@@ -98,19 +92,6 @@
|
|||||||
ORDER BY `dateValue` ASC
|
ORDER BY `dateValue` ASC
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectDailyNewCustomer" resultType="com.imyeyu.api.modules.gao.vo.GaoCustomerDailyStateCustomerView">
|
|
||||||
SELECT
|
|
||||||
`name`,
|
|
||||||
CAST(DATE_FORMAT(FROM_UNIXTIME(`created_at` / 1000), '%Y%m%d') AS UNSIGNED) AS `dateValue`
|
|
||||||
FROM `gao_customer`
|
|
||||||
WHERE
|
|
||||||
`store_id` = #{storeId}
|
|
||||||
AND `created_at` >= #{beginCreatedAt}
|
|
||||||
AND `created_at` <= #{endCreatedAt}
|
|
||||||
AND `deleted_at` IS NULL
|
|
||||||
ORDER BY `dateValue` ASC, `created_at` ASC, `id` ASC
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<select id="countCreatedBefore" resultType="java.lang.Long">
|
<select id="countCreatedBefore" resultType="java.lang.Long">
|
||||||
SELECT
|
SELECT
|
||||||
COUNT(1)
|
COUNT(1)
|
||||||
@@ -131,31 +112,4 @@
|
|||||||
AND `deleted_at` IS NULL
|
AND `deleted_at` IS NULL
|
||||||
GROUP BY IFNULL(CAST(`gender` AS CHAR), 'UNKNOWN')
|
GROUP BY IFNULL(CAST(`gender` AS CHAR), 'UNKNOWN')
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="stateAge" resultType="com.imyeyu.api.modules.gao.vo.GaoCustomerAgeStatView">
|
|
||||||
SELECT
|
|
||||||
COALESCE(`age`, TIMESTAMPDIFF(YEAR, `birthdate`, CURDATE())) AS `age`,
|
|
||||||
COUNT(1) AS `count`
|
|
||||||
FROM `gao_customer`
|
|
||||||
WHERE
|
|
||||||
`store_id` = #{storeId}
|
|
||||||
AND `deleted_at` IS NULL
|
|
||||||
AND (`age` IS NOT NULL OR `birthdate` IS NOT NULL)
|
|
||||||
GROUP BY COALESCE(`age`, TIMESTAMPDIFF(YEAR, `birthdate`, CURDATE()))
|
|
||||||
ORDER BY COALESCE(`age`, TIMESTAMPDIFF(YEAR, `birthdate`, CURDATE())) ASC
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<select id="selectDiseaseTextByStoreId" resultType="com.imyeyu.api.modules.gao.vo.GaoCustomerDiseaseTextView">
|
|
||||||
SELECT
|
|
||||||
`remark`,
|
|
||||||
`disease`
|
|
||||||
FROM `gao_customer`
|
|
||||||
WHERE
|
|
||||||
`store_id` = #{storeId}
|
|
||||||
AND `deleted_at` IS NULL
|
|
||||||
AND (
|
|
||||||
(`remark` IS NOT NULL AND `remark` != '')
|
|
||||||
OR (`disease` IS NOT NULL AND `disease` != '')
|
|
||||||
)
|
|
||||||
</select>
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
Reference in New Issue
Block a user