|
@@ -3,15 +3,14 @@ package com.usky.fire.service.impl;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.usky.common.mybatis.core.AbstractCrudService;
|
|
|
-import com.usky.fire.domain.PatrolInspectionPlan;
|
|
|
-import com.usky.fire.domain.PatrolInspectionPlanSchedule;
|
|
|
-import com.usky.fire.domain.PatrolInspectionPlanSiteSon;
|
|
|
-import com.usky.fire.domain.PatrolInspectionPlanSon;
|
|
|
+import com.usky.common.security.utils.SecurityUtils;
|
|
|
+import com.usky.fire.domain.*;
|
|
|
import com.usky.fire.mapper.PatrolInspectionPlanMapper;
|
|
|
import com.usky.fire.mapper.PatrolInspectionPlanSonMapper;
|
|
|
import com.usky.fire.service.PatrolInspectionPlanScheduleService;
|
|
|
import com.usky.fire.service.PatrolInspectionPlanSiteSonService;
|
|
|
import com.usky.fire.service.PatrolInspectionPlanSonService;
|
|
|
+import com.usky.fire.service.PatrolInspectionSiteService;
|
|
|
import com.usky.fire.service.vo.DataCountVo;
|
|
|
import com.usky.fire.service.vo.PatrolInspectionPlanSonVo;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -43,6 +42,9 @@ public class PatrolInspectionPlanSonServiceImpl extends AbstractCrudService<Patr
|
|
|
@Autowired
|
|
|
private PatrolInspectionPlanSiteSonService patrolInspectionPlanSiteSonService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private PatrolInspectionSiteService patrolInspectionSiteService;
|
|
|
+
|
|
|
@Override
|
|
|
public Map<String, Object> appPlanStatistics(Integer personnelId, String currentDate) {
|
|
|
LambdaQueryWrapper<PatrolInspectionPlanSchedule> queryWrapper = Wrappers.lambdaQuery();
|
|
@@ -70,6 +72,7 @@ public class PatrolInspectionPlanSonServiceImpl extends AbstractCrudService<Patr
|
|
|
}
|
|
|
|
|
|
|
|
|
+ @Override
|
|
|
public Map<String, Object> patrolInspectionPlan(Integer personnelId, String currentDate, String sort) {
|
|
|
LambdaQueryWrapper<PatrolInspectionPlanSchedule> queryWrapper = Wrappers.lambdaQuery();
|
|
|
queryWrapper.select(PatrolInspectionPlanSchedule::getPlanId)
|
|
@@ -99,6 +102,52 @@ public class PatrolInspectionPlanSonServiceImpl extends AbstractCrudService<Patr
|
|
|
return map;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public List<PatrolInspectionPlanSonVo> siteDetails(String siteNubmber, Integer personnelId) {
|
|
|
+ SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ LambdaQueryWrapper<PatrolInspectionPlanSchedule> queryWrapperOne = Wrappers.lambdaQuery();
|
|
|
+ queryWrapperOne.select(PatrolInspectionPlanSchedule::getPlanId)
|
|
|
+ .eq(PatrolInspectionPlanSchedule::getPersonnelId, personnelId)
|
|
|
+ .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());
|
|
|
+ }
|
|
|
+// formatter.format(new Date());
|
|
|
+ List<PatrolInspectionPlanSonVo> planSonList = this.patrolInspectionPlanSon(planIdList, "2022-09-01", "DESC");
|
|
|
+ LambdaQueryWrapper<PatrolInspectionSite> queryWrapper = Wrappers.lambdaQuery();
|
|
|
+ queryWrapper.eq(PatrolInspectionSite::getSiteNubmber, siteNubmber)
|
|
|
+ .eq(PatrolInspectionSite::getTenantId, SecurityUtils.getTenantId());
|
|
|
+ List<PatrolInspectionSite> siteList = patrolInspectionSiteService.list(queryWrapper);
|
|
|
+// List<Integer> siteIdList = new ArrayList<>();
|
|
|
+// for (int i = 0; i < siteList.size(); i++) {
|
|
|
+// siteIdList.add(siteList.get(i).getId());
|
|
|
+// }
|
|
|
+ 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(i).getId());
|
|
|
+ list.add(planSonList.get(i));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
@Override
|
|
|
public List<PatrolInspectionPlanSonVo> patrolInspectionPlanSon(List<Integer> planIdList, String currentDate, String sort) {
|
|
@@ -106,6 +155,7 @@ public class PatrolInspectionPlanSonServiceImpl extends AbstractCrudService<Patr
|
|
|
DateTimeFormatter df1 = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
|
|
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
LambdaQueryWrapper<PatrolInspectionPlanSon> queryWrapper = Wrappers.lambdaQuery();
|
|
|
+ queryWrapper.eq(PatrolInspectionPlanSon::getTenantId, SecurityUtils.getTenantId());
|
|
|
if (planIdList != null && planIdList.size() > 0) {
|
|
|
queryWrapper.in(PatrolInspectionPlanSon::getPlanId, planIdList);
|
|
|
}
|
|
@@ -129,6 +179,7 @@ public class PatrolInspectionPlanSonServiceImpl extends AbstractCrudService<Patr
|
|
|
}
|
|
|
//巡检计划名称查询
|
|
|
LambdaQueryWrapper<PatrolInspectionPlan> queryWrapperOne = Wrappers.lambdaQuery();
|
|
|
+ queryWrapperOne.eq(PatrolInspectionPlan::getTenantId, SecurityUtils.getTenantId());
|
|
|
queryWrapperOne.select(PatrolInspectionPlan::getId, PatrolInspectionPlan::getPlanName);
|
|
|
if (planIdList != null && planIdList.size() > 0) {
|
|
|
queryWrapperOne.in(PatrolInspectionPlan::getId, planIdList);
|
|
@@ -218,7 +269,6 @@ public class PatrolInspectionPlanSonServiceImpl extends AbstractCrudService<Patr
|
|
|
|
|
|
@Override
|
|
|
public List<DataCountVo> planSiteSonCount(List<Integer> planSonidList, Integer inspectionStatus) {
|
|
|
-
|
|
|
LambdaQueryWrapper<PatrolInspectionPlanSiteSon> queryWrapper = Wrappers.lambdaQuery();
|
|
|
if (planSonidList != null && planSonidList.size() > 0) {
|
|
|
queryWrapper.in(PatrolInspectionPlanSiteSon::getPlanId, planSonidList);
|
|
@@ -245,6 +295,7 @@ public class PatrolInspectionPlanSonServiceImpl extends AbstractCrudService<Patr
|
|
|
public Integer planSonCount(List<Integer> planIdList, Integer completion, String currentDate) {
|
|
|
DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
|
|
LambdaQueryWrapper<PatrolInspectionPlanSon> queryWrapper = Wrappers.lambdaQuery();
|
|
|
+ queryWrapper.eq(PatrolInspectionPlanSon::getTenantId, SecurityUtils.getTenantId());
|
|
|
if (planIdList != null && planIdList.size() > 0) {
|
|
|
queryWrapper.in(PatrolInspectionPlanSon::getPlanId, planIdList);
|
|
|
}
|