企业信息统计 根据企业类型统计企业数据接口返回格式调整
This commit is contained in:
parent
895f2851ba
commit
11a80dd985
|
@ -103,8 +103,8 @@ public class EnterpriseInformationController {
|
|||
}
|
||||
@GetMapping("/statisticByEnterpriseType")
|
||||
@Operation(summary = "根据企业类型统计企业数据")
|
||||
public CommonResult<Map<Integer,Long>> statisticByEnterpriseType(){
|
||||
Map<Integer, Long> integerLongMap = enterpriseInformationService.statisticByEnterpriseType();
|
||||
public CommonResult<List<StatisticsResultData>> statisticByEnterpriseType(){
|
||||
List<StatisticsResultData> integerLongMap = enterpriseInformationService.statisticByEnterpriseType();
|
||||
return success(integerLongMap);
|
||||
}
|
||||
@GetMapping("/selectEnterpriseByYear")
|
||||
|
|
|
@ -83,7 +83,7 @@ public interface EnterpriseInformationService {
|
|||
* 根据企业类型统计企业数据
|
||||
* @return
|
||||
*/
|
||||
Map<Integer,Long> statisticByEnterpriseType();
|
||||
List<StatisticsResultData> statisticByEnterpriseType();
|
||||
|
||||
/**
|
||||
* 查询平台企业年度注册数
|
||||
|
|
|
@ -243,10 +243,28 @@ public class EnterpriseInformationServiceImpl implements EnterpriseInformationSe
|
|||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Map<Integer, Long> statisticByEnterpriseType() {
|
||||
public List<StatisticsResultData> statisticByEnterpriseType() {
|
||||
List<EnterpriseInformationDO> enterpriseInformationDOS = enterpriseInformationMapper.selectList();
|
||||
Map<Integer, Long> enterpriseTypeCounts = enterpriseInformationDOS.stream().collect(Collectors.groupingBy(EnterpriseInformationDO::getEnterpriseType, Collectors.counting()));
|
||||
return enterpriseTypeCounts;
|
||||
Map<Integer, Long> enterpriseTypeCounts = enterpriseInformationDOS.stream()
|
||||
.collect(Collectors.groupingBy(EnterpriseInformationDO::getEnterpriseType, Collectors.counting()));
|
||||
List<StatisticsResultData> list = new ArrayList<>();
|
||||
|
||||
StatisticsResultData greatEnterprise = new StatisticsResultData();
|
||||
greatEnterprise.setName("analysis.greatEnterprise");
|
||||
greatEnterprise.setValue(enterpriseTypeCounts.get(3));//大型企业
|
||||
|
||||
StatisticsResultData centreEnterprise = new StatisticsResultData();
|
||||
centreEnterprise.setName("analysis.centreEnterprise");
|
||||
centreEnterprise.setValue(enterpriseTypeCounts.get(2));//中型企业
|
||||
|
||||
StatisticsResultData smallEnterprise = new StatisticsResultData();
|
||||
smallEnterprise.setName("analysis.smallEnterprise");
|
||||
smallEnterprise.setValue(enterpriseTypeCounts.get(1));//小型企业
|
||||
|
||||
list.add(greatEnterprise);
|
||||
list.add(centreEnterprise);
|
||||
list.add(smallEnterprise);
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue