PropertyRoomController.java 2.29 KB
package cn.com.glsx.entmicro.controller;


import cn.com.glsx.entmicro.convert.ConvertRequest;
import cn.com.glsx.entmicro.dto.PropertyRoomDTO;
import cn.com.glsx.entmicro.model.request.DracChannelCodeBillRequest;
import cn.com.glsx.entmicro.remote.PropertyRoomRemote;
import cn.com.glsx.entmicro.request.one.OneSearchRequest;
import cn.com.glsx.entmicro.request.property.PropertyRoomListRequest;
import cn.com.glsx.entmicro.response.one.OneDataResponse;
import cn.com.glsx.entmicro.service.GroupOneService;
import cn.com.glsx.entmicro.utils.Pagination;
import cn.com.glsx.framework.core.beans.rpc.RpcPagination;
import cn.com.glsx.framework.core.beans.rpc.RpcResponse;
import cn.com.glsx.framework.core.exception.RpcServiceException;
import cn.com.glsx.framework.rop.response.RopResponse;
import com.rop.annotation.NeedInSessionType;
import com.rop.annotation.ServiceMethod;
import com.rop.annotation.ServiceMethodBean;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

/**
 * @description: 物业楼栋房号管理
 */
@Slf4j
@Api("物业楼栋房号接口")
@ServiceMethodBean(version = "1.0.0", needInSession = NeedInSessionType.YES)
public class PropertyRoomController {

    @Autowired
    private PropertyRoomRemote propertyRoomRemote;

    /**
     * 查询房号信息
     *
     * @param request
     * @return
     */
    @ServiceMethod(method = "entmicro.api.property.room.page")
    @ApiOperation("根据条件查询房号信息")
    public RopResponse<RpcPagination<PropertyRoomDTO>> page(PropertyRoomListRequest request) {
        try {
            RpcPagination<PropertyRoomDTO> pagination = ConvertRequest.convertPage(request, new PropertyRoomDTO());

            RpcResponse<RpcPagination<PropertyRoomDTO>> res = propertyRoomRemote.page(pagination);
            if(!res.hasResult()){
                return RopResponse.error(res.getMessage());
            }
            return RopResponse.success(res.getResult());
        } catch (RpcServiceException e) {
            log.info("=======PropertyRoomController__page__exception:{}", e.getMessage());
            return RopResponse.error(e.getErrId(), e.getMessage());
        }
    }
}