|
|
@@ -24,14 +24,11 @@ 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
|
|
|
+ * 1、businessPropertyHouse:{} 物业基本信息节点
|
|
|
+ * 2、businessPropertyHouseAttr:[{}] 物业属性信息节点
|
|
|
* Created by wuxw on 2018/5/18.
|
|
|
*/
|
|
|
-@Java110Listener("updatePropertyHouseListener")
|
|
|
+@Java110Listener("updatePropertyHouseHouseListener")
|
|
|
@Transactional
|
|
|
public class UpdatePropertyHouseListener extends AbstractPropertyBusinessServiceDataFlowListener {
|
|
|
|
|
|
@@ -61,26 +58,16 @@ public class UpdatePropertyHouseListener extends AbstractPropertyBusinessService
|
|
|
|
|
|
Assert.notEmpty(data,"没有datas 节点,或没有子节点需要处理");
|
|
|
|
|
|
- //处理 businessProperty 节点
|
|
|
- if(data.containsKey("businessProperty")){
|
|
|
- JSONObject businessProperty = data.getJSONObject("businessProperty");
|
|
|
- doBusinessProperty(business,businessProperty);
|
|
|
- dataFlowContext.addParamOut("propertyId",businessProperty.getString("propertyId"));
|
|
|
+ //处理 businessPropertyHouse 节点
|
|
|
+ if(data.containsKey("businessPropertyHouse")){
|
|
|
+ JSONObject businessPropertyHouse = data.getJSONObject("businessPropertyHouse");
|
|
|
+ doBusinessPropertyHouse(business,businessPropertyHouse);
|
|
|
+ dataFlowContext.addParamOut("propertyId",businessPropertyHouse.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);
|
|
|
+ if(data.containsKey("businessPropertyHouseAttr")){
|
|
|
+ JSONArray businessPropertyHouseAttrs = data.getJSONArray("businessPropertyHouseAttr");
|
|
|
+ doSaveBusinessPropertyHouseAttrs(business,businessPropertyHouseAttrs);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -100,34 +87,18 @@ public class UpdatePropertyHouseListener extends AbstractPropertyBusinessService
|
|
|
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"));
|
|
|
+ Map businessPropertyHouseInfo = propertyServiceDaoImpl.getBusinessPropertyHouse(info);
|
|
|
+ if( businessPropertyHouseInfo != null && !businessPropertyHouseInfo.isEmpty()) {
|
|
|
+ flushBusinessPropertyHouse(businessPropertyHouseInfo,StatusConstant.STATUS_CD_VALID);
|
|
|
+ propertyServiceDaoImpl.updatePropertyHouseInstance(businessPropertyHouseInfo);
|
|
|
+ dataFlowContext.addParamOut("houseId",businessPropertyHouseInfo.get("house_id"));
|
|
|
}
|
|
|
//物业属性
|
|
|
- List<Map> businessPropertyAttrs = propertyServiceDaoImpl.getBusinessPropertyAttrs(info);
|
|
|
- if(businessPropertyAttrs != null && businessPropertyAttrs.size() > 0) {
|
|
|
- for(Map businessPropertyAttr : businessPropertyAttrs) {
|
|
|
- flushBusinessPropertyAttr(businessPropertyAttr,StatusConstant.STATUS_CD_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);
|
|
|
+ List<Map> businessPropertyHouseAttrs = propertyServiceDaoImpl.getBusinessPropertyHouseAttrs(info);
|
|
|
+ if(businessPropertyHouseAttrs != null && businessPropertyHouseAttrs.size() > 0) {
|
|
|
+ for(Map businessPropertyHouseAttr : businessPropertyHouseAttrs) {
|
|
|
+ flushBusinessPropertyHouseAttr(businessPropertyHouseAttr,StatusConstant.STATUS_CD_VALID);
|
|
|
+ propertyServiceDaoImpl.updatePropertyHouseAttrInstance(businessPropertyHouseAttr);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -149,110 +120,62 @@ public class UpdatePropertyHouseListener extends AbstractPropertyBusinessService
|
|
|
delInfo.put("bId",business.getbId());
|
|
|
delInfo.put("operate",StatusConstant.OPERATE_DEL);
|
|
|
//物业信息
|
|
|
- Map propertyInfo = propertyServiceDaoImpl.getPropertyInfo(info);
|
|
|
+ Map propertyInfo = propertyServiceDaoImpl.getPropertyHouse(info);
|
|
|
if(propertyInfo != null && !propertyInfo.isEmpty()){
|
|
|
|
|
|
//物业信息
|
|
|
- Map businessPropertyInfo = propertyServiceDaoImpl.getBusinessPropertyInfo(delInfo);
|
|
|
+ Map businessPropertyHouseInfo = propertyServiceDaoImpl.getBusinessPropertyHouse(delInfo);
|
|
|
//除非程序出错了,这里不会为空
|
|
|
- if(businessPropertyInfo == null || businessPropertyInfo.isEmpty()){
|
|
|
+ if(businessPropertyHouseInfo == null || businessPropertyHouseInfo.isEmpty()){
|
|
|
throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR,"撤单失败(property),程序内部异常,请检查! "+delInfo);
|
|
|
}
|
|
|
|
|
|
- flushBusinessPropertyInfo(businessPropertyInfo,StatusConstant.STATUS_CD_VALID);
|
|
|
- propertyServiceDaoImpl.updatePropertyInfoInstance(businessPropertyInfo);
|
|
|
+ flushBusinessPropertyHouse(businessPropertyHouseInfo,StatusConstant.STATUS_CD_VALID);
|
|
|
+ propertyServiceDaoImpl.updatePropertyHouseInstance(businessPropertyHouseInfo);
|
|
|
dataFlowContext.addParamOut("propertyId",propertyInfo.get("property_id"));
|
|
|
}
|
|
|
|
|
|
//物业属性
|
|
|
- List<Map> propertyAttrs = propertyServiceDaoImpl.getPropertyAttrs(info);
|
|
|
+ List<Map> propertyAttrs = propertyServiceDaoImpl.getPropertyHouseAttrs(info);
|
|
|
if(propertyAttrs != null && propertyAttrs.size()>0){
|
|
|
|
|
|
- List<Map> businessPropertyAttrs = propertyServiceDaoImpl.getBusinessPropertyAttrs(delInfo);
|
|
|
+ List<Map> businessPropertyHouseAttrs = propertyServiceDaoImpl.getBusinessPropertyHouseAttrs(delInfo);
|
|
|
//除非程序出错了,这里不会为空
|
|
|
- if(businessPropertyAttrs == null || businessPropertyAttrs.size() ==0 ){
|
|
|
+ if(businessPropertyHouseAttrs == null || businessPropertyHouseAttrs.size() ==0 ){
|
|
|
throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR,"撤单失败(property_attr),程序内部异常,请检查! "+delInfo);
|
|
|
}
|
|
|
- for(Map businessPropertyAttr : businessPropertyAttrs) {
|
|
|
- flushBusinessPropertyAttr(businessPropertyAttr,StatusConstant.STATUS_CD_VALID);
|
|
|
- propertyServiceDaoImpl.updatePropertyAttrInstance(businessPropertyAttr);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- //物业照片
|
|
|
- List<Map> propertyPhotos = propertyServiceDaoImpl.getPropertyPhoto(info);
|
|
|
- if(propertyPhotos != null && propertyPhotos.size()>0){
|
|
|
- List<Map> businessPropertyPhotos = propertyServiceDaoImpl.getBusinessPropertyPhoto(delInfo);
|
|
|
- //除非程序出错了,这里不会为空
|
|
|
- if(businessPropertyPhotos == null || businessPropertyPhotos.size() ==0 ){
|
|
|
- throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR,"撤单失败(property_photo),程序内部异常,请检查! "+delInfo);
|
|
|
- }
|
|
|
- for(Map businessPropertyPhoto : businessPropertyPhotos) {
|
|
|
- flushBusinessPropertyPhoto(businessPropertyPhoto,StatusConstant.STATUS_CD_VALID);
|
|
|
- propertyServiceDaoImpl.updatePropertyPhotoInstance(businessPropertyPhoto);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- //物业属性
|
|
|
- List<Map> propertyCerdentialses = propertyServiceDaoImpl.getPropertyCerdentials(info);
|
|
|
- if(propertyCerdentialses != null && propertyCerdentialses.size()>0){
|
|
|
- List<Map> businessPropertyCerdentialses = propertyServiceDaoImpl.getBusinessPropertyCerdentials(delInfo);
|
|
|
- //除非程序出错了,这里不会为空
|
|
|
- if(businessPropertyCerdentialses == null || businessPropertyCerdentialses.size() ==0 ){
|
|
|
- throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR,"撤单失败(property_cerdentials),程序内部异常,请检查! "+delInfo);
|
|
|
- }
|
|
|
- for(Map businessPropertyCerdentials : businessPropertyCerdentialses) {
|
|
|
- flushBusinessPropertyCredentials(businessPropertyCerdentials,StatusConstant.STATUS_CD_VALID);
|
|
|
- propertyServiceDaoImpl.updatePropertyCerdentailsInstance(businessPropertyCerdentials);
|
|
|
+ for(Map businessPropertyHouseAttr : businessPropertyHouseAttrs) {
|
|
|
+ flushBusinessPropertyHouseAttr(businessPropertyHouseAttr,StatusConstant.STATUS_CD_VALID);
|
|
|
+ propertyServiceDaoImpl.updatePropertyHouseAttrInstance(businessPropertyHouseAttr);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 保存物业照片
|
|
|
- * @param business 业务对象
|
|
|
- * @param businessPropertyPhotos 物业照片
|
|
|
- */
|
|
|
- private void doBusinessPropertyPhoto(Business business, JSONArray businessPropertyPhotos) {
|
|
|
-
|
|
|
-
|
|
|
- for(int businessPropertyPhotoIndex = 0 ;businessPropertyPhotoIndex < businessPropertyPhotos.size();businessPropertyPhotoIndex++) {
|
|
|
- JSONObject businessPropertyPhoto = businessPropertyPhotos.getJSONObject(businessPropertyPhotoIndex);
|
|
|
- Assert.jsonObjectHaveKey(businessPropertyPhoto, "propertyId", "businessPropertyPhoto 节点下没有包含 propertyId 节点");
|
|
|
-
|
|
|
- if (businessPropertyPhoto.getString("propertyPhotoId").startsWith("-")) {
|
|
|
- throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"propertyPhotoId 错误,不能自动生成(必须已经存在的propertyPhotoId)"+businessPropertyPhoto);
|
|
|
- }
|
|
|
-
|
|
|
- //自动保存DEL信息
|
|
|
- autoSaveDelBusinessPropertyPhoto(business,businessPropertyPhoto);
|
|
|
-
|
|
|
- businessPropertyPhoto.put("bId", business.getbId());
|
|
|
- businessPropertyPhoto.put("operate", StatusConstant.OPERATE_ADD);
|
|
|
- //保存物业信息
|
|
|
- propertyServiceDaoImpl.saveBusinessPropertyPhoto(businessPropertyPhoto);
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
/**
|
|
|
- * 处理 businessProperty 节点
|
|
|
+ * 处理 businessPropertyHouse 节点
|
|
|
* @param business 总的数据节点
|
|
|
- * @param businessProperty 物业节点
|
|
|
+ * @param businessPropertyHouse 物业节点
|
|
|
*/
|
|
|
- private void doBusinessProperty(Business business,JSONObject businessProperty){
|
|
|
+ private void doBusinessPropertyHouse(Business business,JSONObject businessPropertyHouse){
|
|
|
+
|
|
|
+ Assert.jsonObjectHaveKey(businessPropertyHouse,"propertyId","businessPropertyHouse 节点下没有包含 propertyId 节点");
|
|
|
+ Assert.jsonObjectHaveKey(businessPropertyHouse,"houseId","businessPropertyHouse 节点下没有包含 houseId 节点");
|
|
|
|
|
|
- Assert.jsonObjectHaveKey(businessProperty,"propertyId","businessProperty 节点下没有包含 propertyId 节点");
|
|
|
+ if(businessPropertyHouse.getString("propertyId").startsWith("-")){
|
|
|
+ throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"propertyId 错误,不能自动生成(必须已经存在的propertyId)"+businessPropertyHouse);
|
|
|
+ }
|
|
|
|
|
|
- if(businessProperty.getString("propertyId").startsWith("-")){
|
|
|
- throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"propertyId 错误,不能自动生成(必须已经存在的propertyId)"+businessProperty);
|
|
|
+ if(businessPropertyHouse.getString("houseId").startsWith("-")){
|
|
|
+ throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"houseId 错误,不能自动生成(必须已经存在的houseId)"+businessPropertyHouse);
|
|
|
}
|
|
|
//自动保存DEL
|
|
|
- autoSaveDelBusinessProperty(business,businessProperty);
|
|
|
+ autoSaveDelBusinessPropertyHouse(business,businessPropertyHouse);
|
|
|
|
|
|
- businessProperty.put("bId",business.getbId());
|
|
|
- businessProperty.put("operate", StatusConstant.OPERATE_ADD);
|
|
|
+ businessPropertyHouse.put("bId",business.getbId());
|
|
|
+ businessPropertyHouse.put("operate", StatusConstant.OPERATE_ADD);
|
|
|
//保存物业信息
|
|
|
- propertyServiceDaoImpl.saveBusinessPropertyInfo(businessProperty);
|
|
|
+ propertyServiceDaoImpl.saveBusinessPropertyHouse(businessPropertyHouse);
|
|
|
|
|
|
}
|
|
|
|
|
|
@@ -261,53 +184,29 @@ public class UpdatePropertyHouseListener extends AbstractPropertyBusinessService
|
|
|
/**
|
|
|
* 保存物业属性信息
|
|
|
* @param business 当前业务
|
|
|
- * @param businessPropertyAttrs 物业属性
|
|
|
+ * @param businessPropertyHouseAttrs 物业属性
|
|
|
*/
|
|
|
- private void doSaveBusinessPropertyAttrs(Business business,JSONArray businessPropertyAttrs){
|
|
|
+ private void doSaveBusinessPropertyHouseAttrs(Business business,JSONArray businessPropertyHouseAttrs){
|
|
|
JSONObject data = business.getDatas();
|
|
|
|
|
|
|
|
|
- for(int propertyAttrIndex = 0 ; propertyAttrIndex < businessPropertyAttrs.size();propertyAttrIndex ++){
|
|
|
- JSONObject propertyAttr = businessPropertyAttrs.getJSONObject(propertyAttrIndex);
|
|
|
- Assert.jsonObjectHaveKey(propertyAttr,"attrId","businessPropertyAttr 节点下没有包含 attrId 节点");
|
|
|
+ for(int propertyAttrIndex = 0 ; propertyAttrIndex < businessPropertyHouseAttrs.size();propertyAttrIndex ++){
|
|
|
+ JSONObject propertyAttr = businessPropertyHouseAttrs.getJSONObject(propertyAttrIndex);
|
|
|
+ Assert.jsonObjectHaveKey(propertyAttr,"attrId","businessPropertyHouseAttr 节点下没有包含 attrId 节点");
|
|
|
if(propertyAttr.getString("attrId").startsWith("-")){
|
|
|
throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"attrId 错误,不能自动生成(必须已经存在的attrId)"+propertyAttr);
|
|
|
}
|
|
|
//自动保存DEL数据
|
|
|
- autoSaveDelBusinessPropertyAttr(business,propertyAttr);
|
|
|
+ autoSaveDelBusinessPropertyHouseAttr(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);
|
|
|
+ propertyServiceDaoImpl.saveBusinessPropertyHouseAttr(propertyAttr);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
|
|
|
public IPropertyServiceDao getPropertyServiceDaoImpl() {
|
|
|
return propertyServiceDaoImpl;
|