Commit b9902faf authored by cq990612's avatar cq990612

优化代码结构

parent d5b09a95
......@@ -10,7 +10,7 @@ import java.util.List;
*/
public interface WorkTypeService {
List<WorkType> getAll();
List<WorkType> getAll(Integer isSort);
List<Integer> getIdByReviewer(Integer reviewer);
......
......@@ -153,7 +153,7 @@ public class WorkHolidayServiceImpl implements WorkHolidayService {
List<WorkHoliday> workHolidays = workHolidayMapper.getByTypeAndStartDate(new Date());
WorkSubmitAdopt submitAdopt = workSubmitAdoptService.getById(1);
holidayAndAutoDto.setWorkHolidays(workHolidays).setWorkSubmitAdopt(submitAdopt);
List<WorkType> workTypes = workTypeService.getAll();
List<WorkType> workTypes = workTypeService.getAll(null);
if (!CollectionUtils.isEmpty(workTypes)) {
holidayAndAutoDto.setWorkTypes(workTypes);
}
......
......@@ -30,6 +30,8 @@ import org.springframework.util.StringUtils;
import java.util.*;
import static java.util.Collections.*;
/**
* <p>
* 服务实现类
......@@ -146,7 +148,7 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService {
reason.append(workProjectService.getById(wto.getProjectId()).getProjectName()).append(":").append(wto.getReason()).append(";");
}
if (!typeIds.contains(wto.getType())) {
List<WorkType> workTypes = workTypeService.getAll();
List<WorkType> workTypes = workTypeService.getAll(null);
if (!CollectionUtils.isEmpty(workTimeOrders)) {
for (WorkType value : workTypes) {
if (value.getId().equals(wto.getType())) {
......@@ -526,7 +528,7 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService {
ProjectsDto projectsDto = new ProjectsDto();
WorkUser user = workUserService.getById(userId);
// 1.获取可填报的类型
List<WorkType> workTypes = workTypeService.getAll();
List<WorkType> workTypes = workTypeService.getAll(1);
if (!CollectionUtils.isEmpty(workTypes)) {
projectsDto.setWorkTypes(workTypes);
}
......@@ -599,7 +601,7 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService {
}
}
}
Collections.sort(projectManagerDtos);
sort(projectManagerDtos);
projectsDto.setProjectManagerDto(projectManagerDtos);
return projectsDto;
}
......@@ -622,7 +624,7 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService {
List<WorkProject> projects = workProjectService.getNameByIds(projectIds, 1);
ProjectInfoDto projectInfoDto;
List<WorkType> workTypes = workTypeService.getAll();
List<WorkType> workTypes = workTypeService.getAll(null);
if (!CollectionUtils.isEmpty(workTypes)) {
for (WorkType value : workTypes) {
projectInfoDto = new ProjectInfoDto().setType(value.getId()).setTypeName(value.getName()).setDeptManagerName(deptManagerName);
......@@ -719,7 +721,7 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.NO_JOIN_EVERY_PROJECT_PLASE_JION);
}
}
List<WorkType> workTypes = workTypeService.getAll();
List<WorkType> workTypes = workTypeService.getAll(null);
if (!CollectionUtils.isEmpty(workTypes)) {
for (WorkType value : workTypes) {
if (value.getReviewer() == 2) {
......@@ -827,7 +829,7 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService {
}
private String getTypeName(Integer type) {
List<WorkType> workTypes = workTypeService.getAll();
List<WorkType> workTypes = workTypeService.getAll(null);
if (!CollectionUtils.isEmpty(workTypes)) {
for (WorkType value : workTypes) {
if (value.getId().equals(type)) {
......
......@@ -33,13 +33,15 @@ public class WorkTypeServiceImpl implements WorkTypeService {
@Override
public List<WorkType> getAll() {
public List<WorkType> getAll(Integer isSort) {
log.info("WorkTypeServiceImpl[]getAll[]");
List<WorkType> workTypes = workTypeMapper.getAll();
if (CollectionUtils.isEmpty(workTypes)) {
return null;
}
if (null != isSort && 1 == isSort) {
Collections.sort(workTypes);
}
return workTypes;
}
......
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