请假通知
This commit is contained in:
@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.common.core.constant.HttpStatus;
|
||||
import org.dromara.common.core.exception.ServiceException;
|
||||
import org.dromara.common.core.utils.DateUtils;
|
||||
@ -16,7 +17,6 @@ import org.dromara.common.satoken.utils.LoginHelper;
|
||||
import org.dromara.contractor.domain.SubConstructionUser;
|
||||
import org.dromara.contractor.domain.enums.SubConstructionUserRoleEnum;
|
||||
import org.dromara.contractor.service.ISubConstructionUserService;
|
||||
import org.dromara.contractor.service.ISubContractorService;
|
||||
import org.dromara.project.domain.BusAttendance;
|
||||
import org.dromara.project.domain.BusLeave;
|
||||
import org.dromara.project.domain.BusProjectTeam;
|
||||
@ -31,6 +31,9 @@ import org.dromara.project.service.IBusAttendanceService;
|
||||
import org.dromara.project.service.IBusLeaveService;
|
||||
import org.dromara.project.service.IBusProjectTeamMemberService;
|
||||
import org.dromara.project.service.IBusProjectTeamService;
|
||||
import org.dromara.system.domain.dto.notifications.SysNotificationsCreateBatchReq;
|
||||
import org.dromara.system.domain.enums.SysNotificationsEnum;
|
||||
import org.dromara.system.service.SysNotificationsService;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -46,6 +49,7 @@ import java.util.stream.Collectors;
|
||||
* @author lilemy
|
||||
* @date 2025-04-08
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class BusLeaveServiceImpl extends ServiceImpl<BusLeaveMapper, BusLeave>
|
||||
implements IBusLeaveService {
|
||||
@ -60,7 +64,7 @@ public class BusLeaveServiceImpl extends ServiceImpl<BusLeaveMapper, BusLeave>
|
||||
private ISubConstructionUserService constructionUserService;
|
||||
|
||||
@Resource
|
||||
private ISubContractorService contractorService;
|
||||
private SysNotificationsService notificationsService;
|
||||
|
||||
@Lazy
|
||||
@Resource
|
||||
@ -154,7 +158,19 @@ public class BusLeaveServiceImpl extends ServiceImpl<BusLeaveMapper, BusLeave>
|
||||
.eq(SubConstructionUser::getUserRole, SubConstructionUserRoleEnum.ADMIN.getValue())
|
||||
.list();
|
||||
if (CollUtil.isNotEmpty(constructionAdminUsers)) {
|
||||
|
||||
SysNotificationsCreateBatchReq notifications = new SysNotificationsCreateBatchReq();
|
||||
List<Long> idList = constructionAdminUsers.stream().map(SubConstructionUser::getUserId).toList();
|
||||
notifications.setRecipientIds(idList);
|
||||
notifications.setSenderId(constructionUser.getUserId());
|
||||
notifications.setType(SysNotificationsEnum.LEVEL_REVIEW.getCode());
|
||||
notifications.setTitle(SysNotificationsEnum.LEVEL_REVIEW.getDescription());
|
||||
notifications.setContent(SysNotificationsEnum.LEVEL_REVIEW.getDescription());
|
||||
// todo 跳转页面
|
||||
// notifications.setActionUrl();
|
||||
Boolean sendBatch = notificationsService.sendBatch(notifications);
|
||||
if (!sendBatch) {
|
||||
throw new ServiceException("通知发送失败", HttpStatus.ERROR);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -344,7 +360,7 @@ public class BusLeaveServiceImpl extends ServiceImpl<BusLeaveMapper, BusLeave>
|
||||
Long teamId = leave.getTeamId();
|
||||
String teamName = null;
|
||||
if (teamIdTeamMap.containsKey(teamId)) {
|
||||
teamName = projectTeamService.getVo(teamIdTeamMap.get(teamId).get(0)).getTeamName();
|
||||
teamName = projectTeamService.getVo(teamIdTeamMap.get(teamId).getFirst()).getTeamName();
|
||||
}
|
||||
leaveVo.setTeamName(teamName);
|
||||
// 添加审核状态
|
||||
|
@ -0,0 +1,27 @@
|
||||
package org.dromara.system.domain.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @author lilemy
|
||||
* @date 2025-07-24 17:50
|
||||
*/
|
||||
@Getter
|
||||
public enum SysNotificationsEnum {
|
||||
|
||||
LEVEL_REVIEW("1", "请假审批", "您有一条新的请假申请需要审核"),
|
||||
REISSUE_CARD_REVIEW("2", "补卡审批", "");
|
||||
|
||||
private final String code;
|
||||
|
||||
private final String message;
|
||||
|
||||
private final String description;
|
||||
|
||||
SysNotificationsEnum(String code, String message, String description) {
|
||||
this.code = code;
|
||||
this.message = message;
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user