Commit 8b463fd1 by 孙亚楠

dd

parent 52133279
const system = require("../../../system");
const Dao = require("../../dao.base");
class OproductDao extends Dao {
constructor() {
super(Dao.getModelName(OproductDao));
}
}
module.exports = OproductDao;
\ No newline at end of file
const system = require("../../../system");
const Dao = require("../../dao.base");
class OproductprocessDao extends Dao {
constructor() {
super(Dao.getModelName(OproductprocessDao));
}
/**
* 根据 productId 和 status 查询 商品
* @param {*} productId
* @param {*} status
*/
async findByProductIdAndStatus(productId,status){
try {
let _productProcess =await this.model.findOne({where:{
productId:productId,
status:status
}});
return _productProcess || {};
} catch (error) {
console.log(`系统错误 错误信息 ${error}`);
return {};
}
}
}
module.exports = OproductprocessDao;
\ No newline at end of file
'use strict'
/**
* 订单信息明细表
*/
module.exports = function (db, DataTypes) {
return db.define('obusinessmen', {
orderId: {type: DataTypes.STRING, field: 'order_id', allowNull: true, defaultValue:'',comment:'订单id' },
merchantId: {type: DataTypes.STRING, field: 'merchant_id', allowNull: true, comment:'商户id 为了司机宝' },
channelOrderNo: { type: DataTypes.STRING, field: 'channel_order_no', allowNull: true, defaultValue:'', comment:'渠道订单号 为了司机宝'},
status: {type: DataTypes.STRING, field: 'status', allowNull: true,defaultValue:'2000', comment:'业务状态: 2000办理中, 2010待签约, 2020已完成' },
legalName: { type: DataTypes.STRING, field: 'legal_name', allowNull: false,defaultValue:'', comment:'法人姓名'},
legalMobile: {type: DataTypes.STRING, field: 'legal_mobile', allowNull: true,defaultValue:'', comment:'法人电话'},
legalIdCard: { type: DataTypes.STRING, field: 'legalId_card', allowNull: true, defaultValue:'',comment:'法人身份证号'},
name: {type: DataTypes.STRING, field: 'name', allowNull: true, defaultValue:'',comment:'个体工商户名称' },
creditCode: { type: DataTypes.STRING, field: 'credit_code', allowNull: true, defaultValue:'', comment:'统一社会信用代码'},
businessPlace: {type: DataTypes.STRING, field: 'business_place', allowNull: true, defaultValue:'', comment:'经营场所' },
businessScope: {type: DataTypes.STRING, field: 'business_scope', allowNull: true, defaultValue:'', comment:'经营范围' },
regDate: {type: DataTypes.DATE, field: 'reg_date', allowNull: true, defaultValue:'', comment:'注册日期' },
businessImg: {type: DataTypes.STRING, field: 'business_img', allowNull: true, defaultValue:'', comment:'执照照片' },
businessGovFile: {type: DataTypes.STRING, field: 'business_gov_file', allowNull: true, defaultValue:'', comment:'工商官方文件' },
gongzhang: {type: DataTypes.STRING, field: 'gongzhang', allowNull: true, defaultValue:'', comment:'公章' },
caiwuzhang: {type: DataTypes.STRING, field: 'caiwuzhang', allowNull: true, defaultValue:'', comment:'财务章' },
fapiaozhang: {type: DataTypes.STRING, field: 'fapiaozhang', allowNull: true, defaultValue:'', comment:'发票章' },
hetongzhang: {type: DataTypes.STRING, field: 'hetongzhang', allowNull: true, defaultValue:'', comment:'合同章' },
farenzhang: {type: DataTypes.STRING, field: 'farenzhang', allowNull: true, defaultValue:'', comment:'法人章' },
zhangGovFile: {type: DataTypes.STRING, field: 'zhang_gov_file', allowNull: true, defaultValue:'', comment:'刻章官方文件' },
isBank: {type: DataTypes.BOOLEAN, field: 'is_bank', allowNull: true, defaultValue:false, comment:'是否开户' },
bankName: {type: DataTypes.STRING, field: 'bank_name', allowNull: true, defaultValue:'', comment:'账户名称' },
bankNo: {type: DataTypes.STRING, field: 'bank_no', allowNull: true, defaultValue:'', comment:'账户号' },
bank: {type: DataTypes.STRING, field: 'bank', allowNull: true, defaultValue:'', comment:'开户行' },
bankImg: {type: DataTypes.STRING, field: 'bank_img', allowNull: true, defaultValue:'', comment:'账户信息' },
bankGovFile: {type: DataTypes.STRING, field: 'bank_gov_file', allowNull: true, defaultValue:'', comment:'银行开户官方文件' },
caImg: {type: DataTypes.STRING, field: 'ca_img', allowNull: true, defaultValue:'', comment:'CA照片' },
taxRegDay: {type: DataTypes.DATE, field: 'tax_reg_day', allowNull: true, defaultValue:'', comment:'税务登记日' },
taxOrg: {type: DataTypes.STRING, field: 'tax_org', allowNull: true, defaultValue:'', comment:'税务机构名称' },
taxGovFile: {type: DataTypes.STRING, field: 'tax_gov_file', allowNull: true, defaultValue:'', comment:'税务报道官方文件' },
notes: {type: DataTypes.STRING, field: 'notes', allowNull: true, defaultValue:'', comment:'备注' },
commonTaxLadder: {type: DataTypes.STRING, field: 'common_tax_ladder', allowNull: true, defaultValue:'', comment:'普票个税阶梯' },
commonOtherLadder: {type: DataTypes.STRING, field: 'common_other_ladder', allowNull: true, defaultValue:'', comment:'普票增值税、附加税阶梯' },
specialTaxLadder: {type: DataTypes.STRING, field: 'special_tax_ladder', allowNull: true, defaultValue:'', comment:'专票个税阶梯' },
specialOtherLadder: {type: DataTypes.STRING, field: 'special_other_ladder', allowNull: true, defaultValue:'', comment:'专票增值税、附加税阶梯' },
serviceBeginTime: {type: DataTypes.DATE, field: 'service_begin_time', allowNull: true, defaultValue:null, comment:'服务开始时间' },
serviceEndTime: {type: DataTypes.DATE, field: 'service_end_time', allowNull: true, defaultValue:null, comment:'服务结束时间' },
costRate: {type: DataTypes.INTEGER, field: 'cost_rate', allowNull: true, defaultValue:0, comment:'核定成本费用率' },
taxRate: {type: DataTypes.INTEGER, field: 'tax_rate', allowNull: true, defaultValue:0, comment:'服务开始时间' },
addValueUpType: {type: DataTypes.STRING, field: 'add_value_up_type', allowNull: true, defaultValue:'1', comment:'增值税累计类型 1按月 2按季度' },
taxUpType: {type: DataTypes.STRING, field: 'tax_up_type', allowNull: true, defaultValue:'1', comment:'个税累计类型 1按月累计 2按年累计' },
serviceRate: {type: DataTypes.INTEGER, field: 'service_rate', allowNull: true, defaultValue:0, comment:'服务费比例' },
signNotes: {type: DataTypes.STRING, field: 'sign_notes', allowNull: true, defaultValue:'', comment:'签约备注' },
signTime: {type: DataTypes.DATE, field: 'sign_time', allowNull: true, defaultValue:null, comment:'签约时间' },
createdAt: { type: DataTypes.DATE, field: 'created_at', allowNull: false, defaultValue: DataTypes.NOW },
updatedAt: { type: DataTypes.DATE, field: 'updated_at', allowNull: false, defaultValue: DataTypes.NOW },
deletedAt: { type: DataTypes.DATE, field: 'deleted_at', allowNull: true }
},
{
timestamps: true,
underscore: true,
paranoid: true,
version: true,
tableName: 'o_businessmen',
comment: '个体户表',
});
}
'use strict'
/**
* 订单表
*/
module.exports = function (db, DataTypes) {
return db.define('oorder', {
merchantId: {type: DataTypes.STRING, field: 'merchant_id', allowNull: true, defaultValue:'',comment:'商户id, 为了兼容司机宝' },
channelOrderNo: {type: DataTypes.STRING, field: 'order_id', allowNull: true, comment:'订单ID' },
type: { type: DataTypes.INTEGER, field: 'type', allowNull: true, defaultValue:0, comment:'订单类型'},
busiType: {type: DataTypes.STRING, field: 'busi_type', allowNull: true,defaultValue:'', comment:'业务类型 1个体户 2...暂不知道' },
busiId: { type: DataTypes.STRING, field: 'busi_id', allowNull: false,defaultValue:'', comment:'业务id'},
productId: {type: DataTypes.BIGINT, field: 'product_id', allowNull: true,defaultValue:0, comment:'产品id'},
price: { type: DataTypes.BIGINT, field: 'price', allowNull: true, defaultValue:0,comment:'订单价格'},
status: {type: DataTypes.INTEGER, field: 'status', allowNull: true, defaultValue:'0',comment:'订单状态 1待分配 2待完善信息' },
processStatus: { type: DataTypes.STRING, field: 'process_status', allowNull: true, defaultValue:'0', comment:'业务状态 关联o_order_process表'},
assignTime: {type: DataTypes.DATE, field: 'assign_time', allowNull: true, defaultValue:null, comment:'分配时间' },
assignUserId: {type: DataTypes.BIGINT, field: 'assign_user_id', allowNull: true, defaultValue:'0', comment:'分配人id' },
deliverId: {type: DataTypes.STRING, field: 'deliver_id', allowNull: true, defaultValue:'', comment:'交付商id common微服务下' },
desc: {type: DataTypes.STRING, field: 'desc', allowNull: true, defaultValue:'', comment:'订单信息' },
bdId: {type: DataTypes.STRING, field: 'bd_id', allowNull: true, defaultValue:'', comment:'业务员id' },
bdPath: {type: DataTypes.BIGINT, field: 'bd_path', allowNull: true, defaultValue:'', comment:'业务员权限路径' },
createdAt: { type: DataTypes.DATE, field: 'created_at', allowNull: false, defaultValue: DataTypes.NOW },
updatedAt: { type: DataTypes.DATE, field: 'updated_at', allowNull: false, defaultValue: DataTypes.NOW },
deletedAt: { type: DataTypes.DATE, field: 'deleted_at', allowNull: true }
},
{
timestamps: true,
underscore: true,
paranoid: true,
version: true,
tableName: 'o_order',
comment: '订单表',
});
}
'use strict'
/**
* 订单交付表
*/
module.exports = function (db, DataTypes) {
return db.define('oorderdeliver', {
orderId: {type: DataTypes.STRING, field: 'order_id', allowNull: false,comment:'订单ID' },
deliverId: {type: DataTypes.STRING, field: 'deliver_id', allowNull: false, comment:'交付商id' },
deliverName: { type: DataTypes.STRING, field: 'deliver_name', allowNull: false, comment:'交付商名称'},
deliverDivide: {type: DataTypes.STRING, field: 'deliver_divide', allowNull: false,comment:'订单分成' },
auditResult: { type: DataTypes.STRING, field: 'audit_result', allowNull: true,defaultValue:'', comment:'审核结果'},
auditRemark: {type: DataTypes.STRING, field: 'audit_remark', allowNull: true,defaultValue:'', comment:'交付审核备注'},
deliverMailAddr: { type: DataTypes.STRING, field: 'deliver_mail_addr', allowNull: true, defaultValue:'',comment:'交付地址'},
deliverMailTo: {type: DataTypes.STRING, field: 'deliver_mail_to', allowNull: true, defaultValue:'',comment:'收件人' },
deliverMailMobile: { type: DataTypes.STRING, field: 'deliver_mail_mobile', allowNull: true, defaultValue:'', comment:'联系电话'},
deliverContent: {type: DataTypes.STRING, field: 'deliver_content', allowNull: true, defaultValue:'', comment:'交付内容' },
deliverMailNo: {type: DataTypes.STRING, field: 'deliver_mail_no', allowNull: true, defaultValue:'', comment:'交付商交付快递单号' },
deliverMailImg: {type: DataTypes.STRING, field: 'deliver_mail_img', allowNull: true, defaultValue:'', comment:'交付商交付快递单号图片' },
createdAt: { type: DataTypes.DATE, field: 'created_at', allowNull: false, defaultValue: DataTypes.NOW },
updatedAt: { type: DataTypes.DATE, field: 'updated_at', allowNull: false, defaultValue: DataTypes.NOW },
deletedAt: { type: DataTypes.DATE, field: 'deleted_at', allowNull: true }
},
{
timestamps: true,
underscore: true,
paranoid: true,
version: true,
tableName: 'o_order_deliver',
comment: '订单交付表',
});
}
'use strict'
/**
* 订单信息明细表
*/
module.exports = function (db, DataTypes) {
return db.define('oorderinforeg', {
legalName: {type: DataTypes.STRING, field: 'legal_name', allowNull: true, defaultValue:'',comment:'法人姓名' },
idCard: {type: DataTypes.STRING, field: 'id_card', allowNull: true, comment:'法人身份证' },
legalMobile: { type: DataTypes.INTEGER, field: 'legal_mobile', allowNull: true, defaultValue:'', comment:'法人电话'},
names: {type: DataTypes.STRING, field: 'names', allowNull: true,defaultValue:'', comment:'个体户名称' },
capital: { type: DataTypes.STRING, field: 'capital', allowNull: false,defaultValue:'', comment:'注册资本'},
domicileId: {type: DataTypes.STRING, field: 'domicile_id', allowNull: true,defaultValue:'', comment:'注册地id'},
domicileName: { type: DataTypes.STRING, field: 'domicile_name', allowNull: true, defaultValue:'',comment:'注册地名称'},
businessScopeId: {type: DataTypes.STRING, field: 'business_scope_id', allowNull: true, defaultValue:'',comment:'经营范围id' },
businessType: { type: DataTypes.STRING, field: 'business_type', allowNull: true, defaultValue:'', comment:'经营范围'},
businessScope: {type: DataTypes.STRING, field: 'business_scope', allowNull: true, defaultValue:'', comment:'经营范围详情' },
idcardFront: {type: DataTypes.STRING, field: 'idcard_front', allowNull: true, defaultValue:'', comment:'身份证正面照片' },
idcardBack: {type: DataTypes.STRING, field: 'idcard_back', allowNull: true, defaultValue:'', comment:'身份证反面照片' },
otherFile: {type: DataTypes.STRING, field: 'other_file', allowNull: true, defaultValue:'', comment:'其他文件' },
notes: {type: DataTypes.STRING, field: 'notes', allowNull: true, defaultValue:'', comment:'备注' },
guestMailAddr: {type: DataTypes.STRING, field: 'guest_mail_addr', allowNull: true, defaultValue:'', comment:'邮寄客户地址' },
guestMailTo: {type: DataTypes.STRING, field: 'guest_mail_to', allowNull: true, defaultValue:'', comment:'客户收件人' },
guestMailMobile: {type: DataTypes.STRING, field: 'guest_mail_mobile', allowNull: true, defaultValue:'', comment:'客户收件人电话' },
guestMailNo: {type: DataTypes.STRING, field: 'guest_mail_no', allowNull: true, defaultValue:'', comment:'客户快递单号' },
guestMailImg: {type: DataTypes.STRING, field: 'guest_mail_img', allowNull: true, defaultValue:'', comment:'交付商交付快递单号图片' },
guestAccpetFile: {type: DataTypes.STRING, field: 'guest_accpet_file', allowNull: true, defaultValue:'', comment:'客户验收文件' },
createdAt: { type: DataTypes.DATE, field: 'created_at', allowNull: false, defaultValue: DataTypes.NOW },
updatedAt: { type: DataTypes.DATE, field: 'updated_at', allowNull: false, defaultValue: DataTypes.NOW },
deletedAt: { type: DataTypes.DATE, field: 'deleted_at', allowNull: true }
},
{
timestamps: true,
underscore: true,
paranoid: true,
version: true,
tableName: 'o_order_info_reg',
comment: '订单信息明细表',
});
}
'use strict'
/**
* 订单流程表
*/
module.exports = function (db, DataTypes) {
return db.define('oorderprocess', {
productId: {type: DataTypes.BIGINT, field: 'product_id', allowNull: true, comment:'产品ID' },
orderId: {type: DataTypes.BIGINT, field: 'order_id', allowNull: true, comment:'订单号' },
name: { type: DataTypes.STRING, field: 'name', allowNull: false, defaultValue:"", comment:'产品名称'},
status: {type: DataTypes.STRING, field: 'status', allowNull: true, comment:'状态' },
func: { type: DataTypes.STRING, field: 'func', allowNull: false, comment:'状态执行方法名称'},
nextStatus: {type: DataTypes.STRING, field: 'next_status', allowNull: true, comment:'下一个状态'},
name1: { type: DataTypes.STRING, field: 'name1', allowNull: true, comment:'状态1'},
name2: {type: DataTypes.STRING, field: 'name2', allowNull: true, comment:'状态2' },
name3: { type: DataTypes.STRING, field: 'name3', allowNull: true, comment:'状态3'},
name4: {type: DataTypes.STRING, field: 'name4', allowNull: true, comment:'状态4' },
sort: {type: DataTypes.BIGINT, field: 'sort', allowNull: false, defaultValue:1000, comment:'排序' },
createdAt: { type: DataTypes.DATE, field: 'created_at', allowNull: false, defaultValue: DataTypes.NOW },
updatedAt: { type: DataTypes.DATE, field: 'updated_at', allowNull: false, defaultValue: DataTypes.NOW },
deletedAt: { type: DataTypes.DATE, field: 'deleted_at', allowNull: true },
},
{
timestamps: true,
underscore: true,
paranoid: true,
version: true,
tableName: 'o_order_process',
comment: '产品状态表',
});
}
\ No newline at end of file
/**
* 订单产品表
*/
'use strict'
module.exports = function (db, DataTypes) {
return db.define('oproduct', {
name: {type: DataTypes.STRING, field: 'name', allowNull: true, comment:'产品名称' },
desc: { type: DataTypes.STRING(200), field: 'desc', allowNull: false, defaultValue:"", comment:'产品描述'},
pid: { type: DataTypes.BIGINT, field: 'pid', allowNull: true, comment:'父ID'},
isChoose: { type: DataTypes.BOOLEAN, field: 'is_choose', allowNull: false, defaultValue:false, comment:'是否选择'},
sort: {type: DataTypes.INTEGER, field: 'sort', allowNull: false, defaultValue:1, comment:'排序' },
createdAt: { type: DataTypes.DATE, field: 'created_at', allowNull: false, defaultValue: DataTypes.NOW },
updatedAt: { type: DataTypes.DATE, field: 'updated_at', allowNull: false, defaultValue: DataTypes.NOW },
deletedAt: { type: DataTypes.DATE, field: 'deleted_at', allowNull: true },
},
{
timestamps: true,
underscore: true,
paranoid: true,
version: true,
tableName: 'o_product',
comment: '订单产品表',
});
}
/**
* 订单状态表
*/
'use strict'
module.exports = function (db, DataTypes) {
return db.define('oproductprocess', {
productId: {type: DataTypes.STRING, field: 'product_id', allowNull: true, comment:'产品ID' },
name: { type: DataTypes.STRING(200), field: 'name', allowNull: false, defaultValue:"", comment:'产品名称'},
status: {type: DataTypes.STRING, field: 'status', allowNull: true, comment:'状态' },
func: { type: DataTypes.STRING, field: 'func', allowNull: false, comment:'状态执行方法名称'},
nextStatus: {type: DataTypes.STRING, field: 'next_status', allowNull: true, comment:'下一个状态'},
name1: { type: DataTypes.STRING, field: 'name1', allowNull: true, comment:'状态1'},
name2: {type: DataTypes.STRING, field: 'name2', allowNull: true, comment:'状态2' },
name3: { type: DataTypes.STRING, field: 'name3', allowNull: true, comment:'状态3'},
name4: {type: DataTypes.STRING, field: 'name4', allowNull: true, comment:'状态4' },
sort: {type: DataTypes.INTEGER, field: 'sort', allowNull: false, defaultValue:1, comment:'排序' },
createdAt: { type: DataTypes.DATE, field: 'created_at', allowNull: false, defaultValue: DataTypes.NOW },
updatedAt: { type: DataTypes.DATE, field: 'updated_at', allowNull: false, defaultValue: DataTypes.NOW },
deletedAt: { type: DataTypes.DATE, field: 'deleted_at', allowNull: true },
},
{
timestamps: true,
underscore: true,
paranoid: true,
version: true,
tableName: 'o_product_process',
comment: '产品状态表',
});
}
const system = require("../../../system");
const ServiceBase = require("../../sve.base")
/**
* 订单产品表
*/
class OproductService extends ServiceBase {
constructor() {
super("order", ServiceBase.getDaoName(OproductService));
this.oproductprocessDao = system.getObject("db.order.oproductprocessDao");
this.iborderbaseDao = system.getObject("db.order.iborderbaseDao");
}
/**
* 更新订单状态
* @param {*} order_id
* @param {*} updateStatus
* @param {*} params
*/
async updateStatus(orderId, updateStatus, params) {
try {
let _order = this.iborderbaseDao.findById(orderId);
if(!_order){
return system.getResult(null,`系统错误 错误信息 ${error}`);
}
var statusObj = findStatus(_order.productId, _order.status);
// statusObj.next_status 存在不存在 updateStatus
this[statusObj.func](order, statusObj, params);
} catch (error) {
return system.getResult(null,`系统错误 错误信息 ${error}`);
}
}
async setOrderStatus(orderList) {
var productIds = [];
var statues = [];
list = SELECT * FROM o_product_process WHERE product_id IN(: productIds) AND statues IN(: statues)
var map = {};
for (var item of list) {
map[item.product_id + "_" + item.status] = item;
}
for (var order of orderList) {
order.status = map[order.product_id + "_" + order.status] || {};
}
}
}
module.exports = OproductService;
\ 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