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

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

...@@ -344,7 +344,7 @@ ...@@ -344,7 +344,7 @@
field: 'checkSendRole', field: 'checkSendRole',
component: 'JSelectRole', component: 'JSelectRole',
required: false, required: false,
ifShow: computed(() => userType.value === 'role'), ifShow: computed(() => userType.value !== 'user'),
componentProps: { componentProps: {
labelKey: 'roleName', labelKey: 'roleName',
rowKey: 'id', rowKey: 'id',
......
...@@ -168,7 +168,12 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask ...@@ -168,7 +168,12 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
// 写入 待办 // 写入 待办
MyTask myTask = new MyTask(); MyTask myTask = new MyTask();
if(userType.equals("user")) {
myTask.setUid(approvalId); myTask.setUid(approvalId);
} else {
myTask.setRoleid(approvalId);
}
myTask.setTp(5); myTask.setTp(5);
myTask.setTarget(nextTask.getName()); myTask.setTarget(nextTask.getName());
if(zdval!=null&&!zdval.equals("")){ if(zdval!=null&&!zdval.equals("")){
...@@ -183,7 +188,12 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask ...@@ -183,7 +188,12 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
myTask.setDes(""); myTask.setDes("");
//myTask.setLinkAddr("/project/plan/StPlanManList?"+zdmc+"="+zdval); //myTask.setLinkAddr("/project/plan/StPlanManList?"+zdmc+"="+zdval);
if(sysForm!=null){ if(sysForm!=null){
if(sysForm.getFormTp().equals("2")){
myTask.setLinkAddr(sysForm.getFormListurl()); myTask.setLinkAddr(sysForm.getFormListurl());
}else{
myTask.setLinkAddr("/flowable/task/todo/index");
}
} }
myTaskService.save(myTask); myTaskService.save(myTask);
...@@ -210,7 +220,12 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask ...@@ -210,7 +220,12 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
taskFlow.setDeployId(deploymentId); taskFlow.setDeployId(deploymentId);
taskFlow.setFormTableName(sysForm.getFormTableName()); taskFlow.setFormTableName(sysForm.getFormTableName());
if(userType.equals("user")) {
taskFlow.setUid(approvalId); taskFlow.setUid(approvalId);
} else {
taskFlow.setRoleid(approvalId);
}
taskFlow.setTaskDefinitionKey(nextTask.getTaskDefinitionKey()); taskFlow.setTaskDefinitionKey(nextTask.getTaskDefinitionKey());
myTaskFlowService.save(taskFlow); myTaskFlowService.save(taskFlow);
......
...@@ -69,7 +69,7 @@ public class MyTaskFlowController extends JeecgController<MyTaskFlow, IMyTaskFlo ...@@ -69,7 +69,7 @@ public class MyTaskFlowController extends JeecgController<MyTaskFlow, IMyTaskFlo
@Operation(summary="my_task_flow-添加") @Operation(summary="my_task_flow-添加")
@PostMapping(value = "/add") @PostMapping(value = "/add")
public Result<String> add(@RequestBody MyTaskFlow myTaskFlow) { 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()); myTaskFlow.setUid(UserUtil.getUserId());
} }
myTaskFlowService.save(myTaskFlow); myTaskFlowService.save(myTaskFlow);
......
...@@ -96,4 +96,6 @@ public class MyTask implements Serializable { ...@@ -96,4 +96,6 @@ public class MyTask implements Serializable {
@Excel(name = "描述", width = 15) @Excel(name = "描述", width = 15)
private String des; private String des;
private String roleid;
} }
...@@ -65,8 +65,8 @@ public class MyTaskFlow implements Serializable { ...@@ -65,8 +65,8 @@ public class MyTaskFlow implements Serializable {
/**角色ID*/ /**角色ID*/
@Excel(name = "roleId", width = 15) @Excel(name = "roleId", width = 15)
@Schema(description = "roleId") @Schema(description = "roleid")
private java.lang.String roleId; private java.lang.String roleid;
/**工作流节点ID*/ /**工作流节点ID*/
@Excel(name = "taskDefinitionKey", width = 15) @Excel(name = "taskDefinitionKey", width = 15)
......
...@@ -3,6 +3,8 @@ package org.jeecg.modules.stm.my.service; ...@@ -3,6 +3,8 @@ package org.jeecg.modules.stm.my.service;
import org.jeecg.modules.stm.my.entity.MyTaskFlow; import org.jeecg.modules.stm.my.entity.MyTaskFlow;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/** /**
* @Description: my_task_flow * @Description: my_task_flow
* @Author: jeecg-boot * @Author: jeecg-boot
...@@ -11,4 +13,5 @@ import com.baomidou.mybatisplus.extension.service.IService; ...@@ -11,4 +13,5 @@ import com.baomidou.mybatisplus.extension.service.IService;
*/ */
public interface IMyTaskFlowService extends IService<MyTaskFlow> { public interface IMyTaskFlowService extends IService<MyTaskFlow> {
MyTaskFlow selectMyTaskFlowByDeployId(String deployId,String targetId); MyTaskFlow selectMyTaskFlowByDeployId(String deployId,String targetId);
List<String> queryTodoList(MyTaskFlow myTaskFlow);
} }
package org.jeecg.modules.stm.my.service.impl; 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 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.entity.MyTaskFlow;
import org.jeecg.modules.stm.my.mapper.MyTaskFlowMapper; import org.jeecg.modules.stm.my.mapper.MyTaskFlowMapper;
import org.jeecg.modules.stm.my.service.IMyTaskFlowService; 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.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; 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 * @Description: my_task_flow
...@@ -14,11 +26,77 @@ import org.springframework.stereotype.Service; ...@@ -14,11 +26,77 @@ import org.springframework.stereotype.Service;
* @Version: V1.0 * @Version: V1.0
*/ */
@Service @Service
public class MyTaskFlowServiceImpl extends ServiceImpl<MyTaskFlowMapper, MyTaskFlow> implements IMyTaskFlowService { public class MyTaskFlowServiceImpl extends ServiceImpl<MyTaskFlowMapper, MyTaskFlow> implements IMyTaskFlowService {
@Autowired
private SysRoleMapper sysRoleMapper;
@Override @Override
public MyTaskFlow selectMyTaskFlowByDeployId(String deployId,String targetId) { public MyTaskFlow selectMyTaskFlowByDeployId(String deployId,String targetId) {
return this.baseMapper.selectMyTaskFlowByDeployId(deployId,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; ...@@ -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.entity.BaosongTaskRecord;
import org.jeecg.modules.stm.baosong.service.IBaosongTaskRecordService; import org.jeecg.modules.stm.baosong.service.IBaosongTaskRecordService;
import org.jeecg.modules.stm.page.entity.PageTitleconfig; 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.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
...@@ -24,10 +26,8 @@ import org.jeecg.modules.stm.rectify.plan.service.IStRectifyPlanService; ...@@ -24,10 +26,8 @@ import org.jeecg.modules.stm.rectify.plan.service.IStRectifyPlanService;
import org.jeecg.modules.stm.utils.UserUtil; import org.jeecg.modules.stm.utils.UserUtil;
import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.HashMap; import java.util.*;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -46,6 +46,8 @@ public class PageTitleconfigController extends JeecgController<PageTitleconfig, ...@@ -46,6 +46,8 @@ public class PageTitleconfigController extends JeecgController<PageTitleconfig,
@Autowired @Autowired
private IBaosongTaskRecordService baosongTaskRecordService; private IBaosongTaskRecordService baosongTaskRecordService;
@Autowired
private ISysUserRoleService sysUserRoleService;
@GetMapping(value = "/list") @GetMapping(value = "/list")
public Result<IPage<PageTitleconfig>> queryPageList(PageTitleconfig pageTitleconfig, public Result<IPage<PageTitleconfig>> queryPageList(PageTitleconfig pageTitleconfig,
...@@ -90,7 +92,30 @@ public class PageTitleconfigController extends JeecgController<PageTitleconfig, ...@@ -90,7 +92,30 @@ public class PageTitleconfigController extends JeecgController<PageTitleconfig,
//获取待办事项列表,待审批和待填报 //获取待办事项列表,待审批和待填报
QueryWrapper<MyTask> queryWrapper = new QueryWrapper(); QueryWrapper<MyTask> queryWrapper = new QueryWrapper();
String userId = UserUtil.getUserId(); 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"); queryWrapper.last("limit 5");
List<MyTask> list = myTaskService.list(queryWrapper); List<MyTask> list = myTaskService.list(queryWrapper);
return Result.OK(list); return Result.OK(list);
......
...@@ -15,18 +15,21 @@ import org.jeecg.common.aspect.annotation.AutoLog; ...@@ -15,18 +15,21 @@ import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.common.system.base.controller.JeecgController; import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.common.system.query.QueryGenerator; import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.common.system.vo.LoginUser; 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.StProblemCheck;
import org.jeecg.modules.stm.problem.entity.StProblemCheckArchive; import org.jeecg.modules.stm.problem.entity.StProblemCheckArchive;
import org.jeecg.modules.stm.problem.service.IStProblemCheckArchiveService; import org.jeecg.modules.stm.problem.service.IStProblemCheckArchiveService;
import org.jeecg.modules.stm.problem.service.IStProblemCheckService; 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.jeecg.modules.system.service.ISysDictService;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.ModelAndView;
import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
...@@ -44,9 +47,10 @@ public class StProblemCheckController extends JeecgController<StProblemCheck, IS ...@@ -44,9 +47,10 @@ public class StProblemCheckController extends JeecgController<StProblemCheck, IS
@Autowired @Autowired
private IStProblemCheckService stProblemCheckService; private IStProblemCheckService stProblemCheckService;
@Autowired @Autowired
private ISysDictService iSysDictService;
@Autowired
private IStProblemCheckArchiveService stProblemCheckArchiveService; private IStProblemCheckArchiveService stProblemCheckArchiveService;
@Autowired
private IMyTaskFlowService myTaskFlowService;
/** /**
* 分页列表查询 * 分页列表查询
...@@ -66,11 +70,16 @@ public class StProblemCheckController extends JeecgController<StProblemCheck, IS ...@@ -66,11 +70,16 @@ public class StProblemCheckController extends JeecgController<StProblemCheck, IS
HttpServletRequest req) { HttpServletRequest req) {
QueryWrapper<StProblemCheck> queryWrapper = QueryGenerator.initQueryWrapper(stProblemCheck, req.getParameterMap()); 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)) { if(Utils.isNullOrEmpty(todoList)) {
//return Result.OK(null); queryWrapper.eq("bpm_status",0)
.eq("created_user", UserUtil.getUserCode());
} else { } else {
queryWrapper.in("procInsId", todoList); queryWrapper.in("id", todoList);
} }
Page<StProblemCheck> page = new Page<StProblemCheck>(pageNo, pageSize); Page<StProblemCheck> page = new Page<StProblemCheck>(pageNo, pageSize);
...@@ -93,6 +102,7 @@ public class StProblemCheckController extends JeecgController<StProblemCheck, IS ...@@ -93,6 +102,7 @@ public class StProblemCheckController extends JeecgController<StProblemCheck, IS
String userid=sysUser.getId(); String userid=sysUser.getId();
String username=sysUser.getUsername(); String username=sysUser.getUsername();
stProblemCheck.setCreatedUser(username); stProblemCheck.setCreatedUser(username);
stProblemCheck.setBpmStatus(StmConstans.FLOW_STATUS_START);
stProblemCheckService.save(stProblemCheck); stProblemCheckService.save(stProblemCheck);
return Result.OK(stProblemCheck); return Result.OK(stProblemCheck);
} }
......
...@@ -61,4 +61,8 @@ public class StmConstans { ...@@ -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_TEMPLATE_PATH = "/template/stat_record_tpl.docx";
public static final String METRIC_REPORT_SAVE_PATH = "/report"; 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 { ...@@ -20,6 +20,11 @@ public class UserUtil {
return sysUser.getId(); return sysUser.getId();
} }
public static String getRoleCode(){
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
return sysUser.getRoleCode();
}
/** /**
* 生成模板编码 * 生成模板编码
* @param curCode * @param curCode
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论