通知
This commit is contained in:
@ -307,7 +307,6 @@
|
|||||||
<artifactId>snail-job-client-job-core</artifactId>
|
<artifactId>snail-job-client-job-core</artifactId>
|
||||||
<version>${snailjob.version}</version>
|
<version>${snailjob.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- 加密包引入 -->
|
<!-- 加密包引入 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.bouncycastle</groupId>
|
<groupId>org.bouncycastle</groupId>
|
||||||
|
@ -107,10 +107,10 @@ public class AuthController {
|
|||||||
// 登录
|
// 登录
|
||||||
LoginVo loginVo = IAuthStrategy.login(body, client, grantType);
|
LoginVo loginVo = IAuthStrategy.login(body, client, grantType);
|
||||||
|
|
||||||
Long userId = LoginHelper.getUserId();
|
// Long userId = LoginHelper.getUserId();
|
||||||
scheduledExecutorService.schedule(() -> {
|
// scheduledExecutorService.schedule(() -> {
|
||||||
chatGroupService.createSystem(userId,client.getClientKey());
|
// chatGroupService.createSystem(userId,client.getClientKey());
|
||||||
}, 5, TimeUnit.SECONDS);
|
// }, 5, TimeUnit.SECONDS);
|
||||||
return R.ok(loginVo);
|
return R.ok(loginVo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -271,18 +271,18 @@ public class DesVolumeFileServiceImpl extends ServiceImpl<DesVolumeFileMapper, D
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 过程文件
|
// 过程文件
|
||||||
if (CollectionUtil.isNotEmpty(req.getCancellationIds())) {
|
// if (CollectionUtil.isNotEmpty(req.getCancellationIds())) {
|
||||||
List<DesVolumeFile> existingFiles = baseMapper.selectList(new LambdaQueryWrapper<DesVolumeFile>()
|
// List<DesVolumeFile> existingFiles = baseMapper.selectList(new LambdaQueryWrapper<DesVolumeFile>()
|
||||||
.eq(DesVolumeFile::getVolumeCatalogId, req.getVolumeCatalogId())
|
// .eq(DesVolumeFile::getVolumeCatalogId, req.getVolumeCatalogId())
|
||||||
.eq(DesVolumeFile::getType, DesVolumeFile.PROCESS)
|
// .eq(DesVolumeFile::getType, DesVolumeFile.PROCESS)
|
||||||
.orderByDesc(DesVolumeFile::getVersion));
|
// .orderByDesc(DesVolumeFile::getVersion));
|
||||||
if (!existingFiles.isEmpty()) {
|
// if (!existingFiles.isEmpty()) {
|
||||||
DesVolumeFile first = existingFiles.getFirst();
|
// DesVolumeFile first = existingFiles.getFirst();
|
||||||
if (!BusinessStatusEnum.FINISH.getStatus().equals(first.getAuditStatus())) {
|
// if (!BusinessStatusEnum.FINISH.getStatus().equals(first.getAuditStatus())) {
|
||||||
throw new ServiceException("文件尚未审核完成,请勿重复上传");
|
// throw new ServiceException("文件尚未审核完成,请勿重复上传");
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,182 @@
|
|||||||
|
package org.dromara.job.attendance;
|
||||||
|
|
||||||
|
import com.aizuda.snailjob.client.job.core.enums.AllocationAlgorithmEnum;
|
||||||
|
import com.aizuda.snailjob.client.job.core.enums.TriggerTypeEnum;
|
||||||
|
import com.aizuda.snailjob.client.job.core.openapi.SnailJobOpenApi;
|
||||||
|
import com.aizuda.snailjob.common.core.enums.BlockStrategyEnum;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.dromara.project.domain.BusAttendanceRule;
|
||||||
|
import org.dromara.project.domain.BusProject;
|
||||||
|
import org.dromara.project.service.IBusAttendanceRuleService;
|
||||||
|
import org.dromara.project.service.IBusProjectService;
|
||||||
|
import org.springframework.context.annotation.Lazy;
|
||||||
|
import org.springframework.scheduling.annotation.Async;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.time.LocalTime;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Component
|
||||||
|
public class AttendanceJobUtil {
|
||||||
|
|
||||||
|
public static final String CLOCK_IN_REMINDER = "clockInReminder";
|
||||||
|
|
||||||
|
public static final String CLOCK_OUT_REMINDER = "clockOutReminder";
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private IBusProjectService projectService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
@Lazy
|
||||||
|
private IBusAttendanceRuleService attendanceRuleService;
|
||||||
|
|
||||||
|
@Async
|
||||||
|
public void addClusterJob(BusAttendanceRule rule) {
|
||||||
|
|
||||||
|
BusProject project = projectService.getById(rule.getProjectId());
|
||||||
|
String projectName = project.getProjectName();
|
||||||
|
|
||||||
|
String jobName1 = projectName + "上班打卡提醒";
|
||||||
|
LocalTime clockInTime = rule.getClockInTime();
|
||||||
|
//提前10分钟
|
||||||
|
LocalTime clockInReminderTime = clockInTime.minusMinutes(10);
|
||||||
|
String dailyCron1 = toDailyCron(clockInReminderTime);
|
||||||
|
|
||||||
|
Long execute1 = SnailJobOpenApi.addClusterJob()
|
||||||
|
.setRouteKey(AllocationAlgorithmEnum.RANDOM)
|
||||||
|
.setJobName(jobName1)
|
||||||
|
.setExecutorInfo(CLOCK_IN_REMINDER)
|
||||||
|
.setExecutorTimeout(30)
|
||||||
|
.setDescription("add")
|
||||||
|
.setBlockStrategy(BlockStrategyEnum.DISCARD)
|
||||||
|
.setMaxRetryTimes(1)
|
||||||
|
.setTriggerType(TriggerTypeEnum.CRON)
|
||||||
|
.setTriggerInterval(dailyCron1)
|
||||||
|
.addArgsStr("projectId", rule.getProjectId())
|
||||||
|
.setRetryInterval(3)
|
||||||
|
.execute();
|
||||||
|
rule.setClockInJobId(execute1);
|
||||||
|
|
||||||
|
|
||||||
|
String jobName2 = projectName + "下班打卡提醒";
|
||||||
|
LocalTime clockOutTime = rule.getClockOutTime();
|
||||||
|
//后延10分钟
|
||||||
|
LocalTime clockOutReminderTime = clockOutTime.plusMinutes(10);
|
||||||
|
String dailyCron2 = toDailyCron(clockOutReminderTime);
|
||||||
|
|
||||||
|
|
||||||
|
Long execute = SnailJobOpenApi.addClusterJob()
|
||||||
|
.setRouteKey(AllocationAlgorithmEnum.RANDOM)
|
||||||
|
.setJobName(jobName2)
|
||||||
|
.setExecutorInfo(CLOCK_OUT_REMINDER)
|
||||||
|
.setExecutorTimeout(30)
|
||||||
|
.setDescription("add")
|
||||||
|
.setBlockStrategy(BlockStrategyEnum.DISCARD)
|
||||||
|
.setMaxRetryTimes(1)
|
||||||
|
.setTriggerType(TriggerTypeEnum.CRON)
|
||||||
|
.setTriggerInterval(dailyCron2)
|
||||||
|
.addArgsStr("projectId", rule.getProjectId())
|
||||||
|
.setRetryInterval(3)
|
||||||
|
.execute();
|
||||||
|
rule.setClockOutJobId(execute);
|
||||||
|
|
||||||
|
attendanceRuleService.updateById(rule);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Async
|
||||||
|
public void updateClusterJob(Long id) {
|
||||||
|
BusAttendanceRule rule = attendanceRuleService.getById(id);
|
||||||
|
BusProject project = projectService.getById(rule.getProjectId());
|
||||||
|
String projectName = project.getProjectName();
|
||||||
|
|
||||||
|
LocalTime clockInTime = rule.getClockInTime();
|
||||||
|
//提前10分钟
|
||||||
|
LocalTime clockInReminderTime = clockInTime.minusMinutes(10);
|
||||||
|
String dailyCron1 = toDailyCron(clockInReminderTime);
|
||||||
|
|
||||||
|
if (rule.getClockInJobId() != null) {
|
||||||
|
SnailJobOpenApi.updateClusterJob(rule.getClockInJobId())
|
||||||
|
.setTriggerType(TriggerTypeEnum.CRON)
|
||||||
|
.setTriggerInterval(dailyCron1)
|
||||||
|
.execute();
|
||||||
|
} else {
|
||||||
|
String jobName1 = projectName + "上班打卡提醒";
|
||||||
|
Long execute = SnailJobOpenApi.addClusterJob()
|
||||||
|
.setRouteKey(AllocationAlgorithmEnum.RANDOM)
|
||||||
|
.setJobName(jobName1)
|
||||||
|
.setExecutorInfo(CLOCK_IN_REMINDER)
|
||||||
|
.setExecutorTimeout(30)
|
||||||
|
.setDescription("add")
|
||||||
|
.setBlockStrategy(BlockStrategyEnum.DISCARD)
|
||||||
|
.setMaxRetryTimes(1)
|
||||||
|
.setTriggerType(TriggerTypeEnum.CRON)
|
||||||
|
.setTriggerInterval(dailyCron1)
|
||||||
|
.addArgsStr("projectId", rule.getProjectId())
|
||||||
|
.setRetryInterval(3)
|
||||||
|
.execute();
|
||||||
|
rule.setClockInJobId(execute);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
LocalTime clockOutTime = rule.getClockOutTime();
|
||||||
|
//后延10分钟
|
||||||
|
LocalTime clockOutReminderTime = clockOutTime.plusMinutes(10);
|
||||||
|
String dailyCron2 = toDailyCron(clockOutReminderTime);
|
||||||
|
|
||||||
|
if (rule.getClockOutJobId() != null) {
|
||||||
|
SnailJobOpenApi.updateClusterJob(rule.getClockOutJobId())
|
||||||
|
.setTriggerType(TriggerTypeEnum.CRON)
|
||||||
|
.setTriggerInterval(dailyCron2)
|
||||||
|
.execute();
|
||||||
|
} else {
|
||||||
|
String jobName2 = projectName + "下班打卡提醒";
|
||||||
|
Long execute = SnailJobOpenApi.addClusterJob()
|
||||||
|
.setRouteKey(AllocationAlgorithmEnum.RANDOM)
|
||||||
|
.setJobName(jobName2)
|
||||||
|
.setExecutorInfo(CLOCK_OUT_REMINDER)
|
||||||
|
.setExecutorTimeout(30)
|
||||||
|
.setDescription("add")
|
||||||
|
.setBlockStrategy(BlockStrategyEnum.DISCARD)
|
||||||
|
.setMaxRetryTimes(1)
|
||||||
|
.setTriggerType(TriggerTypeEnum.CRON)
|
||||||
|
.setTriggerInterval(dailyCron2)
|
||||||
|
.addArgsStr("projectId", rule.getProjectId())
|
||||||
|
.setRetryInterval(3)
|
||||||
|
.execute();
|
||||||
|
rule.setClockOutJobId(execute);
|
||||||
|
}
|
||||||
|
attendanceRuleService.updateById(rule);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Async
|
||||||
|
public void deleteClusterJob(List<BusAttendanceRule> rules) {
|
||||||
|
Set<Long> jobIds = rules.stream()
|
||||||
|
.flatMap(rule -> Stream.of(rule.getClockInJobId(), rule.getClockOutJobId())) // 提取两个 JobId
|
||||||
|
.filter(Objects::nonNull) // 过滤掉 null 值
|
||||||
|
.collect(Collectors.toSet()); // 收集
|
||||||
|
rules.stream().map(BusAttendanceRule::getClockInJobId).filter(Objects::nonNull).forEach(jobIds::add);
|
||||||
|
SnailJobOpenApi.deleteJob(jobIds).execute();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将LocalTime转换为每天执行的Cron表达式
|
||||||
|
*
|
||||||
|
* @param time 时间
|
||||||
|
* @return 每天在指定时间执行的Cron表达式
|
||||||
|
*/
|
||||||
|
public String toDailyCron(LocalTime time) {
|
||||||
|
int hour = time.getHour();
|
||||||
|
int minute = time.getMinute();
|
||||||
|
|
||||||
|
// Cron格式: 秒 分 时 日 月 周 年(可选)
|
||||||
|
return String.format("0 %d %d * * ?", minute, hour);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,109 @@
|
|||||||
|
package org.dromara.job.attendance;
|
||||||
|
|
||||||
|
|
||||||
|
import cn.hutool.json.JSONUtil;
|
||||||
|
import com.aizuda.snailjob.client.job.core.annotation.JobExecutor;
|
||||||
|
import com.aizuda.snailjob.client.job.core.dto.JobArgs;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.dromara.contractor.domain.SubConstructionUser;
|
||||||
|
import org.dromara.contractor.service.ISubConstructionUserService;
|
||||||
|
import org.dromara.project.domain.BusAttendanceRule;
|
||||||
|
import org.dromara.project.domain.BusProject;
|
||||||
|
import org.dromara.project.domain.BusUserProjectRelevancy;
|
||||||
|
import org.dromara.project.service.IBusAttendanceRuleService;
|
||||||
|
import org.dromara.project.service.IBusProjectService;
|
||||||
|
import org.dromara.project.service.IBusUserProjectRelevancyService;
|
||||||
|
import org.dromara.websocket.ChatServerHandler;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Component
|
||||||
|
public class AttendanceReminderJob {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private IBusUserProjectRelevancyService userProjectRelevancyService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ChatServerHandler chatServerHandler;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private IBusProjectService projectService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private IBusAttendanceRuleService attendanceRuleService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ISubConstructionUserService constructionUserService;
|
||||||
|
|
||||||
|
@JobExecutor(name = "clockInReminder")
|
||||||
|
public void clockInReminder(JobArgs jobArgs) {
|
||||||
|
Long projectId = JSONUtil.parseObj(jobArgs.getJobParams()).getLong("projectId");
|
||||||
|
log.info("项目ID:{},开始执行打卡提醒任务", projectId);
|
||||||
|
|
||||||
|
BusProject project = projectService.getById(projectId);
|
||||||
|
|
||||||
|
BusAttendanceRule rule = attendanceRuleService.getOne(Wrappers.<BusAttendanceRule>lambdaQuery()
|
||||||
|
.eq(BusAttendanceRule::getProjectId, projectId)
|
||||||
|
.last("limit 1")
|
||||||
|
);
|
||||||
|
|
||||||
|
if (rule == null || project == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//查询项目下的关联人员
|
||||||
|
List<BusUserProjectRelevancy> relevancyList = userProjectRelevancyService.list(Wrappers.lambdaQuery(BusUserProjectRelevancy.class)
|
||||||
|
.eq(BusUserProjectRelevancy::getProjectId, projectId));
|
||||||
|
String message = String.format("【%s项目】上班打卡提醒!请在 %s 前完成打卡。",
|
||||||
|
project.getProjectName(), rule.getClockInTime().toString());
|
||||||
|
Set<Long> collect = relevancyList.stream().map(BusUserProjectRelevancy::getUserId).collect(Collectors.toSet());
|
||||||
|
|
||||||
|
List<SubConstructionUser> list = constructionUserService.list(Wrappers.lambdaQuery(SubConstructionUser.class)
|
||||||
|
.in(SubConstructionUser::getSysUserId, collect));
|
||||||
|
Set<Long> list1 = list.stream().map(SubConstructionUser::getSysUserId).collect(Collectors.toSet());
|
||||||
|
|
||||||
|
for (Long userId : list1) {
|
||||||
|
chatServerHandler.sendSystemMessageToUser(userId, message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@JobExecutor(name = "clockOutReminder")
|
||||||
|
public void clockOutReminder(JobArgs jobArgs) {
|
||||||
|
Long projectId = JSONUtil.parseObj(jobArgs.getJobParams()).getLong("projectId");
|
||||||
|
log.info("项目ID:{},开始执行打卡提醒任务", projectId);
|
||||||
|
|
||||||
|
BusProject project = projectService.getById(projectId);
|
||||||
|
|
||||||
|
BusAttendanceRule rule = attendanceRuleService.getOne(Wrappers.<BusAttendanceRule>lambdaQuery()
|
||||||
|
.eq(BusAttendanceRule::getProjectId, projectId)
|
||||||
|
.last("limit 1")
|
||||||
|
);
|
||||||
|
|
||||||
|
if (rule == null || project == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//查询项目下的关联人员
|
||||||
|
List<BusUserProjectRelevancy> relevancyList = userProjectRelevancyService.list(Wrappers.lambdaQuery(BusUserProjectRelevancy.class)
|
||||||
|
.eq(BusUserProjectRelevancy::getProjectId, projectId));
|
||||||
|
String message = String.format("【%s项目】下班打卡提醒!请记得完成打卡。",
|
||||||
|
project.getProjectName());
|
||||||
|
Set<Long> collect = relevancyList.stream().map(BusUserProjectRelevancy::getUserId).collect(Collectors.toSet());
|
||||||
|
|
||||||
|
List<SubConstructionUser> list = constructionUserService.list(Wrappers.lambdaQuery(SubConstructionUser.class)
|
||||||
|
.in(SubConstructionUser::getSysUserId, collect));
|
||||||
|
Set<Long> list1 = list.stream().map(SubConstructionUser::getSysUserId).collect(Collectors.toSet());
|
||||||
|
|
||||||
|
for (Long userId : list1) {
|
||||||
|
chatServerHandler.sendSystemMessageToUser(userId, message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -92,5 +92,14 @@ public class BusAttendanceRule extends BaseEntity {
|
|||||||
*/
|
*/
|
||||||
private String type;
|
private String type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上班打卡提醒定时任务ID
|
||||||
|
*/
|
||||||
|
private Long clockInJobId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 下班打卡提醒定时任务ID
|
||||||
|
*/
|
||||||
|
private Long clockOutJobId;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.dromara.job.attendance.AttendanceJobUtil;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.dromara.project.domain.bo.BusAttendanceRuleBo;
|
import org.dromara.project.domain.bo.BusAttendanceRuleBo;
|
||||||
import org.dromara.project.domain.vo.BusAttendanceRuleVo;
|
import org.dromara.project.domain.vo.BusAttendanceRuleVo;
|
||||||
@ -35,6 +36,7 @@ public class BusAttendanceRuleServiceImpl extends ServiceImpl<BusAttendanceRuleM
|
|||||||
|
|
||||||
private final BusAttendanceRuleMapper baseMapper;
|
private final BusAttendanceRuleMapper baseMapper;
|
||||||
|
|
||||||
|
private final AttendanceJobUtil attendanceJobUtil;
|
||||||
/**
|
/**
|
||||||
* 查询考勤打卡规则
|
* 查询考勤打卡规则
|
||||||
*
|
*
|
||||||
@ -106,6 +108,7 @@ public class BusAttendanceRuleServiceImpl extends ServiceImpl<BusAttendanceRuleM
|
|||||||
if (flag) {
|
if (flag) {
|
||||||
bo.setId(add.getId());
|
bo.setId(add.getId());
|
||||||
}
|
}
|
||||||
|
attendanceJobUtil.addClusterJob(add);
|
||||||
return flag;
|
return flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -120,7 +123,9 @@ public class BusAttendanceRuleServiceImpl extends ServiceImpl<BusAttendanceRuleM
|
|||||||
BusAttendanceRule update = MapstructUtils.convert(bo, BusAttendanceRule.class);
|
BusAttendanceRule update = MapstructUtils.convert(bo, BusAttendanceRule.class);
|
||||||
validEntityBeforeSave(update);
|
validEntityBeforeSave(update);
|
||||||
setResultTime(update);
|
setResultTime(update);
|
||||||
return baseMapper.updateById(update) > 0;
|
int i = baseMapper.updateById(update);
|
||||||
|
attendanceJobUtil.updateClusterJob(bo.getId());
|
||||||
|
return i> 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -208,6 +213,9 @@ public class BusAttendanceRuleServiceImpl extends ServiceImpl<BusAttendanceRuleM
|
|||||||
if (isValid) {
|
if (isValid) {
|
||||||
//TODO 做一些业务上的校验,判断是否需要校验
|
//TODO 做一些业务上的校验,判断是否需要校验
|
||||||
}
|
}
|
||||||
|
List<BusAttendanceRule> busAttendanceRules = baseMapper.selectList(Wrappers.<BusAttendanceRule>lambdaQuery()
|
||||||
|
.in(BusAttendanceRule::getId, ids));
|
||||||
|
attendanceJobUtil.deleteClusterJob(busAttendanceRules);
|
||||||
return baseMapper.deleteByIds(ids) > 0;
|
return baseMapper.deleteByIds(ids) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,6 +42,7 @@ import org.dromara.system.domain.vo.SysOssVo;
|
|||||||
import org.dromara.system.domain.vo.SysUserVo;
|
import org.dromara.system.domain.vo.SysUserVo;
|
||||||
import org.dromara.system.service.ISysOssService;
|
import org.dromara.system.service.ISysOssService;
|
||||||
import org.dromara.system.service.ISysUserService;
|
import org.dromara.system.service.ISysUserService;
|
||||||
|
import org.dromara.websocket.ChatServerHandler;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
@ -92,6 +93,8 @@ public class BusAttendanceServiceImpl extends ServiceImpl<BusAttendanceMapper, B
|
|||||||
|
|
||||||
private final ISysUserService userService;
|
private final ISysUserService userService;
|
||||||
|
|
||||||
|
private final ChatServerHandler chatServerHandler;
|
||||||
|
|
||||||
// 出勤状态(正常、迟到、早退)
|
// 出勤状态(正常、迟到、早退)
|
||||||
private static final Set<String> ATTENDANCE_STATUS = new HashSet<>(Arrays.asList(BusAttendanceClockStatusEnum.NORMAL.getValue(),
|
private static final Set<String> ATTENDANCE_STATUS = new HashSet<>(Arrays.asList(BusAttendanceClockStatusEnum.NORMAL.getValue(),
|
||||||
BusAttendanceClockStatusEnum.LATE.getValue(), BusAttendanceClockStatusEnum.LEAVEEARLY.getValue()));
|
BusAttendanceClockStatusEnum.LATE.getValue(), BusAttendanceClockStatusEnum.LEAVEEARLY.getValue()));
|
||||||
@ -303,7 +306,10 @@ public class BusAttendanceServiceImpl extends ServiceImpl<BusAttendanceMapper, B
|
|||||||
// 上传人脸照
|
// 上传人脸照
|
||||||
SysOssVo upload = ossService.upload(file);
|
SysOssVo upload = ossService.upload(file);
|
||||||
attendance.setFacePic(upload.getOssId().toString());
|
attendance.setFacePic(upload.getOssId().toString());
|
||||||
|
chatServerHandler.sendSystemMessageToUser(userId, "打卡成功");
|
||||||
return this.save(attendance);
|
return this.save(attendance);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user