Commit 36b43aec by 蒋勇

Merge branch 'fi-taxctl' of gitlab.gongsibao.com:jiangyong/zhichan into fi-taxctl

parents 878e3717 ad70da8e
...@@ -70,8 +70,10 @@ class RptAPI extends APIBase{ ...@@ -70,8 +70,10 @@ class RptAPI extends APIBase{
return system.getResult(x); return system.getResult(x);
} }
async saveRptHistory(pobj,query){ async saveRptHistory(pobj,query){
var x=await this.rptService.saveRptHistory(pobj); pobj.forEach(async (hs)=>{
return system.getResult(x); await this.rptService.saveRptHistory(hs);
});
return system.getResult({});
} }
async queryStatus(pobj,query){ async queryStatus(pobj,query){
console.log(JSON.stringify(pobj)); console.log(JSON.stringify(pobj));
......
...@@ -5,6 +5,7 @@ class RptTypeService extends ServiceBase{ ...@@ -5,6 +5,7 @@ class RptTypeService extends ServiceBase{
constructor(){ constructor(){
super("rpt",ServiceBase.getDaoName(RptTypeService)); super("rpt",ServiceBase.getDaoName(RptTypeService));
this.redisClient=system.getObject("util.redisClient"); this.redisClient=system.getObject("util.redisClient");
this.cacheBatchId={};
} }
async deleteUrlsCache(){ async deleteUrlsCache(){
await this.redisClient.delete("docurls"); await this.redisClient.delete("docurls");
...@@ -16,7 +17,13 @@ class RptTypeService extends ServiceBase{ ...@@ -16,7 +17,13 @@ class RptTypeService extends ServiceBase{
var hisarray=[]; var hisarray=[];
var rptid=hs.rptid; var rptid=hs.rptid;
var batchid=hs.batchid; var batchid=hs.batchid;
var batch=await this.db.models.uploadbatch.findById(batchid); var batch=null;
if(!this.cacheBatchId[batchid]){
batch=await this.db.models.uploadbatch.findOne({where:{id:batchid},transaction:t});
this.cacheBatchId[batchid]=batch;
}else{
batch=this.cacheBatchId[batchid];
}
var hisdata=hs.hisdata; var hisdata=hs.hisdata;
var rptdate=hs.rptdate; var rptdate=hs.rptdate;
var rptcode=hs.rptcode; var rptcode=hs.rptcode;
...@@ -52,10 +59,10 @@ class RptTypeService extends ServiceBase{ ...@@ -52,10 +59,10 @@ class RptTypeService extends ServiceBase{
})); }));
console.log(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>sended..........."); console.log(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>sended...........");
await self.redisClient.delete("batch"+batchid); self.redisClient.delete("batch"+batchid);
//改变批的状态为解析完毕 //改变批的状态为解析完毕
batch.batchstatuscode="calc"; batch.batchstatuscode="calc";
await batch.save(); await batch.save({transaction:t});
} }
return {}; return {};
}); });
...@@ -92,6 +99,19 @@ class RptTypeService extends ServiceBase{ ...@@ -92,6 +99,19 @@ class RptTypeService extends ServiceBase{
} }
} }
buildRpt(rpt,upinfo,comp,batchtemp){
var rptupload={
companyname:upinfo.companyName,
companycode:upinfo.companyTaxNum,
rpttypecode:rpt.code,
timetypecode:upinfo.dateType,
urlpath:rpt.url,
rptdate:rpt.date?rpt.date:'toparse',
company_id:comp.id,
uploadbatch_id:batchtemp.id,
}
return rptupload;
}
async saveRpt(upinfo){ async saveRpt(upinfo){
return this.db.transaction(async t=>{ return this.db.transaction(async t=>{
//构建批量对象 //构建批量对象
...@@ -113,6 +133,7 @@ class RptTypeService extends ServiceBase{ ...@@ -113,6 +133,7 @@ class RptTypeService extends ServiceBase{
timetypecode:upinfo.dateType, timetypecode:upinfo.dateType,
accountstandardcode:upinfo.accountingType, accountstandardcode:upinfo.accountingType,
company_id:comp.id, company_id:comp.id,
// userkey:null
} }
//保存批量 //保存批量
var batchtemp=await this.db.models.uploadbatch.create(batchobj,{transaction:t}); var batchtemp=await this.db.models.uploadbatch.create(batchobj,{transaction:t});
...@@ -121,19 +142,15 @@ class RptTypeService extends ServiceBase{ ...@@ -121,19 +142,15 @@ class RptTypeService extends ServiceBase{
{ {
if(k.indexOf("Report")>=0){ if(k.indexOf("Report")>=0){
var rpts=upinfo[k]; var rpts=upinfo[k];
rpts.forEach(rpt=>{ var esrpts=rpts["essential"];
var rptupload={ var unesrpts=rpts["unessential"];
companyname:upinfo.companyName, esrpts.forEach(rpt=>{
companycode:upinfo.companyTaxNum, var tmprpt=this.buildRpt(rpt,upinfo,comp,batchtemp);
rpttypecode:rpt.code, rptresult.push(tmprpt);
timetypecode:upinfo.dateType, });
urlpath:rpt.url, unesrpts.forEach(rpt=>{
rptdate:rpt.date, var tmprpt=this.buildRpt(rpt,upinfo,comp,batchtemp);
company_id:comp.id, rptresult.push(tmprpt);
uploadbatch_id:batchtemp.id,
}
rptresult.push(rptupload);
}); });
} }
} }
......
...@@ -3,7 +3,7 @@ var settings={ ...@@ -3,7 +3,7 @@ var settings={
host: "43.247.184.32", host: "43.247.184.32",
port: 8967, port: 8967,
password: "Gongsibao2018", password: "Gongsibao2018",
db: 2, db: 15,
}, },
database: { database: {
dbname: "fktaxctl", dbname: "fktaxctl",
...@@ -21,10 +21,8 @@ var settings={ ...@@ -21,10 +21,8 @@ var settings={
idle: 1000000 idle: 1000000
}, },
debug: false, debug: false,
dialectOptions: { logging:false
requestTimeout: 999999,
// instanceName:'DEV'
} //设置MSSQL超时时间
} }
}, },
reqEsDevUrl:"http://192.168.4.249:9200/", reqEsDevUrl:"http://192.168.4.249:9200/",
......
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