|
@ -242,34 +242,41 @@ public class GrassRootsGovernServiceImpl implements GrassRootsGovernService { |
|
|
@Override |
|
|
@Override |
|
|
public List<GovernCapacityRankResultDTO> governCapacityRank(AgencyAndNumFormDTO param) { |
|
|
public List<GovernCapacityRankResultDTO> governCapacityRank(AgencyAndNumFormDTO param) { |
|
|
List<GovernCapacityResultDTO> orderList = new ArrayList<>(); |
|
|
List<GovernCapacityResultDTO> orderList = new ArrayList<>(); |
|
|
if(null == param.getTopNum()) param.setTopNum(NumConstant.FIVE); |
|
|
if(null == param.getTopNum()) { |
|
|
if(NumConstant.ZERO == param.getTopNum()) param.setTopNum(NumConstant.MAX); |
|
|
param.setTopNum(NumConstant.FIVE); |
|
|
|
|
|
} |
|
|
|
|
|
if(NumConstant.ZERO == param.getTopNum()) { |
|
|
|
|
|
param.setTopNum(NumConstant.MAX); |
|
|
|
|
|
} |
|
|
PageHelper.startPage(NumConstant.ONE,param.getTopNum()); |
|
|
PageHelper.startPage(NumConstant.ONE,param.getTopNum()); |
|
|
String monthId = dateUtils.getCurrentMonthId(); |
|
|
String dateId = com.epmet.commons.tools.utils.DateUtils.getBeforeNDay(NumConstant.ONE); |
|
|
|
|
|
|
|
|
if (StringUtils.isNotEmpty(param.getAreaCode())){ |
|
|
if (StringUtils.isNotEmpty(param.getAreaCode())){ |
|
|
List<String> nextAgencyIds = screenCustomerAgencyService.getNextAgencyIds(param.getAreaCode(), param.getAgencyId()); |
|
|
List<String> nextAgencyIds = screenCustomerAgencyService.getNextAgencyIds(param.getAreaCode(), param.getAgencyId()); |
|
|
if (CollectionUtils.isEmpty(nextAgencyIds)){ |
|
|
if (CollectionUtils.isEmpty(nextAgencyIds)){ |
|
|
return new ArrayList<>(); |
|
|
return new ArrayList<>(); |
|
|
} |
|
|
} |
|
|
orderList = screenGovernRankDataDao.selectGovernCapacityRatioNew(monthId,nextAgencyIds); |
|
|
orderList = screenGovernRankDataDao.selectGovernCapacityRatioNew(dateId,nextAgencyIds); |
|
|
int time = NumConstant.TWELVE; |
|
|
int time = NumConstant.ONE; |
|
|
while(CollectionUtils.isEmpty(orderList) && time > NumConstant.ONE){ |
|
|
while(CollectionUtils.isEmpty(orderList) && time < NumConstant.TEN){ |
|
|
time--; |
|
|
time++; |
|
|
monthId = dateUtils.getPreviousMonthIdByDest(null ,monthId); |
|
|
dateId = com.epmet.commons.tools.utils.DateUtils.getBeforeNDay(time); |
|
|
PageHelper.startPage(NumConstant.ONE,param.getTopNum()); |
|
|
PageHelper.startPage(NumConstant.ONE,param.getTopNum()); |
|
|
orderList = screenGovernRankDataDao.selectGovernCapacityRatioNew(monthId,nextAgencyIds); |
|
|
orderList = screenGovernRankDataDao.selectGovernCapacityRatioNew(dateId,nextAgencyIds); |
|
|
} |
|
|
} |
|
|
}else { |
|
|
}else { |
|
|
orderList = screenGovernRankDataDao.selectGovernCapacityRatio(monthId, param.getAgencyId()); |
|
|
orderList = screenGovernRankDataDao.selectGovernCapacityRatio(dateId, param.getAgencyId()); |
|
|
int time = NumConstant.TWELVE; |
|
|
int time = NumConstant.ONE; |
|
|
while (CollectionUtils.isEmpty(orderList) && time > NumConstant.ONE) { |
|
|
while (CollectionUtils.isEmpty(orderList) && time < NumConstant.TEN) { |
|
|
time--; |
|
|
time++; |
|
|
monthId = dateUtils.getPreviousMonthIdByDest(null, monthId); |
|
|
dateId = com.epmet.commons.tools.utils.DateUtils.getBeforeNDay(time); |
|
|
PageHelper.startPage(NumConstant.ONE, param.getTopNum()); |
|
|
PageHelper.startPage(NumConstant.ONE, param.getTopNum()); |
|
|
orderList = screenGovernRankDataDao.selectGovernCapacityRatio(monthId, param.getAgencyId()); |
|
|
orderList = screenGovernRankDataDao.selectGovernCapacityRatio(dateId, param.getAgencyId()); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
if(null == orderList || orderList.isEmpty()) return new ArrayList<>(); |
|
|
if(null == orderList || orderList.isEmpty()) { |
|
|
|
|
|
return new ArrayList<>(); |
|
|
|
|
|
} |
|
|
List<GovernCapacityRankResultDTO> result = new LinkedList<>(); |
|
|
List<GovernCapacityRankResultDTO> result = new LinkedList<>(); |
|
|
orderList.forEach(o -> { |
|
|
orderList.forEach(o -> { |
|
|
GovernCapacityRankResultDTO rank = new GovernCapacityRankResultDTO(); |
|
|
GovernCapacityRankResultDTO rank = new GovernCapacityRankResultDTO(); |
|
|