| | |
| | | import me.zhengjie.modules.attendance.domain.AttendanceOvertime;
|
| | | import me.zhengjie.modules.attendance.repository.AttendanceBusinessTravelRepository;
|
| | | import me.zhengjie.modules.attendance.repository.AttendanceOvertimeRepository;
|
| | | import me.zhengjie.modules.constant.Constant;
|
| | | import me.zhengjie.modules.system.domain.SysConfigProportion;
|
| | | import me.zhengjie.modules.system.domain.User;
|
| | | import me.zhengjie.modules.system.repository.SysConfigProportionRepository;
|
| | |
| | | import java.time.format.DateTimeFormatter;
|
| | | import java.util.*;
|
| | | import java.util.function.Function;
|
| | | import java.util.stream.Collectors;
|
| | |
|
| | | /**
|
| | | * @author 姚增春
|
| | |
| | | return travelSubsidy;
|
| | | }
|
| | |
|
| | | @Override
|
| | | @Override
|
| | | public Double queryTravelAllowance(UserLevelWageQueryCriteria criteria) {
|
| | |
|
| | | DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
| | |
| | | LocalDateTime firstDayOfNextMonth = firstDayOfMonth.plusMonths(1);
|
| | |
|
| | | // 查询出差表的记录
|
| | | Integer bussSameMonthDays = attendanceBusinessTravelRepository.findByUserIdAndYearMonth(criteria.getUserId(), firstDayOfMonth, firstDayOfNextMonth);
|
| | | // 查询配置表
|
| | | SysConfigProportion sysConfigProportion = sysConfigProportionRepository.findByTitle("出差补助金额");
|
| | | List<AttendanceBusinessTravel> attendanceBusinessTravelList = attendanceBusinessTravelRepository.findByUserIdAndYearMonth(criteria.getUserId(), firstDayOfMonth, firstDayOfNextMonth);
|
| | | Map<String, Double> attendanceBusinessTravelMap = attendanceBusinessTravelList.stream().collect(Collectors.groupingBy(AttendanceBusinessTravel::getCategory, Collectors.summingDouble(AttendanceBusinessTravel::getTravelDuration)));
|
| | |
|
| | | BigDecimal travelSubsidy = new BigDecimal(0.0);
|
| | | // 出差补助金
|
| | | Double travelSubsidy = (bussSameMonthDays == null ? 0 : bussSameMonthDays) * sysConfigProportion.getProportion();
|
| | |
|
| | | return travelSubsidy;
|
| | | attendanceBusinessTravelMap.forEach((key, value) -> {
|
| | | if (key.equals(Constant.ATTENDANCE_BUSINESS_TRAVEL_CATEGORY_TRAVEL)) {
|
| | | // 出差补助金
|
| | | SysConfigProportion sysConfigProportion = sysConfigProportionRepository.findByTitle("出差补助金额");
|
| | | travelSubsidy.add(BigDecimal.valueOf(value * sysConfigProportion.getProportion()));
|
| | | } else if (key.equals(Constant.ATTENDANCE_BUSINESS_TRAVEL_CATEGORY_SAME_PLACE)) {
|
| | | // 客户现场补助金
|
| | | // SysConfigProportion sysConfigProportion = sysConfigProportionRepository.findByTitle("客户现场补助金额");
|
| | | travelSubsidy.add(BigDecimal.valueOf(value * 30)); // 按30元/天计算 TODO 待调整
|
| | | }
|
| | | });
|
| | | return travelSubsidy.doubleValue();
|
| | | }
|
| | |
|
| | | @Override
|
| | |
| | | List<Map<String, Object>> list = new ArrayList<>();
|
| | | for (UserLevelWageDto userLevelWage : all) {
|
| | | // 将实体类转换成DTO
|
| | | User user = userRepository.findById(userLevelWage.getUserId()).orElseGet(User::new);;
|
| | | User user = userRepository.findById(userLevelWage.getUserId()).orElseGet(User::new);
|
| | |
|
| | | Map<String, Object> map = new LinkedHashMap<>();
|
| | | map.put("员工姓名", user.getNickName());
|