当前角色问题解决

This commit is contained in:
2025-05-06 10:04:29 +08:00
parent 4c69575084
commit a1e2b71141
12 changed files with 76 additions and 51 deletions

View File

@@ -230,7 +230,7 @@ public class SysRoleController extends BaseController {
* 获取当前用户的role对象
*/
@GetMapping("/currentRole")
public R<SysRole> currentRole() {
public R<List<SysRole>> currentRole() {
return R.ok(roleService.getCurrentRole());
}
}

View File

@@ -85,4 +85,9 @@ public class SysOaAttendanceVo extends SysOaAttendance {
private Double overTime;
// 请假天数
private Long absenceDays;
private Long tripDays;
}

View File

@@ -120,6 +120,11 @@ public class OaProgressServiceImpl implements IOaProgressService {
if(isValid){
//TODO 做一些业务上的校验,判断是否需要校验
}
for (Long id : ids) {
QueryWrapper<OaProgress> oaProgressQueryWrapper = new QueryWrapper<>();
oaProgressQueryWrapper.eq("parent_id", id);
baseMapper.delete(oaProgressQueryWrapper);
}
return baseMapper.deleteBatchIds(ids) > 0;
}

View File

@@ -115,7 +115,7 @@ public class SysOaRemindServiceImpl implements ISysOaRemindService {
oaProgressBo.setType(1L);
List<OaProgressVo> rows1 = progressService.queryPageList(oaProgressBo, pageQuery).getRows();
for (OaProgressVo row : rows1) {
if (row.getRemainTime()!=null && row.getRemainTime()<3L){
if (row.getRemainTime()!=null && row.getStatus() !=1L && row.getRemainTime()<3L){
SysOaRemindVo sysOaRemindVo = new SysOaRemindVo();
sysOaRemindVo.setType("progress-project");
sysOaRemindVo.setContent(row.getProgressName());

View File

@@ -97,50 +97,56 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectVoListAndTime" resultType="com.ruoyi.oa.domain.vo.SysOaAttendanceVo">
SELECT
ANY_VALUE(id) AS id,
user_id,
ANY_VALUE(attendance_day) AS attendance_day,
project_id,
ANY_VALUE(day_length) AS day_length,
ANY_VALUE(hour) AS hour,
ANY_VALUE(create_time) AS create_time,
ANY_VALUE(create_by) AS create_by,
ANY_VALUE(update_time) AS update_time,
ANY_VALUE(update_by) AS update_by,
ANY_VALUE(remark) AS remark,
ANY_VALUE(del_flag) AS del_flag,
COUNT(id) AS count,
SELECT ANY_VALUE(id) AS id,
user_id,
ANY_VALUE(attendance_day) AS attendance_day,
project_id,
ANY_VALUE(day_length) AS day_length,
ANY_VALUE(hour) AS hour,
ANY_VALUE(create_time) AS create_time,
ANY_VALUE(create_by) AS create_by,
ANY_VALUE(update_time) AS update_time,
ANY_VALUE(update_by) AS update_by,
ANY_VALUE(remark) AS remark,
ANY_VALUE(del_flag) AS del_flag,
COUNT(id) AS count,
/*
1如果这条记录是按天统计 (day_length>0),就直接用 day_length。
2如果这条记录是按小时统计 (hour>0),那么就算作 1 天。
这样就不会把多日的小时相加再去整除 9
这样就不会把多日的小时相加再去整除 8
*/
SUM(
CASE
WHEN day_length > 0 THEN day_length
WHEN hour > 0 THEN 1
ELSE 0
END
) AS work_times,
SUM(
CASE
WHEN day_length > 0 THEN day_length
WHEN hour > 0 THEN 1
ELSE 0
END
) *9 AS hour_work_times,
SUM(
CASE
WHEN day_length > 0 THEN day_length
WHEN hour > 0 THEN ROUND(hour / 8, 1)
ELSE 0
END
) AS work_times,
SUM(
CASE
WHEN day_length > 0 THEN day_length * 8
WHEN hour > 0 THEN hour
ELSE 0
END
) AS hour_work_times,
/*
overTime如果是按小时统计且 hour>9,才有加班 = (hour - 9)。
overTime如果是按小时统计且 hour>8,才有加班 = (hour - 8)。
如果是 day_length 统计,则一般不会再去算小时加班(你如果有需要,也可以自己按其它规则)。
*/
SUM(
CASE
WHEN hour > 9 THEN hour - 9
ELSE 0
END
) AS overTime
SUM(
IF(hour > 8, hour - 8, 0)
) AS overTime,
/* ---------- 出差天数 (project_id = 0) ---------- */
SUM(
IF(project_id = 0, 1, 0)
) AS tripDays,
/* ---------- 请假天数 (project_id = 1) ---------- */
SUM(
IF(project_id = 1, 1, 0)
) AS absenceDays
FROM sys_oa_attendance soa
WHERE user_id = #{userId}
@@ -149,7 +155,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND del_flag = '0'
GROUP BY soa.project_id;
</select>
<select id="selectUserListAndAttendanceListAndProjectListByUserIds"

View File

@@ -64,7 +64,7 @@ public interface SysRoleMapper extends BaseMapperPlus<SysRoleMapper, SysRole, Sy
* @param userId
* @return
*/
SysRole getCurrentRole(Long userId);
List<SysRole> getCurrentRole(Long userId);
Long[] selectTempRoleByName();

View File

@@ -186,6 +186,6 @@ public interface ISysRoleService {
Long[] selectTempRoleByName();
SysRole getCurrentRole();
List<SysRole> getCurrentRole();
}

View File

@@ -448,7 +448,7 @@ public class SysRoleServiceImpl implements ISysRoleService {
}
@Override
public SysRole getCurrentRole() {
public List<SysRole> getCurrentRole() {
return baseMapper.getCurrentRole(LoginHelper.getUserId());
}

View File

@@ -590,12 +590,10 @@ public class WfProcessServiceImpl extends FlowServiceFactory implements IWfProce
.processInstanceId(histTask.getProcessInstanceId())
.singleResult();
Long userId = Long.parseLong(historicProcessInstance.getStartUserId());
String nickName = userService.selectNickNameById(userId);
flowTask.setStartUserId(userId);
flowTask.setStartUserName(nickName);
SysUser sysUser = sysUserService.selectUserByIdAndNotDelFlag(userId);
flowTask.setStartUserId(sysUser.getUserId());
flowTask.setStartUserName(sysUser.getNickName());
//获取部门信息(新增于2024年2月29日)
SysUser sysUser = sysUserService.selectUserById(userId);
if (sysUser.getDeptId()!=null){
SysDept sysDept = sysDeptService.selectDeptById(sysUser.getDeptId());
flowTask.setDeptName(sysDept.getDeptName());

View File

@@ -7,6 +7,7 @@ import cn.hutool.core.util.StrUtil;
import com.ruoyi.common.core.service.UserService;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.helper.LoginHelper;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.flowable.common.constant.ProcessConstants;
import com.ruoyi.flowable.common.constant.TaskConstants;
@@ -674,9 +675,9 @@ public class WfTaskServiceImpl extends FlowServiceFactory implements IWfTaskServ
for (HistoricVariableInstance var : varList) {
if ("startTime".equals(var.getVariableName())) {
// 若你的流程里存的就是 Date 类型,可以直接转
startDate = (Date) var.getValue();
startDate = DateUtils.parseDate(var.getValue());
} else if ("endTime".equals(var.getVariableName())) {
endDate = (Date) var.getValue();
endDate = DateUtils.parseDate(var.getValue());
}
}

View File

@@ -73,8 +73,9 @@
r.role_name,
r.role_key
from sys_role r
join sys_user_role sur on sur.role_id = r.role_id
where #{userId} = sur.user_id
left join sys_user_role sur on sur.role_id = r.role_id
left join sys_user su on su.user_id = sur.user_id
where #{userId} = sur.user_id and su.del_flag = '0'
</select>
<select id="selectTempRoleByName" resultType="Long">
select r.role_id from sys_role r where r.role_key = 'temp'

10
script/minio/script Normal file
View File

@@ -0,0 +1,10 @@
docker run \
--name minio \
-p 11295:9000 \
-p 11296:9090 \
-d \
-e "MINIO_ROOT_USER=minio" \
-e "MINIO_ROOT_PASSWORD=minio123" \
-v /home/userroot/minio-data:/data \
-v /home/userroot/minio-config:/root/.minio \
minio/minio server /data --console-address ":9090" --address ":9000"