Browse Source

团sop-列表页 查询已发布的sop列表

weijinhao 3 years ago
parent
commit
6cb5cea6b6

+ 12 - 6
fm-sop/src/main/java/com/persagy/fm/sop/controller/GroupSopController.java

@@ -150,12 +150,18 @@ public class GroupSopController {
         return ToolsUtil.successJsonMsg(item);
     }
 
-
-
-
-
-
-
+    /**
+     * 集团sop-列表页  查询已发布的sop列表
+     * @param sopListForSelVo
+     * @return
+     * @throws Exception
+     */
+    @PostMapping("/queryPublishedSopList")
+    public String queryPublishedSopList(@RequestBody QuerySopListForSelVo sopListForSelVo) throws Exception{
+        sopListForSelVo.setProjectId(CommonConst.group_sop_id);
+        JSONObject item = groupSopService.queryPublishedSopList(sopListForSelVo);
+        return ToolsUtil.successJsonMsg(item);
+    }
 
 
 

+ 10 - 0
fm-sop/src/main/java/com/persagy/fm/sop/service/GroupSopService.java

@@ -9,6 +9,16 @@ import java.util.List;
 import java.util.Set;
 
 public interface GroupSopService {
+
+    /**
+     * 查询已发布的sop列表
+     *              设置默认的项目ID
+     * @param jsonStr
+     * @return
+     * @throws Exception
+     */
+    public JSONObject queryPublishedSopList(QuerySopListForSelVo jsonStr) throws Exception;
+
     /**
      * 集团sop-新增页-添加发布状态sop
      * @param saveSopVo

+ 36 - 7
fm-sop/src/main/java/com/persagy/fm/sop/service/impl/GroupSopServiceImpl.java

@@ -9,10 +9,7 @@ import com.persagy.fm.sop.model.dto.*;
 import com.persagy.fm.sop.model.vo.*;
 import com.persagy.fm.sop.service.*;
 import com.persagy.old.cache.OrderTypeCache;
-import com.persagy.old.common.CommonConst;
-import com.persagy.old.common.DateUtil;
-import com.persagy.old.common.SopConst;
-import com.persagy.old.common.StringUtil;
+import com.persagy.old.common.*;
 import com.persagy.old.dao.DBConst;
 import com.persagy.old.dao.DBConst.Result;
 import com.persagy.old.service.EquipModelServiceI;
@@ -59,8 +56,39 @@ public class GroupSopServiceImpl implements GroupSopService {
     private SopEquipModelRelService sopEquipModelRelService;
 
 
-
-
+    @Override
+    public JSONObject queryPublishedSopList(QuerySopListForSelVo sopListForSelVo) throws Exception {
+        String projectId = sopListForSelVo.getProjectId();
+        //1.根据update和项目id查询
+        List<Sop> sops = queryPublishedSopsByProjectIdAndUpdatetime(sopListForSelVo, projectId);
+        /*
+            //========2.移除待修订状态sop=======
+            //如果不是集团的sop的查询
+            if (!jsonObject.getString("project_id").equals(CommonConst.group_sop_id)) {
+                //移除待修订z状态的sop
+                removeGroupReviseSop(sops);
+                String rootProjFuncType = objectService.queryRootProjFuncTypeById(jsonObject.getString("project_id"));
+                removeWithoutProJFuncType(sops, rootProjFuncType);
+            }
+         */
+        //=========3.筛选SOP========
+        //根据 sign_codes 进行筛选
+        sops = filterSopBySignCodes(sopListForSelVo.getSign_codes(), sops, projectId);
+        sops = filterSopByFitScope(sopListForSelVo, sops);
+        //=========4设置返回字段======
+        //这里有两种类型的1-查询发布  2-查询可复制引用
+        List<SopInfoVo> sopInfoVos = additionalSopDetail(sops,projectId,"1");
+        //------------设置过滤项-----
+        JSONObject item = new JSONObject();
+        if (sopListForSelVo.isNeed_return_criteria()) {
+            Map<String, Object> criteria = getSopListCriteria(sops, sopInfoVos);
+            item.put("criteria", criteria);
+        }
+        //在此进行格式转化返回给前端
+        item.put("content", sopInfoVos);
+        item.put("count", sopInfoVos.size());
+        return item;
+    }
 
     @Override
     @Transactional
@@ -453,12 +481,13 @@ public class GroupSopServiceImpl implements GroupSopService {
         //=========3设置返回字段======
 
         List<SopInfoVo> sopInfoVos = additionalSopDetail(sops,projectId,"2");
+
         JSONObject item = new JSONObject();
-        //------------设置过滤项-----
         if (sopListForSelVo.isNeed_return_criteria()) {
             Map<String, Object> criteria = getSopListCriteria(sops, sopInfoVos);
             item.put("criteria", criteria);
         }
+
         //JSONArray content = new JSONArray();
        /* for (Object object : sops) {
             content.add(JSONUtil.getJsonObjectWithKeys((JSONObject)object, querySopListForSel_keys));