Commit 5993f128 by 蒋勇

d

parent 75708ebb
......@@ -3,6 +3,7 @@ const settings=require("../../../../config/settings");
var excel = require('exceljs');
const system = require("../../../system");
const fs = require('fs');
const uuid4=require("uuid4")
class ParseRptTask extends TaskBase{
constructor(){
super(TaskBase.getServiceName(ParseRptTask));
......@@ -57,8 +58,9 @@ async readxls(path) {
//下载文件
var keyindex=urldownload.lastIndexOf("/");
var keystr=urldownload.substring(keyindex+1);
var result= await this.ossC.downfile(keystr);
var localpath="/tmp/"+keystr;
var destfile=keystr.replace(/\s/g, '')
var result= await this.ossC.downfile(keystr,destfile);
var localpath="/tmp/"+destfile
try{
var wb= await this.readxls(localpath);
}catch(e){
......
......@@ -9,10 +9,11 @@ class OSSClient{
});
this.client.useBucket('gsb-zc');
}
async downfile(key){
async downfile(key,destfile){
var me=this;
var destfile=destfile?destfile:key
var result=await co(function* () {
var result = yield me.client.get(key, '/tmp/'+key);
var result = yield me.client.get(key, '/tmp/'+destfile);
return result;
});
return result;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment