|
@@ -1,6 +1,11 @@
|
|
|
package com.enteprise.industry_oveview.service.impl;
|
|
|
|
|
|
import java.util.List;
|
|
|
+import java.util.stream.Collectors;
|
|
|
+
|
|
|
+import com.enteprise.enterprise.domain.Enterprise;
|
|
|
+import com.enteprise.enterprise.mapper.EnterpriseMapper;
|
|
|
+import com.enteprise.industry_oveview.domain.IndustryCount;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import com.enteprise.industry_oveview.mapper.IndustryOverviewMapper;
|
|
@@ -19,6 +24,9 @@ public class IndustryOverviewServiceImpl implements IIndustryOverviewService
|
|
|
@Autowired
|
|
|
private IndustryOverviewMapper industryOverviewMapper;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private EnterpriseMapper enterpriseMapper;
|
|
|
+
|
|
|
/**
|
|
|
* 查询industry_oveview
|
|
|
*
|
|
@@ -40,7 +48,29 @@ public class IndustryOverviewServiceImpl implements IIndustryOverviewService
|
|
|
@Override
|
|
|
public List<IndustryOverview> selectIndustryOverviewList(IndustryOverview industryOverview)
|
|
|
{
|
|
|
- return industryOverviewMapper.selectIndustryOverviewList(industryOverview);
|
|
|
+ List<IndustryOverview> list;
|
|
|
+ if (industryOverview.getYear() == 0){
|
|
|
+ //求总和
|
|
|
+ list = industryOverviewMapper.countAllIndustryOverview().stream().limit(1).collect(Collectors.toList());
|
|
|
+ }else {
|
|
|
+ //求某年
|
|
|
+ list = industryOverviewMapper.selectIndustryOverviewList(industryOverview);
|
|
|
+ }
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<IndustryCount> selectIndustryCountList() {
|
|
|
+ List<IndustryCount> collect = industryOverviewMapper.selectIndustryCount().stream().limit(10).collect(Collectors.toList());
|
|
|
+ IndustryCount industryCount = new IndustryCount();
|
|
|
+ //计算企业剩余数
|
|
|
+ industryCount.setCode("others");
|
|
|
+ industryCount.setIndustryName("其他");
|
|
|
+ List<Enterprise> enterprises = enterpriseMapper.selectEnterpriseList(new Enterprise());
|
|
|
+ int i = enterprises.size() + 1 - collect.stream().mapToInt(IndustryCount::getNumber).sum();
|
|
|
+ industryCount.setNumber(i);
|
|
|
+ collect.add(industryCount);
|
|
|
+ return collect;
|
|
|
}
|
|
|
|
|
|
/**
|