Compare commits

..

No commits in common. "0a412a3da38ad04b8f73437c489234f550ca1ad6" and "67acf8550a588b203fa223d0a3e1c6fcc2f92b9e" have entirely different histories.

10 changed files with 7 additions and 219 deletions

View File

@ -7,7 +7,6 @@ import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import javax.annotation.security.PermitAll;
import java.util.List;
import java.util.Map;
@ -19,6 +18,5 @@ public interface BpmOAGoOutApi {
@GetMapping(PREFIX + "/getGoOutByTime")
@Operation(summary = "获取当日以及昨日外出的用户编号")
@PermitAll
CommonResult<Map<String, List<Long>>> getLeaveListByTime();
}

View File

@ -20,8 +20,7 @@ public enum BpmTaskRuleScriptEnum {
LEADER_X3(22L, "流程发起人的三级领导"),
LEADER_X4(23L, "审批人的一级领导"),
LEADER_X5(24L, "调岗部门领导"),
LEADER_X6(25L, "分配任务的责任人"),
LEADER_X7(26L, "入职部门领导");
LEADER_X6(25L, "分配任务的责任人");
/**
* 脚本编号

View File

@ -7,7 +7,6 @@ import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.annotation.security.PermitAll;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.HashMap;
@ -31,7 +30,6 @@ public class BpmOAGoOutApiImpl implements BpmOAGoOutApi{
private BpmOAGoOutService goOutService;
@Override
@PermitAll
public CommonResult<Map<String, List<Long>>> getLeaveListByTime() {
// 定义格式化模式

View File

@ -1,69 +0,0 @@
package cn.iocoder.yudao.module.bpm.framework.flowable.core.behavior.script.impl;
import cn.hutool.core.collection.CollUtil;
import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.task.BpmTaskRespVO;
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOAEntryDO;
import cn.iocoder.yudao.module.bpm.enums.definition.BpmTaskRuleScriptEnum;
import cn.iocoder.yudao.module.bpm.framework.flowable.core.behavior.script.BpmTaskAssignScript;
import cn.iocoder.yudao.module.bpm.service.oa.BpmOAEntryService;
import cn.iocoder.yudao.module.bpm.service.task.BpmProcessInstanceService;
import cn.iocoder.yudao.module.bpm.service.task.BpmTaskService;
import cn.iocoder.yudao.module.system.api.dept.DeptApi;
import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO;
import org.flowable.engine.delegate.DelegateExecution;
import org.flowable.engine.runtime.ProcessInstance;
import org.springframework.context.annotation.Lazy;
import javax.annotation.Resource;
import java.util.List;
import java.util.Set;
import static cn.iocoder.yudao.framework.common.util.collection.SetUtils.asSet;
import static java.util.Collections.emptySet;
public class BpmTaskEntryLeaderScript implements BpmTaskAssignScript {
@Resource
private DeptApi deptApi;
@Resource
private BpmOAEntryService entryService;
@Resource
@Lazy // 解决循环依赖
private BpmProcessInstanceService bpmProcessInstanceService;
@Resource
@Lazy // 解决循环依赖
private BpmTaskService bpmTaskService ;
@Override
public Set<Long> calculateTaskCandidateUsers(DelegateExecution execution) {
// 获得发起人
ProcessInstance processInstance = bpmProcessInstanceService.getProcessInstance(execution.getProcessInstanceId());
List<BpmTaskRespVO> bpmTaskRespVOs = bpmTaskService.getTaskListByProcessInstanceId(processInstance.getProcessInstanceId());
if (CollUtil.isEmpty(bpmTaskRespVOs)) {
return emptySet();
}
//根据流程实例ID 取到调岗流程表单
BpmOAEntryDO entryDO = entryService.getEntryByProcessInstanceId(processInstance.getProcessInstanceId());
//获取调岗部门ID
Long deptId = entryDO.getEntryDeptId();
//根据部门ID 获取部门信息
DeptRespDTO dept = deptApi.getDept(deptId).getCheckedData();
if (dept.getLevel() > 3) { //判断部门层级
String [] flag = dept.getFlag().split("-");
dept = deptApi.getDept(Long.valueOf(flag[3])).getCheckedData();
}
return dept.getLeaderUserId() != null ? asSet(dept.getLeaderUserId()) : emptySet();
}
@Override
public BpmTaskRuleScriptEnum getEnum() {
return BpmTaskRuleScriptEnum.LEADER_X7;
}
}

View File

@ -209,14 +209,6 @@ public class LogInstanceController {
return success(readUserVO);
}
@GetMapping("/get-unRead")
@Operation(summary = "获取当前登录用户可查看日志未读的数量")
@PreAuthorize("@ss.hasPermission('system:view-log:query')")
public CommonResult<Long> unRead() {
return success(logReadService.getUnRead(getLoginUserId()));
}
@GetMapping("/export-excel")
@Operation(summary = "导出日志实例 Excel")
@PreAuthorize("@ss.hasPermission('system:log-instance:export')")

View File

@ -62,7 +62,7 @@ public interface LogInstanceMapper extends BaseMapperX<LogInstanceDO> {
queryWrapper.inIfPresent(LogInstanceDO::getStartUserId, userIds);
}
return selectPage(reqVO, queryWrapper.orderByDesc(LogInstanceDO::getTime));
return selectPage(reqVO, queryWrapper);
}

View File

@ -1,19 +1,11 @@
package cn.iocoder.yudao.module.system.job.birthday;
import cn.hutool.json.JSONObject;
import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
import cn.iocoder.yudao.framework.tenant.core.job.TenantJob;
import cn.iocoder.yudao.module.system.api.subscribe.SubscribeMessageSendApi;
import cn.iocoder.yudao.module.system.convert.notice.NoticeConvert;
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
import cn.iocoder.yudao.module.system.dal.mysql.user.AdminUserMapper;
import cn.iocoder.yudao.module.system.service.permission.PermissionService;
import cn.iocoder.yudao.module.system.service.user.AdminUserService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.context.XxlJobContext;
import com.xxl.job.core.handler.annotation.XxlJob;
import io.netty.util.internal.StringUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.stereotype.Component;
@ -22,27 +14,16 @@ import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.List;
import java.util.Set;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList;
@Component
@Slf4j
@EnableScheduling
public class BirthdayJob {
@Resource
private AdminUserMapper adminUserMapper;
@Resource
private AdminUserService userService;
@Resource
private PermissionService permissionService;
@Resource
private SubscribeMessageSendApi subscribeMessageSendApi;
/**
* 生日提醒
*
@ -51,44 +32,15 @@ public class BirthdayJob {
@XxlJob("birthdayJob")
@TenantJob // --- 这个注解 会将租户列表拉出来 完了后逐个租户执行 定时任务需要注意
public ReturnT<String> execute() {
// 生日提醒
birthdayRemind();
// 返回执行成功
return ReturnT.SUCCESS;
}
private void birthdayRemind() {
String time = LocalDateTime.now().format(DateTimeFormatter.ofPattern("MM-dd"));
// -- 获取当天月日 生日的人员列表
List<AdminUserDO> list = adminUserMapper.selectList(new LambdaQueryWrapper<AdminUserDO>()
.like(AdminUserDO::getBirthdayDay, time));
if (!list.isEmpty()) {
//获取参数
XxlJobContext xxlJobContext = XxlJobContext.getXxlJobContext();
String jobParam = xxlJobContext.getJobParam();
if (!StringUtil.isNullOrEmpty(jobParam)) {
// 解析参数
JSONObject object = new JSONObject(jobParam);
Long roleId = object.getLong("roleId");
Set<Long> userIds = permissionService.getUserRoleIdListByRoleId(CollectionUtils.singleton(roleId));
//获得用户组中 用户信息
List<AdminUserDO> userDOs = userService.getUserList(userIds);
for (AdminUserDO adminUserDO : userDOs) {
if( adminUserDO.getOpenId() != null && !adminUserDO.getOpenId().isEmpty()) {
subscribeMessageSendApi.sendCompanyNotice(NoticeConvert.INSTANCE.convertBirthday(
adminUserDO.getOpenId(), "formal"));
}
}
log.info("生日提醒,生日为{},人员为{}", time, convertList(list, AdminUserDO::getNickname));
}
}
// TODO: 2024/9/2 发送短信未指定人
log.info("生日提醒,生日为{},人员为{}", time, list);
}
// 返回执行成功
return ReturnT.SUCCESS;
}
}

View File

@ -1,67 +0,0 @@
package cn.iocoder.yudao.module.system.job.fieldwork;
import cn.hutool.core.collection.CollectionUtil;
import cn.iocoder.yudao.framework.tenant.core.job.TenantJob;
import cn.iocoder.yudao.module.bpm.api.oa.BpmOAGoOutApi;
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
import cn.iocoder.yudao.module.system.dal.mysql.user.AdminUserMapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
@Component
@Slf4j
@EnableScheduling
public class FieldworkJob {
@Resource
private AdminUserMapper adminUserMapper;
@Resource
private BpmOAGoOutApi goOutApi;
/**
* 外勤打卡权限调整 针对外出申请流程
*/
@XxlJob("fieldworkJob")
@TenantJob // --- 这个注解 会将租户列表拉出来 完了后逐个租户执行 定时任务需要注意
public ReturnT<String> execute() {
// 外勤打卡权限变更
try {
// 获取用户编号
Map<String, List<Long>> goOutList = goOutApi.getLeaveListByTime().getCheckedData();
if (CollectionUtil.isNotEmpty(goOutList.get("now"))) {
// 讲需要当天外出的用户设置外勤打卡权限
adminUserMapper.update(new AdminUserDO().setFieldworkFlag(1).setFieldworkType(2),
new LambdaQueryWrapper<AdminUserDO>()
.in(AdminUserDO::getId, goOutList.get("now"))
.ne(AdminUserDO::getFieldworkType, 1));
}
if (CollectionUtil.isNotEmpty(goOutList.get("yesterday"))) {
// 将昨日外出的用户关闭外勤打卡权限
adminUserMapper.update(new AdminUserDO().setFieldworkFlag(0).setFieldworkType(0),
new LambdaQueryWrapper<AdminUserDO>()
.in(AdminUserDO::getId, goOutList.get("yesterday"))
.eq(AdminUserDO::getFieldworkType, 2));
}
}catch (Exception ex) {
log.info(ex.toString());
}
// 返回执行成功
return ReturnT.SUCCESS;
}
}

View File

@ -49,11 +49,4 @@ public interface LogReadService {
* @return 阅读状态
*/
Boolean isReadByLogId(Long logId);
/**
* 获取当前登录用户可查看日志未读的数量
* @param userId 用户编号
* @return 未读数量
*/
Long getUnRead(Long userId);
}

View File

@ -86,12 +86,4 @@ public class LogReadServiceImpl implements LogReadService{
return count > 0L;
}
@Override
public Long getUnRead(Long userId) {
return logReadMapper.selectCount(new LambdaQueryWrapperX<LogReadDo>()
.eq(LogReadDo::getReadUserId, userId)
.eq(LogReadDo::getReadStatus, 0));
}
}