def getOperatorPushedListByBoss(self, jsonInfo): info = json.loads(jsonInfo) tokenID = info['tokenID'] operatorUserID = info['userID'] (status, userID) = self.isTokenValid(tokenID) if status is not True: errorInfo = ErrorInfo['TENDER_01'] return (False, errorInfo) info['staffUserID'] = operatorUserID pushedTenderManager = PushedTenderManager() return pushedTenderManager.getPushedTenderListByUserID(info=info)
def getCustomizedPushedListByOperator(self, jsonInfo): info = json.loads(jsonInfo) info['userType'] = USER_TAG_OPERATOR (status, userID) = PushedTenderManager.isTokenValidByUserType(info=info) if status is not True: errorInfo = ErrorInfo['TENDER_01'] return (False, errorInfo) info['staffUserID'] = userID pushedTenderManager = PushedTenderManager() info['tenderTag'] = PUSH_TENDER_INFO_TAG_CUS return pushedTenderManager.getPushedTenderListByUserID(info=info)
def getOperatorPushedListByAuditor(self, jsonInfo): info = json.loads(jsonInfo) info['userType'] = USER_TAG_AUDITOR operatorUserID = info['userID'] (status, userID) = PushedTenderManager.isTokenValidByUserType(info=info) if status is not True: errorInfo = ErrorInfo['TENDER_01'] return (False, errorInfo) info['staffUserID'] = operatorUserID pushedTenderManager = PushedTenderManager() (status, tenderResult) = pushedTenderManager.getPushedTenderListByUserID( info=info) if status is True: try: dataList = tenderResult['dataList'] tenderIDTuple = (o['tenderID'] for o in dataList) pushedResult = db.session.query(PushedTenderInfo).filter( and_(PushedTenderInfo.auditorPushedTime != None, PushedTenderInfo.tenderID.in_(tenderIDTuple))).all() pushedTenderIDList = [o.tenderID for o in pushedResult] for o in dataList: if o['tenderID'] in pushedTenderIDList: o['pushed'] = True else: o['pushed'] = False return (True, tenderResult) except Exception as e: print str(e) # traceback.print_stack() db.session.rollback() errorInfo = ErrorInfo['TENDER_02'] errorInfo['detail'] = str(e) return (False, errorInfo)