|  |  | @ -1,23 +1,11 @@ | 
			
		
	
		
		
			
				
					
					|  |  |  | package cn.iocoder.yudao.module.system.controller.admin.taskinfo; |  |  |  | package cn.iocoder.yudao.module.system.controller.admin.taskinfo; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; |  |  |  | import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; | 
			
		
	
		
		
			
				
					
					|  |  |  | import cn.iocoder.yudao.module.infra.api.job.JobApi; |  |  |  | import cn.iocoder.yudao.module.infra.api.job.JobApi; | 
			
		
	
		
		
			
				
					
					|  |  |  | import cn.iocoder.yudao.module.system.controller.admin.enterprise.vo.EnterprisePageReqVO; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | import cn.iocoder.yudao.module.system.controller.admin.enterpriseinspections.vo.EnterpriseInspectionsPageReqVO; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | import cn.iocoder.yudao.module.system.controller.admin.enterpriseinspections.vo.EnterpriseInspectionsSaveReqVO; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | import cn.iocoder.yudao.module.system.controller.admin.tasktag.vo.TaskTagPageReqVO; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | import cn.iocoder.yudao.module.system.dal.dataobject.dept.DeptDO; |  |  |  | import cn.iocoder.yudao.module.system.dal.dataobject.dept.DeptDO; | 
			
		
	
		
		
			
				
					
					|  |  |  | import cn.iocoder.yudao.module.system.dal.dataobject.enterprise.EnterpriseDO; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | import cn.iocoder.yudao.module.system.dal.dataobject.enterpriseinspections.EnterpriseInspectionsDO; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | import cn.iocoder.yudao.module.system.dal.dataobject.tasktag.TaskTagDO; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO; |  |  |  | import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO; | 
			
		
	
		
		
			
				
					
					|  |  |  | import cn.iocoder.yudao.module.system.service.dept.DeptService; |  |  |  | import cn.iocoder.yudao.module.system.service.dept.DeptService; | 
			
		
	
		
		
			
				
					
					|  |  |  | import cn.iocoder.yudao.module.system.service.enterprise.EnterpriseService; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | import cn.iocoder.yudao.module.system.service.enterpriseinspections.EnterpriseInspectionsService; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | import cn.iocoder.yudao.module.system.service.tasktag.TaskTagService; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | import cn.iocoder.yudao.module.system.service.user.AdminUserService; |  |  |  | import cn.iocoder.yudao.module.system.service.user.AdminUserService; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | import org.springframework.web.bind.annotation.*; |  |  |  | import org.springframework.web.bind.annotation.*; | 
			
		
	
		
		
			
				
					
					|  |  |  | import org.springframework.validation.annotation.Validated; |  |  |  | import org.springframework.validation.annotation.Validated; | 
			
		
	
		
		
			
				
					
					|  |  |  | import org.springframework.security.access.prepost.PreAuthorize; |  |  |  | import org.springframework.security.access.prepost.PreAuthorize; | 
			
		
	
	
		
		
			
				
					|  |  | @ -59,12 +47,6 @@ public class TaskInfoController { | 
			
		
	
		
		
			
				
					
					|  |  |  |     private AdminUserService adminUserService; |  |  |  |     private AdminUserService adminUserService; | 
			
		
	
		
		
			
				
					
					|  |  |  |     @Resource |  |  |  |     @Resource | 
			
		
	
		
		
			
				
					
					|  |  |  |     private DeptService deptService; |  |  |  |     private DeptService deptService; | 
			
		
	
		
		
			
				
					
					|  |  |  |     @Resource |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     private  EnterpriseInspectionsService enterpriseInspectionsService; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     @Resource |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     private TaskTagService taskTagService; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     @Resource |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     private EnterpriseService enterpriseService; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     @PostMapping("/create") |  |  |  |     @PostMapping("/create") | 
			
		
	
	
		
		
			
				
					|  |  | @ -78,19 +60,6 @@ public class TaskInfoController { | 
			
		
	
		
		
			
				
					
					|  |  |  |     @Operation(summary = "更新任务表,用于存储所有的任务信息,任务可由不同用户创建并管理。") |  |  |  |     @Operation(summary = "更新任务表,用于存储所有的任务信息,任务可由不同用户创建并管理。") | 
			
		
	
		
		
			
				
					
					|  |  |  |     @PreAuthorize("@ss.hasPermission('system:task-info:update')") |  |  |  |     @PreAuthorize("@ss.hasPermission('system:task-info:update')") | 
			
		
	
		
		
			
				
					
					|  |  |  |     public CommonResult<Boolean> updateTaskInfo(@Valid @RequestBody TaskInfoSaveReqVO updateReqVO) { |  |  |  |     public CommonResult<Boolean> updateTaskInfo(@Valid @RequestBody TaskInfoSaveReqVO updateReqVO) { | 
			
		
	
		
		
			
				
					
					|  |  |  |         List<Long> eid=updateReqVO.getEnterpriseIds(); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         if (eid == null || eid.isEmpty()) { |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             return success(false); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         } |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         int del=enterpriseInspectionsService.deleteEnterpriseInspectionsTaskId(updateReqVO.getId()); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         EnterpriseInspectionsSaveReqVO enterpriseInspectionsSaveReqVO=new EnterpriseInspectionsSaveReqVO(); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         for(Long enterprise:eid) { |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             enterpriseInspectionsSaveReqVO.setTaskId(updateReqVO.getId()); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             enterpriseInspectionsSaveReqVO.setEnterpriseId(enterprise); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             if(del>0){ |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                 enterpriseInspectionsService.createEnterpriseInspections(enterpriseInspectionsSaveReqVO); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             } |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         } |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         taskInfoService.updateTaskInfo(updateReqVO); |  |  |  |         taskInfoService.updateTaskInfo(updateReqVO); | 
			
		
	
		
		
			
				
					
					|  |  |  |         return success(true); |  |  |  |         return success(true); | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
	
		
		
			
				
					|  |  | @ -110,29 +79,7 @@ public class TaskInfoController { | 
			
		
	
		
		
			
				
					
					|  |  |  |     @PreAuthorize("@ss.hasPermission('system:task-info:query')") |  |  |  |     @PreAuthorize("@ss.hasPermission('system:task-info:query')") | 
			
		
	
		
		
			
				
					
					|  |  |  |     public CommonResult<TaskInfoRespVO> getTaskInfo(@RequestParam("id") Long id) { |  |  |  |     public CommonResult<TaskInfoRespVO> getTaskInfo(@RequestParam("id") Long id) { | 
			
		
	
		
		
			
				
					
					|  |  |  |         TaskInfoDO taskInfo = taskInfoService.getTaskInfo(id); |  |  |  |         TaskInfoDO taskInfo = taskInfoService.getTaskInfo(id); | 
			
		
	
		
		
			
				
					
					|  |  |  |         //获取任务包含企业
 |  |  |  |         return success(BeanUtils.toBean(taskInfo, TaskInfoRespVO.class)); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |         EnterpriseInspectionsPageReqVO enterpriseInspectionsPageReqVO=new EnterpriseInspectionsPageReqVO(); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         enterpriseInspectionsPageReqVO.setTaskId(taskInfo.getId()); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         List<EnterpriseInspectionsDO> enterpriseInspectionsides=enterpriseInspectionsService.getEnterpriseInspectionsList(enterpriseInspectionsPageReqVO); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         EnterprisePageReqVO enterprisePageReqVO=new EnterprisePageReqVO(); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         List<Long> longs = CollectionUtils.convertList(enterpriseInspectionsides, EnterpriseInspectionsDO::getEnterpriseId); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         enterprisePageReqVO.setIds(longs); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         List<EnterpriseDO> enterpriseIdes=enterpriseService.getEnterpriseList(enterprisePageReqVO); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         TaskInfoRespVO bean = BeanUtils.toBean(taskInfo, TaskInfoRespVO.class); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         bean.setEnterpriseIdes(enterpriseIdes); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         //获取任务标签
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         TaskTagPageReqVO taskTagPageReqVO=new TaskTagPageReqVO(); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         taskTagPageReqVO.setTaskId(taskInfo.getId()); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         List<TaskTagDO> taskTagides=taskTagService.getTaskTagList(taskTagPageReqVO); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         List<Long> taglongs = CollectionUtils.convertList(enterpriseInspectionsides, EnterpriseInspectionsDO::getEnterpriseId); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         bean.setTaskTagIdes(taskTagides); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         return success(bean); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     @GetMapping("/page") |  |  |  |     @GetMapping("/page") | 
			
		
	
	
		
		
			
				
					|  |  | @ -142,19 +89,9 @@ public class TaskInfoController { | 
			
		
	
		
		
			
				
					
					|  |  |  |         PageResult<TaskInfoDO> pageResult = taskInfoService.getTaskInfoPage(pageReqVO); |  |  |  |         PageResult<TaskInfoDO> pageResult = taskInfoService.getTaskInfoPage(pageReqVO); | 
			
		
	
		
		
			
				
					
					|  |  |  |         AdminUserDO user = adminUserService.getUser(SecurityFrameworkUtils.getLoginUserId()); |  |  |  |         AdminUserDO user = adminUserService.getUser(SecurityFrameworkUtils.getLoginUserId()); | 
			
		
	
		
		
			
				
					
					|  |  |  |         DeptDO dep= deptService.getDept( user.getDeptId()); |  |  |  |         DeptDO dep= deptService.getDept( user.getDeptId()); | 
			
		
	
		
		
			
				
					
					|  |  |  |         EnterpriseInspectionsPageReqVO enterpriseInspectionsPageReqVO=new EnterpriseInspectionsPageReqVO(); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         pageResult.getList().forEach(item->{ |  |  |  |         pageResult.getList().forEach(item->{ | 
			
		
	
		
		
			
				
					
					|  |  |  |             item.setPublishDep(dep.getName()); |  |  |  |             item.setPublishDep(dep.getName()); | 
			
		
	
		
		
			
				
					
					|  |  |  |             item.setCreateName(adminUserService.getUser(Long.valueOf(item.getCreator())).getRealName()); |  |  |  |             item.setCreateName(adminUserService.getUser(Long.valueOf(item.getCreator())).getRealName()); | 
			
		
	
		
		
			
				
					
					|  |  |  |             enterpriseInspectionsPageReqVO.setTaskId(item.getId()); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             List<EnterpriseInspectionsDO> enterpriseInspectionsides=enterpriseInspectionsService.getEnterpriseInspectionsList(enterpriseInspectionsPageReqVO); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             EnterprisePageReqVO enterprisePageReqVO=new EnterprisePageReqVO(); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             List<Long> longs = CollectionUtils.convertList(enterpriseInspectionsides, EnterpriseInspectionsDO::getEnterpriseId); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             enterprisePageReqVO.setIds(longs); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             List<EnterpriseDO> enterpriseIdes=enterpriseService.getEnterpriseList(enterprisePageReqVO); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             item.setEnterpriseIdes(enterpriseIdes); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         }); |  |  |  |         }); | 
			
		
	
		
		
			
				
					
					|  |  |  |         return success(BeanUtils.toBean(pageResult, TaskInfoRespVO.class)); |  |  |  |         return success(BeanUtils.toBean(pageResult, TaskInfoRespVO.class)); | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
	
		
		
			
				
					|  |  | 
 |