v1.0.14 #21
@@ -16,6 +16,7 @@ import com.imyeyu.api.modules.gao.service.GaoEventService;
|
|||||||
import com.imyeyu.api.modules.gao.service.GaoStoreService;
|
import com.imyeyu.api.modules.gao.service.GaoStoreService;
|
||||||
import com.imyeyu.api.modules.gao.vo.GaoCustomerEventRankView;
|
import com.imyeyu.api.modules.gao.vo.GaoCustomerEventRankView;
|
||||||
import com.imyeyu.api.modules.gao.vo.GaoEventRecordPage;
|
import com.imyeyu.api.modules.gao.vo.GaoEventRecordPage;
|
||||||
|
import com.imyeyu.api.modules.gao.vo.GaoEventRecordPageResult;
|
||||||
import com.imyeyu.api.modules.gao.vo.GaoEventRecordRankPage;
|
import com.imyeyu.api.modules.gao.vo.GaoEventRecordRankPage;
|
||||||
import com.imyeyu.api.modules.user.service.RoleChecker;
|
import com.imyeyu.api.modules.user.service.RoleChecker;
|
||||||
import com.imyeyu.api.modules.user.service.UserLoginService;
|
import com.imyeyu.api.modules.user.service.UserLoginService;
|
||||||
@@ -64,8 +65,12 @@ public class GaoEventRecordController {
|
|||||||
@RequireGaoPermission(GaoPermissionCode.EVENT_RECORD_READ)
|
@RequireGaoPermission(GaoPermissionCode.EVENT_RECORD_READ)
|
||||||
@PostMapping("/list")
|
@PostMapping("/list")
|
||||||
@JsonView(ResponseView.Public.class)
|
@JsonView(ResponseView.Public.class)
|
||||||
public PageResult<GaoEventRecord> list(@RequestBody GaoEventRecordPage page) {
|
public GaoEventRecordPageResult list(@RequestBody GaoEventRecordPage page) {
|
||||||
PageResult<GaoEventRecord> result = service.pageByRange(page);
|
PageResult<GaoEventRecord> pageResult = service.pageByRange(page);
|
||||||
|
GaoEventRecordPageResult result = new GaoEventRecordPageResult();
|
||||||
|
result.setTotal(pageResult.getTotal());
|
||||||
|
result.setList(pageResult.getList());
|
||||||
|
result.setNumberValueTotal(resolveNumberValueTotal(page));
|
||||||
{
|
{
|
||||||
List<String> customerIdList = result.getList().stream().map(GaoEventRecord::getCustomerId).toList();
|
List<String> customerIdList = result.getList().stream().map(GaoEventRecord::getCustomerId).toList();
|
||||||
Map<String, GaoEvent> eventMap = eventService.mapByIdList(result.getList().stream().map(GaoEventRecord::getEventId).toList());
|
Map<String, GaoEvent> eventMap = eventService.mapByIdList(result.getList().stream().map(GaoEventRecord::getEventId).toList());
|
||||||
@@ -80,6 +85,22 @@ public class GaoEventRecordController {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// 根据列表筛选条件返回单个 NUMBER 事件的数值合计
|
||||||
|
///
|
||||||
|
/// @param page 登记记录范围查询请求
|
||||||
|
/// @return 数值合计,不满足单个 NUMBER 事件条件时为空
|
||||||
|
private Long resolveNumberValueTotal(GaoEventRecordPage page) {
|
||||||
|
List<String> eventIdList = page.getEventIdList();
|
||||||
|
if (eventIdList == null || eventIdList.size() != 1) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
GaoEvent event = eventService.mapByIdList(eventIdList).get(eventIdList.get(0));
|
||||||
|
if (event == null || event.getValueType() != GaoEvent.ValueType.NUMBER) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return service.sumNumberValueByRange(page);
|
||||||
|
}
|
||||||
|
|
||||||
@AOPLog
|
@AOPLog
|
||||||
@RequestRateLimit
|
@RequestRateLimit
|
||||||
@RequireGaoPermission(GaoPermissionCode.EVENT_RECORD_READ)
|
@RequireGaoPermission(GaoPermissionCode.EVENT_RECORD_READ)
|
||||||
|
|||||||
@@ -64,6 +64,12 @@ public interface GaoEventRecordMapper extends BaseMapper<GaoEventRecord, String>
|
|||||||
/// @return 登记事件记录列表
|
/// @return 登记事件记录列表
|
||||||
List<GaoEventRecord> selectByRange(GaoEventRecordPage page);
|
List<GaoEventRecord> selectByRange(GaoEventRecordPage page);
|
||||||
|
|
||||||
|
/// 按登记记录列表条件汇总数值
|
||||||
|
///
|
||||||
|
/// @param page 登记记录范围查询请求
|
||||||
|
/// @return 登记数值合计
|
||||||
|
Long sumNumberValueByRange(GaoEventRecordPage page);
|
||||||
|
|
||||||
/// 统计客户登记排行榜总数
|
/// 统计客户登记排行榜总数
|
||||||
///
|
///
|
||||||
/// @param page 排行榜分页请求
|
/// @param page 排行榜分页请求
|
||||||
|
|||||||
@@ -32,6 +32,12 @@ public interface GaoEventRecordService extends BaseService<GaoEventRecord, Strin
|
|||||||
/// @return 登记事件记录列表
|
/// @return 登记事件记录列表
|
||||||
PageResult<GaoEventRecord> pageByRange(GaoEventRecordPage req);
|
PageResult<GaoEventRecord> pageByRange(GaoEventRecordPage req);
|
||||||
|
|
||||||
|
/// 按登记记录列表条件汇总数值
|
||||||
|
///
|
||||||
|
/// @param req 登记记录范围查询请求
|
||||||
|
/// @return 登记数值合计
|
||||||
|
Long sumNumberValueByRange(GaoEventRecordPage req);
|
||||||
|
|
||||||
/// 按时间范围查询客户登记排行榜
|
/// 按时间范围查询客户登记排行榜
|
||||||
///
|
///
|
||||||
/// @param page 范围查询请求,不传时间为全部时间
|
/// @param page 范围查询请求,不传时间为全部时间
|
||||||
|
|||||||
+6
@@ -266,6 +266,12 @@ public class GaoEventRecordServiceImplement extends AbstractEntityService<GaoEve
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long sumNumberValueByRange(GaoEventRecordPage page) {
|
||||||
|
TimiException.required(page.getStoreId(), "not found page.storeId");
|
||||||
|
return mapper.sumNumberValueByRange(page);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public byte[] export(GaoEventRecordPage page) throws IOException {
|
public byte[] export(GaoEventRecordPage page) throws IOException {
|
||||||
TimiException.required(page.getStoreId(), "not found page.storeId");
|
TimiException.required(page.getStoreId(), "not found page.storeId");
|
||||||
|
|||||||
@@ -130,6 +130,14 @@
|
|||||||
ORDER BY r.`registered_at` DESC, r.`created_at` DESC
|
ORDER BY r.`registered_at` DESC, r.`created_at` DESC
|
||||||
LIMIT #{offset}, #{limit}
|
LIMIT #{offset}, #{limit}
|
||||||
</select>
|
</select>
|
||||||
|
<select id="sumNumberValueByRange" resultType="java.lang.Long">
|
||||||
|
SELECT
|
||||||
|
COALESCE(SUM(r.`number_value`), 0)
|
||||||
|
<include refid="rangeFrom"/>
|
||||||
|
WHERE
|
||||||
|
<include refid="rangeWhere"/>
|
||||||
|
AND r.`number_value` IS NOT NULL
|
||||||
|
</select>
|
||||||
|
|
||||||
<sql id="rankWhere">
|
<sql id="rankWhere">
|
||||||
r.`deleted_at` IS NULL
|
r.`deleted_at` IS NULL
|
||||||
|
|||||||
Reference in New Issue
Block a user