Commit 05ba1037 by 王昆

gsb

parent c016c418
......@@ -62,6 +62,8 @@ class APIBase extends DocBase {
"test.testApi",
"inner.registerInner",
"inner.resetPasswordInner",
"inner.resetPasswordInner",
"inner.statusNotify",
];
var x = lst.indexOf(fullname);
return x >= 0;
......@@ -116,7 +118,7 @@ class APIBase extends DocBase {
if (query) {
query.merchant_id = req.headers["app_id"];
}
var rtn = await this[methodname](pobj, query, req);
var rtn = await this[methodname](pobj, query, req) || {};
rtn.requestid = requestid;
this.oplogSve.createDb({
......
var APIBase = require("../../api.base");
var system = require("../../../system");
class TestAPI extends APIBase {
constructor() {
super();
this.orderSve = system.getObject("service.saas.orderSve");
}
async statusNotify(pobj, query, req) {
if (!pobj.source_no) {
return system.getResult(null, "订单号不存在");
}
if (pobj.status == "1190") {
let data = {
id: pobj.source_no,
sve_deliver_express_no: pobj.guest_mail_no,
sve_deliver_express_img: pobj.guest_mail_img
}
// 客户交付
return await this.orderSve.sveDeliver(data);
}
return pobj;
}
exam() {
return "";
}
classDesc() {
return {
groupName: "",
groupDesc: "",
name: "",
desc: "",
exam: "",
};
}
methodDescs() {
return [
{
methodDesc: "",
methodName: "",
paramdescs: [
{
paramDesc: "",
paramName: "",
paramType: "",
defaultValue: "",
}
],
rtnTypeDesc: "",
rtnType: ""
}
];
}
}
module.exports = TestAPI;
\ No newline at end of file
var system = require("../../../system")
const http = require("http")
const querystring = require('querystring');
var settings = require("../../../../config/settings");
const CtlBase = require("../../ctlms.base");
var cacheBaseComp = null;
class BusinessmenCtl extends CtlBase {
constructor() {
super();
this.businessmenSve = system.getObject("service.business.businessmenSve");
}
async allPage(pobj, pobj2, req) {
try {
let condition = {
currentPage: pobj.currentPage,
pageSize: pobj.pageSize,
order_id: this.trim(pobj.order_id),
deliver_id: this.trim(pobj.deliver_id),
name: this.trim(pobj.name),
legal_name: this.trim(pobj.legal_name),
legal_mobile: this.trim(pobj.legal_mobile),
legal_idcard: this.trim(pobj.legal_idcard),
credit_code: this.trim(pobj.credit_code)
};
if (!condition.deliver_id) {
return system.getResult(null, "请重新登录");
}
return await this.businessmenSve.allPage(condition);
} catch (error) {
console.log(error);
return system.getResultFail(500, "接口异常:" + error.message);
}
}
async myPage(pobj, pobj2, req) {
try {
let condition = {
currentPage: pobj.currentPage,
pageSize: pobj.pageSize,
order_id: this.trim(pobj.order_id),
name: this.trim(pobj.name),
operator_id: this.trim(req.loginUser.id),
legal_name: this.trim(pobj.legal_name),
legal_mobile: this.trim(pobj.legal_mobile),
legal_idcard: this.trim(pobj.legal_idcard),
credit_code: this.trim(pobj.credit_code)
};
if (!condition.operator_id) {
return system.getResult(null, "请重新登录");
}
return await this.businessmenSve.allPage(condition);
} catch (error) {
console.log(error);
return system.getResultFail(500, "接口异常:" + error.message);
}
}
}
module.exports = BusinessmenCtl;
\ No newline at end of file
var system = require("../../../system")
const CtlBase = require("../../ctlms.base");
class ManagerCtl extends CtlBase {
constructor() {
super();
this.invoiceSve = system.getObject("service.invoice.invoiceSve");
}
/**
* 交易数据(平台)
* @param {*} pobj
*/
async transData(pobj, pobj2, req) {
try {
var params = {
type: pobj.type || 1,
};
// 交易数据
return await this.invoiceSve.statManageData(params);
} catch (e) {
console.log(e);
return system.getResultFail(500, "接口错误");
}
}
/**
* 首页业务数据(平台)
* @param {*} pobj
*/
async businessData(pobj, pobj2, req) {
try {
var params = {
type: pobj.type || 1,
};
// 业务数据
return await this.invoiceSve.statBusinessData(params);
} catch (e) {
console.log(e);
return system.getResultFail(500, "接口错误");
}
}
/**
* 首页交易数据(交付商)
* @param {*} pobj
*/
async delTransData(pobj, pobj2, req) {
try {
var params = {
type: pobj.type || 1,
delivererId:this.trim(pobj.delivererId)
};
// 交易数据
return await this.invoiceSve.delStatManageData(params);
} catch (e) {
console.log(e);
return system.getResultFail(500, "接口错误");
}
}
/**
* 首页业务数据(交付商)
* @param {*} pobj
*/
async delBusinessData(pobj, pobj2, req) {
try {
var params = {
type: pobj.type || 1,
delivererId:this.trim(pobj.delivererId)
};
// 业务数据
return await this.invoiceSve.delStatBusinessData(params);
} catch (e) {
console.log(e);
return system.getResultFail(500, "接口错误");
}
}
//业务概览 (平台)
async deliverData(pobj, pobj2, req) {
try {
var params = {
type: pobj.type || 1,
currentPage: pobj.currentPage || 1,
pageSize: pobj.pageSize || 10,
}
// 业务办理概览
return await this.invoiceSve.statDeliverData(params);
} catch (e) {
console.log(e);
return system.getResultFail(500, "接口错误");
}
}
}
module.exports = ManagerCtl;
\ No newline at end of file
var system = require("../../../system")
const http = require("http")
const querystring = require('querystring');
var settings = require("../../../../config/settings");
const CtlBase = require("../../ctlms.base");
const logCtl = system.getObject("web.common.oplogCtl");
var cacheBaseComp = null;
class ManagerCtl extends CtlBase {
constructor() {
super();
this.orderSve = system.getObject("service.order.orderSve");
this.invoiceSve = system.getObject("service.invoice.invoiceSve");
}
/**
* 首页交易数据
* @param {*} pobj
*/
async transData(pobj, pobj2, req) {
try {
var params = {
type: pobj.type || 1,
};
// 交易数据
return await this.orderSve.statManageData(params);
} catch (e) {
console.log(e);
return system.getResultFail(500, "接口错误");
}
}
/**
* 首页业务数据
* @param {*} pobj
*/
async businessData(pobj, pobj2, req) {
try {
var params = {
type: pobj.type || 1,
};
// 业务数据
return await this.orderSve.statBusinessData(params);
} catch (e) {
console.log(e);
return system.getResultFail(500, "接口错误");
}
}
async deliverData(pobj, pobj2, req) {
try {
var params = {
type: pobj.type || 1,
currentPage: pobj.currentPage || 1,
pageSize: pobj.pageSize || 10,
}
// 业务办理概览
return await this.orderSve.statDeliverData(params);
} catch (e) {
console.log(e);
return system.getResultFail(500, "接口错误");
}
}
// 交付商统计
async deliverStatTransData(pobj, pobj2, req) {
if(!pobj.current_date){
let nowTime =new Date();
let month = nowTime.getMonth() + 1;
month = month<10?"0"+month:month;
pobj.current_date = nowTime.getFullYear()+"-"+month;
}
pobj.deliver_id = req.body.deliver_id;
try {
return await this.orderSve.deliverStatTransData(pobj);
} catch (error) {
console.log(error);
return system.getResult(null, `系统错误 错误信息 ${error}`);
}
}
// 业务办理
async businessManagement(pobj, pobj2, req) {
if(!pobj.current_date){
let nowTime =new Date();
let month = nowTime.getMonth() + 1;
month = month<10?"0"+month:month;
pobj.current_date = nowTime.getFullYear()+"-"+month;
}
pobj.deliver_id = req.body.deliver_id;
try {
return await this.orderSve.businessManagement(pobj);
} catch (error) {
console.log(error);
return system.getResult(null, `系统错误 错误信息 ${error}`);
}
}
}
module.exports = ManagerCtl;
\ No newline at end of file
var system = require("../../../system")
const CtlBase = require("../../ctlms.base");
class InvoiceCtl extends CtlBase {
constructor() {
super();
this.invoiceSve = system.getObject("service.invoice.invoiceSve");
}
}
module.exports = InvoiceCtl;
\ No newline at end of file
var system = require("../../../system")
const CtlBase = require("../../ctlms.base");
class OrderCtl extends CtlBase {
constructor() {
super();
this.orderSve = system.getObject("service.order.orderSve");
}
}
module.exports = OrderCtl;
\ No newline at end of file
......@@ -63,35 +63,6 @@ class DeliverService extends ServiceBase {
}
async synSave(id, password) {
let rs = await this.callms("common", "deliverUserInfo", {id: id});
if(!rs || !rs.data || !rs.data.user || !rs.data.deliver) {
return;
}
let user = rs.data.user;
let deliver = rs.data.deliver;
let data = {
companyNo: deliver.id,
companyName: deliver.name,
path: user.org_path,
staffNo: user.id,
staffName: user.real_name,
loginId: user.ucname,
pwd: password,
};
if(user.isAdmin) {
data.classType = "leader";
data.className = "主管";
} else {
data.classType = "member";
data.className = " 普通员工";
}
let url = settings.ntapi().synUserDetails;
let res = await this.callApi(url, data, "创建交付商用户");
if(res && res.data && res.data.datas) {
let _d = res.data.datas;
await this.callms("common", "deliverSynUpdate", {user_id: id, nt_user_id: _d.id, nt_company_id: _d.companyId});
}
}
async allOrg(params) {
......
const system = require("../../../system");
const ServiceBase = require("../../svems.base")
const settings = require("../../../../config/settings")
const axios = require("axios");
class OrderService extends ServiceBase {
constructor() {
super();
......@@ -30,6 +32,52 @@ class OrderService extends ServiceBase {
}
async audit(params) {
var rs = await this.callms("order", "saasOrderBulkAudit", params);
if(params.audit_status == "20" && rs.status === 0) {
this.pushOrderToDeliver(params.id);
}
return rs;
}
async pushOrderToDeliver(id) {
let order = await this.callms("order", "saasOrderInfo", {id: id}) || {};
order = order.data;
if (!order) {
return;
}
let notifyApi = settings.outApi().deliverNotifyApi;
let data = {
product_id: order.product_id,
source_id: 1002,
source_no: order.id,
customer_name: order.bminfo.legal_name,
contact_mobile: order.bminfo.legal_mobile,
desc: "saas个体户注册",
saas_deliver_api: notifyApi,
bminfo: order.bminfo,
};
// 推送订单到交付平台
let url = settings.deliverSysApi().orderPushApi;
let res = await axios({
method: 'post',
url: url,
data: data
});
console.log(res.data);
if(res.status == 200 && res.data && res.data.status == 0 && res.data.data) {
await this.updateOrder({id: id, deliver_order_id: res.data.data.id});
}
}
async updateOrder(params) {
let rs = await this.callms("order", "saasOrderUpdate", params);
return rs;
}
// 服务交付
async sveDeliver(params) {
let rs = await this.callms("order", "saasOrderSveDeliver", params);
return rs;
}
......
......@@ -35,12 +35,16 @@ var settings = {
return "http://43.247.184.94:7200/";
}
},
paasUrl: function () {
outApi: function () {
let domain;
if (this.env == "dev") {
return "http://192.168.18.237:4001/";
// return "http://192.168.18.125:4001/";
domain = "http://127.0.0.1:3701";
} else {
return "https://open.gongsibao.com/";
domain = "https://ss-platform.gongsibao.com";
}
return {
deliverNotifyApi: domain + "/api/inner/notifyApi/statusNotify"
}
},
apiconfig: {
......@@ -83,32 +87,24 @@ var settings = {
return "https://open.gongsibao.com/web/common/metaCtl/getApiDoc";
}
},
ntapi: function () {
deliverSysApi: function () {
let domain = "";
let domain_page = "";
if (this.env == "dev") {
domain = "https://nt-api.gongsibao.com";
domain_page = "https://nt.gongsibao.com";
domain = "http://127.0.0.1:3002";
} else {
domain = "https://nga-api.gongsibao.com";
domain_page = "https://nga.gongsibao.com";
domain = "https://xggadmin.gongsibao.com";
}
return {
// 税务登录地址
taxLoginUrl: domain_page + "/web/auth",
// 财务地址
finLoginUrl: domain_page + "/web/auth",
// 创建交付商&管理员
synUserDetails: domain + "/nga-api/synUserDetails",
// 交付商启用/禁用
updateCompanyStatus: domain + "/nga-api/company/updateCompanyStatus",
// 建账
createCustomer: domain + "/nga-api/createCustomer",
// 查询账户信息
getCustomerById: domain + "/nga-api/getCustomerById",
// 上传发票
uploadDetail: domain + "/nga-api/uploadDetail",
return {
// 推送订单s
orderPushApi: domain + "/web/order/orderCtl/addSourceOrder",
}
},
paasUrl: function () {
if (this.env == "dev") {
return "http://192.168.18.237:4001/";
// return "http://192.168.18.125:4001/";
} else {
return "https://open.gongsibao.com/";
}
},
redis: function () {
......
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