|
|
@@ -165,7 +165,7 @@ public class GxtOrderMineServiceImpl implements IGxtOrderMineService {
|
|
|
// completed状态且有复运权限
|
|
|
if (SecurityUtils.hasPermi("gxt:repairOrder:restart")) {
|
|
|
if (hasConditions) repairFilterSql.append(" OR ");
|
|
|
- repairFilterSql.append("t.work_order_status = 'completed'");
|
|
|
+ repairFilterSql.append("t.work_order_status = 'completed' and t.restart_time is null ");
|
|
|
hasConditions = true;
|
|
|
}
|
|
|
|
|
|
@@ -219,7 +219,7 @@ public class GxtOrderMineServiceImpl implements IGxtOrderMineService {
|
|
|
// completed状态且有复运权限
|
|
|
if (SecurityUtils.hasPermi("gxt:maintenance:order:restart")) {
|
|
|
if (hasConditions) workFilterSql.append(" OR ");
|
|
|
- workFilterSql.append("t.work_order_status = 'completed'");
|
|
|
+ workFilterSql.append("t.work_order_status = 'completed' and t.restart_time is null");
|
|
|
hasConditions = true;
|
|
|
}
|
|
|
|
|
|
@@ -245,6 +245,101 @@ public class GxtOrderMineServiceImpl implements IGxtOrderMineService {
|
|
|
return orderList;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public List<OrderScoreInfo> selectUnionOrderListMyRate(GxtRepairOrder repairOrder, GxtWorkOrder workOrder) {
|
|
|
+ // 添加业务特定的数据权限过滤
|
|
|
+ addBusinessDataScopeFilter(repairOrder, workOrder);
|
|
|
+
|
|
|
+ // 根据用户权限和工单状态进行过滤数据
|
|
|
+ // repairOrder只能查询scoringStatus为to_self、to_re、to_approve、to_final 状态的数据
|
|
|
+ // workOrder只能查询scoringStatus为to_self、to_re、to_approve、to_final状态的数据
|
|
|
+
|
|
|
+ Long currentUserId = SecurityUtils.getUserId();
|
|
|
+
|
|
|
+ // 构建维修工单的权限和状态过滤条件
|
|
|
+ StringBuilder repairFilterSql = new StringBuilder();
|
|
|
+ repairFilterSql.append(" AND (");
|
|
|
+ boolean hasConditions = false;
|
|
|
+
|
|
|
+ // to_self状态且有自评权限且是(工作负责人或者超级管理员角色)
|
|
|
+ if (SecurityUtils.hasPermi("gxt:orderScore:selfEvaluation")) {
|
|
|
+ repairFilterSql.append("(t.scoring_status = 'to_self' AND (t.team_leader_id = ")
|
|
|
+ .append(currentUserId)
|
|
|
+ .append(" OR ")
|
|
|
+ .append(SecurityUtils.getUserId())
|
|
|
+ .append(" IN (SELECT user_id FROM sys_user WHERE user_name = 'admin')))");
|
|
|
+ hasConditions = true;
|
|
|
+ }
|
|
|
+
|
|
|
+ // to_re状态且有复评权限且是工作负责人
|
|
|
+ if (SecurityUtils.hasPermi("gxt:orderScore:review")) {
|
|
|
+ if (hasConditions) repairFilterSql.append(" OR ");
|
|
|
+ repairFilterSql.append("t.scoring_status = 'to_re'");
|
|
|
+ hasConditions = true;
|
|
|
+ }
|
|
|
+
|
|
|
+ // to_final状态且有终评权限
|
|
|
+ if (SecurityUtils.hasPermi("gxt:orderScore:finalEvaluation")) {
|
|
|
+ if (hasConditions) repairFilterSql.append(" OR ");
|
|
|
+ repairFilterSql.append("t.scoring_status = 'to_final'");
|
|
|
+ hasConditions = true;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 如果没有任何权限,则不返回任何数据
|
|
|
+ if (!hasConditions) {
|
|
|
+ repairFilterSql = new StringBuilder();
|
|
|
+ repairFilterSql.append(" AND 1=0"); // 永远为false的条件,确保不返回任何数据
|
|
|
+ } else {
|
|
|
+ repairFilterSql.append(")");
|
|
|
+ }
|
|
|
+
|
|
|
+ repairOrder.getParams().put("scoreStatusFilter", repairFilterSql.toString());
|
|
|
+
|
|
|
+ // 构建维保工单的权限和状态过滤条件
|
|
|
+ StringBuilder workFilterSql = new StringBuilder();
|
|
|
+ workFilterSql.append(" AND (");
|
|
|
+ hasConditions = false;
|
|
|
+
|
|
|
+ // to_self状态且有自评权限且是(工作负责人或者超级管理员角色)
|
|
|
+ if (SecurityUtils.hasPermi("gxt:orderScore:selfEvaluation")) {
|
|
|
+ workFilterSql.append("(t.scoring_status = 'to_self' AND (t.team_leader_id = ")
|
|
|
+ .append(currentUserId)
|
|
|
+ .append(" OR ")
|
|
|
+ .append(SecurityUtils.getUserId())
|
|
|
+ .append(" IN (SELECT user_id FROM sys_user WHERE user_name = 'admin')))");
|
|
|
+ hasConditions = true;
|
|
|
+ }
|
|
|
+
|
|
|
+ // to_re状态且有复评权限
|
|
|
+ if (SecurityUtils.hasPermi("gxt:orderScore:review")) {
|
|
|
+ if (hasConditions) workFilterSql.append(" OR ");
|
|
|
+ workFilterSql.append("t.scoring_status = 'to_re'");
|
|
|
+ hasConditions = true;
|
|
|
+ }
|
|
|
+
|
|
|
+ // to_final状态且有终评权限
|
|
|
+ if (SecurityUtils.hasPermi("gxt:orderScore:finalEvaluation")) {
|
|
|
+ if (hasConditions) workFilterSql.append(" OR ");
|
|
|
+ workFilterSql.append("t.scoring_status = 'to_final'");
|
|
|
+ hasConditions = true;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 如果没有任何权限,则不返回任何数据
|
|
|
+ if (!hasConditions) {
|
|
|
+ workFilterSql = new StringBuilder();
|
|
|
+ workFilterSql.append(" AND 1=0"); // 永远为false的条件,确保不返回任何数据
|
|
|
+ } else {
|
|
|
+ workFilterSql.append(")");
|
|
|
+ }
|
|
|
+
|
|
|
+ workOrder.getParams().put("scoreStatusFilter", workFilterSql.toString());
|
|
|
+
|
|
|
+ // 查询工单列表
|
|
|
+ List<OrderScoreInfo> orderList = gxtOrderMineMapper.selectUnionOrderList(repairOrder, workOrder);
|
|
|
+
|
|
|
+ return orderList;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 添加业务特定的数据权限过滤条件
|
|
|
* 基于角色的数据范围进行自定义权限控制
|