|
@@ -1,5 +1,7 @@
|
|
|
package com.ruoyi.powerdistribution.service.impl;
|
|
|
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.HashSet;
|
|
|
import java.util.List;
|
|
|
|
|
|
import com.alibaba.fastjson2.JSONArray;
|
|
@@ -160,22 +162,43 @@ public class PdmWorkPlanServiceImpl implements IPdmWorkPlanService
|
|
|
* @param riskRoleList
|
|
|
*/
|
|
|
void checkRisk(PdmWorkPlan plan,List<PdmRiskRole> riskRoleList){
|
|
|
+ outerloop:
|
|
|
for(PdmRiskRole riskRole:riskRoleList){
|
|
|
JSONObject json = JSONObject.parseObject(riskRole.getRoleDes());
|
|
|
- JSONArray jsonArray = json.getJSONArray("must");//暂时只有必须
|
|
|
- for (int i = 0; i < jsonArray.size(); i++) {
|
|
|
- String value = (String)jsonArray.get(i);
|
|
|
- if(plan.getOpContent().contains(value)){
|
|
|
- plan.setRiskType(riskRole.getRoleCode());
|
|
|
+ if(json.containsKey("must")) {
|
|
|
+ JSONArray jsonArray = json.getJSONArray("must");//单个
|
|
|
+ for (int i = 0; i < jsonArray.size(); i++) {
|
|
|
+ String value = (String) jsonArray.get(i);
|
|
|
+ if (plan.getOpContent().contains(value)) {
|
|
|
+ plan.setRiskType(riskRole.getRoleCode());
|
|
|
+ break outerloop;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- //如果没触发任何规则,则置为1:已处理
|
|
|
- if("0".equals(plan.getRiskType())){
|
|
|
- plan.setRiskType("1");
|
|
|
+ if(json.containsKey("combination")){
|
|
|
+ JSONArray jsonArrayCombination = json.getJSONArray("combination");//组合
|
|
|
+ for (int i = 0; i < jsonArrayCombination.size(); i++) {
|
|
|
+ JSONArray jsonArrayChild = jsonArrayCombination.getJSONArray(i);
|
|
|
+ boolean checkResult = true;
|
|
|
+ for (int j = 0; j < jsonArrayChild.size(); j++) {
|
|
|
+ String value = (String) jsonArrayChild.get(j);
|
|
|
+ if (!plan.getOpContent().contains(value)) {
|
|
|
+ checkResult = false;
|
|
|
+ break ;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(checkResult){
|
|
|
+ plan.setRiskType(riskRole.getRoleCode());
|
|
|
+ break outerloop;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ //如果没触发任何规则,则置为1:已处理
|
|
|
+ if("0".equals(plan.getRiskType())){
|
|
|
+ plan.setRiskType("1");
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
-
|
|
|
}
|