Exemplo n.º 1
0
 def getDistributedTenderListByResp(self, jsonInfo):
     info = json.loads(jsonInfo)
     info['userType'] = USER_TAG_RESPONSIBLEPERSON
     (status, userID) = PushedTenderManager.isTokenValidByUserType(info=info)
     if status is not True:
         errorInfo = ErrorInfo['TENDER_01']
         return (False, errorInfo)
     pushedTenderManager = PushedTenderManager()
     return pushedTenderManager.getDistributedTenderList(info=info)
Exemplo n.º 2
0
 def getOperationListByOperatorID(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)
     pushedTenderManager = PushedTenderManager()
     info['userID'] = userID
     return pushedTenderManager.getTenderDoingDetail(info=info)
Exemplo n.º 3
0
 def updateDonePushedTender(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['userID'] = userID
     pushedTenderManager = PushedTenderManager()
     return pushedTenderManager.updateDonePushedTender(info)
Exemplo n.º 4
0
 def createQuotedPriceByResp(self, jsonInfo):
     info = json.loads(jsonInfo)
     info['userType'] = USER_TAG_RESPONSIBLEPERSON
     (status, userID) = PushedTenderManager.isTokenValidByUserType(info=info)
     if status is not True:
         errorInfo = ErrorInfo['TENDER_01']
         return (False, errorInfo)
     info['userID'] = userID
     pushedTenderManager = PushedTenderManager()
     return pushedTenderManager.createQuotedPrice(info=info)
Exemplo n.º 5
0
 def deletePushedTenderByAuditor(self, jsonInfo):
     info = json.loads(jsonInfo)
     info['userType'] = USER_TAG_AUDITOR
     (status,
      userID) = PushedTenderManager.isTokenValidByUserType(info=info)
     if status is not True:
         errorInfo = ErrorInfo['TENDER_01']
         return (False, errorInfo)
     pushedTenderManager = PushedTenderManager()
     return pushedTenderManager.deletePushedTender(info=info)
Exemplo n.º 6
0
    def recoverPushedTenderByBoss(self, jsonInfo):
        info = json.loads(jsonInfo)
        tokenID = info['tokenID']
        (status, userID) = self.isTokenValid(tokenID)
        if status is not True:
            errorInfo = ErrorInfo['TENDER_01']
            return (False, errorInfo)

        pushedTenderManager = PushedTenderManager()
        return pushedTenderManager.recoverPushedTenderInfo(info=info)
Exemplo n.º 7
0
 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)
Exemplo n.º 8
0
 def deletePushedTenderByResp(self, jsonInfo):
     info = json.loads(jsonInfo)
     info['userType'] = USER_TAG_RESPONSIBLEPERSON
     (status, userID) = PushedTenderManager.isTokenValidByUserType(info=info)
     if status is not True:
         errorInfo = ErrorInfo['TENDER_01']
         return (False, errorInfo)
     info['tag'] = USER_TAG_AUDITOR
     pushedTenderManager = PushedTenderManager()
     info['userID'] = userID
     return pushedTenderManager.deletePushedTender(info=info)
Exemplo n.º 9
0
 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)
Exemplo n.º 10
0
 def getAuditorPushedListByBoss(self, jsonInfo):
     info = json.loads(jsonInfo)
     info['userType'] = USER_TAG_BOSS
     (status,
      userID) = PushedTenderManager.isTokenValidByUserType(info=info)
     if status is not True:
         errorInfo = ErrorInfo['TENDER_01']
         return (False, errorInfo)
     info['userType'] = USER_TAG_AUDITOR
     pushedTenderManager = PushedTenderManager()
     return pushedTenderManager.getPushedTenderListByUserType(info=info)
Exemplo n.º 11
0
 def validateOperator(self, jsonInfo):
     info = json.loads(jsonInfo)
     info['userType'] = USER_TAG_BOSS
     (status,
      userID) = PushedTenderManager.isTokenValidByUserType(info=info)
     if status is not True:
         errorInfo = ErrorInfo['TENDER_01']
         return (False, errorInfo)
     pushedTenderManager = PushedTenderManager()
     info['userType'] = USER_TAG_BOSS
     return pushedTenderManager.validateOperator(info=info)
Exemplo n.º 12
0
 def createPushedTenderByOperator(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)
     pushedTenderManager = PushedTenderManager()
     info['userID'] = userID
     info['pushedTenderInfoTag'] = PUSH_TENDER_INFO_TAG_TENDER
     return pushedTenderManager.createPushedTender(info)
Exemplo n.º 13
0
 def getDataInfoByAuditor(self, jsonInfo):
     info = json.loads(jsonInfo)
     tokenID = info['tokenID']
     (status, userID) = self.isTokenValid(tokenID)
     if status is not True:
         errorInfo = ErrorInfo['TENDER_01']
         return (False, errorInfo)
     info['userType'] = USER_TAG_AUDITOR
     info['userID'] = userID
     pushedTenderManager = PushedTenderManager()
     return pushedTenderManager.getDataInfoByUserID(info=info)
Exemplo n.º 14
0
    def getAllPushedListByBoss(self, jsonInfo):
        info = json.loads(jsonInfo)
        tokenID = info['tokenID']
        (status, userID) = self.isTokenValid(tokenID)
        if status is not True:
            errorInfo = ErrorInfo['TENDER_01']
            return (False, errorInfo)

        info['selfUserID'] = userID
        info['staffUserID'] = info['userID']
        info['selfUserType'] = USER_TAG_BOSS
        pushedTenderManager = PushedTenderManager()
        return pushedTenderManager.getAllPushedList(info=info)
Exemplo n.º 15
0
 def getRespPushedListByBoss(self, jsonInfo):
     info = json.loads(jsonInfo)
     info['userType'] = USER_TAG_BOSS
     (status,
      userID) = PushedTenderManager.isTokenValidByUserType(info=info)
     if status is not True:
         errorInfo = ErrorInfo['TENDER_01']
         return (False, errorInfo)
     info['userID'] = userID
     pushedTenderManager = PushedTenderManager()
     # 此方法同 负责人获取我的推送 所以此处伪装成负责人
     info['userType'] = USER_TAG_RESPONSIBLEPERSON
     return pushedTenderManager.getPushedTenderListByUserType(info=info)
Exemplo n.º 16
0
 def createCustomizedTenderByResp(self, jsonInfo, imgFileList):
     info = json.loads(jsonInfo)
     info['userType'] = USER_TAG_RESPONSIBLEPERSON
     (status, userID) = PushedTenderManager.isTokenValidByUserType(info=info)
     if status is not True:
         errorInfo = ErrorInfo['TENDER_01']
         return (False, errorInfo)
     info['userID'] = userID
     customizedTenderManager = CustomizedTenderManager()
     (status, tenderID) = customizedTenderManager.createCustomizedTender(info=info, imgFileList=imgFileList)
     info['tenderID'] = tenderID
     pushedTenderManager = PushedTenderManager()
     info['pushedTenderInfoTag'] = PUSH_TENDER_INFO_TAG_CUS
     return pushedTenderManager.createPushedTender(info)
Exemplo n.º 17
0
    def getDiscardPushedListByBoss(self, jsonInfo):
        info = json.loads(jsonInfo)
        tokenID = info['tokenID']
        (status, userID) = self.isTokenValid(tokenID)
        if status is not True:
            errorInfo = ErrorInfo['TENDER_01']
            return (False, errorInfo)

        info['selfUserID'] = userID
        info['selfUserType'] = USER_TAG_RESPONSIBLEPERSON
        info['staffUserID'] = '-1'

        pushedTenderManager = PushedTenderManager()
        return pushedTenderManager.getDiscardPushedListWithPushedList(
            info=info)
Exemplo n.º 18
0
    def getAllPushedListByAuditor(self, jsonInfo):
        info = json.loads(jsonInfo)
        tokenID = info['tokenID']
        (status, userID) = self.isTokenValid(tokenID)
        if status is not True:
            errorInfo = ErrorInfo['TENDER_01']
            return (False, errorInfo)

        info['selfUserID'] = userID
        info['staffUserID'] = info['userID']
        info['selfUserType'] = USER_TAG_AUDITOR
        pushedTenderManager = PushedTenderManager()
        (status, result) = pushedTenderManager.getAllPushedList(info=info)
        if status is True:
            self.__tagTenderList(info=result)
        return (status, result)
Exemplo n.º 19
0
 def updateOperator(self, jsonInfo):
     info = json.loads(jsonInfo)
     info['userType'] = USER_TAG_RESPONSIBLEPERSON
     (status, userID) = PushedTenderManager.isTokenValidByUserType(info=info)
     if status is not True:
         errorInfo = ErrorInfo['TENDER_01']
         return (False, errorInfo)
     # 验证登录
     userID = info['userID']
     tenderID = info['tenderID']
     try:
         query = db.session.query(Operator).filter(
             Operator.tenderID == tenderID
         )
         updateInfo = {
             Operator.userID: userID,
             Operator.state : OPERATOR_TAG_CREATED
         }
         query.update(
             updateInfo, synchronize_session=False
         )
         db.session.commit()
     except Exception as e:
         print str(e)
         # traceback.print_stack()
         db.session.rollback()
         errorInfo = ErrorInfo['TENDER_02']
         errorInfo['detail'] = str(e)
         return (False, errorInfo)
     return (True, None)
Exemplo n.º 20
0
    def updateOperatorByBoss(self, jsonInfo):
        info = json.loads(jsonInfo)
        info['userType'] = USER_TAG_BOSS
        (status,
         userID) = PushedTenderManager.isTokenValidByUserType(info=info)
        if status is not True:
            errorInfo = ErrorInfo['TENDER_01']
            return (False, errorInfo)
        # 验证登录
        userID = info['userID']
        tenderID = info['tenderID']
        try:
            # boss 分配人时 直接将人分配,且状态变为进行中
            query = db.session.query(Operator).filter(
                Operator.tenderID == tenderID)
            updateInfo = {
                Operator.userID: userID,
                Operator.state: OPERATOR_TAG_YES
            }
            query.update(updateInfo, synchronize_session=False)

            db.session.query(PushedTenderInfo).filter(
                PushedTenderInfo.tenderID == tenderID).update(
                    {PushedTenderInfo.step: PUSH_TENDER_INFO_TAG_STEP_DOING},
                    synchronize_session=False)
            db.session.commit()
        except Exception as e:
            print str(e)
            # traceback.print_stack()
            db.session.rollback()
            errorInfo = ErrorInfo['TENDER_02']
            errorInfo['detail'] = str(e)
            return (False, errorInfo)
        return (True, None)
Exemplo n.º 21
0
    def createOperator(self, jsonInfo):
        info = json.loads(jsonInfo)
        info['userType'] = USER_TAG_RESPONSIBLEPERSON
        (status, userID) = PushedTenderManager.isTokenValidByUserType(info=info)
        if status is not True:
            errorInfo = ErrorInfo['TENDER_01']
            return (False, errorInfo)

        toUserID = info['userID'].replace('\'', '\\\'').replace('\"', '\\\"')
        tenderID = info['tenderID'].replace('\'', '\\\'').replace('\"', '\\\"')
        operatorID = self.generateID(tenderID)
        operator = Operator(
            operatorID=operatorID, userID=toUserID,
            tenderID=tenderID, state=OPERATOR_TAG_CREATED
        )
        try:
            db.session.add(operator)
            db.session.commit()
        except Exception as e:
            print str(e)
            # traceback.print_stack()
            db.session.rollback()
            errorInfo = ErrorInfo['TENDER_02']
            errorInfo['detail'] = str(e)
            return (False, errorInfo)
        return (True, None)
Exemplo n.º 22
0
    def getAllDataInfoByResp(self, jsonInfo):
        info = json.loads(jsonInfo)
        (status, dataInfo) = self.getTenderUserInfoListByResp(jsonInfo=jsonInfo)
        dataList = dataInfo['dataList']

        pushedTenderManager = PushedTenderManager()
        _ = [self.addPushedDataInfoToUser(o=o, pushedTenderManager=pushedTenderManager, info=info) for o in dataList]
        return (True, dataInfo)
Exemplo n.º 23
0
 def getUserInfoByBoss(self, jsonInfo):
     info = json.loads(jsonInfo)
     info['userType'] = USER_TAG_BOSS
     (status,
      userID) = PushedTenderManager.isTokenValidByUserType(info=info)
     if status is not True:
         errorInfo = ErrorInfo['TENDER_01']
         return (False, errorInfo)
     return self.getUserInfo(info=info)
Exemplo n.º 24
0
 def deleteTenderCommentByResp(self, jsonInfo):
     info = json.loads(jsonInfo)
     info['userType'] = USER_TAG_RESPONSIBLEPERSON
     (status, userID) = PushedTenderManager.isTokenValidByUserType(info=info)
     if status is not True:
         errorInfo = ErrorInfo['TENDER_01']
         return (False, errorInfo)
     info['userID'] = userID
     tenderCommentManager = TenderCommentManager()
     return tenderCommentManager.deleteTenderComment(info=info)
Exemplo n.º 25
0
    def updateToHistory(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['step'] = PUSH_TENDER_INFO_TAG_STEP_HISTORY
        return self.__updatePushedTenderInfoStep(info=info)
Exemplo n.º 26
0
 def deleteUserInfoByBoss(self, jsonInfo):
     info = json.loads(jsonInfo)
     info['userType'] = USER_TAG_BOSS
     (status,
      userID) = PushedTenderManager.isTokenValidByUserType(info=info)
     if status is not True:
         errorInfo = ErrorInfo['TENDER_01']
         return (False, errorInfo)
     userManager = UserManager()
     info['selfUserID'] = userID
     return userManager.deleteOAUserInfo(info=info)
Exemplo n.º 27
0
 def createTenderCommentByBoss(self, jsonInfo):
     info = json.loads(jsonInfo)
     info['userType'] = USER_TAG_BOSS
     (status,
      userID) = PushedTenderManager.isTokenValidByUserType(info=info)
     if status is not True:
         errorInfo = ErrorInfo['TENDER_01']
         return (False, errorInfo)
     info['userID'] = userID
     tenderCommentManager = TenderCommentManager()
     return tenderCommentManager.createTenderComment(info=info)
Exemplo n.º 28
0
    def getTenderDetailForWechatApp(self, jsonInfo):
        info = json.loads(jsonInfo)
        tokenID = info['tokenID']
        (status, userID) = self.isTokenValid(tokenID)
        # 权限校验在getTenderDetail里
        (status, dataInfo) = self.getTenderDetail(jsonInfo=jsonInfo)
        if status is not True:
            return (False, dataInfo)

        info = json.loads(jsonInfo)
        tenderID = info['tenderID']
        try:
            result = db.session.query(PushedTenderInfo).filter(
                PushedTenderInfo.tenderID == tenderID).first()
            if result is None:
                return (False, ErrorInfo['TENDER_04'])
            dataInfo['deadline'] = str(result.deadline)
            dataInfo['state'] = result.state
            pushedTenderManager = PushedTenderManager()
            params = {}
            params['pushedTenderInfo'] = result
            params['userType'] = USER_TAG_BOSS
            userBaseManager = UserBaseManager()
            info['userID'] = userID
            (status, userInfo) = userBaseManager.getUserInfo(info=info)
            params['customizedCompanyID'] = userInfo['customizedCompanyID']
            params['selfUserType'] = USER_TAG_BOSS
            (status, pushedUserList) = pushedTenderManager.getPushedUserList(
                info=params)
            dataInfo['pushedUserList'] = pushedUserList
            soup = BeautifulSoup(dataInfo['detail'], 'lxml')
            detail = soup.get_text().encode("utf-8")
            dataInfo['detail'] = detail.strip()
            return (True, dataInfo)
        except Exception as e:
            print e
            traceback.print_exc()
            errorInfo = ErrorInfo['TENDER_02']
            errorInfo['detail'] = str(e)
            db.session.rollback()
            return (False, errorInfo)
Exemplo n.º 29
0
 def getTenderUserInfoListByResp(self, jsonInfo):
     info = json.loads(jsonInfo)
     info['userType'] = USER_TAG_RESPONSIBLEPERSON
     (status, userID) = PushedTenderManager.isTokenValidByUserType(info=info)
     if status is not True:
         errorInfo = ErrorInfo['TENDER_01']
         return (False, errorInfo)
     userManager = UserManager()
     info['userID'] = userID
     (status, userInfo) = self.getUserInfo(info=info)
     info['customizedCompanyID'] = userInfo['customizedCompanyID']
     return userManager.getTenderUserInfoList(info=info)
Exemplo n.º 30
0
    def getRespPushedListByAuditor(self, jsonInfo):
        info = json.loads(jsonInfo)
        info['userType'] = USER_TAG_AUDITOR
        (status,
         userID) = PushedTenderManager.isTokenValidByUserType(info=info)
        if status is not True:
            errorInfo = ErrorInfo['TENDER_01']
            return (False, errorInfo)
        info['userType'] = USER_TAG_RESPONSIBLEPERSON
        pushedTenderManager = PushedTenderManager()
        (status,
         tenderResult) = pushedTenderManager.getPushedTenderListByUserType(
             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)
        return (False, tenderResult)