Commit 5993f128 by 蒋勇

d

parent 75708ebb
...@@ -3,6 +3,7 @@ const settings=require("../../../../config/settings"); ...@@ -3,6 +3,7 @@ const settings=require("../../../../config/settings");
var excel = require('exceljs'); var excel = require('exceljs');
const system = require("../../../system"); const system = require("../../../system");
const fs = require('fs'); const fs = require('fs');
const uuid4=require("uuid4")
class ParseRptTask extends TaskBase{ class ParseRptTask extends TaskBase{
constructor(){ constructor(){
super(TaskBase.getServiceName(ParseRptTask)); super(TaskBase.getServiceName(ParseRptTask));
...@@ -57,8 +58,9 @@ async readxls(path) { ...@@ -57,8 +58,9 @@ async readxls(path) {
//下载文件 //下载文件
var keyindex=urldownload.lastIndexOf("/"); var keyindex=urldownload.lastIndexOf("/");
var keystr=urldownload.substring(keyindex+1); var keystr=urldownload.substring(keyindex+1);
var result= await this.ossC.downfile(keystr); var destfile=keystr.replace(/\s/g, '')
var localpath="/tmp/"+keystr; var result= await this.ossC.downfile(keystr,destfile);
var localpath="/tmp/"+destfile
try{ try{
var wb= await this.readxls(localpath); var wb= await this.readxls(localpath);
}catch(e){ }catch(e){
......
...@@ -9,10 +9,11 @@ class OSSClient{ ...@@ -9,10 +9,11 @@ class OSSClient{
}); });
this.client.useBucket('gsb-zc'); this.client.useBucket('gsb-zc');
} }
async downfile(key){ async downfile(key,destfile){
var me=this; var me=this;
var destfile=destfile?destfile:key
var result=await co(function* () { 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;
}); });
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