Commit f3fe7ce0 by 王昆

gsb

parent d9c7f676
#!/bin/bash
FROM registry.cn-beijing.aliyuncs.com/hantang/node105:v2
MAINTAINER jy "jiangyong@gongsibao.com"
ADD xgg-pc /apps/xgg-pc/
WORKDIR /apps/xgg-pc/
ADD xgg-admin /apps/xgg-admin/
WORKDIR /apps/xgg-admin/
RUN cnpm install -S
CMD ["node","/apps/xgg-pc/main.js"]
CMD ["node","/apps/xgg-admin/main.js"]
......
{
"editor.tabSize": 2
}
\ No newline at end of file
......@@ -37,7 +37,7 @@ class APIBase extends DocBase {
}
for (let k = 0; k < keys.length; k++) {
const tKey = keys[k];
if (tKey != "sign" && params[tKey]) {
if (tKey != "sign" && params[tKey] && !(params[tKey] instanceof Array)) {
signArr.push(tKey + "=" + params[tKey]);
}
}
......@@ -79,11 +79,12 @@ class APIBase extends DocBase {
result.status = system.appidFail;
result.msg = "请求头app_id值失效,请重新获取";
}
// var signResult = await this.verifySign(pobj.action_body, appInfo.appSecret);
// if (signResult.status != 0) {
// result.status = system.signFail;
// result.msg = signResult.msg;
// }
var signResult = await this.verifySign(pobj.action_body, appInfo.appSecret);
if (signResult.status != 0) {
result.status = system.signFail;
result.msg = signResult.msg;
}
}//验签
else if (appkey) {
appInfo = await this.cacheManager["ApiAccessKeyCheckCache"].cache(appkey, { status: true }, 3000);
......@@ -102,11 +103,11 @@ class APIBase extends DocBase {
var requestid = this.getUUID();
try {
//验证accesskey或验签
// var isPassResult = await this.checkAcck(gname, methodname, pobj, query, req);
// if (isPassResult.status != 0) {
// isPassResult.requestid = "";
// return isPassResult;
// }
var isPassResult = await this.checkAcck(gname, methodname, pobj, query, req);
if (isPassResult.status != 0) {
isPassResult.requestid = "";
return isPassResult;
}
if (pobj && pobj.action_body) {
pobj.action_body.merchant_id = pobj.action_body.merchant_id || req.headers["app_id"];
}
......
......@@ -6,10 +6,15 @@ class ActionAPI extends APIBase {
super();
this.merchantSve = system.getObject("service.merchant.merchantSve");
this.orderSve = system.getObject("service.order.orderSve");
this.businessmenSve = system.getObject("service.order.businessmenSve");
this.businessmenSve = system.getObject("service.business.businessmenSve");
this.merchantrechargeSve = system.getObject("service.merchant.merchantrechargeSve");
this.merchantaccountSve = system.getObject("service.merchant.merchantaccountSve");
this.invoiceSve = system.getObject("service.invoice.invoiceSve");
this.courierSve = system.getObject("service.common.courierSve");
}
/**
* 接口跳转
......@@ -18,16 +23,17 @@ class ActionAPI extends APIBase {
* action_body 执行的参数
*/
async springboard(pobj, qobj, req) {
console.log(pobj, pobj.action_type, !pobj.action_type, "--------------------------------------this is xgg admin ----------------------");
if (!pobj.action_process) {
return system.getResult(null, "action_process参数不能为空");
}
}
if (!pobj.action_type) {
return system.getResult(null, "action_type参数不能为空");
}
var result = null;
switch (pobj.action_process) {
case "sjb"://司机宝
result = await this.sjbOpActionProcess(pobj.action_process, pobj.action_type, pobj.action_body);
case "sijibao"://司机宝
result = await this.sijibaoOpActionProcess(pobj.action_process, pobj.action_type, pobj.action_body);
break;
default:
result = system.getResult(null, "action_process参数错误");
......@@ -36,12 +42,12 @@ class ActionAPI extends APIBase {
return result;
}
async sjbOpActionProcess(action_process, action_type, action_body) {
async sijibaoOpActionProcess(action_process, action_type, action_body) {
var opResult = null;
switch (action_type) {
// sy
case "queryMerchant"://查询商户
opResult = await this.merchantSve.queryMerchant(action_body);
opResult = await this.merchantSve.apiQueryMerchant(action_body);
break;
case "addOrder"://添加订单
opResult = await this.orderSve.addOrder(action_body);
......@@ -52,6 +58,10 @@ class ActionAPI extends APIBase {
case "queryOrder"://订单查询
opResult = await this.orderSve.queryOrder(action_body);
break;
case "orderClose"://订单查询
opResult = await this.orderSve.orderClose(action_body);
break;
case "putContract"://个体工商户合同接收接口
opResult = await this.businessmenSve.putContract(action_body);
break;
......@@ -59,12 +69,11 @@ class ActionAPI extends APIBase {
opResult = await this.businessmenSve.queryBusinessmen(action_body);
break;
// sy
// wk
case "rechargeApplication":// 商户充值申请
opResult = await this.merchantrechargeSve.apiSave(action_body);
opResult = await this.merchantrechargeSve.add(action_body);
break;
case "queryMerchantAccount":// 商户充值申请
opResult = await this.merchantaccountSve.infoByMerchantId(action_body);
break;
case "calcInvoice": // 发票试算接口
opResult = await this.invoiceSve.apiCalcInvoice(action_body);
......@@ -75,25 +84,32 @@ class ActionAPI extends APIBase {
case "cancelInvoice": // 发票提交接口
opResult = await this.invoiceSve.apiCancelInvoice(action_body);
break;
// 以下接口为推送测试
case "testRechargeAudit":// 发票信息查询接口
opResult = await this.merchantrechargeSve.apiAudit(action_body);
break;
case "testInvoiceAudit": // 发票审核
opResult = await this.invoiceSve.testInvoiceAudit(action_body);
break;
case "testKaipiao": // 发票状态已开具
opResult = await this.invoiceSve.testKaipiao(action_body);
case "queryInvoice": // 发票提交接口
opResult = await this.invoiceSve.apiQueryInvoice(action_body);
break;
case "testToemail": // 发票已邮寄
opResult = await this.invoiceSve.testToemail(action_body);
case "queryTaxInvoice":
opResult = await this.invoiceSve.apiQueryTaxInvoice(action_body);
break;
case "testTaxCertificate": // 发票已邮寄
opResult = await this.invoiceSve.testToemail(action_body);
case "queryCourierTrace":
opResult = await this.courierSve.queryCourierTrace(action_body);
break;
// // 以下接口为推送测试
// case "testRechargeAudit":// 发票信息查询接口
// opResult = await this.merchantrechargeSve.apiAudit(action_body);
// break;
// case "testInvoiceAudit": // 发票审核
// opResult = await this.invoiceSve.testInvoiceAudit(action_body);
// break;
// case "testKaipiao": // 发票状态已开具
// opResult = await this.invoiceSve.testKaipiao(action_body);
// break;
// case "testToemail": // 发票已邮寄
// opResult = await this.invoiceSve.testToemail(action_body);
// break;
// case "testTaxCertificate": // 发票已邮寄
// opResult = await this.invoiceSve.testToemail(action_body);
// break;
// wk
default:
opResult = system.getResult(null, "action_type参数错误");
......@@ -104,12 +120,12 @@ class ActionAPI extends APIBase {
exam() {
return `<pre>
1.queryMerchant:查询商户
### queryMerchant:查询商户
功能描述:
查询公司宝开通的商户基本信息,包含商户基本信息、开票信息、邮寄地址、客户经理等信息,如果业务不需要,可不调用
请求参数:
{
"action_process": "sjb",
"action_process": "sijibao",
"action_type": "queryMerchant",
"action_body": {
"sign":"CBCE83769118A4D8906F097ECA558ACF",
......@@ -130,7 +146,7 @@ class ActionAPI extends APIBase {
"contactMobile": "18810277728",
"contactEmail": "qjyang@gongsibao.com",
"invoiceValid": 1,
"mustPay": 1,S
"mustPay": 1,
"status": "1000",
"ownerName": "客户经理姓名",
"ownerMobile": "客户经理电话",
......@@ -159,37 +175,37 @@ class ActionAPI extends APIBase {
"requestid": "8cbd498f9d1441b1812ecaa2653933f4"
}
返回值说明:
name : String :商户名称
name : String :商户名称
taxType : STRING :纳税人类型 00一般纳税人 10小规模纳税人
contactName : String :联系人姓名
contactMobile: String :联系人手机
contactName : String :联系人姓名
contactMobile: String :联系人手机
contactEmail : String :开票申请校验 0否 1是
invoiceValid : int :联系人邮箱
mustPay : int :校验订单支付 0否 1是
ownerName : String :客户经理姓名
ownerMobile : String :客户经理电话
ownerName : String :客户经理姓名
ownerMobile : String :客户经理电话
status : String :商户状态 00待审核 10待签约 90签约完成
titleList : Array :开票抬头列表
titleNo : String :抬头编码
taxNo : String :纳税人识别号
invoiceAddr : String :开票地址
invoiceMobile: String :开票电话
accountName : String :开户名称
titleNo : String :抬头编码
taxNo : String :纳税人识别号
invoiceAddr : String :开票地址
invoiceMobile: String :开票电话
accountName : String :开户名称
accountPublic: String :对公账户
addressList : Array :开票地址列表
addressNo : String :邮寄地址编码
mailAddr : String :邮寄地址
mailTo : String :收件人
addressList : Array :开票地址列表
addressNo : String :邮寄地址编码
mailAddr : String :邮寄地址
mailTo : String :收件人
mailMobile : String :收件电话
2.addOrder/putOrder:添加订单/修改订单
### addOrder:添加订单
功能描述:
提交/修改 需要注册的个体工商户信息(待处理状态可进行修改,其他状态会修改失败)
请求参数:
{
"action_process": "sjb",
"action_process": "sijibao",
"action_type": "addOrder",
"action_body": {
"sign": "CBCE83769118A4D8906F097ECA558ACF",
......@@ -198,42 +214,48 @@ class ActionAPI extends APIBase {
"legalName": "测试法人修改",
"legalMobile": "15010929368",
"legalImg": "http://sss1.jpg",
"idcard": 341221198808328543,
"idcard": "222403",
"idcardFront": "http://sss2.jpg",
"idcardBack": "http://sss3.jpg",
"bankNo": "33333990209874819",
"bank": "北京市地球村",
"bankImg": "",
"names": "名称1,名称2,名称3",
"businessScopeNo": "xxxxxxxxxx1",
"capital": "1000万"
"capital": "1000万",
"domicileId": "11064622752480055",
"businessScopeId": "12219252215000155",
"businessScope": "国内物流信息服务;装卸搬运服务;...",
}
}
请求参数说明:
sign : String : 必填 :签名
times_tamp : long : 必填 :时间戳
channelOrderNo : String : 必填 :渠道单号
legalName : String : 必填 :法人姓名
channelOrderNo : String : 必填 :渠道单号
legalName : String : 必填 :法人姓名
legalMobile : String : 必填 :法人电话
legalImg : String : 必填 :法人证件照
legalImg : String : 非必填 :法人电话
idcard : String : 必填 :法人身份证
idcardFront : String : 必填 :身份证正面照片
idcardBack : String : 必填 :身份证反面照片
bankNo : String : 必填 :银行卡号
bank : String : 必填 :开户行
bankImg : String : 必填 :银行卡照片
bankImg : String : 非必填 :银行卡照片
names : String : 必填 :个体户名称,多个格式为:name1,name2,name3
businessScopeNo : String : 必填 :经营范围编码(需要和产品讨论怎么给出这个字典)
capital : String : 必填 :注册资本
capital : String : 必填 :注册资本
domicileId : String : 必填 :注册地编码
businessscopeId : String : 必填 :经营范围编码
businesssScope : String : 必填 :经营范围详情
返回值:
添加返回值:
{
"status": 0,
"msg": "success",
"data": {
"id": 8,
"orderNo": "SJB201909191148sJXGu",
"status": "00"
"orderNo": "sijibao201909191148sJXGu"
},
"requestid": "9952e339512740ebb6e5df72a4c09895"
}
......@@ -243,18 +265,17 @@ class ActionAPI extends APIBase {
"msg": "success",
"data": null,
"requestid": "e8f31dacc07c4764b8fd4f9955622385"
}
}
返回值说明:
orderNo : String :订单号
status : String :订单状态 00待处理 05执照办理中 10已出执照 15刻章办理中 20已刻章 25银行开户中 30银行已开户 35税务报到中 40已税务报到 50已邮寄
data : String :订单号
3.queryOrder:订单查询
### queryOrder:订单查询
功能描述:
查询以前添加的订单或者查询某个订单的状态
请求参数:
{
"action_process": "sjb",
"action_process": "sijibao",
"action_type": "queryOrder",
"action_body": {
"sign": "CBCE83769118A4D8906F097ECA558ACF",
......@@ -271,7 +292,7 @@ class ActionAPI extends APIBase {
"status": 0,
"msg": "success",
"data": {
"orderNo": "SJB2019091816016FXaj",
"orderNo": "sijibao2019091816016FXaj",
"channelOrderNo": "test0001",
"legalName": "测试法人修改",
"legalMobile": "15010929368",
......@@ -286,36 +307,71 @@ class ActionAPI extends APIBase {
"businessScope": "科技服务行业",
"capital": "1000万",
"status": "10",
"opNotes": null
"opNotes": null,
"domicileId": "11064622752480055",
"businessScopeId": "12219252215000155",
"businesssScope": "国内物流信息服务;装卸搬运服务;..."
},
"requestid": "d108d7fa93984886a3a659114e188a75"
}
返回值说明:
orderNo : String :订单号
channelOrderNo: String :渠道单号
legalName : String :法人姓名
legalMobile : String :法人电话
legalImg : String :法人证件照
idcard : String :法人身份证
idcardFront : String :身份证正面照片
idcardBack : String :身份证反面照片
bankNo : String :银行卡号
bank : String :开户行
bankImg : String :银行卡照片
names : String :个体户名称
businessScope : String :经营范围
capital : String :注册资本
status : String :订单状态 1000未付款, 1010待处理, 1020执照办理中, 1030已出执照, 1040刻章办理中, 1050已刻章,
1060银行开户中, 1070银行已开户, 1080税务报道中, 1090已税务报道, 1100已完成
opNotes : String :操作备注
4.putContract:个体工商户合同接收接口
orderNo : String :订单号
channelOrderNo : String :渠道单号
legalName : String :法人姓名
legalMobile : String :法人电话
legalImg : String :法人证件照
idcard : String :法人身份证
idcardFront : String :身份证正面照片
idcardBack : String :身份证反面照片
bankNo : String :银行卡号
bank : String :开户行
bankImg : String :银行卡照片
names : String :个体户名称
businessScope : String :经营范围
capital : String :注册资本
status : String :订单状态 1000未付款, 1010订单关闭, 1030待处理, 1050执照办理中, 1060已出执照, 1070刻章办理中,
1080已刻章, 1090银行开户中, 1100银行卡已开户, 1110税务报道中, 1120已税务报道, 1170已完成
opNotes : String :操作备注
domicileId : String :注册地编码
businessscopeId : String :经营范围编码
businesssScope : String :经营范围详情
### orderClose:订单关闭接口
功能描述:
如果客户订单提交错误,可使用该接口,关闭订单的操作,只允许再 1000未付款 状态下关闭,如果其他状态下关闭,请联系业务办理人员进行沟通
请求参数:
{
"action_process": "sijibao",
"action_type": "orderClose",
"action_body": {
"sign": "CBCE83769118A4D8906F097ECA558ACF",
"times_tamp": 1568713248,
"channelOrderNo": "test0001",
}
}
请求参数说明:
sign : String : 必填 :签名
times_tamp : long : 必填 :时间戳
channelOrderNo : String : 必填 :渠道订单号
返回值:
{
"status": 0,
"msg": "success",
"data": 1,
"requestid": "b14a73f9d6d84fc7be1e62feaf8316a0"
}
### putContract:个体工商户合同接收接口
功能描述:
个体工商户注册成功后,传入该个体工商户和商户之间的合同信息
个体工商户注册成功后,传入该个体工商户和商户之间的合同信息,才可以做到发票合规
请求参数:
{
"action_process": "sjb",
"action_process": "sijibao",
"action_type": "putContract",
"action_body": {
"sign": "CBCE83769118A4D8906F097ECA558ACF",
......@@ -342,13 +398,12 @@ class ActionAPI extends APIBase {
}
5.queryMerchantAccount: 商户账户查询
### queryMerchantAccount: 商户账户查询
功能描述:
查询商户再公司宝系统中的余额,包括可用余额和冻结金额
(冻结金额是再发票申请时,对可用余额冻结,当发票撤回或者审核不通过时,冻结余额退回到可用余额,当发票申请成功后,公司宝冻结金额扣除)
查询商户再公司宝系统中的余额
请求参数:
{
"action_process": "sjb",
"action_process": "sijibao",
"action_type": "queryMerchantAccount",
"action_body": {
"sign": "CBCE83769118A4D8906F097ECA558ACF",
......@@ -363,25 +418,21 @@ class ActionAPI extends APIBase {
"status": 0,
"msg": "success",
"data": {
"merchant_id": "SJB2019091816016FXaj", // 商户ID
"merchant_id": "sijibao2019091816016FXaj", // 商户ID
"banlance": 2222222 // 可用余额
},
"requestid": "305bcbe9b7f444e38c6155033e6cb66c"
}
返回值说明:
merchant_id : bigint :商户ID
banlance : bigint :可用余额
merchant_id : String :商户ID
banlance : bigint :可用余额(分)
6.queryMerchantTrade: 商户交易流水查询
※※※※ 业务改变,该接口不再提供
7.queryBusinessmen:个体工商户信息查询接口
### queryBusinessmen:个体工商户信息查询接口
功能描述
查询订单办理的个体工商户信息,包括执照、刻章、银行卡户、税务报道、邮寄、个税/增值税/附加税梯度等信息。
请求参数:
{
"action_process": "sjb",
"action_process": "sijibao",
"action_type": "queryBusinessmen",
"action_body": {
"sign": "CBCE83769118A4D8906F097ECA558ACF",
......@@ -398,7 +449,7 @@ class ActionAPI extends APIBase {
"status": 0,
"msg": "success",
"data": {
"orderNo": "SJB2019091816016FXaj",
"orderNo": "sijibao2019091816016FXaj",
"channelOrderNo": "test0001",
"status": "1050",
"legalName": "测试法人修改",
......@@ -431,8 +482,8 @@ class ActionAPI extends APIBase {
"commonOtherLadder": "",
"specialTaxLadder": "",
"specialOtherLadder": "",
"contractStartData": "2019-01-10T00:00:00.000Z",
"contractEndData": "2020-01-10T00:00:00.000Z",
"contractStartData": "2019-01-10",
"contractEndData": "2020-01-10",
"contract": "http://ttt.jpg",
"opNotes": null,
......@@ -444,42 +495,42 @@ class ActionAPI extends APIBase {
"requestid": "305bcbe9b7f444e38c6155033e6cb66c"
}
返回值说明:
orderNo : String :订单号
channelOrderNo : String :渠道订单号
orderNo : String :订单号
channelOrderNo : String :渠道订单号
status : String :状态 1030已出执照, 1050已刻章, 1070银行已开户, 1090已税务报道, 1100待签约 1120已签约
legalName : String :法人姓名
legalName : String :法人姓名
legalMobile : String :法人电话
legalIdCard : String :法人身份证号
name : String :个体工商户名称
creditCode : String :统一社会信用代码
businessPlace : String :经营场所
businessScope : String :经营范围
regDate : String :注册日期(YYYY-MM-DD)
businessImg : String :执照照片
gongzhang : String :公章
caiwuzhang : String :财务章
fapiaozhang : String :发票章
hetongzhang : String :合同章
farenzhang : String :法人章
isBank : int :是否开户 0否 1是
bankName : String :账户名称
bankNo : String :账户号
bank : String :开户行
bankImg : String :账户信息
caImg : String :CA照片
taxRegDay : String :税务登记日
taxOrg : String :税务机构名称
courierNo : String :快递单号
courierImg : String :快递交接单图片
addedValueRate : Double :增值税率
supertaxRate : Double :附加税率
commonTaxLadder : String :普票个税阶梯
commonOtherLadder : String :普票增值税、附加税阶梯
specialTaxLadder : String :专票个税阶梯
name : String :个体工商户名称
creditCode : String :统一社会信用代码
businessPlace : String :经营场所
businessScope : String :经营范围
regDate : String :注册日期(YYYY-MM-DD)
businessImg : String :执照照片
gongzhang : String :公章
caiwuzhang : String :财务章
fapiaozhang : String :发票章
hetongzhang : String :合同章
farenzhang : String :法人章
isBank : int :是否开户 0否 1是
bankName : String :账户名称
bankNo : String :账户号
bank : String :开户行
bankImg : String :账户信息
caImg : String :CA照片
taxRegDay : String :税务登记日
taxOrg : String :税务机构名称
courierNo : String :快递单号
courierImg : String :快递交接单图片
addedValueRate : Double :增值税率
supertaxRate : Double :附加税率
commonTaxLadder : String :普票个税阶梯
commonOtherLadder : String :普票增值税、附加税阶梯
specialTaxLadder : String :专票个税阶梯
specialOtherLadder: String :专票增值税、附加税阶梯
contract : String :个体户合同
contractStartData : String :合同开始时间(YYYY-MM-DD)
contractEndData : String :合同结束时间(YYYY-MM-DD)
contract : String :个体户合同
contractStartData : String :合同开始时间(YYYY-MM-DD)
contractEndData : String :合同结束时间(YYYY-MM-DD)
opNotes : String :操作备注
taxUpType : String :个税累计类型 10无 20按月累计 30按年累计
costRate : Double :核定成本费用率
......@@ -487,12 +538,12 @@ class ActionAPI extends APIBase {
invoiceContents : String :开票内容(多个以英文逗号分割)
8.rechargeApplication:商户充值申请接口
### rechargeApplication:商户充值申请接口
功能描述:
商户线下充值到公司宝后,提交充值申请接口,由公司宝财务审核通过后,金额加入到账户可用余额中
请求参数:
{
"action_process": "sjb",
"action_process": "sijibao",
"action_type": "rechargeApplication",
"action_body": {
"amt": 100000,
......@@ -516,12 +567,12 @@ class ActionAPI extends APIBase {
}
9.calcInvoice:发票试算接口
### calcInvoice:发票试算接口
功能描述:
商户使用试算接口,计算出当前开票所需要缴纳的个税、增值税、附加税、服务费等信息,用于开票前的展示,如果商户业务不需要展示,忽略此接口
请求参数:
{
"action_process": "sjb",
"action_process": "sijibao",
"action_type": "calcInvoice",
"action_body": {
"invoiceList": [
......@@ -537,49 +588,60 @@ class ActionAPI extends APIBase {
}
}
请求参数说明:
sign : String : 必填 :签名
sign : String : 必填 :签名
times_tamp : long : 必填 :时间戳
invoiceList : Array : 必填 :发票试算列表,最多不超过10个,不参与签名
businessmenCreditCode : String : 必填 :个体工商户统一社会信用代码
invoiceTime : String : 必填 :开票时间(YYYY-MM-DD)
invoiceAmt : bigint : 必填 :开票金额(分)
type : int : 必填 :开票类型 0普票 1专票
type : int : 必填 :开票类型 0普票 1专票
返回值:
{
"status": 0,
"msg": "success",
"data": {
"1": {
"code": 1,
"msg": "success",
"incomeTax": "20042494",
"addedValueTax": "28042996",
"specialTax": "2720171",
"serviceTax": "9372000",
"warning": "年度总开票金额已达到4400000",
"monthAmt": 440000
}
{
"status": 0,
"msg": "success",
"data": [{
"creditCode" : "1",
"code": 1,
"msg": "success",
"incomeTax": "20042494",
"addedValueTax": "28042996",
"specialTax": "2720171",
"serviceTax": "9372000",
"warning": "年度总开票金额已达到4400000",
"monthAmt": 440000
},
"requestid": "363e0391a43c4dedb5656623d1bcd540"
}
{
"creditCode" : "2",
"code": 1,
"msg": "success",
"incomeTax": "20042494",
"addedValueTax": "28042996",
"specialTax": "2720171",
"serviceTax": "9372000",
"warning": "年度总开票金额已达到4400000",
"monthAmt": 440000
},
],
"requestid": "363e0391a43c4dedb5656623d1bcd540"
}
返回值说明:
data : Object : 发票处理结果,Map格式,key为个体工商户统一社会信用代码
"1" : Object : 统一社会信用代码
"code" : int : 该个体工商户试算状态 1成功 -1失败
"msg" : String : 试算结果提示,错误时返回错误信息
"incomeTax" : bigint : 试算个税结果(分)
"addedValueTax" : bigint : 试算增值税结果(分)
"specialTax" : bigint : 试算附加费结果(分)
"serviceTax" : bigint : 试算服务费结果(分)
"warning" : String : 警告信息,该字段不为空时,在前端显示,
"monthAmt" : bigint : 该个体工商户在开票时间的月分中,已经申请开票的总金额
10.saveInvoice:申请开票接口
"data" : Array : 发票处理结果
"creditCode" : int : 个体户同意社会信用代码
"code" : int : 该个体工商户试算状态 1成功 -1失败
"msg" : String : 试算结果提示,错误时返回错误信息
"incomeTax" : bigint : 试算个税结果(分)
"addedValueTax" : bigint : 试算增值税结果(分)
"specialTax" : bigint : 试算附加费结果(分)
"serviceTax" : bigint : 试算服务费结果(分)
"warning" : String : 警告信息,该字段不为空时,在前端显示,
"monthAmt" : bigint : 该个体工商户在开票时间的月分中,已经申请开票的总金额
### saveInvoice:申请开票接口
功能描述:
商户为个体工商户申请开发票,批量开,一次不超过10条发票记录
请求参数:
{
"action_process": "sjb",
"action_process": "sijibao",
"action_type": "saveInvoice",
"action_body": {
"invoiceList": [
......@@ -599,104 +661,112 @@ class ActionAPI extends APIBase {
"settleImg": "https://bpohhr.gongsibao.com",
"type": 1
}
],
"times_tamp": 1568713248,
"sign": "D4393F17C96CDA582C1EE5FF0053671E"
}
}
请求参数说明:
sign : String : 必填 :签名
sign : String : 必填 :签名
times_tamp : long : 必填 :时间戳
invoiceList : Array : 必填 :开票申请列表,最多不超过10个,不参与签名
businessmenCreditCode : String : 必填 :个体工商户统一社会信用代码
applyNo : String : 必填 :开票申请编码(商户内唯一)
applyNo : String : 必填 :开票申请编码(商户内唯一)
invoiceTime : String : 必填 :开票时间(YYYY-MM-DD)
invoiceAmt : bigint : 必填 :开票金额(分)
settleImg : String : 必填 :结算单图片地址
type : int : 必填 :开票类型 0普票 1专票
settleImg: String : 必填 :结算单图片地址
type : int : 必填 :开票类型 0普票 1专票
返回值:
{
"status": 0,
"msg": "success",
"data": {
"1111": {
"data": [{
"creditCode": "1",
"code": 1,
"msg": "success"
},
"2222": {
"code": 1,
"msg": "success"
{
"creditCode": "2",
"code": -1,
"msg": "该个体户有发票处于审核中,审核通过后才能继续提交"
}
},
],
"requestid": "a39a364d83c14664b8e3399387fa847d"
}
返回值说明:
data : Object : 发票处理结果,Map格式,key为个体工商户统一社会信用代码
"1" : Object : 个体工商户统一社会信用代码为key的对象
"code" : int : 该个体工商户试算状态 1成功 -1失败
"msg" : String : 试算结果提示,错误时返回错误信息
data : Array : 发票处理结果
"creditCode" : Object : 个体工商户统一社会信用代码为key的对象
"code" : int : 该个体工商户试算状态 1成功 -1失败
"msg" : String : 试算结果提示,错误时返回错误信息
11.cancelInvoice:发票申请撤回接口
### cancelInvoice:发票申请撤回接口
功能描述:
商户可再开票申请之后,公司宝财务审核之前进行发票撤回,其他情况联系客户经理
请求参数:
{
"action_process": "sjb",
"action_process": "sijibao",
"action_type": "cancelInvoice",
"action_body": {
"times_tamp": 1568713248,
"applyNo": "100001"
}
}
请求参数说明:
sign : String : 必填 :签名
sign : String : 必填 :签名
times_tamp : long : 必填 :时间戳
applyNo : String : 必填 :开票申请编号
applyNo : String : 必填 :开票申请编号
返回值:
{
"status": 0,
"msg": "success",
"data": "success",
"data": "",
"requestid": "090bde8c5bb74b9d8c6b97beabf39161"
}
12.queryInvoice:发票查询接口
### queryInvoice:发票查询接口
功能描述:
查询某次开票申请的信息,包括发票状态、开票信息、邮寄信息、完税证明等信息
请求参数:
{
"action_process": "sjb",
"action_process": "sijibao",
"action_type": "queryInvoice",
"action_body": {
"times_tamp": 1568713248,
"applyNo": "100001"
}
}
请求参数说明:
sign : String :签名
sign : String :签名
times_tamp : long :时间戳
applyNo : String :开票申请编号
applyNo : String :开票申请编号
返回值:
{
merchant_id // 商户id
applyNo // 发票申请编号
status // 发票状态 00开票申请 10已撤回 20审核驳回 30审核通过 40已开票 50已邮寄
"status": 0,
"msg": "success",
"data": {
merchant_id // 商户id
applyNo // 发票申请编号
status // 发票状态 00开票申请 10已撤回 20审核驳回 30审核通过 40已开票 50已邮寄
auditRemark // 审核备注
auditRemark // 审核备注
invoiceNo // 发票编号
invoiceTime // 开票时间
invoiceImg // 发票照片
payVoucher // 支付凭证
invoiceNo // 发票编号
invoiceTime // 开票时间
invoiceImg // 发票照片
payVoucher // 支付凭证
courierNo // 快递单号
courierImg // 快递交接单图片
courierNo // 快递单号
courierImg // 快递交接单图片
taxNo // 完税批号
taxTime // 完税时间
taxVoucher // 完税证明(图片地址)
taxNo // 完税批号
taxTime // 完税时间
taxVoucher // 完税证明(图片地址)
},
"requestid": "090bde8c5bb74b9d8c6b97beabf39161"
}
返回值说明:
merchant_id : bigint : 商户id
merchantId : bigint : 商户id
applyNo : String : 发票申请编号
status : String : 发票状态 00开票申请 10已撤回 20审核驳回 30审核通过 40已开票 50已邮寄
auditRemark : String : 审核备注
......@@ -711,22 +781,22 @@ class ActionAPI extends APIBase {
taxTime : String : 完税时间
taxVoucher : String : 完税证明(图片地址)
13.queryTaxInvoice:完税证明查询
### queryTaxInvoice:完税证明查询
功能描述:
查询发票完税证明信息
请求参数:
{
"action_process": "sjb",
"action_process": "sijibao",
"action_type": "queryTaxInvoice",
"action_body": {
"times_tamp": 1568713248,
"applyNo": "100001"
}
}
请求参数说明:
sign : String :签名
sign : String :签名
times_tamp : long :时间戳
applyNo : String :开票申请编号
applyNo : String :开票申请编号
返回值:
{
......@@ -746,14 +816,15 @@ class ActionAPI extends APIBase {
taxVoucher : String : 完税证明(图片地址)
14: queryCourierTrace:查询邮寄进度
### queryCourierTrace:查询邮寄进度
功能描述:
查询邮寄进度
请求参数:
{
"action_process": "sjb",
"action_process": "sijibao",
"action_type": "queryTaxInvoice",
"action_body": {
"times_tamp": 1568713248,
"applyNo": "100001"
}
}
......@@ -763,44 +834,20 @@ class ActionAPI extends APIBase {
applyNo : String :开票申请编号
返回值:
{
merchant_id // 商户id
courierNo // 快递单号
courierStatus // 邮寄状态
courierTime // 时间
desc // 当前状态描述信息
"status": 0,
"msg": "success",
"data": {
merchantId: "", // 商户id
applyNo: "", // 开票申请编号,
courierNo: "xx" // 快递单号
courierStatus // 邮寄状态
courierTime // 时间
desc // 当前状态描述信息
},
"requestid": "090bde8c5bb74b9d8c6b97beabf39161"
}
返回值说明:
merchant_id : bigint : 商户id
applyNo : String : 发票申请编号
courierNo : String : 快递单号
courierStatus : String : 邮寄状态
courierTime : String : 时间(YYYY-MM-DD HH:mm:ss)
desc : String : 当前状态描述信息
15:提交个体工商户合同信息
功能描述:
提交贵公司与个体工商户的合同信息给公司宝,公司宝审核通过后,个体工商户才可以做用户签约(设置个体工商户个税、增值税、附加税阶梯)
请求参数:
{
"action_process": "sjb",
"action_type": "queryTaxInvoice",
"action_body": {
"applyNo": "100001"
}
}
请求参数说明:
sign : String :签名
times_tamp : long :时间戳
applyNo : String :开票申请编号
返回值:
{
merchant_id // 商户id
courierNo // 快递单号
courierStatus // 邮寄状态
courierTime // 时间
desc // 当前状态描述信息
}
返回值说明:
merchant_id : bigint : 商户id
applyNo : String : 发票申请编号
......@@ -814,34 +861,33 @@ class ActionAPI extends APIBase {
------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------------
通知回调商户接口:需要商户提供以下接收的回调地址,回调方式:POST
1. 充值审核
1. 充值审核
2. 订单状态变更推送
3. 个体户合同审核结果推送
4. 个体户签约结果推送
5. 发票状态变更推送
5. 发票状态变更推送
6. 发票完税证明推送
1.充值审核
### 充值审核
功能描述:商户提交发票申请后,公司宝财务在审核该申请之后,通知商户审核状态
推送参数:
{
merchant_id : bigint :商户id
merchantId : String :商户id
outTradeNo : String :充值流水号,
status : int :审核状态 00待审核 10已入账 20审核失败
remark : String :审核备注
}
4. 订单状态变更推送
### 订单状态变更推送
功能描述:订单状态发生变更后,公司宝将状态变更内容推送给商户
推送参数:
{
merchant_id : bigint : 商户id
status : String : 订单状态 1000未付款, 1010待处理, 1020执照办理中, 1030已出执照, 1040刻章办理中, 1050已刻章,
1060银行开户中, 1070银行已开户, 1080税务报道中, 1090已税务报道, 1100已完成
merchantId : String : 商户id
status : String : 订单状态 1050执照办理中, 1060已出执照, 1070刻章办理中, 1080已刻章, 1090银行开户中, 1100银行卡已开户, 1110税务报道中, 1120已税务报道, 1170已完成
channelOrderNo : String : 渠道订单号
// ----- 出执照推送数据 -----
name : String : 个体工商户名称
creditCode : String : 统一社会信用代码
name : String : 个体工商户名称
creditCode : String : 统一社会信用代码
businessPlace : String : 经营场所
businessScope : String : 经营范围
regDate : String : 注册日期 (YYYY-MM-DD)
......@@ -865,7 +911,6 @@ class ActionAPI extends APIBase {
bank : String : 开户行
bankImg : String : 账户信息
// ----- 税务报到推送数据 -----
caImg : String : CA照片
taxRegDay : String : 税务登记日
......@@ -874,18 +919,39 @@ class ActionAPI extends APIBase {
// ----- 邮寄推送数据 -----
courierNo : String : 快递单号
courierImg : String : 快递交接单图片
}
}
5. 个体户合同审核结果推送
### 个体户合同审核结果推送
推送参数:
{
merchantId : String : 商户id
channelOrderNo : String : 渠道订单号
status : String : 审核状态 10成功 20失败
}
6. 个体户签约结果推送
推送参数
{
merchantId : String :商户id
channelOrderNo : String :渠道订单号
creditCode : String :统一社会信用代码
7.发票状态变更推送
commonTaxLadder : String :普票个税阶梯
commonOtherLadder : String :普票增值税、附加税阶梯
specialTaxLadder : String :专票个税阶梯
specialOtherLadder: String :专票增值税、附加税阶梯
taxUpType : String :个税累计类型 10无 20按月累计 30按年累计
costRate : Double :核定成本费用率
signNotes : Double :签约备注
invoiceContents : String :开票内容(多个以英文逗号分割)
}
platformAssignment
7.发票状态变更推送
功能描述:发票状态变更后,公司宝将发票状态变更内容推送给商户
推送参数:
{
merchant_id : bigint :商户id
merchantId : bigint :商户id
applyNo : String :发票申请编号
status : String :发票状态 00开票申请 10已撤回 20审核驳回 30审核通过 40已开票 50已邮寄
status : String :发票状态 0090开票申请 1010审核驳回 1030审核通过 1050已开票 1090已完成
// ----- 发票审核数据字段 -----
auditRemark : String :审核备注
......@@ -900,7 +966,7 @@ class ActionAPI extends APIBase {
courierNo : String :快递单号
courierImg : String :快递交接单图片
}
8.发票完税证明推送
8.发票完税证明推送
功能描述:公司宝客户经理再处理完税证明后,公司宝将完税证明信息推送给商户
推送参数:
{
......@@ -932,41 +998,41 @@ class ActionAPI extends APIBase {
签名字符串示例:times_tamp=1568713248&key=XXXX,key为平台提供的密钥,对字符串进行
后进行大写转换
方法中需要传递的action_type列表有:
queryMerchant:查询商户
addOrder/putOrder:添加订单/修改订单
queryOrder:订单查询
putContract:个体工商户合同接收接口
queryMerchantAccount:商户账户查询
queryMerchantTrade:商户交易流水查询
queryBusinessmen:个体工商户信息查询接口
rechargeApplication:商户充值申请接口
calcInvoice:发票试算接口
saveInvoice:申请开票接口
cancelInvoice:发票申请撤回接口
queryInvoice:发票查询接口
queryTaxInvoice:完税证明查询
queryCourierTrace:查询邮寄进度
<pre/>`,
queryMerchant:查询商户
addOrder/putOrder:添加订单/修改订单
queryOrder:订单查询
orderClose:订单关闭接口
putContract:个体工商户合同接收接口
queryMerchantAccount: 商户账户查询
queryBusinessmen:个体工商户信息查询接口
rechargeApplication:商户充值申请接口
calcInvoice:发票试算接口
saveInvoice:申请开票接口
cancelInvoice:发票申请撤回接口
queryInvoice:发票查询接口
queryTaxInvoice:完税证明查询
queryCourierTrace:查询邮寄进度
<pre/>`,
methodName: "springboard",
paramdescs: [
{
paramDesc: "请求的行为,传递如:sjb",
paramName: "action_process",
paramType: "string",
defaultValue: null,
},
{
paramDesc: "业务操作类型,详情见方法中的描述",
paramName: "action_type",
paramType: "string",
defaultValue: null,
},
{
paramDesc: "业务操作类型的参数,action_body必须传递的参数有,times_tamp(时间戳,类型int)、sign(签名,类型string),其余的为业务需要的参数",
paramName: "action_body",
paramType: "json",
defaultValue: null,
}
{
paramDesc: "请求的行为,传递如:sijibao",
paramName: "action_process",
paramType: "string",
defaultValue: null,
},
{
paramDesc: "业务操作类型,详情见方法中的描述",
paramName: "action_type",
paramType: "string",
defaultValue: null,
},
{
paramDesc: "业务操作类型的参数,action_body必须传递的参数有,times_tamp(时间戳,类型int)、sign(签名,类型string),其余的为业务需要的参数",
paramName: "action_body",
paramType: "json",
defaultValue: null,
}
],
rtnTypeDesc: `<pre>
status: 返回状态,
......@@ -981,10 +1047,10 @@ class ActionAPI extends APIBase {
<pre/>`,
rtnType: `<pre>
{
"status": 0,
"msg": "success",
"data": {},
"requestid": "8cbd498f9d1441b1812ecaa2653933f4"
"status": 0,
"msg": "success",
"data": {},
"requestid": "8cbd498f9d1441b1812ecaa2653933f4"
}
<pre/>`
}
......
......@@ -4,8 +4,8 @@ const querystring = require('querystring');
var settings = require("../../../../config/settings");
const CtlBase = require("../../ctl.base");
const logCtl = system.getObject("web.common.oplogCtl");
const md5 = require("MD5");
const uuidv4 = require('uuid/v4');
var svgCaptcha = require('svg-captcha');
var cacheBaseComp = null;
class UserCtl extends CtlBase {
......@@ -30,11 +30,11 @@ class UserCtl extends CtlBase {
}
}
async login(qobj, pobj, req, res) {
async login(pobj, pobj2, req, res) {
var loginName = this.trim(pobj.loginName);
var password = this.trim(pobj.password);
var captchaKey = this.trim(qobj.captchaKey);
var captchaCode = this.trim(qobj.captchaCode);
var captchaKey = this.trim(pobj.captchaKey);
var captchaCode = this.trim(pobj.captchaCode);
try {
......@@ -49,11 +49,22 @@ class UserCtl extends CtlBase {
// return system.getResult(null, "图片验证码不一致,请点击重试");
// }
var adminUser = await this.service.findById(1);
var adminUser = await this.service.findOne({ucname: loginName});
// var adminUser = await this.service.findById(1);
if(!adminUser) {
return system.getResult(null, "用户名或密码错误");
}
var passwdMD5 = md5(password);
if(passwdMD5 != adminUser.passwd) {
return system.getResult(null, "用户名或密码错误");
}
adminUser.lastLoginTime = new Date();
await adminUser.save();
var xggadminsid = uuidv4();
xggadminsid = "3cb49932-fa02-44f0-90db-9f06fe02e5c7";
await this.redisClient.setWithEx(xggadminsid, JSON.stringify(adminUser), 60 * 60 * 2);
// 处理登录逻辑
var result = {
xggadminsid: xggadminsid,
......
......@@ -9,47 +9,137 @@ class BusinessmenCtl extends CtlBase {
constructor() {
super();
this.businessmenSve = system.getObject("service.business.businessmenSve");
}
async myPage(pobj, pobj2, req) {
async allPage(pobj, pobj2, req) {
try {
var condition = {
currentPage: pobj.currentPage,
pageSize: pobj.pageSize,
userId: req.loginUser.ucid,
orderId: pobj.orderId,
merchantId: pobj.merchantId,
orderId: this.trim(pobj.orderId),
bstatus: pobj.status,
}
return await this.businessmenSve.myPage(condition);
return await this.businessmenSve.allPage(condition);
} catch (error) {
console.log(error);
return system.getResultFail(500, "接口异常:" + error.message);
}
}
async invoicePage(pobj, pobj2, req) {
async info(pobj, pobj2, req) {
try {
var condition = {
id: pobj.id,
}
return await this.businessmenSve.info(condition);
} catch (error) {
console.log(error);
return system.getResultFail(500, "接口异常:" + error.message);
}
}
async sign(pobj, pobj2, req) {
var params = {
id: pobj.id,
taxUpType: pobj.taxUpType,
addValueUpType: pobj.addValueUpType,
costRate: system.y2f(pobj.costRate),
taxRate: system.y2f(pobj.taxRate),
serviceRate: system.y2f(pobj.serviceRate),
signNotes: this.trim(pobj.signNotes),
commonTaxLadder: JSON.stringify(pobj.commonTaxLadder),
commonOtherLadder: JSON.stringify(pobj.commonOtherLadder),
specialTaxLadder: JSON.stringify(pobj.specialTaxLadder),
specialOtherLadder: JSON.stringify(pobj.specialOtherLadder),
invoicecontents: pobj.invoicecontents,
}
try {
return await this.businessmenSve.sign(params);
} catch (error) {
console.log(error);
return system.getResultFail(500, "接口异常:" + error.message);
}
}
async signNames(pobj, pobj2, req) {
try {
var condition = {
bstatuses: ["2020"],
}
return await this.businessmenSve.nameList(condition);
} catch (error) {
console.log(error);
return system.getResultFail(500, "接口异常:" + error.message);
}
}
async signPage(pobj, pobj2, req) {
try {
var condition = {
currentPage: pobj.currentPage,
pageSize: pobj.pageSize,
userId: req.loginUser.ucid,
orderId: pobj.orderId,
businessmenId: pobj.businessmenId,
}
return await this.businessmenSve.invoicePage(condition);
return await this.businessmenSve.signPage(condition);
} catch (error) {
console.log(error);
return system.getResultFail(500, "接口异常:" + error.message);
}
}
async info(pobj, pobj2, req) {
async deliverPage(pobj, pobj2, req) {
try {
var condition = {
id: pobj.id,
currentPage: pobj.currentPage,
pageSize: pobj.pageSize,
orderId: pobj.orderId,
dstatus: pobj.status,
deliverId: "",
}
return await this.businessmenSve.info(condition);
return await this.businessmenSve.deliverPage(condition);
} catch (error) {
console.log(error);
return system.getResultFail(500, "接口异常:" + error.message);
}
}
// async auditContract(pobj, pobj2, req) {
// try {
// var id = Number(pobj.id);
// var status = Number(pobj.status);
// var notes = this.trim(pobj.notes);
// return await this.service.auditContract(id, status, notes);
// } catch (error) {
// console.log(error);
// return system.getResultFail(500, "接口异常:" + error.message);
// }
// }
// async businessmenSign(pobj, pobj2, req) {
// var params = {
// id: pobj.id,
// commonTaxLadder: this.trim(pobj.commonTaxLadder),
// commonOtherLadder: this.trim(pobj.commonOtherLadder),
// specialTaxLadder: this.trim(pobj.specialTaxLadder),
// specialOtherLadder: this.trim(pobj.specialOtherLadder),
// }
// try {
// return await this.service.businessmenSign(params);
// } catch (error) {
// console.log(error);
// return system.getResultFail(500, "接口异常:" + error.message);
// }
// }
}
module.exports = BusinessmenCtl;
\ No newline at end of file
......@@ -8,12 +8,12 @@ var svgCaptcha = require('svg-captcha');
class InvoicecontentCtl extends CtlBase {
constructor() {
super();
this.invoicecontentSev = system.getObject("service.common.invoicecontentSev");
this.invoicecontentSve = system.getObject("service.common.invoicecontentSve");
}
async list(pobj, pobj2, req) {
try {
return await this.invoicecontentSev.list(pobj);
return await this.invoicecontentSve.list(pobj);
} catch (e) {
console.log(e);
return system.getResultFail(500, "接口错误");
......@@ -22,7 +22,7 @@ class InvoicecontentCtl extends CtlBase {
async info(pobj, pobj2, req) {
try {
return await this.invoicecontentSev.info(pobj);
return await this.invoicecontentSve.info(pobj);
} catch (e) {
console.log(e);
return system.getResultFail(500, "接口错误");
......@@ -31,7 +31,7 @@ class InvoicecontentCtl extends CtlBase {
async save(pobj, pobj2, req) {
try {
return await this.invoicecontentSev.save(pobj);
return await this.invoicecontentSve.save(pobj);
} catch (e) {
console.log(e);
return system.getResultFail(500, "接口错误");
......@@ -40,7 +40,7 @@ class InvoicecontentCtl extends CtlBase {
async del(pobj, pobj2, req) {
try {
return await this.invoicecontentSev.del(pobj);
return await this.invoicecontentSve.del(pobj);
} catch (e) {
console.log(e);
return system.getResultFail(500, "接口错误");
......
......@@ -23,7 +23,7 @@ class MetaCtl extends CtlBase {
["starts-with", "$key", "zc"]
]
};
var b = new Buffer.from(JSON.stringify(policyText));
var b = new Buffer(JSON.stringify(policyText));
var policyBase64 = b.toString('base64');
var signature = crypto.createHmac('sha1', accesskey).update(policyBase64).digest().toString('base64'); //base64
......
var system = require("../../../system")
const CtlBase = require("../../ctlms.base");
class ManagerCtl extends CtlBase {
constructor() {
super();
this.invoiceSve = system.getObject("service.invoice.invoiceSve");
}
/**
* 交易数据(平台)
* @param {*} pobj
*/
async transData(pobj, pobj2, req) {
try {
var params = {
type: pobj.type || 1,
};
// 交易数据
return await this.invoiceSve.statManageData(params);
} catch (e) {
console.log(e);
return system.getResultFail(500, "接口错误");
}
}
/**
* 首页业务数据(平台)
* @param {*} pobj
*/
async businessData(pobj, pobj2, req) {
try {
var params = {
type: pobj.type || 1,
};
// 业务数据
return await this.invoiceSve.statBusinessData(params);
} catch (e) {
console.log(e);
return system.getResultFail(500, "接口错误");
}
}
/**
* 首页交易数据(交付商)
* @param {*} pobj
*/
async delTransData(pobj, pobj2, req) {
try {
var params = {
type: pobj.type || 1,
delivererId:this.trim(pobj.delivererId)
};
// 交易数据
return await this.invoiceSve.delStatManageData(params);
} catch (e) {
console.log(e);
return system.getResultFail(500, "接口错误");
}
}
/**
* 首页业务数据(交付商)
* @param {*} pobj
*/
async delBusinessData(pobj, pobj2, req) {
try {
var params = {
type: pobj.type || 1,
delivererId:this.trim(pobj.delivererId)
};
// 业务数据
return await this.invoiceSve.delStatBusinessData(params);
} catch (e) {
console.log(e);
return system.getResultFail(500, "接口错误");
}
}
//业务概览 (平台)
async deliverData(pobj, pobj2, req) {
try {
var params = {
type: pobj.type || 1,
currentPage: pobj.currentPage || 1,
pageSize: pobj.pageSize || 10,
}
// 业务办理概览
return await this.invoiceSve.statDeliverData(params);
} catch (e) {
console.log(e);
return system.getResultFail(500, "接口错误");
}
}
}
module.exports = ManagerCtl;
\ No newline at end of file
var system = require("../../../system")
const http = require("http")
const querystring = require('querystring');
var settings = require("../../../../config/settings");
const CtlBase = require("../../ctlms.base");
const logCtl = system.getObject("web.common.oplogCtl");
var cacheBaseComp = null;
class ManagerCtl extends CtlBase {
constructor() {
super();
this.orderSve = system.getObject("service.order.orderSve");
this.invoiceSve = system.getObject("service.invoice.invoiceSve");
}
/**
* 首页交易数据
* @param {*} pobj
*/
async transData(pobj, pobj2, req) {
try {
var params = {
type: pobj.type || 1,
};
// 交易数据
return await this.orderSve.statManageData(params);
} catch (e) {
console.log(e);
return system.getResultFail(500, "接口错误");
}
}
/**
* 首页业务数据
* @param {*} pobj
*/
async businessData(pobj, pobj2, req) {
try {
var params = {
type: pobj.type || 1,
};
// 业务数据
return await this.orderSve.statBusinessData(params);
} catch (e) {
console.log(e);
return system.getResultFail(500, "接口错误");
}
}
async deliverData(pobj, pobj2, req) {
try {
var params = {
type: pobj.type || 1,
currentPage: pobj.currentPage || 1,
pageSize: pobj.pageSize || 10,
}
// 业务办理概览
return await this.orderSve.statDeliverData(params);
} catch (e) {
console.log(e);
return system.getResultFail(500, "接口错误");
}
}
}
module.exports = ManagerCtl;
\ No newline at end of file
var system = require("../../../system")
const CtlBase = require("../../ctlms.base");
class InvoiceCtl extends CtlBase {
constructor() {
super();
this.invoiceSve = system.getObject("service.invoice.invoiceSve");
}
/**
* 申请发票校验
* @param {*} pobj
*/
async verification(pobj) {
try {
return await this.invoiceSve.apiVerification(pobj);
} catch (error) {
console.log(error);
return system.getResultFail(500, `接口错误 错误信息 ${error}`);
}
}
/**
* 查询明细(平台)
* @param {*} pobj
*/
async queryInvoice(pobj) {
try {
return await this.invoiceSve.apiQueryInvoiceAdmin(pobj);
} catch (error) {
console.log(error);
return system.getResultFail(500, `接口错误 错误信息 ${error}`);
}
}
/**
* 发票明细(交付商)
* @param {*} pobj
*/
async queryInvoiceDeliverer(pobj) {
try {
return await this.invoiceSve.apiQueryInvoiceDeliverer(pobj);
} catch (error) {
console.log(error);
return system.getResultFail(500, `接口错误 错误信息 ${error}`);
}
}
/**
* 发票试算接口
* @param {*} pobj
*/
async calcInvoice(pobj) {
try {
return await this.invoiceSve.apiCalcInvoice(pobj);
} catch (error) {
console.log(error);
return system.getResultFail(500, `接口错误 错误信息 ${error}`);
}
}
/**
* 发票申请保存
* @param {*} pobj
*/
async saveInvoice(pobj) {
try {
return await this.invoiceSve.apiSaveInvoiceAdm(pobj);
} catch (error) {
console.log(error);
return system.getResultFail(500, `接口错误 错误信息 ${error}`);
}
}
/**
* 平台审批
* @param {*} pobj
*/
async platformAssignment(pobj){
try {
let nextStatus = this.trim(pobj.nextStatus);
if(nextStatus=="1030"){ //平台交付商分配
pobj.id=this.trim(pobj.id);
pobj.delivererAmount=system.y2f(pobj.delivererAmount);
pobj.merchantId=this.trim(pobj.merchantId);
pobj.delivererId=this.trim(pobj.delivererId);
pobj.delivererName=this.trim(pobj.delivererName);
}else if(nextStatus=="1070"){//平台提交审批
pobj.id=this.trim(pobj.id);
pobj.auditContent=this.trim(pobj.auditContent);
pobj.delivererContent=this.trim(pobj.delivererContent);
pobj.mailAddr=this.trim(pobj.mailAddr);
pobj.mailMobile=this.trim(pobj.mailMobile);
pobj.mailTo=this.trim(pobj.mailTo);
}else if(nextStatus=="1090"){//平台完成
pobj.id=this.trim(pobj.id);
pobj.auditContent=this.trim(pobj.auditContent);
pobj.delivererContent=this.trim(pobj.delivererContent);
pobj.mailAddr=this.trim(pobj.mailAddr);
pobj.mailMobile=this.trim(pobj.mailMobile);
pobj.mailTo=this.trim(pobj.mailTo);
}else if(nextStatus=="1300"){//平台第二次审核不通过
pobj.id=this.trim(pobj.id);
}
return await this.invoiceSve.apiPlatformAssignment(pobj);
} catch (error) {
console.log(error);
return system.getResultFail(500, `接口错误 错误信息 ${error}`);
}
}
/**
* 交付商审批
* @param {*} pobj
*/
async delivererAssignment(pobj){
try {
let nextStatus = this.trim(pobj.nextStatus);
if(nextStatus=="1050"){ //交付商审批
pobj.id=this.trim(pobj.id);
pobj.invoiceNo=this.trim(pobj.invoiceNo);
pobj.invoiceImg=this.trim(pobj.invoiceImg);
}else if(nextStatus=="1060"){ //交付商提交审批
pobj.id=this.trim(pobj.id);
}else if(nextStatus=="1080"){ //交付商邮寄
pobj.id=this.trim(pobj.id);
pobj.mailNo=this.trim(pobj.mailNo);
}else if(nextStatus=="1040"){ //交付商拒绝处理
pobj.breakReason=this.trim(pobj.breakReason);
}
return await this.invoiceSve.apiDelivererAssignment(pobj);
} catch (error) {
console.log(error);
return system.getResultFail(500, `接口错误 错误信息 ${error}`);
}
}
/**
* 完税证明
* @param {*} pobj
*/
async txPayment(pobj){
try {
return await this.invoiceSve.apiTxPayment(pobj);
} catch (error) {
return system.getResultFail(500, `接口错误 错误信息 ${error}`);
}
}
/**
* 查看完税证明
* @param {*} pobj
*/
async queryTxPayment(pobj){
try {
return await this.invoiceSve.apiQueryTxPayment(pobj);
} catch (error) {
return system.getResultFail(500, `接口错误 错误信息 ${error}`);
}
}
/**
* 发票列表(交付商)
* @param {*} pobj
*/
async delivererInvoices(pobj){
try {
return await this.invoiceSve.apiDelivererInvoices(pobj);
} catch (error) {
return system.getResultFail(500, `接口错误 错误信息 ${error}`);
}
}
/**
* 发票审核列表(交付商)
* @param {*} pobj
*/
async delivererApplyInvoices(pobj){
try {
return await this.invoiceSve.apiDelivererApplyInvoices(pobj);
} catch (error) {
return system.getResultFail(500, `接口错误 错误信息 ${error}`);
}
}
/**
* 发票列表(平台)
* @param {*} pobj
*/
async queryInvoices(pobj){
try {
return await this.invoiceSve.apiQueryInvoices(pobj);
} catch (error) {
return system.getResultFail(500, `接口错误 错误信息 ${error}`);
}
}
/**
* 发票申请列表(平台)
* @param {*} pobj
*/
async queryApplyInvoices(pobj){
try {
return await this.invoiceSve.apiQueryApplyInvoices(pobj);
} catch (error) {
return system.getResultFail(500, `接口错误 错误信息 ${error}`);
}
}
/**
* 平台更新邮寄号(平台)
* @param {*} pobj
*/
async upEmNo(pobj){
try {
return await this.invoiceSve.apiUpEmNo(pobj);
} catch (error) {
return system.getResultFail(500, `接口错误 错误信息 ${error}`);
}
}
async redrush(pobj, pobj2, req, res) {
try {
return await this.invoiceSve.apiRedrush(pobj);
} catch (error) {
return system.getResultFail(500, `接口错误 错误信息 ${error}`);
}
}
}
module.exports = InvoiceCtl;
\ No newline at end of file
......@@ -32,9 +32,10 @@ class MerchantrechargeCtl extends CtlBase {
async audit(pobj, pobj2, req) {
try {
var loginUser = req.loginUser;
pobj.opUser = {
"ucid": "111111",
"ucname": "ceshi"
"ucid": loginUser.ucid,
"ucname": loginUser.ucname
}
return await this.merchantrechargeSve.audit(pobj);
} catch (e) {
......
var system = require("../../../system")
const http = require("http")
const querystring = require('querystring');
var settings = require("../../../../config/settings");
const CtlBase = require("../../ctlms.base");
const logCtl = system.getObject("web.common.oplogCtl");
var cacheBaseComp = null;
class OrderCtl extends CtlBase {
constructor() {
super();
this.orderSve = system.getObject("service.order.orderSve");
}
async allPage(pobj, pobj2, req) {
var condition = {
currentPage: pobj.currentPage || 1,
pageSize: pobj.pageSize || 10,
merchantId: pobj.merchantId,
orderId: this.trim(pobj.orderNo),
channelOrderNo: this.trim(pobj.channelOrderNo),
status: pobj.status,
assignBegin: this.trim(pobj.assignBegin),
assignEnd: this.trim(pobj.assignEnd),
}
this.doTimeCondition(condition, ["createdBegin", "createdEnd"]);
this.doTimeCondition(condition, ["assignBegin", "assignEnd"]);
try {
return await this.orderSve.allOrderList(condition);
} catch (e) {
console.log(e);
return system.getResultFail(500, "接口错误");
}
}
async close(pobj, pobj2, req) {
try {
return await this.orderSve.closeById({
id: pobj.id
});
} catch (e) {
console.log(e);
return system.getResultFail(500, "接口错误");
}
}
async assign(pobj, pobj2, req) {
try {
var params = {
assignUcname: req.loginUser.ucname,
id: pobj.id,
deliver_id: this.trim(pobj.deliverId),
deliverName: this.trim(pobj.deliverName),
deliverDivide: system.y2f(Number(pobj.deliverDivide)),
}
return await this.orderSve.assign(params);
} catch (e) {
console.log(e);
return system.getResultFail(500, "接口错误");
}
}
async orderEdit(pobj, pobj2, req) {
try {
var params = {
id: pobj.id,
merchantId: this.trim(pobj.merchantId),
price: system.y2f(Number(pobj.price)),
}
return await this.orderSve.orderEdit(params);
} catch (e) {
console.log(e);
return system.getResultFail(500, "接口错误");
}
}
async allInfo(pobj, pobj2, req) {
try {
var params = {
id: pobj.id
}
return await this.orderSve.orderInfoAll(params, true);
} catch (e) {
console.log(e);
return system.getResultFail(500, "接口错误");
}
}
async deliverInfo(pobj, pobj2, req) {
try {
var params = {
id: pobj.id
}
return await this.orderSve.orderInfoAll(params);
} catch (e) {
console.log(e);
return system.getResultFail(500, "接口错误");
}
}
async deliverEdit(pobj, pobj2, req) {
try {
return await this.orderSve.deliverEdit(pobj);
} catch (e) {
console.log(e);
return system.getResultFail(500, "接口错误");
}
}
async deliverClose(pobj, pobj2, req) {
try {
return await this.orderSve.deliverClose(pobj);
} catch (e) {
console.log(e);
return system.getResultFail(500, "接口错误");
}
}
async handlePage(pobj, pobj2, req) {
try {
var condition = {
id: pobj.id,
currentPage: pobj.currentPage || 1,
pageSize: pobj.pageSize || 1,
orderId: this.trim(pobj.orderId),
status: this.trim(pobj.status),
deliverId: "", // TODO 传入具体办理人
}
this.doTimeCondition(condition, ["createdBegin", "createdEnd"]);
return await this.orderSve.handlePage(condition);
} catch (e) {
console.log(e);
return system.getResultFail(500, "接口错误");
}
}
async deliverHandle(pobj, pobj2, req) {
try {
var handleObj = {
id: pobj.id,
status: pobj.status,
name: this.trim(pobj.name),
creditCode: this.trim(pobj.creditCode),
businessPlace: this.trim(pobj.businessPlace),
businessScope: this.trim(pobj.businessScope),
regDate: this.trim(pobj.regDate),
businessImg: this.trim(pobj.businessImg),
gongzhang: this.trim(pobj.gongzhang),
caiwuzhang: this.trim(pobj.caiwuzhang),
fapiaozhang: this.trim(pobj.fapiaozhang),
hetongzhang: this.trim(pobj.hetongzhang),
farenzhang: this.trim(pobj.farenzhang),
isBank: this.trim(pobj.isBank),
bankName: this.trim(pobj.bankName),
bankNo: this.trim(pobj.bankNo),
bank: this.trim(pobj.bank),
bankImg: this.trim(pobj.bankImg),
caImg: this.trim(pobj.caImg),
taxRegDay: this.trim(pobj.taxRegDay),
taxOrg: this.trim(pobj.taxOrg),
courierNo: this.trim(pobj.courierNo),
courierImg: this.trim(pobj.courierImg),
}
return await this.orderSve.deliverHandle(handleObj);
} catch (e) {
console.log(e);
return system.getResultFail(500, "接口错误");
}
}
async deliverAudit(pobj, pobj2, req) {
try {
var auditObj = {};
auditObj.id = pobj.id;
auditObj.auditUser = req.loginUser.ucname;
auditObj.status = pobj.status;
auditObj.auditRemark = this.trim(pobj.auditRemark);
auditObj.content = this.trim(pobj.content);
auditObj.addressee = this.trim(pobj.addressee);
auditObj.mobile = this.trim(pobj.mobile);
auditObj.addr = this.trim(pobj.addr);
auditObj.auditResult = this.trim(pobj.auditResult);
return await this.orderSve.deliverAudit(auditObj);
} catch (e) {
console.log(e);
return system.getResultFail(500, "接口错误");
}
}
async orderComplete(pobj, pobj2, req) {
try {
var handleObj = {
id: pobj.id,
deliverType: this.trim(pobj.deliverType),
deliverNo: this.trim(pobj.deliverNo),
deliverImg: this.trim(pobj.deliverImg),
}
return await this.orderSve.orderComplete(handleObj);
} catch (e) {
console.log(e);
return system.getResultFail(500, "接口错误");
}
}
// async orderList(pobj, pobj2, req) {
// try {
// // 订单状态 00待处理 10出执照 20已刻章 30银行开户 40税务报道 50已邮寄
// var condition = {
// currentPage: pobj.currentPage,
// pageSize: pobj.pageSize,
// merchantId: pobj.merchantId,
// orderNo: this.trim(pobj.orderNo),
// channelOrderNo: this.trim(pobj.channelOrderNo),
// status: pobj.status,
// createdBegin: this.trim(pobj.createdBegin),
// createdEnd: this.trim(pobj.createdEnd),
// }
// this.doTimeCondition(condition, ["createdBegin", "createdEnd"]);
// var page = await this.service.pageByCondition(condition);
// console.log(page);
// return system.getResultSuccess(page);
// } catch (error) {
// console.log(error);
// return system.getResultFail(500, "接口异常:" + error.message);
// }
// }
// async createStep(pobj, pobj2, req) {
// var id = Number(pobj.orderId);
// var status = pobj.status;
// try {
// switch (status) {
// case "05": //"执照办理中"
// case "15": //"刻章办理中"
// case "25": //"银行开户中"
// case "35": //"税务报到中"
// return await this.service.changeStatus(id, status);
// case "10": { //"已出执照"
// var params = {
// orderId: pobj.orderId,
// name: this.trim(pobj.name), // 个体工商户名称
// creditCode: this.trim(pobj.creditCode), // 统一社会信用代码
// businessPlace: this.trim(pobj.businessPlace), // 经营场所
// businessScope: this.trim(pobj.businessScope), // 经营范围
// regDate: this.trim(pobj.regDate), // 注册日期
// businessImg: this.trim(pobj.businessImg), // 执照照片
// };
// return await this.service.createLicense(pobj);
// }
// case "20": { //"已刻章"
// var params = {
// orderId: pobj.orderId,
// gongzhang: this.trim(pobj.gongzhang),
// caiwuzhang: this.trim(pobj.caiwuzhang),
// businessImg: this.trim(pobj.businessImg),
// fapiaozhang: this.trim(pobj.fapiaozhang),
// hetongzhang: this.trim(pobj.hetongzhang),
// farenzhang: this.trim(pobj.farenzhang),
// };
// return await this.businessmenSve.putSealInfo(params);
// }
// case "30": { //"银行已开户"
// var params = {
// orderId: pobj.orderId,
// isBank: Number(pobj.isBank) == 1,
// bankName: this.trim(pobj.bankName),
// bankNo: this.trim(pobj.bankNo),
// bank: this.trim(pobj.bank),
// bankImg: this.trim(pobj.bankImg),
// }
// return await this.businessmenSve.putBankInfo(params);
// }
// case "40": { //"已税务报到"
// var params = {
// orderId: pobj.orderId,
// caImg: this.trim(pobj.caImg),
// taxRegDay: this.trim(pobj.taxRegDay),
// taxOrg: this.trim(pobj.taxOrg),
// }
// return await this.businessmenSve.putTaxInfo(params);
// }
// case "50": { //"已邮寄"
// var params = {
// orderId: pobj.orderId,
// courierNo: this.trim(pobj.courierNo),
// courierImg: this.trim(pobj.courierImg),
// }
// return await this.businessmenSve.putExpressInfo(params);
// }
// default : {
// return system.getResult(null, "状态错误");
// }
// }
// } catch (error) {
// console.log(error);
// return system.getResultFail(500, "接口异常:" + error.message);
// }
// }
}
module.exports = OrderCtl;
\ No newline at end of file
......@@ -9,7 +9,7 @@ class CacheBase {
this.isdebug = this.isdebug();
}
isdebug() {
return false;
return true;
}
desc() {
throw new Error("子类需要定义desc方法,返回缓存描述");
......
......@@ -4,7 +4,8 @@ const settings = require("../../../config/settings");
class ApiAppIdCheckCache extends CacheBase {
constructor() {
super();
this.merchantDao = system.getObject("db.merchant.merchantDao");
this.merchantSve = system.getObject("service.merchant.merchantSve");
}
desc() {
return "应用中来访访问appid缓存";
......@@ -13,11 +14,11 @@ class ApiAppIdCheckCache extends CacheBase {
return settings.cacheprefix + "_verify_appid:";
}
async buildCacheVal(cachekey, inputkey, val, ex, ...items) {
var item = await this.merchantDao.getItemByAppId(inputkey);
if (!item) {
var item = await this.merchantSve.getById(inputkey);
if (!item && item.data) {
return null;
}
return JSON.stringify(item);
return JSON.stringify(item.data);
}
}
module.exports = ApiAppIdCheckCache;
module.exports = ApiAppIdCheckCache;
\ No newline at end of file
......@@ -24,17 +24,6 @@ class Dao {
});
}
}
async bulkCreate(objs){
if(!objs || objs.length == 0) {
return;
}
for(var obj of objs) {
if(!obj.id) {
obj.id = await this.redisClient.genrateId(this.modelName);
}
}
return await this.model.bulkCreate(objs);
}
static getModelName(ClassObj) {
return ClassObj["name"].substring(0, ClassObj["name"].lastIndexOf("Dao")).toLowerCase();
}
......@@ -222,8 +211,8 @@ class Dao {
return await this.model.findAndCountAll(tmpWhere);
}
async findOne(obj, t) {
var params = {"where": obj};
if(t) {
var params = { "where": obj };
if (t) {
params.transaction = t;
}
return this.model.findOne(params);
......@@ -231,5 +220,72 @@ class Dao {
async findById(oid) {
return this.model.findById(oid);
}
async setListCodeName(list, field) {
if (!list) {
return;
}
for (item of list) {
await this.setRowCodeName(item, field);
}
}
async setRowCodeName(item, field) {
if (!item || !field) {
return;
}
var map = this[field + "Map"] || {};
if (!item) {
return;
}
item[field + "Name"] = map[item[field] || ""] || "";
}
async getRowCodeName(item, field) {
if (!item || !field) {
return "";
}
var map = this[field + "Map"] || {};
if (!item) {
return "";
}
return map[item[field] || ""] || "";
}
async getById(id, attrs) {
if (!id) {
return null;
}
attrs = attrs || "*";
var sql = "SELECT " + attrs + " FROM " + this.model.tableName + " where id = :id ";
var list = await this.customQuery(sql, {
id: id
});
return list && list.length > 0 ? list[0] : null;
}
async getListByIds(ids, attrs) {
if (!ids || ids.length == 0) {
return [];
}
attrs = attrs || "*";
var sql = "SELECT " + attrs + " FROM " + this.model.tableName + " where id IN (:ids) ";
return await this.customQuery(sql, {
ids: ids
}) || [];
}
async getMapByIds(ids, attrs) {
var result = {};
var list = await this.getListByIds(ids, attrs);
if (!list || list.length == 0) {
return result;
}
for (var item of list) {
result[item.id] = item;
}
return result;
}
}
module.exports = Dao;
const system = require("../../../system");
const Dao = require("../../dao.base");
class PushapiDao extends Dao {
constructor() {
super(Dao.getModelName(PushapiDao));
}
}
module.exports = PushapiDao;
\ No newline at end of file
const system=require("../../../system");
const Dao=require("../../dao.base");
class MerchantpushlogDao extends Dao{
constructor(){
super(Dao.getModelName(MerchantpushlogDao));
const system = require("../../../system");
const Dao = require("../../dao.base");
class PushlogDao extends Dao {
constructor() {
super(Dao.getModelName(PushlogDao));
}
}
module.exports=MerchantpushlogDao;
// var u=new UserDao();
// var roledao=system.getObject("db.roleDao");
// (async ()=>{
// var users=await u.model.findAll({where:{app_id:1}});
// var role=await roledao.model.findOne({where:{code:"guest"}});
// console.log(role);
// for(var i=0;i<users.length;i++){
// await users[i].setRoles([role]);
// console.log(i);
// }
//
// })();
module.exports = PushlogDao;
// var u=new UserDao();
// var roledao=system.getObject("db.roleDao");
// (async ()=>{
// var users=await u.model.findAll({where:{app_id:1}});
// var role=await roledao.model.findOne({where:{code:"guest"}});
// console.log(role);
// for(var i=0;i<users.length;i++){
// await users[i].setRoles([role]);
// console.log(i);
// }
//
// })();
\ No newline at end of file
......@@ -11,6 +11,11 @@ module.exports = (db, DataTypes) => {
type:DataTypes.STRING,
allowNull: false,
},
lastLoginTime: {
type:DataTypes.DATE,
allowNull: true,
},
passwd: DataTypes.STRING,
},{
paranoid: true,//假的删除
underscored: true,
......@@ -18,7 +23,7 @@ module.exports = (db, DataTypes) => {
freezeTableName: true,
// freezeTableName: true,
// define the table's name
tableName: 'xgg_user',
tableName: 'xgg_admin_user',
validate: {
},
indexes:[
......
......@@ -2,58 +2,89 @@ const system = require("../../../system");
const settings = require("../../../../config/settings");
const uiconfig = system.getUiConfig2(settings.appKey);
module.exports = (db, DataTypes) => {
return db.define("merchanttradeprocess", {
return db.define("businessmen", {
order_id: DataTypes.BIGINT,
merchant_id: DataTypes.BIGINT,
invoice_id: DataTypes.BIGINT,
invoiceNo: DataTypes.STRING(64),
amtType: DataTypes.STRING,
amt: DataTypes.BIGINT,
frozen_amt: DataTypes.BIGINT,
available_amt: DataTypes.BIGINT,
busiType: DataTypes.STRING,
complete: {
orderNo: DataTypes.STRING(64),
channelOrderNo: DataTypes.STRING(64),
status: DataTypes.STRING(20),//状态 00待处理 10出执照 20已刻章 30银行开户 40税务报道 50已邮寄 60已签约
legalName: DataTypes.STRING(20),
legalMobile: DataTypes.STRING(20),
name: DataTypes.STRING(100),
creditCode: DataTypes.STRING(100),
businessPlace: DataTypes.STRING(100),
businessScope: DataTypes.STRING(500),
regDate: DataTypes.DATE,
businessImg: DataTypes.STRING(300),
gongzhang: DataTypes.STRING(300),
caiwuzhang: DataTypes.STRING(300),
fapiaozhang: DataTypes.STRING(300),
hetongzhang: DataTypes.STRING(300),
farenzhang: DataTypes.STRING(300),
isBank: {
type: DataTypes.BOOLEAN,
defaultValue: false
},
bankName: DataTypes.STRING(50),
bankNo: DataTypes.STRING(30),
bank: DataTypes.STRING(100),
bankImg: DataTypes.STRING(300),
caImg: DataTypes.STRING(300),
taxRegDay: DataTypes.DATE,
taxOrg: DataTypes.STRING(100),
courierNo: DataTypes.STRING(100),
courierImg: DataTypes.STRING(100),
addedValueRate: DataTypes.DOUBLE(11, 2),
supertaxRate: DataTypes.DOUBLE(11, 2),
commonTaxLadder: DataTypes.STRING(1000),
commonOtherLadder: DataTypes.STRING(1000),
specialTaxLadder: DataTypes.STRING(1000),
specialOtherLadder: DataTypes.STRING(1000),
contractStartData: DataTypes.DATE,
contractEndData: DataTypes.DATE,
contract: DataTypes.STRING(300),//个体户合同
notes: DataTypes.STRING,//备注
opNotes: DataTypes.STRING,//操作备注
}, {
paranoid: true, //假的删除
underscored: true,
version: true,
freezeTableName: true,
//freezeTableName: true,
// define the table's name
tableName: 'xgg_merchant_trade_process',
validate: {},
indexes: [
// Create a unique index on email
// {
// unique: true,
// fields: ['email']
// },
//
// // Creates a gin index on data with the jsonb_path_ops operator
// {
// fields: ['data'],
// using: 'gin',
// operator: 'jsonb_path_ops'
// },
//
// // By default index name will be [table]_[fields]
// // Creates a multi column partial index
// {
// name: 'public_by_author',
// fields: ['author', 'status'],
// where: {
// status: 'public'
// }
// },
//
// // A BTREE index with a ordered field
// {
// name: 'title_index',
// method: 'BTREE',
// fields: ['author', {attribute: 'title', collate: 'en_US', order: 'DESC', length: 5}]
// }
]
});
paranoid: true, //假的删除
underscored: true,
version: true,
freezeTableName: true,
//freezeTableName: true,
// define the table's name
tableName: 'xgg_businessmen',
validate: {},
indexes: [
// Create a unique index on email
// {
// unique: true,
// fields: ['email']
// },
//
// // Creates a gin index on data with the jsonb_path_ops operator
// {
// fields: ['data'],
// using: 'gin',
// operator: 'jsonb_path_ops'
// },
//
// // By default index name will be [table]_[fields]
// // Creates a multi column partial index
// {
// name: 'public_by_author',
// fields: ['author', 'status'],
// where: {
// status: 'public'
// }
// },
//
// // A BTREE index with a ordered field
// {
// name: 'title_index',
// method: 'BTREE',
// fields: ['author', {attribute: 'title', collate: 'en_US', order: 'DESC', length: 5}]
// }
]
});
}
\ No newline at end of file
......@@ -2,60 +2,63 @@ const system = require("../../../system");
const settings = require("../../../../config/settings");
const uiconfig = system.getUiConfig2(settings.appKey);
module.exports = (db, DataTypes) => {
return db.define("merchantpush", {
return db.define("order", {
merchant_id: DataTypes.BIGINT,
merchangeUpdate: DataTypes.STRING(200),
orderUpdate: DataTypes.STRING(200),
yichuzhizhao: DataTypes.STRING(200),
yikezhang: DataTypes.STRING(200),
yikaihu: DataTypes.STRING(200),
yishuiwubaodao: DataTypes.STRING(200),
yiyouji: DataTypes.STRING(200),
fapiaoshenhe: DataTypes.STRING(200),
fapiaokaiju: DataTypes.STRING(200),
fapiaoyouji: DataTypes.STRING(200),
fapiaowanshui: DataTypes.STRING(200),
chongzhishenhe: DataTypes.STRING(200),
orderNo: DataTypes.STRING(64),
channelOrderNo: DataTypes.STRING(64),
legalName: DataTypes.STRING(20),
legalMobile: DataTypes.STRING(20),
legalImg: DataTypes.STRING(300),
idcard: DataTypes.STRING(20),
idcardFront: DataTypes.STRING(300),
idcardBack: DataTypes.STRING(300),
bankNo: DataTypes.STRING(30),
bank: DataTypes.STRING(200),
names: DataTypes.STRING(300),
businessScope: DataTypes.STRING(500),
capital: DataTypes.STRING(100),
status: DataTypes.STRING(20),//订单状态 00待处理 10出执照 20已刻章 30银行开户 40税务报道 50已邮寄
notes: DataTypes.STRING,//备注
opNotes: DataTypes.STRING,//操作备注
}, {
paranoid: true, //假的删除
underscored: true,
version: true,
freezeTableName: true,
//freezeTableName: true,
// define the table's name
tableName: 'xgg_merchant_push',
validate: {},
indexes: [
// Create a unique index on email
// {
// unique: true,
// fields: ['email']
// },
//
// // Creates a gin index on data with the jsonb_path_ops operator
// {
// fields: ['data'],
// using: 'gin',
// operator: 'jsonb_path_ops'
// },
//
// // By default index name will be [table]_[fields]
// // Creates a multi column partial index
// {
// name: 'public_by_author',
// fields: ['author', 'status'],
// where: {
// status: 'public'
// }
// },
//
// // A BTREE index with a ordered field
// {
// name: 'title_index',
// method: 'BTREE',
// fields: ['author', {attribute: 'title', collate: 'en_US', order: 'DESC', length: 5}]
// }
]
});
paranoid: true, //假的删除
underscored: true,
version: true,
freezeTableName: true,
//freezeTableName: true,
// define the table's name
tableName: 'xgg_order',
validate: {},
indexes: [
// Create a unique index on email
// {
// unique: true,
// fields: ['email']
// },
//
// // Creates a gin index on data with the jsonb_path_ops operator
// {
// fields: ['data'],
// using: 'gin',
// operator: 'jsonb_path_ops'
// },
//
// // By default index name will be [table]_[fields]
// // Creates a multi column partial index
// {
// name: 'public_by_author',
// fields: ['author', 'status'],
// where: {
// status: 'public'
// }
// },
//
// // A BTREE index with a ordered field
// {
// name: 'title_index',
// method: 'BTREE',
// fields: ['author', {attribute: 'title', collate: 'en_US', order: 'DESC', length: 5}]
// }
]
});
}
\ No newline at end of file
......@@ -2,18 +2,13 @@ const system = require("../../../system");
const settings = require("../../../../config/settings");
const uiconfig = system.getUiConfig2(settings.appKey);
module.exports = (db, DataTypes) => {
return db.define("merchanttrade", {
return db.define("pushapi", {
merchant_id: DataTypes.BIGINT,
invoice_id: DataTypes.BIGINT,
invoiceNo: DataTypes.STRING(64),
invoiceApplyNo: DataTypes.STRING(64),
recharge_id: DataTypes.BIGINT,
outTradeNo: DataTypes.STRING(64),
amt: DataTypes.BIGINT,
balance: DataTypes.BIGINT,
type: DataTypes.INTEGER,
businessType: DataTypes.INTEGER,
outTradeNo: DataTypes.STRING(64),
rechargeAudit: DataTypes.STRING(200),
orderStatus: DataTypes.STRING(200),
businessmenSign: DataTypes.STRING(200),
invoiceStatus: DataTypes.STRING(200),
invoiceTax: DataTypes.STRING(200),
}, {
paranoid: true, //假的删除
underscored: true,
......@@ -21,7 +16,7 @@ module.exports = (db, DataTypes) => {
freezeTableName: true,
//freezeTableName: true,
// define the table's name
tableName: 'xgg_merchant_trade',
tableName: 'xgg_push_api',
validate: {},
indexes: [
// Create a unique index on email
......
......@@ -2,9 +2,10 @@ const system = require("../../../system");
const settings = require("../../../../config/settings");
const uiconfig = system.getUiConfig2(settings.appKey);
module.exports = (db, DataTypes) => {
return db.define("merchantpushlog", {
merchant_id: DataTypes.BIGINT,
return db.define("pushlog", {
merchant_id: DataTypes.STRING,
dataType: DataTypes.INTEGER,
dataId: DataTypes.STRING,
api: DataTypes.STRING(200),
params: DataTypes.STRING(5000),
rs: DataTypes.STRING(200),
......@@ -20,7 +21,7 @@ module.exports = (db, DataTypes) => {
freezeTableName: true,
//freezeTableName: true,
// define the table's name
tableName: 'xgg_merchant_push_log',
tableName: 'xgg_push_log',
validate: {},
indexes: [
// Create a unique index on email
......
const system = require("../../../system");
const ServiceBase = require("../../svems.base")
const settings = require("../../../../config/settings")
class BusinessmenService extends ServiceBase {
constructor() {
super();
}
async allPage(params) {
var rs = await this.callms("order", "businessmenPage", params);
if (rs.status != 0 || !rs.data || !rs.data.rows) {
return rs;
}
await this.setMerchant(rs.data.rows);
this.transField(rs.data.rows);
return rs;
}
async signPage(params) {
var rs = await this.callms("order", "businessmenSignPage", params);
if (rs.status != 0 || !rs.data || !rs.data.rows) {
return rs;
}
this.transField(rs.data.rows);
return rs;
}
async deliverPage(params) {
var rs = await this.callms("order", "businessmenDeliverPage", params);
if (rs.status != 0 || !rs.data || !rs.data.rows) {
return rs;
}
this.transField(rs.data.rows);
return rs;
}
async info(params) {
var rs = await this.callms("order", "businessmenInfo", params);
await this.setMerchant([rs.data]);
this.transField([rs.data]);
return rs;
}
async sign(params) {
return await this.callms("order", "businessmenSign", params);
}
async nameList(params) {
return await this.callms("order", "businessmenNameList", params);
}
async queryBusinessmen(params) {
var condition = {
merchantId: this.trim(params.merchant_id || params.merchantId),
channelOrderNo: this.trim(params.channelOrderNo),
}
var rs = await this.callms("order", "businessmenByChannelOrderNo", condition);
if (rs.status != 0 && !rs.data) {
return rs;
}
var businessmen = rs.data;
if(!businessmen) {
return system.getResult(null, "个体户不存在");
}
var dto = {};
dto.orderNo = this.trim(businessmen.orderNo);
dto.channelOrderNo = this.trim(businessmen.channelOrderNo);
dto.status = this.trim(businessmen.gstatus);
dto.legalName = this.trim(businessmen.legalName);
dto.legalMobile = this.trim(businessmen.legalMobile);
dto.legalIdCard = this.trim(businessmen.legalIdCard);
dto.name = this.trim(businessmen.name);
dto.creditCode = this.trim(businessmen.creditCode);
dto.businessPlace = this.trim(businessmen.businessPlace);
dto.businessScope = this.trim(businessmen.businessScope);
dto.regDate = this.trim(businessmen.regDate);
dto.businessImg = this.trim(businessmen.businessImg);
dto.gongzhang = this.trim(businessmen.gongzhang);
dto.caiwuzhang = this.trim(businessmen.caiwuzhang);
dto.fapiaozhang = this.trim(businessmen.fapiaozhang);
dto.hetongzhang = this.trim(businessmen.hetongzhang);
dto.farenzhang = this.trim(businessmen.farenzhang);
dto.isBank = this.trim(businessmen.isBank);
dto.bankName = this.trim(businessmen.bankName);
dto.bankNo = this.trim(businessmen.bankNo);
dto.bank = this.trim(businessmen.bank);
dto.bankImg = this.trim(businessmen.bankImg);
dto.caImg = this.trim(businessmen.caImg);
dto.taxRegDay = this.trim(businessmen.taxRegDay);
dto.taxOrg = this.trim(businessmen.taxOrg);
dto.courierNo = this.trim(businessmen.courierNo);
dto.courierImg = this.trim(businessmen.courierImg);
dto.addedValueRate = this.trim(businessmen.addedValueRate);
dto.supertaxRate = this.trim(businessmen.supertaxRate);
dto.commonTaxLadder = this.trim(businessmen.commonTaxLadder);
dto.commonOtherLadder = this.trim(businessmen.commonOtherLadder);
dto.specialTaxLadder = this.trim(businessmen.specialTaxLadder);
dto.specialOtherLadder = this.trim(businessmen.specialOtherLadder);
dto.contractStartData = this.trim(businessmen.contractStartData);
dto.contractEndData = this.trim(businessmen.contractEndData);
dto.contract = this.trim(businessmen.contract);
dto.opNotes = this.trim(businessmen.opNotes);
dto.taxUpType = this.trim(businessmen.taxUpType);
dto.costRate = this.trim(businessmen.costRate);
dto.signNotes = this.trim(businessmen.signNotes);
dto.invoiceContents = this.trim(businessmen.invoiceContents);
return system.getResultSuccess(dto);
}
async putContract(params) {
var merchantId = params.merchant_id || params.merchantId;
var condition = {
merchantId: merchantId,
channelOrderNo: params.channelOrderNo,
contractStartData: params.contractStartData,
contractEndData: params.contractEndData,
contract: params.contract,
};
var rs = await this.callms("order", "addBusinessmenContract", condition);
return rs;
}
async setMerchant(rows) {
if (!rows || rows.length == 0) {
return;
}
var merchantIds = [];
for (var row of rows) {
merchantIds.push(row.merchant_id);
}
var mmap = await this.callms("merchant", "getMapByIds", {
ids: merchantIds,
attrs: "id, name"
});
mmap = mmap.data || {};
for (var row of rows) {
row.merchant = mmap[row.merchant_id] || {};
}
}
transField(rows) {
if (!rows) {
return;
}
for (var row of rows) {
row.costRate = system.f2y(row.costRate);
row.taxRate = system.f2y(row.taxRate);
row.serviceRate = system.f2y(row.serviceRate);
this.parseJsonField(row, ["commonTaxLadder", "commonOtherLadder", "specialTaxLadder", "specialOtherLadder"]);
}
}
parseJsonField(row, fields) {
if (!row || !fields || fields.length == 0) {
return;
}
for (var f of fields) {
if (!f || !row[f]) {
continue;
}
try {
row[f] = JSON.parse(row[f]);
} catch (error) {
console.log(error);
}
}
}
}
module.exports = BusinessmenService;
// var task=new UserService();
// task.getUserStatisticGroupByApp().then(function(result){
// console.log((result));
// }).catch(function(e){
// console.log(e);
// });
\ No newline at end of file
const system = require("../../../system");
const ServiceBase = require("../../svems.base");
var settings = require("../../../../config/settings");
class DeliverService extends ServiceBase {
constructor() {
super();
}
async queryCourierTrace(params) {
var result = {
merchantId: "11111202101312",
courierNo: "222222222",
courierStatus: "配送中",
courierTime: "2019-10-01 10:10:10",
desc: "到达xxxxx",
applyNo: "100001",
}
return system.getResultSuccess(result);
}
}
module.exports = DeliverService;
\ 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();
this.status = {
"0090": {
"status": "0090",
"name": "未付款",
"next": "1000",
"cstatus": "0090", //客户
"dstatus": "", //交付商
},
"1000": {
"status": "1000",
"name": "待审核",
"next": "1020",
"cstatus": "0090", //客户
"dstatus": "", //交付商
},
"1010": {
"status": "1010",
"name": "审核不通过",
"next": "",
"cstatus": "1010",
"dstatus": "",
},
"1020": {
"status": "1020",
"name": "待分配",
"next": "1030",
"cstatus": "1030",
"dstatus": "",
},
"1030": {
"status": "1030",
"name": "待处理",
"next": "1050",
"cstatus": "1030",
"dstatus": "1030",
},
"1040": {
"status": "1040",
"name": "交付商关闭",
"next": "1020",
"cstatus": "1030",
"dstatus": "1040",
},
"1050": {
"status": "1050",
"name": "已开具",
"next": "1060",
"cstatus": "1050",
"dstatus": "1050",
},
"1060": {
"status": "1060",
"name": "待审核",
"next": "1070",
"cstatus": "1050",
"dstatus": "1070",
},
"1070": {
"status": "1070",
"name": "审核通过",
"next": "1080",
"cstatus": "1050",
"dstatus": "1070",
},
"1080": {
"status": "1080",
"name": "已邮寄",
"next": "1090",
"cstatus": "1050",
"dstatus": "1080",
},
"1090": {
"status": "1090",
"name": "完成",
"next": "1100",
"cstatus": "1090",
"dstatus": "1080",
},
"1100": {
"status": "1090",
"name": "发票撤回",
"next": "1100",
"cstatus": "1090",
"dstatus": "1080",
},
"1200": {
"status": "1200",
"name": "红冲",
"next": "",
"cstatus": "1200",
"dstatus": "",
},
"1300": {
"status": "1300",
"name": "审核失败(平台第二次审核)",
"next": "1060",
"cstatus": "1050",
"dstatus": "1060",
}
};
}
async apiCalcInvoice(pobj) {
var merchantId = pobj.merchant_id || pobj.merchantId;
var invoiceList = pobj.invoiceList;
if (!invoiceList || invoiceList.length == 0) {
return system.getResult(null, "请传入试算开票信息");
}
var creditCodes = [];
for (var invoice of invoiceList) {
creditCodes.push(invoice.businessmenCreditCode);
}
// 查询个体户签约信息
var mapRs = await this.callms("order", "businessmenCompleteMapByCreditCodes", {
creditCodes: creditCodes
});
var map = mapRs.data;
var result = [];
for (var invoice of invoiceList) {
var calc = {
creditCode: invoice.businessmenCreditCode,
incomeTax: 0,
addedValueTax: 0,
serviceTax: 0,
specialTax: 0,
warning: "",
monthAmt: 0,
};
var signInfo = map[invoice.businessmenCreditCode];
if (!signInfo) {
calc.code = -1;
calc.msg = "个体工商户【" + invoice.businessmenCreditCode + "】不存在";
result.push(calc);
continue;
}
invoice.invoiceAmount = Number(invoice.invoiceAmt);
invoice.invoiceTime = this.trim(invoice.invoiceTime);
invoice.businessmenCreditCode = this.trim(invoice.businessmenCreditCode);
invoice.serviceRate = signInfo.serviceRate;
invoice.perCalWay = signInfo.taxUpType; // TODO 确定值
invoice.valCalWay = signInfo.addValueUpType; // TODO 确定值
invoice.businessmenId = signInfo.id;
invoice.taxCostPriRat = signInfo.costRate;
invoice.taxIncPriRat = signInfo.taxRate;
if (invoice.type == 1) {
invoice.perIncTaxRange = JSON.parse(signInfo.specialTaxLadder);
invoice.valAddTaxRange = JSON.parse(signInfo.specialOtherLadder);
} else {
invoice.perIncTaxRange = JSON.parse(signInfo.commonTaxLadder);
invoice.valAddTaxRange = JSON.parse(signInfo.commonOtherLadder);
}
try {
console.log(JSON.stringify(invoice));
var rs = await this.callms("invoice", "calcInvoice", invoice);
if (rs.status == 0 && rs.data) {
var calcRs = rs.data;
calc.code = 1;
calc.incomeTax = Number((calcRs.personalIncomeTax || 0)).toFixed(0);
calc.addedValueTax = Number((calcRs.valueAddedTax || 0)).toFixed(0);
calc.serviceTax = Number((calcRs.serviceCharge || 0)).toFixed(0);
calc.specialTax = Number((calcRs.additionalTax || 0)).toFixed(0);
calc.warning = this.trim(calcRs.warning);
calc.monthAmt = 0;
calc.msg = "success";
} else {
calc.code = -1;
calc.msg = rs.msg || "发票服务异常";
}
console.log(rs);
} catch (error) {
calc.code = -1;
calc.msg = "发票服务异常,请联系公司宝";
console.log(error);
}
result.push(calc);
}
return system.getResultSuccess(result);
}
async apiSaveInvoice(pobj) {
var merchantId = pobj.merchant_id || pobj.merchantId;
var invoiceList = pobj.invoiceList;
if (!invoiceList || invoiceList.length == 0) {
return system.getResult(null, "请传入试算开票信息");
}
var creditCodes = [];
for (var invoice of invoiceList) {
creditCodes.push(invoice.businessmenCreditCode);
}
// 查商户titile
var merchantRs = await this.callms("merchant", "getById", {
id: merchantId
});
var merchant = merchantRs.data || {};
var title = await this.callms("merchant", "getMerchantTitleDefault", {
merchantId: merchantId
});
title = title.data;
var address = await this.callms("merchant", "getMerchantAddressDefault", {
merchantId: merchantId
});
var address = address.data || {};
// 查询个体户签约信息
var mapRs = await this.callms("order", "businessmenCompleteMapByCreditCodes", {
creditCodes: creditCodes
});
var map = mapRs.data;
var result = [];
for (var invoice of invoiceList) {
var data = {
creditCode: invoice.businessmenCreditCode,
code: 1,
msg: "success",
applyNo: invoice.applyNo,
};
var signInfo = map[invoice.businessmenCreditCode];
if (!signInfo) {
data.code = -1;
data.msg = "个体工商户【" + invoice.businessmenCreditCode + "】不存在";
result.push(data);
continue;
}
// 发票类型:10 普通发票 20 增值税专用发票 30 电子发票
if (invoice.type === 0) {
invoice.type == "10";
} else if (invoice.type === 1) {
invoice.type == "20";
} else {
invoice.type == "30";
}
// 购买方
invoice.merchantId = merchantId;
invoice.merchantName = merchant.name;
invoice.merchantCreditCode = title.taxNo;
invoice.merchantAddr = title.invoiceAddr;
invoice.merchantMobile = title.invoiceMobile;
invoice.merchantBank = title.accountName;
invoice.merchantAccount = title.accountPublic;
// 申请方联系电话
invoice.applyPhone = merchant.contactMobile;
// 邮寄地址
invoice.mailAddr = address.mailAddr;
invoice.mailMobile = address.mailMobile;
invoice.mailTo = address.mailTo;
invoice.invoiceAmount = Number(invoice.invoiceAmt);
invoice.invoiceTime = this.trim(invoice.invoiceTime);
invoice.businessmenCreditCode = this.trim(invoice.businessmenCreditCode);
// 开票内容
if (signInfo.invoicecontents && signInfo.invoicecontents.length > 0) {
invoice.invoiceContent = signInfo.invoicecontents[0].invoicecontentName;
} else {
invoice.invoiceContent = "服务费";
}
invoice.settleImg = "";
invoice.statements = invoice.settleImg;
invoice.contract = "";
invoice.applyNo = invoice.applyNo;
invoice.serviceRate = signInfo.serviceRate;
invoice.perCalWay = signInfo.taxUpType;
invoice.valCalWay = signInfo.addValueUpType;
// 销售方信息
invoice.businessmenId = signInfo.id;
invoice.businessName = signInfo.name;
invoice.isBank = signInfo.isBank;
invoice.taxAuthorities = signInfo.taxOrg;
invoice.taxCostPriRat = signInfo.costRate;
invoice.taxIncPriRat = signInfo.taxRate;
if (invoice.type == 1) {
invoice.perIncTaxRange = JSON.parse(signInfo.specialTaxLadder);
invoice.valAddTaxRange = JSON.parse(signInfo.specialOtherLadder);
} else {
invoice.perIncTaxRange = JSON.parse(signInfo.commonTaxLadder);
invoice.valAddTaxRange = JSON.parse(signInfo.commonOtherLadder);
}
try {
var rs = await this.callms("invoice", "saveInvoice", invoice);
if (rs.status != 0) {
data.code = -1;
data.msg = rs.msg || "发票服务异常";
}
console.log(rs);
} catch (error) {
data.code = -1;
data.msg = "发票服务异常,请联系公司宝";
console.log(error);
}
result.push(data);
}
return system.getResultSuccess(result);
}
async apiCancelInvoice(pobj) {
var params = {
applyNo: pobj.applyNo,
merchantId: pobj.merchantId || pobj.merchant_id
}
var rs = await this.callms("invoice", "apiCancelInvoice", params);
if (rs.data) {
rs.data = null;
}
return rs;
}
async apiQueryInvoice(pobj) {
var params = {
applyNo: pobj.applyNo,
merchantId: pobj.merchantId || pobj.merchant_id
}
// queryInvoices
var rs = await this.callms("invoice", "queryInvoice", params);
if (rs.status != 0 || !rs.data) {
return system.getResult(null, "发票不存在");
}
var invoiceApply = rs.data || {};
var invoice = invoiceApply.invoice || {};
var result = {
"merchantId": this.trim(invoiceApply.merchantId),
"applyNo": this.trim(invoiceApply.applyNo),
"status": this.trim(invoiceApply.customerStatus),
"auditRemark": this.trim(invoiceApply.remark),
"invoiceNo": this.trim(invoiceApply.id),
"payVoucher": this.trim(invoiceApply.statements),
"courierImg": "",
"courierNo": this.trim(invoice.mailNo),
"invoiceTime": this.trim(invoice.invoiceTime),
"invoiceImg": this.trim(invoice.invoiceImg),
"complateTax": this.trim(invoice.complateTax),
"taxNo": this.trim(invoice.taxNo),
"taxTime": this.trim(invoice.taxTime),
"taxVoucher": this.trim(invoice.taxVoucher),
}
return system.getResultSuccess(result);
}
async apiQueryTaxInvoice(pobj) {
var params = {
applyNo: pobj.applyNo,
merchantId: pobj.merchantId || pobj.merchant_id,
id: pobj.id
}
// queryInvoices
var rs = await this.callms("invoice", "getByApplyNo", params);
if (rs.status != 0 || !rs.data) {
return system.getResult(null, "发票不存在");
}
var invoice = rs.data || {};
var paytaxes = invoice.paytaxes || {};
this.handleDate(paytaxes, ["payTaxesTime"], "YYYY-MM-DD", -8);
var result = {
"merchantId": this.trim(invoice.merchantId),
"applyNo": this.trim(invoice.applyNo),
"taxNo": this.trim(paytaxes.payTaxesNo),
"taxTime": this.trim(paytaxes.payTaxesTime),
"taxVoucher": this.trim(paytaxes.payTaxesImg),
}
return system.getResultSuccess(result);
}
/**
* 发票明细(平台)
* @param {*} pobj
* @param {string} id
* @param {string} applyNo
* @param {string} merchant_id
*/
async apiQueryInvoiceAdmin(pobj) {
var params = {
applyNo: pobj.applyNo,
merchantId: pobj.merchantId || pobj.merchant_id,
id: pobj.id || null
}
var res = await this.callms("invoice", "queryInvoice", params);
if (res.status != 0 || !res.data) {
return system.getResult(null, "发票不存在");
}
res.data.invoiceAmount = system.f2y(res.data.invoiceAmount);
res.data.personalIncomeTax = system.f2y(res.data.personalIncomeTax);
res.data.additionalTax = system.f2y(res.data.additionalTax);
res.data.valueAddedTax = system.f2y(res.data.valueAddedTax);
res.data.serviceCharge = system.f2y(res.data.serviceCharge);
res.data.isBank = res.data.isBank == 1 ? "已开户" : "未开户";
if (res.data.type == 10) {
res.data.type = "普通发票";
} else if (res.data.type == 20) {
res.data.type = "增值税专用发票";
} else {
res.data.type = "电子发票"
}
res.data.payWay = res.data.payWay == "20" ? "线上支付" : "系统账户扣款";
res.data.isPay = res.data.isPay == 1 ? "已支付" : "未付款";
res.data.isInvalid = res.data.isInvalid === 2 ? '未红冲' : '已红冲';
res.data.deliverer.delivererAmount = system.f2y(res.data.deliverer.delivererAmount);
res.data.invoice.complateTax = res.data.invoice.complateTax == "1" ? "已完税" : "未完税";
this.handleDate(res.data, ["invoiceTime"], "YYYY-MM-DD", -8);
this.handleDate(res.data, ["createdAt"], "YYYY-MM-DD", -8);
this.handleDate(res.data['deliverer'], ["createdAt"], "YYYY-MM-DD", -8);
this.handleDate(res.data['deliverer'], ["updatedAt"], "YYYY-MM-DD", -8);
this.handleDate(res.data['invoice'], ["invoiceTime"], "YYYY-MM-DD", -8);
this.handleDate(res.data['invoice'], ["taxTime"], "YYYY-MM-DD", -8);
this.handleDate(res.data["invoice"], ["createdAt"], "YYYY-MM-DD", -8);
this.handleDate(res.data["invoice"], ["updatedAt"], "YYYY-MM-DD", -8);
return res;
}
/**
* 发票明细(交付商)
* @param {*} pobj
* @param {string} id
* @param {string} applyNo
* @param {string} merchant_id
*/
async apiQueryInvoiceDeliverer(pobj) {
var params = {
applyNo: pobj.applyNo,
merchantId: pobj.merchantId || pobj.merchant_id,
id: pobj.id || null
}
var rs = await this.callms("invoice", "queryInvoiceDeliverer", params);
if (rs.status != 0 || !rs.data) {
return system.getResult(null, "发票不存在");
}
rs.data.invoiceAmount = system.f2y(rs.data.invoiceAmount);
rs.data.personalIncomeTax = system.f2y(rs.data.personalIncomeTax);
rs.data.additionalTax = system.f2y(rs.data.additionalTax);
rs.data.valueAddedTax = system.f2y(rs.data.valueAddedTax);
rs.data.serviceCharge = system.f2y(rs.data.serviceCharge);
return rs;
}
/**
* 校验审核
* @param {*} pobj
*/
async apiVerification(pobj) {
var params = {
businessmenCreditCode: pobj.businessmenCreditCode
}
var rs = await this.callms("invoice", "verification", params);
if (rs.status != 0) {
return system.getResult(null, "发票不存在");
}
return rs;
}
/**
* 试算
* @param {*} pobj
*/
async apiCalcInvoice(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", "calcInvoice", pobj);
if (rs.status == 0) {
return rs
} else {
return system.getResult(null, rs.msg);
}
}
/**
* 保存发票申请(提供管理)
* @param {*} pobj
*/
async apiSaveInvoiceAdm(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", "saveInvoice", pobj);
if (rs.status == 0) {
return rs
} else {
return system.getResult(null, rs.msg);
}
}
/**
* 平台审批
* @param {*} pobj
*/
async apiPlatformAssignment(pobj) {
if (!pobj.nextStatus) {
return system.getResult(null, `参数错误`);
}
var rs = await this.callms("invoice", "platformAssignment", pobj);
if (rs.status == 0) {
this.pushDeliver(pobj);
return rs;
} else {
return system.getResult(null, rs.msg);
}
}
/**
* 交付商审批
* @param {*} pobj
*/
async apiDelivererAssignment(pobj) {
if (!pobj.nextStatus) {
return system.getResult(null, `参数错误`);
}
var rs = await this.callms("invoice", "delivererAssignment", pobj);
if (rs.status == 0) {
this.pushDeliver(pobj);
return rs;
} else {
return system.getResult(null, rs.msg);
}
}
/**
* 完税证明
* @param {*} pobj
*/
async apiTxPayment(pobj) {
let params = {};
params.id = this.trim(pobj.id);
params.taxNo = this.trim(pobj.taxNo);
params.complateTax = this.trim(pobj.complateTax);
params.taxTime = this.trim(pobj.taxTime);
params.taxVoucher = this.trim(pobj.taxVoucher);
var rs = await this.callms("invoice", "txPayment", params);
if (rs.status == 0) {
return rs
} else {
return system.getResult(null, rs.msg);
}
}
/**
* 查看完税证明
* @param {*} pobj
*/
async apiQueryTxPayment(pobj) {
let params = {};
params.id = this.trim(pobj.id);
var rs = await this.callms("invoice", "queryTxPayment", params);
if (rs.status == 0) {
return rs
} else {
return system.getResult(null, rs.msg);
}
}
/**
* 发票列表(交付商)
* @param {*} pobj
*/
async apiDelivererInvoices(pobj) {
if (pobj.pageIndex) {
pobj.pageIndex = Number(pobj.pageIndex) || 1;
}
if (pobj.pageSize) {
pobj.pageSize = Number(pobj.pageSize) || 10;
}
let res = await this.callms("invoice", "delivererInvoices", pobj);
for (let item of res.data.rows) {
item.invoice_amount = system.f2y(item.invoice_amount);
}
if (res.status == 0) {
return res;
} else {
return system.getResult(null, res.msg);
}
}
/**
* 发票申请列表(交付商)
* @param {*} pobj
*/
async apiDelivererApplyInvoices(pobj) {
if (pobj.pageIndex) {
pobj.pageIndex = Number(pobj.pageIndex) || 1;
}
if (pobj.pageSize) {
pobj.pageSize = Number(pobj.pageSize) || 10;
}
let res = await this.callms("invoice", "delivererApplyInvoices", pobj);
for (let item of res.data.rows) {
item.invoice_amount = system.f2y(item.invoice_amount);
}
if (res.status == 0) {
return res;
} else {
return system.getResult(null, res.msg);
}
}
/**
* 发票列表(平台)
* @param {*} pobj
*/
async apiQueryInvoices(pobj) {
pobj.pageIndex = Number(pobj.pageIndex || 1);
pobj.pageSize = Number(pobj.pageSize || 10);
var complateTax = this.trim(pobj.complateTax);
if (complateTax === "") {
complateTax = "-1";
}
pobj.complateTax = complateTax;
pobj.statuses = ['1070', '1080', '1090'];
let res = await this.callms("invoice", "queryInvoices", pobj);
for (let item of res.data.rows) {
item.apply.invoice_amount = system.f2y(item.apply.invoice_amount);
}
if (res.status == 0) {
return res;
} else {
return system.getResult(null, res.msg);
}
}
/**
* 发票申请列表(平台)
* @param {*} pobj
*/
async apiQueryApplyInvoices(pobj) {
pobj.pageIndex = Number(pobj.pageIndex || 1);
pobj.pageSize = Number(pobj.pageSize || 10);
let res = await this.callms("invoice", "queryApplyInvoices", pobj);
for (let item of res.data.rows) {
item.invoiceAmount = system.f2y(item.invoiceAmount);
item.personalIncomeTax = system.f2y(item.personalIncomeTax);
item.valueAddedTax = system.f2y(item.valueAddedTax);
item.serviceCharge = system.f2y(item.serviceCharge);
item.additionalTax = system.f2y(item.additionalTax);
}
if (res.status == 0) {
return res;
} else {
return system.getResult(null, res.msg);
}
}
/**
* 更新邮寄单号(平台)
* @param {*} pobj
*/
async apiUpEmNo(pobj) {
if (pobj.id) {
pobj.id = this.trim(pobj.id);
}
if (pobj.platformMailNo) {
pobj.platformMailNo = this.trim(pobj.platformMailNo);
}
let res = await this.callms("invoice", "updateEmail", pobj);
if (res.status == 0) {
return res;
} else {
return system.getResult(null, res.msg);
}
}
async pushDeliver(obj) {
var status = obj.nextStatus;
if (!status) {
return;
}
var pushStatus = ["1010", "1030", "1050", "1090"];
// 0090开票申请 1010审核驳回 1030审核通过 1050已开票 1090已完成
if (pushStatus.indexOf(status) == -1) {
return;
}
// 查发票
var invoiceApply = await this.callms("invoice", "queryInvoice", {
id: obj.id
});
invoiceApply = invoiceApply.data;
if (!invoice) {
console.log("推送信息失败[" + JSON.stringify(obj) + "],发票不存在 ------------------------");
return;
}
var invoice = invoiceApply.invoice || {};
var merchant = await this.callms("merchant", "secretById", {
id: order.merchant_id
});
merchant = merchant.data;
if (!merchant) {
console.log("推送信息失败[" + JSON.stringify(obj) + "],商户不存在 ------------------------");
return;
}
var options = {
merchantId: merchant.id,
appKey: merchant.appSecret,
dataType: 3,
dataId: invoiceApply.id,
field: "invoiceStatus",
};
var params = {
merchantId: merchant.id,
status: status,
applyNo: invoiceApply.applyNo,
}
// 0090开票申请 1030审核通过 1050已开票 1090已完成
if (status == "1010") {
// 1010审核驳回
params.auditRemark = this.trim(invoiceApply.remark);
} else if (status == "1030") {
// 1030审核通过
params.auditRemark = this.trim(invoiceApply.remark);
} else if (status == "1050") {
// invoiceNo : String :发票编号
params.invoiceNo = this.trim(invoiceApply.id);
// invoiceTime : String :开票时间
params.invoiceTime = this.trim(invoice.invoiceTime);
// invoiceImg : String :发票照片
params.invoiceImg = this.trim(invoice.invoiceImg);
// payVoucher : String :支付凭证
params.payVoucher = this.trim(invoiceApply.statements);
} else if (status == "1090") {
// courierNo : String :快递单号
params.courierNo = this.trim(invoice.mailNo);
// courierImg : String :快递交接单图片
params.courierImg = "";
} else {
return;
}
options.params = params;
await this.pushapiSve.push(options);
}
async redrush(params) {
try {
return await this.callms("invoice", "redRushInvoice", params);
} catch (error) {
return system.getResult(null, `系统错误 错误信息 ${error}`);
}
}
//交易数据 平台
async statManageData(params) {
try {
return await this.callms("invoice", "statTransData", params);
} catch (error) {
return system.getResult(-1, `系统错误 错误信息 ${error}`);
}
}
//发票办理 平台
async statBusinessData(params) {
try {
return await this.callms("invoice", "statBusinessData", params);
} catch (error) {
return system.getResult(-1, `系统错误 错误信息${error}`);
}
}
/**
* 交易数据(交付商)
* @param {*} params
*/
async delStatManageData(params) {
try {
return await this.callms("invoice", "delStatTransData", params);
} catch (error) {
return system.getResult(-1, `系统错误 错误信息 ${error}`);
}
}
//发票办理(交付商)
async delStatBusinessData(params) {
try {
return await this.callms("invoice", "delStatBusinessData", params);
} catch (error) {
return system.getResult(-1, `系统错误 错误信息 ${error}`);
}
}
//交付商列表(平台)
async statDeliverData(params) {
try {
return await this.callms("invoice", "statDeliverData", params);
} catch (error) {
return system.getResult(-1, `系统错误 错误信息 ${error}`);
}
}
}
module.exports = InvoiceService;
\ No newline at end of file
......@@ -6,6 +6,71 @@ class MerchantService extends ServiceBase {
super();
}
//查询商户
async apiQueryMerchant(params) {
try {
return await this.queryMerchant(params);
} catch (error) {
return system.getResultFail(-1);
}
}
// ----------------------------------- 以上为api --------------------------------------
async queryMerchant(params) {
try {
var p = {
id : params.merchant_id || params.merchantId,
options: {
title: true,
address:true,
}
}
var rs = await this.callms("merchant", "getById", p);
if(rs.status != 0 || !rs.data) {
return system.getResult(null, "商户不存在");
}
let merchant ={};
merchant.name=rs.data.name;
merchant.taxType=rs.data.taxType;
merchant.contactName=rs.data.contactName;
merchant.contactMobile=rs.data.contactMobile;
merchant.contactEmail=rs.data.contactEmail;
merchant.invoiceValid=rs.data.invoiceValid;
merchant.mustPay=rs.data.mustPay;
merchant.status=rs.data.status;
merchant.ownerName=rs.data.ownerName;
merchant.ownerMobile=rs.data.ownerMobile;
merchant.created_at=rs.data.created_at;
merchant.titleList=[];
for (let item of rs.data.titleList) {
let temp={};
temp.titleNo=item.titleNo;
temp.taxNo=item.taxNo;
temp.invoiceAddr=item.invoiceAddr;
temp.invoiceMobile=item.invoiceMobile;
temp.accountName=item.accountName;
temp.accountPublic=item.accountName;
merchant.titleList.push(temp);
}
merchant.addressList=[];
for (let item of rs.data.addressList) {
let temp={};
temp.addressNo=item.addressNo;
temp.mailAddr=item.mailAddr;
temp.mailTo=item.mailTo;
temp.mailMobile=item.mailMobile;
merchant.addressList.push(temp);
}
return system.getResultSuccess(merchant);
} catch (error) {
return system.getResultFail(-1);
}
}
async nameList() {
var rs = await this.callms("merchant", "nameList", {});
return rs;
......@@ -16,6 +81,11 @@ class MerchantService extends ServiceBase {
return rs;
}
async getById(id) {
var rs = await this.callms("merchant", "getById", {id: id});
return rs;
}
async add(params) {
var merchant = {};
var title = {};
......@@ -92,11 +162,11 @@ class MerchantService extends ServiceBase {
async audit(params) {
var mobile = this.trim(params.mobile);
var ucname = this.trim(params.ucname);
var ucname = this.trim(params.mobile);
params.status = "10";
params.ucname = ucname;
params.ucid = ucname + "_id TODO";
params.ucid = ucid;
// TODO 调用平台,创建商户用户
var auditRs = await this.callms("merchant", "auditMerchant", params);
return auditRs;
......
......@@ -12,6 +12,22 @@ class MerchantaccountService extends ServiceBase{
return res;
}
async infoByMerchantId(params) {
var merchantId = params.merchantId || params.merchant_id;
var res = await this.callms("merchant", "merchantAccountInfoByMerchantId", {merchantId : merchantId});
if(res.status != 0 || !res.data) {
return res;
}
var info = res.data;
var dto = {
"merchant_id": info.merchant_id,
"banlance": info.banlance
};
return system.getResultSuccess(dto);
}
async trans(rows) {
if (!rows) {
return;
......
const system=require("../../../system");
const ServiceBase=require("../../svems.base")
const settings=require("../../../../config/settings")
class MerchantrechargeService extends ServiceBase{
constructor(){
super();
const system = require("../../../system");
const ServiceBase = require("../../svems.base")
const settings = require("../../../../config/settings")
class MerchantrechargeService extends ServiceBase {
constructor() {
super();
this.pushapiSve = system.getObject("service.push.pushapiSve");
}
async add(params) {
// var res = await this.callms("merchant", "merchantRechargePage", params);
//
var recharge = {};
recharge.merchantId = params.merchant_id || params.merchantId;
recharge.amt = Number(params.amt);
recharge.outTradeNo = this.trim(params.outTradeNo);
recharge.voucher = this.trim(params.voucher);
if (recharge.amt <= 0) {
return system.getResult(null, "充值金额不能小于0");
}
return await this.callms("merchant", "merchantRechargeAdd", params);
// await this.transfield(res.data.rows);
// return res;
}
......@@ -20,6 +33,9 @@ class MerchantrechargeService extends ServiceBase{
async audit(params) {
var res = await this.callms("merchant", "merchantRechargeAudit", params);
if (res.status == 0) {
this.pushAudit(params);
}
return res;
}
......@@ -29,6 +45,34 @@ class MerchantrechargeService extends ServiceBase{
return res;
}
async pushAudit(params) {
try {
var recharge = await this.callms("merchant", "merchantRechargeInfo", params);
recharge = recharge.data;
// 查商户加密信息
var merchant = await this.callms("merchant", "secretById", {
id: recharge.merchant_id
});
merchant = merchant.data;
// 推送审核信息
await this.pushapiSve.push({
merchantId: merchant.id,
appKey: merchant.appSecret,
dataType: 0,
dataId: merchant.id,
field: "rechargeAudit",
params: {
merchantId: merchant.id,
outTradeNo: recharge.outTradeNo,
status: recharge.status,
remark: this.trim(recharge.remark)
},
});
} catch (error) {
console.log(error);
}
}
async transfield(rows) {
if (!rows) {
return;
......@@ -41,10 +85,10 @@ class MerchantrechargeService extends ServiceBase{
}
}
}
module.exports=MerchantrechargeService;
module.exports = MerchantrechargeService;
// var task=new UserService();
// task.getUserStatisticGroupByApp().then(function(result){
// console.log((result));
// }).catch(function(e){
// console.log(e);
// });
// });
\ No newline at end of file
......@@ -7,7 +7,6 @@ class MerchanttitleService extends ServiceBase{
}
async merchantTitleList(params){
console.log("天助我也");
return await this.callms("merchant","merchantTitleList",params);
}
......
const system = require("../../../system");
const ServiceBase = require("../../svems.base")
const settings = require("../../../../config/settings")
class OrderService extends ServiceBase {
constructor() {
super();
this.pushapiSve = system.getObject("service.push.pushapiSve");
}
async addOrder(params) {
var merchantId = params.merchant_id;
var rs = await this.callms("merchant", "getById", {
id: merchantId
});
if (!rs || rs.status != 0 || !rs.data) {
return system.getResult(null, rs.msg || "商户不存在");
}
var merchant = rs.data;
// 处理参数
var order = {};
order.merchantId = merchantId;
order.channelOrderNo = this.trim(params.channelOrderNo);
order.legalName = this.trim(params.legalName);
order.legalMobile = this.trim(params.legalMobile);
order.legalImg = this.trim(params.legalImg);
order.idcard = this.trim(params.idcard);
order.idcardFront = this.trim(params.idcardFront);
order.idcardBack = this.trim(params.idcardBack);
order.bankNo = this.trim(params.bankNo);
order.bank = this.trim(params.bank);
order.names = this.trim(params.names);
order.capital = this.trim(params.capital);
order.domicileId = this.trim(params.domicileId);
order.businessScopeId = this.trim(params.businessScopeId);
order.businesssScope = this.trim(params.businesssScope);
order.bdId = this.trim(merchant.ownerId);
order.bdPath = this.trim(merchant.ownerPath);
return await this.callms("order", "addOrder", params);
}
async putOrder(params) {
var merchantId = params.merchant_id;
var rs = await this.callms("merchant", "getById", {
id: merchantId
});
if (!rs || rs.status != 0 || !rs.data) {
return system.getResult(null, rs.msg || "商户不存在");
}
var merchant = rs.data;
// 处理参数
var order = {};
order.merchantId = merchantId;
order.channelOrderNo = this.trim(params.channelOrderNo);
order.legalName = this.trim(params.legalName);
order.legalMobile = this.trim(params.legalMobile);
order.legalImg = this.trim(params.legalImg);
order.idcard = this.trim(params.idcard);
order.idcardFront = this.trim(params.idcardFront);
order.idcardBack = this.trim(params.idcardBack);
order.bankNo = this.trim(params.bankNo);
order.bank = this.trim(params.bank);
order.names = this.trim(params.names);
order.capital = this.trim(params.capital);
order.domicileId = this.trim(params.domicileId);
order.businessScopeId = this.trim(params.businessScopeId);
order.businessScope = this.trim(params.businessScope);
return await this.callms("order", "updOrder", params);
}
async queryOrder(params) {
var condition = {
merchantId: this.trim(params.merchant_id),
channelOrderNo: this.trim(params.channelOrderNo),
}
var rs = await this.callms("order", "byChannelOrderId", condition);
if (rs.status != 0) {
return rs;
}
var order = rs.data;
var dto = {};
dto.orderNo = order.id;
dto.channelOrderNo = order.channelOrderNo;
dto.legalName = order.legalName;
dto.legalMobile = order.legalMobile;
dto.legalImg = order.legalImg;
dto.idcard = order.idcard;
dto.idcardFront = order.idcardFront;
dto.idcardBack = order.idcardBack;
dto.bankNo = order.bankNo;
dto.bank = order.bank;
dto.bankImg = order.bankImg;
dto.names = order.names;
dto.businessScope = order.businessScope;
dto.capital = order.capital;
dto.status = order.ostatus;
dto.opNotes = order.opNotes;
dto.domicileId = order.domicile_id;
dto.businessScopeId = order.businessScope_id;
dto.businessScope = order.businessScope;
return system.getResultSuccess(dto);
}
async allOrderList(params) {
var rs = await this.callms("order", "allOrderList", params);
await this.transfield(rs.data.rows);
await this.setMerchant(rs.data.rows);
return rs;
}
async orderClose(params) {
var p = {
merchantId: params.merchantId || params.merchant_id,
channelOrderNo: params.channelOrderNo
};
var rs = await this.callms("order", "orderClose", p);
return rs;
}
async closeById(params) {
var rs = await this.callms("order", "closeOrderById", {
id: params.id
});
return rs;
}
async assign(params) {
var rs = await this.callms("order", "orderAssign", params);
return rs;
}
async orderEdit(params) {
var rs = await this.callms("order", "orderEdit", params);
return rs;
}
async orderComplete(params) {
var rs = await this.callms("order", "orderComplete", params);
if (rs.status == 0) {
this.pushDeliver(params);
}
return rs;
}
async orderInfoAll(params, isMerchant) {
var rs = await this.callms("order", "orderInfoAll", params);
await this.transfield([rs.data]);
if (rs.data) {
if (rs.data.deliver) {
rs.data.deliverDivide = system.f2y(rs.data.deliver.deliverDivide);
}
if (rs.data.businessmen) {
rs.data.businessmen.costRate = system.f2y(rs.data.businessmen.costRate);
rs.data.businessmen.taxRate = system.f2y(rs.data.businessmen.taxRate);
rs.data.businessmen.serviceRate = system.f2y(rs.data.businessmen.serviceRate);
}
if (isMerchant) {
var merchant = await this.callms("merchant", "getById", {
id: rs.data.merchant_id
}) || {};
rs.data.merchant = merchant.data || {};
}
}
return rs;
}
// 订单办理
async handlePage(params) {
var rs = await this.callms("order", "orderDeliverList", params);
if (rs.status === 0 && rs.data && rs.data.rows) {
for (var row of rs.data.rows) {
row.deliverDivide = system.f2y(row.deliverDivide);
row.order.price = system.f2y(row.order.price);
}
}
return rs;
}
async deliverEdit(params) {
var obj = {
order: params.order,
businessmen: params.businessmen
};
return await this.callms("order", "orderDeliverEdit", obj);
}
async deliverClose(params) {
var obj = {
id: params.id,
breakReason: params.breakReason,
};
return await this.callms("order", "orderDeliverClose", obj);
}
async deliverHandle(obj) {
var rs = await this.callms("order", "orderDeliverHandle", obj);
// var rs = {status: 0};
if (rs.status === 0) {
// 推送数据
this.pushDeliver(obj);
}
return rs;
}
async deliverAudit(obj) {
return await this.callms("order", "orderDeliverAudit", obj);
}
async pushDeliver(obj) {
var status = obj.status;
if (!status) {
return;
}
var order = await this.callms("order", "orderByDeliverId", {
orderDeliverId: obj.id
});
order = order.data;
if (!order) {
console.log("推送信息失败[" + JSON.stringify(obj) + "],订单不存在 ------------------------");
return;
}
var merchant = await this.callms("merchant", "secretById", {
id: order.merchant_id
});
merchant = merchant.data;
if (!merchant) {
console.log("推送信息失败[" + JSON.stringify(obj) + "],商户不存在 ------------------------");
return;
}
var options = {
merchantId: merchant.id,
appKey: merchant.appSecret,
dataType: 1,
dataId: order.id,
field: "orderStatus",
};
var params = {
merchantId: merchant.id,
status: status,
channelOrderNo: order.channelOrderNo,
}
var handlingStatus = ["1050", "1070", "1090", "1110"];
if (status == "1060") {
// 已出执照
params.name = this.trim(obj.name);
params.creditCode = this.trim(obj.creditCode);
params.businessPlace = this.trim(obj.businessPlace);
params.businessScope = this.trim(obj.businessScope);
params.regDate = this.trim(obj.regDate);
params.businessImg = this.trim(obj.businessImg);
params.orderNo = this.trim(obj.orderNo);
params.legalName = this.trim(obj.legalName);
params.legalMobile = this.trim(obj.legalMobile);
} else if (status == "1080") {
// 已刻章
params.gongzhang = this.trim(obj.gongzhang);
params.caiwuzhang = this.trim(obj.caiwuzhang);
params.businessImg = this.trim(obj.businessImg);
params.fapiaozhang = this.trim(obj.fapiaozhang);
params.hetongzhang = this.trim(obj.hetongzhang);
params.farenzhang = this.trim(obj.farenzhang);
} else if (status == "1100") {
// 银行卡已开户
params.isBank = obj.isBank ? 1 : 0;
params.bankName = this.trim(obj.bankName);
params.bankNo = this.trim(obj.bankNo);
params.bank = this.trim(obj.bank);
params.bankImg = this.trim(obj.bankImg);
} else if (status == "1120") {
// 已税务报道
params.caImg = this.trim(obj.caImg);
params.taxRegDay = this.trim(obj.taxRegDay);
params.taxOrg = this.trim(obj.taxOrg);
} else if (status == "1170") {
// 已完成
params.courierNo = this.trim(obj.deliverNo);
params.courierImg = this.trim(obj.deliverImg);
} else if (handlingStatus.indexOf(status) != -1) {} else {
return;
}
options.params = params;
await this.pushapiSve.push(options);
}
async statManageData(params) {
var res = await this.callms("order", "statTransData", params);
return res;
}
async statBusinessData(params) {
var res = await this.callms("order", "statBusinessData", params);
return res;
}
async statDeliverData(params) {
var res = await this.callms("order", "statDeliverData", params);
return res;
}
async transfield(rows) {
if (!rows || rows.length == 0) {
return;
}
for (var row of rows) {
row.price = system.f2y(row.price);
}
return rows;
}
async setMerchant(rows) {
if (!rows || rows.length == 0) {
return;
}
var merchantIds = [];
for (var row of rows) {
merchantIds.push(row.merchant_id);
}
var mmap = await this.callms("merchant", "getMapByIds", {
ids: merchantIds,
attrs: "id, name"
});
mmap = mmap.data || {};
for (var row of rows) {
row.merchant = mmap[row.merchant_id] || {};
}
}
}
module.exports = OrderService;
// var task=new UserService();
// task.getUserStatisticGroupByApp().then(function(result){
// console.log((result));
// }).catch(function(e){
// console.log(e);
// });
\ No newline at end of file
const system = require("../../../system");
const ServiceBase = require("../../sve.base")
const settings = require("../../../../config/settings")
class PushapiService extends ServiceBase {
constructor() {
super("push", ServiceBase.getDaoName(PushapiService));
this.pushlogDao = system.getObject("db.push.pushlogDao");
}
/**
*
* @param {} options 参数如下
* @param merchantId 商户id
* @param appKey 商户加密key
* @param dataType 数据类型
* @param dataId 数据id
* @param field 推送字段,通过字段去查找推送地址
* @param params 推送参数
*/
async push(options) {
var api = await this.findById(options.merchantId);
if (!api) {
console.log("api不存在[" + JSON.stringify(options) + "]");
return;
}
var apiurl = api[options.field];
if (!apiurl) {
console.log("api地址不存在[" + JSON.stringify(options) + "]");
return;
}
var log;
try {
var params = options.params;
params.times_tamp = new Date().getTime();
var signData = await this.createSign(params, options.appKey);
params.sign = signData.data;
params.requestid = this.getUUID();
log = await this.pushlogDao.create({
dataType: Number(options.dataType),
dataId: options.dataId,
api: apiurl,
params: JSON.stringify(options.params),
rs: "",
success: 0,
});
try {
console.log(JSON.stringify(params));
var rtn = await this.restS.execPost(params, apiurl);
var returnValue = 0;
if (rtn.stdout) {
var result = JSON.parse(rtn.stdout);
if (result.code == "success") {
log.success = 1;
log.rs = trn.stdout;
await log.save();
}
}
} catch (error) {
log.success = 0;
log.rs = error.message;
await log.save();
}
} catch (error) {
if (log) {
log.success = 0;
log.rs = error.message;
await log.save();
}
console.log(error.stack, JSON.stringify(options), "--------------------------------- push exception ---------------------------------");
}
}
}
module.exports = PushapiService;
\ No newline at end of file
const system=require("../../../system");
const ServiceBase=require("../../sve.base")
const settings=require("../../../../config/settings")
class MerchantService extends ServiceBase{
constructor(){
super("merchant", ServiceBase.getDaoName(MerchantService));
const system = require("../../../system");
const ServiceBase = require("../../sve.base")
const settings = require("../../../../config/settings")
class PushlogService extends ServiceBase {
constructor() {
super("push", ServiceBase.getDaoName(PushlogService));
}
}
module.exports=MerchantService;
module.exports = PushlogService;
// var task=new UserService();
// task.getUserStatisticGroupByApp().then(function(result){
// console.log((result));
// }).catch(function(e){
// console.log(e);
// });
// });
\ No newline at end of file
const system = require("../system");
const moment = require('moment')
const settings = require("../../config/settings");
const uuidv4 = require('uuid/v4');
const md5 = require("MD5");
class ServiceBase {
constructor(gname, daoName) {
......@@ -268,5 +269,12 @@ class ServiceBase {
}
return o.toString().trim();
}
getUUID() {
var uuid = uuidv4();
var u = uuid.replace(/\-/g, "");
return u;
}
}
module.exports = ServiceBase;
\ No newline at end of file
const system = require("../system");
const moment = require('moment')
const settings = require("../../config/settings");
const md5 = require("MD5");
class ServiceBase {
constructor() {
this.restClient = system.getObject("util.restClient");
this.micro = system.microsetting();
}
/**
* 验证签名
* @param {*} params 要验证的参数
* @param {*} app_key 应用的校验key
*/
async verifySign(params, app_key) {
if (!params) {
return system.getResult(null, "请求参数为空");
}
if (!params.sign) {
return system.getResult(null, "请求参数sign为空");
}
var signArr = [];
var keys = Object.keys(params).sort();
if (keys.length == 0) {
return system.getResult(null, "请求参数信息为空");
}
for (let k = 0; k < keys.length; k++) {
const tKey = keys[k];
if (tKey != "sign" && params[tKey] && !(params[tKey] instanceof Array)) {
signArr.push(tKey + "=" + params[tKey]);
}
}
if (signArr.length == 0) {
return system.getResult(null, "请求参数组装签名参数信息为空");
}
var resultSignStr = signArr.join("&") + "&key=" + app_key;
var resultTmpSign = md5(resultSignStr).toUpperCase();
if (params.sign != resultTmpSign) {
return system.getResult(null, "返回值签名验证失败");
}
return system.getResultSuccess();
}
/**
* 创建签名
* @param {*} params 要验证的参数
* @param {*} app_key 应用的校验key
*/
async createSign(params, app_key) {
if (!params) {
return system.getResultFail(-310, "请求参数为空");
}
var signArr = [];
var keys = Object.keys(params).sort();
if (keys.length == 0) {
return system.getResultFail(-330, "请求参数信息为空");
}
for (let k = 0; k < keys.length; k++) {
const tKey = keys[k];
if (tKey != "sign" && params[tKey] && !(params[tKey] instanceof Array)) {
signArr.push(tKey + "=" + params[tKey]);
}
}
if (signArr.length == 0) {
return system.getResultFail(-350, "请求参数组装签名参数信息为空");
}
var resultSignStr = signArr.join("&") + "&key=" + app_key;
var resultTmpSign = md5(resultSignStr).toUpperCase();
return system.getResultSuccess(resultTmpSign);
}
/**
* 验证参数信息不能为空
* @param {*} params 验证的参数
* @param {*} verifyParamsCount 需要验证参数的数量,如至少验证3个,则传入3
* @param {*} columnList 需要过滤掉的验证参数列表,格式:[]
*/
async verifyParams(params, verifyParamsCount, columnList) {
if (!params) {
return system.getResult(null, "请求参数为空");
}
if (!columnList) {
columnList = [];
}
var keys = Object.keys(params);
if (keys.length == 0) {
return system.getResult(null, "请求参数信息为空");
}
if (keys.length < verifyParamsCount) {
return system.getResult(null, "请求参数不完整");
}
var tResult = system.getResultSuccess();
for (let k = 0; k < keys.length; k++) {
const tKeyValue = keys[k];
if (columnList.length == 0 || columnList.indexOf(tKeyValue) < 0) {
if (!tKeyValue) {
tResult = system.getResult(null, k + "参数不能为空");
break;
}
} //白名单为空或不在白名单中,则需要验证不能为空
}
return tResult;
}
async apiCallWithAk(url, params) {
var acckapp = await this.cacheManager["ApiAccessKeyCache"].cache(settings.appKey);
var acck = acckapp.accessKey;
//按照访问token
var restResult = await this.restClient.execPostWithAK(params, url, acck);
if (restResult) {
if (restResult.status == 0) {
var resultRtn = restResult.data;
return resultRtn;
} else {
await this.cacheManager["ApiAccessKeyCache"].invalidate(settings.appKey);
return null;
}
}
return null;
}
/*
返回20位业务订单号
prefix:业务前缀
*/
async getBusUid(prefix) {
prefix = (prefix || "");
if (prefix) {
prefix = prefix.toUpperCase();
}
var prefixlength = prefix.length;
var subLen = 8 - prefixlength;
var uidStr = "";
if (subLen > 0) {
uidStr = await this.getUidInfo(subLen, 60);
}
var timStr = moment().format("YYYYMMDDHHmm");
return prefix + timStr + uidStr;
}
/*
len:返回长度
radix:参与计算的长度,最大为62
*/
async getUidInfo(len, radix) {
var chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'.split(''); //长度62,到yz长度为长36
var uuid = [],
i;
radix = radix || chars.length;
if (len) {
for (i = 0; i < len; i++) uuid[i] = chars[0 | Math.random() * radix];
} else {
var r;
uuid[8] = uuid[13] = uuid[18] = uuid[23] = '-';
uuid[14] = '4';
for (i = 0; i < 36; i++) {
if (!uuid[i]) {
r = 0 | Math.random() * 16;
uuid[i] = chars[(i == 19) ? (r & 0x3) | 0x8 : r];
}
}
}
return uuid.join('');
}
handleDate(row, fields, pattern, addHours) {
pattern = pattern || "YYYY-MM-DD HH:mm";
if (!row) {
return;
}
for (var field of fields) {
if (row[field]) {
if (addHours) {
row[field] = moment(row[field]).add(addHours, "hours").format(pattern);
} else {
row[field] = moment(row[field]).format(pattern);
}
}
}
}
addWhereTime(where, field, begin, end) {
if (!begin && !end) {
return;
}
if (begin && end) {
where[field] = {
[this.db.Op.between]: [begin, end]
};
} else if (begin && !end) {
where[field] = {
[this.db.Op.gte]: begin
};
} else if (!begin && end) {
where[field] = {
[this.db.Op.lte]: end
};
}
}
async callms(sveName, apiName, params) {
var reqUrl = this.micro[sveName];
if (!reqUrl) {
return system.getResult(null, "未找到【" + sveName + "】服务,请检查settings文件是否存在");
}
if (!apiName) {
return system.getResult(null, "apiName不能为空");
}
try {
var params = {
"action_process": "xgg-admin",
"action_type": apiName,
"action_body": params || {},
}
var rs = await this.restClient.execPost(params, reqUrl);
if (rs && rs.stdout) {
return JSON.parse(rs.stdout);
}
return system.getResult(null, rs);
} catch (error) {
console.log(error);
this.logCtl.error({
optitle: "微服务请求失败",
op: "sveName = " + sveName + "; apiName = " + apiName,
content: "params = " + JSON.stringify(params),
clientIp: ""
});
return system.getResult(null, error.message);
}
}
trim(o) {
if (!o) {
return "";
}
return o.toString().trim();
}
}
module.exports = ServiceBase;
\ No newline at end of file
......@@ -168,23 +168,35 @@ class System {
static microsetting() {
var path = "/api/op/action/springboard";
if (settings.env == "dev") {
var domain = "http://192.168.18.125";
var domain = "http://192.168.18.237";
// var domain = "http://127.0.0.1";
return {
// 公共服务
common: domain + ":3102" + path,
// common: "http://127.0.0.1:3102" + path,
// 商户服务
merchant: domain + ":3101" + path,
order:domain + ":3103" + path,
// order: "http://39.97.116.129:8336" + path,
// merchant: "http://127.0.0.1:3101" + path,
// 订单服务
order: domain +":3103" + path,
// order: "http://127.0.0.1:3103" + path,
// 发票服务
// invoice: domain + ":3105" + path,
invoice: "http://127.0.0.1:3105" + path,
invoice: "" + path,
payment: "" + path,
}
} else {
var odomain = "http://39.107.51.68"
return {
common: "http://39.106.189.242:8333" + path,
merchant: "http://39.106.189.242:8335" + path,
order: "http://39.97.116.129:8336" + path,
invoice: "http://xggsveinvoice.gongsibao.com" + path,
payment: "http://39.97.116.129:8337" + path,
common: odomain + ":8333" + path,
merchant: odomain + ":8335" + path,
order: odomain + ":8336" + path,
invoice: odomain + ":8338" + path,
payment: odomain + ":8337" + path,
}
}
}
......
// const system = require("../../system");
// const uuidv4 = require('uuid/v4');
// const md5 = require("MD5");
// class PushUtils {
// constructor() {
// this.logCtl = system.getObject("web.common.oplogCtl");
// this.cacheManager = system.getObject("db.common.cacheManager");
// this.merchantpushlogSve = system.getObject("service.merchant.merchantpushlogSve");
// this.execClient = system.getObject("util.execClient");
// this.merchantpushSve = system.getObject("service.merchant.merchantpushSve");
// }
// getUUID() {
// var uuid = uuidv4();
// var u = uuid.replace(/\-/g, "");
// return u;
// }
// async getCachePushItemUrl(merchant_id) {
// return await this.cacheManager["MerchantPushUrlCache"].cache(merchant_id, null, 3600);
// }
// /**
// * 推送到第三方数据
// * @param {*} reqUrl 请求推送的url
// * @param {*} params 推送的参数
// */
// async push(merchantId, field, params) {
// try {
// var pushConfig = await this.getCachePushItemUrl(merchantId) || {};
// var reqUrl = pushConfig[field];
// if(!reqUrl) {
// this.logCtl.error({
// optitle: "推送到第三方数据异常error",
// op: "merchantId = " + merchantId + "; reqUrl is empty, field = " + field,
// content: "reqUrl is empty",
// clientIp: "pushUtils中没有ip"
// });
// return;
// }
// // 签名
// params.sign = await this.createSign(params, merchantId);
// params.requestid = this.getUUID();
// var rtn = await this.execClient.execPost(params, reqUrl);
// var returnValue = 0;
// if (rtn.stdout) {
// var result = JSON.parse(rtn.stdout);
// if (result.code == "success") {
// returnValue = 1;
// }
// }
// //记录推送结果
// this.merchantpushlogSve.create({
// merchant_id: merchantId,//商户id
// api: reqUrl,//接口地址
// params: JSON.stringify(params),//推送数据信息
// rs: rtn.stdout,//推送返回结果
// success: returnValue//是否推送成功
// });
// } catch (e) {
// console.log(e.stack);
// this.logCtl.error({
// optitle: "推送到第三方数据异常error",
// op: reqUrl + ";params=" + JSON.stringify(params) + ";reqid=" + params.requestid,
// content: e.stack,
// clientIp: "pushUtils中没有ip"
// });
// }
// }
// /**
// * 多次推送到第三方数据
// * @param {*} reqUrl 请求推送的url
// * @param {*} params 推送的参数
// */
// async pushMany(reqUrl, params) {
// try {
// params.requestid = this.getUUID();
// var rtn = this.execClient.execPost(params, reqUrl);
// //TODO:可以做多次推送,规则待定
// // var result = JSON.parse(rtn.stdout);
// // if (result && result.code == 200) {
// // var resultdata = result.data;
// // return { code: 1, msg: "success" };
// // } else {
// // return { code: -1, msg: "err" };
// // }
// } catch (e) {
// this.logCtl.error({
// optitle: "多次推送到第三方数据异常error",
// op: url + ";params=" + JSON.stringify(params) + ";reqid=" + params.requestid,
// content: e.stack,
// clientIp: pobj.clientIp
// });
// }
// }
// async createSign(params, appId) {
// var appInfo = await this.cacheManager["ApiAppIdCheckCache"].cache(appId, null, 3000);
// var signArr = [];
// var keys = Object.keys(params).sort();
// for (let k = 0; k < keys.length; k++) {
// const tKey = keys[k];
// if (tKey != "sign" && params[tKey]) {
// signArr.push(tKey + "=" + params[tKey]);
// }
// }
// var resultSignStr = signArr.join("&") + "&key=" + appInfo.appSecret;
// return md5(resultSignStr).toUpperCase();
// }
// }
// module.exports = PushUtils;
......@@ -6,16 +6,14 @@ var settings={
db:10,
},
database:{
dbname : "xgg-pc",
dbname : "xgg",
user: "write",
password: "write",
config: {
// host: '43.247.184.35',
// port: 8899,
host: '192.168.18.237',
port: 3306,
// host: '43.247.184.35',
// port: 8899,
dialect: 'mysql',
operatorsAliases: false,
pool: {
......
......@@ -7,7 +7,7 @@ const redisClient = system.getObject("util.redisClient");
module.exports = function (app) {
app.all("/web/*", async function (req, res, next) {
var xggadminsid = req.headers["xggadminsid"] || "3cb49932-fa02-44f0-90db-9f06fe02e5c7";
var xggadminsid = req.headers["xggadminsid"] || "";
var jsonUser = await redisClient.get(xggadminsid);
if (req.url.indexOf("auth/userCtl/login") > 0 ||
......@@ -28,7 +28,7 @@ module.exports = function (app) {
res.end(JSON.stringify({ status: -99, msg: "no login" }));
return;
} else {
redisClient.setWithEx(xggadminsid, jsonUser, 60 * 60 * 12);
redisClient.setWithEx(xggadminsid, jsonUser, 60 * 60 * 3);
}
req.loginUser = JSON.parse(jsonUser);
next();
......
......@@ -4,11 +4,11 @@ var ENVINPUT = {
DB_PORT: process.env.DB_PORT,
DB_USER: process.env.DB_USER,
DB_PWD: process.env.DB_PWD,
DB_NAME: process.env.XGGPC_DB_NAME,
DB_NAME: process.env.XGGADMIN_DB_NAME,
REDIS_HOST: process.env.REDIS_HOST,
REDIS_PORT: process.env.REDIS_PORT,
REDIS_PWD: process.env.REDIS_PWD,
REDIS_DB: process.env.XGGPC_REDIS_DB,
REDIS_DB: process.env.XGGADMIN_REDIS_DB,
APP_ENV: process.env.APP_ENV ? process.env.APP_ENV : "dev"
};
var settings = {
......
## index. 首页
  1 [首页1](doc/index/index1.md)
  1 [发票数据概览](doc/index/index2.md)
1 [发票业务汇总](doc/index/index3.md)
## 1. 公共服务
  1 [公共服务](doc/common/common.md)
......@@ -9,6 +15,8 @@
  4 [交付商](doc/common/deliver.md)
  5 [开票内容](doc/common/invoicecontent.md)
## 2. 用户相关接口
  1 [用户中心](doc/user/user.md)
......@@ -26,15 +34,26 @@
  6 [商户充值](doc/merchant/recharge.md)
## 4. 订单相关接口
  1 [订单接口](doc/order/order.md)
  1 [全部订单](doc/order/order.md)
  2 [订单办理](doc/order/deliver.md)
  3 [个体户+签约](doc/business/businessmen.md)
## 5. 发票接口
  1 [发票申请](doc/invoice/apply.md)
  2 [全部发票](doc/invoice/all.md)
  3 [发票办理](doc/invoice/deliver.md)
  4 [发票管理](doc/invoice/info.md)
## 6. 其他
  2 [订单支付](doc/pay/pay.md)
<!--   2 [个体工商户](doc/order/businessmen.md) -->
## 5. 个体户
  1 [个体户](doc/business/businessmen.md)
## 6. 发票接口
 1 [发票](doc/invoice/invoice.md)
<a name="menu">目录</a>
1. [个体户信息列表](#allPage)
1. [个体户详情](#info)
1. [用户签约](#sign)
1. [签约管理个体户名称下拉](#signNames)
1. [签约管理列表](#signPage)
## **<a name="allPage"> 个体户信息 </a>**
[返回到目录](#menu)
##### URL
[/web/business/businessmenCtl/allPage]
#### 参数格式 `JSON`
#### HTTP请求方式 `POST`
``` javascript
{
"currentPage": "1",
"pageSize": "10",
"merchantId": "", // 商户ID
"orderId": "", // 订单号
"status": "", // 用户状态
}
```
#### 返回结果
```javascript
{
"status": 0,
"msg": "success",
"data": {
"count": 8,
"rows": [
{
"id": 1,
"merchant_id": 110269, // 商户id
"order_id": "" // 订单号
"channelOrderNo": "" // 渠道订单号
"bstatus": "2020", // 业务状态
"bstatusName": "已完成", // 业务状态名称
"gstatus": "2020", // 客户看到状态
"gstatusName": "已完成", // 客户看到状态名称
"dstatus": "2020", // 交付商状态
"dstatusName": "已完成", // 交付商状态名称
"legalName": "", // 法人姓名
"legalMobile": "", // 法人电话
"legalIdcard": "", // 法人身份证
"name": "" // 个体工商户名称
"creditCode": "" // 统一社会信用代码
"merchant": { // 商户信息
"id": "110646227", // 商户id
"name": "司机宝" // 商户名称
}
"businessPlace": "" // 经营场所
"businessScope": "" // 经营范围
"regDate": "" // 注册日期
"businessImg": "" // 执照照片
"gongzhang": "" // 公章
"caiwuzhang": "" // 财务章
"fapiaozhang": "" // 发票章
"hetongzhang": "" // 合同章
"farenzhang": "" // 法人章
"isBank": "" // 是否开户
"bankName": "" // 账户名称
"bankNo": "" // 账户号
"bank": "" // 开户行
"bankImg": "" // 账户信息
"caImg": "" // CA照片
"taxRegDay": "" // 税务登记日
"taxOrg": "" // 税务机构名称
"courierNo": "" // 快递单号
"courierImg": "" // 快递交接单图片
"addedValueRate": "" // 增值税率
"supertaxRate": "" // 附加税率
"commonTaxLadder": "" // 普票个税阶梯
"commonOtherLadder": "" // 普票增值税、附加税阶梯
"specialTaxLadder": "" // 专票个税阶梯
"specialOtherLadder": "" // 专票增值税、附加税阶梯
"contract": "" // 个体户合同
"contractStartData": "" // 合同开始时间
"contractEndData": "" // 合同结束时间
"notes": "" // 备注
"opNotes": "" // 操作备注
"created_at": "", // 创建时间
"taxUpType": "1", // 个税累计类型 1按月累计 2按年累计
"addValueUpType": "1", // 增值税累计类型 1按月 2按季度
"costRate": 11.22, // 核定成本费用率
"taxRate": 3.20, // 含税价百分比
"serviceRate": 1.25, // 服务费比例
"signNotes": null, // 签约备注
"signTime": null, // 签约时间
}
]
}
}
```
## **<a name="info"> 个体户详情 </a>**
[返回到目录](#menu)
##### URL
[/web/business/businessmenCtl/info]
#### 参数格式 `JSON`
#### HTTP请求方式 `POST`
``` javascript
{
"id": "1",
}
```
#### 返回结果
```javascript
{
"status": 0,
"msg": "success",
"data": {
"count": 8,
"rows": [
{
"id": 1,
"merchant_id": 110269, // 商户id
"order_id": "" // 订单号
"channelOrderNo": "" // 渠道订单号
"bstatus": "2020", // 业务状态
"bstatusName": "已完成", // 业务状态名称
"gstatus": "2020", // 客户看到状态
"gstatusName": "已完成", // 客户看到状态名称
"dstatus": "2020", // 交付商状态
"dstatusName": "已完成", // 交付商状态名称
"legalName": "", // 法人姓名
"legalMobile": "", // 法人电话
"legalIdcard": "", // 法人身份证
"name": "" // 个体工商户名称
"creditCode": "" // 统一社会信用代码
"merchant": { // 商户信息
"id": "110646227", // 商户id
"name": "司机宝" // 商户名称
}
"businessPlace": "" // 经营场所
"businessScope": "" // 经营范围
"regDate": "" // 注册日期
"businessImg": "" // 执照照片
"gongzhang": "" // 公章
"caiwuzhang": "" // 财务章
"fapiaozhang": "" // 发票章
"hetongzhang": "" // 合同章
"farenzhang": "" // 法人章
"isBank": "" // 是否开户
"bankName": "" // 账户名称
"bankNo": "" // 账户号
"bank": "" // 开户行
"bankImg": "" // 账户信息
"caImg": "" // CA照片
"taxRegDay": "" // 税务登记日
"taxOrg": "" // 税务机构名称
"courierNo": "" // 快递单号
"courierImg": "" // 快递交接单图片
"addedValueRate": "" // 增值税率
"supertaxRate": "" // 附加税率
"commonTaxLadder": "" // 普票个税阶梯
"commonOtherLadder": "" // 普票增值税、附加税阶梯
"specialTaxLadder": "" // 专票个税阶梯
"specialOtherLadder": "" // 专票增值税、附加税阶梯
"contract": "" // 个体户合同
"contractStartData": "" // 合同开始时间
"contractEndData": "" // 合同结束时间
"notes": "" // 备注
"opNotes": "" // 操作备注
"created_at": "", // 创建时间
}
]
}
}
```
## **<a name="sign"> 用户签约 </a>**
[返回到目录](#menu)
##### URL
[/web/business/businessmenCtl/sign]
#### 参数格式 `JSON`
#### HTTP请求方式 `POST`
``` javascript
{
"id" : "12797237916000358", // 个体户id
"taxUpType":"10", // 个税累计
"addValueUpType":"" // 增值税累计
"costRate":"1122", // 核定成本费用率
"taxRate" : "", // 含税价百分比
"serviceRate" : "", // 服务费百分比
"signNotes":" 12qwdwqd", // 签约备注
"commonTaxLadder": [ // 普票个税梯度
{
"minValue": 0, // 区间最小值
"rate": "0", // 税率
"quiCalDed": 1000, // 素算扣除数
"maxValue": 3000000 // 区间最大值
},
],
"commonOtherLadder": [ // 普票增值税梯度
{
"minValue": 0, // 区间最小值
"zengzhiRate": "0", // 增值税税率
"fujiaRate": "0", // 附加税税率
"maxValue": 3000000 // 区间最大值
},
],
"specialTaxLadder": [ // 专票个税梯度
{
"minValue": 0, // 区间最小值
"rate": "0", // 税率
"quiCalDed": 1000, // 素算扣除数
"maxValue": 3000000 // 区间最大值
},
],
"specialOtherLadder": [ // 专票增值税梯度
{
"minValue": 0, // 区间最小值
"zengzhiRate": "0", // 增值税税率
"fujiaRate": "0", // 附加税税率
"maxValue": 3000000 // 区间最大值
},
],
"invoicecontents": [ // 开票内容
{
"invoicecontent_id": "1" // 开票内容id
"invoicecontentName": "xx" // 开票内容名称
}
],
}
```
#### 返回结果
```javascript
{
"status": 0,
"msg": "success",
}
```
## **<a name="signNames"> 签约管理个体户名称下拉 </a>**
[返回到目录](#menu)
##### URL
[/web/business/businessmenCtl/signNames]
#### 参数格式 `JSON`
#### HTTP请求方式 `POST`
``` javascript
{
}
```
#### 返回结果
```javascript
{
"status": 0,
"msg": "success",
"data": [
{
"id": "12795594625000138", // 个体户id businessmenId
"name": "杨庆菊商贸有限公司" // 个体户名称
},
{
"id": "12797237916000358",
"name": "张娇有限公司"
},
{
"id": "13180527741002204",
"name": "xxxx啊啊啊啊"
}
],
"requestid": "f001946b2787479785216099ef64dec4"
}
```
## **<a name="signPage"> 签约管理列表 </a>**
[返回到目录](#menu)
##### URL
[/web/business/businessmenCtl/signPage]
#### 参数格式 `JSON`
#### HTTP请求方式 `POST`
``` javascript
{
"currentPage": "1",
"pageSize": "10",
"businessmenId": "", // 商户ID 使用接口 签约管理个体户名称下拉 筛选
}
```
#### 返回结果
```javascript
{
"status": 0,
"msg": "success",
"data": {
"count": 8,
"rows": [
{
"id": 1,
"merchant_id": 110269, // 商户id
"order_id": "" // 订单号
"channelOrderNo": "" // 渠道订单号
"bstatus": "2020", // 业务状态
"bstatusName": "已完成", // 业务状态名称
"gstatus": "2020", // 客户看到状态
"gstatusName": "已完成", // 客户看到状态名称
"dstatus": "2020", // 交付商状态
"dstatusName": "已完成", // 交付商状态名称
"legalName": "", // 法人姓名
"legalMobile": "", // 法人电话
"legalIdcard": "", // 法人身份证
"name": "" // 个体工商户名称
"creditCode": "" // 统一社会信用代码
"merchant": { // 商户信息
"id": "110646227", // 商户id
"name": "司机宝" // 商户名称
}
"businessPlace": "" // 经营场所
"businessScope": "" // 经营范围
"regDate": "" // 注册日期
"businessImg": "" // 执照照片
"gongzhang": "" // 公章
"caiwuzhang": "" // 财务章
"fapiaozhang": "" // 发票章
"hetongzhang": "" // 合同章
"farenzhang": "" // 法人章
"isBank": "" // 是否开户
"bankName": "" // 账户名称
"bankNo": "" // 账户号
"bank": "" // 开户行
"bankImg": "" // 账户信息
"caImg": "" // CA照片
"taxRegDay": "" // 税务登记日
"taxOrg": "" // 税务机构名称
"courierNo": "" // 快递单号
"courierImg": "" // 快递交接单图片
"addedValueRate": "" // 增值税率
"supertaxRate": "" // 附加税率
"commonTaxLadder": "" // 普票个税阶梯
"commonOtherLadder": "" // 普票增值税、附加税阶梯
"specialTaxLadder": "" // 专票个税阶梯
"specialOtherLadder": "" // 专票增值税、附加税阶梯
"contract": "" // 个体户合同
"contractStartData": "" // 合同开始时间
"contractEndData": "" // 合同结束时间
"notes": "" // 备注
"opNotes": "" // 操作备注
"created_at": "", // 创建时间
"taxUpType": "1", // 个税累计类型 1按月累计 2按季度 3按年
"addValueUpType": "1", // 增值税累计类型 1按月累计 2按季度 3按年
"costRate": 11.22, // 核定成本费用率
"taxRate": 3.20, // 含税价百分比
"serviceRate": 1.25, // 服务费比例
"signNotes": null, // 签约备注
"signTime": null, // 签约时间
}
]
}
}
```
<a name="menu">目录</a>
1. [发票列表](#list)
1. [发票明细](#info)
1. [发票添加/修改](#save)
1. [发票删除](#del)
1. [发票内容列表](#list)
1. [发票内容明细](#info)
1. [发票内容添加/修改](#save)
1. [发票内容删除](#del)
## **<a name="list"> 发票列表</a>**
## **<a name="list"> 发票内容列表</a>**
[返回到目录](#menu)
##### URL
[/web/common/invoicecontentCtl/list]
......@@ -49,7 +49,7 @@
```
## **<a name="info"> 发票商明细</a>**
## **<a name="info"> 发票内容商明细</a>**
[返回到目录](#menu)
##### URL
[/web/common/invoicecontentCtl/info]
......@@ -82,7 +82,7 @@
}
```
## **<a name="save"> 发票添加/修改</a>**
## **<a name="save"> 发票内容添加/修改</a>**
[返回到目录](#menu)
##### URL
[/web/common/invoicecontentCtl/save]
......@@ -92,7 +92,7 @@
```javascript
{
"id": "", // id
"name": "xxx", // 发票名称
"name": "xxx", // 发票内容名称
"isEnabled": , // 是否可用
}
```
......@@ -116,7 +116,7 @@
```
## **<a name="del"> 发票删除</a>**     
## **<a name="del"> 发票内容删除</a>**     
[返回到目录](#menu)     
**接口方式** HTTP
......@@ -127,7 +127,7 @@
| 参数名|数据类型|必须|默认| 说明 |
|---|:---:|:---:|:---:|---|
| ids | Array| 是 |  | 删除发票id |
| ids | Array| 是 |  | 删除发票内容id |
**返回结果**
......
<a name="menu">目录</a>
1. [交易数据](#transdata)
1. [业务办理数据](#businessData)
1. [业务概览](#businessOverview)
## **<a name="transdata"> 本月交易数据</a>**
[返回到目录](#menu)
##### URL
[/web/index/managerCtl/transData]
#### 参数格式 `JSON`
#### HTTP请求方式 `POST`
``` javascript
{
type: 1, // 筛选状态 1本月 2上月 3总计
}
```
#### 返回结果
```javascript
{
"status": 0,
"msg": "success",
"data": {
"orderCount": 19, // 业务订单量
"orderPrice": 43600, // 订单交易额
"days": [ // echart日期
"2019-01",
"2019-02",
"2019-03",
],
"dayCounts": [ // echart交易量
1,
0,
0,
],
"priceCounts": [ // echart交易额
3000,
0,
0,
]
},
"requestid": "536712febd5b440f8abe7e5df7480aba"
}
```
## **<a name="businessData"> 业务办理数据</a>**
[返回到目录](#menu)
##### URL
[/web/index/managerCtl/businessData]
#### 参数格式 `JSON`
#### HTTP请求方式 `POST`
``` javascript
{
type: 1, // 筛选状态 1本月 2上月 3总计
}
```
#### 返回结果
```javascript
{
"status": 0,
"msg": "success",
"data": {
"completeCount": 0, // 已完成订单量
"toApplyCount": 10, // 待分配订单量
"toAuditCount": 1, // 待审核订单量
"handlingCount": 5 // 办理中订单量
},
"requestid": "776c869048b440d4bf16f9e2f7b42fb8"
}
```
## **<a name="businessOverview"> 业务概览</a>**
[返回到目录](#menu)
##### URL
[/web/index/managerCtl/deliverData]
#### 参数格式 `JSON`
#### HTTP请求方式 `POST`
``` javascript
{
currentPage: 1,
pageSize: 10,
type: 1, // 筛选状态 1本月 2上月 3总计
}
```
#### 返回结果
```javascript
{
"status": 0,
"msg": "success",
"data": {
"count": 3,
"rows": [
{
"deliverName": "某某交付商222", // 交付商
"servicePrice": "4492976", // 服务费
"completeCount": 0, // 完成订单量
"handlingCount": 17 // 办理中订单量
},
]
},
"requestid": "6ef971357a2745e4b2996a97149c0055"
}
```
\ No newline at end of file
<a name="menu">目录</a>
1. [交易数据](#transdata)
1. [业务办理数据](#businessData)
1. [业务概览](#businessOverview)
## **<a name="transdata"> 本月交易数据</a>**
[返回到目录](#menu)
##### URL
[/web/index/managerCtl/transData]
#### 参数格式 `JSON`
#### HTTP请求方式 `POST`
``` javascript
{
type: 1, // 筛选状态 1本月 2上月 3总计
}
```
#### 返回结果
```javascript
{
"status": 0,
"msg": "success",
"data": {
"invoiceCount": 19, // 业务订单量
"serviceChange": 43600, // 订单交易额
"days": [ // echart日期
"2019-01",
"2019-02",
"2019-03",
],
"dayCounts": [ // echart交易量
1,
0,
0,
],
"priceCounts": [ // echart交易额
3000,
0,
0,
]
},
"requestid": "536712febd5b440f8abe7e5df7480aba"
}
```
## **<a name="businessData"> 业务办理数据</a>**
[返回到目录](#menu)
##### URL
[/web/index/managerCtl/businessData]
#### 参数格式 `JSON`
#### HTTP请求方式 `POST`
``` javascript
{
type: 1, // 筛选状态 1本月 2上月 3总计
}
```
#### 返回结果
```javascript
{
"status": 0,
"msg": "success",
"data": {
"completeCount": 0, // 已开具
"toApplyCount": 10, // 待申请审核
"toAuditCount": 1, // 待交付审核
"handlingCount": 5 // 交付商办理中
},
"requestid": "776c869048b440d4bf16f9e2f7b42fb8"
}
```
## **<a name="businessOverview"> 业务概览</a>**
[返回到目录](#menu)
##### URL
[/web/index/managerCtl/deliverData]
#### 参数格式 `JSON`
#### HTTP请求方式 `POST`
``` javascript
{
currentPage: 1,
pageSize: 10,
type: 1, // 筛选状态 1本月 2上月 3总计
}
```
#### 返回结果
```javascript
{
"status": 0,
"msg": "success",
"data": {
"count": 3,
"rows": [
{
"deliverName": "某某交付商222", // 交付商
"servicePrice": "4492976", // 服务费
"completeCount": 0, // 完成订单量
"handlingCount": 17 // 办理中订单量
},
{
"id": "11330348689004287", //交易记录id
"deliverer_id": "11330348689004287", //交付商id
"deliverer_name": "111", //交付商名称
"totalAmount": 519.99, //服务费
"completeCount": 0, //完成的订单
"handlingCount": 0 //办理中订单
},
]
},
"requestid": "6ef971357a2745e4b2996a97149c0055"
}
```
\ No newline at end of file
<a name="menu">目录</a>
1. [支付二维码](#qrcode)
1. [检查支付状态](#getPayStatus)
## **<a name="qrcode"> 支付二维码 </a>**
[返回到目录](#menu)
##### URL
[/web/payment/payCtl/getQrCodeInfo]
#### 参数格式 `JSON`
#### HTTP请求方式 `POST`
``` javascript
{
order_no: // 订单号,
op_type: // 支付方式:["wx","alipay"],
total_sum: // 订单金额
}
```
#### 返回结果
```javascript
{
"status": 0,
"msg": "success",
"data": {
"payinfo":"https://syb.allinpay.com/apiweb/h5unionpay/native?key=qbWZUuwa4pu2J%2Bj38mkp8863", // 二维码图片
"reqsn":"333_40_1",
"chnltrxid":"121905790000021961",
"trxid":"121905790000021961",
"trxstatus":"0000",
"wxPayOrderCode":"121905790000021961", // 微信码
"aliPayOrderCode":"333", // 支付宝码
}
}
```
## **<a name="getPayStatus"> 检查支付状态 </a>**
[返回到目录](#menu)
##### URL
[/web/payment/payCtl/getPayStatus]
#### 参数格式 `JSON`
#### HTTP请求方式 `POST`
``` javascript
{
order_no:订单号,
op_type:支付方式:["wx""alipay"],
aliPay_order_code: 支付宝码,
wx_pay_order_code:微信码
}
```
#### 返回结果
```javascript
{
"status": 0,
"msg": "success",
"data": 以下四种类型
// {code":1"msg":""} code为1则支付成功
// {"code":-330,"msg":"超时未支付,请刷新页面"}
// {"code":-130,"msg":"请及时支付"}
// { code: 0, msg: '错误信息', data: {} }
,
"requestid": "ae2a9c2e2ff6497e8cc9fd2c7fac9fe8"
}
```
<a name="menu">目录</a>
1. [交易数据](#delTransData)
1. [业务办理数据](#delBusinessData)
## **<a name="delTransData"> 本月交易数据</a>**
[返回到目录](#menu)
##### URL
[/web/index/managerCtl/delTransData]
#### 参数格式 `JSON`
#### HTTP请求方式 `POST`
``` javascript
{
type: 1, // 筛选状态 1本月 2上月 3总计
delivererId:"xxx" //交付商ID
}
```
#### 返回结果
```javascript
{
"status": 0,
"msg": "success",
"data": {
"invoiceCount": 19, // 业务订单量
"delivererAmount": 43600, //服务费
"days": [ // echart日期
"2019-01",
"2019-02",
"2019-03",
],
"dayCounts": [ // echart交易量
1,
0,
0,
],
"priceCounts": [ // echart交易额
3000,
0,
0,
]
},
"requestid": "536712febd5b440f8abe7e5df7480aba"
}
```
## **<a name="delBusinessData"> 业务办理数据</a>**
[返回到目录](#menu)
##### URL
[/web/index/managerCtl/delBusinessData]
#### 参数格式 `JSON`
#### HTTP请求方式 `POST`
``` javascript
{
type: 1, // 筛选状态 1本月 2上月 3总计
delivererId:"xxx" //交付商ID
}
```
#### 返回结果
```javascript
{
"status": 0,
"msg": "success",
"data": {
"completeCount": 0, // 已开具
"handlingCount": 5 // 交付商办理中
},
"requestid": "776c869048b440d4bf16f9e2f7b42fb8"
}
```
\ No newline at end of file
<a name="menu">目录</a>
1. [发票状态](#status)
1. [全部发票列表](#queryInvoices)
1. [查看详情](#queryInvoices)
1. [查看完税证明](#queryTxPayment)
## **<a name="saveInvoice"> 发票状态</a>**     
[返回到目录](#menu)    
```
{
"0090": {
"status": "0090",
"name": "未付款",
"next": "1000",
"cstatus": "0090",//客户
"dstatus": "",//交付商
},
"1000": {
"status": "1000",
"name": "待审核",
"next": "1020",
"cstatus": "0090",//客户
"dstatus": "",//交付商
},
"1010": {
"status": "1010",
"name": "审核不通过",
"next": "",
"cstatus": "1010",
"dstatus": "",
},
"1020": {
"status": "1020",
"name": "待分配",
"next": "1030",
"cstatus": "1030",
"dstatus": "",
},
"1030": {
"status": "1030",
"name": "待处理",
"next": "1050",
"cstatus": "1030",
"dstatus": "1030",
},
"1040": {
"status": "1040",
"name": "交付商关闭",
"next": "1020",
"cstatus": "1030",
"dstatus": "1040",
},
"1050": {
"status": "1050",
"name": "已开具",
"next": "1060",
"cstatus": "1050",
"dstatus": "1050",
},
"1060": {
"status": "1060",
"name": "待审核",
"next": "1070",
"cstatus": "1050",
"dstatus": "1070",
},
"1070": {
"status": "1070",
"name": "审核通过",
"next": "1080",
"cstatus": "1050",
"dstatus": "1070",
},
"1080": {
"status": "1080",
"name": "已邮寄",
"next": "1090",
"cstatus": "1050",
"dstatus": "1080",
},
"1090": {
"status": "1090",
"name": "完成",
"next": "1100",
"cstatus": "1090",
"dstatus": "1080",
},
"1100": {
"status": "1090",
"name": "发票撤回",
"next": "1100",
"cstatus": "1090",
"dstatus": "1080",
},
"1200": {
"status": "1200",
"name": "红冲",
"next": "",
"cstatus": "1200",
"dstatus": "",
},
"1300": {
"status": "1300",
"name": "审核失败(平台第二次审核)",
"next": "1060",
"cstatus": "1050",
"dstatus": "1060",
}
}
```
## **<a name="queryInvoices"> 全部发票列表 </a>**     
[返回到目录](#menu)     
**接口方式** HTTP
**HTTP方法** POST
**URI路径** /web/invoice/invoiceCtl/queryInvoices
**参数验证**
**参数**
| 参数名|数据类型|必须|默认| 说明 |
|---|:---:|:---:|:---:|---|
| pageIndex | number | 否 | 1 | 当前页数 |
| pageSize | number | 否 | 10 | 每页记录数 |
| complateTax | string | 否 |  | 是否完税 |
| invoiceTime | string | 否 |  | 开发票时间 |
| applyNo | string | 否 |  | 发票申请编号 |
| inInvalid | string | 否 |  | 是否完税 |
| type | string | 否 |  | 发票类型 |
**示例**
```
{
"type":"10"
}
```
**返回结果**
| 参数名|数据类型| 说明 |
|---|:---:|---|
| status | Number | 状态码 |
| msg | String | 提示信息 |
| data | JSON | 返回值 |
**示例**
```
{
"status":0,
"msg":"操作成功",
"data":{
"count":3,
"rows":[
{
"invoiceTime":"2019-10-28 10:22:05",
"complateTax":"未完成",
"taxTime":"2019-10-28 10:22:05",
"createdAt":"2019-10-28 10:22:05",
"updatedAt":"2019-10-28 10:22:05",
"id":"11665258555003154",
"applyNo":"gongsibao001",
"merchantId":"18asf854584",
"status":"1030",
"invoiceNo":"",
"invoiceImg":null,
"taxNo":"",
"taxVoucher":null,
"mailNo":"",
"deletedAt":null,
"version":0,
"apply":{
"isInvalid":"红冲",
"createdAt":"2019-10-31 12:15:42",
"updatedAt":"2019-10-31 12:15:42",
"type":10,
"applyNo":"gongsibao001",
"merchantName":"腾讯信息科有限公司",
"businessName":"悦图遥感科技"
}
},
{
"invoiceTime":"2019-10-26 14:41:42",
"complateTax":"已完成",
"taxTime":"2019-10-10 08:00:00",
"createdAt":"2019-10-25 19:56:30",
"updatedAt":"2019-10-26 14:41:42",
"id":"11665033820002912",
"applyNo":"gongsibao001",
"merchantId":"18asf854584",
"status":"1080",
"invoiceNo":"gongsibao4584585",
"invoiceImg":"www.baidu.com",
"taxNo":"DIE552SDKD",
"taxVoucher":null,
"mailNo":"JIDNUId625815",
"deletedAt":null,
"version":0,
"apply":{
"isInvalid":"未红冲",
"createdAt":"2019-10-31 12:15:42",
"updatedAt":"2019-10-31 12:15:42",
"type":10,
"applyNo":"gongsibao001",
"merchantName":"腾讯信息科有限公司",
"businessName":"网易信息科技"
}
},
{
"invoiceTime":"2019-10-25 17:38:48",
"complateTax":"未完成",
"taxTime":"2019-10-25 17:36:36",
"createdAt":"2019-10-25 17:36:36",
"updatedAt":"2019-10-25 17:38:48",
"id":"11665025426002758",
"applyNo":"zjietiaodong999",
"merchantId":"11064622752480998",
"status":"1030",
"invoiceNo":"",
"invoiceImg":null,
"taxNo":"",
"taxVoucher":null,
"mailNo":"",
"deletedAt":null,
"version":0,
"apply":{
"isInvalid":"红冲",
"createdAt":"2019-10-31 12:15:42",
"updatedAt":"2019-10-31 12:15:42",
"type":10,
"applyNo":"zjietiaodong999",
"merchantName":"网易科技",
"businessName":"zijietiaodongmingcheng"
}
}
]
},
"bizmsg":"empty",
"requestid":"8296ad60d1bc46b8a73f7405f2861aec"
}
```
## **<a name="queryInvoice"> 查看详情</a>**     
[返回到目录](#menu)     
**接口方式** HTTP
**HTTP方法** POST
**URI路径** '/web/invoice/invoiceCtl/queryInvoice
**参数验证**
**参数**
| 参数名|数据类型|必须|默认| 说明 |
|---|:---:|:---:|:---:|---|
| id | string | 否 |  | 发票ID |
| applyNo | string | 否 |  | 发票申请号 |
| merchantId | string | 否 |  | 商户ID |
**示例**
```
注意:applyNo结合merchantId 一起使用,当id存在是优先使用Id查询
{
"merchantId":"11665033820002912",
"applyNo": "1020",
"id":"xxxx"
}
```
**返回结果**
| 参数名|数据类型| 说明 |
|---|:---:|---|
| status | Number | 状态码 |
| msg | String | 提示信息 |
| data | JSON | 返回值 |
**示例**
```
{
"status":0,
"msg":"操作成功",
"data":{
"id":"11665033820002912",
"merchantId":"18asf854584",
"merchantName":"腾讯信息科有限公司",
"merchantCreditCode":"5456461654165",
"merchantAddr":"北京海淀区上地",
"merchantMobile":"18833836392",
"merchantBank":"招商银大望路支行",
"merchantAccount":"tengxunkeji",
"businessmenId":"12795594625000138",
"businessmenCreditCode":"91210200MA0QE7GT5L",
"businessName":"网易信息科技",
"isBank":"已开户",
"taxAuthorities":"北京朝阳税务局",
"type":"普通发票",
"invoiceAmount":200000,
"statements":"wwww.baidu.com",
"contract":"www.qq.com",
"invoiceTime":"2019-09-19",
"settleImg":"www.taobao.com",
"applyNo":"gongsibao001",
"invoiceContent":null,
"personalIncomeTax":482926.51,
"additionalTax":65323.9,
"valueAddedTax":544365.81,
"serviceCharge":45,
"applyMobile":null,
"isInvalid":"已红冲",
"parentId":null,
"status":"1090",
"customerStatus":"1090",
"payWay":"系统账户扣款",
"payAccount":null,
"isPay":"已支付",
"mailAddr":"北京来广营",
"mailMobile":"0-012535",
"mailTo":"脚姐",
"remark":"脚姐已批准",
"delivererId":"11329678846003516",
"createdAt":"2019-10-25",
"updatedAt":"2019-10-26T05:36:15.000Z",
"deletedAt":null,
"version":0,
"statusName":"完成",
"customerStatusName":"",
"deliverer":{
"id":"11329678846003516",
"invoiceId":"11665033820002912",
"applyNo":"gongsibao001",
"merchantId":"18asf854584",
"delivererId":"1536854655",
"delivererName":"国投迎新科技有限公司",
"delivererAmount":10,
"breakReason":null,
"auditContent":"审核内容信息",
"delivererContent":"交付商交付内容信息",
"mailAddr":"北京大望路",
"mailMobile":"1000",
"mailTo":"脚姐",
"delivererMailNo":"JIDNUId625815",
"platformMailNo":"545sre55sg",
"createdAt":"2019-10-25",
"updatedAt":"2019-10-28",
"deletedAt":null,
"version":0
},
"invoice":{
"id":"11665033820002912",
"applyNo":"gongsibao001",
"merchantId":"18asf854584",
"status":"1080",
"invoiceNo":"gongsibao4584585",
"invoiceTime":"2019-10-12",
"invoiceImg":"www.baidu.com",
"taxNo":"DIE552SDKD",
"complateTax":"已完税",
"taxTime":"2019-10-10",
"taxVoucher":null,
"mailNo":"JIDNUId625815",
"createdAt":"2019-10-25",
"updatedAt":"2019-10-26",
"deletedAt":null,
"version":0,
"statusName":"已邮寄"
},
"parentInvoice":null
},
"bizmsg":"empty",
"requestid":"9120426859914d88ba56a58709683be4"
}
```
[返回到目录](#menu)     
**接口方式** HTTP
**HTTP方法** POST
**URI路径** '/web/invoice/invoiceCtl/platformAssignment'
**参数验证**
**参数**
| 参数名|数据类型|必须|默认| 说明 |
|---|:---:|:---:|:---:|---|
| id | string| 是 |  | 发票申请ID |
| nextStatus | string | 是 | 1070 | 发票状态 |
| auditContent | string | 是 |  | 审核内容 |
| delivererContent | string | 是 |  | 交付内容 |
| mailAddr | string | 是 |  | 邮寄地址 |
| mailMobile | string | 是 |  | 邮寄电话 |
| mailTo | string | 是 |  | 邮寄人 |
**示例**
```
{
"id":"11665430003004143",
"nextStatus": "1070",
"auditContent":"审核内容信息",
"delivererContent":"交付商交付内容信息",
"mailAddr":"北京大望路",
"mailMobile":"010-65658565",
"mailTo":"杨庆菊"
}
```
**返回结果**
| 参数名|数据类型| 说明 |
|---|:---:|---|
| status | Number | 状态码 |
| msg | String | 提示信息 |
| data | JSON | 返回值 |
**示例**
```
{
"status":0,
"msg":"success",
"data":null,
"requestid":"3ea95f1837b9475da4a4d9aacc3ff74b"
}
```
## **<a name="queryTxPayment"> 查看完税证明</a>**     
[返回到目录](#menu)     
**接口方式** HTTP
**HTTP方法** POST
**URI路径** '/api/op/action/springboard
**参数验证**
**参数**
| 参数名|数据类型|必须|默认| 说明 |
|---|:---:|:---:|:---:|---|
| id | string | 是 |  | 发票ID |
**示例**
```
{
"id":"11665033820002912"
}
```
**返回结果**
| 参数名|数据类型| 说明 |
|---|:---:|---|
| status | Number | 状态码 |
| msg | String | 提示信息 |
| data | JSON | 返回值 |
```
{
"status":0,
"msg":"操作成功",
"data":{
"invoiceTime":"2019-10-31 13:09:03",
"complateTax":"已完成",
"taxTime":"2019-10-10 08:00:00",
"createdAt":"2019-10-31 13:09:03",
"updatedAt":"2019-10-31 13:09:03",
"id":"11665448190004592",
"taxNo":"DIE552SDKD",
"taxVoucher":"www.baidu.com"
},
"bizmsg":"empty",
"requestid":"b00a9b2244504505bf1ef1bc36b6949e"
}
```
\ No newline at end of file
<a name="menu">目录</a>
1. [发票状态](#status)
1. [发票申请列表](#queryApplyInvoices)
1. [查看详情](#queryInvoice)
1. [申请审核](#platformAssignment)
1. [业务分配](#platformAssignment2)
1. [交付审核](#platformAssignment3)
## **<a name="saveInvoice"> 发票状态</a>**     
[返回到目录](#menu)    
```javascript
{
"0090": {
"status": "0090",
"name": "未付款",
"next": "1000",
"cstatus": "0090",//客户
"dstatus": "",//交付商
},
"1000": {
"status": "1000",
"name": "待审核",
"next": "1020",
"cstatus": "0090",//客户
"dstatus": "",//交付商
},
"1010": {
"status": "1010",
"name": "审核不通过",
"next": "",
"cstatus": "1010",
"dstatus": "",
},
"1020": {
"status": "1020",
"name": "待分配",
"next": "1030",
"cstatus": "1030",
"dstatus": "",
},
"1030": {
"status": "1030",
"name": "待处理",
"next": "1050",
"cstatus": "1030",
"dstatus": "1030",
},
"1040": {
"status": "1040",
"name": "交付商关闭",
"next": "1020",
"cstatus": "1030",
"dstatus": "1040",
},
"1050": {
"status": "1050",
"name": "已开具",
"next": "1060",
"cstatus": "1050",
"dstatus": "1050",
},
"1060": {
"status": "1060",
"name": "待审核",
"next": "1070",
"cstatus": "1050",
"dstatus": "1070",
},
"1070": {
"status": "1070",
"name": "审核通过",
"next": "1080",
"cstatus": "1050",
"dstatus": "1070",
},
"1080": {
"status": "1080",
"name": "已邮寄",
"next": "1090",
"cstatus": "1050",
"dstatus": "1080",
},
"1090": {
"status": "1090",
"name": "完成",
"next": "1100",
"cstatus": "1090",
"dstatus": "1080",
},
"1100": {
"status": "1090",
"name": "发票撤回",
"next": "1100",
"cstatus": "1090",
"dstatus": "1080",
},
"1200": {
"status": "1200",
"name": "红冲",
"next": "",
"cstatus": "1200",
"dstatus": "",
},
"1300": {
"status": "1300",
"name": "审核失败(平台第二次审核)",
"next": "1060",
"cstatus": "1050",
"dstatus": "1060",
}
}
```
## **<a name="queryApplyInvoices"> 发票申请列表(平台) </a>**     
[返回到目录](#menu)     
**接口方式** HTTP
**HTTP方法** POST
**URI路径** /web/invoice/invoiceCtl/queryApplyInvoices
**参数验证**
**参数**
| 参数名|数据类型|必须|默认| 说明 |
|---|:---:|:---:|:---:|---|
| pageIndex | number | 否 | 1 | 当前页数 |
| pageSize | number | 否 | 10 | 每页记录数 |
| invoiceTime | string | 是 |  | 开发票时间 |
| applyNo | string | 是 |  | 发票申请编号 |
| type | string | 是 |  | 发票类型 |
| status | string | 是 |  | 发票状态 |
**示例**
```javascript
{
"type":"10"
}
```
**返回结果**
| 参数名|数据类型| 说明 |
|---|:---:|---|
| status | Number | 状态码 |
| msg | String | 提示信息 |
| data | JSON | 返回值 |
**示例**
```javascript
{
"status":0,
"msg":"操作成功",
"data":{
"count":3,
"rows":[
{
"invoiceTime":"2019-10-28 10:22:05",
"complateTax":"未完成",
"taxTime":"2019-10-28 10:22:05",
"createdAt":"2019-10-28 10:22:05",
"updatedAt":"2019-10-28 10:22:05",
"id":"11665258555003154",
"applyNo":"gongsibao001",
"merchantId":"18asf854584",
"status":"1030",
"invoiceNo":"",
"invoiceImg":null,
"taxNo":"",
"taxVoucher":null,
"mailNo":"",
"deletedAt":null,
"version":0,
"apply":{
"isInvalid":"红冲",
"createdAt":"2019-10-31 12:15:42",
"updatedAt":"2019-10-31 12:15:42",
"type":10,
"applyNo":"gongsibao001",
"merchantName":"腾讯信息科有限公司",
"businessName":"悦图遥感科技"
}
},
{
"invoiceTime":"2019-10-26 14:41:42",
"complateTax":"已完成",
"taxTime":"2019-10-10 08:00:00",
"createdAt":"2019-10-25 19:56:30",
"updatedAt":"2019-10-26 14:41:42",
"id":"11665033820002912",
"applyNo":"gongsibao001",
"merchantId":"18asf854584",
"status":"1080",
"invoiceNo":"gongsibao4584585",
"invoiceImg":"www.baidu.com",
"taxNo":"DIE552SDKD",
"taxVoucher":null,
"mailNo":"JIDNUId625815",
"deletedAt":null,
"version":0,
"apply":{
"isInvalid":"未红冲",
"createdAt":"2019-10-31 12:15:42",
"updatedAt":"2019-10-31 12:15:42",
"type":10,
"applyNo":"gongsibao001",
"merchantName":"腾讯信息科有限公司",
"businessName":"网易信息科技"
}
},
{
"invoiceTime":"2019-10-25 17:38:48",
"complateTax":"未完成",
"taxTime":"2019-10-25 17:36:36",
"createdAt":"2019-10-25 17:36:36",
"updatedAt":"2019-10-25 17:38:48",
"id":"11665025426002758",
"applyNo":"zjietiaodong999",
"merchantId":"11064622752480998",
"status":"1030",
"invoiceNo":"",
"invoiceImg":null,
"taxNo":"",
"taxVoucher":null,
"mailNo":"",
"deletedAt":null,
"version":0,
"apply":{
"isInvalid":"红冲",
"createdAt":"2019-10-31 12:15:42",
"updatedAt":"2019-10-31 12:15:42",
"type":10,
"applyNo":"zjietiaodong999",
"merchantName":"网易科技",
"businessName":"zijietiaodongmingcheng"
}
}
]
},
"bizmsg":"empty",
"requestid":"8296ad60d1bc46b8a73f7405f2861aec"
}
```
## **<a name="queryInvoice"> 查看详情</a>**     
[返回到目录](#menu)     
**接口方式** HTTP
**HTTP方法** POST
**URI路径** '/web/invoice/invoiceCtl/queryInvoice
**参数验证**
**参数**
| 参数名|数据类型|必须|默认| 说明 |
|---|:---:|:---:|:---:|---|
| id | string | 否 |  | 发票ID |
| applyNo | string | 否 |  | 发票申请号 |
| merchantId | string | 否 |  | 商户ID |
**示例**
```
注意:applyNo结合merchantId 一起使用,当id存在是优先使用Id查询
{
"merchantId":"11665033820002912",
"applyNo": "1020",
"id":"xxxx"
}
```
**返回结果**
| 参数名|数据类型| 说明 |
|---|:---:|---|
| status | Number | 状态码 |
| msg | String | 提示信息 |
| data | JSON | 返回值 |
**示例**
```
{
"status":0,
"msg":"操作成功",
"data":{
"id":"11665033820002912",
"merchantId":"18asf854584",
"merchantName":"腾讯信息科有限公司",
"merchantCreditCode":"5456461654165",
"merchantAddr":"北京海淀区上地",
"merchantMobile":"18833836392",
"merchantBank":"招商银大望路支行",
"merchantAccount":"tengxunkeji",
"businessmenId":"12795594625000138",
"businessmenCreditCode":"91210200MA0QE7GT5L",
"businessName":"网易信息科技",
"isBank":"已开户",
"taxAuthorities":"北京朝阳税务局",
"type":"普通发票",
"invoiceAmount":200000,
"statements":"wwww.baidu.com",
"contract":"www.qq.com",
"invoiceTime":"2019-09-19",
"settleImg":"www.taobao.com",
"applyNo":"gongsibao001",
"invoiceContent":null,
"personalIncomeTax":482926.51,
"additionalTax":65323.9,
"valueAddedTax":544365.81,
"serviceCharge":45,
"applyMobile":null,
"isInvalid":"已红冲",
"parentId":null,
"status":"1090",
"customerStatus":"1090",
"payWay":"系统账户扣款",
"payAccount":null,
"isPay":"已支付",
"mailAddr":"北京来广营",
"mailMobile":"0-012535",
"mailTo":"脚姐",
"remark":"脚姐已批准",
"delivererId":"11329678846003516",
"createdAt":"2019-10-25",
"updatedAt":"2019-10-26T05:36:15.000Z",
"deletedAt":null,
"version":0,
"statusName":"完成",
"customerStatusName":"",
"deliverer":{
"id":"11329678846003516",
"invoiceId":"11665033820002912",
"applyNo":"gongsibao001",
"merchantId":"18asf854584",
"delivererId":"1536854655",
"delivererName":"国投迎新科技有限公司",
"delivererAmount":10,
"breakReason":null,
"auditContent":"审核内容信息",
"delivererContent":"交付商交付内容信息",
"mailAddr":"北京大望路",
"mailMobile":"1000",
"mailTo":"脚姐",
"delivererMailNo":"JIDNUId625815",
"platformMailNo":"545sre55sg",
"createdAt":"2019-10-25",
"updatedAt":"2019-10-28",
"deletedAt":null,
"version":0
},
"invoice":{
"id":"11665033820002912",
"applyNo":"gongsibao001",
"merchantId":"18asf854584",
"status":"1080",
"invoiceNo":"gongsibao4584585",
"invoiceTime":"2019-10-12",
"invoiceImg":"www.baidu.com",
"taxNo":"DIE552SDKD",
"complateTax":"已完税",
"taxTime":"2019-10-10",
"taxVoucher":null,
"mailNo":"JIDNUId625815",
"createdAt":"2019-10-25",
"updatedAt":"2019-10-26",
"deletedAt":null,
"version":0,
"statusName":"已邮寄"
},
"parentInvoice":null
},
"bizmsg":"empty",
"requestid":"9120426859914d88ba56a58709683be4"
}
```
## **<a name="platformAssignment"> 申请审核</a>**     
[返回到目录](#menu)     
**接口方式** HTTP
**HTTP方法** POST
**URI路径** '/web/invoice/invoiceCtl/platformAssignment'
**参数验证**
**参数**
| 参数名|数据类型|必须|默认| 说明 |
|---|:---:|:---:|:---:|---|
| id | string| 是 |  | 发票申请ID |
| nextStatus | string | 是 |  | 发票状态 |
| remark | string | 是 |  | 平台审核备注 |
| isPay | number | 是 |  | 发票支付 必须写 1 请确认是否已经支付 |
**示例**
```
{
"id":"11665430003004143",
"nextStatus": "1020",
"isPay": 1,
"remark": "材料准确无误"
}
```
**返回结果**
| 参数名|数据类型| 说明 |
|---|:---:|---|
| status | Number | 状态码 |
| msg | String | 提示信息 |
| data | JSON | 返回值 |
**示例**
```
{
"status":0,
"msg":"success",
"data":null,
"requestid":"ea903ff378d4469a8fef10a6e15f5036"
}
```
## **<a name="platformAssignment2"> 业务分配</a>**     
[返回到目录](#menu)     
**接口方式** HTTP
**HTTP方法** POST
**URI路径** '/web/invoice/invoiceCtl/platformAssignment'
**参数验证**
**参数**
| 参数名|数据类型|必须|默认| 说明 |
|---|:---:|:---:|:---:|---|
| id | string| 是 |  | 发票申请ID |
| nextStatus | string | 是 | 1030 | 发票状态 |
| merchantId | string | 是 |  | 购买方ID |
| delivererId | number | 是 |  | 交付商ID |
| delivererName | string | 是 |  | 交付商名称 |
| delivererAmount | string | 是 |  | 交付商分成 |
**示例**
```
{
"id":"11665033820002912",
"nextStatus": "1030",
"merchantId":"18asf854584",
"delivererId":"1536854655",
"delivererName":"国投迎新科技有限公司",
"delivererAmount":"1000"
}
```
**返回结果**
| 参数名|数据类型| 说明 |
|---|:---:|---|
| status | Number | 状态码 |
| msg | String | 提示信息 |
| data | JSON | 返回值 |
**示例**
```
{
"status":0,
"msg":"success",
"data":null,
"requestid":"3ea95f1837b9475da4a4d9aacc3ff74b"
}
```
## **<a name="platformAssignment3"> 交付审核</a>**     
[返回到目录](#menu)     
**接口方式** HTTP
**HTTP方法** POST
**URI路径** '/web/invoice/invoiceCtl/platformAssignment'
**参数验证**
**参数**
| 参数名|数据类型|必须|默认| 说明 |
|---|:---:|:---:|:---:|---|
| id | string| 是 |  | 发票申请ID |
| nextStatus | string | 是 | 1070 | 发票状态 |
| auditContent | string | 是 |  | 审核内容 |
| delivererContent | string | 是 |  | 交付内容 |
| mailAddr | string | 是 |  | 邮寄地址 |
| mailMobile | string | 是 |  | 邮寄电话 |
| mailTo | string | 是 |  | 邮寄人 |
**示例**
```
{
"id":"11665430003004143",
"nextStatus": "1070",
"auditContent":"审核内容信息",
"delivererContent":"交付商交付内容信息",
"mailAddr":"北京大望路",
"mailMobile":"010-65658565",
"mailTo":"杨庆菊"
}
```
**返回结果**
| 参数名|数据类型| 说明 |
|---|:---:|---|
| status | Number | 状态码 |
| msg | String | 提示信息 |
| data | JSON | 返回值 |
**示例**
```
{
"status":0,
"msg":"success",
"data":null,
"requestid":"3ea95f1837b9475da4a4d9aacc3ff74b"
}
```
<a name="menu">目录</a>
1. [交付查看商审批列表](#delivererInvoices)
1. [新建进度-已开具](#delivererAssignment)
1. [提交审核](#delivererAssignment2)
1. [新建进度-已邮寄](#delivererAssignment3)
1. [查看详情-和平台不一样](#queryInvoiceDeliverer)
## **<a name="delivererInvoices"> 发票列表(交付商) </a>**     
[返回到目录](#menu)     
**接口方式** HTTP
**HTTP方法** POST
**URI路径** /web/invoice/invoiceCtl/delivererInvoices
**参数验证**
**参数**
| 参数名|数据类型|必须|默认| 说明 |
|---|:---:|:---:|:---:|---|
| pageIndex | number | 否 | 1 | 当前页数 |
| pageSize | number | 否 | 10 | 每页记录数 |
| complateTax | string | 否 |  | 是否完税 |
| invoiceTime | string | 否 |  | 开发票时间 |
| applyNo | string | 否 |  | 发票申请编号 |
| inInvalid | string | 否 |  | 是否完税 |
| type | string | 否 |  | 发票类型 |
**示例**
```
{
"type":"10"
}
```
**返回结果**
| 参数名|数据类型| 说明 |
|---|:---:|---|
| status | Number | 状态码 |
| msg | String | 提示信息 |
| data | JSON | 返回值 |
**示例**
```javascript
{
"status":0,
"msg":"操作成功",
"data":{
"count":2,
"rows":[
{
"applyNo":"gongsibao-futong001",
"invoiceId":"11665448190004592",
"breakReason":null,
"apply":{
"merchantId":"11064622752480055",
"merchantName":"司机宝",
"type":"增值税专用发票",
"invoiceAmount":400000000,
"invoiceTime":"2019-10-19",
"businessName":"北京富通勤国际贸易有限责任公司(个体工商)"
},
"invoice":{
"invoiceNo":"gongsibao4584585",
"status":"1060",
"statusName":"待审核"
}
},
{
"applyNo":"gongsibao-futong001",
"invoiceId":"11665448190004592",
"breakReason":"业务繁忙",
"apply":{
"merchantId":"11064622752480055",
"merchantName":"司机宝",
"type":"增值税专用发票",
"invoiceAmount":400000000,
"invoiceTime":"2019-10-19",
"businessName":"北京富通勤国际贸易有限责任公司(个体工商)"
},
"invoice":{
"invoiceNo":"gongsibao4584585",
"status":"1060",
"statusName":"待审核"
}
}
]
},
"bizmsg":"empty",
"requestid":"21da505b34d7423fbbb8865d64f652a5"
}
```
## **<a name="delivererAssignment"> 新建进度-已开具</a>**     
[返回到目录](#menu)     
**接口方式** HTTP
**HTTP方法** POST
**URI路径** /web/invoice/invoiceCtl/delivererAssignment
**参数验证**
**参数**
| 参数名|数据类型|必须|默认| 说明 |
|---|:---:|:---:|:---:|---|
| id | string| 是 |  | 发票申请ID |
| nextStatus | string | 是 | 1050 | 发票状态 |
| invoiceNo | string | 是 |  | 发票编号 |
| invoiceTime | number | 是 |  | 开具时间 |
| invoiceImg | string | 是 |  | 发票图片 |
**示例**
```
{
"id":"11665430003004143",
"nextStatus": "1050",
"invoiceNo":"gongsibao4584585",
"invoiceTime":"2019-10-12",
"invoiceImg":"www.baidu.com"
}
```
**返回结果**
| 参数名|数据类型| 说明 |
|---|:---:|---|
| status | Number | 状态码 |
| msg | String | 提示信息 |
| data | JSON | 返回值 |
**示例**
```javascript
{
"status":0,
"msg":"success",
"data":null,
"requestid":"3ea95f1837b9475da4a4d9aacc3ff74b"
}
```
## **<a name="delivererAssignment2"> 提交审核</a>**     
[返回到目录](#menu)     
**接口方式** HTTP
**HTTP方法** POST
**URI路径** /web/invoice/invoiceCtl/delivererAssignment
**参数验证**
**参数**
| 参数名|数据类型|必须|默认| 说明 |
|---|:---:|:---:|:---:|---|
| id | string| 是 |  | 发票申请ID |
| nextStatus | string | 是 | 1060  | 发票状态 |
**示例**
```javascript
{
"id":"11665033820002912",
"nextStatus": "1060",
}
```
**返回结果**
| 参数名|数据类型| 说明 |
|---|:---:|---|
| status | Number | 状态码 |
| msg | String | 提示信息 |
| data | JSON | 返回值 |
**示例**
```javascript
{
"status":0,
"msg":"success",
"data":null,
"requestid":"3ea95f1837b9475da4a4d9aacc3ff74b"
}
```
## **<a name="delivererAssignment3"> 交付商邮寄</a>**     
[返回到目录](#menu)     
**接口方式** HTTP
**HTTP方法** POST
**URI路径** /web/invoice/invoiceCtl/delivererAssignment
**参数验证**
**参数**
| 参数名|数据类型|必须|默认| 说明 |
|---|:---:|:---:|:---:|---|
| id | string| 是 |  | 发票申请ID |
| nextStatus | string | 是 | 1080  | 发票状态 |
| mailNo | string | 是 |  | 邮寄单号 |
**示例**
```
{
"id":"11665430003004143",
"nextStatus": "1080",
"mailNo":"JIDNUId625815"
}
```
**返回结果**
| 参数名|数据类型| 说明 |
|---|:---:|---|
| status | Number | 状态码 |
| msg | String | 提示信息 |
| data | JSON | 返回值 |
**示例**
```
{
"status":0,
"msg":"success",
"data":null,
"requestid":"3ea95f1837b9475da4a4d9aacc3ff74b"
}
```
## **<a name="queryInvoiceDeliverer"> 查看详情-和平台不一样</a>**     
[返回到目录](#menu)     
**接口方式** HTTP
**HTTP方法** POST
**URI路径** '/api/op/action/springboard
**参数验证**
**参数**
| 参数名|数据类型|必须|默认| 说明 |
|---|:---:|:---:|:---:|---|
| id | string | 否 |  | 发票ID |
| applyNo | string | 否 |  | 发票申请号 |
| merchantId | string | 是 |  | 商户ID |
**示例**
```
注意:applyNo结合merchantId 一起使用,当id存在是优先使用Id查询
{
"merchantId":"11665033820002912",
"applyNo": "1020",
"id":"xxxx"
}
```
**返回结果**
| 参数名|数据类型| 说明 |
|---|:---:|---|
| status | Number | 状态码 |
| msg | String | 提示信息 |
| data | JSON | 返回值 |
**示例**
```
{
"status":0,
"msg":"操作成功",
"data":{
"id":"11665033820002912",
"delivererId":"11329678846003516",
"merchantId":"18asf854584",
"merchantName":"腾讯信息科有限公司",
"merchantCreditCode":"5456461654165",
"merchantAddr":"北京海淀区上地",
"merchantMobile":"18833836392",
"merchantBank":"招商银大望路支行",
"merchantAccount":"tengxunkeji",
"businessmenId":"12795594625000138",
"businessmenCreditCode":"91210200MA0QE7GT5L",
"businessName":"网易信息科技",
"isBank":"未开户",
"taxAuthorities":"北京朝阳税务局",
"type":"普通发票",
"invoiceAmount":20000000,
"statements":"wwww.baidu.com",
"contract":"www.qq.com",
"invoiceTime":"2019-09-19",
"settleImg":"www.taobao.com",
"applyNo":"gongsibao001",
"invoiceContent":null,
"personalIncomeTax":48292651,
"additionalTax":6532390,
"valueAddedTax":54436581,
"serviceCharge":4500,
"applyMobile":null,
"mailAddr":"北京来广营",
"mailMobile":"0-012535",
"mailTo":"脚姐",
"createdAt":"2019-10-25",
"deliverer":{
"auditContent":"审核内容信息",
"delivererContent":"交付商交付内容信息",
"mailAddr":"北京大望路",
"mailMobile":"1000",
"mailTo":"脚姐",
"delivererMailNo":"JIDNUId625815",
"status":"1080",
"statusName":"已邮寄"
},
"invoice":{
"invoiceNo":"gongsibao4584585",
"invoiceTime":"2019-10-12",
"invoiceImg":"www.baidu.com",
"taxNo":"DIE552SDKD",
"complateTax":"已完税",
"taxTime":"2019-10-10",
"taxVoucher":null
}
},
"bizmsg":"empty",
"requestid":"eecdd1283154468897f30b0c2fd37cb3"
}
```
<a name="menu">目录</a>
1. [发票信息列表](#delivererInvoices)
1. [上传完税](#txPayment)
## **<a name="delivererInvoices"> 发票发票管理列表) </a>**     
[返回到目录](#menu)     
**接口方式** HTTP
**HTTP方法** POST
**URI路径** /web/invoice/invoiceCtl/delivererInvoices
**参数验证**
**参数**
| 参数名|数据类型|必须|默认| 说明 |
|---|:---:|:---:|:---:|---|
| pageIndex | number | 否 | 1 | 当前页数 |
| pageSize | number | 否 | 10 | 每页记录数 |
| complateTax | string | 否 |  | 是否完税 |
| invoiceTime | string | 否 |  | 开发票时间 |
| applyNo | string | 否 |  | 发票申请编号 |
| inInvalid | string | 否 |  | 是否完税 |
| type | string | 否 |  | 发票类型 |
**示例**
```
{
"type":"10"
}
```
**返回结果**
| 参数名|数据类型| 说明 |
|---|:---:|---|
| status | Number | 状态码 |
| msg | String | 提示信息 |
| data | JSON | 返回值 |
**示例**
```javascript
{
"status":0,
"msg":"操作成功",
"data":{
"count":2,
"rows":[
{
"applyNo":"gongsibao-futong001",
"invoiceId":"11665448190004592",
"breakReason":null,
"apply":{
"merchantId":"11064622752480055",
"merchantName":"司机宝",
"type":"增值税专用发票",
"invoiceAmount":400000000,
"invoiceTime":"2019-10-19",
"businessName":"北京富通勤国际贸易有限责任公司(个体工商)"
},
"invoice":{
"invoiceNo":"gongsibao4584585",
"status":"1060",
"statusName":"待审核"
}
},
{
"applyNo":"gongsibao-futong001",
"invoiceId":"11665448190004592",
"breakReason":"业务繁忙",
"apply":{
"merchantId":"11064622752480055",
"merchantName":"司机宝",
"type":"增值税专用发票",
"invoiceAmount":400000000,
"invoiceTime":"2019-10-19",
"businessName":"北京富通勤国际贸易有限责任公司(个体工商)"
},
"invoice":{
"invoiceNo":"gongsibao4584585",
"status":"1060",
"statusName":"待审核"
}
}
]
},
"bizmsg":"empty",
"requestid":"21da505b34d7423fbbb8865d64f652a5"
}
```
## **<a name="txPayment"> 上传完税 </a>**     
[返回到目录](#menu)     
**接口方式** HTTP
**HTTP方法** POST
**URI路径** /web/invoice/invoiceCtl/txPayment
**参数验证**
**参数**
| 参数名|数据类型|必须|默认| 说明 |
|---|:---:|:---:|:---:|---|
| id | number | 是 |  | 发票ID |
| taxNo | number | 是 |  | 发票编号 |
| complateTax | string | 是 |  | 是否完税 |
| taxTime | string | 是 |  | 完税时间 |
| taxVoucher | string | 是 |  | 完税图片 |
**示例**
```
{
"id":"11665448190004592",
"taxNo": "DIE552SDKD",
"complateTax":1,
"taxTime":"2019-10-10",
"taxVoucher":"www.baidu.com"
}
```
**返回结果**
| 参数名|数据类型| 说明 |
|---|:---:|---|
| status | Number | 状态码 |
| msg | String | 提示信息 |
| data | JSON | 返回值 |
<a name="menu">目录</a>
1. [发票状态](#status)
1. [验证发票是否符合申请](#verification)
1. [发票查询明细(平台)](#queryInvoice)
1. [发票查询明细(交付商)](#queryInvoiceDeliverer)
1. [发票试算](#calcInvoice)
1. [发票申请](#invoices)
1. [发票申请列表(平台)](#queryInvoices)
1. [交付查看商审批列表](#delivererInvoices)
1. [发票平台审批](#platformAssignment)
1. [发票交付商审批](#delivererAssignment)
1. [完成税证明](#txPayment)
1. [查看完成税证明](#queryTxPayment)
1. [平台更新邮寄地址](#apiUpEmNO)
## **<a name="saveInvoice"> 发票状态</a>**     
[返回到目录](#menu)    
```
{
"0090": {
"status": "0090",
"name": "未付款",
"next": "1000",
"cstatus": "0090",//客户
"dstatus": "",//交付商
},
"1000": {
"status": "1000",
"name": "待审核",
"next": "1020",
"cstatus": "0090",//客户
"dstatus": "",//交付商
},
"1010": {
"status": "1010",
"name": "审核不通过",
"next": "",
"cstatus": "1010",
"dstatus": "",
},
"1020": {
"status": "1020",
"name": "待分配",
"next": "1030",
"cstatus": "1030",
"dstatus": "",
},
"1030": {
"status": "1030",
"name": "待处理",
"next": "1050",
"cstatus": "1030",
"dstatus": "1030",
},
"1040": {
"status": "1040",
"name": "交付商关闭",
"next": "1020",
"cstatus": "1030",
"dstatus": "1040",
},
"1050": {
"status": "1050",
"name": "已开具",
"next": "1060",
"cstatus": "1050",
"dstatus": "1050",
},
"1060": {
"status": "1060",
"name": "待审核",
"next": "1070",
"cstatus": "1050",
"dstatus": "1070",
},
"1070": {
"status": "1070",
"name": "审核通过",
"next": "1080",
"cstatus": "1050",
"dstatus": "1070",
},
"1080": {
"status": "1080",
"name": "已邮寄",
"next": "1090",
"cstatus": "1050",
"dstatus": "1080",
},
"1090": {
"status": "1090",
"name": "完成",
"next": "1100",
"cstatus": "1090",
"dstatus": "1080",
},
"1100": {
"status": "1090",
"name": "发票撤回",
"next": "1100",
"cstatus": "1090",
"dstatus": "1080",
},
"1200": {
"status": "1200",
"name": "红冲",
"next": "",
"cstatus": "1200",
"dstatus": "",
},
"1300": {
"status": "1300",
"name": "审核失败(平台第二次审核)",
"next": "1060",
"cstatus": "1050",
"dstatus": "1060",
}
}
```
## **<a name="verification"> 验证发票是否符合申请</a>**     
[返回到目录](#menu)     
**接口方式** HTTP
**HTTP方法** POST
**URI路径** '/web/invoice/invoiceCtl/verification'
**参数验证**
**参数**
| 参数名|数据类型|必须|默认| 说明 |
|---|:---:|:---:|:---:|---|
| businessmenCreditCode| string | 是 |  | 发票ID |
**示例**
```
{
"businessmenCreditCode": "91210200MA0QE7GT5L"
}
```
**返回结果**
| 参数名|数据类型| 说明 |
|---|:---:|---|
| status | Number | 状态码 |
| msg | String | 提示信息 |
| data | JSON | 返回值 |
**示例**
```
{
"code":200,
"msg":"ok",
"data":[
],
"status":0,
"requestid":"06336188128143c09c935e536c9742f2"
}
```
## **<a name="calcInvoice"> 发票试算</a>**     
[返回到目录](#menu)     
**接口方式** HTTP
**HTTP方法** POST
**URI路径** /web/invoice/invoiceCtl/calcInvoice
**参数验证**
**参数**
| 参数名|数据类型|必须|默认| 说明 |
|---|:---:|:---:|:---:|---|
| businessmenCreditCode | string| 是 |  | 销售方社会统一信用代码 |
| serviceRate | number| 是 |  | 服务费率 |
| perCalWay | number| 是 |  | 个税计算方式 1:年 请填写 1 |
| valCalWay | number| 是 |  | 增值税计算方式 1:月 2:季度 |
| merchantId | string | 是 |  | 商户id |
| taxIncPriRat | number| 是 |  | 不含税价百分比 |
| taxCostPriRat | number| 是 |  | 核定成本费用率 |
| invoiceTime | String| 是 |  | 开票时间 |
| invoiceAmount | number| 是 |  | 发票金额 |
| perIncTaxRange | JSON | 是 |  | 个税税额范围 |
| valAddTaxRange | JSON | 是 |  | 增值税范围 |
**示例**
```
{
"businessmenCreditCode": "111",
"serviceRate": 225,
"perCalWay": "1",
"valCalWay": "1",
"businessmenId": "12795594625000138",
"taxCostPriRat": 1122,
"taxIncPriRat": 1022,
"invoiceTime": "2019-09-19",
"invoiceAmount": 20000000,
"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 | 返回值 |
**示例**
```
//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>**     
[返回到目录](#menu)     
**接口方式** HTTP
**HTTP方法** POST
**URI路径** /web/invoice/invoiceCtl/saveInvoice
**参数验证**
**参数**
| 参数名|数据类型|必须|默认| 说明 |
|---|:---:|:---:|:---:|---|
| serviceRate | number| 是 |  | 服务费率 |
| perCalWay | number| 是 |  | 个税计算方式 1:月 2:季度 3:年 |
| valCalWay | number| 是 |  | 增值税计算方式 1:月 2:季度 3:年 |
| taxIncPriRat | number| 是 |  | 不含税价百分比 |
| taxCostPriRat | number| 是 |  | 核定成本费用率 |
| invoiceTime | String| 是 |  | 开票时间 |
| perIncTaxRange | JSON | 是 |  | 个税税额范围 |
| valAddTaxRange | JSON | 是 |  | 增值税范围 |
| merchantId | string | 是 |  | 商户id |
| merchantAccount | string | 是 |  | 商户账户 |
| merchantName | string | 是 |  | 商户名称 |
| merchantCreditCode | string | 是 |  | 商户社会统一信用代码 |
| merchantAddr | string | 是 |  | 商户地址 |
| merchantMobile | string | 是 |  | 商户电话 |
| merchantBank | string | 是 |  | 商户开户行 |
| businessmenId | string| 是 |  | 销售方ID |
| businessmenCreditCode | string| 是 |  | 销售方社会统一信用代码 |
| businessName | string| 是 |  | 销售方名称 |
| isBank | string| 是 |  | 是否开户 1:开户 0:未开户 |
| invoiceNo | string | 否 |  | 发票编号 |
| type | number| 否 |  | 发票类型 10 普通发票 20 增值税专用发票 30 电子发票 |
| invoiceAmount | number| 是 |  | 发票金额 |
| statements | string | 是 |  | 结算单子 |
| contract | string| 是 |  | 合同 |
| applyNo | String| 是 |  | 申请编号 |
| invoiceContent | string| 否 |  | 开票内容 |
| applyMobile | string| 否 |  | 申请电话 |
| isInvalid | string| 是 | 2 | 是否红冲 2 未红冲 |
| parentId | string| 否 |  | 发票关联ID 红冲时添加此字段 |
| status | string| 否 | 1000 |平台 开票状态 默认 1000 |
| customerStatus | string| 否 | 1000 | 客户开票状态 默认 1000 |
| payWay | string| 是 |  | 付款方式 10 系统账户扣款 20 线上支付 |
| payAccount | string| 是 | | 付款账户 |
| isPay | number| 否 | 0 | 是否支付 调用前请再次确认此是否支付 |
| mailAddr | string| 是 | | 邮寄地址 |
| mailMobile | string| 是 | | 邮寄电话 |
| mailTo | string| 是 | | 邮寄人 |
```
{
"serviceRate": 400,
"perCalWay": "1",
"valCalWay": "2",
"taxCostPriRat": 1122,
"taxIncPriRat": 1022,
"invoiceTime": "2019-10-19",
"perIncTaxRange": [
{
"minValue": 0,
"rate": "1",
"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": "1",
"fujiaRate": "6",
"maxValue": 3000000
},
{
"minValue": 3000100,
"zengzhiRate": "2",
"fujiaRate": "8",
"maxValue": 10000000
},
{
"minValue": 10000001,
"zengzhiRate": "3",
"fujiaRate": "12",
"maxValue": 214748364700
}
],
"merchantId":"11064622752480055",
"merchantAccount":"driverBabyPublicAccount",
"merchantName": "司机宝",
"merchantCreditCode":"91110108MA008KB56P",
"merchantAddr":"北京市海淀区北太平庄路18号3层3-0227",
"merchantMobile":"010-5369854",
"merchantBank":"110108022130868",
"businessmenId": "110115023996882",
"businessmenCreditCode": "91110115MA00HDC44L",
"businessName":"北京富通勤国际贸易有限责任公司(个体工商)",
"isBank":1,
"taxAuthorities":"北京大兴税务局",
"type":20,
"invoiceAmount": 40000000,
"statements":"wwww.baidu.com",
"contract":"www.qq.com",
"applyNo":"gongsibao-futong001",
"isInvalid":2,
"parentId":null,
"status":"1000",
"customerStatus":"1000",
"payWay":"20",
"payAccount":null,
"isPay":1,
"mailAddr":"北京市海淀区北太平庄路18号3层3-0227",
"mailMobile":"18633923636",
"mailTo":"赵彩红"
}
```
**返回结果**
| 参数名|数据类型| 说明 |
|---|:---:|---|
| status | Number | 状态码 |
| msg | String | 提示信息 |
| data | JSON | 返回值 |
**示例**
```
{
"status":0,
"msg":"success",
"data":null,
"requestid":"ea903ff378d4469a8fef10a6e15f5036"
}
```
## **<a name="queryInvoice"> 查询发票明细(平台)</a>**     
[返回到目录](#menu)     
**接口方式** HTTP
**HTTP方法** POST
**URI路径** '/web/invoice/invoiceCtl/queryInvoice
**参数验证**
**参数**
| 参数名|数据类型|必须|默认| 说明 |
|---|:---:|:---:|:---:|---|
| id | string | 否 |  | 发票ID |
| applyNo | string | 否 |  | 发票申请号 |
| merchantId | string | 否 |  | 商户ID |
**示例**
```
注意:applyNo结合merchantId 一起使用,当id存在是优先使用Id查询
{
"merchantId":"11665033820002912",
"applyNo": "1020",
"id":"xxxx"
}
```
**返回结果**
| 参数名|数据类型| 说明 |
|---|:---:|---|
| status | Number | 状态码 |
| msg | String | 提示信息 |
| data | JSON | 返回值 |
**示例**
```
{
"status":0,
"msg":"操作成功",
"data":{
"id":"11665033820002912",
"merchantId":"18asf854584",
"merchantName":"腾讯信息科有限公司",
"merchantCreditCode":"5456461654165",
"merchantAddr":"北京海淀区上地",
"merchantMobile":"18833836392",
"merchantBank":"招商银大望路支行",
"merchantAccount":"tengxunkeji",
"businessmenId":"12795594625000138",
"businessmenCreditCode":"91210200MA0QE7GT5L",
"businessName":"网易信息科技",
"isBank":"已开户",
"taxAuthorities":"北京朝阳税务局",
"type":"普通发票",
"invoiceAmount":200000,
"statements":"wwww.baidu.com",
"contract":"www.qq.com",
"invoiceTime":"2019-09-19",
"settleImg":"www.taobao.com",
"applyNo":"gongsibao001",
"invoiceContent":null,
"personalIncomeTax":482926.51,
"additionalTax":65323.9,
"valueAddedTax":544365.81,
"serviceCharge":45,
"applyMobile":null,
"isInvalid":"已红冲",
"parentId":null,
"status":"1090",
"customerStatus":"1090",
"payWay":"系统账户扣款",
"payAccount":null,
"isPay":"已支付",
"mailAddr":"北京来广营",
"mailMobile":"0-012535",
"mailTo":"脚姐",
"remark":"脚姐已批准",
"delivererId":"11329678846003516",
"createdAt":"2019-10-25",
"updatedAt":"2019-10-26T05:36:15.000Z",
"deletedAt":null,
"version":0,
"statusName":"完成",
"customerStatusName":"",
"deliverer":{
"id":"11329678846003516",
"invoiceId":"11665033820002912",
"applyNo":"gongsibao001",
"merchantId":"18asf854584",
"delivererId":"1536854655",
"delivererName":"国投迎新科技有限公司",
"delivererAmount":10,
"breakReason":null,
"auditContent":"审核内容信息",
"delivererContent":"交付商交付内容信息",
"mailAddr":"北京大望路",
"mailMobile":"1000",
"mailTo":"脚姐",
"delivererMailNo":"JIDNUId625815",
"platformMailNo":"545sre55sg",
"createdAt":"2019-10-25",
"updatedAt":"2019-10-28",
"deletedAt":null,
"version":0
},
"invoice":{
"id":"11665033820002912",
"applyNo":"gongsibao001",
"merchantId":"18asf854584",
"status":"1080",
"invoiceNo":"gongsibao4584585",
"invoiceTime":"2019-10-12",
"invoiceImg":"www.baidu.com",
"taxNo":"DIE552SDKD",
"complateTax":"已完税",
"taxTime":"2019-10-10",
"taxVoucher":null,
"mailNo":"JIDNUId625815",
"createdAt":"2019-10-25",
"updatedAt":"2019-10-26",
"deletedAt":null,
"version":0,
"statusName":"已邮寄"
},
"parentInvoice":null
},
"bizmsg":"empty",
"requestid":"9120426859914d88ba56a58709683be4"
}
```
## **<a name="queryInvoiceDeliverer"> 查询发票明细(交付商)</a>**     
[返回到目录](#menu)     
**接口方式** HTTP
**HTTP方法** POST
**URI路径** '/api/op/action/springboard
**参数验证**
**参数**
| 参数名|数据类型|必须|默认| 说明 |
|---|:---:|:---:|:---:|---|
| id | string | 否 |  | 发票ID |
| applyNo | string | 否 |  | 发票申请号 |
| merchantId | string | 是 |  | 商户ID |
**示例**
```
注意:applyNo结合merchantId 一起使用,当id存在是优先使用Id查询
{
"merchantId":"11665033820002912",
"applyNo": "1020",
"id":"xxxx"
}
```
**返回结果**
| 参数名|数据类型| 说明 |
|---|:---:|---|
| status | Number | 状态码 |
| msg | String | 提示信息 |
| data | JSON | 返回值 |
**示例**
```
{
"status":0,
"msg":"操作成功",
"data":{
"id":"11665033820002912",
"delivererId":"11329678846003516",
"merchantId":"18asf854584",
"merchantName":"腾讯信息科有限公司",
"merchantCreditCode":"5456461654165",
"merchantAddr":"北京海淀区上地",
"merchantMobile":"18833836392",
"merchantBank":"招商银大望路支行",
"merchantAccount":"tengxunkeji",
"businessmenId":"12795594625000138",
"businessmenCreditCode":"91210200MA0QE7GT5L",
"businessName":"网易信息科技",
"isBank":"未开户",
"taxAuthorities":"北京朝阳税务局",
"type":"普通发票",
"invoiceAmount":20000000,
"statements":"wwww.baidu.com",
"contract":"www.qq.com",
"invoiceTime":"2019-09-19",
"settleImg":"www.taobao.com",
"applyNo":"gongsibao001",
"invoiceContent":null,
"personalIncomeTax":48292651,
"additionalTax":6532390,
"valueAddedTax":54436581,
"serviceCharge":4500,
"applyMobile":null,
"mailAddr":"北京来广营",
"mailMobile":"0-012535",
"mailTo":"脚姐",
"createdAt":"2019-10-25",
"deliverer":{
"auditContent":"审核内容信息",
"delivererContent":"交付商交付内容信息",
"mailAddr":"北京大望路",
"mailMobile":"1000",
"mailTo":"脚姐",
"delivererMailNo":"JIDNUId625815",
"status":"1080",
"statusName":"已邮寄"
},
"invoice":{
"invoiceNo":"gongsibao4584585",
"invoiceTime":"2019-10-12",
"invoiceImg":"www.baidu.com",
"taxNo":"DIE552SDKD",
"complateTax":"已完税",
"taxTime":"2019-10-10",
"taxVoucher":null
}
},
"bizmsg":"empty",
"requestid":"eecdd1283154468897f30b0c2fd37cb3"
}
```
## **<a name="platformAssignment"> 发票平台第一次审批</a>**     
[返回到目录](#menu)     
**接口方式** HTTP
**HTTP方法** POST
**URI路径** '/web/invoice/invoiceCtl/platformAssignment'
**参数验证**
**参数**
| 参数名|数据类型|必须|默认| 说明 |
|---|:---:|:---:|:---:|---|
| id | string| 是 |  | 发票申请ID |
| nextStatus | string | 是 |  | 发票状态 |
| remark | string | 是 |  | 平台审核备注 |
| isPay | number | 是 |  | 发票支付 必须写 1 请确认是否已经支付 |
**示例**
```
{
"id":"11665430003004143",
"nextStatus": "1020",
"isPay": 1,
"remark": "材料准确无误"
}
```
**返回结果**
| 参数名|数据类型| 说明 |
|---|:---:|---|
| status | Number | 状态码 |
| msg | String | 提示信息 |
| data | JSON | 返回值 |
**示例**
```
{
"status":0,
"msg":"success",
"data":null,
"requestid":"ea903ff378d4469a8fef10a6e15f5036"
}
```
## **<a name="platformAssignment"> 分配交付商</a>**     
[返回到目录](#menu)     
**接口方式** HTTP
**HTTP方法** POST
**URI路径** '/web/invoice/invoiceCtl/platformAssignment'
**参数验证**
**参数**
| 参数名|数据类型|必须|默认| 说明 |
|---|:---:|:---:|:---:|---|
| id | string| 是 |  | 发票申请ID |
| nextStatus | string | 是 | 1030 | 发票状态 |
| merchantId | string | 是 |  | 购买方ID |
| delivererId | number | 是 |  | 交付商ID |
| delivererName | string | 是 |  | 交付商名称 |
| delivererAmount | string | 是 |  | 交付商分成 |
**示例**
```
{
"id":"11665033820002912",
"nextStatus": "1030",
"merchantId":"18asf854584",
"delivererId":"1536854655",
"delivererName":"国投迎新科技有限公司",
"delivererAmount":"1000"
}
```
**返回结果**
| 参数名|数据类型| 说明 |
|---|:---:|---|
| status | Number | 状态码 |
| msg | String | 提示信息 |
| data | JSON | 返回值 |
**示例**
```
{
"status":0,
"msg":"success",
"data":null,
"requestid":"3ea95f1837b9475da4a4d9aacc3ff74b"
}
```
## **<a name="delivererAssignment"> 交付商开具</a>**     
[返回到目录](#menu)     
**接口方式** HTTP
**HTTP方法** POST
**URI路径** /web/invoice/invoiceCtl/delivererAssignment
**参数验证**
**参数**
| 参数名|数据类型|必须|默认| 说明 |
|---|:---:|:---:|:---:|---|
| id | string| 是 |  | 发票申请ID |
| nextStatus | string | 是 | 1050 | 发票状态 |
| invoiceNo | string | 是 |  | 发票编号 |
| invoiceTime | number | 是 |  | 开具时间 |
| invoiceImg | string | 是 |  | 发票图片 |
**示例**
```
{
"id":"11665430003004143",
"nextStatus": "1050",
"invoiceNo":"gongsibao4584585",
"invoiceTime":"2019-10-12",
"invoiceImg":"www.baidu.com"
}
```
**返回结果**
| 参数名|数据类型| 说明 |
|---|:---:|---|
| status | Number | 状态码 |
| msg | String | 提示信息 |
| data | JSON | 返回值 |
**示例**
```
{
"status":0,
"msg":"success",
"data":null,
"requestid":"3ea95f1837b9475da4a4d9aacc3ff74b"
}
```
## **<a name="delivererAssignment"> 交付商提交审核</a>**     
[返回到目录](#menu)     
**接口方式** HTTP
**HTTP方法** POST
**URI路径** /web/invoice/invoiceCtl/delivererAssignment
**参数验证**
**参数**
| 参数名|数据类型|必须|默认| 说明 |
|---|:---:|:---:|:---:|---|
| id | string| 是 |  | 发票申请ID |
| nextStatus | string | 是 | 1060  | 发票状态 |
**示例**
```
{
"id":"11665033820002912",
"nextStatus": "1060",
}
```
**返回结果**
| 参数名|数据类型| 说明 |
|---|:---:|---|
| status | Number | 状态码 |
| msg | String | 提示信息 |
| data | JSON | 返回值 |
**示例**
```
{
"status":0,
"msg":"success",
"data":null,
"requestid":"3ea95f1837b9475da4a4d9aacc3ff74b"
}
```
## **<a name="platformAssignment"> 发票平台第二次审核</a>**     
[返回到目录](#menu)     
**接口方式** HTTP
**HTTP方法** POST
**URI路径** '/web/invoice/invoiceCtl/platformAssignment'
**参数验证**
**参数**
| 参数名|数据类型|必须|默认| 说明 |
|---|:---:|:---:|:---:|---|
| id | string| 是 |  | 发票申请ID |
| nextStatus | string | 是 | 1070 | 发票状态 |
| auditContent | string | 是 |  | 审核内容 |
| delivererContent | string | 是 |  | 交付内容 |
| mailAddr | string | 是 |  | 邮寄地址 |
| mailMobile | string | 是 |  | 邮寄电话 |
| mailTo | string | 是 |  | 邮寄人 |
**示例**
```
{
"id":"11665430003004143",
"nextStatus": "1070",
"auditContent":"审核内容信息",
"delivererContent":"交付商交付内容信息",
"mailAddr":"北京大望路",
"mailMobile":"010-65658565",
"mailTo":"杨庆菊"
}
```
**返回结果**
| 参数名|数据类型| 说明 |
|---|:---:|---|
| status | Number | 状态码 |
| msg | String | 提示信息 |
| data | JSON | 返回值 |
**示例**
```
{
"status":0,
"msg":"success",
"data":null,
"requestid":"3ea95f1837b9475da4a4d9aacc3ff74b"
}
```
## **<a name="delivererAssignment"> 交付商邮寄</a>**     
[返回到目录](#menu)     
**接口方式** HTTP
**HTTP方法** POST
**URI路径** /web/invoice/invoiceCtl/delivererAssignment
**参数验证**
**参数**
| 参数名|数据类型|必须|默认| 说明 |
|---|:---:|:---:|:---:|---|
| id | string| 是 |  | 发票申请ID |
| nextStatus | string | 是 | 1080  | 发票状态 |
| mailNo | string | 是 |  | 邮寄单号 |
**示例**
```
{
"id":"11665430003004143",
"nextStatus": "1080",
"mailNo":"JIDNUId625815"
}
```
**返回结果**
| 参数名|数据类型| 说明 |
|---|:---:|---|
| status | Number | 状态码 |
| msg | String | 提示信息 |
| data | JSON | 返回值 |
**示例**
```
{
"status":0,
"msg":"success",
"data":null,
"requestid":"3ea95f1837b9475da4a4d9aacc3ff74b"
}
```
## **<a name="platformAssignment"> 发票平台完成</a>**     
[返回到目录](#menu)     
**接口方式** HTTP
**HTTP方法** POST
**URI路径** /web/invoice/invoiceCtl/platformAssignment'
**参数验证**
**参数**
| 参数名|数据类型|必须|默认| 说明 |
|---|:---:|:---:|:---:|---|
| id | string| 是 |  | 发票申请ID |
| nextStatus | string | 是 | 1090 | 发票状态 |
**示例**
```
{
"id":"11665430003004143",
"nextStatus": "1090"
}
```
**返回结果**
| 参数名|数据类型| 说明 |
|---|:---:|---|
| status | Number | 状态码 |
| msg | String | 提示信息 |
| data | JSON | 返回值 |
**示例**
```
{
"status":0,
"msg":"success",
"data":null,
"requestid":"3ea95f1837b9475da4a4d9aacc3ff74b"
}
```
## **<a name="apiCancelInvoice"> 发票撤销</a>**     
[返回到目录](#menu)     
**接口方式** HTTP
**HTTP方法** POST
**URI路径** '/api/op/action/springboard
**参数验证**
**参数**
| 参数名|数据类型|必须|默认| 说明 |
|---|:---:|:---:|:---:|---|
| merchantId | string | 是 |  | 平台审核备注 |
| applyNo | number | 是 |  | 发票支付 必须写 1 请确认是否已经支付 |
**示例**
```
{
"action_process": "sijibao",
"action_type": "apiCancelInvoice",
"action_body": {
"merchantId":"11665033820002912",
"applyNo": "1020"
}
}
```
**返回结果**
| 参数名|数据类型| 说明 |
|---|:---:|---|
| status | Number | 状态码 |
| msg | String | 提示信息 |
| data | JSON | 返回值 |
## **<a name="txPayment"> 完税证明 </a>**     
[返回到目录](#menu)     
**接口方式** HTTP
**HTTP方法** POST
**URI路径** /web/invoice/invoiceCtl/txPayment
**参数验证**
**参数**
| 参数名|数据类型|必须|默认| 说明 |
|---|:---:|:---:|:---:|---|
| id | number | 是 |  | 发票ID |
| taxNo | number | 是 |  | 发票编号 |
| complateTax | string | 是 |  | 是否完税 |
| taxTime | string | 是 |  | 完税时间 |
| taxVoucher | string | 是 |  | 完税图片 |
**示例**
```
{
"id":"11665448190004592",
"taxNo": "DIE552SDKD",
"complateTax":1,
"taxTime":"2019-10-10",
"taxVoucher":"www.baidu.com"
}
```
**返回结果**
| 参数名|数据类型| 说明 |
|---|:---:|---|
| status | Number | 状态码 |
| msg | String | 提示信息 |
| data | JSON | 返回值 |
## **<a name="queryTxPayment"> 查看完税证明</a>**     
[返回到目录](#menu)     
**接口方式** HTTP
**HTTP方法** POST
**URI路径** '/api/op/action/springboard
**参数验证**
**参数**
| 参数名|数据类型|必须|默认| 说明 |
|---|:---:|:---:|:---:|---|
| id | string | 是 |  | 发票ID |
**示例**
```
{
"id":"11665033820002912"
}
```
**返回结果**
| 参数名|数据类型| 说明 |
|---|:---:|---|
| status | Number | 状态码 |
| msg | String | 提示信息 |
| data | JSON | 返回值 |
```
{
"status":0,
"msg":"操作成功",
"data":{
"invoiceTime":"2019-10-31 13:09:03",
"complateTax":"已完成",
"taxTime":"2019-10-10 08:00:00",
"createdAt":"2019-10-31 13:09:03",
"updatedAt":"2019-10-31 13:09:03",
"id":"11665448190004592",
"taxNo":"DIE552SDKD",
"taxVoucher":"www.baidu.com"
},
"bizmsg":"empty",
"requestid":"b00a9b2244504505bf1ef1bc36b6949e"
}
```
## **<a name="apiUpEmNo"> 平台更新邮寄号 </a>**     
[返回到目录](#menu)     
**接口方式** HTTP
**HTTP方法** POST
**URI路径** '/api/op/action/springboard
**参数验证**
**参数**
| 参数名|数据类型|必须|默认| 说明 |
|---|:---:|:---:|:---:|---|
| id | string | 是 |  | 发票ID |
| platformMailNo | string | 是 |  | 邮寄编号 |
**示例**
```
{
"id":"11665033820002912",
"platformMailNo":"545sre55sg"
}
```
**返回结果**
| 参数名|数据类型| 说明 |
|---|:---:|---|
| status | Number | 状态码 |
| msg | String | 提示信息 |
| data | JSON | 返回值 |
## **<a name="queryInvoices"> 发票列表(平台) </a>**     
[返回到目录](#menu)     
**接口方式** HTTP
**HTTP方法** POST
**URI路径** /web/invoice/invoiceCtl/queryInvoices
**参数验证**
**参数**
| 参数名|数据类型|必须|默认| 说明 |
|---|:---:|:---:|:---:|---|
| pageIndex | number | 否 | 1 | 当前页数 |
| pageSize | number | 否 | 10 | 每页记录数 |
| complateTax | string | 否 |  | 是否完税 |
| invoiceTime | string | 否 |  | 开发票时间 |
| applyNo | string | 否 |  | 发票申请编号 |
| inInvalid | string | 否 |  | 是否完税 |
| type | string | 否 |  | 发票类型 |
**示例**
```
{
"type":"10"
}
```
**返回结果**
| 参数名|数据类型| 说明 |
|---|:---:|---|
| status | Number | 状态码 |
| msg | String | 提示信息 |
| data | JSON | 返回值 |
**示例**
```
{
"status":0,
"msg":"操作成功",
"data":{
"count":3,
"rows":[
{
"invoiceTime":"2019-10-28 10:22:05",
"complateTax":"未完成",
"taxTime":"2019-10-28 10:22:05",
"createdAt":"2019-10-28 10:22:05",
"updatedAt":"2019-10-28 10:22:05",
"id":"11665258555003154",
"applyNo":"gongsibao001",
"merchantId":"18asf854584",
"status":"1030",
"invoiceNo":"",
"invoiceImg":null,
"taxNo":"",
"taxVoucher":null,
"mailNo":"",
"deletedAt":null,
"version":0,
"apply":{
"isInvalid":"红冲",
"createdAt":"2019-10-31 12:15:42",
"updatedAt":"2019-10-31 12:15:42",
"type":10,
"applyNo":"gongsibao001",
"merchantName":"腾讯信息科有限公司",
"businessName":"悦图遥感科技"
}
},
{
"invoiceTime":"2019-10-26 14:41:42",
"complateTax":"已完成",
"taxTime":"2019-10-10 08:00:00",
"createdAt":"2019-10-25 19:56:30",
"updatedAt":"2019-10-26 14:41:42",
"id":"11665033820002912",
"applyNo":"gongsibao001",
"merchantId":"18asf854584",
"status":"1080",
"invoiceNo":"gongsibao4584585",
"invoiceImg":"www.baidu.com",
"taxNo":"DIE552SDKD",
"taxVoucher":null,
"mailNo":"JIDNUId625815",
"deletedAt":null,
"version":0,
"apply":{
"isInvalid":"未红冲",
"createdAt":"2019-10-31 12:15:42",
"updatedAt":"2019-10-31 12:15:42",
"type":10,
"applyNo":"gongsibao001",
"merchantName":"腾讯信息科有限公司",
"businessName":"网易信息科技"
}
},
{
"invoiceTime":"2019-10-25 17:38:48",
"complateTax":"未完成",
"taxTime":"2019-10-25 17:36:36",
"createdAt":"2019-10-25 17:36:36",
"updatedAt":"2019-10-25 17:38:48",
"id":"11665025426002758",
"applyNo":"zjietiaodong999",
"merchantId":"11064622752480998",
"status":"1030",
"invoiceNo":"",
"invoiceImg":null,
"taxNo":"",
"taxVoucher":null,
"mailNo":"",
"deletedAt":null,
"version":0,
"apply":{
"isInvalid":"红冲",
"createdAt":"2019-10-31 12:15:42",
"updatedAt":"2019-10-31 12:15:42",
"type":10,
"applyNo":"zjietiaodong999",
"merchantName":"网易科技",
"businessName":"zijietiaodongmingcheng"
}
}
]
},
"bizmsg":"empty",
"requestid":"8296ad60d1bc46b8a73f7405f2861aec"
}
```
## **<a name="queryInvoices"> 发票申请列表(平台) </a>**     
[返回到目录](#menu)     
**接口方式** HTTP
**HTTP方法** POST
**URI路径** /web/invoice/invoiceCtl/queryInvoices
**参数验证**
**参数**
| 参数名|数据类型|必须|默认| 说明 |
|---|:---:|:---:|:---:|---|
| pageIndex | number | 否 | 1 | 当前页数 |
| pageSize | number | 否 | 10 | 每页记录数 |
| invoiceTime | string | 是 |  | 开发票时间 |
| applyNo | string | 是 |  | 发票申请编号 |
| type | string | 是 |  | 发票类型 |
| status | string | 是 |  | 发票状态 |
**示例**
```
{
"type":"10"
}
```
**返回结果**
| 参数名|数据类型| 说明 |
|---|:---:|---|
| status | Number | 状态码 |
| msg | String | 提示信息 |
| data | JSON | 返回值 |
**示例**
```
{
"status":0,
"msg":"操作成功",
"data":{
"count":3,
"rows":[
{
"invoiceTime":"2019-10-28 10:22:05",
"complateTax":"未完成",
"taxTime":"2019-10-28 10:22:05",
"createdAt":"2019-10-28 10:22:05",
"updatedAt":"2019-10-28 10:22:05",
"id":"11665258555003154",
"applyNo":"gongsibao001",
"merchantId":"18asf854584",
"status":"1030",
"invoiceNo":"",
"invoiceImg":null,
"taxNo":"",
"taxVoucher":null,
"mailNo":"",
"deletedAt":null,
"version":0,
"apply":{
"isInvalid":"红冲",
"createdAt":"2019-10-31 12:15:42",
"updatedAt":"2019-10-31 12:15:42",
"type":10,
"applyNo":"gongsibao001",
"merchantName":"腾讯信息科有限公司",
"businessName":"悦图遥感科技"
}
},
{
"invoiceTime":"2019-10-26 14:41:42",
"complateTax":"已完成",
"taxTime":"2019-10-10 08:00:00",
"createdAt":"2019-10-25 19:56:30",
"updatedAt":"2019-10-26 14:41:42",
"id":"11665033820002912",
"applyNo":"gongsibao001",
"merchantId":"18asf854584",
"status":"1080",
"invoiceNo":"gongsibao4584585",
"invoiceImg":"www.baidu.com",
"taxNo":"DIE552SDKD",
"taxVoucher":null,
"mailNo":"JIDNUId625815",
"deletedAt":null,
"version":0,
"apply":{
"isInvalid":"未红冲",
"createdAt":"2019-10-31 12:15:42",
"updatedAt":"2019-10-31 12:15:42",
"type":10,
"applyNo":"gongsibao001",
"merchantName":"腾讯信息科有限公司",
"businessName":"网易信息科技"
}
},
{
"invoiceTime":"2019-10-25 17:38:48",
"complateTax":"未完成",
"taxTime":"2019-10-25 17:36:36",
"createdAt":"2019-10-25 17:36:36",
"updatedAt":"2019-10-25 17:38:48",
"id":"11665025426002758",
"applyNo":"zjietiaodong999",
"merchantId":"11064622752480998",
"status":"1030",
"invoiceNo":"",
"invoiceImg":null,
"taxNo":"",
"taxVoucher":null,
"mailNo":"",
"deletedAt":null,
"version":0,
"apply":{
"isInvalid":"红冲",
"createdAt":"2019-10-31 12:15:42",
"updatedAt":"2019-10-31 12:15:42",
"type":10,
"applyNo":"zjietiaodong999",
"merchantName":"网易科技",
"businessName":"zijietiaodongmingcheng"
}
}
]
},
"bizmsg":"empty",
"requestid":"8296ad60d1bc46b8a73f7405f2861aec"
}
```
## **<a name="delivererInvoices"> 发票列表(交付商) </a>**     
[返回到目录](#menu)     
**接口方式** HTTP
**HTTP方法** POST
**URI路径** /web/invoice/invoiceCtl/delivererInvoices
**参数验证**
**参数**
| 参数名|数据类型|必须|默认| 说明 |
|---|:---:|:---:|:---:|---|
| pageIndex | number | 否 | 1 | 当前页数 |
| pageSize | number | 否 | 10 | 每页记录数 |
| complateTax | string | 否 |  | 是否完税 |
| invoiceTime | string | 否 |  | 开发票时间 |
| applyNo | string | 否 |  | 发票申请编号 |
| inInvalid | string | 否 |  | 是否完税 |
| type | string | 否 |  | 发票类型 |
**示例**
```
{
"type":"10"
}
```
**返回结果**
| 参数名|数据类型| 说明 |
|---|:---:|---|
| status | Number | 状态码 |
| msg | String | 提示信息 |
| data | JSON | 返回值 |
**示例**
{
"status":0,
"msg":"操作成功",
"data":{
"count":2,
"rows":[
{
"applyNo":"gongsibao-futong001",
"invoiceId":"11665448190004592",
"breakReason":null,
"apply":{
"merchantId":"11064622752480055",
"merchantName":"司机宝",
"type":"增值税专用发票",
"invoiceAmount":400000000,
"invoiceTime":"2019-10-19",
"businessName":"北京富通勤国际贸易有限责任公司(个体工商)"
},
"invoice":{
"invoiceNo":"gongsibao4584585",
"status":"1060",
"statusName":"待审核"
}
},
{
"applyNo":"gongsibao-futong001",
"invoiceId":"11665448190004592",
"breakReason":"业务繁忙",
"apply":{
"merchantId":"11064622752480055",
"merchantName":"司机宝",
"type":"增值税专用发票",
"invoiceAmount":400000000,
"invoiceTime":"2019-10-19",
"businessName":"北京富通勤国际贸易有限责任公司(个体工商)"
},
"invoice":{
"invoiceNo":"gongsibao4584585",
"status":"1060",
"statusName":"待审核"
}
}
]
},
"bizmsg":"empty",
"requestid":"21da505b34d7423fbbb8865d64f652a5"
}
```
\ No newline at end of file
......@@ -40,6 +40,7 @@
"statusName": "待审核", // 充值状态名称
"remark": "", // 审核备注
"auditUserName": null, // 审核人姓名
"auditTime": "2019-10-05 05:26:25", // 审核时间
"created_at": "2019-10-05 05:26:25", // 创建时间
"created_at": "2019-10-01 09:33:05", // 创建时间
},
......
<a name="menu">目录</a>
1. [办理列表](#handlePage)
1. [查看详情](#deliverInfo)
1. [编辑](#deliverEdit)
1. [订单关闭](#deliverClose)
1. [创建进度](#deliverHandle)
## **<a name="handlePage"> 订单办理 </a>**
[返回到目录](#menu)
##### URL
[/web/order/orderCtl/handlePage]
#### 参数格式 `JSON`
#### HTTP请求方式 `POST`
``` javascript
{
"merchant_id": 110361384474, // 商户id
"orderNo": "", // 订单号
"channelOrderNo": "", // 渠道订单号
"createdBegin": "", //
"createdEnd": "",
"status": ""
}
```
#### 返回结果
```javascript
{
"status": 0,
"msg": "success",
"data": {
"count": 18,
"rows": [
{
"id": "12115022197000259", // 订单办理id
"order_id": "13180527760002418", // 订单号
"status": "1030", // 业务状态
"statusName": "待处理", // 业务状态名称
"nextStatus": "1030", // 下一业务状态
"nextStatusName": "待处理", // 下一业务状态名称
"deliver_id": "13120681466000118", // 交付商id
"deliverName": "杨庆菊交付商222", // 交付商名称
"deliverDivide": 2220000, // 交付商分成金额
"breakReason": null,
"created_at": "2019-10-23 10:47:33",
"auditRemark": null, // 审核备注
"content": null, // 交付内容
"addressee": null, // 收件人
"mobile": null, // 联系电话
"addr": null, // 邮寄地址
"auditResult": "", // 审核状态
"order": {
"id": "13180527760002418",
"legalName": "杨庆菊",
"legalMobile": "杨庆菊手机号",
"price": 3000
}
},
]
},
"requestid": "8470ee30a2f14b01987828d2c614684c"
}
```
## **<a name="deliverInfo"> 查看详情 </a>**
[返回到目录](#menu)
##### URL
[/web/order/orderCtl/deliverInfo]
#### 参数格式 `JSON`
#### HTTP请求方式 `POST`
``` javascript
{
"id": "13180527789003380", // 订单号
}
```
#### 返回结果
```javascript
{
"status": 0,
"msg": "success",
"data": {
"id": "13180527789003380", // 订单号\订单号
"merchant_id": "11064622752480048", // 商户id
"channelOrderNo": "xxxxxxxxx111", // 渠道订单号
"price": 300000, // 订单价格(分)
"legalName": "杨庆菊", // 法人姓名
"legalMobile": "杨庆菊手机号", // 法人手机号
"legalImg": "法人照片", // 法人照片
"idcard": "123身份证", // 身份证号码
"idcardFront": "在正面", // 身份证正面图
"idcardBack": "反面", // 身份证反面图
"bankNo": "2222", // 银行卡号
"bank": "开户行", // 开户行
"bankImg": "这是银行卡照片", // 银行卡照片
"names": "名称1,名称2,名称3", // 2~3个注册名称,逗号分割
"domicile_id":"" // 注册地id
"domicileName":"" // 注册地名称
"businessScope_id": "12218127596000645", // 经营范围id
"businessType": "物流信息类", // 经营范围
"businessScope": "国内物流信息服务;装", // 经营范围详情
"capital": "到底是多少", // 注册资本
"statusName": "未付款", // 订单状态名称
"status": "1000", // 订单状态
"ostatusName": "待处理", // 业务进度状态名称
"ostatus": "1030", // 业务进度状态
"assignTime": null, // 分配时间
"assignUcname": "吴经理", // 分配人
"created_at": "2019-10-05 06:57:28", // 创建时间
"deliverType": "", // 交付类型 10交付商交付 20平台交付 30平台保存无需交付
"deliverTypeName": "", // 交付类型名称
"deliverNo": "", // 快递单号
"deliverImg": "", // 交接单
"deliver": { // 交付商
"statusName": "待处理" // 办理状态名称
"status": "1020", // 办理状态
"deliverName": "开封交付商", // 交付商名称
"deliverDivide": 3311, // 交付商分成比例
"auditRemark": null, // 审核备注
"content": null, // 交付内容
"addressee": null, // 收件人
"mobile": null, // 联系电话
"addr": null, // 邮寄地址
"auditResult": "", // 审核状态
},
"businessmen": {
"orderNo": "" // 订单号
"channelOrderNo": "" // 渠道订单号
"bstatus": "2020", // 业务状态
"bstatusName": "已完成", // 业务状态名称
"gstatus": "2020", // 客户看到的业务状态
"gstatusName": "已完成", // 客户看到的业务状态名号曾
"dstatus": "2020", // 交付商看到的状态
"dstatusName": "已完成" // 交付商看到的状态名称
"legalName": "" // 法人姓名
"legalMobile": "" // 法人电话
"name": "" // 个体工商户名称
"creditCode": "" // 统一社会信用代码
"businessPlace": "" // 经营场所
"businessScope": "" // 经营范围
"regDate": "" // 注册日期
"businessImg": "" // 执照照片
"gongzhang": "" // 公章
"caiwuzhang": "" // 财务章
"fapiaozhang": "" // 发票章
"hetongzhang": "" // 合同章
"farenzhang": "" // 法人章
"isBank": "" // 是否开户
"bankName": "" // 账户名称
"bankNo": "" // 账户号
"bank": "" // 开户行
"bankImg": "" // 账户信息
"caImg": "" // CA照片
"taxRegDay": "" // 税务登记日
"taxOrg": "" // 税务机构名称
"courierNo": "" // 快递单号
"courierImg": "" // 快递交接单图片
"addedValueRate": "" // 增值税率
"supertaxRate": "" // 附加税率
"commonTaxLadder": "" // 普票个税阶梯
"commonOtherLadder": "" // 普票增值税、附加税阶梯
"specialTaxLadder": "" // 专票个税阶梯
"specialOtherLadder": "" // 专票增值税、附加税阶梯
"contract": "" // 个体户合同
"contractStartData": "" // 合同开始时间
"contractEndData": "" // 合同结束时间
"notes": "" // 备注
"opNotes": "" // 操作备注
"created_at": "", // 创建时间
"taxUpType": "1", // 个税累计类型 1按月累计 2按年累计
"addValueUpType": "1", // 增值税累计类型 1按月 2按季度
"costRate": 11.22, // 核定成本费用率
"taxRate": 3.20, // 含税价百分比
"serviceRate": 1.25, // 服务费比例
"signNotes": null, // 签约备注
"signTime": null, // 签约时间
}
},
}
```
## **<a name="deliverEdit"> 编辑 </a>**
[返回到目录](#menu)
##### URL
[/web/order/orderCtl/deliverEdit]
#### 参数格式 `JSON`
#### HTTP请求方式 `POST`
``` javascript
{
// 订单对象
"order": {
"id": "13180527789003380", // 订单id\订单号
"legalName": "杨庆菊", // 法人姓名
"idcard": "123身份证", // 身份证号码
"legalMobile": "杨庆菊手机号", // 法人手机号
"bankNo": "2222", // 银行卡号
"capital": "到底是多少", // 注册资本
"names": "山驴比1,山驴比2,山驴比3", // 2~3个个体工商户名称
"businessType": "太难了", // 经营范围
"businessScope": "太狠了", // 经营范围详情
"idcardFront": "在正面", // 身份证正面图
"idcardBack": "反面", // 身份证反面图
},
// 个体工商户信息
"businessmen": {
"id": "12795594625000138", // 个体户id
// 个体工商户执照信息
"name": "杨庆菊有限公司", // 个体户名称
"creditCode": "xxxxxx333333333", // 统一社会信用代码
"businessPlace": "来广营地铁站", // 经营场所
"legalName": "杨庆菊", // 法人姓名
"legalMobile": "杨庆菊手机号", // 法人手机号
"legalIdcard": "2222222222", // 法人身份证号
"regDate": "2019-01-22", // 注册日期
"businessScope": "1,2,3,4,5,", // 经营范围
"businessImg": "http:1.png", // 执照照片
// 个体工商户刻章信息
"gongzhang": "http://gongzhang.png", // 公章
"caiwuzhang": "http://caiwuzhang.png", // 财务章
"fapiaozhang": "http://fapiaozhang.png", // 发票章
"hetongzhang": "http://hetongzhang.png", // 合同章
"farenzhang": "http://farenzhang.png", // 法人章
// 个体户开户信息
"isBank": 1, // 是否开户 0否 1是
"bankName": "https://bankName", // 账户名称
"bankNo": "https://bankNo", // 帐号
"bank": "https://bank", // 开户行
"bankImg": "https://bankImg", // 账户图片
// 税务报道信息
"caImg": "12313212", // CA照片
"taxRegDay": "2019-01-01", // 税务登记日
"taxOrg": "12333", // 税务机构名称
// 邮寄信息
"courierNo": "111111111", // 快递单号
"courierImg": "快递交接图片", // 快递交接图片
}
}
```
#### 返回结果
```javascript
{
"status": 0,
"msg": "success",
"data": null
}
```
## **<a name="deliverClose"> 订单关闭 </a>**
[返回到目录](#menu)
##### URL
[/web/order/orderCtl/deliverClose]
#### 参数格式 `JSON`
#### HTTP请求方式 `POST`
``` javascript
{
"id": "12115175152000322", // 订单办理id
"breakReason": "qiqibaba" // 关闭原因
}
```
#### 返回结果
```javascript
{
"status": 0,
"msg": "success",
"data": null
}
```
## **<a name="deliverHandle"> 创建进度 </a>**
[返回到目录](#menu)
##### URL
[/web/order/orderCtl/deliverHandle]
#### 参数格式 `JSON`
#### HTTP请求方式 `POST`
``` javascript
// ※※※ 当status == 1120 || status == 1140时,显示为提交审核按钮, 接口还用这个,只传id和status:1030
{
// 公共变量,所有情况都需要传
"id": "1", // 订单办理id
"status": "1010", // 订单状态
// 出执照
"name": "杨庆菊有限公司", // 个体工商户名称
"creditCode": "xxxxxx333333333", // 社会统一信用代码
"businessPlace": "来广营地铁站", // 经营场所
"businessScope": "1,2,3,4,5,", // 经营范围
"regDate": "2019-01-22", // 注册时间
"businessImg": "http:1.png" // 执照照片
// 刻章办理
"gongzhang": "http://gongzhang.png", // 公章
"caiwuzhang": "http://caiwuzhang.png", // 财务章
"fapiaozhang": "http://fapiaozhang.png", // 发票章
"hetongzhang": "http://hetongzhang.png", // 合同章
"farenzhang": "http://farenzhang.png" // 法人章
// 银行开户
"isBank":"1", // 是否开户 0否 1是
"bankName":"https://bankName", // 账户名称
"bankNo":"https://bankNo", // 账户号
"bank":"https://bank", // 开户行
"bankImg":"https://bankImg", // 账户信息
// 税务报到
"caImg": "12313212", // CA认证图
"taxRegDay": "2019-01-01", // 税务登记日
"taxOrg": "12333" // 税务机构名称
// 已邮寄
"courierNo": "111111111" // 快递单号
"courierImg": "快递交接图片" // courierImg
}
```
#### 返回结果
```javascript
{
"status": 0,
"msg": "success",
"data": null
}
```
<a name="menu">目录</a>
1. [全部订单](#orderList)
1. [订单关闭](#close)
1. [订单分配](#assign)
1. [查看详情](#orderInfo)
1. [编辑](#orderEdit)
1. [交付审核](#deliverAudit)
1. [订单完成](#orderComplete)
## **<a name="orderList"> 全部订单 </a>**
[返回到目录](#menu)
##### URL
[/web/order/orderCtl/allPage]
#### 参数格式 `JSON`
#### HTTP请求方式 `POST`
``` javascript
{
"merchant_id": 110361384474, // 商户id
"orderNo": "", // 订单号
"createdBegin": "", // 创建时间
"createdEnd": "",
"assignBegin": "", // 分配时间
"assignEnd": "",
"status": ""
}
```
#### 返回结果
```javascript
{
"status": 0,
"msg": "success",
"data": {
"count": 4,
"rows": [
{
"id": "13180527789003380", // 订单号\订单号
"merchant_id": "11064622752480048", // 商户id
"channelOrderNo": "xxxxxxxxx111", // 渠道订单号
"price": 300000, // 订单价格(分)
"legalName": "杨庆菊", // 法人姓名
"legalMobile": "杨庆菊手机号", // 法人手机号
"legalImg": "法人照片", // 法人照片
"idcard": "123身份证", // 身份证号码
"idcardFront": "在正面", // 身份证正面图
"idcardBack": "反面", // 身份证反面图
"bankNo": "2222", // 银行卡号
"bank": "开户行", // 开户行
"bankImg": "这是银行卡照片", // 银行卡照片
"names": "名称1,名称2,名称3", // 2~3个注册名称,逗号分割
"domicile_id":"" // 注册地id
"domicileName":"" // 注册地名称
"businessScope_id": "12218127596000645", // 经营范围id
"businessType": "物流信息类", // 经营范围
"businessScope": "国内物流信息服务;装", // 经营范围详情
"capital": "到底是多少", // 注册资本
"statusName": "未付款", // 订单状态名称
"status": "1000", // 订单状态
"ostatusName": "待处理", // 业务进度状态名称
"ostatus": "1030", // 业务进度状态
"assignTime": null, // 分配时间
"assignUcname": "吴经理", // 分配人
"created_at": "2019-10-05 06:57:28", // 创建时间
"deliverType": "", // 交付类型 10交付商交付 20平台交付 30平台保存无需交付
"deliverTypeName": "", // 交付类型名称
"deliverNo": "", // 快递单号
"deliverImg": "", // 交接单
"deliver": { // 交付商
"statusName": "待处理" // 办理状态名称
"status": "1020", // 办理状态
"deliverName": "开封交付商", // 交付商名称
"deliverDivide": 3311, // 交付商分成比例
"auditRemark": null, // 审核备注
"content": null, // 交付内容
"addressee": null, // 收件人
"mobile": null, // 联系电话
"addr": null, // 邮寄地址
"auditResult": "", // 审核状态
}
"merchant": { // 商户对象
"id": "11064622752480055", // 商户id
"name": "司机宝" // 商户名号曾
}
},
]
}
}
```
## **<a name="close"> 订单关闭 </a>**
[返回到目录](#menu)
##### URL
[/web/order/orderCtl/close]
#### 参数格式 `JSON`
#### HTTP请求方式 `POST`
``` javascript
{
"id": 110361384474, // 商户id
}
```
#### 返回结果
```javascript
{
"status": 0,
"msg": "success",
"data": null
}
```
## **<a name="assign"> 订单分配 </a>**
[返回到目录](#menu)
##### URL
[/web/order/orderCtl/assign]
#### 参数格式 `JSON`
#### HTTP请求方式 `POST`
``` javascript
{
"id": 110361384474, // 商户id
"deliverId": "", // 交付商id
"deliverName": "", // 交付商名称
"orderDeliver": 500, // 交付商分成金额
}
```
#### 返回结果
```javascript
{
"status": 0,
"msg": "success",
"data": null
}
```
## **<a name="orderEdit"> 订单编辑 </a>**
[返回到目录](#menu)
##### URL
[/web/order/orderCtl/orderEdit]
#### 参数格式 `JSON`
#### HTTP请求方式 `POST`
``` javascript
{
"id": "13180527789003380", // 订单id
"merchantId": "11064622752480055", // 商户id
"price": 2600.72 // 订单价格
}
```
#### 返回结果
```javascript
{
"status": 0,
"msg": "success",
"data": null
}
```
## **<a name="orderInfo"> 查看详情 </a>**
[返回到目录](#menu)
##### URL
[/web/order/orderCtl/allInfo]
#### 参数格式 `JSON`
#### HTTP请求方式 `POST`
``` javascript
{
"id": "13180527789003380", // 订单id
}
```
#### 返回结果
```javascript
{
"status": 0,
"msg": "success",
"data": {
"id": "13180527789003380", // 订单号\订单号
"merchant_id": "11064622752480048", // 商户id
"channelOrderNo": "xxxxxxxxx111", // 渠道订单号
"price": 300000, // 订单价格(分)
"legalName": "杨庆菊", // 法人姓名
"legalMobile": "杨庆菊手机号", // 法人手机号
"legalImg": "法人照片", // 法人照片
"idcard": "123身份证", // 身份证号码
"idcardFront": "在正面", // 身份证正面图
"idcardBack": "反面", // 身份证反面图
"bankNo": "2222", // 银行卡号
"bank": "开户行", // 开户行
"bankImg": "这是银行卡照片", // 银行卡照片
"names": "名称1,名称2,名称3", // 2~3个注册名称,逗号分割
"domicile_id":"" // 注册地id
"domicileName":"" // 注册地名称
"businessScope_id": "12218127596000645", // 经营范围id
"businessType": "物流信息类", // 经营范围
"businessScope": "国内物流信息服务;装", // 经营范围详情
"capital": "到底是多少", // 注册资本
"statusName": "未付款", // 订单状态名称
"status": "1000", // 订单状态
"ostatusName": "待处理", // 业务进度状态名称
"ostatus": "1030", // 业务进度状态
"assignTime": null, // 分配时间
"assignUcname": "吴经理", // 分配人
"created_at": "2019-10-05 06:57:28", // 创建时间
"deliverType": "", // 交付类型 10交付商交付 20平台交付 30平台保存无需交付
"deliverTypeName": "", // 交付类型名称
"deliverNo": "", // 快递单号
"deliverImg": "", // 交接单
"deliver": { // 交付商
"statusName": "待处理" // 办理状态名称
"status": "1020", // 办理状态
"deliverName": "开封交付商", // 交付商名称
"deliverDivide": 3311, // 交付商分成比例
"auditRemark": null, // 审核备注
"content": null, // 交付内容
"addressee": null, // 收件人
"mobile": null, // 联系电话
"addr": null, // 邮寄地址
"auditResult": "", // 审核状态
},
"businessmen": {
"orderNo": "" // 订单号
"channelOrderNo": "" // 渠道订单号
"bstatus": "2020", // 业务状态
"bstatusName": "已完成", // 业务状态名称
"gstatus": "2020", // 客户看到的业务状态
"gstatusName": "已完成", // 客户看到的业务状态名号曾
"dstatus": "2020", // 交付商看到的状态
"dstatusName": "已完成" // 交付商看到的状态名称
"legalName": "" // 法人姓名
"legalMobile": "" // 法人电话
"name": "" // 个体工商户名称
"creditCode": "" // 统一社会信用代码
"businessPlace": "" // 经营场所
"businessScope": "" // 经营范围
"regDate": "" // 注册日期
"businessImg": "" // 执照照片
"gongzhang": "" // 公章
"caiwuzhang": "" // 财务章
"fapiaozhang": "" // 发票章
"hetongzhang": "" // 合同章
"farenzhang": "" // 法人章
"isBank": "" // 是否开户
"bankName": "" // 账户名称
"bankNo": "" // 账户号
"bank": "" // 开户行
"bankImg": "" // 账户信息
"caImg": "" // CA照片
"taxRegDay": "" // 税务登记日
"taxOrg": "" // 税务机构名称
"courierNo": "" // 快递单号
"courierImg": "" // 快递交接单图片
"addedValueRate": "" // 增值税率
"supertaxRate": "" // 附加税率
"commonTaxLadder": "" // 普票个税阶梯
"commonOtherLadder": "" // 普票增值税、附加税阶梯
"specialTaxLadder": "" // 专票个税阶梯
"specialOtherLadder": "" // 专票增值税、附加税阶梯
"contract": "" // 个体户合同
"contractStartData": "" // 合同开始时间
"contractEndData": "" // 合同结束时间
"notes": "" // 备注
"opNotes": "" // 操作备注
"created_at": "", // 创建时间
"taxUpType": "1", // 个税累计类型 1按月累计 2按年累计
"addValueUpType": "1", // 增值税累计类型 1按月 2按季度
"costRate": 11.22, // 核定成本费用率
"taxRate": 3.20, // 含税价百分比
"serviceRate": 1.25, // 服务费比例
"signNotes": null, // 签约备注
"signTime": null, // 签约时间
}
},
}
```
## **<a name="deliverAudit"> 交付审核 </a>**
[返回到目录](#menu)
##### URL
[/web/order/orderCtl/deliverAudit]
#### 参数格式 `JSON`
#### HTTP请求方式 `POST`
#### ※※※ 1140审核失败 1150审核成功
``` javascript
{
"id" : "12115182819000593", // 注意 订单办理id,deliver对象中的id,或者order对象中的orderDeliverId
"status" : "1140", // 1140审核失败 1150审核成功
"auditRemark" : "边1去", // 审核备注
"content" : "靠靠靠2", // 交付内容
"addressee" : "李庆菊", // 收件人
"mobile" : "131222266663", // 联系电话
"addr" : "国创产业园4", // 联系地址
}
```
#### 返回结果
```javascript
{
"status": 0,
"msg": "success",
"data": null
}
```
## **<a name="orderComplete"> 订单完成 </a>**
[返回到目录](#menu)
##### URL
[/web/order/orderCtl/orderComplete]
#### 参数格式 `JSON`
#### HTTP请求方式 `POST`
#### ※※※ 1140审核失败 1150审核成功
``` javascript
{
"id":"13180527754002366", // 订单id
"deliverType":"20", // 交付类型
"deliverNo":"xxooxxoo", // 快递单号
"deliverImg":"https://g" // 交接单
}
```
#### 返回结果
```javascript
{
"status": 0,
"msg": "success",
"data": null
}
```
{
"name": "xgg-pc",
"name": "bigdata",
"version": "1.0.0",
"lockfileVersion": 1,
"requires": true,
......
{
"name": "xgg-pc",
"name": "bigdata",
"version": "1.0.0",
"description": "h5framework",
"main": "main.js",
......
var system = require("../../../system")
var settings = require("../../../../config/settings");
const CtlBase = require("../../ctlms.base");
var cacheBaseComp = null;
class InvoiceCtl extends CtlBase {
constructor() {
super();
this.invoiceSve = system.getObject("service.invoice.invoiceSve");
}
//获取所有发票信息 (条件分页)
async invoices(pobj, pobj2, req){
try {
pobj.uid = req.loginUser.ucid;
return await this.invoiceSve.invoices(pobj);
} catch (error) {
return system.getResultFail(500, "接口错误");
}
}
//创建发票(批量创建)
async create(pobj, pobj2, req){
try {
var invoices = pobj.invoices || [];
if(invoices.length == 0) {
return system.getResult(null, "请至少填写一条发票信息");
}
var list = [];
for(var invoice of invoices) {
var obj = {};
obj.merchantId = this.trim(invoice.merchant_id);
obj.uid = req.loginUser.ucid;
obj.type = this.trim(invoice.type);
obj.taxNo = this.trim(invoice.taxNo);
obj.purchaserName = this.trim(invoice.purchaserName);
obj.purPhoneAddr = this.trim(invoice.purPhoneAddr);
obj.purBankAcc = this.trim(invoice.purBankAcc);
obj.amount = this.trim(invoice.amount);
obj.statementsUrl = this.trim(invoice.statementsUrl);
obj.contractUrl = this.trim(invoice.contractUrl);
obj.mailAddr = this.trim(invoice.mailAddr);
obj.mailTo = this.trim(invoice.mailTo);
obj.mailMobile = this.trim(invoice.mailMobile);
obj.isPay = 0;
obj.status = 1;
obj.merchantCode = this.trim(invoice.creditCode);
obj.merchantName = this.trim(invoice.name );
obj.corporations = this.trim(invoice.legalName);
obj.identityCode = this.trim(invoice.legalIdcard);
obj.bank = invoice.isBank ? 1 : 0;
list.push(obj);
}
return await this.invoiceSve.create(list);
} catch (error) {
console.log(error);
return system.getResultFail(500, "接口错误");
}
}
//更新发票
async update(params){
try {
return await this.invoiceSve.update(params);
} catch (error) {
return system.getResultFail(500, "接口错误");
}
}
}
module.exports = InvoiceCtl;
\ No newline at end of file
var system = require("../../../system")
const http = require("http")
const querystring = require('querystring');
var settings = require("../../../../config/settings");
const CtlBase = require("../../ctlms.base");
var cacheBaseComp = null;
class OrderCtl extends CtlBase {
constructor() {
super();
this.redisClient = system.getObject("util.redisClient");
this.orderSve = system.getObject("service.order.orderSve");
}
async add(pobj, pobj2, req) {
var loginUser = req.loginUser;
var order = {};
order.merchantId = "";
order.channelOrderNo = await this.redisClient.genrateId("channelOrderNo");
order.names = this.trim(pobj.names);
order.domicile_id = this.trim(pobj.domicile_id);
order.domicileName = this.trim(pobj.domicileName);
order.businessScope_id = this.trim(pobj.businessScope_id);
order.businessType = this.trim(pobj.businessType);
order.businessScope = this.trim(pobj.businessScope);
order.legalName = this.trim(pobj.legalName);
order.legalMobile = this.trim(pobj.legalMobile);
order.legalImg = this.trim(pobj.legalImg);
order.idcard = this.trim(pobj.idcard);
order.idcardFront = this.trim(pobj.idcardFront);
order.idcardBack = this.trim(pobj.idcardBack);
order.userId = this.trim(loginUser.ucid);
order.mailAddr = this.trim(pobj.mailAddr);
order.mailTo = this.trim(pobj.mailTo);
order.mailMobile = this.trim(pobj.mailMobile);
// order.bankNo = this.trim(pobj.bankNo);
// order.bank = this.trim(pobj.bank);
// order.bankImg = this.trim(pobj.bankImg);
// order.capital = this.trim(pobj.capital);
order.price = system.y2f(Number(pobj.price || 2300));
try {
return await this.orderSve.add(order);
} catch (e) {
console.log(e);
return system.getResultFail(500, "接口错误");
}
}
async myPage(pobj, pobj2, req) {
try {
var condition = {
currentPage: pobj.currentPage,
pageSize: pobj.pageSize,
userId: req.loginUser.ucid,
createdBegin: pobj.createdBegin,
createdEnd: pobj.createdEnd,
}
this.doTimeCondition(condition, ["createdBegin", "createdEnd"]);
return await this.orderSve.myPage(condition);
} catch (error) {
console.log(error);
return system.getResultFail(500, "接口异常:" + error.message);
}
}
async info(pobj, pobj2, req) {
try {
var condition = {
id: pobj.id,
}
return await this.orderSve.info(condition);
} catch (error) {
console.log(error);
return system.getResultFail(500, "接口异常:" + error.message);
}
}
async createStep(pobj, pobj2, req) {
var id = Number(pobj.orderId);
var status = pobj.status;
try {
switch (status) {
case "05": //"执照办理中"
case "15": //"刻章办理中"
case "25": //"银行开户中"
case "35": //"税务报到中"
return await this.service.changeStatus(id, status);
case "10": { //"已出执照"
var params = {
orderId: pobj.orderId,
name: this.trim(pobj.name), // 个体工商户名称
creditCode: this.trim(pobj.creditCode), // 统一社会信用代码
businessPlace: this.trim(pobj.businessPlace), // 经营场所
businessScope: this.trim(pobj.businessScope), // 经营范围
regDate: this.trim(pobj.regDate), // 注册日期
businessImg: this.trim(pobj.businessImg), // 执照照片
};
return await this.service.createLicense(pobj);
}
case "20": { //"已刻章"
var params = {
orderId: pobj.orderId,
gongzhang: this.trim(pobj.gongzhang),
caiwuzhang: this.trim(pobj.caiwuzhang),
businessImg: this.trim(pobj.businessImg),
fapiaozhang: this.trim(pobj.fapiaozhang),
hetongzhang: this.trim(pobj.hetongzhang),
farenzhang: this.trim(pobj.farenzhang),
};
return await this.businessmenSve.putSealInfo(params);
}
case "30": { //"银行已开户"
var params = {
orderId: pobj.orderId,
isBank: Number(pobj.isBank) == 1,
bankName: this.trim(pobj.bankName),
bankNo: this.trim(pobj.bankNo),
bank: this.trim(pobj.bank),
bankImg: this.trim(pobj.bankImg),
}
return await this.businessmenSve.putBankInfo(params);
}
case "40": { //"已税务报到"
var params = {
orderId: pobj.orderId,
caImg: this.trim(pobj.caImg),
taxRegDay: this.trim(pobj.taxRegDay),
taxOrg: this.trim(pobj.taxOrg),
}
return await this.businessmenSve.putTaxInfo(params);
}
case "50": { //"已邮寄"
var params = {
orderId: pobj.orderId,
courierNo: this.trim(pobj.courierNo),
courierImg: this.trim(pobj.courierImg),
}
return await this.businessmenSve.putExpressInfo(params);
}
default: {
return system.getResult(null, "状态错误");
}
}
} catch (error) {
console.log(error);
return system.getResultFail(500, "接口异常:" + error.message);
}
}
}
module.exports = OrderCtl;
\ No newline at end of file
var system = require("../../../system")
const http = require("http")
const querystring = require('querystring');
var settings = require("../../../../config/settings");
const CtlBase = require("../../ctlms.base");
class PayCtl extends CtlBase {
constructor() {
super();
this.QrCodeUrl = "http://igirl.gongsibao.com/api/tlapi/getQrCodeInfo";
this.PayStatusUrl = "http://igirl.gongsibao.com/api/tlapi/getPayStatus";
this.orderSve = system.getObject("service.order.orderSve");
}
/*
请求参数
{
order_no:订单号,
op_type:支付方式:["wx","alipay"],
total_sum:订单金额
}
返回结果
{
成功返回:
{"code":1,
"msg":"SUCCESS",
"data":
{"payinfo":"https://syb.allinpay.com/apiweb/h5unionpay/native?key=qbWZUuwa4pu2J%2Bj38mkp8863",支付的URL
"reqsn":"333_40_1",
"chnltrxid":"121905790000021961",
"trxid":"121905790000021961",
"trxstatus":"0000",
"wxPayOrderCode":"121905790000021961",微信码
"aliPayOrderCode":"333",支付宝码}
}
失败返回:
{ code: 0, msg: '错误信息', data: {} }
}
*/
async getQrCodeInfo(pobj, pobj2, req) {
if (!pobj.order_no || !pobj.op_type || !pobj.total_sum) {
return system.getResult(null, "请求参数错误");
}
var parm = {};
parm.orderNo = pobj.order_no;
parm.company_id = 1;
parm.other_company_id = 45;
parm.op_type = pobj.op_type;
parm.totalSum = pobj.total_sum;
parm.sveItemCode = "product001";
parm.sveItemName = "个体工商户注册";
parm.create_ip = system.get_client_ip(req);
//parm.create_ip = "127.0.0.1";
parm.req_key = "sygyqbpogszc";
console.log(parm.orderNo);
var rc = system.getObject("util.restClient");
var data = querystring.stringify(parm);
var rtn = null;
try {
rtn = await rc.execPost2(data, this.QrCodeUrl);
console.log(rtn, "-------------------请求支付二维码------------------");
var result = JSON.parse(rtn.stdout);
if (result.code == 1) {
return system.getResultSuccess(result.data);
} else {
return system.getResult(null, "请求失败");
}
return rtn.stdout;
} catch (e) {
return system.getResultFail(500, "接口错误");
}
}
/*
请求参数
{
order_no:订单号,
op_type:支付方式:["wx","alipay"],
aliPay_order_code: 支付宝码,
wx_pay_order_code:微信码
}
返回结果
返回值:{code":1"msg":""} code为1则支付成功
{"code":-330,"msg":"超时未支付,请刷新页面"}
{"code":-130,"msg":"请及时支付"}
{ code: 0, msg: '错误信息', data: {} }
*/
async getPayStatus(pobj, pobj2, req) {
if (!pobj.op_type || !pobj.order_no) {
return system.getResult(null, "请求参数错误");
}
var parm = {
aliPayOrderCode: pobj.aliPay_order_code,
company_id: 1,
other_company_id: 45,
op_type: pobj.op_type,
orderNo: pobj.order_no,
wxPayOrderCode: pobj.wx_pay_order_code,
req_key: "sygyqbpogszc"
};
var rc = system.getObject("util.restClient");
var data = querystring.stringify(parm);
var rtn = null;
try {
rtn = await rc.execPost2(data, this.PayStatusUrl);
var result = JSON.parse(rtn.stdout);
return system.getResultSuccess(result);
} catch (e) {
return system.getResultFail(500, "接口错误");
}
}
async getReCall(obj) {
if (obj.trxstatus == "0000") {
try {
await this.orderSve.orderPay({
id: obj.out_trade_no
});
return system.getResult("更改支付状态成功");
} catch (e) {
console.log(e);
return system.getResult("更改支付状态失败");
}
}
}
}
module.exports = PayCtl;
// var tesk = new PayCtl();
// var par = {
// "trxcode": "VSP501",
// "trxamt": "100",
// "reqsn": "order000001_45_1",
// "chnltrxid": "4200000410201910151445633333",
// "trxid": "121905790000021960",
// "trxstatus": "0000",
// "fintime": "20191015225231",
// "client_ip": "",
// "out_trade_no": "order000001",
// "company_id": "1",
// "other_company_id": "45",
// "req_accountType": "wx",
// "req_key" :""
// };
// tesk.getReCall(par).then(function(result){
// console.log((result));
// }).catch(function(e){
// console.log(e);
// });
\ No newline at end of file
const CacheBase = require("../cache.base");
const system = require("../../system");
const settings = require("../../../config/settings");
class MerchantPushUrlCache extends CacheBase {
constructor() {
super();
this.merchantpushDao = system.getObject("db.merchant.merchantpushDao");
}
desc() {
return "应用中缓存访问token";
}
prefix() {
return settings.cacheprefix + "_merchantPushUrl:";
}
async buildCacheVal(cachekey, inputkey, val, ex, ...items) {
var item = await this.merchantpushDao.getItemByMerchantId(inputkey);
if (!item) {
return null;
}
return JSON.stringify(item);
}
}
module.exports = MerchantPushUrlCache;
const system = require("../../../system");
const Dao = require("../../dao.base");
const moment = require("moment");
class InvoiceDao extends Dao {
constructor() {
super(Dao.getModelName(InvoiceDao));
// this.invoiceStatusDict = {
// "00": "开票申请",
// "10": "已撤回",
// "20": "审核驳回",
// "30": "审核通过",
// "40": "已开票",
// "50": "已邮寄"
// };
}
//批量插入数据
async builkSave(invoices){
if(invoices.length>0 && invoices){
return await this.model.bulkCreate(invoices);
}else{
return null;
}
}
// async getInvoiceStatusName(status) {
// return this.invoiceStatusDict[status || ""] || "";
// }
// async findAllAmtByCreditCode(creditCode, invoiceDay) {
// var year = moment(invoiceDay).format("YYYY");
// var beginTime = year + "-01-01 00:00:00";
// var endTime = year + "-01-01 00:00:00";
// var sql = [];
// sql.push("SELECT SUM(invoiceAmt) AS totalAmt");
// sql.push("FROM xgg_invoice");
// sql.push("WHERE businessmenCreditCode = :creditCode");
// sql.push("AND invoiceTime >= :beginTime AND invoiceTime <= :endTime ");
// var list = await this.customQuery(sql.join(" "), {
// creditCode: creditCode,
// beginTime: beginTime,
// endTime: endTime,
// }) || [];
// var totalAmt = 0;
// for(var item of list) {
// totalAmt = item.totalAmt || 0;
// }
// return totalAmt;
// }
// async findMonthAmtByCreditCode(creditCode, invoiceDay, statuses) {
// var month = moment(invoiceDay).month();
// const beginTime = moment().month(month).startOf('month').format("YYYY-MM-DD") + " 00:00:00";
// const endTime = moment().month(month).endOf('month').format("YYYY-MM-DD") + " 23:59:59";
// console.log(beginTime, endTime);
// var sql = [];
// sql.push("SELECT * ");
// sql.push("FROM xgg_invoice");
// sql.push("WHERE businessmenCreditCode = :creditCode");
// sql.push("AND invoiceTime >= :beginTime");
// sql.push("AND invoiceTime <= :endTime");
// if(statuses && statuses.length > 0) {
// sql.push("AND invoiceStatus IN (:statuses)")
// }
// var map = {};
// var list = await this.customQuery(sql.join(" "), {
// creditCode: creditCode,
// beginTime: beginTime,
// endTime: endTime,
// statuses: statuses || "",
// });
// return list || [];
// }
// async findMapByIds(ids, attrs) {
// var result = {};
// if(!ids || ids.length == 0) {
// return result;
// }
// attrs = attrs || "*";
// var sql = "SELECT " + attrs + " FROM xgg_invoice where id IN (:ids) ";
// var list = await this.customQuery(sql, {ids: ids});
// if(!list || list.length == 0) {
// return result;
// }
// for(var item of list) {
// result[item.id] = item;
// }
// return result;
// }
}
module.exports = InvoiceDao;
// var u=new UserDao();
// var roledao=system.getObject("db.roleDao");
// (async ()=>{
// var users=await u.model.findAll({where:{app_id:1}});
// var role=await roledao.model.findOne({where:{code:"guest"}});
// console.log(role);
// for(var i=0;i<users.length;i++){
// await users[i].setRoles([role]);
// console.log(i);
// }
//
// })();
\ No newline at end of file
const system = require("../../../system");
const Dao = require("../../dao.base");
class MerchantDao extends Dao {
constructor() {
super(Dao.getModelName(MerchantDao));
}
async nameList() {
var sql = "SELECT id, name FROM xgg_merchant";
return await this.customQuery(sql);
}
/**
* 获取商户信息
* @param {*} app_id appid
*/
async getItemByAppId(app_id) {
return this.model.findOne({
where: {
id: app_id
},
attributes: ["id",
"name",//商户名称
"taxType",//纳税人类型 0一般纳税人 1小规模纳税人
"contactName",//联系人姓名
"contactMobile",//联系人手机
"contactEmail",//联系人邮箱
"taxNo",//纳税人识别号
"invoiceAddr",//开票地址
"invoiceMobile",//开票电话
"accountName",//开户名称
"accountPublic",//对公账户
"mailAddr",//邮寄地址
"mailTo",//收件人
"mailMobile",//收件电话
"ownerId",//客户经理id
"ownerPath",//客户经理组织机构路径
"status",//订单状态 0待审核 1待签约 2签约完成
"ucname",//登录账号
"ucid",//登录账号用户id
"appSecret"],
raw: true
});
}
async idsLikeName(name) {
var result = [];
if(!name || !name.trim()) {
return result;
}
var sql = "SELECT id FROM xgg_merchant WHERE name LIKE :name ";
var list = await this.customQuery(sql, {name : "%" + name + "%"});
if(list) {
for(var item of list) {
result.push(item.id);
}
}
return result;
}
async findMapByIds(ids, attrs) {
var result = {};
if(!ids || ids.length == 0) {
return result;
}
attrs = attrs || "*";
var sql = "SELECT " + attrs + " FROM xgg_merchant where id IN (:ids) ";
var list = await this.customQuery(sql, {ids:ids});
if(!list || list.length == 0) {
return result;
}
for(var item of list) {
result[item.id] = item;
}
return result;
}
}
module.exports = MerchantDao;
// var u=new UserDao();
// var roledao=system.getObject("db.roleDao");
// (async ()=>{
// var users=await u.model.findAll({where:{app_id:1}});
// var role=await roledao.model.findOne({where:{code:"guest"}});
// console.log(role);
// for(var i=0;i<users.length;i++){
// await users[i].setRoles([role]);
// console.log(i);
// }
//
// })();
const system=require("../../../system");
const Dao=require("../../dao.base");
class MerchantaccountDao extends Dao{
constructor(){
super(Dao.getModelName(MerchantaccountDao));
}
// 冻结金额
async frozenAmt(id, amt, t) {
var sql = [];
// UPDATE xgg_merchant_account SET available_amt = available_amt - :amt, frozen_amt = frozen_amt + :amt WHERE id = 1 AND available_amt - :amt >= 0
sql.push("UPDATE");
sql.push("xgg_merchant_account");
sql.push("SET");
sql.push("available_amt = available_amt - :amt, frozen_amt = frozen_amt + :amt");
sql.push("WHERE id = :id");
sql.push("AND available_amt - :amt >= 0");
return await this.customUpdate(sql.join(" "), {
id: id,
amt: amt,
}, t);
}
// 撤回冻结
async unFrozenAmt(id, amt, t) {
var sql = [];
// UPDATE xgg_merchant_account SET available_amt = available_amt - :amt, frozen_amt = frozen_amt + :amt WHERE id = 1 AND available_amt - :amt >= 0
sql.push("UPDATE");
sql.push("xgg_merchant_account");
sql.push("SET");
sql.push("available_amt = available_amt + :amt, frozen_amt = frozen_amt - :amt");
sql.push("WHERE id = :id");
sql.push("AND frozen_amt - :amt >= 0");
return await this.customUpdate(sql.join(" "), {
id: id,
amt: amt,
}, t);
}
// 解冻扣款
async cutpayment(id, amt, t) {
var sql = [];
sql.push("UPDATE");
sql.push("xgg_merchant_account");
sql.push("SET");
sql.push("frozen_amt = frozen_amt - :amt");
sql.push("WHERE id = :id");
sql.push("AND frozen_amt - :amt >= 0");
return await this.customUpdate(sql.join(" "), {
id: id,
amt: amt,
}, t);
}
async inrAvailableAmt(merchantId, amt, t) {
var sql = [];
sql.push("UPDATE");
sql.push("xgg_merchant_account");
sql.push("SET");
sql.push("available_amt = available_amt + :amt");
sql.push("WHERE merchant_id = :merchantId");
return await this.customUpdate(sql.join(" "), {
merchantId: merchantId,
amt: amt,
}, t);
}
}
module.exports=MerchantaccountDao;
// var u=new UserDao();
// var roledao=system.getObject("db.roleDao");
// (async ()=>{
// var users=await u.model.findAll({where:{app_id:1}});
// var role=await roledao.model.findOne({where:{code:"guest"}});
// console.log(role);
// for(var i=0;i<users.length;i++){
// await users[i].setRoles([role]);
// console.log(i);
// }
//
// })();
const system = require("../../../system");
const Dao = require("../../dao.base");
class MerchantpushDao extends Dao {
constructor() {
super(Dao.getModelName(MerchantpushDao));
}
/**
* 获取推送地址
* @param {*} merchant_id 商户id
*/
async getItemByMerchantId(merchant_id) {
return this.model.findOne({
where: {
merchant_id: merchant_id
},
raw: true
});
}
async pushInfo(merchantId, field, params) {
var pushConfig = this.dao.findOne({
merchant_id: merchantId
}) || {};
var url = pushConfig[field];
if(!url) {
return;
}
var rs = await this.restClient.execPost(params, url);
var success = false;
if (rs.stdout) {
let rsData = JSON.parse(rs.stdout);
if (rsData.code == "0" || rsData.code == "0000") {
success = true;
}
}
await this.merchantpushlogDao.create({
merchant_id: merchantId,
api: url,
params: params,
rs: rs,
success: success
});
}
}
module.exports = MerchantpushDao;
// var u=new UserDao();
// var roledao=system.getObject("db.roleDao");
// (async ()=>{
// var users=await u.model.findAll({where:{app_id:1}});
// var role=await roledao.model.findOne({where:{code:"guest"}});
// console.log(role);
// for(var i=0;i<users.length;i++){
// await users[i].setRoles([role]);
// console.log(i);
// }
//
// })();
\ No newline at end of file
const system=require("../../../system");
const Dao=require("../../dao.base");
class MerchantrechargeDao extends Dao{
constructor(){
super(Dao.getModelName(MerchantrechargeDao));
}
}
module.exports=MerchantrechargeDao;
// var u=new UserDao();
// var roledao=system.getObject("db.roleDao");
// (async ()=>{
// var users=await u.model.findAll({where:{app_id:1}});
// var role=await roledao.model.findOne({where:{code:"guest"}});
// console.log(role);
// for(var i=0;i<users.length;i++){
// await users[i].setRoles([role]);
// console.log(i);
// }
//
// })();
const system=require("../../../system");
const Dao=require("../../dao.base");
class MerchantsignedDao extends Dao{
constructor(){
super(Dao.getModelName(MerchantsignedDao));
}
}
module.exports=MerchantsignedDao;
// var u=new UserDao();
// var roledao=system.getObject("db.roleDao");
// (async ()=>{
// var users=await u.model.findAll({where:{app_id:1}});
// var role=await roledao.model.findOne({where:{code:"guest"}});
// console.log(role);
// for(var i=0;i<users.length;i++){
// await users[i].setRoles([role]);
// console.log(i);
// }
//
// })();
const system=require("../../../system");
const Dao=require("../../dao.base");
class MerchanttradeDao extends Dao{
constructor(){
super(Dao.getModelName(MerchanttradeDao));
}
async getBusinessTypes () {
return {
"00": "服务费扣款",
"10": "个税扣款",
"20": "增值费扣款",
"30": "附加费扣款",
"90": "充值入账",
}
}
}
module.exports=MerchanttradeDao;
// var u=new UserDao();
// var roledao=system.getObject("db.roleDao");
// (async ()=>{
// var users=await u.model.findAll({where:{app_id:1}});
// var role=await roledao.model.findOne({where:{code:"guest"}});
// console.log(role);
// for(var i=0;i<users.length;i++){
// await users[i].setRoles([role]);
// console.log(i);
// }
//
// })();
const system=require("../../../system");
const Dao=require("../../dao.base");
class MerchanttradeprocessDao extends Dao{
constructor(){
super(Dao.getModelName(MerchanttradeprocessDao));
// amtType 费用类型 00服务费 10个税 20增值费 30附加费
// 流水记录 00开票冻结 10解冻扣款 20撤回发票退款 30审核驳回退款
}
async getAmtTypes() {
return {
"00": "服务费",
"10": "个税",
"20": "增值费",
"30": "附加费"
}
}
async getBusiTypes() {
return {
"00": "开票冻结",
"10": "解冻扣款",
"20": "撤回发票退款",
"30": "审核驳回退款",
}
}
async findMapByInvoiceId(invoiceId, busiTypes) {
var sql = [];
sql.push("SELECT * ");
sql.push("FROM `xgg_merchant_trade_process` ");
sql.push("WHERE invoice_id = :invoiceId");
if (busiTypes && busiTypes.length > 0) {
sql.push("AND busiType IN (:busiTypes)");
}
var list = await this.customQuery(sql.join(""), {invoiceId: invoiceId, busiTypes: busiTypes});
var result = {};
for(var item of list) {
var lst = result[item.amtType] || [];
lst.push(item);
result[item.amtType] = lst;
}
return result;
}
async findUnComplete(invoiceId) {
var sql = "SELECT * FROM `xgg_merchant_trade_process` WHERE invoice_id = 1 AND busiType IN ('00') AND complete = 0";
var list = await this.customQuery(sql, {invoiceId: invoiceId});
return list || [];
}
}
module.exports=MerchanttradeprocessDao;
// var u=new UserDao();
// var roledao=system.getObject("db.roleDao");
// (async ()=>{
// var users=await u.model.findAll({where:{app_id:1}});
// var role=await roledao.model.findOne({where:{code:"guest"}});
// console.log(role);
// for(var i=0;i<users.length;i++){
// await users[i].setRoles([role]);
// console.log(i);
// }
//
// })();
const system=require("../../../system");
const Dao=require("../../dao.base");
class MerchanttradeprocessDao extends Dao{
constructor(){
super(Dao.getModelName(MerchanttradeprocessDao));
}
}
module.exports=MerchanttradeprocessDao;
// var u=new UserDao();
// var roledao=system.getObject("db.roleDao");
// (async ()=>{
// var users=await u.model.findAll({where:{app_id:1}});
// var role=await roledao.model.findOne({where:{code:"guest"}});
// console.log(role);
// for(var i=0;i<users.length;i++){
// await users[i].setRoles([role]);
// console.log(i);
// }
//
// })();
const system = require("../../../system");
const settings = require("../../../../config/settings");
const uiconfig = system.getUiConfig2(settings.appKey);
module.exports = (db, DataTypes) => {
return db.define("invoice", {
merchantId: DataTypes.STRING, //个体工商户
taxNo: DataTypes.STRING,
merchantCode: DataTypes.STRING(20),
merchantName: DataTypes.STRING(20),
corporations: DataTypes.STRING(20),
identityCode: DataTypes.STRING(20),
bank: DataTypes.INTEGER,
uid: DataTypes.STRING(32), //用户id
type: DataTypes.STRING, //发票类型
purchaserName: DataTypes.STRING, //购买方名称
purPhoneAddr: DataTypes.STRING(200), //购买方电话和地址
purBankAcc: DataTypes.STRING(200), //购买方开户行和帐户
mailAddr: DataTypes.STRING(200), //邮寄地址
mailTo: DataTypes.STRING,
mailMobile: DataTypes.STRING,
status: DataTypes.INTEGER,
isPay: DataTypes.INTEGER,
amount: DataTypes.STRING(100), //开票金额
statementsUrl: DataTypes.STRING(300), //结算单链接
contractUrl: DataTypes.STRING(300) //合同链接
// businessmen_id: DataTypes.BIGINT,
// applyNo: DataTypes.STRING(64),
// invoiceAmt: DataTypes.BIGINT,
// tryIncomeTax: DataTypes.BIGINT,
// tryAddedValueTax: DataTypes.BIGINT,
// tryServiceTax: DataTypes.BIGINT,
// trySpecialTax: DataTypes.BIGINT,
// tryMonthAmt: DataTypes.BIGINT,
// incomeTax: DataTypes.BIGINT,
// addedValueTax: DataTypes.BIGINT,
// serviceTax: DataTypes.BIGINT,
// specialTax: DataTypes.BIGINT,
// monthAmt: DataTypes.BIGINT,
// settleImg: DataTypes.STRING(300),
// remark: DataTypes.STRING(200),
// businessmenName: DataTypes.STRING(100),
// businessmenCreditCode: DataTypes.STRING(100),
// businessmenIsBank: {
// type: DataTypes.BOOLEAN,
// defaultValue: false
// },
// merchantName: DataTypes.STRING(100),
// merchantTaxNo: DataTypes.STRING(64),
// merchantInvoiceAddr: DataTypes.STRING(200),
// merchantInvoiceMobile: DataTypes.STRING(30),
// merchantAccountName: DataTypes.STRING(50),
// merchantAccountPublic: DataTypes.STRING(50),
// mailAddr: DataTypes.STRING(200),
// mailTo: DataTypes.STRING(200),
// mailMobile: DataTypes.STRING(200),
// courierNo: DataTypes.STRING(64),
// courierImg: DataTypes.STRING(300),
// invoiceNo: DataTypes.STRING(64),
// invoiceTime: DataTypes.DATE,
// invoiceImg: DataTypes.STRING(300),
// payVoucher: DataTypes.STRING(300),
// invoiceStatus: DataTypes.STRING(4),
// auditRemark: DataTypes.STRING(200),
// taxNo: DataTypes.STRING(64),
// taxTime: DataTypes.DATE,
// taxVoucher: DataTypes.STRING(300),
}, {
timestamps: true,
paranoid: true, //假的删除
underscored: true,
version: true,
freezeTableName: true,
//freezeTableName: true,
// define the table's name
tableName: 'invoice',
validate: {},
indexes: [
// Create a unique index on email
// {
// unique: true,
// fields: ['email']
// },
//
// // Creates a gin index on data with the jsonb_path_ops operator
// {
// fields: ['data'],
// using: 'gin',
// operator: 'jsonb_path_ops'
// },
//
// // By default index name will be [table]_[fields]
// // Creates a multi column partial index
// {
// name: 'public_by_author',
// fields: ['author', 'status'],
// where: {
// status: 'public'
// }
// },
//
// // A BTREE index with a ordered field
// {
// name: 'title_index',
// method: 'BTREE',
// fields: ['author', {attribute: 'title', collate: 'en_US', order: 'DESC', length: 5}]
// }
]
});
}
\ No newline at end of file
const system = require("../../../system");
const settings = require("../../../../config/settings");
const uiconfig = system.getUiConfig2(settings.appKey);
module.exports = (db, DataTypes) => {
return db.define("merchant", {
name: DataTypes.STRING(100),
taxType: DataTypes.INTEGER,
contactName: DataTypes.STRING(30),
contactMobile: DataTypes.STRING(30),
contactEmail: DataTypes.STRING(30),
taxNo: DataTypes.STRING(64),
invoiceAddr: DataTypes.STRING(200),
invoiceMobile: DataTypes.STRING(30),
accountName: DataTypes.STRING(50),
accountPublic: DataTypes.STRING(50),
mailAddr: DataTypes.STRING(200),
mailTo: DataTypes.STRING(200),
mailMobile: DataTypes.STRING(200),
ownerName: DataTypes.STRING,
ownerMobile: DataTypes.STRING,
ownerId: DataTypes.INTEGER,
ownerPath: DataTypes.STRING(100),
status: DataTypes.INTEGER,
ucname: DataTypes.STRING(30),
ucid: DataTypes.INTEGER,
appSecret: DataTypes.STRING(64),//商户密钥信息,用于进行签名请求接口
}, {
paranoid: true,//假的删除
underscored: true,
version: true,
freezeTableName: true,
//freezeTableName: true,
// define the table's name
tableName: 'xgg_merchant',
validate: {
},
indexes: [
// Create a unique index on email
// {
// unique: true,
// fields: ['email']
// },
//
// // Creates a gin index on data with the jsonb_path_ops operator
// {
// fields: ['data'],
// using: 'gin',
// operator: 'jsonb_path_ops'
// },
//
// // By default index name will be [table]_[fields]
// // Creates a multi column partial index
// {
// name: 'public_by_author',
// fields: ['author', 'status'],
// where: {
// status: 'public'
// }
// },
//
// // A BTREE index with a ordered field
// {
// name: 'title_index',
// method: 'BTREE',
// fields: ['author', {attribute: 'title', collate: 'en_US', order: 'DESC', length: 5}]
// }
]
});
}
const system=require("../../../system");
const settings=require("../../../../config/settings");
const uiconfig=system.getUiConfig2(settings.appKey);
module.exports = (db, DataTypes) => {
return db.define("merchantaccount", {
merchant_id: DataTypes.BIGINT,
channel_id: DataTypes.STRING(32),
available_amt: DataTypes.BIGINT,
frozen_amt: DataTypes.BIGINT,
},{
paranoid: true,//假的删除
underscored: true,
version: true,
freezeTableName: true,
//freezeTableName: true,
// define the table's name
tableName: 'xgg_merchant_account',
validate: {
},
indexes:[
// Create a unique index on email
// {
// unique: true,
// fields: ['email']
// },
//
// // Creates a gin index on data with the jsonb_path_ops operator
// {
// fields: ['data'],
// using: 'gin',
// operator: 'jsonb_path_ops'
// },
//
// // By default index name will be [table]_[fields]
// // Creates a multi column partial index
// {
// name: 'public_by_author',
// fields: ['author', 'status'],
// where: {
// status: 'public'
// }
// },
//
// // A BTREE index with a ordered field
// {
// name: 'title_index',
// method: 'BTREE',
// fields: ['author', {attribute: 'title', collate: 'en_US', order: 'DESC', length: 5}]
// }
]
});
}
const system=require("../../../system");
const settings=require("../../../../config/settings");
const uiconfig=system.getUiConfig2(settings.appKey);
module.exports = (db, DataTypes) => {
return db.define("merchantrecharge", {
merchant_id: DataTypes.BIGINT,
voucher: DataTypes.STRING(300),
outTradeNo: DataTypes.STRING,
amt: DataTypes.BIGINT,
status: DataTypes.INTEGER,
remark: DataTypes.STRING(300),
auditUserName: DataTypes.STRING,
},{
paranoid: true,//假的删除
underscored: true,
version: true,
freezeTableName: true,
//freezeTableName: true,
// define the table's name
tableName: 'xgg_merchant_recharge',
validate: {
},
indexes:[
// Create a unique index on email
// {
// unique: true,
// fields: ['email']
// },
//
// // Creates a gin index on data with the jsonb_path_ops operator
// {
// fields: ['data'],
// using: 'gin',
// operator: 'jsonb_path_ops'
// },
//
// // By default index name will be [table]_[fields]
// // Creates a multi column partial index
// {
// name: 'public_by_author',
// fields: ['author', 'status'],
// where: {
// status: 'public'
// }
// },
//
// // A BTREE index with a ordered field
// {
// name: 'title_index',
// method: 'BTREE',
// fields: ['author', {attribute: 'title', collate: 'en_US', order: 'DESC', length: 5}]
// }
]
});
}
const system=require("../../../system");
const settings=require("../../../../config/settings");
const uiconfig=system.getUiConfig2(settings.appKey);
module.exports = (db, DataTypes) => {
return db.define("merchantsigned", {
merchant_id: DataTypes.BIGINT,
nameA: DataTypes.STRING(100),
contractNo: DataTypes.STRING(64),
beginDate: DataTypes.DATE,
endDate: DataTypes.DATE,
serviceRate: DataTypes.DOUBLE(11, 2),
},{
paranoid: true,//假的删除
underscored: true,
version: true,
freezeTableName: true,
//freezeTableName: true,
// define the table's name
tableName: 'xgg_merchant_signed',
validate: {
},
indexes:[
// Create a unique index on email
// {
// unique: true,
// fields: ['email']
// },
//
// // Creates a gin index on data with the jsonb_path_ops operator
// {
// fields: ['data'],
// using: 'gin',
// operator: 'jsonb_path_ops'
// },
//
// // By default index name will be [table]_[fields]
// // Creates a multi column partial index
// {
// name: 'public_by_author',
// fields: ['author', 'status'],
// where: {
// status: 'public'
// }
// },
//
// // A BTREE index with a ordered field
// {
// name: 'title_index',
// method: 'BTREE',
// fields: ['author', {attribute: 'title', collate: 'en_US', order: 'DESC', length: 5}]
// }
]
});
}
const system=require("../../../system");
const settings=require("../../../../config/settings");
const uiconfig=system.getUiConfig2(settings.appKey);
module.exports = (db, DataTypes) => {
return db.define("merchantuser", {
ucid: {
type:DataTypes.INTEGER,
allowNull: false,
},
ucname: {
type:DataTypes.STRING,
allowNull: false,
},
merchant_id: DataTypes.BIGINT,
},{
paranoid: true,//假的删除
underscored: true,
version: true,
freezeTableName: true,
//freezeTableName: true,
// define the table's name
tableName: 'xgg_merchant_user',
validate: {
},
indexes:[
// Create a unique index on email
// {
// unique: true,
// fields: ['email']
// },
//
// // Creates a gin index on data with the jsonb_path_ops operator
// {
// fields: ['data'],
// using: 'gin',
// operator: 'jsonb_path_ops'
// },
//
// // By default index name will be [table]_[fields]
// // Creates a multi column partial index
// {
// name: 'public_by_author',
// fields: ['author', 'status'],
// where: {
// status: 'public'
// }
// },
//
// // A BTREE index with a ordered field
// {
// name: 'title_index',
// method: 'BTREE',
// fields: ['author', {attribute: 'title', collate: 'en_US', order: 'DESC', length: 5}]
// }
]
});
}
const system = require("../../../system");
const ServiceBase = require("../../svems.base")
const settings = require("../../../../config/settings")
class BusinessmenService extends ServiceBase {
constructor() {
super();
}
async myPage(params) {
var rs = await this.callms("order", "businessmenUserPage", params);
return rs;
}
async invoicePage(params) {
params.gstatuses = ['2020'];
var rs = await this.callms("order", "businessmenUserPage", params);
return rs;
}
async info(params) {
var rs = await this.callms("order", "businessmenInfo", params);
return rs;
}
}
module.exports = BusinessmenService;
// var task=new UserService();
// task.getUserStatisticGroupByApp().then(function(result){
// console.log((result));
// }).catch(function(e){
// console.log(e);
// });
const system = require("../../../system");
const ServiceBase = require("../../sve.base")
const settings = require("../../../../config/settings")
class InvoiceService extends ServiceBase {
constructor() {
super("invoice", ServiceBase.getDaoName(InvoiceService));
}
//获取所有发票信息 (条件分页)
async invoices(params) {
if (!params.uid) {
return system.getResultFail(-1, '用户id不能为空');
} else {
var currentPage = Number(params.currentPage || 1);
var pageSize = Number(params.pageSize || 10);
var where = {};
if (params.type && (params.type == 'electronic' || params.type == 'paperQuality')) {
params.type = this.trim(params.type);
where.type = params.type;
}
if (params.id) {
where.id = this.trim(params.id);
}
where.uid = params.uid;
var orderby = [
["id", 'desc']
];
let res = await this.getPageList(currentPage, pageSize, where, orderby);
if (res && res.rows) {
for (var row of res.rows) {
this.handleDate(row, ["created_at", "updated_at"], null, -8);
await this.transfield(row);
}
}
return system.getResultSuccess(res);
}
}
async transfield(row) {
if (!row) {
return;
}
row.creditCode = this.trim(row.merchantCode);
row.name = this.trim(row.merchantName);
row.legalName = this.trim(row.corporations);
row.legalIdcard = this.trim(row.identityCode);
row.isBank = this.trim(row.bank);
}
//创建发票
async create(invoices) {
console.log(invoices);
if (invoices && invoices.length > 0) {
console.log("要插入的数据数组:" + JSON.stringify(invoices));
try {
let res = await this.dao.bulkCreate(invoices);
if (res) {
return system.getResultSuccess(res)
} else {
return system.getResultFail();
}
} catch (error) {
console.log(error);
return system.getResultFail(-1, `插入失败:失败信息:${JSON.stringify(error)}`);
}
} else {
return system.getResultFail(-1, `参数错误`);
}
}
}
module.exports = InvoiceService;
\ No newline at end of file
const system = require("../../../system");
const ServiceBase = require("../../sve.base")
const settings = require("../../../../config/settings")
class InvoiceService extends ServiceBase {
constructor() {
super("invoice", ServiceBase.getDaoName(InvoiceService));
// this.merchantDao = system.getObject("db.merchant.merchantDao");
// this.merchantsignedDao = system.getObject("db.merchant.merchantsignedDao");
// this.merchantaccountDao = system.getObject("db.merchant.merchantaccountDao");
// this.businessmenDao = system.getObject("db.order.businessmenDao");
// this.merchanttradeDao = system.getObject("db.merchant.merchanttradeDao");
// this.merchanttradeprocessDao = system.getObject("db.merchant.merchanttradeprocessDao");
// this.restClient = system.getObject("util.restClient");
// this.pushUtils = system.getObject("util.businessManager.pushUtils")
}
async apiCalcInvoice(pobj) {
var merchantId = pobj.merchant_id;
var signInfo = await this.merchantsignedDao.findOne({
merchant_id: merchantId
});
var list = pobj.invoiceList;
if(list.length > 10) {
return system.getResult(null, "一次试算请求不能超过10条记录");
}
var result = {};
for(var item of list) {
var invoice = {
merchantId: merchantId,
businessmenCreditCode: item.businessmenCreditCode,
invoiceAmt: item.invoiceAmt,
invoiceTime: item.invoiceTime,
type: item.type,
};
try {
var rs = await this.calcInvoice(merchantId, invoice, signInfo);
result[item.businessmenCreditCode] = {
code : rs.code,
msg: rs.msg || "",
incomeTax: rs.incomeTax || 0,
addedValueTax: rs.addedValueTax || 0,
specialTax: rs.specialTax || 0,
serviceTax: rs.serviceTax || 0,
warning: rs.warning || "",
monthAmt: rs.monthAmt || 0,
}
} catch (error) {
result[item.businessmenCreditCode] = {
code : 0,
msg: "试算服务异常",
incomeTax: 0,
addedValueTax: 0,
specialTax: 0,
serviceTax: 0,
warning: "",
monthAmt: 0,
}
}
}
return system.getResultSuccess(result);
}
async apiSaveInvoice(pobj) {
var merchantId = pobj.merchant_id;
var signInfo = await this.merchantsignedDao.findOne({
merchant_id: merchantId
});
var list = pobj.invoiceList;
if(list.length > 10) {
return system.getResult(null, "一次发票提交不能超过10条记录");
}
var merchant = await this.merchantDao.findById(merchantId);
var result = {};
for(var item of list) {
var repeat = await this.dao.findOne({merchant_id: merchantId, applyNo: item.applyNo});
if(repeat) {
result[item.businessmenCreditCode] = {
code: 0,
msg: "发票【" + item.applyNo + "】申请号重复",
}
continue;
}
var invoice = {
merchant_id: merchantId,
applyNo: item.applyNo,
businessmenCreditCode: item.businessmenCreditCode,
invoiceAmt: item.invoiceAmt,
invoiceTime: item.invoiceTime,
type: item.type,
settleImg: item.settleImg,
merchantName: merchant.name,
merchantTaxNo: merchant.taxNo,
merchantInvoiceAddr: merchant.invoiceAddr,
merchantInvoiceMobile: merchant.invoiceMobile,
merchantAccountName: merchant.accountName,
merchantAccountPublic: merchant.accountPublic,
};
try {
var rs = await this.saveInvoice(invoice, signInfo);
result[item.businessmenCreditCode] = {
code: rs.code,
msg: rs.msg || "",
}
} catch (error) {
console.log(error.stack);
var message = error.message || "";
var msg;
if(message == "1001") {
msg = "账户余额不足";
}
if(message == "Validation error") {
msg = "发票申请号" + item.applyNo + "】重复";
}
result[item.businessmenCreditCode] = {
code: 0,
msg: msg || "服务异常",
}
}
}
return system.getResultSuccess(result);
}
async apiCancelInvoice(pobj) {
try {
var rs = await this.cancel(pobj.merchant_id, pobj.applyNo);
if(rs.code == 1) {
return system.getResultSuccess("success");
}
return system.getResult(null, rs.msg);
} catch (error) {
console.log(error.stack);
return system.getResult(null, error.message == "1001" ? "账户解冻余额不足" : "服务错误");
}
}
async testInvoiceAudit(pobj) {
var invoice = await this.dao.findOne({merchant_id: pobj.merchant_id, applyNo: pobj.applyNo});
var rs = await this.audit(invoice.id, pobj.isPass, pobj.remark);
return system.getResultSuccess(rs);
}
async testKaipiao(pobj) {
var invoice = await this.dao.findOne({merchant_id: pobj.merchant_id, applyNo: pobj.applyNo});
var info = {
id: invoice.id,
invoiceNo: pobj.invoiceNo,
invoiceTime: pobj.invoiceTime,
invoiceImg: pobj.invoiceImg,
payVoucher: pobj.payVoucher,
isServiceTax: pobj.isServiceTax,
isInomeTaX: pobj.isInomeTaX,
isAddedValueTax: pobj.isAddedValueTax,
isSpecialTax: pobj.isSpecialTax,
}
var rs = await this.kaipiao(info);
return system.getResultSuccess(rs);
}
// 发票费用计算
async calcInvoice(merchantId, invoice, signInfo) {
var result = {
code: 1,
creditCode: invoice.businessmenCreditCode,
msg: "success"
};
// 查询商户签约信息
if (!signInfo) {
signInfo = await this.merchantsignedDao.findOne({
merchant_id: merchantId
});
}
if (!signInfo) {
result.code = 1;
result.msg = "商户未签约";
return result;
}
// 发票信息
var invoiceType = invoice.type || 0; // 0专票 1普票
var invoiceAmt = Number(invoice.invoiceAmt); // 开票金额分
var invoiceTime = invoice.invoiceTime; // 开票时间
var creditCode = invoice.businessmenCreditCode; // 社会统一信用代码
// 服务费率
var serviceRate = Number(signInfo.serviceRate || 0);
var serviceTax = Number((invoiceAmt * serviceRate) / 100).toFixed(0) || 0;
// 查询账户信息
var account = await this.merchantaccountDao.findOne({
channel_id: 0,
merchant_id: merchantId,
});
result.accountId = account.id;
if (account.available_amt < serviceTax) {
result.code = 0;
result.msg = "账户余额不足,请充值";
return result;
}
// 验证发票
var invoiceList = await this.dao.findMonthAmtByCreditCode(creditCode, invoice.invoiceTime, ['00']);
if(invoiceList.length > 0) {
result.code = 0;
result.msg = "该商户发票编号【" + invoiceList[0].applyNo + "】正在申请中,请等待审核通过或者撤回才能再次申请";
return result;
}
// 获取个体工商户信息
var businessmen = await this.businessmenDao.findOne({
creditCode: creditCode
});
// 查询个体户签约信息
if (!businessmen) {
result.code = 0;
result.msg = "个体工商户不存在,请检查该商户的统一社会信用代码【" + creditCode + "】";
return result;
}
result.businessmen = businessmen;
// 计算当前个体工商户月开票总金额
var totalAmt = Number(await this.dao.findAllAmtByCreditCode(creditCode, invoiceTime) || 0);
// 未开户的,不计算,不扣款
if (businessmen.isBank) {
result.msg = "success";
result.incomeTax = 0;
result.addedValueTax = 0;
result.specialTax = 0;
result.serviceTax = serviceTax;
return result;
}
if (totalAmt + invoiceAmt >= 500000000) {
result.code = 0;
result.msg = "本年度开票金额不允许超过500万";
return result;
}
if (totalAmt + invoiceAmt >= 420000000) {
result.warning = "年度总开票金额已达到" + system.f2y(totalAmt + invoiceAmt);
}
// 00开票申请 10已撤回 20审核驳回 30审核通过 40已开票 50已邮寄 60完税证明
var monthList = await this.dao.findMonthAmtByCreditCode(creditCode, invoiceTime, ['00', '30', '40', '50', '60']);
// 计算当月个税、增值税、附加税 累计金额
var monthIcomeTax = 0;
var monthAddedValueTax = 0;
var monthSpecialTax = 0;
var monthAmt = 0;
for (var item of monthList) {
monthAmt = monthAmt + Number(item.invoiceAmt);
monthIcomeTax = monthIcomeTax + Number(item.incomeTax);
monthAddedValueTax = monthAddedValueTax + Number(item.addedValueTax);
monthSpecialTax = monthSpecialTax + Number(item.specialTax);
}
// 计算当前个税
var taxLadder;
var otherLadder;
// 当前开票额 + 本月开票额
var amt = invoiceAmt + monthAmt;
if (invoiceType == '00') {
taxLadder = this.getAmtLadder(invoiceAmt, JSON.parse(businessmen.commonTaxLadder));
otherLadder = this.getAmtLadder(invoiceAmt, JSON.parse(businessmen.commonOtherLadder));
} else {
taxLadder = this.getAmtLadder(invoiceAmt, JSON.parse(businessmen.specialTaxLadder));
otherLadder = this.getAmtLadder(invoiceAmt, JSON.parse(businessmen.specialOtherLadder));
}
var incomeRate = Number(taxLadder.rate || 0) / 100; // 个税税率
var zengzhiRate = Number(otherLadder.zengzhiRate || 0) / 100; // 着呢格式税税率
var fujiaRate = Number(otherLadder.fujiaRate || 0) / 100; // 附加税税率
var xadd = 1 + zengzhiRate; // 1 + 增值税
// 计算个税 ((当前开票额 + 本月开票额) * 个税 / (1 + 增值税)) - 本月个税总额
result.incomeTax = ((amt * incomeRate / xadd) - monthIcomeTax).toFixed(0);
// 计算增值税 ((当前开票额 + 本月开票额) * 增值税 / (1 + 增值税)) - 本月个税总额
result.addedValueTax = ((amt * zengzhiRate / xadd) - monthAddedValueTax).toFixed(0);
// 计算附加税
result.specialTax = Number(result.addedValueTax * fujiaRate).toFixed(0);
// 计算服务费
result.serviceTax = Number((invoiceAmt * serviceRate) / 100).toFixed(0);
// 本月已申请的开票金额
result.monthAmt = monthAmt;
// 验证账户金额是否可使用
var totalfee = Number(result.incomeTax) + Number(result.addedValueTax) + Number(result.specialTax) + Number(result.serviceTax);
if (totalfee > account.available_amt) {
result.code = 0;
result.msg = "账户余额不足,请充值";
return result;
}
return result;
}
async saveInvoice(invoice, signInfo) {
var result = {code: 1}
if(!signInfo) {
signInfo = await this.merchantsignedDao.findOne({
merchant_id: invoice.merchant_id
});
}
if (!signInfo) {
result.code = 0;
result.msg = "商户未签约";
return result;
}
// 计算税费
var taxResult = await this.calcInvoice(invoice.merchant_id, invoice, signInfo);
if (taxResult.code === 0) {
return taxResult;
}
// 试算费用
invoice.tryIncomeTax = Number(taxResult.incomeTax || 0);
invoice.tryAddedValueTax = Number(taxResult.addedValueTax || 0);
invoice.tryServiceTax = Number(taxResult.serviceTax || 0);
invoice.trySpecialTax = Number(taxResult.specialTax || 0);
invoice.tryMonthAmt = Number(taxResult.monthAmt || 0);
// 实际费用,因为试算时,都使用实际费用字段,所以这里先赋值,再审核时,再次计算再次赋值
invoice.incomeTax = Number(taxResult.incomeTax || 0);
invoice.addedValueTax = Number(taxResult.addedValueTax || 0);
invoice.serviceTax = Number(taxResult.serviceTax || 0);
invoice.specialTax = Number(taxResult.specialTax || 0);
invoice.monthAmt = Number(taxResult.monthAmt || 0);
invoice.businessmenName = taxResult.businessmen.name;
invoice.businessmenCreditCode = taxResult.businessmen.creditCode;
invoice.businessmenIsBank = taxResult.businessmen.isBank;
invoice.businessmen_id = taxResult.businessmen.id;
var accountId = taxResult.accountId;
var totalfee = invoice.incomeTax + invoice.addedValueTax + invoice.serviceTax + invoice.specialTax;
// 发票事务处理
var self = this;
var data = await self.db.transaction(async function (t) {
// 创建发票
invoice = await self.dao.create(invoice, t);
// 冻结金额 TODO 测试事务回滚
var rows = await self.merchantaccountDao.frozenAmt(accountId, totalfee, t);
if (rows.length < 2 || rows[1] == 0) {
// 账户余额不足
throw new Error(1001);
}
// 查询账户额度
var account = await self.merchantaccountDao.findOne({
channel_id: 0,
merchant_id: invoice.merchant_id,
});
var availableAmt = account.available_amt || 0;
var frozen_amt = account.frozen_amt || 0;
// 服务费冻结
await self.doFrozenItem({
invoice: invoice,
accountId: accountId,
amt: invoice.serviceTax,
amtType: "00",
busiType: "00",
frozen: true,
}, t);
// 个税流水
await self.doFrozenItem({
invoice: invoice,
accountId: accountId,
amt: invoice.incomeTax,
amtType: "10",
busiType: "00",
frozen: true,
}, t);
// 增值税流水
await self.doFrozenItem({
invoice: invoice,
accountId: accountId,
amt: invoice.addedValueTax,
amtType: "20",
busiType: "00",
frozen: true,
}, t);
// 附加费流水
await self.doFrozenItem({
invoice: invoice,
accountId: accountId,
amt: invoice.specialTax,
amtType: "30",
busiType: "00",
frozen: true,
}, t);
return invoice;
});
result.code = 1;
result.msg = "success";
return result;
}
// 发票撤回
async cancel(merchantId, applyNo) {
var result = {
code: 1
};
var invoice = await this.dao.findOne({
merchant_id: merchantId,
applyNo: applyNo
});
if (!invoice) {
result.code = 1;
result.msg = "发票不存在";
return result;
}
if (invoice.invoiceStatus != '00') {
var statusName = await this.dao.getInvoiceStatusName(invoice.invoiceStatus);
result.code = 0;
result.msg = "当前发票状态为【" + statusName + "】,不允许撤回,如需撤回请联系客户经理。";
return result;
}
// 解冻冻结金额
await this.unfreeze(invoice, "20", "10", "发票撤回解冻");
result.msg = "success";
return result;
}
// 发票审核
async audit(id, isPass, auditRemark) {
var result = {code: 1};
var invoice = await this.dao.findById(id);
if (!invoice) {
result.code = 0;
result.msg = "发票不存在";
return result;
}
if (invoice.invoiceStatus != '00') {
var statusName = await this.dao.getInvoiceStatusName(invoice.invoiceStatus);
result.code = 0;
result.msg = "当前发票状态为【" + statusName + "】,不可以审核。";
return result;
}
if (isPass) {
invoice.invoiceStatus = "30";
invoice.auditRemark = auditRemark;
await invoice.save();
} else {
// 解冻冻结金额
await this.unfreeze(invoice, "30", "20", auditRemark);
}
// 推送审核信息
var pushObj = {
merchant_id: invoice.merchant_id,
applyNo: invoice.applyNo,
auditStatus: isPass ? 1 : 0,
auditRemark: auditRemark,
}
this.pushUtils.push(invoice.merchant_id, "fapiaoshenhe", pushObj);
result.code = 1;
result.msg = "success";
return result;
}
async kaipiao(info) {
var result = {code : 1};
var invoice = await this.dao.findById(info.id);
if (!invoice) {
result.code = 0;
result.msg = "发票不存在";
return result;
}
if (invoice.invoiceStatus != '30') {
var statusName = await this.dao.getInvoiceStatusName(invoice.invoiceStatus);
result.code = 0;
result.msg = "当前发票状态为【" + statusName + "】,不可以开票。";
return result;
}
var processMap = await this.merchanttradeprocessDao.findMapByInvoiceId(invoice.id);
var account = await this.merchantaccountDao.findOne({
channel_id: 0,
merchant_id: invoice.merchant_id,
});
var self = this;
await this.db.transaction(async function (t) {
var updateParams = {
invoiceStatus: "40",
invoiceNo: info.invoiceNo,
invoiceTime: info.invoiceTime,
invoiceImg: info.invoiceImg,
payVoucher: info.payVoucher,
updated_at: new Date()
}
// 审核通过
await self.dao.model.update(updateParams, {where: {id: invoice.id},transaction: t});
if (invoice.businessmenIsBank) {
return;
}
if (info.isServiceTax) {
// 扣除服务费
await self.cutpayment(account, invoice, processMap["00"], "00", t);
}
if (info.isInomeTaX) {
// 扣除个税
await self.cutpayment(account, invoice, processMap["10"], "10", t);
}
if (info.isAddedValueTax) {
// 扣除增值税
await self.cutpayment(account, invoice, processMap["20"], "20", t);
}
if (info.isSpecialTax) {
// 扣除附加费
await self.cutpayment(account, invoice, processMap["30"], "30", t);
}
});
// 推送开票信息 TODO
invoice = await this.dao.findById(info.id);
var pushObj = {
merchant_id: invoice.merchant_id,
applyNo: invoice.applyNo,
invoiceNo: info.invoiceNo,
invoiceTime: info.invoiceTime,
invoiceImg: info.invoiceImg,
payVoucher: info.payVoucher,
}
this.pushUtils.push(invoice.merchant_id, "fapiaoshenhe", pushObj);
}
async toEmail(id, courierNo, courierImg) {
var invoice = await this.dao.findById(info.id);
if (!invoice) {
result.code = 1;
result.msg = "发票不存在";
return result;
}
if (invoice.invoiceStatus != '40') {
var statusName = await this.dao.getInvoiceStatusName(invoice.invoiceStatus);
result.code = 1;
result.msg = "当前发票状态为【" + statusName + "】,不可以创建邮寄进度。";
return result;
}
invoice.courierNo = courierNo;
invoice.courierImg = courierImg;
invoice.invoiceStatus = "50";
await invoice.save();
// TODO 推送邮寄信息
invoice = await this.dao.findById(info.id);
var params = {
merchant_id : invoice.merchant_id,// 商户id
courierNo: courierNo, // 快递单号
courierImg: courierImg, // 快递交接单图片
}
this.pushUtils.push(invoice.merchant_id, "fapiaoshenhe", params);
}
async taxCertificate(info) {
// taxNo: DataTypes.STRING(64),
// taxTime: DataTypes.DATE,
// taxVoucher: DataTypes.STRING(300),
if (!invoice) {
result.code = 1;
result.msg = "发票不存在";
return result;
}
if (invoice.invoiceStatus != '50') {
var statusName = await this.dao.getInvoiceStatusName(invoice.invoiceStatus);
result.code = 1;
result.msg = "当前发票状态为【" + statusName + "】,不可以创建完税证明。";
return result;
}
var processMap = await this.merchanttradeprocessDao.findMapByInvoiceId(invoiceId);
var account = await this.merchantaccountDao.findOne({
channel_id: 0,
merchant_id: merchantId,
});
await this.db.transaction(async function (t) {
var updateParams = {
invoiceStatus: "50",
taxNo: info.taxNo,
taxTime: info.taxTime,
taxVoucher: info.taxVoucher,
updated_at: new Date()
}
// 审核通过
await self.dao.model.update(updateParams, {where: {id: invoice.id},transaction: t});
if (invoice.businessmenIsBank) {
return;
}
if (info.isServiceTax) {
// 扣除服务费
await self.cutpayment(account, invoice, processMap["00"], "00", t);
}
if (info.isInomeTaX) {
// 扣除个税
await self.cutpayment(account, invoice, processMap["10"], "10", t);
}
if (info.isAddedValueTax) {
// 扣除增值税
await self.cutpayment(account, invoice, processMap["20"], "20", t);
}
if (info.isSpecialTax) {
// 扣除附加费
await self.cutpayment(account, invoice, processMap["30"], "30", t);
}
// 这里可以检查一下,当前发票冻结流水全部解冻
var list = await self.merchanttradeprocessDao.findUnComplete(invoice.id);
for(var item of list) {
if(item.amt == 0) {
await self.cutpayment(account, invoice, [item], item.amtType, t);
} else {
throw new Error(1002);
}
}
});
}
// 解冻扣款操作
async cutpayment(account, invoice, processList, amtType, t) {
for(var item of processList) {
if(!item.complete && (item.busiType == '00')) {
// 账户解冻扣款
var rows = await this.merchantaccountDao.cutpayment(account.id, item.amt, t);
if(rows == 0) {
throw new Error(1001);
}
// 解冻扣款流水
var unfreezeObj = {
merchant_id: item.merchant_id,
invoice_id: item.invoice_id,
amt: item.amt,
busiType: "10",
amtType: amtType,
};
await this.merchanttradeprocessDao.create(unfreezeObj, t);
await this.merchanttradeprocessDao.model.update({complete: true}, {where: {id: item.id},transaction: t});
}
}
}
async doAuditPass(invoice, auditRemark) {
// 计算税费
var taxResult = await this.calcInvoice(invoice.merchant_id, invoice);
var processMap = await this.merchanttradeprocessDao.findMapByInvoiceId(invoiceId);
// 服务费
var serviceTax = self.cloneProcessObj(processMap, "00", busiType);
// 个税
var incomeTax = self.cloneProcessObj(processMap, "10", busiType);
// 增值费
var addedValueTax = self.cloneProcessObj(processMap, "20", busiType);
// 附加费
var specialTax = self.cloneProcessObj(processMap, "30", busiType);
// 计算费用差
var serviceTaxDiff = Number(taxResult.serviceTax || 0) - Number(serviceTax.amt);
var incomeTaxDiff = Number(taxResult.incomeTax || 0) - Number(incomeTax.amt);
var addedValueTaxDiff = Number(taxResult.addedValueTax || 0) - Number(addedValueTax.amt);
var specialTax = Number(taxResult.specialTax || 0) - Number(specialTax.amt);
var account = await this.merchantaccountDao.findOne({
channel_id: 0,
merchant_id: merchantId,
});
var self = this;
await this.db.transaction(async function (t) {
// 审核通过
await self.dao.model.update({
invoiceStatus: "30",
updated_at: new Date(),
auditRemark: auditRemark || ""
}, {
where: {
id: invoice.id
},
transaction: t
});
if (invoice.businessmenIsBank) {
return;
}
var rows = 0;
if (serviceTaxDiff != 0) {
await self.doProcessItem({
invoice: invoice,
amt: serviceTaxDiff,
amtType: "00",
busiType: serviceTaxDiff > 0 ? "40" : "50",
}, t);
}
if (incomeTaxDiff != 0) {
await self.doProcessItem({
invoice: invoice,
amt: incomeTaxDiff,
amtType: "10",
busiType: incomeTaxDiff > 0 ? "40" : "50",
}, t);
}
if (addedValueTax != 0) {
await self.doProcessItem({
invoice: invoice,
amt: addedValueTax,
amtType: "20",
busiType: addedValueTax > 0 ? "40" : "50",
}, t);
}
if (specialTax != 0) {
await self.doProcessItem({
invoice: invoice,
amt: specialTax,
amtType: "30",
busiType: specialTax > 0 ? "40" : "50",
}, t);
}
});
}
// 处理冻结、解冻流水
async doFrozenItem(params, t) {
var invoice = params.invoice;
var amt = params.amt;
var accountId = params.accountId;
var amtType = params.amtType;
var busiType = params.busiType;
var frozen = params.frozen;
if (amt > 0) {
var rows ;
if(frozen) {
rows = await this.merchantaccountDao.frozenAmt(accountId, amt, t);
} else {
rows = await this.merchantaccountDao.unFrozenAmt(accountId, amt, t);
}
if (rows.length < 2 || rows[1] == 0) {
// 账户余额不足
throw new Error(1001);
}
}
var account = await this.merchantaccountDao.findOne({id: accountId}, t);
// 个税
await this.merchanttradeprocessDao.create({
merchant_id: invoice.merchant_id,
invoice_id: invoice.id,
amt: amt,
available_amt: account.available_amt,
frozen_amt: account.frozen_amt,
busiType: busiType,
amtType: amtType,
}, t);
}
// 解冻退款
async unfreeze(invoice, busiType, invoiceStatus, remark) {
var processMap = await this.merchanttradeprocessDao.findMapByInvoiceId(invoice.id);
// 查询账户信息
var account = await this.merchantaccountDao.findOne({
channel_id: 0,
merchant_id: invoice.merchant_id,
});
var self = this;
// 撤回冻结金额
await this.db.transaction(async function (t) {
if(!invoice.businessmenIsBank) {
// 服务费
var serviceTax = self.cloneProcessObj(processMap, "00", busiType);
// 解冻
await self.doFrozenItem({
invoice: invoice,
accountId: account.id,
amt: serviceTax.amt,
amtType: "00",
busiType: "20",
frozen: false,
}, t);
// 个税
var incomeTax = self.cloneProcessObj(processMap, "10", busiType);
// 解冻
await self.doFrozenItem({
invoice: invoice,
accountId: account.id,
amt: incomeTax.amt,
amtType: "10",
busiType: "20",
frozen: false,
}, t);
// 增值费
var addedValueTax = self.cloneProcessObj(processMap, "20", busiType);
// 解冻
await self.doFrozenItem({
invoice: invoice,
accountId: account.id,
amt: addedValueTax.amt,
amtType: "20",
busiType: "20",
frozen: false,
}, t);
// 附加费
var specialTax = self.cloneProcessObj(processMap, "30", busiType);
// 解冻
await self.doFrozenItem({
invoice: invoice,
accountId: account.id,
amt: addedValueTax.amt,
amtType: "30",
busiType: "20",
frozen: false,
}, t);
}
// 发票状态修改
await self.dao.model.update({invoiceStatus: invoiceStatus, updated_at:new Date(), auditRemark: (remark || "")}, {where:{id:invoice.id}, transaction:t});
});
}
cloneProcessObj(processMap, amtType, busiType) {
var list = processMap[amtType];
// 判断解冻扣款
if (list.length > 1) {
// 服务费冻结已被处理,不可撤回发票
throw new Error(amtType);
}
var item = list[0];
return {
merchant_id: item.merchant_id,
invoice_id: item.invoice_id,
amt: item.amt,
busiType: busiType,
amtType: amtType,
};
}
getAmtLadder(amt, ladders) {
if (!ladders) {
return {};
}
for (var ladder of ladders) {
var min = Number(ladder.minValue);
var max = Number(ladder.maxValue);
if (amt >= min && amt < max) {
return ladder;
}
}
return {};
}
}
module.exports = InvoiceService;
// var task=new UserService();
// task.getUserStatisticGroupByApp().then(function(result){
// console.log((result));
// }).catch(function(e){
// console.log(e);
// });
\ No newline at end of file
const system=require("../../../system");
const ServiceBase=require("../../sve.base")
const settings=require("../../../../config/settings")
class MerchantpushlogService extends ServiceBase{
constructor(){
super("merchant", ServiceBase.getDaoName(MerchantpushlogService));
}
}
module.exports=MerchantpushlogService;
// var task=new UserService();
// task.getUserStatisticGroupByApp().then(function(result){
// console.log((result));
// }).catch(function(e){
// console.log(e);
// });
const system=require("../../../system");
const ServiceBase=require("../../sve.base")
const settings=require("../../../../config/settings")
class MerchanttradeService extends ServiceBase{
constructor(){
super("merchant", ServiceBase.getDaoName(MerchanttradeService));
this.merchantDao = system.getObject("db.merchant.merchantDao");
}
async pageByCondition(params) {
var currentPage = Number(params.currentPage || 1);
var pageSize = Number(params.pageSize || 10);
var where = {};
var merchantIds ;
// 商户名称
if (params.merchantName) {
merchantIds = await this.merchantDao.idsLikeName(params.merchantName);
if (!merchantIds || merchantIds.length == 0) {
return {count : 0, rows: []};
}
}
if(params.merchantId) {
var mid = Number(params.merchantId);
if(merchantIds) {
if(merchantIds.indexOf(mid) == -1) {
return {count : 0, rows: []};
} else {
merchantIds = [mid];
}
} else {
merchantIds = [mid];
}
}
if(merchantIds && merchantIds.length > 0) {
where.merchant_id = {
[this.db.Op.in]: merchantIds
};
}
if(params.invoiceApplyNo) {
where.invoiceApplyNo = params.invoiceApplyNo;
}
if(params.type) {
where.type = params.type;
}
if (params.status == 'number') {
where.status = params.status;
}
// 创建时间
this.addWhereTime(where, 'created_at', params.createdBegin, params.createdEnd, true);
var orderby = [
["id", 'desc']
];
var attributes = ["id", "merchant_id", "invoice_id", "invoiceNo", "invoiceApplyNo", "recharge_id",
"outTradeNo", "amt", "balance", "type", "businessType", "created_at"];
var page = await this.getPageList(currentPage, pageSize, where, orderby, attributes);
if (page && page.rows) {
var busiType = await this.dao.getBusinessTypes();
var merchantMap = await this.getMerchantMap(page.rows, "id, name");
for (var row of page.rows) {
row.businessTypeName = busiType[row.businessType];
row.merchantName = (merchantMap[row.merchant_id] || {}).name || "";
this.handleDate(row, ["created_at"], null, -8);
}
system.f2y4list(page.rows, ["amt"]);
}
return page;
}
async setMerchant(rows, attrs) {
var map = await this.getMerchantMap(rows, attrs);
for(var row of rows) {
row.merchant = map[row.merchant_id] || {};
}
}
async getMerchantMap(rows, attrs) {
if(!rows || rows.length == 0) {
return {};
}
var ids = [];
for(var row of rows) {
ids.push(row.merchant_id);
}
return await this.merchantDao.findMapByIds(ids, attrs);
}
}
module.exports=MerchanttradeService;
// var task=new UserService();
// task.getUserStatisticGroupByApp().then(function(result){
// console.log((result));
// }).catch(function(e){
// console.log(e);
// });
const system=require("../../../system");
const ServiceBase=require("../../sve.base")
const settings=require("../../../../config/settings")
class MerchanttradeprocessService extends ServiceBase{
constructor(){
super("merchant", ServiceBase.getDaoName(MerchanttradeprocessService));
this.merchantDao = system.getObject("db.merchant.merchantDao");
this.invoiceDao = system.getObject("db.invoice.invoiceDao");
}
async pageByCondition(params) {
var currentPage = Number(params.currentPage || 1);
var pageSize = Number(params.pageSize || 10);
var where = {};
var merchantIds ;
// 商户名称
if (params.merchantName) {
merchantIds = await this.merchantDao.idsLikeName(params.merchantName);
if (!merchantIds || merchantIds.length == 0) {
return {count : 0, rows: []};
}
}
if(params.merchantId) {
var mid = Number(params.merchantId);
if(merchantIds) {
if(merchantIds.indexOf(mid) == -1) {
return {count : 0, rows: []};
} else {
merchantIds = [mid];
}
} else {
merchantIds = [mid];
}
}
if(merchantIds && merchantIds.length > 0) {
where.merchant_id = {
[this.db.Op.in]: merchantIds
};
}
if(params.invoiceApplyNo) {
var invoice = await this.invoiceDao.findOne({applyNo: params.invoiceApplyNo});
if(!invoice) {
return {count : 0, rows: []};
}
where.invoice_id = invoice.id;
}
if(params.type) {
where.type = params.type;
}
if (params.busiType) {
where.busiType = params.busiType;
}
// 创建时间
this.addWhereTime(where, 'created_at', params.createdBegin, params.createdEnd, true);
var orderby = [
["id", 'desc']
];
var attributes = ["id", "merchant_id", "invoice_id", "amtType", "amt", "frozen_amt", "available_amt",
"busiType", "complete", "created_at"];
var page = await this.getPageList(currentPage, pageSize, where, orderby, attributes);
if (page && page.rows) {
var amtTypeMap = await this.dao.getAmtTypes();
var busiTypeMap = await this.dao.getBusiTypes();
var merchantMap = await this.getMerchantMap(page.rows, "id, name");
var invoiceMap = await this.getInvoiceMap(page.rows, "id, applyNo");
for (var row of page.rows) {
row.amtTypeName = amtTypeMap[row.amtType];
row.busiTypeName = busiTypeMap[row.busiType];
row.merchantName = (merchantMap[row.merchant_id] || {}).name || "";
row.invoiceApplyNo = (invoiceMap[row.invoice_id] || {}).applyNo || "";
this.handleDate(row, ["created_at"], null, -8);
}
system.f2y4list(page.rows, ["amt", "frozen_amt", "available_amt"]);
}
return page;
}
async setMerchant(rows, attrs) {
var map = await this.getMerchantMap(rows, attrs);
for(var row of rows) {
row.merchant = map[row.merchant_id] || {};
}
}
async getMerchantMap(rows, attrs) {
if(!rows || rows.length == 0) {
return {};
}
var ids = [];
for(var row of rows) {
ids.push(row.merchant_id);
}
return await this.merchantDao.findMapByIds(ids, attrs);
}
async getInvoiceMap(rows, attrs) {
if(!rows || rows.length == 0) {
return {};
}
var ids = [];
for(var row of rows) {
ids.push(row.invoice_id);
}
return await this.invoiceDao.findMapByIds(ids, attrs);
}
}
module.exports=MerchanttradeprocessService;
// var task=new UserService();
// task.getUserStatisticGroupByApp().then(function(result){
// console.log((result));
// }).catch(function(e){
// console.log(e);
// });
const system=require("../../../system");
const ServiceBase=require("../../sve.base")
const settings=require("../../../../config/settings")
class MerchantuserService extends ServiceBase{
constructor(){
super("merchant", ServiceBase.getDaoName(MerchantuserService));
}
}
module.exports=MerchantuserService;
// var task=new UserService();
// task.getUserStatisticGroupByApp().then(function(result){
// console.log((result));
// }).catch(function(e){
// console.log(e);
// });
const system = require("../../../system");
const ServiceBase = require("../../svems.base")
const settings = require("../../../../config/settings")
class OrderService extends ServiceBase {
constructor() {
super();
}
async add(params) {
var rs = await this.callms("order", "addOrder", params);
return rs;
}
async myPage(params) {
var rs = await this.callms("order", "myOrderPage", params);
await this.transfield(rs.data.rows);
return rs;
}
async info(params) {
var rs = await this.callms("order", "orderInfoAll", params);
await this.transfield([rs.data]);
return rs;
}
async orderPay(params) {
var rs = await this.callms("order", "orderPay", params);
return rs;
}
async transfield(rows) {
if (!rows) {
return;
}
for (var item of rows) {
if (!item) {
continue;
}
item.price = system.f2y(item.price);
}
}
}
module.exports = OrderService;
// var task=new UserService();
// task.getUserStatisticGroupByApp().then(function(result){
// console.log((result));
// }).catch(function(e){
// console.log(e);
// });
\ No newline at end of file
const system = require("../system");
const moment = require('moment')
const settings = require("../../config/settings");
const md5 = require("MD5");
class ServiceBase {
constructor() {
this.restClient = system.getObject("util.restClient");
this.micro = system.microsetting();
}
/*
返回20位业务订单号
prefix:业务前缀
*/
async getBusUid(prefix) {
prefix = (prefix || "");
if (prefix) {
prefix = prefix.toUpperCase();
}
var prefixlength = prefix.length;
var subLen = 8 - prefixlength;
var uidStr = "";
if (subLen > 0) {
uidStr = await this.getUidInfo(subLen, 60);
}
var timStr = moment().format("YYYYMMDDHHmm");
return prefix + timStr + uidStr;
}
/*
len:返回长度
radix:参与计算的长度,最大为62
*/
async getUidInfo(len, radix) {
var chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'.split(''); //长度62,到yz长度为长36
var uuid = [],
i;
radix = radix || chars.length;
if (len) {
for (i = 0; i < len; i++) uuid[i] = chars[0 | Math.random() * radix];
} else {
var r;
uuid[8] = uuid[13] = uuid[18] = uuid[23] = '-';
uuid[14] = '4';
for (i = 0; i < 36; i++) {
if (!uuid[i]) {
r = 0 | Math.random() * 16;
uuid[i] = chars[(i == 19) ? (r & 0x3) | 0x8 : r];
}
}
}
return uuid.join('');
}
handleDate(row, fields, pattern, addHours) {
pattern = pattern || "YYYY-MM-DD HH:mm";
if (!row) {
return;
}
for (var field of fields) {
if (row[field]) {
if (addHours) {
row[field] = moment(row[field]).add(addHours, "hours").format(pattern);
} else {
row[field] = moment(row[field]).format(pattern);
}
}
}
}
addWhereTime(where, field, begin, end) {
if (!begin && !end) {
return;
}
if (begin && end) {
where[field] = {
[this.db.Op.between]: [begin, end]
};
} else if (begin && !end) {
where[field] = {
[this.db.Op.gte]: begin
};
} else if (!begin && end) {
where[field] = {
[this.db.Op.lte]: end
};
}
}
async callms(sveName, apiName, params) {
var reqUrl = this.micro[sveName];
if (!reqUrl) {
return system.getResult(null, "未找到【" + sveName + "】服务,请检查settings文件是否存在");
}
if (!apiName) {
return system.getResult(null, "apiName不能为空");
}
try {
var params = {
"action_process": "xgg-admin",
"action_type": apiName,
"action_body": params || {},
}
console.log(params, reqUrl, "-------------------------------");
var rs = await this.restClient.execPost(params, reqUrl);
if (rs && rs.stdout) {
return JSON.parse(rs.stdout);
}
return system.getResult(null, rs);
} catch (error) {
console.log(error)
this.logCtl.error({
optitle: "微服务请求失败",
op: "sveName = " + sveName + "; apiName = " + apiName,
content: "params = " + JSON.stringify(params),
clientIp: ""
});
return system.getResult(null, error.message);
}
}
trim(o) {
if (!o) {
return "";
}
return o.toString().trim();
}
}
module.exports = ServiceBase;
\ No newline at end of file
const system = require("../../system");
const uuidv4 = require('uuid/v4');
const md5 = require("MD5");
class PushUtils {
constructor() {
this.logCtl = system.getObject("web.common.oplogCtl");
this.cacheManager = system.getObject("db.common.cacheManager");
this.merchantpushlogSve = system.getObject("service.merchant.merchantpushlogSve");
this.execClient = system.getObject("util.execClient");
this.merchantpushSve = system.getObject("service.merchant.merchantpushSve");
}
getUUID() {
var uuid = uuidv4();
var u = uuid.replace(/\-/g, "");
return u;
}
async getCachePushItemUrl(merchant_id) {
return await this.cacheManager["MerchantPushUrlCache"].cache(merchant_id, null, 3600);
}
/**
* 推送到第三方数据
* @param {*} reqUrl 请求推送的url
* @param {*} params 推送的参数
*/
async push(merchantId, field, params) {
try {
var pushConfig = await this.getCachePushItemUrl(merchantId) || {};
var reqUrl = pushConfig[field];
if(!reqUrl) {
this.logCtl.error({
optitle: "推送到第三方数据异常error",
op: "merchantId = " + merchantId + "; reqUrl is empty, field = " + field,
content: "reqUrl is empty",
clientIp: "pushUtils中没有ip"
});
return;
}
// 签名
params.sign = await this.createSign(params, merchantId);
params.requestid = this.getUUID();
var rtn = await this.execClient.execPost(params, reqUrl);
var returnValue = 0;
if (rtn.stdout) {
var result = JSON.parse(rtn.stdout);
if (result.code == "success") {
returnValue = 1;
}
}
//记录推送结果
this.merchantpushlogSve.create({
merchant_id: merchantId,//商户id
api: reqUrl,//接口地址
params: JSON.stringify(params),//推送数据信息
rs: rtn.stdout,//推送返回结果
success: returnValue//是否推送成功
});
} catch (e) {
console.log(e.stack);
this.logCtl.error({
optitle: "推送到第三方数据异常error",
op: reqUrl + ";params=" + JSON.stringify(params) + ";reqid=" + params.requestid,
content: e.stack,
clientIp: "pushUtils中没有ip"
});
}
}
/**
* 多次推送到第三方数据
* @param {*} reqUrl 请求推送的url
* @param {*} params 推送的参数
*/
async pushMany(reqUrl, params) {
try {
params.requestid = this.getUUID();
var rtn = this.execClient.execPost(params, reqUrl);
//TODO:可以做多次推送,规则待定
// var result = JSON.parse(rtn.stdout);
// if (result && result.code == 200) {
// var resultdata = result.data;
// return { code: 1, msg: "success" };
// } else {
// return { code: -1, msg: "err" };
// }
} catch (e) {
this.logCtl.error({
optitle: "多次推送到第三方数据异常error",
op: url + ";params=" + JSON.stringify(params) + ";reqid=" + params.requestid,
content: e.stack,
clientIp: pobj.clientIp
});
}
}
async createSign(params, appId) {
var appInfo = await this.cacheManager["ApiAppIdCheckCache"].cache(appId, null, 3000);
var signArr = [];
var keys = Object.keys(params).sort();
for (let k = 0; k < keys.length; k++) {
const tKey = keys[k];
if (tKey != "sign" && params[tKey]) {
signArr.push(tKey + "=" + params[tKey]);
}
}
var resultSignStr = signArr.join("&") + "&key=" + appInfo.appSecret;
return md5(resultSignStr).toUpperCase();
}
}
module.exports = PushUtils;
<a name="menu">目录</a>
1. [我的个体户](#myPage)
1. [个体户开票列表](#invoicePage)
1. [个体户详情](#info)
## **<a name="myPage"> 我的个体户 </a>**
[返回到目录](#menu)
##### URL
[/web/business/businessmenCtl/myPage]
#### 参数格式 `JSON`
#### HTTP请求方式 `POST`
``` javascript
{
"currentPage": "1",
"pageSize": "3",
"orderId": ""
}
```
#### 返回结果
```javascript
{
"status": 0,
"msg": "success",
"data": {
"count": 8,
"rows": [
{
"id": "12795594625000138", // 个体户id
"order_id": "13180532689003786", // 订单编号
"channelOrderNo": "xxxxxxxxx116", // 渠道订单号
"gstatus": "2000", // 个体户状态
"gstatusName": "办理中", // 个体户状态名称
// 个体工商户执照信息
"legalName": "杨庆菊", // 法人姓名
"legalMobile": "杨庆菊手机号", // 法人手机号
"legalIdcard": "2222222222", // 法人身份证号
"name": "杨庆菊有限公司", // 个体户名称
"creditCode": "xxxxxx333333333", // 统一社会信用代码
"businessPlace": "来广营地铁站", // 经营场所
"businessScope": "1,2,3,4,5,", // 经营范围
"regDate": "2019-01-22", // 注册日期
"businessImg": "http:1.png", // 执照照片
// 个体工商户刻章信息
"gongzhang": "http://gongzhang.png", // 公章
"caiwuzhang": "http://caiwuzhang.png", // 财务章
"fapiaozhang": "http://fapiaozhang.png", // 发票章
"hetongzhang": "http://hetongzhang.png", // 合同章
"farenzhang": "http://farenzhang.png", // 法人章
// 个体户开户信息
"isBank": 1, // 是否开户 0否 1是
"bankName": "https://bankName", // 账户名称
"bankNo": "https://bankNo", // 帐号
"bank": "https://bank", // 开户行
"bankImg": "https://bankImg", // 账户图片
"caImg": "12313212", // CA照片
"taxRegDay": "2019-01-01", // 税务登记日
"taxOrg": "12333", // 税务机构名称
"courierNo": "111111111", // 快递单号
"courierImg": "快递交接图片", // 快递交接图片
"taxUpType":"10", // 个税累计
"costRate":"1122", // 核定成本费用率
"signNotes":" 12qwdwqd", // 签约备注
"commonTaxLadder": "[{ }]", // 普票个税梯度
"commonOtherLadder": "[{}]", // 普票票增值税、附加税梯度
"specialTaxLadder": "[{}]", // 专票个税梯度
"specialOtherLadder": "[{}]" // 专票票增值税、附加税梯度
"signTime": "" // 签约时间
"created_at": "2019-10-06 07:19:07",
"updated_at": "2019-10-06 07:38:57",
}
]
}
}
```
## **<a name="invoicePage"> 个体户开票列表 </a>**
[返回到目录](#menu)
##### URL
[/web/business/businessmenCtl/invoicePage]
#### 参数格式 `JSON`
#### HTTP请求方式 `POST`
``` javascript
{
"currentPage": "1",
"pageSize": "3",
"orderId": ""
}
```
#### 返回结果
```javascript
{
"status": 0,
"msg": "success",
"data": {
"count": 8,
"rows": [
{
"id": "12795594625000138", // 个体户id
"order_id": "13180532689003786", // 订单编号
"channelOrderNo": "xxxxxxxxx116", // 渠道订单号
"gstatus": "2000", // 个体户状态
"gstatusName": "办理中", // 个体户状态名称
// 个体工商户执照信息
"legalName": "杨庆菊", // 法人姓名
"legalMobile": "杨庆菊手机号", // 法人手机号
"legalIdcard": "2222222222", // 法人身份证号
"name": "杨庆菊有限公司", // 个体户名称
"creditCode": "xxxxxx333333333", // 统一社会信用代码
"businessPlace": "来广营地铁站", // 经营场所
"businessScope": "1,2,3,4,5,", // 经营范围
"regDate": "2019-01-22", // 注册日期
"businessImg": "http:1.png", // 执照照片
// 个体工商户刻章信息
"gongzhang": "http://gongzhang.png", // 公章
"caiwuzhang": "http://caiwuzhang.png", // 财务章
"fapiaozhang": "http://fapiaozhang.png", // 发票章
"hetongzhang": "http://hetongzhang.png", // 合同章
"farenzhang": "http://farenzhang.png", // 法人章
// 个体户开户信息
"isBank": 1, // 是否开户 0否 1是
"bankName": "https://bankName", // 账户名称
"bankNo": "https://bankNo", // 帐号
"bank": "https://bank", // 开户行
"bankImg": "https://bankImg", // 账户图片
"caImg": "12313212", // CA照片
"taxRegDay": "2019-01-01", // 税务登记日
"taxOrg": "12333", // 税务机构名称
"courierNo": "111111111", // 快递单号
"courierImg": "快递交接图片", // 快递交接图片
"taxUpType":"10", // 个税累计
"costRate":"1122", // 核定成本费用率
"signNotes":" 12qwdwqd", // 签约备注
"commonTaxLadder": "[{ }]", // 普票个税梯度
"commonOtherLadder": "[{}]", // 普票票增值税、附加税梯度
"specialTaxLadder": "[{}]", // 专票个税梯度
"specialOtherLadder": "[{}]" // 专票票增值税、附加税梯度
"signTime": "" // 签约时间
"created_at": "2019-10-06 07:19:07",
"updated_at": "2019-10-06 07:38:57",
}
]
}
}
```
## **<a name="info"> 个体户详情 </a>**
[返回到目录](#menu)
##### URL
[/web/business/businessmenCtl/info]
#### 参数格式 `JSON`
#### HTTP请求方式 `POST`
``` javascript
{
"id": "14", // 个体工商户id
}
```
#### 返回结果
```javascript
{
"status": 0,
"msg": "success",
"data": {
"id": "12795594625000138", // 个体户id
"order_id": "13180532689003786", // 订单编号
"channelOrderNo": "xxxxxxxxx116", // 渠道订单号
"gstatus": "2000", // 个体户状态
"gstatusName": "办理中", // 个体户状态名称
// 个体工商户执照信息
"legalName": "杨庆菊", // 法人姓名
"legalMobile": "杨庆菊手机号", // 法人手机号
"legalIdcard": "2222222222", // 法人身份证号
"name": "杨庆菊有限公司", // 个体户名称
"creditCode": "xxxxxx333333333", // 统一社会信用代码
"businessPlace": "来广营地铁站", // 经营场所
"businessScope": "1,2,3,4,5,", // 经营范围
"regDate": "2019-01-22", // 注册日期
"businessImg": "http:1.png", // 执照照片
// 个体工商户刻章信息
"gongzhang": "http://gongzhang.png", // 公章
"caiwuzhang": "http://caiwuzhang.png", // 财务章
"fapiaozhang": "http://fapiaozhang.png", // 发票章
"hetongzhang": "http://hetongzhang.png", // 合同章
"farenzhang": "http://farenzhang.png", // 法人章
// 个体户开户信息
"isBank": 1, // 是否开户 0否 1是
"bankName": "https://bankName", // 账户名称
"bankNo": "https://bankNo", // 帐号
"bank": "https://bank", // 开户行
"bankImg": "https://bankImg", // 账户图片
"caImg": "12313212", // CA照片
"taxRegDay": "2019-01-01", // 税务登记日
"taxOrg": "12333", // 税务机构名称
"courierNo": "111111111", // 快递单号
"courierImg": "快递交接图片", // 快递交接图片
"taxUpType":"10", // 个税累计
"costRate":"1122", // 核定成本费用率
"signNotes":" 12qwdwqd", // 签约备注
"commonTaxLadder": "[{ }]", // 普票个税梯度
"commonOtherLadder": "[{}]", // 普票票增值税、附加税梯度
"specialTaxLadder": "[{}]", // 专票个税梯度
"specialOtherLadder": "[{}]" // 专票票增值税、附加税梯度
"signTime": "" // 签约时间
"created_at": "2019-10-06 07:19:07",
"updated_at": "2019-10-06 07:38:57",
}
}
```
## **<a name="businessmenSign"> 用户签约 </a>**
[返回到目录](#menu)
##### URL
[/web/order/businessmenCtl/businessmenSign]
#### 参数格式 `JSON`
#### HTTP请求方式 `POST`
``` javascript
{
"id": "1",
"commonTaxLadder": "[{\"minValue\": 0, \"rate\": \"0\", \"maxValue\": 3000000 }]",
"commonOtherLadder": "[{\"minValue\": 0, \"rate\": \"0\", \"maxValue\": 3000000 }]",
"specialTaxLadder": "[{\"minValue\": 0, \"rate\": \"0\", \"maxValue\": 3000000 }]",
"specialOtherLadder": "[{\"minValue\": 0, \"rate\": \"0\", \"maxValue\": 3000000 }]"
}
```
#### 返回结果
```javascript
{
"status": 0,
"msg": "success",
}
```
<a name="menu">目录</a>
1. [提交订单](#add)
1. [我的订单](#myPage)
1. [订单详情](#info)
## **<a name="add"> 提交订单 </a>**
[返回到目录](#menu)
##### URL
[/web/order/orderCtl/add]
#### 参数格式 `JSON`
#### HTTP请求方式 `POST`
``` javascript
{
"names": "11123", // 个体户名称
"legalName": "1111", // 法人姓名
"legalMobile": "22222", // 法人手机号
"legalImg": "法人照片", // 法人中哦阿扁
"idcard": "123身份证", // 法人身份证号码
"idcardFront": "在正面", // 身份证正面图
"idcardBack": "反面", // 身份证背面图
"domicile_id": "12218127596000645", // 注册地id
"domicileName":"" // 注册地名称
"businessScope_id": "12218127596000645", // 经营范围id
"businessType": "科技类", // 经营范围
"businessScope": "科技类是啥", // 经营范围详情
"mailAddr": "", // 邮寄地址
"mailTo": "", // 收件人
"mailMobile": "", // 收件人电话
}
```
#### 返回结果
```javascript
{
"status": 0,
"msg": "success",
"data": "13181392299000741" // 返回订单id
}
```
## **<a name="myPage"> 我的订单 </a>**
[返回到目录](#menu)
##### URL
[/web/order/orderCtl/myPage]
#### 参数格式 `JSON`
#### HTTP请求方式 `POST`
``` javascript
{
"currentPage": "1",
"pageSize": "3",
"createdBegin": "",
"createdEnd": ""
}
```
#### 返回结果
```javascript
{
"status": 0,
"msg": "success",
"data": {
"count": 12,
"rows": [
{
"id": "13180527789003380", // 订单号\订单号
"merchant_id": "11064622752480048", // 商户id
"channelOrderNo": "xxxxxxxxx111", // 渠道订单号
"price": 300000, // 订单价格
"legalName": "杨庆菊", // 法人姓名
"legalMobile": "杨庆菊手机号", // 法人手机号
"legalImg": "法人照片", // 法人照片
"idcard": "123身份证", // 身份证号码
"idcardFront": "在正面", // 身份证正面图
"idcardBack": "反面", // 身份证反面图
"names": "11111", // 个体工商户名称
"domicile_id": "12218127596000645", // 经营范围id
"domicileName":"" // 注册地名称
"businessScope_id": "12218127596000645", // 经营范围id
"businessType": "太难了", // 经营范围
"businessScope": "太狠了", // 经营范围详情
"mailAddr": "", // 邮寄地址
"mailTo": "", // 收件人
"mailMobile": "", // 收件人电话
"capital": "到底是多少", // 注册资本
"ostatusName": "未付款", // 订单状态名称
"ostatus": "1000", // 订单状态
"assignTime": null, // 分配时间
"created_at": "2019-10-05 06:57:28", // 创建时间
},
...
]
},
"requestid": "ae2a9c2e2ff6497e8cc9fd2c7fac9fe8"
}
```
## **<a name="info"> 订单详情 </a>**
[返回到目录](#menu)
##### URL
[/web/order/orderCtl/info]
#### 参数格式 `JSON`
#### HTTP请求方式 `POST`
``` javascript
{
"id": "1", // 订单id
}
```
#### 返回结果
```javascript
{
"id": "13180527789003380", // 订单号\订单号
"merchant_id": "11064622752480048", // 商户id
"channelOrderNo": "xxxxxxxxx111", // 渠道订单号
"price": 300000, // 订单价格
"legalName": "杨庆菊", // 法人姓名
"legalMobile": "杨庆菊手机号", // 法人手机号
"legalImg": "法人照片", // 法人照片
"idcard": "123身份证", // 身份证号码
"idcardFront": "在正面", // 身份证正面图
"idcardBack": "反面", // 身份证反面图
"names": "11111", // 个体工商户名称
"domicile_id": "12218127596000645", // 经营范围id
"domicileName":"" // 注册地名称
"businessScope_id": "12218127596000645", // 经营范围id
"businessType": "太难了", // 经营范围
"businessScope": "太狠了", // 经营范围详情
"mailAddr": "", // 邮寄地址
"mailTo": "", // 收件人
"mailMobile": "", // 收件人电话
"capital": "到底是多少", // 注册资本
"ostatusName": "未付款", // 订单状态名称
"ostatus": "1000", // 订单状态
"assignTime": null, // 分配时间
"created_at": "2019-10-05 06:57:28", // 创建时间
"businessmen": { // 个体工商户对象,没有为空
"id": "12795594625000138", // 个体户id
"order_id": "13180532689003786", // 订单编号
"channelOrderNo": "xxxxxxxxx116", // 渠道订单那好
"gstatus": "1100", // 个体户状态
"gstatusName": "待签约", // 个体户状态名称
// 个体工商户执照信息
"legalName": "杨庆菊", // 法人姓名
"legalMobile": "杨庆菊手机号", // 法人手机号
"legalIdcard": "2222222222", // 法人身份证号
"name": "杨庆菊有限公司", // 个体户名称
"creditCode": "xxxxxx333333333", // 统一社会信用代码
"businessPlace": "来广营地铁站", // 经营场所
"businessScope": "1,2,3,4,5,", // 经营范围
"regDate": "2019-01-22", // 注册日期
"businessImg": "http:1.png", // 执照照片
// 个体工商户刻章信息
"gongzhang": "http://gongzhang.png", // 公章
"caiwuzhang": "http://caiwuzhang.png", // 财务章
"fapiaozhang": "http://fapiaozhang.png", // 发票章
"hetongzhang": "http://hetongzhang.png", // 合同章
"farenzhang": "http://farenzhang.png", // 法人章
// 个体户开户信息
"isBank": 1, // 是否开户 0否 1是
"bankName": "https://bankName", // 账户名称
"bankNo": "https://bankNo", // 帐号
"bank": "https://bank", // 开户行
"bankImg": "https://bankImg", // 账户图片
"caImg": "12313212", // CA照片
"taxRegDay": "2019-01-01", // 税务登记日
"taxOrg": "12333", // 税务机构名称
"courierNo": "111111111", // 快递单号
"courierImg": "快递交接图片", // 快递交接图片
"taxUpType":"10", // 个税累计
"costRate":"1122", // 核定成本费用率
"signNotes":" 12qwdwqd", // 签约备注
"commonTaxLadder": "[{ }]", // 普票个税梯度
"commonOtherLadder": "[{}]", // 普票票增值税、附加税梯度
"specialTaxLadder": "[{}]", // 专票个税梯度
"specialOtherLadder": "[{}]" // 专票票增值税、附加税梯度
"signTime": "" // 签约时间
"created_at": "2019-10-06 07:19:07",
"updated_at": "2019-10-06 07:38:57",
}
}
```
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