Browse Source

添加 物业业务处理侦听 15 个

wuxw 7 years ago
parent
commit
b4d773e696
27 changed files with 3994 additions and 15 deletions
  1. 0 0
      CommunityService/doc/updateCommunityInfo.json
  2. 56 0
      PropertyService/Readme.md
  3. 47 0
      PropertyService/doc/savePropertyInfo.json
  4. 47 0
      PropertyService/doc/updatePropertyInfo.json
  5. 10 0
      PropertyService/docker/Dockerfile
  6. 14 0
      PropertyService/docker/bin/start_property.sh
  7. 12 0
      PropertyService/docker/docker-compose.yml
  8. 11 0
      PropertyService/docker/onStart.sh
  9. 2 2
      PropertyService/src/main/java/com/java110/property/api/PropertyApi.java
  10. 296 0
      PropertyService/src/main/java/com/java110/property/listener/DeletePropertyCerdentialsListener.java
  11. 296 0
      PropertyService/src/main/java/com/java110/property/listener/DeletePropertyHouseListener.java
  12. 296 0
      PropertyService/src/main/java/com/java110/property/listener/DeletePropertyPhotoListener.java
  13. 5 5
      PropertyService/src/main/java/com/java110/property/listener/DeletePropertyInfoListener.java
  14. 310 0
      PropertyService/src/main/java/com/java110/property/listener/SavePropertyCerdentialsListener.java
  15. 310 0
      PropertyService/src/main/java/com/java110/property/listener/SavePropertyFeeListener.java
  16. 310 0
      PropertyService/src/main/java/com/java110/property/listener/SavePropertyHouseListener.java
  17. 1 1
      PropertyService/src/main/java/com/java110/property/listener/SavePropertyInfoListener.java
  18. 310 0
      PropertyService/src/main/java/com/java110/property/listener/SavePropertyPhotoListener.java
  19. 310 0
      PropertyService/src/main/java/com/java110/property/listener/SavePropertyUserListener.java
  20. 322 0
      PropertyService/src/main/java/com/java110/property/listener/UpdatePropertyCerdentialsListener.java
  21. 322 0
      PropertyService/src/main/java/com/java110/property/listener/UpdatePropertyFeeListener.java
  22. 322 0
      PropertyService/src/main/java/com/java110/property/listener/UpdatePropertyHouseListener.java
  23. 1 1
      PropertyService/src/main/java/com/java110/property/listener/UpdatePropertyInfoListener.java
  24. 322 0
      PropertyService/src/main/java/com/java110/property/listener/UpdatePropertyPhotoListener.java
  25. 1 1
      PropertyService/src/main/resources/application.yml
  26. 17 0
      java110-common/src/main/java/com/java110/common/constant/ServiceCodeConstant.java
  27. 44 5
      java110-config/db/PropertyService/create_table.sql

CommunityService/doc/updateStoreInfo.json → CommunityService/doc/updateCommunityInfo.json


+ 56 - 0
PropertyService/Readme.md

@@ -0,0 +1,56 @@
+### 变更历史(change history)
+版本|变更内容|变更时间|变更人员
+:-: | :-: | :-: | :-:
+v0.01|初稿|2018-07-24|wuxw
+
+## serviceCode 包括
+
+### 保存物业基本信息
+
+save.property.info
+
+### 保存照片信息
+save.property.photo
+
+### 保存证件信息
+save.property.cerdentials
+
+### 保存物业员工信息
+save.property.user
+
+### 保存物业费用信息
+save.property.fee
+
+### 保存物业住户信息
+save.property.house
+
+
+### 修改物业基本信息
+
+update.property.info
+
+### 修改照片信息
+update.property.photo
+
+### 修改证件信息
+update.property.cerdentials
+
+### 修改物业费用信息
+update.property.fee
+
+### 修改物业住户信息
+update.property.house
+
+
+### 删除照片信息
+delete.property.photo
+
+### 删除证件信息
+delete.property.cerdentials
+
+### 删除物业员工信息
+delete.property.user
+
+
+### 删除物业住户信息
+delete.property.house

+ 47 - 0
PropertyService/doc/savePropertyInfo.json

@@ -0,0 +1,47 @@
+{
+  "orders": {
+    "appId": "外系统ID,分配得到",
+    "transactionId": "100000000020180409224736000001",
+    "userId": "用户ID",
+    "orderTypeCd": "订单类型,查询,受理",
+    "requestTime": "20180409224736",
+    "remark": "备注",
+    "sign": "这个服务是否要求MD5签名",
+    "attrs": [{
+      "specCd": "配置的字段ID",
+      "value": "具体值"
+    }]
+  },
+  "business": [{
+    "serviceCode": "save.community.info",
+    "serviceName": "保存小区信息",
+    "remark": "备注",
+    "datas": {
+      "businessCommunity": {
+        "communityId": "-1",
+        "name": "方博家园",
+        "address": "青海省西宁市城中区129号",
+        "cityCode": "100010",
+        "nearbyLandmarks": "王府井旁30米",
+        "mapX": "101.801909",
+        "mapY": "36.597263"
+      },
+      "businessCommunityAttr": [{
+        "communityId": "-1",
+        "attrId":"-1",
+        "specCd":"1001",
+        "value":"01"
+      }],
+      "businessCommunityPhoto":[{
+        "communityPhotoId":"-1",
+        "communityId":"-1",
+        "communityPhotoTypeCd":"T",
+        "photo":"12345678.jpg"
+      }]
+    },
+    "attrs": [{
+      "specCd": "配置的字段ID",
+      "value": "具体值"
+    }]
+  }]
+}

+ 47 - 0
PropertyService/doc/updatePropertyInfo.json

@@ -0,0 +1,47 @@
+{
+  "orders": {
+    "appId": "外系统ID,分配得到",
+    "transactionId": "100000000020180409224736000001",
+    "userId": "用户ID",
+    "orderTypeCd": "订单类型,查询,受理",
+    "requestTime": "20180409224736",
+    "remark": "备注",
+    "sign": "这个服务是否要求MD5签名",
+    "attrs": [{
+      "specCd": "配置的字段ID",
+      "value": "具体值"
+    }]
+  },
+  "business": [{
+    "serviceCode": "update.community.info",
+    "serviceName": "修改商户信息",
+    "remark": "备注",
+    "datas": {
+      "businessCommunity": {
+        "communityId": "123456",
+        "name": "万博家博园(城西区)",
+        "address": "青海省西宁市城中区129号",
+        "cityCode": "100010",
+        "nearbyLandmarks": "王府井旁30米",
+        "mapX": "101.801909",
+        "mapY": "36.597263"
+      },
+      "businessCommunityAttr": [{
+        "communityId": "123456",
+        "attrId":"1234546",
+        "specCd":"1001",
+        "value":"01"
+      }],
+      "businessCommunityPhoto":[{
+        "communityPhotoId":"12321",
+        "communityId": "123456",
+        "communityPhotoTypeCd":"T",
+        "photo":"12345678.jpg"
+      }]
+    },
+    "attrs": [{
+      "specCd": "配置的字段ID",
+      "value": "具体值"
+    }]
+  }]
+}

+ 10 - 0
PropertyService/docker/Dockerfile

@@ -0,0 +1,10 @@
+FROM registry.cn-beijing.aliyuncs.com/sxd/ubuntu-java8:1.0
+MAINTAINER wuxw <928255095@qq.com>
+
+
+ADD bin/start_property.sh /root/
+
+
+RUN chmod u+x /root/start_property.sh
+
+CMD ["/root/start_property.sh","dev"]

+ 14 - 0
PropertyService/docker/bin/start_property.sh

@@ -0,0 +1,14 @@
+#!/bin/bash
+#### debug model prod
+#nohup java -Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=8000,suspend=n -jar -Dspring.profiles.active=dev target/PropertyService.jar > property.log 2>&1 &
+
+#### normal prod model
+#nohup java -jar -Dspring.profiles.active=prod target/PropertyService.jar > property.log 2>&1 &
+
+#### normal test model
+#nohup java -jar -Dspring.profiles.active=test target/PropertyService.jar > property.log 2>&1 &
+
+#### normal dev model
+nohup java -jar -Dspring.profiles.active=$1 target/PropertyService.jar > property.log 2>&1 &
+
+tail -100f property.log

+ 12 - 0
PropertyService/docker/docker-compose.yml

@@ -0,0 +1,12 @@
+version: '2'
+services:
+   propertyserivce:
+       container_name: propertyserivce-1
+       build:
+          context: .
+          dockerfile: Dockerfile
+       restart: always
+       ports:
+       - "8009:8009"
+       volumes:
+       - ../target/PropertyService.jar:/root/target/PropertyService.jar

+ 11 - 0
PropertyService/docker/onStart.sh

@@ -0,0 +1,11 @@
+#!/bin/bash
+
+cp -r ../bin .
+
+cp  -r ../target .
+
+docker build -t java110/property .
+
+docker run -ti --name property_test -p8006:8006 -idt java110/property:latest
+
+docker logs -f property_test

+ 2 - 2
PropertyService/src/main/java/com/java110/property/api/PropertyApi.java

@@ -19,7 +19,7 @@ import java.util.HashMap;
 import java.util.Map;
 
 /**
- * 用户服务类
+ * 物业服务类
  * Created by wuxw on 2018/5/14.
  */
 @RestController
@@ -34,7 +34,7 @@ public class PropertyApi extends BaseController {
     }
 
     /**
-     * 用户服务统一处理接口
+     * 物业服务统一处理接口
      * @param orderInfo
      * @param request
      * @return

+ 296 - 0
PropertyService/src/main/java/com/java110/property/listener/DeletePropertyCerdentialsListener.java

@@ -0,0 +1,296 @@
+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、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("deletePropertyCerdentialsListener")
+@Transactional
+public class DeletePropertyCerdentialsListener extends AbstractPropertyBusinessServiceDataFlowListener {
+
+    private final static Logger logger = LoggerFactory.getLogger(DeletePropertyCerdentialsListener.class);
+    @Autowired
+    IPropertyServiceDao propertyServiceDaoImpl;
+
+    @Override
+    public int getOrder() {
+        return 3;
+    }
+
+    @Override
+    public String getServiceCode() {
+        return ServiceCodeConstant.SERVICE_CODE_DELETE_PROPERTY_CERDENTIALS;
+    }
+
+    /**
+     * 根据删除信息 查出Instance表中数据 保存至business表 (状态写DEL) 方便撤单时直接更新回去
+     * @param dataFlowContext 数据对象
+     * @param business 当前业务对象
+     */
+    @Override
+    protected void doSaveBusiness(DataFlowContext dataFlowContext, Business business) {
+        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);
+        }
+    }
+
+    /**
+     * 删除 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);
+
+        //物业信息
+        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);
+            }
+        }
+    }
+
+    /**
+     * 撤单
+     * 从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);
+        //物业信息
+        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);
+        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);
+            }
+        }
+    }
+
+    /**
+     * 保存物业照片
+     * @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 物业证件
+     */
+    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;
+    }
+
+    public void setPropertyServiceDaoImpl(IPropertyServiceDao propertyServiceDaoImpl) {
+        this.propertyServiceDaoImpl = propertyServiceDaoImpl;
+    }
+}

+ 296 - 0
PropertyService/src/main/java/com/java110/property/listener/DeletePropertyHouseListener.java

@@ -0,0 +1,296 @@
+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、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("deletePropertyHouseListener")
+@Transactional
+public class DeletePropertyHouseListener extends AbstractPropertyBusinessServiceDataFlowListener {
+
+    private final static Logger logger = LoggerFactory.getLogger(DeletePropertyHouseListener.class);
+    @Autowired
+    IPropertyServiceDao propertyServiceDaoImpl;
+
+    @Override
+    public int getOrder() {
+        return 3;
+    }
+
+    @Override
+    public String getServiceCode() {
+        return ServiceCodeConstant.SERVICE_CODE_DELETE_PROPERTY_HOUSE;
+    }
+
+    /**
+     * 根据删除信息 查出Instance表中数据 保存至business表 (状态写DEL) 方便撤单时直接更新回去
+     * @param dataFlowContext 数据对象
+     * @param business 当前业务对象
+     */
+    @Override
+    protected void doSaveBusiness(DataFlowContext dataFlowContext, Business business) {
+        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);
+        }
+    }
+
+    /**
+     * 删除 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);
+
+        //物业信息
+        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);
+            }
+        }
+    }
+
+    /**
+     * 撤单
+     * 从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);
+        //物业信息
+        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);
+        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);
+            }
+        }
+    }
+
+    /**
+     * 保存物业照片
+     * @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 物业证件
+     */
+    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;
+    }
+
+    public void setPropertyServiceDaoImpl(IPropertyServiceDao propertyServiceDaoImpl) {
+        this.propertyServiceDaoImpl = propertyServiceDaoImpl;
+    }
+}

+ 296 - 0
PropertyService/src/main/java/com/java110/property/listener/DeletePropertyPhotoListener.java

@@ -0,0 +1,296 @@
+package com.java110.property.listener;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.java110.property.dao.IPropertyServiceDao;
+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 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、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")
+@Transactional
+public class DeletePropertyPhotoListener extends AbstractPropertyBusinessServiceDataFlowListener {
+
+    private final static Logger logger = LoggerFactory.getLogger(DeletePropertyPhotoListener.class);
+    @Autowired
+    IPropertyServiceDao propertyServiceDaoImpl;
+
+    @Override
+    public int getOrder() {
+        return 3;
+    }
+
+    @Override
+    public String getServiceCode() {
+        return ServiceCodeConstant.SERVICE_CODE_DELETE_PROPERTY_PHOTO;
+    }
+
+    /**
+     * 根据删除信息 查出Instance表中数据 保存至business表 (状态写DEL) 方便撤单时直接更新回去
+     * @param dataFlowContext 数据对象
+     * @param business 当前业务对象
+     */
+    @Override
+    protected void doSaveBusiness(DataFlowContext dataFlowContext, Business business) {
+        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);
+        }
+    }
+
+    /**
+     * 删除 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);
+
+        //物业信息
+        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);
+            }
+        }
+    }
+
+    /**
+     * 撤单
+     * 从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);
+        //物业信息
+        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);
+        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);
+            }
+        }
+    }
+
+    /**
+     * 保存物业照片
+     * @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 物业证件
+     */
+    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;
+    }
+
+    public void setPropertyServiceDaoImpl(IPropertyServiceDao propertyServiceDaoImpl) {
+        this.propertyServiceDaoImpl = propertyServiceDaoImpl;
+    }
+}

+ 5 - 5
PropertyService/src/main/java/com/java110/property/listener/DeletePropertyInfoListener.java

@@ -2,7 +2,6 @@ package com.java110.property.listener;
 
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
-import com.java110.property.dao.IPropertyServiceDao;
 import com.java110.common.constant.ResponseConstant;
 import com.java110.common.constant.ServiceCodeConstant;
 import com.java110.common.constant.StatusConstant;
@@ -11,6 +10,7 @@ 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;
@@ -31,11 +31,11 @@ import java.util.Map;
  * 协议地址 :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("deletePropertyInfoListener")
+@Java110Listener("deletePropertyUserListener")
 @Transactional
-public class DeletePropertyInfoListener extends AbstractPropertyBusinessServiceDataFlowListener {
+public class DeletePropertyUserListener extends AbstractPropertyBusinessServiceDataFlowListener {
 
-    private final static Logger logger = LoggerFactory.getLogger(DeletePropertyInfoListener.class);
+    private final static Logger logger = LoggerFactory.getLogger(DeletePropertyUserListener.class);
     @Autowired
     IPropertyServiceDao propertyServiceDaoImpl;
 
@@ -46,7 +46,7 @@ public class DeletePropertyInfoListener extends AbstractPropertyBusinessServiceD
 
     @Override
     public String getServiceCode() {
-        return ServiceCodeConstant.SERVICE_CODE_DELETE_STORE_INFO;
+        return ServiceCodeConstant.SERVICE_CODE_DELETE_PROPERTY_USER;
     }
 
     /**

+ 310 - 0
PropertyService/src/main/java/com/java110/property/listener/SavePropertyCerdentialsListener.java

@@ -0,0 +1,310 @@
+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.common.util.DateUtil;
+import com.java110.common.util.StringUtil;
+import com.java110.core.annotation.Java110Listener;
+import com.java110.core.context.DataFlowContext;
+import com.java110.core.factory.GenerateCodeFactory;
+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.text.ParseException;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 保存 用户信息 侦听
+ * Created by wuxw on 2018/5/18.
+ */
+@Java110Listener("savePropertyCerdentialsListener")
+@Transactional
+public class SavePropertyCerdentialsListener extends AbstractPropertyBusinessServiceDataFlowListener {
+
+    private final static Logger logger = LoggerFactory.getLogger(SavePropertyCerdentialsListener.class);
+
+    @Autowired
+    IPropertyServiceDao propertyServiceDaoImpl;
+
+    @Override
+    public int getOrder() {
+        return 0;
+    }
+
+    @Override
+    public String getServiceCode() {
+        return ServiceCodeConstant.SERVICE_CODE_SAVE_PROPERTY_CERDENTIALS;
+    }
+
+    /**
+     * 保存物业信息 business 表中
+     * @param dataFlowContext 数据对象
+     * @param business 当前业务对象
+     */
+    @Override
+    protected void doSaveBusiness(DataFlowContext dataFlowContext, Business business) {
+        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);
+        }
+    }
+
+    /**
+     * business 数据转移到 instance
+     * @param dataFlowContext 数据对象
+     * @param business 当前业务对象
+     */
+    @Override
+    protected void doBusinessToInstance(DataFlowContext dataFlowContext, Business business) {
+        JSONObject data = business.getDatas();
+
+        Map info = new HashMap();
+        info.put("bId",business.getbId());
+        info.put("operate",StatusConstant.OPERATE_ADD);
+
+        //物业信息
+        Map businessPropertyInfo = propertyServiceDaoImpl.getBusinessPropertyInfo(info);
+        if( businessPropertyInfo != null && !businessPropertyInfo.isEmpty()) {
+            propertyServiceDaoImpl.savePropertyInfoInstance(info);
+            dataFlowContext.addParamOut("propertyId",businessPropertyInfo.get("property_id"));
+        }
+        //物业属性
+        List<Map> businessPropertyAttrs = propertyServiceDaoImpl.getBusinessPropertyAttrs(info);
+        if(businessPropertyAttrs != null && businessPropertyAttrs.size() > 0) {
+            propertyServiceDaoImpl.savePropertyAttrsInstance(info);
+        }
+        //物业照片
+        List<Map> businessPropertyPhotos = propertyServiceDaoImpl.getBusinessPropertyPhoto(info);
+        if(businessPropertyPhotos != null && businessPropertyPhotos.size() >0){
+            propertyServiceDaoImpl.savePropertyPhotoInstance(info);
+        }
+        //物业证件
+        List<Map> businessPropertyCerdentialses = propertyServiceDaoImpl.getBusinessPropertyCerdentials(info);
+        if(businessPropertyCerdentialses != null && businessPropertyCerdentialses.size()>0){
+            propertyServiceDaoImpl.savePropertyCerdentialsInstance(info);
+        }
+    }
+
+    /**
+     * 撤单
+     * @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_VALID);
+        Map paramIn = new HashMap();
+        paramIn.put("bId",bId);
+        paramIn.put("statusCd",StatusConstant.STATUS_CD_INVALID);
+        //物业信息
+        Map propertyInfo = propertyServiceDaoImpl.getPropertyInfo(info);
+        if(propertyInfo != null && !propertyInfo.isEmpty()){
+            paramIn.put("propertyId",propertyInfo.get("property_id").toString());
+            propertyServiceDaoImpl.updatePropertyInfoInstance(paramIn);
+            dataFlowContext.addParamOut("propertyId",propertyInfo.get("property_id"));
+        }
+
+        //物业属性
+        List<Map> propertyAttrs = propertyServiceDaoImpl.getPropertyAttrs(info);
+        if(propertyAttrs != null && propertyAttrs.size()>0){
+            propertyServiceDaoImpl.updatePropertyAttrInstance(paramIn);
+        }
+
+        //物业照片
+        List<Map> propertyPhotos = propertyServiceDaoImpl.getPropertyPhoto(info);
+        if(propertyPhotos != null && propertyPhotos.size()>0){
+            propertyServiceDaoImpl.updatePropertyPhotoInstance(paramIn);
+        }
+
+        //物业属性
+        List<Map> propertyCerdentialses = propertyServiceDaoImpl.getPropertyCerdentials(info);
+        if(propertyCerdentialses != null && propertyCerdentialses.size()>0){
+            propertyServiceDaoImpl.updatePropertyCerdentailsInstance(paramIn);
+        }
+    }
+
+    /**
+     * 保存物业照片
+     * @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("-")) {
+                String propertyPhotoId = GenerateCodeFactory.getPropertyPhotoId();
+                businessPropertyPhoto.put("propertyPhotoId", propertyPhotoId);
+            }
+            businessPropertyPhoto.put("bId", business.getbId());
+            businessPropertyPhoto.put("operate", StatusConstant.OPERATE_ADD);
+            //保存物业信息
+            propertyServiceDaoImpl.saveBusinessPropertyPhoto(businessPropertyPhoto);
+        }
+    }
+
+    /**
+     * 处理 businessProperty 节点
+     * @param business 总的数据节点
+     * @param businessProperty 物业节点
+     */
+    private void doBusinessProperty(Business business,JSONObject businessProperty){
+
+        Assert.jsonObjectHaveKey(businessProperty,"propertyId","businessProperty 节点下没有包含 propertyId 节点");
+
+        if(businessProperty.getString("propertyId").startsWith("-")){
+            //刷新缓存
+            flushPropertyId(business.getDatas());
+        }
+
+        businessProperty.put("bId",business.getbId());
+        businessProperty.put("operate", StatusConstant.OPERATE_ADD);
+        //保存物业信息
+        propertyServiceDaoImpl.saveBusinessPropertyInfo(businessProperty);
+
+    }
+
+
+
+    /**
+     * 保存物业属性信息
+     * @param business 当前业务
+     * @param businessPropertyAttrs 物业属性
+     */
+    private void doSaveBusinessPropertyAttrs(Business business,JSONArray businessPropertyAttrs){
+        JSONObject data = business.getDatas();
+        JSONObject businessProperty = data.getJSONObject("businessProperty");
+        for(int propertyAttrIndex = 0 ; propertyAttrIndex < businessPropertyAttrs.size();propertyAttrIndex ++){
+            JSONObject propertyAttr = businessPropertyAttrs.getJSONObject(propertyAttrIndex);
+            Assert.jsonObjectHaveKey(propertyAttr,"attrId","businessPropertyAttr 节点下没有包含 attrId 节点");
+
+            if(propertyAttr.getString("attrId").startsWith("-")){
+                String attrId = GenerateCodeFactory.getAttrId();
+                propertyAttr.put("attrId",attrId);
+            }
+
+            propertyAttr.put("bId",business.getbId());
+            propertyAttr.put("propertyId",businessProperty.getString("propertyId"));
+            propertyAttr.put("operate", StatusConstant.OPERATE_ADD);
+
+            propertyServiceDaoImpl.saveBusinessPropertyAttr(propertyAttr);
+        }
+    }
+
+
+    /**
+     * 保存 物业证件 信息
+     * @param business 当前业务
+     * @param businessPropertyCerdentialses 物业证件
+     */
+    private void doBusinessPropertyCerdentials(Business business, JSONArray businessPropertyCerdentialses) {
+        for(int businessPropertyCerdentialsIndex = 0 ; businessPropertyCerdentialsIndex < businessPropertyCerdentialses.size() ; businessPropertyCerdentialsIndex ++) {
+            JSONObject businessPropertyCerdentials = businessPropertyCerdentialses.getJSONObject(businessPropertyCerdentialsIndex);
+            Assert.jsonObjectHaveKey(businessPropertyCerdentials, "propertyId", "businessPropertyPhoto 节点下没有包含 propertyId 节点");
+
+            if (businessPropertyCerdentials.getString("propertyCerdentialsId").startsWith("-")) {
+                String propertyPhotoId = GenerateCodeFactory.getPropertyCerdentialsId();
+                businessPropertyCerdentials.put("propertyCerdentialsId", propertyPhotoId);
+            }
+            Date validityPeriod = null;
+            try {
+                if(StringUtil.isNullOrNone(businessPropertyCerdentials.getString("validityPeriod"))){
+                    validityPeriod = DateUtil.getLastDate();
+                }else {
+                    validityPeriod = DateUtil.getDateFromString(businessPropertyCerdentials.getString("validityPeriod"), DateUtil.DATE_FORMATE_STRING_B);
+                }
+            } catch (ParseException e) {
+                throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"传入参数 validityPeriod 格式不正确,请填写 "+DateUtil.DATE_FORMATE_STRING_B +" 格式,"+businessPropertyCerdentials);
+            }
+            businessPropertyCerdentials.put("validityPeriod",validityPeriod);
+            businessPropertyCerdentials.put("bId", business.getbId());
+            businessPropertyCerdentials.put("operate", StatusConstant.OPERATE_ADD);
+            //保存物业信息
+            propertyServiceDaoImpl.saveBusinessPropertyCerdentials(businessPropertyCerdentials);
+        }
+    }
+
+
+
+    /**
+     * 刷新 物业ID
+     * @param data
+     */
+    private void flushPropertyId(JSONObject data) {
+
+        String propertyId = GenerateCodeFactory.getPropertyId();
+        JSONObject businessProperty = data.getJSONObject("businessProperty");
+        businessProperty.put("propertyId",propertyId);
+        //刷物业属性
+        if(data.containsKey("businessPropertyAttr")) {
+            JSONArray businessPropertyAttrs = data.getJSONArray("businessPropertyAttr");
+            for(int businessPropertyAttrIndex = 0;businessPropertyAttrIndex < businessPropertyAttrs.size();businessPropertyAttrIndex++) {
+                JSONObject businessPropertyAttr = businessPropertyAttrs.getJSONObject(businessPropertyAttrIndex);
+                businessPropertyAttr.put("propertyId", propertyId);
+            }
+        }
+        //刷 是物业照片 的 propertyId
+        if(data.containsKey("businessPropertyPhoto")) {
+            JSONArray businessPropertyPhotos = data.getJSONArray("businessPropertyPhoto");
+            for(int businessPropertyPhotoIndex = 0;businessPropertyPhotoIndex < businessPropertyPhotos.size();businessPropertyPhotoIndex++) {
+                JSONObject businessPropertyPhoto = businessPropertyPhotos.getJSONObject(businessPropertyPhotoIndex);
+                businessPropertyPhoto.put("propertyId", propertyId);
+            }
+        }
+        //刷 物业证件 的propertyId
+        if(data.containsKey("businessPropertyCerdentials")) {
+            JSONArray businessPropertyCerdentialses = data.getJSONArray("businessPropertyCerdentials");
+            for(int businessPropertyCerdentialsIndex = 0;businessPropertyCerdentialsIndex < businessPropertyCerdentialses.size();businessPropertyCerdentialsIndex++) {
+                JSONObject businessPropertyCerdentials = businessPropertyCerdentialses.getJSONObject(businessPropertyCerdentialsIndex);
+                businessPropertyCerdentials.put("propertyId", propertyId);
+            }
+        }
+    }
+
+
+    public IPropertyServiceDao getPropertyServiceDaoImpl() {
+        return propertyServiceDaoImpl;
+    }
+
+    public void setPropertyServiceDaoImpl(IPropertyServiceDao propertyServiceDaoImpl) {
+        this.propertyServiceDaoImpl = propertyServiceDaoImpl;
+    }
+}

+ 310 - 0
PropertyService/src/main/java/com/java110/property/listener/SavePropertyFeeListener.java

@@ -0,0 +1,310 @@
+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.common.util.DateUtil;
+import com.java110.common.util.StringUtil;
+import com.java110.core.annotation.Java110Listener;
+import com.java110.core.context.DataFlowContext;
+import com.java110.core.factory.GenerateCodeFactory;
+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.text.ParseException;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 保存 用户信息 侦听
+ * Created by wuxw on 2018/5/18.
+ */
+@Java110Listener("savePropertyFeeListener")
+@Transactional
+public class SavePropertyFeeListener extends AbstractPropertyBusinessServiceDataFlowListener {
+
+    private final static Logger logger = LoggerFactory.getLogger(SavePropertyFeeListener.class);
+
+    @Autowired
+    IPropertyServiceDao propertyServiceDaoImpl;
+
+    @Override
+    public int getOrder() {
+        return 0;
+    }
+
+    @Override
+    public String getServiceCode() {
+        return ServiceCodeConstant.SERVICE_CODE_SAVE_PROPERTY_FEE;
+    }
+
+    /**
+     * 保存物业信息 business 表中
+     * @param dataFlowContext 数据对象
+     * @param business 当前业务对象
+     */
+    @Override
+    protected void doSaveBusiness(DataFlowContext dataFlowContext, Business business) {
+        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);
+        }
+    }
+
+    /**
+     * business 数据转移到 instance
+     * @param dataFlowContext 数据对象
+     * @param business 当前业务对象
+     */
+    @Override
+    protected void doBusinessToInstance(DataFlowContext dataFlowContext, Business business) {
+        JSONObject data = business.getDatas();
+
+        Map info = new HashMap();
+        info.put("bId",business.getbId());
+        info.put("operate",StatusConstant.OPERATE_ADD);
+
+        //物业信息
+        Map businessPropertyInfo = propertyServiceDaoImpl.getBusinessPropertyInfo(info);
+        if( businessPropertyInfo != null && !businessPropertyInfo.isEmpty()) {
+            propertyServiceDaoImpl.savePropertyInfoInstance(info);
+            dataFlowContext.addParamOut("propertyId",businessPropertyInfo.get("property_id"));
+        }
+        //物业属性
+        List<Map> businessPropertyAttrs = propertyServiceDaoImpl.getBusinessPropertyAttrs(info);
+        if(businessPropertyAttrs != null && businessPropertyAttrs.size() > 0) {
+            propertyServiceDaoImpl.savePropertyAttrsInstance(info);
+        }
+        //物业照片
+        List<Map> businessPropertyPhotos = propertyServiceDaoImpl.getBusinessPropertyPhoto(info);
+        if(businessPropertyPhotos != null && businessPropertyPhotos.size() >0){
+            propertyServiceDaoImpl.savePropertyPhotoInstance(info);
+        }
+        //物业证件
+        List<Map> businessPropertyCerdentialses = propertyServiceDaoImpl.getBusinessPropertyCerdentials(info);
+        if(businessPropertyCerdentialses != null && businessPropertyCerdentialses.size()>0){
+            propertyServiceDaoImpl.savePropertyCerdentialsInstance(info);
+        }
+    }
+
+    /**
+     * 撤单
+     * @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_VALID);
+        Map paramIn = new HashMap();
+        paramIn.put("bId",bId);
+        paramIn.put("statusCd",StatusConstant.STATUS_CD_INVALID);
+        //物业信息
+        Map propertyInfo = propertyServiceDaoImpl.getPropertyInfo(info);
+        if(propertyInfo != null && !propertyInfo.isEmpty()){
+            paramIn.put("propertyId",propertyInfo.get("property_id").toString());
+            propertyServiceDaoImpl.updatePropertyInfoInstance(paramIn);
+            dataFlowContext.addParamOut("propertyId",propertyInfo.get("property_id"));
+        }
+
+        //物业属性
+        List<Map> propertyAttrs = propertyServiceDaoImpl.getPropertyAttrs(info);
+        if(propertyAttrs != null && propertyAttrs.size()>0){
+            propertyServiceDaoImpl.updatePropertyAttrInstance(paramIn);
+        }
+
+        //物业照片
+        List<Map> propertyPhotos = propertyServiceDaoImpl.getPropertyPhoto(info);
+        if(propertyPhotos != null && propertyPhotos.size()>0){
+            propertyServiceDaoImpl.updatePropertyPhotoInstance(paramIn);
+        }
+
+        //物业属性
+        List<Map> propertyCerdentialses = propertyServiceDaoImpl.getPropertyCerdentials(info);
+        if(propertyCerdentialses != null && propertyCerdentialses.size()>0){
+            propertyServiceDaoImpl.updatePropertyCerdentailsInstance(paramIn);
+        }
+    }
+
+    /**
+     * 保存物业照片
+     * @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("-")) {
+                String propertyPhotoId = GenerateCodeFactory.getPropertyPhotoId();
+                businessPropertyPhoto.put("propertyPhotoId", propertyPhotoId);
+            }
+            businessPropertyPhoto.put("bId", business.getbId());
+            businessPropertyPhoto.put("operate", StatusConstant.OPERATE_ADD);
+            //保存物业信息
+            propertyServiceDaoImpl.saveBusinessPropertyPhoto(businessPropertyPhoto);
+        }
+    }
+
+    /**
+     * 处理 businessProperty 节点
+     * @param business 总的数据节点
+     * @param businessProperty 物业节点
+     */
+    private void doBusinessProperty(Business business,JSONObject businessProperty){
+
+        Assert.jsonObjectHaveKey(businessProperty,"propertyId","businessProperty 节点下没有包含 propertyId 节点");
+
+        if(businessProperty.getString("propertyId").startsWith("-")){
+            //刷新缓存
+            flushPropertyId(business.getDatas());
+        }
+
+        businessProperty.put("bId",business.getbId());
+        businessProperty.put("operate", StatusConstant.OPERATE_ADD);
+        //保存物业信息
+        propertyServiceDaoImpl.saveBusinessPropertyInfo(businessProperty);
+
+    }
+
+
+
+    /**
+     * 保存物业属性信息
+     * @param business 当前业务
+     * @param businessPropertyAttrs 物业属性
+     */
+    private void doSaveBusinessPropertyAttrs(Business business,JSONArray businessPropertyAttrs){
+        JSONObject data = business.getDatas();
+        JSONObject businessProperty = data.getJSONObject("businessProperty");
+        for(int propertyAttrIndex = 0 ; propertyAttrIndex < businessPropertyAttrs.size();propertyAttrIndex ++){
+            JSONObject propertyAttr = businessPropertyAttrs.getJSONObject(propertyAttrIndex);
+            Assert.jsonObjectHaveKey(propertyAttr,"attrId","businessPropertyAttr 节点下没有包含 attrId 节点");
+
+            if(propertyAttr.getString("attrId").startsWith("-")){
+                String attrId = GenerateCodeFactory.getAttrId();
+                propertyAttr.put("attrId",attrId);
+            }
+
+            propertyAttr.put("bId",business.getbId());
+            propertyAttr.put("propertyId",businessProperty.getString("propertyId"));
+            propertyAttr.put("operate", StatusConstant.OPERATE_ADD);
+
+            propertyServiceDaoImpl.saveBusinessPropertyAttr(propertyAttr);
+        }
+    }
+
+
+    /**
+     * 保存 物业证件 信息
+     * @param business 当前业务
+     * @param businessPropertyCerdentialses 物业证件
+     */
+    private void doBusinessPropertyCerdentials(Business business, JSONArray businessPropertyCerdentialses) {
+        for(int businessPropertyCerdentialsIndex = 0 ; businessPropertyCerdentialsIndex < businessPropertyCerdentialses.size() ; businessPropertyCerdentialsIndex ++) {
+            JSONObject businessPropertyCerdentials = businessPropertyCerdentialses.getJSONObject(businessPropertyCerdentialsIndex);
+            Assert.jsonObjectHaveKey(businessPropertyCerdentials, "propertyId", "businessPropertyPhoto 节点下没有包含 propertyId 节点");
+
+            if (businessPropertyCerdentials.getString("propertyCerdentialsId").startsWith("-")) {
+                String propertyPhotoId = GenerateCodeFactory.getPropertyCerdentialsId();
+                businessPropertyCerdentials.put("propertyCerdentialsId", propertyPhotoId);
+            }
+            Date validityPeriod = null;
+            try {
+                if(StringUtil.isNullOrNone(businessPropertyCerdentials.getString("validityPeriod"))){
+                    validityPeriod = DateUtil.getLastDate();
+                }else {
+                    validityPeriod = DateUtil.getDateFromString(businessPropertyCerdentials.getString("validityPeriod"), DateUtil.DATE_FORMATE_STRING_B);
+                }
+            } catch (ParseException e) {
+                throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"传入参数 validityPeriod 格式不正确,请填写 "+DateUtil.DATE_FORMATE_STRING_B +" 格式,"+businessPropertyCerdentials);
+            }
+            businessPropertyCerdentials.put("validityPeriod",validityPeriod);
+            businessPropertyCerdentials.put("bId", business.getbId());
+            businessPropertyCerdentials.put("operate", StatusConstant.OPERATE_ADD);
+            //保存物业信息
+            propertyServiceDaoImpl.saveBusinessPropertyCerdentials(businessPropertyCerdentials);
+        }
+    }
+
+
+
+    /**
+     * 刷新 物业ID
+     * @param data
+     */
+    private void flushPropertyId(JSONObject data) {
+
+        String propertyId = GenerateCodeFactory.getPropertyId();
+        JSONObject businessProperty = data.getJSONObject("businessProperty");
+        businessProperty.put("propertyId",propertyId);
+        //刷物业属性
+        if(data.containsKey("businessPropertyAttr")) {
+            JSONArray businessPropertyAttrs = data.getJSONArray("businessPropertyAttr");
+            for(int businessPropertyAttrIndex = 0;businessPropertyAttrIndex < businessPropertyAttrs.size();businessPropertyAttrIndex++) {
+                JSONObject businessPropertyAttr = businessPropertyAttrs.getJSONObject(businessPropertyAttrIndex);
+                businessPropertyAttr.put("propertyId", propertyId);
+            }
+        }
+        //刷 是物业照片 的 propertyId
+        if(data.containsKey("businessPropertyPhoto")) {
+            JSONArray businessPropertyPhotos = data.getJSONArray("businessPropertyPhoto");
+            for(int businessPropertyPhotoIndex = 0;businessPropertyPhotoIndex < businessPropertyPhotos.size();businessPropertyPhotoIndex++) {
+                JSONObject businessPropertyPhoto = businessPropertyPhotos.getJSONObject(businessPropertyPhotoIndex);
+                businessPropertyPhoto.put("propertyId", propertyId);
+            }
+        }
+        //刷 物业证件 的propertyId
+        if(data.containsKey("businessPropertyCerdentials")) {
+            JSONArray businessPropertyCerdentialses = data.getJSONArray("businessPropertyCerdentials");
+            for(int businessPropertyCerdentialsIndex = 0;businessPropertyCerdentialsIndex < businessPropertyCerdentialses.size();businessPropertyCerdentialsIndex++) {
+                JSONObject businessPropertyCerdentials = businessPropertyCerdentialses.getJSONObject(businessPropertyCerdentialsIndex);
+                businessPropertyCerdentials.put("propertyId", propertyId);
+            }
+        }
+    }
+
+
+    public IPropertyServiceDao getPropertyServiceDaoImpl() {
+        return propertyServiceDaoImpl;
+    }
+
+    public void setPropertyServiceDaoImpl(IPropertyServiceDao propertyServiceDaoImpl) {
+        this.propertyServiceDaoImpl = propertyServiceDaoImpl;
+    }
+}

+ 310 - 0
PropertyService/src/main/java/com/java110/property/listener/SavePropertyHouseListener.java

@@ -0,0 +1,310 @@
+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.common.util.DateUtil;
+import com.java110.common.util.StringUtil;
+import com.java110.core.annotation.Java110Listener;
+import com.java110.core.context.DataFlowContext;
+import com.java110.core.factory.GenerateCodeFactory;
+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.text.ParseException;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 保存 用户信息 侦听
+ * Created by wuxw on 2018/5/18.
+ */
+@Java110Listener("savePropertyHouseListener")
+@Transactional
+public class SavePropertyHouseListener extends AbstractPropertyBusinessServiceDataFlowListener {
+
+    private final static Logger logger = LoggerFactory.getLogger(SavePropertyHouseListener.class);
+
+    @Autowired
+    IPropertyServiceDao propertyServiceDaoImpl;
+
+    @Override
+    public int getOrder() {
+        return 0;
+    }
+
+    @Override
+    public String getServiceCode() {
+        return ServiceCodeConstant.SERVICE_CODE_SAVE_PROPERTY_HOUSE;
+    }
+
+    /**
+     * 保存物业信息 business 表中
+     * @param dataFlowContext 数据对象
+     * @param business 当前业务对象
+     */
+    @Override
+    protected void doSaveBusiness(DataFlowContext dataFlowContext, Business business) {
+        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);
+        }
+    }
+
+    /**
+     * business 数据转移到 instance
+     * @param dataFlowContext 数据对象
+     * @param business 当前业务对象
+     */
+    @Override
+    protected void doBusinessToInstance(DataFlowContext dataFlowContext, Business business) {
+        JSONObject data = business.getDatas();
+
+        Map info = new HashMap();
+        info.put("bId",business.getbId());
+        info.put("operate",StatusConstant.OPERATE_ADD);
+
+        //物业信息
+        Map businessPropertyInfo = propertyServiceDaoImpl.getBusinessPropertyInfo(info);
+        if( businessPropertyInfo != null && !businessPropertyInfo.isEmpty()) {
+            propertyServiceDaoImpl.savePropertyInfoInstance(info);
+            dataFlowContext.addParamOut("propertyId",businessPropertyInfo.get("property_id"));
+        }
+        //物业属性
+        List<Map> businessPropertyAttrs = propertyServiceDaoImpl.getBusinessPropertyAttrs(info);
+        if(businessPropertyAttrs != null && businessPropertyAttrs.size() > 0) {
+            propertyServiceDaoImpl.savePropertyAttrsInstance(info);
+        }
+        //物业照片
+        List<Map> businessPropertyPhotos = propertyServiceDaoImpl.getBusinessPropertyPhoto(info);
+        if(businessPropertyPhotos != null && businessPropertyPhotos.size() >0){
+            propertyServiceDaoImpl.savePropertyPhotoInstance(info);
+        }
+        //物业证件
+        List<Map> businessPropertyCerdentialses = propertyServiceDaoImpl.getBusinessPropertyCerdentials(info);
+        if(businessPropertyCerdentialses != null && businessPropertyCerdentialses.size()>0){
+            propertyServiceDaoImpl.savePropertyCerdentialsInstance(info);
+        }
+    }
+
+    /**
+     * 撤单
+     * @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_VALID);
+        Map paramIn = new HashMap();
+        paramIn.put("bId",bId);
+        paramIn.put("statusCd",StatusConstant.STATUS_CD_INVALID);
+        //物业信息
+        Map propertyInfo = propertyServiceDaoImpl.getPropertyInfo(info);
+        if(propertyInfo != null && !propertyInfo.isEmpty()){
+            paramIn.put("propertyId",propertyInfo.get("property_id").toString());
+            propertyServiceDaoImpl.updatePropertyInfoInstance(paramIn);
+            dataFlowContext.addParamOut("propertyId",propertyInfo.get("property_id"));
+        }
+
+        //物业属性
+        List<Map> propertyAttrs = propertyServiceDaoImpl.getPropertyAttrs(info);
+        if(propertyAttrs != null && propertyAttrs.size()>0){
+            propertyServiceDaoImpl.updatePropertyAttrInstance(paramIn);
+        }
+
+        //物业照片
+        List<Map> propertyPhotos = propertyServiceDaoImpl.getPropertyPhoto(info);
+        if(propertyPhotos != null && propertyPhotos.size()>0){
+            propertyServiceDaoImpl.updatePropertyPhotoInstance(paramIn);
+        }
+
+        //物业属性
+        List<Map> propertyCerdentialses = propertyServiceDaoImpl.getPropertyCerdentials(info);
+        if(propertyCerdentialses != null && propertyCerdentialses.size()>0){
+            propertyServiceDaoImpl.updatePropertyCerdentailsInstance(paramIn);
+        }
+    }
+
+    /**
+     * 保存物业照片
+     * @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("-")) {
+                String propertyPhotoId = GenerateCodeFactory.getPropertyPhotoId();
+                businessPropertyPhoto.put("propertyPhotoId", propertyPhotoId);
+            }
+            businessPropertyPhoto.put("bId", business.getbId());
+            businessPropertyPhoto.put("operate", StatusConstant.OPERATE_ADD);
+            //保存物业信息
+            propertyServiceDaoImpl.saveBusinessPropertyPhoto(businessPropertyPhoto);
+        }
+    }
+
+    /**
+     * 处理 businessProperty 节点
+     * @param business 总的数据节点
+     * @param businessProperty 物业节点
+     */
+    private void doBusinessProperty(Business business,JSONObject businessProperty){
+
+        Assert.jsonObjectHaveKey(businessProperty,"propertyId","businessProperty 节点下没有包含 propertyId 节点");
+
+        if(businessProperty.getString("propertyId").startsWith("-")){
+            //刷新缓存
+            flushPropertyId(business.getDatas());
+        }
+
+        businessProperty.put("bId",business.getbId());
+        businessProperty.put("operate", StatusConstant.OPERATE_ADD);
+        //保存物业信息
+        propertyServiceDaoImpl.saveBusinessPropertyInfo(businessProperty);
+
+    }
+
+
+
+    /**
+     * 保存物业属性信息
+     * @param business 当前业务
+     * @param businessPropertyAttrs 物业属性
+     */
+    private void doSaveBusinessPropertyAttrs(Business business,JSONArray businessPropertyAttrs){
+        JSONObject data = business.getDatas();
+        JSONObject businessProperty = data.getJSONObject("businessProperty");
+        for(int propertyAttrIndex = 0 ; propertyAttrIndex < businessPropertyAttrs.size();propertyAttrIndex ++){
+            JSONObject propertyAttr = businessPropertyAttrs.getJSONObject(propertyAttrIndex);
+            Assert.jsonObjectHaveKey(propertyAttr,"attrId","businessPropertyAttr 节点下没有包含 attrId 节点");
+
+            if(propertyAttr.getString("attrId").startsWith("-")){
+                String attrId = GenerateCodeFactory.getAttrId();
+                propertyAttr.put("attrId",attrId);
+            }
+
+            propertyAttr.put("bId",business.getbId());
+            propertyAttr.put("propertyId",businessProperty.getString("propertyId"));
+            propertyAttr.put("operate", StatusConstant.OPERATE_ADD);
+
+            propertyServiceDaoImpl.saveBusinessPropertyAttr(propertyAttr);
+        }
+    }
+
+
+    /**
+     * 保存 物业证件 信息
+     * @param business 当前业务
+     * @param businessPropertyCerdentialses 物业证件
+     */
+    private void doBusinessPropertyCerdentials(Business business, JSONArray businessPropertyCerdentialses) {
+        for(int businessPropertyCerdentialsIndex = 0 ; businessPropertyCerdentialsIndex < businessPropertyCerdentialses.size() ; businessPropertyCerdentialsIndex ++) {
+            JSONObject businessPropertyCerdentials = businessPropertyCerdentialses.getJSONObject(businessPropertyCerdentialsIndex);
+            Assert.jsonObjectHaveKey(businessPropertyCerdentials, "propertyId", "businessPropertyPhoto 节点下没有包含 propertyId 节点");
+
+            if (businessPropertyCerdentials.getString("propertyCerdentialsId").startsWith("-")) {
+                String propertyPhotoId = GenerateCodeFactory.getPropertyCerdentialsId();
+                businessPropertyCerdentials.put("propertyCerdentialsId", propertyPhotoId);
+            }
+            Date validityPeriod = null;
+            try {
+                if(StringUtil.isNullOrNone(businessPropertyCerdentials.getString("validityPeriod"))){
+                    validityPeriod = DateUtil.getLastDate();
+                }else {
+                    validityPeriod = DateUtil.getDateFromString(businessPropertyCerdentials.getString("validityPeriod"), DateUtil.DATE_FORMATE_STRING_B);
+                }
+            } catch (ParseException e) {
+                throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"传入参数 validityPeriod 格式不正确,请填写 "+DateUtil.DATE_FORMATE_STRING_B +" 格式,"+businessPropertyCerdentials);
+            }
+            businessPropertyCerdentials.put("validityPeriod",validityPeriod);
+            businessPropertyCerdentials.put("bId", business.getbId());
+            businessPropertyCerdentials.put("operate", StatusConstant.OPERATE_ADD);
+            //保存物业信息
+            propertyServiceDaoImpl.saveBusinessPropertyCerdentials(businessPropertyCerdentials);
+        }
+    }
+
+
+
+    /**
+     * 刷新 物业ID
+     * @param data
+     */
+    private void flushPropertyId(JSONObject data) {
+
+        String propertyId = GenerateCodeFactory.getPropertyId();
+        JSONObject businessProperty = data.getJSONObject("businessProperty");
+        businessProperty.put("propertyId",propertyId);
+        //刷物业属性
+        if(data.containsKey("businessPropertyAttr")) {
+            JSONArray businessPropertyAttrs = data.getJSONArray("businessPropertyAttr");
+            for(int businessPropertyAttrIndex = 0;businessPropertyAttrIndex < businessPropertyAttrs.size();businessPropertyAttrIndex++) {
+                JSONObject businessPropertyAttr = businessPropertyAttrs.getJSONObject(businessPropertyAttrIndex);
+                businessPropertyAttr.put("propertyId", propertyId);
+            }
+        }
+        //刷 是物业照片 的 propertyId
+        if(data.containsKey("businessPropertyPhoto")) {
+            JSONArray businessPropertyPhotos = data.getJSONArray("businessPropertyPhoto");
+            for(int businessPropertyPhotoIndex = 0;businessPropertyPhotoIndex < businessPropertyPhotos.size();businessPropertyPhotoIndex++) {
+                JSONObject businessPropertyPhoto = businessPropertyPhotos.getJSONObject(businessPropertyPhotoIndex);
+                businessPropertyPhoto.put("propertyId", propertyId);
+            }
+        }
+        //刷 物业证件 的propertyId
+        if(data.containsKey("businessPropertyCerdentials")) {
+            JSONArray businessPropertyCerdentialses = data.getJSONArray("businessPropertyCerdentials");
+            for(int businessPropertyCerdentialsIndex = 0;businessPropertyCerdentialsIndex < businessPropertyCerdentialses.size();businessPropertyCerdentialsIndex++) {
+                JSONObject businessPropertyCerdentials = businessPropertyCerdentialses.getJSONObject(businessPropertyCerdentialsIndex);
+                businessPropertyCerdentials.put("propertyId", propertyId);
+            }
+        }
+    }
+
+
+    public IPropertyServiceDao getPropertyServiceDaoImpl() {
+        return propertyServiceDaoImpl;
+    }
+
+    public void setPropertyServiceDaoImpl(IPropertyServiceDao propertyServiceDaoImpl) {
+        this.propertyServiceDaoImpl = propertyServiceDaoImpl;
+    }
+}

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

@@ -45,7 +45,7 @@ public class SavePropertyInfoListener extends AbstractPropertyBusinessServiceDat
 
     @Override
     public String getServiceCode() {
-        return ServiceCodeConstant.SERVICE_CODE_SAVE_STORE_INFO;
+        return ServiceCodeConstant.SERVICE_CODE_SAVE_PROPERTY_INFO;
     }
 
     /**

+ 310 - 0
PropertyService/src/main/java/com/java110/property/listener/SavePropertyPhotoListener.java

@@ -0,0 +1,310 @@
+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.common.util.DateUtil;
+import com.java110.common.util.StringUtil;
+import com.java110.core.annotation.Java110Listener;
+import com.java110.core.context.DataFlowContext;
+import com.java110.core.factory.GenerateCodeFactory;
+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.text.ParseException;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 保存 用户信息 侦听
+ * Created by wuxw on 2018/5/18.
+ */
+@Java110Listener("savePropertyPhotoListener")
+@Transactional
+public class SavePropertyPhotoListener extends AbstractPropertyBusinessServiceDataFlowListener {
+
+    private final static Logger logger = LoggerFactory.getLogger(SavePropertyPhotoListener.class);
+
+    @Autowired
+    IPropertyServiceDao propertyServiceDaoImpl;
+
+    @Override
+    public int getOrder() {
+        return 0;
+    }
+
+    @Override
+    public String getServiceCode() {
+        return ServiceCodeConstant.SERVICE_CODE_SAVE_PROPERTY_PHOTO;
+    }
+
+    /**
+     * 保存物业信息 business 表中
+     * @param dataFlowContext 数据对象
+     * @param business 当前业务对象
+     */
+    @Override
+    protected void doSaveBusiness(DataFlowContext dataFlowContext, Business business) {
+        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);
+        }
+    }
+
+    /**
+     * business 数据转移到 instance
+     * @param dataFlowContext 数据对象
+     * @param business 当前业务对象
+     */
+    @Override
+    protected void doBusinessToInstance(DataFlowContext dataFlowContext, Business business) {
+        JSONObject data = business.getDatas();
+
+        Map info = new HashMap();
+        info.put("bId",business.getbId());
+        info.put("operate",StatusConstant.OPERATE_ADD);
+
+        //物业信息
+        Map businessPropertyInfo = propertyServiceDaoImpl.getBusinessPropertyInfo(info);
+        if( businessPropertyInfo != null && !businessPropertyInfo.isEmpty()) {
+            propertyServiceDaoImpl.savePropertyInfoInstance(info);
+            dataFlowContext.addParamOut("propertyId",businessPropertyInfo.get("property_id"));
+        }
+        //物业属性
+        List<Map> businessPropertyAttrs = propertyServiceDaoImpl.getBusinessPropertyAttrs(info);
+        if(businessPropertyAttrs != null && businessPropertyAttrs.size() > 0) {
+            propertyServiceDaoImpl.savePropertyAttrsInstance(info);
+        }
+        //物业照片
+        List<Map> businessPropertyPhotos = propertyServiceDaoImpl.getBusinessPropertyPhoto(info);
+        if(businessPropertyPhotos != null && businessPropertyPhotos.size() >0){
+            propertyServiceDaoImpl.savePropertyPhotoInstance(info);
+        }
+        //物业证件
+        List<Map> businessPropertyCerdentialses = propertyServiceDaoImpl.getBusinessPropertyCerdentials(info);
+        if(businessPropertyCerdentialses != null && businessPropertyCerdentialses.size()>0){
+            propertyServiceDaoImpl.savePropertyCerdentialsInstance(info);
+        }
+    }
+
+    /**
+     * 撤单
+     * @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_VALID);
+        Map paramIn = new HashMap();
+        paramIn.put("bId",bId);
+        paramIn.put("statusCd",StatusConstant.STATUS_CD_INVALID);
+        //物业信息
+        Map propertyInfo = propertyServiceDaoImpl.getPropertyInfo(info);
+        if(propertyInfo != null && !propertyInfo.isEmpty()){
+            paramIn.put("propertyId",propertyInfo.get("property_id").toString());
+            propertyServiceDaoImpl.updatePropertyInfoInstance(paramIn);
+            dataFlowContext.addParamOut("propertyId",propertyInfo.get("property_id"));
+        }
+
+        //物业属性
+        List<Map> propertyAttrs = propertyServiceDaoImpl.getPropertyAttrs(info);
+        if(propertyAttrs != null && propertyAttrs.size()>0){
+            propertyServiceDaoImpl.updatePropertyAttrInstance(paramIn);
+        }
+
+        //物业照片
+        List<Map> propertyPhotos = propertyServiceDaoImpl.getPropertyPhoto(info);
+        if(propertyPhotos != null && propertyPhotos.size()>0){
+            propertyServiceDaoImpl.updatePropertyPhotoInstance(paramIn);
+        }
+
+        //物业属性
+        List<Map> propertyCerdentialses = propertyServiceDaoImpl.getPropertyCerdentials(info);
+        if(propertyCerdentialses != null && propertyCerdentialses.size()>0){
+            propertyServiceDaoImpl.updatePropertyCerdentailsInstance(paramIn);
+        }
+    }
+
+    /**
+     * 保存物业照片
+     * @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("-")) {
+                String propertyPhotoId = GenerateCodeFactory.getPropertyPhotoId();
+                businessPropertyPhoto.put("propertyPhotoId", propertyPhotoId);
+            }
+            businessPropertyPhoto.put("bId", business.getbId());
+            businessPropertyPhoto.put("operate", StatusConstant.OPERATE_ADD);
+            //保存物业信息
+            propertyServiceDaoImpl.saveBusinessPropertyPhoto(businessPropertyPhoto);
+        }
+    }
+
+    /**
+     * 处理 businessProperty 节点
+     * @param business 总的数据节点
+     * @param businessProperty 物业节点
+     */
+    private void doBusinessProperty(Business business,JSONObject businessProperty){
+
+        Assert.jsonObjectHaveKey(businessProperty,"propertyId","businessProperty 节点下没有包含 propertyId 节点");
+
+        if(businessProperty.getString("propertyId").startsWith("-")){
+            //刷新缓存
+            flushPropertyId(business.getDatas());
+        }
+
+        businessProperty.put("bId",business.getbId());
+        businessProperty.put("operate", StatusConstant.OPERATE_ADD);
+        //保存物业信息
+        propertyServiceDaoImpl.saveBusinessPropertyInfo(businessProperty);
+
+    }
+
+
+
+    /**
+     * 保存物业属性信息
+     * @param business 当前业务
+     * @param businessPropertyAttrs 物业属性
+     */
+    private void doSaveBusinessPropertyAttrs(Business business,JSONArray businessPropertyAttrs){
+        JSONObject data = business.getDatas();
+        JSONObject businessProperty = data.getJSONObject("businessProperty");
+        for(int propertyAttrIndex = 0 ; propertyAttrIndex < businessPropertyAttrs.size();propertyAttrIndex ++){
+            JSONObject propertyAttr = businessPropertyAttrs.getJSONObject(propertyAttrIndex);
+            Assert.jsonObjectHaveKey(propertyAttr,"attrId","businessPropertyAttr 节点下没有包含 attrId 节点");
+
+            if(propertyAttr.getString("attrId").startsWith("-")){
+                String attrId = GenerateCodeFactory.getAttrId();
+                propertyAttr.put("attrId",attrId);
+            }
+
+            propertyAttr.put("bId",business.getbId());
+            propertyAttr.put("propertyId",businessProperty.getString("propertyId"));
+            propertyAttr.put("operate", StatusConstant.OPERATE_ADD);
+
+            propertyServiceDaoImpl.saveBusinessPropertyAttr(propertyAttr);
+        }
+    }
+
+
+    /**
+     * 保存 物业证件 信息
+     * @param business 当前业务
+     * @param businessPropertyCerdentialses 物业证件
+     */
+    private void doBusinessPropertyCerdentials(Business business, JSONArray businessPropertyCerdentialses) {
+        for(int businessPropertyCerdentialsIndex = 0 ; businessPropertyCerdentialsIndex < businessPropertyCerdentialses.size() ; businessPropertyCerdentialsIndex ++) {
+            JSONObject businessPropertyCerdentials = businessPropertyCerdentialses.getJSONObject(businessPropertyCerdentialsIndex);
+            Assert.jsonObjectHaveKey(businessPropertyCerdentials, "propertyId", "businessPropertyPhoto 节点下没有包含 propertyId 节点");
+
+            if (businessPropertyCerdentials.getString("propertyCerdentialsId").startsWith("-")) {
+                String propertyPhotoId = GenerateCodeFactory.getPropertyCerdentialsId();
+                businessPropertyCerdentials.put("propertyCerdentialsId", propertyPhotoId);
+            }
+            Date validityPeriod = null;
+            try {
+                if(StringUtil.isNullOrNone(businessPropertyCerdentials.getString("validityPeriod"))){
+                    validityPeriod = DateUtil.getLastDate();
+                }else {
+                    validityPeriod = DateUtil.getDateFromString(businessPropertyCerdentials.getString("validityPeriod"), DateUtil.DATE_FORMATE_STRING_B);
+                }
+            } catch (ParseException e) {
+                throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"传入参数 validityPeriod 格式不正确,请填写 "+DateUtil.DATE_FORMATE_STRING_B +" 格式,"+businessPropertyCerdentials);
+            }
+            businessPropertyCerdentials.put("validityPeriod",validityPeriod);
+            businessPropertyCerdentials.put("bId", business.getbId());
+            businessPropertyCerdentials.put("operate", StatusConstant.OPERATE_ADD);
+            //保存物业信息
+            propertyServiceDaoImpl.saveBusinessPropertyCerdentials(businessPropertyCerdentials);
+        }
+    }
+
+
+
+    /**
+     * 刷新 物业ID
+     * @param data
+     */
+    private void flushPropertyId(JSONObject data) {
+
+        String propertyId = GenerateCodeFactory.getPropertyId();
+        JSONObject businessProperty = data.getJSONObject("businessProperty");
+        businessProperty.put("propertyId",propertyId);
+        //刷物业属性
+        if(data.containsKey("businessPropertyAttr")) {
+            JSONArray businessPropertyAttrs = data.getJSONArray("businessPropertyAttr");
+            for(int businessPropertyAttrIndex = 0;businessPropertyAttrIndex < businessPropertyAttrs.size();businessPropertyAttrIndex++) {
+                JSONObject businessPropertyAttr = businessPropertyAttrs.getJSONObject(businessPropertyAttrIndex);
+                businessPropertyAttr.put("propertyId", propertyId);
+            }
+        }
+        //刷 是物业照片 的 propertyId
+        if(data.containsKey("businessPropertyPhoto")) {
+            JSONArray businessPropertyPhotos = data.getJSONArray("businessPropertyPhoto");
+            for(int businessPropertyPhotoIndex = 0;businessPropertyPhotoIndex < businessPropertyPhotos.size();businessPropertyPhotoIndex++) {
+                JSONObject businessPropertyPhoto = businessPropertyPhotos.getJSONObject(businessPropertyPhotoIndex);
+                businessPropertyPhoto.put("propertyId", propertyId);
+            }
+        }
+        //刷 物业证件 的propertyId
+        if(data.containsKey("businessPropertyCerdentials")) {
+            JSONArray businessPropertyCerdentialses = data.getJSONArray("businessPropertyCerdentials");
+            for(int businessPropertyCerdentialsIndex = 0;businessPropertyCerdentialsIndex < businessPropertyCerdentialses.size();businessPropertyCerdentialsIndex++) {
+                JSONObject businessPropertyCerdentials = businessPropertyCerdentialses.getJSONObject(businessPropertyCerdentialsIndex);
+                businessPropertyCerdentials.put("propertyId", propertyId);
+            }
+        }
+    }
+
+
+    public IPropertyServiceDao getPropertyServiceDaoImpl() {
+        return propertyServiceDaoImpl;
+    }
+
+    public void setPropertyServiceDaoImpl(IPropertyServiceDao propertyServiceDaoImpl) {
+        this.propertyServiceDaoImpl = propertyServiceDaoImpl;
+    }
+}

+ 310 - 0
PropertyService/src/main/java/com/java110/property/listener/SavePropertyUserListener.java

@@ -0,0 +1,310 @@
+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.common.util.DateUtil;
+import com.java110.common.util.StringUtil;
+import com.java110.core.annotation.Java110Listener;
+import com.java110.core.context.DataFlowContext;
+import com.java110.core.factory.GenerateCodeFactory;
+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.text.ParseException;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 保存 用户信息 侦听
+ * Created by wuxw on 2018/5/18.
+ */
+@Java110Listener("savePropertyUserListener")
+@Transactional
+public class SavePropertyUserListener extends AbstractPropertyBusinessServiceDataFlowListener {
+
+    private final static Logger logger = LoggerFactory.getLogger(SavePropertyUserListener.class);
+
+    @Autowired
+    IPropertyServiceDao propertyServiceDaoImpl;
+
+    @Override
+    public int getOrder() {
+        return 0;
+    }
+
+    @Override
+    public String getServiceCode() {
+        return ServiceCodeConstant.SERVICE_CODE_SAVE_PROPERTY_USER;
+    }
+
+    /**
+     * 保存物业信息 business 表中
+     * @param dataFlowContext 数据对象
+     * @param business 当前业务对象
+     */
+    @Override
+    protected void doSaveBusiness(DataFlowContext dataFlowContext, Business business) {
+        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);
+        }
+    }
+
+    /**
+     * business 数据转移到 instance
+     * @param dataFlowContext 数据对象
+     * @param business 当前业务对象
+     */
+    @Override
+    protected void doBusinessToInstance(DataFlowContext dataFlowContext, Business business) {
+        JSONObject data = business.getDatas();
+
+        Map info = new HashMap();
+        info.put("bId",business.getbId());
+        info.put("operate",StatusConstant.OPERATE_ADD);
+
+        //物业信息
+        Map businessPropertyInfo = propertyServiceDaoImpl.getBusinessPropertyInfo(info);
+        if( businessPropertyInfo != null && !businessPropertyInfo.isEmpty()) {
+            propertyServiceDaoImpl.savePropertyInfoInstance(info);
+            dataFlowContext.addParamOut("propertyId",businessPropertyInfo.get("property_id"));
+        }
+        //物业属性
+        List<Map> businessPropertyAttrs = propertyServiceDaoImpl.getBusinessPropertyAttrs(info);
+        if(businessPropertyAttrs != null && businessPropertyAttrs.size() > 0) {
+            propertyServiceDaoImpl.savePropertyAttrsInstance(info);
+        }
+        //物业照片
+        List<Map> businessPropertyPhotos = propertyServiceDaoImpl.getBusinessPropertyPhoto(info);
+        if(businessPropertyPhotos != null && businessPropertyPhotos.size() >0){
+            propertyServiceDaoImpl.savePropertyPhotoInstance(info);
+        }
+        //物业证件
+        List<Map> businessPropertyCerdentialses = propertyServiceDaoImpl.getBusinessPropertyCerdentials(info);
+        if(businessPropertyCerdentialses != null && businessPropertyCerdentialses.size()>0){
+            propertyServiceDaoImpl.savePropertyCerdentialsInstance(info);
+        }
+    }
+
+    /**
+     * 撤单
+     * @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_VALID);
+        Map paramIn = new HashMap();
+        paramIn.put("bId",bId);
+        paramIn.put("statusCd",StatusConstant.STATUS_CD_INVALID);
+        //物业信息
+        Map propertyInfo = propertyServiceDaoImpl.getPropertyInfo(info);
+        if(propertyInfo != null && !propertyInfo.isEmpty()){
+            paramIn.put("propertyId",propertyInfo.get("property_id").toString());
+            propertyServiceDaoImpl.updatePropertyInfoInstance(paramIn);
+            dataFlowContext.addParamOut("propertyId",propertyInfo.get("property_id"));
+        }
+
+        //物业属性
+        List<Map> propertyAttrs = propertyServiceDaoImpl.getPropertyAttrs(info);
+        if(propertyAttrs != null && propertyAttrs.size()>0){
+            propertyServiceDaoImpl.updatePropertyAttrInstance(paramIn);
+        }
+
+        //物业照片
+        List<Map> propertyPhotos = propertyServiceDaoImpl.getPropertyPhoto(info);
+        if(propertyPhotos != null && propertyPhotos.size()>0){
+            propertyServiceDaoImpl.updatePropertyPhotoInstance(paramIn);
+        }
+
+        //物业属性
+        List<Map> propertyCerdentialses = propertyServiceDaoImpl.getPropertyCerdentials(info);
+        if(propertyCerdentialses != null && propertyCerdentialses.size()>0){
+            propertyServiceDaoImpl.updatePropertyCerdentailsInstance(paramIn);
+        }
+    }
+
+    /**
+     * 保存物业照片
+     * @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("-")) {
+                String propertyPhotoId = GenerateCodeFactory.getPropertyPhotoId();
+                businessPropertyPhoto.put("propertyPhotoId", propertyPhotoId);
+            }
+            businessPropertyPhoto.put("bId", business.getbId());
+            businessPropertyPhoto.put("operate", StatusConstant.OPERATE_ADD);
+            //保存物业信息
+            propertyServiceDaoImpl.saveBusinessPropertyPhoto(businessPropertyPhoto);
+        }
+    }
+
+    /**
+     * 处理 businessProperty 节点
+     * @param business 总的数据节点
+     * @param businessProperty 物业节点
+     */
+    private void doBusinessProperty(Business business,JSONObject businessProperty){
+
+        Assert.jsonObjectHaveKey(businessProperty,"propertyId","businessProperty 节点下没有包含 propertyId 节点");
+
+        if(businessProperty.getString("propertyId").startsWith("-")){
+            //刷新缓存
+            flushPropertyId(business.getDatas());
+        }
+
+        businessProperty.put("bId",business.getbId());
+        businessProperty.put("operate", StatusConstant.OPERATE_ADD);
+        //保存物业信息
+        propertyServiceDaoImpl.saveBusinessPropertyInfo(businessProperty);
+
+    }
+
+
+
+    /**
+     * 保存物业属性信息
+     * @param business 当前业务
+     * @param businessPropertyAttrs 物业属性
+     */
+    private void doSaveBusinessPropertyAttrs(Business business,JSONArray businessPropertyAttrs){
+        JSONObject data = business.getDatas();
+        JSONObject businessProperty = data.getJSONObject("businessProperty");
+        for(int propertyAttrIndex = 0 ; propertyAttrIndex < businessPropertyAttrs.size();propertyAttrIndex ++){
+            JSONObject propertyAttr = businessPropertyAttrs.getJSONObject(propertyAttrIndex);
+            Assert.jsonObjectHaveKey(propertyAttr,"attrId","businessPropertyAttr 节点下没有包含 attrId 节点");
+
+            if(propertyAttr.getString("attrId").startsWith("-")){
+                String attrId = GenerateCodeFactory.getAttrId();
+                propertyAttr.put("attrId",attrId);
+            }
+
+            propertyAttr.put("bId",business.getbId());
+            propertyAttr.put("propertyId",businessProperty.getString("propertyId"));
+            propertyAttr.put("operate", StatusConstant.OPERATE_ADD);
+
+            propertyServiceDaoImpl.saveBusinessPropertyAttr(propertyAttr);
+        }
+    }
+
+
+    /**
+     * 保存 物业证件 信息
+     * @param business 当前业务
+     * @param businessPropertyCerdentialses 物业证件
+     */
+    private void doBusinessPropertyCerdentials(Business business, JSONArray businessPropertyCerdentialses) {
+        for(int businessPropertyCerdentialsIndex = 0 ; businessPropertyCerdentialsIndex < businessPropertyCerdentialses.size() ; businessPropertyCerdentialsIndex ++) {
+            JSONObject businessPropertyCerdentials = businessPropertyCerdentialses.getJSONObject(businessPropertyCerdentialsIndex);
+            Assert.jsonObjectHaveKey(businessPropertyCerdentials, "propertyId", "businessPropertyPhoto 节点下没有包含 propertyId 节点");
+
+            if (businessPropertyCerdentials.getString("propertyCerdentialsId").startsWith("-")) {
+                String propertyPhotoId = GenerateCodeFactory.getPropertyCerdentialsId();
+                businessPropertyCerdentials.put("propertyCerdentialsId", propertyPhotoId);
+            }
+            Date validityPeriod = null;
+            try {
+                if(StringUtil.isNullOrNone(businessPropertyCerdentials.getString("validityPeriod"))){
+                    validityPeriod = DateUtil.getLastDate();
+                }else {
+                    validityPeriod = DateUtil.getDateFromString(businessPropertyCerdentials.getString("validityPeriod"), DateUtil.DATE_FORMATE_STRING_B);
+                }
+            } catch (ParseException e) {
+                throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"传入参数 validityPeriod 格式不正确,请填写 "+DateUtil.DATE_FORMATE_STRING_B +" 格式,"+businessPropertyCerdentials);
+            }
+            businessPropertyCerdentials.put("validityPeriod",validityPeriod);
+            businessPropertyCerdentials.put("bId", business.getbId());
+            businessPropertyCerdentials.put("operate", StatusConstant.OPERATE_ADD);
+            //保存物业信息
+            propertyServiceDaoImpl.saveBusinessPropertyCerdentials(businessPropertyCerdentials);
+        }
+    }
+
+
+
+    /**
+     * 刷新 物业ID
+     * @param data
+     */
+    private void flushPropertyId(JSONObject data) {
+
+        String propertyId = GenerateCodeFactory.getPropertyId();
+        JSONObject businessProperty = data.getJSONObject("businessProperty");
+        businessProperty.put("propertyId",propertyId);
+        //刷物业属性
+        if(data.containsKey("businessPropertyAttr")) {
+            JSONArray businessPropertyAttrs = data.getJSONArray("businessPropertyAttr");
+            for(int businessPropertyAttrIndex = 0;businessPropertyAttrIndex < businessPropertyAttrs.size();businessPropertyAttrIndex++) {
+                JSONObject businessPropertyAttr = businessPropertyAttrs.getJSONObject(businessPropertyAttrIndex);
+                businessPropertyAttr.put("propertyId", propertyId);
+            }
+        }
+        //刷 是物业照片 的 propertyId
+        if(data.containsKey("businessPropertyPhoto")) {
+            JSONArray businessPropertyPhotos = data.getJSONArray("businessPropertyPhoto");
+            for(int businessPropertyPhotoIndex = 0;businessPropertyPhotoIndex < businessPropertyPhotos.size();businessPropertyPhotoIndex++) {
+                JSONObject businessPropertyPhoto = businessPropertyPhotos.getJSONObject(businessPropertyPhotoIndex);
+                businessPropertyPhoto.put("propertyId", propertyId);
+            }
+        }
+        //刷 物业证件 的propertyId
+        if(data.containsKey("businessPropertyCerdentials")) {
+            JSONArray businessPropertyCerdentialses = data.getJSONArray("businessPropertyCerdentials");
+            for(int businessPropertyCerdentialsIndex = 0;businessPropertyCerdentialsIndex < businessPropertyCerdentialses.size();businessPropertyCerdentialsIndex++) {
+                JSONObject businessPropertyCerdentials = businessPropertyCerdentialses.getJSONObject(businessPropertyCerdentialsIndex);
+                businessPropertyCerdentials.put("propertyId", propertyId);
+            }
+        }
+    }
+
+
+    public IPropertyServiceDao getPropertyServiceDaoImpl() {
+        return propertyServiceDaoImpl;
+    }
+
+    public void setPropertyServiceDaoImpl(IPropertyServiceDao propertyServiceDaoImpl) {
+        this.propertyServiceDaoImpl = propertyServiceDaoImpl;
+    }
+}

+ 322 - 0
PropertyService/src/main/java/com/java110/property/listener/UpdatePropertyCerdentialsListener.java

@@ -0,0 +1,322 @@
+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、businessProperty:{} 物业基本信息节点
+ * 2、businessPropertyAttr:[{}] 物业属性信息节点
+ * 3、businessPropertyPhoto:[{}] 物业照片信息节点
+ * 4、businessPropertyCerdentials:[{}] 物业证件信息节点
+ * 协议地址 :https://github.com/java110/MicroCommunity/wiki/%E4%BF%AE%E6%94%B9%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("updatePropertyCerdentialsListener")
+@Transactional
+public class UpdatePropertyCerdentialsListener extends AbstractPropertyBusinessServiceDataFlowListener {
+
+    private final static Logger logger = LoggerFactory.getLogger(UpdatePropertyCerdentialsListener.class);
+    @Autowired
+    IPropertyServiceDao propertyServiceDaoImpl;
+
+    @Override
+    public int getOrder() {
+        return 2;
+    }
+
+    @Override
+    public String getServiceCode() {
+        return ServiceCodeConstant.SERVICE_CODE_UPDATE_PROPERTY_CERDENTIALS;
+    }
+
+    /**
+     * business过程
+     * @param dataFlowContext
+     * @param business
+     */
+    @Override
+    protected void doSaveBusiness(DataFlowContext dataFlowContext, Business business) {
+
+        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);
+        }
+    }
+
+
+    /**
+     * business to instance 过程
+     * @param dataFlowContext 数据对象
+     * @param business 当前业务对象
+     */
+    @Override
+    protected void doBusinessToInstance(DataFlowContext dataFlowContext, Business business) {
+
+        JSONObject data = business.getDatas();
+
+        Map info = new HashMap();
+        info.put("bId",business.getbId());
+        info.put("operate",StatusConstant.OPERATE_ADD);
+
+        //物业信息
+        Map businessPropertyInfo = propertyServiceDaoImpl.getBusinessPropertyInfo(info);
+        if( businessPropertyInfo != null && !businessPropertyInfo.isEmpty()) {
+            flushBusinessPropertyInfo(businessPropertyInfo,StatusConstant.STATUS_CD_VALID);
+            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_VALID);
+                propertyServiceDaoImpl.updatePropertyAttrInstance(businessPropertyAttr);
+            }
+        }
+        //物业照片
+        List<Map> businessPropertyPhotos = propertyServiceDaoImpl.getBusinessPropertyPhoto(info);
+        if(businessPropertyPhotos != null && businessPropertyPhotos.size() >0){
+            for(Map businessPropertyPhoto : businessPropertyPhotos) {
+                flushBusinessPropertyPhoto(businessPropertyPhoto,StatusConstant.STATUS_CD_VALID);
+                propertyServiceDaoImpl.updatePropertyPhotoInstance(businessPropertyPhoto);
+            }
+        }
+        //物业证件
+        List<Map> businessPropertyCerdentialses = propertyServiceDaoImpl.getBusinessPropertyCerdentials(info);
+        if(businessPropertyCerdentialses != null && businessPropertyCerdentialses.size()>0){
+            for(Map businessPropertyCerdentials : businessPropertyCerdentialses) {
+                flushBusinessPropertyCredentials(businessPropertyCerdentials,StatusConstant.STATUS_CD_VALID);
+                propertyServiceDaoImpl.updatePropertyCerdentailsInstance(businessPropertyCerdentials);
+            }
+        }
+    }
+
+    /**
+     * 撤单
+     * @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_VALID);
+        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);
+        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);
+            }
+        }
+    }
+
+    /**
+     * 保存物业照片
+     * @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);
+            }
+
+            //自动保存DEL信息
+            autoSaveDelBusinessPropertyPhoto(business,businessPropertyPhoto);
+
+            businessPropertyPhoto.put("bId", business.getbId());
+            businessPropertyPhoto.put("operate", StatusConstant.OPERATE_ADD);
+            //保存物业信息
+            propertyServiceDaoImpl.saveBusinessPropertyPhoto(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);
+
+        businessProperty.put("bId",business.getbId());
+        businessProperty.put("operate", StatusConstant.OPERATE_ADD);
+        //保存物业信息
+        propertyServiceDaoImpl.saveBusinessPropertyInfo(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);
+            }
+            //自动保存DEL数据
+            autoSaveDelBusinessPropertyAttr(business,propertyAttr);
+
+            propertyAttr.put("bId",business.getbId());
+            propertyAttr.put("propertyId",propertyAttr.getString("propertyId"));
+            propertyAttr.put("operate", StatusConstant.OPERATE_ADD);
+
+            propertyServiceDaoImpl.saveBusinessPropertyAttr(propertyAttr);
+        }
+    }
+
+
+    /**
+     * 保存 物业证件 信息
+     * @param business 当前业务
+     * @param businessPropertyCerdentialses 物业证件
+     */
+    private void doBusinessPropertyCerdentials(Business business, JSONArray businessPropertyCerdentialses) {
+
+        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);
+
+            businessPropertyCerdentials.put("bId", business.getbId());
+            businessPropertyCerdentials.put("operate", StatusConstant.OPERATE_ADD);
+            //保存物业信息
+            propertyServiceDaoImpl.saveBusinessPropertyCerdentials(businessPropertyCerdentials);
+        }
+    }
+
+    public IPropertyServiceDao getPropertyServiceDaoImpl() {
+        return propertyServiceDaoImpl;
+    }
+
+    public void setPropertyServiceDaoImpl(IPropertyServiceDao propertyServiceDaoImpl) {
+        this.propertyServiceDaoImpl = propertyServiceDaoImpl;
+    }
+
+
+
+}

+ 322 - 0
PropertyService/src/main/java/com/java110/property/listener/UpdatePropertyFeeListener.java

@@ -0,0 +1,322 @@
+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、businessProperty:{} 物业基本信息节点
+ * 2、businessPropertyAttr:[{}] 物业属性信息节点
+ * 3、businessPropertyPhoto:[{}] 物业照片信息节点
+ * 4、businessPropertyCerdentials:[{}] 物业证件信息节点
+ * 协议地址 :https://github.com/java110/MicroCommunity/wiki/%E4%BF%AE%E6%94%B9%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("updatePropertyFeeListener")
+@Transactional
+public class UpdatePropertyFeeListener extends AbstractPropertyBusinessServiceDataFlowListener {
+
+    private final static Logger logger = LoggerFactory.getLogger(UpdatePropertyFeeListener.class);
+    @Autowired
+    IPropertyServiceDao propertyServiceDaoImpl;
+
+    @Override
+    public int getOrder() {
+        return 2;
+    }
+
+    @Override
+    public String getServiceCode() {
+        return ServiceCodeConstant.SERVICE_CODE_UPDATE_PROPERTY_FEE;
+    }
+
+    /**
+     * business过程
+     * @param dataFlowContext
+     * @param business
+     */
+    @Override
+    protected void doSaveBusiness(DataFlowContext dataFlowContext, Business business) {
+
+        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);
+        }
+    }
+
+
+    /**
+     * business to instance 过程
+     * @param dataFlowContext 数据对象
+     * @param business 当前业务对象
+     */
+    @Override
+    protected void doBusinessToInstance(DataFlowContext dataFlowContext, Business business) {
+
+        JSONObject data = business.getDatas();
+
+        Map info = new HashMap();
+        info.put("bId",business.getbId());
+        info.put("operate",StatusConstant.OPERATE_ADD);
+
+        //物业信息
+        Map businessPropertyInfo = propertyServiceDaoImpl.getBusinessPropertyInfo(info);
+        if( businessPropertyInfo != null && !businessPropertyInfo.isEmpty()) {
+            flushBusinessPropertyInfo(businessPropertyInfo,StatusConstant.STATUS_CD_VALID);
+            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_VALID);
+                propertyServiceDaoImpl.updatePropertyAttrInstance(businessPropertyAttr);
+            }
+        }
+        //物业照片
+        List<Map> businessPropertyPhotos = propertyServiceDaoImpl.getBusinessPropertyPhoto(info);
+        if(businessPropertyPhotos != null && businessPropertyPhotos.size() >0){
+            for(Map businessPropertyPhoto : businessPropertyPhotos) {
+                flushBusinessPropertyPhoto(businessPropertyPhoto,StatusConstant.STATUS_CD_VALID);
+                propertyServiceDaoImpl.updatePropertyPhotoInstance(businessPropertyPhoto);
+            }
+        }
+        //物业证件
+        List<Map> businessPropertyCerdentialses = propertyServiceDaoImpl.getBusinessPropertyCerdentials(info);
+        if(businessPropertyCerdentialses != null && businessPropertyCerdentialses.size()>0){
+            for(Map businessPropertyCerdentials : businessPropertyCerdentialses) {
+                flushBusinessPropertyCredentials(businessPropertyCerdentials,StatusConstant.STATUS_CD_VALID);
+                propertyServiceDaoImpl.updatePropertyCerdentailsInstance(businessPropertyCerdentials);
+            }
+        }
+    }
+
+    /**
+     * 撤单
+     * @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_VALID);
+        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);
+        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);
+            }
+        }
+    }
+
+    /**
+     * 保存物业照片
+     * @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);
+            }
+
+            //自动保存DEL信息
+            autoSaveDelBusinessPropertyPhoto(business,businessPropertyPhoto);
+
+            businessPropertyPhoto.put("bId", business.getbId());
+            businessPropertyPhoto.put("operate", StatusConstant.OPERATE_ADD);
+            //保存物业信息
+            propertyServiceDaoImpl.saveBusinessPropertyPhoto(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);
+
+        businessProperty.put("bId",business.getbId());
+        businessProperty.put("operate", StatusConstant.OPERATE_ADD);
+        //保存物业信息
+        propertyServiceDaoImpl.saveBusinessPropertyInfo(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);
+            }
+            //自动保存DEL数据
+            autoSaveDelBusinessPropertyAttr(business,propertyAttr);
+
+            propertyAttr.put("bId",business.getbId());
+            propertyAttr.put("propertyId",propertyAttr.getString("propertyId"));
+            propertyAttr.put("operate", StatusConstant.OPERATE_ADD);
+
+            propertyServiceDaoImpl.saveBusinessPropertyAttr(propertyAttr);
+        }
+    }
+
+
+    /**
+     * 保存 物业证件 信息
+     * @param business 当前业务
+     * @param businessPropertyCerdentialses 物业证件
+     */
+    private void doBusinessPropertyCerdentials(Business business, JSONArray businessPropertyCerdentialses) {
+
+        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);
+
+            businessPropertyCerdentials.put("bId", business.getbId());
+            businessPropertyCerdentials.put("operate", StatusConstant.OPERATE_ADD);
+            //保存物业信息
+            propertyServiceDaoImpl.saveBusinessPropertyCerdentials(businessPropertyCerdentials);
+        }
+    }
+
+    public IPropertyServiceDao getPropertyServiceDaoImpl() {
+        return propertyServiceDaoImpl;
+    }
+
+    public void setPropertyServiceDaoImpl(IPropertyServiceDao propertyServiceDaoImpl) {
+        this.propertyServiceDaoImpl = propertyServiceDaoImpl;
+    }
+
+
+
+}

+ 322 - 0
PropertyService/src/main/java/com/java110/property/listener/UpdatePropertyHouseListener.java

@@ -0,0 +1,322 @@
+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、businessProperty:{} 物业基本信息节点
+ * 2、businessPropertyAttr:[{}] 物业属性信息节点
+ * 3、businessPropertyPhoto:[{}] 物业照片信息节点
+ * 4、businessPropertyCerdentials:[{}] 物业证件信息节点
+ * 协议地址 :https://github.com/java110/MicroCommunity/wiki/%E4%BF%AE%E6%94%B9%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("updatePropertyHouseListener")
+@Transactional
+public class UpdatePropertyHouseListener extends AbstractPropertyBusinessServiceDataFlowListener {
+
+    private final static Logger logger = LoggerFactory.getLogger(UpdatePropertyHouseListener.class);
+    @Autowired
+    IPropertyServiceDao propertyServiceDaoImpl;
+
+    @Override
+    public int getOrder() {
+        return 2;
+    }
+
+    @Override
+    public String getServiceCode() {
+        return ServiceCodeConstant.SERVICE_CODE_UPDATE_PROPERTY_HOUSE;
+    }
+
+    /**
+     * business过程
+     * @param dataFlowContext
+     * @param business
+     */
+    @Override
+    protected void doSaveBusiness(DataFlowContext dataFlowContext, Business business) {
+
+        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);
+        }
+    }
+
+
+    /**
+     * business to instance 过程
+     * @param dataFlowContext 数据对象
+     * @param business 当前业务对象
+     */
+    @Override
+    protected void doBusinessToInstance(DataFlowContext dataFlowContext, Business business) {
+
+        JSONObject data = business.getDatas();
+
+        Map info = new HashMap();
+        info.put("bId",business.getbId());
+        info.put("operate",StatusConstant.OPERATE_ADD);
+
+        //物业信息
+        Map businessPropertyInfo = propertyServiceDaoImpl.getBusinessPropertyInfo(info);
+        if( businessPropertyInfo != null && !businessPropertyInfo.isEmpty()) {
+            flushBusinessPropertyInfo(businessPropertyInfo,StatusConstant.STATUS_CD_VALID);
+            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_VALID);
+                propertyServiceDaoImpl.updatePropertyAttrInstance(businessPropertyAttr);
+            }
+        }
+        //物业照片
+        List<Map> businessPropertyPhotos = propertyServiceDaoImpl.getBusinessPropertyPhoto(info);
+        if(businessPropertyPhotos != null && businessPropertyPhotos.size() >0){
+            for(Map businessPropertyPhoto : businessPropertyPhotos) {
+                flushBusinessPropertyPhoto(businessPropertyPhoto,StatusConstant.STATUS_CD_VALID);
+                propertyServiceDaoImpl.updatePropertyPhotoInstance(businessPropertyPhoto);
+            }
+        }
+        //物业证件
+        List<Map> businessPropertyCerdentialses = propertyServiceDaoImpl.getBusinessPropertyCerdentials(info);
+        if(businessPropertyCerdentialses != null && businessPropertyCerdentialses.size()>0){
+            for(Map businessPropertyCerdentials : businessPropertyCerdentialses) {
+                flushBusinessPropertyCredentials(businessPropertyCerdentials,StatusConstant.STATUS_CD_VALID);
+                propertyServiceDaoImpl.updatePropertyCerdentailsInstance(businessPropertyCerdentials);
+            }
+        }
+    }
+
+    /**
+     * 撤单
+     * @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_VALID);
+        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);
+        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);
+            }
+        }
+    }
+
+    /**
+     * 保存物业照片
+     * @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);
+            }
+
+            //自动保存DEL信息
+            autoSaveDelBusinessPropertyPhoto(business,businessPropertyPhoto);
+
+            businessPropertyPhoto.put("bId", business.getbId());
+            businessPropertyPhoto.put("operate", StatusConstant.OPERATE_ADD);
+            //保存物业信息
+            propertyServiceDaoImpl.saveBusinessPropertyPhoto(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);
+
+        businessProperty.put("bId",business.getbId());
+        businessProperty.put("operate", StatusConstant.OPERATE_ADD);
+        //保存物业信息
+        propertyServiceDaoImpl.saveBusinessPropertyInfo(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);
+            }
+            //自动保存DEL数据
+            autoSaveDelBusinessPropertyAttr(business,propertyAttr);
+
+            propertyAttr.put("bId",business.getbId());
+            propertyAttr.put("propertyId",propertyAttr.getString("propertyId"));
+            propertyAttr.put("operate", StatusConstant.OPERATE_ADD);
+
+            propertyServiceDaoImpl.saveBusinessPropertyAttr(propertyAttr);
+        }
+    }
+
+
+    /**
+     * 保存 物业证件 信息
+     * @param business 当前业务
+     * @param businessPropertyCerdentialses 物业证件
+     */
+    private void doBusinessPropertyCerdentials(Business business, JSONArray businessPropertyCerdentialses) {
+
+        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);
+
+            businessPropertyCerdentials.put("bId", business.getbId());
+            businessPropertyCerdentials.put("operate", StatusConstant.OPERATE_ADD);
+            //保存物业信息
+            propertyServiceDaoImpl.saveBusinessPropertyCerdentials(businessPropertyCerdentials);
+        }
+    }
+
+    public IPropertyServiceDao getPropertyServiceDaoImpl() {
+        return propertyServiceDaoImpl;
+    }
+
+    public void setPropertyServiceDaoImpl(IPropertyServiceDao propertyServiceDaoImpl) {
+        this.propertyServiceDaoImpl = propertyServiceDaoImpl;
+    }
+
+
+
+}

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

@@ -46,7 +46,7 @@ public class UpdatePropertyInfoListener extends AbstractPropertyBusinessServiceD
 
     @Override
     public String getServiceCode() {
-        return ServiceCodeConstant.SERVICE_CODE_UPDATE_STORE_INFO;
+        return ServiceCodeConstant.SERVICE_CODE_UPDATE_PROPERTY_INFO;
     }
 
     /**

+ 322 - 0
PropertyService/src/main/java/com/java110/property/listener/UpdatePropertyPhotoListener.java

@@ -0,0 +1,322 @@
+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、businessProperty:{} 物业基本信息节点
+ * 2、businessPropertyAttr:[{}] 物业属性信息节点
+ * 3、businessPropertyPhoto:[{}] 物业照片信息节点
+ * 4、businessPropertyCerdentials:[{}] 物业证件信息节点
+ * 协议地址 :https://github.com/java110/MicroCommunity/wiki/%E4%BF%AE%E6%94%B9%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("updatePropertyPhotoListener")
+@Transactional
+public class UpdatePropertyPhotoListener extends AbstractPropertyBusinessServiceDataFlowListener {
+
+    private final static Logger logger = LoggerFactory.getLogger(UpdatePropertyPhotoListener.class);
+    @Autowired
+    IPropertyServiceDao propertyServiceDaoImpl;
+
+    @Override
+    public int getOrder() {
+        return 2;
+    }
+
+    @Override
+    public String getServiceCode() {
+        return ServiceCodeConstant.SERVICE_CODE_UPDATE_PROPERTY_PHOTO;
+    }
+
+    /**
+     * business过程
+     * @param dataFlowContext
+     * @param business
+     */
+    @Override
+    protected void doSaveBusiness(DataFlowContext dataFlowContext, Business business) {
+
+        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);
+        }
+    }
+
+
+    /**
+     * business to instance 过程
+     * @param dataFlowContext 数据对象
+     * @param business 当前业务对象
+     */
+    @Override
+    protected void doBusinessToInstance(DataFlowContext dataFlowContext, Business business) {
+
+        JSONObject data = business.getDatas();
+
+        Map info = new HashMap();
+        info.put("bId",business.getbId());
+        info.put("operate",StatusConstant.OPERATE_ADD);
+
+        //物业信息
+        Map businessPropertyInfo = propertyServiceDaoImpl.getBusinessPropertyInfo(info);
+        if( businessPropertyInfo != null && !businessPropertyInfo.isEmpty()) {
+            flushBusinessPropertyInfo(businessPropertyInfo,StatusConstant.STATUS_CD_VALID);
+            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_VALID);
+                propertyServiceDaoImpl.updatePropertyAttrInstance(businessPropertyAttr);
+            }
+        }
+        //物业照片
+        List<Map> businessPropertyPhotos = propertyServiceDaoImpl.getBusinessPropertyPhoto(info);
+        if(businessPropertyPhotos != null && businessPropertyPhotos.size() >0){
+            for(Map businessPropertyPhoto : businessPropertyPhotos) {
+                flushBusinessPropertyPhoto(businessPropertyPhoto,StatusConstant.STATUS_CD_VALID);
+                propertyServiceDaoImpl.updatePropertyPhotoInstance(businessPropertyPhoto);
+            }
+        }
+        //物业证件
+        List<Map> businessPropertyCerdentialses = propertyServiceDaoImpl.getBusinessPropertyCerdentials(info);
+        if(businessPropertyCerdentialses != null && businessPropertyCerdentialses.size()>0){
+            for(Map businessPropertyCerdentials : businessPropertyCerdentialses) {
+                flushBusinessPropertyCredentials(businessPropertyCerdentials,StatusConstant.STATUS_CD_VALID);
+                propertyServiceDaoImpl.updatePropertyCerdentailsInstance(businessPropertyCerdentials);
+            }
+        }
+    }
+
+    /**
+     * 撤单
+     * @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_VALID);
+        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);
+        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);
+            }
+        }
+    }
+
+    /**
+     * 保存物业照片
+     * @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);
+            }
+
+            //自动保存DEL信息
+            autoSaveDelBusinessPropertyPhoto(business,businessPropertyPhoto);
+
+            businessPropertyPhoto.put("bId", business.getbId());
+            businessPropertyPhoto.put("operate", StatusConstant.OPERATE_ADD);
+            //保存物业信息
+            propertyServiceDaoImpl.saveBusinessPropertyPhoto(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);
+
+        businessProperty.put("bId",business.getbId());
+        businessProperty.put("operate", StatusConstant.OPERATE_ADD);
+        //保存物业信息
+        propertyServiceDaoImpl.saveBusinessPropertyInfo(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);
+            }
+            //自动保存DEL数据
+            autoSaveDelBusinessPropertyAttr(business,propertyAttr);
+
+            propertyAttr.put("bId",business.getbId());
+            propertyAttr.put("propertyId",propertyAttr.getString("propertyId"));
+            propertyAttr.put("operate", StatusConstant.OPERATE_ADD);
+
+            propertyServiceDaoImpl.saveBusinessPropertyAttr(propertyAttr);
+        }
+    }
+
+
+    /**
+     * 保存 物业证件 信息
+     * @param business 当前业务
+     * @param businessPropertyCerdentialses 物业证件
+     */
+    private void doBusinessPropertyCerdentials(Business business, JSONArray businessPropertyCerdentialses) {
+
+        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);
+
+            businessPropertyCerdentials.put("bId", business.getbId());
+            businessPropertyCerdentials.put("operate", StatusConstant.OPERATE_ADD);
+            //保存物业信息
+            propertyServiceDaoImpl.saveBusinessPropertyCerdentials(businessPropertyCerdentials);
+        }
+    }
+
+    public IPropertyServiceDao getPropertyServiceDaoImpl() {
+        return propertyServiceDaoImpl;
+    }
+
+    public void setPropertyServiceDaoImpl(IPropertyServiceDao propertyServiceDaoImpl) {
+        this.propertyServiceDaoImpl = propertyServiceDaoImpl;
+    }
+
+
+
+}

+ 1 - 1
PropertyService/src/main/resources/application.yml

@@ -1,3 +1,3 @@
 spring:
   profiles:
-    active: test
+    active: dev

+ 17 - 0
java110-common/src/main/java/com/java110/common/constant/ServiceCodeConstant.java

@@ -251,6 +251,23 @@ public class ServiceCodeConstant {
     public static final String SERVICE_CODE_MEMBER_QUIT_COMMUNITY = "member.quit.community";
 
 
+    public static final String SERVICE_CODE_SAVE_PROPERTY_INFO = "save.property.info";
+    public static final String SERVICE_CODE_SAVE_PROPERTY_PHOTO = "save.property.photo";
+    public static final String SERVICE_CODE_SAVE_PROPERTY_CERDENTIALS = "save.property.cerdentials";
+    public static final String SERVICE_CODE_SAVE_PROPERTY_USER = "save.property.user";
+    public static final String SERVICE_CODE_SAVE_PROPERTY_FEE = "save.property.fee";
+    public static final String SERVICE_CODE_SAVE_PROPERTY_HOUSE = "save.property.house";
+    public static final String SERVICE_CODE_UPDATE_PROPERTY_INFO = "update.property.info";
+    public static final String SERVICE_CODE_UPDATE_PROPERTY_PHOTO = "update.property.photo";
+    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_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";
+
+
 
 
 

+ 44 - 5
java110-config/db/PropertyService/create_table.sql

@@ -120,7 +120,47 @@ CREATE TABLE business_property_user(
     property_user_id VARCHAR(30) NOT NULL COMMENT '物业用户ID',
     property_id VARCHAR(30) NOT NULL COMMENT '物业ID',
     b_id VARCHAR(30) NOT NULL COMMENT '业务Id',
-    user_id VARCHAR(30) NOT NULL COMMENT '用户ID',,
+    user_id VARCHAR(30) NOT NULL COMMENT '用户ID',
+    `month` INT NOT NULL COMMENT '月份',
+    create_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+    operate VARCHAR(3) NOT NULL COMMENT '数据状态,添加ADD,修改MOD 删除DEL'
+);
+
+-- 物业费 停车费
+CREATE TABLE business_property_fee(
+    fee_id VARCHAR(30) NOT NULL COMMENT 'ID',
+    b_id VARCHAR(30) NOT NULL COMMENT '业务Id',
+    property_id VARCHAR(30) NOT NULL COMMENT '物业ID',
+    fee_type_cd VARCHAR(10) NOT NULL COMMENT '费用类型,物业费,停车费 请查看property_fee_type表',
+    fee_money VARCHAR(20) NOT NULL COMMENT '费用金额',
+    fee_time VARCHAR(10) NOT NULL COMMENT '费用周期,一个月,半年,或一年 请查看property_fee_time表',
+    create_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+    start_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '开始时间',
+    end_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '结束时间',
+    `month` INT NOT NULL COMMENT '月份',
+    operate VARCHAR(3) NOT NULL COMMENT '数据状态,添加ADD,修改MOD 删除DEL'
+);
+
+CREATE TABLE business_property_house(
+    house_id VARCHAR(30) NOT NULL COMMENT 'ID',
+    b_id VARCHAR(30) NOT NULL COMMENT '业务Id',
+    house_num VARCHAR(30) NOT NULL COMMENT '门牌号',
+    house_name VARCHAR(50) NOT NULL COMMENT '住户名称',
+    house_phone VARCHAR(11) COMMENT '住户联系号码',
+    house_area VARCHAR(30) NOT NULL COMMENT '房屋面积',
+    fee_type_cd VARCHAR(10) NOT NULL COMMENT '费用类型 property_fee_type表',
+    fee_price VARCHAR(30) NOT NULL COMMENT '费用单价',
+    `month` INT NOT NULL COMMENT '月份',
+    create_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+    operate VARCHAR(3) NOT NULL COMMENT '数据状态,添加ADD,修改MOD 删除DEL'
+);
+
+CREATE TABLE business_property_house_attr(
+    b_id VARCHAR(30) NOT NULL COMMENT '订单ID',
+    attr_id VARCHAR(30) NOT NULL COMMENT '属性id',
+    house_id VARCHAR(30) NOT NULL COMMENT '用户ID',
+    spec_cd VARCHAR(12) NOT NULL COMMENT '规格id,参考spec表',
+    VALUE VARCHAR(50) NOT NULL COMMENT '属性值',
     `month` INT NOT NULL COMMENT '月份',
     create_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
     operate VARCHAR(3) NOT NULL COMMENT '数据状态,添加ADD,修改MOD 删除DEL'
@@ -197,7 +237,7 @@ CREATE TABLE p_property_user(
     property_user_id VARCHAR(30) NOT NULL COMMENT '物业用户ID',
     property_id VARCHAR(30) NOT NULL COMMENT '物业ID',
     b_id VARCHAR(30) NOT NULL COMMENT '业务Id',
-    user_id VARCHAR(30) NOT NULL COMMENT '用户ID',,
+    user_id VARCHAR(30) NOT NULL COMMENT '用户ID',
     `month` INT NOT NULL COMMENT '月份',
     create_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
         status_cd VARCHAR(2) NOT NULL default '0' COMMENT '数据状态,详细参考c_status表,S 保存,0, 在用 1失效',
@@ -208,7 +248,6 @@ CREATE TABLE p_property_fee(
     fee_id VARCHAR(30) NOT NULL COMMENT 'ID',
     b_id VARCHAR(30) NOT NULL COMMENT '业务Id',
     property_id VARCHAR(30) NOT NULL COMMENT '物业ID',
-    user_id VARCHAR(30) NOT NULL COMMENT '用户ID',
     fee_type_cd VARCHAR(10) NOT NULL COMMENT '费用类型,物业费,停车费 请查看property_fee_type表',
     fee_money VARCHAR(20) NOT NULL COMMENT '费用金额',
     fee_time VARCHAR(10) NOT NULL COMMENT '费用周期,一个月,半年,或一年 请查看property_fee_time表',
@@ -222,6 +261,7 @@ CREATE INDEX idx_property_fee_fee_id ON p_property_fee(fee_id);
 CREATE INDEX idx_property_fee_b_id ON p_property_fee(b_id);
 
 CREATE TABLE p_property_house(
+    b_id VARCHAR(30) NOT NULL COMMENT '业务Id',
     house_id VARCHAR(30) NOT NULL COMMENT 'ID',
     house_num VARCHAR(30) NOT NULL COMMENT '门牌号',
     house_name VARCHAR(50) NOT NULL COMMENT '住户名称',
@@ -229,14 +269,13 @@ CREATE TABLE p_property_house(
     house_area VARCHAR(30) NOT NULL COMMENT '房屋面积',
     fee_type_cd VARCHAR(10) NOT NULL COMMENT '费用类型 property_fee_type表',
     fee_price VARCHAR(30) NOT NULL COMMENT '费用单价',
-    user_id VARCHAR(10) NOT NULL COMMENT '录入人',
     create_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
-    update_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间',
     status_cd VARCHAR(2) NOT NULL DEFAULT '0' COMMENT '数据状态,详细参考c_status表,S 保存,0, 在用 1失效',
     UNIQUE KEY (house_id)
 );
 
 CREATE TABLE p_property_house_attr(
+    b_id VARCHAR(30) NOT NULL COMMENT '业务Id',
     attr_id VARCHAR(30) NOT NULL COMMENT '属性id',
     house_id VARCHAR(30) NOT NULL COMMENT '用户ID',
     spec_cd VARCHAR(12) NOT NULL COMMENT '规格id,参考spec表',