|
@@ -3,6 +3,7 @@ package com.ytpm.arithmetic.controller;
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
|
+import com.github.pagehelper.PageHelper;
|
|
|
import com.github.pagehelper.PageInfo;
|
|
import com.github.pagehelper.PageInfo;
|
|
|
import com.ytpm.advertise.enums.AdSourceTypeEnum;
|
|
import com.ytpm.advertise.enums.AdSourceTypeEnum;
|
|
|
import com.ytpm.agent.enums.UserStatusEnum;
|
|
import com.ytpm.agent.enums.UserStatusEnum;
|
|
@@ -87,35 +88,9 @@ public class UserController {
|
|
|
@PostMapping("/queryAll")
|
|
@PostMapping("/queryAll")
|
|
|
public ResultTable<YtAppUserListView> queryAll(@RequestBody YtAppUserListParam param) {
|
|
public ResultTable<YtAppUserListView> queryAll(@RequestBody YtAppUserListParam param) {
|
|
|
//查询主应用
|
|
//查询主应用
|
|
|
- List<YtAppUserListView> resultList = new ArrayList<>();
|
|
|
|
|
- List<YtAppUserListView> dyzUserList = appUserMapper.queryAll(param);
|
|
|
|
|
- if (CollUtil.isNotEmpty(dyzUserList)) {
|
|
|
|
|
- resultList.addAll(dyzUserList);
|
|
|
|
|
- }
|
|
|
|
|
- int total = resultList.size()/param.getLimit();
|
|
|
|
|
- long a = resultList.size() % param.getLimit();
|
|
|
|
|
- if(resultList.size() % param.getLimit() != 0){
|
|
|
|
|
- total++;
|
|
|
|
|
- }
|
|
|
|
|
- int totalSize = resultList.size();
|
|
|
|
|
- //判断最后一页时返回剩余数据
|
|
|
|
|
- List<YtAppUserListView> result;
|
|
|
|
|
- if(param.getPage().compareTo(total)>=0){
|
|
|
|
|
- int skip = (param.getPage() - 1) *param.getLimit();
|
|
|
|
|
- result = resultList.stream().skip(skip).limit(a).collect(Collectors.toList());
|
|
|
|
|
- }else {
|
|
|
|
|
- if(param.getPage()>1){
|
|
|
|
|
- int skip = (param.getPage() - 1) *param.getLimit();
|
|
|
|
|
- result = resultList.stream().skip(skip).limit(param.getLimit()).collect(Collectors.toList());
|
|
|
|
|
- }else{
|
|
|
|
|
- result = resultList.stream().limit(param.getLimit()).collect(Collectors.toList());
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
- dyzUserList.clear();
|
|
|
|
|
- resultList.clear();
|
|
|
|
|
|
|
+ PageHelper.startPage(param.getPage(), param.getLimit());
|
|
|
|
|
+ List<YtAppUserListView> result = appUserMapper.queryAll(param);
|
|
|
String collect = result.stream().map(YtAppUserListView::getUserId).collect(Collectors.joining(","));
|
|
String collect = result.stream().map(YtAppUserListView::getUserId).collect(Collectors.joining(","));
|
|
|
-
|
|
|
|
|
List<YtDyzAdRecord> adRecords = adRecordMapper.getByUserIds(collect);
|
|
List<YtDyzAdRecord> adRecords = adRecordMapper.getByUserIds(collect);
|
|
|
List<YtDyzLoginRecord> dyzLogins = loginRecordMapper.getLoginRecordByIds(collect);
|
|
List<YtDyzLoginRecord> dyzLogins = loginRecordMapper.getLoginRecordByIds(collect);
|
|
|
Map<String, List<YtDyzAdRecord>> userAdMap = adRecords.stream().collect(
|
|
Map<String, List<YtDyzAdRecord>> userAdMap = adRecords.stream().collect(
|
|
@@ -123,7 +98,7 @@ public class UserController {
|
|
|
Map<String, List<YtDyzLoginRecord>> loginMap = dyzLogins.stream().collect(
|
|
Map<String, List<YtDyzLoginRecord>> loginMap = dyzLogins.stream().collect(
|
|
|
Collectors.groupingBy(YtDyzLoginRecord::getUserId));
|
|
Collectors.groupingBy(YtDyzLoginRecord::getUserId));
|
|
|
setUserExtInfo(result,userAdMap,loginMap);
|
|
setUserExtInfo(result,userAdMap,loginMap);
|
|
|
- return ResultTable.resultTableOk(result , (long) totalSize,param.getLimit(),param.getPage(),total);
|
|
|
|
|
|
|
+ return ResultTable.resultTableOk(new PageInfo<>(result));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|