Commit 787ac126 by 孙亚楠

修改传入费率格式问题

parent 53fe2603
...@@ -20,6 +20,19 @@ class InvoiceCtl extends CtlBase { ...@@ -20,6 +20,19 @@ class InvoiceCtl extends CtlBase {
} }
/** /**
* 申请发票校验试算
* @param {*} pobj
*/
async verificationAndCalculation(pobj) {
try {
return await this.invoiceSve.apiVerificationAndCalculation(pobj);
} catch (error) {
console.log(error);
return system.getResultFail(500, `接口错误 错误信息 ${error}`);
}
}
/**
* 查询明细(平台) * 查询明细(平台)
* @param {*} pobj * @param {*} pobj
*/ */
......
...@@ -146,9 +146,9 @@ class InvoiceService extends ServiceBase { ...@@ -146,9 +146,9 @@ class InvoiceService extends ServiceBase {
invoice.invoiceAmount = Number(invoice.invoiceAmt); invoice.invoiceAmount = Number(invoice.invoiceAmt);
invoice.invoiceTime = this.trim(invoice.invoiceTime); invoice.invoiceTime = this.trim(invoice.invoiceTime);
invoice.businessmenCreditCode = this.trim(invoice.businessmenCreditCode); invoice.businessmenCreditCode = this.trim(invoice.businessmenCreditCode);
invoice.businessmenType=this.trim(invoice.businessmenType) || "10";
invoice.serviceRate = signInfo.serviceRate; invoice.serviceRate = signInfo.serviceRate;
invoice.ruleCode=this.trim(invoice.ruleCode) || "10";
invoice.perCalWay = signInfo.taxUpType; // TODO 确定值 invoice.perCalWay = signInfo.taxUpType; // TODO 确定值
invoice.valCalWay = signInfo.addValueUpType; // TODO 确定值 invoice.valCalWay = signInfo.addValueUpType; // TODO 确定值
...@@ -165,7 +165,7 @@ class InvoiceService extends ServiceBase { ...@@ -165,7 +165,7 @@ class InvoiceService extends ServiceBase {
try { try {
console.log(JSON.stringify(invoice)); console.log(JSON.stringify(invoice));
var rs = await this.callms("invoice", "calcInvoice", invoice); var rs = await this.callms("invoice", "verificationAndCalculation", invoice);
if (rs.status == 0 && rs.data) { if (rs.status == 0 && rs.data) {
var calcRs = rs.data; var calcRs = rs.data;
calc.code = 1; calc.code = 1;
...@@ -191,6 +191,20 @@ class InvoiceService extends ServiceBase { ...@@ -191,6 +191,20 @@ class InvoiceService extends ServiceBase {
return system.getResultSuccess(result); return system.getResultSuccess(result);
} }
async apiVerificationAndCalculation(pobj){
pobj.serviceRate = Number(pobj.serviceRate) * 100;
pobj.taxIncPriRat = Number(pobj.taxIncPriRat) * 100;
pobj.taxCostPriRat = Number(pobj.taxCostPriRat) * 100;
pobj.invoiceAmount = system.y2f(pobj.invoiceAmount);
var rs = await this.callms("invoice", "verificationAndCalculation", pobj);
if (rs.status == 0) {
return rs
} else {
return system.getResult(null, rs.msg);
}
}
async apiSaveInvoice(pobj) { async apiSaveInvoice(pobj) {
var merchantId = pobj.merchant_id || pobj.merchantId; var merchantId = pobj.merchant_id || pobj.merchantId;
var invoiceList = pobj.invoiceList; var invoiceList = pobj.invoiceList;
......
...@@ -24,7 +24,7 @@ var settings = { ...@@ -24,7 +24,7 @@ var settings = {
salt: "%iatpD1gcxz7iF#B", salt: "%iatpD1gcxz7iF#B",
defaultpwd: "987456", defaultpwd: "987456",
basepath: path.normalize(path.join(__dirname, '../..')), basepath: path.normalize(path.join(__dirname, '../..')),
port: process.env.NODE_PORT || 4001, port: process.env.NODE_PORT || 3002,
reqEsAddr: function () { reqEsAddr: function () {
if (this.env == "dev") { if (this.env == "dev") {
var localsettings = require("./localsettings"); var localsettings = require("./localsettings");
......
<a name="menu">目录</a> <a name="menu">目录</a>
1. [发票状态](#status) 1. [发票状态](#status)
1. [验证发票是否符合申请](#verification) 1. [验证发票是否符合申请](#verification)已经弃用
1. [发票查询明细(平台)](#queryInvoice) 1. [发票查询明细(平台)](#queryInvoice)
1. [发票查询明细(交付商)](#queryInvoiceDeliverer) 1. [发票查询明细(交付商)](#queryInvoiceDeliverer)
1. [发票试算](#calcInvoice) 1. [发票试算](#calcInvoice) 已经弃用
1. [发票申请](#invoices) 1. [发票申请](#invoices)
1. [发票验证&试算](#verificationAndCalculation)
1. [发票申请列表(平台)](#queryInvoices) 1. [发票申请列表(平台)](#queryInvoices)
1. [交付查看商审批列表](#delivererInvoices) 1. [交付查看商审批列表](#delivererInvoices)
...@@ -19,6 +19,8 @@ ...@@ -19,6 +19,8 @@
1. [平台更新邮寄地址](#apiUpEmNO) 1. [平台更新邮寄地址](#apiUpEmNO)
## **<a name="saveInvoice"> 发票状态</a>**      ## **<a name="saveInvoice"> 发票状态</a>**     
[返回到目录](#menu)     [返回到目录](#menu)    
``` ```
...@@ -257,32 +259,6 @@ ...@@ -257,32 +259,6 @@
| msg | String | 提示信息 | | msg | String | 提示信息 |
| data | JSON | 返回值 | | data | JSON | 返回值 |
**示例**
```
//fail
{
"status":-1,
"msg":"该商户发票正在申请中,请等待审核通过或者撤回才能再次申请",
"data":null,
"bizmsg":"empty"
}
//success
{
"status":0,
"msg":"操作成功",
"data":{
"serviceCharge":"4500",
"personalIncomeTax":0,
"valueAddedTax":0,
"additionalTax":0,
"warning":""
},
"bizmsg":"empty",
"requestid":"a1d2e2ad49b841329dfe3a04435ffd23"
}
```
## **<a name="saveInvoice"> 发票申请保存</a>**      ## **<a name="saveInvoice"> 发票申请保存</a>**     
[返回到目录](#menu)      [返回到目录](#menu)     
...@@ -315,10 +291,12 @@ ...@@ -315,10 +291,12 @@
| businessmenId | string| 是 |  | 销售方ID | | businessmenId | string| 是 |  | 销售方ID |
| businessmenCreditCode | string| 是 |  | 销售方社会统一信用代码 | | businessmenCreditCode | string| 是 |  | 销售方社会统一信用代码 |
| businessmenType | number| 是 |  | 销售方类型 10 个体工商 20 自然人 |
| businessName | string| 是 |  | 销售方名称 | | businessName | string| 是 |  | 销售方名称 |
| isBank | string| 是 |  | 是否开户 1:开户 0:未开户 | | isBank | string| 是 |  | 是否开户 1:开户 0:未开户 |
| invoiceNo | string | 否 |  | 发票编号 | | invoiceNo | string | 否 |  | 发票编号 |
| ruleCode | number| 是 |  | 算法编码 10 个体工商 20 自然人算法 |
| type | number| 否 |  | 发票类型 10 普通发票 20 增值税专用发票 30 电子发票 | | type | number| 否 |  | 发票类型 10 普通发票 20 增值税专用发票 30 电子发票 |
| invoiceAmount | number| 是 |  | 发票金额 | | invoiceAmount | number| 是 |  | 发票金额 |
| statements | string | 是 |  | 结算单子 | | statements | string | 是 |  | 结算单子 |
...@@ -394,14 +372,15 @@ ...@@ -394,14 +372,15 @@
"merchantAddr":"北京市海淀区北太平庄路18号3层3-0227", "merchantAddr":"北京市海淀区北太平庄路18号3层3-0227",
"merchantMobile":"010-5369854", "merchantMobile":"010-5369854",
"merchantBank":"110108022130868", "merchantBank":"110108022130868",
"businessmenType":"10",
"businessmenId": "110115023996882", "businessmenId": "110115023996882",
"businessmenCreditCode": "91110115MA00HDC44L", "businessmenCreditCode": "91110115MA00HDC44L",
"businessName":"北京富通勤国际贸易有限责任公司(个体工商)", "businessName":"北京富通勤国际贸易有限责任公司(个体工商)",
"isBank":1, "isBank":1,
"taxAuthorities":"北京大兴税务局", "taxAuthorities":"北京大兴税务局",
"type":20, "type":20,
"invoiceAmount": 40000000, "ruleCode":"10",
"invoiceAmount": 40000000,
"statements":"wwww.baidu.com", "statements":"wwww.baidu.com",
"contract":"www.qq.com", "contract":"www.qq.com",
"applyNo":"gongsibao-futong001", "applyNo":"gongsibao-futong001",
...@@ -437,6 +416,95 @@ ...@@ -437,6 +416,95 @@
"requestid":"ea903ff378d4469a8fef10a6e15f5036" "requestid":"ea903ff378d4469a8fef10a6e15f5036"
} }
``` ```
## **<a name="verificationAndCalculation"> 发票验证&试算</a>**     
[返回到目录](#menu)     
**接口方式** HTTP
**HTTP方法** POST
**URI路径** /web/invoice/invoiceCtl/verificationAndCalculation
**参数验证**
**参数**
| 参数名|数据类型|必须|默认| 说明 |
|---|:---:|:---:|:---:|---|
| businessmenType | number| 是 |  | 销售方类型 10 个体工商 20 自然人 |
| businessmenCreditCode | string| 是 |  | 销售方社会统一信用代码 |
| ruleCode | number| 是 |  | 算法编码 10 个体工商 20 自然人算法 |
| serviceRate | number| 是 |  | 服务费率 例子:10.11% |
| perCalWay | number| 是 |  | 个税计算方式 1:年 请填写 1 |
| valCalWay | number| 是 |  | 增值税计算方式 1:月 2:季度 |
| merchantId | string | 是 |  | 商户id |
| taxIncPriRat | number| 是 |  | 不含税价百分比 例子:10.11%|
| taxCostPriRat | number| 是 |  | 核定成本费用率 例子:10.11%|
| invoiceTime | String| 是 |  | 开票时间 |
| invoiceAmount | number| 是 |  | 发票金额 |
| perIncTaxRange | JSON | 是 |  | 个税税额范围 |
| valAddTaxRange | JSON | 是 |  | 增值税范围 |
**示例**
```
{
"businessmenCreditCode": "111",
"serviceRate": 2.25,
"perCalWay": "1",
"valCalWay": "1",
"businessmenId": "12795594625000138",
"taxCostPriRat": 11.22,
"taxIncPriRat": 10.22,
"invoiceTime": "2019-09-19",
"invoiceAmount": 2000000,
"perIncTaxRange": [
{
"minValue": 0,
"rate": "0",
"quiCalDed": 100000,
"maxValue": 3000000
},
{
"minValue": 3000100,
"rate": "1.5",
"quiCalDed": 200000,
"maxValue": 10000000
},
{
"minValue": 10000001,
"rate": "4.86",
"quiCalDed": 300000,
"maxValue": 214748364700
}
],
"valAddTaxRange": [
{
"minValue": 0,
"zengzhiRate": "0",
"fujiaRate": "0",
"maxValue": 3000000
},
{
"minValue": 3000100,
"zengzhiRate": "0",
"fujiaRate": "0",
"maxValue": 10000000
},
{
"minValue": 10000001,
"zengzhiRate": "3",
"fujiaRate": "12",
"maxValue": 214748364700
}
]
}
```
**返回结果**
| 参数名|数据类型| 说明 |
|---|:---:|---|
| status | Number | 状态码 |
| msg | String | 提示信息 |
| data | JSON | 返回值 |
## **<a name="queryInvoice"> 查询发票明细(平台)</a>**      ## **<a name="queryInvoice"> 查询发票明细(平台)</a>**     
......
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