Commit 60cb6846 by 王昆

gsb

parent ac52af9e
......@@ -61,7 +61,8 @@ class APIBase extends DocBase {
var lst = [
"test.testApi",
"test.test",
"op.invoiceApi",
"op.saveInvoiceApi",
"op.invoiceListApi",
];
var x = lst.indexOf(fullname);
return x >= 0;
......
var APIBase = require("../../api.base");
var system = require("../../../system");
class TestAPI extends APIBase {
class InvoiceApi extends APIBase {
constructor() {
super();
// this.orderSve = system.getObject("service.order.orderSve");
......@@ -9,17 +9,22 @@ class TestAPI extends APIBase {
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 = {};
async saveInvoiceApi(pobj, query, req) {
pobj.creditCode = "91110105589080831E";
try {
await this.invoiceSve.sendInvoiceToDz({id: "11665025426002758"});
return await this.invoiceSve.apiSaveInvoiceCNB(pobj);
} catch (e) {
console.log(e);
}
return result;
}
async invoiceListApi(pobj, query, req) {
try {
pobj.creditCode = "91110105589080831E";
// pobj.businessmenCreditCode = "111";
return await this.invoiceSve.apiInvoiceListCNB(pobj);
} catch (e) {
console.log(e);
}
......@@ -60,4 +65,4 @@ class TestAPI extends APIBase {
}
}
module.exports = TestAPI;
\ No newline at end of file
module.exports = InvoiceApi;
\ No newline at end of file
......@@ -333,6 +333,81 @@ class InvoiceService extends ServiceBase {
return system.getResultSuccess(result);
}
/**
* 保存发票申请(提供管理) 张威吹牛必专用
* @param {*} pobj
*/
async apiSaveInvoiceCNB(pobj) {
var mapRs = await this.callms("order", "businessmenCompleteMapByCreditCodes", {
creditCodes: pobj.creditCode
});
var map = mapRs.data;
var signInfo = map[pobj.creditCode];
if (!pobj.invoiceTime) {
pobj.invoiceTime = moment().format("YYYY-MM-DD");
}
pobj.merchantId = ""; //个体户ID
pobj.invoiceAmount = system.y2f(pobj.invoiceAmount);
pobj.serviceRate = system.f2y(signInfo.serviceRate);
pobj.perCalWay = signInfo.taxUpType;
pobj.valCalWay = signInfo.addValueUpType;
pobj.applyNo = await this.getBusUid("");
// 销售方信息
pobj.businessmenId = signInfo.id;
pobj.isBank = signInfo.isBank;
pobj.taxAuthorities = signInfo.taxOrg;
pobj.taxCostPriRat = system.f2y(signInfo.costRate);
pobj.taxIncPriRat = system.f2y(signInfo.taxRate);
pobj.perIncTaxRange = JSON.parse(signInfo.specialTaxLadder);
pobj.valAddTaxRange = JSON.parse(signInfo.specialOtherLadder);
pobj.businessmenType = 10;
pobj.businessmenCreditCode = pobj.creditCode;
pobj.businessName = signInfo.name;
pobj.businessmenName = signInfo.name;
pobj.businessmenAddr = "北京市海淀区西北旺东路10号院东区2号楼二层202",
pobj.businessmenMobile = "010-5236";
pobj.businessmenBank = "北京朝阳双秀支";
pobj.businessmenAccount = "8569659856";
pobj.isBank = 1;
pobj.taxAuthorities = "北京市工商行政管理局海淀分局";
pobj.type = "10";
pobj.status = "1000";
pobj.customerStatus = "1000";
pobj.payWay = "10";
pobj.businessmenType = "10";
pobj.ruleCode = "10";
// 开票内容
if (signInfo.invoicecontents && signInfo.invoicecontents.length > 0) {
pobj.invoiceContent = signInfo.invoicecontents[0].invoicecontentName;
} else {
pobj.invoiceContent = "服务费";
}
var rs = await this.callms("invoice", "saveInvoice", pobj);
if (rs.status == 0) {
return rs
} else {
return system.getResult(null, rs.msg);
}
}
async apiInvoiceListCNB(pobj) {
return await this.apiQueryApplyInvoices(pobj);
}
async apiCancelInvoice(pobj) {
var params = {
applyNo: pobj.applyNo,
......
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