| | |
| | | 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());
|
| | | } |
| | | } |