Commit 83049baf authored by suhuiguang's avatar suhuiguang

1.1.统计服务合并,接口api整理

parent 4fe9ccef
......@@ -242,6 +242,9 @@ public class JGDPStatisticsServiceImpl {
public Map<String, Object> getCenterMapCountDataForGlobal(DPFilterParamDto dpFilterParamDto) {
Map<String, Object> result = new HashMap<>();
String orgCode = this.getAndSetOrgCode(dpFilterParamDto.getCityCode());
if (StringUtils.isEmpty(orgCode)) {
return new HashMap<>();
}
// 1.气瓶数量统计
long cylinderNum = this.staticsCenterMapCountDataForCylinder(result, orgCode);
//1.8大类设备数量统计,压力容器里包括气瓶所以需要特殊处理,在统计压力容器时去掉气瓶的数量
......@@ -258,6 +261,9 @@ public class JGDPStatisticsServiceImpl {
private Map<String, Object> getCenterMapOverviewData(DPFilterParamDto dpFilterParamDto) {
Map<String, Object> result = new HashMap<>();
String orgCode = this.getAndSetOrgCode(dpFilterParamDto.getCityCode());
if(StringUtils.isEmpty(orgCode)){
return new HashMap<>();
}
// 0. 气瓶数量统计
long cylinderNum = this.staticsCenterMapCountDataForCylinder(result, orgCode);
// 1. 8大类设备数量统计,压力容器里包括气瓶所以需要特殊处理,在统计压力容器时去掉气瓶的数量
......@@ -859,13 +865,13 @@ public class JGDPStatisticsServiceImpl {
public List<Map<String, Object>> maintenanceCountTopTen(DPFilterParamDto dpFilterParamDto) {
List<RegionModel> regionModels = setRegionIfRootParent(dpFilterParamDto);
List<Integer> regionCodeList = regionModels.stream().map(m -> m.getRegionCode()).collect(Collectors.toList());
Map<Integer,RegionModel> regionMap = regionModels.stream().collect(Collectors.toMap(RegionModel::getRegionCode, Function.identity()));
List<Map<String, Object>> list = dpStatisticsMapper.maintenanceCountTopTen(dpFilterParamDto,regionCodeList);
Map<Integer, RegionModel> regionMap = regionModels.stream().collect(Collectors.toMap(RegionModel::getRegionCode, Function.identity()));
List<Map<String, Object>> list = dpStatisticsMapper.maintenanceCountTopTen(dpFilterParamDto, regionCodeList);
List<Map<String, Object>> resultList = new ArrayList<>();
for (int i = 0; i < list.size(); i++) {
Map<String, Object> result = new HashMap<>();
result.put("key", i);
result.put("city", regionMap.get(Integer.valueOf(list.get(i).get("companyCode")+"")).getRegionName());
result.put("city", regionMap.get(Integer.valueOf(list.get(i).get("companyCode") + "")).getRegionName());
result.put("count", list.get(i).get("count"));
result.put("name", list.get(i).get("companyName"));
resultList.add(result);
......@@ -876,13 +882,13 @@ public class JGDPStatisticsServiceImpl {
public Map<String, Object> maintenanceCount(DPFilterParamDto dpFilterParamDto) {
List<RegionModel> regionModels = setRegionIfRootParent(dpFilterParamDto);
List<Integer> regionCodeList = regionModels.stream().map(m -> m.getRegionCode()).collect(Collectors.toList());
Map<Integer,RegionModel> regionMap = regionModels.stream().collect(Collectors.toMap(RegionModel::getRegionCode, Function.identity()));
List<Map<String, Object>> list = dpStatisticsMapper.maintenanceCount(dpFilterParamDto,regionCodeList);
Map<Integer, RegionModel> regionMap = regionModels.stream().collect(Collectors.toMap(RegionModel::getRegionCode, Function.identity()));
List<Map<String, Object>> list = dpStatisticsMapper.maintenanceCount(dpFilterParamDto, regionCodeList);
Map<String, Object> resultMap = new HashMap<>();
List xList = new ArrayList();
List yList = new ArrayList();
for (int i = 0; i < list.size(); i++) {
xList.add(regionMap.get(Integer.valueOf(list.get(i).get("companyCode")+"")).getRegionName());
xList.add(regionMap.get(Integer.valueOf(list.get(i).get("companyCode") + "")).getRegionName());
yList.add(list.get(i).get("count"));
}
resultMap.put("xdata", xList);
......@@ -913,31 +919,31 @@ public class JGDPStatisticsServiceImpl {
private Map<String, Object> cancelCount(Map<String, Object> resultMap, List<RegionModel> regionModelList) {
Map<String,Integer> countMap = new HashMap<>();
Map<String, Integer> countMap = new HashMap<>();
List<Object> xDataList = new ArrayList<>();
List<Object> yDataList = new ArrayList<>();
List<Integer> regionCodeList = regionModelList.stream().map(m -> m.getRegionCode()).collect(Collectors.toList());
List<Map<String, String>> orgCodeByCompanyCodes = commonMapper.getOrgCodesByCompanyCodes(regionCodeList);
Map<String, String> companyMap = new HashMap<>();
List<String> orgCodes = new ArrayList<>();
orgCodeByCompanyCodes.stream().forEach(t->{
companyMap.put(t.get("companyCode")+"",t.get("orgCode"));
if(StringUtils.isNotBlank(t.get("orgCode"))) {
orgCodeByCompanyCodes.stream().forEach(t -> {
companyMap.put(t.get("companyCode") + "", t.get("orgCode"));
if (StringUtils.isNotBlank(t.get("orgCode"))) {
orgCodes.add(t.get("orgCode"));
}
});
//注销报废
List<Map<String,Object>> cancelCoountList = dpStatisticsMapper.cancelCountByOrgCodes(orgCodes);
countByMap(countMap,cancelCoountList);
List<Map<String, Object>> cancelCoountList = dpStatisticsMapper.cancelCountByOrgCodes(orgCodes);
countByMap(countMap, cancelCoountList);
for(int i = 0; i < regionModelList.size(); i++){
for (int i = 0; i < regionModelList.size(); i++) {
AtomicInteger count = new AtomicInteger();
xDataList.add(regionModelList.get(i).getRegionName());
if(StringUtils.isNotEmpty(companyMap.get(regionModelList.get(i).getRegionCode()+""))){
if (StringUtils.isNotEmpty(companyMap.get(regionModelList.get(i).getRegionCode() + ""))) {
int finalI = i;
countMap.forEach((k, v)->{
if(k.startsWith(companyMap.get(regionModelList.get(finalI).getRegionCode()+""))){
if(null != v){
countMap.forEach((k, v) -> {
if (k.startsWith(companyMap.get(regionModelList.get(finalI).getRegionCode() + ""))) {
if (null != v) {
count.addAndGet(v);
}
}
......@@ -953,31 +959,31 @@ public class JGDPStatisticsServiceImpl {
private Map<String, Object> disableCount(Map<String, Object> resultMap, List<RegionModel> regionModelList) {
Map<String,Integer> countMap = new HashMap<>();
Map<String, Integer> countMap = new HashMap<>();
List<Object> xDataList = new ArrayList<>();
List<Object> yDataList = new ArrayList<>();
List<Integer> regionCodeList = regionModelList.stream().map(m -> m.getRegionCode()).collect(Collectors.toList());
List<Map<String, String>> orgCodeByCompanyCodes = commonMapper.getOrgCodesByCompanyCodes(regionCodeList);
Map<String, String> companyMap = new HashMap<>();
List<String> orgCodes = new ArrayList<>();
orgCodeByCompanyCodes.stream().forEach(t->{
companyMap.put(t.get("companyCode")+"",t.get("orgCode"));
if(StringUtils.isNotBlank(t.get("orgCode"))) {
orgCodeByCompanyCodes.stream().forEach(t -> {
companyMap.put(t.get("companyCode") + "", t.get("orgCode"));
if (StringUtils.isNotBlank(t.get("orgCode"))) {
orgCodes.add(t.get("orgCode"));
}
});
//启用停用
List<Map<String,Object>> disableCountList = dpStatisticsMapper.disableCountByOrgCodes(orgCodes);
countByMap(countMap,disableCountList);
List<Map<String, Object>> disableCountList = dpStatisticsMapper.disableCountByOrgCodes(orgCodes);
countByMap(countMap, disableCountList);
for(int i = 0; i < regionModelList.size(); i++){
for (int i = 0; i < regionModelList.size(); i++) {
AtomicInteger count = new AtomicInteger();
xDataList.add(regionModelList.get(i).getRegionName());
if(StringUtils.isNotEmpty(companyMap.get(regionModelList.get(i).getRegionCode()+""))){
if (StringUtils.isNotEmpty(companyMap.get(regionModelList.get(i).getRegionCode() + ""))) {
int finalI = i;
countMap.forEach((k, v)->{
if(k.startsWith(companyMap.get(regionModelList.get(finalI).getRegionCode()+""))){
if(null != v){
countMap.forEach((k, v) -> {
if (k.startsWith(companyMap.get(regionModelList.get(finalI).getRegionCode() + ""))) {
if (null != v) {
count.addAndGet(v);
}
}
......@@ -993,44 +999,44 @@ public class JGDPStatisticsServiceImpl {
private Map<String, Object> changeCount(Map<String, Object> resultMap, List<RegionModel> regionModelList) {
Map<String,Integer> countMap = new HashMap<>();
Map<String, Integer> countMap = new HashMap<>();
List<Object> xDataList = new ArrayList<>();
List<Object> yDataList = new ArrayList<>();
List<Integer> regionCodeList = regionModelList.stream().map(m -> m.getRegionCode()).collect(Collectors.toList());
List<Map<String, String>> orgCodeByCompanyCodes = commonMapper.getOrgCodesByCompanyCodes(regionCodeList);
Map<String, String> companyMap = new HashMap<>();
List<String> orgCodes = new ArrayList<>();
orgCodeByCompanyCodes.stream().forEach(t->{
companyMap.put(t.get("companyCode")+"",t.get("orgCode"));
if(StringUtils.isNotBlank(t.get("orgCode"))) {
orgCodeByCompanyCodes.stream().forEach(t -> {
companyMap.put(t.get("companyCode") + "", t.get("orgCode"));
if (StringUtils.isNotBlank(t.get("orgCode"))) {
orgCodes.add(t.get("orgCode"));
}
});
//更名变更登记
List<Map<String,Object>> changeNameList = dpStatisticsMapper.changeNameCountByOrgCodes(orgCodes);
countByMap(countMap,changeNameList);
List<Map<String, Object>> changeNameList = dpStatisticsMapper.changeNameCountByOrgCodes(orgCodes);
countByMap(countMap, changeNameList);
//改造变更登记
List<Map<String,Object>> reformList = dpStatisticsMapper.changeReformCountByOrgCodes(orgCodes);
countByMap(countMap,reformList);
List<Map<String, Object>> reformList = dpStatisticsMapper.changeReformCountByOrgCodes(orgCodes);
countByMap(countMap, reformList);
//移装变更登记
List<Map<String,Object>> transferList = dpStatisticsMapper.changeTransferCountByOrgCodes(orgCodes);
countByMap(countMap,transferList);
List<Map<String, Object>> transferList = dpStatisticsMapper.changeTransferCountByOrgCodes(orgCodes);
countByMap(countMap, transferList);
//单位变更登记
List<Map<String,Object>> unitList = dpStatisticsMapper.changeUnitCountByOrgCodes(orgCodes);
countByMap(countMap,unitList);
List<Map<String, Object>> unitList = dpStatisticsMapper.changeUnitCountByOrgCodes(orgCodes);
countByMap(countMap, unitList);
//单位变更登记
List<Map<String,Object>> vehicleList = dpStatisticsMapper.changeVehicleCountByOrgCodes(orgCodes);
countByMap(countMap,vehicleList);
List<Map<String, Object>> vehicleList = dpStatisticsMapper.changeVehicleCountByOrgCodes(orgCodes);
countByMap(countMap, vehicleList);
for(int i = 0; i < regionModelList.size(); i++){
for (int i = 0; i < regionModelList.size(); i++) {
AtomicInteger count = new AtomicInteger();
xDataList.add(regionModelList.get(i).getRegionName());
if(StringUtils.isNotEmpty(companyMap.get(regionModelList.get(i).getRegionCode()+""))){
if (StringUtils.isNotEmpty(companyMap.get(regionModelList.get(i).getRegionCode() + ""))) {
int finalI = i;
countMap.forEach((k, v)->{
if(k.startsWith(companyMap.get(regionModelList.get(finalI).getRegionCode()+""))){
if(null != v){
countMap.forEach((k, v) -> {
if (k.startsWith(companyMap.get(regionModelList.get(finalI).getRegionCode() + ""))) {
if (null != v) {
count.addAndGet(v);
}
}
......@@ -1047,33 +1053,33 @@ public class JGDPStatisticsServiceImpl {
private Map<String, Object> useCount(Map<String, Object> resultMap, List<RegionModel> regionModelList) {
Map<String,Integer> countMap = new HashMap<>();
Map<String, Integer> countMap = new HashMap<>();
List<Object> xDataList = new ArrayList<>();
List<Object> yDataList = new ArrayList<>();
List<Integer> regionCodeList = regionModelList.stream().map(m -> m.getRegionCode()).collect(Collectors.toList());
List<Map<String, String>> orgCodeByCompanyCodes = commonMapper.getOrgCodesByCompanyCodes(regionCodeList);
Map<String, String> companyMap = new HashMap<>();
List<String> orgCodes = new ArrayList<>();
orgCodeByCompanyCodes.stream().forEach(t->{
companyMap.put(t.get("companyCode")+"",t.get("orgCode"));
if(StringUtils.isNotBlank(t.get("orgCode"))) {
orgCodeByCompanyCodes.stream().forEach(t -> {
companyMap.put(t.get("companyCode") + "", t.get("orgCode"));
if (StringUtils.isNotBlank(t.get("orgCode"))) {
orgCodes.add(t.get("orgCode"));
}
});
//使用告知
List<Map<String,Object>> useCountList = dpStatisticsMapper.useCountByOrgCodes(orgCodes);
countByMap(countMap,useCountList);
List<Map<String, Object>> useCountList = dpStatisticsMapper.useCountByOrgCodes(orgCodes);
countByMap(countMap, useCountList);
//车用气瓶使用告知
List<Map<String, Object>> vehicleCountList = dpStatisticsMapper.vehicleCountByOrgCodes(orgCodes);
countByMap(countMap,vehicleCountList);
for(int i = 0; i < regionModelList.size(); i++){
countByMap(countMap, vehicleCountList);
for (int i = 0; i < regionModelList.size(); i++) {
AtomicInteger count = new AtomicInteger();
xDataList.add(regionModelList.get(i).getRegionName());
if(StringUtils.isNotEmpty(companyMap.get(regionModelList.get(i).getRegionCode()+""))){
if (StringUtils.isNotEmpty(companyMap.get(regionModelList.get(i).getRegionCode() + ""))) {
int finalI = i;
countMap.forEach((k, v)->{
if(k.startsWith(companyMap.get(regionModelList.get(finalI).getRegionCode()+""))){
if(null != v){
countMap.forEach((k, v) -> {
if (k.startsWith(companyMap.get(regionModelList.get(finalI).getRegionCode() + ""))) {
if (null != v) {
count.addAndGet(v);
}
}
......@@ -1089,39 +1095,39 @@ public class JGDPStatisticsServiceImpl {
}
private Map<String, Object> noticeCount(Map<String, Object> resultMap, List<RegionModel> regionModelList) {
Map<String,Integer> countMap = new HashMap<>();
Map<String, Integer> countMap = new HashMap<>();
List<Object> xDataList = new ArrayList<>();
List<Object> yDataList = new ArrayList<>();
List<Integer> regionCodeList = regionModelList.stream().map(m -> m.getRegionCode()).collect(Collectors.toList());
List<Map<String, String>> orgCodeByCompanyCodes = commonMapper.getOrgCodesByCompanyCodes(regionCodeList);
Map<String, String> companyMap = new HashMap<>();
List<String> orgCodes = new ArrayList<>();
orgCodeByCompanyCodes.stream().forEach(t->{
companyMap.put(t.get("companyCode")+"",t.get("orgCode"));
if(StringUtils.isNotBlank(t.get("orgCode"))) {
orgCodeByCompanyCodes.stream().forEach(t -> {
companyMap.put(t.get("companyCode") + "", t.get("orgCode"));
if (StringUtils.isNotBlank(t.get("orgCode"))) {
orgCodes.add(t.get("orgCode"));
}
});
//安装告知
List<Map<String,Object>> installCountList = dpStatisticsMapper.installCountByOrgCodes(orgCodes);
countByMap(countMap,installCountList);
List<Map<String, Object>> installCountList = dpStatisticsMapper.installCountByOrgCodes(orgCodes);
countByMap(countMap, installCountList);
//维修告知
List<Map<String, Object>> maintenanceCountList = dpStatisticsMapper.maintenanceNoticeCountByOrgCodes(orgCodes);
countByMap(countMap,maintenanceCountList);
countByMap(countMap, maintenanceCountList);
//改造告知
List<Map<String, Object>> reformCountList = dpStatisticsMapper.reformCountByOrgCodes(orgCodes);
countByMap(countMap,reformCountList);
countByMap(countMap, reformCountList);
//移装告知
List<Map<String, Object>> transferCountList = dpStatisticsMapper.transferCountByOrgCodes(orgCodes);
countByMap(countMap,transferCountList);
for(int i = 0; i < regionModelList.size(); i++){
countByMap(countMap, transferCountList);
for (int i = 0; i < regionModelList.size(); i++) {
AtomicInteger count = new AtomicInteger();
xDataList.add(regionModelList.get(i).getRegionName());
if(StringUtils.isNotEmpty(companyMap.get(regionModelList.get(i).getRegionCode()+""))){
if (StringUtils.isNotEmpty(companyMap.get(regionModelList.get(i).getRegionCode() + ""))) {
int finalI = i;
countMap.forEach((k, v)->{
if(k.startsWith(companyMap.get(regionModelList.get(finalI).getRegionCode()+""))){
if(null != v){
countMap.forEach((k, v) -> {
if (k.startsWith(companyMap.get(regionModelList.get(finalI).getRegionCode() + ""))) {
if (null != v) {
count.addAndGet(v);
}
}
......@@ -1138,9 +1144,9 @@ public class JGDPStatisticsServiceImpl {
private void countByMap(Map<String, Integer> countMap, List<Map<String, Object>> list) {
for (int i = 0; i < list.size(); i++) {
if (null == countMap.get(list.get(i).get("orgCode"))) {
countMap.put(list.get(i).get("orgCode").toString(), Integer.valueOf(list.get(i).get("count")+""));
countMap.put(list.get(i).get("orgCode").toString(), Integer.valueOf(list.get(i).get("count") + ""));
} else {
countMap.put(list.get(i).get("orgCode").toString(), countMap.get(list.get(i).get("orgCode")) + Integer.valueOf(list.get(i).get("count")+""));
countMap.put(list.get(i).get("orgCode").toString(), countMap.get(list.get(i).get("orgCode")) + Integer.valueOf(list.get(i).get("count") + ""));
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment