|
@@ -34,29 +34,32 @@ public class TaskServiceImpl implements TaskService {
|
|
private TaskMapper taskMapper;
|
|
private TaskMapper taskMapper;
|
|
@Autowired
|
|
@Autowired
|
|
private UserMapper userMapper;
|
|
private UserMapper userMapper;
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
- public boolean delete(Long id, Long adminId) throws ServiceException {
|
|
|
|
|
|
+ public boolean delete(Long id, Long adminId) throws ServiceException {
|
|
return taskMapper.deleteById(id) > 0;
|
|
return taskMapper.deleteById(id) > 0;
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public Page<TaskDTO> list(String taskType, Integer page, Integer limit, Long adminId,Long companyId) throws ServiceException {
|
|
|
|
|
|
+ public Page<TaskDTO> list(String taskType, Integer page, Integer limit, Long adminId, Long companyId) throws ServiceException {
|
|
Wrapper<TaskDO> wrapper = new EntityWrapper<TaskDO>();
|
|
Wrapper<TaskDO> wrapper = new EntityWrapper<TaskDO>();
|
|
if (taskType != null) {
|
|
if (taskType != null) {
|
|
wrapper.like("task_type", taskType);
|
|
wrapper.like("task_type", taskType);
|
|
}
|
|
}
|
|
- wrapper.orderBy("gmt_create",false);
|
|
|
|
- wrapper.orderBy("gmt_update",false);
|
|
|
|
- wrapper.eq("company_id",companyId);
|
|
|
|
|
|
+ wrapper.orderBy("gmt_create", false);
|
|
|
|
+ wrapper.orderBy("gmt_update", false);
|
|
|
|
+ wrapper.eq("company_id", companyId);
|
|
List<TaskDO> list = taskMapper.selectPage(new RowBounds((page - 1) * limit, limit), wrapper);
|
|
List<TaskDO> list = taskMapper.selectPage(new RowBounds((page - 1) * limit, limit), wrapper);
|
|
- List<TaskDTO> taskDTOS=new ArrayList<>();
|
|
|
|
- for(TaskDO taskDO : list){
|
|
|
|
- TaskDTO taskDTO=new TaskDTO();
|
|
|
|
- BeanUtils.copyProperties(taskDO,taskDTO);
|
|
|
|
- UserDO userDO=userMapper.selectById(taskDO.getUserId());
|
|
|
|
- taskDTO.setUserName(userDO.getUserName());
|
|
|
|
- taskDTO.setVueGmtCreate(taskDO.getGmtCreate());
|
|
|
|
- taskDTO.setVueGmtUpdate(taskDO.getGmtUpdate());
|
|
|
|
|
|
+ List<TaskDTO> taskDTOS = new ArrayList<>();
|
|
|
|
+ for (TaskDO taskDO : list) {
|
|
|
|
+ TaskDTO taskDTO = new TaskDTO();
|
|
|
|
+ BeanUtils.copyProperties(taskDO, taskDTO);
|
|
|
|
+ UserDO userDO = userMapper.selectById(taskDO.getUserId());
|
|
|
|
+ if (userDO != null) {
|
|
|
|
+ taskDTO.setUserName(userDO.getUserName());
|
|
|
|
+ taskDTO.setVueGmtCreate(taskDO.getGmtCreate());
|
|
|
|
+ taskDTO.setVueGmtUpdate(taskDO.getGmtUpdate());
|
|
|
|
+ }
|
|
taskDTOS.add(taskDTO);
|
|
taskDTOS.add(taskDTO);
|
|
}
|
|
}
|
|
Integer count = taskMapper.selectCount(wrapper);
|
|
Integer count = taskMapper.selectCount(wrapper);
|
|
@@ -65,37 +68,37 @@ public class TaskServiceImpl implements TaskService {
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
- public TaskDO create(String taskType, String orderNo, Long userId, Long adminId,Long companyId) throws ServiceException {
|
|
|
|
- Date now = new Date();
|
|
|
|
- TaskDO insertDO = new TaskDO();
|
|
|
|
- insertDO.setTaskType(taskType);
|
|
|
|
- insertDO.setOrderNo(orderNo);
|
|
|
|
- insertDO.setUserId(userId);
|
|
|
|
- insertDO.setGmtUpdate(now);
|
|
|
|
- insertDO.setGmtCreate(now);
|
|
|
|
- insertDO.setCompanyId(companyId);
|
|
|
|
- insertDO.setHide(0);
|
|
|
|
- if (taskMapper.insert(insertDO) > 0) {
|
|
|
|
- return insertDO;
|
|
|
|
- }
|
|
|
|
- throw new AdminServiceException(ExceptionDefinition.ADMIN_UNKNOWN_EXCEPTION);
|
|
|
|
|
|
+ public TaskDO create(String taskType, String orderNo, Long userId, Long adminId, Long companyId) throws ServiceException {
|
|
|
|
+ Date now = new Date();
|
|
|
|
+ TaskDO insertDO = new TaskDO();
|
|
|
|
+ insertDO.setTaskType(taskType);
|
|
|
|
+ insertDO.setOrderNo(orderNo);
|
|
|
|
+ insertDO.setUserId(userId);
|
|
|
|
+ insertDO.setGmtUpdate(now);
|
|
|
|
+ insertDO.setGmtCreate(now);
|
|
|
|
+ insertDO.setCompanyId(companyId);
|
|
|
|
+ insertDO.setHide(0);
|
|
|
|
+ if (taskMapper.insert(insertDO) > 0) {
|
|
|
|
+ return insertDO;
|
|
|
|
+ }
|
|
|
|
+ throw new AdminServiceException(ExceptionDefinition.ADMIN_UNKNOWN_EXCEPTION);
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
- public String edit(Long id, String taskType, String orderNo, Long userId, Long adminId,Long companyId) throws ServiceException {
|
|
|
|
- Date now = new Date();
|
|
|
|
- TaskDO updateDO = new TaskDO();
|
|
|
|
- updateDO.setId(id);
|
|
|
|
- updateDO.setTaskType(taskType);
|
|
|
|
- updateDO.setOrderNo(orderNo);
|
|
|
|
- updateDO.setUserId(userId);
|
|
|
|
- updateDO.setGmtUpdate(now);
|
|
|
|
- updateDO.setCompanyId(companyId);
|
|
|
|
- if (taskMapper.updateById(updateDO) > 0) {
|
|
|
|
- return "ok";
|
|
|
|
- }
|
|
|
|
- throw new AdminServiceException(ExceptionDefinition.ADMIN_UNKNOWN_EXCEPTION);
|
|
|
|
|
|
+ public String edit(Long id, String taskType, String orderNo, Long userId, Long adminId, Long companyId) throws ServiceException {
|
|
|
|
+ Date now = new Date();
|
|
|
|
+ TaskDO updateDO = new TaskDO();
|
|
|
|
+ updateDO.setId(id);
|
|
|
|
+ updateDO.setTaskType(taskType);
|
|
|
|
+ updateDO.setOrderNo(orderNo);
|
|
|
|
+ updateDO.setUserId(userId);
|
|
|
|
+ updateDO.setGmtUpdate(now);
|
|
|
|
+ updateDO.setCompanyId(companyId);
|
|
|
|
+ if (taskMapper.updateById(updateDO) > 0) {
|
|
|
|
+ return "ok";
|
|
|
|
+ }
|
|
|
|
+ throw new AdminServiceException(ExceptionDefinition.ADMIN_UNKNOWN_EXCEPTION);
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|