|
@@ -72,24 +72,27 @@ public class PatrolInspectionPlanSonServiceImpl extends AbstractCrudService<Patr
|
|
|
|
|
|
@Override
|
|
|
public Map<String, Object> appPlanStatistics(String currentDate) {
|
|
|
- List<Integer> personnelIdList = this.getpersonId();
|
|
|
- LambdaQueryWrapper<PatrolInspectionPlanSchedule> queryWrapper = Wrappers.lambdaQuery();
|
|
|
- queryWrapper.select(PatrolInspectionPlanSchedule::getPlanId)
|
|
|
- .in(PatrolInspectionPlanSchedule::getPersonnelId, personnelIdList)
|
|
|
- .groupBy(PatrolInspectionPlanSchedule::getPlanId);
|
|
|
- List<PatrolInspectionPlanSchedule> planScheduleList = patrolInspectionPlanScheduleService.list(queryWrapper);
|
|
|
Integer planSonCount = 0;
|
|
|
Integer patrolledCount = 0;
|
|
|
Integer undetectedCount = 0;
|
|
|
- if (planScheduleList.size() > 0) {
|
|
|
- List<Integer> planIdList = new ArrayList<>();
|
|
|
- for (int i = 0; i < planScheduleList.size(); i++) {
|
|
|
- planIdList.add(planScheduleList.get(i).getPlanId());
|
|
|
+ List<Integer> personnelIdList = this.getpersonId();
|
|
|
+ if (personnelIdList.size() > 0) {
|
|
|
+ LambdaQueryWrapper<PatrolInspectionPlanSchedule> queryWrapper = Wrappers.lambdaQuery();
|
|
|
+ queryWrapper.select(PatrolInspectionPlanSchedule::getPlanId)
|
|
|
+ .in(PatrolInspectionPlanSchedule::getPersonnelId, personnelIdList)
|
|
|
+ .groupBy(PatrolInspectionPlanSchedule::getPlanId);
|
|
|
+ List<PatrolInspectionPlanSchedule> planScheduleList = patrolInspectionPlanScheduleService.list(queryWrapper);
|
|
|
+ if (planScheduleList.size() > 0) {
|
|
|
+ List<Integer> planIdList = new ArrayList<>();
|
|
|
+ for (int i = 0; i < planScheduleList.size(); i++) {
|
|
|
+ planIdList.add(planScheduleList.get(i).getPlanId());
|
|
|
+ }
|
|
|
+ planSonCount = this.planSonCount(planIdList, null, currentDate);
|
|
|
+ patrolledCount = this.planSonCount(planIdList, 100, currentDate);
|
|
|
+ undetectedCount = planSonCount - patrolledCount;
|
|
|
}
|
|
|
- planSonCount = this.planSonCount(planIdList, null, currentDate);
|
|
|
- patrolledCount = this.planSonCount(planIdList, 100, currentDate);
|
|
|
- undetectedCount = planSonCount - patrolledCount;
|
|
|
}
|
|
|
+
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
map.put("planSonCount", planSonCount);//巡检任务总数
|
|
|
map.put("patrolledCount", patrolledCount);//已巡检任务
|
|
@@ -99,64 +102,69 @@ public class PatrolInspectionPlanSonServiceImpl extends AbstractCrudService<Patr
|
|
|
|
|
|
@Override
|
|
|
public List<PatrolInspectionPlanSonVo> patrolInspectionPlan(String currentDate, String sort) {
|
|
|
- List<Integer> personnelIdList = this.getpersonId();
|
|
|
- LambdaQueryWrapper<PatrolInspectionPlanSchedule> queryWrapper = Wrappers.lambdaQuery();
|
|
|
- queryWrapper.select(PatrolInspectionPlanSchedule::getPlanId)
|
|
|
- .in(PatrolInspectionPlanSchedule::getPersonnelId, personnelIdList)
|
|
|
- .groupBy(PatrolInspectionPlanSchedule::getPlanId);
|
|
|
- List<PatrolInspectionPlanSchedule> planScheduleList = patrolInspectionPlanScheduleService.list(queryWrapper);
|
|
|
List<PatrolInspectionPlanSonVo> planList = new ArrayList<>();
|
|
|
- if (planScheduleList.size() > 0) {
|
|
|
- List<Integer> planIdList = new ArrayList<>();
|
|
|
- for (int i = 0; i < planScheduleList.size(); i++) {
|
|
|
- planIdList.add(planScheduleList.get(i).getPlanId());
|
|
|
+ List<Integer> personnelIdList = this.getpersonId();
|
|
|
+ if (personnelIdList.size()>0){
|
|
|
+ LambdaQueryWrapper<PatrolInspectionPlanSchedule> queryWrapper = Wrappers.lambdaQuery();
|
|
|
+ queryWrapper.select(PatrolInspectionPlanSchedule::getPlanId)
|
|
|
+ .in(PatrolInspectionPlanSchedule::getPersonnelId, personnelIdList)
|
|
|
+ .groupBy(PatrolInspectionPlanSchedule::getPlanId);
|
|
|
+ List<PatrolInspectionPlanSchedule> planScheduleList = patrolInspectionPlanScheduleService.list(queryWrapper);
|
|
|
+ if (planScheduleList.size() > 0) {
|
|
|
+ List<Integer> planIdList = new ArrayList<>();
|
|
|
+ for (int i = 0; i < planScheduleList.size(); i++) {
|
|
|
+ planIdList.add(planScheduleList.get(i).getPlanId());
|
|
|
+ }
|
|
|
+ planList = this.patrolInspectionPlanSon(planIdList, currentDate, sort);
|
|
|
}
|
|
|
- planList = this.patrolInspectionPlanSon(planIdList, currentDate, sort);
|
|
|
}
|
|
|
+
|
|
|
return planList;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public List<PatrolInspectionPlanSonVo> planList(String siteNubmber) {
|
|
|
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
- List<Integer> personnelIdList = this.getpersonId();
|
|
|
- LambdaQueryWrapper<PatrolInspectionSite> queryWrapper = Wrappers.lambdaQuery();
|
|
|
- queryWrapper.eq(PatrolInspectionSite::getEnable, 1);
|
|
|
- queryWrapper
|
|
|
- .eq(PatrolInspectionSite::getTenantId, SecurityUtils.getTenantId())
|
|
|
- .eq(PatrolInspectionSite::getSiteNubmber, siteNubmber);
|
|
|
- List<PatrolInspectionSite> siteList = patrolInspectionSiteService.list(queryWrapper);
|
|
|
- if (siteList.size() <= 0) {
|
|
|
- throw new BusinessException("无效地点,请联系管理人员添加点位");
|
|
|
- }
|
|
|
-
|
|
|
- LambdaQueryWrapper<PatrolInspectionPlanSchedule> queryWrapperOne = Wrappers.lambdaQuery();
|
|
|
- queryWrapperOne.select(PatrolInspectionPlanSchedule::getPlanId)
|
|
|
- .in(PatrolInspectionPlanSchedule::getPersonnelId, personnelIdList)
|
|
|
- .groupBy(PatrolInspectionPlanSchedule::getPlanId);
|
|
|
- List<PatrolInspectionPlanSchedule> planScheduleList = patrolInspectionPlanScheduleService.list(queryWrapperOne);
|
|
|
List<PatrolInspectionPlanSonVo> list = new ArrayList<>();
|
|
|
- if (planScheduleList.size() > 0) {
|
|
|
- List<Integer> planIdList = new ArrayList<>();
|
|
|
- for (int i = 0; i < planScheduleList.size(); i++) {
|
|
|
- planIdList.add(planScheduleList.get(i).getPlanId());
|
|
|
- }
|
|
|
- List<PatrolInspectionPlanSonVo> planSonList = this.patrolInspectionPlanSon(planIdList, formatter.format(new Date()), "DESC");
|
|
|
- List<Integer> planSonIdList = new ArrayList<>();
|
|
|
- for (int i = 0; i < planSonList.size(); i++) {
|
|
|
- planSonIdList.add(planSonList.get(i).getId());
|
|
|
+ List<Integer> personnelIdList = this.getpersonId();
|
|
|
+ if (personnelIdList.size()>0){
|
|
|
+ LambdaQueryWrapper<PatrolInspectionSite> queryWrapper = Wrappers.lambdaQuery();
|
|
|
+ queryWrapper.eq(PatrolInspectionSite::getEnable, 1);
|
|
|
+ queryWrapper
|
|
|
+ .eq(PatrolInspectionSite::getTenantId, SecurityUtils.getTenantId())
|
|
|
+ .eq(PatrolInspectionSite::getSiteNubmber, siteNubmber);
|
|
|
+ List<PatrolInspectionSite> siteList = patrolInspectionSiteService.list(queryWrapper);
|
|
|
+ if (siteList.size() <= 0) {
|
|
|
+ throw new BusinessException("无效地点,请联系管理人员添加点位");
|
|
|
}
|
|
|
- LambdaQueryWrapper<PatrolInspectionPlanSiteSon> queryWrapperTwo = Wrappers.lambdaQuery();
|
|
|
- queryWrapperTwo.select(PatrolInspectionPlanSiteSon::getPlanId)
|
|
|
- .eq(PatrolInspectionPlanSiteSon::getSiteId, siteList.get(0).getId())
|
|
|
- .in(PatrolInspectionPlanSiteSon::getPlanId, planSonIdList)
|
|
|
- .eq(PatrolInspectionPlanSiteSon::getInspectionStatus, 1);
|
|
|
- List<PatrolInspectionPlanSiteSon> planSiteSonList = patrolInspectionPlanSiteSonService.list(queryWrapperTwo);
|
|
|
- for (int i = 0; i < planSonList.size(); i++) {
|
|
|
- for (int j = 0; j < planSiteSonList.size(); j++) {
|
|
|
- if (planSonList.get(i).getId() == planSiteSonList.get(j).getPlanId()) {
|
|
|
- planSonList.get(i).setSiteId(siteList.get(0).getId());
|
|
|
- list.add(planSonList.get(i));
|
|
|
+
|
|
|
+ LambdaQueryWrapper<PatrolInspectionPlanSchedule> queryWrapperOne = Wrappers.lambdaQuery();
|
|
|
+ queryWrapperOne.select(PatrolInspectionPlanSchedule::getPlanId)
|
|
|
+ .in(PatrolInspectionPlanSchedule::getPersonnelId, personnelIdList)
|
|
|
+ .groupBy(PatrolInspectionPlanSchedule::getPlanId);
|
|
|
+ List<PatrolInspectionPlanSchedule> planScheduleList = patrolInspectionPlanScheduleService.list(queryWrapperOne);
|
|
|
+ if (planScheduleList.size() > 0) {
|
|
|
+ List<Integer> planIdList = new ArrayList<>();
|
|
|
+ for (int i = 0; i < planScheduleList.size(); i++) {
|
|
|
+ planIdList.add(planScheduleList.get(i).getPlanId());
|
|
|
+ }
|
|
|
+ List<PatrolInspectionPlanSonVo> planSonList = this.patrolInspectionPlanSon(planIdList, formatter.format(new Date()), "DESC");
|
|
|
+ List<Integer> planSonIdList = new ArrayList<>();
|
|
|
+ for (int i = 0; i < planSonList.size(); i++) {
|
|
|
+ planSonIdList.add(planSonList.get(i).getId());
|
|
|
+ }
|
|
|
+ LambdaQueryWrapper<PatrolInspectionPlanSiteSon> queryWrapperTwo = Wrappers.lambdaQuery();
|
|
|
+ queryWrapperTwo.select(PatrolInspectionPlanSiteSon::getPlanId)
|
|
|
+ .eq(PatrolInspectionPlanSiteSon::getSiteId, siteList.get(0).getId())
|
|
|
+ .in(PatrolInspectionPlanSiteSon::getPlanId, planSonIdList)
|
|
|
+ .eq(PatrolInspectionPlanSiteSon::getInspectionStatus, 1);
|
|
|
+ List<PatrolInspectionPlanSiteSon> planSiteSonList = patrolInspectionPlanSiteSonService.list(queryWrapperTwo);
|
|
|
+ for (int i = 0; i < planSonList.size(); i++) {
|
|
|
+ for (int j = 0; j < planSiteSonList.size(); j++) {
|
|
|
+ if (planSonList.get(i).getId() == planSiteSonList.get(j).getPlanId()) {
|
|
|
+ planSonList.get(i).setSiteId(siteList.get(0).getId());
|
|
|
+ list.add(planSonList.get(i));
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -511,9 +519,6 @@ public class PatrolInspectionPlanSonServiceImpl extends AbstractCrudService<Patr
|
|
|
.eq(PatrolInspectionPersonnel::getTenantId, SecurityUtils.getTenantId())
|
|
|
.eq(PatrolInspectionPersonnel::getUserId, SecurityUtils.getUserId());
|
|
|
List<PatrolInspectionPersonnel> personnelList = patrolInspectionPersonnelService.list(queryWrapper);
|
|
|
- if (personnelList.size() <= 0) {
|
|
|
- throw new BusinessException("该用户不是巡检人员,请联系管理员");
|
|
|
- }
|
|
|
List<Integer> list = new ArrayList<>();
|
|
|
for (int i = 0; i < personnelList.size(); i++) {
|
|
|
list.add(personnelList.get(i).getId());
|