|
@@ -9,7 +9,6 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.metro.baseRe.BaseResponse;
|
|
import com.metro.baseRe.BaseResponse;
|
|
import com.metro.entity.dto.DataShowMiddlerDTO;
|
|
import com.metro.entity.dto.DataShowMiddlerDTO;
|
|
-import com.metro.entity.enums.DataShowTopEnum;
|
|
|
|
import com.metro.entity.po.Company;
|
|
import com.metro.entity.po.Company;
|
|
import com.metro.entity.po.DataShow;
|
|
import com.metro.entity.po.DataShow;
|
|
import com.metro.entity.po.JDevices;
|
|
import com.metro.entity.po.JDevices;
|
|
@@ -30,7 +29,10 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
-import java.util.*;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
|
+import java.util.Collections;
|
|
|
|
+import java.util.List;
|
|
|
|
+import java.util.Map;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
@Service
|
|
@Service
|
|
@@ -66,54 +68,47 @@ public class DataShowServiceImpl implements DataShowService {
|
|
JPersonVO jPersonVO = this.rootTrue();
|
|
JPersonVO jPersonVO = this.rootTrue();
|
|
Integer adminType = jPersonVO.getType();
|
|
Integer adminType = jPersonVO.getType();
|
|
DataShowTopVO dataShowTopVO = new DataShowTopVO();
|
|
DataShowTopVO dataShowTopVO = new DataShowTopVO();
|
|
- Integer totalNumber;//盘查总人数
|
|
|
|
- Integer totalWarningNumber;//总预警人数 = 总存疑人数 + 总抓捕人数
|
|
|
|
- Integer totalDoubtNumber;//总存疑人数
|
|
|
|
- Integer totalArrestNumber;//总抓捕人数
|
|
|
|
|
|
+ Integer totalNumber = 0;//盘查总人数
|
|
|
|
+ Integer totalWarningNumber = 0;//总预警人数 = 总存疑人数 + 总抓捕人数
|
|
|
|
+ Integer totalArrestNumber = 0;//总抓捕人数
|
|
|
|
+ Integer totalDoubtNumber = 0;//总存疑人数
|
|
|
|
|
|
/*1.获取数据库中,今日0点之前的数据*/
|
|
/*1.获取数据库中,今日0点之前的数据*/
|
|
- List<Integer> list = new ArrayList<>();
|
|
|
|
- Collections.addAll(list,
|
|
|
|
- DataShowTopEnum.BERFORE_NUMBER.getType(),
|
|
|
|
- DataShowTopEnum.BERFOR_DOUBT_NUMBER.getType(),
|
|
|
|
- DataShowTopEnum.BERFOR_ARREST_NUMBER.getType()
|
|
|
|
- );
|
|
|
|
- List<DataShow> dataShows = null;
|
|
|
|
|
|
+ DataShow dataShow = null;
|
|
Map<Integer, Integer> dataShowMap = null;//存储当前账号今日之前的数据
|
|
Map<Integer, Integer> dataShowMap = null;//存储当前账号今日之前的数据
|
|
if (adminType == 1) {
|
|
if (adminType == 1) {
|
|
- dataShows = dataShowMapper.selectList(new LambdaQueryWrapper<DataShow>().in(DataShow::getType, list).eq(DataShow::getCompanyId, "").eq(DataShow::getBranchId, ""));
|
|
|
|
|
|
+ dataShow = dataShowMapper.selectByCompanyIdGroup(null,null);
|
|
} else if (adminType == 2) {
|
|
} else if (adminType == 2) {
|
|
- dataShows = dataShowMapper.selectByCompanyIdGroup(jPersonVO.getCompanyId(), list);
|
|
|
|
|
|
+ dataShow = dataShowMapper.selectByCompanyIdGroup(jPersonVO.getCompanyId(),null);
|
|
} else {
|
|
} else {
|
|
throw new ServiceException("无权操作");
|
|
throw new ServiceException("无权操作");
|
|
}
|
|
}
|
|
- if (dataShows != null)
|
|
|
|
- dataShowMap =getByDataShows(dataShows);
|
|
|
|
-// dataShowMap = dataShows.stream().collect(Collectors.toMap(DataShow::getType, DataShow::getNumber));
|
|
|
|
|
|
+ if(dataShow != null){
|
|
|
|
+ totalNumber = dataShow.getNumber();
|
|
|
|
+ totalArrestNumber = dataShow.getArrestNumber();
|
|
|
|
+ totalDoubtNumber = dataShow.getDoubtNumber();
|
|
|
|
+ totalWarningNumber = totalArrestNumber + totalDoubtNumber;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
|
|
/*2.获取数据库中,今日0点之后的数据*/
|
|
/*2.获取数据库中,今日0点之后的数据*/
|
|
Integer todayNumber = 0;//今日盘查人数
|
|
Integer todayNumber = 0;//今日盘查人数
|
|
Integer todayWarningNumber = 0;//今日预警人数 = 今日存疑人数 + 今日抓捕人数
|
|
Integer todayWarningNumber = 0;//今日预警人数 = 今日存疑人数 + 今日抓捕人数
|
|
- Integer todayDoubtNumber = 0;//今日存疑人数
|
|
|
|
Integer todayArrestNumber = 0;//今日抓捕人数
|
|
Integer todayArrestNumber = 0;//今日抓捕人数
|
|
|
|
+ Integer todayDoubtNumber = 0;//今日存疑人数
|
|
|
|
|
|
- List<PassreCordsLessVO> passreCordsLessVOS = passreCordsMapper.selectTodayDataNumber(jPersonVO.getCompanyId() == null ? null:jPersonVO.getCompanyId(),null);
|
|
|
|
-
|
|
|
|
- todayNumber = passreCordsLessVOS.stream().mapToInt(PassreCordsLessVO::getNumber).sum();
|
|
|
|
- todayDoubtNumber = passreCordsLessVOS.stream().filter(p -> p.getPass() == 1).mapToInt(PassreCordsLessVO::getNumber).sum();
|
|
|
|
- todayArrestNumber = passreCordsLessVOS.stream().filter(p -> p.getPass() == 0).mapToInt(PassreCordsLessVO::getNumber).sum();
|
|
|
|
- todayWarningNumber = todayDoubtNumber + todayArrestNumber;
|
|
|
|
-
|
|
|
|
- if (dataShowMap != null) {
|
|
|
|
- totalNumber = todayNumber + (dataShowMap.get(DataShowTopEnum.BERFORE_NUMBER.getType()) != null ? dataShowMap.get(DataShowTopEnum.BERFORE_NUMBER.getType()) : 0);
|
|
|
|
- totalDoubtNumber = todayDoubtNumber + (dataShowMap.get(DataShowTopEnum.BERFOR_DOUBT_NUMBER.getType()) != null ? dataShowMap.get(DataShowTopEnum.BERFOR_DOUBT_NUMBER.getType()) : 0);
|
|
|
|
- totalArrestNumber = todayArrestNumber + (dataShowMap.get(DataShowTopEnum.BERFOR_ARREST_NUMBER.getType()) != null ? dataShowMap.get(DataShowTopEnum.BERFOR_ARREST_NUMBER.getType()) : 0);
|
|
|
|
- totalWarningNumber = totalDoubtNumber + totalArrestNumber;
|
|
|
|
- }else {
|
|
|
|
- totalNumber = todayNumber;
|
|
|
|
- totalWarningNumber = todayDoubtNumber + todayArrestNumber;
|
|
|
|
- totalDoubtNumber = todayDoubtNumber;
|
|
|
|
- totalArrestNumber = todayArrestNumber;
|
|
|
|
|
|
+ if (adminType == 1) {
|
|
|
|
+ dataShow = dataShowMapper.selectByCompanyIdGroup(null,1);
|
|
|
|
+ } else if (adminType == 2) {
|
|
|
|
+ dataShow = dataShowMapper.selectByCompanyIdGroup(jPersonVO.getCompanyId(),1);
|
|
|
|
+ } else {
|
|
|
|
+ throw new ServiceException("无权操作");
|
|
|
|
+ }
|
|
|
|
+ if(dataShow != null){
|
|
|
|
+ todayNumber = dataShow.getNumber();
|
|
|
|
+ todayArrestNumber = dataShow.getArrestNumber();
|
|
|
|
+ todayDoubtNumber = dataShow.getDoubtNumber();
|
|
|
|
+ todayWarningNumber = todayArrestNumber + todayDoubtNumber;
|
|
}
|
|
}
|
|
/*3.获取站点数量*/
|
|
/*3.获取站点数量*/
|
|
LambdaQueryWrapper<Company> companyWrapper = new LambdaQueryWrapper<>();
|
|
LambdaQueryWrapper<Company> companyWrapper = new LambdaQueryWrapper<>();
|
|
@@ -137,68 +132,29 @@ public class DataShowServiceImpl implements DataShowService {
|
|
|
|
|
|
return BaseResponse.ok(dataShowTopVO);
|
|
return BaseResponse.ok(dataShowTopVO);
|
|
}
|
|
}
|
|
- private Map<Integer, Integer> getByDataShows(List<DataShow> dataShows){
|
|
|
|
- Map<Integer, Integer> map = new HashMap<>();
|
|
|
|
- int totalNumber = 0;
|
|
|
|
- int totalDoubtNumber = 0;
|
|
|
|
- int totalArrestNumber = 0;
|
|
|
|
- for (DataShow dataShow : dataShows) {
|
|
|
|
- if(dataShow.getType().equals(DataShowTopEnum.BERFORE_NUMBER.getType())) totalNumber+=dataShow.getNumber();
|
|
|
|
- else if(dataShow.getType().equals(DataShowTopEnum.BERFOR_DOUBT_NUMBER.getType())) {totalDoubtNumber+=dataShow.getNumber();}
|
|
|
|
- else if(dataShow.getType().equals(DataShowTopEnum.BERFOR_ARREST_NUMBER.getType())){ totalArrestNumber+=dataShow.getNumber();}
|
|
|
|
- }
|
|
|
|
- map.put(DataShowTopEnum.BERFORE_NUMBER.getType(),totalNumber);
|
|
|
|
- map.put(DataShowTopEnum.BERFOR_DOUBT_NUMBER.getType(),totalDoubtNumber);
|
|
|
|
- map.put(DataShowTopEnum.BERFOR_ARREST_NUMBER.getType(),totalArrestNumber);
|
|
|
|
- return map;
|
|
|
|
- }
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public BaseResponse<DataShowMiddleVO> selectDataShowMiddler(DataShowMiddlerDTO dataShowMiddlerDTO) {
|
|
public BaseResponse<DataShowMiddleVO> selectDataShowMiddler(DataShowMiddlerDTO dataShowMiddlerDTO) {
|
|
JPersonVO jPersonVO = this.rootTrue();
|
|
JPersonVO jPersonVO = this.rootTrue();
|
|
- Integer timeType = dataShowMiddlerDTO.getTimeType();
|
|
|
|
- Integer passType = dataShowMiddlerDTO.getPassType();
|
|
|
|
- List<Integer> list = new ArrayList<>();
|
|
|
|
-
|
|
|
|
- /*传入共有四种情况*/
|
|
|
|
- /*1.全部 +盘查*/
|
|
|
|
- if(timeType == 1 && passType == 1){
|
|
|
|
- Collections.addAll(list,
|
|
|
|
- DataShowTopEnum.BERFORE_NUMBER.getType(),
|
|
|
|
- DataShowTopEnum.TODAY_NUMBER.getType()
|
|
|
|
- );
|
|
|
|
- }
|
|
|
|
- /*2.全部 +预警*/
|
|
|
|
- else if(timeType == 1 && passType == 2){
|
|
|
|
- Collections.addAll(list,
|
|
|
|
- DataShowTopEnum.BERFOR_DOUBT_NUMBER.getType(),
|
|
|
|
- DataShowTopEnum.BERFOR_ARREST_NUMBER.getType(),
|
|
|
|
- DataShowTopEnum.TODAY_DOUBT_NUMBER.getType(),
|
|
|
|
- DataShowTopEnum.TODAY_ARREST_NUMBER.getType()
|
|
|
|
- );
|
|
|
|
- }
|
|
|
|
- /*3.今日 +盘查*/
|
|
|
|
- else if(timeType == 2 && passType == 1){
|
|
|
|
- Collections.addAll(list,
|
|
|
|
- DataShowTopEnum.TODAY_NUMBER.getType()
|
|
|
|
- );
|
|
|
|
|
|
+ List<DataShowBrandchVO> dataShowList = null;
|
|
|
|
+ if(jPersonVO.getType() == 1){
|
|
|
|
+ dataShowList = dataShowMapper.getDataShowListByCompanyIdAndBranchId(null,dataShowMiddlerDTO);
|
|
|
|
+ }else if(jPersonVO.getType() == 2) {
|
|
|
|
+ dataShowList = dataShowMapper.getDataShowListByCompanyIdAndBranchId(jPersonVO.getCompanyId(),dataShowMiddlerDTO);
|
|
|
|
+ }else {
|
|
|
|
+ throw new ServiceException("无权操作");
|
|
}
|
|
}
|
|
- /*4.今日 +预警*/
|
|
|
|
- else if(timeType == 2 && passType == 2){
|
|
|
|
- Collections.addAll(list,
|
|
|
|
- DataShowTopEnum.TODAY_DOUBT_NUMBER.getType(),
|
|
|
|
- DataShowTopEnum.TODAY_ARREST_NUMBER.getType()
|
|
|
|
- );
|
|
|
|
- }else{throw new ServiceException("数据有误");}
|
|
|
|
-
|
|
|
|
- List<DataShow> dataShowList = dataShowMapper.getDataShowListByCompanyIdAndBranchId(jPersonVO,list);
|
|
|
|
/*获取数据中companyMap 和barnchMap 暂时只要branchName*/
|
|
/*获取数据中companyMap 和barnchMap 暂时只要branchName*/
|
|
// Map<String, Company> companyMap = companyService.getCompanyMapByList(dataShowList, DataShow::getCompanyId);
|
|
// Map<String, Company> companyMap = companyService.getCompanyMapByList(dataShowList, DataShow::getCompanyId);
|
|
- Map<String, Company> barnchMap = companyService.getBranchMapByList(dataShowList,DataShow::getBranchId);
|
|
|
|
|
|
+ Map<String, Company> barnchMap = companyService.getBranchMapByList(dataShowList,DataShowBrandchVO::getBranchId);
|
|
List<String> siteList = new ArrayList<>();
|
|
List<String> siteList = new ArrayList<>();
|
|
List<Integer> numberList = new ArrayList<>();
|
|
List<Integer> numberList = new ArrayList<>();
|
|
- for (DataShow dataShow : dataShowList) {
|
|
|
|
- numberList.add(dataShow.getNumber());
|
|
|
|
|
|
+ for (DataShowBrandchVO dataShow : dataShowList) {
|
|
|
|
+ if(dataShowMiddlerDTO.getPassType() == 1){
|
|
|
|
+ numberList.add(dataShow.getNumber());
|
|
|
|
+ }else {
|
|
|
|
+ numberList.add(dataShow.getWarningNumber());
|
|
|
|
+ }
|
|
siteList.add(barnchMap.get(dataShow.getCompanyId()+dataShow.getBranchId()) == null ?
|
|
siteList.add(barnchMap.get(dataShow.getCompanyId()+dataShow.getBranchId()) == null ?
|
|
"" : barnchMap.get(dataShow.getCompanyId()+dataShow.getBranchId()).getBranchName());
|
|
"" : barnchMap.get(dataShow.getCompanyId()+dataShow.getBranchId()).getBranchName());
|
|
}
|
|
}
|
|
@@ -227,7 +183,8 @@ public class DataShowServiceImpl implements DataShowService {
|
|
Integer number = 0;
|
|
Integer number = 0;
|
|
for (int j = 0; j < list.size(); j++) {
|
|
for (int j = 0; j < list.size(); j++) {
|
|
PassreCordsGroupByTimeVO pco = list.get(j);
|
|
PassreCordsGroupByTimeVO pco = list.get(j);
|
|
- Integer time = pco.getTime();
|
|
|
|
|
|
+ String substring = pco.getDate().substring(11,13);
|
|
|
|
+ Integer time = Integer.valueOf(substring);
|
|
int start = i*2;
|
|
int start = i*2;
|
|
int end = (i*2) + 2;
|
|
int end = (i*2) + 2;
|
|
if(time >= start && time < end){
|
|
if(time >= start && time < end){
|
|
@@ -264,6 +221,7 @@ public class DataShowServiceImpl implements DataShowService {
|
|
List<Integer> list = new ArrayList<>();
|
|
List<Integer> list = new ArrayList<>();
|
|
Collections.addAll(list,0,1);//去掉了健康码异常的实时预警
|
|
Collections.addAll(list,0,1);//去掉了健康码异常的实时预警
|
|
PassreCordsWrapper.in(PassreCords::getPass,list);
|
|
PassreCordsWrapper.in(PassreCords::getPass,list);
|
|
|
|
+ PassreCordsWrapper.eq(PassreCords::getFirstPass,true);
|
|
PassreCordsWrapper.orderByDesc(PassreCords::getPassTime);
|
|
PassreCordsWrapper.orderByDesc(PassreCords::getPassTime);
|
|
Page<PassreCords> selectPage = passreCordsMapper.selectPage(new Page<>(0, 6), PassreCordsWrapper);
|
|
Page<PassreCords> selectPage = passreCordsMapper.selectPage(new Page<>(0, 6), PassreCordsWrapper);
|
|
List<PassreCords> records = selectPage.getRecords();
|
|
List<PassreCords> records = selectPage.getRecords();
|