Commit 05a6d667 authored by neo's avatar neo

[DEV] add get project by id

parent 4a041590
...@@ -47,7 +47,7 @@ public class ProjectController { ...@@ -47,7 +47,7 @@ public class ProjectController {
@ApiOperation(value = "getProject", notes = "Get Project") @ApiOperation(value = "getProject", notes = "Get Project")
@RequestMapping(value = "getProject", method = RequestMethod.GET) @RequestMapping(value = "getProject", method = RequestMethod.GET)
public @ResponseBody public @ResponseBody
List<ProjectDisplayDto> GetProjectById(String projectId) { ProjectDisplayDto GetProjectById(String projectId) {
return projectService.getProjectById(projectId); return projectService.getProjectById(projectId);
} }
......
...@@ -105,10 +105,19 @@ public class ProjectServiceImpl { ...@@ -105,10 +105,19 @@ public class ProjectServiceImpl {
/** /**
* @TODO: this dmeo only for running,should change to query data from db (neo) * @TODO: this dmeo only for running,should change to query data from db (neo)
*/ */
public List<ProjectDisplayDto> getProjectById(String projectId) { public ProjectDisplayDto getProjectById(String projectId) {
List<ProjectDisplayDto> displayDtos = new ArrayList<>(); Project project = projectMapper.selectByPrimaryKey(projectId);
displayDtos.add(new ProjectDisplayDto().demo()); ProjectDisplayDto dto = new ProjectDisplayDto();
return displayDtos; dto.extractFromProject(project);
List<ProjectStatusManage> manageStatus = projectMapper.getStatusesByProjectId(projectId);
Map<Integer, Integer> dic = new HashMap<>();
manageStatus.forEach(m -> {
dic.put(m.getPeriodId(), m.getStatus());
});
dto.setProjectStatusList(dic);
return dto;
} }
public List<ProjectDisplayDto> getAllProjectList(String orgId, String serviceId, Integer projectYear) { public List<ProjectDisplayDto> getAllProjectList(String orgId, String serviceId, Integer projectYear) {
......
package pwc.taxtech.atms.dpo; package pwc.taxtech.atms.dpo;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import pwc.taxtech.atms.entity.Project;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
...@@ -268,38 +269,6 @@ public class ProjectDisplayDto { ...@@ -268,38 +269,6 @@ public class ProjectDisplayDto {
this.year = year; this.year = year;
} }
public ProjectDisplayDto demo() {
this.clientCode = "1";
this.code = "1";
this.createTime = new Date();
this.dbName = "db";
this.effectiveDate = new Date();
this.endPeriod = 1;
this.enterpriseAccountSetId = "1";
this.expiredDate = new Date();
this.haveCreateProject = true;
this.id = "1";
this.industryId = "1";
this.industryName = "dname";
this.isActive = true;
this.name = "na";
this.organizationId = "oid";
this.organizationName = "oname";
this.projectStatusList = null;
this.regionId = "1";
this.regionName = "rn";
this.ruleType = 1;
this.serviceTypeId = "1";
this.serviceTypeIds = new ArrayList<>();
this.serviceTypeName = "sn";
this.serviceTypeTemplateGroupList = new ArrayList<>();
this.startPeriod = 1;
this.templateGroupId = "1";
this.templateGroupName = "tn";
this.upDate = new Date();
this.year = 1;
return this;
}
public Map<Integer, Integer> getProjectStatusList() { public Map<Integer, Integer> getProjectStatusList() {
return projectStatusList; return projectStatusList;
...@@ -308,4 +277,23 @@ public class ProjectDisplayDto { ...@@ -308,4 +277,23 @@ public class ProjectDisplayDto {
public void setProjectStatusList(Map<Integer, Integer> projectStatusList) { public void setProjectStatusList(Map<Integer, Integer> projectStatusList) {
this.projectStatusList = projectStatusList; this.projectStatusList = projectStatusList;
} }
public void extractFromProject(Project project){
this.clientCode = project.getClientCode();
this.code = project.getCode();
this.createTime = project.getCreateTime();
this.effectiveDate = new Date();
this.endPeriod = project.getEndPeriod();
this.enterpriseAccountSetId = project.getEnterpriseAccountSetId();
this.id = project.getId();
this.industryId = project.getIndustryId();
this.isActive = project.getIsActive();
this.name = project.getName();
this.organizationId = project.getOrganizationId();
this.regionId = project.getRegionId();
this.ruleType = project.getRuleType();
this.startPeriod = project.getStartPeriod();
this.upDate = project.getUpdateTime();
this.year = project.getYear();
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment