瀏覽代碼

删除业主时增加判断是否有未解绑的房屋信息

曾成 5 年之前
父節點
當前提交
411cf8971b

+ 0 - 1
Api/src/main/java/com/java110/api/bmo/owner/IOwnerBMO.java

@@ -38,7 +38,6 @@ public interface IOwnerBMO extends IApiBaseBMO {
      */
      */
     public JSONObject deleteOwner(JSONObject paramInJson);
     public JSONObject deleteOwner(JSONObject paramInJson);
 
 
-    public JSONObject deleteOwnerRoomRel(JSONObject paramInJson);
 
 
     /**
     /**
      * 退出小区成员
      * 退出小区成员

+ 0 - 12
Api/src/main/java/com/java110/api/bmo/owner/impl/OwnerBMOImpl.java

@@ -125,18 +125,6 @@ public class OwnerBMOImpl extends ApiBaseBMO implements IOwnerBMO {
     }
     }
 
 
 
 
-    public JSONObject deleteOwnerRoomRel(JSONObject paramInJson) {
-        JSONObject business = JSONObject.parseObject("{\"datas\":{}}");
-        business.put(CommonConstant.HTTP_BUSINESS_TYPE_CD, BusinessTypeConstant.BUSINESS_TYPE_DELETE_OWNER_ROOM_REL);
-        business.put(CommonConstant.HTTP_SEQ, DEFAULT_SEQ);
-        business.put(CommonConstant.HTTP_INVOKE_MODEL, CommonConstant.HTTP_INVOKE_MODEL_S);
-        JSONObject businessOwner = new JSONObject();
-        businessOwner.put("ownerId", paramInJson.getString("ownerId"));
-        business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put("businessOwnerRoomRel", businessOwner);
-
-        return business;
-    }
-
     /**
     /**
      * 退出小区成员
      * 退出小区成员
      *
      *

+ 6 - 14
Api/src/main/java/com/java110/api/listener/owner/DeleteOwnerListener.java

@@ -80,23 +80,15 @@ public class DeleteOwnerListener extends AbstractServiceApiDataFlowListener {
         if ("1001".equals(paramObj.getString("ownerTypeCd"))) {
         if ("1001".equals(paramObj.getString("ownerTypeCd"))) {
             //ownerId 写为 memberId
             //ownerId 写为 memberId
             paramObj.put("ownerId", paramObj.getString("memberId"));
             paramObj.put("ownerId", paramObj.getString("memberId"));
+            RoomDto roomDto = new RoomDto();
+            roomDto.setOwnerId((String) paramObj.get("ownerId"));
+            List<RoomDto> roomDtoList = roomInnerServiceSMOImpl.queryRoomsByOwner(roomDto);
+            if(roomDtoList.size() > 0){
+                throw new IllegalArgumentException("删除失败,删除前请先解绑房屋信息");
+            }
             //小区楼添加到小区中
             //小区楼添加到小区中
             businesses.add(ownerBMOImpl.exitCommunityMember(paramObj));
             businesses.add(ownerBMOImpl.exitCommunityMember(paramObj));
         }
         }
-        RoomDto roomDto = new RoomDto();
-        roomDto.setOwnerId((String) paramObj.get("ownerId"));
-        List<RoomDto> roomDtoList = roomInnerServiceSMOImpl.queryRoomsByOwner(roomDto);
-        //判断改业主是否有房屋信息
-        if(roomDtoList.size() > 0){
-            //删除房屋关系
-            businesses.add(ownerBMOImpl.deleteOwnerRoomRel(paramObj));
-            //更新房屋信息为未出售
-            for(int i =0; i < roomDtoList.size(); i ++){
-                paramObj.put("state","2002");
-                paramObj.put("roomId",roomDtoList.get(i).getRoomId());
-                businesses.add(roomBMOImpl.updateShellRoom(paramObj, dataFlowContext));
-            }
-        }
         ResponseEntity<String> responseEntity = ownerBMOImpl.callService(dataFlowContext, service.getServiceCode(), businesses);
         ResponseEntity<String> responseEntity = ownerBMOImpl.callService(dataFlowContext, service.getServiceCode(), businesses);
 
 
         dataFlowContext.setResponseEntity(responseEntity);
         dataFlowContext.setResponseEntity(responseEntity);

+ 14 - 14
UserService/src/main/java/com/java110/user/listener/ownerRoomRel/AbstractOwnerRoomRelBusinessServiceDataFlowListener.java

@@ -57,25 +57,25 @@ public abstract class AbstractOwnerRoomRelBusinessServiceDataFlowListener extend
     protected void autoSaveDelBusinessOwnerRoomRel(Business business, JSONObject businessOwnerRoomRel) {
     protected void autoSaveDelBusinessOwnerRoomRel(Business business, JSONObject businessOwnerRoomRel) {
 //自动插入DEL
 //自动插入DEL
         Map info = new HashMap();
         Map info = new HashMap();
-        info.put("ownerId", businessOwnerRoomRel.getString("ownerId"));
+        info.put("relId", businessOwnerRoomRel.getString("relId"));
         info.put("statusCd", StatusConstant.STATUS_CD_VALID);
         info.put("statusCd", StatusConstant.STATUS_CD_VALID);
         List<Map> currentOwnerRoomRelInfos = getOwnerRoomRelServiceDaoImpl().getOwnerRoomRelInfo(info);
         List<Map> currentOwnerRoomRelInfos = getOwnerRoomRelServiceDaoImpl().getOwnerRoomRelInfo(info);
         if (currentOwnerRoomRelInfos == null || currentOwnerRoomRelInfos.size() != 1) {
         if (currentOwnerRoomRelInfos == null || currentOwnerRoomRelInfos.size() != 1) {
             throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR, "未找到需要修改数据信息,入参错误或数据有问题,请检查" + info);
             throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR, "未找到需要修改数据信息,入参错误或数据有问题,请检查" + info);
         }
         }
-        for ( int i = 0; i < currentOwnerRoomRelInfos.size(); i++){
-            Map currentOwnerRoomRelInfo = currentOwnerRoomRelInfos.get(0);
-            currentOwnerRoomRelInfo.put("bId", business.getbId());
-            currentOwnerRoomRelInfo.put("relId", currentOwnerRoomRelInfo.get("rel_id"));
-            currentOwnerRoomRelInfo.put("operate", currentOwnerRoomRelInfo.get("operate"));
-            currentOwnerRoomRelInfo.put("remark", currentOwnerRoomRelInfo.get("remark"));
-            currentOwnerRoomRelInfo.put("state", currentOwnerRoomRelInfo.get("state"));
-            currentOwnerRoomRelInfo.put("ownerId", currentOwnerRoomRelInfo.get("owner_id"));
-            currentOwnerRoomRelInfo.put("userId", currentOwnerRoomRelInfo.get("user_id"));
-            currentOwnerRoomRelInfo.put("roomId", currentOwnerRoomRelInfo.get("room_id"));
-            currentOwnerRoomRelInfo.put("operate", StatusConstant.OPERATE_DEL);
-            getOwnerRoomRelServiceDaoImpl().saveBusinessOwnerRoomRelInfo(currentOwnerRoomRelInfo);
-        }
+
+        Map currentOwnerRoomRelInfo = currentOwnerRoomRelInfos.get(0);
+        currentOwnerRoomRelInfo.put("bId", business.getbId());
+        currentOwnerRoomRelInfo.put("relId", currentOwnerRoomRelInfo.get("rel_id"));
+        currentOwnerRoomRelInfo.put("operate", currentOwnerRoomRelInfo.get("operate"));
+        currentOwnerRoomRelInfo.put("remark", currentOwnerRoomRelInfo.get("remark"));
+        currentOwnerRoomRelInfo.put("state", currentOwnerRoomRelInfo.get("state"));
+        currentOwnerRoomRelInfo.put("ownerId", currentOwnerRoomRelInfo.get("owner_id"));
+        currentOwnerRoomRelInfo.put("userId", currentOwnerRoomRelInfo.get("user_id"));
+        currentOwnerRoomRelInfo.put("roomId", currentOwnerRoomRelInfo.get("room_id"));
+        currentOwnerRoomRelInfo.put("operate", StatusConstant.OPERATE_DEL);
+        getOwnerRoomRelServiceDaoImpl().saveBusinessOwnerRoomRelInfo(currentOwnerRoomRelInfo);
+
     }
     }
 
 
 
 

+ 4 - 4
UserService/src/main/java/com/java110/user/listener/ownerRoomRel/DeleteOwnerRoomRelInfoListener.java

@@ -161,11 +161,11 @@ public class DeleteOwnerRoomRelInfoListener extends AbstractOwnerRoomRelBusiness
      */
      */
     private void doBusinessOwnerRoomRel(Business business, JSONObject businessOwnerRoomRel) {
     private void doBusinessOwnerRoomRel(Business business, JSONObject businessOwnerRoomRel) {
 
 
-        Assert.jsonObjectHaveKey(businessOwnerRoomRel, "ownerId", "businessOwnerRoomRel 节点下没有包含 ownerId 节点");
+        Assert.jsonObjectHaveKey(businessOwnerRoomRel, "relId", "businessOwnerRoomRel 节点下没有包含 relId 节点");
 
 
-//        if (businessOwnerRoomRel.getString("relId").startsWith("-")) {
-//            throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR, "relId 错误,不能自动生成(必须已经存在的relId)" + businessOwnerRoomRel);
-//        }
+        if (businessOwnerRoomRel.getString("relId").startsWith("-")) {
+            throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR, "relId 错误,不能自动生成(必须已经存在的relId)" + businessOwnerRoomRel);
+        }
         //自动插入DEL
         //自动插入DEL
         autoSaveDelBusinessOwnerRoomRel(business, businessOwnerRoomRel);
         autoSaveDelBusinessOwnerRoomRel(business, businessOwnerRoomRel);
     }
     }