|
|
|
@ -30,6 +30,7 @@ import com.gaotao.modules.sys.entity.SysSceneExceptionRuleConditionEntity; |
|
|
|
import com.gaotao.modules.sys.entity.SysSceneExceptionRuleEntity; |
|
|
|
import com.gaotao.modules.sys.mapper.SysSceneExceptionRuleMapper; |
|
|
|
import com.gaotao.modules.sys.service.SysMsgService; |
|
|
|
import com.gaotao.modules.sys.service.SysUserRoleService; |
|
|
|
import com.gaotao.modules.trans.dao.TransNoControlMapper; |
|
|
|
import com.gaotao.modules.trans.entity.TransNoControl; |
|
|
|
import org.slf4j.Logger; |
|
|
|
@ -86,6 +87,8 @@ public class ScheduleServiceImpl implements ScheduleService { |
|
|
|
private ScheduleTodoMessageMapper scheduleTodoMessageMapper; |
|
|
|
@Autowired |
|
|
|
private TransNoControlMapper transNoControlMapper; |
|
|
|
@Autowired |
|
|
|
private SysUserRoleService sysUserRoleService; |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@ -3717,6 +3720,9 @@ public class ScheduleServiceImpl implements ScheduleService { |
|
|
|
@Override |
|
|
|
public Map<String, Object> getTodoCenterStats(Map<String, Object> inData) { |
|
|
|
Map<String, Object> query = buildTodoCenterQuery(inData, false); |
|
|
|
if (needMatchRoleForBadge(inData) && !applyRoleFilterForBadge(query, inData)) { |
|
|
|
return buildEmptyTodoCenterStats(); |
|
|
|
} |
|
|
|
Map<String, Object> dbStats = scheduleTodoMessageMapper.getTodoCenterStats(query); |
|
|
|
Map<String, Object> result = new HashMap<>(); |
|
|
|
result.put("totalCount", toDefaultInt(dbStats == null ? null : dbStats.get("totalCount"), 0)); |
|
|
|
@ -3767,6 +3773,7 @@ public class ScheduleServiceImpl implements ScheduleService { |
|
|
|
query.put("forceType", trimToEmpty(inData == null ? null : inData.get("forceType"))); |
|
|
|
query.put("todoStatus", trimToEmpty(inData == null ? null : inData.get("todoStatus"))); |
|
|
|
query.put("status", trimToEmpty(inData == null ? null : inData.get("status"))); |
|
|
|
query.put("matchRoleOnly", trimToEmpty(inData == null ? null : inData.get("matchRoleOnly"))); |
|
|
|
|
|
|
|
if (includePaging) { |
|
|
|
int pageNo = toPositiveInt(inData == null ? null : inData.get("page"), 1); |
|
|
|
@ -3801,6 +3808,63 @@ public class ScheduleServiceImpl implements ScheduleService { |
|
|
|
return StringUtils.hasText(text) ? text : ""; |
|
|
|
} |
|
|
|
|
|
|
|
private boolean needMatchRoleForBadge(Map<String, Object> inData) { |
|
|
|
String matchRoleOnly = trimToEmpty(inData == null ? null : inData.get("matchRoleOnly")); |
|
|
|
return FLAG_Y.equalsIgnoreCase(matchRoleOnly) || "true".equalsIgnoreCase(matchRoleOnly); |
|
|
|
} |
|
|
|
|
|
|
|
private boolean applyRoleFilterForBadge(Map<String, Object> query, Map<String, Object> inData) { |
|
|
|
Long userId = toLong(inData == null ? null : inData.get("userId")); |
|
|
|
if (userId == null || userId <= 0) { |
|
|
|
return false; |
|
|
|
} |
|
|
|
List<Long> roleIdList = sysUserRoleService.queryRoleIdList(userId); |
|
|
|
if (CollectionUtils.isEmpty(roleIdList)) { |
|
|
|
return false; |
|
|
|
} |
|
|
|
List<String> responsibilityDeptList = new ArrayList<>(); |
|
|
|
for (Long roleId : roleIdList) { |
|
|
|
if (roleId != null) { |
|
|
|
responsibilityDeptList.add(String.valueOf(roleId)); |
|
|
|
} |
|
|
|
} |
|
|
|
if (responsibilityDeptList.isEmpty()) { |
|
|
|
return false; |
|
|
|
} |
|
|
|
query.put("responsibilityDeptList", responsibilityDeptList); |
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
|
private Map<String, Object> buildEmptyTodoCenterStats() { |
|
|
|
Map<String, Object> result = new HashMap<>(); |
|
|
|
result.put("totalCount", 0); |
|
|
|
result.put("pendingAuditCount", 0); |
|
|
|
result.put("pendingOperateCount", 0); |
|
|
|
result.put("unauditedCount", 0); |
|
|
|
result.put("lockPendingCount", 0); |
|
|
|
result.put("pendingTotalCount", 0); |
|
|
|
result.put("completedCount", 0); |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
private Long toLong(Object value) { |
|
|
|
if (value == null) { |
|
|
|
return null; |
|
|
|
} |
|
|
|
if (value instanceof Number) { |
|
|
|
return ((Number) value).longValue(); |
|
|
|
} |
|
|
|
String text = String.valueOf(value).trim(); |
|
|
|
if (!StringUtils.hasText(text)) { |
|
|
|
return null; |
|
|
|
} |
|
|
|
try { |
|
|
|
return Long.parseLong(text); |
|
|
|
} catch (Exception e) { |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private List<SplitRollMetricContext> buildSplitRollMetricContexts(SearchScheduleData inData) { |
|
|
|
List<SplitRollMetricContext> contextList = new ArrayList<>(); |
|
|
|
List<Map<String, Object>> rollRows = inData.getRollRows(); |
|
|
|
|