| | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.core.annotation.Java110Cmd; |
| | | import com.java110.core.context.ICmdDataFlowContext; |
| | | import com.java110.core.event.cmd.AbstractServiceCmdListener; |
| | | import com.java110.core.event.cmd.Cmd; |
| | | import com.java110.core.event.cmd.CmdEvent; |
| | | import com.java110.dto.FloorDto; |
| | | import com.java110.dto.RoomDto; |
| | | import com.java110.dto.UnitDto; |
| | | import com.java110.dto.basePrivilege.BasePrivilegeDto; |
| | | import com.java110.dto.owner.OwnerDto; |
| | | import com.java110.dto.owner.OwnerRoomRelDto; |
| | | import com.java110.intf.community.IFloorInnerServiceSMO; |
| | | import com.java110.intf.community.IMenuInnerServiceSMO; |
| | | import com.java110.intf.community.IRoomInnerServiceSMO; |
| | |
| | | import com.java110.utils.exception.SMOException; |
| | | import com.java110.utils.util.Assert; |
| | | import com.java110.utils.util.BeanConvertUtil; |
| | | import com.java110.utils.util.DateUtil; |
| | | import com.java110.utils.util.StringUtil; |
| | | import com.java110.vo.api.ApiRoomDataVo; |
| | | import com.java110.vo.api.ApiRoomVo; |
| | | import com.java110.vo.api.ApiUnitVo; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.HttpStatus; |
| | | import org.springframework.http.ResponseEntity; |
| | |
| | | import java.util.Map; |
| | | |
| | | @Java110Cmd(serviceCode = "room.queryRooms") |
| | | public class QueryRoomsCmd extends AbstractServiceCmdListener { |
| | | public class QueryRoomsCmd extends Cmd { |
| | | @Autowired |
| | | private IUnitInnerServiceSMO unitInnerServiceSMOImpl; |
| | | |
| | |
| | | public void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException { |
| | | RoomDto roomDto = BeanConvertUtil.covertBean(reqJson, RoomDto.class); |
| | | |
| | | //导致业务受理搜索查询 |
| | | // if (reqJson.containsKey("flag") && reqJson.getString("flag").equals("1")) { |
| | | // if (reqJson.containsKey("roomNumLike") && !StringUtil.isEmpty(reqJson.getString("roomNumLike"))) { |
| | | // String[] roomNumLikes = reqJson.getString("roomNumLike").split("-"); |
| | | // roomDto.setFloorNum(roomNumLikes[0]); |
| | | // roomDto.setUnitNum(roomNumLikes[1]); |
| | | // roomDto.setRoomNum(roomNumLikes[2]); |
| | | // roomDto.setRoomNumLike(""); |
| | | // } |
| | | // } |
| | | ApiRoomVo apiRoomVo = new ApiRoomVo(); |
| | | //查询总记录数 |
| | | int total = roomInnerServiceSMOImpl.queryRoomsCount(BeanConvertUtil.covertBean(reqJson, RoomDto.class)); |
| | | int total = roomInnerServiceSMOImpl.queryRoomsCount(roomDto); |
| | | apiRoomVo.setTotal(total); |
| | | List<RoomDto> roomDtoList = null; |
| | | if (total > 0) { |
| | | roomDtoList = roomInnerServiceSMOImpl.queryRooms(roomDto); |
| | | refreshRoomOwners(reqJson.getString("userId"), reqJson.getString("communityId"), roomDtoList); |
| | | refreshRoomOwners(reqJson.getString("loginUserId"), reqJson.getString("communityId"), roomDtoList); |
| | | } else { |
| | | roomDtoList = new ArrayList<>(); |
| | | } |
| | |
| | | * @param roomDtos |
| | | */ |
| | | private void refreshRoomOwners(String userId, String communityId, List<RoomDto> roomDtos) { |
| | | |
| | | /** |
| | | * 量太大时 查询 会比较慢,如果其他地方有bug 切换 查询报表去,不能靠这个接口查询大量数据 |
| | | */ |
| | | if (roomDtos == null || roomDtos.size() > 20) { |
| | | return; |
| | | } |
| | | List<String> roomIds = new ArrayList<>(); |
| | | for (RoomDto roomDto : roomDtos) { |
| | | roomIds.add(roomDto.getRoomId()); |
| | |
| | | List<OwnerDto> ownerDtos = ownerInnerServiceSMOImpl.queryOwnersByRoom(ownerDto); |
| | | for (RoomDto roomDto : roomDtos) { |
| | | for (OwnerDto tmpOwnerDto : ownerDtos) { |
| | | if (roomDto.getRoomId().equals(tmpOwnerDto.getRoomId())) { |
| | | roomDto.setOwnerId(tmpOwnerDto.getOwnerId()); |
| | | roomDto.setOwnerName(tmpOwnerDto.getName()); |
| | | //对业主身份证号隐藏处理 |
| | | String idCard = tmpOwnerDto.getIdCard(); |
| | | if (mark.size() == 0 && idCard != null && !idCard.equals("") && idCard.length() > 15) { |
| | | idCard = idCard.substring(0, 6) + "**********" + idCard.substring(16); |
| | | } |
| | | //对业主手机号隐藏处理 |
| | | String link = tmpOwnerDto.getLink(); |
| | | if (mark.size() == 0 && link != null && !link.equals("") && link.length() > 10) { |
| | | link = link.substring(0, 3) + "****" + link.substring(7); |
| | | } |
| | | roomDto.setIdCard(idCard); |
| | | roomDto.setLink(link); |
| | | if (!roomDto.getRoomId().equals(tmpOwnerDto.getRoomId())) { |
| | | continue; |
| | | } |
| | | try { |
| | | roomDto.setStartTime(DateUtil.getDateFromString(tmpOwnerDto.getStartTime(), DateUtil.DATE_FORMATE_STRING_A)); |
| | | roomDto.setEndTime(DateUtil.getDateFromString(tmpOwnerDto.getEndTime(), DateUtil.DATE_FORMATE_STRING_A)); |
| | | } catch (Exception e) { |
| | | // |
| | | } |
| | | roomDto.setOwnerId(tmpOwnerDto.getOwnerId()); |
| | | roomDto.setOwnerName(tmpOwnerDto.getName()); |
| | | //对业主身份证号隐藏处理 |
| | | String idCard = tmpOwnerDto.getIdCard(); |
| | | if (mark.size() == 0 && idCard != null && !idCard.equals("") && idCard.length() > 15) { |
| | | idCard = idCard.substring(0, 6) + "**********" + idCard.substring(16); |
| | | } |
| | | //对业主手机号隐藏处理 |
| | | String link = tmpOwnerDto.getLink(); |
| | | if (mark.size() == 0 && link != null && !link.equals("") && link.length() > 10) { |
| | | link = link.substring(0, 3) + "****" + link.substring(7); |
| | | } |
| | | roomDto.setIdCard(idCard); |
| | | roomDto.setLink(link); |
| | | |
| | | //商铺类型查询起租时间 |
| | | if (roomDto.getRoomType().equals(RoomDto.ROOM_TYPE_SHOPS)) { |
| | | OwnerRoomRelDto ownerRoomRelDto = new OwnerRoomRelDto(); |
| | | ownerRoomRelDto.setRoomId(roomDto.getRoomId()); |
| | | ownerRoomRelDto.setStatusCd("0"); |
| | | List<OwnerRoomRelDto> ownerRoomRelDtoList = ownerRoomRelInnerServiceSMOImpl.queryOwnerRoomRels(ownerRoomRelDto); |
| | | if (ownerRoomRelDtoList != null && ownerRoomRelDtoList.size() == 1) { |
| | | roomDto.setStartTime(ownerRoomRelDtoList.get(0).getStartTime()); |
| | | roomDto.setEndTime(ownerRoomRelDtoList.get(0).getEndTime()); |
| | | } |
| | | } |
| | | // if (roomDto.getRoomType().equals(RoomDto.ROOM_TYPE_SHOPS)) { |
| | | // OwnerRoomRelDto ownerRoomRelDto = new OwnerRoomRelDto(); |
| | | // ownerRoomRelDto.setRoomId(roomDto.getRoomId()); |
| | | // ownerRoomRelDto.setStatusCd("0"); |
| | | // List<OwnerRoomRelDto> ownerRoomRelDtoList = ownerRoomRelInnerServiceSMOImpl.queryOwnerRoomRels(ownerRoomRelDto); |
| | | // if (ownerRoomRelDtoList != null && ownerRoomRelDtoList.size() == 1) { |
| | | // roomDto.setStartTime(ownerRoomRelDtoList.get(0).getStartTime()); |
| | | // roomDto.setEndTime(ownerRoomRelDtoList.get(0).getEndTime()); |
| | | // } |
| | | // } |
| | | } |
| | | } |
| | | } |