Commit 668794c0 by 丁伟峰

分页的当前页:page.getNumber()

1 parent f6acd499
...@@ -86,6 +86,7 @@ public class BusinessBaseServiceImpl implements BusinessBaseService { ...@@ -86,6 +86,7 @@ public class BusinessBaseServiceImpl implements BusinessBaseService {
// 技能组 // 技能组
mapSkillGroup = new HashMap<>(); mapSkillGroup = new HashMap<>();
mapSkillGroup.putAll(skillGroupDao.findAll().stream().collect(Collectors.toMap(SkillGroupEntity::getSkillGroupCode, SkillGroupEntity::getSkillGroup))); mapSkillGroup.putAll(skillGroupDao.findAll().stream().collect(Collectors.toMap(SkillGroupEntity::getSkillGroupCode, SkillGroupEntity::getSkillGroup)));
log.info("initMaps ====> mapLayer ==> {}, mapSkillGroup ==> {}", mapLayer, mapSkillGroup);
} }
String getLayerName(String layerId) { String getLayerName(String layerId) {
...@@ -98,7 +99,6 @@ public class BusinessBaseServiceImpl implements BusinessBaseService { ...@@ -98,7 +99,6 @@ public class BusinessBaseServiceImpl implements BusinessBaseService {
String getSkillGroupName(String skillGroupCode) { String getSkillGroupName(String skillGroupCode) {
if (mapSkillGroup == null) { if (mapSkillGroup == null) {
initMaps(); initMaps();
;
} }
return mapSkillGroup.get(skillGroupCode); return mapSkillGroup.get(skillGroupCode);
} }
......
...@@ -67,7 +67,7 @@ public class EngineerCalendarServiceImpl implements EngineerCalendarService { ...@@ -67,7 +67,7 @@ public class EngineerCalendarServiceImpl implements EngineerCalendarService {
rs.setTotal(page.getTotalElements()); rs.setTotal(page.getTotalElements());
rs.setPages(page.getTotalPages()); rs.setPages(page.getTotalPages());
rs.setPageSize(page.getSize()); rs.setPageSize(page.getSize());
rs.setPageCurrent(page.getNumber()); rs.setPageCurrent(page.getNumber() + 1);
rs.setEngineers(engineers); rs.setEngineers(engineers);
return Result.success(rs); return Result.success(rs);
} }
......
...@@ -36,7 +36,7 @@ public class OrgCapacityServiceImpl implements OrgCapacityService { ...@@ -36,7 +36,7 @@ public class OrgCapacityServiceImpl implements OrgCapacityService {
@Override @Override
public Result<?> getOrgCapacityData(CapacityStatQueryDTO.Request reqDTO) { public Result<?> getOrgCapacityData(CapacityStatQueryDTO.Request reqDTO) {
// 根据大区/分部/分站查询,分别返回分部/分站/工作队的容量 // 根据大区/分部/分站查询,分别返回分部/分站/工作队的容量
Page<?> stats = null; Page<?> page = null;
Pageable pageable = PageRequest.of(reqDTO.getPage() - 1, reqDTO.getSize()); Pageable pageable = PageRequest.of(reqDTO.getPage() - 1, reqDTO.getSize());
Map<String, String> names = null; Map<String, String> names = null;
String levelType = reqDTO.getLevelType(); String levelType = reqDTO.getLevelType();
...@@ -47,27 +47,30 @@ public class OrgCapacityServiceImpl implements OrgCapacityService { ...@@ -47,27 +47,30 @@ public class OrgCapacityServiceImpl implements OrgCapacityService {
; ;
List<String> branchIds = new ArrayList<>(names.keySet()); List<String> branchIds = new ArrayList<>(names.keySet());
log.info("levelType: {} ==> branchIds: {}", levelType, branchIds); log.info("levelType: {} ==> branchIds: {}", levelType, branchIds);
stats = capacityOrgStatDao.findByBranchIdsAndWorkdayBetween(branchIds, reqDTO.getStartDate(), reqDTO.getEndDate(), pageable); page = capacityOrgStatDao.findByBranchIdsAndWorkdayBetween(branchIds, reqDTO.getStartDate(), reqDTO.getEndDate(), pageable);
} else if ("branch".equals(reqDTO.getLevelType())) { } else if ("branch".equals(reqDTO.getLevelType())) {
names = orgGroupDao.findAllByBranchId(levelValue).stream() names = orgGroupDao.findAllByBranchId(levelValue).stream()
.collect(Collectors.toMap(OrgGroupEntity::getGroupId, OrgGroupEntity::getGroupName)); .collect(Collectors.toMap(OrgGroupEntity::getGroupId, OrgGroupEntity::getGroupName));
List<String> groupIds = new ArrayList<>(names.keySet()); List<String> groupIds = new ArrayList<>(names.keySet());
log.info("levelType: {} ==> groupIds: {}", levelType, groupIds); log.info("levelType: {} ==> groupIds: {}", levelType, groupIds);
stats = capacityOrgStatDao.findByGroupIdsAndWorkdayBetween(groupIds, reqDTO.getStartDate(), reqDTO.getEndDate(), pageable); page = capacityOrgStatDao.findByGroupIdsAndWorkdayBetween(groupIds, reqDTO.getStartDate(), reqDTO.getEndDate(), pageable);
} else { } else {
names = orgTeamDao.findAllByGroupId(levelValue).stream() names = orgTeamDao.findAllByGroupId(levelValue).stream()
.collect(Collectors.toMap(OrgTeamEntity::getTeamId, OrgTeamEntity::getTeamName)); .collect(Collectors.toMap(OrgTeamEntity::getTeamId, OrgTeamEntity::getTeamName));
List<String> teamIds = new ArrayList<>(names.keySet()); List<String> teamIds = new ArrayList<>(names.keySet());
log.info("levelType: {} ==> teamIds: {}", levelType, teamIds); log.info("levelType: {} ==> teamIds: {}", levelType, teamIds);
stats = capacityTeamStatDao.findByTeamIdsAndWorkdayBetween(teamIds, reqDTO.getStartDate(), reqDTO.getEndDate(), pageable); page = capacityTeamStatDao.findByTeamIdsAndWorkdayBetween(teamIds, reqDTO.getStartDate(), reqDTO.getEndDate(), pageable);
} }
CapacityStatQueryDTO.Result rs = new CapacityStatQueryDTO.Result(); CapacityStatQueryDTO.Result rs = new CapacityStatQueryDTO.Result();
rs.setLevelType(levelType); rs.setLevelType(levelType);
rs.setTotal(stats.getTotalElements()).setPages(stats.getTotalPages()).setPageSize(pageable.getPageSize()).setPageCurrent(stats.getNumber()); rs.setTotal(page.getTotalElements())
.setPages(page.getTotalPages())
.setPageSize(pageable.getPageSize())
.setPageCurrent(page.getNumber() + 1);
List<CapacityStatQueryDTO.Content> contents = new ArrayList<>(); List<CapacityStatQueryDTO.Content> contents = new ArrayList<>();
for (Object item : stats.getContent()) { for (Object item : page.getContent()) {
CapacityStatQueryDTO.Content content = new CapacityStatQueryDTO.Content(); CapacityStatQueryDTO.Content content = new CapacityStatQueryDTO.Content();
if (item instanceof CapacityOrgStatEntity) { if (item instanceof CapacityOrgStatEntity) {
// cluster/branch查询,都是capacity_org_stat // cluster/branch查询,都是capacity_org_stat
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!