Commit ba04204a authored by cq990612's avatar cq990612

优化代码结构

parent 7f3846ab
......@@ -5,8 +5,8 @@ package cn.wisenergy.model.enums;
* @QQ1799796883
*/
public enum ChangeTypeEnum {
COSTBUDGET(1, "成本预算"),
WORKINGHOURSBUDGET(2, "工时预算"),
COSTBUDGET(1, "成本预算(万元)"),
WORKINGHOURSBUDGET(2, "工时预算(人/天)"),
STARTINGTIME(3, "预计开始时间"),
ENDTIME(4, "预计结束时间"),
......
......@@ -18,6 +18,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import java.util.Calendar;
import java.util.Date;
......@@ -174,7 +175,7 @@ public class WorkHolidayServiceImpl implements WorkHolidayService {
/*if (null == workHoliday.getDayType()) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.INPUT_PARAM_IS_NULL);
}*/
if (null == workHoliday.getDes()) {
if (StringUtils.isEmpty(workHoliday.getDes())) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.INPUT_PARAM_IS_NULL);
}
if (workHoliday.getDayStart().compareTo(workHoliday.getDayEnd()) > 0) {
......
......@@ -99,7 +99,7 @@ public class WorkProjectServiceImpl implements WorkProjectService {
}
List<WorkProject> workProjects = workProjectMapper.getProjectsByIds(ids, isConclusion);
if (CollectionUtils.isEmpty(workProjects)) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.MANAGER_NOT_PROJECT);
return null;
}
return workProjects;
}
......
......@@ -541,13 +541,16 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService {
if (!CollectionUtils.isEmpty(workTypes)) {
projectsDto.setWorkTypes(workTypes);
}
// 2.获取可填报的项目
projectsDto.setProjectInfoDto(getProjectInfoDto(userId));
// 3.获取可审批的项目
List<UserRoleLevelDto> roleUserLevel = UserRoleLevelUtils.getRoleUserLevel(userId);
if (CollectionUtils.isEmpty(roleUserLevel)) {
return projectsDto;
}
for (UserRoleLevelDto userRoleLevelDto : roleUserLevel) {
// 如果有审批权限
if (LevelEnum.EXAMINE.getLevelName().equals(userRoleLevelDto.getLevelName())) {
......@@ -620,6 +623,9 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService {
List<ProjectInfoDto> projectList = new ArrayList<>();
// 3.获取正在进行中的项目/商机
List<WorkProject> projects = workProjectService.getNameByIds(projectIds, 1);
if (CollectionUtils.isEmpty(projects)) {
return projectList;
}
ProjectInfoDto projectInfoDto;
List<WorkType> workTypes = workTypeService.getAll();
if (!CollectionUtils.isEmpty(workTypes)) {
......
......@@ -9,6 +9,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import java.util.List;
......@@ -51,11 +52,11 @@ public class WorkTypeServiceImpl implements WorkTypeService {
@Override
public Boolean addAndModifyWorkType(WorkType workType) {
log.info("WorkTypeServiceImpl[]modifyTypeById[]input.param.workType:{}" + workType);
if (null == workType || (null == workType.getName() && null == workType.getReviewer())) {
if (null == workType || (StringUtils.isEmpty(workType.getName()) && null == workType.getReviewer())) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.INPUT_PARAM_IS_NULL);
}
if (null == workType.getId()) {
if (null == workType.getName() || null == workType.getReviewer()) {
if (StringUtils.isEmpty(workType.getName()) || null == workType.getReviewer()) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.INPUT_PARAM_IS_NULL);
}
int insert = workTypeMapper.insert(workType);
......@@ -65,7 +66,6 @@ public class WorkTypeServiceImpl implements WorkTypeService {
if (i == 0) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.UPDATE_DATA_FAIL);
}
return i>0;
}
}
......
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