Commit b79710d4 by 王昆

gsb

parent 741c419c
......@@ -19,6 +19,7 @@ class EcontractApi {
this.wxSve = system.getObject("service.wxSve");
this.esettleSve = system.getObject("service.esettleSve");
this.etemplatebusiSve = system.getObject("service.etemplatebusiSve");
this.bankthreelogSve = system.getObject("service.bankthreelogSve");
this.bankthreelog2Sve = system.getObject("service.bankthreelog2Sve");
......@@ -738,25 +739,32 @@ class EcontractApi {
if (!param.idNo) {
return this.returnjson(-1, "请提供该用户身份证号")
}
// else {
// if (!await this.idcardClient.checkIDCard(param.idNo)) {
// return this.returnjson(-1, "身份证格式不正确");
// }
// let card = await this.idcardClient.cardInfo(param.idNo);
// 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岁之间")
// }
// }
// }
if (!await this.idcardClient.checkIDCard(param.idNo)) {
return this.returnjson(-1, "身份证格式不正确");
}
// TODO 赵庆测试
let busiIds = await etemplatebusiSve.busiIdsByTemplateId(param.ecid);
let num = await this.esettleSve.isValidAge(busiIds);
if(num) {
let card = await this.idcardClient.cardInfo(param.idNo);
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岁之间")
}
}
}
// TODO END
if (!param.bankno) {
return this.returnjson(-1, "请提供该用户银行卡号")
}
......
const Dao = require("../dao.base");
class EtemplatebusiDao extends Dao {
constructor() {
super(Dao.getModelName(EtemplatebusiDao));
}
}
module.exports = EtemplatebusiDao;
module.exports = (db, DataTypes) => {
return db.define("etemplatebusi", {
template_type:DataTypes.BIGINT,
template_id:DataTypes.BIGINT,
busi_id:DataTypes.BIGINT,
busi_company_name:DataTypes.BIGINT,
},{
paranoid: true,//假的删除
underscored: true,
version: true,
freezeTableName: true,
//freezeTableName: true,
// define the table's name
tableName: 'c_etemplate_busi',
validate: {
},
indexes:[
// Create a unique index on email
// {
// unique: true,
// fields: ['email']
// },
//
// // Creates a gin index on data with the jsonb_path_ops operator
// {
// fields: ['data'],
// using: 'gin',
// operator: 'jsonb_path_ops'
// },
//
// // By default index name will be [table]_[fields]
// // Creates a multi column partial index
// {
// name: 'public_by_author',
// fields: ['author', 'status'],
// where: {
// status: 'public'
// }
// },
//
// // A BTREE index with a ordered field
// {
// name: 'title_index',
// method: 'BTREE',
// fields: ['author', {attribute: 'title', collate: 'en_US', order: 'DESC', length: 5}]
// }
]
});
}
......@@ -851,6 +851,24 @@ class EsettleService extends ServiceBase {
return getTax;
}
async isValidAge(ids) {
if (!ids || ids.length == 0) {
return 0;
}
let sql = "SELECT COUNT(1) AS num FROM tbl_busi WHERE id IN (:ids) AND age_flag = 1 ";
let list = await this.settledb.query(sql.join(" "), {replacements: {ids: ids}});
if (list && list.length > 0) {
list = list[0, 0] || [];
if (!list || list.length == 0) {
return 0;
}
return list[0].num || 0;
}
return 0;
}
}
module.exports = EsettleService;
\ No newline at end of file
const ServiceBase = require("../sve.base");
class EtemplatebusiService extends ServiceBase {
constructor() {
super(ServiceBase.getDaoName(EtemplatebusiService));
}
async getlist(id) {
var sql = "SELECT * FROM c_etemplate_busi WHERE template_id = " + id;
var page = await this.customQuery(sql);
return page;
}
async busiIdsByTemplateId(id) {
var sql = "SELECT busi_id FROM c_etemplate_busi WHERE template_id = " + id;
var list = await this.customQuery(sql);
let rs = [];
if (!list || list.length == 0) {
return rs;
}
for (let item of list) {
rs.push(item.busi_id);
}
return rs;
}
async getinfo(qobj) {
var sql = "SELECT * FROM c_etemplate_busi WHERE template_id = " + qobj.template_id + " AND busi_id = " + qobj.company_id;
var page = await this.customQuery(sql);
return page;
}
async deleteTetId(qobj) {
let sql = "DELETE FROM c_etemplate_busi WHERE id = " + qobj.id;
await this.customExecAddOrPutSql(sql);
return 1;
}
async suggest(name, ownerIds) {
return await this.dao.suggest(name, ownerIds);
}
async saveto(etebusi) {
return await this.create(etebusi);
}
}
module.exports = EtemplatebusiService;
\ 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