Kaynağa Gözat

重构集团版本到添加草稿状态sop

weijinhao 3 yıl önce
ebeveyn
işleme
f710963cb2
83 değiştirilmiş dosya ile 13902 ekleme ve 1063 silme
  1. 67 0
      fm-sop/pom.xml
  2. 71 155
      fm-sop/src/main/java/com/persagy/fm/sop/controller/GroupSopController.java
  3. 1 1
      fm-sop/src/main/java/com/persagy/fm/sop/controller/SopController.java
  4. 21 0
      fm-sop/src/main/java/com/persagy/fm/sop/controller/SopEditController.java
  5. 21 0
      fm-sop/src/main/java/com/persagy/fm/sop/controller/SopEquipModelRelController.java
  6. 21 0
      fm-sop/src/main/java/com/persagy/fm/sop/controller/SopLabelRelController.java
  7. 21 0
      fm-sop/src/main/java/com/persagy/fm/sop/controller/SopObjRelController.java
  8. 21 0
      fm-sop/src/main/java/com/persagy/fm/sop/controller/SopOrderTypeRelController.java
  9. 21 0
      fm-sop/src/main/java/com/persagy/fm/sop/controller/SopSopRelController.java
  10. 16 0
      fm-sop/src/main/java/com/persagy/fm/sop/dao/SopEditMapper.java
  11. 39 0
      fm-sop/src/main/java/com/persagy/fm/sop/dao/SopEditMapper.xml
  12. 1 1
      fm-sop/src/main/java/com/persagy/fm/sop/dao/SopEquipModelRelMapper.java
  13. 1 1
      fm-sop/src/main/java/com/persagy/fm/sop/dao/SopLabelRelMapper.java
  14. 1 1
      fm-sop/src/main/java/com/persagy/fm/sop/dao/SopMapper.java
  15. 2 1
      fm-sop/src/main/java/com/persagy/fm/sop/dao/SopMapper.xml
  16. 1 1
      fm-sop/src/main/java/com/persagy/fm/sop/dao/SopObjRelMapper.java
  17. 1 1
      fm-sop/src/main/java/com/persagy/fm/sop/dao/SopOrderTypeRelMapper.java
  18. 1 1
      fm-sop/src/main/java/com/persagy/fm/sop/dao/SopSopRelMapper.java
  19. 67 0
      fm-sop/src/main/java/com/persagy/fm/sop/model/dto/RefSopInfo.java
  20. 234 8
      fm-sop/src/main/java/com/persagy/fm/sop/model/dto/Sop.java
  21. 373 0
      fm-sop/src/main/java/com/persagy/fm/sop/model/dto/SopEdit.java
  22. 60 7
      fm-sop/src/main/java/com/persagy/fm/sop/model/dto/SopEquipModelRel.java
  23. 60 7
      fm-sop/src/main/java/com/persagy/fm/sop/model/dto/SopLabelRel.java
  24. 70 11
      fm-sop/src/main/java/com/persagy/fm/sop/model/dto/SopObjRel.java
  25. 69 7
      fm-sop/src/main/java/com/persagy/fm/sop/model/dto/SopOrderTypeRel.java
  26. 69 7
      fm-sop/src/main/java/com/persagy/fm/sop/model/dto/SopSopRel.java
  27. 794 0
      fm-sop/src/main/java/com/persagy/fm/sop/model/dto/SopStepsBean.java
  28. 45 0
      fm-sop/src/main/java/com/persagy/fm/sop/model/vo/QuerySopReferenceVo.java
  29. 18 0
      fm-sop/src/main/java/com/persagy/fm/sop/model/vo/SaveSopEditVo.java
  30. 7 786
      fm-sop/src/main/java/com/persagy/fm/sop/model/vo/SaveSopVo.java
  31. 45 0
      fm-sop/src/main/java/com/persagy/fm/sop/model/vo/VerifySopNameVo.java
  32. 48 0
      fm-sop/src/main/java/com/persagy/fm/sop/service/GroupSopService.java
  33. 16 0
      fm-sop/src/main/java/com/persagy/fm/sop/service/SopEditService.java
  34. 1 1
      fm-sop/src/main/java/com/persagy/fm/sop/service/SopEquipModelRelService.java
  35. 1 1
      fm-sop/src/main/java/com/persagy/fm/sop/service/SopLabelRelService.java
  36. 1 1
      fm-sop/src/main/java/com/persagy/fm/sop/service/SopObjRelService.java
  37. 1 1
      fm-sop/src/main/java/com/persagy/fm/sop/service/SopOrderTypeRelService.java
  38. 1 1
      fm-sop/src/main/java/com/persagy/fm/sop/service/SopService.java
  39. 1 1
      fm-sop/src/main/java/com/persagy/fm/sop/service/SopSopRelService.java
  40. 440 0
      fm-sop/src/main/java/com/persagy/fm/sop/service/impl/GroupSopServiceImpl.java
  41. 20 0
      fm-sop/src/main/java/com/persagy/fm/sop/service/impl/SopEditServiceImpl.java
  42. 1 1
      fm-sop/src/main/java/com/persagy/fm/sop/service/impl/SopEquipModelRelServiceImpl.java
  43. 1 1
      fm-sop/src/main/java/com/persagy/fm/sop/service/impl/SopLabelRelServiceImpl.java
  44. 1 1
      fm-sop/src/main/java/com/persagy/fm/sop/service/impl/SopObjRelServiceImpl.java
  45. 1 1
      fm-sop/src/main/java/com/persagy/fm/sop/service/impl/SopOrderTypeRelServiceImpl.java
  46. 1 1
      fm-sop/src/main/java/com/persagy/fm/sop/service/impl/SopServiceImpl.java
  47. 1 1
      fm-sop/src/main/java/com/persagy/fm/sop/service/impl/SopSopRelServiceImpl.java
  48. 0 4
      fm-sop/src/main/java/com/persagy/fm/sop/utils/TimeUtils.java
  49. 0 43
      fm-sop/src/main/java/com/persagy/fm/sop/utils/ToolsUtil.java
  50. 56 0
      fm-sop/src/main/java/com/persagy/old/cache/ComponentRelationCache.java
  51. 42 0
      fm-sop/src/main/java/com/persagy/old/cache/DictionaryCache.java
  52. 63 0
      fm-sop/src/main/java/com/persagy/old/cache/GraphCache.java
  53. 42 0
      fm-sop/src/main/java/com/persagy/old/cache/InfoPointCache.java
  54. 32 0
      fm-sop/src/main/java/com/persagy/old/cache/OrderTypeCache.java
  55. 52 0
      fm-sop/src/main/java/com/persagy/old/cache/ProjectCache.java
  56. 1 4
      fm-sop/src/main/java/com/persagy/fm/sop/constant/CommonConst.java
  57. 50 0
      fm-sop/src/main/java/com/persagy/old/common/CommonMessage.java
  58. 88 0
      fm-sop/src/main/java/com/persagy/old/common/DataRequestPathUtil.java
  59. 669 0
      fm-sop/src/main/java/com/persagy/old/common/DataRequestProcessUtil.java
  60. 62 0
      fm-sop/src/main/java/com/persagy/old/common/DateUtil.java
  61. 10 0
      fm-sop/src/main/java/com/persagy/old/common/IJSONOperator.java
  62. 715 0
      fm-sop/src/main/java/com/persagy/old/common/JSONUtil.java
  63. 302 0
      fm-sop/src/main/java/com/persagy/old/common/RedisConstant.java
  64. 87 0
      fm-sop/src/main/java/com/persagy/old/common/SopConst.java
  65. 214 0
      fm-sop/src/main/java/com/persagy/old/common/SopUtil.java
  66. 350 0
      fm-sop/src/main/java/com/persagy/old/common/StringUtil.java
  67. 273 0
      fm-sop/src/main/java/com/persagy/old/common/ToolsUtil.java
  68. 106 0
      fm-sop/src/main/java/com/persagy/old/common/Tree.java
  69. 140 0
      fm-sop/src/main/java/com/persagy/old/common/TreeNode.java
  70. 78 0
      fm-sop/src/main/java/com/persagy/old/common/enums/ObjectLevel.java
  71. 435 0
      fm-sop/src/main/java/com/persagy/old/config/RedisConfig.java
  72. 31 0
      fm-sop/src/main/java/com/persagy/old/config/Schema.java
  73. 137 0
      fm-sop/src/main/java/com/persagy/old/dao/DBAgent.java
  74. 674 0
      fm-sop/src/main/java/com/persagy/old/dao/DBCommonMethods.java
  75. 1 1
      fm-sop/src/main/java/com/persagy/fm/sop/constant/DBConst.java
  76. 36 0
      fm-sop/src/main/java/com/persagy/old/dao/PersagyManageClient.java
  77. 585 0
      fm-sop/src/main/java/com/persagy/old/service/BaseService.java
  78. 391 0
      fm-sop/src/main/java/com/persagy/old/service/DictionaryServiceI.java
  79. 495 0
      fm-sop/src/main/java/com/persagy/old/service/ObjectServiceI.java
  80. 884 0
      fm-sop/src/main/java/com/persagy/old/service/impl/DictionaryServiceImpl.java
  81. 4022 0
      fm-sop/src/main/java/com/persagy/old/service/impl/ObjectServiceImpl.java
  82. 1 1
      fm-sop/src/main/resources/bootstrap.yml
  83. 3 2
      fm-sop/src/main/test/CodeGenerator.java

+ 67 - 0
fm-sop/pom.xml

@@ -10,6 +10,9 @@
     <modelVersion>4.0.0</modelVersion>
     <artifactId>fm-sop</artifactId>
     <packaging>jar</packaging>
+    <properties>
+        <hbase.version>1.3.0</hbase.version>
+    </properties>
     <dependencies>
         <dependency>
             <groupId>org.projectlombok</groupId>
@@ -39,5 +42,69 @@
             <artifactId>velocity-engine-core</artifactId>
             <version>2.3</version>
         </dependency>
+
+        <dependency>
+            <groupId>com.sagacloud</groupId>
+            <artifactId>zillion-util</artifactId>
+            <version>2.2.3</version>
+            <exclusions>
+                <exclusion>
+                    <groupId>org.apache.httpcomponents</groupId>
+                    <artifactId>httpclient</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>org.apache.httpcomponents</groupId>
+                    <artifactId>httpcore</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.hbase</groupId>
+            <artifactId>hbase-server</artifactId>
+            <version>${hbase.version}</version>
+            <exclusions>
+                <exclusion>
+                    <groupId>com.sun.jersey</groupId>
+                    <artifactId>jersey-server</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>com.sun.jersey</groupId>
+                    <artifactId>jersey-core</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>com.sun.jersey</groupId>
+                    <artifactId>jersey-json</artifactId>
+                </exclusion>
+                <!--  <exclusion>
+                    <groupId>com.google.guava</groupId>
+                    <artifactId>guava</artifactId>
+                </exclusion>-->
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.hbase</groupId>
+            <artifactId>hbase-client</artifactId>
+            <version>${hbase.version}</version>
+            <exclusions>
+                <exclusion>
+                    <groupId>com.google.guava</groupId>
+                    <artifactId>guava</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>com.sagacloud</groupId>
+            <artifactId>json-lib-zillion</artifactId>
+            <version>1.0</version>
+            <type>jar</type>
+            <exclusions>
+                <exclusion>
+                    <groupId>com.google.guava</groupId>
+                    <artifactId>guava</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+
     </dependencies>
 </project>

+ 71 - 155
fm-sop/src/main/java/com/persagy/fm/sop/controller/GroupSopController.java

@@ -1,186 +1,102 @@
 package com.persagy.fm.sop.controller;
 
+import com.alibaba.fastjson.JSONObject;
 import com.persagy.fm.common.response.FmResponseMsg;
 import com.persagy.fm.common.response.FmResponseUtil;
-import com.persagy.fm.sop.constant.CommonConst;
-import com.persagy.fm.sop.constant.DBConst;
-import com.persagy.fm.sop.model.dto.*;
+import com.persagy.fm.sop.model.dto.RefSopInfo;
+import com.persagy.fm.sop.model.vo.QuerySopReferenceVo;
+import com.persagy.fm.sop.model.vo.SaveSopEditVo;
 import com.persagy.fm.sop.model.vo.SaveSopVo;
-import com.persagy.fm.sop.utils.ToolsUtil;
-import org.apache.commons.beanutils.BeanUtils;
-import org.apache.commons.collections.CollectionUtils;
-import org.apache.commons.lang.BooleanUtils;
-import org.springframework.transaction.annotation.Transactional;
+import com.persagy.fm.sop.model.vo.VerifySopNameVo;
+import com.persagy.fm.sop.service.GroupSopService;
+import com.persagy.old.common.CommonConst;
+import com.persagy.old.common.ToolsUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
-import java.lang.reflect.InvocationTargetException;
-import java.util.*;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 
 @RestController
 @RequestMapping("restGroupSopService")
 public class GroupSopController {
-    //添加参数逻辑校验工作
-    @PostMapping("addPublishedSop")
-    public FmResponseMsg addPublishedSop(@RequestBody  SaveSopVo saveSopVo) throws Exception {
 
+    @Autowired
+    private GroupSopService groupSopService;
+
+
+    /**
+     * 集团sop-新增页-添加发布状态sop
+     * @param saveSopVo
+     * @return
+     * @throws Exception
+     */
+    @PostMapping("/addPublishedSop")
+    public FmResponseMsg addPublishedSop(@RequestBody  SaveSopVo saveSopVo) throws Exception {
         //设置查询的项目类型为集团类型的
         saveSopVo.setProject_id(CommonConst.group_sop_id);
-        saveSopVo.setSop_id(ToolsUtil.getRecordId(DBConst.TABLE_SOP_ID_TAG));
-        //找到sop 与与对象、设备型号、工单类型、自定义标签、sop关系 并插入数据库中
-        addSopRelation(saveSopVo);
-        //落库本条sop*/
-
+        groupSopService.addPublishedSop(saveSopVo);
         return FmResponseUtil.successMsg("保存成功");
     }
 
 
-    @Transactional
-    public boolean addSopRelation(SaveSopVo saveSopVo) throws Exception{
-
-        //添加sop与对象关系-sop_obj_rel
-        List<SaveSopVo.FitObjsBean> sopRelObjs = getSopRelObjs(saveSopVo);
-        if(CollectionUtils.isNotEmpty(sopRelObjs)) {
-            for (SaveSopVo.FitObjsBean sopRelObj : sopRelObjs) {
-                SopObjRel build = SopObjRel.builder()
-                        .sopId(saveSopVo.getSop_id())
-                        .objId(sopRelObj.getObj_id())
-                        .objType(sopRelObj.getObj_type())
-                        .valid(true)
-                        .build();
-
-                build.insert();
-            }
-        }
-
-        //添加sop与设备型号关系-sop_equip_model_rel
-        List<String> equip_model_ids = saveSopVo.getEquip_model_ids();
-        distinctCollection(equip_model_ids);
-        if(CollectionUtils.isNotEmpty(equip_model_ids)) {
-            for (String equip_model_id : equip_model_ids) {
-                SopEquipModelRel sopEquipModelRel = new SopEquipModelRel();
-                sopEquipModelRel.setEquipModelId(equip_model_id);
-                sopEquipModelRel.setSopId(saveSopVo.getSop_id());
-                sopEquipModelRel.setValid(true);
-                sopEquipModelRel.insert();
-            }
-        }
-
-        //添加sop与工单类型关系-sop_order_type_rel
-        List<String> order_types = saveSopVo.getOrder_type();
-        distinctCollection(order_types);
-        if(CollectionUtils.isNotEmpty(order_types)) {
-            for (String order_type : order_types) {
-                SopOrderTypeRel sopOrderTypeRel = new SopOrderTypeRel();
-                sopOrderTypeRel.setOrderType(order_type);
-                sopOrderTypeRel.setProjectId(saveSopVo.getProject_id());
-                sopOrderTypeRel.setValid(true);
-                sopOrderTypeRel.setSopId(saveSopVo.getSop_id());
-                sopOrderTypeRel.insert();
-            }
-        }
-        //添加sop与自定义标签关系-sop_label_rel
-        List<String> labels = saveSopVo.getLabels();
-        distinctCollection(labels);
-        if(CollectionUtils.isNotEmpty(labels)) {
-            for (String label : labels) {
-                SopLabelRel sopLabelRel = new SopLabelRel();
-                sopLabelRel.setLabel(label);
-                sopLabelRel.setSopId(saveSopVo.getSop_id());
-                sopLabelRel.setValid(true);
-                sopLabelRel.insert();
-            }
-        }
-        //添加sop与sop关系-sop_sop_rel
-        Set<String> sopRefSops = getSopRefSops(saveSopVo);
-        if(CollectionUtils.isNotEmpty(sopRefSops)) {
-            for (String sopRefSop : sopRefSops) {
-                SopSopRel sopSopRel = new SopSopRel();
-                sopSopRel.setProjectId(saveSopVo.getProject_id());
-                sopSopRel.setRelSopId(sopRefSop);
-                sopSopRel.setSopId(saveSopVo.getSop_id());
-                sopSopRel.setValid(true);
-            }
-        }
-
-        return true;
-
+    /**
+     * 集团sop-新增页-验证sop
+     * @param saveSopVo
+     * @return
+     * @throws Exception
+     */
+    @PostMapping("/verifySopBeforePublish")
+    public FmResponseMsg verifySopBeforePublish(@RequestBody SaveSopVo saveSopVo) throws Exception{
+        saveSopVo.setProject_id(CommonConst.group_sop_id);
+        groupSopService.verifySopForPublish(saveSopVo);
+        return FmResponseUtil.successMsg("验证成功");
     }
 
-    public void distinctCollection(List<String> list) {
-        HashSet set = new HashSet(list);
-        list.clear();
-        list.addAll(set);
+    /**
+     * 集团sop-新增页-添加草稿状态sop
+     * @param
+     * @return
+     * @throws Exception
+     */
+    @PostMapping("/addDraftSop")
+    public String addDraftSop(@RequestBody SaveSopEditVo saveSopEditVo) throws Exception{
+        String sopId = groupSopService.addDraftSop(saveSopEditVo);
+        Map<String, Object> ret = new HashMap<>();
+        ret.put("sop_id",sopId);
+        return ToolsUtil.successJsonMsg(ret);
     }
 
-    public  List<SaveSopVo.FitObjsBean> getSopRelObjs(SaveSopVo sop) throws InvocationTargetException, IllegalAccessException {
-        List<SaveSopVo.FitObjsBean> sopRelObjs = new ArrayList<>();
-        Map<String,SaveSopVo.FitObjsBean> objectId_Object = new HashMap<>();
+    /**
+     * 集团sop-编辑页-编辑sop时验证sop名称
+     * @param verifySopNameVo
+     * @return
+     * @throws Exception
+     */
+    @PostMapping("/verifySopNameForUpdate")
+    public String verifySopNameForUpdate(@RequestBody @Validated VerifySopNameVo verifySopNameVo) throws Exception{
+        boolean isCan = groupSopService.verifySopBeforePublish(verifySopNameVo);
+        return ToolsUtil.successJsonMsg(JSONObject.parseObject("{\"can_use\":"+isCan+"}"));
 
-        if(sop != null) {
-            //查询适用的对象
-            List<SaveSopVo.FitObjsBean> fit_objs = sop.getFit_objs();
-            if(CollectionUtils.isNotEmpty(fit_objs)) {
-                for (SaveSopVo.FitObjsBean fit_obj : fit_objs) {
-                    objectId_Object.put(fit_obj.getObj_id(),fit_obj);
-                }
-            }
-            List<SaveSopVo.StepsBean> steps = sop.getSteps();
-            if(CollectionUtils.isNotEmpty(steps)) {
-                for (SaveSopVo.StepsBean step : steps) {
-                    //如果不是来自引用的对象
-                    if(BooleanUtils.isFalse(step.isFrom_sop())) {
-                        List<SaveSopVo.StepsBean.StepContentBean> step_content = step.getStep_content();
-                        if(CollectionUtils.isNotEmpty(step_content)) {
-                            for (SaveSopVo.StepsBean.StepContentBean stepContentBean : step_content) {
-                                List<SaveSopVo.StepsBean.StepContentBean.ContentObjsBean> content_objs = stepContentBean.getContent_objs();
-                                if(CollectionUtils.isNotEmpty(content_objs)) {
-                                    for (SaveSopVo.StepsBean.StepContentBean.ContentObjsBean content_obj : content_objs) {
-                                        //进行数值拷贝到一个对象中去
-                                        SaveSopVo.FitObjsBean fitObjsBean = new SaveSopVo.FitObjsBean();
-                                        BeanUtils.copyProperties(fitObjsBean,content_obj);
-                                        objectId_Object.put(content_obj.getObj_id(),fitObjsBean);
-                                    }
-                                }
-                            }
-                        }
-                    }
-                }
-            }
-        }
-
-        //sop中 适用对象和步骤中的对象
-        for (SaveSopVo.FitObjsBean value : objectId_Object.values()) {
-            sopRelObjs.add(value);
-        }
-        return sopRelObjs;
     }
 
-    public Set<String> getSopRefSops(SaveSopVo sop){
-        LinkedHashSet<String> sopIds = new LinkedHashSet<>();
-        if(sop != null) {
+    /**
+     * 详细页-查询当前sop被引用的sop列表
+     * @param querySopReferenceVo
+     * @return
+     * @throws Exception
+     */
+
+    @PostMapping("/queryReferencedSopListById")
+    public String  queryReferencedSopListById(@RequestBody QuerySopReferenceVo querySopReferenceVo) throws Exception{
+        List<RefSopInfo> refSopInfos = groupSopService.queryReferencedSopListById(querySopReferenceVo);
+       return ToolsUtil.successJsonMsg(refSopInfos);
+    }
 
-            List<SaveSopVo.StepsBean> steps = sop.getSteps();
-            if(CollectionUtils.isNotEmpty(steps)) {
-                for (SaveSopVo.StepsBean step : steps) {
-                    if (BooleanUtils.isTrue(step.isFrom_sop())) {
-                        sopIds.add(step.getSop_id());
-                    } else {
-                        List<SaveSopVo.StepsBean.StepContentBean> step_content = step.getStep_content();
-                        if(CollectionUtils.isNotEmpty(step_content)) {
-                            for (SaveSopVo.StepsBean.StepContentBean stepContentBean : step_content) {
-                                if (BooleanUtils.isTrue(stepContentBean.isFrom_sop())) {
-                                    sopIds.add(stepContentBean.getSop_id());
-                                }
 
-                            }
-                        }
-                    }
-                }
-            }
-        }
-        return sopIds;
-    }
 }

+ 1 - 1
fm-sop/src/main/java/com/persagy/fm/sop/controller/SopController.java

@@ -11,7 +11,7 @@ import org.springframework.web.bind.annotation.RestController;
  * </p>
  *
  * @author weijinhao
- * @since 2021-03-16
+ * @since 2021-03-17
  */
 @RestController
 @RequestMapping("/sop")

+ 21 - 0
fm-sop/src/main/java/com/persagy/fm/sop/controller/SopEditController.java

@@ -0,0 +1,21 @@
+package com.persagy.fm.sop.controller;
+
+
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ *  前端控制器
+ * </p>
+ *
+ * @author weijinhao
+ * @since 2021-03-17
+ */
+@RestController
+@RequestMapping("/sop-edit")
+public class SopEditController {
+
+}
+

+ 21 - 0
fm-sop/src/main/java/com/persagy/fm/sop/controller/SopEquipModelRelController.java

@@ -0,0 +1,21 @@
+package com.persagy.fm.sop.controller;
+
+
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ *  前端控制器
+ * </p>
+ *
+ * @author weijinhao
+ * @since 2021-03-17
+ */
+@RestController
+@RequestMapping("/sop-equip-model-rel")
+public class SopEquipModelRelController {
+
+}
+

+ 21 - 0
fm-sop/src/main/java/com/persagy/fm/sop/controller/SopLabelRelController.java

@@ -0,0 +1,21 @@
+package com.persagy.fm.sop.controller;
+
+
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ *  前端控制器
+ * </p>
+ *
+ * @author weijinhao
+ * @since 2021-03-17
+ */
+@RestController
+@RequestMapping("/sop-label-rel")
+public class SopLabelRelController {
+
+}
+

+ 21 - 0
fm-sop/src/main/java/com/persagy/fm/sop/controller/SopObjRelController.java

@@ -0,0 +1,21 @@
+package com.persagy.fm.sop.controller;
+
+
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ *  前端控制器
+ * </p>
+ *
+ * @author weijinhao
+ * @since 2021-03-17
+ */
+@RestController
+@RequestMapping("/sop-obj-rel")
+public class SopObjRelController {
+
+}
+

+ 21 - 0
fm-sop/src/main/java/com/persagy/fm/sop/controller/SopOrderTypeRelController.java

@@ -0,0 +1,21 @@
+package com.persagy.fm.sop.controller;
+
+
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ *  前端控制器
+ * </p>
+ *
+ * @author weijinhao
+ * @since 2021-03-17
+ */
+@RestController
+@RequestMapping("/sop-order-type-rel")
+public class SopOrderTypeRelController {
+
+}
+

+ 21 - 0
fm-sop/src/main/java/com/persagy/fm/sop/controller/SopSopRelController.java

@@ -0,0 +1,21 @@
+package com.persagy.fm.sop.controller;
+
+
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ *  前端控制器
+ * </p>
+ *
+ * @author weijinhao
+ * @since 2021-03-17
+ */
+@RestController
+@RequestMapping("/sop-sop-rel")
+public class SopSopRelController {
+
+}
+

+ 16 - 0
fm-sop/src/main/java/com/persagy/fm/sop/dao/SopEditMapper.java

@@ -0,0 +1,16 @@
+package com.persagy.fm.sop.dao;
+
+import com.persagy.fm.sop.model.dto.SopEdit;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author weijinhao
+ * @since 2021-03-17
+ */
+public interface SopEditMapper extends BaseMapper<SopEdit> {
+
+}

+ 39 - 0
fm-sop/src/main/java/com/persagy/fm/sop/dao/SopEditMapper.xml

@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.persagy.fm.sop.dao.SopEditMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.persagy.fm.sop.model.dto.SopEdit">
+        <id column="sop_edit_id" property="sopEditId" />
+        <result column="sop_id" property="sopId" />
+        <result column="project_id" property="projectId" />
+        <result column="extend_field" property="extendField" />
+        <result column="operator" property="operator" />
+        <result column="sop_name" property="sopName" />
+        <result column="sop_type" property="sopType" />
+        <result column="no_obj" property="noObj" />
+        <result column="domains" property="domains" />
+        <result column="tools" property="tools" />
+        <result column="order_type" property="orderType" />
+        <result column="fit_objs" property="fitObjs" />
+        <result column="equip_model_ids" property="equipModelIds" />
+        <result column="labels" property="labels" />
+        <result column="steps" property="steps" />
+        <result column="related_data" property="relatedData" />
+        <result column="sop_status" property="sopStatus" />
+        <result column="publish_status" property="publishStatus" />
+        <result column="ref_sop_ids" property="refSopIds" />
+        <result column="version" property="version" />
+        <result column="version_count" property="versionCount" />
+        <result column="version_explain" property="versionExplain" />
+        <result column="create_time" property="createTime" />
+        <result column="update_time" property="updateTime" />
+        <result column="valid" property="valid" />
+    </resultMap>
+
+    <!-- 通用查询结果列 -->
+    <sql id="Base_Column_List">
+        sop_edit_id, sop_id, project_id, extend_field, operator, sop_name, sop_type, no_obj, domains, tools, order_type, fit_objs, equip_model_ids, labels, steps, related_data, sop_status, publish_status, ref_sop_ids, version, version_count, version_explain, create_time, update_time, valid
+    </sql>
+
+</mapper>

+ 1 - 1
fm-sop/src/main/java/com/persagy/fm/sop/dao/SopEquipModelRelMapper.java

@@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  * </p>
  *
  * @author weijinhao
- * @since 2021-03-16
+ * @since 2021-03-17
  */
 public interface SopEquipModelRelMapper extends BaseMapper<SopEquipModelRel> {
 

+ 1 - 1
fm-sop/src/main/java/com/persagy/fm/sop/dao/SopLabelRelMapper.java

@@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  * </p>
  *
  * @author weijinhao
- * @since 2021-03-16
+ * @since 2021-03-17
  */
 public interface SopLabelRelMapper extends BaseMapper<SopLabelRel> {
 

+ 1 - 1
fm-sop/src/main/java/com/persagy/fm/sop/dao/SopMapper.java

@@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  * </p>
  *
  * @author weijinhao
- * @since 2021-03-16
+ * @since 2021-03-17
  */
 public interface SopMapper extends BaseMapper<Sop> {
 

+ 2 - 1
fm-sop/src/main/java/com/persagy/fm/sop/dao/SopMapper.xml

@@ -23,6 +23,7 @@
         <result column="sop_status" property="sopStatus" />
         <result column="publish_status" property="publishStatus" />
         <result column="ref_sop_ids" property="refSopIds" />
+        <result column="version" property="version" />
         <result column="version_count" property="versionCount" />
         <result column="version_explain" property="versionExplain" />
         <result column="version_exp" property="versionExp" />
@@ -32,7 +33,7 @@
 
     <!-- 通用查询结果列 -->
     <sql id="Base_Column_List">
-        sop_id, project_id, extend_field, operator, sop_name, sop_type, no_obj, domains, order_type, tools, fit_objs, equip_model_ids, labels, steps_version, steps, related_data, sop_status, publish_status, ref_sop_ids, version_count, version_explain, version_exp, valid, update_time
+        sop_id, project_id, extend_field, operator, sop_name, sop_type, no_obj, domains, order_type, tools, fit_objs, equip_model_ids, labels, steps_version, steps, related_data, sop_status, publish_status, ref_sop_ids, version, version_count, version_explain, version_exp, valid, update_time
     </sql>
 
 </mapper>

+ 1 - 1
fm-sop/src/main/java/com/persagy/fm/sop/dao/SopObjRelMapper.java

@@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  * </p>
  *
  * @author weijinhao
- * @since 2021-03-16
+ * @since 2021-03-17
  */
 public interface SopObjRelMapper extends BaseMapper<SopObjRel> {
 

+ 1 - 1
fm-sop/src/main/java/com/persagy/fm/sop/dao/SopOrderTypeRelMapper.java

@@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  * </p>
  *
  * @author weijinhao
- * @since 2021-03-16
+ * @since 2021-03-17
  */
 public interface SopOrderTypeRelMapper extends BaseMapper<SopOrderTypeRel> {
 

+ 1 - 1
fm-sop/src/main/java/com/persagy/fm/sop/dao/SopSopRelMapper.java

@@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  * </p>
  *
  * @author weijinhao
- * @since 2021-03-16
+ * @since 2021-03-17
  */
 public interface SopSopRelMapper extends BaseMapper<SopSopRel> {
 

+ 67 - 0
fm-sop/src/main/java/com/persagy/fm/sop/model/dto/RefSopInfo.java

@@ -0,0 +1,67 @@
+package com.persagy.fm.sop.model.dto;
+
+public class RefSopInfo {
+    private String ref_sop_id;
+    private String ref_sop_name;
+    private String version;
+    private String sop_type;
+    private String stauts_explain;
+    private String operator;
+    private String update_time;
+
+    public String getRef_sop_id() {
+        return ref_sop_id;
+    }
+
+    public void setRef_sop_id(String ref_sop_id) {
+        this.ref_sop_id = ref_sop_id;
+    }
+
+    public String getRef_sop_name() {
+        return ref_sop_name;
+    }
+
+    public void setRef_sop_name(String ref_sop_name) {
+        this.ref_sop_name = ref_sop_name;
+    }
+
+    public String getVersion() {
+        return version;
+    }
+
+    public void setVersion(String version) {
+        this.version = version;
+    }
+
+    public String getSop_type() {
+        return sop_type;
+    }
+
+    public void setSop_type(String sop_type) {
+        this.sop_type = sop_type;
+    }
+
+    public String getStauts_explain() {
+        return stauts_explain;
+    }
+
+    public void setStauts_explain(String stauts_explain) {
+        this.stauts_explain = stauts_explain;
+    }
+
+    public String getOperator() {
+        return operator;
+    }
+
+    public void setOperator(String operator) {
+        this.operator = operator;
+    }
+
+    public String getUpdate_time() {
+        return update_time;
+    }
+
+    public void setUpdate_time(String update_time) {
+        this.update_time = update_time;
+    }
+}

+ 234 - 8
fm-sop/src/main/java/com/persagy/fm/sop/model/dto/Sop.java

@@ -4,9 +4,6 @@ import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.extension.activerecord.Model;
 import com.baomidou.mybatisplus.annotation.TableId;
 import java.io.Serializable;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-import lombok.experimental.Accessors;
 
 /**
  * <p>
@@ -14,11 +11,8 @@ import lombok.experimental.Accessors;
  * </p>
  *
  * @author weijinhao
- * @since 2021-03-16
+ * @since 2021-03-17
  */
-@Data
-@EqualsAndHashCode(callSuper = false)
-@Accessors(chain = true)
 public class Sop extends Model<Sop> {
 
     private static final long serialVersionUID=1L;
@@ -125,7 +119,9 @@ obj_tye:build-建筑、floor-楼层、space-空间、system-系统实例、equip
      */
     private String refSopIds;
 
-    private String versionCount;
+    private String version;
+
+    private Integer versionCount;
 
     private String versionExplain;
 
@@ -142,9 +138,239 @@ obj_tye:build-建筑、floor-楼层、space-空间、system-系统实例、equip
     private String updateTime;
 
 
+    public String getSopId() {
+        return sopId;
+    }
+
+    public void setSopId(String sopId) {
+        this.sopId = sopId;
+    }
+
+    public String getProjectId() {
+        return projectId;
+    }
+
+    public void setProjectId(String projectId) {
+        this.projectId = projectId;
+    }
+
+    public String getExtendField() {
+        return extendField;
+    }
+
+    public void setExtendField(String extendField) {
+        this.extendField = extendField;
+    }
+
+    public String getOperator() {
+        return operator;
+    }
+
+    public void setOperator(String operator) {
+        this.operator = operator;
+    }
+
+    public String getSopName() {
+        return sopName;
+    }
+
+    public void setSopName(String sopName) {
+        this.sopName = sopName;
+    }
+
+    public String getSopType() {
+        return sopType;
+    }
+
+    public void setSopType(String sopType) {
+        this.sopType = sopType;
+    }
+
+    public String getNoObj() {
+        return noObj;
+    }
+
+    public void setNoObj(String noObj) {
+        this.noObj = noObj;
+    }
+
+    public String getDomains() {
+        return domains;
+    }
+
+    public void setDomains(String domains) {
+        this.domains = domains;
+    }
+
+    public String getOrderType() {
+        return orderType;
+    }
+
+    public void setOrderType(String orderType) {
+        this.orderType = orderType;
+    }
+
+    public String getTools() {
+        return tools;
+    }
+
+    public void setTools(String tools) {
+        this.tools = tools;
+    }
+
+    public String getFitObjs() {
+        return fitObjs;
+    }
+
+    public void setFitObjs(String fitObjs) {
+        this.fitObjs = fitObjs;
+    }
+
+    public String getEquipModelIds() {
+        return equipModelIds;
+    }
+
+    public void setEquipModelIds(String equipModelIds) {
+        this.equipModelIds = equipModelIds;
+    }
+
+    public String getLabels() {
+        return labels;
+    }
+
+    public void setLabels(String labels) {
+        this.labels = labels;
+    }
+
+    public String getStepsVersion() {
+        return stepsVersion;
+    }
+
+    public void setStepsVersion(String stepsVersion) {
+        this.stepsVersion = stepsVersion;
+    }
+
+    public String getSteps() {
+        return steps;
+    }
+
+    public void setSteps(String steps) {
+        this.steps = steps;
+    }
+
+    public String getRelatedData() {
+        return relatedData;
+    }
+
+    public void setRelatedData(String relatedData) {
+        this.relatedData = relatedData;
+    }
+
+    public String getSopStatus() {
+        return sopStatus;
+    }
+
+    public void setSopStatus(String sopStatus) {
+        this.sopStatus = sopStatus;
+    }
+
+    public String getPublishStatus() {
+        return publishStatus;
+    }
+
+    public void setPublishStatus(String publishStatus) {
+        this.publishStatus = publishStatus;
+    }
+
+    public String getRefSopIds() {
+        return refSopIds;
+    }
+
+    public void setRefSopIds(String refSopIds) {
+        this.refSopIds = refSopIds;
+    }
+
+    public String getVersion() {
+        return version;
+    }
+
+    public void setVersion(String version) {
+        this.version = version;
+    }
+
+    public Integer getVersionCount() {
+        return versionCount;
+    }
+
+    public void setVersionCount(Integer versionCount) {
+        this.versionCount = versionCount;
+    }
+
+    public String getVersionExplain() {
+        return versionExplain;
+    }
+
+    public void setVersionExplain(String versionExplain) {
+        this.versionExplain = versionExplain;
+    }
+
+    public String getVersionExp() {
+        return versionExp;
+    }
+
+    public void setVersionExp(String versionExp) {
+        this.versionExp = versionExp;
+    }
+
+    public Boolean getValid() {
+        return valid;
+    }
+
+    public void setValid(Boolean valid) {
+        this.valid = valid;
+    }
+
+    public String getUpdateTime() {
+        return updateTime;
+    }
+
+    public void setUpdateTime(String updateTime) {
+        this.updateTime = updateTime;
+    }
+
     @Override
     protected Serializable pkVal() {
         return this.sopId;
     }
 
+    @Override
+    public String toString() {
+        return "Sop{" +
+        "sopId=" + sopId +
+        ", projectId=" + projectId +
+        ", extendField=" + extendField +
+        ", operator=" + operator +
+        ", sopName=" + sopName +
+        ", sopType=" + sopType +
+        ", noObj=" + noObj +
+        ", domains=" + domains +
+        ", orderType=" + orderType +
+        ", tools=" + tools +
+        ", fitObjs=" + fitObjs +
+        ", equipModelIds=" + equipModelIds +
+        ", labels=" + labels +
+        ", stepsVersion=" + stepsVersion +
+        ", steps=" + steps +
+        ", relatedData=" + relatedData +
+        ", sopStatus=" + sopStatus +
+        ", publishStatus=" + publishStatus +
+        ", refSopIds=" + refSopIds +
+        ", version=" + version +
+        ", versionCount=" + versionCount +
+        ", versionExplain=" + versionExplain +
+        ", versionExp=" + versionExp +
+        ", valid=" + valid +
+        ", updateTime=" + updateTime +
+        "}";
+    }
 }

+ 373 - 0
fm-sop/src/main/java/com/persagy/fm/sop/model/dto/SopEdit.java

@@ -0,0 +1,373 @@
+package com.persagy.fm.sop.model.dto;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import com.baomidou.mybatisplus.annotation.TableId;
+import java.io.Serializable;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author weijinhao
+ * @since 2021-03-17
+ */
+public class SopEdit extends Model<SopEdit> {
+
+    private static final long serialVersionUID=1L;
+
+    /**
+     * 主键
+     */
+    @TableId(value = "sop_edit_id", type = IdType.ASSIGN_UUID)
+    private String sopEditId;
+
+    private String sopId;
+
+    /**
+     * 通用sop的项目Id默认为"group_sop_id"
+     */
+    private String projectId;
+
+    /**
+     * 项目类型:同一级建筑功能类型 ,字段使用原有的extend_field保存
+     */
+    private String extendField;
+
+    /**
+     * 表示sop的发布者、更新者
+     */
+    private String operator;
+
+    /**
+     * 名称项目下唯一
+     */
+    private String sopName;
+
+    /**
+     * 1-通用,2-项目专用
+     */
+    private String sopType;
+
+    /**
+     * 0-否 1-是
+     */
+    private String noObj;
+
+    /**
+     * 数组[code,code],
+子项:SE-强电,WE-弱电,AC-空调,WS-给排水,FF-消防,SP-安防
+     */
+    private String domains;
+
+    /**
+     * 数组[{"tool":“……”,"from_step":true}]
+     */
+    private String tools;
+
+    /**
+     * 数组[code,code],
+子项:1-保养、2-维修、3-巡检、4-运行、5-安防、
+     */
+    private String orderType;
+
+    /**
+     * [{
+      "obj_id:"***", //对象id
+      "obj_name:"对象名称1", //对象名称
+      "obj_type":"equip",  //对象类型,子项见后边
+}]
+     */
+    private String fitObjs;
+
+    /**
+     * [name,name]
+     */
+    private String equipModelIds;
+
+    /**
+     * 见 sop表
+     */
+    private String labels;
+
+    /**
+     * [{"name":"***',“url”:“***”},{}]
+     */
+    private String steps;
+
+    /**
+     * 0-草稿、1-已发布
+     */
+    private String relatedData;
+
+    /**
+     * 3-修订中
+     */
+    private String sopStatus;
+
+    /**
+     * id的数组[sop_id,sop_id]
+     */
+    private String publishStatus;
+
+    private String refSopIds;
+
+    private String version;
+
+    private Integer versionCount;
+
+    /**
+     * 数组[“描述”,“描述”]
+     */
+    private String versionExplain;
+
+    /**
+     * yyyyMMddhhmmss
+     */
+    private String createTime;
+
+    /**
+     * yyyyMMddhhmmss
+     */
+    private String updateTime;
+
+    private Boolean valid;
+
+
+    public String getSopEditId() {
+        return sopEditId;
+    }
+
+    public void setSopEditId(String sopEditId) {
+        this.sopEditId = sopEditId;
+    }
+
+    public String getSopId() {
+        return sopId;
+    }
+
+    public void setSopId(String sopId) {
+        this.sopId = sopId;
+    }
+
+    public String getProjectId() {
+        return projectId;
+    }
+
+    public void setProjectId(String projectId) {
+        this.projectId = projectId;
+    }
+
+    public String getExtendField() {
+        return extendField;
+    }
+
+    public void setExtendField(String extendField) {
+        this.extendField = extendField;
+    }
+
+    public String getOperator() {
+        return operator;
+    }
+
+    public void setOperator(String operator) {
+        this.operator = operator;
+    }
+
+    public String getSopName() {
+        return sopName;
+    }
+
+    public void setSopName(String sopName) {
+        this.sopName = sopName;
+    }
+
+    public String getSopType() {
+        return sopType;
+    }
+
+    public void setSopType(String sopType) {
+        this.sopType = sopType;
+    }
+
+    public String getNoObj() {
+        return noObj;
+    }
+
+    public void setNoObj(String noObj) {
+        this.noObj = noObj;
+    }
+
+    public String getDomains() {
+        return domains;
+    }
+
+    public void setDomains(String domains) {
+        this.domains = domains;
+    }
+
+    public String getTools() {
+        return tools;
+    }
+
+    public void setTools(String tools) {
+        this.tools = tools;
+    }
+
+    public String getOrderType() {
+        return orderType;
+    }
+
+    public void setOrderType(String orderType) {
+        this.orderType = orderType;
+    }
+
+    public String getFitObjs() {
+        return fitObjs;
+    }
+
+    public void setFitObjs(String fitObjs) {
+        this.fitObjs = fitObjs;
+    }
+
+    public String getEquipModelIds() {
+        return equipModelIds;
+    }
+
+    public void setEquipModelIds(String equipModelIds) {
+        this.equipModelIds = equipModelIds;
+    }
+
+    public String getLabels() {
+        return labels;
+    }
+
+    public void setLabels(String labels) {
+        this.labels = labels;
+    }
+
+    public String getSteps() {
+        return steps;
+    }
+
+    public void setSteps(String steps) {
+        this.steps = steps;
+    }
+
+    public String getRelatedData() {
+        return relatedData;
+    }
+
+    public void setRelatedData(String relatedData) {
+        this.relatedData = relatedData;
+    }
+
+    public String getSopStatus() {
+        return sopStatus;
+    }
+
+    public void setSopStatus(String sopStatus) {
+        this.sopStatus = sopStatus;
+    }
+
+    public String getPublishStatus() {
+        return publishStatus;
+    }
+
+    public void setPublishStatus(String publishStatus) {
+        this.publishStatus = publishStatus;
+    }
+
+    public String getRefSopIds() {
+        return refSopIds;
+    }
+
+    public void setRefSopIds(String refSopIds) {
+        this.refSopIds = refSopIds;
+    }
+
+    public String getVersion() {
+        return version;
+    }
+
+    public void setVersion(String version) {
+        this.version = version;
+    }
+
+    public Integer getVersionCount() {
+        return versionCount;
+    }
+
+    public void setVersionCount(Integer versionCount) {
+        this.versionCount = versionCount;
+    }
+
+    public String getVersionExplain() {
+        return versionExplain;
+    }
+
+    public void setVersionExplain(String versionExplain) {
+        this.versionExplain = versionExplain;
+    }
+
+    public String getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(String createTime) {
+        this.createTime = createTime;
+    }
+
+    public String getUpdateTime() {
+        return updateTime;
+    }
+
+    public void setUpdateTime(String updateTime) {
+        this.updateTime = updateTime;
+    }
+
+    public Boolean getValid() {
+        return valid;
+    }
+
+    public void setValid(Boolean valid) {
+        this.valid = valid;
+    }
+
+    @Override
+    protected Serializable pkVal() {
+        return this.sopEditId;
+    }
+
+    @Override
+    public String toString() {
+        return "SopEdit{" +
+        "sopEditId=" + sopEditId +
+        ", sopId=" + sopId +
+        ", projectId=" + projectId +
+        ", extendField=" + extendField +
+        ", operator=" + operator +
+        ", sopName=" + sopName +
+        ", sopType=" + sopType +
+        ", noObj=" + noObj +
+        ", domains=" + domains +
+        ", tools=" + tools +
+        ", orderType=" + orderType +
+        ", fitObjs=" + fitObjs +
+        ", equipModelIds=" + equipModelIds +
+        ", labels=" + labels +
+        ", steps=" + steps +
+        ", relatedData=" + relatedData +
+        ", sopStatus=" + sopStatus +
+        ", publishStatus=" + publishStatus +
+        ", refSopIds=" + refSopIds +
+        ", version=" + version +
+        ", versionCount=" + versionCount +
+        ", versionExplain=" + versionExplain +
+        ", createTime=" + createTime +
+        ", updateTime=" + updateTime +
+        ", valid=" + valid +
+        "}";
+    }
+}

+ 60 - 7
fm-sop/src/main/java/com/persagy/fm/sop/model/dto/SopEquipModelRel.java

@@ -4,9 +4,6 @@ import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.extension.activerecord.Model;
 import com.baomidou.mybatisplus.annotation.TableId;
 import java.io.Serializable;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-import lombok.experimental.Accessors;
 
 /**
  * <p>
@@ -14,11 +11,8 @@ import lombok.experimental.Accessors;
  * </p>
  *
  * @author weijinhao
- * @since 2021-03-16
+ * @since 2021-03-17
  */
-@Data
-@EqualsAndHashCode(callSuper = false)
-@Accessors(chain = true)
 public class SopEquipModelRel extends Model<SopEquipModelRel> {
 
     private static final long serialVersionUID=1L;
@@ -55,9 +49,68 @@ public class SopEquipModelRel extends Model<SopEquipModelRel> {
     private Boolean valid;
 
 
+    public String getSopEquipModelId() {
+        return sopEquipModelId;
+    }
+
+    public void setSopEquipModelId(String sopEquipModelId) {
+        this.sopEquipModelId = sopEquipModelId;
+    }
+
+    public String getSopId() {
+        return sopId;
+    }
+
+    public void setSopId(String sopId) {
+        this.sopId = sopId;
+    }
+
+    public String getEquipModelId() {
+        return equipModelId;
+    }
+
+    public void setEquipModelId(String equipModelId) {
+        this.equipModelId = equipModelId;
+    }
+
+    public String getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(String createTime) {
+        this.createTime = createTime;
+    }
+
+    public String getUpdateTime() {
+        return updateTime;
+    }
+
+    public void setUpdateTime(String updateTime) {
+        this.updateTime = updateTime;
+    }
+
+    public Boolean getValid() {
+        return valid;
+    }
+
+    public void setValid(Boolean valid) {
+        this.valid = valid;
+    }
+
     @Override
     protected Serializable pkVal() {
         return this.sopEquipModelId;
     }
 
+    @Override
+    public String toString() {
+        return "SopEquipModelRel{" +
+        "sopEquipModelId=" + sopEquipModelId +
+        ", sopId=" + sopId +
+        ", equipModelId=" + equipModelId +
+        ", createTime=" + createTime +
+        ", updateTime=" + updateTime +
+        ", valid=" + valid +
+        "}";
+    }
 }

+ 60 - 7
fm-sop/src/main/java/com/persagy/fm/sop/model/dto/SopLabelRel.java

@@ -4,9 +4,6 @@ import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.extension.activerecord.Model;
 import com.baomidou.mybatisplus.annotation.TableId;
 import java.io.Serializable;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-import lombok.experimental.Accessors;
 
 /**
  * <p>
@@ -14,11 +11,8 @@ import lombok.experimental.Accessors;
  * </p>
  *
  * @author weijinhao
- * @since 2021-03-16
+ * @since 2021-03-17
  */
-@Data
-@EqualsAndHashCode(callSuper = false)
-@Accessors(chain = true)
 public class SopLabelRel extends Model<SopLabelRel> {
 
     private static final long serialVersionUID=1L;
@@ -55,9 +49,68 @@ public class SopLabelRel extends Model<SopLabelRel> {
     private Boolean valid;
 
 
+    public String getSopLabelId() {
+        return sopLabelId;
+    }
+
+    public void setSopLabelId(String sopLabelId) {
+        this.sopLabelId = sopLabelId;
+    }
+
+    public String getSopId() {
+        return sopId;
+    }
+
+    public void setSopId(String sopId) {
+        this.sopId = sopId;
+    }
+
+    public String getLabel() {
+        return label;
+    }
+
+    public void setLabel(String label) {
+        this.label = label;
+    }
+
+    public String getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(String createTime) {
+        this.createTime = createTime;
+    }
+
+    public String getUpdateTime() {
+        return updateTime;
+    }
+
+    public void setUpdateTime(String updateTime) {
+        this.updateTime = updateTime;
+    }
+
+    public Boolean getValid() {
+        return valid;
+    }
+
+    public void setValid(Boolean valid) {
+        this.valid = valid;
+    }
+
     @Override
     protected Serializable pkVal() {
         return this.sopLabelId;
     }
 
+    @Override
+    public String toString() {
+        return "SopLabelRel{" +
+        "sopLabelId=" + sopLabelId +
+        ", sopId=" + sopId +
+        ", label=" + label +
+        ", createTime=" + createTime +
+        ", updateTime=" + updateTime +
+        ", valid=" + valid +
+        "}";
+    }
 }

+ 70 - 11
fm-sop/src/main/java/com/persagy/fm/sop/model/dto/SopObjRel.java

@@ -1,13 +1,8 @@
 package com.persagy.fm.sop.model.dto;
 
 import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.extension.activerecord.Model;
-import lombok.Builder;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-import lombok.experimental.Accessors;
-
+import com.baomidou.mybatisplus.annotation.TableId;
 import java.io.Serializable;
 
 /**
@@ -16,12 +11,8 @@ import java.io.Serializable;
  * </p>
  *
  * @author weijinhao
- * @since 2021-03-16
+ * @since 2021-03-17
  */
-@Data
-@Builder
-@EqualsAndHashCode(callSuper = false)
-@Accessors(chain = true)
 public class SopObjRel extends Model<SopObjRel> {
 
     private static final long serialVersionUID=1L;
@@ -63,9 +54,77 @@ public class SopObjRel extends Model<SopObjRel> {
     private Boolean valid;
 
 
+    public String getSopObjId() {
+        return sopObjId;
+    }
+
+    public void setSopObjId(String sopObjId) {
+        this.sopObjId = sopObjId;
+    }
+
+    public String getSopId() {
+        return sopId;
+    }
+
+    public void setSopId(String sopId) {
+        this.sopId = sopId;
+    }
+
+    public String getObjId() {
+        return objId;
+    }
+
+    public void setObjId(String objId) {
+        this.objId = objId;
+    }
+
+    public String getObjType() {
+        return objType;
+    }
+
+    public void setObjType(String objType) {
+        this.objType = objType;
+    }
+
+    public String getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(String createTime) {
+        this.createTime = createTime;
+    }
+
+    public String getUpdateTime() {
+        return updateTime;
+    }
+
+    public void setUpdateTime(String updateTime) {
+        this.updateTime = updateTime;
+    }
+
+    public Boolean getValid() {
+        return valid;
+    }
+
+    public void setValid(Boolean valid) {
+        this.valid = valid;
+    }
+
     @Override
     protected Serializable pkVal() {
         return this.sopObjId;
     }
 
+    @Override
+    public String toString() {
+        return "SopObjRel{" +
+        "sopObjId=" + sopObjId +
+        ", sopId=" + sopId +
+        ", objId=" + objId +
+        ", objType=" + objType +
+        ", createTime=" + createTime +
+        ", updateTime=" + updateTime +
+        ", valid=" + valid +
+        "}";
+    }
 }

+ 69 - 7
fm-sop/src/main/java/com/persagy/fm/sop/model/dto/SopOrderTypeRel.java

@@ -4,9 +4,6 @@ import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.extension.activerecord.Model;
 import com.baomidou.mybatisplus.annotation.TableId;
 import java.io.Serializable;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-import lombok.experimental.Accessors;
 
 /**
  * <p>
@@ -14,11 +11,8 @@ import lombok.experimental.Accessors;
  * </p>
  *
  * @author weijinhao
- * @since 2021-03-16
+ * @since 2021-03-17
  */
-@Data
-@EqualsAndHashCode(callSuper = false)
-@Accessors(chain = true)
 public class SopOrderTypeRel extends Model<SopOrderTypeRel> {
 
     private static final long serialVersionUID=1L;
@@ -57,9 +51,77 @@ public class SopOrderTypeRel extends Model<SopOrderTypeRel> {
     private Boolean valid;
 
 
+    public String getSopOrderTypeId() {
+        return sopOrderTypeId;
+    }
+
+    public void setSopOrderTypeId(String sopOrderTypeId) {
+        this.sopOrderTypeId = sopOrderTypeId;
+    }
+
+    public String getSopId() {
+        return sopId;
+    }
+
+    public void setSopId(String sopId) {
+        this.sopId = sopId;
+    }
+
+    public String getProjectId() {
+        return projectId;
+    }
+
+    public void setProjectId(String projectId) {
+        this.projectId = projectId;
+    }
+
+    public String getOrderType() {
+        return orderType;
+    }
+
+    public void setOrderType(String orderType) {
+        this.orderType = orderType;
+    }
+
+    public String getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(String createTime) {
+        this.createTime = createTime;
+    }
+
+    public String getUpdateTime() {
+        return updateTime;
+    }
+
+    public void setUpdateTime(String updateTime) {
+        this.updateTime = updateTime;
+    }
+
+    public Boolean getValid() {
+        return valid;
+    }
+
+    public void setValid(Boolean valid) {
+        this.valid = valid;
+    }
+
     @Override
     protected Serializable pkVal() {
         return this.sopOrderTypeId;
     }
 
+    @Override
+    public String toString() {
+        return "SopOrderTypeRel{" +
+        "sopOrderTypeId=" + sopOrderTypeId +
+        ", sopId=" + sopId +
+        ", projectId=" + projectId +
+        ", orderType=" + orderType +
+        ", createTime=" + createTime +
+        ", updateTime=" + updateTime +
+        ", valid=" + valid +
+        "}";
+    }
 }

+ 69 - 7
fm-sop/src/main/java/com/persagy/fm/sop/model/dto/SopSopRel.java

@@ -4,9 +4,6 @@ import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.extension.activerecord.Model;
 import com.baomidou.mybatisplus.annotation.TableId;
 import java.io.Serializable;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-import lombok.experimental.Accessors;
 
 /**
  * <p>
@@ -14,11 +11,8 @@ import lombok.experimental.Accessors;
  * </p>
  *
  * @author weijinhao
- * @since 2021-03-16
+ * @since 2021-03-17
  */
-@Data
-@EqualsAndHashCode(callSuper = false)
-@Accessors(chain = true)
 public class SopSopRel extends Model<SopSopRel> {
 
     private static final long serialVersionUID=1L;
@@ -60,9 +54,77 @@ public class SopSopRel extends Model<SopSopRel> {
     private Boolean valid;
 
 
+    public String getSopSopId() {
+        return sopSopId;
+    }
+
+    public void setSopSopId(String sopSopId) {
+        this.sopSopId = sopSopId;
+    }
+
+    public String getProjectId() {
+        return projectId;
+    }
+
+    public void setProjectId(String projectId) {
+        this.projectId = projectId;
+    }
+
+    public String getSopId() {
+        return sopId;
+    }
+
+    public void setSopId(String sopId) {
+        this.sopId = sopId;
+    }
+
+    public String getRelSopId() {
+        return relSopId;
+    }
+
+    public void setRelSopId(String relSopId) {
+        this.relSopId = relSopId;
+    }
+
+    public String getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(String createTime) {
+        this.createTime = createTime;
+    }
+
+    public String getUpdateTime() {
+        return updateTime;
+    }
+
+    public void setUpdateTime(String updateTime) {
+        this.updateTime = updateTime;
+    }
+
+    public Boolean getValid() {
+        return valid;
+    }
+
+    public void setValid(Boolean valid) {
+        this.valid = valid;
+    }
+
     @Override
     protected Serializable pkVal() {
         return this.sopSopId;
     }
 
+    @Override
+    public String toString() {
+        return "SopSopRel{" +
+        "sopSopId=" + sopSopId +
+        ", projectId=" + projectId +
+        ", sopId=" + sopId +
+        ", relSopId=" + relSopId +
+        ", createTime=" + createTime +
+        ", updateTime=" + updateTime +
+        ", valid=" + valid +
+        "}";
+    }
 }

Dosya farkı çok büyük olduğundan ihmal edildi
+ 794 - 0
fm-sop/src/main/java/com/persagy/fm/sop/model/dto/SopStepsBean.java


+ 45 - 0
fm-sop/src/main/java/com/persagy/fm/sop/model/vo/QuerySopReferenceVo.java

@@ -0,0 +1,45 @@
+package com.persagy.fm.sop.model.vo;
+
+import javax.validation.constraints.NotEmpty;
+import javax.validation.constraints.NotNull;
+
+public class QuerySopReferenceVo {
+    /**
+     * user_id : ****
+     * sop_id : ***
+     * version : V0.3
+     */
+    @NotNull
+    @NotEmpty
+    private String user_id;
+    @NotNull
+    @NotEmpty
+    private String sop_id;
+    @NotNull
+    @NotEmpty
+    private String version;
+
+    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 getVersion() {
+        return version;
+    }
+
+    public void setVersion(String version) {
+        this.version = version;
+    }
+}

+ 18 - 0
fm-sop/src/main/java/com/persagy/fm/sop/model/vo/SaveSopEditVo.java

@@ -0,0 +1,18 @@
+package com.persagy.fm.sop.model.vo;
+
+/**
+ * sop edit表 落库协议
+ * v1.0
+ */
+public class SaveSopEditVo extends SaveSopVo {
+
+    private String sop_edit_id;
+
+    public String getSop_edit_id() {
+        return sop_edit_id;
+    }
+
+    public void setSop_edit_id(String sop_edit_id) {
+        this.sop_edit_id = sop_edit_id;
+    }
+}

Dosya farkı çok büyük olduğundan ihmal edildi
+ 7 - 786
fm-sop/src/main/java/com/persagy/fm/sop/model/vo/SaveSopVo.java


+ 45 - 0
fm-sop/src/main/java/com/persagy/fm/sop/model/vo/VerifySopNameVo.java

@@ -0,0 +1,45 @@
+package com.persagy.fm.sop.model.vo;
+
+import javax.validation.constraints.NotEmpty;
+import javax.validation.constraints.NotNull;
+
+public class VerifySopNameVo {
+
+    /**
+     * user_id : ***
+     * sop_id : ***
+     * sop_name : ***
+     */
+    @NotNull
+    @NotEmpty
+    private String user_id;
+    @NotNull
+    private String sop_id;
+    @NotNull
+    @NotEmpty
+    private String sop_name;
+
+    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;
+    }
+}

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

@@ -0,0 +1,48 @@
+package com.persagy.fm.sop.service;
+
+import com.persagy.fm.sop.model.dto.RefSopInfo;
+import com.persagy.fm.sop.model.vo.QuerySopReferenceVo;
+import com.persagy.fm.sop.model.vo.SaveSopEditVo;
+import com.persagy.fm.sop.model.vo.SaveSopVo;
+import com.persagy.fm.sop.model.vo.VerifySopNameVo;
+
+import java.util.List;
+import java.util.Set;
+
+public interface GroupSopService {
+    /**
+     * 集团sop-新增页-添加发布状态sop
+     * @param saveSopVo
+     * @return
+     * @throws Exception
+     */
+    boolean addPublishedSop(SaveSopVo saveSopVo) throws Exception;
+
+    /**
+     * 在发布前验证sop
+     * @param saveSopVo
+     * @return
+     * @throws Exception
+     */
+    boolean verifySopForPublish(SaveSopVo saveSopVo) throws Exception;
+
+    Set<String> getSopRefSops(SaveSopVo sop);
+
+    String addDraftSop(SaveSopEditVo saveSopEditVo) throws Exception ;
+
+    /**
+     * 集团sop-新增页-验证sop
+     * @param jsonStr
+     * @return
+     * @throws Exception
+     */
+    public boolean verifySopBeforePublish(VerifySopNameVo jsonStr) throws Exception;
+
+    /**
+     * 详细页-查询当前sop被引用的sop列表
+     * @param querySopReferenceVo
+     * @return
+     * @throws Exception
+     */
+    List<RefSopInfo> queryReferencedSopListById(QuerySopReferenceVo querySopReferenceVo)throws Exception;
+}

+ 16 - 0
fm-sop/src/main/java/com/persagy/fm/sop/service/SopEditService.java

@@ -0,0 +1,16 @@
+package com.persagy.fm.sop.service;
+
+import com.persagy.fm.sop.model.dto.SopEdit;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author weijinhao
+ * @since 2021-03-17
+ */
+public interface SopEditService extends IService<SopEdit> {
+
+}

+ 1 - 1
fm-sop/src/main/java/com/persagy/fm/sop/service/SopEquipModelRelService.java

@@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
  * </p>
  *
  * @author weijinhao
- * @since 2021-03-16
+ * @since 2021-03-17
  */
 public interface SopEquipModelRelService extends IService<SopEquipModelRel> {
 

+ 1 - 1
fm-sop/src/main/java/com/persagy/fm/sop/service/SopLabelRelService.java

@@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
  * </p>
  *
  * @author weijinhao
- * @since 2021-03-16
+ * @since 2021-03-17
  */
 public interface SopLabelRelService extends IService<SopLabelRel> {
 

+ 1 - 1
fm-sop/src/main/java/com/persagy/fm/sop/service/SopObjRelService.java

@@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
  * </p>
  *
  * @author weijinhao
- * @since 2021-03-16
+ * @since 2021-03-17
  */
 public interface SopObjRelService extends IService<SopObjRel> {
 

+ 1 - 1
fm-sop/src/main/java/com/persagy/fm/sop/service/SopOrderTypeRelService.java

@@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
  * </p>
  *
  * @author weijinhao
- * @since 2021-03-16
+ * @since 2021-03-17
  */
 public interface SopOrderTypeRelService extends IService<SopOrderTypeRel> {
 

+ 1 - 1
fm-sop/src/main/java/com/persagy/fm/sop/service/SopService.java

@@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
  * </p>
  *
  * @author weijinhao
- * @since 2021-03-16
+ * @since 2021-03-17
  */
 public interface SopService extends IService<Sop> {
 

+ 1 - 1
fm-sop/src/main/java/com/persagy/fm/sop/service/SopSopRelService.java

@@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
  * </p>
  *
  * @author weijinhao
- * @since 2021-03-16
+ * @since 2021-03-17
  */
 public interface SopSopRelService extends IService<SopSopRel> {
 

+ 440 - 0
fm-sop/src/main/java/com/persagy/fm/sop/service/impl/GroupSopServiceImpl.java

@@ -0,0 +1,440 @@
+package com.persagy.fm.sop.service.impl;
+
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.persagy.fm.common.exception.BusinessValidatorException;
+import com.persagy.fm.sop.model.dto.*;
+import com.persagy.fm.sop.model.vo.QuerySopReferenceVo;
+import com.persagy.fm.sop.model.vo.SaveSopEditVo;
+import com.persagy.fm.sop.model.vo.SaveSopVo;
+import com.persagy.fm.sop.model.vo.VerifySopNameVo;
+import com.persagy.fm.sop.service.GroupSopService;
+import com.persagy.fm.sop.service.SopEditService;
+import com.persagy.fm.sop.service.SopService;
+import com.persagy.fm.sop.service.SopSopRelService;
+import com.persagy.old.common.*;
+import com.persagy.old.dao.DBConst;
+import com.persagy.old.dao.DBConst.Result;
+import com.persagy.old.service.ObjectServiceI;
+import org.apache.commons.beanutils.BeanUtils;
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.lang.BooleanUtils;
+import org.apache.commons.lang.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.*;
+
+@Service
+public class GroupSopServiceImpl implements GroupSopService {
+    //@Autowired
+    public ObjectServiceI objectService;
+
+    @Autowired
+    private SopService sopService;
+
+    @Autowired
+    private SopEditService sopEditService;
+
+    @Autowired
+    private SopSopRelService sopSopRelService;
+
+
+
+    @Override
+    @Transactional
+    public boolean addPublishedSop(SaveSopVo saveSopVo) throws Exception {
+
+        saveSopVo.setSop_id(ToolsUtil.getRecordId(DBConst.TABLE_SOP_ID_TAG));
+        //找到sop 与与对象、设备型号、工单类型、自定义标签、sop关系 并插入数据库中
+        addSopRelation(saveSopVo);
+        //落库本条sop*/
+        //填充必要字段
+        Sop sop = new Sop();
+        //将 请求体中的参数拷贝到我们里面
+        //BeanUtils.copyProperties(sop,saveSopVo);
+        String s = JSONObject.toJSONString(saveSopVo);
+        JSONObject jsonObject = JSONObject.parseObject(s);
+        jsonObject = JSONUtil.prossesParamToJsonString(jsonObject, CommonMessage.tranfer_json_string_sop);
+        Sop sop1 = JSONObject.parseObject(jsonObject.toJSONString(), Sop.class);
+        BeanUtils.copyProperties(sop,sop1);
+
+        sop.setSopStatus(SopConst.SOP_STATUS_PUBLISH);
+        sop.setPublishStatus(SopConst.PUBLISH_STATUS_NORMAL);
+        sop.setVersionCount(1);
+        sop.setVersion("V0.1");
+        sop.setVersionExplain("[\""+ CommonConst.version_explain_create+"\"]");
+
+        //将参数转化为指定的字段后进行存储
+        sop.insert();
+        return true;
+    }
+
+    @Override
+    public boolean verifySopForPublish(SaveSopVo saveSopVo) throws Exception {
+        String projectId = saveSopVo.getProject_id();
+        List<String> objTypes = Arrays.asList("build","floor","space","system","shaft","equip");
+
+        //验证对象内容是否有效
+        //获取所有引用的对象
+        List<String> objects = new ArrayList<>();
+        List<SaveSopVo.FitObjsBean> fit_objs = saveSopVo.getFit_objs();
+        if(CollectionUtils.isNotEmpty(fit_objs)) {
+            for (SaveSopVo.FitObjsBean fit_obj : fit_objs) {
+                if(objTypes.contains(fit_obj.getObj_type())) {
+                    objects.add(fit_obj.getObj_id());
+                }
+            }
+        }
+        List<SopStepsBean> steps = saveSopVo.getSteps();
+        if(CollectionUtils.isNotEmpty(steps)) {
+            for (SopStepsBean step : steps) {
+                List<SopStepsBean.StepContentBean> step_content = step.getStep_content();
+
+                if(CollectionUtils.isNotEmpty(step_content)) {
+                    for (SopStepsBean.StepContentBean stepContentBean : step_content) {
+                        //content_objs
+                        List<SopStepsBean.StepContentBean.ContentObjsBean> content_objs = stepContentBean.getContent_objs();
+                        if(CollectionUtils.isNotEmpty(content_objs)) {
+                            for (SopStepsBean.StepContentBean.ContentObjsBean content_obj : content_objs) {
+                                if(objTypes.contains(content_obj.getObj_type())) {
+                                    objects.add(content_obj.getObj_id());
+                                }
+                            }
+                        }
+                        //confirm_result
+                        List<SopStepsBean.StepContentBean.ConfirmResultBean> confirm_result = stepContentBean.getConfirm_result();
+                        if(CollectionUtils.isNotEmpty(confirm_result)) {
+                            for (SopStepsBean.StepContentBean.ConfirmResultBean confirmResultBean : confirm_result) {
+                                if(objTypes.contains(confirmResultBean.getObj_type())) {
+                                    objects.add(confirmResultBean.getObj_id());
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+        }
+        if(CollectionUtils.isNotEmpty(objects)) {
+            String objectStr = objectService.queryBatchObj(JSONObject.toJSONString(objects), projectId, false);
+            JSONObject objectJson = JSONObject.parseObject(objectStr);
+            if(DBConst.Result.FAILURE.equals(objectJson.getString(Result.RESULT))){
+                throw new Exception(objectStr);
+            }
+            Map<String, String> objectIdName = objectService.getObjectIdNameMap(objectStr);
+            if(!objectIdName.isEmpty()) {
+                Map<Object, Object> valiadtorData = new HashMap<>();
+                for (String id : objectIdName.keySet()) {
+                    valiadtorData.put(objectIdName.get(id),"添加的对象已作废,请前往编辑!");
+                }
+                throw new BusinessValidatorException(valiadtorData);
+            }
+        }
+        //验证引用sop是否有效
+
+        Set<String> sopRefSops = this.getSopRefSops(saveSopVo);
+        if(CollectionUtils.isNotEmpty(sopRefSops)) {
+
+            QueryWrapper<Sop> queryWrapper = new QueryWrapper<>();
+            queryWrapper.in("sop_id",sopRefSops).eq("valid",false);
+            //查询他所引用的sop 是否有无效的
+            List<Sop> sops = sopService.list(queryWrapper);
+            if(CollectionUtils.isNotEmpty(sops)) {
+
+                Map<Object, Object> valiadtorData = new HashMap<>();
+                for (Sop sop : sops) {
+                    valiadtorData.put(sop.getSopName(),"引用的标准操作流程已被作废,请前往编辑!");
+                }
+                throw new BusinessValidatorException(valiadtorData);
+            }
+        }
+        return true;
+    }
+
+
+    private boolean addSopRelation(SaveSopVo saveSopVo) throws Exception{
+
+        //添加sop与对象关系-sop_obj_rel
+        List<SaveSopVo.FitObjsBean> sopRelObjs = getSopRelObjs(saveSopVo);
+        if(CollectionUtils.isNotEmpty(sopRelObjs)) {
+            for (SaveSopVo.FitObjsBean sopRelObj : sopRelObjs) {
+
+                SopObjRel sopObjRel = new SopObjRel();
+                sopObjRel.setSopId(saveSopVo.getSop_id());
+                sopObjRel.setObjId(sopRelObj.getObj_id());
+                sopObjRel.setObjType(sopRelObj.getObj_type());
+                sopObjRel.setValid(true);
+                sopObjRel.insert();
+            }
+        }
+
+        //添加sop与设备型号关系-sop_equip_model_rel
+        List<String> equip_model_ids = saveSopVo.getEquip_model_ids();
+        distinctCollection(equip_model_ids);
+        if(CollectionUtils.isNotEmpty(equip_model_ids)) {
+            for (String equip_model_id : equip_model_ids) {
+                SopEquipModelRel sopEquipModelRel = new SopEquipModelRel();
+                sopEquipModelRel.setEquipModelId(equip_model_id);
+                sopEquipModelRel.setSopId(saveSopVo.getSop_id());
+                sopEquipModelRel.setValid(true);
+                sopEquipModelRel.insert();
+            }
+        }
+
+        //添加sop与工单类型关系-sop_order_type_rel
+        List<String> order_types = saveSopVo.getOrder_type();
+        distinctCollection(order_types);
+        if(CollectionUtils.isNotEmpty(order_types)) {
+            for (String order_type : order_types) {
+                SopOrderTypeRel sopOrderTypeRel = new SopOrderTypeRel();
+                sopOrderTypeRel.setOrderType(order_type);
+                sopOrderTypeRel.setProjectId(saveSopVo.getProject_id());
+                sopOrderTypeRel.setValid(true);
+                sopOrderTypeRel.setSopId(saveSopVo.getSop_id());
+                sopOrderTypeRel.insert();
+            }
+        }
+        //添加sop与自定义标签关系-sop_label_rel
+        List<String> labels = saveSopVo.getLabels();
+        distinctCollection(labels);
+        if(CollectionUtils.isNotEmpty(labels)) {
+            for (String label : labels) {
+                SopLabelRel sopLabelRel = new SopLabelRel();
+                sopLabelRel.setLabel(label);
+                sopLabelRel.setSopId(saveSopVo.getSop_id());
+                sopLabelRel.setValid(true);
+                sopLabelRel.insert();
+            }
+        }
+        //添加sop与sop关系-sop_sop_rel
+        Set<String> sopRefSops = getSopRefSops(saveSopVo);
+        if(CollectionUtils.isNotEmpty(sopRefSops)) {
+            for (String sopRefSop : sopRefSops) {
+                SopSopRel sopSopRel = new SopSopRel();
+                sopSopRel.setProjectId(saveSopVo.getProject_id());
+                sopSopRel.setRelSopId(sopRefSop);
+                sopSopRel.setSopId(saveSopVo.getSop_id());
+                sopSopRel.setValid(true);
+            }
+        }
+
+        return true;
+
+    }
+
+    private void distinctCollection(List<String> list) {
+        HashSet set = new HashSet(list);
+        list.clear();
+        list.addAll(set);
+    }
+
+    private  List<SaveSopVo.FitObjsBean> getSopRelObjs(SaveSopVo sop) throws InvocationTargetException, IllegalAccessException {
+        List<SaveSopVo.FitObjsBean> sopRelObjs = new ArrayList<>();
+        Map<String,SaveSopVo.FitObjsBean> objectId_Object = new HashMap<>();
+
+        if(sop != null) {
+            //查询适用的对象
+            List<SaveSopVo.FitObjsBean> fit_objs = sop.getFit_objs();
+            if(CollectionUtils.isNotEmpty(fit_objs)) {
+                for (SaveSopVo.FitObjsBean fit_obj : fit_objs) {
+                    objectId_Object.put(fit_obj.getObj_id(),fit_obj);
+                }
+            }
+            List<SopStepsBean> steps = sop.getSteps();
+            if(CollectionUtils.isNotEmpty(steps)) {
+                for (SopStepsBean step : steps) {
+                    //如果不是来自引用的对象
+                    if(BooleanUtils.isFalse(step.isFrom_sop())) {
+                        List<SopStepsBean.StepContentBean> step_content = step.getStep_content();
+                        if(CollectionUtils.isNotEmpty(step_content)) {
+                            for (SopStepsBean.StepContentBean stepContentBean : step_content) {
+                                List<SopStepsBean.StepContentBean.ContentObjsBean> content_objs = stepContentBean.getContent_objs();
+                                if(CollectionUtils.isNotEmpty(content_objs)) {
+                                    for (SopStepsBean.StepContentBean.ContentObjsBean content_obj : content_objs) {
+                                        //进行数值拷贝到一个对象中去
+                                        SaveSopVo.FitObjsBean fitObjsBean = new SaveSopVo.FitObjsBean();
+                                        BeanUtils.copyProperties(fitObjsBean,content_obj);
+                                        objectId_Object.put(content_obj.getObj_id(),fitObjsBean);
+                                    }
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+        }
+
+        //sop中 适用对象和步骤中的对象
+        for (SaveSopVo.FitObjsBean value : objectId_Object.values()) {
+            sopRelObjs.add(value);
+        }
+        return sopRelObjs;
+    }
+
+    public Set<String> getSopRefSops(SaveSopVo sop){
+        LinkedHashSet<String> sopIds = new LinkedHashSet<>();
+        if(sop != null) {
+
+            List<SopStepsBean> steps = sop.getSteps();
+            if(CollectionUtils.isNotEmpty(steps)) {
+                for (SopStepsBean step : steps) {
+                    if (BooleanUtils.isTrue(step.isFrom_sop())) {
+                        sopIds.add(step.getSop_id());
+                    } else {
+                        List<SopStepsBean.StepContentBean> step_content = step.getStep_content();
+                        if(CollectionUtils.isNotEmpty(step_content)) {
+                            for (SopStepsBean.StepContentBean stepContentBean : step_content) {
+                                if (BooleanUtils.isTrue(stepContentBean.isFrom_sop())) {
+                                    sopIds.add(stepContentBean.getSop_id());
+                                }
+
+                            }
+                        }
+                    }
+                }
+            }
+        }
+        return sopIds;
+    }
+
+    @Override
+    public String addDraftSop(SaveSopEditVo saveSopEditVo) throws Exception {
+
+        saveSopEditVo.setProject_id(CommonConst.group_sop_id);
+        Set<String> sopRefSops = this.getSopRefSops(saveSopEditVo);
+        saveSopEditVo.setSop_id(UUID.randomUUID().toString().replaceAll("-",""));
+
+        SopEdit sopEdit = new SopEdit();
+        //sop类型 1 通用    2 项目专用
+        sopEdit.setSopType("1");
+        //sop状态 0 草稿  1 已发布   2 已作废
+        sopEdit.setSopStatus("0");
+
+        String s = JSONObject.toJSONString(saveSopEditVo);
+        JSONObject jsonObject = JSONObject.parseObject(s);
+        jsonObject = JSONUtil.prossesParamToJsonString(jsonObject, CommonMessage.tranfer_json_string_sop);
+        SopEdit sopEditTmp = JSONObject.parseObject(jsonObject.toJSONString(), SopEdit.class);
+
+        BeanUtils.copyProperties(sopEdit,sopEditTmp);
+
+        sopEdit.insert();
+        return sopEdit.getSopId();
+    }
+
+    @Override
+    public boolean verifySopBeforePublish(VerifySopNameVo verifySopNameVo) throws Exception {
+        //查询sop 表中是否存在CommonConst.group_sop_id  sop_name  sopId 的数据
+        QueryWrapper<Sop> sopQueryWrapper = new QueryWrapper<>();
+        sopQueryWrapper.eq("project_id",CommonConst.group_sop_id).eq("sop_name",verifySopNameVo.getSop_name()).ne("sop_id",verifySopNameVo.getSop_id());
+        List<Sop> hashSop = sopService.list(sopQueryWrapper);
+        //存在名称
+        if(CollectionUtils.isNotEmpty(hashSop)) {
+            return false;
+        }
+        QueryWrapper<SopEdit> sopEditQueryWrapper = new QueryWrapper<>();
+        sopEditQueryWrapper.eq("project_id",CommonConst.group_sop_id).eq("sop_name",verifySopNameVo.getSop_name()).ne("sop_id",verifySopNameVo.getSop_id());
+        List<SopEdit> hasSopEdit = sopEditService.list(sopEditQueryWrapper);
+        //存在名称
+        if(CollectionUtils.isNotEmpty(hasSopEdit)) {
+            return false;
+        }
+        return true;
+    }
+
+
+
+    @Override
+    public List<RefSopInfo> queryReferencedSopListById(QuerySopReferenceVo querySopReferenceVo) throws Exception {
+        //根据id  和版本进行数据的查询
+        QueryWrapper<Sop> sopQueryWrapper = new QueryWrapper<>();
+        sopQueryWrapper.eq("sop_id",querySopReferenceVo.getSop_id()).eq("version",querySopReferenceVo.getVersion());
+        Sop one = sopService.getOne(sopQueryWrapper);
+        // 1通过sop_sop_rel关系表查询到所有引用当前sop的sopID
+
+        QueryWrapper<SopSopRel> sopSopRelQueryWrapper = new QueryWrapper<>();
+        sopSopRelQueryWrapper.in("rel_sop_id",one.getSopId()).eq("valid",true);
+        List<SopSopRel> sopSopRels = sopSopRelService.list(sopSopRelQueryWrapper);
+        Set<String> ids = new HashSet<>();
+        for (SopSopRel sopSopRel : sopSopRels) {
+            ids.add(sopSopRel.getRelSopId());
+        }
+        // 2根据sopID 和有效状态 批量查询sop:name、status、update_time、version、stauts_explain
+
+        QueryWrapper<Sop> sopQueryWrapper2 = new QueryWrapper<>();
+        sopQueryWrapper2.in("sop_id",ids).eq("valid",true);
+        List<Sop> list = sopService.list(sopQueryWrapper2);
+
+        List<RefSopInfo> refSopInfos = new ArrayList<>();
+        if(CollectionUtils.isNotEmpty(list)) {
+            for (Sop sop : list) {
+                RefSopInfo refSopInfo = new RefSopInfo();
+                refSopInfo.setRef_sop_id(sop.getSopId());
+                refSopInfo.setRef_sop_name(sop.getSopName());
+                refSopInfo.setVersion(sop.getVersion());
+                refSopInfo.setSop_type(sop.getSopType());
+                refSopInfo.setStauts_explain(getSopStatus(sop));
+                /*
+                 ********************************
+                 * ********************************
+                 * ********************************
+                 * ********************************
+                 * ********************************
+                 * ********************************
+                 * if (!CommonConst.group_sop_id.equals(sopItem.getString("project_id"))) {
+                        	sop.put("project_id", sopItem.getString("project_id"));
+                        	sop.put("project_name", projectCache.getProjectNameById(sopItem.getString("project_id")));
+						}
+                 */
+
+                if(StringUtils.isNotBlank(sop.getOperator())) {
+                    refSopInfo.setOperator(sop.getOperator());
+                }
+                refSopInfo.setUpdate_time(DateUtil.transferDateFormat(sop.getUpdateTime(), CommonConst.date_format_save, CommonConst.date_format_show));
+                refSopInfos.add(refSopInfo);
+            }
+        }
+
+        //sop 为历史版本的sop
+        /*
+        ****************************************************************
+        * ********************************
+        * ********************************
+        * ********************************
+        * ********************************
+        * ****************************************************************
+        * ********************************
+        * ********************************
+        * ********************************
+        * ********************************
+        *
+        *
+        *
+         */
+
+        return refSopInfos;
+    }
+
+
+    /**
+     * 转换sop状态为汉字
+     * @param sop
+     * @return
+     */
+    public String getSopStatus(Sop sop){
+        String status = sop.getSopStatus();
+        if(SopConst.SOP_STATUS_PUBLISH.equals(status)){
+            String publishStatus = sop.getPublishStatus();
+            status = "已发布";
+            if(SopConst.PUBLISH_STATUS_REVISE.equals(publishStatus)){
+                status = "已发布、待修订";
+            }else if(SopConst.PUBLISH_STATUS_REVISEING.equals(publishStatus)){
+                status = "已发布、编辑中";
+            }
+        }else{
+            status = "已作废";
+        }
+        return status;
+    }
+}

+ 20 - 0
fm-sop/src/main/java/com/persagy/fm/sop/service/impl/SopEditServiceImpl.java

@@ -0,0 +1,20 @@
+package com.persagy.fm.sop.service.impl;
+
+import com.persagy.fm.sop.model.dto.SopEdit;
+import com.persagy.fm.sop.dao.SopEditMapper;
+import com.persagy.fm.sop.service.SopEditService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author weijinhao
+ * @since 2021-03-17
+ */
+@Service
+public class SopEditServiceImpl extends ServiceImpl<SopEditMapper, SopEdit> implements SopEditService {
+
+}

+ 1 - 1
fm-sop/src/main/java/com/persagy/fm/sop/service/impl/SopEquipModelRelServiceImpl.java

@@ -12,7 +12,7 @@ import org.springframework.stereotype.Service;
  * </p>
  *
  * @author weijinhao
- * @since 2021-03-16
+ * @since 2021-03-17
  */
 @Service
 public class SopEquipModelRelServiceImpl extends ServiceImpl<SopEquipModelRelMapper, SopEquipModelRel> implements SopEquipModelRelService {

+ 1 - 1
fm-sop/src/main/java/com/persagy/fm/sop/service/impl/SopLabelRelServiceImpl.java

@@ -12,7 +12,7 @@ import org.springframework.stereotype.Service;
  * </p>
  *
  * @author weijinhao
- * @since 2021-03-16
+ * @since 2021-03-17
  */
 @Service
 public class SopLabelRelServiceImpl extends ServiceImpl<SopLabelRelMapper, SopLabelRel> implements SopLabelRelService {

+ 1 - 1
fm-sop/src/main/java/com/persagy/fm/sop/service/impl/SopObjRelServiceImpl.java

@@ -12,7 +12,7 @@ import org.springframework.stereotype.Service;
  * </p>
  *
  * @author weijinhao
- * @since 2021-03-16
+ * @since 2021-03-17
  */
 @Service
 public class SopObjRelServiceImpl extends ServiceImpl<SopObjRelMapper, SopObjRel> implements SopObjRelService {

+ 1 - 1
fm-sop/src/main/java/com/persagy/fm/sop/service/impl/SopOrderTypeRelServiceImpl.java

@@ -12,7 +12,7 @@ import org.springframework.stereotype.Service;
  * </p>
  *
  * @author weijinhao
- * @since 2021-03-16
+ * @since 2021-03-17
  */
 @Service
 public class SopOrderTypeRelServiceImpl extends ServiceImpl<SopOrderTypeRelMapper, SopOrderTypeRel> implements SopOrderTypeRelService {

+ 1 - 1
fm-sop/src/main/java/com/persagy/fm/sop/service/impl/SopServiceImpl.java

@@ -12,7 +12,7 @@ import org.springframework.stereotype.Service;
  * </p>
  *
  * @author weijinhao
- * @since 2021-03-16
+ * @since 2021-03-17
  */
 @Service
 public class SopServiceImpl extends ServiceImpl<SopMapper, Sop> implements SopService {

+ 1 - 1
fm-sop/src/main/java/com/persagy/fm/sop/service/impl/SopSopRelServiceImpl.java

@@ -12,7 +12,7 @@ import org.springframework.stereotype.Service;
  * </p>
  *
  * @author weijinhao
- * @since 2021-03-16
+ * @since 2021-03-17
  */
 @Service
 public class SopSopRelServiceImpl extends ServiceImpl<SopSopRelMapper, SopSopRel> implements SopSopRelService {

+ 0 - 4
fm-sop/src/main/java/com/persagy/fm/sop/utils/TimeUtils.java

@@ -1,4 +0,0 @@
-package com.persagy.fm.sop.utils;
-
-public class TimeUtils {
-}

+ 0 - 43
fm-sop/src/main/java/com/persagy/fm/sop/utils/ToolsUtil.java

@@ -1,43 +0,0 @@
-/**
- * @包名称 com.sagacloud.common
- * @文件名 ToolsUtil.java
- * @创建者 wanghailong
- * @邮箱 wanghailong@persagy.com  
- * @修改描述 
- */
-
-package com.persagy.fm.sop.utils;
-
-import org.apache.commons.lang.StringUtils;
-
-import java.util.UUID;
-
-
-/** 
- * 功能描述: 常用工具方法
- * @类型名称 ToolsUtil
- * @创建者 wanghailong
- * @邮箱 wanghailong@persagy.com  
- * @修改描述 
- */
-public class ToolsUtil {
-
-    public static String getUuid() {
-    	String uuid = UUID.randomUUID().toString().replace("-","");
-    	return uuid;
-    }
-
-    /**
-     * 生成前缀+uuid的字符串
-     * @param prefix  --前缀字符串
-     * @return recordId --prefix+uuid(去除-)
-     */
-	public static String getRecordId(String prefix) {
-		String recordId = "";
-		if (!StringUtils.isNotBlank(prefix)) {
-			recordId = prefix;
-		}
-		recordId = recordId + UUID.randomUUID().toString().replace("-", "");
-		return recordId;
-	}
- }

+ 56 - 0
fm-sop/src/main/java/com/persagy/old/cache/ComponentRelationCache.java

@@ -0,0 +1,56 @@
+package com.persagy.old.cache;
+
+import com.alibaba.fastjson.JSONObject;
+import com.persagy.old.common.RedisConstant;
+import com.persagy.old.common.StringUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.data.redis.core.RedisTemplate;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.Resource;
+
+@Component
+public class ComponentRelationCache {
+
+    private static final Logger log = LoggerFactory.getLogger(ComponentRelationCache.class);
+    @Resource(name="saasRedisTemplate")
+    private RedisTemplate<String, Object> saasRedisTemplate;
+
+    /**
+     * @desc 根据  原始组件编码    查询单个对应关系记录
+     * @param baseCmptCode
+     * @return
+     */
+    public JSONObject getComponentRelationByBaseCmptCode(String baseCmptCode) {
+
+        String jsonStr = (String) saasRedisTemplate.opsForHash().get(RedisConstant.ALL_COMPONENT_RELATION_KEY, baseCmptCode);
+        if (StringUtil.isNotNull(jsonStr)) {
+            return JSONObject.parseObject(jsonStr);
+        }
+        log.error("ComponentRelationCache:未获得缓存:"+baseCmptCode);
+        return new JSONObject();
+    }
+
+    /**
+     * 根据原始组件编码判断是否有app对应显示组件
+     * @param baseCmptCode	原始组件
+     * @return
+     */
+    public boolean hasAppCmpt(String baseCmptCode){
+        String app_cmpt_code = getAppComponentCodeByBaseCmptCode(baseCmptCode);
+        return StringUtil.isNotNull(app_cmpt_code);
+    }
+
+    /**
+     * @desc 根据 原始组件编码	查询app的组件code
+     * @param baseCmptCode
+     * @return
+     */
+    public String getAppComponentCodeByBaseCmptCode(String baseCmptCode){
+        JSONObject componentRelation = getComponentRelationByBaseCmptCode(baseCmptCode);
+        return componentRelation.getString("app_cmpt_code");
+    }
+
+
+}

+ 42 - 0
fm-sop/src/main/java/com/persagy/old/cache/DictionaryCache.java

@@ -0,0 +1,42 @@
+package com.persagy.old.cache;
+
+import com.alibaba.fastjson.JSONObject;
+import com.persagy.old.common.RedisConstant;
+import org.apache.commons.lang.StringUtils;
+import org.springframework.data.redis.core.RedisTemplate;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.Resource;
+
+/**
+ * Created by DOOM on 2017/9/7.
+ */
+@Component
+public class DictionaryCache {
+    @Resource(name="saasRedisTemplate")
+    private RedisTemplate<String,Object> saasRedisTemplate ;
+
+
+    /**
+     * 根据字典类型、字典code码获取项目下字典名称
+     * @param dictType 字典类型
+     * @param code     字典code码
+     * @return
+     */
+    public String getNameByTypeCode(String dictType, String code){
+        if (saasRedisTemplate.opsForHash().get(RedisConstant.ALL_GENERAL_DICTIONARY_KEY, dictType + ":" + code) == null) {
+            return "";
+        }
+        String result = (String) saasRedisTemplate.opsForHash().get(RedisConstant.ALL_GENERAL_DICTIONARY_KEY, dictType + ":" + code);
+        JSONObject dictionary = JSONObject.parseObject(result);
+        String name = null;
+        if (dictionary != null) {
+            name = dictionary.getString("name");
+            String customerName = dictionary.getString("customer_name");
+            if (StringUtils.isNotBlank(customerName)){
+                name = customerName;
+            }
+        }
+        return name;
+    }
+}

+ 63 - 0
fm-sop/src/main/java/com/persagy/old/cache/GraphCache.java

@@ -0,0 +1,63 @@
+package com.persagy.old.cache;
+
+import com.alibaba.fastjson.JSONObject;
+import com.persagy.old.common.DataRequestPathUtil;
+import com.persagy.old.common.RedisConstant;
+import com.persagy.old.common.StringUtil;
+import com.persagy.old.dao.DBConst;
+import com.persagy.old.service.BaseService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.redis.core.HashOperations;
+import org.springframework.data.redis.core.RedisOperations;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+
+/**
+ * Created by DOOM on 2017/9/6.
+ */
+@Service("graphCache")
+public class GraphCache {
+
+    @Autowired
+    private BaseService baseService;
+    private static final Logger log = LoggerFactory.getLogger(GraphCache.class);
+    @Resource(name="dataPlatformRedisTemplate")
+    private RedisOperations<String, Object> dataPlatformRedisTemplate;
+
+    public String getGraphIdByProjectIdAndGraph(String projectId, String graph) {
+        String key = projectId + ":" + graph;
+        HashOperations<String, Object, Object> opsForHash = dataPlatformRedisTemplate.opsForHash();
+        String graphId = (String) opsForHash.get(RedisConstant.ALL_GRAPH_INSTANCE_KEY, key);
+        if (StringUtil.isNull(graphId)) {
+            log.error("GraphCache未获取到缓存:" + key);
+        }
+        return graphId;
+    }
+    /**
+     * 功能描述:创建图示例
+     *
+     * @param projectId
+     * @param graph
+     * @return
+     * @throws Exception
+     */
+    public String createGraphInstance(String projectId,String graph )throws Exception{
+        String graphId = "";
+        JSONObject jsonObject = new JSONObject();
+        jsonObject.put("graph_type", graph);
+        jsonObject.put("projectId", projectId);
+
+        String requestUrl = baseService.getDataPlatformPath(DataRequestPathUtil.dataPlat_relation_graph_instance_create);
+        String queryResult = baseService.httpPostRequestDataPlatform(requestUrl, jsonObject.toJSONString());
+        JSONObject queryJson = JSONObject.parseObject(queryResult);
+        if (DBConst.Result.SUCCESS.equals(queryJson.getString(DBConst.Result.RESULT))) {
+            graphId = queryJson.getString("graph_id");
+            HashOperations<String, String, Object> opsForHash = dataPlatformRedisTemplate.opsForHash();
+            opsForHash.put(RedisConstant.ALL_GRAPH_INSTANCE_KEY, projectId + ":" + graph, graphId);
+        }
+        return graphId;
+    }
+}

+ 42 - 0
fm-sop/src/main/java/com/persagy/old/cache/InfoPointCache.java

@@ -0,0 +1,42 @@
+package com.persagy.old.cache;
+
+import com.alibaba.fastjson.JSONObject;
+import com.persagy.old.common.RedisConstant;
+import com.persagy.old.common.StringUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.redis.core.RedisTemplate;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.Resource;
+
+/**
+ * Created by guosongchao on 2017/8/17.
+ */
+@Component
+public class InfoPointCache {
+    @Resource(name="saasRedisTemplate")
+    private RedisTemplate<String, Object> saasRedisTemplate;
+    @Autowired
+    private ComponentRelationCache componentRelationCache;
+    /**
+     * 判断信息点是否在APP显示
+     * @param infoCmptId   信息点id
+     * @param baseCmptCode 信息点原始组件编码
+     * @return
+     */
+    public boolean isShowInApp(String infoCmptId, String baseCmptCode){
+        boolean isShowInApp = true;
+        String jsonStr = (String) saasRedisTemplate.opsForHash().get(RedisConstant.ALL_INFO_COMPONENT_KEY,infoCmptId);
+        if(StringUtil.isNotNull(jsonStr)){
+            JSONObject infoPoint = JSONObject.parseObject(jsonStr);
+            String appShowFlag = infoPoint.getString("app_show_flag");
+            if(!"1".equals(appShowFlag))
+                isShowInApp = false;
+        }else{
+            isShowInApp = componentRelationCache.hasAppCmpt(baseCmptCode);
+        }
+
+        return isShowInApp;
+    }
+
+}

+ 32 - 0
fm-sop/src/main/java/com/persagy/old/cache/OrderTypeCache.java

@@ -0,0 +1,32 @@
+package com.persagy.old.cache;
+
+import com.alibaba.fastjson.JSONObject;
+import com.persagy.old.common.RedisConstant;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.data.redis.core.RedisOperations;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.Resource;
+
+/**
+ * Created by yuecaipu on 2018/7/13.
+ */
+@Component
+public class OrderTypeCache {
+    private static final Logger log = LoggerFactory.getLogger(OrderTypeCache.class);
+    @Resource(name = "saasRedisTemplate")
+    private RedisOperations<String, Object> saasRedisTemplate;
+    public  String getOrderTypeNameById(String code){
+
+        String orderTypeStr = (String) saasRedisTemplate.opsForHash().get(RedisConstant.ALL_WO_FLOW_PLAN_PERSAGY_KEY, code);
+
+        if (orderTypeStr!=null){
+            JSONObject orderType = JSONObject.parseObject(orderTypeStr);
+            return orderType.getString("plan_name");
+        }
+        log.error("OrderTypeCache:getNameByTypeCode未获取到缓存:" + code);
+        return "";
+    }
+
+}

+ 52 - 0
fm-sop/src/main/java/com/persagy/old/cache/ProjectCache.java

@@ -0,0 +1,52 @@
+package com.persagy.old.cache;
+
+import com.alibaba.fastjson.JSONObject;
+import com.persagy.old.common.CommonConst;
+import com.persagy.old.common.RedisConstant;
+import com.persagy.old.common.StringUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.data.redis.core.RedisOperations;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.Resource;
+
+/**
+ * Created by guosongchao on 2017/8/15.
+ */
+@Component("projectCache")
+public class ProjectCache  {
+    private static final Logger log = LoggerFactory.getLogger(ProjectCache.class);
+    @Resource(name="emsRedisTemplate")
+    private RedisOperations<String, String> emsRedisTemplate;
+
+    public JSONObject getProjectById(String projectId){
+        String jsonStr = (String)emsRedisTemplate.opsForHash().get(RedisConstant.ALL_PROJECTS_KEY, projectId);
+        if (StringUtil.isNotNull(jsonStr)){
+            return JSONObject.parseObject(jsonStr);
+        }
+        log.error("projectCache未获取到缓存:"+projectId);
+        return new JSONObject();
+    }
+
+    public String getProjectNameById(String projectId){
+
+        return getProjectById(projectId).getString(CommonConst.info_name_local_name_project);
+    }
+
+    public String getProjLocalIDById(String projectId){
+
+        return getProjectById(projectId).getString(CommonConst.info_name_local_id_project);
+    }
+
+    /**
+     * 获取项目密码
+     * @param projectId
+     * @return
+     * @throws Exception
+     */
+    public String getProjectSecretById(String projectId){
+        return "";
+    }
+
+}

+ 1 - 4
fm-sop/src/main/java/com/persagy/fm/sop/constant/CommonConst.java

@@ -1,11 +1,8 @@
-package com.persagy.fm.sop.constant;
-
-import org.springframework.boot.autoconfigure.SpringBootApplication;
+package com.persagy.old.common;
 
 /**
  * Created by guosongchao on 2017/8/17.
  */
-@SpringBootApplication
 public class CommonConst {
     //通用sop的项目ID(默认)
     public final static String group_sop_id = "group_sop_id";

Dosya farkı çok büyük olduğundan ihmal edildi
+ 50 - 0
fm-sop/src/main/java/com/persagy/old/common/CommonMessage.java


+ 88 - 0
fm-sop/src/main/java/com/persagy/old/common/DataRequestPathUtil.java

@@ -0,0 +1,88 @@
+/**
+ * @包名称 com.sagacloud.common
+ * @文件名 DataRequestPathUtil.java
+ * @创建者 wanghailong
+ * @邮箱 wanghailong@persagy.com  
+ * @修改描述 
+ */
+
+package com.persagy.old.common;
+
+/** 
+ * 功能描述: 数据请求路径工具类
+ * @类型名称 DataRequestPathUtil
+ * @创建者 wanghailong
+ * @邮箱 wanghailong@persagy.com  
+ * @修改描述 
+ */
+public class DataRequestPathUtil {
+	
+	/**** 数据平台请求路径 ***/
+	//get:数据平台-数据字典查询
+	public final static String dataPlat_dict_query = "BASEPATH/dict/query/PARAM";
+
+	//post: 数据平台-对象模糊查询
+	public final static String dataPlat_object_like_query = "BASEPATH/object/search?projectId=PROJECTID&secret=SECRET";
+	//post:数据平台-对象-批量查询
+	public final static String dataPlat_object_batch_query = "BASEPATH/object/batch_query?projectId=PROJECTID&secret=SECRET";
+	//post:数据平台-对象-批量查询 (post)
+	public final static String dataPlat_object_batch_query_post = "BASEPATH/object/batch_query";
+
+	//post:根据信息点来查询各物理实体
+	public final static String dataPlat_object_query_by_info = "BASEPATH/object/query_by_info?projectId=PROJECTID&secret=SECRET";
+	//post:数据平台-对象-查询某个对象下的指定类型的objects
+	public final static String dataPlat_object_subset_query = "BASEPATH/object/subset_query?projectId=PROJECTID&secret=SECRET";
+	//post:数据平台-系统-查询某个专业下的所有系统
+	public final static String dataPlat_system_query_by_domain = "BASEPATH/equipment/system_query?projectId=PROJECTID&secret=SECRET";
+	//get:数据平台-项目-管理员查询
+	public final static String dataPlat_project_query = "BASEPATH/mng/project/query?secret=SECRET";
+	//post:数据平台-对象-设备综合查询
+	public final static String dataPlat_equipment_complex_query = "BASEPATH/equipment/complex_query?projectId=PROJECTID&secret=SECRET";
+		
+
+	//post:数据平台-关系-图实例-查询
+	public final static String dataPlat_relation_graph_instance_query = "BASEPATH/relation/graph_instance/query?projectId=PROJECTID&secret=SECRET";
+	//post:数据平台-关系-关系实例-查询
+	public final static String dataPlat_relation_relation_instance_query = "BASEPATH/relation/query?projectId=PROJECTID&secret=SECRET";
+	//post:数据平台-关系-指定图类型和关系类型的集合
+	public final static String dataPlat_relation_query_subset = "BASEPATH/relation/query_subset?projectId=PROJECTID&secret=SECRET";
+	//post:数据平台-关系-根据obj_type查询
+	public final static String dataPlat_relation_query_by_obj_type = "BASEPATH/relation/query_by_obj_type";
+
+
+	//get:数据平台-信息点-空间信息点
+	public final static String dataPlat_infoPoint_query_space = "BASEPATH/infocode/query/space";
+	//get:数据平台-信息点-楼层信息点
+	public final static String dataPlat_infoPoint_query_floor = "BASEPATH/infocode/query/floor";
+	//get:数据平台-信息点-建筑体信息点
+	public final static String dataPlat_infoPoint_query_building = "BASEPATH/infocode/query/building";
+	//get:数据平台-信息点-设备、系统独有信息点
+	public final static String dataPlat_infoPoint_special = "BASEPATH/infocode/query?ID=PARAM";
+	//post:数据平台-信息点-模糊查询
+	public final static String dataPlat_infoPoint_search = "BASEPATH/info_point/search?projectId=PROJECTID&secret=SECRET";
+	//post:数据平台-抗震设防烈度
+	public final static String dataPlat_seismic_precautionary_intensity_query = "BASEPATH/dict/query/seismic_precautionary_intensity";
+	//post:数据平台-查询信息点方案
+	public final static String dataPlat_custom_infoCode_scheme_query = "BASEPATH/custom_infocode/scheme/query";
+	//post:数据平台-查询信息点
+	public final static String dataPlat_custom_infoCode_scheme_info_query = "BASEPATH/custom_infocode/scheme/info/query";
+	//post:数据平台-增加自定义信息点
+	public final static String dataPlat_custom_infoCode_scheme_info_create = "BASEPATH/custom_infocode/scheme/info/create";
+
+	//post : 查询当前用户的密码MD5值
+//	public final static String persagy_manage_query_password_byuserid = "BASEPATH/Spring/MVC/entrance/unifier/queryPasswordByUserIdService";
+
+	//post:数据平台-查询种族相关信息点
+	public final static String dataPlat_infoCode_query_property = "BASEPATH/infocode/query_property";
+
+	//post:数据平台-图-图实例-添加
+	public final static String dataPlat_relation_graph_instance_create = "BASEPATH/relation/graph_instance/create?projectId=PROJECTID&secret=SECRET";
+	
+	//post:saas-竖井查询
+	public final static String dataPlat_query_shaft = "BASEPATH/restObjectService/queryShaft";
+
+	//post:数据平台-根据空间id或设备id查关系详情(层级结构)
+	public final static String dataPlat_query_space_or_equip = "BASEPATH/facility/querySpaceOrEquip";
+	//post:数据平台-根据空间id或设备id查关系详情(非层级结构)
+	public final static String dataPlat_query_space_or_equip_NoHierarchy = "BASEPATH/facility/querySpaceOrEquipNoHierarchy";
+}

+ 669 - 0
fm-sop/src/main/java/com/persagy/old/common/DataRequestProcessUtil.java

@@ -0,0 +1,669 @@
+package com.persagy.old.common;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.google.common.collect.Maps;
+import com.persagy.old.dao.DBConst;
+import com.persagy.old.dao.DBConst.Result;
+
+import java.text.SimpleDateFormat;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Date;
+import java.util.Map;
+
+/**
+ * 
+ * 功能描述: 数据请求处理类,包括查询条件的组装、返回数据处理、排序等
+ * @类型名称 DataRequestProcessUtil
+ * @创建者 wanghailong
+ * @邮箱 wanghailong@persagy.com  
+ * @修改描述
+ */
+public class DataRequestProcessUtil {
+    /**
+     * 转换更新参数
+     * @param jsonObject    用户接口参数,除了过滤项,其它项默认为新增项
+     * @return              数据平台接口参数
+     */
+    public static JSONObject getAddParamJson(JSONObject jsonObject){
+        JSONObject paramJson = new JSONObject();
+        paramJson.put("insertObject", jsonObject);
+        return paramJson;
+    }
+
+    /**
+     * 转换主键查询参数
+     * @param jsonObject    用户接口数据
+     * @param majors         主键
+     * @return                数据平台接口参数
+     */
+    public static JSONObject getKeyWithMajors(JSONObject jsonObject, String... majors){
+        JSONObject paramJson = new JSONObject();
+        JSONObject keyJson = new JSONObject();
+        Object value;
+        for(String major : majors){
+            value = jsonObject.get(major);
+            if(value != null && !"".equals(value.toString())){
+                keyJson.put(major, value);
+            }
+        }
+        paramJson.put("Key", keyJson);
+        return paramJson;
+    }
+
+    /**
+     * 转换更新参数
+     * @param jsonObject    用户接口参数,除了过滤项,其它项默认为修改项
+     * @param majors        过滤项
+     * @return              数据平台接口参数
+     */
+    public static JSONObject getUpdateParamJson(JSONObject jsonObject, String... majors){
+        JSONObject paramJson = new JSONObject();
+        JSONObject criteriaJson = new JSONObject();
+        Object value;
+        for(String major : majors){
+            value = jsonObject.get(major);
+            if(value != null && !"".equals(value.toString())){
+                criteriaJson.put(major, value);
+            }
+            jsonObject.remove(major);
+        }
+        paramJson.put("criteria", criteriaJson);
+        paramJson.put("set", jsonObject);
+
+        return paramJson;
+    }
+
+    /**
+     * 获得除去某些项的条件
+     * @param jsonObject    用户接口参数
+     * @param majors        过滤项
+     * @return              数据平台接口参数
+     */
+    public static JSONObject getCriteriaRemoveMajors(JSONObject jsonObject, String... majors){
+        JSONObject paramJson = new JSONObject();
+        for(String major : majors){
+            jsonObject.remove(major);
+        }
+        paramJson.put("criteria", jsonObject);
+        return paramJson;
+    }
+
+    /**
+     * 获得指定项的条件
+     * @param jsonObject    用户接口参数
+     * @param majors        过滤项
+     * @return              数据平台接口参数
+     */
+    public static JSONObject getCriteriaWithMajors(JSONObject jsonObject, String... majors){
+        JSONObject paramJson = new JSONObject();
+        JSONObject criteria = new JSONObject();
+        for(String major : majors){
+            criteria.put(major, jsonObject.get(major));
+        }
+        paramJson.put("criteria", criteria);
+        return paramJson;
+    }
+
+    /**
+     * 获得指定项的条件-用于批量查询
+     * @param jsonArray    用户接口参数
+     * @param key           参数的code码
+     * @param code          用户接口参数code码
+     * @return              数据平台接口参数
+     */
+    public static JSONObject getCriteriasWithMajors(JSONArray jsonArray, String key, String code){
+        JSONObject paramJson = new JSONObject();
+        JSONArray criterias = new JSONArray();
+        JSONObject criteria, json;
+        for(int i=0; i<jsonArray.size(); i++){
+            json = jsonArray.getJSONObject(i);
+            criteria = new JSONObject();
+            criteria.put(code, json.get(key));
+            criterias.add(criteria);
+        }
+        paramJson.put("criterias", criterias);
+        return paramJson;
+    }
+
+    /**
+     * 获得指定项的条件-用于批量查询
+     * @param jsonObject    用户接口参数
+     * @param key           参数的code码
+     * @param code          用户接口参数code码
+     * @return              数据平台接口参数
+     */
+    public static JSONObject getCriteriasWithMajors(JSONObject jsonObject, String key, String code){
+        JSONObject paramJson = new JSONObject();
+        JSONArray criterias = new JSONArray();
+        JSONObject criteria = new JSONObject();
+        criteria.put(code, jsonObject.get(key));
+        criterias.add(criteria);
+        paramJson.put("criterias", criterias);
+        return paramJson;
+    }
+    
+    /**
+     * 获得批量查询参数
+     * @param jsonObject 参数
+     * @param arrayInfo 批量数组名
+     * @param infoName  查询参数
+     * @param marjors   非批量参数
+     * @return
+     */
+    public static JSONObject getCriteriasWithMajors(JSONObject jsonObject, String arrayInfo, String infoName, String... marjors){
+        JSONObject paramJson = new JSONObject();
+        JSONArray criterias = new JSONArray();
+        JSONObject criteria;
+        JSONArray infos = jsonObject.getJSONArray(arrayInfo);
+        if(infos != null) {
+            for (int i=0; i<infos.size(); i++){
+                criteria = new JSONObject();
+                criteria.put(infoName, infos.get(i));
+                for(String marjor : marjors){
+                    if(!marjor.equals(infoName))
+                        criteria.put(marjor, jsonObject.get(marjor));
+                }
+                criterias.add(criteria);
+            }
+        }
+        paramJson.put("criterias", criterias);
+        return paramJson;
+    }
+
+    /**
+     * 获得数据平台查询条件
+     * @param codeName
+     * @param jsonObject
+     * @param majors
+     * @return
+     */
+    public static JSONObject getDataPlatCriteriaWithMajors(String codeName, JSONObject jsonObject, String... majors){
+        JSONObject paramJson = new JSONObject();
+        JSONObject criteria = new JSONObject();
+        if(codeName != null){
+            criteria.put("id", jsonObject.get(codeName));
+        }
+        for(String major : majors){
+            criteria.put(major, jsonObject.get(major));
+        }
+        paramJson.put("criteria", criteria);
+        return paramJson;
+    }
+
+    /**
+     * filter info
+     */
+    public static IJSONOperator filter = (jsonObject, filters) -> {
+        JSONObject returnJson = new JSONObject();
+        for(String filter : filters){
+            returnJson.put(filter, jsonObject.get(filter));
+        }
+        return returnJson;
+    };
+
+    /**
+     * remove info
+     */
+    public static IJSONOperator removeInfo = (jsonObject, infos) -> {
+        if(jsonObject != null){
+            for(String info : infos){
+                jsonObject.remove(info);
+            }
+        }
+        return jsonObject;
+    };
+
+    /**
+     * String to JSONObject/JSONArray
+     */
+    public static IJSONOperator processStringToJson = (jsonObject, marjors) ->{
+        if(jsonObject != null){
+            String content;
+            for(String marjor : marjors){
+                content = jsonObject.getString(marjor);
+                if(content != null){
+                    if(content.startsWith("{"))
+                        jsonObject.put(marjor, JSONObject.parseObject(content));
+                    else if(content.startsWith("["))
+                        jsonObject.put(marjor, JSONObject.parseArray(content));
+                }
+            }
+        }
+        return jsonObject;
+    };
+
+    /**
+     * tranfer infoValue of date type
+     */
+    public static IJSONOperator tranferTimeFormat = (jsonObject, marjors) ->{
+        SimpleDateFormat fsdf = new SimpleDateFormat(CommonConst.date_format_save);
+        SimpleDateFormat tsdf = new SimpleDateFormat(CommonConst.date_format_show);
+        for(String marjor : marjors){
+            if(jsonObject.containsKey(marjor))
+                jsonObject.put(marjor, tsdf.format(fsdf.parse(jsonObject.getString(marjor))));
+        }
+        return jsonObject;
+    };
+
+    /**
+     * process result : tranfer info of date type、 filter info、 process string to json
+     * @param queryResult query result
+     * @param tranferTimeFormat operation of tranfer info of date type
+     * @param processStringToJson operation of process string to json
+     * @param filter operation of filter info
+     * @param dataInfo parameter of tranfer info of date type
+     * @param jsonInfo parameter of process string to json
+     * @param filters parameter of filter info
+     * @return
+     * @throws Exception
+     */
+    public static JSONObject processQueryResult(String queryResult, IJSONOperator tranferTimeFormat, IJSONOperator processStringToJson, IJSONOperator filter, String dataInfo, String[] jsonInfo, String... filters) throws Exception{
+        JSONObject queryResultJson = JSONObject.parseObject(queryResult);
+        if("failure".equals(queryResultJson.getString("Result")) || queryResultJson.getIntValue("Count") < 1)
+            return queryResultJson;
+        JSONArray queryResultArray = queryResultJson.getJSONArray("Content");
+        JSONArray returnArray = new JSONArray();
+        JSONObject item;
+        for(int i=0; i<queryResultArray.size(); i++){
+            item = queryResultArray.getJSONObject(i);
+            if(tranferTimeFormat != null)
+                item = tranferTimeFormat.operation(item, dataInfo);
+            if(processStringToJson != null)
+                item = processStringToJson.operation(item, jsonInfo);
+            if(filter != null)
+                item = filter.operation(item, filters);
+            returnArray.add(item);
+        }
+        queryResultJson.put("Content", returnArray);
+        queryResultJson.put("Count", returnArray.size());
+        return queryResultJson;
+    }
+
+    /**
+     * get first record from query result
+     * @param queryResult query result
+     * @param tranferTimeFormat operation of tranfer info of date type
+     * @param processStringToJson operation of process string to json
+     * @param filter operation of filter info
+     * @param dataInfo parameter of tranfer info of date type
+     * @param jsonInfo parameter of process string to json
+     * @param filters parameter of filter info
+     * @return
+     * @throws Exception
+     */
+    public static JSONObject getFirstRecordfromResult(String queryResult, IJSONOperator tranferTimeFormat, IJSONOperator processStringToJson, IJSONOperator filter, String[] dataInfo, String[] jsonInfo, String... filters) throws Exception{
+        JSONObject queryResultJson = JSONObject.parseObject(queryResult);
+        if("failure".equals(queryResultJson.getString("Result")) || queryResultJson.getIntValue("Count") < 1)
+            return queryResultJson;
+        JSONArray queryResultArray = queryResultJson.getJSONArray("Content");
+        JSONObject item = queryResultArray.getJSONObject(0);
+        if(tranferTimeFormat != null)
+            item = tranferTimeFormat.operation(item, dataInfo);
+        if(processStringToJson != null)
+            item = processStringToJson.operation(item, jsonInfo);
+        if(filter != null)
+            item = filter.operation(item, filters);
+        queryResultJson.put("Item", item);
+        queryResultJson.remove("Content");
+        queryResultJson.remove("Count");
+        return queryResultJson;
+    }
+
+    /**
+     *
+     * 功能描述:处理查询返回结果,将结果中的内容项转化为JsonString
+     * @param queryResult
+     * @param majors
+     * @return
+     * @创建者 wanghailong
+     * @邮箱 wanghailong@persagy.com 
+     * @修改描述
+     */
+    public static String prossesResultToJsonString(String queryResult, String... majors){
+        if(queryResult.contains("Result") && queryResult.contains("Content")){
+            JSONObject resultJson = JSONObject.parseObject(queryResult);
+            JSONArray array = (JSONArray) resultJson.get("Content");
+            for(int i = 0 ; i < array.size() ; i++){
+                JSONObject dataJson = array.getJSONObject(i);
+                for(String major : majors){
+                    String dataString = dataJson.getString(major);
+                    if(!StringUtil.isNull(dataString)){
+                        if(dataString.startsWith("{")){
+                            dataJson.put(major, JSONObject.parseObject(dataJson.getString(major)));
+                        }else if(dataString.startsWith("[")){
+                            dataJson.put(major, JSONArray.parseArray(dataJson.getString(major)));
+                        }
+                    }
+                }
+                array.set(i, dataJson);
+            }
+            resultJson.put("Content", array);
+            queryResult = resultJson.toString();
+        }
+        return queryResult;
+    }
+
+    /**
+     *
+     * 功能描述:处理插入参数,将参数中的内容项转化为JsonString
+     * @param jsonObject
+     * @param majors
+     * @return
+     * @创建者 wanghailong
+     * @邮箱 wanghailong@persagy.com
+     * @修改描述
+     */
+    public static JSONObject prossesParamToJsonString(JSONObject jsonObject, String... majors){
+        for(String major : majors){
+            if(jsonObject.containsKey(major)){
+                jsonObject.put(major, JSON.toJSONString(jsonObject.get(major)));
+            }
+        }
+        return jsonObject;
+    }
+
+    /**
+     * 功能描述:处理查询返回结果,转换结果中Date类型的数据格式
+     * @param queryResult
+     * @param fromDateFormat
+     * @param toDateFormat
+     * @param majors
+     * @return
+     * @throws Exception
+     */
+    public static String prossesResultToDateString(String queryResult, String fromDateFormat, String toDateFormat , String... majors) throws Exception{
+        if(queryResult.contains("Result") && queryResult.contains("Content")){
+            JSONObject resultJson = JSONObject.parseObject(queryResult);
+            JSONArray array = (JSONArray) resultJson.get("Content");
+            SimpleDateFormat fsdf = new SimpleDateFormat(fromDateFormat);
+            SimpleDateFormat tsdf = new SimpleDateFormat(toDateFormat);
+            for(int i = 0 ; i < array.size() ; i++){
+                JSONObject dataJson = array.getJSONObject(i);
+                for(String major : majors){
+                    String dataString = dataJson.getString(major);
+                    if(!StringUtil.isNull(dataString)){
+                        dataJson.put(major, tsdf.format(fsdf.parse(dataString)));
+                    }
+                }
+                array.set(i, dataJson);
+            }
+            resultJson.put("Content", array);
+            queryResult = resultJson.toString();
+        }
+        return queryResult;
+    }
+
+    /**
+     *
+     * 功能描述:返回查询结果中的第一条记录
+     * @param queryResult
+     * @return
+     * @创建者 wanghailong
+     * @邮箱 wanghailong@persagy.com 
+     * @修改描述
+     */
+    public static String getFirstRecordfromResult(String queryResult){
+        if(queryResult.contains("Result") && queryResult.contains("Content")){
+            JSONObject resultJson = JSONObject.parseObject(queryResult);
+            JSONArray array = (JSONArray) resultJson.get("Content");
+            if(array.size() > 0 && null != array.get(0)) {
+                resultJson.put("Item", JSONObject.parseObject(array.get(0).toString()));
+                resultJson.remove("Content");
+                resultJson.remove("Count");
+            }
+
+            queryResult = resultJson.toString();
+        }
+        return queryResult;
+    }
+
+    /**
+     *
+     * 功能描述:返回查询结果中的第一条记录,Json格式
+     * @param queryResult
+     * @return
+     * @创建者 wanghailong
+     * @邮箱 wanghailong@persagy.com 
+     * @修改描述
+     */
+    public static JSONObject getFirstRecordfromResultWithJson(String queryResult){
+        JSONObject firstJson = null;
+        if(queryResult.contains("Result") && queryResult.contains("Content")){
+            JSONObject resultJson = JSONObject.parseObject(queryResult);
+            JSONArray array = (JSONArray) resultJson.get("Content");
+            if(array.size() > 0 && null != array.get(0)) {
+                firstJson = JSONObject.parseObject(array.get(0).toString());
+            }
+        }
+        return firstJson;
+    }
+
+    /**
+     * 转换返回结果数据格式 persagy --> saga
+     * @param queryResult
+     * @return
+     */
+    public static JSONObject translationResultFromPersagy(String queryResult){
+        JSONObject queryJson = JSONObject.parseObject(queryResult);
+        JSONObject result = new JSONObject();
+        result.put(Result.RESULT, queryJson.get(Result.PERSAGY_RESULT));
+        result.put(Result.CONTENT, queryJson.get(Result.PERSAGY_CONTENT));
+        result.put(Result.RESULTMSG, queryJson.get(Result.PERSAGY_REASON));
+        return result;
+    }
+
+
+    public static <K, V> Map<K, V> getMapFromResult(JSONObject resultJson, String keyCode, String valueCode){
+        Map<K, V> map = Maps.newHashMap();
+
+        JSONArray results = resultJson.getJSONArray(DBConst.Result.CONTENT);
+        results = results == null ? new JSONArray() : results;
+        JSONObject result;
+
+        for(int i=0; i<results.size(); i++){
+            result = results.getJSONObject(i);
+            map.put((K)result.get(keyCode), (V)result.get(valueCode));
+        }
+
+        return map;
+    }
+
+    /**
+     * 排序
+     * @param queryResult
+     * @param field  排序的字段
+     * @param order      -1:倒序  1:正序
+     * @return
+     */
+    public static JSONObject sortByField(String queryResult, String field, int order){
+        JSONObject resultJson = JSONObject.parseObject(queryResult);
+        JSONArray contentArray = resultJson.getJSONArray("Content");
+        if(contentArray != null){
+            Collections.sort(contentArray, new Comparator<Object>(){
+                public int compare(Object str1, Object str2){
+                    JSONObject obj1 = JSONObject.parseObject(str1.toString());
+                    JSONObject obj2 = JSONObject.parseObject(str2.toString());
+                    if(obj1.getLongValue(field) > obj2.getLongValue(field)){
+                        return order;
+                    }
+                    if(obj1.getLongValue(field) == obj2.getLongValue(field)){
+                        return 0;
+                    }
+                    return -1 * order;
+                }
+            });
+        }
+        resultJson.put("Content", contentArray);
+        return resultJson;
+    }
+
+    /**
+     * 排序
+     * @param array
+     * @param field  排序的字段
+     * @param order      -1:倒序  1:正序
+     * @return
+     */
+    public static JSONArray sortByField(JSONArray array, String field, int order){
+        if(array != null){
+            Collections.sort(array, new Comparator<Object>(){
+                public int compare(Object str1, Object str2){
+                    JSONObject obj1 = JSONObject.parseObject(str1.toString());
+                    JSONObject obj2 = JSONObject.parseObject(str2.toString());
+                    if(obj1.getLongValue(field) > obj2.getLongValue(field)){
+                        return order;
+                    }
+                    if(obj1.getLongValue(field) == obj2.getLongValue(field)){
+                        return 0;
+                    }
+                    return -1 * order;
+                }
+            });
+        }
+        return array;
+    }
+    
+    /**
+     * 排序
+     * @param array
+     * @param field  排序的字段
+     * @param order      -1:倒序  1:正序
+     * @return
+     */
+    public static JSONArray sortByIntegerField(JSONArray array, String field, int order){
+    	if(array != null){
+    		Collections.sort(array, new Comparator<Object>(){
+    			public int compare(Object str1, Object str2){
+    				JSONObject obj1 = JSONObject.parseObject(str1.toString());
+    				JSONObject obj2 = JSONObject.parseObject(str2.toString());
+    				String order1_Str = obj1.getString(field);
+    				String order2_Str = obj2.getString(field);
+    				if(StringUtil.isNull(order1_Str)) {
+    					order1_Str = Integer.MIN_VALUE + "";
+    				}
+    				if(StringUtil.isNull(order2_Str)) {
+    					order2_Str = Integer.MIN_VALUE + "";
+    				}
+    				
+    				
+    				Integer order1 = Integer.valueOf(order1_Str);
+    				Integer order2 = Integer.valueOf(order2_Str);
+    				
+    				if(order1 > order2){
+    					return order;
+    				}
+    				if(order1 == order2){
+    					return 0;
+    				}
+    				return -1 * order;
+    			}
+    		});
+    	}
+    	return array;
+    }
+    /**
+     * 排序
+     * @param array
+     * @param field  排序的字段
+     * @param order      -1:倒序  1:正序
+     * @return
+     */
+    public static JSONArray sortByStringField(JSONArray array, String field, int order){
+    	if(array != null){
+    		Collections.sort(array, new Comparator<Object>(){
+    			public int compare(Object str1, Object str2){
+    				JSONObject obj1 = JSONObject.parseObject(str1.toString());
+    				JSONObject obj2 = JSONObject.parseObject(str2.toString());
+    				String order1 = obj1.getString(field);
+    				if(order1 == null) {
+    					order1 = "";
+    				}
+    				
+    				String order2 = obj2.getString(field);
+    				if(order2 == null) {
+    					order2 = "";
+    				}
+    				
+    				
+    				if(order1.compareTo(order2) > -1){
+    					return order;
+    				}
+    				return -1 * order;
+    			}
+    		});
+    	}
+    	return array;
+    }
+
+    /**
+     * 排序
+     * @param array
+     * @param field  排序的字段
+     * @param order      -1:倒序  1:正序
+     * @return
+     */
+    public static JSONArray sortByDateField(JSONArray array, String field, int order){
+    	if(array != null){
+    		Collections.sort(array, new Comparator<Object>(){
+    			public int compare(Object str1, Object str2){
+    				JSONObject obj1 = JSONObject.parseObject(str1.toString());
+    				JSONObject obj2 = JSONObject.parseObject(str2.toString());
+    				String order1_Str = obj1.getString(field);
+    				String order2_Str = obj2.getString(field);
+    				try {
+    					Date order1 = DateUtil.parseDate(CommonConst.date_format_save, order1_Str);
+    					Date order2 = DateUtil.parseDate(CommonConst.date_format_save, order2_Str);
+    					
+    					if(order1.getTime() > order2.getTime()){
+    						return order;
+    					}
+    					if(order1.getTime() == order2.getTime()){
+    						return 0;
+    					}
+					} catch (Exception e) {
+					}
+    				return -1 * order;
+    			}
+    		});
+    	}
+    	return array;
+    }
+    
+    public static void main(String[] args) {
+		JSONArray array = new JSONArray();
+		JSONObject object = new JSONObject();
+		object.put("create_time", "20171120000056");
+		array.add(object);
+		object = new JSONObject();
+		object.put("create_time", "20171120000001");
+		array.add(object);
+		object = new JSONObject();
+		object.put("create_time", "20171120000008");
+		array.add(object);
+		object = new JSONObject();
+		object.put("create_time", "20171120000004");
+		array.add(object);
+		object = new JSONObject();
+		object.put("create_time", "20171120000003");
+		array.add(object);
+		object = new JSONObject();
+		object.put("create_time", "20171120000015");
+		array.add(object);
+		object = new JSONObject();
+		object.put("create_time", "20171120000011");
+		array.add(object);
+		object = new JSONObject();
+		object.put("create_time", "20171120000003");
+		array.add(object);
+		object = new JSONObject();
+		object.put("create_time", "20171120000003");
+		array.add(object);
+		System.out.println(sortByDateField(array, "create_time", 1).toJSONString());
+		System.out.println(sortByDateField(array, "create_time", -1).toJSONString());
+	}
+    
+    
+}

+ 62 - 0
fm-sop/src/main/java/com/persagy/old/common/DateUtil.java

@@ -0,0 +1,62 @@
+/**
+ * @包名称 com.sagacloud.common
+ * @文件名 DateUtil.java
+ * @创建者 wanghailong
+ * @邮箱 wanghailong@persagy.com  
+ * @修改描述 
+ */
+
+package com.persagy.old.common;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+/** 
+ * 功能描述: 日期工具类
+ * @类型名称 DateUtil
+ * @创建者 wanghailong
+ * @邮箱 wanghailong@persagy.com  
+ * @修改描述 
+ */
+public class DateUtil {
+    public static String sdfHour = "yyyyMMddHH";
+
+	public static String getNowTimeStr() {
+    	SimpleDateFormat sdf = new SimpleDateFormat(CommonConst.date_format_save);
+        return sdf.format(new Date());
+    }
+    
+	/**
+	 * 获取当前的UTC时间,精确到毫秒
+	 */
+	public static Long getUtcTimeNow(){
+		Date dateNow = new Date();
+		Long lRes = dateNow.getTime();
+		return lRes;
+	}
+
+	/**
+	 * 转换时间格式
+	 * @param dateStr
+	 * @param fromDateFormat
+	 * @param toDateFormat
+	 * @return
+	 * @throws ParseException
+	 */
+	public static String transferDateFormat(String dateStr, String fromDateFormat, String toDateFormat) throws ParseException {
+		SimpleDateFormat fromSdf = new SimpleDateFormat(fromDateFormat);
+		SimpleDateFormat toSdf = new SimpleDateFormat(toDateFormat);
+		return toSdf.format(fromSdf.parse(dateStr));
+	}
+	
+	public static Date parseDate(String pattern, String str) throws ParseException {
+		Date date = new SimpleDateFormat(pattern).parse(str);
+		return date;
+	}
+
+	public static String formatStr(String pattern, Date date) {
+		String str = new SimpleDateFormat(pattern).format(date);
+		return str;
+	}
+}

+ 10 - 0
fm-sop/src/main/java/com/persagy/old/common/IJSONOperator.java

@@ -0,0 +1,10 @@
+package com.persagy.old.common;
+
+import com.alibaba.fastjson.JSONObject;
+
+/**
+ * Created by guosongchao on 2017/8/16.
+ */
+public interface IJSONOperator {
+    public JSONObject operation(JSONObject jsonObject, String... str) throws Exception;
+}

+ 715 - 0
fm-sop/src/main/java/com/persagy/old/common/JSONUtil.java

@@ -0,0 +1,715 @@
+package com.persagy.old.common;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+
+import java.text.SimpleDateFormat;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+
+public class JSONUtil {
+    /**
+     * 转换更新参数
+     * @param jsonObject    用户接口参数,除了过滤项,其它项默认为新增项
+     * @return              数据平台接口参数
+     */
+    public static JSONObject getAddParamJson(JSONObject jsonObject){
+        JSONObject paramJson = new JSONObject();
+        paramJson.put("insertObject", jsonObject);
+        return paramJson;
+    }
+
+    /**
+     * 转换批量插入参数-bathchAddParam为JSONObect数组
+     * @param batchAddParam
+     * @param idName
+     * @param idTag
+     * @param param
+     * @param marjors
+     * @return
+     */
+    public static JSONObject getBatchAddParamJson(JSONArray batchAddParam, String idName, String idTag, JSONObject param, String... marjors){
+        JSONArray array = new JSONArray();
+        JSONObject batchItem;
+        for(int i=0; i<batchAddParam.size(); i++){
+            batchItem = batchAddParam.getJSONObject(i);
+            batchItem.put(idName, idTag + ToolsUtil.getRecordId(""));
+            for(String marjor : marjors){
+                batchItem.put(marjor, JSON.parse(JSON.toJSONString(param.get(marjor))));
+            }
+            array.add(batchItem);
+        }
+        JSONObject paramJson = new JSONObject();
+        paramJson.put("insertObjects", array);
+        return paramJson;
+    }
+
+    /**
+     * 转换批量插入参数-bathch
+     * @param batchAddParam   --需要批量插入的数组
+     * @param batchName		  --需要插入的字段名
+     * @param idName		  --主键字段名称
+     * @param idTag           --主键前缀
+     * @param param           --携带其它字段参数的对象   
+     * @param marjors         --其它字段参数(key)
+     * @return
+     */
+    public static JSONObject getBatchAddParamJson(JSONArray batchAddParam, String batchName, String idName, String idTag, JSONObject param, String... marjors){
+        JSONArray array = new JSONArray();
+        JSONObject item;
+        for(int i=0; i<batchAddParam.size(); i++){
+            item = new JSONObject();
+            item.put(batchName, batchAddParam.getString(i));
+            item.put(idName, idTag + ToolsUtil.getRecordId(""));
+            for(String marjor : marjors){
+                item.put(marjor, JSON.parse(JSON.toJSONString(param.get(marjor))));
+            }
+            array.add(item);
+        }
+        JSONObject paramJson = new JSONObject();
+        paramJson.put("insertObjects", array);
+        return paramJson;
+    }
+
+    /**
+     * 转换主键查询参数
+     * @param jsonObject    用户接口数据
+     * @param majors         主键
+     * @return                数据平台接口参数
+     */
+    public static JSONObject getKeyWithMajors(JSONObject jsonObject, String... majors){
+        JSONObject paramJson = new JSONObject();
+        JSONObject keyJson = new JSONObject();
+        Object value;
+        for(String major : majors){
+            value = jsonObject.get(major);
+            if(value != null && !"".equals(value.toString())){
+                keyJson.put(major, value);
+            }
+        }
+        paramJson.put("Key", keyJson);
+        return paramJson;
+    }
+
+    public static JSONObject getKeysWithMajors(JSONObject jsonObject, String infoName, String infoKey){
+        JSONObject paramJson = new JSONObject();
+        JSONArray keys = new JSONArray();
+        JSONObject key;
+        JSONArray keyArray = jsonObject.getJSONArray(infoName);
+        if(keyArray != null){
+            for(int i=0; i<keyArray.size(); i++){
+                key = new JSONObject();
+                key.put(infoKey, keyArray.get(i));
+                keys.add(key);
+            }
+        }
+        paramJson.put("keys", keys);
+        return paramJson;
+    }
+
+    public static JSONObject getBatchUpdateParamJson(JSONObject jsonObject, String arrayInfo, String infoName, JSONObject values, String... marjors){
+    	JSONObject paramJson = new JSONObject();
+    	JSONArray criterias = new JSONArray();
+    	
+    	JSONArray array = jsonObject.getJSONArray(arrayInfo);
+    	if(array == null || array.size() == 0){
+    		return null;
+    	}
+    	for(int i=0; i<array.size(); i++){
+    		JSONObject criteria = new JSONObject();
+    		criteria.put(infoName, array.get(i));
+    		for(String marjor : marjors){
+    			criteria.put(marjor, jsonObject.get(marjor));
+    		}
+    		criterias.add(criteria);
+    	}
+    	paramJson.put("criterias", criterias);
+    	paramJson.put("set", values);
+    	
+    	return paramJson;
+    }
+    
+    /**
+     * 转换更新参数
+     * @param jsonObject    用户接口参数,除了过滤项,其它项默认为修改项
+     * @param majors        过滤项
+     * @return              数据平台接口参数
+     */
+    public static JSONObject getUpdateParamJson(JSONObject jsonObject, String... majors){
+        JSONObject paramJson = new JSONObject();
+        JSONObject criteriaJson = new JSONObject();
+        Object value;
+        for(String major : majors){
+            value = jsonObject.get(major);
+            if(value != null && !"".equals(value.toString())){
+                criteriaJson.put(major, value);
+            }
+            jsonObject.remove(major);
+        }
+        paramJson.put("criteria", criteriaJson);
+        paramJson.put("set", jsonObject);
+
+        return paramJson;
+    }
+
+    /**
+     * 转换更新参数
+     * @param jsonObject    用户接口参数,除了过滤项,其它项默认为修改项
+     * @param conditionName 更新条件名称
+     * @param conditionValue 更新条件值
+     * @param majors        过滤项
+     * @return              数据平台接口参数
+     */
+    public static JSONObject getUpdateParamJson(String conditionName, String conditionValue, JSONObject jsonObject, String... majors){
+        JSONObject paramJson = new JSONObject();
+        JSONObject criteriaJson = new JSONObject();
+        criteriaJson.put(conditionName, conditionValue);
+        Object value;
+        for(String major : majors){
+            value = jsonObject.get(major);
+            if(value != null && !"".equals(value.toString())){
+                criteriaJson.put(major, value);
+            }
+            jsonObject.remove(major);
+        }
+        paramJson.put("criteria", criteriaJson);
+        paramJson.put("set", jsonObject);
+
+        return paramJson;
+    }
+
+    /**
+     * 获得除去某些项的条件
+     * @param jsonObject    用户接口参数
+     * @param majors        过滤项
+     * @return              数据平台接口参数
+     */
+    public static JSONObject getCriteriaRemoveMajors(JSONObject jsonObject, String... majors){
+        JSONObject paramJson = new JSONObject();
+        for(String major : majors){
+            jsonObject.remove(major);
+        }
+        paramJson.put("criteria", jsonObject);
+        return paramJson;
+    }
+
+    /**
+     * 获得指定项的条件
+     * @param jsonObject    用户接口参数
+     * @param majors        过滤项
+     * @return              数据平台接口参数
+     */
+    public static JSONObject getCriteriaWithMajors(JSONObject jsonObject, String... majors){
+        JSONObject paramJson = new JSONObject();
+        JSONObject criteria = new JSONObject();
+        for(String major : majors){
+            criteria.put(major, jsonObject.get(major));
+        }
+        paramJson.put("criteria", criteria);
+        return paramJson;
+    }
+
+    /**
+     * 获得指定项的条件-用于批量查询
+     * @param jsonArray    用户接口参数
+     * @param key           参数的code码
+     * @param code          用户接口参数code码
+     * @return              数据平台接口参数
+     */
+    public static JSONObject getCriteriasWithMajors(JSONArray jsonArray, String key, String code){
+        JSONObject paramJson = new JSONObject();
+        JSONArray criterias = new JSONArray();
+        JSONObject criteria, json;
+        for(int i=0; i<jsonArray.size(); i++){
+            json = jsonArray.getJSONObject(i);
+            criteria = new JSONObject();
+            criteria.put(code, json.get(key));
+            criterias.add(criteria);
+        }
+        paramJson.put("criterias", criterias);
+        return paramJson;
+    }
+
+    /**
+     * 获得指定项的条件-用于批量查询
+     * @param jsonObject    用户接口参数
+     * @param key           参数的code码
+     * @param code          用户接口参数code码
+     * @return              数据平台接口参数
+     */
+    public static JSONObject getCriteriasWithMajors(JSONObject jsonObject, String key, String code){
+        JSONObject paramJson = new JSONObject();
+        JSONArray criterias = new JSONArray();
+        JSONObject criteria = new JSONObject();
+        criteria.put(code, jsonObject.get(key));
+        criterias.add(criteria);
+        paramJson.put("criterias", criterias);
+        return paramJson;
+    }
+
+    /**
+     * 获得批量查询参数
+     * @param jsonObject 参数
+     * @param arrayInfo 批量数组名
+     * @param infoName  查询参数
+     * @param marjors   非批量参数
+     * @return
+     */
+    public static JSONObject getCriteriasWithMajors(JSONObject jsonObject, String arrayInfo, String infoName, String... marjors){
+        JSONObject paramJson = new JSONObject();
+        JSONArray criterias = new JSONArray();
+        JSONObject criteria;
+        JSONArray infos = jsonObject.getJSONArray(arrayInfo);
+        if(infos != null) {
+            for (int i=0; i<infos.size(); i++){
+                criteria = new JSONObject();
+                criteria.put(infoName, infos.get(i));
+                for(String marjor : marjors){
+                    if(!marjor.equals(infoName)){
+                    	Object value = jsonObject.get(marjor);
+                    	if(value instanceof JSONObject){
+                    		criteria.put(marjor, JSONObject.parseObject((jsonObject.getString(marjor))));
+                    	}else if(value instanceof JSONArray){
+                    		criteria.put(marjor, JSONArray.parseArray(jsonObject.getString(marjor)));
+                    	}else{
+                    		criteria.put(marjor, jsonObject.get(marjor));
+                    	}
+                    }
+                }
+                criterias.add(criteria);
+            }
+        }
+        paramJson.put("criterias", criterias);
+        return paramJson;
+    }
+
+    /**
+     * 获得数据平台查询条件
+     * @param codeName
+     * @param jsonObject
+     * @param majors
+     * @return
+     */
+    public static JSONObject getDataPlatCriteriaWithMajors(String codeName, JSONObject jsonObject, String... majors){
+        JSONObject paramJson = new JSONObject();
+        JSONObject criteria = new JSONObject();
+        if(codeName != null){
+            criteria.put("id", jsonObject.get(codeName));
+        }
+        for(String major : majors){
+            criteria.put(major, jsonObject.get(major));
+        }
+        paramJson.put("criteria", criteria);
+        return paramJson;
+    }
+
+    /**
+     * filter info
+     */
+    public static IJSONOperator filter = (jsonObject, filters) -> {
+        JSONObject returnJson = new JSONObject();
+        for(String filter : filters){
+            returnJson.put(filter, jsonObject.get(filter));
+        }
+        return returnJson;
+    };
+
+    /**
+     * remove info
+     */
+    public static IJSONOperator removeInfo = (jsonObject, infos) -> {
+        if(jsonObject != null){
+            for(String info : infos){
+                jsonObject.remove(info);
+            }
+        }
+        return jsonObject;
+    };
+
+    /**
+     * String to JSONObject/JSONArray
+     */
+    public static IJSONOperator processStringToJson = (jsonObject, marjors) ->{
+        if(jsonObject != null){
+            String content;
+            for(String marjor : marjors){
+                content = jsonObject.getString(marjor);
+                if(content != null){
+                    if(content.startsWith("{"))
+                        jsonObject.put(marjor, JSONObject.parseObject(content));
+                    else if(content.startsWith("["))
+                        jsonObject.put(marjor, JSONObject.parseArray(content));
+                }
+            }
+        }
+        return jsonObject;
+    };
+
+    /**
+     * tranfer infoValue of date type
+     */
+    public static IJSONOperator tranferTimeFormat = (jsonObject, marjors) ->{
+        SimpleDateFormat fsdf = new SimpleDateFormat(CommonConst.date_format_save);
+        SimpleDateFormat tsdf = new SimpleDateFormat(CommonConst.date_format_show);
+        for(String marjor : marjors){
+            if(jsonObject.containsKey(marjor))
+                jsonObject.put(marjor, tsdf.format(fsdf.parse(jsonObject.getString(marjor))));
+        }
+        return jsonObject;
+    };
+
+    /**
+     * process result : tranfer info of date type、 filter info、 process string to json
+     * @param queryResult query result
+     * @param tranferTimeFormat operation of tranfer info of date type
+     * @param processStringToJson operation of process string to json
+     * @param filter operation of filter info
+     * @param dataInfo parameter of tranfer info of date type
+     * @param jsonInfo parameter of process string to json
+     * @param filters parameter of filter info
+     * @return
+     * @throws Exception
+     */
+    public static JSONObject processQueryResult(String queryResult, IJSONOperator tranferTimeFormat, IJSONOperator processStringToJson, IJSONOperator filter, String dataInfo, String[] jsonInfo, String... filters) throws Exception{
+        JSONObject queryResultJson = JSONObject.parseObject(queryResult);
+        if("failure".equals(queryResultJson.getString("Result")) || queryResultJson.getIntValue("Count") < 1)
+            return queryResultJson;
+        JSONArray queryResultArray = queryResultJson.getJSONArray("Content");
+        JSONArray returnArray = new JSONArray();
+        JSONObject item;
+        for(int i=0; i<queryResultArray.size(); i++){
+            item = queryResultArray.getJSONObject(i);
+            if(tranferTimeFormat != null)
+                item = tranferTimeFormat.operation(item, dataInfo);
+            if(processStringToJson != null)
+                item = processStringToJson.operation(item, jsonInfo);
+            if(filter != null)
+                item = filter.operation(item, filters);
+            returnArray.add(item);
+        }
+        queryResultJson.put("Content", returnArray);
+        queryResultJson.put("Count", returnArray.size());
+        return queryResultJson;
+    }
+
+    /**
+     * get first record from query result
+     * @param queryResult query result
+     * @param tranferTimeFormat operation of tranfer info of date type
+     * @param processStringToJson operation of process string to json
+     * @param filter operation of filter info
+     * @param dataInfo parameter of tranfer info of date type
+     * @param jsonInfo parameter of process string to json
+     * @param filters parameter of filter info
+     * @return
+     * @throws Exception
+     */
+    public static JSONObject getFirstRecordfromResult(String queryResult, IJSONOperator tranferTimeFormat, IJSONOperator processStringToJson, IJSONOperator filter, String[] dataInfo, String[] jsonInfo, String... filters) throws Exception{
+        JSONObject queryResultJson = JSONObject.parseObject(queryResult);
+        if("failure".equals(queryResultJson.getString("Result")) || queryResultJson.getIntValue("Count") < 1)
+            return queryResultJson;
+        JSONArray queryResultArray = queryResultJson.getJSONArray("Content");
+        JSONObject item = queryResultArray.getJSONObject(0);
+        if(tranferTimeFormat != null)
+            item = tranferTimeFormat.operation(item, dataInfo);
+        if(processStringToJson != null)
+            item = processStringToJson.operation(item, jsonInfo);
+        if(filter != null)
+            item = filter.operation(item, filters);
+        queryResultJson.put("Item", item);
+        queryResultJson.remove("Content");
+        queryResultJson.remove("Count");
+        return queryResultJson;
+    }
+
+    /**
+     *
+     * 功能描述:处理查询返回结果,将结果中的内容项转化为JsonString
+     * @param queryResult
+     * @param majors
+     * @return
+     * @创建者 wanghailong
+     * @邮箱 wanghailong@persagy.com 
+     * @修改描述
+     */
+    public static String prossesResultToJsonString(String queryResult, String... majors){
+        if(queryResult.contains("Result") && queryResult.contains("Content")){
+            JSONObject resultJson = JSONObject.parseObject(queryResult);
+            JSONArray array = (JSONArray) resultJson.get("Content");
+            for(int i = 0 ; i < array.size() ; i++){
+                JSONObject dataJson = array.getJSONObject(i);
+                for(String major : majors){
+                    String dataString = dataJson.getString(major);
+                    if(!StringUtil.isNull(dataString)){
+                        if(dataString.startsWith("{")){
+                            dataJson.put(major, JSONObject.parseObject(dataJson.getString(major)));
+                        }else if(dataString.startsWith("[")){
+                            dataJson.put(major, JSONArray.parseArray(dataJson.getString(major)));
+                        }
+                    }
+                }
+                array.set(i, dataJson);
+            }
+            resultJson.put("Content", array);
+            queryResult = resultJson.toString();
+        }
+        return queryResult;
+    }
+
+    /**
+     *
+     * 功能描述:处理插入参数,将参数中的内容项转化为JsonString
+     * @param jsonObject
+     * @param majors
+     * @return
+     * @创建者 wanghailong
+     * @邮箱 wanghailong@persagy.com
+     * @修改描述
+     */
+    public static JSONObject prossesParamToJsonString(JSONObject jsonObject, String... majors){
+        for(String major : majors){
+            if(jsonObject.containsKey(major)){
+                jsonObject.put(major, JSON.toJSONString(jsonObject.get(major)));
+            }
+        }
+        return jsonObject;
+    }
+
+    /**
+     * 功能描述:处理查询返回结果,转换结果中Date类型的数据格式
+     * @param queryResult
+     * @param fromDateFormat
+     * @param toDateFormat
+     * @param majors
+     * @return
+     * @throws Exception
+     */
+    public static String prossesResultToDateString(String queryResult, String fromDateFormat, String toDateFormat , String... majors) throws Exception{
+        if(queryResult.contains("Result") && queryResult.contains("Content")){
+            JSONObject resultJson = JSONObject.parseObject(queryResult);
+            JSONArray array = (JSONArray) resultJson.get("Content");
+            SimpleDateFormat fsdf = new SimpleDateFormat(fromDateFormat);
+            SimpleDateFormat tsdf = new SimpleDateFormat(toDateFormat);
+            for(int i = 0 ; i < array.size() ; i++){
+                JSONObject dataJson = array.getJSONObject(i);
+                for(String major : majors){
+                    String dataString = dataJson.getString(major);
+                    if(!StringUtil.isNull(dataString)){
+                        dataJson.put(major, tsdf.format(fsdf.parse(dataString)));
+                    }
+                }
+                array.set(i, dataJson);
+            }
+            resultJson.put("Content", array);
+            queryResult = resultJson.toString();
+        }
+        return queryResult;
+    }
+
+    /**
+     *
+     * 功能描述:返回查询结果中的第一条记录
+     * @param queryResult
+     * @return
+     * @创建者 wanghailong
+     * @邮箱 wanghailong@persagy.com 
+     * @修改描述
+     */
+    public static String getFirstRecordfromResult(String queryResult){
+        if(queryResult.contains("Result") && queryResult.contains("Content")){
+            JSONObject resultJson = JSONObject.parseObject(queryResult);
+            JSONArray array = (JSONArray) resultJson.get("Content");
+            if(array.size() > 0 && null != array.get(0)) {
+                resultJson.put("Item", JSONObject.parseObject(array.get(0).toString()));
+                resultJson.remove("Content");
+                resultJson.remove("Count");
+            }
+
+            queryResult = resultJson.toString();
+        }
+        return queryResult;
+    }
+
+    /**
+     *
+     * 功能描述:返回查询结果中的第一条记录,Json格式
+     * @param queryResult
+     * @return
+     * @创建者 wanghailong
+     * @邮箱 wanghailong@persagy.com 
+     * @修改描述
+     */
+    public static JSONObject getFirstRecordfromResultWithJson(String queryResult){
+        JSONObject firstJson = null;
+        if(queryResult.contains("Result") && queryResult.contains("Content")){
+            JSONObject resultJson = JSONObject.parseObject(queryResult);
+            JSONArray array = (JSONArray) resultJson.get("Content");
+            if(array.size() > 0 && null != array.get(0)) {
+                firstJson = JSONObject.parseObject(array.get(0).toString());
+            }
+        }
+        return firstJson;
+    }
+
+    /**
+     * 排序
+     * @param queryResult
+     * @param field  排序的字段
+     * @param order      -1:倒序  1:正序
+     * @return
+     */
+    public static JSONObject sortByField(String queryResult, String field, int order){
+        JSONObject resultJson = JSONObject.parseObject(queryResult);
+        JSONArray contentArray = resultJson.getJSONArray("Content");
+        if(contentArray != null){
+            Collections.sort(contentArray, new Comparator<Object>(){
+                public int compare(Object str1, Object str2){
+                    JSONObject obj1 = JSONObject.parseObject(str1.toString());
+                    JSONObject obj2 = JSONObject.parseObject(str2.toString());
+                    if(obj1.getLongValue(field) > obj2.getLongValue(field)){
+                        return order;
+                    }
+                    if(obj1.getLongValue(field) == obj2.getLongValue(field)){
+                        return 0;
+                    }
+                    return -1 * order;
+                }
+            });
+        }
+        resultJson.put("Content", contentArray);
+        return resultJson;
+    }
+
+    /**
+     * 排序
+     * @param array
+     * @param field  排序的字段
+     * @param order      -1:倒序  1:正序
+     * @return
+     */
+    public static JSONArray sortByStringField(JSONArray array, String field, int order){
+    	if(array != null){
+    		Collections.sort(array, new Comparator<Object>(){
+    			public int compare(Object str1, Object str2){
+    				JSONObject obj1 = JSONObject.parseObject(str1.toString());
+    				JSONObject obj2 = JSONObject.parseObject(str2.toString());
+    				String order1 = obj1.getString(field);
+    				if(order1 == null) {
+    					order1 = "";
+    				}
+    				
+    				String order2 = obj2.getString(field);
+    				if(order2 == null) {
+    					order2 = "";
+    				}
+    				
+    				
+    				if(order1.compareTo(order2) > -1){
+    					return order;
+    				}
+    				return -1 * order;
+    			}
+    		});
+    	}
+    	return array;
+    }
+    
+    /**
+     * 排序
+     * @param array
+     * @param field  排序的字段
+     * @param order      -1:倒序  1:正序
+     * @return
+     */
+    public static JSONArray sortByField(JSONArray array, String field, int order){
+        if(array != null){
+            Collections.sort(array, new Comparator<Object>(){
+                public int compare(Object str1, Object str2){
+                    JSONObject obj1 = JSONObject.parseObject(str1.toString());
+                    JSONObject obj2 = JSONObject.parseObject(str2.toString());
+                    if(obj1.getLongValue(field) > obj2.getLongValue(field)){
+                        return order;
+                    }
+                    if(obj1.getLongValue(field) == obj2.getLongValue(field)){
+                        return 0;
+                    }
+                    return -1 * order;
+                }
+            });
+        }
+        return array;
+    }
+
+    /**
+     * 将List转为JSONArray
+     * @param list
+     * @return
+     */
+    public static <T> JSONArray parseJSONArray(List<T> list){
+        JSONArray array = new JSONArray();
+        for(T item : list){
+            if(!array.contains(item)){
+                array.add(item);
+            }
+        }
+        return array;
+    }
+
+    /**
+     * 去重JSONArray
+     * @param array
+     * @return
+     */
+    public static JSONArray distinctArray(JSONArray array){
+        JSONArray distinctedArray = new JSONArray();
+        Object item;
+        if(array != null) {
+            for (int i = 0; i < array.size(); i++) {
+                item = array.get(i);
+                if (!distinctedArray.contains(item)) {
+                    distinctedArray.add(item);
+                }
+            }
+        }
+        return distinctedArray;
+    }
+
+    
+    /**
+     * 
+     * Description: 在源JSONObject对象中获取目标key的值,组成新的JSONObject并返回
+     * @param sourceObj   源string对象
+     * @param keys 返回对象的key
+     * @return JSONObject 
+     * @author yuecaipu
+     * @since 2018年7月11日: 下午1:04:10
+     * Update By yuecaipu 2018年7月11日: 下午1:04:10
+     */
+    public static JSONObject getJsonObjectWithKeys(String sourceObj, String... keys) {
+    	JSONObject source = JSONObject.parseObject(sourceObj);
+    	JSONObject resultObj = getJsonObjectWithKeys(source, keys);
+		return resultObj;
+	}
+
+    /**
+     * 
+     * Description: 在源JSONObject对象中获取目标key的值,组成新的JSONObject并返回
+     * @param sourceObj 源JSONObject对象
+     * @param keys 返回对象的key
+     * @return JSONObject 
+     * @author yuecaipu
+     * @since 2018年7月11日: 下午1:07:49
+     * Update By yuecaipu 2018年7月11日: 下午1:07:49
+     */
+    public static JSONObject getJsonObjectWithKeys(JSONObject sourceObj, String... keys) {
+		JSONObject resultObj = new JSONObject();
+		for (String key : keys) {
+			if (sourceObj.containsKey(key)) {
+				resultObj.put(key, sourceObj.get(key));
+			}
+		}
+		return resultObj;
+	}
+}

+ 302 - 0
fm-sop/src/main/java/com/persagy/old/common/RedisConstant.java

@@ -0,0 +1,302 @@
+package com.persagy.old.common;
+
+public class RedisConstant {
+    /**
+     * 存储管理分区集合的key,String类型
+     * MANAGE_PARATION_LIST_KEY:[{管理分区},{管理分区}]
+     */
+    public static final String MANAGE_PARTITION_LIST_KEY="MANAGE_PARTITION_LIST";
+
+    /**
+     * 索引为5的redis库中存放不加入报表统计的表的键名
+     * 格式为String格式
+     */
+    public static final String NO_JOIN_COUNT="NO_JOIN_COUNT_PROJECT_IDS";
+    /**
+     * redis库中存所有项目名称的键
+     * 格式为Hash格式
+     */
+    public static final String ALL_PROJECT_NAMES_KEY="ALL_PROJECT_NAMES";
+    /**
+     * redis库中存所有启用状态的项目id
+     * 格式为Set格式
+     */
+    public static final String ALL_ENABLED_PROJECTIDS_KEY="ALL_ENABLED_PROJECTIDS";
+    /**
+     * redis库中存所有的项目信息
+     * 格式为Hash格式
+     */
+    public static final String ALL_PROJECTS_KEY = "ALL_PROJECTS";
+
+    /**
+     * redis库中存所有权限包信息
+     * 格式为Hash格式
+     */
+    public static final String ALL_AUTHO_PACKAGES_KEY = "ALL_AUTHO_PACKAGES";
+
+    /**
+     * redis库中存所有部门信息
+     * 格式为Hash格式
+     */
+    public static final String ALL_DEPT_KEY = "ALL_DEPTS";
+
+    /**
+     * redis库中存工单类型信息
+     * 格式为Hash格式
+     */
+    public static final String ALL_WO_FLOW_PLAN_PERSAGY_KEY = "ALL_WO_FLOW_PLAN_PERSAGY";
+
+    /**
+     * redis库中存所有岗位信息
+     * 格式为Hash格式
+     */
+    public static final String ALL_POSITIONS_KEY = "ALL_POSITIONS";
+    /**
+     * redis库中存所有岗位信息
+     * 格式为Hash格式
+     */
+    public static final String ALL_POSITIONS_DEPT_KEY = "ALL_POSITIONS_DEPT";
+    /**
+     * redis库中存所有人员基本信息的key,使用人员id作为key
+     * 格式为Hash格式
+     */
+    public static final String PERSON_CACHE_ID="PERSON_CACHE_ID";
+    /**
+     * redis库中存所有人员基本信息的key,PERSON_CACHE_USER_ID_人员id_用户id
+     * 格式为String格式
+     */
+    public static final String PERSON_CACHE_USER_ID="PERSON_CACHE_USER_ID";
+    /**
+     * redis库中存所有项目人员信息的key,使用PERSON_PROJECT_POSITION_人员id_项目id_岗位id
+     * 格式为String格式
+     */
+    public static final String PERSON_PROJECT_POSITION_PREFIX = "PERSON_PROJECT_POSITION";
+    /**
+     * redis库中存所有专业类型信息
+     * 格式为Hash格式
+     */
+    public static final String ALL_SPECIALTY_KEY = "ALL_SPECIALTY";
+
+    /**
+     * redis库中存组件关系表信息
+     * 格式为Hash格式
+     */
+    public static final String ALL_COMPONENT_RELATION_KEY = "ALL_COMPONENT_RELATION";
+
+
+    /**
+     * redis库中存信息点组件表信息
+     * 格式为Hash格式
+     */
+    public static final String ALL_INFO_COMPONENT_KEY = "ALL_INFO_COMPONENT";
+
+
+    /**
+     * redis库中存数据字典表信息
+     * 格式为Hash格式
+     */
+    public static final String ALL_GENERAL_DICTIONARY_KEY = "ALL_GENERAL_DICTIONARY";
+
+
+    /**
+     * redis库中存对象工单提醒配置表信息
+     * 格式为Hash格式
+     */
+    public static final String ALL_OBJ_WO_REMIND_CONFIG_KEY = "ALL_OBJ_WO_REMIND_CONFIG";
+
+    /**
+     * redis库中存事件订阅管理表信息
+     * 格式为Hash格式
+     */
+    public static final String ALL_EVENT_AUTHORITY_KEY = "ALL_EVENT_AUTHORITY";
+
+    /**
+     * redis库中存储所有任务类型的键
+     * 格式为Hash格式
+     */
+    public static final String ALL_TASK_TYPE_KEY = "ALL_TASK_TYPE";
+    /**
+     * redis库中存储所有任务类型名称的键
+     * 格式为Hash格式
+     */
+    public static final String ALL_TASK_TYPE_NAME_KEY = "ALL_TASK_TYPE_NAME";
+
+    /**
+     * redis库中存储所有节点类型的键
+     * 格式为Hash格式
+     */
+    public static final String ALL_NODE_TYPE_KEY = "ALL_NODE_TYPE";
+    /**
+     * redis库中存储所有节点类型名称的键
+     * 格式为Hash格式
+     */
+    public static final String ALL_NODE_TYPE_NAME_KEY = "ALL_NODE_TYPE_NAME";
+
+    /**
+     * redis库中存储所有重要级别的键
+     * 格式为Hash格式
+     */
+    public static final String ALL_URGENCY_KEY = "ALL_URGENCY";
+    /**
+     * redis库中存储所有重要级别名称的键
+     * 格式为Hash格式
+     */
+    public static final String ALL_URGENCY_NAME_KEY = "ALL_URGENCY_NAME";
+
+    /**
+     * redis库中存储所有审核流程的键
+     * 格式为Hash格式
+     */
+    public static final String ALL_AUDIT_STREAM_KEY = "ALL_AUDIT_STREAM";
+    /**
+     * redis库中存储所有审核流程名称的键
+     * 格式为Hash格式
+     */
+    public static final String ALL_AUDIT_STREAM_NAME_KEY = "ALL_AUDIT_STREAM_NAME";
+    /**
+     * redis库中存储项目计划引用集团计划个数的键
+     * 格式为Hash格式
+     */
+    public static final String ALL_QUOTE_GOUP_PLAN_NUM_KEY = "ALL_QUOTE_GOUP_PLAN_NUM";
+
+    /**
+     * redis库中存所有合同类型提醒设置表
+     * 格式为Hash格式
+     */
+    public static final String ALL_CONTRACT_TYPE_KEY = "ALL_CONTRACT_TYPE";
+    /**
+     * redis库中存所有供应商类型信息
+     * 格式为Hash格式
+     */
+    public static final String ALL_SUPPLIER_TYPE_KEY = "ALL_SUPPLIER_TYPE";
+
+    /**
+     * redis库中存所有供应商类型扩展信息
+     * 格式为Hash格式
+     */
+    public static final String ALL_SUPPLIER_TYPE_EXTEND_KEY = "ALL_SUPPLIER_TYPE_EXTEND";
+
+    /**
+     * redis库中存所有供应商信息
+     * 格式为Hash格式
+     */
+    public static final String ALL_SUPPLIER_KEY = "ALL_SUPPLIER";
+
+    /**
+     * redis库中存 信息点方案id:系统启动时会创建自定义信息点方案,创建成功会返回方案id,赋值给UNIQUE_SCHEME,创建操作只执行一次
+     * 格式为Hash格式
+     */
+    public static final String UNIQUE_SCHEME_KEY = "UNIQUE_SCHEME";
+
+    /**
+     * redis库中存所有项目、建筑功能类型缓存的Key
+     * 格式为Hash格式
+     */
+    public static final String ALL_FUNCTION_TYPES_KEY = "ALL_FUNCTION_TYPES_KEY";
+
+    /**
+     * redis库中存所有地理位置-省市区缓存类型的Key
+     * 格式为Hash格式
+     */
+    public static final String ALL_GEOGRAPHY_KEY = "ALL_GEOGRAPHY_KEY";
+
+    /**
+     * redis库中存所有用户信息,user_id为hkey
+     * 格式为Hash格式
+     */
+    public static final String ALL_USERS_KEY = "ALL_USERS";
+
+    /**
+     * redis库中存所有用户信息,hkey为用户名
+     * 格式为Hash格式
+     */
+    public static final String All_USERS_NAME_KEY = "ALL_USERS_NAME";
+    /**
+     * redis库中存所有用户密码的MD5值,user_id为hkey
+     * 格式为Hash格式
+     */
+    public static final String ALL_USERS_PASS_MD5_KEY = "ALL_USERS_PASS_MD5_KEY";
+
+    /**
+     * redis库中存权限包id最大个数的Key
+     * 格式为Hash格式
+     */
+    public static final String AUTHORIZATION_INCR_ID = "authorizationIncrId";
+
+    /**
+     * redis库中存储的所有功能点
+     */
+    public static final String ALL_FUNCTIONS_KEY = "ALL_FUNCTIONS";
+    /**
+     * redis库中存储的所有资源点
+     */
+    public static final String ALL_RESOURCES_KEY = "ALL_RESOURCES";
+    /**
+     * redis库中存储的所有功能标签KEY
+     */
+    public static final String ALL_FUNCTIONTAGS_KEY = "ALL_FUNCTIONTAGS";
+
+    /**
+     * redis库中存所有事件类型数据
+     * 格式为String格式
+     */
+    public static final String ALL_EVENT_TYPES = "ALL_EVENT_TYPES";
+
+    /**
+     * redis库中存所有事件来源数据
+     * 格式为String格式
+     */
+    public static final String ALL_EVENT_SOURCES = "ALL_EVENT_SOURCES";
+
+    /**
+     * redis库中存所有紧急程度数据
+     * 格式为String格式
+     */
+    public static final String ALL_EVENT_URGENCYS = "ALL_EVENT_URGENCYS";
+    /**
+     * redis库中存所有关闭类型数据
+     * 格式为String格式
+     */
+    public static final String ALL_EVENT_CLOSE_TYPES = "ALL_EVENT_CLOSE_TYPES";
+
+    /**
+     * redis库中存所有问题原因数据
+     * 格式为String格式
+     */
+    public static final String ALL_EVENT_ROOT_REASONS = "ALL_EVENT_ROOT_REASONS";
+
+    /**
+     * redis库中存所有问题类型数据
+     * 格式为String格式
+     */
+    public static final String ALL_EVENT_PROBLEM_TYPES = "ALL_PROBLEM_TYPES";
+
+    /**
+     * redis库中存所有问题类型树数据
+     * 格式为String格式
+     */
+    public static final String PROBLEM_TYPES_TREE = "PROBLEM_TYPES_TREE";
+    /**
+     * redis库中存数据平台中的专业-名称数据
+     * 格式为String格式
+     */
+    public static final String ALL_DOMAIN_SPECIALITY_KEY = "ALL_DOMAIN_SPECIALITY";
+    /**
+     * redis库中存数据平台中的系统类-名称数据
+     * 格式为String格式
+     */
+    public static final String ALL_SYSTEM_CLASS_KEY = "ALL_SYSTEM_CLASS";
+    /**
+     * redis库中存数据平台中的设备类-名称数据
+     * 格式为String格式
+     */
+    public static final String ALL_EQUIPMENT_CLASS_KEY = "ALL_EQUIPMENT_CLASS";
+
+
+    /**
+     * redis库中存数据平台中的图实例ID 项目id:图类型 -- 图实例ID  数据
+     * 格式为String格式
+     */
+    public static final String ALL_GRAPH_INSTANCE_KEY = "ALL_GRAPH_INSTANCE";
+
+}

+ 87 - 0
fm-sop/src/main/java/com/persagy/old/common/SopConst.java

@@ -0,0 +1,87 @@
+package com.persagy.old.common;
+
+/**
+ * 
+ * Description:   sop通用字段常数
+ * Company: Persagy 
+ * @author yuecaipu 
+ * @version 1.0
+ * @since: 2018年7月9日: 上午10:45:12
+ * Update By yuecaipu 2018年7月9日: 上午10:45:12
+ */
+public class SopConst {
+
+    //发布状态-1-正常、
+    public final static String PUBLISH_STATUS_NORMAL = "1";
+    //发布状态-2-待修订
+    public final static String PUBLISH_STATUS_REVISE = "2";
+    //发布状态-3-修订中
+    public final static String PUBLISH_STATUS_REVISEING = "3";
+    
+    //SOP状态-0-草稿
+    public final static String SOP_STATUS_DRAFT = "0";
+    //SOP状态-1-已发布
+    public final static String SOP_STATUS_PUBLISH = "1";
+    //SOP状态-2-已作废
+    public final static String SOP_STATUS_DESTROYED= "2";
+    
+    //SOP类型-1-集团(通用)
+    public final static String SOP_TYPE_GROUP = "1";
+    //SOP状态-2-项目专用
+    public final static String SOP_TYPE_PROJECT= "2";
+       
+}
+
+/**
+ * Description:    sop待修订消息表常数
+ */
+class SopReviseMsgConst {
+    
+    //对象类型-1-对象模型
+    public final static String OBJ_TYPE_MODEL = "1";
+    //对象类型-2-对象实例
+    public final static String OBJ_TYPE_EXAMPLE = "2";
+    //对象类型-3-信息点
+    public final static String OBJ_TYPE_INFO = "3";
+    
+    //状态-1-已处理
+    public final static String STATUS_RESOLVED = "1";
+    //状态-2-已忽略
+    public final static String STATUS_IGNORE = "2";
+    //状态-2-已自动处理
+    public final static String STATUS_RESOLVED_AUTO = "3";
+    
+}
+
+/**
+ * Description:    sop引用关系作废消息表常数
+ */
+class SopDestroyMsgConst {
+	
+	//状态-1-未处理
+	public final static String STATUS_NO_RESOLVED = "1";
+	//状态-2-已处理
+	public final static String STATUS_RESOLVED = "2";
+	
+}
+
+/**
+ * Description:    操作日志表
+ */
+class OperateLogConst {
+	
+	//操作类型-I-新增
+	public final static String OPERATE_TYPE_INSERT = "I";
+	//操作类型-U-更新
+	public final static String OPERATE_TYPE_UPDATE = "U";
+	//操作类型-D-删除
+	public final static String OPERATE_TYPE_DELETE = "D";
+	//操作类型-Q-查询
+	public final static String OPERATE_TYPE_QUERY = "Q";
+	
+	//操作结果-0-失败
+	public final static String OPERATE_RESULT_FAILED = "0";
+	//操作结果-1-成功
+	public final static String OPERATE_RESULT_SUCCESS = "1";
+
+}

+ 214 - 0
fm-sop/src/main/java/com/persagy/old/common/SopUtil.java

@@ -0,0 +1,214 @@
+package com.persagy.old.common;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.persagy.old.dao.DBConst;
+
+import java.util.HashMap;
+
+;
+
+public class SopUtil{
+	/**
+	 * 没有填的必填项放到lackFields集合中
+	 * @param sop
+	 * @return
+	 */
+	public static JSONArray validRequiredFields(JSONObject sop){
+		JSONArray lackFields = new JSONArray();
+		//验证user_id project_id sop_name steps 是否为空 如果为空添加到lackFields 数组中去
+		StringUtil.isNull(lackFields, sop, "user_id", "project_id", "sop_name", "steps");
+//		StringUtil.isNull(lackFields, sop, "user_id", "project_id", "sop_name", "domains", "steps");
+		
+		JSONObject fitObj, step, stepContent, contentObj, confirmResult, infoPoint, custom;
+		JSONArray fitObjs, steps, stepContents, contentObjs, confirmResults, infoPoints, customs;
+		//适用对象
+		fitObjs = sop.getJSONArray("fit_objs");
+		fitObjs = fitObjs == null ? new JSONArray() : fitObjs;
+		for(int i=0; i<fitObjs.size(); i++){
+			fitObj = fitObjs.getJSONObject(i);
+			//适用对象的obj_id obj_name obj_type 为必须传递的字段
+			StringUtil.isNull(lackFields, fitObj, "obj_id", "obj_name", "obj_type");
+		}
+		prefix(lackFields, "fit_objs", "obj_id", "obj_name", "obj_type");
+		
+		//步骤-大步
+		steps = sop.getJSONArray("steps");
+		steps = steps == null ? new JSONArray() : steps;
+		for(int i=0; i<steps.size(); i++){
+			step = steps.getJSONObject(i);
+			
+			//步骤-小步
+			stepContents = step.getJSONArray("step_content");
+			stepContents = stepContents == null ? new JSONArray() : stepContents;
+			for(int j=0; j<stepContents.size(); j++){
+				stepContent = stepContents.getJSONObject(j);
+				
+				//小步涉及到的对象
+				contentObjs = stepContent.getJSONArray("content_objs");
+				//涉及的对象的 obj_id obj_name obj_type 不能为空
+				contentObjs = contentObjs == null ? new JSONArray() : contentObjs;
+				for(int k=0; k<contentObjs.size(); k++){
+					contentObj = contentObjs.getJSONObject(k);
+					StringUtil.isNull(lackFields, contentObj, "obj_id", "obj_name", "obj_type");
+				}
+				prefix(lackFields, "content_objs", "obj_id", "obj_name", "obj_type");
+				JSONArray contents = stepContent.getJSONArray("contents");
+				contents = contents == null ? new JSONArray() : contents;
+				for (int l = 0; l < contents.size(); l++) {
+					JSONObject content = contents.getJSONObject(l);
+					//contents 的 description 不能为空
+					StringUtil.isNull(lackFields, content, "description");
+					//小步需确认的反馈信息
+					confirmResults = content.getJSONArray("confirm_result");
+					confirmResults = confirmResults == null ? new JSONArray() : confirmResults;
+					for(int k=0; k<confirmResults.size(); k++){
+						confirmResult = confirmResults.getJSONObject(k);
+						
+						//反馈信息中的信息点
+						infoPoints = confirmResult.getJSONArray("info_points");
+						infoPoints = infoPoints == null ? new JSONArray() : infoPoints;
+						for(int m=0; m<infoPoints.size(); m++){
+							infoPoint = infoPoints.getJSONObject(m);
+							//信息点 的id code name 不能为空
+							StringUtil.isNull(lackFields, infoPoint, "id", "code", "name");
+						}
+						prefix(lackFields, "info_points", "id", "code", "name");
+						
+						//反馈信息中的自定义信息
+
+						customs = confirmResult.getJSONArray("customs");
+						customs = customs == null ? new JSONArray() : customs;
+						for(int m=0; m<customs.size(); m++){
+							custom = customs.getJSONObject(m);
+							//自定义信息的 name type 不能为空
+							StringUtil.isNull(lackFields, custom, "name", "type");
+						}
+						prefix(lackFields, "customs", "name", "type");
+						//confirm_result 的 obj_id obj_name obj_type 不能为空
+						StringUtil.isNull(lackFields, confirmResult, "obj_id", "obj_name", "obj_type");
+					}
+					prefix(lackFields, "confirm_result", "obj_id", "obj_name", "obj_type");
+				}
+				//step_content 的from_sop 不能为空
+				StringUtil.isNull(lackFields, stepContent, "from_sop");
+			}
+			prefix(lackFields, "step_content", "from_sop");
+			//steps 的from_sop 不能为空
+			StringUtil.isNull(lackFields, step, "from_sop");
+		}
+		prefix(lackFields, "steps", "from_sop");
+		
+		return lackFields;
+	}
+	
+	private static void prefix(JSONArray lackFields, String prefix, String... params){
+		lackFields = lackFields == null ? new JSONArray() : lackFields;
+		for(String param : params){
+			if(lackFields.contains(param)){
+				if(!lackFields.contains(prefix + "." + param))
+					lackFields.add(prefix + "." + param);
+				lackFields.remove(param);
+			}
+		}
+	}
+	
+	/**
+	 * 获取自定义信息点code
+	 * @param code			主信息点code,异常信息点必填
+	 * @param objType		对象类型,自定义信息点必填
+	 * @param endWith		结束标志,异常信息点时有用,默认“status”
+	 * @return
+	 */
+	public static String getCtmInfoPointCode(String code, String objType, String endWith){
+		String ctmCode;
+		if(StringUtil.isNull(code)){
+			ctmCode = DBConst.ID_TAG_CTM_INFO_POINT + "_" + objType  + "_" + ToolsUtil.getUuid();
+		}else{
+			if(StringUtil.isNull(endWith)){
+				endWith = "status";
+			}
+			if(!code.startsWith(DBConst.ID_TAG_CTM_INFO_POINT)){
+				code = DBConst.ID_TAG_CTM_INFO_POINT + "_" + code;
+			}
+			ctmCode = code + "_" + endWith;
+		}
+		return ctmCode;
+	}
+
+	/**
+	 * 
+	 * Description:  合并两个sop的查询结果
+	 * @param resultStrA
+	 * @param resultStrB
+	 * @return String
+	 * @author yuecaipu
+	 * @since 2018年4月27日: 下午3:20:40
+	 * Update By yuecaipu 2018年4月27日: 下午3:20:40
+	 */
+	public static String integrateSopResult(String resultStrA, String resultStrB) {
+		JSONObject resultJsonA = JSONObject.parseObject(resultStrA);
+		JSONObject resultJsonB = JSONObject.parseObject(resultStrB);
+		JSONArray resultContentA = resultJsonA.getJSONArray("Content");
+		JSONArray resultContentB = resultJsonB.getJSONArray("Content");
+		if (resultContentA==null || resultContentA.size()==0) {
+			return resultStrB;
+		}
+		if (resultContentB==null || resultContentB.size()==0) {
+			return resultStrA;
+		}
+		resultContentA.addAll(resultContentB);
+		resultJsonA.put("Content",resultContentA);
+		return resultJsonA.toJSONString();
+	}
+	
+	 /**
+	 * Description: 获取sop所有关系对象(适用对象和步骤中的对象并集)
+	 * @param sop
+	 * @param sopObjs
+	 * @return JSONArray
+	 * @author yuecaipu
+	 * @since 2018年5月28日: 下午5:21:21
+	 * Update By yuecaipu 2018年5月28日: 下午5:21:21
+	 */
+	 
+	public static JSONArray getSopRelObjs(JSONObject sop) {
+		JSONArray sopObjs = sop.getJSONArray("fit_objs");
+		HashMap<String, Object> sopRelObjsMap = new HashMap<String, Object>();
+		for (int i = 0, length = sopObjs.size(); i < length; i++) {
+			sopRelObjsMap.put(sopObjs.getJSONObject(i).getString("obj_id"), sopObjs.getJSONObject(i));
+		}        
+		JSONArray steps = sop.getJSONArray("steps");
+		JSONObject step,stepContent,contentObj;
+		JSONArray stepContents,contentObjs;
+		String objId;
+		for (int i = 0, stepsLength = steps.size(); i < stepsLength; i++) {
+			step = steps.getJSONObject(i);
+			if (!step.getBooleanValue("from_sop")) {
+				stepContents = step.getJSONArray("step_content");
+				if (stepContents != null && stepContents.size() > 0) {
+					for (int j = 0, stepContentsLength = stepContents.size(); j < stepContentsLength; j++) {
+						stepContent = stepContents.getJSONObject(j);
+						// 工作内容中涉及的对象
+						contentObjs = stepContent.getJSONArray("content_objs");
+						if (contentObjs != null && contentObjs.size() > 0) {
+							for (int k = 0, contentObjsLength = contentObjs.size(); k < contentObjsLength; k++) {
+								contentObj = contentObjs.getJSONObject(k);
+								objId = contentObj.getString("obj_id");
+								if (!sopRelObjsMap.containsKey(objId)) {
+									sopRelObjsMap.put(objId, contentObj);
+								}
+							}
+						}
+					}
+				}
+			}
+		}
+		//sop中 适用对象和步骤中的对象
+		JSONArray sopRelObjs = new JSONArray();
+		for (Object obj : sopRelObjsMap.values()) {
+			sopRelObjs.add(obj);
+		}
+		return sopRelObjs;
+	}
+}

+ 350 - 0
fm-sop/src/main/java/com/persagy/old/common/StringUtil.java

@@ -0,0 +1,350 @@
+package com.persagy.old.common;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.persagy.old.service.BaseService;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Created by gsc on 17/5/16.
+ */
+@SuppressWarnings("unchecked")
+public class StringUtil {
+	
+	public static boolean isNull(JSONArray lackFields, JSONObject jsonObject, String... params){
+		lackFields = lackFields == null ? new JSONArray() : lackFields;
+		if(jsonObject == null)
+			return false;
+		Object value;
+		boolean flag = false;
+		for(String param : params){
+			value = jsonObject.get(param);
+			if(value instanceof JSONObject){
+				if(value == null || ((JSONObject)value).isEmpty()){
+					flag = true;
+					if(!lackFields.contains(param))
+						lackFields.add(param);
+				}
+			}else if(value instanceof JSONArray){
+				if(value == null || ((JSONArray)value).isEmpty()){
+					flag = true;
+					if(!lackFields.contains(param))
+						lackFields.add(param);
+				}
+			}else{
+				if(value == null || "".equals(JSON.toJSON(value))){
+					flag = true;
+					if(!lackFields.contains(param))
+						lackFields.add(param);
+				}
+			}
+		}
+		return flag;
+	}
+	
+	public static boolean isExist(JSONArray lackFields, JSONObject jsonObject, String... params){
+		lackFields = lackFields == null ? new JSONArray() : lackFields;
+		if(jsonObject == null)
+			return false;
+		Object value;
+		boolean flag = false;
+		for(String param : params){
+			value = jsonObject.get(param);
+			if(value instanceof JSONObject){
+				if(value == null || ((JSONObject)value).isEmpty()){
+					if(!lackFields.contains(param))
+						lackFields.add(param);
+				}else{
+					flag = true;
+				}
+			}else if(value instanceof JSONArray){
+				if(value == null || ((JSONArray)value).isEmpty()){
+					if(!lackFields.contains(param))
+						lackFields.add(param);
+				}else{
+					flag = true;
+				}
+			}else{
+				if(value == null || "".equals(JSON.toJSON(value))){
+					if(!lackFields.contains(param))
+						lackFields.add(param);
+				}else{
+					flag = true;
+				}
+			}
+		}
+		return flag;
+	}
+	
+    /**
+     * 判断String是否为null或空
+     * @param params
+     * @return
+     */
+    public static boolean isNull(String... params){
+        for(String param : params){
+            if(param == null || "".equals(param)){
+                return true;
+            }
+        }
+        return false;
+    }
+    /**
+     * 判断String是否为null或空
+     * @param params
+     * @return
+     */
+    public static boolean isNotNull(String... params){
+
+        return !isNull(params);
+    }
+    /**
+     * 判断JSONObects是否包含parmas中的字段
+     * @param jsonObject
+     * @param params
+     * @return
+     */
+    public static boolean isNull(JSONObject jsonObject, String... params){
+        for(String param : params){
+            if(isNull(jsonObject.getString(param))){
+                return true;
+            }
+        }
+        return false;
+    }
+
+    /**
+     * 判断JSONObect中时候包含parmas中字段的为空数组
+     * @param jsonObject
+     * @param params
+     * @return
+     */
+    public static boolean isEmptyList(JSONObject jsonObject, String... params){
+        JSONArray jsonArray;
+        for(String param : params){
+            jsonArray = jsonObject.getJSONArray(param);
+            if(jsonArray == null || jsonArray.isEmpty()){
+                return true;
+            }
+        }
+        return false;
+    }
+
+    /**
+     * 转换ID
+     * @param id     ID
+     * @param taget 转换目标ID标识
+     * @return
+     */
+    public static String transferId(String id, String taget, String dataPlatBasePath){
+        Map<String, String> parentIdMap = null;
+        try {
+            parentIdMap = getParentIdAndCategoryMap(id, dataPlatBasePath);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        Map<String, String> map = new HashMap<String, String>();
+       /* if(id.startsWith(CommonConst.tag_project)){
+
+        }else if(id.startsWith(CommonConst.tag_build)){
+            map.put(CommonConst.tag_project, CommonConst.tag_project+ id.substring(2, id.length()-3));
+        }else if(id.startsWith(CommonConst.tag_floor)){
+            map.put(CommonConst.tag_project, CommonConst.tag_project+id.substring(2, id.length()-6));
+            map.put(CommonConst.tag_build, CommonConst.tag_build+id.substring(2, id.length()-3));
+        }else if(id.startsWith(CommonConst.tag_space)){
+            map.put(CommonConst.tag_project, CommonConst.tag_project+id.substring(2, id.length()-9));
+            map.put(CommonConst.tag_build, CommonConst.tag_build+id.substring(2, id.length()-6));
+            map.put(CommonConst.tag_floor, CommonConst.tag_floor+id.substring(2, id.length()-3));
+        }else if(id.startsWith(CommonConst.tag_equip)){
+            map.put(CommonConst.tag_project, CommonConst.tag_project+id.substring(2, id.length()-12));
+            map.put(CommonConst.tag_build, CommonConst.tag_build+id.substring(2, id.length()-9));
+        }else if(id.startsWith(CommonConst.tag_system)){
+            map.put(CommonConst.tag_project, CommonConst.tag_project+id.substring(2, id.length()-10));
+            map.put(CommonConst.tag_build, CommonConst.tag_build+id.substring(2, id.length()-7));
+        }*/
+        if(id.startsWith(CommonConst.tag_project)){
+
+        }else if(id.startsWith(CommonConst.tag_build)){
+            map.put(CommonConst.tag_project, CommonConst.tag_project+ id.substring(2, 12));
+        }else if(id.startsWith(CommonConst.tag_floor)){
+            map.put(CommonConst.tag_project, CommonConst.tag_project+ id.substring(2, 12));
+            map.put(CommonConst.tag_build, parentIdMap.get("building"));
+        }else if(id.startsWith(CommonConst.tag_space)){
+            map.put(CommonConst.tag_project, CommonConst.tag_project+ id.substring(2, 12));
+            map.put(CommonConst.tag_build, parentIdMap.get("building"));
+            map.put(CommonConst.tag_floor, parentIdMap.get("floor"));
+        }else if(id.startsWith(CommonConst.tag_equip)){
+            map.put(CommonConst.tag_project, CommonConst.tag_project+ id.substring(2, 12));
+            map.put(CommonConst.tag_build, parentIdMap.get("building"));
+        }else if(id.startsWith(CommonConst.tag_system)){
+            map.put(CommonConst.tag_project, CommonConst.tag_project+ id.substring(2, 12));
+            map.put(CommonConst.tag_build, parentIdMap.get("building"));
+        }
+        return map.get(taget);
+    }
+    
+    /**
+     * 
+     * Description:获取同一项目下同一类型对象的关联建筑id、楼层id、设备id信息 
+     * @param ids 设备(空间、部件)id的集合,集合内容应为同一类型的id
+     * @return {"id值":{"building":"", "floor":"", "equipment":"", "category":""}}, 只有传入的id为设备和系统时,才会返回category,其值为类型码组合,如SETDLS(前两位是专业码,中间两位是系统码,后四位是设备类别码)
+     * @throws Exception Map<String,String>
+     * @author cuixubin
+     * @since 2018年5月15日: 下午6:42:17
+     * Update By cuixubin 2018年5月15日: 下午6:42:17
+     */
+    public static Map<String, Map<String, String>> getParentIds(List<String> ids, String  dataPlatBasePath) throws Exception{
+    	Map<String, Map<String, String>> resultMap = new HashMap<>();
+    	if(null == ids || ids.isEmpty()) {
+    		return resultMap;
+    	}
+    	String id = ids.get(0);
+        String projectId = "Pj" + id.substring(2, 12);
+        String requestUrl = DataRequestPathUtil.dataPlat_object_batch_query;
+        requestUrl = requestUrl.replace("BASEPATH", dataPlatBasePath);
+        if (null != projectId && !"".equals(projectId)) {
+            requestUrl = requestUrl.replace("PROJECTID", projectId);
+        }
+        
+        String buildParamStr = "{\"criterias\":[{\"id\":\"" + id + "\"}";
+        for(int i=1; i<ids.size(); i++) {
+        	buildParamStr += ",{\"id\":\"" + ids.get(i) + "\"}";
+        }
+        buildParamStr += "],\"valid\":null,\"projectId\":\""+ projectId +"\"}";
+        
+//        String result = new BaseService().httpPostRequest(requestUrl, buildParamStr);
+        String result = new BaseService().httpPostRequestDataPlatform(requestUrl, buildParamStr);
+        JSONObject resultJson = JSONObject.parseObject(result);
+        JSONArray content = (JSONArray) resultJson.get("Content");
+        if (content != null && content.size() != 0) {
+        	Map<String,String> locationMap = new HashMap<>();
+        	for(int i=0; i<content.size(); i++) {
+        		JSONObject item = content.getJSONObject(i);
+        		locationMap = (Map<String, String>) item.get("location");
+        		locationMap.put("category",(String) ((JSONObject) content.get(i)).get("category"));
+//              resultMap.put("category",(String) ((JSONObject) content.get(0)).get("category"));
+        		resultMap.put(item.getString("id"), locationMap);
+        	}
+        }
+        return resultMap;
+    }
+
+    private static Map<String,String> getParentIdAndCategoryMap(String id, String dataPlatBasePath) throws Exception{
+        String projectId = "Pj" + id.substring(2, 12);
+        String requestUrl = DataRequestPathUtil.dataPlat_object_batch_query;
+        requestUrl = requestUrl.replace("BASEPATH", dataPlatBasePath);
+        if (null != projectId && !"".equals(projectId)) {
+            requestUrl = requestUrl.replace("PROJECTID", projectId);
+        }
+        String buildParamStr = "{\"criterias\":[{\"id\":\"" + id + "\"}]}";
+        JSONObject requstParams = JSONObject.parseObject(buildParamStr);
+        requstParams.put("projectId", projectId);
+//        String result = new BaseService().httpPostRequest(requestUrl, requstParams.toString());
+        String result = new BaseService().httpPostRequestDataPlatform(requestUrl, requstParams.toString());
+
+        JSONObject resultJson = JSONObject.parseObject(result);
+        JSONArray content = (JSONArray) resultJson.get("Content");
+        Map<String, String> resultMap = new HashMap<>();
+        if (content != null) {
+            Map<String,String> locationMap = (Map<String, String>) ((JSONObject) content.get(0)).get("location");
+            resultMap.putAll(locationMap);
+            resultMap.put("category",(String) ((JSONObject) content.get(0)).get("category"));
+        }
+        return resultMap;
+    }
+
+
+
+    /**
+     * 获取设备或系统的类型
+     * @param id 设备、系统ID
+     * @Param taget 类型标识
+     * @return
+     */
+    public static String getEquipOrSystemCodeFromId(String id, String taget, String dataPlatBasePath){
+        Map<String, String> map = new HashMap<String, String>();
+     /*   if(id.startsWith(CommonConst.tag_equip)){
+            map.put(CommonConst.tag_dict_class, id.substring(15, 17));
+            map.put(CommonConst.tag_dict_equip, id.substring(17, 21));
+        }else if(id.startsWith(CommonConst.tag_system)){
+            map.put(CommonConst.tag_dict_class, id.substring(15, 17));
+            map.put(CommonConst.tag_dict_sytstem, id.substring(17, 19));
+        }*/
+        Map<String, String> parentCategoryMap = null;
+        try {
+            parentCategoryMap = getParentIdAndCategoryMap(id, dataPlatBasePath);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        String category = parentCategoryMap.get("category");
+        if (id.startsWith(CommonConst.tag_equip)) {
+            map.put(CommonConst.tag_dict_class, category == null || category.length()<6 ? null : category.substring(0, 2));
+            map.put(CommonConst.tag_dict_equip, category == null || category.length()<6  ? null : category.substring(2, 6));
+        } else if (id.startsWith(CommonConst.tag_system)) {
+            map.put(CommonConst.tag_dict_class, category == null || category.length()<4 ? null : category.substring(0, 2));
+            map.put(CommonConst.tag_dict_sytstem, category == null || category.length()<4  ? null : category.substring(2, 4));
+        }
+        return map.get(taget);
+    }
+    
+    /**
+     * 获取设备的类型
+     * @param projectId 项目id
+     * @Param ids 设备ids
+     * @return
+     */
+	public static JSONArray getEquipCodeFromEquipIds(String projectId, JSONArray ids, String dataPlatBasePath) {
+		JSONArray content = null;
+		try {
+//			Properties properties = new Properties();
+//			properties.load(StringUtil.class.getResourceAsStream("/config.properties"));
+//			String dataPlatBasePath = properties.getProperty("data.platform.basePath");
+			String requestUrl = DataRequestPathUtil.dataPlat_object_batch_query;
+			requestUrl = requestUrl.replace("BASEPATH", dataPlatBasePath);
+			if (null != projectId && !"".equals(projectId)) {
+				requestUrl = requestUrl.replace("PROJECTID", projectId);
+			}
+			JSONObject requstParams = new JSONObject();
+			requstParams.put("criterias", ids);
+			requstParams.put("projectId", projectId);
+//			String result = new BaseService().httpPostRequest(requestUrl, requstParams.toJSONString());
+			String result = new BaseService().httpPostRequestDataPlatform(requestUrl, requstParams.toJSONString());
+
+			JSONObject resultJson = JSONObject.parseObject(result);
+			content = (JSONArray) resultJson.get("Content");
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+		JSONArray equipCodes = new JSONArray();
+		if (content != null && content.size() != 0) {
+			for (int i = 0, length = content.size(); i < length; i++) {
+				JSONObject jsonObject = content.getJSONObject(i);
+				String category = jsonObject.getString("category");
+				String equipCode = category == null || category.length() < 6 ? null : category.substring(2, 6);
+				if (!equipCodes.contains(equipCode)) {
+					equipCodes.add(equipCode);
+				}
+			}
+		}
+		return equipCodes;
+	}
+    
+
+    /**
+     * 右侧补齐String长度
+     * @param str
+     * @param length
+     * @param sign
+     * @return
+     */
+    public static String completLengthFromRight(String str, int length, String sign){
+        while(str.length() < length){
+            str = str + sign;
+        }
+        return str;
+    }
+}

+ 273 - 0
fm-sop/src/main/java/com/persagy/old/common/ToolsUtil.java

@@ -0,0 +1,273 @@
+/**
+ * @包名称 com.sagacloud.common
+ * @文件名 ToolsUtil.java
+ * @创建者 wanghailong
+ * @邮箱 wanghailong@persagy.com  
+ * @修改描述 
+ */
+
+package com.persagy.old.common;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.persagy.old.dao.DBConst;
+import com.persagy.old.dao.DBConst.Result;
+import sun.misc.BASE64Encoder;
+
+import java.io.UnsupportedEncodingException;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import java.util.Comparator;
+import java.util.Map;
+import java.util.TreeMap;
+import java.util.UUID;
+import java.util.stream.Stream;
+
+
+/** 
+ * 功能描述: 常用工具方法
+ * @类型名称 ToolsUtil
+ * @创建者 wanghailong
+ * @邮箱 wanghailong@persagy.com  
+ * @修改描述 
+ */
+public class ToolsUtil {
+    //返回项-缺少必填项
+    public final static String return_error_json = "{\"Result\":\"failure\",\"ResultMsg\":\"缺少必填项\"}";
+    public static String errorJsonMsg(String msg) {
+        JSONObject jsonRes = new JSONObject();
+		jsonRes.put("Result", "failure");
+		jsonRes.put("ResultMsg", msg);
+		return jsonRes.toString();
+    }
+    public static String errorJsonMsg(JSONObject item){
+        JSONObject jsonRes = new JSONObject();
+        jsonRes.put("Result", "failure");
+        jsonRes.put("Item", item);
+        return jsonRes.toJSONString();
+    }
+    
+    public static String successJsonMsg(JSONArray array){
+        JSONObject jsonRes = new JSONObject();
+        jsonRes.put("Result", "success");
+        jsonRes.put("Content", array);
+        jsonRes.put("Count", array.size());
+        return jsonRes.toJSONString();
+    }
+
+    public static String successJsonMsg(JSONObject item){
+        JSONObject jsonRes = new JSONObject();
+        jsonRes.put("Result", "success");
+        jsonRes.put("Item", item);
+        return jsonRes.toJSONString();
+    }
+
+    public static String successJsonMsg(Object item){
+        JSONObject jsonRes = new JSONObject();
+        jsonRes.put("Result", "success");
+        jsonRes.put("Item", item);
+        return jsonRes.toJSONString();
+    }
+
+    public static String successJsonMsg(String successMsg){
+        JSONObject jsonRes = new JSONObject();
+        jsonRes.put("Result", "success");
+        jsonRes.put("ResultMsg", successMsg);
+        return jsonRes.toJSONString();
+    }
+
+
+    public static String getUuid() {
+    	String uuid = UUID.randomUUID().toString().replace("-","");
+    	return uuid;
+    }
+
+    /**
+     * 生成前缀+uuid的字符串
+     * @param prefix  --前缀字符串
+     * @return recordId --prefix+uuid(去除-)
+     */
+	public static String getRecordId(String prefix) {
+		String recordId = "";
+		if (!StringUtil.isNull(prefix)) {
+			recordId = prefix;
+		}
+		recordId = recordId + UUID.randomUUID().toString().replace("-", "");
+		return recordId;
+	}
+    /**
+     * 倒序排序
+     * @param array
+     * @return
+     */
+    public static JSONArray sortDesc(JSONArray array){
+        JSONArray newArray = new JSONArray();
+        for(int i=array.size()-1; i>-1; i--){
+            newArray.add(array.get(i));
+        }
+        return newArray;
+    }
+
+    /**
+     * 根据条件过滤数组字段
+     * @param array
+     * @param filterCondition
+     * @return
+     */
+    public static JSONArray filterRemind(JSONArray array, JSONArray filterCondition){
+        JSONArray newArray = new JSONArray();
+        JSONObject item, newItem;
+        if(array != null){
+            for(int i=0; i<array.size(); i++){
+                item = array.getJSONObject(i);
+                newItem = new JSONObject();
+                for(int j=0; j<filterCondition.size(); j++){
+                    newItem.put(filterCondition.getString(j), item.get(filterCondition.getString(j)));
+                }
+                newArray.add(newItem);
+            }
+        }
+        return newArray;
+    }
+    /**
+     * 根据条件过滤数组字段
+     * @param filterCondition
+     * @return
+     */
+    public static JSONObject filterRemind(JSONObject jsonObject, JSONArray filterCondition){
+    	JSONObject newItem = new JSONObject();
+    	if(jsonObject != null){
+			for(int j=0; j<filterCondition.size(); j++){
+				newItem.put(filterCondition.getString(j), jsonObject.get(filterCondition.getString(j)));
+			}
+    	}
+    	return newItem;
+    }
+    /**
+     * 根据条件过滤数组字段
+     * @param array
+     * @param filterConditions
+     * @return
+     */
+    public static JSONArray filterRemind(JSONArray array, String... filterConditions){
+    	JSONArray newArray = new JSONArray();
+    	JSONObject item, newItem;
+    	if(array != null){
+    		for(int i=0; i<array.size(); i++){
+    			item = array.getJSONObject(i);
+    			newItem = new JSONObject();
+    			for(String filterCondition : filterConditions){
+    				newItem.put(filterCondition, item.get(filterCondition));
+    			}
+    			newArray.add(newItem);
+    		}
+    	}
+    	return newArray;
+    }
+    /**
+     * 根据条件过滤数组字段
+     * @param queryResult
+     * @param filterConditions
+     * @return
+     */
+    public static String filterRemind(String queryResult, String... filterConditions){
+    	if(queryResult.contains(Result.RESULT) && queryResult.contains(Result.CONTENT)) {
+    		JSONObject resultJson = JSONObject.parseObject(queryResult);
+			JSONArray contents = resultJson.getJSONArray(Result.CONTENT);
+			contents = filterRemind(contents, filterConditions);
+			resultJson.put(Result.CONTENT, contents);
+			queryResult = JSON.toJSONString(resultJson);
+    	}
+    	return queryResult;
+    }
+    /**
+     * 根据条件过滤数组字段
+     * @param queryResult
+     * @param filterCondition
+     * @return
+     */
+    public static String filterRemind(String queryResult, JSONArray filterCondition){
+    	if(queryResult.contains(DBConst.Result.RESULT) && queryResult.contains(Result.CONTENT)) {
+    		JSONObject resultJson = JSONObject.parseObject(queryResult);
+    		JSONArray contents = resultJson.getJSONArray(Result.CONTENT);
+    		contents = filterRemind(contents, filterCondition);
+    		resultJson.put(Result.CONTENT, contents);
+    		queryResult = JSON.toJSONString(resultJson);
+    	}
+    	return queryResult;
+    }
+
+    /**
+     * MD5加密
+     * @param str
+     * @return
+     * @throws NoSuchAlgorithmException
+     * @throws UnsupportedEncodingException
+     */
+    public static String encodeByMd5(String str) throws NoSuchAlgorithmException, UnsupportedEncodingException {
+        //确定计算方法
+        MessageDigest md5= MessageDigest.getInstance("MD5");
+        BASE64Encoder base64en = new BASE64Encoder();
+        //加密后的字符串
+        String newstr=base64en.encode(md5.digest(str.getBytes("utf-8")));
+        return newstr;
+    }
+    
+    /**
+     * 根据map的value排序 倒序
+     * @param map
+     * @param <K>
+     * @return
+     */
+    public static <K> JSONArray sortMapByValue(Map<K, Integer> map){
+        JSONArray array = new JSONArray();
+        Stream<Map.Entry<K, Integer>> stream = map.entrySet().stream();
+        stream.sorted(Comparator.comparing(e -> Integer.valueOf(e.getValue()) * -1)).forEach(e -> array.add(e.getKey()));
+        return array;
+    }
+    
+    
+    /**
+     * 
+     * Description: ZillionAgent返回结果是否成功
+     * @param resultStr
+     * @return boolean
+     * @author yuecaipu
+     * @since 2018年7月9日: 下午12:20:22
+     * Update By yuecaipu 2018年7月9日: 下午12:20:22
+     */
+    public static boolean isSuccessForResult(String resultStr) {
+		JSONObject resultJson = JSONObject.parseObject(resultStr);
+		return isSuccessForResult(resultJson);
+	}
+
+    public static boolean isSuccessForResult(JSONObject resultJson) {
+		String result = resultJson.getString(Result.RESULT);
+		if (Result.SUCCESS.equals(result)) {
+			return true;
+		}
+		return false;
+	}
+    
+    
+	/**
+	 * Description: 获取一个key升序排序的map
+	 * @return Map<String,JSONArray>
+	 * @author yuecaipu
+	 * @since 2018年7月26日: 下午1:35:01
+	 * Update By yuecaipu 2018年7月26日: 下午1:35:01
+	 */
+	public static Map<String, JSONArray> getAscMap(){
+		 Map<String, JSONArray> map = new TreeMap<String, JSONArray>(
+	                new Comparator<String>() {
+	                    public int compare(String obj1, String obj2) {
+	                        // 升序排序
+	                    	Integer order1 = Integer.valueOf(obj1);
+	                    	Integer order2 = Integer.valueOf(obj2);
+	                        return order1.compareTo(order2);
+	                    }
+	                });
+		 return map;
+	}
+ }

+ 106 - 0
fm-sop/src/main/java/com/persagy/old/common/Tree.java

@@ -0,0 +1,106 @@
+package com.persagy.old.common;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 
+ * Description:  递归封装树形结构
+ * Company: Persagy 
+ * @author yuecaipu 
+ * @version 1.0
+ * @since: 2018年11月19日: 上午11:17:34
+ * Update By yuecaipu 2018年11月19日: 上午11:17:34
+ */
+public class Tree {
+    List<TreeNode> nodes = new ArrayList<TreeNode>();
+ 
+    public Tree(List<TreeNode> nodes) {
+        super();
+        this.nodes = nodes;
+    }
+ 
+    /**
+     * 构建树形结构
+     *
+     * @return
+     */
+    public List<TreeNode> buildTree() {
+        List<TreeNode> treeNodes = new ArrayList<TreeNode>();
+        List<TreeNode> rootNodes = getRootNodes();
+        for (TreeNode rootNode : rootNodes) {
+            buildChildNodes(rootNode);
+            treeNodes.add(rootNode);
+        }
+        return treeNodes;
+    }
+ 
+    /**
+     * 递归子节点
+     *
+     * @param node
+     */
+    public void buildChildNodes(TreeNode node) {
+        List<TreeNode> children = getChildNodes(node);
+        if (!children.isEmpty()) {
+            for (TreeNode child : children) {
+                buildChildNodes(child);
+            }
+            node.setChildren(children);
+        }
+    }
+ 
+    /**
+     * 获取父节点下所有的子节点
+     *
+     * @param nodes
+     * @param pnode
+     * @return
+     */
+    public List<TreeNode> getChildNodes(TreeNode pnode) {
+        List<TreeNode> childNodes = new ArrayList<TreeNode>();
+        for (TreeNode n : nodes) {
+            if (pnode.getKey().equals(n.getParentId())) {
+                childNodes.add(n);
+            }
+        }
+        return childNodes;
+    }
+ 
+    /**
+     * 判断是否为根节点
+     *
+     * @param nodes
+     * @param inNode
+     * @return
+     */
+    public boolean rootNode(TreeNode node) {
+        boolean isRootNode = true;
+        if (node.getParentId()==null) {
+			return isRootNode;
+		}
+        for (TreeNode n : nodes) {
+            if (node.getParentId().equals(n.getKey())) {
+                isRootNode = false;
+                break;
+            }
+        }
+        return isRootNode;
+    }
+ 
+    /**
+     * 获取集合中所有的根节点
+     *
+     * @param nodes
+     * @return
+     */
+    public List<TreeNode> getRootNodes() {
+        List<TreeNode> rootNodes = new ArrayList<TreeNode>();
+        for (TreeNode n : nodes) {
+            if (rootNode(n)) {
+                rootNodes.add(n);
+            }
+        }
+        return rootNodes;
+    }
+}

+ 140 - 0
fm-sop/src/main/java/com/persagy/old/common/TreeNode.java

@@ -0,0 +1,140 @@
+package com.persagy.old.common;
+
+import java.util.List;
+
+public class TreeNode {
+	private String key;
+	private String name;
+	private String serial;
+	private String parentId;
+	private List<TreeNode> children;
+	
+	/**
+	* @return the key
+	*/
+	
+	public String getKey() {
+		return key;
+	}
+	
+	/**
+	* @param key the key to set
+	*/
+	
+	public void setKey(String key) {
+		this.key = key;
+	}
+	
+	/**
+	* @return the name
+	*/
+	
+	public String getName() {
+		return name;
+	}
+	
+	/**
+	* @param name the name to set
+	*/
+	
+	public void setName(String name) {
+		this.name = name;
+	}
+	
+	/**
+	* @return the serial
+	*/
+	
+	public String getSerial() {
+		return serial;
+	}
+	
+	/**
+	* @param serial the serial to set
+	*/
+	
+	public void setSerial(String serial) {
+		this.serial = serial;
+	}
+	
+	/**
+	* @return the parentId
+	*/
+	
+	public String getParentId() {
+		return parentId;
+	}
+	
+	/**
+	* @param parentId the parentId to set
+	*/
+	
+	public void setParentId(String parentId) {
+		this.parentId = parentId;
+	}
+	
+	/**
+	* @return the children
+	*/
+	
+	public List<TreeNode> getChildren() {
+		return children;
+	}
+	
+	/**
+	* @param children the children to set
+	*/
+	
+	public void setChildren(List<TreeNode> children) {
+		this.children = children;
+	}
+
+	
+	 
+	 /**
+	 *(non-Javadoc)
+	 * @see Object#toString()
+	 */
+
+	@Override
+	public String toString() {
+		return "TreeNode [key=" + key + ", name=" + name + ", serial=" + serial + ", parentId=" + parentId + ", children=" + children + "]";
+	}
+
+	/**
+	 *(non-Javadoc)
+	 * @see Object#hashCode()
+	 */
+
+	@Override
+	public int hashCode() {
+		final int prime = 31;
+		int result = 1;
+		result = prime * result + ((key == null) ? 0 : key.hashCode());
+		return result;
+	}
+
+
+	 /**
+	 *(non-Javadoc)
+	 * @see Object#equals(Object)
+	 */
+	 
+	@Override
+	public boolean equals(Object obj) {
+		if (this == obj)
+			return true;
+		if (obj == null)
+			return false;
+		if (getClass() != obj.getClass())
+			return false;
+		TreeNode other = (TreeNode) obj;
+		if (key == null) {
+			if (other.key != null)
+				return false;
+		} else if (!key.equals(other.key))
+			return false;
+		return true;
+	}
+	
+}

+ 78 - 0
fm-sop/src/main/java/com/persagy/old/common/enums/ObjectLevel.java

@@ -0,0 +1,78 @@
+package com.persagy.old.common.enums;
+/**
+ * 
+ * Description:   对象类型排序优先级 ,数字越大等级越高
+ * Company: Persagy 
+ * @author yuecaipu 
+ * @version 1.0
+ * @since: 2018年11月22日: 下午8:07:14
+ * Update By yuecaipu 2018年11月22日: 下午8:07:14
+ */
+public enum ObjectLevel {
+
+	BUILD("Bd", 6),
+
+	SYSTEM("Sy", 5),
+
+	SHAFT("Sh", 4),
+
+	FLOOR("Fl", 3),
+
+	SPACE("Sp", 2),
+
+	EQUIP("Eq", 1);
+
+	private Integer level;
+
+	private String idPre;
+
+	private ObjectLevel(String idPre, Integer level) {
+		this.idPre = idPre;
+		this.level = level;
+	}
+
+	// 根据对象id获取对应的等级
+	public static Integer getLevel(String objId) {
+		for (ObjectLevel c : ObjectLevel.values()) {
+			if (objId.startsWith(c.getIdPre())) {
+				return c.getLevel();
+			}
+		}
+		return -1;
+	}
+
+	/**
+	 * @return the level
+	 */
+
+	public Integer getLevel() {
+		return level;
+	}
+
+	/**
+	 * @param level
+	 *            the level to set
+	 */
+
+	public void setLevel(Integer level) {
+		this.level = level;
+	}
+
+	/**
+	 * @return the idPre
+	 */
+
+	public String getIdPre() {
+		return idPre;
+	}
+
+	/**
+	 * @param idPre
+	 *            the idPre to set
+	 */
+
+	public void setIdPre(String idPre) {
+		this.idPre = idPre;
+	}
+
+}

+ 435 - 0
fm-sop/src/main/java/com/persagy/old/config/RedisConfig.java

@@ -0,0 +1,435 @@
+package com.persagy.old.config;
+
+
+import org.apache.commons.pool2.impl.GenericObjectPoolConfig;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.data.redis.connection.RedisNode;
+import org.springframework.data.redis.connection.RedisPassword;
+import org.springframework.data.redis.connection.RedisSentinelConfiguration;
+import org.springframework.data.redis.connection.RedisStandaloneConfiguration;
+import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory;
+import org.springframework.data.redis.connection.lettuce.LettucePoolingClientConfiguration;
+import org.springframework.data.redis.core.RedisTemplate;
+import org.springframework.data.redis.serializer.StringRedisSerializer;
+import org.springframework.util.StringUtils;
+
+import java.util.HashSet;
+import java.util.Set;
+
+//被@RefreshScope修饰的Bean都是延迟加载的,只有在第一次访问时才会被初始化,刷新Bean也是同理,下次访问时会创建一个信息的对象
+//@RefreshScope //这里不能省略  不然不能手动触发
+@Configuration
+public class RedisConfig {
+
+    /**
+     * 主机地址
+     */
+    @Value("${spring.redis.host}")
+    private String springRedisHost;
+
+    /**
+     * 端口号
+     */
+    @Value("${spring.redis.port}")
+    private Integer springRedisPort;
+
+//	@Value("${spring.redis.timeout}")
+//	private Integer springRedisTimeout;
+
+    /**
+     * 密码(如果有的话)
+     */
+//    @Value("${spring.redis.password}")
+//    private String springRedisPassword;
+
+    /**
+     * 密码-单机(如果有的话)
+     */
+    @Value("${spring.redis.password.standalone}")
+    private String springRedisPasswordStandalone;
+
+    /**
+     * 密码-哨兵(如果有的话)
+     */
+    @Value("${spring.redis.password.sentinel}")
+    private String springRedisPasswordSentinel;
+
+    /**
+     * 置连接池中最大允许的空闲连接  建议maxidle与maxTotal一样
+     */
+    @Value("${spring.redis.pool.max-idle}")
+    private Integer springRedisPoolMaxIdle;
+
+    /**
+     * 设置连接池中最小允许的连接数
+     */
+    @Value("${spring.redis.pool.min-idle}")
+    private Integer springRedisPoolMinIdle;
+
+    /**
+     *  没有获取资源时最长等待1秒,1秒后还没有的话就报错
+     */
+    @Value("${spring.redis.pool.max-wait}")
+    private Integer springRedisPoolMaxWait;
+
+    /**
+     *  设置连接池中最大活跃连接
+     */
+    @Value("${spring.redis.pool.max-active}")
+    private Integer springRedisPoolMaxActive;
+
+
+    @Value("${spring.redis.database.zero}")
+    private Integer springRedisDatabaseZero;
+
+    @Value("${spring.redis.database.one}")
+    private Integer springRedisDatabaseOne;
+
+    @Value("${spring.redis.database.two}")
+    private Integer springRedisDatabaseTwo;
+
+    @Value("${spring.redis.database.three}")
+    private Integer springRedisDatabaseThree;
+
+    @Value("${spring.redis.database.four}")
+    private Integer springRedisDatabaseFour;
+
+    @Value("${spring.redis.database.five}")
+    private Integer springRedisDatabaseFive;
+
+    @Value("${spring.redis.database.six}")
+    private Integer springRedisDatabaseSix;
+
+    @Value("${spring.redis.database.seven}")
+    private Integer springRedisDatabaseSeven;
+
+    @Value("${spring.redis.database.eight}")
+    private Integer springRedisDatabaseEight;
+
+    @Value("${spring.redis.database.nine}")
+    private Integer springRedisDatabaseNine;
+
+    @Value("${spring.redis.database.ten}")
+    private Integer springRedisDatabaseTen;
+
+    @Value("${spring.redis.database.eleven}")
+    private Integer springRedisDatabaseEleven;
+
+    @Value("${spring.redis.database.fifteen}")
+    private Integer springRedisDatabaseFifteen;
+
+    /**
+     * 哨兵集群名称
+     */
+    @Value("${spring.redis.sentinel.master}")
+    private String springRedisSentinelMaster;
+
+    /**
+     * 哨兵集群节点地址
+     */
+    @Value("${spring.redis.sentinel.nodes}")
+    private String springRedisSentinelNodes;
+
+    @Value("${spring.redis.use.cluster}")
+    private Boolean redisUseCluster;
+
+
+
+
+
+
+
+
+
+    /**
+     *
+     *<p>Description: 运维平台:使用索引为0的Redis库 .</p>
+     *<p>@return RedisTemplate<String,Object>
+     *@since 2019年5月10日: 下午5:14:20
+     *@author gezhanbin
+     *@version 1.0
+     */
+    @Bean
+    public RedisTemplate<String, String> emsRedisTemplate() {
+        RedisTemplate<String, String> template = new RedisTemplate<String, String>();
+        template.setConnectionFactory(redisConnectionFactory(springRedisDatabaseZero));
+        template.setDefaultSerializer(new StringRedisSerializer());
+        return template;
+    }
+
+    /**
+     *
+     *<p>Description: saas:使用索引为1的Redis库 .</p>
+     *<p>@return RedisTemplate<String,Object>
+     *@since 2019年5月10日: 下午5:18:27
+     *@author gezhanbin
+     *@version 1.0
+     */
+    @Bean
+    public RedisTemplate<String, Object> saasRedisTemplate() {
+        RedisTemplate<String, Object> template = new RedisTemplate<String, Object>();
+        template.setConnectionFactory(redisConnectionFactory(springRedisDatabaseOne));
+        template.setDefaultSerializer(new StringRedisSerializer());
+        return template;
+    }
+
+    /**
+     *
+     *<p>Description:  workorder:使用索引为2的Redis库.</p>
+     *<p>@return RedisTemplate<String,Object>
+     *@since 2019年5月10日: 下午5:19:56
+     *@author gezhanbin
+     *@version 1.0
+     */
+    @Bean
+    public RedisTemplate<String, Object> workOrderRedisTemplate() {
+        RedisTemplate<String, Object> template = new RedisTemplate<String, Object>();
+        template.setConnectionFactory(redisConnectionFactory(springRedisDatabaseTwo));
+        template.setDefaultSerializer(new StringRedisSerializer());
+        return template;
+    }
+
+    /**
+     *
+     *<p>Description: 人员服务:使用索引为3的Redis库 .</p>
+     *<p>@return RedisTemplate<String,Object>
+     *@since 2019年5月10日: 下午5:20:23
+     *@author gezhanbin
+     *@version 1.0
+     */
+    @Bean
+    public RedisTemplate<String, Object> personServiceRedisTemplate() {
+        RedisTemplate<String, Object> template = new RedisTemplate<String, Object>();
+        template.setConnectionFactory(redisConnectionFactory(springRedisDatabaseThree));
+        template.setDefaultSerializer(new StringRedisSerializer());
+        return template;
+    }
+
+    /**
+     *<p>Description: 事件管理:使用索引为4的Redis库 .</p>
+     *<p>@return RedisTemplate<String,Object>
+     *@since 2019年5月10日: 下午5:23:09
+     *@author gezhanbin
+     *@version 1.0
+     */
+    @Bean
+    public RedisTemplate<String, Object> eventMgRedisTemplate() {
+        RedisTemplate<String, Object> template = new RedisTemplate<String, Object>();
+        template.setConnectionFactory(redisConnectionFactory(springRedisDatabaseFour));
+        template.setDefaultSerializer(new StringRedisSerializer());
+        return template;
+    }
+
+    /**
+     *
+     *<p>Description:  报表缓存:使用索引为5的Redis库.</p>
+     *<p>@return RedisTemplate<String,Object>
+     *@since 2019年5月10日: 下午5:26:24
+     *@author gezhanbin
+     *@version 1.0
+     */
+    @Bean
+    public RedisTemplate<String, Object> customRedisTemplate() {
+        RedisTemplate<String, Object> template = new RedisTemplate<String, Object>();
+        template.setConnectionFactory(redisConnectionFactory(springRedisDatabaseFive));
+        template.setDefaultSerializer(new StringRedisSerializer());
+        return template;
+    }
+
+    /**
+     *
+     *<p>Description:  数据平台:使用索引为 6 的Redis库 .</p>
+     *<p>@return RedisTemplate<String,Object>
+     *@since 2019年7月10日: 上午9:18:06
+     *@author gezhanbin
+     *@version 1.0
+     */
+    @Bean
+    public RedisTemplate<String, Object> dataPlatformRedisTemplate() {
+        RedisTemplate<String, Object> template = new RedisTemplate<String, Object>();
+        template.setConnectionFactory(redisConnectionFactory(springRedisDatabaseSix));
+        template.setDefaultSerializer(new StringRedisSerializer());
+        return template;
+    }
+
+    /**
+     *
+     *<p>Description:  抢单信息缓存:使用索引为10的Redis库.</p>
+     *<p>@return RedisTemplate<String,Object>
+     *@since 2019年5月10日: 下午5:26:51
+     *@author gezhanbin
+     *@version 1.0
+     */
+    @Bean
+    public RedisTemplate<String, Object> robbingRedisTemplate() {
+        RedisTemplate<String, Object> template = new RedisTemplate<String, Object>();
+        template.setConnectionFactory(redisConnectionFactory(springRedisDatabaseTen));
+        template.setDefaultSerializer(new StringRedisSerializer());
+        return template;
+    }
+
+    @Bean
+    public RedisTemplate<String, Object> taskRedisTemplate() {
+        RedisTemplate<String, Object> template = new RedisTemplate<String, Object>();
+        template.setConnectionFactory(redisConnectionFactory(springRedisDatabaseEleven));
+        template.setDefaultSerializer(new StringRedisSerializer());
+        return template;
+    }
+
+    /**
+     *
+     *<p>Description: 访问量统计:使用索引为15的Redis库 .</p>
+     *<p>@return RedisTemplate<String,Object>
+     *@since 2019年5月10日: 下午5:27:24
+     *@author gezhanbin
+     *@version 1.0
+     */
+    @Bean
+    public RedisTemplate<String, Object> pageViewRedisTemplate() {
+        RedisTemplate<String, Object> template = new RedisTemplate<String, Object>();
+        template.setConnectionFactory(redisConnectionFactory(springRedisDatabaseFifteen));
+        template.setDefaultSerializer(new StringRedisSerializer());
+        return template;
+    }
+
+
+
+
+
+
+
+    /**
+     *
+     *<p>Description:  redis连接工厂 .</p>
+     *<p>@param index redis库的索引
+     *<p>@return RedisConnectionFactory
+     *@since 2019年5月10日: 下午4:49:24
+     *@author gezhanbin
+     *@version 1.0
+     */
+    private LettuceConnectionFactory redisConnectionFactory(int index) {
+        LettuceConnectionFactory redisConnectionFactory = null;
+        if(redisUseCluster) {
+            redisConnectionFactory = new LettuceConnectionFactory(redisSentinelConfiguration(index), jedisClientConfiguration());
+        } else {
+            redisConnectionFactory = new LettuceConnectionFactory(redisStandaloneConfiguration(index), jedisClientConfiguration());
+        }
+        redisConnectionFactory.afterPropertiesSet();
+        return redisConnectionFactory;
+    }
+
+
+    /**
+     *
+     *<p>Description:  jedis 客户端 连接池配置.</p>
+     *<p>@return JedisClientConfiguration
+     *@since 2019年5月10日: 下午4:47:59
+     *@author gezhanbin
+     *@version 1.0
+     */
+    private LettucePoolingClientConfiguration jedisClientConfiguration() {
+//		LettuceClientConfiguration.LettuceClientConfigurationBuilder builder = LettuceClientConfiguration.builder();
+//		JedisClientConfiguration.JedisPoolingClientConfigurationBuilder jedisPoolingClientConfigurationBuilder = builder.usePooling();
+//		jedisPoolingClientConfigurationBuilder.poolConfig(jedisPoolConfig());
+//		return builder.build();
+        return LettucePoolingClientConfiguration.builder().poolConfig(jedisPoolConfig()).build();
+    }
+
+    /**
+     *
+     *<p>Description: jedis 连接池配置 .</p>
+     *<p>@return JedisPoolConfig
+     *@since 2019年5月10日: 下午4:34:33
+     *@author gezhanbin
+     *@version 1.0
+     */
+    private GenericObjectPoolConfig jedisPoolConfig() {
+//		JedisPoolConfig jedisPoolConfig = new JedisPoolConfig();
+//		jedisPoolConfig.setMaxIdle(springRedisPoolMaxIdle);
+//		jedisPoolConfig.setMinIdle(springRedisPoolMinIdle);
+//		jedisPoolConfig.setMaxTotal(springRedisPoolMaxActive);
+//		jedisPoolConfig.setMaxWaitMillis(springRedisPoolMaxWait);
+//		return jedisPoolConfig;
+
+        GenericObjectPoolConfig poolConfig = new GenericObjectPoolConfig();
+
+        poolConfig.setMinIdle(springRedisPoolMinIdle);
+        poolConfig.setMaxIdle(springRedisPoolMaxIdle);
+        poolConfig.setMaxTotal(springRedisPoolMaxActive);
+        poolConfig.setMaxWaitMillis(springRedisPoolMaxWait);
+        return poolConfig;
+    }
+
+
+
+    /**
+     *
+     *<p>Description:  哨兵模式的redis配置.</p>
+     *<p>@param index
+     *<p>@return RedisSentinelConfiguration
+     *@since 2019年5月10日: 下午4:20:43
+     *@author gezhanbin
+     *@version 1.0
+     */
+    private RedisSentinelConfiguration redisSentinelConfiguration(int index) {
+        RedisSentinelConfiguration redisSentinelConfiguration = new RedisSentinelConfiguration();
+        redisSentinelConfiguration.setDatabase(index);
+        redisSentinelConfiguration.setMaster(springRedisSentinelMaster);
+        //配置redis的哨兵sentinel
+        String[] hosts = StringUtils.delimitedListToStringArray(springRedisSentinelNodes,",");
+        Set<RedisNode> redisNodeSet = new HashSet<RedisNode>();
+        for(String redisHost : hosts){
+            String[] item = redisHost.split(":");
+            String ip = item[0];
+            String port = item[1];
+            redisNodeSet.add(new RedisNode(ip, Integer.parseInt(port)));
+        }
+        redisSentinelConfiguration.setSentinels(redisNodeSet);
+        if(!StringUtils.isEmpty(springRedisPasswordSentinel)) {
+            redisSentinelConfiguration.setPassword(redisPasswordSentinel());
+        }
+        return redisSentinelConfiguration;
+    }
+
+
+    /**
+     *
+     *<p>Description:  单机模式的redis配置 .</p>
+     *<p>@param index  redis库的索引
+     *<p>@return RedisStandaloneConfiguration
+     *@since 2019年5月10日: 下午4:05:20
+     *@author gezhanbin
+     *@version 1.0
+     */
+    private RedisStandaloneConfiguration redisStandaloneConfiguration(int index) {
+        RedisStandaloneConfiguration redisStandaloneConfiguration = new RedisStandaloneConfiguration();
+        redisStandaloneConfiguration.setDatabase(index);
+        redisStandaloneConfiguration.setHostName(springRedisHost);
+        redisStandaloneConfiguration.setPort(springRedisPort);
+        if(!StringUtils.isEmpty(springRedisPasswordStandalone)) {
+            redisStandaloneConfiguration.setPassword(redisPasswordStandalone());
+        }
+        return redisStandaloneConfiguration;
+    }
+
+
+    /**
+     *
+     *<p>Description:  redis的访问密码.</p>
+     *<p>@return RedisPassword
+     *@since 2019年5月10日: 下午4:02:48
+     *@author gezhanbin
+     *@version 1.0
+     */
+//    private RedisPassword redisPassword() {
+//        return RedisPassword.of(springRedisPasswordSentinel);
+//    }
+    private RedisPassword redisPasswordSentinel() {
+        return RedisPassword.of(springRedisPasswordSentinel);
+    }
+    private RedisPassword redisPasswordStandalone() {
+        return RedisPassword.of(springRedisPasswordStandalone);
+    }
+}

+ 31 - 0
fm-sop/src/main/java/com/persagy/old/config/Schema.java

@@ -0,0 +1,31 @@
+package com.persagy.old.config;
+
+import com.persagy.old.dao.DBConst;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+//被@RefreshScope修饰的Bean都是延迟加载的,只有在第一次访问时才会被初始化,刷新Bean也是同理,下次访问时会创建一个信息的对象
+//@RefreshScope //这里不能省略  不然不能手动触发
+@Component
+public class Schema {
+	
+	@Value("${database.name.physicalworld}")
+	public void setPhysicalWorld(String physicalWorld) {
+		DBConst.DATABASE_WORLD_NAME = physicalWorld;
+	}
+	
+	@Value("${database.name.saas}")
+	public void setSaas(String saas) {
+		DBConst.DATABASE_SAAS_NAME = saas;
+	}
+	
+	@Value("${database.name.sop}")
+	public void setSop(String sop) {
+		DBConst.DATABASE_NAME = sop;
+	}
+	
+	@Value("${database.name.workorder}")
+	public void setWokorder(String workorder) {
+		DBConst.DATABASE_WORK_ORDER = workorder;
+	}
+}

+ 137 - 0
fm-sop/src/main/java/com/persagy/old/dao/DBAgent.java

@@ -0,0 +1,137 @@
+package com.persagy.old.dao;
+
+import com.zillion.database.agent.ZillionAgent;
+import org.apache.hadoop.conf.Configuration;
+
+public class DBAgent {
+    public static ZillionAgent agent;
+
+    public static ZillionAgent GetAgent() {
+        if (agent == null) {
+            try {
+                Configuration configuration = new Configuration();
+                configuration.set("hbase.cluster.distributed", "true");
+                // InputStream in = new
+                // ClassPathResource("/hbase-site.xml").getInputStream();
+                // configuration.addResource(in);
+                configuration.set("dfs.replication", dfsReplication);
+                configuration.set("hbase.rootdir", hbaseRootdir);
+                configuration.set("hbase.cluster.distributed", hbaseClusterDistributed);
+                configuration.set("hbase.zookeeper.quorum", hbaseZookeeperQuorum);
+                configuration.set("hbase.zookeeper.property.dataDir", hbaseZookeeperPropertyDataDir);
+
+                configuration.set("minor_db.enable", minor_dbEnable);
+                configuration.set("minor_db.c3p0.jdbcUrl", minor_dbJdbcUrl);
+                configuration.set("minor_db.c3p0.user", minor_user);
+                configuration.set("minor_db.c3p0.password", minor_password);
+                configuration.set("minor_db.c3p0.acquireIncrement", minor_acquireIncrement);
+                configuration.set("minor_db.c3p0.idleConnectionTestPeriod", minor_idleConnectionTestPeriod);
+                configuration.set("minor_db.c3p0.initialPoolSize", minor_initialPoolSize);
+                configuration.set("minor_db.c3p0.maxIdleTime", minor_maxIdleTime);
+                configuration.set("minor_db.c3p0.maxPoolSize", minor_maxPoolSize);
+                configuration.set("minor_db.c3p0.maxStatements", minor_maxStatements);
+                configuration.set("minor_db.c3p0.minPoolSize", minor_minPoolSize);
+                configuration.set("hbase.table.sanity.checks", hbaseTableSanityChecks);
+
+                agent = new ZillionAgent(configuration, "sop");
+                agent.Start();
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        }
+        return agent;
+    }
+
+    // hbase
+    private static String hbaseZookeeperQuorum;
+    private static String dfsReplication;
+    private static String hbaseRootdir;
+    private static String hbaseClusterDistributed;
+    private static String hbaseZookeeperPropertyDataDir;
+
+    // mysql
+    private static String minor_dbEnable;
+    private static String minor_dbJdbcUrl;
+    private static String minor_user;
+    private static String minor_password;
+    private static String minor_acquireIncrement;
+    private static String minor_idleConnectionTestPeriod;
+    private static String minor_initialPoolSize;
+    private static String minor_maxIdleTime;
+    private static String minor_maxPoolSize;
+    private static String minor_maxStatements;
+    private static String minor_minPoolSize;
+    private static String hbaseTableSanityChecks;
+
+
+    public static void setMinor_dbEnable(String minor_dbEnable) {
+        DBAgent.minor_dbEnable = minor_dbEnable;
+    }
+
+    public static void setMinor_dbJdbcUrl(String minor_dbJdbcUrl) {
+        DBAgent.minor_dbJdbcUrl = minor_dbJdbcUrl;
+    }
+
+    public static void setMinor_user(String minor_user) {
+        DBAgent.minor_user = minor_user;
+    }
+
+    public static void setMinor_password(String minor_password) {
+        DBAgent.minor_password = minor_password;
+    }
+
+    public static void setMinor_acquireIncrement(String minor_acquireIncrement) {
+        DBAgent.minor_acquireIncrement = minor_acquireIncrement;
+    }
+
+    public static void setMinor_idleConnectionTestPeriod(String minor_idleConnectionTestPeriod) {
+        DBAgent.minor_idleConnectionTestPeriod = minor_idleConnectionTestPeriod;
+    }
+
+    public static void setMinor_initialPoolSize(String minor_initialPoolSize) {
+        DBAgent.minor_initialPoolSize = minor_initialPoolSize;
+    }
+
+    public static void setMinor_maxIdleTime(String minor_maxIdleTime) {
+        DBAgent.minor_maxIdleTime = minor_maxIdleTime;
+    }
+
+    public static void setMinor_maxPoolSize(String minor_maxPoolSize) {
+        DBAgent.minor_maxPoolSize = minor_maxPoolSize;
+    }
+
+    public static void setMinor_maxStatements(String minor_maxStatements) {
+        DBAgent.minor_maxStatements = minor_maxStatements;
+    }
+
+    public static void setMinor_minPoolSize(String minor_minPoolSize) {
+        DBAgent.minor_minPoolSize = minor_minPoolSize;
+    }
+
+    public static void setHbaseTableSanityChecks(String hbaseTableSanityChecks) {
+        DBAgent.hbaseTableSanityChecks = hbaseTableSanityChecks;
+    }
+
+    public static void setHbaseZookeeperQuorum(String hbaseZookeeperQuorum) {
+        DBAgent.hbaseZookeeperQuorum = hbaseZookeeperQuorum;
+    }
+
+    public static void setDfsReplication(String dfsReplication) {
+        DBAgent.dfsReplication = dfsReplication;
+    }
+
+    public static void setHbaseRootdir(String hbaseRootdir) {
+        DBAgent.hbaseRootdir = hbaseRootdir;
+    }
+
+    public static void setHbaseClusterDistributed(String hbaseClusterDistributed) {
+        DBAgent.hbaseClusterDistributed = hbaseClusterDistributed;
+    }
+
+    public static void setHbaseZookeeperPropertyDataDir(String hbaseZookeeperPropertyDataDir) {
+        DBAgent.hbaseZookeeperPropertyDataDir = hbaseZookeeperPropertyDataDir;
+    }
+
+
+
+}

+ 674 - 0
fm-sop/src/main/java/com/persagy/old/dao/DBCommonMethods.java

@@ -0,0 +1,674 @@
+package com.persagy.old.dao;
+
+
+import com.persagy.old.common.DateUtil;
+import com.persagy.old.common.ToolsUtil;
+import com.sagacloud.json.JSONArray;
+import com.sagacloud.json.JSONObject;
+import net.minidev.json.JSONValue;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Arrays;
+
+public class DBCommonMethods {
+	private static final Logger log = LoggerFactory.getLogger(DBCommonMethods.class);
+
+	/**
+	 * 
+	 * 功能描述:插入记录
+	 * @param tableName
+	 * @param jsonStr
+	 * @return 
+	 * @创建者 wanghailong
+	 * @邮箱 wanghailong@persagy.com 
+	 * @修改描述
+	 */
+	public static String insertRecord(String tableName, String jsonStr) {
+		return insertRecord(DBConst.DATABASE_NAME, tableName, jsonStr);
+	}
+
+	/**
+	 * 
+	 * 功能描述:插入记录,指定操作的数据库
+	 * @param Database
+	 * @param tableName
+	 * @param jsonStr
+	 * @return 
+	 * @创建者 wanghailong
+	 * @邮箱 wanghailong@persagy.com 
+	 * @修改描述
+	 */
+	public static String insertRecord(String Database, String tableName, String jsonStr) {
+		JSONObject dataJson = (JSONObject) JSONValue.parse(jsonStr);
+		JSONObject insertObject = (JSONObject) dataJson.get("insertObject");
+		insertObject = processInsertObj(insertObject);
+
+		JSONObject bodyNode = (JSONObject) JSONValue.parse("{}");
+		bodyNode.put("QueryType", "insert");
+		bodyNode.put("Database", Database);
+		bodyNode.put("Datatable", tableName);
+		bodyNode.put("InsertObject", dataJson.get("insertObject"));
+		log.info(bodyNode.toString());
+		try {
+			String result = DBAgent.GetAgent().Query(bodyNode).toString();
+//			log.info(result);
+			return result;
+		} catch (Exception e) {
+			e.printStackTrace();
+			log.error("请求异常:",e);
+			return ToolsUtil.errorJsonMsg(Arrays.toString(e.getStackTrace()));
+		}
+	}
+	
+	/**
+	 * 
+	 * 功能描述:插入记录,指定操作的数据库
+	 * @param Database
+	 * @param tableName
+	 * @param jsonStr
+	 * @return 
+	 * @创建者 wanghailong
+	 * @邮箱 wanghailong@persagy.com 
+	 * @修改描述
+	 */
+	public static String insertRecord(String Database, String tableName, String jsonStr, boolean notUpdateTime) {
+		JSONObject dataJson = (JSONObject) JSONValue.parse(jsonStr);
+		JSONObject insertObject = (JSONObject) dataJson.get("insertObject");
+//		insertObject = processInsertObj(insertObject);
+		// 添加数据有效状态,true-有效,false-无效
+		insertObject.put(DBConst.TABLE_FIELD_VALID, true);
+		
+		JSONObject bodyNode = (JSONObject) JSONValue.parse("{}");
+		bodyNode.put("QueryType", "insert");
+		bodyNode.put("Database", Database);
+		bodyNode.put("Datatable", tableName);
+		bodyNode.put("InsertObject", dataJson.get("insertObject"));
+		log.info(bodyNode.toString());
+		try {
+			String result = DBAgent.GetAgent().Query(bodyNode).toString();
+//			log.info(result);
+			return result;
+		} catch (Exception e) {
+			e.printStackTrace();
+			log.error("请求异常:",e);
+			return ToolsUtil.errorJsonMsg(Arrays.toString(e.getStackTrace()));
+		}
+	}
+	/**
+	 * 
+	 * 功能描述:插入一批记录,指定操作的数据库
+	 * @param tableName
+	 * @param jsonStr
+	 * @return 
+	 * @创建者 wanghailong
+	 * @邮箱 wanghailong@persagy.com 
+	 * @修改描述
+	 */
+	public static String insertBatchRecord(String tableName, String jsonStr) {
+		return insertBatchRecord(DBConst.DATABASE_NAME, tableName, jsonStr);
+	}
+	/**
+	 * 
+	 * 功能描述:插入一批记录,指定操作的数据库
+	 * @param Database
+	 * @param tableName
+	 * @param jsonStr
+	 * @return 
+	 * @创建者 wanghailong
+	 * @邮箱 wanghailong@persagy.com 
+	 * @修改描述
+	 */
+	public static String insertBatchRecord(String Database, String tableName, String jsonStr) {
+		JSONObject dataJson = (JSONObject) JSONValue.parse(jsonStr);
+		JSONArray insertObjects = (JSONArray) dataJson.get("insertObjects");
+		insertObjects = processInsertArray(insertObjects);
+		JSONObject bodyNode = (JSONObject) JSONValue.parse("{}");
+		bodyNode.put("QueryType", "batch_insert");
+		bodyNode.put("Database", Database);
+		bodyNode.put("Datatable", tableName);
+		bodyNode.put("InsertObjects", insertObjects);
+		log.info(bodyNode.toString());
+		try {
+			String result = DBAgent.GetAgent().Query(bodyNode).toString();
+//			log.info(result);
+			return result;
+		} catch (Exception e) {
+			e.printStackTrace();
+			log.error("请求异常:",e);
+			return ToolsUtil.errorJsonMsg(Arrays.toString(e.getStackTrace()));
+		}
+	}
+	
+	/**
+	 * 
+	 * 功能描述:修改记录
+	 * @param tableName
+	 * @param jsonStr
+	 * @return 
+	 * @创建者 wanghailong
+	 * @邮箱 wanghailong@persagy.com 
+	 * @修改描述
+	 */
+	public static String updateRecord(String tableName, String jsonStr) {
+		return updateRecord(DBConst.DATABASE_NAME, tableName, jsonStr);
+	}
+
+	/**
+	 * 
+	 * 功能描述:修改记录
+	 * @param Database
+	 * @param tableName
+	 * @param jsonStr
+	 * @return 
+	 * @创建者 wanghailong
+	 * @邮箱 wanghailong@persagy.com 
+	 * @修改描述
+	 */
+	public static String updateRecord(String Database, String tableName, String jsonStr) {
+		JSONObject dataJson = (JSONObject) JSONValue.parse(jsonStr);
+		JSONObject bodyNode = (JSONObject) JSONValue.parse("{}");
+		JSONObject set = (JSONObject) dataJson.get("set");
+		// 添加更新时间
+		set.put(DBConst.TABLE_FIELD_UPDATE_TIME, DateUtil.getNowTimeStr());
+		
+		bodyNode.put("QueryType", "update");
+		bodyNode.put("Database", Database);
+		bodyNode.put("Datatable", tableName);
+		bodyNode.put("Criteria", dataJson.get("criteria"));
+		bodyNode.put("Set", set);
+		log.info(bodyNode.toString());
+		try {
+			String result = DBAgent.GetAgent().Query(bodyNode).toString();
+//			log.info(result);
+			return result;
+		} catch (Exception e) {
+			e.printStackTrace();
+			log.error("请求异常:",e);
+			return ToolsUtil.errorJsonMsg(Arrays.toString(e.getStackTrace()));
+		}
+	}
+	
+	/**
+	 * 
+	 * 功能描述:修改记录
+	 * @param Database
+	 * @param tableName
+	 * @param jsonStr
+	 * @return 
+	 * @创建者 wanghailong
+	 * @邮箱 wanghailong@persagy.com 
+	 * @修改描述
+	 */
+	public static String updateRecord(String Database, String tableName, String jsonStr, boolean notUpdateTime) {
+		JSONObject dataJson = (JSONObject) JSONValue.parse(jsonStr);
+		JSONObject bodyNode = (JSONObject) JSONValue.parse("{}");
+		JSONObject set = (JSONObject) dataJson.get("set");
+		
+		bodyNode.put("QueryType", "update");
+		bodyNode.put("Database", Database);
+		bodyNode.put("Datatable", tableName);
+		bodyNode.put("Criteria", dataJson.get("criteria"));
+		bodyNode.put("Set", set);
+		log.info(bodyNode.toString());
+		try {
+			String result = DBAgent.GetAgent().Query(bodyNode).toString();
+//			log.info(result);
+			return result;
+		} catch (Exception e) {
+			e.printStackTrace();
+			log.error("请求异常:",e);
+			return ToolsUtil.errorJsonMsg(Arrays.toString(e.getStackTrace()));
+		}
+	}
+	
+	public static String updateBatchRecord(String tableName, String jsonStr){
+		return updateBatchRecord(DBConst.DATABASE_NAME,  tableName, jsonStr);
+	}
+	
+	/**
+	 * 
+	 * Description: 批量更新sop发布版本(仅物理世界对象改变时使用,不更新update_time)
+	 * @param tableName
+	 * @param jsonStr
+	 * @return String
+	 * @author yuecaipu
+	 * @since 2018年5月29日: 上午11:15:23
+	 * Update By yuecaipu 2018年5月29日: 上午11:15:23
+	 */
+	public static String updateBatchPublishStatus(String tableName, String jsonStr){
+		return updateBatchPublishStatus(DBConst.DATABASE_NAME,  tableName, jsonStr);
+	}
+	
+	public static String updateBatchRecord(String Database, String tableName, String jsonStr){
+		JSONObject dataJson = (JSONObject) JSONValue.parse(jsonStr);
+		JSONObject bodyNode = (JSONObject) JSONValue.parse("{}");
+		JSONObject set = (JSONObject) dataJson.get("set");
+		// 添加更新时间
+		set.put(DBConst.TABLE_FIELD_UPDATE_TIME, DateUtil.getNowTimeStr());
+		
+		bodyNode.put("QueryType", "batch_update");
+		bodyNode.put("Database", Database);
+		bodyNode.put("Datatable", tableName);
+		bodyNode.put("Criterias", dataJson.get("criterias"));
+		bodyNode.put("Set", set);
+		log.info(bodyNode.toString());
+		try {
+			String result = DBAgent.GetAgent().Query(bodyNode).toString();
+//			log.info(result);
+			return result;
+		} catch (Exception e) {
+			e.printStackTrace();
+			log.error("请求异常:",e);
+			return ToolsUtil.errorJsonMsg(Arrays.toString(e.getStackTrace()));
+		}
+	}
+	public static String updateBatchPublishStatus(String Database, String tableName, String jsonStr){
+		JSONObject dataJson = (JSONObject) JSONValue.parse(jsonStr);
+		JSONObject bodyNode = (JSONObject) JSONValue.parse("{}");
+		JSONObject set = (JSONObject) dataJson.get("set");
+		
+		bodyNode.put("QueryType", "batch_update");
+		bodyNode.put("Database", Database);
+		bodyNode.put("Datatable", tableName);
+		bodyNode.put("Criterias", dataJson.get("criterias"));
+		bodyNode.put("Set", set);
+		log.info(bodyNode.toString());
+		try {
+			String result = DBAgent.GetAgent().Query(bodyNode).toString();
+//			log.info(result);
+			return result;
+		} catch (Exception e) {
+			e.printStackTrace();
+			log.error("请求异常:",e);
+			return ToolsUtil.errorJsonMsg(Arrays.toString(e.getStackTrace()));
+		}
+	}
+
+	/**
+	 * 
+	 * 功能描述:删除数据
+	 * @param tableName
+	 * @param jsonStr
+	 * @return 
+	 * @创建者 wanghailong
+	 * @邮箱 wanghailong@persagy.com 
+	 * @修改描述
+	 */
+	public static String deleteRecord(String tableName, String jsonStr) {
+		return deleteRecord(DBConst.DATABASE_NAME, tableName, jsonStr);
+	}
+
+	/**
+	 * 
+	 * 功能描述:删除数据
+	 * @param Database
+	 * @param tableName
+	 * @param jsonStr
+	 * @return 
+	 * @创建者 wanghailong
+	 * @邮箱 wanghailong@persagy.com 
+	 * @修改描述
+	 */
+	public static String deleteRecord(String Database, String tableName, String jsonStr) {
+		JSONObject dataJson = (JSONObject) JSONValue.parse(jsonStr);
+		JSONObject setNode = (JSONObject) JSONValue.parse("{}");
+		setNode.put(DBConst.TABLE_FIELD_VALID, false);
+		setNode.put(DBConst.TABLE_FIELD_UPDATE_TIME, DateUtil.getNowTimeStr());
+
+		JSONObject bodyNode = (JSONObject) JSONValue.parse("{}");
+		bodyNode.put("QueryType", "update");
+		bodyNode.put("Database", Database);
+		bodyNode.put("Datatable", tableName);
+		bodyNode.put("Criteria", dataJson.get("criteria"));
+		bodyNode.put("Set", setNode);
+		log.info(bodyNode.toString());
+		try {
+			String result = DBAgent.GetAgent().Query(bodyNode).toString();
+//			log.info(result);
+			return result;
+		} catch (Exception e) {
+			e.printStackTrace();
+			log.error("请求异常:",e);
+			return ToolsUtil.errorJsonMsg(Arrays.toString(e.getStackTrace()));
+		}
+	}
+	
+	/**
+	 * 功能描述:批量删除数据
+	 * @param tableName
+	 * @param jsonStr
+	 * @return
+	 */
+	public static String deleteBatchRecord(String tableName, String jsonStr){
+		return deleteBatchRecord(DBConst.DATABASE_NAME, tableName, jsonStr);
+	}
+
+	/**
+	 * 功能描述:批量删除数据
+	 * @param Database
+	 * @param tableName
+	 * @param jsonStr
+	 * @return
+	 */
+	public static String deleteBatchRecord(String Database, String tableName, String jsonStr){
+		JSONObject dataJson = (JSONObject) JSONValue.parse(jsonStr);
+		JSONObject setNode = (JSONObject) JSONValue.parse("{}");
+		setNode.put(DBConst.TABLE_FIELD_VALID, false);
+		setNode.put(DBConst.TABLE_FIELD_UPDATE_TIME, DateUtil.getNowTimeStr());
+		
+		JSONObject bodyNode = (JSONObject) JSONValue.parse("{}");
+		bodyNode.put("QueryType", "batch_update");
+		bodyNode.put("Database", Database);
+		bodyNode.put("Datatable", tableName);
+		bodyNode.put("Criterias", dataJson.get("criterias"));
+		bodyNode.put("Set", setNode);
+		log.info(bodyNode.toString());
+		try {
+			String result = DBAgent.GetAgent().Query(bodyNode).toString();
+//			log.info(result);
+			return result;
+		} catch (Exception e) {
+			e.printStackTrace();
+			log.error("请求异常:",e);
+			return ToolsUtil.errorJsonMsg(Arrays.toString(e.getStackTrace()));
+		}
+	}
+	
+	/**
+	 * 
+	 * 功能描述:根据主键查询一条记录数据
+	 * @param tableName
+	 * @param jsonStr
+	 * @return 
+	 * @创建者 wanghailong
+	 * @邮箱 wanghailong@persagy.com 
+	 * @修改描述
+	 */
+	public static String getRecordBykey(String tableName, String jsonStr) {
+		return getRecordBykey(DBConst.DATABASE_NAME, tableName, jsonStr);
+	}
+	/**
+	 * 
+	 * 功能描述:根据主键查询一条记录数据
+	 * @param Database
+	 * @param tableName
+	 * @param jsonStr
+	 * @return 
+	 * @创建者 wanghailong
+	 * @邮箱 wanghailong@persagy.com 
+	 * @修改描述
+	 */
+	public static String getRecordBykey(String Database, String tableName, String jsonStr) {
+		JSONObject dataJson = (JSONObject) JSONValue.parse(jsonStr);
+		JSONObject bodyNode = (JSONObject) JSONValue.parse("{}");
+		bodyNode.put("QueryType", "get");
+		bodyNode.put("Database", Database);
+		bodyNode.put("Datatable", tableName);
+		bodyNode.put("Key", dataJson.get("Key"));
+		log.info(bodyNode.toString());
+		try {
+			String result = DBAgent.GetAgent().Query(bodyNode).toString();
+//			log.info(result);
+			return result;
+		} catch (Exception e) {
+			e.printStackTrace();
+			log.error("请求异常:",e);
+			return ToolsUtil.errorJsonMsg(Arrays.toString(e.getStackTrace()));
+		}
+	}
+	/**
+	 * 
+	 * 功能描述:根据主键查询多条记录数据
+	 * @param tableName
+	 * @param jsonStr
+	 * @return 
+	 * @创建者 wanghailong
+	 * @邮箱 wanghailong@persagy.com 
+	 * @修改描述
+	 */
+	public static String getBatchRecordBykeys(String tableName, String jsonStr) {
+		return getBatchRecordBykeys(DBConst.DATABASE_NAME, tableName, jsonStr);
+	}
+	/**
+	 * 
+	 * 功能描述:根据主键查询多条记录数据
+	 * @param Database
+	 * @param tableName
+	 * @param jsonStr
+	 * @return 
+	 * @创建者 wanghailong
+	 * @邮箱 wanghailong@persagy.com 
+	 * @修改描述
+	 */
+	public static String getBatchRecordBykeys(String Database, String tableName, String jsonStr) {
+		JSONObject dataJson = (JSONObject) JSONValue.parse(jsonStr);
+		JSONObject bodyNode = (JSONObject) JSONValue.parse("{}");
+		bodyNode.put("QueryType", "batch_get");
+		bodyNode.put("Database", Database);
+		bodyNode.put("Datatable", tableName);
+		bodyNode.put("Keys", dataJson.get("keys"));
+		bodyNode.put("ReturnColumns", dataJson.get("ReturnColumns"));
+		log.info(bodyNode.toString());
+		try {
+			String result = DBAgent.GetAgent().Query(bodyNode).toString();
+//			log.info(result);
+			return result;
+		} catch (Exception e) {
+			e.printStackTrace();
+			log.error("请求异常:",e);
+			return ToolsUtil.errorJsonMsg(Arrays.toString(e.getStackTrace()));
+		}
+	}
+	/**
+	 * 
+	 * 功能描述:查询所有数据,包括无效数据
+	 * @param tableName
+	 * @return 
+	 * @创建者 wanghailong
+	 * @邮箱 wanghailong@persagy.com 
+	 * @修改描述
+	 */
+	public static String queryAllRecord( String tableName) {
+		String jsonStr = "{\"criteria\":{}}" ;
+		return queryRecordByCriteria(DBConst.DATABASE_NAME, tableName, jsonStr);
+	}
+
+	/**
+	 *
+	 * 功能描述:查询所有数据,包括无效数据
+	 * @param tableName
+	 * @return
+	 * @创建者 wanghailong
+	 * @邮箱 wanghailong@persagy.com
+	 * @修改描述
+	 */
+	public static String queryAllRecord(String dataSource, String tableName) {
+		String jsonStr = "{\"criteria\":{}}" ;
+		return queryRecordByCriteria(dataSource, tableName, jsonStr);
+	}
+	/**
+	 * 
+	 * 功能描述:查询所有有效数据
+	 * @param tableName
+	 * @return 
+	 * @创建者 wanghailong
+	 * @邮箱 wanghailong@persagy.com 
+	 * @修改描述
+	 */
+	public static String queryAllValidRecord( String tableName) {
+		String jsonStr = "{\"criteria\":{}}" ;
+		return queryValidRecordByCriteria(DBConst.DATABASE_NAME, tableName, jsonStr);
+	}
+	/**
+	 * 
+	 * 功能描述:查询符合条件的数据,包括无效数据
+	 * @param tableName
+	 * @param jsonStr
+	 * @return 
+	 * @创建者 wanghailong
+	 * @邮箱 wanghailong@persagy.com 
+	 * @修改描述
+	 */
+	public static String queryRecordByCriteria( String tableName, String jsonStr) {
+		return queryRecordByCriteria(DBConst.DATABASE_NAME, tableName, jsonStr);
+	}
+	
+	/**
+	 * 
+	 * 功能描述:查询符合条件的数据,包括无效数据
+	 * @param Database
+	 * @param tableName
+	 * @param jsonStr
+	 * @return 
+	 * @创建者 wanghailong
+	 * @邮箱 wanghailong@persagy.com 
+	 * @修改描述
+	 */
+	public static String queryRecordByCriteria(String Database, String tableName, String jsonStr) {
+		JSONObject dataJson = (JSONObject) JSONValue.parse(jsonStr);
+		JSONObject bodyNode = (JSONObject) JSONValue.parse("{}");
+		bodyNode.put("QueryType", "select");
+		bodyNode.put("Database", Database);
+		bodyNode.put("Datatable", tableName);
+		bodyNode.put("Criteria", dataJson.get("criteria"));
+		log.info(bodyNode.toString());
+		try {
+			String result = DBAgent.GetAgent().Query(bodyNode).toString();
+//			log.info(result);
+			return result;
+		} catch (Exception e) {
+			e.printStackTrace();
+			log.error("请求异常:",e);
+			return ToolsUtil.errorJsonMsg(Arrays.toString(e.getStackTrace()));
+		}
+	}
+	
+	/**
+	 * 功能描述:批量查询符合条件的数据,并合并,包括无效数据
+	 * @param tableName
+	 * @param jsonStr
+	 * @return
+	 */
+	public static String queryBathchMergeRecordByCriterias(String tableName, String jsonStr){
+		return queryBathchMergeRecordByCriterias(DBConst.DATABASE_NAME, tableName, jsonStr);
+	}
+
+	/**
+	 * 功能描述:批量查询符合条件的数据,并合并,包括无效数据
+	 * @param dataBase
+	 * @param tableName
+	 * @param jsonStr
+	 * @return
+	 */
+	public static String queryBathchMergeRecordByCriterias(String dataBase, String tableName, String jsonStr){
+		JSONObject dataJson = (JSONObject) JSONValue.parse(jsonStr);
+		JSONObject bodyNode = (JSONObject) JSONValue.parse("{}");
+		bodyNode.put("QueryType", "batch_select_merge");
+		bodyNode.put("Database", dataBase);
+		bodyNode.put("Datatable", tableName);
+		bodyNode.put("Criterias", dataJson.get("criterias"));
+		log.info(bodyNode.toString());
+		try {
+			String result = DBAgent.GetAgent().Query(bodyNode).toString();
+//			log.info(result);
+			return result;
+		} catch (Exception e) {
+			e.printStackTrace();
+			log.error("请求异常:",e);
+			return ToolsUtil.errorJsonMsg(Arrays.toString(e.getStackTrace()));
+		}
+	}
+	
+
+	/**
+	 * 
+	 * 功能描述:查询符合条件的有效数据
+	 * @param tableName
+	 * @param jsonStr
+	 * @return 
+	 * @创建者 wanghailong
+	 * @邮箱 wanghailong@persagy.com 
+	 * @修改描述
+	 */
+	public static String queryValidRecordByCriteria( String tableName, String jsonStr) {
+		return queryValidRecordByCriteria(DBConst.DATABASE_NAME, tableName, jsonStr);
+	}
+	
+	/**
+	 * 
+	 * 功能描述:查询符合条件的有效数据
+	 * @param Database
+	 * @param tableName
+	 * @param jsonStr
+	 * @return 
+	 * @创建者 wanghailong
+	 * @邮箱 wanghailong@persagy.com 
+	 * @修改描述
+	 */
+	public static String queryValidRecordByCriteria(String Database, String tableName, String jsonStr) {
+		JSONObject dataJson = (JSONObject) JSONValue.parse(jsonStr);
+		JSONObject bodyNode = (JSONObject) JSONValue.parse("{}");
+		bodyNode.put("QueryType", "select");
+		bodyNode.put("Database", Database);
+		bodyNode.put("Datatable", tableName);
+		bodyNode.put("Criteria", dataJson.get("criteria"));
+		log.info(bodyNode.toString());
+		try {
+			JSONObject resJson = DBAgent.GetAgent().Query(bodyNode);
+			JSONArray arr = (JSONArray) resJson.get("Content");
+			int removeCount = 0;
+			for (int i = arr.size() - 1; i > -1; i--) {
+				JSONObject node = (JSONObject) arr.get(i);
+				if(node.get(DBConst.TABLE_FIELD_VALID) != null && !(Boolean) node.get(DBConst.TABLE_FIELD_VALID)){
+					arr.remove(i);
+					removeCount += 1;
+				}
+			}
+			resJson.put("Count", (Long)resJson.get("Count")- removeCount);
+//			log.info(resJson.toString());
+			return resJson.toString();
+		} catch (Exception e) {
+			e.printStackTrace();
+			log.error("请求异常:",e);
+			return ToolsUtil.errorJsonMsg(Arrays.toString(e.getStackTrace()));
+		}
+	}
+	/**
+	 * 
+	 * 功能描述:处理新增数据
+	 * @param node
+	 * @return 
+	 * @创建者 wanghailong
+	 * @邮箱 wanghailong@persagy.com 
+	 * @修改描述
+	 */
+	private static JSONObject processInsertObj(JSONObject node) {
+		if(!node.containsKey(DBConst.TABLE_FIELD_CTEATE_TIME)){
+			// 添加创建时间
+			node.put(DBConst.TABLE_FIELD_CTEATE_TIME, DateUtil.getNowTimeStr());
+		}
+		// 添加更新时间
+		node.put(DBConst.TABLE_FIELD_UPDATE_TIME, DateUtil.getNowTimeStr());
+		// 添加数据有效状态,true-有效,false-无效
+		node.put(DBConst.TABLE_FIELD_VALID, true);
+		return node;
+	}
+
+	/**
+	 *
+	 * 功能描述:处理新增数据
+	 * @param nodes
+	 * @return
+	 * @创建者 wanghailong
+	 * @邮箱 wanghailong@persagy.com
+	 * @修改描述
+	 */
+	private static JSONArray processInsertArray(JSONArray nodes) {
+		JSONArray array = new JSONArray();
+		for(int i=0; i<nodes.size(); i++){
+			array.add(processInsertObj((JSONObject) nodes.get(i)));
+		}
+		return array;
+	}
+}

+ 1 - 1
fm-sop/src/main/java/com/persagy/fm/sop/constant/DBConst.java

@@ -1,4 +1,4 @@
-package com.persagy.fm.sop.constant;
+package com.persagy.old.dao;
 
 /**
  * 

+ 36 - 0
fm-sop/src/main/java/com/persagy/old/dao/PersagyManageClient.java

@@ -0,0 +1,36 @@
+package com.persagy.old.dao;
+
+import feign.Headers;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+
+/**
+ * 运维系统
+ * <p> PersagyManageClient.java.</p>
+ * <p>Description:  .</p>
+ * <p>Company: .</p>
+ * <p>@author gezhanbin</p>
+ * <p>@version .</p>
+ * 2019年6月17日: 下午2:21:44
+ */
+@FeignClient(name = "EMS-SaaS-Web")
+public interface PersagyManageClient {
+
+	/**
+	 * 查询当前用户的密码MD5值
+	 *<p>Description:  .</p> 
+	 *<p>@param params
+	 *<p>@return String
+	 *@since 2019年6月17日: 下午2:13:57
+	 *@author gezhanbin
+	 *@version 1.0
+	 */
+	@PostMapping("/Spring/MVC/entrance/unifier/queryPasswordByUserIdService")
+	@Headers({"Content-Type: application/x-www-form-urlencoded"})
+	public String queryPasswordByUserIdService(@RequestParam("jsonString") String jsonString);
+	
+	
+	
+	
+}

+ 585 - 0
fm-sop/src/main/java/com/persagy/old/service/BaseService.java

@@ -0,0 +1,585 @@
+/**
+ * @包名称 com.sagacloud.service
+ * @文件名 BaseService.java
+ * @创建者 wanghailong
+ * @邮箱 wanghailong@persagy.com  
+ * @修改描述 
+ */
+
+package com.persagy.old.service;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+import com.persagy.old.common.*;
+import com.persagy.old.dao.DBConst;
+import com.persagy.old.dao.DBConst.Result;
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.lang.StringUtils;
+import org.apache.http.NameValuePair;
+import org.apache.http.client.entity.UrlEncodedFormEntity;
+import org.apache.http.client.methods.CloseableHttpResponse;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.client.methods.HttpUriRequest;
+import org.apache.http.entity.StringEntity;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClients;
+import org.apache.http.message.BasicNameValuePair;
+import org.apache.http.util.EntityUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+
+import java.io.IOException;
+import java.util.*;
+
+/**
+ * 功能描述:
+ * 
+ * @类型名称 BaseService
+ * @创建者 wanghailong
+ * @邮箱 wanghailong@persagy.com
+ * @修改描述
+ * 
+ * update by yuecaipu 2018/5/2
+ */
+//被@RefreshScope修饰的Bean都是延迟加载的,只有在第一次访问时才会被初始化,刷新Bean也是同理,下次访问时会创建一个信息的对象
+//@RefreshScope //这里不能省略  不然不能手动触发
+@Service("baseService")
+public class BaseService {
+	@Value("${data.platform.basePath}")
+	public String dataPlatBasePath;
+
+
+	/**
+	 * 数据平台使用设备标签筛选
+    */
+    @Value("${obj.filter.by.tag}")
+    public boolean tagFlag;
+    /**
+     * 数据平台设备标签(后缀)
+     */
+    @Value("${equip.tag}")
+    public String equipTag;
+
+	private static final Logger log = LoggerFactory.getLogger(BaseService.class);
+
+	/**
+	 * 功能描述:http请求,Json类型参数
+	 * 
+	 * @param url
+	 * @param jsonStr
+	 * @return
+	 * @throws Exception
+	 * @创建者 wanghailong
+	 * @邮箱 wanghailong@persagy.com 修改描述
+	 */
+	public String httpPostRequest(String url, String jsonStr) throws Exception {
+		log.info("请求数据平台post:"+url);
+		
+		if(StringUtil.isNull(jsonStr)) {
+			jsonStr = new JSONObject().toJSONString();
+		}
+		/**
+		 * 统一处理:调用非运维系统时,user_id统一使用systemId
+		 */
+//		JSONObject jsonParam = JSONObject.parseObject(jsonStr);
+//		jsonParam.put("user_id", CommonConst.SYSTEM_ID);
+//		jsonStr = jsonParam.toJSONString();
+		
+		/***********统一处理:调用非运维系统时,user_id统一使用systemId  结束**************************/
+		
+		
+		log.info(jsonStr);
+
+		/*---- 数据平台不接收get方式传参 需要将get请求的参数projectId转为post updateTime:20180504 10:53 ----*/
+//		dataPlatBasePath = dataPlatBasePath == null ? initDataPlatBasePath() : dataPlatBasePath;
+//		if (url.contains("projectId") && url.contains(dataPlatBasePath)) {
+//			JSONObject jsonObject = JSONObject.parseObject(jsonStr);
+//			int index = url.indexOf("projectId");
+//			String projectId = url.substring(index + "projectId=".length(), index + "projectId".length() + 13);
+//			jsonObject.put("projectId", projectId);
+//			jsonStr = jsonObject.toString();
+//		}
+		/*----------- end -------------*/
+
+		String respContent = null;
+		CloseableHttpClient httpclient = HttpClients.createDefault();
+		HttpPost httpPost = new HttpPost(url);
+		httpPost.addHeader("Content-Type", "application/json;charset=utf-8");
+		httpPost.setEntity(new StringEntity(jsonStr, "utf-8"));
+		// 执行请求
+		respContent = executeHttpRequest(httpclient, httpPost);
+//		log.info(respContent);
+		return respContent;
+	}
+
+	
+	/**
+	 * Description: post方式访问数据平台接口,项目id放到post参数体内,不需要项目密码
+	 * @param url 请求数据平台url
+	 * @param jsonStr 请求参数jsonString
+	 * @return
+	 * @throws Exception String
+	 * @author cuixubin
+	 * @since 2018年5月3日: 下午8:11:04
+	 * Update By cuixubin 2018年5月3日: 下午8:11:04
+	 */
+	public String httpPostRequestDataPlatform(String url, String jsonStr) throws Exception {
+
+        /**
+         * 数据平台设备标签筛选 特殊处理
+         **/
+        if (tagFlag) {
+            if (url.contains("equipment/complex_query")) {
+                JSONArray businessTag = new JSONArray();
+                businessTag.add(equipTag);
+                JSONObject jsonObject = JSONObject.parseObject(jsonStr);
+                jsonObject.put("businessTag", businessTag);
+                jsonStr = jsonObject.toJSONString();
+            } else if (url.contains("object/search")) {
+                JSONObject jsonObject = JSONObject.parseObject(jsonStr);
+                JSONArray category = jsonObject.getJSONArray("category");
+                if (CollectionUtils.isNotEmpty(category)) {
+                    JSONArray businessTag = new JSONArray();
+                    for (int i = 0; i < category.size(); i++) {
+                        if ("EqObj".equals(category.getString(i))) {  //目前只支持设备对象可以打标签
+                            businessTag.add(category.getString(i) + "_" + equipTag);
+                        }
+                    }
+                    jsonObject.put("businessTag", businessTag);
+                    jsonStr = jsonObject.toJSONString();
+                }
+            } else if (url.contains("object/subset_query") || url.contains("object/query_by_info")) {
+                JSONObject jsonObject = JSONObject.parseObject(jsonStr);
+                JSONObject criteria = (JSONObject) jsonObject.getOrDefault("criteria", new JSONObject());
+                JSONArray type = (JSONArray) criteria.getOrDefault("type", new JSONArray());
+                if (CollectionUtils.isNotEmpty(type)) {
+                    JSONArray businessTag = new JSONArray();
+                    for (int i = 0; i < type.size(); i++) {
+                        if ("Eq".equals(type.getString(i))) {  //目前只支持设备对象可以打标签
+                            businessTag.add(type.getString(i) + "_" + equipTag);
+                        }
+                    }
+                    jsonObject.put("businessTag", businessTag);
+                    jsonStr = jsonObject.toJSONString();
+                }
+            }
+        }
+
+        log.info("请求数据平台post:"+url);
+        log.info(jsonStr);
+
+        // 项目id放到post体
+//		if(url.contains("projectId")){
+//			JSONObject jsonObject = JSONObject.parseObject(jsonStr);
+//			int index = url.indexOf("projectId");
+//			String projectId = url.substring(index+"projectId=".length(),index+"projectId".length()+13);
+//			jsonObject.put("projectId",projectId);
+//			jsonStr = jsonObject.toString();
+//		}
+
+		String respContent = null;
+		CloseableHttpClient httpclient = HttpClients.createDefault();
+		HttpPost httpPost = new HttpPost(url);
+		httpPost.addHeader("Content-Type", "application/json;charset=utf-8");
+		httpPost.setEntity(new StringEntity(jsonStr, "utf-8"));
+		// 执行请求
+		respContent = executeHttpRequest(httpclient, httpPost);
+		if(null != respContent && respContent.contains("failure")) {
+			log.error(respContent);
+		}
+		return respContent;
+	}
+	
+	
+
+	
+	
+	
+	/**
+	 * 
+	 * 功能描述::http请求,非Json类型参数,参数直接是'&'间隔的
+	 * 
+	 * @param url
+	 * @param params
+	 * @return
+	 * @throws Exception
+	 * @创建者 wanghailong
+	 * @邮箱 wanghailong@persagy.com 修改描述
+	 */
+	@Deprecated
+	public String httpPostWithListParams(String url, Map<String, String> params) throws Exception {
+		String respContent = null;
+		CloseableHttpClient httpclient = HttpClients.createDefault();
+		HttpPost httpPost = new HttpPost(url);
+		httpPost.addHeader("Content-Type", "application/json;charset=utf-8");
+		// 设置请求的的参数
+		List<NameValuePair> nvps = new ArrayList<NameValuePair>();
+		// 参数 jsonArray形式
+		Set<String> keySet = params.keySet();
+		for (String key : keySet) {
+			nvps.add(new BasicNameValuePair(key, params.get(key)));
+		}
+		httpPost.setEntity(new UrlEncodedFormEntity(nvps, "utf-8"));
+		// 执行请求
+		respContent = executeHttpRequest(httpclient, httpPost);
+//		log.info(respContent);
+		return respContent;
+	}
+
+
+	
+	/**
+	 * 功能描述:http请求,Json类型参数
+	 *
+	 * @param url
+	 * @param jsonStr
+	 * @return
+	 * @throws Exception
+	 * @创建者 wanghailong
+	 * @邮箱 wanghailong@persagy.com 修改描述
+	 */
+	public String httpPostRequestToPersagy(String url, String jsonStr) throws Exception {
+		log.info("请求数据平台post:"+url);
+		log.info(jsonStr);
+		String respContent = null;
+		CloseableHttpClient httpclient = HttpClients.createDefault();
+		HttpPost httpPost = new HttpPost(url);
+		httpPost.addHeader("Content-Type", "application/x-www-form-urlencoded");
+		httpPost.setEntity(new StringEntity("jsonString=" + jsonStr, "utf-8"));
+		// 执行请求
+		respContent = executeHttpRequest(httpclient, httpPost);
+//		log.info(respContent);
+		return respContent;
+	}
+
+	
+	
+	
+	
+	private Map<String, String> URLRequest(String URL) {
+		Map<String, String> mapRequest = new HashMap<String, String>();
+		String[] arrSplit = null;
+		String strUrlParam = TruncateUrlPage(URL);
+		if (strUrlParam == null) {
+			return mapRequest;
+		}
+		//每个键值为一组 www.2cto.com
+		arrSplit = strUrlParam.split("[&]");
+		for (String strSplit : arrSplit) {
+			String[] arrSplitEqual = null;
+			arrSplitEqual = strSplit.split("[=]");
+
+			//解析出键值
+			if (arrSplitEqual.length > 1) {
+				//正确解析
+				mapRequest.put(arrSplitEqual[0], arrSplitEqual[1]);
+			} else {
+				if (arrSplitEqual[0] != "") {
+					//只有参数没有值,不加入
+					mapRequest.put(arrSplitEqual[0], "");
+				}
+			}
+		}
+		mapRequest.remove("secret");
+		return mapRequest;
+	}
+
+	private static String TruncateUrlPage(String strURL) {
+		if (StringUtils.isNotEmpty(strURL)) {
+			String[] arrSplit = strURL.trim().split("[?]");
+			if (arrSplit.length > 1) {
+				return arrSplit[1];
+			}
+		}
+		return null;
+	}
+
+
+	/**
+	 * 执行http请求
+	 * @param httpClient
+	 * @param httpRequest
+	 * @return
+	 */
+	private static String executeHttpRequest(CloseableHttpClient httpClient, HttpUriRequest httpRequest){
+		CloseableHttpResponse response;
+		String respContent = null;
+		try {
+			response = httpClient.execute(httpRequest);
+			respContent = EntityUtils.toString(response.getEntity(), "utf-8");
+		} catch (Exception e) {
+		}finally {
+			try {
+				httpClient.close();
+			} catch (IOException e) {
+				log.error("HttpClient closed failed!");
+			}
+			
+			if(respContent == null || respContent.startsWith("<")){
+				respContent = ToolsUtil.errorJsonMsg("请求异常" + respContent);
+			}
+		}
+		return respContent;
+	}
+
+	  /**
+	    *
+	    * 功能描述::获取数据平台请求路径
+	    * @param requestPath 请求路径,DataRequestPathUtil中的属性值
+	    * @return
+	    * @创建者 wanghailong
+	    * @邮箱 wanghailong@persagy.com
+	    * 修改描述
+	    */
+		public String getDataPlatformPath(String requestPath) {
+			String requestUrl = null;
+			if (null == requestPath || "".equals(requestPath))
+				return requestUrl;
+			else
+				requestUrl = requestPath;
+			requestUrl = requestUrl.replace("BASEPATH", dataPlatBasePath);
+//			requestUrl = requestUrl.replace("SECRET", dataPlatDefaultSecret);
+			return requestUrl;
+		}
+		/**
+		 *
+		 * 功能描述:获取数据平台-数据字典请求路径
+		 * @param requestPath
+		 * @param param 数据字典编码
+		 * @return
+		 * @创建者 wanghailong
+		 * @邮箱 wanghailong@persagy.com
+		 * 修改描述
+		 */
+		public String getDataPlatDictPath(String requestPath , String param) {
+			String requestUrl = null;
+			if (null == requestPath || "".equals(requestPath))
+				return requestUrl;
+			else
+				requestUrl = requestPath;
+			requestUrl = requestUrl.replace("BASEPATH", dataPlatBasePath);
+			if(null != param && !"".equals(param)){
+				requestUrl = requestUrl.replace("PARAM", param);
+			}
+			return requestUrl;
+		}
+		
+	/**
+	 *
+	 * 功能描述:获取数据平台请求路径
+	 * @param requestPath  请求路径,DataRequestPathUtil中的属性值
+	 * @param projectId 项目Id,项目相关请求,path中可以不带该参数
+	 * @param secret 秘钥,项目相关请求可以使用默认秘钥,其它请求需要projectId和secret匹配
+	 * @return
+	 * @创建者 wanghailong
+	 * @邮箱 wanghailong@persagy.com 修改描述
+	 */
+//	public String getDataPlatformPath(String requestPath, String projectId, String secret) {
+//		String requestUrl = null;
+//		if (null == requestPath || "".equals(requestPath))
+//			return requestUrl;
+//		else
+//			requestUrl = requestPath;
+//		requestUrl = requestUrl.replace("BASEPATH", dataPlatBasePath);
+//		if (null != projectId && !"".equals(projectId)) {
+//			requestUrl = requestUrl.replace("PROJECTID", projectId);
+//		}
+////		if (null != secret && !"".equals(secret)) {
+////			requestUrl = requestUrl.replace("SECRET", secret);
+////		} else {
+////			requestUrl = requestUrl.replace("SECRET", dataPlatDefaultSecret);
+////		}
+//		return requestUrl;
+//	}
+	
+	/**
+	 * 获取创建自定义信息点参数中的objType
+	 * @param objId
+	 * @param objType
+	 * @param objTypeMap 暂存
+	 * @return
+	 */
+	public String getObjTypeForCtm(String objId, String objType, Map<String, String> objTypeMap) throws Exception {
+		objTypeMap = objTypeMap == null ? Maps.newHashMap() : objTypeMap;
+		String ctmObjType = objTypeMap.get(objId);
+		if(!StringUtil.isNull(ctmObjType)){
+		}else if(objType.equals(CommonConst.data_type_build)){
+			ctmObjType = "building";
+		}else if(objType.equals(CommonConst.data_type_floor)){
+			ctmObjType = "floor";
+		}else if(objType.equals(CommonConst.data_type_space)){
+			ctmObjType = "space";
+		}else if(objType.equals(CommonConst.data_type_equip)){
+			String project_id = StringUtil.transferId(objId, CommonConst.tag_project, dataPlatBasePath);
+			String params = "{\"projectId\":\""+ project_id +"\", \"criterias\":[{\"id\":\""+objId+"\"}]}";
+			String requestUrl = getDataPlatformPath(DataRequestPathUtil.dataPlat_object_batch_query);
+//			String resultStr = httpPostRequest(requestUrl, params);
+			String resultStr = httpPostRequestDataPlatform(requestUrl, params);
+			JSONObject resultJson = JSONObject.parseObject(resultStr);
+			JSONArray content = resultJson.getJSONArray(DBConst.Result.CONTENT);
+			if(content != null && content.size() != 0){
+				JSONObject item = content.getJSONObject(0);
+				JSONObject relation = item.getJSONObject("relation");
+				relation = relation == null ? new JSONObject() : relation;
+				ctmObjType = relation.getString("equipment_category");
+			}
+		}else if(objType.equals(CommonConst.data_type_equip_class)){
+			ctmObjType = objId;
+		}else if(objType.equals(CommonConst.data_type_system)){
+			String project_id = StringUtil.transferId(objId, CommonConst.tag_project, dataPlatBasePath);
+			String params = "{\"projectId\":\""+ project_id +"\", \"criterias\":[{\"id\":\""+objId+"\"}]}";
+			String requestUrl = getDataPlatformPath(DataRequestPathUtil.dataPlat_object_batch_query);
+//			String resultStr = httpPostRequest(requestUrl, params);
+			String resultStr = httpPostRequestDataPlatform(requestUrl, params);
+			JSONObject resultJson = JSONObject.parseObject(resultStr);
+			JSONArray content = resultJson.getJSONArray(Result.CONTENT);
+			if(content != null && content.size() != 0){
+				JSONObject item = content.getJSONObject(0);
+				JSONObject relation = item.getJSONObject("relation");
+				relation = relation == null ? new JSONObject() : relation;
+				ctmObjType = relation.getString("equipment_category");
+			}
+		}else if(objType.equals(CommonConst.data_type_system_class)){
+			ctmObjType = objId;
+		}
+		objTypeMap.put(objId, ctmObjType);
+		return ctmObjType;
+	}
+
+	/**
+	 * 获取信息点的id中的对象类型
+	 * @param objType	confirm_result中的对象类型
+	 * @return
+	 */
+	public String getObjTypeForInfoId(String objType) throws Exception {
+		String ctmObjType = null;
+		if(objType.equals(CommonConst.data_type_build)){
+			ctmObjType = "build";
+		}else if(objType.equals(CommonConst.data_type_floor)){
+			ctmObjType = "floor";
+		}else if(objType.equals(CommonConst.data_type_space)){
+			ctmObjType = "space";
+		}else if(objType.equals(CommonConst.data_type_equip)){
+			ctmObjType = "equip";
+		}else if(objType.equals(CommonConst.data_type_equip_class)){
+			ctmObjType = "equip";
+		}else if(objType.equals(CommonConst.data_type_system)){
+			ctmObjType = "system";
+		}else if(objType.equals(CommonConst.data_type_system_class)){
+			ctmObjType = "system";
+		}
+		return ctmObjType;
+	}
+	
+	/**
+	 * 创建自定义信息点,自定义信息点的异常信息点一定要在自定义信息点后面,返回结果的map中不存在infoPointCode的信息点表示创建失败,调用之后用返回结果中的新code替换原来的code
+	 * @param objType					对象类型,如果有多种类型的对象,分开多次调用即可
+	 * @param firstTag				自定义信息点默认的一级标签
+	 * @param unit						单位
+	 * @param dataType				数据类型,默认Str
+	 * @param customInfos				自定义信息点
+	 * @return			<调用方法传入的信息点的code, 实际在数据平台存储的code>
+	 */
+	public Map<String, String> createCustomInfos(String objType, String firstTag, String unit, String dataType, List<JSONObject> customInfos) throws Exception {
+		Map<String, String> resultMap = Maps.newHashMap();
+		//设置默认值
+		if(StringUtil.isNull(firstTag)){
+			firstTag = "反馈参数";
+		}
+		if(StringUtil.isNull(dataType)){
+			dataType = "Str";
+		}
+		//1.查询objType对象类型的自定义信息点有哪些
+		//1.1 查询方案ID
+		String schemeId = null;
+		JSONObject params = new JSONObject();
+		String paramStr = DataRequestProcessUtil.getCriteriaWithMajors(params).toJSONString();
+		String requestUrl = getDataPlatformPath(DataRequestPathUtil.dataPlat_custom_infoCode_scheme_query);
+//		String resultStr = httpPostRequest(requestUrl, paramStr);
+		String resultStr = httpPostRequestDataPlatform(requestUrl, paramStr);
+		JSONObject resultJson = JSONObject.parseObject(resultStr);
+		if(Result.FAILURE.equals(resultJson.getString(Result.RESULT))){
+			return resultMap;
+		}
+		JSONArray schemes = resultJson.getJSONArray(Result.CONTENT);
+		if(schemes == null || schemes.size() == 0){
+			return resultMap;
+		}
+		JSONObject scheme = schemes.getJSONObject(0);
+		schemeId = scheme.getString("scheme_id");
+		//1.2 已存在的信息点
+		params.put("scheme_id", schemeId);
+		params.put("obj_type", objType);
+		params.put("firstTag", firstTag);
+		paramStr = DataRequestProcessUtil.getCriteriaWithMajors(params, "scheme_id", "obj_type", "firstTag").toJSONString();
+		requestUrl = getDataPlatformPath(DataRequestPathUtil.dataPlat_custom_infoCode_scheme_info_query);
+//		resultStr = httpPostRequest(requestUrl, paramStr);
+		resultStr = httpPostRequestDataPlatform(requestUrl, paramStr);
+		resultJson = JSONObject.parseObject(resultStr);
+		if(Result.FAILURE.equals(resultJson.getString(Result.RESULT))){
+			return resultMap;
+		}
+		//信息点名称和code对照信息
+		Map<String, String> infoNameOriginalCode = DataRequestProcessUtil.getMapFromResult(resultJson, "infoPointName", "infoPointCode");
+
+		//2.补充自定义信息点,并记录信息点在数据平台的code
+		customInfos = customInfos == null ? Lists.newArrayList() : customInfos;
+		JSONObject customInfo;
+		String infoPointCode, infoPointName, mainInfoPointCode, originalInfoPointCode, inputMode;
+		for(int i=0; i<customInfos.size(); i++){
+			customInfo = customInfos.get(i);
+			infoPointCode = customInfo.getString("infoPointCode");
+			infoPointName = customInfo.getString("infoPointName");
+			mainInfoPointCode = customInfo.getString("mainInfoPointCode");
+			originalInfoPointCode = infoNameOriginalCode.getOrDefault(infoPointName, infoPointCode);
+
+			if(!StringUtil.isNull(mainInfoPointCode)){
+				if(!mainInfoPointCode.equals(resultMap.get(mainInfoPointCode))){
+					//替换自定义信息点的异常信息点的code
+					originalInfoPointCode = infoPointCode.replace(mainInfoPointCode, resultMap.get(mainInfoPointCode));
+				}
+			}
+			//记录infoPointCode的变化
+			resultMap.put(infoPointCode, originalInfoPointCode);
+
+			customInfo.put("firstTag", firstTag);
+			customInfo.put("infoPointCode", originalInfoPointCode);
+			customInfo.put("dataType", dataType);
+			customInfo.put("inputMode", getInfoPointOriginalModeFromAppMode(customInfo.getString("inputMode")));
+		}
+		//3.创建自定义信息点
+		params.clear();
+		params.put("scheme_id", schemeId);
+		params.put("obj_type", objType);
+		params.put("criterias", customInfos);
+		requestUrl = getDataPlatformPath(DataRequestPathUtil.dataPlat_custom_infoCode_scheme_info_create);
+//		resultStr = httpPostRequest(requestUrl, params.toJSONString());
+		resultStr = httpPostRequestDataPlatform(requestUrl, params.toJSONString());
+		resultJson = JSONObject.parseObject(resultStr);
+		if(Result.FAILURE.equals(resultJson.getString(Result.RESULT))){
+			resultMap.clear();
+		}
+		return resultMap;
+	}
+
+	/**
+	 * 根据自定义信息点类型转换信息点原始组件
+	 * @param appMode
+	 * @return
+	 */
+	public String getInfoPointOriginalModeFromAppMode(String appMode){
+		if(StringUtil.isNull(appMode)){
+			appMode = "default";
+		}
+		String infoPointMode = CommonMessage.customTypeInfoPointModeRels.getString(appMode);
+		if(StringUtil.isNull(infoPointMode)){
+			infoPointMode = CommonMessage.customTypeInfoPointModeRels.getString("default");
+		}
+		return infoPointMode;
+	}
+	
+}

+ 391 - 0
fm-sop/src/main/java/com/persagy/old/service/DictionaryServiceI.java

@@ -0,0 +1,391 @@
+/**
+ * @包名称 com.sagacloud.service
+ * @文件名 DictionaryServiceI.java
+ * @创建者 wanghailong
+ * @邮箱 wanghailong@persagy.com  
+ * @修改描述 
+ */
+
+package com.persagy.old.service;
+
+import com.alibaba.fastjson.JSONArray;
+
+import java.util.Map;
+
+
+/**
+ * 功能描述: 数据字典相关操作接口
+ * 
+ * @类型名称 DictionaryServiceI
+ * @创建者 wanghailong
+ * @邮箱 wanghailong@persagy.com
+ * @修改描述
+ */
+public interface DictionaryServiceI {
+	
+	/**
+	 * 
+	 * 功能描述:查询所有行政区编码
+	 * @return
+	 * @throws Exception 
+	 * @创建者 wanghailong
+	 * @邮箱 wanghailong@persagy.com 
+	 * 修改描述
+	 */
+	public Map<String, String> queryAllRegionCode() throws Exception;
+	
+	/**
+	 * 
+	 * 功能描述:查询所有气候区代码
+	 * @return
+	 * @throws Exception 
+	 * @创建者 wanghailong
+	 * @邮箱 wanghailong@persagy.com 
+	 * 修改描述
+	 */
+	public Map<String, String> queryAllClimateAreaCode() throws Exception;
+	
+	/**
+	 * 
+	 * 功能描述:查询所有发展水平代码
+	 * @return
+	 * @throws Exception 
+	 * @创建者 wanghailong
+	 * @邮箱 wanghailong@persagy.com 
+	 * 修改描述
+	 */
+	public Map<String, String> queryAllDevelopmentLevelCode() throws Exception;
+	
+	/**
+	 * 
+	 * 功能描述:查询所有设备类型
+	 * @return
+	 * @throws Exception 
+	 * @创建者 wanghailong
+	 * @邮箱 wanghailong@persagy.com 
+	 * 修改描述
+	 */
+	public String queryAllEquipmentCategory() throws Exception;
+
+	/**
+	 *
+	 * 功能描述:查询所有天气状态
+	 * @return
+	 * @throws Exception
+	 * @创建者 wanghailong
+	 * @邮箱 wanghailong@persagy.com
+	 * 修改描述
+	 */
+	public Map<String, String> queryAllWeatherStatusCode() throws Exception;
+
+	/**
+	 *
+	 * 功能描述:查询所有风力等级
+	 * @return
+	 * @throws Exception
+	 * @创建者 wanghailong
+	 * @邮箱 wanghailong@persagy.com
+	 * 修改描述
+	 */
+	public Map<String, String> queryAllWindLevelCode() throws Exception;
+
+	/**
+	 *
+	 * 功能描述:查询所有方向代码
+	 * @return
+	 * @throws Exception
+	 * @创建者 wanghailong
+	 * @邮箱 wanghailong@persagy.com
+	 * 修改描述
+	 */
+	public Map<String, String> queryAllDirectionCode() throws Exception;
+
+	
+	/**
+	 * 功能描述:数据字典:查询方位信息
+	 * @return
+	 * @throws Exception
+	 */
+	public String queryAllListDirectionCode() throws Exception;
+	
+	/**
+	 *
+	 * 功能描述:查询建筑功能类型
+	 * @return
+	 * @throws Exception
+	 * @创建者 wanghailong
+	 * @邮箱 wanghailong@persagy.com
+	 * 修改描述
+	 */
+	public Map<String, String> queryAllBuildingCode() throws Exception;
+	
+	/**
+	 * 功能描述:查询建筑功能类型
+	 * @return
+	 * @throws Exception
+	 */
+	public String queryAllListBuildingCode() throws Exception;
+	
+
+	/**
+	 *
+	 * 功能描述:查询空间功能类型
+	 * @return
+	 * @throws Exception
+	 * @创建者 wanghailong
+	 * @邮箱 wanghailong@persagy.com
+	 * 修改描述
+	 */
+	public Map<String, String> queryAllSpaceCode() throws Exception;
+	/**
+	 *
+	 * 功能描述:查询空间功能类型
+	 * @return
+	 * @throws Exception
+	 * @创建者 wanghailong
+	 * @邮箱 wanghailong@persagy.com
+	 * 修改描述
+	 */
+	public String queryAllSpaceCodeJson() throws Exception;
+
+	/**
+	 *
+	 * 功能描述:查询租赁业态类型
+	 * @return
+	 * @throws Exception
+	 * @创建者 wanghailong
+	 * @邮箱 wanghailong@persagy.com
+	 * 修改描述
+	 */
+	public String queryAllRentalCode() throws Exception;
+	
+
+	/**
+	 *
+	 * 功能描述:查询防尘等级
+	 * @return
+	 * @throws Exception
+	 * @创建者 wanghailong
+	 * @邮箱 wanghailong@persagy.com
+	 * 修改描述
+	 */
+	public String queryAllDustproofCode() throws Exception;
+
+	/**
+	 *
+	 * 功能描述:查询防水等级
+	 * @return
+	 * @throws Exception
+	 * @创建者 wanghailong
+	 * @邮箱 wanghailong@persagy.com
+	 * 修改描述
+	 */
+	public String queryAllWaterproofCode() throws Exception;
+
+	/**
+	 *
+	 * 功能描述:查询防爆设备类型
+	 * @return
+	 * @throws Exception
+	 * @创建者 wanghailong
+	 * @邮箱 wanghailong@persagy.com
+	 * 修改描述
+	 */
+	public String queryAllDangerCode() throws Exception;
+
+	/**
+	 *
+	 * 功能描述:查询防爆类型
+	 * @return
+	 * @throws Exception
+	 * @创建者 wanghailong
+	 * @邮箱 wanghailong@persagy.com
+	 * 修改描述
+	 */
+	public String queryAllExplosionproofEquipmentCode() throws Exception;
+
+	/**
+	 *
+	 * 功能描述:查询危险区域等级
+	 * @return
+	 * @throws Exception
+	 * @创建者 wanghailong
+	 * @邮箱 wanghailong@persagy.com
+	 * 修改描述
+	 */
+	public String queryAllExplosionproofGasTemperatureCode() throws Exception;
+
+	/**
+	 *
+	 * 功能描述:查询气体类型和温度类型
+	 * @return
+	 * @throws Exception
+	 * @创建者 wanghailong
+	 * @邮箱 wanghailong@persagy.com
+	 * 修改描述
+	 */
+	public String queryAllExplosionproofTypeCode() throws Exception;
+
+	/**
+	 * 功能描述:设备管理-新增页:查询专业-系统类型-设备类型
+	 * @throws Exception
+	 * @return
+	 */
+	public String queryAllEquipCategory(String jsonStr) throws Exception;
+	
+	/**
+	 * 功能描述:设备管理-新增页:查询专业-系统类型-设备类型
+	 * @throws Exception
+	 * @return
+	 */
+	public Map<String, String> queryAllEquipCategoryMap() throws Exception;
+	
+	/**
+	 * 
+	 * 功能描述:查询数据字典数据
+	 * @param name
+	 * @return 
+	 * @创建者 wanghailong
+	 * @邮箱 wanghailong@persagy.com 
+	 * 修改描述
+	 */
+	public Map<String, String> queryDictionaryDataByName(String name);
+	
+	
+
+	/**
+	 *
+	 * 功能描述:查询租赁业态类型
+	 * @return
+	 * @throws Exception
+	 * @创建者 wanghailong
+	 * @邮箱 wanghailong@persagy.com
+	 * 修改描述
+	 */
+	public Map<String, String> queryAllRentalCodeMap() throws Exception;
+	
+	/**
+	 *
+	 * 功能描述:查询抗震设防烈度
+	 * @return
+	 * @throws Exception
+	 * @创建者 wanghailong
+	 * @邮箱 wanghailong@persagy.com
+	 * 修改描述
+	 */
+	public Map<String, String> queryAllSeismicPrecautionaryIntensityCode() throws Exception;
+	
+	
+
+	/**
+	 *
+	 * 功能描述:查询防尘等级
+	 * @return
+	 * @throws Exception
+	 * @创建者 wanghailong
+	 * @邮箱 wanghailong@persagy.com
+	 * 修改描述
+	 */
+	public Map<String, String> queryAllDustproofCodeMap() throws Exception;
+	
+	
+	/**
+	 *
+	 * 功能描述:查询防水等级
+	 * @return
+	 * @throws Exception
+	 * @创建者 wanghailong
+	 * @邮箱 wanghailong@persagy.com
+	 * 修改描述
+	 */
+	public Map<String, String> queryAllWaterproofCodeMap() throws Exception;
+	
+	
+	/**
+	 *
+	 * 功能描述:查询防爆设备类型
+	 * @return
+	 * @throws Exception
+	 * @创建者 wanghailong
+	 * @邮箱 wanghailong@persagy.com
+	 * 修改描述
+	 */
+	public Map<String, String> queryAllDangerCodeMap() throws Exception;
+	
+	/**
+	 *
+	 * 功能描述:查询防爆类型
+	 * @return
+	 * @throws Exception
+	 * @创建者 wanghailong
+	 * @邮箱 wanghailong@persagy.com
+	 * 修改描述
+	 */
+	public Map<String, String> queryAllExplosionproofEquipmentCodeMap() throws Exception;
+	
+	/**
+	 *
+	 * 功能描述:查询危险区域等级
+	 * @return
+	 * @throws Exception
+	 * @创建者 wanghailong
+	 * @邮箱 wanghailong@persagy.com
+	 * 修改描述
+	 */
+	public Map<String, String> queryAllExplosionproofGasTemperatureCodeMap() throws Exception;
+	
+	/**
+	 *
+	 * 功能描述:查询气体类型和温度类型
+	 * @return
+	 * @throws Exception
+	 * @创建者 wanghailong
+	 * @邮箱 wanghailong@persagy.com
+	 * 修改描述
+	 */
+	public Map<String, String> queryAllExplosionproofTypeCodeMap() throws Exception;
+	
+	/**
+	 * 功能描述:查询污秽等级
+	 * @return
+	 * @throws Exception
+	 */
+	public Map<String, String> queryAllContaminationLevelCodeMap() throws Exception;
+	
+
+	/**
+	 * 功能描述:查询污染等级
+	 * @return
+	 * @throws Exception
+	 */
+	public Map<String, String> queryAllPollutionLevelCodeMap() throws Exception;
+	
+	/**
+	 * 功能描述:查询专业-系统类型-设备类型信息
+	 * @return
+	 * @throws Exception
+	 */
+	public Map<String, String> queryEquipmentCategory() throws Exception;
+
+	/**
+	 *
+	 * 功能描述:查询数据字典数据
+	 * @param name
+	 * @return
+	 * @创建者 wanghailong
+	 * @邮箱 wanghailong@persagy.com
+	 * 修改描述
+	 */
+	public JSONArray queryDictionaryDataForJSONArrayByName(String name) throws Exception;
+
+    /**
+     * Description: 获取init_data数据
+     *
+     * @param
+     * @return com.alibaba.fastjson.JSONArray
+     * @author: kangjun
+     * @date: 2020/1/8 11:30
+     * @version: V1.0
+     */
+    JSONArray queryDataSourceById(String init_data_id);
+}

+ 495 - 0
fm-sop/src/main/java/com/persagy/old/service/ObjectServiceI.java

@@ -0,0 +1,495 @@
+package com.persagy.old.service;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Created by guosongchao on 2017/8/16.
+ */
+public interface ObjectServiceI {
+    /**
+     * 搜索物理世界对象
+     * @param jsonStr
+     * @return
+     * @throws Exception
+     */
+    public String searchObject(String jsonStr) throws Exception;
+    /**
+     * 搜索物理世界对象大类(系统,设备,空间大类)
+     * @param jsonStr
+     * @return
+     * @throws Exception
+     */
+    public String searchObjectClass(String jsonStr) throws Exception;
+    /**
+     * 查询对象分类
+     * @param jsonStr
+     * @return
+     * @throws Exception
+     */
+    public String queryObjClassForObjSel(String jsonStr) throws Exception;
+
+    /**
+     * 查询通用系统类
+     * @param jsonStr
+     * @return
+     * @throws Exception
+     */
+    public String querySystemClass(String jsonStr) throws Exception;
+
+    /**
+     * 查询通用设备类
+     * @param jsonStr
+     * @return
+     * @throws Exception
+     */
+    public String queryEquipClass(String jsonStr) throws Exception;
+
+    /**
+     * 查询建筑体
+     * @param jsonStr
+     * @return
+     * @throws Exception
+     */
+    public String queryBuild(String jsonStr) throws Exception;
+
+    /**
+     * 查询楼层
+     * @param jsonStr
+     * @return
+     * @throws Exception
+     */
+    public String queryFloor(String jsonStr) throws Exception;
+
+    /**
+     * 查询空间
+     * @param jsonStr
+     * @return
+     * @throws Exception
+     */
+    public String querySpace(String jsonStr) throws Exception;
+
+    /**
+     * 查询系统实例
+     * @param jsonStr
+     * @return
+     * @throws Exception
+     */
+    public String querySystem(String jsonStr) throws Exception;
+
+    /**
+     * 系统专业下所有系统
+     * @param jsonStr
+     * @return
+     * @throws Exception
+     */
+    public String querySystemForSystemDomain(String jsonStr) throws Exception;
+
+    /**
+     * 查询建筑-楼层-空间列表树
+     * @param jsonStr
+     * @return
+     * @throws Exception
+     */
+    public String queryBuildFloorSpaceTree(String jsonStr) throws Exception;
+
+    /**
+     * 查询设备实例
+     * @param jsonStr
+     * @return
+     * @throws Exception
+     */
+    public String queryEquip(String jsonStr) throws Exception;
+
+    /**
+     * 查询工具、部件列表
+     * @param jsonStr
+     * @return
+     * @throws Exception
+     */
+    public String queryTempObjectList(String jsonStr) throws Exception;
+
+    /**
+     * 验证自定义对象是否已经存在
+     * @param jsonStr
+     * @return
+     * @throws Exception
+     */
+    public String existTempObjectWithType(String jsonStr) throws Exception;
+    
+    /**
+     * 添加自定义对象
+     * @param jsonStr
+     * @return
+     * @throws Exception
+     */
+    public String addBatchTempObject(String jsonStr) throws Exception;
+
+    /**
+     * 搜索信息点
+     * @param jsonStr
+     * @return
+     * @throws Exception
+     */
+    public String searchInfoPoint(String jsonStr) throws Exception;
+
+    /**
+     * 查询对象分类
+     * @param jsonStr
+     * @return
+     * @throws Exception
+     */
+    public String queryObjClassForInfoPointSel(String jsonStr) throws Exception;
+
+    /**
+     * 查询建筑下信息点
+     * @param jsonStr
+     * @return
+     * @throws Exception
+     */
+    public String queryInfoPointForBuild(String jsonStr) throws Exception;
+
+    /**
+     * 查询楼层下信息点
+     * @param jsonStr
+     * @return
+     * @throws Exception
+     */
+    public String queryInfoPointForFloor(String jsonStr) throws Exception;
+
+    /**
+     * 查询空间下信息点
+     * @param jsonStr
+     * @return
+     * @throws Exception
+     */
+    public String queryInfoPointForSpace(String jsonStr) throws Exception;
+
+    /**
+     * 查询系统下信息点
+     * @param jsonStr
+     * @return
+     * @throws Exception
+     */
+    public String queryInfoPointForSystem(String jsonStr) throws Exception;
+
+    /**
+     * 查询设备下信息点
+     * @param jsonStr
+     * @return
+     * @throws Exception
+     */
+    public String queryInfoPointForEquip(String jsonStr) throws Exception;
+
+    /**
+     * 查询系统类下信息点
+     * @param jsonStr
+     * @return
+     * @throws Exception
+     */
+    public String queryInfoPointForSystemClass(String jsonStr) throws Exception;
+    
+    /**
+     * 查询建筑下信息点
+     * @param jsonStr
+     * @return
+     * @throws Exception
+     */
+    public String queryInfoPointForBuildClass(String jsonStr) throws Exception;
+    
+    /**
+     * 查询楼层下信息点
+     * @param jsonStr
+     * @return
+     * @throws Exception
+     */
+    public String queryInfoPointForFloorClass(String jsonStr) throws Exception;
+    
+    /**
+     * 查询空间下信息点
+     * @param jsonStr
+     * @return
+     * @throws Exception
+     */
+    public String queryInfoPointForSpaceClass(String jsonStr) throws Exception;
+
+    /**
+     * 查询设备类下信息点
+     * @param jsonStr
+     * @return
+     * @throws Exception
+     */
+    public String queryInfoPointForEquipClass(String jsonStr) throws Exception;
+    /**
+     * 查询竖井下信息点
+     * @param jsonStr
+     * @return
+     * @throws Exception
+     */
+	public String queryInfoPointForShaft(String jsonStr)  throws Exception;
+    /**
+     * 
+     * Description: 根据对象ID批量查询对象
+     * @param jsonStr   对象id集合
+     * @param projectId 项目id
+     * @param valid		对象有效状态  true表示筛选可用的对象, false表示筛选已删除对象, null表示都查询
+     * @throws Exception
+     */
+    public String queryBatchObj(String jsonStr, String projectId, boolean valid) throws Exception;
+
+    /**
+     * 查询设备系统类型、信息点
+     * @param jsonStr
+     * @return
+     * @throws Exception
+     */
+    public List<String> queryBatchDomainOrInfoPoint(String jsonStr) throws Exception;
+    /**
+     * 查询所有设备空间系统类型、信息点
+     * @param jsonStr
+     * @return
+     * @throws Exception
+     */
+    public List<String> queryBatchAllDomainOrInfoPoint(String jsonStr) throws Exception;
+    
+    /**
+     * 获取对象查询结果中ID和localname的对应关系
+     * @param queryResult
+     * @return
+     */
+    public Map<String, String> getObjectIdNameMap(String queryResult);
+    
+    /**
+     * 查询数据
+     * @param requestPath
+     * @param projectId
+     * @param secret
+     * @param jsonStr
+     * @return
+     */
+    public String httpPostRequestDataPlatformPath(String requestPath, String projectId, String secret, String jsonStr) throws Exception ;
+    
+    /**
+	 * 功能描述: 获取数据平台的关系实例(单个)
+	 * @param project_id
+	 * @param secret
+	 * @param from_id
+	 * @param to_id
+	 * @param graph_id
+	 * @param rel_type
+	 * @return
+	 * @throws Exception 
+	 */
+	public JSONObject queryRelation(String project_id, String secret,
+                                    String from_id, String to_id,
+                                    String graph_id, String rel_type) throws Exception;
+    /**
+	 * 功能描述: 获取数据平台的关系实例(多个)
+	 * @param project_id
+	 * @param from_id
+	 * @param to_id
+	 * @param graph_id
+	 * @param rel_type
+	 * @return
+	 * @throws Exception
+	 */
+	public JSONArray queryRelations(String project_id, String from_id, String to_id, String graph_id, String rel_type)
+			throws Exception;
+	/**
+	 *
+	 * @param project_id
+	 * @param secret
+	 * @param jsonObject
+	 * @return
+	 * @throws Exception
+	 */
+	public JSONArray queryRelation(String project_id, String secret,
+                                   JSONArray criterias) throws Exception;
+
+	/**
+	 * 查询空间功能类型
+	 * @param jsonStr
+	 * @return
+	 */
+	public String querySpaceClass(String jsonStr) throws Exception;
+
+
+    /**
+     * @description 根据className和objCode查询实例  eg. className="equipClass" objCode="TDLS"
+     * @param projectId
+     * @param className
+     * @param objCode
+     * @return com.alibaba.fastjson.JSONArray
+     * @author feng
+     * @date 16:05 2018/5/24
+     */
+    JSONArray queryInstanceByObjType(String projectId, String className, String objCode, Map<String, String> spaceRelation) throws Exception;
+
+
+    /**
+     * @description 筛选空间下的设备
+     * @param projectId
+     * @param spaceCode
+     * @param equipmentArray
+     * @return com.alibaba.fastjson.JSONArray
+     * @author feng
+     * @date 14:27 2018/5/26
+     */
+    JSONArray filterEquipmentInSpace(String projectId, String spaceCode, JSONArray equipmentArray, Map<String, String> spaceRelationMap) throws Exception;
+
+
+    /**
+     * 筛选楼层下的设备
+     * @param projectId 项目id
+     * @param floorId 楼层id
+     * @param equipmentArray 需要筛选的设备数组
+     * @return com.alibaba.fastjson.JSONArray
+     * @throws Exception
+     */
+    JSONArray filterEquipmentInFloor(String projectId, String floorId, JSONArray equipmentArray, Map<String, String> spaceRelationMap) throws Exception;
+
+    JSONArray filterEquipmentByFloorIdentity(String projectId, String floorIdentityCode, JSONArray equipmentArray, Map<String, String> spaceRelationMap) throws Exception;
+
+    Map<String, String> getSpaceRelation(String projectId) throws Exception;
+    /**
+     * 筛选楼层下的空间
+     * @param projectId  项目id
+     * @param floorId 楼层Id
+     * @param spaceArray 需要筛选的空间
+     * @return com.alibaba.fastjson.JSONArray
+     * @throws Exception
+     */
+    JSONArray filterSapceInFloor(String projectId, String floorId, JSONArray spaceArray) throws Exception;
+
+    JSONArray filterSapceByFloorIdentity(String projectId, String floorIdentityCode, JSONArray spaceArray) throws Exception;
+
+
+    /**
+     *
+     * Description: 通过id获取对象(space,equip,floor,build等)详情
+     * @param obj_id
+     * @return String
+     * @author yuecaipu
+     * @since 2018年6月1日: 上午9:24:07
+     * Update By yuecaipu 2018年6月1日: 上午9:24:07
+     */
+	public String queryObjById(String objId, String projectId) throws Exception;
+
+	/**
+	 * 
+	 * Description: 查询楼层信息点
+	 * @param jsonObject
+	 * @return
+	 * @throws Exception String
+	 * @author yuecaipu
+	 * @since 2018年6月4日: 下午7:14:03
+	 * Update By yuecaipu 2018年6月4日: 下午7:14:03
+	 */
+	public String queryFloorInfoPointByCode(String infoPointCode) throws Exception;
+
+	/**
+	 * 
+	 * Description: 查询建筑功能类型
+	 * @param jsonObject
+	 * @return
+	 * @throws Exception String
+	 * @author yuecaipu
+	 * @since 2018年6月4日: 下午7:14:03
+	 * Update By yuecaipu 2018年6月4日: 下午7:14:03
+	 */
+	public String queryBuildFuncType() throws Exception;
+	
+	/**
+	 * 
+	 * Description: 查询竖井功能类型
+	 * @param jsonObject
+	 * @return
+	 * @throws Exception String
+	 * @author yuecaipu
+	 * @since 2018年6月4日: 下午7:14:03
+	 * Update By yuecaipu 2018年6月4日: 下午7:14:03
+	 */
+	public String queryShaftFuncType() throws Exception;
+	
+	/**
+	 * 
+	 * Description: 查询项目类型
+	 * @return
+	 * @throws Exception String
+	 * @author yuecaipu
+	 * @since 2018年10月19日: 上午9:44:57
+	 * Update By yuecaipu 2018年10月19日: 上午9:44:57
+	 */
+	public String queryProFuncType() throws Exception;
+	
+	/**
+	 * 
+	 * Description: 根据项目id获取对应的一级项目类型
+	 * @return
+	 * @throws Exception String
+	 * @author yuecaipu
+	 * @since 2018年10月19日: 上午9:44:57
+	 * Update By yuecaipu 2018年10月19日: 上午9:44:57
+	 */
+	public String queryRootProjFuncTypeById(String projectId) throws Exception;
+	  /**
+	   * 
+	   * Description: 实例化中间件:支持空间类、设备类
+	   * @param jsonObject
+	   * @return String
+	   * @author yuecaipu
+	 * @throws Exception 
+	   * @since 2018年10月19日: 下午6:45:13
+	   * Update By yuecaipu 2018年10月19日: 下午6:45:13
+	   */
+	public String convertClassToObject(JSONObject jsonObject) throws Exception;
+	/*根据空间id或设备id查关系详情(非层级结构)*/
+	public JSONArray querySpaceOrEquipNoHierarchy(String projectId, String objType, JSONArray objIds) throws Exception;
+	/**
+	 * 
+	 * Description: 数据平台 查询某个object下指定类型的objects subset_query
+	 * @param projectId
+	 * @param id
+	 * @param type
+	 * @return
+	 * @throws Exception JSONArray
+	 * @author yuecaipu
+	 * @since 2018年11月17日: 下午6:37:29
+	 * Update By yuecaipu 2018年11月17日: 下午6:37:29
+	 */
+	public JSONArray subsetQuery(String projectId, String id, String... type) throws Exception;
+	/**
+	 * Description: 获取设备类下的设备实例
+	 * @param projectId
+	 * @param equipType
+	 * @return
+	 * @throws Exception JSONArray
+	 * @author yuecaipu
+	 * @since 2018年10月26日: 下午5:51:22
+	 * Update By yuecaipu 2018年10月26日: 下午5:51:22
+	 */
+	public JSONArray queryEquipByType(String projectId, String equipType) throws Exception;
+	/**
+	 * Description: 获取空间类下的空间实例
+	 * @param projectId
+	 * @param roomFuncType
+	 * @return
+	 * @throws Exception JSONArray
+	 * @author yuecaipu
+	 * @since 2018年10月26日: 下午5:51:04
+	 * Update By yuecaipu 2018年10月26日: 下午5:51:00
+	 */
+	public JSONArray querySpaceByType(String projectId, String roomFuncType) throws Exception;
+	public String getProFuncTypeNameById(String extend_field) throws Exception;
+
+    JSONArray queryCustomInfoPointList();
+
+    boolean addCustomInfoPoint(JSONObject jsonObject);
+
+    boolean updateCustomInfoPoint(JSONObject jsonObject);
+
+    boolean delelteCustomInfoPointById(JSONObject jsonObject);
+}

+ 884 - 0
fm-sop/src/main/java/com/persagy/old/service/impl/DictionaryServiceImpl.java

@@ -0,0 +1,884 @@
+package com.persagy.old.service.impl;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.persagy.old.cache.DictionaryCache;
+import com.persagy.old.common.CommonConst;
+import com.persagy.old.common.DataRequestPathUtil;
+import com.persagy.old.common.JSONUtil;
+import com.persagy.old.common.StringUtil;
+import com.persagy.old.dao.DBCommonMethods;
+import com.persagy.old.dao.DBConst;
+import com.persagy.old.dao.DBConst.Result;
+import com.persagy.old.service.BaseService;
+import com.persagy.old.service.DictionaryServiceI;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.HashMap;
+import java.util.Map;
+
+@Service("dictionaryService")
+public class DictionaryServiceImpl extends BaseService implements DictionaryServiceI {
+
+	private static final Logger log = LoggerFactory.getLogger(DictionaryServiceImpl.class);
+	
+	@Autowired
+    private DictionaryCache dictionaryCache;
+	/**
+	 * 查询地理信息--省市信息
+	 * @return
+	 * @throws Exception
+	 */
+	public Map<String, String> queryAllRegionCode() throws Exception {
+		Map<String, String> regionMap = new HashMap<>();
+        String requestURL = this.getDataPlatDictPath(DataRequestPathUtil.dataPlat_dict_query ,"geography");
+//        String resultStr = this.httpGetRequest(requestURL);
+        String resultStr = this.httpPostRequestDataPlatform(requestURL,"{}");
+		JSONObject resultJson = JSONObject.parseObject(resultStr);
+		if("success".equals(resultJson.getString("Result"))){
+			JSONObject contentJson = resultJson.getJSONObject("Content");
+			JSONObject provinceItem, cityItem, cityInfo, districtItem;
+			JSONArray proviceArray, cityArray, cityInfoArray, districtArray;
+			//处理普通省市地区
+			proviceArray = contentJson.getJSONArray("normal");
+			if(proviceArray != null){
+				for(int i=0; i<proviceArray.size(); i++){
+					provinceItem = proviceArray.getJSONObject(i);
+					//处理市级数据
+					cityArray = provinceItem.getJSONArray("cities");
+					for(int j=0; j<cityArray.size(); j++){
+						cityItem = cityArray.getJSONObject(j);
+						cityInfoArray = cityItem.getJSONArray("cityInfo");
+						//处理市区数据
+						districtArray = cityItem.getJSONArray("district");
+						for(int k=0; k<districtArray.size(); k++){
+							districtItem = districtArray.getJSONObject(k);
+							regionMap.put(districtItem.getString("code"), districtItem.getString("districtName"));
+						}
+						//获取市级信息
+						for(int k=0; k<cityInfoArray.size(); k++){
+							cityInfo = cityInfoArray.getJSONObject(k);
+							if(!cityInfo.getString("name").contains("市本级")) {
+								regionMap.put(cityInfo.getString("code"), cityInfo.getString("name"));
+								break;
+							}
+						}
+					}
+					//处理省级数据
+					regionMap.put(StringUtil.completLengthFromRight(provinceItem.getString("provinceCode"), 6, "0"), provinceItem.getString("provinceName"));
+				}
+			}
+			//处理直辖市
+			proviceArray = contentJson.getJSONArray("specialCities");
+			if(proviceArray != null){
+				for(int i=0; i<proviceArray.size(); i++){
+					provinceItem = proviceArray.getJSONObject(i);
+					//处理市区信息
+					districtArray = provinceItem.getJSONArray("district");
+					for(int j=0; j<districtArray.size(); j++){
+						districtItem = districtArray.getJSONObject(j);
+						regionMap.put(districtItem.getString("code"), districtItem.getString("districtName"));
+					}
+					//处理市级信息
+					cityInfoArray = provinceItem.getJSONArray("cityInfo");
+					for(int j=0; j<cityInfoArray.size(); j++){
+						cityInfo = cityInfoArray.getJSONObject(j);
+						if(!cityInfo.getString("name").contains("市本级")){
+							regionMap.put(cityInfo.getString("code"), cityInfo.getString("name"));
+							break;
+						}
+					}
+				}
+			}
+		}
+		return regionMap;
+	}
+
+	/**
+	 * 查询气候区
+	 * @return
+	 * @throws Exception
+	 */
+	public Map<String, String> queryAllClimateAreaCode() throws Exception {
+		Map<String, String> climateMap = new HashMap<String, String>();
+		String requestURL = this.getDataPlatDictPath(DataRequestPathUtil.dataPlat_dict_query ,"climate");
+//		String resultStr = this.httpGetRequest(requestURL);
+		String resultStr = this.httpPostRequestDataPlatform(requestURL,"{}");
+		if(resultStr.contains(DBConst.Result.SUCCESS)){
+//			JSONObject climate, climateItem;
+//			JSONArray climateArray;
+			JSONObject climateJson = JSONObject.parseObject(resultStr);
+			JSONArray climates = climateJson.getJSONArray("Content");
+			getDictionaryCode(climateMap, climates);
+//			for(int i=0; i<climates.size(); i++){
+//				climate = climates.getJSONObject(i);
+//				climateMap.put(climate.getString("code"), climate.getString("name"));
+//				climateArray = climate.getJSONArray("content");
+//				for(int j=0; j<climateArray.size(); j++){
+//					climateItem = climateArray.getJSONObject(j);
+//					climateMap.put(climateItem.getString("code"), climateItem.getString("name"));
+//				}
+//			}
+		}
+		return climateMap;
+	}
+
+	/**
+	 * 查询发展水平
+	 * @return
+	 * @throws Exception
+	 */
+	public Map<String, String> queryAllDevelopmentLevelCode() throws Exception {
+		Map<String, String> developMap = new HashMap<String, String>();
+		String requestURL = this.getDataPlatDictPath(DataRequestPathUtil.dataPlat_dict_query ,"develop");
+//		String resultStr = this.httpGetRequest(requestURL);
+		String resultStr = this.httpPostRequestDataPlatform(requestURL,"{}");
+		if(resultStr.contains("success")){
+			JSONObject developJson = JSONObject.parseObject(resultStr);
+			JSONArray develops = developJson.getJSONArray("Content");
+			getDictionaryCode(developMap, develops);
+		}
+		return developMap;
+	}
+
+	public void getDictionaryCode(Map<String, String> dictionaryMap, JSONArray dictionarys){
+		if(dictionarys == null || dictionarys.size() == 0){
+			return;
+		}
+		JSONObject dictionary;
+		for(int i=0; i<dictionarys.size(); i++){
+			dictionary = dictionarys.getJSONObject(i);
+			dictionaryMap.put(dictionary.getString("code"), dictionary.getString("name"));
+			getDictionaryCode(dictionaryMap, dictionary.getJSONArray("content"));
+		}
+	}
+
+	/**
+	 * 查询所有设备类型的数据字典
+	 * @return
+	 * @throws Exception
+	 */
+	public String queryAllEquipmentCategory() throws Exception {
+		String requestURL = this.getDataPlatDictPath(DataRequestPathUtil.dataPlat_dict_query ,"equipment_all");
+//		String resQuery = this.httpGetRequest(requestURL);
+		String resQuery = this.httpPostRequestDataPlatform(requestURL,"{}");
+		return resQuery.replace("class", "name").replace("system", "name").replace("facility", "name");
+	}
+
+	/**
+	 * 查询天气状态
+	 * @return
+	 * @throws Exception
+	 */
+	public Map<String, String> queryAllWeatherStatusCode() throws Exception{
+		Map<String, String> weatherMap = new HashMap<String, String>();
+		String requestURL = this.getDataPlatDictPath(DataRequestPathUtil.dataPlat_dict_query ,"weather");
+//		String resultStr = this.httpGetRequest(requestURL);
+		String resultStr = this.httpPostRequestDataPlatform(requestURL,"{}");
+		if(resultStr.contains("success")){
+			JSONObject weather;
+			JSONObject weatherJson = JSONObject.parseObject(resultStr);
+			JSONArray weathers = weatherJson.getJSONArray("Content");
+			for(int i=0; i<weathers.size(); i++){
+				weather = weathers.getJSONObject(i);
+				weatherMap.put(weather.getString("code"), weather.getString("name"));
+			}
+		}
+		return weatherMap;
+	}
+
+	/**
+	 * 查询空气风力等级
+	 * @return
+	 * @throws Exception
+	 */
+	public Map<String, String> queryAllWindLevelCode() throws Exception{
+		Map<String, String> windMap = new HashMap<String, String>();
+		String requestURL = this.getDataPlatDictPath(DataRequestPathUtil.dataPlat_dict_query ,"wind");
+//		String resultStr = this.httpGetRequest(requestURL);
+		String resultStr = this.httpPostRequestDataPlatform(requestURL,"{}");
+		if(resultStr.contains("success")){
+			JSONObject wind;
+			JSONObject windJson = JSONObject.parseObject(resultStr);
+			JSONArray winds = windJson.getJSONArray("Content");
+			for(int i=0; i<winds.size(); i++){
+				wind = winds.getJSONObject(i);
+				windMap.put(wind.getString("code"), wind.getString("name"));
+			}
+		}
+		return windMap;
+	}
+
+	/**
+	 * 查询方位信息
+	 * @return
+	 * @throws Exception
+	 */
+	public Map<String, String> queryAllDirectionCode() throws Exception{
+		Map<String, String> directionMap = new HashMap<String, String>();
+		String requestURL = this.getDataPlatDictPath(DataRequestPathUtil.dataPlat_dict_query ,"direction");
+//		String resultStr = this.httpGetRequest(requestURL);
+		String resultStr = this.httpPostRequestDataPlatform(requestURL,"{}");
+		if(resultStr.contains("success")){
+			JSONObject direction;
+			JSONObject directionJson = JSONObject.parseObject(resultStr);
+			JSONArray directions = directionJson.getJSONArray("Content");
+			for(int i=0; i<directions.size(); i++){
+				direction = directions.getJSONObject(i);
+				directionMap.put(direction.getString("code"), direction.getString("name"));
+			}
+		}
+		return directionMap;
+	}
+
+	
+
+	/**
+	 * 功能描述:数据字典:查询方位信息
+	 * @return
+	 * @throws Exception
+	 */
+	@Override
+	public String queryAllListDirectionCode() throws Exception {
+		String requestURL = this.getDataPlatDictPath(DataRequestPathUtil.dataPlat_dict_query ,"direction");
+//		return this.httpGetRequest(requestURL);
+		return this.httpPostRequestDataPlatform(requestURL,"{}");
+	}
+	
+	/**
+	 * 查询建筑功能类型
+	 * @return
+	 * @throws Exception
+	 */
+	public Map<String, String> queryAllBuildingCode() throws Exception{
+		Map<String, String> buildingMap = new HashMap<String, String>();
+		String requestURL = this.getDataPlatDictPath(DataRequestPathUtil.dataPlat_dict_query ,"building");
+//		String resultStr = this.httpGetRequest(requestURL);
+		String resultStr = this.httpPostRequestDataPlatform(requestURL,"{}");
+		if(resultStr.contains("success")){
+//			JSONObject direction;
+			JSONObject directionJson = JSONObject.parseObject(resultStr);
+			JSONArray directions = directionJson.getJSONArray("Content");
+			getDictionaryCode(buildingMap, directions);
+//			for(int i=0; i<directions.size(); i++){
+//				direction = directions.getJSONObject(i);
+//				buildingMap.put(direction.getString("code"), direction.getString("name"));
+//			}
+		}
+		return buildingMap;
+	}
+	
+	/**
+	 * 功能描述:查询建筑功能类型
+	 * @return
+	 * @throws Exception
+	 */
+	@Override
+	public String queryAllListBuildingCode() throws Exception {
+		String requestURL = this.getDataPlatDictPath(DataRequestPathUtil.dataPlat_dict_query ,"building");
+//		return this.httpGetRequest(requestURL);
+		return this.httpPostRequestDataPlatform(requestURL,"{}");
+	}
+
+	/**
+	 * 查询空间功能类型
+	 * @return
+	 * @throws Exception
+	 */
+	@Override
+	public Map<String, String> queryAllSpaceCode() throws Exception{
+		Map<String, String> spaceMap = new HashMap<String, String>();
+		String requestURL = this.getDataPlatDictPath(DataRequestPathUtil.dataPlat_dict_query ,"space");
+//		String resultStr = this.httpGetRequest(requestURL);
+		String resultStr = this.httpPostRequestDataPlatform(requestURL,"{}");
+		if(resultStr.contains("success")){
+			JSONObject directionJson = JSONObject.parseObject(resultStr);
+			JSONArray directions = directionJson.getJSONArray("Content");
+			getDictionaryCode(spaceMap, directions);
+		}
+		return spaceMap;
+	}
+	/**
+	 * 查询空间功能类型
+	 * @return
+	 * @throws Exception
+	 */
+	@Override
+	public String queryAllSpaceCodeJson() throws Exception{
+		String requestURL = this.getDataPlatDictPath(DataRequestPathUtil.dataPlat_dict_query ,"space");
+//		return this.httpGetRequest(requestURL);
+		return this.httpPostRequestDataPlatform(requestURL,"{}");
+	}
+
+	/**
+	 * 查询租赁业态
+	 * @return
+	 * @throws Exception
+	 */
+	public String queryAllRentalCode() throws Exception{
+		String requestURL = this.getDataPlatDictPath(DataRequestPathUtil.dataPlat_dict_query ,"rental");
+//		return this.httpGetRequest(requestURL);
+		return this.httpPostRequestDataPlatform(requestURL,"{}");
+	}
+	
+
+    /**
+     * 查询防尘等级
+     * @return
+     * @throws Exception
+     */
+    public String queryAllDustproofCode() throws Exception {
+        String requestURL = this.getDataPlatDictPath(DataRequestPathUtil.dataPlat_dict_query ,"dustproof");
+//        return this.httpGetRequest(requestURL);
+        return this.httpPostRequestDataPlatform(requestURL,"{}");
+    }
+
+    /**
+     * 查询防水等级
+     * @return
+     * @throws Exception
+     */
+    @Override
+    public String queryAllWaterproofCode() throws Exception {
+        String requestURL = this.getDataPlatDictPath(DataRequestPathUtil.dataPlat_dict_query ,"waterproof");
+//        return this.httpGetRequest(requestURL);
+        return this.httpPostRequestDataPlatform(requestURL,"{}");
+    }
+
+    /**
+     * 查询防爆设备类型
+     * @return
+     * @throws Exception
+     */
+    public String queryAllDangerCode() throws Exception {
+        String requestURL = this.getDataPlatDictPath(DataRequestPathUtil.dataPlat_dict_query ,"danger");
+//        return this.httpGetRequest(requestURL);
+        return this.httpPostRequestDataPlatform(requestURL,"{}");
+    }
+
+    /**
+     * 查询防爆型式
+     * @return
+     * @throws Exception
+     */
+    public String queryAllExplosionproofEquipmentCode() throws Exception {
+        String requestURL = this.getDataPlatDictPath(DataRequestPathUtil.dataPlat_dict_query ,"explosionproof/equipment");
+//        return this.httpGetRequest(requestURL);
+        return this.httpPostRequestDataPlatform(requestURL,"{}");
+    }
+
+    /**
+     * 查询危险区域等级
+     * @return
+     * @throws Exception
+     */
+    public String queryAllExplosionproofGasTemperatureCode() throws Exception {
+        String requestURL = this.getDataPlatDictPath(DataRequestPathUtil.dataPlat_dict_query ,"explosionproof/gas_temperature");
+//        return this.httpGetRequest(requestURL);
+        return this.httpPostRequestDataPlatform(requestURL,"{}");
+    }
+
+    /**
+     * 查询气体类型或温度类型
+     * @return
+     * @throws Exception
+     */
+    public String queryAllExplosionproofTypeCode() throws Exception {
+        String requestURL = this.getDataPlatDictPath(DataRequestPathUtil.dataPlat_dict_query ,"explosionproof/type");
+//        return this.httpGetRequest(requestURL);
+        return this.httpPostRequestDataPlatform(requestURL,"{}");
+    }
+
+	@Override
+	public String queryAllEquipCategory(String jsonStr) throws Exception {
+		jsonStr = StringUtil.isNull(jsonStr) ? "{}" : jsonStr;
+		JSONObject jsonObject = JSONObject.parseObject(jsonStr);
+		String projectId = jsonObject.getString("project_id");
+		
+		JSONObject result = new JSONObject();
+		result.put(Result.RESULT, Result.SUCCESS);
+		JSONArray contents = new JSONArray();
+		result.put(Result.CONTENT, contents);
+		
+		//获取数据字典中 专业-系统-设备类型 树形结构
+		String requestUrl = getDataPlatDictPath(DataRequestPathUtil.dataPlat_dict_query, "equipment_all");
+		
+//		String equipmentStr = this.httpGetRequest(requestUrl);
+		String equipmentStr = this.httpPostRequestDataPlatform(requestUrl,"{}");
+//		if(StringUtil.isNull(equipmentStr)) {
+//			return result.toJSONString();
+//		}
+		JSONObject equipmentJson = JSONObject.parseObject(equipmentStr);
+		if(Result.FAILURE.equals(equipmentJson.getString(Result.RESULT))) {
+			return equipmentStr;
+		}
+		JSONArray resultContents = equipmentJson.getJSONArray(Result.CONTENT);
+		if(resultContents == null || resultContents.size() == 0) {
+			return result.toJSONString();
+		}
+		for (int i = 0; i < resultContents.size(); i++) {
+			JSONObject professionObj = resultContents.getJSONObject(i);
+			String professionCode = professionObj.getString("code");
+			String professionName = professionObj.getString("class");
+			JSONObject resultProfession = new JSONObject();
+			resultProfession.put("code", professionCode);
+			if(!StringUtil.isNull(projectId)){
+				resultProfession.put("name", dictionaryCache.getNameByTypeCode(CommonConst.dict_type_object_domain, professionCode));
+			}else{
+				resultProfession.put("name", professionName);
+			}
+			contents.add(resultProfession);
+			JSONArray systemContents = professionObj.getJSONArray("content");
+			if(systemContents == null || systemContents.size()  == 0) {
+				continue;
+			}
+			JSONArray resultProfessionContent = new JSONArray();
+			resultProfession.put("content", resultProfessionContent);
+			for (int j = 0; j < systemContents.size(); j++) {
+				JSONObject systemObj = systemContents.getJSONObject(j);
+				String systemCode = systemObj.getString("code");
+				String systemName = systemObj.getString("system");
+				JSONObject resultSystem = new JSONObject();
+				resultSystem.put("code", systemCode);
+				resultSystem.put("name", systemName);
+//				resultSystem.put("type", "system");
+				resultProfessionContent.add(resultSystem);
+				
+				JSONArray facilityContents = systemObj.getJSONArray("content");
+				if(facilityContents == null || facilityContents.size()  == 0) {
+					continue;
+				}
+				JSONArray resultSystemContent = new JSONArray();
+				resultSystem.put("content", resultSystemContent);
+				for (int k = 0; k < facilityContents.size(); k++) {
+					JSONObject facilityObj = facilityContents.getJSONObject(k);
+					String facilityCode = facilityObj.getString("code");
+					String facilityName = facilityObj.getString("facility");
+					JSONObject resultFacility = new JSONObject();
+					resultFacility.put("code", facilityCode);
+					resultFacility.put("name", facilityName);
+//					resultFacility.put("type", "equip");
+					resultSystemContent.add(resultFacility);
+				}
+			}
+			
+		}
+		
+		return result.toJSONString();
+	}
+	@Override
+	public Map<String,String> queryAllEquipCategoryMap() throws Exception {
+		Map<String, String> equipCategoryMap = new HashMap<>();
+		
+		//获取数据字典中 专业-系统-设备类型 树形结构
+		String requestUrl = getDataPlatDictPath(DataRequestPathUtil.dataPlat_dict_query, "equipment_all");
+		
+//		String equipmentStr = this.httpGetRequest(requestUrl);
+		String equipmentStr = this.httpPostRequestDataPlatform(requestUrl,"{}");
+		JSONObject equipmentJson = JSONObject.parseObject(equipmentStr);
+		if(Result.FAILURE.equals(equipmentJson.getString(Result.RESULT))) {
+			return equipCategoryMap;
+		}
+		JSONArray resultContents = equipmentJson.getJSONArray(Result.CONTENT);
+		if(resultContents == null || resultContents.size() == 0) {
+			return equipCategoryMap;
+		}
+		for (int i = 0; i < resultContents.size(); i++) {
+			JSONObject professionObj = resultContents.getJSONObject(i);
+			String professionCode = professionObj.getString("code");
+			String professionName = professionObj.getString("class");
+			equipCategoryMap.put(professionCode, professionName);
+			JSONArray systemContents = professionObj.getJSONArray("content");
+			if(systemContents == null || systemContents.size()  == 0) {
+				continue;
+			}
+			for (int j = 0; j < systemContents.size(); j++) {
+				JSONObject systemObj = systemContents.getJSONObject(j);
+				String systemCode = systemObj.getString("code");
+				String systemName = systemObj.getString("system");
+				equipCategoryMap.put(systemCode, systemName);
+				JSONArray facilityContents = systemObj.getJSONArray("content");
+				if(facilityContents == null || facilityContents.size()  == 0) {
+					continue;
+				}
+				for (int k = 0; k < facilityContents.size(); k++) {
+					JSONObject facilityObj = facilityContents.getJSONObject(k);
+					String facilityCode = facilityObj.getString("code");
+					String facilityName = facilityObj.getString("facility");
+					equipCategoryMap.put(facilityCode, facilityName);
+				}
+			}
+			
+		}
+		
+		return equipCategoryMap;
+	}
+	/**
+	 * 查询租赁业态
+	 * @return
+	 * @throws Exception
+	 */
+	@Override
+	public Map<String, String> queryAllRentalCodeMap() throws Exception{
+		Map<String, String> rentalMap = new HashMap<>();
+		String requestURL = this.getDataPlatDictPath(DataRequestPathUtil.dataPlat_dict_query ,"rental");
+//		String resultStr = this.httpGetRequest(requestURL);
+		String resultStr = this.httpPostRequestDataPlatform(requestURL,"{}");
+		if(resultStr.contains("success")){
+			JSONObject rentalJson = JSONObject.parseObject(resultStr);
+			JSONArray rentals = rentalJson.getJSONArray("Content");
+			getDictionaryCode(rentalMap, rentals);
+		}
+		return rentalMap;
+	}
+	/**
+	 * 查询抗震设防烈度
+	 * @return
+	 * @throws Exception
+	 */
+	@Override
+	public Map<String, String> queryAllSeismicPrecautionaryIntensityCode() throws Exception{
+		Map<String, String> rentalMap = new HashMap<>();
+		String requestURL = this.getDataPlatDictPath(DataRequestPathUtil.dataPlat_seismic_precautionary_intensity_query ,null);
+//		String resultStr = this.httpGetRequest(requestURL);
+		String resultStr = this.httpPostRequestDataPlatform(requestURL,"{}");
+		if(resultStr.contains("success")){
+			JSONObject direction;
+			JSONObject directionJson = JSONObject.parseObject(resultStr);
+			JSONArray directions = directionJson.getJSONArray("Content");
+			for(int i=0; i<directions.size(); i++){
+				direction = directions.getJSONObject(i);
+				rentalMap.put(direction.getString("code"), direction.getString("name"));
+			}
+		}
+		return rentalMap;
+	}
+	
+
+	  /**
+	   * 查询防尘等级
+	   * @return
+	   * @throws Exception
+	   */
+		@Override
+	  public Map<String, String> queryAllDustproofCodeMap() throws Exception {
+			Map<String, String> dustproofMap = new HashMap<>();
+	      String requestURL = this.getDataPlatDictPath(DataRequestPathUtil.dataPlat_dict_query ,"dustproof");
+//	      String resultStr = this.httpGetRequest(requestURL);
+	      String resultStr = this.httpPostRequestDataPlatform(requestURL,"{}");
+			if(resultStr.contains("success")){
+				JSONObject direction;
+				JSONObject directionJson = JSONObject.parseObject(resultStr);
+				JSONArray directions = directionJson.getJSONArray("Content");
+				for(int i=0; i<directions.size(); i++){
+					direction = directions.getJSONObject(i);
+					dustproofMap.put(direction.getString("code"), direction.getString("name"));
+				}
+			}
+			return dustproofMap;
+	  }
+	/**
+     * 查询防水等级
+     * @return
+     * @throws Exception
+     */
+    public Map<String, String> queryAllWaterproofCodeMap() throws Exception {
+    	Map<String, String> waterproofMap = new HashMap<>();
+        String requestURL = this.getDataPlatDictPath(DataRequestPathUtil.dataPlat_dict_query ,"waterproof");
+//        String resultStr = this.httpGetRequest(requestURL);
+        String resultStr = this.httpPostRequestDataPlatform(requestURL,"{}");
+		if(resultStr.contains("success")){
+			JSONObject direction;
+			JSONObject directionJson = JSONObject.parseObject(resultStr);
+			JSONArray directions = directionJson.getJSONArray("Content");
+			for(int i=0; i<directions.size(); i++){
+				direction = directions.getJSONObject(i);
+				waterproofMap.put(direction.getString("code"), direction.getString("name"));
+			}
+		}
+		return waterproofMap;
+    }
+	
+
+    /**
+     * 查询防爆设备类型
+     * @return
+     * @throws Exception
+     */
+    public Map<String, String> queryAllDangerCodeMap() throws Exception {
+    	Map<String, String> dangerTypeMap = new HashMap<>();
+        String requestURL = this.getDataPlatDictPath(DataRequestPathUtil.dataPlat_dict_query ,"danger");
+//        String resultStr = this.httpGetRequest(requestURL);
+        String resultStr = this.httpPostRequestDataPlatform(requestURL,"{}");
+		if(resultStr.contains("success")){
+			JSONObject direction;
+			JSONObject directionJson = JSONObject.parseObject(resultStr);
+			JSONArray directions = directionJson.getJSONArray("Content");
+			for(int i=0; i<directions.size(); i++){
+				direction = directions.getJSONObject(i);
+				dangerTypeMap.put(direction.getString("code"), direction.getString("name"));
+			}
+		}
+		return dangerTypeMap;
+    }
+    
+    /**
+     * 查询防爆型式
+     * @return
+     * @throws Exception
+     */
+    public Map<String, String> queryAllExplosionproofEquipmentCodeMap() throws Exception {
+    	Map<String, String> proofEquipmentMap = new HashMap<>();
+        String requestURL = this.getDataPlatDictPath(DataRequestPathUtil.dataPlat_dict_query ,"explosionproof/equipment");
+//        String resultStr = this.httpGetRequest(requestURL);
+        String resultStr = this.httpPostRequestDataPlatform(requestURL,"{}");
+		if(resultStr.contains("success")){
+			JSONObject rentalJson = JSONObject.parseObject(resultStr);
+			JSONArray rentals = rentalJson.getJSONArray("Content");
+			getDictionaryCode(proofEquipmentMap, rentals);
+		}
+		return proofEquipmentMap;
+    }
+    
+    /**
+     * 查询危险区域等级
+     * @return
+     * @throws Exception
+     */
+    public Map<String, String> queryAllExplosionproofGasTemperatureCodeMap() throws Exception {
+    	Map<String, String> gasTemperatureMap = new HashMap<>();
+        String requestURL = this.getDataPlatDictPath(DataRequestPathUtil.dataPlat_dict_query ,"explosionproof/gas_temperature");
+//        String resultStr = this.httpGetRequest(requestURL);
+        String resultStr = this.httpPostRequestDataPlatform(requestURL,"{}");
+		if(resultStr.contains("success")){
+			JSONObject direction;
+			JSONObject directionJson = JSONObject.parseObject(resultStr);
+			JSONArray directions = directionJson.getJSONArray("Content");
+			for(int i=0; i<directions.size(); i++){
+				direction = directions.getJSONObject(i);
+				gasTemperatureMap.put(direction.getString("code"), direction.getString("name"));
+			}
+		}
+		return gasTemperatureMap;
+    }
+    
+    
+
+    /**
+     * 查询气体类型或温度类型
+     * @return
+     * @throws Exception
+     */
+    public Map<String, String> queryAllExplosionproofTypeCodeMap() throws Exception {
+    	Map<String, String> proofTypeMap = new HashMap<>();
+        String requestURL = this.getDataPlatDictPath(DataRequestPathUtil.dataPlat_dict_query ,"explosionproof/type");
+//        String resultStr = this.httpGetRequest(requestURL);
+        String resultStr = this.httpPostRequestDataPlatform(requestURL,"{}");
+		if(resultStr.contains("success")){
+			JSONObject rentalJson = JSONObject.parseObject(resultStr);
+			JSONArray rentals = rentalJson.getJSONArray("Content");
+			getDictionaryCode(proofTypeMap, rentals);
+		}
+		return proofTypeMap;
+    }
+    /**
+     * 查询污秽等级
+     * @return
+     * @throws Exception
+     */
+    public Map<String, String> queryAllContaminationLevelCodeMap() throws Exception {
+    	Map<String, String> contaminationLevelMap = new HashMap<>();
+    	String requestURL = this.getDataPlatDictPath(DataRequestPathUtil.dataPlat_dict_query ,"contamination_level");
+//    	String resultStr = this.httpGetRequest(requestURL);
+    	String resultStr = this.httpPostRequestDataPlatform(requestURL,"{}");
+    	if(resultStr.contains("success")){
+    		JSONObject direction;
+    		JSONObject directionJson = JSONObject.parseObject(resultStr);
+    		JSONArray directions = directionJson.getJSONArray("Content");
+    		for(int i=0; i<directions.size(); i++){
+    			direction = directions.getJSONObject(i);
+    			contaminationLevelMap.put(direction.getString("code"), direction.getString("name"));
+    		}
+    	}
+    	return contaminationLevelMap;
+    }
+    
+
+    /**
+     * 查询污染等级
+     * @return
+     * @throws Exception
+     */
+    public Map<String, String> queryAllPollutionLevelCodeMap() throws Exception {
+    	Map<String, String> pollutionLevelMap = new HashMap<>();
+        String requestURL = this.getDataPlatDictPath(DataRequestPathUtil.dataPlat_dict_query ,"pollution_level");
+//        String resultStr = this.httpGetRequest(requestURL);
+        String resultStr = this.httpPostRequestDataPlatform(requestURL,"{}");
+		if(resultStr.contains("success")){
+			JSONObject direction;
+			JSONObject directionJson = JSONObject.parseObject(resultStr);
+			JSONArray directions = directionJson.getJSONArray("Content");
+			for(int i=0; i<directions.size(); i++){
+				direction = directions.getJSONObject(i);
+				pollutionLevelMap.put(direction.getString("code"), direction.getString("name"));
+			}
+		}
+		return pollutionLevelMap;
+    }
+    
+	/**
+	 * 
+	 * 功能描述:查询数据字典数据
+	 * @param name
+	 * @return 
+	 * @创建者 wanghailong
+	 * @邮箱 wanghailong@persagy.com 
+	 * 修改描述
+	 */
+    @Override
+	public Map<String, String> queryDictionaryDataByName(String name){
+		Map<String, String> map = null;
+		if(null == name || "".equals(name)) return map;
+		try {
+			if(name.contains("省市区代码")){
+				map = queryAllRegionCode();
+			}else if(name.contains("气候区代码")){
+				map = queryAllClimateAreaCode();
+			}else if(name.contains("天气状态")){
+				map = queryAllWeatherStatusCode();
+			}else if(name.contains("空气风力等级")){
+				map = queryAllWindLevelCode();
+			}else if(name.contains("方向代码")){
+				map = queryAllDirectionCode();
+			}else if(name.contains("建筑功能")){
+				map = queryAllBuildingCode();
+			}else if(name.contains("空间功能")){
+				map = queryAllSpaceCode();
+			}else if(name.contains("租赁业态")){
+				map = queryAllRentalCodeMap();
+			}else if(name.contains("抗震设防烈度")){
+				map = queryAllSeismicPrecautionaryIntensityCode();
+			}else if(name.contains("防尘等级")){	
+				map = queryAllDustproofCodeMap();
+			}else if(name.contains("防水等级")){
+				map = queryAllWaterproofCodeMap();
+			}else if(name.contains("防爆设备类型")){
+				map = queryAllDangerCodeMap();
+			}else if(name.contains("防爆型式")){
+				map = queryAllExplosionproofEquipmentCodeMap();
+			}else if(name.contains("危险区域等级")){
+				map = queryAllExplosionproofGasTemperatureCodeMap();
+			}else if(name.contains("气体类型") || name.contains("温度类型") ){
+				map = queryAllExplosionproofTypeCodeMap();
+			}else if(name.contains("防爆等级")){
+//				map = queryAllPollutionLevelCode();
+			}else if(name.contains("污秽等级")){
+				map = queryAllContaminationLevelCodeMap();
+			}else if(name.contains("污染等级")){
+				map = queryAllPollutionLevelCodeMap();
+			}else {
+				log.info("未查到数据字典["+name+"]的信息!");
+			}
+		} catch (Exception e) {
+			log.info("未查到数据字典["+name+"]的信息!");
+		}
+	
+		return map;
+	}
+
+	/**
+	 *
+	 * 功能描述:查询数据字典数据
+	 * @param name
+	 * @return
+	 * @throws Exception
+	 * @创建者 wanghailong
+	 * @邮箱 wanghailong@persagy.com
+	 * 修改描述
+	 */
+	@Override
+	public JSONArray queryDictionaryDataForJSONArrayByName(String name) throws Exception{
+		JSONArray array = null;
+		Map<String, String> map = queryDictionaryDataByName(name);
+		if(map != null){
+			array = new JSONArray();
+			JSONObject item;
+			for(String key : map.keySet()){
+				item = new JSONObject();
+				item.put("code", key);
+				item.put("name", map.get(key));
+				array.add(item);
+			}
+		}
+		return array;
+	}
+
+    /**
+     * Description: 获取init_data表中数据源
+     *
+     * @param
+     * @return com.alibaba.fastjson.JSONArray
+     * @author: kangjun
+     * @date: 2020/1/8 11:30
+     * @version: V1.0
+     */
+    @Override
+    public JSONArray queryDataSourceById(String init_data_id) {
+        JSONObject paramValue = new JSONObject();
+        paramValue.put("init_data_id", init_data_id);
+        String params = JSONUtil.getKeyWithMajors(paramValue, "init_data_id").toJSONString();
+        String resultStr = DBCommonMethods.getRecordBykey(DBConst.DATABASE_SAAS_NAME,DBConst.TABLE_INIT_DATA, params);
+        JSONObject resultJson = JSONObject.parseObject(resultStr);
+        JSONArray array = (JSONArray) resultJson.get(Result.CONTENT);
+        if (array.size() > 0 && null != array) {
+            JSONObject jsonObj = JSONObject.parseObject(array.get(0).toString());
+            String contentStr = jsonObj.getString("data_content");
+            return JSONArray.parseArray(contentStr);
+        }
+        return new JSONArray();
+    }
+
+    @Override
+	public Map<String, String> queryEquipmentCategory() throws Exception {
+		Map<String, String> equipmentCategoryMap = new HashMap<>();
+		String url = getDataPlatDictPath(DataRequestPathUtil.dataPlat_dict_query, "equipment_all");
+//		String queryResult = httpGetRequest(url);
+		String queryResult = httpPostRequestDataPlatform(url,"{}");
+		JSONObject queryJson = JSONObject.parseObject(queryResult);
+		if(Result.SUCCESS.equals(queryJson.getString(Result.RESULT))) {
+			JSONArray queryContents = queryJson.getJSONArray(Result.CONTENT);
+			if(queryContents != null && queryContents.size() > 0) {
+				for (int i = 0; i < queryContents.size(); i++) {
+					queryJson = queryContents.getJSONObject(i);
+					String code = queryJson.getString("code");
+					String name = queryJson.getString("class");
+					equipmentCategoryMap.put(code, name);
+					JSONArray systemContents = queryJson.getJSONArray("content");
+					if(systemContents != null && systemContents.size() > 0) {
+						for (int j = 0; j < systemContents.size(); j++) {
+							JSONObject system = systemContents.getJSONObject(j);
+							code = system.getString("code");
+							name = system.getString("system");
+							equipmentCategoryMap.put(code, name);
+							JSONArray categoryContents = system.getJSONArray("content");
+							if(categoryContents != null && categoryContents.size() > 0) {
+								for (int k = 0; k < categoryContents.size(); k++) {
+									JSONObject category = categoryContents.getJSONObject(k);
+									code = category.getString("code");
+									name = category.getString("facility");
+									equipmentCategoryMap.put(code, name);
+								}
+							}
+						}
+					}
+				}
+			}
+		}
+		return equipmentCategoryMap;
+	}
+    
+
+}

Dosya farkı çok büyük olduğundan ihmal edildi
+ 4022 - 0
fm-sop/src/main/java/com/persagy/old/service/impl/ObjectServiceImpl.java


+ 1 - 1
fm-sop/src/main/resources/bootstrap.yml

@@ -1,5 +1,5 @@
 server:
-  port: 9937
+  port: 9936
 spring: 
   application:
     name: sop

+ 3 - 2
fm-sop/src/main/test/CodeGenerator.java

@@ -55,10 +55,11 @@ public class CodeGenerator {
         strategy.setCapitalMode(true);
         strategy.setNaming(NamingStrategy.underline_to_camel);
         strategy.setColumnNaming(NamingStrategy.underline_to_camel);
-        strategy.setEntityLombokModel(true);
+        strategy.setEntityLombokModel(false);
         strategy.setRestControllerStyle(true);
         strategy.setControllerMappingHyphenStyle(true);
-        strategy.setInclude("sop","sop_sop_rel","sop_obj_rel","sop_equip_model_rel","sop_order_type_rel","sop_label_rel");
+        //strategy.setInclude("sop","sop_sop_rel","sop_obj_rel","sop_equip_model_rel","sop_order_type_rel","sop_label_rel");
+        strategy.setInclude("sop_edit");
         //strategy.setTablePrefix(pc.getModuleName() + "_");
         mpg.setStrategy(strategy);
         //mpg.setTemplateEngine(new FreemarkerTemplateEngine());