Commit ff585ba2 authored by neo's avatar neo

[DEV] get project status api impl

parent 93353486
...@@ -32,4 +32,14 @@ public class ProjectStatusManageController { ...@@ -32,4 +32,14 @@ public class ProjectStatusManageController {
@PathVariable("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());
} }
@ApiOperation(value = "getProjectStatus", notes = "")
@RequestMapping(value = {"getProjectStatus/{dbName}/{projectId}/{periodId}"}, method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@ResponseBody
public OperationResultDto<ProjectStatusManageDto> getProjectStatus(@PathVariable String dbName, @PathVariable String projectId,
@PathVariable Integer periodId) {
return projectStatusManageService.getProjectStatus(dbName, projectId, periodId);
}
} }
...@@ -5,4 +5,6 @@ import pwc.taxtech.atms.dto.taxadmin.ProjectStatusManageDto; ...@@ -5,4 +5,6 @@ import pwc.taxtech.atms.dto.taxadmin.ProjectStatusManageDto;
public interface ProjectStatusManageService { public interface ProjectStatusManageService {
OperationResultDto<ProjectStatusManageDto> setProjectStatus(String dbName, Integer periodId, Integer status, String id); OperationResultDto<ProjectStatusManageDto> setProjectStatus(String dbName, Integer periodId, Integer status, String id);
OperationResultDto<ProjectStatusManageDto> getProjectStatus(String dbName, String projectId, Integer periodId);
} }
...@@ -7,6 +7,7 @@ import org.springframework.stereotype.Service; ...@@ -7,6 +7,7 @@ import org.springframework.stereotype.Service;
import pwc.taxtech.atms.dao.ProjectStatusManageMapper; import pwc.taxtech.atms.dao.ProjectStatusManageMapper;
import pwc.taxtech.atms.dto.FieldsMapper; import pwc.taxtech.atms.dto.FieldsMapper;
import pwc.taxtech.atms.dto.OperationResultDto; import pwc.taxtech.atms.dto.OperationResultDto;
import pwc.taxtech.atms.dto.taxadmin.ProjectImportSubStatusDto;
import pwc.taxtech.atms.dto.taxadmin.ProjectStatusManageDto; import pwc.taxtech.atms.dto.taxadmin.ProjectStatusManageDto;
import pwc.taxtech.atms.entitiy.ProjectStatusManage; import pwc.taxtech.atms.entitiy.ProjectStatusManage;
import pwc.taxtech.atms.entitiy.ProjectStatusManageExample; import pwc.taxtech.atms.entitiy.ProjectStatusManageExample;
...@@ -75,4 +76,55 @@ public class ProjectStatusManageServiceImpl implements ProjectStatusManageServic ...@@ -75,4 +76,55 @@ public class ProjectStatusManageServiceImpl implements ProjectStatusManageServic
return ord; return ord;
} }
} }
@Override
public OperationResultDto<ProjectStatusManageDto> getProjectStatus(String dbName, String projectId, Integer periodId) {
try {
ProjectStatusManageExample example = new ProjectStatusManageExample();
example.createCriteria().andDbNameEqualTo(dbName).andPeriodIdEqualTo(periodId);
List<ProjectStatusManage> psmList = projectStatusManageMapper.selectByExample(example);
if (psmList != null && !psmList.isEmpty()) {
ProjectStatusManage first = psmList.get(FIRST_OR_DFAULT);
ProjectStatusManageDto dto = new ProjectStatusManageDto();
try {
FieldsMapper.map(first, dto);
} catch (Exception e) {
e.printStackTrace();
LOGGER.warn("field map some error");
}
ProjectImportSubStatusDto ssd = new ProjectImportSubStatusDto();//TODO:should query status from db (neo)
ssd.setAdjustImport(false);
ssd.setCustomInvoiceImport(false);
ssd.setEntryImport(false);
ssd.setErpImport(false);
ssd.setInputInvoiceImport(false);
ssd.setOutputInvoiceImport(false);
ssd.setTbImport(false);
ssd.setVoucherMapImport(false);
dto.setImportSubStatus(ssd);
OperationResultDto resultDto = new OperationResultDto();
resultDto.setResult(true);
resultDto.setResultMsg("");
resultDto.setData(dto);
return resultDto;
}else {
throw new Exception("数据库"+dbName+"状态信息为NULL");
}
}catch (Exception e){
OperationResultDto resultDto = new OperationResultDto();
resultDto.setResult(false);
resultDto.setResultMsg(e.getMessage());
resultDto.setData(null);
return resultDto;
}
}
} }
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