| | |
| | | String isOr() default ""; |
| | | // |
| | | |
| | | String orGroup() default "";
|
| | |
|
| | | enum Type { |
| | | // jie 2019/6/4 相等 |
| | | EQUAL |
| | |
| | | } |
| | | try { |
| | | List<Field> fields = getAllFields(query.getClass(), new ArrayList<>()); |
| | |
|
| | | Map<String, List<Predicate>> orGroupMap = new HashMap<String, List<Predicate>>();
|
| | |
|
| | | for (Field field : fields) { |
| | | boolean accessible = field.isAccessible(); |
| | | // 设置对象的访问权限,保证对private的属性的访 |
| | |
| | | } |
| | | // |
| | | |
| | | String orGroup = q.orGroup();
|
| | | if (ObjectUtil.isNotEmpty(orGroup)) {
|
| | | if (orGroupMap.get(orGroup) == null) {
|
| | | orGroupMap.put(orGroup, new ArrayList<Predicate>());
|
| | | }
|
| | | List<Predicate> predicates = orGroupMap.get(orGroup);
|
| | | switch (q.type()) {
|
| | | case EQUAL:
|
| | | predicates.add(cb.equal(getExpression(attributeName,join,root)
|
| | | .as((Class<? extends Comparable>) fieldType),val));
|
| | | break;
|
| | | case GREATER_THAN:
|
| | | predicates.add(cb.greaterThanOrEqualTo(getExpression(attributeName,join,root)
|
| | | .as((Class<? extends Comparable>) fieldType), (Comparable) val));
|
| | | break;
|
| | | case LESS_THAN:
|
| | | predicates.add(cb.lessThanOrEqualTo(getExpression(attributeName,join,root)
|
| | | .as((Class<? extends Comparable>) fieldType), (Comparable) val));
|
| | | break;
|
| | | case LESS_THAN_NQ:
|
| | | predicates.add(cb.lessThan(getExpression(attributeName,join,root)
|
| | | .as((Class<? extends Comparable>) fieldType), (Comparable) val));
|
| | | break;
|
| | | case INNER_LIKE:
|
| | | predicates.add(cb.like(getExpression(attributeName,join,root)
|
| | | .as(String.class), "%" + val.toString() + "%"));
|
| | | break;
|
| | | case LEFT_LIKE:
|
| | | predicates.add(cb.like(getExpression(attributeName,join,root)
|
| | | .as(String.class), "%" + val.toString()));
|
| | | break;
|
| | | case RIGHT_LIKE:
|
| | | predicates.add(cb.like(getExpression(attributeName,join,root)
|
| | | .as(String.class), val.toString() + "%"));
|
| | | break;
|
| | | case IN:
|
| | | if (CollUtil.isNotEmpty((Collection<Object>)val)) {
|
| | | predicates.add(getExpression(attributeName,join,root).in((Collection<Object>) val));
|
| | | }
|
| | | break;
|
| | | case NOT_IN:
|
| | | if (CollUtil.isNotEmpty((Collection<Object>)val)) {
|
| | | predicates.add(getExpression(attributeName,join,root).in((Collection<Object>) val).not());
|
| | | }
|
| | | break;
|
| | | case NOT_EQUAL:
|
| | | predicates.add(cb.notEqual(getExpression(attributeName,join,root), val));
|
| | | break;
|
| | | case NOT_NULL:
|
| | | predicates.add(cb.isNotNull(getExpression(attributeName,join,root)));
|
| | | break;
|
| | | case IS_NULL:
|
| | | predicates.add(cb.isNull(getExpression(attributeName,join,root)));
|
| | | break;
|
| | | case BETWEEN:
|
| | | List<Object> between = new ArrayList<>((List<Object>)val);
|
| | | predicates.add(cb.between(getExpression(attributeName, join, root).as((Class<? extends Comparable>) between.get(0).getClass()),
|
| | | (Comparable) between.get(0), (Comparable) between.get(1)));
|
| | | break;
|
| | | default: break;
|
| | | }
|
| | | } else {
|
| | | switch (q.type()) { |
| | | case EQUAL: |
| | | list.add(cb.equal(getExpression(attributeName,join,root) |
| | |
| | | default: break; |
| | | } |
| | | } |
| | | }
|
| | | field.setAccessible(accessible); |
| | | } |
| | | orGroupMap.values().forEach(predicates -> list.add(cb.or(predicates.toArray(new Predicate[0]))));
|
| | | } catch (Exception e) { |
| | | log.error(e.getMessage(), e); |
| | | } |
| | |
| | | return new ResponseEntity<>(attendanceService.queryAll(criteria,pageable),HttpStatus.OK); |
| | | } |
| | | |
| | | @GetMapping("/notNormal")
|
| | | @Log("查询考勤记录")
|
| | | @ApiOperation("查询考勤记录")
|
| | | @PreAuthorize("@el.check('attendance:list')")
|
| | | public ResponseEntity<Object> queryAttendanceNotNormal(AttendanceQueryCriteria criteria, Pageable pageable){
|
| | | return new ResponseEntity<>(attendanceService.queryAllNotNormal(criteria,pageable),HttpStatus.OK);
|
| | | }
|
| | |
|
| | | @GetMapping(value = "/all") |
| | | @Log("查询考勤记录") |
| | | @ApiOperation("查询考勤记录") |
| | |
| | | Map<String,Object> queryAll(AttendanceQueryCriteria criteria, Pageable pageable);
|
| | |
|
| | | /**
|
| | | * 查询数据分页
|
| | | * @param criteria 条件
|
| | | * @param pageable 分页参数
|
| | | * @return Map<String,Object>
|
| | | */
|
| | | Map<String,Object> queryAllNotNormal(AttendanceQueryCriteria criteria, Pageable pageable);
|
| | |
|
| | | /**
|
| | | * 查询所有数据不分页
|
| | | * @param criteria 条件参数
|
| | | * @return List<AttendanceDto>
|
| | |
| | | @Query(type = Query.Type.EQUAL, propName = "endClockResults") |
| | | private String endClockResults; |
| | | |
| | | /* 开始打卡模糊查询 */
|
| | | @Query(orGroup = "NotNormal", type = Query.Type.IN, propName = "startClockResults")
|
| | | private List<String> startClockResultsList;
|
| | |
|
| | | /* 结束打卡模糊查询 */
|
| | | @Query(orGroup = "NotNormal", type = Query.Type.IN, propName = "endClockResults")
|
| | | private List<String> endClockResultsList;
|
| | |
|
| | | /* 模糊 */ |
| | | @Query(propName = "attendanceDate", type = Query.Type.INNER_LIKE) |
| | | private String attendanceDateLike; |
| | | |
| | | @Query(propName = "userId", type = Query.Type.IN)
|
| | | private List<Long> userIds;
|
| | |
|
| | | private String targetYearMonth; |
| | | } |
| | |
| | | import me.zhengjie.modules.attendance.service.mapstruct.AttendanceMapper;
|
| | | import me.zhengjie.modules.constant.Constant;
|
| | | import me.zhengjie.modules.quartz.service.impl.WeComServiceImpl;
|
| | | import me.zhengjie.modules.system.domain.Role;
|
| | | import me.zhengjie.modules.system.domain.SysConfigHoliday;
|
| | | import me.zhengjie.modules.system.domain.SysRostering;
|
| | | import me.zhengjie.modules.system.domain.User;
|
| | | import me.zhengjie.modules.system.repository.DictDetailRepository;
|
| | | import me.zhengjie.modules.system.repository.SysConfigHolidayRepository;
|
| | | import me.zhengjie.modules.system.repository.SysRosteringRepository;
|
| | | import me.zhengjie.modules.system.repository.UserRepository;
|
| | | import me.zhengjie.modules.system.domain.*;
|
| | | import me.zhengjie.modules.system.repository.*;
|
| | | import me.zhengjie.modules.system.service.dto.SysConfigHolidayQueryCriteria;
|
| | | import me.zhengjie.utils.*;
|
| | | import org.apache.commons.lang3.ObjectUtils;
|
| | |
| | | }
|
| | |
|
| | | @Override
|
| | | public Map<String,Object> queryAllNotNormal(AttendanceQueryCriteria criteria, Pageable pageable) {
|
| | |
|
| | | if (criteria.getUserId() == null) {
|
| | | List<String> wecomExcludeList = dictDetailRepository.findByDictName("wecom_exclude_list").stream().map(DictDetail::getValue).collect(Collectors.toList());
|
| | | criteria.setUserIds(userRepository.findAllByEnabled(true).stream().filter(user ->!wecomExcludeList.contains(user.getWeComId())).map(User::getId).collect(Collectors.toList()));
|
| | | }
|
| | |
|
| | | criteria.setStartClockResultsList(Arrays.asList(Constant.ATTENDANCE_START_EARLY, Constant.ATTENDANCE_START_LATE, Constant.ATTENDANCE_STATE_WAITFOR, Constant.ATTENDANCE_STATE_NOTSIGNED, Constant.ATTENDANCE_STATE_LACK_OF_TIME));
|
| | | criteria.setEndClockResultsList(Arrays.asList(Constant.ATTENDANCE_START_EARLY, Constant.ATTENDANCE_START_LATE, Constant.ATTENDANCE_STATE_WAITFOR, Constant.ATTENDANCE_STATE_NOTSIGNED, Constant.ATTENDANCE_STATE_LACK_OF_TIME));
|
| | | Page<Attendance> page = attendanceRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
|
| | | //将实体转换为Dto(重写)
|
| | | Function<Attendance, AttendanceDto> func = attendance -> {
|
| | | // 将实体类转换成DTO
|
| | | AttendanceDto attendanceDto = attendanceMapper.toDto(attendance);
|
| | | //查询用户信息
|
| | | User user = userRepository.findById(attendanceDto.getUserId()).orElseGet(User::new);
|
| | | attendanceDto.setUserName(user.getNickName());
|
| | | return attendanceDto;
|
| | | };
|
| | | return PageUtil.toPage(page.map(func));
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<AttendanceDto> queryAll(AttendanceQueryCriteria criteria){
|
| | | return attendanceMapper.toDto(attendanceRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
|
| | | }
|
| | |
| | | package me.zhengjie.modules.task.service.impl;
|
| | |
|
| | | import lombok.RequiredArgsConstructor;
|
| | | import me.zhengjie.exception.BadRequestException;
|
| | | import me.zhengjie.modules.constant.Constant;
|
| | | import me.zhengjie.modules.project.domain.Project;
|
| | | import me.zhengjie.modules.project.repository.ProjectRepository;
|
| | |
| | | @CacheEvict(cacheNames = "ChildrenTask", allEntries = true)
|
| | | public TaskMongo create(Long userId, TaskMongo resources) {
|
| | | resources.setTaskStatus(Constant.TASK_STATUS_NOT_STARTED);
|
| | | boolean existed = mongoTemplate.exists(Query.query(Criteria.where("name").is(resources.getName()).and("projectId").is(resources.getProjectId())), TaskMongo.class);
|
| | | if (existed) {
|
| | | throw new BadRequestException("任务名称重复");
|
| | | }
|
| | | synchronized (lock) {
|
| | | // 查询最大的old_id值
|
| | | Query query = new Query();
|
| | |
| | | //
|
| | | // containUserList.addAll(userIdList.stream().filter(o -> !containUserList.contains(o)).collect(Collectors.toList()));
|
| | |
|
| | |
|
| | | boolean existed = mongoTemplate.exists(Query.query(Criteria.where("name").is(resources.getName()).and("projectId").is(resources.getProjectId()).and("id").ne(resources.getId())), TaskMongo.class);
|
| | | if (existed) {
|
| | | throw new BadRequestException("任务名称重复");
|
| | | }
|
| | | return mongoTemplate.save(resources);
|
| | |
|
| | | }
|
| | |
| | | }) |
| | | } |
| | | |
| | | export function getYearTimeLength(data) { |
| | | export function getYearTimeLength(userId, data) { |
| | | return request({ |
| | | url: 'api/attendanceLeave/getYearTimeLength', |
| | | url: 'api/attendanceLeave/getYearTimeLength/' + userId, |
| | | method: 'post', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export function getOverTimeLength(data) { |
| | | export function getOverTimeLength(userId, data) { |
| | | return request({ |
| | | url: 'api/attendanceLeave/getOverTimeLength', |
| | | url: 'api/attendanceLeave/getOverTimeLength/' + userId, |
| | | method: 'post', |
| | | data |
| | | }) |
| | |
| | | crudUser.getAll().then(res => { |
| | | this.users = res |
| | | }) |
| | | // 资产 |
| | | // 资产 response.data |
| | | crudAssetManagement.getAll().then(res => { |
| | | this.assetManagements = res |
| | | }) |
| | |
| | | return |
| | | } |
| | | // 获取年假剩余时长 |
| | | crudAttendanceLeave.getYearTimeLength((this.form.userId == null ? 1 : this.form.userId)).then(res => { |
| | | crudAttendanceLeave.getYearTimeLength((this.form.userId == null ? 1 : this.form.userId), this.form.leaveStartTime.substring(0, 4)).then(res => { |
| | | this.yearTimeLenght = res |
| | | }) |
| | | // 获取调休假剩余时长 |
| | | crudAttendanceLeave.getOverTimeLength((this.form.userId == null ? 1 : this.form.userId)).then(res => { |
| | | crudAttendanceLeave.getOverTimeLength((this.form.userId == null ? 1 : this.form.userId), this.form.leaveStartTime.substring(0, 7)).then(res => { |
| | | this.OverTimeLenght = res |
| | | }) |
| | | // 通过后台计算时长 |
| | |
| | | 当前任务:<i> {{ selectedTaskName }} </i> |
| | | <span |
| | | v-if="taskTotal.performanceType" |
| | | style="magin: right 10px;" |
| | | style="margin: right 10px;" |
| | | ><i> |
| | | (绩效类型: |
| | | {{ |