From adfeef73def3e8da801ebfc9bf0a03d042fb03d5 Mon Sep 17 00:00:00 2001
From: java110 <928255095@qq.com>
Date: 星期日, 26 四月 2020 23:09:49 +0800
Subject: [PATCH] 优化数据状态

---
 Api/src/main/java/com/java110/api/bmo/inspection/impl/InspectionBMOImpl.java |  286 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 286 insertions(+), 0 deletions(-)

diff --git a/Api/src/main/java/com/java110/api/bmo/inspection/impl/InspectionBMOImpl.java b/Api/src/main/java/com/java110/api/bmo/inspection/impl/InspectionBMOImpl.java
index ee8cc83..904d262 100644
--- a/Api/src/main/java/com/java110/api/bmo/inspection/impl/InspectionBMOImpl.java
+++ b/Api/src/main/java/com/java110/api/bmo/inspection/impl/InspectionBMOImpl.java
@@ -1,8 +1,21 @@
 package com.java110.api.bmo.inspection.impl;
 
+import com.alibaba.fastjson.JSONObject;
 import com.java110.api.bmo.ApiBaseBMO;
 import com.java110.api.bmo.inspection.IInspectionBMO;
+import com.java110.core.context.DataFlowContext;
+import com.java110.core.smo.inspectionPlan.IInspectionPlanInnerServiceSMO;
+import com.java110.core.smo.inspectionRoute.IInspectionRoutePointRelInnerServiceSMO;
+import com.java110.dto.inspectionPlan.InspectionPlanDto;
+import com.java110.dto.inspectionRoute.InspectionRoutePointRelDto;
+import com.java110.utils.constant.BusinessTypeConstant;
+import com.java110.utils.constant.CommonConstant;
+import com.java110.utils.util.Assert;
+import com.java110.utils.util.BeanConvertUtil;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+
+import java.util.List;
 
 /**
  * @ClassName InspectionBMOImpl
@@ -14,4 +27,277 @@
  **/
 @Service("inspectionBMOImpl")
 public class InspectionBMOImpl extends ApiBaseBMO implements IInspectionBMO {
+
+
+    @Autowired
+    private IInspectionPlanInnerServiceSMO inspectionPlanInnerServiceSMOImpl;
+
+    @Autowired
+    private IInspectionRoutePointRelInnerServiceSMO inspectionRoutePointRelInnerServiceSMOImpl;
+
+    /**
+     * 娣诲姞灏忓尯淇℃伅
+     *
+     * @param paramInJson     鎺ュ彛璋冪敤鏀句紶鍏ュ叆鍙�
+     * @param dataFlowContext 鏁版嵁涓婁笅鏂�
+     * @return 璁㈠崟鏈嶅姟鑳藉鎺ュ彈鐨勬姤鏂�
+     */
+    public JSONObject deleteInspectionPlan(JSONObject paramInJson, DataFlowContext dataFlowContext) {
+
+
+        JSONObject business = JSONObject.parseObject("{\"datas\":{}}");
+        business.put(CommonConstant.HTTP_BUSINESS_TYPE_CD, BusinessTypeConstant.BUSINESS_TYPE_DELETE_INSPECTION_PLAN);
+        business.put(CommonConstant.HTTP_SEQ, DEFAULT_SEQ);
+        business.put(CommonConstant.HTTP_INVOKE_MODEL, CommonConstant.HTTP_INVOKE_MODEL_S);
+        JSONObject businessInspectionPlan = new JSONObject();
+        businessInspectionPlan.putAll(paramInJson);
+        //璁$畻 搴旀敹閲戦
+        business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put("businessInspectionPlan", businessInspectionPlan);
+        return business;
+    }
+    /**
+     * 娣诲姞灏忓尯淇℃伅
+     *
+     * @param paramInJson     鎺ュ彛璋冪敤鏀句紶鍏ュ叆鍙�
+     * @param dataFlowContext 鏁版嵁涓婁笅鏂�
+     * @return 璁㈠崟鏈嶅姟鑳藉鎺ュ彈鐨勬姤鏂�
+     */
+    public JSONObject addInspectionPlan(JSONObject paramInJson, DataFlowContext dataFlowContext) {
+
+
+        JSONObject business = JSONObject.parseObject("{\"datas\":{}}");
+        business.put(CommonConstant.HTTP_BUSINESS_TYPE_CD, BusinessTypeConstant.BUSINESS_TYPE_SAVE_INSPECTION_PLAN);
+        business.put(CommonConstant.HTTP_SEQ, DEFAULT_SEQ);
+        business.put(CommonConstant.HTTP_INVOKE_MODEL, CommonConstant.HTTP_INVOKE_MODEL_S);
+        JSONObject businessInspectionPlan = new JSONObject();
+        businessInspectionPlan.putAll(paramInJson);
+        businessInspectionPlan.put("inspectionPlanId", "-1");
+        //璁$畻 搴旀敹閲戦
+        business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put("businessInspectionPlan", businessInspectionPlan);
+        return business;
+    }
+
+    /**
+     * 娣诲姞宸℃璁″垝淇℃伅
+     *
+     * @param paramInJson     鎺ュ彛璋冪敤鏀句紶鍏ュ叆鍙�
+     * @param dataFlowContext 鏁版嵁涓婁笅鏂�
+     * @return 璁㈠崟鏈嶅姟鑳藉鎺ュ彈鐨勬姤鏂�
+     */
+    public JSONObject updateInspectionPlan(JSONObject paramInJson, DataFlowContext dataFlowContext) {
+
+
+        JSONObject business = JSONObject.parseObject("{\"datas\":{}}");
+        business.put(CommonConstant.HTTP_BUSINESS_TYPE_CD, BusinessTypeConstant.BUSINESS_TYPE_UPDATE_INSPECTION_PLAN);
+        business.put(CommonConstant.HTTP_SEQ, DEFAULT_SEQ);
+        business.put(CommonConstant.HTTP_INVOKE_MODEL, CommonConstant.HTTP_INVOKE_MODEL_S);
+        JSONObject businessInspectionPlan = new JSONObject();
+        businessInspectionPlan.putAll(paramInJson);
+        //璁$畻 搴旀敹閲戦
+        business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put("businessInspectionPlan", businessInspectionPlan);
+        return business;
+    }
+
+    /**
+     * 娣诲姞璁惧淇℃伅
+     *
+     * @param paramInJson     鎺ュ彛璋冪敤鏀句紶鍏ュ叆鍙�
+     * @param dataFlowContext 鏁版嵁涓婁笅鏂�
+     * @return 璁㈠崟鏈嶅姟鑳藉鎺ュ彈鐨勬姤鏂�
+     */
+    public JSONObject updateInspectionPlanState(JSONObject paramInJson, DataFlowContext dataFlowContext) {
+
+        InspectionPlanDto inspectionPlanDto = new InspectionPlanDto();
+        inspectionPlanDto.setCommunityId(paramInJson.getString("communityId"));
+        inspectionPlanDto.setInspectionPlanId(paramInJson.getString("inspectionPlanId"));
+        List<InspectionPlanDto> inspectionPlanDtos = inspectionPlanInnerServiceSMOImpl.queryInspectionPlans(inspectionPlanDto);
+
+        Assert.listOnlyOne(inspectionPlanDtos, "鏍规嵁璁″垝ID鏌ヨ鍒板鏉¤褰曪紝璇锋鏌ユ暟鎹�");
+
+        JSONObject business = JSONObject.parseObject("{\"datas\":{}}");
+        business.put(CommonConstant.HTTP_BUSINESS_TYPE_CD, BusinessTypeConstant.BUSINESS_TYPE_UPDATE_INSPECTION_PLAN);
+        business.put(CommonConstant.HTTP_SEQ, DEFAULT_SEQ);
+        business.put(CommonConstant.HTTP_INVOKE_MODEL, CommonConstant.HTTP_INVOKE_MODEL_S);
+        JSONObject businessInspectionPlan = new JSONObject();
+        businessInspectionPlan.putAll(BeanConvertUtil.beanCovertMap(inspectionPlanDtos.get(0)));
+        businessInspectionPlan.put("state", paramInJson.getString("state"));
+        business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put("businessInspectionPlan", businessInspectionPlan);
+        return business;
+    }
+
+    /**
+     * 娣诲姞灏忓尯淇℃伅
+     *
+     * @param paramInJson     鎺ュ彛璋冪敤鏀句紶鍏ュ叆鍙�
+     * @param dataFlowContext 鏁版嵁涓婁笅鏂�
+     * @return 璁㈠崟鏈嶅姟鑳藉鎺ュ彈鐨勬姤鏂�
+     */
+    public JSONObject deleteInspectionPoint(JSONObject paramInJson, DataFlowContext dataFlowContext) {
+
+
+        JSONObject business = JSONObject.parseObject("{\"datas\":{}}");
+
+        business.put(CommonConstant.HTTP_BUSINESS_TYPE_CD, BusinessTypeConstant.BUSINESS_TYPE_DELETE_INSPECTION);
+        business.put(CommonConstant.HTTP_SEQ, DEFAULT_SEQ);
+        business.put(CommonConstant.HTTP_INVOKE_MODEL, CommonConstant.HTTP_INVOKE_MODEL_S);
+        JSONObject businessInspectionPoint = new JSONObject();
+        businessInspectionPoint.putAll(paramInJson);
+        //璁$畻 搴旀敹閲戦
+        business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put("businessInspectionPoint", businessInspectionPoint);
+        return business;
+    }
+
+    /**
+     * 娣诲姞灏忓尯淇℃伅
+     *
+     * @param paramInJson     鎺ュ彛璋冪敤鏀句紶鍏ュ叆鍙�
+     * @param dataFlowContext 鏁版嵁涓婁笅鏂�
+     * @return 璁㈠崟鏈嶅姟鑳藉鎺ュ彈鐨勬姤鏂�
+     */
+    public JSONObject addInspectionPoint(JSONObject paramInJson, DataFlowContext dataFlowContext) {
+        JSONObject business = JSONObject.parseObject("{\"datas\":{}}");
+        business.put(CommonConstant.HTTP_BUSINESS_TYPE_CD, BusinessTypeConstant.BUSINESS_TYPE_SAVE_INSPECTION);
+        business.put(CommonConstant.HTTP_SEQ, DEFAULT_SEQ);
+        business.put(CommonConstant.HTTP_INVOKE_MODEL, CommonConstant.HTTP_INVOKE_MODEL_S);
+        JSONObject businessInspectionPoint = new JSONObject();
+        businessInspectionPoint.putAll(paramInJson);
+        businessInspectionPoint.put("inspectionId", "-1");
+        //璁$畻 搴旀敹閲戦
+        business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put("businessInspectionPoint", businessInspectionPoint);
+        return business;
+    }
+
+    /**
+     * 娣诲姞宸℃鐐逛俊鎭�
+     *
+     * @param paramInJson     鎺ュ彛璋冪敤鏀句紶鍏ュ叆鍙�
+     * @param dataFlowContext 鏁版嵁涓婁笅鏂�
+     * @return 璁㈠崟鏈嶅姟鑳藉鎺ュ彈鐨勬姤鏂�
+     */
+    public JSONObject updateInspectionPoint(JSONObject paramInJson, DataFlowContext dataFlowContext) {
+
+
+        JSONObject business = JSONObject.parseObject("{\"datas\":{}}");
+        business.put(CommonConstant.HTTP_BUSINESS_TYPE_CD, BusinessTypeConstant.BUSINESS_TYPE_UPDATE_INSPECTION);
+        business.put(CommonConstant.HTTP_SEQ, DEFAULT_SEQ);
+        business.put(CommonConstant.HTTP_INVOKE_MODEL, CommonConstant.HTTP_INVOKE_MODEL_S);
+        JSONObject businessInspectionPoint = new JSONObject();
+        businessInspectionPoint.putAll(paramInJson);
+        //璁$畻 搴旀敹閲戦
+        business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put("businessInspectionPoint", businessInspectionPoint);
+        return business;
+    }
+    /**
+     * 娣诲姞灏忓尯淇℃伅
+     *
+     * @param paramInJson     鎺ュ彛璋冪敤鏀句紶鍏ュ叆鍙�
+     * @param dataFlowContext 鏁版嵁涓婁笅鏂�
+     * @return 璁㈠崟鏈嶅姟鑳藉鎺ュ彈鐨勬姤鏂�
+     */
+    public JSONObject deleteInspectionRoute(JSONObject paramInJson, DataFlowContext dataFlowContext) {
+
+
+        JSONObject business = JSONObject.parseObject("{\"datas\":{}}");
+        business.put(CommonConstant.HTTP_BUSINESS_TYPE_CD, BusinessTypeConstant.BUSINESS_TYPE_DELETE_INSPECTION_ROUTE);
+        business.put(CommonConstant.HTTP_SEQ, DEFAULT_SEQ);
+        business.put(CommonConstant.HTTP_INVOKE_MODEL, CommonConstant.HTTP_INVOKE_MODEL_S);
+        JSONObject businessInspectionRoute = new JSONObject();
+        businessInspectionRoute.putAll(paramInJson);
+        //璁$畻 搴旀敹閲戦
+        business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put("businessInspectionRoute", businessInspectionRoute);
+        return business;
+    }
+
+    /**
+     * 娣诲姞灏忓尯淇℃伅
+     *
+     * @param paramInJson     鎺ュ彛璋冪敤鏀句紶鍏ュ叆鍙�
+     * @param dataFlowContext 鏁版嵁涓婁笅鏂�
+     * @return 璁㈠崟鏈嶅姟鑳藉鎺ュ彈鐨勬姤鏂�
+     */
+    public JSONObject deleteInspectionRoutePoint(JSONObject paramInJson, DataFlowContext dataFlowContext) {
+        InspectionRoutePointRelDto inspectionRoutePointRelDto = new InspectionRoutePointRelDto();
+        inspectionRoutePointRelDto.setCommunityId(paramInJson.getString("communityId"));
+        inspectionRoutePointRelDto.setInspectionId(paramInJson.getString("inspectionId"));
+        inspectionRoutePointRelDto.setInspectionRouteId(paramInJson.getString("inspectionRouteId"));
+        List<InspectionRoutePointRelDto> inspectionRoutePointRelDtos = inspectionRoutePointRelInnerServiceSMOImpl.queryInspectionRoutePointRels(inspectionRoutePointRelDto);
+
+        Assert.listOnlyOne(inspectionRoutePointRelDtos, "鏈煡璇㈠埌锛堟垨澶氭潯锛夎鍒犻櫎鐨� 宸℃璺嚎涓嬬殑宸℃鐐�");
+
+        JSONObject business = JSONObject.parseObject("{\"datas\":{}}");
+        business.put(CommonConstant.HTTP_BUSINESS_TYPE_CD, BusinessTypeConstant.BUSINESS_TYPE_DELETE_INSPECTION_ROUTE_POINT_REL);
+        business.put(CommonConstant.HTTP_SEQ, DEFAULT_SEQ);
+        business.put(CommonConstant.HTTP_INVOKE_MODEL, CommonConstant.HTTP_INVOKE_MODEL_S);
+        JSONObject businessInspectionRoute = new JSONObject();
+        businessInspectionRoute.putAll(BeanConvertUtil.beanCovertMap(inspectionRoutePointRelDtos.get(0)));
+        //璁$畻 搴旀敹閲戦
+        business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put("businessInspectionRoutePointRel", businessInspectionRoute);
+        return business;
+    }
+
+    /**
+     * 娣诲姞灏忓尯淇℃伅
+     *
+     * @param paramInJson     鎺ュ彛璋冪敤鏀句紶鍏ュ叆鍙�
+     * @param dataFlowContext 鏁版嵁涓婁笅鏂�
+     * @return 璁㈠崟鏈嶅姟鑳藉鎺ュ彈鐨勬姤鏂�
+     */
+    public JSONObject addInspectionRoute(JSONObject paramInJson, DataFlowContext dataFlowContext) {
+
+
+        JSONObject business = JSONObject.parseObject("{\"datas\":{}}");
+        business.put(CommonConstant.HTTP_BUSINESS_TYPE_CD, BusinessTypeConstant.BUSINESS_TYPE_SAVE_INSPECTION_ROUTE);
+        business.put(CommonConstant.HTTP_SEQ, DEFAULT_SEQ);
+        business.put(CommonConstant.HTTP_INVOKE_MODEL, CommonConstant.HTTP_INVOKE_MODEL_S);
+        JSONObject businessInspectionRoute = new JSONObject();
+        businessInspectionRoute.putAll(paramInJson);
+        businessInspectionRoute.put("inspectionRouteId", "-1");
+        //璁$畻 搴旀敹閲戦
+        business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put("businessInspectionRoute", businessInspectionRoute);
+        return business;
+    }
+
+    /**
+     * 娣诲姞灏忓尯淇℃伅
+     *
+     * @param paramInJson     鎺ュ彛璋冪敤鏀句紶鍏ュ叆鍙�
+     * @param dataFlowContext 鏁版嵁涓婁笅鏂�
+     * @return 璁㈠崟鏈嶅姟鑳藉鎺ュ彈鐨勬姤鏂�
+     */
+    public JSONObject addInspectionRoute(JSONObject paramInJson, DataFlowContext dataFlowContext, int index) {
+
+
+        JSONObject business = JSONObject.parseObject("{\"datas\":{}}");
+        business.put(CommonConstant.HTTP_BUSINESS_TYPE_CD, BusinessTypeConstant.BUSINESS_TYPE_SAVE_INSPECTION_ROUTE_POINT_REL);
+        business.put(CommonConstant.HTTP_SEQ, DEFAULT_SEQ);
+        business.put(CommonConstant.HTTP_INVOKE_MODEL, CommonConstant.HTTP_INVOKE_MODEL_S);
+        JSONObject businessInspectionRoute = new JSONObject();
+        businessInspectionRoute.putAll(paramInJson);
+        businessInspectionRoute.put("irpRelId", "-" + index);
+        //璁$畻 搴旀敹閲戦
+        business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put("businessInspectionRoutePointRel", businessInspectionRoute);
+        return business;
+    }
+
+    /**
+     * 娣诲姞宸℃璺嚎淇℃伅
+     *
+     * @param paramInJson     鎺ュ彛璋冪敤鏀句紶鍏ュ叆鍙�
+     * @param dataFlowContext 鏁版嵁涓婁笅鏂�
+     * @return 璁㈠崟鏈嶅姟鑳藉鎺ュ彈鐨勬姤鏂�
+     */
+    public JSONObject updateInspectionRoute(JSONObject paramInJson, DataFlowContext dataFlowContext) {
+
+
+        JSONObject business = JSONObject.parseObject("{\"datas\":{}}");
+        business.put(CommonConstant.HTTP_BUSINESS_TYPE_CD, BusinessTypeConstant.BUSINESS_TYPE_UPDATE_INSPECTION_ROUTE);
+        business.put(CommonConstant.HTTP_SEQ, DEFAULT_SEQ);
+        business.put(CommonConstant.HTTP_INVOKE_MODEL, CommonConstant.HTTP_INVOKE_MODEL_S);
+        JSONObject businessInspectionRoute = new JSONObject();
+        businessInspectionRoute.putAll(paramInJson);
+        //璁$畻 搴旀敹閲戦
+        business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put("businessInspectionRoute", businessInspectionRoute);
+        return business;
+    }
+
 }

--
Gitblit v1.8.0