Browse Source

Merge branch 'master' of https://github.com/java110/MicroCommunity

duckweed 6 years ago
parent
commit
8746dc8315

+ 1 - 0
Api/src/main/java/com/java110/api/ApiApplicationStart.java

@@ -87,6 +87,7 @@ public class ApiApplicationStart {
 
     /**
      * swagger 插件
+     *
      * @return Docket 对象
      */
     @Bean

+ 651 - 6
WebService/src/main/java/com/java110/web/smo/assetImport/impl/AssetImportSMOImpl.java

@@ -1,19 +1,39 @@
 package com.java110.web.smo.assetImport.impl;
 
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.java110.common.constant.FeeTypeConstant;
+import com.java110.common.constant.ResponseConstant;
+import com.java110.common.constant.ServiceConstant;
+import com.java110.common.exception.ListenerExecuteException;
+import com.java110.common.util.Assert;
+import com.java110.common.util.DateUtil;
 import com.java110.common.util.ImportExcelUtils;
+import com.java110.common.util.StringUtil;
 import com.java110.core.context.IPageData;
+import com.java110.dto.FeeConfigDto;
+import com.java110.dto.ParkingSpaceDto;
+import com.java110.entity.assetImport.ImportFloor;
+import com.java110.entity.assetImport.ImportOwner;
+import com.java110.entity.assetImport.ImportParkingSpace;
+import com.java110.entity.assetImport.ImportRoom;
+import com.java110.entity.component.ComponentValidateResult;
 import com.java110.web.core.BaseComponentSMO;
 import com.java110.web.smo.assetImport.IAssetImportSMO;
 import org.apache.poi.ss.usermodel.Sheet;
 import org.apache.poi.ss.usermodel.Workbook;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpMethod;
 import org.springframework.http.HttpStatus;
 import org.springframework.http.ResponseEntity;
 import org.springframework.stereotype.Service;
+import org.springframework.web.client.RestTemplate;
 import org.springframework.web.multipart.MultipartFile;
 
 import java.io.InputStream;
+import java.util.ArrayList;
 import java.util.List;
 
 /**
@@ -28,20 +48,645 @@ import java.util.List;
 public class AssetImportSMOImpl extends BaseComponentSMO implements IAssetImportSMO {
     private final static Logger logger = LoggerFactory.getLogger(AssetImportSMOImpl.class);
 
+    @Autowired
+    private RestTemplate restTemplate;
+
     @Override
-    public ResponseEntity<String> importExcelData(IPageData pd, MultipartFile uploadFile) throws Exception{
-        InputStream is = uploadFile.getInputStream();
+    public ResponseEntity<String> importExcelData(IPageData pd, MultipartFile uploadFile) throws Exception {
+
+        ComponentValidateResult result = this.validateStoreStaffCommunityRelationship(pd, restTemplate);
+
+        //InputStream is = uploadFile.getInputStream();
 
         Workbook workbook = null;  //工作簿
-        Sheet sheet = null;         //工作表
+        //工作表
         String[] headers = null;   //表头信息
-
+        List<ImportFloor> floors = new ArrayList<ImportFloor>();
+        List<ImportOwner> owners = new ArrayList<ImportOwner>();
+        List<ImportRoom> rooms = new ArrayList<ImportRoom>();
+        List<ImportParkingSpace> parkingSpaces = new ArrayList<ImportParkingSpace>();
         workbook = ImportExcelUtils.createWorkbook(uploadFile);
+        //获取楼信息
+        getFloors(workbook, floors);
+        //获取业主信息
+        getOwners(workbook, owners);
+
+        //获取房屋信息
+        getRooms(workbook, rooms, floors, owners);
+
+        //获取车位信息
+        getParkingSpaces(workbook, parkingSpaces, owners);
+
+        //数据校验
+        importExcelDataValidate(floors, owners, rooms, parkingSpaces);
+
+        // 保存数据
+        return dealExcelData(pd, floors, owners, rooms, parkingSpaces, result);
+    }
+
+    /**
+     * 处理ExcelData数据
+     *
+     * @param floors        楼栋单元信息
+     * @param owners        业主信息
+     * @param rooms         房屋信息
+     * @param parkingSpaces 车位信息
+     */
+    private ResponseEntity<String> dealExcelData(IPageData pd, List<ImportFloor> floors, List<ImportOwner> owners, List<ImportRoom> rooms, List<ImportParkingSpace> parkingSpaces, ComponentValidateResult result) {
+        ResponseEntity<String> responseEntity = null;
+        //保存单元信息 和 楼栋信息
+        responseEntity = savedFloorAndUnitInfo(pd, floors, result);
+
+        if (responseEntity == null || responseEntity.getStatusCode() != HttpStatus.OK) {
+            return responseEntity;
+        }
+
+        // 保存业主信息
+        responseEntity = savedOwnerInfo(pd, owners, result);
+        if (responseEntity == null || responseEntity.getStatusCode() != HttpStatus.OK) {
+            return responseEntity;
+        }
+
+        //保存房屋
+        responseEntity = savedRoomInfo(pd, rooms, result);
+        if (responseEntity == null || responseEntity.getStatusCode() != HttpStatus.OK) {
+            return responseEntity;
+        }
+
+        //保存车位
+        responseEntity = savedParkingSpaceInfo(pd, parkingSpaces, result);
+
+        if (responseEntity == null || responseEntity.getStatusCode() != HttpStatus.OK) {
+            return responseEntity;
+        }
+
+        return responseEntity;
+    }
+
+    /**
+     * 保存车位信息
+     *
+     * @param pd
+     * @param parkingSpaces
+     * @param result
+     * @return
+     */
+    private ResponseEntity<String> savedParkingSpaceInfo(IPageData pd, List<ImportParkingSpace> parkingSpaces, ComponentValidateResult result) {
+        String apiUrl = "";
+        JSONObject paramIn = null;
+        ResponseEntity<String> responseEntity = null;
+        ImportOwner owner = null;
+        for (ImportParkingSpace parkingSpace : parkingSpaces) {
+            JSONObject savedParkingSpaceInfo = getExistsParkSpace(pd, result, parkingSpace);
+            if (savedParkingSpaceInfo != null) {
+                continue;
+            }
+
+            paramIn = new JSONObject();
+
+            apiUrl = ServiceConstant.SERVICE_API_URL + "/api/parkingSpace.saveParkingSpace";
+
+            paramIn.put("communityId", result.getCommunityId());
+            paramIn.put("num", parkingSpace.getPsNum());
+            paramIn.put("area", parkingSpace.getArea());
+            paramIn.put("typeCd", parkingSpace.getTypeCd());
+
+            responseEntity = this.callCenterService(restTemplate, pd, paramIn.toJSONString(), apiUrl, HttpMethod.POST);
+            if (responseEntity.getStatusCode() != HttpStatus.OK) {
+                continue;
+            }
+
+            savedParkingSpaceInfo = getExistsParkSpace(pd, result, parkingSpace);
+            if (savedParkingSpaceInfo != null) {
+                continue;
+            }
+
+            //是否有业主信息
+            if (parkingSpace.getImportOwner() == null) {
+                continue;
+            }
+
+            paramIn.clear();
+
+            paramIn.put("communityId", result.getCommunityId());
+            paramIn.put("ownerId", parkingSpace.getImportOwner().getOwnerId());
+            paramIn.put("carNum", parkingSpace.getCarNum());
+            paramIn.put("carBrand", parkingSpace.getCarBrand());
+            paramIn.put("carType", parkingSpace.getCarType());
+            paramIn.put("carColor", parkingSpace.getCarColor());
+            paramIn.put("psId", savedParkingSpaceInfo.getString("psId"));
+            paramIn.put("storeId", result.getStoreId());
+            paramIn.put("sellOrHire", parkingSpace.getSellOrHire());
+
+            String feeTypeCd = "1001".equals(parkingSpace.getTypeCd())
+                    ? FeeTypeConstant.FEE_TYPE_SELL_UP_PARKING_SPACE : FeeTypeConstant.FEE_TYPE_SELL_DOWN_PARKING_SPACE;
+            apiUrl = ServiceConstant.SERVICE_API_URL + "/api/fee.queryFeeConfig?communityId=" + result.getCommunityId() + "&feeTypeCd=" + feeTypeCd;
+            responseEntity = this.callCenterService(restTemplate, pd, "", apiUrl, HttpMethod.GET);
+
+            if (responseEntity.getStatusCode() != HttpStatus.OK) {
+                continue;
+            }
+
+            JSONObject configInfo = JSONObject.parseObject(responseEntity.getBody());
+            if(!configInfo.containsKey("additionalAmount")){
+                continue;
+            }
+
+            paramIn.put("receivedAmount", configInfo.getString("additionalAmount"));
+
+            apiUrl = ServiceConstant.SERVICE_API_URL + "/api/parkingSpace.sellParkingSpace";
+            responseEntity = this.callCenterService(restTemplate, pd, paramIn.toJSONString(), apiUrl, HttpMethod.POST);
+        }
+
+        return responseEntity;
+    }
+
+
+    /**
+     * 保存房屋信息
+     *
+     * @param pd
+     * @param rooms
+     * @param result
+     * @return
+     */
+    private ResponseEntity<String> savedRoomInfo(IPageData pd, List<ImportRoom> rooms, ComponentValidateResult result) {
+        String apiUrl = "";
+        JSONObject paramIn = null;
+        ResponseEntity<String> responseEntity = null;
+        ImportOwner owner = null;
+        for (ImportRoom room : rooms) {
+            JSONObject savedRoomInfo = getExistsRoom(pd, result, room);
+            if (savedRoomInfo != null) {
+                continue;
+            }
+
+            paramIn = new JSONObject();
+
+
+            //保存 房屋
+
+            apiUrl = ServiceConstant.SERVICE_API_URL + "/api/room.saveRoom";
+
+            paramIn.put("communityId", result.getCommunityId());
+            paramIn.put("unitId", room.getFloor().getUnitId());
+            paramIn.put("roomNum", room.getRoomNum());
+            paramIn.put("layer", room.getLayer());
+            paramIn.put("section", room.getSection());
+            paramIn.put("apartment", "1");
+            paramIn.put("state", "1000");
+            paramIn.put("builtUpArea", room.getBuiltUpArea());
+            paramIn.put("unitPrice", "1000.00");
+
+            responseEntity = this.callCenterService(restTemplate, pd, paramIn.toJSONString(), apiUrl, HttpMethod.POST);
+            if (responseEntity.getStatusCode() != HttpStatus.OK) {
+                continue;
+            }
+
+            savedRoomInfo = getExistsRoom(pd, result, room);
+            if (savedRoomInfo == null) {
+                continue;
+            }
+
+            if (room.getImportOwner() == null) {
+                continue;
+            }
+            paramIn.clear();
+            apiUrl = ServiceConstant.SERVICE_API_URL + "/api/room.sellRoom";
+            paramIn.put("communityId", result.getCommunityId());
+            paramIn.put("ownerId", room.getImportOwner().getOwnerId());
+            paramIn.put("roomId", savedRoomInfo.getString("roomId"));
+            paramIn.put("state", "2002");
+            paramIn.put("storeId", result.getStoreId());
+            responseEntity = this.callCenterService(restTemplate, pd, paramIn.toJSONString(), apiUrl, HttpMethod.POST);
+
+        }
+
+        return responseEntity;
+    }
+
+    /**
+     * 查询存在的房屋信息
+     * room.queryRooms
+     *
+     * @param pd
+     * @param result
+     * @param parkingSpace
+     * @return
+     */
+    private JSONObject getExistsParkSpace(IPageData pd, ComponentValidateResult result, ImportParkingSpace parkingSpace) {
+        String apiUrl = "";
+        ResponseEntity<String> responseEntity = null;
+        apiUrl = ServiceConstant.SERVICE_API_URL + "/api/parkingSpace.queryParkingSpaces?page=1&row=1&communityId=" + result.getCommunityId()
+                + "&num=" + parkingSpace.getPsNum();
+        responseEntity = this.callCenterService(restTemplate, pd, "", apiUrl, HttpMethod.GET);
+
+        if (responseEntity.getStatusCode() != HttpStatus.OK) { //跳过 保存单元信息
+            return null;
+        }
+
+        JSONObject savedParkingSpaceInfoResults = JSONObject.parseObject(responseEntity.getBody());
+
+
+        if (!savedParkingSpaceInfoResults.containsKey("parkingSpaces") || savedParkingSpaceInfoResults.getJSONArray("parkingSpaces").size() != 1) {
+            return null;
+        }
+
+
+        JSONObject savedParkingSpaceInfo = savedParkingSpaceInfoResults.getJSONArray("parkingSpaces").getJSONObject(0);
+
+        return savedParkingSpaceInfo;
+    }
+
+
+    /**
+     * 查询存在的房屋信息
+     * room.queryRooms
+     *
+     * @param pd
+     * @param result
+     * @param room
+     * @return
+     */
+    private JSONObject getExistsRoom(IPageData pd, ComponentValidateResult result, ImportRoom room) {
+        String apiUrl = "";
+        ResponseEntity<String> responseEntity = null;
+        apiUrl = ServiceConstant.SERVICE_API_URL + "/api/room.queryRooms?communityId=" + result.getCommunityId()
+                + "&floorId=" + room.getFloor().getFloorId() + "&unitId=" + room.getFloor().getUnitId() + "&roomNum=" + room.getRoomNum();
+        responseEntity = this.callCenterService(restTemplate, pd, "", apiUrl, HttpMethod.GET);
+
+        if (responseEntity.getStatusCode() != HttpStatus.OK) { //跳过 保存单元信息
+            return null;
+        }
+
+        JSONObject savedRoomInfoResults = JSONObject.parseObject(responseEntity.getBody());
+
+
+        if (!savedRoomInfoResults.containsKey("rooms") || savedRoomInfoResults.getJSONArray("rooms").size() != 1) {
+            return null;
+        }
+
 
+        JSONObject savedRoomInfo = savedRoomInfoResults.getJSONArray("rooms").getJSONObject(0);
+
+        return savedRoomInfo;
+    }
+
+    /**
+     * 保存业主信息
+     *
+     * @param pd
+     * @param owners
+     * @param result
+     * @return
+     */
+    private ResponseEntity<String> savedOwnerInfo(IPageData pd, List<ImportOwner> owners, ComponentValidateResult result) {
+        String apiUrl = "";
+        JSONObject paramIn = null;
+        ResponseEntity<String> responseEntity = null;
+
+        for (ImportOwner owner : owners) {
+            JSONObject savedOwnerInfo = getExistsOwner(pd, result, owner);
+
+            if (savedOwnerInfo != null) {
+                continue;
+            }
+            paramIn = new JSONObject();
+
+            apiUrl = ServiceConstant.SERVICE_API_URL + "/api/owner.saveOwner";
+
+            paramIn.put("communityId", result.getCommunityId());
+            paramIn.put("userId", result.getUserId());
+            paramIn.put("name", owner.getOwnerName());
+            paramIn.put("age", owner.getAge());
+            paramIn.put("link", owner.getTel());
+            paramIn.put("sex", owner.getSex());
+            paramIn.put("ownerTypeCd", "1001");
+            responseEntity = this.callCenterService(restTemplate, pd, paramIn.toJSONString(), apiUrl, HttpMethod.POST);
+            if (responseEntity.getStatusCode() != HttpStatus.OK) {
+                savedOwnerInfo = getExistsOwner(pd, result, owner);
+                owner.setOwnerId(savedOwnerInfo.getString("ownerId"));
+            }
+        }
+
+        return responseEntity;
+    }
+
+    /**
+     * 保存 楼栋和 单元信息
+     *
+     * @param pd
+     * @param floors
+     * @param result
+     * @return
+     */
+    private ResponseEntity<String> savedFloorAndUnitInfo(IPageData pd, List<ImportFloor> floors, ComponentValidateResult result) {
+        String apiUrl = "";
+        JSONObject paramIn = null;
+        ResponseEntity<String> responseEntity = null;
+        for (ImportFloor importFloor : floors) {
+            paramIn = new JSONObject();
+            //先保存 楼栋信息
+            JSONObject savedFloorInfo = getExistsFloor(pd, result, importFloor);
+            // 如果不存在,才插入
+            if (savedFloorInfo == null) {
+                apiUrl = ServiceConstant.SERVICE_API_URL + "/api/floor.saveFloor";
+                paramIn.put("communityId", result.getCommunityId());
+                paramIn.put("floorNum", importFloor.getFloorNum());
+                paramIn.put("userId", result.getUserId());
+                paramIn.put("name", importFloor.getFloorNum() + "号楼");
+                responseEntity = this.callCenterService(restTemplate, pd, paramIn.toJSONString(), apiUrl, HttpMethod.POST);
+            }
+            if (responseEntity.getStatusCode() != HttpStatus.OK) { //跳过 保存单元信息
+                continue;
+            }
+
+            savedFloorInfo = getExistsFloor(pd, result, importFloor);
+
+            if (savedFloorInfo == null) {
+                continue;
+            }
+            importFloor.setFloorId(savedFloorInfo.getString("floorId"));
+            paramIn.clear();
+            //判断单元信息是否已经存在,如果存在则不保存数据unit.queryUnits
+            if (getExistsUnit(pd, result, importFloor) != null) {
+                continue;
+            }
+
+            apiUrl = ServiceConstant.SERVICE_API_URL + "/api/unit.saveUnit";
+
+            paramIn.put("communityId", result.getCommunityId());
+            paramIn.put("floorId", savedFloorInfo.getString("floorId"));
+            paramIn.put("unitNum", importFloor.getUnitNum());
+            paramIn.put("layerCount", importFloor.getLayerCount());
+            paramIn.put("lift", importFloor.getLift());
+            responseEntity = this.callCenterService(restTemplate, pd, paramIn.toJSONString(), apiUrl, HttpMethod.POST);
+
+            //将unitId 刷入ImportFloor对象
+            JSONObject savedUnitInfo = getExistsUnit(pd, result, importFloor);
+            importFloor.setUnitId(savedUnitInfo.getString("unitId"));
+
+        }
+        return responseEntity;
+    }
+
+    private JSONObject getExistsUnit(IPageData pd, ComponentValidateResult result, ImportFloor importFloor) {
+        String apiUrl = "";
+        ResponseEntity<String> responseEntity = null;
+        apiUrl = ServiceConstant.SERVICE_API_URL + "/api/unit.queryUnits?communityId=" + result.getCommunityId()
+                + "&floorId=" + importFloor.getFloorId() + "&unitNum=" + importFloor.getFloorNum();
+        responseEntity = this.callCenterService(restTemplate, pd, "", apiUrl, HttpMethod.GET);
+
+        if (responseEntity.getStatusCode() != HttpStatus.OK) { //跳过 保存单元信息
+            return null;
+        }
+
+        JSONArray savedFloorInfoResults = JSONArray.parseArray(responseEntity.getBody());
+
+        if (savedFloorInfoResults == null || savedFloorInfoResults.size() != 1) {
+            return null;
+        }
+
+        JSONObject savedUnitInfo = savedFloorInfoResults.getJSONObject(0);
+
+        return savedUnitInfo;
+    }
+
+    private JSONObject getExistsFloor(IPageData pd, ComponentValidateResult result, ImportFloor importFloor) {
+        String apiUrl = "";
+        ResponseEntity<String> responseEntity = null;
+        apiUrl = ServiceConstant.SERVICE_API_URL + "/api/floor.queryFloors?page=1&row=1&communityId=" + result.getCommunityId() + "&floorNum=" + importFloor.getFloorNum();
+        responseEntity = this.callCenterService(restTemplate, pd, "", apiUrl, HttpMethod.GET);
+
+        if (responseEntity.getStatusCode() != HttpStatus.OK) { //跳过 保存单元信息
+            return null;
+        }
+
+        JSONObject savedFloorInfoResult = JSONObject.parseObject(responseEntity.getBody());
+
+        if (!savedFloorInfoResult.containsKey("apiFloorDataVoList") || savedFloorInfoResult.getJSONArray("apiFloorDataVoList").size() != 1) {
+            return null;
+        }
+
+        JSONObject savedFloorInfo = savedFloorInfoResult.getJSONArray("apiFloorDataVoList").getJSONObject(0);
+
+        return savedFloorInfo;
+    }
+
+    /**
+     * 查询存在的业主
+     *
+     * @param pd
+     * @param result
+     * @param importOwner
+     * @return
+     */
+    private JSONObject getExistsOwner(IPageData pd, ComponentValidateResult result, ImportOwner importOwner) {
+        String apiUrl = "";
+        ResponseEntity<String> responseEntity = null;
+        apiUrl = ServiceConstant.SERVICE_API_URL + "/api/owner.queryOwners?page=1&row=1&communityId=" + result.getCommunityId()
+                + "&ownerTypeCd=1001&name=" + importOwner.getOwnerName() + "&link=" + importOwner.getTel();
+        responseEntity = this.callCenterService(restTemplate, pd, "", apiUrl, HttpMethod.GET);
+
+        if (responseEntity.getStatusCode() != HttpStatus.OK) { //跳过 保存单元信息
+            return null;
+        }
+
+        JSONObject savedOwnerInfoResult = JSONObject.parseObject(responseEntity.getBody());
+
+        if (!savedOwnerInfoResult.containsKey("owners") || savedOwnerInfoResult.getJSONArray("owners").size() != 1) {
+            return null;
+        }
+
+        JSONObject savedOwnerInfo = savedOwnerInfoResult.getJSONArray("owners").getJSONObject(0);
+
+        return savedOwnerInfo;
+    }
+
+    /**
+     * 数据校验处理
+     *
+     * @param floors
+     * @param owners
+     * @param rooms
+     * @param parkingSpaces
+     */
+    private void importExcelDataValidate(List<ImportFloor> floors, List<ImportOwner> owners, List<ImportRoom> rooms, List<ImportParkingSpace> parkingSpaces) {
+    }
+
+    /**
+     * 获取车位信息
+     *
+     * @param workbook
+     * @param parkingSpaces
+     */
+    private void getParkingSpaces(Workbook workbook, List<ImportParkingSpace> parkingSpaces, List<ImportOwner> owners) {
+        Sheet sheet = null;
+        sheet = ImportExcelUtils.getSheet(workbook, "车位信息");
+        List<Object[]> oList = ImportExcelUtils.listFromSheet(sheet);
+        ImportParkingSpace importParkingSpace = null;
+        for (int osIndex = 0; osIndex < oList.size(); osIndex++) {
+            Object[] os = oList.get(osIndex);
+            if (osIndex == 0) { // 第一行是 头部信息 直接跳过
+                continue;
+            }
+            if(StringUtil.isNullOrNone(os[0])){
+                continue;
+            }
+            importParkingSpace = new ImportParkingSpace();
+            importParkingSpace.setPsNum(os[0].toString());
+            importParkingSpace.setTypeCd(os[1].toString());
+            importParkingSpace.setArea(Double.parseDouble(os[2].toString()));
+            if(StringUtil.isNullOrNone(os[3])){
+                parkingSpaces.add(importParkingSpace);
+                continue;
+            }
+            ImportOwner importOwner = getImportOwner(owners, os[3].toString());
+            importParkingSpace.setImportOwner(importOwner);
+            if (importOwner != null) {
+                importParkingSpace.setCarNum(os[4].toString());
+                importParkingSpace.setCarBrand(os[5].toString());
+                importParkingSpace.setCarType(os[6].toString());
+                importParkingSpace.setCarColor(os[7].toString());
+                importParkingSpace.setSellOrHire(os[8].toString());
+            }
+
+            parkingSpaces.add(importParkingSpace);
+        }
+    }
+
+    /**
+     * 获取 房屋信息
+     *
+     * @param workbook
+     * @param rooms
+     */
+    private void getRooms(Workbook workbook, List<ImportRoom> rooms,
+                          List<ImportFloor> floors, List<ImportOwner> owners) {
+        Sheet sheet = null;
+        sheet = ImportExcelUtils.getSheet(workbook, "房屋信息");
+        List<Object[]> oList = ImportExcelUtils.listFromSheet(sheet);
+        ImportRoom importRoom = null;
+        for (int osIndex = 0; osIndex < oList.size(); osIndex++) {
+            Object[] os = oList.get(osIndex);
+            if (osIndex == 0) { // 第一行是 头部信息 直接跳过
+                continue;
+            }
+            if(StringUtil.isNullOrNone(os[0])){
+                continue;
+            }
+            importRoom = new ImportRoom();
+            importRoom.setRoomNum(os[0].toString());
+            importRoom.setFloor(getImportFloor(floors, os[1].toString(), os[2].toString()));
+            importRoom.setLayer(Integer.parseInt(os[3].toString()));
+            importRoom.setSection(os[4].toString());
+            importRoom.setBuiltUpArea(Double.parseDouble(os[5].toString()));
+            if(StringUtil.isNullOrNone(os[6])){
+                rooms.add(importRoom);
+                continue;
+            }
+            importRoom.setImportOwner(getImportOwner(owners, os[6].toString()));
+            rooms.add(importRoom);
+        }
+    }
+
+    /**
+     * 从导入的业主信息中获取业主,如果没有返回 null
+     *
+     * @param owners
+     * @param ownerNum
+     * @return
+     */
+    private ImportOwner getImportOwner(List<ImportOwner> owners, String ownerNum) {
+        for (ImportOwner importOwner : owners) {
+            if (ownerNum.equals(importOwner.getOwnerNum())) {
+                return importOwner;
+            }
+        }
+
+        return null;
+
+    }
+
+    /**
+     * get 导入楼栋信息
+     *
+     * @param floors
+     */
+    private ImportFloor getImportFloor(List<ImportFloor> floors, String floorNum, String unitNum) {
+        for (ImportFloor importFloor : floors) {
+            if (floorNum.equals(importFloor.getFloorNum())
+                    && unitNum.equals(importFloor.getUnitNum())) {
+                return importFloor;
+            }
+        }
+
+        throw new IllegalArgumentException("在楼栋单元sheet中未找到楼栋编号[" + floorNum + "],单元编号[" + unitNum + "]数据");
+    }
+
+    /**
+     * 获取业主信息
+     *
+     * @param workbook
+     * @param owners
+     */
+    private void getOwners(Workbook workbook, List<ImportOwner> owners) {
+        Sheet sheet = null;
+        sheet = ImportExcelUtils.getSheet(workbook, "业主信息");
+        List<Object[]> oList = ImportExcelUtils.listFromSheet(sheet);
+        ImportOwner importOwner = null;
+        for (int osIndex = 0; osIndex < oList.size(); osIndex++) {
+            Object[] os = oList.get(osIndex);
+            if (osIndex == 0) { // 第一行是 头部信息 直接跳过
+                continue;
+            }
+            if(StringUtil.isNullOrNone(os[0])){
+                continue;
+            }
+            importOwner = new ImportOwner();
+            importOwner.setOwnerNum(os[0].toString());
+            importOwner.setOwnerName(os[1].toString());
+            importOwner.setSex("男".equals(os[2].toString()) ? "0" : "1");
+            importOwner.setAge(Integer.parseInt(os[3].toString()));
+            importOwner.setTel(os[4].toString());
+            owners.add(importOwner);
+        }
+    }
+
+    /**
+     * 获取小区
+     *
+     * @param workbook
+     * @param floors
+     */
+    private void getFloors(Workbook workbook, List<ImportFloor> floors) {
+        Sheet sheet = null;
         sheet = ImportExcelUtils.getSheet(workbook, "楼栋单元");
         List<Object[]> oList = ImportExcelUtils.listFromSheet(sheet);
+        ImportFloor importFloor = null;
+        for (int osIndex = 0; osIndex < oList.size(); osIndex++) {
+            Object[] os = oList.get(osIndex);
+            if (osIndex == 0) { // 第一行是 头部信息 直接跳过
+                continue;
+            }
+
+            if(StringUtil.isNullOrNone(os[0])){
+                continue;
+            }
+            importFloor = new ImportFloor();
+            importFloor.setFloorNum(os[0].toString());
+            importFloor.setUnitNum(os[1].toString());
+            importFloor.setLayerCount(os[2].toString());
+            importFloor.setLift("有".equals(os[3].toString()) ? "Y" : "N");
+            floors.add(importFloor);
+        }
+    }
+
+    public RestTemplate getRestTemplate() {
+        return restTemplate;
+    }
 
-        logger.debug("请求参数为:%s", pd.getReqData());
-        return new ResponseEntity<String>("成功", HttpStatus.OK);
+    public void setRestTemplate(RestTemplate restTemplate) {
+        this.restTemplate = restTemplate;
     }
 }

BIN
WebService/src/main/resources/static/import/hc.xlsx


+ 68 - 0
java110-bean/src/main/java/com/java110/entity/assetImport/ImportFloor.java

@@ -0,0 +1,68 @@
+package com.java110.entity.assetImport;
+
+/**
+ * 小区楼对象
+ */
+public class ImportFloor {
+
+    private String floorId;
+
+    private String floorNum;
+
+    private String unitId;
+
+    private String unitNum;
+
+    private String layerCount;
+
+    private String lift;
+
+
+    public String getFloorNum() {
+        return floorNum;
+    }
+
+    public void setFloorNum(String floorNum) {
+        this.floorNum = floorNum;
+    }
+
+    public String getUnitNum() {
+        return unitNum;
+    }
+
+    public void setUnitNum(String unitNum) {
+        this.unitNum = unitNum;
+    }
+
+    public String getLayerCount() {
+        return layerCount;
+    }
+
+    public void setLayerCount(String layerCount) {
+        this.layerCount = layerCount;
+    }
+
+    public String getLift() {
+        return lift;
+    }
+
+    public void setLift(String lift) {
+        this.lift = lift;
+    }
+
+    public String getFloorId() {
+        return floorId;
+    }
+
+    public void setFloorId(String floorId) {
+        this.floorId = floorId;
+    }
+
+    public String getUnitId() {
+        return unitId;
+    }
+
+    public void setUnitId(String unitId) {
+        this.unitId = unitId;
+    }
+}

+ 70 - 0
java110-bean/src/main/java/com/java110/entity/assetImport/ImportOwner.java

@@ -0,0 +1,70 @@
+package com.java110.entity.assetImport;
+
+
+/**
+ * 业主导入 实体
+ *
+ * add by wuxw 2019-09-24
+ */
+public class ImportOwner {
+
+    private String ownerId;
+
+    private String ownerNum;
+
+    private String ownerName;
+
+    private String sex;
+
+    private int age;
+
+    private String tel;
+
+    public String getOwnerNum() {
+        return ownerNum;
+    }
+
+    public void setOwnerNum(String ownerNum) {
+        this.ownerNum = ownerNum;
+    }
+
+    public String getOwnerName() {
+        return ownerName;
+    }
+
+    public void setOwnerName(String ownerName) {
+        this.ownerName = ownerName;
+    }
+
+    public String getSex() {
+        return sex;
+    }
+
+    public void setSex(String sex) {
+        this.sex = sex;
+    }
+
+    public int getAge() {
+        return age;
+    }
+
+    public void setAge(int age) {
+        this.age = age;
+    }
+
+    public String getTel() {
+        return tel;
+    }
+
+    public void setTel(String tel) {
+        this.tel = tel;
+    }
+
+    public String getOwnerId() {
+        return ownerId;
+    }
+
+    public void setOwnerId(String ownerId) {
+        this.ownerId = ownerId;
+    }
+}

+ 100 - 0
java110-bean/src/main/java/com/java110/entity/assetImport/ImportParkingSpace.java

@@ -0,0 +1,100 @@
+package com.java110.entity.assetImport;
+
+/**
+ * 车位导入
+ *
+ * add by wuxw 2019-09-24
+ */
+public class ImportParkingSpace {
+
+    private String psNum;
+
+    private String typeCd;
+
+    private double area;
+
+    private ImportOwner importOwner;
+
+    private String carNum;
+
+    private String carBrand;
+
+    private String carType;
+
+    private String carColor;
+
+    private String sellOrHire;
+
+
+    public String getPsNum() {
+        return psNum;
+    }
+
+    public void setPsNum(String psNum) {
+        this.psNum = psNum;
+    }
+
+    public String getTypeCd() {
+        return typeCd;
+    }
+
+    public void setTypeCd(String typeCd) {
+        this.typeCd = typeCd;
+    }
+
+    public double getArea() {
+        return area;
+    }
+
+    public void setArea(double area) {
+        this.area = area;
+    }
+
+    public ImportOwner getImportOwner() {
+        return importOwner;
+    }
+
+    public void setImportOwner(ImportOwner importOwner) {
+        this.importOwner = importOwner;
+    }
+
+    public String getCarNum() {
+        return carNum;
+    }
+
+    public void setCarNum(String carNum) {
+        this.carNum = carNum;
+    }
+
+    public String getCarBrand() {
+        return carBrand;
+    }
+
+    public void setCarBrand(String carBrand) {
+        this.carBrand = carBrand;
+    }
+
+    public String getCarType() {
+        return carType;
+    }
+
+    public void setCarType(String carType) {
+        this.carType = carType;
+    }
+
+    public String getCarColor() {
+        return carColor;
+    }
+
+    public void setCarColor(String carColor) {
+        this.carColor = carColor;
+    }
+
+    public String getSellOrHire() {
+        return sellOrHire;
+    }
+
+    public void setSellOrHire(String sellOrHire) {
+        this.sellOrHire = sellOrHire;
+    }
+}

+ 67 - 0
java110-bean/src/main/java/com/java110/entity/assetImport/ImportRoom.java

@@ -0,0 +1,67 @@
+package com.java110.entity.assetImport;
+
+/**
+ * 房屋导入对象
+ */
+public class ImportRoom {
+
+    private ImportFloor floor;
+
+    private String roomNum;
+
+    private int layer;
+
+    private String section;
+
+    private double builtUpArea;
+
+    private ImportOwner importOwner;
+
+    public ImportFloor getFloor() {
+        return floor;
+    }
+
+    public void setFloor(ImportFloor floor) {
+        this.floor = floor;
+    }
+
+    public String getRoomNum() {
+        return roomNum;
+    }
+
+    public void setRoomNum(String roomNum) {
+        this.roomNum = roomNum;
+    }
+
+    public int getLayer() {
+        return layer;
+    }
+
+    public void setLayer(int layer) {
+        this.layer = layer;
+    }
+
+    public String getSection() {
+        return section;
+    }
+
+    public void setSection(String section) {
+        this.section = section;
+    }
+
+    public double getBuiltUpArea() {
+        return builtUpArea;
+    }
+
+    public void setBuiltUpArea(double builtUpArea) {
+        this.builtUpArea = builtUpArea;
+    }
+
+    public ImportOwner getImportOwner() {
+        return importOwner;
+    }
+
+    public void setImportOwner(ImportOwner importOwner) {
+        this.importOwner = importOwner;
+    }
+}

+ 201 - 203
java110-db/src/main/resources/mapper/parkingSpace/ParkingSpaceServiceDaoImplMapper.xml

@@ -5,232 +5,230 @@
 <mapper namespace="parkingSpaceServiceDaoImpl">
 
     <!-- 保存停车位信息 add by wuxw 2018-07-03 -->
-       <insert id="saveBusinessParkingSpaceInfo" parameterType="Map">
-           insert into business_parking_space(
-area,operate,type_cd,num,ps_id,remark,state,community_id,b_id,user_id
-) values (
-#{area},#{operate},#{typeCd},#{num},#{psId},#{remark},#{state},#{communityId},#{bId},#{userId}
-)
-       </insert>
-
-
-       <!-- 查询停车位信息(Business) add by wuxw 2018-07-03 -->
-       <select id="getBusinessParkingSpaceInfo" parameterType="Map" resultType="Map">
-           select  t.area,t.operate,t.type_cd,t.type_cd typeCd,t.num,t.ps_id,t.ps_id psId,t.remark,t.state,t.community_id,t.community_id communityId,t.b_id,t.b_id bId,t.user_id,t.user_id userId 
-from business_parking_space t 
-where 1 =1 
-<if test="area !=null and area != ''">
-   and t.area= #{area}
-</if> 
-<if test="operate !=null and operate != ''">
-   and t.operate= #{operate}
-</if> 
-<if test="typeCd !=null and typeCd != ''">
-   and t.type_cd= #{typeCd}
-</if> 
-<if test="num !=null and num != ''">
-   and t.num= #{num}
-</if> 
-<if test="psId !=null and psId != ''">
-   and t.ps_id= #{psId}
-</if> 
-<if test="remark !=null and remark != ''">
-   and t.remark= #{remark}
-</if> 
-<if test="state !=null and state != ''">
-   and t.state= #{state}
-</if>
-
-<if test="communityId !=null and communityId != ''">
-   and t.community_id= #{communityId}
-</if> 
-<if test="bId !=null and bId != ''">
-   and t.b_id= #{bId}
-</if> 
-<if test="userId !=null and userId != ''">
-   and t.user_id= #{userId}
-</if> 
-
-       </select>
+    <insert id="saveBusinessParkingSpaceInfo" parameterType="Map">
+        insert into business_parking_space(
+        area,operate,type_cd,num,ps_id,remark,state,community_id,b_id,user_id
+        ) values (
+        #{area},#{operate},#{typeCd},#{num},#{psId},#{remark},#{state},#{communityId},#{bId},#{userId}
+        )
+    </insert>
 
 
+    <!-- 查询停车位信息(Business) add by wuxw 2018-07-03 -->
+    <select id="getBusinessParkingSpaceInfo" parameterType="Map" resultType="Map">
+        select t.area,t.operate,t.type_cd,t.type_cd typeCd,t.num,t.ps_id,t.ps_id
+        psId,t.remark,t.state,t.community_id,t.community_id communityId,t.b_id,t.b_id bId,t.user_id,t.user_id userId
+        from business_parking_space t
+        where 1 =1
+        <if test="area !=null and area != ''">
+            and t.area= #{area}
+        </if>
+        <if test="operate !=null and operate != ''">
+            and t.operate= #{operate}
+        </if>
+        <if test="typeCd !=null and typeCd != ''">
+            and t.type_cd= #{typeCd}
+        </if>
+        <if test="num !=null and num != ''">
+            and t.num= #{num}
+        </if>
+        <if test="psId !=null and psId != ''">
+            and t.ps_id= #{psId}
+        </if>
+        <if test="remark !=null and remark != ''">
+            and t.remark= #{remark}
+        </if>
+        <if test="state !=null and state != ''">
+            and t.state= #{state}
+        </if>
+
+        <if test="communityId !=null and communityId != ''">
+            and t.community_id= #{communityId}
+        </if>
+        <if test="bId !=null and bId != ''">
+            and t.b_id= #{bId}
+        </if>
+        <if test="userId !=null and userId != ''">
+            and t.user_id= #{userId}
+        </if>
 
+    </select>
 
 
     <!-- 保存停车位信息至 instance表中 add by wuxw 2018-07-03 -->
     <insert id="saveParkingSpaceInfoInstance" parameterType="Map">
         insert into p_parking_space(
-area,type_cd,num,ps_id,remark,status_cd,state,community_id,b_id,user_id
-) select t.area,t.type_cd,t.num,t.ps_id,t.remark,'0',t.state,t.community_id,t.b_id,t.user_id from business_parking_space t where 1=1
-<if test="area !=null and area != ''">
-   and t.area= #{area}
-</if> 
-   and t.operate= 'ADD'
-<if test="typeCd !=null and typeCd != ''">
-   and t.type_cd= #{typeCd}
-</if> 
-<if test="num !=null and num != ''">
-   and t.num= #{num}
-</if> 
-<if test="psId !=null and psId != ''">
-   and t.ps_id= #{psId}
-</if> 
-<if test="remark !=null and remark != ''">
-   and t.remark= #{remark}
-</if> 
-<if test="state !=null and state != ''">
-   and t.state= #{state}
-</if> 
-<if test="communityId !=null and communityId != ''">
-   and t.community_id= #{communityId}
-</if> 
-<if test="bId !=null and bId != ''">
-   and t.b_id= #{bId}
-</if> 
-<if test="userId !=null and userId != ''">
-   and t.user_id= #{userId}
-</if> 
+        area,type_cd,num,ps_id,remark,status_cd,state,community_id,b_id,user_id
+        ) select t.area,t.type_cd,t.num,t.ps_id,t.remark,'0',t.state,t.community_id,t.b_id,t.user_id from
+        business_parking_space t where 1=1
+        <if test="area !=null and area != ''">
+            and t.area= #{area}
+        </if>
+        and t.operate= 'ADD'
+        <if test="typeCd !=null and typeCd != ''">
+            and t.type_cd= #{typeCd}
+        </if>
+        <if test="num !=null and num != ''">
+            and t.num= #{num}
+        </if>
+        <if test="psId !=null and psId != ''">
+            and t.ps_id= #{psId}
+        </if>
+        <if test="remark !=null and remark != ''">
+            and t.remark= #{remark}
+        </if>
+        <if test="state !=null and state != ''">
+            and t.state= #{state}
+        </if>
+        <if test="communityId !=null and communityId != ''">
+            and t.community_id= #{communityId}
+        </if>
+        <if test="bId !=null and bId != ''">
+            and t.b_id= #{bId}
+        </if>
+        <if test="userId !=null and userId != ''">
+            and t.user_id= #{userId}
+        </if>
 
     </insert>
 
 
-
     <!-- 查询停车位信息 add by wuxw 2018-07-03 -->
     <select id="getParkingSpaceInfo" parameterType="Map" resultType="Map">
-        select  t.area,t.type_cd,t.type_cd typeCd,t.num,t.ps_id,t.ps_id psId,t.remark,t.status_cd,t.status_cd statusCd,t.state,t.community_id,t.community_id communityId,t.b_id,t.b_id bId,t.user_id,t.user_id userId 
-from p_parking_space t 
-where 1 =1 
-<if test="area !=null and area != ''">
-   and t.area= #{area}
-</if> 
-<if test="typeCd !=null and typeCd != ''">
-   and t.type_cd= #{typeCd}
-</if> 
-<if test="num !=null and num != ''">
-   and t.num= #{num}
-</if> 
-<if test="psId !=null and psId != ''">
-   and t.ps_id= #{psId}
-</if> 
-<if test="remark !=null and remark != ''">
-   and t.remark= #{remark}
-</if> 
-<if test="statusCd !=null and statusCd != ''">
-   and t.status_cd= #{statusCd}
-</if> 
-<if test="state !=null and state != ''">
-   and t.state= #{state}
-</if>
-<if test="states != null and states != null">
-    and t.state in
-    <foreach collection="states" item="item" open="(" close=")" separator=",">
-        #{item}
-    </foreach>
-</if>
-<if test="psIds != null and psIds != null">
-    and t.ps_id in
-    <foreach collection="psIds" item="item" open="(" close=")" separator=",">
-        #{item}
-    </foreach>
-</if>
-<if test="communityId !=null and communityId != ''">
-   and t.community_id= #{communityId}
-</if> 
-<if test="bId !=null and bId != ''">
-   and t.b_id= #{bId}
-</if> 
-<if test="userId !=null and userId != ''">
-   and t.user_id= #{userId}
-</if>
-
-<if test="page != -1 and page != null ">
-   limit #{page}, #{row}
-</if> 
+        select t.area,t.type_cd,t.type_cd typeCd,t.num,t.ps_id,t.ps_id psId,t.remark,t.status_cd,t.status_cd
+        statusCd,t.state,t.community_id,t.community_id communityId,t.b_id,t.b_id bId,t.user_id,t.user_id userId
+        from p_parking_space t
+        where 1 =1
+        <if test="area !=null and area != ''">
+            and t.area= #{area}
+        </if>
+        <if test="typeCd !=null and typeCd != ''">
+            and t.type_cd= #{typeCd}
+        </if>
+        <if test="num !=null and num != ''">
+            and t.num= #{num}
+        </if>
+        <if test="psId !=null and psId != ''">
+            and t.ps_id= #{psId}
+        </if>
+        <if test="remark !=null and remark != ''">
+            and t.remark= #{remark}
+        </if>
+        <if test="statusCd !=null and statusCd != ''">
+            and t.status_cd= #{statusCd}
+        </if>
+        <if test="state !=null and state != ''">
+            and t.state= #{state}
+        </if>
+        <if test="states != null and states != null">
+            and t.state in
+            <foreach collection="states" item="item" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
+        <if test="psIds != null and psIds != null">
+            and t.ps_id in
+            <foreach collection="psIds" item="item" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
+        <if test="communityId !=null and communityId != ''">
+            and t.community_id= #{communityId}
+        </if>
+        <if test="bId !=null and bId != ''">
+            and t.b_id= #{bId}
+        </if>
+        <if test="userId !=null and userId != ''">
+            and t.user_id= #{userId}
+        </if>
+
+        <if test="page != -1 and page != null ">
+            limit #{page}, #{row}
+        </if>
 
     </select>
 
 
-
-
     <!-- 修改停车位信息 add by wuxw 2018-07-03 -->
     <update id="updateParkingSpaceInfoInstance" parameterType="Map">
-        update  p_parking_space t set t.status_cd = #{statusCd}
-<if test="newBId != null and newBId != ''">
-,t.b_id = #{newBId}
-</if> 
-<if test="area !=null and area != ''">
-, t.area= #{area}
-</if> 
-<if test="typeCd !=null and typeCd != ''">
-, t.type_cd= #{typeCd}
-</if> 
-<if test="num !=null and num != ''">
-, t.num= #{num}
-</if> 
-<if test="remark !=null and remark != ''">
-, t.remark= #{remark}
-</if> 
-<if test="state !=null and state != ''">
-, t.state= #{state}
-</if> 
-<if test="communityId !=null and communityId != ''">
-, t.community_id= #{communityId}
-</if> 
-<if test="userId !=null and userId != ''">
-, t.user_id= #{userId}
-</if> 
- where 1=1 <if test="psId !=null and psId != ''">
-and t.ps_id= #{psId}
-</if> 
-<if test="bId !=null and bId != ''">
-and t.b_id= #{bId}
-</if> 
+        update p_parking_space t set t.status_cd = #{statusCd}
+        <if test="newBId != null and newBId != ''">
+            ,t.b_id = #{newBId}
+        </if>
+        <if test="area !=null and area != ''">
+            , t.area= #{area}
+        </if>
+        <if test="typeCd !=null and typeCd != ''">
+            , t.type_cd= #{typeCd}
+        </if>
+        <if test="num !=null and num != ''">
+            , t.num= #{num}
+        </if>
+        <if test="remark !=null and remark != ''">
+            , t.remark= #{remark}
+        </if>
+        <if test="state !=null and state != ''">
+            , t.state= #{state}
+        </if>
+        <if test="communityId !=null and communityId != ''">
+            , t.community_id= #{communityId}
+        </if>
+        <if test="userId !=null and userId != ''">
+            , t.user_id= #{userId}
+        </if>
+        where 1=1
+        <if test="psId !=null and psId != ''">
+            and t.ps_id= #{psId}
+        </if>
+        <if test="bId !=null and bId != ''">
+            and t.b_id= #{bId}
+        </if>
 
     </update>
 
     <!-- 查询停车位数量 add by wuxw 2018-07-03 -->
-     <select id="queryParkingSpacesCount" parameterType="Map" resultType="Map">
-        select  count(1) count 
-from p_parking_space t 
-where 1 =1 
-<if test="area !=null and area != ''">
-   and t.area= #{area}
-</if> 
-<if test="typeCd !=null and typeCd != ''">
-   and t.type_cd= #{typeCd}
-</if> 
-<if test="num !=null and num != ''">
-   and t.num= #{num}
-</if> 
-<if test="psId !=null and psId != ''">
-   and t.ps_id= #{psId}
-</if> 
-<if test="remark !=null and remark != ''">
-   and t.remark= #{remark}
-</if> 
-<if test="statusCd !=null and statusCd != ''">
-   and t.status_cd= #{statusCd}
-</if> 
-<if test="state !=null and state != ''">
-   and t.state= #{state}
-</if>
- <if test="states != null and states != null">
-     and t.state in
-     <foreach collection="states" item="item" open="(" close=")" separator=",">
-         #{item}
-     </foreach>
- </if>
-<if test="communityId !=null and communityId != ''">
-   and t.community_id= #{communityId}
-</if> 
-<if test="bId !=null and bId != ''">
-   and t.b_id= #{bId}
-</if> 
-<if test="userId !=null and userId != ''">
-   and t.user_id= #{userId}
-</if> 
-
-
-     </select>
+    <select id="queryParkingSpacesCount" parameterType="Map" resultType="Map">
+        select count(1) count
+        from p_parking_space t
+        where 1 =1
+        <if test="area !=null and area != ''">
+            and t.area= #{area}
+        </if>
+        <if test="typeCd !=null and typeCd != ''">
+            and t.type_cd= #{typeCd}
+        </if>
+        <if test="num !=null and num != ''">
+            and t.num= #{num}
+        </if>
+        <if test="psId !=null and psId != ''">
+            and t.ps_id= #{psId}
+        </if>
+        <if test="remark !=null and remark != ''">
+            and t.remark= #{remark}
+        </if>
+        <if test="statusCd !=null and statusCd != ''">
+            and t.status_cd= #{statusCd}
+        </if>
+        <if test="state !=null and state != ''">
+            and t.state= #{state}
+        </if>
+        <if test="states != null and states != null">
+            and t.state in
+            <foreach collection="states" item="item" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
+        <if test="communityId !=null and communityId != ''">
+            and t.community_id= #{communityId}
+        </if>
+        <if test="bId !=null and bId != ''">
+            and t.b_id= #{bId}
+        </if>
+        <if test="userId !=null and userId != ''">
+            and t.user_id= #{userId}
+        </if>
+
+
+    </select>
 
 </mapper>