Commit 36cce5d8 by 王昆

gsb

parent 85fa753b
xggpjb-admin/node_modules/
.idea/
\ No newline at end of file
......@@ -59,7 +59,8 @@ class APIBase extends DocBase {
async isCheckWhiteList(gname, methodname) {
var fullname = gname + "." + methodname;
var lst = [
"test.testApi"
"test.testApi",
"test.test",
];
var x = lst.indexOf(fullname);
return x >= 0;
......
var APIBase = require("../../api.base");
var system = require("../../../system");
class TestAPI extends APIBase {
constructor() {
super();
this.orderSve = system.getObject("service.order.orderSve");
this.platformUtils = system.getObject("util.businessManager.opPlatformUtils");
// this.orderSve = system.getObject("service.order.orderSve");
// this.platformUtils = system.getObject("util.businessManager.opPlatformUtils");
this.invoiceSve = system.getObject("service.invoice.invoiceSve");
}
async test(pobj, query, req) {
// var tmp = await this.orderSve.createLicense(pobj.action_body);
//获取验证码
......@@ -13,12 +16,20 @@ class TestAPI extends APIBase {
//创建用户
// var result = await this.platformUtils.createUserInfo("13075556691", "13075556693", "9366");
//创建用户
var result = await this.platformUtils.login("13075556691", "9366");
// var result = await this.platformUtils.login("13075556691", "9366");
var result = {};
try {
await this.invoiceSve.sendInvoiceToDz({id: "11665025426002758"});
} catch (e) {
console.log(e);
}
return result;
}
exam() {
return "";
}
classDesc() {
return {
groupName: "",
......@@ -28,6 +39,7 @@ class TestAPI extends APIBase {
exam: "",
};
}
methodDescs() {
return [
{
......@@ -47,4 +59,5 @@ class TestAPI extends APIBase {
];
}
}
module.exports = TestAPI;
\ No newline at end of file
const system = require("../../../system");
const ServiceBase = require("../../svems.base")
const settings = require("../../../../config/settings")
class InvoiceService extends ServiceBase {
constructor() {
super();
......@@ -146,9 +147,9 @@ class InvoiceService extends ServiceBase {
invoice.invoiceAmount = Number(invoice.invoiceAmt);
invoice.invoiceTime = this.trim(invoice.invoiceTime);
invoice.businessmenCreditCode = this.trim(invoice.businessmenCreditCode);
invoice.businessmenType=this.trim(invoice.businessmenType) || "10";
invoice.businessmenType = this.trim(invoice.businessmenType) || "10";
invoice.serviceRate = signInfo.serviceRate;
invoice.ruleCode=this.trim(invoice.ruleCode) || "10";
invoice.ruleCode = this.trim(invoice.ruleCode) || "10";
invoice.perCalWay = signInfo.taxUpType; // TODO 确定值
invoice.valCalWay = signInfo.addValueUpType; // TODO 确定值
......@@ -191,7 +192,7 @@ class InvoiceService extends ServiceBase {
return system.getResultSuccess(result);
}
async apiVerificationAndCalculation(pobj){
async apiVerificationAndCalculation(pobj) {
pobj.serviceRate = Number(pobj.serviceRate) * 100;
pobj.taxIncPriRat = Number(pobj.taxIncPriRat) * 100;
pobj.taxCostPriRat = Number(pobj.taxCostPriRat) * 100;
......@@ -451,6 +452,7 @@ class InvoiceService extends ServiceBase {
this.handleDate(res.data["invoice"], ["updatedAt"], "YYYY-MM-DD", -8);
return res;
}
/**
* 发票明细(交付商)
* @param {*} pobj
......@@ -477,6 +479,7 @@ class InvoiceService extends ServiceBase {
return rs;
}
/**
* 校验审核
* @param {*} pobj
......@@ -491,6 +494,7 @@ class InvoiceService extends ServiceBase {
}
return rs;
}
/**
* 试算
* @param {*} pobj
......@@ -541,12 +545,41 @@ class InvoiceService extends ServiceBase {
var rs = await this.callms("invoice", "platformAssignment", pobj);
if (rs.status == 0) {
this.pushDeliver(pobj);
// 1090办理完成
if (pobj.nextStatus == "1090") {
this.sendInvoiceToDz(pobj);
}
return rs;
} else {
return system.getResult(null, rs.msg);
}
}
async sendInvoiceToDz(obj) {
// 查发票
let invoiceApply = await this.callms("invoice", "queryInvoice", {
id: obj.id
});
console.log(invoiceApply, "00000000000000000000000000000000000000000000000000000000000");
let invoice = invoiceApply.data.invoice || {};
let params = {
uploadPeriod: 201912,
companyId: 10001,
customerId: 498590,
userId: 123456,
file: [
invoice.invoiceImg,
]
};
let apiurl = "https://nga-api.gongsibao.com/nga-sass//billInfo/uploadFileForAliyun";
let rs = await this.restClient.execPost(params, apiurl);
return rs;
}
/**
* 交付商审批
* @param {*} pobj
......@@ -644,6 +677,7 @@ class InvoiceService extends ServiceBase {
return system.getResult(null, res.msg);
}
}
/**
* 发票列表(平台)
* @param {*} pobj
......@@ -790,6 +824,7 @@ class InvoiceService extends ServiceBase {
return system.getResult(null, `系统错误 错误信息 ${error}`);
}
}
//交易数据 平台
async statManageData(params) {
try {
......@@ -798,6 +833,7 @@ class InvoiceService extends ServiceBase {
return system.getResult(-1, `系统错误 错误信息 ${error}`);
}
}
//发票办理 平台
async statBusinessData(params) {
try {
......@@ -806,6 +842,7 @@ class InvoiceService extends ServiceBase {
return system.getResult(-1, `系统错误 错误信息${error}`);
}
}
/**
* 交易数据(交付商)
* @param {*} params
......@@ -817,6 +854,7 @@ class InvoiceService extends ServiceBase {
return system.getResult(-1, `系统错误 错误信息 ${error}`);
}
}
//发票办理(交付商)
async delStatBusinessData(params) {
try {
......@@ -825,6 +863,7 @@ class InvoiceService extends ServiceBase {
return system.getResult(-1, `系统错误 错误信息 ${error}`);
}
}
//交付商列表(平台)
async statDeliverData(params) {
try {
......@@ -835,4 +874,5 @@ class InvoiceService extends ServiceBase {
}
}
module.exports = InvoiceService;
\ No newline at end of file
......@@ -213,6 +213,7 @@ class ServiceBase {
}
var rs = await this.restClient.execPost(params, reqUrl);
console.log(rs);
if (rs && rs.stdout) {
return JSON.parse(rs.stdout);
}
......
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