Commit 937a74c9 by 王昆

gsb

parent b5128458
...@@ -18,7 +18,7 @@ class TestApi { ...@@ -18,7 +18,7 @@ class TestApi {
async testAddDL(obj) { async testAddDL(obj) {
let contracts = obj.contracts || []; let contracts = obj.contracts || [];
for(let p of contracts) { for(let p of contracts) {
await this.redisClient.rpush("bpo:contract:download", JSON.stringify(p)); await this.downcontractClient.download(p);
} }
return {msg: "success"} return {msg: "success"}
} }
......
...@@ -16,6 +16,8 @@ class DKcontractService extends ServiceBase { ...@@ -16,6 +16,8 @@ class DKcontractService extends ServiceBase {
this.userDao = system.getObject("db.userDao"); this.userDao = system.getObject("db.userDao");
this.restClient = system.getObject("util.restClient"); this.restClient = system.getObject("util.restClient");
this.redisClient = system.getObject("util.redisClient");
} }
async getInfo(id) { async getInfo(id) {
...@@ -235,6 +237,8 @@ class DKcontractService extends ServiceBase { ...@@ -235,6 +237,8 @@ class DKcontractService extends ServiceBase {
end_at.setFullYear(end_at.getFullYear() + 1); end_at.setFullYear(end_at.getFullYear() + 1);
contract.end_at = end_at; contract.end_at = end_at;
// 合同下载任务
this.redisClient.rpushBCD({id: contract.id, sve: "dk"});
await contract.save(); await contract.save();
} catch (e) { } catch (e) {
logCtl.error({ logCtl.error({
......
...@@ -32,6 +32,8 @@ class EcontractService extends ServiceBase { ...@@ -32,6 +32,8 @@ class EcontractService extends ServiceBase {
this.eSignBaoRedirectBossUrl = settings.apiconfig.eSignBaoRedirectBossUrl(); this.eSignBaoRedirectBossUrl = settings.apiconfig.eSignBaoRedirectBossUrl();
this.redisClient = system.getObject("util.redisClient");
this.ydCompanyIds = [ this.ydCompanyIds = [
10173, 10173,
10174, 10174,
...@@ -271,6 +273,10 @@ class EcontractService extends ServiceBase { ...@@ -271,6 +273,10 @@ class EcontractService extends ServiceBase {
contract.end_at = end_at; contract.end_at = end_at;
contract.save(); contract.save();
// TODO DOWNLOAD OK
this.redisClient.rpushBCD({id: contract.id, sve: "e"});
// }
} }
} catch (error) { } catch (error) {
...@@ -518,13 +524,9 @@ class EcontractService extends ServiceBase { ...@@ -518,13 +524,9 @@ class EcontractService extends ServiceBase {
} }
if (signResult == "2") { if (signResult == "2") {
// TODO WANGKUN 改定时任务获取 // TODO DOWNLOAD OK
// let fileRs = await this.utilesignbaoSve.downloadUserContractFile(contract.eflowid, "econtractSve"); this.redisClient.rpushBCD({id: contract.id, sve: "e"});
// console.log(fileRs, "---------------------------------------------------");
// if(fileRs.code == 1 && fileRs.data.selfossUrl) {
// contract.fileurl = fileRs.data.selfossUrl;
// contract.save();
// }
try { try {
this.updateApply(contract.id); this.updateApply(contract.id);
} catch (error) { } catch (error) {
...@@ -1453,6 +1455,8 @@ class EcontractService extends ServiceBase { ...@@ -1453,6 +1455,8 @@ class EcontractService extends ServiceBase {
await econtract.save(); await econtract.save();
this.syncSign(econtract.id); this.syncSign(econtract.id);
// TODO DOWNLOAD OK
this.redisClient.rpushBCD({id: econtract.id, sve: "e"});
return this.returnjson(0, "success", { return this.returnjson(0, "success", {
contractId: econtract.id contractId: econtract.id
}); });
...@@ -1638,6 +1642,8 @@ class EcontractService extends ServiceBase { ...@@ -1638,6 +1642,8 @@ class EcontractService extends ServiceBase {
econtract.end_at = end_at; econtract.end_at = end_at;
await econtract.save(); await econtract.save();
// TODO DOWNLOAD OK
this.redisClient.rpushBCD({id: econtract.id, sve: "e"});
return this.returnjson(0, "success", { return this.returnjson(0, "success", {
contractId: econtract.id contractId: econtract.id
}); });
...@@ -1810,6 +1816,9 @@ class EcontractService extends ServiceBase { ...@@ -1810,6 +1816,9 @@ class EcontractService extends ServiceBase {
await econtract.save(); await econtract.save();
this.syncSign(econtract.id); this.syncSign(econtract.id);
// TODO DOWNLOAD OK
this.redisClient.rpushBCD({id: econtract.id, sve: "e"});
return this.returnjson(0, "success", { return this.returnjson(0, "success", {
contractId: econtract.id contractId: econtract.id
}); });
...@@ -2015,6 +2024,9 @@ class EcontractService extends ServiceBase { ...@@ -2015,6 +2024,9 @@ class EcontractService extends ServiceBase {
await econtract.save(); await econtract.save();
this.syncSign(econtract.id); this.syncSign(econtract.id);
// TODO DOWNLOAD
this.redisClient.rpushBCD({id: econtract.id, sve: "e"});
return this.returnjson(0, "success", { return this.returnjson(0, "success", {
contractId: econtract.id contractId: econtract.id
}); });
......
...@@ -29,6 +29,8 @@ class EntcontractService extends ServiceBase { ...@@ -29,6 +29,8 @@ class EntcontractService extends ServiceBase {
this.YZKEY = "4a112ce87c38464d8d454caf23b7b31f"; this.YZKEY = "4a112ce87c38464d8d454caf23b7b31f";
this.YZHDURL = "http://bifrost-youzan-gateway.qa.s.qima-inc.com/api/auth_exempt/youzan.pay.finance.tax.sign.merchant.gsb.notify/1.0.0"; this.YZHDURL = "http://bifrost-youzan-gateway.qa.s.qima-inc.com/api/auth_exempt/youzan.pay.finance.tax.sign.merchant.gsb.notify/1.0.0";
this.redisClient = system.getObject("util.redisClient");
} }
async getAppConfig() { async getAppConfig() {
...@@ -196,6 +198,9 @@ class EntcontractService extends ServiceBase { ...@@ -196,6 +198,9 @@ class EntcontractService extends ServiceBase {
entcontract.end_at = end_at; entcontract.end_at = end_at;
await entcontract.save(); await entcontract.save();
// 合同下载任务
this.redisClient.rpushBCD({id: entcontract.id, sve: "ent"});
// this.syncSign(entcontract.id); // this.syncSign(entcontract.id);
// return await this.createMerchant(params); 暂时先不用了 // return await this.createMerchant(params); 暂时先不用了
// return this.returnjson(0, "success", { // return this.returnjson(0, "success", {
...@@ -682,6 +687,10 @@ class EntcontractService extends ServiceBase { ...@@ -682,6 +687,10 @@ class EntcontractService extends ServiceBase {
params.toAppId = enttemplate.appid; params.toAppId = enttemplate.appid;
params.toMcthid = enttemplate.mcthid; params.toMcthid = enttemplate.mcthid;
params.key = enttemplate.key; params.key = enttemplate.key;
// 合同下载任务
this.redisClient.rpushBCD({id: entcontract.id, sve: "ent"});
return await this.createYzMerchant(params); return await this.createYzMerchant(params);
// return this.returnjson(0, "success", { // return this.returnjson(0, "success", {
// contractId: entcontract.id // contractId: entcontract.id
......
...@@ -8,6 +8,7 @@ const redisClient = system.getObject("util.redisClient"); ...@@ -8,6 +8,7 @@ const redisClient = system.getObject("util.redisClient");
// const logCtl=system.getObject("web.oplogCtl"); // const logCtl=system.getObject("web.oplogCtl");
class DownContractClient { class DownContractClient {
constructor() { constructor() {
this.DOWNLOAD_KEY = "bpo:contract:download";
this.KEY = "DOWN_LOAD_CONTRACT_KEY"; this.KEY = "DOWN_LOAD_CONTRACT_KEY";
this.sve = { this.sve = {
e: system.getObject("service.econtractSve"), e: system.getObject("service.econtractSve"),
...@@ -33,13 +34,13 @@ class DownContractClient { ...@@ -33,13 +34,13 @@ class DownContractClient {
} }
async doDownLoad() { async doDownLoad() {
let len = await redisClient.llen("bpo:contract:download") || 0; let len = await redisClient.llen(this.DOWNLOAD_KEY) || 0;
if (!len) { if (!len) {
redisClient.delete(this.KEY); redisClient.delete(this.KEY);
return; return;
} }
for (let i = 0; i < len; i++) { for (let i = 0; i < len; i++) {
let item = await redisClient.rpop("bpo:contract:download"); let item = await redisClient.rpop(this.DOWNLOAD_KEY);
console.log(item); console.log(item);
item = JSON.parse(item); item = JSON.parse(item);
try { try {
......
...@@ -216,6 +216,10 @@ class RedisClient{ ...@@ -216,6 +216,10 @@ class RedisClient{
return await this.client.blpopAsync(key, d); return await this.client.blpopAsync(key, d);
} }
async rpushBCD(v) {
this.rpush("bpo:contract:download", JSON.stringify(v));
}
} }
module.exports=RedisClient; module.exports=RedisClient;
// var client=new RedisClient(); // var client=new RedisClient();
......
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