Explorar o código

同步售出房屋信息到room表

unknown %!s(int64=6) %!d(string=hai) anos
pai
achega
3829a4eaa7

+ 26 - 0
Api/src/main/java/com/java110/api/listener/room/SellRoomListener.java

@@ -72,6 +72,10 @@ public class SellRoomListener extends AbstractServiceApiDataFlowListener {
         //添加单元信息
         businesses.add(sellRoom(paramObj, dataFlowContext));
 
+        //更新房屋信息为售出
+        businesses.add(updateRoom(paramObj, dataFlowContext));
+
+
         //添加物业费用信息
         businesses.add(addPropertyFee(paramObj, dataFlowContext));
 
@@ -161,6 +165,28 @@ public class SellRoomListener extends AbstractServiceApiDataFlowListener {
         super.communityHasOwner(paramObj, communityInnerServiceSMOImpl);
     }
 
+    /**
+     * 添加小区楼信息
+     *
+     * @param paramInJson     接口调用放传入入参
+     * @param dataFlowContext 数据上下文
+     * @return 订单服务能够接受的报文
+     */
+    private JSONObject updateRoom(JSONObject paramInJson, DataFlowContext dataFlowContext) {
+
+
+        JSONObject business = JSONObject.parseObject("{\"datas\":{}}");
+        business.put(CommonConstant.HTTP_BUSINESS_TYPE_CD, BusinessTypeConstant.BUSINESS_TYPE_UPDATE_ROOM_INFO);
+        business.put(CommonConstant.HTTP_SEQ, DEFAULT_SEQ);
+        business.put(CommonConstant.HTTP_INVOKE_MODEL, CommonConstant.HTTP_INVOKE_MODEL_S);
+        JSONObject businessUnit = new JSONObject();
+        businessUnit.putAll(paramInJson);
+        businessUnit.put("userId", dataFlowContext.getRequestCurrentHeaders().get(CommonConstant.HTTP_USER_ID));
+        business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put("businessRoom", businessUnit);
+
+        return business;
+    }
+
 
     public ICommunityInnerServiceSMO getCommunityInnerServiceSMOImpl() {
         return communityInnerServiceSMOImpl;

+ 4 - 1
CommunityService/src/main/java/com/java110/community/listener/room/AbstractRoomBusinessServiceDataFlowListener.java

@@ -59,7 +59,7 @@ public abstract class AbstractRoomBusinessServiceDataFlowListener extends Abstra
      *
      * @param businessRoom 小区房屋信息
      */
-    protected void autoSaveDelBusinessRoom(Business business, JSONObject businessRoom) {
+    protected Map<String,String> autoSaveDelBusinessRoom(Business business, JSONObject businessRoom) {
 //自动插入DEL
         Map info = new HashMap();
         info.put("roomId", businessRoom.getString("roomId"));
@@ -89,6 +89,9 @@ public abstract class AbstractRoomBusinessServiceDataFlowListener extends Abstra
 
         currentRoomInfo.put("operate", StatusConstant.OPERATE_DEL);
         getRoomServiceDaoImpl().saveBusinessRoomInfo(currentRoomInfo);
+
+        //便于更新数据
+        return currentRoomInfo;
     }
 
 

+ 24 - 1
CommunityService/src/main/java/com/java110/community/listener/room/UpdateRoomInfoListener.java

@@ -17,6 +17,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.transaction.annotation.Transactional;
 
 import java.util.HashMap;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 
@@ -168,10 +169,32 @@ public class UpdateRoomInfoListener extends AbstractRoomBusinessServiceDataFlowL
             throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR, "roomId 错误,不能自动生成(必须已经存在的roomId)" + businessRoom);
         }
         //自动保存DEL
-        autoSaveDelBusinessRoom(business, businessRoom);
+        Map<String,String> currentRoomInfo = autoSaveDelBusinessRoom(business, businessRoom);
 
         businessRoom.put("bId", business.getbId());
         businessRoom.put("operate", StatusConstant.OPERATE_ADD);
+        Map<String,String> needInsert = new HashMap<>();
+        //将不需要改变的数据写到businessRoom中
+        for (Map.Entry<String, String> currentRoomInfoEntry : currentRoomInfo.entrySet()) {
+            Iterator iter = businessRoom.entrySet().iterator();
+            boolean writeFlag = true;
+            while (iter.hasNext()) {
+                Map.Entry entry = (Map.Entry) iter.next();
+                //key值比对
+                if (currentRoomInfoEntry.getKey().equals(entry.getKey().toString())){
+                    writeFlag = false;
+                    break;
+                }
+            }
+            if (writeFlag){
+                needInsert.put(currentRoomInfoEntry.getKey(),currentRoomInfoEntry.getValue());
+            }
+        }
+        //写入businessRoom
+        for (Map.Entry<String, String> needInsertMap : needInsert.entrySet()) {
+            businessRoom.put(needInsertMap.getKey(),needInsertMap.getValue());
+        }
+
         //保存小区房屋信息
         roomServiceDaoImpl.saveBusinessRoomInfo(businessRoom);
 

+ 15 - 1
WebService/src/main/java/com/java110/web/smo/addOwner/impl/AddOwnerRoomBindingSMOImpl.java

@@ -61,7 +61,21 @@ public class AddOwnerRoomBindingSMOImpl extends AbstractComponentSMO implements
         newParamIn.put("communityId", communityId);
         newParamIn.put("userId", pd.getUserId());
         newParamIn.put("storeId", result.getStoreId());
-        newParamIn.put("state", "2002");
+        newParamIn.put("state", "2001");
+        //房屋修改信息为已售
+//        newParamIn.put("bId", sellRoomSelectRoom.getString("bId"));
+//        newParamIn.put("roomNum", sellRoomSelectRoom.getString("roomNum"));
+//        newParamIn.put("unitPrice", sellRoomSelectRoom.getString("unitPrice"));
+//        newParamIn.put("builtUpArea", sellRoomSelectRoom.getString("builtUpArea"));
+//        newParamIn.put("roomNum", sellRoomSelectRoom.getString("roomNum"));
+//        newParamIn.put("unitNum", sellRoomSelectRoom.getString("unitNum"));
+//        newParamIn.put("section", sellRoomSelectRoom.getString("section"));
+//        newParamIn.put("flowComponent", sellRoomSelectRoom.getString("flowComponent"));
+//        newParamIn.put("userName", sellRoomSelectRoom.getString("userName"));
+//        newParamIn.put("roomId", sellRoomSelectRoom.getString("roomId"));
+//        newParamIn.put("layer", sellRoomSelectRoom.getString("layer"));
+//        newParamIn.put("apartment", sellRoomSelectRoom.getString("apartment"));
+
         responseEntity = this.callCenterService(restTemplate, pd, newParamIn.toJSONString(),
                 ServiceConstant.SERVICE_API_URL + "/api/room.sellRoom",
                 HttpMethod.POST);

+ 1 - 0
java110-code-generator/src/main/java/com/java110/RoomGeneratorApplication.java

@@ -45,6 +45,7 @@ public class RoomGeneratorApplication {
         param.put("apartment", "apartment");
         param.put("userId", "user_id");
         param.put("statusCd", "status_cd");
+        param.put("state", "state");
         param.put("remark", "remark");
         param.put("operate", "operate");
         data.setParams(param);