xiatian 5 年之前
父节点
当前提交
30d98027b6

+ 13 - 1
examcloud-task-api-provider/src/main/java/cn/com/qmth/examcloud/task/api/controller/ReportsComputeController.java

@@ -1,10 +1,15 @@
 package cn.com.qmth.examcloud.task.api.controller;
 package cn.com.qmth.examcloud.task.api.controller;
 
 
+import java.util.List;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.bind.annotation.RestController;
 
 
 import cn.com.qmth.examcloud.api.commons.exchange.PageInfo;
 import cn.com.qmth.examcloud.api.commons.exchange.PageInfo;
@@ -55,5 +60,12 @@ public class ReportsComputeController extends ControllerSupport {
     	User user=getAccessUser();
     	User user=getAccessUser();
     	return reportsComputeService.queryPage(projectId, pageNo, pageSize,user.getRootOrgId());
     	return reportsComputeService.queryPage(projectId, pageNo, pageSize,user.getRootOrgId());
     }
     }
-
+    @ApiOperation(value="批量获取")
+	@GetMapping("/getList")
+	public List<ReportsComputeBean> getList(@RequestParam(required = true) String ids) {
+    	List<Long> pids = Stream.of(ids.split(",")).map(s -> Long.parseLong(s.trim()))
+				.collect(Collectors.toList());
+    	User user = getAccessUser();
+		return reportsComputeService.getList(pids, user.getRootOrgId());
+	}
 }
 }

+ 3 - 0
examcloud-task-dao/src/main/java/cn/com/qmth/examcloud/task/dao/ReportsComputeRepo.java

@@ -38,4 +38,7 @@ public interface ReportsComputeRepo
 	public List<ReportsComputeEntity> findByProjectIdAndRootOrgIdAndStatus(Long projectId, Long rootOrgId,ReportsComputeStatus status);
 	public List<ReportsComputeEntity> findByProjectIdAndRootOrgIdAndStatus(Long projectId, Long rootOrgId,ReportsComputeStatus status);
 
 
 	public List<ReportsComputeEntity> findByStatus(ReportsComputeStatus status);
 	public List<ReportsComputeEntity> findByStatus(ReportsComputeStatus status);
+	
+	@Query(value = "select * from EC_T_REPORTS_COMPUTE where id in(?1) and root_org_id=?2 ", nativeQuery = true)
+	public List<ReportsComputeEntity> getByIds(List<Long> ids, Long rootOrgId);
 }
 }

+ 1 - 0
examcloud-task-service/src/main/java/cn/com/qmth/examcloud/task/service/ReportsComputeService.java

@@ -20,4 +20,5 @@ public interface ReportsComputeService {
 	public void clearStopingFlag(Long id);
 	public void clearStopingFlag(Long id);
 	public void add(Long projectId,Long rootOrgId);
 	public void add(Long projectId,Long rootOrgId);
 	public PageInfo<ReportsComputeBean> queryPage(Long projectId,Integer pageNo,Integer pageSize,Long rootOrgId);
 	public PageInfo<ReportsComputeBean> queryPage(Long projectId,Integer pageNo,Integer pageSize,Long rootOrgId);
+	public List<ReportsComputeBean> getList(List<Long> pids, Long rootOrgId);
 }
 }

+ 15 - 0
examcloud-task-service/src/main/java/cn/com/qmth/examcloud/task/service/impl/ReportsComputeServiceImpl.java

@@ -785,4 +785,19 @@ public class ReportsComputeServiceImpl implements ReportsComputeService {
 		}
 		}
 		return new PageInfo<ReportsComputeBean>(projects, ret);
 		return new PageInfo<ReportsComputeBean>(projects, ret);
 	}
 	}
+
+	@Override
+	public List<ReportsComputeBean> getList(List<Long> pids, Long rootOrgId) {
+		List<ReportsComputeBean> ret=new ArrayList<ReportsComputeBean>();
+		List<ReportsComputeEntity> list=reportsComputeRepo.getByIds(pids, rootOrgId);
+		if(list!=null) {
+			for(ReportsComputeEntity pe:list) {
+				ReportsComputeBean bean = new ReportsComputeBean();
+				BeanUtils.copyProperties(pe, bean);
+				bean.setStatusName(bean.getStatus().getDesc());
+				ret.add(bean);
+			}
+		}
+		return ret;
+	}
 }
 }