|
|
@@ -2,13 +2,9 @@ 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;
|
|
|
@@ -19,8 +15,6 @@ 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;
|
|
|
@@ -58,27 +52,12 @@ public class SavePropertyFeeListener extends AbstractPropertyBusinessServiceData
|
|
|
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("businessPropertyFee")){
|
|
|
+ JSONArray businessPropertyFees = data.getJSONArray("businessPropertyFee");
|
|
|
+ doBusinessPropertyFee(business,businessPropertyFees);
|
|
|
}
|
|
|
|
|
|
- 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);
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -94,27 +73,13 @@ public class SavePropertyFeeListener extends AbstractPropertyBusinessServiceData
|
|
|
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);
|
|
|
+
|
|
|
+ //物业费用
|
|
|
+ List<Map> businessPropertyFees = propertyServiceDaoImpl.getBusinessPropertyFee(info);
|
|
|
+ if(businessPropertyFees != null && businessPropertyFees.size() >0){
|
|
|
+ propertyServiceDaoImpl.savePropertyFeeInstance(info);
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -132,174 +97,36 @@ public class SavePropertyFeeListener extends AbstractPropertyBusinessServiceData
|
|
|
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);
|
|
|
+
|
|
|
+ //物业费用
|
|
|
+ List<Map> propertyFees = propertyServiceDaoImpl.getPropertyFee(info);
|
|
|
+ if(propertyFees != null && propertyFees.size()>0){
|
|
|
+ propertyServiceDaoImpl.updatePropertyFeeInstance(paramIn);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 保存物业照片
|
|
|
+ * 保存物业费用
|
|
|
* @param business 业务对象
|
|
|
- * @param businessPropertyPhotos 物业照片
|
|
|
+ * @param businessPropertyFees 物业费用
|
|
|
*/
|
|
|
- private void doBusinessPropertyPhoto(Business business, JSONArray businessPropertyPhotos) {
|
|
|
+ private void doBusinessPropertyFee(Business business, JSONArray businessPropertyFees) {
|
|
|
|
|
|
- for(int businessPropertyPhotoIndex = 0 ;businessPropertyPhotoIndex < businessPropertyPhotos.size();businessPropertyPhotoIndex++) {
|
|
|
- JSONObject businessPropertyPhoto = businessPropertyPhotos.getJSONObject(businessPropertyPhotoIndex);
|
|
|
- Assert.jsonObjectHaveKey(businessPropertyPhoto, "propertyId", "businessPropertyPhoto 节点下没有包含 propertyId 节点");
|
|
|
+ for(int businessPropertyFeeIndex = 0 ;businessPropertyFeeIndex < businessPropertyFees.size();businessPropertyFeeIndex++) {
|
|
|
+ JSONObject businessPropertyFee = businessPropertyFees.getJSONObject(businessPropertyFeeIndex);
|
|
|
+ Assert.jsonObjectHaveKey(businessPropertyFee, "propertyId", "businessPropertyFee 节点下没有包含 propertyId 节点");
|
|
|
|
|
|
- if (businessPropertyPhoto.getString("propertyPhotoId").startsWith("-")) {
|
|
|
- String propertyPhotoId = GenerateCodeFactory.getPropertyPhotoId();
|
|
|
- businessPropertyPhoto.put("propertyPhotoId", propertyPhotoId);
|
|
|
+ if (businessPropertyFee.getString("feeId").startsWith("-")) {
|
|
|
+ String propertyFeeId = GenerateCodeFactory.getPropertyFeeId();
|
|
|
+ businessPropertyFee.put("feeId", propertyFeeId);
|
|
|
}
|
|
|
- businessPropertyPhoto.put("bId", business.getbId());
|
|
|
- businessPropertyPhoto.put("operate", StatusConstant.OPERATE_ADD);
|
|
|
+ businessPropertyFee.put("bId", business.getbId());
|
|
|
+ businessPropertyFee.put("operate", StatusConstant.OPERATE_ADD);
|
|
|
//保存物业信息
|
|
|
- propertyServiceDaoImpl.saveBusinessPropertyPhoto(businessPropertyPhoto);
|
|
|
+ propertyServiceDaoImpl.saveBusinessPropertyFee(businessPropertyFee);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 处理 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;
|
|
|
}
|