Sfoglia il codice sorgente

添加住户测试完成

wuxw 7 anni fa
parent
commit
84a28768f6

+ 42 - 0
PropertyService/doc/savePropertyHouse.json

@@ -0,0 +1,42 @@
+{
+  "orders": {
+    "appId": "外系统ID,分配得到",
+    "transactionId": "100000000020180409224736000001",
+    "userId": "用户ID",
+    "orderTypeCd": "订单类型,查询,受理",
+    "requestTime": "20180409224736",
+    "remark": "备注",
+    "sign": "这个服务是否要求MD5签名",
+    "attrs": [{
+      "specCd": "配置的字段ID",
+      "value": "具体值"
+    }]
+  },
+  "business": {
+    "serviceCode": "save.property.house",
+    "serviceName": "保存物业费用",
+    "remark": "备注",
+    "datas": {
+      "businessPropertyHouse":{
+        "houseId":"-1",
+        "propertyId":"123213",
+        "houseNum":"T",
+        "houseName":"10",
+        "housePhone":"17797173942",
+        "houseArea": "01918",
+        "feeTypeCd": "111",
+        "feePrice": "10.09"
+      },
+      "businessPropertyHouseAttr": [{
+        "houseId": "-1",
+        "attrId":"-1",
+        "specCd":"1001",
+        "value":"01"
+      }]
+    },
+    "attrs": [{
+      "specCd": "配置的字段ID",
+      "value": "具体值"
+    }]
+  }
+}

+ 83 - 0
PropertyService/src/main/java/com/java110/property/dao/IPropertyServiceDao.java

@@ -58,6 +58,22 @@ public interface IPropertyServiceDao {
      * @throws DAOException
      */
     public void saveBusinessPropertyFee(Map info) throws DAOException;
+
+    /**
+     * 保存 住户信息
+     * @param businessPropertyHouse 住户信息 封装
+     * @throws DAOException 操作数据库异常
+     */
+    public void saveBusinessPropertyHouse(Map businessPropertyHouse) throws DAOException;
+
+    /**
+     * 保存住户属性
+     * @param businessPropertyHouseAttr 住户信息封装
+     * @throws DAOException 操作数据库异常
+     */
+    public void saveBusinessPropertyHouseAttr(Map businessPropertyHouseAttr) throws DAOException;
+
+
     /**
      * 查询物业信息(business过程)
      * 根据bId 查询物业信息
@@ -76,6 +92,25 @@ public interface IPropertyServiceDao {
      */
     public List<Map> getBusinessPropertyAttrs(Map info) throws DAOException;
 
+    /**
+     * 查询住户信息(business过程)
+     * 根据bId 查询物业信息
+     * @param info bId 信息
+     * @return 物业信息
+     * @throws DAOException
+     */
+    public Map getBusinessPropertyHouse(Map info) throws DAOException;
+
+
+    /**
+     * 查询住户属性信息(business过程)
+     * @param info bId 信息
+     * @return 物业属性
+     * @throws DAOException
+     */
+    public List<Map> getBusinessPropertyHouseAttrs(Map info) throws DAOException;
+
+
 
     /**
      * 查询物业照片
@@ -124,6 +159,21 @@ public interface IPropertyServiceDao {
      */
     public void savePropertyAttrsInstance(Map info) throws DAOException;
 
+    /**
+     * 保存 住户信息 Business数据到 Instance中
+     * @param info
+     * @throws DAOException
+     */
+    public void savePropertyHouseInstance(Map info) throws DAOException;
+
+
+    /**
+     * 保存 住户属性信息 Business数据到 Instance中
+     * @param info
+     * @throws DAOException
+     */
+    public void savePropertyHouseAttrsInstance(Map info) throws DAOException;
+
     /**
      * 保存 物业照片信息 Business数据到 Instance中
      * @param info
@@ -172,6 +222,24 @@ public interface IPropertyServiceDao {
      */
     public List<Map> getPropertyAttrs(Map info) throws DAOException;
 
+    /**
+     * 查询住户信息(instance过程)
+     * 根据bId 查询物业信息
+     * @param info bId 信息
+     * @return 物业信息
+     * @throws DAOException
+     */
+    public Map getPropertyHouse(Map info) throws DAOException;
+
+
+    /**
+     * 查询住户属性信息(instance过程)
+     * @param info bId 信息
+     * @return 物业属性
+     * @throws DAOException
+     */
+    public List<Map> getPropertyHouseAttrs(Map info) throws DAOException;
+
 
     /**
      * 查询物业照片(instance 过程)
@@ -220,6 +288,21 @@ public interface IPropertyServiceDao {
      */
     public void updatePropertyAttrInstance(Map info) throws DAOException;
 
+    /**
+     * 修改住户信息
+     * @param info 修改信息
+     * @throws DAOException
+     */
+    public void updatePropertyHouseInstance(Map info) throws DAOException;
+
+
+    /**
+     * 修改住户属性信息
+     * @param info 修改信息
+     * @throws DAOException
+     */
+    public void updatePropertyHouseAttrInstance(Map info) throws DAOException;
+
 
     /**
      * 修改物业照片信息

+ 167 - 0
PropertyService/src/main/java/com/java110/property/dao/impl/PropertyServiceDaoImpl.java

@@ -124,6 +124,39 @@ public class PropertyServiceDaoImpl extends BaseServiceDao implements IPropertyS
         }
     }
 
+    /**
+     * 保存 住户信息
+     * @param businessPropertyHouse 住户信息 封装
+     * @throws DAOException 操作数据库异常
+     */
+    public void saveBusinessPropertyHouse(Map businessPropertyHouse) throws DAOException{
+        businessPropertyHouse.put("month", DateUtil.getCurrentMonth());
+        // 查询business_user 数据是否已经存在
+        logger.debug("保存住户信息 入参 businessPropertyHouse : {}",businessPropertyHouse);
+        int saveFlag = sqlSessionTemplate.insert("propertyServiceDaoImpl.saveBusinessPropertyHouse",businessPropertyHouse);
+
+        if(saveFlag < 1){
+            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"保存住户数据失败:"+ JSONObject.toJSONString(businessPropertyHouse));
+        }
+    }
+
+    /**
+     * 保存住户属性
+     * @param businessPropertyHouseAttr 住户信息封装
+     * @throws DAOException 操作数据库异常
+     */
+    public void saveBusinessPropertyHouseAttr(Map businessPropertyHouseAttr) throws DAOException{
+        businessPropertyHouseAttr.put("month", DateUtil.getCurrentMonth());
+        // 查询business_user 数据是否已经存在
+        logger.debug("保存住户属性信息 入参 businessPropertyHouseAttr : {}",businessPropertyHouseAttr);
+
+        int saveFlag = sqlSessionTemplate.insert("propertyServiceDaoImpl.saveBusinessPropertyHouseAttr",businessPropertyHouseAttr);
+
+        if(saveFlag < 1){
+            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"保存住户属性数据失败:"+ JSONObject.toJSONString(businessPropertyHouseAttr));
+        }
+    }
+
     /**
      * 查询物业信息
      * @param info bId 信息
@@ -161,6 +194,42 @@ public class PropertyServiceDaoImpl extends BaseServiceDao implements IPropertyS
         return businessPropertyAttrs;
     }
 
+    /**
+     * 查询住户信息(business过程)
+     * 根据bId 查询物业信息
+     * @param info bId 信息
+     * @return 物业信息
+     * @throws DAOException
+     */
+    public Map getBusinessPropertyHouse(Map info) throws DAOException{
+        logger.debug("查询住户信息 入参 info : {}",info);
+
+        List<Map> businessPropertyHouses = sqlSessionTemplate.selectList("propertyServiceDaoImpl.getBusinessPropertyHouse",info);
+        if(businessPropertyHouses == null){
+            return null;
+        }
+        if(businessPropertyHouses.size() >1){
+            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"根据条件查询有多条数据,数据异常,请检查:businessPropertyHouse,"+ JSONObject.toJSONString(info));
+        }
+
+        return businessPropertyHouses.get(0);
+    }
+
+
+    /**
+     * 查询住户属性信息(business过程)
+     * @param info bId 信息
+     * @return 物业属性
+     * @throws DAOException
+     */
+    public List<Map> getBusinessPropertyHouseAttrs(Map info) throws DAOException{
+        logger.debug("查询住户属性信息 入参 info : {}",info);
+
+        List<Map> businessPropertyHouseAttrs = sqlSessionTemplate.selectList("propertyServiceDaoImpl.getBusinessPropertyHouseAttrs",info);
+
+        return businessPropertyHouseAttrs;
+    }
+
     /**
      * 查询物业照片
      * @param info bId 信息
@@ -247,6 +316,37 @@ public class PropertyServiceDaoImpl extends BaseServiceDao implements IPropertyS
         }
     }
 
+    /**
+     * 保存 住户信息 Business数据到 Instance中
+     * @param info
+     * @throws DAOException
+     */
+    public void savePropertyHouseInstance(Map info) throws DAOException{
+        logger.debug("保存住户信息Instance 入参 info : {}",info);
+
+        int saveFlag = sqlSessionTemplate.insert("propertyServiceDaoImpl.savePropertyHouseInstance",info);
+
+        if(saveFlag < 1){
+            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"保存住户信息Instance数据失败:"+ JSONObject.toJSONString(info));
+        }
+    }
+
+
+    /**
+     * 保存 住户属性信息 Business数据到 Instance中
+     * @param info
+     * @throws DAOException
+     */
+    public void savePropertyHouseAttrsInstance(Map info) throws DAOException{
+        logger.debug("保存住户属性信息Instance 入参 info : {}",info);
+
+        int saveFlag = sqlSessionTemplate.insert("propertyServiceDaoImpl.savePropertyHouseAttrsInstance",info);
+
+        if(saveFlag < 1){
+            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"保存住户属性信息Instance数据失败:"+ JSONObject.toJSONString(info));
+        }
+    }
+
     @Override
     public void savePropertyPhotoInstance(Map info) throws DAOException {
         logger.debug("保存物业照片信息Instance 入参 info : {}",info);
@@ -336,6 +436,42 @@ public class PropertyServiceDaoImpl extends BaseServiceDao implements IPropertyS
         return propertyAttrs;
     }
 
+    /**
+     * 查询住户信息(instance过程)
+     * 根据bId 查询物业信息
+     * @param info bId 信息
+     * @return 物业信息
+     * @throws DAOException
+     */
+    public Map getPropertyHouse(Map info) throws DAOException{
+        logger.debug("查询住户信息 入参 info : {}",info);
+
+        List<Map> businessPropertyInfos = sqlSessionTemplate.selectList("propertyServiceDaoImpl.getPropertyHouse",info);
+        if(businessPropertyInfos == null || businessPropertyInfos.size() == 0){
+            return null;
+        }
+        if(businessPropertyInfos.size() >1){
+            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"根据条件查询有多条数据,数据异常,请检查:getPropertyHouse,"+ JSONObject.toJSONString(info));
+        }
+
+        return businessPropertyInfos.get(0);
+    }
+
+
+    /**
+     * 查询住户属性信息(instance过程)
+     * @param info bId 信息
+     * @return 物业属性
+     * @throws DAOException
+     */
+    public List<Map> getPropertyHouseAttrs(Map info) throws DAOException{
+        logger.debug("查询住户属性信息 入参 info : {}",info);
+
+        List<Map> propertyAttrs = sqlSessionTemplate.selectList("propertyServiceDaoImpl.getPropertyHouseAttrs",info);
+
+        return propertyAttrs;
+    }
+
     /**
      * 物业照片查询(instance)
      * @param info bId 信息
@@ -418,6 +554,37 @@ public class PropertyServiceDaoImpl extends BaseServiceDao implements IPropertyS
         }
     }
 
+    /**
+     * 修改住户信息
+     * @param info 修改信息
+     * @throws DAOException
+     */
+    public void updatePropertyHouseInstance(Map info) throws DAOException{
+        logger.debug("修改住户信息Instance 入参 info : {}",info);
+
+        int saveFlag = sqlSessionTemplate.update("propertyServiceDaoImpl.updatePropertyHouseInstance",info);
+
+        if(saveFlag < 1){
+            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"修改住户信息Instance数据失败:"+ JSONObject.toJSONString(info));
+        }
+    }
+
+
+    /**
+     * 修改住户属性信息
+     * @param info 修改信息
+     * @throws DAOException
+     */
+    public void updatePropertyHouseAttrInstance(Map info) throws DAOException{
+        logger.debug("修改住户属性信息Instance 入参 info : {}",info);
+
+        int saveFlag = sqlSessionTemplate.update("propertyServiceDaoImpl.updatePropertyHouseAttrInstance",info);
+
+        if(saveFlag < 1){
+            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"修改住户属性信息Instance数据失败:"+ JSONObject.toJSONString(info));
+        }
+    }
+
     /**
      * 修改 物业照片信息
      * @param info 修改信息

+ 44 - 112
PropertyService/src/main/java/com/java110/property/listener/SavePropertyHouseListener.java

@@ -59,25 +59,15 @@ public class SavePropertyHouseListener extends AbstractPropertyBusinessServiceDa
         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("businessPropertyHouse")){
+            JSONObject businessProperty = data.getJSONObject("businessPropertyHouse");
+            doBusinessPropertyHouse(business,businessProperty);
+            dataFlowContext.addParamOut("houseId",businessProperty.getString("houseId"));
         }
 
-        if(data.containsKey("businessPropertyAttr")){
-            JSONArray businessPropertyAttrs = data.getJSONArray("businessPropertyAttr");
-            doSaveBusinessPropertyAttrs(business,businessPropertyAttrs);
-        }
-
-        if(data.containsKey("businessPropertyPhoto")){
-            JSONArray businessPropertyPhotos = data.getJSONArray("businessPropertyPhoto");
-            doBusinessPropertyPhoto(business,businessPropertyPhotos);
-        }
-
-        if(data.containsKey("businessPropertyCerdentials")){
-            JSONArray businessPropertyCerdentialses = data.getJSONArray("businessPropertyCerdentials");
-            doBusinessPropertyCerdentials(business,businessPropertyCerdentialses);
+        if(data.containsKey("businessPropertyHouseAttr")){
+            JSONArray businessPropertyHouseAttrs = data.getJSONArray("businessPropertyHouseAttr");
+            doSaveBusinessPropertyHouseAttrs(business,businessPropertyHouseAttrs);
         }
     }
 
@@ -95,25 +85,15 @@ public class SavePropertyHouseListener extends AbstractPropertyBusinessServiceDa
         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"));
+        Map businessPropertyHouse = propertyServiceDaoImpl.getBusinessPropertyHouse(info);
+        if( businessPropertyHouse != null && !businessPropertyHouse.isEmpty()) {
+            propertyServiceDaoImpl.savePropertyHouseInstance(info);
+            dataFlowContext.addParamOut("houseId",businessPropertyHouse.get("house_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);
+        List<Map> businessPropertyHouseAttrs = propertyServiceDaoImpl.getBusinessPropertyHouseAttrs(info);
+        if(businessPropertyHouseAttrs != null && businessPropertyHouseAttrs.size() > 0) {
+            propertyServiceDaoImpl.savePropertyHouseAttrsInstance(info);
         }
     }
 
@@ -133,51 +113,17 @@ public class SavePropertyHouseListener extends AbstractPropertyBusinessServiceDa
         paramIn.put("bId",bId);
         paramIn.put("statusCd",StatusConstant.STATUS_CD_INVALID);
         //物业信息
-        Map propertyInfo = propertyServiceDaoImpl.getPropertyInfo(info);
+        Map propertyInfo = propertyServiceDaoImpl.getPropertyHouse(info);
         if(propertyInfo != null && !propertyInfo.isEmpty()){
-            paramIn.put("propertyId",propertyInfo.get("property_id").toString());
-            propertyServiceDaoImpl.updatePropertyInfoInstance(paramIn);
-            dataFlowContext.addParamOut("propertyId",propertyInfo.get("property_id"));
+            paramIn.put("houseId",propertyInfo.get("house_id").toString());
+            propertyServiceDaoImpl.updatePropertyHouseInstance(paramIn);
+            dataFlowContext.addParamOut("houseId",propertyInfo.get("house_id"));
         }
 
         //物业属性
-        List<Map> propertyAttrs = propertyServiceDaoImpl.getPropertyAttrs(info);
+        List<Map> propertyAttrs = propertyServiceDaoImpl.getPropertyHouseAttrs(info);
         if(propertyAttrs != null && propertyAttrs.size()>0){
-            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);
+            propertyServiceDaoImpl.updatePropertyHouseAttrInstance(paramIn);
         }
     }
 
@@ -186,19 +132,23 @@ public class SavePropertyHouseListener extends AbstractPropertyBusinessServiceDa
      * @param business 总的数据节点
      * @param businessProperty 物业节点
      */
-    private void doBusinessProperty(Business business,JSONObject businessProperty){
+    private void doBusinessPropertyHouse(Business business,JSONObject businessProperty){
 
-        Assert.jsonObjectHaveKey(businessProperty,"propertyId","businessProperty 节点下没有包含 propertyId 节点");
+        Assert.jsonObjectHaveKey(businessProperty,"houseId","businessPropertyHouse 节点下没有包含 houseId 节点");
+        Assert.jsonObjectHaveKey(businessProperty,"propertyId","businessPropertyHouse 节点下没有包含 propertyId 节点");
 
         if(businessProperty.getString("propertyId").startsWith("-")){
+            throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"businessPropertyHouse 节点下 propertyId 必须为已有物业ID 不能以 - 开头");
+        }
+        if(businessProperty.getString("houseId").startsWith("-")){
             //刷新缓存
-            flushPropertyId(business.getDatas());
+            flushHouseId(business.getDatas());
         }
 
         businessProperty.put("bId",business.getbId());
         businessProperty.put("operate", StatusConstant.OPERATE_ADD);
         //保存物业信息
-        propertyServiceDaoImpl.saveBusinessPropertyInfo(businessProperty);
+        propertyServiceDaoImpl.saveBusinessPropertyHouse(businessProperty);
 
     }
 
@@ -207,14 +157,13 @@ public class SavePropertyHouseListener extends AbstractPropertyBusinessServiceDa
     /**
      * 保存物业属性信息
      * @param business 当前业务
-     * @param businessPropertyAttrs 物业属性
+     * @param businessPropertyHouseAttrs 物业属性
      */
-    private void doSaveBusinessPropertyAttrs(Business business,JSONArray businessPropertyAttrs){
+    private void doSaveBusinessPropertyHouseAttrs(Business business,JSONArray businessPropertyHouseAttrs){
         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 节点");
+        for(int propertyAttrIndex = 0 ; propertyAttrIndex < businessPropertyHouseAttrs.size();propertyAttrIndex ++){
+            JSONObject propertyAttr = businessPropertyHouseAttrs.getJSONObject(propertyAttrIndex);
+            Assert.jsonObjectHaveKey(propertyAttr,"attrId","businessPropertyHouseAttr 节点下没有包含 attrId 节点");
 
             if(propertyAttr.getString("attrId").startsWith("-")){
                 String attrId = GenerateCodeFactory.getAttrId();
@@ -222,10 +171,9 @@ public class SavePropertyHouseListener extends AbstractPropertyBusinessServiceDa
             }
 
             propertyAttr.put("bId",business.getbId());
-            propertyAttr.put("propertyId",businessProperty.getString("propertyId"));
             propertyAttr.put("operate", StatusConstant.OPERATE_ADD);
 
-            propertyServiceDaoImpl.saveBusinessPropertyAttr(propertyAttr);
+            propertyServiceDaoImpl.saveBusinessPropertyHouseAttr(propertyAttr);
         }
     }
 
@@ -265,36 +213,20 @@ public class SavePropertyHouseListener extends AbstractPropertyBusinessServiceDa
 
 
     /**
-     * 刷新 物业ID
+     * 刷新 商户ID
      * @param data
      */
-    private void flushPropertyId(JSONObject data) {
+    private void flushHouseId(JSONObject data) {
 
-        String propertyId = GenerateCodeFactory.getPropertyId();
-        JSONObject businessProperty = data.getJSONObject("businessProperty");
-        businessProperty.put("propertyId",propertyId);
+        String houseId = GenerateCodeFactory.getHouseId();
+        JSONObject businessProperty = data.getJSONObject("businessPropertyHouse");
+        businessProperty.put("houseId",houseId);
         //刷物业属性
-        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);
+        if(data.containsKey("businessPropertyHouseAttr")) {
+            JSONArray businessPropertyHouseAttrs = data.getJSONArray("businessPropertyHouseAttr");
+            for(int businessPropertyHouseAttrIndex = 0;businessPropertyHouseAttrIndex < businessPropertyHouseAttrs.size();businessPropertyHouseAttrIndex++) {
+                JSONObject businessPropertyHouseAttr = businessPropertyHouseAttrs.getJSONObject(businessPropertyHouseAttrIndex);
+                businessPropertyHouseAttr.put("houseId", houseId);
             }
         }
     }

+ 2 - 0
java110-config/db/PropertyService/create_table.sql

@@ -144,6 +144,7 @@ CREATE TABLE business_property_fee(
 
 CREATE TABLE business_property_house(
     house_id VARCHAR(30) NOT NULL COMMENT 'ID',
+    property_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 '住户名称',
@@ -264,6 +265,7 @@ 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',
+    property_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 '住户联系号码',

+ 169 - 2
java110-config/src/main/resources/mapper/property/PropertyServiceDaoImplMapper.xml

@@ -35,6 +35,18 @@
         insert into business_property_fee(fee_id,b_id,property_id,fee_type_cd,fee_money,fee_time,start_time,end_time,month,operate)
         values(#{feeId},#{bId},#{propertyId},#{feeTypeCd},#{feeMoney},#{feeTime},#{startTime},#{endTime},#{month},#{operate})
     </insert>
+
+    <!-- 保存住户信息 add by wuxw 2018-07-03 -->
+    <insert id="saveBusinessPropertyHouse" parameterType="Map">
+        insert into business_property_house(house_id,property_id,b_id,house_num,house_name,house_phone,house_area,fee_type_cd,fee_price,month,operate)
+        values(#{houseId},#{propertyId},#{bId},#{houseNum},#{houseName},#{housePhone},#{houseArea},#{feeTypeCd},#{feePrice},#{month},#{operate})
+    </insert>
+    <!-- 保存商户属性信息  add by wuxw 2018-07-03 -->
+    <insert id="saveBusinessPropertyHouseAttr" parameterType="Map">
+        insert into business_property_house_attr(b_id,attr_id,house_id,spec_cd,value,month,operate)
+        values(#{bId},#{attrId},#{houseId},#{specCd},#{value},#{month},#{operate})
+    </insert>
+
     <!-- 查询商户信息(Business) add by wuxw 2018-07-03 -->
     <select id="getBusinessPropertyInfo" parameterType="Map" resultType="Map">
         select s.property_id,s.b_id,s.name,s.address,s.tel,s.nearby_landmarks,s.map_x,s.map_y,s.operate
@@ -53,7 +65,7 @@
 
     <!-- 查询商户属性信息(Business) add by wuxw 2018-07-03 -->
     <select id="getBusinessPropertyAttrs" parameterType="Map" resultType="Map">
-        select sa.b_id,sa.attr_id,sa.property_id,sa.spec_cd,sa.value,sa.oppropertyServiceDaoImplerate
+        select sa.b_id,sa.attr_id,sa.property_id,sa.spec_cd,sa.value,sa.operate
         from business_property_attr sa where 1=1
         <if test="operate != null and operate != ''">
             and sa.operate = #{operate}
@@ -69,6 +81,43 @@
         </if>
     </select>
 
+    <!-- 查询住户信息(Business) add by wuxw 2018-07-03 -->
+    <select id="getBusinessPropertyHouse" parameterType="Map" resultType="Map">
+        select s.house_id,s.property_id,s.b_id,s.house_num,s.house_name,s.house_phone,s.house_area,s.fee_type_cd,s.fee_price,s.operate
+        from business_property_house s where 1 = 1
+        <if test="operate != null and operate != ''">
+            and s.operate = #{operate}
+        </if>
+        <if test="bId != null and bId !=''">
+            and s.b_id = #{bId}
+        </if>
+        <if test="propertyId != null and propertyId != ''">
+            and s.property_id = #{propertyId}
+        </if>
+        <if test="houseId != null and houseId != ''">
+            and s.house_id = #{houseId}
+        </if>
+    </select>
+
+
+    <!-- 查询住户属性信息(Business) add by wuxw 2018-07-03 -->
+    <select id="getBusinessPropertyHouseAttrs" parameterType="Map" resultType="Map">
+        select sa.b_id,sa.attr_id,sa.house_id,sa.spec_cd,sa.value,sa.operate
+        from business_property_house_attr sa where 1=1
+        <if test="operate != null and operate != ''">
+            and sa.operate = #{operate}
+        </if>
+        <if test="bId != null and bId !=''">
+            and sa.b_id = #{bId}
+        </if>
+        <if test="houseId != null and houseId != ''">
+            and sa.house_id = #{houseId}
+        </if>
+        <if test="attrId != null and attrId != ''">
+            and sa.attr_id = #{attrId}
+        </if>
+    </select>
+
     <!-- 查询商户照片信息 add by wuxw 2018-07-03 -->
     <select id="getBusinessPropertyPhoto" parameterType="Map" resultType="Map">
         select sp.property_photo_id,sp.b_id,sp.property_id,sp.property_photo_type_cd,sp.photo,sp.operate
@@ -144,6 +193,22 @@
         from business_property_attr sa
         where sa.operate = 'ADD' and sa.b_id=#{bId}
     </insert>
+
+    <!-- 保存住户信息至 instance表中 add by wuxw 2018-07-03 -->
+    <insert id="savePropertyHouseInstance" parameterType="Map">
+        insert into p_property_house(house_id,property_id,b_id,house_num,house_name,house_phone,house_area,fee_type_cd,fee_price,status_cd)
+        select s.house_id,s.property_id,s.b_id,s.house_num,s.house_name,s.house_phone,s.house_area,s.fee_type_cd,s.fee_price,'0'
+        from business_property_house s where
+        s.operate = 'ADD' and s.b_id=#{bId}
+    </insert>
+
+    <!-- 保存住户属性信息到 instance add by wuxw 2018-07-03 -->
+    <insert id="savePropertyHouseAttrsInstance" parameterType="Map">
+        insert into p_property_house_attr(b_id,attr_id,house_id,spec_cd,value,status_cd)
+        select sa.b_id,sa.attr_id,sa.house_id,sa.spec_cd,sa.value,'0'
+        from business_property_house_attr sa
+        where sa.operate = 'ADD' and sa.b_id=#{bId}
+    </insert>
     
     <!-- 保存 商户照片信息 instance add by wuxw 2018-07-03 -->
     <insert id="savePropertyPhotoInstance" parameterType="Map">
@@ -198,7 +263,7 @@
     <select id="getPropertyAttrs" parameterType="Map" resultType="Map">
         select sa.b_id,sa.attr_id,sa.property_id,sa.spec_cd,sa.value,sa.status_cd
         from p_property_attr sa
-        wheregetPropertyFee
+        where
         1=1
         <if test="statusCd != null and statusCd != ''">
             and sa.status_cd = #{statusCd}
@@ -214,6 +279,48 @@
         </if>
     </select>
 
+
+
+    <!-- 查询住户信息 add by wuxw 2018-07-03 -->
+    <select id="getPropertyHouse" parameterType="Map" resultType="Map">
+        select s.house_id,s.property_id,s.b_id,s.house_num,s.house_name,s.house_area,s.house_phone,s.fee_type_cd,s.fee_price,s.status_cd
+        from p_property_house s
+        where 1=1
+        <if test="statusCd != null and statusCd != ''">
+            and s.status_cd = #{statusCd}
+        </if>
+
+        <if test="bId != null and bId !=''">
+            and s.b_id = #{bId}
+        </if>
+        <if test="propertyId != null and propertyId !=''">
+            and s.property_id = #{propertyId}
+        </if>
+        <if test="houseId != null and houseId !=''">
+            and s.house_id = #{houseId}
+        </if>
+    </select>
+
+    <!-- 查询住户属性信息 add by wuxw 2018-07-03 -->
+    <select id="getPropertyHouseAttrs" parameterType="Map" resultType="Map">
+        select sa.b_id,sa.attr_id,sa.house_id,sa.spec_cd,sa.value,sa.status_cd
+        from p_property_house_attr sa
+        where
+        1=1
+        <if test="statusCd != null and statusCd != ''">
+            and sa.status_cd = #{statusCd}
+        </if>
+        <if test="bId != null and bId !=''">
+            and sa.b_id = #{bId}
+        </if>
+        <if test="houseId != null and houseId !=''">
+            and sa.house_id = #{houseId}
+        </if>
+        <if test="attrId != null and attrId != ''">
+            and sa.attr_id = #{attrId}
+        </if>
+    </select>
+
     <!-- 查询商户照片信息 add by wuxw 2018-07-03 -->
     <select id="getPropertyPhoto" parameterType="Map" resultType="Map">
         select sp.property_photo_id,sp.b_id,sp.property_id,sp.property_photo_type_cd,sp.photo,sp.status_cd
@@ -337,6 +444,66 @@
         </if>
     </update>
 
+    <!-- 修改住户信息 add by wuxw 2018-07-03 -->
+    <update id="updatePropertyHouseInstance" parameterType="Map">
+        update p_property_house s set s.status_cd = #{statusCd}
+        <if test="newBId != null and newBId != ''">
+            ,s.b_id = #{newBId}
+        </if>
+        <if test="houseName != null and houseName != ''">
+            ,s.house_name = #{houseName}
+        </if>
+        <if test="houseNum != null and houseNum != ''">
+            ,s.house_num = #{houseNum}
+        </if>
+        <if test="housePhone != null and housePhone != ''">
+            ,s.house_phone = #{housePhone}
+        </if>
+        <if test="houseArea != null and houseArea != ''">
+            ,s.house_area = #{houseArea}
+        </if>
+        <if test="feeTypeCd != null and feeTypeCd != ''">
+            ,s.fee_type_cd = #{feeTypeCd}
+        </if>
+        <if test="feePrice != null and feePrice != ''">
+            ,s.fee_price = #{feePrice}
+        </if>
+        where 1=1
+        <if test="bId != null and bId !=''">
+            and s.b_id = #{bId}
+        </if>
+        <if test="propertyId != null and propertyId !=''">
+            and s.property_id = #{propertyId}
+        </if>
+        <if test="houseId != null and houseId !=''">
+            and s.house_id = #{houseId}
+        </if>
+    </update>
+
+    <!-- 修改住户属性信息 add by wuxw 2018-07-03 -->
+    <update id="updatePropertyHouseAttrInstance" parameterType="Map">
+        update p_property_house_attr sa set sa.status_cd = #{statusCd}
+        <if test="newBId != null and newBId != ''">
+            ,sa.b_id = #{newBId}
+        </if>
+        <if test="value != null and value != ''">
+            ,sa.value = #{value}
+        </if>
+        where 1=1
+        <if test="bId != null and bId !=''">
+            and sa.b_id = #{bId}
+        </if>
+        <if test="houseId != null and houseId !=''">
+            and sa.house_id = #{houseId}
+        </if>
+        <if test="specCd != null and specCd !=''">
+            and sa.spec_cd = #{specCd}
+        </if>
+        <if test="attrId != null and attrId !=''">
+            and sa.attr_id = #{attrId}
+        </if>
+    </update>
+
     <!-- 修改商户照片信息 add by wuxw 2018-07-03 -->
     <update id="updatePropertyPhotoInstance" parameterType="Map">
         update p_property_photo sp set sp.status_cd = #{statusCd}

+ 15 - 0
java110-core/src/main/java/com/java110/core/factory/GenerateCodeFactory.java

@@ -80,6 +80,7 @@ public class GenerateCodeFactory {
         prefixMap.put("propertyCerdentialsId","92");
         prefixMap.put("propertyUserId","93");
         prefixMap.put("propertyFeeId","94");
+        prefixMap.put("houseId","95");
     }
 
     private static String PLATFORM_CODE = "0001";
@@ -399,6 +400,20 @@ public class GenerateCodeFactory {
         return getCode(prefixMap.get("propertyFeeId"));
     }
 
+    /**
+     * 住户ID生成
+     * @return
+     * @throws GenerateCodeException
+     */
+    public static String getHouseId() throws GenerateCodeException{
+        if(!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))){
+            return prefixMap.get("houseId") + DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H+nextId("%06d"));
+        }
+
+        return getCode(prefixMap.get("houseId"));
+    }
+
+
 
     /**
      * 商品ID生成