Commit a6606e1a authored by neo's avatar neo

[DEV] V] query project all status impl

parent 2ed9ec79
package pwc.taxtech.atms.controller; package pwc.taxtech.atms.controller;
import java.util.List; import java.util.List;
import java.util.Map;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
...@@ -59,7 +61,7 @@ public class ProjectController { ...@@ -59,7 +61,7 @@ public class ProjectController {
@ApiOperation(value = "getAllProjectList", notes = "Get All List") @ApiOperation(value = "getAllProjectList", notes = "Get All List")
@RequestMapping(value = "getAllProjectList", method = RequestMethod.GET) @RequestMapping(value = "getAllProjectList", method = RequestMethod.GET)
public @ResponseBody public @ResponseBody
List<ProjectDisplayDto> getAllProjectList( String orgID, String serviceID, Integer projectYear) { List<ProjectDisplayDto> getAllProjectList(String orgID, String serviceID, Integer projectYear) {
logger.info("/api/v1/project/getAllProjectList with orgID {} serviceID {}", orgID, serviceID); logger.info("/api/v1/project/getAllProjectList with orgID {} serviceID {}", orgID, serviceID);
return projectService.getAllProjectList(orgID, serviceID == null ? "" : serviceID, projectYear); return projectService.getAllProjectList(orgID, serviceID == null ? "" : serviceID, projectYear);
} }
...@@ -68,9 +70,16 @@ public class ProjectController { ...@@ -68,9 +70,16 @@ public class ProjectController {
@RequestMapping(value = "add", method = RequestMethod.POST) @RequestMapping(value = "add", method = RequestMethod.POST)
@ApiImplicitParam(name = "projectDto", value = "projectDto", required = true, dataType = "ProjectDisplayDto") @ApiImplicitParam(name = "projectDto", value = "projectDto", required = true, dataType = "ProjectDisplayDto")
public @ResponseBody public @ResponseBody
AddProjectResult AddProject(@RequestBody ProjectDisplayDto projectDto,String userName) { AddProjectResult AddProject(@RequestBody ProjectDisplayDto projectDto, String userName) {
if(userName==null ||userName.isEmpty())userName="test";//TODO: should use session username future(neo) if (userName == null || userName.isEmpty()) userName = "test";//TODO: should use session username future(neo)
return projectService.addProject(projectDto, userName); return projectService.addProject(projectDto, userName);
} }
@ApiOperation(value = "getProjectAllStatus", notes = "get project all status")
@RequestMapping(value = "getProjectAllStatus/{dbName}", method = RequestMethod.GET)
public @ResponseBody
Map<Integer, Integer> getProjectAllStatus(@PathVariable String dbName) {
return projectService.getProjectAllStatus(dbName);
}
} }
...@@ -3,6 +3,7 @@ package pwc.taxtech.atms.controller; ...@@ -3,6 +3,7 @@ package pwc.taxtech.atms.controller;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
...@@ -12,8 +13,6 @@ import pwc.taxtech.atms.dto.taxadmin.ProjectStatusManageDto; ...@@ -12,8 +13,6 @@ import pwc.taxtech.atms.dto.taxadmin.ProjectStatusManageDto;
import pwc.taxtech.atms.service.IdentityService; import pwc.taxtech.atms.service.IdentityService;
import pwc.taxtech.atms.service.ProjectStatusManageService; import pwc.taxtech.atms.service.ProjectStatusManageService;
import javax.ws.rs.PathParam;
@RestController @RestController
@RequestMapping("/api/v1/ProjectStatusManage") @RequestMapping("/api/v1/ProjectStatusManage")
public class ProjectStatusManageController { public class ProjectStatusManageController {
...@@ -25,12 +24,12 @@ public class ProjectStatusManageController { ...@@ -25,12 +24,12 @@ public class ProjectStatusManageController {
private IdentityService identityService; private IdentityService identityService;
@ApiOperation(value = "setProjectStatus", notes = "") @ApiOperation(value = "setProjectStatus", notes = "")
@RequestMapping(value = { "/setProjectStatus/{dbName}/{periodId}/{status}" }, method = RequestMethod.GET, @RequestMapping(value = {"/setProjectStatus/{dbName}/{periodId}/{status}"}, method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_UTF8_VALUE) produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@ResponseBody @ResponseBody
public OperationResultDto<ProjectStatusManageDto> setProjectStatus(@PathParam("dbName") String dbName, public OperationResultDto<ProjectStatusManageDto> setProjectStatus(@PathVariable("dbName") String dbName,
@PathParam("periodId") Integer periodId, @PathVariable("periodId") Integer periodId,
@PathParam("status") Integer status) { @PathVariable("status") Integer status) {
return projectStatusManageService.setProjectStatus(dbName,periodId,status,identityService.getIdentityUser().getID()); return projectStatusManageService.setProjectStatus(dbName, periodId, status, identityService.getIdentityUser().getID());
} }
} }
...@@ -10,6 +10,7 @@ import pwc.taxtech.atms.MyMapper; ...@@ -10,6 +10,7 @@ import pwc.taxtech.atms.MyMapper;
import pwc.taxtech.atms.dto.taxadmin.ProjectDisplayDto; import pwc.taxtech.atms.dto.taxadmin.ProjectDisplayDto;
import pwc.taxtech.atms.entitiy.Project; import pwc.taxtech.atms.entitiy.Project;
import pwc.taxtech.atms.entitiy.ProjectExample; import pwc.taxtech.atms.entitiy.ProjectExample;
import pwc.taxtech.atms.entitiy.ProjectStatusManage;
@Mapper @Mapper
public interface ProjectMapper extends MyMapper { public interface ProjectMapper extends MyMapper {
...@@ -221,4 +222,13 @@ public interface ProjectMapper extends MyMapper { ...@@ -221,4 +222,13 @@ public interface ProjectMapper extends MyMapper {
"ORDER BY ea.EffectiveDate,org.Code" + "ORDER BY ea.EffectiveDate,org.Code" +
"</script>") "</script>")
List<ProjectDisplayDto> getProjectFromEnterpriseAccountSetOrg(@Param("orgID") String orgID, @Param("serviceID") String serviceID); List<ProjectDisplayDto> getProjectFromEnterpriseAccountSetOrg(@Param("orgID") String orgID, @Param("serviceID") String serviceID);
@Select("SELECT " +
" PeriodId,Status " +
"FROM " +
" ProjectStatusManage p " +
"WHERE " +
" p.DbName = #{dbName} " +
"ORDER BY PeriodId , Status")
List<ProjectStatusManage> selectProjectAllStatus(String dbName);
} }
\ No newline at end of file
package pwc.taxtech.atms.service; package pwc.taxtech.atms.service;
import java.util.List; import java.util.List;
import java.util.Map;
import pwc.taxtech.atms.dto.ProjectClientDto; import pwc.taxtech.atms.dto.ProjectClientDto;
import pwc.taxtech.atms.dto.ServiceTypeDto; import pwc.taxtech.atms.dto.ServiceTypeDto;
...@@ -41,6 +42,8 @@ public interface ProjectService { ...@@ -41,6 +42,8 @@ public interface ProjectService {
AddProjectResult addProject(ProjectDisplayDto projectDto, String userName); AddProjectResult addProject(ProjectDisplayDto projectDto, String userName);
Map<Integer,Integer> getProjectAllStatus(String dbName);
// Map<Integer, Integer> getProjectAllStatus(String dbName); // Map<Integer, Integer> getProjectAllStatus(String dbName);
} }
...@@ -22,16 +22,8 @@ import pwc.taxtech.atms.dto.TemplateGroupDto; ...@@ -22,16 +22,8 @@ import pwc.taxtech.atms.dto.TemplateGroupDto;
import pwc.taxtech.atms.dto.taxadmin.AddProjectResult; import pwc.taxtech.atms.dto.taxadmin.AddProjectResult;
import pwc.taxtech.atms.dto.taxadmin.ProjectDisplayDto; import pwc.taxtech.atms.dto.taxadmin.ProjectDisplayDto;
import pwc.taxtech.atms.dto.taxadmin.ProjectYearParam; import pwc.taxtech.atms.dto.taxadmin.ProjectYearParam;
import pwc.taxtech.atms.entitiy.OrganizationServiceTemplateGroupExample; import pwc.taxtech.atms.entitiy.*;
import pwc.taxtech.atms.entitiy.Project;
import pwc.taxtech.atms.entitiy.ProjectClient;
import pwc.taxtech.atms.entitiy.ProjectClientExample;
import pwc.taxtech.atms.entitiy.ProjectClientExample.Criteria; import pwc.taxtech.atms.entitiy.ProjectClientExample.Criteria;
import pwc.taxtech.atms.entitiy.ProjectServiceType;
import pwc.taxtech.atms.entitiy.ServiceType;
import pwc.taxtech.atms.entitiy.ServiceTypeExample;
import pwc.taxtech.atms.entitiy.TemplateGroup;
import pwc.taxtech.atms.entitiy.TemplateGroupExample;
import pwc.taxtech.atms.service.OperationLogService; import pwc.taxtech.atms.service.OperationLogService;
import pwc.taxtech.atms.service.ProjectService; import pwc.taxtech.atms.service.ProjectService;
...@@ -229,6 +221,17 @@ public class ProjectServiceImpl implements ProjectService { ...@@ -229,6 +221,17 @@ public class ProjectServiceImpl implements ProjectService {
} }
@Override
public Map<Integer, Integer> getProjectAllStatus(String dbName) {
List<ProjectStatusManage> psmList= projectMapper.selectProjectAllStatus(dbName);
Map<Integer,Integer> result =new HashMap<>(psmList.size());
psmList.forEach(m->{
result.put(m.getPeriodId(),m.getStatus());
});
return result;
}
private String generateDatabase(Project project, String accsetid) {//TODO: should be impl future(neo) private String generateDatabase(Project project, String accsetid) {//TODO: should be impl future(neo)
return "db_test"; return "db_test";
} }
......
...@@ -1697,7 +1697,7 @@ frameworkModule.controller('appOverviewController', ['$rootScope', '$scope', '$t ...@@ -1697,7 +1697,7 @@ frameworkModule.controller('appOverviewController', ['$rootScope', '$scope', '$t
projectService.addProject(project).success(function (rsp) { projectService.addProject(project).success(function (rsp) {
if (rsp && rsp.result) { if (rsp && rsp.result) {
project.haveCreateProject = true; project.haveCreateProject = true;
project.dbName = rsp.dbname; project.dbName = rsp.dBname;
project.id = rsp.projectID; project.id = rsp.projectID;
if (_.isNull(project.projectStatusList)) { //如果当前期间还没有导入任何数据的话,就添加一条未开始状态的记录 if (_.isNull(project.projectStatusList)) { //如果当前期间还没有导入任何数据的话,就添加一条未开始状态的记录
......
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