package com.gkhy.safePlatform.account.service.impl;
|
|
import com.gkhy.safePlatform.account.model.dto.resp.ProjectRespDTO;
|
import com.gkhy.safePlatform.account.entity.user.ProjectInfo;
|
import com.gkhy.safePlatform.account.enums.ProjectStatusEnum;
|
import com.gkhy.safePlatform.account.service.ProjectService;
|
import com.gkhy.safePlatform.account.service.baseService.ProjectInfoService;
|
import com.gkhy.safePlatform.commons.utils.BeanCopyUtils;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.stereotype.Service;
|
|
import java.util.ArrayList;
|
import java.util.List;
|
|
@Service("projectService")
|
public class ProjectServiceImpl implements ProjectService {
|
|
@Autowired
|
private ProjectInfoService projectInfoService;
|
|
@Override
|
public List<ProjectRespDTO> getEnableProjectList() {
|
List<ProjectInfo> sources = projectInfoService.getAllProject(ProjectStatusEnum.ENABLED);
|
List<ProjectRespDTO> result = new ArrayList<>();
|
ProjectRespDTO projectRespDTO;
|
for (ProjectInfo projectInfo :
|
sources) {
|
projectRespDTO = new ProjectRespDTO();
|
projectRespDTO.setProjectId(projectInfo.getId());
|
projectRespDTO.setProjectCode(projectInfo.getCode());
|
projectRespDTO.setProjectName(projectInfo.getName());
|
projectRespDTO.setStatus(projectInfo.getStatus());
|
ProjectStatusEnum statusEnum = ProjectStatusEnum.parse(projectInfo.getStatus());
|
assert statusEnum != null;
|
projectRespDTO.setStatusDesc(statusEnum.getValue());
|
result.add(projectRespDTO);
|
}
|
return result;
|
}
|
}
|