wuxw лет назад: 7
Родитель
Сommit
285c5b8f73

+ 29 - 0
PropertyService/doc/deletePropertyAttr.json

@@ -0,0 +1,29 @@
+{
+  "orders": {
+    "appId": "外系统ID,分配得到",
+    "transactionId": "100000000020180409224736000001",
+    "userId": "用户ID",
+    "orderTypeCd": "订单类型,查询,受理",
+    "requestTime": "20180409224736",
+    "remark": "备注",
+    "sign": "这个服务是否要求MD5签名",
+    "attrs": [{
+      "specCd": "配置的字段ID",
+      "value": "具体值"
+    }]
+  },
+  "business": {
+    "serviceCode": "delete.property.attr",
+    "serviceName": "删除物业属性",
+    "remark": "备注",
+    "datas": {
+      "businessPropertyAttr": [{
+        "attrId":"112018121800000002"
+      }]
+    },
+    "attrs": [{
+      "specCd": "配置的字段ID",
+      "value": "具体值"
+    }]
+  }
+}

+ 29 - 0
PropertyService/doc/deletePropertyCerdentials.json

@@ -0,0 +1,29 @@
+{
+  "orders": {
+    "appId": "外系统ID,分配得到",
+    "transactionId": "100000000020180409224736000001",
+    "userId": "用户ID",
+    "orderTypeCd": "订单类型,查询,受理",
+    "requestTime": "20180409224736",
+    "remark": "备注",
+    "sign": "这个服务是否要求MD5签名",
+    "attrs": [{
+      "specCd": "配置的字段ID",
+      "value": "具体值"
+    }]
+  },
+  "business": {
+    "serviceCode": "delete.property.cerdentials",
+    "serviceName": "删除商户证件信息",
+    "remark": "备注",
+    "datas": {
+      "businessPropertyCerdentials":[{
+        "propertyCerdentialsId":"9220181218000002"
+      }]
+    },
+    "attrs": [{
+      "specCd": "配置的字段ID",
+      "value": "具体值"
+    }]
+  }
+}

+ 33 - 0
PropertyService/doc/deletePropertyHouse.json

@@ -0,0 +1,33 @@
+{
+  "orders": {
+    "appId": "外系统ID,分配得到",
+    "transactionId": "100000000020180409224736000001",
+    "userId": "用户ID",
+    "orderTypeCd": "订单类型,查询,受理",
+    "requestTime": "20180409224736",
+    "remark": "备注",
+    "sign": "这个服务是否要求MD5签名",
+    "attrs": [{
+      "specCd": "配置的字段ID",
+      "value": "具体值"
+    }]
+  },
+  "business": {
+    "serviceCode": "delete.property.house",
+    "serviceName": "删除住户",
+    "remark": "备注",
+    "datas": {
+      "businessPropertyHouse":{
+        "houseId":"9520181222000005"
+      },
+      "businessPropertyHouseAttr": [{
+        "houseId": "9520181222000005",
+        "attrId":"112018122200000006"
+      }]
+    },
+    "attrs": [{
+      "specCd": "配置的字段ID",
+      "value": "具体值"
+    }]
+  }
+}

+ 29 - 0
PropertyService/doc/deletePropertyPhoto.json

@@ -0,0 +1,29 @@
+{
+  "orders": {
+    "appId": "外系统ID,分配得到",
+    "transactionId": "100000000020180409224736000001",
+    "userId": "用户ID",
+    "orderTypeCd": "订单类型,查询,受理",
+    "requestTime": "20180409224736",
+    "remark": "备注",
+    "sign": "这个服务是否要求MD5签名",
+    "attrs": [{
+      "specCd": "配置的字段ID",
+      "value": "具体值"
+    }]
+  },
+  "business": {
+    "serviceCode": "delete.property.photo",
+    "serviceName": "删除物业照片信息",
+    "remark": "备注",
+    "datas": {
+      "businessPropertyPhoto":[{
+        "propertyPhotoId":"12320181218000001"
+      }]
+    },
+    "attrs": [{
+      "specCd": "配置的字段ID",
+      "value": "具体值"
+    }]
+  }
+}

+ 29 - 0
PropertyService/doc/deletePropertyUser.json

@@ -0,0 +1,29 @@
+{
+  "orders": {
+    "appId": "外系统ID,分配得到",
+    "transactionId": "100000000020180409224736000001",
+    "userId": "用户ID",
+    "orderTypeCd": "订单类型,查询,受理",
+    "requestTime": "20180409224736",
+    "remark": "备注",
+    "sign": "这个服务是否要求MD5签名",
+    "attrs": [{
+      "specCd": "配置的字段ID",
+      "value": "具体值"
+    }]
+  },
+  "business": {
+    "serviceCode": "delete.property.user",
+    "serviceName": "删除住户信息",
+    "remark": "备注",
+    "datas": {
+      "businessPropertyUser":[{
+        "propertyUserId":"9320181219000001"
+      }]
+    },
+    "attrs": [{
+      "specCd": "配置的字段ID",
+      "value": "具体值"
+    }]
+  }
+}

+ 39 - 0
PropertyService/src/main/java/com/java110/property/listener/AbstractPropertyBusinessServiceDataFlowListener.java

@@ -99,6 +99,21 @@ public abstract class AbstractPropertyBusinessServiceDataFlowListener extends Ab
         businessPropertyPhoto.put("statusCd",statusCd);
     }
 
+    /**
+     * 刷新 businessPropertyPhoto 数据
+     * @param businessPropertyUser
+     * @param statusCd
+     */
+    protected void flushBusinessPropertyUser(Map businessPropertyUser,String statusCd){
+        businessPropertyUser.put("propertyId",businessPropertyUser.get("property_id"));
+        businessPropertyUser.put("propertyUserId",businessPropertyUser.get("property_user_id"));
+        businessPropertyUser.put("userId",businessPropertyUser.get("user_id"));
+        businessPropertyUser.put("relCd",businessPropertyUser.get("rel_cd"));
+        businessPropertyUser.put("newBId",businessPropertyUser.get("b_id"));
+        businessPropertyUser.put("statusCd",statusCd);
+    }
+
+
     /**
      * 刷新 businessPropertyPhoto 数据
      * @param businessPropertyFee
@@ -270,6 +285,30 @@ public abstract class AbstractPropertyBusinessServiceDataFlowListener extends Ab
         getPropertyServiceDaoImpl().saveBusinessPropertyPhoto(currentPropertyPhoto);
     }
 
+    /**
+     * 当修改数据时,查询instance表中的数据 自动保存删除数据到business中
+     * @param business
+     * @param businessPropertyUser 物业用户
+     */
+    protected void autoSaveDelBusinessPropertyUser(Business business,JSONObject businessPropertyUser){
+        Map info = new HashMap();
+        info.put("propertyUserId",businessPropertyUser.getString("propertyUserId"));
+        info.put("propertyId",businessPropertyUser.getString("propertyId"));
+        info.put("statusCd",StatusConstant.STATUS_CD_VALID);
+        List<Map> currentPropertyUsers = getPropertyServiceDaoImpl().getPropertyUser(info);
+        if(currentPropertyUsers == null || currentPropertyUsers.size() != 1){
+            throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"未找到需要修改数据信息,入参错误或数据有问题,请检查"+info);
+        }
+        Map currentPropertyUser = currentPropertyUsers.get(0);
+        currentPropertyUser.put("bId",business.getbId());
+        currentPropertyUser.put("propertyUserId",currentPropertyUser.get("property_user_id"));
+        currentPropertyUser.put("propertyId",currentPropertyUser.get("property_id"));
+        currentPropertyUser.put("userId",currentPropertyUser.get("user_id"));
+        currentPropertyUser.put("relCd",currentPropertyUser.get("rel_cd"));
+        currentPropertyUser.put("operate",StatusConstant.OPERATE_DEL);
+        getPropertyServiceDaoImpl().saveBusinessPropertyUser(currentPropertyUser);
+    }
+
     /**
      * 当修改数据时,查询instance表中的数据 自动保存删除数据到business中
      * @param business

+ 153 - 0
PropertyService/src/main/java/com/java110/property/listener/DeletePropertyAttrListener.java

@@ -0,0 +1,153 @@
+package com.java110.property.listener;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.java110.common.constant.ResponseConstant;
+import com.java110.common.constant.ServiceCodeConstant;
+import com.java110.common.constant.StatusConstant;
+import com.java110.common.exception.ListenerExecuteException;
+import com.java110.common.util.Assert;
+import com.java110.core.annotation.Java110Listener;
+import com.java110.core.context.DataFlowContext;
+import com.java110.entity.center.Business;
+import com.java110.property.dao.IPropertyServiceDao;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 删除物业信息 侦听
+ *
+ * 处理节点
+ * 1、businessPropertyHouse:{} 物业住户信息节点
+ * 2、businessPropertyAttr:[{}] 物业属性信息节点
+ * Created by wuxw on 2018/5/18.
+ */
+@Java110Listener("deletePropertyAttrListener")
+@Transactional
+public class DeletePropertyAttrListener extends AbstractPropertyBusinessServiceDataFlowListener {
+
+    private final static Logger logger = LoggerFactory.getLogger(DeletePropertyAttrListener.class);
+    @Autowired
+    IPropertyServiceDao propertyServiceDaoImpl;
+
+    @Override
+    public int getOrder() {
+        return 3;
+    }
+
+    @Override
+    public String getServiceCode() {
+        return ServiceCodeConstant.SERVICE_CODE_DELETE_PROPERTY_ATTR;
+    }
+
+    /**
+     * 根据删除信息 查出Instance表中数据 保存至business表 (状态写DEL) 方便撤单时直接更新回去
+     * @param dataFlowContext 数据对象
+     * @param business 当前业务对象
+     */
+    @Override
+    protected void doSaveBusiness(DataFlowContext dataFlowContext, Business business) {
+        JSONObject data = business.getDatas();
+
+        Assert.notEmpty(data,"没有datas 节点,或没有子节点需要处理");
+
+        if(data.containsKey("businessPropertyAttr")){
+            JSONArray businessPropertyAttrs = data.getJSONArray("businessPropertyAttr");
+            doSaveBusinessPropertyAttrs(business,businessPropertyAttrs);
+        }
+    }
+
+    /**
+     * 删除 instance数据
+     * @param dataFlowContext 数据对象
+     * @param business 当前业务对象
+     */
+    @Override
+    protected void doBusinessToInstance(DataFlowContext dataFlowContext, Business business) {
+        String bId = business.getbId();
+        //Assert.hasLength(bId,"请求报文中没有包含 bId");
+
+        //物业信息
+        Map info = new HashMap();
+        info.put("bId",business.getbId());
+        info.put("operate",StatusConstant.OPERATE_DEL);
+
+        //物业属性
+        List<Map> businessPropertyAttrs = propertyServiceDaoImpl.getBusinessPropertyAttrs(info);
+        if(businessPropertyAttrs != null && businessPropertyAttrs.size() > 0) {
+            for(Map businessPropertyAttr : businessPropertyAttrs) {
+                flushBusinessPropertyAttr(businessPropertyAttr,StatusConstant.STATUS_CD_INVALID);
+                propertyServiceDaoImpl.updatePropertyAttrInstance(businessPropertyAttr);
+            }
+        }
+    }
+
+    /**
+     * 撤单
+     * 从business表中查询到DEL的数据 将instance中的数据更新回来
+     * @param dataFlowContext 数据对象
+     * @param business 当前业务对象
+     */
+    @Override
+    protected void doRecover(DataFlowContext dataFlowContext, Business business) {
+        String bId = business.getbId();
+        //Assert.hasLength(bId,"请求报文中没有包含 bId");
+        Map info = new HashMap();
+        info.put("bId",bId);
+        info.put("statusCd",StatusConstant.STATUS_CD_INVALID);
+
+        Map delInfo = new HashMap();
+        delInfo.put("bId",business.getbId());
+        delInfo.put("operate",StatusConstant.OPERATE_DEL);
+
+        //物业属性
+        List<Map> propertyAttrs = propertyServiceDaoImpl.getPropertyAttrs(info);
+        if(propertyAttrs != null && propertyAttrs.size()>0){
+
+            List<Map> businessPropertyAttrs = propertyServiceDaoImpl.getBusinessPropertyAttrs(delInfo);
+            //除非程序出错了,这里不会为空
+            if(businessPropertyAttrs == null || businessPropertyAttrs.size() ==0 ){
+                throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR,"撤单失败(property_attr),程序内部异常,请检查! "+delInfo);
+            }
+            for(Map businessPropertyAttr : businessPropertyAttrs) {
+                flushBusinessPropertyAttr(businessPropertyAttr,StatusConstant.STATUS_CD_VALID);
+                propertyServiceDaoImpl.updatePropertyAttrInstance(businessPropertyAttr);
+            }
+        }
+    }
+
+
+
+    /**
+     * 保存物业属性信息
+     * @param business 当前业务
+     * @param businessPropertyAttrs 物业属性
+     */
+    private void doSaveBusinessPropertyAttrs(Business business,JSONArray businessPropertyAttrs){
+        JSONObject data = business.getDatas();
+
+        for(int propertyAttrIndex = 0 ; propertyAttrIndex < businessPropertyAttrs.size();propertyAttrIndex ++){
+            JSONObject propertyAttr = businessPropertyAttrs.getJSONObject(propertyAttrIndex);
+            Assert.jsonObjectHaveKey(propertyAttr,"attrId","businessPropertyAttr 节点下没有包含 attrId 节点");
+            if(propertyAttr.getString("attrId").startsWith("-")){
+                throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"attrId 错误,不能自动生成(必须已经存在的attrId)"+propertyAttr);
+            }
+
+            autoSaveDelBusinessPropertyAttr(business,propertyAttr);
+        }
+    }
+
+    public IPropertyServiceDao getPropertyServiceDaoImpl() {
+        return propertyServiceDaoImpl;
+    }
+
+    public void setPropertyServiceDaoImpl(IPropertyServiceDao propertyServiceDaoImpl) {
+        this.propertyServiceDaoImpl = propertyServiceDaoImpl;
+    }
+}

+ 2 - 142
PropertyService/src/main/java/com/java110/property/listener/DeletePropertyCerdentialsListener.java

@@ -60,23 +60,6 @@ public class DeletePropertyCerdentialsListener extends AbstractPropertyBusinessS
 
         Assert.notEmpty(data,"没有datas 节点,或没有子节点需要处理");
 
-        //处理 businessProperty 节点 按理这里不应该处理,程序上支持,以防真有这种业务
-        if(data.containsKey("businessProperty")){
-            JSONObject businessProperty = data.getJSONObject("businessProperty");
-            doBusinessProperty(business,businessProperty);
-            dataFlowContext.addParamOut("propertyId",businessProperty.getString("propertyId"));
-        }
-
-        if(data.containsKey("businessPropertyAttr")){
-            JSONArray businessPropertyAttrs = data.getJSONArray("businessPropertyAttr");
-            doSaveBusinessPropertyAttrs(business,businessPropertyAttrs);
-        }
-
-        if(data.containsKey("businessPropertyPhoto")){
-            JSONArray businessPropertyPhotos = data.getJSONArray("businessPropertyPhoto");
-            doBusinessPropertyPhoto(business,businessPropertyPhotos);
-        }
-
         if(data.containsKey("businessPropertyCerdentials")){
             JSONArray businessPropertyCerdentialses = data.getJSONArray("businessPropertyCerdentials");
             doBusinessPropertyCerdentials(business,businessPropertyCerdentialses);
@@ -98,29 +81,6 @@ public class DeletePropertyCerdentialsListener extends AbstractPropertyBusinessS
         info.put("bId",business.getbId());
         info.put("operate",StatusConstant.OPERATE_DEL);
 
-        //物业信息
-        Map businessPropertyInfo = propertyServiceDaoImpl.getBusinessPropertyInfo(info);
-        if( businessPropertyInfo != null && !businessPropertyInfo.isEmpty()) {
-            flushBusinessPropertyInfo(businessPropertyInfo,StatusConstant.STATUS_CD_INVALID);
-            propertyServiceDaoImpl.updatePropertyInfoInstance(businessPropertyInfo);
-            dataFlowContext.addParamOut("propertyId",businessPropertyInfo.get("property_id"));
-        }
-        //物业属性
-        List<Map> businessPropertyAttrs = propertyServiceDaoImpl.getBusinessPropertyAttrs(info);
-        if(businessPropertyAttrs != null && businessPropertyAttrs.size() > 0) {
-            for(Map businessPropertyAttr : businessPropertyAttrs) {
-                flushBusinessPropertyAttr(businessPropertyAttr,StatusConstant.STATUS_CD_INVALID);
-                propertyServiceDaoImpl.updatePropertyAttrInstance(businessPropertyAttr);
-            }
-        }
-        //物业照片
-        List<Map> businessPropertyPhotos = propertyServiceDaoImpl.getBusinessPropertyPhoto(info);
-        if(businessPropertyPhotos != null && businessPropertyPhotos.size() >0){
-            for(Map businessPropertyPhoto : businessPropertyPhotos) {
-                flushBusinessPropertyPhoto(businessPropertyPhoto,StatusConstant.STATUS_CD_INVALID);
-                propertyServiceDaoImpl.updatePropertyPhotoInstance(businessPropertyPhoto);
-            }
-        }
         //物业证件
         List<Map> businessPropertyCerdentialses = propertyServiceDaoImpl.getBusinessPropertyCerdentials(info);
         if(businessPropertyCerdentialses != null && businessPropertyCerdentialses.size()>0){
@@ -148,50 +108,6 @@ public class DeletePropertyCerdentialsListener extends AbstractPropertyBusinessS
         Map delInfo = new HashMap();
         delInfo.put("bId",business.getbId());
         delInfo.put("operate",StatusConstant.OPERATE_DEL);
-        //物业信息
-        Map propertyInfo = propertyServiceDaoImpl.getPropertyInfo(info);
-        if(propertyInfo != null && !propertyInfo.isEmpty()){
-
-            //物业信息
-            Map businessPropertyInfo = propertyServiceDaoImpl.getBusinessPropertyInfo(delInfo);
-            //除非程序出错了,这里不会为空
-            if(businessPropertyInfo == null || businessPropertyInfo.isEmpty()){
-                throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR,"撤单失败(property),程序内部异常,请检查! "+delInfo);
-            }
-
-            flushBusinessPropertyInfo(businessPropertyInfo,StatusConstant.STATUS_CD_VALID);
-            propertyServiceDaoImpl.updatePropertyInfoInstance(businessPropertyInfo);
-            dataFlowContext.addParamOut("propertyId",propertyInfo.get("property_id"));
-        }
-
-        //物业属性
-        List<Map> propertyAttrs = propertyServiceDaoImpl.getPropertyAttrs(info);
-        if(propertyAttrs != null && propertyAttrs.size()>0){
-
-            List<Map> businessPropertyAttrs = propertyServiceDaoImpl.getBusinessPropertyAttrs(delInfo);
-            //除非程序出错了,这里不会为空
-            if(businessPropertyAttrs == null || businessPropertyAttrs.size() ==0 ){
-                throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR,"撤单失败(property_attr),程序内部异常,请检查! "+delInfo);
-            }
-            for(Map businessPropertyAttr : businessPropertyAttrs) {
-                flushBusinessPropertyAttr(businessPropertyAttr,StatusConstant.STATUS_CD_VALID);
-                propertyServiceDaoImpl.updatePropertyAttrInstance(businessPropertyAttr);
-            }
-        }
-
-        //物业照片
-        List<Map> propertyPhotos = propertyServiceDaoImpl.getPropertyPhoto(info);
-        if(propertyPhotos != null && propertyPhotos.size()>0){
-            List<Map> businessPropertyPhotos = propertyServiceDaoImpl.getBusinessPropertyPhoto(delInfo);
-            //除非程序出错了,这里不会为空
-            if(businessPropertyPhotos == null || businessPropertyPhotos.size() ==0 ){
-                throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR,"撤单失败(property_photo),程序内部异常,请检查! "+delInfo);
-            }
-            for(Map businessPropertyPhoto : businessPropertyPhotos) {
-                flushBusinessPropertyPhoto(businessPropertyPhoto,StatusConstant.STATUS_CD_VALID);
-                propertyServiceDaoImpl.updatePropertyPhotoInstance(businessPropertyPhoto);
-            }
-        }
 
         //物业属性
         List<Map> propertyCerdentialses = propertyServiceDaoImpl.getPropertyCerdentials(info);
@@ -208,61 +124,6 @@ public class DeletePropertyCerdentialsListener extends AbstractPropertyBusinessS
         }
     }
 
-    /**
-     * 保存物业照片
-     * @param business 业务对象
-     * @param businessPropertyPhotos 物业照片
-     */
-    private void doBusinessPropertyPhoto(Business business, JSONArray businessPropertyPhotos) {
-
-        for(int businessPropertyPhotoIndex = 0 ;businessPropertyPhotoIndex < businessPropertyPhotos.size();businessPropertyPhotoIndex++) {
-            JSONObject businessPropertyPhoto = businessPropertyPhotos.getJSONObject(businessPropertyPhotoIndex);
-            Assert.jsonObjectHaveKey(businessPropertyPhoto, "propertyId", "businessPropertyPhoto 节点下没有包含 propertyId 节点");
-
-            if (businessPropertyPhoto.getString("propertyPhotoId").startsWith("-")) {
-                throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"propertyPhotoId 错误,不能自动生成(必须已经存在的propertyPhotoId)"+businessPropertyPhoto);
-            }
-
-            autoSaveDelBusinessPropertyPhoto(business,businessPropertyPhoto);
-        }
-    }
-
-    /**
-     * 处理 businessProperty 节点
-     * @param business 总的数据节点
-     * @param businessProperty 物业节点
-     */
-    private void doBusinessProperty(Business business,JSONObject businessProperty){
-
-        Assert.jsonObjectHaveKey(businessProperty,"propertyId","businessProperty 节点下没有包含 propertyId 节点");
-
-        if(businessProperty.getString("propertyId").startsWith("-")){
-            throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"propertyId 错误,不能自动生成(必须已经存在的propertyId)"+businessProperty);
-        }
-        //自动插入DEL
-        autoSaveDelBusinessProperty(business,businessProperty);
-    }
-
-
-
-    /**
-     * 保存物业属性信息
-     * @param business 当前业务
-     * @param businessPropertyAttrs 物业属性
-     */
-    private void doSaveBusinessPropertyAttrs(Business business,JSONArray businessPropertyAttrs){
-        JSONObject data = business.getDatas();
-
-        for(int propertyAttrIndex = 0 ; propertyAttrIndex < businessPropertyAttrs.size();propertyAttrIndex ++){
-            JSONObject propertyAttr = businessPropertyAttrs.getJSONObject(propertyAttrIndex);
-            Assert.jsonObjectHaveKey(propertyAttr,"attrId","businessPropertyAttr 节点下没有包含 attrId 节点");
-            if(propertyAttr.getString("attrId").startsWith("-")){
-                throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"attrId 错误,不能自动生成(必须已经存在的attrId)"+propertyAttr);
-            }
-
-            autoSaveDelBusinessPropertyAttr(business,propertyAttr);
-        }
-    }
 
 
     /**
@@ -272,11 +133,10 @@ public class DeletePropertyCerdentialsListener extends AbstractPropertyBusinessS
      */
     private void doBusinessPropertyCerdentials(Business business, JSONArray businessPropertyCerdentialses) {
 
-        Map info = null;
-        Map currentPropertyCerdentials = null;
+
         for(int businessPropertyCerdentialsIndex = 0 ; businessPropertyCerdentialsIndex < businessPropertyCerdentialses.size() ; businessPropertyCerdentialsIndex ++) {
             JSONObject businessPropertyCerdentials = businessPropertyCerdentialses.getJSONObject(businessPropertyCerdentialsIndex);
-            Assert.jsonObjectHaveKey(businessPropertyCerdentials, "propertyId", "businessPropertyPhoto 节点下没有包含 propertyId 节点");
+            Assert.jsonObjectHaveKey(businessPropertyCerdentials, "propertyCerdentialsId", "businessPropertyPhoto 节点下没有包含 propertyCerdentialsId 节点");
 
             if (businessPropertyCerdentials.getString("propertyCerdentialsId").startsWith("-")) {
                 throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"propertyPhotoId 错误,不能自动生成(必须已经存在的propertyPhotoId)"+businessPropertyCerdentials);

+ 45 - 143
PropertyService/src/main/java/com/java110/property/listener/DeletePropertyHouseListener.java

@@ -24,11 +24,8 @@ import java.util.Map;
  * 删除物业信息 侦听
  *
  * 处理节点
- * 1、businessProperty:{} 物业基本信息节点
- * 2、businessPropertyAttr:[{}] 物业属性信息节点
- * 3、businessPropertyPhoto:[{}] 物业照片信息节点
- * 4、businessPropertyCerdentials:[{}] 物业证件信息节点
- * 协议地址 :https://github.com/java110/MicroCommunity/wiki/%E5%88%A0%E9%99%A4%E5%95%86%E6%88%B7%E4%BF%A1%E6%81%AF-%E5%8D%8F%E8%AE%AE
+ * 1、businessPropertyHouse:{} 物业住户信息节点
+ * 2、businessPropertyHouseAttr:[{}] 物业属性信息节点
  * Created by wuxw on 2018/5/18.
  */
 @Java110Listener("deletePropertyHouseListener")
@@ -60,26 +57,16 @@ public class DeletePropertyHouseListener extends AbstractPropertyBusinessService
 
         Assert.notEmpty(data,"没有datas 节点,或没有子节点需要处理");
 
-        //处理 businessProperty 节点 按理这里不应该处理,程序上支持,以防真有这种业务
-        if(data.containsKey("businessProperty")){
-            JSONObject businessProperty = data.getJSONObject("businessProperty");
-            doBusinessProperty(business,businessProperty);
-            dataFlowContext.addParamOut("propertyId",businessProperty.getString("propertyId"));
+        //处理 businessPropertyHouse 节点 按理这里不应该处理,程序上支持,以防真有这种业务
+        if(data.containsKey("businessPropertyHouse")){
+            JSONObject businessPropertyHouse = data.getJSONObject("businessPropertyHouse");
+            doBusinessPropertyHouse(business,businessPropertyHouse);
+            dataFlowContext.addParamOut("houseId",businessPropertyHouse.getString("houseId"));
         }
 
-        if(data.containsKey("businessPropertyAttr")){
-            JSONArray businessPropertyAttrs = data.getJSONArray("businessPropertyAttr");
-            doSaveBusinessPropertyAttrs(business,businessPropertyAttrs);
-        }
-
-        if(data.containsKey("businessPropertyPhoto")){
-            JSONArray businessPropertyPhotos = data.getJSONArray("businessPropertyPhoto");
-            doBusinessPropertyPhoto(business,businessPropertyPhotos);
-        }
-
-        if(data.containsKey("businessPropertyCerdentials")){
-            JSONArray businessPropertyCerdentialses = data.getJSONArray("businessPropertyCerdentials");
-            doBusinessPropertyCerdentials(business,businessPropertyCerdentialses);
+        if(data.containsKey("businessPropertyHouseAttr")){
+            JSONArray businessPropertyHouseAttrs = data.getJSONArray("businessPropertyHouseAttr");
+            doSaveBusinessPropertyHouseAttrs(business,businessPropertyHouseAttrs);
         }
     }
 
@@ -99,34 +86,18 @@ public class DeletePropertyHouseListener extends AbstractPropertyBusinessService
         info.put("operate",StatusConstant.OPERATE_DEL);
 
         //物业信息
-        Map businessPropertyInfo = propertyServiceDaoImpl.getBusinessPropertyInfo(info);
-        if( businessPropertyInfo != null && !businessPropertyInfo.isEmpty()) {
-            flushBusinessPropertyInfo(businessPropertyInfo,StatusConstant.STATUS_CD_INVALID);
-            propertyServiceDaoImpl.updatePropertyInfoInstance(businessPropertyInfo);
-            dataFlowContext.addParamOut("propertyId",businessPropertyInfo.get("property_id"));
+        Map businessPropertyHouseInfo = propertyServiceDaoImpl.getBusinessPropertyHouse(info);
+        if( businessPropertyHouseInfo != null && !businessPropertyHouseInfo.isEmpty()) {
+            flushBusinessPropertyHouse(businessPropertyHouseInfo,StatusConstant.STATUS_CD_INVALID);
+            propertyServiceDaoImpl.updatePropertyHouseInstance(businessPropertyHouseInfo);
+            dataFlowContext.addParamOut("houseId",businessPropertyHouseInfo.get("house_id"));
         }
         //物业属性
-        List<Map> businessPropertyAttrs = propertyServiceDaoImpl.getBusinessPropertyAttrs(info);
-        if(businessPropertyAttrs != null && businessPropertyAttrs.size() > 0) {
-            for(Map businessPropertyAttr : businessPropertyAttrs) {
-                flushBusinessPropertyAttr(businessPropertyAttr,StatusConstant.STATUS_CD_INVALID);
-                propertyServiceDaoImpl.updatePropertyAttrInstance(businessPropertyAttr);
-            }
-        }
-        //物业照片
-        List<Map> businessPropertyPhotos = propertyServiceDaoImpl.getBusinessPropertyPhoto(info);
-        if(businessPropertyPhotos != null && businessPropertyPhotos.size() >0){
-            for(Map businessPropertyPhoto : businessPropertyPhotos) {
-                flushBusinessPropertyPhoto(businessPropertyPhoto,StatusConstant.STATUS_CD_INVALID);
-                propertyServiceDaoImpl.updatePropertyPhotoInstance(businessPropertyPhoto);
-            }
-        }
-        //物业证件
-        List<Map> businessPropertyCerdentialses = propertyServiceDaoImpl.getBusinessPropertyCerdentials(info);
-        if(businessPropertyCerdentialses != null && businessPropertyCerdentialses.size()>0){
-            for(Map businessPropertyCerdentials : businessPropertyCerdentialses) {
-                flushBusinessPropertyCredentials(businessPropertyCerdentials,StatusConstant.STATUS_CD_INVALID);
-                propertyServiceDaoImpl.updatePropertyCerdentailsInstance(businessPropertyCerdentials);
+        List<Map> businessPropertyHouseAttrs = propertyServiceDaoImpl.getBusinessPropertyHouseAttrs(info);
+        if(businessPropertyHouseAttrs != null && businessPropertyHouseAttrs.size() > 0) {
+            for(Map businessPropertyHouseAttr : businessPropertyHouseAttrs) {
+                flushBusinessPropertyHouseAttr(businessPropertyHouseAttr,StatusConstant.STATUS_CD_INVALID);
+                propertyServiceDaoImpl.updatePropertyHouseAttrInstance(businessPropertyHouseAttr);
             }
         }
     }
@@ -153,94 +124,47 @@ public class DeletePropertyHouseListener extends AbstractPropertyBusinessService
         if(propertyInfo != null && !propertyInfo.isEmpty()){
 
             //物业信息
-            Map businessPropertyInfo = propertyServiceDaoImpl.getBusinessPropertyInfo(delInfo);
+            Map businessPropertyHouseInfo = propertyServiceDaoImpl.getBusinessPropertyHouse(delInfo);
             //除非程序出错了,这里不会为空
-            if(businessPropertyInfo == null || businessPropertyInfo.isEmpty()){
-                throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR,"撤单失败(property),程序内部异常,请检查! "+delInfo);
+            if(businessPropertyHouseInfo == null || businessPropertyHouseInfo.isEmpty()){
+                throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR,"撤单失败(house),程序内部异常,请检查! "+delInfo);
             }
 
-            flushBusinessPropertyInfo(businessPropertyInfo,StatusConstant.STATUS_CD_VALID);
-            propertyServiceDaoImpl.updatePropertyInfoInstance(businessPropertyInfo);
-            dataFlowContext.addParamOut("propertyId",propertyInfo.get("property_id"));
+            flushBusinessPropertyHouse(businessPropertyHouseInfo,StatusConstant.STATUS_CD_VALID);
+            propertyServiceDaoImpl.updatePropertyHouseInstance(businessPropertyHouseInfo);
+            dataFlowContext.addParamOut("houseId",propertyInfo.get("house_id"));
         }
 
         //物业属性
-        List<Map> propertyAttrs = propertyServiceDaoImpl.getPropertyAttrs(info);
+        List<Map> propertyAttrs = propertyServiceDaoImpl.getPropertyHouseAttrs(info);
         if(propertyAttrs != null && propertyAttrs.size()>0){
 
-            List<Map> businessPropertyAttrs = propertyServiceDaoImpl.getBusinessPropertyAttrs(delInfo);
+            List<Map> businessPropertyHouseAttrs = propertyServiceDaoImpl.getBusinessPropertyHouseAttrs(delInfo);
             //除非程序出错了,这里不会为空
-            if(businessPropertyAttrs == null || businessPropertyAttrs.size() ==0 ){
+            if(businessPropertyHouseAttrs == null || businessPropertyHouseAttrs.size() ==0 ){
                 throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR,"撤单失败(property_attr),程序内部异常,请检查! "+delInfo);
             }
-            for(Map businessPropertyAttr : businessPropertyAttrs) {
-                flushBusinessPropertyAttr(businessPropertyAttr,StatusConstant.STATUS_CD_VALID);
-                propertyServiceDaoImpl.updatePropertyAttrInstance(businessPropertyAttr);
-            }
-        }
-
-        //物业照片
-        List<Map> propertyPhotos = propertyServiceDaoImpl.getPropertyPhoto(info);
-        if(propertyPhotos != null && propertyPhotos.size()>0){
-            List<Map> businessPropertyPhotos = propertyServiceDaoImpl.getBusinessPropertyPhoto(delInfo);
-            //除非程序出错了,这里不会为空
-            if(businessPropertyPhotos == null || businessPropertyPhotos.size() ==0 ){
-                throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR,"撤单失败(property_photo),程序内部异常,请检查! "+delInfo);
-            }
-            for(Map businessPropertyPhoto : businessPropertyPhotos) {
-                flushBusinessPropertyPhoto(businessPropertyPhoto,StatusConstant.STATUS_CD_VALID);
-                propertyServiceDaoImpl.updatePropertyPhotoInstance(businessPropertyPhoto);
-            }
-        }
-
-        //物业属性
-        List<Map> propertyCerdentialses = propertyServiceDaoImpl.getPropertyCerdentials(info);
-        if(propertyCerdentialses != null && propertyCerdentialses.size()>0){
-            List<Map> businessPropertyCerdentialses = propertyServiceDaoImpl.getBusinessPropertyCerdentials(delInfo);
-            //除非程序出错了,这里不会为空
-            if(businessPropertyCerdentialses == null || businessPropertyCerdentialses.size() ==0 ){
-                throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR,"撤单失败(property_cerdentials),程序内部异常,请检查! "+delInfo);
-            }
-            for(Map businessPropertyCerdentials : businessPropertyCerdentialses) {
-                flushBusinessPropertyCredentials(businessPropertyCerdentials,StatusConstant.STATUS_CD_VALID);
-                propertyServiceDaoImpl.updatePropertyCerdentailsInstance(businessPropertyCerdentials);
+            for(Map businessPropertyHouseAttr : businessPropertyHouseAttrs) {
+                flushBusinessPropertyHouseAttr(businessPropertyHouseAttr,StatusConstant.STATUS_CD_VALID);
+                propertyServiceDaoImpl.updatePropertyHouseAttrInstance(businessPropertyHouseAttr);
             }
         }
     }
 
     /**
-     * 保存物业照片
-     * @param business 业务对象
-     * @param businessPropertyPhotos 物业照片
-     */
-    private void doBusinessPropertyPhoto(Business business, JSONArray businessPropertyPhotos) {
-
-        for(int businessPropertyPhotoIndex = 0 ;businessPropertyPhotoIndex < businessPropertyPhotos.size();businessPropertyPhotoIndex++) {
-            JSONObject businessPropertyPhoto = businessPropertyPhotos.getJSONObject(businessPropertyPhotoIndex);
-            Assert.jsonObjectHaveKey(businessPropertyPhoto, "propertyId", "businessPropertyPhoto 节点下没有包含 propertyId 节点");
-
-            if (businessPropertyPhoto.getString("propertyPhotoId").startsWith("-")) {
-                throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"propertyPhotoId 错误,不能自动生成(必须已经存在的propertyPhotoId)"+businessPropertyPhoto);
-            }
-
-            autoSaveDelBusinessPropertyPhoto(business,businessPropertyPhoto);
-        }
-    }
-
-    /**
-     * 处理 businessProperty 节点
+     * 处理 businessPropertyHouse 节点
      * @param business 总的数据节点
-     * @param businessProperty 物业节点
+     * @param businessPropertyHouse 物业节点
      */
-    private void doBusinessProperty(Business business,JSONObject businessProperty){
+    private void doBusinessPropertyHouse(Business business,JSONObject businessPropertyHouse){
 
-        Assert.jsonObjectHaveKey(businessProperty,"propertyId","businessProperty 节点下没有包含 propertyId 节点");
+        Assert.jsonObjectHaveKey(businessPropertyHouse,"houseId","businessPropertyHouse 节点下没有包含 houseId 节点");
 
-        if(businessProperty.getString("propertyId").startsWith("-")){
-            throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"propertyId 错误,不能自动生成(必须已经存在的propertyId)"+businessProperty);
+        if(businessPropertyHouse.getString("houseId").startsWith("-")){
+            throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"houseId 错误,不能自动生成(必须已经存在的houseId)"+businessPropertyHouse);
         }
         //自动插入DEL
-        autoSaveDelBusinessProperty(business,businessProperty);
+        autoSaveDelBusinessPropertyHouse(business,businessPropertyHouse);
     }
 
 
@@ -248,41 +172,19 @@ public class DeletePropertyHouseListener extends AbstractPropertyBusinessService
     /**
      * 保存物业属性信息
      * @param business 当前业务
-     * @param businessPropertyAttrs 物业属性
+     * @param businessPropertyHouseAttrs 物业属性
      */
-    private void doSaveBusinessPropertyAttrs(Business business,JSONArray businessPropertyAttrs){
+    private void doSaveBusinessPropertyHouseAttrs(Business business,JSONArray businessPropertyHouseAttrs){
         JSONObject data = business.getDatas();
 
-        for(int propertyAttrIndex = 0 ; propertyAttrIndex < businessPropertyAttrs.size();propertyAttrIndex ++){
-            JSONObject propertyAttr = businessPropertyAttrs.getJSONObject(propertyAttrIndex);
-            Assert.jsonObjectHaveKey(propertyAttr,"attrId","businessPropertyAttr 节点下没有包含 attrId 节点");
+        for(int propertyAttrIndex = 0 ; propertyAttrIndex < businessPropertyHouseAttrs.size();propertyAttrIndex ++){
+            JSONObject propertyAttr = businessPropertyHouseAttrs.getJSONObject(propertyAttrIndex);
+            Assert.jsonObjectHaveKey(propertyAttr,"attrId","businessPropertyHouseAttr 节点下没有包含 attrId 节点");
             if(propertyAttr.getString("attrId").startsWith("-")){
                 throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"attrId 错误,不能自动生成(必须已经存在的attrId)"+propertyAttr);
             }
 
-            autoSaveDelBusinessPropertyAttr(business,propertyAttr);
-        }
-    }
-
-
-    /**
-     * 保存 物业证件 信息
-     * @param business 当前业务
-     * @param businessPropertyCerdentialses 物业证件
-     */
-    private void doBusinessPropertyCerdentials(Business business, JSONArray businessPropertyCerdentialses) {
-
-        Map info = null;
-        Map currentPropertyCerdentials = null;
-        for(int businessPropertyCerdentialsIndex = 0 ; businessPropertyCerdentialsIndex < businessPropertyCerdentialses.size() ; businessPropertyCerdentialsIndex ++) {
-            JSONObject businessPropertyCerdentials = businessPropertyCerdentialses.getJSONObject(businessPropertyCerdentialsIndex);
-            Assert.jsonObjectHaveKey(businessPropertyCerdentials, "propertyId", "businessPropertyPhoto 节点下没有包含 propertyId 节点");
-
-            if (businessPropertyCerdentials.getString("propertyCerdentialsId").startsWith("-")) {
-                throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"propertyPhotoId 错误,不能自动生成(必须已经存在的propertyPhotoId)"+businessPropertyCerdentials);
-            }
-
-            autoSaveDelBusinessPropertyCerdentials(business,businessPropertyCerdentials);
+            autoSaveDelBusinessPropertyHouseAttr(business,propertyAttr);
         }
     }
 

+ 1 - 149
PropertyService/src/main/java/com/java110/property/listener/DeletePropertyPhotoListener.java

@@ -24,11 +24,7 @@ import java.util.Map;
  * 删除物业信息 侦听
  *
  * 处理节点
- * 1、businessProperty:{} 物业基本信息节点
- * 2、businessPropertyAttr:[{}] 物业属性信息节点
  * 3、businessPropertyPhoto:[{}] 物业照片信息节点
- * 4、businessPropertyCerdentials:[{}] 物业证件信息节点
- * 协议地址 :https://github.com/java110/MicroCommunity/wiki/%E5%88%A0%E9%99%A4%E5%95%86%E6%88%B7%E4%BF%A1%E6%81%AF-%E5%8D%8F%E8%AE%AE
  * Created by wuxw on 2018/5/18.
  */
 @Java110Listener("deletePropertyPhotoListener")
@@ -59,28 +55,10 @@ public class DeletePropertyPhotoListener extends AbstractPropertyBusinessService
         JSONObject data = business.getDatas();
 
         Assert.notEmpty(data,"没有datas 节点,或没有子节点需要处理");
-
-        //处理 businessProperty 节点 按理这里不应该处理,程序上支持,以防真有这种业务
-        if(data.containsKey("businessProperty")){
-            JSONObject businessProperty = data.getJSONObject("businessProperty");
-            doBusinessProperty(business,businessProperty);
-            dataFlowContext.addParamOut("propertyId",businessProperty.getString("propertyId"));
-        }
-
-        if(data.containsKey("businessPropertyAttr")){
-            JSONArray businessPropertyAttrs = data.getJSONArray("businessPropertyAttr");
-            doSaveBusinessPropertyAttrs(business,businessPropertyAttrs);
-        }
-
         if(data.containsKey("businessPropertyPhoto")){
             JSONArray businessPropertyPhotos = data.getJSONArray("businessPropertyPhoto");
             doBusinessPropertyPhoto(business,businessPropertyPhotos);
         }
-
-        if(data.containsKey("businessPropertyCerdentials")){
-            JSONArray businessPropertyCerdentialses = data.getJSONArray("businessPropertyCerdentials");
-            doBusinessPropertyCerdentials(business,businessPropertyCerdentialses);
-        }
     }
 
     /**
@@ -97,22 +75,6 @@ public class DeletePropertyPhotoListener extends AbstractPropertyBusinessService
         Map info = new HashMap();
         info.put("bId",business.getbId());
         info.put("operate",StatusConstant.OPERATE_DEL);
-
-        //物业信息
-        Map businessPropertyInfo = propertyServiceDaoImpl.getBusinessPropertyInfo(info);
-        if( businessPropertyInfo != null && !businessPropertyInfo.isEmpty()) {
-            flushBusinessPropertyInfo(businessPropertyInfo,StatusConstant.STATUS_CD_INVALID);
-            propertyServiceDaoImpl.updatePropertyInfoInstance(businessPropertyInfo);
-            dataFlowContext.addParamOut("propertyId",businessPropertyInfo.get("property_id"));
-        }
-        //物业属性
-        List<Map> businessPropertyAttrs = propertyServiceDaoImpl.getBusinessPropertyAttrs(info);
-        if(businessPropertyAttrs != null && businessPropertyAttrs.size() > 0) {
-            for(Map businessPropertyAttr : businessPropertyAttrs) {
-                flushBusinessPropertyAttr(businessPropertyAttr,StatusConstant.STATUS_CD_INVALID);
-                propertyServiceDaoImpl.updatePropertyAttrInstance(businessPropertyAttr);
-            }
-        }
         //物业照片
         List<Map> businessPropertyPhotos = propertyServiceDaoImpl.getBusinessPropertyPhoto(info);
         if(businessPropertyPhotos != null && businessPropertyPhotos.size() >0){
@@ -121,14 +83,6 @@ public class DeletePropertyPhotoListener extends AbstractPropertyBusinessService
                 propertyServiceDaoImpl.updatePropertyPhotoInstance(businessPropertyPhoto);
             }
         }
-        //物业证件
-        List<Map> businessPropertyCerdentialses = propertyServiceDaoImpl.getBusinessPropertyCerdentials(info);
-        if(businessPropertyCerdentialses != null && businessPropertyCerdentialses.size()>0){
-            for(Map businessPropertyCerdentials : businessPropertyCerdentialses) {
-                flushBusinessPropertyCredentials(businessPropertyCerdentials,StatusConstant.STATUS_CD_INVALID);
-                propertyServiceDaoImpl.updatePropertyCerdentailsInstance(businessPropertyCerdentials);
-            }
-        }
     }
 
     /**
@@ -148,36 +102,6 @@ public class DeletePropertyPhotoListener extends AbstractPropertyBusinessService
         Map delInfo = new HashMap();
         delInfo.put("bId",business.getbId());
         delInfo.put("operate",StatusConstant.OPERATE_DEL);
-        //物业信息
-        Map propertyInfo = propertyServiceDaoImpl.getPropertyInfo(info);
-        if(propertyInfo != null && !propertyInfo.isEmpty()){
-
-            //物业信息
-            Map businessPropertyInfo = propertyServiceDaoImpl.getBusinessPropertyInfo(delInfo);
-            //除非程序出错了,这里不会为空
-            if(businessPropertyInfo == null || businessPropertyInfo.isEmpty()){
-                throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR,"撤单失败(property),程序内部异常,请检查! "+delInfo);
-            }
-
-            flushBusinessPropertyInfo(businessPropertyInfo,StatusConstant.STATUS_CD_VALID);
-            propertyServiceDaoImpl.updatePropertyInfoInstance(businessPropertyInfo);
-            dataFlowContext.addParamOut("propertyId",propertyInfo.get("property_id"));
-        }
-
-        //物业属性
-        List<Map> propertyAttrs = propertyServiceDaoImpl.getPropertyAttrs(info);
-        if(propertyAttrs != null && propertyAttrs.size()>0){
-
-            List<Map> businessPropertyAttrs = propertyServiceDaoImpl.getBusinessPropertyAttrs(delInfo);
-            //除非程序出错了,这里不会为空
-            if(businessPropertyAttrs == null || businessPropertyAttrs.size() ==0 ){
-                throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR,"撤单失败(property_attr),程序内部异常,请检查! "+delInfo);
-            }
-            for(Map businessPropertyAttr : businessPropertyAttrs) {
-                flushBusinessPropertyAttr(businessPropertyAttr,StatusConstant.STATUS_CD_VALID);
-                propertyServiceDaoImpl.updatePropertyAttrInstance(businessPropertyAttr);
-            }
-        }
 
         //物业照片
         List<Map> propertyPhotos = propertyServiceDaoImpl.getPropertyPhoto(info);
@@ -193,19 +117,6 @@ public class DeletePropertyPhotoListener extends AbstractPropertyBusinessService
             }
         }
 
-        //物业属性
-        List<Map> propertyCerdentialses = propertyServiceDaoImpl.getPropertyCerdentials(info);
-        if(propertyCerdentialses != null && propertyCerdentialses.size()>0){
-            List<Map> businessPropertyCerdentialses = propertyServiceDaoImpl.getBusinessPropertyCerdentials(delInfo);
-            //除非程序出错了,这里不会为空
-            if(businessPropertyCerdentialses == null || businessPropertyCerdentialses.size() ==0 ){
-                throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR,"撤单失败(property_cerdentials),程序内部异常,请检查! "+delInfo);
-            }
-            for(Map businessPropertyCerdentials : businessPropertyCerdentialses) {
-                flushBusinessPropertyCredentials(businessPropertyCerdentials,StatusConstant.STATUS_CD_VALID);
-                propertyServiceDaoImpl.updatePropertyCerdentailsInstance(businessPropertyCerdentials);
-            }
-        }
     }
 
     /**
@@ -217,7 +128,7 @@ public class DeletePropertyPhotoListener extends AbstractPropertyBusinessService
 
         for(int businessPropertyPhotoIndex = 0 ;businessPropertyPhotoIndex < businessPropertyPhotos.size();businessPropertyPhotoIndex++) {
             JSONObject businessPropertyPhoto = businessPropertyPhotos.getJSONObject(businessPropertyPhotoIndex);
-            Assert.jsonObjectHaveKey(businessPropertyPhoto, "propertyId", "businessPropertyPhoto 节点下没有包含 propertyId 节点");
+            Assert.jsonObjectHaveKey(businessPropertyPhoto, "propertyPhotoId", "businessPropertyPhoto 节点下没有包含 propertyPhotoId 节点");
 
             if (businessPropertyPhoto.getString("propertyPhotoId").startsWith("-")) {
                 throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"propertyPhotoId 错误,不能自动生成(必须已经存在的propertyPhotoId)"+businessPropertyPhoto);
@@ -227,65 +138,6 @@ public class DeletePropertyPhotoListener extends AbstractPropertyBusinessService
         }
     }
 
-    /**
-     * 处理 businessProperty 节点
-     * @param business 总的数据节点
-     * @param businessProperty 物业节点
-     */
-    private void doBusinessProperty(Business business,JSONObject businessProperty){
-
-        Assert.jsonObjectHaveKey(businessProperty,"propertyId","businessProperty 节点下没有包含 propertyId 节点");
-
-        if(businessProperty.getString("propertyId").startsWith("-")){
-            throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"propertyId 错误,不能自动生成(必须已经存在的propertyId)"+businessProperty);
-        }
-        //自动插入DEL
-        autoSaveDelBusinessProperty(business,businessProperty);
-    }
-
-
-
-    /**
-     * 保存物业属性信息
-     * @param business 当前业务
-     * @param businessPropertyAttrs 物业属性
-     */
-    private void doSaveBusinessPropertyAttrs(Business business,JSONArray businessPropertyAttrs){
-        JSONObject data = business.getDatas();
-
-        for(int propertyAttrIndex = 0 ; propertyAttrIndex < businessPropertyAttrs.size();propertyAttrIndex ++){
-            JSONObject propertyAttr = businessPropertyAttrs.getJSONObject(propertyAttrIndex);
-            Assert.jsonObjectHaveKey(propertyAttr,"attrId","businessPropertyAttr 节点下没有包含 attrId 节点");
-            if(propertyAttr.getString("attrId").startsWith("-")){
-                throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"attrId 错误,不能自动生成(必须已经存在的attrId)"+propertyAttr);
-            }
-
-            autoSaveDelBusinessPropertyAttr(business,propertyAttr);
-        }
-    }
-
-
-    /**
-     * 保存 物业证件 信息
-     * @param business 当前业务
-     * @param businessPropertyCerdentialses 物业证件
-     */
-    private void doBusinessPropertyCerdentials(Business business, JSONArray businessPropertyCerdentialses) {
-
-        Map info = null;
-        Map currentPropertyCerdentials = null;
-        for(int businessPropertyCerdentialsIndex = 0 ; businessPropertyCerdentialsIndex < businessPropertyCerdentialses.size() ; businessPropertyCerdentialsIndex ++) {
-            JSONObject businessPropertyCerdentials = businessPropertyCerdentialses.getJSONObject(businessPropertyCerdentialsIndex);
-            Assert.jsonObjectHaveKey(businessPropertyCerdentials, "propertyId", "businessPropertyPhoto 节点下没有包含 propertyId 节点");
-
-            if (businessPropertyCerdentials.getString("propertyCerdentialsId").startsWith("-")) {
-                throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"propertyPhotoId 错误,不能自动生成(必须已经存在的propertyPhotoId)"+businessPropertyCerdentials);
-            }
-
-            autoSaveDelBusinessPropertyCerdentials(business,businessPropertyCerdentials);
-        }
-    }
-
     public IPropertyServiceDao getPropertyServiceDaoImpl() {
         return propertyServiceDaoImpl;
     }

+ 25 - 169
PropertyService/src/main/java/com/java110/property/listener/DeletePropertyUserListener.java

@@ -24,11 +24,7 @@ import java.util.Map;
  * 删除物业信息 侦听
  *
  * 处理节点
- * 1、businessProperty:{} 物业基本信息节点
- * 2、businessPropertyAttr:[{}] 物业属性信息节点
- * 3、businessPropertyPhoto:[{}] 物业照片信息节点
- * 4、businessPropertyCerdentials:[{}] 物业证件信息节点
- * 协议地址 :https://github.com/java110/MicroCommunity/wiki/%E5%88%A0%E9%99%A4%E5%95%86%E6%88%B7%E4%BF%A1%E6%81%AF-%E5%8D%8F%E8%AE%AE
+ * 3、businessPropertyUser:[{}] 物业照片信息节点
  * Created by wuxw on 2018/5/18.
  */
 @Java110Listener("deletePropertyUserListener")
@@ -60,27 +56,11 @@ public class DeletePropertyUserListener extends AbstractPropertyBusinessServiceD
 
         Assert.notEmpty(data,"没有datas 节点,或没有子节点需要处理");
 
-        //处理 businessProperty 节点 按理这里不应该处理,程序上支持,以防真有这种业务
-        if(data.containsKey("businessProperty")){
-            JSONObject businessProperty = data.getJSONObject("businessProperty");
-            doBusinessProperty(business,businessProperty);
-            dataFlowContext.addParamOut("propertyId",businessProperty.getString("propertyId"));
+        if(data.containsKey("businessPropertyUser")){
+            JSONArray businessPropertyUsers = data.getJSONArray("businessPropertyUser");
+            doBusinessPropertyUser(business,businessPropertyUsers);
         }
 
-        if(data.containsKey("businessPropertyAttr")){
-            JSONArray businessPropertyAttrs = data.getJSONArray("businessPropertyAttr");
-            doSaveBusinessPropertyAttrs(business,businessPropertyAttrs);
-        }
-
-        if(data.containsKey("businessPropertyPhoto")){
-            JSONArray businessPropertyPhotos = data.getJSONArray("businessPropertyPhoto");
-            doBusinessPropertyPhoto(business,businessPropertyPhotos);
-        }
-
-        if(data.containsKey("businessPropertyCerdentials")){
-            JSONArray businessPropertyCerdentialses = data.getJSONArray("businessPropertyCerdentials");
-            doBusinessPropertyCerdentials(business,businessPropertyCerdentialses);
-        }
     }
 
     /**
@@ -98,35 +78,13 @@ public class DeletePropertyUserListener extends AbstractPropertyBusinessServiceD
         info.put("bId",business.getbId());
         info.put("operate",StatusConstant.OPERATE_DEL);
 
-        //物业信息
-        Map businessPropertyInfo = propertyServiceDaoImpl.getBusinessPropertyInfo(info);
-        if( businessPropertyInfo != null && !businessPropertyInfo.isEmpty()) {
-            flushBusinessPropertyInfo(businessPropertyInfo,StatusConstant.STATUS_CD_INVALID);
-            propertyServiceDaoImpl.updatePropertyInfoInstance(businessPropertyInfo);
-            dataFlowContext.addParamOut("propertyId",businessPropertyInfo.get("property_id"));
-        }
-        //物业属性
-        List<Map> businessPropertyAttrs = propertyServiceDaoImpl.getBusinessPropertyAttrs(info);
-        if(businessPropertyAttrs != null && businessPropertyAttrs.size() > 0) {
-            for(Map businessPropertyAttr : businessPropertyAttrs) {
-                flushBusinessPropertyAttr(businessPropertyAttr,StatusConstant.STATUS_CD_INVALID);
-                propertyServiceDaoImpl.updatePropertyAttrInstance(businessPropertyAttr);
-            }
-        }
+
         //物业照片
-        List<Map> businessPropertyPhotos = propertyServiceDaoImpl.getBusinessPropertyPhoto(info);
-        if(businessPropertyPhotos != null && businessPropertyPhotos.size() >0){
-            for(Map businessPropertyPhoto : businessPropertyPhotos) {
-                flushBusinessPropertyPhoto(businessPropertyPhoto,StatusConstant.STATUS_CD_INVALID);
-                propertyServiceDaoImpl.updatePropertyPhotoInstance(businessPropertyPhoto);
-            }
-        }
-        //物业证件
-        List<Map> businessPropertyCerdentialses = propertyServiceDaoImpl.getBusinessPropertyCerdentials(info);
-        if(businessPropertyCerdentialses != null && businessPropertyCerdentialses.size()>0){
-            for(Map businessPropertyCerdentials : businessPropertyCerdentialses) {
-                flushBusinessPropertyCredentials(businessPropertyCerdentials,StatusConstant.STATUS_CD_INVALID);
-                propertyServiceDaoImpl.updatePropertyCerdentailsInstance(businessPropertyCerdentials);
+        List<Map> businessPropertyUsers = propertyServiceDaoImpl.getBusinessPropertyUser(info);
+        if(businessPropertyUsers != null && businessPropertyUsers.size() >0){
+            for(Map businessPropertyUser : businessPropertyUsers) {
+                flushBusinessPropertyUser(businessPropertyUser,StatusConstant.STATUS_CD_INVALID);
+                propertyServiceDaoImpl.updatePropertyUserInstance(businessPropertyUser);
             }
         }
     }
@@ -148,62 +106,19 @@ public class DeletePropertyUserListener extends AbstractPropertyBusinessServiceD
         Map delInfo = new HashMap();
         delInfo.put("bId",business.getbId());
         delInfo.put("operate",StatusConstant.OPERATE_DEL);
-        //物业信息
-        Map propertyInfo = propertyServiceDaoImpl.getPropertyInfo(info);
-        if(propertyInfo != null && !propertyInfo.isEmpty()){
-
-            //物业信息
-            Map businessPropertyInfo = propertyServiceDaoImpl.getBusinessPropertyInfo(delInfo);
-            //除非程序出错了,这里不会为空
-            if(businessPropertyInfo == null || businessPropertyInfo.isEmpty()){
-                throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR,"撤单失败(property),程序内部异常,请检查! "+delInfo);
-            }
-
-            flushBusinessPropertyInfo(businessPropertyInfo,StatusConstant.STATUS_CD_VALID);
-            propertyServiceDaoImpl.updatePropertyInfoInstance(businessPropertyInfo);
-            dataFlowContext.addParamOut("propertyId",propertyInfo.get("property_id"));
-        }
 
-        //物业属性
-        List<Map> propertyAttrs = propertyServiceDaoImpl.getPropertyAttrs(info);
-        if(propertyAttrs != null && propertyAttrs.size()>0){
-
-            List<Map> businessPropertyAttrs = propertyServiceDaoImpl.getBusinessPropertyAttrs(delInfo);
-            //除非程序出错了,这里不会为空
-            if(businessPropertyAttrs == null || businessPropertyAttrs.size() ==0 ){
-                throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR,"撤单失败(property_attr),程序内部异常,请检查! "+delInfo);
-            }
-            for(Map businessPropertyAttr : businessPropertyAttrs) {
-                flushBusinessPropertyAttr(businessPropertyAttr,StatusConstant.STATUS_CD_VALID);
-                propertyServiceDaoImpl.updatePropertyAttrInstance(businessPropertyAttr);
-            }
-        }
 
         //物业照片
-        List<Map> propertyPhotos = propertyServiceDaoImpl.getPropertyPhoto(info);
-        if(propertyPhotos != null && propertyPhotos.size()>0){
-            List<Map> businessPropertyPhotos = propertyServiceDaoImpl.getBusinessPropertyPhoto(delInfo);
+        List<Map> propertyUsers = propertyServiceDaoImpl.getPropertyUser(info);
+        if(propertyUsers != null && propertyUsers.size()>0){
+            List<Map> businessPropertyUsers = propertyServiceDaoImpl.getBusinessPropertyUser(delInfo);
             //除非程序出错了,这里不会为空
-            if(businessPropertyPhotos == null || businessPropertyPhotos.size() ==0 ){
+            if(businessPropertyUsers == null || businessPropertyUsers.size() ==0 ){
                 throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR,"撤单失败(property_photo),程序内部异常,请检查! "+delInfo);
             }
-            for(Map businessPropertyPhoto : businessPropertyPhotos) {
-                flushBusinessPropertyPhoto(businessPropertyPhoto,StatusConstant.STATUS_CD_VALID);
-                propertyServiceDaoImpl.updatePropertyPhotoInstance(businessPropertyPhoto);
-            }
-        }
-
-        //物业属性
-        List<Map> propertyCerdentialses = propertyServiceDaoImpl.getPropertyCerdentials(info);
-        if(propertyCerdentialses != null && propertyCerdentialses.size()>0){
-            List<Map> businessPropertyCerdentialses = propertyServiceDaoImpl.getBusinessPropertyCerdentials(delInfo);
-            //除非程序出错了,这里不会为空
-            if(businessPropertyCerdentialses == null || businessPropertyCerdentialses.size() ==0 ){
-                throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR,"撤单失败(property_cerdentials),程序内部异常,请检查! "+delInfo);
-            }
-            for(Map businessPropertyCerdentials : businessPropertyCerdentialses) {
-                flushBusinessPropertyCredentials(businessPropertyCerdentials,StatusConstant.STATUS_CD_VALID);
-                propertyServiceDaoImpl.updatePropertyCerdentailsInstance(businessPropertyCerdentials);
+            for(Map businessPropertyUser : businessPropertyUsers) {
+                flushBusinessPropertyUser(businessPropertyUser,StatusConstant.STATUS_CD_VALID);
+                propertyServiceDaoImpl.updatePropertyUserInstance(businessPropertyUser);
             }
         }
     }
@@ -211,78 +126,19 @@ public class DeletePropertyUserListener extends AbstractPropertyBusinessServiceD
     /**
      * 保存物业照片
      * @param business 业务对象
-     * @param businessPropertyPhotos 物业照片
-     */
-    private void doBusinessPropertyPhoto(Business business, JSONArray businessPropertyPhotos) {
-
-        for(int businessPropertyPhotoIndex = 0 ;businessPropertyPhotoIndex < businessPropertyPhotos.size();businessPropertyPhotoIndex++) {
-            JSONObject businessPropertyPhoto = businessPropertyPhotos.getJSONObject(businessPropertyPhotoIndex);
-            Assert.jsonObjectHaveKey(businessPropertyPhoto, "propertyId", "businessPropertyPhoto 节点下没有包含 propertyId 节点");
-
-            if (businessPropertyPhoto.getString("propertyPhotoId").startsWith("-")) {
-                throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"propertyPhotoId 错误,不能自动生成(必须已经存在的propertyPhotoId)"+businessPropertyPhoto);
-            }
-
-            autoSaveDelBusinessPropertyPhoto(business,businessPropertyPhoto);
-        }
-    }
-
-    /**
-     * 处理 businessProperty 节点
-     * @param business 总的数据节点
-     * @param businessProperty 物业节点
-     */
-    private void doBusinessProperty(Business business,JSONObject businessProperty){
-
-        Assert.jsonObjectHaveKey(businessProperty,"propertyId","businessProperty 节点下没有包含 propertyId 节点");
-
-        if(businessProperty.getString("propertyId").startsWith("-")){
-            throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"propertyId 错误,不能自动生成(必须已经存在的propertyId)"+businessProperty);
-        }
-        //自动插入DEL
-        autoSaveDelBusinessProperty(business,businessProperty);
-    }
-
-
-
-    /**
-     * 保存物业属性信息
-     * @param business 当前业务
-     * @param businessPropertyAttrs 物业属性
-     */
-    private void doSaveBusinessPropertyAttrs(Business business,JSONArray businessPropertyAttrs){
-        JSONObject data = business.getDatas();
-
-        for(int propertyAttrIndex = 0 ; propertyAttrIndex < businessPropertyAttrs.size();propertyAttrIndex ++){
-            JSONObject propertyAttr = businessPropertyAttrs.getJSONObject(propertyAttrIndex);
-            Assert.jsonObjectHaveKey(propertyAttr,"attrId","businessPropertyAttr 节点下没有包含 attrId 节点");
-            if(propertyAttr.getString("attrId").startsWith("-")){
-                throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"attrId 错误,不能自动生成(必须已经存在的attrId)"+propertyAttr);
-            }
-
-            autoSaveDelBusinessPropertyAttr(business,propertyAttr);
-        }
-    }
-
-
-    /**
-     * 保存 物业证件 信息
-     * @param business 当前业务
-     * @param businessPropertyCerdentialses 物业证件
+     * @param businessPropertyUsers 物业照片
      */
-    private void doBusinessPropertyCerdentials(Business business, JSONArray businessPropertyCerdentialses) {
+    private void doBusinessPropertyUser(Business business, JSONArray businessPropertyUsers) {
 
-        Map info = null;
-        Map currentPropertyCerdentials = null;
-        for(int businessPropertyCerdentialsIndex = 0 ; businessPropertyCerdentialsIndex < businessPropertyCerdentialses.size() ; businessPropertyCerdentialsIndex ++) {
-            JSONObject businessPropertyCerdentials = businessPropertyCerdentialses.getJSONObject(businessPropertyCerdentialsIndex);
-            Assert.jsonObjectHaveKey(businessPropertyCerdentials, "propertyId", "businessPropertyPhoto 节点下没有包含 propertyId 节点");
+        for(int businessPropertyUserIndex = 0 ;businessPropertyUserIndex < businessPropertyUsers.size();businessPropertyUserIndex++) {
+            JSONObject businessPropertyUser = businessPropertyUsers.getJSONObject(businessPropertyUserIndex);
+            Assert.jsonObjectHaveKey(businessPropertyUser, "propertyUserId", "businessPropertyUser 节点下没有包含 propertyUserId 节点");
 
-            if (businessPropertyCerdentials.getString("propertyCerdentialsId").startsWith("-")) {
-                throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"propertyPhotoId 错误,不能自动生成(必须已经存在的propertyPhotoId)"+businessPropertyCerdentials);
+            if (businessPropertyUser.getString("propertyUserId").startsWith("-")) {
+                throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"propertyUserId 错误,不能自动生成(必须已经存在的propertyUserId)"+businessPropertyUser);
             }
 
-            autoSaveDelBusinessPropertyCerdentials(business,businessPropertyCerdentials);
+            autoSaveDelBusinessPropertyUser(business,businessPropertyUser);
         }
     }
 

+ 1 - 4
java110-common/src/main/java/com/java110/common/constant/ServiceCodeConstant.java

@@ -262,13 +262,10 @@ public class ServiceCodeConstant {
     public static final String SERVICE_CODE_UPDATE_PROPERTY_CERDENTIALS = "update.property.cerdentials";
     public static final String SERVICE_CODE_UPDATE_PROPERTY_FEE = "update.property.fee";
     public static final String SERVICE_CODE_UPDATE_PROPERTY_HOUSE = "update.property.house";
+    public static final String SERVICE_CODE_DELETE_PROPERTY_ATTR = "delete.property.attr";
     public static final String SERVICE_CODE_DELETE_PROPERTY_PHOTO = "delete.property.photo";
     public static final String SERVICE_CODE_DELETE_PROPERTY_CERDENTIALS = "delete.property.cerdentials";
     public static final String SERVICE_CODE_DELETE_PROPERTY_USER = "delete.property.user";
     public static final String SERVICE_CODE_DELETE_PROPERTY_HOUSE = "delete.property.house";
 
-
-
-
-
 }