领退料审核流逻辑优化

This commit is contained in:
sxu 2024-11-01 17:33:58 +08:00
parent d82dccea6d
commit fb174749d9
6 changed files with 18 additions and 18 deletions

View File

@ -10,9 +10,9 @@ public class BmConfigItems {
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";

View File

@ -68,7 +68,7 @@ public interface IBmConfigService
*/
public int deleteBmConfigById(Long id);
public List<String> getLeaseTaskAuditRoleKeys();
public List<String> getLeaseTaskAuditRoleIds();
public List<String> getBackTaskAuditRoleKeys();
public List<String> getBackTaskAuditRoleIds();
}

View File

@ -147,9 +147,9 @@ public class BmConfigServiceImpl implements IBmConfigService
}
/**获取所设定的领料审核角色列表*/
public List<String> getLeaseTaskAuditRoleKeys() {
public List<String> getLeaseTaskAuditRoleIds() {
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)) {
String value = getValueWithDefault(bmConfig.getItemValue(), "");
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();
BmConfig bmConfig = bmConfigMapper.selectBmConfigByItemName(BmConfigItems.BACK_TASK_AUDIT_ROLE_KEYS);
BmConfig bmConfig = bmConfigMapper.selectBmConfigByItemName(BmConfigItems.BACK_TASK_AUDIT_ROLE_IDS);
if (Objects.nonNull(bmConfig)) {
String value = getValueWithDefault(bmConfig.getItemValue(), "");
if (StringUtils.isNotEmpty(value)) {

View File

@ -32,9 +32,9 @@ public class TmTaskAuditLog extends BaseEntity {
@ApiModelProperty(value = "任务类型(定义数据字典)")
private Long taskType;
/** 角色权限字符串 */
@Excel(name = "角色权限字符串")
@ApiModelProperty(value = "角色权限字符串")
private String roleKey;
/** 角色Id字符串 */
@Excel(name = "角色Id字符串")
@ApiModelProperty(value = "角色Id字符串")
private String roleId;
}

View File

@ -118,26 +118,26 @@ public class TmTaskAuditLogServiceImpl implements ITmTaskAuditLogService {
public TmTaskAuditResult getAuditResult(TmTaskAuditLog tmTaskAuditLog) {
List<String> needRoles = new ArrayList<>();
if (MaterialConstants.LEASE_TASK_TYPE.equals(tmTaskAuditLog.getTaskType())) {
needRoles = bmConfigService.getLeaseTaskAuditRoleKeys();
needRoles = bmConfigService.getLeaseTaskAuditRoleIds();
} else if (MaterialConstants.BACK_TASK_TYPE.equals(tmTaskAuditLog.getTaskType())) {
needRoles = bmConfigService.getBackTaskAuditRoleKeys();
needRoles = bmConfigService.getBackTaskAuditRoleIds();
} //TODO, add more tasks logic to get needRoles
if (CollectionUtils.isEmpty(needRoles)) {
return new TmTaskAuditResult(true);
} else {
List<String> auditRoleKeys = selectTmTaskAuditRoleKeyList(tmTaskAuditLog);
List<String> auditRoleIds = selectTmTaskAuditRoleKeyList(tmTaskAuditLog);
String nextRole = needRoles.get(0);
boolean finished = false;
for (int i = 0; i < needRoles.size(); i++) {
if (i < needRoles.size() - 1) {
// 遍历还没到最后一个
if (auditRoleKeys.contains(needRoles.get(i))) {
if (auditRoleIds.contains(needRoles.get(i))) {
nextRole = needRoles.get(i + 1);
}
} else {
// 遍历已经到最后一个了
if (auditRoleKeys.contains(needRoles.get(i))) {
if (auditRoleIds.contains(needRoles.get(i))) {
nextRole = "";
finished = true;
}

View File

@ -29,7 +29,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<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
<where>
<if test="taskId != null "> and task_id = #{taskId}</if>