提交 87ceb7a8 authored 作者: liuluyu's avatar liuluyu

Merge branch 'master' of http://47.97.51.208/root/zrch-risk-39

......@@ -344,7 +344,7 @@
field: 'checkSendRole',
component: 'JSelectRole',
required: false,
ifShow: computed(() => userType.value === 'role'),
ifShow: computed(() => userType.value !== 'user'),
componentProps: {
labelKey: 'roleName',
rowKey: 'id',
......
......@@ -168,7 +168,12 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
// 写入 待办
MyTask myTask = new MyTask();
if(userType.equals("user")) {
myTask.setUid(approvalId);
} else {
myTask.setRoleid(approvalId);
}
myTask.setTp(5);
myTask.setTarget(nextTask.getName());
if(zdval!=null&&!zdval.equals("")){
......@@ -183,7 +188,12 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
myTask.setDes("");
//myTask.setLinkAddr("/project/plan/StPlanManList?"+zdmc+"="+zdval);
if(sysForm!=null){
if(sysForm.getFormTp().equals("2")){
myTask.setLinkAddr(sysForm.getFormListurl());
}else{
myTask.setLinkAddr("/flowable/task/todo/index");
}
}
myTaskService.save(myTask);
......@@ -210,7 +220,12 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
taskFlow.setDeployId(deploymentId);
taskFlow.setFormTableName(sysForm.getFormTableName());
if(userType.equals("user")) {
taskFlow.setUid(approvalId);
} else {
taskFlow.setRoleid(approvalId);
}
taskFlow.setTaskDefinitionKey(nextTask.getTaskDefinitionKey());
myTaskFlowService.save(taskFlow);
......
......@@ -69,7 +69,7 @@ public class MyTaskFlowController extends JeecgController<MyTaskFlow, IMyTaskFlo
@Operation(summary="my_task_flow-添加")
@PostMapping(value = "/add")
public Result<String> add(@RequestBody MyTaskFlow myTaskFlow) {
if(myTaskFlow.getUid()==null&&myTaskFlow.getRoleId()==null) {
if(myTaskFlow.getUid()==null&&myTaskFlow.getRoleid()==null) {
myTaskFlow.setUid(UserUtil.getUserId());
}
myTaskFlowService.save(myTaskFlow);
......
......@@ -96,4 +96,6 @@ public class MyTask implements Serializable {
@Excel(name = "描述", width = 15)
private String des;
private String roleid;
}
......@@ -65,8 +65,8 @@ public class MyTaskFlow implements Serializable {
/**角色ID*/
@Excel(name = "roleId", width = 15)
@Schema(description = "roleId")
private java.lang.String roleId;
@Schema(description = "roleid")
private java.lang.String roleid;
/**工作流节点ID*/
@Excel(name = "taskDefinitionKey", width = 15)
......
......@@ -3,6 +3,8 @@ package org.jeecg.modules.stm.my.service;
import org.jeecg.modules.stm.my.entity.MyTaskFlow;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/**
* @Description: my_task_flow
* @Author: jeecg-boot
......@@ -11,4 +13,5 @@ import com.baomidou.mybatisplus.extension.service.IService;
*/
public interface IMyTaskFlowService extends IService<MyTaskFlow> {
MyTaskFlow selectMyTaskFlowByDeployId(String deployId,String targetId);
List<String> queryTodoList(MyTaskFlow myTaskFlow);
}
package org.jeecg.modules.stm.my.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.common.constant.SymbolConstant;
import org.jeecg.modules.stm.my.entity.MyTaskFlow;
import org.jeecg.modules.stm.my.mapper.MyTaskFlowMapper;
import org.jeecg.modules.stm.my.service.IMyTaskFlowService;
import org.jeecg.modules.stm.utils.UserUtil;
import org.jeecg.modules.system.entity.SysRole;
import org.jeecg.modules.system.entity.SysUserDepart;
import org.jeecg.modules.system.mapper.SysRoleMapper;
import org.jeecg.modules.system.service.ISysRoleIndexService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import java.sql.SQLException;
import java.sql.Wrapper;
import java.util.*;
import java.util.stream.Collectors;
/**
* @Description: my_task_flow
......@@ -14,11 +26,77 @@ import org.springframework.stereotype.Service;
* @Version: V1.0
*/
@Service
public class MyTaskFlowServiceImpl extends ServiceImpl<MyTaskFlowMapper, MyTaskFlow> implements IMyTaskFlowService {
@Autowired
private SysRoleMapper sysRoleMapper;
@Override
public MyTaskFlow selectMyTaskFlowByDeployId(String deployId,String targetId) {
return this.baseMapper.selectMyTaskFlowByDeployId(deployId,targetId);
}
@Override
public List<String> queryTodoList(MyTaskFlow myTaskFlow) {
LambdaQueryWrapper<MyTaskFlow> query = new LambdaQueryWrapper<>();
String roleCodes = UserUtil.getRoleCode();
final List<String> roleCodeList;
final List<String> roleIdList;// 使用 final 关键字
if (StringUtils.hasText(roleCodes)) {
roleCodeList = Arrays.asList(roleCodes.split(","));
roleIdList = queryRoleIdsByRoleCodes(roleCodeList);
} else {
roleCodeList = Collections.emptyList(); // 明确赋值为空列表
roleIdList = Collections.emptyList();
}
// 基础条件
query.eq(Objects.nonNull(myTaskFlow.getDeployId()),
MyTaskFlow::getDeployId, myTaskFlow.getDeployId())
.eq(Objects.nonNull(myTaskFlow.getTargetId()),
MyTaskFlow::getTargetId, myTaskFlow.getTargetId())
.eq(Objects.nonNull(myTaskFlow.getFormTableName()),
MyTaskFlow::getFormTableName, myTaskFlow.getFormTableName())
.eq(Objects.nonNull(myTaskFlow.getTaskDefinitionKey()),
MyTaskFlow::getTaskDefinitionKey, myTaskFlow.getTaskDefinitionKey());
// 权限条件:本人或角色匹配
if (!roleCodeList.isEmpty()) {
query.and(wrapper -> wrapper
.eq(MyTaskFlow::getUid, UserUtil.getUserId())
.or()
.in(MyTaskFlow::getRoleid,roleIdList)
);
} else {
query.eq(MyTaskFlow::getUid, UserUtil.getUserId());
}
query.select(MyTaskFlow::getTargetId);
// 使用 Set 去重
Set<String> targetIdSet = this.baseMapper.selectList(query).stream()
.map(MyTaskFlow::getTargetId)
.filter(Objects::nonNull)
.collect(Collectors.toSet());
return new ArrayList<>(targetIdSet);
}
private List<String> queryRoleIdsByRoleCodes(List<String> roleCodes) {
LambdaQueryWrapper<SysRole> query = new LambdaQueryWrapper<>();
query.in(SysRole::getRoleCode,roleCodes);
List<String> roleIds = new ArrayList<>();
List<SysRole> list = sysRoleMapper.selectList(query);
for(SysRole sysRole:list) {
roleIds.add(sysRole.getId());
}
return roleIds;
}
}
......@@ -13,6 +13,8 @@ import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.modules.stm.baosong.entity.BaosongTaskRecord;
import org.jeecg.modules.stm.baosong.service.IBaosongTaskRecordService;
import org.jeecg.modules.stm.page.entity.PageTitleconfig;
import org.jeecg.modules.system.entity.SysUserRole;
import org.jeecg.modules.system.service.ISysUserRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
......@@ -24,10 +26,8 @@ import org.jeecg.modules.stm.rectify.plan.service.IStRectifyPlanService;
import org.jeecg.modules.stm.utils.UserUtil;
import jakarta.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
......@@ -46,6 +46,8 @@ public class PageTitleconfigController extends JeecgController<PageTitleconfig,
@Autowired
private IBaosongTaskRecordService baosongTaskRecordService;
@Autowired
private ISysUserRoleService sysUserRoleService;
@GetMapping(value = "/list")
public Result<IPage<PageTitleconfig>> queryPageList(PageTitleconfig pageTitleconfig,
......@@ -90,7 +92,30 @@ public class PageTitleconfigController extends JeecgController<PageTitleconfig,
//获取待办事项列表,待审批和待填报
QueryWrapper<MyTask> queryWrapper = new QueryWrapper();
String userId = UserUtil.getUserId();
queryWrapper.eq("sta",0).eq("uid",userId).orderByDesc("priority").orderByDesc("st_time");
String roleids="";
List<SysUserRole> userRole = sysUserRoleService.list(new QueryWrapper<SysUserRole>().lambda().eq(SysUserRole::getUserId, userId));
for(int u=0;u<userRole.size();u++){
SysUserRole sysUserRole=userRole.get(u);
roleids=roleids+sysUserRole.getRoleId()+",";
}
if(!roleids.equals("")){
roleids=roleids.substring(0,roleids.length()-1);
}
// 创建一个最终变量或实际上的最终变量用于 lambda
final String finalRoleids = roleids;
//queryWrapper.eq("sta",0).eq("uid",userId).orderByDesc("priority").orderByDesc("st_time");
// 修改:uid 和 roleid 是 OR 关系
queryWrapper.eq("sta", 0)
.and(wrapper -> {
wrapper.eq("uid", userId);
if(!"".equals(finalRoleids)){
wrapper.or().in("roleid", Arrays.asList(finalRoleids.split(",")));
}
})
.orderByDesc("priority")
.orderByDesc("st_time");
queryWrapper.last("limit 5");
List<MyTask> list = myTaskService.list(queryWrapper);
return Result.OK(list);
......
......@@ -15,18 +15,21 @@ import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.modules.stm.my.entity.MyTaskFlow;
import org.jeecg.modules.stm.my.service.IMyTaskFlowService;
import org.jeecg.modules.stm.problem.entity.StProblemCheck;
import org.jeecg.modules.stm.problem.entity.StProblemCheckArchive;
import org.jeecg.modules.stm.problem.service.IStProblemCheckArchiveService;
import org.jeecg.modules.stm.problem.service.IStProblemCheckService;
import org.jeecg.modules.stm.utils.StmConstans;
import org.jeecg.modules.stm.utils.UserUtil;
import org.jeecg.modules.system.service.ISysDictService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
......@@ -44,9 +47,10 @@ public class StProblemCheckController extends JeecgController<StProblemCheck, IS
@Autowired
private IStProblemCheckService stProblemCheckService;
@Autowired
private ISysDictService iSysDictService;
@Autowired
private IStProblemCheckArchiveService stProblemCheckArchiveService;
@Autowired
private IMyTaskFlowService myTaskFlowService;
/**
* 分页列表查询
......@@ -66,11 +70,16 @@ public class StProblemCheckController extends JeecgController<StProblemCheck, IS
HttpServletRequest req) {
QueryWrapper<StProblemCheck> queryWrapper = QueryGenerator.initQueryWrapper(stProblemCheck, req.getParameterMap());
List<String> todoList = stProblemCheck.getTodolist();
MyTaskFlow myTaskFlow = new MyTaskFlow();
myTaskFlow.setFormTableName("st_problem_check");
myTaskFlow.setTaskDefinitionKey(stProblemCheck.getBmpNodeId());
List<String> todoList = myTaskFlowService.queryTodoList(myTaskFlow);
if(Utils.isNullOrEmpty(todoList)) {
//return Result.OK(null);
queryWrapper.eq("bpm_status",0)
.eq("created_user", UserUtil.getUserCode());
} else {
queryWrapper.in("procInsId", todoList);
queryWrapper.in("id", todoList);
}
Page<StProblemCheck> page = new Page<StProblemCheck>(pageNo, pageSize);
......@@ -93,6 +102,7 @@ public class StProblemCheckController extends JeecgController<StProblemCheck, IS
String userid=sysUser.getId();
String username=sysUser.getUsername();
stProblemCheck.setCreatedUser(username);
stProblemCheck.setBpmStatus(StmConstans.FLOW_STATUS_START);
stProblemCheckService.save(stProblemCheck);
return Result.OK(stProblemCheck);
}
......
......@@ -61,4 +61,8 @@ public class StmConstans {
public static final String METRIC_REPORT_TEMPLATE_PATH = "/template/stat_record_tpl.docx";
public static final String METRIC_REPORT_SAVE_PATH = "/report";
public static final String FLOW_STATUS_START = "0";// 流程开始
public static final String FLOW_STATUS_RUNING = "1"; //进行中
public static final String FLOW_STATUS_END = "2"; //已经结
}
......@@ -20,6 +20,11 @@ public class UserUtil {
return sysUser.getId();
}
public static String getRoleCode(){
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
return sysUser.getRoleCode();
}
/**
* 生成模板编码
* @param curCode
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论