Commit e16c5ead by 王昆

Merge branch 'xgg-admin-ali' into xgg-admin

parents 0c2424ac a5ee8edf
var system = require("../../../system") var system = require("../../../system")
const CtlBase = require("../../ctlms.base"); const CtlBase = require("../../ctlms.base");
var moment = require('moment'); var moment = require('moment');
class InvoiceCtl extends CtlBase { class InvoiceCtl extends CtlBase {
constructor() { constructor() {
super(); super();
this.invoiceSve = system.getObject("service.invoice.invoiceSve"); this.invoiceSve = system.getObject("service.invoice.invoiceSve");
this.userSve = system.getObject("service.uc.userSve"); this.userSve = system.getObject("service.uc.userSve");
this.INVOICE_TYPE = ["10","20","30"]; this.INVOICE_TYPE = ["10", "20", "30"];
} }
/** /**
* 业务进度字典 * 业务进度字典
* @param {*} pobj * @param {*} pobj
*/ */
async processDics(pobj, pobj2, req) { async processDics(pobj, pobj2, req) {
try { try {
...@@ -24,7 +25,7 @@ class InvoiceCtl extends CtlBase { ...@@ -24,7 +25,7 @@ class InvoiceCtl extends CtlBase {
/** /**
* 发票申请列表-平台(管理员) * 发票申请列表-平台(管理员)
* @param {*} pobj * @param {*} pobj
*/ */
async invoicePage(pobj, pobj2, req) { async invoicePage(pobj, pobj2, req) {
try { try {
...@@ -38,7 +39,7 @@ class InvoiceCtl extends CtlBase { ...@@ -38,7 +39,7 @@ class InvoiceCtl extends CtlBase {
/** /**
* 发票申请列表-业务员 * 发票申请列表-业务员
* @param {*} pobj * @param {*} pobj
*/ */
async myInvoicePage(pobj, pobj2, req) { async myInvoicePage(pobj, pobj2, req) {
try { try {
...@@ -53,7 +54,7 @@ class InvoiceCtl extends CtlBase { ...@@ -53,7 +54,7 @@ class InvoiceCtl extends CtlBase {
/** /**
* 发票申请 * 发票申请
* @param {*} pobj * @param {*} pobj
*/ */
async invoiceApply(pobj, pobj2, req) { async invoiceApply(pobj, pobj2, req) {
try { try {
...@@ -72,7 +73,7 @@ class InvoiceCtl extends CtlBase { ...@@ -72,7 +73,7 @@ class InvoiceCtl extends CtlBase {
/** /**
* 进度处理 * 进度处理
* @param {*} pobj * @param {*} pobj
*/ */
async handleStatus(pobj, pobj2, req) { async handleStatus(pobj, pobj2, req) {
try { try {
...@@ -103,7 +104,7 @@ class InvoiceCtl extends CtlBase { ...@@ -103,7 +104,7 @@ class InvoiceCtl extends CtlBase {
/** /**
* 根据ID查详细信息 * 根据ID查详细信息
* @param {*} pobj * @param {*} pobj
*/ */
async invoice(pobj, pobj2, req) { async invoice(pobj, pobj2, req) {
try { try {
...@@ -116,9 +117,9 @@ class InvoiceCtl extends CtlBase { ...@@ -116,9 +117,9 @@ class InvoiceCtl extends CtlBase {
/** /**
* 发票推送 * 发票推送
* @param {*} pobj * @param {*} pobj
* @param {*} pobj2 * @param {*} pobj2
* @param {*} req * @param {*} req
*/ */
async uploadDetail(pobj, pobj2, req) { async uploadDetail(pobj, pobj2, req) {
if (!pobj.invoice_id) { if (!pobj.invoice_id) {
...@@ -128,24 +129,24 @@ class InvoiceCtl extends CtlBase { ...@@ -128,24 +129,24 @@ class InvoiceCtl extends CtlBase {
return res; return res;
} }
/** // /**
* 发票试算接口 // * 发票试算接口
* @param {*} pobj // * @param {*} pobj
*/ // */
async calcInvoice(pobj) { // async calcInvoice(pobj) {
try { // try {
return await this.invoiceSve.calcInvoice(pobj); // return await this.invoiceSve.calcInvoice(pobj);
} catch (error) { // } catch (error) {
console.log(error); // console.log(error);
return system.getResultFail(500, `接口错误 错误信息 ${error}`); // return system.getResultFail(500, `接口错误 错误信息 ${error}`);
} // }
} // }
/** /**
* 发票试算接口 * 发票试算接口
* @param {*} pobj * @param {*} pobj
* @param {*} query * @param {*} query
* @param {*} req * @param {*} req
*/ */
async calcInvoice(pobj, query, req) { async calcInvoice(pobj, query, req) {
let res = [], let res = [],
...@@ -168,15 +169,24 @@ class InvoiceCtl extends CtlBase { ...@@ -168,15 +169,24 @@ class InvoiceCtl extends CtlBase {
} }
try { try {
let rs = await this.invoiceSve.calcInvoice(params); let rs = await this.invoiceSve.calcInvoice(params);
if (!rs) { if (rs.status !== 0) {
rs = { res.push({
credit_code: item.credit_code, credit_code: item.credit_code,
msg: "试算失败" status: rs.status,
}; msg: rs.msg
});
continue;
} }
res.push(rs); let data = rs.data;
data.status = rs.status;
res.push(data);
} catch (error) { } catch (error) {
console.log(error); console.log(error);
res.push({
credit_code: item.credit_code,
status: 500,
msg: "试算异常," + error.message
});
} }
} }
return system.getResult(res); return system.getResult(res);
...@@ -242,7 +252,6 @@ class InvoiceCtl extends CtlBase { ...@@ -242,7 +252,6 @@ class InvoiceCtl extends CtlBase {
// } // }
// /** // /**
// * 计算发票增值税 // * 计算发票增值税
// * @param {*} pobj // * @param {*} pobj
...@@ -438,4 +447,5 @@ class InvoiceCtl extends CtlBase { ...@@ -438,4 +447,5 @@ class InvoiceCtl extends CtlBase {
// } // }
// } // }
} }
module.exports = InvoiceCtl; module.exports = InvoiceCtl;
\ No newline at end of file
...@@ -386,10 +386,16 @@ class InvoiceService extends ServiceBase { ...@@ -386,10 +386,16 @@ class InvoiceService extends ServiceBase {
value_added_tax = system.f2y(value_added_tax); value_added_tax = system.f2y(value_added_tax);
additional_tax = system.f2y(additional_tax); additional_tax = system.f2y(additional_tax);
service_amount = system.f2y(service_amount); service_amount = system.f2y(service_amount);
return {personal_invoice_tax:personal_invoice_tax,value_added_tax:value_added_tax,additional_tax:additional_tax,service_amount:service_amount,credit_code:params.credit_code}; return system.getResultSuccess({
personal_invoice_tax: personal_invoice_tax,
value_added_tax: value_added_tax,
additional_tax: additional_tax,
service_amount: service_amount,
credit_code: params.credit_code
});
} catch (error) { } catch (error) {
console.log(error); console.log(error);
return null; return system.getResult(null, "试算失败");
} }
} }
......
...@@ -196,11 +196,11 @@ class System { ...@@ -196,11 +196,11 @@ class System {
} else { } else {
var odomain = "http://123.57.217.203" var odomain = "http://123.57.217.203"
return { return {
common: "xggsvecommon-service" + path, common: "alixggsvecommon-service" + path,
merchant: "xggsvemerchant-service" + path, merchant: "alixggsvemerchant-service" + path,
order: "xggsveorder-service" + path, order: "alixggsveorder-service" + path,
invoice: "xggsveinvoice-service" + path, invoice: "alixggsveinvoice-service" + path,
uc: "xggsveuc-service" + path, uc: "alixggsveuc-service" + path,
} }
} }
} }
......
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