Commit d3519b27 by 王昆

gsb

parent 251f885f
......@@ -9,6 +9,11 @@ class EntcontractApi {
this.utilesignbaoSve = system.getObject("service.utilesignbaoSve");
}
async syncSignedFile() {
this.entcontractSve.downloadCompleteUrl();
return "start success"
}
async autoSign(pobj) {
// 处理参数
var param = {
......
......@@ -651,6 +651,62 @@ class EntcontractService extends ServiceBase {
data: data || null
}
}
async downloadCompleteUrl(limit) {
var sql = "SELECT id FROM `c_entcontract` WHERE eflowstatus = '2' AND (fileurl IS NULL OR fileurl = '') ORDER BY id DESC ";
if (limit) {
sql = sql + " LIMIT " + limit;
}
var list = await this.dao.customQuery(sql);
if (!list || list.length == 0) {
return;
}
for (var o of list) {
var id = o.id;
try {
var contract = await this.dao.findById(id);
if (!contract) {
continue;
}
if (contract.eflowstatus != "2") {
continue;
}
if (!contract.fileurl) {
// 请求文件地址
let fileRs = await this.utilesignbaoSve.downloadUserContractFile(contract.eflowid, "econtractSve");
if (fileRs.code == 1 && fileRs.data.selfossUrl) {
contract.fileurl = fileRs.data.selfossUrl;
contract.save();
} else {
await this.utilesignbaoSve.archiveProcess({flowId: contract.eflowid}, "econtractSve");
let fileRs = await this.utilesignbaoSve.downloadUserContractFile(contract.eflowid, "econtractSve");
if (fileRs.code == 1 && fileRs.data.selfossUrl) {
contract.fileurl = fileRs.data.selfossUrl;
contract.save();
}
}
}
} catch (e) {
console.error(e);
//日志记录
logCtl.error({
optitle: "定时下载合同任务异常, id=" + id,
op: "app/base/service/impl/econtractSve.js",
content: e.stack,
clientIp: ""
});
return {
code: -200,
message: "error",
data: {}
};
}
}
}
}
module.exports = EntcontractService;
\ No newline at end of file
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