|
@@ -67,11 +67,15 @@ public class PatrolInspectionPlanSonServiceImpl extends AbstractCrudService<Patr
|
|
|
@Autowired
|
|
|
private PatrolInspectionRecordPictureService patrolInspectionRecordPictureService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private PatrolInspectionPersonnelService patrolInspectionPersonnelService;
|
|
|
+
|
|
|
@Override
|
|
|
- public Map<String, Object> appPlanStatistics(Integer personnelId, String currentDate) {
|
|
|
+ public Map<String, Object> appPlanStatistics(String currentDate) {
|
|
|
+ List<Integer> personnelIdList = this.getpersonId();
|
|
|
LambdaQueryWrapper<PatrolInspectionPlanSchedule> queryWrapper = Wrappers.lambdaQuery();
|
|
|
queryWrapper.select(PatrolInspectionPlanSchedule::getPlanId)
|
|
|
- .eq(PatrolInspectionPlanSchedule::getPersonnelId, personnelId)
|
|
|
+ .in(PatrolInspectionPlanSchedule::getPersonnelId, personnelIdList)
|
|
|
.groupBy(PatrolInspectionPlanSchedule::getPlanId);
|
|
|
List<PatrolInspectionPlanSchedule> planScheduleList = patrolInspectionPlanScheduleService.list(queryWrapper);
|
|
|
Integer planSonCount = 0;
|
|
@@ -93,17 +97,14 @@ public class PatrolInspectionPlanSonServiceImpl extends AbstractCrudService<Patr
|
|
|
return map;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
@Override
|
|
|
- public Map<String, Object> patrolInspectionPlan(Integer personnelId, String currentDate, String sort) {
|
|
|
+ public List<PatrolInspectionPlanSonVo> patrolInspectionPlan(String currentDate, String sort) {
|
|
|
+ List<Integer> personnelIdList = this.getpersonId();
|
|
|
LambdaQueryWrapper<PatrolInspectionPlanSchedule> queryWrapper = Wrappers.lambdaQuery();
|
|
|
queryWrapper.select(PatrolInspectionPlanSchedule::getPlanId)
|
|
|
- .eq(PatrolInspectionPlanSchedule::getPersonnelId, personnelId)
|
|
|
+ .in(PatrolInspectionPlanSchedule::getPersonnelId, personnelIdList)
|
|
|
.groupBy(PatrolInspectionPlanSchedule::getPlanId);
|
|
|
List<PatrolInspectionPlanSchedule> planScheduleList = patrolInspectionPlanScheduleService.list(queryWrapper);
|
|
|
- Integer planSonCount = 0;
|
|
|
- Integer patrolledCount = 0;
|
|
|
- Integer undetectedCount = 0;
|
|
|
List<PatrolInspectionPlanSonVo> planList = new ArrayList<>();
|
|
|
if (planScheduleList.size() > 0) {
|
|
|
List<Integer> planIdList = new ArrayList<>();
|
|
@@ -111,22 +112,14 @@ public class PatrolInspectionPlanSonServiceImpl extends AbstractCrudService<Patr
|
|
|
planIdList.add(planScheduleList.get(i).getPlanId());
|
|
|
}
|
|
|
planList = this.patrolInspectionPlanSon(planIdList, currentDate, sort);
|
|
|
- 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);//已巡检任务
|
|
|
- map.put("undetectedCount", undetectedCount);//漏检任务
|
|
|
- map.put("planList", planList);
|
|
|
- return map;
|
|
|
+ return planList;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public List<PatrolInspectionPlanSonVo> planList(String siteNubmber, Integer personnelId) {
|
|
|
+ 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
|
|
@@ -139,7 +132,7 @@ public class PatrolInspectionPlanSonServiceImpl extends AbstractCrudService<Patr
|
|
|
|
|
|
LambdaQueryWrapper<PatrolInspectionPlanSchedule> queryWrapperOne = Wrappers.lambdaQuery();
|
|
|
queryWrapperOne.select(PatrolInspectionPlanSchedule::getPlanId)
|
|
|
- .eq(PatrolInspectionPlanSchedule::getPersonnelId, personnelId)
|
|
|
+ .in(PatrolInspectionPlanSchedule::getPersonnelId, personnelIdList)
|
|
|
.groupBy(PatrolInspectionPlanSchedule::getPlanId);
|
|
|
List<PatrolInspectionPlanSchedule> planScheduleList = patrolInspectionPlanScheduleService.list(queryWrapperOne);
|
|
|
List<PatrolInspectionPlanSonVo> list = new ArrayList<>();
|
|
@@ -175,7 +168,7 @@ public class PatrolInspectionPlanSonServiceImpl extends AbstractCrudService<Patr
|
|
|
@Override
|
|
|
public Map<String, Object> siteDetails(Integer siteId, String siteNubmber) {
|
|
|
LambdaQueryWrapper<PatrolInspectionSite> queryWrapper = Wrappers.lambdaQuery();
|
|
|
-// queryWrapper.eq(PatrolInspectionSite::getTenantId, SecurityUtils.getTenantId());
|
|
|
+ queryWrapper.eq(PatrolInspectionSite::getTenantId, SecurityUtils.getTenantId());
|
|
|
queryWrapper.eq(PatrolInspectionSite::getEnable, 1);
|
|
|
if (siteId != 0 && siteId != null) {
|
|
|
queryWrapper.eq(PatrolInspectionSite::getId, siteId);
|
|
@@ -348,6 +341,104 @@ public class PatrolInspectionPlanSonServiceImpl extends AbstractCrudService<Patr
|
|
|
return list;
|
|
|
}
|
|
|
|
|
|
+ public List<PatrolInspectionRecordVo> recordList(String currentDate, String sort,Integer id) {
|
|
|
+ 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<PatrolInspectionRecordVo> 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());
|
|
|
+ }
|
|
|
+ LambdaQueryWrapper<PatrolInspectionRecord> queryWrapperOne = Wrappers.lambdaQuery();
|
|
|
+ queryWrapperOne.in(PatrolInspectionRecord::getPlanId, planIdList)
|
|
|
+ .between(PatrolInspectionRecord::getCreateTime, currentDate + " 00:00:00", currentDate + " 23:59:59");
|
|
|
+ if (id != null && id != 0) {
|
|
|
+ queryWrapperOne.eq(PatrolInspectionRecord::getId,id);
|
|
|
+ }
|
|
|
+ if (sort.equals("ASC")) {
|
|
|
+ queryWrapperOne.orderByAsc(PatrolInspectionRecord::getId);
|
|
|
+ } else {
|
|
|
+ queryWrapperOne.orderByDesc(PatrolInspectionRecord::getId);
|
|
|
+ }
|
|
|
+ List<PatrolInspectionRecord> recordList = patrolInspectionRecordMapper.selectList(queryWrapperOne);
|
|
|
+ if (recordList.size() > 0) {
|
|
|
+ List<Integer> siteIdList = new ArrayList<>();
|
|
|
+ for (int i = 0; i < recordList.size(); i++) {
|
|
|
+ siteIdList.add(recordList.get(i).getSiteId());
|
|
|
+ }
|
|
|
+ LambdaQueryWrapper<PatrolInspectionSiteContent> queryWrapperTwo = Wrappers.lambdaQuery();
|
|
|
+ queryWrapperTwo.in(PatrolInspectionSiteContent::getSiteId, siteIdList);
|
|
|
+ List<PatrolInspectionSiteContent> siteContentLsit = patrolInspectionSiteContentService.list(queryWrapperTwo);
|
|
|
+
|
|
|
+ Map<Integer, List<PatrolInspectionSiteContent>> grouypByAreaId = siteContentLsit.stream().collect(
|
|
|
+ Collectors.groupingBy(o -> o.getSiteId())
|
|
|
+ );
|
|
|
+ List<DataCountVo> dataCountVoList = new ArrayList<>();
|
|
|
+ grouypByAreaId.forEach((k, v) -> {
|
|
|
+ DataCountVo dataCountVo = new DataCountVo();
|
|
|
+ dataCountVo.setListCount(v.size());
|
|
|
+ dataCountVo.setId(k);
|
|
|
+ dataCountVoList.add(dataCountVo);
|
|
|
+ });
|
|
|
+ for (int i = 0; i < recordList.size(); i++) {
|
|
|
+ PatrolInspectionRecordVo record = new PatrolInspectionRecordVo();
|
|
|
+ record.setId(recordList.get(i).getId());
|
|
|
+ record.setSiteNubmber(recordList.get(i).getSiteNubmber());
|
|
|
+ record.setSiteType(recordList.get(i).getSiteType());
|
|
|
+ record.setAreaName(recordList.get(i).getAreaName());
|
|
|
+ record.setSiteName(recordList.get(i).getSiteName());
|
|
|
+ record.setName(recordList.get(i).getName());
|
|
|
+ record.setPhone(recordList.get(i).getPhone());
|
|
|
+ record.setPlanType(recordList.get(i).getPlanType());
|
|
|
+ record.setSiteStatus(recordList.get(i).getSiteStatus());
|
|
|
+ record.setLongitude(recordList.get(i).getLongitude());
|
|
|
+ record.setLatitude(recordList.get(i).getLatitude());
|
|
|
+ record.setStartDate(recordList.get(i).getStartDate());
|
|
|
+ record.setEndDate(recordList.get(i).getEndDate());
|
|
|
+ record.setCreateTime(recordList.get(i).getCreateTime());
|
|
|
+ record.setPlanId(recordList.get(i).getPlanId());
|
|
|
+ record.setPlanSonId(recordList.get(i).getPlanSonId());
|
|
|
+ record.setSiteId(recordList.get(i).getSiteId());
|
|
|
+ record.setTenantId(recordList.get(i).getTenantId());
|
|
|
+ record.setCompanyId(recordList.get(i).getCompanyId());
|
|
|
+ record.setCreator(recordList.get(i).getCreator());
|
|
|
+ record.setRemarks(recordList.get(i).getRemarks());
|
|
|
+ record.setContentCount(0);
|
|
|
+ for (int j = 0; j < dataCountVoList.size(); j++) {
|
|
|
+ if (recordList.get(i).getSiteId() == dataCountVoList.get(i).getId()) {
|
|
|
+ record.setContentCount(dataCountVoList.get(i).getListCount());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ list.add(record);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<Integer> getpersonId() {
|
|
|
+ LambdaQueryWrapper<PatrolInspectionPersonnel> queryWrapper = Wrappers.lambdaQuery();
|
|
|
+ queryWrapper.eq(PatrolInspectionPersonnel::getEnable, 1)
|
|
|
+ .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());
|
|
|
+ }
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
@Override
|
|
|
public Integer planSiteSonCount(Integer planSonId, Integer inspectionStatus) {
|
|
@@ -377,7 +468,7 @@ public class PatrolInspectionPlanSonServiceImpl extends AbstractCrudService<Patr
|
|
|
LambdaQueryWrapper<PatrolInspectionContent> queryWrapperOne = Wrappers.lambdaQuery();
|
|
|
queryWrapperOne.eq(PatrolInspectionContent::getEnable, 1)
|
|
|
.in(PatrolInspectionContent::getId, contentIdList);
|
|
|
-// queryWrapperOne.eq(PatrolInspectionContent::getTenantId, SecurityUtils.getTenantId());
|
|
|
+ queryWrapperOne.eq(PatrolInspectionContent::getTenantId, SecurityUtils.getTenantId());
|
|
|
List<PatrolInspectionContent> patrolInspectionContentList = patrolInspectionContentService.list(queryWrapperOne);
|
|
|
List<PatrolInspectionContentVo> patrolInspectionContentVoList = new ArrayList<>();
|
|
|
if (patrolInspectionContentList.size() > 0) {
|