Merge branch 'master' of http://192.168.1.110:5678/r/pms-upgrade into yaozc
33 files modified
2 files renamed
| | |
| | | |
| | | // 查询出差记录 |
| | | @Query(value = "SELECT * from attendance_business_travel where user_id = ?1 and travel_start_time <= ?3 and travel_end_time >= ?2 and approval_status in ('business_approve_status_agree')", nativeQuery = true) |
| | | AttendanceBusinessTravel findByUserAndDate(Long userId, String startDate, String endDate); |
| | | AttendanceBusinessTravel findByUserAndDate(Long userId, LocalDateTime startDate, LocalDateTime endDate); |
| | | } |
| | |
| | | Double getSurplusYearTime(Long userId,String startTime,String endTime); |
| | | |
| | | //查询请假记录 |
| | | @Query(value = "SELECT * from attendance_leave where user_id = ?1 and leave_start_time <= ?3 and leave_end_time >= ?2 and approval_status IN ('approval_status_passed')", nativeQuery = true) |
| | | @Query(value = "SELECT * from attendance_leave where user_id = ?1 and leave_start_time < ?3 and leave_end_time > ?2 and approval_status IN ('approval_status_passed')", nativeQuery = true) |
| | | List<AttendanceLeave> findByUserIdAndDate(Long userId, LocalDateTime startDate, LocalDateTime endDate); |
| | | } |
| | |
| | | } |
| | | |
| | | @PutMapping(value = "/approve") |
| | | @Log("审核功能") |
| | | @ApiOperation("审核功能") |
| | | public ResponseEntity<Object> checkApprove(@Validated @RequestBody AttendanceBusinessTravel resources){ |
| | | @Log("审核/撤销功能") |
| | | @ApiOperation("审核/撤销功能") |
| | | public ResponseEntity<Object> checkApprove(@Validated @RequestBody AttendanceBusinessTravel resources) throws Exception { |
| | | attendanceBusinessTravelService.updateApprove(resources); |
| | | return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
| | | } |
| | | |
| | | @PutMapping(value = "/revoke") |
| | | @Log("出差撤销") |
| | | @ApiOperation("出差撤销") |
| | | public ResponseEntity<Object> revokeBussiness(@Validated @RequestBody AttendanceBusinessTravel resources){ |
| | | attendanceBusinessTravelService.updateRevoke(resources); |
| | | return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
| | | } |
| | | } |
| | |
| | | @PostMapping(value = "/addAttendanceInfo") |
| | | @Log("考勤信息补充") |
| | | @ApiOperation("考勤信息补充") |
| | | @PreAuthorize("@el.check('attendance:addAttendanceInfo')") |
| | | public ResponseEntity<Object> addAttendanceInfo(@Validated @RequestBody Attendance attendance) throws Exception { |
| | | attendanceService.addAttendanceInfo(attendance); |
| | | return new ResponseEntity<>(HttpStatus.CREATED); |
| | | } |
| | | |
| | | } |
| | |
| | | @PutMapping(value = "/approve") |
| | | @Log("审核功能") |
| | | @ApiOperation("审核功能") |
| | | public ResponseEntity<Object> checkApprove(@Validated @RequestBody AttendanceGoOut resources){ |
| | | public ResponseEntity<Object> checkApprove(@Validated @RequestBody AttendanceGoOut resources) throws Exception { |
| | | attendanceGoOutService.updateApprove(resources); |
| | | return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
| | | } |
| | | |
| | | @PutMapping(value = "/revoke") |
| | | @Log("外出撤销") |
| | | @ApiOperation("外出撤销") |
| | | public ResponseEntity<Object> revokeGoOut(@Validated @RequestBody AttendanceGoOut resources){ |
| | | attendanceGoOutService.updateRevoke(resources); |
| | | return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
| | | } |
| | | } |
| | |
| | | @PutMapping(value = "/approve") |
| | | @Log("审核功能") |
| | | @ApiOperation("审核功能") |
| | | public ResponseEntity<Object> checkApprove(@Validated @RequestBody AttendanceLeave resources){ |
| | | public ResponseEntity<Object> checkApprove(@Validated @RequestBody AttendanceLeave resources) throws Exception { |
| | | attendanceLeaveService.updateApprove(resources); |
| | | return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
| | | } |
| | |
| | | * 审核功能 |
| | | * @param resources / |
| | | */ |
| | | void updateApprove(AttendanceBusinessTravel resources); |
| | | void updateApprove(AttendanceBusinessTravel resources) throws Exception; |
| | | |
| | | /** |
| | | * 审核撤销 |
| | | * @param resources |
| | | */ |
| | | void updateRevoke(AttendanceBusinessTravel resources); |
| | | } |
| | |
| | | * 审核功能 |
| | | * @param resources / |
| | | */ |
| | | void updateApprove(AttendanceGoOut resources); |
| | | |
| | | /** |
| | | * 撤销功能 |
| | | * @param resources |
| | | */ |
| | | void updateRevoke(AttendanceGoOut resources); |
| | | void updateApprove(AttendanceGoOut resources) throws Exception; |
| | | } |
| | |
| | | * 审核功能 |
| | | * @param resources / |
| | | */ |
| | | void updateApprove(AttendanceLeave resources); |
| | | void updateApprove(AttendanceLeave resources) throws Exception; |
| | | |
| | | /** |
| | | * 多选删除 |
| | |
| | | import me.zhengjie.modules.attendance.service.dto.AttendanceGoOutDto; |
| | | import me.zhengjie.modules.constant.Constant; |
| | | import me.zhengjie.modules.quartz.service.OpaiDingTalkService; |
| | | import me.zhengjie.modules.quartz.service.impl.DingTalkServiceImpl; |
| | | import me.zhengjie.modules.system.domain.Job; |
| | | import me.zhengjie.modules.system.domain.Role; |
| | | import me.zhengjie.modules.system.domain.SysConfigHoliday; |
| | | 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.UserRepository; |
| | | import me.zhengjie.utils.*; |
| | |
| | | private final AttendanceRepository attendanceRepository; |
| | | private final AttendanceLeaveRepository attendanceLeaveRepository; |
| | | private final AttendanceGoOutRepository attendanceGoOutRepository; |
| | | private final DictDetailRepository dictDetailRepository; |
| | | private final DingTalkServiceImpl dingTalkService; |
| | | |
| | | @Override |
| | | public Map<String,Object> queryAll(AttendanceBusinessTravelQueryCriteria criteria, Pageable pageable){ |
| | |
| | | public void download(List<AttendanceBusinessTravelDto> all, HttpServletResponse response) throws IOException { |
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | | for (AttendanceBusinessTravelDto attendanceBusinessTravel : all) { |
| | | String bussDurationUnit = attendanceBusinessTravel.getDurationUnit() != null ? dictDetailRepository.findByDictNameAndValue(Constant.CARD_APPROVE_STATUS, attendanceBusinessTravel.getDurationUnit()).getLabel() : ""; |
| | | String bussStatus = attendanceBusinessTravel.getApprovalStatus() != null ? dictDetailRepository.findByDictNameAndValue(Constant.BUSSINESS_APPROVE_STATUS, attendanceBusinessTravel.getApprovalStatus()).getLabel() : ""; |
| | | Map<String,Object> map = new LinkedHashMap<>(); |
| | | map.put("用户id", attendanceBusinessTravel.getUserId()); |
| | | map.put("审批用户id", attendanceBusinessTravel.getApprovalUserId()); |
| | | map.put("出差开始时间", attendanceBusinessTravel.getTravelStartTime()); |
| | | map.put("出差结束时间", attendanceBusinessTravel.getTravelEndTime()); |
| | | map.put("出差时长", attendanceBusinessTravel.getTravelDuration()); |
| | | map.put("时长单位", attendanceBusinessTravel.getDurationUnit()); |
| | | map.put("时长单位", bussDurationUnit); |
| | | map.put("出差原因", attendanceBusinessTravel.getTravelReason()); |
| | | map.put("出发城市", attendanceBusinessTravel.getDepartureCity()); |
| | | map.put("到达城市", attendanceBusinessTravel.getArrivalCity()); |
| | | map.put("审批状态", attendanceBusinessTravel.getApprovalStatus()); |
| | | map.put("审批状态", bussStatus); |
| | | map.put("审批说明", attendanceBusinessTravel.getApprovalDescription()); |
| | | map.put("备注", attendanceBusinessTravel.getRemarks()); |
| | | map.put("创建者", attendanceBusinessTravel.getCreateBy()); |
| | |
| | | } |
| | | |
| | | /** |
| | | * 审核功能 |
| | | * 审核/撤销功能 |
| | | * @param resources / |
| | | */ |
| | | @Override |
| | | public void updateApprove(AttendanceBusinessTravel resources) { |
| | | public void updateApprove(AttendanceBusinessTravel resources) throws Exception { |
| | | AttendanceBusinessTravel attendanceBusinessTravel = attendanceBusinessTravelRepository.findById(resources.getId()).orElseGet(AttendanceBusinessTravel::new); |
| | | ValidationUtil.isNull( attendanceBusinessTravel.getId(),"AttendanceBusinessTravel","id",resources.getId()); |
| | | attendanceBusinessTravel.copy(resources); |
| | | //审批通过直接改考勤记录的状态 |
| | | if(resources.getApprovalStatus().equals(Constant.BUSSINESS_APPROVE_STATUS_AGREE)){ |
| | | // 查询考勤记录是否存在 |
| | | Attendance attendance = attendanceRepository.findAllByUserIdAndAttendanceDate(resources.getUserId(),resources.getTravelStartTime().toLocalDateTime().toString().substring(0,10)); |
| | | if(ObjectUtils.isNotEmpty(attendance)){ |
| | | attendance.setStartClockResults(Constant.ATTENDANCE_STATE_BUSINESS); |
| | | attendance.setEndClockResults(Constant.ATTENDANCE_STATE_BUSINESS); |
| | | attendanceRepository.save(attendance); |
| | | } |
| | | } |
| | | attendanceBusinessTravelRepository.save(attendanceBusinessTravel); |
| | | // 调用定时任务修改考勤记录 |
| | | List<User> userList = new ArrayList<>(); |
| | | if(ObjectUtils.isNotEmpty(attendanceBusinessTravel.getUserId())){ |
| | | User user = userRepository.findById(attendanceBusinessTravel.getUserId()).orElseGet(User::new); |
| | | userList.add(user); |
| | | } |
| | | |
| | | /** |
| | | * 审核撤销 |
| | | * @param resources |
| | | */ |
| | | @Override |
| | | public void updateRevoke(AttendanceBusinessTravel resources) { |
| | | AttendanceBusinessTravel attendanceBusinessTravel = attendanceBusinessTravelRepository.findById(resources.getId()).orElseGet(AttendanceBusinessTravel::new); |
| | | ValidationUtil.isNull( attendanceBusinessTravel.getId(),"AttendanceBusinessTravel","id",resources.getId()); |
| | | attendanceBusinessTravel.copy(resources); |
| | | attendanceBusinessTravel.setApprovalStatus(Constant.BUSSINESS_APPROVE_STATUS_REVIEWED); |
| | | // 查询考勤记录是否存在,修改状态为等待 |
| | | Attendance attendance = attendanceRepository.findAllByUserIdAndAttendanceDate(resources.getUserId(),resources.getTravelStartTime().toLocalDateTime().toString().substring(0,10)); |
| | | if(ObjectUtils.isNotEmpty(attendance)){ |
| | | attendance.setStartClockResults(Constant.ATTENDANCE_STATE_WAITFOR); |
| | | attendance.setEndClockResults(Constant.ATTENDANCE_STATE_WAITFOR); |
| | | attendanceRepository.save(attendance); |
| | | } |
| | | attendanceBusinessTravelRepository.save(attendanceBusinessTravel); |
| | | SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd"); |
| | | String attendanceDate = df.format(attendanceBusinessTravel.getTravelStartTime()); |
| | | dingTalkService.getDingTalkAttendanceListOfNoonOrNight(attendanceDate,userList); |
| | | } |
| | | } |
| | |
| | | import me.zhengjie.modules.system.domain.Role; |
| | | import me.zhengjie.modules.system.domain.SysConfigProportion; |
| | | import me.zhengjie.modules.system.domain.User; |
| | | import me.zhengjie.modules.system.repository.DictDetailRepository; |
| | | import me.zhengjie.modules.system.repository.RoleRepository; |
| | | import me.zhengjie.modules.system.repository.SysConfigProportionRepository; |
| | | import me.zhengjie.modules.system.repository.UserRepository; |
| | |
| | | private final RoleRepository roleRepository; |
| | | private final AttendanceRepository attendanceRepository; |
| | | private final SysConfigProportionRepository sysConfigProportionRepository; |
| | | private final DictDetailRepository dictDetailRepository; |
| | | |
| | | @Override |
| | | public Map<String,Object> queryAll(AttendanceCardreplacementQueryCriteria criteria, Pageable pageable){ |
| | |
| | | public void download(List<AttendanceCardreplacementDto> all, HttpServletResponse response) throws IOException { |
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | | for (AttendanceCardreplacementDto attendanceCardreplacement : all) { |
| | | String attCardreplacementType = attendanceCardreplacement.getApprovalStatus() != null ? dictDetailRepository.findByDictNameAndValue(Constant.CARD_APPROVE_STATUS, attendanceCardreplacement.getApprovalStatus()).getLabel() : ""; |
| | | String attCardReplacementDistinguish = attendanceCardreplacement.getCardReplacementDistinguish() != null ? dictDetailRepository.findByDictNameAndValue(Constant.CARD_REPLACEMENT_DIFFERENTIATION, attendanceCardreplacement.getCardReplacementDistinguish()).getLabel() : ""; |
| | | Map<String,Object> map = new LinkedHashMap<>(); |
| | | map.put("用户id", attendanceCardreplacement.getUserId()); |
| | | map.put("审批用户id", attendanceCardreplacement.getApprovalUserId()); |
| | | map.put("补卡时间", attendanceCardreplacement.getCardReplacementTime()); |
| | | map.put("补卡原因", attendanceCardreplacement.getCardReplacementReason()); |
| | | map.put("审批状态", attendanceCardreplacement.getApprovalStatus()); |
| | | map.put("审批状态", attCardreplacementType); |
| | | map.put("审批说明", attendanceCardreplacement.getApprovalDescription()); |
| | | map.put("补卡区分", attendanceCardreplacement.getCardReplacementDistinguish()); |
| | | map.put("补卡区分", attCardReplacementDistinguish); |
| | | map.put("备注", attendanceCardreplacement.getRemarks()); |
| | | map.put("创建者", attendanceCardreplacement.getCreateBy()); |
| | | map.put("创建时间", attendanceCardreplacement.getCreateTime()); |
| | |
| | | import me.zhengjie.modules.attendance.service.dto.AttendanceLeaveDto; |
| | | import me.zhengjie.modules.constant.Constant; |
| | | import me.zhengjie.modules.quartz.service.OpaiDingTalkService; |
| | | import me.zhengjie.modules.quartz.service.impl.DingTalkServiceImpl; |
| | | import me.zhengjie.modules.system.domain.Job; |
| | | import me.zhengjie.modules.system.domain.Role; |
| | | import me.zhengjie.modules.system.domain.SysConfigHoliday; |
| | | 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.UserRepository; |
| | | import me.zhengjie.utils.*; |
| | |
| | | private final AttendanceRepository attendanceRepository; |
| | | private final AttendanceLeaveRepository attendanceLeaveRepository; |
| | | private final AttendanceBusinessTravelRepository attendanceBusinessTravelRepository; |
| | | private final DictDetailRepository dictDetailRepository; |
| | | private final DingTalkServiceImpl dingTalkService; |
| | | |
| | | @Override |
| | | public Map<String,Object> queryAll(AttendanceGoOutQueryCriteria criteria, Pageable pageable){ |
| | |
| | | public void download(List<AttendanceGoOutDto> all, HttpServletResponse response) throws IOException { |
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | | for (AttendanceGoOutDto attendanceGoOut : all) { |
| | | String outOfOfficeType = attendanceGoOut.getOutOfOfficeType() != null ? dictDetailRepository.findByDictNameAndValue(Constant.GOOUT_APPROVE_STATUS, attendanceGoOut.getOutOfOfficeType()).getLabel() : ""; |
| | | String outDurationUnit = attendanceGoOut.getDurationUnit() != null ? dictDetailRepository.findByDictNameAndValue(Constant.LEAVE_TIME_TYPE, attendanceGoOut.getDurationUnit()).getLabel() : ""; |
| | | Map<String,Object> map = new LinkedHashMap<>(); |
| | | map.put("用户id", attendanceGoOut.getUserId()); |
| | | map.put("审批用户id", attendanceGoOut.getApprovalUserId()); |
| | | map.put("外出开始时间", attendanceGoOut.getOutStartTime()); |
| | | map.put("外出结束时间", attendanceGoOut.getOutEndTime()); |
| | | map.put("外出时长", attendanceGoOut.getOutDuration()); |
| | | map.put("时长单位", attendanceGoOut.getDurationUnit()); |
| | | map.put("外出类型", attendanceGoOut.getOutOfOfficeType()); |
| | | map.put("时长单位", outDurationUnit); |
| | | map.put("外出类型", outOfOfficeType); |
| | | map.put("外出原因", attendanceGoOut.getOutReason()); |
| | | map.put("审批状态", attendanceGoOut.getApprovalStatus()); |
| | | map.put("审批说明", attendanceGoOut.getApprovalDescription()); |
| | |
| | | } |
| | | |
| | | /** |
| | | * 审核功能 |
| | | * 审核/撤销功能 |
| | | * @param resources / |
| | | */ |
| | | @Override |
| | | public void updateApprove(AttendanceGoOut resources) { |
| | | public void updateApprove(AttendanceGoOut resources) throws Exception { |
| | | AttendanceGoOut attendanceGoOut = attendanceGoOutRepository.findById(resources.getId()).orElseGet(AttendanceGoOut::new); |
| | | ValidationUtil.isNull( attendanceGoOut.getId(),"AttendanceGoOut","id",resources.getId()); |
| | | attendanceGoOut.copy(resources); |
| | | //审批通过直接改考勤记录的状态 |
| | | if(resources.getApprovalStatus().equals(Constant.GOOUT_APPROVE_STATUS_AGREE)){ |
| | | // 查询考勤记录是否存在 |
| | | Attendance attendance = attendanceRepository.findAllByUserIdAndAttendanceDate(resources.getUserId(),resources.getOutStartTime().toLocalDateTime().toString().substring(0,10)); |
| | | if(ObjectUtils.isNotEmpty(attendance)){ |
| | | if (!attendance.getStartClockResults().equals(Constant.ATTENDANCE_STATE_GOOUT) && resources.getOutStartTime().toLocalDateTime().compareTo(attendance.getRosteringWorkStartTime().toLocalDateTime()) <= 0) { |
| | | attendance.setStartClockResults(Constant.ATTENDANCE_STATE_GOOUT); |
| | | } |
| | | if (!attendance.getEndClockResults().equals(Constant.ATTENDANCE_STATE_GOOUT) &&resources.getOutEndTime().toLocalDateTime().compareTo(attendance.getRosteringWorkEndTime().toLocalDateTime()) >= 0) { |
| | | attendance.setEndClockResults(Constant.ATTENDANCE_STATE_GOOUT); |
| | | } |
| | | attendanceRepository.save(attendance); |
| | | } |
| | | } |
| | | attendanceGoOutRepository.save(attendanceGoOut); |
| | | // 调用定时任务修改考勤记录 |
| | | List<User> userList = new ArrayList<>(); |
| | | if(ObjectUtils.isNotEmpty(attendanceGoOut.getUserId())){ |
| | | User user = userRepository.findById(attendanceGoOut.getUserId()).orElseGet(User::new); |
| | | userList.add(user); |
| | | } |
| | | |
| | | /** |
| | | * 外出撤销 |
| | | * @param resources |
| | | */ |
| | | @Override |
| | | public void updateRevoke(AttendanceGoOut resources) { |
| | | AttendanceGoOut attendanceGoOut = attendanceGoOutRepository.findById(resources.getId()).orElseGet(AttendanceGoOut::new); |
| | | ValidationUtil.isNull( attendanceGoOut.getId(),"AttendanceGoOut","id",resources.getId()); |
| | | attendanceGoOut.copy(resources); |
| | | attendanceGoOut.setApprovalStatus(Constant.GOOUT_APPROVE_STATUS_REVIEWED); |
| | | // 查询考勤记录是否存在 |
| | | Attendance attendance = attendanceRepository.findAllByUserIdAndAttendanceDate(resources.getUserId(),resources.getOutStartTime().toLocalDateTime().toString().substring(0,10)); |
| | | if(ObjectUtils.isNotEmpty(attendance)){ |
| | | attendance.setStartClockResults(Constant.ATTENDANCE_STATE_WAITFOR); |
| | | attendance.setEndClockResults(Constant.ATTENDANCE_STATE_WAITFOR); |
| | | attendanceRepository.save(attendance); |
| | | } |
| | | attendanceGoOutRepository.save(attendanceGoOut); |
| | | SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd"); |
| | | String attendanceDate = df.format(attendanceGoOut.getOutStartTime()); |
| | | dingTalkService.getDingTalkAttendanceListOfNoonOrNight(attendanceDate,userList); |
| | | } |
| | | } |
| | |
| | | import me.zhengjie.modules.attendance.service.dto.AttendanceDto; |
| | | import me.zhengjie.modules.constant.Constant; |
| | | import me.zhengjie.modules.quartz.service.OpaiDingTalkService; |
| | | import me.zhengjie.modules.quartz.service.impl.DingTalkServiceImpl; |
| | | import me.zhengjie.modules.system.domain.*; |
| | | import me.zhengjie.modules.system.repository.DictDetailRepository; |
| | | import me.zhengjie.modules.system.repository.SysConfigHolidayRepository; |
| | |
| | | private final AttendanceRepository attendanceRepository; |
| | | private final AttendanceGoOutRepository attendanceGoOutRepository; |
| | | private final AttendanceBusinessTravelRepository attendanceBusinessTravelRepository; |
| | | private final DingTalkServiceImpl dingTalkService; |
| | | |
| | | @Override |
| | | public Map<String,Object> queryAll(AttendanceLeaveQueryCriteria criteria, Pageable pageable){ |
| | |
| | | * @param resources / |
| | | */ |
| | | @Override |
| | | public void updateApprove(AttendanceLeave resources) { |
| | | public void updateApprove(AttendanceLeave resources) throws Exception { |
| | | AttendanceLeave attendanceLeave = attendanceLeaveRepository.findById(resources.getId()).orElseGet(AttendanceLeave::new); |
| | | ValidationUtil.isNull( attendanceLeave.getId(),"AttendanceLeave","id",resources.getId()); |
| | | attendanceLeave.copy(resources); |
| | | //审批通过直接改考勤记录的状态 |
| | | if(resources.getApprovalStatus().equals(Constant.APPROVAL_STATUS_PASSED)){ |
| | | // 查询考勤记录是否存在 |
| | | Attendance attendance = attendanceRepository.findAllByUserIdAndAttendanceDate(resources.getUserId(),resources.getLeaveStartTime().toLocalDateTime().toString().substring(0,10)); |
| | | if(ObjectUtils.isNotEmpty(attendance)){ |
| | | if (!attendance.getStartClockResults().equals(Constant.ATTENDANCE_STATE_LEAVE) && resources.getLeaveStartTime().toLocalDateTime().compareTo(attendance.getRosteringWorkStartTime().toLocalDateTime()) <= 0) { |
| | | attendance.setStartClockResults(Constant.ATTENDANCE_STATE_LEAVE); |
| | | } |
| | | if (!attendance.getEndClockResults().equals(Constant.ATTENDANCE_STATE_LEAVE) &&resources.getLeaveEndTime().toLocalDateTime().compareTo(attendance.getRosteringWorkEndTime().toLocalDateTime()) >= 0) { |
| | | attendance.setEndClockResults(Constant.ATTENDANCE_STATE_LEAVE); |
| | | } |
| | | attendanceRepository.save(attendance); |
| | | } |
| | | } |
| | | attendanceLeaveRepository.save(attendanceLeave); |
| | | // 调用定时任务修改考勤记录 |
| | | List<User> userList = new ArrayList<>(); |
| | | if(ObjectUtils.isNotEmpty(attendanceLeave.getUserId())){ |
| | | User user = userRepository.findById(attendanceLeave.getUserId()).orElseGet(User::new); |
| | | userList.add(user); |
| | | } |
| | | SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd"); |
| | | String attendanceDate = df.format(attendanceLeave.getLeaveStartTime()); |
| | | dingTalkService.getDingTalkAttendanceListOfNoonOrNight(attendanceDate,userList); |
| | | } |
| | | |
| | | @Override |
| | |
| | | public void download(List<AttendanceLeaveDto> all, HttpServletResponse response) throws IOException { |
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | | for (AttendanceLeaveDto attendanceLeave : all) { |
| | | String leavrType = attendanceLeave.getLeaveType() != null ? dictDetailRepository.findByDictNameAndValue(Constant.LEAVE_TYPE, attendanceLeave.getLeaveType()).getLabel() : ""; |
| | | String leaveStatus = attendanceLeave.getApprovalStatus() != null ? dictDetailRepository.findByDictNameAndValue(Constant.APPROVAL_STATUS, attendanceLeave.getApprovalStatus()).getLabel() : ""; |
| | | Map<String,Object> map = new LinkedHashMap<>(); |
| | | map.put("用户ID", attendanceLeave.getUserId()); |
| | | map.put("审批用户ID", attendanceLeave.getApprovalUserId()); |
| | | map.put("请假类型", attendanceLeave.getLeaveType()); |
| | | map.put("请假类型", leavrType); |
| | | map.put("请假开始时间", attendanceLeave.getLeaveStartTime()); |
| | | map.put("请假结束时间", attendanceLeave.getLeaveEndTime()); |
| | | map.put("请假时长", attendanceLeave.getLeaveDuration()); |
| | | map.put("请假原因", attendanceLeave.getLeaveReason()); |
| | | map.put("审批状态", attendanceLeave.getApprovalStatus()); |
| | | map.put("审批状态", leaveStatus); |
| | | map.put("审批说明", attendanceLeave.getApprovalDescription()); |
| | | map.put("备注", attendanceLeave.getRemarks()); |
| | | map.put("创建者", attendanceLeave.getCreateBy()); |
| | |
| | | private final AttendanceBusinessTravelRepository attendanceBusinessTravelRepository; |
| | | private final AttendanceGoOutRepository attendanceGoOutRepository; |
| | | private final DingTalkServiceImpl dingTalkService; |
| | | private final OapiDingTalkMethod oapiDingTalkMethod; |
| | | |
| | | @Override |
| | | public Map<String,Object> queryAll(AttendanceQueryCriteria criteria, Pageable pageable){ |
| | |
| | | */ |
| | | @Override |
| | | public void addAttendanceInfo(Attendance attendance) throws Exception { |
| | | // 获取今天日期 |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | String todayDate = sdf.format(new Date()); |
| | | if(attendance.getAttendanceDate().compareTo(Timestamp.valueOf(todayDate)) >= 0){ |
| | | throw new BadRequestException("只能更新小于等于今天的考勤信息"); |
| | | } |
| | | SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd"); |
| | | String attendanceDate = df.format(attendance.getAttendanceDate()); |
| | | List<User> userList = new ArrayList<>(); |
| | |
| | | User user = userRepository.findById(attendance.getUserId()).orElseGet(User::new); |
| | | userList.add(user); |
| | | } |
| | | // 调用0时定时任务 |
| | | dingTalkService.getDingTalkAttendanceList(attendance.getAttendanceDate()); |
| | | // 选择日期和员工更新员工的考勤信息,未选择员工则更新所有人 |
| | | dingTalkService.getDingTalkAttendanceListOfNoonOrNight(attendanceDate ,userList); |
| | | } |
| | |
| | | import me.zhengjie.modules.project.domain.ProjectPerformance; |
| | | import org.springframework.data.jpa.repository.JpaRepository; |
| | | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; |
| | | import org.springframework.data.jpa.repository.Query; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | |
| | | * @date 2023-01-17 |
| | | **/ |
| | | public interface ProjectPerformanceRepository extends JpaRepository<ProjectPerformance, Long>, JpaSpecificationExecutor<ProjectPerformance> { |
| | | |
| | | // 根据项目查询绩效表 |
| | | @Query(value = "SELECT * FROM `project_performance` WHERE project_id = ?", nativeQuery = true) |
| | | ProjectPerformance findByProjectId(Long id); |
| | | } |
| | |
| | | return new ResponseEntity<>(projectPerformanceService.queryAll(criteria,pageable),HttpStatus.OK); |
| | | } |
| | | |
| | | @GetMapping(value = "/all") |
| | | @Log("查询项目绩效") |
| | | @ApiOperation("查询项目绩效") |
| | | @PreAuthorize("@el.check('projectPerformance:list')") |
| | | public ResponseEntity<Object> queryProjectPerformance(ProjectPerformanceQueryCriteria criteria){ |
| | | return new ResponseEntity<>(projectPerformanceService.queryAll(criteria),HttpStatus.OK); |
| | | } |
| | | |
| | | @PostMapping |
| | | @Log("新增项目绩效") |
| | | @ApiOperation("新增项目绩效") |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | import io.swagger.annotations.*; |
| | | import java.io.IOException; |
| | | import java.text.ParseException; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | /** |
| | |
| | | return new ResponseEntity<>(projectPerformanceDetailService.queryAll(criteria,pageable),HttpStatus.OK); |
| | | } |
| | | |
| | | @GetMapping(value = "/all") |
| | | @Log("查询项目绩效详细") |
| | | @ApiOperation("查询项目绩效详细") |
| | | @PreAuthorize("@el.check('projectPerformanceDetail:list')") |
| | | public ResponseEntity<Object> queryProjectPerformanceDetail(ProjectPerformanceDetailQueryCriteria criteria){ |
| | | return new ResponseEntity<>(projectPerformanceDetailService.queryAll(criteria),HttpStatus.OK); |
| | | } |
| | | |
| | | @PostMapping |
| | | @Log("新增项目绩效详细") |
| | | @ApiOperation("新增项目绩效详细") |
| | | @PreAuthorize("@el.check('projectPerformanceDetail:add')") |
| | | public ResponseEntity<Object> createProjectPerformanceDetail(@Validated @RequestBody ProjectPerformanceDetail resources){ |
| | | public ResponseEntity<Object> createProjectPerformanceDetail(@Validated @RequestBody ProjectPerformanceDetail resources) throws ParseException { |
| | | return new ResponseEntity<>(projectPerformanceDetailService.create(resources),HttpStatus.CREATED); |
| | | } |
| | | |
| | |
| | | import me.zhengjie.modules.project.service.dto.ProjectPerformanceDetailDto; |
| | | import me.zhengjie.modules.project.service.dto.ProjectPerformanceDetailQueryCriteria; |
| | | import org.springframework.data.domain.Pageable; |
| | | |
| | | import java.text.ParseException; |
| | | import java.util.Map; |
| | | import java.util.List; |
| | | import java.io.IOException; |
| | |
| | | * @param resources / |
| | | * @return ProjectPerformanceDetailDto |
| | | */ |
| | | ProjectPerformanceDetailDto create(ProjectPerformanceDetail resources); |
| | | ProjectPerformanceDetailDto create(ProjectPerformanceDetail resources) throws ParseException; |
| | | |
| | | /** |
| | | * 编辑 |
| | |
| | | package me.zhengjie.modules.project.service.dto; |
| | | |
| | | import lombok.Data; |
| | | import me.zhengjie.base.BaseDTO; |
| | | |
| | | import java.sql.Timestamp; |
| | | import java.io.Serializable; |
| | | |
| | |
| | | * @date 2023-01-17 |
| | | **/ |
| | | @Data |
| | | public class ProjectPerformanceDetailDto implements Serializable { |
| | | public class ProjectPerformanceDetailDto extends BaseDTO implements Serializable { |
| | | |
| | | /** ID */ |
| | | private Long id; |
| | |
| | | /** 绩效年月 */ |
| | | private Timestamp yearMonth; |
| | | |
| | | /** 创建者 */ |
| | | private String createBy; |
| | | /** 员工姓名 */ |
| | | private String userName; |
| | | |
| | | /** 创建时间 */ |
| | | private Timestamp createTime; |
| | | |
| | | /** 更新者 */ |
| | | private String updateBy; |
| | | |
| | | /** 更新时间 */ |
| | | private Timestamp updateTime; |
| | | /** 项目名称 */ |
| | | private String projectName; |
| | | } |
| | |
| | | package me.zhengjie.modules.project.service.dto; |
| | | |
| | | import lombok.Data; |
| | | import me.zhengjie.base.BaseDTO; |
| | | |
| | | import java.sql.Timestamp; |
| | | import java.io.Serializable; |
| | | |
| | |
| | | * @date 2023-01-17 |
| | | **/ |
| | | @Data |
| | | public class ProjectPerformanceDto implements Serializable { |
| | | public class ProjectPerformanceDto extends BaseDTO implements Serializable { |
| | | |
| | | /** ID */ |
| | | private Long id; |
| | |
| | | /** 绩效年月 */ |
| | | private Timestamp yearMonth; |
| | | |
| | | /** 创建者 */ |
| | | private String createBy; |
| | | |
| | | /** 创建时间 */ |
| | | private Timestamp createTime; |
| | | |
| | | /** 更新者 */ |
| | | private String updateBy; |
| | | |
| | | /** 更新时间 */ |
| | | private Timestamp updateTime; |
| | | /** 项目名称 */ |
| | | private String projectName; |
| | | } |
| | |
| | | |
| | | /** 精确 */ |
| | | @Query |
| | | private Timestamp startDate; |
| | | |
| | | /** 精确 */ |
| | | @Query |
| | | private Timestamp endDate; |
| | | |
| | | /** 精确 */ |
| | | @Query |
| | | private Timestamp yearMonth; |
| | | } |
| | |
| | | */ |
| | | package me.zhengjie.modules.project.service.impl; |
| | | |
| | | import me.zhengjie.modules.project.domain.Project; |
| | | import me.zhengjie.modules.project.domain.ProjectPerformance; |
| | | import me.zhengjie.modules.project.domain.ProjectPerformanceDetail; |
| | | import me.zhengjie.modules.project.repository.ProjectRepository; |
| | | import me.zhengjie.modules.project.service.dto.ProjectPerformanceDto; |
| | | import me.zhengjie.modules.system.domain.User; |
| | | import me.zhengjie.modules.system.repository.UserRepository; |
| | | import me.zhengjie.utils.ValidationUtil; |
| | | import me.zhengjie.utils.FileUtil; |
| | | import lombok.RequiredArgsConstructor; |
| | |
| | | import org.springframework.data.domain.Pageable; |
| | | import me.zhengjie.utils.PageUtil; |
| | | import me.zhengjie.utils.QueryHelp; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import java.sql.Timestamp; |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.io.IOException; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.ArrayList; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.function.Function; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | |
| | | |
| | | private final ProjectPerformanceDetailRepository projectPerformanceDetailRepository; |
| | | private final ProjectPerformanceDetailMapper projectPerformanceDetailMapper; |
| | | private final UserRepository userRepository; |
| | | private final ProjectRepository projectRepository; |
| | | |
| | | @Override |
| | | public Map<String,Object> queryAll(ProjectPerformanceDetailQueryCriteria criteria, Pageable pageable){ |
| | | Page<ProjectPerformanceDetail> page = projectPerformanceDetailRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); |
| | | return PageUtil.toPage(page.map(projectPerformanceDetailMapper::toDto)); |
| | | //将实体转换为Dto(重写) |
| | | Function<ProjectPerformanceDetail, ProjectPerformanceDetailDto> func = new Function<ProjectPerformanceDetail, ProjectPerformanceDetailDto>(){ |
| | | |
| | | @Override |
| | | public ProjectPerformanceDetailDto apply(ProjectPerformanceDetail projectPerformanceDetail) { |
| | | // 将实体类转换成DTO |
| | | ProjectPerformanceDetailDto projectPerformanceDetailDto = projectPerformanceDetailMapper.toDto(projectPerformanceDetail); |
| | | //查询用户名称 |
| | | User user = userRepository.findById(projectPerformanceDetailDto.getUserId()).orElseGet(User::new); |
| | | projectPerformanceDetailDto.setUserName(user.getNickName()); |
| | | //查询项目名称 |
| | | Project project = projectRepository.findById(projectPerformanceDetailDto.getProjectId()).orElseGet(Project::new); |
| | | projectPerformanceDetailDto.setProjectName(project.getName()); |
| | | return projectPerformanceDetailDto; |
| | | } |
| | | }; |
| | | return PageUtil.toPage(page.map(func)); |
| | | } |
| | | |
| | | @Override |
| | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public ProjectPerformanceDetailDto create(ProjectPerformanceDetail resources) { |
| | | public ProjectPerformanceDetailDto create(ProjectPerformanceDetail resources) throws ParseException { |
| | | return projectPerformanceDetailMapper.toDto(projectPerformanceDetailRepository.save(resources)); |
| | | } |
| | | |
| | |
| | | @Override |
| | | public void download(List<ProjectPerformanceDetailDto> all, HttpServletResponse response) throws IOException { |
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | | SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | for (ProjectPerformanceDetailDto projectPerformanceDetail : all) { |
| | | Map<String,Object> map = new LinkedHashMap<>(); |
| | | map.put("员工ID", projectPerformanceDetail.getUserId()); |
| | | Project project = projectRepository.findById(projectPerformanceDetail.getProjectId()).orElseGet(Project::new); |
| | | User user = userRepository.findById(projectPerformanceDetail.getUserId()).orElseGet(User::new); |
| | | map.put("员工", user.getNickName()); |
| | | map.put("绩效工时", projectPerformanceDetail.getPerformanceHours()); |
| | | map.put("项目ID", projectPerformanceDetail.getProjectId()); |
| | | map.put("绩效年月", projectPerformanceDetail.getYearMonth()); |
| | | map.put("项目", project.getName()); |
| | | map.put("绩效年月", (df.format(projectPerformanceDetail.getYearMonth())).substring(0,7)); |
| | | map.put("创建者", projectPerformanceDetail.getCreateBy()); |
| | | map.put("创建时间", projectPerformanceDetail.getCreateTime()); |
| | | map.put("更新者", projectPerformanceDetail.getUpdateBy()); |
| | |
| | | |
| | | import java.io.IOException; |
| | | import java.sql.Timestamp; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDate; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.ArrayList; |
| | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Map.Entry; |
| | | import java.util.function.Function; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import me.zhengjie.exception.BadRequestException; |
| | | import me.zhengjie.modules.attendance.domain.AttendanceBusinessTravel; |
| | | import me.zhengjie.modules.attendance.service.dto.AttendanceBusinessTravelDto; |
| | | import me.zhengjie.modules.project.domain.Project; |
| | | import me.zhengjie.modules.project.repository.ProjectRepository; |
| | | import me.zhengjie.modules.system.domain.SysConfigProportion; |
| | | import me.zhengjie.modules.system.domain.User; |
| | | import org.apache.commons.lang3.ObjectUtils; |
| | | import org.springframework.data.domain.Page; |
| | | import org.springframework.data.domain.Pageable; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | private final TaskDaliyRepository taskDaliyRepository; |
| | | private final TaskUserRepository taskUserRepository; |
| | | private final ProjectPerformanceDetailRepository projectPerformanceDetailRepository; |
| | | private final ProjectRepository projectRepository; |
| | | |
| | | @Override |
| | | public Map<String,Object> queryAll(ProjectPerformanceQueryCriteria criteria, Pageable pageable){ |
| | | Page<ProjectPerformance> page = projectPerformanceRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); |
| | | return PageUtil.toPage(page.map(projectPerformanceMapper::toDto)); |
| | | //将实体转换为Dto(重写) |
| | | Function<ProjectPerformance, ProjectPerformanceDto> func = new Function<ProjectPerformance, ProjectPerformanceDto>(){ |
| | | |
| | | @Override |
| | | public ProjectPerformanceDto apply(ProjectPerformance projectPerformance) { |
| | | // 将实体类转换成DTO |
| | | ProjectPerformanceDto projectPerformanceDto = projectPerformanceMapper.toDto(projectPerformance); |
| | | //查询项目名称 |
| | | Project project = projectRepository.findById(projectPerformanceDto.getProjectId()).orElseGet(Project::new); |
| | | projectPerformanceDto.setProjectName(project.getName()); |
| | | return projectPerformanceDto; |
| | | } |
| | | }; |
| | | return PageUtil.toPage(page.map(func)); |
| | | } |
| | | |
| | | @Override |
| | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public ProjectPerformanceDto create(ProjectPerformance resources) { |
| | | //判断项目名称是否存在 |
| | | getInfo(resources,null); |
| | | return projectPerformanceMapper.toDto(projectPerformanceRepository.save(resources)); |
| | | } |
| | | |
| | |
| | | public void update(ProjectPerformance resources) { |
| | | ProjectPerformance projectPerformance = projectPerformanceRepository.findById(resources.getId()).orElseGet(ProjectPerformance::new); |
| | | ValidationUtil.isNull( projectPerformance.getId(),"ProjectPerformance","id",resources.getId()); |
| | | //判断项目名称是否存在 |
| | | getInfo(resources,projectPerformance); |
| | | projectPerformance.copy(resources); |
| | | projectPerformanceRepository.save(projectPerformance); |
| | | } |
| | | |
| | | /** |
| | | * 重名验证 |
| | | * @param / |
| | | */ |
| | | public void getInfo(ProjectPerformance resources, ProjectPerformance projectPerformance){ |
| | | //查询项目绩效表 |
| | | ProjectPerformance projectPerformance1 = projectPerformanceRepository.findByProjectId(resources.getProjectId()); |
| | | if(ObjectUtils.isNotEmpty(resources.getId())){ |
| | | if(projectPerformance1 != null && projectPerformance1.getId() != projectPerformance.getId()){ |
| | | throw new BadRequestException("项目名称已存在"); |
| | | } |
| | | }else{ |
| | | if(projectPerformance1 != null){ |
| | | throw new BadRequestException("标题项目名称已存在"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | @Override |
| | |
| | | @Override |
| | | public void download(List<ProjectPerformanceDto> all, HttpServletResponse response) throws IOException { |
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | | SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:ss:mm"); |
| | | for (ProjectPerformanceDto projectPerformance : all) { |
| | | Map<String,Object> map = new LinkedHashMap<>(); |
| | | map.put("项目ID", projectPerformance.getProjectId()); |
| | | map.put("结算开始日", projectPerformance.getStartDate()); |
| | | map.put("结算终了日", projectPerformance.getEndDate()); |
| | | map.put("绩效年月", projectPerformance.getYearMonth()); |
| | | Project project = projectRepository.findById(projectPerformance.getProjectId()).orElseGet(Project::new); |
| | | map.put("项目", project.getName()); |
| | | map.put("结算开始日", (df.format(projectPerformance.getStartDate())).substring(0,10)); |
| | | map.put("结算终了日", (df.format(projectPerformance.getEndDate())).substring(0,10)); |
| | | map.put("绩效年月", (df.format(projectPerformance.getYearMonth())).substring(0,7)); |
| | | map.put("创建者", projectPerformance.getCreateBy()); |
| | | map.put("创建时间", projectPerformance.getCreateTime()); |
| | | map.put("更新者", projectPerformance.getUpdateBy()); |
| | |
| | | |
| | | private final AttendanceLeaveRepository attendanceLeaveRepository; |
| | | |
| | | private final SysRosteringRepository sysRosteringRepository; |
| | | |
| | | /** |
| | | * 每天0点执行,新增用户考勤信息 |
| | | * @throws Exception |
| | | */ |
| | | public void getDingTalkAttendanceList(Timestamp attendDate) throws Exception { |
| | | //查询状态正常的员工 |
| | | List<User> userList = getUserList(); |
| | | //获取今天时间 |
| | | SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd"); |
| | | String todayDate = df.format(new Date()); |
| | | //获取当前时间 |
| | | Calendar calTodayDay = Calendar.getInstance(); |
| | | calTodayDay.setTime(Timestamp.valueOf(todayDate + " 00:00:00")); |
| | | //查询节假日表是否有记录 |
| | | SysConfigHoliday sysConfigHoliday = sysConfigHolidayRepository.findByHolidayDate(todayDate); |
| | | // attendDate为null(这是定时任务) 或者 参数日期小于等于今天在创建(这是考勤按钮调用) |
| | | if(ObjectUtils.isEmpty(attendDate) || attendDate.compareTo(Timestamp.valueOf(todayDate+ " 00:00:00")) <= 0) { |
| | | //遍历在职员工向考勤记录添加数据 |
| | | for (User user : userList) { |
| | | // 没有钉钉号的不更新 |
| | | if (ObjectUtils.isNotEmpty(user.getDingding())) { |
| | | //查询当前用户的排班 |
| | | SysRostering sysRostering = sysRosteringRepository.findByRosId(user.getSysRostering().getId()); |
| | | //查询考勤记录是否存在 |
| | | Attendance attendance = attendanceRepository.findAllByUserIdAndAttendanceDate(user.getId(), (attendDate == null ? todayDate : df.format(attendDate))); |
| | | DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("HH:mm:ss"); |
| | | if (ObjectUtil.isEmpty(attendance)) { |
| | | attendance = new Attendance(); |
| | | } |
| | | //添加记录 |
| | | attendance.setUserId(user.getId()); |
| | | Date date = df.parse((attendDate == null ? todayDate : df.format(attendDate))); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | String today = sdf.format(date); |
| | | attendance.setAttendanceDate(Timestamp.valueOf(today)); |
| | | //状态为等待 |
| | | attendance.setStartClockResults(Constant.ATTENDANCE_STATE_WAITFOR); |
| | | attendance.setEndClockResults(Constant.ATTENDANCE_STATE_WAITFOR); |
| | | if (calTodayDay.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY && sysConfigHoliday == null || calTodayDay.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY && sysConfigHoliday == null) { |
| | | //双休 |
| | | attendance.setDateType(Constant.DATE_TYPE_WEEKEND); |
| | | } else if (sysConfigHoliday != null && sysConfigHoliday.getDateType().equals(Constant.DATE_TYPE_LEGAL_HOLIDAYS)) { |
| | | //法定 |
| | | attendance.setDateType(Constant.DATE_TYPE_LEGAL_HOLIDAYS); |
| | | } else { |
| | | //除了法定节假日和双休都属于工作日 |
| | | attendance.setDateType(Constant.DATE_TYPE_WEEKDAY); |
| | | } |
| | | |
| | | attendance.setRosteringWorkStartTime(Timestamp.valueOf((attendDate == null ? todayDate : df.format(attendDate)) + " " + dateTimeFormatter.format(sysRostering.getWorkStartTime()))); |
| | | attendance.setRosteringWorkEndTime(Timestamp.valueOf((attendDate == null ? todayDate : df.format(attendDate)) + " " + dateTimeFormatter.format(sysRostering.getWorkEndTime()))); |
| | | attendance.setRosteringLunchStartTime(Timestamp.valueOf((attendDate == null ? todayDate : df.format(attendDate)) + " " + dateTimeFormatter.format(sysRostering.getLunchStartTime()))); |
| | | attendance.setRosteringLunchEndTime(Timestamp.valueOf((attendDate == null ? todayDate : df.format(attendDate)) + " " + dateTimeFormatter.format(sysRostering.getLunchEndTime()))); |
| | | attendanceRepository.save(attendance); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 中午12点30或凌晨02:30执行定时任务 |
| | | * @throws Exception |
| | |
| | | }else { |
| | | calDay.setTime(Timestamp.valueOf(yesterday + " 00:00:00")); |
| | | } |
| | | String timeResult = ""; |
| | | //遍历在职员工向考勤记录添加数据 |
| | | for (User user : userList) { |
| | | if(ObjectUtils.isNotEmpty(user.getDingding())){ |
| | |
| | | attendance = attendanceRepository.findAllByUserIdAndAttendanceDate(user.getId(), yesterday); |
| | | oapiDingTalkRecordResultList = opaiDingTalkService.getAttendanceList(oapiDingTalkRecordResultList, oapiDingTalkAccessToken.getAccessToken(), yesterday + " 00:00:00", userDinDingList, 0l, 50l); |
| | | } |
| | | // attendance为空, attendDate不为空是考勤信息补全功能,创建考勤 |
| | | if(ObjectUtils.isEmpty(attendance) && ObjectUtils.isNotEmpty(attendDate)){ |
| | | attendance = new Attendance(); |
| | | Date date = df.parse(attendDate); |
| | | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | String attDate =simpleDateFormat.format(date); |
| | | Calendar calTodayDay = Calendar.getInstance(); |
| | | calTodayDay.setTime(Timestamp.valueOf(attendDate + " 00:00:00")); |
| | | //查询节假日表是否有记录 |
| | | SysConfigHoliday sysConfigHoliday = sysConfigHolidayRepository.findByHolidayDate(todayDate); |
| | | attendance.setUserId(user.getId()); |
| | | attendance.setAttendanceDate(Timestamp.valueOf(attDate)); |
| | | if(calTodayDay.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY && sysConfigHoliday == null || calTodayDay.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY && sysConfigHoliday == null){ |
| | | //双休 |
| | | attendance.setDateType(Constant.DATE_TYPE_WEEKEND); |
| | | }else if(sysConfigHoliday != null && sysConfigHoliday.getDateType().equals(Constant.DATE_TYPE_LEGAL_HOLIDAYS)){ |
| | | //法定 |
| | | attendance.setDateType(Constant.DATE_TYPE_LEGAL_HOLIDAYS); |
| | | }else{ |
| | | //除了法定节假日和双休都属于工作日 |
| | | attendance.setDateType(Constant.DATE_TYPE_WEEKDAY); |
| | | } |
| | | attendance.setStartClockResults(Constant.ATTENDANCE_STATE_WAITFOR); |
| | | attendance.setEndClockResults(Constant.ATTENDANCE_STATE_WAITFOR); |
| | | attendance.setRosteringWorkStartTime(Timestamp.valueOf(todayDate + " " + dateTimeFormatter.format(user.getSysRostering().getWorkStartTime()))); |
| | | attendance.setRosteringWorkEndTime(Timestamp.valueOf(todayDate + " " + dateTimeFormatter.format(user.getSysRostering().getWorkEndTime()))); |
| | | attendance.setRosteringLunchStartTime(Timestamp.valueOf(todayDate + " " + dateTimeFormatter.format(user.getSysRostering().getLunchStartTime()))); |
| | | attendance.setRosteringLunchEndTime(Timestamp.valueOf(todayDate + " " + dateTimeFormatter.format(user.getSysRostering().getLunchEndTime()))); |
| | | } |
| | | for (OapiDingTalkRecordResult oapiDingTalkRecordResult : oapiDingTalkRecordResultList) { |
| | | |
| | | if ("NotSigned".equals(oapiDingTalkRecordResult.getTimeResult())) { |
| | | oapiDingTalkRecordResult.setUserCheckTime(null); |
| | | timeResult = "NotSigned"; |
| | | } |
| | | if ("OnDuty".equals(oapiDingTalkRecordResult.getCheckType())) { |
| | | // 状态不等于等待,说明有审批通过,不修改 |
| | | if(attendance.getStartClockResults().equals(Constant.ATTENDANCE_STATE_WAITFOR)){ |
| | | attendance.setStartClockResults(ObjectUtil.isEmpty(oapiDingTalkRecordResult.getUserCheckTime()) ? oapiDingTalkRecordResult.getTimeResult() : checkResult(user.getSysRostering(), oapiDingTalkRecordResult.getUserCheckTime(), 1)); |
| | | } |
| | | attendance.setStartClockResults(ObjectUtil.isEmpty(oapiDingTalkRecordResult.getUserCheckTime()) ? Constant.ATTENDANCE_STATE_NOTSIGNED : checkResult(user.getSysRostering(), oapiDingTalkRecordResult.getUserCheckTime(), 1)); |
| | | attendance.setStartLocationResults(setLocationResults(oapiDingTalkRecordResult.getLocationResult())); |
| | | attendance.setActualWorkStartTime(oapiDingTalkRecordResult.getUserCheckTime()); |
| | | }else if("OffDuty".equals(oapiDingTalkRecordResult.getCheckType())){ |
| | | if(attendance.getStartClockResults().equals(Constant.ATTENDANCE_STATE_WAITFOR)){ |
| | | attendance.setEndClockResults(ObjectUtil.isEmpty(oapiDingTalkRecordResult.getUserCheckTime()) ? oapiDingTalkRecordResult.getTimeResult() : checkResult(user.getSysRostering(), oapiDingTalkRecordResult.getUserCheckTime(), 2)); |
| | | } |
| | | attendance.setEndClockResults(ObjectUtil.isEmpty(oapiDingTalkRecordResult.getUserCheckTime()) ? Constant.ATTENDANCE_STATE_NOTSIGNED : checkResult(user.getSysRostering(), oapiDingTalkRecordResult.getUserCheckTime(), 2)); |
| | | attendance.setEndLocationResults(setLocationResults(oapiDingTalkRecordResult.getLocationResult())); |
| | | attendance.setActualWorkEndTime(oapiDingTalkRecordResult.getUserCheckTime()); |
| | | } |
| | | } |
| | | // 如果是周六或者周日或节假日,打卡状态为等待的话,就改状态为休息(oapiDingTalkRecordResultList为空的情况下) |
| | | if(calDay.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY || calDay.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY || attendance.getDateType().equals(Constant.DATE_TYPE_LEGAL_HOLIDAYS)){ |
| | | if((ObjectUtils.isNotEmpty(attendance)) && (calDay.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY || calDay.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY || attendance.getDateType().equals(Constant.DATE_TYPE_LEGAL_HOLIDAYS))){ |
| | | // 上午 |
| | | if(day && attendance.getStartClockResults().equals(Constant.ATTENDANCE_STATE_WAITFOR)){ |
| | | attendance.setStartClockResults(Constant.ATTENDANCE_STATE_REST); |
| | |
| | | } |
| | | |
| | | // 修改考勤打卡状态 |
| | | attendance = updateRecord(user, attendance, timeResult, day, attendDate); |
| | | if(ObjectUtils.isNotEmpty(attendance)){ |
| | | attendance = updateRecord(user, attendance, day, attendDate); |
| | | attendanceRepository.save(attendance); |
| | | } |
| | | } |
| | | } |
| | | }else{ |
| | |
| | | * 查询其他状态表并调用方法修改 |
| | | * @param user |
| | | */ |
| | | public Attendance updateRecord(User user, Attendance attendance, String timeResult, Boolean day, String attendDate){ |
| | | public Attendance updateRecord(User user, Attendance attendance, Boolean day, String attendDate){ |
| | | // 查询考勤请假表 |
| | | List<AttendanceLeave> attendanceLeaveList = attendanceLeaveRepository.findByUserIdAndDate(user.getId(),attendance.getRosteringWorkStartTime().toLocalDateTime(),attendance.getRosteringWorkEndTime().toLocalDateTime()); |
| | | List<AttendanceLeave> attendanceLeaveLists = attendanceLeaveRepository.findByUserIdAndDate(user.getId(),attendance.getRosteringWorkStartTime().toLocalDateTime(),attendance.getRosteringWorkEndTime().toLocalDateTime()); |
| | | for(AttendanceLeave attendanceLeave : attendanceLeaveLists){ |
| | | // 上午/下午/全天 |
| | | if(attendanceLeave.getLeaveStartTime().toLocalDateTime().isBefore(attendance.getRosteringLunchStartTime().toLocalDateTime()) && attendanceLeave.getLeaveEndTime().toLocalDateTime().compareTo(attendance.getRosteringLunchStartTime().toLocalDateTime()) <= 0){ |
| | | getMornOrNoon(user,attendance,attendDate,attendance.getRosteringWorkStartTime(), attendance.getRosteringLunchEndTime(),day); |
| | | }else if(attendanceLeave.getLeaveStartTime().toLocalDateTime().compareTo(attendance.getRosteringLunchEndTime().toLocalDateTime()) >= 0 && attendanceLeave.getLeaveEndTime().toLocalDateTime().compareTo(attendance.getRosteringWorkEndTime().toLocalDateTime()) <= 0){ |
| | | getMornOrNoon(user,attendance,attendDate,attendance.getRosteringLunchStartTime(),attendance.getRosteringWorkEndTime(),day); |
| | | }else{ |
| | | getMornOrNoon(user,attendance,attendDate,attendanceLeave.getLeaveStartTime(),attendanceLeave.getLeaveEndTime(),day); |
| | | } |
| | | } |
| | | //查询出差表 |
| | | AttendanceBusinessTravel attendanceBusinessTravel = attendanceBusinessTravelRepository.findByUserAndDate(user.getId(),attendance.getAttendanceDate().toLocalDateTime(),attendance.getAttendanceDate().toLocalDateTime()); |
| | | if(ObjectUtils.isNotEmpty(attendanceBusinessTravel)){ |
| | | getMornOrNoon(user,attendance,attendDate,attendanceBusinessTravel.getTravelStartTime(),attendance.getRosteringWorkEndTime(),day); |
| | | }// 查询外出表o |
| | | List<AttendanceGoOut> attendanceGoOutList = attendanceGoOutRepository.findByUserAndDate(user.getId(),attendance.getRosteringWorkStartTime().toLocalDateTime(),attendance.getRosteringWorkEndTime().toLocalDateTime()); |
| | | for(AttendanceGoOut attendanceGoOut : attendanceGoOutList) { |
| | | // 上午/下午 |
| | | if (attendanceGoOut.getOutStartTime().toLocalDateTime().isBefore(attendance.getRosteringLunchStartTime().toLocalDateTime()) && attendanceGoOut.getOutEndTime().toLocalDateTime().compareTo(attendance.getRosteringLunchStartTime().toLocalDateTime()) <= 0) { |
| | | getMornOrNoon(user, attendance, attendDate, attendance.getRosteringWorkStartTime(), attendance.getRosteringLunchEndTime(), day); |
| | | } else if (attendanceGoOut.getOutStartTime().toLocalDateTime().compareTo(attendance.getRosteringLunchEndTime().toLocalDateTime()) >= 0 && attendanceGoOut.getOutEndTime().toLocalDateTime().compareTo(attendance.getRosteringWorkEndTime().toLocalDateTime()) <= 0) { |
| | | getMornOrNoon(user, attendance, attendDate, attendance.getRosteringLunchStartTime(),attendance.getRosteringWorkEndTime() ,day); |
| | | } else { |
| | | getMornOrNoon(user, attendance, attendDate, attendanceGoOut.getOutStartTime(), attendanceGoOut.getOutEndTime(), day); |
| | | } |
| | | } |
| | | return attendance; |
| | | } |
| | | |
| | | /** |
| | | * 请假优先于出差优先于外出 |
| | | * @param user |
| | | * @param attendance |
| | | * @param attendDate |
| | | * @param startDate |
| | | * @param endDate |
| | | */ |
| | | public void getMornOrNoon(User user,Attendance attendance,String attendDate,Timestamp startDate,Timestamp endDate,Boolean day){ |
| | | // 查询考勤请假表 |
| | | List<AttendanceLeave> attendanceLeaveList = attendanceLeaveRepository.findByUserIdAndDate(user.getId(),startDate.toLocalDateTime(),endDate.toLocalDateTime()); |
| | | Double leaveDuration = new Double(0.00);//钉钉方法的时长 |
| | | Double leaveStartDuration = new Double(0.00);//考勤按钮的时长 |
| | | Double leaveEndDuration = new Double(0.00);//考勤按钮的时长 |
| | | //请假优先于出差优先于外出 |
| | | if(attendanceLeaveList.size() < 1){ |
| | | // 查询考勤出差表 |
| | | AttendanceBusinessTravel attendanceBusinessTravel = attendanceBusinessTravelRepository.findByUserAndDate(user.getId(),attendance.getAttendanceDate().toString().substring(0,10),attendance.getAttendanceDate().toString().substring(0,10)); |
| | | AttendanceBusinessTravel attendanceBusinessTravel = attendanceBusinessTravelRepository.findByUserAndDate(user.getId(),attendance.getAttendanceDate().toLocalDateTime(),attendance.getAttendanceDate().toLocalDateTime()); |
| | | Double bussDuration = new Double(0.00); |
| | | Double bussStartDuration = new Double(0.00);//考勤按钮的时长 |
| | | Double bussEndDuration = new Double(0.00);//考勤按钮的时长 |
| | |
| | | outStartDuration += getStartDuration(attendanceGoOut.getOutStartTime(),attendanceGoOut.getOutEndTime(),attendance); |
| | | outEndDuration += getEndDuration(attendanceGoOut.getOutStartTime(),attendanceGoOut.getOutEndTime(),attendance); |
| | | //调用方法修改考勤打卡状态 |
| | | updateAttendanceRecord(null,attendance,timeResult,Constant.ATTENDANCE_STATE_GOOUT,day,outStartDuration,outEndDuration); |
| | | updateAttendanceRecord(null,attendance,Constant.ATTENDANCE_STATE_GOOUT,day,outStartDuration,outEndDuration); |
| | | }else{ |
| | | // 上午or下午总时长 |
| | | outDuration += getDuration(attendanceGoOut.getOutStartTime(),attendanceGoOut.getOutEndTime(),attendance,day); |
| | | updateAttendanceRecord(outDuration,attendance,timeResult,Constant.ATTENDANCE_STATE_GOOUT, day,null,null); |
| | | updateAttendanceRecord(outDuration,attendance,Constant.ATTENDANCE_STATE_GOOUT, day,null,null); |
| | | } |
| | | } |
| | | }else{ |
| | |
| | | bussStartDuration += getStartDuration(attendanceBusinessTravel.getTravelStartTime(),attendance.getRosteringWorkEndTime(),attendance); |
| | | bussEndDuration += getEndDuration(attendanceBusinessTravel.getTravelStartTime(),attendance.getRosteringWorkEndTime(),attendance); |
| | | //调用方法修改考勤打卡状态 |
| | | updateAttendanceRecord(null,attendance,timeResult,Constant.ATTENDANCE_STATE_BUSINESS,day,bussStartDuration,bussEndDuration); |
| | | updateAttendanceRecord(null,attendance,Constant.ATTENDANCE_STATE_BUSINESS,day,bussStartDuration,bussEndDuration); |
| | | }else{ |
| | | // 上午or下午总时长 |
| | | bussDuration += getDuration(attendanceBusinessTravel.getTravelStartTime(),attendance.getRosteringWorkEndTime(),attendance,day); |
| | | updateAttendanceRecord(bussDuration,attendance,timeResult,Constant.ATTENDANCE_STATE_BUSINESS,day,null,null); |
| | | updateAttendanceRecord(bussDuration,attendance,Constant.ATTENDANCE_STATE_BUSINESS,day,null,null); |
| | | } |
| | | } |
| | | } |
| | |
| | | for(AttendanceLeave attendanceLeave : attendanceLeaveList){ |
| | | // attendDate不等于null 说明是考勤信息按钮 |
| | | if(ObjectUtils.isNotEmpty(attendDate)){ |
| | | // 上午时长、下午时长 |
| | | // 上午总时长、下午总时长 |
| | | leaveStartDuration += getStartDuration(attendanceLeave.getLeaveStartTime(),attendanceLeave.getLeaveEndTime(),attendance); |
| | | leaveEndDuration += getEndDuration(attendanceLeave.getLeaveStartTime(),attendanceLeave.getLeaveEndTime(),attendance); |
| | | //调用方法修改考勤打卡状态 |
| | | updateAttendanceRecord(null,attendance,timeResult,Constant.ATTENDANCE_STATE_LEAVE,day,leaveStartDuration,leaveEndDuration); |
| | | updateAttendanceRecord(null,attendance,Constant.ATTENDANCE_STATE_LEAVE,day,leaveStartDuration,leaveEndDuration); |
| | | }else{ |
| | | // 上午or下午总时长 |
| | | leaveDuration += getDuration(attendanceLeave.getLeaveStartTime(),attendanceLeave.getLeaveEndTime(),attendance,day); |
| | | //调用方法修改考勤打卡状态 |
| | | updateAttendanceRecord(leaveDuration,attendance,timeResult,Constant.ATTENDANCE_STATE_LEAVE,day,null,null); |
| | | updateAttendanceRecord(leaveDuration,attendance,Constant.ATTENDANCE_STATE_LEAVE,day,null,null); |
| | | } |
| | | } |
| | | } |
| | | return attendance; |
| | | } |
| | | |
| | | /** |
| | |
| | | /** |
| | | * 修改考勤记录打卡状态 |
| | | * @param attendance |
| | | * @param timeResult |
| | | * @param type |
| | | */ |
| | | public void updateAttendanceRecord(Double duration, Attendance attendance, String timeResult, String type, Boolean day,Double stDuration,Double enDuration){ |
| | | public void updateAttendanceRecord(Double duration, Attendance attendance, String type, Boolean day,Double stDuration,Double enDuration){ |
| | | // 上午排班开始时间到排班午休开始时间的时长 |
| | | Integer workMorningTime = calculateTimes(attendance.getRosteringWorkStartTime().toLocalDateTime(), attendance.getRosteringLunchStartTime().toLocalDateTime()); |
| | | Double result = Double.valueOf(new BigDecimal((float) workMorningTime / 3600).setScale(2, BigDecimal.ROUND_HALF_UP).toString()); |
| | |
| | | noonResult1 = Double.valueOf(new BigDecimal((float) actualTime / 3600).setScale(2, BigDecimal.ROUND_HALF_UP).toString()); |
| | | } |
| | | // 没打卡的情况下,修改考勤打卡状态 |
| | | if(timeResult.equals("NotSigned")){ |
| | | if(attendance.getStartClockResults().equals(Constant.ATTENDANCE_STATE_NOTSIGNED) && attendance.getEndClockResults().equals(Constant.ATTENDANCE_STATE_NOTSIGNED)){ |
| | | // duration为null说明是考勤信息按钮 |
| | | if(ObjectUtils.isEmpty(duration)){ |
| | | if(stDuration > 0 && enDuration == 0){ |
| | | setAttendance(stDuration,null,result,null,attendance,type); |
| | | }else if(enDuration > 0 && stDuration == 0){ |
| | | setAttendance(null,enDuration,null,noonResult,attendance,type); |
| | | }else{ |
| | | setAttendance(stDuration,null,result,null,attendance,type); |
| | | setAttendance(null,enDuration,null,noonResult,attendance,type); |
| | | } |
| | | }else{ |
| | | // 上午 |
| | | if(day){ |
| | |
| | | }else{ |
| | | // duration为null说明是考勤信息按钮 |
| | | if(ObjectUtils.isEmpty(duration)){ |
| | | if(stDuration > 0 && enDuration == 0){ |
| | | setAttendanceStart(stDuration,null,result1,result,null,attendance,type); |
| | | }else if(enDuration > 0 && stDuration == 0){ |
| | | setAttendanceStart(null,enDuration,noonResult1,null,noonResult,attendance,type); |
| | | }else{ |
| | | setAttendanceStart(stDuration,null,result1,result,null,attendance,type); |
| | | setAttendanceStart(null,enDuration,noonResult1,null,noonResult,attendance,type); |
| | | } |
| | | }else{ |
| | | //打卡的情况,修改考勤状态 |
| | | if(day){ |
| | |
| | | package me.zhengjie.modules.quartz.task; |
| | | |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import me.zhengjie.exception.BadRequestException; |
| | | import me.zhengjie.modules.attendance.domain.*; |
| | | import me.zhengjie.modules.attendance.repository.AttendanceBusinessTravelRepository; |
| | | import me.zhengjie.modules.attendance.repository.AttendanceGoOutRepository; |
| | | import me.zhengjie.modules.attendance.repository.AttendanceLeaveRepository; |
| | | import me.zhengjie.modules.attendance.repository.AttendanceRepository; |
| | | import me.zhengjie.modules.constant.Constant; |
| | | import me.zhengjie.modules.quartz.service.dto.OapiDingTalkAccessToken; |
| | | import me.zhengjie.modules.quartz.service.OpaiDingTalkService; |
| | | import me.zhengjie.modules.quartz.service.dto.OapiDingTalkRecordResult; |
| | | import me.zhengjie.modules.quartz.service.impl.DingTalkServiceImpl; |
| | | 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.SysConfigHolidayRepository; |
| | | import me.zhengjie.modules.system.repository.SysRosteringRepository; |
| | | import me.zhengjie.modules.system.repository.UserRepository; |
| | | import org.apache.commons.lang3.ObjectUtils; |
| | | import org.springframework.scheduling.annotation.Async; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.sql.Timestamp; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.Duration; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.time.LocalTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * 钉钉定时任务(取考勤记录) |
| | | */ |
| | |
| | | @Async |
| | | public class OapiDingTalkMethod { |
| | | |
| | | private final AttendanceRepository attendanceRepository; |
| | | |
| | | private final UserRepository userRepository; |
| | | |
| | | private final SysConfigHolidayRepository sysConfigHolidayRepository; |
| | | |
| | | private final SysRosteringRepository sysRosteringRepository; |
| | | |
| | | private final DingTalkServiceImpl dingTalkService; |
| | | |
| | | |
| | | /** |
| | | * 每天0点执行,新增用户考勤信息 |
| | | * |
| | | * @throws Exception |
| | | */ |
| | | public void getDingTalkAttendanceList() throws Exception { |
| | | //查询状态正常的员工 |
| | | List<User> userList = getUserList(); |
| | | //获取今天时间 |
| | | SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd"); |
| | | String todayDate = df.format(new Date()); |
| | | //获取当前时间 |
| | | Calendar calTodayDay = Calendar.getInstance(); |
| | | calTodayDay.setTime(Timestamp.valueOf(todayDate + " 00:00:00")); |
| | | //查询节假日表是否有记录 |
| | | SysConfigHoliday sysConfigHoliday = sysConfigHolidayRepository.findByHolidayDate(todayDate); |
| | | //遍历在职员工向考勤记录添加数据 |
| | | for (User user : userList){ |
| | | if(ObjectUtils.isNotEmpty(user.getDingding())){ |
| | | //查询当前用户的排班 |
| | | SysRostering sysRostering = sysRosteringRepository.findByRosId(user.getSysRostering().getId()); |
| | | //查询考勤记录是否存在 |
| | | Attendance attendance = attendanceRepository.findAllByUserIdAndAttendanceDate(user.getId(), todayDate); |
| | | DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("HH:mm:ss"); |
| | | if (ObjectUtil.isEmpty(attendance)) { |
| | | attendance = new Attendance(); |
| | | } |
| | | //添加记录 |
| | | attendance.setUserId(user.getId()); |
| | | Date date = df.parse(todayDate); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | String today=sdf.format(date); |
| | | attendance.setAttendanceDate(Timestamp.valueOf(today)); |
| | | //状态为等待 |
| | | attendance.setStartClockResults(Constant.ATTENDANCE_STATE_WAITFOR); |
| | | attendance.setEndClockResults(Constant.ATTENDANCE_STATE_WAITFOR); |
| | | if(calTodayDay.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY && sysConfigHoliday == null || calTodayDay.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY && sysConfigHoliday == null){ |
| | | //双休 |
| | | attendance.setDateType(Constant.DATE_TYPE_WEEKEND); |
| | | }else if(sysConfigHoliday != null && sysConfigHoliday.getDateType().equals(Constant.DATE_TYPE_LEGAL_HOLIDAYS)){ |
| | | //法定 |
| | | attendance.setDateType(Constant.DATE_TYPE_LEGAL_HOLIDAYS); |
| | | }else{ |
| | | //除了法定节假日和双休都属于工作日 |
| | | attendance.setDateType(Constant.DATE_TYPE_WEEKDAY); |
| | | } |
| | | |
| | | attendance.setRosteringWorkStartTime(Timestamp.valueOf(todayDate + " " + dateTimeFormatter.format(sysRostering.getWorkStartTime()))); |
| | | attendance.setRosteringWorkEndTime(Timestamp.valueOf(todayDate + " " + dateTimeFormatter.format(sysRostering.getWorkEndTime()))); |
| | | attendance.setRosteringLunchStartTime(Timestamp.valueOf(todayDate + " " + dateTimeFormatter.format(sysRostering.getLunchStartTime()))); |
| | | attendance.setRosteringLunchEndTime(Timestamp.valueOf(todayDate + " " + dateTimeFormatter.format(sysRostering.getLunchEndTime()))); |
| | | attendanceRepository.save(attendance); |
| | | } |
| | | } |
| | | dingTalkService.getDingTalkAttendanceList(null); |
| | | } |
| | | |
| | | /** |
| | | * 定时任务调用 |
| | | *中午晚上定时任务调用 |
| | | */ |
| | | public void getDingTalkAttendance() throws Exception { |
| | | dingTalkService.getDingTalkAttendanceListOfNoonOrNight(null,null); |
| | | } |
| | | |
| | | /** |
| | | * 查询用户 |
| | | */ |
| | | public List<User> getUserList(){ |
| | | List<User> userList = userRepository.findAllByEnabled(true); |
| | | return userList; |
| | | } |
| | | } |
| | |
| | | }) |
| | | } |
| | | |
| | | export function revoke(data) { |
| | | return request({ |
| | | url: 'api/attendanceBusinessTravel/revoke', |
| | | method: 'put', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export default { add, edit, del, getAll, getRemainingTime, approve, revoke } |
| | | export default { add, edit, del, getAll, getRemainingTime, approve } |
| | |
| | | }) |
| | | } |
| | | |
| | | export function revoke(data) { |
| | | return request({ |
| | | url: 'api/attendanceGoOut/revoke', |
| | | method: 'put', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export default { add, edit, del, getAll, getRemainingTime, approve, revoke } |
| | | export default { add, edit, del, getAll, getRemainingTime, approve } |
| File was renamed from eladmin-web-master/src/api/projectPerformance.js |
| | |
| | | import request from '@/utils/request' |
| | | |
| | | export function getAll(params) { |
| | | return request({ |
| | | url: 'api/projectPerformance/all', |
| | | method: 'get', |
| | | params |
| | | }) |
| | | } |
| | | |
| | | export function add(data) { |
| | | return request({ |
| | | url: 'api/projectPerformance', |
| | |
| | | }) |
| | | } |
| | | |
| | | export default { add, edit, del } |
| | | export default { add, edit, del, getAll } |
| File was renamed from eladmin-web-master/src/api/projectPerformanceDetail.js |
| | |
| | | import request from '@/utils/request' |
| | | |
| | | export function getAll(params) { |
| | | return request({ |
| | | url: 'api/projectPerformanceDetail/all', |
| | | method: 'get', |
| | | params |
| | | }) |
| | | } |
| | | |
| | | export function add(data) { |
| | | return request({ |
| | | url: 'api/projectPerformanceDetail', |
| | |
| | | }) |
| | | } |
| | | |
| | | export default { add, edit, del } |
| | | export default { add, edit, del, getAll } |
| | |
| | | <!--工具栏--> |
| | | <div class="head-container"> |
| | | <div> |
| | | <el-select v-model="query.userId" filterable clearable placeholder="请选择员工" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-select v-model="query.userId" filterable clearable placeholder="所属员工" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in users" |
| | | :key="item.id" |
| | |
| | | clearable |
| | | class="filter-item" |
| | | value-format="yyyy-MM-dd" |
| | | placeholder="请选择日期" |
| | | placeholder="考勤日期" |
| | | style="width: 185px;" |
| | | /> |
| | | <el-select v-model="query.startLocationResults" filterable clearable placeholder="请选择开始位置结果" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-select v-model="query.startLocationResults" filterable clearable placeholder="开始位置结果" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in dict[lacationResules]" |
| | | :key="item.value" |
| | |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | <el-select v-model="query.startClockResults" filterable clearable placeholder="请选择开始打卡结果" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-select v-model="query.startClockResults" filterable clearable placeholder="开始打卡结果" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in dict[attendanceState]" |
| | | :key="item.value" |
| | |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | <el-select v-model="query.endLocationResults" filterable clearable placeholder="请选择结束位置结果" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-select v-model="query.endLocationResults" filterable clearable placeholder="结束位置结果" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in dict[lacationResules]" |
| | | :key="item.value" |
| | |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | <el-select v-model="query.endClockResults" filterable clearable placeholder="请选择结束打卡结果" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-select v-model="query.endClockResults" filterable clearable placeholder="结束打卡结果" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in dict[attendanceState]" |
| | | :key="item.value" |
| | |
| | | </div> |
| | | <!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'--> |
| | | <crudOperation :permission="permission"> |
| | | <template slot="left"> |
| | | <el-button |
| | | slot="right" |
| | | size="mini" |
| | | type="info" |
| | | type="primary" |
| | | icon="el-icon-timer" |
| | | class="filter-item" |
| | | style="margin-right: 7.5px" |
| | | :disabled="crud.selections.length !== 1" |
| | | @click="makeUpCardOnDuty(crud.selections[0],1)" |
| | | >上班补卡 |
| | | </el-button> |
| | | </template> |
| | | <template slot="left"> |
| | | <el-button |
| | | slot="right" |
| | | size="mini" |
| | | type="info" |
| | | type="primary" |
| | | icon="el-icon-timer" |
| | | class="filter-item" |
| | | style="margin-right: 7.5px" |
| | | :disabled="crud.selections.length !== 1" |
| | | style="margin-left: 4px !important;" |
| | | @click="makeUpCardOnDuty(crud.selections[0],2)" |
| | | >下班补卡 |
| | | </el-button> |
| | | </template> |
| | | <template slot="left"> |
| | | <el-button |
| | | slot="right" |
| | | size="mini" |
| | | type="info" |
| | | type="primary" |
| | | icon="el-icon-suitcase-1" |
| | | class="filter-item" |
| | | style="margin-right: 7.5px" |
| | | :disabled="crud.selections.length == null" |
| | | style="margin-left: 4px !important;" |
| | | @click="toGoOutRequest('goOut')" |
| | | >外出 |
| | | >外出申请 |
| | | </el-button> |
| | | </template> |
| | | <template slot="left"> |
| | | <el-button |
| | | slot="right" |
| | | size="mini" |
| | | type="info" |
| | | type="primary" |
| | | icon="el-icon-timer" |
| | | class="filter-item" |
| | | style="margin-right: 7.5px" |
| | | :disabled="crud.selections.length == null" |
| | | style="margin-left: 4px !important;" |
| | | @click="toGoOutRequest()" |
| | | >出差 |
| | | >出差申请 |
| | | </el-button> |
| | | </template> |
| | | <template slot="left"> |
| | | <el-button |
| | | slot="right" |
| | | v-permission="permission.addAttendanceInfo" |
| | | size="mini" |
| | | type="info" |
| | | icon="el-icon-document" |
| | | type="primary" |
| | | icon="el-icon-plus" |
| | | class="filter-item" |
| | | style="margin-right: 7.5px" |
| | | :disabled="crud.selections.length == null" |
| | | style="margin-left: 4px !important;" |
| | | @click="toSupplementInfo()" |
| | | >考勤信息补充 |
| | | >考勤生成 |
| | | </el-button> |
| | | </template> |
| | | </crudOperation> |
| | | <!--表单组件--> |
| | | <el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="500px"> |
| | | <el-form ref="form" :model="form" :rules="rules" size="small" label-width="140px"> |
| | | <el-form-item label="员工" prop="userId"> |
| | | <el-form-item label="所属员工" prop="userId"> |
| | | <el-select v-model="form.userId" clearable filterable placeholder="请选择" style="width: 310px;" @change="getRosteTime(form)"> |
| | | <el-option |
| | | v-for="item in users" |
| | |
| | | style="width: 310px;" |
| | | value-format="yyyy-MM-dd HH:mm:ss" |
| | | align="right" |
| | | :picker-options="{ disabledDate(time) { |
| | | :picker-options="{ |
| | | disabledDate(time) { |
| | | return form.rosteringWorkEndTime ? time.getTime() > new Date(form.rosteringWorkEndTime).getTime() - 8.64e7 : false; |
| | | } |
| | | }" |
| | |
| | | style="width: 310px;" |
| | | value-format="yyyy-MM-dd HH:mm:ss" |
| | | align="right" |
| | | :picker-options="{ disabledDate(time) { |
| | | :picker-options="{ |
| | | disabledDate(time) { |
| | | return form.actualWorkEndTime ? time.getTime() > new Date(form.actualWorkEndTime).getTime() - 8.64e7 : false; |
| | | } |
| | | }" |
| | |
| | | style="width: 310px;" |
| | | value-format="yyyy-MM-dd HH:mm:ss" |
| | | align="right" |
| | | :picker-options="{ disabledDate(time) { |
| | | :picker-options="{ |
| | | disabledDate(time) { |
| | | return form.rosteringWorkStartTime ? time.getTime() < new Date(form.rosteringWorkStartTime).getTime() - 8.64e7 : false; |
| | | } |
| | | }" |
| | |
| | | style="width: 310px;" |
| | | value-format="yyyy-MM-dd HH:mm:ss" |
| | | align="right" |
| | | :picker-options="{ disabledDate(time) { |
| | | :picker-options="{ |
| | | disabledDate(time) { |
| | | return form.actualWorkStartTime ? time.getTime() < new Date(form.actualWorkStartTime).getTime() - 8.64e7 : false; |
| | | } |
| | | }" |
| | |
| | | <el-button :loading="crud.status.cu === 2" type="primary" @click="crud.submitCU">确认</el-button> |
| | | </div> |
| | | </el-dialog> |
| | | <!--补卡--> |
| | | <!--补卡表单--> |
| | | <el-dialog :close-on-click-modal="false" :before-close="closeCard" :visible.sync="makeUpCardVisible" :title="makeUpCardTitle" width="500px"> |
| | | <el-form ref="makeUpCardForm" :model="makeUpCardForm" :rules="makeRules" size="small" label-width="140px" style="height: 400px"> |
| | | <el-form ref="makeUpCardForm" :model="makeUpCardForm" :rules="makeRules" size="small" label-width="80px"> |
| | | <el-form-item label="基准时间"> |
| | | <span>{{ makeUpCardForm.rosterTime }}</span> |
| | | </el-form-item> |
| | |
| | | <label style="margin-right: 5px">时间:</label> |
| | | <el-time-picker |
| | | v-model="makeUpCardForm.cardReplacementTime" |
| | | placeholder="选择时间" |
| | | format="HH:mm:ss" |
| | | value-format="HH:mm:ss" |
| | | style="width: 195px;" |
| | | style="width: 330px;" |
| | | /> |
| | | </div> |
| | | </el-form-item> |
| | | <el-form-item label="审批人" prop="approvalUserId"> |
| | | <el-select v-model="makeUpCardForm.approvalUserId" clearable filterable placeholder="请选择" style="width: 240px;"> |
| | | <el-select v-model="makeUpCardForm.approvalUserId" clearable filterable placeholder="请选择" style="width: 370px;"> |
| | | <el-option |
| | | v-for="item in users" |
| | | :key="item.id" |
| | |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="补卡原因"> |
| | | <el-input v-model="makeUpCardForm.cardReplacementReason" type="textarea" :rows="6" resize="none" style="width: 325px;" /> |
| | | <el-input v-model="makeUpCardForm.cardReplacementReason" type="textarea" rows="3" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="备注"> |
| | | <el-input v-model="makeUpCardForm.remarks" type="textarea" rows="3" style="width: 370px;" /> |
| | | </el-form-item> |
| | | </el-form> |
| | | <div slot="footer" class="dialog-footer"> |
| | |
| | | </el-dialog> |
| | | <!--外出表单--> |
| | | <el-dialog :close-on-click-modal="false" :before-close="closeCard" :visible.sync="goOutVisible" :title="goOutTitle" width="500px"> |
| | | <el-form ref="goOutForm" :model="goOutForm" :rules="goOutRules" size="small" label-width="100px"> |
| | | <el-form ref="goOutForm" :model="goOutForm" :rules="goOutRules" size="small" label-width="80px"> |
| | | <el-form-item label="开始时间" prop="outStartTime"> |
| | | <el-date-picker |
| | | v-model="goOutForm.outStartTime" |
| | | type="datetime" |
| | | placeholder="选择日期时间" |
| | | style="width: 310px;" |
| | | style="width: 370px;" |
| | | value-format="yyyy-MM-dd HH:mm:ss" |
| | | align="right" |
| | | :picker-options="{ disabledDate(time) { |
| | | :picker-options="{ |
| | | disabledDate(time) { |
| | | return goOutForm.outEndTime ? time.getTime() > new Date(goOutForm.outEndTime).getTime() - 8.64e7 : false; |
| | | } |
| | | }" |
| | |
| | | v-model="goOutForm.outEndTime" |
| | | type="datetime" |
| | | placeholder="选择日期时间" |
| | | style="width: 310px;" |
| | | style="width: 370px;" |
| | | value-format="yyyy-MM-dd HH:mm:ss" |
| | | align="right" |
| | | :picker-options="{ disabledDate(time) { |
| | | :picker-options="{ |
| | | disabledDate(time) { |
| | | return goOutForm.outStartTime ? time.getTime() < new Date(goOutForm.outStartTime).getTime() - 8.64e7 : false; |
| | | } |
| | | }" |
| | |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="外出时长" prop="outDuration"> |
| | | <el-input v-model="goOutForm.outDuration" disabled style="width: 310px;"> |
| | | <el-input v-model="goOutForm.outDuration" disabled style="width: 370px;"> |
| | | <template slot="append">{{ dict.label[dictLeaveTimeType][goOutForm.durationUnit] }}</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="外出类型" prop="outOfOfficeType"> |
| | | <el-select v-model="goOutForm.outOfOfficeType" filterable clearable placeholder="请选择外出类型" style="width: 310px;"> |
| | | <el-select v-model="goOutForm.outOfOfficeType" filterable clearable placeholder="请选择" style="width: 370px;"> |
| | | <el-option |
| | | v-for="item in dict[dictGoOutTypr]" |
| | | :key="item.value" |
| | |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="审批员工" prop="approvalUserId"> |
| | | <el-select v-model="goOutForm.approvalUserId" filterable clearable placeholder="请选择审批员工" style="width: 310px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-select v-model="goOutForm.approvalUserId" filterable clearable placeholder="请选择" style="width: 370px;" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in users" |
| | | :key="item.id" |
| | |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="外出原因"> |
| | | <el-input v-model="goOutForm.outReason" type="textarea" rows="3" style="width: 310px;" /> |
| | | <el-input v-model="goOutForm.outReason" type="textarea" rows="3" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="备注"> |
| | | <el-input v-model="goOutForm.remarks" type="textarea" rows="3" style="width: 310px;" /> |
| | | <el-input v-model="goOutForm.remarks" type="textarea" rows="3" style="width: 370px;" /> |
| | | </el-form-item> |
| | | </el-form> |
| | | <div slot="footer" class="dialog-footer"> |
| | |
| | | </el-dialog> |
| | | <!--出差表单--> |
| | | <el-dialog :close-on-click-modal="false" :before-close="closeCard" :visible.sync="bussVisible" :title="bussTitle" width="500px"> |
| | | <el-form ref="bussForm" :model="bussForm" :rules="bussRules" size="small" label-width="100px"> |
| | | <el-form-item label="开始时间" prop="travelStartTime"> |
| | | <el-form ref="bussForm" :model="bussForm" :rules="bussRules" size="small" label-width="80px"> |
| | | <el-form-item label="开始日期" prop="travelStartTime"> |
| | | <el-date-picker |
| | | v-model="bussForm.travelStartTime" |
| | | type="date" |
| | | placeholder="选择日期时间" |
| | | style="width: 310px;" |
| | | placeholder="选择日期" |
| | | style="width: 370px;" |
| | | value-format="yyyy-MM-dd" |
| | | align="right" |
| | | :picker-options="{ disabledDate(time) { |
| | | :picker-options="{ |
| | | disabledDate(time) { |
| | | return bussForm.travelEndTime ? time.getTime() > new Date(bussForm.travelEndTime).getTime() - 8.64e7 : false; |
| | | } |
| | | }" |
| | | @change="checkTime()" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="结束时间" prop="travelEndTime"> |
| | | <el-form-item label="结束日期" prop="travelEndTime"> |
| | | <el-date-picker |
| | | v-model="bussForm.travelEndTime" |
| | | type="date" |
| | | placeholder="选择日期时间" |
| | | style="width: 310px;" |
| | | placeholder="选择日期" |
| | | style="width: 370px;" |
| | | value-format="yyyy-MM-dd" |
| | | align="right" |
| | | :picker-options="{ disabledDate(time) { |
| | | :picker-options="{ |
| | | disabledDate(time) { |
| | | return bussForm.travelStartTime ? time.getTime() < new Date(bussForm.travelStartTime).getTime() - 8.64e7 : false; |
| | | } |
| | | }" |
| | |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="出差时长" prop="travelDuration"> |
| | | <el-input v-model="bussForm.travelDuration" disabled style="width: 310px;"> |
| | | <el-input v-model="bussForm.travelDuration" disabled style="width: 370px;"> |
| | | <template slot="append">{{ dict.label[dictLeaveTimeType][bussForm.durationUnit] }}</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="审批员工" prop="approvalUserId"> |
| | | <el-select v-model="bussForm.approvalUserId" filterable clearable placeholder="请选择审批员工" style="width: 310px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-select v-model="bussForm.approvalUserId" filterable clearable placeholder="请选择" style="width: 370px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in users" |
| | | :key="item.id" |
| | |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="出差原因"> |
| | | <el-input v-model="bussForm.travelReason" type="textarea" rows="3" style="width: 310px;" /> |
| | | <el-input v-model="bussForm.travelReason" type="textarea" rows="3" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="出发城市"> |
| | | <el-input v-model="bussForm.departureCity" style="width: 310px;" /> |
| | | <el-input v-model="bussForm.departureCity" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="到达城市"> |
| | | <el-input v-model="bussForm.arrivalCity" style="width: 310px;" /> |
| | | <el-input v-model="bussForm.arrivalCity" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="备注"> |
| | | <el-input v-model="bussForm.remarks" type="textarea" rows="3" style="width: 310px;" /> |
| | | <el-input v-model="bussForm.remarks" type="textarea" rows="3" style="width: 370px;" /> |
| | | </el-form-item> |
| | | </el-form> |
| | | <div slot="footer" class="dialog-footer"> |
| | |
| | | </el-dialog> |
| | | <!--考勤信息补充--> |
| | | <el-dialog :close-on-click-modal="false" :before-close="closeCard" :visible.sync="attendVisible" :title="attendTitle" width="500px"> |
| | | <el-form ref="attform" :model="attform" :rules="attRules" size="small" label-width="100px"> |
| | | <el-form-item label="考勤时间" prop="attendTime"> |
| | | <el-form ref="attform" :model="attform" :rules="attRules" size="small" label-width="80px"> |
| | | <el-form-item label="考勤日期" prop="attendTime"> |
| | | <el-date-picker |
| | | v-model="attform.attendTime" |
| | | type="date" |
| | | placeholder="选择日期时间" |
| | | style="width: 310px;" |
| | | placeholder="选择日期" |
| | | style="width: 370px;" |
| | | value-format="yyyy-MM-dd" |
| | | align="right" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="审批员工" prop="userId"> |
| | | <el-select v-model="attform.userId" filterable clearable placeholder="请选择员工" style="width: 310px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-form-item label="所属员工" prop="userId"> |
| | | <el-select v-model="attform.userId" filterable clearable placeholder="请选择" style="width: 370px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in users" |
| | | :key="item.id" |
| | |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <div class="attCss" style="color: red;">*选择日期和员工更新员工的考勤信息,未选择员工则更新所有人</div> |
| | | <div class="attCss" style="color: red;">*选择员工则更新选中员工的考勤信息,未选择员工则更新所有员工的考勤信息</div> |
| | | </el-form> |
| | | <div slot="footer" class="dialog-footer"> |
| | | <el-button type="text" @click="closeCard">取消</el-button> |
| | |
| | | <!--表格渲染--> |
| | | <el-table ref="table" v-loading="crud.loading" :data="crud.data" size="small" style="width: 100%;" @selection-change="crud.selectionChangeHandler"> |
| | | <el-table-column type="selection" width="55" /> |
| | | <el-table-column prop="userName" label="员工" fixed="left" width="100" show-overflow-tooltip> |
| | | <el-table-column prop="userName" label="所属员工" fixed="left" width="100" show-overflow-tooltip> |
| | | <template slot-scope="scope"> |
| | | <el-tag>{{ scope.row.userName }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="attendanceDate" label="考勤日期" fixed="left" width="100px" show-overflow-tooltip> |
| | | <el-table-column prop="attendanceDate" label="考勤日期" fixed="left" width="100" show-overflow-tooltip> |
| | | <template slot-scope="scope"> |
| | | {{ crud.toDate(scope.row.attendanceDate) }} |
| | | </template> |
| | |
| | | <el-tag v-if="scope.row.startLocationResults === dictlocationResultsRest" type="warning">{{ dict.label[lacationResules][scope.row.startLocationResults] }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="startClockResults" min-width="120" label="开始打卡结果" show-overflow-tooltip> |
| | | <el-table-column prop="startClockResults" min-width="100" label="开始打卡结果" show-overflow-tooltip> |
| | | <template slot-scope="scope"> |
| | | <el-tag v-if="scope.row.startClockResults === dictAttendanceStateWaitFor" type="warning">{{ dict.label[attendanceState][scope.row.startClockResults] }}</el-tag> |
| | | <el-tag v-if="scope.row.startClockResults === dictAttendanceStateNormal" type="success">{{ dict.label[attendanceState][scope.row.startClockResults] }}</el-tag> |
| | |
| | | <el-tag v-if="scope.row.endLocationResults === dictlocationResultsRest" type="warning">{{ dict.label[lacationResules][scope.row.endLocationResults] }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="endClockResults" min-width="120" label="结束打卡结果" show-overflow-tooltip> |
| | | <el-table-column prop="endClockResults" min-width="100" label="结束打卡结果" show-overflow-tooltip> |
| | | <template slot-scope="scope"> |
| | | <el-tag v-if="scope.row.endClockResults === dictAttendanceStateWaitFor" type="warning">{{ dict.label[attendanceState][scope.row.endClockResults] }}</el-tag> |
| | | <el-tag v-if="scope.row.endClockResults === dictAttendanceStateNormal" type="success">{{ dict.label[attendanceState][scope.row.endClockResults] }}</el-tag> |
| | |
| | | <el-tag v-if="scope.row.endClockResults === dictStartEarly" type="warning">{{ dict.label[attendanceState][scope.row.endClockResults] }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="dateType" min-width="100" label="日期类型" show-overflow-tooltip> |
| | | <el-table-column prop="dateType" min-width="80" label="日期类型" show-overflow-tooltip> |
| | | <template slot-scope="scope"> |
| | | <el-tag>{{ dict.label[dateType][scope.row.dateType] }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="createTime" label="创建时间" min-width="150" show-overflow-tooltip /> |
| | | <el-table-column v-if="checkPer(['admin','attendance:edit','attendance:del'])" label="操作" width="150px" align="center"> |
| | | <el-table-column prop="remarks" label="备注" min-width="140" show-overflow-tooltip /> |
| | | <el-table-column prop="createTime" label="创建时间" min-width="140" show-overflow-tooltip /> |
| | | <el-table-column v-if="checkPer(['admin','attendance:edit','attendance:del'])" label="操作" width="150px" align="center" fixed="right"> |
| | | <template slot-scope="scope"> |
| | | <udOperation |
| | | :data="scope.row" |
| | |
| | | add: ['admin', 'attendance:add'], |
| | | edit: ['admin', 'attendance:edit'], |
| | | del: ['admin', 'attendance:del'], |
| | | download: ['admin', 'attendance:download'] |
| | | download: ['admin', 'attendance:download'], |
| | | addAttendanceInfo: ['admin', 'attendance:addAttendanceInfo'] |
| | | }, |
| | | rules: { |
| | | userId: [ |
| | | { required: true, message: '员工不能为空', trigger: 'change' } |
| | | { required: true, message: '所属员工不能为空', trigger: 'change' } |
| | | ], |
| | | attendanceDate: [ |
| | | { required: true, message: '考勤日期不能为空', trigger: 'blur' } |
| | |
| | | ], |
| | | dateType: [ |
| | | { required: true, message: '日期类型不能为空', trigger: 'change' } |
| | | ], |
| | | attendTime: [ |
| | | { required: true, message: '考勤日期不能为空', trigger: 'change' } |
| | | ] |
| | | }, |
| | | makeRules: { |
| | |
| | | ] |
| | | }, |
| | | goOutRules: { |
| | | approvalUserId: [ |
| | | { required: true, message: '审批人不能为空', trigger: 'change' } |
| | | ], |
| | | outStartTime: [ |
| | | { required: true, message: '外出开始时间不能为空', trigger: 'blur' } |
| | | { required: true, message: '开始时间不能为空', trigger: 'blur' } |
| | | ], |
| | | outEndTime: [ |
| | | { required: true, message: '外出结束时间不能为空', trigger: 'blur' } |
| | | { required: true, message: '结束时间不能为空', trigger: 'blur' } |
| | | ], |
| | | outDuration: [ |
| | | { required: true, message: '外出时长不能为空', trigger: 'change' } |
| | | ], |
| | | outOfOfficeType: [ |
| | | { required: true, message: '外出类型不能为空', trigger: 'change' } |
| | | ], |
| | | outDuration: [ |
| | | { required: true, message: '外出时长不能为空', trigger: 'change' } |
| | | approvalUserId: [ |
| | | { required: true, message: '审批人不能为空', trigger: 'change' } |
| | | ] |
| | | }, |
| | | bussRules: { |
| | | approvalUserId: [ |
| | | { required: true, message: '审批人不能为空', trigger: 'change' } |
| | | ], |
| | | travelStartTime: [ |
| | | { required: true, message: '出差开始时间不能为空', trigger: 'blur' } |
| | | { required: true, message: '开始时间不能为空', trigger: 'blur' } |
| | | ], |
| | | travelEndTime: [ |
| | | { required: true, message: '出差结束时间不能为空', trigger: 'blur' } |
| | | { required: true, message: '结束时间不能为空', trigger: 'blur' } |
| | | ], |
| | | travelDuration: [ |
| | | { required: true, message: '出差时长不能为空', trigger: 'change' } |
| | | ], |
| | | approvalUserId: [ |
| | | { required: true, message: '审批人不能为空', trigger: 'change' } |
| | | ] |
| | | }, |
| | | attRules: { |
| | |
| | | toGoOutRequest(data) { |
| | | if (data === 'goOut') { |
| | | this.goOutVisible = true |
| | | this.goOutForm.durationUnit = this.dictLeaveTimeTypeHour |
| | | } else { |
| | | this.bussVisible = true |
| | | this.bussForm.durationUnit = this.dictLeaveTimeTypeDay |
| | | } |
| | | }, |
| | | // 计算时长 |
| | | checkTime(data) { |
| | | if (data === 'goOut') { |
| | | this.goOutForm.durationUnit = this.dictLeaveTimeTypeHour |
| | | const params = JSON.stringify({ |
| | | 'outStartTime': this.goOutForm.outStartTime, |
| | | 'outEndTime': this.goOutForm.outEndTime |
| | |
| | | this.goOutForm.outDuration = res |
| | | }) |
| | | } else { |
| | | this.bussForm.durationUnit = this.dictLeaveTimeTypeDay |
| | | const params = JSON.stringify({ |
| | | 'travelStartTime': this.bussForm.travelStartTime, |
| | | 'travelEndTime': this.bussForm.travelEndTime |
| | |
| | | |
| | | <style scoped> |
| | | .attCss { |
| | | margin-left:25px; |
| | | font-size: 12px; |
| | | text-align: center; |
| | | } |
| | | </style> |
| | |
| | | <p>确定撤销该记录?</p> |
| | | <div style="text-align: right; margin: 0"> |
| | | <el-button size="mini" type="primary" @click="canel(scope.row)">取消</el-button> |
| | | <el-button :loading="crud.status.cu === 2" type="primary" size="mini" @click="revoke(scope.row)">确定</el-button> |
| | | <el-button :loading="successLoading" type="primary" size="mini" @click="revoke(scope.row)">确定</el-button> |
| | | </div> |
| | | <el-button |
| | | v-if="scope.row.approvalUserId === $store.state.user.user.id" |
| | |
| | | }) |
| | | }, |
| | | // 审批页面赋值 |
| | | toApprove(data) { |
| | | toApprove(data, Number) { |
| | | if (Number !== '1') { |
| | | this.makeUpCardVisible = true |
| | | } |
| | | this.form.id = data.id |
| | | this.form.userId = data.userId |
| | | this.form.userName = data.userName |
| | |
| | | return |
| | | } |
| | | } |
| | | this.successLoading = true |
| | | crudAttendanceBusinessTravel.approve(this.form).then(res => { |
| | | this.crud.refresh() |
| | | this.makeUpCardVisible = false |
| | |
| | | }, |
| | | // 撤消功能 |
| | | revoke(data) { |
| | | crudAttendanceBusinessTravel.revoke(data).then(res => { |
| | | this.toApprove(data, '1') |
| | | this.form.approvalStatus = this.dictGoOutAppRev |
| | | this.successLoading = true |
| | | crudAttendanceBusinessTravel.approve(this.form).then(res => { |
| | | this.crud.refresh() |
| | | this.successLoading = false |
| | | this.$message({ type: 'success', message: '撤销成功' }) |
| | | this.$refs[`popover_${data.id}`].showPopper = false |
| | | }).catch((error) => { |
| | |
| | | <p>确定撤销该记录?</p> |
| | | <div style="text-align: right; margin: 0"> |
| | | <el-button size="mini" type="primary" @click="canel(scope.row)">取消</el-button> |
| | | <el-button :loading="crud.status.cu === 2" type="primary" size="mini" @click="revoke(scope.row)">确定</el-button> |
| | | <el-button :loading="successLoading" type="primary" size="mini" @click="revoke(scope.row)">确定</el-button> |
| | | </div> |
| | | <el-button |
| | | v-if="scope.row.approvalUserId === $store.state.user.user.id" |
| | |
| | | }) |
| | | }, |
| | | // 审批页面赋值 |
| | | toApprove(data) { |
| | | toApprove(data, Number) { |
| | | if (Number !== '1') { |
| | | this.makeUpCardVisible = true |
| | | } |
| | | this.form.id = data.id |
| | | this.form.userId = data.userId |
| | | this.form.userName = data.userName |
| | |
| | | return |
| | | } |
| | | } |
| | | this.successLoading = true |
| | | crudAttendanceGoOut.approve(this.form).then(res => { |
| | | this.crud.refresh() |
| | | this.makeUpCardVisible = false |
| | |
| | | }, |
| | | // 撤消功能 |
| | | revoke(data) { |
| | | crudAttendanceGoOut.revoke(data).then(res => { |
| | | this.toApprove(data, '1') |
| | | this.form.approvalStatus = this.dictGoOutAppRev |
| | | this.successLoading = true |
| | | crudAttendanceGoOut.approve(this.form).then(res => { |
| | | this.crud.refresh() |
| | | this.successLoading = false |
| | | this.$message({ type: 'success', message: '撤销成功' }) |
| | | this.$refs[`popover_${data.id}`].showPopper = false |
| | | }).catch((error) => { |
| | |
| | | return |
| | | } |
| | | } |
| | | this.successLoading = true |
| | | crudAttendanceLeave.approve(this.form).then(res => { |
| | | this.crud.refresh() |
| | | this.makeUpCardVisible = false |
| | |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | <el-date-picker v-model="query.yearMonth" type="month" clearable placeholder="绩效年月" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" /> |
| | | <el-date-picker v-model="query.startDate" type="date" value-format="yyyy-MM-dd HH:mm:ss" clearable placeholder="结算开始日" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" /> |
| | | <el-date-picker v-model="query.endDate" type="date" value-format="yyyy-MM-dd HH:mm:ss" clearable placeholder="结算结束日" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" /> |
| | | <el-date-picker v-model="query.yearMonth" type="month" value-format="yyyy-MM-dd HH:mm:ss" clearable placeholder="绩效年月" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" /> |
| | | <rrOperation :crud="crud" /> |
| | | </div> |
| | | <!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'--> |
| | |
| | | <!--表单组件--> |
| | | <el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="500px"> |
| | | <el-form ref="form" :model="form" :rules="rules" size="small" label-width="100px"> |
| | | <el-form-item label="项目ID" prop="projectId"> |
| | | <el-select v-model="form.projectId" filterable placeholder="项目名称" style="width: 350px;" class="filter-item"> |
| | | <el-form-item label="项目名称" prop="projectId"> |
| | | <el-select v-model="form.projectId" filterable placeholder="请选择项目" style="width: 350px;" class="filter-item"> |
| | | <el-option |
| | | v-for="item in projectList" |
| | | :key="item.id" |
| | |
| | | <el-date-picker v-model="form.endDate" type="date" :picker-options="pickerOptionsEnd" style="width: 350px;" placeholder="选择日期" /> |
| | | </el-form-item> |
| | | <el-form-item label="绩效年月" prop="yearMonth"> |
| | | <el-date-picker v-model="form.yearMonth" type="month" clearable placeholder="绩效年月" style="width: 350px;" class="filter-item" /> |
| | | <el-date-picker v-model="form.yearMonth" type="month" value-format="yyyy-MM-dd" clearable placeholder="绩效年月" style="width: 350px;" class="filter-item" /> |
| | | </el-form-item> |
| | | </el-form> |
| | | <div slot="footer" class="dialog-footer"> |
| | |
| | | </el-dialog> |
| | | <!--表格渲染--> |
| | | <el-table ref="table" v-loading="crud.loading" :data="crud.data" size="small" style="width: 100%;" @selection-change="crud.selectionChangeHandler"> |
| | | <el-table-column type="selection" width="55" /> |
| | | <el-table-column prop="id" label="ID" /> |
| | | <el-table-column prop="projectId" label="项目ID" /> |
| | | <el-table-column prop="startDate" label="结算开始日" /> |
| | | <el-table-column prop="endDate" label="结算终了日" /> |
| | | <el-table-column prop="yearMonth" label="绩效年月" /> |
| | | <el-table-column type="selection" width="55" show-overflow-tooltip /> |
| | | <el-table-column prop="projectId" label="项目名称" show-overflow-tooltip> |
| | | <template slot-scope="scope"> |
| | | <el-tag>{{ scope.row.projectName }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="startDate" label="结算开始日" show-overflow-tooltip> |
| | | <template slot-scope="scope"> |
| | | {{ crud.toDate(scope.row.startDate) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="endDate" label="结算终了日" show-overflow-tooltip> |
| | | <template slot-scope="scope"> |
| | | {{ crud.toDate(scope.row.endDate) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="yearMonth" label="绩效年月" show-overflow-tooltip> |
| | | <template slot-scope="scope"> |
| | | {{ substr(scope.row.yearMonth) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column v-if="checkPer(['admin','projectPerformance:edit','projectPerformance:del'])" label="操作" width="150px" align="center"> |
| | | <template slot-scope="scope"> |
| | | <udOperation |
| | |
| | | </template> |
| | | |
| | | <script> |
| | | import crudProjectPerformance from '@/api/projectPerformance' |
| | | import crudProjectPerformance from '@/api/project/projectPerformance' |
| | | import crudProject from '@/api/project/project' |
| | | import CRUD, { presenter, header, form, crud } from '@crud/crud' |
| | | import rrOperation from '@crud/RR.operation' |
| | |
| | | }, |
| | | rules: { |
| | | projectId: [ |
| | | { required: true, message: '项目ID不能为空', trigger: 'blur' } |
| | | { required: true, message: '项目名称不能为空', trigger: 'change' } |
| | | ], |
| | | startDate: [ |
| | | { required: true, message: '结算开始日不能为空', trigger: 'blur' } |
| | | { required: true, message: '结算开始日不能为空', trigger: 'change' } |
| | | ], |
| | | endDate: [ |
| | | { required: true, message: '结算终了日不能为空', trigger: 'blur' } |
| | | { required: true, message: '结算终了日不能为空', trigger: 'change' } |
| | | ], |
| | | yearMonth: [ |
| | | { required: true, message: '绩效年月不能为空', trigger: 'blur' } |
| | | { required: true, message: '绩效年月不能为空', trigger: 'change' } |
| | | ] |
| | | }, |
| | | // 选中结束时间之后不可选 |
| | |
| | | crudProject.getAll().then(res => { |
| | | this.projectList = res |
| | | }) |
| | | }, |
| | | // 截取年月 |
| | | substr(data) { |
| | | return data.substring(0, 7) |
| | | } |
| | | } |
| | | } |
| | |
| | | <div class="head-container"> |
| | | <div v-if="crud.props.searchToggle"> |
| | | <!-- 搜索 --> |
| | | <label class="el-form-item-label">员工ID</label> |
| | | <el-input v-model="query.userId" clearable placeholder="员工ID" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" /> |
| | | <label class="el-form-item-label">项目ID</label> |
| | | <el-input v-model="query.projectId" clearable placeholder="项目ID" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" /> |
| | | <label class="el-form-item-label">绩效年月</label> |
| | | <el-input v-model="query.yearMonth" clearable placeholder="绩效年月" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" /> |
| | | <el-select v-model="query.userId" filterable placeholder="员工" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in userList" |
| | | :key="item.id" |
| | | :label="item.nickName" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | <el-select v-model="query.projectId" filterable placeholder="项目名称" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in projectList" |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | <el-date-picker v-model="query.yearMonth" type="month" value-format="yyyy-MM-dd HH:mm:ss" clearable placeholder="绩效年月" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" /> |
| | | <rrOperation :crud="crud" /> |
| | | </div> |
| | | <!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'--> |
| | |
| | | <!--表单组件--> |
| | | <el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="500px"> |
| | | <el-form ref="form" :model="form" :rules="rules" size="small" label-width="80px"> |
| | | <el-form-item label="员工ID" prop="userId"> |
| | | 未设置字典,请手动设置 Select |
| | | <el-form-item label="员工" prop="userId"> |
| | | <el-select v-model="form.userId" filterable clearable placeholder="请选择员工" style="width: 370px;"> |
| | | <el-option |
| | | v-for="item in userList" |
| | | :key="item.id" |
| | | :label="item.nickName" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="绩效工时" prop="performanceHours"> |
| | | <el-input v-model="form.performanceHours" style="width: 370px;" /> |
| | | <el-input v-model="form.performanceHours" style="width: 370px;"> |
| | | <template slot="append">小时</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="项目ID" prop="projectId"> |
| | | 未设置字典,请手动设置 Select |
| | | <el-form-item label="项目名称" prop="projectId"> |
| | | <el-select v-model="form.projectId" filterable clearable placeholder="请选择项目名称" style="width: 370px;"> |
| | | <el-option |
| | | v-for="item in projectList" |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="绩效年月" prop="yearMonth"> |
| | | <el-date-picker v-model="form.yearMonth" type="datetime" style="width: 370px;" /> |
| | | <el-date-picker v-model="form.yearMonth" type="month" value-format="yyyy-MM-dd" clearable placeholder="绩效年月" style="width: 370px;" class="filter-item" /> |
| | | </el-form-item> |
| | | </el-form> |
| | | <div slot="footer" class="dialog-footer"> |
| | |
| | | <!--表格渲染--> |
| | | <el-table ref="table" v-loading="crud.loading" :data="crud.data" size="small" style="width: 100%;" @selection-change="crud.selectionChangeHandler"> |
| | | <el-table-column type="selection" width="55" /> |
| | | <el-table-column prop="userId" label="员工ID" /> |
| | | <el-table-column prop="performanceHours" label="绩效工时" /> |
| | | <el-table-column prop="projectId" label="项目ID" /> |
| | | <el-table-column prop="yearMonth" label="绩效年月" /> |
| | | <el-table-column prop="userId" label="员工" show-overflow-tooltip> |
| | | <template slot-scope="scope"> |
| | | <el-tag>{{ scope.row.userName }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="performanceHours" label="绩效工时" show-overflow-tooltip> |
| | | <template slot-scope="scope"> |
| | | {{ scope.row.performanceHours + '(时)' }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="projectId" label="项目名称" show-overflow-tooltip> |
| | | <template slot-scope="scope"> |
| | | <el-tag>{{ scope.row.projectName }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="yearMonth" label="绩效年月" show-overflow-tooltip> |
| | | <template slot-scope="scope"> |
| | | {{ substr(scope.row.yearMonth) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column v-if="checkPer(['admin','projectPerformanceDetail:edit','projectPerformanceDetail:del'])" label="操作" width="150px" align="center"> |
| | | <template slot-scope="scope"> |
| | | <udOperation |
| | |
| | | </template> |
| | | |
| | | <script> |
| | | import crudProjectPerformanceDetail from '@/api/projectPerformanceDetail' |
| | | import crudProjectPerformanceDetail from '@/api/project/projectPerformanceDetail' |
| | | import crudProject from '@/api/project/project' |
| | | import crudUser from '@/api/system/user' |
| | | import CRUD, { presenter, header, form, crud } from '@crud/crud' |
| | | import rrOperation from '@crud/RR.operation' |
| | | import crudOperation from '@crud/CRUD.operation' |
| | |
| | | return CRUD({ title: '项目绩效详细', url: 'api/projectPerformanceDetail', idField: 'id', sort: 'id,desc', crudMethod: { ...crudProjectPerformanceDetail }}) |
| | | }, |
| | | data() { |
| | | // 时长(千内)验证 |
| | | var durationValidate = (rule, value, callback) => { |
| | | const reg = /^([0-9]|[1-9]\d{1,2})(\.\d{1,2})?$|1000$/ |
| | | if (value != null && value !== '' && !reg.test(value)) { |
| | | callback(new Error('请输入 一千 以内的正整数或两位小数')) |
| | | } else { |
| | | callback() |
| | | } |
| | | } |
| | | return { |
| | | permission: { |
| | | add: ['admin', 'projectPerformanceDetail:add'], |
| | | edit: ['admin', 'projectPerformanceDetail:edit'], |
| | | del: ['admin', 'projectPerformanceDetail:del'] |
| | | del: ['admin', 'projectPerformanceDetail:del'], |
| | | download: ['admin', 'projectPerformanceDetail:download'] |
| | | }, |
| | | rules: { |
| | | userId: [ |
| | | { required: true, message: '员工ID不能为空', trigger: 'blur' } |
| | | { required: true, message: '员工ID不能为空', trigger: 'change' } |
| | | ], |
| | | performanceHours: [ |
| | | { required: true, message: '绩效工时不能为空', trigger: 'blur' } |
| | | { required: true, message: '绩效工时不能为空', trigger: 'blur' }, |
| | | { validator: durationValidate, trigger: 'blur' } |
| | | ], |
| | | projectId: [ |
| | | { required: true, message: '项目ID不能为空', trigger: 'blur' } |
| | | { required: true, message: '项目ID不能为空', trigger: 'change' } |
| | | ], |
| | | yearMonth: [ |
| | | { required: true, message: '绩效年月不能为空', trigger: 'blur' } |
| | | { required: true, message: '绩效年月不能为空', trigger: 'change' } |
| | | ] |
| | | }, |
| | | queryTypeOptions: [ |
| | | { key: 'userId', display_name: '员工ID' }, |
| | | { key: 'projectId', display_name: '项目ID' }, |
| | | { key: 'yearMonth', display_name: '绩效年月' } |
| | | ] |
| | | ], |
| | | projectList: [], |
| | | userList: [] |
| | | } |
| | | }, |
| | | methods: { |
| | | // 钩子:在获取表格数据之前执行,false 则代表不获取数据 |
| | | [CRUD.HOOK.beforeRefresh]() { |
| | | this.getprojectAll() |
| | | this.getUser() |
| | | return true |
| | | }, |
| | | // 获取信息项目列表 |
| | | getprojectAll() { |
| | | crudProject.getAll().then(res => { |
| | | this.projectList = res |
| | | }) |
| | | }, |
| | | // 获取员工信息 |
| | | getUser() { |
| | | crudUser.getAll().then(res => { |
| | | this.userList = res |
| | | }) |
| | | }, |
| | | // 截取年月 |
| | | substr(data) { |
| | | return data.substring(0, 7) |
| | | } |
| | | } |
| | | } |