|
@@ -6,8 +6,8 @@ import com.java110.api.bmo.room.IRoomBMO;
|
|
|
import com.java110.api.listener.AbstractServiceApiPlusListener;
|
|
import com.java110.api.listener.AbstractServiceApiPlusListener;
|
|
|
import com.java110.core.annotation.Java110Listener;
|
|
import com.java110.core.annotation.Java110Listener;
|
|
|
import com.java110.core.context.DataFlowContext;
|
|
import com.java110.core.context.DataFlowContext;
|
|
|
-import com.java110.core.factory.GenerateCodeFactory;
|
|
|
|
|
import com.java110.core.event.service.api.ServiceDataFlowEvent;
|
|
import com.java110.core.event.service.api.ServiceDataFlowEvent;
|
|
|
|
|
+import com.java110.core.factory.GenerateCodeFactory;
|
|
|
import com.java110.utils.constant.CommonConstant;
|
|
import com.java110.utils.constant.CommonConstant;
|
|
|
import com.java110.utils.constant.ServiceCodeAddRoomBindingConstant;
|
|
import com.java110.utils.constant.ServiceCodeAddRoomBindingConstant;
|
|
|
import com.java110.utils.util.Assert;
|
|
import com.java110.utils.util.Assert;
|
|
@@ -41,6 +41,20 @@ public class BindingAddRoomBindingListener extends AbstractServiceApiPlusListene
|
|
|
Assert.hasKeyByFlowData(infos, "addRoomView", "unitPrice", "必填,请填写房屋每平米单价");
|
|
Assert.hasKeyByFlowData(infos, "addRoomView", "unitPrice", "必填,请填写房屋每平米单价");
|
|
|
Assert.hasKeyByFlowData(infos, "addRoomView", "state", "必填,请选择房屋状态");
|
|
Assert.hasKeyByFlowData(infos, "addRoomView", "state", "必填,请选择房屋状态");
|
|
|
|
|
|
|
|
|
|
+ JSONObject addRoomView = null;
|
|
|
|
|
+ for (int roomIndex = 0; roomIndex < infos.size(); roomIndex++) {
|
|
|
|
|
+ JSONObject _info = infos.getJSONObject(roomIndex);
|
|
|
|
|
+ if (_info.containsKey("addRoomView") && _info.getString("flowComponent").equals("addRoomView")) {
|
|
|
|
|
+ addRoomView = _info;
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (addRoomView == null) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ Assert.judgeAttrValue(addRoomView);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -70,14 +84,17 @@ public class BindingAddRoomBindingListener extends AbstractServiceApiPlusListene
|
|
|
addRoomView.put("userId", context.getRequestCurrentHeaders().get(CommonConstant.HTTP_USER_ID));
|
|
addRoomView.put("userId", context.getRequestCurrentHeaders().get(CommonConstant.HTTP_USER_ID));
|
|
|
addRoomView.put("unitId", viewUnitInfo.getString("unitId"));
|
|
addRoomView.put("unitId", viewUnitInfo.getString("unitId"));
|
|
|
roomBMOImpl.addBusinessRoom(addRoomView, context);
|
|
roomBMOImpl.addBusinessRoom(addRoomView, context);
|
|
|
|
|
+ //处理房屋属性
|
|
|
|
|
+ dealRoomAttr(addRoomView, context);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+
|
|
|
commit(context);
|
|
commit(context);
|
|
|
|
|
|
|
|
JSONObject paramOutObj = new JSONObject();
|
|
JSONObject paramOutObj = new JSONObject();
|
|
|
paramOutObj.put("floorId", viewFloorInfo.getString("floorId"));
|
|
paramOutObj.put("floorId", viewFloorInfo.getString("floorId"));
|
|
|
paramOutObj.put("unitId", viewUnitInfo.getString("unitId"));
|
|
paramOutObj.put("unitId", viewUnitInfo.getString("unitId"));
|
|
|
- paramOutObj.put("roomId", addRoomView.getString("floorId"));
|
|
|
|
|
|
|
+ paramOutObj.put("roomId", addRoomView.getString("roomId"));
|
|
|
ResponseEntity<String> responseEntity = null;
|
|
ResponseEntity<String> responseEntity = null;
|
|
|
if (context.getResponseEntity().getStatusCode() == HttpStatus.OK) {
|
|
if (context.getResponseEntity().getStatusCode() == HttpStatus.OK) {
|
|
|
responseEntity = new ResponseEntity<String>(paramOutObj.toJSONString(), HttpStatus.OK);
|
|
responseEntity = new ResponseEntity<String>(paramOutObj.toJSONString(), HttpStatus.OK);
|
|
@@ -85,6 +102,27 @@ public class BindingAddRoomBindingListener extends AbstractServiceApiPlusListene
|
|
|
context.setResponseEntity(responseEntity);
|
|
context.setResponseEntity(responseEntity);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ private void dealRoomAttr(JSONObject addRoomView, DataFlowContext context) {
|
|
|
|
|
+
|
|
|
|
|
+ if (!addRoomView.containsKey("attrs")) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ JSONArray attrs = addRoomView.getJSONArray("attrs");
|
|
|
|
|
+ if (attrs.size() < 1) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ JSONObject attr = null;
|
|
|
|
|
+ for (int attrIndex = 0; attrIndex < attrs.size(); attrIndex++) {
|
|
|
|
|
+ attr = attrs.getJSONObject(attrIndex);
|
|
|
|
|
+ attr.put("roomId", addRoomView.getString("roomId"));
|
|
|
|
|
+ roomBMOImpl.addRoomAttr(attr, context);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
@Override
|
|
@Override
|
|
|
public String getServiceCode() {
|
|
public String getServiceCode() {
|
|
|
return ServiceCodeAddRoomBindingConstant.BINDING_ADDROOMBINDING;
|
|
return ServiceCodeAddRoomBindingConstant.BINDING_ADDROOMBINDING;
|