Beispiel #1
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)
Beispiel #2
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)
Beispiel #3
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)
Beispiel #4
0
 def pushedTenderByAuditor(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)
Beispiel #5
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)
Beispiel #6
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)
Beispiel #7
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)
Beispiel #8
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)
Beispiel #9
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)
Beispiel #10
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)
Beispiel #11
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)
Beispiel #12
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)
Beispiel #13
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)
Beispiel #14
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)
Beispiel #15
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)
Beispiel #16
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)
Beispiel #17
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)
Beispiel #18
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)
Beispiel #19
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)
Beispiel #20
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)
Beispiel #21
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)
Beispiel #22
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)