Commit 61ebcf44 by zhaoxiqing

gsb

parent d05f3668
...@@ -19,7 +19,7 @@ class YZContractApi { ...@@ -19,7 +19,7 @@ class YZContractApi {
async syncSignedFile() { async syncSignedFile() {
this.entcontractSve.downloadCompleteUrl(); this.entcontractSve.downloadCompleteUrl();
return "start success" return "start success";
} }
async merchantSign(pobj) { async merchantSign(pobj) {
...@@ -176,7 +176,6 @@ class YZContractApi { ...@@ -176,7 +176,6 @@ class YZContractApi {
if (param.sign != sign) { if (param.sign != sign) {
return this.returnjson(1001001, "签名错误"); return this.returnjson(1001001, "签名错误");
} }
try { try {
var result = await this.econtractSve.autoSignNoBank(param); var result = await this.econtractSve.autoSignNoBank(param);
return result; return result;
......
...@@ -33,10 +33,10 @@ module.exports = (db, DataTypes) => { ...@@ -33,10 +33,10 @@ module.exports = (db, DataTypes) => {
begin_at: DataTypes.DATE, begin_at: DataTypes.DATE,
end_at: DataTypes.DATE, end_at: DataTypes.DATE,
isPush: { // isPush: {
type: DataTypes.BOOLEAN, // type: DataTypes.BOOLEAN,
defaultValue: true // defaultValue: true
}, // },
}, { }, {
paranoid: true, //假的删除 paranoid: true, //假的删除
underscored: true, underscored: true,
...@@ -78,4 +78,4 @@ module.exports = (db, DataTypes) => { ...@@ -78,4 +78,4 @@ module.exports = (db, DataTypes) => {
// } // }
] ]
}); });
} }
\ No newline at end of file
...@@ -203,7 +203,7 @@ class EntcontractService extends ServiceBase { ...@@ -203,7 +203,7 @@ class EntcontractService extends ServiceBase {
return this.returnjson(-1, tt.message || "签约失败", tt.code); return this.returnjson(-1, tt.message || "签约失败", tt.code);
} }
async createYzMerchant(params) { async createYzMerchant(params) {
var data = { var data = {
...@@ -293,8 +293,8 @@ class EntcontractService extends ServiceBase { ...@@ -293,8 +293,8 @@ class EntcontractService extends ServiceBase {
"posturl": "" "posturl": ""
}); });
} }
let temp = await this.etemplateDao.findById(10222); let temp = await this.etemplateDao.findById(10222);
let template = await this.etemplateDao.findOne({ let template = await this.etemplateDao.findOne({
ecompany_id: ecompany.id, ecompany_id: ecompany.id,
...@@ -556,8 +556,6 @@ class EntcontractService extends ServiceBase { ...@@ -556,8 +556,6 @@ class EntcontractService extends ServiceBase {
}, },
} }
return res; return res;
} }
// e签宝流程 // e签宝流程
...@@ -708,6 +706,7 @@ class EntcontractService extends ServiceBase { ...@@ -708,6 +706,7 @@ class EntcontractService extends ServiceBase {
} }
if (!contract.fileurl) { if (!contract.fileurl) {
await this.syncYzSign(2134);
// 请求文件地址 // 请求文件地址
let fileRs = await this.utilesignbaoSve.downloadUserContractFile(contract.eflowid, "econtractSve"); let fileRs = await this.utilesignbaoSve.downloadUserContractFile(contract.eflowid, "econtractSve");
if (fileRs.code == 1 && fileRs.data.selfossUrl) { if (fileRs.code == 1 && fileRs.data.selfossUrl) {
...@@ -753,35 +752,35 @@ class EntcontractService extends ServiceBase { ...@@ -753,35 +752,35 @@ class EntcontractService extends ServiceBase {
if (!account) { if (!account) {
return null; return null;
} }
// 查用户 // 查用户
var user = await this.userDao.findById(account.user_id); var user = await this.userDao.findById(account.user_id);
// 查商户签约返回值 // 查商户签约返回值
let signInfo = this.yzmerchantsignedDao.findOne({entcontract_id: contractId}); let signInfo =await this.yzmerchantsignedDao.findOne({entcontract_id: contractId});
if (!signInfo) {
return null;
}
// 获取yz配置 // 获取yz配置
let conf = this.getAppConfig(); let conf = await this.getAppConfig();
// 推送数据 // 推送数据
var param = { var param = {
"appId": conf.appId, // appId "appId": conf.appId, // appId
"merchantName": signInfo.companyName, // 有赞商户名称 "merchantName": signInfo.companyName, // 有赞商户名称
"merchantId": user.userId3rd, // 有赞商户id "merchantId": user.userId3rd, // 有赞商户id
"fileUrl": contract.fileurl, // 签约合同pdf文件 "fileUrl": contract.fileurl, // 签约合同pdf文件
"idName": account.userName, // 代理人姓名 "idName": account.userName, // 代理人姓名
"idNo": account.personsSign, // 代理人身份证 "idNo": account.personsSign, // 代理人身份证
"mobile" : account.mobile, //代理人手机号
"nonceStr": await this.getUidStr(16), // 随机码 "nonceStr": await this.getUidStr(16), // 随机码
"beginDate": await this.formateTime(contract.begin_at), // 合同开始时间 "beginDate": await this.formateTime(contract.begin_at), // 合同开始时间
"endDate": await this.formateTime(contract.end_at), // 合同结束时间 "endDate": await this.formateTime(contract.end_at), // 合同结束时间
} };
// 签名 // 签名
var signArr = []; var signArr = [];
signArr.push("appId=" + param.appId); signArr.push("appId=" + param.appId);
// ...补全签名信息 // ...补全签名信息
signArr.push("nonceStr=" + param.nonceStr); signArr.push("nonceStr=" + param.nonceStr);
signArr.push("key=" + busi.key); signArr.push("key=" + this.YZKEY);
param.sign = md5(signArr.join("&")).toUpperCase(); param.sign = md5(signArr.join("&")).toUpperCase();
console.log(JSON.stringify(param)); console.log(JSON.stringify(param));
var rs = ""; var rs = "";
...@@ -802,6 +801,22 @@ class EntcontractService extends ServiceBase { ...@@ -802,6 +801,22 @@ class EntcontractService extends ServiceBase {
} }
} }
async formateTime(inputTime) {
var date = new Date(inputTime);
var y = date.getFullYear();
var m = date.getMonth() + 1;
m = m < 10 ? ('0' + m) : m;
var d = date.getDate();
d = d < 10 ? ('0' + d) : d;
var h = date.getHours();
h = h < 10 ? ('0' + h) : h;
var minute = date.getMinutes();
var second = date.getSeconds();
minute = minute < 10 ? ('0' + minute) : minute;
second = second < 10 ? ('0' + second) : second;
return y + '-' + m + '-' + d + ' ' + h + ':' + minute + ':' + second;
}
} }
module.exports = EntcontractService; 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