Exemplo n.º 1
0
 def get(self, community_id, page_size, page):
     """查询小区的物业费缴费情况"""
     parser = reqparse.RequestParser()
     parser.add_argument('status', type=int, location='args')
     parser.add_argument('year', type=int, location='args')
     parser.add_argument('houseId', type=int, location='args')
     args = parser.parse_args()
     base_condition = '%%%s%%'
     status = args['status'] if args['status'] is not None else ''
     condition_status = base_condition % status
     house_id = args['houseId']
     if house_id is None:
         fees = models.PropertyFee.query\
             .filter_by(communityId=community_id)\
             .filter(models.PropertyFee.status.like(condition_status))\
             .order_by(models.PropertyFee.id.desc())\
             .paginate(page, page_size, error_out=False).items
     else:
         fees = models.PropertyFee.query \
             .filter_by(communityId=community_id) \
             .filter_by(houseId=house_id) \
             .filter(models.PropertyFee.status.like(condition_status)) \
             .order_by(models.PropertyFee.id.desc()) \
             .paginate(page, page_size, error_out=False).items
     return {'data': util.serialize(fees)}
Exemplo n.º 2
0
 def get(self, community_id, page_size, page):
     """分页查询报修情况"""
     parser = reqparse.RequestParser()
     parser.add_argument('type', type=int, location='args')
     parser.add_argument('userId', type=int, location='args')
     parser.add_argument('status', type=int, location='args')
     parser.add_argument('keyword', location='args')
     args = parser.parse_args()
     type_value = args['type'] if args['type'] is not None else ''
     condition_type = '%%%s%%' % type_value
     status = args['status'] if args['status'] is not None else ''
     condition_status = '%%%s%%' % status
     keyword = args['keyword'] if args['keyword'] is not None else ''
     condition = '%%%s%%' % keyword
     user_id = args['userId']
     if user_id is None:
         fixes = models.Repair.query\
             .filter(or_(models.Repair.description.like(condition),
                         models.Repair.reporter.like(condition)))\
             .filter(models.Repair.type.like(condition_type))\
             .filter(models.Repair.status.like(condition_status))\
             .filter_by(communityId=community_id)\
             .order_by(models.Repair.reportTime.desc())\
             .paginate(page, page_size, error_out=False).items
     else:
         fixes = models.Repair.query \
             .filter(or_(models.Repair.description.like(condition),
                         models.Repair.reporter.like(condition))) \
             .filter(models.Repair.type.like(condition_type)) \
             .filter(models.Repair.status.like(condition_status)) \
             .filter_by(communityId=community_id) \
             .filter_by(userId=user_id) \
             .order_by(models.Repair.reportTime.desc()) \
             .paginate(page, page_size, error_out=False).items
     return {'data': util.serialize(fixes)}
Exemplo n.º 3
0
 def get(self):
     parser = reqparse.RequestParser()
     parser.add_argument('thirdPartyId', required=True, location='args')
     args = parser.parse_args()
     third_party_id = args['thirdPartyId']
     result = models.Community.query\
         .filter_by(thirdPartyId=third_party_id).first()
     if result is None:
         return config.COMMUNITY_NOT_COOPERATE
     else:
         return {'data': util.serialize(result)}
Exemplo n.º 4
0
 def sendServerOnlinePacket():
     '''孩儿们,老大王者归来了.
     '''
     g.logger.debug('sendServerOnlinePacket sending')
     udpSocket = RunUdpServer.connectMultiCastServer()
     udpSocket.sendto(RunUdpServer._packData(command.server['sysServerOnline']), (setting.groupIp, setting.groupPort))
     #发送    watchPath
     watchPathStr = util.serialize(setting.watchPath)
     udpSocket.sendto(RunUdpServer._packData(command.server['sysSendWatchPath'], str(len(watchPathStr))) + watchPathStr, (setting.groupIp, setting.groupPort))
     
     udpSocket.close()
Exemplo n.º 5
0
 def post(self):
     """用户登录"""
     parser = reqparse.RequestParser()
     parser.add_argument('username', required=True)
     parser.add_argument('password', required=True)
     user = parser.parse_args()
     result = models.User.query.filter_by(
         username=user['username'], password=user['password']).first()
     if result is not None:
         return {'data': util.serialize(result, ['password'])}
     else:
         return config.USERNAME_OR_PASSWORD_ERROR
Exemplo n.º 6
0
 def get(self):
     parser = reqparse.RequestParser()
     parser.add_argument('communityId', type=int, location='args', required=True)
     parser.add_argument('buildingId', location='args', required=True)
     parser.add_argument('unitId', location='args', required=True)
     parser.add_argument('roomId', location='args', required=True)
     args = parser.parse_args()
     community_id = args['communityId']
     building_id = args['buildingId']
     unit_id = args['unitId']
     room_id = args['roomId']
     house = models.House.query.filter_by(communityId=community_id,
                                          buildingId=building_id,
                                          unitId=unit_id,
                                          roomId=room_id).first()
     return {'data': util.serialize(house)}
Exemplo n.º 7
0
    def get(self, community_id, page_size, page):
        """获取公告栏分页信息"""
        parser = reqparse.RequestParser()
        parser.add_argument('keyword', location='args')
        parser.add_argument('userId', type=int, location='args')
        args = parser.parse_args()
        base_condition = '%%%s%%'
        keyword = args['keyword'] if args['keyword'] is not None else ''
        condition = base_condition % keyword
        user_id = args['userId']
        if user_id is not None and user_id != '':
            messages = models.BoardMessage.query\
                .filter_by(userId=user_id)\
                .filter(or_(models.BoardMessage.content.like(condition),
                            models.BoardMessage.source.like(condition)))\
                .filter(or_(models.BoardMessage.isTop.isnot(True),
                            and_(models.BoardMessage.topEndTime > datetime.datetime.now(),
                                 models.BoardMessage.topStartTime < datetime.datetime.now())))\
                .filter_by(communityId=community_id)\
                .order_by(models.BoardMessage.topStartTime.desc(),
                          models.BoardMessage.postTime.desc())\
                .paginate(page, page_size, error_out=False).items
        else:
            messages = models.BoardMessage.query \
                .filter(or_(models.BoardMessage.content.like(condition),
                            models.BoardMessage.source.like(condition),)) \
                .filter(or_(models.BoardMessage.isTop.isnot(True),
                            and_(
                                models.BoardMessage.topEndTime > datetime.datetime.now(),
                                models.BoardMessage.topStartTime < datetime.datetime.now()))) \
                .filter_by(communityId=community_id) \
                .order_by(models.BoardMessage.topStartTime.desc(),
                          models.BoardMessage.postTime.desc()) \
                .paginate(page, page_size, error_out=False).items

        return {'data': util.serialize(messages, ['password'])}
Exemplo n.º 8
0
    def get(self, user_id):
        """获取某个用户信息"""

        user = models.User.query.filter_by(id=user_id).first()
        return {'data': util.serialize(user)}
Exemplo n.º 9
0
 def sysGetWatchPath(self, *args):
     g.logger.debug('sysGetWatchPath starting')
     watchPathStr = util.serialize(setting.watchPath)
     g.logger.debug('watchPathStr: %s' %watchPathStr)
     self._request(self._packData(command.server['sysSendWatchPath'], str(len(watchPathStr))) + watchPathStr)