审核按钮权限控制
parent
f0c7c99541
commit
32f8b20d91
|
@ -458,7 +458,7 @@ public class AccountService {
|
|||
return new ArrayList<>();
|
||||
}
|
||||
String sql = "select u.id as id from sys_user_role ur left join sys_user u on u.id=ur.user_id where ur.role_id in (?)";
|
||||
String ids = roleIds.stream().collect(Collectors.joining());
|
||||
String ids = String.join("", roleIds);
|
||||
List<Record> records = pagination.find(sql, ids);
|
||||
if (records == null || records.isEmpty()) {
|
||||
return new ArrayList<>();
|
||||
|
@ -466,7 +466,10 @@ public class AccountService {
|
|||
|
||||
List<String> userIds = new ArrayList<>(roleIds.size());
|
||||
for (Record record : records) {
|
||||
userIds.add(record.getInt("id") + "");
|
||||
Integer id = record.getInt("id");
|
||||
if (id != null) {
|
||||
userIds.add(id.toString());
|
||||
}
|
||||
}
|
||||
return userIds;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package cn.palmte.work.service;
|
||||
|
||||
|
||||
import cn.palmte.work.config.activiti.ActConstant;
|
||||
import cn.palmte.work.model.ActTaskDef;
|
||||
import cn.palmte.work.model.Admin;
|
||||
import cn.palmte.work.model.AdminRepository;
|
||||
import cn.palmte.work.utils.ActUtil;
|
||||
|
@ -55,8 +57,9 @@ public class ActListenerService {
|
|||
|
||||
ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().processInstanceId(procInsId).singleResult();
|
||||
logger.info("addCandidateUsers : {}, taskName:{}, hasProcIns:{}", candidateUsers, delegateTask.getName(), processInstance != null);
|
||||
|
||||
if (actUtil.isProjectProcessIns(processInstance)) {
|
||||
updateProjectApprover(candidateUsers, processInstance);
|
||||
updateProjectApprover(candidateUsers, processInstance, procDefId, taskDefKey);
|
||||
}
|
||||
|
||||
delegateTask.addCandidateUsers(candidateUsers);
|
||||
|
@ -87,13 +90,15 @@ public class ActListenerService {
|
|||
* @param candidateUsers
|
||||
* @param processInstance
|
||||
*/
|
||||
private void updateProjectApprover(List<String> candidateUsers, ProcessInstance processInstance) {
|
||||
private void updateProjectApprover(List<String> candidateUsers, ProcessInstance processInstance, String procDefId, String taskDefKey) {
|
||||
String businessKey = processInstance.getBusinessKey();
|
||||
logger.info("businessKey : {}", businessKey);
|
||||
ActTaskDef actTaskDef = actTaskDefService.findFirstByProcDefIdAndTaskKey(procDefId, taskDefKey);
|
||||
|
||||
try {
|
||||
int adminId = 0;
|
||||
if (!candidateUsers.isEmpty()) {
|
||||
if (!candidateUsers.isEmpty() && actTaskDef!=null && actTaskDef.getTaskIndex() != ActConstant.TASK_INDEX_FIRST_USER_TASK) {
|
||||
//回退到发起节点 审批人设置为空
|
||||
for (String id : candidateUsers) {
|
||||
Admin one = adminRepository.findOne(Integer.parseInt(id));
|
||||
if (!one.isDeleted() && one.getEnabled() == 1) {
|
||||
|
@ -103,6 +108,7 @@ public class ActListenerService {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
projectInstanceService.updateApprover(Integer.parseInt(businessKey), adminId);
|
||||
} catch (Exception e) {
|
||||
logger.error("", e);
|
||||
|
|
|
@ -204,6 +204,9 @@ public class ActUtil {
|
|||
for (IdentityLink identityLink : identityLinkList) {
|
||||
if ("assignee".equals(identityLink.getType()) || "candidate".equals(identityLink.getType())) {
|
||||
String assigneeUserId = identityLink.getUserId();
|
||||
if (StrKit.isBlank(assigneeUserId) || "null".equals(assigneeUserId)) {
|
||||
continue;
|
||||
}
|
||||
namesBuilder.append(accountService.getNameById(Integer.parseInt(assigneeUserId)));
|
||||
namesBuilder.append(",");
|
||||
}
|
||||
|
|
|
@ -1872,7 +1872,7 @@
|
|||
<button type="button" class="am-btn am-btn-warning am-btn-xs" onclick="javascript:history.go(-1);">
|
||||
返回上一级
|
||||
</button>
|
||||
<#if project.creatorId!=project.approveId && adminId==project.approveId>
|
||||
<#if adminId==project.approveId>
|
||||
<button type="submit" class="am-btn am-btn-primary am-btn-xs" id="saveFinal">审核</button>
|
||||
</#if>
|
||||
</div>
|
||||
|
|
|
@ -271,7 +271,7 @@
|
|||
</button>-->
|
||||
|
||||
|
||||
<#if list.creatorId!=list.approveId && adminId==list.approveId>
|
||||
<#if adminId==list.approveId>
|
||||
<button type="button"
|
||||
class="am-btn am-btn-default am-btn-xs am-text-secondary"
|
||||
onclick="location.href='${base}/project/approve?listFrom=list&id=${list.id}'"><span
|
||||
|
|
Loading…
Reference in New Issue