指定部门领导审批功能
parent
40f9706e29
commit
955b31aa83
|
@ -8,27 +8,30 @@ import lombok.Getter;
|
|||
* 审批人设置枚举
|
||||
*/
|
||||
@Getter
|
||||
public enum CandidateTypeEnum {
|
||||
public enum ActCandidateTypeEnum {
|
||||
USER(0, "按用户设置审批人"),
|
||||
ROLE(1, "按角色设置审批人"),
|
||||
STARTER_LEADER(2, "按发起人部门领导设置审批人");
|
||||
STARTER_LEADER(2, "按发起人部门领导设置审批人"),
|
||||
DEPT_LEADER(3, "按指定的部门领导设置审批人");
|
||||
|
||||
|
||||
private int type;
|
||||
private String name;
|
||||
|
||||
CandidateTypeEnum(int type, String name) {
|
||||
ActCandidateTypeEnum(int type, String name) {
|
||||
this.type = type;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public static CandidateTypeEnum ofType(int type) {
|
||||
public static ActCandidateTypeEnum ofType(int type) {
|
||||
if (type == USER.getType()) {
|
||||
return USER;
|
||||
} else if (type == ROLE.getType()) {
|
||||
return ROLE;
|
||||
} else if (type == STARTER_LEADER.getType()) {
|
||||
return STARTER_LEADER;
|
||||
} else if (type == DEPT_LEADER.getType()) {
|
||||
return DEPT_LEADER;
|
||||
} else {
|
||||
throw new ResponseException("不支持的类型【" + type + "】");
|
||||
}
|
|
@ -7,6 +7,11 @@ public class ActConstant {
|
|||
*/
|
||||
public static final String START_PROCESS_USERID = "startUserId";
|
||||
|
||||
/**
|
||||
* 部门领导id
|
||||
*/
|
||||
public static final String DEPT_LEADER_ID = "deptLeaderId";
|
||||
|
||||
/**
|
||||
* 单实例 或签
|
||||
*/
|
||||
|
|
|
@ -116,7 +116,9 @@ public class ActListenerService {
|
|||
processInstance.getProcessInstanceId(), businessKey, adminId);
|
||||
projectInstanceService.updateApprover(Integer.parseInt(businessKey), adminId);
|
||||
} else if (actUtil.isNewProcess(procDefId)) {
|
||||
projectProcessService.updateAudit(Integer.parseInt(businessKey), null, enableUsers);
|
||||
if (!enableUsers.isEmpty()) {
|
||||
projectProcessService.updateAudit(Integer.parseInt(businessKey), null, enableUsers);
|
||||
}
|
||||
logger.info("**** rwcjjt 任务创建监听 更新审批2 procInsId:{}, projectId:{}, enableUsers:{} **** ",
|
||||
processInstance.getProcessInstanceId(), businessKey, enableUsers);
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@ import org.slf4j.LoggerFactory;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import top.jfunc.common.db.QueryHelper;
|
||||
import top.jfunc.common.db.bean.Record;
|
||||
import top.jfunc.common.db.utils.Pagination;
|
||||
|
||||
import java.util.*;
|
||||
|
@ -352,7 +353,7 @@ public class ActTaskDefService {
|
|||
//通过特殊类型查询
|
||||
List<String> candidateTypeList = taskDef.getCandidateTypeList();
|
||||
logger.info("findCandidateUsers-type-task:{}, typeList:{}", taskDef.getTaskName(), candidateTypeList);
|
||||
List<String> userListByType = queryCandidatesByTypes(candidateRoleList, procInsId);
|
||||
List<String> userListByType = queryCandidatesByTypes(candidateTypeList, procInsId);
|
||||
logger.info("findCandidateUsers-type-task:{}, userListByType:{}", taskDef.getTaskName(), userListByType);
|
||||
if (!userListByType.isEmpty()) {
|
||||
res.addAll(userListByType);
|
||||
|
@ -363,6 +364,13 @@ public class ActTaskDefService {
|
|||
return resList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过类型查找审批人
|
||||
*
|
||||
* @param types
|
||||
* @param procInsId
|
||||
* @return
|
||||
*/
|
||||
private List<String> queryCandidatesByTypes(List<String> types, String procInsId) {
|
||||
if (types == null || types.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
|
@ -370,13 +378,25 @@ public class ActTaskDefService {
|
|||
|
||||
List<String> userIdList = new ArrayList<>();
|
||||
for (String typeStr : types) {
|
||||
if (CandidateTypeEnum.STARTER_LEADER.getType() == Integer.parseInt(typeStr)) {
|
||||
|
||||
ActCandidateTypeEnum candidateTypeEnum = ActCandidateTypeEnum.ofType(Integer.parseInt(typeStr));
|
||||
if (ActCandidateTypeEnum.STARTER_LEADER == candidateTypeEnum) {
|
||||
//查找发起人部门主管
|
||||
String startUserId = actUtil.getStartUserId(procInsId);
|
||||
int leaderId = accountService.getOneLevelDeptManagerId(Integer.parseInt(startUserId));
|
||||
logger.info("queryCandidatesByType startLeader:{}, procInsId:{} ", leaderId, procInsId);
|
||||
if (leaderId != 0) {
|
||||
userIdList.add(String.valueOf(leaderId));
|
||||
}
|
||||
} else if (ActCandidateTypeEnum.DEPT_LEADER == candidateTypeEnum) {
|
||||
Record record = actUtil.getVariable(ActConstant.DEPT_LEADER_ID, procInsId);
|
||||
if (record != null) {
|
||||
String deptLeaderId = record.getStr("text");
|
||||
userIdList.add(deptLeaderId);
|
||||
logger.info("queryCandidatesByType deptLeader:{}, procInsId:{} ", deptLeaderId, procInsId);
|
||||
}else{
|
||||
logger.error("queryCandidatesByType not find deptLeader procInsId:{} ", procInsId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package cn.palmte.work.service;
|
||||
|
||||
import cn.palmte.work.config.activiti.ActConstant;
|
||||
import org.springframework.jdbc.core.BatchPreparedStatementSetter;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
@ -226,13 +227,13 @@ public class ProjectProcessService {
|
|||
BigDecimal repaidAmount = getProjectRepaidAmount(entity.getProjectId());
|
||||
variables.put("repaidAmount", repaidAmount);
|
||||
// 合同金额
|
||||
variables.put("amount", project.getContractAmount() == null ? 0 : project.getContractAmount());
|
||||
variables.put("contractAmount", project.getContractAmount() == null ? 0 : project.getContractAmount());
|
||||
// 项目类型
|
||||
variables.put("projectType", project.getType());
|
||||
// 合作类型
|
||||
variables.put("cooperationType", project.getCooperateType() == null ? 0 : project.getCooperateType());
|
||||
// 部门领导ID
|
||||
variables.put("deptLeaderId", entity.getApplyDeptLeaderId());
|
||||
variables.put(ActConstant.DEPT_LEADER_ID, entity.getApplyDeptLeaderId());
|
||||
|
||||
startAuditProgress(entity, variables);
|
||||
}
|
||||
|
|
|
@ -76,7 +76,8 @@
|
|||
<select multiple
|
||||
data-am-selected="{btnSize: 'sm',btnWidth: '150px',maxHeight: 500,searchBox: 1}"
|
||||
id="typeSelect_${list.id}">
|
||||
<option value="1" <#if list.candidateTypeList?seq_contains('1')>selected</#if> >发起人部门主管</option>
|
||||
<option value="2" <#if list.candidateTypeList?seq_contains('2')>selected</#if> >发起人部门领导</option>
|
||||
<option value="3" <#if list.candidateTypeList?seq_contains('3')>selected</#if> >发起时指定的部门领导</option>
|
||||
</select>
|
||||
|
||||
</td>
|
||||
|
|
Loading…
Reference in New Issue