| | |
| | | import me.zhengjie.modules.system.service.mapstruct.UserLoginMapper; |
| | | import me.zhengjie.modules.system.service.mapstruct.UserMapper; |
| | | import me.zhengjie.modules.task.domain.TaskDaliy; |
| | | import me.zhengjie.modules.task.domain.TaskMongo; |
| | | import me.zhengjie.modules.task.repository.TaskDaliyRepository; |
| | | import me.zhengjie.modules.task.service.TaskDaliyService; |
| | | import me.zhengjie.modules.task.service.dto.TaskDaliyQueryCriteria; |
| | |
| | | import org.springframework.cache.annotation.Cacheable; |
| | | import org.springframework.data.domain.Page; |
| | | import org.springframework.data.domain.Pageable; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import javax.validation.constraints.NotBlank; |
| | | import java.io.File; |
| | |
| | | private final TaskDaliyService taskDaliyService; |
| | | private final DeptRepository deptRepository; |
| | | |
| | | private final MongoTemplate mongoTemplate; |
| | | |
| | | @Override |
| | | public Object queryAll(UserQueryCriteria criteria, Pageable pageable) { |
| | | Page<User> page = userRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder), pageable); |
| | |
| | | }); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | @Override |
| | | public List<UserDto> getUserByTaskId(String taskId) { |
| | | // 日历类 |
| | | Calendar calendar = Calendar.getInstance(); |
| | | // 日期格式化 |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| | | // 日历字符串 |
| | | String calendarStr = sdf.format(calendar.getTime()); |
| | | |
| | | TaskMongo taskMongo = mongoTemplate.findById(taskId, TaskMongo.class); |
| | | List<Long> containUserList = taskMongo.getContainUserList(); |
| | | List<User> userList = new ArrayList<>(); |
| | | if(containUserList.size() != 0){ |
| | | for (Long userId : containUserList) { |
| | | userList.add(userRepository.findById(userId).get()); |
| | | } |
| | | } |
| | | List<UserDto> userDto = userMapper.toDto(userList); |
| | | for (int i = 0; i < userDto.size(); i++) { |
| | | // 根据用户ID、指定年月查询用户级别工资 |
| | | SysUserLevelWage sysUserLevelWage = sysUserLevelWageRepository.findTargetYearMonth(userDto.get(i).getId(), calendarStr); |
| | | // 判断用户级别工资是否为空 |
| | | if (sysUserLevelWage != null) { |
| | | // 根据ID查询用户级别 |
| | | SysLevel sysLevel = sysLevelRepository.findById(sysUserLevelWage.getLevelId()).orElseGet(SysLevel::new); |
| | | // 用户 |
| | | userDto.get(i).setLevelName(sysLevel.getName()); |
| | | } else { |
| | | // 用户 |
| | | userDto.get(i).setLevelName(null); |
| | | } |
| | | } |
| | | return userDto; |
| | | } |
| | | |
| | | @Override |
| | |
| | | onlineUserService.kickOutForUsername(resources.getUsername()); |
| | | } |
| | | // 临时旧用户级别ID |
| | | Long tempOldLevelId = user.getLevelId();; |
| | | Long tempOldLevelId = user.getLevelId(); |
| | | ; |
| | | user.setUsername(resources.getUsername()); |
| | | user.setEmail(resources.getEmail()); |
| | | user.setEnabled(resources.getEnabled()); |
| | |
| | | |
| | | /** |
| | | * 获取日历信息 |
| | | * |
| | | * @param month |
| | | * @return |
| | | * @throws Exception |
| | |
| | | |
| | | /** |
| | | * 判断状态 |
| | | * |
| | | * @param result |
| | | * @return |
| | | */ |
| | |
| | | |
| | | /** |
| | | *获取用户基础信息 |
| | | * |
| | | * @return |
| | | * @throws ParseException |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 判断用户级别变更 |
| | | * |
| | | * @param userId |
| | | * @param oldLevelId |
| | | * @param newLevelId |
| | |
| | | |
| | | /** |
| | | * 创建用户级别工资 |
| | | * |
| | | * @param userId |
| | | * @param levelId |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 创建用户级别其他 |
| | | * |
| | | * @param userId |
| | | * @param levelId |
| | | */ |
| | |
| | | // 保存 |
| | | sysUserLevelOtherRepository.save(sysUserLevelOther); |
| | | } |
| | | |
| | | |
| | | } |