Преглед на файлове

内蒙山洪运维系统-应急系统功能模块开发,增加旗县管理员角色

dylan преди 2 години
родител
ревизия
de70d21389

+ 3 - 3
src/main/java/org/springblade/modules/baseinfo/region/whole/controller/BaseRegionController.java

@@ -121,7 +121,7 @@ public class BaseRegionController extends BladeController {
                 if (Func.isNull(deptRegionEntity)){
                     return R.fail("查询失败");
                 }
-                queryWrapper.eq(BaseRegionInfoEntity::getAdcd,deptRegionEntity.getAdcd());
+                queryWrapper.eq(BaseRegionInfoEntity::getParentCode,deptRegionEntity.getAdcd());
             }else if(BusinessConstant.ROLE_YJ_SERVICE_PERSON.equals(user.getRoleName())){
                 LambdaQueryWrapper<DeptRegionEntity> wrapper = Wrappers.<DeptRegionEntity>query().lambda();
                 wrapper.eq(DeptRegionEntity::getDeptId, Func.toLong(user.getDeptId()));
@@ -130,7 +130,7 @@ public class BaseRegionController extends BladeController {
                 if (Func.isNull(deptRegionEntity)){
                     return R.fail("查询失败");
                 }
-                queryWrapper.eq(BaseRegionInfoEntity::getAdcd,deptRegionEntity.getAdcd());
+                queryWrapper.eq(BaseRegionInfoEntity::getParentCode,deptRegionEntity.getAdcd());
             }else if(BusinessConstant.ROLE_QI_ADMIN.equals(user.getRoleName())){
                 LambdaQueryWrapper<DeptRegionEntity> wrapper = Wrappers.<DeptRegionEntity>query().lambda();
                 wrapper.eq(DeptRegionEntity::getDeptId, Func.toLong(user.getDeptId()));
@@ -139,7 +139,7 @@ public class BaseRegionController extends BladeController {
                 if (Func.isNull(deptRegionEntity)){
                     return R.fail("查询失败");
                 }
-                queryWrapper.eq(BaseRegionInfoEntity::getAdcd,deptRegionEntity.getAdcd());
+                queryWrapper.eq(BaseRegionInfoEntity::getParentCode,deptRegionEntity.getAdcd());
             }else{
                 return R.fail("查询失败");
             }

+ 275 - 236
src/main/java/org/springblade/modules/baseinfo/servicePerson/controller/ServicePersonController.java

@@ -26,8 +26,10 @@ import org.springblade.modules.baseinfo.servicePerson.vo.OrgPersonContactVO;
 import org.springblade.modules.baseinfo.servicePerson.vo.ServicePersonVO;
 import org.springblade.modules.baseinfo.servicePerson.wrapper.ServicePersonWrapper;
 import org.springblade.modules.system.entity.Dept;
+import org.springblade.modules.system.entity.Role;
 import org.springblade.modules.system.entity.User;
 import org.springblade.modules.system.service.IDeptService;
+import org.springblade.modules.system.service.IRoleService;
 import org.springblade.modules.system.service.IUserService;
 import org.springblade.modules.system.vo.UserVO;
 import org.springframework.web.bind.annotation.*;
@@ -51,249 +53,286 @@ import java.util.Objects;
 @AllArgsConstructor
 @Api(value = "项目运维人员管理", tags = "项目运维人员管理")
 public class ServicePersonController extends BladeController {
-	private final IServicePersonService servicePersonService;
-	private final IUserService userService;
-	private final IDeptService deptService;
+    private final IServicePersonService servicePersonService;
+    private final IUserService userService;
+    private final IDeptService deptService;
+    private final IRoleService roleService;
 
-	@GetMapping("/page")
-	@ApiImplicitParams({
-		@ApiImplicitParam(name = "realName", value = "人员名称", paramType = "query", dataType = "string"),
-		@ApiImplicitParam(name = "phone", value = "联系电话", paramType = "query", dataType = "string"),
-	})
-	@ApiOperationSupport(order = 1)
-	@ApiOperation(value = "分页")
-	public R<IPage<UserVO>> orgPersonList(@ApiIgnore User userEntity, Query query) {
-		BladeUser user = AuthUtil.getUser();
-		if (BusinessConstant.ROLE_SYS_ADMIN.equals(user.getRoleName())) {
-			LambdaQueryWrapper<Dept> deptLambdaQueryWrapper = Wrappers.<Dept>query().lambda();
-			deptLambdaQueryWrapper.eq(Dept::getIsDeleted, 0);
-			deptLambdaQueryWrapper.eq(Dept::getParentId, Func.toLong(user.getDeptId()));
-			List<Dept> deptList = deptService.list(deptLambdaQueryWrapper);
-			if (null == deptList || deptList.size() == 0) {
-				return R.data(null);
-			}
-			ArrayList<Long> deptIds = new ArrayList<>();
-			for (Dept dept : deptList) {
-				deptIds.add(dept.getId());
-			}
-			LambdaQueryWrapper<User> wrapper = Wrappers.<User>query().lambda();
-			wrapper.eq(User::getIsDeleted, 0);
-			wrapper.in(User::getDeptId, deptIds);
-			if (userEntity.getRealName() != null) {
-				wrapper.like(User::getRealName, userEntity.getRealName());
-			}
-			if (userEntity.getPhone() != null) {
-				wrapper.like(User::getPhone, userEntity.getPhone());
-			}
-			IPage<User> pages = userService.page(Condition.getPage(query), wrapper);
-			return R.data(ServicePersonWrapper.build().pageVO(pages));
-		} else if (BusinessConstant.ROLE_ORG_ADMIN.equals(user.getRoleName())) {
-			LambdaQueryWrapper<Dept> deptLambdaQueryWrapper = Wrappers.<Dept>query().lambda();
-			deptLambdaQueryWrapper.eq(Dept::getIsDeleted, 0);
-			deptLambdaQueryWrapper.eq(Dept::getParentId, Func.toLong(user.getDeptId()));
-			List<Dept> deptList = deptService.list(deptLambdaQueryWrapper);
-			if (null == deptList || deptList.size() == 0) {
-				return R.data(null);
-			}
-			ArrayList<Long> deptIds = new ArrayList<>();
-			for (Dept dept : deptList) {
-				deptIds.add(dept.getId());
-			}
-			LambdaQueryWrapper<User> wrapper = Wrappers.<User>query().lambda();
-			wrapper.eq(User::getIsDeleted, 0);
-			wrapper.in(User::getDeptId, deptIds);
-			wrapper.eq(User::getPostId, BusinessConstant.POST_ADMIN_ID);
-			if (userEntity.getRealName() != null) {
-				wrapper.like(User::getRealName, userEntity.getRealName());
-			}
-			if (userEntity.getPhone() != null) {
-				wrapper.like(User::getPhone, userEntity.getPhone());
-			}
-			IPage<User> pages = userService.page(Condition.getPage(query), wrapper);
-			return R.data(ServicePersonWrapper.build().pageVO(pages));
-		} else if (BusinessConstant.ROLE_COMPANY_ADMIN.equals(user.getRoleName())) {
-			LambdaQueryWrapper<User> wrapper = Wrappers.<User>query().lambda();
-			wrapper.eq(User::getIsDeleted, 0);
-			wrapper.eq(User::getDeptId, Func.toLong(user.getDeptId()));
-			wrapper.eq(User::getPostId, BusinessConstant.POST_SERVICE_PERSON_ID);
-			if (userEntity.getRealName() != null) {
-				wrapper.like(User::getRealName, userEntity.getRealName());
-			}
-			if (userEntity.getPhone() != null) {
-				wrapper.like(User::getPhone, userEntity.getPhone());
-			}
-			IPage<User> pages = userService.page(Condition.getPage(query), wrapper);
-			return R.data(ServicePersonWrapper.build().pageVO(pages));
-		}
-		return R.data(null);
-	}
+    @GetMapping("/page")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "realName", value = "人员名称", paramType = "query", dataType = "string"),
+            @ApiImplicitParam(name = "phone", value = "联系电话", paramType = "query", dataType = "string"),
+    })
+    @ApiOperationSupport(order = 1)
+    @ApiOperation(value = "分页")
+    public R<IPage<UserVO>> orgPersonList(@ApiIgnore User userEntity, Query query) {
+        BladeUser user = AuthUtil.getUser();
+        if (BusinessConstant.ROLE_SYS_ADMIN.equals(user.getRoleName())) {
+            LambdaQueryWrapper<Dept> deptLambdaQueryWrapper = Wrappers.<Dept>query().lambda();
+            deptLambdaQueryWrapper.eq(Dept::getIsDeleted, 0);
+            deptLambdaQueryWrapper.eq(Dept::getParentId, Func.toLong(user.getDeptId()));
+            List<Dept> deptList = deptService.list(deptLambdaQueryWrapper);
+            if (null == deptList || deptList.size() == 0) {
+                return R.data(null);
+            }
+            ArrayList<Long> deptIds = new ArrayList<>();
+            for (Dept dept : deptList) {
+                deptIds.add(dept.getId());
+            }
+            LambdaQueryWrapper<User> wrapper = Wrappers.<User>query().lambda();
+            wrapper.eq(User::getIsDeleted, 0);
+            wrapper.in(User::getDeptId, deptIds);
+            if (userEntity.getRealName() != null) {
+                wrapper.like(User::getRealName, userEntity.getRealName());
+            }
+            if (userEntity.getPhone() != null) {
+                wrapper.like(User::getPhone, userEntity.getPhone());
+            }
+            IPage<User> pages = userService.page(Condition.getPage(query), wrapper);
+            return R.data(ServicePersonWrapper.build().pageVO(pages));
+        } else if (BusinessConstant.ROLE_ORG_ADMIN.equals(user.getRoleName())) {
+            LambdaQueryWrapper<Dept> deptLambdaQueryWrapper = Wrappers.<Dept>query().lambda();
+            deptLambdaQueryWrapper.eq(Dept::getIsDeleted, 0);
+            deptLambdaQueryWrapper.eq(Dept::getParentId, Func.toLong(user.getDeptId()));
+            List<Dept> deptList = deptService.list(deptLambdaQueryWrapper);
+            if (null == deptList || deptList.size() == 0) {
+                return R.data(null);
+            }
+            ArrayList<Long> deptIds = new ArrayList<>();
+            for (Dept dept : deptList) {
+                deptIds.add(dept.getId());
+            }
+            LambdaQueryWrapper<User> wrapper = Wrappers.<User>query().lambda();
+            wrapper.eq(User::getIsDeleted, 0);
+            wrapper.in(User::getDeptId, deptIds);
+            wrapper.eq(User::getPostId, BusinessConstant.POST_ADMIN_ID);
+            if (userEntity.getRealName() != null) {
+                wrapper.like(User::getRealName, userEntity.getRealName());
+            }
+            if (userEntity.getPhone() != null) {
+                wrapper.like(User::getPhone, userEntity.getPhone());
+            }
+            IPage<User> pages = userService.page(Condition.getPage(query), wrapper);
+            return R.data(ServicePersonWrapper.build().pageVO(pages));
+        } else if (BusinessConstant.ROLE_COMPANY_ADMIN.equals(user.getRoleName())) {
+            LambdaQueryWrapper<User> wrapper = Wrappers.<User>query().lambda();
+            wrapper.eq(User::getIsDeleted, 0);
+            wrapper.eq(User::getDeptId, Func.toLong(user.getDeptId()));
+            wrapper.eq(User::getPostId, BusinessConstant.POST_SERVICE_PERSON_ID);
+            if (userEntity.getRealName() != null) {
+                wrapper.like(User::getRealName, userEntity.getRealName());
+            }
+            if (userEntity.getPhone() != null) {
+                wrapper.like(User::getPhone, userEntity.getPhone());
+            }
+            IPage<User> pages = userService.page(Condition.getPage(query), wrapper);
+            return R.data(ServicePersonWrapper.build().pageVO(pages));
+        }
+        return R.data(null);
+    }
 
 
-	@GetMapping("/list")
-	@ApiOperationSupport(order = 2)
-	@ApiOperation(value = "列表")
-	public R<List<User>> list() {
-		BladeUser user = AuthUtil.getUser();
-		LambdaQueryWrapper<User> wrapper = Wrappers.<User>query().lambda();
-		wrapper.eq(User::getIsDeleted, 0);
-		wrapper.eq(User::getDeptId, Func.toLong(user.getDeptId()));
-		List<User> lists = userService.list(wrapper);
-		return R.data(lists);
-	}
+    @GetMapping("/list")
+    @ApiOperationSupport(order = 2)
+    @ApiOperation(value = "列表")
+    public R<List<User>> list() {
+        BladeUser user = AuthUtil.getUser();
+        LambdaQueryWrapper<User> wrapper = Wrappers.<User>query().lambda();
+        wrapper.eq(User::getIsDeleted, 0);
+        wrapper.eq(User::getDeptId, Func.toLong(user.getDeptId()));
+        List<User> lists = userService.list(wrapper);
+        return R.data(lists);
+    }
 
-	/**
-	 * 详情
-	 */
-	@GetMapping("/detail")
-	@ApiOperationSupport(order = 3)
-	@ApiOperation(value = "详情", notes = "传入 User")
-	public R<User> detail(User user) {
-		User detail = userService.getById(user.getId());
-		return R.data(detail);
-	}
+    @GetMapping("/yw/list")
+    @ApiOperationSupport(order = 2)
+    @ApiOperation(value = "列表")
+    public R<List<User>> ywList() {
+        BladeUser user = AuthUtil.getUser();
+        LambdaQueryWrapper<Role> roleWrapper = Wrappers.<Role>query().lambda();
+        roleWrapper.eq(Role::getRoleAlias, BusinessConstant.ROLE_COMPANY_SERVICE_PERSON);
+        roleWrapper.last("limit 1");
+        Role role = roleService.getOne(roleWrapper);
+        if (Func.isNull(role)) {
+            return R.fail("查询失败");
+        }
+        LambdaQueryWrapper<User> wrapper = Wrappers.<User>query().lambda();
+        wrapper.eq(User::getDeptId, Func.toLong(user.getDeptId()));
+        wrapper.eq(User::getRoleId, Func.toStr(role.getId()));
+        List<User> lists = userService.list(wrapper);
+        return R.data(lists);
+    }
 
-	/**
-	 * 新增
-	 */
-	@PostMapping("/save")
-	@ApiOperationSupport(order = 4)
-	@ApiOperation(value = "新增", notes = "传入 User")
-	public R save(@RequestBody User userEntity) {
-		LambdaQueryWrapper<User> wrapper = Wrappers.<User>query().lambda();
-		wrapper.eq(User::getAccount, userEntity.getAccount());
-		wrapper.eq(User::getIsDeleted, 0);
-		List<User> list = userService.list(wrapper);
-		if (null != list && list.size() > 0) {
-			return R.fail("帐号已经存在");
-		}
-		userEntity.setName(userEntity.getRealName());
-		userEntity.setPassword(DigestUtil.encrypt(userEntity.getAccount() + BusinessConstant.ACCOUNT_PW_SUFFIX));
-		BladeUser user = AuthUtil.getUser();
-		if (BusinessConstant.ROLE_SYS_ADMIN.equals(user.getRoleName())) {
-			userEntity.setRoleId(BusinessConstant.ROLE_ORG_ADMIN_ID);
-			userEntity.setPostId(BusinessConstant.POST_ADMIN_ID);
-		} else if (BusinessConstant.ROLE_ORG_ADMIN.equals(user.getRoleName())) {
-			userEntity.setRoleId(BusinessConstant.ROLE_COMPANY_ADMIN_ID);
-			userEntity.setPostId(BusinessConstant.POST_ADMIN_ID);
-		} else if (BusinessConstant.ROLE_COMPANY_ADMIN.equals(user.getRoleName())) {
-			userEntity.setRoleId(BusinessConstant.ROLE_COMPANY_SERVICE_PERSON_ID);
-			userEntity.setPostId(BusinessConstant.POST_SERVICE_PERSON_ID);
-			userEntity.setDeptId(user.getDeptId());
-		} else {
-			return R.fail("用户创建错误!");
-		}
-		userEntity.setUserType(1);
-		return R.status(userService.save(userEntity));
-	}
+    /**
+     * 详情
+     */
+    @GetMapping("/detail")
+    @ApiOperationSupport(order = 3)
+    @ApiOperation(value = "详情", notes = "传入 User")
+    public R<User> detail(User user) {
+        User detail = userService.getById(user.getId());
+        return R.data(detail);
+    }
 
-	/**
-	 * 修改
-	 */
-	@PostMapping("/update")
-	@ApiOperationSupport(order = 5)
-	@ApiOperation(value = "修改", notes = "传入 User")
-	public R update(@RequestBody User user) {
-		if (Objects.isNull(user.getId())) {
-			return R.fail("用户ID不能为空!");
-		}
-		return R.status(userService.updateById(user));
-	}
+    /**
+     * 新增
+     */
+    @PostMapping("/save")
+    @ApiOperationSupport(order = 4)
+    @ApiOperation(value = "新增", notes = "传入 User")
+    public R save(@RequestBody User userEntity) {
+        LambdaQueryWrapper<User> wrapper = Wrappers.<User>query().lambda();
+        wrapper.eq(User::getAccount, userEntity.getAccount());
+        wrapper.eq(User::getIsDeleted, 0);
+        List<User> list = userService.list(wrapper);
+        if (null != list && list.size() > 0) {
+            return R.fail("帐号已经存在");
+        }
+        userEntity.setName(userEntity.getRealName());
+        userEntity.setPassword(DigestUtil.encrypt(userEntity.getAccount() + BusinessConstant.ACCOUNT_PW_SUFFIX));
+        BladeUser user = AuthUtil.getUser();
+        if (BusinessConstant.ROLE_SYS_ADMIN.equals(user.getRoleName())) {
+            LambdaQueryWrapper<Role> roleWrapper = Wrappers.<Role>query().lambda();
+            roleWrapper.eq(Role::getRoleAlias, BusinessConstant.ROLE_ORG_ADMIN);
+            roleWrapper.last("limit 1");
+            Role role = roleService.getOne(roleWrapper);
+            userEntity.setRoleId(Func.toStr(role.getId()));
+            //userEntity.setRoleId(BusinessConstant.ROLE_ORG_ADMIN_ID);
+            userEntity.setPostId(BusinessConstant.POST_ADMIN_ID);
+        } else if (BusinessConstant.ROLE_ORG_ADMIN.equals(user.getRoleName())) {
+            LambdaQueryWrapper<Role> roleWrapper = Wrappers.<Role>query().lambda();
+            roleWrapper.eq(Role::getRoleAlias, BusinessConstant.ROLE_COMPANY_ADMIN);
+            roleWrapper.last("limit 1");
+            Role role = roleService.getOne(roleWrapper);
+            userEntity.setRoleId(Func.toStr(role.getId()));
+            //userEntity.setRoleId(BusinessConstant.ROLE_COMPANY_ADMIN_ID);
+            userEntity.setPostId(BusinessConstant.POST_ADMIN_ID);
+        } else if (BusinessConstant.ROLE_COMPANY_ADMIN.equals(user.getRoleName())) {
+            LambdaQueryWrapper<Role> roleWrapper = Wrappers.<Role>query().lambda();
+            roleWrapper.eq(Role::getRoleAlias, BusinessConstant.ROLE_COMPANY_SERVICE_PERSON);
+            roleWrapper.last("limit 1");
+            Role role = roleService.getOne(roleWrapper);
+            userEntity.setRoleId(Func.toStr(role.getId()));
+            //userEntity.setRoleId(BusinessConstant.ROLE_COMPANY_SERVICE_PERSON_ID);
+            userEntity.setPostId(BusinessConstant.POST_SERVICE_PERSON_ID);
+            userEntity.setDeptId(user.getDeptId());
+        } else {
+            return R.fail("用户创建错误!");
+        }
+        userEntity.setUserType(1);
+        return R.status(userService.save(userEntity));
+    }
 
-	/**
-	 * 删除
-	 */
-	@PostMapping("/remove")
-	@ApiOperationSupport(order = 7)
-	@ApiOperation(value = "逻辑删除", notes = "传入 ids")
-	public R remove(@ApiParam(value = "主键集合") @RequestParam String ids) {
-		List<Long> list = Func.toLongList(ids);
-		if (null != list && list.size() > 0) {
-			for (Long id : list) {
-				userService.removeById(id);
-			}
-		}
-		return R.status(true);
-	}
+    /**
+     * 修改
+     */
+    @PostMapping("/update")
+    @ApiOperationSupport(order = 5)
+    @ApiOperation(value = "修改", notes = "传入 User")
+    public R update(@RequestBody User user) {
+        if (Objects.isNull(user.getId())) {
+            return R.fail("用户ID不能为空!");
+        }
+        return R.status(userService.updateById(user));
+    }
 
-	/**
-	 * 用户联系表
-	 * @return
-	 */
-	@GetMapping("/contact")
-	@ApiOperationSupport(order = 1)
-	@ApiOperation(value = "通讯录")
-	public R<List<OrgPersonContactVO>> contact() {
-		BladeUser user = AuthUtil.getUser();
-		List<OrgPersonContactVO> list = new LinkedList<>();
-		if (BusinessConstant.ROLE_SYS_ADMIN.equals(user.getRoleName())) {
-			LambdaQueryWrapper<Dept> wrapper = Wrappers.<Dept>query().lambda();
-			wrapper.eq(Dept::getIsDeleted, 0);
-			wrapper.eq(Dept::getParentId, Func.toLong(user.getDeptId()));
-			List<Dept> root = this.deptService.list(wrapper);
-			for (Dept dept : root) {
-				OrgPersonContactVO contactVO = new OrgPersonContactVO();
-				contactVO.setId(dept.getId());
-				contactVO.setOrgName(dept.getDeptName());
-				LambdaQueryWrapper<User> userLambdaQueryWrapper = Wrappers.<User>query().lambda();
-				userLambdaQueryWrapper.eq(User::getIsDeleted, 0);
-				userLambdaQueryWrapper.eq(User::getDeptId, Func.toStr(dept.getId()));
-				List<User> userList = this.userService.list(userLambdaQueryWrapper);
-				List<ServicePersonVO> personVOList = new LinkedList<>();
-				for (User u : userList) {
-					ServicePersonVO vo = new ServicePersonVO();
-					vo.setId(u.getId());
-					vo.setPersonName(u.getRealName());
-					vo.setContactPhone(u.getPhone());
-					personVOList.add(vo);
-				}
-				contactVO.setServicePersonVOList(personVOList);
-				list.add(contactVO);
-			}
-		} else if (BusinessConstant.ROLE_ORG_ADMIN.equals(user.getRoleName())) {
-			LambdaQueryWrapper<Dept> wrapper = Wrappers.<Dept>query().lambda();
-			wrapper.eq(Dept::getIsDeleted, 0);
-			wrapper.eq(Dept::getParentId, Func.toLong(user.getDeptId()));
-			List<Dept> root = this.deptService.list(wrapper);
-			for (Dept dept : root) {
-				OrgPersonContactVO contactVO = new OrgPersonContactVO();
-				contactVO.setId(dept.getId());
-				contactVO.setOrgName(dept.getDeptName());
-				LambdaQueryWrapper<User> userLambdaQueryWrapper = Wrappers.<User>query().lambda();
-				userLambdaQueryWrapper.eq(User::getIsDeleted, 0);
-				userLambdaQueryWrapper.eq(User::getDeptId, Func.toStr(dept.getId()));
-				List<User> userList = this.userService.list(userLambdaQueryWrapper);
-				List<ServicePersonVO> personVOList = new LinkedList<>();
-				for (User u : userList) {
-					ServicePersonVO vo = new ServicePersonVO();
-					vo.setId(u.getId());
-					vo.setPersonName(u.getRealName());
-					vo.setContactPhone(u.getPhone());
-					personVOList.add(vo);
-				}
-				contactVO.setServicePersonVOList(personVOList);
-				list.add(contactVO);
-			}
-		} else if (BusinessConstant.ROLE_COMPANY_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_SERVICE_PERSON.equals(user.getRoleName())) {
-			OrgPersonContactVO contactVO = new OrgPersonContactVO();
-			contactVO.setId(Func.toLong(user.getDeptId()));
-			Dept dept = this.deptService.getById(contactVO.getId());
-			contactVO.setOrgName(dept.getDeptName());
-			LambdaQueryWrapper<User> userLambdaQueryWrapper = Wrappers.<User>query().lambda();
-			userLambdaQueryWrapper.eq(User::getIsDeleted, 0);
-			userLambdaQueryWrapper.eq(User::getDeptId, Func.toStr(dept.getId()));
-			List<User> userList = this.userService.list(userLambdaQueryWrapper);
-			List<ServicePersonVO> personVOList = new LinkedList<>();
-			for (User u : userList) {
-				ServicePersonVO vo = new ServicePersonVO();
-				vo.setId(u.getId());
-				vo.setPersonName(u.getRealName());
-				vo.setContactPhone(u.getPhone());
-				personVOList.add(vo);
-			}
-			contactVO.setServicePersonVOList(personVOList);
+    /**
+     * 删除
+     */
+    @PostMapping("/remove")
+    @ApiOperationSupport(order = 7)
+    @ApiOperation(value = "逻辑删除", notes = "传入 ids")
+    public R remove(@ApiParam(value = "主键集合") @RequestParam String ids) {
+        List<Long> list = Func.toLongList(ids);
+        if (null != list && list.size() > 0) {
+            for (Long id : list) {
+                userService.removeById(id);
+            }
+        }
+        return R.status(true);
+    }
 
-			list.add(contactVO);
-		}
-		return R.data(list);
-	}
+    /**
+     * 用户联系表
+     *
+     * @return
+     */
+    @GetMapping("/contact")
+    @ApiOperationSupport(order = 1)
+    @ApiOperation(value = "通讯录")
+    public R<List<OrgPersonContactVO>> contact() {
+        BladeUser user = AuthUtil.getUser();
+        List<OrgPersonContactVO> list = new LinkedList<>();
+        if (BusinessConstant.ROLE_SYS_ADMIN.equals(user.getRoleName())) {
+            LambdaQueryWrapper<Dept> wrapper = Wrappers.<Dept>query().lambda();
+            wrapper.eq(Dept::getIsDeleted, 0);
+            wrapper.eq(Dept::getParentId, Func.toLong(user.getDeptId()));
+            List<Dept> root = this.deptService.list(wrapper);
+            for (Dept dept : root) {
+                OrgPersonContactVO contactVO = new OrgPersonContactVO();
+                contactVO.setId(dept.getId());
+                contactVO.setOrgName(dept.getDeptName());
+                LambdaQueryWrapper<User> userLambdaQueryWrapper = Wrappers.<User>query().lambda();
+                userLambdaQueryWrapper.eq(User::getIsDeleted, 0);
+                userLambdaQueryWrapper.eq(User::getDeptId, Func.toStr(dept.getId()));
+                List<User> userList = this.userService.list(userLambdaQueryWrapper);
+                List<ServicePersonVO> personVOList = new LinkedList<>();
+                for (User u : userList) {
+                    ServicePersonVO vo = new ServicePersonVO();
+                    vo.setId(u.getId());
+                    vo.setPersonName(u.getRealName());
+                    vo.setContactPhone(u.getPhone());
+                    personVOList.add(vo);
+                }
+                contactVO.setServicePersonVOList(personVOList);
+                list.add(contactVO);
+            }
+        } else if (BusinessConstant.ROLE_ORG_ADMIN.equals(user.getRoleName())) {
+            LambdaQueryWrapper<Dept> wrapper = Wrappers.<Dept>query().lambda();
+            wrapper.eq(Dept::getIsDeleted, 0);
+            wrapper.ne(Dept::getDeptCategory,3);
+            wrapper.eq(Dept::getParentId, Func.toLong(user.getDeptId()));
+            List<Dept> root = this.deptService.list(wrapper);
+            for (Dept dept : root) {
+                OrgPersonContactVO contactVO = new OrgPersonContactVO();
+                contactVO.setId(dept.getId());
+                contactVO.setOrgName(dept.getDeptName());
+                LambdaQueryWrapper<User> userLambdaQueryWrapper = Wrappers.<User>query().lambda();
+                userLambdaQueryWrapper.eq(User::getIsDeleted, 0);
+                userLambdaQueryWrapper.eq(User::getDeptId, Func.toStr(dept.getId()));
+                List<User> userList = this.userService.list(userLambdaQueryWrapper);
+                List<ServicePersonVO> personVOList = new LinkedList<>();
+                for (User u : userList) {
+                    ServicePersonVO vo = new ServicePersonVO();
+                    vo.setId(u.getId());
+                    vo.setPersonName(u.getRealName());
+                    vo.setContactPhone(u.getPhone());
+                    personVOList.add(vo);
+                }
+                contactVO.setServicePersonVOList(personVOList);
+                list.add(contactVO);
+            }
+        } else if (BusinessConstant.ROLE_COMPANY_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_SERVICE_PERSON.equals(user.getRoleName())) {
+            OrgPersonContactVO contactVO = new OrgPersonContactVO();
+            contactVO.setId(Func.toLong(user.getDeptId()));
+            Dept dept = this.deptService.getById(contactVO.getId());
+            contactVO.setOrgName(dept.getDeptName());
+            LambdaQueryWrapper<User> userLambdaQueryWrapper = Wrappers.<User>query().lambda();
+            userLambdaQueryWrapper.eq(User::getIsDeleted, 0);
+            userLambdaQueryWrapper.eq(User::getDeptId, Func.toStr(dept.getId()));
+            List<User> userList = this.userService.list(userLambdaQueryWrapper);
+            List<ServicePersonVO> personVOList = new LinkedList<>();
+            for (User u : userList) {
+                ServicePersonVO vo = new ServicePersonVO();
+                vo.setId(u.getId());
+                vo.setPersonName(u.getRealName());
+                vo.setContactPhone(u.getPhone());
+                personVOList.add(vo);
+            }
+            contactVO.setServicePersonVOList(personVOList);
+
+            list.add(contactVO);
+        }
+        return R.data(list);
+    }
 }

+ 59 - 24
src/main/java/org/springblade/modules/business/check/order/controller/RtuCheckOrderController.java

@@ -251,7 +251,6 @@ public class RtuCheckOrderController extends BladeController {
                 checkOrderInfoDTO.setAdCode(deptRegionEntity.getAdcd());
             }
         }
-
         List<CheckOrderInfoVO> list = rtuCheckOrderService.unconfirmOrderList(checkOrderInfoDTO);
         for (CheckOrderInfoVO v : list) {
             RtuCheckOrderWrapper.build().entityVO(v);
@@ -380,7 +379,6 @@ public class RtuCheckOrderController extends BladeController {
                 checkOrderInfoDTO.setAdCode(deptRegionEntity.getAdcd());
             }
         }
-
         LambdaQueryWrapper<CheckOrderSettingEntity> wrapper = Wrappers.<CheckOrderSettingEntity>query().lambda();
         wrapper.eq(CheckOrderSettingEntity::getIsDeleted, 0);
         List<CheckOrderSettingEntity> settingEntityList = checkOrderSettingService.list(wrapper);
@@ -390,7 +388,6 @@ public class RtuCheckOrderController extends BladeController {
         } else {
             checkOrderInfoDTO.setOrderComfireDelayTime(120);
         }
-
         IPage<CheckOrderInfoVO> pages = rtuCheckOrderService.selectConfirmDelayPage(Condition.getPage(query), checkOrderInfoDTO);
         List<CheckOrderInfoVO> list = pages.getRecords();
         for (CheckOrderInfoVO v : list) {
@@ -449,7 +446,6 @@ public class RtuCheckOrderController extends BladeController {
                 checkOrderInfoDTO.setAdCode(deptRegionEntity.getAdcd());
             }
         }
-
         IPage<CheckOrderHistroyVO> pages = rtuCheckOrderService.selectHistoryPage(Condition.getPage(query), checkOrderInfoDTO);
         List<CheckOrderHistroyVO> list = pages.getRecords();
         for (CheckOrderHistroyVO v : list) {
@@ -746,7 +742,6 @@ public class RtuCheckOrderController extends BladeController {
         processInfoEntity.setOrderId(checkOrderInfoDTO.getId());
         processInfoEntity.setOrderStatusKey(statusdict.getId());
         processInfoEntity.setProcessDesc(checkOrderInfoDTO.getOrderDesc());
-
         rtuOrderProcessService.save(processInfoEntity);
         //更新测站状态
         RtuStatusEntity statusEntity = new RtuStatusEntity();
@@ -754,7 +749,6 @@ public class RtuCheckOrderController extends BladeController {
         statusEntity.setLastUpTime(new Date());
         statusEntity.setRunStatusId(EquipmentStatusEnum.STATUS_FAILURE.getCode());
         rtuManageService.updateRtuStatus(statusEntity);
-
         return R.status(true);
     }
 
@@ -853,24 +847,12 @@ public class RtuCheckOrderController extends BladeController {
     public R<List<OrgCheckOrderCountVO>> orgOrderStatistics() {
         BladeUser user = AuthUtil.getUser();
         List<OrgCheckOrderCountVO> list = new LinkedList<>();
-        LambdaQueryWrapper<Dept> wrapper = Wrappers.<Dept>query().lambda();
-        wrapper.eq(Dept::getParentId, Func.toLong(user.getDeptId()));
-        List<Dept> root = this.deptService.list(wrapper);
-        for (Dept dept : root) {
+        if (BusinessConstant.ROLE_QI_ADMIN.equals(user.getRoleName())) {
+            Dept dept = this.deptService.getById(Func.toLong(user.getDeptId()));
             LambdaQueryWrapper<DeptRegionEntity> deptLambdaQueryWrapper = Wrappers.<DeptRegionEntity>query().lambda();
-            if (user.getRoleName().equals(BusinessConstant.ROLE_SYS_ADMIN)) {
-                deptLambdaQueryWrapper.eq(DeptRegionEntity::getDeptId, dept.getId());
-            } else {
-                deptLambdaQueryWrapper.eq(DeptRegionEntity::getDeptId, Func.toLong(user.getDeptId()));
-            }
+            deptLambdaQueryWrapper.eq(DeptRegionEntity::getDeptId, dept.getId());
             DeptRegionEntity deptRegionEntity = this.deptRegionService.getOne(deptLambdaQueryWrapper);
-            LambdaQueryWrapper<RegionInfoEntity> nodeQueryWrapper = Wrappers.<RegionInfoEntity>query().lambda();
-            nodeQueryWrapper.eq(RegionInfoEntity::getAdcd, deptRegionEntity.getAdcd());
-            RegionInfoEntity nodeRegion = this.regionService.getOne(nodeQueryWrapper);
             int excludecode = 0;
-            if (nodeRegion.getParentCode().equals(BusinessConstant.REGION_NM_ADCODE)) {
-                excludecode = 1;
-            }
             OrgCheckOrderCountVO orgCheckOrderCountVO = new OrgCheckOrderCountVO();
             orgCheckOrderCountVO.setDeptId(dept.getId());
             orgCheckOrderCountVO.setOrgName(dept.getDeptName());
@@ -905,7 +887,63 @@ public class RtuCheckOrderController extends BladeController {
             Long reportCount = rtuCheckOrderService.reportCount(checkOrderInfoDTO);
             orgCheckOrderCountVO.setReportOrderCount(reportCount);
             list.add(orgCheckOrderCountVO);
+        } else {
+            LambdaQueryWrapper<Dept> wrapper = Wrappers.<Dept>query().lambda();
+            wrapper.eq(Dept::getParentId, Func.toLong(user.getDeptId()));
+            wrapper.ne(Dept::getDeptCategory, 3);
+            List<Dept> root = this.deptService.list(wrapper);
+            for (Dept dept : root) {
+                LambdaQueryWrapper<DeptRegionEntity> deptLambdaQueryWrapper = Wrappers.<DeptRegionEntity>query().lambda();
+                if (user.getRoleName().equals(BusinessConstant.ROLE_SYS_ADMIN)) {
+                    deptLambdaQueryWrapper.eq(DeptRegionEntity::getDeptId, dept.getId());
+                } else if (user.getRoleName().equals(BusinessConstant.ROLE_ORG_ADMIN)) {
+                    deptLambdaQueryWrapper.eq(DeptRegionEntity::getDeptId, dept.getId());
+                }
+                DeptRegionEntity deptRegionEntity = this.deptRegionService.getOne(deptLambdaQueryWrapper);
+                LambdaQueryWrapper<RegionInfoEntity> nodeQueryWrapper = Wrappers.<RegionInfoEntity>query().lambda();
+                nodeQueryWrapper.eq(RegionInfoEntity::getAdcd, deptRegionEntity.getAdcd());
+                RegionInfoEntity nodeRegion = this.regionService.getOne(nodeQueryWrapper);
+                int excludecode = 0;
+                if (nodeRegion.getParentCode().equals(BusinessConstant.REGION_NM_ADCODE)) {
+                    excludecode = 1;
+                }
+                OrgCheckOrderCountVO orgCheckOrderCountVO = new OrgCheckOrderCountVO();
+                orgCheckOrderCountVO.setDeptId(dept.getId());
+                orgCheckOrderCountVO.setOrgName(dept.getDeptName());
+                CheckOrderInfoDTO checkOrderInfoDTO = new CheckOrderInfoDTO();
+                checkOrderInfoDTO.setAdCode(deptRegionEntity.getAdcd());
+                checkOrderInfoDTO.setExcludeCode(excludecode);
+                //任务数量
+                checkOrderInfoDTO.setOrderClose(OrderCloseEnum.ACTIVE_OPEN.getCode());
+                Long orderCount = rtuCheckOrderService.orderCount(checkOrderInfoDTO);
+                orgCheckOrderCountVO.setOrderCount(orderCount);
+                //未确认
+                checkOrderInfoDTO.setOrderClose(OrderCloseEnum.ACTIVE_OPEN.getCode());
+                checkOrderInfoDTO.setOrderConfirm(OrderConfirmEnum.ACTIVE_CREATE.getCode());
+                long count = rtuCheckOrderService.unconfirmOrderCount(checkOrderInfoDTO);
+                orgCheckOrderCountVO.setUnconfirmOrderCount(count);
+                //处理中
+                checkOrderInfoDTO.setOrderClose(OrderCloseEnum.ACTIVE_OPEN.getCode());
+                checkOrderInfoDTO.setOrderConfirm(OrderConfirmEnum.ACTIVE_CONFIRM.getCode());
+                DictInfoEntity biz = dictService.getDict(DictBusinessConstant.ORDER_STATUS_CODE, OrderStatusEnum.STATUS_CONFIRM.getCode());
+                if (biz != null) {
+                    checkOrderInfoDTO.setOrderStatusKey(biz.getId());
+                }
+                Long unCloseOrderCount = rtuCheckOrderService.unCloseOrderCount(checkOrderInfoDTO);
+                orgCheckOrderCountVO.setProcessingOrderCount(unCloseOrderCount);
+                //已处理
+                checkOrderInfoDTO.setOrderClose(OrderCloseEnum.ACTIVE_OPEN.getCode());
+                checkOrderInfoDTO.setOrderConfirm(OrderConfirmEnum.ACTIVE_CONFIRM.getCode());
+                biz = dictService.getDict(DictBusinessConstant.ORDER_STATUS_CODE, OrderStatusEnum.STATUS_PROCESS.getCode());
+                if (biz != null) {
+                    checkOrderInfoDTO.setOrderStatusKey(biz.getId());
+                }
+                Long reportCount = rtuCheckOrderService.reportCount(checkOrderInfoDTO);
+                orgCheckOrderCountVO.setReportOrderCount(reportCount);
+                list.add(orgCheckOrderCountVO);
+            }
         }
+
         return R.data(list);
     }
 
@@ -928,9 +966,7 @@ public class RtuCheckOrderController extends BladeController {
         Long rtuCount = rtuBaseInfoService.rtuCount(rtuInfoDTO);
         checkOrderInfoDTO.setOrderClose(0);
         Long orderCount = rtuCheckOrderService.orderCount(checkOrderInfoDTO);
-
         Long unConfirmOrderCount = rtuCheckOrderService.unconfirmOrderCount(checkOrderInfoDTO);
-
         DictInfoEntity biz = dictService.getDict(DictBusinessConstant.ORDER_STATUS_CODE, OrderStatusEnum.STATUS_CONFIRM.getCode());
         if (biz != null) {
             checkOrderInfoDTO.setOrderStatusKey(biz.getId());
@@ -941,7 +977,6 @@ public class RtuCheckOrderController extends BladeController {
         data.put("orderCount", orderCount);
         data.put("orderUnconfirm", unConfirmOrderCount);
         data.put("orderProcessing", unCloseOrderCount);
-
         DictInfoEntity dictInfoEntity = dictService.getDict(DictBusinessConstant.ORDER_STATUS_CODE, OrderStatusEnum.STATUS_PROCESS.getCode());
         if (dictInfoEntity != null) {
             checkOrderInfoDTO.setOrderStatusKey(dictInfoEntity.getId());

+ 326 - 336
src/main/java/org/springblade/modules/business/check/process/controller/RtuOrderProcessController.java

@@ -68,359 +68,349 @@ import java.util.List;
 @AllArgsConstructor
 @Api(value = "工单处理管理模块", tags = "工单处理管理模块")
 public class RtuOrderProcessController extends BladeController {
-	private final IRtuOrderProcessService rtuOrderProcessService;
-	private final IRtuCheckOrderService checkOrderService;
-	private final IUserService userService;
-	private final IBaseInfoDictService dictService;
-	private final IDeptRegionService deptRegionService;
-	private final IRtuBaseInfoService rtuBaseInfoService;
-	private final IRegionInfoService regionService;
-	private final IDictBizService dictBizService;
+    private final IRtuOrderProcessService rtuOrderProcessService;
+    private final IRtuCheckOrderService checkOrderService;
+    private final IUserService userService;
+    private final IBaseInfoDictService dictService;
+    private final IDeptRegionService deptRegionService;
+    private final IRtuBaseInfoService rtuBaseInfoService;
+    private final IRegionInfoService regionService;
+    private final IDictBizService dictBizService;
 
-	@Resource
-	private OssBuilder ossBuilder;
-	/**
-	 * 分页
-	 */
-	@GetMapping("/list")
-	@ApiImplicitParams({
-		@ApiImplicitParam(name = "id", value = "工单ID", paramType = "query", dataType = "long")
-	})
-	@ApiOperationSupport(order = 2)
-	@ApiOperation(value = "不分页", notes = "传入checkOrderInfoDTO")
-	public R<List<OrderProcessInfoVO>> list(CheckOrderInfoDTO checkOrderInfoDTO) {
-		List<OrderProcessInfoVO> list = rtuOrderProcessService.selectList(checkOrderInfoDTO);
-		//CheckOrderInfoEntity checkOrderInfoEntity = checkOrderService.getById(checkOrderInfoDTO.getId());
-		for (OrderProcessInfoVO v : list) {
-			//v.setTaskCreateTime(checkOrderInfoEntity.getCreateTime());
-			RtuOrderProcessWrapper.build().entityVO(v);
-		}
-		return R.data(list);
-	}
+    @Resource
+    private OssBuilder ossBuilder;
 
-	/**
-	 * 多表联合查询自定义分页
-	 */
-	@GetMapping("/page")
-	@ApiImplicitParams({
-		@ApiImplicitParam(name = "id", value = "工单ID", paramType = "query", dataType = "long")
-	})
-	@ApiOperationSupport(order = 3)
-	@ApiOperation(value = "分页", notes = "传入checkOrderInfoDTO")
-	public R<IPage<OrderProcessInfoVO>> page(CheckOrderInfoDTO checkOrderInfoDTO, Query query) {
-		IPage<OrderProcessInfoVO> pages = rtuOrderProcessService.selectPage(Condition.getPage(query), checkOrderInfoDTO);
-		List<OrderProcessInfoVO> list = pages.getRecords();
-		for (OrderProcessInfoVO v : list) {
-			RtuOrderProcessWrapper.build().entityVO(v);
-		}
-		return R.data(pages);
-	}
+    /**
+     * 分页
+     */
+    @GetMapping("/list")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "id", value = "工单ID", paramType = "query", dataType = "long")
+    })
+    @ApiOperationSupport(order = 2)
+    @ApiOperation(value = "不分页", notes = "传入checkOrderInfoDTO")
+    public R<List<OrderProcessInfoVO>> list(CheckOrderInfoDTO checkOrderInfoDTO) {
+        List<OrderProcessInfoVO> list = rtuOrderProcessService.selectList(checkOrderInfoDTO);
+        for (OrderProcessInfoVO v : list) {
+            RtuOrderProcessWrapper.build().entityVO(v);
+        }
+        return R.data(list);
+    }
 
+    /**
+     * 多表联合查询自定义分页
+     */
+    @GetMapping("/page")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "id", value = "工单ID", paramType = "query", dataType = "long")
+    })
+    @ApiOperationSupport(order = 3)
+    @ApiOperation(value = "分页", notes = "传入checkOrderInfoDTO")
+    public R<IPage<OrderProcessInfoVO>> page(CheckOrderInfoDTO checkOrderInfoDTO, Query query) {
+        IPage<OrderProcessInfoVO> pages = rtuOrderProcessService.selectPage(Condition.getPage(query), checkOrderInfoDTO);
+        List<OrderProcessInfoVO> list = pages.getRecords();
+        for (OrderProcessInfoVO v : list) {
+            RtuOrderProcessWrapper.build().entityVO(v);
+        }
+        return R.data(pages);
+    }
 
-	/**
-	 * 查询当天填报的工单信息
-	 *
-	 * @return
-	 */
-	@GetMapping("/today/list")
-	@ApiOperationSupport(order = 2)
-	@ApiOperation(value = "分页")
-	public R<List<OrderProcessInfoVO>> todayList(@ApiIgnore OrderProcessInfoDTO processInfoDTO) {
-		BladeUser user = AuthUtil.getUser();
-		int excludecode = 0;
-		if (BusinessConstant.ROLE_SYS_ADMIN.equals(user.getRoleName())) {
-			processInfoDTO.setAdCode(BusinessConstant.REGION_NM_ADCODE);
-		} else if (BusinessConstant.ROLE_ORG_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_SERVICE_PERSON.equals(user.getRoleName())) {
-			DeptRegionEntity deptRegionEntity = deptRegionService.getRegionByDeptId(Func.toLong(user.getDeptId()));
-//			LambdaQueryWrapper<DeptRegionEntity> deptRegionEntityLambdaQueryWrapper = Wrappers.<DeptRegionEntity>query().lambda();
-//			deptRegionEntityLambdaQueryWrapper.eq(DeptRegionEntity::getIsDeleted, 0);
-//			deptRegionEntityLambdaQueryWrapper.eq(DeptRegionEntity::getDeptId, Func.toLong(user.getDeptId()));
-//			DeptRegionEntity deptRegionEntity = deptRegionService.getOne(deptRegionEntityLambdaQueryWrapper);
-			if (null == deptRegionEntity){
-				return R.data(null);
-			}
-			processInfoDTO.setAdCode(deptRegionEntity.getAdcd());
 
-			//DeptRegionEntity deptRegionEntity = deptRegionService.getRegionByDeptId(Func.toLong(user.getDeptId()));
+    /**
+     * 查询当天填报的工单信息
+     *
+     * @return
+     */
+    @GetMapping("/today/list")
+    @ApiOperationSupport(order = 2)
+    @ApiOperation(value = "分页")
+    public R<List<OrderProcessInfoVO>> todayList(@ApiIgnore OrderProcessInfoDTO processInfoDTO) {
+        BladeUser user = AuthUtil.getUser();
+        int excludecode = 0;
+        if (BusinessConstant.ROLE_SYS_ADMIN.equals(user.getRoleName())) {
+            processInfoDTO.setAdCode(BusinessConstant.REGION_NM_ADCODE);
+        } else if (BusinessConstant.ROLE_ORG_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_SERVICE_PERSON.equals(user.getRoleName())) {
+            DeptRegionEntity deptRegionEntity = deptRegionService.getRegionByDeptId(Func.toLong(user.getDeptId()));
+            if (Func.notNull(deptRegionEntity)) {
+                processInfoDTO.setAdCode(deptRegionEntity.getAdcd());
+                LambdaQueryWrapper<RegionInfoEntity> nodeQueryWrapper = Wrappers.<RegionInfoEntity>query().lambda();
+                nodeQueryWrapper.eq(RegionInfoEntity::getAdcd, deptRegionEntity.getAdcd());
+                RegionInfoEntity nodeRegion = this.regionService.getOne(nodeQueryWrapper);
+                if (nodeRegion.getParentCode().equals(BusinessConstant.REGION_NM_ADCODE)) {
+                    excludecode = 1;
+                }
+            }
+        } else if (BusinessConstant.ROLE_QI_ADMIN.equals(user.getRoleName())) {
+            DeptRegionEntity deptRegionEntity = deptRegionService.getRegionByDeptId(Func.toLong(user.getDeptId()));
+            if (Func.notNull(deptRegionEntity)) {
+                processInfoDTO.setAdCode(deptRegionEntity.getAdcd());
+            }
+        }
+        processInfoDTO.setExcludeCode(excludecode);
+        Date date = new Date();
+        String dt = Func.formatDateTime(date);
+        processInfoDTO.setCreateTime(Func.parse(dt, ConcurrentDateFormat.of("yyyy-MM-dd")));
+        List<OrderProcessInfoVO> list = rtuOrderProcessService.selectTodayProcessList(processInfoDTO);
+        for (OrderProcessInfoVO vo : list) {
+            RtuOrderProcessWrapper.build().entityVO(vo);
+        }
+        return R.data(list);
+    }
 
-			LambdaQueryWrapper<RegionInfoEntity> nodeQueryWrapper = Wrappers.<RegionInfoEntity>query().lambda();
-			nodeQueryWrapper.eq(RegionInfoEntity::getAdcd, deptRegionEntity.getAdcd());
-			RegionInfoEntity nodeRegion = this.regionService.getOne(nodeQueryWrapper);
 
-			if (nodeRegion.getParentCode().equals(BusinessConstant.REGION_NM_ADCODE)) {
-				excludecode = 1;
-			}
-		}
+    /**
+     * 多表联合查询自定义分页
+     */
+    @GetMapping("/today/page")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "id", value = "工单ID", paramType = "query", dataType = "long")
+    })
+    @ApiOperationSupport(order = 3)
+    @ApiOperation(value = "分页", notes = "传入checkOrderInfoDTO")
+    public R<IPage<OrderProcessInfoVO>> todayPage(@ApiIgnore OrderProcessInfoDTO orderProcessInfoDTO, Query query) {
+        BladeUser user = AuthUtil.getUser();
+        if (BusinessConstant.ROLE_SYS_ADMIN.equals(user.getRoleName())) {
+            orderProcessInfoDTO.setAdCode(BusinessConstant.REGION_NM_ADCODE);
+        } else if (BusinessConstant.ROLE_ORG_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_SERVICE_PERSON.equals(user.getRoleName())) {
+            LambdaQueryWrapper<DeptRegionEntity> deptRegionEntityLambdaQueryWrapper = Wrappers.<DeptRegionEntity>query().lambda();
+            deptRegionEntityLambdaQueryWrapper.eq(DeptRegionEntity::getDeptId, Func.toLong(user.getDeptId()));
+            DeptRegionEntity deptRegionEntity = deptRegionService.getOne(deptRegionEntityLambdaQueryWrapper);
+            orderProcessInfoDTO.setAdCode(deptRegionEntity.getAdcd());
+            if (Func.notNull(orderProcessInfoDTO.getAdCode())) {
+                RegionTreeNodeEntity nodeEntity = this.regionService.getRegionNode(user.getRoleName(), user.getDeptId(), orderProcessInfoDTO.getAdCode());
+                orderProcessInfoDTO.setExcludeCode(nodeEntity.getExclude());
+            }
+        } else if (BusinessConstant.ROLE_QI_ADMIN.equals(user.getRoleName())) {
+            LambdaQueryWrapper<DeptRegionEntity> deptRegionEntityLambdaQueryWrapper = Wrappers.<DeptRegionEntity>query().lambda();
+            deptRegionEntityLambdaQueryWrapper.eq(DeptRegionEntity::getDeptId, Func.toLong(user.getDeptId()));
+            DeptRegionEntity deptRegionEntity = deptRegionService.getOne(deptRegionEntityLambdaQueryWrapper);
+            orderProcessInfoDTO.setAdCode(deptRegionEntity.getAdcd());
+        }
+        Date date = new Date();
+        String dt = Func.formatDateTime(date);
+        orderProcessInfoDTO.setCreateTime(Func.parse(dt, ConcurrentDateFormat.of("yyyy-MM-dd")));
+        IPage<OrderProcessInfoVO> pages = rtuOrderProcessService.selectTodayProcessPage(Condition.getPage(query), orderProcessInfoDTO);
+        List<OrderProcessInfoVO> list = pages.getRecords();
+        for (OrderProcessInfoVO v : list) {
+            RtuOrderProcessWrapper.build().entityVO(v);
+        }
+        return R.data(pages);
+    }
 
-//		if (processInfoDTO.getAdCode()!=null){
-//			DeptRegionEntity deptRegionEntity = deptRegionService.getRegionByDeptId(Func.toLong(user.getDeptId()));
-//
-//			LambdaQueryWrapper<RegionInfoEntity> nodeQueryWrapper = Wrappers.<RegionInfoEntity>query().lambda();
-//			nodeQueryWrapper.eq(RegionInfoEntity::getAdcd, deptRegionEntity.getAdcd());
-//			RegionInfoEntity nodeRegion = this.regionService.getOne(nodeQueryWrapper);
-//			int excludecode = 0;
-//			if (nodeRegion.getParentCode().equals(BusinessConstant.REGION_NM_ADCODE)) {
-//				excludecode = 1;
-//			}
-//			RegionTreeNodeEntity nodeEntity= this.regionService.getRegionNode(user.getRoleName(),user.getDeptId(),processInfoDTO.getAdCode());
-//
-//		}
-		processInfoDTO.setExcludeCode(excludecode);
-		Date date = new Date();
-		String dt = Func.formatDateTime(date);
-		processInfoDTO.setCreateTime(Func.parse(dt, ConcurrentDateFormat.of("yyyy-MM-dd")));
-		List<OrderProcessInfoVO> list = rtuOrderProcessService.selectTodayProcessList(processInfoDTO);
-		for (OrderProcessInfoVO vo : list) {
-			RtuOrderProcessWrapper.build().entityVO(vo);
-		}
-		return R.data(list);
-	}
 
+    /**
+     * 详情
+     */
+    @GetMapping("/detail")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "id", value = "填报ID", paramType = "query", dataType = "long"),
+    })
+    @ApiOperationSupport(order = 1)
+    @ApiOperation(value = "详情", notes = "传入orderProcessInfoEntity")
+    public R<OrderProcessInfoVO> detail(OrderProcessInfoEntity orderProcessInfoEntity) {
+        OrderProcessInfoEntity detail = rtuOrderProcessService.getById(orderProcessInfoEntity.getId());
+        OrderProcessInfoVO vo = RtuOrderProcessWrapper.build().entityVO(detail);
+        CheckOrderInfoEntity checkOrderInfoEntity = checkOrderService.getById(vo.getOrderId());
+        if (checkOrderInfoEntity.getOrderConfirmUser() != null) {
+            User user = userService.getById(checkOrderInfoEntity.getOrderConfirmUser());
+            vo.setOrderConfirmUserName(user.getRealName());
+        }
+        DictBiz biz = dictBizService.getById(checkOrderInfoEntity.getOrderFromKey());
+        vo.setOrderFromText(biz.getDictValue());
+        return R.data(vo);
+    }
 
-	/**
-	 * 多表联合查询自定义分页
-	 */
-	@GetMapping("/today/page")
-	@ApiImplicitParams({
-		@ApiImplicitParam(name = "id", value = "工单ID", paramType = "query", dataType = "long")
-	})
-	@ApiOperationSupport(order = 3)
-	@ApiOperation(value = "分页", notes = "传入checkOrderInfoDTO")
-	public R<IPage<OrderProcessInfoVO>> todayPage(@ApiIgnore OrderProcessInfoDTO orderProcessInfoDTO, Query query) {
-		BladeUser user = AuthUtil.getUser();
-		if (BusinessConstant.ROLE_SYS_ADMIN.equals(user.getRoleName())) {
-			orderProcessInfoDTO.setAdCode(BusinessConstant.REGION_NM_ADCODE);
-		} else if (BusinessConstant.ROLE_ORG_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_SERVICE_PERSON.equals(user.getRoleName())) {
-			LambdaQueryWrapper<DeptRegionEntity> deptRegionEntityLambdaQueryWrapper = Wrappers.<DeptRegionEntity>query().lambda();
-			deptRegionEntityLambdaQueryWrapper.eq(DeptRegionEntity::getIsDeleted, 0);
-			deptRegionEntityLambdaQueryWrapper.eq(DeptRegionEntity::getDeptId, Func.toLong(user.getDeptId()));
-			DeptRegionEntity deptRegionEntity = deptRegionService.getOne(deptRegionEntityLambdaQueryWrapper);
-			orderProcessInfoDTO.setAdCode(deptRegionEntity.getAdcd());
-		}
-		if (orderProcessInfoDTO.getAdCode()!=null){
-			RegionTreeNodeEntity nodeEntity= this.regionService.getRegionNode(user.getRoleName(),user.getDeptId(),orderProcessInfoDTO.getAdCode());
-			orderProcessInfoDTO.setExcludeCode(nodeEntity.getExclude());
-		}
-		Date date = new Date();
-		String dt = Func.formatDateTime(date);
-		orderProcessInfoDTO.setCreateTime(Func.parse(dt, ConcurrentDateFormat.of("yyyy-MM-dd")));
+    /**
+     * 新增
+     */
+    @PostMapping("/save")
+    @ApiOperationSupport(order = 4)
+    @ApiOperation(value = "新增", notes = "传入orderProcessInfoEntity")
+    public R save(@RequestBody OrderProcessInfoEntity orderProcessInfoEntity) {
+        BladeUser user = AuthUtil.getUser();
+        CheckOrderInfoEntity checkOrderInfoEntity = checkOrderService.getById(orderProcessInfoEntity.getOrderId());
+        DictInfoEntity dictInfoEntity = dictService.getDict(DictBusinessConstant.ORDER_STATUS_CODE, OrderStatusEnum.STATUS_PROCESS.getCode());
+        checkOrderInfoEntity.setOrderStatusKey(dictInfoEntity.getId());
+        checkOrderInfoEntity.setOrderDesc(orderProcessInfoEntity.getProcessDesc());
+        checkOrderInfoEntity.setProcessUser(user.getUserId());
+        checkOrderInfoEntity.setOrderProcessTime(new Date());
+        checkOrderService.updateById(checkOrderInfoEntity);
+        orderProcessInfoEntity.setOrderStatusKey(checkOrderInfoEntity.getOrderStatusKey());
+        rtuOrderProcessService.save(orderProcessInfoEntity);
+        //更新更换信息
+        LambdaQueryWrapper<RtuInfoEntity> rtuWrapper = Wrappers.<RtuInfoEntity>query().lambda();
+        rtuWrapper.eq(RtuInfoEntity::getIsDeleted, 0);
+        rtuWrapper.eq(RtuInfoEntity::getRtuCode, checkOrderInfoEntity.getRtuCode());
+        RtuInfoEntity rtuInfoEntity = rtuBaseInfoService.getOne(rtuWrapper);
+        if (orderProcessInfoEntity.getRtuReplace() != null && orderProcessInfoEntity.getRtuReplace() == 1) {
+            rtuInfoEntity.setRtuReplaceDate(orderProcessInfoEntity.getCreateTime());
+            rtuInfoEntity.setRtuBrand(orderProcessInfoEntity.getRtuBrand());
+            rtuInfoEntity.setRtuModel(orderProcessInfoEntity.getRtuModel());
+        }
+        if (orderProcessInfoEntity.getRainSensorReplace() != null && orderProcessInfoEntity.getRainSensorReplace() == 1) {
+            rtuInfoEntity.setRainSensorReplaceDate(orderProcessInfoEntity.getCreateTime());
+            rtuInfoEntity.setRainSensorBrand(orderProcessInfoEntity.getRainSensorBrand());
+            rtuInfoEntity.setRainSensorModel(orderProcessInfoEntity.getRainSensorModel());
+        }
+        if (orderProcessInfoEntity.getWaterSensorReplace() != null && orderProcessInfoEntity.getWaterSensorReplace() == 1) {
+            rtuInfoEntity.setWaterSensorReplaceDate(orderProcessInfoEntity.getCreateTime());
+            rtuInfoEntity.setWaterSensorBrand(orderProcessInfoEntity.getWaterSensorBrand());
+            rtuInfoEntity.setWaterSensorModel(orderProcessInfoEntity.getWaterSensorModel());
+        }
+        if (orderProcessInfoEntity.getGroundSensorReplace() != null && orderProcessInfoEntity.getGroundSensorReplace() == 1) {
+            rtuInfoEntity.setGroundSensorReplaceDate(orderProcessInfoEntity.getCreateTime());
+            rtuInfoEntity.setGroundSensorBrand(orderProcessInfoEntity.getGroundSensorBrand());
+            rtuInfoEntity.setGroundSensorModel(orderProcessInfoEntity.getGroundSensorModel());
+        }
+        if (orderProcessInfoEntity.getBatteryReplace() != null && orderProcessInfoEntity.getBatteryReplace() == 1) {
+            rtuInfoEntity.setBatteryReplaceDate(orderProcessInfoEntity.getCreateTime());
+        }
+        rtuBaseInfoService.updateById(rtuInfoEntity);
+        return R.status(true);
+    }
 
-		IPage<OrderProcessInfoVO> pages = rtuOrderProcessService.selectTodayProcessPage(Condition.getPage(query), orderProcessInfoDTO);
-		List<OrderProcessInfoVO> list = pages.getRecords();
-		for (OrderProcessInfoVO v : list) {
-			RtuOrderProcessWrapper.build().entityVO(v);
-		}
-		return R.data(pages);
-	}
+    /**
+     * 修改
+     */
+    @PostMapping("/update")
+    @ApiOperationSupport(order = 5)
+    @ApiOperation(value = "修改", notes = "传入orderProcessInfoEntity")
+    public R update(@RequestBody OrderProcessInfoEntity orderProcessInfoEntity) {
+        return R.status(rtuOrderProcessService.updateById(orderProcessInfoEntity));
+    }
 
+    /**
+     * 新增或修改
+     */
+    @PostMapping("/submit")
+    @ApiOperationSupport(order = 6)
+    @ApiOperation(value = "新增或修改", notes = "传入orderProcessInfoEntity")
+    public R submit(@RequestBody OrderProcessInfoEntity orderProcessInfoEntity) {
+        return R.status(rtuOrderProcessService.saveOrUpdate(orderProcessInfoEntity));
+    }
 
-	/**
-	 * 详情
-	 */
-	@GetMapping("/detail")
-	@ApiImplicitParams({
-		@ApiImplicitParam(name = "id", value = "填报ID", paramType = "query", dataType = "long"),
-	})
-	@ApiOperationSupport(order = 1)
-	@ApiOperation(value = "详情", notes = "传入orderProcessInfoEntity")
-	public R<OrderProcessInfoVO> detail(OrderProcessInfoEntity orderProcessInfoEntity) {
+    /**
+     * 删除
+     */
+    @PostMapping("/remove")
+    @ApiOperationSupport(order = 7)
+    @ApiOperation(value = "逻辑删除", notes = "传入projectInfoEntity")
+    public R remove(@ApiParam(value = "主键集合") @RequestParam String ids) {
+        boolean temp = rtuOrderProcessService.deleteLogic(Func.toLongList(ids));
+        return R.status(temp);
+    }
 
-		OrderProcessInfoEntity detail = rtuOrderProcessService.getById(orderProcessInfoEntity.getId());
 
-		OrderProcessInfoVO vo = RtuOrderProcessWrapper.build().entityVO(detail);
-		CheckOrderInfoEntity checkOrderInfoEntity = checkOrderService.getById(vo.getOrderId());
-		if (checkOrderInfoEntity.getOrderConfirmUser() != null) {
-			User user = userService.getById(checkOrderInfoEntity.getOrderConfirmUser());
-			vo.setOrderConfirmUserName(user.getRealName());
-		}
-		DictBiz biz = dictBizService.getById(checkOrderInfoEntity.getOrderFromKey());
-		vo.setOrderFromText(biz.getDictValue());
-		return R.data(vo);
-	}
+    /**
+     * 维修任务-无信号上报信息列表,分页
+     */
+    @GetMapping("/nonetworksignal/page")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "rtuName", value = "测站名称", paramType = "query", dataType = "string"),
+            @ApiImplicitParam(name = "rtuCode", value = "测站编码", paramType = "query", dataType = "string"),
+    })
+    @ApiOperationSupport(order = 3)
+    @ApiOperation(value = "分页", notes = "传入OrderProcessInfoDTO")
+    public R<IPage<OrderProcessInfoVO>> page(OrderProcessInfoDTO orderProcessInfoDTO, Query query) {
+        BladeUser user = AuthUtil.getUser();
+        if (BusinessConstant.ROLE_SYS_ADMIN.equals(user.getRoleName())) {
+            if (Func.isNull(orderProcessInfoDTO.getAdCode())) {
+                orderProcessInfoDTO.setAdCode(BusinessConstant.REGION_NM_ADCODE);
+            }
+            RegionTreeNodeEntity nodeEntity = this.regionService.getRegionNode(user.getRoleName(), user.getDeptId(), orderProcessInfoDTO.getAdCode());
+            if (Func.notNull(nodeEntity)) {
+                orderProcessInfoDTO.setExcludeCode(nodeEntity.getExclude());
+            }
+        } else if (BusinessConstant.ROLE_ORG_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_SERVICE_PERSON.equals(user.getRoleName())) {
+            if (Func.isNull(orderProcessInfoDTO.getAdCode())) {
+                LambdaQueryWrapper<DeptRegionEntity> deptRegionEntityLambdaQueryWrapper = Wrappers.<DeptRegionEntity>query().lambda();
+                deptRegionEntityLambdaQueryWrapper.eq(DeptRegionEntity::getDeptId, Func.toLong(user.getDeptId()));
+                DeptRegionEntity deptRegionEntity = deptRegionService.getOne(deptRegionEntityLambdaQueryWrapper);
+                orderProcessInfoDTO.setAdCode(deptRegionEntity.getAdcd());
+            }
+            RegionTreeNodeEntity nodeEntity = this.regionService.getRegionNode(user.getRoleName(), user.getDeptId(), orderProcessInfoDTO.getAdCode());
+            if (Func.notNull(nodeEntity)) {
+                orderProcessInfoDTO.setExcludeCode(nodeEntity.getExclude());
+            }
+        } else if (BusinessConstant.ROLE_QI_ADMIN.equals(user.getRoleName())) {
+            if (Func.isNull(orderProcessInfoDTO.getAdCode())) {
+                LambdaQueryWrapper<DeptRegionEntity> deptRegionEntityLambdaQueryWrapper = Wrappers.<DeptRegionEntity>query().lambda();
+                deptRegionEntityLambdaQueryWrapper.eq(DeptRegionEntity::getDeptId, Func.toLong(user.getDeptId()));
+                DeptRegionEntity deptRegionEntity = deptRegionService.getOne(deptRegionEntityLambdaQueryWrapper);
+                orderProcessInfoDTO.setAdCode(deptRegionEntity.getAdcd());
+            }
+        }
+        IPage<OrderProcessInfoVO> pages = rtuOrderProcessService.selectNoNetworkSignalPage(Condition.getPage(query), orderProcessInfoDTO);
+        List<OrderProcessInfoVO> list = pages.getRecords();
+        for (OrderProcessInfoVO v : list) {
+            RtuOrderProcessWrapper.build().entityVO(v);
+        }
+        return R.data(pages);
+    }
 
-	/**
-	 * 新增
-	 */
-	@PostMapping("/save")
-	@ApiOperationSupport(order = 4)
-	@ApiOperation(value = "新增", notes = "传入orderProcessInfoEntity")
-	public R save(@RequestBody OrderProcessInfoEntity orderProcessInfoEntity) {
-		BladeUser user = AuthUtil.getUser();
-		CheckOrderInfoEntity checkOrderInfoEntity = checkOrderService.getById(orderProcessInfoEntity.getOrderId());
-		DictInfoEntity dictInfoEntity = dictService.getDict(DictBusinessConstant.ORDER_STATUS_CODE, OrderStatusEnum.STATUS_PROCESS.getCode());
-		checkOrderInfoEntity.setOrderStatusKey(dictInfoEntity.getId());
-		checkOrderInfoEntity.setOrderDesc(orderProcessInfoEntity.getProcessDesc());
-		checkOrderInfoEntity.setProcessUser(user.getUserId());
-		checkOrderInfoEntity.setOrderProcessTime(new Date());
-		checkOrderService.updateById(checkOrderInfoEntity);
-		//checkOrderService.updateOrderStatus(checkOrderInfoEntity);
+    /**
+     * 维修任务上报-无信号上报图片补交关闭
+     *
+     * @param orderProcessInfoEntity
+     * @return
+     */
+    @PostMapping("/nonetworksignal/close")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "id", value = "记录ID", paramType = "query", dataType = "long"),
+    })
+    @ApiOperationSupport(order = 4)
+    @ApiOperation(value = "图片补交关闭操作", notes = "传入实体类OrderProcessInfoEntity")
+    public R noNetworkSignalPhotoSubmitClose(@RequestBody OrderProcessInfoEntity orderProcessInfoEntity) {
+        if (orderProcessInfoEntity.getId() == null) {
+            return R.fail("参数错误!");
+        }
+        OrderProcessInfoEntity entity = rtuOrderProcessService.getById(orderProcessInfoEntity.getId());
+        if (null == entity) {
+            return R.status(false);
+        }
+        entity.setPhotoSupplementSubmitStatus(1);
 
-		orderProcessInfoEntity.setOrderStatusKey(checkOrderInfoEntity.getOrderStatusKey());
-		rtuOrderProcessService.save(orderProcessInfoEntity);
-		//更新更换信息
-		LambdaQueryWrapper<RtuInfoEntity> rtuWrapper = Wrappers.<RtuInfoEntity>query().lambda();
-		rtuWrapper.eq(RtuInfoEntity::getIsDeleted, 0);
-		rtuWrapper.eq(RtuInfoEntity::getRtuCode, checkOrderInfoEntity.getRtuCode());
-		RtuInfoEntity rtuInfoEntity = rtuBaseInfoService.getOne(rtuWrapper);
-		if (orderProcessInfoEntity.getRtuReplace() != null && orderProcessInfoEntity.getRtuReplace() == 1) {
-			rtuInfoEntity.setRtuReplaceDate(orderProcessInfoEntity.getCreateTime());
-			rtuInfoEntity.setRtuBrand(orderProcessInfoEntity.getRtuBrand());
-			rtuInfoEntity.setRtuModel(orderProcessInfoEntity.getRtuModel());
-		}
-		if (orderProcessInfoEntity.getRainSensorReplace() != null && orderProcessInfoEntity.getRainSensorReplace() == 1) {
-			rtuInfoEntity.setRainSensorReplaceDate(orderProcessInfoEntity.getCreateTime());
-			rtuInfoEntity.setRainSensorBrand(orderProcessInfoEntity.getRainSensorBrand());
-			rtuInfoEntity.setRainSensorModel(orderProcessInfoEntity.getRainSensorModel());
-		}
-		if (orderProcessInfoEntity.getWaterSensorReplace() != null && orderProcessInfoEntity.getWaterSensorReplace() == 1) {
-			rtuInfoEntity.setWaterSensorReplaceDate(orderProcessInfoEntity.getCreateTime());
-			rtuInfoEntity.setWaterSensorBrand(orderProcessInfoEntity.getWaterSensorBrand());
-			rtuInfoEntity.setWaterSensorModel(orderProcessInfoEntity.getWaterSensorModel());
-		}
-		if (orderProcessInfoEntity.getGroundSensorReplace() != null && orderProcessInfoEntity.getGroundSensorReplace() == 1) {
-			rtuInfoEntity.setGroundSensorReplaceDate(orderProcessInfoEntity.getCreateTime());
-			rtuInfoEntity.setGroundSensorBrand(orderProcessInfoEntity.getGroundSensorBrand());
-			rtuInfoEntity.setGroundSensorModel(orderProcessInfoEntity.getGroundSensorModel());
-		}
-		if (orderProcessInfoEntity.getBatteryReplace() != null && orderProcessInfoEntity.getBatteryReplace() == 1) {
-			rtuInfoEntity.setBatteryReplaceDate(orderProcessInfoEntity.getCreateTime());
-		}
-		rtuBaseInfoService.updateById(rtuInfoEntity);
-		return R.status(true);
-	}
+        rtuOrderProcessService.updateById(entity);
+        return R.success("操作成功!");
+    }
 
-	/**
-	 * 修改
-	 */
-	@PostMapping("/update")
-	@ApiOperationSupport(order = 5)
-	@ApiOperation(value = "修改", notes = "传入orderProcessInfoEntity")
-	public R update(@RequestBody OrderProcessInfoEntity orderProcessInfoEntity) {
-		return R.status(rtuOrderProcessService.updateById(orderProcessInfoEntity));
-	}
+    @ApiLog("图片提交")
+    @PostMapping(value = "/nonetworksignal/putPhoto")
+    @ApiOperationSupport(order = 6)
+    @ApiOperation(value = "图片提交", notes = "")
+    public R putFile(MultipartFile file) {
+        BladeFile bladeFile = ossBuilder.template().putFile(file);
+        return R.data(bladeFile);
+    }
 
-	/**
-	 * 新增或修改
-	 */
-	@PostMapping("/submit")
-	@ApiOperationSupport(order = 6)
-	@ApiOperation(value = "新增或修改", notes = "传入orderProcessInfoEntity")
-	public R submit(@RequestBody OrderProcessInfoEntity orderProcessInfoEntity) {
-		return R.status(rtuOrderProcessService.saveOrUpdate(orderProcessInfoEntity));
-	}
-
-	/**
-	 * 删除
-	 */
-	@PostMapping("/remove")
-	@ApiOperationSupport(order = 7)
-	@ApiOperation(value = "逻辑删除", notes = "传入projectInfoEntity")
-	public R remove(@ApiParam(value = "主键集合") @RequestParam String ids) {
-		boolean temp = rtuOrderProcessService.deleteLogic(Func.toLongList(ids));
-		return R.status(temp);
-	}
-
-
-	/**
-	 * 维修任务-无信号上报信息列表,分页
-	 */
-	@GetMapping("/nonetworksignal/page")
-	@ApiImplicitParams({
-		@ApiImplicitParam(name = "rtuName", value = "测站名称", paramType = "query", dataType = "string"),
-		@ApiImplicitParam(name = "rtuCode", value = "测站编码", paramType = "query", dataType = "string"),
-	})
-	@ApiOperationSupport(order = 3)
-	@ApiOperation(value = "分页", notes = "传入OrderProcessInfoDTO")
-	public R<IPage<OrderProcessInfoVO>> page(OrderProcessInfoDTO orderProcessInfoDTO, Query query) {
-		BladeUser user = AuthUtil.getUser();
-		if (BusinessConstant.ROLE_SYS_ADMIN.equals(user.getRoleName())) {
-			if (orderProcessInfoDTO.getAdCode() == null) {
-				orderProcessInfoDTO.setAdCode(BusinessConstant.REGION_NM_ADCODE);
-			}
-		} else if (BusinessConstant.ROLE_ORG_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_SERVICE_PERSON.equals(user.getRoleName())) {
-			if (orderProcessInfoDTO.getAdCode() == null) {
-				LambdaQueryWrapper<DeptRegionEntity> deptRegionEntityLambdaQueryWrapper = Wrappers.<DeptRegionEntity>query().lambda();
-				deptRegionEntityLambdaQueryWrapper.eq(DeptRegionEntity::getIsDeleted, 0);
-				deptRegionEntityLambdaQueryWrapper.eq(DeptRegionEntity::getDeptId, Func.toLong(user.getDeptId()));
-				DeptRegionEntity deptRegionEntity = deptRegionService.getOne(deptRegionEntityLambdaQueryWrapper);
-				orderProcessInfoDTO.setAdCode(deptRegionEntity.getAdcd());
-			}
-		}
-		if (orderProcessInfoDTO.getAdCode()!=null){
-			RegionTreeNodeEntity nodeEntity= this.regionService.getRegionNode(user.getRoleName(),user.getDeptId(),orderProcessInfoDTO.getAdCode());
-			orderProcessInfoDTO.setExcludeCode(nodeEntity.getExclude());
-		}
-		IPage<OrderProcessInfoVO> pages = rtuOrderProcessService.selectNoNetworkSignalPage(Condition.getPage(query), orderProcessInfoDTO);
-		List<OrderProcessInfoVO> list = pages.getRecords();
-		for (OrderProcessInfoVO v : list) {
-			RtuOrderProcessWrapper.build().entityVO(v);
-		}
-		return R.data(pages);
-	}
-
-	/**
-	 * 维修任务上报-无信号上报图片补交关闭
-	 *
-	 * @param orderProcessInfoEntity
-	 * @return
-	 */
-	@PostMapping("/nonetworksignal/close")
-	@ApiImplicitParams({
-		@ApiImplicitParam(name = "id", value = "记录ID", paramType = "query", dataType = "long"),
-	})
-	@ApiOperationSupport(order = 4)
-	@ApiOperation(value = "图片补交关闭操作", notes = "传入实体类OrderProcessInfoEntity")
-	public R noNetworkSignalPhotoSubmitClose(@RequestBody OrderProcessInfoEntity orderProcessInfoEntity) {
-		if (orderProcessInfoEntity.getId() == null) {
-			return R.fail("参数错误!");
-		}
-		OrderProcessInfoEntity entity = rtuOrderProcessService.getById(orderProcessInfoEntity.getId());
-		if (null == entity) {
-			return R.status(false);
-		}
-		entity.setPhotoSupplementSubmitStatus(1);
-
-		rtuOrderProcessService.updateById(entity);
-		return R.success("操作成功!");
-	}
-
-	@ApiLog("图片提交")
-	@PostMapping(value = "/nonetworksignal/putPhoto")
-	@ApiOperationSupport(order = 6)
-	@ApiOperation(value = "图片提交", notes = "")
-	public R putFile(MultipartFile file) {
-		BladeFile bladeFile = ossBuilder.template().putFile(file);
-		return R.data(bladeFile);
-	}
-
-	/**
-	 * 修改
-	 */
-	@PostMapping("/nonetworksignal/photo/update")
-	@ApiOperationSupport(order = 5)
-	@ApiOperation(value = "修改", notes = "传入OrderProcessInfoEntity")
-	public R nonetworksignalPhotoUpdate(@RequestBody OrderProcessInfoEntity orderProcessInfoEntity) {
-		OrderProcessInfoEntity entity = rtuOrderProcessService.getById(orderProcessInfoEntity.getId());
-		entity.setBaseBeforePhoto1Take(orderProcessInfoEntity.getBaseBeforePhoto1Take());
-		entity.setBaseBeforePhoto1Url(orderProcessInfoEntity.getBaseBeforePhoto1Url());
-		entity.setBaseBeforePhoto2Take(orderProcessInfoEntity.getBaseBeforePhoto2Take());
-		entity.setBaseBeforePhoto2Url(orderProcessInfoEntity.getBaseBeforePhoto2Url());
-		entity.setBaseAfterPhoto1Take(orderProcessInfoEntity.getBaseAfterPhoto1Take());
-		entity.setBaseAfterPhoto1Url(orderProcessInfoEntity.getBaseAfterPhoto1Url());
-		entity.setBaseAfterPhoto2Take(orderProcessInfoEntity.getBaseAfterPhoto2Take());
-		entity.setBaseAfterPhoto2Url(orderProcessInfoEntity.getBaseAfterPhoto2Url());
-		entity.setRtuPhotoTake(orderProcessInfoEntity.getRtuPhotoTake());
-		entity.setRtuPhotoUrl(orderProcessInfoEntity.getRtuPhotoUrl());
-		entity.setRainSensorPhotoTake(orderProcessInfoEntity.getRainSensorPhotoTake());
-		entity.setRainSensorPhotoUrl(orderProcessInfoEntity.getRainSensorPhotoUrl());
-		entity.setWaterSensorPhotoTake(orderProcessInfoEntity.getWaterSensorPhotoTake());
-		entity.setWaterSensorPhotoUrl(orderProcessInfoEntity.getWaterSensorPhotoUrl());
-		entity.setGroundSensorPhotoTake(orderProcessInfoEntity.getGroundSensorPhotoTake());
-		entity.setGroundSensorPhotoUrl(orderProcessInfoEntity.getGroundSensorPhotoUrl());
-		entity.setBatteryPhotoTake(orderProcessInfoEntity.getBatteryPhotoTake());
-		entity.setBatteryPhotoUrl(orderProcessInfoEntity.getBatteryPhotoUrl());
-		entity.setSunPhotoTake(orderProcessInfoEntity.getSunPhotoTake());
-		entity.setSunPhotoUrl(orderProcessInfoEntity.getSunPhotoUrl());
-		return R.status(rtuOrderProcessService.updateById(entity));
-	}
+    /**
+     * 修改
+     */
+    @PostMapping("/nonetworksignal/photo/update")
+    @ApiOperationSupport(order = 5)
+    @ApiOperation(value = "修改", notes = "传入OrderProcessInfoEntity")
+    public R nonetworksignalPhotoUpdate(@RequestBody OrderProcessInfoEntity orderProcessInfoEntity) {
+        OrderProcessInfoEntity entity = rtuOrderProcessService.getById(orderProcessInfoEntity.getId());
+        entity.setBaseBeforePhoto1Take(orderProcessInfoEntity.getBaseBeforePhoto1Take());
+        entity.setBaseBeforePhoto1Url(orderProcessInfoEntity.getBaseBeforePhoto1Url());
+        entity.setBaseBeforePhoto2Take(orderProcessInfoEntity.getBaseBeforePhoto2Take());
+        entity.setBaseBeforePhoto2Url(orderProcessInfoEntity.getBaseBeforePhoto2Url());
+        entity.setBaseAfterPhoto1Take(orderProcessInfoEntity.getBaseAfterPhoto1Take());
+        entity.setBaseAfterPhoto1Url(orderProcessInfoEntity.getBaseAfterPhoto1Url());
+        entity.setBaseAfterPhoto2Take(orderProcessInfoEntity.getBaseAfterPhoto2Take());
+        entity.setBaseAfterPhoto2Url(orderProcessInfoEntity.getBaseAfterPhoto2Url());
+        entity.setRtuPhotoTake(orderProcessInfoEntity.getRtuPhotoTake());
+        entity.setRtuPhotoUrl(orderProcessInfoEntity.getRtuPhotoUrl());
+        entity.setRainSensorPhotoTake(orderProcessInfoEntity.getRainSensorPhotoTake());
+        entity.setRainSensorPhotoUrl(orderProcessInfoEntity.getRainSensorPhotoUrl());
+        entity.setWaterSensorPhotoTake(orderProcessInfoEntity.getWaterSensorPhotoTake());
+        entity.setWaterSensorPhotoUrl(orderProcessInfoEntity.getWaterSensorPhotoUrl());
+        entity.setGroundSensorPhotoTake(orderProcessInfoEntity.getGroundSensorPhotoTake());
+        entity.setGroundSensorPhotoUrl(orderProcessInfoEntity.getGroundSensorPhotoUrl());
+        entity.setBatteryPhotoTake(orderProcessInfoEntity.getBatteryPhotoTake());
+        entity.setBatteryPhotoUrl(orderProcessInfoEntity.getBatteryPhotoUrl());
+        entity.setSunPhotoTake(orderProcessInfoEntity.getSunPhotoTake());
+        entity.setSunPhotoUrl(orderProcessInfoEntity.getSunPhotoUrl());
+        return R.status(rtuOrderProcessService.updateById(entity));
+    }
 }

+ 14 - 5
src/main/java/org/springblade/modules/business/data/controller/RtuDataRainController.java

@@ -156,24 +156,33 @@ public class RtuDataRainController extends BladeController {
     public R<IPage<RtuDataRainVO>> yjPage(@ApiIgnore RtuDataRainDTO rtuDataRainDTO, Query query) {
         BladeUser user = AuthUtil.getUser();
         if (BusinessConstant.ROLE_SYS_ADMIN.equals(user.getRoleName())) {
-            if (rtuDataRainDTO.getAdCode() == null) {
+            if (Func.isNull(rtuDataRainDTO.getAdCode())) {
                 rtuDataRainDTO.setAdCode(BusinessConstant.REGION_NM_ADCODE);
             }
+            RegionTreeNodeEntity node = this.regionService.getRegionNode(user.getRoleName(), user.getDeptId(), rtuDataRainDTO.getAdCode());
+            if (null != node) {
+                rtuDataRainDTO.setExcludeCode(node.getExclude());
+            }
         } else if (BusinessConstant.ROLE_ORG_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_SERVICE_PERSON.equals(user.getRoleName())) {
-            if (rtuDataRainDTO.getAdCode() == null) {
+            if (Func.isNull(rtuDataRainDTO.getAdCode())) {
                 LambdaQueryWrapper<DeptRegionEntity> deptRegionEntityLambdaQueryWrapper = Wrappers.<DeptRegionEntity>query().lambda();
-                deptRegionEntityLambdaQueryWrapper.eq(DeptRegionEntity::getIsDeleted, 0);
                 deptRegionEntityLambdaQueryWrapper.eq(DeptRegionEntity::getDeptId, Func.toLong(user.getDeptId()));
                 DeptRegionEntity deptRegionEntity = deptRegionService.getOne(deptRegionEntityLambdaQueryWrapper);
                 rtuDataRainDTO.setAdCode(deptRegionEntity.getAdcd());
             }
-        }
-        if (rtuDataRainDTO.getAdCode() != null) {
             RegionTreeNodeEntity node = this.regionService.getRegionNode(user.getRoleName(), user.getDeptId(), rtuDataRainDTO.getAdCode());
             if (null != node) {
                 rtuDataRainDTO.setExcludeCode(node.getExclude());
             }
+        } else if (BusinessConstant.ROLE_QI_ADMIN.equals(user.getRoleName())) {
+            if (Func.isNull(rtuDataRainDTO.getAdCode())) {
+                LambdaQueryWrapper<DeptRegionEntity> deptRegionEntityLambdaQueryWrapper = Wrappers.<DeptRegionEntity>query().lambda();
+                deptRegionEntityLambdaQueryWrapper.eq(DeptRegionEntity::getDeptId, Func.toLong(user.getDeptId()));
+                DeptRegionEntity deptRegionEntity = deptRegionService.getOne(deptRegionEntityLambdaQueryWrapper);
+                rtuDataRainDTO.setAdCode(deptRegionEntity.getAdcd());
+            }
         }
+
         IPage<RtuDataRainVO> pages = dataRainService.selectYjPage(Condition.getPage(query), rtuDataRainDTO);
         List<RtuDataRainVO> list = pages.getRecords();
         for (RtuDataRainVO vo : list) {

+ 1158 - 1046
src/main/java/org/springblade/modules/business/equipment/inspection/base/controller/EquipmentInspectionController.java

@@ -73,1050 +73,1162 @@ import java.util.*;
 @RequiredArgsConstructor
 @Api(value = "设备巡检管理模块", tags = "设备巡检管理模块")
 public class EquipmentInspectionController extends BladeController {
-	private final IEquipmentInspectionService equipmentInspectionService;
-	private final IEquipmentInspectionPlanService planService;
-	private final IDeptService deptService;
-	private final IRtuBaseInfoService rtuBaseInfoService;
-	private final IDeptRegionService deptRegionService;
-	private final IEquipmentInspectionReportService inspectionReportService;
-	private final IUserService userService;
-	private final IRegionInfoService regionService;
-
-	@Resource
-	private OssBuilder ossBuilder;
-
-	@Value("${export-config.workdir}")
-	private String workDir;
-
-	@Value("${export-config.inspection-unfinished-template}")
-	private String inspectionUnfinishedTemplate;
-
-	/**
-	 * 全部列表
-	 */
-	@GetMapping("/list")
-	@ApiOperationSupport(order = 2)
-	@ApiOperation(value = "全部列表,不分页")
-	public R<List<EquipmentInspectionInfoVO>> list() {
-		List<EquipmentInspectionInfoEntity> pages = equipmentInspectionService.list();
-		return R.data(EquipmentInspectionWrapper.build().listVO(pages));
-	}
-
-
-	@GetMapping("/page")
-	@ApiImplicitParams({
-		@ApiImplicitParam(name = "rtuCode", value = "测站编码", paramType = "query", dataType = "string"),
-		@ApiImplicitParam(name = "rtuName", value = "测站名称", paramType = "query", dataType = "string"),
-		@ApiImplicitParam(name = "adCode", value = "行政区划编码", paramType = "query", dataType = "string"),
-	})
-	@ApiOperationSupport(order = 3)
-	@ApiOperation(value = "分页", notes = "传入 EquipmentInspectionInfoDTO 实体类")
-	public R<IPage<EquipmentInspectionInfoVO>> page(@ApiIgnore EquipmentInspectionInfoDTO inspectionInfoDTO, Query query) {
-		BladeUser user = AuthUtil.getUser();
-		if (BusinessConstant.ROLE_SYS_ADMIN.equals(user.getRoleName())) {
-			if (inspectionInfoDTO.getAdCode() == null) {
-				inspectionInfoDTO.setAdCode(BusinessConstant.REGION_NM_ADCODE);
-			}
-		} else if (BusinessConstant.ROLE_ORG_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_SERVICE_PERSON.equals(user.getRoleName())) {
-			if (inspectionInfoDTO.getAdCode() == null) {
-				LambdaQueryWrapper<DeptRegionEntity> deptRegionEntityLambdaQueryWrapper = Wrappers.<DeptRegionEntity>query().lambda();
-				deptRegionEntityLambdaQueryWrapper.eq(DeptRegionEntity::getIsDeleted, 0);
-				deptRegionEntityLambdaQueryWrapper.eq(DeptRegionEntity::getDeptId, Func.toLong(user.getDeptId()));
-				DeptRegionEntity deptRegionEntity = deptRegionService.getOne(deptRegionEntityLambdaQueryWrapper);
-				inspectionInfoDTO.setAdCode(deptRegionEntity.getAdcd());
-			}
-		}
-
-		if (inspectionInfoDTO.getAdCode() != null) {
-			RegionTreeNodeEntity node = this.regionService.getRegionNode(user.getRoleName(), user.getDeptId(), inspectionInfoDTO.getAdCode());
-			if (null != node) {
-				inspectionInfoDTO.setExcludeCode(node.getExclude());
-			}
-		}
-		IPage<EquipmentInspectionInfoVO> pages = equipmentInspectionService.selectPage(Condition.getPage(query), inspectionInfoDTO);
-		return R.data(pages);
-	}
-
-
-	@GetMapping("/rain/page")
-	@ApiImplicitParams({
-		@ApiImplicitParam(name = "rtuCode", value = "测站编码", paramType = "query", dataType = "string"),
-		@ApiImplicitParam(name = "rtuName", value = "测站名称", paramType = "query", dataType = "string"),
-		@ApiImplicitParam(name = "adCode", value = "行政区划编码", paramType = "query", dataType = "string"),
-		@ApiImplicitParam(name = "rainSeasonKind", value = "汛期类型", paramType = "query", dataType = "int"),
-		@ApiImplicitParam(name = "servicePersonId", value = "运维人员", paramType = "query", dataType = "long"),
-		@ApiImplicitParam(name = "deptId", value = "部门ID", paramType = "query", dataType = "long")
-	})
-	@ApiOperationSupport(order = 3)
-	@ApiOperation(value = "分页", notes = "传入 EquipmentInspectionInfoDTO 实体类")
-	public R<IPage<EquipmentInspectionInfoVO>> rainpage(@ApiIgnore EquipmentInspectionInfoDTO inspectionInfoDTO, Query query) {
-		BladeUser user = AuthUtil.getUser();
-		if (inspectionInfoDTO.getDeptId() != null) {
-			LambdaQueryWrapper<DeptRegionEntity> deptLambdaQueryWrapper = Wrappers.<DeptRegionEntity>query().lambda();
-			deptLambdaQueryWrapper.eq(DeptRegionEntity::getIsDeleted, 0);
-			deptLambdaQueryWrapper.eq(DeptRegionEntity::getDeptId, inspectionInfoDTO.getDeptId());
-			DeptRegionEntity deptRegionEntity = deptRegionService.getOne(deptLambdaQueryWrapper);
-			inspectionInfoDTO.setAdCode(deptRegionEntity.getAdcd());
-		} else {
-			if (BusinessConstant.ROLE_SYS_ADMIN.equals(user.getRoleName())) {
-				if (inspectionInfoDTO.getAdCode() == null) {
-					inspectionInfoDTO.setAdCode(BusinessConstant.REGION_NM_ADCODE);
-				}
-			} else if (BusinessConstant.ROLE_ORG_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_SERVICE_PERSON.equals(user.getRoleName())) {
-				if (inspectionInfoDTO.getAdCode() == null) {
-					LambdaQueryWrapper<DeptRegionEntity> deptRegionEntityLambdaQueryWrapper = Wrappers.<DeptRegionEntity>query().lambda();
-					deptRegionEntityLambdaQueryWrapper.eq(DeptRegionEntity::getIsDeleted, 0);
-					deptRegionEntityLambdaQueryWrapper.eq(DeptRegionEntity::getDeptId, Func.toLong(user.getDeptId()));
-					DeptRegionEntity deptRegionEntity = deptRegionService.getOne(deptRegionEntityLambdaQueryWrapper);
-					inspectionInfoDTO.setAdCode(deptRegionEntity.getAdcd());
-				}
-			}
-		}
-		if (inspectionInfoDTO.getAdCode() != null) {
-			RegionTreeNodeEntity node = this.regionService.getRegionNode(user.getRoleName(), user.getDeptId(), inspectionInfoDTO.getAdCode());
-			if (null != node) {
-				inspectionInfoDTO.setExcludeCode(node.getExclude());
-			}
-		}
-
-		Calendar calendar = Calendar.getInstance();
-		calendar.setTime(new Date());
-		calendar.set(Calendar.MONTH, 0);
-		calendar.set(Calendar.DAY_OF_MONTH, 1);
-		calendar.set(Calendar.HOUR_OF_DAY, 0);
-		calendar.set(Calendar.MINUTE, 0);
-		calendar.set(Calendar.SECOND, 0);
-		inspectionInfoDTO.setInspectionYearStartDate(calendar.getTime());
-		calendar.add(Calendar.YEAR, 1);
-		inspectionInfoDTO.setInspectionYearEndDate(calendar.getTime());
-
-		if (inspectionInfoDTO.getRainSeasonKind() != null) {
-			if (inspectionInfoDTO.getRainSeasonKind() == 1) {
-				inspectionInfoDTO.setBeforeRainSeasonStatus(1);
-				inspectionInfoDTO.setBeforeRainSeasonReportUser(inspectionInfoDTO.getServicePersonId());
-			} else if (inspectionInfoDTO.getRainSeasonKind() == 2) {
-				inspectionInfoDTO.setRainSeasonFirstStatus(1);
-				inspectionInfoDTO.setRainSeasonFirstReportUser(inspectionInfoDTO.getServicePersonId());
-			} else if (inspectionInfoDTO.getRainSeasonKind() == 3) {
-				inspectionInfoDTO.setRainSeasonSecondStatus(1);
-				inspectionInfoDTO.setRainSeasonSecondReportUser(inspectionInfoDTO.getServicePersonId());
-			}
-		}
-
-		IPage<EquipmentInspectionInfoVO> pages = equipmentInspectionService.selectPage(Condition.getPage(query), inspectionInfoDTO);
-		return R.data(pages);
-	}
-
-	/**
-	 * 当前汛期待巡检的设备,只返回未巡检过的设备
-	 * @param inspectionInfoDTO
-	 * @param query
-	 * @return
-	 */
-	@GetMapping("/rtu/page")
-	@ApiImplicitParams({
-		@ApiImplicitParam(name = "rtuCode", value = "测站编码", paramType = "query", dataType = "string"),
-		@ApiImplicitParam(name = "rtuName", value = "测站名称", paramType = "query", dataType = "string"),
-		@ApiImplicitParam(name = "adCode", value = "行政区划编码", paramType = "query", dataType = "string"),
-	})
-	@ApiOperationSupport(order = 3)
-	@ApiOperation(value = "当前汛期待巡检设备", notes = "传入 EquipmentInspectionInfoDTO 实体类")
-	public R<IPage<EquipmentInspectionInfoVO>> rtuPage(@ApiIgnore EquipmentInspectionInfoDTO inspectionInfoDTO, Query query) {
-		BladeUser user = AuthUtil.getUser();
-		if (BusinessConstant.ROLE_SYS_ADMIN.equals(user.getRoleName())) {
-			if (inspectionInfoDTO.getAdCode() == null) {
-				inspectionInfoDTO.setAdCode(BusinessConstant.REGION_NM_ADCODE);
-			}
-		} else if (BusinessConstant.ROLE_ORG_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_SERVICE_PERSON.equals(user.getRoleName())) {
-			if (inspectionInfoDTO.getAdCode() == null) {
-				LambdaQueryWrapper<DeptRegionEntity> deptRegionEntityLambdaQueryWrapper = Wrappers.<DeptRegionEntity>query().lambda();
-				deptRegionEntityLambdaQueryWrapper.eq(DeptRegionEntity::getIsDeleted, 0);
-				deptRegionEntityLambdaQueryWrapper.eq(DeptRegionEntity::getDeptId, Func.toLong(user.getDeptId()));
-				DeptRegionEntity deptRegionEntity = deptRegionService.getOne(deptRegionEntityLambdaQueryWrapper);
-				inspectionInfoDTO.setAdCode(deptRegionEntity.getAdcd());
-			}
-		}
-		if (inspectionInfoDTO.getAdCode() != null) {
-			RegionTreeNodeEntity node = this.regionService.getRegionNode(user.getRoleName(), user.getDeptId(), inspectionInfoDTO.getAdCode());
-			if (null != node) {
-				inspectionInfoDTO.setExcludeCode(node.getExclude());
-			}
-		}
-		Calendar calendar = Calendar.getInstance();
-		calendar.setTime(new Date());
-		calendar.set(Calendar.MONTH, 0);
-		calendar.set(Calendar.DAY_OF_MONTH, 1);
-		calendar.set(Calendar.HOUR_OF_DAY, 0);
-		calendar.set(Calendar.MINUTE, 0);
-		calendar.set(Calendar.SECOND, 0);
-		inspectionInfoDTO.setInspectionYearStartDate(calendar.getTime());
-		calendar.add(Calendar.YEAR, 1);
-		inspectionInfoDTO.setInspectionYearEndDate(calendar.getTime());
-		EquipmentInspectionPlanEntity planEntity = planService.getPlanInfo();
-		calendar.setTime(new Date());
-		Date dt = calendar.getTime();
-		if ((dt.getTime() / 1000 == planEntity.getBeforeRainSeasonEndTime().getTime() / 1000 || dt.after(planEntity.getBeforeRainSeasonStartTime())) && dt.before(planEntity.getBeforeRainSeasonEndTime())) {
-			inspectionInfoDTO.setBeforeRainSeasonStatus(1);
-		} else if ((dt.getTime() / 1000 == planEntity.getBeforeRainSeasonEndTime().getTime() / 1000 || dt.after(planEntity.getRainSeasonFirstStartTime())) && dt.before(planEntity.getRainSeasonFirstEndTime())) {
-			inspectionInfoDTO.setRainSeasonFirstStatus(1);
-		} else if ((dt.getTime() / 1000 == planEntity.getBeforeRainSeasonEndTime().getTime() / 1000 || dt.after(planEntity.getRainSeasonSecondStartTime())) && dt.before(planEntity.getRainSeasonSecondEndTime())) {
-			inspectionInfoDTO.setRainSeasonSecondStatus(1);
-		}
-		IPage<EquipmentInspectionInfoVO> pages = equipmentInspectionService.selectRtuPage(Condition.getPage(query), inspectionInfoDTO);
-		List<EquipmentInspectionInfoVO> list = pages.getRecords();
-		for (EquipmentInspectionInfoVO vo : list) {
-	        EquipmentInspectionWrapper.build().entityVO(vo);
-		}
-		return R.data(pages);
-	}
-
-	/**
-	 * 统计本年度巡检设备数量、各汛期巡检设备数量
-	 *
-	 * @param inspectionInfoDTO
-	 * @return
-	 */
-	@GetMapping("/count")
-	@ApiImplicitParams({
-		@ApiImplicitParam(name = "adCode", value = "行政区划编码", paramType = "query", dataType = "string"),
-	})
-	@ApiOperationSupport(order = 2)
-	@ApiOperation(value = "已巡检上报设备数量")
-	public R<Map<String, Object>> inspectionReportCount(@ApiIgnore EquipmentInspectionInfoDTO inspectionInfoDTO) {
-		BladeUser user = AuthUtil.getUser();
-		if (BusinessConstant.ROLE_SYS_ADMIN.equals(user.getRoleName())) {
-			if (inspectionInfoDTO.getAdCode() == null) {
-				inspectionInfoDTO.setAdCode(BusinessConstant.REGION_NM_ADCODE);
-			}
-		} else if (BusinessConstant.ROLE_ORG_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_SERVICE_PERSON.equals(user.getRoleName())) {
-			if (inspectionInfoDTO.getAdCode() == null) {
-				LambdaQueryWrapper<DeptRegionEntity> deptRegionEntityLambdaQueryWrapper = Wrappers.<DeptRegionEntity>query().lambda();
-				deptRegionEntityLambdaQueryWrapper.eq(DeptRegionEntity::getIsDeleted, 0);
-				deptRegionEntityLambdaQueryWrapper.eq(DeptRegionEntity::getDeptId, Func.toLong(user.getDeptId()));
-				DeptRegionEntity deptRegionEntity = deptRegionService.getOne(deptRegionEntityLambdaQueryWrapper);
-				inspectionInfoDTO.setAdCode(deptRegionEntity.getAdcd());
-			}
-		}
-		int excludeCode =0;
-		if (inspectionInfoDTO.getAdCode() != null) {
-			RegionTreeNodeEntity node = this.regionService.getRegionNode(user.getRoleName(), user.getDeptId(), inspectionInfoDTO.getAdCode());
-			if (null != node) {
-				excludeCode = node.getExclude();
-			}
-		}
-		inspectionInfoDTO.setExcludeCode(excludeCode);
-
-		Map<String, Object> data = new HashMap<>();
-		RtuInfoDTO rtuInfoDTO=new RtuInfoDTO();
-		rtuInfoDTO.setExcludeCode(excludeCode);
-		rtuInfoDTO.setAdCode(inspectionInfoDTO.getAdCode());
-		long count = rtuBaseInfoService.rtuCount(rtuInfoDTO);
-		data.put("rtus", count);
-		long rtus = count;
-		int rainKind = 0;
-		long remaininspectionrtus = 0;
-		EquipmentInspectionPlanEntity planEntity = planService.getPlanInfo();
-		Date dt = new Date();
-		if (dt.after(planEntity.getBeforeRainSeasonStartTime()) && dt.before(planEntity.getBeforeRainSeasonEndTime())) {
-			rainKind = 1;
-		} else if (dt.after(planEntity.getRainSeasonFirstStartTime()) && dt.before(planEntity.getRainSeasonFirstEndTime())) {
-			rainKind = 2;
-		} else if (dt.after(planEntity.getRainSeasonSecondStartTime()) && dt.before(planEntity.getRainSeasonSecondEndTime())) {
-			rainKind = 3;
-		}
-		data.put("rainKind", rainKind);
-		Calendar calendar = Calendar.getInstance();
-		calendar.setTime(new Date());
-		calendar.set(Calendar.MONTH, 0);
-		calendar.set(Calendar.DAY_OF_MONTH, 1);
-		calendar.set(Calendar.HOUR_OF_DAY, 0);
-		calendar.set(Calendar.MINUTE, 0);
-		calendar.set(Calendar.SECOND, 0);
-		inspectionInfoDTO.setInspectionYearStartDate(calendar.getTime());
-		calendar.add(Calendar.YEAR, 1);
-		inspectionInfoDTO.setInspectionYearEndDate(calendar.getTime());
-
-		count = equipmentInspectionService.inspectionCount(inspectionInfoDTO);
-		data.put("inspectionCount", count);
-		EquipmentInspectionReportDTO inspectionReportDTO = new EquipmentInspectionReportDTO();
-		calendar.setTime(new Date());
-		calendar.set(Calendar.MONTH, 0);
-		calendar.set(Calendar.DAY_OF_MONTH, 1);
-		calendar.set(Calendar.HOUR_OF_DAY, 0);
-		calendar.set(Calendar.MINUTE, 0);
-		calendar.set(Calendar.SECOND, 0);
-		inspectionReportDTO.setInspectionYearStartDate(calendar.getTime());
-		calendar.add(Calendar.YEAR, 1);
-		inspectionReportDTO.setInspectionYearEndDate(calendar.getTime());
-		inspectionReportDTO.setRainSeasonKind(1);
-		inspectionReportDTO.setExcludeCode(excludeCode);
-		inspectionReportDTO.setAdCode(inspectionInfoDTO.getAdCode());
-		count = inspectionReportService.equipmentInspectionReportCount(inspectionReportDTO);
-		data.put("beforeRainInspectionCount", count);
-		if (rainKind == 1) {
-			remaininspectionrtus = rtus - count;
-		}
-		inspectionReportDTO.setRainSeasonKind(2);
-		count = inspectionReportService.equipmentInspectionReportCount(inspectionReportDTO);
-		data.put("firstRainInspectionCount", count);
-		if (rainKind == 2) {
-			remaininspectionrtus = rtus - count;
-		}
-		inspectionReportDTO.setRainSeasonKind(3);
-		count = inspectionReportService.equipmentInspectionReportCount(inspectionReportDTO);
-		data.put("sencodRainInspectionCount", count);
-		if (rainKind == 3) {
-			remaininspectionrtus = rtus - count;
-		}
-		data.put("remaininspectionrtus", remaininspectionrtus);
-		return R.data(data);
-	}
-
-	/**
-	 * 填报状态
-	 */
-	@GetMapping("/reportStatus")
-	@ApiOperationSupport(order = 1)
-	@ApiOperation(value = "详情", notes = "传入实体类EquipmentInspectionInfoEntity")
-	public R<EquipmentInspectionInfoVO> getReportStatus(EquipmentInspectionInfoEntity equipmentInspectionInfoEntity) {
-		if (null == equipmentInspectionInfoEntity.getId()) {
-			return R.fail("参数错误");
-		}
-		EquipmentInspectionInfoEntity detail = equipmentInspectionService.getById(equipmentInspectionInfoEntity.getId());
-		return R.data(EquipmentInspectionWrapper.build().entityVO(detail));
-	}
-
-	/**
-	 * 填报状态
-	 */
-	@GetMapping("/rtu/reportStatus")
-	@ApiOperationSupport(order = 1)
-	@ApiOperation(value = "详情", notes = "传入实体类EquipmentInspectionInfoEntity")
-	public R<EquipmentInspectionInfoVO> getRtuReportStatus(EquipmentInspectionInfoEntity equipmentInspectionInfoEntity) {
-		if (null == equipmentInspectionInfoEntity.getRtuCode()) {
-			return R.fail("参数错误");
-		}
-		LambdaQueryWrapper<EquipmentInspectionInfoEntity> wrapper = Wrappers.<EquipmentInspectionInfoEntity>query().lambda();
-		wrapper.eq(EquipmentInspectionInfoEntity::getIsDeleted, 0);
-		wrapper.eq(EquipmentInspectionInfoEntity::getRtuCode, equipmentInspectionInfoEntity.getRtuCode());
-		Calendar calendar = Calendar.getInstance();
-		calendar.setTime(new Date());
-		calendar.set(Calendar.MONTH, 0);
-		calendar.set(Calendar.DAY_OF_MONTH, 1);
-		calendar.set(Calendar.HOUR_OF_DAY, 0);
-		calendar.set(Calendar.MINUTE, 0);
-		calendar.set(Calendar.SECOND, 0);
-		calendar.set(Calendar.MILLISECOND, 0);
-		wrapper.ge(EquipmentInspectionInfoEntity::getInspectionDate, calendar.getTime());
-		calendar.add(Calendar.YEAR, 1);
-		wrapper.lt(EquipmentInspectionInfoEntity::getInspectionDate, calendar.getTime());
-		EquipmentInspectionInfoEntity detail = equipmentInspectionService.getOne(wrapper);
-		if (null == detail) {
-			detail = new EquipmentInspectionInfoEntity();
-			detail.setBeforeRainSeasonStatus(0);
-			detail.setRainSeasonFirstStatus(0);
-			detail.setRainSeasonSecondStatus(0);
-		}
-		return R.data(EquipmentInspectionWrapper.build().entityVO(detail));
-	}
-
-	/**
-	 * 详情
-	 */
-	@GetMapping("/detail")
-	@ApiOperationSupport(order = 1)
-	@ApiOperation(value = "详情", notes = "传入实体类EquipmentInspectionInfoEntity")
-	public R<EquipmentInspectionInfoVO> detail(EquipmentInspectionInfoEntity equipmentInspectionInfoEntity) {
-		if (null == equipmentInspectionInfoEntity.getId()) {
-			return R.fail("参数错误");
-		}
-		EquipmentInspectionInfoEntity detail = equipmentInspectionService.getOne(Condition.getQueryWrapper(equipmentInspectionInfoEntity));
-		return R.data(EquipmentInspectionWrapper.build().entityVO(detail));
-	}
-
-	/**
-	 * 新增
-	 */
-	@PostMapping("/save")
-	@ApiOperationSupport(order = 4)
-	@ApiOperation(value = "新增", notes = "传入orderProcessInfoEntity")
-	public R save(@RequestBody EquipmentInspectionInfoEntity equipmentInspectionInfoEntity) {
-		return R.status(equipmentInspectionService.save(equipmentInspectionInfoEntity));
-	}
-
-	/**
-	 * 修改
-	 */
-	@PostMapping("/update")
-	@ApiOperationSupport(order = 5)
-	@ApiOperation(value = "修改", notes = "传入orderProcessInfoEntity")
-	public R update(@RequestBody EquipmentInspectionInfoEntity equipmentInspectionInfoEntity) {
-		return R.status(equipmentInspectionService.updateById(equipmentInspectionInfoEntity));
-	}
-
-	/**
-	 * 新增或修改
-	 */
-	@PostMapping("/submit")
-	@ApiOperationSupport(order = 6)
-	@ApiOperation(value = "新增或修改", notes = "传入orderProcessInfoEntity")
-	public R submit(@RequestBody EquipmentInspectionInfoEntity equipmentInspectionInfoEntity) {
-		return R.status(equipmentInspectionService.saveOrUpdate(equipmentInspectionInfoEntity));
-	}
-
-	/**
-	 * 删除
-	 */
-	@PostMapping("/remove")
-	@ApiOperationSupport(order = 7)
-	@ApiOperation(value = "逻辑删除", notes = "传入projectInfoEntity")
-	public R remove(@ApiParam(value = "主键集合") @RequestParam String ids) {
-		boolean temp = equipmentInspectionService.deleteLogic(Func.toLongList(ids));
-		return R.status(temp);
-	}
-
-	/**
-	 * 巡检统计
-	 *
-	 * @return
-	 */
-	@GetMapping("/person/statistics")
-	@ApiOperationSupport(order = 3)
-	@ApiOperation(value = "统计表格")
-	public R<List<EquipmentInspectionStatisticsVO>> inspectionStatistics() {
-		BladeUser user = AuthUtil.getUser();
-		LambdaQueryWrapper<User> userQueryWrapper = Wrappers.<User>query().lambda();
-		userQueryWrapper.eq(User::getIsDeleted, 0);
-		userQueryWrapper.eq(User::getDeptId, Func.toLong(user.getDeptId()));
-		List<User> list = userService.list(userQueryWrapper);
-		List<EquipmentInspectionStatisticsVO> countList = new LinkedList<>();
-		for (User u : list) {
-			EquipmentInspectionStatisticsVO vo = new EquipmentInspectionStatisticsVO();
-			vo.setUserId(u.getId());
-			vo.setServicePersonName(u.getRealName());
-			EquipmentInspectionInfoDTO inspectionInfoDTO = new EquipmentInspectionInfoDTO();
-			Calendar calendar = Calendar.getInstance();
-			calendar.setTime(new Date());
-			calendar.setTime(new Date());
-			calendar.set(Calendar.MONTH, 0);
-			calendar.set(Calendar.DAY_OF_MONTH, 1);
-			calendar.set(Calendar.HOUR_OF_DAY, 0);
-			calendar.set(Calendar.MINUTE, 0);
-			calendar.set(Calendar.SECOND, 0);
-			inspectionInfoDTO.setInspectionYearStartDate(calendar.getTime());
-			calendar.add(Calendar.YEAR, 1);
-			inspectionInfoDTO.setInspectionYearEndDate(calendar.getTime());
-			inspectionInfoDTO.setBeforeRainSeasonReportUser(u.getId());
-			long count = equipmentInspectionService.inspectionCount(inspectionInfoDTO);
-			vo.setBeforeRainInspectionCount(count);
-			inspectionInfoDTO.setBeforeRainSeasonReportUser(null);
-			inspectionInfoDTO.setRainSeasonFirstReportUser(u.getId());
-			count = equipmentInspectionService.inspectionCount(inspectionInfoDTO);
-			vo.setFirstRainInspectionCount(count);
-			inspectionInfoDTO.setRainSeasonFirstReportUser(null);
-			inspectionInfoDTO.setRainSeasonSecondReportUser(u.getId());
-			count = equipmentInspectionService.inspectionCount(inspectionInfoDTO);
-			vo.setSencodRainInspectionCount(count);
-			countList.add(vo);
-		}
-		return R.data(countList);
-	}
-
-	/**
-	 * 巡检统计
-	 *
-	 * @return
-	 */
-	@GetMapping("/org/statistics")
-	@ApiOperationSupport(order = 3)
-	@ApiOperation(value = "统计表格")
-	public R<List<OrgEquipmentInspectionStatisticsVO>> orgInspectionStatistics() {
-		BladeUser user = AuthUtil.getUser();
-
-		List<OrgEquipmentInspectionStatisticsVO> list = new LinkedList<>();
-		if (BusinessConstant.ROLE_COMPANY_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_SERVICE_PERSON.equals(user.getRoleName())) {
-			//运维公司和运维人员,只显示本部门统计数据
-			Dept dept = deptService.getById(Func.toLong(user.getDeptId()));
-
-			OrgEquipmentInspectionStatisticsVO orgEquipmentInspectionStatisticsVO = new OrgEquipmentInspectionStatisticsVO();
-			orgEquipmentInspectionStatisticsVO.setDeptId(dept.getId());
-			orgEquipmentInspectionStatisticsVO.setOrgName(dept.getDeptName());
-
-			LambdaQueryWrapper<DeptRegionEntity> deptLambdaQueryWrapper = Wrappers.<DeptRegionEntity>query().lambda();
-			deptLambdaQueryWrapper.eq(DeptRegionEntity::getDeptId, dept.getParentId());
-			DeptRegionEntity deptRegionEntity = deptRegionService.getOne(deptLambdaQueryWrapper);
-
-
-			LambdaQueryWrapper<RegionInfoEntity> nodeQueryWrapper = Wrappers.<RegionInfoEntity>query().lambda();
-			nodeQueryWrapper.eq(RegionInfoEntity::getAdcd, deptRegionEntity.getAdcd());
-			RegionInfoEntity nodeRegion = this.regionService.getOne(nodeQueryWrapper);
-
-			int excludecode=0;
-			if (nodeRegion.getParentCode().equals(BusinessConstant.REGION_NM_ADCODE)){
-				excludecode=1;
-			}
-
-			RtuInfoDTO rtuInfoDTO=new RtuInfoDTO();
-		//	RegionTreeNodeEntity node = this.regionService.getRegionNode(user.getRoleName(),user.getDeptId(), deptRegionEntity.getAdcd());
-		//	if (null != node) {
-				rtuInfoDTO.setExcludeCode(excludecode);
-		//	}
-			rtuInfoDTO.setAdCode(deptRegionEntity.getAdcd());
-
-			Long count = rtuBaseInfoService.rtuCount(rtuInfoDTO);
-			orgEquipmentInspectionStatisticsVO.setRtuCount(count);
-			EquipmentInspectionInfoDTO inspectionInfoDTO = new EquipmentInspectionInfoDTO();
-			inspectionInfoDTO.setAdCode(deptRegionEntity.getAdcd());
-
-			//if (null != node) {
-				inspectionInfoDTO.setExcludeCode(excludecode);
-			//}
-			Calendar calendar = Calendar.getInstance();
-			calendar.setTime(new Date());
-			calendar.set(Calendar.MONTH, 0);
-			calendar.set(Calendar.DAY_OF_MONTH, 1);
-			calendar.set(Calendar.HOUR_OF_DAY, 0);
-			calendar.set(Calendar.MINUTE, 0);
-			calendar.set(Calendar.SECOND, 0);
-			inspectionInfoDTO.setInspectionYearStartDate(calendar.getTime());
-			calendar.add(Calendar.YEAR, 1);
-			inspectionInfoDTO.setInspectionYearEndDate(calendar.getTime());
-			count = equipmentInspectionService.inspectionCount(inspectionInfoDTO);
-			orgEquipmentInspectionStatisticsVO.setInspectionCount(count);
-			EquipmentInspectionReportDTO inspectionReportDTO = new EquipmentInspectionReportDTO();
-			inspectionReportDTO.setAdCode(deptRegionEntity.getAdcd());
-			//if (null != node) {
-				inspectionReportDTO.setExcludeCode(excludecode);
-			//}
-			calendar.setTime(new Date());
-			calendar.set(Calendar.MONTH, 0);
-			calendar.set(Calendar.DAY_OF_MONTH, 1);
-			calendar.set(Calendar.HOUR_OF_DAY, 0);
-			calendar.set(Calendar.MINUTE, 0);
-			calendar.set(Calendar.SECOND, 0);
-			inspectionReportDTO.setInspectionYearStartDate(calendar.getTime());
-			calendar.add(Calendar.YEAR, 1);
-			inspectionReportDTO.setInspectionYearEndDate(calendar.getTime());
-			inspectionReportDTO.setRainSeasonKind(1);
-			count = inspectionReportService.equipmentInspectionReportCount(inspectionReportDTO);
-			orgEquipmentInspectionStatisticsVO.setBeforeRainInspectionCount(count);
-			inspectionReportDTO.setRainSeasonKind(2);
-			count = inspectionReportService.equipmentInspectionReportCount(inspectionReportDTO);
-			orgEquipmentInspectionStatisticsVO.setFirstRainInspectionCount(count);
-			inspectionReportDTO.setRainSeasonKind(3);
-			count = inspectionReportService.equipmentInspectionReportCount(inspectionReportDTO);
-			orgEquipmentInspectionStatisticsVO.setSencodRainInspectionCount(count);
-			list.add(orgEquipmentInspectionStatisticsVO);
-
-		} else  if(BusinessConstant.ROLE_ORG_ADMIN.equals(user.getRoleName())){
-
-			LambdaQueryWrapper<DeptRegionEntity> orgdeptregionWrapper = Wrappers.<DeptRegionEntity>query().lambda();
-			orgdeptregionWrapper.eq(DeptRegionEntity::getDeptId,Func.toLong(user.getDeptId()));
-			DeptRegionEntity orgdeptregion = deptRegionService.getOne(orgdeptregionWrapper);
-
-			LambdaQueryWrapper<RegionInfoEntity> nodeQueryWrapper = Wrappers.<RegionInfoEntity>query().lambda();
-			nodeQueryWrapper.eq(RegionInfoEntity::getAdcd, orgdeptregion.getAdcd());
-			RegionInfoEntity orgregion = this.regionService.getOne(nodeQueryWrapper);
-
-			int excludecode=0;
-			if (orgregion.getParentCode().equals(BusinessConstant.REGION_NM_ADCODE)){
-				excludecode=1;
-			}
-
-			//盟市管理员,显示运维公司统计数据
-			LambdaQueryWrapper<Dept> wrapper = Wrappers.<Dept>query().lambda();
-			wrapper.eq(Dept::getIsDeleted, 0);
-			wrapper.eq(Dept::getParentId, Func.toLong(user.getDeptId()));
-			List<Dept> deptList = this.deptService.list(wrapper);
-			for (Dept dept : deptList) {
-				OrgEquipmentInspectionStatisticsVO orgEquipmentInspectionStatisticsVO = new OrgEquipmentInspectionStatisticsVO();
-				orgEquipmentInspectionStatisticsVO.setDeptId(dept.getId());
-				orgEquipmentInspectionStatisticsVO.setOrgName(dept.getDeptName());
-
-			//	LambdaQueryWrapper<DeptRegionEntity> deptLambdaQueryWrapper = Wrappers.<DeptRegionEntity>query().lambda();
-				//deptLambdaQueryWrapper.eq(DeptRegionEntity::getDeptId, dept.getId());
-			//	DeptRegionEntity deptRegionEntity = deptRegionService.getOne(deptLambdaQueryWrapper);
-				RtuInfoDTO rtuInfoDTO=new RtuInfoDTO();
-
-			//	RegionTreeNodeEntity node = this.regionService.getRegionNode(BusinessConstant.ROLE_COMPANY_ADMIN,Func.toStr(dept.getId()), deptRegionEntity.getAdcd());
-			//	if (null != node) {
-					rtuInfoDTO.setExcludeCode(excludecode);
-			//	}
-				rtuInfoDTO.setAdCode(orgregion.getAdcd());
-				Long count = rtuBaseInfoService.rtuCount(rtuInfoDTO);
-				orgEquipmentInspectionStatisticsVO.setRtuCount(count);
-				EquipmentInspectionInfoDTO inspectionInfoDTO = new EquipmentInspectionInfoDTO();
-				inspectionInfoDTO.setAdCode(orgregion.getAdcd());
-			//	if (null != node) {
-					inspectionInfoDTO.setExcludeCode(excludecode);
-			//	}
-				Calendar calendar = Calendar.getInstance();
-				calendar.setTime(new Date());
-				calendar.set(Calendar.MONTH, 0);
-				calendar.set(Calendar.DAY_OF_MONTH, 1);
-				calendar.set(Calendar.HOUR_OF_DAY, 0);
-				calendar.set(Calendar.MINUTE, 0);
-				calendar.set(Calendar.SECOND, 0);
-				inspectionInfoDTO.setInspectionYearStartDate(calendar.getTime());
-				calendar.add(Calendar.YEAR, 1);
-				inspectionInfoDTO.setInspectionYearEndDate(calendar.getTime());
-				count = equipmentInspectionService.inspectionCount(inspectionInfoDTO);
-				orgEquipmentInspectionStatisticsVO.setInspectionCount(count);
-				EquipmentInspectionReportDTO inspectionReportDTO = new EquipmentInspectionReportDTO();
-				inspectionReportDTO.setAdCode(orgregion.getAdcd());
-				//if (null != node) {
-					inspectionReportDTO.setExcludeCode(excludecode);
-			//	}
-				calendar.setTime(new Date());
-				calendar.set(Calendar.MONTH, 0);
-				calendar.set(Calendar.DAY_OF_MONTH, 1);
-				calendar.set(Calendar.HOUR_OF_DAY, 0);
-				calendar.set(Calendar.MINUTE, 0);
-				calendar.set(Calendar.SECOND, 0);
-				inspectionReportDTO.setInspectionYearStartDate(calendar.getTime());
-				calendar.add(Calendar.YEAR, 1);
-				inspectionReportDTO.setInspectionYearEndDate(calendar.getTime());
-				inspectionReportDTO.setRainSeasonKind(1);
-				count = inspectionReportService.equipmentInspectionReportCount(inspectionReportDTO);
-				orgEquipmentInspectionStatisticsVO.setBeforeRainInspectionCount(count);
-				inspectionReportDTO.setRainSeasonKind(2);
-				count = inspectionReportService.equipmentInspectionReportCount(inspectionReportDTO);
-				orgEquipmentInspectionStatisticsVO.setFirstRainInspectionCount(count);
-				inspectionReportDTO.setRainSeasonKind(3);
-				count = inspectionReportService.equipmentInspectionReportCount(inspectionReportDTO);
-				orgEquipmentInspectionStatisticsVO.setSencodRainInspectionCount(count);
-				list.add(orgEquipmentInspectionStatisticsVO);
-			}
-		}else{
-			//系统管理员,显示盟市部门统计数据
-			LambdaQueryWrapper<Dept> wrapper = Wrappers.<Dept>query().lambda();
-			wrapper.eq(Dept::getIsDeleted, 0);
-			wrapper.eq(Dept::getParentId, Func.toLong(user.getDeptId()));
-			List<Dept> deptList = this.deptService.list(wrapper);
-			for (Dept dept : deptList) {
-				OrgEquipmentInspectionStatisticsVO orgEquipmentInspectionStatisticsVO = new OrgEquipmentInspectionStatisticsVO();
-				orgEquipmentInspectionStatisticsVO.setDeptId(dept.getId());
-				orgEquipmentInspectionStatisticsVO.setOrgName(dept.getDeptName());
-
-				LambdaQueryWrapper<DeptRegionEntity> deptLambdaQueryWrapper = Wrappers.<DeptRegionEntity>query().lambda();
-				deptLambdaQueryWrapper.eq(DeptRegionEntity::getDeptId, dept.getId());
-				DeptRegionEntity deptRegionEntity = deptRegionService.getOne(deptLambdaQueryWrapper);
-
-				LambdaQueryWrapper<RegionInfoEntity> nodeQueryWrapper = Wrappers.<RegionInfoEntity>query().lambda();
-				nodeQueryWrapper.eq(RegionInfoEntity::getAdcd, deptRegionEntity.getAdcd());
-				RegionInfoEntity nodeRegion = this.regionService.getOne(nodeQueryWrapper);
-
-				int excludecode=0;
-				if (nodeRegion.getParentCode().equals(BusinessConstant.REGION_NM_ADCODE)){
-					excludecode=1;
-				}
-
-				RtuInfoDTO rtuInfoDTO=new RtuInfoDTO();
-
-				//RegionTreeNodeEntity node = this.regionService.getRegionNode(BusinessConstant.ROLE_ORG_ADMIN,Func.toStr(dept.getId()), deptRegionEntity.getAdcd());
-				//if (null != node) {
-					rtuInfoDTO.setExcludeCode(excludecode);
-				//}
-				rtuInfoDTO.setAdCode(nodeRegion.getAdcd());
-				Long count = rtuBaseInfoService.rtuCount(rtuInfoDTO);
-
-				orgEquipmentInspectionStatisticsVO.setRtuCount(count);
-				EquipmentInspectionInfoDTO inspectionInfoDTO = new EquipmentInspectionInfoDTO();
-				inspectionInfoDTO.setAdCode(nodeRegion.getAdcd());
-				//if (null != node) {
-					inspectionInfoDTO.setExcludeCode(excludecode);
-				//}
-				Calendar calendar = Calendar.getInstance();
-				calendar.setTime(new Date());
-				calendar.set(Calendar.MONTH, 0);
-				calendar.set(Calendar.DAY_OF_MONTH, 1);
-				calendar.set(Calendar.HOUR_OF_DAY, 0);
-				calendar.set(Calendar.MINUTE, 0);
-				calendar.set(Calendar.SECOND, 0);
-				inspectionInfoDTO.setInspectionYearStartDate(calendar.getTime());
-				calendar.add(Calendar.YEAR, 1);
-				inspectionInfoDTO.setInspectionYearEndDate(calendar.getTime());
-				count = equipmentInspectionService.inspectionCount(inspectionInfoDTO);
-				orgEquipmentInspectionStatisticsVO.setInspectionCount(count);
-				EquipmentInspectionReportDTO inspectionReportDTO = new EquipmentInspectionReportDTO();
-				inspectionReportDTO.setAdCode(deptRegionEntity.getAdcd());
-			//	if (null != node) {
-					inspectionReportDTO.setExcludeCode(excludecode);
-			//	}
-				calendar.setTime(new Date());
-				calendar.set(Calendar.MONTH, 0);
-				calendar.set(Calendar.DAY_OF_MONTH, 1);
-				calendar.set(Calendar.HOUR_OF_DAY, 0);
-				calendar.set(Calendar.MINUTE, 0);
-				calendar.set(Calendar.SECOND, 0);
-				inspectionReportDTO.setInspectionYearStartDate(calendar.getTime());
-				calendar.add(Calendar.YEAR, 1);
-				inspectionReportDTO.setInspectionYearEndDate(calendar.getTime());
-				inspectionReportDTO.setRainSeasonKind(1);
-				count = inspectionReportService.equipmentInspectionReportCount(inspectionReportDTO);
-				orgEquipmentInspectionStatisticsVO.setBeforeRainInspectionCount(count);
-				inspectionReportDTO.setRainSeasonKind(2);
-				count = inspectionReportService.equipmentInspectionReportCount(inspectionReportDTO);
-				orgEquipmentInspectionStatisticsVO.setFirstRainInspectionCount(count);
-				inspectionReportDTO.setRainSeasonKind(3);
-				count = inspectionReportService.equipmentInspectionReportCount(inspectionReportDTO);
-				orgEquipmentInspectionStatisticsVO.setSencodRainInspectionCount(count);
-				list.add(orgEquipmentInspectionStatisticsVO);
-			}
-		}
-
-		return R.data(list);
-	}
-
-	/**
-	 * 未完成巡检设备清单信息列表,分页
-	 */
-	@GetMapping("/unfinished/page")
-	@ApiImplicitParams({
-		@ApiImplicitParam(name = "rtuName", value = "测站名称", paramType = "query", dataType = "string"),
-		@ApiImplicitParam(name = "rtuCode", value = "测站编码", paramType = "query", dataType = "string"),
-		@ApiImplicitParam(name = "inspectionYear", value = "巡检年度", paramType = "query", dataType = "string"),
-		@ApiImplicitParam(name = "rainSeasonKind", value = "汛期类型", paramType = "query", dataType = "int"),
-	})
-	@ApiOperationSupport(order = 2)
-	@ApiOperation(value = "未完成巡检设备清单信息列表")
-	public R<IPage<EquipmentInspectionInfoVO>> unfinishedInspectionEquipmentPage(@ApiIgnore EquipmentInspectionInfoDTO inspectionInfoDTO, Query query) {
-		BladeUser user = AuthUtil.getUser();
-		if (BusinessConstant.ROLE_SYS_ADMIN.equals(user.getRoleName())) {
-			inspectionInfoDTO.setAdCode(BusinessConstant.REGION_NM_ADCODE);
-		} else if (BusinessConstant.ROLE_ORG_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_SERVICE_PERSON.equals(user.getRoleName())) {
-			LambdaQueryWrapper<DeptRegionEntity> deptRegionEntityLambdaQueryWrapper = Wrappers.<DeptRegionEntity>query().lambda();
-			deptRegionEntityLambdaQueryWrapper.eq(DeptRegionEntity::getIsDeleted, 0);
-			deptRegionEntityLambdaQueryWrapper.eq(DeptRegionEntity::getDeptId, Func.toLong(user.getDeptId()));
-			DeptRegionEntity deptRegionEntity = deptRegionService.getOne(deptRegionEntityLambdaQueryWrapper);
-			inspectionInfoDTO.setAdCode(deptRegionEntity.getAdcd());
-		}
-		if (inspectionInfoDTO.getAdCode() != null) {
-			RegionTreeNodeEntity node = this.regionService.getRegionNode(user.getRoleName(), user.getDeptId(), inspectionInfoDTO.getAdCode());
-			if (null != node) {
-				inspectionInfoDTO.setExcludeCode(node.getExclude());
-			}
-		}
-		Date now = new Date();
-		if (inspectionInfoDTO.getInspectionYear() != null) {
-			Date year = Func.parseDate(inspectionInfoDTO.getInspectionYear(), "yyyy-MM-dd");
-			Calendar calendar = Calendar.getInstance();
-			calendar.setTime(year);
-			calendar.set(Calendar.MONTH, 0);
-			calendar.set(Calendar.DAY_OF_MONTH, 1);
-			calendar.set(Calendar.HOUR_OF_DAY, 0);
-			calendar.set(Calendar.MINUTE, 0);
-			calendar.set(Calendar.SECOND, 0);
-			inspectionInfoDTO.setInspectionYearStartDate(calendar.getTime());
-			calendar.add(Calendar.YEAR, 1);
-			inspectionInfoDTO.setInspectionYearEndDate(calendar.getTime());
-		} else {
-			Calendar calendar = Calendar.getInstance();
-			calendar.setTime(new Date());
-			calendar.set(Calendar.MONTH, 0);
-			calendar.set(Calendar.DAY_OF_MONTH, 1);
-			calendar.set(Calendar.HOUR_OF_DAY, 0);
-			calendar.set(Calendar.MINUTE, 0);
-			calendar.set(Calendar.SECOND, 0);
-			inspectionInfoDTO.setInspectionYearStartDate(calendar.getTime());
-			calendar.add(Calendar.YEAR, 1);
-			inspectionInfoDTO.setInspectionYearEndDate(calendar.getTime());
-			if (inspectionInfoDTO.getRainSeasonKind() == null) {
-				//处理汛期类别
-				LambdaQueryWrapper<EquipmentInspectionPlanEntity> wrapper = Wrappers.<EquipmentInspectionPlanEntity>query().lambda();
-				wrapper.eq(EquipmentInspectionPlanEntity::getIsDeleted, 0);
-				wrapper.orderByDesc(EquipmentInspectionPlanEntity::getCreateTime);
-				List<EquipmentInspectionPlanEntity> list = planService.list(wrapper);
-				if (null != list && list.size() > 0) {
-					EquipmentInspectionPlanEntity entity = list.get(0);
-
-					Calendar dt = Calendar.getInstance();
-					Calendar calendarStart = Calendar.getInstance();
-					Calendar calendarEnd = Calendar.getInstance();
-					dt.setTime(now);
-					//汛前上报
-					calendarStart.setTime(entity.getBeforeRainSeasonStartTime());
-					calendarEnd.setTime(entity.getBeforeRainSeasonEndTime());
-					if ((dt.getTime().getTime() / 1000 == calendarStart.getTime().getTime() / 1000 || dt.after(calendarStart)) && dt.before(calendarEnd)) {
-						inspectionInfoDTO.setRainSeasonKind(1);
-					}
-					//汛中第一次上报
-					calendarStart.setTime(entity.getRainSeasonFirstStartTime());
-					calendarEnd.setTime(entity.getRainSeasonFirstEndTime());
-					if ((dt.getTime().getTime() / 1000 == calendarStart.getTime().getTime() / 1000 || dt.after(calendarStart)) && dt.before(calendarEnd)) {
-						inspectionInfoDTO.setRainSeasonKind(2);
-					}
-					//汛中第二次上报
-					calendarStart.setTime(entity.getRainSeasonSecondStartTime());
-					calendarEnd.setTime(entity.getRainSeasonSecondEndTime());
-					if ((dt.getTime().getTime() / 1000 == calendarStart.getTime().getTime() / 1000 || dt.after(calendarStart)) && dt.before(calendarEnd)) {
-						inspectionInfoDTO.setRainSeasonKind(3);
-					}
-				}
-				//没在当年任意一个汛期,直接返回
-				if (inspectionInfoDTO.getRainSeasonKind() == null) {
-					return R.data(null);
-				}
-			}
-		}
-		IPage<EquipmentInspectionInfoVO> pages = equipmentInspectionService.selectUnfinishedInspectionEquipmentPage(Condition.getPage(query), inspectionInfoDTO);
-		List<EquipmentInspectionInfoVO> volist = pages.getRecords();
-		for (EquipmentInspectionInfoVO vo : volist) {
-			EquipmentInspectionWrapper.build().entityVO(vo);
-		}
-		return R.data(pages);
-	}
-
-	/**
-	 * 未完成巡检设备清单信息导出
-	 *
-	 * @return
-	 */
-	@GetMapping("/unfinished/export")
-	@ApiOperationSupport(order = 3)
-	@ApiOperation(value = "未完成巡检设备清单导出", notes = "")
-	public R<Map<String, Object>> unfinishedInspectionEquipmentExport(@ApiIgnore EquipmentInspectionInfoDTO inspectionInfoDTO) {
-		BladeUser user = AuthUtil.getUser();
-		if (BusinessConstant.ROLE_SYS_ADMIN.equals(user.getRoleName())) {
-			inspectionInfoDTO.setAdCode(BusinessConstant.REGION_NM_ADCODE);
-		} else if (BusinessConstant.ROLE_ORG_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_SERVICE_PERSON.equals(user.getRoleName())) {
-			LambdaQueryWrapper<DeptRegionEntity> deptRegionEntityLambdaQueryWrapper = Wrappers.<DeptRegionEntity>query().lambda();
-			deptRegionEntityLambdaQueryWrapper.eq(DeptRegionEntity::getIsDeleted, 0);
-			deptRegionEntityLambdaQueryWrapper.eq(DeptRegionEntity::getDeptId, Func.toLong(user.getDeptId()));
-			DeptRegionEntity deptRegionEntity = deptRegionService.getOne(deptRegionEntityLambdaQueryWrapper);
-			inspectionInfoDTO.setAdCode(deptRegionEntity.getAdcd());
-		}
-		if (inspectionInfoDTO.getAdCode() != null) {
-			RegionTreeNodeEntity node = this.regionService.getRegionNode(user.getRoleName(), user.getDeptId(), inspectionInfoDTO.getAdCode());
-			if (null != node) {
-				inspectionInfoDTO.setExcludeCode(node.getExclude());
-			}
-		}
-		//文件标题
-		String title = "";
-		//当前时间
-		Date now = new Date();
-		if (inspectionInfoDTO.getInspectionYear() != null) {
-			Date year = Func.parseDate(inspectionInfoDTO.getInspectionYear(), "yyyy-MM-dd");
-			Calendar calendar = Calendar.getInstance();
-			calendar.setTime(year);
-			calendar.set(Calendar.MONTH, 0);
-			calendar.set(Calendar.DAY_OF_MONTH, 1);
-			calendar.set(Calendar.HOUR_OF_DAY, 0);
-			calendar.set(Calendar.MINUTE, 0);
-			calendar.set(Calendar.SECOND, 0);
-			inspectionInfoDTO.setInspectionYearStartDate(calendar.getTime());
-			calendar.add(Calendar.YEAR, 1);
-			inspectionInfoDTO.setInspectionYearEndDate(calendar.getTime());
-			title += Func.formatDate(year) + "年";
-
-		} else {
-			Calendar calendar = Calendar.getInstance();
-			calendar.setTime(now);
-			calendar.set(Calendar.MONTH, 0);
-			calendar.set(Calendar.DAY_OF_MONTH, 1);
-			calendar.set(Calendar.HOUR_OF_DAY, 0);
-			calendar.set(Calendar.MINUTE, 0);
-			calendar.set(Calendar.SECOND, 0);
-			inspectionInfoDTO.setInspectionYearStartDate(calendar.getTime());
-
-			calendar.add(Calendar.YEAR, 1);
-			inspectionInfoDTO.setInspectionYearEndDate(calendar.getTime());
-
-			title += Func.formatDate(now) + "年";
-
-			if (inspectionInfoDTO.getRainSeasonKind() == null) {
-				//处理汛期类别
-				LambdaQueryWrapper<EquipmentInspectionPlanEntity> wrapper = Wrappers.<EquipmentInspectionPlanEntity>query().lambda();
-				wrapper.eq(EquipmentInspectionPlanEntity::getIsDeleted, 0);
-				wrapper.orderByDesc(EquipmentInspectionPlanEntity::getCreateTime);
-				List<EquipmentInspectionPlanEntity> list = planService.list(wrapper);
-				if (null != list && list.size() > 0) {
-					EquipmentInspectionPlanEntity entity = list.get(0);
-
-					Calendar dt = Calendar.getInstance();
-					Calendar calendarStart = Calendar.getInstance();
-					Calendar calendarEnd = Calendar.getInstance();
-					dt.setTime(now);
-					//汛前上报
-					calendarStart.setTime(entity.getBeforeRainSeasonStartTime());
-					calendarEnd.setTime(entity.getBeforeRainSeasonEndTime());
-					if ((dt.getTime().getTime() / 1000 == calendarStart.getTime().getTime() / 1000 || dt.after(calendarStart)) && dt.before(calendarEnd)) {
-						inspectionInfoDTO.setRainSeasonKind(1);
-						title += "汛前";
-					}
-					//汛中第一次上报
-					calendarStart.setTime(entity.getRainSeasonFirstStartTime());
-					calendarEnd.setTime(entity.getRainSeasonFirstEndTime());
-					if ((dt.getTime().getTime() / 1000 == calendarStart.getTime().getTime() / 1000 || dt.after(calendarStart)) && dt.before(calendarEnd)) {
-						inspectionInfoDTO.setRainSeasonKind(2);
-						title += "汛中第一次";
-					}
-					//汛中第二次上报
-					calendarStart.setTime(entity.getRainSeasonSecondStartTime());
-					calendarEnd.setTime(entity.getRainSeasonSecondEndTime());
-					if ((dt.getTime().getTime() / 1000 == calendarStart.getTime().getTime() / 1000 || dt.after(calendarStart)) && dt.before(calendarEnd)) {
-						inspectionInfoDTO.setRainSeasonKind(3);
-						title += "汛中第二次";
-					}
-				}
-				//没在当年任意一个汛期,直接返回
-				if (inspectionInfoDTO.getRainSeasonKind() == null) {
-					List<UnfinishedInspectionEquipmentExportEntity> unfinishedInspectionEquipmentExportEntities = new LinkedList<>();
-					Map<String, Object> data = this.exportUnfinishedInspectionEquipmentExcel(title, unfinishedInspectionEquipmentExportEntities);
-					return R.data(data);
-				}
-			}
-		}
-		if (inspectionInfoDTO.getRainSeasonKind() != null) {
-			if (inspectionInfoDTO.getRainSeasonKind() == 1) {
-				title += "汛前";
-			} else if (inspectionInfoDTO.getRainSeasonKind() == 2) {
-				title += "汛中第一次";
-			} else if (inspectionInfoDTO.getRainSeasonKind() == 3) {
-				title += "汛中第二次";
-			}
-		}
-		List<EquipmentInspectionInfoVO> equipmentInspectionInfoVOList = equipmentInspectionService.selectUnfinishedInspectionEquipmentList(inspectionInfoDTO);
-		//生成数据
-		List<UnfinishedInspectionEquipmentExportEntity> unfinishedInspectionEquipmentExportEntities = new LinkedList<>();
-		if (null != equipmentInspectionInfoVOList && equipmentInspectionInfoVOList.size() > 0) {
-			int index = 1;
-			for (EquipmentInspectionInfoVO entity : equipmentInspectionInfoVOList) {
-				UnfinishedInspectionEquipmentExportEntity exportEntity = new UnfinishedInspectionEquipmentExportEntity();
-				exportEntity.setIndex(index);
-				if (entity.getAdCity() != null) {
-					exportEntity.setAdCity(entity.getAdCity());
-				} else {
-					exportEntity.setAdCity("");
-				}
-				if (entity.getAdDist() != null) {
-					exportEntity.setAdDist(entity.getAdDist());
-				} else {
-					exportEntity.setAdDist("");
-				}
-				if (entity.getRtuName() != null) {
-					exportEntity.setRtuName(entity.getRtuName());
-				} else {
-					exportEntity.setRtuName("");
-				}
-				exportEntity.setRtuCode(entity.getRtuCode());
-				String rtuKindDesc = "";
-				if (entity.getIsRain() != null && entity.getIsRain() == 1) {
-					rtuKindDesc += "雨量站";
-				}
-				if ((entity.getIsRiver() != null && entity.getIsRiver() == 1) || (entity.getIsRes() != null && entity.getIsRes() == 1)) {
-					if (rtuKindDesc.length() > 0) {
-						rtuKindDesc += "/";
-					}
-					rtuKindDesc += "水位站";
-				}
-				if (entity.getIsGround() != null && entity.getIsGround() == 1) {
-					if (rtuKindDesc.length() > 0) {
-						rtuKindDesc += "/";
-					}
-					rtuKindDesc += "墒情站";
-				}
-				if (entity.getIsVideo() != null && entity.getIsVideo() == 1) {
-					if (rtuKindDesc.length() > 0) {
-						rtuKindDesc += "/";
-					}
-					rtuKindDesc += "视频站";
-				}
-				exportEntity.setRtuKindDesc(rtuKindDesc);
-
-				if (entity.getLng() != null) {
-					exportEntity.setLng(entity.getLng());
-				} else {
-					exportEntity.setLng("");
-				}
-				if (entity.getLat() != null) {
-					exportEntity.setLat(entity.getLat());
-				} else {
-					exportEntity.setLat("");
-				}
-				if (entity.getLocationDesc() != null) {
-					exportEntity.setLocationDesc(entity.getLocationDesc());
-				} else {
-					exportEntity.setLocationDesc("");
-				}
-
-				if (entity.getBeforeRainSeasonStatus() != null) {
-					if (entity.getBeforeRainSeasonStatus() == 0) {
-						exportEntity.setBeforeRainSeasonStatus("");
-					} else if (entity.getBeforeRainSeasonStatus() == 1) {
-						exportEntity.setBeforeRainSeasonStatus("已填报");
-					} else {
-						exportEntity.setBeforeRainSeasonStatus("");
-					}
-				} else {
-					exportEntity.setBeforeRainSeasonStatus("");
-				}
-				if (entity.getRainSeasonFirstStatus() != null) {
-					if (entity.getRainSeasonFirstStatus() == 0) {
-						exportEntity.setRainSeasonFirstStatus("");
-					} else if (entity.getRainSeasonFirstStatus() == 1) {
-						exportEntity.setRainSeasonFirstStatus("已填报");
-					} else {
-						exportEntity.setRainSeasonFirstStatus("");
-					}
-				} else {
-					exportEntity.setRainSeasonFirstStatus("");
-				}
-				if (entity.getRainSeasonSecondStatus() != null) {
-					if (entity.getRainSeasonSecondStatus() == 0) {
-						exportEntity.setRainSeasonSecondStatus("");
-					} else if (entity.getRainSeasonSecondStatus() == 1) {
-						exportEntity.setRainSeasonSecondStatus("已填报");
-					} else {
-						exportEntity.setRainSeasonSecondStatus("");
-					}
-				} else {
-					exportEntity.setRainSeasonSecondStatus("");
-				}
-				unfinishedInspectionEquipmentExportEntities.add(exportEntity);
-				index += 1;
-			}
-		}
-		Map<String, Object> data = this.exportUnfinishedInspectionEquipmentExcel(title, unfinishedInspectionEquipmentExportEntities);
-		return R.data(data);
-	}
-
-	private Map<String, Object> exportUnfinishedInspectionEquipmentExcel(String title, List<UnfinishedInspectionEquipmentExportEntity> list) {
-		//当前时间
-		//Calendar dt = Calendar.getInstance();
-		//dt.setTime(new Date());
-		Map<String, Object> data = new HashMap<>();
-		data.put("status", 0);
-		String templateFilePath = this.workDir + File.separator + this.inspectionUnfinishedTemplate;
-		String outpath = this.workDir + File.separator + Func.formatDate(new Date());
-		File dir = new File(outpath);
-		if (!dir.exists()) {
-			if (!dir.mkdir()) {
-				data.put("error", "目录创建失败");
-				return data;
-			}
-		}
-		String outFileName = Func.randomUUID() + ".xlsx";
-		outpath += File.separator + outFileName;
-		ExcelWriter excelWriter = EasyExcel.write(outpath).withTemplate(templateFilePath).excelType(ExcelTypeEnum.XLSX).build();
-		WriteSheet writeSheet = EasyExcel.writerSheet("信息统计表").build();
-		excelWriter.write(list, writeSheet);
-		excelWriter.finish();
-		try {
-			FileInputStream fileInputStream = new FileInputStream(new File(outpath));
-			BladeFile bladeFile = ossBuilder.template().putFile(outFileName, fileInputStream);
-			String ossPath = bladeFile.getName();
-			//String p = bladeFile.getDomain();
-			data.put("name", ossPath);
-			data.put("url", ossPath);
-			data.put("filename", "未完成巡检设备(" + title + ")统计清单表");
-			data.put("status", 1);
-
-		} catch (FileNotFoundException e) {
-			e.printStackTrace();
-			data.put("error", "导出失败!");
-		}
-		return data;
-	}
+    private final IEquipmentInspectionService equipmentInspectionService;
+    private final IEquipmentInspectionPlanService planService;
+    private final IDeptService deptService;
+    private final IRtuBaseInfoService rtuBaseInfoService;
+    private final IDeptRegionService deptRegionService;
+    private final IEquipmentInspectionReportService inspectionReportService;
+    private final IUserService userService;
+    private final IRegionInfoService regionService;
+
+    @Resource
+    private OssBuilder ossBuilder;
+
+    @Value("${export-config.workdir}")
+    private String workDir;
+
+    @Value("${export-config.inspection-unfinished-template}")
+    private String inspectionUnfinishedTemplate;
+
+    /**
+     * 全部列表
+     */
+    @GetMapping("/list")
+    @ApiOperationSupport(order = 2)
+    @ApiOperation(value = "全部列表,不分页")
+    public R<List<EquipmentInspectionInfoVO>> list() {
+        List<EquipmentInspectionInfoEntity> pages = equipmentInspectionService.list();
+        return R.data(EquipmentInspectionWrapper.build().listVO(pages));
+    }
+
+
+    @GetMapping("/page")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "rtuCode", value = "测站编码", paramType = "query", dataType = "string"),
+            @ApiImplicitParam(name = "rtuName", value = "测站名称", paramType = "query", dataType = "string"),
+            @ApiImplicitParam(name = "adCode", value = "行政区划编码", paramType = "query", dataType = "string"),
+    })
+    @ApiOperationSupport(order = 3)
+    @ApiOperation(value = "分页", notes = "传入 EquipmentInspectionInfoDTO 实体类")
+    public R<IPage<EquipmentInspectionInfoVO>> page(@ApiIgnore EquipmentInspectionInfoDTO inspectionInfoDTO, Query query) {
+        BladeUser user = AuthUtil.getUser();
+        if (BusinessConstant.ROLE_SYS_ADMIN.equals(user.getRoleName())) {
+            if (Func.isNull(inspectionInfoDTO.getAdCode())) {
+                inspectionInfoDTO.setAdCode(BusinessConstant.REGION_NM_ADCODE);
+            }
+            RegionTreeNodeEntity node = this.regionService.getRegionNode(user.getRoleName(), user.getDeptId(), inspectionInfoDTO.getAdCode());
+            if (Func.notNull(node)) {
+                inspectionInfoDTO.setExcludeCode(node.getExclude());
+            }
+        } else if (BusinessConstant.ROLE_ORG_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_SERVICE_PERSON.equals(user.getRoleName())) {
+            if (Func.isNull(inspectionInfoDTO.getAdCode())) {
+                LambdaQueryWrapper<DeptRegionEntity> deptRegionEntityLambdaQueryWrapper = Wrappers.<DeptRegionEntity>query().lambda();
+                deptRegionEntityLambdaQueryWrapper.eq(DeptRegionEntity::getDeptId, Func.toLong(user.getDeptId()));
+                DeptRegionEntity deptRegionEntity = deptRegionService.getOne(deptRegionEntityLambdaQueryWrapper);
+                inspectionInfoDTO.setAdCode(deptRegionEntity.getAdcd());
+            }
+            RegionTreeNodeEntity node = this.regionService.getRegionNode(user.getRoleName(), user.getDeptId(), inspectionInfoDTO.getAdCode());
+            if (Func.notNull(node)) {
+                inspectionInfoDTO.setExcludeCode(node.getExclude());
+            }
+        } else if (BusinessConstant.ROLE_SYS_ADMIN.equals(user.getRoleName())) {
+            if (Func.isNull(inspectionInfoDTO.getAdCode())) {
+                LambdaQueryWrapper<DeptRegionEntity> deptRegionEntityLambdaQueryWrapper = Wrappers.<DeptRegionEntity>query().lambda();
+                deptRegionEntityLambdaQueryWrapper.eq(DeptRegionEntity::getDeptId, Func.toLong(user.getDeptId()));
+                DeptRegionEntity deptRegionEntity = deptRegionService.getOne(deptRegionEntityLambdaQueryWrapper);
+                inspectionInfoDTO.setAdCode(deptRegionEntity.getAdcd());
+            }
+        }
+        IPage<EquipmentInspectionInfoVO> pages = equipmentInspectionService.selectPage(Condition.getPage(query), inspectionInfoDTO);
+        return R.data(pages);
+    }
+
+
+    @GetMapping("/rain/page")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "rtuCode", value = "测站编码", paramType = "query", dataType = "string"),
+            @ApiImplicitParam(name = "rtuName", value = "测站名称", paramType = "query", dataType = "string"),
+            @ApiImplicitParam(name = "adCode", value = "行政区划编码", paramType = "query", dataType = "string"),
+            @ApiImplicitParam(name = "rainSeasonKind", value = "汛期类型", paramType = "query", dataType = "int"),
+            @ApiImplicitParam(name = "servicePersonId", value = "运维人员", paramType = "query", dataType = "long"),
+            @ApiImplicitParam(name = "deptId", value = "部门ID", paramType = "query", dataType = "long")
+    })
+    @ApiOperationSupport(order = 3)
+    @ApiOperation(value = "分页", notes = "传入 EquipmentInspectionInfoDTO 实体类")
+    public R<IPage<EquipmentInspectionInfoVO>> rainpage(@ApiIgnore EquipmentInspectionInfoDTO inspectionInfoDTO, Query query) {
+        BladeUser user = AuthUtil.getUser();
+        if (inspectionInfoDTO.getDeptId() != null) {
+            LambdaQueryWrapper<DeptRegionEntity> deptLambdaQueryWrapper = Wrappers.<DeptRegionEntity>query().lambda();
+            deptLambdaQueryWrapper.eq(DeptRegionEntity::getDeptId, inspectionInfoDTO.getDeptId());
+            DeptRegionEntity deptRegionEntity = deptRegionService.getOne(deptLambdaQueryWrapper);
+            inspectionInfoDTO.setAdCode(deptRegionEntity.getAdcd());
+        } else {
+            if (BusinessConstant.ROLE_SYS_ADMIN.equals(user.getRoleName())) {
+                if (Func.isNull(inspectionInfoDTO.getAdCode())) {
+                    inspectionInfoDTO.setAdCode(BusinessConstant.REGION_NM_ADCODE);
+                }
+                RegionTreeNodeEntity node = this.regionService.getRegionNode(user.getRoleName(), user.getDeptId(), inspectionInfoDTO.getAdCode());
+                if (Func.notNull(node)) {
+                    inspectionInfoDTO.setExcludeCode(node.getExclude());
+                }
+            } else if (BusinessConstant.ROLE_ORG_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_SERVICE_PERSON.equals(user.getRoleName())) {
+                if (Func.isNull(inspectionInfoDTO.getAdCode())) {
+                    LambdaQueryWrapper<DeptRegionEntity> deptRegionEntityLambdaQueryWrapper = Wrappers.<DeptRegionEntity>query().lambda();
+                    deptRegionEntityLambdaQueryWrapper.eq(DeptRegionEntity::getDeptId, Func.toLong(user.getDeptId()));
+                    DeptRegionEntity deptRegionEntity = deptRegionService.getOne(deptRegionEntityLambdaQueryWrapper);
+                    inspectionInfoDTO.setAdCode(deptRegionEntity.getAdcd());
+                }
+                RegionTreeNodeEntity node = this.regionService.getRegionNode(user.getRoleName(), user.getDeptId(), inspectionInfoDTO.getAdCode());
+                if (Func.notNull(node)) {
+                    inspectionInfoDTO.setExcludeCode(node.getExclude());
+                }
+            } else if (BusinessConstant.ROLE_QI_ADMIN.equals(user.getRoleName())) {
+                if (Func.isNull(inspectionInfoDTO.getAdCode())) {
+                    LambdaQueryWrapper<DeptRegionEntity> deptRegionEntityLambdaQueryWrapper = Wrappers.<DeptRegionEntity>query().lambda();
+                    deptRegionEntityLambdaQueryWrapper.eq(DeptRegionEntity::getDeptId, Func.toLong(user.getDeptId()));
+                    DeptRegionEntity deptRegionEntity = deptRegionService.getOne(deptRegionEntityLambdaQueryWrapper);
+                    inspectionInfoDTO.setAdCode(deptRegionEntity.getAdcd());
+                }
+            }
+        }
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTime(new Date());
+        calendar.set(Calendar.MONTH, 0);
+        calendar.set(Calendar.DAY_OF_MONTH, 1);
+        calendar.set(Calendar.HOUR_OF_DAY, 0);
+        calendar.set(Calendar.MINUTE, 0);
+        calendar.set(Calendar.SECOND, 0);
+        inspectionInfoDTO.setInspectionYearStartDate(calendar.getTime());
+        calendar.add(Calendar.YEAR, 1);
+        inspectionInfoDTO.setInspectionYearEndDate(calendar.getTime());
+        if (inspectionInfoDTO.getRainSeasonKind() != null) {
+            if (inspectionInfoDTO.getRainSeasonKind() == 1) {
+                inspectionInfoDTO.setBeforeRainSeasonStatus(1);
+                inspectionInfoDTO.setBeforeRainSeasonReportUser(inspectionInfoDTO.getServicePersonId());
+            } else if (inspectionInfoDTO.getRainSeasonKind() == 2) {
+                inspectionInfoDTO.setRainSeasonFirstStatus(1);
+                inspectionInfoDTO.setRainSeasonFirstReportUser(inspectionInfoDTO.getServicePersonId());
+            } else if (inspectionInfoDTO.getRainSeasonKind() == 3) {
+                inspectionInfoDTO.setRainSeasonSecondStatus(1);
+                inspectionInfoDTO.setRainSeasonSecondReportUser(inspectionInfoDTO.getServicePersonId());
+            }
+        }
+        IPage<EquipmentInspectionInfoVO> pages = equipmentInspectionService.selectPage(Condition.getPage(query), inspectionInfoDTO);
+        return R.data(pages);
+    }
+
+    /**
+     * 当前汛期待巡检的设备,只返回未巡检过的设备
+     *
+     * @param inspectionInfoDTO
+     * @param query
+     * @return
+     */
+    @GetMapping("/rtu/page")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "rtuCode", value = "测站编码", paramType = "query", dataType = "string"),
+            @ApiImplicitParam(name = "rtuName", value = "测站名称", paramType = "query", dataType = "string"),
+            @ApiImplicitParam(name = "adCode", value = "行政区划编码", paramType = "query", dataType = "string"),
+    })
+    @ApiOperationSupport(order = 3)
+    @ApiOperation(value = "当前汛期待巡检设备", notes = "传入 EquipmentInspectionInfoDTO 实体类")
+    public R<IPage<EquipmentInspectionInfoVO>> rtuPage(@ApiIgnore EquipmentInspectionInfoDTO inspectionInfoDTO, Query query) {
+        BladeUser user = AuthUtil.getUser();
+        if (BusinessConstant.ROLE_SYS_ADMIN.equals(user.getRoleName())) {
+            if (Func.isNull(inspectionInfoDTO.getAdCode())) {
+                inspectionInfoDTO.setAdCode(BusinessConstant.REGION_NM_ADCODE);
+            }
+            RegionTreeNodeEntity node = this.regionService.getRegionNode(user.getRoleName(), user.getDeptId(), inspectionInfoDTO.getAdCode());
+            if (Func.notNull(node)) {
+                inspectionInfoDTO.setExcludeCode(node.getExclude());
+            }
+        } else if (BusinessConstant.ROLE_ORG_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_SERVICE_PERSON.equals(user.getRoleName())) {
+            if (Func.isNull(inspectionInfoDTO.getAdCode())) {
+                LambdaQueryWrapper<DeptRegionEntity> deptRegionEntityLambdaQueryWrapper = Wrappers.<DeptRegionEntity>query().lambda();
+                deptRegionEntityLambdaQueryWrapper.eq(DeptRegionEntity::getDeptId, Func.toLong(user.getDeptId()));
+                DeptRegionEntity deptRegionEntity = deptRegionService.getOne(deptRegionEntityLambdaQueryWrapper);
+                inspectionInfoDTO.setAdCode(deptRegionEntity.getAdcd());
+            }
+            RegionTreeNodeEntity node = this.regionService.getRegionNode(user.getRoleName(), user.getDeptId(), inspectionInfoDTO.getAdCode());
+            if (Func.notNull(node)) {
+                inspectionInfoDTO.setExcludeCode(node.getExclude());
+            }
+        } else if (BusinessConstant.ROLE_QI_ADMIN.equals(user.getRoleName())) {
+            if (Func.isNull(inspectionInfoDTO.getAdCode())) {
+                LambdaQueryWrapper<DeptRegionEntity> deptRegionEntityLambdaQueryWrapper = Wrappers.<DeptRegionEntity>query().lambda();
+                deptRegionEntityLambdaQueryWrapper.eq(DeptRegionEntity::getDeptId, Func.toLong(user.getDeptId()));
+                DeptRegionEntity deptRegionEntity = deptRegionService.getOne(deptRegionEntityLambdaQueryWrapper);
+                inspectionInfoDTO.setAdCode(deptRegionEntity.getAdcd());
+            }
+        }
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTime(new Date());
+        calendar.set(Calendar.MONTH, 0);
+        calendar.set(Calendar.DAY_OF_MONTH, 1);
+        calendar.set(Calendar.HOUR_OF_DAY, 0);
+        calendar.set(Calendar.MINUTE, 0);
+        calendar.set(Calendar.SECOND, 0);
+        inspectionInfoDTO.setInspectionYearStartDate(calendar.getTime());
+        calendar.add(Calendar.YEAR, 1);
+        inspectionInfoDTO.setInspectionYearEndDate(calendar.getTime());
+        EquipmentInspectionPlanEntity planEntity = planService.getPlanInfo();
+        calendar.setTime(new Date());
+        Date dt = calendar.getTime();
+        if ((dt.getTime() / 1000 == planEntity.getBeforeRainSeasonEndTime().getTime() / 1000 || dt.after(planEntity.getBeforeRainSeasonStartTime())) && dt.before(planEntity.getBeforeRainSeasonEndTime())) {
+            inspectionInfoDTO.setBeforeRainSeasonStatus(1);
+        } else if ((dt.getTime() / 1000 == planEntity.getBeforeRainSeasonEndTime().getTime() / 1000 || dt.after(planEntity.getRainSeasonFirstStartTime())) && dt.before(planEntity.getRainSeasonFirstEndTime())) {
+            inspectionInfoDTO.setRainSeasonFirstStatus(1);
+        } else if ((dt.getTime() / 1000 == planEntity.getBeforeRainSeasonEndTime().getTime() / 1000 || dt.after(planEntity.getRainSeasonSecondStartTime())) && dt.before(planEntity.getRainSeasonSecondEndTime())) {
+            inspectionInfoDTO.setRainSeasonSecondStatus(1);
+        }
+        IPage<EquipmentInspectionInfoVO> pages = equipmentInspectionService.selectRtuPage(Condition.getPage(query), inspectionInfoDTO);
+        List<EquipmentInspectionInfoVO> list = pages.getRecords();
+        for (EquipmentInspectionInfoVO vo : list) {
+            EquipmentInspectionWrapper.build().entityVO(vo);
+        }
+        return R.data(pages);
+    }
+
+    /**
+     * 统计本年度巡检设备数量、各汛期巡检设备数量
+     *
+     * @param inspectionInfoDTO
+     * @return
+     */
+    @GetMapping("/count")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "adCode", value = "行政区划编码", paramType = "query", dataType = "string"),
+    })
+    @ApiOperationSupport(order = 2)
+    @ApiOperation(value = "已巡检上报设备数量")
+    public R<Map<String, Object>> inspectionReportCount(@ApiIgnore EquipmentInspectionInfoDTO inspectionInfoDTO) {
+        BladeUser user = AuthUtil.getUser();
+        int excludeCode = 0;
+        if (BusinessConstant.ROLE_SYS_ADMIN.equals(user.getRoleName())) {
+            if (Func.isNull(inspectionInfoDTO.getAdCode())) {
+                inspectionInfoDTO.setAdCode(BusinessConstant.REGION_NM_ADCODE);
+            }
+            RegionTreeNodeEntity node = this.regionService.getRegionNode(user.getRoleName(), user.getDeptId(), inspectionInfoDTO.getAdCode());
+            if (Func.notNull(node)) {
+                excludeCode = node.getExclude();
+            }
+        } else if (BusinessConstant.ROLE_ORG_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_SERVICE_PERSON.equals(user.getRoleName())) {
+            if (Func.isNull(inspectionInfoDTO.getAdCode())) {
+                LambdaQueryWrapper<DeptRegionEntity> deptRegionEntityLambdaQueryWrapper = Wrappers.<DeptRegionEntity>query().lambda();
+                deptRegionEntityLambdaQueryWrapper.eq(DeptRegionEntity::getDeptId, Func.toLong(user.getDeptId()));
+                DeptRegionEntity deptRegionEntity = deptRegionService.getOne(deptRegionEntityLambdaQueryWrapper);
+                inspectionInfoDTO.setAdCode(deptRegionEntity.getAdcd());
+            }
+            RegionTreeNodeEntity node = this.regionService.getRegionNode(user.getRoleName(), user.getDeptId(), inspectionInfoDTO.getAdCode());
+            if (Func.notNull(node)) {
+                excludeCode = node.getExclude();
+            }
+        } else if (BusinessConstant.ROLE_QI_ADMIN.equals(user.getRoleName())) {
+            if (Func.isNull(inspectionInfoDTO.getAdCode())) {
+                LambdaQueryWrapper<DeptRegionEntity> deptRegionEntityLambdaQueryWrapper = Wrappers.<DeptRegionEntity>query().lambda();
+                deptRegionEntityLambdaQueryWrapper.eq(DeptRegionEntity::getDeptId, Func.toLong(user.getDeptId()));
+                DeptRegionEntity deptRegionEntity = deptRegionService.getOne(deptRegionEntityLambdaQueryWrapper);
+                inspectionInfoDTO.setAdCode(deptRegionEntity.getAdcd());
+            }
+        }
+        inspectionInfoDTO.setExcludeCode(excludeCode);
+        Map<String, Object> data = new HashMap<>();
+        RtuInfoDTO rtuInfoDTO = new RtuInfoDTO();
+        rtuInfoDTO.setExcludeCode(excludeCode);
+        rtuInfoDTO.setAdCode(inspectionInfoDTO.getAdCode());
+        long count = rtuBaseInfoService.rtuCount(rtuInfoDTO);
+        data.put("rtus", count);
+        long rtus = count;
+        int rainKind = 0;
+        long remaininspectionrtus = 0;
+        EquipmentInspectionPlanEntity planEntity = planService.getPlanInfo();
+        Date dt = new Date();
+        if (dt.after(planEntity.getBeforeRainSeasonStartTime()) && dt.before(planEntity.getBeforeRainSeasonEndTime())) {
+            rainKind = 1;
+        } else if (dt.after(planEntity.getRainSeasonFirstStartTime()) && dt.before(planEntity.getRainSeasonFirstEndTime())) {
+            rainKind = 2;
+        } else if (dt.after(planEntity.getRainSeasonSecondStartTime()) && dt.before(planEntity.getRainSeasonSecondEndTime())) {
+            rainKind = 3;
+        }
+        data.put("rainKind", rainKind);
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTime(new Date());
+        calendar.set(Calendar.MONTH, 0);
+        calendar.set(Calendar.DAY_OF_MONTH, 1);
+        calendar.set(Calendar.HOUR_OF_DAY, 0);
+        calendar.set(Calendar.MINUTE, 0);
+        calendar.set(Calendar.SECOND, 0);
+        inspectionInfoDTO.setInspectionYearStartDate(calendar.getTime());
+        calendar.add(Calendar.YEAR, 1);
+        inspectionInfoDTO.setInspectionYearEndDate(calendar.getTime());
+
+        count = equipmentInspectionService.inspectionCount(inspectionInfoDTO);
+        data.put("inspectionCount", count);
+        EquipmentInspectionReportDTO inspectionReportDTO = new EquipmentInspectionReportDTO();
+        calendar.setTime(new Date());
+        calendar.set(Calendar.MONTH, 0);
+        calendar.set(Calendar.DAY_OF_MONTH, 1);
+        calendar.set(Calendar.HOUR_OF_DAY, 0);
+        calendar.set(Calendar.MINUTE, 0);
+        calendar.set(Calendar.SECOND, 0);
+        inspectionReportDTO.setInspectionYearStartDate(calendar.getTime());
+        calendar.add(Calendar.YEAR, 1);
+        inspectionReportDTO.setInspectionYearEndDate(calendar.getTime());
+        inspectionReportDTO.setRainSeasonKind(1);
+        inspectionReportDTO.setExcludeCode(excludeCode);
+        inspectionReportDTO.setAdCode(inspectionInfoDTO.getAdCode());
+        count = inspectionReportService.equipmentInspectionReportCount(inspectionReportDTO);
+        data.put("beforeRainInspectionCount", count);
+        if (rainKind == 1) {
+            remaininspectionrtus = rtus - count;
+        }
+        inspectionReportDTO.setRainSeasonKind(2);
+        count = inspectionReportService.equipmentInspectionReportCount(inspectionReportDTO);
+        data.put("firstRainInspectionCount", count);
+        if (rainKind == 2) {
+            remaininspectionrtus = rtus - count;
+        }
+        inspectionReportDTO.setRainSeasonKind(3);
+        count = inspectionReportService.equipmentInspectionReportCount(inspectionReportDTO);
+        data.put("sencodRainInspectionCount", count);
+        if (rainKind == 3) {
+            remaininspectionrtus = rtus - count;
+        }
+        data.put("remaininspectionrtus", remaininspectionrtus);
+        return R.data(data);
+    }
+
+    /**
+     * 填报状态
+     */
+    @GetMapping("/reportStatus")
+    @ApiOperationSupport(order = 1)
+    @ApiOperation(value = "详情", notes = "传入实体类EquipmentInspectionInfoEntity")
+    public R<EquipmentInspectionInfoVO> getReportStatus(EquipmentInspectionInfoEntity equipmentInspectionInfoEntity) {
+        if (null == equipmentInspectionInfoEntity.getId()) {
+            return R.fail("参数错误");
+        }
+        EquipmentInspectionInfoEntity detail = equipmentInspectionService.getById(equipmentInspectionInfoEntity.getId());
+        return R.data(EquipmentInspectionWrapper.build().entityVO(detail));
+    }
+
+    /**
+     * 填报状态
+     */
+    @GetMapping("/rtu/reportStatus")
+    @ApiOperationSupport(order = 1)
+    @ApiOperation(value = "详情", notes = "传入实体类EquipmentInspectionInfoEntity")
+    public R<EquipmentInspectionInfoVO> getRtuReportStatus(EquipmentInspectionInfoEntity equipmentInspectionInfoEntity) {
+        if (null == equipmentInspectionInfoEntity.getRtuCode()) {
+            return R.fail("参数错误");
+        }
+        LambdaQueryWrapper<EquipmentInspectionInfoEntity> wrapper = Wrappers.<EquipmentInspectionInfoEntity>query().lambda();
+        wrapper.eq(EquipmentInspectionInfoEntity::getIsDeleted, 0);
+        wrapper.eq(EquipmentInspectionInfoEntity::getRtuCode, equipmentInspectionInfoEntity.getRtuCode());
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTime(new Date());
+        calendar.set(Calendar.MONTH, 0);
+        calendar.set(Calendar.DAY_OF_MONTH, 1);
+        calendar.set(Calendar.HOUR_OF_DAY, 0);
+        calendar.set(Calendar.MINUTE, 0);
+        calendar.set(Calendar.SECOND, 0);
+        calendar.set(Calendar.MILLISECOND, 0);
+        wrapper.ge(EquipmentInspectionInfoEntity::getInspectionDate, calendar.getTime());
+        calendar.add(Calendar.YEAR, 1);
+        wrapper.lt(EquipmentInspectionInfoEntity::getInspectionDate, calendar.getTime());
+        EquipmentInspectionInfoEntity detail = equipmentInspectionService.getOne(wrapper);
+        if (null == detail) {
+            detail = new EquipmentInspectionInfoEntity();
+            detail.setBeforeRainSeasonStatus(0);
+            detail.setRainSeasonFirstStatus(0);
+            detail.setRainSeasonSecondStatus(0);
+        }
+        return R.data(EquipmentInspectionWrapper.build().entityVO(detail));
+    }
+
+    /**
+     * 详情
+     */
+    @GetMapping("/detail")
+    @ApiOperationSupport(order = 1)
+    @ApiOperation(value = "详情", notes = "传入实体类EquipmentInspectionInfoEntity")
+    public R<EquipmentInspectionInfoVO> detail(EquipmentInspectionInfoEntity equipmentInspectionInfoEntity) {
+        if (null == equipmentInspectionInfoEntity.getId()) {
+            return R.fail("参数错误");
+        }
+        EquipmentInspectionInfoEntity detail = equipmentInspectionService.getOne(Condition.getQueryWrapper(equipmentInspectionInfoEntity));
+        return R.data(EquipmentInspectionWrapper.build().entityVO(detail));
+    }
+
+    /**
+     * 新增
+     */
+    @PostMapping("/save")
+    @ApiOperationSupport(order = 4)
+    @ApiOperation(value = "新增", notes = "传入orderProcessInfoEntity")
+    public R save(@RequestBody EquipmentInspectionInfoEntity equipmentInspectionInfoEntity) {
+        return R.status(equipmentInspectionService.save(equipmentInspectionInfoEntity));
+    }
+
+    /**
+     * 修改
+     */
+    @PostMapping("/update")
+    @ApiOperationSupport(order = 5)
+    @ApiOperation(value = "修改", notes = "传入orderProcessInfoEntity")
+    public R update(@RequestBody EquipmentInspectionInfoEntity equipmentInspectionInfoEntity) {
+        return R.status(equipmentInspectionService.updateById(equipmentInspectionInfoEntity));
+    }
+
+    /**
+     * 新增或修改
+     */
+    @PostMapping("/submit")
+    @ApiOperationSupport(order = 6)
+    @ApiOperation(value = "新增或修改", notes = "传入orderProcessInfoEntity")
+    public R submit(@RequestBody EquipmentInspectionInfoEntity equipmentInspectionInfoEntity) {
+        return R.status(equipmentInspectionService.saveOrUpdate(equipmentInspectionInfoEntity));
+    }
+
+    /**
+     * 删除
+     */
+    @PostMapping("/remove")
+    @ApiOperationSupport(order = 7)
+    @ApiOperation(value = "逻辑删除", notes = "传入projectInfoEntity")
+    public R remove(@ApiParam(value = "主键集合") @RequestParam String ids) {
+        boolean temp = equipmentInspectionService.deleteLogic(Func.toLongList(ids));
+        return R.status(temp);
+    }
+
+    /**
+     * 巡检统计
+     *
+     * @return
+     */
+    @GetMapping("/person/statistics")
+    @ApiOperationSupport(order = 3)
+    @ApiOperation(value = "统计表格")
+    public R<List<EquipmentInspectionStatisticsVO>> inspectionStatistics() {
+        BladeUser user = AuthUtil.getUser();
+        LambdaQueryWrapper<User> userQueryWrapper = Wrappers.<User>query().lambda();
+        userQueryWrapper.eq(User::getIsDeleted, 0);
+        userQueryWrapper.eq(User::getDeptId, Func.toLong(user.getDeptId()));
+        List<User> list = userService.list(userQueryWrapper);
+        List<EquipmentInspectionStatisticsVO> countList = new LinkedList<>();
+        for (User u : list) {
+            EquipmentInspectionStatisticsVO vo = new EquipmentInspectionStatisticsVO();
+            vo.setUserId(u.getId());
+            vo.setServicePersonName(u.getRealName());
+            EquipmentInspectionInfoDTO inspectionInfoDTO = new EquipmentInspectionInfoDTO();
+            Calendar calendar = Calendar.getInstance();
+            calendar.setTime(new Date());
+            calendar.setTime(new Date());
+            calendar.set(Calendar.MONTH, 0);
+            calendar.set(Calendar.DAY_OF_MONTH, 1);
+            calendar.set(Calendar.HOUR_OF_DAY, 0);
+            calendar.set(Calendar.MINUTE, 0);
+            calendar.set(Calendar.SECOND, 0);
+            inspectionInfoDTO.setInspectionYearStartDate(calendar.getTime());
+            calendar.add(Calendar.YEAR, 1);
+            inspectionInfoDTO.setInspectionYearEndDate(calendar.getTime());
+            inspectionInfoDTO.setBeforeRainSeasonReportUser(u.getId());
+            long count = equipmentInspectionService.inspectionCount(inspectionInfoDTO);
+            vo.setBeforeRainInspectionCount(count);
+            inspectionInfoDTO.setBeforeRainSeasonReportUser(null);
+            inspectionInfoDTO.setRainSeasonFirstReportUser(u.getId());
+            count = equipmentInspectionService.inspectionCount(inspectionInfoDTO);
+            vo.setFirstRainInspectionCount(count);
+            inspectionInfoDTO.setRainSeasonFirstReportUser(null);
+            inspectionInfoDTO.setRainSeasonSecondReportUser(u.getId());
+            count = equipmentInspectionService.inspectionCount(inspectionInfoDTO);
+            vo.setSencodRainInspectionCount(count);
+            countList.add(vo);
+        }
+        return R.data(countList);
+    }
+
+    /**
+     * 巡检统计
+     *
+     * @return
+     */
+    @GetMapping("/org/statistics")
+    @ApiOperationSupport(order = 3)
+    @ApiOperation(value = "统计表格")
+    public R<List<OrgEquipmentInspectionStatisticsVO>> orgInspectionStatistics() {
+        BladeUser user = AuthUtil.getUser();
+        List<OrgEquipmentInspectionStatisticsVO> list = new LinkedList<>();
+        if (BusinessConstant.ROLE_COMPANY_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_SERVICE_PERSON.equals(user.getRoleName())) {
+            //运维公司和运维人员,只显示本部门统计数据
+            Dept dept = deptService.getById(Func.toLong(user.getDeptId()));
+
+            OrgEquipmentInspectionStatisticsVO orgEquipmentInspectionStatisticsVO = new OrgEquipmentInspectionStatisticsVO();
+            orgEquipmentInspectionStatisticsVO.setDeptId(dept.getId());
+            orgEquipmentInspectionStatisticsVO.setOrgName(dept.getDeptName());
+
+            LambdaQueryWrapper<DeptRegionEntity> deptLambdaQueryWrapper = Wrappers.<DeptRegionEntity>query().lambda();
+            deptLambdaQueryWrapper.eq(DeptRegionEntity::getDeptId, dept.getParentId());
+            DeptRegionEntity deptRegionEntity = deptRegionService.getOne(deptLambdaQueryWrapper);
+
+
+            LambdaQueryWrapper<RegionInfoEntity> nodeQueryWrapper = Wrappers.<RegionInfoEntity>query().lambda();
+            nodeQueryWrapper.eq(RegionInfoEntity::getAdcd, deptRegionEntity.getAdcd());
+            RegionInfoEntity nodeRegion = this.regionService.getOne(nodeQueryWrapper);
+
+            int excludecode = 0;
+            if (nodeRegion.getParentCode().equals(BusinessConstant.REGION_NM_ADCODE)) {
+                excludecode = 1;
+            }
+
+            RtuInfoDTO rtuInfoDTO = new RtuInfoDTO();
+            //	RegionTreeNodeEntity node = this.regionService.getRegionNode(user.getRoleName(),user.getDeptId(), deptRegionEntity.getAdcd());
+            //	if (null != node) {
+            rtuInfoDTO.setExcludeCode(excludecode);
+            //	}
+            rtuInfoDTO.setAdCode(deptRegionEntity.getAdcd());
+
+            Long count = rtuBaseInfoService.rtuCount(rtuInfoDTO);
+            orgEquipmentInspectionStatisticsVO.setRtuCount(count);
+            EquipmentInspectionInfoDTO inspectionInfoDTO = new EquipmentInspectionInfoDTO();
+            inspectionInfoDTO.setAdCode(deptRegionEntity.getAdcd());
+
+            //if (null != node) {
+            inspectionInfoDTO.setExcludeCode(excludecode);
+            //}
+            Calendar calendar = Calendar.getInstance();
+            calendar.setTime(new Date());
+            calendar.set(Calendar.MONTH, 0);
+            calendar.set(Calendar.DAY_OF_MONTH, 1);
+            calendar.set(Calendar.HOUR_OF_DAY, 0);
+            calendar.set(Calendar.MINUTE, 0);
+            calendar.set(Calendar.SECOND, 0);
+            inspectionInfoDTO.setInspectionYearStartDate(calendar.getTime());
+            calendar.add(Calendar.YEAR, 1);
+            inspectionInfoDTO.setInspectionYearEndDate(calendar.getTime());
+            count = equipmentInspectionService.inspectionCount(inspectionInfoDTO);
+            orgEquipmentInspectionStatisticsVO.setInspectionCount(count);
+            EquipmentInspectionReportDTO inspectionReportDTO = new EquipmentInspectionReportDTO();
+            inspectionReportDTO.setAdCode(deptRegionEntity.getAdcd());
+            //if (null != node) {
+            inspectionReportDTO.setExcludeCode(excludecode);
+            //}
+            calendar.setTime(new Date());
+            calendar.set(Calendar.MONTH, 0);
+            calendar.set(Calendar.DAY_OF_MONTH, 1);
+            calendar.set(Calendar.HOUR_OF_DAY, 0);
+            calendar.set(Calendar.MINUTE, 0);
+            calendar.set(Calendar.SECOND, 0);
+            inspectionReportDTO.setInspectionYearStartDate(calendar.getTime());
+            calendar.add(Calendar.YEAR, 1);
+            inspectionReportDTO.setInspectionYearEndDate(calendar.getTime());
+            inspectionReportDTO.setRainSeasonKind(1);
+            count = inspectionReportService.equipmentInspectionReportCount(inspectionReportDTO);
+            orgEquipmentInspectionStatisticsVO.setBeforeRainInspectionCount(count);
+            inspectionReportDTO.setRainSeasonKind(2);
+            count = inspectionReportService.equipmentInspectionReportCount(inspectionReportDTO);
+            orgEquipmentInspectionStatisticsVO.setFirstRainInspectionCount(count);
+            inspectionReportDTO.setRainSeasonKind(3);
+            count = inspectionReportService.equipmentInspectionReportCount(inspectionReportDTO);
+            orgEquipmentInspectionStatisticsVO.setSencodRainInspectionCount(count);
+            list.add(orgEquipmentInspectionStatisticsVO);
+
+        } else if (BusinessConstant.ROLE_ORG_ADMIN.equals(user.getRoleName())) {
+
+            LambdaQueryWrapper<DeptRegionEntity> orgdeptregionWrapper = Wrappers.<DeptRegionEntity>query().lambda();
+            orgdeptregionWrapper.eq(DeptRegionEntity::getDeptId, Func.toLong(user.getDeptId()));
+            DeptRegionEntity orgdeptregion = deptRegionService.getOne(orgdeptregionWrapper);
+
+            LambdaQueryWrapper<RegionInfoEntity> nodeQueryWrapper = Wrappers.<RegionInfoEntity>query().lambda();
+            nodeQueryWrapper.eq(RegionInfoEntity::getAdcd, orgdeptregion.getAdcd());
+            RegionInfoEntity orgregion = this.regionService.getOne(nodeQueryWrapper);
+
+            int excludecode = 0;
+            if (orgregion.getParentCode().equals(BusinessConstant.REGION_NM_ADCODE)) {
+                excludecode = 1;
+            }
+
+            //盟市管理员,显示运维公司统计数据
+            LambdaQueryWrapper<Dept> wrapper = Wrappers.<Dept>query().lambda();
+            wrapper.eq(Dept::getIsDeleted, 0);
+            wrapper.eq(Dept::getParentId, Func.toLong(user.getDeptId()));
+            wrapper.ne(Dept::getDeptCategory,3);
+            List<Dept> deptList = this.deptService.list(wrapper);
+            for (Dept dept : deptList) {
+                OrgEquipmentInspectionStatisticsVO orgEquipmentInspectionStatisticsVO = new OrgEquipmentInspectionStatisticsVO();
+                orgEquipmentInspectionStatisticsVO.setDeptId(dept.getId());
+                orgEquipmentInspectionStatisticsVO.setOrgName(dept.getDeptName());
+
+                //	LambdaQueryWrapper<DeptRegionEntity> deptLambdaQueryWrapper = Wrappers.<DeptRegionEntity>query().lambda();
+                //deptLambdaQueryWrapper.eq(DeptRegionEntity::getDeptId, dept.getId());
+                //	DeptRegionEntity deptRegionEntity = deptRegionService.getOne(deptLambdaQueryWrapper);
+                RtuInfoDTO rtuInfoDTO = new RtuInfoDTO();
+
+                //	RegionTreeNodeEntity node = this.regionService.getRegionNode(BusinessConstant.ROLE_COMPANY_ADMIN,Func.toStr(dept.getId()), deptRegionEntity.getAdcd());
+                //	if (null != node) {
+                rtuInfoDTO.setExcludeCode(excludecode);
+                //	}
+                rtuInfoDTO.setAdCode(orgregion.getAdcd());
+                Long count = rtuBaseInfoService.rtuCount(rtuInfoDTO);
+                orgEquipmentInspectionStatisticsVO.setRtuCount(count);
+                EquipmentInspectionInfoDTO inspectionInfoDTO = new EquipmentInspectionInfoDTO();
+                inspectionInfoDTO.setAdCode(orgregion.getAdcd());
+                //	if (null != node) {
+                inspectionInfoDTO.setExcludeCode(excludecode);
+                //	}
+                Calendar calendar = Calendar.getInstance();
+                calendar.setTime(new Date());
+                calendar.set(Calendar.MONTH, 0);
+                calendar.set(Calendar.DAY_OF_MONTH, 1);
+                calendar.set(Calendar.HOUR_OF_DAY, 0);
+                calendar.set(Calendar.MINUTE, 0);
+                calendar.set(Calendar.SECOND, 0);
+                inspectionInfoDTO.setInspectionYearStartDate(calendar.getTime());
+                calendar.add(Calendar.YEAR, 1);
+                inspectionInfoDTO.setInspectionYearEndDate(calendar.getTime());
+                count = equipmentInspectionService.inspectionCount(inspectionInfoDTO);
+                orgEquipmentInspectionStatisticsVO.setInspectionCount(count);
+                EquipmentInspectionReportDTO inspectionReportDTO = new EquipmentInspectionReportDTO();
+                inspectionReportDTO.setAdCode(orgregion.getAdcd());
+                //if (null != node) {
+                inspectionReportDTO.setExcludeCode(excludecode);
+                //	}
+                calendar.setTime(new Date());
+                calendar.set(Calendar.MONTH, 0);
+                calendar.set(Calendar.DAY_OF_MONTH, 1);
+                calendar.set(Calendar.HOUR_OF_DAY, 0);
+                calendar.set(Calendar.MINUTE, 0);
+                calendar.set(Calendar.SECOND, 0);
+                inspectionReportDTO.setInspectionYearStartDate(calendar.getTime());
+                calendar.add(Calendar.YEAR, 1);
+                inspectionReportDTO.setInspectionYearEndDate(calendar.getTime());
+                inspectionReportDTO.setRainSeasonKind(1);
+                count = inspectionReportService.equipmentInspectionReportCount(inspectionReportDTO);
+                orgEquipmentInspectionStatisticsVO.setBeforeRainInspectionCount(count);
+                inspectionReportDTO.setRainSeasonKind(2);
+                count = inspectionReportService.equipmentInspectionReportCount(inspectionReportDTO);
+                orgEquipmentInspectionStatisticsVO.setFirstRainInspectionCount(count);
+                inspectionReportDTO.setRainSeasonKind(3);
+                count = inspectionReportService.equipmentInspectionReportCount(inspectionReportDTO);
+                orgEquipmentInspectionStatisticsVO.setSencodRainInspectionCount(count);
+                list.add(orgEquipmentInspectionStatisticsVO);
+            }
+        } else if(BusinessConstant.ROLE_SYS_ADMIN.equals(user.getRoleName())) {
+            //系统管理员,显示盟市部门统计数据
+            LambdaQueryWrapper<Dept> wrapper = Wrappers.<Dept>query().lambda();
+            wrapper.eq(Dept::getIsDeleted, 0);
+            wrapper.eq(Dept::getParentId, Func.toLong(user.getDeptId()));
+            List<Dept> deptList = this.deptService.list(wrapper);
+            for (Dept dept : deptList) {
+                OrgEquipmentInspectionStatisticsVO orgEquipmentInspectionStatisticsVO = new OrgEquipmentInspectionStatisticsVO();
+                orgEquipmentInspectionStatisticsVO.setDeptId(dept.getId());
+                orgEquipmentInspectionStatisticsVO.setOrgName(dept.getDeptName());
+
+                LambdaQueryWrapper<DeptRegionEntity> deptLambdaQueryWrapper = Wrappers.<DeptRegionEntity>query().lambda();
+                deptLambdaQueryWrapper.eq(DeptRegionEntity::getDeptId, dept.getId());
+                DeptRegionEntity deptRegionEntity = deptRegionService.getOne(deptLambdaQueryWrapper);
+
+                LambdaQueryWrapper<RegionInfoEntity> nodeQueryWrapper = Wrappers.<RegionInfoEntity>query().lambda();
+                nodeQueryWrapper.eq(RegionInfoEntity::getAdcd, deptRegionEntity.getAdcd());
+                RegionInfoEntity nodeRegion = this.regionService.getOne(nodeQueryWrapper);
+
+                int excludecode = 0;
+                if (nodeRegion.getParentCode().equals(BusinessConstant.REGION_NM_ADCODE)) {
+                    excludecode = 1;
+                }
+
+                RtuInfoDTO rtuInfoDTO = new RtuInfoDTO();
+
+                //RegionTreeNodeEntity node = this.regionService.getRegionNode(BusinessConstant.ROLE_ORG_ADMIN,Func.toStr(dept.getId()), deptRegionEntity.getAdcd());
+                //if (null != node) {
+                rtuInfoDTO.setExcludeCode(excludecode);
+                //}
+                rtuInfoDTO.setAdCode(nodeRegion.getAdcd());
+                Long count = rtuBaseInfoService.rtuCount(rtuInfoDTO);
+
+                orgEquipmentInspectionStatisticsVO.setRtuCount(count);
+                EquipmentInspectionInfoDTO inspectionInfoDTO = new EquipmentInspectionInfoDTO();
+                inspectionInfoDTO.setAdCode(nodeRegion.getAdcd());
+                //if (null != node) {
+                inspectionInfoDTO.setExcludeCode(excludecode);
+                //}
+                Calendar calendar = Calendar.getInstance();
+                calendar.setTime(new Date());
+                calendar.set(Calendar.MONTH, 0);
+                calendar.set(Calendar.DAY_OF_MONTH, 1);
+                calendar.set(Calendar.HOUR_OF_DAY, 0);
+                calendar.set(Calendar.MINUTE, 0);
+                calendar.set(Calendar.SECOND, 0);
+                inspectionInfoDTO.setInspectionYearStartDate(calendar.getTime());
+                calendar.add(Calendar.YEAR, 1);
+                inspectionInfoDTO.setInspectionYearEndDate(calendar.getTime());
+                count = equipmentInspectionService.inspectionCount(inspectionInfoDTO);
+                orgEquipmentInspectionStatisticsVO.setInspectionCount(count);
+                EquipmentInspectionReportDTO inspectionReportDTO = new EquipmentInspectionReportDTO();
+                inspectionReportDTO.setAdCode(deptRegionEntity.getAdcd());
+                //	if (null != node) {
+                inspectionReportDTO.setExcludeCode(excludecode);
+                //	}
+                calendar.setTime(new Date());
+                calendar.set(Calendar.MONTH, 0);
+                calendar.set(Calendar.DAY_OF_MONTH, 1);
+                calendar.set(Calendar.HOUR_OF_DAY, 0);
+                calendar.set(Calendar.MINUTE, 0);
+                calendar.set(Calendar.SECOND, 0);
+                inspectionReportDTO.setInspectionYearStartDate(calendar.getTime());
+                calendar.add(Calendar.YEAR, 1);
+                inspectionReportDTO.setInspectionYearEndDate(calendar.getTime());
+                inspectionReportDTO.setRainSeasonKind(1);
+                count = inspectionReportService.equipmentInspectionReportCount(inspectionReportDTO);
+                orgEquipmentInspectionStatisticsVO.setBeforeRainInspectionCount(count);
+                inspectionReportDTO.setRainSeasonKind(2);
+                count = inspectionReportService.equipmentInspectionReportCount(inspectionReportDTO);
+                orgEquipmentInspectionStatisticsVO.setFirstRainInspectionCount(count);
+                inspectionReportDTO.setRainSeasonKind(3);
+                count = inspectionReportService.equipmentInspectionReportCount(inspectionReportDTO);
+                orgEquipmentInspectionStatisticsVO.setSencodRainInspectionCount(count);
+                list.add(orgEquipmentInspectionStatisticsVO);
+            }
+        }else if(BusinessConstant.ROLE_QI_ADMIN.equals(user.getRoleName())) {
+            LambdaQueryWrapper<DeptRegionEntity> orgdeptregionWrapper = Wrappers.<DeptRegionEntity>query().lambda();
+            orgdeptregionWrapper.eq(DeptRegionEntity::getDeptId, Func.toLong(user.getDeptId()));
+            DeptRegionEntity orgdeptregion = deptRegionService.getOne(orgdeptregionWrapper);
+            int excludecode = 0;
+
+            //旗县管理员
+            Dept dept = this.deptService.getById( Func.toLong(user.getDeptId()));
+
+           // LambdaQueryWrapper<Dept> wrapper = Wrappers.<Dept>query().lambda();
+          //  wrapper.eq(Dept::getParentId, Func.toLong(user.getDeptId()));
+           // List<Dept> deptList = this.deptService.list(wrapper);
+           // for (Dept dept : deptList) {
+                OrgEquipmentInspectionStatisticsVO orgEquipmentInspectionStatisticsVO = new OrgEquipmentInspectionStatisticsVO();
+                orgEquipmentInspectionStatisticsVO.setDeptId(dept.getId());
+                orgEquipmentInspectionStatisticsVO.setOrgName(dept.getDeptName());
+
+                //	LambdaQueryWrapper<DeptRegionEntity> deptLambdaQueryWrapper = Wrappers.<DeptRegionEntity>query().lambda();
+                //deptLambdaQueryWrapper.eq(DeptRegionEntity::getDeptId, dept.getId());
+                //	DeptRegionEntity deptRegionEntity = deptRegionService.getOne(deptLambdaQueryWrapper);
+                RtuInfoDTO rtuInfoDTO = new RtuInfoDTO();
+
+                //	RegionTreeNodeEntity node = this.regionService.getRegionNode(BusinessConstant.ROLE_COMPANY_ADMIN,Func.toStr(dept.getId()), deptRegionEntity.getAdcd());
+                //	if (null != node) {
+                rtuInfoDTO.setExcludeCode(excludecode);
+                //	}
+                rtuInfoDTO.setAdCode(orgdeptregion.getAdcd());
+                Long count = rtuBaseInfoService.rtuCount(rtuInfoDTO);
+                orgEquipmentInspectionStatisticsVO.setRtuCount(count);
+                EquipmentInspectionInfoDTO inspectionInfoDTO = new EquipmentInspectionInfoDTO();
+                inspectionInfoDTO.setAdCode(orgdeptregion.getAdcd());
+                //	if (null != node) {
+                inspectionInfoDTO.setExcludeCode(excludecode);
+                //	}
+                Calendar calendar = Calendar.getInstance();
+                calendar.setTime(new Date());
+                calendar.set(Calendar.MONTH, 0);
+                calendar.set(Calendar.DAY_OF_MONTH, 1);
+                calendar.set(Calendar.HOUR_OF_DAY, 0);
+                calendar.set(Calendar.MINUTE, 0);
+                calendar.set(Calendar.SECOND, 0);
+                inspectionInfoDTO.setInspectionYearStartDate(calendar.getTime());
+                calendar.add(Calendar.YEAR, 1);
+                inspectionInfoDTO.setInspectionYearEndDate(calendar.getTime());
+                count = equipmentInspectionService.inspectionCount(inspectionInfoDTO);
+                orgEquipmentInspectionStatisticsVO.setInspectionCount(count);
+                EquipmentInspectionReportDTO inspectionReportDTO = new EquipmentInspectionReportDTO();
+                inspectionReportDTO.setAdCode(orgdeptregion.getAdcd());
+                //if (null != node) {
+                inspectionReportDTO.setExcludeCode(excludecode);
+                //	}
+                calendar.setTime(new Date());
+                calendar.set(Calendar.MONTH, 0);
+                calendar.set(Calendar.DAY_OF_MONTH, 1);
+                calendar.set(Calendar.HOUR_OF_DAY, 0);
+                calendar.set(Calendar.MINUTE, 0);
+                calendar.set(Calendar.SECOND, 0);
+                inspectionReportDTO.setInspectionYearStartDate(calendar.getTime());
+                calendar.add(Calendar.YEAR, 1);
+                inspectionReportDTO.setInspectionYearEndDate(calendar.getTime());
+                inspectionReportDTO.setRainSeasonKind(1);
+                count = inspectionReportService.equipmentInspectionReportCount(inspectionReportDTO);
+                orgEquipmentInspectionStatisticsVO.setBeforeRainInspectionCount(count);
+                inspectionReportDTO.setRainSeasonKind(2);
+                count = inspectionReportService.equipmentInspectionReportCount(inspectionReportDTO);
+                orgEquipmentInspectionStatisticsVO.setFirstRainInspectionCount(count);
+                inspectionReportDTO.setRainSeasonKind(3);
+                count = inspectionReportService.equipmentInspectionReportCount(inspectionReportDTO);
+                orgEquipmentInspectionStatisticsVO.setSencodRainInspectionCount(count);
+                list.add(orgEquipmentInspectionStatisticsVO);
+          //  }
+        }
+
+        return R.data(list);
+    }
+
+    /**
+     * 未完成巡检设备清单信息列表,分页
+     */
+    @GetMapping("/unfinished/page")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "rtuName", value = "测站名称", paramType = "query", dataType = "string"),
+            @ApiImplicitParam(name = "rtuCode", value = "测站编码", paramType = "query", dataType = "string"),
+            @ApiImplicitParam(name = "inspectionYear", value = "巡检年度", paramType = "query", dataType = "string"),
+            @ApiImplicitParam(name = "rainSeasonKind", value = "汛期类型", paramType = "query", dataType = "int"),
+    })
+    @ApiOperationSupport(order = 2)
+    @ApiOperation(value = "未完成巡检设备清单信息列表")
+    public R<IPage<EquipmentInspectionInfoVO>> unfinishedInspectionEquipmentPage(@ApiIgnore EquipmentInspectionInfoDTO inspectionInfoDTO, Query query) {
+        BladeUser user = AuthUtil.getUser();
+        if (BusinessConstant.ROLE_SYS_ADMIN.equals(user.getRoleName())) {
+            inspectionInfoDTO.setAdCode(BusinessConstant.REGION_NM_ADCODE);
+            RegionTreeNodeEntity node = this.regionService.getRegionNode(user.getRoleName(), user.getDeptId(), inspectionInfoDTO.getAdCode());
+            if (Func.notNull(node)) {
+                inspectionInfoDTO.setExcludeCode(node.getExclude());
+            }
+        } else if (BusinessConstant.ROLE_ORG_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_SERVICE_PERSON.equals(user.getRoleName())) {
+            LambdaQueryWrapper<DeptRegionEntity> deptRegionEntityLambdaQueryWrapper = Wrappers.<DeptRegionEntity>query().lambda();
+            deptRegionEntityLambdaQueryWrapper.eq(DeptRegionEntity::getDeptId, Func.toLong(user.getDeptId()));
+            DeptRegionEntity deptRegionEntity = deptRegionService.getOne(deptRegionEntityLambdaQueryWrapper);
+            inspectionInfoDTO.setAdCode(deptRegionEntity.getAdcd());
+            RegionTreeNodeEntity node = this.regionService.getRegionNode(user.getRoleName(), user.getDeptId(), inspectionInfoDTO.getAdCode());
+            if (Func.notNull(node)) {
+                inspectionInfoDTO.setExcludeCode(node.getExclude());
+            }
+        } else if (BusinessConstant.ROLE_QI_ADMIN.equals(user.getRoleName())) {
+            LambdaQueryWrapper<DeptRegionEntity> deptRegionEntityLambdaQueryWrapper = Wrappers.<DeptRegionEntity>query().lambda();
+            deptRegionEntityLambdaQueryWrapper.eq(DeptRegionEntity::getDeptId, Func.toLong(user.getDeptId()));
+            DeptRegionEntity deptRegionEntity = deptRegionService.getOne(deptRegionEntityLambdaQueryWrapper);
+            inspectionInfoDTO.setAdCode(deptRegionEntity.getAdcd());
+        }
+
+        Date now = new Date();
+        if (inspectionInfoDTO.getInspectionYear() != null) {
+            Date year = Func.parseDate(inspectionInfoDTO.getInspectionYear(), "yyyy-MM-dd");
+            Calendar calendar = Calendar.getInstance();
+            calendar.setTime(year);
+            calendar.set(Calendar.MONTH, 0);
+            calendar.set(Calendar.DAY_OF_MONTH, 1);
+            calendar.set(Calendar.HOUR_OF_DAY, 0);
+            calendar.set(Calendar.MINUTE, 0);
+            calendar.set(Calendar.SECOND, 0);
+            inspectionInfoDTO.setInspectionYearStartDate(calendar.getTime());
+            calendar.add(Calendar.YEAR, 1);
+            inspectionInfoDTO.setInspectionYearEndDate(calendar.getTime());
+        } else {
+            Calendar calendar = Calendar.getInstance();
+            calendar.setTime(new Date());
+            calendar.set(Calendar.MONTH, 0);
+            calendar.set(Calendar.DAY_OF_MONTH, 1);
+            calendar.set(Calendar.HOUR_OF_DAY, 0);
+            calendar.set(Calendar.MINUTE, 0);
+            calendar.set(Calendar.SECOND, 0);
+            inspectionInfoDTO.setInspectionYearStartDate(calendar.getTime());
+            calendar.add(Calendar.YEAR, 1);
+            inspectionInfoDTO.setInspectionYearEndDate(calendar.getTime());
+            if (inspectionInfoDTO.getRainSeasonKind() == null) {
+                //处理汛期类别
+                LambdaQueryWrapper<EquipmentInspectionPlanEntity> wrapper = Wrappers.<EquipmentInspectionPlanEntity>query().lambda();
+                wrapper.eq(EquipmentInspectionPlanEntity::getIsDeleted, 0);
+                wrapper.orderByDesc(EquipmentInspectionPlanEntity::getCreateTime);
+                List<EquipmentInspectionPlanEntity> list = planService.list(wrapper);
+                if (null != list && list.size() > 0) {
+                    EquipmentInspectionPlanEntity entity = list.get(0);
+
+                    Calendar dt = Calendar.getInstance();
+                    Calendar calendarStart = Calendar.getInstance();
+                    Calendar calendarEnd = Calendar.getInstance();
+                    dt.setTime(now);
+                    //汛前上报
+                    calendarStart.setTime(entity.getBeforeRainSeasonStartTime());
+                    calendarEnd.setTime(entity.getBeforeRainSeasonEndTime());
+                    if ((dt.getTime().getTime() / 1000 == calendarStart.getTime().getTime() / 1000 || dt.after(calendarStart)) && dt.before(calendarEnd)) {
+                        inspectionInfoDTO.setRainSeasonKind(1);
+                    }
+                    //汛中第一次上报
+                    calendarStart.setTime(entity.getRainSeasonFirstStartTime());
+                    calendarEnd.setTime(entity.getRainSeasonFirstEndTime());
+                    if ((dt.getTime().getTime() / 1000 == calendarStart.getTime().getTime() / 1000 || dt.after(calendarStart)) && dt.before(calendarEnd)) {
+                        inspectionInfoDTO.setRainSeasonKind(2);
+                    }
+                    //汛中第二次上报
+                    calendarStart.setTime(entity.getRainSeasonSecondStartTime());
+                    calendarEnd.setTime(entity.getRainSeasonSecondEndTime());
+                    if ((dt.getTime().getTime() / 1000 == calendarStart.getTime().getTime() / 1000 || dt.after(calendarStart)) && dt.before(calendarEnd)) {
+                        inspectionInfoDTO.setRainSeasonKind(3);
+                    }
+                }
+                //没在当年任意一个汛期,直接返回
+                if (inspectionInfoDTO.getRainSeasonKind() == null) {
+                    return R.data(null);
+                }
+            }
+        }
+        IPage<EquipmentInspectionInfoVO> pages = equipmentInspectionService.selectUnfinishedInspectionEquipmentPage(Condition.getPage(query), inspectionInfoDTO);
+        List<EquipmentInspectionInfoVO> volist = pages.getRecords();
+        for (EquipmentInspectionInfoVO vo : volist) {
+            EquipmentInspectionWrapper.build().entityVO(vo);
+        }
+        return R.data(pages);
+    }
+
+    /**
+     * 未完成巡检设备清单信息导出
+     *
+     * @return
+     */
+    @GetMapping("/unfinished/export")
+    @ApiOperationSupport(order = 3)
+    @ApiOperation(value = "未完成巡检设备清单导出", notes = "")
+    public R<Map<String, Object>> unfinishedInspectionEquipmentExport(@ApiIgnore EquipmentInspectionInfoDTO inspectionInfoDTO) {
+        BladeUser user = AuthUtil.getUser();
+        if (BusinessConstant.ROLE_SYS_ADMIN.equals(user.getRoleName())) {
+            inspectionInfoDTO.setAdCode(BusinessConstant.REGION_NM_ADCODE);
+            RegionTreeNodeEntity node = this.regionService.getRegionNode(user.getRoleName(), user.getDeptId(), inspectionInfoDTO.getAdCode());
+            if (Func.notNull(node)) {
+                inspectionInfoDTO.setExcludeCode(node.getExclude());
+            }
+        } else if (BusinessConstant.ROLE_ORG_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_SERVICE_PERSON.equals(user.getRoleName())) {
+            LambdaQueryWrapper<DeptRegionEntity> deptRegionEntityLambdaQueryWrapper = Wrappers.<DeptRegionEntity>query().lambda();
+            deptRegionEntityLambdaQueryWrapper.eq(DeptRegionEntity::getDeptId, Func.toLong(user.getDeptId()));
+            DeptRegionEntity deptRegionEntity = deptRegionService.getOne(deptRegionEntityLambdaQueryWrapper);
+            inspectionInfoDTO.setAdCode(deptRegionEntity.getAdcd());
+            RegionTreeNodeEntity node = this.regionService.getRegionNode(user.getRoleName(), user.getDeptId(), inspectionInfoDTO.getAdCode());
+            if (Func.notNull(node)) {
+                inspectionInfoDTO.setExcludeCode(node.getExclude());
+            }
+        } else if (BusinessConstant.ROLE_QI_ADMIN.equals(user.getRoleName())) {
+            LambdaQueryWrapper<DeptRegionEntity> deptRegionEntityLambdaQueryWrapper = Wrappers.<DeptRegionEntity>query().lambda();
+            deptRegionEntityLambdaQueryWrapper.eq(DeptRegionEntity::getDeptId, Func.toLong(user.getDeptId()));
+            DeptRegionEntity deptRegionEntity = deptRegionService.getOne(deptRegionEntityLambdaQueryWrapper);
+            inspectionInfoDTO.setAdCode(deptRegionEntity.getAdcd());
+        }
+
+        //文件标题
+        String title = "";
+        //当前时间
+        Date now = new Date();
+        if (inspectionInfoDTO.getInspectionYear() != null) {
+            Date year = Func.parseDate(inspectionInfoDTO.getInspectionYear(), "yyyy-MM-dd");
+            Calendar calendar = Calendar.getInstance();
+            calendar.setTime(year);
+            calendar.set(Calendar.MONTH, 0);
+            calendar.set(Calendar.DAY_OF_MONTH, 1);
+            calendar.set(Calendar.HOUR_OF_DAY, 0);
+            calendar.set(Calendar.MINUTE, 0);
+            calendar.set(Calendar.SECOND, 0);
+            inspectionInfoDTO.setInspectionYearStartDate(calendar.getTime());
+            calendar.add(Calendar.YEAR, 1);
+            inspectionInfoDTO.setInspectionYearEndDate(calendar.getTime());
+            title += Func.formatDate(year) + "年";
+
+        } else {
+            Calendar calendar = Calendar.getInstance();
+            calendar.setTime(now);
+            calendar.set(Calendar.MONTH, 0);
+            calendar.set(Calendar.DAY_OF_MONTH, 1);
+            calendar.set(Calendar.HOUR_OF_DAY, 0);
+            calendar.set(Calendar.MINUTE, 0);
+            calendar.set(Calendar.SECOND, 0);
+            inspectionInfoDTO.setInspectionYearStartDate(calendar.getTime());
+
+            calendar.add(Calendar.YEAR, 1);
+            inspectionInfoDTO.setInspectionYearEndDate(calendar.getTime());
+
+            title += Func.formatDate(now) + "年";
+
+            if (inspectionInfoDTO.getRainSeasonKind() == null) {
+                //处理汛期类别
+                LambdaQueryWrapper<EquipmentInspectionPlanEntity> wrapper = Wrappers.<EquipmentInspectionPlanEntity>query().lambda();
+                wrapper.eq(EquipmentInspectionPlanEntity::getIsDeleted, 0);
+                wrapper.orderByDesc(EquipmentInspectionPlanEntity::getCreateTime);
+                List<EquipmentInspectionPlanEntity> list = planService.list(wrapper);
+                if (null != list && list.size() > 0) {
+                    EquipmentInspectionPlanEntity entity = list.get(0);
+
+                    Calendar dt = Calendar.getInstance();
+                    Calendar calendarStart = Calendar.getInstance();
+                    Calendar calendarEnd = Calendar.getInstance();
+                    dt.setTime(now);
+                    //汛前上报
+                    calendarStart.setTime(entity.getBeforeRainSeasonStartTime());
+                    calendarEnd.setTime(entity.getBeforeRainSeasonEndTime());
+                    if ((dt.getTime().getTime() / 1000 == calendarStart.getTime().getTime() / 1000 || dt.after(calendarStart)) && dt.before(calendarEnd)) {
+                        inspectionInfoDTO.setRainSeasonKind(1);
+                        title += "汛前";
+                    }
+                    //汛中第一次上报
+                    calendarStart.setTime(entity.getRainSeasonFirstStartTime());
+                    calendarEnd.setTime(entity.getRainSeasonFirstEndTime());
+                    if ((dt.getTime().getTime() / 1000 == calendarStart.getTime().getTime() / 1000 || dt.after(calendarStart)) && dt.before(calendarEnd)) {
+                        inspectionInfoDTO.setRainSeasonKind(2);
+                        title += "汛中第一次";
+                    }
+                    //汛中第二次上报
+                    calendarStart.setTime(entity.getRainSeasonSecondStartTime());
+                    calendarEnd.setTime(entity.getRainSeasonSecondEndTime());
+                    if ((dt.getTime().getTime() / 1000 == calendarStart.getTime().getTime() / 1000 || dt.after(calendarStart)) && dt.before(calendarEnd)) {
+                        inspectionInfoDTO.setRainSeasonKind(3);
+                        title += "汛中第二次";
+                    }
+                }
+                //没在当年任意一个汛期,直接返回
+                if (inspectionInfoDTO.getRainSeasonKind() == null) {
+                    List<UnfinishedInspectionEquipmentExportEntity> unfinishedInspectionEquipmentExportEntities = new LinkedList<>();
+                    Map<String, Object> data = this.exportUnfinishedInspectionEquipmentExcel(title, unfinishedInspectionEquipmentExportEntities);
+                    return R.data(data);
+                }
+            }
+        }
+        if (inspectionInfoDTO.getRainSeasonKind() != null) {
+            if (inspectionInfoDTO.getRainSeasonKind() == 1) {
+                title += "汛前";
+            } else if (inspectionInfoDTO.getRainSeasonKind() == 2) {
+                title += "汛中第一次";
+            } else if (inspectionInfoDTO.getRainSeasonKind() == 3) {
+                title += "汛中第二次";
+            }
+        }
+        List<EquipmentInspectionInfoVO> equipmentInspectionInfoVOList = equipmentInspectionService.selectUnfinishedInspectionEquipmentList(inspectionInfoDTO);
+        //生成数据
+        List<UnfinishedInspectionEquipmentExportEntity> unfinishedInspectionEquipmentExportEntities = new LinkedList<>();
+        if (null != equipmentInspectionInfoVOList && equipmentInspectionInfoVOList.size() > 0) {
+            int index = 1;
+            for (EquipmentInspectionInfoVO entity : equipmentInspectionInfoVOList) {
+                UnfinishedInspectionEquipmentExportEntity exportEntity = new UnfinishedInspectionEquipmentExportEntity();
+                exportEntity.setIndex(index);
+                if (entity.getAdCity() != null) {
+                    exportEntity.setAdCity(entity.getAdCity());
+                } else {
+                    exportEntity.setAdCity("");
+                }
+                if (entity.getAdDist() != null) {
+                    exportEntity.setAdDist(entity.getAdDist());
+                } else {
+                    exportEntity.setAdDist("");
+                }
+                if (entity.getRtuName() != null) {
+                    exportEntity.setRtuName(entity.getRtuName());
+                } else {
+                    exportEntity.setRtuName("");
+                }
+                exportEntity.setRtuCode(entity.getRtuCode());
+                String rtuKindDesc = "";
+                if (entity.getIsRain() != null && entity.getIsRain() == 1) {
+                    rtuKindDesc += "雨量站";
+                }
+                if ((entity.getIsRiver() != null && entity.getIsRiver() == 1) || (entity.getIsRes() != null && entity.getIsRes() == 1)) {
+                    if (rtuKindDesc.length() > 0) {
+                        rtuKindDesc += "/";
+                    }
+                    rtuKindDesc += "水位站";
+                }
+                if (entity.getIsGround() != null && entity.getIsGround() == 1) {
+                    if (rtuKindDesc.length() > 0) {
+                        rtuKindDesc += "/";
+                    }
+                    rtuKindDesc += "墒情站";
+                }
+                if (entity.getIsVideo() != null && entity.getIsVideo() == 1) {
+                    if (rtuKindDesc.length() > 0) {
+                        rtuKindDesc += "/";
+                    }
+                    rtuKindDesc += "视频站";
+                }
+                exportEntity.setRtuKindDesc(rtuKindDesc);
+
+                if (entity.getLng() != null) {
+                    exportEntity.setLng(entity.getLng());
+                } else {
+                    exportEntity.setLng("");
+                }
+                if (entity.getLat() != null) {
+                    exportEntity.setLat(entity.getLat());
+                } else {
+                    exportEntity.setLat("");
+                }
+                if (entity.getLocationDesc() != null) {
+                    exportEntity.setLocationDesc(entity.getLocationDesc());
+                } else {
+                    exportEntity.setLocationDesc("");
+                }
+
+                if (entity.getBeforeRainSeasonStatus() != null) {
+                    if (entity.getBeforeRainSeasonStatus() == 0) {
+                        exportEntity.setBeforeRainSeasonStatus("");
+                    } else if (entity.getBeforeRainSeasonStatus() == 1) {
+                        exportEntity.setBeforeRainSeasonStatus("已填报");
+                    } else {
+                        exportEntity.setBeforeRainSeasonStatus("");
+                    }
+                } else {
+                    exportEntity.setBeforeRainSeasonStatus("");
+                }
+                if (entity.getRainSeasonFirstStatus() != null) {
+                    if (entity.getRainSeasonFirstStatus() == 0) {
+                        exportEntity.setRainSeasonFirstStatus("");
+                    } else if (entity.getRainSeasonFirstStatus() == 1) {
+                        exportEntity.setRainSeasonFirstStatus("已填报");
+                    } else {
+                        exportEntity.setRainSeasonFirstStatus("");
+                    }
+                } else {
+                    exportEntity.setRainSeasonFirstStatus("");
+                }
+                if (entity.getRainSeasonSecondStatus() != null) {
+                    if (entity.getRainSeasonSecondStatus() == 0) {
+                        exportEntity.setRainSeasonSecondStatus("");
+                    } else if (entity.getRainSeasonSecondStatus() == 1) {
+                        exportEntity.setRainSeasonSecondStatus("已填报");
+                    } else {
+                        exportEntity.setRainSeasonSecondStatus("");
+                    }
+                } else {
+                    exportEntity.setRainSeasonSecondStatus("");
+                }
+                unfinishedInspectionEquipmentExportEntities.add(exportEntity);
+                index += 1;
+            }
+        }
+        Map<String, Object> data = this.exportUnfinishedInspectionEquipmentExcel(title, unfinishedInspectionEquipmentExportEntities);
+        return R.data(data);
+    }
+
+    private Map<String, Object> exportUnfinishedInspectionEquipmentExcel(String title, List<UnfinishedInspectionEquipmentExportEntity> list) {
+        //当前时间
+        //Calendar dt = Calendar.getInstance();
+        //dt.setTime(new Date());
+        Map<String, Object> data = new HashMap<>();
+        data.put("status", 0);
+        String templateFilePath = this.workDir + File.separator + this.inspectionUnfinishedTemplate;
+        String outpath = this.workDir + File.separator + Func.formatDate(new Date());
+        File dir = new File(outpath);
+        if (!dir.exists()) {
+            if (!dir.mkdir()) {
+                data.put("error", "目录创建失败");
+                return data;
+            }
+        }
+        String outFileName = Func.randomUUID() + ".xlsx";
+        outpath += File.separator + outFileName;
+        ExcelWriter excelWriter = EasyExcel.write(outpath).withTemplate(templateFilePath).excelType(ExcelTypeEnum.XLSX).build();
+        WriteSheet writeSheet = EasyExcel.writerSheet("信息统计表").build();
+        excelWriter.write(list, writeSheet);
+        excelWriter.finish();
+        try {
+            FileInputStream fileInputStream = new FileInputStream(new File(outpath));
+            BladeFile bladeFile = ossBuilder.template().putFile(outFileName, fileInputStream);
+            String ossPath = bladeFile.getName();
+            //String p = bladeFile.getDomain();
+            data.put("name", ossPath);
+            data.put("url", ossPath);
+            data.put("filename", "未完成巡检设备(" + title + ")统计清单表");
+            data.put("status", 1);
+
+        } catch (FileNotFoundException e) {
+            e.printStackTrace();
+            data.put("error", "导出失败!");
+        }
+        return data;
+    }
 }

+ 1263 - 1238
src/main/java/org/springblade/modules/business/equipment/inspection/report/controller/EquipmentInspectionReportController.java

@@ -72,1281 +72,1306 @@ import java.util.*;
 @Slf4j
 @Api(value = "设备巡检填报管理模块", tags = "设备巡检填报管理模块")
 public class EquipmentInspectionReportController extends BladeController {
-	private final IEquipmentInspectionReportService reportService;
-	private final IEquipmentInspectionService inspectionService;
-	private final IEquipmentInspectionPlanService planService;
-	private final IDeptRegionService deptRegionService;
-	private final IRtuBaseInfoService rtuBaseInfoService;
-	private final IRegionInfoService regionService;
+    private final IEquipmentInspectionReportService reportService;
+    private final IEquipmentInspectionService inspectionService;
+    private final IEquipmentInspectionPlanService planService;
+    private final IDeptRegionService deptRegionService;
+    private final IRtuBaseInfoService rtuBaseInfoService;
+    private final IRegionInfoService regionService;
 
-	@Resource
-	private OssBuilder ossBuilder;
+    @Resource
+    private OssBuilder ossBuilder;
 
-	@Value("${export-config.workdir}")
-	private String workDir;
+    @Value("${export-config.workdir}")
+    private String workDir;
 
-	@Value("${export-config.inspection-remainingproblems-template}")
-	private String inspectionRemainingProblemsTemplate;
+    @Value("${export-config.inspection-remainingproblems-template}")
+    private String inspectionRemainingProblemsTemplate;
 
 
-	/**
-	 * 分页
-	 */
-	@GetMapping("/list")
-	@ApiImplicitParams({
-		@ApiImplicitParam(name = "adCode", value = "行政区划编码", paramType = "query", dataType = "string"),
-		@ApiImplicitParam(name = "inspectionYear", value = "巡检年度", paramType = "query", dataType = "string"),
-	})
-	@ApiOperationSupport(order = 2)
-	@ApiOperation(value = "分页")
-	public R<List<EquipmentInspectionReportVO>> list(@ApiIgnore EquipmentInspectionReportDTO inspectionReportDTO) {
-		if (inspectionReportDTO.getInspectionYear() != null) {
-			Date year = Func.parseDate(inspectionReportDTO.getInspectionYear(), "yyyy-MM-dd");
-			Calendar calendar = Calendar.getInstance();
-			calendar.setTime(year);
-			calendar.set(Calendar.MONTH, 0);
-			calendar.set(Calendar.DAY_OF_MONTH, 1);
-			calendar.set(Calendar.HOUR_OF_DAY, 0);
-			calendar.set(Calendar.MINUTE, 0);
-			calendar.set(Calendar.SECOND, 0);
-			inspectionReportDTO.setInspectionYearStartDate(calendar.getTime());
-			calendar.add(Calendar.YEAR, 1);
-			inspectionReportDTO.setInspectionYearEndDate(calendar.getTime());
-		} else {
-			Calendar calendar = Calendar.getInstance();
-			calendar.setTime(new Date());
-			calendar.set(Calendar.MONTH, 0);
-			calendar.set(Calendar.DAY_OF_MONTH, 1);
-			calendar.set(Calendar.HOUR_OF_DAY, 0);
-			calendar.set(Calendar.MINUTE, 0);
-			calendar.set(Calendar.SECOND, 0);
-			inspectionReportDTO.setInspectionYearStartDate(calendar.getTime());
-			calendar.add(Calendar.YEAR, 1);
-			inspectionReportDTO.setInspectionYearEndDate(calendar.getTime());
-		}
-		List<EquipmentInspectionReportVO> list = reportService.selectList(inspectionReportDTO);
-		for (EquipmentInspectionReportVO vo : list) {
-			EquipmentInspectionReportWrapper.build().entityVO(vo);
-		}
-		return R.data(list);
-	}
+    /**
+     * 分页
+     */
+    @GetMapping("/list")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "adCode", value = "行政区划编码", paramType = "query", dataType = "string"),
+            @ApiImplicitParam(name = "inspectionYear", value = "巡检年度", paramType = "query", dataType = "string"),
+    })
+    @ApiOperationSupport(order = 2)
+    @ApiOperation(value = "分页")
+    public R<List<EquipmentInspectionReportVO>> list(@ApiIgnore EquipmentInspectionReportDTO inspectionReportDTO) {
+        if (inspectionReportDTO.getInspectionYear() != null) {
+            Date year = Func.parseDate(inspectionReportDTO.getInspectionYear(), "yyyy-MM-dd");
+            Calendar calendar = Calendar.getInstance();
+            calendar.setTime(year);
+            calendar.set(Calendar.MONTH, 0);
+            calendar.set(Calendar.DAY_OF_MONTH, 1);
+            calendar.set(Calendar.HOUR_OF_DAY, 0);
+            calendar.set(Calendar.MINUTE, 0);
+            calendar.set(Calendar.SECOND, 0);
+            inspectionReportDTO.setInspectionYearStartDate(calendar.getTime());
+            calendar.add(Calendar.YEAR, 1);
+            inspectionReportDTO.setInspectionYearEndDate(calendar.getTime());
+        } else {
+            Calendar calendar = Calendar.getInstance();
+            calendar.setTime(new Date());
+            calendar.set(Calendar.MONTH, 0);
+            calendar.set(Calendar.DAY_OF_MONTH, 1);
+            calendar.set(Calendar.HOUR_OF_DAY, 0);
+            calendar.set(Calendar.MINUTE, 0);
+            calendar.set(Calendar.SECOND, 0);
+            inspectionReportDTO.setInspectionYearStartDate(calendar.getTime());
+            calendar.add(Calendar.YEAR, 1);
+            inspectionReportDTO.setInspectionYearEndDate(calendar.getTime());
+        }
+        List<EquipmentInspectionReportVO> list = reportService.selectList(inspectionReportDTO);
+        for (EquipmentInspectionReportVO vo : list) {
+            EquipmentInspectionReportWrapper.build().entityVO(vo);
+        }
+        return R.data(list);
+    }
 
-	/**
-	 * 分页
-	 */
-	@GetMapping("/page")
-	@ApiImplicitParams({
-		@ApiImplicitParam(name = "rtuName", value = "测站名称", paramType = "query", dataType = "string"),
-		@ApiImplicitParam(name = "rtuCode", value = "测站编码", paramType = "query", dataType = "string"),
-		@ApiImplicitParam(name = "adCode", value = "行政区划编码", paramType = "query", dataType = "string"),
-		@ApiImplicitParam(name = "inspectionYear", value = "巡检年度", paramType = "query", dataType = "string"),
-		@ApiImplicitParam(name = "rainSeasonKind", value = "汛期类型", paramType = "query", dataType = "int"),
-	})
-	@ApiOperationSupport(order = 2)
-	@ApiOperation(value = "分页")
-	public R<IPage<EquipmentInspectionReportVO>> page(@ApiIgnore EquipmentInspectionReportDTO inspectionReportDTO, Query query) {
-		BladeUser user = AuthUtil.getUser();
-		if (BusinessConstant.ROLE_SYS_ADMIN.equals(user.getRoleName())) {
-//			if (inspectionReportDTO.getAdCode() == null) {
-//				inspectionReportDTO.setAdCode(BusinessConstant.REGION_NM_ADCODE);
-//			}
-		} else if (BusinessConstant.ROLE_ORG_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_SERVICE_PERSON.equals(user.getRoleName())) {
-			if (inspectionReportDTO.getAdCode() == null) {
-				LambdaQueryWrapper<DeptRegionEntity> deptRegionEntityLambdaQueryWrapper = Wrappers.<DeptRegionEntity>query().lambda();
-				deptRegionEntityLambdaQueryWrapper.eq(DeptRegionEntity::getIsDeleted, 0);
-				deptRegionEntityLambdaQueryWrapper.eq(DeptRegionEntity::getDeptId, Func.toLong(user.getDeptId()));
-				DeptRegionEntity deptRegionEntity = deptRegionService.getOne(deptRegionEntityLambdaQueryWrapper);
-				inspectionReportDTO.setAdCode(deptRegionEntity.getAdcd());
-			}
-		}
-		int excludeCode = 0;
-		if (inspectionReportDTO.getAdCode() != null) {
-			RegionTreeNodeEntity node = this.regionService.getRegionNode(user.getRoleName(), user.getDeptId(), inspectionReportDTO.getAdCode());
-			if (null != node) {
-				excludeCode = node.getExclude();
-			}
-		}
-		inspectionReportDTO.setExcludeCode(excludeCode);
-		if (inspectionReportDTO.getInspectionYear() != null) {
-			Date year = Func.parseDate(inspectionReportDTO.getInspectionYear(), "yyyy-MM-dd");
-			Calendar calendar = Calendar.getInstance();
-			calendar.setTime(year);
-			calendar.set(Calendar.MONTH, 0);
-			calendar.set(Calendar.DAY_OF_MONTH, 1);
-			calendar.set(Calendar.HOUR_OF_DAY, 0);
-			calendar.set(Calendar.MINUTE, 0);
-			calendar.set(Calendar.SECOND, 0);
-			inspectionReportDTO.setInspectionYearStartDate(calendar.getTime());
-			calendar.add(Calendar.YEAR, 1);
-			inspectionReportDTO.setInspectionYearEndDate(calendar.getTime());
-		} else {
-			Calendar calendar = Calendar.getInstance();
-			calendar.setTime(new Date());
-			calendar.set(Calendar.MONTH, 0);
-			calendar.set(Calendar.DAY_OF_MONTH, 1);
-			calendar.set(Calendar.HOUR_OF_DAY, 0);
-			calendar.set(Calendar.MINUTE, 0);
-			calendar.set(Calendar.SECOND, 0);
-			inspectionReportDTO.setInspectionYearStartDate(calendar.getTime());
-			calendar.add(Calendar.YEAR, 1);
-			inspectionReportDTO.setInspectionYearEndDate(calendar.getTime());
-		}
-		IPage<EquipmentInspectionReportVO> pages = reportService.selectPage(Condition.getPage(query), inspectionReportDTO);
-		List<EquipmentInspectionReportVO> list = pages.getRecords();
-		for (EquipmentInspectionReportVO vo : list) {
-			EquipmentInspectionReportWrapper.build().entityVO(vo);
-		}
-		return R.data(pages);
-	}
+    /**
+     * 分页
+     */
+    @GetMapping("/page")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "rtuName", value = "测站名称", paramType = "query", dataType = "string"),
+            @ApiImplicitParam(name = "rtuCode", value = "测站编码", paramType = "query", dataType = "string"),
+            @ApiImplicitParam(name = "adCode", value = "行政区划编码", paramType = "query", dataType = "string"),
+            @ApiImplicitParam(name = "inspectionYear", value = "巡检年度", paramType = "query", dataType = "string"),
+            @ApiImplicitParam(name = "rainSeasonKind", value = "汛期类型", paramType = "query", dataType = "int"),
+    })
+    @ApiOperationSupport(order = 2)
+    @ApiOperation(value = "分页")
+    public R<IPage<EquipmentInspectionReportVO>> page(@ApiIgnore EquipmentInspectionReportDTO inspectionReportDTO, Query query) {
+        BladeUser user = AuthUtil.getUser();
+        int excludeCode = 0;
+        if (BusinessConstant.ROLE_SYS_ADMIN.equals(user.getRoleName())) {
+            if (Func.notNull(inspectionReportDTO.getAdCode())) {
+                RegionTreeNodeEntity node = this.regionService.getRegionNode(user.getRoleName(), user.getDeptId(), inspectionReportDTO.getAdCode());
+                if (Func.notNull(node)) {
+                    excludeCode = node.getExclude();
+                }
+            }
+        } else if (BusinessConstant.ROLE_ORG_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_SERVICE_PERSON.equals(user.getRoleName())) {
+            if (Func.isNull(inspectionReportDTO.getAdCode())) {
+                LambdaQueryWrapper<DeptRegionEntity> deptRegionEntityLambdaQueryWrapper = Wrappers.<DeptRegionEntity>query().lambda();
+                deptRegionEntityLambdaQueryWrapper.eq(DeptRegionEntity::getDeptId, Func.toLong(user.getDeptId()));
+                DeptRegionEntity deptRegionEntity = deptRegionService.getOne(deptRegionEntityLambdaQueryWrapper);
+                inspectionReportDTO.setAdCode(deptRegionEntity.getAdcd());
+            }
+            RegionTreeNodeEntity node = this.regionService.getRegionNode(user.getRoleName(), user.getDeptId(), inspectionReportDTO.getAdCode());
+            if (Func.notNull(node)) {
+                excludeCode = node.getExclude();
+            }
+        } else if (BusinessConstant.ROLE_QI_ADMIN.equals(user.getRoleName())) {
+            if (Func.isNull(inspectionReportDTO.getAdCode())) {
+                LambdaQueryWrapper<DeptRegionEntity> deptRegionEntityLambdaQueryWrapper = Wrappers.<DeptRegionEntity>query().lambda();
+                deptRegionEntityLambdaQueryWrapper.eq(DeptRegionEntity::getDeptId, Func.toLong(user.getDeptId()));
+                DeptRegionEntity deptRegionEntity = deptRegionService.getOne(deptRegionEntityLambdaQueryWrapper);
+                inspectionReportDTO.setAdCode(deptRegionEntity.getAdcd());
+            }
+        }
+        inspectionReportDTO.setExcludeCode(excludeCode);
+        if (inspectionReportDTO.getInspectionYear() != null) {
+            Date year = Func.parseDate(inspectionReportDTO.getInspectionYear(), "yyyy-MM-dd");
+            Calendar calendar = Calendar.getInstance();
+            calendar.setTime(year);
+            calendar.set(Calendar.MONTH, 0);
+            calendar.set(Calendar.DAY_OF_MONTH, 1);
+            calendar.set(Calendar.HOUR_OF_DAY, 0);
+            calendar.set(Calendar.MINUTE, 0);
+            calendar.set(Calendar.SECOND, 0);
+            inspectionReportDTO.setInspectionYearStartDate(calendar.getTime());
+            calendar.add(Calendar.YEAR, 1);
+            inspectionReportDTO.setInspectionYearEndDate(calendar.getTime());
+        } else {
+            Calendar calendar = Calendar.getInstance();
+            calendar.setTime(new Date());
+            calendar.set(Calendar.MONTH, 0);
+            calendar.set(Calendar.DAY_OF_MONTH, 1);
+            calendar.set(Calendar.HOUR_OF_DAY, 0);
+            calendar.set(Calendar.MINUTE, 0);
+            calendar.set(Calendar.SECOND, 0);
+            inspectionReportDTO.setInspectionYearStartDate(calendar.getTime());
+            calendar.add(Calendar.YEAR, 1);
+            inspectionReportDTO.setInspectionYearEndDate(calendar.getTime());
+        }
+        IPage<EquipmentInspectionReportVO> pages = reportService.selectPage(Condition.getPage(query), inspectionReportDTO);
+        List<EquipmentInspectionReportVO> list = pages.getRecords();
+        for (EquipmentInspectionReportVO vo : list) {
+            EquipmentInspectionReportWrapper.build().entityVO(vo);
+        }
+        return R.data(pages);
+    }
 
-	/**
-	 * 查询我填报的巡检信息
-	 */
-	@GetMapping("/my/page")
-	@ApiImplicitParams({
-		@ApiImplicitParam(name = "rtuName", value = "测站名称", paramType = "query", dataType = "string"),
-		@ApiImplicitParam(name = "rtuCode", value = "测站编码", paramType = "query", dataType = "string"),
-	})
-	@ApiOperationSupport(order = 2)
-	@ApiOperation(value = "分页")
-	public R<IPage<EquipmentInspectionReportVO>> myPage(@ApiIgnore EquipmentInspectionReportDTO inspectionReportDTO, Query query) {
-		BladeUser user = AuthUtil.getUser();
-		inspectionReportDTO.setCreateUser(user.getUserId());
-		IPage<EquipmentInspectionReportVO> pages = reportService.selectPage(Condition.getPage(query), inspectionReportDTO);
-		List<EquipmentInspectionReportVO> list = pages.getRecords();
-		for (EquipmentInspectionReportVO vo : list) {
-			EquipmentInspectionReportWrapper.build().entityVO(vo);
-		}
-		return R.data(pages);
-	}
+    /**
+     * 查询我填报的巡检信息
+     */
+    @GetMapping("/my/page")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "rtuName", value = "测站名称", paramType = "query", dataType = "string"),
+            @ApiImplicitParam(name = "rtuCode", value = "测站编码", paramType = "query", dataType = "string"),
+    })
+    @ApiOperationSupport(order = 2)
+    @ApiOperation(value = "分页")
+    public R<IPage<EquipmentInspectionReportVO>> myPage(@ApiIgnore EquipmentInspectionReportDTO inspectionReportDTO, Query query) {
+        BladeUser user = AuthUtil.getUser();
+        inspectionReportDTO.setCreateUser(user.getUserId());
+        IPage<EquipmentInspectionReportVO> pages = reportService.selectPage(Condition.getPage(query), inspectionReportDTO);
+        List<EquipmentInspectionReportVO> list = pages.getRecords();
+        for (EquipmentInspectionReportVO vo : list) {
+            EquipmentInspectionReportWrapper.build().entityVO(vo);
+        }
+        return R.data(pages);
+    }
 
-	/**
-	 * 详情
-	 */
-	@GetMapping("/detail")
-	@ApiImplicitParams({
-		@ApiImplicitParam(name = "id", value = "ID", paramType = "query", dataType = "long"),
-	})
-	@ApiOperationSupport(order = 1)
-	@ApiOperation(value = "详情", notes = "传入实体类EquipmentInspectionReportDTO")
-	public R<EquipmentInspectionReportVO> detail(EquipmentInspectionReportDTO inspectionReportDTO) {
-		EquipmentInspectionReportEntity detail = reportService.getById(inspectionReportDTO.getId());
-		if (detail != null) {
-			EquipmentInspectionReportVO vo = EquipmentInspectionReportWrapper.build().entityVO(detail);
-			return R.data(vo);
-		}
-		return R.data(null);
-	}
+    /**
+     * 详情
+     */
+    @GetMapping("/detail")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "id", value = "ID", paramType = "query", dataType = "long"),
+    })
+    @ApiOperationSupport(order = 1)
+    @ApiOperation(value = "详情", notes = "传入实体类EquipmentInspectionReportDTO")
+    public R<EquipmentInspectionReportVO> detail(EquipmentInspectionReportDTO inspectionReportDTO) {
+        EquipmentInspectionReportEntity detail = reportService.getById(inspectionReportDTO.getId());
+        if (detail != null) {
+            EquipmentInspectionReportVO vo = EquipmentInspectionReportWrapper.build().entityVO(detail);
+            return R.data(vo);
+        }
+        return R.data(null);
+    }
 
-	/**
-	 * 新增
-	 */
-	@PostMapping("/save")
-	@ApiOperationSupport(order = 4)
-	@ApiOperation(value = "新增", notes = "传入实体类EquipmentInspectionReportEntity ")
-	public R save(@RequestBody EquipmentInspectionReportEntity inspectionReportEntity) {
-		BladeUser user = AuthUtil.getUser();
-		if (inspectionReportEntity.getNetworkSignalStatus() == 0) {
-			if (null == inspectionReportEntity.getInspectionWorkPhotos() || inspectionReportEntity.getInspectionWorkPhotos().length() == 0) {
-				return R.fail("现场信号正常时,至少需要拍摄一张工作留存照片!");
-			}
-		}
-		Calendar dt = Calendar.getInstance();
-		dt.setTime(new Date());
-		Calendar calendarStart = Calendar.getInstance();
-		Calendar calendarEnd = Calendar.getInstance();
-		inspectionReportEntity.setRainSeasonKind(0);
-		String rainSeasonText = "";
-		//处理汛期类别
-		LambdaQueryWrapper<EquipmentInspectionPlanEntity> wrapper = Wrappers.<EquipmentInspectionPlanEntity>query().lambda();
-		wrapper.eq(EquipmentInspectionPlanEntity::getIsDeleted, 0);
-		wrapper.orderByDesc(EquipmentInspectionPlanEntity::getCreateTime);
-		List<EquipmentInspectionPlanEntity> list = planService.list(wrapper);
-		if (null != list && list.size() > 0) {
-			EquipmentInspectionPlanEntity entity = list.get(0);
-			//汛前上报
-			calendarStart.setTime(entity.getBeforeRainSeasonStartTime());
-			calendarEnd.setTime(entity.getBeforeRainSeasonEndTime());
-			rainSeasonText += "汛前巡检日期:" + Func.formatDate(calendarStart.getTime()) + "-" + Func.formatDate(calendarEnd.getTime());
-			if ((dt.getTime().getTime() / 1000 == calendarStart.getTime().getTime() / 1000 || dt.after(calendarStart)) && dt.before(calendarEnd)) {
-				inspectionReportEntity.setRainSeasonKind(1);
-			}
-			//汛中第一次上报
-			calendarStart.setTime(entity.getRainSeasonFirstStartTime());
-			calendarEnd.setTime(entity.getRainSeasonFirstEndTime());
-			rainSeasonText += ",汛中(一)巡检日期:" + Func.formatDate(calendarStart.getTime()) + "-" + Func.formatDate(calendarEnd.getTime());
-			if ((dt.getTime().getTime() / 1000 == calendarStart.getTime().getTime() / 1000 || dt.after(calendarStart)) && dt.before(calendarEnd)) {
-				inspectionReportEntity.setRainSeasonKind(2);
-			}
-			//汛中第二次上报
-			calendarStart.setTime(entity.getRainSeasonSecondStartTime());
-			calendarEnd.setTime(entity.getRainSeasonSecondEndTime());
-			rainSeasonText += ",汛中(二)巡检日期:" + Func.formatDate(calendarStart.getTime()) + "-" + Func.formatDate(calendarEnd.getTime());
-			if ((dt.getTime().getTime() / 1000 == calendarStart.getTime().getTime() / 1000 || dt.after(calendarStart)) && dt.before(calendarEnd)) {
-				inspectionReportEntity.setRainSeasonKind(3);
-			}
-		} else {
-			//汛前上报
-			calendarStart.setTime(dt.getTime());
-			calendarStart.set(Calendar.MONTH, 4 - 1);
-			calendarStart.set(Calendar.DAY_OF_MONTH, 1);
-			calendarStart.set(Calendar.HOUR_OF_DAY, 0);
-			calendarStart.set(Calendar.MINUTE, 0);
-			calendarStart.set(Calendar.SECOND, 0);
-			calendarEnd.setTime(dt.getTime());
-			calendarEnd.set(Calendar.MONTH, 6 - 1);
-			calendarEnd.set(Calendar.DAY_OF_MONTH, 1);
-			calendarEnd.set(Calendar.HOUR_OF_DAY, 0);
-			calendarEnd.set(Calendar.MINUTE, 0);
-			calendarEnd.set(Calendar.SECOND, 0);
-			rainSeasonText += "汛前巡检日期:" + Func.formatDate(calendarStart.getTime()) + "-" + Func.formatDate(calendarEnd.getTime());
-			if ((dt.getTime().getTime() / 1000 == calendarStart.getTime().getTime() / 1000 || dt.after(calendarStart)) && dt.before(calendarEnd)) {
-				inspectionReportEntity.setRainSeasonKind(1);
-			}
-			//汛中第一次上报
-			calendarStart.setTime(dt.getTime());
-			calendarStart.set(Calendar.MONTH, 6 - 1);
-			calendarStart.set(Calendar.DAY_OF_MONTH, 1);
-			calendarStart.set(Calendar.HOUR_OF_DAY, 0);
-			calendarStart.set(Calendar.MINUTE, 0);
-			calendarStart.set(Calendar.SECOND, 0);
-			calendarEnd.setTime(dt.getTime());
-			calendarEnd.set(Calendar.MONTH, 8 - 1);
-			calendarEnd.set(Calendar.DAY_OF_MONTH, 15);
-			calendarEnd.set(Calendar.HOUR_OF_DAY, 0);
-			calendarEnd.set(Calendar.MINUTE, 0);
-			calendarEnd.set(Calendar.SECOND, 0);
-			rainSeasonText += ",汛中(一)巡检日期:" + Func.formatDate(calendarStart.getTime()) + "-" + Func.formatDate(calendarEnd.getTime());
-			if ((dt.getTime().getTime() / 1000 == calendarStart.getTime().getTime() / 1000 || dt.after(calendarStart)) && dt.before(calendarEnd)) {
-				inspectionReportEntity.setRainSeasonKind(2);
-			}
-			//汛中第二次上报
-			calendarStart.setTime(dt.getTime());
-			calendarStart.set(Calendar.MONTH, 8 - 1);
-			calendarStart.set(Calendar.DAY_OF_MONTH, 15);
-			calendarStart.set(Calendar.HOUR_OF_DAY, 0);
-			calendarStart.set(Calendar.MINUTE, 0);
-			calendarStart.set(Calendar.SECOND, 0);
-			calendarEnd.setTime(dt.getTime());
-			calendarEnd.set(Calendar.MONTH, 10 - 1);
-			calendarEnd.set(Calendar.DAY_OF_MONTH, 1);
-			calendarEnd.set(Calendar.HOUR_OF_DAY, 0);
-			calendarEnd.set(Calendar.MINUTE, 0);
-			calendarEnd.set(Calendar.SECOND, 0);
-			rainSeasonText += ",汛中(二)巡检日期:" + Func.formatDate(calendarStart.getTime()) + "-" + Func.formatDate(calendarEnd.getTime());
-			if ((dt.getTime().getTime() / 1000 == calendarStart.getTime().getTime() / 1000 || dt.after(calendarStart)) && dt.before(calendarEnd)) {
-				inspectionReportEntity.setRainSeasonKind(3);
-			}
-		}
-		if (inspectionReportEntity.getRainSeasonKind() == 0) {
-			Map<String, Object> d = new HashMap<>();
-			d.put("code", 1);
-			d.put("msg", "当前不在汛期填报期(" + rainSeasonText + "),请确认!");
-			return R.data(d);
-		}
-		//处理遗留问题
-		String remainQuestion = inspectionReportEntity.getRemainQuestion();
-		if (remainQuestion != null && remainQuestion.length() > 0) {
-			inspectionReportEntity.setRemainQuestionState(1);
-		}
-		EquipmentInspectionInfoEntity infoEntity = new EquipmentInspectionInfoEntity();
-		infoEntity.setInspectionDate(new Date());
-		//查找是否有主表记录
-		calendarStart = Calendar.getInstance();
-		calendarStart.setTime(dt.getTime());
-		calendarEnd = Calendar.getInstance();
-		calendarEnd.setTime(dt.getTime());
-		calendarStart.set(Calendar.MONTH, 0);
-		calendarStart.set(Calendar.DAY_OF_MONTH, 1);
-		calendarEnd.add(Calendar.YEAR, 1);
-		calendarEnd.set(Calendar.MONTH, 0);
-		calendarEnd.set(Calendar.DAY_OF_MONTH, 1);
-		LambdaQueryWrapper<EquipmentInspectionInfoEntity> infowrapper = Wrappers.<EquipmentInspectionInfoEntity>query().lambda();
-		infowrapper.eq(EquipmentInspectionInfoEntity::getIsDeleted, 0);
-		infowrapper.eq(EquipmentInspectionInfoEntity::getRtuCode, inspectionReportEntity.getRtuCode());
-		infowrapper.ge(EquipmentInspectionInfoEntity::getInspectionDate, Func.formatDate(calendarStart.getTime()));
-		infowrapper.lt(EquipmentInspectionInfoEntity::getInspectionDate, Func.formatDate(calendarEnd.getTime()));
-		List<EquipmentInspectionInfoEntity> infoEntityList = inspectionService.list(infowrapper);
-		if (null != infoEntityList && infoEntityList.size() == 1) {
-			infoEntity = infoEntityList.get(0);
-		} else {
-			infoEntity.setRtuCode(inspectionReportEntity.getRtuCode());
-		}
-		infoEntity.setInspectionDate(dt.getTime());
-		//写入填报子表,判断当前汛期是否已经填报
-		if (1 == inspectionReportEntity.getRainSeasonKind()) {
-			if (infoEntity.getBeforeRainSeasonStatus() != null && infoEntity.getBeforeRainSeasonStatus() == 1) {
-				Map<String, Object> d = new HashMap<>();
-				d.put("code", 1);
-				d.put("msg", "汛前巡检已填报,请勿重复上报!");
-				return R.data(d);
-			}
-		} else if (2 == inspectionReportEntity.getRainSeasonKind()) {
-			if (infoEntity.getRainSeasonFirstStatus() != null && infoEntity.getRainSeasonFirstStatus() == 1) {
-				Map<String, Object> d = new HashMap<>();
-				d.put("code", 1);
-				d.put("msg", "汛中(一)巡检已填报,请勿重复上报!");
-				return R.data(d);
-			}
-		} else if (3 == inspectionReportEntity.getRainSeasonKind()) {
-			if (infoEntity.getRainSeasonSecondStatus() != null && infoEntity.getRainSeasonSecondStatus() == 1) {
-				Map<String, Object> d = new HashMap<>();
-				d.put("code", 1);
-				d.put("msg", "汛中(二)巡检已填报,请勿重复上报!");
-				return R.data(d);
-			}
-		}
-		reportService.save(inspectionReportEntity);
-		if (1 == inspectionReportEntity.getRainSeasonKind()) {
-			infoEntity.setBeforeRainSeasonReportId(inspectionReportEntity.getId());
-			infoEntity.setBeforeRainSeasonStatus(1);
-			infoEntity.setBeforeRainSeasonReportTime(infoEntity.getInspectionDate());
-			infoEntity.setBeforeRainSeasonReportUser(user.getUserId());
-		} else if (2 == inspectionReportEntity.getRainSeasonKind()) {
-			infoEntity.setRainSeasonFirstReportId(inspectionReportEntity.getId());
-			infoEntity.setRainSeasonFirstStatus(1);
-			infoEntity.setRainSeasonFirstReportTime(infoEntity.getInspectionDate());
-			infoEntity.setRainSeasonFirstReportUser(user.getUserId());
-		} else if (3 == inspectionReportEntity.getRainSeasonKind()) {
-			infoEntity.setRainSeasonSecondReportId(inspectionReportEntity.getId());
-			infoEntity.setRainSeasonSecondStatus(1);
-			infoEntity.setRainSeasonSecondReportTime(infoEntity.getInspectionDate());
-			infoEntity.setRainSeasonSecondReportUser(user.getUserId());
-		}
-		inspectionService.saveOrUpdate(infoEntity);
+    /**
+     * 新增
+     */
+    @PostMapping("/save")
+    @ApiOperationSupport(order = 4)
+    @ApiOperation(value = "新增", notes = "传入实体类EquipmentInspectionReportEntity ")
+    public R save(@RequestBody EquipmentInspectionReportEntity inspectionReportEntity) {
+        BladeUser user = AuthUtil.getUser();
+        if (inspectionReportEntity.getNetworkSignalStatus() == 0) {
+            if (null == inspectionReportEntity.getInspectionWorkPhotos() || inspectionReportEntity.getInspectionWorkPhotos().length() == 0) {
+                return R.fail("现场信号正常时,至少需要拍摄一张工作留存照片!");
+            }
+        }
+        Calendar dt = Calendar.getInstance();
+        dt.setTime(new Date());
+        Calendar calendarStart = Calendar.getInstance();
+        Calendar calendarEnd = Calendar.getInstance();
+        inspectionReportEntity.setRainSeasonKind(0);
+        String rainSeasonText = "";
+        //处理汛期类别
+        LambdaQueryWrapper<EquipmentInspectionPlanEntity> wrapper = Wrappers.<EquipmentInspectionPlanEntity>query().lambda();
+        wrapper.eq(EquipmentInspectionPlanEntity::getIsDeleted, 0);
+        wrapper.orderByDesc(EquipmentInspectionPlanEntity::getCreateTime);
+        List<EquipmentInspectionPlanEntity> list = planService.list(wrapper);
+        if (null != list && list.size() > 0) {
+            EquipmentInspectionPlanEntity entity = list.get(0);
+            //汛前上报
+            calendarStart.setTime(entity.getBeforeRainSeasonStartTime());
+            calendarEnd.setTime(entity.getBeforeRainSeasonEndTime());
+            rainSeasonText += "汛前巡检日期:" + Func.formatDate(calendarStart.getTime()) + "-" + Func.formatDate(calendarEnd.getTime());
+            if ((dt.getTime().getTime() / 1000 == calendarStart.getTime().getTime() / 1000 || dt.after(calendarStart)) && dt.before(calendarEnd)) {
+                inspectionReportEntity.setRainSeasonKind(1);
+            }
+            //汛中第一次上报
+            calendarStart.setTime(entity.getRainSeasonFirstStartTime());
+            calendarEnd.setTime(entity.getRainSeasonFirstEndTime());
+            rainSeasonText += ",汛中(一)巡检日期:" + Func.formatDate(calendarStart.getTime()) + "-" + Func.formatDate(calendarEnd.getTime());
+            if ((dt.getTime().getTime() / 1000 == calendarStart.getTime().getTime() / 1000 || dt.after(calendarStart)) && dt.before(calendarEnd)) {
+                inspectionReportEntity.setRainSeasonKind(2);
+            }
+            //汛中第二次上报
+            calendarStart.setTime(entity.getRainSeasonSecondStartTime());
+            calendarEnd.setTime(entity.getRainSeasonSecondEndTime());
+            rainSeasonText += ",汛中(二)巡检日期:" + Func.formatDate(calendarStart.getTime()) + "-" + Func.formatDate(calendarEnd.getTime());
+            if ((dt.getTime().getTime() / 1000 == calendarStart.getTime().getTime() / 1000 || dt.after(calendarStart)) && dt.before(calendarEnd)) {
+                inspectionReportEntity.setRainSeasonKind(3);
+            }
+        } else {
+            //汛前上报
+            calendarStart.setTime(dt.getTime());
+            calendarStart.set(Calendar.MONTH, 4 - 1);
+            calendarStart.set(Calendar.DAY_OF_MONTH, 1);
+            calendarStart.set(Calendar.HOUR_OF_DAY, 0);
+            calendarStart.set(Calendar.MINUTE, 0);
+            calendarStart.set(Calendar.SECOND, 0);
+            calendarEnd.setTime(dt.getTime());
+            calendarEnd.set(Calendar.MONTH, 6 - 1);
+            calendarEnd.set(Calendar.DAY_OF_MONTH, 1);
+            calendarEnd.set(Calendar.HOUR_OF_DAY, 0);
+            calendarEnd.set(Calendar.MINUTE, 0);
+            calendarEnd.set(Calendar.SECOND, 0);
+            rainSeasonText += "汛前巡检日期:" + Func.formatDate(calendarStart.getTime()) + "-" + Func.formatDate(calendarEnd.getTime());
+            if ((dt.getTime().getTime() / 1000 == calendarStart.getTime().getTime() / 1000 || dt.after(calendarStart)) && dt.before(calendarEnd)) {
+                inspectionReportEntity.setRainSeasonKind(1);
+            }
+            //汛中第一次上报
+            calendarStart.setTime(dt.getTime());
+            calendarStart.set(Calendar.MONTH, 6 - 1);
+            calendarStart.set(Calendar.DAY_OF_MONTH, 1);
+            calendarStart.set(Calendar.HOUR_OF_DAY, 0);
+            calendarStart.set(Calendar.MINUTE, 0);
+            calendarStart.set(Calendar.SECOND, 0);
+            calendarEnd.setTime(dt.getTime());
+            calendarEnd.set(Calendar.MONTH, 8 - 1);
+            calendarEnd.set(Calendar.DAY_OF_MONTH, 15);
+            calendarEnd.set(Calendar.HOUR_OF_DAY, 0);
+            calendarEnd.set(Calendar.MINUTE, 0);
+            calendarEnd.set(Calendar.SECOND, 0);
+            rainSeasonText += ",汛中(一)巡检日期:" + Func.formatDate(calendarStart.getTime()) + "-" + Func.formatDate(calendarEnd.getTime());
+            if ((dt.getTime().getTime() / 1000 == calendarStart.getTime().getTime() / 1000 || dt.after(calendarStart)) && dt.before(calendarEnd)) {
+                inspectionReportEntity.setRainSeasonKind(2);
+            }
+            //汛中第二次上报
+            calendarStart.setTime(dt.getTime());
+            calendarStart.set(Calendar.MONTH, 8 - 1);
+            calendarStart.set(Calendar.DAY_OF_MONTH, 15);
+            calendarStart.set(Calendar.HOUR_OF_DAY, 0);
+            calendarStart.set(Calendar.MINUTE, 0);
+            calendarStart.set(Calendar.SECOND, 0);
+            calendarEnd.setTime(dt.getTime());
+            calendarEnd.set(Calendar.MONTH, 10 - 1);
+            calendarEnd.set(Calendar.DAY_OF_MONTH, 1);
+            calendarEnd.set(Calendar.HOUR_OF_DAY, 0);
+            calendarEnd.set(Calendar.MINUTE, 0);
+            calendarEnd.set(Calendar.SECOND, 0);
+            rainSeasonText += ",汛中(二)巡检日期:" + Func.formatDate(calendarStart.getTime()) + "-" + Func.formatDate(calendarEnd.getTime());
+            if ((dt.getTime().getTime() / 1000 == calendarStart.getTime().getTime() / 1000 || dt.after(calendarStart)) && dt.before(calendarEnd)) {
+                inspectionReportEntity.setRainSeasonKind(3);
+            }
+        }
+        if (inspectionReportEntity.getRainSeasonKind() == 0) {
+            Map<String, Object> d = new HashMap<>();
+            d.put("code", 1);
+            d.put("msg", "当前不在汛期填报期(" + rainSeasonText + "),请确认!");
+            return R.data(d);
+        }
+        //处理遗留问题
+        String remainQuestion = inspectionReportEntity.getRemainQuestion();
+        if (remainQuestion != null && remainQuestion.length() > 0) {
+            inspectionReportEntity.setRemainQuestionState(1);
+        }
+        EquipmentInspectionInfoEntity infoEntity = new EquipmentInspectionInfoEntity();
+        infoEntity.setInspectionDate(new Date());
+        //查找是否有主表记录
+        calendarStart = Calendar.getInstance();
+        calendarStart.setTime(dt.getTime());
+        calendarEnd = Calendar.getInstance();
+        calendarEnd.setTime(dt.getTime());
+        calendarStart.set(Calendar.MONTH, 0);
+        calendarStart.set(Calendar.DAY_OF_MONTH, 1);
+        calendarEnd.add(Calendar.YEAR, 1);
+        calendarEnd.set(Calendar.MONTH, 0);
+        calendarEnd.set(Calendar.DAY_OF_MONTH, 1);
+        LambdaQueryWrapper<EquipmentInspectionInfoEntity> infowrapper = Wrappers.<EquipmentInspectionInfoEntity>query().lambda();
+        infowrapper.eq(EquipmentInspectionInfoEntity::getIsDeleted, 0);
+        infowrapper.eq(EquipmentInspectionInfoEntity::getRtuCode, inspectionReportEntity.getRtuCode());
+        infowrapper.ge(EquipmentInspectionInfoEntity::getInspectionDate, Func.formatDate(calendarStart.getTime()));
+        infowrapper.lt(EquipmentInspectionInfoEntity::getInspectionDate, Func.formatDate(calendarEnd.getTime()));
+        List<EquipmentInspectionInfoEntity> infoEntityList = inspectionService.list(infowrapper);
+        if (null != infoEntityList && infoEntityList.size() == 1) {
+            infoEntity = infoEntityList.get(0);
+        } else {
+            infoEntity.setRtuCode(inspectionReportEntity.getRtuCode());
+        }
+        infoEntity.setInspectionDate(dt.getTime());
+        //写入填报子表,判断当前汛期是否已经填报
+        if (1 == inspectionReportEntity.getRainSeasonKind()) {
+            if (infoEntity.getBeforeRainSeasonStatus() != null && infoEntity.getBeforeRainSeasonStatus() == 1) {
+                Map<String, Object> d = new HashMap<>();
+                d.put("code", 1);
+                d.put("msg", "汛前巡检已填报,请勿重复上报!");
+                return R.data(d);
+            }
+        } else if (2 == inspectionReportEntity.getRainSeasonKind()) {
+            if (infoEntity.getRainSeasonFirstStatus() != null && infoEntity.getRainSeasonFirstStatus() == 1) {
+                Map<String, Object> d = new HashMap<>();
+                d.put("code", 1);
+                d.put("msg", "汛中(一)巡检已填报,请勿重复上报!");
+                return R.data(d);
+            }
+        } else if (3 == inspectionReportEntity.getRainSeasonKind()) {
+            if (infoEntity.getRainSeasonSecondStatus() != null && infoEntity.getRainSeasonSecondStatus() == 1) {
+                Map<String, Object> d = new HashMap<>();
+                d.put("code", 1);
+                d.put("msg", "汛中(二)巡检已填报,请勿重复上报!");
+                return R.data(d);
+            }
+        }
+        reportService.save(inspectionReportEntity);
+        if (1 == inspectionReportEntity.getRainSeasonKind()) {
+            infoEntity.setBeforeRainSeasonReportId(inspectionReportEntity.getId());
+            infoEntity.setBeforeRainSeasonStatus(1);
+            infoEntity.setBeforeRainSeasonReportTime(infoEntity.getInspectionDate());
+            infoEntity.setBeforeRainSeasonReportUser(user.getUserId());
+        } else if (2 == inspectionReportEntity.getRainSeasonKind()) {
+            infoEntity.setRainSeasonFirstReportId(inspectionReportEntity.getId());
+            infoEntity.setRainSeasonFirstStatus(1);
+            infoEntity.setRainSeasonFirstReportTime(infoEntity.getInspectionDate());
+            infoEntity.setRainSeasonFirstReportUser(user.getUserId());
+        } else if (3 == inspectionReportEntity.getRainSeasonKind()) {
+            infoEntity.setRainSeasonSecondReportId(inspectionReportEntity.getId());
+            infoEntity.setRainSeasonSecondStatus(1);
+            infoEntity.setRainSeasonSecondReportTime(infoEntity.getInspectionDate());
+            infoEntity.setRainSeasonSecondReportUser(user.getUserId());
+        }
+        inspectionService.saveOrUpdate(infoEntity);
 
-		EquipmentInspectionReportEntity reportEntity = reportService.getById(inspectionReportEntity.getId());
-		reportEntity.setInspectionId(infoEntity.getId());
-		reportService.updateById(reportEntity);
+        EquipmentInspectionReportEntity reportEntity = reportService.getById(inspectionReportEntity.getId());
+        reportEntity.setInspectionId(infoEntity.getId());
+        reportService.updateById(reportEntity);
 
-		//更新更换信息
-		LambdaQueryWrapper<RtuInfoEntity> rtuWrapper = Wrappers.<RtuInfoEntity>query().lambda();
-		rtuWrapper.eq(RtuInfoEntity::getIsDeleted, 0);
-		rtuWrapper.eq(RtuInfoEntity::getRtuCode, infoEntity.getRtuCode());
-		RtuInfoEntity rtuInfoEntity = rtuBaseInfoService.getOne(rtuWrapper);
-		if (inspectionReportEntity.getRtuReplace() != null && inspectionReportEntity.getRtuReplace() == 1) {
-			rtuInfoEntity.setRtuReplaceDate(inspectionReportEntity.getCreateTime());
-			rtuInfoEntity.setRtuModel(inspectionReportEntity.getRtuModelRemark());
-		}
-		if (inspectionReportEntity.getRainSensorReplace() != null && inspectionReportEntity.getRainSensorReplace() == 1) {
-			rtuInfoEntity.setRainSensorReplaceDate(inspectionReportEntity.getCreateTime());
-			rtuInfoEntity.setRainSensorModel(inspectionReportEntity.getRainSensorModelRemark());
-		}
-		if (inspectionReportEntity.getWaterSensorReplace() != null && inspectionReportEntity.getWaterSensorReplace() == 1) {
-			rtuInfoEntity.setWaterSensorReplaceDate(inspectionReportEntity.getCreateTime());
-			rtuInfoEntity.setWaterSensorModel(inspectionReportEntity.getWaterSensorModelRemark());
-		}
-		if (inspectionReportEntity.getGroundSensorReplace() != null && inspectionReportEntity.getGroundSensorReplace() == 1) {
-			rtuInfoEntity.setGroundSensorReplaceDate(inspectionReportEntity.getCreateTime());
-			rtuInfoEntity.setGroundSensorModel(inspectionReportEntity.getGroundSensorModelRemark());
-		}
-		if (inspectionReportEntity.getBatteryReplace() != null && inspectionReportEntity.getBatteryReplace() == 1) {
-			rtuInfoEntity.setBatteryReplaceDate(inspectionReportEntity.getCreateTime());
-			rtuInfoEntity.setBatteryModel(inspectionReportEntity.getBatteryModelRemark());
-		}
+        //更新更换信息
+        LambdaQueryWrapper<RtuInfoEntity> rtuWrapper = Wrappers.<RtuInfoEntity>query().lambda();
+        rtuWrapper.eq(RtuInfoEntity::getIsDeleted, 0);
+        rtuWrapper.eq(RtuInfoEntity::getRtuCode, infoEntity.getRtuCode());
+        RtuInfoEntity rtuInfoEntity = rtuBaseInfoService.getOne(rtuWrapper);
+        if (inspectionReportEntity.getRtuReplace() != null && inspectionReportEntity.getRtuReplace() == 1) {
+            rtuInfoEntity.setRtuReplaceDate(inspectionReportEntity.getCreateTime());
+            rtuInfoEntity.setRtuModel(inspectionReportEntity.getRtuModelRemark());
+        }
+        if (inspectionReportEntity.getRainSensorReplace() != null && inspectionReportEntity.getRainSensorReplace() == 1) {
+            rtuInfoEntity.setRainSensorReplaceDate(inspectionReportEntity.getCreateTime());
+            rtuInfoEntity.setRainSensorModel(inspectionReportEntity.getRainSensorModelRemark());
+        }
+        if (inspectionReportEntity.getWaterSensorReplace() != null && inspectionReportEntity.getWaterSensorReplace() == 1) {
+            rtuInfoEntity.setWaterSensorReplaceDate(inspectionReportEntity.getCreateTime());
+            rtuInfoEntity.setWaterSensorModel(inspectionReportEntity.getWaterSensorModelRemark());
+        }
+        if (inspectionReportEntity.getGroundSensorReplace() != null && inspectionReportEntity.getGroundSensorReplace() == 1) {
+            rtuInfoEntity.setGroundSensorReplaceDate(inspectionReportEntity.getCreateTime());
+            rtuInfoEntity.setGroundSensorModel(inspectionReportEntity.getGroundSensorModelRemark());
+        }
+        if (inspectionReportEntity.getBatteryReplace() != null && inspectionReportEntity.getBatteryReplace() == 1) {
+            rtuInfoEntity.setBatteryReplaceDate(inspectionReportEntity.getCreateTime());
+            rtuInfoEntity.setBatteryModel(inspectionReportEntity.getBatteryModelRemark());
+        }
 
-		rtuInfoEntity.setNetworkSimId(inspectionReportEntity.getNetworkSimId());
-		rtuInfoEntity.setNetworkPayer(inspectionReportEntity.getNetworkPayer());
+        rtuInfoEntity.setNetworkSimId(inspectionReportEntity.getNetworkSimId());
+        rtuInfoEntity.setNetworkPayer(inspectionReportEntity.getNetworkPayer());
 
-		rtuBaseInfoService.updateById(rtuInfoEntity);
-		Map<String, Object> d = new HashMap<>();
-		d.put("code", 0);
-		return R.data(d);
+        rtuBaseInfoService.updateById(rtuInfoEntity);
+        Map<String, Object> d = new HashMap<>();
+        d.put("code", 0);
+        return R.data(d);
 
-	}
+    }
 
-	/**
-	 * 修改
-	 */
-	@PostMapping("/update")
-	@ApiOperationSupport(order = 5)
-	@ApiOperation(value = "修改", notes = "传入reportEntity")
-	public R update(@RequestBody EquipmentInspectionReportEntity reportEntity) {
-		//处理遗留问题
-		String remainQuestion = reportEntity.getRemainQuestion();
-		if (remainQuestion != null && remainQuestion.length() > 0) {
-			reportEntity.setRemainQuestionState(1);
-		}
-		return R.status(reportService.updateById(reportEntity));
-	}
+    /**
+     * 修改
+     */
+    @PostMapping("/update")
+    @ApiOperationSupport(order = 5)
+    @ApiOperation(value = "修改", notes = "传入reportEntity")
+    public R update(@RequestBody EquipmentInspectionReportEntity reportEntity) {
+        //处理遗留问题
+        String remainQuestion = reportEntity.getRemainQuestion();
+        if (remainQuestion != null && remainQuestion.length() > 0) {
+            reportEntity.setRemainQuestionState(1);
+        }
+        return R.status(reportService.updateById(reportEntity));
+    }
 
-	/**
-	 * 修改
-	 */
-	@PostMapping("/nonetworksignal/photo/update")
-	@ApiOperationSupport(order = 5)
-	@ApiOperation(value = "修改", notes = "传入orderProcessInfoEntity")
-	public R nonetworksignalPhotoUpdate(@RequestBody EquipmentInspectionReportEntity reportEntity) {
-		EquipmentInspectionReportEntity entity = reportService.getById(reportEntity.getId());
-		entity.setSiteCheckPhotos(reportEntity.getSiteCheckPhotos());
-		entity.setRainSiteCheckPhotos(reportEntity.getRainSiteCheckPhotos());
-		entity.setWaterSiteCheckPhotos(reportEntity.getWaterSiteCheckPhotos());
-		entity.setGroundSiteCheckPhotos(reportEntity.getGroundSiteCheckPhotos());
-		entity.setOtherEquipmentCheckPhotos(reportEntity.getOtherEquipmentCheckPhotos());
-		entity.setRtuReplacePhotos(reportEntity.getRtuReplacePhotos());
-		entity.setRainSensorReplacePhotos(reportEntity.getRainSensorReplacePhotos());
-		entity.setWaterSensorReplacePhotos(reportEntity.getWaterSensorReplacePhotos());
-		entity.setGroundSensorReplacePhotos(reportEntity.getGroundSensorReplacePhotos());
-		entity.setBatteryReplacePhotos(reportEntity.getBatteryReplacePhotos());
-		entity.setBatteryControllerReplacePhotos(reportEntity.getBatteryControllerReplacePhotos());
-		entity.setOtherEquipmentReplacePhotos(reportEntity.getOtherEquipmentReplacePhotos());
-		entity.setSunPowerReplacePhotos(reportEntity.getSunPowerReplacePhotos());
-		entity.setInspectionWorkPhotos(reportEntity.getInspectionWorkPhotos());
-		return R.status(reportService.updateById(entity));
-	}
+    /**
+     * 修改
+     */
+    @PostMapping("/nonetworksignal/photo/update")
+    @ApiOperationSupport(order = 5)
+    @ApiOperation(value = "修改", notes = "传入orderProcessInfoEntity")
+    public R nonetworksignalPhotoUpdate(@RequestBody EquipmentInspectionReportEntity reportEntity) {
+        EquipmentInspectionReportEntity entity = reportService.getById(reportEntity.getId());
+        entity.setSiteCheckPhotos(reportEntity.getSiteCheckPhotos());
+        entity.setRainSiteCheckPhotos(reportEntity.getRainSiteCheckPhotos());
+        entity.setWaterSiteCheckPhotos(reportEntity.getWaterSiteCheckPhotos());
+        entity.setGroundSiteCheckPhotos(reportEntity.getGroundSiteCheckPhotos());
+        entity.setOtherEquipmentCheckPhotos(reportEntity.getOtherEquipmentCheckPhotos());
+        entity.setRtuReplacePhotos(reportEntity.getRtuReplacePhotos());
+        entity.setRainSensorReplacePhotos(reportEntity.getRainSensorReplacePhotos());
+        entity.setWaterSensorReplacePhotos(reportEntity.getWaterSensorReplacePhotos());
+        entity.setGroundSensorReplacePhotos(reportEntity.getGroundSensorReplacePhotos());
+        entity.setBatteryReplacePhotos(reportEntity.getBatteryReplacePhotos());
+        entity.setBatteryControllerReplacePhotos(reportEntity.getBatteryControllerReplacePhotos());
+        entity.setOtherEquipmentReplacePhotos(reportEntity.getOtherEquipmentReplacePhotos());
+        entity.setSunPowerReplacePhotos(reportEntity.getSunPowerReplacePhotos());
+        entity.setInspectionWorkPhotos(reportEntity.getInspectionWorkPhotos());
+        return R.status(reportService.updateById(entity));
+    }
 
-	/**
-	 * 删除
-	 */
-	@PostMapping("/remove")
-	@ApiOperationSupport(order = 7)
-	@ApiOperation(value = "逻辑删除", notes = "传入ids")
-	public R remove(@ApiParam(value = "主键集合") @RequestParam String ids) {
-		boolean temp = reportService.deleteLogic(Func.toLongList(ids));
-		return R.status(temp);
-	}
+    /**
+     * 删除
+     */
+    @PostMapping("/remove")
+    @ApiOperationSupport(order = 7)
+    @ApiOperation(value = "逻辑删除", notes = "传入ids")
+    public R remove(@ApiParam(value = "主键集合") @RequestParam String ids) {
+        boolean temp = reportService.deleteLogic(Func.toLongList(ids));
+        return R.status(temp);
+    }
 
-	/**
-	 * 查询当天的巡检填报信息
-	 */
-	@GetMapping("/today/list")
-	@ApiOperationSupport(order = 2)
-	@ApiOperation(value = "查询")
-	public R<List<EquipmentInspectionReportVO>> todayList(@ApiIgnore EquipmentInspectionReportDTO inspectionReportDTO) {
-		BladeUser user = AuthUtil.getUser();
-		int excludecode = 0;
-		if (BusinessConstant.ROLE_SYS_ADMIN.equals(user.getRoleName())) {
-			inspectionReportDTO.setAdCode(BusinessConstant.REGION_NM_ADCODE);
-		} else if (BusinessConstant.ROLE_ORG_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_SERVICE_PERSON.equals(user.getRoleName())) {
-//			LambdaQueryWrapper<DeptRegionEntity> deptRegionEntityLambdaQueryWrapper = Wrappers.<DeptRegionEntity>query().lambda();
-//			deptRegionEntityLambdaQueryWrapper.eq(DeptRegionEntity::getIsDeleted, 0);
-//			deptRegionEntityLambdaQueryWrapper.eq(DeptRegionEntity::getDeptId, Func.toLong(user.getDeptId()));
-//			DeptRegionEntity deptRegionEntity = deptRegionService.getOne(deptRegionEntityLambdaQueryWrapper);
+    /**
+     * 查询当天的巡检填报信息
+     */
+    @GetMapping("/today/list")
+    @ApiOperationSupport(order = 2)
+    @ApiOperation(value = "查询")
+    public R<List<EquipmentInspectionReportVO>> todayList(@ApiIgnore EquipmentInspectionReportDTO inspectionReportDTO) {
+        BladeUser user = AuthUtil.getUser();
+        int excludecode = 0;
+        if (BusinessConstant.ROLE_SYS_ADMIN.equals(user.getRoleName())) {
+            inspectionReportDTO.setAdCode(BusinessConstant.REGION_NM_ADCODE);
+        } else if (BusinessConstant.ROLE_ORG_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_SERVICE_PERSON.equals(user.getRoleName())) {
+            DeptRegionEntity deptRegionEntity = deptRegionService.getRegionByDeptId(Func.toLong(user.getDeptId()));
+            if (Func.notNull(deptRegionEntity)) {
+                inspectionReportDTO.setAdCode(deptRegionEntity.getAdcd());
+                LambdaQueryWrapper<RegionInfoEntity> nodeQueryWrapper = Wrappers.<RegionInfoEntity>query().lambda();
+                nodeQueryWrapper.eq(RegionInfoEntity::getAdcd, deptRegionEntity.getAdcd());
+                RegionInfoEntity nodeRegion = this.regionService.getOne(nodeQueryWrapper);
+                if (nodeRegion.getParentCode().equals(BusinessConstant.REGION_NM_ADCODE)) {
+                    excludecode = 1;
+                }
+            }
+        } else if (BusinessConstant.ROLE_QI_ADMIN.equals(user.getRoleName())) {
+            DeptRegionEntity deptRegionEntity = deptRegionService.getRegionByDeptId(Func.toLong(user.getDeptId()));
+            if (Func.notNull(deptRegionEntity)) {
+                inspectionReportDTO.setAdCode(deptRegionEntity.getAdcd());
+            }
+        }
+        inspectionReportDTO.setExcludeCode(excludecode);
+        Date date = new Date();
+        String dt = Func.formatDateTime(date);
+        inspectionReportDTO.setCreateTime(Func.parse(dt, ConcurrentDateFormat.of("yyyy-MM-dd")));
+        List<EquipmentInspectionReportVO> list = reportService.selectTodayReportList(inspectionReportDTO);
+        for (EquipmentInspectionReportVO vo : list) {
+            EquipmentInspectionReportWrapper.build().entityVO(vo);
+        }
+        return R.data(list);
+    }
 
-			DeptRegionEntity deptRegionEntity = deptRegionService.getRegionByDeptId(Func.toLong(user.getDeptId()));
-			if (null == deptRegionEntity) {
-				return R.data(null);
-			}
-			inspectionReportDTO.setAdCode(deptRegionEntity.getAdcd());
+    /**
+     * 查询当天的巡检填报信息
+     */
+    @GetMapping("/today/page")
+    @ApiOperationSupport(order = 2)
+    @ApiOperation(value = "查询")
+    public R<IPage<EquipmentInspectionReportVO>> todayPage(@ApiIgnore EquipmentInspectionReportDTO inspectionReportDTO, Query query) {
+        BladeUser user = AuthUtil.getUser();
+        if (BusinessConstant.ROLE_SYS_ADMIN.equals(user.getRoleName())) {
+            inspectionReportDTO.setAdCode(BusinessConstant.REGION_NM_ADCODE);
+        } else if (BusinessConstant.ROLE_ORG_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_SERVICE_PERSON.equals(user.getRoleName())) {
+            LambdaQueryWrapper<DeptRegionEntity> deptRegionEntityLambdaQueryWrapper = Wrappers.<DeptRegionEntity>query().lambda();
+            deptRegionEntityLambdaQueryWrapper.eq(DeptRegionEntity::getDeptId, Func.toLong(user.getDeptId()));
+            DeptRegionEntity deptRegionEntity = deptRegionService.getOne(deptRegionEntityLambdaQueryWrapper);
+            inspectionReportDTO.setAdCode(deptRegionEntity.getAdcd());
+        } else if (BusinessConstant.ROLE_QI_ADMIN.equals(user.getRoleName())) {
+            LambdaQueryWrapper<DeptRegionEntity> deptRegionEntityLambdaQueryWrapper = Wrappers.<DeptRegionEntity>query().lambda();
+            deptRegionEntityLambdaQueryWrapper.eq(DeptRegionEntity::getDeptId, Func.toLong(user.getDeptId()));
+            DeptRegionEntity deptRegionEntity = deptRegionService.getOne(deptRegionEntityLambdaQueryWrapper);
+            inspectionReportDTO.setAdCode(deptRegionEntity.getAdcd());
+        }
 
-			LambdaQueryWrapper<RegionInfoEntity> nodeQueryWrapper = Wrappers.<RegionInfoEntity>query().lambda();
-			nodeQueryWrapper.eq(RegionInfoEntity::getAdcd, deptRegionEntity.getAdcd());
-			RegionInfoEntity nodeRegion = this.regionService.getOne(nodeQueryWrapper);
+        Date date = new Date();
+        String dt = Func.formatDateTime(date);
+        inspectionReportDTO.setCreateTime(Func.parse(dt, ConcurrentDateFormat.of("yyyy-MM-dd")));
+        IPage<EquipmentInspectionReportVO> page = reportService.selectTodayReportPage(Condition.getPage(query), inspectionReportDTO);
 
-			if (nodeRegion.getParentCode().equals(BusinessConstant.REGION_NM_ADCODE)) {
-				excludecode = 1;
-			}
-		}
+        List<EquipmentInspectionReportVO> list = page.getRecords();
+        for (EquipmentInspectionReportVO vo : list) {
+            EquipmentInspectionReportWrapper.build().entityVO(vo);
+        }
+        return R.data(page);
+    }
 
-//		if (inspectionReportDTO.getAdCode() != null) {
-//			DeptRegionEntity deptRegionEntity = deptRegionService.getRegionByDeptId(Func.toLong(user.getDeptId()));
-//
-//			LambdaQueryWrapper<RegionInfoEntity> nodeQueryWrapper = Wrappers.<RegionInfoEntity>query().lambda();
-//			nodeQueryWrapper.eq(RegionInfoEntity::getAdcd, deptRegionEntity.getAdcd());
-//			RegionInfoEntity nodeRegion = this.regionService.getOne(nodeQueryWrapper);
-//			int excludecode = 0;
-//			if (nodeRegion.getParentCode().equals(BusinessConstant.REGION_NM_ADCODE)) {
-//				excludecode = 1;
-//			}
-//
-//			RegionTreeNodeEntity nodeEntity = this.regionService.getRegionNode(user.getRoleName(), user.getDeptId(), inspectionReportDTO.getAdCode());
-//			inspectionReportDTO.setExcludeCode(excludecode);
-//		}
-		inspectionReportDTO.setExcludeCode(excludecode);
-		Date date = new Date();
-		String dt = Func.formatDateTime(date);
-		inspectionReportDTO.setCreateTime(Func.parse(dt, ConcurrentDateFormat.of("yyyy-MM-dd")));
-		List<EquipmentInspectionReportVO> list = reportService.selectTodayReportList(inspectionReportDTO);
-		for (EquipmentInspectionReportVO vo : list) {
-			EquipmentInspectionReportWrapper.build().entityVO(vo);
-		}
-		return R.data(list);
-	}
 
-	/**
-	 * 查询当天的巡检填报信息
-	 */
-	@GetMapping("/today/page")
-	@ApiOperationSupport(order = 2)
-	@ApiOperation(value = "查询")
-	public R<IPage<EquipmentInspectionReportVO>> todayPage(@ApiIgnore EquipmentInspectionReportDTO inspectionReportDTO, Query query) {
-		BladeUser user = AuthUtil.getUser();
-		if (BusinessConstant.ROLE_SYS_ADMIN.equals(user.getRoleName())) {
-			inspectionReportDTO.setAdCode(BusinessConstant.REGION_NM_ADCODE);
-		} else if (BusinessConstant.ROLE_ORG_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_SERVICE_PERSON.equals(user.getRoleName())) {
-			LambdaQueryWrapper<DeptRegionEntity> deptRegionEntityLambdaQueryWrapper = Wrappers.<DeptRegionEntity>query().lambda();
-			deptRegionEntityLambdaQueryWrapper.eq(DeptRegionEntity::getIsDeleted, 0);
-			deptRegionEntityLambdaQueryWrapper.eq(DeptRegionEntity::getDeptId, Func.toLong(user.getDeptId()));
-			DeptRegionEntity deptRegionEntity = deptRegionService.getOne(deptRegionEntityLambdaQueryWrapper);
-			inspectionReportDTO.setAdCode(deptRegionEntity.getAdcd());
-		}
+    @GetMapping("/count")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "adCode", value = "行政区划编码", paramType = "query", dataType = "string"),
+            @ApiImplicitParam(name = "inspectionYear", value = "巡检年度", paramType = "query", dataType = "string"),
+            @ApiImplicitParam(name = "rainSeasonKind", value = "汛期类型", paramType = "query", dataType = "int"),
+    })
+    @ApiOperationSupport(order = 2)
+    @ApiOperation(value = "已巡检上报设备数量")
+    public R<Map<String, Object>> inspectionReportCount(@ApiIgnore EquipmentInspectionReportDTO inspectionReportDTO) {
+        if (inspectionReportDTO.getAdCode() == null) {
+            return R.status(false);
+        }
+        BladeUser user = AuthUtil.getUser();
+        if (BusinessConstant.ROLE_SYS_ADMIN.equals(user.getRoleName())) {
+            if (Func.isNull(inspectionReportDTO.getAdCode())) {
+                inspectionReportDTO.setAdCode(BusinessConstant.REGION_NM_ADCODE);
+            }
+        } else if (BusinessConstant.ROLE_ORG_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_SERVICE_PERSON.equals(user.getRoleName())) {
+            if (Func.isNull(inspectionReportDTO.getAdCode())) {
+                LambdaQueryWrapper<DeptRegionEntity> deptRegionEntityLambdaQueryWrapper = Wrappers.<DeptRegionEntity>query().lambda();
+                deptRegionEntityLambdaQueryWrapper.eq(DeptRegionEntity::getDeptId, Func.toLong(user.getDeptId()));
+                DeptRegionEntity deptRegionEntity = deptRegionService.getOne(deptRegionEntityLambdaQueryWrapper);
+                inspectionReportDTO.setAdCode(deptRegionEntity.getAdcd());
+            }
+        } else if (BusinessConstant.ROLE_QI_ADMIN.equals(user.getRoleName())) {
+            if (Func.isNull(inspectionReportDTO.getAdCode())) {
+                LambdaQueryWrapper<DeptRegionEntity> deptRegionEntityLambdaQueryWrapper = Wrappers.<DeptRegionEntity>query().lambda();
+                deptRegionEntityLambdaQueryWrapper.eq(DeptRegionEntity::getDeptId, Func.toLong(user.getDeptId()));
+                DeptRegionEntity deptRegionEntity = deptRegionService.getOne(deptRegionEntityLambdaQueryWrapper);
+                inspectionReportDTO.setAdCode(deptRegionEntity.getAdcd());
+            }
+        }
+        if (inspectionReportDTO.getInspectionYear() != null) {
+            Date year = Func.parseDate(inspectionReportDTO.getInspectionYear(), "yyyy-MM-dd");
+            Calendar calendar = Calendar.getInstance();
+            calendar.setTime(year);
+            calendar.set(Calendar.MONTH, 0);
+            calendar.set(Calendar.DAY_OF_MONTH, 1);
+            calendar.set(Calendar.HOUR_OF_DAY, 0);
+            calendar.set(Calendar.MINUTE, 0);
+            calendar.set(Calendar.SECOND, 0);
+            inspectionReportDTO.setInspectionYearStartDate(calendar.getTime());
+            calendar.add(Calendar.YEAR, 1);
+            inspectionReportDTO.setInspectionYearEndDate(calendar.getTime());
+        } else {
+            Calendar calendar = Calendar.getInstance();
+            calendar.setTime(new Date());
+            calendar.set(Calendar.MONTH, 0);
+            calendar.set(Calendar.DAY_OF_MONTH, 1);
+            calendar.set(Calendar.HOUR_OF_DAY, 0);
+            calendar.set(Calendar.MINUTE, 0);
+            calendar.set(Calendar.SECOND, 0);
+            inspectionReportDTO.setInspectionYearStartDate(calendar.getTime());
+            calendar.add(Calendar.YEAR, 1);
+            inspectionReportDTO.setInspectionYearEndDate(calendar.getTime());
+        }
+        Map<String, Object> data = new HashMap<>();
+        long count = reportService.equipmentInspectionReportCount(inspectionReportDTO);
+        data.put("inspectionCount", count);
+        return R.data(data);
+    }
 
-		Date date = new Date();
-		String dt = Func.formatDateTime(date);
-		inspectionReportDTO.setCreateTime(Func.parse(dt, ConcurrentDateFormat.of("yyyy-MM-dd")));
-		IPage<EquipmentInspectionReportVO> page = reportService.selectTodayReportPage(Condition.getPage(query), inspectionReportDTO);
+    /**
+     * 遗留问题信息列表,分页
+     */
+    @GetMapping("/remainingproblems/page")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "rtuName", value = "测站名称", paramType = "query", dataType = "string"),
+            @ApiImplicitParam(name = "rtuCode", value = "测站编码", paramType = "query", dataType = "string"),
+            @ApiImplicitParam(name = "inspectionYear", value = "巡检年度", paramType = "query", dataType = "string"),
+            @ApiImplicitParam(name = "rainSeasonKind", value = "汛期类型", paramType = "query", dataType = "int"),
+    })
+    @ApiOperationSupport(order = 2)
+    @ApiOperation(value = "遗留问题信息列表")
+    public R<IPage<EquipmentInspectionReportVO>> remainingproblemsPage(@ApiIgnore EquipmentInspectionReportDTO inspectionReportDTO, Query query) {
+        BladeUser user = AuthUtil.getUser();
+        if (BusinessConstant.ROLE_SYS_ADMIN.equals(user.getRoleName())) {
+            inspectionReportDTO.setAdCode(BusinessConstant.REGION_NM_ADCODE);
+            RegionTreeNodeEntity nodeEntity = this.regionService.getRegionNode(user.getRoleName(), user.getDeptId(), inspectionReportDTO.getAdCode());
+            inspectionReportDTO.setExcludeCode(nodeEntity.getExclude());
+        } else if (BusinessConstant.ROLE_ORG_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_SERVICE_PERSON.equals(user.getRoleName())) {
+            LambdaQueryWrapper<DeptRegionEntity> deptRegionEntityLambdaQueryWrapper = Wrappers.<DeptRegionEntity>query().lambda();
+            deptRegionEntityLambdaQueryWrapper.eq(DeptRegionEntity::getDeptId, Func.toLong(user.getDeptId()));
+            DeptRegionEntity deptRegionEntity = deptRegionService.getOne(deptRegionEntityLambdaQueryWrapper);
+            inspectionReportDTO.setAdCode(deptRegionEntity.getAdcd());
+            RegionTreeNodeEntity nodeEntity = this.regionService.getRegionNode(user.getRoleName(), user.getDeptId(), inspectionReportDTO.getAdCode());
+            inspectionReportDTO.setExcludeCode(nodeEntity.getExclude());
+        } else if (BusinessConstant.ROLE_QI_ADMIN.equals(user.getRoleName())) {
+            LambdaQueryWrapper<DeptRegionEntity> deptRegionEntityLambdaQueryWrapper = Wrappers.<DeptRegionEntity>query().lambda();
+            deptRegionEntityLambdaQueryWrapper.eq(DeptRegionEntity::getDeptId, Func.toLong(user.getDeptId()));
+            DeptRegionEntity deptRegionEntity = deptRegionService.getOne(deptRegionEntityLambdaQueryWrapper);
+            inspectionReportDTO.setAdCode(deptRegionEntity.getAdcd());
+        }
 
-		List<EquipmentInspectionReportVO> list = page.getRecords();
-		for (EquipmentInspectionReportVO vo : list) {
-			EquipmentInspectionReportWrapper.build().entityVO(vo);
-		}
-		return R.data(page);
-	}
+        if (inspectionReportDTO.getInspectionYear() != null) {
+            Date year = Func.parseDate(inspectionReportDTO.getInspectionYear(), "yyyy-MM-dd");
+            Calendar calendar = Calendar.getInstance();
+            calendar.setTime(year);
+            calendar.set(Calendar.MONTH, 0);
+            calendar.set(Calendar.DAY_OF_MONTH, 1);
+            calendar.set(Calendar.HOUR_OF_DAY, 0);
+            calendar.set(Calendar.MINUTE, 0);
+            calendar.set(Calendar.SECOND, 0);
+            inspectionReportDTO.setInspectionYearStartDate(calendar.getTime());
+            calendar.add(Calendar.YEAR, 1);
+            inspectionReportDTO.setInspectionYearEndDate(calendar.getTime());
+        } else {
+            Calendar calendar = Calendar.getInstance();
+            calendar.setTime(new Date());
+            calendar.set(Calendar.MONTH, 0);
+            calendar.set(Calendar.DAY_OF_MONTH, 1);
+            calendar.set(Calendar.HOUR_OF_DAY, 0);
+            calendar.set(Calendar.MINUTE, 0);
+            calendar.set(Calendar.SECOND, 0);
+            inspectionReportDTO.setInspectionYearStartDate(calendar.getTime());
+            calendar.add(Calendar.YEAR, 1);
+            inspectionReportDTO.setInspectionYearEndDate(calendar.getTime());
+        }
+        IPage<EquipmentInspectionReportVO> pages = reportService.selectRemainingproblemsPage(Condition.getPage(query), inspectionReportDTO);
+        return R.data(pages);
+    }
 
 
-	@GetMapping("/count")
-	@ApiImplicitParams({
-		@ApiImplicitParam(name = "adCode", value = "行政区划编码", paramType = "query", dataType = "string"),
-		@ApiImplicitParam(name = "inspectionYear", value = "巡检年度", paramType = "query", dataType = "string"),
-		@ApiImplicitParam(name = "rainSeasonKind", value = "汛期类型", paramType = "query", dataType = "int"),
-	})
-	@ApiOperationSupport(order = 2)
-	@ApiOperation(value = "已巡检上报设备数量")
-	public R<Map<String, Object>> inspectionReportCount(@ApiIgnore EquipmentInspectionReportDTO inspectionReportDTO) {
-		if (inspectionReportDTO.getAdCode() == null) {
-			return R.status(false);
-		}
-		BladeUser user = AuthUtil.getUser();
-		if (BusinessConstant.ROLE_SYS_ADMIN.equals(user.getRoleName())) {
-			if (inspectionReportDTO.getAdCode() == null) {
-				inspectionReportDTO.setAdCode(BusinessConstant.REGION_NM_ADCODE);
-			}
-		} else if (BusinessConstant.ROLE_ORG_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_SERVICE_PERSON.equals(user.getRoleName())) {
-			if (inspectionReportDTO.getAdCode() == null) {
-				LambdaQueryWrapper<DeptRegionEntity> deptRegionEntityLambdaQueryWrapper = Wrappers.<DeptRegionEntity>query().lambda();
-				deptRegionEntityLambdaQueryWrapper.eq(DeptRegionEntity::getIsDeleted, 0);
-				deptRegionEntityLambdaQueryWrapper.eq(DeptRegionEntity::getDeptId, Func.toLong(user.getDeptId()));
-				DeptRegionEntity deptRegionEntity = deptRegionService.getOne(deptRegionEntityLambdaQueryWrapper);
-				inspectionReportDTO.setAdCode(deptRegionEntity.getAdcd());
-			}
-		}
-		if (inspectionReportDTO.getInspectionYear() != null) {
-			Date year = Func.parseDate(inspectionReportDTO.getInspectionYear(), "yyyy-MM-dd");
-			Calendar calendar = Calendar.getInstance();
-			calendar.setTime(year);
-			calendar.set(Calendar.MONTH, 0);
-			calendar.set(Calendar.DAY_OF_MONTH, 1);
-			calendar.set(Calendar.HOUR_OF_DAY, 0);
-			calendar.set(Calendar.MINUTE, 0);
-			calendar.set(Calendar.SECOND, 0);
-			inspectionReportDTO.setInspectionYearStartDate(calendar.getTime());
-			calendar.add(Calendar.YEAR, 1);
-			inspectionReportDTO.setInspectionYearEndDate(calendar.getTime());
-		} else {
-			Calendar calendar = Calendar.getInstance();
-			calendar.setTime(new Date());
-			calendar.set(Calendar.MONTH, 0);
-			calendar.set(Calendar.DAY_OF_MONTH, 1);
-			calendar.set(Calendar.HOUR_OF_DAY, 0);
-			calendar.set(Calendar.MINUTE, 0);
-			calendar.set(Calendar.SECOND, 0);
-			inspectionReportDTO.setInspectionYearStartDate(calendar.getTime());
-			calendar.add(Calendar.YEAR, 1);
-			inspectionReportDTO.setInspectionYearEndDate(calendar.getTime());
-		}
-		Map<String, Object> data = new HashMap<>();
-		long count = reportService.equipmentInspectionReportCount(inspectionReportDTO);
-		data.put("inspectionCount", count);
-		return R.data(data);
-	}
+    /**
+     * 遗留问题关闭
+     *
+     * @param reportEntity
+     * @return
+     */
+    @PostMapping("/remainingproblems/close")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "id", value = "工单ID", paramType = "query", dataType = "long"),
+            @ApiImplicitParam(name = "remainQuestionResolution", value = "处理意见", paramType = "query", dataType = "string")
+    })
+    @ApiOperationSupport(order = 4)
+    @ApiOperation(value = "遗留问题关闭操作", notes = "传入实体类EquipmentInspectionReportEntity")
+    public R remainingProblemsClose(@RequestBody EquipmentInspectionReportEntity reportEntity) {
+        if (reportEntity.getId() == null) {
+            return R.fail("参数错误!");
+        }
+        EquipmentInspectionReportEntity entity = reportService.getById(reportEntity.getId());
+        if (null == entity) {
+            return R.status(false);
+        }
+        entity.setRemainQuestionState(2);
+        entity.setRemainQuestionResolution(reportEntity.getRemainQuestionResolution());
+        reportService.updateById(entity);
+        return R.success("操作成功!");
+    }
 
-	/**
-	 * 遗留问题信息列表,分页
-	 */
-	@GetMapping("/remainingproblems/page")
-	@ApiImplicitParams({
-		@ApiImplicitParam(name = "rtuName", value = "测站名称", paramType = "query", dataType = "string"),
-		@ApiImplicitParam(name = "rtuCode", value = "测站编码", paramType = "query", dataType = "string"),
-		@ApiImplicitParam(name = "inspectionYear", value = "巡检年度", paramType = "query", dataType = "string"),
-		@ApiImplicitParam(name = "rainSeasonKind", value = "汛期类型", paramType = "query", dataType = "int"),
-	})
-	@ApiOperationSupport(order = 2)
-	@ApiOperation(value = "遗留问题信息列表")
-	public R<IPage<EquipmentInspectionReportVO>> remainingproblemsPage(@ApiIgnore EquipmentInspectionReportDTO inspectionReportDTO, Query query) {
-		BladeUser user = AuthUtil.getUser();
-		if (BusinessConstant.ROLE_SYS_ADMIN.equals(user.getRoleName())) {
-			inspectionReportDTO.setAdCode(BusinessConstant.REGION_NM_ADCODE);
-		} else if (BusinessConstant.ROLE_ORG_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_SERVICE_PERSON.equals(user.getRoleName())) {
-			LambdaQueryWrapper<DeptRegionEntity> deptRegionEntityLambdaQueryWrapper = Wrappers.<DeptRegionEntity>query().lambda();
-			deptRegionEntityLambdaQueryWrapper.eq(DeptRegionEntity::getIsDeleted, 0);
-			deptRegionEntityLambdaQueryWrapper.eq(DeptRegionEntity::getDeptId, Func.toLong(user.getDeptId()));
-			DeptRegionEntity deptRegionEntity = deptRegionService.getOne(deptRegionEntityLambdaQueryWrapper);
-			inspectionReportDTO.setAdCode(deptRegionEntity.getAdcd());
-		}
-		if (inspectionReportDTO.getAdCode() != null) {
-			RegionTreeNodeEntity nodeEntity = this.regionService.getRegionNode(user.getRoleName(), user.getDeptId(), inspectionReportDTO.getAdCode());
-			inspectionReportDTO.setExcludeCode(nodeEntity.getExclude());
-		}
-		if (inspectionReportDTO.getInspectionYear() != null) {
-			Date year = Func.parseDate(inspectionReportDTO.getInspectionYear(), "yyyy-MM-dd");
-			Calendar calendar = Calendar.getInstance();
-			calendar.setTime(year);
-			calendar.set(Calendar.MONTH, 0);
-			calendar.set(Calendar.DAY_OF_MONTH, 1);
-			calendar.set(Calendar.HOUR_OF_DAY, 0);
-			calendar.set(Calendar.MINUTE, 0);
-			calendar.set(Calendar.SECOND, 0);
-			inspectionReportDTO.setInspectionYearStartDate(calendar.getTime());
-			calendar.add(Calendar.YEAR, 1);
-			inspectionReportDTO.setInspectionYearEndDate(calendar.getTime());
-		} else {
-			Calendar calendar = Calendar.getInstance();
-			calendar.setTime(new Date());
-			calendar.set(Calendar.MONTH, 0);
-			calendar.set(Calendar.DAY_OF_MONTH, 1);
-			calendar.set(Calendar.HOUR_OF_DAY, 0);
-			calendar.set(Calendar.MINUTE, 0);
-			calendar.set(Calendar.SECOND, 0);
-			inspectionReportDTO.setInspectionYearStartDate(calendar.getTime());
-			calendar.add(Calendar.YEAR, 1);
-			inspectionReportDTO.setInspectionYearEndDate(calendar.getTime());
-		}
-		IPage<EquipmentInspectionReportVO> pages = reportService.selectRemainingproblemsPage(Condition.getPage(query), inspectionReportDTO);
-		return R.data(pages);
-	}
+    @GetMapping("/monthremainingproblems/export")
+    @ApiOperationSupport(order = 3)
+    @ApiOperation(value = "当前汛期巡检遗留问题导出", notes = "")
+    public R<Map<String, Object>> monthRemainingProblemsExport() {
+        EquipmentInspectionReportDTO inspectionReportDTO = new EquipmentInspectionReportDTO();
+        BladeUser user = AuthUtil.getUser();
+        if (BusinessConstant.ROLE_SYS_ADMIN.equals(user.getRoleName())) {
+            inspectionReportDTO.setAdCode(BusinessConstant.REGION_NM_ADCODE);
+            RegionTreeNodeEntity node = this.regionService.getRegionNode(user.getRoleName(), user.getDeptId(), inspectionReportDTO.getAdCode());
+            if (Func.notNull(node)) {
+                inspectionReportDTO.setExcludeCode(node.getExclude());
+            }
+        } else if (BusinessConstant.ROLE_ORG_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_SERVICE_PERSON.equals(user.getRoleName())) {
+            LambdaQueryWrapper<DeptRegionEntity> deptRegionEntityLambdaQueryWrapper = Wrappers.<DeptRegionEntity>query().lambda();
+            deptRegionEntityLambdaQueryWrapper.eq(DeptRegionEntity::getDeptId, Func.toLong(user.getDeptId()));
+            DeptRegionEntity deptRegionEntity = deptRegionService.getOne(deptRegionEntityLambdaQueryWrapper);
+            inspectionReportDTO.setAdCode(deptRegionEntity.getAdcd());
+            RegionTreeNodeEntity node = this.regionService.getRegionNode(user.getRoleName(), user.getDeptId(), inspectionReportDTO.getAdCode());
+            if (Func.notNull(node)) {
+                inspectionReportDTO.setExcludeCode(node.getExclude());
+            }
+        } else if (BusinessConstant.ROLE_QI_ADMIN.equals(user.getRoleName())) {
+            LambdaQueryWrapper<DeptRegionEntity> deptRegionEntityLambdaQueryWrapper = Wrappers.<DeptRegionEntity>query().lambda();
+            deptRegionEntityLambdaQueryWrapper.eq(DeptRegionEntity::getDeptId, Func.toLong(user.getDeptId()));
+            DeptRegionEntity deptRegionEntity = deptRegionService.getOne(deptRegionEntityLambdaQueryWrapper);
+            inspectionReportDTO.setAdCode(deptRegionEntity.getAdcd());
+        }
 
+        //文件标题
+        String title = "";
+        //当前时间
+        Calendar dt = Calendar.getInstance();
+        dt.setTime(new Date());
+        //处理汛期类别
+        LambdaQueryWrapper<EquipmentInspectionPlanEntity> wrapper = Wrappers.<EquipmentInspectionPlanEntity>query().lambda();
+        wrapper.eq(EquipmentInspectionPlanEntity::getIsDeleted, 0);
+        wrapper.orderByDesc(EquipmentInspectionPlanEntity::getCreateTime);
+        EquipmentInspectionPlanEntity planEntity = new EquipmentInspectionPlanEntity();
+        List<EquipmentInspectionPlanEntity> planEntityList = planService.list(wrapper);
+        if (null != planEntityList && planEntityList.size() > 0) {
+            EquipmentInspectionPlanEntity entity = planEntityList.get(0);
+            planEntity.setBeforeRainSeasonStartTime(entity.getBeforeRainSeasonStartTime());
+            planEntity.setBeforeRainSeasonEndTime(entity.getBeforeRainSeasonEndTime());
+            planEntity.setRainSeasonFirstStartTime(entity.getRainSeasonFirstStartTime());
+            planEntity.setRainSeasonFirstEndTime(entity.getRainSeasonFirstEndTime());
+            planEntity.setRainSeasonSecondStartTime(entity.getRainSeasonSecondStartTime());
+            planEntity.setRainSeasonSecondEndTime(entity.getRainSeasonSecondEndTime());
+        } else {
+            Calendar calendarStart = Calendar.getInstance();
+            Calendar calendarEnd = Calendar.getInstance();
+            //汛前上报
+            calendarStart.setTime(new Date());
+            calendarStart.set(Calendar.MONTH, 4 - 1);
+            calendarStart.set(Calendar.DAY_OF_MONTH, 1);
+            calendarStart.set(Calendar.HOUR_OF_DAY, 0);
+            calendarStart.set(Calendar.MINUTE, 0);
+            calendarStart.set(Calendar.SECOND, 0);
+            calendarEnd.setTime(new Date());
+            calendarEnd.set(Calendar.MONTH, 6 - 1);
+            calendarEnd.set(Calendar.DAY_OF_MONTH, 1);
+            calendarEnd.set(Calendar.HOUR_OF_DAY, 0);
+            calendarEnd.set(Calendar.MINUTE, 0);
+            calendarEnd.set(Calendar.SECOND, 0);
+            planEntity.setBeforeRainSeasonStartTime(calendarStart.getTime());
+            planEntity.setBeforeRainSeasonEndTime(calendarEnd.getTime());
+            //汛中第一次上报
+            calendarStart.setTime(new Date());
+            calendarStart.set(Calendar.MONTH, 6 - 1);
+            calendarStart.set(Calendar.DAY_OF_MONTH, 1);
+            calendarStart.set(Calendar.HOUR_OF_DAY, 0);
+            calendarStart.set(Calendar.MINUTE, 0);
+            calendarStart.set(Calendar.SECOND, 0);
+            calendarEnd.setTime(new Date());
+            calendarEnd.set(Calendar.MONTH, 8 - 1);
+            calendarEnd.set(Calendar.DAY_OF_MONTH, 15);
+            calendarEnd.set(Calendar.HOUR_OF_DAY, 0);
+            calendarEnd.set(Calendar.MINUTE, 0);
+            calendarEnd.set(Calendar.SECOND, 0);
+            planEntity.setRainSeasonFirstStartTime(calendarStart.getTime());
+            planEntity.setRainSeasonFirstEndTime(calendarEnd.getTime());
+            //汛中第二次上报
+            calendarStart.setTime(new Date());
+            calendarStart.set(Calendar.MONTH, 8 - 1);
+            calendarStart.set(Calendar.DAY_OF_MONTH, 15);
+            calendarStart.set(Calendar.HOUR_OF_DAY, 0);
+            calendarStart.set(Calendar.MINUTE, 0);
+            calendarStart.set(Calendar.SECOND, 0);
+            calendarEnd.setTime(new Date());
+            calendarEnd.set(Calendar.MONTH, 10 - 1);
+            calendarEnd.set(Calendar.DAY_OF_MONTH, 1);
+            calendarEnd.set(Calendar.HOUR_OF_DAY, 0);
+            calendarEnd.set(Calendar.MINUTE, 0);
+            calendarEnd.set(Calendar.SECOND, 0);
+            planEntity.setRainSeasonSecondStartTime(calendarStart.getTime());
+            planEntity.setRainSeasonSecondEndTime(calendarEnd.getTime());
+        }
+        Calendar calendarStart = Calendar.getInstance();
+        calendarStart.setTime(planEntity.getBeforeRainSeasonStartTime());
+        Calendar calendarEnd = Calendar.getInstance();
+        //汛前上报
+        calendarEnd.setTime(planEntity.getBeforeRainSeasonEndTime());
+        calendarEnd.add(Calendar.DAY_OF_MONTH, -1);
+        title = (calendarStart.get(Calendar.MONTH) + 1) + "月" + calendarStart.get(Calendar.DAY_OF_MONTH) + "日" + "-" + (calendarEnd.get(Calendar.MONTH) + 1) + "月" + calendarEnd.get(Calendar.DAY_OF_MONTH) + "日";
+        calendarEnd.setTime(planEntity.getRainSeasonFirstStartTime());
+        if ((dt.getTime().getTime() / 1000 == calendarStart.getTime().getTime() / 1000 || dt.after(calendarStart)) && dt.before(calendarEnd)) {
+            inspectionReportDTO.setRainSeasonKind(1);
+        } else {
+            //汛中第一次上报
+            calendarStart.setTime(planEntity.getRainSeasonFirstStartTime());
+            calendarEnd.setTime(planEntity.getRainSeasonFirstEndTime());
+            calendarEnd.add(Calendar.DAY_OF_MONTH, -1);
+            title = (calendarStart.get(Calendar.MONTH) + 1) + "月" + calendarStart.get(Calendar.DAY_OF_MONTH) + "日" + "-" + (calendarEnd.get(Calendar.MONTH) + 1) + "月" + calendarEnd.get(Calendar.DAY_OF_MONTH) + "日";
+            calendarEnd.setTime(planEntity.getRainSeasonFirstEndTime());
+            if ((dt.getTime().getTime() / 1000 == calendarStart.getTime().getTime() / 1000 || dt.after(calendarStart)) && dt.before(calendarEnd)) {
+                inspectionReportDTO.setRainSeasonKind(2);
+            } else {
+                //汛中第二次上报
+                calendarStart.setTime(planEntity.getRainSeasonSecondStartTime());
+                calendarEnd.setTime(planEntity.getRainSeasonSecondEndTime());
+                calendarEnd.add(Calendar.DAY_OF_MONTH, -1);
+                title = (calendarStart.get(Calendar.MONTH) + 1) + "月" + calendarStart.get(Calendar.DAY_OF_MONTH) + "日" + "-" + (calendarEnd.get(Calendar.MONTH) + 1) + "月" + calendarEnd.get(Calendar.DAY_OF_MONTH) + "日";
+                calendarEnd.setTime(dt.getTime());
+                calendarEnd.add(Calendar.YEAR, 1);
+                calendarEnd.set(Calendar.MONTH, 0);
+                calendarEnd.set(Calendar.DAY_OF_MONTH, 1);
+                calendarEnd.set(Calendar.HOUR_OF_DAY, 0);
+                calendarEnd.set(Calendar.MINUTE, 0);
+                calendarEnd.set(Calendar.SECOND, 0);
+                if ((dt.getTime().getTime() / 1000 == calendarStart.getTime().getTime() / 1000 || dt.after(calendarStart)) && dt.before(calendarEnd)) {
+                    inspectionReportDTO.setRainSeasonKind(3);
+                }
+            }
+        }
 
-	/**
-	 * 遗留问题关闭
-	 *
-	 * @param reportEntity
-	 * @return
-	 */
-	@PostMapping("/remainingproblems/close")
-	@ApiImplicitParams({
-		@ApiImplicitParam(name = "id", value = "工单ID", paramType = "query", dataType = "long"),
-		@ApiImplicitParam(name = "remainQuestionResolution", value = "处理意见", paramType = "query", dataType = "string")
-	})
-	@ApiOperationSupport(order = 4)
-	@ApiOperation(value = "遗留问题关闭操作", notes = "传入实体类EquipmentInspectionReportEntity")
-	public R remainingProblemsClose(@RequestBody EquipmentInspectionReportEntity reportEntity) {
-		if (reportEntity.getId() == null) {
-			return R.fail("参数错误!");
-		}
-		EquipmentInspectionReportEntity entity = reportService.getById(reportEntity.getId());
-		if (null == entity) {
-			return R.status(false);
-		}
-		entity.setRemainQuestionState(2);
-		entity.setRemainQuestionResolution(reportEntity.getRemainQuestionResolution());
-		reportService.updateById(entity);
-		return R.success("操作成功!");
-	}
+        //生成数据
+        List<EquipmentInspectionReportVO> reportEntityList = reportService.selectRainSeasonRemainingproblemsList(inspectionReportDTO);
+        List<EquipmentInspectionExportEntity> list = new LinkedList<>();
+        if (null != reportEntityList && reportEntityList.size() > 0) {
+            int index = 1;
+            for (EquipmentInspectionReportVO entity : reportEntityList) {
+                EquipmentInspectionExportEntity exportEntity = new EquipmentInspectionExportEntity();
+                exportEntity.setIndex(index);
+                if (entity.getAdCity() != null) {
+                    exportEntity.setAdCity(entity.getAdCity());
+                } else {
+                    exportEntity.setAdCity("");
+                }
+                if (entity.getAdDist() != null) {
+                    exportEntity.setAdDist(entity.getAdDist());
+                } else {
+                    exportEntity.setAdDist("");
+                }
+                if (entity.getRtuName() != null) {
+                    exportEntity.setRtuName(entity.getRtuName());
+                } else {
+                    exportEntity.setRtuName("");
+                }
+                exportEntity.setRtuCode(entity.getRtuCode());
+                String rtuKindDesc = "";
+                if (entity.getIsRain() != null && entity.getIsRain() == 1) {
+                    rtuKindDesc += "雨量站";
+                }
+                if ((entity.getIsRiver() != null && entity.getIsRiver() == 1) || (entity.getIsRes() != null && entity.getIsRes() == 1)) {
+                    if (rtuKindDesc.length() > 0) {
+                        rtuKindDesc += "/";
+                    }
+                    rtuKindDesc += "水位站";
+                }
+                if (entity.getIsGround() != null && entity.getIsGround() == 1) {
+                    if (rtuKindDesc.length() > 0) {
+                        rtuKindDesc += "/";
+                    }
+                    rtuKindDesc += "墒情站";
+                }
+                if (entity.getIsCamera() != null && entity.getIsCamera() == 1) {
+                    if (rtuKindDesc.length() > 0) {
+                        rtuKindDesc += "/";
+                    }
+                    rtuKindDesc += "视频站";
+                }
+                exportEntity.setRtuKindDesc(rtuKindDesc);
+                if (entity.getLocationDesc() != null) {
+                    exportEntity.setLocationDesc(entity.getLocationDesc());
+                } else {
+                    exportEntity.setLocationDesc("");
+                }
+                if (entity.getLng() != null) {
+                    exportEntity.setLng(entity.getLng());
+                } else {
+                    exportEntity.setLng("");
+                }
+                if (entity.getLat() != null) {
+                    exportEntity.setLat(entity.getLat());
+                } else {
+                    exportEntity.setLat("");
+                }
+                if (entity.getManageCompany() != null) {
+                    exportEntity.setManageCompany(entity.getManageCompany());
+                } else {
+                    exportEntity.setManageCompany("");
+                }
+                if (entity.getServicePersonName() != null) {
+                    exportEntity.setServicePersonName(entity.getServicePersonName());
+                } else {
+                    exportEntity.setServicePersonName("");
+                }
+                if (entity.getCreateTime() != null) {
+                    exportEntity.setCreateTime(Func.formatDate(entity.getCreateTime()));
+                } else {
+                    exportEntity.setCreateTime("");
+                }
+                if (entity.getRemainQuestion() != null) {
+                    exportEntity.setRemainQuestion(entity.getRemainQuestion());
+                } else {
+                    exportEntity.setRemainQuestion("");
+                }
+                if (entity.getRemainQuestionState() != null) {
+                    if (entity.getRemainQuestionState() == 1) {
+                        exportEntity.setRemainQuestionState("待处理");
+                    } else if (entity.getRemainQuestionState() == 2) {
+                        exportEntity.setRemainQuestionState("已处理完成");
+                    } else {
+                        exportEntity.setRemainQuestionState("");
+                    }
+                } else {
+                    exportEntity.setRemainQuestionState("");
+                }
+                if (entity.getRemainQuestionResolution() != null) {
+                    exportEntity.setRemainQuestionResolution(entity.getRemainQuestionResolution());
+                } else {
+                    exportEntity.setRemainQuestionResolution("");
+                }
+                list.add(exportEntity);
+                index += 1;
+            }
+        }
+        Map<String, Object> data = new HashMap<>();
+        data.put("status", 0);
+        String templateFilePath = this.workDir + File.separator + this.inspectionRemainingProblemsTemplate;
+        String outpath = this.workDir + File.separator + Func.formatDate(new Date());
+        File dir = new File(outpath);
+        if (!dir.exists()) {
+            if (!dir.mkdir()) {
+                return R.fail("目录创建失败");
+            }
+        }
+        String outFileName = Func.randomUUID() + ".xlsx";
+        outpath += File.separator + outFileName;
+        ExcelWriter excelWriter = EasyExcel.write(outpath).withTemplate(templateFilePath).excelType(ExcelTypeEnum.XLSX).build();
+        WriteSheet writeSheet = EasyExcel.writerSheet("信息统计表").build();
+        excelWriter.write(list, writeSheet);
+        excelWriter.finish();
+        try {
+            FileInputStream fileInputStream = new FileInputStream(new File(outpath));
+            BladeFile bladeFile = ossBuilder.template().putFile(outFileName, fileInputStream);
+            String ossPath = bladeFile.getName();
+            String p = bladeFile.getDomain();
+            log.info(ossPath);
+            log.info(p);
+            data.put("name", ossPath);
+            data.put("url", ossPath);
+            data.put("filename", "汛期(" + title + ")巡检遗留问题表");
+            data.put("status", 1);
+        } catch (FileNotFoundException e) {
+            e.printStackTrace();
+        }
+        return R.data(data);
+    }
 
-	@GetMapping("/monthremainingproblems/export")
-	@ApiOperationSupport(order = 3)
-	@ApiOperation(value = "当前汛期巡检遗留问题导出", notes = "")
-	public R<Map<String, Object>> monthRemainingProblemsExport() {
-		EquipmentInspectionReportDTO inspectionReportDTO = new EquipmentInspectionReportDTO();
-		BladeUser user = AuthUtil.getUser();
-		if (BusinessConstant.ROLE_SYS_ADMIN.equals(user.getRoleName())) {
-			inspectionReportDTO.setAdCode(BusinessConstant.REGION_NM_ADCODE);
-		} else if (BusinessConstant.ROLE_ORG_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_SERVICE_PERSON.equals(user.getRoleName())) {
-			LambdaQueryWrapper<DeptRegionEntity> deptRegionEntityLambdaQueryWrapper = Wrappers.<DeptRegionEntity>query().lambda();
-			deptRegionEntityLambdaQueryWrapper.eq(DeptRegionEntity::getIsDeleted, 0);
-			deptRegionEntityLambdaQueryWrapper.eq(DeptRegionEntity::getDeptId, Func.toLong(user.getDeptId()));
-			DeptRegionEntity deptRegionEntity = deptRegionService.getOne(deptRegionEntityLambdaQueryWrapper);
-			inspectionReportDTO.setAdCode(deptRegionEntity.getAdcd());
-		}
-		if (inspectionReportDTO.getAdCode() != null) {
-			RegionTreeNodeEntity node = this.regionService.getRegionNode(user.getRoleName(), user.getDeptId(), inspectionReportDTO.getAdCode());
-			if (null != node) {
-				inspectionReportDTO.setExcludeCode(node.getExclude());
-			}
-		}
-		//文件标题
-		String title = "";
-		//当前时间
-		Calendar dt = Calendar.getInstance();
-		dt.setTime(new Date());
-		//处理汛期类别
-		LambdaQueryWrapper<EquipmentInspectionPlanEntity> wrapper = Wrappers.<EquipmentInspectionPlanEntity>query().lambda();
-		wrapper.eq(EquipmentInspectionPlanEntity::getIsDeleted, 0);
-		wrapper.orderByDesc(EquipmentInspectionPlanEntity::getCreateTime);
-		EquipmentInspectionPlanEntity planEntity = new EquipmentInspectionPlanEntity();
-		List<EquipmentInspectionPlanEntity> planEntityList = planService.list(wrapper);
-		if (null != planEntityList && planEntityList.size() > 0) {
-			EquipmentInspectionPlanEntity entity = planEntityList.get(0);
-			planEntity.setBeforeRainSeasonStartTime(entity.getBeforeRainSeasonStartTime());
-			planEntity.setBeforeRainSeasonEndTime(entity.getBeforeRainSeasonEndTime());
-			planEntity.setRainSeasonFirstStartTime(entity.getRainSeasonFirstStartTime());
-			planEntity.setRainSeasonFirstEndTime(entity.getRainSeasonFirstEndTime());
-			planEntity.setRainSeasonSecondStartTime(entity.getRainSeasonSecondStartTime());
-			planEntity.setRainSeasonSecondEndTime(entity.getRainSeasonSecondEndTime());
-		} else {
-			Calendar calendarStart = Calendar.getInstance();
-			Calendar calendarEnd = Calendar.getInstance();
-			//汛前上报
-			calendarStart.setTime(new Date());
-			calendarStart.set(Calendar.MONTH, 4 - 1);
-			calendarStart.set(Calendar.DAY_OF_MONTH, 1);
-			calendarStart.set(Calendar.HOUR_OF_DAY, 0);
-			calendarStart.set(Calendar.MINUTE, 0);
-			calendarStart.set(Calendar.SECOND, 0);
-			calendarEnd.setTime(new Date());
-			calendarEnd.set(Calendar.MONTH, 6 - 1);
-			calendarEnd.set(Calendar.DAY_OF_MONTH, 1);
-			calendarEnd.set(Calendar.HOUR_OF_DAY, 0);
-			calendarEnd.set(Calendar.MINUTE, 0);
-			calendarEnd.set(Calendar.SECOND, 0);
-			planEntity.setBeforeRainSeasonStartTime(calendarStart.getTime());
-			planEntity.setBeforeRainSeasonEndTime(calendarEnd.getTime());
-			//汛中第一次上报
-			calendarStart.setTime(new Date());
-			calendarStart.set(Calendar.MONTH, 6 - 1);
-			calendarStart.set(Calendar.DAY_OF_MONTH, 1);
-			calendarStart.set(Calendar.HOUR_OF_DAY, 0);
-			calendarStart.set(Calendar.MINUTE, 0);
-			calendarStart.set(Calendar.SECOND, 0);
-			calendarEnd.setTime(new Date());
-			calendarEnd.set(Calendar.MONTH, 8 - 1);
-			calendarEnd.set(Calendar.DAY_OF_MONTH, 15);
-			calendarEnd.set(Calendar.HOUR_OF_DAY, 0);
-			calendarEnd.set(Calendar.MINUTE, 0);
-			calendarEnd.set(Calendar.SECOND, 0);
-			planEntity.setRainSeasonFirstStartTime(calendarStart.getTime());
-			planEntity.setRainSeasonFirstEndTime(calendarEnd.getTime());
-			//汛中第二次上报
-			calendarStart.setTime(new Date());
-			calendarStart.set(Calendar.MONTH, 8 - 1);
-			calendarStart.set(Calendar.DAY_OF_MONTH, 15);
-			calendarStart.set(Calendar.HOUR_OF_DAY, 0);
-			calendarStart.set(Calendar.MINUTE, 0);
-			calendarStart.set(Calendar.SECOND, 0);
-			calendarEnd.setTime(new Date());
-			calendarEnd.set(Calendar.MONTH, 10 - 1);
-			calendarEnd.set(Calendar.DAY_OF_MONTH, 1);
-			calendarEnd.set(Calendar.HOUR_OF_DAY, 0);
-			calendarEnd.set(Calendar.MINUTE, 0);
-			calendarEnd.set(Calendar.SECOND, 0);
-			planEntity.setRainSeasonSecondStartTime(calendarStart.getTime());
-			planEntity.setRainSeasonSecondEndTime(calendarEnd.getTime());
-		}
-		Calendar calendarStart = Calendar.getInstance();
-		calendarStart.setTime(planEntity.getBeforeRainSeasonStartTime());
-		Calendar calendarEnd = Calendar.getInstance();
-		//汛前上报
-		calendarEnd.setTime(planEntity.getBeforeRainSeasonEndTime());
-		calendarEnd.add(Calendar.DAY_OF_MONTH, -1);
-		title = (calendarStart.get(Calendar.MONTH) + 1) + "月" + calendarStart.get(Calendar.DAY_OF_MONTH) + "日" + "-" + (calendarEnd.get(Calendar.MONTH) + 1) + "月" + calendarEnd.get(Calendar.DAY_OF_MONTH) + "日";
-		calendarEnd.setTime(planEntity.getRainSeasonFirstStartTime());
-		if ((dt.getTime().getTime() / 1000 == calendarStart.getTime().getTime() / 1000 || dt.after(calendarStart)) && dt.before(calendarEnd)) {
-			inspectionReportDTO.setRainSeasonKind(1);
-		} else {
-			//汛中第一次上报
-			calendarStart.setTime(planEntity.getRainSeasonFirstStartTime());
-			calendarEnd.setTime(planEntity.getRainSeasonFirstEndTime());
-			calendarEnd.add(Calendar.DAY_OF_MONTH, -1);
-			title = (calendarStart.get(Calendar.MONTH) + 1) + "月" + calendarStart.get(Calendar.DAY_OF_MONTH) + "日" + "-" + (calendarEnd.get(Calendar.MONTH) + 1) + "月" + calendarEnd.get(Calendar.DAY_OF_MONTH) + "日";
-			calendarEnd.setTime(planEntity.getRainSeasonFirstEndTime());
-			if ((dt.getTime().getTime() / 1000 == calendarStart.getTime().getTime() / 1000 || dt.after(calendarStart)) && dt.before(calendarEnd)) {
-				inspectionReportDTO.setRainSeasonKind(2);
-			} else {
-				//汛中第二次上报
-				calendarStart.setTime(planEntity.getRainSeasonSecondStartTime());
-				calendarEnd.setTime(planEntity.getRainSeasonSecondEndTime());
-				calendarEnd.add(Calendar.DAY_OF_MONTH, -1);
-				title = (calendarStart.get(Calendar.MONTH) + 1) + "月" + calendarStart.get(Calendar.DAY_OF_MONTH) + "日" + "-" + (calendarEnd.get(Calendar.MONTH) + 1) + "月" + calendarEnd.get(Calendar.DAY_OF_MONTH) + "日";
-				calendarEnd.setTime(dt.getTime());
-				calendarEnd.add(Calendar.YEAR, 1);
-				calendarEnd.set(Calendar.MONTH, 0);
-				calendarEnd.set(Calendar.DAY_OF_MONTH, 1);
-				calendarEnd.set(Calendar.HOUR_OF_DAY, 0);
-				calendarEnd.set(Calendar.MINUTE, 0);
-				calendarEnd.set(Calendar.SECOND, 0);
-				if ((dt.getTime().getTime() / 1000 == calendarStart.getTime().getTime() / 1000 || dt.after(calendarStart)) && dt.before(calendarEnd)) {
-					inspectionReportDTO.setRainSeasonKind(3);
-				}
-			}
-		}
 
-		//生成数据
-		List<EquipmentInspectionReportVO> reportEntityList = reportService.selectRainSeasonRemainingproblemsList(inspectionReportDTO);
-		List<EquipmentInspectionExportEntity> list = new LinkedList<>();
-		if (null != reportEntityList && reportEntityList.size() > 0) {
-			int index = 1;
-			for (EquipmentInspectionReportVO entity : reportEntityList) {
-				EquipmentInspectionExportEntity exportEntity = new EquipmentInspectionExportEntity();
-				exportEntity.setIndex(index);
-				if (entity.getAdCity() != null) {
-					exportEntity.setAdCity(entity.getAdCity());
-				} else {
-					exportEntity.setAdCity("");
-				}
-				if (entity.getAdDist() != null) {
-					exportEntity.setAdDist(entity.getAdDist());
-				} else {
-					exportEntity.setAdDist("");
-				}
-				if (entity.getRtuName() != null) {
-					exportEntity.setRtuName(entity.getRtuName());
-				} else {
-					exportEntity.setRtuName("");
-				}
-				exportEntity.setRtuCode(entity.getRtuCode());
-				String rtuKindDesc = "";
-				if (entity.getIsRain() != null && entity.getIsRain() == 1) {
-					rtuKindDesc += "雨量站";
-				}
-				if ((entity.getIsRiver() != null && entity.getIsRiver() == 1) || (entity.getIsRes() != null && entity.getIsRes() == 1)) {
-					if (rtuKindDesc.length() > 0) {
-						rtuKindDesc += "/";
-					}
-					rtuKindDesc += "水位站";
-				}
-				if (entity.getIsGround() != null && entity.getIsGround() == 1) {
-					if (rtuKindDesc.length() > 0) {
-						rtuKindDesc += "/";
-					}
-					rtuKindDesc += "墒情站";
-				}
-				if (entity.getIsCamera() != null && entity.getIsCamera() == 1) {
-					if (rtuKindDesc.length() > 0) {
-						rtuKindDesc += "/";
-					}
-					rtuKindDesc += "视频站";
-				}
-				exportEntity.setRtuKindDesc(rtuKindDesc);
-				if (entity.getLocationDesc() != null) {
-					exportEntity.setLocationDesc(entity.getLocationDesc());
-				} else {
-					exportEntity.setLocationDesc("");
-				}
-				if (entity.getLng() != null) {
-					exportEntity.setLng(entity.getLng());
-				} else {
-					exportEntity.setLng("");
-				}
-				if (entity.getLat() != null) {
-					exportEntity.setLat(entity.getLat());
-				} else {
-					exportEntity.setLat("");
-				}
-				if (entity.getManageCompany() != null) {
-					exportEntity.setManageCompany(entity.getManageCompany());
-				} else {
-					exportEntity.setManageCompany("");
-				}
-				if (entity.getServicePersonName() != null) {
-					exportEntity.setServicePersonName(entity.getServicePersonName());
-				} else {
-					exportEntity.setServicePersonName("");
-				}
-				if (entity.getCreateTime() != null) {
-					exportEntity.setCreateTime(Func.formatDate(entity.getCreateTime()));
-				} else {
-					exportEntity.setCreateTime("");
-				}
-				if (entity.getRemainQuestion() != null) {
-					exportEntity.setRemainQuestion(entity.getRemainQuestion());
-				} else {
-					exportEntity.setRemainQuestion("");
-				}
-				if (entity.getRemainQuestionState() != null) {
-					if (entity.getRemainQuestionState() == 1) {
-						exportEntity.setRemainQuestionState("待处理");
-					} else if (entity.getRemainQuestionState() == 2) {
-						exportEntity.setRemainQuestionState("已处理完成");
-					} else {
-						exportEntity.setRemainQuestionState("");
-					}
-				} else {
-					exportEntity.setRemainQuestionState("");
-				}
-				if (entity.getRemainQuestionResolution() != null) {
-					exportEntity.setRemainQuestionResolution(entity.getRemainQuestionResolution());
-				} else {
-					exportEntity.setRemainQuestionResolution("");
-				}
-				list.add(exportEntity);
-				index += 1;
-			}
-		}
-		Map<String, Object> data = new HashMap<>();
-		data.put("status", 0);
-		String templateFilePath = this.workDir + File.separator + this.inspectionRemainingProblemsTemplate;
-		String outpath = this.workDir + File.separator + Func.formatDate(new Date());
-		File dir = new File(outpath);
-		if (!dir.exists()) {
-			if (!dir.mkdir()) {
-				return R.fail("目录创建失败");
-			}
-		}
-		String outFileName = Func.randomUUID() + ".xlsx";
-		outpath += File.separator + outFileName;
-		ExcelWriter excelWriter = EasyExcel.write(outpath).withTemplate(templateFilePath).excelType(ExcelTypeEnum.XLSX).build();
-		WriteSheet writeSheet = EasyExcel.writerSheet("信息统计表").build();
-		excelWriter.write(list, writeSheet);
-		excelWriter.finish();
-		try {
-			FileInputStream fileInputStream = new FileInputStream(new File(outpath));
-			BladeFile bladeFile = ossBuilder.template().putFile(outFileName, fileInputStream);
-			String ossPath = bladeFile.getName();
-			String p = bladeFile.getDomain();
-			log.info(ossPath);
-			log.info(p);
-			data.put("name", ossPath);
-			data.put("url", ossPath);
-			data.put("filename", "汛期(" + title + ")巡检遗留问题表");
-			data.put("status", 1);
-		} catch (FileNotFoundException e) {
-			e.printStackTrace();
-		}
-		return R.data(data);
-	}
+    @GetMapping("/uncloseremainingproblems/export")
+    @ApiOperationSupport(order = 3)
+    @ApiOperation(value = "当前汛期未关闭遗留问题导出", notes = "")
+    public R<Map<String, Object>> uncloseRemainingProblemsExport() {
+        EquipmentInspectionReportDTO inspectionReportDTO = new EquipmentInspectionReportDTO();
+        BladeUser user = AuthUtil.getUser();
+        if (BusinessConstant.ROLE_SYS_ADMIN.equals(user.getRoleName())) {
+            inspectionReportDTO.setAdCode(BusinessConstant.REGION_NM_ADCODE);
+            RegionTreeNodeEntity node = this.regionService.getRegionNode(user.getRoleName(), user.getDeptId(), inspectionReportDTO.getAdCode());
+            if (Func.notNull(node)) {
+                inspectionReportDTO.setExcludeCode(node.getExclude());
+            }
+        } else if (BusinessConstant.ROLE_ORG_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_SERVICE_PERSON.equals(user.getRoleName())) {
+            LambdaQueryWrapper<DeptRegionEntity> deptRegionEntityLambdaQueryWrapper = Wrappers.<DeptRegionEntity>query().lambda();
+            deptRegionEntityLambdaQueryWrapper.eq(DeptRegionEntity::getDeptId, Func.toLong(user.getDeptId()));
+            DeptRegionEntity deptRegionEntity = deptRegionService.getOne(deptRegionEntityLambdaQueryWrapper);
+            inspectionReportDTO.setAdCode(deptRegionEntity.getAdcd());
+            RegionTreeNodeEntity node = this.regionService.getRegionNode(user.getRoleName(), user.getDeptId(), inspectionReportDTO.getAdCode());
+            if (Func.notNull(node)) {
+                inspectionReportDTO.setExcludeCode(node.getExclude());
+            }
+        } else if (BusinessConstant.ROLE_QI_ADMIN.equals(user.getRoleName())) {
+            LambdaQueryWrapper<DeptRegionEntity> deptRegionEntityLambdaQueryWrapper = Wrappers.<DeptRegionEntity>query().lambda();
+            deptRegionEntityLambdaQueryWrapper.eq(DeptRegionEntity::getDeptId, Func.toLong(user.getDeptId()));
+            DeptRegionEntity deptRegionEntity = deptRegionService.getOne(deptRegionEntityLambdaQueryWrapper);
+            inspectionReportDTO.setAdCode(deptRegionEntity.getAdcd());
+        }
 
+        //文件标题
+        String title = "";
+        //当前时间
+        Calendar dt = Calendar.getInstance();
+        dt.setTime(new Date());
+        //处理汛期类别
+        LambdaQueryWrapper<EquipmentInspectionPlanEntity> wrapper = Wrappers.<EquipmentInspectionPlanEntity>query().lambda();
+        wrapper.eq(EquipmentInspectionPlanEntity::getIsDeleted, 0);
+        wrapper.orderByDesc(EquipmentInspectionPlanEntity::getCreateTime);
+        EquipmentInspectionPlanEntity planEntity = new EquipmentInspectionPlanEntity();
+        List<EquipmentInspectionPlanEntity> planEntityList = planService.list(wrapper);
+        if (null != planEntityList && planEntityList.size() > 0) {
+            EquipmentInspectionPlanEntity entity = planEntityList.get(0);
+            planEntity.setBeforeRainSeasonStartTime(entity.getBeforeRainSeasonStartTime());
+            planEntity.setBeforeRainSeasonEndTime(entity.getBeforeRainSeasonEndTime());
+            planEntity.setRainSeasonFirstStartTime(entity.getRainSeasonFirstStartTime());
+            planEntity.setRainSeasonFirstEndTime(entity.getRainSeasonFirstEndTime());
+            planEntity.setRainSeasonSecondStartTime(entity.getRainSeasonSecondStartTime());
+            planEntity.setRainSeasonSecondEndTime(entity.getRainSeasonSecondEndTime());
+        } else {
+            Calendar calendarStart = Calendar.getInstance();
+            Calendar calendarEnd = Calendar.getInstance();
+            //汛前上报
+            calendarStart.setTime(new Date());
+            calendarStart.set(Calendar.MONTH, 4 - 1);
+            calendarStart.set(Calendar.DAY_OF_MONTH, 1);
+            calendarStart.set(Calendar.HOUR_OF_DAY, 0);
+            calendarStart.set(Calendar.MINUTE, 0);
+            calendarStart.set(Calendar.SECOND, 0);
+            calendarEnd.setTime(new Date());
+            calendarEnd.set(Calendar.MONTH, 6 - 1);
+            calendarEnd.set(Calendar.DAY_OF_MONTH, 1);
+            calendarEnd.set(Calendar.HOUR_OF_DAY, 0);
+            calendarEnd.set(Calendar.MINUTE, 0);
+            calendarEnd.set(Calendar.SECOND, 0);
+            planEntity.setBeforeRainSeasonStartTime(calendarStart.getTime());
+            planEntity.setBeforeRainSeasonEndTime(calendarEnd.getTime());
+            //汛中第一次上报
+            calendarStart.setTime(new Date());
+            calendarStart.set(Calendar.MONTH, 6 - 1);
+            calendarStart.set(Calendar.DAY_OF_MONTH, 1);
+            calendarStart.set(Calendar.HOUR_OF_DAY, 0);
+            calendarStart.set(Calendar.MINUTE, 0);
+            calendarStart.set(Calendar.SECOND, 0);
+            calendarEnd.setTime(new Date());
+            calendarEnd.set(Calendar.MONTH, 8 - 1);
+            calendarEnd.set(Calendar.DAY_OF_MONTH, 15);
+            calendarEnd.set(Calendar.HOUR_OF_DAY, 0);
+            calendarEnd.set(Calendar.MINUTE, 0);
+            calendarEnd.set(Calendar.SECOND, 0);
+            planEntity.setRainSeasonFirstStartTime(calendarStart.getTime());
+            planEntity.setRainSeasonFirstEndTime(calendarEnd.getTime());
+            //汛中第二次上报
+            calendarStart.setTime(new Date());
+            calendarStart.set(Calendar.MONTH, 8 - 1);
+            calendarStart.set(Calendar.DAY_OF_MONTH, 15);
+            calendarStart.set(Calendar.HOUR_OF_DAY, 0);
+            calendarStart.set(Calendar.MINUTE, 0);
+            calendarStart.set(Calendar.SECOND, 0);
+            calendarEnd.setTime(new Date());
+            calendarEnd.set(Calendar.MONTH, 10 - 1);
+            calendarEnd.set(Calendar.DAY_OF_MONTH, 1);
+            calendarEnd.set(Calendar.HOUR_OF_DAY, 0);
+            calendarEnd.set(Calendar.MINUTE, 0);
+            calendarEnd.set(Calendar.SECOND, 0);
+            planEntity.setRainSeasonSecondStartTime(calendarStart.getTime());
+            planEntity.setRainSeasonSecondEndTime(calendarEnd.getTime());
+        }
+        Calendar calendarStart = Calendar.getInstance();
+        calendarStart.setTime(planEntity.getBeforeRainSeasonStartTime());
+        Calendar calendarEnd = Calendar.getInstance();
+        //汛前上报
+        calendarEnd.setTime(planEntity.getBeforeRainSeasonEndTime());
+        calendarEnd.add(Calendar.DAY_OF_MONTH, -1);
+        title = (calendarStart.get(Calendar.MONTH) + 1) + "月" + calendarStart.get(Calendar.DAY_OF_MONTH) + "日" + "-" + (calendarEnd.get(Calendar.MONTH) + 1) + "月" + calendarEnd.get(Calendar.DAY_OF_MONTH) + "日";
+        calendarEnd.setTime(planEntity.getRainSeasonFirstStartTime());
+        if ((dt.getTime().getTime() / 1000 == calendarStart.getTime().getTime() / 1000 || dt.after(calendarStart)) && dt.before(calendarEnd)) {
+            inspectionReportDTO.setRainSeasonKind(1);
+        } else {
+            //汛中第一次上报
+            calendarStart.setTime(planEntity.getRainSeasonFirstStartTime());
+            calendarEnd.setTime(planEntity.getRainSeasonFirstEndTime());
+            calendarEnd.add(Calendar.DAY_OF_MONTH, -1);
+            title = (calendarStart.get(Calendar.MONTH) + 1) + "月" + calendarStart.get(Calendar.DAY_OF_MONTH) + "日" + "-" + (calendarEnd.get(Calendar.MONTH) + 1) + "月" + calendarEnd.get(Calendar.DAY_OF_MONTH) + "日";
+            calendarEnd.setTime(planEntity.getRainSeasonFirstEndTime());
+            if ((dt.getTime().getTime() / 1000 == calendarStart.getTime().getTime() / 1000 || dt.after(calendarStart)) && dt.before(calendarEnd)) {
+                inspectionReportDTO.setRainSeasonKind(2);
+            } else {
+                //汛中第二次上报
+                calendarStart.setTime(planEntity.getRainSeasonSecondStartTime());
+                calendarEnd.setTime(planEntity.getRainSeasonSecondEndTime());
+                calendarEnd.add(Calendar.DAY_OF_MONTH, -1);
+                title = (calendarStart.get(Calendar.MONTH) + 1) + "月" + calendarStart.get(Calendar.DAY_OF_MONTH) + "日" + "-" + (calendarEnd.get(Calendar.MONTH) + 1) + "月" + calendarEnd.get(Calendar.DAY_OF_MONTH) + "日";
+                calendarEnd.setTime(dt.getTime());
+                calendarEnd.add(Calendar.YEAR, 1);
+                calendarEnd.set(Calendar.MONTH, 0);
+                calendarEnd.set(Calendar.DAY_OF_MONTH, 1);
+                calendarEnd.set(Calendar.HOUR_OF_DAY, 0);
+                calendarEnd.set(Calendar.MINUTE, 0);
+                calendarEnd.set(Calendar.SECOND, 0);
+                if ((dt.getTime().getTime() / 1000 == calendarStart.getTime().getTime() / 1000 || dt.after(calendarStart)) && dt.before(calendarEnd)) {
+                    inspectionReportDTO.setRainSeasonKind(3);
+                }
+            }
+        }
+        //生成数据
+        List<EquipmentInspectionReportVO> reportEntityList = reportService.selectRainSeasonUncolseRemainingproblemsList(inspectionReportDTO);
+        List<EquipmentInspectionExportEntity> list = new LinkedList<>();
+        if (null != reportEntityList && reportEntityList.size() > 0) {
+            int index = 1;
+            for (EquipmentInspectionReportVO entity : reportEntityList) {
+                EquipmentInspectionExportEntity exportEntity = new EquipmentInspectionExportEntity();
+                exportEntity.setIndex(index);
+                if (entity.getAdCity() != null) {
+                    exportEntity.setAdCity(entity.getAdCity());
+                } else {
+                    exportEntity.setAdCity("");
+                }
+                if (entity.getAdDist() != null) {
+                    exportEntity.setAdDist(entity.getAdDist());
+                } else {
+                    exportEntity.setAdDist("");
+                }
+                if (entity.getRtuName() != null) {
+                    exportEntity.setRtuName(entity.getRtuName());
+                } else {
+                    exportEntity.setRtuName("");
+                }
+                exportEntity.setRtuCode(entity.getRtuCode());
+                String rtuKindDesc = "";
+                if (entity.getIsRain() != null && entity.getIsRain() == 1) {
+                    rtuKindDesc += "雨量站";
+                }
+                if ((entity.getIsRiver() != null && entity.getIsRiver() == 1) || (entity.getIsRes() != null && entity.getIsRes() == 1)) {
+                    if (rtuKindDesc.length() > 0) {
+                        rtuKindDesc += "/";
+                    }
+                    rtuKindDesc += "水位站";
+                }
+                if (entity.getIsGround() != null && entity.getIsGround() == 1) {
+                    if (rtuKindDesc.length() > 0) {
+                        rtuKindDesc += "/";
+                    }
+                    rtuKindDesc += "墒情站";
+                }
+                if (entity.getIsCamera() != null && entity.getIsCamera() == 1) {
+                    if (rtuKindDesc.length() > 0) {
+                        rtuKindDesc += "/";
+                    }
+                    rtuKindDesc += "视频站";
+                }
+                exportEntity.setRtuKindDesc(rtuKindDesc);
+                if (entity.getLocationDesc() != null) {
+                    exportEntity.setLocationDesc(entity.getLocationDesc());
+                } else {
+                    exportEntity.setLocationDesc("");
+                }
+                if (entity.getLng() != null) {
+                    exportEntity.setLng(entity.getLng());
+                } else {
+                    exportEntity.setLng("");
+                }
+                if (entity.getLat() != null) {
+                    exportEntity.setLat(entity.getLat());
+                } else {
+                    exportEntity.setLat("");
+                }
+                if (entity.getManageCompany() != null) {
+                    exportEntity.setManageCompany(entity.getManageCompany());
+                } else {
+                    exportEntity.setManageCompany("");
+                }
+                if (entity.getServicePersonName() != null) {
+                    exportEntity.setServicePersonName(entity.getServicePersonName());
+                } else {
+                    exportEntity.setServicePersonName("");
+                }
+                if (entity.getCreateTime() != null) {
+                    exportEntity.setCreateTime(Func.formatDate(entity.getCreateTime()));
+                } else {
+                    exportEntity.setCreateTime("");
+                }
+                if (entity.getRemainQuestion() != null) {
+                    exportEntity.setRemainQuestion(entity.getRemainQuestion());
+                } else {
+                    exportEntity.setRemainQuestion("");
+                }
+                if (entity.getRemainQuestionState() != null) {
+                    if (entity.getRemainQuestionState() == 1) {
+                        exportEntity.setRemainQuestionState("待处理");
+                    } else if (entity.getRemainQuestionState() == 2) {
+                        exportEntity.setRemainQuestionState("已处理完成");
+                    } else {
+                        exportEntity.setRemainQuestionState("");
+                    }
+                } else {
+                    exportEntity.setRemainQuestionState("");
+                }
+                if (entity.getRemainQuestionResolution() != null) {
+                    exportEntity.setRemainQuestionResolution(entity.getRemainQuestionResolution());
+                } else {
+                    exportEntity.setRemainQuestionResolution("");
+                }
+                list.add(exportEntity);
+                index += 1;
+            }
+        }
+        Map<String, Object> data = new HashMap<>();
+        data.put("status", 0);
+        String templateFilePath = this.workDir + File.separator + this.inspectionRemainingProblemsTemplate;
+        String outpath = this.workDir + File.separator + Func.formatDate(new Date());
+        File dir = new File(outpath);
+        if (!dir.exists()) {
+            if (!dir.mkdir()) {
+                return R.fail("目录创建失败");
+            }
+        }
+        String outFileName = Func.randomUUID() + ".xlsx";
+        outpath += File.separator + outFileName;
+        ExcelWriter excelWriter = EasyExcel.write(outpath).withTemplate(templateFilePath).excelType(ExcelTypeEnum.XLSX).build();
+        WriteSheet writeSheet = EasyExcel.writerSheet("信息统计表").build();
+        excelWriter.write(list, writeSheet);
+        excelWriter.finish();
+        try {
+            FileInputStream fileInputStream = new FileInputStream(new File(outpath));
+            BladeFile bladeFile = ossBuilder.template().putFile(outFileName, fileInputStream);
+            String ossPath = bladeFile.getName();
+            String p = bladeFile.getDomain();
+            log.info(ossPath);
+            log.info(p);
+            data.put("name", ossPath);
+            data.put("url", ossPath);
+            data.put("filename", "汛期(" + title + ")巡检遗留问题表");
+            data.put("status", 1);
+        } catch (FileNotFoundException e) {
+            e.printStackTrace();
+        }
+        return R.data(data);
+    }
 
-	@GetMapping("/uncloseremainingproblems/export")
-	@ApiOperationSupport(order = 3)
-	@ApiOperation(value = "当前汛期未关闭遗留问题导出", notes = "")
-	public R<Map<String, Object>> uncloseRemainingProblemsExport() {
-		EquipmentInspectionReportDTO inspectionReportDTO = new EquipmentInspectionReportDTO();
-		BladeUser user = AuthUtil.getUser();
-		if (BusinessConstant.ROLE_SYS_ADMIN.equals(user.getRoleName())) {
-			inspectionReportDTO.setAdCode(BusinessConstant.REGION_NM_ADCODE);
-		} else if (BusinessConstant.ROLE_ORG_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_SERVICE_PERSON.equals(user.getRoleName())) {
-			LambdaQueryWrapper<DeptRegionEntity> deptRegionEntityLambdaQueryWrapper = Wrappers.<DeptRegionEntity>query().lambda();
-			deptRegionEntityLambdaQueryWrapper.eq(DeptRegionEntity::getIsDeleted, 0);
-			deptRegionEntityLambdaQueryWrapper.eq(DeptRegionEntity::getDeptId, Func.toLong(user.getDeptId()));
-			DeptRegionEntity deptRegionEntity = deptRegionService.getOne(deptRegionEntityLambdaQueryWrapper);
-			inspectionReportDTO.setAdCode(deptRegionEntity.getAdcd());
-		}
-		if (inspectionReportDTO.getAdCode() != null) {
-			RegionTreeNodeEntity node = this.regionService.getRegionNode(user.getRoleName(), user.getDeptId(), inspectionReportDTO.getAdCode());
-			if (null != node) {
-				inspectionReportDTO.setExcludeCode(node.getExclude());
-			}
-		}
-		//文件标题
-		String title = "";
-		//当前时间
-		Calendar dt = Calendar.getInstance();
-		dt.setTime(new Date());
-		//处理汛期类别
-		LambdaQueryWrapper<EquipmentInspectionPlanEntity> wrapper = Wrappers.<EquipmentInspectionPlanEntity>query().lambda();
-		wrapper.eq(EquipmentInspectionPlanEntity::getIsDeleted, 0);
-		wrapper.orderByDesc(EquipmentInspectionPlanEntity::getCreateTime);
-		EquipmentInspectionPlanEntity planEntity = new EquipmentInspectionPlanEntity();
-		List<EquipmentInspectionPlanEntity> planEntityList = planService.list(wrapper);
-		if (null != planEntityList && planEntityList.size() > 0) {
-			EquipmentInspectionPlanEntity entity = planEntityList.get(0);
-			planEntity.setBeforeRainSeasonStartTime(entity.getBeforeRainSeasonStartTime());
-			planEntity.setBeforeRainSeasonEndTime(entity.getBeforeRainSeasonEndTime());
-			planEntity.setRainSeasonFirstStartTime(entity.getRainSeasonFirstStartTime());
-			planEntity.setRainSeasonFirstEndTime(entity.getRainSeasonFirstEndTime());
-			planEntity.setRainSeasonSecondStartTime(entity.getRainSeasonSecondStartTime());
-			planEntity.setRainSeasonSecondEndTime(entity.getRainSeasonSecondEndTime());
-		} else {
-			Calendar calendarStart = Calendar.getInstance();
-			Calendar calendarEnd = Calendar.getInstance();
-			//汛前上报
-			calendarStart.setTime(new Date());
-			calendarStart.set(Calendar.MONTH, 4 - 1);
-			calendarStart.set(Calendar.DAY_OF_MONTH, 1);
-			calendarStart.set(Calendar.HOUR_OF_DAY, 0);
-			calendarStart.set(Calendar.MINUTE, 0);
-			calendarStart.set(Calendar.SECOND, 0);
-			calendarEnd.setTime(new Date());
-			calendarEnd.set(Calendar.MONTH, 6 - 1);
-			calendarEnd.set(Calendar.DAY_OF_MONTH, 1);
-			calendarEnd.set(Calendar.HOUR_OF_DAY, 0);
-			calendarEnd.set(Calendar.MINUTE, 0);
-			calendarEnd.set(Calendar.SECOND, 0);
-			planEntity.setBeforeRainSeasonStartTime(calendarStart.getTime());
-			planEntity.setBeforeRainSeasonEndTime(calendarEnd.getTime());
-			//汛中第一次上报
-			calendarStart.setTime(new Date());
-			calendarStart.set(Calendar.MONTH, 6 - 1);
-			calendarStart.set(Calendar.DAY_OF_MONTH, 1);
-			calendarStart.set(Calendar.HOUR_OF_DAY, 0);
-			calendarStart.set(Calendar.MINUTE, 0);
-			calendarStart.set(Calendar.SECOND, 0);
-			calendarEnd.setTime(new Date());
-			calendarEnd.set(Calendar.MONTH, 8 - 1);
-			calendarEnd.set(Calendar.DAY_OF_MONTH, 15);
-			calendarEnd.set(Calendar.HOUR_OF_DAY, 0);
-			calendarEnd.set(Calendar.MINUTE, 0);
-			calendarEnd.set(Calendar.SECOND, 0);
-			planEntity.setRainSeasonFirstStartTime(calendarStart.getTime());
-			planEntity.setRainSeasonFirstEndTime(calendarEnd.getTime());
-			//汛中第二次上报
-			calendarStart.setTime(new Date());
-			calendarStart.set(Calendar.MONTH, 8 - 1);
-			calendarStart.set(Calendar.DAY_OF_MONTH, 15);
-			calendarStart.set(Calendar.HOUR_OF_DAY, 0);
-			calendarStart.set(Calendar.MINUTE, 0);
-			calendarStart.set(Calendar.SECOND, 0);
-			calendarEnd.setTime(new Date());
-			calendarEnd.set(Calendar.MONTH, 10 - 1);
-			calendarEnd.set(Calendar.DAY_OF_MONTH, 1);
-			calendarEnd.set(Calendar.HOUR_OF_DAY, 0);
-			calendarEnd.set(Calendar.MINUTE, 0);
-			calendarEnd.set(Calendar.SECOND, 0);
-			planEntity.setRainSeasonSecondStartTime(calendarStart.getTime());
-			planEntity.setRainSeasonSecondEndTime(calendarEnd.getTime());
-		}
-		Calendar calendarStart = Calendar.getInstance();
-		calendarStart.setTime(planEntity.getBeforeRainSeasonStartTime());
-		Calendar calendarEnd = Calendar.getInstance();
-		//汛前上报
-		calendarEnd.setTime(planEntity.getBeforeRainSeasonEndTime());
-		calendarEnd.add(Calendar.DAY_OF_MONTH, -1);
-		title = (calendarStart.get(Calendar.MONTH) + 1) + "月" + calendarStart.get(Calendar.DAY_OF_MONTH) + "日" + "-" + (calendarEnd.get(Calendar.MONTH) + 1) + "月" + calendarEnd.get(Calendar.DAY_OF_MONTH) + "日";
-		calendarEnd.setTime(planEntity.getRainSeasonFirstStartTime());
-		if ((dt.getTime().getTime() / 1000 == calendarStart.getTime().getTime() / 1000 || dt.after(calendarStart)) && dt.before(calendarEnd)) {
-			inspectionReportDTO.setRainSeasonKind(1);
-		} else {
-			//汛中第一次上报
-			calendarStart.setTime(planEntity.getRainSeasonFirstStartTime());
-			calendarEnd.setTime(planEntity.getRainSeasonFirstEndTime());
-			calendarEnd.add(Calendar.DAY_OF_MONTH, -1);
-			title = (calendarStart.get(Calendar.MONTH) + 1) + "月" + calendarStart.get(Calendar.DAY_OF_MONTH) + "日" + "-" + (calendarEnd.get(Calendar.MONTH) + 1) + "月" + calendarEnd.get(Calendar.DAY_OF_MONTH) + "日";
-			calendarEnd.setTime(planEntity.getRainSeasonFirstEndTime());
-			if ((dt.getTime().getTime() / 1000 == calendarStart.getTime().getTime() / 1000 || dt.after(calendarStart)) && dt.before(calendarEnd)) {
-				inspectionReportDTO.setRainSeasonKind(2);
-			} else {
-				//汛中第二次上报
-				calendarStart.setTime(planEntity.getRainSeasonSecondStartTime());
-				calendarEnd.setTime(planEntity.getRainSeasonSecondEndTime());
-				calendarEnd.add(Calendar.DAY_OF_MONTH, -1);
-				title = (calendarStart.get(Calendar.MONTH) + 1) + "月" + calendarStart.get(Calendar.DAY_OF_MONTH) + "日" + "-" + (calendarEnd.get(Calendar.MONTH) + 1) + "月" + calendarEnd.get(Calendar.DAY_OF_MONTH) + "日";
-				calendarEnd.setTime(dt.getTime());
-				calendarEnd.add(Calendar.YEAR, 1);
-				calendarEnd.set(Calendar.MONTH, 0);
-				calendarEnd.set(Calendar.DAY_OF_MONTH, 1);
-				calendarEnd.set(Calendar.HOUR_OF_DAY, 0);
-				calendarEnd.set(Calendar.MINUTE, 0);
-				calendarEnd.set(Calendar.SECOND, 0);
-				if ((dt.getTime().getTime() / 1000 == calendarStart.getTime().getTime() / 1000 || dt.after(calendarStart)) && dt.before(calendarEnd)) {
-					inspectionReportDTO.setRainSeasonKind(3);
-				}
-			}
-		}
-		//生成数据
-		List<EquipmentInspectionReportVO> reportEntityList = reportService.selectRainSeasonUncolseRemainingproblemsList(inspectionReportDTO);
-		List<EquipmentInspectionExportEntity> list = new LinkedList<>();
-		if (null != reportEntityList && reportEntityList.size() > 0) {
-			int index = 1;
-			for (EquipmentInspectionReportVO entity : reportEntityList) {
-				EquipmentInspectionExportEntity exportEntity = new EquipmentInspectionExportEntity();
-				exportEntity.setIndex(index);
-				if (entity.getAdCity() != null) {
-					exportEntity.setAdCity(entity.getAdCity());
-				} else {
-					exportEntity.setAdCity("");
-				}
-				if (entity.getAdDist() != null) {
-					exportEntity.setAdDist(entity.getAdDist());
-				} else {
-					exportEntity.setAdDist("");
-				}
-				if (entity.getRtuName() != null) {
-					exportEntity.setRtuName(entity.getRtuName());
-				} else {
-					exportEntity.setRtuName("");
-				}
-				exportEntity.setRtuCode(entity.getRtuCode());
-				String rtuKindDesc = "";
-				if (entity.getIsRain() != null && entity.getIsRain() == 1) {
-					rtuKindDesc += "雨量站";
-				}
-				if ((entity.getIsRiver() != null && entity.getIsRiver() == 1) || (entity.getIsRes() != null && entity.getIsRes() == 1)) {
-					if (rtuKindDesc.length() > 0) {
-						rtuKindDesc += "/";
-					}
-					rtuKindDesc += "水位站";
-				}
-				if (entity.getIsGround() != null && entity.getIsGround() == 1) {
-					if (rtuKindDesc.length() > 0) {
-						rtuKindDesc += "/";
-					}
-					rtuKindDesc += "墒情站";
-				}
-				if (entity.getIsCamera() != null && entity.getIsCamera() == 1) {
-					if (rtuKindDesc.length() > 0) {
-						rtuKindDesc += "/";
-					}
-					rtuKindDesc += "视频站";
-				}
-				exportEntity.setRtuKindDesc(rtuKindDesc);
-				if (entity.getLocationDesc() != null) {
-					exportEntity.setLocationDesc(entity.getLocationDesc());
-				} else {
-					exportEntity.setLocationDesc("");
-				}
-				if (entity.getLng() != null) {
-					exportEntity.setLng(entity.getLng());
-				} else {
-					exportEntity.setLng("");
-				}
-				if (entity.getLat() != null) {
-					exportEntity.setLat(entity.getLat());
-				} else {
-					exportEntity.setLat("");
-				}
-				if (entity.getManageCompany() != null) {
-					exportEntity.setManageCompany(entity.getManageCompany());
-				} else {
-					exportEntity.setManageCompany("");
-				}
-				if (entity.getServicePersonName() != null) {
-					exportEntity.setServicePersonName(entity.getServicePersonName());
-				} else {
-					exportEntity.setServicePersonName("");
-				}
-				if (entity.getCreateTime() != null) {
-					exportEntity.setCreateTime(Func.formatDate(entity.getCreateTime()));
-				} else {
-					exportEntity.setCreateTime("");
-				}
-				if (entity.getRemainQuestion() != null) {
-					exportEntity.setRemainQuestion(entity.getRemainQuestion());
-				} else {
-					exportEntity.setRemainQuestion("");
-				}
-				if (entity.getRemainQuestionState() != null) {
-					if (entity.getRemainQuestionState() == 1) {
-						exportEntity.setRemainQuestionState("待处理");
-					} else if (entity.getRemainQuestionState() == 2) {
-						exportEntity.setRemainQuestionState("已处理完成");
-					} else {
-						exportEntity.setRemainQuestionState("");
-					}
-				} else {
-					exportEntity.setRemainQuestionState("");
-				}
-				if (entity.getRemainQuestionResolution() != null) {
-					exportEntity.setRemainQuestionResolution(entity.getRemainQuestionResolution());
-				} else {
-					exportEntity.setRemainQuestionResolution("");
-				}
-				list.add(exportEntity);
-				index += 1;
-			}
-		}
-		Map<String, Object> data = new HashMap<>();
-		data.put("status", 0);
-		String templateFilePath = this.workDir + File.separator + this.inspectionRemainingProblemsTemplate;
-		String outpath = this.workDir + File.separator + Func.formatDate(new Date());
-		File dir = new File(outpath);
-		if (!dir.exists()) {
-			if (!dir.mkdir()) {
-				return R.fail("目录创建失败");
-			}
-		}
-		String outFileName = Func.randomUUID() + ".xlsx";
-		outpath += File.separator + outFileName;
-		ExcelWriter excelWriter = EasyExcel.write(outpath).withTemplate(templateFilePath).excelType(ExcelTypeEnum.XLSX).build();
-		WriteSheet writeSheet = EasyExcel.writerSheet("信息统计表").build();
-		excelWriter.write(list, writeSheet);
-		excelWriter.finish();
-		try {
-			FileInputStream fileInputStream = new FileInputStream(new File(outpath));
-			BladeFile bladeFile = ossBuilder.template().putFile(outFileName, fileInputStream);
-			String ossPath = bladeFile.getName();
-			String p = bladeFile.getDomain();
-			log.info(ossPath);
-			log.info(p);
-			data.put("name", ossPath);
-			data.put("url", ossPath);
-			data.put("filename", "汛期(" + title + ")巡检遗留问题表");
-			data.put("status", 1);
-		} catch (FileNotFoundException e) {
-			e.printStackTrace();
-		}
-		return R.data(data);
-	}
 
+    /**
+     * 巡检上报-无信号上报信息列表,分页
+     */
+    @GetMapping("/nonetworksignal/page")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "rtuName", value = "测站名称", paramType = "query", dataType = "string"),
+            @ApiImplicitParam(name = "rtuCode", value = "测站编码", paramType = "query", dataType = "string"),
+            @ApiImplicitParam(name = "inspectionYear", value = "巡检年度", paramType = "query", dataType = "string"),
+            @ApiImplicitParam(name = "rainSeasonKind", value = "汛期类型", paramType = "query", dataType = "int"),
+    })
+    @ApiOperationSupport(order = 2)
+    @ApiOperation(value = "无信号上报信息列表")
+    public R<IPage<EquipmentInspectionReportVO>> nonetworksignalReportPage(@ApiIgnore EquipmentInspectionReportDTO inspectionReportDTO, Query query) {
+        BladeUser user = AuthUtil.getUser();
+        if (BusinessConstant.ROLE_SYS_ADMIN.equals(user.getRoleName())) {
+            inspectionReportDTO.setAdCode(BusinessConstant.REGION_NM_ADCODE);
+            RegionTreeNodeEntity node = this.regionService.getRegionNode(user.getRoleName(), user.getDeptId(), inspectionReportDTO.getAdCode());
+            if (Func.notNull(node)) {
+                inspectionReportDTO.setExcludeCode(node.getExclude());
+            }
+        } else if (BusinessConstant.ROLE_ORG_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_SERVICE_PERSON.equals(user.getRoleName())) {
+            LambdaQueryWrapper<DeptRegionEntity> deptRegionEntityLambdaQueryWrapper = Wrappers.<DeptRegionEntity>query().lambda();
+            deptRegionEntityLambdaQueryWrapper.eq(DeptRegionEntity::getDeptId, Func.toLong(user.getDeptId()));
+            DeptRegionEntity deptRegionEntity = deptRegionService.getOne(deptRegionEntityLambdaQueryWrapper);
+            inspectionReportDTO.setAdCode(deptRegionEntity.getAdcd());
+            RegionTreeNodeEntity node = this.regionService.getRegionNode(user.getRoleName(), user.getDeptId(), inspectionReportDTO.getAdCode());
+            if (Func.notNull(node)) {
+                inspectionReportDTO.setExcludeCode(node.getExclude());
+            }
+        } else if (BusinessConstant.ROLE_QI_ADMIN.equals(user.getRoleName())) {
+            LambdaQueryWrapper<DeptRegionEntity> deptRegionEntityLambdaQueryWrapper = Wrappers.<DeptRegionEntity>query().lambda();
+            deptRegionEntityLambdaQueryWrapper.eq(DeptRegionEntity::getDeptId, Func.toLong(user.getDeptId()));
+            DeptRegionEntity deptRegionEntity = deptRegionService.getOne(deptRegionEntityLambdaQueryWrapper);
+            inspectionReportDTO.setAdCode(deptRegionEntity.getAdcd());
+        }
 
-	/**
-	 * 巡检上报-无信号上报信息列表,分页
-	 */
-	@GetMapping("/nonetworksignal/page")
-	@ApiImplicitParams({
-		@ApiImplicitParam(name = "rtuName", value = "测站名称", paramType = "query", dataType = "string"),
-		@ApiImplicitParam(name = "rtuCode", value = "测站编码", paramType = "query", dataType = "string"),
-		@ApiImplicitParam(name = "inspectionYear", value = "巡检年度", paramType = "query", dataType = "string"),
-		@ApiImplicitParam(name = "rainSeasonKind", value = "汛期类型", paramType = "query", dataType = "int"),
-	})
-	@ApiOperationSupport(order = 2)
-	@ApiOperation(value = "无信号上报信息列表")
-	public R<IPage<EquipmentInspectionReportVO>> nonetworksignalReportPage(@ApiIgnore EquipmentInspectionReportDTO inspectionReportDTO, Query query) {
-		BladeUser user = AuthUtil.getUser();
-		if (BusinessConstant.ROLE_SYS_ADMIN.equals(user.getRoleName())) {
-			inspectionReportDTO.setAdCode(BusinessConstant.REGION_NM_ADCODE);
-		} else if (BusinessConstant.ROLE_ORG_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_SERVICE_PERSON.equals(user.getRoleName())) {
-			LambdaQueryWrapper<DeptRegionEntity> deptRegionEntityLambdaQueryWrapper = Wrappers.<DeptRegionEntity>query().lambda();
-			deptRegionEntityLambdaQueryWrapper.eq(DeptRegionEntity::getIsDeleted, 0);
-			deptRegionEntityLambdaQueryWrapper.eq(DeptRegionEntity::getDeptId, Func.toLong(user.getDeptId()));
-			DeptRegionEntity deptRegionEntity = deptRegionService.getOne(deptRegionEntityLambdaQueryWrapper);
-			inspectionReportDTO.setAdCode(deptRegionEntity.getAdcd());
-		}
-		if (inspectionReportDTO.getAdCode() != null) {
-			RegionTreeNodeEntity node = this.regionService.getRegionNode(user.getRoleName(), user.getDeptId(), inspectionReportDTO.getAdCode());
-			if (null != node) {
-				inspectionReportDTO.setExcludeCode(node.getExclude());
-			}
-		}
-		if (inspectionReportDTO.getInspectionYear() != null) {
-			Date year = Func.parseDate(inspectionReportDTO.getInspectionYear(), "yyyy-MM-dd");
-			Calendar calendar = Calendar.getInstance();
-			calendar.setTime(year);
-			calendar.set(Calendar.MONTH, 0);
-			calendar.set(Calendar.DAY_OF_MONTH, 1);
-			calendar.set(Calendar.HOUR_OF_DAY, 0);
-			calendar.set(Calendar.MINUTE, 0);
-			calendar.set(Calendar.SECOND, 0);
-			inspectionReportDTO.setInspectionYearStartDate(calendar.getTime());
-			calendar.add(Calendar.YEAR, 1);
-			inspectionReportDTO.setInspectionYearEndDate(calendar.getTime());
-		} else {
-			Calendar calendar = Calendar.getInstance();
-			calendar.setTime(new Date());
-			calendar.set(Calendar.MONTH, 0);
-			calendar.set(Calendar.DAY_OF_MONTH, 1);
-			calendar.set(Calendar.HOUR_OF_DAY, 0);
-			calendar.set(Calendar.MINUTE, 0);
-			calendar.set(Calendar.SECOND, 0);
-			inspectionReportDTO.setInspectionYearStartDate(calendar.getTime());
-			calendar.add(Calendar.YEAR, 1);
-			inspectionReportDTO.setInspectionYearEndDate(calendar.getTime());
-		}
-		IPage<EquipmentInspectionReportVO> pages = reportService.selectNoNetworkSignalPage(Condition.getPage(query), inspectionReportDTO);
-		return R.data(pages);
-	}
+        if (inspectionReportDTO.getInspectionYear() != null) {
+            Date year = Func.parseDate(inspectionReportDTO.getInspectionYear(), "yyyy-MM-dd");
+            Calendar calendar = Calendar.getInstance();
+            calendar.setTime(year);
+            calendar.set(Calendar.MONTH, 0);
+            calendar.set(Calendar.DAY_OF_MONTH, 1);
+            calendar.set(Calendar.HOUR_OF_DAY, 0);
+            calendar.set(Calendar.MINUTE, 0);
+            calendar.set(Calendar.SECOND, 0);
+            inspectionReportDTO.setInspectionYearStartDate(calendar.getTime());
+            calendar.add(Calendar.YEAR, 1);
+            inspectionReportDTO.setInspectionYearEndDate(calendar.getTime());
+        } else {
+            Calendar calendar = Calendar.getInstance();
+            calendar.setTime(new Date());
+            calendar.set(Calendar.MONTH, 0);
+            calendar.set(Calendar.DAY_OF_MONTH, 1);
+            calendar.set(Calendar.HOUR_OF_DAY, 0);
+            calendar.set(Calendar.MINUTE, 0);
+            calendar.set(Calendar.SECOND, 0);
+            inspectionReportDTO.setInspectionYearStartDate(calendar.getTime());
+            calendar.add(Calendar.YEAR, 1);
+            inspectionReportDTO.setInspectionYearEndDate(calendar.getTime());
+        }
+        IPage<EquipmentInspectionReportVO> pages = reportService.selectNoNetworkSignalPage(Condition.getPage(query), inspectionReportDTO);
+        return R.data(pages);
+    }
 
-	/**
-	 * 巡检上报-无信号上报图片补交关闭
-	 *
-	 * @param reportEntity
-	 * @return
-	 */
-	@PostMapping("/nonetworksignal/close")
-	@ApiImplicitParams({
-		@ApiImplicitParam(name = "id", value = "记录ID", paramType = "query", dataType = "long"),
-	})
-	@ApiOperationSupport(order = 4)
-	@ApiOperation(value = "图片补交关闭操作", notes = "传入实体类EquipmentInspectionReportEntity")
-	public R noNetworkSignalPhotoSubmitClose(@RequestBody EquipmentInspectionReportEntity reportEntity) {
-		if (reportEntity.getId() == null) {
-			return R.fail("参数错误!");
-		}
-		EquipmentInspectionReportEntity entity = reportService.getById(reportEntity.getId());
-		if (null == entity) {
-			return R.status(false);
-		}
-		entity.setPhotoSupplementSubmitStatus(1);
+    /**
+     * 巡检上报-无信号上报图片补交关闭
+     *
+     * @param reportEntity
+     * @return
+     */
+    @PostMapping("/nonetworksignal/close")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "id", value = "记录ID", paramType = "query", dataType = "long"),
+    })
+    @ApiOperationSupport(order = 4)
+    @ApiOperation(value = "图片补交关闭操作", notes = "传入实体类EquipmentInspectionReportEntity")
+    public R noNetworkSignalPhotoSubmitClose(@RequestBody EquipmentInspectionReportEntity reportEntity) {
+        if (reportEntity.getId() == null) {
+            return R.fail("参数错误!");
+        }
+        EquipmentInspectionReportEntity entity = reportService.getById(reportEntity.getId());
+        if (null == entity) {
+            return R.status(false);
+        }
+        entity.setPhotoSupplementSubmitStatus(1);
 
-		reportService.updateById(entity);
-		return R.success("操作成功!");
-	}
+        reportService.updateById(entity);
+        return R.success("操作成功!");
+    }
 
-	@ApiLog("图片提交")
-	@PostMapping(value = "/nonetworksignal/putPhoto")
-	@ApiOperationSupport(order = 6)
-	@ApiOperation(value = "图片提交", notes = "")
-	public R putFile(MultipartFile file) {
-		BladeFile bladeFile = ossBuilder.template().putFile(file);
-		return R.data(bladeFile);
-	}
+    @ApiLog("图片提交")
+    @PostMapping(value = "/nonetworksignal/putPhoto")
+    @ApiOperationSupport(order = 6)
+    @ApiOperation(value = "图片提交", notes = "")
+    public R putFile(MultipartFile file) {
+        BladeFile bladeFile = ossBuilder.template().putFile(file);
+        return R.data(bladeFile);
+    }
 }

+ 1654 - 1640
src/main/java/org/springblade/modules/business/warning/service/impl/RtuWarningServiceImpl.java

@@ -17,6 +17,7 @@ import org.springblade.core.mp.base.BaseServiceImpl;
 import org.springblade.core.tool.jackson.JsonUtil;
 import org.springblade.core.tool.utils.ConcurrentDateFormat;
 import org.springblade.core.tool.utils.Func;
+import org.springblade.enums.EquipmentStatusEnum;
 import org.springblade.enums.WarnKindEnum;
 import org.springblade.enums.WarningActiveEnum;
 import org.springblade.enums.WarningStatusEnum;
@@ -72,1664 +73,1677 @@ import java.util.List;
 @Service
 public class RtuWarningServiceImpl extends BaseServiceImpl<RtuWarningMapper, RtuWarningInfoEntity> implements IRtuWarningService {
 
-	@Resource
-	private IRtuDataRainStoreService rainStoreService;
+    @Resource
+    private IRtuDataRainStoreService rainStoreService;
 
-	@Resource
-	private IRtuDataRiverStoreService riverStoreService;
+    @Resource
+    private IRtuDataRiverStoreService riverStoreService;
 
-	@Resource
-	private IRtuDataRsvrStoreService rsvrStoreService;
+    @Resource
+    private IRtuDataRsvrStoreService rsvrStoreService;
 
-	@Resource
-	private KafkaTemplate<String, String> kafkaTemplate;
-
-	@Resource
-	private RedisTemplate<String, String> redisTemplate;
-
-	@Value("${spring.mq-topic.ywxt-warning}")
-	private String topicYwxtWarning;
+    @Resource
+    private IRtuManageService rtuManageService;
 
-	@Value("${spring.warn-config.missout}")
-	private Integer missout;
-
-	@Value("${spring.warn-config.clock-failure-duration}")
-	private Integer clockFailureDuration;
-
-	@Value("${spring.warn-config.outlier-value}")
-	private Integer outlierValue;
-
-
-	@Override
-	public IPage<RtuWarningInfoVO> selectPage(IPage<RtuWarningInfoVO> page, RtuWarningInfoDTO rtuWarningInfoDTO) {
-		return page.setRecords(baseMapper.selectPage(page, rtuWarningInfoDTO));
-	}
-
-	@Override
-	public IPage<RtuWarningInfoVO> selectClockPage(IPage page, RtuWarningInfoDTO rtuWarningInfoDTO) {
-		return page.setRecords(baseMapper.selectClockPage(page, rtuWarningInfoDTO));
-	}
-
-	@Override
-	public IPage<RtuWarningInfoVO> selectOfflinePage(IPage<RtuWarningInfoVO> page, RtuWarningInfoDTO rtuWarningInfoDTO) {
-		return page.setRecords(baseMapper.selectOfflinePage(page, rtuWarningInfoDTO));
-	}
-
-	@Override
-	public IPage<RtuWarningInfoVO> selectOthersWarnPage(IPage<RtuWarningInfoVO> page, RtuWarningInfoDTO rtuWarningInfoDTO) {
-		return page.setRecords(baseMapper.selectOthersWarnPage(page, rtuWarningInfoDTO));
-	}
-
-	@Override
-	public IPage<RtuWarningInfoVO> selectHourMissOutPage(IPage<RtuWarningInfoVO> page, RtuWarningInfoDTO rtuWarningInfoDTO) {
-		return page.setRecords(baseMapper.selectHourMissOutPage(page, rtuWarningInfoDTO));
-	}
-
-	@Override
-	public IPage<RtuWarningInfoVO> selectRainHourMissOutPage(IPage page, RtuWarningInfoDTO rtuWarningInfoDTO) {
-		return page.setRecords(baseMapper.selectRainHourMissOutPage(page, rtuWarningInfoDTO));
-	}
-
-	@Override
-	public IPage<RtuWarningInfoVO> selectRiverHourMissOutPage(IPage page, RtuWarningInfoDTO rtuWarningInfoDTO) {
-		return page.setRecords(baseMapper.selectRiverHourMissOutPage(page, rtuWarningInfoDTO));
-	}
-
-	@Override
-	public IPage<RtuWarningInfoVO> selectMinUpDelayPage(IPage<RtuWarningInfoVO> page, RtuWarningInfoDTO rtuWarningInfoDTO) {
-		return page.setRecords(baseMapper.selectMinUpDelayPage(page, rtuWarningInfoDTO));
-	}
-
-	@Override
-	public IPage<RtuWarningInfoVO> selectHourUpDelayPage(IPage<RtuWarningInfoVO> page, RtuWarningInfoDTO rtuWarningInfoDTO) {
-		return page.setRecords(baseMapper.selectHourUpDelayPage(page, rtuWarningInfoDTO));
-	}
-
-	@Override
-	public IPage<RtuWarningInfoVO> selectRainHourUpDelayPage(IPage page, RtuWarningInfoDTO rtuWarningInfoDTO) {
-		return page.setRecords(baseMapper.selectRainHourUpDelayPage(page, rtuWarningInfoDTO));
-	}
-
-	@Override
-	public IPage<RtuWarningInfoVO> selectRiverHourUpDelayPage(IPage page, RtuWarningInfoDTO rtuWarningInfoDTO) {
-		return page.setRecords(baseMapper.selectRiverHourUpDelayPage(page, rtuWarningInfoDTO));
-	}
-
-	@Override
-	public IPage<RtuWarningInfoVO> selectOutlierValuePage(IPage page, RtuWarningInfoDTO rtuWarningInfoDTO) {
-		return page.setRecords(baseMapper.selectOutlierValuePage(page, rtuWarningInfoDTO));
-	}
-
-	@Override
-	public Long warningRtuCount(RtuWarningInfoDTO rtuWarningInfoDTO) {
-		return baseMapper.warningRtuCount(rtuWarningInfoDTO);
-	}
-
-	@Override
-	public Long warningOfflineRtuCount(RtuWarningInfoDTO rtuWarningInfoDTO) {
-		return baseMapper.warningOfflineRtuCount(rtuWarningInfoDTO);
-	}
-
-	@Override
-	public Long otherWarningRtuCount(RtuWarningInfoDTO rtuWarningInfoDTO) {
-		return baseMapper.otherWarningRtuCount(rtuWarningInfoDTO);
-	}
-
-	@Override
-	public Long warningClockRtuCount(RtuWarningInfoDTO rtuWarningInfoDTO) {
-		return this.baseMapper.warningClockRtuCount(rtuWarningInfoDTO);
-	}
-
-	@Override
-	public Long warningHourMissOutRtuCount(RtuWarningInfoDTO rtuWarningInfoDTO) {
-		return baseMapper.warningHourMissOutRtuCount(rtuWarningInfoDTO);
-	}
-
-	@Override
-	public Long warningRainHourMissOutRtuCount(RtuWarningInfoDTO rtuWarningInfoDTO) {
-		return this.baseMapper.warningRainHourMissOutRtuCount(rtuWarningInfoDTO);
-	}
-
-	@Override
-	public Long warningRiverHourMissOutRtuCount(RtuWarningInfoDTO rtuWarningInfoDTO) {
-		return this.baseMapper.warningRiverHourMissOutRtuCount(rtuWarningInfoDTO);
-	}
-
-	@Override
-	public Long warningMinUpDelayRtuCount(RtuWarningInfoDTO rtuWarningInfoDTO) {
-		return baseMapper.warningMinUpDelayRtuCount(rtuWarningInfoDTO);
-	}
-
-	@Override
-	public Long warningHourUpDelayRtuCount(RtuWarningInfoDTO rtuWarningInfoDTO) {
-		return baseMapper.warningHourUpDelayRtuCount(rtuWarningInfoDTO);
-	}
-
-	@Override
-	public Long warningRainHourUpDelayRtuCount(RtuWarningInfoDTO rtuWarningInfoDTO) {
-		return this.baseMapper.warningRainHourUpDelayRtuCount(rtuWarningInfoDTO);
-	}
-
-	@Override
-	public Long warningRiverHourUpDelayRtuCount(RtuWarningInfoDTO rtuWarningInfoDTO) {
-		return this.baseMapper.warningHourUpDelayRtuCount(rtuWarningInfoDTO);
-	}
-
-	@Override
-	public Long warningOutlierValueRtuCount(RtuWarningInfoDTO rtuWarningInfoDTO) {
-		return this.baseMapper.warningOutlierValueRtuCount(rtuWarningInfoDTO);
-	}
-
-	/**
-	 * 时钟预警
-	 *
-	 * @param rtuInfoEntity
-	 * @param checkTm
-	 * @param upTime
-	 */
-	private void clockWarnHappen(RtuInfoEntity rtuInfoEntity, Date checkTm, Date upTime) {
-		LambdaQueryWrapper<RtuWarningInfoEntity> warningWrapper = Wrappers.<RtuWarningInfoEntity>query().lambda();
-		warningWrapper.eq(RtuWarningInfoEntity::getIsDeleted, 0);
-		warningWrapper.eq(RtuWarningInfoEntity::getRtuCode, rtuInfoEntity.getRtuCode());
-		warningWrapper.eq(RtuWarningInfoEntity::getWarningStatus, WarningStatusEnum.STATUS_HAPPEN.getCode());
-		warningWrapper.eq(RtuWarningInfoEntity::getWarningKind, WarnKindEnum.WARN_CLOCK.getCode());
-		RtuWarningInfoEntity warningInfoEntity = this.getOne(warningWrapper);
-		if (null != warningInfoEntity) {
-			warningInfoEntity.setUpdateTime(checkTm);
-			this.updateById(warningInfoEntity);
-			kafkaTemplate.send(topicYwxtWarning, JsonUtil.toJson(warningInfoEntity));
-		} else {
-			RtuWarningInfoEntity entity = new RtuWarningInfoEntity();
-			entity.setRtuCode(rtuInfoEntity.getRtuCode());
-			entity.setWarningHappenTime(checkTm);
-			entity.setWarningStatus(WarningStatusEnum.STATUS_HAPPEN.getCode());
-			entity.setWarningKind(WarnKindEnum.WARN_CLOCK.getCode());
-			entity.setWarningDesc("时钟异常,服务器时间:" + Func.formatDateTime(checkTm) + "," + "测站采集时间:" + Func.formatDateTime(upTime));
-			this.save(entity);
-			kafkaTemplate.send(topicYwxtWarning, JsonUtil.toJson(entity));
-		}
-	}
-
-	/**
-	 * 时钟预警恢复
-	 *
-	 * @param rtuInfoEntity
-	 * @param checkTm
-	 */
-	private void clockWarnRecovery(RtuInfoEntity rtuInfoEntity, Date checkTm) {
-		LambdaQueryWrapper<RtuWarningInfoEntity> warningWrapper = Wrappers.<RtuWarningInfoEntity>query().lambda();
-		warningWrapper.eq(RtuWarningInfoEntity::getIsDeleted, 0);
-		warningWrapper.eq(RtuWarningInfoEntity::getRtuCode, rtuInfoEntity.getRtuCode());
-		warningWrapper.eq(RtuWarningInfoEntity::getWarningStatus, WarningStatusEnum.STATUS_HAPPEN.getCode());
-		warningWrapper.eq(RtuWarningInfoEntity::getWarningKind, WarnKindEnum.WARN_CLOCK.getCode());
-		RtuWarningInfoEntity warningInfoEntity = this.getOne(warningWrapper);
-		if (null != warningInfoEntity) {
-			//恢复
-			warningInfoEntity.setWarningRecoveryTime(checkTm);
-			warningInfoEntity.setWarningStatus(WarningStatusEnum.STATUS_CLOSE.getCode());
-			warningInfoEntity.setUpdateTime(checkTm);
-			this.updateById(warningInfoEntity);
-			kafkaTemplate.send(topicYwxtWarning, JsonUtil.toJson(warningInfoEntity));
-		}
-	}
-
-	/**
-	 * 时钟预警检测
-	 *
-	 * @param checkTm
-	 * @param upTime
-	 * @param fromDate
-	 */
-	private boolean clockWarnCheck(Date checkTm, Date upTime, Date fromDate) {
-		//检测时钟异常,情况1,上报时间比服务器时间晚,时钟错误
-		if (upTime.after(checkTm)) {
-			long tm = (upTime.getTime() - checkTm.getTime()) / 1000L;
-			if (tm > clockFailureDuration * 60) {
-				return true;
-			}
-		} else {
-			//检测时钟异常,情况2,上报时间比数据库服务器(东华)时间晚,时钟错误
-			if (upTime.after(fromDate)) {
-				long tm = (upTime.getTime() - fromDate.getTime()) / 1000L;
-				if (tm > clockFailureDuration * 60) {
-					return true;
-				}
-			}
-		}
-		return false;
-	}
-
-	@Override
-	public boolean checkRtuClockStatus(RtuInfoEntity rtuInfoEntity, RtuWarnSettingEntity warnSettingEntity, LocalDateTime checkTime) {
-		ValueOperations<String, String> ops = redisTemplate.opsForValue();
-		boolean isWarn = false;
-		StringBuilder warnDesc = new StringBuilder();
-		StringBuilder warnRecoveryDesc = new StringBuilder();
-		if (rtuInfoEntity.getIsRain() != null && rtuInfoEntity.getIsRain() == 1) {
-
-			String key = RedisBusinessConstant.KEY_ETL_RAIN_UP_LAST + rtuInfoEntity.getRtuCode();
-			String lastRainInfo = ops.get(key);
-			if (null != lastRainInfo && lastRainInfo.length() > 0) {
-				EtlRainDataEntity etlRainDataEntity = JSONObject.parseObject(lastRainInfo, EtlRainDataEntity.class);
-				LocalDateTime upTime = LocalDateTime.ofInstant(etlRainDataEntity.getTm().toInstant(), ZoneId.systemDefault());
-				LocalDateTime fromDate = LocalDateTime.ofInstant(etlRainDataEntity.getFromDate().toInstant(), ZoneId.systemDefault());
-
-				warnRecoveryDesc.append("雨量站,服务器时间:");
-				warnRecoveryDesc.append(checkTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
-				warnRecoveryDesc.append(",上报时间:");
-				warnRecoveryDesc.append(upTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
-				//检测时钟异常,情况1,上报时间比服务器时间晚,时钟错误
-				if (upTime.isAfter(checkTime)) {
-					long min = ChronoUnit.MINUTES.between(upTime, checkTime);
-					if (min > clockFailureDuration) {
-						isWarn = true;
-						warnDesc.append("雨量站时钟异常,服务器时间:");
-						warnDesc.append(checkTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
-						warnDesc.append(",上报时间:");
-						warnDesc.append(upTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
-						warnDesc.append(",时钟快");
-						warnDesc.append(Func.toStr(min));
-						warnDesc.append("分钟");
-					}
-				} else {
-					//检测时钟异常,情况2,上报时间比数据库服务器(东华)时间晚,时钟错误
-					if (upTime.isAfter(fromDate)) {
-						long min = ChronoUnit.MINUTES.between(upTime, fromDate);
-						if (min > clockFailureDuration) {
-							isWarn = true;
-							warnDesc.append("雨量站时钟异常,服务器时间:");
-							warnDesc.append(fromDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
-							warnDesc.append(",上报时间:");
-							warnDesc.append(upTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
-							warnDesc.append(",时钟快");
-							warnDesc.append(Func.toStr(min));
-							warnDesc.append("分钟");
-						}
-					}
-				}
-			}
-		}
-		if (rtuInfoEntity.getIsRiver() != null && rtuInfoEntity.getIsRiver() == 1) {
-
-			String key = RedisBusinessConstant.KEY_ETL_RIVER_UP_LAST + rtuInfoEntity.getRtuCode();
-			String lastRiverInfo = ops.get(key);
-			if (null != lastRiverInfo && lastRiverInfo.length() > 0) {
-				EtlRiverDataEntity etlRiverDataEntity = JSONObject.parseObject(lastRiverInfo, EtlRiverDataEntity.class);
-				LocalDateTime upTime = LocalDateTime.ofInstant(etlRiverDataEntity.getTm().toInstant(), ZoneId.systemDefault());
-				LocalDateTime fromDate = LocalDateTime.ofInstant(etlRiverDataEntity.getFromDate().toInstant(), ZoneId.systemDefault());
-				if (warnRecoveryDesc.length() > 0) {
-					warnRecoveryDesc.append(",");
-				}
-				warnRecoveryDesc.append("水位站,服务器时间:");
-				warnRecoveryDesc.append(checkTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
-				warnRecoveryDesc.append(",上报时间:");
-				warnRecoveryDesc.append(upTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
-				//检测时钟异常,情况1,上报时间比服务器时间晚,时钟错误
-				if (upTime.isAfter(checkTime)) {
-					long min = ChronoUnit.MINUTES.between(upTime, checkTime);
-					if (min > clockFailureDuration) {
-						isWarn = true;
-						if (warnDesc.length() > 0) {
-							warnDesc.append(",");
-						}
-						warnDesc.append("水位站时钟异常,服务器时间:");
-						warnDesc.append(checkTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
-						warnDesc.append(",上报时间:");
-						warnDesc.append(upTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
-						warnDesc.append(",时钟快");
-						warnDesc.append(Func.toStr(min));
-						warnDesc.append("分钟");
-					}
-				} else {
-					//检测时钟异常,情况2,上报时间比数据库服务器(东华)时间晚,时钟错误
-					if (upTime.isAfter(fromDate)) {
-						long min = ChronoUnit.MINUTES.between(upTime, fromDate);
-						if (min > clockFailureDuration) {
-							isWarn = true;
-							if (warnDesc.length() > 0) {
-								warnDesc.append(",");
-							}
-							warnDesc.append("水位站时钟异常,服务器时间:");
-							warnDesc.append(fromDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
-							warnDesc.append(",上报时间:");
-							warnDesc.append(upTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
-							warnDesc.append(",时钟快");
-							warnDesc.append(Func.toStr(min));
-							warnDesc.append("分钟");
-						}
-					}
-				}
-			}
-		}
-		if (rtuInfoEntity.getIsRes() != null && rtuInfoEntity.getIsRes() == 1) {
-
-			String key = RedisBusinessConstant.KEY_ETL_RSVR_UP_LAST + rtuInfoEntity.getRtuCode();
-			String lastRsvrInfo = ops.get(key);
-			if (null != lastRsvrInfo && lastRsvrInfo.length() > 0) {
-				EtlRsvrDataEntity etlRsvrDataEntity = JSONObject.parseObject(lastRsvrInfo, EtlRsvrDataEntity.class);
-				LocalDateTime upTime = LocalDateTime.ofInstant(etlRsvrDataEntity.getTm().toInstant(), ZoneId.systemDefault());
-				LocalDateTime fromDate = LocalDateTime.ofInstant(etlRsvrDataEntity.getFromDate().toInstant(), ZoneId.systemDefault());
-				if (warnRecoveryDesc.length() > 0) {
-					warnRecoveryDesc.append(",");
-				}
-				warnRecoveryDesc.append("水位站,服务器时间:");
-				warnRecoveryDesc.append(checkTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
-				warnRecoveryDesc.append(",上报时间:");
-				warnRecoveryDesc.append(upTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
-				//检测时钟异常,情况1,上报时间比服务器时间晚,时钟错误
-				if (upTime.isAfter(checkTime)) {
-					long min = ChronoUnit.MINUTES.between(upTime, checkTime);
-					if (min > clockFailureDuration) {
-						isWarn = true;
-						if (warnDesc.length() > 0) {
-							warnDesc.append(",");
-						}
-						warnDesc.append("水位站时钟异常,服务器时间:");
-						warnDesc.append(checkTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
-						warnDesc.append(",上报时间:");
-						warnDesc.append(upTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
-						warnDesc.append(",时钟快");
-						warnDesc.append(Func.toStr(min));
-						warnDesc.append("分钟");
-					}
-				} else {
-					//检测时钟异常,情况2,上报时间比数据库服务器(东华)时间晚,时钟错误
-					if (upTime.isAfter(fromDate)) {
-						long min = ChronoUnit.MINUTES.between(upTime, fromDate);
-						if (min > clockFailureDuration) {
-							isWarn = true;
-							if (warnDesc.length() > 0) {
-								warnDesc.append(",");
-							}
-							warnDesc.append("水位站时钟异常,服务器时间:");
-							warnDesc.append(fromDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
-							warnDesc.append(",上报时间:");
-							warnDesc.append(upTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
-							warnDesc.append(",时钟快");
-							warnDesc.append(Func.toStr(min));
-							warnDesc.append("分钟");
-						}
-					}
-				}
-			}
-		}
-		if (rtuInfoEntity.getIsGround() != null && rtuInfoEntity.getIsGround() == 1) {
-
-			String key = RedisBusinessConstant.KEY_ETL_GROUND_UP_LAST + rtuInfoEntity.getRtuCode();
-			String lastGroundInfo = ops.get(key);
-			if (null != lastGroundInfo && lastGroundInfo.length() > 0) {
-				EtlGroundDataEntity etlGroundDataEntity = JSONObject.parseObject(lastGroundInfo, EtlGroundDataEntity.class);
-				LocalDateTime upTime = LocalDateTime.ofInstant(etlGroundDataEntity.getTm().toInstant(), ZoneId.systemDefault());
-				LocalDateTime fromDate = LocalDateTime.ofInstant(etlGroundDataEntity.getFromDate().toInstant(), ZoneId.systemDefault());
-				if (warnRecoveryDesc.length() > 0) {
-					warnRecoveryDesc.append(",");
-				}
-				warnRecoveryDesc.append("墒情站,服务器时间:");
-				warnRecoveryDesc.append(checkTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
-				warnRecoveryDesc.append(",上报时间:");
-				warnRecoveryDesc.append(upTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
-				//检测时钟异常,情况1,上报时间比服务器时间晚,时钟错误
-				if (upTime.isAfter(checkTime)) {
-					long min = ChronoUnit.MINUTES.between(upTime, checkTime);
-					if (min > clockFailureDuration) {
-						isWarn = true;
-						if (warnDesc.length() > 0) {
-							warnDesc.append(",");
-						}
-						warnDesc.append("墒情站时钟异常,服务器时间:");
-						warnDesc.append(checkTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
-						warnDesc.append(",上报时间:");
-						warnDesc.append(upTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
-						warnDesc.append(",时钟快");
-						warnDesc.append(Func.toStr(min));
-						warnDesc.append("分钟");
-					}
-				} else {
-					//检测时钟异常,情况2,上报时间比数据库服务器(东华)时间晚,时钟错误
-					if (upTime.isAfter(fromDate)) {
-						long min = ChronoUnit.MINUTES.between(upTime, fromDate);
-						if (min > clockFailureDuration) {
-							isWarn = true;
-							if (warnDesc.length() > 0) {
-								warnDesc.append(",");
-							}
-							warnDesc.append("墒情站时钟异常,服务器时间:");
-							warnDesc.append(fromDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
-							warnDesc.append(",上报时间:");
-							warnDesc.append(upTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
-							warnDesc.append(",时钟快");
-							warnDesc.append(Func.toStr(min));
-							warnDesc.append("分钟");
-						}
-					}
-				}
-			}
-		}
-		HashOperations<String, String, String> hashops = redisTemplate.opsForHash();
-		String key = RedisBusinessConstant.KEY_RTU_RUN_INFO + rtuInfoEntity.getRtuCode();
-		String warnKindKey = RedisBusinessConstant.KEY_RTU_RUN_INFO_WARN_KIND + Func.toStr(WarnKindEnum.WARN_CLOCK.getCode());
-		String warnStatus = hashops.get(key, warnKindKey);
-		if (isWarn) {
-			//测站时钟有异常,产生预警
-			boolean isCreateWarn = false;
-			if (null != warnStatus) {
-				if (WarningStatusEnum.STATUS_CLOSE.getCode() == Func.toInt(warnStatus)) {
-					isCreateWarn = true;
-				}
-			} else {
-				LambdaQueryWrapper<RtuWarningInfoEntity> warningWrapper = Wrappers.<RtuWarningInfoEntity>query().lambda();
-				warningWrapper.eq(RtuWarningInfoEntity::getRtuCode, rtuInfoEntity.getRtuCode());
-				warningWrapper.eq(RtuWarningInfoEntity::getWarningStatus, WarningStatusEnum.STATUS_HAPPEN.getCode());
-				warningWrapper.eq(RtuWarningInfoEntity::getWarningKind, WarnKindEnum.WARN_CLOCK.getCode());
-				RtuWarningInfoEntity warningInfoEntity = this.getOne(warningWrapper);
-				if (null == warningInfoEntity) {
-					isCreateWarn = true;
-				}
-			}
-
-			if (isCreateWarn) {
-				RtuWarningInfoEntity entity = new RtuWarningInfoEntity();
-				entity.setRtuCode(rtuInfoEntity.getRtuCode());
-				entity.setWarningHappenTime(Date.from(checkTime.atZone(ZoneId.systemDefault()).toInstant()));
-				entity.setWarningStatus(WarningStatusEnum.STATUS_HAPPEN.getCode());
-				entity.setWarningKind(WarnKindEnum.WARN_CLOCK.getCode());
-				entity.setWarningDesc(warnDesc.toString());
-				this.save(entity);
-				//更新预警状态
-				hashops.put(key, warnKindKey, Func.toStr(WarningStatusEnum.STATUS_HAPPEN.getCode()));
-				//预警通知
-				kafkaTemplate.send(topicYwxtWarning, JsonUtil.toJson(entity));
-				log.info("时钟异常 {} {} {} ", rtuInfoEntity.getRtuCode(), rtuInfoEntity.getRtuName(), warnDesc.toString());
-			}
-
-			if (null == warnStatus) {
-				//更新预警状态
-				hashops.put(key, warnKindKey, Func.toStr(WarningStatusEnum.STATUS_HAPPEN.getCode()));
-			}
-		} else {
-			boolean isCloseWarn = false;
-			if (null != warnStatus) {
-				if (WarningStatusEnum.STATUS_CLOSE.getCode() == Func.toInt(warnStatus)) {
-					isCloseWarn = true;
-				}
-			} else {
-				LambdaQueryWrapper<RtuWarningInfoEntity> warningWrapper = Wrappers.<RtuWarningInfoEntity>query().lambda();
-				warningWrapper.eq(RtuWarningInfoEntity::getRtuCode, rtuInfoEntity.getRtuCode());
-				warningWrapper.eq(RtuWarningInfoEntity::getWarningStatus, WarningStatusEnum.STATUS_HAPPEN.getCode());
-				warningWrapper.eq(RtuWarningInfoEntity::getWarningKind, WarnKindEnum.WARN_CLOCK.getCode());
-				RtuWarningInfoEntity warningInfoEntity = this.getOne(warningWrapper);
-				if (null != warningInfoEntity) {
-					isCloseWarn = true;
-				}
-			}
-			if (isCloseWarn) {
-				LambdaQueryWrapper<RtuWarningInfoEntity> warningWrapper = Wrappers.<RtuWarningInfoEntity>query().lambda();
-				warningWrapper.eq(RtuWarningInfoEntity::getRtuCode, rtuInfoEntity.getRtuCode());
-				warningWrapper.eq(RtuWarningInfoEntity::getWarningStatus, WarningStatusEnum.STATUS_HAPPEN.getCode());
-				warningWrapper.eq(RtuWarningInfoEntity::getWarningKind, WarnKindEnum.WARN_CLOCK.getCode());
-				RtuWarningInfoEntity warningInfoEntity = this.getOne(warningWrapper);
-				if (null != warningInfoEntity) {
-					//恢复
-					warningInfoEntity.setWarningRecoveryDesc(warnRecoveryDesc.toString());
-					warningInfoEntity.setWarningRecoveryTime(Date.from(checkTime.atZone(ZoneId.systemDefault()).toInstant()));
-					warningInfoEntity.setWarningStatus(WarningStatusEnum.STATUS_CLOSE.getCode());
-					this.updateById(warningInfoEntity);
-					//更新预警状态
-					hashops.put(key, warnKindKey, Func.toStr(WarningStatusEnum.STATUS_CLOSE.getCode()));
-					//预警通知
-					kafkaTemplate.send(topicYwxtWarning, JsonUtil.toJson(warningInfoEntity));
-					log.info("时钟异常恢复 {} {} {} ", rtuInfoEntity.getRtuCode(), rtuInfoEntity.getRtuName(), warnRecoveryDesc.toString());
-				}
-			}
-			if (null == warnStatus) {
-				//更新预警状态
-				hashops.put(key, warnKindKey, Func.toStr(WarningStatusEnum.STATUS_CLOSE.getCode()));
-			}
-		}
-		return true;
-	}
-
-	@Override
-	public boolean checkRtuRainUpHourDelayStatus(RtuInfoEntity rtuInfoEntity, RtuWarnSettingEntity warnSettingEntity, LocalDateTime checkTime) {
+    @Resource
+    private KafkaTemplate<String, String> kafkaTemplate;
+
+    @Resource
+    private RedisTemplate<String, String> redisTemplate;
+
+    @Value("${spring.mq-topic.ywxt-warning}")
+    private String topicYwxtWarning;
+
+    @Value("${spring.warn-config.missout}")
+    private Integer missout;
+
+    @Value("${spring.warn-config.clock-failure-duration}")
+    private Integer clockFailureDuration;
+
+    @Value("${spring.warn-config.outlier-value}")
+    private Integer outlierValue;
+
+
+    @Override
+    public IPage<RtuWarningInfoVO> selectPage(IPage<RtuWarningInfoVO> page, RtuWarningInfoDTO rtuWarningInfoDTO) {
+        return page.setRecords(baseMapper.selectPage(page, rtuWarningInfoDTO));
+    }
+
+    @Override
+    public IPage<RtuWarningInfoVO> selectClockPage(IPage page, RtuWarningInfoDTO rtuWarningInfoDTO) {
+        return page.setRecords(baseMapper.selectClockPage(page, rtuWarningInfoDTO));
+    }
+
+    @Override
+    public IPage<RtuWarningInfoVO> selectOfflinePage(IPage<RtuWarningInfoVO> page, RtuWarningInfoDTO rtuWarningInfoDTO) {
+        return page.setRecords(baseMapper.selectOfflinePage(page, rtuWarningInfoDTO));
+    }
+
+    @Override
+    public IPage<RtuWarningInfoVO> selectOthersWarnPage(IPage<RtuWarningInfoVO> page, RtuWarningInfoDTO rtuWarningInfoDTO) {
+        return page.setRecords(baseMapper.selectOthersWarnPage(page, rtuWarningInfoDTO));
+    }
+
+    @Override
+    public IPage<RtuWarningInfoVO> selectHourMissOutPage(IPage<RtuWarningInfoVO> page, RtuWarningInfoDTO rtuWarningInfoDTO) {
+        return page.setRecords(baseMapper.selectHourMissOutPage(page, rtuWarningInfoDTO));
+    }
+
+    @Override
+    public IPage<RtuWarningInfoVO> selectRainHourMissOutPage(IPage page, RtuWarningInfoDTO rtuWarningInfoDTO) {
+        return page.setRecords(baseMapper.selectRainHourMissOutPage(page, rtuWarningInfoDTO));
+    }
+
+    @Override
+    public IPage<RtuWarningInfoVO> selectRiverHourMissOutPage(IPage page, RtuWarningInfoDTO rtuWarningInfoDTO) {
+        return page.setRecords(baseMapper.selectRiverHourMissOutPage(page, rtuWarningInfoDTO));
+    }
+
+    @Override
+    public IPage<RtuWarningInfoVO> selectMinUpDelayPage(IPage<RtuWarningInfoVO> page, RtuWarningInfoDTO rtuWarningInfoDTO) {
+        return page.setRecords(baseMapper.selectMinUpDelayPage(page, rtuWarningInfoDTO));
+    }
+
+    @Override
+    public IPage<RtuWarningInfoVO> selectHourUpDelayPage(IPage<RtuWarningInfoVO> page, RtuWarningInfoDTO rtuWarningInfoDTO) {
+        return page.setRecords(baseMapper.selectHourUpDelayPage(page, rtuWarningInfoDTO));
+    }
+
+    @Override
+    public IPage<RtuWarningInfoVO> selectRainHourUpDelayPage(IPage page, RtuWarningInfoDTO rtuWarningInfoDTO) {
+        return page.setRecords(baseMapper.selectRainHourUpDelayPage(page, rtuWarningInfoDTO));
+    }
+
+    @Override
+    public IPage<RtuWarningInfoVO> selectRiverHourUpDelayPage(IPage page, RtuWarningInfoDTO rtuWarningInfoDTO) {
+        return page.setRecords(baseMapper.selectRiverHourUpDelayPage(page, rtuWarningInfoDTO));
+    }
+
+    @Override
+    public IPage<RtuWarningInfoVO> selectOutlierValuePage(IPage page, RtuWarningInfoDTO rtuWarningInfoDTO) {
+        return page.setRecords(baseMapper.selectOutlierValuePage(page, rtuWarningInfoDTO));
+    }
+
+    @Override
+    public Long warningRtuCount(RtuWarningInfoDTO rtuWarningInfoDTO) {
+        return baseMapper.warningRtuCount(rtuWarningInfoDTO);
+    }
+
+    @Override
+    public Long warningOfflineRtuCount(RtuWarningInfoDTO rtuWarningInfoDTO) {
+        return baseMapper.warningOfflineRtuCount(rtuWarningInfoDTO);
+    }
+
+    @Override
+    public Long otherWarningRtuCount(RtuWarningInfoDTO rtuWarningInfoDTO) {
+        return baseMapper.otherWarningRtuCount(rtuWarningInfoDTO);
+    }
+
+    @Override
+    public Long warningClockRtuCount(RtuWarningInfoDTO rtuWarningInfoDTO) {
+        return this.baseMapper.warningClockRtuCount(rtuWarningInfoDTO);
+    }
+
+    @Override
+    public Long warningHourMissOutRtuCount(RtuWarningInfoDTO rtuWarningInfoDTO) {
+        return baseMapper.warningHourMissOutRtuCount(rtuWarningInfoDTO);
+    }
+
+    @Override
+    public Long warningRainHourMissOutRtuCount(RtuWarningInfoDTO rtuWarningInfoDTO) {
+        return this.baseMapper.warningRainHourMissOutRtuCount(rtuWarningInfoDTO);
+    }
+
+    @Override
+    public Long warningRiverHourMissOutRtuCount(RtuWarningInfoDTO rtuWarningInfoDTO) {
+        return this.baseMapper.warningRiverHourMissOutRtuCount(rtuWarningInfoDTO);
+    }
+
+    @Override
+    public Long warningMinUpDelayRtuCount(RtuWarningInfoDTO rtuWarningInfoDTO) {
+        return baseMapper.warningMinUpDelayRtuCount(rtuWarningInfoDTO);
+    }
+
+    @Override
+    public Long warningHourUpDelayRtuCount(RtuWarningInfoDTO rtuWarningInfoDTO) {
+        return baseMapper.warningHourUpDelayRtuCount(rtuWarningInfoDTO);
+    }
+
+    @Override
+    public Long warningRainHourUpDelayRtuCount(RtuWarningInfoDTO rtuWarningInfoDTO) {
+        return this.baseMapper.warningRainHourUpDelayRtuCount(rtuWarningInfoDTO);
+    }
+
+    @Override
+    public Long warningRiverHourUpDelayRtuCount(RtuWarningInfoDTO rtuWarningInfoDTO) {
+        return this.baseMapper.warningHourUpDelayRtuCount(rtuWarningInfoDTO);
+    }
+
+    @Override
+    public Long warningOutlierValueRtuCount(RtuWarningInfoDTO rtuWarningInfoDTO) {
+        return this.baseMapper.warningOutlierValueRtuCount(rtuWarningInfoDTO);
+    }
+
+    /**
+     * 时钟预警
+     *
+     * @param rtuInfoEntity
+     * @param checkTm
+     * @param upTime
+     */
+    private void clockWarnHappen(RtuInfoEntity rtuInfoEntity, Date checkTm, Date upTime) {
+        LambdaQueryWrapper<RtuWarningInfoEntity> warningWrapper = Wrappers.<RtuWarningInfoEntity>query().lambda();
+        warningWrapper.eq(RtuWarningInfoEntity::getIsDeleted, 0);
+        warningWrapper.eq(RtuWarningInfoEntity::getRtuCode, rtuInfoEntity.getRtuCode());
+        warningWrapper.eq(RtuWarningInfoEntity::getWarningStatus, WarningStatusEnum.STATUS_HAPPEN.getCode());
+        warningWrapper.eq(RtuWarningInfoEntity::getWarningKind, WarnKindEnum.WARN_CLOCK.getCode());
+        RtuWarningInfoEntity warningInfoEntity = this.getOne(warningWrapper);
+        if (null != warningInfoEntity) {
+            warningInfoEntity.setUpdateTime(checkTm);
+            this.updateById(warningInfoEntity);
+            kafkaTemplate.send(topicYwxtWarning, JsonUtil.toJson(warningInfoEntity));
+        } else {
+            RtuWarningInfoEntity entity = new RtuWarningInfoEntity();
+            entity.setRtuCode(rtuInfoEntity.getRtuCode());
+            entity.setWarningHappenTime(checkTm);
+            entity.setWarningStatus(WarningStatusEnum.STATUS_HAPPEN.getCode());
+            entity.setWarningKind(WarnKindEnum.WARN_CLOCK.getCode());
+            entity.setWarningDesc("时钟异常,服务器时间:" + Func.formatDateTime(checkTm) + "," + "测站采集时间:" + Func.formatDateTime(upTime));
+            this.save(entity);
+            kafkaTemplate.send(topicYwxtWarning, JsonUtil.toJson(entity));
+        }
+    }
+
+    /**
+     * 时钟预警恢复
+     *
+     * @param rtuInfoEntity
+     * @param checkTm
+     */
+    private void clockWarnRecovery(RtuInfoEntity rtuInfoEntity, Date checkTm) {
+        LambdaQueryWrapper<RtuWarningInfoEntity> warningWrapper = Wrappers.<RtuWarningInfoEntity>query().lambda();
+        warningWrapper.eq(RtuWarningInfoEntity::getIsDeleted, 0);
+        warningWrapper.eq(RtuWarningInfoEntity::getRtuCode, rtuInfoEntity.getRtuCode());
+        warningWrapper.eq(RtuWarningInfoEntity::getWarningStatus, WarningStatusEnum.STATUS_HAPPEN.getCode());
+        warningWrapper.eq(RtuWarningInfoEntity::getWarningKind, WarnKindEnum.WARN_CLOCK.getCode());
+        RtuWarningInfoEntity warningInfoEntity = this.getOne(warningWrapper);
+        if (null != warningInfoEntity) {
+            //恢复
+            warningInfoEntity.setWarningRecoveryTime(checkTm);
+            warningInfoEntity.setWarningStatus(WarningStatusEnum.STATUS_CLOSE.getCode());
+            warningInfoEntity.setUpdateTime(checkTm);
+            this.updateById(warningInfoEntity);
+            kafkaTemplate.send(topicYwxtWarning, JsonUtil.toJson(warningInfoEntity));
+        }
+    }
+
+    /**
+     * 时钟预警检测
+     *
+     * @param checkTm
+     * @param upTime
+     * @param fromDate
+     */
+    private boolean clockWarnCheck(Date checkTm, Date upTime, Date fromDate) {
+        //检测时钟异常,情况1,上报时间比服务器时间晚,时钟错误
+        if (upTime.after(checkTm)) {
+            long tm = (upTime.getTime() - checkTm.getTime()) / 1000L;
+            if (tm > clockFailureDuration * 60) {
+                return true;
+            }
+        } else {
+            //检测时钟异常,情况2,上报时间比数据库服务器(东华)时间晚,时钟错误
+            if (upTime.after(fromDate)) {
+                long tm = (upTime.getTime() - fromDate.getTime()) / 1000L;
+                if (tm > clockFailureDuration * 60) {
+                    return true;
+                }
+            }
+        }
+        return false;
+    }
+
+    @Override
+    public boolean checkRtuClockStatus(RtuInfoEntity rtuInfoEntity, RtuWarnSettingEntity warnSettingEntity, LocalDateTime checkTime) {
+        ValueOperations<String, String> ops = redisTemplate.opsForValue();
+        boolean isWarn = false;
+        StringBuilder warnDesc = new StringBuilder();
+        StringBuilder warnRecoveryDesc = new StringBuilder();
+        if (rtuInfoEntity.getIsRain() != null && rtuInfoEntity.getIsRain() == 1) {
+
+            String key = RedisBusinessConstant.KEY_ETL_RAIN_UP_LAST + rtuInfoEntity.getRtuCode();
+            String lastRainInfo = ops.get(key);
+            if (null != lastRainInfo && lastRainInfo.length() > 0) {
+                EtlRainDataEntity etlRainDataEntity = JSONObject.parseObject(lastRainInfo, EtlRainDataEntity.class);
+                LocalDateTime upTime = LocalDateTime.ofInstant(etlRainDataEntity.getTm().toInstant(), ZoneId.systemDefault());
+                LocalDateTime fromDate = LocalDateTime.ofInstant(etlRainDataEntity.getFromDate().toInstant(), ZoneId.systemDefault());
+
+                warnRecoveryDesc.append("雨量站,服务器时间:");
+                warnRecoveryDesc.append(checkTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
+                warnRecoveryDesc.append(",上报时间:");
+                warnRecoveryDesc.append(upTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
+                //检测时钟异常,情况1,上报时间比服务器时间晚,时钟错误
+                if (upTime.isAfter(checkTime)) {
+                    long min = ChronoUnit.MINUTES.between(upTime, checkTime);
+                    if (min > clockFailureDuration) {
+                        isWarn = true;
+                        warnDesc.append("雨量站时钟异常,服务器时间:");
+                        warnDesc.append(checkTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
+                        warnDesc.append(",上报时间:");
+                        warnDesc.append(upTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
+                        warnDesc.append(",时钟快");
+                        warnDesc.append(Func.toStr(min));
+                        warnDesc.append("分钟");
+                    }
+                } else {
+                    //检测时钟异常,情况2,上报时间比数据库服务器(东华)时间晚,时钟错误
+                    if (upTime.isAfter(fromDate)) {
+                        long min = ChronoUnit.MINUTES.between(upTime, fromDate);
+                        if (min > clockFailureDuration) {
+                            isWarn = true;
+                            warnDesc.append("雨量站时钟异常,服务器时间:");
+                            warnDesc.append(fromDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
+                            warnDesc.append(",上报时间:");
+                            warnDesc.append(upTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
+                            warnDesc.append(",时钟快");
+                            warnDesc.append(Func.toStr(min));
+                            warnDesc.append("分钟");
+                        }
+                    }
+                }
+            }
+        }
+        if (rtuInfoEntity.getIsRiver() != null && rtuInfoEntity.getIsRiver() == 1) {
+
+            String key = RedisBusinessConstant.KEY_ETL_RIVER_UP_LAST + rtuInfoEntity.getRtuCode();
+            String lastRiverInfo = ops.get(key);
+            if (null != lastRiverInfo && lastRiverInfo.length() > 0) {
+                EtlRiverDataEntity etlRiverDataEntity = JSONObject.parseObject(lastRiverInfo, EtlRiverDataEntity.class);
+                LocalDateTime upTime = LocalDateTime.ofInstant(etlRiverDataEntity.getTm().toInstant(), ZoneId.systemDefault());
+                LocalDateTime fromDate = LocalDateTime.ofInstant(etlRiverDataEntity.getFromDate().toInstant(), ZoneId.systemDefault());
+                if (warnRecoveryDesc.length() > 0) {
+                    warnRecoveryDesc.append(",");
+                }
+                warnRecoveryDesc.append("水位站,服务器时间:");
+                warnRecoveryDesc.append(checkTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
+                warnRecoveryDesc.append(",上报时间:");
+                warnRecoveryDesc.append(upTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
+                //检测时钟异常,情况1,上报时间比服务器时间晚,时钟错误
+                if (upTime.isAfter(checkTime)) {
+                    long min = ChronoUnit.MINUTES.between(upTime, checkTime);
+                    if (min > clockFailureDuration) {
+                        isWarn = true;
+                        if (warnDesc.length() > 0) {
+                            warnDesc.append(",");
+                        }
+                        warnDesc.append("水位站时钟异常,服务器时间:");
+                        warnDesc.append(checkTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
+                        warnDesc.append(",上报时间:");
+                        warnDesc.append(upTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
+                        warnDesc.append(",时钟快");
+                        warnDesc.append(Func.toStr(min));
+                        warnDesc.append("分钟");
+                    }
+                } else {
+                    //检测时钟异常,情况2,上报时间比数据库服务器(东华)时间晚,时钟错误
+                    if (upTime.isAfter(fromDate)) {
+                        long min = ChronoUnit.MINUTES.between(upTime, fromDate);
+                        if (min > clockFailureDuration) {
+                            isWarn = true;
+                            if (warnDesc.length() > 0) {
+                                warnDesc.append(",");
+                            }
+                            warnDesc.append("水位站时钟异常,服务器时间:");
+                            warnDesc.append(fromDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
+                            warnDesc.append(",上报时间:");
+                            warnDesc.append(upTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
+                            warnDesc.append(",时钟快");
+                            warnDesc.append(Func.toStr(min));
+                            warnDesc.append("分钟");
+                        }
+                    }
+                }
+            }
+        }
+        if (rtuInfoEntity.getIsRes() != null && rtuInfoEntity.getIsRes() == 1) {
+
+            String key = RedisBusinessConstant.KEY_ETL_RSVR_UP_LAST + rtuInfoEntity.getRtuCode();
+            String lastRsvrInfo = ops.get(key);
+            if (null != lastRsvrInfo && lastRsvrInfo.length() > 0) {
+                EtlRsvrDataEntity etlRsvrDataEntity = JSONObject.parseObject(lastRsvrInfo, EtlRsvrDataEntity.class);
+                LocalDateTime upTime = LocalDateTime.ofInstant(etlRsvrDataEntity.getTm().toInstant(), ZoneId.systemDefault());
+                LocalDateTime fromDate = LocalDateTime.ofInstant(etlRsvrDataEntity.getFromDate().toInstant(), ZoneId.systemDefault());
+                if (warnRecoveryDesc.length() > 0) {
+                    warnRecoveryDesc.append(",");
+                }
+                warnRecoveryDesc.append("水位站,服务器时间:");
+                warnRecoveryDesc.append(checkTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
+                warnRecoveryDesc.append(",上报时间:");
+                warnRecoveryDesc.append(upTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
+                //检测时钟异常,情况1,上报时间比服务器时间晚,时钟错误
+                if (upTime.isAfter(checkTime)) {
+                    long min = ChronoUnit.MINUTES.between(upTime, checkTime);
+                    if (min > clockFailureDuration) {
+                        isWarn = true;
+                        if (warnDesc.length() > 0) {
+                            warnDesc.append(",");
+                        }
+                        warnDesc.append("水位站时钟异常,服务器时间:");
+                        warnDesc.append(checkTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
+                        warnDesc.append(",上报时间:");
+                        warnDesc.append(upTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
+                        warnDesc.append(",时钟快");
+                        warnDesc.append(Func.toStr(min));
+                        warnDesc.append("分钟");
+                    }
+                } else {
+                    //检测时钟异常,情况2,上报时间比数据库服务器(东华)时间晚,时钟错误
+                    if (upTime.isAfter(fromDate)) {
+                        long min = ChronoUnit.MINUTES.between(upTime, fromDate);
+                        if (min > clockFailureDuration) {
+                            isWarn = true;
+                            if (warnDesc.length() > 0) {
+                                warnDesc.append(",");
+                            }
+                            warnDesc.append("水位站时钟异常,服务器时间:");
+                            warnDesc.append(fromDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
+                            warnDesc.append(",上报时间:");
+                            warnDesc.append(upTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
+                            warnDesc.append(",时钟快");
+                            warnDesc.append(Func.toStr(min));
+                            warnDesc.append("分钟");
+                        }
+                    }
+                }
+            }
+        }
+        if (rtuInfoEntity.getIsGround() != null && rtuInfoEntity.getIsGround() == 1) {
+
+            String key = RedisBusinessConstant.KEY_ETL_GROUND_UP_LAST + rtuInfoEntity.getRtuCode();
+            String lastGroundInfo = ops.get(key);
+            if (null != lastGroundInfo && lastGroundInfo.length() > 0) {
+                EtlGroundDataEntity etlGroundDataEntity = JSONObject.parseObject(lastGroundInfo, EtlGroundDataEntity.class);
+                LocalDateTime upTime = LocalDateTime.ofInstant(etlGroundDataEntity.getTm().toInstant(), ZoneId.systemDefault());
+                LocalDateTime fromDate = LocalDateTime.ofInstant(etlGroundDataEntity.getFromDate().toInstant(), ZoneId.systemDefault());
+                if (warnRecoveryDesc.length() > 0) {
+                    warnRecoveryDesc.append(",");
+                }
+                warnRecoveryDesc.append("墒情站,服务器时间:");
+                warnRecoveryDesc.append(checkTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
+                warnRecoveryDesc.append(",上报时间:");
+                warnRecoveryDesc.append(upTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
+                //检测时钟异常,情况1,上报时间比服务器时间晚,时钟错误
+                if (upTime.isAfter(checkTime)) {
+                    long min = ChronoUnit.MINUTES.between(upTime, checkTime);
+                    if (min > clockFailureDuration) {
+                        isWarn = true;
+                        if (warnDesc.length() > 0) {
+                            warnDesc.append(",");
+                        }
+                        warnDesc.append("墒情站时钟异常,服务器时间:");
+                        warnDesc.append(checkTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
+                        warnDesc.append(",上报时间:");
+                        warnDesc.append(upTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
+                        warnDesc.append(",时钟快");
+                        warnDesc.append(Func.toStr(min));
+                        warnDesc.append("分钟");
+                    }
+                } else {
+                    //检测时钟异常,情况2,上报时间比数据库服务器(东华)时间晚,时钟错误
+                    if (upTime.isAfter(fromDate)) {
+                        long min = ChronoUnit.MINUTES.between(upTime, fromDate);
+                        if (min > clockFailureDuration) {
+                            isWarn = true;
+                            if (warnDesc.length() > 0) {
+                                warnDesc.append(",");
+                            }
+                            warnDesc.append("墒情站时钟异常,服务器时间:");
+                            warnDesc.append(fromDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
+                            warnDesc.append(",上报时间:");
+                            warnDesc.append(upTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
+                            warnDesc.append(",时钟快");
+                            warnDesc.append(Func.toStr(min));
+                            warnDesc.append("分钟");
+                        }
+                    }
+                }
+            }
+        }
+        HashOperations<String, String, String> hashops = redisTemplate.opsForHash();
+        String key = RedisBusinessConstant.KEY_RTU_RUN_INFO + rtuInfoEntity.getRtuCode();
+        String warnKindKey = RedisBusinessConstant.KEY_RTU_RUN_INFO_WARN_KIND + Func.toStr(WarnKindEnum.WARN_CLOCK.getCode());
+        String warnStatus = hashops.get(key, warnKindKey);
+        if (isWarn) {
+            //测站时钟有异常,产生预警
+            boolean isCreateWarn = false;
+            if (null != warnStatus) {
+                if (WarningStatusEnum.STATUS_CLOSE.getCode() == Func.toInt(warnStatus)) {
+                    isCreateWarn = true;
+                }
+            } else {
+                LambdaQueryWrapper<RtuWarningInfoEntity> warningWrapper = Wrappers.<RtuWarningInfoEntity>query().lambda();
+                warningWrapper.eq(RtuWarningInfoEntity::getRtuCode, rtuInfoEntity.getRtuCode());
+                warningWrapper.eq(RtuWarningInfoEntity::getWarningStatus, WarningStatusEnum.STATUS_HAPPEN.getCode());
+                warningWrapper.eq(RtuWarningInfoEntity::getWarningKind, WarnKindEnum.WARN_CLOCK.getCode());
+                RtuWarningInfoEntity warningInfoEntity = this.getOne(warningWrapper);
+                if (null == warningInfoEntity) {
+                    isCreateWarn = true;
+                }
+            }
+
+            if (isCreateWarn) {
+                RtuWarningInfoEntity entity = new RtuWarningInfoEntity();
+                entity.setRtuCode(rtuInfoEntity.getRtuCode());
+                entity.setWarningHappenTime(Date.from(checkTime.atZone(ZoneId.systemDefault()).toInstant()));
+                entity.setWarningStatus(WarningStatusEnum.STATUS_HAPPEN.getCode());
+                entity.setWarningKind(WarnKindEnum.WARN_CLOCK.getCode());
+                entity.setWarningDesc(warnDesc.toString());
+                this.save(entity);
+                //更新预警状态
+                hashops.put(key, warnKindKey, Func.toStr(WarningStatusEnum.STATUS_HAPPEN.getCode()));
+                //预警通知
+                kafkaTemplate.send(topicYwxtWarning, JsonUtil.toJson(entity));
+                log.info("时钟异常 {} {} {} ", rtuInfoEntity.getRtuCode(), rtuInfoEntity.getRtuName(), warnDesc.toString());
+            }
+
+            if (null == warnStatus) {
+                //更新预警状态
+                hashops.put(key, warnKindKey, Func.toStr(WarningStatusEnum.STATUS_HAPPEN.getCode()));
+            }
+        } else {
+            boolean isCloseWarn = false;
+            if (null != warnStatus) {
+                if (WarningStatusEnum.STATUS_CLOSE.getCode() == Func.toInt(warnStatus)) {
+                    isCloseWarn = true;
+                }
+            } else {
+                LambdaQueryWrapper<RtuWarningInfoEntity> warningWrapper = Wrappers.<RtuWarningInfoEntity>query().lambda();
+                warningWrapper.eq(RtuWarningInfoEntity::getRtuCode, rtuInfoEntity.getRtuCode());
+                warningWrapper.eq(RtuWarningInfoEntity::getWarningStatus, WarningStatusEnum.STATUS_HAPPEN.getCode());
+                warningWrapper.eq(RtuWarningInfoEntity::getWarningKind, WarnKindEnum.WARN_CLOCK.getCode());
+                RtuWarningInfoEntity warningInfoEntity = this.getOne(warningWrapper);
+                if (null != warningInfoEntity) {
+                    isCloseWarn = true;
+                }
+            }
+            if (isCloseWarn) {
+                LambdaQueryWrapper<RtuWarningInfoEntity> warningWrapper = Wrappers.<RtuWarningInfoEntity>query().lambda();
+                warningWrapper.eq(RtuWarningInfoEntity::getRtuCode, rtuInfoEntity.getRtuCode());
+                warningWrapper.eq(RtuWarningInfoEntity::getWarningStatus, WarningStatusEnum.STATUS_HAPPEN.getCode());
+                warningWrapper.eq(RtuWarningInfoEntity::getWarningKind, WarnKindEnum.WARN_CLOCK.getCode());
+                RtuWarningInfoEntity warningInfoEntity = this.getOne(warningWrapper);
+                if (null != warningInfoEntity) {
+                    //恢复
+                    warningInfoEntity.setWarningRecoveryDesc(warnRecoveryDesc.toString());
+                    warningInfoEntity.setWarningRecoveryTime(Date.from(checkTime.atZone(ZoneId.systemDefault()).toInstant()));
+                    warningInfoEntity.setWarningStatus(WarningStatusEnum.STATUS_CLOSE.getCode());
+                    this.updateById(warningInfoEntity);
+                    //更新预警状态
+                    hashops.put(key, warnKindKey, Func.toStr(WarningStatusEnum.STATUS_CLOSE.getCode()));
+                    //预警通知
+                    kafkaTemplate.send(topicYwxtWarning, JsonUtil.toJson(warningInfoEntity));
+                    log.info("时钟异常恢复 {} {} {} ", rtuInfoEntity.getRtuCode(), rtuInfoEntity.getRtuName(), warnRecoveryDesc.toString());
+                }
+            }
+            if (null == warnStatus) {
+                //更新预警状态
+                hashops.put(key, warnKindKey, Func.toStr(WarningStatusEnum.STATUS_CLOSE.getCode()));
+            }
+        }
+        return true;
+    }
+
+    @Override
+    public boolean checkRtuRainUpHourDelayStatus(RtuInfoEntity rtuInfoEntity, RtuWarnSettingEntity warnSettingEntity, LocalDateTime checkTime) {
 //		if (rtuInfoEntity.getRtuCode().equals("40509005")) {
 //			log.info("40509005");
 //		}
-		ValueOperations<String, String> ops = redisTemplate.opsForValue();
-		if (rtuInfoEntity.getIsRain() != null && rtuInfoEntity.getIsRain() == 1) {
-			String key = RedisBusinessConstant.KEY_ETL_RAIN_HOUR_UP_LAST + rtuInfoEntity.getRtuCode();
-			String lastRainInfo = ops.get(key);
-			if (null != lastRainInfo && lastRainInfo.length() > 0) {
-				EtlRainDataEntity etlRainDataEntity = JSONObject.parseObject(lastRainInfo, EtlRainDataEntity.class);
-
-				Date upTime = etlRainDataEntity.getTm();
-				Date fromDate = etlRainDataEntity.getFromDate();
-				LocalDateTime tm = checkTime.minusHours(2);
-				LocalDateTime upTm = LocalDateTime.ofInstant(fromDate.toInstant(), ZoneId.systemDefault());
-				if (upTm.isEqual(tm) || upTm.isAfter(tm)) {
-					//只检测2小时前上报数据
-					HashOperations<String, String, String> hashops = redisTemplate.opsForHash();
-					String runInfokey = RedisBusinessConstant.KEY_RTU_RUN_INFO + rtuInfoEntity.getRtuCode();
-					String warnKindKey = RedisBusinessConstant.KEY_RTU_RUN_INFO_WARN_KIND + Func.toStr(WarnKindEnum.WARN_RAIN_UP_HOUR_DELAY.getCode());
-					String warnStatus = hashops.get(runInfokey, warnKindKey);
-					if (upTime.before(fromDate)) {
-						//延时时长,分
-						long delayDuration = (fromDate.getTime() - upTime.getTime()) / 1000L / 60L;
-						if (delayDuration >= warnSettingEntity.getWarnRainDelayHourDuration()) {
-							//延时异常
-							boolean isCreateWarn = false;
-							if (null != warnStatus) {
-								if (WarningStatusEnum.STATUS_CLOSE.getCode() == Func.toInt(warnStatus)) {
-									isCreateWarn = true;
-								}
-							} else {
-								LambdaQueryWrapper<RtuWarningInfoEntity> warningWrapper = Wrappers.<RtuWarningInfoEntity>query().lambda();
-								warningWrapper.eq(RtuWarningInfoEntity::getRtuCode, etlRainDataEntity.getRtuCode());
-								warningWrapper.eq(RtuWarningInfoEntity::getWarningStatus, WarningStatusEnum.STATUS_HAPPEN.getCode());
-								warningWrapper.eq(RtuWarningInfoEntity::getWarningKind, WarnKindEnum.WARN_RAIN_UP_HOUR_DELAY.getCode());
-								RtuWarningInfoEntity warningInfoEntity = this.getOne(warningWrapper);
-								if (null == warningInfoEntity) {
-									isCreateWarn = true;
-								}
-							}
-							if (isCreateWarn) {
-								RtuWarningInfoEntity entity = new RtuWarningInfoEntity();
-								entity.setRtuCode(etlRainDataEntity.getRtuCode());
-								entity.setWarningHappenTime(Date.from(checkTime.atZone(ZoneId.systemDefault()).toInstant()));
-								entity.setWarningStatus(WarningStatusEnum.STATUS_HAPPEN.getCode());
-								entity.setWarningKind(WarnKindEnum.WARN_RAIN_UP_HOUR_DELAY.getCode());
-								entity.setWarningDesc("雨情整点上报延时异常,延时设定参数:" + Func.toStr(warnSettingEntity.getWarnRainDelayHourDuration()) + "分钟,上报时间:" + Func.formatDateTime(fromDate) + ",测站采集时间:" + Func.formatDateTime(upTime) + ",延时:" + Func.toStr(delayDuration) + "分钟");
-								this.save(entity);
-								//更新预警状态
-								hashops.put(runInfokey, warnKindKey, Func.toStr(WarningStatusEnum.STATUS_HAPPEN.getCode()));
-								//预警通知
-								kafkaTemplate.send(topicYwxtWarning, JsonUtil.toJson(entity));
-								log.info("雨情整点上报延时异常 {} {} {} ", rtuInfoEntity.getRtuCode(), rtuInfoEntity.getRtuName(), entity.getWarningDesc());
-							}
-
-							if (null == warnStatus) {
-								//更新预警状态
-								hashops.put(runInfokey, warnKindKey, Func.toStr(WarningStatusEnum.STATUS_HAPPEN.getCode()));
-							}
-						} else {
-							//没有检测到预警发生,进行预警恢复操作
-							boolean isCloseWarn = false;
-							if (null != warnStatus) {
-								if (WarningStatusEnum.STATUS_CLOSE.getCode() == Func.toInt(warnStatus)) {
-									isCloseWarn = true;
-								}
-							} else {
-								LambdaQueryWrapper<RtuWarningInfoEntity> warningWrapper = Wrappers.<RtuWarningInfoEntity>query().lambda();
-								warningWrapper.eq(RtuWarningInfoEntity::getRtuCode, etlRainDataEntity.getRtuCode());
-								warningWrapper.eq(RtuWarningInfoEntity::getWarningStatus, WarningStatusEnum.STATUS_HAPPEN.getCode());
-								warningWrapper.eq(RtuWarningInfoEntity::getWarningKind, WarnKindEnum.WARN_RAIN_UP_HOUR_DELAY.getCode());
-								RtuWarningInfoEntity warningInfoEntity = this.getOne(warningWrapper);
-								if (null != warningInfoEntity) {
-									isCloseWarn = true;
-								}
-							}
-							if (isCloseWarn) {
-								LambdaQueryWrapper<RtuWarningInfoEntity> warningWrapper = Wrappers.<RtuWarningInfoEntity>query().lambda();
-								warningWrapper.eq(RtuWarningInfoEntity::getRtuCode, etlRainDataEntity.getRtuCode());
-								warningWrapper.eq(RtuWarningInfoEntity::getWarningStatus, WarningStatusEnum.STATUS_HAPPEN.getCode());
-								warningWrapper.eq(RtuWarningInfoEntity::getWarningKind, WarnKindEnum.WARN_RAIN_UP_HOUR_DELAY.getCode());
-								RtuWarningInfoEntity warningInfoEntity = this.getOne(warningWrapper);
-								if (null != warningInfoEntity) {
-									//恢复
-									warningInfoEntity.setWarningRecoveryDesc("雨情整点上报延时恢复,延时设定参数:" + Func.toStr(warnSettingEntity.getWarnRainDelayHourDuration()) + "分钟,上报时间:" + Func.formatDateTime(fromDate) + ",测站采集时间:" + Func.formatDateTime(upTime) + ",延时:" + Func.toStr(delayDuration) + "分钟");
-									warningInfoEntity.setWarningRecoveryTime(Date.from(checkTime.atZone(ZoneId.systemDefault()).toInstant()));
-									warningInfoEntity.setWarningStatus(WarningStatusEnum.STATUS_CLOSE.getCode());
-									this.updateById(warningInfoEntity);
-									//更新预警状态
-									hashops.put(runInfokey, warnKindKey, Func.toStr(WarningStatusEnum.STATUS_CLOSE.getCode()));
-									//通知
-									kafkaTemplate.send(topicYwxtWarning, JsonUtil.toJson(warningInfoEntity));
-									log.info("雨情整点上报延时恢复 {} {} {} ", rtuInfoEntity.getRtuCode(), rtuInfoEntity.getRtuName(), warningInfoEntity.getWarningRecoveryDesc());
-								}
-							}
-							if (null == warnStatus) {
-								//更新预警状态
-								hashops.put(runInfokey, warnKindKey, Func.toStr(WarningStatusEnum.STATUS_CLOSE.getCode()));
-							}
-						}
-					}
-				}
-
-			}
-		}
-		return true;
-	}
-
-	@Override
-	public boolean checkRtuRiverUpHourDelayStatus(RtuInfoEntity rtuInfoEntity, RtuWarnSettingEntity warnSettingEntity, LocalDateTime checkTime) {
-		ValueOperations<String, String> ops = redisTemplate.opsForValue();
-
-		String key = RedisBusinessConstant.KEY_ETL_RIVER_HOUR_UP_LAST + rtuInfoEntity.getRtuCode();
-		String lastRiverInfo = ops.get(key);
-		if (null != lastRiverInfo && lastRiverInfo.length() > 0) {
-			EtlRiverDataEntity etlRiverDataEntity = JSONObject.parseObject(lastRiverInfo, EtlRiverDataEntity.class);
-			Date upTime = etlRiverDataEntity.getTm();
-			Date fromDate = etlRiverDataEntity.getFromDate();
-			LocalDateTime tm = checkTime.minusHours(2);
-			LocalDateTime upTm = LocalDateTime.ofInstant(fromDate.toInstant(), ZoneId.systemDefault());
-			if (upTm.isEqual(tm) || upTm.isAfter(tm)) {
-				//只检测2小时前上报数据
-				HashOperations<String, String, String> hashops = redisTemplate.opsForHash();
-				String runInfokey = RedisBusinessConstant.KEY_RTU_RUN_INFO + rtuInfoEntity.getRtuCode();
-				String warnKindKey = RedisBusinessConstant.KEY_RTU_RUN_INFO_WARN_KIND + Func.toStr(WarnKindEnum.WARN_WL_UP_HOUR_DELAY.getCode());
-				String warnStatus = hashops.get(runInfokey, warnKindKey);
-				if (upTime.before(fromDate)) {
-					//延时时长,分
-					long delayDuration = (fromDate.getTime() - upTime.getTime()) / 1000L / 60L;
-					if (delayDuration >= warnSettingEntity.getWarnRiverDelayHourDuration()) {
-						//延时异常
-						boolean isCreateWarn = false;
-						if (null != warnStatus) {
-							if (WarningStatusEnum.STATUS_CLOSE.getCode() == Func.toInt(warnStatus)) {
-								isCreateWarn = true;
-							}
-						} else {
-							LambdaQueryWrapper<RtuWarningInfoEntity> warningWrapper = Wrappers.<RtuWarningInfoEntity>query().lambda();
-							warningWrapper.eq(RtuWarningInfoEntity::getRtuCode, etlRiverDataEntity.getRtuCode());
-							warningWrapper.eq(RtuWarningInfoEntity::getWarningStatus, WarningStatusEnum.STATUS_HAPPEN.getCode());
-							warningWrapper.eq(RtuWarningInfoEntity::getWarningKind, WarnKindEnum.WARN_WL_UP_HOUR_DELAY.getCode());
-							RtuWarningInfoEntity warningInfoEntity = this.getOne(warningWrapper);
-							if (null == warningInfoEntity) {
-								isCreateWarn = true;
-							}
-						}
-
-
-						if (isCreateWarn) {
-							RtuWarningInfoEntity entity = new RtuWarningInfoEntity();
-							entity.setRtuCode(etlRiverDataEntity.getRtuCode());
-							entity.setWarningHappenTime(Date.from(checkTime.atZone(ZoneId.systemDefault()).toInstant()));
-							entity.setWarningStatus(WarningStatusEnum.STATUS_HAPPEN.getCode());
-							entity.setWarningKind(WarnKindEnum.WARN_WL_UP_HOUR_DELAY.getCode());
-							entity.setWarningDesc("水位整点上报延时异常,延时设定参数:" + Func.toStr(warnSettingEntity.getWarnRiverDelayHourDuration()) + "分钟,上报时间:" + Func.formatDateTime(fromDate) + ",测站采集时间:" + Func.formatDateTime(upTime) + ",延时:" + Func.toStr(delayDuration) + "分钟");
-							this.save(entity);
-							//更新预警状态
-							hashops.put(runInfokey, warnKindKey, Func.toStr(WarningStatusEnum.STATUS_HAPPEN.getCode()));
-							//通知
-							kafkaTemplate.send(topicYwxtWarning, JsonUtil.toJson(entity));
-							log.info("水位整点上报延时异常 {} {} {} ", rtuInfoEntity.getRtuCode(), rtuInfoEntity.getRtuName(), entity.getWarningDesc());
-						}
-						if (null == warnStatus) {
-							//更新预警状态
-							hashops.put(runInfokey, warnKindKey, Func.toStr(WarningStatusEnum.STATUS_HAPPEN.getCode()));
-						}
-					} else {
-						//没有检测到预警发生,进行预警恢复操作
-						boolean isCloseWarn = false;
-						if (null != warnStatus) {
-							if (WarningStatusEnum.STATUS_CLOSE.getCode() == Func.toInt(warnStatus)) {
-								isCloseWarn = true;
-							}
-						} else {
-							LambdaQueryWrapper<RtuWarningInfoEntity> warningWrapper = Wrappers.<RtuWarningInfoEntity>query().lambda();
-							warningWrapper.eq(RtuWarningInfoEntity::getRtuCode, etlRiverDataEntity.getRtuCode());
-							warningWrapper.eq(RtuWarningInfoEntity::getWarningStatus, WarningStatusEnum.STATUS_HAPPEN.getCode());
-							warningWrapper.eq(RtuWarningInfoEntity::getWarningKind, WarnKindEnum.WARN_WL_UP_HOUR_DELAY.getCode());
-							RtuWarningInfoEntity warningInfoEntity = this.getOne(warningWrapper);
-							if (null != warningInfoEntity) {
-								isCloseWarn = true;
-							}
-						}
-						if (isCloseWarn) {
-							LambdaQueryWrapper<RtuWarningInfoEntity> warningWrapper = Wrappers.<RtuWarningInfoEntity>query().lambda();
-							warningWrapper.eq(RtuWarningInfoEntity::getRtuCode, etlRiverDataEntity.getRtuCode());
-							warningWrapper.eq(RtuWarningInfoEntity::getWarningStatus, WarningStatusEnum.STATUS_HAPPEN.getCode());
-							warningWrapper.eq(RtuWarningInfoEntity::getWarningKind, WarnKindEnum.WARN_WL_UP_HOUR_DELAY.getCode());
-							RtuWarningInfoEntity warningInfoEntity = this.getOne(warningWrapper);
-							if (null != warningInfoEntity) {
-								//恢复
-								warningInfoEntity.setWarningRecoveryDesc("水位整点上报延时恢复,延时设定参数:" + Func.toStr(warnSettingEntity.getWarnRiverDelayHourDuration()) + "分钟,上报时间:" + Func.formatDateTime(fromDate) + ",测站采集时间:" + Func.formatDateTime(upTime) + ",延时:" + Func.toStr(delayDuration) + "分钟");
-								warningInfoEntity.setWarningRecoveryTime(Date.from(checkTime.atZone(ZoneId.systemDefault()).toInstant()));
-								warningInfoEntity.setWarningStatus(WarningStatusEnum.STATUS_CLOSE.getCode());
-								this.updateById(warningInfoEntity);
-								//更新预警状态
-								hashops.put(runInfokey, warnKindKey, Func.toStr(WarningStatusEnum.STATUS_CLOSE.getCode()));
-								//通知
-								kafkaTemplate.send(topicYwxtWarning, JsonUtil.toJson(warningInfoEntity));
-								log.info("水位整点上报延时恢复 {} {} {} ", rtuInfoEntity.getRtuCode(), rtuInfoEntity.getRtuName(), warningInfoEntity.getWarningRecoveryDesc());
-							}
-						}
-						if (null == warnStatus) {
-							//更新预警状态
-							hashops.put(runInfokey, warnKindKey, Func.toStr(WarningStatusEnum.STATUS_CLOSE.getCode()));
-						}
-					}
-				}
-			}
-		}
-
-		return true;
-	}
-
-	@Override
-	public boolean checkRtuRsvrUpHourDelayStatus(RtuInfoEntity rtuInfoEntity, RtuWarnSettingEntity warnSettingEntity, LocalDateTime checkTime) {
-		ValueOperations<String, String> ops = redisTemplate.opsForValue();
-
-		String key = RedisBusinessConstant.KEY_ETL_RSVR_HOUR_UP_LAST + rtuInfoEntity.getRtuCode();
-		String lastRsvrInfo = ops.get(key);
-		if (null != lastRsvrInfo && lastRsvrInfo.length() > 0) {
-
-			EtlRsvrDataEntity etlRsvrDataEntity = JSONObject.parseObject(lastRsvrInfo, EtlRsvrDataEntity.class);
-			Date upTime = etlRsvrDataEntity.getTm();
-			Date fromDate = etlRsvrDataEntity.getFromDate();
-			LocalDateTime tm = checkTime.minusHours(2);
-			LocalDateTime upTm = LocalDateTime.ofInstant(fromDate.toInstant(), ZoneId.systemDefault());
-			if (upTm.isEqual(tm) || upTm.isAfter(tm)) {
-				//只检测2小时前上报数据
-
-				HashOperations<String, String, String> hashops = redisTemplate.opsForHash();
-				String runInfokey = RedisBusinessConstant.KEY_RTU_RUN_INFO + rtuInfoEntity.getRtuCode();
-				String warnKindKey = RedisBusinessConstant.KEY_RTU_RUN_INFO_WARN_KIND + Func.toStr(WarnKindEnum.WARN_WL_UP_HOUR_DELAY.getCode());
-				String warnStatus = hashops.get(runInfokey, warnKindKey);
-
-				if (upTime.before(fromDate)) {
-					//延时时长,分
-					long delayDuration = (fromDate.getTime() - upTime.getTime()) / 1000L / 60L;
-					if (delayDuration >= warnSettingEntity.getWarnRsvrDelayHourDuration()) {
-						//延时异常
-						boolean isCreateWarn = false;
-						if (null != warnStatus) {
-							if (WarningStatusEnum.STATUS_CLOSE.getCode() == Func.toInt(warnStatus)) {
-								isCreateWarn = true;
-							}
-						} else {
-							LambdaQueryWrapper<RtuWarningInfoEntity> warningWrapper = Wrappers.<RtuWarningInfoEntity>query().lambda();
-
-							warningWrapper.eq(RtuWarningInfoEntity::getRtuCode, etlRsvrDataEntity.getRtuCode());
-							warningWrapper.eq(RtuWarningInfoEntity::getWarningStatus, WarningStatusEnum.STATUS_HAPPEN.getCode());
-							warningWrapper.eq(RtuWarningInfoEntity::getWarningKind, WarnKindEnum.WARN_WL_UP_HOUR_DELAY.getCode());
-							RtuWarningInfoEntity warningInfoEntity = this.getOne(warningWrapper);
-							if (null == warningInfoEntity) {
-								isCreateWarn = true;
-							}
-						}
-
-
-						if (isCreateWarn) {
-							RtuWarningInfoEntity entity = new RtuWarningInfoEntity();
-							entity.setRtuCode(etlRsvrDataEntity.getRtuCode());
-							entity.setWarningHappenTime(Date.from(checkTime.atZone(ZoneId.systemDefault()).toInstant()));
-							entity.setWarningStatus(WarningStatusEnum.STATUS_HAPPEN.getCode());
-							entity.setWarningKind(WarnKindEnum.WARN_WL_UP_HOUR_DELAY.getCode());
-							entity.setWarningDesc("水位整点上报延时异常,延时设定参数:" + Func.toStr(warnSettingEntity.getWarnRsvrDelayHourDuration()) + "分钟,上报时间:" + Func.formatDateTime(fromDate) + ",测站采集时间:" + Func.formatDateTime(upTime) + ",延时:" + Func.toStr(delayDuration) + "分钟");
-							this.save(entity);
-							//更新预警状态
-							hashops.put(runInfokey, warnKindKey, Func.toStr(WarningStatusEnum.STATUS_HAPPEN.getCode()));
-							//通知
-							kafkaTemplate.send(topicYwxtWarning, JsonUtil.toJson(entity));
-
-							log.info("水位整点上报延时异常 {} {} {} ", rtuInfoEntity.getRtuCode(), rtuInfoEntity.getRtuName(), entity.getWarningDesc());
-						}
-
-						if (null == warnStatus) {
-							//更新预警状态
-							hashops.put(runInfokey, warnKindKey, Func.toStr(WarningStatusEnum.STATUS_HAPPEN.getCode()));
-						}
-					} else {
-						//没有检测到预警发生,进行预警恢复操作
-						boolean isCloseWarn = false;
-						if (null != warnStatus) {
-							if (WarningStatusEnum.STATUS_CLOSE.getCode() == Func.toInt(warnStatus)) {
-								isCloseWarn = true;
-							}
-						} else {
-							LambdaQueryWrapper<RtuWarningInfoEntity> warningWrapper = Wrappers.<RtuWarningInfoEntity>query().lambda();
-
-							warningWrapper.eq(RtuWarningInfoEntity::getRtuCode, etlRsvrDataEntity.getRtuCode());
-							warningWrapper.eq(RtuWarningInfoEntity::getWarningStatus, WarningStatusEnum.STATUS_HAPPEN.getCode());
-							warningWrapper.eq(RtuWarningInfoEntity::getWarningKind, WarnKindEnum.WARN_WL_UP_HOUR_DELAY.getCode());
-							RtuWarningInfoEntity warningInfoEntity = this.getOne(warningWrapper);
-							if (null != warningInfoEntity) {
-								isCloseWarn = true;
-							}
-						}
-
-						if (isCloseWarn) {
-							LambdaQueryWrapper<RtuWarningInfoEntity> warningWrapper = Wrappers.<RtuWarningInfoEntity>query().lambda();
-							warningWrapper.eq(RtuWarningInfoEntity::getIsDeleted, 0);
-							warningWrapper.eq(RtuWarningInfoEntity::getRtuCode, etlRsvrDataEntity.getRtuCode());
-							warningWrapper.eq(RtuWarningInfoEntity::getWarningStatus, WarningStatusEnum.STATUS_HAPPEN.getCode());
-							warningWrapper.eq(RtuWarningInfoEntity::getWarningKind, WarnKindEnum.WARN_WL_UP_HOUR_DELAY.getCode());
-							RtuWarningInfoEntity warningInfoEntity = this.getOne(warningWrapper);
-							if (null != warningInfoEntity) {
-								//恢复
-								warningInfoEntity.setWarningRecoveryDesc("水位整点上报延时恢复,延时设定参数:" + Func.toStr(warnSettingEntity.getWarnRsvrDelayHourDuration()) + "分钟,上报时间:" + Func.formatDateTime(fromDate) + ",测站采集时间:" + Func.formatDateTime(upTime) + ",延时:" + Func.toStr(delayDuration) + "分钟");
-								warningInfoEntity.setWarningRecoveryTime(Date.from(checkTime.atZone(ZoneId.systemDefault()).toInstant()));
-								warningInfoEntity.setWarningStatus(WarningStatusEnum.STATUS_CLOSE.getCode());
-								this.updateById(warningInfoEntity);
-								//更新预警状态
-								hashops.put(runInfokey, warnKindKey, Func.toStr(WarningStatusEnum.STATUS_CLOSE.getCode()));
-								//通知
-								kafkaTemplate.send(topicYwxtWarning, JsonUtil.toJson(warningInfoEntity));
-
-								log.info("水位整点上报延时恢复 {} {} {} ", rtuInfoEntity.getRtuCode(), rtuInfoEntity.getRtuName(), warningInfoEntity.getWarningRecoveryDesc());
-							}
-						}
-
-						if (null == warnStatus) {
-							//更新预警状态
-							hashops.put(runInfokey, warnKindKey, Func.toStr(WarningStatusEnum.STATUS_CLOSE.getCode()));
-						}
-					}
-				}
-			}
-		}
-
-		return true;
-	}
-
-	/**
-	 * 5分钟雨量站上报延时检测
-	 *
-	 * @param rtuInfoEntity
-	 * @param warnSettingEntity
-	 * @param checkTime
-	 * @return
-	 */
-	@Override
-	public boolean checkRtuRainUpDelayStatus(RtuInfoEntity rtuInfoEntity, RtuWarnSettingEntity warnSettingEntity, LocalDateTime checkTime) {
+        ValueOperations<String, String> ops = redisTemplate.opsForValue();
+        if (rtuInfoEntity.getIsRain() != null && rtuInfoEntity.getIsRain() == 1) {
+            String key = RedisBusinessConstant.KEY_ETL_RAIN_HOUR_UP_LAST + rtuInfoEntity.getRtuCode();
+            String lastRainInfo = ops.get(key);
+            if (null != lastRainInfo && lastRainInfo.length() > 0) {
+                EtlRainDataEntity etlRainDataEntity = JSONObject.parseObject(lastRainInfo, EtlRainDataEntity.class);
+
+                Date upTime = etlRainDataEntity.getTm();
+                Date fromDate = etlRainDataEntity.getFromDate();
+                LocalDateTime tm = checkTime.minusHours(2);
+                LocalDateTime upTm = LocalDateTime.ofInstant(fromDate.toInstant(), ZoneId.systemDefault());
+                if (upTm.isEqual(tm) || upTm.isAfter(tm)) {
+                    //只检测2小时前上报数据
+                    HashOperations<String, String, String> hashops = redisTemplate.opsForHash();
+                    String runInfokey = RedisBusinessConstant.KEY_RTU_RUN_INFO + rtuInfoEntity.getRtuCode();
+                    String warnKindKey = RedisBusinessConstant.KEY_RTU_RUN_INFO_WARN_KIND + Func.toStr(WarnKindEnum.WARN_RAIN_UP_HOUR_DELAY.getCode());
+                    String warnStatus = hashops.get(runInfokey, warnKindKey);
+                    if (upTime.before(fromDate)) {
+                        //延时时长,分
+                        long delayDuration = (fromDate.getTime() - upTime.getTime()) / 1000L / 60L;
+                        if (delayDuration >= warnSettingEntity.getWarnRainDelayHourDuration()) {
+                            //延时异常
+                            boolean isCreateWarn = false;
+                            if (null != warnStatus) {
+                                if (WarningStatusEnum.STATUS_CLOSE.getCode() == Func.toInt(warnStatus)) {
+                                    isCreateWarn = true;
+                                }
+                            } else {
+                                LambdaQueryWrapper<RtuWarningInfoEntity> warningWrapper = Wrappers.<RtuWarningInfoEntity>query().lambda();
+                                warningWrapper.eq(RtuWarningInfoEntity::getRtuCode, etlRainDataEntity.getRtuCode());
+                                warningWrapper.eq(RtuWarningInfoEntity::getWarningStatus, WarningStatusEnum.STATUS_HAPPEN.getCode());
+                                warningWrapper.eq(RtuWarningInfoEntity::getWarningKind, WarnKindEnum.WARN_RAIN_UP_HOUR_DELAY.getCode());
+                                RtuWarningInfoEntity warningInfoEntity = this.getOne(warningWrapper);
+                                if (null == warningInfoEntity) {
+                                    isCreateWarn = true;
+                                }
+                            }
+                            if (isCreateWarn) {
+                                RtuWarningInfoEntity entity = new RtuWarningInfoEntity();
+                                entity.setRtuCode(etlRainDataEntity.getRtuCode());
+                                entity.setWarningHappenTime(Date.from(checkTime.atZone(ZoneId.systemDefault()).toInstant()));
+                                entity.setWarningStatus(WarningStatusEnum.STATUS_HAPPEN.getCode());
+                                entity.setWarningKind(WarnKindEnum.WARN_RAIN_UP_HOUR_DELAY.getCode());
+                                entity.setWarningDesc("雨情整点上报延时异常,延时设定参数:" + Func.toStr(warnSettingEntity.getWarnRainDelayHourDuration()) + "分钟,上报时间:" + Func.formatDateTime(fromDate) + ",测站采集时间:" + Func.formatDateTime(upTime) + ",延时:" + Func.toStr(delayDuration) + "分钟");
+                                this.save(entity);
+                                //更新预警状态
+                                hashops.put(runInfokey, warnKindKey, Func.toStr(WarningStatusEnum.STATUS_HAPPEN.getCode()));
+                                //预警通知
+                                kafkaTemplate.send(topicYwxtWarning, JsonUtil.toJson(entity));
+                                log.info("雨情整点上报延时异常 {} {} {} ", rtuInfoEntity.getRtuCode(), rtuInfoEntity.getRtuName(), entity.getWarningDesc());
+                            }
+
+                            if (null == warnStatus) {
+                                //更新预警状态
+                                hashops.put(runInfokey, warnKindKey, Func.toStr(WarningStatusEnum.STATUS_HAPPEN.getCode()));
+                            }
+                        } else {
+                            //没有检测到预警发生,进行预警恢复操作
+                            boolean isCloseWarn = false;
+                            if (null != warnStatus) {
+                                if (WarningStatusEnum.STATUS_CLOSE.getCode() == Func.toInt(warnStatus)) {
+                                    isCloseWarn = true;
+                                }
+                            } else {
+                                LambdaQueryWrapper<RtuWarningInfoEntity> warningWrapper = Wrappers.<RtuWarningInfoEntity>query().lambda();
+                                warningWrapper.eq(RtuWarningInfoEntity::getRtuCode, etlRainDataEntity.getRtuCode());
+                                warningWrapper.eq(RtuWarningInfoEntity::getWarningStatus, WarningStatusEnum.STATUS_HAPPEN.getCode());
+                                warningWrapper.eq(RtuWarningInfoEntity::getWarningKind, WarnKindEnum.WARN_RAIN_UP_HOUR_DELAY.getCode());
+                                RtuWarningInfoEntity warningInfoEntity = this.getOne(warningWrapper);
+                                if (null != warningInfoEntity) {
+                                    isCloseWarn = true;
+                                }
+                            }
+                            if (isCloseWarn) {
+                                LambdaQueryWrapper<RtuWarningInfoEntity> warningWrapper = Wrappers.<RtuWarningInfoEntity>query().lambda();
+                                warningWrapper.eq(RtuWarningInfoEntity::getRtuCode, etlRainDataEntity.getRtuCode());
+                                warningWrapper.eq(RtuWarningInfoEntity::getWarningStatus, WarningStatusEnum.STATUS_HAPPEN.getCode());
+                                warningWrapper.eq(RtuWarningInfoEntity::getWarningKind, WarnKindEnum.WARN_RAIN_UP_HOUR_DELAY.getCode());
+                                RtuWarningInfoEntity warningInfoEntity = this.getOne(warningWrapper);
+                                if (null != warningInfoEntity) {
+                                    //恢复
+                                    warningInfoEntity.setWarningRecoveryDesc("雨情整点上报延时恢复,延时设定参数:" + Func.toStr(warnSettingEntity.getWarnRainDelayHourDuration()) + "分钟,上报时间:" + Func.formatDateTime(fromDate) + ",测站采集时间:" + Func.formatDateTime(upTime) + ",延时:" + Func.toStr(delayDuration) + "分钟");
+                                    warningInfoEntity.setWarningRecoveryTime(Date.from(checkTime.atZone(ZoneId.systemDefault()).toInstant()));
+                                    warningInfoEntity.setWarningStatus(WarningStatusEnum.STATUS_CLOSE.getCode());
+                                    this.updateById(warningInfoEntity);
+                                    //更新预警状态
+                                    hashops.put(runInfokey, warnKindKey, Func.toStr(WarningStatusEnum.STATUS_CLOSE.getCode()));
+                                    //通知
+                                    kafkaTemplate.send(topicYwxtWarning, JsonUtil.toJson(warningInfoEntity));
+                                    log.info("雨情整点上报延时恢复 {} {} {} ", rtuInfoEntity.getRtuCode(), rtuInfoEntity.getRtuName(), warningInfoEntity.getWarningRecoveryDesc());
+                                }
+                            }
+                            if (null == warnStatus) {
+                                //更新预警状态
+                                hashops.put(runInfokey, warnKindKey, Func.toStr(WarningStatusEnum.STATUS_CLOSE.getCode()));
+                            }
+                        }
+                    }
+                }
+
+            }
+        }
+        return true;
+    }
+
+    @Override
+    public boolean checkRtuRiverUpHourDelayStatus(RtuInfoEntity rtuInfoEntity, RtuWarnSettingEntity warnSettingEntity, LocalDateTime checkTime) {
+        ValueOperations<String, String> ops = redisTemplate.opsForValue();
+
+        String key = RedisBusinessConstant.KEY_ETL_RIVER_HOUR_UP_LAST + rtuInfoEntity.getRtuCode();
+        String lastRiverInfo = ops.get(key);
+        if (null != lastRiverInfo && lastRiverInfo.length() > 0) {
+            EtlRiverDataEntity etlRiverDataEntity = JSONObject.parseObject(lastRiverInfo, EtlRiverDataEntity.class);
+            Date upTime = etlRiverDataEntity.getTm();
+            Date fromDate = etlRiverDataEntity.getFromDate();
+            LocalDateTime tm = checkTime.minusHours(2);
+            LocalDateTime upTm = LocalDateTime.ofInstant(fromDate.toInstant(), ZoneId.systemDefault());
+            if (upTm.isEqual(tm) || upTm.isAfter(tm)) {
+                //只检测2小时前上报数据
+                HashOperations<String, String, String> hashops = redisTemplate.opsForHash();
+                String runInfokey = RedisBusinessConstant.KEY_RTU_RUN_INFO + rtuInfoEntity.getRtuCode();
+                String warnKindKey = RedisBusinessConstant.KEY_RTU_RUN_INFO_WARN_KIND + Func.toStr(WarnKindEnum.WARN_WL_UP_HOUR_DELAY.getCode());
+                String warnStatus = hashops.get(runInfokey, warnKindKey);
+                if (upTime.before(fromDate)) {
+                    //延时时长,分
+                    long delayDuration = (fromDate.getTime() - upTime.getTime()) / 1000L / 60L;
+                    if (delayDuration >= warnSettingEntity.getWarnRiverDelayHourDuration()) {
+                        //延时异常
+                        boolean isCreateWarn = false;
+                        if (null != warnStatus) {
+                            if (WarningStatusEnum.STATUS_CLOSE.getCode() == Func.toInt(warnStatus)) {
+                                isCreateWarn = true;
+                            }
+                        } else {
+                            LambdaQueryWrapper<RtuWarningInfoEntity> warningWrapper = Wrappers.<RtuWarningInfoEntity>query().lambda();
+                            warningWrapper.eq(RtuWarningInfoEntity::getRtuCode, etlRiverDataEntity.getRtuCode());
+                            warningWrapper.eq(RtuWarningInfoEntity::getWarningStatus, WarningStatusEnum.STATUS_HAPPEN.getCode());
+                            warningWrapper.eq(RtuWarningInfoEntity::getWarningKind, WarnKindEnum.WARN_WL_UP_HOUR_DELAY.getCode());
+                            RtuWarningInfoEntity warningInfoEntity = this.getOne(warningWrapper);
+                            if (null == warningInfoEntity) {
+                                isCreateWarn = true;
+                            }
+                        }
+
+
+                        if (isCreateWarn) {
+                            RtuWarningInfoEntity entity = new RtuWarningInfoEntity();
+                            entity.setRtuCode(etlRiverDataEntity.getRtuCode());
+                            entity.setWarningHappenTime(Date.from(checkTime.atZone(ZoneId.systemDefault()).toInstant()));
+                            entity.setWarningStatus(WarningStatusEnum.STATUS_HAPPEN.getCode());
+                            entity.setWarningKind(WarnKindEnum.WARN_WL_UP_HOUR_DELAY.getCode());
+                            entity.setWarningDesc("水位整点上报延时异常,延时设定参数:" + Func.toStr(warnSettingEntity.getWarnRiverDelayHourDuration()) + "分钟,上报时间:" + Func.formatDateTime(fromDate) + ",测站采集时间:" + Func.formatDateTime(upTime) + ",延时:" + Func.toStr(delayDuration) + "分钟");
+                            this.save(entity);
+                            //更新预警状态
+                            hashops.put(runInfokey, warnKindKey, Func.toStr(WarningStatusEnum.STATUS_HAPPEN.getCode()));
+                            //通知
+                            kafkaTemplate.send(topicYwxtWarning, JsonUtil.toJson(entity));
+                            log.info("水位整点上报延时异常 {} {} {} ", rtuInfoEntity.getRtuCode(), rtuInfoEntity.getRtuName(), entity.getWarningDesc());
+                        }
+                        if (null == warnStatus) {
+                            //更新预警状态
+                            hashops.put(runInfokey, warnKindKey, Func.toStr(WarningStatusEnum.STATUS_HAPPEN.getCode()));
+                        }
+                    } else {
+                        //没有检测到预警发生,进行预警恢复操作
+                        boolean isCloseWarn = false;
+                        if (null != warnStatus) {
+                            if (WarningStatusEnum.STATUS_CLOSE.getCode() == Func.toInt(warnStatus)) {
+                                isCloseWarn = true;
+                            }
+                        } else {
+                            LambdaQueryWrapper<RtuWarningInfoEntity> warningWrapper = Wrappers.<RtuWarningInfoEntity>query().lambda();
+                            warningWrapper.eq(RtuWarningInfoEntity::getRtuCode, etlRiverDataEntity.getRtuCode());
+                            warningWrapper.eq(RtuWarningInfoEntity::getWarningStatus, WarningStatusEnum.STATUS_HAPPEN.getCode());
+                            warningWrapper.eq(RtuWarningInfoEntity::getWarningKind, WarnKindEnum.WARN_WL_UP_HOUR_DELAY.getCode());
+                            RtuWarningInfoEntity warningInfoEntity = this.getOne(warningWrapper);
+                            if (null != warningInfoEntity) {
+                                isCloseWarn = true;
+                            }
+                        }
+                        if (isCloseWarn) {
+                            LambdaQueryWrapper<RtuWarningInfoEntity> warningWrapper = Wrappers.<RtuWarningInfoEntity>query().lambda();
+                            warningWrapper.eq(RtuWarningInfoEntity::getRtuCode, etlRiverDataEntity.getRtuCode());
+                            warningWrapper.eq(RtuWarningInfoEntity::getWarningStatus, WarningStatusEnum.STATUS_HAPPEN.getCode());
+                            warningWrapper.eq(RtuWarningInfoEntity::getWarningKind, WarnKindEnum.WARN_WL_UP_HOUR_DELAY.getCode());
+                            RtuWarningInfoEntity warningInfoEntity = this.getOne(warningWrapper);
+                            if (null != warningInfoEntity) {
+                                //恢复
+                                warningInfoEntity.setWarningRecoveryDesc("水位整点上报延时恢复,延时设定参数:" + Func.toStr(warnSettingEntity.getWarnRiverDelayHourDuration()) + "分钟,上报时间:" + Func.formatDateTime(fromDate) + ",测站采集时间:" + Func.formatDateTime(upTime) + ",延时:" + Func.toStr(delayDuration) + "分钟");
+                                warningInfoEntity.setWarningRecoveryTime(Date.from(checkTime.atZone(ZoneId.systemDefault()).toInstant()));
+                                warningInfoEntity.setWarningStatus(WarningStatusEnum.STATUS_CLOSE.getCode());
+                                this.updateById(warningInfoEntity);
+                                //更新预警状态
+                                hashops.put(runInfokey, warnKindKey, Func.toStr(WarningStatusEnum.STATUS_CLOSE.getCode()));
+                                //通知
+                                kafkaTemplate.send(topicYwxtWarning, JsonUtil.toJson(warningInfoEntity));
+                                log.info("水位整点上报延时恢复 {} {} {} ", rtuInfoEntity.getRtuCode(), rtuInfoEntity.getRtuName(), warningInfoEntity.getWarningRecoveryDesc());
+                            }
+                        }
+                        if (null == warnStatus) {
+                            //更新预警状态
+                            hashops.put(runInfokey, warnKindKey, Func.toStr(WarningStatusEnum.STATUS_CLOSE.getCode()));
+                        }
+                    }
+                }
+            }
+        }
+
+        return true;
+    }
+
+    @Override
+    public boolean checkRtuRsvrUpHourDelayStatus(RtuInfoEntity rtuInfoEntity, RtuWarnSettingEntity warnSettingEntity, LocalDateTime checkTime) {
+        ValueOperations<String, String> ops = redisTemplate.opsForValue();
+
+        String key = RedisBusinessConstant.KEY_ETL_RSVR_HOUR_UP_LAST + rtuInfoEntity.getRtuCode();
+        String lastRsvrInfo = ops.get(key);
+        if (null != lastRsvrInfo && lastRsvrInfo.length() > 0) {
+
+            EtlRsvrDataEntity etlRsvrDataEntity = JSONObject.parseObject(lastRsvrInfo, EtlRsvrDataEntity.class);
+            Date upTime = etlRsvrDataEntity.getTm();
+            Date fromDate = etlRsvrDataEntity.getFromDate();
+            LocalDateTime tm = checkTime.minusHours(2);
+            LocalDateTime upTm = LocalDateTime.ofInstant(fromDate.toInstant(), ZoneId.systemDefault());
+            if (upTm.isEqual(tm) || upTm.isAfter(tm)) {
+                //只检测2小时前上报数据
+
+                HashOperations<String, String, String> hashops = redisTemplate.opsForHash();
+                String runInfokey = RedisBusinessConstant.KEY_RTU_RUN_INFO + rtuInfoEntity.getRtuCode();
+                String warnKindKey = RedisBusinessConstant.KEY_RTU_RUN_INFO_WARN_KIND + Func.toStr(WarnKindEnum.WARN_WL_UP_HOUR_DELAY.getCode());
+                String warnStatus = hashops.get(runInfokey, warnKindKey);
+
+                if (upTime.before(fromDate)) {
+                    //延时时长,分
+                    long delayDuration = (fromDate.getTime() - upTime.getTime()) / 1000L / 60L;
+                    if (delayDuration >= warnSettingEntity.getWarnRsvrDelayHourDuration()) {
+                        //延时异常
+                        boolean isCreateWarn = false;
+                        if (null != warnStatus) {
+                            if (WarningStatusEnum.STATUS_CLOSE.getCode() == Func.toInt(warnStatus)) {
+                                isCreateWarn = true;
+                            }
+                        } else {
+                            LambdaQueryWrapper<RtuWarningInfoEntity> warningWrapper = Wrappers.<RtuWarningInfoEntity>query().lambda();
+
+                            warningWrapper.eq(RtuWarningInfoEntity::getRtuCode, etlRsvrDataEntity.getRtuCode());
+                            warningWrapper.eq(RtuWarningInfoEntity::getWarningStatus, WarningStatusEnum.STATUS_HAPPEN.getCode());
+                            warningWrapper.eq(RtuWarningInfoEntity::getWarningKind, WarnKindEnum.WARN_WL_UP_HOUR_DELAY.getCode());
+                            RtuWarningInfoEntity warningInfoEntity = this.getOne(warningWrapper);
+                            if (null == warningInfoEntity) {
+                                isCreateWarn = true;
+                            }
+                        }
+
+
+                        if (isCreateWarn) {
+                            RtuWarningInfoEntity entity = new RtuWarningInfoEntity();
+                            entity.setRtuCode(etlRsvrDataEntity.getRtuCode());
+                            entity.setWarningHappenTime(Date.from(checkTime.atZone(ZoneId.systemDefault()).toInstant()));
+                            entity.setWarningStatus(WarningStatusEnum.STATUS_HAPPEN.getCode());
+                            entity.setWarningKind(WarnKindEnum.WARN_WL_UP_HOUR_DELAY.getCode());
+                            entity.setWarningDesc("水位整点上报延时异常,延时设定参数:" + Func.toStr(warnSettingEntity.getWarnRsvrDelayHourDuration()) + "分钟,上报时间:" + Func.formatDateTime(fromDate) + ",测站采集时间:" + Func.formatDateTime(upTime) + ",延时:" + Func.toStr(delayDuration) + "分钟");
+                            this.save(entity);
+                            //更新预警状态
+                            hashops.put(runInfokey, warnKindKey, Func.toStr(WarningStatusEnum.STATUS_HAPPEN.getCode()));
+                            //通知
+                            kafkaTemplate.send(topicYwxtWarning, JsonUtil.toJson(entity));
+
+                            log.info("水位整点上报延时异常 {} {} {} ", rtuInfoEntity.getRtuCode(), rtuInfoEntity.getRtuName(), entity.getWarningDesc());
+                        }
+
+                        if (null == warnStatus) {
+                            //更新预警状态
+                            hashops.put(runInfokey, warnKindKey, Func.toStr(WarningStatusEnum.STATUS_HAPPEN.getCode()));
+                        }
+                    } else {
+                        //没有检测到预警发生,进行预警恢复操作
+                        boolean isCloseWarn = false;
+                        if (null != warnStatus) {
+                            if (WarningStatusEnum.STATUS_CLOSE.getCode() == Func.toInt(warnStatus)) {
+                                isCloseWarn = true;
+                            }
+                        } else {
+                            LambdaQueryWrapper<RtuWarningInfoEntity> warningWrapper = Wrappers.<RtuWarningInfoEntity>query().lambda();
+
+                            warningWrapper.eq(RtuWarningInfoEntity::getRtuCode, etlRsvrDataEntity.getRtuCode());
+                            warningWrapper.eq(RtuWarningInfoEntity::getWarningStatus, WarningStatusEnum.STATUS_HAPPEN.getCode());
+                            warningWrapper.eq(RtuWarningInfoEntity::getWarningKind, WarnKindEnum.WARN_WL_UP_HOUR_DELAY.getCode());
+                            RtuWarningInfoEntity warningInfoEntity = this.getOne(warningWrapper);
+                            if (null != warningInfoEntity) {
+                                isCloseWarn = true;
+                            }
+                        }
+
+                        if (isCloseWarn) {
+                            LambdaQueryWrapper<RtuWarningInfoEntity> warningWrapper = Wrappers.<RtuWarningInfoEntity>query().lambda();
+                            warningWrapper.eq(RtuWarningInfoEntity::getIsDeleted, 0);
+                            warningWrapper.eq(RtuWarningInfoEntity::getRtuCode, etlRsvrDataEntity.getRtuCode());
+                            warningWrapper.eq(RtuWarningInfoEntity::getWarningStatus, WarningStatusEnum.STATUS_HAPPEN.getCode());
+                            warningWrapper.eq(RtuWarningInfoEntity::getWarningKind, WarnKindEnum.WARN_WL_UP_HOUR_DELAY.getCode());
+                            RtuWarningInfoEntity warningInfoEntity = this.getOne(warningWrapper);
+                            if (null != warningInfoEntity) {
+                                //恢复
+                                warningInfoEntity.setWarningRecoveryDesc("水位整点上报延时恢复,延时设定参数:" + Func.toStr(warnSettingEntity.getWarnRsvrDelayHourDuration()) + "分钟,上报时间:" + Func.formatDateTime(fromDate) + ",测站采集时间:" + Func.formatDateTime(upTime) + ",延时:" + Func.toStr(delayDuration) + "分钟");
+                                warningInfoEntity.setWarningRecoveryTime(Date.from(checkTime.atZone(ZoneId.systemDefault()).toInstant()));
+                                warningInfoEntity.setWarningStatus(WarningStatusEnum.STATUS_CLOSE.getCode());
+                                this.updateById(warningInfoEntity);
+                                //更新预警状态
+                                hashops.put(runInfokey, warnKindKey, Func.toStr(WarningStatusEnum.STATUS_CLOSE.getCode()));
+                                //通知
+                                kafkaTemplate.send(topicYwxtWarning, JsonUtil.toJson(warningInfoEntity));
+
+                                log.info("水位整点上报延时恢复 {} {} {} ", rtuInfoEntity.getRtuCode(), rtuInfoEntity.getRtuName(), warningInfoEntity.getWarningRecoveryDesc());
+                            }
+                        }
+
+                        if (null == warnStatus) {
+                            //更新预警状态
+                            hashops.put(runInfokey, warnKindKey, Func.toStr(WarningStatusEnum.STATUS_CLOSE.getCode()));
+                        }
+                    }
+                }
+            }
+        }
+
+        return true;
+    }
+
+    /**
+     * 5分钟雨量站上报延时检测
+     *
+     * @param rtuInfoEntity
+     * @param warnSettingEntity
+     * @param checkTime
+     * @return
+     */
+    @Override
+    public boolean checkRtuRainUpDelayStatus(RtuInfoEntity rtuInfoEntity, RtuWarnSettingEntity warnSettingEntity, LocalDateTime checkTime) {
 //		if (rtuInfoEntity.getRtuCode().equals("40517675")) {
 //			log.info("40517675");
 //		}
 
-		LocalDateTime startTime = checkTime.minusHours(1);
-		RtuDataRainDTO dataRainDTO = new RtuDataRainDTO();
-		dataRainDTO.setRtuCode(rtuInfoEntity.getRtuCode());
-		Instant instant = startTime.atZone(ZoneId.systemDefault()).toInstant();
-		dataRainDTO.setBeginTime(Date.from(instant));
-		List<RtuDataRainStoreEntity> rainStoreEntityList = this.rainStoreService.selectList(dataRainDTO);
-		if (null != rainStoreEntityList && rainStoreEntityList.size() >= 2) {
-			boolean isWarn = false;
-			Date firstUpTime = new Date();
-			Date firstFromTime = new Date();
-			Date secondUpTime = new Date();
-			Date secondFromTime = new Date();
-			long secondDelayDuration = 0;
-			long firstDelayDuration = 0;
-			for (int i = rainStoreEntityList.size(); i > 1; i--) {
-				RtuDataRainStoreEntity firstUp = rainStoreEntityList.get(i - 2);
-				boolean isBeforeWarn = false;
-				firstUpTime = firstUp.getTm();
-				firstFromTime = firstUp.getFromTime();
-				firstDelayDuration = 0;
-				if (firstUpTime.before(firstFromTime)) {
-					//延时时长
-					firstDelayDuration = (firstFromTime.getTime() - firstUpTime.getTime()) / 1000L;
-					if (firstDelayDuration > warnSettingEntity.getWarnRainDelayMinDuration() * 60) {
-						isBeforeWarn = true;
-					}
-				}
-				RtuDataRainStoreEntity secondUp = rainStoreEntityList.get(i - 1);
-				boolean isNowWarn = false;
-				secondUpTime = secondUp.getTm();
-				secondFromTime = secondUp.getFromTime();
-				secondDelayDuration = 0;
-				if (secondUpTime.before(secondFromTime)) {
-					//延时时长,秒
-					secondDelayDuration = (secondFromTime.getTime() - secondUpTime.getTime()) / 1000L;
-					if (secondDelayDuration > warnSettingEntity.getWarnRainDelayMinDuration() * 60) {
-						isNowWarn = true;
-					}
-				}
-				if (isBeforeWarn && isNowWarn) {
-					isWarn = true;
-					break;
-				}
-			}
-			HashOperations<String, String, String> hashops = redisTemplate.opsForHash();
-			String key = RedisBusinessConstant.KEY_RTU_RUN_INFO + rtuInfoEntity.getRtuCode();
-			String warnKindKey = RedisBusinessConstant.KEY_RTU_RUN_INFO_WARN_KIND + Func.toStr(WarnKindEnum.WARN_UP_MIN_DELAY.getCode());
-			String warnStatus = hashops.get(key, warnKindKey);
-			if (isWarn) {
-				//延时异常
-				boolean isCreateWarn = false;
-				if (null != warnStatus) {
-					if (WarningStatusEnum.STATUS_CLOSE.getCode() == Func.toInt(warnStatus)) {
-						isCreateWarn = true;
-					}
-				} else {
-					LambdaQueryWrapper<RtuWarningInfoEntity> warningWrapper = Wrappers.<RtuWarningInfoEntity>query().lambda();
-					warningWrapper.eq(RtuWarningInfoEntity::getRtuCode, rtuInfoEntity.getRtuCode());
-					warningWrapper.eq(RtuWarningInfoEntity::getWarningStatus, WarningStatusEnum.STATUS_HAPPEN.getCode());
-					warningWrapper.eq(RtuWarningInfoEntity::getWarningKind, WarnKindEnum.WARN_UP_MIN_DELAY.getCode());
-					RtuWarningInfoEntity warningInfoEntity = this.getOne(warningWrapper);
-					if (null == warningInfoEntity) {
-						isCreateWarn = true;
-					}
-				}
-				if (isCreateWarn) {
-					RtuWarningInfoEntity warningInfoEntity = new RtuWarningInfoEntity();
-					warningInfoEntity.setRtuCode(rtuInfoEntity.getRtuCode());
-					warningInfoEntity.setWarningHappenTime(Date.from(checkTime.atZone(ZoneId.systemDefault()).toInstant()));
-					warningInfoEntity.setWarningStatus(WarningStatusEnum.STATUS_HAPPEN.getCode());
-					warningInfoEntity.setWarningKind(WarnKindEnum.WARN_UP_MIN_DELAY.getCode());
-					String desc = "雨情5分钟上报延时异常,延时设定参数:" + Func.toStr(warnSettingEntity.getWarnRainDelayMinDuration()) + "分钟";
-					desc += ",第一个报文上报时间:" + Func.formatDateTime(firstFromTime) + " 采集时间:" + Func.formatDateTime(firstUpTime) + " 延时:" + Func.toStr(firstDelayDuration / 60L) + "分";
-					desc += ",第二个报文上报时间:" + Func.formatDateTime(secondFromTime) + " 采集时间:" + Func.formatDateTime(secondUpTime) + " 延时:" + Func.toStr(secondDelayDuration / 60L) + "分";
-					warningInfoEntity.setWarningDesc(desc);
-					this.save(warningInfoEntity);
-					//更新预警状态
-					hashops.put(key, warnKindKey, Func.toStr(WarningStatusEnum.STATUS_HAPPEN.getCode()));
-					//预警通知
-					kafkaTemplate.send(topicYwxtWarning, JsonUtil.toJson(warningInfoEntity));
-					log.info("雨情5分钟上报延时异常 {} {} {}", rtuInfoEntity.getRtuCode(), rtuInfoEntity.getRtuName(), desc);
-				}
-				if (null == warnStatus) {
-					//更新预警状态
-					hashops.put(key, warnKindKey, Func.toStr(WarningStatusEnum.STATUS_HAPPEN.getCode()));
-				}
-			} else {
-				//没有检测到预警发生,进行预警恢复操作
-				boolean isCloseWarn = false;
-				if (null != warnStatus) {
-					if (WarningStatusEnum.STATUS_HAPPEN.getCode() == Func.toInt(warnStatus)) {
-						isCloseWarn = true;
-					}
-				} else {
-					LambdaQueryWrapper<RtuWarningInfoEntity> warningWrapper = Wrappers.<RtuWarningInfoEntity>query().lambda();
-					warningWrapper.eq(RtuWarningInfoEntity::getRtuCode, rtuInfoEntity.getRtuCode());
-					warningWrapper.eq(RtuWarningInfoEntity::getWarningStatus, WarningStatusEnum.STATUS_HAPPEN.getCode());
-					warningWrapper.eq(RtuWarningInfoEntity::getWarningKind, WarnKindEnum.WARN_UP_MIN_DELAY.getCode());
-					RtuWarningInfoEntity warningInfoEntity = this.getOne(warningWrapper);
-					if (null != warningInfoEntity) {
-						isCloseWarn = true;
-					}
-				}
-				if (isCloseWarn) {
-					LambdaQueryWrapper<RtuWarningInfoEntity> warningWrapper = Wrappers.<RtuWarningInfoEntity>query().lambda();
-					warningWrapper.eq(RtuWarningInfoEntity::getRtuCode, rtuInfoEntity.getRtuCode());
-					warningWrapper.eq(RtuWarningInfoEntity::getWarningStatus, WarningStatusEnum.STATUS_HAPPEN.getCode());
-					warningWrapper.eq(RtuWarningInfoEntity::getWarningKind, WarnKindEnum.WARN_UP_MIN_DELAY.getCode());
-					RtuWarningInfoEntity warningInfoEntity = this.getOne(warningWrapper);
-					if (null != warningInfoEntity) {
-						//恢复
-						warningInfoEntity.setWarningRecoveryTime(Date.from(checkTime.atZone(ZoneId.systemDefault()).toInstant()));
-						warningInfoEntity.setWarningStatus(WarningStatusEnum.STATUS_CLOSE.getCode());
-						String desc = "雨情5分钟上报延时恢复,延时设定参数:" + Func.toStr(warnSettingEntity.getWarnRainDelayMinDuration()) + "分钟";
-						desc += ",第一个报文上报时间:" + Func.formatDateTime(firstFromTime) + " 采集时间:" + Func.formatDateTime(firstUpTime) + " 延时:" + Func.toStr(firstDelayDuration / 60L) + "分";
-						desc += ",第二个报文上报时间:" + Func.formatDateTime(secondFromTime) + " 采集时间:" + Func.formatDateTime(secondUpTime) + " 延时:" + Func.toStr(secondDelayDuration / 60L) + "分";
-						warningInfoEntity.setWarningRecoveryDesc(desc);
-						this.updateById(warningInfoEntity);
-						//更新预警状态
-						hashops.put(key, warnKindKey, Func.toStr(WarningStatusEnum.STATUS_CLOSE.getCode()));
-						//预警通知
-						kafkaTemplate.send(topicYwxtWarning, JsonUtil.toJson(warningInfoEntity));
-						log.info("雨情5分钟上报延时恢复 {} {} {}", rtuInfoEntity.getRtuCode(), rtuInfoEntity.getRtuName(), desc);
-					}
-				}
-				if (null == warnStatus) {
-					//更新预警状态
-					hashops.put(key, warnKindKey, Func.toStr(WarningStatusEnum.STATUS_CLOSE.getCode()));
-				}
-			}
-		}
-
-		return true;
-	}
-
-	/**
-	 * 离线检测
-	 *
-	 * @param rtuInfoEntity
-	 * @param warnSettingEntity
-	 * @param checkTime
-	 * @return
-	 */
-	@Override
-	public boolean checkRtuOfflineStatus(RtuInfoEntity rtuInfoEntity, RtuWarnSettingEntity warnSettingEntity, LocalDateTime checkTime) {
-//		if (rtuInfoEntity.getRtuCode().equals("01718525")) {
-//			log.info("01718525");
-//		}
-		boolean isOffline = false;
-		int checkCount = 0;
-		int warnCount = 0;
-		String offlineDurationSettingText = "";
-		String offlineDurationText = "";
-		boolean hasUp = false;
-		HashOperations<String, String, String> hashops = redisTemplate.opsForHash();
-		String key = RedisBusinessConstant.KEY_RTU_RUN_INFO + rtuInfoEntity.getRtuCode();
-		String lastDatetimeText = hashops.get(key, RedisBusinessConstant.KEY_RTU_RUN_INFO_LAST_TIME);
-		if (null != lastDatetimeText && lastDatetimeText.length() > 0) {
-			hasUp = true;
-			LocalDateTime lastDateTime = LocalDateTime.parse(lastDatetimeText, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
-			if (checkTime.isEqual(lastDateTime) || checkTime.isAfter(lastDateTime)) {
-				long day = ChronoUnit.DAYS.between(lastDateTime, checkTime);
-				offlineDurationText = Func.toStr(day) + "天";
-				long hours = ChronoUnit.HOURS.between(lastDateTime, checkTime);
-				if (hours > 0) {
-					offlineDurationText += Func.toStr(hours % 24) + "小时";
-				}
-				//雨量站
-				if (rtuInfoEntity.getIsRain() != null && rtuInfoEntity.getIsRain() == 1) {
-					checkCount += 1;
-					if (hours >= warnSettingEntity.getWarnRainOfflineDuration()) {
-						warnCount += 1;
-						offlineDurationSettingText += "雨量站阀值(小时):" + Func.toStr(warnSettingEntity.getWarnRainOfflineDuration());
-					}
-				}
-				//河道水位站,水库水位站
-				if (rtuInfoEntity.getIsRiver() != null && rtuInfoEntity.getIsRiver() == 1) {
-					checkCount += 1;
-					if (hours >= warnSettingEntity.getWarnRiverOfflineDuration()) {
-						warnCount += 1;
-						if (offlineDurationSettingText.length() > 0) {
-							offlineDurationSettingText += ",";
-						}
-						offlineDurationSettingText += "水位站阀值(小时):" + Func.toStr(warnSettingEntity.getWarnRiverOfflineDuration());
-					}
-				} else if (rtuInfoEntity.getIsRes() != null && rtuInfoEntity.getIsRes() == 1) {
-					checkCount += 1;
-					if (hours >= warnSettingEntity.getWarnRsvrOfflineDuration()) {
-						warnCount += 1;
-						if (offlineDurationSettingText.length() > 0) {
-							offlineDurationSettingText += ",";
-						}
-						offlineDurationSettingText += "水位站阀值(小时):" + Func.toStr(warnSettingEntity.getWarnRsvrOfflineDuration());
-					}
-				}
-				//墒情站
-				if (rtuInfoEntity.getIsGround() != null && rtuInfoEntity.getIsGround() == 1) {
-					checkCount += 1;
-					if (hours >= warnSettingEntity.getWarnGroundOfflineDuration()) {
-						warnCount += 1;
-						if (offlineDurationSettingText.length() > 0) {
-							offlineDurationSettingText += ",";
-						}
-						offlineDurationSettingText += "墒情站阀值(小时):" + Func.toStr(warnSettingEntity.getWarnGroundOfflineDuration());
-					}
-				}
-			}
-		} else {
-			String offlineCheckLastTimeText = hashops.get(key, RedisBusinessConstant.KEY_RTU_RUN_INFO_OFFLINE_CHECK_POINT_TIME);
-			if (null != offlineCheckLastTimeText && offlineCheckLastTimeText.length() > 0) {
-				LocalDateTime lastDateTime = LocalDateTime.parse(offlineCheckLastTimeText, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
-				long hours = ChronoUnit.HOURS.between(lastDateTime, checkTime);
-				//雨量站
-				if (rtuInfoEntity.getIsRain() != null && rtuInfoEntity.getIsRain() == 1) {
-					checkCount += 1;
-					if (hours >= warnSettingEntity.getWarnRainOfflineDuration()) {
-						warnCount += 1;
-						offlineDurationSettingText += "雨量站阀值(小时):" + Func.toStr(warnSettingEntity.getWarnRainOfflineDuration());
-					}
-				}
-				//河道水位站,水库水位站
-				if (rtuInfoEntity.getIsRiver() != null && rtuInfoEntity.getIsRiver() == 1) {
-					checkCount += 1;
-					if (hours >= warnSettingEntity.getWarnRiverOfflineDuration()) {
-						warnCount += 1;
-						if (offlineDurationSettingText.length() > 0) {
-							offlineDurationSettingText += ",";
-						}
-						offlineDurationSettingText += "水位站阀值(小时):" + Func.toStr(warnSettingEntity.getWarnRiverOfflineDuration());
-					}
-				} else if (rtuInfoEntity.getIsRes() != null && rtuInfoEntity.getIsRes() == 1) {
-					checkCount += 1;
-					if (hours >= warnSettingEntity.getWarnRsvrOfflineDuration()) {
-						warnCount += 1;
-						if (offlineDurationSettingText.length() > 0) {
-							offlineDurationSettingText += ",";
-						}
-						offlineDurationSettingText += "水位站阀值(小时):" + Func.toStr(warnSettingEntity.getWarnRsvrOfflineDuration());
-					}
-				}
-				//墒情站
-				if (rtuInfoEntity.getIsGround() != null && rtuInfoEntity.getIsGround() == 1) {
-					checkCount += 1;
-					if (hours >= warnSettingEntity.getWarnGroundOfflineDuration()) {
-						warnCount += 1;
-						if (offlineDurationSettingText.length() > 0) {
-							offlineDurationSettingText += ",";
-						}
-						offlineDurationSettingText += "墒情站阀值(小时):" + Func.toStr(warnSettingEntity.getWarnGroundOfflineDuration());
-					}
-				}
-			} else {
-				hashops.put(key, RedisBusinessConstant.KEY_RTU_RUN_INFO_OFFLINE_CHECK_POINT_TIME, checkTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
-			}
-		}
-		String warnKindKey = RedisBusinessConstant.KEY_RTU_RUN_INFO_WARN_KIND + Func.toStr(WarnKindEnum.WARN_OFFLINE.getCode());
-		String warnStatus = hashops.get(key, warnKindKey);
-		if (checkCount > 0) {
-			//所有检测对像都已经离线时,产生离线预警
-			if (checkCount == warnCount) {
-				//触发预警
-				boolean isCreateWarn = false;
-				if (null != warnStatus) {
-					if (WarningStatusEnum.STATUS_CLOSE.getCode() == Func.toInt(warnStatus)) {
-						isCreateWarn = true;
-					}
-				} else {
-					LambdaQueryWrapper<RtuWarningInfoEntity> warningWrapper = Wrappers.<RtuWarningInfoEntity>query().lambda();
-					warningWrapper.eq(RtuWarningInfoEntity::getRtuCode, rtuInfoEntity.getRtuCode());
-					warningWrapper.eq(RtuWarningInfoEntity::getWarningStatus, WarningStatusEnum.STATUS_HAPPEN.getCode());
-					warningWrapper.eq(RtuWarningInfoEntity::getWarningKind, WarnKindEnum.WARN_OFFLINE.getCode());
-					RtuWarningInfoEntity warningInfoEntity = this.getOne(warningWrapper);
-					if (null == warningInfoEntity) {
-						isCreateWarn = true;
-					}
-				}
-
-				if (isCreateWarn) {
-					RtuWarningInfoEntity entity = new RtuWarningInfoEntity();
-					entity.setRtuCode(rtuInfoEntity.getRtuCode());
-					entity.setWarningHappenTime(Date.from(checkTime.atZone(ZoneId.systemDefault()).toInstant()));
-					entity.setWarningStatus(WarningStatusEnum.STATUS_HAPPEN.getCode());
-					entity.setWarningKind(WarnKindEnum.WARN_OFFLINE.getCode());
-					if (null != lastDatetimeText && lastDatetimeText.length() > 0) {
-						LocalDateTime lastDateTime = LocalDateTime.parse(lastDatetimeText, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
-						entity.setRtuLastTime(Date.from(lastDateTime.atZone(ZoneId.systemDefault()).toInstant()));
-						entity.setWarningDesc("测站离线异常,检测时间:" + Func.formatDateTime(entity.getWarningHappenTime()) + ",测站最后上线时间:" + Func.formatDateTime(entity.getRtuLastTime()) + ",离线设定参数:" + offlineDurationSettingText);
-					} else {
-						entity.setWarningDesc("测站离线异常,检测时间:" + Func.formatDateTime(entity.getWarningHappenTime()) + ",未检测到数据上报,离线设定参数:" + offlineDurationSettingText);
-					}
-					this.save(entity);
-					//更新预警状态
-					hashops.put(key, warnKindKey, Func.toStr(WarningStatusEnum.STATUS_HAPPEN.getCode()));
-					//预警通知
-					kafkaTemplate.send(topicYwxtWarning, JsonUtil.toJson(entity));
-					log.info("测站离线异常 {} {} {}", rtuInfoEntity.getRtuCode(), rtuInfoEntity.getRtuName(), entity.getWarningDesc());
-				}
-				if (null == warnStatus) {
-					//更新预警状态
-					hashops.put(key, warnKindKey, Func.toStr(WarningStatusEnum.STATUS_HAPPEN.getCode()));
-				}
-				isOffline = true;
-			} else {
-				if (hasUp) {
-					boolean isCloseWarn = false;
-					if (null != warnStatus) {
-						if (WarningStatusEnum.STATUS_HAPPEN.getCode() == Func.toInt(warnStatus)) {
-							isCloseWarn = true;
-						}
-					} else {
-						LambdaQueryWrapper<RtuWarningInfoEntity> warningWrapper = Wrappers.<RtuWarningInfoEntity>query().lambda();
-						warningWrapper.eq(RtuWarningInfoEntity::getRtuCode, rtuInfoEntity.getRtuCode());
-						warningWrapper.eq(RtuWarningInfoEntity::getWarningStatus, WarningStatusEnum.STATUS_HAPPEN.getCode());
-						warningWrapper.eq(RtuWarningInfoEntity::getWarningKind, WarnKindEnum.WARN_OFFLINE.getCode());
-						RtuWarningInfoEntity warningInfoEntity = this.getOne(warningWrapper);
-						if (null != warningInfoEntity) {
-							isCloseWarn = true;
-						}
-					}
-					if (isCloseWarn) {
-						//恢复
-						LambdaQueryWrapper<RtuWarningInfoEntity> warningWrapper = Wrappers.<RtuWarningInfoEntity>query().lambda();
-						warningWrapper.eq(RtuWarningInfoEntity::getRtuCode, rtuInfoEntity.getRtuCode());
-						warningWrapper.eq(RtuWarningInfoEntity::getWarningStatus, WarningStatusEnum.STATUS_HAPPEN.getCode());
-						warningWrapper.eq(RtuWarningInfoEntity::getWarningKind, WarnKindEnum.WARN_OFFLINE.getCode());
-						RtuWarningInfoEntity warningInfoEntity = this.getOne(warningWrapper);
-						if (null != warningInfoEntity) {
-							String warningRecoveryDesc = "";
-							LocalDateTime lastDateTime = LocalDateTime.parse(lastDatetimeText, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
-							warningRecoveryDesc = "测站离线异常恢复,检测时间:" + Func.formatDateTime(Date.from(checkTime.atZone(ZoneId.systemDefault()).toInstant())) + ",测站恢复上线时间:" + Func.formatDateTime(Date.from(lastDateTime.atZone(ZoneId.systemDefault()).toInstant())) + ",离线设定参数:" + offlineDurationSettingText + ",测站离线时长:" + offlineDurationText;
-							warningInfoEntity.setWarningRecoveryDesc(warningRecoveryDesc);
-							warningInfoEntity.setWarningRecoveryTime(Date.from(checkTime.atZone(ZoneId.systemDefault()).toInstant()));
-							warningInfoEntity.setWarningStatus(WarningStatusEnum.STATUS_CLOSE.getCode());
-							this.updateById(warningInfoEntity);
-							//更新预警状态
-							hashops.put(key, warnKindKey, Func.toStr(WarningStatusEnum.STATUS_CLOSE.getCode()));
-							//预警通知
-							kafkaTemplate.send(topicYwxtWarning, JsonUtil.toJson(warningInfoEntity));
-							log.info("测站离线异常恢复 {} {} {}", rtuInfoEntity.getRtuCode(), rtuInfoEntity.getRtuName(), warningRecoveryDesc);
-						}
-					}
-				}
-				if (null == warnStatus) {
-					//更新预警状态
-					hashops.put(key, warnKindKey, Func.toStr(WarningStatusEnum.STATUS_CLOSE.getCode()));
-				}
-			}
-		}
-		return isOffline;
-	}
-
-	@Override
-	public boolean checkRtuRainMissOutStatus(RtuInfoEntity rtuInfoEntity, RtuWarnSettingEntity warnSettingEntity, LocalDateTime checkTime) {
+        LocalDateTime startTime = checkTime.minusHours(1);
+        RtuDataRainDTO dataRainDTO = new RtuDataRainDTO();
+        dataRainDTO.setRtuCode(rtuInfoEntity.getRtuCode());
+        Instant instant = startTime.atZone(ZoneId.systemDefault()).toInstant();
+        dataRainDTO.setBeginTime(Date.from(instant));
+        List<RtuDataRainStoreEntity> rainStoreEntityList = this.rainStoreService.selectList(dataRainDTO);
+        if (null != rainStoreEntityList && rainStoreEntityList.size() >= 2) {
+            boolean isWarn = false;
+            Date firstUpTime = new Date();
+            Date firstFromTime = new Date();
+            Date secondUpTime = new Date();
+            Date secondFromTime = new Date();
+            long secondDelayDuration = 0;
+            long firstDelayDuration = 0;
+            for (int i = rainStoreEntityList.size(); i > 1; i--) {
+                RtuDataRainStoreEntity firstUp = rainStoreEntityList.get(i - 2);
+                boolean isBeforeWarn = false;
+                firstUpTime = firstUp.getTm();
+                firstFromTime = firstUp.getFromTime();
+                firstDelayDuration = 0;
+                if (firstUpTime.before(firstFromTime)) {
+                    //延时时长
+                    firstDelayDuration = (firstFromTime.getTime() - firstUpTime.getTime()) / 1000L;
+                    if (firstDelayDuration > warnSettingEntity.getWarnRainDelayMinDuration() * 60) {
+                        isBeforeWarn = true;
+                    }
+                }
+                RtuDataRainStoreEntity secondUp = rainStoreEntityList.get(i - 1);
+                boolean isNowWarn = false;
+                secondUpTime = secondUp.getTm();
+                secondFromTime = secondUp.getFromTime();
+                secondDelayDuration = 0;
+                if (secondUpTime.before(secondFromTime)) {
+                    //延时时长,秒
+                    secondDelayDuration = (secondFromTime.getTime() - secondUpTime.getTime()) / 1000L;
+                    if (secondDelayDuration > warnSettingEntity.getWarnRainDelayMinDuration() * 60) {
+                        isNowWarn = true;
+                    }
+                }
+                if (isBeforeWarn && isNowWarn) {
+                    isWarn = true;
+                    break;
+                }
+            }
+            HashOperations<String, String, String> hashops = redisTemplate.opsForHash();
+            String key = RedisBusinessConstant.KEY_RTU_RUN_INFO + rtuInfoEntity.getRtuCode();
+            String warnKindKey = RedisBusinessConstant.KEY_RTU_RUN_INFO_WARN_KIND + Func.toStr(WarnKindEnum.WARN_UP_MIN_DELAY.getCode());
+            String warnStatus = hashops.get(key, warnKindKey);
+            if (isWarn) {
+                //延时异常
+                boolean isCreateWarn = false;
+                if (null != warnStatus) {
+                    if (WarningStatusEnum.STATUS_CLOSE.getCode() == Func.toInt(warnStatus)) {
+                        isCreateWarn = true;
+                    }
+                } else {
+                    LambdaQueryWrapper<RtuWarningInfoEntity> warningWrapper = Wrappers.<RtuWarningInfoEntity>query().lambda();
+                    warningWrapper.eq(RtuWarningInfoEntity::getRtuCode, rtuInfoEntity.getRtuCode());
+                    warningWrapper.eq(RtuWarningInfoEntity::getWarningStatus, WarningStatusEnum.STATUS_HAPPEN.getCode());
+                    warningWrapper.eq(RtuWarningInfoEntity::getWarningKind, WarnKindEnum.WARN_UP_MIN_DELAY.getCode());
+                    RtuWarningInfoEntity warningInfoEntity = this.getOne(warningWrapper);
+                    if (null == warningInfoEntity) {
+                        isCreateWarn = true;
+                    }
+                }
+                if (isCreateWarn) {
+                    RtuWarningInfoEntity warningInfoEntity = new RtuWarningInfoEntity();
+                    warningInfoEntity.setRtuCode(rtuInfoEntity.getRtuCode());
+                    warningInfoEntity.setWarningHappenTime(Date.from(checkTime.atZone(ZoneId.systemDefault()).toInstant()));
+                    warningInfoEntity.setWarningStatus(WarningStatusEnum.STATUS_HAPPEN.getCode());
+                    warningInfoEntity.setWarningKind(WarnKindEnum.WARN_UP_MIN_DELAY.getCode());
+                    String desc = "雨情5分钟上报延时异常,延时设定参数:" + Func.toStr(warnSettingEntity.getWarnRainDelayMinDuration()) + "分钟";
+                    desc += ",第一个报文上报时间:" + Func.formatDateTime(firstFromTime) + " 采集时间:" + Func.formatDateTime(firstUpTime) + " 延时:" + Func.toStr(firstDelayDuration / 60L) + "分";
+                    desc += ",第二个报文上报时间:" + Func.formatDateTime(secondFromTime) + " 采集时间:" + Func.formatDateTime(secondUpTime) + " 延时:" + Func.toStr(secondDelayDuration / 60L) + "分";
+                    warningInfoEntity.setWarningDesc(desc);
+                    this.save(warningInfoEntity);
+                    //更新预警状态
+                    hashops.put(key, warnKindKey, Func.toStr(WarningStatusEnum.STATUS_HAPPEN.getCode()));
+                    //预警通知
+                    kafkaTemplate.send(topicYwxtWarning, JsonUtil.toJson(warningInfoEntity));
+                    log.info("雨情5分钟上报延时异常 {} {} {}", rtuInfoEntity.getRtuCode(), rtuInfoEntity.getRtuName(), desc);
+                }
+                if (null == warnStatus) {
+                    //更新预警状态
+                    hashops.put(key, warnKindKey, Func.toStr(WarningStatusEnum.STATUS_HAPPEN.getCode()));
+                }
+            } else {
+                //没有检测到预警发生,进行预警恢复操作
+                boolean isCloseWarn = false;
+                if (null != warnStatus) {
+                    if (WarningStatusEnum.STATUS_HAPPEN.getCode() == Func.toInt(warnStatus)) {
+                        isCloseWarn = true;
+                    }
+                } else {
+                    LambdaQueryWrapper<RtuWarningInfoEntity> warningWrapper = Wrappers.<RtuWarningInfoEntity>query().lambda();
+                    warningWrapper.eq(RtuWarningInfoEntity::getRtuCode, rtuInfoEntity.getRtuCode());
+                    warningWrapper.eq(RtuWarningInfoEntity::getWarningStatus, WarningStatusEnum.STATUS_HAPPEN.getCode());
+                    warningWrapper.eq(RtuWarningInfoEntity::getWarningKind, WarnKindEnum.WARN_UP_MIN_DELAY.getCode());
+                    RtuWarningInfoEntity warningInfoEntity = this.getOne(warningWrapper);
+                    if (null != warningInfoEntity) {
+                        isCloseWarn = true;
+                    }
+                }
+                if (isCloseWarn) {
+                    LambdaQueryWrapper<RtuWarningInfoEntity> warningWrapper = Wrappers.<RtuWarningInfoEntity>query().lambda();
+                    warningWrapper.eq(RtuWarningInfoEntity::getRtuCode, rtuInfoEntity.getRtuCode());
+                    warningWrapper.eq(RtuWarningInfoEntity::getWarningStatus, WarningStatusEnum.STATUS_HAPPEN.getCode());
+                    warningWrapper.eq(RtuWarningInfoEntity::getWarningKind, WarnKindEnum.WARN_UP_MIN_DELAY.getCode());
+                    RtuWarningInfoEntity warningInfoEntity = this.getOne(warningWrapper);
+                    if (null != warningInfoEntity) {
+                        //恢复
+                        warningInfoEntity.setWarningRecoveryTime(Date.from(checkTime.atZone(ZoneId.systemDefault()).toInstant()));
+                        warningInfoEntity.setWarningStatus(WarningStatusEnum.STATUS_CLOSE.getCode());
+                        String desc = "雨情5分钟上报延时恢复,延时设定参数:" + Func.toStr(warnSettingEntity.getWarnRainDelayMinDuration()) + "分钟";
+                        desc += ",第一个报文上报时间:" + Func.formatDateTime(firstFromTime) + " 采集时间:" + Func.formatDateTime(firstUpTime) + " 延时:" + Func.toStr(firstDelayDuration / 60L) + "分";
+                        desc += ",第二个报文上报时间:" + Func.formatDateTime(secondFromTime) + " 采集时间:" + Func.formatDateTime(secondUpTime) + " 延时:" + Func.toStr(secondDelayDuration / 60L) + "分";
+                        warningInfoEntity.setWarningRecoveryDesc(desc);
+                        this.updateById(warningInfoEntity);
+                        //更新预警状态
+                        hashops.put(key, warnKindKey, Func.toStr(WarningStatusEnum.STATUS_CLOSE.getCode()));
+                        //预警通知
+                        kafkaTemplate.send(topicYwxtWarning, JsonUtil.toJson(warningInfoEntity));
+                        log.info("雨情5分钟上报延时恢复 {} {} {}", rtuInfoEntity.getRtuCode(), rtuInfoEntity.getRtuName(), desc);
+                    }
+                }
+                if (null == warnStatus) {
+                    //更新预警状态
+                    hashops.put(key, warnKindKey, Func.toStr(WarningStatusEnum.STATUS_CLOSE.getCode()));
+                }
+            }
+        }
+
+        return true;
+    }
+
+    /**
+     * 离线检测
+     *
+     * @param rtuInfoEntity
+     * @param warnSettingEntity
+     * @param checkTime
+     * @return
+     */
+    @Override
+    public boolean checkRtuOfflineStatus(RtuInfoEntity rtuInfoEntity, RtuWarnSettingEntity warnSettingEntity, LocalDateTime checkTime) {
+//        if (rtuInfoEntity.getRtuCode().equals("40517371")) {
+//            log.info("40517371");
+//        }
+        boolean isOffline = false;
+        int checkCount = 0;
+        int warnCount = 0;
+        String offlineDurationSettingText = "";
+        String offlineDurationText = "";
+        boolean hasUp = false;
+        HashOperations<String, String, String> hashops = redisTemplate.opsForHash();
+        String key = RedisBusinessConstant.KEY_RTU_RUN_INFO + rtuInfoEntity.getRtuCode();
+        String lastDatetimeText = hashops.get(key, RedisBusinessConstant.KEY_RTU_RUN_INFO_LAST_TIME);
+        if (Func.isNull(lastDatetimeText)) {
+            LambdaQueryWrapper<RtuStatusEntity> querywrapper = Wrappers.<RtuStatusEntity>query().lambda();
+            querywrapper.eq(RtuStatusEntity::getRtuCode, rtuInfoEntity.getRtuCode());
+            RtuStatusEntity entity = rtuManageService.getOne(querywrapper);
+            if (Func.notNull(entity)) {
+                if (Func.notNull(entity.getLastUpTime())) {
+                    lastDatetimeText = Func.formatDateTime(entity.getLastUpTime());
+                }
+            }
+        }
+        if (null != lastDatetimeText && lastDatetimeText.length() > 0) {
+            hasUp = true;
+            LocalDateTime lastDateTime = LocalDateTime.parse(lastDatetimeText, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
+            if (checkTime.isEqual(lastDateTime) || checkTime.isAfter(lastDateTime)) {
+                long day = ChronoUnit.DAYS.between(lastDateTime, checkTime);
+                offlineDurationText = Func.toStr(day) + "天";
+                long hours = ChronoUnit.HOURS.between(lastDateTime, checkTime);
+                if (hours > 0) {
+                    offlineDurationText += Func.toStr(hours % 24) + "小时";
+                }
+                //雨量站
+                if (rtuInfoEntity.getIsRain() != null && rtuInfoEntity.getIsRain() == 1) {
+                    checkCount += 1;
+                    if (hours >= warnSettingEntity.getWarnRainOfflineDuration()) {
+                        warnCount += 1;
+                        offlineDurationSettingText += "雨量站阀值(小时):" + Func.toStr(warnSettingEntity.getWarnRainOfflineDuration());
+                    }
+                }
+                //河道水位站,水库水位站
+                if (rtuInfoEntity.getIsRiver() != null && rtuInfoEntity.getIsRiver() == 1) {
+                    checkCount += 1;
+                    if (hours >= warnSettingEntity.getWarnRiverOfflineDuration()) {
+                        warnCount += 1;
+                        if (offlineDurationSettingText.length() > 0) {
+                            offlineDurationSettingText += ",";
+                        }
+                        offlineDurationSettingText += "水位站阀值(小时):" + Func.toStr(warnSettingEntity.getWarnRiverOfflineDuration());
+                    }
+                } else if (rtuInfoEntity.getIsRes() != null && rtuInfoEntity.getIsRes() == 1) {
+                    checkCount += 1;
+                    if (hours >= warnSettingEntity.getWarnRsvrOfflineDuration()) {
+                        warnCount += 1;
+                        if (offlineDurationSettingText.length() > 0) {
+                            offlineDurationSettingText += ",";
+                        }
+                        offlineDurationSettingText += "水位站阀值(小时):" + Func.toStr(warnSettingEntity.getWarnRsvrOfflineDuration());
+                    }
+                }
+                //墒情站
+                if (rtuInfoEntity.getIsGround() != null && rtuInfoEntity.getIsGround() == 1) {
+                    checkCount += 1;
+                    if (hours >= warnSettingEntity.getWarnGroundOfflineDuration()) {
+                        warnCount += 1;
+                        if (offlineDurationSettingText.length() > 0) {
+                            offlineDurationSettingText += ",";
+                        }
+                        offlineDurationSettingText += "墒情站阀值(小时):" + Func.toStr(warnSettingEntity.getWarnGroundOfflineDuration());
+                    }
+                }
+            }
+        } else {
+            String offlineCheckLastTimeText = hashops.get(key, RedisBusinessConstant.KEY_RTU_RUN_INFO_OFFLINE_CHECK_POINT_TIME);
+            if (null != offlineCheckLastTimeText && offlineCheckLastTimeText.length() > 0) {
+                LocalDateTime lastDateTime = LocalDateTime.parse(offlineCheckLastTimeText, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
+                long hours = ChronoUnit.HOURS.between(lastDateTime, checkTime);
+                //雨量站
+                if (rtuInfoEntity.getIsRain() != null && rtuInfoEntity.getIsRain() == 1) {
+                    checkCount += 1;
+                    if (hours >= warnSettingEntity.getWarnRainOfflineDuration()) {
+                        warnCount += 1;
+                        offlineDurationSettingText += "雨量站阀值(小时):" + Func.toStr(warnSettingEntity.getWarnRainOfflineDuration());
+                    }
+                }
+                //河道水位站,水库水位站
+                if (rtuInfoEntity.getIsRiver() != null && rtuInfoEntity.getIsRiver() == 1) {
+                    checkCount += 1;
+                    if (hours >= warnSettingEntity.getWarnRiverOfflineDuration()) {
+                        warnCount += 1;
+                        if (offlineDurationSettingText.length() > 0) {
+                            offlineDurationSettingText += ",";
+                        }
+                        offlineDurationSettingText += "水位站阀值(小时):" + Func.toStr(warnSettingEntity.getWarnRiverOfflineDuration());
+                    }
+                } else if (rtuInfoEntity.getIsRes() != null && rtuInfoEntity.getIsRes() == 1) {
+                    checkCount += 1;
+                    if (hours >= warnSettingEntity.getWarnRsvrOfflineDuration()) {
+                        warnCount += 1;
+                        if (offlineDurationSettingText.length() > 0) {
+                            offlineDurationSettingText += ",";
+                        }
+                        offlineDurationSettingText += "水位站阀值(小时):" + Func.toStr(warnSettingEntity.getWarnRsvrOfflineDuration());
+                    }
+                }
+                //墒情站
+                if (rtuInfoEntity.getIsGround() != null && rtuInfoEntity.getIsGround() == 1) {
+                    checkCount += 1;
+                    if (hours >= warnSettingEntity.getWarnGroundOfflineDuration()) {
+                        warnCount += 1;
+                        if (offlineDurationSettingText.length() > 0) {
+                            offlineDurationSettingText += ",";
+                        }
+                        offlineDurationSettingText += "墒情站阀值(小时):" + Func.toStr(warnSettingEntity.getWarnGroundOfflineDuration());
+                    }
+                }
+            } else {
+                hashops.put(key, RedisBusinessConstant.KEY_RTU_RUN_INFO_OFFLINE_CHECK_POINT_TIME, checkTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
+            }
+        }
+        String warnKindKey = RedisBusinessConstant.KEY_RTU_RUN_INFO_WARN_KIND + Func.toStr(WarnKindEnum.WARN_OFFLINE.getCode());
+        String warnStatus = hashops.get(key, warnKindKey);
+        if (checkCount > 0) {
+            //所有检测对像都已经离线时,产生离线预警
+            if (checkCount == warnCount) {
+                //触发预警
+                boolean isCreateWarn = false;
+                if (null != warnStatus) {
+                    if (WarningStatusEnum.STATUS_CLOSE.getCode() == Func.toInt(warnStatus)) {
+                        isCreateWarn = true;
+                    }
+                } else {
+                    LambdaQueryWrapper<RtuWarningInfoEntity> warningWrapper = Wrappers.<RtuWarningInfoEntity>query().lambda();
+                    warningWrapper.eq(RtuWarningInfoEntity::getRtuCode, rtuInfoEntity.getRtuCode());
+                    warningWrapper.eq(RtuWarningInfoEntity::getWarningStatus, WarningStatusEnum.STATUS_HAPPEN.getCode());
+                    warningWrapper.eq(RtuWarningInfoEntity::getWarningKind, WarnKindEnum.WARN_OFFLINE.getCode());
+                    RtuWarningInfoEntity warningInfoEntity = this.getOne(warningWrapper);
+                    if (null == warningInfoEntity) {
+                        isCreateWarn = true;
+                    }
+                }
+
+                if (isCreateWarn) {
+                    RtuWarningInfoEntity entity = new RtuWarningInfoEntity();
+                    entity.setRtuCode(rtuInfoEntity.getRtuCode());
+                    entity.setWarningHappenTime(Date.from(checkTime.atZone(ZoneId.systemDefault()).toInstant()));
+                    entity.setWarningStatus(WarningStatusEnum.STATUS_HAPPEN.getCode());
+                    entity.setWarningKind(WarnKindEnum.WARN_OFFLINE.getCode());
+                    if (null != lastDatetimeText && lastDatetimeText.length() > 0) {
+                        LocalDateTime lastDateTime = LocalDateTime.parse(lastDatetimeText, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
+                        entity.setRtuLastTime(Date.from(lastDateTime.atZone(ZoneId.systemDefault()).toInstant()));
+                        entity.setWarningDesc("测站离线异常,检测时间:" + Func.formatDateTime(entity.getWarningHappenTime()) + ",测站最后上线时间:" + Func.formatDateTime(entity.getRtuLastTime()) + ",离线设定参数:" + offlineDurationSettingText);
+                    } else {
+                        entity.setWarningDesc("测站离线异常,检测时间:" + Func.formatDateTime(entity.getWarningHappenTime()) + ",未检测到数据上报,离线设定参数:" + offlineDurationSettingText);
+                    }
+                    this.save(entity);
+                    //更新预警状态
+                    hashops.put(key, warnKindKey, Func.toStr(WarningStatusEnum.STATUS_HAPPEN.getCode()));
+                    //预警通知
+                    kafkaTemplate.send(topicYwxtWarning, JsonUtil.toJson(entity));
+                    log.info("测站离线异常 {} {} {}", rtuInfoEntity.getRtuCode(), rtuInfoEntity.getRtuName(), entity.getWarningDesc());
+                }
+                if (null == warnStatus) {
+                    //更新预警状态
+                    hashops.put(key, warnKindKey, Func.toStr(WarningStatusEnum.STATUS_HAPPEN.getCode()));
+                }
+                isOffline = true;
+            } else {
+                if (hasUp) {
+                    //  boolean isCloseWarn = false;
+//					if (null != warnStatus) {
+//						if (WarningStatusEnum.STATUS_HAPPEN.getCode() == Func.toInt(warnStatus)) {
+//							isCloseWarn = true;
+//						}
+//					} else {
+//                    LambdaQueryWrapper<RtuWarningInfoEntity> warningWrapper = Wrappers.<RtuWarningInfoEntity>query().lambda();
+//                    warningWrapper.eq(RtuWarningInfoEntity::getRtuCode, rtuInfoEntity.getRtuCode());
+//                    warningWrapper.eq(RtuWarningInfoEntity::getWarningStatus, WarningStatusEnum.STATUS_HAPPEN.getCode());
+//                    warningWrapper.eq(RtuWarningInfoEntity::getWarningKind, WarnKindEnum.WARN_OFFLINE.getCode());
+//                    RtuWarningInfoEntity warningInfoEntity = this.getOne(warningWrapper);
+//                    if (null != warningInfoEntity) {
+//                        isCloseWarn = true;
+//                    }
+                    //}
+                    // if (isCloseWarn) {
+                    //恢复
+                    LambdaQueryWrapper<RtuWarningInfoEntity> warningWrapper = Wrappers.<RtuWarningInfoEntity>query().lambda();
+                    warningWrapper.eq(RtuWarningInfoEntity::getRtuCode, rtuInfoEntity.getRtuCode());
+                    warningWrapper.eq(RtuWarningInfoEntity::getWarningStatus, WarningStatusEnum.STATUS_HAPPEN.getCode());
+                    warningWrapper.eq(RtuWarningInfoEntity::getWarningKind, WarnKindEnum.WARN_OFFLINE.getCode());
+                    RtuWarningInfoEntity warningInfoEntity = this.getOne(warningWrapper);
+                    if (null != warningInfoEntity) {
+                        String warningRecoveryDesc = "";
+                        LocalDateTime lastDateTime = LocalDateTime.parse(lastDatetimeText, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
+                        warningRecoveryDesc = "测站离线异常恢复,检测时间:" + Func.formatDateTime(Date.from(checkTime.atZone(ZoneId.systemDefault()).toInstant())) + ",测站恢复上线时间:" + Func.formatDateTime(Date.from(lastDateTime.atZone(ZoneId.systemDefault()).toInstant())) + ",离线设定参数:" + offlineDurationSettingText + ",测站离线时长:" + offlineDurationText;
+                        warningInfoEntity.setWarningRecoveryDesc(warningRecoveryDesc);
+                        warningInfoEntity.setWarningRecoveryTime(Date.from(checkTime.atZone(ZoneId.systemDefault()).toInstant()));
+                        warningInfoEntity.setWarningStatus(WarningStatusEnum.STATUS_CLOSE.getCode());
+                        this.updateById(warningInfoEntity);
+                        //更新预警状态
+                        hashops.put(key, warnKindKey, Func.toStr(WarningStatusEnum.STATUS_CLOSE.getCode()));
+                        //预警通知
+                        kafkaTemplate.send(topicYwxtWarning, JsonUtil.toJson(warningInfoEntity));
+                        log.info("测站离线异常恢复 {} {} {}", rtuInfoEntity.getRtuCode(), rtuInfoEntity.getRtuName(), warningRecoveryDesc);
+                    }
+                    // }
+                }
+                if (null == warnStatus) {
+                    //更新预警状态
+                    hashops.put(key, warnKindKey, Func.toStr(WarningStatusEnum.STATUS_CLOSE.getCode()));
+                }
+            }
+        }
+        return isOffline;
+    }
+
+    @Override
+    public boolean checkRtuRainMissOutStatus(RtuInfoEntity rtuInfoEntity, RtuWarnSettingEntity warnSettingEntity, LocalDateTime checkTime) {
 //		if (rtuInfoEntity.getRtuCode().equals("01718550")) {
 //			log.info("01718550");
 //		}
-		//为了处理补报的情况,前推12小时进行检测
-		LocalDateTime endTime = checkTime.minusHours(12).withMinute(0);
-		LocalDateTime startTime = endTime.minusDays(1);
-		RtuDataRainDTO dataRainDTO = new RtuDataRainDTO();
-		dataRainDTO.setRtuCode(rtuInfoEntity.getRtuCode());
-		dataRainDTO.setIntv(1.0);
-		Instant instant = startTime.atZone(ZoneId.systemDefault()).toInstant();
-		dataRainDTO.setBeginTime(Date.from(instant));
-		instant = endTime.atZone(ZoneId.systemDefault()).toInstant();
-		dataRainDTO.setEndTime(Date.from(instant));
-		List<RtuDataRainStoreEntity> rainStoreEntityList = this.rainStoreService.selectList(dataRainDTO);
-		if (null != rainStoreEntityList && rainStoreEntityList.size() > 0) {
-			HashOperations<String, String, String> hashops = redisTemplate.opsForHash();
-			String key = RedisBusinessConstant.KEY_RTU_RUN_INFO + rtuInfoEntity.getRtuCode();
-			String warnKindKey = RedisBusinessConstant.KEY_RTU_RUN_INFO_WARN_KIND + Func.toStr(WarnKindEnum.WARN_RAIN_MISS_OUT.getCode());
-			String warnStatus = hashops.get(key, warnKindKey);
-			//漏报的报文数量
-			int upCount = rainStoreEntityList.size();
-			int missCount = 24 - upCount;
-			if (missCount >= warnSettingEntity.getWarnMissNum()) {
-				//检测是否上报过,避免是新上线测站误报
-				instant = startTime.atZone(ZoneId.systemDefault()).toInstant();
-				dataRainDTO.setEndTime(Date.from(instant));
-				List<RtuDataRainStoreEntity> lastRainStoreEntityList = this.rainStoreService.selectLast(dataRainDTO);
-				if (null != lastRainStoreEntityList && lastRainStoreEntityList.size() > 0) {
-					//触发预警
-					boolean isCreateWarn = false;
-					if (null != warnStatus) {
-						if (WarningStatusEnum.STATUS_CLOSE.getCode() == Func.toInt(warnStatus)) {
-							isCreateWarn = true;
-						}
-					} else {
-						LambdaQueryWrapper<RtuWarningInfoEntity> warningWrapper = Wrappers.<RtuWarningInfoEntity>query().lambda();
-						warningWrapper.eq(RtuWarningInfoEntity::getRtuCode, rtuInfoEntity.getRtuCode());
-						warningWrapper.eq(RtuWarningInfoEntity::getWarningStatus, WarningStatusEnum.STATUS_HAPPEN.getCode());
-						warningWrapper.eq(RtuWarningInfoEntity::getWarningKind, WarnKindEnum.WARN_RAIN_MISS_OUT.getCode());
-						RtuWarningInfoEntity warningInfoEntity = this.getOne(warningWrapper);
-						if (null == warningInfoEntity) {
-							isCreateWarn = true;
-						}
-					}
-					if (isCreateWarn) {
-						StringBuilder upTimeMessage = new StringBuilder();
-						for (RtuDataRainStoreEntity rainStoreEntity : rainStoreEntityList) {
-							String tmText = Func.formatDateTime(rainStoreEntity.getTm());
-							if (upTimeMessage.length() > 0) {
-								upTimeMessage.append(",");
-							}
-							upTimeMessage.append(tmText);
-						}
-						RtuWarningInfoEntity entity = new RtuWarningInfoEntity();
-						entity.setRtuCode(rtuInfoEntity.getRtuCode());
-						entity.setWarningHappenTime(Date.from(checkTime.atZone(ZoneId.systemDefault()).toInstant()));
-						entity.setWarningStatus(WarningStatusEnum.STATUS_HAPPEN.getCode());
-						entity.setWarningKind(WarnKindEnum.WARN_RAIN_MISS_OUT.getCode());
-						entity.setWarningDesc("测站雨量漏报异常,检测时间:" + Func.formatDateTime(entity.getWarningHappenTime()) + ",24小时内漏报数量:" + missCount + ",24小时内上报时间:" + upTimeMessage.toString());
-						this.save(entity);
-						//更新预警状态
-						hashops.put(key, warnKindKey, Func.toStr(WarningStatusEnum.STATUS_HAPPEN.getCode()));
-						//预警通知
-						kafkaTemplate.send(topicYwxtWarning, JsonUtil.toJson(entity));
-						log.info("测站雨量漏报异常 {} {} {} ", rtuInfoEntity.getRtuCode(), rtuInfoEntity.getRtuName(), entity.getWarningDesc());
-					}
-					if (null == warnStatus) {
-						//更新预警状态
-						hashops.put(key, warnKindKey, Func.toStr(WarningStatusEnum.STATUS_HAPPEN.getCode()));
-					}
-				}
-			} else {
-				//恢复
-				boolean isCloseWarn = false;
-				if (null != warnStatus) {
-					if (WarningStatusEnum.STATUS_HAPPEN.getCode() == Func.toInt(warnStatus)) {
-						isCloseWarn = true;
-					}
-				} else {
-					LambdaQueryWrapper<RtuWarningInfoEntity> warningWrapper = Wrappers.<RtuWarningInfoEntity>query().lambda();
-					warningWrapper.eq(RtuWarningInfoEntity::getRtuCode, rtuInfoEntity.getRtuCode());
-					warningWrapper.eq(RtuWarningInfoEntity::getWarningStatus, WarningStatusEnum.STATUS_HAPPEN.getCode());
-					warningWrapper.eq(RtuWarningInfoEntity::getWarningKind, WarnKindEnum.WARN_RAIN_MISS_OUT.getCode());
-					RtuWarningInfoEntity warningInfoEntity = this.getOne(warningWrapper);
-					if (null != warningInfoEntity) {
-						isCloseWarn = true;
-					}
-				}
-				if (isCloseWarn) {
-					LambdaQueryWrapper<RtuWarningInfoEntity> warningWrapper = Wrappers.<RtuWarningInfoEntity>query().lambda();
-					warningWrapper.eq(RtuWarningInfoEntity::getRtuCode, rtuInfoEntity.getRtuCode());
-					warningWrapper.eq(RtuWarningInfoEntity::getWarningStatus, WarningStatusEnum.STATUS_HAPPEN.getCode());
-					warningWrapper.eq(RtuWarningInfoEntity::getWarningKind, WarnKindEnum.WARN_RAIN_MISS_OUT.getCode());
-					RtuWarningInfoEntity warningInfoEntity = this.getOne(warningWrapper);
-					if (null != warningInfoEntity) {
-						//恢复
-						warningInfoEntity.setWarningRecoveryDesc("测站雨量漏报恢复,检测时间:" + Func.formatDateTime(Date.from(checkTime.atZone(ZoneId.systemDefault()).toInstant())) + ",24小时内上报数量:" + upCount);
-						warningInfoEntity.setWarningRecoveryTime(Date.from(checkTime.atZone(ZoneId.systemDefault()).toInstant()));
-						warningInfoEntity.setWarningStatus(WarningStatusEnum.STATUS_CLOSE.getCode());
-						this.updateById(warningInfoEntity);
-						//更新预警状态
-						hashops.put(key, warnKindKey, Func.toStr(WarningStatusEnum.STATUS_CLOSE.getCode()));
-						//预警通知
-						kafkaTemplate.send(topicYwxtWarning, JsonUtil.toJson(warningInfoEntity));
-						log.info("测站雨量漏报恢复 {} {} {} ", rtuInfoEntity.getRtuCode(), rtuInfoEntity.getRtuName(), warningInfoEntity.getWarningRecoveryDesc());
-					}
-				}
-				if (null == warnStatus) {
-					//更新预警状态
-					hashops.put(key, warnKindKey, Func.toStr(WarningStatusEnum.STATUS_CLOSE.getCode()));
-				}
-			}
-		}
-		return true;
-	}
-
-	@Override
-	public boolean checkRtuRiverMissOutStatus(RtuInfoEntity rtuInfoEntity, RtuWarnSettingEntity warnSettingEntity, LocalDateTime checkTime) {
+        //为了处理补报的情况,前推12小时进行检测
+        LocalDateTime endTime = checkTime.minusHours(12).withMinute(0);
+        LocalDateTime startTime = endTime.minusDays(1);
+        RtuDataRainDTO dataRainDTO = new RtuDataRainDTO();
+        dataRainDTO.setRtuCode(rtuInfoEntity.getRtuCode());
+        dataRainDTO.setIntv(1.0);
+        Instant instant = startTime.atZone(ZoneId.systemDefault()).toInstant();
+        dataRainDTO.setBeginTime(Date.from(instant));
+        instant = endTime.atZone(ZoneId.systemDefault()).toInstant();
+        dataRainDTO.setEndTime(Date.from(instant));
+        List<RtuDataRainStoreEntity> rainStoreEntityList = this.rainStoreService.selectList(dataRainDTO);
+        if (null != rainStoreEntityList && rainStoreEntityList.size() > 0) {
+            HashOperations<String, String, String> hashops = redisTemplate.opsForHash();
+            String key = RedisBusinessConstant.KEY_RTU_RUN_INFO + rtuInfoEntity.getRtuCode();
+            String warnKindKey = RedisBusinessConstant.KEY_RTU_RUN_INFO_WARN_KIND + Func.toStr(WarnKindEnum.WARN_RAIN_MISS_OUT.getCode());
+            String warnStatus = hashops.get(key, warnKindKey);
+            //漏报的报文数量
+            int upCount = rainStoreEntityList.size();
+            int missCount = 24 - upCount;
+            if (missCount >= warnSettingEntity.getWarnMissNum()) {
+                //检测是否上报过,避免是新上线测站误报
+                instant = startTime.atZone(ZoneId.systemDefault()).toInstant();
+                dataRainDTO.setEndTime(Date.from(instant));
+                List<RtuDataRainStoreEntity> lastRainStoreEntityList = this.rainStoreService.selectLast(dataRainDTO);
+                if (null != lastRainStoreEntityList && lastRainStoreEntityList.size() > 0) {
+                    //触发预警
+                    boolean isCreateWarn = false;
+                    if (null != warnStatus) {
+                        if (WarningStatusEnum.STATUS_CLOSE.getCode() == Func.toInt(warnStatus)) {
+                            isCreateWarn = true;
+                        }
+                    } else {
+                        LambdaQueryWrapper<RtuWarningInfoEntity> warningWrapper = Wrappers.<RtuWarningInfoEntity>query().lambda();
+                        warningWrapper.eq(RtuWarningInfoEntity::getRtuCode, rtuInfoEntity.getRtuCode());
+                        warningWrapper.eq(RtuWarningInfoEntity::getWarningStatus, WarningStatusEnum.STATUS_HAPPEN.getCode());
+                        warningWrapper.eq(RtuWarningInfoEntity::getWarningKind, WarnKindEnum.WARN_RAIN_MISS_OUT.getCode());
+                        RtuWarningInfoEntity warningInfoEntity = this.getOne(warningWrapper);
+                        if (null == warningInfoEntity) {
+                            isCreateWarn = true;
+                        }
+                    }
+                    if (isCreateWarn) {
+                        StringBuilder upTimeMessage = new StringBuilder();
+                        for (RtuDataRainStoreEntity rainStoreEntity : rainStoreEntityList) {
+                            String tmText = Func.formatDateTime(rainStoreEntity.getTm());
+                            if (upTimeMessage.length() > 0) {
+                                upTimeMessage.append(",");
+                            }
+                            upTimeMessage.append(tmText);
+                        }
+                        RtuWarningInfoEntity entity = new RtuWarningInfoEntity();
+                        entity.setRtuCode(rtuInfoEntity.getRtuCode());
+                        entity.setWarningHappenTime(Date.from(checkTime.atZone(ZoneId.systemDefault()).toInstant()));
+                        entity.setWarningStatus(WarningStatusEnum.STATUS_HAPPEN.getCode());
+                        entity.setWarningKind(WarnKindEnum.WARN_RAIN_MISS_OUT.getCode());
+                        entity.setWarningDesc("测站雨量漏报异常,检测时间:" + Func.formatDateTime(entity.getWarningHappenTime()) + ",24小时内漏报数量:" + missCount + ",24小时内上报时间:" + upTimeMessage.toString());
+                        this.save(entity);
+                        //更新预警状态
+                        hashops.put(key, warnKindKey, Func.toStr(WarningStatusEnum.STATUS_HAPPEN.getCode()));
+                        //预警通知
+                        kafkaTemplate.send(topicYwxtWarning, JsonUtil.toJson(entity));
+                        log.info("测站雨量漏报异常 {} {} {} ", rtuInfoEntity.getRtuCode(), rtuInfoEntity.getRtuName(), entity.getWarningDesc());
+                    }
+                    if (null == warnStatus) {
+                        //更新预警状态
+                        hashops.put(key, warnKindKey, Func.toStr(WarningStatusEnum.STATUS_HAPPEN.getCode()));
+                    }
+                }
+            } else {
+                //恢复
+                boolean isCloseWarn = false;
+                if (null != warnStatus) {
+                    if (WarningStatusEnum.STATUS_HAPPEN.getCode() == Func.toInt(warnStatus)) {
+                        isCloseWarn = true;
+                    }
+                } else {
+                    LambdaQueryWrapper<RtuWarningInfoEntity> warningWrapper = Wrappers.<RtuWarningInfoEntity>query().lambda();
+                    warningWrapper.eq(RtuWarningInfoEntity::getRtuCode, rtuInfoEntity.getRtuCode());
+                    warningWrapper.eq(RtuWarningInfoEntity::getWarningStatus, WarningStatusEnum.STATUS_HAPPEN.getCode());
+                    warningWrapper.eq(RtuWarningInfoEntity::getWarningKind, WarnKindEnum.WARN_RAIN_MISS_OUT.getCode());
+                    RtuWarningInfoEntity warningInfoEntity = this.getOne(warningWrapper);
+                    if (null != warningInfoEntity) {
+                        isCloseWarn = true;
+                    }
+                }
+                if (isCloseWarn) {
+                    LambdaQueryWrapper<RtuWarningInfoEntity> warningWrapper = Wrappers.<RtuWarningInfoEntity>query().lambda();
+                    warningWrapper.eq(RtuWarningInfoEntity::getRtuCode, rtuInfoEntity.getRtuCode());
+                    warningWrapper.eq(RtuWarningInfoEntity::getWarningStatus, WarningStatusEnum.STATUS_HAPPEN.getCode());
+                    warningWrapper.eq(RtuWarningInfoEntity::getWarningKind, WarnKindEnum.WARN_RAIN_MISS_OUT.getCode());
+                    RtuWarningInfoEntity warningInfoEntity = this.getOne(warningWrapper);
+                    if (null != warningInfoEntity) {
+                        //恢复
+                        warningInfoEntity.setWarningRecoveryDesc("测站雨量漏报恢复,检测时间:" + Func.formatDateTime(Date.from(checkTime.atZone(ZoneId.systemDefault()).toInstant())) + ",24小时内上报数量:" + upCount);
+                        warningInfoEntity.setWarningRecoveryTime(Date.from(checkTime.atZone(ZoneId.systemDefault()).toInstant()));
+                        warningInfoEntity.setWarningStatus(WarningStatusEnum.STATUS_CLOSE.getCode());
+                        this.updateById(warningInfoEntity);
+                        //更新预警状态
+                        hashops.put(key, warnKindKey, Func.toStr(WarningStatusEnum.STATUS_CLOSE.getCode()));
+                        //预警通知
+                        kafkaTemplate.send(topicYwxtWarning, JsonUtil.toJson(warningInfoEntity));
+                        log.info("测站雨量漏报恢复 {} {} {} ", rtuInfoEntity.getRtuCode(), rtuInfoEntity.getRtuName(), warningInfoEntity.getWarningRecoveryDesc());
+                    }
+                }
+                if (null == warnStatus) {
+                    //更新预警状态
+                    hashops.put(key, warnKindKey, Func.toStr(WarningStatusEnum.STATUS_CLOSE.getCode()));
+                }
+            }
+        }
+        return true;
+    }
+
+    @Override
+    public boolean checkRtuRiverMissOutStatus(RtuInfoEntity rtuInfoEntity, RtuWarnSettingEntity warnSettingEntity, LocalDateTime checkTime) {
 //		if (rtuInfoEntity.getRtuCode().equals("01710140")) {
 //			log.info("01710140");
 //		}
-		//为了处理补报的情况,前推12小时进行检测
-		LocalDateTime endTime = checkTime.minusHours(12).withMinute(0);
-		LocalDateTime startTime = endTime.minusDays(1);
-		RtuDataRiverDTO dataRiverDTO = new RtuDataRiverDTO();
-		dataRiverDTO.setRtuCode(rtuInfoEntity.getRtuCode());
-		Instant instant = startTime.atZone(ZoneId.systemDefault()).toInstant();
-		dataRiverDTO.setBeginTime(Date.from(instant));
-		instant = endTime.atZone(ZoneId.systemDefault()).toInstant();
-		dataRiverDTO.setEndTime(Date.from(instant));
-		List<RtuDataRiverStoreEntity> riverStoreEntityList = this.riverStoreService.selectList(dataRiverDTO);
-		if (null != riverStoreEntityList && riverStoreEntityList.size() > 0) {
-			StringBuilder upTimeMessage = new StringBuilder();
-			int upCount = 0;
-			for (int d = 0; d < 24; d++) {
-				LocalDateTime hourDateTime = startTime.plusHours(d);
-				for (RtuDataRiverStoreEntity riverStoreEntity : riverStoreEntityList) {
-					LocalDateTime upHourDateTime = LocalDateTime.ofInstant(riverStoreEntity.getTm().toInstant(), ZoneId.systemDefault());
-					if (hourDateTime.isEqual(upHourDateTime)) {
-						upCount += 1;
-						String tmText = Func.formatDateTime(riverStoreEntity.getTm());
-						if (upTimeMessage.length() > 0) {
-							upTimeMessage.append(",");
-						}
-						upTimeMessage.append(tmText);
-						break;
-					}
-				}
-			}
-			HashOperations<String, String, String> hashops = redisTemplate.opsForHash();
-			String key = RedisBusinessConstant.KEY_RTU_RUN_INFO + rtuInfoEntity.getRtuCode();
-			String warnKindKey = RedisBusinessConstant.KEY_RTU_RUN_INFO_WARN_KIND + Func.toStr(WarnKindEnum.WARN_WL_MISS_OUT.getCode());
-			String warnStatus = hashops.get(key, warnKindKey);
-			//漏报的报文数量
-			int missCount = 24 - upCount;
-			if (missCount >= warnSettingEntity.getWarnMissNum()) {
-
-				//检测是否上报过,避免是新上线测站误报
-				instant = startTime.atZone(ZoneId.systemDefault()).toInstant();
-				dataRiverDTO.setEndTime(Date.from(instant));
-				List<RtuDataRiverStoreEntity> lastRiverStoreEntityList = this.riverStoreService.selectLast(dataRiverDTO);
-				if (null != lastRiverStoreEntityList && lastRiverStoreEntityList.size() > 0) {
-
-					//触发预警
-					boolean isCreateWarn = false;
-					if (null != warnStatus) {
-						if (WarningStatusEnum.STATUS_CLOSE.getCode() == Func.toInt(warnStatus)) {
-							isCreateWarn = true;
-						}
-					} else {
-						LambdaQueryWrapper<RtuWarningInfoEntity> warningWrapper = Wrappers.<RtuWarningInfoEntity>query().lambda();
-						warningWrapper.eq(RtuWarningInfoEntity::getRtuCode, rtuInfoEntity.getRtuCode());
-						warningWrapper.eq(RtuWarningInfoEntity::getWarningStatus, WarningStatusEnum.STATUS_HAPPEN.getCode());
-						warningWrapper.eq(RtuWarningInfoEntity::getWarningKind, WarnKindEnum.WARN_WL_MISS_OUT.getCode());
-						RtuWarningInfoEntity warningInfoEntity = this.getOne(warningWrapper);
-						if (null == warningInfoEntity) {
-							isCreateWarn = true;
-						}
-					}
-
-					if (isCreateWarn) {
-						RtuWarningInfoEntity entity = new RtuWarningInfoEntity();
-						entity.setRtuCode(rtuInfoEntity.getRtuCode());
-						entity.setWarningHappenTime(Date.from(checkTime.atZone(ZoneId.systemDefault()).toInstant()));
-						entity.setWarningStatus(WarningStatusEnum.STATUS_HAPPEN.getCode());
-						entity.setWarningKind(WarnKindEnum.WARN_WL_MISS_OUT.getCode());
-						entity.setWarningDesc("测站水位漏报异常,检测时间:" + Func.formatDateTime(entity.getWarningHappenTime()) + ",24小时内漏报数量:" + missCount + ",24小时内上报时间:" + upTimeMessage.toString());
-						this.save(entity);
-						//更新预警状态
-						hashops.put(key, warnKindKey, Func.toStr(WarningStatusEnum.STATUS_HAPPEN.getCode()));
-						//预警通知
-						kafkaTemplate.send(topicYwxtWarning, JsonUtil.toJson(entity));
-						log.info("测站水位漏报异常 {} {} {}", rtuInfoEntity.getRtuCode(), rtuInfoEntity.getRtuName(), entity.getWarningDesc());
-					}
-					if (null == warnStatus) {
-						//更新预警状态
-						hashops.put(key, warnKindKey, Func.toStr(WarningStatusEnum.STATUS_HAPPEN.getCode()));
-					}
-				}
-			} else {
-				//恢复
-				boolean isCloseWarn = false;
-				if (null != warnStatus) {
-					if (WarningStatusEnum.STATUS_HAPPEN.getCode() == Func.toInt(warnStatus)) {
-						isCloseWarn = true;
-					}
-				} else {
-					LambdaQueryWrapper<RtuWarningInfoEntity> warningWrapper = Wrappers.<RtuWarningInfoEntity>query().lambda();
-					warningWrapper.eq(RtuWarningInfoEntity::getRtuCode, rtuInfoEntity.getRtuCode());
-					warningWrapper.eq(RtuWarningInfoEntity::getWarningStatus, WarningStatusEnum.STATUS_HAPPEN.getCode());
-					warningWrapper.eq(RtuWarningInfoEntity::getWarningKind, WarnKindEnum.WARN_WL_MISS_OUT.getCode());
-					RtuWarningInfoEntity warningInfoEntity = this.getOne(warningWrapper);
-					if (null != warningInfoEntity) {
-						isCloseWarn = true;
-					}
-				}
-				if (isCloseWarn) {
-					LambdaQueryWrapper<RtuWarningInfoEntity> warningWrapper = Wrappers.<RtuWarningInfoEntity>query().lambda();
-					warningWrapper.eq(RtuWarningInfoEntity::getRtuCode, rtuInfoEntity.getRtuCode());
-					warningWrapper.eq(RtuWarningInfoEntity::getWarningStatus, WarningStatusEnum.STATUS_HAPPEN.getCode());
-					warningWrapper.eq(RtuWarningInfoEntity::getWarningKind, WarnKindEnum.WARN_WL_MISS_OUT.getCode());
-					RtuWarningInfoEntity warningInfoEntity = this.getOne(warningWrapper);
-					if (null != warningInfoEntity) {
-						//恢复
-						warningInfoEntity.setWarningRecoveryDesc("测站水位漏报恢复,检测时间:" + Func.formatDateTime(Date.from(checkTime.atZone(ZoneId.systemDefault()).toInstant())) + ",24小时内上报数量:" + upCount);
-						warningInfoEntity.setWarningRecoveryTime(Date.from(checkTime.atZone(ZoneId.systemDefault()).toInstant()));
-						warningInfoEntity.setWarningStatus(WarningStatusEnum.STATUS_CLOSE.getCode());
-						this.updateById(warningInfoEntity);
-						//更新预警状态
-						hashops.put(key, warnKindKey, Func.toStr(WarningStatusEnum.STATUS_CLOSE.getCode()));
-						//预警通知
-						kafkaTemplate.send(topicYwxtWarning, JsonUtil.toJson(warningInfoEntity));
-						log.info("测站水位漏报恢复 {} {} {}", rtuInfoEntity.getRtuCode(), rtuInfoEntity.getRtuName(), warningInfoEntity.getWarningRecoveryDesc());
-					}
-				}
-
-				if (null == warnStatus) {
-					//更新预警状态
-					hashops.put(key, warnKindKey, Func.toStr(WarningStatusEnum.STATUS_CLOSE.getCode()));
-				}
-			}
-		}
-		return true;
-	}
-
-	@Override
-	public boolean checkRtuRsvrMissOutStatus(RtuInfoEntity rtuInfoEntity, RtuWarnSettingEntity warnSettingEntity, LocalDateTime checkTime) {
+        //为了处理补报的情况,前推12小时进行检测
+        LocalDateTime endTime = checkTime.minusHours(12).withMinute(0);
+        LocalDateTime startTime = endTime.minusDays(1);
+        RtuDataRiverDTO dataRiverDTO = new RtuDataRiverDTO();
+        dataRiverDTO.setRtuCode(rtuInfoEntity.getRtuCode());
+        Instant instant = startTime.atZone(ZoneId.systemDefault()).toInstant();
+        dataRiverDTO.setBeginTime(Date.from(instant));
+        instant = endTime.atZone(ZoneId.systemDefault()).toInstant();
+        dataRiverDTO.setEndTime(Date.from(instant));
+        List<RtuDataRiverStoreEntity> riverStoreEntityList = this.riverStoreService.selectList(dataRiverDTO);
+        if (null != riverStoreEntityList && riverStoreEntityList.size() > 0) {
+            StringBuilder upTimeMessage = new StringBuilder();
+            int upCount = 0;
+            for (int d = 0; d < 24; d++) {
+                LocalDateTime hourDateTime = startTime.plusHours(d);
+                for (RtuDataRiverStoreEntity riverStoreEntity : riverStoreEntityList) {
+                    LocalDateTime upHourDateTime = LocalDateTime.ofInstant(riverStoreEntity.getTm().toInstant(), ZoneId.systemDefault());
+                    if (hourDateTime.isEqual(upHourDateTime)) {
+                        upCount += 1;
+                        String tmText = Func.formatDateTime(riverStoreEntity.getTm());
+                        if (upTimeMessage.length() > 0) {
+                            upTimeMessage.append(",");
+                        }
+                        upTimeMessage.append(tmText);
+                        break;
+                    }
+                }
+            }
+            HashOperations<String, String, String> hashops = redisTemplate.opsForHash();
+            String key = RedisBusinessConstant.KEY_RTU_RUN_INFO + rtuInfoEntity.getRtuCode();
+            String warnKindKey = RedisBusinessConstant.KEY_RTU_RUN_INFO_WARN_KIND + Func.toStr(WarnKindEnum.WARN_WL_MISS_OUT.getCode());
+            String warnStatus = hashops.get(key, warnKindKey);
+            //漏报的报文数量
+            int missCount = 24 - upCount;
+            if (missCount >= warnSettingEntity.getWarnMissNum()) {
+
+                //检测是否上报过,避免是新上线测站误报
+                instant = startTime.atZone(ZoneId.systemDefault()).toInstant();
+                dataRiverDTO.setEndTime(Date.from(instant));
+                List<RtuDataRiverStoreEntity> lastRiverStoreEntityList = this.riverStoreService.selectLast(dataRiverDTO);
+                if (null != lastRiverStoreEntityList && lastRiverStoreEntityList.size() > 0) {
+
+                    //触发预警
+                    boolean isCreateWarn = false;
+                    if (null != warnStatus) {
+                        if (WarningStatusEnum.STATUS_CLOSE.getCode() == Func.toInt(warnStatus)) {
+                            isCreateWarn = true;
+                        }
+                    } else {
+                        LambdaQueryWrapper<RtuWarningInfoEntity> warningWrapper = Wrappers.<RtuWarningInfoEntity>query().lambda();
+                        warningWrapper.eq(RtuWarningInfoEntity::getRtuCode, rtuInfoEntity.getRtuCode());
+                        warningWrapper.eq(RtuWarningInfoEntity::getWarningStatus, WarningStatusEnum.STATUS_HAPPEN.getCode());
+                        warningWrapper.eq(RtuWarningInfoEntity::getWarningKind, WarnKindEnum.WARN_WL_MISS_OUT.getCode());
+                        RtuWarningInfoEntity warningInfoEntity = this.getOne(warningWrapper);
+                        if (null == warningInfoEntity) {
+                            isCreateWarn = true;
+                        }
+                    }
+
+                    if (isCreateWarn) {
+                        RtuWarningInfoEntity entity = new RtuWarningInfoEntity();
+                        entity.setRtuCode(rtuInfoEntity.getRtuCode());
+                        entity.setWarningHappenTime(Date.from(checkTime.atZone(ZoneId.systemDefault()).toInstant()));
+                        entity.setWarningStatus(WarningStatusEnum.STATUS_HAPPEN.getCode());
+                        entity.setWarningKind(WarnKindEnum.WARN_WL_MISS_OUT.getCode());
+                        entity.setWarningDesc("测站水位漏报异常,检测时间:" + Func.formatDateTime(entity.getWarningHappenTime()) + ",24小时内漏报数量:" + missCount + ",24小时内上报时间:" + upTimeMessage.toString());
+                        this.save(entity);
+                        //更新预警状态
+                        hashops.put(key, warnKindKey, Func.toStr(WarningStatusEnum.STATUS_HAPPEN.getCode()));
+                        //预警通知
+                        kafkaTemplate.send(topicYwxtWarning, JsonUtil.toJson(entity));
+                        log.info("测站水位漏报异常 {} {} {}", rtuInfoEntity.getRtuCode(), rtuInfoEntity.getRtuName(), entity.getWarningDesc());
+                    }
+                    if (null == warnStatus) {
+                        //更新预警状态
+                        hashops.put(key, warnKindKey, Func.toStr(WarningStatusEnum.STATUS_HAPPEN.getCode()));
+                    }
+                }
+            } else {
+                //恢复
+                boolean isCloseWarn = false;
+                if (null != warnStatus) {
+                    if (WarningStatusEnum.STATUS_HAPPEN.getCode() == Func.toInt(warnStatus)) {
+                        isCloseWarn = true;
+                    }
+                } else {
+                    LambdaQueryWrapper<RtuWarningInfoEntity> warningWrapper = Wrappers.<RtuWarningInfoEntity>query().lambda();
+                    warningWrapper.eq(RtuWarningInfoEntity::getRtuCode, rtuInfoEntity.getRtuCode());
+                    warningWrapper.eq(RtuWarningInfoEntity::getWarningStatus, WarningStatusEnum.STATUS_HAPPEN.getCode());
+                    warningWrapper.eq(RtuWarningInfoEntity::getWarningKind, WarnKindEnum.WARN_WL_MISS_OUT.getCode());
+                    RtuWarningInfoEntity warningInfoEntity = this.getOne(warningWrapper);
+                    if (null != warningInfoEntity) {
+                        isCloseWarn = true;
+                    }
+                }
+                if (isCloseWarn) {
+                    LambdaQueryWrapper<RtuWarningInfoEntity> warningWrapper = Wrappers.<RtuWarningInfoEntity>query().lambda();
+                    warningWrapper.eq(RtuWarningInfoEntity::getRtuCode, rtuInfoEntity.getRtuCode());
+                    warningWrapper.eq(RtuWarningInfoEntity::getWarningStatus, WarningStatusEnum.STATUS_HAPPEN.getCode());
+                    warningWrapper.eq(RtuWarningInfoEntity::getWarningKind, WarnKindEnum.WARN_WL_MISS_OUT.getCode());
+                    RtuWarningInfoEntity warningInfoEntity = this.getOne(warningWrapper);
+                    if (null != warningInfoEntity) {
+                        //恢复
+                        warningInfoEntity.setWarningRecoveryDesc("测站水位漏报恢复,检测时间:" + Func.formatDateTime(Date.from(checkTime.atZone(ZoneId.systemDefault()).toInstant())) + ",24小时内上报数量:" + upCount);
+                        warningInfoEntity.setWarningRecoveryTime(Date.from(checkTime.atZone(ZoneId.systemDefault()).toInstant()));
+                        warningInfoEntity.setWarningStatus(WarningStatusEnum.STATUS_CLOSE.getCode());
+                        this.updateById(warningInfoEntity);
+                        //更新预警状态
+                        hashops.put(key, warnKindKey, Func.toStr(WarningStatusEnum.STATUS_CLOSE.getCode()));
+                        //预警通知
+                        kafkaTemplate.send(topicYwxtWarning, JsonUtil.toJson(warningInfoEntity));
+                        log.info("测站水位漏报恢复 {} {} {}", rtuInfoEntity.getRtuCode(), rtuInfoEntity.getRtuName(), warningInfoEntity.getWarningRecoveryDesc());
+                    }
+                }
+
+                if (null == warnStatus) {
+                    //更新预警状态
+                    hashops.put(key, warnKindKey, Func.toStr(WarningStatusEnum.STATUS_CLOSE.getCode()));
+                }
+            }
+        }
+        return true;
+    }
+
+    @Override
+    public boolean checkRtuRsvrMissOutStatus(RtuInfoEntity rtuInfoEntity, RtuWarnSettingEntity warnSettingEntity, LocalDateTime checkTime) {
 //		if (rtuInfoEntity.getRtuCode().equals("01710140")) {
 //			log.info("01710140");
 //		}
-		//为了处理补报的情况,前推12小时进行检测
-		LocalDateTime endTime = checkTime.minusHours(12).withMinute(0);
-		LocalDateTime startTime = endTime.minusDays(1);
-		RtuDataRsvrDTO dataRsvrDTO = new RtuDataRsvrDTO();
-		dataRsvrDTO.setRtuCode(rtuInfoEntity.getRtuCode());
-		Instant instant = startTime.atZone(ZoneId.systemDefault()).toInstant();
-		dataRsvrDTO.setBeginTime(Date.from(instant));
-		instant = endTime.atZone(ZoneId.systemDefault()).toInstant();
-		dataRsvrDTO.setEndTime(Date.from(instant));
-		List<RtuDataRsvrStoreEntity> rsvrStoreEntityList = this.rsvrStoreService.selectList(dataRsvrDTO);
-		if (null != rsvrStoreEntityList && rsvrStoreEntityList.size() > 0) {
-			StringBuilder upTimeMessage = new StringBuilder();
-			int upCount = 0;
-			for (int d = 0; d < 24; d++) {
-				LocalDateTime hourDateTime = startTime.plusHours(d);
-				for (RtuDataRsvrStoreEntity rsvrStoreEntity : rsvrStoreEntityList) {
-					LocalDateTime upHourDateTime = LocalDateTime.ofInstant(rsvrStoreEntity.getTm().toInstant(), ZoneId.systemDefault());
-					if (hourDateTime.isEqual(upHourDateTime)) {
-						upCount += 1;
-						String tmText = Func.formatDateTime(rsvrStoreEntity.getTm());
-						if (upTimeMessage.length() > 0) {
-							upTimeMessage.append(",");
-						}
-						upTimeMessage.append(tmText);
-						break;
-					}
-				}
-			}
-			HashOperations<String, String, String> hashops = redisTemplate.opsForHash();
-			String key = RedisBusinessConstant.KEY_RTU_RUN_INFO + rtuInfoEntity.getRtuCode();
-			String warnKindKey = RedisBusinessConstant.KEY_RTU_RUN_INFO_WARN_KIND + Func.toStr(WarnKindEnum.WARN_WL_MISS_OUT.getCode());
-			String warnStatus = hashops.get(key, warnKindKey);
-			//漏报的报文数量
-			int missCount = 24 - upCount;
-			if (missCount >= warnSettingEntity.getWarnMissNum()) {
-				//检测是否上报过,避免是新上线测站误报
-				instant = startTime.atZone(ZoneId.systemDefault()).toInstant();
-				dataRsvrDTO.setEndTime(Date.from(instant));
-				List<RtuDataRsvrStoreEntity> lastRsvrStoreEntityList = this.rsvrStoreService.selectLast(dataRsvrDTO);
-				if (null != lastRsvrStoreEntityList && lastRsvrStoreEntityList.size() > 0) {
-					//触发预警
-					boolean isCreateWarn = false;
-					if (null != warnStatus) {
-						if (WarningStatusEnum.STATUS_CLOSE.getCode() == Func.toInt(warnStatus)) {
-							isCreateWarn = true;
-						}
-					} else {
-						LambdaQueryWrapper<RtuWarningInfoEntity> warningWrapper = Wrappers.<RtuWarningInfoEntity>query().lambda();
-
-						warningWrapper.eq(RtuWarningInfoEntity::getRtuCode, rtuInfoEntity.getRtuCode());
-						warningWrapper.eq(RtuWarningInfoEntity::getWarningStatus, WarningStatusEnum.STATUS_HAPPEN.getCode());
-						warningWrapper.eq(RtuWarningInfoEntity::getWarningKind, WarnKindEnum.WARN_WL_MISS_OUT.getCode());
-						RtuWarningInfoEntity warningInfoEntity = this.getOne(warningWrapper);
-						if (null == warningInfoEntity) {
-							isCreateWarn = true;
-						}
-					}
-
-					if (isCreateWarn) {
-						RtuWarningInfoEntity entity = new RtuWarningInfoEntity();
-						entity.setRtuCode(rtuInfoEntity.getRtuCode());
-						entity.setWarningHappenTime(Date.from(checkTime.atZone(ZoneId.systemDefault()).toInstant()));
-						entity.setWarningStatus(WarningStatusEnum.STATUS_HAPPEN.getCode());
-						entity.setWarningKind(WarnKindEnum.WARN_WL_MISS_OUT.getCode());
-						entity.setWarningDesc("测站水位漏报异常,检测时间:" + Func.formatDateTime(entity.getWarningHappenTime()) + ",24小时内漏报数量:" + missCount + ",24小时内上报时间:" + upTimeMessage.toString());
-						this.save(entity);
-						//更新预警状态
-						hashops.put(key, warnKindKey, Func.toStr(WarningStatusEnum.STATUS_HAPPEN.getCode()));
-						//预警通知
-						kafkaTemplate.send(topicYwxtWarning, JsonUtil.toJson(entity));
-						log.info("测站水位漏报异常 {} {} {}", rtuInfoEntity.getRtuCode(), rtuInfoEntity.getRtuName(), entity.getWarningDesc());
-					}
-					if (null == warnStatus) {
-						//更新预警状态
-						hashops.put(key, warnKindKey, Func.toStr(WarningStatusEnum.STATUS_HAPPEN.getCode()));
-					}
-				}
-			} else {
-				//恢复
-				boolean isCloseWarn = false;
-				if (null != warnStatus) {
-					if (WarningStatusEnum.STATUS_HAPPEN.getCode() == Func.toInt(warnStatus)) {
-						isCloseWarn = true;
-					}
-				} else {
-					LambdaQueryWrapper<RtuWarningInfoEntity> warningWrapper = Wrappers.<RtuWarningInfoEntity>query().lambda();
-					warningWrapper.eq(RtuWarningInfoEntity::getRtuCode, rtuInfoEntity.getRtuCode());
-					warningWrapper.eq(RtuWarningInfoEntity::getWarningStatus, WarningStatusEnum.STATUS_HAPPEN.getCode());
-					warningWrapper.eq(RtuWarningInfoEntity::getWarningKind, WarnKindEnum.WARN_WL_MISS_OUT.getCode());
-					RtuWarningInfoEntity warningInfoEntity = this.getOne(warningWrapper);
-					if (null != warningInfoEntity) {
-						isCloseWarn = true;
-					}
-				}
-
-				if (isCloseWarn) {
-					LambdaQueryWrapper<RtuWarningInfoEntity> warningWrapper = Wrappers.<RtuWarningInfoEntity>query().lambda();
-					warningWrapper.eq(RtuWarningInfoEntity::getRtuCode, rtuInfoEntity.getRtuCode());
-					warningWrapper.eq(RtuWarningInfoEntity::getWarningStatus, WarningStatusEnum.STATUS_HAPPEN.getCode());
-					warningWrapper.eq(RtuWarningInfoEntity::getWarningKind, WarnKindEnum.WARN_WL_MISS_OUT.getCode());
-					RtuWarningInfoEntity warningInfoEntity = this.getOne(warningWrapper);
-					if (null != warningInfoEntity) {
-						//恢复
-						warningInfoEntity.setWarningRecoveryDesc("测站水位漏报恢复,检测时间:" + Func.formatDateTime(Date.from(checkTime.atZone(ZoneId.systemDefault()).toInstant())) + ",24小时内上报数量:" + upCount);
-						warningInfoEntity.setWarningRecoveryTime(Date.from(checkTime.atZone(ZoneId.systemDefault()).toInstant()));
-						warningInfoEntity.setWarningStatus(WarningStatusEnum.STATUS_CLOSE.getCode());
-						this.updateById(warningInfoEntity);
-						//更新预警状态
-						hashops.put(key, warnKindKey, Func.toStr(WarningStatusEnum.STATUS_CLOSE.getCode()));
-						//预警通知
-						kafkaTemplate.send(topicYwxtWarning, JsonUtil.toJson(warningInfoEntity));
-						log.info("测站水位漏报恢复 {} {} {}", rtuInfoEntity.getRtuCode(), rtuInfoEntity.getRtuName(), warningInfoEntity.getWarningRecoveryDesc());
-					}
-				}
-				if (null == warnStatus) {
-					//更新预警状态
-					hashops.put(key, warnKindKey, Func.toStr(WarningStatusEnum.STATUS_CLOSE.getCode()));
-				}
-			}
-		}
-		return true;
-	}
-
-	@Override
-	public boolean checkRtuOutlierValueStatus(RtuInfoEntity rtuInfoEntity, RtuWarnSettingEntity warnSettingEntity, LocalDateTime checkTime) {
-		Date checkTm = new Date();
-		String rtuCode = rtuInfoEntity.getRtuCode();
-		HashOperations<String, String, String> ops = redisTemplate.opsForHash();
-		String surfkey = RedisBusinessConstant.KEY_SURF_DATA + rtuCode;
-		String surfTmValue = ops.get(surfkey, "upTime");
-		if (null == surfTmValue) {
-			return true;
-		}
-		String value1 = ops.get(surfkey, "lefttop.value");
-		String value2 = ops.get(surfkey, "leftbottom.value");
-		String value3 = ops.get(surfkey, "righttop.value");
-		String value4 = ops.get(surfkey, "rightbottom.value");
-		if (null == value1 || null == value2 || null == value3 || null == value4) {
-			log.info("surf info is null");
-			return true;
-		}
-		LocalDateTime surfTm = LocalDateTime.parse(surfTmValue, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")).withMinute(0);
-		LocalDateTime endTime = surfTm.plusHours(1);
-		RtuDataRainDTO dataRainDTO = new RtuDataRainDTO();
-		dataRainDTO.setRtuCode(rtuInfoEntity.getRtuCode());
-		dataRainDTO.setIntv(1.0);
-		Instant instant = surfTm.atZone(ZoneId.systemDefault()).toInstant();
-		dataRainDTO.setBeginTime(Date.from(instant));
-		instant = endTime.atZone(ZoneId.systemDefault()).toInstant();
-		dataRainDTO.setEndTime(Date.from(instant));
-		List<RtuDataRainStoreEntity> rainStoreEntityList = this.rainStoreService.selectList(dataRainDTO);
-		if (null != rainStoreEntityList && rainStoreEntityList.size() > 0) {
-			for (RtuDataRainStoreEntity entity : rainStoreEntityList) {
-				LocalDateTime hourDateTime = LocalDateTime.ofInstant(entity.getTm().toInstant(), ZoneId.systemDefault()).withMinute(0);
-				if (surfTm.isEqual(hourDateTime)) {
-					float count = Func.toFloat(value1) + Func.toFloat(value2) + Func.toFloat(value3) + Func.toFloat(value4);
-					if (count > 0) {
-						count = count / 4;
-					}
-					Double drp = entity.getDrp();
-					if (drp != null) {
-						double baseValue = drp.doubleValue() - count;
-						if (baseValue >= (double) outlierValue) {
-							//疑似异常值
-							LambdaQueryWrapper<RtuWarningInfoEntity> warningWrapper = Wrappers.<RtuWarningInfoEntity>query().lambda();
-							warningWrapper.eq(RtuWarningInfoEntity::getIsDeleted, 0);
-							warningWrapper.eq(RtuWarningInfoEntity::getRtuCode, rtuInfoEntity.getRtuCode());
-							warningWrapper.eq(RtuWarningInfoEntity::getWarningStatus, WarningStatusEnum.STATUS_HAPPEN.getCode());
-							warningWrapper.eq(RtuWarningInfoEntity::getWarningKind, WarnKindEnum.WARN_OUTLIER_VALUE.getCode());
-							RtuWarningInfoEntity warningInfoEntity = this.getOne(warningWrapper);
-							if (null == warningInfoEntity) {
-								RtuWarningInfoEntity warningInfoEntity1 = new RtuWarningInfoEntity();
-								warningInfoEntity1.setRtuCode(rtuInfoEntity.getRtuCode());
-								warningInfoEntity1.setWarningHappenTime(checkTm);
-								warningInfoEntity1.setWarningStatus(WarningStatusEnum.STATUS_HAPPEN.getCode());
-								warningInfoEntity1.setWarningKind(WarnKindEnum.WARN_OUTLIER_VALUE.getCode());
-								String desc = "测站采集雨量大于面雨量30mm,疑似异常值,";
-								desc += "雨量采集时间:" + Func.formatDateTime(entity.getTm());
-								desc += ",时段降雨:" + Func.toStr(entity.getDrp());
-								desc += ",平均面雨量:" + Func.toStr(count);
-								warningInfoEntity1.setWarningDesc(desc);
-								this.save(warningInfoEntity1);
-								//触发预警
-								kafkaTemplate.send(topicYwxtWarning, JsonUtil.toJson(warningInfoEntity1));
-							}
-						}
-					}
-					break;
-				}
-			}
-		}
-		return true;
-	}
+        //为了处理补报的情况,前推12小时进行检测
+        LocalDateTime endTime = checkTime.minusHours(12).withMinute(0);
+        LocalDateTime startTime = endTime.minusDays(1);
+        RtuDataRsvrDTO dataRsvrDTO = new RtuDataRsvrDTO();
+        dataRsvrDTO.setRtuCode(rtuInfoEntity.getRtuCode());
+        Instant instant = startTime.atZone(ZoneId.systemDefault()).toInstant();
+        dataRsvrDTO.setBeginTime(Date.from(instant));
+        instant = endTime.atZone(ZoneId.systemDefault()).toInstant();
+        dataRsvrDTO.setEndTime(Date.from(instant));
+        List<RtuDataRsvrStoreEntity> rsvrStoreEntityList = this.rsvrStoreService.selectList(dataRsvrDTO);
+        if (null != rsvrStoreEntityList && rsvrStoreEntityList.size() > 0) {
+            StringBuilder upTimeMessage = new StringBuilder();
+            int upCount = 0;
+            for (int d = 0; d < 24; d++) {
+                LocalDateTime hourDateTime = startTime.plusHours(d);
+                for (RtuDataRsvrStoreEntity rsvrStoreEntity : rsvrStoreEntityList) {
+                    LocalDateTime upHourDateTime = LocalDateTime.ofInstant(rsvrStoreEntity.getTm().toInstant(), ZoneId.systemDefault());
+                    if (hourDateTime.isEqual(upHourDateTime)) {
+                        upCount += 1;
+                        String tmText = Func.formatDateTime(rsvrStoreEntity.getTm());
+                        if (upTimeMessage.length() > 0) {
+                            upTimeMessage.append(",");
+                        }
+                        upTimeMessage.append(tmText);
+                        break;
+                    }
+                }
+            }
+            HashOperations<String, String, String> hashops = redisTemplate.opsForHash();
+            String key = RedisBusinessConstant.KEY_RTU_RUN_INFO + rtuInfoEntity.getRtuCode();
+            String warnKindKey = RedisBusinessConstant.KEY_RTU_RUN_INFO_WARN_KIND + Func.toStr(WarnKindEnum.WARN_WL_MISS_OUT.getCode());
+            String warnStatus = hashops.get(key, warnKindKey);
+            //漏报的报文数量
+            int missCount = 24 - upCount;
+            if (missCount >= warnSettingEntity.getWarnMissNum()) {
+                //检测是否上报过,避免是新上线测站误报
+                instant = startTime.atZone(ZoneId.systemDefault()).toInstant();
+                dataRsvrDTO.setEndTime(Date.from(instant));
+                List<RtuDataRsvrStoreEntity> lastRsvrStoreEntityList = this.rsvrStoreService.selectLast(dataRsvrDTO);
+                if (null != lastRsvrStoreEntityList && lastRsvrStoreEntityList.size() > 0) {
+                    //触发预警
+                    boolean isCreateWarn = false;
+                    if (null != warnStatus) {
+                        if (WarningStatusEnum.STATUS_CLOSE.getCode() == Func.toInt(warnStatus)) {
+                            isCreateWarn = true;
+                        }
+                    } else {
+                        LambdaQueryWrapper<RtuWarningInfoEntity> warningWrapper = Wrappers.<RtuWarningInfoEntity>query().lambda();
+
+                        warningWrapper.eq(RtuWarningInfoEntity::getRtuCode, rtuInfoEntity.getRtuCode());
+                        warningWrapper.eq(RtuWarningInfoEntity::getWarningStatus, WarningStatusEnum.STATUS_HAPPEN.getCode());
+                        warningWrapper.eq(RtuWarningInfoEntity::getWarningKind, WarnKindEnum.WARN_WL_MISS_OUT.getCode());
+                        RtuWarningInfoEntity warningInfoEntity = this.getOne(warningWrapper);
+                        if (null == warningInfoEntity) {
+                            isCreateWarn = true;
+                        }
+                    }
+
+                    if (isCreateWarn) {
+                        RtuWarningInfoEntity entity = new RtuWarningInfoEntity();
+                        entity.setRtuCode(rtuInfoEntity.getRtuCode());
+                        entity.setWarningHappenTime(Date.from(checkTime.atZone(ZoneId.systemDefault()).toInstant()));
+                        entity.setWarningStatus(WarningStatusEnum.STATUS_HAPPEN.getCode());
+                        entity.setWarningKind(WarnKindEnum.WARN_WL_MISS_OUT.getCode());
+                        entity.setWarningDesc("测站水位漏报异常,检测时间:" + Func.formatDateTime(entity.getWarningHappenTime()) + ",24小时内漏报数量:" + missCount + ",24小时内上报时间:" + upTimeMessage.toString());
+                        this.save(entity);
+                        //更新预警状态
+                        hashops.put(key, warnKindKey, Func.toStr(WarningStatusEnum.STATUS_HAPPEN.getCode()));
+                        //预警通知
+                        kafkaTemplate.send(topicYwxtWarning, JsonUtil.toJson(entity));
+                        log.info("测站水位漏报异常 {} {} {}", rtuInfoEntity.getRtuCode(), rtuInfoEntity.getRtuName(), entity.getWarningDesc());
+                    }
+                    if (null == warnStatus) {
+                        //更新预警状态
+                        hashops.put(key, warnKindKey, Func.toStr(WarningStatusEnum.STATUS_HAPPEN.getCode()));
+                    }
+                }
+            } else {
+                //恢复
+                boolean isCloseWarn = false;
+                if (null != warnStatus) {
+                    if (WarningStatusEnum.STATUS_HAPPEN.getCode() == Func.toInt(warnStatus)) {
+                        isCloseWarn = true;
+                    }
+                } else {
+                    LambdaQueryWrapper<RtuWarningInfoEntity> warningWrapper = Wrappers.<RtuWarningInfoEntity>query().lambda();
+                    warningWrapper.eq(RtuWarningInfoEntity::getRtuCode, rtuInfoEntity.getRtuCode());
+                    warningWrapper.eq(RtuWarningInfoEntity::getWarningStatus, WarningStatusEnum.STATUS_HAPPEN.getCode());
+                    warningWrapper.eq(RtuWarningInfoEntity::getWarningKind, WarnKindEnum.WARN_WL_MISS_OUT.getCode());
+                    RtuWarningInfoEntity warningInfoEntity = this.getOne(warningWrapper);
+                    if (null != warningInfoEntity) {
+                        isCloseWarn = true;
+                    }
+                }
+
+                if (isCloseWarn) {
+                    LambdaQueryWrapper<RtuWarningInfoEntity> warningWrapper = Wrappers.<RtuWarningInfoEntity>query().lambda();
+                    warningWrapper.eq(RtuWarningInfoEntity::getRtuCode, rtuInfoEntity.getRtuCode());
+                    warningWrapper.eq(RtuWarningInfoEntity::getWarningStatus, WarningStatusEnum.STATUS_HAPPEN.getCode());
+                    warningWrapper.eq(RtuWarningInfoEntity::getWarningKind, WarnKindEnum.WARN_WL_MISS_OUT.getCode());
+                    RtuWarningInfoEntity warningInfoEntity = this.getOne(warningWrapper);
+                    if (null != warningInfoEntity) {
+                        //恢复
+                        warningInfoEntity.setWarningRecoveryDesc("测站水位漏报恢复,检测时间:" + Func.formatDateTime(Date.from(checkTime.atZone(ZoneId.systemDefault()).toInstant())) + ",24小时内上报数量:" + upCount);
+                        warningInfoEntity.setWarningRecoveryTime(Date.from(checkTime.atZone(ZoneId.systemDefault()).toInstant()));
+                        warningInfoEntity.setWarningStatus(WarningStatusEnum.STATUS_CLOSE.getCode());
+                        this.updateById(warningInfoEntity);
+                        //更新预警状态
+                        hashops.put(key, warnKindKey, Func.toStr(WarningStatusEnum.STATUS_CLOSE.getCode()));
+                        //预警通知
+                        kafkaTemplate.send(topicYwxtWarning, JsonUtil.toJson(warningInfoEntity));
+                        log.info("测站水位漏报恢复 {} {} {}", rtuInfoEntity.getRtuCode(), rtuInfoEntity.getRtuName(), warningInfoEntity.getWarningRecoveryDesc());
+                    }
+                }
+                if (null == warnStatus) {
+                    //更新预警状态
+                    hashops.put(key, warnKindKey, Func.toStr(WarningStatusEnum.STATUS_CLOSE.getCode()));
+                }
+            }
+        }
+        return true;
+    }
+
+    @Override
+    public boolean checkRtuOutlierValueStatus(RtuInfoEntity rtuInfoEntity, RtuWarnSettingEntity warnSettingEntity, LocalDateTime checkTime) {
+        Date checkTm = new Date();
+        String rtuCode = rtuInfoEntity.getRtuCode();
+        HashOperations<String, String, String> ops = redisTemplate.opsForHash();
+        String surfkey = RedisBusinessConstant.KEY_SURF_DATA + rtuCode;
+        String surfTmValue = ops.get(surfkey, "upTime");
+        if (null == surfTmValue) {
+            return true;
+        }
+        String value1 = ops.get(surfkey, "lefttop.value");
+        String value2 = ops.get(surfkey, "leftbottom.value");
+        String value3 = ops.get(surfkey, "righttop.value");
+        String value4 = ops.get(surfkey, "rightbottom.value");
+        if (null == value1 || null == value2 || null == value3 || null == value4) {
+            log.info("surf info is null");
+            return true;
+        }
+        LocalDateTime surfTm = LocalDateTime.parse(surfTmValue, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")).withMinute(0);
+        LocalDateTime endTime = surfTm.plusHours(1);
+        RtuDataRainDTO dataRainDTO = new RtuDataRainDTO();
+        dataRainDTO.setRtuCode(rtuInfoEntity.getRtuCode());
+        dataRainDTO.setIntv(1.0);
+        Instant instant = surfTm.atZone(ZoneId.systemDefault()).toInstant();
+        dataRainDTO.setBeginTime(Date.from(instant));
+        instant = endTime.atZone(ZoneId.systemDefault()).toInstant();
+        dataRainDTO.setEndTime(Date.from(instant));
+        List<RtuDataRainStoreEntity> rainStoreEntityList = this.rainStoreService.selectList(dataRainDTO);
+        if (null != rainStoreEntityList && rainStoreEntityList.size() > 0) {
+            for (RtuDataRainStoreEntity entity : rainStoreEntityList) {
+                LocalDateTime hourDateTime = LocalDateTime.ofInstant(entity.getTm().toInstant(), ZoneId.systemDefault()).withMinute(0);
+                if (surfTm.isEqual(hourDateTime)) {
+                    float count = Func.toFloat(value1) + Func.toFloat(value2) + Func.toFloat(value3) + Func.toFloat(value4);
+                    if (count > 0) {
+                        count = count / 4;
+                    }
+                    Double drp = entity.getDrp();
+                    if (drp != null) {
+                        double baseValue = drp.doubleValue() - count;
+                        if (baseValue >= (double) outlierValue) {
+                            //疑似异常值
+                            LambdaQueryWrapper<RtuWarningInfoEntity> warningWrapper = Wrappers.<RtuWarningInfoEntity>query().lambda();
+                            warningWrapper.eq(RtuWarningInfoEntity::getIsDeleted, 0);
+                            warningWrapper.eq(RtuWarningInfoEntity::getRtuCode, rtuInfoEntity.getRtuCode());
+                            warningWrapper.eq(RtuWarningInfoEntity::getWarningStatus, WarningStatusEnum.STATUS_HAPPEN.getCode());
+                            warningWrapper.eq(RtuWarningInfoEntity::getWarningKind, WarnKindEnum.WARN_OUTLIER_VALUE.getCode());
+                            RtuWarningInfoEntity warningInfoEntity = this.getOne(warningWrapper);
+                            if (null == warningInfoEntity) {
+                                RtuWarningInfoEntity warningInfoEntity1 = new RtuWarningInfoEntity();
+                                warningInfoEntity1.setRtuCode(rtuInfoEntity.getRtuCode());
+                                warningInfoEntity1.setWarningHappenTime(checkTm);
+                                warningInfoEntity1.setWarningStatus(WarningStatusEnum.STATUS_HAPPEN.getCode());
+                                warningInfoEntity1.setWarningKind(WarnKindEnum.WARN_OUTLIER_VALUE.getCode());
+                                String desc = "测站采集雨量大于面雨量30mm,疑似异常值,";
+                                desc += "雨量采集时间:" + Func.formatDateTime(entity.getTm());
+                                desc += ",时段降雨:" + Func.toStr(entity.getDrp());
+                                desc += ",平均面雨量:" + Func.toStr(count);
+                                warningInfoEntity1.setWarningDesc(desc);
+                                this.save(warningInfoEntity1);
+                                //触发预警
+                                kafkaTemplate.send(topicYwxtWarning, JsonUtil.toJson(warningInfoEntity1));
+                            }
+                        }
+                    }
+                    break;
+                }
+            }
+        }
+        return true;
+    }
 }

+ 25 - 0
src/main/java/org/springblade/modules/test/TestController.java

@@ -6,6 +6,7 @@
  */
 package org.springblade.modules.test;
 
+import cn.hutool.json.JSONUtil;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
@@ -16,13 +17,16 @@ import lombok.extern.slf4j.Slf4j;
 import org.springblade.core.boot.ctrl.BladeController;
 import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.jackson.JsonUtil;
+import org.springblade.etl.entity.EtlRainDataEntity;
 import org.springblade.modules.yjxt.business.warn.entity.WarnDetailInfoEntity;
 import org.springblade.utils.HttpRequestUtil;
+import org.springframework.kafka.core.KafkaTemplate;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import javax.annotation.Resource;
 import java.io.FileInputStream;
 import java.io.IOException;
 import java.util.*;
@@ -43,6 +47,27 @@ import java.util.*;
 public class TestController extends BladeController {
 
 
+	@Resource
+	private KafkaTemplate<String, String> kafkaTemplate;
+
+	@GetMapping("/rain/test")
+	@ApiOperationSupport(order = 1)
+	@ApiOperation(value = "获取配置项", notes = "获取配置项")
+	public R rainTest() {
+
+
+		EtlRainDataEntity etlRainDataEntity = new EtlRainDataEntity();
+		etlRainDataEntity.setRtuCode("40517371");
+
+		etlRainDataEntity.setIntv(1.0);
+		etlRainDataEntity.setDrp(0.0);
+		etlRainDataEntity.setTm(new Date());
+		etlRainDataEntity.setFromDate(new Date());
+
+		kafkaTemplate.send("topic-etl-rain-data", JsonUtil.toJson(etlRainDataEntity));
+
+		return R.success("ok");
+	}
 
 	@GetMapping("/map/json")
 	@ApiOperationSupport(order = 1)

+ 1 - 1
src/main/resources/application-dev.yml

@@ -71,7 +71,7 @@ spring:
     url: http://111.204.228.227:20002/app/apk
     save-path: D:\\tmp
   task-config:
-    warning-check-task: false
+    warning-check-task: true
     test-task: false
     rain-count-task: false
     surface-rain-task: false