|
@@ -408,140 +408,150 @@ public class PatrolInspectionPlanSonServiceImpl extends AbstractCrudService<Patr
|
|
|
List<PatrolInspectionPlanSon> list = patrolInspectionPlanSonMapper.selectInspectionPlanSonData(datetime1,datetime2);
|
|
|
if(list.size() <=0){
|
|
|
LOGGER.info("当前时间向前一小时没有漏检记录");
|
|
|
- }
|
|
|
- List<Integer> sonIdlist = new ArrayList<>();
|
|
|
- for (int i = 0; i < list.size(); i++) {
|
|
|
- sonIdlist.add(list.get(i).getId());
|
|
|
- }
|
|
|
- LambdaQueryWrapper<PatrolInspectionPlanSiteSon> queryWrapper = Wrappers.lambdaQuery();
|
|
|
- queryWrapper.in(PatrolInspectionPlanSiteSon::getPlanId,sonIdlist)
|
|
|
- .eq(PatrolInspectionPlanSiteSon::getInspectionStatus,1);
|
|
|
- List<PatrolInspectionPlanSiteSon> siteSonList = patrolInspectionPlanSiteSonService.list(queryWrapper);
|
|
|
- if(CollectionUtils.isNotEmpty(siteSonList)){
|
|
|
- List<Integer> siteIdList = new ArrayList<>();
|
|
|
- List<Integer> noSonIdList = new ArrayList<>();
|
|
|
- for (int i = 0; i < siteSonList.size(); i++) {
|
|
|
- siteIdList.add(siteSonList.get(i).getSiteId());
|
|
|
- noSonIdList.add(siteSonList.get(i).getPlanId());
|
|
|
- }
|
|
|
- //获取巡检地点
|
|
|
- LOGGER.info("获取巡检地点");
|
|
|
- LambdaQueryWrapper<PatrolInspectionSite> queryWrapper1 = Wrappers.lambdaQuery();
|
|
|
- queryWrapper1.in(PatrolInspectionSite::getId,siteIdList)
|
|
|
- .eq(PatrolInspectionSite::getEnable,1);
|
|
|
- List<PatrolInspectionSite> siteList = patrolInspectionSiteService.list(queryWrapper1);
|
|
|
- if(siteList.size() <= 0){
|
|
|
- LOGGER.info("查询巡检地点记录为空");
|
|
|
- }
|
|
|
- //获取巡检子计划
|
|
|
- LambdaQueryWrapper<PatrolInspectionPlanSon> planSonQueryWrapper = Wrappers.lambdaQuery();
|
|
|
- planSonQueryWrapper.in(PatrolInspectionPlanSon::getId,noSonIdList);
|
|
|
- List<PatrolInspectionPlanSon> noPlanSonList = this.list(planSonQueryWrapper);
|
|
|
- List<Integer> planIdList = new ArrayList<>();
|
|
|
- List<Integer> personnelList = new ArrayList<>();
|
|
|
- List<Integer> areaList = new ArrayList<>();
|
|
|
- for (int i = 0; i < noPlanSonList.size(); i++) {
|
|
|
- planIdList.add(noPlanSonList.get(i).getPlanId());
|
|
|
- personnelList.add(noPlanSonList.get(i).getPersonnelId());
|
|
|
- areaList.add(noPlanSonList.get(i).getAreaId());
|
|
|
- }
|
|
|
-
|
|
|
- //获取巡检计划
|
|
|
- List<PatrolInspectionPlan> noPlanIdList = patrolInspectionPlanMapper.selectNoPlanList(planIdList);
|
|
|
- //获取巡检人员
|
|
|
- LOGGER.info("获取巡检人员");
|
|
|
- LambdaQueryWrapper<PatrolInspectionPersonnel> personnelQueryWrapper = Wrappers.lambdaQuery();
|
|
|
- personnelQueryWrapper.in(PatrolInspectionPersonnel::getId,personnelList)
|
|
|
- .eq(PatrolInspectionPersonnel::getEnable,1);
|
|
|
- List<PatrolInspectionPersonnel> inspectionPersonnelList = patrolInspectionPersonnelService.list(personnelQueryWrapper);
|
|
|
- if(inspectionPersonnelList.size() <= 0){
|
|
|
- LOGGER.info("巡检人员信息不存在");
|
|
|
- }
|
|
|
- //获取巡检区域
|
|
|
- LambdaQueryWrapper<PatrolInspectionArea> queryWrapperOne = Wrappers.lambdaQuery();
|
|
|
- queryWrapperOne.in(PatrolInspectionArea::getId, areaList)
|
|
|
- .eq(PatrolInspectionArea::getEnable,1);
|
|
|
- List<PatrolInspectionArea> areaInfoList = patrolInspectionAreaService.list(queryWrapperOne);
|
|
|
- if(areaInfoList.size() <= 0){
|
|
|
- LOGGER.info("巡检区域不存在");
|
|
|
+ }else{
|
|
|
+ List<Integer> sonIdlist = new ArrayList<>();
|
|
|
+ for (int i = 0; i < list.size(); i++) {
|
|
|
+ sonIdlist.add(list.get(i).getId());
|
|
|
}
|
|
|
+ LambdaQueryWrapper<PatrolInspectionPlanSiteSon> queryWrapper = Wrappers.lambdaQuery();
|
|
|
+ queryWrapper.in(PatrolInspectionPlanSiteSon::getPlanId,sonIdlist)
|
|
|
+ .eq(PatrolInspectionPlanSiteSon::getInspectionStatus,1);
|
|
|
+ List<PatrolInspectionPlanSiteSon> siteSonList = patrolInspectionPlanSiteSonService.list(queryWrapper);
|
|
|
+ if(CollectionUtils.isNotEmpty(siteSonList)){
|
|
|
+ List<Integer> siteIdList = new ArrayList<>();
|
|
|
+ List<Integer> noSonIdList = new ArrayList<>();
|
|
|
+ for (int i = 0; i < siteSonList.size(); i++) {
|
|
|
+ siteIdList.add(siteSonList.get(i).getSiteId());
|
|
|
+ noSonIdList.add(siteSonList.get(i).getPlanId());
|
|
|
+ }
|
|
|
+ //获取巡检地点
|
|
|
+ LOGGER.info("获取巡检地点");
|
|
|
+ LambdaQueryWrapper<PatrolInspectionSite> queryWrapper1 = Wrappers.lambdaQuery();
|
|
|
+ if(CollectionUtils.isNotEmpty(siteIdList)){
|
|
|
+ queryWrapper1.in(PatrolInspectionSite::getId,siteIdList)
|
|
|
+ .eq(PatrolInspectionSite::getEnable,1);
|
|
|
+ }
|
|
|
+ List<PatrolInspectionSite> siteList = patrolInspectionSiteService.list(queryWrapper1);
|
|
|
+ if(siteList.size() <= 0){
|
|
|
+ LOGGER.info("查询巡检地点记录为空");
|
|
|
+ }
|
|
|
+ //获取巡检子计划
|
|
|
+ LambdaQueryWrapper<PatrolInspectionPlanSon> planSonQueryWrapper = Wrappers.lambdaQuery();
|
|
|
+ if(CollectionUtils.isNotEmpty(noSonIdList)){
|
|
|
+ planSonQueryWrapper.in(PatrolInspectionPlanSon::getId,noSonIdList);
|
|
|
+ }
|
|
|
+ List<PatrolInspectionPlanSon> noPlanSonList = this.list(planSonQueryWrapper);
|
|
|
+ List<Integer> planIdList = new ArrayList<>();
|
|
|
+ List<Integer> personnelList = new ArrayList<>();
|
|
|
+ List<Integer> areaList = new ArrayList<>();
|
|
|
+ for (int i = 0; i < noPlanSonList.size(); i++) {
|
|
|
+ planIdList.add(noPlanSonList.get(i).getPlanId());
|
|
|
+ personnelList.add(noPlanSonList.get(i).getPersonnelId());
|
|
|
+ areaList.add(noPlanSonList.get(i).getAreaId());
|
|
|
+ }
|
|
|
|
|
|
- for (int i = 0; i < siteSonList.size(); i++) {
|
|
|
- PatrolInspectionAbnormal patrolInspectionAbnormal = new PatrolInspectionAbnormal();
|
|
|
- Integer siteId = siteSonList.get(i).getSiteId();
|
|
|
- Integer planSonId = siteSonList.get(i).getPlanId();
|
|
|
- for (int j = 0; j < siteList.size(); j++) {
|
|
|
- if(siteId.equals(siteList.get(j).getId())){
|
|
|
- patrolInspectionAbnormal.setSiteNubmber(siteList.get(j).getSiteNubmber());
|
|
|
- patrolInspectionAbnormal.setSiteType(siteList.get(j).getSiteType());
|
|
|
- patrolInspectionAbnormal.setSiteName(siteList.get(j).getSiteName());
|
|
|
- patrolInspectionAbnormal.setLongitude(siteList.get(j).getLongitude());
|
|
|
- patrolInspectionAbnormal.setLatitude(siteList.get(j).getLatitude());
|
|
|
- patrolInspectionAbnormal.setSiteId(siteList.get(j).getId());
|
|
|
- patrolInspectionAbnormal.setCompanyId(siteList.get(j).getCompanyId());
|
|
|
- break;
|
|
|
- }
|
|
|
+ //获取巡检计划
|
|
|
+ List<PatrolInspectionPlan> noPlanIdList = patrolInspectionPlanMapper.selectNoPlanList(planIdList);
|
|
|
+ //获取巡检人员
|
|
|
+ LOGGER.info("获取巡检人员");
|
|
|
+ LambdaQueryWrapper<PatrolInspectionPersonnel> personnelQueryWrapper = Wrappers.lambdaQuery();
|
|
|
+ if(CollectionUtils.isNotEmpty(personnelList)){
|
|
|
+ personnelQueryWrapper.in(PatrolInspectionPersonnel::getId,personnelList)
|
|
|
+ .eq(PatrolInspectionPersonnel::getEnable,1);
|
|
|
+ }
|
|
|
+ List<PatrolInspectionPersonnel> inspectionPersonnelList = patrolInspectionPersonnelService.list(personnelQueryWrapper);
|
|
|
+ if(inspectionPersonnelList.size() <= 0){
|
|
|
+ LOGGER.info("巡检人员信息不存在");
|
|
|
+ }
|
|
|
+ //获取巡检区域
|
|
|
+ LambdaQueryWrapper<PatrolInspectionArea> queryWrapperOne = Wrappers.lambdaQuery();
|
|
|
+ if(CollectionUtils.isNotEmpty(areaList)){
|
|
|
+ queryWrapperOne.in(PatrolInspectionArea::getId, areaList)
|
|
|
+ .eq(PatrolInspectionArea::getEnable,1);
|
|
|
+ }
|
|
|
+ List<PatrolInspectionArea> areaInfoList = patrolInspectionAreaService.list(queryWrapperOne);
|
|
|
+ if(areaInfoList.size() <= 0){
|
|
|
+ LOGGER.info("巡检区域不存在");
|
|
|
}
|
|
|
|
|
|
- for (int j = 0; j < noPlanSonList.size(); j++) {
|
|
|
- if(planSonId.equals(noPlanSonList.get(j).getId())){
|
|
|
- patrolInspectionAbnormal.setPlanId(noPlanSonList.get(j).getPlanId());
|
|
|
- patrolInspectionAbnormal.setPlanSonId(noPlanSonList.get(j).getId());
|
|
|
- patrolInspectionAbnormal.setTenantId(noPlanSonList.get(j).getTenantId());
|
|
|
- patrolInspectionAbnormal.setPlanType(noPlanSonList.get(j).getPlanType());
|
|
|
- Integer planType = noPlanSonList.get(j).getPlanType();
|
|
|
- String startDate = null;
|
|
|
- String endDate = null;
|
|
|
- if (planType.equals(1)) {
|
|
|
- startDate = df1.format(noPlanSonList.get(j).getInspectionDate()) + "T" + noPlanSonList.get(j).getStartTime();
|
|
|
- endDate = df1.format(noPlanSonList.get(j).getInspectionDate()) + "T" + noPlanSonList.get(j).getEndTime();
|
|
|
- } else {
|
|
|
- startDate = df1.format(noPlanSonList.get(j).getStartDate()) + "T" + noPlanSonList.get(j).getStartTime();
|
|
|
- endDate = df1.format(noPlanSonList.get(j).getEndDate()) + "T" + noPlanSonList.get(j).getEndTime();
|
|
|
+ for (int i = 0; i < siteSonList.size(); i++) {
|
|
|
+ PatrolInspectionAbnormal patrolInspectionAbnormal = new PatrolInspectionAbnormal();
|
|
|
+ Integer siteId = siteSonList.get(i).getSiteId();
|
|
|
+ Integer planSonId = siteSonList.get(i).getPlanId();
|
|
|
+ for (int j = 0; j < siteList.size(); j++) {
|
|
|
+ if(siteId.equals(siteList.get(j).getId())){
|
|
|
+ patrolInspectionAbnormal.setSiteNubmber(siteList.get(j).getSiteNubmber());
|
|
|
+ patrolInspectionAbnormal.setSiteType(siteList.get(j).getSiteType());
|
|
|
+ patrolInspectionAbnormal.setSiteName(siteList.get(j).getSiteName());
|
|
|
+ patrolInspectionAbnormal.setLongitude(siteList.get(j).getLongitude());
|
|
|
+ patrolInspectionAbnormal.setLatitude(siteList.get(j).getLatitude());
|
|
|
+ patrolInspectionAbnormal.setSiteId(siteList.get(j).getId());
|
|
|
+ patrolInspectionAbnormal.setCompanyId(siteList.get(j).getCompanyId());
|
|
|
+ break;
|
|
|
}
|
|
|
+ }
|
|
|
|
|
|
- patrolInspectionAbnormal.setStartDate(LocalDateTime.parse(startDate));
|
|
|
- patrolInspectionAbnormal.setEndDate(LocalDateTime.parse(endDate));
|
|
|
+ for (int j = 0; j < noPlanSonList.size(); j++) {
|
|
|
+ if(planSonId.equals(noPlanSonList.get(j).getId())){
|
|
|
+ patrolInspectionAbnormal.setPlanId(noPlanSonList.get(j).getPlanId());
|
|
|
+ patrolInspectionAbnormal.setPlanSonId(noPlanSonList.get(j).getId());
|
|
|
+ patrolInspectionAbnormal.setTenantId(noPlanSonList.get(j).getTenantId());
|
|
|
+ patrolInspectionAbnormal.setPlanType(noPlanSonList.get(j).getPlanType());
|
|
|
+ Integer planType = noPlanSonList.get(j).getPlanType();
|
|
|
+ String startDate = null;
|
|
|
+ String endDate = null;
|
|
|
+ if (planType.equals(1)) {
|
|
|
+ startDate = df1.format(noPlanSonList.get(j).getInspectionDate()) + "T" + noPlanSonList.get(j).getStartTime();
|
|
|
+ endDate = df1.format(noPlanSonList.get(j).getInspectionDate()) + "T" + noPlanSonList.get(j).getEndTime();
|
|
|
+ } else {
|
|
|
+ startDate = df1.format(noPlanSonList.get(j).getStartDate()) + "T" + noPlanSonList.get(j).getStartTime();
|
|
|
+ endDate = df1.format(noPlanSonList.get(j).getEndDate()) + "T" + noPlanSonList.get(j).getEndTime();
|
|
|
+ }
|
|
|
|
|
|
- Integer noAreaId = noPlanSonList.get(j).getAreaId();
|
|
|
- for (int k = 0; k < areaInfoList.size(); k++) {
|
|
|
- if(noAreaId.equals(areaInfoList.get(k).getId())){
|
|
|
- patrolInspectionAbnormal.setAreaName(areaInfoList.get(k).getAreaName());
|
|
|
- break;
|
|
|
+ patrolInspectionAbnormal.setStartDate(LocalDateTime.parse(startDate));
|
|
|
+ patrolInspectionAbnormal.setEndDate(LocalDateTime.parse(endDate));
|
|
|
+
|
|
|
+ Integer noAreaId = noPlanSonList.get(j).getAreaId();
|
|
|
+ for (int k = 0; k < areaInfoList.size(); k++) {
|
|
|
+ if(noAreaId.equals(areaInfoList.get(k).getId())){
|
|
|
+ patrolInspectionAbnormal.setAreaName(areaInfoList.get(k).getAreaName());
|
|
|
+ break;
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- Integer noPersonnelId = noPlanSonList.get(j).getPersonnelId();
|
|
|
- for (int k = 0; k < inspectionPersonnelList.size(); k++) {
|
|
|
- if(noPersonnelId.equals(inspectionPersonnelList.get(k).getId())){
|
|
|
- patrolInspectionAbnormal.setName(inspectionPersonnelList.get(k).getFullName());
|
|
|
- patrolInspectionAbnormal.setPhone(inspectionPersonnelList.get(k).getPhoneNumber());
|
|
|
- break;
|
|
|
+ Integer noPersonnelId = noPlanSonList.get(j).getPersonnelId();
|
|
|
+ for (int k = 0; k < inspectionPersonnelList.size(); k++) {
|
|
|
+ if(noPersonnelId.equals(inspectionPersonnelList.get(k).getId())){
|
|
|
+ patrolInspectionAbnormal.setName(inspectionPersonnelList.get(k).getFullName());
|
|
|
+ patrolInspectionAbnormal.setPhone(inspectionPersonnelList.get(k).getPhoneNumber());
|
|
|
+ break;
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- Integer planId = noPlanSonList.get(j).getPlanId();
|
|
|
- for (int k = 0; k < noPlanIdList.size(); k++) {
|
|
|
- if(planId.equals(noPlanIdList.get(k).getId())){
|
|
|
- patrolInspectionAbnormal.setRouteId(noPlanIdList.get(k).getRouteId());
|
|
|
- break;
|
|
|
+ Integer planId = noPlanSonList.get(j).getPlanId();
|
|
|
+ for (int k = 0; k < noPlanIdList.size(); k++) {
|
|
|
+ if(planId.equals(noPlanIdList.get(k).getId())){
|
|
|
+ patrolInspectionAbnormal.setRouteId(noPlanIdList.get(k).getRouteId());
|
|
|
+ break;
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
- break;
|
|
|
+ break;
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- patrolInspectionAbnormal.setAbnormalStatus(1);
|
|
|
- patrolInspectionAbnormal.setCreateTime(LocalDateTime.now());
|
|
|
- patrolInspectionAbnormal.setCreator("YT_admin");
|
|
|
+ patrolInspectionAbnormal.setAbnormalStatus(1);
|
|
|
+ patrolInspectionAbnormal.setCreateTime(LocalDateTime.now());
|
|
|
+ patrolInspectionAbnormal.setCreator("YT_admin");
|
|
|
|
|
|
|
|
|
- patrolInspectionAbnormalService.save(patrolInspectionAbnormal);
|
|
|
+ patrolInspectionAbnormalService.save(patrolInspectionAbnormal);
|
|
|
|
|
|
- LOGGER.info("巡检漏检定时任务 end");
|
|
|
+ LOGGER.info("巡检漏检定时任务 end");
|
|
|
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|