Commit 13051004 by 孙亚楠

d

parent b406a472
......@@ -24,6 +24,9 @@ class BpoSDPJApi {
this.ccashinfoSve = system.getObject("service.ccashinfoSve");
this.ecompanybusiSve = system.getObject("service.ecompanybusiSve");
this.qrClient = system.getObject("util.qrClient");
this.idcardClient = system.getObject("util.idcardClient");
this.esettleSve = system.getObject("service.esettleSve");
this.tdevApi = require("./tdevApi");
let resultMap = {
0:"操作成功",
1:"操作失败",
......@@ -156,7 +159,9 @@ class BpoSDPJApi {
});
return this.getResult(0,{
id_name:_cCashInfo.id_name,
id_no:_cCashInfo.id_no
id_no:_cCashInfo.id_no,
app_id: _cCashInfo.app_id,
id:_cCashInfo.id
})
}catch (e) {
console.log(e);
......@@ -174,10 +179,36 @@ class BpoSDPJApi {
* @returns {Promise<void>}
*/
async authentication(obj, req){
if(!obj || !obj.id_name || !obj.id_no ){
if(!obj || !obj.id_name || !obj.id_no || !obj.mchtId || !obj.app_id|| !obj.id){
return this.getResult(1002001,null);
}
try{
if (!await this.idcardClient.checkIDCard(obj.id_no)) {
return this.returnjson(-1, "身份证格式不正确");
}
let num = await this.esettleSve.isValidAge([obj.mchtId]);
if(num) {
let card = await this.idcardClient.cardInfo(obj.id_no);
let age = card.age || 0;
if(!age) {
return this.returnjson(-1, "身份证号格式错误, 只支持18位身份证号码");
}
if(card.sex == 'male') {
if (age < 18 || age > 60) {
return this.returnjson(-1, "签约失败,男限制18-60岁之间")
}
} else {
if (age < 18 || age > 55) {
return this.returnjson(-1, "签约失败,女限制18-55岁之间")
}
}
}
let doAuthRes = await this.tdevApi.doAuth({idName:this.trim(obj.id_name),idNo:this.trim(obj.id_no)},{ app_id:obj.app_id});
//异步推送信息
pushAsync(obj);
}catch (e) {
console.log(e);
......@@ -191,6 +222,25 @@ class BpoSDPJApi {
}
/**
* fn:异步同送信息
* @param params
*/
pushAsync(params){
/**
* fn:签约
*/
let res = this.tdevApi.doSign3(params);
/**
* fn:更新验证信息 人名 身份证号
*/
this.ccashinfoSve.update(params);
}
getResult(code,data={},other={}){
......
......@@ -50,10 +50,10 @@ class TDEVApi {
// 专票签(三方签)
let signParam = {
ecid: this.trim(cashInfo.ecid),
appId: this.trim(cashInfo.appId),
userId: this.trim(cashInfo.idNo),
idName: this.trim(cashInfo.idName),
idNo: this.trim(cashInfo.idNo),
appId: this.trim(cashInfo.app_id),
userId: this.trim(cashInfo.id_no),
idName: this.trim(cashInfo.id_name),
idNo: this.trim(cashInfo.id_no),
};
try {
let key = `${cashInfo.mcthId}_${cashInfo.outTradeNo}`;
......
......@@ -58,6 +58,47 @@ class CcashinfoSve extends ServiceBase {
}
}
/**
* fn:跟新缓存记录
* @param params
* @returns {Promise<void>}
*/
async update(params){
try{
console.log(`跟新【${params.id}】参数` + JSON.stringify(params));
if(!params.id){
return null;
}
let bean = await this.dao.model.findOne({
where:{
id:this.trim(params.id)
}
});
if(!bean){
console.log(`跟新纪录失败 记录【${params.id}】信息不存在 `);
return ;
}
let properties = {
id: this.trim(params.id)
};
if(params.id_name){
properties.id_name=this.trim(params.id_name)
}
if(params.id_no){
properties.id_no=this.trim(params.id_no)
}
if(params.contract_id){
properties.contract_id=this.trim(params.contract_id)
}
await this.dao.update(properties)
return {code:0,null}
}catch (e) {
console.log(e);
return null;
}
}
}
......
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