2 files added
53 files modified
| | |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-amqp</artifactId> |
| | | </dependency> |
| | | <dependency>
|
| | | <groupId>org.apache.httpcomponents</groupId>
|
| | | <artifactId>httpclient</artifactId>
|
| | | <version>4.5.14</version>
|
| | | <scope>test</scope>
|
| | | </dependency>
|
| | | </dependencies> |
| | | |
| | | <!-- 打包 --> |
| | |
| | | @ApiModelProperty(value = "加班时长") |
| | | private Double overtimeDuration; |
| | | |
| | | @Column(name = "`date_type`",nullable = false)
|
| | | @NotBlank
|
| | | @ApiModelProperty(value = "日期类型")
|
| | | private String dateType;
|
| | |
|
| | | @Column(name = "`approval_status`") |
| | | @ApiModelProperty(value = "审批状态") |
| | | private String approvalStatus; |
| | |
| | | List<AttendanceOvertime> findByUserIdAndDate(Long userId, LocalDateTime startDate, LocalDateTime endDate); |
| | | |
| | | List<AttendanceOvertime> findByUserId(Long userId); |
| | |
|
| | | List<AttendanceOvertime> findByUserIdAndApprovalStatus(Long userId, String overtimePass);
|
| | | } |
| | |
| | | return new ResponseEntity<>(attendanceGoOutService.getRemainingTime(resources),HttpStatus.CREATED); |
| | | } |
| | | |
| | | @PutMapping(value = "/reflashTime")
|
| | | public ResponseEntity<Object> getRemainingTime(@RequestBody Long[] ids) {
|
| | | attendanceGoOutService.reflashTime(ids);
|
| | | return new ResponseEntity<>(HttpStatus.OK);
|
| | | }
|
| | |
|
| | | @PutMapping(value = "/approve") |
| | | @Log("审核/撤销功能") |
| | | @ApiOperation("审核/撤销功能") |
| | |
| | | */ |
| | | Double getRemainingTime(AttendanceGoOut attendanceGoOut); |
| | | |
| | | void reflashTime(Long[] ids);
|
| | |
|
| | | /** |
| | | * 审核功能 |
| | | * @param resources / |
| | |
| | | */ |
| | | Double queryAttendanceHours(AttendanceQueryCriteria criteria); |
| | | |
| | | Double queryAttendanceHolidaysOverTimeHours(AttendanceQueryCriteria criteria);
|
| | |
|
| | | /**
|
| | | * 查询某月平日加班小时数
|
| | | * @param criteria 条件参数
|
| | | * @return List<AttendanceDto>
|
| | | */
|
| | | Double queryAttendanceOverTimeHours(AttendanceQueryCriteria criteria);
|
| | |
|
| | | |
| | | void getUserMakeUpCard(String userId); |
| | | |
| | |
| | | /** 加班时长单位 */ |
| | | private String overtimeDurationUnit; |
| | | |
| | | /** 日期类型 */
|
| | | private String dateType;
|
| | |
|
| | | /** 审批状态 */ |
| | | private String approvalStatus; |
| | | |
| | |
| | | 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.system.domain.Job; |
| | | 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; |
| | | import me.zhengjie.modules.system.domain.*;
|
| | | import me.zhengjie.modules.system.repository.*;
|
| | | import me.zhengjie.modules.system.service.SysConfigHolidayService;
|
| | | import me.zhengjie.utils.*; |
| | | import lombok.RequiredArgsConstructor; |
| | | import me.zhengjie.modules.attendance.repository.AttendanceCardreplacementRepository; |
| | |
| | | |
| | | import java.sql.Timestamp; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDate;
|
| | | import java.util.*; |
| | | import java.io.IOException; |
| | | import javax.servlet.http.HttpServletResponse; |
| | |
| | | private final AttendanceRepository attendanceRepository; |
| | | private final SysConfigProportionRepository sysConfigProportionRepository; |
| | | private final DictDetailRepository dictDetailRepository; |
| | | private final SysConfigHolidayRepository sysConfigHolidayRepository;
|
| | | |
| | | @Override |
| | | public Map<String,Object> queryAll(AttendanceCardreplacementQueryCriteria criteria, Pageable pageable){ |
| | |
| | | } |
| | | |
| | | /** |
| | | * 只能补3个工作日的卡
|
| | | * @param resources
|
| | | */
|
| | | public void checkCardreplacement(AttendanceCardreplacement resources) {
|
| | |
|
| | | LocalDate toLocalDate = resources.getCardReplacementTime().toLocalDateTime().toLocalDate();
|
| | | LocalDate localDate = LocalDate.now();
|
| | | int count = 0;
|
| | | while (localDate.isAfter(toLocalDate)) {
|
| | | if (count >= 3) {
|
| | | throw new BadRequestException("只能申请3个工作日的补卡");
|
| | | }
|
| | | if (localDate.getDayOfWeek().getValue() == 6 || localDate.getDayOfWeek().getValue() == 7) {
|
| | | SysConfigHoliday holidayDate = sysConfigHolidayRepository.findByHolidayDate(localDate.toString());
|
| | | if (holidayDate != null && holidayDate.getDateType().equals(Constant.DATE_TYPE_WEEKDAY)) {
|
| | | count++;
|
| | | }
|
| | | } else {
|
| | | SysConfigHoliday holidayDate = sysConfigHolidayRepository.findByHolidayDate(localDate.toString());
|
| | | if (holidayDate == null || holidayDate.getDateType().equals(Constant.DATE_TYPE_LEGAL_HOLIDAYS) || holidayDate.getDateType().equals(Constant.DATE_TYPE_HOLIDAYS)) {
|
| | | count++;
|
| | | }
|
| | | }
|
| | | localDate = localDate.plusDays(-1);
|
| | | count++;
|
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * 返回前三个工作日的日期
|
| | | * @param resources
|
| | | */
|
| | | public List<String> getCardreplacementAbleDateList(AttendanceCardreplacement resources) {
|
| | | List<String> dateList = new ArrayList<>();
|
| | | LocalDate toLocalDate = resources.getCardReplacementTime().toLocalDateTime().toLocalDate();
|
| | | LocalDate localDate = LocalDate.now();
|
| | | int count = 0;
|
| | | while (localDate.isAfter(toLocalDate)) {
|
| | | if (count >= 3) {
|
| | | break;
|
| | | }
|
| | | if (localDate.getDayOfWeek().getValue() == 6 || localDate.getDayOfWeek().getValue() == 7) {
|
| | | SysConfigHoliday holidayDate = sysConfigHolidayRepository.findByHolidayDate(localDate.toString());
|
| | | if (holidayDate != null && holidayDate.getDateType().equals(Constant.DATE_TYPE_WEEKDAY)) {
|
| | | dateList.add(localDate.toString());
|
| | | count++;
|
| | | }
|
| | | } else {
|
| | | SysConfigHoliday holidayDate = sysConfigHolidayRepository.findByHolidayDate(localDate.toString());
|
| | | if (holidayDate == null || holidayDate.getDateType().equals(Constant.DATE_TYPE_LEGAL_HOLIDAYS) || holidayDate.getDateType().equals(Constant.DATE_TYPE_HOLIDAYS)) {
|
| | | dateList.add(localDate.toString());
|
| | | count++;
|
| | | }
|
| | | }
|
| | | localDate = localDate.plusDays(-1);
|
| | | count++;
|
| | | }
|
| | | return dateList;
|
| | | }
|
| | | /**
|
| | | * 查询剩余补卡次数 |
| | | */ |
| | | public void getCardreplacement(Timestamp cardReplacementTime, Long userId){ |
| | |
| | | return result; |
| | | } |
| | | |
| | | @Override
|
| | | public void reflashTime(Long[] ids) {
|
| | | List<AttendanceGoOut> attendanceGoOutList = attendanceGoOutRepository.findAllById(Arrays.asList(ids));
|
| | | attendanceGoOutList.forEach(attendanceGoOut -> {
|
| | | attendanceGoOut.setOutDuration(getRemainingTime(attendanceGoOut));
|
| | | attendanceGoOutRepository.save(attendanceGoOut);
|
| | | });
|
| | | }
|
| | |
|
| | | private Long calculateTimes(Calculate calculate, Long userId) { |
| | | User userInfo = userRepository.getOne(userId); |
| | | SysRostering sysRostering = userInfo.getSysRostering(); |
| | |
| | | LeaEndTime = LeaEndTime.substring(0,10) + " " + user.getSysRostering().getWorkEndTime().toString() + ":00"; |
| | | } |
| | | // 查询其他状态的表是否有重复 |
| | | repeatValidation(LeaStartTime, LeaEndTime, resources.getUserId()); |
| | | // repeatValidation(LeaStartTime, LeaEndTime, resources.getUserId());
|
| | | // 验证请假时间是否冲突 |
| | | List<AttendanceLeave> attendanceLeaveList = attendanceLeaveRepository.checkCreateLeaveTime(LeaStartTime,LeaEndTime, resources.getUserId()); |
| | | if(attendanceLeaveList.size() > 0){ |
| | |
| | | LeaEndTime = LeaEndTime.substring(0,10) + " " + user.getSysRostering().getWorkEndTime().toString() + ":00"; |
| | | } |
| | | // 查询其他状态的表是否有重复 |
| | | repeatValidation(LeaStartTime, LeaEndTime, resources.getUserId()); |
| | | // repeatValidation(LeaStartTime, LeaEndTime, resources.getUserId());
|
| | | // 验证是否存在时间冲突的请假记录 |
| | | Set<Long> ids = new HashSet<>(); |
| | | ids.add(attendanceLeave.getId()); |
| | |
| | | //获取年假剩余(新) |
| | | Double surplusYearTime = new Double(0.00); |
| | | |
| | | List<AttendanceOvertime> attendanceOvertimeList = attendanceOvertimeRepository.findByUserId(userId); |
| | | List<AttendanceOvertime> attendanceOvertimeList = attendanceOvertimeRepository.findByUserIdAndApprovalStatus(userId, Constant.OVERTIME_PASS);
|
| | | if (attendanceOvertimeList.size() > 0) { |
| | | surplusYearTime = attendanceOvertimeList.stream() |
| | | .filter(attendanceOvertime -> attendanceOvertime.getApprovalStatus().equals(Constant.OVERTIME_PASS)) |
| | | .filter(attendanceOvertime -> !attendanceOvertime.getDateType().equals(Constant.DATE_TYPE_LEGAL_HOLIDAYS))
|
| | | .map(attendanceOvertime -> attendanceOvertime.getOvertimeDuration()).reduce(0.0, (o1, o2) -> o1 + o2); |
| | | Double usedTime = attendanceLeaveRepository.sumLeaveDurationByUserIdAndLeaveType(userId, Constant.LEAVE_TYPE_REPLACE); |
| | | if (usedTime != null) { |
| | |
| | | import me.zhengjie.modules.constant.Constant; |
| | | import me.zhengjie.modules.quartz.service.OpaiDingTalkService; |
| | | import me.zhengjie.modules.system.domain.Role; |
| | | import me.zhengjie.modules.system.domain.SysConfigHoliday;
|
| | | import me.zhengjie.modules.system.domain.SysRostering; |
| | | import me.zhengjie.modules.system.domain.User; |
| | | import me.zhengjie.modules.system.repository.DictDetailRepository; |
| | | import me.zhengjie.modules.system.repository.SysConfigHolidayRepository;
|
| | | import me.zhengjie.modules.system.repository.UserRepository; |
| | | import me.zhengjie.utils.*; |
| | | import org.apache.commons.lang3.ObjectUtils; |
| | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.math.BigDecimal; |
| | | import java.sql.Timestamp;
|
| | | import java.text.SimpleDateFormat; |
| | | import java.time.Duration; |
| | | import java.time.format.DateTimeFormatter;
|
| | | import java.util.ArrayList; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.List; |
| | |
| | | private final DictDetailRepository dictDetailRepository; |
| | | private final UserRepository userRepository; |
| | | private final OpaiDingTalkService opaiDingTalkService; |
| | | private final SysConfigHolidayRepository sysConfigHolidayRepository;
|
| | | |
| | | @Override |
| | | public Map<String,Object> queryAll(AttendanceOvertimeQueryCriteria criteria, Pageable pageable){ |
| | |
| | | // throw new BadRequestException("考勤记录不存在"); |
| | | // } |
| | | |
| | | SysConfigHoliday sysConfigHoliday = sysConfigHolidayRepository.findByHolidayDate(resources.getOvertimeStartTime().toLocalDateTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
|
| | | if (sysConfigHoliday != null && sysConfigHoliday.getDateType().equals(Constant.DATE_TYPE_LEGAL_HOLIDAYS)) {
|
| | | resources.setDateType(Constant.DATE_TYPE_LEGAL_HOLIDAYS);
|
| | | } else {
|
| | | resources.setDateType(Constant.DATE_TYPE_WEEKEND);
|
| | | }
|
| | | resources.setApprovalStatus(Constant.OVERTIME_APPROVAL); |
| | | try { |
| | | //发送给审批者 |
| | |
| | | throw new BadRequestException("审核通过或退回的不能进行修改"); |
| | | } |
| | | |
| | | SysConfigHoliday sysConfigHoliday = sysConfigHolidayRepository.findByHolidayDate(resources.getOvertimeStartTime().toLocalDateTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
|
| | | if (sysConfigHoliday != null && sysConfigHoliday.getDateType().equals(Constant.DATE_TYPE_LEGAL_HOLIDAYS)) {
|
| | | resources.setDateType(Constant.DATE_TYPE_LEGAL_HOLIDAYS);
|
| | | } else {
|
| | | resources.setDateType(Constant.DATE_TYPE_WEEKEND);
|
| | | }
|
| | |
|
| | | //获取当前登入人信息 |
| | | User user1 = userRepository.getOne(SecurityUtils.getCurrentUserId()); |
| | | Role role = user1.getRoles().iterator().next(); |
| | |
| | | } |
| | | } |
| | | |
| | | //查询考勤表是否有记录 |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | // //查询考勤表是否有记录
|
| | | // SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
| | | // String attDate = sdf.format(resources.getOvertimeStartTime()); |
| | | // Attendance attendance = attendanceRepository.findAllByUserIdAndAttendanceDate(resources.getUserId(),attDate.substring(0,10)); |
| | | // if(ObjectUtils.isEmpty(attendance)){ |
| | |
| | | |
| | | long minutes = 0; |
| | | |
| | | if (sysRostering.getWorkEndTime().isBefore(resources.getOvertimeEndTime().toLocalDateTime().toLocalTime()) &&
|
| | | sysRostering.getWorkEndTime().plusMinutes(30).isAfter(resources.getOvertimeEndTime().toLocalDateTime().toLocalTime())) {
|
| | | resources.setOvertimeEndTime(Timestamp.valueOf(resources.getOvertimeEndTime().toLocalDateTime().with(sysRostering.getWorkEndTime())));
|
| | | }
|
| | |
|
| | | if ((resources.getOvertimeStartTime().toLocalDateTime().toLocalTime().isBefore(sysRostering.getLunchStartTime()) || resources.getOvertimeStartTime().toLocalDateTime().toLocalTime().equals(sysRostering.getLunchStartTime())) |
| | | && (resources.getOvertimeEndTime().toLocalDateTime().toLocalTime().isAfter(sysRostering.getLunchEndTime()) || resources.getOvertimeEndTime().toLocalDateTime().toLocalTime().equals(sysRostering.getLunchEndTime()) )) { |
| | | minutes = Duration.between(resources.getOvertimeStartTime().toLocalDateTime(), resources.getOvertimeEndTime().toLocalDateTime()).toMinutes() - 60; |
| | |
| | | minutes = Duration.between(sysRostering.getLunchEndTime(), resources.getOvertimeEndTime().toLocalDateTime()).toMinutes(); |
| | | } |
| | | |
| | | if (sysRostering.getWorkEndTime().isBefore(resources.getOvertimeEndTime().toLocalDateTime().toLocalTime())) {
|
| | | minutes -= 30;
|
| | | }
|
| | |
|
| | | double hours = new BigDecimal((double) minutes / 60).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); |
| | | |
| | | attendanceOvertimeDto.setOvertimeDuration(hours); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public Double queryAttendanceHolidaysOverTimeHours(AttendanceQueryCriteria criteria) {
|
| | |
|
| | | LocalDate startDate = LocalDate.parse(criteria.getTargetYearMonth(), DateTimeFormatter.ofPattern("yyyy-MM-dd"));
|
| | | LocalDate endDate = startDate.plusMonths(1).minusDays(1);
|
| | | // 节日检索类
|
| | | SysConfigHolidayQueryCriteria sysConfigHolidayQueryCriteria = new SysConfigHolidayQueryCriteria();
|
| | | sysConfigHolidayQueryCriteria.setHolidayDateLike(criteria.getTargetYearMonth().substring(0,7));
|
| | | // 获取本月节日列表
|
| | | List<SysConfigHoliday> sysConfigHolidayMonthList = sysConfigHolidayRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,sysConfigHolidayQueryCriteria,criteriaBuilder));
|
| | | if (sysConfigHolidayMonthList.isEmpty()) {
|
| | | return 0.0D;
|
| | | }
|
| | | // 加班信息
|
| | | List<AttendanceOvertime> attendanceOvertimeList = attendanceOvertimeRepository.findByUserIdAndDate(criteria.getUserId(), startDate.atStartOfDay(), endDate.atStartOfDay());
|
| | |
|
| | | return sysConfigHolidayMonthList.stream()
|
| | | .filter(sysConfigHoliday -> Constant.DATE_TYPE_LEGAL_HOLIDAYS.equals(sysConfigHoliday.getDateType()))
|
| | | .mapToDouble(sysConfigHoliday -> {
|
| | | for (AttendanceOvertime attendanceOvertime : attendanceOvertimeList) {
|
| | | if (sysConfigHoliday.getHolidayDate().toLocalDateTime().isEqual(attendanceOvertime.getOvertimeStartTime().toLocalDateTime().truncatedTo(ChronoUnit.DAYS))) {
|
| | | return attendanceOvertime.getOvertimeDuration();
|
| | | }
|
| | | }
|
| | | return 0.0D;
|
| | | }).sum();
|
| | | }
|
| | |
|
| | | @Override
|
| | | public Double queryAttendanceOverTimeHours(AttendanceQueryCriteria criteria) {
|
| | | // 节日检索类
|
| | | SysConfigHolidayQueryCriteria sysConfigHolidayQueryCriteria = new SysConfigHolidayQueryCriteria();
|
| | | sysConfigHolidayQueryCriteria.setHolidayDateLike(criteria.getTargetYearMonth().substring(0,7));
|
| | | // 获取本月节日列表
|
| | | List<SysConfigHoliday> sysConfigHolidayMonthList = sysConfigHolidayRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,sysConfigHolidayQueryCriteria,criteriaBuilder));
|
| | |
|
| | | LocalDate startDate = LocalDate.parse(criteria.getTargetYearMonth(), DateTimeFormatter.ofPattern("yyyy-MM-dd"));
|
| | | LocalDate endDate = startDate.plusMonths(1).minusDays(1);
|
| | |
|
| | | Long distance = ChronoUnit.DAYS.between(startDate, endDate);
|
| | |
|
| | | return Stream.iterate(startDate, d -> d.plusDays(1)).limit(distance + 1).filter(localDate -> {
|
| | | for (SysConfigHoliday sysConfigHoliday : sysConfigHolidayMonthList) {
|
| | | if (sysConfigHoliday.getHolidayDate().toLocalDateTime().isEqual(localDate.atStartOfDay())) {
|
| | | return Constant.DATE_TYPE_WEEKDAY.equals(sysConfigHoliday.getDateType());
|
| | | }
|
| | | }
|
| | | return localDate.getDayOfWeek() != DayOfWeek.SATURDAY && localDate.getDayOfWeek() != DayOfWeek.SUNDAY;
|
| | | }).map(localDate -> {
|
| | | LocalDateTime startOfDate = localDate.atTime(0, 0, 0);
|
| | | LocalDateTime endOfDate = localDate.atTime(23, 59, 59);
|
| | | Attendance attendanceDate = attendanceRepository.findAllByUserIdAndAttendanceDate(criteria.getUserId(), localDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
|
| | | if (attendanceDate == null) {
|
| | | return BigDecimal.valueOf(0.0);
|
| | | }
|
| | | LocalDateTime actualWorkStartTime = attendanceDate.getActualWorkStartTime() == null ? null : attendanceDate.getActualWorkStartTime().toLocalDateTime();
|
| | | LocalDateTime actualWorkEndTime = attendanceDate.getActualWorkEndTime() == null ? null : attendanceDate.getActualWorkEndTime().toLocalDateTime();
|
| | |
|
| | | LocalDateTime rosteringWorkStartTime = attendanceDate.getRosteringWorkStartTime() == null ? null : attendanceDate.getRosteringWorkStartTime().toLocalDateTime();
|
| | | LocalDateTime rosteringWorkEndTime = attendanceDate.getRosteringWorkEndTime() == null ? null : attendanceDate.getRosteringWorkEndTime().toLocalDateTime();
|
| | | if (actualWorkStartTime != null && actualWorkStartTime.isBefore(rosteringWorkStartTime)) {
|
| | | actualWorkStartTime = rosteringWorkStartTime;
|
| | | }
|
| | | List<Calculate> attendanceParts = new ArrayList<>();
|
| | | // 当日打卡信息不全不算
|
| | | if (actualWorkStartTime != null && actualWorkEndTime != null) {
|
| | | attendanceParts.add(new Calculate(actualWorkStartTime, actualWorkEndTime));
|
| | | }
|
| | |
|
| | | // 正常时间管理
|
| | | List<Calculate> breakParts = new ArrayList<>();
|
| | | breakParts.add(new Calculate(rosteringWorkStartTime, rosteringWorkEndTime.plusMinutes(30)));
|
| | |
|
| | | // 外出信息
|
| | | List<AttendanceGoOut> attendanceGoOutList = attendanceGoOutRepository.findByUserAndDate(criteria.getUserId(), startOfDate, endOfDate);
|
| | | attendanceParts.addAll(
|
| | | attendanceGoOutList.stream().map(attendanceGoOut -> {
|
| | | LocalDateTime attendanceGoOutStart = attendanceGoOut.getOutStartTime().toLocalDateTime();
|
| | | LocalDateTime attendanceGoOutEnd = attendanceGoOut.getOutEndTime().toLocalDateTime();
|
| | | if (attendanceGoOutStart.isBefore(rosteringWorkStartTime)) {
|
| | | attendanceGoOutStart = rosteringWorkStartTime;
|
| | | }
|
| | | return new Calculate(attendanceGoOutStart, attendanceGoOutEnd);
|
| | | }).filter(calculate -> calculate.getStart().isBefore(calculate.getEnd())).collect(Collectors.toList())
|
| | | );
|
| | |
|
| | | List<Calculate> resultParts = new ArrayList<>();
|
| | |
|
| | | attendanceParts.stream().sorted().reduce(new Stack<Calculate>(), (result, current) -> {
|
| | | // 删除重复时间,合并相连的时间段
|
| | | if (result.empty()) {
|
| | | result.push(current);
|
| | | return result;
|
| | | }
|
| | | Calculate last = result.peek();
|
| | | if (last.getEnd().isBefore(current.getStart())) {
|
| | | result.push(current);
|
| | | } else if (last.getEnd().isBefore(current.getEnd())) {
|
| | | last.setEnd(current.getEnd());
|
| | | }
|
| | | return result;
|
| | | }, (o1, o2) -> null).forEach(calculate -> {
|
| | | // 去除休息时间:午休等
|
| | | for (Calculate breakPart : breakParts) {
|
| | | if ((!calculate.getStart().isAfter(breakPart.getStart()) && !calculate.getEnd().isBefore(breakPart.getStart()))
|
| | | || (!calculate.getStart().isAfter(breakPart.getEnd()) && !calculate.getEnd().isBefore(breakPart.getEnd()))) {
|
| | | Calculate calculate1 = new Calculate(calculate.getStart(), breakPart.getStart());
|
| | | Calculate calculate2 = new Calculate(breakPart.getEnd(), calculate.getEnd());
|
| | | if (calculate1.getStart().isBefore(calculate1.getEnd())) {
|
| | | resultParts.add(calculate1);
|
| | | }
|
| | | if (calculate2.getStart().isBefore(calculate2.getEnd())) {
|
| | | resultParts.add(calculate2);
|
| | | }
|
| | | } else if (calculate.getEnd().isBefore(breakPart.getStart()) || calculate.getStart().isAfter(breakPart.getEnd())) {
|
| | | resultParts.add(calculate);
|
| | | }
|
| | | }
|
| | | });
|
| | |
|
| | | // 出勤时间累计
|
| | | Long result = resultParts.stream()
|
| | | .mapToLong(calculate -> ChronoUnit.MINUTES.between(calculate.getStart(), calculate.getEnd()))
|
| | | .sum();
|
| | | // .reduce(new BigDecimal(0),
|
| | | // (total, current) -> total.add(BigDecimal.valueOf(current)),
|
| | | // (o1, o2) -> null).divide(BigDecimal.valueOf(3600), 2, RoundingMode.HALF_UP
|
| | | // )
|
| | | // result = result.setScale(1, RoundingMode.FLOOR);
|
| | | // if (result < 30) {
|
| | | // System.out.println("localDate : " + localDate + " hours : " + 0);
|
| | | // return BigDecimal.valueOf(0.0);
|
| | | // } else {
|
| | | // result = result - 30;
|
| | | // }
|
| | | System.out.println("localDate : " + localDate + " hours : " + result);
|
| | | return BigDecimal.valueOf(result).divide(BigDecimal.valueOf(60), 1, RoundingMode.HALF_DOWN);
|
| | | }).reduce(BigDecimal::add).get().doubleValue();
|
| | | }
|
| | |
|
| | | @Override
|
| | | public Double queryAttendanceHours(AttendanceQueryCriteria criteria) { |
| | | // 节日检索类 |
| | | SysConfigHolidayQueryCriteria sysConfigHolidayQueryCriteria = new SysConfigHolidayQueryCriteria(); |
| | |
| | | @ApiModelProperty(value = "总消耗成本") |
| | | private BigDecimal moneyTotalCost; |
| | | |
| | | @Column(name = "`money_real_cost`")
|
| | | @ApiModelProperty(value = "总消耗成本")
|
| | | private BigDecimal moneyRealCost;
|
| | |
|
| | | public void copy(ProjectProgress source) { |
| | | BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); |
| | | } |
| New file |
| | |
| | | /*
|
| | | * Copyright 2019-2020 Zheng Jie
|
| | | *
|
| | | * Licensed under the Apache License, Version 2.0 (the "License");
|
| | | * you may not use this file except in compliance with the License.
|
| | | * You may obtain a copy of the License at
|
| | | *
|
| | | * http://www.apache.org/licenses/LICENSE-2.0
|
| | | *
|
| | | * Unless required by applicable law or agreed to in writing, software
|
| | | * distributed under the License is distributed on an "AS IS" BASIS,
|
| | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| | | * See the License for the specific language governing permissions and
|
| | | * limitations under the License.
|
| | | */
|
| | | package me.zhengjie.modules.project.domain;
|
| | |
|
| | | import cn.hutool.core.bean.BeanUtil;
|
| | | import cn.hutool.core.bean.copier.CopyOptions;
|
| | | import io.swagger.annotations.ApiModelProperty;
|
| | | import lombok.Data;
|
| | | import me.zhengjie.base.BaseEntity;
|
| | |
|
| | | import javax.persistence.*;
|
| | | import javax.validation.constraints.NotBlank;
|
| | | import javax.validation.constraints.NotNull;
|
| | | import java.io.Serializable;
|
| | | import java.math.BigDecimal;
|
| | | import java.sql.Timestamp;
|
| | |
|
| | | /**
|
| | | * @website https://eladmin.vip
|
| | | * @description /
|
| | | * @author HuaZhe
|
| | | * @date 2022-12-23
|
| | | **/
|
| | | @Entity
|
| | | @Data
|
| | | @Table(name="project_progress_detail")
|
| | | public class ProjectProgressDetail extends BaseEntity implements Serializable {
|
| | |
|
| | | @Id
|
| | | @GeneratedValue(strategy = GenerationType.IDENTITY)
|
| | | @Column(name = "`id`")
|
| | | @ApiModelProperty(value = "ID")
|
| | | private Long id;
|
| | |
|
| | | @Column(name = "`belong_year`",nullable = false)
|
| | | @NotNull
|
| | | @ApiModelProperty(value = "年度")
|
| | | private Integer belongYear;
|
| | |
|
| | | @Column(name = "`belong_week`",nullable = false)
|
| | | @NotNull
|
| | | @ApiModelProperty(value = "周度")
|
| | | private Integer belongWeek;
|
| | |
|
| | | @Column(name = "`belong_date`",nullable = false)
|
| | | @NotNull
|
| | | @ApiModelProperty(value = "生成日")
|
| | | private Timestamp belongDate;
|
| | |
|
| | | @ManyToOne
|
| | | @JoinColumn(name = "`project_id`",nullable = false)
|
| | | @NotNull
|
| | | @ApiModelProperty(value = "项目ID")
|
| | | private Project project;
|
| | |
|
| | | @Column(name = "`user_id`")
|
| | | @ApiModelProperty(value = "用户ID")
|
| | | private Long userId;
|
| | |
|
| | | @Column(name = "`time_init_cost`")
|
| | | @ApiModelProperty(value = "总分配绩效工时")
|
| | | private Double timeInitCost;
|
| | |
|
| | | @Column(name = "`time_total_cost`")
|
| | | @ApiModelProperty(value = "实际消化总工时")
|
| | | private Double timeTotalCost;
|
| | |
|
| | | // @Column(name = "`time_last_cost`")
|
| | | // @ApiModelProperty(value = "当周消化工时")
|
| | | // private Double timeLastCost;
|
| | |
|
| | | @Column(name = "`money_total_cost`")
|
| | | @ApiModelProperty(value = "实际消耗总成本")
|
| | | private BigDecimal moneyTotalCost;
|
| | |
|
| | | // @Column(name = "`money_last_cost`")
|
| | | // @ApiModelProperty(value = "当周消耗成本")
|
| | | // private Double moneyLastCost;
|
| | |
|
| | | public void copy(ProjectProgressDetail source) {
|
| | | BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
|
| | | }
|
| | | }
|
| | |
| | | */ |
| | | void download(List<ProjectCostDto> all, HttpServletResponse response) throws IOException; |
| | | |
| | | BigDecimal calcUserCostByDate(Long userId, Timestamp enterProjectTime, Timestamp exitProjectTime, Map<String, Double> costHoursMap); |
| | | // BigDecimal calcUserCostByDate(Long userId, Timestamp enterProjectTime, Timestamp exitProjectTime, Map<String, Double> costHoursMap);
|
| | |
|
| | | BigDecimal calcUserCostByHours(Long userId, Double timeTotalCost);
|
| | | } |
| New file |
| | |
| | | /*
|
| | | * Copyright 2019-2020 Zheng Jie
|
| | | *
|
| | | * Licensed under the Apache License, Version 2.0 (the "License");
|
| | | * you may not use this file except in compliance with the License.
|
| | | * You may obtain a copy of the License at
|
| | | *
|
| | | * http://www.apache.org/licenses/LICENSE-2.0
|
| | | *
|
| | | * Unless required by applicable law or agreed to in writing, software
|
| | | * distributed under the License is distributed on an "AS IS" BASIS,
|
| | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| | | * See the License for the specific language governing permissions and
|
| | | * limitations under the License.
|
| | | */
|
| | | package me.zhengjie.modules.project.service.dto;
|
| | |
|
| | | import lombok.Data;
|
| | | import me.zhengjie.base.BaseDTO;
|
| | | import me.zhengjie.modules.project.domain.ProjectProgress;
|
| | |
|
| | | import java.io.Serializable;
|
| | |
|
| | | /**
|
| | | * @website https://eladmin.vip
|
| | | * @description /
|
| | | * @author HuaZhe
|
| | | * @date 2022-12-23
|
| | | **/
|
| | | @Data
|
| | | public class ProjectProgressDetailDto extends BaseDTO implements Serializable {
|
| | |
|
| | | /** ID */
|
| | | private Long id;
|
| | |
|
| | | /** 用户ID */
|
| | | private Long userId;
|
| | |
|
| | | /** 总分配绩效工时 */
|
| | | private Double timeInitCost;
|
| | |
|
| | | /** 实际消化总工时 */
|
| | | private Double timeTotalCost;
|
| | |
|
| | | /** 当周消化工时 */
|
| | | private Double timeLastCost;
|
| | |
|
| | | /** 实际消耗总成本 */
|
| | | private Double moneyTotalCost;
|
| | |
|
| | | /** 当周消耗成本 */
|
| | | private Double moneyLastCost;
|
| | |
|
| | | /** 上周进度 */
|
| | | private ProjectProgress lastProjectProcess;
|
| | |
|
| | | } |
| | |
| | | */ |
| | | package me.zhengjie.modules.project.service.dto; |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | |
| | | import lombok.Data; |
| | | import me.zhengjie.base.BaseDTO; |
| | | import me.zhengjie.modules.project.domain.ProjectProgress; |
| | |
|
| | | import java.io.Serializable;
|
| | | import java.math.BigDecimal;
|
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | |
| | | /** 总消耗成本 */ |
| | | private BigDecimal moneyTotalCost; |
| | | |
| | | /** 总消耗成本 */
|
| | | private BigDecimal moneyRealCost;
|
| | |
|
| | | /** 上周进度 */ |
| | | private ProjectProgress lastProjectProcess; |
| | | |
| | |
| | | */ |
| | | package me.zhengjie.modules.project.service.impl; |
| | | |
| | | import java.io.IOException; |
| | | import java.math.BigDecimal; |
| | | import java.sql.Timestamp; |
| | | import java.text.ParseException; |
| | | import java.time.DayOfWeek; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.time.ZoneId; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.time.temporal.ChronoUnit; |
| | | import java.util.ArrayList; |
| | | import java.util.Collection; |
| | | import java.util.Collections; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Map.Entry; |
| | | import java.util.Optional; |
| | | import java.util.function.Function; |
| | | import java.util.stream.Collectors; |
| | | import java.util.stream.Stream; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import org.springframework.data.domain.Page; |
| | | import org.springframework.data.domain.Pageable; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import lombok.RequiredArgsConstructor; |
| | | import me.zhengjie.exception.BadRequestException; |
| | | import me.zhengjie.modules.constant.Constant; |
| | |
| | | import me.zhengjie.modules.project.service.dto.ProjectCostQueryCriteria; |
| | | import me.zhengjie.modules.project.service.mapstruct.ProjectCostMapper; |
| | | import me.zhengjie.modules.system.domain.SysConfigHoliday; |
| | | import me.zhengjie.modules.system.domain.SysLevel; |
| | | import me.zhengjie.modules.system.domain.SysUserLevelInsurance; |
| | | import me.zhengjie.modules.system.domain.SysUserLevelWage; |
| | | import me.zhengjie.modules.system.domain.User; |
| | | import me.zhengjie.modules.system.repository.SysConfigHolidayRepository; |
| | | import me.zhengjie.modules.system.repository.SysLevelRepository; |
| | | import me.zhengjie.modules.system.repository.SysUserLevelInsuranceRepository; |
| | | import me.zhengjie.modules.system.repository.SysUserLevelWageRepository; |
| | | import me.zhengjie.modules.system.repository.UserRepository; |
| | | import me.zhengjie.modules.system.service.RoleService; |
| | | import me.zhengjie.modules.system.service.UserService; |
| | | import me.zhengjie.modules.system.service.dto.RoleSmallDto; |
| | | import me.zhengjie.modules.system.service.dto.SysRosteringDto; |
| | | import me.zhengjie.modules.system.service.dto.UserDto; |
| | | import me.zhengjie.utils.FileUtil; |
| | | import me.zhengjie.utils.PageUtil; |
| | | import me.zhengjie.utils.QueryHelp; |
| | | import me.zhengjie.utils.SecurityUtils; |
| | | import me.zhengjie.utils.ValidationUtil; |
| | | import me.zhengjie.modules.treatment.domain.UserInsurance;
|
| | | import me.zhengjie.modules.treatment.domain.UserLevelWage;
|
| | | import me.zhengjie.modules.treatment.repository.UserInsuranceRepository;
|
| | | import me.zhengjie.modules.treatment.repository.UserLevelWageRepository;
|
| | | import me.zhengjie.utils.*;
|
| | | import me.zhengjie.utils.enums.DataScopeEnum; |
| | | import org.springframework.data.domain.Page;
|
| | | import org.springframework.data.domain.Pageable;
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.springframework.transaction.annotation.Transactional;
|
| | |
|
| | | import javax.servlet.http.HttpServletResponse;
|
| | | import java.io.IOException;
|
| | | import java.math.BigDecimal;
|
| | | import java.text.ParseException;
|
| | | import java.time.DayOfWeek;
|
| | | import java.time.LocalDate;
|
| | | import java.time.LocalDateTime;
|
| | | import java.time.ZoneId;
|
| | | import java.time.temporal.ChronoUnit;
|
| | | import java.util.*;
|
| | | import java.util.function.Function;
|
| | | import java.util.stream.Collectors;
|
| | | import java.util.stream.Stream;
|
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | |
| | | private final ProjectCostMapper projectCostMapper; |
| | | private final ProjectRepository projectRepository; |
| | | private final UserRepository userRepository; |
| | | private final SysUserLevelWageRepository sysUserLevelWageRepository; |
| | | private final SysUserLevelInsuranceRepository sysUserLevelInsuranceRepository; |
| | | private final UserLevelWageRepository sysUserLevelWageRepository;
|
| | | private final UserInsuranceRepository sysUserLevelInsuranceRepository;
|
| | | private final SysConfigHolidayRepository sysConfigHolidayRepository; |
| | | private final UserService userService; |
| | | private final RoleService roleService; |
| | |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public BigDecimal calcUserCostByDate(Long userId, Timestamp enterProjectTime, Timestamp exitProjectTime, Map<String, Double> costHoursMap) { |
| | | // 工资 |
| | | BigDecimal wageCost = BigDecimal.valueOf(0); |
| | | // 工作天数 |
| | | LocalDateTime enterProject = enterProjectTime.toLocalDateTime(); |
| | | LocalDateTime exitProject = exitProjectTime.toLocalDateTime(); |
| | | |
| | | // 通过id获取用户级别工资 |
| | | List<SysUserLevelWage> sysUserLevelWages = sysUserLevelWageRepository.findByUserId(userId) |
| | | .stream().filter(sysUserLevelWage -> !((sysUserLevelWage.getEndDate() != null && sysUserLevelWage.getEndDate().before(enterProjectTime)) || sysUserLevelWage.getStartDate().after(exitProjectTime))) |
| | | .collect(Collectors.toList()); |
| | | // 通过id获取用户级别保险 |
| | | List<SysUserLevelInsurance> sysUserLevelInsurances = sysUserLevelInsuranceRepository.findByUserId(userId) |
| | | .stream().filter(sysUserLevelInsurance -> !((sysUserLevelInsurance.getEndDate() != null && sysUserLevelInsurance.getEndDate().before(enterProjectTime)) || sysUserLevelInsurance.getStartDate().after(exitProjectTime))) |
| | | .collect(Collectors.toList()); |
| | | |
| | | // @Override
|
| | | // public BigDecimal calcUserCostByDate(Long userId, Timestamp enterProjectTime, Timestamp exitProjectTime, Map<String, Double> costHoursMap) {
|
| | | // // 工资
|
| | | // BigDecimal wageCost = BigDecimal.valueOf(0);
|
| | | // // 工作天数
|
| | | // LocalDateTime enterProject = enterProjectTime.toLocalDateTime();
|
| | | // LocalDateTime exitProject = exitProjectTime.toLocalDateTime();
|
| | | //
|
| | | //// // 通过id获取用户级别工资
|
| | | //// List<UserLevelWage> sysUserLevelWages = sysUserLevelWageRepository.findUserLevelWageByUserId(userId)
|
| | | //// .stream().filter(sysUserLevelWage -> !((sysUserLevelWage.getYearMonth().getEndDate() != null && sysUserLevelWage.getEndDate().before(enterProjectTime)) || sysUserLevelWage.getStartDate().after(exitProjectTime)))
|
| | | //// .collect(Collectors.toList());
|
| | | //// // 通过id获取用户级别保险
|
| | | //// List<SysUserLevelInsurance> sysUserLevelInsurances = sysUserLevelInsuranceRepository.findByUserId(userId)
|
| | | //// .stream().filter(sysUserLevelInsurance -> !((sysUserLevelInsurance.getEndDate() != null && sysUserLevelInsurance.getEndDate().before(enterProjectTime)) || sysUserLevelInsurance.getStartDate().after(exitProjectTime)))
|
| | | //// .collect(Collectors.toList());
|
| | | //
|
| | | // List<UserLevelWage> userLevelWages = sysUserLevelWageRepository.findUserLevelWageByUserId(userId);
|
| | | // UserInsurance userInsurance = sysUserLevelInsuranceRepository.findbyUserIdAndDate(userId, enterProject.format(DateTimeFormatter.ofPattern("yyyy-MM")));
|
| | | //
|
| | | // // 判断是否有用户级别工资 |
| | | // if(sysUserLevelWages.size() <= 0){ |
| | | // if(userLevelWages.size() == 0){
|
| | | // throw new BadRequestException("此用户暂无级别工资"); |
| | | // } |
| | | // UserLevelWage userLevelWage = userLevelWages.get(0);
|
| | | // // 判断是否有用户级别保险 |
| | | // if(sysUserLevelInsurances.size() <= 0){ |
| | | // if(userInsurance == null){
|
| | | // throw new BadRequestException("此用户暂无级别保险"); |
| | | // } |
| | | //
|
| | | //// Map<Long, Double> sysUserLevelWageHoursMap = new HashMap<Long, Double>();
|
| | | //// for (SysUserLevelWage sysUserLevelWage : sysUserLevelWages) {
|
| | | //// sysUserLevelWageHoursMap.put(sysUserLevelWage.getId(), 0.0);
|
| | | //// }
|
| | | ////
|
| | | //// Map<Long, Double> sysUserLevelInsuranceHoursMap = new HashMap<Long, Double>();
|
| | | //// for (SysUserLevelInsurance sysUserLevelInsurance : sysUserLevelInsurances) {
|
| | | //// sysUserLevelInsuranceHoursMap.put(sysUserLevelInsurance.getId(), 0.0);
|
| | | //// }
|
| | | //
|
| | | //// for (LocalDate currentLocalDate = enterProject.toLocalDate();
|
| | | //// currentLocalDate.isBefore(exitProject.toLocalDate()) || currentLocalDate.isEqual(exitProject.toLocalDate());
|
| | | //// currentLocalDate = currentLocalDate.plusDays(1)) {
|
| | | ////
|
| | | //// String dateStr = currentLocalDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
|
| | | //// if (!costHoursMap.containsKey(dateStr)) {
|
| | | //// continue;
|
| | | //// }
|
| | | ////
|
| | | //// Date currentDate = Date.from(currentLocalDate.atStartOfDay().atZone(ZoneId.systemDefault()).toInstant());
|
| | | ////
|
| | | //// Double costHours = costHoursMap.get(dateStr);
|
| | | ////
|
| | | //// for (SysUserLevelWage sysUserLevelWage : sysUserLevelWages) {
|
| | | //// if (sysUserLevelWage.getEndDate() == null || sysUserLevelWage.getEndDate().after(currentDate) || sysUserLevelWage.getEndDate().equals(currentDate)) {
|
| | | //// sysUserLevelWageHoursMap.put(sysUserLevelWage.getId(), costHours + sysUserLevelWageHoursMap.get(sysUserLevelWage.getId()));
|
| | | //// break;
|
| | | //// }
|
| | | //// }
|
| | | ////
|
| | | //// for (SysUserLevelInsurance sysUserLevelInsurance : sysUserLevelInsurances) {
|
| | | //// if (sysUserLevelInsurance.getEndDate() == null || sysUserLevelInsurance.getEndDate().after(currentDate) || sysUserLevelInsurance.getEndDate().equals(currentDate)) {
|
| | | //// sysUserLevelInsuranceHoursMap.put(sysUserLevelInsurance.getId(), costHours + sysUserLevelInsuranceHoursMap.get(sysUserLevelInsurance.getId()));
|
| | | //// break;
|
| | | //// }
|
| | | //// }
|
| | | //// }
|
| | | //
|
| | | // for (Entry<Long, Double> entry : sysUserLevelWageHoursMap.entrySet()) {
|
| | | // SysUserLevelWage sysLevel = sysUserLevelWageRepository.findById(entry.getKey()).orElseGet(SysUserLevelWage::new);
|
| | | // wageCost = wageCost.add(sysLevel.getLevelWage().multiply(BigDecimal.valueOf(entry.getValue())).divide(BigDecimal.valueOf(160), 2, BigDecimal.ROUND_CEILING));
|
| | | // }
|
| | | //
|
| | | // for (Entry<Long, Double> entry : sysUserLevelInsuranceHoursMap.entrySet()) {
|
| | | // SysUserLevelInsurance sysLevel = sysUserLevelInsuranceRepository.findById(entry.getKey()).orElseGet(SysUserLevelInsurance::new);
|
| | | //
|
| | | // BigDecimal accumulationRadix = sysLevel.getAccumulationRadix().multiply(BigDecimal.valueOf(sysLevel.getAccumulationCompanyProportion() / 100));
|
| | | // BigDecimal pensionRadix = sysLevel.getPensionRadix().multiply(BigDecimal.valueOf(sysLevel.getPensionCompanyProportion() / 100));
|
| | | // BigDecimal medicalRadix = sysLevel.getMedicalRadix().multiply(BigDecimal.valueOf(sysLevel.getMedicalCompanyProportion() / 100));
|
| | | // BigDecimal unemploymentRadix = sysLevel.getUnemploymentRadix().multiply(BigDecimal.valueOf(sysLevel.getUnemploymentCompanyProportion() / 100));
|
| | | // BigDecimal maternityRadix = sysLevel.getMaternityRadix().multiply(BigDecimal.valueOf(sysLevel.getMaternityCompanyProportion() / 100));
|
| | | // BigDecimal industrialInjuryRadix = sysLevel.getIndustrialInjuryRadix().multiply(BigDecimal.valueOf(sysLevel.getIndustrialInjuryCompanyProportion() / 100));
|
| | | //
|
| | | // wageCost = wageCost.add(accumulationRadix.add(pensionRadix).add(medicalRadix).add(unemploymentRadix).add(maternityRadix).add(industrialInjuryRadix).multiply(BigDecimal.valueOf(entry.getValue())).divide(BigDecimal.valueOf(160), 2, BigDecimal.ROUND_CEILING));
|
| | | // }
|
| | | //
|
| | | // return wageCost;
|
| | | // }
|
| | | |
| | | Map<Long, Double> sysUserLevelWageHoursMap = new HashMap<Long, Double>(); |
| | | for (SysUserLevelWage sysUserLevelWage : sysUserLevelWages) { |
| | | sysUserLevelWageHoursMap.put(sysUserLevelWage.getId(), 0.0); |
| | | @Override
|
| | | public BigDecimal calcUserCostByHours(Long userId, Double timeTotalCost) {
|
| | | // 工资
|
| | | BigDecimal wageCost = BigDecimal.valueOf(0);
|
| | |
|
| | | // 通过id获取用户级别工资
|
| | | List<UserLevelWage> sysUserLevelWages = sysUserLevelWageRepository.findUserLevelWageByUserId(userId);
|
| | | if (sysUserLevelWages.size() == 0) {
|
| | | return BigDecimal.ZERO;
|
| | | }
|
| | | // 通过id获取用户级别保险
|
| | | List<UserInsurance> sysUserLevelInsurances = sysUserLevelInsuranceRepository.findByUserId(userId);
|
| | | if (sysUserLevelInsurances.size() == 0) {
|
| | | return BigDecimal.ZERO;
|
| | | } |
| | | |
| | | Map<Long, Double> sysUserLevelInsuranceHoursMap = new HashMap<Long, Double>(); |
| | | for (SysUserLevelInsurance sysUserLevelInsurance : sysUserLevelInsurances) { |
| | | sysUserLevelInsuranceHoursMap.put(sysUserLevelInsurance.getId(), 0.0); |
| | | } |
| | | // 工资
|
| | | UserLevelWage sysUserLevelWage = sysUserLevelWages.get(sysUserLevelWages.size() - 1);
|
| | | wageCost = wageCost.add(sysUserLevelWage.getBasicWage().add(sysUserLevelWage.getRankWage()).add(sysUserLevelWage.getPerformanceWage()).multiply(BigDecimal.valueOf(timeTotalCost)).divide(BigDecimal.valueOf(160), 2, BigDecimal.ROUND_CEILING));
|
| | | |
| | | for (LocalDate currentLocalDate = enterProject.toLocalDate(); |
| | | currentLocalDate.isBefore(exitProject.toLocalDate()) || currentLocalDate.isEqual(exitProject.toLocalDate()); |
| | | currentLocalDate = currentLocalDate.plusDays(1)) { |
| | | // 五险一金
|
| | | UserInsurance sysUserLevelInsurance = sysUserLevelInsurances.get(sysUserLevelInsurances.size() - 1);
|
| | | BigDecimal accumulationRadix = sysUserLevelInsurance.getAccumulationFund().multiply(BigDecimal.valueOf(sysUserLevelInsurance.getAccumulationFundCompany() / 100));
|
| | | BigDecimal pensionRadix = sysUserLevelInsurance.getRetirementInsurance().multiply(BigDecimal.valueOf(sysUserLevelInsurance.getRetirementInsuranceCompany() / 100));
|
| | | BigDecimal medicalRadix = sysUserLevelInsurance.getMedicalInsurance().multiply(BigDecimal.valueOf(sysUserLevelInsurance.getMedicalInsuranceCompany() / 100));
|
| | | BigDecimal unemploymentRadix = sysUserLevelInsurance.getUnemploymentInsurance().multiply(BigDecimal.valueOf(sysUserLevelInsurance.getUnemploymentInsuranceCompany() / 100));
|
| | | BigDecimal maternityRadix = sysUserLevelInsurance.getBirthInsurance().multiply(BigDecimal.valueOf(sysUserLevelInsurance.getBirthInsuranceCompany() / 100));
|
| | | BigDecimal industrialInjuryRadix = sysUserLevelInsurance.getEmploymentInsurance().multiply(BigDecimal.valueOf(sysUserLevelInsurance.getEmploymentInsuranceCompany() / 100));
|
| | | |
| | | String dateStr = currentLocalDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")); |
| | | if (!costHoursMap.containsKey(dateStr)) { |
| | | continue; |
| | | } |
| | | |
| | | Date currentDate = Date.from(currentLocalDate.atStartOfDay().atZone(ZoneId.systemDefault()).toInstant()); |
| | | |
| | | Double costHours = costHoursMap.get(dateStr); |
| | | |
| | | for (SysUserLevelWage sysUserLevelWage : sysUserLevelWages) { |
| | | if (sysUserLevelWage.getEndDate() == null || sysUserLevelWage.getEndDate().after(currentDate) || sysUserLevelWage.getEndDate().equals(currentDate)) { |
| | | sysUserLevelWageHoursMap.put(sysUserLevelWage.getId(), costHours + sysUserLevelWageHoursMap.get(sysUserLevelWage.getId())); |
| | | break; |
| | | } |
| | | } |
| | | |
| | | for (SysUserLevelInsurance sysUserLevelInsurance : sysUserLevelInsurances) { |
| | | if (sysUserLevelInsurance.getEndDate() == null || sysUserLevelInsurance.getEndDate().after(currentDate) || sysUserLevelInsurance.getEndDate().equals(currentDate)) { |
| | | sysUserLevelInsuranceHoursMap.put(sysUserLevelInsurance.getId(), costHours + sysUserLevelInsuranceHoursMap.get(sysUserLevelInsurance.getId())); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | |
| | | for (Entry<Long, Double> entry : sysUserLevelWageHoursMap.entrySet()) { |
| | | SysUserLevelWage sysLevel = sysUserLevelWageRepository.findById(entry.getKey()).orElseGet(SysUserLevelWage::new); |
| | | wageCost = wageCost.add(sysLevel.getLevelWage().multiply(BigDecimal.valueOf(entry.getValue())).divide(BigDecimal.valueOf(160), 2, BigDecimal.ROUND_CEILING)); |
| | | } |
| | | |
| | | for (Entry<Long, Double> entry : sysUserLevelInsuranceHoursMap.entrySet()) { |
| | | SysUserLevelInsurance sysLevel = sysUserLevelInsuranceRepository.findById(entry.getKey()).orElseGet(SysUserLevelInsurance::new); |
| | | |
| | | BigDecimal accumulationRadix = sysLevel.getAccumulationRadix().multiply(BigDecimal.valueOf(sysLevel.getAccumulationCompanyProportion() / 100)); |
| | | BigDecimal pensionRadix = sysLevel.getPensionRadix().multiply(BigDecimal.valueOf(sysLevel.getPensionCompanyProportion() / 100)); |
| | | BigDecimal medicalRadix = sysLevel.getMedicalRadix().multiply(BigDecimal.valueOf(sysLevel.getMedicalCompanyProportion() / 100)); |
| | | BigDecimal unemploymentRadix = sysLevel.getUnemploymentRadix().multiply(BigDecimal.valueOf(sysLevel.getUnemploymentCompanyProportion() / 100)); |
| | | BigDecimal maternityRadix = sysLevel.getMaternityRadix().multiply(BigDecimal.valueOf(sysLevel.getMaternityCompanyProportion() / 100)); |
| | | BigDecimal industrialInjuryRadix = sysLevel.getIndustrialInjuryRadix().multiply(BigDecimal.valueOf(sysLevel.getIndustrialInjuryCompanyProportion() / 100)); |
| | | |
| | | wageCost = wageCost.add(accumulationRadix.add(pensionRadix).add(medicalRadix).add(unemploymentRadix).add(maternityRadix).add(industrialInjuryRadix).multiply(BigDecimal.valueOf(entry.getValue())).divide(BigDecimal.valueOf(160), 2, BigDecimal.ROUND_CEILING)); |
| | | } |
| | | wageCost = wageCost.add(accumulationRadix.add(pensionRadix).add(medicalRadix).add(unemploymentRadix).add(maternityRadix).add(industrialInjuryRadix).multiply(BigDecimal.valueOf(timeTotalCost)).divide(BigDecimal.valueOf(160), 2, BigDecimal.ROUND_CEILING));
|
| | | |
| | | return wageCost; |
| | | } |
| | |
| | | if ("".equals(dateType)) { |
| | | dateType = currentLocalDate.getDayOfWeek() == DayOfWeek.SATURDAY || currentLocalDate.getDayOfWeek() == DayOfWeek.SUNDAY ? Constant.DATE_TYPE_WEEKEND : Constant.DATE_TYPE_WEEKDAY; |
| | | } |
| | | if (Constant.DATE_TYPE_WEEKEND.equals(dateType) || Constant.DATE_TYPE_LEGAL_HOLIDAYS.equals(dateType)) { |
| | | if (Constant.DATE_TYPE_WEEKEND.equals(dateType) || Constant.DATE_TYPE_LEGAL_HOLIDAYS.equals(dateType) || Constant.DATE_TYPE_HOLIDAYS.equals(dateType)) {
|
| | | continue; |
| | | } |
| | | |
| | |
| | | if (exitProject.toLocalTime().compareTo(sysRostering.getLunchStartTime()) > 0) { |
| | | exitProject = exitProject.with(sysRostering.getLunchStartTime()); |
| | | } |
| | | costHours = costHours + sysRostering.getWorkStartTime().until(exitProject.toLocalTime(), ChronoUnit.HOURS); |
| | | costHours = costHours + BigDecimal.valueOf(sysRostering.getWorkStartTime().until(exitProject.toLocalTime(), ChronoUnit.MINUTES)).divide(BigDecimal.valueOf(60), 2, BigDecimal.ROUND_CEILING).doubleValue();
|
| | | } else if (exitProject.toLocalTime().compareTo(sysRostering.getLunchEndTime()) > 0 && exitProject.toLocalTime().compareTo(sysRostering.getWorkEndTime()) < 0) { |
| | | costHours = costHours + sysRostering.getWorkStartTime().until(sysRostering.getLunchStartTime(), ChronoUnit.HOURS) + sysRostering.getLunchEndTime().until(exitProject.toLocalTime(), ChronoUnit.HOURS); |
| | | costHours = costHours + BigDecimal.valueOf(sysRostering.getWorkStartTime().until(sysRostering.getLunchStartTime(), ChronoUnit.MINUTES) + sysRostering.getLunchEndTime().until(exitProject.toLocalTime(), ChronoUnit.MINUTES)).divide(BigDecimal.valueOf(60), 2, BigDecimal.ROUND_CEILING).doubleValue();
|
| | | } else if (exitProject.toLocalTime().compareTo(sysRostering.getWorkEndTime()) >= 0) { |
| | | costHours = costHours + sysRostering.getLunchEndTime().until(sysRostering.getWorkEndTime(), ChronoUnit.HOURS) + sysRostering.getWorkStartTime().until(sysRostering.getLunchStartTime(), ChronoUnit.HOURS); |
| | | costHours = costHours + BigDecimal.valueOf(sysRostering.getLunchEndTime().until(sysRostering.getWorkEndTime(), ChronoUnit.MINUTES) + sysRostering.getWorkStartTime().until(sysRostering.getLunchStartTime(), ChronoUnit.MINUTES)).divide(BigDecimal.valueOf(60), 2, BigDecimal.ROUND_CEILING).doubleValue();
|
| | | } |
| | | } else if (currentLocalDate.isEqual(enterProject.toLocalDate())) { |
| | | if (enterProject.toLocalTime().compareTo(sysRostering.getWorkStartTime()) <= 0) { |
| | | costHours = costHours + sysRostering.getLunchEndTime().until(sysRostering.getWorkEndTime(), ChronoUnit.HOURS) + sysRostering.getWorkStartTime().until(sysRostering.getLunchStartTime(), ChronoUnit.HOURS); |
| | | costHours = costHours + BigDecimal.valueOf(sysRostering.getLunchEndTime().until(sysRostering.getWorkEndTime(), ChronoUnit.MINUTES) + sysRostering.getWorkStartTime().until(sysRostering.getLunchStartTime(), ChronoUnit.MINUTES)).divide(BigDecimal.valueOf(60), 2, BigDecimal.ROUND_CEILING).doubleValue();
|
| | | } else if (enterProject.toLocalTime().compareTo(sysRostering.getWorkStartTime()) > 0 && enterProject.toLocalTime().compareTo(sysRostering.getLunchStartTime()) <= 0) { |
| | | costHours = costHours + sysRostering.getLunchEndTime().until(sysRostering.getWorkEndTime(), ChronoUnit.HOURS) + enterProject.toLocalTime().until(sysRostering.getLunchStartTime(), ChronoUnit.HOURS); |
| | | costHours = costHours + BigDecimal.valueOf(sysRostering.getLunchEndTime().until(sysRostering.getWorkEndTime(), ChronoUnit.MINUTES) + enterProject.toLocalTime().until(sysRostering.getLunchStartTime(), ChronoUnit.MINUTES)).divide(BigDecimal.valueOf(60), 2, BigDecimal.ROUND_CEILING).doubleValue();
|
| | | } else if (enterProject.toLocalTime().compareTo(sysRostering.getLunchStartTime()) > 0 && enterProject.toLocalTime().compareTo(sysRostering.getWorkEndTime()) < 0) { |
| | | if (enterProject.toLocalTime().compareTo(sysRostering.getLunchEndTime()) < 0) { |
| | | enterProject = enterProject.with(sysRostering.getLunchEndTime()); |
| | | } |
| | | costHours = costHours + enterProject.toLocalTime().until(sysRostering.getWorkEndTime(), ChronoUnit.HOURS); |
| | | costHours = costHours + BigDecimal.valueOf(enterProject.toLocalTime().until(sysRostering.getWorkEndTime(), ChronoUnit.MINUTES)).divide(BigDecimal.valueOf(60), 2, BigDecimal.ROUND_CEILING).doubleValue();
|
| | | } |
| | | } else { |
| | | costHours = costHours + sysRostering.getLunchEndTime().until(sysRostering.getWorkEndTime(), ChronoUnit.HOURS) + sysRostering.getWorkStartTime().until(sysRostering.getLunchStartTime(), ChronoUnit.HOURS); |
| | | costHours = costHours + BigDecimal.valueOf(sysRostering.getLunchEndTime().until(sysRostering.getWorkEndTime(), ChronoUnit.MINUTES) + sysRostering.getWorkStartTime().until(sysRostering.getLunchStartTime(), ChronoUnit.MINUTES)).divide(BigDecimal.valueOf(60), 2, BigDecimal.ROUND_CEILING).doubleValue();
|
| | | } |
| | | } |
| | | return costHours; |
| | |
| | | |
| | | // 通过id获取用户信息 |
| | | UserDto user = userService.findById(criteria.getUserId()); |
| | | // 通过id获取用户级别工资 |
| | | Optional<SysUserLevelWage> sysUserLevelWageOpl = sysUserLevelWageRepository.findByUserId(criteria.getUserId()) |
| | | .stream().filter(sysUserLevelWage -> !((sysUserLevelWage.getEndDate() != null && sysUserLevelWage.getEndDate().before(startDate)) || sysUserLevelWage.getStartDate().after(endDate))) |
| | | .max((o1, o2) -> o1.getStartDate().compareTo(o2.getStartDate())); |
| | | // 通过id获取用户级别保险 |
| | | Optional<SysUserLevelInsurance> sysUserLevelInsuranceOpl = sysUserLevelInsuranceRepository.findByUserId(criteria.getUserId()) |
| | | .stream().filter(sysUserLevelInsurance -> !((sysUserLevelInsurance.getEndDate() != null && sysUserLevelInsurance.getEndDate().before(startDate)) || sysUserLevelInsurance.getStartDate().after(endDate))) |
| | | .max((o1, o2) -> o1.getStartDate().compareTo(o2.getStartDate())); |
| | | // // 通过id获取用户级别工资
|
| | | // Optional<SysUserLevelWage> sysUserLevelWageOpl = sysUserLevelWageRepository.findByUserId(criteria.getUserId())
|
| | | // .stream().filter(sysUserLevelWage -> !((sysUserLevelWage.getEndDate() != null && sysUserLevelWage.getEndDate().before(startDate)) || sysUserLevelWage.getStartDate().after(endDate)))
|
| | | // .max((o1, o2) -> o1.getStartDate().compareTo(o2.getStartDate()));
|
| | | // // 通过id获取用户级别保险
|
| | | // Optional<SysUserLevelInsurance> sysUserLevelInsuranceOpl = sysUserLevelInsuranceRepository.findByUserId(criteria.getUserId())
|
| | | // .stream().filter(sysUserLevelInsurance -> !((sysUserLevelInsurance.getEndDate() != null && sysUserLevelInsurance.getEndDate().before(startDate)) || sysUserLevelInsurance.getStartDate().after(endDate)))
|
| | | // .max((o1, o2) -> o1.getStartDate().compareTo(o2.getStartDate()));
|
| | |
|
| | | List<UserLevelWage> userLevelWageList = sysUserLevelWageRepository.findUserLevelWageByUserId(criteria.getUserId());
|
| | | List<UserInsurance> userInsurances = sysUserLevelInsuranceRepository.findByUserId(criteria.getUserId());
|
| | |
|
| | | |
| | | // 判断是否有用户级别工资 |
| | | if (!sysUserLevelWageOpl.isPresent()) { |
| | | if (userLevelWageList.size() == 0) {
|
| | | throw new BadRequestException("此用户暂无级别工资"); |
| | | } |
| | | // 判断是否有用户级别保险 |
| | | if (!sysUserLevelInsuranceOpl.isPresent()) { |
| | | if (userInsurances.size() == 0) {
|
| | | throw new BadRequestException("此用户暂无级别保险"); |
| | | } |
| | | |
| | |
| | | if ("".equals(dateType)) { |
| | | dateType = currentLocalDate.getDayOfWeek() == DayOfWeek.SATURDAY || currentLocalDate.getDayOfWeek() == DayOfWeek.SUNDAY ? Constant.DATE_TYPE_WEEKEND : Constant.DATE_TYPE_WEEKDAY; |
| | | } |
| | | if (Constant.DATE_TYPE_WEEKEND.equals(dateType) || Constant.DATE_TYPE_LEGAL_HOLIDAYS.equals(dateType)) { |
| | | if (Constant.DATE_TYPE_WEEKEND.equals(dateType) || Constant.DATE_TYPE_LEGAL_HOLIDAYS.equals(dateType) || Constant.DATE_TYPE_HOLIDAYS.equals(dateType)) {
|
| | | continue; |
| | | } |
| | | |
| | |
| | | if (exitProject.toLocalTime().compareTo(sysRostering.getLunchStartTime()) > 0) { |
| | | exitProject = exitProject.with(sysRostering.getLunchStartTime()); |
| | | } |
| | | costHours = costHours + sysRostering.getWorkStartTime().until(exitProject.toLocalTime(), ChronoUnit.HOURS); |
| | | costHours = costHours + BigDecimal.valueOf(sysRostering.getWorkStartTime().until(exitProject.toLocalTime(), ChronoUnit.MINUTES)).divide(BigDecimal.valueOf(60), 2, BigDecimal.ROUND_CEILING).doubleValue();
|
| | | } else if (exitProject.toLocalTime().compareTo(sysRostering.getLunchEndTime()) > 0 && exitProject.toLocalTime().compareTo(sysRostering.getWorkEndTime()) < 0) { |
| | | costHours = costHours + sysRostering.getWorkStartTime().until(sysRostering.getLunchStartTime(), ChronoUnit.HOURS) + sysRostering.getLunchEndTime().until(exitProject.toLocalTime(), ChronoUnit.HOURS); |
| | | costHours = costHours + BigDecimal.valueOf(sysRostering.getWorkStartTime().until(sysRostering.getLunchStartTime(), ChronoUnit.MINUTES) + sysRostering.getLunchEndTime().until(exitProject.toLocalTime(), ChronoUnit.MINUTES)).divide(BigDecimal.valueOf(60), 2, BigDecimal.ROUND_CEILING).doubleValue();
|
| | | } else if (exitProject.toLocalTime().compareTo(sysRostering.getWorkEndTime()) >= 0) { |
| | | costHours = costHours + sysRostering.getLunchEndTime().until(sysRostering.getWorkEndTime(), ChronoUnit.HOURS) + sysRostering.getWorkStartTime().until(sysRostering.getLunchStartTime(), ChronoUnit.HOURS); |
| | | costHours = costHours + BigDecimal.valueOf(sysRostering.getLunchEndTime().until(sysRostering.getWorkEndTime(), ChronoUnit.MINUTES) + sysRostering.getWorkStartTime().until(sysRostering.getLunchStartTime(), ChronoUnit.MINUTES)).divide(BigDecimal.valueOf(60), 2, BigDecimal.ROUND_CEILING).doubleValue();
|
| | | } |
| | | } else if (currentLocalDate.isEqual(enterProject.toLocalDate())) { |
| | | if (enterProject.toLocalTime().compareTo(sysRostering.getWorkStartTime()) <= 0) { |
| | | costHours = costHours + sysRostering.getLunchEndTime().until(sysRostering.getWorkEndTime(), ChronoUnit.HOURS) + sysRostering.getWorkStartTime().until(sysRostering.getLunchStartTime(), ChronoUnit.HOURS); |
| | | costHours = costHours + BigDecimal.valueOf(sysRostering.getLunchEndTime().until(sysRostering.getWorkEndTime(), ChronoUnit.MINUTES) + sysRostering.getWorkStartTime().until(sysRostering.getLunchStartTime(), ChronoUnit.MINUTES)).divide(BigDecimal.valueOf(60), 2, BigDecimal.ROUND_CEILING).doubleValue();
|
| | | } else if (enterProject.toLocalTime().compareTo(sysRostering.getWorkStartTime()) > 0 && enterProject.toLocalTime().compareTo(sysRostering.getLunchStartTime()) <= 0) { |
| | | costHours = costHours + sysRostering.getLunchEndTime().until(sysRostering.getWorkEndTime(), ChronoUnit.HOURS) + enterProject.toLocalTime().until(sysRostering.getLunchStartTime(), ChronoUnit.HOURS); |
| | | costHours = costHours + BigDecimal.valueOf(sysRostering.getLunchEndTime().until(sysRostering.getWorkEndTime(), ChronoUnit.MINUTES) + enterProject.toLocalTime().until(sysRostering.getLunchStartTime(), ChronoUnit.MINUTES)).divide(BigDecimal.valueOf(60), 2, BigDecimal.ROUND_CEILING).doubleValue();
|
| | | } else if (enterProject.toLocalTime().compareTo(sysRostering.getLunchStartTime()) > 0 && enterProject.toLocalTime().compareTo(sysRostering.getWorkEndTime()) < 0) { |
| | | if (enterProject.toLocalTime().compareTo(sysRostering.getLunchEndTime()) < 0) { |
| | | enterProject = enterProject.with(sysRostering.getLunchEndTime()); |
| | | } |
| | | costHours = costHours + enterProject.toLocalTime().until(sysRostering.getWorkEndTime(), ChronoUnit.HOURS); |
| | | costHours = costHours + BigDecimal.valueOf(enterProject.toLocalTime().until(sysRostering.getWorkEndTime(), ChronoUnit.MINUTES)).divide(BigDecimal.valueOf(60), 2, BigDecimal.ROUND_CEILING).doubleValue();
|
| | | } |
| | | } else { |
| | | costHours = costHours + sysRostering.getLunchEndTime().until(sysRostering.getWorkEndTime(), ChronoUnit.HOURS) + sysRostering.getWorkStartTime().until(sysRostering.getLunchStartTime(), ChronoUnit.HOURS); |
| | | costHours = costHours + BigDecimal.valueOf(sysRostering.getLunchEndTime().until(sysRostering.getWorkEndTime(), ChronoUnit.MINUTES) + sysRostering.getWorkStartTime().until(sysRostering.getLunchStartTime(), ChronoUnit.MINUTES)).divide(BigDecimal.valueOf(60), 2, BigDecimal.ROUND_CEILING).doubleValue();
|
| | | } |
| | | } |
| | | } else { |
| | |
| | | projectCost.setInvolvementHours(BigDecimal.valueOf(costHours)); |
| | | |
| | | // 用户级别工资成本 |
| | | SysLevel sysLevelWage = sysLevelRepository.findById(sysUserLevelWageOpl.get().getLevelId()).orElseGet(SysLevel::new); |
| | | wageCost = wageCost.add(sysLevelWage.getLevelWage().multiply(BigDecimal.valueOf(costHours)).divide(BigDecimal.valueOf(160), 2, BigDecimal.ROUND_CEILING)); |
| | | wageCost = wageCost.add(userLevelWageList.get(0).getBasicWage())
|
| | | .add(userLevelWageList.get(0).getRankWage())
|
| | | .add(userLevelWageList.get(0).getPerformanceWage())
|
| | | .multiply(BigDecimal.valueOf(costHours))
|
| | | .divide(BigDecimal.valueOf(160), 2, BigDecimal.ROUND_CEILING);
|
| | | |
| | | // 用户级别保险成本 |
| | | SysLevel sysLevelInsurance = sysLevelRepository.findById(sysUserLevelInsuranceOpl.get().getLevelId()).orElseGet(SysLevel::new); |
| | | UserInsurance sysLevelInsurance = userInsurances.stream().max(Comparator.comparing(UserInsurance::getYearMonth)).orElseGet(UserInsurance::new);
|
| | | |
| | | BigDecimal accumulationRadix = sysLevelInsurance.getAccumulationRadix().multiply(BigDecimal.valueOf(sysLevelInsurance.getAccumulationCompanyProportion() / 100)); |
| | | BigDecimal pensionRadix = sysLevelInsurance.getPensionRadix().multiply(BigDecimal.valueOf(sysLevelInsurance.getPensionCompanyProportion() / 100)); |
| | | BigDecimal medicalRadix = sysLevelInsurance.getMedicalRadix().multiply(BigDecimal.valueOf(sysLevelInsurance.getMedicalCompanyProportion() / 100)); |
| | | BigDecimal unemploymentRadix = sysLevelInsurance.getUnemploymentRadix().multiply(BigDecimal.valueOf(sysLevelInsurance.getUnemploymentCompanyProportion() / 100)); |
| | | BigDecimal maternityRadix = sysLevelInsurance.getMaternityRadix().multiply(BigDecimal.valueOf(sysLevelInsurance.getMaternityCompanyProportion() / 100)); |
| | | BigDecimal industrialInjuryRadix = sysLevelInsurance.getIndustrialInjuryRadix().multiply(BigDecimal.valueOf(sysLevelInsurance.getIndustrialInjuryCompanyProportion() / 100)); |
| | |
|
| | | BigDecimal accumulationRadix = sysLevelInsurance.getAccumulationFund().multiply(BigDecimal.valueOf(sysLevelInsurance.getAccumulationFundCompany() / 100));
|
| | | BigDecimal pensionRadix = sysLevelInsurance.getRetirementInsurance().multiply(BigDecimal.valueOf(sysLevelInsurance.getRetirementInsuranceCompany() / 100));
|
| | | BigDecimal medicalRadix = sysLevelInsurance.getMedicalInsurance().multiply(BigDecimal.valueOf(sysLevelInsurance.getMedicalInsuranceCompany() / 100));
|
| | | BigDecimal unemploymentRadix = sysLevelInsurance.getUnemploymentInsurance().multiply(BigDecimal.valueOf(sysLevelInsurance.getUnemploymentInsuranceCompany() / 100));
|
| | | BigDecimal maternityRadix = sysLevelInsurance.getBirthInsurance().multiply(BigDecimal.valueOf(sysLevelInsurance.getBirthInsuranceCompany() / 100));
|
| | | BigDecimal industrialInjuryRadix = sysLevelInsurance.getEmploymentInsurance().multiply(BigDecimal.valueOf(sysLevelInsurance.getEmploymentInsuranceCompany() / 100));
|
| | | |
| | | wageCost = wageCost.add(accumulationRadix.add(pensionRadix).add(medicalRadix).add(unemploymentRadix).add(maternityRadix).add(industrialInjuryRadix).multiply(BigDecimal.valueOf(costHours)).divide(BigDecimal.valueOf(160), 2, BigDecimal.ROUND_CEILING)); |
| | | |
| | |
| | | */ |
| | | package me.zhengjie.modules.project.service.impl; |
| | | |
| | | import java.io.IOException; |
| | | import java.math.BigDecimal; |
| | | import java.sql.Timestamp; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.DayOfWeek; |
| | | import java.time.LocalDate; |
| | | import java.time.temporal.WeekFields; |
| | | import java.util.ArrayList; |
| | | import java.util.Comparator; |
| | | import java.util.HashMap; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Optional; |
| | | import java.util.Map.Entry; |
| | | import java.util.function.Function; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import org.springframework.data.domain.Page; |
| | | import org.springframework.data.domain.Pageable; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import lombok.RequiredArgsConstructor; |
| | | import me.zhengjie.exception.BadRequestException; |
| | | import me.zhengjie.modules.constant.Constant; |
| | | import me.zhengjie.modules.project.domain.Project; |
| | | import me.zhengjie.modules.project.domain.ProjectProgress; |
| | | import me.zhengjie.modules.project.domain.ProjectProgressDetail;
|
| | | import me.zhengjie.modules.project.repository.ProjectProgressRepository; |
| | | import me.zhengjie.modules.project.repository.ProjectRepository; |
| | | import me.zhengjie.modules.project.service.ProjectCostService; |
| | |
| | | import me.zhengjie.modules.project.service.dto.ProjectProgressQueryCriteria; |
| | | import me.zhengjie.modules.project.service.mapstruct.ProjectProgressMapper; |
| | | import me.zhengjie.modules.system.repository.DictDetailRepository; |
| | | import me.zhengjie.modules.task.domain.Task; |
| | | import me.zhengjie.modules.task.domain.TaskDailyInterface; |
| | | import me.zhengjie.modules.task.domain.TaskDaliy; |
| | | import me.zhengjie.modules.task.domain.TaskInterface; |
| | | import me.zhengjie.modules.task.domain.TaskMongo;
|
| | | import me.zhengjie.modules.task.domain.TaskUserMongo;
|
| | | import me.zhengjie.modules.task.repository.TaskDaliyRepository; |
| | | import me.zhengjie.modules.task.repository.TaskRepository; |
| | | import me.zhengjie.utils.FileUtil; |
| | | import me.zhengjie.utils.PageUtil; |
| | | import me.zhengjie.utils.QueryHelp; |
| | | import me.zhengjie.utils.ValidationUtil; |
| | | import org.springframework.data.domain.Page;
|
| | | import org.springframework.data.domain.Pageable;
|
| | | import org.springframework.data.mongodb.core.MongoTemplate;
|
| | | import org.springframework.data.mongodb.core.aggregation.Aggregation;
|
| | | import org.springframework.data.mongodb.core.aggregation.AggregationResults;
|
| | | import org.springframework.data.mongodb.core.query.Criteria;
|
| | | import org.springframework.data.mongodb.core.query.Query;
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.springframework.transaction.annotation.Transactional;
|
| | |
|
| | | import javax.servlet.http.HttpServletResponse;
|
| | | import java.io.IOException;
|
| | | import java.math.BigDecimal;
|
| | | import java.math.RoundingMode;
|
| | | import java.sql.Timestamp;
|
| | | import java.time.DayOfWeek;
|
| | | import java.time.LocalDate;
|
| | | import java.time.temporal.WeekFields;
|
| | | import java.util.*;
|
| | | import java.util.function.Function;
|
| | | import java.util.stream.Collectors;
|
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | |
| | | private final TaskRepository taskRepository; |
| | | private final TaskDaliyRepository taskDaliyRepository; |
| | | private final ProjectCostService projectCostService; |
| | | private final MongoTemplate mongoTemplate;
|
| | | |
| | | @Override |
| | | public Map<String,Object> queryAll(ProjectProgressQueryCriteria criteria, Pageable pageable){ |
| | |
| | | |
| | | private ProjectProgressDto generalProjectProgress(ProjectProgress resources) { |
| | | |
| | | // 总消化工时 |
| | | // Double timeTotalCost = 0.0; |
| | | // 总消耗工作量 |
| | | Double workTotalCost = 0.0; |
| | | // 真实时长 |
| | | Double realLastCost = 0.0; |
| | | List<TaskDailyInterface> taskDaliyWithTaskList = taskDaliyRepository.collectByProjectIdAndFillDateLessThanGroupByTaskIdJoinTask(resources.getProject().getId(), resources.getBelongDate()); // TODO error |
| | | Query query = new Query(Criteria.where("projectId").is(resources.getProject().getId()));
|
| | | List<TaskMongo> taskMongoList = mongoTemplate.find(query, TaskMongo.class);
|
| | | |
| | | for (TaskDailyInterface taskDaily : taskDaliyWithTaskList) { |
| | | // 总消化工时 |
| | | // timeTotalCost += BigDecimal.valueOf(taskDaily.getPlanHours()).multiply(BigDecimal.valueOf(taskDaily.getTaskProgress())).divide(BigDecimal.valueOf(100), 2, BigDecimal.ROUND_CEILING).doubleValue(); |
| | | // 总消耗工作量 |
| | | workTotalCost += taskDaily.getConsumedWorkload(); |
| | | // 真实时长 |
| | | realLastCost += taskDaily.getConsumedHours(); |
| | | } |
| | | // 总消化工时 |
| | | // resources.setTimeTotalCost(timeTotalCost); |
| | | // 总消耗工作量 |
| | | resources.setWorkTotalCost(workTotalCost); |
| | | // 真实时长 |
| | | resources.setRealLastCost(realLastCost); |
| | | Aggregation customerAgg = Aggregation.newAggregation(
|
| | | Aggregation.match(Criteria.where("task").in(taskMongoList)),
|
| | | Aggregation.project("userId", "taskHours", "costHours"),
|
| | | Aggregation.group("userId").sum("taskHours").as("taskHours").sum("costHours").as("costHours")
|
| | | );
|
| | | |
| | | if (resources.getId() == null) { |
| | | // 根据项目ID取得任务信息 |
| | | TaskInterface taskTotal = taskRepository.collectByProjectId(resources.getProject().getId()); |
| | | // 总工时 |
| | | resources.setTimeTotalInit(taskTotal.getPlanHours()); |
| | | // 总工作量 |
| | | resources.setWorkTotalInit(taskTotal.getPlanWorkload()); |
| | | AggregationResults<Map> aggregate = mongoTemplate.aggregate(customerAgg, TaskUserMongo.class, Map.class);
|
| | | List<ProjectProgressDetail> projectProgressDetailList = aggregate.getMappedResults().stream().filter(data -> data.get("_id") != null).map(data -> {
|
| | | ProjectProgressDetail projectProgressDetail = new ProjectProgressDetail();
|
| | | projectProgressDetail.setUserId(Long.parseLong(String.valueOf(data.get("_id"))));
|
| | | BigDecimal taskHours = new BigDecimal(String.valueOf(data.get("taskHours")));
|
| | | projectProgressDetail.setTimeInitCost(taskHours.setScale(2, RoundingMode.HALF_UP).doubleValue());
|
| | | BigDecimal costHours = new BigDecimal(String.valueOf(data.get("costHours")));
|
| | | projectProgressDetail.setTimeTotalCost(costHours.setScale(2, RoundingMode.HALF_UP).doubleValue());
|
| | |
|
| | | BigDecimal moneyTotalCost = projectCostService.calcUserCostByHours(projectProgressDetail.getUserId(), projectProgressDetail.getTimeTotalCost());
|
| | | projectProgressDetail.setMoneyTotalCost(moneyTotalCost);
|
| | |
|
| | | return projectProgressDetail;
|
| | | }).collect(Collectors.toList());
|
| | |
|
| | | // 任务总时间
|
| | | resources.setTimeTotalInit(projectProgressDetailList.stream().mapToDouble(ProjectProgressDetail::getTimeInitCost).sum());
|
| | | // 消耗总时间
|
| | | resources.setTimeTotalCost(projectProgressDetailList.stream().mapToDouble(ProjectProgressDetail::getTimeTotalCost).sum());
|
| | |
|
| | | // 计划总成本 |
| | | resources.setMoneyTotalInit(resources.getProject().getPerformancePrice().multiply(BigDecimal.valueOf(taskTotal.getPlanHours())).divide(BigDecimal.valueOf(160))); |
| | | } |
| | | |
| | | // 根据日期和项目ID取得日报信息 |
| | | List<TaskDailyInterface> taskDaliyList = taskDaliyRepository.collectByProjectIdAndFillDateLessThanGroupByUserIdAndFillDate(resources.getProject().getId(), resources.getBelongDate()); |
| | | Map<Long, List<TaskDailyInterface>> collectMap = taskDaliyList.stream().collect(Collectors.groupingBy(TaskDailyInterface::getUserId)); |
| | | |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| | | resources.setMoneyTotalInit(resources.getProject().getProjectPrice().multiply(BigDecimal.valueOf(10000)));
|
| | | // 已分配总成本
|
| | | resources.setMoneyTotalCost(BigDecimal.valueOf(resources.getTimeTotalCost()).multiply(BigDecimal.valueOf(11250)).divide(BigDecimal.valueOf(160), 2, RoundingMode.HALF_UP));
|
| | | // 总消耗成本 |
| | | BigDecimal totalCost = BigDecimal.valueOf(0.0); |
| | | for (Entry<Long, List<TaskDailyInterface>> entry : collectMap.entrySet()) { |
| | | List<TaskDailyInterface> taskDaliyListSub = entry.getValue(); |
| | | // 最小日期 |
| | | TaskDailyInterface taskDaliyFirst = taskDaliyListSub.stream().min(Comparator.comparing(taskDaliy -> taskDaliy.getFillDate())).get(); |
| | | // 最大日期 |
| | | TaskDailyInterface taskDaliyLast = taskDaliyListSub.stream().max(Comparator.comparing(taskDaliy -> taskDaliy.getFillDate())).get(); |
| | | Map<String, Double> costHourMap = new HashMap<String, Double>(); |
| | | taskDaliyListSub.forEach(taskDaliy -> { |
| | | costHourMap.put(sdf.format(taskDaliy.getFillDate()), taskDaliy.getConsumedHours()); |
| | | }); |
| | | // 根据员工成本单金算出当前工作的成本 |
| | | totalCost = totalCost.add(projectCostService.calcUserCostByDate(entry.getKey(), new Timestamp(taskDaliyFirst.getFillDate().getTime()), new Timestamp(taskDaliyLast.getFillDate().getTime()), costHourMap)); |
| | | } |
| | | resources.setMoneyRealCost(projectProgressDetailList.stream().map(ProjectProgressDetail::getMoneyTotalCost).reduce(BigDecimal.ZERO, BigDecimal::add).setScale(2, RoundingMode.HALF_UP));
|
| | | |
| | | // 总消耗成本 |
| | | resources.setMoneyTotalCost(totalCost); |
| | | ProjectProgressDto projectProgressDto = projectProgressMapper.toDto(projectProgressRepository.save(resources));
|
| | | |
| | | return projectProgressMapper.toDto(projectProgressRepository.save(resources)); |
| | | return projectProgressDto;
|
| | | } |
| | | |
| | | @Override |
| | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode;
|
| | | import java.sql.Timestamp; |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | |
| | | projectDto.setActualTaskTime(taskInterface.getPlanHours()); |
| | | |
| | | // 根据日期和项目ID取得日报信息 |
| | | List<TaskDailyInterface> taskDailyInterfaceList = taskDaliyRepository.collectByProjectIdGroupByUserIdAndFillDate(project.getId()); |
| | | Map<Long, List<TaskDailyInterface>> collectMap = taskDailyInterfaceList.stream().collect(Collectors.groupingBy(TaskDailyInterface::getUserId)); |
| | | Query query = new Query(Criteria.where("projectId").is(project.getId()));
|
| | | List<TaskMongo> taskMongoList = mongoTemplate.find(query, TaskMongo.class);
|
| | | |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| | | // 实际消耗成本 |
| | | BigDecimal actualCost = BigDecimal.valueOf(0.0); |
| | | for (Entry<Long, List<TaskDailyInterface>> entry : collectMap.entrySet()) { |
| | | List<TaskDailyInterface> taskDaliyListSub = entry.getValue(); |
| | | // 最小日期 |
| | | TaskDailyInterface taskDaliyFirst = taskDaliyListSub.stream().min(Comparator.comparing(taskDaliy -> taskDaliy.getFillDate())).get(); |
| | | // 最大日期 |
| | | TaskDailyInterface taskDaliyLast = taskDaliyListSub.stream().max(Comparator.comparing(taskDaliy -> taskDaliy.getFillDate())).get(); |
| | | Map<String, Double> costHourMap = new HashMap<String, Double>(); |
| | | taskDaliyListSub.forEach(taskDaliy -> { |
| | | costHourMap.put(sdf.format(taskDaliy.getFillDate()), taskDaliy.getConsumedHours()); |
| | | }); |
| | | // 根据员工成本单金算出当前工作的成本 |
| | | actualCost = actualCost.add(projectCostService.calcUserCostByDate(entry.getKey(), new Timestamp(taskDaliyFirst.getFillDate().getTime()), new Timestamp(taskDaliyLast.getFillDate().getTime()), costHourMap)); |
| | | } |
| | | Aggregation customerAgg = Aggregation.newAggregation(
|
| | | Aggregation.match(Criteria.where("task").in(taskMongoList)),
|
| | | Aggregation.project("userId", "taskHours", "costHours"),
|
| | | Aggregation.group("userId").sum("taskHours").as("taskHours").sum("costHours").as("costHours")
|
| | | );
|
| | |
|
| | | AggregationResults<Map> aggregate = mongoTemplate.aggregate(customerAgg, TaskUserMongo.class, Map.class);
|
| | | BigDecimal actualCost =aggregate.getMappedResults().stream().filter(data -> data.get("_id") != null).map(data -> {
|
| | | BigDecimal moneyTotalCost = projectCostService.calcUserCostByHours(Long.parseLong(String.valueOf(data.get("_id"))), Double.valueOf(String.valueOf(data.get("costHours"))));
|
| | | return moneyTotalCost;
|
| | | }).reduce(BigDecimal.ZERO, BigDecimal::add);
|
| | |
|
| | | // 实际消耗成本 |
| | | projectDto.setActualLaborCost(actualCost); |
| | | // 项目二次处理 |
| | |
| | | } else if (sysConfigHoliday != null && sysConfigHoliday.getDateType().equals(Constant.DATE_TYPE_LEGAL_HOLIDAYS)) { |
| | | // 考勤记录:日期类型-节假日 |
| | | attendance.setDateType(Constant.DATE_TYPE_LEGAL_HOLIDAYS); |
| | | } else if (sysConfigHoliday != null && sysConfigHoliday.getDateType().equals(Constant.DATE_TYPE_HOLIDAYS)) {
|
| | | // 考勤记录:日期类型-法定节假日
|
| | | attendance.setDateType(Constant.DATE_TYPE_HOLIDAYS);
|
| | | } else { |
| | | // 考勤记录:日期类型-工作日 |
| | | attendance.setDateType(Constant.DATE_TYPE_WEEKDAY); |
| | |
| | | // 考勤记录:根据用户和日期查询 |
| | | Attendance attendance = attendanceRepository.findAllByUserIdAndAttendanceDate(user.getId(), strAttendDate); |
| | | // 如果是周六或者周日或节假日,打卡状态为等待的话,就改状态为休息(oapiDingTalkRecordResultList为空的情况下) |
| | | if (ObjectUtils.isNotEmpty(attendance) && (calAttendDate.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY || calAttendDate.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY || attendance.getDateType().equals(Constant.DATE_TYPE_LEGAL_HOLIDAYS))) { |
| | | if (ObjectUtils.isNotEmpty(attendance) && (calAttendDate.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY || calAttendDate.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY || attendance.getDateType().equals(Constant.DATE_TYPE_LEGAL_HOLIDAYS) || attendance.getDateType().equals(Constant.DATE_TYPE_HOLIDAYS))) {
|
| | | // 开始打卡结果 |
| | | if(attendance.getStartClockResults().equals(Constant.ATTENDANCE_STATE_WAITFOR)){ |
| | | attendance.setStartClockResults(Constant.ATTENDANCE_STATE_REST); |
| | |
| | | // 考勤记录:根据用户和日期查询 |
| | | Attendance attendance = attendanceRepository.findAllByUserIdAndAttendanceDate(user.getId(), strAttendDate); |
| | | // 如果是周六或者周日或节假日,打卡状态为等待的话,就改状态为休息(oapiDingTalkRecordResultList为空的情况下) |
| | | if (ObjectUtils.isNotEmpty(attendance) && (calAttendDate.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY || calAttendDate.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY || attendance.getDateType().equals(Constant.DATE_TYPE_LEGAL_HOLIDAYS))) { |
| | | if (ObjectUtils.isNotEmpty(attendance) && (calAttendDate.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY || calAttendDate.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY || attendance.getDateType().equals(Constant.DATE_TYPE_LEGAL_HOLIDAYS) || attendance.getDateType().equals(Constant.DATE_TYPE_HOLIDAYS))) {
|
| | | // 开始打卡结果 |
| | | if(attendance.getStartClockResults().equals(Constant.ATTENDANCE_STATE_WAITFOR)){ |
| | | attendance.setStartClockResults(Constant.ATTENDANCE_STATE_REST); |
| | |
| | | } |
| | | } |
| | | }else{ |
| | | // 查询考勤外出表
|
| | | List<AttendanceGoOut> attendanceGoOutList = attendanceGoOutRepository.findByUserAndDate(user.getId(),attendance.getRosteringWorkStartTime().toLocalDateTime(),attendance.getRosteringWorkEndTime().toLocalDateTime());
|
| | | for(AttendanceGoOut attendanceGoOut : attendanceGoOutList){
|
| | | // attendDate不等于null 说明是考勤信息按钮
|
| | | if(ObjectUtils.isNotEmpty(attendDate)){
|
| | | // 上午时长、下午时长
|
| | | leaveStartDuration += getStartDuration(attendanceGoOut.getOutStartTime(),attendanceGoOut.getOutEndTime(),attendance);
|
| | | leaveEndDuration += getEndDuration(attendanceGoOut.getOutStartTime(),attendanceGoOut.getOutEndTime(),attendance);
|
| | | }else{
|
| | | // 上午or下午总时长
|
| | | leaveDuration += getDuration(attendanceGoOut.getOutStartTime(),attendanceGoOut.getOutEndTime(),attendance,day);
|
| | | }
|
| | | }
|
| | | for(AttendanceLeave attendanceLeave : attendanceLeaveList){ |
| | | // attendDate不等于null 说明是考勤信息按钮 |
| | | if(ObjectUtils.isNotEmpty(attendDate)){ |
| | |
| | | String approveStatus = newSalaryDto.getApproveStatus() != null ? dictDetailRepository.findByDictNameAndValue(Constant.APPROVE_STATUS, newSalaryDto.getApproveStatus()).getLabel() : ""; |
| | | Map<String, Object> map = new LinkedHashMap<>(); |
| | | map.put("员工姓名", userNickName); |
| | | map.put("工资年月", newSalaryDto.getSalaryYearMonth()); |
| | | map.put("工资年月", newSalaryDto.getSalaryYearMonth().toLocalDateTime().format(DateTimeFormatter.ofPattern("yyyy-MM")));
|
| | | map.put("基本工资", newSalaryDto.getBasicWage()); |
| | | map.put("全勤小时数", newSalaryDto.getFullDays()); |
| | | map.put("缺勤小时数", newSalaryDto.getAbsenceDays()); |
| | | map.put("实际基础工资", newSalaryDto.getActualBasicWage()); |
| | | map.put("其他补助", newSalaryDto.getTravelAllowance()); |
| | | map.put("其他补助", newSalaryDto.getTravelAllowance().add(newSalaryDto.getOvertimeAllowance()));
|
| | | // map.put("绩效工资", newSalaryDto.getAchievementsWage()); |
| | | // map.put("应完成绩效工时", newSalaryDto.getNeedCompletedAchievementsHours()); |
| | | // map.put("已完成绩效工时", newSalaryDto.getAlreadyCompletedAchievementsHours()); |
| | |
| | | try { |
| | | // 获取出差补助 |
| | | newSalary = getUserBussSubsidy(userId, targetYearMonth, newSalary); |
| | | // // 获取加班补助工资 |
| | | // // 获取加班补助工资 旧加班暂时废止
|
| | | // newSalary = getUserOverTimeSubsidy(userId, targetYearMonth, newSalary); |
| | | // 获取用户级别工资 |
| | | newSalary = getUserLevelWage(userId, targetYearMonth, newSalary, errors); |
| | |
| | | // newSalary = getUserLevelOther(userId, targetYearMonth, newSalary); |
| | | // 获取工作天数 |
| | | newSalary = getWorkDays(targetYearMonth, newSalary); |
| | |
|
| | | // 平日加班费(含3倍工资)
|
| | | newSalary = getNormalOverTimeWage(userId, targetYearMonth, newSalary);
|
| | | |
| | | // 获取出勤小时数 |
| | | newSalary = getAttendanceHours(userId, targetYearMonth, newSalary); |
| | |
| | | } else { |
| | | newSalaryRepository.save(newSalary); |
| | | } |
| | | // create(newSalary); |
| | | // try { |
| | | // 保存 |
| | | }
|
| | | |
| | | // create(newSalary); |
| | | // } catch (Exception e) { |
| | | // // 删除 |
| | | // deleteByUserIdAndSalaryYearMonthAndCreateNew(newSalary); |
| | | // } |
| | | // 获取平日加班费
|
| | | private NewSalary getNormalOverTimeWage(Long userId, String targetYearMonth, NewSalary newSalary) throws ParseException {
|
| | | // 考勤查询类
|
| | | AttendanceQueryCriteria attendanceQueryCriteria = new AttendanceQueryCriteria();
|
| | | attendanceQueryCriteria.setUserId(userId);
|
| | | attendanceQueryCriteria.setTargetYearMonth(targetYearMonth);
|
| | | // 查询某月平日加班小时数
|
| | | Double attendanceHours = attendanceService.queryAttendanceOverTimeHours(attendanceQueryCriteria);
|
| | | // 查询某月节假日加班小时数
|
| | | Double attendanceHolidayHours = attendanceService.queryAttendanceHolidaysOverTimeHours(attendanceQueryCriteria);
|
| | |
|
| | | UserLevelWageQueryCriteria criteria = new UserLevelWageQueryCriteria();
|
| | | criteria.setUserId(userId);
|
| | | criteria.setTargetYearMonth(targetYearMonth);
|
| | | UserLevelWageDto userLevelWageDto = userLevelWageService.queryTargetYearMonth(criteria);
|
| | | // 平日加班费
|
| | | if (userLevelWageDto.getOverTimeWage() != null) {
|
| | | // System.out.println("用户" + userId + "的级别工资中平日加班时间" + attendanceHours + "小时,配置加班费用为:" + userLevelWageDto.getOverTimeWage() + "元/小时!");
|
| | | newSalary.setOvertimeAllowance(userLevelWageDto.getOverTimeWage().multiply(BigDecimal.valueOf(attendanceHours)));
|
| | | // System.out.println(newSalary.getOvertimeAllowance() + "元");
|
| | | } else {
|
| | | newSalary.setOvertimeAllowance(newSalary.getBasicWage().multiply(BigDecimal.valueOf(attendanceHours)).divide(BigDecimal.valueOf(newSalary.getFullDays()), 2, RoundingMode.HALF_UP));
|
| | | }
|
| | | // 节假日加班费
|
| | | newSalary.setOvertimeAllowance(newSalary.getOvertimeAllowance().add(newSalary.getBasicWage().multiply(BigDecimal.valueOf(attendanceHolidayHours)).multiply(BigDecimal.valueOf(3)).divide(BigDecimal.valueOf(21.75), 2, RoundingMode.HALF_UP)));
|
| | | // 税前工资累计
|
| | | newSalary.setPreTaxAmount(newSalary.getPreTaxAmount().add(newSalary.getOvertimeAllowance()));
|
| | | // 返回
|
| | | return newSalary;
|
| | | } |
| | | |
| | | // 获取用户级别工资 |
| | |
| | | UserDto userDto = userService.findById(userId); |
| | | LocalDate createDate = userDto.getCreateTime().toLocalDateTime().toLocalDate(); |
| | | if (userDto.getInternshipTime() != null) { |
| | | LocalDate localDate1 = createDate.plusMonths(userDto.getInternshipTime()); |
| | | LocalDate localDate1 = createDate.plusMonths(userDto.getInternshipTime()).withDayOfMonth(1);
|
| | | LocalDate localDate2 = LocalDate.parse(targetYearMonth, DateTimeFormatter.ofPattern("yyyy-MM-dd")); |
| | | if (!localDate2.isAfter(localDate1)) { |
| | | if (localDate1.isAfter(localDate2)) {
|
| | | coefficient = 0.8; |
| | | } |
| | | } |
| | |
| | | return newSalary; |
| | | } |
| | | |
| | | // 获取加班补助工资 |
| | | private NewSalary getUserOverTimeSubsidy(Long userId, String targetYearMonth, NewSalary newSalary) throws ParseException { |
| | | // 用户级别工资检索类 |
| | | UserLevelWageQueryCriteria userLevelWageQueryCriteria = new UserLevelWageQueryCriteria(); |
| | | userLevelWageQueryCriteria.setUserId(userId); |
| | | userLevelWageQueryCriteria.setTargetYearMonth(targetYearMonth + " 00:00:00"); |
| | | // 获取加班补助金额 |
| | | Double overTimeMoney = userLevelWageService.queryOverTimeAllowance(userLevelWageQueryCriteria); |
| | | // 设置加班补助的金额 |
| | | newSalary.setOvertimeAllowance(new BigDecimal(overTimeMoney)); |
| | | return newSalary; |
| | | } |
| | | // // 获取加班补助工资
|
| | | // private NewSalary getUserOverTimeSubsidy(Long userId, String targetYearMonth, NewSalary newSalary) throws ParseException {
|
| | | // // 用户级别工资检索类
|
| | | // UserLevelWageQueryCriteria userLevelWageQueryCriteria = new UserLevelWageQueryCriteria();
|
| | | // userLevelWageQueryCriteria.setUserId(userId);
|
| | | // userLevelWageQueryCriteria.setTargetYearMonth(targetYearMonth + " 00:00:00");
|
| | | // // 获取加班补助金额
|
| | | // Double overTimeMoney = userLevelWageService.queryOverTimeAllowance(userLevelWageQueryCriteria);
|
| | | // // 设置加班补助的金额
|
| | | // newSalary.setOvertimeAllowance(new BigDecimal(overTimeMoney));
|
| | | // return newSalary;
|
| | | // }
|
| | | |
| | | // 获取用户级别保险 |
| | | private NewSalary getUserLevelInsurance(Long userId, String targetYearMonth, NewSalary newSalary) throws ParseException { |
| | |
| | | UserDto userDto = userService.findById(userId); |
| | | LocalDate createDate = userDto.getCreateTime().toLocalDateTime().toLocalDate(); |
| | | if (userDto.getInternshipTime() != null) { |
| | | LocalDate localDate1 = createDate.plusMonths(userDto.getInternshipTime()); |
| | | LocalDate localDate1 = createDate.plusMonths(userDto.getInternshipTime()).withDayOfMonth(1);
|
| | | LocalDate localDate2 = LocalDate.parse(targetYearMonth, DateTimeFormatter.ofPattern("yyyy-MM-dd")); |
| | | if (localDate1.isAfter(localDate2)) { |
| | | // 税前工资累计 |
| | |
| | | @GeneratedValue(strategy = GenerationType.IDENTITY) |
| | | private Long id; |
| | | |
| | | @OneToMany(mappedBy = "dict",cascade={CascadeType.PERSIST,CascadeType.REMOVE}) |
| | | @OneToMany(mappedBy = "dict", fetch = FetchType.EAGER, cascade={CascadeType.PERSIST,CascadeType.REMOVE})
|
| | | private List<DictDetail> dictDetails; |
| | | |
| | | @NotBlank |
| | |
| | | */ |
| | | public interface DictRepository extends JpaRepository<Dict, Long>, JpaSpecificationExecutor<Dict> { |
| | | |
| | | Dict findByName(String name);
|
| | |
|
| | | /** |
| | | * 删除 |
| | | * @param ids / |
| | |
| | | } |
| | | // 临时旧用户级别ID |
| | | Long tempOldLevelId = user.getLevelId(); |
| | | ; |
| | | user.setUsername(resources.getUsername()); |
| | | user.setEmail(resources.getEmail()); |
| | | user.setEnabled(resources.getEnabled()); |
| | |
| | | int shouldWordDays = 0; |
| | | List<SysConfigHoliday> holidayConfigurationList = sysConfigHolidayRepository.findAll(); |
| | | for (SysConfigHoliday holidayConfiguration : holidayConfigurationList) { |
| | | if (holidayConfiguration.getDateType().equals(Constant.DATE_TYPE_LEGAL_HOLIDAYS)) { |
| | | if (holidayConfiguration.getDateType().equals(Constant.DATE_TYPE_LEGAL_HOLIDAYS)
|
| | | || holidayConfiguration.getDateType().equals(Constant.DATE_TYPE_HOLIDAYS)) {
|
| | | holiday.add(sdf.format(holidayConfiguration.getHolidayDate())); |
| | | } |
| | | } |
| | |
| | | |
| | | List<TaskDaliyMongo> daliyMongoList = mongoTemplate.find( |
| | | Query.query( |
| | | new Criteria("userId").is(SecurityUtils.getCurrentUserId()) |
| | | new Criteria("userId").is(userId)
|
| | | .and("fillDate") |
| | | .gte(new SimpleDateFormat("yyyy-MM-dd").parse(startTime)) |
| | | .lte(new SimpleDateFormat("yyyy-MM-dd").parse(endTime))) |
| | |
| | | List<TaskDaliyMongo> taskDaliyMongoSm = null; |
| | | try { |
| | | taskDaliyMongoSm = mongoTemplate.find( |
| | | Query.query(new Criteria("userId").is(SecurityUtils.getCurrentUserId()) |
| | | Query.query(new Criteria("userId").is(userId)
|
| | | .and("taskUserMongo").is(taskDaliyMongo.getTaskUserMongo()) |
| | | .and("fillDate").lt(new SimpleDateFormat("yyyy-MM-dd").parse(startTime))) |
| | | .with(Sort.by(Sort.Direction.DESC, "fillDate")), TaskDaliyMongo.class); |
| | |
| | | } |
| | | //跨月 |
| | | if (taskDaliyMongoSm.size() > 0) { |
| | | Double performanceHours = taskDaliyMongoSm.get(0).getPerformanceHours();
|
| | | if (performanceHours == null) {
|
| | | performanceHours = taskDaliyMongoSm.get(0).getTaskUserMongo().getPerformanceHours();
|
| | | }
|
| | | BigDecimal lastValue = BigDecimal.valueOf(taskDaliyMongoSm.get(0).getTaskProgress()) |
| | | .multiply(BigDecimal.valueOf(taskDaliyMongoSm.get(0).getTaskUserMongo().getPerformanceHours())) |
| | | .multiply(BigDecimal.valueOf(performanceHours))
|
| | | .divide(BigDecimal.valueOf(100), 2, RoundingMode.HALF_UP); |
| | | taskDaliyMongo.setConsumedHours(BigDecimal.valueOf(taskDaliyMongo.getConsumedHours()).subtract(lastValue).doubleValue()); |
| | | } |
| | |
| | | @ApiModelProperty(value = "员工ID") |
| | | private Long userId; |
| | | |
| | | private String userName;
|
| | |
|
| | | private Long old_task_id; |
| | | |
| | | @ApiModelProperty(value = "填写日期") |
| | |
| | | @ApiModelProperty(value = "优先度") |
| | | private String priority; |
| | | |
| | | private String uid;
|
| | |
|
| | | //private List<TaskDaliyMongo> taskDaliyList = new LinkedList<TaskDaliyMongo>(); |
| | | |
| | | @ApiModelProperty(value = "任务工时") |
| | |
| | | @GetMapping(value = "/download") |
| | | @PreAuthorize("@el.check('task:download')") |
| | | public void exportTask(HttpServletResponse response, TaskQueryCriteria criteria) throws IOException { |
| | | // taskService.download(taskService.queryAll(criteria), response); |
| | | taskService.download(taskService.queryAll(criteria), response);
|
| | | } |
| | | |
| | | @GetMapping |
| | |
| | | return new ResponseEntity<>(taskService.getTastAllById(taskId),HttpStatus.OK); |
| | | } |
| | | |
| | | @GetMapping("/getTasts") |
| | | @Log("根据任务名字查询任务") |
| | | public ResponseEntity<Object> getTasts(String taskName){ |
| | | return new ResponseEntity<>(taskService.getTastByName(taskName),HttpStatus.OK); |
| | | } |
| | | // @GetMapping("/getTasts")
|
| | | // @Log("根据任务名字查询任务")
|
| | | // public ResponseEntity<Object> getTasts(String taskName){
|
| | | // return new ResponseEntity<>(taskService.getTastByName(taskName),HttpStatus.OK);
|
| | | // }
|
| | | } |
| | |
| | | * @param criteria 条件参数 |
| | | * @return List<TaskDto> |
| | | */ |
| | | List<TaskMongo> queryAll(TaskQueryCriteria criteria); |
| | | List<TaskMongoDto> queryAll(TaskQueryCriteria criteria);
|
| | | |
| | | /** |
| | | * 任务二次处理 |
| | |
| | | * @param response / |
| | | * @throws IOException / |
| | | */ |
| | | void download(List<TaskDto> all, HttpServletResponse response) throws IOException; |
| | | void download(List<TaskMongoDto> all, HttpServletResponse response) throws IOException;
|
| | | |
| | | // /** |
| | | // * 查询所有参与的数据不分页 |
| | |
| | | /** 优先度 */ |
| | | private String priority; |
| | | |
| | | private String uid;
|
| | |
|
| | | private List<TaskDaliyMongo> taskDaliyList = new LinkedList<TaskDaliyMongo>(); |
| | | |
| | | /** 任务工时 */ |
| | |
| | | */ |
| | | package me.zhengjie.modules.task.service.impl; |
| | | |
| | | import java.io.IOException; |
| | | import java.math.BigDecimal; |
| | | import java.math.MathContext; |
| | | import java.math.RoundingMode; |
| | | import java.text.DecimalFormat; |
| | | import java.time.Instant; |
| | | import java.util.*; |
| | | import java.util.concurrent.atomic.AtomicReference; |
| | | import java.util.regex.Pattern; |
| | | import java.util.stream.Collectors; |
| | | import java.util.stream.Stream; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import lombok.RequiredArgsConstructor;
|
| | | import me.zhengjie.modules.constant.Constant;
|
| | | import me.zhengjie.modules.project.domain.Project;
|
| | | import me.zhengjie.modules.project.repository.ProjectRepository;
|
| | | import me.zhengjie.modules.project.service.ProjectService;
|
| | | import me.zhengjie.modules.project.service.dto.ProjectDto;
|
| | | import me.zhengjie.modules.project.service.dto.ProjectQueryCriteria;
|
| | | import me.zhengjie.modules.system.domain.DictDetail;
|
| | | import me.zhengjie.modules.system.domain.User;
|
| | | import me.zhengjie.modules.system.repository.DictDetailRepository;
|
| | | import me.zhengjie.modules.system.repository.UserRepository;
|
| | | import me.zhengjie.modules.system.service.RoleService;
|
| | | import me.zhengjie.modules.system.service.dto.DictDetailQueryCriteria;
|
| | | import me.zhengjie.modules.system.service.dto.RoleSmallDto;
|
| | | import me.zhengjie.modules.task.domain.*;
|
| | | import me.zhengjie.modules.task.repository.TaskDaliyRepository;
|
| | | import me.zhengjie.modules.task.repository.TaskRepository;
|
| | | import me.zhengjie.modules.task.repository.TaskUserRepository;
|
| | | import me.zhengjie.modules.task.service.TaskService;
|
| | | import me.zhengjie.modules.task.service.dto.TaskDto;
|
| | | import me.zhengjie.modules.task.service.dto.TaskMongoDto;
|
| | | import me.zhengjie.modules.task.service.dto.TaskQueryCriteria;
|
| | | import me.zhengjie.modules.task.service.dto.TaskUserMongoDto; |
| | | import me.zhengjie.modules.task.service.mapstruct.TaskMapper;
|
| | | import me.zhengjie.modules.treatment.repository.UserLevelWageRepository; |
| | | import org.bson.types.ObjectId; |
| | | import me.zhengjie.utils.*;
|
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.cache.annotation.CacheConfig; |
| | | import org.springframework.cache.annotation.CacheEvict; |
| | | import org.springframework.cache.annotation.Cacheable; |
| | | import org.springframework.data.domain.Page; |
| | | import org.springframework.data.domain.Pageable; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import lombok.RequiredArgsConstructor; |
| | | import me.zhengjie.exception.BadRequestException; |
| | | import me.zhengjie.modules.constant.Constant; |
| | | import me.zhengjie.modules.project.domain.Project; |
| | | import me.zhengjie.modules.project.repository.ProjectRepository; |
| | | import me.zhengjie.modules.project.service.ProjectService; |
| | | import me.zhengjie.modules.project.service.dto.ProjectDto; |
| | | import me.zhengjie.modules.project.service.dto.ProjectQueryCriteria; |
| | | import me.zhengjie.modules.system.domain.DictDetail; |
| | | import me.zhengjie.modules.system.repository.DictDetailRepository; |
| | | import me.zhengjie.modules.system.service.RoleService; |
| | | import me.zhengjie.modules.system.service.dto.DictDetailQueryCriteria; |
| | | import me.zhengjie.modules.system.service.dto.RoleSmallDto; |
| | | import me.zhengjie.modules.task.domain.Task; |
| | | import me.zhengjie.modules.task.domain.TaskAggrMongo; |
| | | import me.zhengjie.modules.task.domain.TaskDaliy; |
| | | import me.zhengjie.modules.task.domain.TaskDaliyMongo; |
| | | import me.zhengjie.modules.task.domain.TaskMongo; |
| | | import me.zhengjie.modules.task.domain.TaskUser; |
| | | import me.zhengjie.modules.task.domain.TaskUserMongo; |
| | | import me.zhengjie.modules.task.repository.TaskDaliyRepository; |
| | | import me.zhengjie.modules.task.repository.TaskRepository; |
| | | import me.zhengjie.modules.task.repository.TaskUserRepository; |
| | | import me.zhengjie.modules.task.service.TaskService; |
| | | import me.zhengjie.modules.task.service.dto.TaskDto; |
| | | import me.zhengjie.modules.task.service.dto.TaskMongoDto; |
| | | import me.zhengjie.modules.task.service.dto.TaskQueryCriteria; |
| | | import me.zhengjie.modules.task.service.mapstruct.TaskMapper; |
| | | import me.zhengjie.utils.FileUtil; |
| | | import me.zhengjie.utils.PageUtil; |
| | | import me.zhengjie.utils.QueryHelp; |
| | | import me.zhengjie.utils.SecurityUtils; |
| | | import me.zhengjie.utils.ValidationUtil; |
| | | import javax.servlet.http.HttpServletResponse;
|
| | | import java.io.IOException;
|
| | | import java.math.BigDecimal;
|
| | | import java.math.MathContext;
|
| | | import java.math.RoundingMode;
|
| | | import java.util.*;
|
| | | import java.util.concurrent.atomic.AtomicReference;
|
| | | import java.util.regex.Pattern;
|
| | | import java.util.stream.Collectors;
|
| | | import java.util.stream.Stream;
|
| | | |
| | | /** |
| | | * @author 赵士淞 |
| | |
| | | private final DictDetailRepository dictDetailRepository; |
| | | private final TaskUserRepository taskUserRepository; |
| | | private final TaskDaliyRepository taskDaliyRepository; |
| | | private final UserRepository userRepository;
|
| | | private final RoleService roleService; |
| | | private final UserLevelWageRepository userLevelWageRepository; |
| | | @Autowired |
| | |
| | | taskUserMongoDtoList.add(dto); |
| | | } else { |
| | | //如果有日志 |
| | | daliyMongoList.sort(((o1, o2) -> (int) (o2.getTaskProgress() - o1.getTaskProgress()))); |
| | | daliyMongoList.sort(((o1, o2) -> (int) (100 * (o2.getTaskProgress() - o1.getTaskProgress()))));
|
| | | dto.setMaxTaskProgress(daliyMongoList.get(0).getTaskProgress()); |
| | | dto.setAlreadyConsumedHours(consumptionHours.get()); |
| | | taskUserMongoDtoList.add(dto); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<TaskMongo> queryAll(TaskQueryCriteria criteria) { |
| | | public List<TaskMongoDto> queryAll(TaskQueryCriteria criteria) {
|
| | | |
| | | // 获取登录用户角色等级 |
| | | List<Integer> levels = roleService.findByUsersId(SecurityUtils.getCurrentUserId()).stream().map(RoleSmallDto::getLevel).collect(Collectors.toList()); |
| | | // 登录用户最大角色等级 |
| | | int min = Collections.min(levels); |
| | | // 判断角色等级 |
| | | if (min == Constant.ROLE_LEVEL_MANAGER || min == Constant.ROLE_LEVEL_LEADER || min == Constant.ROLE_LEVEL_ORDINARY) { |
| | | // // 根据用户ID查询参与的项目ID |
| | | // List<Long> taskUserProjectIdList = taskUserRepository.findProjectIdByUserId(SecurityUtils.getCurrentUserId()); |
| | | // 根据用户ID查询负责的项目ID |
| | | List<Long> projectIdList = projectRepository.findIdByLiableUserId(SecurityUtils.getCurrentUserId()); |
| | | // 检索条件 |
| | | List<Long> totalProjectIdList = Stream.of(projectIdList).flatMap(Collection::stream).distinct().collect(Collectors.toList()); |
| | | if (totalProjectIdList.size() == 0) { |
| | | return Collections.emptyList(); |
| | | } |
| | | criteria.setProjectIdInList(totalProjectIdList); |
| | | } |
| | | // // 获取登录用户角色等级
|
| | | // List<Integer> levels = roleService.findByUsersId(SecurityUtils.getCurrentUserId()).stream().map(RoleSmallDto::getLevel).collect(Collectors.toList());
|
| | | // // 登录用户最大角色等级
|
| | | // int min = Collections.min(levels);
|
| | | // // 判断角色等级
|
| | | // if (min == Constant.ROLE_LEVEL_MANAGER || min == Constant.ROLE_LEVEL_LEADER || min == Constant.ROLE_LEVEL_ORDINARY) {
|
| | | //// // 根据用户ID查询参与的项目ID
|
| | | //// List<Long> taskUserProjectIdList = taskUserRepository.findProjectIdByUserId(SecurityUtils.getCurrentUserId());
|
| | | // // 根据用户ID查询负责的项目ID
|
| | | // List<Long> projectIdList = projectRepository.findIdByLiableUserId(SecurityUtils.getCurrentUserId());
|
| | | // // 检索条件
|
| | | // List<Long> totalProjectIdList = Stream.of(projectIdList).flatMap(Collection::stream).distinct().collect(Collectors.toList());
|
| | | // if (totalProjectIdList.size() == 0) {
|
| | | // return Collections.emptyList();
|
| | | // }
|
| | | // criteria.setProjectIdInList(totalProjectIdList);
|
| | | // }
|
| | | //
|
| | | // Criteria criteriaMongo = new Criteria();
|
| | | // if (criteria.getProjectId() != null) {
|
| | | // criteriaMongo = criteriaMongo.and("projectId").is(criteria.getProjectId());
|
| | | // } else if (criteria.getProjectIdInList() != null) {
|
| | | // criteriaMongo = criteriaMongo.and("projectId").in(criteria.getProjectIdInList().toArray());
|
| | | // }
|
| | | // if (criteria.getName() != null) {
|
| | | //// criteriaMongo = criteriaMongo.and("parent").exists(false);
|
| | | //// } else {
|
| | | // criteriaMongo = criteriaMongo.and("name").regex(Pattern.compile("^.*" + criteria.getName() + ".*$", Pattern.CASE_INSENSITIVE));
|
| | | // }
|
| | | // Query query = new Query(criteriaMongo);
|
| | | // Long totalCount = mongoTemplate.count(query, TaskMongo.class);
|
| | | // if (totalCount == 0) {
|
| | | // return Collections.emptyList();
|
| | | // }
|
| | | // List<TaskMongo> taskMongoList = mongoTemplate.find(query, TaskMongo.class);
|
| | | // return taskMongoList;
|
| | | |
| | | Criteria criteriaMongo = new Criteria(); |
| | | if (criteria.getProjectId() != null) { |
| | | criteriaMongo = criteriaMongo.and("projectId").is(criteria.getProjectId()); |
| | | } else if (criteria.getProjectIdInList() != null) { |
| | | criteriaMongo = criteriaMongo.and("projectId").in(criteria.getProjectIdInList().toArray()); |
| | | } |
| | | if (criteria.getName() != null) { |
| | | // criteriaMongo = criteriaMongo.and("parent").exists(false); |
| | | // } else { |
| | | if (criteria.getName() == null) {
|
| | | criteriaMongo = criteriaMongo.and("parent").exists(false);
|
| | | } else {
|
| | | criteriaMongo = criteriaMongo.and("name").regex(Pattern.compile("^.*" + criteria.getName() + ".*$", Pattern.CASE_INSENSITIVE)); |
| | | } |
| | | Query query = new Query(criteriaMongo); |
| | | Long totalCount = mongoTemplate.count(query, TaskMongo.class); |
| | | if (totalCount == 0) { |
| | | return Collections.emptyList(); |
| | | if (criteria.getTaskStatuses() != null && criteria.getTaskStatuses().size() > 0) {
|
| | | criteriaMongo = criteriaMongo.and("taskStatus").in(criteria.getTaskStatuses());
|
| | | } |
| | | if (criteria.getUserIds() != null && criteria.getUserIds().size() > 0) {
|
| | | criteriaMongo = criteriaMongo.and("userIdList").in(criteria.getUserIds());
|
| | | }
|
| | | if (criteria.getTagList() != null && criteria.getTagList().size() > 0) {
|
| | | criteriaMongo = criteriaMongo.and("tagList").in(criteria.getTagList());
|
| | | }
|
| | | if(criteria.getPerformanceType() != null) {
|
| | | criteriaMongo = criteriaMongo.and("performanceType").is(criteria.getPerformanceType());
|
| | | }
|
| | | Query query = new Query(criteriaMongo);
|
| | | List<TaskMongo> taskMongoList = mongoTemplate.find(query, TaskMongo.class); |
| | | return taskMongoList; |
| | |
|
| | | List<TaskMongoDto> taskMongoDtoList = createTreeWithoutChildren(null, taskMongoList);
|
| | | return taskMongoDtoList;
|
| | | } |
| | | |
| | | public List<TaskMongoDto> findByCompanyId(Long companyId) { |
| | |
| | | |
| | | // @Cacheable(cacheNames = "ChildrenTask", key = "'userId:' +#p0 + 'projectId:' + #p1.projectId") |
| | | public List<TaskMongoDto> queryChildrenTaskAnyParent(Long userId,TaskQueryCriteria criteria) { |
| | | |
| | | |
| | | List<TaskMongo> taskMongosName = new ArrayList<>(); |
| | | boolean flag = false; |
| | | if (criteria.getName() != null) { |
| | | Criteria criteriaTask = new Criteria(); |
| | | Pattern pattern = Pattern.compile("^.*" + criteria.getName() + ".*$", Pattern.CASE_INSENSITIVE); |
| | | criteriaTask.and("name").is(pattern); |
| | | criteriaTask.and("pid").is(null); |
| | | taskMongosName = mongoTemplate.find(Query.query(criteriaTask), TaskMongo.class); |
| | | flag = true; |
| | | } |
| | | // 获取登录用户角色等级 |
| | | List<Integer> levels = roleService.findByUsersId(SecurityUtils.getCurrentUserId()).stream().map(RoleSmallDto::getLevel).collect(Collectors.toList()); |
| | | // 登录用户最大角色等级 |
| | | int min = Collections.min(levels); |
| | | |
| | | List<TaskMongo> taskMongoList = null;
|
| | | Criteria criteriaTask = new Criteria();
|
| | | criteriaTask.and("pid").is(null);
|
| | | criteriaTask.and("taskStatus").nin(Constant.TASK_STATUS_COMPLETED);
|
| | | if (criteria.getName() != null) {
|
| | | Pattern pattern = Pattern.compile("^.*" + criteria.getName() + ".*$", Pattern.CASE_INSENSITIVE);
|
| | | criteriaTask.and("name").is(pattern);
|
| | | }
|
| | |
|
| | | if (criteria.getProjectId() != null) {
|
| | | criteriaTask.and("projectId").is(criteria.getProjectId());
|
| | | if (min == Constant.ROLE_LEVEL_MANAGER || min == Constant.ROLE_LEVEL_LEADER || min == Constant.ROLE_LEVEL_ORDINARY) { |
| | | //看看当前这个用户是不是这个项目的项目负责人,如果是项目负责人的话显示全部的任务 |
| | | List<Long> idByLiableUserId = projectRepository.findIdByLiableUserId(userId); |
| | | for (Long aLong : idByLiableUserId) { |
| | | if (criteria.getProjectId().equals(aLong)) { |
| | | Criteria criteriaAll = new Criteria(); |
| | | criteriaAll = criteriaAll.and("projectId").is(criteria.getProjectId()).and("pid").is(null); |
| | | Query query = new Query(criteriaAll); |
| | | List<TaskMongo> taskMongos = new ArrayList<>(); |
| | | if (flag) { |
| | | taskMongos = taskMongosName; |
| | | } else { |
| | | taskMongos = mongoTemplate.find(query, TaskMongo.class); |
| | | List<Long> projectIds = projectRepository.findIdByLiableUserId(userId);
|
| | | if (!projectIds.contains(criteria.getProjectId())) {
|
| | | criteriaTask.and("containUserList").is(userId);
|
| | | }
|
| | | }
|
| | | } |
| | | |
| | | List<TaskMongoDto> taskMongoDtoList = new ArrayList<TaskMongoDto>(); |
| | | for (TaskMongo taskMongo : taskMongos) { |
| | | TaskMongoDto taskMongoDto = new TaskMongoDto(); |
| | | |
| | | taskMongoDto.setId(taskMongo.getId()); |
| | | taskMongoDto.setName(taskMongo.getName()); |
| | | taskMongoDto.setProjectId(taskMongo.getProjectId()); |
| | | taskMongoDto.setPlanStartTime(taskMongo.getPlanStartTime()); |
| | | taskMongoDto.setPlanEndTime(taskMongo.getPlanEndTime()); |
| | | |
| | | Query childrenQuery = new Query(Criteria.where("parent").is(taskMongo)); |
| | | long children = mongoTemplate.count(childrenQuery, TaskMongo.class); |
| | | taskMongoDto.setLeaf(children == 0); |
| | | |
| | | //如果时项目负责人有最高权限 |
| | | taskMongoDto.setFlag(true); |
| | | |
| | | taskMongoDtoList.add(taskMongoDto); |
| | | } |
| | | return taskMongoDtoList; |
| | | } |
| | | } |
| | | Criteria criteriaMongo = new Criteria(); |
| | | criteriaMongo = criteriaMongo.and("containUserList").is(userId); |
| | | if (criteria.getProjectId() != null) { |
| | | criteriaMongo = criteriaMongo.and("projectId").is(criteria.getProjectId()).and("pid").is(null); |
| | | } |
| | | if (criteria.getName() != null) { |
| | | criteriaMongo = criteriaMongo.and("name").regex(Pattern.compile("^.*" + criteria.getName() + ".*$", Pattern.CASE_INSENSITIVE)).and("pid").is(null); |
| | | } |
| | | Query query = new Query(criteriaMongo); |
| | | Query query = new Query(criteriaTask);
|
| | | Long totalCount = mongoTemplate.count(query, TaskMongo.class); |
| | | if (totalCount == 0) { |
| | | return Collections.emptyList(); |
| | | } |
| | | //获取包含成员 |
| | | List<TaskMongo> taskMongoList = mongoTemplate.find(query, TaskMongo.class); |
| | | |
| | | List<TaskMongoDto> taskMongoDtoList = new ArrayList<TaskMongoDto>(); |
| | | taskMongoList = mongoTemplate.find(query, TaskMongo.class);
|
| | | // 结果集
|
| | | List<TaskMongoDto> taskMongoDtoList = new ArrayList<>();
|
| | | for (TaskMongo taskMongo : taskMongoList) { |
| | | |
| | | TaskMongoDto taskMongoDto = new TaskMongoDto(); |
| | |
| | | taskMongoDtoList.add(taskMongoDto); |
| | | } |
| | | return taskMongoDtoList; |
| | | } else { |
| | | List<TaskMongoDto> taskMongoDtoList = new ArrayList<>(); |
| | | |
| | | if (criteria.getName() != null) { |
| | | Criteria criteriaTask = new Criteria(); |
| | | Pattern pattern = Pattern.compile("^.*" + criteria.getName() + ".*$", Pattern.CASE_INSENSITIVE); |
| | | criteriaTask.and("name").is(pattern); |
| | | criteriaTask.and("pid").is(null); |
| | | taskMongosName = mongoTemplate.find(Query.query(criteriaTask), TaskMongo.class); |
| | | flag = true; |
| | | } |
| | | |
| | | List<TaskMongo> all; |
| | | if (flag) { |
| | | all = taskMongosName; |
| | | } else { |
| | | all = mongoTemplate.find(Query.query(new Criteria("projectId").is(criteria.getProjectId()).and("pid").is(null)), TaskMongo.class); |
| | | } |
| | | //获取所有的任务 |
| | | for (TaskMongo taskMongo : all) { |
| | | |
| | | TaskMongoDto taskMongoDto = new TaskMongoDto(); |
| | | |
| | | taskMongoDto.setId(taskMongo.getId()); |
| | | taskMongoDto.setName(taskMongo.getName()); |
| | | taskMongoDto.setProjectId(taskMongo.getProjectId()); |
| | | taskMongoDto.setPlanStartTime(taskMongo.getPlanStartTime()); |
| | | taskMongoDto.setPlanEndTime(taskMongo.getPlanEndTime()); |
| | | |
| | | Query childrenQuery = new Query(Criteria.where("parent").is(taskMongo)); |
| | | long children = mongoTemplate.count(childrenQuery, TaskMongo.class); |
| | | taskMongoDto.setLeaf(children == 0); |
| | | taskMongoDto.setFlag(true); |
| | | taskMongoDtoList.add(taskMongoDto); |
| | | } |
| | | int num = taskMongoDtoList.size(); |
| | | return taskMongoDtoList; |
| | | } |
| | | } |
| | | |
| | | |
| | |
| | | } |
| | | |
| | | @Override |
| | | public void download(List<TaskDto> all, HttpServletResponse response) throws IOException { |
| | | public void download(List<TaskMongoDto> all, HttpServletResponse response) throws IOException {
|
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | | for (TaskDto task : all) { |
| | | for (TaskMongoDto task : all) {
|
| | | String projectName = task.getProjectId() != null ? projectRepository.findById(task.getProjectId()).orElseGet(Project::new).getName() : ""; |
| | | String pidName = task.getPid() != null ? taskRepository.findById(task.getPid()).orElseGet(Task::new).getName() : ""; |
| | | String priority = task.getPriority() != null ? dictDetailRepository.findByDictNameAndValue(Constant.PRIORITY, task.getPriority()).getLabel() : ""; |
| | | String taskClassification = task.getTaskClassification() != null ? dictDetailRepository.findByDictNameAndValue(Constant.TASK_CLASSIFICATION, task.getTaskClassification()).getLabel() : ""; |
| | | String planWorkloadUnit = task.getPlanWorkloadUnit() != null ? dictDetailRepository.findByDictNameAndValue(Constant.STANDARD_WORKLOAD_UNIT, task.getPlanWorkloadUnit()).getLabel() : ""; |
| | | String taskStatus = task.getTaskStatus() != null ? dictDetailRepository.findByDictNameAndValue(Constant.TASK_STATUS, task.getTaskStatus()).getLabel() : ""; |
| | | List<String> userNameList = new ArrayList<>();
|
| | | userRepository.findAllById(task.getUserIdList()).forEach(user -> userNameList.add(user.getNickName()));
|
| | | Map<String, Object> map = new LinkedHashMap<>(); |
| | | map.put("项目名称", projectName); |
| | | map.put("父任务名称", pidName); |
| | | map.put("项目", projectName);
|
| | | map.put("名称", task.getName()); |
| | | map.put("优先度", priority); |
| | | map.put("任务分类", taskClassification); |
| | | map.put("描述", task.getDescription()); |
| | | map.put("计划工时", task.getPlanHours());
|
| | | map.put("计划开始时间", task.getPlanStartTime()); |
| | | map.put("计划结束时间", task.getPlanEndTime()); |
| | | map.put("计划工时", task.getPlanHours()); |
| | | map.put("计划工作量", task.getPlanWorkload()); |
| | | map.put("计划工作量单位", planWorkloadUnit); |
| | | map.put("任务状态", taskStatus); |
| | | map.put("备注", task.getRemarks()); |
| | | map.put("创建者", task.getCreateBy()); |
| | | map.put("创建时间", task.getCreateTime()); |
| | | map.put("更新者", task.getUpdateBy()); |
| | | map.put("更新时间", task.getUpdateTime()); |
| | |
|
| | | map.put("消耗工时", task.getConsumedHours());
|
| | |
|
| | | map.put("绩效类型", task.getPerformanceType().equals("1") ? "绩效" : "非绩效");
|
| | | map.put("任务分类", String.join(",", task.getTagList()));
|
| | | map.put("任务负责人", String.join(",", userNameList));
|
| | | list.add(map); |
| | | } |
| | | FileUtil.downloadExcel(list, response); |
| | |
| | | taskUserMongoDto.setPriority(taskUserMongo.getPriority()); |
| | | taskUserMongoDto.setTaskStatus(taskUserMongo.getTaskStatus()); |
| | | |
| | | taskUserMongoDto.setUid(taskUserMongo.getUid()); // TODO
|
| | |
|
| | | taskUserMongoDto.setTaskStartDate(taskUserMongo.getTaskStartDate()); |
| | | taskUserMongoDto.setTaskEndDate(taskUserMongo.getTaskEndDate()); |
| | | taskUserMongoDto.setTaskHours(taskUserMongo.getTaskHours()); |
| | |
| | | taskUserMongoDto.setName(taskUserMongo.getName()); |
| | | taskUserMongoDto.setOld_id(taskUserMongo.getTask().getOld_id()); |
| | | |
| | | taskUserMongoDto.setUid(taskUserMongo.getUid()); // TODO
|
| | |
|
| | | if (taskUserMongo.getUserId() != null) { |
| | | taskUserMongoDto.setUserId(taskUserMongo.getUserId()); |
| | | UserDto userDto = userService.findById(taskUserMongo.getUserId()); |
| | |
| | | if ("".equals(dateType)) { |
| | | dateType = toDayDateTime.toLocalDate().getDayOfWeek() == DayOfWeek.SATURDAY || toDayDateTime.toLocalDate().getDayOfWeek() == DayOfWeek.SUNDAY ? Constant.DATE_TYPE_WEEKEND : Constant.DATE_TYPE_WEEKDAY; |
| | | } |
| | | if (Constant.DATE_TYPE_WEEKEND.equals(dateType) || Constant.DATE_TYPE_LEGAL_HOLIDAYS.equals(dateType)) { |
| | | if (Constant.DATE_TYPE_WEEKEND.equals(dateType) || Constant.DATE_TYPE_LEGAL_HOLIDAYS.equals(dateType) || Constant.DATE_TYPE_HOLIDAYS.equals(dateType)) {
|
| | | toDayDateTime = toDayDateTime.plusDays(1).with(user.getSysRostering().getWorkStartTime()); |
| | | continue; |
| | | } |
| | |
| | | if (toDayDateTime.toLocalDate().isEqual(localEndDateTime.toLocalDate())) { |
| | | if (toDayDateTime.toLocalTime().isBefore(localEndDateTime.toLocalTime())) { |
| | | if (localEndDateTime.toLocalTime().isBefore(user.getSysRostering().getLunchStartTime())) { |
| | | totalHours += toDayDateTime.toLocalTime().until(localEndDateTime.toLocalTime(), ChronoUnit.HOURS); |
| | | totalHours += BigDecimal.valueOf(toDayDateTime.toLocalTime().until(localEndDateTime.toLocalTime(), ChronoUnit.MINUTES)).divide(BigDecimal.valueOf(60), 2, BigDecimal.ROUND_CEILING).doubleValue();
|
| | | } else { |
| | | totalHours += toDayDateTime.toLocalTime().until(user.getSysRostering().getLunchStartTime(), ChronoUnit.HOURS); |
| | | totalHours += BigDecimal.valueOf(toDayDateTime.toLocalTime().until(user.getSysRostering().getLunchStartTime(), ChronoUnit.MINUTES)).divide(BigDecimal.valueOf(60), 2, BigDecimal.ROUND_CEILING).doubleValue();
|
| | | } |
| | | } |
| | | } else { |
| | | totalHours += toDayDateTime.toLocalTime().until(user.getSysRostering().getLunchStartTime(), ChronoUnit.HOURS); |
| | | totalHours += BigDecimal.valueOf(toDayDateTime.toLocalTime().until(user.getSysRostering().getLunchStartTime(), ChronoUnit.MINUTES)).divide(BigDecimal.valueOf(60), 2, BigDecimal.ROUND_CEILING).doubleValue();
|
| | | } |
| | | } |
| | | if (toDayDateTime.toLocalTime().isBefore(user.getSysRostering().getLunchEndTime())) { |
| | |
| | | if (toDayDateTime.toLocalDate().isEqual(localEndDateTime.toLocalDate())) { |
| | | if (toDayDateTime.toLocalTime().isBefore(localEndDateTime.toLocalTime())) { |
| | | if (localEndDateTime.toLocalTime().isBefore(user.getSysRostering().getWorkEndTime())) { |
| | | totalHours += toDayDateTime.toLocalTime().until(localEndDateTime.toLocalTime(), ChronoUnit.HOURS); |
| | | totalHours += BigDecimal.valueOf(toDayDateTime.toLocalTime().until(localEndDateTime.toLocalTime(), ChronoUnit.MINUTES)).divide(BigDecimal.valueOf(60), 2, BigDecimal.ROUND_CEILING).doubleValue();
|
| | | } else { |
| | | totalHours += toDayDateTime.toLocalTime().until(user.getSysRostering().getWorkEndTime(), ChronoUnit.HOURS); |
| | | totalHours += BigDecimal.valueOf(toDayDateTime.toLocalTime().until(user.getSysRostering().getWorkEndTime(), ChronoUnit.MINUTES)).divide(BigDecimal.valueOf(60), 2, BigDecimal.ROUND_CEILING).doubleValue();
|
| | | } |
| | | } |
| | | } else { |
| | | totalHours += toDayDateTime.toLocalTime().until(user.getSysRostering().getWorkEndTime(), ChronoUnit.HOURS); |
| | | totalHours += BigDecimal.valueOf(toDayDateTime.toLocalTime().until(user.getSysRostering().getWorkEndTime(), ChronoUnit.MINUTES)).divide(BigDecimal.valueOf(60), 2, BigDecimal.ROUND_CEILING).doubleValue();
|
| | | } |
| | | } |
| | | toDayDateTime = toDayDateTime.plusDays(1).with(user.getSysRostering().getWorkStartTime()); |
| | |
| | | resources.setTaskHours(resources.getTaskHours()); |
| | | resources.setTaskStatus(resources.getTaskStatus()); |
| | | resources.setPerformanceHours(resources.getTaskHours()); |
| | |
|
| | | resources.setUid(resources.getUid());
|
| | |
|
| | | mongoTemplate.save(resources); |
| | | |
| | | if (resources.getUserId() != null) { |
| | |
| | | taskUserMongo.setTaskHours(resources.getTaskHours()); |
| | | taskUserMongo.setTaskStatus(resources.getTaskStatus()); |
| | | |
| | | taskUserMongo.setUid(resources.getUid());
|
| | |
|
| | | // Double coefficientByUserId; |
| | | // if (resources.isOk()) { |
| | | // taskUserMongo.setTaskStatus("task_status_completed"); |
| | |
| | | @ApiModelProperty(value = "绩效系数") |
| | | private BigDecimal performanceCoefficient = BigDecimal.ZERO; |
| | | |
| | | @Column(name = "`over_time_wage`")
|
| | | @ApiModelProperty(value = "平日加班工资")
|
| | | private BigDecimal overTimeWage = null;
|
| | |
|
| | | @Column(name = "`locked`") |
| | | @ApiModelProperty(value = "锁定状态") |
| | | private Integer locked; |
| | |
| | | |
| | | Optional<UserInsurance> findByUserIdAndYearMonth(Long userId, String monthYear); |
| | | |
| | | @Query(value = "SELECT * from new_user_insurance WHERE user_id = ?1 AND `year_month` >= ?2 ORDER BY `year_month` ASC LIMIT 1",nativeQuery = true) |
| | | @Query(value = "SELECT * from new_user_insurance WHERE user_id = ?1 AND `year_month` >= ?2 ORDER BY `year_month` DESC LIMIT 1",nativeQuery = true)
|
| | | UserInsurance findbyUserIdAndDate(Long userId, String yearMonth); |
| | | |
| | | @Query(value = "SELECT * FROM `new_user_insurance` WHERE user_id = ?1 AND `year_month` != ?2",nativeQuery = true) |
| | | UserInsurance findbyUserIdAndNotEqualTo(Long userId, String yearMonth); |
| | | |
| | | @Query(value = "SELECT * FROM `new_user_insurance` WHERE user_id = ?1 AND `year_month` < ?2 ORDER BY `year_month` DESC LIMIT 1",nativeQuery = true)
|
| | | UserInsurance findbyUserIdAndYearMonthLessThan(Long userId, String yearMonth);
|
| | |
|
| | | @Query(value = "SELECT * FROM `new_user_insurance` WHERE user_id = ?1 AND `year_month` >= ?2",nativeQuery = true)
|
| | | UserInsurance findbyUserIdAnYearMonthGreaterThanEqual(Long userId, String yearMonth);
|
| | |
|
| | | @Query(value = "SELECT * FROM `new_user_insurance` WHERE user_id in (SELECT user_id FROM sys_user WHERE company_id = ?1 AND enabled is true)",nativeQuery = true) |
| | | List<UserInsurance> findbyCompanyId(Long companyId); |
| | | |
| | | List<UserInsurance> findByUserId(Long userId);
|
| | |
|
| | | // /** |
| | | // * 查询第二条 |
| | | // * @param companyId |
| | |
| | | */ |
| | | package me.zhengjie.modules.treatment.repository; |
| | | |
| | | import me.zhengjie.modules.system.domain.SysUserLevelWage; |
| | | import me.zhengjie.modules.treatment.domain.UserInsurance; |
| | | import cn.hutool.core.lang.Opt;
|
| | | import me.zhengjie.modules.treatment.domain.UserLevelWage; |
| | | import org.springframework.data.jpa.repository.JpaRepository; |
| | | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; |
| | |
| | | /** 查询今年日期最大的记录 */ |
| | | @Query(value = "SELECT * from new_user_level_wage WHERE user_id = ?1 AND `year_month` < ?2 ORDER BY `year_month` DESC LIMIT 1",nativeQuery = true) |
| | | UserLevelWage findByUserIdAndMaxDate(Long userId, String yearMonth); |
| | | |
| | | } |
| | |
| | | /** 团队工资比例 */ |
| | | private BigDecimal performanceCoefficient; |
| | | |
| | | /** 平日加班费 */
|
| | | private BigDecimal overTimeWage;
|
| | |
|
| | | /** 锁定状态 */ |
| | | private Integer locked; |
| | | |
| | |
| | | // 如果传递的时间在转正时间之前 |
| | | if(date1.before(date2)) { |
| | | // 查询没转正的日期数据 |
| | | userInsuranceOpt = userInsuranceRepository.findbyUserIdAndNotEqualTo(criteria.getUserId(), confirmationTime); |
| | | userInsuranceOpt = userInsuranceRepository.findbyUserIdAndYearMonthLessThan(criteria.getUserId(), confirmationTime);
|
| | | } else { |
| | | // 查询第二条转正后的数据 |
| | | userInsuranceOpt = userInsuranceRepository.findbyUserIdAndDate(criteria.getUserId(), confirmationTime); |
| | |
| | | public Map<String, Object> queryAll(UserLevelWageQueryCriteria criteria, Pageable pageable) { |
| | | Page<UserLevelWage> page = userLevelWageRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder), pageable); |
| | | // 将实体类转换为DTO(重写) |
| | | Function<UserLevelWage, UserLevelWageDto> func = new Function<UserLevelWage, UserLevelWageDto>() { |
| | | @Override |
| | | public UserLevelWageDto apply(UserLevelWage userLevelWage) { |
| | | Function<UserLevelWage, UserLevelWageDto> func = userLevelWage -> {
|
| | | // 将实体类转换成DTO |
| | | UserLevelWageDto userLevelWageDto = userLevelWageMapper.toDto(userLevelWage); |
| | | User user = userRepository.findById(userLevelWageDto.getUserId()).orElseGet(User::new); |
| | | ValidationUtil.isNull(userLevelWageDto.getId(), "User", "id", userLevelWageDto.getUserId()); |
| | | userLevelWageDto.setNickName(user.getNickName()); |
| | | return userLevelWageDto; |
| | | } |
| | | }; |
| | | return PageUtil.toPage(page.map(func)); |
| | | } |
| | |
| | | public void download(List<UserLevelWageDto> all, HttpServletResponse response) throws IOException { |
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | | for (UserLevelWageDto userLevelWage : all) { |
| | | // 将实体类转换成DTO
|
| | | User user = userRepository.findById(userLevelWage.getUserId()).orElseGet(User::new);;
|
| | |
|
| | | Map<String, Object> map = new LinkedHashMap<>(); |
| | | map.put("用户ID", userLevelWage.getUserId()); |
| | | map.put("员工姓名", user.getNickName());
|
| | | map.put("所属公司", user.getCompany().getLabel());
|
| | | map.put("年月", userLevelWage.getYearMonth()); |
| | | map.put("级别", userLevelWage.getLevel()); |
| | | map.put("等级", userLevelWage.getRank()); |
| | | map.put("级别基本工资", userLevelWage.getBasicWage()); |
| | | map.put("级别等级工资", userLevelWage.getRankWage()); |
| | | map.put("绩效工资", userLevelWage.getPerformanceWage()); |
| | | map.put("团队工资比例", userLevelWage.getPerformanceCoefficient()); |
| | | map.put("锁定状态", userLevelWage.getLocked()); |
| | | map.put("备注", userLevelWage.getRemarks()); |
| | | map.put("创建者", userLevelWage.getCreateBy()); |
| | | map.put("创建时间", userLevelWage.getCreateTime()); |
| | | map.put("更新者", userLevelWage.getUpdateBy()); |
| | | map.put("更新时间", userLevelWage.getUpdateTime()); |
| | | map.put("总工资", userLevelWage.getBasicWage().add(userLevelWage.getRankWage()).add(userLevelWage.getPerformanceWage()));
|
| | | map.put("基本工资", userLevelWage.getBasicWage());
|
| | | map.put("调整工资", userLevelWage.getRankWage());
|
| | | map.put("岗位工资", userLevelWage.getPerformanceWage());
|
| | | map.put("在职状态", user.getEnabled() ? "在职" : "离职");
|
| | | list.add(map); |
| | | } |
| | | FileUtil.downloadExcel(list, response); |
| | |
| | | #配置数据源
|
| | | spring:
|
| | | main:
allow-circular-references: true
|
| | | main:
|
| | | allow-circular-references: true
|
| | | data:
|
| | | mongodb:
|
| | | uri: mongodb://mongoadmin:secret@114.116.101.63:32452/pms?authSource=admin&readPreference=primary&ssl=false&directConnection=true
|
| | | uri: mongodb://mongoadmin:secret@114.116.101.63:32452/pms_upgrade?authSource=admin&readPreference=primary&ssl=false&directConnection=true
|
| | | datasource:
|
| | | druid:
|
| | | db-type: com.alibaba.druid.pool.DruidDataSource
|
| | | driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
|
| | | # url: jdbc:log4jdbc:mysql://${DB_HOST:114.116.101.63}:${DB_PORT:31752}/${DB_NAME:pms_upgrade}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false
|
| | | url: jdbc:log4jdbc:mysql://${DB_HOST:114.116.101.63}:${DB_PORT:31404}/${DB_NAME:pms_upgrade}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false
|
| | | url: jdbc:log4jdbc:mysql://${DB_HOST:114.116.101.63}:${DB_PORT:31752}/${DB_NAME:pms_upgrade}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false
|
| | | # url: jdbc:log4jdbc:mysql://${DB_HOST:114.116.101.63}:${DB_PORT:31404}/${DB_NAME:pms_upgrade}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false
|
| | | username: ${DB_USER:root}
|
| | | password: ${DB_PWD:123456}
|
| | | # 初始连接数
|
| | |
| | | stat:
|
| | | enabled: true
|
| | | # 记录慢SQL
|
| | | log-slow-sql: true
|
| | | # log-slow-sql: true
|
| | | slow-sql-millis: 1000
|
| | | merge-sql: true
|
| | | wall:
|
| | |
| | | package me.zhengjie; |
| | | |
| | | import me.zhengjie.modules.attendance.domain.Attendance;
|
| | | import me.zhengjie.modules.attendance.domain.AttendanceGoOut; |
| | | import me.zhengjie.modules.attendance.domain.AttendanceOvertime; |
| | | import me.zhengjie.modules.attendance.domain.Calculate; |
| | | import me.zhengjie.modules.attendance.repository.AttendanceGoOutRepository;
|
| | | import me.zhengjie.modules.attendance.service.AttendanceGoOutService; |
| | | import me.zhengjie.modules.attendance.service.AttendanceService;
|
| | | import me.zhengjie.modules.attendance.service.dto.AttendanceGoOutDto;
|
| | | import me.zhengjie.modules.attendance.service.dto.AttendanceGoOutQueryCriteria;
|
| | | import me.zhengjie.modules.attendance.service.mapstruct.AttendanceGoOutMapper;
|
| | | import me.zhengjie.modules.constant.Constant; |
| | | import me.zhengjie.modules.quartz.task.AttendanceMonthlyMethod; |
| | | import me.zhengjie.modules.system.domain.SysRostering; |
| | |
| | | import me.zhengjie.modules.system.service.dto.SysConfigHolidayDto; |
| | | import me.zhengjie.utils.SecurityUtils; |
| | | import org.junit.jupiter.api.Test; |
| | | import org.junit.jupiter.api.extension.ExtendWith;
|
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest;
|
| | | import org.springframework.boot.test.context.SpringBootTest; |
| | | import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
|
| | | import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
|
| | | import org.springframework.security.core.Authentication;
|
| | | import org.springframework.security.core.context.SecurityContextHolder;
|
| | | import org.springframework.test.annotation.Rollback;
|
| | | import org.springframework.test.context.junit.jupiter.SpringExtension;
|
| | | import org.springframework.test.context.junit4.SpringRunner;
|
| | | import org.springframework.transaction.annotation.Transactional;
|
| | | |
| | | import java.math.BigDecimal; |
| | | import java.sql.Timestamp; |
| | | import java.text.ParseException; |
| | | import java.time.DayOfWeek; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.time.LocalTime; |
| | | import java.time.*;
|
| | | import java.time.format.DateTimeFormatter; |
| | | import java.time.temporal.ChronoUnit; |
| | | import java.util.List;
|
| | | import java.util.stream.Stream; |
| | | |
| | | @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) |
| | | //@ExtendWith(SpringExtension.class)
|
| | | //@DataJpaTest
|
| | | public class AttendanceTest { |
| | | |
| | | @Autowired |
| | |
| | | public void exec100() throws ParseException { |
| | | attendanceMonthlyMethod.getMonthlyData(); |
| | | } |
| | |
|
| | | @Autowired
|
| | | private AttendanceService attendanceService;
|
| | |
|
| | | @Test
|
| | | public void addAttendanceInfo() {
|
| | | LocalDate startDate = LocalDate.of(2024, 6, 7);
|
| | | LocalDate endDate = LocalDate.of(2024, 6, 7);
|
| | | long distance = ChronoUnit.DAYS.between(startDate, endDate);
|
| | | Stream.iterate(startDate, d -> d.plusDays(1)).limit(distance + 1).forEach(localDate -> {
|
| | | Attendance attendance = new Attendance();
|
| | | attendance.setUserId(44L);
|
| | | attendance.setAttendanceDate(Timestamp.valueOf(localDate.atStartOfDay()));
|
| | | try {
|
| | | attendanceService.addAttendanceInfo(attendance);
|
| | | } catch (Exception e) {
|
| | | throw new RuntimeException(e);
|
| | | }
|
| | | });
|
| | | }
|
| | |
|
| | | @Autowired
|
| | | private AttendanceGoOutMapper attendanceGoOutMapper;
|
| | | @Autowired
|
| | | private AuthenticationManagerBuilder authenticationManagerBuilder;
|
| | | @Autowired
|
| | | private AttendanceGoOutRepository attendanceGoOutRepository;
|
| | |
|
| | | @Test
|
| | | @Transactional
|
| | | @Rollback(false)
|
| | | public void AttendanceGoOutServiceTest() {
|
| | | UsernamePasswordAuthenticationToken authenticationToken =
|
| | | new UsernamePasswordAuthenticationToken("yaozc", "0350111443");
|
| | | Authentication authentication = authenticationManagerBuilder.getObject().authenticate(authenticationToken);
|
| | | SecurityContextHolder.getContext().setAuthentication(authentication);
|
| | |
|
| | | AttendanceGoOutQueryCriteria criteria = new AttendanceGoOutQueryCriteria();
|
| | | criteria.setOutOfOfficeType("go_out_type_personnel");
|
| | | criteria.setOutStartTimeLike("2024-10-%");
|
| | | List<AttendanceGoOutDto> attendanceGoOutDtos = attendanceGoOutService.queryAll(criteria);
|
| | | attendanceGoOutDtos.forEach(attendanceGoOut -> {
|
| | | Calculate calculate = new Calculate();
|
| | | calculate.setStart(attendanceGoOut.getOutStartTime().toLocalDateTime());
|
| | | calculate.setEnd(attendanceGoOut.getOutEndTime().toLocalDateTime());
|
| | |
|
| | | long timeSeconds = calculateTimes(calculate, attendanceGoOut.getUserId());
|
| | |
|
| | | Double result = Double.valueOf(new BigDecimal((float) timeSeconds / 3600).setScale(2, BigDecimal.ROUND_HALF_UP).toString());
|
| | |
|
| | | if (result.compareTo(attendanceGoOut.getOutDuration()) != 0) {
|
| | | System.out.println(attendanceGoOut.getUserName() + " : " + result + " : " + attendanceGoOut.getOutDuration() + " : " + attendanceGoOut.getOutStartTime() + " : " + attendanceGoOut.getOutEndTime());
|
| | | attendanceGoOut.setOutDuration(result);
|
| | | attendanceGoOutRepository.save(attendanceGoOutMapper.toEntity(attendanceGoOut));
|
| | | }
|
| | | });
|
| | | }
|
| | |
|
| | | private Long calculateTimes(Calculate calculate, Long userId) {
|
| | | User userInfo = userRepository.getOne(userId);
|
| | | SysRostering sysRostering = userInfo.getSysRostering();
|
| | |
|
| | | LocalDate startDate = calculate.getStart().toLocalDate();
|
| | | LocalDate endDate = calculate.getEnd().toLocalDate();
|
| | | LocalTime startTime = calculate.getStart().toLocalTime();
|
| | | LocalTime endTime = calculate.getEnd().toLocalTime();
|
| | | long distance = ChronoUnit.DAYS.between(startDate, endDate);
|
| | | return Stream.iterate(startDate, d -> d.plusDays(1)).limit(distance + 1).map(localDate -> {
|
| | | SysConfigHolidayDto sysConfigHolidayDto = sysConfigHolidayService.queryByHolidayDate(localDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
|
| | | Boolean isWeekend = localDate.getDayOfWeek() == DayOfWeek.SATURDAY || localDate.getDayOfWeek() == DayOfWeek.SUNDAY;
|
| | | if ((sysConfigHolidayDto == null && !isWeekend) ||
|
| | | sysConfigHolidayDto != null && Constant.DATE_TYPE_WEEKDAY.equals(sysConfigHolidayDto.getDateType())) {
|
| | |
|
| | | LocalDateTime goOutStartTime = localDate.atTime(startTime);
|
| | | LocalDateTime goOutEndTime = localDate.atTime(endTime);
|
| | | LocalDateTime lunchStartTime = localDate.atTime(sysRostering.getLunchStartTime());
|
| | | LocalDateTime lunchEndTime = localDate.atTime(sysRostering.getLunchEndTime());
|
| | |
|
| | |
|
| | | if (goOutEndTime.isBefore(lunchStartTime) || goOutStartTime.isAfter(lunchEndTime)) {
|
| | | return ChronoUnit.SECONDS.between(goOutStartTime, goOutEndTime);
|
| | | } else if (!goOutEndTime.isBefore(lunchStartTime) && !goOutEndTime.isAfter(lunchEndTime)) {
|
| | | return ChronoUnit.SECONDS.between(goOutStartTime, lunchStartTime);
|
| | | } else if (!goOutStartTime.isBefore(lunchStartTime) && !goOutStartTime.isAfter(lunchEndTime)) {
|
| | | return ChronoUnit.SECONDS.between(lunchEndTime, goOutEndTime);
|
| | | } else {
|
| | | return ChronoUnit.SECONDS.between(goOutStartTime, goOutEndTime) - 3600;
|
| | | }
|
| | | } else {
|
| | | LocalDateTime goOutStartTime = localDate.atTime(startTime);
|
| | | LocalDateTime goOutEndTime = localDate.atTime(endTime);
|
| | | return ChronoUnit.SECONDS.between(goOutStartTime, goOutEndTime);
|
| | | }
|
| | | }).reduce(0L, (result, current) -> result + current);
|
| | | }
|
| | | } |
| | |
| | | import lombok.Data; |
| | | import me.zhengjie.modules.constant.Constant; |
| | | import me.zhengjie.modules.project.domain.Project; |
| | | import me.zhengjie.modules.project.domain.ProjectType;
|
| | | import me.zhengjie.modules.project.repository.ProjectRepository; |
| | | import me.zhengjie.modules.project.repository.ProjectTypeRepository;
|
| | | import me.zhengjie.modules.project.service.ProjectProgressService;
|
| | | import me.zhengjie.modules.project.service.ProjectService;
|
| | | import me.zhengjie.modules.project.service.dto.ProjectDto;
|
| | | import me.zhengjie.modules.project.service.dto.ProjectQueryCriteria; |
| | | import me.zhengjie.modules.project.service.impl.ProjectServiceImpl;
|
| | | import me.zhengjie.modules.project.service.mapstruct.ProjectMapper;
|
| | | import me.zhengjie.modules.system.domain.DictDetail;
|
| | | import me.zhengjie.modules.system.domain.SysCompany;
|
| | | import me.zhengjie.modules.system.domain.User;
|
| | | import me.zhengjie.modules.system.repository.DictRepository;
|
| | | import me.zhengjie.modules.system.repository.SysCompanyRepository;
|
| | | import me.zhengjie.modules.system.repository.UserRepository;
|
| | | import me.zhengjie.modules.system.service.UserService; |
| | | import me.zhengjie.modules.system.service.dto.UserDto; |
| | | import me.zhengjie.modules.task.domain.TaskDaliyMongo; |
| | |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | |
| | | import java.io.*;
|
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.nio.charset.StandardCharsets;
|
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Arrays; |
| | | import java.util.Comparator; |
| | | import java.util.List; |
| | | import java.util.Optional; |
| | | import java.time.LocalDate;
|
| | | import java.time.format.DateTimeFormatter;
|
| | | import java.util.*;
|
| | | import java.util.stream.Collectors; |
| | | |
| | | @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) |
| | |
| | | private ProjectRepository projectRepository; |
| | | |
| | | @Autowired |
| | | private ProjectService projectService;
|
| | |
|
| | | @Autowired
|
| | | private ProjectMapper projectMapper;
|
| | |
|
| | | @Autowired
|
| | | private ProjectTypeRepository projectTypeRepository;
|
| | |
|
| | | @Autowired
|
| | | private MongoTemplate mongoTemplate; |
| | | |
| | | @Autowired |
| | | private UserLevelWageRepository userLevelWageRepository; |
| | |
|
| | | @Autowired
|
| | | private SysCompanyRepository companyRepository;
|
| | |
|
| | | @Autowired
|
| | | private DictRepository dictRepository;
|
| | |
|
| | | @Autowired
|
| | | private UserRepository userRepository;
|
| | | |
| | | @Test |
| | | public void closeTaskByProject() { |
| | |
| | | |
| | | @Test |
| | | public void changeTask() { |
| | | List<TaskMongo> taskMongoList = mongoTemplate.find(Query.query(new Criteria("pid").exists(true)), TaskMongo.class); |
| | | List<Long> projectIdList = taskMongoList.stream().map(taskMongo -> taskMongo.getProjectId()).distinct().collect(Collectors.toList()); |
| | | for (Long projectId : projectIdList) { |
| | | Project project = projectRepository.findById(projectId).orElse(new Project()); |
| | | System.out.println(project.getId() + "\t" + project.getName() + "\t" + project.getProjectStatus()); |
| | | mongoTemplate.find(Query.query(new Criteria("projectId").is(projectId)), TaskMongo.class).forEach(System.out::println); |
| | | } |
| | | // List<TaskMongo> taskMongoList = mongoTemplate.find(Query.query(new Criteria("pid").exists(true)), TaskMongo.class);
|
| | | // List<Long> projectIdList = taskMongoList.stream().map(taskMongo -> taskMongo.getProjectId()).distinct().collect(Collectors.toList());
|
| | | // for (Long projectId : projectIdList) {
|
| | | // Project project = projectRepository.findById(projectId).orElse(new Project());
|
| | | // System.out.println(project.getId() + "\t" + project.getName() + "\t" + project.getProjectStatus());
|
| | | // mongoTemplate.find(Query.query(new Criteria("projectId").is(projectId)), TaskMongo.class).forEach(System.out::println);
|
| | | // }
|
| | |
|
| | | Project project = projectRepository.findById(253L).orElse(new Project());
|
| | | TaskMongo taskMongo = mongoTemplate.findById("66ed27577a36a8322c08a5f5", TaskMongo.class);
|
| | | taskMongo.setProjectId(project.getId());
|
| | | mongoTemplate.save(taskMongo);
|
| | | } |
| | | |
| | | @Test |
| | |
| | | updateTask(taskMongo, taskMongo); |
| | | } |
| | | } |
| | |
|
| | | // @Test
|
| | | // public void changeTaskUserRoot() {
|
| | | // String taskId = "65f14d1c811ddb5466e3379d";
|
| | | // TaskMongo taskMongo = mongoTemplate.findById(taskId, TaskMongo.class);
|
| | | //
|
| | | // String taskUserId = "669601474953ff46d6f8d426";
|
| | | // TaskUserMongo taskUserMongo = mongoTemplate.findById(taskUserId, TaskUserMongo.class);
|
| | | // taskUserMongo.setTask(taskMongo);
|
| | | // mongoTemplate.save(taskUserMongo);
|
| | | //// System.out.println(taskMongo);
|
| | | //// System.out.println(taskUserMongo);
|
| | | // }
|
| | |
|
| | | @Test
|
| | | public void changeTaskUser2Task() {
|
| | | String taskUserId = "67185c703d80ce1746421009";
|
| | | TaskUserMongo taskUserMongo = mongoTemplate.findById(taskUserId, TaskUserMongo.class);
|
| | |
|
| | | String taskId = "6731bc9b3d80ce17464215e5";
|
| | | TaskMongo taskMongo = mongoTemplate.findById(taskId, TaskMongo.class);
|
| | |
|
| | | taskUserMongo.setTask(taskMongo);
|
| | | mongoTemplate.save(taskUserMongo);
|
| | | }
|
| | |
|
| | | |
| | | @Test |
| | | public void changeTaskStatus() { |
| | |
| | | System.out.println(); |
| | | }); |
| | | } |
| | |
|
| | | @Autowired
|
| | | private ProjectProgressService projectProgressService;
|
| | |
|
| | | @Test
|
| | | public void process() {
|
| | | // projectProgressService.autoGenerateProjectProcess(LocalDate.of(2024, 5, 20), 2024, 20);
|
| | | // projectProgressService.autoGenerateProjectProcess(LocalDate.of(2024, 5, 27), 2024, 21);
|
| | | projectProgressService.autoGenerateProjectProcess(LocalDate.of(2024, 6, 3), 2024, 22);
|
| | | }
|
| | |
|
| | | @Test
|
| | | public void exportProjectInfo() {
|
| | | List<ProjectDto> projectDtos = projectMapper.toDto(projectRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, new ProjectQueryCriteria(), criteriaBuilder)));
|
| | | try (BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream("C:\\Users\\yaozc\\Desktop\\project.csv"), StandardCharsets.UTF_8))) {
|
| | |
|
| | | projectDtos.forEach(projectDto -> {
|
| | | try {
|
| | | writer.write(Arrays.asList(
|
| | | projectDto.getName(),
|
| | | projectTypeRepository.findById(projectDto.getProjectTypeId()).orElseGet(() -> new ProjectType()).getName(),
|
| | | dictRepository.findByName("project_distinguish").getDictDetails().stream().filter(dictDetail -> dictDetail.getValue().equals(projectDto.getProjectDistinguish())).findFirst().orElseGet(() -> new DictDetail()).getLabel(),
|
| | | projectDto.getCompanyId() == null ? "" : companyRepository.findById(projectDto.getCompanyId()).orElseGet(() -> new SysCompany()).getLabel(),
|
| | | projectDto.getRequirement() == null ? "" : projectDto.getRequirement().replace("\n", "\\n"),
|
| | | projectDto.getLiableUserId() == null ? "" : userRepository.findByIdIn(Arrays.stream(projectDto.getLiableUserId().replace("-", "").split(",")).map(Long::valueOf).collect(Collectors.toList())).stream().map(User::getNickName).collect(Collectors.joining("-")),
|
| | | projectDto.getPlanStartDate() == null ? "" : projectDto.getPlanStartDate().toLocalDateTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")),
|
| | | projectDto.getPlanEndDate() == null ? "" : projectDto.getPlanEndDate().toLocalDateTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")),
|
| | | dictRepository.findByName("project_status").getDictDetails().stream().filter(dictDetail -> dictDetail.getValue().equals(projectDto.getProjectStatus())).findFirst().orElseGet(() -> new DictDetail()).getLabel(),
|
| | | dictRepository.findByName("approve_status").getDictDetails().stream().filter(dictDetail -> dictDetail.getValue().equals(projectDto.getApproveStatus())).findFirst().orElseGet(() -> new DictDetail()).getLabel(),
|
| | | projectDto.getRemarks() == null ? "" : projectDto.getRemarks().replace("\n", "\\n")
|
| | | ).stream().collect(Collectors.joining("@", "", "\n")));
|
| | | } catch (IOException e) {
|
| | | throw new RuntimeException(e);
|
| | | }
|
| | | });
|
| | | } catch (IOException e) {
|
| | | throw new RuntimeException(e);
|
| | | }
|
| | | }
|
| | | } |
| | | |
| | | @Data |
| | |
| | | import me.zhengjie.modules.attendance.service.AttendanceLeaveService; |
| | | import me.zhengjie.modules.attendance.service.AttendanceService; |
| | | import me.zhengjie.modules.attendance.service.dto.AttendanceQueryCriteria; |
| | | import me.zhengjie.modules.project.domain.Project;
|
| | | import me.zhengjie.modules.project.repository.ProjectRepository; |
| | | import me.zhengjie.modules.project.service.ProjectService; |
| | | import me.zhengjie.modules.quartz.service.impl.DingTalkServiceImpl; |
| | |
| | | import me.zhengjie.modules.task.domain.TaskUserMongo; |
| | | import me.zhengjie.modules.task.service.TaskDaliyService; |
| | | import me.zhengjie.modules.task.service.dto.TaskDaliyMongoDto; |
| | | import me.zhengjie.modules.treatment.domain.UserLevelWage;
|
| | | import me.zhengjie.modules.treatment.repository.UserLevelWageRepository;
|
| | | import me.zhengjie.modules.treatment.service.UserInsuranceService;
|
| | | import me.zhengjie.modules.treatment.service.dto.UserInsuranceDto;
|
| | | import me.zhengjie.modules.treatment.service.dto.UserInsuranceQueryCriteria;
|
| | | import org.junit.jupiter.api.Test; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.boot.test.context.SpringBootTest; |
| | |
| | | |
| | | @Autowired |
| | | UserRepository userRepository; |
| | |
|
| | | @Autowired
|
| | | UserLevelWageRepository userLevelWageRepository;
|
| | | |
| | | @Autowired |
| | | ProjectRepository projectRepository; |
| | |
| | | @Test |
| | | public void task7() { |
| | | NewSalaryQueryCriteria criteria = new NewSalaryQueryCriteria(); |
| | | criteria.setSelectedValue1(Arrays.asList(103L)); // 44 |
| | | criteria.setTargetYearMonth("2024-04-01"); |
| | | criteria.setSelectedValue1(Arrays.asList(48L)); // 44
|
| | | criteria.setTargetYearMonth("2024-10-01");
|
| | | salaryService.generate(criteria); |
| | | } |
| | | |
| | |
| | | // Long userId = 45L; |
| | | // String date = "2024-01-29"; |
| | | AttendanceQueryCriteria criteria = new AttendanceQueryCriteria(); |
| | | criteria.setUserId(45L); |
| | | criteria.setTargetYearMonth("2024-03-01"); |
| | | criteria.setUserId(24L);
|
| | | criteria.setTargetYearMonth("2024-07-01");
|
| | | System.out.println(attendanceService.queryAttendanceHours(criteria)); |
| | | }
|
| | |
|
| | | @Test
|
| | | public void queryAttendanceOverTimeHours() {
|
| | | AttendanceQueryCriteria criteria = new AttendanceQueryCriteria();
|
| | | // List<User> userList = userRepository.findAllByEnabled(true);
|
| | | // for (User user : userList) {
|
| | | // criteria.setUserId(user.getId());
|
| | | // criteria.setTargetYearMonth("2024-08-01");
|
| | | // System.out.println(user.getNickName() + "(" + user.getId() + ")" + " : " + attendanceService.queryAttendanceOverTimeHours(criteria));
|
| | | // }
|
| | | criteria.setUserId(55L);
|
| | | criteria.setTargetYearMonth("2024-10-01");
|
| | | System.out.println(attendanceService.queryAttendanceOverTimeHours(criteria));
|
| | | } |
| | | |
| | | @Test |
| | |
| | | |
| | | @Test |
| | | public void test100() throws ParseException { |
| | | System.out.println(attendanceLeaveService.getOverTimeLength(128L)); |
| | | System.out.println(attendanceLeaveService.getOverTimeLength(60L));
|
| | | }
|
| | |
|
| | | @Test
|
| | | public void test101() {
|
| | | List<TaskMongo> taskMongoList = mongoTemplate.find(Query.query(Criteria.where("projectId").is(234L)), TaskMongo.class);
|
| | |
|
| | | taskMongoList.forEach(taskMongo -> System.out.println(taskMongo.getName() + "\t" + taskMongo.getPlanHours()));
|
| | |
|
| | | List<TaskUserMongo> taskUserMongoList = mongoTemplate.find(Query.query(Criteria.where("task").in(taskMongoList)), TaskUserMongo.class);
|
| | |
|
| | | Map<Long, TaskUserMongo> taskUserMongoMap = taskUserMongoList.stream().collect(
|
| | | Collectors.groupingBy(
|
| | | (TaskUserMongo taskUserMongo) -> taskUserMongo.getUserId(),
|
| | | Collectors.collectingAndThen(
|
| | | Collectors.reducing(
|
| | | null,
|
| | | (TaskUserMongo prev, TaskUserMongo cur) -> {
|
| | | if (prev == null) {
|
| | | return cur;
|
| | | }
|
| | | prev.setPerformanceHours(prev.getPerformanceHours() + cur.getPerformanceHours());
|
| | | prev.setCostHours(prev.getCostHours() + cur.getCostHours());
|
| | | return prev;
|
| | | }
|
| | | ),
|
| | | Function.identity()
|
| | | )
|
| | | )
|
| | | );
|
| | |
|
| | | System.out.println("姓名\t合计工时\t预计工时\t工资\t绩效成本");
|
| | |
|
| | | List<TaskDaliyMongo> daliyMongoList = mongoTemplate.find(Query.query(new Criteria("taskUserMongo").in(taskUserMongoList)), TaskDaliyMongo.class);
|
| | | daliyMongoList.stream().collect(
|
| | | Collectors.groupingBy(
|
| | | (TaskDaliyMongo taskDaliyMongo) -> taskDaliyMongo.getUserId(),
|
| | | Collectors.collectingAndThen(
|
| | | Collectors.reducing(
|
| | | null,
|
| | | (TaskDaliyMongo prev, TaskDaliyMongo cur) -> {
|
| | | if (prev == null) {
|
| | | return cur;
|
| | | }
|
| | | prev.setConsumedHours(prev.getConsumedHours() + cur.getConsumedHours());
|
| | | return prev;
|
| | | }
|
| | | ),
|
| | | Function.identity()
|
| | | )
|
| | | )
|
| | | ).forEach((key, value) -> {
|
| | | User user = userRepository.findById(key).get();
|
| | | System.out.print(user.getNickName() + "\t");
|
| | | System.out.print(value.getConsumedHours() + "\t");
|
| | |
|
| | | // System.out.print(taskUserMongoMap.get(key).getCostHours() + "\t");
|
| | | System.out.print(taskUserMongoMap.get(key).getPerformanceHours() + "\t");
|
| | |
|
| | | UserLevelWage userLevelWage = userLevelWageRepository.findUserLevelWageByUserId(user.getId()).get(0);
|
| | | BigDecimal cost = userLevelWage.getBasicWage().add(userLevelWage.getPerformanceWage()).add(userLevelWage.getRankWage());
|
| | | System.out.print(cost + "\t");
|
| | |
|
| | | System.out.println(BigDecimal.valueOf(value.getConsumedHours()).multiply(cost).divide(BigDecimal.valueOf(160), 2, RoundingMode.HALF_UP));
|
| | | });
|
| | | }
|
| | |
|
| | | /**
|
| | | * 查询各个项目的总工时
|
| | | */
|
| | | @Test
|
| | | public void test102() {
|
| | | List<Project> projectList = projectRepository.findAllById(Arrays.asList(214L, 182L, 245L, 196L, 234L, 195L, 95L, 198L, 226L, 134L, 241L, 212L));
|
| | | projectList.parallelStream().forEach(project -> {
|
| | | List<TaskMongo> taskMongoList = mongoTemplate.find(Query.query(Criteria.where("projectId").is(project.getId())), TaskMongo.class);
|
| | | List<TaskUserMongo> taskUserMongoList = mongoTemplate.find(Query.query(Criteria.where("task").in(taskMongoList)), TaskUserMongo.class);
|
| | | List<TaskDaliyMongo> taskDaliyMongoList = mongoTemplate.find(Query.query(Criteria.where("taskUserMongo").in(taskUserMongoList)), TaskDaliyMongo.class);
|
| | | Double totalHours = taskDaliyMongoList.stream().mapToDouble(taskDaliyMongo -> taskDaliyMongo.getConsumedHours()).sum();
|
| | | System.out.println(project.getName() + "\t" + totalHours);
|
| | | });
|
| | | }
|
| | |
|
| | | @Autowired
|
| | | private UserInsuranceService userInsuranceService;
|
| | |
|
| | | @Test
|
| | | public void test103() throws ParseException {
|
| | | UserInsuranceQueryCriteria criteria = new UserInsuranceQueryCriteria();
|
| | | criteria.setUserId(44L);
|
| | | criteria.setTargetYearMonth("2024-08-01");
|
| | | UserInsuranceDto userInsuranceDto = userInsuranceService.queryTargetYearMonth(criteria);
|
| | | System.out.println(userInsuranceDto.getEmploymentInsurance());
|
| | | } |
| | | } |
| | |
| | | <version>3.0.3</version> |
| | | </dependency> |
| | | |
| | | <dependency>
|
| | | <groupId>org.jsoup</groupId>
|
| | | <artifactId>jsoup</artifactId>
|
| | | <version>1.13.1</version>
|
| | | </dependency>
|
| | | |
| | | <!--Mysql依赖包--> |
| | | <dependency> |
| | |
| | | }) |
| | | } |
| | | |
| | | export default { add, edit, del, getAll, getRemainingTime, approve, updateAgree } |
| | | export function reflashTime(ids) { |
| | | return request({ |
| | | url: 'api/attendanceGoOut/reflashTime', |
| | | method: 'put', |
| | | data: ids |
| | | }) |
| | | } |
| | | |
| | | export default { add, edit, del, getAll, getRemainingTime, approve, updateAgree, reflashTime } |
| | |
| | | if (to.meta.title) { |
| | | document.title = to.meta.title + ' - ' + Config.title |
| | | } |
| | | console.log('to.path : ', to.path) |
| | | NProgress.start() |
| | | if (getToken()) { |
| | | // 已登录且要跳转的页面是登录页 |
| | |
| | | NProgress.done() |
| | | } else { |
| | | if (store.getters.roles.length === 0) { // 判断当前用户是否已拉取完user_info信息 |
| | | console.log('1111111111111111111111111111111111111111111111111') |
| | | store.dispatch('GetInfo').then(() => { // 拉取user_info |
| | | // 动态路由,拉取菜单 |
| | | loadMenus(next, to) |
| | |
| | | }) |
| | | // 登录时未拉取 菜单,在此处拉取 |
| | | } else if (store.getters.loadMenus) { |
| | | console.log('222222222222222222222222222222222222222222222222222') |
| | | // 修改成false,防止死循环 |
| | | store.dispatch('updateLoadMenus') |
| | | loadMenus(next, to) |
| | | } else { |
| | | console.log('33333333333333333333333333333333333333333333333333') |
| | | next() |
| | | } |
| | | } |
| | |
| | | }) |
| | | |
| | | export const loadMenus = (next, to) => { |
| | | console.log('44444444444444444444444444444444444444444444') |
| | | buildMenus().then(res => { |
| | | const sdata = JSON.parse(JSON.stringify(res)) |
| | | const rdata = JSON.parse(JSON.stringify(res)) |
| | |
| | | |
| | | store.dispatch('GenerateRoutes', rewriteRoutes).then(() => { // 存储路由 |
| | | router.addRoutes(rewriteRoutes) // 动态添加可访问路由表 |
| | | console.log('to.path2 : ', to.path) |
| | | next({ ...to, replace: true }) |
| | | }) |
| | | store.dispatch('SetSidebarRouters', sidebarRoutes) |
| | |
| | | > |
| | | 批量拒绝 |
| | | </el-button> |
| | | <el-button |
| | | slot="right" |
| | | v-permission="permission.updateAgree" |
| | | class="filter-item" |
| | | size="mini" |
| | | type="primary" |
| | | icon="el-icon-upload" |
| | | :disabled="crud.selections.length < 1" |
| | | style="margin-left: 4px !important;" |
| | | @click="toReflash(crud.selections)" |
| | | > |
| | | 时间刷新 |
| | | </el-button> |
| | | </crudOperation> |
| | | <!--表单组件--> |
| | | <el-dialog |
| | |
| | | }) |
| | | }) |
| | | }, |
| | | |
| | | // 时间同步 |
| | | toReflash(data) { |
| | | const ids = [] |
| | | // 循环数据 |
| | | for (let i = 0; i < data.length; i++) { |
| | | // ID列表 |
| | | ids.push(data[i].id) |
| | | } |
| | | crudAttendanceGoOut |
| | | .reflashTime(ids) |
| | | .then(res => { |
| | | // 消息提示 |
| | | this.$message({ |
| | | type: 'success', |
| | | message: '刷新成功!' |
| | | }) |
| | | // 刷新数据 |
| | | this.crud.refresh() |
| | | }) |
| | | }, |
| | | |
| | | // 审批页面赋值 |
| | | toApprove(data, Number) { |
| | | if (Number !== '1') { |
| | |
| | | </div> |
| | | </el-dialog> |
| | | <!--表格渲染--> |
| | | <el-table ref="table" v-loading="crud.loading" :data="crud.data" size="small" style="width: 150%;" @selection-change="crud.selectionChangeHandler"> |
| | | <el-table ref="table" v-loading="crud.loading" :data="crud.data" row-key="id" size="small" style="width: 150%;" @selection-change="crud.selectionChangeHandler"> |
| | | <el-table-column type="selection" width="55" fixed="left" /> |
| | | <el-table-column :show-overflow-tooltip="true" prop="name" label="名称" fixed="left" width="240" /> |
| | | <el-table-column :show-overflow-tooltip="true" prop="projectTypeName" label="项目类型" width="110"> |
| | |
| | | <el-table-column fixed type="selection" width="55px" /> |
| | | <el-table-column fixed show-overflow-tooltip prop="belongYear" label="年度" /> |
| | | <el-table-column fixed show-overflow-tooltip prop="belongWeek" label="周数" /> |
| | | <el-table-column fixed show-overflow-tooltip prop="projectName" label="所属项目" width="140px"> |
| | | <el-table-column fixed show-overflow-tooltip prop="projectName" label="所属项目" width="200px"> |
| | | <template slot-scope="scope"> |
| | | <el-tag>{{ scope.row.project.name }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column show-overflow-tooltip prop="lastedProgress" label="本周预计"> |
| | | <template slot-scope="scope"> |
| | | {{ (scope.row.lastProjectProcess.estimatedProgress ? scope.row.lastProjectProcess.estimatedProgress : 0) + '%' }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column show-overflow-tooltip prop="projectProgress" label="本周实际"> |
| | | <template slot-scope="scope"> |
| | | <span :style="{ color: scope.row.lastedProgress > scope.row.projectProgress ? 'red' : '' }">{{ (scope.row.projectProgress ? scope.row.projectProgress + '%' : '0%') }}</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column show-overflow-tooltip prop="estimatedProgress" label="下周预计"> |
| | | <template slot-scope="scope"> |
| | | {{ (scope.row.estimatedProgress ? scope.row.estimatedProgress + '%' : '0%') }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column show-overflow-tooltip prop="moneyTotalInit" label="计划总成本" width="140px"> |
| | | <el-table-column show-overflow-tooltip prop="moneyTotalInit" label="入项总成本" width="180px"> |
| | | <template slot-scope="scope"> |
| | | {{ scope.row.moneyTotalInit != null && scope.row.moneyTotalInit != '' ? crud.toMoney(scope.row.moneyTotalInit) : 0 }} |
| | | ({{ scope.row.lastProjectProcess.moneyTotalInit != null && scope.row.lastProjectProcess.moneyTotalInit != '' ? crud.toMoney(scope.row.moneyTotalInit - scope.row.lastProjectProcess.moneyTotalInit) : crud.toMoney(0) }}) |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column show-overflow-tooltip prop="moneyTotalCost" label="总消耗成本" width="140px"> |
| | | <el-table-column show-overflow-tooltip prop="moneyTotalCost" label="已分配成本(概算)" width="180px"> |
| | | <template slot-scope="scope"> |
| | | {{ scope.row.moneyTotalCost != null && scope.row.moneyTotalCost != '' ? crud.toMoney(scope.row.moneyTotalCost) : 0 }} |
| | | ({{ scope.row.lastProjectProcess.moneyTotalCost != null && scope.row.lastProjectProcess.moneyTotalCost != '' ? crud.toMoney(scope.row.moneyTotalCost - scope.row.lastProjectProcess.moneyTotalCost) : crud.toMoney(0) }}) |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column show-overflow-tooltip prop="realLastCost" label="本周消化工时" width="100px"> |
| | | <el-table-column show-overflow-tooltip prop="moneyRealCost" label="已消耗成本(实际)" width="140px"> |
| | | <template slot-scope="scope"> |
| | | {{ scope.row.lastProjectProcess.realLastCost != null ? scope.row.realLastCost - scope.row.lastProjectProcess.realLastCost : scope.row.realLastCost }} |
| | | {{ scope.row.moneyRealCost != null && scope.row.moneyRealCost != '' ? crud.toMoney(scope.row.moneyRealCost) : 0 }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column show-overflow-tooltip prop="workTotalInit" label="总工作量" width="100px"> |
| | | <el-table-column show-overflow-tooltip prop="timeTotalInit" label="已分配工时" width="100px"> |
| | | <template slot-scope="scope"> |
| | | {{ scope.row.workTotalInit != null && scope.row.workTotalInit != '' ? crud.toMoney(scope.row.workTotalInit) : 0 }} |
| | | ({{ scope.row.lastProjectProcess.workTotalInit != null && scope.row.lastProjectProcess.workTotalInit != '' ? crud.toMoney(scope.row.workTotalInit - scope.row.lastProjectProcess.workTotalInit) : crud.toMoney(0) }}) |
| | | {{ scope.row.timeTotalInit != null && scope.row.timeTotalInit != '' ? crud.toMoney(scope.row.timeTotalInit) : 0 }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column show-overflow-tooltip prop="workTotalCost" label="总消耗工作量" width="100px"> |
| | | <el-table-column show-overflow-tooltip prop="timeTotalCost" label="已消耗工时" width="180px"> |
| | | <template slot-scope="scope"> |
| | | {{ scope.row.workTotalCost != null && scope.row.workTotalCost != '' ? crud.toMoney(scope.row.workTotalCost) : 0 }} |
| | | ({{ scope.row.lastProjectProcess.workTotalCost != null && scope.row.lastProjectProcess.workTotalCost != '' ? crud.toMoney(scope.row.workTotalCost - scope.row.lastProjectProcess.workTotalCost) : crud.toMoney(0) }}) |
| | | {{ scope.row.timeTotalCost != null && scope.row.timeTotalCost != '' ? crud.toMoney(scope.row.timeTotalCost) : 0 }} |
| | | ({{ scope.row.lastProjectProcess.timeTotalCost != null && scope.row.lastProjectProcess.timeTotalCost != '' ? crud.toMoney(scope.row.timeTotalCost - scope.row.lastProjectProcess.timeTotalCost) : crud.toMoney(0) }}) |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column show-overflow-tooltip prop="projectProgress" label="进度"> |
| | | <template slot-scope="scope"> |
| | | <span :style="{ color: scope.row.lastedProgress > scope.row.projectProgress ? 'red' : '' }">{{ (scope.row.projectProgress ? scope.row.projectProgress + '%' : '0%') }}</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column show-overflow-tooltip prop="approveStatus" label="承认状态"> |
| | |
| | | <el-form-item label="出差补助工资" prop="travelAllowance"> |
| | | <el-input v-model="form.travelAllowance" style="width: 523px;" :disabled="disabledFlagByApprove" @change="statisticalAmount" /> |
| | | </el-form-item> |
| | | <el-form-item label="绩效工资" prop="overtimeAllowance"> |
| | | <el-form-item label="加班工资" prop="overtimeAllowance"> |
| | | <el-input v-model="form.overtimeAllowance" style="width: 523px;" :disabled="disabledFlagByApprove" @change="statisticalAmount" /> |
| | | </el-form-item> |
| | | <el-divider>公积金</el-divider> |
| | |
| | | callback(new Error('数值必须大于等于0')) |
| | | } else if ((!/(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/.test(value))) { |
| | | callback(new Error('数值最多两位小数')) |
| | | } else if (value > 100) { |
| | | callback(new Error('数值必须小于等于100')) |
| | | } else if (value > 1000) { |
| | | callback(new Error('数值必须小于等于1000')) |
| | | } else { |
| | | callback() |
| | | } |
| | |
| | | <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="110px"> |
| | | <el-form-item label="所属项目" prop="projectId"> |
| | | <el-select v-model="form.projectId" disabled placeholder="请选择" style="width: 340px;"> |
| | | <el-select v-model="form.projectId" :disabled="44 !== $store.state.user.user.id" placeholder="请选择" style="width: 340px;"> |
| | | <el-option |
| | | v-for="item in projects" |
| | | :key="item.id" |
| | |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="remarks" label="备注" min-width="140px" /> |
| | | <el-table-column v-if="checkPer(['admin','task:divide','task:edit','task:del'])" label="操作" width="180px" align="center" fixed="right"> |
| | | <el-table-column v-if="checkPer(['admin','taskDaliy:add','taskDaliy:edit','taskDaliy:del'])" label="操作" width="180px" align="center" fixed="right"> |
| | | <template slot-scope="scope"> |
| | | <udOperation :data="scope.row" :permission="permission" /> |
| | | <udOperation :data="scope.row" :permission="permission" > |
| | | <el-button |
| | | slot="left" |
| | | v-permission="permission.add" |
| | | size="mini" |
| | | type="primary" |
| | | icon="el-icon-share" |
| | | @click="quickFilling1(scope.row)" |
| | | /> |
| | | </udOperation> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | |
| | | this.form.taskUserMongo.name = this.currentTask.name |
| | | this.form.taskUserMongo.taskStartDate = this.currentTask.taskStartDate |
| | | this.form.taskUserMongo.taskEndDate = this.currentTask.taskEndDate |
| | | this.form.taskProgress = this.currentTask.taskProgress |
| | | |
| | | this.fetchAlreadyConsumedHours() |
| | | |
| | |
| | | type: 'error' |
| | | }) |
| | | return |
| | | } else if (parseInt(this.form.consumedHours) + parseInt(this.form.todayFixedHours) > parseInt(this.form.todayAttendanceHours)) { |
| | | this.$message({ |
| | | showClose: true, |
| | | message: '当日消耗工时总和超过打卡时间,请修改消耗工时', |
| | | type: 'error' |
| | | }) |
| | | return |
| | | // } else if (parseInt(this.form.consumedHours) + parseInt(this.form.todayFixedHours) > parseInt(this.form.todayAttendanceHours)) { |
| | | // this.$message({ |
| | | // showClose: true, |
| | | // message: '当日消耗工时总和超过打卡时间,请修改消耗工时', |
| | | // type: 'error' |
| | | // }) |
| | | // return |
| | | } else if (this.form.taskProgress === undefined) { |
| | | this.$message({ |
| | | showClose: true, |
| | |
| | | this.crud.toAdd() |
| | | this.getTaskProgress(object.id) |
| | | }, |
| | | quickFilling1(object) { |
| | | this.currentTask = { ...object, id: object.taskUserMongo.id, consumedHours: object.consumedHours, taskProgress: object.taskProgress } |
| | | // this.form = object |
| | | // this.form.fillDate = '' |
| | | // this.form.consumedHours = 0 |
| | | // console.log('object : ', object); |
| | | // this.form.taskUserMongo = object.taskUserMongo |
| | | this.crud.toAdd() |
| | | }, |
| | | getTaskProgress(id) { |
| | | // 任务更改查询任务进度 |
| | | crudTaskDaliy.getDailyTaskProgress({ taskUserId: id }).then(res => { |
| | |
| | | >小时</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="UID" prop="uid"> |
| | | <el-input |
| | | v-model="form.uid" |
| | | style="width: 340px;" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="任务进度" prop="newTaskProgress"> |
| | | <el-input |
| | | v-model="form.newTaskProgress" |
| | |
| | | :disabled="true" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item v-if="form.newTaskProgress === 100" label="任务状态"> |
| | | <el-form-item v-if="form.newTaskProgress === 100" label="任务状态1"> |
| | | <el-switch |
| | | v-if="form.taskStatus === taskSt || form.taskStatus === taskSo" |
| | | v-model="form.is_ok" |
| | |
| | | taskStatus: null, |
| | | remarks: null, |
| | | divideUserIds: [], |
| | | is_ok: null |
| | | is_ok: null, |
| | | uid: null |
| | | } |
| | | export default { |
| | | name: 'TaskUser', |
| | |
| | | if (!this.form.taskStatus) { |
| | | this.form.taskStatus = 'task_status_not_started' |
| | | } |
| | | if (this.form.is_ok === true) { |
| | | this.form.taskStatus = this.taskSt |
| | | } else if (this.form.is_ok === false) { |
| | | this.form.taskStatus = this.taskSo |
| | | } |
| | | if (!this.form.name) { |
| | | this.form.name = this.form.task.name |
| | | } |
| | |
| | | handleChange(value) { |
| | | if (value) { |
| | | this.taskStatusOne = '已完成' |
| | | this.form.taskStatus == this.taskSt |
| | | } else { |
| | | this.taskStatusOne = '未承认' |
| | | this.form.taskStatus == this.taskSo |
| | | } |
| | | }, |
| | | checkStartTime(time) { |
| | |
| | | :step="100" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="加班补助" prop="overTimeWage"> |
| | | <el-input v-model="form.overTimeWage" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="备注"> |
| | | <el-input v-model="form.remarks" style="width: 370px;" /> |
| | | </el-form-item> |
| | |
| | | {{ crud.toMoney(scope.row.performanceWage) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="performanceCoefficient" label="绩效系数" /> |
| | | <el-table-column prop="overTimeWage" label="平日加班补助"> |
| | | <template slot-scope="scope"> |
| | | <template v-if="scope.row.overTimeWage !== undefined"> |
| | | {{ crud.toMoney(scope.row.overTimeWage) }} |
| | | </template> |
| | | <template v-else> |
| | | {{ 'Auto' }} |
| | | </template> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="locked" label="锁定状态" /> |
| | | <el-table-column prop="remarks" label="备注" /> |
| | | <el-table-column v-if="checkPer(['admin','userLevelWage:edit','userLevelWage:del'])" label="操作" width="150px" align="center"> |
| | |
| | | import crudUser from '@/api/system/user' |
| | | import UploadExcelComponent from '@/components/UploadExcel/index.vue' |
| | | |
| | | const defaultForm = { id: null, userId: null, yearMonth: null, level: null, rank: null, basicWage: null, rankWage: null, performanceWage: null, locked: 0, remarks: null } |
| | | const defaultForm = { id: null, userId: null, yearMonth: null, level: null, rank: null, basicWage: null, rankWage: null, performanceWage: null, overTimeWage: null, locked: 0, remarks: null } |
| | | export default { |
| | | name: 'UserLevelWage', |
| | | components: { pagination, crudOperation, rrOperation, udOperation, UploadExcelComponent }, |