Bladeren bron

临时提交

weijinhao 3 jaren geleden
bovenliggende
commit
ac7923c86f

+ 571 - 23
fm-sop/src/main/java/com/persagy/fm/sop/controller/GroupSopController.java

@@ -1,13 +1,16 @@
 package com.persagy.fm.sop.controller;
 
+import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.persagy.fm.common.response.FmResponseMsg;
 import com.persagy.fm.common.response.FmResponseUtil;
-import com.persagy.fm.sop.model.dto.RefSopInfo;
+import com.persagy.fm.sop.model.dto.*;
 import com.persagy.fm.sop.model.vo.*;
-import com.persagy.fm.sop.service.GroupSopService;
-import com.persagy.old.common.CommonConst;
-import com.persagy.old.common.ToolsUtil;
+import com.persagy.fm.sop.service.*;
+import com.persagy.old.common.*;
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.lang.BooleanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.PostMapping;
@@ -15,9 +18,7 @@ import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 @RestController
 @RequestMapping("restGroupSopService")
@@ -29,14 +30,15 @@ public class GroupSopController {
 
     /**
      * 集团sop-新增页-添加发布状态sop
-     *
+     * <p>
      * 重构完成
+     *
      * @param saveSopVo
      * @return
      * @throws Exception
      */
     @PostMapping("/addPublishedSop")
-    public FmResponseMsg addPublishedSop(@RequestBody  SaveSopVo saveSopVo) throws Exception {
+    public FmResponseMsg addPublishedSop(@RequestBody SaveSopVo saveSopVo) throws Exception {
         //设置查询的项目类型为集团类型的
         saveSopVo.setProject_id(CommonConst.group_sop_id);
         groupSopService.addPublishedSop(saveSopVo);
@@ -46,14 +48,15 @@ public class GroupSopController {
 
     /**
      * 集团sop-新增页-验证sop
-     *
+     * <p>
      * 重构完成
+     *
      * @param saveSopVo
      * @return
      * @throws Exception
      */
     @PostMapping("/verifySopBeforePublish")
-    public FmResponseMsg verifySopBeforePublish(@RequestBody SaveSopVo saveSopVo) throws Exception{
+    public FmResponseMsg verifySopBeforePublish(@RequestBody SaveSopVo saveSopVo) throws Exception {
         saveSopVo.setProject_id(CommonConst.group_sop_id);
         groupSopService.verifySopForPublish(saveSopVo);
         return FmResponseUtil.successMsg("验证成功");
@@ -61,88 +64,633 @@ public class GroupSopController {
 
     /**
      * 集团sop-新增页-添加草稿状态sop
-     *
+     * <p>
      * 重构完成
+     *
      * @param
      * @return
      * @throws Exception
      */
     @PostMapping("/addDraftSop")
-    public String addDraftSop(@RequestBody SaveSopEditVo saveSopEditVo) throws Exception{
+    public String addDraftSop(@RequestBody SaveSopEditVo saveSopEditVo) throws Exception {
         saveSopEditVo.setProject_id(CommonConst.group_sop_id);
         String sopId = groupSopService.addDraftSop(saveSopEditVo);
         Map<String, Object> ret = new HashMap<>();
-        ret.put("sop_id",sopId);
+        ret.put("sop_id", sopId);
         return ToolsUtil.successJsonMsg(ret);
     }
 
     /**
      * 集团sop-编辑页-编辑sop时验证sop名称
      * 重构完成
+     *
      * @param verifySopNameVo
      * @return
      * @throws Exception
      */
     @PostMapping("/verifySopNameForUpdate")
-    public String verifySopNameForUpdate(@RequestBody @Validated VerifySopNameVo verifySopNameVo) throws Exception{
+    public String verifySopNameForUpdate(@RequestBody @Validated VerifySopNameVo verifySopNameVo) throws Exception {
         boolean isCan = groupSopService.verifySopBeforePublish(verifySopNameVo);
-        return ToolsUtil.successJsonMsg(JSONObject.parseObject("{\"can_use\":"+isCan+"}"));
+        return ToolsUtil.successJsonMsg(JSONObject.parseObject("{\"can_use\":" + isCan + "}"));
 
     }
 
     /**
      * 详细页-查询当前sop被引用的sop列表
      * 重构完成
+     *
      * @param querySopReferenceVo
      * @return
      * @throws Exception
      */
 
     @PostMapping("/queryReferencedSopListById")
-    public String  queryReferencedSopListById(@RequestBody QuerySopReferenceVo querySopReferenceVo) throws Exception{
+    public String queryReferencedSopListById(@RequestBody QuerySopReferenceVo querySopReferenceVo) throws Exception {
         List<RefSopInfo> refSopInfos = groupSopService.queryReferencedSopListById(querySopReferenceVo);
-       return ToolsUtil.successJsonMsg(refSopInfos);
+        return ToolsUtil.successJsonMsg(refSopInfos);
     }
 
     /**
      * 新增页:查询可供选择的sop,复制、引用时用
+     *
      * @param jsonStr
      * @return
      * @throws Exception
      */
     @PostMapping("/verifySopNameForAdd")
-    public String verifySopNameForAdd(@RequestBody VerifySopNameVo verifySopNameVo) throws Exception{
+    public String verifySopNameForAdd(@RequestBody VerifySopNameVo verifySopNameVo) throws Exception {
         boolean isCan = groupSopService.verifySopBeforePublish(verifySopNameVo);
-        return ToolsUtil.successJsonMsg(JSONObject.parseObject("{\"can_use\":"+isCan+"}"));
+        return ToolsUtil.successJsonMsg(JSONObject.parseObject("{\"can_use\":" + isCan + "}"));
 
     }
 
 
     /**
      * 集团sop-编辑页-保存草稿状态sop
+     *
      * @param saveSopVo
      * @return
      * @throws Exception
      */
     @PostMapping("/saveDraftSop")
-    public String saveDraftSop(@RequestBody SaveDraftSopVo saveSopVo) throws Exception{
+    public String saveDraftSop(@RequestBody SaveDraftSopVo saveSopVo) throws Exception {
         saveSopVo.setProject_id(CommonConst.group_sop_id);
         return ToolsUtil.successJsonMsg("");
     }
 
+    /**
+     * 新增页:查询可供选择的sop,复制、引用时用
+     * @param jsonStr
+     * @return
+     * @throws Exception
+     */
+    @PostMapping("/querySopListForSel")
+    public String querySopListForSel(@RequestBody QuerySopListForSelVo sopListForSelVo) throws Exception{
+
+        String sopId = sopListForSelVo.getSop_id();
+        String projectId = CommonConst.group_sop_id;
+        String sop_name = sopListForSelVo.getSop_name();
+        //是否返回包含大类对象的sop  true:返回   false:不返回 (默认返回)
+        Boolean flag = true;
+        if(BooleanUtils.isFalse(sopListForSelVo.isIs_contains_classObj())) {
+            flag = false;
+        }
+        //1.根据update和项目id查询
+        List<Sop> sops = queryPublishedSopsByProjectIdAndUpdatetime(sopListForSelVo, projectId);
+        //2筛选sop
+
+        /*
+        removeReviseSop(sops);//已经直接放到sql 语句中查询了
+        if (!jsonObject.getString("project_id").equals(CommonConst.group_sop_id)) {
+			String rootProjFuncType = objectService.queryRootProjFuncTypeById(jsonObject.getString("project_id"));
+			removeWithoutProJFuncType(sops, rootProjFuncType);
+		}
+         */
+        removeRelSop(sops,projectId,sopId);
+
+        if (!flag) {
+            Iterator<Sop> iterator = sops.iterator();
+            while (iterator.hasNext()) {
+                Sop sopItem = iterator.next();
+                if (isContainsClassObj(sopItem)) {
+                    iterator.remove();
+                }
+            }
+        }
+
+        //sops = filterSopByName(sop_name, sops); 直接在sql 中解决
+        sops = filterSopByFitScope(sopListForSelVo, sops);
+
+        //=========3设置返回字段======
+        sops = additionalSopDetail(sops,jsonObject.getString("project_id"),"2");
+
+        //------------设置过滤项-----
+        if (sopListForSelVo.isNeed_return_criteria()) {
+            JSONObject criteria = getSopListCriteria(sops);
+            item.put("criteria", criteria);
+        }
+        JSONArray content = new JSONArray();
+        for (Object object : sops) {
+            content.add(JSONUtil.getJsonObjectWithKeys((JSONObject)object, querySopListForSel_keys));
+        }
+        item.put("content", content);
+        item.put("count", content.size());
+        return ToolsUtil.successJsonMsg(item);
+
+
+
+
+
+        return groupSopService.querySopListForSel(jsonObject.toJSONString());
+    }
+
 
+    private JSONObject getSopListCriteria(JSONArray content) throws Exception {
+        // 遍历结果过滤字段、组合返回查询参数
+        JSONObject sopItem,  equipModel;
+        JSONObject criteria = new JSONObject();
 
+        if (content != null) {
+
+            HashMap<String, String> equipModelMap = collectEquipModeFromSops(content);
+            JSONArray equipModels = new JSONArray();
+            for (String equipModelId : equipModelMap.keySet()) {
+                equipModel = new JSONObject();
+                equipModel.put("equip_model_id", equipModelId);
+                equipModel.put("equip_model_name", equipModelMap.get(equipModelId));
+                equipModels.add(equipModel);
+            }
+
+            HashMap<String, Object> fitObjMap = collectFitObjsFromSops(content);
+            JSONArray fitObjs = new JSONArray();
+            for (String fitObjId : fitObjMap.keySet()) {
+                fitObjs.add(fitObjMap.get(fitObjId));
+            }
+
+            HashMap<String, Object> OrderTypeMap = collectOrderTypeFromSops(content);
+            JSONArray orderTypes = new JSONArray();
+            for (String OrderTypeId : OrderTypeMap.keySet()) {
+                orderTypes.add(OrderTypeMap.get(OrderTypeId));
+            }
+
+            JSONArray labels = new JSONArray();
+            for (int i = 0; i < content.size(); i++) {
+                sopItem = content.getJSONObject(i);
+                JSONArray labelsItem = sopItem.getJSONArray("labels");
+                if (labelsItem == null) {
+                    continue;
+                }
+                for (int j = 0; j < labelsItem.size(); j++) {
+                    if (!labels.contains(labelsItem.getString(j))) {
+                        labels.add(labelsItem.getString(j));
+                    }
+                }
+            }
+
+            HashMap<String, Object> signMap = getBathchMergeRecordBySign(content);
+            JSONArray signs = new JSONArray();
+//			signs.addAll(signMap.values());
+            for (String signCode : signMap.keySet()) {
+                signs.add(signMap.get(signCode));
+            }
+            criteria.put("equip_models", equipModels);
+            criteria.put("labels", labels);
+            criteria.put("order_type", orderTypes);
+            criteria.put("fit_objs", fitObjs);
+            criteria.put("signs", signs);
+        }
+
+        return criteria;
+    }
+
+
+    @Autowired
+    private SopLabelRelService sopLabelRelService;
+    @Autowired
+    private SopObjRelService sopObjRelService;
+    @Autowired
+    private SopOrderTypeRelService sopOrderTypeRelService;
+    @Autowired
+    private SopEquipModelRelService sopEquipModelRelService;
+
+
+
+
+    private List<Sop> filterSopByFitScope(QuerySopListForSelVo sopListForSelVo, List<Sop> sops) throws Exception {
+        JSONObject param = JSONObject.parseObject(JSONObject.toJSONString(sopListForSelVo));
+
+        param.remove("project_id");
+        JSONObject epuipModelsResJson = null, labelsResJson = null, orderTypeResJson = null, fitObjResJson = null;
+        if (StringUtil.isEmptyList(param, "equip_model_ids")
+                && StringUtil.isEmptyList(param, "labels")
+                && StringUtil.isEmptyList(param, "order_type")
+                && StringUtil.isEmptyList(param, "fit_obj_ids")) {
+            return sops;
+        }else {
+            //查询条件后的交集
+            Set<String> sopId = new HashSet<>();
+            Map<String, Sop> sopMap = getSopMap(sops);
+            //1.根据适用返回查询sopid
+            //1.1根据设备型号查询
+            if(!StringUtil.isEmptyList(param, "equip_model_ids")){
+                QueryWrapper<SopEquipModelRel> sopEquipModelRelQueryWrapper = new QueryWrapper<>();
+                sopEquipModelRelQueryWrapper.in("equip_model_id",sopListForSelVo.getEquip_model_ids());
+                List<SopEquipModelRel> list = sopEquipModelRelService.list(sopEquipModelRelQueryWrapper);
+
+                Set<String> tmp = new HashSet<>();
+                for (SopEquipModelRel sopEquipModelRel : list) {
+                    tmp.add(sopEquipModelRel.getSopId());
+                }
+                sopId.addAll(tmp);
+            }
+            //1.2根据自定义标签查询
+            if( !StringUtil.isEmptyList(param, "labels")){
+                QueryWrapper<SopLabelRel> query = new QueryWrapper<>();
+                query.in("label",sopListForSelVo.getLabels());
+                List<SopLabelRel> list = sopLabelRelService.list(query);
+                Set<String> tmp = new HashSet<>();
+                for (SopLabelRel sopLabelRel : list) {
+                    tmp.add(sopLabelRel.getSopId());
+                }
+                sopId.retainAll(tmp);
+            }
+            //1.3根据工单类型查询
+            if(!StringUtil.isEmptyList(param, "order_type")){
+                QueryWrapper<SopOrderTypeRel> query = new QueryWrapper<>();
+                query.in("order_type",sopListForSelVo.getOrder_type());
+                List<SopOrderTypeRel> list = sopOrderTypeRelService.list(query);
+                Set<String> tmp = new HashSet<>();
+                for (SopOrderTypeRel sopOrderTypeRel : list) {
+                    tmp.add(sopOrderTypeRel.getSopId());
+                }
+                sopId.retainAll(tmp);
+            }
+            //1.4根据适用对象查询
+            if( !StringUtil.isEmptyList(param, "fit_obj_ids")){
+                QueryWrapper<SopObjRel> query = new QueryWrapper<>();
+                query.in("obj_id",sopListForSelVo.getFit_obj_ids());
+                List<SopObjRel> list = sopObjRelService.list(query);
+                Set<String> tmp = new HashSet<>();
+                for (SopObjRel sopObjRel : list) {
+                    tmp.add(sopObjRel.getSopId());
+                }
+                sopId.retainAll(tmp);
+            }
+
+            //查询出每张表中的id 然后求出一个交集来
+
+            List<Sop> resultSops = new ArrayList<>();
+            for (String s : sopId) {
+                if (sopMap.containsKey(s)) {
+                    resultSops.add(sopMap.get(sopId));
+                }
+            }
+            return resultSops;
+        }
+
+    }
 
     /**
+     *
+     * Description:
+     * @param sops
+     * @return HashMap<String,Sop>    key:sop_id ; value: sop
+     * @author yuecaipu
+     * @since 2018年7月10日: 下午5:50:41
+     * Update By yuecaipu 2018年7月10日: 下午5:50:41
+     */
+    private Map<String, Sop> getSopMap(List<Sop> sops) {
+        Map<String, Sop> resultMap = new HashMap<>();
+        for (Sop sop : sops) {
+            resultMap.put(sop.getSopId(),sop);
+        }
+        return resultMap;
+    }
+
+
+
+    @Autowired
+    private SopService sopService;
+    @Autowired
+    private SopSopRelService sopSopRelService;
+
+    public boolean isContainsClassObj(Sop sop) throws Exception {
+        List<SopStepsBean> steps = sop.getSteps();
+        for (SopStepsBean step : steps) {
+            Boolean from_sop = step.isFrom_sop();
+            //非引用
+            if(!from_sop) {
+                List<SopStepsBean.StepContentBean> step_content = step.getStep_content();
+                for (SopStepsBean.StepContentBean stepContentBean : step_content) {
+                    Boolean from_sop1 = stepContentBean.isFrom_sop();
+                    //非引用
+                    if(!from_sop1) {
+                        List<SopStepsBean.StepContentBean.ContentObjsBean> content_objs = stepContentBean.getContent_objs();
+                        for (SopStepsBean.StepContentBean.ContentObjsBean content_obj : content_objs) {
+                            String obj_type = content_obj.getObj_type();
+                            if (obj_type.contains("_")) {
+                               return true;
+                            }
+                        }
+                    }else {
+                        //如果是引用的haul
+                        String sop_id = stepContentBean.getSop_id();
+                        Sop sop1 = new Sop();
+                        Sop query = sop1.selectById(sop_id);
+                        if(query != null) {
+                            return isContainsClassObj(query);
+                        }
+
+                    }
+                }
+
+
+            }else {
+                //如果是引用的haul
+                String sop_id = step.getSop_id();
+                Sop sop1 = new Sop();
+                Sop query = sop1.selectById(sop_id);
+                if(query != null) {
+                    return isContainsClassObj(query);
+                }
+
+            }
+        }
+        return false;
+
+    }
+
+
+    private void removeRelSop( List<Sop>  sops, String projectId, String sopId) {
+        Set<String> relSopIds = querySopRel(projectId, sopId);
+        relSopIds.add(sopId);
+        Iterator<Sop> iterator = sops.iterator();
+        while (iterator.hasNext()) {
+            Sop next = iterator.next();
+            String nodeId = next.getSopId();
+            if (relSopIds.contains(nodeId)) {
+                iterator.remove();
+            }
+        }
+    }
+
+    public Set<String> querySopRel(String projectId,String sopId) {
+        //key:被引用SOP的主键id  value:引用该SOP的SOP主键id
+        Map<String, Set<String>> relSopId2sopId = new HashMap<>();
+
+        QueryWrapper<SopSopRel> query = new QueryWrapper();
+        query.eq("'",projectId).eq("",sopId).eq("valid",true);
+
+        List<SopSopRel> list = sopSopRelService.list(query);
+        for (SopSopRel sopSopRel : list) {
+            String rel_sop_id = sopSopRel.getRelSopId();
+            String sop_id = sopSopRel.getSopId();
+            Set<String> sopIds = relSopId2sopId.getOrDefault(rel_sop_id, new HashSet<String>());
+            sopIds.add(sop_id);
+            relSopId2sopId.put(rel_sop_id, sopIds);
+        }
+        return getRelSopRecursively(relSopId2sopId,sopId);
+    }
+
+
+    private Set<String> getRelSopRecursively(Map<String, Set<String>> relSopId2sopId, String sopId) {
+        Set<String> relSopIds = new HashSet<>();
+        if (CollectionUtils.isEmpty(relSopId2sopId.get(sopId))) {
+            return relSopIds;
+        }
+        Set<String> set = relSopId2sopId.get(sopId);
+        relSopIds.addAll(set);
+        for (String string : set) {
+            relSopIds.addAll(getRelSopRecursively(relSopId2sopId, string));
+        }
+        return relSopIds;
+    }
+
+
+
+    private List<Sop> queryPublishedSopsByProjectIdAndUpdatetime(QuerySopListForSelVo sopListForSelVo,String projectId) throws Exception {
+        String sop_name = sopListForSelVo.getSop_name();
+        /*
+        //如果项目id 不是集团特有的id的话进入
+		if (!CommonConst.group_sop_id.equals(requestJson.getString("project_id"))) {
+			//如果sign_codes 数时空的话 或者sign_codes 码中包含public 的话
+			if (StringUtil.isEmptyList(requestJson, "sign_codes") || requestJson.getJSONArray("sign_codes").contains("public")) {
+				//设置为group_sop_id
+				projectIds.add(CommonConst.group_sop_id);
+			}
+		}
+
+         */
+        //查询条件为 projectIds valid sop_status SOP_STATUS_PUBLISH,
+        // 大于等于  小于等于   不包含待修订
+
+        QueryWrapper<Sop> query = new QueryWrapper();
+        query.eq("project_id",projectId)
+                .eq("valid",true)
+                .eq("sop_status", SopConst.SOP_STATUS_PUBLISH)
+                .ge("update_time",sopListForSelVo.getUpdate_time_from())
+                .le("update_time",sopListForSelVo.getUpdate_time_to())
+                .ne("publish_status",SopConst.PUBLISH_STATUS_REVISE)
+                .like("sop_name",sop_name);
+
+
+        return  sopService.list(query);
+    }
+
+
+
+
+
+ /*   @Autowired
+    private SopService sopService;
+
+    *//**
      * 集团sop-编辑页-发布sop
+     *
      * @param saveSopVo
      * @return
      * @throws Exception
-     */
+     *//*
     @PostMapping("/publishSop")
-    public String publishSop(@RequestBody SaveSopVo saveSopVo) throws Exception{
+    public String publishSop(@RequestBody SaveSopVo saveSopVo) throws Exception {
         saveSopVo.setProject_id(CommonConst.group_sop_id);
+        //根据sopid 和valid
+
+        QueryWrapper<Sop> query = new QueryWrapper<>();
+        String sop_id = saveSopVo.getSop_id();
+        query.eq("sop_id", sop_id).eq("valid", true);
+        Sop one = sopService.getOne(query);
+
+        Integer versionCount = null;
+        boolean isUpdate = true;
+
+        //此处不是很明白,明明都是空了为啥还有获取
+        if (one == null) {
+            isUpdate = false;
+        } else {
+            versionCount = one.getVersionCount();
+        }
+
+
+        Map<String, Map<String, Object>> sopId_RefProfile = proccessSopIdRefProfile(one.getRefSopIds());
+        if(sopId_RefProfile != null) {
+            if(isUpdate) {
+                proccessSopItem(one,sopId_RefProfile,null);
+            }
+        }else {
+
+        }
+
         return null;
     }
 
+
+    *//**
+     * 处理sop详情 补充引用sop简介,添加内容对象变化标识
+     * @param sop
+     * @param refSopProfile
+     * @Param changedObjIds     objId //对象变化数据key:objId value:{"objId":objId, "objName":objName, "objType":objType}
+     * @return
+     *//*
+    public JSONObject proccessSopItem(Sop sop, Map<String, Map<String, Object>> refSopProfile, Set<String> changedObjIds) {
+        *//*
+         if(changedObjIds != null) {
+            fitObjs = (JSONArray)sop.getOrDefault("fit_objs", new JSONArray());
+            fitObjs = fitObjs == null ? new JSONArray() : fitObjs;
+            for (int i = 0; i < fitObjs.size(); i++) {
+                fitObj = fitObjs.getJSONObject(i);
+                if(changedObjIds.contains(fitObj.getString("obj_id"))){
+                    fitObj.put("is_revise", true);
+                }
+            }
+        }
+         *//*
+
+
+
+        //处理步骤
+        List<SopStepsBean> steps = sop.getSteps();
+        if(CollectionUtils.isNotEmpty(steps)) {
+            for (SopStepsBean step : steps) {
+                if(step.isFrom_sop()) {
+                    //大步为引用sop
+                    String refSopId = step.getSop_id();
+                    Map<String, Object> stringObjectMap = refSopProfile.get(refSopId);
+                   if(stringObjectMap != null) {
+                        *//**********************************//*
+                        //step.putAll(profile);
+                   }
+
+                }else {
+                    List<SopStepsBean.StepContentBean> step_content = step.getStep_content();
+                    if(CollectionUtils.isNotEmpty(step_content)) {
+                        for (SopStepsBean.StepContentBean stepContentBean : step_content) {
+                            if(stepContentBean.isFrom_sop()) {
+                                String refSopId = stepContentBean.getSop_id();
+                                Map<String, Object> stringObjectMap = refSopProfile.get(refSopId);
+                                if(stringObjectMap != null) {
+                                    *//**********************************//*
+                                    //step.putAll(profile);
+                                }
+                            }
+
+                            *//*
+                            {
+                        if(!stepContent.getBooleanValue("from_sop")){
+                            //非引用sop操作
+                            //操作内容
+                            contentObjs = (JSONArray)stepContent.getOrDefault("content_objs", new JSONArray());
+                            if(contentObjs != null){
+                                for(int k=0; k<contentObjs.size(); k++){
+                                    contentObj = contentObjs.getJSONObject(k);
+                                    if(changedObjIds.contains(contentObj.getString("obj_id"))){
+                                        //内容对象变化
+                                        contentObj.put("is_revise", true);
+                                    }else{
+                                        parents = (JSONArray)contentObj.getOrDefault("parents", new JSONArray());
+                                        if(parents != null){
+                                            for(int l=0; l<parents.size(); l++){
+                                                parent = parents.getJSONObject(l);
+                                                parentIds = (JSONArray)parent.getOrDefault("parent_ids", new JSONArray());
+                                                if(parentIds != null){
+                                                    for(int m=0; m<parentIds.size(); m++){
+                                                        parentId = parentIds.getString(m);
+                                                        if(changedObjIds.contains(parentId)){
+                                                            //内容对象所属大类变化
+                                                            contentObj.put("is_revise", true);
+                                                        }
+                                                    }
+                                                }
+                                            }
+                                        }
+                                    }
+                                }
+                            }
+                            //确认结果
+                            if(changedObjIds != null && changedObjIds.size() > 0){
+                                        confirmResults = (JSONArray)stepContent.getOrDefault("confirm_result", new JSONArray());
+                                        if(confirmResults != null){
+                                            for(int k=0; k<confirmResults.size(); k++){
+                                                confirmResult = confirmResults.getJSONObject(k);
+                                                if(changedObjIds.contains(confirmResult.getString("obj_id"))){
+                                                    //确认结果对象变化
+                                                    confirmResult.put("is_revise", true);
+                                                }else{
+                                                    parents = confirmResult.getJSONArray("parents");
+                                                    if(parents != null){
+                                                        for(int l=0; l<parents.size(); l++){
+                                                            parent = parents.getJSONObject(l);
+                                                            parentIds = parent.getJSONArray("parent_ids");
+                                                            if(parentIds != null){
+                                                                for(int m=0; m<parentIds.size(); m++){
+                                                                    parentId = parentIds.getString(m);
+                                                                    if(changedObjIds.contains(parentId)){
+                                                                        //确认结果所属大类变化
+                                                                        confirmResult.put("is_revise", true);
+                                                                    }
+                                                                }
+                                                            }
+                                                        }
+                                                    }
+                                                }
+                                                //信息点
+                                                infoPoints = (JSONArray)confirmResult.getOrDefault("info_points", new JSONArray());
+                                                infoPoints = infoPoints == null ? new JSONArray() : infoPoints;
+                                                for(int l=0; l<infoPoints.size(); l++){
+                                                    infoPoint = infoPoints.getJSONObject(l);
+                                                    if(changedObjIds.contains(infoPoint.getString("id"))){
+                                                        //信息点变化
+                                                        infoPoint.put("is_revise", true);
+                                                    }
+                                                }
+                                            }
+                                        }
+                                    }
+                                }
+                                }
+                             *//*
+
+
+                        }
+                    }
+                }
+            }
+        }
+
+
+        return null;
+    }
+*/
+
+        /**
+         * 处理引用的sop id与简介(sop_name,version,step_count,status_explain,update_time)
+         *
+         * @param refSopIds 被引用sopId集合
+         * @return map      key:sopId  value:sop对象
+         * @throws Exception
+         * @Param userId        调用者
+         */
+    public Map<String, Map<String, Object>> proccessSopIdRefProfile(List<String> refSopIds) throws Exception {
+        return null;
+    }
 }

+ 136 - 0
fm-sop/src/main/java/com/persagy/fm/sop/model/vo/QuerySopListForSelVo.java

@@ -0,0 +1,136 @@
+package com.persagy.fm.sop.model.vo;
+
+import java.util.List;
+
+public class QuerySopListForSelVo {
+
+    /**
+     * user_id : ***
+     * sop_id : ****
+     * sop_name : ***
+     * equip_model_ids : ["***","***"]
+     * labels : ["***","***"]
+     * order_type : ["***","***"]
+     * fit_obj_ids : ["***","***"]
+     * need_return_criteria : true
+     * is_contains_classObj : true
+     */
+
+    private String user_id;
+    private String sop_id;
+    private String sop_name;
+    private Boolean need_return_criteria;
+    private Boolean is_contains_classObj;
+    private List<String> equip_model_ids;
+    private List<String> labels;
+    private List<String> order_type;
+    private List<String> fit_obj_ids;
+
+    private String update_time_from;
+    private String update_time_to;
+
+
+    public Boolean getNeed_return_criteria() {
+        return need_return_criteria;
+    }
+
+    public void setNeed_return_criteria(Boolean need_return_criteria) {
+        this.need_return_criteria = need_return_criteria;
+    }
+
+    public Boolean getIs_contains_classObj() {
+        return is_contains_classObj;
+    }
+
+    public void setIs_contains_classObj(Boolean is_contains_classObj) {
+        this.is_contains_classObj = is_contains_classObj;
+    }
+
+    public String getUpdate_time_from() {
+        return update_time_from;
+    }
+
+    public void setUpdate_time_from(String update_time_from) {
+        this.update_time_from = update_time_from;
+    }
+
+    public String getUpdate_time_to() {
+        return update_time_to;
+    }
+
+    public void setUpdate_time_to(String update_time_to) {
+        this.update_time_to = update_time_to;
+    }
+
+    public String getUser_id() {
+        return user_id;
+    }
+
+    public void setUser_id(String user_id) {
+        this.user_id = user_id;
+    }
+
+    public String getSop_id() {
+        return sop_id;
+    }
+
+    public void setSop_id(String sop_id) {
+        this.sop_id = sop_id;
+    }
+
+    public String getSop_name() {
+        return sop_name;
+    }
+
+    public void setSop_name(String sop_name) {
+        this.sop_name = sop_name;
+    }
+
+    public boolean isNeed_return_criteria() {
+        return need_return_criteria;
+    }
+
+    public void setNeed_return_criteria(boolean need_return_criteria) {
+        this.need_return_criteria = need_return_criteria;
+    }
+
+    public boolean isIs_contains_classObj() {
+        return is_contains_classObj;
+    }
+
+    public void setIs_contains_classObj(boolean is_contains_classObj) {
+        this.is_contains_classObj = is_contains_classObj;
+    }
+
+    public List<String> getEquip_model_ids() {
+        return equip_model_ids;
+    }
+
+    public void setEquip_model_ids(List<String> equip_model_ids) {
+        this.equip_model_ids = equip_model_ids;
+    }
+
+    public List<String> getLabels() {
+        return labels;
+    }
+
+    public void setLabels(List<String> labels) {
+        this.labels = labels;
+    }
+
+    public List<String> getOrder_type() {
+        return order_type;
+    }
+
+    public void setOrder_type(List<String> order_type) {
+        this.order_type = order_type;
+    }
+
+    public List<String> getFit_obj_ids() {
+        return fit_obj_ids;
+    }
+
+    public void setFit_obj_ids(List<String> fit_obj_ids) {
+        this.fit_obj_ids = fit_obj_ids;
+    }
+}