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] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=AF=B7=E5=81=87=E5=AE=9A?= =?UTF-8?q?=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