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");
}
async test(pobj, query, req) {
// var tmp = await this.orderSve.createLicense(pobj.action_body);
//获取验证码
// await this.platformUtils.fetchVCode(pobj.action_body.mobile);
//创建用户
// var result = await this.platformUtils.createUserInfo("13075556691", "13075556693", "9366");
//创建用户
var result = await this.platformUtils.login("13075556691", "9366");
return result;
}
exam() {
return "";
}
classDesc() {
return {
groupName: "",
groupDesc: "",
name: "",
desc: "",
exam: "",
};
}
methodDescs() {
return [
{
methodDesc: "",
methodName: "",
paramdescs: [
{
paramDesc: "",
paramName: "",
paramType: "",
defaultValue: "",
}
],
rtnTypeDesc: "",
rtnType: ""
}
];
constructor() {
super();
// 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);
//获取验证码
// await this.platformUtils.fetchVCode(pobj.action_body.mobile);
//创建用户
// var result = await this.platformUtils.createUserInfo("13075556691", "13075556693", "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: "",
groupDesc: "",
name: "",
desc: "",
exam: "",
};
}
methodDescs() {
return [
{
methodDesc: "",
methodName: "",
paramdescs: [
{
paramDesc: "",
paramName: "",
paramType: "",
defaultValue: "",
}
],
rtnTypeDesc: "",
rtnType: ""
}
];
}
}
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,9 +479,10 @@ class InvoiceService extends ServiceBase {
return rs;
}
/**
* 校验审核
* @param {*} pobj
* @param {*} pobj
*/
async apiVerification(pobj) {
var params = {
......@@ -491,9 +494,10 @@ class InvoiceService extends ServiceBase {
}
return rs;
}
/**
* 试算
* @param {*} pobj
* @param {*} pobj
*/
async apiCalcInvoice(pobj) {
......@@ -513,7 +517,7 @@ class InvoiceService extends ServiceBase {
/**
* 保存发票申请(提供管理)
* @param {*} pobj
* @param {*} pobj
*/
async apiSaveInvoiceAdm(pobj) {
......@@ -532,7 +536,7 @@ class InvoiceService extends ServiceBase {
/**
* 平台审批
* @param {*} pobj
* @param {*} pobj
*/
async apiPlatformAssignment(pobj) {
if (!pobj.nextStatus) {
......@@ -541,15 +545,44 @@ 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
* @param {*} pobj
*/
async apiDelivererAssignment(pobj) {
if (!pobj.nextStatus) {
......@@ -566,7 +599,7 @@ class InvoiceService extends ServiceBase {
/**
* 完税证明
* @param {*} pobj
* @param {*} pobj
*/
async apiTxPayment(pobj) {
let params = {};
......@@ -587,7 +620,7 @@ class InvoiceService extends ServiceBase {
/**
* 查看完税证明
* @param {*} pobj
* @param {*} pobj
*/
async apiQueryTxPayment(pobj) {
let params = {};
......@@ -602,7 +635,7 @@ class InvoiceService extends ServiceBase {
/**
* 发票列表(交付商)
* @param {*} pobj
* @param {*} pobj
*/
async apiDelivererInvoices(pobj) {
if (pobj.pageIndex) {
......@@ -625,7 +658,7 @@ class InvoiceService extends ServiceBase {
/**
* 发票申请列表(交付商)
* @param {*} pobj
* @param {*} pobj
*/
async apiDelivererApplyInvoices(pobj) {
if (pobj.pageIndex) {
......@@ -644,9 +677,10 @@ class InvoiceService extends ServiceBase {
return system.getResult(null, res.msg);
}
}
/**
* 发票列表(平台)
* @param {*} pobj
* @param {*} pobj
*/
async apiQueryInvoices(pobj) {
pobj.pageIndex = Number(pobj.pageIndex || 1);
......@@ -671,7 +705,7 @@ class InvoiceService extends ServiceBase {
/**
* 发票申请列表(平台)
* @param {*} pobj
* @param {*} pobj
*/
async apiQueryApplyInvoices(pobj) {
pobj.pageIndex = Number(pobj.pageIndex || 1);
......@@ -693,7 +727,7 @@ class InvoiceService extends ServiceBase {
/**
* 更新邮寄单号(平台)
* @param {*} pobj
* @param {*} pobj
*/
async apiUpEmNo(pobj) {
if (pobj.id) {
......@@ -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,17 +842,19 @@ class InvoiceService extends ServiceBase {
return system.getResult(-1, `系统错误 错误信息${error}`);
}
}
/**
* 交易数据(交付商)
* @param {*} params
* @param {*} params
*/
async delStatManageData(params) {
try {
return await this.callms("invoice", "delStatTransData", params);
return await this.callms("invoice", "delStatTransData", params);
} catch (error) {
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