领退料审核流逻辑优化
This commit is contained in:
parent
d82dccea6d
commit
fb174749d9
|
|
@ -10,9 +10,9 @@ public class BmConfigItems {
|
||||||
|
|
||||||
public static final String WEI_XIU_ROLE_IDS = "KuGuanRoleIDs";
|
public static final String WEI_XIU_ROLE_IDS = "KuGuanRoleIDs";
|
||||||
|
|
||||||
public static final String LEASE_TASK_AUDIT_ROLE_KEYS = "LeaseTaskAuditRoleKeys";
|
public static final String LEASE_TASK_AUDIT_ROLE_IDS = "LeaseTaskAuditRoleIDs";
|
||||||
|
|
||||||
public static final String BACK_TASK_AUDIT_ROLE_KEYS = "BackTaskAuditRoleKeys";
|
public static final String BACK_TASK_AUDIT_ROLE_IDS = "BackTaskAuditRoleIDs";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@ public interface IBmConfigService
|
||||||
*/
|
*/
|
||||||
public int deleteBmConfigById(Long id);
|
public int deleteBmConfigById(Long id);
|
||||||
|
|
||||||
public List<String> getLeaseTaskAuditRoleKeys();
|
public List<String> getLeaseTaskAuditRoleIds();
|
||||||
|
|
||||||
public List<String> getBackTaskAuditRoleKeys();
|
public List<String> getBackTaskAuditRoleIds();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -147,9 +147,9 @@ public class BmConfigServiceImpl implements IBmConfigService
|
||||||
}
|
}
|
||||||
|
|
||||||
/**获取所设定的领料审核角色列表*/
|
/**获取所设定的领料审核角色列表*/
|
||||||
public List<String> getLeaseTaskAuditRoleKeys() {
|
public List<String> getLeaseTaskAuditRoleIds() {
|
||||||
List<String> list = new ArrayList();
|
List<String> list = new ArrayList();
|
||||||
BmConfig bmConfig = bmConfigMapper.selectBmConfigByItemName(BmConfigItems.LEASE_TASK_AUDIT_ROLE_KEYS);
|
BmConfig bmConfig = bmConfigMapper.selectBmConfigByItemName(BmConfigItems.LEASE_TASK_AUDIT_ROLE_IDS);
|
||||||
if (Objects.nonNull(bmConfig)) {
|
if (Objects.nonNull(bmConfig)) {
|
||||||
String value = getValueWithDefault(bmConfig.getItemValue(), "");
|
String value = getValueWithDefault(bmConfig.getItemValue(), "");
|
||||||
if (StringUtils.isNotEmpty(value)) {
|
if (StringUtils.isNotEmpty(value)) {
|
||||||
|
|
@ -160,9 +160,9 @@ public class BmConfigServiceImpl implements IBmConfigService
|
||||||
}
|
}
|
||||||
|
|
||||||
/**获取所设定的退料审核角色列表*/
|
/**获取所设定的退料审核角色列表*/
|
||||||
public List<String> getBackTaskAuditRoleKeys() {
|
public List<String> getBackTaskAuditRoleIds() {
|
||||||
List<String> list = new ArrayList();
|
List<String> list = new ArrayList();
|
||||||
BmConfig bmConfig = bmConfigMapper.selectBmConfigByItemName(BmConfigItems.BACK_TASK_AUDIT_ROLE_KEYS);
|
BmConfig bmConfig = bmConfigMapper.selectBmConfigByItemName(BmConfigItems.BACK_TASK_AUDIT_ROLE_IDS);
|
||||||
if (Objects.nonNull(bmConfig)) {
|
if (Objects.nonNull(bmConfig)) {
|
||||||
String value = getValueWithDefault(bmConfig.getItemValue(), "");
|
String value = getValueWithDefault(bmConfig.getItemValue(), "");
|
||||||
if (StringUtils.isNotEmpty(value)) {
|
if (StringUtils.isNotEmpty(value)) {
|
||||||
|
|
|
||||||
|
|
@ -32,9 +32,9 @@ public class TmTaskAuditLog extends BaseEntity {
|
||||||
@ApiModelProperty(value = "任务类型(定义数据字典)")
|
@ApiModelProperty(value = "任务类型(定义数据字典)")
|
||||||
private Long taskType;
|
private Long taskType;
|
||||||
|
|
||||||
/** 角色权限字符串 */
|
/** 角色Id字符串 */
|
||||||
@Excel(name = "角色权限字符串")
|
@Excel(name = "角色Id字符串")
|
||||||
@ApiModelProperty(value = "角色权限字符串")
|
@ApiModelProperty(value = "角色Id字符串")
|
||||||
private String roleKey;
|
private String roleId;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -118,26 +118,26 @@ public class TmTaskAuditLogServiceImpl implements ITmTaskAuditLogService {
|
||||||
public TmTaskAuditResult getAuditResult(TmTaskAuditLog tmTaskAuditLog) {
|
public TmTaskAuditResult getAuditResult(TmTaskAuditLog tmTaskAuditLog) {
|
||||||
List<String> needRoles = new ArrayList<>();
|
List<String> needRoles = new ArrayList<>();
|
||||||
if (MaterialConstants.LEASE_TASK_TYPE.equals(tmTaskAuditLog.getTaskType())) {
|
if (MaterialConstants.LEASE_TASK_TYPE.equals(tmTaskAuditLog.getTaskType())) {
|
||||||
needRoles = bmConfigService.getLeaseTaskAuditRoleKeys();
|
needRoles = bmConfigService.getLeaseTaskAuditRoleIds();
|
||||||
} else if (MaterialConstants.BACK_TASK_TYPE.equals(tmTaskAuditLog.getTaskType())) {
|
} else if (MaterialConstants.BACK_TASK_TYPE.equals(tmTaskAuditLog.getTaskType())) {
|
||||||
needRoles = bmConfigService.getBackTaskAuditRoleKeys();
|
needRoles = bmConfigService.getBackTaskAuditRoleIds();
|
||||||
} //TODO, add more tasks logic to get needRoles
|
} //TODO, add more tasks logic to get needRoles
|
||||||
|
|
||||||
if (CollectionUtils.isEmpty(needRoles)) {
|
if (CollectionUtils.isEmpty(needRoles)) {
|
||||||
return new TmTaskAuditResult(true);
|
return new TmTaskAuditResult(true);
|
||||||
} else {
|
} else {
|
||||||
List<String> auditRoleKeys = selectTmTaskAuditRoleKeyList(tmTaskAuditLog);
|
List<String> auditRoleIds = selectTmTaskAuditRoleKeyList(tmTaskAuditLog);
|
||||||
String nextRole = needRoles.get(0);
|
String nextRole = needRoles.get(0);
|
||||||
boolean finished = false;
|
boolean finished = false;
|
||||||
for (int i = 0; i < needRoles.size(); i++) {
|
for (int i = 0; i < needRoles.size(); i++) {
|
||||||
if (i < needRoles.size() - 1) {
|
if (i < needRoles.size() - 1) {
|
||||||
// 遍历,还没到最后一个
|
// 遍历,还没到最后一个
|
||||||
if (auditRoleKeys.contains(needRoles.get(i))) {
|
if (auditRoleIds.contains(needRoles.get(i))) {
|
||||||
nextRole = needRoles.get(i + 1);
|
nextRole = needRoles.get(i + 1);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// 遍历,已经到最后一个了
|
// 遍历,已经到最后一个了
|
||||||
if (auditRoleKeys.contains(needRoles.get(i))) {
|
if (auditRoleIds.contains(needRoles.get(i))) {
|
||||||
nextRole = "";
|
nextRole = "";
|
||||||
finished = true;
|
finished = true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectTmTaskAuditRoleKeyList" parameterType="com.bonus.material.task.domain.TmTaskAuditLog" resultType="java.lang.String">
|
<select id="selectTmTaskAuditRoleKeyList" parameterType="com.bonus.material.task.domain.TmTaskAuditLog" resultType="java.lang.String">
|
||||||
select role_key
|
select role_id
|
||||||
from tm_task_audit_log
|
from tm_task_audit_log
|
||||||
<where>
|
<where>
|
||||||
<if test="taskId != null "> and task_id = #{taskId}</if>
|
<if test="taskId != null "> and task_id = #{taskId}</if>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue