Commit 179dda15 by Sxy

feat: 百度工商套餐

parent 6e2d7343
...@@ -64,6 +64,9 @@ class DeliverybillDao extends Dao { ...@@ -64,6 +64,9 @@ class DeliverybillDao extends Dao {
/*根据交付单编号获取订单详情*/ /*根据交付单编号获取订单详情*/
async findInfoByDeliverCode(qobj) { async findInfoByDeliverCode(qobj) {
var qcwhere = { "delivery_code": qobj.deliverNumber }; var qcwhere = { "delivery_code": qobj.deliverNumber };
if (qobj.productCode) {
qcwhere.product_code = qobj.productCode
}
return await this.findOne(qcwhere); return await this.findOne(qcwhere);
} }
...@@ -133,6 +136,9 @@ class DeliverybillDao extends Dao { ...@@ -133,6 +136,9 @@ class DeliverybillDao extends Dao {
master_source_number: qobj.master_source_number master_source_number: qobj.master_source_number
} }
} }
if (qobj.productCode) {
whereobj.product_code = qobj.productCode;
}
return await this.updateByWhere(setobj, whereobj, t); return await this.updateByWhere(setobj, whereobj, t);
} }
...@@ -154,6 +160,25 @@ class DeliverybillDao extends Dao { ...@@ -154,6 +160,25 @@ class DeliverybillDao extends Dao {
/*插入交付单信息*/ /*插入交付单信息*/
async insertInfo(qobj) {//到时候看交付单信息后再确定 async insertInfo(qobj) {//到时候看交付单信息后再确定
const obj = this.buildContent(qobj);
return await this.create(obj);
}
// 套餐批量插入
async insertInfoPackage(qobj, businessTypes = []) {
let packages = [];
const obj = this.buildContent(qobj);
for (let val of businessTypes) {
packages.push({
...obj,
product_code: val,
is_package: true
});
}
await this.bulkCreate(packages);
return "SUCCESS"
}
buildContent(qobj) {
var obj = { var obj = {
"delivery_code": qobj.deliverNumber, "delivery_code": qobj.deliverNumber,
"delivery_status": qobj.deliverStatus, "delivery_status": qobj.deliverStatus,
...@@ -226,9 +251,10 @@ class DeliverybillDao extends Dao { ...@@ -226,9 +251,10 @@ class DeliverybillDao extends Dao {
if (qobj.statusReason && qobj.statusReason != 'undefined') { if (qobj.statusReason && qobj.statusReason != 'undefined') {
obj.close_reason = qobj.statusReason; obj.close_reason = qobj.statusReason;
} }
return await this.create(obj); return obj;
} }
} }
module.exports = DeliverybillDao; module.exports = DeliverybillDao;
...@@ -66,14 +66,14 @@ module.exports = (db, DataTypes) => { ...@@ -66,14 +66,14 @@ module.exports = (db, DataTypes) => {
allowNull: true, allowNull: true,
type: DataTypes.STRING type: DataTypes.STRING
}, },
master_source_number:{//主订单号 master_source_number: {//主订单号
allowNull: true, allowNull: true,
type: DataTypes.STRING type: DataTypes.STRING
}, },
settle_status: {// 服务单流转状态 settle_status: {// 服务单流转状态
allowNull: true, allowNull: true,
type: DataTypes.STRING, type: DataTypes.STRING,
defaultValue:'waittosettle' defaultValue: 'waittosettle'
}, },
selling_price: {//售价 selling_price: {//售价
allowNull: true, allowNull: true,
...@@ -123,7 +123,10 @@ module.exports = (db, DataTypes) => { ...@@ -123,7 +123,10 @@ module.exports = (db, DataTypes) => {
allowNull: true, allowNull: true,
type: DataTypes.STRING type: DataTypes.STRING
}, },
is_package: {//是否是套餐
type: DataTypes.BOOLEAN,
defaultValue: false
},
}, { }, {
paranoid: false,//假的删除 paranoid: false,//假的删除
underscored: true, underscored: true,
......
...@@ -238,7 +238,17 @@ class DeliverybillService extends ServiceBase { ...@@ -238,7 +238,17 @@ class DeliverybillService extends ServiceBase {
} }
async insertInfo(qobj) {//*插入交付单信息*/从队列取数据的时候用 async insertInfo(qobj) {//*插入交付单信息*/从队列取数据的时候用
return await this.dao.insertInfo(qobj); switch (qobj.businessType) {
case "QYJYTC1":
//工商执照办理、银行开户、税务报到
return await this.dao.insertInfoPackage(qobj, ["companyCase", "openBankAccountCase", "taxCase"]);
case "QYJYTC2":
//工商执照办理、银行开户、税务报到、注册地址服务(一年期)、代理记账(一年期
return await this.dao.insertInfoPackage(qobj, ["companyCase", "openBankAccountCase", "taxCase", "regAddrCase1", "agentCase1"]);
default:
// 非套餐类产品
return await this.dao.insertInfo(qobj);
}
} }
async insertInfoall(pobj) {//*插入交付单信息,大事务*/从队列取数据的时候用 async insertInfoall(pobj) {//*插入交付单信息,大事务*/从队列取数据的时候用
......
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