Commit daa8b886 by 王昆

gsb

parent abe11dc5
const system = require("../../../system");
const Dao = require("../../dao.base");
class ChannelDao extends Dao {
constructor() {
super(Dao.getModelName(ChannelDao));
this.statusMap = {};
}
}
module.exports = ChannelDao;
\ No newline at end of file
...@@ -55,6 +55,7 @@ module.exports = (db, DataTypes) => { ...@@ -55,6 +55,7 @@ module.exports = (db, DataTypes) => {
deliverType: DataTypes.STRING, deliverType: DataTypes.STRING,
deliverNo: DataTypes.STRING, deliverNo: DataTypes.STRING,
deliverImg: DataTypes.STRING, deliverImg: DataTypes.STRING,
productItems: DataTypes.STRING,
}, { }, {
paranoid: true, //假的删除 paranoid: true, //假的删除
underscored: true, underscored: true,
......
const system = require("../../../system");
const ServiceBase = require("../../sve.base")
const settings = require("../../../../config/settings")
const moment = require("moment");
class ChannelService extends ServiceBase {
constructor() {
super("order", ServiceBase.getDaoName(ChannelService));
}
}
module.exports = ChannelService;
// var task=new UserService();
// task.getUserStatisticGroupByApp().then(function(result){
// console.log((result));
// }).catch(function(e){
// console.log(e);
// });
\ No newline at end of file
...@@ -171,7 +171,87 @@ class IborderService extends ServiceBase { ...@@ -171,7 +171,87 @@ class IborderService extends ServiceBase {
// -----------------------以此间隔,上面为API下面为service--------------------------------- // -----------------------以此间隔,上面为API下面为service---------------------------------
async createOrder(params, t) { async createOrder(params, t) {
// 处理注册订单
// 产品项
params.productItems = (params.productItems || []).join("");
var order = {};
order.price = Number(params.price || 0);
order.status = "1000";
var merchantId = params.merchantId || params.merchant_id;
if (merchantId) {
var exists = await this.dao.findOne({
merchant_id: this.trim(merchantId),
channelOrderNo: this.trim(params.channelOrderNo),
});
if (exists) {
return system.getResult(null, "订单号【" + params.channelOrderNo + "】重复");
}
var merchantData = await this.microsveClient.call("merchant", "getById", {
"id": merchantId
});
if (merchantData.status != 0) {
return merchantData;
}
var merchant = merchantData.data;
if (!merchant.mustPay) {
order.price = 0;
order.status = "1020";
}
}
var busiStatus = await this.orderBusinessStatus.findOrderBusinessStatus(order.status);
if (busiStatus) {
order.ostatus = busiStatus.ostatus;
}
// 商户id
order.merchant_id = this.trim(merchantId);
// 三方渠道号
order.channelOrderNo = this.trim(params.channelOrderNo);
// 订单资料信息
order.legalName = this.trim(params.legalName);
order.legalMobile = this.trim(params.legalMobile);
order.legalImg = this.trim(params.legalImg);
order.idcard = this.trim(params.idcard);
order.idcardFront = this.trim(params.idcardFront);
order.idcardBack = this.trim(params.idcardBack);
order.bankNo = this.trim(params.bankNo);
order.bank = this.trim(params.bank);
order.bankImg = this.trim(params.bankImg);
order.names = this.trim(params.names);
order.capital = this.trim(params.capital);
order.domicile_id = this.trim(params.domicileId);
order.domicileName = this.trim(params.domicileName);
// 个体户经营范围
order.businessScope_id = this.trim(params.businessScopeId);
order.businessType = this.trim(params.businessType);
order.businessScope = this.trim(params.businessScope);
order.bdId = this.trim(params.bdId);
order.bdPath = this.trim(params.bdId);
// 邮寄地址
order.mailAddr = this.trim(params.mailAddr);
order.mailTo = this.trim(params.mailTo);
order.mailMobile = this.trim(params.mailMobile);
order.userId = this.trim(params.userId);
// var baseOrder = {};
// baseOrder = await this.baseorderDao.create(baseOrder);
// order.id = baseOrder.id;
order = await this.dao.create(order);
return system.getResultSuccess({
orderNo: order.id
});
} }
......
...@@ -9,6 +9,8 @@ class IborderbaseService extends ServiceBase { ...@@ -9,6 +9,8 @@ class IborderbaseService extends ServiceBase {
this.iborderSve = system.getObject("service.order.iborderSve"); this.iborderSve = system.getObject("service.order.iborderSve");
this.iborderdkSve = system.getObject("service.order.iborderdkSve"); this.iborderdkSve = system.getObject("service.order.iborderdkSve");
this.iborderdzSve = system.getObject("service.order.iborderdzSve"); this.iborderdzSve = system.getObject("service.order.iborderdzSve");
this.channelSve = system.getObject("service.order.channelSve");
this.paymentSve = system.getObject("service.order.paymentSve");
this.services = { this.services = {
"1000": this.iborderSve, // 注册订单 "1000": this.iborderSve, // 注册订单
...@@ -59,7 +61,7 @@ class IborderbaseService extends ServiceBase { ...@@ -59,7 +61,7 @@ class IborderbaseService extends ServiceBase {
let productType = this.trim(params.productTypes); let productType = this.trim(params.productTypes);
let childSve = this.getService(productType); let childSve = this.getService(productType);
if(!childSve) { if (!childSve) {
return system.getResult(null, `暂不支持此种产品类型:${productType}`); return system.getResult(null, `暂不支持此种产品类型:${productType}`);
} }
...@@ -71,8 +73,9 @@ class IborderbaseService extends ServiceBase { ...@@ -71,8 +73,9 @@ class IborderbaseService extends ServiceBase {
params.legalMobile = this.trim(params.legalMobile); params.legalMobile = this.trim(params.legalMobile);
params.legalEmail = this.trim(params.legalEmail); params.legalEmail = this.trim(params.legalEmail);
params.payType = Number(params.payType || 1); params.payType = Number(params.payType || 1);
params.productType = Number(params.productType || 1); params.productType = productType;
params.price = Number(params.price || 0); params.price = Number(params.price || 0);
params.status = "1000"; // 待处理
let self = this; let self = this;
//1 保存基类的信息 //1 保存基类的信息
await this.db.transaction(async t => { await this.db.transaction(async t => {
...@@ -81,6 +84,14 @@ class IborderbaseService extends ServiceBase { ...@@ -81,6 +84,14 @@ class IborderbaseService extends ServiceBase {
//将id 赋值 //将id 赋值
params.id = _baseOrder.id; params.id = _baseOrder.id;
await childSve.createOrder(params, t); await childSve.createOrder(params, t);
// 处理payment
if(payType != 2) {
var payment = {
};
this.paymentSve.create();
}
}); });
return system.getResultSuccess(); return system.getResultSuccess();
} catch (error) { } catch (error) {
...@@ -89,24 +100,34 @@ class IborderbaseService extends ServiceBase { ...@@ -89,24 +100,34 @@ class IborderbaseService extends ServiceBase {
} }
/** /**
* 完善信息 * 完善信息
* @param {*} params * @param {*} params
* legalName * legalName
* legalMobile * legalMobile
* names * names
* creditCode * creditCode
* isBank * isBank
* businessScope * businessScope
*/ */
async completedOrder(params) { async completedOrder(params) {
//1 检查个体户是否存在 (根据统一社会信用代码查个体工商户是否存在) //1 检查个体户是否存在 (根据统一社会信用代码查个体工商户是否存在)
this.trimObject(params); this.trimObject(params);
if(!params.legalName){return system.getResult(null,`参数错误 法人姓名不能为空`);} if (!params.legalName) {
if(!params.legalMobile){return system.getResult(null,`参数错误 法人电话不能为空`);} return system.getResult(null, `参数错误 法人姓名不能为空`);
if(!params.creditCode){return system.getResult(null,`参数错误 法人统一社会信用代码不能为空`);} }
if(!params.names){return system.getResult(null,`参数错误 个体户名称不能为空`);} if (!params.legalMobile) {
if(!params.businessScope){return system.getResult(null,`参数错误 经营范围不能为空`);} return system.getResult(null, `参数错误 法人电话不能为空`);
}
if (!params.creditCode) {
return system.getResult(null, `参数错误 法人统一社会信用代码不能为空`);
}
if (!params.names) {
return system.getResult(null, `参数错误 个体户名称不能为空`);
}
if (!params.businessScope) {
return system.getResult(null, `参数错误 经营范围不能为空`);
}
//2 如果不存在添加保存个体户 //2 如果不存在添加保存个体户
//3 完善信息 //3 完善信息
} }
......
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