首页统计模式调整
This commit is contained in:
parent
d3d1f180ee
commit
1cea027067
|
|
@ -143,11 +143,12 @@ public class WxAppletController {
|
|||
@ApiOperation("获取首页最新数据")
|
||||
public R getNewestData(@RequestParam(required = false) String dataMode){
|
||||
List<SurvStationInfo> stationList = stationInfoService.getAllStationAndDevice("","","token");
|
||||
Integer dataCounts = stationInfoService.getCountOfAllData();
|
||||
Integer dataCounts = 0;
|
||||
//补充最新数据进入
|
||||
List<CommonDataTrans> listFinal = new ArrayList<>();
|
||||
if(stationList!=null&&stationList.size()>0){
|
||||
for (SurvStationInfo survStationInfo : stationList) {
|
||||
dataCounts = dataCounts + stationInfoService.getStationDataCounts(survStationInfo);
|
||||
if(survStationInfo.getDeviceList()!=null&&survStationInfo.getDeviceList().size()>0){
|
||||
List<SurvDeviceDeploy> remainList = new ArrayList<>();
|
||||
List<String> airList = new ArrayList<>();
|
||||
|
|
@ -230,7 +231,9 @@ public class WxAppletController {
|
|||
}
|
||||
}
|
||||
if(!listFinal.isEmpty()){
|
||||
listFinal.forEach(item->item.setDataCounts(dataCounts));
|
||||
for (CommonDataTrans commonDataTrans : listFinal) {
|
||||
commonDataTrans.setDataCounts(dataCounts);
|
||||
}
|
||||
}
|
||||
return R.ok(listFinal);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,4 +23,6 @@ public interface ISurvStationInfoService extends IService<SurvStationInfo> {
|
|||
List<SurvStationInfo> getAllStationAndDevice(String stationCode,String deployType, String token);
|
||||
|
||||
Integer getCountOfAllData();
|
||||
|
||||
Integer getStationDataCounts(SurvStationInfo survStationInfo);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,11 +2,17 @@ package org.jeecg.system.applet.service.impl;
|
|||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.jeecg.common.constant.PollutionConstants;
|
||||
import org.jeecg.common.entity.SurvDeviceDeploy;
|
||||
import org.jeecg.common.entity.SurvStationInfo;
|
||||
import org.jeecg.system.applet.mapper.SurvStationInfoMapper;
|
||||
import org.jeecg.system.applet.service.ISurvStationInfoService;
|
||||
import org.jeecg.system.applet.service.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
|
@ -18,6 +24,28 @@ import java.util.List;
|
|||
@Service
|
||||
public class SurvStationInfoServiceImpl extends ServiceImpl<SurvStationInfoMapper, SurvStationInfo> implements ISurvStationInfoService {
|
||||
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ISurvDeviceDeployService deviceDeployService;
|
||||
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ISurvHisdataAirService airService;
|
||||
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ISurvHisdataSoilService soilService;
|
||||
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ISurvHisdataOrientwaterService orientwaterService;
|
||||
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ISurvHisdataLivestockwaterService livestockwaterService;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public IPage<SurvStationInfo> pages(IPage<SurvStationInfo> page, SurvStationInfo survStationInfo) {
|
||||
return baseMapper.pages(page,survStationInfo);
|
||||
|
|
@ -43,5 +71,42 @@ public class SurvStationInfoServiceImpl extends ServiceImpl<SurvStationInfoMappe
|
|||
return baseMapper.getCountOfAllData();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getStationDataCounts(SurvStationInfo survStationInfo) {
|
||||
Integer dataCounts = 0;
|
||||
if(survStationInfo!=null){
|
||||
List<SurvDeviceDeploy> deploys = new ArrayList<>();
|
||||
if(survStationInfo.getDeviceList() !=null && !survStationInfo.getDeviceList().isEmpty()){ //没有设备传入去重新查询
|
||||
deploys = survStationInfo.getDeviceList();
|
||||
}else{
|
||||
deploys = deviceDeployService.getDeviceByStation(survStationInfo.getStationCode(),null);
|
||||
}
|
||||
|
||||
if(!deploys.isEmpty()){
|
||||
for (SurvDeviceDeploy deploy : deploys) {
|
||||
switch (deploy.getDeployType()){
|
||||
case PollutionConstants.AIR_SURV:
|
||||
dataCounts = dataCounts + airService.getHisDataCount(new ArrayList<>(Arrays.asList(deploy.getDeployCode())));
|
||||
break;
|
||||
case PollutionConstants.SOIL_SURV:
|
||||
dataCounts = dataCounts + soilService.getHisDataCount(new ArrayList<>(Arrays.asList(deploy.getDeployCode())));
|
||||
break;
|
||||
case PollutionConstants.WATER_ORIENT:
|
||||
dataCounts = dataCounts + orientwaterService.getHisDataCount(new ArrayList<>(Arrays.asList(deploy.getDeployCode())));
|
||||
break;
|
||||
case PollutionConstants.WATER_LIVE:
|
||||
dataCounts = dataCounts + livestockwaterService.getHisDataCount(new ArrayList<>(Arrays.asList(deploy.getDeployCode())));
|
||||
break;
|
||||
case PollutionConstants.WATER_QULITY:
|
||||
dataCounts = dataCounts + soilService.getHisDataCount(new ArrayList<>(Arrays.asList(deploy.getDeployCode())));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return dataCounts;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue