From 379ce97ab54ce4e3e153baa005c6706abf401c72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BD=97=E6=88=90?= <2847920761@qq.com> Date: Mon, 31 Mar 2025 11:26:37 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=AF=B7=E5=81=87?= =?UTF-8?q?=E5=AE=9A=E6=97=B6=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/ruoyi/task/BusinessTask.java | 112 +++++++++++------- ...pUserApplyForPayrollSettlementDetails.java | 2 +- .../wgz/service/impl/WgzLeaveServiceImpl.java | 6 +- 3 files changed, 73 insertions(+), 47 deletions(-) diff --git a/ruoyi-system/src/main/java/com/ruoyi/task/BusinessTask.java b/ruoyi-system/src/main/java/com/ruoyi/task/BusinessTask.java index 602c4e9..e596b54 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/task/BusinessTask.java +++ b/ruoyi-system/src/main/java/com/ruoyi/task/BusinessTask.java @@ -3,14 +3,17 @@ package com.ruoyi.task; import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.lang.Console; import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.toolkit.SqlHelper; import com.ruoyi.bgt.domain.BgtProjectRecruit; import com.ruoyi.bgt.domain.BgtProjectRecruitApply; import com.ruoyi.bgt.domain.dto.BgtScoreDTO; +import com.ruoyi.bgt.service.IBgtMessageService; import com.ruoyi.bgt.service.IBgtProjectRecruitApplyService; import com.ruoyi.bgt.service.IBgtProjectRecruitService; import com.ruoyi.common.constants.WgzAndBgtMessageConstant; import com.ruoyi.common.enums.RecruitApplyStatus; import com.ruoyi.common.enums.RecruitStatus; +import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.fbs.domain.FbsProjectTask; import com.ruoyi.fbs.service.IFbsProjectTaskService; import com.ruoyi.wgz.domain.WgzAttendance; @@ -24,6 +27,8 @@ import com.ruoyi.wgz.service.IWgzScoreRecordService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.transaction.reactive.TransactionalOperator; import java.math.BigDecimal; import java.time.LocalDate; @@ -67,6 +72,12 @@ public class BusinessTask @Autowired private IWgzScoreRecordService wgzScoreRecordService; + @Autowired + private IBgtMessageService iBgtMessageService; + + @Autowired + private IBgtProjectRecruitService iBgtProjectRecruitService; + public void ryNoParams() { Console.log("-------------------------------------------------------------------------"); @@ -272,7 +283,7 @@ public class BusinessTask WgzAttendance attendance = new WgzAttendance() .setId(one.getId()) .setMissedOut(1) - .setExceptionType("4,").setUpdateBy("系统").setCreateBy("系统"); + .setExceptionType(one.getExceptionType()+"4,").setUpdateBy("系统").setCreateBy("系统"); lists.add(attendance); //添加消息提醒 WgzMessage wgzMessage = new WgzMessage(). @@ -306,7 +317,12 @@ public class BusinessTask /** * 请假 */ + @Transactional public void leave(){ + System.out.println("????????????????"); + System.out.println("????????????????"); + System.out.println("????????????????"); + System.out.println("????????????????"); List updataList = new ArrayList<>(); List attendanceList = new ArrayList<>(); List messagesList = new ArrayList<>(); @@ -335,51 +351,61 @@ public class BusinessTask setSubheading(WgzAndBgtMessageConstant.wgzMessage(mp,"118")). setMessageLargeType(LARGE_OTHER). setMessageSmallType(SMALL_SYSTEM); - messagesList.add(wgzMessage); } + messagesList.add(wgzMessage); + //状态超时需要把对应消息的状态变更为【不需要操作】 + BgtProjectRecruit recruit = iBgtProjectRecruitService.getById(wgzLeave.getApplyKey()); + iBgtMessageService.operation( + USERTYPE_WGZ, + SecurityUtils.getAppUserId(), + USERTYPE_BGT, + recruit.getUserId(), + wgzLeave.getId(), + SqlHelper.table(WgzLeave.class).getTableName() + ); + } } - if (iWgzLeaveService.updateBatchById(updataList)){ - //3、发送请假超时的消息 - if (!iWgzMessageService.saveBatch(messagesList)){ - log.error("批量添加请假超时消息失败!"); - } - //4、获取所有审批成功的请假消息,然后批量新增请假打卡数据到考勤表(如若需要日薪就需要连表查询) - List wgzLeaveListTwo = iWgzLeaveService.list( - Wrappers.lambdaQuery() - .eq(WgzLeave::getAuditorType, "2") - ); - for (WgzLeave wgzLeave : wgzLeaveListTwo) { - //获取请假的具体天数(目前的请假是全天,没有分时间段) - List formattedDates = getFormattedDates(wgzLeave.getStartTime(), wgzLeave.getEndTime()); - //业务逻辑 - for (LocalDate formattedDate : formattedDates) { - //如果formattedDate小于当前日期,就跳过 - if (formattedDate.isBefore(now)){ - continue; - } - //查询当前人、当前项目、当前打卡时间是否存在,如若存在就跳过 - int count = iWgzAttendanceService.count( - Wrappers.lambdaQuery() - .eq(WgzAttendance::getUserId, wgzLeave.getUserId()) - .eq(WgzAttendance::getRecruitId, wgzLeave.getRecruitId()) - .eq(WgzAttendance::getDate, formattedDate) - ); - if (count > 0){ - continue; - } - //获取到请假天数 - WgzAttendance wgzAttendance = new WgzAttendance(). - setRecruitId(wgzLeave.getRecruitId()). - setApplyKey(wgzLeave.getApplyKey()). - setUserId(wgzLeave.getUserId()). - setLeaveMarkId(wgzLeave.getId()). - setDate(formattedDate). - setExceptionType("6,"); - attendanceList.add(wgzAttendance); + //3、发送请假超时的消息,然后批量修改请假消息的状态为超时且发送超时消息 + if (!updataList.isEmpty()){ + iWgzLeaveService.updateBatchById(updataList); + iWgzMessageService.saveBatch(messagesList); + } + //4、获取所有审批成功的请假消息,然后批量新增请假打卡数据到考勤表(如若需要日薪就需要连表查询) + List wgzLeaveListTwo = iWgzLeaveService.list( + Wrappers.lambdaQuery() + .eq(WgzLeave::getAuditorType, "2") + ); + for (WgzLeave wgzLeave : wgzLeaveListTwo) { + //获取请假的具体天数(目前的请假是全天,没有分时间段) + List formattedDates = getFormattedDates(wgzLeave.getStartTime(), wgzLeave.getEndTime()); + //业务逻辑 + for (LocalDate formattedDate : formattedDates) { + //如果formattedDate小于当前日期,就跳过 + if (formattedDate.isBefore(now)){ + continue; } + //查询当前人、当前项目、当前打卡时间是否存在,如若存在就跳过 + int count = iWgzAttendanceService.count( + Wrappers.lambdaQuery() + .eq(WgzAttendance::getUserId, wgzLeave.getUserId()) + .eq(WgzAttendance::getRecruitId, wgzLeave.getRecruitId()) + .eq(WgzAttendance::getDate, formattedDate) + ); + if (count > 0){ + continue; + } + //获取到请假天数 + WgzAttendance wgzAttendance = new WgzAttendance(). + setRecruitId(wgzLeave.getRecruitId()). + setApplyKey(wgzLeave.getApplyKey()). + setUserId(wgzLeave.getUserId()). + setLeaveMarkId(wgzLeave.getId()). + setDate(formattedDate). + setExceptionType("7,").setUpdateBy("系统").setCreateBy("系统"); + attendanceList.add(wgzAttendance); } - if (!iWgzAttendanceService.addAMissingCardRecord(attendanceList)){ - log.error("批量添加上班缺卡信息失败!"); - } + } + if (!attendanceList.isEmpty()){ + iWgzAttendanceService.addAMissingCardRecord(attendanceList); } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wgz/bo/res/WgzAppUserApplyForPayrollSettlementDetails.java b/ruoyi-system/src/main/java/com/ruoyi/wgz/bo/res/WgzAppUserApplyForPayrollSettlementDetails.java index c10467c..8202607 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wgz/bo/res/WgzAppUserApplyForPayrollSettlementDetails.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wgz/bo/res/WgzAppUserApplyForPayrollSettlementDetails.java @@ -45,7 +45,7 @@ public class WgzAppUserApplyForPayrollSettlementDetails { @ApiModelProperty("结算人") private String auditorUserName; - @ApiModelProperty("结算时间") + @ApiModelProperty("申请时间") private LocalDateTime createTime; @ApiModelProperty("工资金额") diff --git a/ruoyi-system/src/main/java/com/ruoyi/wgz/service/impl/WgzLeaveServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wgz/service/impl/WgzLeaveServiceImpl.java index dc39d27..955e48d 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wgz/service/impl/WgzLeaveServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wgz/service/impl/WgzLeaveServiceImpl.java @@ -253,11 +253,11 @@ public class WgzLeaveServiceImpl extends ServicePlusImpl Date: Tue, 1 Apr 2025 13:39:58 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/resources/mapper/bgt/BgtProjectRecruitApplyMapper.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ruoyi-system/src/main/resources/mapper/bgt/BgtProjectRecruitApplyMapper.xml b/ruoyi-system/src/main/resources/mapper/bgt/BgtProjectRecruitApplyMapper.xml index c085baa..d389fd8 100644 --- a/ruoyi-system/src/main/resources/mapper/bgt/BgtProjectRecruitApplyMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/bgt/BgtProjectRecruitApplyMapper.xml @@ -151,7 +151,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and (wa.late = 0 and wa.early_leave = 0 and wa.missed_in = 0 and wa.missed_out = 0) and leave_mark_id is null - AND ((wa.late = 1 OR wa.missed_in = 1 OR wa.early_leave = 1 OR wa.missed_out = 1) + AND ((wa.id is null OR wa.late = 1 OR wa.missed_in = 1 OR wa.early_leave = 1 OR wa.missed_out = 1) AND leave_mark_id IS NULL) From 8effac832a88cd7c04b221345a6b493e523705bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BD=97=E6=88=90?= <2847920761@qq.com> Date: Tue, 1 Apr 2025 15:58:55 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E6=97=A5=E6=8A=A5=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/WgzDailyClockServiceImpl.java | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/ruoyi-system/src/main/java/com/ruoyi/wgz/service/impl/WgzDailyClockServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wgz/service/impl/WgzDailyClockServiceImpl.java index d12ed41..fd946e2 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wgz/service/impl/WgzDailyClockServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wgz/service/impl/WgzDailyClockServiceImpl.java @@ -33,14 +33,12 @@ import com.ruoyi.wgz.bo.res.WgzAppCheckDailyNewspaperRes; import com.ruoyi.wgz.bo.res.WgzAppUserDailyRecordRes; import com.ruoyi.wgz.bo.res.WgzUserDailyCalendarRes; import com.ruoyi.wgz.bo.rests.WgzAppAttachmentAcquisitionTwo; +import com.ruoyi.wgz.domain.WgzAttendance; import com.ruoyi.wgz.domain.WgzDailyClock; import com.ruoyi.wgz.domain.WgzMessage; import com.ruoyi.wgz.domain.WgzUser; import com.ruoyi.wgz.mapper.WgzDailyClockMapper; -import com.ruoyi.wgz.service.IWgzDailyClockService; -import com.ruoyi.wgz.service.IWgzLeaveService; -import com.ruoyi.wgz.service.IWgzMessageService; -import com.ruoyi.wgz.service.IWgzUserService; +import com.ruoyi.wgz.service.*; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -91,6 +89,9 @@ public class WgzDailyClockServiceImpl extends ServicePlusImpl apply1 = new LambdaQueryWrapper() + .eq(WgzAttendance::getApplyKey, by.getId()) + .eq(WgzAttendance::getUserId, appUserId) + .orderByAsc(WgzAttendance::getId) + .last("limit 1"); + WgzAttendance one1 = iWgzAttendanceService.getOne(apply1); + if (one1 != null) { + LocalDate date = one1.getDate(); + fh.put(date.toString(),new WgzAppAttachmentAcquisitionTwo().setStatus("1")); + } //5、查看fh的key最大和最小的日期之间差哪些日期,然后补齐数据 LocalDate minDate = fh.keySet().stream().map(LocalDate::parse).min(LocalDate::compareTo).orElse(null); LocalDate now = LocalDate.now(); From 38f7abfa62f8d6c430844f6c166d9bb28750627a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BD=97=E6=88=90?= <2847920761@qq.com> Date: Tue, 1 Apr 2025 17:06:00 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E8=A1=A5=E5=8D=A1=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E6=8E=92=E9=99=A4=E6=8E=89=E8=AF=B7=E5=81=87=E7=9A=84=E6=95=B0?= =?UTF-8?q?=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ruoyi/wgz/service/impl/WgzAttendanceServiceImpl.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ruoyi-system/src/main/java/com/ruoyi/wgz/service/impl/WgzAttendanceServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wgz/service/impl/WgzAttendanceServiceImpl.java index bf95823..992079a 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wgz/service/impl/WgzAttendanceServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wgz/service/impl/WgzAttendanceServiceImpl.java @@ -364,7 +364,8 @@ public class WgzAttendanceServiceImpl extends ServicePlusImpl apply = new LambdaQueryWrapper(). eq(WgzAttendance::getUserId, appUserId). - eq(WgzAttendance::getRecruitId, appById.getId()) + eq(WgzAttendance::getRecruitId, appById.getId()). + isNull(WgzAttendance::getLeaveMarkId) .and(wrapper -> wrapper .eq(WgzAttendance::getLate, 1) .or() From a1bc546a499e5b8eb6ecbff9546ce5aa936e2ade Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BD=97=E6=88=90?= <2847920761@qq.com> Date: Tue, 1 Apr 2025 17:48:19 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E8=A1=A5=E5=8D=A1=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E6=8E=92=E9=99=A4=E6=8E=89=E8=AF=B7=E5=81=87=E7=9A=84=E6=95=B0?= =?UTF-8?q?=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ruoyi/wgz/service/impl/WgzAttendanceServiceImpl.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ruoyi-system/src/main/java/com/ruoyi/wgz/service/impl/WgzAttendanceServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wgz/service/impl/WgzAttendanceServiceImpl.java index 992079a..9fc98a3 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wgz/service/impl/WgzAttendanceServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wgz/service/impl/WgzAttendanceServiceImpl.java @@ -387,11 +387,11 @@ public class WgzAttendanceServiceImpl extends ServicePlusImpl