检验非空判断

This commit is contained in:
chen 2024-08-05 16:07:04 +08:00
parent 1c5a3595da
commit 136a6fd7dd
6 changed files with 235 additions and 218 deletions

View File

@ -84,6 +84,7 @@ public class ProjectAssessmentIndicatorsController implements ProjectAssessmentI
@PostMapping(Api.PROJECT_QUARTERLY_EVALUATION_LIST) @PostMapping(Api.PROJECT_QUARTERLY_EVALUATION_LIST)
public String list(@RequestHeader Long userId, @RequestBody PageNoUtil<ProjectAssessmentIndicatorsDto> pageNoUtil) throws XQException { public String list(@RequestHeader Long userId, @RequestBody PageNoUtil<ProjectAssessmentIndicatorsDto> pageNoUtil) throws XQException {
try { try {
if (!ObjectUtils.isEmpty(pageNoUtil)) {
Page<ProjectAssessmentIndicatorsDto> page = new Page<>(pageNoUtil.getPageNo(), pageNoUtil.getPageSize()); Page<ProjectAssessmentIndicatorsDto> page = new Page<>(pageNoUtil.getPageNo(), pageNoUtil.getPageSize());
List<ProjectAssessmentIndicators> indicatorsServiceList = indicatorsService.getList(page, pageNoUtil.getT(), String.valueOf(userId)); List<ProjectAssessmentIndicators> indicatorsServiceList = indicatorsService.getList(page, pageNoUtil.getT(), String.valueOf(userId));
ResultListReqUtil<ProjectAssessmentIndicators> listReqUtil = new ResultListReqUtil<>(); ResultListReqUtil<ProjectAssessmentIndicators> listReqUtil = new ResultListReqUtil<>();
@ -91,10 +92,12 @@ public class ProjectAssessmentIndicatorsController implements ProjectAssessmentI
listReqUtil.setPages(page.getPages()); listReqUtil.setPages(page.getPages());
listReqUtil.setTotal(page.getTotal()); listReqUtil.setTotal(page.getTotal());
return ApiResponse.fillSuccess(listReqUtil); return ApiResponse.fillSuccess(listReqUtil);
}
} catch (Exception e) { } catch (Exception e) {
log.error("ProjectAssessmentIndicatorsController.list", e); log.error("ProjectAssessmentIndicatorsController.list", e);
throw new XQException(ErrorCode.PROJECTINFO_EXCEPTION_ERROR, null); throw new XQException(ErrorCode.PROJECTINFO_EXCEPTION_ERROR, null);
} }
return ApiResponse.fillFail("获取失败!");
} }
@Override @Override

View File

@ -48,6 +48,7 @@ public class ProjectBudgetImplementController implements ProjectBudgetImplementA
@Override @Override
public String list(@RequestHeader Long userId,@RequestBody ProjectBudgetImplementFindReq projectBudgetImplementFindReq) throws XQException { public String list(@RequestHeader Long userId,@RequestBody ProjectBudgetImplementFindReq projectBudgetImplementFindReq) throws XQException {
try { try {
if (!ObjectUtils.isEmpty(projectBudgetImplementFindReq)) {
Page<ProjectBudgetImplementAddDto> page = new Page<>(projectBudgetImplementFindReq.getPageNo(), projectBudgetImplementFindReq.getPageSize()); Page<ProjectBudgetImplementAddDto> page = new Page<>(projectBudgetImplementFindReq.getPageNo(), projectBudgetImplementFindReq.getPageSize());
List<ProjectBudgetImplementAddDto> list = projectBudgetImplementService.getList(page, projectBudgetImplementFindReq); List<ProjectBudgetImplementAddDto> list = projectBudgetImplementService.getList(page, projectBudgetImplementFindReq);
for (ProjectBudgetImplementAddDto implementAddDto : list) { for (ProjectBudgetImplementAddDto implementAddDto : list) {
@ -86,10 +87,12 @@ public class ProjectBudgetImplementController implements ProjectBudgetImplementA
listReq.setTotal(page.getTotal()); listReq.setTotal(page.getTotal());
listReq.setPages(page.getPages()); listReq.setPages(page.getPages());
return ApiResponse.fillSuccess(listReq); return ApiResponse.fillSuccess(listReq);
}
} catch (Exception e) { } catch (Exception e) {
log.error("ProjectBudgetImplementController.list", e); log.error("ProjectBudgetImplementController.list", e);
throw new XQException(ErrorCode.PROJECTINFO_EXCEPTION_ERROR, null); throw new XQException(ErrorCode.PROJECTINFO_EXCEPTION_ERROR, null);
} }
return ApiResponse.fillFail("获取失败!");
} }

View File

@ -140,7 +140,7 @@ public class ProjectDepartmentController implements ProjectDepartmentApi {
log.error("ProjectDepartmentController.list", e); log.error("ProjectDepartmentController.list", e);
throw new XQException(ErrorCode.PROJECTINFO_EXCEPTION_ERROR, null); throw new XQException(ErrorCode.PROJECTINFO_EXCEPTION_ERROR, null);
} }
return null; return ApiResponse.fillFail("获取失败!");
} }
/** /**
@ -149,6 +149,7 @@ public class ProjectDepartmentController implements ProjectDepartmentApi {
* @return List<ProjectWeeklyDto> * @return List<ProjectWeeklyDto>
**/ **/
private List<ProjectWeeklyDto> getThisWeek(List<ProjectWeeklyDto> list) { private List<ProjectWeeklyDto> getThisWeek(List<ProjectWeeklyDto> list) {
if (!ObjectUtils.isEmpty(list)) {
for (int i = 0; i < list.size(); i++) { for (int i = 0; i < list.size(); i++) {
if (ObjectUtils.isEmpty(list.get(i).getThisWeek()) && ObjectUtils.isEmpty(list.get(i).getNextWeek())) { if (ObjectUtils.isEmpty(list.get(i).getThisWeek()) && ObjectUtils.isEmpty(list.get(i).getNextWeek())) {
EntityWrapper<ProjectWeekly> wrapper = new EntityWrapper(); EntityWrapper<ProjectWeekly> wrapper = new EntityWrapper();
@ -164,6 +165,7 @@ public class ProjectDepartmentController implements ProjectDepartmentApi {
list.get(i).setNextWeek(nextWeekBuilder.toString()); list.get(i).setNextWeek(nextWeekBuilder.toString());
} }
} }
}
return list; return list;
} }
@ -235,6 +237,6 @@ public class ProjectDepartmentController implements ProjectDepartmentApi {
log.error("ProjectDepartmentController.list", e); log.error("ProjectDepartmentController.list", e);
throw new XQException(ErrorCode.PROJECTINFO_EXCEPTION_ERROR, null); throw new XQException(ErrorCode.PROJECTINFO_EXCEPTION_ERROR, null);
} }
return null; return ApiResponse.fillFail("获取失败!");
} }
} }

View File

@ -124,8 +124,9 @@ public class ProjectInitComtroller implements ProjectInitApi {
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public String addInit(@RequestHeader("userId") Long userId, @RequestBody ProjectInfoInitDto initDto) throws XQException { public String addInit(@RequestHeader("userId") Long userId, @RequestBody ProjectInfoInitDto initDto) throws XQException {
ProjectInfoReq infoReq = initDto.getProjectInfoReq();
try { try {
if (!ObjectUtils.isEmpty(initDto)) {
ProjectInfoReq infoReq = initDto.getProjectInfoReq();
//判断项目名是否重复 //判断项目名是否重复
ProjectInfo info = new JacksonUtil<ProjectInfo>().setAddEntity(userId, infoReq, ProjectInfo.class); ProjectInfo info = new JacksonUtil<ProjectInfo>().setAddEntity(userId, infoReq, ProjectInfo.class);
EntityWrapper<ProjectInfo> wrapper = new EntityWrapper<>(); EntityWrapper<ProjectInfo> wrapper = new EntityWrapper<>();
@ -262,6 +263,8 @@ public class ProjectInitComtroller implements ProjectInitApi {
baseActiviti.startWorkflow(userId, info.getId(), aType, aClass, map); baseActiviti.startWorkflow(userId, info.getId(), aType, aClass, map);
} }
return ApiResponse.fillSuccess("添加成功"); return ApiResponse.fillSuccess("添加成功");
}
return ApiResponse.fillFail("操作失败");
} catch (Exception e) { } catch (Exception e) {
log.error("ProjectInitController.add", e); log.error("ProjectInitController.add", e);
// 批量新增出现异常被捕获时手动回滚事务保证数据库一致 // 批量新增出现异常被捕获时手动回滚事务保证数据库一致
@ -319,6 +322,7 @@ public class ProjectInitComtroller implements ProjectInitApi {
@PostMapping(Api.PROJECT_INIT_LIST) @PostMapping(Api.PROJECT_INIT_LIST)
public String list(@RequestHeader("userId") Long userId, @RequestBody ProjectFindReq projectFindReq) throws XQException { public String list(@RequestHeader("userId") Long userId, @RequestBody ProjectFindReq projectFindReq) throws XQException {
try { try {
if (!ObjectUtils.isEmpty(projectFindReq)) {
String projectName = projectFindReq.getProjectName(); String projectName = projectFindReq.getProjectName();
String projectCategory = projectFindReq.getProjectCategory(); String projectCategory = projectFindReq.getProjectCategory();
String projectStep = projectFindReq.getProjectStep(); String projectStep = projectFindReq.getProjectStep();
@ -355,10 +359,12 @@ public class ProjectInitComtroller implements ProjectInitApi {
resp.setPages(page.getPages()); resp.setPages(page.getPages());
resp.setTotal(page.getTotal()); resp.setTotal(page.getTotal());
return ApiResponse.fillSuccess(resp); return ApiResponse.fillSuccess(resp);
}
} catch (Exception e) { } catch (Exception e) {
log.error("ProjectInfoController.list", e); log.error("ProjectInfoController.list", e);
throw new XQException(ErrorCode.PROJECTINFO_EXCEPTION_ERROR, null); throw new XQException(ErrorCode.PROJECTINFO_EXCEPTION_ERROR, null);
} }
return ApiResponse.fillFail("获取失败!");
} }
@Transactional @Transactional

View File

@ -40,6 +40,7 @@ public class ProjectQuarterlyEvaluationController implements ProjectQuarterlyEva
@PostMapping(Api.PROJECT_QUARTERLY_EVALUATION) @PostMapping(Api.PROJECT_QUARTERLY_EVALUATION)
public String list(@RequestHeader Long userId, @RequestBody PageNoUtil<ProjectQuarterlyEvaluation> pageNoUtil) throws XQException { public String list(@RequestHeader Long userId, @RequestBody PageNoUtil<ProjectQuarterlyEvaluation> pageNoUtil) throws XQException {
try { try {
if (!ObjectUtils.isEmpty(pageNoUtil)) {
//先拿到季度审核表数据 //先拿到季度审核表数据
EntityWrapper<SystemUserLogin> userLoginEntityWrapper = new EntityWrapper<>(); EntityWrapper<SystemUserLogin> userLoginEntityWrapper = new EntityWrapper<>();
userLoginEntityWrapper.eq("id_", userId); userLoginEntityWrapper.eq("id_", userId);
@ -57,9 +58,11 @@ public class ProjectQuarterlyEvaluationController implements ProjectQuarterlyEva
} }
ResultListReqUtil<ProjectInfoListItemResp> listReqUtil = new ResultListReqUtil<>(list, page.getTotal(), page.getPages()); ResultListReqUtil<ProjectInfoListItemResp> listReqUtil = new ResultListReqUtil<>(list, page.getTotal(), page.getPages());
return ApiResponse.fillSuccess(listReqUtil); return ApiResponse.fillSuccess(listReqUtil);
}
} catch (Exception e) { } catch (Exception e) {
log.error("ProjectQuarterlyEvaluationController.list", e); log.error("ProjectQuarterlyEvaluationController.list", e);
throw new XQException(ErrorCode.PROJECTINFO_EXCEPTION_ERROR, null); throw new XQException(ErrorCode.PROJECTINFO_EXCEPTION_ERROR, null);
} }
return ApiResponse.fillFail("获取失败!");
} }
} }

View File

@ -106,7 +106,7 @@ public class ProjectWholeFirmController implements ProjectWholeFirmApi {
listResp.setUserId(String.valueOf(systemUserLogin.getUserinfoId())); listResp.setUserId(String.valueOf(systemUserLogin.getUserinfoId()));
return ApiResponse.fillSuccess(listResp); return ApiResponse.fillSuccess(listResp);
} }
return null; return ApiResponse.fillFail("获取失败!");
} }
/** /**