|  | @@ -3,6 +3,7 @@ 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.core.exception.BusinessException;
 | 
	
		
			
				|  |  | +import com.usky.common.core.util.StringUtils;
 | 
	
		
			
				|  |  |  import com.usky.common.mybatis.core.AbstractCrudService;
 | 
	
		
			
				|  |  |  import com.usky.common.security.utils.SecurityUtils;
 | 
	
		
			
				|  |  |  import com.usky.fire.domain.*;
 | 
	
	
		
			
				|  | @@ -104,7 +105,7 @@ public class PatrolInspectionPlanSonServiceImpl extends AbstractCrudService<Patr
 | 
	
		
			
				|  |  |      public List<PatrolInspectionPlanSonVo> patrolInspectionPlan(String currentDate, String sort) {
 | 
	
		
			
				|  |  |          List<PatrolInspectionPlanSonVo> planList = new ArrayList<>();
 | 
	
		
			
				|  |  |          List<Integer> personnelIdList = this.getpersonId();
 | 
	
		
			
				|  |  | -        if (personnelIdList.size()>0){
 | 
	
		
			
				|  |  | +        if (personnelIdList.size() > 0) {
 | 
	
		
			
				|  |  |              LambdaQueryWrapper<PatrolInspectionPlanSchedule> queryWrapper = Wrappers.lambdaQuery();
 | 
	
		
			
				|  |  |              queryWrapper.select(PatrolInspectionPlanSchedule::getPlanId)
 | 
	
		
			
				|  |  |                      .in(PatrolInspectionPlanSchedule::getPersonnelId, personnelIdList)
 | 
	
	
		
			
				|  | @@ -127,11 +128,10 @@ public class PatrolInspectionPlanSonServiceImpl extends AbstractCrudService<Patr
 | 
	
		
			
				|  |  |          SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
 | 
	
		
			
				|  |  |          List<PatrolInspectionPlanSonVo> list = new ArrayList<>();
 | 
	
		
			
				|  |  |          List<Integer> personnelIdList = this.getpersonId();
 | 
	
		
			
				|  |  | -        if (personnelIdList.size()>0){
 | 
	
		
			
				|  |  | +        if (personnelIdList.size() > 0) {
 | 
	
		
			
				|  |  |              LambdaQueryWrapper<PatrolInspectionSite> queryWrapper = Wrappers.lambdaQuery();
 | 
	
		
			
				|  |  |              queryWrapper.eq(PatrolInspectionSite::getEnable, 1);
 | 
	
		
			
				|  |  | -            queryWrapper
 | 
	
		
			
				|  |  | -                    .eq(PatrolInspectionSite::getTenantId, SecurityUtils.getTenantId())
 | 
	
		
			
				|  |  | +            queryWrapper.eq(PatrolInspectionSite::getTenantId, SecurityUtils.getTenantId())
 | 
	
		
			
				|  |  |                      .eq(PatrolInspectionSite::getSiteNubmber, siteNubmber);
 | 
	
		
			
				|  |  |              List<PatrolInspectionSite> siteList = patrolInspectionSiteService.list(queryWrapper);
 | 
	
		
			
				|  |  |              if (siteList.size() <= 0) {
 | 
	
	
		
			
				|  | @@ -174,25 +174,51 @@ public class PatrolInspectionPlanSonServiceImpl extends AbstractCrudService<Patr
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @Override
 | 
	
		
			
				|  |  | -    public Map<String, Object> siteDetails(Integer siteId, String siteNubmber) {
 | 
	
		
			
				|  |  | +    public Map<String, Object> siteDetails(Integer siteId, String siteNubmber, Integer planSonId) {
 | 
	
		
			
				|  |  | +        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
 | 
	
		
			
				|  |  | +        List<Integer> personnelIdList = this.getpersonId();
 | 
	
		
			
				|  |  | +        if (personnelIdList.size() <= 0) {
 | 
	
		
			
				|  |  | +            throw new BusinessException("该地点不在计划中");
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  |          LambdaQueryWrapper<PatrolInspectionSite> queryWrapper = Wrappers.lambdaQuery();
 | 
	
		
			
				|  |  |          queryWrapper.eq(PatrolInspectionSite::getTenantId, SecurityUtils.getTenantId());
 | 
	
		
			
				|  |  |          queryWrapper.eq(PatrolInspectionSite::getEnable, 1);
 | 
	
		
			
				|  |  |          if (siteId != 0 && siteId != null) {
 | 
	
		
			
				|  |  |              queryWrapper.eq(PatrolInspectionSite::getId, siteId);
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | -        if (siteNubmber != null && !"".equals(siteNubmber)) {
 | 
	
		
			
				|  |  | +        if (StringUtils.isNotBlank(siteNubmber)) {
 | 
	
		
			
				|  |  |              queryWrapper.eq(PatrolInspectionSite::getSiteNubmber, siteNubmber);
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          List<PatrolInspectionSite> siteList = patrolInspectionSiteService.list(queryWrapper);
 | 
	
		
			
				|  |  |          if (siteList.size() <= 0) {
 | 
	
		
			
				|  |  |              throw new BusinessException("无效地点,请联系管理人员添加点位");
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | +        int planSonSiteCount = patrolInspectionPlanMapper.planSiteCount(personnelIdList, siteList.get(0).getId(), dateFormat.format(new Date()));
 | 
	
		
			
				|  |  | +        if (planSonSiteCount <= 0) {
 | 
	
		
			
				|  |  | +            throw new BusinessException("此地点尚未采集,请采集该点位");
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +//        List<PatrolInspectionRecordPicture> recordPictureList = new ArrayList<>();
 | 
	
		
			
				|  |  | +//        if (planSonId != null && planSonId != 0) {
 | 
	
		
			
				|  |  | +//            LambdaQueryWrapper<PatrolInspectionRecord> query = Wrappers.lambdaQuery();
 | 
	
		
			
				|  |  | +//            query.eq(PatrolInspectionRecord::getSiteId, siteId)
 | 
	
		
			
				|  |  | +//                    .eq(PatrolInspectionRecord::getPlanSonId, planSonId);
 | 
	
		
			
				|  |  | +//            List<PatrolInspectionRecord> recordList = patrolInspectionRecordMapper.selectList(query);
 | 
	
		
			
				|  |  | +//            if (CollectionUtils.isNotEmpty(recordList)) {
 | 
	
		
			
				|  |  | +//                siteList.get(0).setRemarks(recordList.get(0).getRemarks());
 | 
	
		
			
				|  |  | +//                LambdaQueryWrapper<PatrolInspectionRecordPicture> queryOne = Wrappers.lambdaQuery();
 | 
	
		
			
				|  |  | +//                queryOne.eq(PatrolInspectionRecordPicture::getRecordId, recordList.get(0).getId());
 | 
	
		
			
				|  |  | +//                recordPictureList = patrolInspectionRecordPictureService.list(queryOne);
 | 
	
		
			
				|  |  | +//            }
 | 
	
		
			
				|  |  | +//        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +//        siteList.get(0).setRecordPictureList(recordPictureList);
 | 
	
		
			
				|  |  |          List<PatrolInspectionContentVo> contentList = this.contentList(siteList.get(0).getId());
 | 
	
		
			
				|  |  | +        siteList.get(0).setContentCount(contentList.size());
 | 
	
		
			
				|  |  | +        siteList.get(0).setPlanSonId(planSonId);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |          Map<String, Object> map = new HashMap<>();
 | 
	
		
			
				|  |  |          map.put("siteList", siteList);
 | 
	
		
			
				|  |  |          map.put("contentList", contentList);
 | 
	
		
			
				|  |  | -        map.put("contentCount", contentList.size());
 | 
	
		
			
				|  |  |          return map;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -350,7 +376,7 @@ public class PatrolInspectionPlanSonServiceImpl extends AbstractCrudService<Patr
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @Override
 | 
	
		
			
				|  |  | -    public List<PatrolInspectionRecordVo> recordList(String currentDate, String sort, Integer id) {
 | 
	
		
			
				|  |  | +    public List<PatrolInspectionRecordVo> recordList(String currentDate, String sort, Integer id,Integer planSonId,Integer siteId) {
 | 
	
		
			
				|  |  |          List<Integer> personnelIdList = this.getpersonId();
 | 
	
		
			
				|  |  |          LambdaQueryWrapper<PatrolInspectionPlanSchedule> queryWrapper = Wrappers.lambdaQuery();
 | 
	
		
			
				|  |  |          queryWrapper.select(PatrolInspectionPlanSchedule::getPlanId)
 | 
	
	
		
			
				|  | @@ -369,6 +395,12 @@ public class PatrolInspectionPlanSonServiceImpl extends AbstractCrudService<Patr
 | 
	
		
			
				|  |  |              if (id != null && id != 0) {
 | 
	
		
			
				|  |  |                  queryWrapperOne.eq(PatrolInspectionRecord::getId, id);
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  | +            if (planSonId != null && planSonId != 0) {
 | 
	
		
			
				|  |  | +                queryWrapperOne.eq(PatrolInspectionRecord::getPlanSonId, planSonId);
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            if (siteId != null && siteId != 0) {
 | 
	
		
			
				|  |  | +                queryWrapperOne.eq(PatrolInspectionRecord::getSiteId, siteId);
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  |              if (sort.equals("ASC")) {
 | 
	
		
			
				|  |  |                  queryWrapperOne.orderByAsc(PatrolInspectionRecord::getId);
 | 
	
		
			
				|  |  |              } else {
 | 
	
	
		
			
				|  | @@ -377,9 +409,15 @@ public class PatrolInspectionPlanSonServiceImpl extends AbstractCrudService<Patr
 | 
	
		
			
				|  |  |              List<PatrolInspectionRecord> recordList = patrolInspectionRecordMapper.selectList(queryWrapperOne);
 | 
	
		
			
				|  |  |              if (recordList.size() > 0) {
 | 
	
		
			
				|  |  |                  List<Integer> siteIdList = new ArrayList<>();
 | 
	
		
			
				|  |  | +                List<Integer> recordIdList = new ArrayList<>();
 | 
	
		
			
				|  |  |                  for (int i = 0; i < recordList.size(); i++) {
 | 
	
		
			
				|  |  |                      siteIdList.add(recordList.get(i).getSiteId());
 | 
	
		
			
				|  |  | +                    recordIdList.add(recordList.get(i).getId());
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  | +                LambdaQueryWrapper<PatrolInspectionRecordPicture> queryOne = Wrappers.lambdaQuery();
 | 
	
		
			
				|  |  | +                queryOne.in(PatrolInspectionRecordPicture::getRecordId, recordIdList);
 | 
	
		
			
				|  |  | +                List<PatrolInspectionRecordPicture> recordPictureList = patrolInspectionRecordPictureService.list(queryOne);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |                  LambdaQueryWrapper<PatrolInspectionSiteContent> queryWrapperTwo = Wrappers.lambdaQuery();
 | 
	
		
			
				|  |  |                  queryWrapperTwo.in(PatrolInspectionSiteContent::getSiteId, siteIdList);
 | 
	
		
			
				|  |  |                  List<PatrolInspectionSiteContent> siteContentLsit = patrolInspectionSiteContentService.list(queryWrapperTwo);
 | 
	
	
		
			
				|  | @@ -418,6 +456,17 @@ public class PatrolInspectionPlanSonServiceImpl extends AbstractCrudService<Patr
 | 
	
		
			
				|  |  |                      record.setCreator(recordList.get(i).getCreator());
 | 
	
		
			
				|  |  |                      record.setRemarks(recordList.get(i).getRemarks());
 | 
	
		
			
				|  |  |                      record.setContentCount(0);
 | 
	
		
			
				|  |  | +                    List<PatrolInspectionRecordPicture> PatrolInspectionRecordPictureList = new ArrayList<>();
 | 
	
		
			
				|  |  | +                    for (int j = 0; j < recordPictureList.size(); j++) {
 | 
	
		
			
				|  |  | +                        PatrolInspectionRecordPicture patrolInspectionRecordPicture = new PatrolInspectionRecordPicture();
 | 
	
		
			
				|  |  | +                        if (recordList.get(i).getId() == recordPictureList.get(j).getRecordId()) {
 | 
	
		
			
				|  |  | +                            patrolInspectionRecordPicture.setRecordId(recordPictureList.get(j).getRecordId());
 | 
	
		
			
				|  |  | +                            patrolInspectionRecordPicture.setPictureUrl(recordPictureList.get(j).getPictureUrl());
 | 
	
		
			
				|  |  | +                            patrolInspectionRecordPicture.setId(recordPictureList.get(j).getId());
 | 
	
		
			
				|  |  | +                        }
 | 
	
		
			
				|  |  | +                        PatrolInspectionRecordPictureList.add(patrolInspectionRecordPicture);
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                    record.setRecordPictureList(PatrolInspectionRecordPictureList);
 | 
	
		
			
				|  |  |                      for (int j = 0; j < dataCountVoList.size(); j++) {
 | 
	
		
			
				|  |  |                          if (recordList.get(i).getSiteId() == dataCountVoList.get(i).getId()) {
 | 
	
		
			
				|  |  |                              record.setContentCount(dataCountVoList.get(i).getListCount());
 | 
	
	
		
			
				|  | @@ -475,6 +524,9 @@ public class PatrolInspectionPlanSonServiceImpl extends AbstractCrudService<Patr
 | 
	
		
			
				|  |  |                              contentOptionVo.setSelectStatus(true);
 | 
	
		
			
				|  |  |                              contentOptionVo.setRemarks(recordOptionList.get(j).getRemarks());
 | 
	
		
			
				|  |  |                          }
 | 
	
		
			
				|  |  | +                        if (contentOptionList.get(i).getContentId()==recordOptionList.get(j).getContentId()){
 | 
	
		
			
				|  |  | +                            contentOptionVo.setContent(recordOptionList.get(i).getContent());
 | 
	
		
			
				|  |  | +                        }
 | 
	
		
			
				|  |  |                      }
 | 
	
		
			
				|  |  |                      contentOptionVoList.add(contentOptionVo);
 | 
	
		
			
				|  |  |                  }
 | 
	
	
		
			
				|  | @@ -624,8 +676,8 @@ public class PatrolInspectionPlanSonServiceImpl extends AbstractCrudService<Patr
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |              //巡检计划名称查询
 | 
	
		
			
				|  |  |              LambdaQueryWrapper<PatrolInspectionPlan> queryWrapperOne = Wrappers.lambdaQuery();
 | 
	
		
			
				|  |  | -            queryWrapperOne.eq(PatrolInspectionPlan::getTenantId, SecurityUtils.getTenantId());
 | 
	
		
			
				|  |  | -            queryWrapperOne.eq(PatrolInspectionPlan::getEnable, 1);
 | 
	
		
			
				|  |  | +//            queryWrapperOne.eq(PatrolInspectionPlan::getTenantId, SecurityUtils.getTenantId());
 | 
	
		
			
				|  |  | +//            queryWrapperOne.eq(PatrolInspectionPlan::getEnable, 1);
 | 
	
		
			
				|  |  |              queryWrapperOne.select(PatrolInspectionPlan::getId, PatrolInspectionPlan::getPlanName);
 | 
	
		
			
				|  |  |              if (planIdList != null && planIdList.size() > 0) {
 | 
	
		
			
				|  |  |                  queryWrapperOne.in(PatrolInspectionPlan::getId, planIdList);
 |