|
@@ -8,6 +8,8 @@ import java.util.stream.Collectors;
|
|
|
import javax.persistence.criteria.Predicate;
|
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.examcloud.core.reports.api.bean.ProjectInfoBean;
|
|
|
+import org.examcloud.core.reports.api.request.GetProjectInfoBeanReq;
|
|
|
import org.examcloud.core.reports.api.request.UpdateProjectStatusReq;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -160,4 +162,24 @@ public class ProjectServiceImpl implements ProjectService {
|
|
|
}
|
|
|
projectRepo.save(pe);
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public ProjectInfoBean getProjectInfoBean(GetProjectInfoBeanReq req) {
|
|
|
+ if (req.getProjectId() == null) {
|
|
|
+ throw new StatusException("1000005", "项目id不能为空");
|
|
|
+ }
|
|
|
+ ProjectEntity pe = GlobalHelper.getEntity(projectRepo, req.getProjectId(), ProjectEntity.class);
|
|
|
+ if (pe == null) {
|
|
|
+ throw new StatusException("1000006", "项目不存在");
|
|
|
+ }
|
|
|
+ ProjectInfoBean bean=new ProjectInfoBean();
|
|
|
+ BeanUtils.copyProperties(pe, bean);
|
|
|
+ bean.setAnalyseType(pe.getAnalyseType().name());
|
|
|
+ bean.setDataOrigin(pe.getDataOrigin().name());
|
|
|
+ bean.setReportStatus(pe.getReportStatus().name());
|
|
|
+ List<Double> partitionDetails = Arrays.asList(pe.getPartitionDetails().split(",")).stream().map(str -> Double.parseDouble(str))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ bean.setPartitionDetails(partitionDetails);
|
|
|
+ return bean;
|
|
|
+ }
|
|
|
}
|