|
|
@ -1,15 +1,25 @@ |
|
|
|
package com.epmet.datareport.service.screen.impl; |
|
|
|
|
|
|
|
import com.epmet.commons.extappauth.bean.ExternalAppRequestParam; |
|
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
|
import com.epmet.datareport.dao.screen.ScreenIndexDataMonthlyDao; |
|
|
|
import com.epmet.datareport.dao.screen.ScreenIndexDataYearlyDao; |
|
|
|
import com.epmet.datareport.service.screen.IndexService; |
|
|
|
import com.epmet.screen.dto.form.MonthBarchartFormDTO; |
|
|
|
import com.epmet.screen.dto.form.MonthPieChartFormDTO; |
|
|
|
import com.epmet.screen.dto.form.SubAgencyIndexRankFormDTO; |
|
|
|
import com.epmet.screen.dto.form.YearAverageIndexFormDTO; |
|
|
|
import com.epmet.screen.dto.result.MonthPieChartResultDTO; |
|
|
|
import com.epmet.screen.dto.result.YearAverageIndexResultDTO; |
|
|
|
import com.epmet.screen.dto.result.*; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
import java.time.LocalDate; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.Comparator; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
/** |
|
|
|
* 指数相关相关各指标查询 |
|
|
|
* |
|
|
@ -23,6 +33,8 @@ public class IndexServiceImpl implements IndexService { |
|
|
|
private ScreenIndexDataYearlyDao screenIndexDataYearlyDao; |
|
|
|
@Autowired |
|
|
|
private ScreenIndexDataMonthlyDao screenIndexDataMonthlyDao; |
|
|
|
@Autowired |
|
|
|
private GrassrootsPartyDevServiceImpl grassrootsPartyDevServiceImpl; |
|
|
|
|
|
|
|
/** |
|
|
|
* @Description 1、年度平均指数 |
|
|
@ -53,4 +65,68 @@ public class IndexServiceImpl implements IndexService { |
|
|
|
} |
|
|
|
return monthPieChartResultDTO; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Description 3、月度指数分析-柱状图 |
|
|
|
* @param monthBarchartFormDTO |
|
|
|
* @author zxc |
|
|
|
* @date 2020/8/19 5:27 下午 |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public MonthBarchartResultDTO monthBarchart(MonthBarchartFormDTO monthBarchartFormDTO, ExternalAppRequestParam externalAppRequestParam) { |
|
|
|
String customerId = externalAppRequestParam.getCustomerId(); |
|
|
|
MonthBarchartResultDTO result = new MonthBarchartResultDTO(); |
|
|
|
List<Double> serviceAbilityData = new ArrayList<>(); |
|
|
|
List<Double> partyDevAbilityData = new ArrayList<>(); |
|
|
|
List<Double> governAbilityData = new ArrayList<>(); |
|
|
|
List<Double> totalIndexData = new ArrayList<>(); |
|
|
|
// 1. x轴
|
|
|
|
Map<String, String> x = grassrootsPartyDevServiceImpl.getX(); |
|
|
|
result.setXAxis(x.values().stream().collect(Collectors.toList())); |
|
|
|
// 2. 查询近一年的指数值【不包括本月】
|
|
|
|
List<MonthBarchartResult> monthBarchartResults = screenIndexDataMonthlyDao.selectMonthBarchart(customerId, monthBarchartFormDTO.getAgencyId()); |
|
|
|
if (monthBarchartResults.size() == NumConstant.ZERO){ |
|
|
|
for (int i = NumConstant.ZERO; i <= NumConstant.TWELVE; i++) { |
|
|
|
serviceAbilityData.add(NumConstant.ZERO_DOT_ZERO); |
|
|
|
partyDevAbilityData.add(NumConstant.ZERO_DOT_ZERO); |
|
|
|
governAbilityData.add(NumConstant.ZERO_DOT_ZERO); |
|
|
|
totalIndexData.add(NumConstant.ZERO_DOT_ZERO); |
|
|
|
} |
|
|
|
result.setServiceAbilityData(serviceAbilityData); |
|
|
|
result.setPartyDevAbilityData(partyDevAbilityData); |
|
|
|
result.setGovernAbilityData(governAbilityData); |
|
|
|
result.setTotalIndexData(totalIndexData); |
|
|
|
return result; |
|
|
|
} |
|
|
|
List<MonthBarchartResult> collect = monthBarchartResults.stream().sorted(Comparator.comparing(MonthBarchartResult::getMonthId)).collect(Collectors.toList()); |
|
|
|
collect.forEach(month -> { |
|
|
|
serviceAbilityData.add(null == month.getServiceAbility() ? NumConstant.ZERO_DOT_ZERO : month.getServiceAbility()); |
|
|
|
partyDevAbilityData.add(null == month.getPartyDevAbility() ? NumConstant.ZERO_DOT_ZERO : month.getPartyDevAbility()); |
|
|
|
governAbilityData.add(null == month.getGovernAbility() ? NumConstant.ZERO_DOT_ZERO : month.getGovernAbility()); |
|
|
|
totalIndexData.add(null == month.getIndexTotal() ? NumConstant.ZERO_DOT_ZERO : month.getIndexTotal()); |
|
|
|
}); |
|
|
|
result.setServiceAbilityData(serviceAbilityData); |
|
|
|
result.setPartyDevAbilityData(partyDevAbilityData); |
|
|
|
result.setGovernAbilityData(governAbilityData); |
|
|
|
result.setTotalIndexData(totalIndexData); |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Description 4、下级部门指数排行 |
|
|
|
* @param subAgencyIndexRankFormDTO |
|
|
|
* @author zxc |
|
|
|
* @date 2020/8/20 10:04 上午 |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public List<SubAgencyIndexRankResultDTO> subAgencyIndexRank(SubAgencyIndexRankFormDTO subAgencyIndexRankFormDTO) { |
|
|
|
LocalDate now = LocalDate.now().minusMonths(NumConstant.ONE); |
|
|
|
String monthId = now.toString().substring(NumConstant.ZERO,NumConstant.FOUR).concat(now.toString().substring(NumConstant.FIVE,NumConstant.SEVEN)); |
|
|
|
subAgencyIndexRankFormDTO.setMonthId(monthId); |
|
|
|
List<SubAgencyIndexRankResultDTO> subAgencyIndexRankResultDTOS = screenIndexDataMonthlyDao.selectSubAgencyIndexRank(subAgencyIndexRankFormDTO); |
|
|
|
if (subAgencyIndexRankResultDTOS.size() == NumConstant.ZERO){ |
|
|
|
return new ArrayList<>(); |
|
|
|
} |
|
|
|
return subAgencyIndexRankResultDTOS; |
|
|
|
} |
|
|
|
} |
|
|
|