CheckHazardController.java 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549
  1. package com.zd.security.controller;
  2. import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
  3. import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
  4. import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
  5. import com.zd.common.core.annotation.Log;
  6. import com.zd.common.core.annotation.PreAuthorize;
  7. import com.zd.common.core.log.BusinessType;
  8. import com.zd.common.core.utils.FileConfigUtils;
  9. import com.zd.common.core.utils.StringUtils;
  10. import com.zd.common.core.web.controller.AbstractController;
  11. import com.zd.model.domain.ResultData;
  12. import com.zd.model.domain.per.PerFun;
  13. import com.zd.model.domain.per.PerPrefix;
  14. import com.zd.security.api.bo.CheckHazardBo;
  15. import com.zd.security.api.dto.CheckHazardApplyDto;
  16. import com.zd.security.api.dto.UploadDto;
  17. import com.zd.security.api.vo.CheckHazardApplyVo;
  18. import com.zd.security.api.vo.CheckHazardVo;
  19. import com.zd.security.api.vo.CheckManageVo;
  20. import com.zd.security.api.vo.CheckRectifyApplyVo;
  21. import com.zd.security.entity.*;
  22. import com.zd.security.scope.DataPermission;
  23. import com.zd.security.scope.DataPermissionAspect;
  24. import com.zd.security.service.*;
  25. import org.springframework.beans.BeanUtils;
  26. import org.springframework.beans.factory.annotation.Autowired;
  27. import org.springframework.web.bind.annotation.*;
  28. import java.util.Collections;
  29. import java.util.List;
  30. import java.util.Optional;
  31. import java.util.function.Function;
  32. import java.util.stream.Collectors;
  33. /**
  34. * <p>
  35. * 隐患表 前端控制器
  36. * </p>
  37. *
  38. * @author cyl
  39. * @since 2023-04-19
  40. */
  41. @RestController
  42. @RequestMapping("/checkHazard")
  43. public class CheckHazardController extends AbstractController {
  44. @Autowired
  45. private CheckHazardService checkHazardService;
  46. @Autowired
  47. private CheckRectifyService checkRectifyService;
  48. @Autowired
  49. private CheckManageService checkManageService;
  50. @Autowired
  51. private UploadService uploadService;
  52. @Autowired
  53. private FileConfigUtils fileConfigUtils;
  54. @Autowired
  55. private CheckStaffUserService checkStaffUserService;
  56. @Autowired
  57. private CheckMemberService checkMemberService;
  58. /**
  59. * 通过巡查管理Id获取
  60. * @param checkHazard
  61. * @return
  62. */
  63. @GetMapping(value = "/findByCheckHazardList")
  64. public ResultData find(CheckHazard checkHazard) {
  65. //查询条件
  66. QueryWrapper <CheckHazard> wrapper = new QueryWrapper <>();
  67. //过滤物理删除数据及正序叙
  68. wrapper.lambda().eq(CheckHazard::getIsDeleted, Boolean.FALSE)
  69. .eq(CheckHazard::getCheckManageId,checkHazard.getCheckManageId()).orderByAsc(CheckHazard::getId);
  70. List <CheckHazard> checkHazardList = checkHazardService.list(wrapper);
  71. return ResultData.success(checkHazardList);
  72. }
  73. /**
  74. * 添加数据
  75. * @param checkHazardBo
  76. * @return
  77. */
  78. @Log(title = "安全服务-测试添加", businessType = BusinessType.INSERT)
  79. @PostMapping(value = "/add")
  80. public ResultData add(@RequestBody CheckHazardBo checkHazardBo) {
  81. Optional.ofNullable(checkHazardBo.getCheckHazardDtoList()).orElseGet(Collections::emptyList)
  82. .stream()
  83. .forEach(a->{
  84. //参数检查
  85. paramCheck.notNull(a)
  86. .notNull(a.getHazardLevel())
  87. .strNotEmpty(a.getHazardCheckPro())
  88. .strNotEmpty(a.getHazardDescribe());
  89. });
  90. checkHazardService.addHazard(checkHazardBo);
  91. return ResultData.success("操作成功");
  92. }
  93. /**
  94. * 获取数据列表list(院校巡查和实验室自查)
  95. * @param checkHazardBo
  96. * @return
  97. */
  98. @DataPermission()
  99. @PreAuthorize(hasPermi = PerPrefix.SECURITY_CHECKHAZARD + PerFun.LIST)
  100. @GetMapping(value = "/list")
  101. public ResultData list(CheckHazardBo checkHazardBo) {
  102. //参数检查
  103. List<Long> userList = DataPermissionAspect.threadLocal.get(); // 获取数据
  104. checkHazardBo.setUserList(userList);
  105. DataPermissionAspect.threadLocal.remove();
  106. Page <CheckHazardVo> page = checkHazardService.checkHazardList(checkHazardBo);
  107. return ResultData.success(page);
  108. }
  109. /**
  110. * 获取数据列表list(院校巡查和实验室自查)已完成
  111. * @param checkHazardBo
  112. * @return
  113. */
  114. @DataPermission()
  115. @PreAuthorize(hasPermi = PerPrefix.SECURITY_CHECKHAZARD + PerFun.LIST)
  116. @GetMapping(value = "/overList")
  117. public ResultData overList(CheckHazardBo checkHazardBo) {
  118. //参数检查
  119. List<Long> userList = DataPermissionAspect.threadLocal.get(); // 获取数据
  120. checkHazardBo.setUserList(userList);
  121. DataPermissionAspect.threadLocal.remove();
  122. Page <CheckHazardVo> page = checkHazardService.overList(checkHazardBo);
  123. return ResultData.success(page);
  124. }
  125. /**
  126. * 获取数据列表list(院校巡查和实验室自查)待整改
  127. * @param checkHazardBo
  128. * @return
  129. */
  130. @DataPermission(roleKey="rectifyGentle")
  131. @PreAuthorize(hasPermi = PerPrefix.SECURITY_CHECKHAZARD + PerFun.LIST)
  132. @GetMapping(value = "/rectifyList")
  133. public ResultData rectifyList(CheckHazardBo checkHazardBo) {
  134. //参数检查
  135. List<Long> userList = DataPermissionAspect.threadLocal.get(); // 获取数据
  136. checkHazardBo.setUserList(userList);
  137. DataPermissionAspect.threadLocal.remove();
  138. Page <CheckHazardVo> page = checkHazardService.rectifyList(checkHazardBo);
  139. return ResultData.success(page);
  140. }
  141. /**
  142. * 获取数据列表list(院校巡查和实验室自查)待复核
  143. * @param checkHazardBo
  144. * @return
  145. */
  146. @DataPermission(roleKey="checkGentle")
  147. @PreAuthorize(hasPermi = PerPrefix.SECURITY_CHECKHAZARD + PerFun.LIST)
  148. @GetMapping(value = "/recheckList")
  149. public ResultData recheckList(CheckHazardBo checkHazardBo) {
  150. //参数检查
  151. List<Long> userList = DataPermissionAspect.threadLocal.get(); // 获取数据
  152. checkHazardBo.setUserList(userList);
  153. DataPermissionAspect.threadLocal.remove();
  154. Page <CheckHazardVo> page = checkHazardService.recheckList(checkHazardBo);
  155. return ResultData.success(page);
  156. }
  157. /**
  158. * 获取数据列表list(小程序接口)
  159. * @param checkHazardBo
  160. * @return
  161. */
  162. @DataPermission()
  163. @GetMapping(value = "/appHazardList")
  164. public ResultData appHazardList(CheckHazardBo checkHazardBo) {
  165. //参数检查
  166. List<Long> userList = DataPermissionAspect.threadLocal.get(); // 获取数据
  167. checkHazardBo.setUserList(userList);
  168. DataPermissionAspect.threadLocal.remove();
  169. Page <CheckHazardVo> page = checkHazardService.checkHazardList(checkHazardBo);
  170. return ResultData.success(page);
  171. }
  172. /**
  173. * 获取数据列表list(批量审批查询列表)
  174. * @param checkHazardBo
  175. * @return
  176. */
  177. @PreAuthorize(hasPermi = PerPrefix.SECURITY_CHECKHAZARD + PerFun.APPROVE)
  178. @GetMapping(value = "/batchApprovalList")
  179. public ResultData batchApprovalList(CheckHazardBo checkHazardBo) {
  180. checkHazardBo.setUserId(getCurrentUserId());
  181. Page <CheckHazardVo> page = checkHazardService.batchApprovalList(checkHazardBo);
  182. return ResultData.success(page);
  183. }
  184. /**
  185. * 获取数据列表list(院校巡查和实验室自查)
  186. * @param checkHazardBo
  187. * @return
  188. */
  189. @PreAuthorize(hasPermi = PerPrefix.SECURITY_CHECKHAZARD + PerFun.LIST)
  190. @GetMapping(value = "/appList")
  191. public ResultData appList(CheckHazardBo checkHazardBo) {
  192. Page <CheckHazardVo> page = checkHazardService.checkHazardAppList(checkHazardBo);
  193. return ResultData.success(page);
  194. }
  195. /**
  196. * 获取数据列表list(小程序接口)
  197. * @param checkHazardBo
  198. * @return
  199. */
  200. @GetMapping(value = "/appCheckHazardList")
  201. public ResultData appCheckHazardList(CheckHazardBo checkHazardBo) {
  202. checkHazardBo.setAppFlag(1);
  203. Page <CheckHazardVo> page = checkHazardService.checkHazardAppList(checkHazardBo);
  204. return ResultData.success(page);
  205. }
  206. /**
  207. * 获取数据详情(院校巡查和实验室自查)
  208. * @param id
  209. * @return
  210. */
  211. @PreAuthorize(hasPermi = PerPrefix.SECURITY_CHECKHAZARD + PerFun.QUERY)
  212. @GetMapping(value = "/getHazardById")
  213. public ResultData getHazardById(Long id){
  214. CheckHazardApplyVo checkHazardApplyVo = new CheckHazardApplyVo();
  215. CheckHazard checkHazard = checkHazardService.getById(id);
  216. StringBuilder stringBuffer = new StringBuilder();
  217. if(StringUtils.isNotNull(checkHazard.getHazardCheckCode1())){
  218. stringBuffer.append(checkHazard.getHazardCheckCode1()+""+checkHazard.getHazardCheckName1());
  219. }
  220. if(StringUtils.isNotNull(checkHazard.getHazardCheckCode2())){
  221. stringBuffer.append("—"+checkHazard.getHazardCheckCode2()+""+checkHazard.getHazardCheckName2());
  222. }
  223. if(StringUtils.isNotNull(checkHazard.getHazardCheckCode3())){
  224. stringBuffer.append("—"+checkHazard.getHazardCheckCode3()+""+checkHazard.getHazardCheckName3());
  225. }
  226. if(StringUtils.isNotNull(checkHazard.getHazardCheckCode())){
  227. stringBuffer.append("—"+checkHazard.getHazardCheckCode()+""+checkHazard.getHazardCheckName());
  228. }
  229. //查询巡查管理的基础数据
  230. CheckManageVo checkManageVo = checkManageService.findCheckManage(checkHazard.getCheckManageId());
  231. BeanUtils.copyProperties(checkManageVo,checkHazardApplyVo);
  232. //复制整改数据到大的对象里
  233. BeanUtils.copyProperties(checkHazard,checkHazardApplyVo.getCheckHazardApplyDto());
  234. CheckHazardBo checkHazardBo = new CheckHazardBo();
  235. checkHazardBo.setSubId(checkManageVo.getSubId());
  236. checkHazardBo.setHazardCheckPro(checkHazard.getHazardCheckPro());
  237. //这里需要统计检查项历史数据
  238. checkHazardApplyVo.getCheckHazardApplyDto().setHazardCheckCount(checkHazardService.countHazardNum(checkHazardBo));
  239. if(StringUtils.isNotNull(stringBuffer)){
  240. checkHazardApplyVo.getCheckHazardApplyDto().setHazardCheckProStr(stringBuffer.toString());
  241. }
  242. //这里需要查询身份
  243. getRectifyCheck(checkHazardApplyVo.getCheckHazardApplyDto(),checkManageVo.getSubId(),checkHazard.getHazardType(),checkManageVo.getCheckPlanId());
  244. //补全图片查询
  245. if(checkHazardApplyVo.getCheckHazardApplyDto()!=null){
  246. QueryWrapper <Upload> uploadWrap = new QueryWrapper <>();
  247. uploadWrap.lambda().eq(Upload::getSource,2).eq(Upload::getKeyId,checkHazardApplyVo.getCheckHazardApplyDto().getId());
  248. List<Upload> uploadList = uploadService.list(uploadWrap);
  249. Function <List<Upload>,List<UploadDto>> function = fun->Optional.ofNullable(fun).orElseGet(Collections::emptyList)
  250. .stream()
  251. .map(a->{
  252. UploadDto uploadDto = new UploadDto();
  253. BeanUtils.copyProperties(a,uploadDto);
  254. uploadDto.setFileUrl(uploadDto.getFileUrl());
  255. uploadDto.setViewFileUrl(fileConfigUtils.getFileDomainAdmin()+uploadDto.getFileUrl());
  256. return uploadDto;
  257. }).collect(Collectors.toList());
  258. checkHazardApplyVo.getCheckHazardApplyDto().setUploadDtoList(function.apply(uploadList));
  259. }
  260. //查询条件
  261. QueryWrapper <CheckRectify> wrapper = new QueryWrapper <>();
  262. if(StringUtils.isNotNull(checkHazard.getId())){
  263. wrapper.lambda().eq(CheckRectify::getIsDeleted,Boolean.FALSE)
  264. .eq(CheckRectify::getCheckHazardId,checkHazard.getId())
  265. .orderByAsc(CheckRectify::getId);
  266. List<CheckRectify> checkRectify = checkRectifyService.list(wrapper);
  267. if(checkRectify!=null && !checkRectify.isEmpty()){
  268. for(CheckRectify checkRectify1:checkRectify){
  269. if(StringUtils.isNotNull(checkRectify1.getReviewedBy())){
  270. //拆分整改内容
  271. CheckRectifyApplyVo checkRectifyApplyVo = new CheckRectifyApplyVo();
  272. checkRectifyApplyVo.setApplyFlag(1);
  273. checkRectifyApplyVo.setId(checkRectify1.getId());
  274. checkRectifyApplyVo.setRectifyType(checkRectify1.getRectifyType());
  275. checkRectifyApplyVo.setRectifyResult(checkRectify1.getRectifyResult());
  276. checkRectifyApplyVo.setRectifyMeasure(checkRectify1.getRectifyMeasure());
  277. checkRectifyApplyVo.setCreateBy(checkRectify1.getCreateBy());
  278. checkRectifyApplyVo.setCreateName(checkRectify1.getCreateName());
  279. checkRectifyApplyVo.setCreateTime(checkRectify1.getCreateTime());
  280. checkHazardApplyVo.getCheckRectifyApplyList().add(checkRectifyApplyVo);
  281. //查询整改图片
  282. checkRectifyApplyVo.setUploadDtoList(funDto(checkRectify1.getId()));
  283. //拆分复核内容
  284. CheckRectifyApplyVo checkRectifyExamineVo = new CheckRectifyApplyVo();
  285. checkRectifyExamineVo.setApplyFlag(2);
  286. checkRectifyExamineVo.setExamineResult(checkRectify1.getExamineResult());
  287. checkRectifyExamineVo.setExamineOpinion(checkRectify1.getExamineOpinion());
  288. checkRectifyExamineVo.setReviewedBy(checkRectify1.getReviewedBy());
  289. checkRectifyExamineVo.setReviewedName(checkRectify1.getReviewedName());
  290. checkRectifyExamineVo.setReviewedTime(checkRectify1.getReviewedTime());
  291. checkHazardApplyVo.getCheckRectifyApplyList().add(checkRectifyExamineVo);
  292. }else{
  293. //整改内容
  294. CheckRectifyApplyVo checkRectifyApplyVo = new CheckRectifyApplyVo();
  295. checkRectifyApplyVo.setApplyFlag(1);
  296. checkRectifyApplyVo.setId(checkRectify1.getId());
  297. checkRectifyApplyVo.setRectifyType(checkRectify1.getRectifyType());
  298. checkRectifyApplyVo.setRectifyResult(checkRectify1.getRectifyResult());
  299. checkRectifyApplyVo.setRectifyMeasure(checkRectify1.getRectifyMeasure());
  300. checkHazardApplyVo.getCheckRectifyApplyList().add(checkRectifyApplyVo);
  301. checkRectifyApplyVo.setCreateBy(checkRectify1.getCreateBy());
  302. checkRectifyApplyVo.setCreateName(checkRectify1.getCreateName());
  303. checkRectifyApplyVo.setCreateTime(checkRectify1.getCreateTime());
  304. //查询整改图片
  305. checkRectifyApplyVo.setUploadDtoList(funDto(checkRectify1.getId()));
  306. }
  307. }
  308. }
  309. }
  310. checkHazardApplyVo.setRectifyNotice(checkManageVo.getRectifyNotice());
  311. return ResultData.success(checkHazardApplyVo);
  312. }
  313. /**
  314. * 获取数据详情(小程序接口)
  315. * @param id
  316. * @return
  317. */
  318. @GetMapping(value = "/getAppHazardById")
  319. public ResultData getAppHazardById(Long id){
  320. CheckHazardApplyVo checkHazardApplyVo = new CheckHazardApplyVo();
  321. CheckHazard checkHazard = checkHazardService.getById(id);
  322. StringBuilder stringBuffer = new StringBuilder();
  323. if(StringUtils.isNotNull(checkHazard.getHazardCheckCode1())){
  324. stringBuffer.append(checkHazard.getHazardCheckCode1()+""+checkHazard.getHazardCheckName1());
  325. }
  326. if(StringUtils.isNotNull(checkHazard.getHazardCheckCode2())){
  327. stringBuffer.append("—"+checkHazard.getHazardCheckCode2()+""+checkHazard.getHazardCheckName2());
  328. }
  329. if(StringUtils.isNotNull(checkHazard.getHazardCheckCode3())){
  330. stringBuffer.append("—"+checkHazard.getHazardCheckCode3()+""+checkHazard.getHazardCheckName3());
  331. }
  332. if(StringUtils.isNotNull(checkHazard.getHazardCheckCode())){
  333. stringBuffer.append("—"+checkHazard.getHazardCheckCode()+""+checkHazard.getHazardCheckName());
  334. }
  335. //查询巡查管理的基础数据
  336. CheckManageVo checkManageVo = checkManageService.findCheckManage(checkHazard.getCheckManageId());
  337. BeanUtils.copyProperties(checkManageVo,checkHazardApplyVo);
  338. //复制整改数据到大的对象里
  339. BeanUtils.copyProperties(checkHazard,checkHazardApplyVo.getCheckHazardApplyDto());
  340. CheckHazardBo checkHazardBo = new CheckHazardBo();
  341. checkHazardBo.setSubId(checkManageVo.getSubId());
  342. checkHazardBo.setHazardCheckPro(checkHazard.getHazardCheckPro());
  343. //这里需要统计检查项历史数据
  344. checkHazardApplyVo.getCheckHazardApplyDto().setHazardCheckCount(checkHazardService.countHazardNum(checkHazardBo));
  345. if(StringUtils.isNotNull(stringBuffer)){
  346. checkHazardApplyVo.getCheckHazardApplyDto().setHazardCheckProStr(stringBuffer.toString());
  347. }
  348. //这里需要查询身份
  349. getRectifyCheck(checkHazardApplyVo.getCheckHazardApplyDto(),checkManageVo.getSubId(),checkHazard.getHazardType(),checkManageVo.getCheckPlanId());
  350. //补全图片查询
  351. if(checkHazardApplyVo.getCheckHazardApplyDto()!=null){
  352. QueryWrapper <Upload> uploadWrap = new QueryWrapper <>();
  353. uploadWrap.lambda().eq(Upload::getSource,2).eq(Upload::getKeyId,checkHazardApplyVo.getCheckHazardApplyDto().getId());
  354. List<Upload> uploadList = uploadService.list(uploadWrap);
  355. Function <List<Upload>,List<UploadDto>> function = fun->Optional.ofNullable(fun).orElseGet(Collections::emptyList)
  356. .stream()
  357. .map(a->{
  358. UploadDto uploadDto = new UploadDto();
  359. BeanUtils.copyProperties(a,uploadDto);
  360. uploadDto.setFileUrl(uploadDto.getFileUrl());
  361. uploadDto.setViewFileUrl(fileConfigUtils.getFileDomainAdmin()+uploadDto.getFileUrl());
  362. return uploadDto;
  363. }).collect(Collectors.toList());
  364. checkHazardApplyVo.getCheckHazardApplyDto().setUploadDtoList(function.apply(uploadList));
  365. }
  366. //查询条件
  367. QueryWrapper <CheckRectify> wrapper = new QueryWrapper <>();
  368. if(StringUtils.isNotNull(checkHazard.getId())){
  369. wrapper.lambda().eq(CheckRectify::getIsDeleted,Boolean.FALSE)
  370. .eq(CheckRectify::getCheckHazardId,checkHazard.getId())
  371. .orderByAsc(CheckRectify::getId);
  372. List<CheckRectify> checkRectify = checkRectifyService.list(wrapper);
  373. if(checkRectify!=null && !checkRectify.isEmpty()){
  374. for(CheckRectify checkRectify1:checkRectify){
  375. if(StringUtils.isNotNull(checkRectify1.getReviewedBy())){
  376. //拆分整改内容
  377. CheckRectifyApplyVo checkRectifyApplyVo = new CheckRectifyApplyVo();
  378. checkRectifyApplyVo.setApplyFlag(1);
  379. checkRectifyApplyVo.setId(checkRectify1.getId());
  380. checkRectifyApplyVo.setRectifyType(checkRectify1.getRectifyType());
  381. checkRectifyApplyVo.setRectifyResult(checkRectify1.getRectifyResult());
  382. checkRectifyApplyVo.setRectifyMeasure(checkRectify1.getRectifyMeasure());
  383. checkRectifyApplyVo.setCreateBy(checkRectify1.getCreateBy());
  384. checkRectifyApplyVo.setCreateName(checkRectify1.getCreateName());
  385. checkRectifyApplyVo.setCreateTime(checkRectify1.getCreateTime());
  386. checkHazardApplyVo.getCheckRectifyApplyList().add(checkRectifyApplyVo);
  387. //查询整改图片
  388. checkRectifyApplyVo.setUploadDtoList(funDto(checkRectify1.getId()));
  389. //拆分复核内容
  390. CheckRectifyApplyVo checkRectifyExamineVo = new CheckRectifyApplyVo();
  391. checkRectifyExamineVo.setApplyFlag(2);
  392. checkRectifyExamineVo.setExamineResult(checkRectify1.getExamineResult());
  393. checkRectifyExamineVo.setExamineOpinion(checkRectify1.getExamineOpinion());
  394. checkRectifyExamineVo.setReviewedBy(checkRectify1.getReviewedBy());
  395. checkRectifyExamineVo.setReviewedName(checkRectify1.getReviewedName());
  396. checkRectifyExamineVo.setReviewedTime(checkRectify1.getReviewedTime());
  397. checkHazardApplyVo.getCheckRectifyApplyList().add(checkRectifyExamineVo);
  398. }else{
  399. //整改内容
  400. CheckRectifyApplyVo checkRectifyApplyVo = new CheckRectifyApplyVo();
  401. checkRectifyApplyVo.setApplyFlag(1);
  402. checkRectifyApplyVo.setId(checkRectify1.getId());
  403. checkRectifyApplyVo.setRectifyType(checkRectify1.getRectifyType());
  404. checkRectifyApplyVo.setRectifyResult(checkRectify1.getRectifyResult());
  405. checkRectifyApplyVo.setRectifyMeasure(checkRectify1.getRectifyMeasure());
  406. checkHazardApplyVo.getCheckRectifyApplyList().add(checkRectifyApplyVo);
  407. checkRectifyApplyVo.setCreateBy(checkRectify1.getCreateBy());
  408. checkRectifyApplyVo.setCreateName(checkRectify1.getCreateName());
  409. checkRectifyApplyVo.setCreateTime(checkRectify1.getCreateTime());
  410. //查询整改图片
  411. checkRectifyApplyVo.setUploadDtoList(funDto(checkRectify1.getId()));
  412. }
  413. }
  414. }
  415. }
  416. return ResultData.success(checkHazardApplyVo);
  417. }
  418. //查询登录人当前的隐患是否有整改身份和检查身份
  419. private void getRectifyCheck(CheckHazardApplyDto applyDto,Long subId,Integer hazardType,Long checkPlanId){
  420. if(hazardType.intValue()==2){
  421. //查询自查检查身份
  422. List<CheckStaffUser> checkStaffUserAppList = checkStaffUserService.list(new LambdaQueryWrapper <CheckStaffUser>()
  423. .eq(CheckStaffUser::getUserId,getCurrentUserId()).eq(CheckStaffUser::getStaffType,1)
  424. .eq(CheckStaffUser::getSubId,subId));
  425. if(checkStaffUserAppList!=null && !checkStaffUserAppList.isEmpty()){
  426. applyDto.setApplyGentle(Boolean.TRUE);
  427. }
  428. }else{
  429. //查询院校巡查身份
  430. List<CheckMember> checkMemberList = checkMemberService.list(new LambdaQueryWrapper <CheckMember>()
  431. .eq(CheckMember::getCheckPlanId,checkPlanId).eq(CheckMember::getUserId,getCurrentUserId()));
  432. if(checkMemberList!=null && !checkMemberList.isEmpty()){
  433. applyDto.setApplyGentle(Boolean.TRUE);
  434. }
  435. }
  436. //查询整改身份
  437. List<CheckStaffUser> checkStaffUserRecList = checkStaffUserService.list(new LambdaQueryWrapper <CheckStaffUser>()
  438. .eq(CheckStaffUser::getUserId,getCurrentUserId()).eq(CheckStaffUser::getStaffType,2)
  439. .eq(CheckStaffUser::getSubId,subId));
  440. if(checkStaffUserRecList!=null && !checkStaffUserRecList.isEmpty()){
  441. applyDto.setRectifyGentle(Boolean.TRUE);
  442. }
  443. }
  444. public List<UploadDto> funDto(Long id){
  445. Function<List<Upload>,List<UploadDto>> function = fun->Optional.ofNullable(fun).orElseGet(Collections::emptyList)
  446. .stream()
  447. .map(a->{
  448. UploadDto uploadDto = new UploadDto();
  449. BeanUtils.copyProperties(a,uploadDto);
  450. return uploadDto;
  451. }).collect(Collectors.toList());
  452. QueryWrapper <Upload> uploadWrap = new QueryWrapper <>();
  453. uploadWrap.lambda().eq(Upload::getSource,3).eq(Upload::getKeyId,id);
  454. List<Upload> uploadList = uploadService.list(uploadWrap);
  455. return function.apply(uploadList);
  456. }
  457. /**
  458. * 获取数据列表list(暂无法整改)
  459. * @param checkHazardBo
  460. * @return
  461. */
  462. @DataPermission()
  463. @PreAuthorize(hasPermi = PerPrefix.SECURITY_CHECKHAZARD + PerFun.LIST)
  464. @GetMapping(value = "/unableRectifyList")
  465. public ResultData unableRectifyList(CheckHazardBo checkHazardBo) {
  466. //参数检查
  467. List<Long> userList = DataPermissionAspect.threadLocal.get(); // 获取数据
  468. checkHazardBo.setUserList(userList);
  469. DataPermissionAspect.threadLocal.remove();
  470. Page <CheckHazardVo> page = checkHazardService.unableRectifyList(checkHazardBo);;
  471. return ResultData.success(page);
  472. }
  473. /**
  474. * 统计隐患数量
  475. * @param checkHazardBo
  476. * @return
  477. */
  478. @GetMapping(value = "/countHazardNum")
  479. public ResultData countHazardNum(CheckHazardBo checkHazardBo) {
  480. return ResultData.success(checkHazardService.countHazardNum(checkHazardBo));
  481. }
  482. /**
  483. * 统计隐患数量
  484. * @param checkHazardBo
  485. * @return
  486. */
  487. @GetMapping(value = "/rectifySchedule")
  488. public ResultData rectifySchedule(CheckHazardBo checkHazardBo) {
  489. return ResultData.success(checkHazardService.rectifySchedule(checkHazardBo.getCheckManageId()));
  490. }
  491. /**
  492. * 安全隐患整改逾期数据标记
  493. * @return
  494. */
  495. @GetMapping(value = "/overdue")
  496. public ResultData overdue() {
  497. checkHazardService.overdue();
  498. return ResultData.success();
  499. }
  500. }