def workflowdata(pviguid, title, senddate, workitemListJson, note): # print(pviguid) if senddate and senddate != "": senddate = Utils.formatStrToTime(senddate) if senddate: senddate = Utils.fromatTimeToStr(senddate, "%Y-%m-%d") else: senddate = None else: senddate = None workflow = {} workflow['rowguid'] = str(uuid.uuid1()) workflow['processVersionInstanceGuid'] = pviguid workflow['processVersionInstanceName'] = title workflow['processVersionGuid'] = '' workflow['initiatorname'] = '' workflow['startDate'] = senddate workflow['endTime'] = '' workflow['terminateDate'] = '' workflow['status'] = 0 workflow['tag'] = '2' workflow['note'] = note workflow['workitemjson'] = workitemListJson workflow['instancejson'] = '' workflow['defXml'] = '' workflow['operatedate'] = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime()) return workflow
def analysisTaskNodeFb(file): csvFile = csv.reader(file) # 读取一行,下面的reader中已经没有该行了 head_row = next(csvFile) # print(head_row) __conn = getConnect_old() counter = 0 for row in csvFile: if len(row) < 7: continue taskNodeFb = {} taskNodeFb['RowGuid'] = row[0] taskNodeFb['tasknodeguid'] = row[1] taskNodeFb['Ordernum'] = row[2] taskNodeFb['feedbacker'] = row[3] taskNodeFb['feedbackerguid'] = row[4] operateDateStr = row[5] if operateDateStr and len(operateDateStr) > 0: operateDate = Utils.formatStrToTime(operateDateStr) operateDateStr = Utils.fromatTimeToStr(operateDate, '%Y-%m-%d') else: operateDateStr = None taskNodeFb['OperateDate'] = operateDateStr taskNodeFb['Others'] = row[6] taskNodeFb['BelongXiaQuCode'] = "1" # print(taskNodeFb) if insertTaskNodeFb(__conn, taskNodeFb): counter += 1 print("插入常务会议反馈数据:%d 条。" % counter) if counter % 1000 == 0: __conn.commitData() __conn.commitData() __conn.closeConn()
def handleFeedback(): __conn = getConnect_old() __conn_oa = getConnect_oa_old() records = getFeedbacks(__conn) counter = 0 for record in records: feedback = {} feedback['RowGuid'] = str(uuid.uuid1()) feedback['MeetingGuid'] = record[0] feedbackerGuid = record[1] if getFrame_userguid(__conn_oa, feedbackerGuid): feedbackerGuid = getFrame_userguid(__conn_oa, feedbackerGuid) feedback['FeedBackUserGuid'] = feedbackerGuid feedback['FeedBackUserName'] = record[2] FeedBackDate = record[3] FeedBackDate = Utils.formatStrToTime(FeedBackDate) if FeedBackDate: FeedBackDate = Utils.fromatTimeToStr(FeedBackDate, "%Y-%m-%d %H:%M:%S") feedback['FeedBackDate'] = FeedBackDate feedback['FeedBackContent'] = record[4] feedback['imported'] = 1 if insertFeedback(__conn, feedback): counter += 1 print("已经插入反馈数据: %d 条。" % counter) __conn.commitData() __conn.closeConn()
def handleSignInfo(): __conn = getConnect_old() records = getAllSignInfo(__conn) counter = 0 for records in records: signInfo = {} signInfo['MAINUNID'] = records[0] signInfo['UNID'] = records[1] unitStr = records[2] if unitStr: units = str(unitStr).split(',') for i in range(len(units)): signInfo['Unit'] = units[i] unitIdStr = records[3] if not unitIdStr or unitIdStr == '': continue unitIds = str(unitIdStr).split(',') if i < len(unitIds): signInfo['UNITID'] = unitIds[i] # userStr = records[4] # if not userStr or userStr == '': # continue # users = str(userStr).split(',') # if i < len(users): # signInfo['User'] = users[i] # # userTitleStr = records[5] # if not userTitleStr or userTitleStr == '': # continue # userTitles = str(userTitleStr).split(',') # if i < len(userTitles): # signInfo['USERTITLE'] = userTitles[i] timeStr = records[4] if not timeStr or timeStr == '': continue times = str(timeStr).split(',') if i < len(times): timeStr = times[i] time1 = Utils.formatStrToTime(timeStr) timeStr = Utils.fromatTimeToStr(time1, '%Y-%m-%d %H:%M:%S') signInfo['TIME'] = timeStr if insertSignInfoDone(__conn, signInfo): counter += 1 print("插入签收记录数据:%d 条。" % counter) if counter % 1000 == 0: __conn.commitData() __conn.commitData() __conn.closeConn()
def analysisDayScheduleCsv(file): csvFile = csv.reader(file) # 读取一行,下面的reader中已经没有该行了 head_row = next(csvFile) # print(head_row) __conn = getConnect_old() counter = 0 for row in csvFile: if len(row) != 32: continue schedule = {} # print(row) userguid = row[0] userguid = str(userguid).replace("CN=", "").replace("O=", "") userguid = Utils.getInitUserGuid(userguid, __conn) schedule['userguid'] = userguid # if not userguid: # print(leader, row[0]) # return year = row[1] schedule['year'] = year week = row[2] schedule['weekflag'] = re.sub('[^0-9]', "", week) leader = row[3] schedule['leader'] = leader #周一至周日的数据 for i in range(1, 8): # print(i) #一周一天的数据 schedule['RowGuid'] = str(uuid.uuid1()) day1 = row[4 * i] if len(day1) < 1: continue daytime = Utils.formatStrToTime(day1) schedule['scheduletime'] = Utils.fromatTimeToStr( daytime, '%Y-%m-%d') weekday1 = row[4 * i + 1] schedule['weekday'] = weekday1 amcontent1 = row[4 * i + 2] schedule['amcontent'] = amcontent1 pmcontent1 = row[4 * i + 3] schedule['pmcontent'] = pmcontent1 if insertDaySchedule(__conn, schedule): counter += 1 print("插入日程数据:%d 条。" % counter) if counter % 1000 == 0: __conn.commitData() __conn.commitData() __conn.closeConn()
def addArchiveHandle(tag): __conn = getConnect_old() records = getWorkflow_handle(__conn) counter = 0 for record in records: workflowhandle = {} workflowhandle['rowguid'] = str(uuid.uuid1()) workflowhandle['archiveRowguid'] = record[0] workflowhandle['archiveType'] = tag workflowhandle['processversionInstanceGuid'] = record[0] workflowhandle['activityName'] = record[1] userGuidStr = record[2] # print(userGuidStr) #默认为系统管理员 userGuid = '45f0c5f9-cad2-49e6-887d-b38dfcbc23de' if userGuidStr: userGuid = Utils.getInitUserGuid(userGuidStr, __conn) if not userGuid: userGuid = userGuidStr workflowhandle['HandleUserGuid'] = userGuid workflowhandle['handleUserName'] = record[3] workflowhandle['HandleUserOUGuid'] = Utils.getUnitBaseOuGUid() workflowhandle['isdone'] = "1" #标识为历史数据 workflowhandle['frominducestate'] = "1" if record[2] == '办理完毕': workflowhandle['isdone'] = "1" doneDateStr = record[4] if doneDateStr: doneDate = Utils.formatStrToTime(doneDateStr) if doneDate: doneDateStr = Utils.fromatTimeToStr(doneDate, '%Y-%m-%d %H:%M:%S') else: doneDateStr = None else: doneDateStr = None workflowhandle['donedate'] = doneDateStr if insertWorkflowHandle(workflowhandle, __conn) > 0: counter += 1 print('流程处理信息已经添加:%d 条' % counter) if counter % 1000 == 0: pass __conn.commitData() __conn.commitData() __conn.closeConn()
def eachfile(filepath, conn): pathdir = os.listdir(filepath) counter = 0 paths = filepath.split("\\") outputfilepath = None if len(paths) > 6: unitName = paths[5] tag = Utils.getFileTag(filepath) outputfilepath = Utils.getFileOutPutPath(unitName, Utils.getFileTag_ch(filepath)) for dir in pathdir: child = os.path.join('%s\%s' % (filepath, dir)) if os.path.isfile(child): if child.find("basicInfo") != -1: counter =readfile(child, outputfilepath, tag, conn) continue counter += eachfile(child, conn) if counter % 1000 == 0: conn.commitData() conn.commitData() return counter
def analysisOpinionCsv(file): csvFile = csv.reader(file) # 读取一行,下面的reader中已经没有该行了 head_row = next(csvFile) # print(head_row) __conn = getConnect_old() counter = 0 for row in csvFile: # print(row) if len(row) < 6: continue opinion = {} opinion['parentunid'] = row[0] opinion['UNID'] = row[1] opinion['OPINIONUSER'] = Utils.getUserGuid(row[2]) opinion['OPINIONUSERTITLE'] = row[3] opinionTime = Utils.formatStrToTime(row[4]) if opinionTime: opinionTimeStr = Utils.fromatTimeToStr(opinionTime, '%Y-%m-%d %H:%M') else: continue opinion['opinionTime'] = opinionTimeStr opinion['OPINIONBODY'] = row[5] feedbackunid = None if len(row) > 6: feedbackunid = row[6] opinion['feedbackunid'] = feedbackunid if insertOpinion(__conn, opinion): counter += 1 if counter % 1000 == 0: __conn.commitData() print("已经插入意见信息: %d 条。" % counter) __conn.commitData() __conn.closeConn()
def analysisLeaderApproveCsv(file): csvFile = csv.reader(file) # 读取一行,下面的reader中已经没有该行了 head_row = next(csvFile) # print(head_row) __conn = getConnect_old() counter = 0 for row in csvFile: if len(row) < 19: continue comments = {} rowguid = row[0] comments['Rowguid'] = str(uuid.uuid1()) comments['pviguid'] = rowguid comments['doctitle'] = row[1] comments['replytitle'] = row[2] comments['commentguid'] = row[3] comments['commentsubguid'] = row[4] comments['method'] = row[5] filingdateStr = row[6] if filingdateStr: filingdate = Utils.formatStrToTime(filingdateStr) if filingdate: filingdateStr = Utils.fromatTimeToStr(filingdate, '%Y-%m-%d') else: filingdateStr = None comments['filingdate'] = filingdateStr finishdateStr = row[7] if finishdateStr: finishdate = Utils.formatStrToTime(finishdateStr) if finishdate: finishdateStr = Utils.fromatTimeToStr(finishdate, '%Y-%m-%d') else: finishdateStr = None comments['finishdate'] = finishdateStr comments['commentleader'] = row[8] commentdateStr = row[9] if finishdateStr: finishdate = Utils.formatStrToTime(commentdateStr) if finishdate: commentdateStr = Utils.fromatTimeToStr(finishdate, '%Y-%m-%d') else: commentdateStr = None comments['commentdate'] = commentdateStr comments['urgency'] = row[10] comments['securitylevel'] = row[11] comments['fromdept'] = row[12] comments['hostdept'] = row[13] comments['assistantdept'] = row[14] comments['opinion'] = row[15] userguid = row[16] userguid = str(userguid).replace("CN=", "").replace("O=", "") userguid = Utils.getInitUserGuid(userguid, __conn) comments['SignUserGuid'] = userguid comments['SignUserName'] = row[17] comments['AddUserBaseouguid'] = Utils.getBaseOuGuid(userguid, __conn) signDateStr = row[18] if signDateStr: signDate = Utils.formatStrToTime(signDateStr) if signDate: signDateStr = Utils.fromatTimeToStr(signDate, '%Y-%m-%d') else: signDateStr = None comments['OperateDate'] = signDateStr comments['status'] = '已提交' comments['imported'] = 1 if insertComments(__conn, comments): counter += 1 print("插入日程数据:%d 条。" % counter) if counter % 1000 == 0: __conn.commitData() __conn.commitData() __conn.closeConn()
def analysisExcutiveCsv(file): csvFile = csv.reader(file) # 读取一行,下面的reader中已经没有该行了 head_row = next(csvFile) # print(head_row) __conn = getConnect_old() counter = 0 for row in csvFile: if len(row) < 12: continue task = {} task['pviguid'] = row[0] task['rowguid'] = row[1] task['registername'] = row[2] task['registerguid'] = row[3] registertimeStr = row[4] if registertimeStr and len(registertimeStr) > 0: registertime = Utils.formatStrToTime(registertimeStr) registertimeStr = Utils.fromatTimeToStr(registertime, '%Y-%m-%d') else: registertimeStr = None task['registertime'] = registertimeStr task['supervisionnum'] = row[5] task['taskname'] = row[6] executivetimeStr = row[7] if executivetimeStr and len(executivetimeStr) > 0: executivetime = Utils.formatStrToTime(executivetimeStr) executivetimeStr = Utils.fromatTimeToStr(executivetime, '%Y-%m-%d') else: executivetimeStr = None task['executivetime'] = executivetimeStr feedbacktimeStr = row[8] if feedbacktimeStr and len(feedbacktimeStr) > 0: feedbacktime = Utils.formatStrToTime(feedbacktimeStr) feedbacktimeStr = Utils.fromatTimeToStr(feedbacktime, '%Y-%m-%d') else: feedbacktimeStr = None task['feedbacktime'] = feedbacktimeStr meetingcontentStr = row[9] meetingcontentStr1 = re.sub('<[^>]*>', '', meetingcontentStr) task['meetingcontent'] = meetingcontentStr1 matcherObjs = Utils.getStrByReg(meetingcontentStr, '[0-9a-zA-Z]{32}') # print(matcherObjs) if matcherObjs: wd24PviGuid = matcherObjs[1] task['BelongXiaQuCode'] = wd24PviGuid task['yearFlag'] = row[10] isacrossyear = 0 if '是' == row[11]: isacrossyear = 1 task['isacrossyear'] = isacrossyear task['imported'] = "1" task['taskType'] = "1" task['pvistatus'] = "9" # print(task) if insertTask(__conn, task): counter += 1 print("插入常务会议数据:%d 条。" % counter) if counter % 1000 == 0: __conn.commitData() __conn.commitData() __conn.closeConn()
def analysisWd24Csv(file): csvFile = csv.reader(file) # 读取一行,下面的reader中已经没有该行了 head_row = next(csvFile) # print(head_row) __conn = getConnect_old() counter = 0 for row in csvFile: # print(row) # print(len(row)) if len(row) != 37: continue wd24 = {} wd24['RowGuid'] = str(uuid.uuid1()) wd24['ProcessVersionInstanceGuid'] = row[0] # print(row[0]) wd24['pviguid'] = row[0] txttitle = row[1] if not txttitle: continue else: txttitle = re.sub('[\']{1,5}', "”", txttitle) wd24['txttitle'] = txttitle wd24['FaWenFileNumber'] = row[2] countFilenumber = getCountFileNumber(__conn, row[2]) if countFilenumber == None or getCountFileNumber(__conn, row[2])[0][0] > 0: print(row[2], getCountFileNumber(__conn, row[2])[0][0]) continue wd24['JpdFawenYear'] = re.sub('[^0-9]', '', row[3]) wd24['TxtFileNumber'] = re.sub('[^0-9]', '', row[4]) wd24['Ouname'] = row[5] sendfiledate = Utils.formatStrToTime(row[6]) if sendfiledate: sendfiledate = Utils.fromatTimeToStr(sendfiledate, "%Y-%m-%d %H:%M:%S") wd24['sendfiledate'] = sendfiledate wd24['InitUserDisplayName'] = row[7] wd24['JpdMiji'] = row[8] wd24['secrecyTime'] = row[9] wd24['jpdhuanji'] = row[10] wd24['sanctionsTime'] = row[11] wd24['phone'] = row[12] wd24['secrecyExaminer'] = row[13] wd24['lawExaminer'] = row[14] wd24['categorynum'] = row[15] wd24['identfyFile'] = row[16] wd24['genresType'] = row[17] wd24['rulesFile'] = row[18] wd24['partyMixInfo'] = row[19] wd24['policyFiles'] = row[20] wd24['commonAttr'] = row[21] wd24['noPublicReason'] = row[22] wd24['drafttype'] = row[23] wd24['txtzhusong'] = row[24] wd24['txtchaosong'] = row[25] wd24['theme'] = row[26] wd24['sendFileType'] = row[27] wd24['pdfawendz'] = row[28] wd24['bark'] = row[29] relatedLink = row[30] if relatedLink and relatedLink != '': relatedLink = Utils.handleRelateLink(relatedLink) wd24['relatedLink'] = relatedLink C_CreateUser = row[31] C_CreateUser = Utils.getInitUserGuid(C_CreateUser, __conn) wd24["InitUserGuid"] = C_CreateUser wd24['JpdGongWenZhongLei'] = row[32] wd24['searchLevel'] = row[33] wd24['printNum'] = re.sub('[^0-9]', '', row[34]) if Utils.getUnitBaseOuGUid(row[35]) == None: continue wd24['SubWebFlowOuGuid'] = Utils.getUnitBaseOuGUid(row[35]) wd24['imported'] = 1 wd24['DelFlag'] = 0 # print(wd24) if insertWd24(__conn, wd24) > 0: counter += 1 if counter % 1000 == 0: __conn.commitData() print("发文数据已经插入:%d 条。" % counter) __conn.commitData() __conn.closeConn()
def analysisWd25Csv(file): csvFile = csv.reader(file) # 读取一行,下面的reader中已经没有该行了 head_row = next(csvFile) # print(head_row) __conn = getConnect_old() counter = 0 for row in csvFile: # print(len(row)) if len(row) != 26: continue # print(row) wd25 = {} wd25['RowGuid'] = str(uuid.uuid1()) wd25['ProcessVersionInstanceGuid'] = row[0] txttitle = row[1] if txttitle: txttitle = re.sub('[\']{1,5}', "”", txttitle) else: continue wd25['TxtTitle'] = txttitle wd25['txtlaiwenhao'] = row[2] wd25['ShouWenFileNumber'] = row[3] wd25['replyTitle'] = row[4] wd25['flowNum'] = row[5] wd25['fileCode'] = row[6] wd25['txtlaiwendept'] = row[7] wd25['fileStyle'] = row[8] wd25['initUserDisplayName'] = row[9] wd25['jinji'] = row[10] wd25['jpdMiji'] = row[11] wd25['Arch_Type'] = row[12] saveTimeStr = row[13] #将时间字符串转为时间 # if saveTimeStr == '短期': # pass # elif saveTimeStr and str(saveTimeStr).strip() != '': # saveTimeStr = Utils.formatStrToTime(saveTimeStr) # if saveTimeStr: # saveTimeStr = Utils.fromatTimeToStr(saveTimeStr, "%Y-%m-%d %H:%M:%S") # else: # saveTimeStr = None wd25['saveTime'] = saveTimeStr wd25['searchLevel'] = row[14] wd25['clearFileType'] = row[15] txtFileDateStr = row[16] #将时间字符串转为时间 if txtFileDateStr and txtFileDateStr != '': txtFileDateStr = Utils.formatStrToTime(txtFileDateStr) if txtFileDateStr: txtFileDateStr = Utils.fromatTimeToStr(txtFileDateStr, "%Y-%m-%d %H:%M:%S") else: txtFileDateStr = None wd25['TxtFileDate'] = txtFileDateStr txtShouWenDateStr = row[17] #将时间字符串转为时间 if txtShouWenDateStr and txtShouWenDateStr != '': txtShouWenDateStr = Utils.formatStrToTime(txtShouWenDateStr) if txtShouWenDateStr: txtShouWenDateStr = Utils.fromatTimeToStr( txtShouWenDateStr, "%Y-%m-%d %H:%M:%S") else: txtShouWenDateStr = None wd25['TxtShouWenDate'] = txtShouWenDateStr wd25['txtzhuban'] = row[18] banjieDateStr = row[19] #将时间字符串转为时间 if banjieDateStr and str(banjieDateStr).strip() != '': banjieDateStr = Utils.formatStrToTime(banjieDateStr) if banjieDateStr: banjieDateStr = Utils.fromatTimeToStr(banjieDateStr, "%Y-%m-%d %H:%M:%S") else: banjieDateStr = None wd25['banjieDate'] = banjieDateStr overTimeStr = row[20] #将时间字符串转为时间 if overTimeStr and str(overTimeStr).strip() != '': overTimeStr = Utils.formatStrToTime(overTimeStr) if overTimeStr: overTimeStr = Utils.fromatTimeToStr(overTimeStr, "%Y-%m-%d %H:%M:%S") else: overTimeStr = None wd25['overTime'] = overTimeStr wd25['isQuit'] = row[21] wd25['attach'] = row[22] wd25['bark'] = row[23] wd25['Ouname'] = row[24] C_CreateUser = Utils.getInitUserGuid(row[25], __conn) wd25['InitUserGuid'] = C_CreateUser wd25['imported'] = 1 wd25['DelFlag'] = 0 wd25['SubWebFlowOuGuid'] = Utils.getUnitBaseOuGUid() if insertWd25(__conn, wd25) > 0: counter += 1 if counter % 1000 == 0: __conn.commitData() print("收文数据已经插入:%d 条。" % counter) __conn.commitData() __conn.closeConn()
# print(Utils.getUnitBaseOuGUid()) # if Utils.getUnitBaseOuGUid() == None: # exit() readAllFiles(testFilePath) #处理流程步骤信息,将老数据的流程步骤信息解析为单个步骤的信息 # handleWorkflow() #公文需要添加流程处理相关数据 if testFilePath.find("收文") != -1: handleTag = 'wd_25' elif testFilePath.find("发文") != -1: handleTag = 'wd_24' else: exit() # handleArchiveHandleData(handleTag) #处理流程步骤对应的意见信息 # handleWorkflowAndOpinion() #封装流程处理信息数据 #工作流标识 note = Utils.getFirst_alpha(testFilePath) + "_" + handleTag # handleWorkflowListData(note) #处理附件,存储附件信息 #文件解析路径 inputForderName = "D:\各单位老数据1\oa导出数据\附件\直接发文" #文件存储路径 # outputForderName = "D:\OA9Attach\BigFileUpLoadStorage/" # outputForderName = "D:\OA9Attach\BigFileUpLoadStorage/wd24" #附件标识 # tag = "leaderApprove_formal" # tag = "leaderApprove_feedback" tag = "wd25" # handleFile(inputForderName, outputForderName, tag)
def import_wd25(): counter = 0 __conn = getConnect_new() __conn_1 = getConnect_old() results = findAllWd25(__conn_1) # __conn_1.closeConn() for record in results: Wd25 = {} # 主键 # UNID = sheet.cell(rownum, 0).value UNID = record[0] if not UNID: UNID = None continue else: UNID = re.sub('[^0-9|a-zA-Z]', '', UNID) if UNID == '': # print("跳过该数据:%s"%UNID) continue Wd25["RowGuid"] = UNID Wd25["ProcessVersionInstanceGuid"] = UNID # 标题 # subject = sheet.cell(rownum, 1).value subject = record[1] if not subject: subject = None Wd25["TxtTitle"] = subject # 文件字号 # DocMark = sheet.cell(rownum, 2).value DocMark = record[2] if not DocMark: DocMark = None Wd25["txtlaiwenhao"] = DocMark # 发文字号 # DocMark_ZB = sheet.cell(rownum, 3).value DocMark_ZB = record[3] if not DocMark_ZB: DocMark_ZB = None Wd25["ShouWenFileNumber"] = DocMark_ZB # 答复意见 # Subject_Leader = sheet.cell(rownum, 4).value Subject_Leader = record[4] if not Subject_Leader: Subject_Leader = None Wd25["replyTitle"] = Subject_Leader # 流水号 # DocNum = sheet.cell(rownum, 5).value DocNum = record[5] if not DocNum: DocNum = None Wd25["flowNum"] = DocNum # 文件标识 # HandleOrView = sheet.cell(rownum, 6).value HandleOrView = record[6] if not HandleOrView: HandleOrView = None Wd25["fileCode"] = HandleOrView # 来文单位 # SourceUnit = sheet.cell(rownum, 7).value SourceUnit = record[7] if not SourceUnit: SourceUnit = None Wd25["txtlaiwendept"] = SourceUnit # 收文分类 # FileCategory = sheet.cell(rownum, 8).value FileCategory = record[8] if not FileCategory: FileCategory = None Wd25["fileStyle"] = FileCategory # 登记人 # RegPerson = sheet.cell(rownum, 9).value RegPerson = record[9] if not RegPerson: RegPerson = None Wd25["initUserDisplayName"] = RegPerson # 登记人guid C_CreateUser = record[10] C_CreateUser = Utils.getInitUserGuid(C_CreateUser, __conn_1) if not C_CreateUser: C_CreateUser = None elif C_CreateUser == 2: C_CreateUser = '' Wd25["InitUserGuid"] = C_CreateUser # 紧急程度 # UrgentLevel = sheet.cell(rownum, 11).value UrgentLevel = record[11] if not UrgentLevel: UrgentLevel = None Wd25["jinji"] = UrgentLevel # 文件密级 # SecLevel = sheet.cell(rownum, 12).value SecLevel = record[12] if not SecLevel: SecLevel = None Wd25["jpdMiji"] = SecLevel # 文种 # DocType = sheet.cell(rownum, 13).value DocType = record[13] if not DocType: DocType = None Wd25["Arch_Type"] = DocType # 保管期限 # KeepTerm = sheet.cell(rownum, 14).value KeepTerm = record[14] if not KeepTerm: KeepTerm = None Wd25["saveTime"] = KeepTerm # 查询级别 # QueryLevel = sheet.cell(rownum, 15).value QueryLevel = record[15] if not QueryLevel: QueryLevel = None Wd25["searchLevel"] = QueryLevel # 归档类型 # ArchiveType = sheet.cell(rownum, 16).value ArchiveType = record[16] if not ArchiveType: ArchiveType = None Wd25["clearFileType"] = ArchiveType # 发文日期 # SignDate = sheet.cell(rownum, 17).value SignDate = record[17] if not SignDate: SignDate = time.localtime() else: # SignDate = re.sub('[^0-9 | \/]', '', SignDate) SignDateTime = Utils.formatStrToTime(SignDate) SignDate = Utils.fromatTimeToStr(SignDateTime, "%Y-%m-%d") Wd25["TxtFileDate"] = SignDate # 收文日期 # RegDate = sheet.cell(rownum, 18).value RegDate = record[18] jpdshouwenyear = None if not RegDate: RegDateTime = time.localtime() else: jpdshouwenyear = RegDate.split('/')[0] jpdshouwenyear = re.sub('[^0-9]', '', jpdshouwenyear) # RegDate = re.sub('[^0-9 | \/]', '', RegDate) RegDateTime = Utils.formatStrToTime(RegDate) RegDate = Utils.fromatTimeToStr(RegDateTime, "%Y-%m-%d") Wd25["TxtShouWenDate"] = str(RegDate) Wd25["jpdshouwenyear"] = jpdshouwenyear # 主办单位 # DealUnit = sheet.cell(rownum, 19).value DealUnit = record[19] if not DealUnit: DealUnit = None Wd25["txtzhuban"] = DealUnit # 交办日期 # DealDate = sheet.cell(rownum, 20).value DealDateStr = record[20] if not DealDateStr: DealDateTime = time.localtime() else: DealDateStrs = str(DealDateStr).split(',') # DealDateStr = re.sub('[^0-9 | \/]', '', str(DealDateStrs[0])) DealDateTime = Utils.formatStrToTime(DealDateStrs[0]) DealDateStr = Utils.fromatTimeToStr(DealDateTime, "%Y-%m-%d") Wd25["banjieDate"] = DealDateStr # 办理期限 # Deadline = sheet.cell(rownum, 21).value Deadline = record[21] if not Deadline: DeadlineTime = time.localtime() else: # Deadline = re.sub('[^0-9 | \/]', '', Deadline) DeadlineTime = Utils.formatStrToTime(Deadline) Deadline = Utils.fromatTimeToStr(DeadlineTime, "%Y-%m-%d") Wd25["overTime"] = Deadline # 是否退文 # IsReturnFile = sheet.cell(rownum, 22).value IsReturnFile = record[22] if not IsReturnFile: IsReturnFile = None Wd25["isQuit"] = IsReturnFile # 文件附件 # Attachment = sheet.cell(rownum, 23).value Attachment = record[23] if not Attachment: Attachment = None Wd25["attach"] = Attachment # 备注 # remark = sheet.cell(rownum, 24).value remark = record[24] if not remark: remark = None Wd25["bark"] = remark # 收文员所属科室 # RegDeptTitle = sheet.cell(rownum, 25).value RegDeptTitle = record[25] if not RegDeptTitle: RegDeptTitle = None Wd25["ouname"] = RegDeptTitle # 收文员所属科室Guid # RegDeptTitleGuid = sheet.cell(rownum, 26).value RegDept = record[26] # RegDept = getInitDeptGuid(RegDeptTitle, __conn) # if not RegDept: # RegDept = '' # elif RegDept == 1: # RegDept = 'a' # elif RegDept == 2: # RegDept = '' Wd25["ouguid"] = RegDept # 迁移数据状态 Wd25["imported"] = "1" Wd25["ArchiveState"] = "1" SubWebFlowOuGuid = Utils.getSubWebFlowOuGuid('wd25_workflow_done', UNID, __conn) Wd25['SubWebFlowOuGuid'] = SubWebFlowOuGuid if insertWd25(Wd25, __conn) > 0: counter += 1 print("已经插入:%d条数据。" % counter) if counter % 1000 == 0: __conn.commitData() __conn.commitData() __conn.closeConn() __conn_1.closeConn()
def handleMeetingSend(): __conn = getConnect_old() __conn_oa = getConnect_oa_old() noticeRecords = getNoticeData(__conn) counter = 0 for record in noticeRecords: meetingSend = {} meetingSend['RowGuid'] = record[0] meetingSend['MeetingName'] = record[1] meetingSend['Maincontent'] = record[2] MeetingDate = record[3] if MeetingDate: MeetingDate = Utils.formatStrToTime(MeetingDate) if MeetingDate: MeetingDate = Utils.fromatTimeToStr(MeetingDate, "%Y-%m-%d %H:%M:%S") else: MeetingDate = None meetingSend['MeetingDate'] = MeetingDate MeetingEndDate = record[4] if MeetingEndDate: MeetingEndDate = Utils.formatStrToTime(MeetingEndDate) if MeetingEndDate: MeetingEndDate = Utils.fromatTimeToStr(MeetingEndDate, "%Y-%m-%d %H:%M:%S") else: MeetingEndDate = None meetingSend['MeetingEndDate'] = MeetingEndDate meetingSend['MeetingPlace'] = record[5] meetingSend['AttendanceLeader'] = record[6] meetingSend['Hoster'] = record[7] meetingSend['ReceiveOuGuids'] = record[8] meetingSend['ReceiveOuNames'] = record[9] meetingSend['ReceiveUserGuids'] = record[10] meetingSend['ReceiveUserNames'] = record[11] meetingSend['SMSNotice'] = record[12] meetingSend['Backlognotice'] = record[13] meetingSend['feedback'] = record[13] meetingSend['msgcontent'] = record[14] meetingSend['SendUserGuid'] = getFrame_userguid(__conn_oa, record[15]) meetingSend['SendUserName'] = record[16] operatedate = record[17] if operatedate: operatedate = Utils.formatStrToTime(operatedate) if operatedate: operatedate = Utils.fromatTimeToStr(operatedate, "%Y-%m-%d %H:%M:%S") else: operatedate = None meetingSend['operatedate'] = operatedate #通知类型 docWord = record[18] draft = "1" if docWord and docWord != "" and docWord == "常务会议": draft = "0" meetingSend['Draft'] = draft meetingSend['imported'] = "1" #是否是督查通知,默认(0):不是 meetingSend['issupervisor'] = "0" meetingSend['sendState'] = "1" if insertMeetingSend(__conn, meetingSend): counter += 1 print("数据已经插入:%d 条。" % counter) # print(record) # print(meetingSend) # return # pass print(counter) __conn.commitData() __conn.closeConn() __conn_oa.closeConn()