Commit 33f7fcf1 by 王昆

gsb

parent 00ed1a86
#!/bin/bash #!/bin/bash
FROM registry.cn-beijing.aliyuncs.com/hantang/node105:v2 FROM registry.cn-beijing.aliyuncs.com/hantang/node105:v2
MAINTAINER jy "jiangyong@gongsibao.com" MAINTAINER jy "jiangyong@gongsibao.com"
ADD xggsve-order/apps/xggsve-order/ ADD xggsve-invoice/apps/xggsve-invoice/
WORKDIR /apps/xggsve-order/ WORKDIR /apps/xggsve-invoice/
RUN cnpm install -S RUN cnpm install -S
CMD ["node","/apps/xggsve-order/main.js"] CMD ["node","/apps/xggsve-invoice/main.js"]
......
...@@ -65,17 +65,60 @@ class APIBase extends DocBase { ...@@ -65,17 +65,60 @@ class APIBase extends DocBase {
return x >= 0; return x >= 0;
} }
async checkAcck(gname, methodname, pobj, query, req) { async checkAcck(gname, methodname, pobj, query, req) {
return system.getResultSuccess(); var appInfo = null;
var result = system.getResultSuccess();
var ispass = await this.isCheckWhiteList(gname, methodname);
var appkey = req.headers["accesskey"];
var app_id = req.headers["app_id"];
if (ispass) {
return result;
}//在白名单里面
if (app_id) {
appInfo = await this.cacheManager["ApiAppIdCheckCache"].cache(app_id, null, 3000);
if (!appInfo) {
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;
// }
}//验签
else if (appkey) {
appInfo = await this.cacheManager["ApiAccessKeyCheckCache"].cache(appkey, { status: true }, 3000);
if (!appInfo || !appInfo.app) {
result.status = system.tokenFail;
result.msg = "请求头accesskey失效,请重新获取";
}
}//验证accesskey
else {
result.status = -1;
result.msg = "请求头没有相关访问参数,请验证后在进行请求";
}
return result;
} }
async doexec(gname, methodname, pobj, query, req) { async doexec(gname, methodname, pobj, query, req) {
var requestid = this.getUUID(); var requestid = this.getUUID();
try { try {
//验证accesskey或验签
// 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"];
}
if (query) {
query.merchant_id = req.headers["app_id"];
}
var rtn = await this[methodname](pobj, query, req); var rtn = await this[methodname](pobj, query, req);
rtn.requestid = requestid; rtn.requestid = requestid;
this.oplogSve.createDb({ this.oplogSve.createDb({
appid: req.headers["app_id"] || "", appid: req.headers["app_id"] || "",
appkey: "", appkey: req.headers["accesskey"] || "",
requestId: requestid, requestId: requestid,
op: req.classname + "/" + methodname, op: req.classname + "/" + methodname,
content: JSON.stringify(pobj), content: JSON.stringify(pobj),
...@@ -88,8 +131,8 @@ class APIBase extends DocBase { ...@@ -88,8 +131,8 @@ class APIBase extends DocBase {
} catch (e) { } catch (e) {
console.log(e.stack, "api调用出现异常,请联系管理员..........") console.log(e.stack, "api调用出现异常,请联系管理员..........")
this.logCtl.error({ this.logCtl.error({
appid: "" + pobj.action_process, appid: req.headers["app_id"] || "",
appkey: "", appkey: req.headers["accesskey"] || "",
requestId: requestid, requestId: requestid,
op: pobj.classname + "/" + methodname, op: pobj.classname + "/" + methodname,
content: e.stack, content: e.stack,
......
var APIBase = require("../../api.base");
var system = require("../../../system");
var settings = require("../../../../config/settings");
class ActionAPI extends APIBase {
constructor() {
super();
this.invoiceSve = system.getObject("service.invoice.invoiceSve");
this.applySve = system.getObject("service.invoice.applySve");
this.delivererSve = system.getObject("service.invoice.delivererSve");
}
/**
* 接口跳转
* action_process 执行的流程
* action_type 执行的类型
* action_body 执行的参数
*/
async springboard(pobj, qobj, req) {
if (!pobj.action_process) {
return system.getResult(null, "action_process参数不能为空");
}
if (!pobj.action_type) {
return system.getResult(null, "action_type参数不能为空");
}
return await this.sjbOpActionProcess(pobj.action_process, pobj.action_type, pobj.action_body);
}
async sjbOpActionProcess(action_process, action_type, action_body) {
var opResult = null;
switch (action_type) {
case "verification": // 验证该商户是不是存在正在审核的发票
opResult = await this.applySve.apiVerificationByBusinessmenCreditCode(action_body);
break;
case "calcInvoice": // 发票试算接口
opResult = await this.applySve.apiCalcInvoice(action_body);
break;
case "saveInvoice": // 发票申请单提交接口
opResult = await this.applySve.apiSaveInvoice(action_body);
break;
case "queryApplyInvoices": // 发票申请列表(平台)
opResult = await this.applySve.apiQueryApplyInvoices(action_body);
break;
case "queryInvoices": // 发票列表(平台)
opResult = await this.invoiceSve.apiQueryInvoices(action_body);
break;
case "delivererApplyInvoices": //发票申请列表(交付商)
opResult = await this.delivererSve.apiDelivererApplyInvoices(action_body);
break;
case "delivererInvoices": //发票列表(交付商)
opResult = await this.delivererSve.apiDelInvs(action_body);
break;
case "queryInvoice": // 发票明细(平台)
opResult = await this.applySve.apiQueryInvoice(action_body);
break;
case "queryInvoiceDeliverer": // 发票明细(交付商)
opResult = await this.delivererSve.apiQueryInvoiceDeliverer(action_body);
break;
case "apiCancelInvoice": // 发票申请单撤回
opResult = await this.applySve.apiCancelInvoice(action_body);
break;
case "queryProcess": // 查看业务办理(平台)
opResult = await this.delivererSve.apiQueryProcess(action_body);
break;
case "platformAssignment": // 平台审批
opResult = await this.applySve.apiAssignment(action_body);
break;
case "delivererAssignment": //交付商审批
opResult = await this.delivererSve.apiAssignment(action_body);
break;
case "txPayment": //完税证明更新
opResult = await this.invoiceSve.apiTxPayment(action_body);
break;
case "queryTxPayment": //完税证明更新
opResult = await this.invoiceSve.apiQueryTxPayment(action_body);
break;
case "redRushInvoice": //红冲
opResult = await this.applySve.apiRedRushInvoice(action_body);
break;
case "updateEmail": //平台更新邮寄地址
opResult = await this.delivererSve.apiUpEmNo(action_body);
break;
case "statTransData": //交易数据
opResult = await this.applySve.apiStatTransData(action_body);
break;
case "statBusinessData": //发票办理
opResult = await this.applySve.apiStatBusinessData(action_body);
break;
case "statDeliverData": //交付商业务概览
opResult = await this.delivererSve.apiStatDeliverData(action_body);
break;
case "delStatTransData": //交易数据(交付商)
opResult = await this.delivererSve.apiDelStatTransData(action_body);
break;
case "delStatBusinessData": //发票办理(交付商)
opResult = await this.delivererSve.apiDelStatBusinessData(action_body);
break;
default:
opResult = system.getResult(null, "action_type参数错误");
break;
}
return opResult;
}
exam() {
return `<pre>
9.calcInvoice:发票试算接口
功能描述:
商户使用试算接口,计算出当前开票所需要缴纳的个税、增值税、附加税、服务费等信息,用于开票前的展示,如果商户业务不需要展示,忽略此接口
请求参数:
{
"action_process": "sjb",
"action_type": "calcInvoice",
"action_body": {
"invoiceList": [
{
"businessmenCreditCode":"1111",
"invoiceTime": "2019-09-19",
"invoiceAmt":440000000,
"type": 1
}
],
"times_tamp": 1568713248,
"sign": "D4393F17C96CDA582C1EE5FF0053671E"
}
}
请求参数说明:
sign : String : 必填 :签名
times_tamp : long : 必填 :时间戳
invoiceList : Array : 必填 :发票试算列表,最多不超过10个,不参与签名
businessmenCreditCode : String : 必填 :个体工商户统一社会信用代码
invoiceTime : String : 必填 :开票时间(YYYY-MM-DD)
invoiceAmt : bigint : 必填 :开票金额(分)
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
}
},
"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:申请开票接口
功能描述:
商户为个体工商户申请开发票,批量开,一次不超过10条发票记录
请求参数:
{
"action_process": "sjb",
"action_type": "saveInvoice",
"action_body": {
"invoiceList": [
{
"businessmenCreditCode":"1111",
"invoiceTime": "2019-09-19",
"applyNo": "100001",
"invoiceAmt":330000,
"settleImg": "https://bpohhr.gongsibao.com",
"type": 1
},
{
"businessmenCreditCode":"2222",
"applyNo": "100002",
"invoiceTime": "2019-09-19",
"invoiceAmt":200000,
"settleImg": "https://bpohhr.gongsibao.com",
"type": 1
}
],
"times_tamp": 1568713248,
"sign": "D4393F17C96CDA582C1EE5FF0053671E"
}
}
请求参数说明:
sign : String : 必填 :签名
times_tamp : long : 必填 :时间戳
invoiceList : Array : 必填 :开票申请列表,最多不超过10个,不参与签名
businessmenCreditCode : String : 必填 :个体工商户统一社会信用代码
applyNo : String : 必填 :开票申请编码(商户内唯一)
invoiceTime : String : 必填 :开票时间(YYYY-MM-DD)
invoiceAmt : bigint : 必填 :开票金额(分)
settleImg : String : 必填 :结算单图片地址
type : int : 必填 :开票类型 0普票 1专票
返回值:
{
"status": 0,
"msg": "success",
"data": {
"1111": {
"code": 1,
"msg": "success"
},
"2222": {
"code": 1,
"msg": "success"
}
},
"requestid": "a39a364d83c14664b8e3399387fa847d"
}
返回值说明:
data : Object : 发票处理结果,Map格式,key为个体工商户统一社会信用代码
"1" : Object : 个体工商户统一社会信用代码为key的对象
"code" : int : 该个体工商户试算状态 1成功 -1失败
"msg" : String : 试算结果提示,错误时返回错误信息
11.cancelInvoice:发票申请撤回接口
功能描述:
商户可再开票申请之后,公司宝财务审核之前进行发票撤回,其他情况联系客户经理
请求参数:
{
"action_process": "sjb",
"action_type": "cancelInvoice",
"action_body": {
"applyNo": "100001"
}
}
请求参数说明:
sign : String : 必填 :签名
times_tamp : long : 必填 :时间戳
applyNo : String : 必填 :开票申请编号
返回值:
{
"status": 0,
"msg": "success",
"data": "success",
"requestid": "090bde8c5bb74b9d8c6b97beabf39161"
}
12.queryInvoice:发票查询接口
功能描述:
查询某次开票申请的信息,包括发票状态、开票信息、邮寄信息、完税证明等信息
请求参数:
{
"action_process": "sjb",
"action_type": "queryInvoice",
"action_body": {
"applyNo": "100001"
}
}
请求参数说明:
sign : String :签名
times_tamp : long :时间戳
applyNo : String :开票申请编号
返回值:
{
merchant_id // 商户id
applyNo // 发票申请编号
status // 发票状态 00开票申请 10已撤回 20审核驳回 30审核通过 40已开票 50已邮寄
auditRemark // 审核备注
invoiceNo // 发票编号
invoiceTime // 开票时间
invoiceImg // 发票照片
payVoucher // 支付凭证
courierNo // 快递单号
courierImg // 快递交接单图片
taxNo // 完税批号
taxTime // 完税时间
taxVoucher // 完税证明(图片地址)
}
返回值说明:
merchant_id : bigint : 商户id
applyNo : String : 发票申请编号
status : String : 发票状态 00开票申请 10已撤回 20审核驳回 30审核通过 40已开票 50已邮寄
auditRemark : String : 审核备注
invoiceNo : String : 发票编号
invoiceTime : String : 开票时间(YYYY-MM-DD)
invoiceImg : String : 发票照片
payVoucher : String : 支付凭证
courierNo : String : 快递单号
courierImg : String : 快递交接单图片
complateTax : int : 是否完税 0否 1是
taxNo : String : 完税批号
taxTime : String : 完税时间
taxVoucher : String : 完税证明(图片地址)
13.queryTaxInvoice:完税证明查询
功能描述:
查询发票完税证明信息
请求参数:
{
"action_process": "sjb",
"action_type": "queryTaxInvoice",
"action_body": {
"applyNo": "100001"
}
}
请求参数说明:
sign : String :签名
times_tamp : long :时间戳
applyNo : String :开票申请编号
返回值:
{
merchant_id // 商户id
applyNo // 发票申请编号
complateTax // 是否完税 0否 1是
taxNo // 完税批号
taxTime // 完税时间
taxVoucher // 完税证明(图片地址)
}
返回值说明:
merchant_id : bigint : 商户id
applyNo : String : 发票申请编号
complateTax : int : 是否完税 0否 1是
taxNo : String : 完税批号
taxTime : String : 完税时间
taxVoucher : String : 完税证明(图片地址)
14: queryCourierTrace:查询邮寄进度
功能描述:
查询邮寄进度
请求参数:
{
"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 : 发票申请编号
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 : 发票申请编号
courierNo : String : 快递单号
courierStatus : String : 邮寄状态
courierTime : String : 时间(YYYY-MM-DD HH:mm:ss)
desc : String : 当前状态描述信息
------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------------
通知回调商户接口:需要商户提供以下接收的回调地址,回调方式:POST
1. 充值审核
2. 商户修改接口
3. 订单修改接口
4. 订单状态变更推送
5. 个体户合同审核结果推送
6. 个体户签约结果推送
7. 发票状态变更推送
8. 发票完税证明推送
1.充值审核
功能描述:商户提交发票申请后,公司宝财务在审核该申请之后,通知商户审核状态
推送参数:
{
merchant_id : bigint :商户id
outTradeNo : String :充值流水号,
status : int :充值状态 1已认证 2审核失败
remark : String :审核备注
}
4. 订单状态变更推送
功能描述:订单状态发生变更后,公司宝将状态变更内容推送给商户
推送参数:
{
merchant_id : bigint : 商户id
status : String : 00待处理 05执照办理中 10已出执照 15刻章办理中 20已刻章 25银行开户中 30银行已开户 35税务报到中 40已税务报到 50已邮寄
channelOrderNo : String : 渠道订单号
// ----- 出执照推送数据 -----
name : String : 个体工商户名称
creditCode : String : 统一社会信用代码
businessPlace : String : 经营场所
businessScope : String : 经营范围
regDate : String : 注册日期 (YYYY-MM-DD)
businessImg : String : 执照照片
orderNo : String : 订单号
legalName : String : 法人姓名
legalMobile : String : 法人电话
// ----- 刻章推送数据 -----
gongzhang : String : 公章
caiwuzhang : String : 财务章
businessImg : String : 执照照片
fapiaozhang : String : 发票章
hetongzhang : String : 合同章
farenzhang : String : 法人章
// ----- 开户推送数据 -----
isBank : String : 是否开户
bankName : String : 账户名称
bankNo : String : 账户号
bank : String : 开户行
bankImg : String : 账户信息
// ----- 税务报到推送数据 -----
caImg : String : CA照片
taxRegDay : String : 税务登记日
taxOrg : String : 税务机构名称
// ----- 邮寄推送数据 -----
courierNo : String : 快递单号
courierImg : String : 快递交接单图片
}
5. 订单状态变更推送
功能描述:订单状态发生变更后,公司宝将状态变更内容推送给商户
推送参数:
{
merchant_id : bigint : 商户id
status : String : 00待处理 05执照办理中 10已出执照 15刻章办理中 20已刻章 25银行开户中 30银行已开户 35税务报到中 40已税务报到 50已邮寄
channelOrderNo : String : 渠道订单号
// ----- 出执照推送数据 -----
name : String : 个体工商户名称
creditCode : String : 统一社会信用代码
businessPlace : String : 经营场所
businessScope : String : 经营范围
regDate : String : 注册日期 (YYYY-MM-DD)
businessImg : String : 执照照片
orderNo : String : 订单号
legalName : String : 法人姓名
legalMobile : String : 法人电话
// ----- 刻章推送数据 -----
gongzhang : String : 公章
caiwuzhang : String : 财务章
businessImg : String : 执照照片
fapiaozhang : String : 发票章
hetongzhang : String : 合同章
farenzhang : String : 法人章
// ----- 开户推送数据 -----
isBank : String : 是否开户
bankName : String : 账户名称
bankNo : String : 账户号
bank : String : 开户行
bankImg : String : 账户信息
// ----- 税务报到推送数据 -----
caImg : String : CA照片
taxRegDay : String : 税务登记日
taxOrg : String : 税务机构名称
// ----- 邮寄推送数据 -----
courierNo : String : 快递单号
courierImg : String : 快递交接单图片
}
5. 个体户合同审核结果推送
6. 个体户签约结果推送
7.发票状态变更推送
功能描述:发票状态变更后,公司宝将发票状态变更内容推送给商户
推送参数:
{
merchant_id : bigint :商户id
applyNo : String :发票申请编号
status : String :发票状态 00开票申请 10已撤回 20审核驳回 30审核通过 40已开票 50已邮寄
// ----- 发票审核数据字段 -----
auditRemark : String :审核备注
// ----- 发票开具数据字段 -----
invoiceNo : String :发票编号
invoiceTime : String :开票时间
invoiceImg : String :发票照片
payVoucher : String :支付凭证
// ----- 发票邮件数据字段 -----
courierNo : String :快递单号
courierImg : String :快递交接单图片
}
8.发票完税证明推送
功能描述:公司宝客户经理再处理完税证明后,公司宝将完税证明信息推送给商户
推送参数:
{
merchant_id : bigint :商户id
applyNo : String :发票申请编号
complateTax : String :是否完税 0否 1是
taxNo : String :完税批号
taxTime : String :完税时间
taxVoucher : String :完税证明(图片地址)
}
<pre/>`;
}
classDesc() {
return {
groupName: "op",
groupDesc: "元数据服务包",
name: "ActionAPI",
desc: "此类是对外提供接口服务",
exam: "",
};
}
methodDescs() {
return [
{
methodDesc: `<pre>请求地址:http://sj.app.com:3002/api/op/action/springboard
请求时需要在请求头中增加app_id参数信息,app_id由平台提供给调用方
方法中的签名只有action_body中的参数参与,按照参数的首字母进行ASCII码进行正序排列后进行签名,action_body中的参数为空或参数为list或为json的不参与签名
签名字符串示例:times_tamp=1568713248&key=XXXX,key为平台提供的密钥,对字符串进行
后进行大写转换
方法中需要传递的action_type列表有:
queryMerchant:查询商户
addOrder/putOrder:添加订单/修改订单
queryOrder:订单查询
putContract:个体工商户合同接收接口
queryMerchantAccount:商户账户查询
queryMerchantTrade:商户交易流水查询
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,
}
],
rtnTypeDesc: `<pre>
status: 返回状态,
msg: 返回信息描述,验证有误则为错误提示,
data: 返回数据信息,
requestid: 返回的处理此次请求的凭证
status状态码如下:
0 业务请求处理成功
-1 请求参数验证失败
1200 访问appid失效
1300 签名验证失败
<pre/>`,
rtnType: `<pre>
{
"status": 0,
"msg": "success",
"data": {},
"requestid": "8cbd498f9d1441b1812ecaa2653933f4"
}
<pre/>`
}
];
}
}
module.exports = ActionAPI;
\ No newline at end of file
...@@ -96,7 +96,7 @@ class UserCtl extends CtlBase { ...@@ -96,7 +96,7 @@ class UserCtl extends CtlBase {
await adminUser.save(); await adminUser.save();
var xggadminsid = uuidv4(); var xggadminsid = uuidv4();
xggadminsid = "3cb49932-fa02-44f0-90db-9f06fe02e5c7"; // xggadminsid = "3cb49932-fa02-44f0-90db-9f06fe02e5c7";
await this.redisClient.setWithEx(xggadminsid, JSON.stringify(adminUser), 60 * 60 * 2); await this.redisClient.setWithEx(xggadminsid, JSON.stringify(adminUser), 60 * 60 * 2);
// 处理登录逻辑 // 处理登录逻辑
......
...@@ -12,11 +12,7 @@ class ApiAppIdCheckCache extends CacheBase { ...@@ -12,11 +12,7 @@ class ApiAppIdCheckCache extends CacheBase {
return settings.cacheprefix + "_verify_appid:"; return settings.cacheprefix + "_verify_appid:";
} }
async buildCacheVal(cachekey, inputkey, val, ex, ...items) { async buildCacheVal(cachekey, inputkey, val, ex, ...items) {
var item = await this.merchantDao.getItemByAppId(inputkey); return;
if (!item) {
return null;
}
return JSON.stringify(item);
} }
} }
module.exports = ApiAppIdCheckCache; module.exports = ApiAppIdCheckCache;
...@@ -3,14 +3,11 @@ class Dao { ...@@ -3,14 +3,11 @@ class Dao {
constructor(modelName) { constructor(modelName) {
this.modelName = modelName; this.modelName = modelName;
this.redisClient = system.getObject("util.redisClient"); this.redisClient = system.getObject("util.redisClient");
this.orderBusinessStatus = system.getObject("util.orderBusinessStatus");
var db = system.getObject("db.common.connection").getCon(); var db = system.getObject("db.common.connection").getCon();
this.db = db; this.db = db;
console.log("........set dao model.........."); console.log("........set dao model..........");
this.model = db.models[this.modelName]; this.model = db.models[this.modelName];
} }
async preCreate(u) { async preCreate(u) {
if (!u.id) { if (!u.id) {
u.id = await this.redisClient.genrateId(this.modelName); u.id = await this.redisClient.genrateId(this.modelName);
...@@ -33,7 +30,6 @@ class Dao { ...@@ -33,7 +30,6 @@ class Dao {
}); });
} }
} }
//批量插入 //批量插入
async bulkCreate(objs) { async bulkCreate(objs) {
if (!objs || objs.length == 0) { if (!objs || objs.length == 0) {
...@@ -81,7 +77,6 @@ class Dao { ...@@ -81,7 +77,6 @@ class Dao {
where: qobj where: qobj
}); });
if (en != null) { if (en != null) {
1
return en.destroy(); return en.destroy();
} }
return null; return null;
...@@ -294,7 +289,6 @@ class Dao { ...@@ -294,7 +289,6 @@ class Dao {
async findById(oid) { async findById(oid) {
return this.model.findById(oid); return this.model.findById(oid);
} }
async setListCodeName(list, field) { async setListCodeName(list, field) {
if (!list) { if (!list) {
return; return;
...@@ -325,7 +319,6 @@ class Dao { ...@@ -325,7 +319,6 @@ class Dao {
return map[item[field] || ""] || ""; return map[item[field] || ""] || "";
} }
async getById(id, attrs) { async getById(id, attrs) {
if (!id) { if (!id) {
return null; return null;
...@@ -350,6 +343,7 @@ class Dao { ...@@ -350,6 +343,7 @@ class Dao {
ids: ids ids: ids
}) || []; }) || [];
} }
async getMapByIds(ids, attrs) { async getMapByIds(ids, attrs) {
var result = {}; var result = {};
var list = await this.getListByIds(ids, attrs); var list = await this.getListByIds(ids, attrs);
...@@ -362,6 +356,5 @@ class Dao { ...@@ -362,6 +356,5 @@ class Dao {
} }
return result; return result;
} }
} }
module.exports = Dao; module.exports = Dao;
\ No newline at end of file
const system = require("../../../system");
const Dao = require("../../dao.base"); const Dao = require("../../dao.base");
class IborderDao extends Dao { const system = require("../../../system");
class ApplyDao extends Dao {
constructor() { constructor() {
super(Dao.getModelName(IborderDao)); super(Dao.getModelName(ApplyDao));
this.statusMap = { this.statusMap = {
"1000": "未付款", "0090": "未付款",
"1010": "订单关闭", "1000": "待审核",
"1010": "审核不通过",
"1020": "待分配", "1020": "待分配",
"1030": "待处理", "1030": "待处理",
"1040": "交付商关闭", "1040": "交付商关闭",
"1050": "执照办理中", "1050": "已开具",
"1060": "已出执照", "1060": "待审核",
"1070": "刻章办理中", "1070": "审核通过",
"1080": "已刻章", "1080": "已邮寄",
"1090": "银行开户中", "1090": "完成",
"1100": "银行卡已开户", "1100": "发票撤回",
"1110": "税务报道中", "1200": "红冲",
"1120": "已税务报道", "1300": "审核失败(平台第二次审核)"
"1130": "待审核",
"1140": "审核失败",
"1150": "审核通过",
"1160": "已邮寄",
"1170": "已完成",
}; };
this.ostatusMap = {
"1000": "未付款", this.customerMap = {
"1010": "订单关闭", "0090": "未付款",
"1000": "待审核",
"1030": "待处理", "1030": "待处理",
"1050": "执照办理中", "1050": "已开具",
"1060": "已出执照", "1090": "完成"
"1070": "刻章办理中",
"1080": "已刻章",
"1090": "银行开户中",
"1100": "银行卡已开户",
"1110": "税务报道中",
"1120": "已税务报道",
"1170": "已完成",
}; };
this.deliverTypeMap = { this.deliverMap = {
"10": "交付商交付", "1030": "待处理",
"20": "平台交付", "1040": "交付商关闭",
"30": "平台保存无需交付", "1050": "已开具",
"1060": "待审核",
"1080": "已邮寄",
"1300": "审核失败(平台第二次审核)"
} }
} }
async statOrderByTime(begin, end) {
var sql = [];
sql.push("SELECT");
sql.push("COUNT(1) AS orderCount, SUM(price) AS orderPrice");
sql.push("FROM `ib_order`");
sql.push("WHERE 1 = 1");
var params = { async findMapByIds(ids, attrs) {
begin: begin, var result = {};
end: end if (!ids || ids.length == 0) {
}; return result;
if (begin) {
sql.push("AND created_at >= :begin");
}
if (end) {
sql.push("AND created_at <= :end");
} }
var list = await this.customQuery(sql.join(" "), params);
attrs = attrs || "*";
var sql = "SELECT " + attrs + " FROM invoice_apply where id IN (:ids) ";
var list = await this.customQuery(sql, { ids: ids });
if (!list || list.length == 0) { if (!list || list.length == 0) {
return { return result;
orderCount: 0,
orderPrice: 0,
}
} }
var item = list[0];
return { for (var item of list) {
orderCount: item.orderCount || 0, result[item.id] = item;
orderPrice: item.orderPrice || 0,
} }
return result;
} }
//按天来计算(平台)
async statDayByTime(begin, end) { async statDayByTime(begin, end) {
var result = {}; var result = {};
var sql = []; var sql = [];
sql.push("SELECT"); sql.push("SELECT");
sql.push("DATE_FORMAT(created_at, '%Y-%m-%d') AS `day`, SUM(price) AS orderPrice, COUNT(1) AS orderCount"); sql.push("DATE_FORMAT(created_at, '%Y-%m-%d') AS `day`, SUM(service_change) AS serviceChange, COUNT(1) AS invoiceCount");
sql.push("FROM `ib_order`"); sql.push("FROM `invoice_apply`");
sql.push("WHERE 1 = 1"); sql.push("WHERE 1 = 1");
var params = { var params = {
...@@ -108,12 +90,13 @@ class IborderDao extends Dao { ...@@ -108,12 +90,13 @@ class IborderDao extends Dao {
return result; return result;
} }
//安月来计算(平台)
async statMonthByTime(begin, end) { async statMonthByTime(begin, end) {
var result = {}; var result = {};
var sql = []; var sql = [];
sql.push("SELECT"); sql.push("SELECT");
sql.push("DATE_FORMAT(created_at, '%Y-%m') AS `month`, SUM(price) AS orderPrice, COUNT(1) AS orderCount"); sql.push("DATE_FORMAT(created_at, '%Y-%m') AS `month`, SUM(service_change) AS serviceChange, COUNT(1) AS invoiceCount");
sql.push("FROM `ib_order`"); sql.push("FROM `invoice_apply`");
sql.push("WHERE 1 = 1"); sql.push("WHERE 1 = 1");
var params = { var params = {
...@@ -146,15 +129,47 @@ class IborderDao extends Dao { ...@@ -146,15 +129,47 @@ class IborderDao extends Dao {
result.end = item.month; result.end = item.month;
} }
} }
return result; return result;
} }
async statInvoiceByTime(begin, end) {
var sql = [];
sql.push("SELECT");
sql.push("COUNT(1) AS invoiceCount, SUM(service_change) AS serviceChange");
sql.push("FROM `invoice_apply`");
sql.push("WHERE 1 = 1");
var params = {
begin: begin,
end: end
};
if (begin) {
sql.push("AND created_at >= :begin");
}
if (end) {
sql.push("AND created_at <= :end");
}
var list = await this.customQuery(sql.join(" "), params);
if (!list || list.length == 0) {
return {
invoiceCount: 0,
serviceChange: 0,
}
}
var item = list[0];
return {
invoiceCount: item.invoiceCount || 0,
serviceChange: item.serviceChange || 0,
}
}
async statByStatus(begin, end) { async statByStatus(begin, end) {
var sql = []; var sql = [];
sql.push("SELECT"); sql.push("SELECT");
sql.push("`status`, COUNT(1) AS orderCount "); sql.push("`status`, COUNT(1) AS invoiceCount ");
sql.push("FROM `ib_order`"); sql.push("FROM `invoice_apply`");
sql.push("WHERE 1 = 1"); sql.push("WHERE 1 = 1");
var params = { var params = {
begin: begin, begin: begin,
...@@ -177,10 +192,10 @@ class IborderDao extends Dao { ...@@ -177,10 +192,10 @@ class IborderDao extends Dao {
} }
for(var item of list) { for(var item of list) {
result[item.status] = item.orderCount || 0; result[item.status] = item.invoiceCount || 0;
} }
return result; return result;
} }
} }
module.exports = IborderDao; module.exports = ApplyDao;
\ No newline at end of file
const Dao = require("../../dao.base");
const system = require("../../../system");
class DelivererDao extends Dao {
constructor() {
super(Dao.getModelName(DelivererDao));
this.statusMap = {
"0090":"未付款",
"1000":"待审核",
"1010":"审核不通过",
"1020":"待分配",
"1030":"待处理",
"1040":"交付商关闭",
"1050":"已开具",
"1060":"待审核",
"1070":"审核通过",
"1080":"已邮寄",
"1090":"完成",
"1100":"发票撤回",
"1200":"红冲",
"1300":"审核失败(平台第二次审核)"
};
this.customerMap = {
"0090":"未付款",
"1000":"待审核",
"1030":"待处理",
"1050":"已开具",
"1090":"完成"
};
this.deliverMap = {
"1030":"待处理",
"1040":"交付商关闭",
"1050":"已开具",
"1060":"待审核",
"1080":"已邮寄",
"1300":"审核失败(平台第二次审核)"
}
}
//交付商业务概览
async countStat(params) {
var sql = [];
sql.push("select distinct deliverer_id from `xgg-invoice`.invoice_deliverer where 1=1");
this.setCondition(params, sql);
var list = await this.customQuery(sql.join(" "), params);
return {
total:list.length || 0,
list:list
};
}
setCondition(params, sql) {
if (params.begin) {
sql.push("AND created_at >= :begin");
}
if (params.end) {
sql.push("AND created_at <= :end");
}
}
//获取名字 id等信息
async queryStat(params, startRow, pageSize) {
var sql = [];
sql.push("SELECT");
sql.push("b.id, b.deliverer_id, b.deliverer_name,sum(b.deliverer_amount) as totalAmount");
sql.push("FROM invoice_deliverer b inner join invoice_apply a on a.deliverer_id=b.id ");
sql.push("WHERE 1 = 1 and b.deliverer_id in ("+params.list+")");
if (params.begin) {
sql.push("AND b.created_at >= :begin");
}
if (params.end) {
sql.push("AND b.created_at <= :end");
}
sql.push("GROUP BY b.deliverer_id");
sql.push("LIMIT :startRow, :pageSize");
params.startRow = startRow;
params.pageSize = pageSize;
var list = await this.customQuery(sql.join(" "), params);
return list;
}
async statDeliverByStatus(params) {
var sql = [];
sql.push("SELECT");
sql.push("a.deliverer_id,a.status,COUNT(1) AS invoiceCount");
sql.push("FROM `invoice_apply` a inner join `invoice_deliverer` b on a.deliverer_id=b.id");
sql.push("WHERE 1 = 1");
if(params.delivererIds) {
sql.push("AND a.deliverer_id IN (:delivererIds)")
}
if (params.begin) {
sql.push("AND b.created_at >= :begin");
}
if (params.end) {
sql.push("AND b.created_at <= :end");
}
sql.push("GROUP BY a.`status`");
var result = {};
var list = await this.customQuery(sql.join(" "), params);
if (!list || list.length == 0) {
return result;
}
for (var item of list) {
result[item.deliverer_id + "_" + item.status] = item.invoiceCount || 0;
}
return result;
}
//按天来计算(交付商)
async delStatDayByTime(begin, end,delivererId) {
var result = {};
var sql = [];
sql.push("SELECT");
sql.push("DATE_FORMAT(created_at, '%Y-%m-%d') AS `day`, SUM(deliverer_amount) AS delivererAmount, COUNT(1) AS invoiceCount");
sql.push("FROM `invoice_deliverer`");
sql.push("WHERE 1 = 1");
var params = {
begin: begin,
end: end,
delivererId:delivererId
};
if (begin) {
sql.push("AND created_at >= :begin");
}
if (end) {
sql.push("AND created_at <= :end");
}
if (delivererId) {
sql.push("AND deliverer_id = :delivererId");
}
sql.push("GROUP BY `day` ORDER BY `day` ASC");
var list = await this.customQuery(sql.join(" "), params);
if (!list || list.length == 0) {
return result;
}
for (var item of list) {
result[item.day] = item;
}
return result;
}
//安月来计算(交付商)
async delStatMonthByTime(begin, end,delivererId) {
var result = {};
var sql = [];
sql.push("SELECT");
sql.push("DATE_FORMAT(created_at, '%Y-%m') AS `month`, SUM(deliverer_amount) AS delivererAmount, COUNT(1) AS invoiceCount");
sql.push("FROM `invoice_deliverer`");
sql.push("WHERE 1 = 1");
var params = {
begin: begin,
end: end
};
if (begin) {
sql.push("AND created_at >= :begin");
}
if (end) {
sql.push("AND created_at <= :end");
}
if (delivererId) {
sql.push("AND deliverer_id = :delivererId");
}
sql.push("GROUP BY `month` ORDER BY `month` ASC");
var list = await this.customQuery(sql.join(" "), params);
if (!list || list.length == 0) {
return result;
}
for (var idx = 0; idx < list.length; idx++) {
var item = list[idx];
result[item.month] = item;
if (idx == 0) {
result.begin = item.month;
}
if (idx == list.length - 1) {
result.end = item.month;
}
}
return result;
}
async delStatInvoiceByTime(begin, end,delivererId) {
var sql = [];
sql.push("SELECT");
sql.push("COUNT(1) AS invoiceCount, SUM(deliverer_amount) AS delivererAmount");
sql.push("FROM `invoice_deliverer`");
sql.push("WHERE 1 = 1");
var params = {
begin: begin,
end: end,
delivererId:delivererId
};
if (begin) {
sql.push("AND created_at >= :begin");
}
if (end) {
sql.push("AND created_at <= :end");
}
if (delivererId) {
sql.push("AND deliverer_id = :delivererId");
}
var list = await this.customQuery(sql.join(" "), params);
if (!list || list.length == 0) {
return {
invoiceCount: 0,
delivererAmount: 0,
}
}
var item = list[0];
return {
invoiceCount: item.invoiceCount || 0,
delivererAmount: item.delivererAmount || 0,
}
}
/**
* 发票办理
* @param {*} begin
* @param {*} end
*/
async delStatByStatus(begin, end) {
var sql = [];
sql.push("SELECT");
sql.push("`status`, COUNT(1) AS invoiceCount ");
sql.push("FROM `invoice_deliverer`");
sql.push("WHERE 1 = 1");
var params = {
begin: begin,
end: end
};
if (begin) {
sql.push("AND created_at >= :begin");
}
if (end) {
sql.push("AND created_at <= :end");
}
sql.push("GROUP BY `status`");
var result = {};
var list = await this.customQuery(sql.join(" "), params);
if(!list || list.length == 0) {
return result;
}
for(var item of list) {
result[item.status] = item.invoiceCount || 0;
}
return result;
}
}
module.exports = DelivererDao;
const system = require("../../../system");
const Dao = require("../../dao.base");
const moment = require("moment");
class InvoiceDao extends Dao {
constructor() {
super(Dao.getModelName(InvoiceDao));
this.statusMap = {
"0090": "未付款",
"1000": "待审核",
"1010": "审核不通过",
"1020": "待分配",
"1030": "待处理",
"1040": "交付商关闭",
"1050": "已开具",
"1060": "待审核",
"1070": "审核通过",
"1080": "已邮寄",
"1090": "完成",
"1100": "发票撤回",
"1200": "红冲",
"1300": "审核失败(平台第二次审核)"
};
this.customerMap = {
"0090": "未付款",
"1000": "待审核",
"1030": "待处理",
"1050": "已开具",
"1090": "完成"
};
this.deliverMap = {
"1030": "待处理",
"1040": "交付商关闭",
"1050": "已开具",
"1060": "待审核",
"1080": "已邮寄",
"1300": "审核失败(平台第二次审核)"
}
this.redStatusMap = {
"1": "未红冲",
"2": "红冲中",
"3": "红冲失败",
"4": "红冲成功",
};
this.red_statusMap = this.redStatusMap;
}
async countByParams(params) {
var sql = [];
sql.push("SELECT");
sql.push("COUNT(1) as total");
sql.push("FROM `invoice` t1");
sql.push("INNER JOIN `invoice_apply` t2 ON t1.`id` = t2.`id`");
sql.push("WHERE 1 = 1 and t2.status in('1070','1080','1090')");
this.setCondition(params, sql);
var counts = await this.customQuery(sql.join(" "), params);
if(!counts || counts.length == 0) {
return 0;
}
return counts[0].total || 0;
}
async pageByParams(params, startRow, pageSize) {
var sql = [];
sql.push("SELECT");
sql.push("t1.*");
sql.push("FROM `invoice` t1");
sql.push("INNER JOIN `invoice_apply` t2 ON t1.`id` = t2.`id`");
sql.push("WHERE 1 = 1 ");
this.setCondition(params, sql);
sql.push("ORDER BY id DESC");
sql.push("LIMIT :startRow, :pageSize");
params.startRow = startRow || 0;
params.pageSize = pageSize || 10;
return await this.customQuery(sql.join(" "), params);
}
setCondition(params, sql) {
var complateTax = params.complateTax;
if (complateTax != "-1") {
params.complateTax = Number(complateTax);
sql.push("AND t1.`complate_tax` = :complateTax");
}
// invoiceTimeBegin 2019-01-01 2019-01-01 00:00:00
// invoiceTimeEnd 2019-11-01 2019-11-01 23:59:59
if(params.invoiceTimeBegin) {
sql.push("AND t1.`invoice_time` >= :invoiceTimeBegin");
}
if(params.invoiceTimeEnd) {
sql.push("AND t1.`invoice_time` <= :invoiceTimeEnd");
}
if(params.invoiceTime){
sql.push("AND t1.`invoice_time` >= :invoiceTime");
}
if(params.applyNo) {
sql.push("AND t2.`apply_no` = :applyNo");
}
if(params.redStatus) {
sql.push("AND t1.`red_status` = :redStatus");
}
if (params.type) {
sql.push("AND t2.`type` = :type");
}
if(params.statuses && params.statuses.length > 0){
sql.push("AND t2.`status` in (:statuses)");
}
}
}
module.exports = InvoiceDao;
\ No newline at end of file
...@@ -8,7 +8,7 @@ const md5 = require("MD5"); ...@@ -8,7 +8,7 @@ const md5 = require("MD5");
//同时增加账户数量,增加系统平台账户 //同时增加账户数量,增加系统平台账户
var dbf=system.getObject("db.common.connection"); var dbf=system.getObject("db.common.connection");
var db=dbf.getCon(); var db=dbf.getCon();
db.sync({force:true}).then(async ()=>{ db.sync({force:false}).then(async ()=>{
console.log("sync complete..."); console.log("sync complete...");
//创建role //创建role
......
...@@ -21,7 +21,6 @@ module.exports = { ...@@ -21,7 +21,6 @@ module.exports = {
}, },
"pdict": { "pdict": {
"logLevel": { "debug": 0, "info": 1, "warn": 2, "error": 3, "fatal": 4 }, "logLevel": { "debug": 0, "info": 1, "warn": 2, "error": 3, "fatal": 4 },
"sex": {"male": "男", "female": "女"},
} }
} }
} }
\ No newline at end of file
...@@ -3,54 +3,27 @@ const settings=require("../../../../config/settings"); ...@@ -3,54 +3,27 @@ const settings=require("../../../../config/settings");
const uiconfig=system.getUiConfig2(settings.appKey); const uiconfig=system.getUiConfig2(settings.appKey);
module.exports = (db, DataTypes) => { module.exports = (db, DataTypes) => {
return db.define("user", { return db.define("user", {
userName: { ucid: {
type:DataTypes.STRING, type:DataTypes.INTEGER,
allowNull: false, allowNull: false,
}, },
password: { ucname: {
type:DataTypes.STRING, type:DataTypes.STRING,
allowNull: false, allowNull: false,
}, },
nickName: { lastLoginTime: {
type:DataTypes.STRING, type:DataTypes.DATE,
allowNull: true,
},
sex: {
type:DataTypes.ENUM,
allowNull: true,
values: Object.keys(uiconfig.config.pdict.sex),
},
mobile:DataTypes.STRING,
mail: {
type:DataTypes.STRING,
allowNull: true, allowNull: true,
}, },
headUrl: DataTypes.STRING,
isAdmin:{
type:DataTypes.BOOLEAN,
defaultValue: false
},
isSuper:{
type:DataTypes.BOOLEAN,
defaultValue: false
},
openId:DataTypes.STRING,
app_id:DataTypes.INTEGER,
account_id:DataTypes.INTEGER,
isEnabled:{
type:DataTypes.BOOLEAN,
defaultValue: true
},
},{ },{
paranoid: true,//假的删除 paranoid: true,//假的删除
underscored: true, underscored: true,
version: true, version: true,
freezeTableName: true, freezeTableName: true,
//freezeTableName: true, // freezeTableName: true,
// define the table's name // define the table's name
tableName: 'p_user', tableName: 'xgg_admin_user',
validate: { validate: {
}, },
indexes:[ indexes:[
// Create a unique index on email // Create a unique index on email
......
const system = require("../../../system");
const settings = require("../../../../config/settings");
const uiconfig = system.getUiConfig2(settings.appKey);
const moment = require('moment')
/**
* 发表申请表
*/
module.exports = (db, DataTypes) => {
return db.define("apply", {
//抬头信息 购买方
merchantId: {type: DataTypes.STRING,field: 'merchant_id', allowNull: true, comment:'个体工商户id(购买方id)' },
merchantName: {type: DataTypes.STRING,field: 'merchant_name', allowNull: false, comment:'抬头名称' },
merchantCreditCode: {type: DataTypes.STRING,field: 'merchant_credit_code', allowNull: false, comment:'纳税人识别号' },
merchantAddr: {type: DataTypes.STRING,field: 'merchant_addr', allowNull: false, comment:'地址' },
merchantMobile: {type: DataTypes.STRING,field: 'merchant_mobile', allowNull: false, comment:'电话' },
merchantBank: {type: DataTypes.STRING,field: 'merchant_bank', allowNull: false, comment:'开户行' },
merchantAccount: {type: DataTypes.STRING,field: 'merchant_account', allowNull: false, comment:'账号' },
//销售方信息
businessmenId:{type: DataTypes.STRING,field: 'businessmen_id', allowNull: false, comment:'销售方id' },
businessmenCreditCode:{type: DataTypes.STRING,field: 'businessmen_credit_code', allowNull: false, comment:'个体户社会统一信息用代码' },
businessmenName:{type: DataTypes.STRING,field: 'businessmen_name', allowNull: false, comment:'销售方名称' },
businessmenAddr:{type: DataTypes.STRING,field: 'businessmen_addr', allowNull: false, comment:'销售方地址' },
businessmenMobile:{type: DataTypes.STRING,field: 'businessmen_mobile', allowNull: false, comment:'销售方电话' },
businessmenBank:{type: DataTypes.STRING,field: 'businessmen_bank', allowNull: false, comment:'销售方开户行' },
businessmenAccount:{type: DataTypes.STRING,field: 'businessmen_account', allowNull: false, comment:'销售方账户' },
isBank:{type: DataTypes.INTEGER, field: 'is_bank', allowNull: false, defaultValue: 0, comment:'开户状态:1.已开户 0.未开户'},
taxAuthorities:{type: DataTypes.STRING,field: 'tax_authoritioes', allowNull: true, comment:'税务报道机构' },
//发票信息
// invoiceNo:{type: DataTypes.STRING,field: 'invoice_no', allowNull: true, comment:'发票编号' },
type:{type: DataTypes.INTEGER,field: 'type', allowNull: false, defaultValue:10, comment:'发票类型:10 普通发票 20 增值税专用发票 30 电子发票' },
invoiceAmount:{type: DataTypes.BIGINT,field: 'invoice_amount', allowNull: false, comment:'发票总额' },
statements:{type: DataTypes.STRING,field: 'statements', allowNull: false, comment:'结算单' },
contract:{type: DataTypes.STRING,field: 'contract', allowNull: false, comment:'合同' },
invoiceTime:{type: DataTypes.DATE,field: 'invoice_time', allowNull: true, comment:'开票时间' },
settleImg:{type: DataTypes.STRING,field: 'settle_img', allowNull: true, comment:'开票凭证' },
applyNo:{type: DataTypes.STRING,field: 'apply_no', allowNull: true, comment:'开票申请记录' },
invoiceContent:{type: DataTypes.STRING,field: 'invoice_content', allowNull: true, comment:'开票内容' },
personalIncomeTax:{type: DataTypes.BIGINT,field: 'personal_invoice_tax', allowNull: true, comment:'个税',
set:function(val, key) {
if(val=="0.00"){val=0;}
if(String(val).indexOf(".")!=-1){
val=val*100;
}
let v = val?val:0;
this.setDataValue(key, v);} },
additionalTax:{type: DataTypes.BIGINT,field: 'additional_tax', allowNull: true, comment:'附加税',
set:function(val, key) {
if(val=="0.00"){val=0;}
if(String(val).indexOf(".")!=-1){
val=val*100;
}
let v = val?val:0;
this.setDataValue(key, v);} },
valueAddedTax:{type: DataTypes.BIGINT,field: 'value_added_tax', allowNull: true, comment:'增值税',
set:function(val, key) {
if(val=="0.00"){val=0;}
if(String(val).indexOf(".")!=-1){
val=val*100;
}
let v = val?val:0;
this.setDataValue(key, v);} },
serviceCharge:{type: DataTypes.BIGINT,field: 'service_change', allowNull: true, comment:'服务费',
set:function(val, key) {
if(val=="0.00"){val=0;}
if(String(val).indexOf(".")!=-1){
val=val*100;
}
let v = val?val:0;
this.setDataValue(key, v);} },
applyMobile:{type: DataTypes.STRING,field: 'apply_mobile', allowNull: true, comment:'申请方电话' },
isInvalid:{ type: DataTypes.STRING, field: 'is_invalid', allowNull: false,
get:function() {
var isInvalid = this.getDataValue('isInvalid');
let v;
if(isInvalid==1){
v="未红冲";
}else if(isInvalid==2){
v="红冲中";
}else if(isInvalid==3){
v="红冲失败";
}else if(isInvalid==4){
v="红冲成功"
}
return v;
},
defaultValue: 1,
comment:'红冲状态 1:未红冲 2:红冲中 3 红冲失败 4 红冲成功'
},
parentId:{type: DataTypes.STRING,field: 'parent_id', allowNull: true, comment:'父id 红冲的关系id' },
//发票状态
status:{ type: DataTypes.STRING, field: 'status', allowNull: false, defaultValue:'1000', comment:'订单状态 1000 未付款 1010 审核不通过 1020 代分配 1030 待处理 1040 交付商关闭 1050 已开具 1060 代审核 1070 审核通过 1080 已邮寄 1090 完成 1100 发票撤回'},
customerStatus:{ type: DataTypes.STRING, field: 'customer_status', allowNull: false, defaultValue:'1000', comment:'客户端状态 1000 未付款 1030 待处理 1050 已开具 1090 完成 1100 发票撤回'},
//付款信息
payWay:{ type: DataTypes.STRING, field: 'pay_way', allowNull: true, comment:'付款方式 10 系统账户扣款 20 线上支付'},
payAccount:{ type: DataTypes.STRING, field: 'pay_account', allowNull: true, comment:'付款账户'},
isPay:{type: DataTypes.INTEGER, field: 'is_pay', allowNull: false, defaultValue:0, comment:'支付状态:1.已支付 0.未支付'},
//邮寄地址
mailAddr:{type: DataTypes.STRING,field: 'mail_addr', allowNull: true, comment:'邮寄地址' },
mailMobile:{type: DataTypes.STRING,field: 'mail_mobile', allowNull: true, comment:'邮寄电话' },
mailTo:{type: DataTypes.STRING,field: 'mail_to', allowNull: true, comment:'邮寄人' },
//平台第一次审核信息
remark:{type: DataTypes.STRING,field: 'remark', allowNull: true, comment:'平台审核备注' },
delivererId:{type: DataTypes.STRING,field: 'deliverer_id', allowNull: true, comment:'正在办理的交付商id' },
createdAt: { type: DataTypes.DATE, field: 'created_at', allowNull: false, defaultValue: DataTypes.NOW,comment:'发票创建时间',
get() {
let res = moment(this.getDataValue('createdAt')).add(8).format('YYYY-MM-DD HH:mm:ss');
return res;
}
},
updatedAt: { type: DataTypes.DATE, field: 'updated_at', allowNull: false, defaultValue: DataTypes.NOW ,comment:'更新时间',
get(key) {
let res = moment(this.getDataValue(key)).add(8).format('YYYY-MM-DD HH:mm:ss');
return res;
}
},
deletedAt: { type: DataTypes.DATE, field: 'deleted_at', allowNull: true, comment:'删除时间'}
},{
timestamps: true,
underscore: false,
freezeTableName: true,
paranoid: true,
// schema: '',
tableName: 'invoice_apply',
comment: '发票申请表',
charset: 'utf8',
collate: 'utf8_general_ci',
version: true
});
}
\ 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("deliverer", {
//发票id
invoiceId: {type: DataTypes.STRING,field: 'invoice_id', allowNull: true, comment:'发票id' },
applyNo:{type: DataTypes.STRING,field: 'apply_no', allowNull: false, comment:'发票编号' },
merchantId: {type: DataTypes.STRING,field: 'merchant_id', allowNull: true, comment:'个体工商户id(购买方id)' },
//平台选取交付商提交信息
delivererId:{type: DataTypes.STRING,field: 'deliverer_id', allowNull: true, comment:'交付商id' },
delivererName:{type: DataTypes.STRING,field: 'deliverer_name', allowNull: true, comment:'交付商名称' },
delivererAmount:{type: DataTypes.BIGINT,field: 'deliverer_amount', allowNull: true, comment:'交付商分成' },
breakReason:{type: DataTypes.STRING,field: 'break_reason', allowNull: true, comment:'拒绝原因' },
//平台第二次审核提交信息
auditContent:{type: DataTypes.STRING,field: 'audit_content', allowNull: true, comment:'审核备注' },
delivererContent:{type: DataTypes.STRING,field: 'deliverer_content', allowNull: true, comment:'交付内容' },
mailAddr:{type: DataTypes.STRING,field: 'mail_addr', allowNull: true, comment:'邮寄地址' },
mailMobile:{type: DataTypes.STRING,field: 'mail_mobile', allowNull: true, comment:'邮寄电话' },
mailTo:{type: DataTypes.STRING,field: 'mail_to', allowNull: true, comment:'邮寄人' },
mailEmail:{type: DataTypes.STRING,field: 'mail_email', allowNull: true, comment:'邮寄邮箱' },
//交付商交付信息(如果交付商邮寄那么则这个字段本应该在invoice表中,但是为了方便查询放在此表中)
delivererMailNo:{type: DataTypes.STRING,field: 'deliverer_mail_no', allowNull: true, comment:'交付商邮寄单号' },
platformMailNo:{type: DataTypes.STRING,field: 'platform_mail_no', allowNull: true, comment:'平台邮寄单号' },
createdAt: { type: DataTypes.DATE, field: 'created_at', allowNull: false, defaultValue: DataTypes.NOW,comment:'发票创建时间'},
updatedAt: { type: DataTypes.DATE, field: 'updated_at', allowNull: false, defaultValue: DataTypes.NOW ,comment:'更新时间'},
deletedAt: { type: DataTypes.DATE, field: 'deleted_at', allowNull: true, comment:'删除时间'}
},{
timestamps: true,
underscore: false,
freezeTableName: true,
paranoid: true,
// schema: '',
tableName: 'invoice_deliverer',
comment: '交付商分配表',
charset: 'utf8',
collate: 'utf8_general_ci',
version: true
});
}
\ No newline at end of file
const system = require("../../../system");
const settings = require("../../../../config/settings");
const uiconfig = system.getUiConfig2(settings.appKey);
const moment = require('moment')
//发票表 交付商提交的所有字段都保存到这个表中
module.exports = (db, DataTypes) => {
return db.define("invoice", {
applyNo:{type: DataTypes.STRING,field: 'apply_no', allowNull: false, comment:'发票申请号' },
merchantId: {type: DataTypes.STRING,field: 'merchant_id', allowNull: true, comment:'个体工商户id(购买方id)' },
status:{ type: DataTypes.INTEGER, field: 'status', allowNull: true, comment:'审核状态 1030 待处理 1040 交付商关闭 1050 已开具 1060 代审核 1070 审核通过 1080 已邮寄'},
//已开具
invoiceNo:{type: DataTypes.STRING,field: 'invoice_no', allowNull: true, comment:'发票编号' },
invoiceTime: { type: DataTypes.DATE, field: 'invoice_time', allowNull: true, defaultValue: DataTypes.NOW,comment:'开票时间',
get() {
let res = moment(this.getDataValue('updatedAt')).add(8).format('YYYY-MM-DD HH:mm:ss');
return res;
}
},
invoiceImg:{type: DataTypes.STRING,field: 'invoice_img', allowNull: true, comment:'发票照片' },
//拒绝原因
//reason:{type: DataTypes.STRING,field: 'reason', allowNull: true, comment:'拒绝原因' },
//完税
taxNo:{type: DataTypes.STRING,field: 'tax_no', allowNull: true, comment:'完税批号'},
complateTax: {type:DataTypes.INTEGER,field: 'complate_tax', allowNull: true, defaultValue:0,comment:'是否完税 0 未完成 1 已完成',
get:function() {
var isInvalid = this.getDataValue('complateTax');
var v = isInvalid=='1'?"已完成":"未完成";
return v;
},},
taxTime: { type: DataTypes.DATE, field: 'tax_time', allowNull: true, defaultValue: DataTypes.NOW,comment:'完税时间',
get() {
let res = moment(this.getDataValue('taxTime')).add(8).format('YYYY-MM-DD HH:mm:ss');
return res;
}},
taxVoucher:{type: DataTypes.STRING,field: 'tax_voucher', allowNull: true, comment:'完税照片' },
//邮寄相关
mailNo:{type: DataTypes.STRING,field: 'mail_no', allowNull: true, comment:'快递单号' },
redStatus:{ type: DataTypes.STRING, field: 'red_status', allowNull: false, defaultValue: '1',
comment:'红冲状态 1:未红冲 2:红冲中 3 红冲失败 4 红冲成功'
},
createdAt: { type: DataTypes.DATE, field: 'created_at', allowNull: false, defaultValue: DataTypes.NOW,comment:'发票创建时间',
get() {
let res = moment(this.getDataValue('createdAt')).add(8).format('YYYY-MM-DD HH:mm:ss');
return res;
}},
updatedAt: { type: DataTypes.DATE, field: 'updated_at', allowNull: false, defaultValue: DataTypes.NOW ,comment:'更新时间',
get() {
let res = moment(this.getDataValue('updatedAt')).add(8).format('YYYY-MM-DD HH:mm:ss');
return res;
}},
deletedAt: { type: DataTypes.DATE, field: 'deleted_at', allowNull: true, comment:'删除时间'},
},{
timestamps: true,
underscore: false,
freezeTableName: true,
paranoid: true,
// schema: '',
tableName: 'invoice',
comment: '发票表',
charset: 'utf8',
collate: 'utf8_general_ci',
version: true
});
}
\ No newline at end of file
const system=require("../../../system"); const system=require("../../../system");
const ServiceBase=require("../../sve.base"); const ServiceBase=require("../../sve.base");
const fs=require("fs"); const fs=require("fs");
var excel = require('exceljs');
const uuidv4 = require('uuid/v4'); const uuidv4 = require('uuid/v4');
var path= require('path'); var path= require('path');
class TaskService extends ServiceBase{ class TaskService extends ServiceBase{
......
const system = require("../../../system");
const ServiceBase = require("../../sve.base")
const Decimal = require('decimal.js');
const moment = require('moment');
class ApplyService extends ServiceBase {
constructor() {
super("invoice", ServiceBase.getDaoName(ApplyService));
let is = system.getObject("util.invoiceStatus");
this.invoiceStatus = is.status;
this.delivererDao = system.getObject("db.invoice.delivererDao");
this.invoiceDao = system.getObject("db.invoice.invoiceDao");
//最大的发票总额度
this.MAX_TOTAL_AMOUNT = 500000000;
//警告发票额度
this.WARNING_AMOUNT = 400000000;
this.PER_TAX = 1; //个税
this.VAL_TAX = 2; //增值税
this.INVOICE_MAX = 10; //一次性插入最大值
}
/**
* 保存发票信息
* @param {*} params 参数
* params:{
* invoiceAmount:100000, //发票金额
* invoiceTime:"2019-12-12", //开票时间
* serviceRate:"0.03", //服务费率
* businessmenId:1, //商户id
* perCalWay:1, //个税计算方式 1:年
* valCalWay:1, //增值税计算方式 1:月 2:季度
* taxIncPriRat:0.03, //不含税价百分比
* taxCostPriRat:0.96, //核定成本费用率
* perIncTaxRange:[ //税额范围
* {
* minValue:0,
* rate:"0",
* quiCalDed:0,
* maxValue:3000000
* }
* ],
* valAddTaxRange:[
* {
* minValue:0,
* zengzhiRate:0,
* fujiaRate:0,
* maxValue:3000000
* }
* ],
* merchantId:xxx, //商户id 可以为空
* merchantName:xxx, //抬头
* merchantCreditCode:xxx,//纳税人识别号
* merchantAddr:xxx, //地址
* merchantMobile:xxx, //电话
* merchantBank:xxx, //开户行
* mercahntAccount:xxx, //开户账号
* businessmenCreditCode:xxx, //销售方社会统一信用代码
* businessName:xxx, //销售方名称
* isBank:xxx, //销售方是否开户
* taxAuthorities:xxx, //税务报道机构
*
* invoiceNo:xxx, //发票编号,
* type:1, //发票类型 10 普通发票 20 增值税专用发票 30 电子发票
* statements:xxx, //结算单子
* contract:xxx, //合同
* settleImg:xxx, //开票凭证
* applyId:xxx, //开票申请id 如果是红冲状态则需要传
* invoiceContent:xxx, //开票内容
*
* personalIncomeTax:xxx, //个税 不需要
* additionalTax:xxx, //附加税 不需要
* valueAddedTax:xxx, //增值税 不需要
* serviceCharge:xxx, //服务费 不需要
*
* applyMobile:xxx, //申请电话
*
* payWay:xxx, //付款方式
* payAccount:xxx, //付款账户
* isPay:xxx, //是否付款
*
* mailAddr:xxx, //邮寄地址
* mailMobile:xxx, //邮寄电话
* mailTo:xxx, //邮寄人
* }
*/
async apiSaveInvoice(params) {
try {
let res = await this.saveInvoice(params);
return res;
} catch (error) {
return system.getResult(null, `系统错误 错误信息:${error}`);
}
}
/**
* 计算各种费率(试算)
* @param {*} pobj
* @param {*}
* params:{
* invoiceAmount:100000, //发票金额
* invoiceTime:"2019-12-12", //开票时间
* businessmenCreditCode:"xxx", //纳税人识别号
* serviceRate:"0.03", //服务费率
* businessmenId:1, //商户id
* perCalWay:1, //个税计算方式 1:年
* valCalWay:1, //增值税计算方式 1:月 2:季度
* taxIncPriRat:0.03, //不含税价百分比
* taxCostPriRat:0.96, //核定成本费用率
* perIncTaxRange:[
* {
* minValue:0,
* rate:"0",
* quiCalDed:0,
* maxValue:3000000
* }
* ],
* valAddTaxRange:[
* {
* minValue:0,
* zengzhiRate:0,
* fujiaRate:0,
* maxValue:3000000
* }
* ],
* }*/
async apiCalcInvoice(params) {
let result = await this.calcInvoice(params);
if (!result.hasOwnProperty('status')) {
return system.getResult(result);
}
return result;
}
/**
* 查询申请列表(平台)
* @param {*} params
*/
async apiQueryApplyInvoices(params) {
try {
return await this.queryApplyInvoices(params);
} catch (error) {
return system.getResult(null, `系统错误 错误信息 ${error}`);
}
}
/**
* 查询发票明细(平台)
* @param {*} params
*/
async apiQueryInvoice(params) {
try {
var merchantId = params.merchantId || params.merchant_id;
if ((params.merchantId && params.applyNo) || params.id) {
let res = await this.queryInvoice(params.applyNo, merchantId, params.id);
return res;
} else {
return system.getResultSuccess();
}
} catch (error) {
return system.getResult(null, `系统错误 错误信息:${error}`);
}
}
/**
* 发票撤回
* @param params
* {
* applyNo:"", //发票申请编号
* merchantId:"", //商户id
* }
*/
async apiCancelInvoice(params) {
try {
var merchantId = params.merchantId || params.merchant_id;
if (!params.applyNo || !merchantId) {
return system.getResult(null, "发票申请编号不合法。");
}
return await this.cancelInvoice(params.applyNo, merchantId);
} catch (error) {
return system.getResult(null, `系统错误:错误信息 ${error}`);
}
}
/**
* 平台业务分配
* @param {*} params
* {
* id:"xxx" //发票id
* nextStatus:"xxx", //发票状态
*
* }
*/
async apiAssignment(params) {
try {
if (!params.id) {
return system.getResult(null, `参数错误`);
}
return await this.assignment(params);
} catch (error) {
return system.getResult(null, `系统错误 错误信息 ${error}`);
}
}
/**
* 平台业务分配
* @param {*} params
* {
* id:"xxx" //发票id
* nextStatus:"xxx", //发票状态
*
* }
*/
async apiVerificationByBusinessmenCreditCode(params) {
try {
if (!params.businessmenCreditCode) {
return system.getResult(null, `参数错误`);
}
return await this.verificationByBusinessmenCreditCode(this.trim(params.businessmenCreditCode));
} catch (error) {
return system.getResult(null, `系统错误 错误信息 ${error}`);
}
}
/**
* 发票红冲
* @param {*} params
*/
async apiRedRushInvoice(params) {
if (!params.id) {
return system.getResult(null, `参数错误 发票ID不合法`);
}
try {
let res = await this.redRushInvoice(params);
return res;
} catch (error) {
return system.getResult(null, `参数错误 错误信息 ${error}`);
}
}
/**
* 交易数据(平台)
* @param {*} params
*/
async apiStatTransData(params) {
try {
return await this.statTransData(params);
} catch (error) {
return system.getResult(-1,`系统错误 错误信息 ${error}`);
}
}
/**
* 发票办理(平台)
* @param {*} params
*/
async apiStatBusinessData(params) {
try {
return await this.statBusinessData(params);
} catch (error) {
console.log(error);
return system.getResult(null, "接口异常");
}
}
//===========================================================================================
/**
* 发票办理(平台)
* @param {*} params
*/
async statBusinessData(params) {
var result = {};
var type = Number(params.type || 1);
// 查 已完成订单,待分配订单,待审核订单,办理中订单
var begin, end;
// 取开始时间
if (type == 1) {
begin = moment().format("YYYY-MM") + "-01 00:00:00";
end = moment(begin).add(1, "months").subtract(1, 'days').format("YYYY-MM-DD") + " 23:59:59";
} else if (type == 2) {
begin = moment().subtract(1, "months").format("YYYY-MM") + "-01 00:00:00";
end = moment(begin).add(1, "months").subtract(1, 'days').format("YYYY-MM-DD") + " 23:59:59";
}
// 先按照订单状态查
var statMap = await this.dao.statByStatus(begin, end);
// 已开具 1050
result.completeCount = this.addStatCount(statMap, ['1050']);
// 待申请审核 1000
result.toApplyCount = this.addStatCount(statMap, ['1000']);
// 待交付审核 1130 1140
result.toAuditCount = this.addStatCount(statMap, ['1060']);
// 办理中 "1030", "1050", "1060", "1080", "1300"
result.handlingCount = this.addStatCount(statMap, ["1030", "1050", "1060", "1080", "1300"]);
return system.getResultSuccess(result);
}
/**
* 交易数据(平台)
* @param {*} params
*/
async statTransData(params) {
try {
var result = {
invoiceCount: 0,
serviceChange: 0,
};
var type = Number(params.type || 1);
var begin, end;
// 取开始时间
if (type == 1) {
begin = moment().format("YYYY-MM") + "-01 00:00:00";
} else if (type == 2) {
begin = moment().subtract(1, "months").format("YYYY-MM") + "-01 00:00:00";
}
// echart数据
var days = [];
var dayCounts = [];
var priceCounts = [];
// 处理查询业务
if (type == 1 || type == 2) { // 取结束时间
end = moment(begin).add(1, "months").subtract(1, 'days').format("YYYY-MM-DD") + " 23:59:59";
days = this.getDays(end);
// 按天统计
var dayMap = await this.dao.statDayByTime(begin, end);
for (var day of days) {
var ditem = dayMap[day] || {};
dayCounts.push(ditem.invoiceCount || 0);
priceCounts.push(system.f2y(ditem.serviceChange || 0));
}
} else {
var monthMap = await this.dao.statMonthByTime(begin, end);
var bm = monthMap.begin || "";
var em = monthMap.end || "";
if (bm && em) {
// 开始月份-结束月份所有月份
var curMonth = bm;
while (true) {
days.push(curMonth);
if (curMonth == em) {
break;
}
curMonth = moment(curMonth + "-01").add(1, "month").format("YYYY-MM");
}
}
for (var day of days) {
var ditem = monthMap[day] || {};
dayCounts.push(ditem.invoiceCount || 0);
priceCounts.push(system.f2y(ditem.serviceChange || 0));
}
}
var invoiceApplyData = await this.dao.statInvoiceByTime(begin, end) || {};
result.invoiceCount = invoiceApplyData.invoiceCount;
result.serviceChange = system.f2y(invoiceApplyData.serviceChange);
result.days = days;
result.dayCounts = dayCounts;
result.priceCounts = priceCounts;
return system.getResultSuccess(result);
} catch (error) {
return system.getResult(null,`系统错误 错误信息 ${error}`);
}
}
/**
* 红冲
* @param {*} params
*/
async redRushInvoice(params) {
try {
let _apply = await this.dao.findById(params.id) || {};
let invoice = await this.invoiceDao.findById(params.id) || {};
//判断红冲状态
if (invoice.redStatus == 2) {
return system.getResult(null, `发票红冲中`);
} else if (invoice.redStatus == 4) {
return system.getResult(null, `红冲已红冲`);
}
let nowObj = {};
nowObj.merchantId = this.trim(_apply.merchantId);
nowObj.merchantName = this.trim(_apply.merchantName);
nowObj.merchantCreditCode = this.trim(_apply.merchantCreditCode);
nowObj.merchantAddr = this.trim(_apply.merchantAddr);
nowObj.merchantMobile = this.trim(_apply.merchantMobile);
nowObj.merchantBank = this.trim(_apply.merchantBank);
nowObj.merchantAccount = this.trim(_apply.merchantAccount);
nowObj.businessmenCreditCode = this.trim(_apply.businessmenCreditCode);
nowObj.businessmenId = this.trim(_apply.businessmenId);
nowObj.businessmenName = this.trim(_apply.businessmenName);
nowObj.businessmenAddr = this.trim(_apply.businessmenAddr);
nowObj.businessmenMobile = this.trim(_apply.businessmenMobile);
nowObj.businessmenBank = this.trim(_apply.businessmenBank);
nowObj.businessmenAccount = this.trim(_apply.businessmenAccount);
nowObj.isBank = _apply.isBank ? 1 : 0;
nowObj.taxAuthorities = this.trim(_apply.taxAuthorities);
nowObj.type = this.trim(_apply.type);
nowObj.invoiceAmount = this.trim(_apply.invoiceAmount);
nowObj.statements = this.trim(_apply.statements);
nowObj.contract = this.trim(_apply.contract);
nowObj.invoiceTime = this.trim(_apply.invoiceTime);
nowObj.settleImg = this.trim(_apply.settleImg);
nowObj.applyNo = this.trim(_apply.applyNo);
nowObj.invoiceConten = this.trim(_apply.invoiceConten);
nowObj.personalIncomeTax = this.trim(_apply.personalIncomeTax);
nowObj.additionalTax = this.trim(_apply.additionalTax);
nowObj.valueAddedTax = this.trim(_apply.valueAddedTax);
nowObj.serviceCharge = this.trim(_apply.serviceCharge);
nowObj.applyMobile = this.trim(_apply.applyMobile);
nowObj.parentId = this.trim(_apply.id);
nowObj.status = this.trim("1000");
nowObj.customerStatus = this.trim("1000");
nowObj.payWay = this.trim(_apply.payWay);
nowObj.payAccount = this.trim(_apply.payAccount);
nowObj.mailAddr = this.trim(_apply.mailAddr);
nowObj.mailMobile = this.trim(_apply.mailMobile);
nowObj.mailTo = this.trim(_apply.mailTo);
nowObj.remark = this.trim("");
nowObj.delivererId = this.trim("");
nowObj.isPay = 0;
let res = await this.db.transaction(async (t) => {
// 插入发票申请单
let _nowObj = await this.dao.create(nowObj, t);
// 插入一条发票信息
await this.invoiceDao.create({
id: _nowObj.id,
applyNo: _nowObj.applyNo,
merchantId: _nowObj.merchantId,
red_status: '1',
}, t);
// 源发票改为红冲办理中
var updfields = {
redStatus: '2',
id: _apply.id,
}
await this.invoiceDao.update(updfields, t);
});
return system.getResultSuccess();
} catch (error) {
console.log(error);
return system.getResult(null, `参数错误 错误信息 ${error}`);
}
}
/**
* 插入发票
* @param {*} params
*/
async saveInvoice(params) {
try {
//判断是否存在发票
let _invoiceIsHas = await this.dao.model.findOne({
where: {
merchantId: this.trim(params.merchantId),
applyNo: this.trim(params.applyNo)
}
});
if (_invoiceIsHas) {
return system.getResult(null, `发票已存在,请勿重复提交。`);
}
//试算
let val = await this.calcInvoice(params);
if (val.code != -1) {
params.personalIncomeTax = this.trim(val.personalIncomeTax);
params.additionalTax = this.trim(val.additionalTax);
params.valueAddedTax = this.trim(val.valueAddedTax);
params.serviceCharge = this.trim(val.serviceCharge);
params.isPay = (params.isPay) ? 1 : 0;
params.status = "1000";
params.customerStatus = "1000";
}
//标识是不是被红冲了
let flag = false;
if (params.invoiceId) {
//校验发票存在不
let _invoice = await this.invoiceDao.findOne({
where: {
id: this.trim(params.invoiceId)
}
});
if (!_invoice) {
return system.getResult(null, `此发票不能红冲`);
}
params.parentId = this.trim(params.invoiceId);
params.isInvalid = 1;
flag = true;
}
let res = await this.db.transaction(async (t) => {
//插入发票申请单
let _apply = await this.dao.create(params, t);
//插入一条发票信息
await this.invoiceDao.model.create({
id: _apply.id,
applyNo: _apply.applyNo,
merchantId: _apply.merchantId
}, t);
//如果parentId不为空则需要将此id的发票状态改成红冲
if (flag) {
//根该发票状态
await this.invoiceDao.update({
status: this.invoiceStatus.cancleInvoice,
id: this.trim(params.invoiceId)
}, t);
//根该发票申请表中状态
await this.dao.update({
status: this.invoiceStatus.cancelInvoice,
customerStatus: this.invoiceStatus.cancelInvoice,
id: this.trim(params.invoiceId)
});
}
});
return system.getResultSuccess();
} catch (error) {
return system.getResult(null, `系统错误 错误信息 ${error}`);
}
}
/**
* 查询bussinessmenId下已完成的不含税价发票总额度
* @param {*} bussinessmenId
*/
getSubTotalAmount(subTotal) {
let result = {};
if (subTotal >= this.MAX_TOTAL_AMOUNT) {
result.status = -1;
result.msg = "该商户发票总额已达到最大额度!";
return result;
} else {
result.status = 0;
if (subTotal >= this.WARNING_AMOUNT && subTotal <= this.MAX_TOTAL_AMOUNT) {
result.msg = `本次开票累计金额已达到${subTotal}元`;
} else {
result.msg = "ok";
}
return result;
}
}
/**
* 查询当前 申请单是否存在
* @param {*} creditCode 统一社会信用编码
*/
async verificationByBusinessmenCreditCode(businessmenCreditCode) {
let invoices = await this.dao.model.findAll({
where: {
businessmenCreditCode: businessmenCreditCode,
status: {
[this.db.Op.in]: ['1000', '0090']
}
}
});
let res = {};
if (!invoices || invoices.length > 0) {
res.status = -1;
res.msg = "该商户发票正在申请中,请等待审核通过或者撤回才能再次申请";
} else {
res.msg = "ok";
res.data = [];
res.status = 0;
}
return res;
}
/**
* 校验各种费率 的合法性
* @param {*} params
* params
*/
verificationParams(params) {
let res = {};
if (params.taxIncPriRat > 10000 || params.serviceRate > 10000 || params.taxCostPriRat > 10000) {
res.status = -1;
res.msg = "参数错误,所有费率都应小于1";
} else {
params.taxIncPriRat = new Decimal(params.taxIncPriRat).div(10000).toFixed(4);
params.taxCostPriRat = new Decimal(params.taxCostPriRat).div(10000).toFixed(4);
params.serviceRate = new Decimal(params.serviceRate).div(10000).toFixed(4);
res.status = 0;
res.msg = "ok";
}
return res;
}
/**
* 累计不含税价
* @param {*} businessmenId 商户id
* @param {*} taxIncPriRat 不含税价百分比
* @param {*} invoiceAmount 发票总额
* @param {*} type 计算类型 1:个税 2:增值税
* @param {*} valCalWay 增值税计算类型 1:月 2:季度 3:年
* @param {*} perCalWay 增值税计算类型 1:月 2:季度 3:年
* @param {*} invoiceTime 格式 YYYY-MM-DD hh:mm:ss
*/
async calAccumulatedPriceExcludingTax(businessmenId, businessmenCreditCode, taxIncPriRat, invoiceAmount, type, valCalWay, perCalWay, invoiceTime) {
let now = moment(invoiceTime),
startTime, attribute;
if (type === 1) { //个税
attribute = `invoiceAmount`;
if (perCalWay === 3) { //按照年
startTime = `${now.get('year')}-01-01 00:00:00`;
} else if (perCalWay === 2) { //按照季度
let quarter = now.quarter();
if (1 == quarter) { //第一季度
startTime = `${now.get('year')}-01-01 00:00:00`;
} else if (2 == quarter) {
startTime = `${now.get('year')}-04-01 00:00:00`;
} else if (3 == quarter) {
startTime = `${now.get('year')}-07-01 00:00:00`;
} else {
startTime = `${now.get('year')}-10-01 00:00:00`;
}
} else { //按照月
let _month = now.month() < 10 ? "0" + now.month() : now.month();
startTime = `${now.get('year')}-${_month}-01 00:00:00`;
}
} else {
attribute = `valueAddedTax`;
if (valCalWay === 1) { //月
startTime = `${now.get('year')}-${now.month()}-01 00:00:00`;
} else if (valCalWay === 2) { //季度
let quarter = now.quarter();
if (1 == quarter) { //第一季度
startTime = `${now.get('year')}-01-01 00:00:00`;
} else if (2 == quarter) {
startTime = `${now.get('year')}-04-01 00:00:00`;
} else if (3 == quarter) {
startTime = `${now.get('year')}-07-01 00:00:00`;
} else {
startTime = `${now.get('year')}-10-01 00:00:00`;
}
} else { //年
startTime = `${now.get('year')}-01-01 00:00:00`;
}
}
console.log("本年度开始的时间:" + startTime + " 至今:" + now.format("YYYY-MM-DD hh:mm:ss"));
let beforeAmount = await this.dao.model.sum(attribute, {
where: {
businessmenId: businessmenId,
businessmenCreditCode: businessmenCreditCode,
status: {
[this.db.Op.in]: ['1020', '1030', '1040', '1050', '1060', '1070', '1080', '1090', '1100', '1200', '1300']
},
invoiceTime: {
[this.db.Op.between]: [startTime, now.format("YYYY-MM-DD hh:mm:ss")],
}
}
});
beforeAmount = isNaN(beforeAmount) ? 0 : beforeAmount;
let res = new Decimal(invoiceAmount).plus(beforeAmount).div(Decimal.add(1, taxIncPriRat)).toFixed(2);
console.log("当前累计金额 :" + res);
return res;
}
/**
* 计算累计利润
* @param {*} x1 年累计金额
* @param {*} taxCostPriRat 核定成本费用率
*/
calAccumulatedProfit(x1, taxCostPriRat) {
if (taxCostPriRat == 0) {
return 0;
} else {
return new Decimal(x1).mul(Decimal.sub(1, taxCostPriRat)).toFixed(2);
}
}
/**
* 计算累计税值
* @param {*} businessmenId
* @param {*} type 计算类型 1:个税 2:增值税
* @param {*} valCalWay 增值税计算类型 1:月 2:季度
*
*/
async calCumulativeProfit(businessmenId, type, valCalWay) {
let now = moment(),
startTime, attribute;
if (type == 1) {
attribute = `personalIncomeTax`;
startTime = `${now.get('year')}-01-01 00:00:00`;
} else {
attribute = `valueAddedTax`;
if (valCalWay === 1) { //月
startTime = `${now.get('year')}-${now.month()}-01 00:00:00`;
} else { //季度
let quarter = now.quarter();
if (1 == quarter) { //第一季度
startTime = `${now.get('year')}-01-01 00:00:00`;
} else if (2 == quarter) {
startTime = `${now.get('year')}-04-01 00:00:00`;
} else if (3 == quarter) {
startTime = `${now.get('year')}-07-01 00:00:00`;
} else {
startTime = `${now.get('year')}-10-01 00:00:00`;
}
}
}
console.log("本年度开始的时间:" + startTime + " 至今:" + now.format("YYYY-MM-DD hh:mm:ss"));
let cumulativeProfit = await this.dao.model.sum(attribute, {
where: {
businessmenId: businessmenId,
status: this.invoiceStatus.auditPass,
invoiceTime: {
[this.db.Op.between]: [startTime, now.format("YYYY-MM-DD hh:mm:ss")],
}
}
});
return cumulativeProfit || 0;
}
/**
* 计算个税
* @param {*} x2 //累计不含说价
* @param {*} taxPer //个税税率
* @param {*} quiCalDed //速算扣除数
* @param {*} cumulativeProfit //累计缴纳的个税
*/
calTaxPersonal(x2, taxPer, quiCalDed, cumulativeProfit) {
x2 = x2 || 0;
quiCalDed = quiCalDed || 0;
taxPer = taxPer || 0;
cumulativeProfit = cumulativeProfit || 0;
if (taxPer == 0) {
return 0;
}
return (new Decimal(x2).mul(taxPer).div(100).sub(quiCalDed).sub(cumulativeProfit)).toFixed(2);
}
/**
* 计算附加税
* @param {*} valueAddedTax
* @param {*} addTaxRat
*/
calAddTax(valueAddedTax, addTaxRat) {
if (addTaxRat == 0) {
return 0
} else {
return new Decimal(valueAddedTax).mul(addTaxRat).div(100).toFixed(2);
}
}
/**
* 计算税率值
* @param {*} amount 金额
* @param {*} taxRange 税率范围
* @param {*} type 类型 1:个税 2 增值税
*/
calRateRange(amount, taxRange, type) {
let res = {};
if (type === this.PER_TAX) {
for (let item of taxRange) {
if (item.minValue <= amount && amount <= item.maxValue) {
res.taxPer = item.rate;
res.quiCalDed = item.quiCalDed;
break;
}
}
} else {
for (let item of taxRange) {
if (item.minValue <= amount && amount <= item.maxValue) {
res.valAddTaxRat = item.zengzhiRate;
res.addTaxRat = item.fujiaRate;
break;
}
}
}
//校验费率
// for (const key in res) {
// if(Number(res[key])>100){
// return {code:-1,msg:"费率不能大于1"};
// }
// }
res.status = 0;
return res;
}
/**
* 计算增值税
* @param {*} x3 //累计不含说价
* @param {*} valAddTaxRat //增值税率
* @param {*} cumulativeProfitOfvalTax //累计缴纳的增值税
*/
calValTax(x3, valAddTaxRat, cumulativeProfitOfvalTax) {
if (valAddTaxRat == 0) {
return 0;
}
let res = new Decimal(x3).mul(valAddTaxRat).div(100).sub(cumulativeProfitOfvalTax).toFixed(2);
return res;
}
/**
* 发票费用计算
* @param {*} params
*
* params:{
* invoiceAmount:100000, //发票金额
* invoiceTime:"2019-12-12", //开票时间
* businessmenCreditCode:"xxx", //纳税人识别号
* serviceRate:"0.03", //服务费率
* perCalWay:1, //个税计算方式 1:月 2:季度 3:年
* valCalWay:1, //增值税计算方式 1:月 2:季度 3:年
* businessmenId:1, //商户id
* taxIncPriRat:0.03, //不含税价百分比
* taxCostPriRat:0.96, //核定成本费用率
* perIncTaxRange:[
* {
* minValue:0,
* rate:"0",
* quiCalDed:0,
* maxValue:3000000
* }
* ],
* valAddTaxRange:[
* {
* minValue:0,
* zengzhiRate:0,
* fujiaRate:0,
* maxValue:3000000
* }
* ],
* }
*
*/
async calcInvoice(params) {
if (Number(this.trim(params.invoiceAmount)) > this.MAX_TOTAL_AMOUNT) {
return {
status: -1,
msg: `开票金额大于可开发票的最大金额`,
data: null
}
}
//参数验证: 验证所有的利率 都必须小于1
let vpr = this.verificationParams(params);
if (vpr.status === -1) {
return vpr;
}
// 验证发票是否存在或未完成
let invoiceRes = await this.verificationByBusinessmenCreditCode(this.trim(params.businessmenCreditCode));
if (invoiceRes.status === -1 || invoiceRes.data.length > 0) {
return invoiceRes;
}
// 服务费率
let serviceRate = Number(params.serviceRate || 0);
let serviceCharge = Number((params.invoiceAmount * serviceRate) / 100).toFixed(0) || 0;
//计算累计不含税价 businessmenId,businessmenCreditCode,taxIncPriRat,invoiceAmount,type,valCalWay,perCalWay,invoiceTime
let x1 = await this.calAccumulatedPriceExcludingTax(params.businessmenId, params.businessmenCreditCode, params.taxIncPriRat, params.invoiceAmount, this.PER_TAX, null, params.perCalWay, params.invoiceTime);
console.log("个税 累计不含税价总额:" + x1);
//判断总额度是否大于最大开票额度
let subTotalRes = this.getSubTotalAmount(x1);
//返回警告信息
let warning = "";
if (subTotalRes.status === -1) {
return subTotalRes;
} else {
if (subTotalRes.msg != "ok") {
warning = subTotalRes.msg;
}
}
//计算累计利润
let x2 = this.calAccumulatedProfit(x1, params.taxCostPriRat);
//根据 cumulativeProfit 查找对应梯度的个税税率和速算扣除数
let calRateRangeResForPer = this.calRateRange(x2, params.perIncTaxRange, this.PER_TAX);
//这块处理有问题
if (calRateRangeResForPer.status === -1) {
return calRateRangeResForPer;
}
let {
taxPer,
quiCalDed
} = calRateRangeResForPer;
//计算年累计的个税
let cumulativeProfit = await this.calCumulativeProfit(params.businessmenId, this.PER_TAX, params.valCalWay);
//计算个税
let personalIncomeTax = this.calTaxPersonal(x2, taxPer, quiCalDed, cumulativeProfit);
/*计算增值税*/
//计算累计不含税价
let x3 = await this.calAccumulatedPriceExcludingTax(params.businessmenId, params.businessmenCreditCode, params.taxIncPriRat, params.invoiceAmount, this.VAL_TAX, params.valCalWay, null, params.invoiceTime);
console.log("增值税 累计不含税价总额:" + x3);
//根据 cumulativeProfitOfvalTax 查找对应梯度的个税税率
let calRateRangeResForVal = this.calRateRange(x3, params.valAddTaxRange, this.VAL_TAX);
if (calRateRangeResForVal.code === -1) {
return calRateRangeResForVal;
}
let {
valAddTaxRat,
addTaxRat
} = calRateRangeResForVal;
//计算年累计的增值税
let cumulativeProfitOfvalTax = await this.calCumulativeProfit(params.businessmenId, this.VAL_TAX, params.valCalWay);
//计算增值税
let valueAddedTax = this.calValTax(x3, valAddTaxRat, cumulativeProfitOfvalTax);
//附加税
let additionalTax = this.calAddTax(valueAddedTax, addTaxRat);
let res = {
serviceCharge: serviceCharge, //服务费
personalIncomeTax: personalIncomeTax, //个税
valueAddedTax: valueAddedTax, //附加税
additionalTax: additionalTax, //附加税
warning: warning //警告信息
}
console.log("计算的各种税额:" + JSON.stringify(res));
return res;
}
async getByApplyNo(params) {
var merchantId = params.merchantId || params.merchant_id;
var applyNo = params.applyNo;
var item = await this.dao.getByApplyNo(merchantId, applyNo);
if (item) {
this.handleDate(item, ["created_at", "updated_at"], null, -8);
}
return system.getResultSuccess(item);
}
/**
* 查询发票明细
* @param {*} applyNo
* @param {*} merchantId
*/
async queryInvoice(applyNo, merchantId, id) {
try {
let _apply;
if (merchantId && applyNo) {
_apply = await this.dao.model.findOne({
where: {
merchantId: merchantId,
applyNo: applyNo
},
raw: true
});
} else if (id) {
_apply = await this.dao.model.findOne({
where: {
id: this.trim(id)
},
raw: true
});
} else {
_apply = null;
}
if (!_apply) {
return system.getResult(null)
}
this.dao.setRowCodeName(_apply, "status");
this.dao.setRowCodeName(_apply, "customerStatus");
//查询平台审批内容
let deliverer = await this.delivererDao.model.findOne({
where: {
id: _apply.delivererId
},
raw: true
});
_apply.deliverer = deliverer;
//查询发票信息
let invoice = await this.invoiceDao.model.findOne({
where: {
id: _apply.id
},
raw: true
});
this.dao.setRowCodeName(invoice, "status");
//红冲关联
let parentInvoice = await this.dao.model.findOne({
where: {
id: _apply.parentId
},
raw: true
});
this.dao.setRowCodeName(parentInvoice, "status");
this.dao.setRowCodeName(parentInvoice, "customerStatus");
_apply.invoice = invoice;
_apply.deliverer = deliverer || {};
_apply.parentInvoice = parentInvoice;
this.handleDate(_apply.invoice, ["taxTime", "invoiceTime"], "YYYY-MM-DD");
return system.getResult(_apply);
} catch (error) {
return system.getResult(null, `系统错误 错误信息:${error}`);
}
}
/**
* 发票撤回
* @param {*} applyNo
* @param {*} merchantId
* @param
*/
async cancelInvoice(applyNo, merchantId) {
let _invoice = await this.dao.model.findOne({
where: {
applyNo: applyNo,
merchantId: merchantId
},
attributes: ['id', 'status']
});
if (_invoice.status != this.invoiceStatus.unpay) {
return system.getResult(null, `当前发票正在处理,不能撤回`);
} else {
_invoice.status = this.invoiceStatus.recall;
try {
let res = await _invoice.save();
return system.getResult(res);
} catch (error) {
return system.getResult(null, `系统错误: ${error}`);
}
}
}
/**
* 发票业务分配
* @param {*} params
* {
* id:"" //发票id
* nextStatus:"" //发票状态
* }
*/
async assignment(params) {
let _apply = await this.verification(params);
try {
let res;
switch (params.nextStatus) {
case "1010": //审核不通过
res = await this.examine1000(params, _apply);
break;
case "1020": //待分配
res = await this.examine1000(params, _apply);
break;
case "1030": //待处理
res = await this.examine1030(params, _apply);
break;
case "1070": //审核通过
res = await this.examine1070(params, _apply);
break;
case "1300": //审核失败
res = await this.examine1300(params, _apply);
break;
case "1090": //已完成
res = await this.examine1090(params, _apply);
break;
default:
res = system.getResult(null, "action_type参数错误");
break;
}
return res;
} catch (error) {
return system.getResult(null, `系统错误 错误信息 ${error}`);
}
}
/**
* 第一次审核
* @param {*} params
* {
* id: xxx, //发票id
* isPay:1, //时候付款
* nextStatus:1020,//发票状态
* remark:""//发票标注
* }
*/
async examine1000(params, _apply) {
if (Number(params.isPay) != 1) {
return system.getResult(null, `参数错误 请核对付款信息`);
}
params.nextStatus = this.trim(params.nextStatus);
params.remark = this.trim(params.remark);
_apply.status = params.nextStatus;
_apply.remark = params.remark;
_apply.isPay = Number(params.isPay);
if(params.nextStatus=="1010"){
_apply.customerStatus="1010";
}
try {
let res = await _apply.save();
if (_apply.parentId && params.nextStatus =="1010") {
await this.invoiceDao.update({id: _apply.parentId, redStatus: '3'});
}
return system.getResultSuccess();
} catch (error) {
return system.getResult(null, `系统错误 错误信息 ${error}`);
}
}
/**
* 待处理 (当前状态待分配或者是审核为通过)
* @param {*} params
* {
* id: xxx, //发票id
* delivererId:1, //交付商
* nextStatus:examine1020,//发票状态
* delivererName:""//交付商名称
* delivererAmount:"" //分成
* }
*/
async examine1030(params, _apply) {
if (!params.id || !params.delivererName) {
return system.getResult(null, `系统错误 错误信息 ${error}`);
}
await this.db.transaction(async (t) => {
let _deliverer = await this.delivererDao.create({
invoiceId: _apply.id,
applyNo: _apply.applyNo,
merchantId: _apply.merchantId,
delivererId: this.trim(params.delivererId),
delivererName: this.trim(params.delivererName),
delivererAmount: Number(this.trim(params.delivererAmount))
}, t);
let applyData = {};
applyData.status = this.trim(params.nextStatus);
applyData.customerStatus = this.trim(params.nextStatus);
applyData.delivererId = this.trim(_deliverer.id);
applyData.id = this.trim(params.id);
//更新申请发票内容
await this.dao.update(applyData, t);
//更改发票状态
let invoiceData = {};
invoiceData.status = this.trim(params.nextStatus);
invoiceData.id = this.trim(params.id);
await this.invoiceDao.update(invoiceData, t);
}).catch(error => {
return system.getResult(null, `系统错误 错误信息 ${error}`);
});
return system.getResultSuccess();
}
/**
* 第二次审核
* @param {*} params
* {
* id: xxx, //发票id
* auditContent:1, //审核备注
* nextStatus:1070,//发票状态
* delivererContent:""//发票内容
* mailAddr:"", //邮寄地址
* mailMobile:"", //邮寄电话
* mailTo:"", //邮寄人
* }
*/
async examine1070(params, _apply) {
let delivererData = {},
applyData = {},
invoiceData = {};
let _deliverer = await this.delivererDao.findOne({
id: _apply.delivererId
});
delivererData.auditContent = this.trim(params.auditContent);
delivererData.delivererContent = this.trim(params.delivererContent);
delivererData.mailAddr = this.trim(params.mailAddr);
delivererData.mailMobile = this.trim(params.mailMobile);
delivererData.mailTo = this.trim(params.mailTo);
delivererData.mailEmail = this.trim(params.mailEmail);
delivererData.id = this.trim(_deliverer.id);
applyData.status = this.trim(params.nextStatus);
applyData.id = this.trim(params.id);
invoiceData.status = this.trim(params.nextStatus);
invoiceData.id = this.trim(params.id);
await this.db.transaction(async (t) => {
//更新deliverer信息
await this.delivererDao.update(delivererData, t);
//更新 申请单和发票单
await this.dao.update(applyData, t);
await this.invoiceDao.update(invoiceData, t);
if(_apply.parentId) {
await this.invoiceDao.update({id: _apply.parentId, redStatus: '4'}, t);
}
}).catch(error => {
return system.getResult(null, `系统错误 错误信息 ${error}`);
});
return system.getResultSuccess();
}
/**
* 第二次审核失败
* @param {*} params
*/
async examine1300(params) {
let _apply = await this.dao.findOne({
id: this.trim(params.id)
});
if (!_apply) {
return system.getResult(null, `发票不存在,请核对发票ID`);
}
let _deliverer=await this.delivererDao.model.findOne({
where:{
id:_apply.delivererId
}
});
if(!_deliverer){
return system.getResult(null,`交付商不存在,请联系管理员`);
}
await this.db.transaction(async (t) => {
//更新 申请单和发票单
await this.dao.update({
status: "1300",
id: _apply.id
}, t);
await this.invoiceDao.update({
status: "1300",
id: _apply.id
}, t);
if(_deliverer.id){
//提交审核信息
await this.delivererDao.update({
auditContent:this.trim(auditContent),
id:_deliverer.id
});
}
}).catch(error => {
return system.getResult(null, `系统错误 错误信息 ${error}`);
});
return system.getResultSuccess();
}
/**
* 平台更新 已完成状态
* @param {*} params
* @param {*} _apply
*/
async examine1090(params, _apply) {
let applyData = {};
applyData.status = this.trim(params.nextStatus);
applyData.customerStatus = this.trim(params.nextStatus);
applyData.id = this.trim(params.id);
// invoiceData.status = this.trim(params.nextStatus);
// invoiceData.id=this.trim(params.id);
await this.db.transaction(async (t) => {
//更新 申请单和发票单
await this.dao.update(applyData, t);
// await this.invoiceDao.update(invoiceData,t);
}).catch(error => {
return system.getResult(null, `系统错误 错误信息 ${error}`);
});
return system.getResultSuccess();
}
/**
* 检查状态是否正确
* @param {*} params
* {
* id:xxx //发票id
* nextStatus:xxx //发票状态
* }
*/
async verification(params) {
let _apply = await this.dao.findOne({
id: this.trim(params.id)
});
if (!_apply) {
return system.getResult(null, `此发票不存在`);
}
//获取当前状态 的对象
let _status = this.invoiceStatus[_apply.status];
//如果不符合状态则退出
if (params.nextStatus == "1300" || params.nextStatus == "1040" || params.nextStatus == "1010") {
return _apply;
}
if (!_status && _status.next != params.nextStatus) {
let name = this.invoiceStatus[this.invoiceStatus[_apply.status].next].name;
return system.getResult(null, `更新状态错误,提示:当前状态的下一个状态是 ${name}`);
}
return _apply;
}
/**
* 发票申请列表查询(平台)
* @param {*} params
* @param applyNo 发票的申请编号
* @param invoiceTime 发票的申请时间
* @param type 发票的类型
* @param status 业务进度
*/
async queryApplyInvoices(params) {
let where = {};
if (this.trim(params.applyNo)) {
where.applyNo = this.trim(params.applyNo);
}
if (this.trim(params.invoiceTime)) {
where.invoiceTime = {
[this.db.Op.gte]:this.trim(params.invoiceTime)
}
}
if (this.trim(params.type)) {
where.type = this.trim(params.type);
}
if (this.trim(params.status)) {
where.status = this.trim(params.status);
}
let pageIndex = params.pageIndex || 1;
let pageSize = params.pageSize || 10;
let orderObj = [
// ['updatedAt', 'desc'],
['id', 'desc']
];
try {
let _apply = await this.dao.getPageList(pageIndex, pageSize, where, orderObj, null, null);
for (let item of _apply.rows) {
let _deliverer = await this.delivererDao.model.findOne({
// where: {
// delivererId: item.delivererId
// },
attributes: ['delivererName']
});
if (_deliverer) {
item.delivererName = _deliverer.delivererName;
} else {
item.delivererName = "";
}
if (item.type == "10") {
item.type = "普通发票";
} else if (item.type == "20") {
item.type = "增值税专用发票";
} else if(item.type=="30"){
item.type = "电子发票";
}else{
item.type="";
}
let _invoice = await this.invoiceDao.model.findOne({
where: {
id: item.id
},
attributes: ['status']
});
if (_invoice.status) {
this.dao.setRowCodeName(_invoice, "status");
} else {
_invoice.status = "";
}
item.delivererStatus = _invoice.statusName;
//处理时间
this.handleDate(item, ["invoiceTime"], null, -8);
this.dao.setRowCodeName(item, "status");
item.isPay = item.isPay == 1 ? '已付款' : '未付款';
}
return system.getResult(_apply);
} catch (error) {
return system.getResult(`系统错误 错误信息 ${error}`);
}
}
/**
* 列举所有日期
* @param {*} end
*/
getDays(end) {
var days = [];
var month = moment(end).format("YYYY-MM");
var endDay = Number(moment(end).format("DD"));
for (var i = 1; i <= endDay; i++) {
if (i < 10) {
days.push(month + "-0" + i);
} else {
days.push(month + "-" + i);
}
}
return days;
}
addStatCount(statusMap, statuses) {
var count = 0;
if(!statuses) {
return count;
}
for(var status of statuses) {
count = count + Number(statusMap[status] || 0);
}
return count;
}
}
module.exports = ApplyService;
\ No newline at end of file
const ServiceBase = require("../../sve.base");
const system = require("../../../system");
const moment = require('moment');
/**
* 平台提交的信息
*/
class DelivererService extends ServiceBase {
constructor() {
super("invoice", ServiceBase.getDaoName(DelivererService));
// this.invoiceDao = system.getObject("db.invoice.invoiceDao");
this.applyDao = system.getObject("db.invoice.applyDao");
}
/**
* 平台业务分配
* @param {*} params
*/
async apiAssignment(params) {
try {
return await this.assignment(params);
} catch (error) {
return system.getResult(null, `系统错误 错误信息 ${error}`);
}
}
/**
* 产看业务办理
* @param {*} params
* {
* id:xxx 发票id
* }
*/
async apiQueryProcess(params) {
try {
return await this.queryProcess(params);
} catch (error) {
return system.getResult(null, `系统错误 错误信息 ${error}`);
}
}
/**
* 平台更新地址
* @param {*} params
*/
async apiUpEmNo(params) {
try {
if (!params.id) { return system.getResult(null, `参数错误 ID不能为空`); }
if (!params.platformMailNo) { return system.getResult(null, `参数错误 邮寄单号不能为空`); }
return await this.updateEmailNo(params);
} catch (error) {
return system.getResult(null, `系统错误 错误信息 ${error}`);
}
}
/**
* 申请列表(交付商)
* @param {*} params
*/
async apiDelivererApplyInvoices(params) {
try {
// if (!params.delivererId) { return system.getResult(null, `参数错误 ID不能为空`); }
return await this.delivererApplyInvoices(params);
} catch (error) {
return system.getResult(null, `系统错误 错误信息 ${error}`);
}
}
/**
* 发票明细(交付商)
* @param {*} params
*/
async apiQueryInvoiceDeliverer(params) {
try {
var merchantId = params.merchantId || params.merchant_id;
if ((params.merchantId && params.applyNo) || params.id) {
let res = await this.queryInvoiceDeliverer(params.applyNo, merchantId, params.id);
return res;
} else {
return system.getResultSuccess();
}
} catch (error) {
return system.getResult(null, `系统错误 错误信息:${error}`);
}
}
/**
* 交付商审批列表
* @param {*} params
*/
async apiDelInvs(params) {
try {
return await this.delInvs(params);
} catch (error) {
return system.getResult(null, `系统错误 错误信息 ${error}`);
}
}
/**
* 交付商业务概览
* @param {*} params
*/
async apiStatDeliverData(params) {
try {
return await this.statDeliverData(params);
} catch (error) {
console.log(error);
return system.getResult(null, "接口异常");
}
}
/**
* 交易数据(交付商)
* @param {*} params
*/
async apiDelStatTransData(params) {
try {
if(!params.delivererId){
return system.getResult(-1,`交付商ID不能为空`);
}
return await this.delStatTransData(params);
} catch (error) {
return system.getResult(-1,`系统错误 错误信息 ${error}`);
}
}
/**
* 发票办理(交付商)
* @param {*} params
*/
async apiDelStatBusinessData(params) {
try {
if(!params.delivererId){
return system.getResult(-1,`交付商ID不能为空`);
}
return await this.delStatBusinessData(params);
} catch (error) {
console.log(error);
return system.getResult(null, "接口异常");
}
}
//=========================================================================================//
/**
* 发票办理(交付商)
* @param {*} params
*/
async delStatBusinessData(params) {
try {
var result = {};
var type = Number(params.type || 1);
// 查 已完成订单,待分配订单,待审核订单,办理中订单
var begin, end,delivererId=params.delivererId;
// 取开始时间
if (type == 1) {//本月
begin = moment().format("YYYY-MM") + "-01 00:00:00";
end = moment(begin).add(1, "months").subtract(1, 'days').format("YYYY-MM-DD") + " 23:59:59";
} else if (type == 2) {//上个月
begin = moment().subtract(1, "months").format("YYYY-MM") + "-01 00:00:00";
end = moment(begin).add(1, "months").subtract(1, 'days').format("YYYY-MM-DD") + " 23:59:59";
}
// 先按照订单状态查
let list = await this.dao.model.findAll({
include:[
{
association:this.dao.model.belongsTo(this.applyDao.model,{
foreignKey:"invoiceId",targetKey:"id"
}),
required:true,
attributes:['status'],
where:{
status:{
[this.db.Op.in]:['1030','1040','1050','1060','1300']
}
}
}
],
where:{
delivererId:delivererId,
createdAt:{
[this.db.Op.between]:[begin,end]
}
},
attributes:['id','delivererName','delivererId']
});
// 已开具 1050
let count = 0;
for(let item of list){
if(item.apply.status=="1050"){
count+=1;
}
}
result.completeCount = count || 0;
result.handlingCount = list.length-count<=0?0:list.length-count;
return system.getResultSuccess(result);
} catch (error) {
return system.getResult(-1,`系统错误 错误信息 ${error}`);
}
}
/**
* 交易数据(交付商)
* @param {*} params
*/
async delStatTransData(params) {
try {
var result = {
invoiceCount: 0,
delivererAmount: 0,
};
var type = Number(params.type || 1);
var begin, end,delivererId=params.delivererId;
// 取开始时间
if (type == 1) {
begin = moment().format("YYYY-MM") + "-01 00:00:00";
} else if (type == 2) {
begin = moment().subtract(1, "months").format("YYYY-MM") + "-01 00:00:00";
}
// echart数据
var days = [];
var dayCounts = [];
var priceCounts = [];
// 处理查询业务
if (type == 1 || type == 2) { // 取结束时间
end = moment(begin).add(1, "months").subtract(1, 'days').format("YYYY-MM-DD") + " 23:59:59";
days = this.getDays(end);
// 按天统计
var dayMap = await this.dao.delStatDayByTime(begin, end,delivererId);
for (var day of days) {
var ditem = dayMap[day] || {};
dayCounts.push(ditem.invoiceCount || 0);
priceCounts.push(system.f2y(ditem.delivererAmount || 0));
}
} else {
var monthMap = await this.dao.delStatMonthByTime(begin, end, delivererId);
var bm = monthMap.begin || "";
var em = monthMap.end || "";
if (bm && em) {
// 开始月份-结束月份所有月份
var curMonth = bm;
while (true) {
days.push(curMonth);
if (curMonth == em) {
break;
}
curMonth = moment(curMonth + "-01").add(1, "month").format("YYYY-MM");
}
}
for (var day of days) {
var ditem = monthMap[day] || {};
dayCounts.push(ditem.invoiceCount || 0);
priceCounts.push(system.f2y(ditem.delivererAmount || 0));
}
}
var invoiceApplyData = await this.dao.delStatInvoiceByTime(begin, end ,delivererId) || {};
result.invoiceCount = invoiceApplyData.invoiceCount;
result.delivererAmount = system.f2y(invoiceApplyData.delivererAmount);
result.days = days;
result.dayCounts = dayCounts;
result.priceCounts = priceCounts;
return system.getResultSuccess(result);
} catch (error) {
return system.getResult(null,`系统错误 错误信息 ${error}`);
}
}
/**
* 交付商业务概览
* @param {*} params
*/
async statDeliverData(params) {
try {
var currentPage = Number(params.currentPage || 1);
var pageSize = Number(params.pageSize || 10);
// 处理时间
var type = Number(params.type || 1);
var begin, end;
// 取开始时间
if (type == 1) {
begin = moment().format("YYYY-MM") + "-01 00:00:00";
end = moment(begin).add(1, "months").subtract(1, 'days').format("YYYY-MM-DD") + " 23:59:59";
} else if (type == 2) {
begin = moment().subtract(1, "months").format("YYYY-MM") + "-01 00:00:00";
end = moment(begin).add(1, "months").subtract(1, 'days').format("YYYY-MM-DD") + " 23:59:59";
}
var condition = {
begin: begin,
end: end,
}
// 查总数
var _res = await this.dao.countStat(condition);
if (_res.total == 0) {
return system.getResultSuccess({
count: 0,
rows: []
});
}else{
let _str=[];
//这个id是交付商的id
for (let item of _res.list) {
_str.push(`'${item.deliverer_id}'`);
}
condition.list=_str.join(",");
}
// 查条数
var startRow = (currentPage - 1) * pageSize;
var list = await this.dao.queryStat(condition, startRow, pageSize);
for (let item of list) {
item.totalAmount=system.f2y(item.totalAmount || 0)
}
//计算每个
// 设置已完成数量、办理中数量
var delivererIds = [];
for (var item of list) {
//这个是交付商表的主键
delivererIds.push(item.id);
}
var dstatusMap = await this.dao.statDeliverByStatus({
begin: begin,
end: end,
delivererIds: delivererIds
});
for (var item of list) {
item.completeCount = this.addStatCount(dstatusMap, item.id, ['1080',"1090"]);
item.handlingCount = this.addStatCount(dstatusMap, item.id, ['1030','1040','1050','1060','1300']);
}
return system.getResultSuccess({
count: _res.total,
rows: list
});
} catch (error) {
system.getResult(-1,`系统错误 错误信息 ${error}`);
}
}
addStatCount(statusMap, deliverer_id, statuses) {
var count = 0;
if (!statuses || statuses.length == 0) {
return count;
}
for (var status of statuses) {
count = count + Number(statusMap[deliverer_id + "_" + status] || 0);
}
return count;
}
/**
* 发票业务分配
* @param {*} params
* {
* applyNo:"" //发票编号
* nextStatus:"" //发票状态
* }
*/
async assignment(params) {
let obj = await this.verification(params);
let _apply = obj._apply;
let _invoice = obj._invoice;
try {
let res;
switch (params.nextStatus) {
case "1040": //交付商以关闭
res = await this.examine1040(params, _apply, _invoice);
break;
case "1050": //已开具
res = await this.examine1050(params, _apply, _invoice);
break;
case "1060": //待审核
res = await this.examine1060(params, _apply, _invoice);
break;
case "1080": //邮寄
res = await this.examine1080(params, _apply, _invoice);
break;
case "1090": //已邮寄
res = await this.examine1090(params, _apply, _invoice);
break;
default:
res = system.getResult(null, "action_type参数错误");
break;
}
return res;
} catch (error) {
return system.getResult(null, `系统错误 错误信息 ${error}`);
}
}
/**
* 交付商拒绝
* @param {*} params
* {
* "id":"xxx",
* "nextStatus":"1040",
* ""
* }
* @param {*} _apply
* //将申请表中的delivererId 变成null,
* //将invoice和apply 中的状态待分配 1020
* //添加拒绝原因
*/
async examine1040(params, _apply, _invoice) {
//更改发票表信息
_invoice.status = this.trim(params.nextStatus);
//添加拒绝原因
let delivererData = {
breakReason: this.trim(params.breakReason),
id: _apply.delivererId
};
//更改申请表信息
_apply.status = "1020";
_apply.delivererId = null;
let applyData = {};
applyData.id = _apply.id;
applyData.status = "1020";
applyData.delivererId = '';
let invoiceData = {};
invoiceData.status = "1020";
await this.db.transaction(async (t) => {
//更新申请表状态
await this.applyDao.update(applyData, t);
//更新发票表状态
await this.invoiceDao.update(invoiceData, t);
//更新拒绝原因
await this.dao.update(delivererData, t);
}).catch(error => {
return system.getResult(null, `系统错误 错误信息 ${error}`);
});
return system.getResultSuccess();
}
/**
* 交付商开具
* @param {*} params
* @param {*} _apply
*/
async examine1050(params, _apply, _invoice) {
//更改发票表信息
let invoiceData = {};
invoiceData.id = params.id;
invoiceData.invoiceNo = this.trim(params.invoiceNo);
invoiceData.invoiceTime = this.trim(params.invoiceTime);
invoiceData.invoiceImg = this.trim(params.invoiceImg);
invoiceData.status = this.trim(params.nextStatus);
//更改申请表信息
let applyData = {};
applyData.id = params.id;
applyData.status = this.trim(params.nextStatus);
applyData.customerStatus = this.trim(params.nextStatus);
await this.db.transaction(async (t) => {
//更新申请表状态
await this.applyDao.update(applyData, t);
//更新发票表状态
await this.invoiceDao.update(invoiceData, t);
}).catch(error => {
return system.getResult(null, `系统错误 错误信息 ${error}`);
});
return system.getResultSuccess();
}
/**
* 交付商提交审核
* @param {*} params
* {
* nextStatus:xxx, //发票状态
* id:xxx //发票id
* }
* @param {*} _apply
*/
async examine1060(params, _apply, _invoice) {
let invoiceData = {}, applyData = {};
invoiceData.status = params.nextStatus;
invoiceData.id = params.id;
if (params.invoiceNo) {
invoiceData.invoiceNo = this.trim(params.invoiceNo);
}
if (params.invoiceTime) {
invoiceData.invoiceTime = this.trim(params.invoiceTime);
}
if (params.invoiceImg) {
invoiceData.invoiceImg = this.trim(params.invoiceImg);
}
applyData.status = params.nextStatus;
applyData.id = params.id;
await this.db.transaction(async (t) => {
//更新申请表状态
await this.applyDao.update(applyData, t);
//更新发票表状态
await this.invoiceDao.update(invoiceData, t);
}).catch(error => {
return system.getResult(null, `系统错误 错误信息 ${error}`);
});
return system.getResultSuccess();
}
/**
* 交付商已邮寄
* @param {*} params
* {
* nextStatus:xxx, //发票状态
* id:xxx //发票id
* }
* @param {*} _apply
*/
async examine1080(params, _apply, _invoice) {
let invoiceData = {}, applyData = {}, delivererData = {};
//更改发票表信息
invoiceData.status = this.trim(params.nextStatus);
invoiceData.mailNo = this.trim(params.mailNo);
invoiceData.id = this.trim(params.id);
//更改申请表信息
applyData.status = this.trim(params.nextStatus);
applyData.id = this.trim(params.id);
//交付商
let _deliverer = await this.dao.findOne({ id: _apply.delivererId });
delivererData.delivererMailNo = params.mailNo;
delivererData.id = _deliverer.id;
await this.db.transaction(async (t) => {
//更新申请表状态
await this.applyDao.update(applyData, t);
//更新发票表状态
await this.invoiceDao.update(invoiceData, t);
//更新交付商信息
await this.dao.update(delivererData, t);
}).catch(error => {
return system.getResult(null, `系统错误 错误信息 ${error}`);
});
return system.getResultSuccess();
}
/**
* 检查状态是否正确
* @param {*} params
* {
* id:xxx //发票id
* nextStatus:xxx //发票状态
* }
*/
async verification(params) {
let _apply = await this.applyDao.findOne({ id: params.id });
let _invoice = await this.invoiceDao.findOne({ id: params.id });
if (!_invoice) { return system.getResult(null, `此发票不存在`); }
//获取当前状态 的对象
let _status = this.invoiceStatus[_invoice.status];
//如果不符合状态则退出
if (params.nextStatus == "1300" || params.nextStatus == "1040" || params.nextStatus == "1010") {
let obj = {
_apply: _apply,
_invoice: _invoice
};
return obj;
} else if (!_status && _status.dstatus != params.nextStatus) {
let name = this.invoiceStatus[this.invoiceStatus[_invoice.status].dstatus].name;
return system.getResult(null, `更新状态错误,提示:当前状态的下一个状态是 ${name}`);
}
let obj = {
_apply: _apply,
_invoice: _invoice
};
return obj;
}
/**
* 查看业务办理
*/
async queryProcess(params) {
let _apply = await this.applyDao.model.findOne({ where: { id: this.trim(params.id) }, attributes: ['delivererId'] });
if (!_apply) {
return system.getResult(null, `发票不存在`);
}
let _deliverer = await this.dao.findOne({ id: _apply.delivererId });
return system.getResult(_deliverer);
}
/**
* 平台更新邮寄地址
* @param {*} params
*/
async updateEmailNo(params) {
try {
let _apply = await this.applyDao.model.findOne({ where: { id: this.trim(params.id) }, attributes: ['delivererId'] });
if (!_apply) { return system.getResult(null, `发票不存在,请确认发票ID`); }
let _deliverer = await this.dao.model.findOne({ where: { id: _apply.delivererId } });
if (!_deliverer) { return system.getResult(null, `交付商办理信息不存在,请联系管理员`); }
_deliverer.platformMailNo = this.trim(params.platformMailNo);
let res = await _deliverer.save();
return system.getResult(res);
} catch (error) {
return system.getResult(null, `系统错误 错误信息 ${error}`);
}
}
/**
* 交付商申请列表
* @param {*} params
*/
async delivererApplyInvoices(params) {
try {
// if (!params.delivererId) { return system.getResult({ rows: 0, data: {} }); }
// let where = `where b.deliverer_id = ${this.trim(params.delivererId)}`;
let where = "where 1=1 ";
if (this.trim(params.applyNo)) {
where += ` and a.apply_no='${this.trim(params.applyNo)}'`;
}
if (this.trim(params.invoiceTime)) {
where += `and a.invoice_time>='${this.trim(params.invoiceTime)}'`;
}
if (this.trim(params.type)) {
where += `and a.type='${this.trim(params.type)}'`;
}
if (this.trim(params.status)) {
where += `and c.status='${this.trim(params.status)}'`;
}
params.statRow = (Number(this.trim(params.pageIndex)) - 1) * Number(this.trim(params.pageSize));
if (params.statRow <= 0) { params.statRow = 0; }
params.pageSize = Number(this.trim(params.pageSize)) <= 0 ? 10 : Number(this.trim(params.pageSize));
let countSql = "";
countSql = countSql + "select count(1) as count ";
countSql = countSql + "from invoice_deliverer b ";
countSql = countSql + "inner join invoice_apply a on b.invoice_id = a.id ";
countSql = countSql + "inner join invoice c on c.id = b.invoice_id ";
countSql = countSql + where;
let total = await this.customQuery(countSql);
if (total[0].count == 0) {
return { rows: [], count: 0 }
}
let dataSql = `select a.id, a.apply_no,a.type,a.invoice_amount,a.invoice_time,c.status,a.merchant_name,a.businessmen_name
from invoice_deliverer b inner join invoice_apply a on b.invoice_id = a.id
inner join invoice c on c.id = b.invoice_id ${where}`
dataSql += `order by id desc limit ${params.statRow},${params.pageSize}`;
let rows = await this.customQuery(dataSql);
for (let item of rows) {
if (item.type == "10") {
item.type = "普通发票";
} else if (item.type == "20") {
item.type = "增值税专用发票";
} else if (item.type == "30") {
item.type = "电子发票";
} else {
item.type = "";
}
this.handleDate(item, ["invoice_time"], "YYYY-MM-DD HH:mm:ss", -8);
this.dao.setRowCodeName(item, "status");
}
let res = { count: total[0].count, rows: rows };
return system.getResult(res);
} catch (error) {
return system.getResult(null, `系统错误 错误信息 ${error}`);
}
}
/**
* 查询发票明细(交付商)
* @param {*} applyNo
* @param {*} merchantId
*/
async queryInvoiceDeliverer(applyNo, merchantId, id) {
try {
let _apply;
if (merchantId && applyNo) {
_apply = await this.applyDao.model.findOne({
where: {
merchantId: this.trim(merchantId),
applyNo: this.trim(applyNo)
},
attributes: this._applyAttribute,
raw: true
});
} else if (id) {
_apply = await this.applyDao.model.findOne({
where: { id: this.trim(id) },
attributes: this._applyAttribute,
raw: true
});
} else {
_apply = null;
}
if (!_apply) { return system.getResult(null) }
//格式化字典
_apply.isBank = this.isBank == 1 ? '开户' : '未开户';
if (_apply.type == 10) {
_apply.type = "普通发票";
} else if (_apply.type == 20) {
_apply.type = "增值税专用发票";
} else {
_apply.type = "电子发票"
}
//格式化日期
this.handleDate(_apply, ["invoiceTime"], "YYYY-MM-DD HH:mm:ss", -8);
this.handleDate(_apply, ["createdAt"], "YYYY-MM-DD HH:mm:ss", -8);
//查询平台审批内容
let deliverer = await this.dao.model.findOne({
where: { id: _apply.delivererId },
raw: true,
attributes: this._delivererAttribute
});
//查询发票信息
let invoice = await this.invoiceDao.model.findOne({
where: { id: _apply.id },
attributes: this._invoiceAttribute,
raw: true
});
this.handleDate(invoice, ["invoiceTime"], "YYYY-MM-DD HH:mm:ss", -8);
this.handleDate(invoice, ["taxTime"], "YYYY-MM-DD HH:mm:ss", -8);
invoice.complateTax = invoice.complateTax == 1 ? '已完税' : '未完税';
deliverer.status = invoice.status;
//格式化状态
this.dao.setRowCodeName(deliverer, "status");
_apply.deliverer = deliverer;
delete invoice["status"];
_apply.invoice = invoice;
_apply.deliverer = deliverer || null;
return system.getResult(_apply);
} catch (error) {
return system.getResult(null, `系统错误 错误信息:${error}`);
}
}
/**
* 发票列表(交付商)
* @param {*} params
*/
async delInvs(params) {
let where = '';
// if (this.trim(params.delivererId)) {
// where += `and deliverer_id = '${this.trim(params.delivererId)}`;
// }
if (this.trim(params.applyNo)) {
where += ` and a.apply_no='${this.trim(params.applyNo)}'`;
}
if (this.trim(params.invoiceTime)) {
where += `and a.invoice_time >= '${this.trim(params.invoiceTime)}'`;
}
if (this.trim(params.type)) {
where += ` and a.type='${this.trim(params.type)}'`;
}
if (this.trim(params.status)) {
where += `and b.status = '${this.trim(params.status)}'`;
} else {
where += `and b.status in('1070','1080','1090')`;
}
if (this.trim(params.complateTax) == "1" || this.trim(params.complateTax) == "0") {
where += ` and b.complate_tax='${this.trim(params.complateTax)}'`;
}
if (this.trim(params.redStatus)) {
where += ` and b.red_status='${this.trim(params.redStatus)}'`;
}
params.statRow = (Number(this.trim(params.pageIndex)) - 1) * Number(this.trim(params.pageSize));
if (params.statRow <= 0) { params.statRow = 0; }
params.pageSize = Number(this.trim(params.pageSize)) <= 0 ? 10 : Number(this.trim(params.pageSize));
try {
let sql = `select count(1) as total from invoice_apply a inner join invoice b on a.id=b.id where 1=1 ${where}`;
let total = await this.customQuery(sql);
// let sqlData=`select a.apply_no,a.type,a.invoice_amount,a.invoice_time,b.status,a.merchant_name,a.businessmen_name,a.id from invoice_apply a, invoice b where 1=1 ` ;
let sqlData = `select a.id, a.apply_no,a.type,b.invoice_no,b.invoice_time,a.invoice_amount,a.merchant_id,a.merchant_name,
a.merchant_credit_code,a.merchant_addr,a.merchant_mobile,a.merchant_bank,a.merchant_account,a.businessmen_id,
a.businessmen_credit_code,a.businessmen_name,a.businessmen_addr,a.businessmen_mobile,a.businessmen_bank,
a.businessmen_account,a.is_bank,a.tax_authoritioes,a.is_invalid,b.complate_tax, b.status,b.red_status from invoice_apply a
inner join invoice b on a.id=b.id where 1=1 ` ;
if (where) {
sqlData += ` ${where}`;
}
sqlData += ` limit ${params.statRow},${params.pageSize}`;
let rows = await this.customQuery(sqlData);
for (let item of rows) {
if (item.type == 10) {
item.type = '普通发票';
} else if (item.type == 20) {
item.type = '增值税专用发票';
} else if (item.type == 30) {
item.type = '电子发票';
} else { }
if (item.red_status == 1) {
item.red_status = '未红冲';
} else if (item.red_status == 2) {
item.red_status = '红冲中';
} else if (item.red_status == 3) {
item.red_status = '红冲失败';
} else if (item.red_status == 4) {
item.red_status = '红冲成功';
} else {
item.red_status = '';
}
item.month = moment(item.invoice_time).month() + 1;
item.complate_tax = item.complate_tax == 1 ? '已完成' : '未完成';
this.handleDate(item, ["invoice_time"], "YYYY-MM-DD HH:mm:ss", -8);
this.dao.setRowCodeName(item, "status");
}
let res = { count: total[0].total, rows: rows };
return system.getResult(res);
} catch (error) {
return system.getResult(null, `系统错误 错误信息 ${error}`);
}
}
/**
* 列举所有日期
* @param {*} end
*/
getDays(end) {
var days = [];
var month = moment(end).format("YYYY-MM");
var endDay = Number(moment(end).format("DD"));
for (var i = 1; i <= endDay; i++) {
if (i < 10) {
days.push(month + "-0" + i);
} else {
days.push(month + "-" + i);
}
}
return days;
}
// addStatCount(statusMap, statuses) {
// var count = 0;
// if(!statuses) {
// return count;
// }
// for(var status of statuses) {
// count = count + Number(statusMap[status] || 0);
// }
// return count;
// }
}
module.exports = DelivererService;
\ No newline at end of file
const ServiceBase = require("../../sve.base");
const system = require("../../../system");
const moment = require('moment')
/**
* 交付商 提交的信息
*/
class InvoiceService extends ServiceBase {
constructor() {
super("invoice", ServiceBase.getDaoName(InvoiceService));
let is = system.getObject("util.invoiceStatus");
this.invoiceStatus = is.status;
this.applyDao = system.getObject("db.invoice.applyDao");
this.delivererDao = system.getObject("db.invoice.delivererDao");
}
/**
* 完税证明
* @param {*} params
*/
async apiTxPayment(params) {
if (!params.id) {
return system.getResult(null, `参数错误 发票ID不合法`);
}
try {
let res = await this.txPayment(params);
return res;
} catch (error) {
return system.getResult(null, `参数错误 错误信息 ${error}`);
}
}
/**
* 查看完税证明
* @param {*} params
*/
async apiQueryTxPayment(params) {
if (!params.id) {
return system.getResult(null, `参数错误 发票ID不合法`);
}
try {
return await this.queryTxPayment(params);
} catch (error) {
return system.getResult(null, `参数错误 错误信息 ${error}`);
}
}
/**
* 发票列表(平台)
* @param {*} params
*/
async apiQueryInvoices(params) {
try {
if(params.applyNo){params.applyNo=this.trim(params.applyNo)}
if(params.type){params.type=this.trim(params.type);}
if(params.invoiceTime){params.invoiceTime=this.trim(params.invoiceTime);}
return await this.queryInvoices(params);
} catch (error) {
return system.getResult(null, `系统错误 错误信息 ${error}`);
}
}
//==============================================================
/**
* 完税证明
* @param {*} params
* {
* id:xxx //完税证明
* }
*/
async txPayment(params) {
try {
let _invoice = await this.dao.findOne({
id: this.trim(params.id)
});
if (!_invoice) {
return system.getResult(null, `发票不存在`);
}
let res = await this.dao.update({
id: this.trim(params.id),
taxNo: this.trim(params.taxNo),
complateTax: 1,
taxTime: this.trim(params.taxTime),
taxVoucher: this.trim(params.taxVoucher)
});
return system.getResult(res);
} catch (error) {
return system.getResult(null, `参数错误 错误信息 ${error}`);
}
}
/**
* 查看完税证明
* @param {*} params
* {
* id:xxx //完税证明
* }
*/
async queryTxPayment(params) {
try {
let _invoice = await this.dao.model.findOne({
where: {
id: this.trim(params.id),
complateTax: 1
},
attributes: ['id', 'taxNo', 'complateTax', 'taxTime', 'taxVoucher']
});
if (!_invoice) {
return system.getResult(null, `完税证明不存在`);
}
return system.getResult(_invoice);
} catch (error) {
return system.getResult(null, `参数错误 错误信息 ${error}`);
}
}
/**
* 发票列表查询(平台)
* @param {*} params
* @param applyNo 发票的申请编号
* @param invoiceTime 发票的申请时间
* @param type 发票的类型
* @param status 业务进度
*/
async queryInvoices(params) {
try {
var pageIndex = Number(params.pageIndex || 1);
var pageSize = Number(params.pageSize || 10);
var total = await this.dao.countByParams(params);
if (total == 0) {
return system.getResultSuccess({
count: 0,
rows: []
});
}
var startRow = (pageIndex - 1) * pageSize;
var list = await this.dao.pageByParams(params, startRow, pageSize);
await this.setApply(list);
for (var item of list) {
// item.redStatusName = this.dao.getRowCodeName(item, "red_status");
if (item.red_status == 1) {
item.red_status = '未红冲';
} else if (item.red_status == 2) {
item.red_status = '红冲中';
} else if (item.red_status == 3) {
item.red_status = '红冲失败'
} else if (item.red_status == 4) {
item.red_status = '红冲成功';
} else {
item.red_status = '';
}
this.dao.getRowCodeName(item.apply,"status");
item.complate_tax = item.complate_tax == 1 ? '已完税' : '未完税';
item.month = moment(item.invoice_time).month() + 1;
this.handleDate(item,['invoice_time'],null,-8);
if (item.apply['type'] == '10') {
item.apply['type'] = "普通发票";
} else if (item.apply['type'] == '20') {
item.apply['type'] = "增值税专用发票";
} else {
item.apply['type'] = "电子发票";
}
}
var page = {
count: total,
rows: list
};
return system.getResultSuccess(page);
} catch (error) {
console.log(error);
return system.getResult(`系统错误 错误信息 ${error}`);
}
}
async setApply(list) {
if (!list || list.length == 0) {
return;
}
var ids = [];
for (var item of list) {
ids.push(item.id);
}
var applyMap = await this.applyDao.findMapByIds(ids) || {};
for (var item of list) {
item.apply = applyMap[item.id] || {};
}
}
}
module.exports = InvoiceService;
\ No newline at end of file
...@@ -10,7 +10,6 @@ class ServiceBase { ...@@ -10,7 +10,6 @@ class ServiceBase {
this.daoName = daoName; this.daoName = daoName;
this.dao = system.getObject("db." + gname + "." + daoName); this.dao = system.getObject("db." + gname + "." + daoName);
this.restS = system.getObject("util.restClient"); this.restS = system.getObject("util.restClient");
this.orderBusinessStatus = system.getObject("util.orderBusinessStatus");
} }
/** /**
* 验证签名 * 验证签名
......
...@@ -147,55 +147,33 @@ class System { ...@@ -147,55 +147,33 @@ class System {
static getUid(len, radix) { static getUid(len, radix) {
var chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'.split(''); var chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'.split('');
var uuid = [], var uuid = [],
i; i;
radix = radix || chars.length; radix = radix || chars.length;
if (len) { if (len) {
for (i = 0; i < len; i++) uuid[i] = chars[0 | Math.random() * radix]; for (i = 0; i < len; i++) uuid[i] = chars[0 | Math.random() * radix];
} else { } else {
var r; var r;
uuid[8] = uuid[13] = uuid[18] = uuid[23] = '-'; uuid[8] = uuid[13] = uuid[18] = uuid[23] = '-';
uuid[14] = '4'; uuid[14] = '4';
for (i = 0; i < 36; i++) { for (i = 0; i < 36; i++) {
if (!uuid[i]) { if (!uuid[i]) {
r = 0 | Math.random() * 16; r = 0 | Math.random() * 16;
uuid[i] = chars[(i == 19) ? (r & 0x3) | 0x8 : r]; uuid[i] = chars[(i == 19) ? (r & 0x3) | 0x8 : r];
}
} }
}
} }
return uuid.join(''); return uuid.join('');
} }
static microsetting() {
var path = "/api/op/action/springboard";
if (settings.env == "dev") {
var domain = "http://192.168.18.237";
return {
common: domain + ":3102" + path,
merchant: domain + ":3101" + path,
order: domain + ":3103" + path,
invoice: "" + path,
payment: "" + path,
}
} else {
var odomain = "http://39.107.51.68"
return {
common: odomain + ":8333" + path,
merchant: odomain + ":8335" + path,
order: odomain + ":8336" + path,
invoice: odomain + ":8338" + path,
payment: odomain + ":8337" + path,
} }
}
} }
Date.prototype.Format = function (fmt) { //author: meizz Date.prototype.Format = function (fmt) { //author: meizz
var o = { var o = {
"M+": this.getMonth() + 1, //月份 "M+": this.getMonth() + 1, //月份
"d+": this.getDate(), //日 "d+": this.getDate(), //日
"h+": this.getHours(), //小时 "h+": this.getHours(), //小时
"m+": this.getMinutes(), //分 "m+": this.getMinutes(), //分
"s+": this.getSeconds(), //秒 "s+": this.getSeconds(), //秒
"q+": Math.floor((this.getMonth() + 3) / 3), //季度 "q+": Math.floor((this.getMonth() + 3) / 3), //季度
"S": this.getMilliseconds() //毫秒 "S": this.getMilliseconds() //毫秒
}; };
if (/(y+)/.test(fmt)) if (/(y+)/.test(fmt))
fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length)); fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
......
const system = require("../../system");
const uuidv4 = require('uuid/v4');
const md5 = require("MD5");
var settings = require("../../../config/settings");
class OpPlatformUtils {
constructor() {
this.logCtl = system.getObject("web.common.oplogCtl");
this.cacheManager = system.getObject("db.common.cacheManager");
this.restClient = system.getObject("util.restClient");
this.createUserUrl = settings.paasUrl() + "api/auth/accessAuth/register";
this.fetchDefaultVCodeUrl = settings.paasUrl() + "api/auth/accessAuth/fetchDefaultVCode";
this.loginUrl = settings.paasUrl() + "api/auth/accessAuth/login";
this.authByCodeUrl = settings.paasUrl() + "api/auth/accessAuth/authByCode";
}
getUUID() {
var uuid = uuidv4();
var u = uuid.replace(/\-/g, "");
return u;
}
async getReqApiAccessKey() {
return await this.cacheManager["ApiAccessKeyCache"].cache(settings.appKey, null, 3600);
}
/**
* 创建用户信息
* @param {*} userName 用户名
* @param {*} mobile 手机号
* @param {*} password 密码,不传为使用默认密码
*
* 返回值:
* {
"status": 0,---值为2000为已经存在此用户,注册失败
"msg": "success",
"data": {
"auth_url": "http://sj.app.com:3002/auth?opencode=1e4949d1c39444a8b32f023143625b1d",---回调url,通过回调地址获取平台用户信息
"opencode": "1e4949d1c39444a8b32f023143625b1d",---平台用户code随机生成会变,平台是30s有效期,通过其可以向获取用户信息
"open_user_id": 12---平台用户id
},
"requestid": "5362bf6f941e4f92961a61068f05cd7f"
}
*/
async createUserInfo(userName, mobile, password) {
var reqApiAccessKey = await this.getReqApiAccessKey();
if (!reqApiAccessKey || !reqApiAccessKey.accessKey) {
return system.getResult(null, "获取请求token失败");
}
var param = {
userName: userName,
mobile: mobile,
password: password || settings.defaultPassWord,
}
//按照访问token
var restResult = await this.restClient.execPostWithAK(
param,
this.createUserUrl, reqApiAccessKey.accessKey);
if (restResult.status != 0 || !restResult.data) {
return system.getResult(restResult.status, restResult.msg);
}
return system.getResultSuccess(restResult.data);
}
async fetchVCode(mobile) {
var reqApiAccessKey = await this.getReqApiAccessKey();
if (!reqApiAccessKey || !reqApiAccessKey.accessKey) {
return system.getResult(null, "获取请求token失败");
}
var param = { mobile: mobile }
//按照访问token
var restResult = await this.restClient.execPostWithAK(
param,
this.fetchDefaultVCodeUrl, reqApiAccessKey.accessKey);
if (restResult.status != 0 || !restResult.data) {
return system.getResult(null, restResult.msg);
}
return system.getResultSuccess();
}
/**
* 用户登录
* @param {*} userName 用户名
* @param {*} password 密码,不传为使用默认密码
*
* 返回值:
* {
"status": 0,---值为2010为用户名或密码错误
"msg": "success",
"data": {
"auth_url": "http://sj.app.com:3002/auth?opencode=1e4949d1c39444a8b32f023143625b1d",---回调url,通过回调地址获取平台用户信息
"opencode": "1e4949d1c39444a8b32f023143625b1d"---平台用户code随机生成会变,平台是30s有效期,通过其可以向获取用户信息
},
"requestid": "5362bf6f941e4f92961a61068f05cd7f"
}
*/
async login(userName, password) {
var reqApiAccessKey = await this.getReqApiAccessKey();
if (!reqApiAccessKey || !reqApiAccessKey.accessKey) {
return system.getResult(null, "获取请求token失败");
}
var param = {
userName: userName,
password: password || settings.defaultPassWord,
}
//按照访问token
var restResult = await this.restClient.execPostWithAK(
param,
this.loginUrl, reqApiAccessKey.accessKey);
if (restResult.status != 0 || !restResult.data) {
return system.getResult(restResult.status, restResult.msg);
}
return system.getResultSuccess(restResult.data);
}
/**
* 通过opencode获取用户登录信息
* @param {*} opencode 用户登录或注册opencode
*
* 返回值:
* {
"status": 0,---值为2010为用户名或密码错误
"msg": "success",
"data": {},---平台用户信息
"requestid": "5362bf6f941e4f92961a61068f05cd7f"
}
*/
async authByCode(opencode) {
var reqApiAccessKey = await this.getReqApiAccessKey();
if (!reqApiAccessKey || !reqApiAccessKey.accessKey) {
return system.getResult(null, "获取请求token失败");
}
var param = {
opencode: opencode
}
//按照访问token
var restResult = await this.restClient.execPostWithAK(
param,
this.authByCodeUrl, reqApiAccessKey.accessKey);
if (restResult.status != 0 || !restResult.data) {
return system.getResult(restResult.status, restResult.msg);
}
return system.getResultSuccess(restResult.data);
}
}
module.exports = OpPlatformUtils;
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;
var excel = require('exceljs');
const system=require("../system");
const uuidv4 = require('uuid/v4');
const fs=require("fs");
class ExcelClient {
constructor() {
this.columns = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'];
this.ossClient=system.getObject("util.ossClient");
this.filedownloadDao = system.getObject("db.filedownloadDao");
}
async download(params) {
var self = this;
var title = params.title || "";
var code = params.code || uuidv4();
var fileName = params.fileName || code + ".xlsx";
var filePath = params.filePath || "/tmp/" + fileName;
var rows = params.rows || [];
var user = params.user || {};
var wb = new excel.Workbook();
wb.properties.date1904 = true;
var sheet = wb.addWorksheet("sheet1");
var headers = rows[0];
console.log(headers, "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@2 headers");
if(title) {
sheet.addRow([title]);
sheet.getCell("A1").font = {
    name: '微软雅黑',
    family: 4,
    size: 12,
    bold: true
};
sheet.getCell('A1').alignment = { vertical: 'middle', horizontal: 'center' };
var colkey = 0;
if(headers.length > 0) {
colkey = headers.length - 1;
}
var endColumn = this.columns[colkey] || "A";
sheet.mergeCells("A1:" + endColumn + "1");
}
for(var r of rows) {
sheet.addRow(r);
}
wb.xlsx.writeFile(filePath).then(async function(d) {
var rtn = await self.ossClient.upfile(fileName, filePath);
fs.unlink(filePath,function(err){});
var obj = {
user_id : user.id || 0,
userName : user.userName || "",
code : code,
fileName : fileName,
filePath : rtn.url || "",
isDownload : false,
}
var obj = await self.filedownloadDao.create(obj);
});
}
}
module.exports = ExcelClient;
const system = require("../system"); const system = require("../system");
class OrderBusinessStatus { class InvoiceStatus {
constructor() { constructor() {
this.busiStatus = { this.finish="1090";
this.unpay="1000";
this.auditPass="1070";
this.recall="1100";
this.unAssignment="1020";//待分被
this.pending="1030";//待处理
this.cancleInvoice="1200";//红冲
this.status = {
"0090": {
"status": "0090",
"name": "未付款",
"next": "1000",
"cstatus": "0090",//客户
"dstatus": "",//交付商
},
"1000": { "1000": {
"status": "1000", "status": "1000",
"name": "未付款", "name": "待审核",
"next": "1020", "next": "1020",
"ostatus": "1000", "cstatus": "0090",//客户
"dstatus": "", "dstatus": "",//交付商
}, },
"1010": { "1010": {
"status": "1010", "status": "1010",
"name": "订单关闭", "name": "审核不通过",
"next": "", "next": "",
"ostatus": "1010", "cstatus": "1010",
"dstatus": "", "dstatus": "",
}, },
"1020": { "1020": {
"status": "1020", "status": "1020",
"name": "待分配", "name": "待分配",
"next": "1030", "next": "1030",
"ostatus": "1030", "cstatus": "1030",
"dstatus": "1030", "dstatus": "",
}, },
"1030": { "1030": {
"status": "1030", "status": "1030",
"name": "待处理", "name": "待处理",
"next": "1050", "next": "1050",
"ostatus": "1030", "cstatus": "1030",
"dstatus": "1030", "dstatus": "1030",
}, },
"1040": { "1040": {
"status": "1040", "status": "1040",
"name": "交付商关闭", "name": "交付商关闭",
"next": "1020", "next": "1020",
"ostatus": "1030", "cstatus": "1030",
"dstatus": "1030", "dstatus": "1040",
}, },
"1050": { "1050": {
"status": "1050", "status": "1050",
"name": "执照办理中", "name": "已开具",
"next": "1060", "next": "1060",
"ostatus": "1050", "cstatus": "1050",
"dstatus": "1050", "dstatus": "1050",
}, },
"1060": { "1060": {
"status": "1060", "status": "1060",
"name": "已出执照", "name": "待审核",
"next": "1070", "next": "1070",
"ostatus": "1060", "cstatus": "1050",
"dstatus": "1060", "dstatus": "1070",
}, },
"1070": { "1070": {
"status": "1070", "status": "1070",
"name": "刻章办理中", "name": "审核通过",
"next": "1080", "next": "1080",
"ostatus": "1070", "cstatus": "1050",
"dstatus": "1070", "dstatus": "1070",
}, },
"1080": { "1080": {
"status": "1080", "status": "1080",
"name": "已刻章", "name": "已邮寄",
"next": "1090", "next": "1090",
"ostatus": "1080", "cstatus": "1050",
"dstatus": "1080", "dstatus": "1080",
}, },
"1090": { "1090": {
"status": "1090", "status": "1090",
"name": "银行开户中", "name": "完成",
"next": "1100", "next": "1100",
"ostatus": "1090", "cstatus": "1090",
"dstatus": "1090", "dstatus": "1080",
}, },
"1100": { "1100": {
"status": "1100", "status": "1090",
"name": "银行卡已开户", "name": "发票撤回",
"next": "1110", "next": "1100",
"ostatus": "1100", "cstatus": "1090",
"dstatus": "1100", "dstatus": "1080",
},
"1110": {
"status": "1110",
"name": "税务报道中",
"next": "1120",
"ostatus": "1110",
"dstatus": "1110",
},
"1120": {
"status": "1120",
"name": "已税务报道",
"next": "1130",
"ostatus": "1120",
"dstatus": "1120",
},
"1130": {
"status": "1130",
"name": "待审核",
"next": "1140",
"ostatus": "1120",
"dstatus": "1130",
},
"1140": {
"status": "1140",
"name": "审核失败",
"next": "1150",
"ostatus": "1120",
"dstatus": "1140",
},
"1150": {
"status": "1150",
"name": "审核通过",
"next": "1160",
"ostatus": "1120",
"dstatus": "1150",
},
"1160": {
"status": "1160",
"name": "已邮寄",
"next": "1170",
"ostatus": "1120",
"dstatus": "1160",
}, },
"1170": { "1200": {
"status": "1170", "status": "1200",
"name": "已完成", "name": "红冲",
"ostatus": "1170", "next": "",
"cstatus": "1200",
"dstatus": "", "dstatus": "",
},
"1300": {
"status": "1300",
"name": "审核失败(平台第二次审核)",
"next": "1060",
"cstatus": "1050",
"dstatus": "1060",
} }
}; };
} }
async findOrderBusinessStatus(status) { async findInvoiceBusinessStatus(status) {
return this.busiStatus[status]; return this.invoiceStatus[status];
} }
async findOrderNextBusinessStatus(status) { async findInvoiceNextBusinessStatus(status) {
var curStatus = await this.findOrderBusinessStatus(status); var curStatus = await this.findInvoiceBusinessStatus(status);
if(!curStatus || !curStatus.next) { if(!curStatus || !curStatus.next) {
return; return;
} }
return await this.findOrderBusinessStatus(curStatus.next); return await this.findInvoiceBusinessStatus(curStatus.next);
} }
} }
module.exports = OrderBusinessStatus; module.exports = InvoiceStatus;
\ No newline at end of file \ No newline at end of file
...@@ -220,6 +220,7 @@ class RedisClient { ...@@ -220,6 +220,7 @@ class RedisClient {
async genrateId(tableName) { async genrateId(tableName) {
// "时间戳 - tableName的hashCode + (1000 - 9999) + 随机8位数" // "时间戳 - tableName的hashCode + (1000 - 9999) + 随机8位数"
var time = parseInt(new Date().getTime() / 1000); var time = parseInt(new Date().getTime() / 1000);
var tabcode = this.hashCode(tableName); var tabcode = this.hashCode(tableName);
......
...@@ -6,10 +6,10 @@ var settings={ ...@@ -6,10 +6,10 @@ var settings={
db:10, db:10,
}, },
database:{ database:{
dbname : "xgg-order", dbname : "xgg-invoice",
user: "write", user: "write",
password: "write", password: "write",
config: { config: {
// host: '43.247.184.35', // host: '43.247.184.35',
// port: 8899, // port: 8899,
host: '192.168.18.237', host: '192.168.18.237',
......
...@@ -4,11 +4,11 @@ var ENVINPUT = { ...@@ -4,11 +4,11 @@ var ENVINPUT = {
DB_PORT: process.env.DB_PORT, DB_PORT: process.env.DB_PORT,
DB_USER: process.env.DB_USER, DB_USER: process.env.DB_USER,
DB_PWD: process.env.DB_PWD, DB_PWD: process.env.DB_PWD,
DB_NAME: process.env.XGGSVEORDER_DB_NAME, DB_NAME: process.env.XGGSVEINVOICE_DB_NAME,
REDIS_HOST: process.env.REDIS_HOST, REDIS_HOST: process.env.REDIS_HOST,
REDIS_PORT: process.env.REDIS_PORT, REDIS_PORT: process.env.REDIS_PORT,
REDIS_PWD: process.env.REDIS_PWD, REDIS_PWD: process.env.REDIS_PWD,
REDIS_DB: process.env.XGGSVEORDER_REDIS_DB, REDIS_DB: process.env.XGGSVEINVOICE_REDIS_DB,
APP_ENV: process.env.APP_ENV ? process.env.APP_ENV : "dev" APP_ENV: process.env.APP_ENV ? process.env.APP_ENV : "dev"
}; };
var settings = { var settings = {
......
## 1. 发票接口
  1 [发票](doc/invoice/invoice_index.md)
<a name="menu">目录</a>
1. [交易数据(交付商)](#delTransData)
1. [业务办理数据(交付商)](#delBusinessData)
1. [交易数据](#transdata)
1. [业务办理数据](#businessData)
1. [业务概览](#businessOverview)
## **<a name="delTransData"> 本月交易数据(交付商)</a>**
[返回到目录](#menu)
##### URL
[/web/index/managerCtl/delTransData]
#### 参数格式 `JSON`
#### HTTP请求方式 `POST`
``` javascript
{
"action_process": "sijibao",
"action_type": "delStatTransData",
"action_body": {
"type":"1", // 筛选状态 1本月 2上月 3总计
"delivererId":"11330348689004287" //交付商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
{
"action_process": "sijibao",
"action_type": "delStatBusinessData",
"action_body": {
"type":1, // 筛选状态 1本月 2上月 3总计
"delivererId":"13120681528000587" //交付商ID
}
}
```
#### 返回结果
```javascript
{
"status": 0,
"msg": "success",
"data": {
"completeCount": 0, // 已开具
"handlingCount": 5 // 交付商办理中
},
"requestid": "776c869048b440d4bf16f9e2f7b42fb8"
}
```
## **<a name="transdata"> 本月交易数据(平台)</a>**
[返回到目录](#menu)
##### URL
[/web/index/managerCtl/transData]
#### 参数格式 `JSON`
#### HTTP请求方式 `POST`
``` javascript
{
"action_process": "sijibao",
"action_type": "delStatBusinessData",
"action_body": {
"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
{
"action_process": "sijibao",
"action_type": "delStatBusinessData",
"action_body": {
"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
{
"action_process": "sijibao",
"action_type": "delStatBusinessData",
"action_body": {
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
{ {
"name": "xggsve-merchant", "name": "bigdata",
"version": "1.0.0", "version": "1.0.0",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
...@@ -43,12 +43,6 @@ ...@@ -43,12 +43,6 @@
"resolved": "https://registry.npmjs.org/address/-/address-1.0.3.tgz", "resolved": "https://registry.npmjs.org/address/-/address-1.0.3.tgz",
"integrity": "sha512-z55ocwKBRLryBs394Sm3ushTtBeg6VAeuku7utSoSnsJKvKcnXFIyC6vh27n3rXyxSgkJBBCAvyOn7gSUcTYjg==" "integrity": "sha512-z55ocwKBRLryBs394Sm3ushTtBeg6VAeuku7utSoSnsJKvKcnXFIyC6vh27n3rXyxSgkJBBCAvyOn7gSUcTYjg=="
}, },
"addressparser": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/addressparser/-/addressparser-1.0.1.tgz",
"integrity": "sha1-R6++GiqSYhkdtoOOT9HTm0CCF0Y=",
"optional": true
},
"agent-base": { "agent-base": {
"version": "4.2.0", "version": "4.2.0",
"resolved": "https://registry.npmjs.org/agent-base/-/agent-base-4.2.0.tgz", "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-4.2.0.tgz",
...@@ -66,6 +60,7 @@ ...@@ -66,6 +60,7 @@
"version": "5.5.2", "version": "5.5.2",
"resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz", "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz",
"integrity": "sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU=", "integrity": "sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU=",
"dev": true,
"requires": { "requires": {
"co": "^4.6.0", "co": "^4.6.0",
"fast-deep-equal": "^1.0.0", "fast-deep-equal": "^1.0.0",
...@@ -111,45 +106,6 @@ ...@@ -111,45 +106,6 @@
"integrity": "sha1-SlKCrBZHKek2Gbz9OtFR+BfOkfU=", "integrity": "sha1-SlKCrBZHKek2Gbz9OtFR+BfOkfU=",
"dev": true "dev": true
}, },
"amqplib": {
"version": "0.5.2",
"resolved": "https://registry.npmjs.org/amqplib/-/amqplib-0.5.2.tgz",
"integrity": "sha512-l9mCs6LbydtHqRniRwYkKdqxVa6XMz3Vw1fh+2gJaaVgTM6Jk3o8RccAKWKtlhT1US5sWrFh+KKxsVUALURSIA==",
"optional": true,
"requires": {
"bitsyntax": "~0.0.4",
"bluebird": "^3.4.6",
"buffer-more-ints": "0.0.2",
"readable-stream": "1.x >=1.1.9",
"safe-buffer": "^5.0.1"
},
"dependencies": {
"isarray": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz",
"integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=",
"optional": true
},
"readable-stream": {
"version": "1.1.14",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz",
"integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=",
"optional": true,
"requires": {
"core-util-is": "~1.0.0",
"inherits": "~2.0.1",
"isarray": "0.0.1",
"string_decoder": "~0.10.x"
}
},
"string_decoder": {
"version": "0.10.31",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz",
"integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=",
"optional": true
}
}
},
"ansi-cyan": { "ansi-cyan": {
"version": "0.1.1", "version": "0.1.1",
"resolved": "https://registry.npmjs.org/ansi-cyan/-/ansi-cyan-0.1.1.tgz", "resolved": "https://registry.npmjs.org/ansi-cyan/-/ansi-cyan-0.1.1.tgz",
...@@ -180,12 +136,14 @@ ...@@ -180,12 +136,14 @@
"ansi-regex": { "ansi-regex": {
"version": "2.1.1", "version": "2.1.1",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz",
"integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=" "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=",
"dev": true
}, },
"ansi-styles": { "ansi-styles": {
"version": "2.2.1", "version": "2.2.1",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz",
"integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=" "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=",
"dev": true
}, },
"ansi-wrap": { "ansi-wrap": {
"version": "0.1.0", "version": "0.1.0",
...@@ -302,12 +260,14 @@ ...@@ -302,12 +260,14 @@
"asn1": { "asn1": {
"version": "0.2.3", "version": "0.2.3",
"resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.3.tgz", "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.3.tgz",
"integrity": "sha1-2sh4dxPJlmhJ/IGAd36+nB3fO4Y=" "integrity": "sha1-2sh4dxPJlmhJ/IGAd36+nB3fO4Y=",
"dev": true
}, },
"assert-plus": { "assert-plus": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz",
"integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=",
"dev": true
}, },
"assign-symbols": { "assign-symbols": {
"version": "1.0.0", "version": "1.0.0",
...@@ -320,15 +280,6 @@ ...@@ -320,15 +280,6 @@
"resolved": "https://registry.npmjs.org/ast-types/-/ast-types-0.11.4.tgz", "resolved": "https://registry.npmjs.org/ast-types/-/ast-types-0.11.4.tgz",
"integrity": "sha512-RbY3UMcOcGhc3pOfQ6sliVjt3lqGib9lRjfH1UXJ8YfBFWbcWSJ8jr/VB2W6ulCzTSO/DSnCASqsHYuqa8O7yw==" "integrity": "sha512-RbY3UMcOcGhc3pOfQ6sliVjt3lqGib9lRjfH1UXJ8YfBFWbcWSJ8jr/VB2W6ulCzTSO/DSnCASqsHYuqa8O7yw=="
}, },
"async": {
"version": "2.6.1",
"resolved": "https://registry.npmjs.org/async/-/async-2.6.1.tgz",
"integrity": "sha512-fNEiL2+AZt6AlAw/29Cr0UDe4sRAHCpEHh54WMz+Bb7QfNcFw4h3loofyJpLeQs4Yx7yuqu/2dLgM5hKOs6HlQ==",
"optional": true,
"requires": {
"lodash": "^4.17.10"
}
},
"async-foreach": { "async-foreach": {
"version": "0.1.3", "version": "0.1.3",
"resolved": "https://registry.npmjs.org/async-foreach/-/async-foreach-0.1.3.tgz", "resolved": "https://registry.npmjs.org/async-foreach/-/async-foreach-0.1.3.tgz",
...@@ -355,7 +306,8 @@ ...@@ -355,7 +306,8 @@
"asynckit": { "asynckit": {
"version": "0.4.0", "version": "0.4.0",
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
"integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=",
"dev": true
}, },
"atob": { "atob": {
"version": "2.1.1", "version": "2.1.1",
...@@ -380,21 +332,14 @@ ...@@ -380,21 +332,14 @@
"aws-sign2": { "aws-sign2": {
"version": "0.7.0", "version": "0.7.0",
"resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz",
"integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=" "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=",
"dev": true
}, },
"aws4": { "aws4": {
"version": "1.7.0", "version": "1.7.0",
"resolved": "https://registry.npmjs.org/aws4/-/aws4-1.7.0.tgz", "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.7.0.tgz",
"integrity": "sha512-32NDda82rhwD9/JBCCkB+MRYDp0oSvlo2IL6rQWA10PQi7tDUM3eqMSltXmY+Oyl/7N3P3qNtAlv7X0d9bI28w==" "integrity": "sha512-32NDda82rhwD9/JBCCkB+MRYDp0oSvlo2IL6rQWA10PQi7tDUM3eqMSltXmY+Oyl/7N3P3qNtAlv7X0d9bI28w==",
}, "dev": true
"axios": {
"version": "0.15.3",
"resolved": "https://registry.npmjs.org/axios/-/axios-0.15.3.tgz",
"integrity": "sha1-LJ1jiy4ZGgjqHWzJiOrda6W9wFM=",
"optional": true,
"requires": {
"follow-redirects": "1.0.0"
}
}, },
"babel-helper-vue-jsx-merge-props": { "babel-helper-vue-jsx-merge-props": {
"version": "2.0.3", "version": "2.0.3",
...@@ -507,6 +452,7 @@ ...@@ -507,6 +452,7 @@
"version": "1.0.1", "version": "1.0.1",
"resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.1.tgz", "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.1.tgz",
"integrity": "sha1-Y7xdy2EzG5K8Bf1SiVPDNGKgb40=", "integrity": "sha1-Y7xdy2EzG5K8Bf1SiVPDNGKgb40=",
"dev": true,
"optional": true, "optional": true,
"requires": { "requires": {
"tweetnacl": "^0.14.3" "tweetnacl": "^0.14.3"
...@@ -518,52 +464,6 @@ ...@@ -518,52 +464,6 @@
"integrity": "sha1-5tXqjF2tABMEpwsiY4RH9pyy+Ak=", "integrity": "sha1-5tXqjF2tABMEpwsiY4RH9pyy+Ak=",
"dev": true "dev": true
}, },
"bitsyntax": {
"version": "0.0.4",
"resolved": "https://registry.npmjs.org/bitsyntax/-/bitsyntax-0.0.4.tgz",
"integrity": "sha1-6xDMb4K4xJDj6FaY8H6D1G4MuoI=",
"optional": true,
"requires": {
"buffer-more-ints": "0.0.2"
}
},
"bl": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/bl/-/bl-1.1.2.tgz",
"integrity": "sha1-/cqHGplxOqANGeO7ukHER4emU5g=",
"optional": true,
"requires": {
"readable-stream": "~2.0.5"
},
"dependencies": {
"process-nextick-args": {
"version": "1.0.7",
"resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz",
"integrity": "sha1-FQ4gt1ZZCtP5EJPyWk8q2L/zC6M=",
"optional": true
},
"readable-stream": {
"version": "2.0.6",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.0.6.tgz",
"integrity": "sha1-j5A0HmilPMySh4jaz80Rs265t44=",
"optional": true,
"requires": {
"core-util-is": "~1.0.0",
"inherits": "~2.0.1",
"isarray": "~1.0.0",
"process-nextick-args": "~1.0.6",
"string_decoder": "~0.10.x",
"util-deprecate": "~1.0.1"
}
},
"string_decoder": {
"version": "0.10.31",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz",
"integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=",
"optional": true
}
}
},
"block-stream": { "block-stream": {
"version": "0.0.9", "version": "0.0.9",
"resolved": "https://registry.npmjs.org/block-stream/-/block-stream-0.0.9.tgz", "resolved": "https://registry.npmjs.org/block-stream/-/block-stream-0.0.9.tgz",
...@@ -599,6 +499,7 @@ ...@@ -599,6 +499,7 @@
"version": "2.10.1", "version": "2.10.1",
"resolved": "https://registry.npmjs.org/boom/-/boom-2.10.1.tgz", "resolved": "https://registry.npmjs.org/boom/-/boom-2.10.1.tgz",
"integrity": "sha1-OciRjO/1eZ+D+UkqhI9iWt0Mdm8=", "integrity": "sha1-OciRjO/1eZ+D+UkqhI9iWt0Mdm8=",
"dev": true,
"requires": { "requires": {
"hoek": "2.x.x" "hoek": "2.x.x"
} }
...@@ -662,26 +563,6 @@ ...@@ -662,26 +563,6 @@
"resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.0.0.tgz", "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.0.0.tgz",
"integrity": "sha512-83apNb8KK0Se60UE1+4Ukbe3HbfELJ6UlI4ldtOGs7So4KD26orJM8hIY9lxdzP+UpItH1Yh/Y8GUvNFWFFRxA==" "integrity": "sha512-83apNb8KK0Se60UE1+4Ukbe3HbfELJ6UlI4ldtOGs7So4KD26orJM8hIY9lxdzP+UpItH1Yh/Y8GUvNFWFFRxA=="
}, },
"buffer-more-ints": {
"version": "0.0.2",
"resolved": "https://registry.npmjs.org/buffer-more-ints/-/buffer-more-ints-0.0.2.tgz",
"integrity": "sha1-JrOIXRD6E9t/wBquOquHAZngEkw="
},
"buildmail": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/buildmail/-/buildmail-4.0.1.tgz",
"integrity": "sha1-h393OLeHKYccmhBeO4N9K+EaenI=",
"optional": true,
"requires": {
"addressparser": "1.0.1",
"libbase64": "0.1.0",
"libmime": "3.0.0",
"libqp": "1.1.0",
"nodemailer-fetch": "1.6.0",
"nodemailer-shared": "1.1.0",
"punycode": "1.4.1"
}
},
"builtin-modules": { "builtin-modules": {
"version": "1.1.1", "version": "1.1.1",
"resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz", "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz",
...@@ -781,12 +662,14 @@ ...@@ -781,12 +662,14 @@
"caseless": { "caseless": {
"version": "0.12.0", "version": "0.12.0",
"resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz",
"integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=",
"dev": true
}, },
"chalk": { "chalk": {
"version": "1.1.3", "version": "1.1.3",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz",
"integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=",
"dev": true,
"requires": { "requires": {
"ansi-styles": "^2.2.1", "ansi-styles": "^2.2.1",
"escape-string-regexp": "^1.0.2", "escape-string-regexp": "^1.0.2",
...@@ -800,11 +683,6 @@ ...@@ -800,11 +683,6 @@
"resolved": "https://registry.npmjs.org/charenc/-/charenc-0.0.2.tgz", "resolved": "https://registry.npmjs.org/charenc/-/charenc-0.0.2.tgz",
"integrity": "sha1-wKHS86cJLgN3S/qD8UwPxXkKhmc=" "integrity": "sha1-wKHS86cJLgN3S/qD8UwPxXkKhmc="
}, },
"circular-json": {
"version": "0.5.4",
"resolved": "https://registry.npmjs.org/circular-json/-/circular-json-0.5.4.tgz",
"integrity": "sha512-vnJA8KS0BfOihugYEUkLRcnmq21FbuivbxgzDLXNs3zIk4KllV4Mx4UuTzBXht9F00C7QfD1YqMXg1zP6EXpig=="
},
"class-utils": { "class-utils": {
"version": "0.3.6", "version": "0.3.6",
"resolved": "https://registry.npmjs.org/class-utils/-/class-utils-0.3.6.tgz", "resolved": "https://registry.npmjs.org/class-utils/-/class-utils-0.3.6.tgz",
...@@ -974,6 +852,7 @@ ...@@ -974,6 +852,7 @@
"version": "1.0.6", "version": "1.0.6",
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.6.tgz", "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.6.tgz",
"integrity": "sha1-cj599ugBrFYTETp+RFqbactjKBg=", "integrity": "sha1-cj599ugBrFYTETp+RFqbactjKBg=",
"dev": true,
"requires": { "requires": {
"delayed-stream": "~1.0.0" "delayed-stream": "~1.0.0"
} }
...@@ -981,7 +860,8 @@ ...@@ -981,7 +860,8 @@
"commander": { "commander": {
"version": "2.15.1", "version": "2.15.1",
"resolved": "https://registry.npmjs.org/commander/-/commander-2.15.1.tgz", "resolved": "https://registry.npmjs.org/commander/-/commander-2.15.1.tgz",
"integrity": "sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag==" "integrity": "sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag==",
"dev": true
}, },
"component-emitter": { "component-emitter": {
"version": "1.2.1", "version": "1.2.1",
...@@ -1032,9 +912,12 @@ ...@@ -1032,9 +912,12 @@
"dev": true "dev": true
}, },
"content-disposition": { "content-disposition": {
"version": "0.5.2", "version": "0.5.3",
"resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.2.tgz", "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.3.tgz",
"integrity": "sha1-DPaLud318r55YcOoUXjLhdunjLQ=" "integrity": "sha512-ExO0774ikEObIAEV9kDo50o+79VCUdEB6n6lzKgGwupcVeRlhrj3qGAfwq8G6uBJjkqLrhT0qEYFcWng8z1z0g==",
"requires": {
"safe-buffer": "5.1.2"
}
}, },
"content-type": { "content-type": {
"version": "1.0.4", "version": "1.0.4",
...@@ -1113,6 +996,7 @@ ...@@ -1113,6 +996,7 @@
"version": "2.0.5", "version": "2.0.5",
"resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-2.0.5.tgz", "resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-2.0.5.tgz",
"integrity": "sha1-O9/s3GCBR8HGcgL6KR59ylnqo7g=", "integrity": "sha1-O9/s3GCBR8HGcgL6KR59ylnqo7g=",
"dev": true,
"requires": { "requires": {
"boom": "2.x.x" "boom": "2.x.x"
} }
...@@ -1130,6 +1014,7 @@ ...@@ -1130,6 +1014,7 @@
"version": "1.14.1", "version": "1.14.1",
"resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz",
"integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=",
"dev": true,
"requires": { "requires": {
"assert-plus": "^1.0.0" "assert-plus": "^1.0.0"
} }
...@@ -1139,11 +1024,6 @@ ...@@ -1139,11 +1024,6 @@
"resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-1.2.0.tgz", "resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-1.2.0.tgz",
"integrity": "sha512-vKQ9DTQPN1FLYiiEEOQ6IBGFqvjCa5rSK3cWMy/Nespm5d/x3dGFT9UBZnkLxCwua/IXBi2TYnwTEpsOvhC4UQ==" "integrity": "sha512-vKQ9DTQPN1FLYiiEEOQ6IBGFqvjCa5rSK3cWMy/Nespm5d/x3dGFT9UBZnkLxCwua/IXBi2TYnwTEpsOvhC4UQ=="
}, },
"date-format": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/date-format/-/date-format-1.2.0.tgz",
"integrity": "sha1-YV6CjiM90aubua4JUODOzPpuytg="
},
"dateformat": { "dateformat": {
"version": "2.2.0", "version": "2.2.0",
"resolved": "https://registry.npmjs.org/dateformat/-/dateformat-2.2.0.tgz", "resolved": "https://registry.npmjs.org/dateformat/-/dateformat-2.2.0.tgz",
...@@ -1163,6 +1043,11 @@ ...@@ -1163,6 +1043,11 @@
"integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=",
"dev": true "dev": true
}, },
"decimal.js": {
"version": "10.2.0",
"resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.2.0.tgz",
"integrity": "sha512-vDPw+rDgn3bZe1+F/pyEwb1oMG2XTlRVgAa6B4KccTEpYgF8w6eQllVbQcfIJnZyvzFtFpxnpGtx8dd7DJp/Rw=="
},
"decode-uri-component": { "decode-uri-component": {
"version": "0.2.0", "version": "0.2.0",
"resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz", "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz",
...@@ -1250,7 +1135,8 @@ ...@@ -1250,7 +1135,8 @@
"delayed-stream": { "delayed-stream": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
"integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=",
"dev": true
}, },
"delegates": { "delegates": {
"version": "1.0.0", "version": "1.0.0",
...@@ -1380,22 +1266,11 @@ ...@@ -1380,22 +1266,11 @@
} }
} }
}, },
"easyimage": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/easyimage/-/easyimage-3.1.0.tgz",
"integrity": "sha512-yycLx61oU5UOmIR3pVrv1fkoMKHurR2vPo74+iHs2aLkTdvpco0oiCX/ljeuM6VcUocXx7jijWsAupWHRI1e7A==",
"requires": {
"bluebird": "^3.5.1",
"mkdirp": "^0.5.0",
"nanoid": "^1.0.2",
"tslib": "^1.8.1",
"typescript": "^2.6.2"
}
},
"ecc-jsbn": { "ecc-jsbn": {
"version": "0.1.1", "version": "0.1.1",
"resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz", "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz",
"integrity": "sha1-D8c6ntXw1Tw4GTOYUj735UN3dQU=", "integrity": "sha1-D8c6ntXw1Tw4GTOYUj735UN3dQU=",
"dev": true,
"optional": true, "optional": true,
"requires": { "requires": {
"jsbn": "~0.1.0" "jsbn": "~0.1.0"
...@@ -1518,7 +1393,8 @@ ...@@ -1518,7 +1393,8 @@
"escape-string-regexp": { "escape-string-regexp": {
"version": "1.0.5", "version": "1.0.5",
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
"integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=" "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=",
"dev": true
}, },
"escodegen": { "escodegen": {
"version": "1.9.1", "version": "1.9.1",
...@@ -1608,112 +1484,150 @@ ...@@ -1608,112 +1484,150 @@
} }
}, },
"express": { "express": {
"version": "4.16.3", "version": "4.17.1",
"resolved": "https://registry.npmjs.org/express/-/express-4.16.3.tgz", "resolved": "https://registry.npmjs.org/express/-/express-4.17.1.tgz",
"integrity": "sha1-avilAjUNsyRuzEvs9rWjTSL37VM=", "integrity": "sha512-mHJ9O79RqluphRrcw2X/GTh3k9tVv8YcoyY4Kkh4WDMUYKRZUq0h1o0w2rrrxBqM7VoeUVqgb27xlEMXTnYt4g==",
"requires": { "requires": {
"accepts": "~1.3.5", "accepts": "~1.3.7",
"array-flatten": "1.1.1", "array-flatten": "1.1.1",
"body-parser": "1.18.2", "body-parser": "1.19.0",
"content-disposition": "0.5.2", "content-disposition": "0.5.3",
"content-type": "~1.0.4", "content-type": "~1.0.4",
"cookie": "0.3.1", "cookie": "0.4.0",
"cookie-signature": "1.0.6", "cookie-signature": "1.0.6",
"debug": "2.6.9", "debug": "2.6.9",
"depd": "~1.1.2", "depd": "~1.1.2",
"encodeurl": "~1.0.2", "encodeurl": "~1.0.2",
"escape-html": "~1.0.3", "escape-html": "~1.0.3",
"etag": "~1.8.1", "etag": "~1.8.1",
"finalhandler": "1.1.1", "finalhandler": "~1.1.2",
"fresh": "0.5.2", "fresh": "0.5.2",
"merge-descriptors": "1.0.1", "merge-descriptors": "1.0.1",
"methods": "~1.1.2", "methods": "~1.1.2",
"on-finished": "~2.3.0", "on-finished": "~2.3.0",
"parseurl": "~1.3.2", "parseurl": "~1.3.3",
"path-to-regexp": "0.1.7", "path-to-regexp": "0.1.7",
"proxy-addr": "~2.0.3", "proxy-addr": "~2.0.5",
"qs": "6.5.1", "qs": "6.7.0",
"range-parser": "~1.2.0", "range-parser": "~1.2.1",
"safe-buffer": "5.1.1", "safe-buffer": "5.1.2",
"send": "0.16.2", "send": "0.17.1",
"serve-static": "1.13.2", "serve-static": "1.14.1",
"setprototypeof": "1.1.0", "setprototypeof": "1.1.1",
"statuses": "~1.4.0", "statuses": "~1.5.0",
"type-is": "~1.6.16", "type-is": "~1.6.18",
"utils-merge": "1.0.1", "utils-merge": "1.0.1",
"vary": "~1.1.2" "vary": "~1.1.2"
}, },
"dependencies": { "dependencies": {
"accepts": {
"version": "1.3.7",
"resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.7.tgz",
"integrity": "sha512-Il80Qs2WjYlJIBNzNkK6KYqlVMTbZLXgHx2oT0pU/fjRHyEp+PEfEPY0R3WCwAGVOtauxh1hOxNgIf5bv7dQpA==",
"requires": {
"mime-types": "~2.1.24",
"negotiator": "0.6.2"
}
},
"body-parser": { "body-parser": {
"version": "1.18.2", "version": "1.19.0",
"resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.18.2.tgz", "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.19.0.tgz",
"integrity": "sha1-h2eKGdhLR9hZuDGZvVm84iKxBFQ=", "integrity": "sha512-dhEPs72UPbDnAQJ9ZKMNTP6ptJaionhP5cBb541nXPlW60Jepo9RV/a4fX4XWW9CuFNK22krhrj1+rgzifNCsw==",
"requires": { "requires": {
"bytes": "3.0.0", "bytes": "3.1.0",
"content-type": "~1.0.4", "content-type": "~1.0.4",
"debug": "2.6.9", "debug": "2.6.9",
"depd": "~1.1.1", "depd": "~1.1.2",
"http-errors": "~1.6.2", "http-errors": "1.7.2",
"iconv-lite": "0.4.19", "iconv-lite": "0.4.24",
"on-finished": "~2.3.0", "on-finished": "~2.3.0",
"qs": "6.5.1", "qs": "6.7.0",
"raw-body": "2.3.2", "raw-body": "2.4.0",
"type-is": "~1.6.15" "type-is": "~1.6.17"
}
},
"bytes": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.0.tgz",
"integrity": "sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg=="
},
"cookie": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.0.tgz",
"integrity": "sha512-+Hp8fLp57wnUSt0tY0tHEXh4voZRDnoIrZPqlo3DPiI4y9lwg/jqx+1Om94/W6ZaPDOUbnjOt/99w66zk+l1Xg=="
},
"http-errors": {
"version": "1.7.2",
"resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.7.2.tgz",
"integrity": "sha512-uUQBt3H/cSIVfch6i1EuPNy/YsRSOUBXTVfZ+yR7Zjez3qjBz6i9+i4zjNaoqcoFVI4lQJ5plg63TvGfRSDCRg==",
"requires": {
"depd": "~1.1.2",
"inherits": "2.0.3",
"setprototypeof": "1.1.1",
"statuses": ">= 1.5.0 < 2",
"toidentifier": "1.0.0"
} }
}, },
"iconv-lite": { "iconv-lite": {
"version": "0.4.19", "version": "0.4.24",
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.19.tgz", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",
"integrity": "sha512-oTZqweIP51xaGPI4uPa56/Pri/480R+mo7SeU+YETByQNhDG55ycFyNLIgta9vXhILrxXDmF7ZGhqZIcuN0gJQ==" "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==",
"requires": {
"safer-buffer": ">= 2.1.2 < 3"
}
},
"mime-db": {
"version": "1.40.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.40.0.tgz",
"integrity": "sha512-jYdeOMPy9vnxEqFRRo6ZvTZ8d9oPb+k18PKoYNYUe2stVEBPPwsln/qWzdbmaIvnhZ9v2P+CuecK+fpUfsV2mA=="
},
"mime-types": {
"version": "2.1.24",
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.24.tgz",
"integrity": "sha512-WaFHS3MCl5fapm3oLxU4eYDw77IQM2ACcxQ9RIxfaC3ooc6PFuBMGZZsYpvoXS5D5QTWPieo1jjLdAm3TBP3cQ==",
"requires": {
"mime-db": "1.40.0"
}
},
"negotiator": {
"version": "0.6.2",
"resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.2.tgz",
"integrity": "sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw=="
},
"parseurl": {
"version": "1.3.3",
"resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
"integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ=="
}, },
"qs": { "qs": {
"version": "6.5.1", "version": "6.7.0",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.5.1.tgz", "resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz",
"integrity": "sha512-eRzhrN1WSINYCDCbrz796z37LOe3m5tmW7RQf6oBntukAG1nmovJvhnwHHRMAfeoItc1m2Hk02WER2aQ/iqs+A==" "integrity": "sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ=="
}, },
"raw-body": { "raw-body": {
"version": "2.3.2", "version": "2.4.0",
"resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.3.2.tgz", "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.4.0.tgz",
"integrity": "sha1-vNYMd9Prk83gBQKVw/N5OJvIj4k=", "integrity": "sha512-4Oz8DUIwdvoa5qMJelxipzi/iJIi40O5cGV1wNYp5hvZP8ZN0T+jiNkL0QepXs+EsQ9XJ8ipEDoiH70ySUJP3Q==",
"requires": { "requires": {
"bytes": "3.0.0", "bytes": "3.1.0",
"http-errors": "1.6.2", "http-errors": "1.7.2",
"iconv-lite": "0.4.19", "iconv-lite": "0.4.24",
"unpipe": "1.0.0" "unpipe": "1.0.0"
},
"dependencies": {
"depd": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/depd/-/depd-1.1.1.tgz",
"integrity": "sha1-V4O04cRZ8G+lyif5kfPQbnoxA1k="
},
"http-errors": {
"version": "1.6.2",
"resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.6.2.tgz",
"integrity": "sha1-CgAsyFcHGSp+eUbO7cERVfYOxzY=",
"requires": {
"depd": "1.1.1",
"inherits": "2.0.3",
"setprototypeof": "1.0.3",
"statuses": ">= 1.3.1 < 2"
}
},
"setprototypeof": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.0.3.tgz",
"integrity": "sha1-ZlZ+NwQ+608E2RvWWMDL77VbjgQ="
}
} }
}, },
"safe-buffer": { "setprototypeof": {
"version": "5.1.1", "version": "1.1.1",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.1.tgz",
"integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==" "integrity": "sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw=="
}, },
"statuses": { "type-is": {
"version": "1.4.0", "version": "1.6.18",
"resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz", "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz",
"integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew==" "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==",
"requires": {
"media-typer": "0.3.0",
"mime-types": "~2.1.24"
}
} }
} }
}, },
...@@ -1827,7 +1741,8 @@ ...@@ -1827,7 +1741,8 @@
"extsprintf": { "extsprintf": {
"version": "1.3.0", "version": "1.3.0",
"resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz",
"integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=" "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=",
"dev": true
}, },
"fancy-log": { "fancy-log": {
"version": "1.3.2", "version": "1.3.2",
...@@ -1843,12 +1758,14 @@ ...@@ -1843,12 +1758,14 @@
"fast-deep-equal": { "fast-deep-equal": {
"version": "1.1.0", "version": "1.1.0",
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz",
"integrity": "sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ=" "integrity": "sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ=",
"dev": true
}, },
"fast-json-stable-stringify": { "fast-json-stable-stringify": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz",
"integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=" "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=",
"dev": true
}, },
"fast-levenshtein": { "fast-levenshtein": {
"version": "2.0.6", "version": "2.0.6",
...@@ -1890,23 +1807,23 @@ ...@@ -1890,23 +1807,23 @@
} }
}, },
"finalhandler": { "finalhandler": {
"version": "1.1.1", "version": "1.1.2",
"resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.1.tgz", "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.2.tgz",
"integrity": "sha512-Y1GUDo39ez4aHAw7MysnUD5JzYX+WaIj8I57kO3aEPT1fFRL4sr7mjei97FgnwhAyyzRYmQZaTHb2+9uZ1dPtg==", "integrity": "sha512-aAWcW57uxVNrQZqFXjITpW3sIUQmHGG3qSb9mUah9MgMC4NeWhNOlNjXEYq3HjRAvL6arUviZGGJsBg6z0zsWA==",
"requires": { "requires": {
"debug": "2.6.9", "debug": "2.6.9",
"encodeurl": "~1.0.2", "encodeurl": "~1.0.2",
"escape-html": "~1.0.3", "escape-html": "~1.0.3",
"on-finished": "~2.3.0", "on-finished": "~2.3.0",
"parseurl": "~1.3.2", "parseurl": "~1.3.3",
"statuses": "~1.4.0", "statuses": "~1.5.0",
"unpipe": "~1.0.0" "unpipe": "~1.0.0"
}, },
"dependencies": { "dependencies": {
"statuses": { "parseurl": {
"version": "1.4.0", "version": "1.3.3",
"resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz", "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
"integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew==" "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ=="
} }
} }
}, },
...@@ -1963,15 +1880,6 @@ ...@@ -1963,15 +1880,6 @@
"integrity": "sha1-Tnmumy6zi/hrO7Vr8+ClaqX8q9c=", "integrity": "sha1-Tnmumy6zi/hrO7Vr8+ClaqX8q9c=",
"dev": true "dev": true
}, },
"follow-redirects": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.0.0.tgz",
"integrity": "sha1-jjQpjL0uF28lTv/sdaHHjMhJ/Tc=",
"optional": true,
"requires": {
"debug": "^2.2.0"
}
},
"for-in": { "for-in": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz",
...@@ -1990,12 +1898,14 @@ ...@@ -1990,12 +1898,14 @@
"forever-agent": { "forever-agent": {
"version": "0.6.1", "version": "0.6.1",
"resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz",
"integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=" "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=",
"dev": true
}, },
"form-data": { "form-data": {
"version": "2.3.2", "version": "2.3.2",
"resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.2.tgz", "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.2.tgz",
"integrity": "sha1-SXBJi+YEwgwAXU9cI67NIda0kJk=", "integrity": "sha1-SXBJi+YEwgwAXU9cI67NIda0kJk=",
"dev": true,
"requires": { "requires": {
"asynckit": "^0.4.0", "asynckit": "^0.4.0",
"combined-stream": "1.0.6", "combined-stream": "1.0.6",
...@@ -2113,6 +2023,7 @@ ...@@ -2113,6 +2023,7 @@
"version": "1.2.0", "version": "1.2.0",
"resolved": "https://registry.npmjs.org/generate-object-property/-/generate-object-property-1.2.0.tgz", "resolved": "https://registry.npmjs.org/generate-object-property/-/generate-object-property-1.2.0.tgz",
"integrity": "sha1-nA4cQDCM6AT0eDYYuTf6iPmdUNA=", "integrity": "sha1-nA4cQDCM6AT0eDYYuTf6iPmdUNA=",
"dev": true,
"requires": { "requires": {
"is-property": "^1.0.0" "is-property": "^1.0.0"
} }
...@@ -2162,6 +2073,7 @@ ...@@ -2162,6 +2073,7 @@
"version": "0.1.7", "version": "0.1.7",
"resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz",
"integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=",
"dev": true,
"requires": { "requires": {
"assert-plus": "^1.0.0" "assert-plus": "^1.0.0"
} }
...@@ -2905,12 +2817,14 @@ ...@@ -2905,12 +2817,14 @@
"har-schema": { "har-schema": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz",
"integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=" "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=",
"dev": true
}, },
"har-validator": { "har-validator": {
"version": "5.0.3", "version": "5.0.3",
"resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.0.3.tgz", "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.0.3.tgz",
"integrity": "sha1-ukAsJmGU8VlW7xXg/PJCmT9qff0=", "integrity": "sha1-ukAsJmGU8VlW7xXg/PJCmT9qff0=",
"dev": true,
"requires": { "requires": {
"ajv": "^5.1.0", "ajv": "^5.1.0",
"har-schema": "^2.0.0" "har-schema": "^2.0.0"
...@@ -2920,6 +2834,7 @@ ...@@ -2920,6 +2834,7 @@
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz",
"integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=",
"dev": true,
"requires": { "requires": {
"ansi-regex": "^2.0.0" "ansi-regex": "^2.0.0"
} }
...@@ -2981,6 +2896,7 @@ ...@@ -2981,6 +2896,7 @@
"version": "3.1.3", "version": "3.1.3",
"resolved": "https://registry.npmjs.org/hawk/-/hawk-3.1.3.tgz", "resolved": "https://registry.npmjs.org/hawk/-/hawk-3.1.3.tgz",
"integrity": "sha1-B4REvXwWQLD+VA0sm3PVlnjo4cQ=", "integrity": "sha1-B4REvXwWQLD+VA0sm3PVlnjo4cQ=",
"dev": true,
"requires": { "requires": {
"boom": "2.x.x", "boom": "2.x.x",
"cryptiles": "2.x.x", "cryptiles": "2.x.x",
...@@ -2988,20 +2904,11 @@ ...@@ -2988,20 +2904,11 @@
"sntp": "1.x.x" "sntp": "1.x.x"
} }
}, },
"hipchat-notifier": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/hipchat-notifier/-/hipchat-notifier-1.1.0.tgz",
"integrity": "sha1-ttJJdVQ3wZEII2d5nTupoPI7Ix4=",
"optional": true,
"requires": {
"lodash": "^4.0.0",
"request": "^2.0.0"
}
},
"hoek": { "hoek": {
"version": "2.16.3", "version": "2.16.3",
"resolved": "https://registry.npmjs.org/hoek/-/hoek-2.16.3.tgz", "resolved": "https://registry.npmjs.org/hoek/-/hoek-2.16.3.tgz",
"integrity": "sha1-ILt0A9POo5jpHcRxCo/xuCdKJe0=" "integrity": "sha1-ILt0A9POo5jpHcRxCo/xuCdKJe0=",
"dev": true
}, },
"homedir-polyfill": { "homedir-polyfill": {
"version": "1.0.1", "version": "1.0.1",
...@@ -3052,26 +2959,13 @@ ...@@ -3052,26 +2959,13 @@
"version": "1.2.0", "version": "1.2.0",
"resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz",
"integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=",
"dev": true,
"requires": { "requires": {
"assert-plus": "^1.0.0", "assert-plus": "^1.0.0",
"jsprim": "^1.2.2", "jsprim": "^1.2.2",
"sshpk": "^1.7.0" "sshpk": "^1.7.0"
} }
}, },
"httpntlm": {
"version": "1.6.1",
"resolved": "https://registry.npmjs.org/httpntlm/-/httpntlm-1.6.1.tgz",
"integrity": "sha1-rQFScUOi6Hc8+uapb1hla7UqNLI=",
"requires": {
"httpreq": ">=0.4.22",
"underscore": "~1.7.0"
}
},
"httpreq": {
"version": "0.4.24",
"resolved": "https://registry.npmjs.org/httpreq/-/httpreq-0.4.24.tgz",
"integrity": "sha1-QzX/2CzZaWaKOUZckprGHWOTYn8="
},
"https-proxy-agent": { "https-proxy-agent": {
"version": "2.2.1", "version": "2.2.1",
"resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-2.2.1.tgz", "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-2.2.1.tgz",
...@@ -3166,9 +3060,9 @@ ...@@ -3166,9 +3060,9 @@
"integrity": "sha1-vd7XARQpCCjAoDnnLvJfWq7ENUo=" "integrity": "sha1-vd7XARQpCCjAoDnnLvJfWq7ENUo="
}, },
"ipaddr.js": { "ipaddr.js": {
"version": "1.6.0", "version": "1.9.0",
"resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.6.0.tgz", "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.0.tgz",
"integrity": "sha1-4/o1e3c9phnybpXwSdBVxyeW+Gs=" "integrity": "sha512-M4Sjn6N/+O6/IXSJseKqHoFc+5FdGJ22sXqnjTpdZweHK64MzEPAyQZyEU3R/KRv2GLoa7nNtg/C2Ev6m7z+eA=="
}, },
"is-absolute": { "is-absolute": {
"version": "1.0.0", "version": "1.0.0",
...@@ -3214,7 +3108,8 @@ ...@@ -3214,7 +3108,8 @@
"is-buffer": { "is-buffer": {
"version": "1.1.6", "version": "1.1.6",
"resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz",
"integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==" "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==",
"dev": true
}, },
"is-builtin-module": { "is-builtin-module": {
"version": "1.0.0", "version": "1.0.0",
...@@ -3311,12 +3206,14 @@ ...@@ -3311,12 +3206,14 @@
"is-my-ip-valid": { "is-my-ip-valid": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/is-my-ip-valid/-/is-my-ip-valid-1.0.0.tgz", "resolved": "https://registry.npmjs.org/is-my-ip-valid/-/is-my-ip-valid-1.0.0.tgz",
"integrity": "sha512-gmh/eWXROncUzRnIa1Ubrt5b8ep/MGSnfAUI3aRp+sqTCs1tv1Isl8d8F6JmkN3dXKc3ehZMrtiPN9eL03NuaQ==" "integrity": "sha512-gmh/eWXROncUzRnIa1Ubrt5b8ep/MGSnfAUI3aRp+sqTCs1tv1Isl8d8F6JmkN3dXKc3ehZMrtiPN9eL03NuaQ==",
"dev": true
}, },
"is-my-json-valid": { "is-my-json-valid": {
"version": "2.17.2", "version": "2.17.2",
"resolved": "https://registry.npmjs.org/is-my-json-valid/-/is-my-json-valid-2.17.2.tgz", "resolved": "https://registry.npmjs.org/is-my-json-valid/-/is-my-json-valid-2.17.2.tgz",
"integrity": "sha512-IBhBslgngMQN8DDSppmgDv7RNrlFotuuDsKcrCP3+HbFaVivIBU7u9oiiErw8sH4ynx3+gOGQ3q2otkgiSi6kg==", "integrity": "sha512-IBhBslgngMQN8DDSppmgDv7RNrlFotuuDsKcrCP3+HbFaVivIBU7u9oiiErw8sH4ynx3+gOGQ3q2otkgiSi6kg==",
"dev": true,
"requires": { "requires": {
"generate-function": "^2.0.0", "generate-function": "^2.0.0",
"generate-object-property": "^1.1.0", "generate-object-property": "^1.1.0",
...@@ -3374,7 +3271,8 @@ ...@@ -3374,7 +3271,8 @@
"is-property": { "is-property": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/is-property/-/is-property-1.0.2.tgz", "resolved": "https://registry.npmjs.org/is-property/-/is-property-1.0.2.tgz",
"integrity": "sha1-V/4cTkhHTt1lsJkR8msc1Ald2oQ=" "integrity": "sha1-V/4cTkhHTt1lsJkR8msc1Ald2oQ=",
"dev": true
}, },
"is-relative": { "is-relative": {
"version": "1.0.0", "version": "1.0.0",
...@@ -3385,12 +3283,6 @@ ...@@ -3385,12 +3283,6 @@
"is-unc-path": "^1.0.0" "is-unc-path": "^1.0.0"
} }
}, },
"is-stream": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz",
"integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=",
"optional": true
},
"is-type-of": { "is-type-of": {
"version": "1.2.0", "version": "1.2.0",
"resolved": "https://registry.npmjs.org/is-type-of/-/is-type-of-1.2.0.tgz", "resolved": "https://registry.npmjs.org/is-type-of/-/is-type-of-1.2.0.tgz",
...@@ -3404,7 +3296,8 @@ ...@@ -3404,7 +3296,8 @@
"is-typedarray": { "is-typedarray": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz",
"integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=",
"dev": true
}, },
"is-unc-path": { "is-unc-path": {
"version": "1.0.0", "version": "1.0.0",
...@@ -3458,32 +3351,38 @@ ...@@ -3458,32 +3351,38 @@
"version": "0.1.1", "version": "0.1.1",
"resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz",
"integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=", "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=",
"dev": true,
"optional": true "optional": true
}, },
"json-schema": { "json-schema": {
"version": "0.2.3", "version": "0.2.3",
"resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz",
"integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=" "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=",
"dev": true
}, },
"json-schema-traverse": { "json-schema-traverse": {
"version": "0.3.1", "version": "0.3.1",
"resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz",
"integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A=" "integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A=",
"dev": true
}, },
"json-stringify-safe": { "json-stringify-safe": {
"version": "5.0.1", "version": "5.0.1",
"resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz",
"integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=",
"dev": true
}, },
"jsonpointer": { "jsonpointer": {
"version": "4.0.1", "version": "4.0.1",
"resolved": "https://registry.npmjs.org/jsonpointer/-/jsonpointer-4.0.1.tgz", "resolved": "https://registry.npmjs.org/jsonpointer/-/jsonpointer-4.0.1.tgz",
"integrity": "sha1-T9kss04OnbPInIYi7PUfm5eMbLk=" "integrity": "sha1-T9kss04OnbPInIYi7PUfm5eMbLk=",
"dev": true
}, },
"jsprim": { "jsprim": {
"version": "1.4.1", "version": "1.4.1",
"resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz",
"integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=",
"dev": true,
"requires": { "requires": {
"assert-plus": "1.0.0", "assert-plus": "1.0.0",
"extsprintf": "1.3.0", "extsprintf": "1.3.0",
...@@ -3520,33 +3419,6 @@ ...@@ -3520,33 +3419,6 @@
"type-check": "~0.3.2" "type-check": "~0.3.2"
} }
}, },
"libbase64": {
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/libbase64/-/libbase64-0.1.0.tgz",
"integrity": "sha1-YjUag5VjrF/1vSbxL2Dpgwu3UeY="
},
"libmime": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/libmime/-/libmime-3.0.0.tgz",
"integrity": "sha1-UaGp50SOy9Ms2lRCFnW7IbwJPaY=",
"requires": {
"iconv-lite": "0.4.15",
"libbase64": "0.1.0",
"libqp": "1.1.0"
},
"dependencies": {
"iconv-lite": {
"version": "0.4.15",
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.15.tgz",
"integrity": "sha1-/iZaIYrGpXz+hUkn6dBMGYJe3es="
}
}
},
"libqp": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/libqp/-/libqp-1.1.0.tgz",
"integrity": "sha1-9ebgatdLeU+1tbZpiL9yjvHe2+g="
},
"liftoff": { "liftoff": {
"version": "2.5.0", "version": "2.5.0",
"resolved": "https://registry.npmjs.org/liftoff/-/liftoff-2.5.0.tgz", "resolved": "https://registry.npmjs.org/liftoff/-/liftoff-2.5.0.tgz",
...@@ -3863,142 +3735,6 @@ ...@@ -3863,142 +3735,6 @@
"chalk": "^1.0.0" "chalk": "^1.0.0"
} }
}, },
"log4js": {
"version": "2.10.0",
"resolved": "https://registry.npmjs.org/log4js/-/log4js-2.10.0.tgz",
"integrity": "sha512-NnhN9PjFF9zhxinAjlmDYvkqqrIW+yA3LLJAoTJ3fs6d1zru86OqQHfsxiUcc1kRq3z+faGR4DeyXUfiNbVxKQ==",
"requires": {
"amqplib": "^0.5.2",
"axios": "^0.15.3",
"circular-json": "^0.5.4",
"date-format": "^1.2.0",
"debug": "^3.1.0",
"hipchat-notifier": "^1.1.0",
"loggly": "^1.1.0",
"mailgun-js": "^0.18.0",
"nodemailer": "^2.5.0",
"redis": "^2.7.1",
"semver": "^5.5.0",
"slack-node": "~0.2.0",
"streamroller": "0.7.0"
},
"dependencies": {
"debug": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz",
"integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==",
"requires": {
"ms": "2.0.0"
}
}
}
},
"loggly": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/loggly/-/loggly-1.1.1.tgz",
"integrity": "sha1-Cg/B0/o6XsRP3HuJe+uipGlc6+4=",
"optional": true,
"requires": {
"json-stringify-safe": "5.0.x",
"request": "2.75.x",
"timespan": "2.3.x"
},
"dependencies": {
"assert-plus": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-0.2.0.tgz",
"integrity": "sha1-104bh+ev/A24qttwIfP+SBAasjQ=",
"optional": true
},
"aws-sign2": {
"version": "0.6.0",
"resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.6.0.tgz",
"integrity": "sha1-FDQt0428yU0OW4fXY81jYSwOeU8=",
"optional": true
},
"caseless": {
"version": "0.11.0",
"resolved": "https://registry.npmjs.org/caseless/-/caseless-0.11.0.tgz",
"integrity": "sha1-cVuW6phBWTzDMGeSP17GDr2k99c=",
"optional": true
},
"form-data": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/form-data/-/form-data-2.0.0.tgz",
"integrity": "sha1-bwrrrcxdoWwT4ezBETfYX5uIOyU=",
"optional": true,
"requires": {
"asynckit": "^0.4.0",
"combined-stream": "^1.0.5",
"mime-types": "^2.1.11"
}
},
"har-validator": {
"version": "2.0.6",
"resolved": "https://registry.npmjs.org/har-validator/-/har-validator-2.0.6.tgz",
"integrity": "sha1-zcvAgYgmWtEZtqWnyKtw7s+10n0=",
"optional": true,
"requires": {
"chalk": "^1.1.1",
"commander": "^2.9.0",
"is-my-json-valid": "^2.12.4",
"pinkie-promise": "^2.0.0"
}
},
"http-signature": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.1.1.tgz",
"integrity": "sha1-33LiZwZs0Kxn+3at+OE0qPvPkb8=",
"optional": true,
"requires": {
"assert-plus": "^0.2.0",
"jsprim": "^1.2.2",
"sshpk": "^1.7.0"
}
},
"qs": {
"version": "6.2.3",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.2.3.tgz",
"integrity": "sha1-HPyyXBCpsrSDBT/zn138kjOQjP4=",
"optional": true
},
"request": {
"version": "2.75.0",
"resolved": "https://registry.npmjs.org/request/-/request-2.75.0.tgz",
"integrity": "sha1-0rgmiihtoT6qXQGt9dGMyQ9lfZM=",
"optional": true,
"requires": {
"aws-sign2": "~0.6.0",
"aws4": "^1.2.1",
"bl": "~1.1.2",
"caseless": "~0.11.0",
"combined-stream": "~1.0.5",
"extend": "~3.0.0",
"forever-agent": "~0.6.1",
"form-data": "~2.0.0",
"har-validator": "~2.0.6",
"hawk": "~3.1.3",
"http-signature": "~1.1.0",
"is-typedarray": "~1.0.0",
"isstream": "~0.1.2",
"json-stringify-safe": "~5.0.1",
"mime-types": "~2.1.7",
"node-uuid": "~1.4.7",
"oauth-sign": "~0.8.1",
"qs": "~6.2.0",
"stringstream": "~0.0.4",
"tough-cookie": "~2.3.0",
"tunnel-agent": "~0.4.1"
}
},
"tunnel-agent": {
"version": "0.4.3",
"resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.4.3.tgz",
"integrity": "sha1-Y3PbdpCf5XDgjXNYM2Xtgop07us=",
"optional": true
}
}
},
"long": { "long": {
"version": "4.0.0", "version": "4.0.0",
"resolved": "https://registry.npmjs.org/long/-/long-4.0.0.tgz", "resolved": "https://registry.npmjs.org/long/-/long-4.0.0.tgz",
...@@ -4023,59 +3759,6 @@ ...@@ -4023,59 +3759,6 @@
"yallist": "^2.1.2" "yallist": "^2.1.2"
} }
}, },
"mailcomposer": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/mailcomposer/-/mailcomposer-4.0.1.tgz",
"integrity": "sha1-DhxEsqB890DuF9wUm6AJ8Zyt/rQ=",
"optional": true,
"requires": {
"buildmail": "4.0.1",
"libmime": "3.0.0"
}
},
"mailgun-js": {
"version": "0.18.1",
"resolved": "https://registry.npmjs.org/mailgun-js/-/mailgun-js-0.18.1.tgz",
"integrity": "sha512-lvuMP14u24HS2uBsJEnzSyPMxzU2b99tQsIx1o6QNjqxjk8b3WvR+vq5oG1mjqz/IBYo+5gF+uSoDS0RkMVHmg==",
"optional": true,
"requires": {
"async": "~2.6.0",
"debug": "~3.1.0",
"form-data": "~2.3.0",
"inflection": "~1.12.0",
"is-stream": "^1.1.0",
"path-proxy": "~1.0.0",
"promisify-call": "^2.0.2",
"proxy-agent": "~3.0.0",
"tsscmp": "~1.0.0"
},
"dependencies": {
"debug": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz",
"integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==",
"requires": {
"ms": "2.0.0"
}
},
"proxy-agent": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/proxy-agent/-/proxy-agent-3.0.0.tgz",
"integrity": "sha512-g6n6vnk8fRf705ShN+FEXFG/SDJaW++lSs0d9KaJh4uBWW/wi7en4Cpo5VYQW3SZzAE121lhB/KLQrbURoubZw==",
"optional": true,
"requires": {
"agent-base": "^4.2.0",
"debug": "^3.1.0",
"http-proxy-agent": "^2.1.0",
"https-proxy-agent": "^2.2.1",
"lru-cache": "^4.1.2",
"pac-proxy-agent": "^2.0.1",
"proxy-from-env": "^1.0.0",
"socks-proxy-agent": "^3.0.0"
}
}
}
},
"make-iterator": { "make-iterator": {
"version": "1.0.1", "version": "1.0.1",
"resolved": "https://registry.npmjs.org/make-iterator/-/make-iterator-1.0.1.tgz", "resolved": "https://registry.npmjs.org/make-iterator/-/make-iterator-1.0.1.tgz",
...@@ -4112,15 +3795,10 @@ ...@@ -4112,15 +3795,10 @@
"object-visit": "^1.0.0" "object-visit": "^1.0.0"
} }
}, },
"md5": { "marked": {
"version": "2.2.1", "version": "0.7.0",
"resolved": "https://registry.npmjs.org/md5/-/md5-2.2.1.tgz", "resolved": "https://registry.npmjs.org/marked/-/marked-0.7.0.tgz",
"integrity": "sha1-U6s41f48iJG6RlMp6iP6wFQBJvk=", "integrity": "sha512-c+yYdCZJQrsRjTPhUx7VKkApw9bwDkNbHUKo1ovgcfDjb2kc8rLuRbIFyXL5WOEUwzSSKo3IXpph2K6DqB/KZg=="
"requires": {
"charenc": "~0.0.1",
"crypt": "~0.0.1",
"is-buffer": "~1.1.1"
}
}, },
"media-typer": { "media-typer": {
"version": "0.3.0", "version": "0.3.0",
...@@ -4256,9 +3934,9 @@ ...@@ -4256,9 +3934,9 @@
} }
}, },
"moment": { "moment": {
"version": "2.22.1", "version": "2.24.0",
"resolved": "https://registry.npmjs.org/moment/-/moment-2.22.1.tgz", "resolved": "https://registry.npmjs.org/moment/-/moment-2.24.0.tgz",
"integrity": "sha512-shJkRTSebXvsVqk56I+lkb2latjBs8I+pc2TzWc545y2iFnSjm7Wg0QMh+ZWcdSLQyGEau5jI8ocnmkyTgr9YQ==" "integrity": "sha512-bV7f+6l2QigeBBZSM/6yTNq4P2fNpSWj/0e7jQcy87A8e7o2nAfP/34/2ky5Vw4B9S446EtIhodAzkFCcR4dQg=="
}, },
"moment-timezone": { "moment-timezone": {
"version": "0.5.17", "version": "0.5.17",
...@@ -4399,11 +4077,6 @@ ...@@ -4399,11 +4077,6 @@
"integrity": "sha512-bAdJv7fBLhWC+/Bls0Oza+mvTaNQtP+1RyhhhvD95pgUJz6XM5IzgmxOkItJ9tkoCiplvAnXI1tNmmUD/eScyA==", "integrity": "sha512-bAdJv7fBLhWC+/Bls0Oza+mvTaNQtP+1RyhhhvD95pgUJz6XM5IzgmxOkItJ9tkoCiplvAnXI1tNmmUD/eScyA==",
"dev": true "dev": true
}, },
"nanoid": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-1.0.2.tgz",
"integrity": "sha512-sCTwJt690lduNHyqknXJp8pRwzm80neOLGaiTHU2KUJZFVSErl778NNCIivEQCX5gNT0xR1Jy3HEMe/TABT6lw=="
},
"nanomatch": { "nanomatch": {
"version": "1.2.9", "version": "1.2.9",
"resolved": "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.9.tgz", "resolved": "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.9.tgz",
...@@ -4677,93 +4350,6 @@ ...@@ -4677,93 +4350,6 @@
"resolved": "https://registry.npmjs.org/node-uuid/-/node-uuid-1.4.8.tgz", "resolved": "https://registry.npmjs.org/node-uuid/-/node-uuid-1.4.8.tgz",
"integrity": "sha1-sEDrCSOWivq/jTL7HxfxFn/auQc=" "integrity": "sha1-sEDrCSOWivq/jTL7HxfxFn/auQc="
}, },
"node-wxpay": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/node-wxpay/-/node-wxpay-1.1.3.tgz",
"integrity": "sha1-r148/W7ezpNPVV253/IvQ/HBVsA=",
"requires": {
"MD5": "^1.2.1",
"request": "^2.54.0",
"xml2js": "^0.4.6"
}
},
"nodemailer": {
"version": "2.7.2",
"resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-2.7.2.tgz",
"integrity": "sha1-8kLmSa7q45tsftdA73sGHEBNMPk=",
"optional": true,
"requires": {
"libmime": "3.0.0",
"mailcomposer": "4.0.1",
"nodemailer-direct-transport": "3.3.2",
"nodemailer-shared": "1.1.0",
"nodemailer-smtp-pool": "2.8.2",
"nodemailer-smtp-transport": "2.7.2",
"socks": "1.1.9"
},
"dependencies": {
"socks": {
"version": "1.1.9",
"resolved": "https://registry.npmjs.org/socks/-/socks-1.1.9.tgz",
"integrity": "sha1-Yo1+TQSRJDVEWsC25Fk3bLPm1pE=",
"optional": true,
"requires": {
"ip": "^1.1.2",
"smart-buffer": "^1.0.4"
}
}
}
},
"nodemailer-direct-transport": {
"version": "3.3.2",
"resolved": "https://registry.npmjs.org/nodemailer-direct-transport/-/nodemailer-direct-transport-3.3.2.tgz",
"integrity": "sha1-6W+vuQNYVglH5WkBfZfmBzilCoY=",
"optional": true,
"requires": {
"nodemailer-shared": "1.1.0",
"smtp-connection": "2.12.0"
}
},
"nodemailer-fetch": {
"version": "1.6.0",
"resolved": "https://registry.npmjs.org/nodemailer-fetch/-/nodemailer-fetch-1.6.0.tgz",
"integrity": "sha1-ecSQihwPXzdbc/6IjamCj23JY6Q="
},
"nodemailer-shared": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/nodemailer-shared/-/nodemailer-shared-1.1.0.tgz",
"integrity": "sha1-z1mU4v0mjQD1zw+nZ6CBae2wfsA=",
"requires": {
"nodemailer-fetch": "1.6.0"
}
},
"nodemailer-smtp-pool": {
"version": "2.8.2",
"resolved": "https://registry.npmjs.org/nodemailer-smtp-pool/-/nodemailer-smtp-pool-2.8.2.tgz",
"integrity": "sha1-LrlNbPhXgLG0clzoU7nL1ejajHI=",
"optional": true,
"requires": {
"nodemailer-shared": "1.1.0",
"nodemailer-wellknown": "0.1.10",
"smtp-connection": "2.12.0"
}
},
"nodemailer-smtp-transport": {
"version": "2.7.2",
"resolved": "https://registry.npmjs.org/nodemailer-smtp-transport/-/nodemailer-smtp-transport-2.7.2.tgz",
"integrity": "sha1-A9ccdjFPFKx9vHvwM6am0W1n+3c=",
"optional": true,
"requires": {
"nodemailer-shared": "1.1.0",
"nodemailer-wellknown": "0.1.10",
"smtp-connection": "2.12.0"
}
},
"nodemailer-wellknown": {
"version": "0.1.10",
"resolved": "https://registry.npmjs.org/nodemailer-wellknown/-/nodemailer-wellknown-0.1.10.tgz",
"integrity": "sha1-WG24EB2zDLRDjrVGc3pBqtDPE9U="
},
"nopt": { "nopt": {
"version": "3.0.6", "version": "3.0.6",
"resolved": "https://registry.npmjs.org/nopt/-/nopt-3.0.6.tgz", "resolved": "https://registry.npmjs.org/nopt/-/nopt-3.0.6.tgz",
...@@ -4823,7 +4409,8 @@ ...@@ -4823,7 +4409,8 @@
"oauth-sign": { "oauth-sign": {
"version": "0.8.2", "version": "0.8.2",
"resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.8.2.tgz", "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.8.2.tgz",
"integrity": "sha1-Rqarfwrq2N6unsBWV4C31O/rnUM=" "integrity": "sha1-Rqarfwrq2N6unsBWV4C31O/rnUM=",
"dev": true
}, },
"object-assign": { "object-assign": {
"version": "4.1.1", "version": "4.1.1",
...@@ -4929,6 +4516,14 @@ ...@@ -4929,6 +4516,14 @@
"integrity": "sha1-ofeDj4MUxRbwXs78vEzP4EtO14k=", "integrity": "sha1-ofeDj4MUxRbwXs78vEzP4EtO14k=",
"dev": true "dev": true
}, },
"opentype.js": {
"version": "0.7.3",
"resolved": "https://registry.npmjs.org/opentype.js/-/opentype.js-0.7.3.tgz",
"integrity": "sha1-QPuM4Yv9YOdESO/f5EKDQJg5eqs=",
"requires": {
"tiny-inflate": "^1.0.2"
}
},
"optionator": { "optionator": {
"version": "0.8.2", "version": "0.8.2",
"resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.2.tgz", "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.2.tgz",
...@@ -5114,23 +4709,6 @@ ...@@ -5114,23 +4709,6 @@
"integrity": "sha1-PBrfhx6pzWyUMbbqK9dKD/BVxME=", "integrity": "sha1-PBrfhx6pzWyUMbbqK9dKD/BVxME=",
"dev": true "dev": true
}, },
"path-proxy": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/path-proxy/-/path-proxy-1.0.0.tgz",
"integrity": "sha1-GOijaFn8nS8aU7SN7hOFQ8Ag3l4=",
"optional": true,
"requires": {
"inflection": "~1.3.0"
},
"dependencies": {
"inflection": {
"version": "1.3.8",
"resolved": "https://registry.npmjs.org/inflection/-/inflection-1.3.8.tgz",
"integrity": "sha1-y9Fg2p91sUw8xjV41POWeEvzAU4=",
"optional": true
}
}
},
"path-root": { "path-root": {
"version": "0.1.1", "version": "0.1.1",
"resolved": "https://registry.npmjs.org/path-root/-/path-root-0.1.1.tgz", "resolved": "https://registry.npmjs.org/path-root/-/path-root-0.1.1.tgz",
...@@ -5170,15 +4748,11 @@ ...@@ -5170,15 +4748,11 @@
} }
} }
}, },
"pdfcrowd": {
"version": "4.3.1",
"resolved": "https://registry.npmjs.org/pdfcrowd/-/pdfcrowd-4.3.1.tgz",
"integrity": "sha1-26C9qLJ3GJa8KUu4bD/CZGssULw="
},
"performance-now": { "performance-now": {
"version": "2.1.0", "version": "2.1.0",
"resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz",
"integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=" "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=",
"dev": true
}, },
"pify": { "pify": {
"version": "2.3.0", "version": "2.3.0",
...@@ -5189,12 +4763,14 @@ ...@@ -5189,12 +4763,14 @@
"pinkie": { "pinkie": {
"version": "2.0.4", "version": "2.0.4",
"resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz",
"integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA=" "integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA=",
"dev": true
}, },
"pinkie-promise": { "pinkie-promise": {
"version": "2.0.1", "version": "2.0.1",
"resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz",
"integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=", "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=",
"dev": true,
"requires": { "requires": {
"pinkie": "^2.0.0" "pinkie": "^2.0.0"
} }
...@@ -5326,22 +4902,13 @@ ...@@ -5326,22 +4902,13 @@
"resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz", "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz",
"integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==" "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw=="
}, },
"promisify-call": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/promisify-call/-/promisify-call-2.0.4.tgz",
"integrity": "sha1-1IwtRWUszM1SgB3ey9UzptS9X7o=",
"optional": true,
"requires": {
"with-callback": "^1.0.2"
}
},
"proxy-addr": { "proxy-addr": {
"version": "2.0.3", "version": "2.0.5",
"resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.3.tgz", "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.5.tgz",
"integrity": "sha512-jQTChiCJteusULxjBp8+jftSQE5Obdl3k4cnmLA6WXtK6XFuWRnvVL7aCiBqaLPM8c4ph0S4tKna8XvmIwEnXQ==", "integrity": "sha512-t/7RxHXPH6cJtP0pRG6smSr9QJidhB+3kXu0KgXnbGYMgzEnUxRQ4/LDdfOwZEMyIh3/xHb8PX3t+lfL9z+YVQ==",
"requires": { "requires": {
"forwarded": "~0.1.2", "forwarded": "~0.1.2",
"ipaddr.js": "1.6.0" "ipaddr.js": "1.9.0"
} }
}, },
"proxy-agent": { "proxy-agent": {
...@@ -5382,7 +4949,8 @@ ...@@ -5382,7 +4949,8 @@
"punycode": { "punycode": {
"version": "1.4.1", "version": "1.4.1",
"resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz",
"integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=" "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=",
"dev": true
}, },
"qr-image": { "qr-image": {
"version": "3.2.0", "version": "3.2.0",
...@@ -5400,9 +4968,9 @@ ...@@ -5400,9 +4968,9 @@
"integrity": "sha1-T2ih3Arli9P7lYSMMDJNt11kNgs=" "integrity": "sha1-T2ih3Arli9P7lYSMMDJNt11kNgs="
}, },
"range-parser": { "range-parser": {
"version": "1.2.0", "version": "1.2.1",
"resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.0.tgz", "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz",
"integrity": "sha1-9JvmtIeJTdxA3MlKMi9hEJLgDV4=" "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg=="
}, },
"raw-body": { "raw-body": {
"version": "2.3.3", "version": "2.3.3",
...@@ -5550,6 +5118,7 @@ ...@@ -5550,6 +5118,7 @@
"version": "2.87.0", "version": "2.87.0",
"resolved": "https://registry.npmjs.org/request/-/request-2.87.0.tgz", "resolved": "https://registry.npmjs.org/request/-/request-2.87.0.tgz",
"integrity": "sha512-fcogkm7Az5bsS6Sl0sibkbhcKsnyon/jV1kF3ajGmF0c8HrttdKTPRT9hieOaQHA5HEq6r8OyWOo/o781C1tNw==", "integrity": "sha512-fcogkm7Az5bsS6Sl0sibkbhcKsnyon/jV1kF3ajGmF0c8HrttdKTPRT9hieOaQHA5HEq6r8OyWOo/o781C1tNw==",
"dev": true,
"requires": { "requires": {
"aws-sign2": "~0.7.0", "aws-sign2": "~0.7.0",
"aws4": "^1.6.0", "aws4": "^1.6.0",
...@@ -5573,18 +5142,6 @@ ...@@ -5573,18 +5142,6 @@
"uuid": "^3.1.0" "uuid": "^3.1.0"
} }
}, },
"requestretry": {
"version": "1.13.0",
"resolved": "https://registry.npmjs.org/requestretry/-/requestretry-1.13.0.tgz",
"integrity": "sha512-Lmh9qMvnQXADGAQxsXHP4rbgO6pffCfuR8XUBdP9aitJcLQJxhp7YZK4xAVYXnPJ5E52mwrfiKQtKonPL8xsmg==",
"optional": true,
"requires": {
"extend": "^3.0.0",
"lodash": "^4.15.0",
"request": "^2.74.0",
"when": "^3.7.7"
}
},
"require-directory": { "require-directory": {
"version": "2.1.1", "version": "2.1.1",
"resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz",
...@@ -5792,9 +5349,9 @@ ...@@ -5792,9 +5349,9 @@
"integrity": "sha512-4SJ3dm0WAwWy/NVeioZh5AntkdJoWKxHxcmyP622fOkgHa4z3R0TdBJICINyaSDE6uNwVc8gZr+ZinwZAH4xIA==" "integrity": "sha512-4SJ3dm0WAwWy/NVeioZh5AntkdJoWKxHxcmyP622fOkgHa4z3R0TdBJICINyaSDE6uNwVc8gZr+ZinwZAH4xIA=="
}, },
"send": { "send": {
"version": "0.16.2", "version": "0.17.1",
"resolved": "https://registry.npmjs.org/send/-/send-0.16.2.tgz", "resolved": "https://registry.npmjs.org/send/-/send-0.17.1.tgz",
"integrity": "sha512-E64YFPUssFHEFBvpbbjr44NCLtI1AohxQ8ZSiJjQLskAdKuriYEP6VyGEsRDH8ScozGpkaX1BGvhanqCwkcEZw==", "integrity": "sha512-BsVKsiGcQMFwT8UxypobUKyv7irCNRHk1T0G680vk88yf6LBByGcZJOTJCrTP2xVN6yI+XjPJcNuE3V4fT9sAg==",
"requires": { "requires": {
"debug": "2.6.9", "debug": "2.6.9",
"depd": "~1.1.2", "depd": "~1.1.2",
...@@ -5803,23 +5360,40 @@ ...@@ -5803,23 +5360,40 @@
"escape-html": "~1.0.3", "escape-html": "~1.0.3",
"etag": "~1.8.1", "etag": "~1.8.1",
"fresh": "0.5.2", "fresh": "0.5.2",
"http-errors": "~1.6.2", "http-errors": "~1.7.2",
"mime": "1.4.1", "mime": "1.6.0",
"ms": "2.0.0", "ms": "2.1.1",
"on-finished": "~2.3.0", "on-finished": "~2.3.0",
"range-parser": "~1.2.0", "range-parser": "~1.2.1",
"statuses": "~1.4.0" "statuses": "~1.5.0"
}, },
"dependencies": { "dependencies": {
"mime": { "http-errors": {
"version": "1.4.1", "version": "1.7.3",
"resolved": "https://registry.npmjs.org/mime/-/mime-1.4.1.tgz", "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.7.3.tgz",
"integrity": "sha512-KI1+qOZu5DcW6wayYHSzR/tXKCDC5Om4s1z2QJjDULzLcmf3DvzS7oluY4HCTrc+9FiKmWUgeNLg7W3uIQvxtQ==" "integrity": "sha512-ZTTX0MWrsQ2ZAhA1cejAwDLycFsd7I7nVtnkT3Ol0aqodaKW+0CTZDQ1uBv5whptCnc8e8HeRRJxRs0kmm/Qfw==",
"requires": {
"depd": "~1.1.2",
"inherits": "2.0.4",
"setprototypeof": "1.1.1",
"statuses": ">= 1.5.0 < 2",
"toidentifier": "1.0.0"
}
}, },
"statuses": { "inherits": {
"version": "1.4.0", "version": "2.0.4",
"resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
"integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew==" "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
},
"ms": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz",
"integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg=="
},
"setprototypeof": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.1.tgz",
"integrity": "sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw=="
} }
} }
}, },
...@@ -5893,14 +5467,21 @@ ...@@ -5893,14 +5467,21 @@
} }
}, },
"serve-static": { "serve-static": {
"version": "1.13.2", "version": "1.14.1",
"resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.13.2.tgz", "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.14.1.tgz",
"integrity": "sha512-p/tdJrO4U387R9oMjb1oj7qSMaMfmOyd4j9hOFoxZe2baQszgHcSWjuya/CiT5kgZZKRudHNOA0pYXOl8rQ5nw==", "integrity": "sha512-JMrvUwE54emCYWlTI+hGrGv5I8dEwmco/00EvkzIIsR7MqrHonbD9pO2MOfFnpFntl7ecpZs+3mW+XbQZu9QCg==",
"requires": { "requires": {
"encodeurl": "~1.0.2", "encodeurl": "~1.0.2",
"escape-html": "~1.0.3", "escape-html": "~1.0.3",
"parseurl": "~1.3.2", "parseurl": "~1.3.3",
"send": "0.16.2" "send": "0.17.1"
},
"dependencies": {
"parseurl": {
"version": "1.3.3",
"resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
"integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ=="
}
} }
}, },
"set-blocking": { "set-blocking": {
...@@ -5963,29 +5544,11 @@ ...@@ -5963,29 +5544,11 @@
"integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=",
"dev": true "dev": true
}, },
"slack-node": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/slack-node/-/slack-node-0.2.0.tgz",
"integrity": "sha1-3kuN3aqLeT9h29KTgQT9q/N9+jA=",
"optional": true,
"requires": {
"requestretry": "^1.2.2"
}
},
"smart-buffer": { "smart-buffer": {
"version": "1.1.15", "version": "1.1.15",
"resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-1.1.15.tgz", "resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-1.1.15.tgz",
"integrity": "sha1-fxFLW2X6s+KjWqd1uxLw0cZJvxY=" "integrity": "sha1-fxFLW2X6s+KjWqd1uxLw0cZJvxY="
}, },
"smtp-connection": {
"version": "2.12.0",
"resolved": "https://registry.npmjs.org/smtp-connection/-/smtp-connection-2.12.0.tgz",
"integrity": "sha1-1275EnyyPCJZ7bHoNJwujV4tdME=",
"requires": {
"httpntlm": "1.6.1",
"nodemailer-shared": "1.1.0"
}
},
"snapdragon": { "snapdragon": {
"version": "0.8.2", "version": "0.8.2",
"resolved": "https://registry.npmjs.org/snapdragon/-/snapdragon-0.8.2.tgz", "resolved": "https://registry.npmjs.org/snapdragon/-/snapdragon-0.8.2.tgz",
...@@ -6103,6 +5666,7 @@ ...@@ -6103,6 +5666,7 @@
"version": "1.0.9", "version": "1.0.9",
"resolved": "https://registry.npmjs.org/sntp/-/sntp-1.0.9.tgz", "resolved": "https://registry.npmjs.org/sntp/-/sntp-1.0.9.tgz",
"integrity": "sha1-ZUEYTMkK7qbG57NeJlkIJEPGYZg=", "integrity": "sha1-ZUEYTMkK7qbG57NeJlkIJEPGYZg=",
"dev": true,
"requires": { "requires": {
"hoek": "2.x.x" "hoek": "2.x.x"
} }
...@@ -6205,6 +5769,7 @@ ...@@ -6205,6 +5769,7 @@
"version": "1.14.1", "version": "1.14.1",
"resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.14.1.tgz", "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.14.1.tgz",
"integrity": "sha1-Ew9Zde3a2WPx1W+SuaxsUfqfg+s=", "integrity": "sha1-Ew9Zde3a2WPx1W+SuaxsUfqfg+s=",
"dev": true,
"requires": { "requires": {
"asn1": "~0.2.3", "asn1": "~0.2.3",
"assert-plus": "^1.0.0", "assert-plus": "^1.0.0",
...@@ -6269,27 +5834,6 @@ ...@@ -6269,27 +5834,6 @@
"xtend": "^4.0.0" "xtend": "^4.0.0"
} }
}, },
"streamroller": {
"version": "0.7.0",
"resolved": "https://registry.npmjs.org/streamroller/-/streamroller-0.7.0.tgz",
"integrity": "sha512-WREzfy0r0zUqp3lGO096wRuUp7ho1X6uo/7DJfTlEi0Iv/4gT7YHqXDjKC2ioVGBZtE8QzsQD9nx1nIuoZ57jQ==",
"requires": {
"date-format": "^1.2.0",
"debug": "^3.1.0",
"mkdirp": "^0.5.1",
"readable-stream": "^2.3.0"
},
"dependencies": {
"debug": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz",
"integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==",
"requires": {
"ms": "2.0.0"
}
}
}
},
"streamsearch": { "streamsearch": {
"version": "0.1.2", "version": "0.1.2",
"resolved": "https://registry.npmjs.org/streamsearch/-/streamsearch-0.1.2.tgz", "resolved": "https://registry.npmjs.org/streamsearch/-/streamsearch-0.1.2.tgz",
...@@ -6317,12 +5861,14 @@ ...@@ -6317,12 +5861,14 @@
"stringstream": { "stringstream": {
"version": "0.0.6", "version": "0.0.6",
"resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.6.tgz", "resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.6.tgz",
"integrity": "sha512-87GEBAkegbBcweToUrdzf3eLhWNg06FJTebl4BVJz/JgWy8CvEr9dRtX5qWphiynMSQlxxi+QqN0z5T32SLlhA==" "integrity": "sha512-87GEBAkegbBcweToUrdzf3eLhWNg06FJTebl4BVJz/JgWy8CvEr9dRtX5qWphiynMSQlxxi+QqN0z5T32SLlhA==",
"dev": true
}, },
"strip-ansi": { "strip-ansi": {
"version": "3.0.1", "version": "3.0.1",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz",
"integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=",
"dev": true,
"requires": { "requires": {
"ansi-regex": "^2.0.0" "ansi-regex": "^2.0.0"
} }
...@@ -6349,7 +5895,16 @@ ...@@ -6349,7 +5895,16 @@
"supports-color": { "supports-color": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz",
"integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=" "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=",
"dev": true
},
"svg-captcha": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/svg-captcha/-/svg-captcha-1.4.0.tgz",
"integrity": "sha512-/fkkhavXPE57zRRCjNqAP3txRCSncpMx3NnNZL7iEoyAtYwUjPhJxW6FQTQPG5UPEmCrbFoXS10C3YdJlW7PDg==",
"requires": {
"opentype.js": "^0.7.3"
}
}, },
"tar": { "tar": {
"version": "2.2.1", "version": "2.2.1",
...@@ -6471,11 +6026,10 @@ ...@@ -6471,11 +6026,10 @@
"integrity": "sha1-dkpaEa9QVhkhsTPztE5hhofg9cM=", "integrity": "sha1-dkpaEa9QVhkhsTPztE5hhofg9cM=",
"dev": true "dev": true
}, },
"timespan": { "tiny-inflate": {
"version": "2.3.0", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/timespan/-/timespan-2.3.0.tgz", "resolved": "https://registry.npmjs.org/tiny-inflate/-/tiny-inflate-1.0.2.tgz",
"integrity": "sha1-SQLOBAvRPYRcj1myfp1ZutbzmSk=", "integrity": "sha1-k9nez/yIBb1X6uQxDwt0Xptvs6c="
"optional": true
}, },
"to-arraybuffer": { "to-arraybuffer": {
"version": "1.0.1", "version": "1.0.1",
...@@ -6524,6 +6078,11 @@ ...@@ -6524,6 +6078,11 @@
"repeat-string": "^1.6.1" "repeat-string": "^1.6.1"
} }
}, },
"toidentifier": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.0.tgz",
"integrity": "sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw=="
},
"toposort-class": { "toposort-class": {
"version": "1.0.1", "version": "1.0.1",
"resolved": "https://registry.npmjs.org/toposort-class/-/toposort-class-1.0.1.tgz", "resolved": "https://registry.npmjs.org/toposort-class/-/toposort-class-1.0.1.tgz",
...@@ -6533,6 +6092,7 @@ ...@@ -6533,6 +6092,7 @@
"version": "2.3.4", "version": "2.3.4",
"resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.3.4.tgz", "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.3.4.tgz",
"integrity": "sha512-TZ6TTfI5NtZnuyy/Kecv+CnoROnyXn2DN97LontgQpCwsX2XyLYCC0ENhYkehSOwAp8rTQKc/NUIF7BkQ5rKLA==", "integrity": "sha512-TZ6TTfI5NtZnuyy/Kecv+CnoROnyXn2DN97LontgQpCwsX2XyLYCC0ENhYkehSOwAp8rTQKc/NUIF7BkQ5rKLA==",
"dev": true,
"requires": { "requires": {
"punycode": "^1.4.1" "punycode": "^1.4.1"
} }
...@@ -6567,21 +6127,11 @@ ...@@ -6567,21 +6127,11 @@
} }
} }
}, },
"tslib": {
"version": "1.9.1",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-1.9.1.tgz",
"integrity": "sha512-avfPS28HmGLLc2o4elcc2EIq2FcH++Yo5YxpBZi9Yw93BCTGFthI4HPE4Rpep6vSYQaK8e69PelM44tPj+RaQg=="
},
"tsscmp": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/tsscmp/-/tsscmp-1.0.5.tgz",
"integrity": "sha1-fcSjOvcVgatDN9qR2FylQn69mpc=",
"optional": true
},
"tunnel-agent": { "tunnel-agent": {
"version": "0.6.0", "version": "0.6.0",
"resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz",
"integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=",
"dev": true,
"requires": { "requires": {
"safe-buffer": "^5.0.1" "safe-buffer": "^5.0.1"
} }
...@@ -6590,6 +6140,7 @@ ...@@ -6590,6 +6140,7 @@
"version": "0.14.5", "version": "0.14.5",
"resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz",
"integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=", "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=",
"dev": true,
"optional": true "optional": true
}, },
"type-check": { "type-check": {
...@@ -6614,11 +6165,6 @@ ...@@ -6614,11 +6165,6 @@
"resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz",
"integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=" "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c="
}, },
"typescript": {
"version": "2.8.3",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-2.8.3.tgz",
"integrity": "sha512-K7g15Bb6Ra4lKf7Iq2l/I5/En+hLIHmxWZGq3D4DIRNFxMNV6j2SHSvDOqs2tGd4UvD/fJvrwopzQXjLrT7Itw=="
},
"uid-safe": { "uid-safe": {
"version": "2.1.5", "version": "2.1.5",
"resolved": "https://registry.npmjs.org/uid-safe/-/uid-safe-2.1.5.tgz", "resolved": "https://registry.npmjs.org/uid-safe/-/uid-safe-2.1.5.tgz",
...@@ -6633,11 +6179,6 @@ ...@@ -6633,11 +6179,6 @@
"integrity": "sha1-5z3T17DXxe2G+6xrCufYxqadUPo=", "integrity": "sha1-5z3T17DXxe2G+6xrCufYxqadUPo=",
"dev": true "dev": true
}, },
"underscore": {
"version": "1.7.0",
"resolved": "https://registry.npmjs.org/underscore/-/underscore-1.7.0.tgz",
"integrity": "sha1-a7rwh3UA02vjTsqlhODbn+8DUgk="
},
"union-value": { "union-value": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.0.tgz", "resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.0.tgz",
...@@ -6824,6 +6365,7 @@ ...@@ -6824,6 +6365,7 @@
"version": "1.10.0", "version": "1.10.0",
"resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz",
"integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=",
"dev": true,
"requires": { "requires": {
"assert-plus": "^1.0.0", "assert-plus": "^1.0.0",
"core-util-is": "1.0.2", "core-util-is": "1.0.2",
...@@ -6926,12 +6468,6 @@ ...@@ -6926,12 +6468,6 @@
} }
} }
}, },
"when": {
"version": "3.7.8",
"resolved": "https://registry.npmjs.org/when/-/when-3.7.8.tgz",
"integrity": "sha1-xxMLan6gRpPoQs3J56Hyqjmjn4I=",
"optional": true
},
"which": { "which": {
"version": "1.3.0", "version": "1.3.0",
"resolved": "https://registry.npmjs.org/which/-/which-1.3.0.tgz", "resolved": "https://registry.npmjs.org/which/-/which-1.3.0.tgz",
...@@ -6963,12 +6499,6 @@ ...@@ -6963,12 +6499,6 @@
"semver": "^5.0.1" "semver": "^5.0.1"
} }
}, },
"with-callback": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/with-callback/-/with-callback-1.0.2.tgz",
"integrity": "sha1-oJYpuakgAo1yFAT7Q1vc/1yRvCE=",
"optional": true
},
"wkx": { "wkx": {
"version": "0.4.5", "version": "0.4.5",
"resolved": "https://registry.npmjs.org/wkx/-/wkx-0.4.5.tgz", "resolved": "https://registry.npmjs.org/wkx/-/wkx-0.4.5.tgz",
...@@ -6998,16 +6528,6 @@ ...@@ -6998,16 +6528,6 @@
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=",
"dev": true "dev": true
}, },
"wx-pay": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/wx-pay/-/wx-pay-1.0.2.tgz",
"integrity": "sha1-rhQqFRQ0yjgKgDffgytl3f9JdQQ=",
"requires": {
"md5": "^2.0.0",
"request": "^2.54.0",
"xml2js": "^0.4.6"
}
},
"xml2js": { "xml2js": {
"version": "0.4.19", "version": "0.4.19",
"resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.19.tgz", "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.19.tgz",
......
{ {
"name": "xggsve-merchant", "name": "bigdata",
"version": "1.0.0", "version": "1.0.0",
"description": "h5framework", "description": "h5framework",
"main": "main.js", "main": "main.js",
...@@ -22,16 +22,19 @@ ...@@ -22,16 +22,19 @@
"cookie-parser": "^1.4.3", "cookie-parser": "^1.4.3",
"crypto": "^1.0.1", "crypto": "^1.0.1",
"crypto-js": "^3.1.9-1", "crypto-js": "^3.1.9-1",
"decimal": "^0.0.2",
"decimal.js": "^10.2.0",
"ejs": "^2.5.8", "ejs": "^2.5.8",
"element-ui": "^2.4.0", "element-ui": "^2.4.0",
"engine.io-parser": "^2.1.2", "engine.io-parser": "^2.1.2",
"errorhandler": "^1.5.0", "errorhandler": "^1.5.0",
"exif-js": "^2.3.0", "exif-js": "^2.3.0",
"express": "^4.16.2", "express": "^4.17.1",
"express-session": "^1.15.6", "express-session": "^1.15.6",
"gm": "^1.23.1", "gm": "^1.23.1",
"marked": "^0.7.0", "marked": "^0.7.0",
"method-override": "^2.3.10", "method-override": "^2.3.10",
"moment": "^2.24.0",
"morgan": "^1.9.0", "morgan": "^1.9.0",
"multer": "^1.3.0", "multer": "^1.3.0",
"mysql2": "^1.5.3", "mysql2": "^1.5.3",
......
var APIBase = require("../../api.base");
var system = require("../../../system");
var settings = require("../../../../config/settings");
class ActionAPI extends APIBase {
constructor() {
super();
this.iborderSve = system.getObject("service.order.iborderSve");
this.iborderdeliverSve = system.getObject("service.order.iborderdeliverSve");
this.businessmenSve = system.getObject("service.business.businessmenSve");
this.businessmencontractSve = system.getObject("service.business.businessmencontractSve");
}
/**
* 接口跳转
* action_process 执行的流程
* action_type 执行的类型
* action_body 执行的参数
*/
async springboard(pobj, qobj, req) {
var result;
if (!pobj.action_process) {
return system.getResult(null, "action_process参数不能为空");
}
if (!pobj.action_type) {
return system.getResult(null, "action_type参数不能为空");
}
console.log(pobj.action_process, pobj.action_type, pobj.action_body, "---------------- this is order micro sve --------------------");
try {
result = await this.handleRequest(pobj.action_process, pobj.action_type, pobj.action_body);
} catch (error) {
console.log(error);
}
return result;
}
async handleRequest(action_process, action_type, action_body) {
var opResult = null;
switch (action_type) {
// 订单
case "addOrder":
opResult = await this.iborderSve.apiAdd(action_body);
break;
case "updOrder":
opResult = await this.iborderSve.apiUpd(action_body);
break;
case "allOrderList":
opResult = await this.iborderSve.apiAllList(action_body);
break;
case "orderInfo":
opResult = await this.iborderSve.apiInfo(action_body);
break;
case "orderInfoAll":
opResult = await this.iborderSve.apiAllInfo(action_body);
break;
case "byChannelOrderId":
opResult = await this.iborderSve.apiByChannelOrderId(action_body);
break;
case "orderEdit":
opResult = await this.iborderSve.apiEdit(action_body);
break;
case "orderAssign":
opResult = await this.iborderSve.apiAssign(action_body);
break;
case "myOrderPage":
opResult = await this.iborderSve.apiMyPage(action_body);
break;
case "orderPay":
opResult = await this.iborderSve.apiOrderPay(action_body);
break;
case "orderClose":
opResult = await this.iborderSve.apiOrderClose(action_body);
break;
case "closeOrderById":
opResult = await this.iborderSve.apiCloseById(action_body);
break;
case "orderComplete":
opResult = await this.iborderSve.apiComplete(action_body);
break;
case "orderByDeliverId":
opResult = await this.iborderSve.apiByDeliverId(action_body);
break;
// 订单办理
case "orderDeliverList":
opResult = await this.iborderdeliverSve.apiPage(action_body);
break;
case "orderDeliverHandle":
opResult = await this.iborderdeliverSve.apiHandle(action_body);
break;
case "orderDeliverInfo":
opResult = await this.iborderdeliverSve.apiInfo(action_body);
break;
case "orderDeliverEdit":
opResult = await this.iborderdeliverSve.apiEdit(action_body);
break;
case "orderDeliverAudit":
opResult = await this.iborderdeliverSve.apiAudit(action_body);
break;
case "orderDeliverClose":
opResult = await this.iborderdeliverSve.apiClose(action_body);
break;
// 个体户管理
case "businessmenByOrderId":
opResult = await this.businessmenSve.apiByOrderId(action_body);
break;
case "businessmenByChannelOrderNo":
opResult = await this.businessmenSve.apiByChannelOrderNo(action_body);
break;
case "businessmenNameList":
opResult = await this.businessmenSve.apiNameList(action_body);
break;
case "businessmenPage":
opResult = await this.businessmenSve.apiPage(action_body);
break;
case "businessmenInfo":
opResult = await this.businessmenSve.apiInfo(action_body);
break;
case "businessmenSign":
opResult = await this.businessmenSve.apiSign(action_body);
break;
case "businessmenSignPage":
opResult = await this.businessmenSve.apiSignPage(action_body);
break;
case "businessmenInfoPage":
opResult = await this.businessmenSve.apiInfoPage(action_body);
break;
case "businessmenUserPage":
opResult = await this.businessmenSve.apiUserPage(action_body);
break;
case "businessmenDeliverPage":
opResult = await this.businessmenSve.apiDeliverPage(action_body);
break;
case "addBusinessmenContract":
opResult = await this.businessmenSve.apiAddContract(action_body);
break;
case "businessmenCompleteMapByCreditCodes":
opResult = await this.businessmenSve.apiCompleteMapByCreditCodes(action_body);
break;
// 统计数据
case "statTransData":
opResult = await this.iborderSve.apiStatTransData(action_body);
break;
case "statBusinessData":
opResult = await this.iborderSve.apiStatBusinessData(action_body);
break;
case "statDeliverData":
opResult = await this.iborderdeliverSve.apiStatDeliverData(action_body);
break;
default:
opResult = system.getResult(null, "action_type参数错误");
break;
}
return opResult;
}
exam() {
return `<pre><pre/>`;
}
classDesc() {
return {
groupName: "op",
groupDesc: "元数据服务包",
name: "ActionAPI",
desc: "此类是对外提供接口服务",
exam: "",
};
}
methodDescs() {
return [{
methodDesc: `<pre><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,
}
],
rtnTypeDesc: `<pre><pre/>`,
rtnType: `<pre><pre/>`
}];
}
}
module.exports = ActionAPI;
\ No newline at end of file
const system = require("../../../system");
const Dao = require("../../dao.base");
class BusinessmenDao extends Dao {
constructor() {
super(Dao.getModelName(BusinessmenDao));
this.bstatusMap = {
"2000": "办理中",
"2010": "待签约",
"2020": "已完成",
}
this.gstatusMap = {
"2000": "办理中",
"2020": "已完成",
}
this.dstatusMap = {
"2000": "办理中",
"2020": "已完成",
}
}
async nameList(bstatuses) {
var sql = "SELECT id, name FROM " + this.model.tableName + " WHERE 1 = 1 ";
var params = {};
if (bstatuses && bstatuses.length > 0) {
sql = sql + " AND bstatus IN (:bstatuses) ";
params.bstatuses = bstatuses;
}
return this.customQuery(sql, params);
}
async getByOrderId(orderId, attrs) {
if (!orderId) {
return null;
}
attrs = attrs || "*";
var sql = "SELECT " + attrs + " FROM " + this.model.tableName + " where order_id = :orderId ";
var list = await this.customQuery(sql, {
orderId: orderId
});
return list && list.length > 0 ? list[0] : null;
}
async getByChannelOrderNo(merchantId, channelOrderNo, attrs) {
if (!merchantId || !channelOrderNo) {
return null;
}
var params = {
merchantId: merchantId,
channelOrderNo: channelOrderNo,
}
attrs = attrs || "*";
var sql = "SELECT " + attrs + " FROM " + this.model.tableName + " where merchant_id = :merchantId AND channelOrderNo = :channelOrderNo LIMIT 1";
var list = await this.customQuery(sql, params);
return list && list.length > 0 ? list[0] : null;
}
async getByCreditCodes(params, attrs) {
var creditCodes = params.creditCodes;
var statuses = params.statuses;
var result = {};
if (!creditCodes || creditCodes.length == 0) {
return result;
}
attrs = attrs || "*";
var sql = "SELECT " + attrs + " FROM " + this.model.tableName + " where creditCode IN (:creditCodes) ";
if (statuses && statuses.length > 0) {
sql = sql + " AND bstatus IN (:statuses) "
}
return await this.customQuery(sql, params);
}
async getMapByCreditCodes(params, attrs) {
var result = {};
var list = this.getByCreditCodes(params, attrs);
if (!list) {
return result;
}
for (var item of list) {
result[item.creditCode] = item;
}
return result;
}
}
module.exports = BusinessmenDao;
\ No newline at end of file
const system=require("../../../system");
const Dao=require("../../dao.base");
class BusinessmencontractDao extends Dao{
constructor(){
super(Dao.getModelName(BusinessmencontractDao));
}
}
module.exports=BusinessmencontractDao;
const system=require("../../../system");
const Dao=require("../../dao.base");
class BusinessmeninvoicecontentDao extends Dao{
constructor(){
super(Dao.getModelName(BusinessmeninvoicecontentDao));
}
async delByBusinessmenId(businessmenId, t) {
var sql = "DELETE FROM " + this.model.tableName + " WHERE businessmen_id = :businessmenId";
var list = await this.customUpdate(sql, {
businessmenId: businessmenId
}, t) || [null];
return list[0];
}
async mapByBusinessmenIds(businessmenIds, attrs) {
var result = {};
if (!businessmenIds || businessmenIds.length == 0) {
return result;
}
attrs = attrs || "*";
var sql = "SELECT businessmen_id, invoicecontent_id, invoicecontentName FROM " + this.model.tableName + " where businessmen_id IN (:businessmenIds) ";
var list = await this.customQuery(sql, {
businessmenIds: businessmenIds
});
if(!list) {
return result;
}
for(var item of list) {
var lst = result[item.businessmen_id];
if(!lst) {
lst = [];
}
lst.push(item);
result[item.businessmen_id] = lst;
}
return result;
}
}
module.exports=BusinessmeninvoicecontentDao;
const system = require("../../../system");
const Dao = require("../../dao.base");
class IborderdeliverDao extends Dao {
constructor() {
super(Dao.getModelName(IborderdeliverDao));
this.statusMap = {
"1030": "待处理",
"1040": "关闭订单",
"1050": "执照办理中",
"1060": "已出执照",
"1070": "刻章办理中",
"1080": "已刻章",
"1090": "银行开户中",
"1100": "银行卡已开户",
"1110": "税务报道中",
"1120": "已税务报道",
"1130": "待审核",
"1140": "审核失败",
"1150": "审核通过",
"1160": "已邮寄",
};
}
async findAssignedOrder(orderId) {
var sql = "SELECT * FROM `ib_order_deliver` WHERE order_id = :orderId AND `status` <> '1040' LIMIT 1";
var list = await this.customQuery(sql, {
orderId: orderId
});
return list && list.length > 0 ? list[0] : null;
}
async findMapByOrderIds(orderIds) {
var result = {};
var sql = "SELECT * FROM `ib_order_deliver` WHERE order_id IN (:orderIds) AND `status` <> '1040' LIMIT 1";
var list = await this.customQuery(sql, {
orderIds: orderIds
});
if (!list || list.length == 0) {
return result;
}
for (var item of list) {
await this.setRowCodeName(item, "status");
result[item.order_id] = item;
}
return result;
}
async findMapByOrderIds(orderIds) {
var result = {};
var sql = "SELECT * FROM `ib_order_deliver` WHERE order_id IN (:orderIds) AND `status` <> '9000'";
var list = await this.customQuery(sql, {
orderIds: orderIds
});
if (!list || list.length == 0) {
return result;
}
for (var item of list) {
await this.setRowCodeName(item, "status");
result[item.order_id] = item;
}
return result;
}
async findMapByIds(ids) {
var result = {};
var sql = "SELECT * FROM `ib_order_deliver` WHERE id IN (:ids)";
var list = await this.customQuery(sql, {
ids: ids
});
if (!list || list.length == 0) {
return result;
}
for (var item of list) {
await this.setRowCodeName(item, "status");
result[item.id] = item;
}
return result;
}
async countStat(params) {
var sql = [];
sql.push("SELECT");
sql.push("COUNT(DISTINCT deliver_id) AS total");
sql.push("FROM `ib_order_deliver`");
sql.push("WHERE 1 = 1");
this.setCondition(params, sql);
var list = await this.customQuery(sql.join(" "), params);
return list && list.length > 0 ? (list[0].total || 0) : 0;
}
async queryStat(params, startRow, pageSize) {
var sql = [];
// SELECT deliver_id, deliverName, SUM(deliverDivide) AS servicePrice FROM `ib_order_deliver` GROUP BY deliver_id;
sql.push("SELECT");
sql.push("deliver_id, deliverName, SUM(deliverDivide) AS servicePrice");
sql.push("FROM `ib_order_deliver` ");
sql.push("WHERE 1 = 1");
this.setCondition(params, sql);
sql.push("GROUP BY deliver_id");
sql.push("LIMIT :startRow, :pageSize");
params.startRow = startRow;
params.pageSize = pageSize;
var list = await this.customQuery(sql.join(" "), params);
return list;
}
async statDeliverByStatus(params) {
var sql = [];
sql.push("SELECT");
sql.push("deliver_id, `status`, COUNT(1) AS orderCount");
sql.push("FROM `ib_order_deliver`");
sql.push("WHERE 1 = 1");
if(params.deliverIds) {
sql.push("AND deliver_id IN (:deliverIds)")
}
if (params.begin) {
sql.push("AND created_at >= :begin");
}
if (params.end) {
sql.push("AND created_at <= :end");
}
sql.push("GROUP BY `status`");
var result = {};
var list = await this.customQuery(sql.join(" "), params);
if (!list || list.length == 0) {
return result;
}
for (var item of list) {
result[item.deliver_id + "_" + item.status] = item.orderCount || 0;
}
return result;
}
setCondition(params, sql) {
if (params.begin) {
sql.push("AND created_at >= :begin");
}
if (params.end) {
sql.push("AND created_at <= :end");
}
}
}
module.exports = IborderdeliverDao;
\ No newline at end of file
const system = require("../../../system");
const settings = require("../../../../config/settings");
module.exports = (db, DataTypes) => {
return db.define("businessmen", {
order_id: DataTypes.STRING(32),
merchant_id: DataTypes.STRING(32),
channelOrderNo: DataTypes.STRING(64),
// 业务状态: 2000办理中, 2010待签约, 2020已完成
bstatus: DataTypes.STRING(10),
// 客户状态: 2000办理中, 2020已完成
gstatus: DataTypes.STRING(10),
// 客户状态: 2000办理中, 2020已完成
dstatus: DataTypes.STRING(10),
legalName: DataTypes.STRING(20),
legalMobile: DataTypes.STRING(20),
legalIdcard: DataTypes.STRING(30),
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),
contractStartData: DataTypes.DATE,
contractEndData: DataTypes.DATE,
contract: DataTypes.STRING(300), //个体户合同
notes: DataTypes.STRING, //备注
opNotes: DataTypes.STRING, //操作备注
// 个体户签约相关字段
taxUpType: DataTypes.STRING,
addValueUpType: DataTypes.STRING,
costRate: DataTypes.INTEGER,
taxRate: DataTypes.INTEGER,
serviceRate: DataTypes.INTEGER,
signNotes: DataTypes.STRING,
commonTaxLadder: DataTypes.STRING(1000),
commonOtherLadder: DataTypes.STRING(1000),
specialTaxLadder: DataTypes.STRING(1000),
specialOtherLadder: DataTypes.STRING(1000),
signTime: DataTypes.DATE,
bdId: DataTypes.STRING,
bdPath: DataTypes.STRING,
userId: DataTypes.STRING,
}, {
paranoid: true, //假的删除
underscored: true,
version: true,
freezeTableName: true,
//freezeTableName: true,
// define the table's name
tableName: 'ib_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
const system = require("../../../system");
const settings = require("../../../../config/settings");
module.exports = (db, DataTypes) => {
return db.define("businessmencontract", {
businessmen_id: DataTypes.STRING(32),
merchant_id: DataTypes.STRING(32),
contractStartData: DataTypes.DATE,
contractEndData: DataTypes.DATE,
contract: DataTypes.STRING(300),//个体户合同
}, {
paranoid: true, //假的删除
underscored: true,
version: true,
freezeTableName: true,
//freezeTableName: true,
// define the table's name
tableName: 'ib_businessmen_contract',
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");
module.exports = (db, DataTypes) => {
return db.define("businessmeninvoicecontent", {
businessmen_id: DataTypes.STRING(32),
invoicecontent_id: DataTypes.STRING(32),
invoicecontentName: DataTypes.STRING(32),
}, {
paranoid: true, //假的删除
underscored: true,
version: true,
freezeTableName: true,
//freezeTableName: true,
// define the table's name
tableName: 'ib_businessmen_invoicecontent',
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("iborder", {
merchant_id: DataTypes.STRING(32),
channelOrderNo: DataTypes.STRING(64),
price: DataTypes.BIGINT,
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),
bankImg: DataTypes.STRING(300),
names: DataTypes.STRING(300),
domicile_id: DataTypes.STRING(32),
domicileName: DataTypes.STRING(20),
businessScope_id: DataTypes.STRING(32),
businessType: DataTypes.STRING(100),
businessScope: DataTypes.STRING(500),
capital: DataTypes.STRING(100),
// 平台状态 1000未付款, 1010待处理, 1020执照办理中, 1030已出执照, 1040刻章办理中, 1050已刻章,
// 1060银行开户中, 1070银行已开户, 1080税务报道中, 1090已税务报道, 1100已完成
status: DataTypes.STRING(10),
// 订单状态:1000未付款, 1010订单关闭, 1030待处理, 1050执照办理中, 1060已出执照, 1070刻章办理中,
// 1080已刻章, 1090银行开户中, 1100银行卡已开户, 1110税务报道中, 1120已税务报道, 1170已完成
ostatus: DataTypes.STRING(10),
notes: DataTypes.STRING, // 备注
opNotes: DataTypes.STRING, // 操作备注
bdId: DataTypes.STRING,
bdPath: DataTypes.STRING,
userId: DataTypes.STRING,
mailAddr: DataTypes.STRING,
mailTo: DataTypes.STRING,
mailMobile: DataTypes.STRING,
assignTime: DataTypes.DATE,
assignUcname: DataTypes.STRING,
orderDeliverId: DataTypes.STRING,
deliverType: DataTypes.STRING,
deliverNo: DataTypes.STRING,
deliverImg: DataTypes.STRING,
}, {
paranoid: true, //假的删除
underscored: true,
version: true,
freezeTableName: true,
//freezeTableName: true,
// define the table's name
tableName: 'ib_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
const system = require("../../../system");
const settings = require("../../../../config/settings");
const uiconfig = system.getUiConfig2(settings.appKey);
module.exports = (db, DataTypes) => {
return db.define("iborderdeliver", {
order_id: DataTypes.STRING(32),
// 办理状态 1030待处理, 1040关闭订单, 1050执照办理中, 1060已出执照, 1070刻章办理中,
// 1080已刻章, 1090银行开户中, 1100银行卡已开户, 1110税务报道中, 1120已税务报道,
// 1130提交审核, 1140审核失败, 1150审核通过, 1160已邮寄
status: DataTypes.STRING(10),
deliver_id: DataTypes.STRING(32),
deliverName: DataTypes.STRING(50),
deliverDivide: DataTypes.BIGINT,
auditRemark: DataTypes.STRING,
content: DataTypes.STRING,
addressee: DataTypes.STRING,
mobile: DataTypes.STRING,
addr: DataTypes.STRING,
auditUser: DataTypes.STRING,
auditResult: DataTypes.STRING,
breakReason: DataTypes.STRING(300),
}, {
paranoid: true, //假的删除
underscored: true,
version: true,
freezeTableName: true,
//freezeTableName: true,
// define the table's name
tableName: 'ib_order_deliver',
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 ServiceBase = require("../../sve.base")
const settings = require("../../../../config/settings")
class BusinessmenService extends ServiceBase {
constructor() {
super("business", ServiceBase.getDaoName(BusinessmenService));
this.businessmeninvoicecontentDao = system.getObject("db.business.businessmeninvoicecontentDao");
}
async api(params) {
try {
return await this.saveSign(params);
} catch (error) {
console.log(error);
return system.getResult(null, "接口异常");
}
}
async apiNameList(params) {
try {
return await this.nameList(params);
} catch (error) {
console.log(error);
return system.getResult(null, "接口异常");
}
}
async apiInfoPage(params) {
try {
return await this.infoPage(params);
} catch (error) {
console.log(error);
return system.getResult(null, "接口异常");
}
}
async apiSignPage(params) {
try {
return await this.signPage(params);
} catch (error) {
console.log(error);
return system.getResult(null, "接口异常");
}
}
async apiPage(params) {
try {
return await this.page(params);
} catch (error) {
console.log(error);
return system.getResult(null, "接口异常");
}
}
async apiInfo(params) {
try {
return await this.info(params);
} catch (error) {
console.log(error);
return system.getResult(null, "接口异常");
}
}
async apiSign(params) {
try {
return await this.sign(params);
} catch (error) {
console.log(error);
return system.getResult(null, "接口异常");
}
}
async apiUserPage(params) {
try {
return await this.userPage(params);
} catch (error) {
console.log(error);
return system.getResult(null, "接口异常");
}
}
async apiDeliverPage(params) {
try {
return await this.deliverPage(params);
} catch (error) {
console.log(error);
return system.getResult(null, "接口异常");
}
}
async apiByOrderId(params) {
try {
return await this.byOrderId(params);
} catch (error) {
console.log(error);
return system.getResult(null, "接口异常");
}
}
async apiByChannelOrderNo(params) {
try {
return await this.byChannelOrderNo(params);
} catch (error) {
console.log(error);
return system.getResult(null, "接口异常");
}
}
async apiCompleteMapByCreditCodes(params) {
try {
return await this.getCompleteMapByCreditCodes(params);
} catch (error) {
console.log(error);
return system.getResult(null, "接口异常");
}
}
async apiAddContract(params) {
try {
return await this.addContract(params);
} catch (error) {
console.log(error);
return system.getResult(null, "接口异常");
}
}
// -----------------------以此间隔,上面为API,下面为service---------------------------------
async method(params) {
return system.getResultSuccess();
}
async addContract(params) {
var merchantId = params.merchant_id || params.merchantId;
var channelOrderNo = this.trim(params.channelOrderNo);
var businessmen = await this.dao.findOne({
merchant_id: merchantId,
channelOrderNo: channelOrderNo,
});
if (!businessmen) {
return system.getResult(null, "个体户不存在");
}
businessmen.contract = this.trim(params.contract);
businessmen.contractStartData = params.contractStartData;
businessmen.contractEndData = params.contractEndData;
await businessmen.save();
return system.getResultSuccess();
}
async byOrderId(params) {
var businessmen = await this.dao.getByOrderId(param.orderId);
if (businessmen) {
await this.dao.setRowCodeName(businessmen, "bstatus");
await this.dao.setRowCodeName(businessmen, "gstatus");
await this.dao.setRowCodeName(businessmen, "dstatus");
this.handleDate(businessmen, ["created_at", "updated_at", "signTime"], "YYYY-MM-DD HH:mm:ss", -8);
this.handleDate(businessmen, ["regDate", "taxRegDay", "contractEndData", "contractStartData"], "YYYY-MM-DD", -8);
}
return system.getResultSuccess(businessmen);
}
async byChannelOrderNo(params) {
var businessmen = await this.dao.getByChannelOrderNo(params.merchantId, params.channelOrderNo);
if (businessmen) {
await this.dao.setRowCodeName(businessmen, "bstatus");
await this.dao.setRowCodeName(businessmen, "gstatus");
await this.dao.setRowCodeName(businessmen, "dstatus");
this.handleDate(businessmen, ["created_at", "updated_at", "signTime"], "YYYY-MM-DD HH:mm:ss", -8);
this.handleDate(businessmen, ["regDate", "taxRegDay", "contractEndData", "contractStartData"], "YYYY-MM-DD", -8);
}
return system.getResultSuccess(businessmen);
}
async nameList(params) {
var list = await this.dao.nameList(params.bstatuses);
return system.getResultSuccess(list);
}
async page(params) {
var currentPage = Number(params.currentPage || 1);
var pageSize = Number(params.pageSize || 10);
var orderId = this.trim(params.orderId);
var bstatus = this.trim(params.bstatus);
var merchantId = this.trim(params.merchantId);
var where = {};
var orderby = [
["id", 'desc']
];
if (params.businessmenId) {
where.id = params.businessmenId;
}
if (merchantId) {
where.merchant_id = merchantId;
}
if (orderId) {
where.order_id = orderId;
}
if (bstatus) {
where.bstatus = bstatus;
}
this.addWhereTime(where, 'created_at', params.createdBegin, params.createdEnd);
var page = await this.getPageList(currentPage, pageSize, where, orderby);
if (page && page.rows) {
for (var row of page.rows) {
await this.dao.setRowCodeName(row, "bstatus");
await this.dao.setRowCodeName(row, "gstatus");
await this.dao.setRowCodeName(row, "dstatus");
this.handleDate(row, ["created_at", "updated_at", "signTime"], null, -8);
this.handleDate(row, ["regDate", "taxRegDay"], "YYYY-MM-DD", -8);
}
// 设置开票内容
await this.setInvoiceContent(page.rows);
}
return system.getResultSuccess(page);
}
async signPage(params) {
var currentPage = Number(params.currentPage || 1);
var pageSize = Number(params.pageSize || 10);
var orderId = this.trim(params.orderId);
var status = this.trim(params.status);
var merchantId = this.trim(params.merchantId);
var where = {};
var orderby = [
["id", 'desc']
];
if (params.businessmenId) {
where.id = params.businessmenId;
}
where.bstatus = "2020";
this.addWhereTime(where, 'created_at', params.createdBegin, params.createdEnd);
var page = await this.getPageList(currentPage, pageSize, where, orderby);
if (page && page.rows) {
for (var row of page.rows) {
this.handleDate(row, ["created_at", "updated_at", "signTime"], null, -8);
this.handleDate(row, ["regDate", "taxRegDay"], "YYYY-MM-DD", -8);
}
await this.setInvoiceContent(page.rows);
}
return system.getResultSuccess(page);
}
async getCompleteMapByCreditCodes(params) {
var result = {};
var attrs = "id, creditCode, name, isBank, taxOrg, taxUpType, addValueUpType, costRate, " +
"taxRate, serviceRate,commonTaxLadder,commonOtherLadder,specialTaxLadder,specialOtherLadder";
var condition = {
creditCodes: params.creditCodes,
statuses: ["2020"],
}
var list = await this.dao.getByCreditCodes(condition, attrs);
if (!list || list.length == 0) {
return result;
}
var ids = [];
for (var item of list) {
ids.push(item.id);
}
var icmap = await this.businessmeninvoicecontentDao.mapByBusinessmenIds(ids);
for (var item of list) {
item.invoicecontents = icmap[item.id] || [];
result[item.creditCode] = item;
}
return system.getResultSuccess(result);
}
async infoPage(params) {
var currentPage = Number(params.currentPage || 1);
var pageSize = Number(params.pageSize || 10);
var merchantId = this.trim(params.merchantId);
var orderId = this.trim(params.orderId);
var status = this.trim(params.status);
// TODO 有可能根据这个鸡巴玩意进行查询
var deliverId = this.trim(params.deliverId);
var where = {};
var orderby = [
["id", 'desc']
];
if (params.businessmenId) {
where.id = params.businessmenId;
}
if (merchantId) {
where.merchant_id = merchantId;
}
if (orderId) {
where.order_id = orderId;
}
if (status) {
where.status = status;
}
var attrs = ["id", "order_id", "legalName", "creditCode", "status"];
this.addWhereTime(where, 'created_at', params.createdBegin, params.createdEnd);
var page = await this.getPageList(currentPage, pageSize, where, orderby, attrs);
if (page && page.rows) {
for (var row of page.rows) {
await this.dao.setRowCodeName(row, "status");
}
}
return system.getResultSuccess(page);
}
async userPage(params) {
var currentPage = Number(params.currentPage || 1);
var pageSize = Number(params.pageSize || 10);
var userId = this.trim(params.userId);
var orderId = this.trim(params.orderId);
var gstatuses = params.gstatuses;
var where = {};
if (userId) {
where.userId = userId;
}
if (orderId) {
where.order_id = orderId;
}
if (gstatuses && gstatuses.length > 0) {
where.gstatus = {
[this.db.Op.in]: gstatuses
}
}
var orderby = [
["id", 'desc']
];
this.addWhereTime(where, 'created_at', params.createdBegin, params.createdEnd);
var page = await this.getPageList(currentPage, pageSize, where, orderby);
if (page && page.rows) {
for (var row of page.rows) {
await this.dao.setRowCodeName(row, "bstatus");
await this.dao.setRowCodeName(row, "gstatus");
await this.dao.setRowCodeName(row, "dstatus");
this.handleDate(row, ["created_at", "updated_at"], null, -8);
this.handleDate(row, ["regDate", "taxRegDay"], "YYYY-MM-DD", -8);
}
}
return system.getResultSuccess(page);
}
async deliverPage(params) {
var currentPage = Number(params.currentPage || 1);
var pageSize = Number(params.pageSize || 10);
var deliverId = this.trim(params.deliverId);
var orderId = this.trim(params.orderId);
var dstatus = params.dstatus;
var where = {};
if (deliverId) {
// TODO 查询个体户下所有订单id
}
if (orderId) {
where.order_id = orderId;
}
if (dstatus) {
where.dstatus = dstatus
}
var orderby = [
["id", 'desc']
];
this.addWhereTime(where, 'created_at', params.createdBegin, params.createdEnd);
var page = await this.getPageList(currentPage, pageSize, where, orderby);
if (page && page.rows) {
for (var row of page.rows) {
await this.dao.setRowCodeName(row, "dstatus");
this.handleDate(row, ["created_at", "updated_at"], null, -8);
this.handleDate(row, ["regDate", "taxRegDay"], "YYYY-MM-DD", -8);
}
}
return system.getResultSuccess(page);
}
async info(params) {
var info = await this.dao.getById(params.id);
await this.dao.setRowCodeName(info, "bstatus");
await this.dao.setRowCodeName(info, "gstatus");
await this.dao.setRowCodeName(info, "dstatus");
this.handleDate(info, ["created_at", "updated_at"], null, -8);
this.handleDate(info, ["regDate", "taxRegDay"], "YYYY-MM-DD", -8);
await this.setInvoiceContent([info]);
return system.getResultSuccess(info);
}
async sign(params) {
var bm = await this.dao.findById(params.id);
if (!bm) {
return system.getResult(null, "个体户不存在");
}
if (bm.bstatus != "2010" && bm.bstatus != "2020") {
return system.getResult(null, "个体户状态错误,不允许进行签约");
}
bm.bstatus = "2020";
bm.gstatus = "2020";
bm.taxUpType = params.taxUpType || "1";
bm.addValueUpType = params.addValueUpType || "1";
bm.costRate = params.costRate;
bm.taxRate = params.taxRate;
bm.serviceRate = params.serviceRate;
bm.signNotes = this.trim(params.signNotes);
bm.commonTaxLadder = params.commonTaxLadder || "";
bm.commonOtherLadder = params.commonOtherLadder || "";
bm.specialTaxLadder = params.specialTaxLadder || "";
bm.specialOtherLadder = params.specialOtherLadder || "";
bm.signTime = new Date();
await bm.save();
var iclist = params.invoicecontents || [];
await this.businessmeninvoicecontentDao.delByBusinessmenId(bm.id);
var icobjs = [];
for(var ic of iclist) {
if(!ic) {
continue;
}
delete ic.id;
ic.businessmen_id = bm.id;
icobjs.push(ic);
}
if(icobjs.length > 0) {
await this.businessmeninvoicecontentDao.bulkCreate(icobjs);
}
return system.getResultSuccess();
}
async setInvoiceContent(rows) {
if (!rows || rows.length == 0) {
return;
}
var ids = [];
for (var row of rows) {
ids.push(row.id);
}
var icmap = await this.businessmeninvoicecontentDao.mapByBusinessmenIds(ids);
for (var row of rows) {
ids.push(row.id);
row.invoicecontents = icmap[row.id] || [];
}
}
}
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("../../sve.base")
const settings = require("../../../../config/settings")
class BusinessmencontractService extends ServiceBase {
constructor() {
super("business", ServiceBase.getDaoName(BusinessmencontractService));
}
async api(params) {
try {
return await this.xxx(params);
} catch (error) {
console.log(error);
return system.getResult(null, "接口异常");
}
}
async apiAdd(params) {
try {
return await this.apiSave(params);
} catch (error) {
console.log(error);
return system.getResult(null, "接口异常");
}
}
// -----------------------以此间隔,上面为API,下面为service---------------------------------
async add(params) {
return system.getResultSuccess();
}
async method(params) {
return system.getResultSuccess();
}
}
module.exports = BusinessmencontractService;
// 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")
const moment = require("moment");
class IborderService extends ServiceBase {
constructor() {
super("order", ServiceBase.getDaoName(IborderService));
this.iborderdeliverDao = system.getObject("db.order.iborderdeliverDao");
this.microsveClient = system.getObject("util.microsve.microsveClient");
this.businessmenDao = system.getObject("db.business.businessmenDao");
}
async api(params) {
try {
return await this.saveSign(params);
} catch (error) {
console.log(error);
return system.getResult(null, "接口异常");
}
}
async apiAllList(params) {
try {
return await this.allList(params);
} catch (error) {
console.log(error);
return system.getResult(null, "接口异常");
}
}
async apiAdd(params) {
try {
return await this.add(params);
} catch (error) {
console.log(error);
return system.getResult(null, "接口异常");
}
}
async apiUpd(params) {
try {
return await this.upd(params);
} catch (error) {
console.log(error);
return system.getResult(null, "接口异常");
}
}
async apiInfo(params) {
try {
return await this.info(params);
} catch (error) {
console.log(error);
return system.getResult(null, "接口异常");
}
}
async apiAllInfo(params) {
try {
return await this.infoAll(params);
} catch (error) {
console.log(error);
return system.getResult(null, "接口异常");
}
}
async apiAssign(params) {
try {
return await this.assign(params);
} catch (error) {
console.log(error);
return system.getResult(null, "接口异常");
}
}
async apiEdit(params) {
try {
return await this.edit(params);
} catch (error) {
console.log(error);
return system.getResult(null, "接口异常");
}
}
async apiMyPage(params) {
try {
return await this.myPage(params);
} catch (error) {
console.log(error);
return system.getResult(null, "接口异常");
}
}
async apiOrderPay(params) {
try {
return await this.orderPay(params);
} catch (error) {
console.log(error);
return system.getResult(null, "接口异常");
}
}
async apiByChannelOrderId(params) {
try {
return await this.byChannelOrderId(params);
} catch (error) {
console.log(error);
return system.getResult(null, "接口异常");
}
}
async apiOrderClose(params) {
try {
return await this.orderClose(params);
} catch (error) {
console.log(error);
return system.getResult(null, "接口异常");
}
}
async apiCloseById(params) {
try {
return await this.closeById(params);
} catch (error) {
console.log(error);
return system.getResult(null, "接口异常");
}
}
async apiComplete(params) {
try {
return await this.complete(params);
} catch (error) {
console.log(error);
return system.getResult(null, "接口异常");
}
}
async apiByDeliverId(params) {
try {
return await this.byDeliverId(params);
} catch (error) {
console.log(error);
return system.getResult(null, "接口异常");
}
}
async apiStatTransData(params) {
try {
return await this.statTransData(params);
} catch (error) {
console.log(error);
return system.getResult(null, "接口异常");
}
}
async apiStatBusinessData(params) {
try {
return await this.statBusinessData(params);
} catch (error) {
console.log(error);
return system.getResult(null, "接口异常");
}
}
// -----------------------以此间隔,上面为API,下面为service---------------------------------
async statTransData(params) {
var result = {
orderCount: 0,
orderPrice: 0,
};
var type = Number(params.type || 1);
var begin, end;
// 取开始时间
if (type == 1) {
begin = moment().format("YYYY-MM") + "-01 00:00:00";
} else if (type == 2) {
begin = moment().subtract(1, "months").format("YYYY-MM") + "-01 00:00:00";
}
// echart数据
var days = [];
var dayCounts = [];
var priceCounts = [];
// 处理查询业务
if (type == 1 || type == 2) { // 取结束时间
end = moment(begin).add(1, "months").subtract(1, 'days').format("YYYY-MM-DD") + " 23:59:59";
days = this.getDays(end);
// 按天统计
var dayMap = await this.dao.statDayByTime(begin, end);
//days = this.getDays(end);
for (var day of days) {
var ditem = dayMap[day] || {};
dayCounts.push(ditem.orderCount || 0);
priceCounts.push(system.f2y(ditem.orderPrice || 0));
}
} else {
var monthMap = await this.dao.statMonthByTime(begin, end);
var bm = monthMap.begin || "";
var em = monthMap.end || "";
if (bm && em) {
// 开始月份-结束月份所有月份
var curMonth = bm;
while (true) {
days.push(curMonth);
if (curMonth == em) {
break;
}
curMonth = moment(curMonth + "-01").add(1, "month").format("YYYY-MM");
}
}
for (var day of days) {
var ditem = monthMap[day] || {};
dayCounts.push(ditem.orderCount || 0);
priceCounts.push(system.f2y(ditem.orderPrice || 0));
}
}
var orderData = await this.dao.statOrderByTime(begin, end) || {};
result.orderCount = orderData.orderCount;
result.orderPrice = system.f2y(orderData.orderPrice);
result.days = days;
result.dayCounts = dayCounts;
result.priceCounts = priceCounts;
return system.getResultSuccess(result);
}
getDays(end) {
var days = [];
var month = moment(end).format("YYYY-MM");
var endDay = Number(moment(end).format("DD"));
for (var i = 1; i <= endDay; i++) {
if (i < 10) {
days.push(month + "-0" + i);
} else {
days.push(month + "-" + i);
}
}
return days;
}
async statBusinessData(params) {
var result = {};
var type = Number(params.type || 1);
// 查 已完成订单,待分配订单,待审核订单,办理中订单
var begin, end;
// 取开始时间
if (type == 1) {
begin = moment().format("YYYY-MM") + "-01 00:00:00";
end = moment(begin).add(1, "months").subtract(1, 'days').format("YYYY-MM-DD") + " 23:59:59";
} else if (type == 2) {
begin = moment().subtract(1, "months").format("YYYY-MM") + "-01 00:00:00";
end = moment(begin).add(1, "months").subtract(1, 'days').format("YYYY-MM-DD") + " 23:59:59";
}
// 先按照订单状态查他妈的
var statMap = await this.dao.statByStatus(begin, end);
// 所有状态
// "1000": "未付款", "1010": "订单关闭", "1020": "待分配", "1030": "待处理", "1040": "交付商关闭",
// "1050": "执照办理中", "1060": "已出执照", "1070": "刻章办理中", "1080": "已刻章", "1090": "银行开户中",
// "1100": "银行卡已开户", "1110": "税务报道中", "1120": "已税务报道", "1130": "待审核", "1140": "审核失败",
// "1150": "审核通过", "1160": "已邮寄", "1170": "已完成",
//
// 已完成 1100
result.completeCount = this.addStatCount(statMap, ['1100']);
// 待分配
result.toApplyCount = this.addStatCount(statMap, ['1020']);
// 待审核 1130 1140
result.toAuditCount = this.addStatCount(statMap, ['1130']);
// 办理中 1030, 1050, 1060, 1070, 1080, 1090, 1100, 1110, 1120, 1130, 1140, 1150, 1160
result.handlingCount = this.addStatCount(statMap, ["1030", "1050", "1060", "1070", "1080", "1090", "1100", "1110", "1120", "1130", "1140", "1150", "1160"]);
return system.getResultSuccess(result);
}
addStatCount(statusMap, statuses) {
var count = 0;
if(!statuses) {
return count;
}
for(var status of statuses) {
count = count + Number(statusMap[status] || 0);
}
return count;
}
async byDeliverId(params) {
var od = await this.dao.findOne({
orderDeliverId: params.orderDeliverId
});
return system.getResultSuccess(od);
}
async orderPay(params) {
var order = await this.findById(params.id);
if (!order) {
return system.getResult(null, "订单不存在");
}
var busiStatus = await this.orderBusinessStatus.findOrderBusinessStatus(order.status);
if (busiStatus.next != "1020") {
return system.getResult(null, "当前订单不允许支付");
}
var nextBusi = await this.orderBusinessStatus.findOrderBusinessStatus(busiStatus.next);
order.status = nextBusi.status;
order.ostatus = nextBusi.ostatus;
await order.save();
return system.getResultSuccess();
}
async add(params) {
var order = {};
order.price = Number(params.price || 300000);
order.status = "1000";
var merchantId = params.merchantId || params.merchant_id;
if (merchantId) {
var exists = await this.dao.findOne({
merchant_id: this.trim(merchantId),
channelOrderNo: this.trim(params.channelOrderNo),
});
if (exists) {
return system.getResult(null, "订单号【" + params.channelOrderNo + "】重复");
}
var merchantData = await this.microsveClient.call("merchant", "getById", {
"id": merchantId
});
if (merchantData.status != 0) {
return merchantData;
}
var merchant = merchantData.data;
if (!merchant.mustPay) {
order.price = 0;
order.status = "1020";
}
}
var busiStatus = await this.orderBusinessStatus.findOrderBusinessStatus(order.status);
if (busiStatus) {
order.ostatus = busiStatus.ostatus;
}
// 商户id
order.merchant_id = this.trim(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.bankImg = this.trim(params.bankImg);
order.names = this.trim(params.names);
order.capital = this.trim(params.capital);
order.domicile_id = this.trim(params.domicileId);
order.domicileName = this.trim(params.domicileName);
// 个体户经营范围
order.businessScope_id = this.trim(params.businessScopeId);
order.businessType = this.trim(params.businessType);
order.businessScope = this.trim(params.businessScope);
order.bdId = this.trim(params.bdId);
order.bdPath = this.trim(params.bdId);
// 邮寄地址
order.mailAddr = this.trim(params.mailAddr);
order.mailTo = this.trim(params.mailTo);
order.mailMobile = this.trim(params.mailMobile);
order.userId = this.trim(params.userId);
order = await this.dao.create(order);
return system.getResultSuccess({
orderNo: order.id
});
}
async upd(params) {
var merchantId = params.merchantId || params.merchant_id;
var order = await this.dao.findOne({
merchant_id: this.trim(merchantId),
channelOrderNo: this.trim(params.channelOrderNo),
});
if (!order) {
return system.getResult(null, "订单不存在");
}
// 商户id
order.merchant_id = this.trim(merchantId);
// 订单资料信息
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.bankImg = this.trim(params.bankImg);
order.names = this.trim(params.names);
order.capital = this.trim(params.capital);
order.domicile_id = this.trim(params.domicileId);
order.domicileName = this.trim(params.domicileName);
// 个体户经营范围
order.businessScope_id = this.trim(params.businessScopeId);
order.businessType = this.trim(params.businessType);
order.businessScope = this.trim(params.businessScope);
// 邮寄地址
order.mailAddr = this.trim(params.mailAddr);
order.mailTo = this.trim(params.mailTo);
order.mailMobile = this.trim(params.mailMobile);
order = await order.save();
return system.getResultSuccess({
orderNo: order.id
});
}
// 全部订单
async allList(params) {
var currentPage = Number(params.currentPage || 1);
var pageSize = Number(params.pageSize || 10);
var merchantId = this.trim(params.merchantId);
var channelOrderNo = this.trim(params.channelOrderNo);
var orderId = this.trim(params.orderId);
var status = this.trim(params.status);
var where = {};
var orderby = [
["id", 'desc']
];
if (merchantId) {
where.merchant_id = merchantId;
}
if (orderId) {
where.id = orderId;
}
if (status) {
where.status = status
}
this.addWhereTime(where, 'created_at', params.createdBegin, params.createdEnd);
this.addWhereTime(where, 'assignTime', params.assignBegin, params.assignEnd);
var page = await this.getPageList(currentPage, pageSize, where, orderby, null);
if (page && page.rows) {
for (var row of page.rows) {
await this.dao.setRowCodeName(row, "status");
await this.dao.setRowCodeName(row, "ostatus");
await this.dao.setRowCodeName(row, "deliverType");
this.handleDate(row, ["created_at", "assignTime"], null, -8);
}
// 设置交付商
await this.setDeliver(page.rows);
}
return system.getResultSuccess(page);
}
async setDeliver(rows) {
if (!rows || rows.length == 0) {
return;
}
var orderDeliverIds = [];
for (var row of rows) {
orderDeliverIds.push(row.orderDeliverId);
}
var deliverMap = await this.iborderdeliverDao.findMapByIds(orderDeliverIds);
for (var row of rows) {
row.deliver = deliverMap[row.orderDeliverId] || {};
this.handleDate(row.deliver, ["created_at", "updated_at"], null, -8);
}
}
async myPage(params) {
var currentPage = Number(params.currentPage || 1);
var pageSize = Number(params.pageSize || 10);
var bdId = this.trim(params.bdId);
var userId = this.trim(params.userId);
var bdPath = this.trim(params.bdPath);
var ostatuses = params.ostatuses;
var where = {};
var orderby = [
["id", 'desc']
];
if (bdId) {
where.merchant_id = bdId;
}
if (bdPath && bdPath.length > 0) {
where.id = {
[this.db.Op.like]: bdPath + "%"
}
}
if (userId) {
where.userId = userId;
}
if (ostatuses && ostatuses.length > 0) {
where.ostatus = {
[this.db.Op.in]: ostatuses
}
}
this.addWhereTime(where, 'created_at', params.createdBegin, params.createdEnd);
var page = await this.getPageList(currentPage, pageSize, where, orderby, null);
if (page && page.rows) {
for (var row of page.rows) {
await this.dao.setRowCodeName(row, "status");
await this.dao.setRowCodeName(row, "ostatus");
await this.dao.setRowCodeName(row, "deliverType");
this.handleDate(row, ["created_at", "assignTime"], null, -8);
}
}
return system.getResultSuccess(page);
}
async info(params) {
var row = await this.dao.getById(params.id);
if (!row) {
return system.getResult(null, "订单不存在");
}
await this.dao.setRowCodeName(row, "status");
await this.dao.setRowCodeName(row, "deliverType");
this.handleDate(row, ["created_at", "assignTime"], null, -8);
return system.getResultSuccess(row);
}
async byChannelOrderId(params) {
var merchantId = params.merchantId || params.merchant_id;
var row = await this.dao.model.findOne({
where: {
merchant_id: merchantId,
channelOrderNo: this.trim(params.channelOrderNo),
},
raw: true
});
if (!row) {
return system.getResult(null, "订单不存在");
}
await this.dao.setRowCodeName(row, "status");
await this.dao.setRowCodeName(row, "ostatus");
await this.dao.setRowCodeName(row, "deliverType");
this.handleDate(row, ["created_at", "assignTime"], null, -8);
return system.getResultSuccess(row);
}
async infoAll(params) {
var row = await this.dao.getById(params.id);
if (!row) {
return system.getResult(null, "订单不存在");
}
await this.dao.setRowCodeName(row, "status");
await this.dao.setRowCodeName(row, "deliverType");
this.handleDate(row, ["created_at", "assignTime"], null, -8);
// 个体户
var businessmen = await this.businessmenDao.getByOrderId(params.id);
if (businessmen) {
await this.businessmenDao.setRowCodeName(businessmen, "bstatus");
await this.businessmenDao.setRowCodeName(businessmen, "gstatus");
await this.businessmenDao.setRowCodeName(businessmen, "dstatus");
this.handleDate(businessmen, ["created_at", "updated_at"], null, -8);
}
row.businessmen = businessmen || {};
// 交付商
row.deliver = await this.iborderdeliverDao.getById(row.orderDeliverId) || {};
await this.iborderdeliverDao.setRowCodeName(row.deliver, "status");
this.handleDate(row.deliver, ["created_at", "updated_at"], null, -8);
return system.getResultSuccess(row);
}
// 订单编辑,只编辑指定几个字段,暂时只有merchant_id和价格
async edit(params) {
var id = params.id;
var merchantId = this.trim(params.merchantId);
var price = Number(params.price || 0);
var order = await this.findById(id);
if (!order) {
return system.getResult(null, "订单不存在");
}
order.merchant_id = merchantId;
if ("1000" == order.status) {
order.price = price;
}
order = await order.save();
return system.getResultSuccess();
}
// 订单分配
async assign(params) {
var orderId = this.trim(params.id);
var order = await this.findById(orderId);
if (!order) {
return system.getResult(null, "订单不存在");
}
if (order.status != "1020") {
return system.getResult(null, "该订单状态不允许分配,请刷新重试");
}
if (order.orderDeliverId) {
return system.getResult(null, "该订单已分配,不允许再次分配");
}
order.status = "1030";
order.assignTime = new Date();
order.assignUcname = this.trim(params.assignUcname);
var orderDeliver = {};
orderDeliver.order_id = orderId;
orderDeliver.status = "1030";
orderDeliver.deliver_id = this.trim(params.deliverId);
orderDeliver.deliverName = this.trim(params.deliverName);
orderDeliver.deliverDivide = Number(params.deliverDivide || 0);
// 创建交付商订单
orderDeliver = await this.iborderdeliverDao.create(orderDeliver);
order.orderDeliverId = orderDeliver.id;
// 订单更改状态
await order.save();
return system.getResultSuccess();
}
async updPrice(params) {
var orderId = this.trim(params.orderId);
var merchantId = this.trim(params.merchantId);
var price = Number(params.price || 0);
var order = await this.findById(orderId);
if (!order) {
return system.getResult(null, "订单不存在");
}
order.price = price;
order.merchant_id = merchant;
await order.save();
return system.getResultSuccess();
}
async closeById(params) {
var order = await this.dao.findById(params.id);
if (!order) {
return system.getResult(null, "订单不存在");
}
if (order.status != 1000) {
var statusName = await this.dao.getRowCodeName(order, "ostatus");
return system.getResult(null, "订单状态处于【" + statusName + "】,不允许关闭");
}
var busiStatus = await this.orderBusinessStatus.findOrderBusinessStatus("1010");
order.status = busiStatus.status;
order.ostatus = busiStatus.ostatus;
await order.save();
return system.getResultSuccess({
orderNo: order.id
});
}
async orderClose(params) {
var order = await this.dao.findOne({
merchant_id: this.trim(params.merchantId),
channelOrderNo: this.trim(params.channelOrderNo),
});
if (!order) {
return system.getResult(null, "订单不存在");
}
if (order.status != 1000) {
var statusName = await this.dao.getRowCodeName(order, "ostatus");
return system.getResult(null, "订单状态处于【" + statusName + "】,不允许关闭");
}
var busiStatus = await this.orderBusinessStatus.findOrderBusinessStatus("1010");
order.status = busiStatus.status;
order.ostatus = busiStatus.ostatus;
await order.save();
return system.getResultSuccess({
orderNo: order.id
});
}
async complete(params) {
var order = await this.dao.findById(params.id);
if (!order) {
return system.getResult(null, "订单不存在");
}
await this.dao.setRowCodeName(order, "status");
if (order.status != "1160") {
return system.getResult(null, "订单状态错误【" + order.statusName + "】,不允许该状态下完成订单");
}
var businessmen = await this.businessmenDao.getByOrderId(params.id);
var self = this;
await this.db.transaction(async function (t) {
var orderFields = {
status: "1170",
ostatus: "1170",
id: order.id,
deliverType: self.trim(params.deliverType),
deliverNo: self.trim(params.deliverNo),
deliverImg: self.trim(params.deliverImg),
}
await self.dao.update(orderFields, t);
await self.businessmenDao.update({
id: businessmen.id,
bstatus: "2010",
}, t);
return 1;
});
return system.getResultSuccess();
}
}
module.exports = IborderService;
// 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")
const moment = require("moment");
class IborderdeliverService extends ServiceBase {
constructor() {
super("order", ServiceBase.getDaoName(IborderdeliverService));
this.iborderDao = system.getObject("db.order.iborderDao");
this.businessmenDao = system.getObject("db.business.businessmenDao");
}
async api(params) {
try {
return await this.saveSign(params);
} catch (error) {
console.log(error);
return system.getResult(null, "接口异常");
}
}
async apiPage(params) {
try {
return await this.page(params);
} catch (error) {
console.log(error);
return system.getResult(null, "接口异常");
}
}
async apiInfo(params) {
try {
return await this.info(params);
} catch (error) {
console.log(error);
return system.getResult(null, "接口异常");
}
}
async apiEdit(params) {
try {
return await this.edit(params);
} catch (error) {
console.log(error);
return system.getResult(null, "接口异常");
}
}
async apiClose(params) {
try {
return await this.close(params);
} catch (error) {
console.log(error);
return system.getResult(null, "接口异常");
}
}
async apiHandle(params) {
try {
var id = params.id;
var status = params.status;
var dorder = await this.dao.findById(id);
if (!dorder) {
return system.getResult(null, "订单不存在");
}
var order = await this.iborderDao.findById(dorder.order_id);
await this.iborderDao.setRowCodeName(order, "status");
var busiStatus = await this.orderBusinessStatus.findOrderBusinessStatus(order.status);
var nextObj = await this.orderBusinessStatus.findOrderBusinessStatus(busiStatus.next);
if (status == '1130') {
if (order.status != '1120' && order.status != '1140') {
return system.getResult(null, "订单状态【" + order.statusName + "】,不允许提交审核");
}
nextObj = await this.orderBusinessStatus.findOrderBusinessStatus("1130");
} else if (status != busiStatus.next && busiStatus.next) {
if (!nextObj) {
return system.getResult(null, "订单进度错误");
}
return system.getResult(null, "订单状态错误,应该新建【" + nextObj.name + "】进度");
}
params.nextObj = nextObj;
// "1050": "执照办理中", "1060": "已出执照",
// "1070": "刻章办理中", "1080": "已刻章",
// "1090": "银行开户中", "1100": "银行卡已开户",
// "1110": "税务报道中", "1120": "已税务报道",
// "1130": "提交审核", "1140": "审核失败", "1150": "审核通过",
// "1160": "已邮寄",
switch (params.status) {
case "1050": // 执照办理中
case "1070": // 刻章办理中
case "1090": // 银行开户中
case "1110": // 税务报道中
return await this.changeStatus(params, dorder, order);
case "1060": { // 已出执照
return await this.status1060(params, dorder, order);
}
case "1080": { // 已刻章
return await this.status1080(params, dorder, order);
}
case "1100": { // 银行已开户
return await this.status1100(params, dorder, order);
}
case "1120": { // 已税务报道
return await this.status1120(params, dorder, order);
}
case "1130": { // 提交审核
return await this.status1130(params, dorder, order);
}
case "1160": { // 已邮寄
return await this.status1160(params, dorder, order);
}
default:
return system.getResult(null, "无法识别订单状态");
}
} catch (error) {
console.log(error);
return system.getResult(null, "接口异常");
}
}
async apiAudit(params) {
try {
return await this.audit(params);
} catch (error) {
console.log(error);
return system.getResult(null, "接口异常");
}
}
async apiStatDeliverData(params) {
try {
return await this.statDeliverData(params);
} catch (error) {
console.log(error);
return system.getResult(null, "接口异常");
}
}
// -----------------------以此间隔,上面为API,下面为service---------------------------------
async statDeliverData(params) {
var currentPage = Number(params.currentPage || 1);
var pageSize = Number(params.pageSize || 10);
// 处理时间
var type = Number(params.type || 1);
var begin, end;
// 取开始时间
if (type == 1) {
begin = moment().format("YYYY-MM") + "-01 00:00:00";
end = moment(begin).add(1, "months").subtract(1, 'days').format("YYYY-MM-DD") + " 23:59:59";
} else if (type == 2) {
begin = moment().subtract(1, "months").format("YYYY-MM") + "-01 00:00:00";
end = moment(begin).add(1, "months").subtract(1, 'days').format("YYYY-MM-DD") + " 23:59:59";
}
var condition = {
begin: begin,
end: end,
}
// 查总数
var total = await this.dao.countStat(condition);
if (total == 0) {
return system.getResultSuccess({
count: 0,
rows: []
});
}
// 查条数
var startRow = (currentPage - 1) * pageSize;
var list = await this.dao.queryStat(condition, startRow, pageSize);
// 设置已完成数量、办理中数量
var deliverIds = [];
for (var item of list) {
deliverIds.push(item.deliver_id);
}
var dstatusMap = await this.dao.statDeliverByStatus({
begin: begin,
end: end,
deliverIds: deliverIds
});
for (var item of list) {
item.completeCount = this.addStatCount(dstatusMap, item.deliver_id, ['1160']);
item.handlingCount = this.addStatCount(dstatusMap, item.deliver_id, ["1030", "1050", "1060", "1070", "1080", "1090", "1100", "1110", "1120", "1130", "1140", "1150"]);
}
return system.getResultSuccess({
count: total,
rows: list
});
}
addStatCount(statusMap, deliver_id, statuses) {
var count = 0;
if (!statuses || statuses.length == 0) {
return count;
}
for (var status of statuses) {
count = count + Number(statusMap[deliver_id + "_" + status] || 0);
}
return count;
}
async info(params) {
var id = params.id;
var deliverOrder = await this.dao.getById(id);
var order = await this.iborderDao.getById(deliverOrder.order_id);
var businessmen = await this.businessmenDao.getByOrderId(deliverOrder.order_id);
await this.dao.setRowCodeName(deliverOrder, "status");
await this.iborderDao.setRowCodeName(order, "status");
await this.businessmenDao.setRowCodeName(businessmen, "status");
this.handleDate(deliverOrder, ["created_at", "updated_at"], null, -8);
this.handleDate(order, ["created_at", "updated_at", "assignTime"], null, -8);
this.handleDate(businessmen, ["created_at", "updated_at"], null, -8);
this.handleDate(businessmen, ["regDate", "taxRegDay"], "YYYY-MM-DD", -8);
system.f2y4list([order], ["price"]);
system.f2y4list([deliverOrder], ["deliverDivide"]);
return system.getResultSuccess({
deliverOrder: deliverOrder,
order: order,
businessmen: businessmen,
});
}
async page(params) {
var currentPage = Number(params.currentPage || 1);
var pageSize = Number(params.pageSize || 10);
var deliverId = this.trim(params.deliverId);
var orderId = this.trim(params.orderId);
var status = this.trim(params.status);
var merchantId = this.trim(params.merchantId);
var where = {};
var orderby = [
["id", 'desc']
];
if (deliverId) {
where.deliver_id = deliverId;
}
if (merchantId) {
where.merchant_id = merchantId;
}
if (orderId) {
where.order_id = orderId;
}
if (status) {
where.status = status;
}
this.addWhereTime(where, 'created_at', params.createdBegin, params.createdEnd);
var page = await this.getPageList(currentPage, pageSize, where, orderby);
if (page && page.rows) {
for (var row of page.rows) {
await this.dao.setRowCodeName(row, "status");
// 下一个状态
var nextObj = await this.orderBusinessStatus.findOrderNextBusinessStatus(row.status);
row.nextStatus = nextObj.status;
row.nextStatusName = nextObj.name;
this.handleDate(row, ["created_at"], null, -8);
}
await this.setOrder(page.rows, "`id`, `legalName`, `legalMobile`, `price`, `idcard`");
}
return system.getResultSuccess(page);
}
async setOrder(rows, attrs) {
if (!rows || rows.length == 0) {
return;
}
var ids = [];
for (var row of rows) {
ids.push(row.order_id);
}
var map = await this.iborderDao.getMapByIds(ids, attrs);
for (var row of rows) {
row.order = map[row.order_id] || {}
}
}
async changeStatus(params, dorder, order) {
var nextObj = params.nextObj;
order.status = nextObj.status;
order.ostatus = nextObj.ostatus;
dorder.status = nextObj.dstatus;
await order.save();
await dorder.save();
return system.getResultSuccess();
}
async status1060(params, dorder, order) {
var current = "1060";
if (!params.name) {
return system.getResult(null, "请输入个体工商户名称");
}
if (!params.creditCode) {
return system.getResult(null, "请输入统一社会信用代码");
}
if (!params.businessPlace) {
return system.getResult(null, "请输入经营场所");
}
if (!params.businessScope) {
return system.getResult(null, "请输入经营范围");
}
if (!params.regDate) {
return system.getResult(null, "请输入注册日期");
}
if (!params.businessImg) {
return system.getResult(null, "请上传执照照片");
}
var businessmen = await this.businessmenDao.findOne({
order_id: order.id
});
if (!businessmen) {
businessmen = {};
}
var self = this;
var v = await this.db.transaction(async function (t) {
var updateFields = {};
updateFields.name = self.trim(params.name);
updateFields.creditCode = self.trim(params.creditCode);
updateFields.businessPlace = self.trim(params.businessPlace);
updateFields.businessScope = self.trim(params.businessScope);
updateFields.regDate = params.regDate;
updateFields.businessImg = self.trim(params.businessImg);
updateFields.order_id = self.trim(order.id);
updateFields.merchant_id = self.trim(order.merchant_id);
updateFields.channelOrderNo = self.trim(order.channelOrderNo);
updateFields.legalName = self.trim(order.legalName);
updateFields.legalMobile = self.trim(order.legalMobile);
updateFields.legalIdcard = self.trim(order.idcard);
if (businessmen.id) {
updateFields.id = businessmen.id;
await self.businessmenDao.update(updateFields, t);
} else {
updateFields.bstatus = "2000";
updateFields.gstatus = "2000";
updateFields.dstatus = "2000";
await self.businessmenDao.create(updateFields, t);
}
await self.updateOrderStatusTranscation(dorder, params.nextObj, t);
return 1;
});
return system.getResultSuccess(v);
}
async status1080(params, dorder, order) {
var current = "1080";
var businessmen = await this.businessmenDao.findOne({
order_id: order.id
});
if (!businessmen) {
return system.getResult(null, "个体户订单不存在");
}
var self = this;
var v = await this.db.transaction(async function (t) {
var updateFields = {};
updateFields.id = businessmen.id;
updateFields.gongzhang = self.trim(params.gongzhang);
updateFields.caiwuzhang = self.trim(params.caiwuzhang);
updateFields.businessImg = self.trim(params.businessImg);
updateFields.fapiaozhang = self.trim(params.fapiaozhang);
updateFields.hetongzhang = self.trim(params.hetongzhang);
updateFields.farenzhang = self.trim(params.farenzhang);
await self.businessmenDao.update(updateFields, t);
await self.updateOrderStatusTranscation(dorder, params.nextObj, t);
return 1;
});
return system.getResultSuccess(v);
}
async status1100(params, dorder, order) {
var businessmen = await this.businessmenDao.findOne({
order_id: order.id
});
if (!businessmen) {
return system.getResult(null, "个体户订单那不存在");
}
var self = this;
var v = await this.db.transaction(async function (t) {
var updateFields = {};
updateFields.id = businessmen.id;
updateFields.isBank = params.isBank ? true : fasle;
updateFields.bankName = self.trim(params.bankName);
updateFields.bankNo = self.trim(params.bankNo);
updateFields.bank = self.trim(params.bank);
updateFields.bankImg = self.trim(params.bankImg);
await self.businessmenDao.update(updateFields, t);
await self.updateOrderStatusTranscation(dorder, params.nextObj, t);
return 1;
});
return system.getResultSuccess(v);
}
async status1120(params, dorder, order) {
var businessmen = await this.businessmenDao.findOne({
order_id: order.id
});
if (!businessmen) {
return system.getResult(null, "个体户订单那不存在");
}
var self = this;
var v = await this.db.transaction(async function (t) {
var updateFields = {};
updateFields.id = businessmen.id;
updateFields.caImg = params.caImg;
updateFields.taxRegDay = params.taxRegDay;
updateFields.taxOrg = params.taxOrg;
await self.businessmenDao.update(updateFields, t);
await self.updateOrderStatusTranscation(dorder, params.nextObj, t);
return 1;
});
//推送
return system.getResultSuccess(v);
}
// 提交审核
async status1130(params, dorder, order) {
var self = this;
var v = await this.db.transaction(async function (t) {
await self.updateOrderStatusTranscation(dorder, params.nextObj, t);
return 1;
});
return system.getResultSuccess(v);
}
async status1160(params, dorder, order) {
var businessmen = await this.businessmenDao.findOne({
order_id: order.id
});
if (!businessmen) {
return system.getResult(null, "个体户订单不存在");
}
var nextObj = params.nextObj;
var self = this;
var v = await this.db.transaction(async function (t) {
var updateFields = {};
updateFields.id = businessmen.id;
updateFields.dstatus = "2020";
updateFields.courierNo = params.courierNo;
updateFields.courierImg = params.courierImg;
await self.businessmenDao.update(updateFields, t);
await self.iborderDao.update({
id: dorder.order_id,
status: "1160",
}, t);
await self.dao.update({
id: dorder.id,
status: "1160"
});
return 1;
});
return system.getResultSuccess(v);
}
async audit(params) {
if (params.status != "1140" && params.status != "1150") {
return system.getResult(null, "订单审核状态填写错误");
}
var dorder = await this.findById(params.id);
if (!dorder) {
return system.getResult(null, "订单不存在");
};
await this.dao.setRowCodeName(dorder, "status");
if (dorder.status != "1130") {
return system.getResult(null, "订单状态【" + dorder.statusName + "】,不允许审核");
}
var self = this;
await this.db.transaction(async function (t) {
var updateFields = {};
updateFields.id = params.id;
updateFields.status = params.status;
updateFields.auditRemark = self.trim(params.auditRemark);
updateFields.content = self.trim(params.content);
updateFields.addressee = self.trim(params.addressee);
updateFields.mobile = self.trim(params.mobile);
updateFields.addr = self.trim(params.addr);
updateFields.auditUser = self.trim(params.auditUser);
updateFields.auditResult = params.status == "1140" ? "审核失败" : "审核成功";
await self.dao.update(updateFields, t);
await self.iborderDao.update({
id: dorder.order_id,
status: params.status
}, t);
});
return system.getResultSuccess();
}
async updateOrderStatusTranscation(dorder, statusObj, t) {
if (!statusObj) {
return;
}
var orderFields = {
id: dorder.order_id
};
if (statusObj.status) {
orderFields.status = statusObj.status;
}
if (statusObj.ostatus) {
orderFields.ostatus = statusObj.ostatus;
}
await this.iborderDao.update(orderFields, t);
var dorderFileds = {
id: dorder.id
};
if (statusObj.dstatus) {
dorderFileds.status = statusObj.dstatus;
await this.dao.update(dorderFileds, t);
}
}
async updateBusiness(status, businessmen, border, t) {
await this.businessmenDao.update(businessmen, t);
await this.iborderDao.update({
status: status,
id: border.order_id
}, t);
await this.dao.update({
status: status,
id: border.id
}, t);
}
async edit(params) {
var orderParams = params.order;
var bmParams = params.businessmen;
var orderEdit = {};
var bmEdit = {};
orderEdit.id = orderParams.id;
orderEdit.legalName = this.trim(orderParams.legalName);
orderEdit.idcard = this.trim(orderParams.idcard);
orderEdit.legalMobile = this.trim(orderParams.legalMobile);
orderEdit.bankNo = this.trim(orderParams.bankNo);
orderEdit.capital = this.trim(orderParams.capital);
orderEdit.names = this.trim(orderParams.names);
orderEdit.businessType = this.trim(orderParams.businessType);
orderEdit.businessScope = this.trim(orderParams.businessScope);
orderEdit.idcardFront = this.trim(orderParams.idcardFront);
orderEdit.idcardBack = this.trim(orderParams.idcardBack);
bmEdit.id = this.trim(bmParams.id);
// 执照信息
bmEdit.name = this.trim(bmParams.name);
bmEdit.creditCode = this.trim(bmParams.creditCode);
bmEdit.businessPlace = this.trim(bmParams.businessPlace);
bmEdit.legalName = this.trim(bmParams.legalName);
bmEdit.legalMobile = this.trim(bmParams.legalMobile);
bmEdit.legalIdcard = this.trim(bmParams.legalIdcard);
bmEdit.regDate = this.trim(bmParams.regDate);
bmEdit.businessScope = this.trim(bmParams.businessScope);
bmEdit.businessImg = this.trim(bmParams.businessImg);
// 刻章
bmEdit.gongzhang = this.trim(bmParams.gongzhang);
bmEdit.caiwuzhang = this.trim(bmParams.caiwuzhang);
bmEdit.fapiaozhang = this.trim(bmParams.fapiaozhang);
bmEdit.hetongzhang = this.trim(bmParams.hetongzhang);
bmEdit.farenzhang = this.trim(bmParams.farenzhang);
// 开户信息
bmEdit.isBank = bmParams.isBank ? true : false;
bmEdit.bankName = this.trim(bmParams.bankName);
bmEdit.bankNo = this.trim(bmParams.bankNo);
bmEdit.bank = this.trim(bmParams.bank);
bmEdit.bankImg = this.trim(bmParams.bankImg);
// 税务报道
bmEdit.caImg = this.trim(bmParams.caImg);
bmEdit.taxRegDay = this.trim(bmParams.taxRegDay);
bmEdit.taxOrg = this.trim(bmParams.taxOrg);
// 邮寄信息
bmEdit.courierNo = this.trim(bmParams.courierNo);
bmEdit.courierImg = this.trim(bmParams.courierImg);
var self = this;
await this.db.transaction(async function (t) {
await self.iborderDao.update(orderEdit, t);
await self.businessmenDao.update(bmEdit, t);
return 1;
});
return system.getResultSuccess();
}
async close(params) {
var od = await this.findById(params.id);
var order = await this.iborderDao.findById(od.order_id);
if (!od) {
return system.getResult(null, od);
}
if (od.status == "1040") {
return system.getResultSuccess();
}
await this.dao.setRowCodeName(od, "status");
if (od.status != "1030") {
return system.getResult(null, "订单处于【" + od.statusName + "】状态, 不允许关闭");
}
od.status = "1040";
od.breakReason = this.trim(params.breakReason);
await od.save();
order.orderDeliverId = "";
order.status = "1020";
await order.save();
return system.getResultSuccess();
}
}
module.exports = IborderdeliverService;
// 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 uuidv4 = require('uuid/v4');
const md5 = require("MD5");
const settings = require("../../../config/settings");
class MicrosveClient {
constructor() {
this.logCtl = system.getObject("web.common.oplogCtl");
this.restClient = system.getObject("util.restClient");
this.micro = system.microsetting();
}
async call(sveName, apiName, params) {
var errorMsg;
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-sve-order",
"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);
}
}
}
module.exports = MicrosveClient;
## 商户服务接口
  1 [商户接口](doc/merchant/merchant.md)
  2 [签约管理](doc/merchant/signed.md)
  2 [抬头管理](doc/merchant/title.md)
  2 [地址管理](doc/merchant/businessmen.md)
  2 [资金账户](doc/merchant/businessmen.md)
  2 [充值申请](doc/merchant/businessmen.md)
  2 [充值记录](doc/merchant/businessmen.md)
## 3. 发票接口
  1 [发票](gongsibao-er/README.md)
<a name="menu">目录</a>
1. [个体户nameList](#nameList)
1. [个体户列表](#list)
1. [个体户信息](#info)
1. [用户签约](#businessmenSign)
1. [签约管理列表](#signList)
1. [个体户信息列表](#infoList)
## **<a name="nameList"> 个体户nameList </a>**
[返回到目录](#menu)
#### 参数格式 `JSON`
#### HTTP请求方式 `POST`
``` javascript
{
"action_process": "test",
"action_type": "businessmenPage",
"action_body": {
}
}
```
#### 返回结果
```javascript
{
"status": 0,
"msg": "success",
"data": [
{
"id": "12795594625000138", // 个体户id
"name": "杨庆菊有限公司2" // 个体户名称
}
],
"requestid": "b90fb36b8738400db40dceb1d6664cef"
}
```
## **<a name="list"> 个体户列表 </a>**
[返回到目录](#menu)
#### 参数格式 `JSON`
#### HTTP请求方式 `POST`
``` javascript
{
"action_process": "test",
"action_type": "businessmenPage",
"action_body": {
"currentPage": "1",
"pageSize": "5",
"merchantId": "", // 商户id
"orderId": "", // 订单号
"status": "" // 个体户状态 1030已出执照, 1050已刻章, 1070银行已开户, 1090已税务报道, 1100待签约, 1120已签约
}
}
```
#### 返回结果
```javascript
{
"status": 0,
"msg": "success",
"data": {
"count": 1,
"rows": [
{
"id": "12795594625000138", // 个体户id
"order_id": "13180532689003786", // 订单编号
"channelOrderNo": "xxxxxxxxx116", // 渠道订单那好
"status": "1100", // 个体户状态
"statusName": "待签约", // 个体户状态名称
// 个体工商户执照信息
"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": "快递交接图片", // 快递交接图片
"signTime": "" // 签约时间
"created_at": "2019-10-06 07:19:07",
"updated_at": "2019-10-06 07:38:57"
}
]
},
"requestid": "0287b98bb1e946b898a6657da4262880"
}
```
## **<a name="info"> 个体户信息 </a>**
[返回到目录](#menu)
#### 参数格式 `JSON`
#### HTTP请求方式 `POST`
``` javascript
{
"action_process": "test",
"action_type": "businessmenInfo",
"action_body": {
"id": "12795594625000138"
}
}
```
#### 返回结果
```javascript
{
"status": 0,
"msg": "success",
"data": {
"id": "12795594625000138", // 个体户id
"order_id": "13180532689003786", // 订单编号
"channelOrderNo": "xxxxxxxxx116", // 渠道订单那好
"status": "1100", // 个体户状态
"statusName": "待签约", // 个体户状态名称
// 个体工商户执照信息
"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",
},
"requestid": "da004bed597f44e88289d02c7a3843a5"
}
```
## **<a name="businessmenSign"> 用户签约 </a>**
[返回到目录](#menu)
#### 参数格式 `JSON`
#### HTTP请求方式 `POST`
``` javascript
{
"action_process": "test",
"action_type": "businessmenSign",
"action_body": {
"id": "12795594625000138", // 个体户id
"taxUpType":"10", // 个税累计
"costRate":"1122", // 核定成本费用率
"signNotes":" 12qwdwqd", // 签约备注
"commonTaxLadder": "[{ }]", // 普票个税梯度
"commonOtherLadder": "[{}]", // 普票票增值税、附加税梯度
"specialTaxLadder": "[{}]", // 专票个税梯度
"specialOtherLadder": "[{}]" // 专票票增值税、附加税梯度
}
```
#### 返回结果
```javascript
{
"status": 0,
"msg": "success",
"data":
"requestid": "da004bed597f44e88289d02c7a3843a5"
}
```
## **<a name="signList"> 签约管理列表 </a>**
[返回到目录](#menu)
#### 参数格式 `JSON`
#### HTTP请求方式 `POST`
``` javascript
{
"action_process": "test",
"action_type": "businessmenPage",
"action_body": {
"currentPage": "1",
"pageSize": "5",
"businessmenId": "", // 个体户id
}
}
```
#### 返回结果
```javascript
{
"status": 0,
"msg": "success",
"data": {
"count": 1,
"rows": [
{
"id": "12795594625000138", // 个体户id
"taxUpType":"10", // 个税累计
"costRate":"1122", // 核定成本费用率
"signNotes":" 12qwdwqd", // 签约备注
"commonTaxLadder": "[{ }]", // 普票个税梯度
"commonOtherLadder": "[{}]", // 普票票增值税、附加税梯度
"specialTaxLadder": "[{}]", // 专票个税梯度
"specialOtherLadder": "[{}]" // 专票票增值税、附加税梯度
"signTime": "" // 签约时间
}
]
},
"requestid": "0287b98bb1e946b898a6657da4262880"
}
```
## **<a name="infoList"> 个体户信息列表 </a>**
[返回到目录](#menu)
#### 参数格式 `JSON`
#### HTTP请求方式 `POST`
``` javascript
{
"action_process": "test",
"action_type": "businessmenInfoPage",
"action_body": {
"currentPage": "1",
"pageSize": "5",
"orderId": "",
"status": ""
}
}
```
#### 返回结果
```javascript
{
"status": 0,
"msg": "success",
"data": {
"count": 1,
"rows": [
{
"id": "12795594625000138", // 个体户id
"order_id": "13180532689003786", // 订单号
"legalName": "杨庆菊", // 法人姓名
"creditCode": "xxxxxx333333333", // 统一社会信用代码
"status": "1120", // 状态
"statusName": "已签约" // 状态名称
}
]
},
"requestid": "a9b76b92be69452e9403637447c08659"
}
```
<a name="menu">目录</a>
1. [新增订单](#add)
1. [全部订单](#allList)
1. [订单分配](#assign)
1. [订单信息](#info)
1. [订单编辑](#edit)
1. [我的订单-pc](#pc-myorders)
## **<a name="add"> 新增订单</a>**
[返回到目录](#menu)
#### 参数格式 `JSON`
#### HTTP请求方式 `POST`
``` javascript
{
"action_process": "test",
"action_type": "addOrder",
"action_body": {
"merchantId": "11064622752480048", // 商户id
"channelOrderNo": "xxxxxxxxx111", // 渠道订单号
"legalName": "杨庆菊", // 法人姓名
"legalMobile": "杨庆菊手机号", // 法人手机号
"legalImg": "法人照片", // 法人照皮那
"idcard": "123身份证", // 身份证
"idcardFront": "在正面", // 身份证正面照
"idcardBack": "反面", // 身份证反面照
"bankNo": "2222", // 银行卡号
"bank": "开户行", // 开户行
"bankImg": "这是银行卡照片", // 银行卡照片
"names": " ", // 姓名
"capital": "到底是多少" // 注册资金
"domicile_id":"" // 注册地id
"domicileName":"" // 注册地名称
"businessScope_id": "1221812759600065", // 经营范围id
"businessType": "太难了", // 经营范围
"businessScope": "太狠了", // 经营范围详情
}
}
```
#### 返回结果
```javascript
{
"status": 0,
"msg": "success",
"data": {
"id": "13180527789003380", // id
"price": 300000,
"status": "1000",
"channelOrderNo": "xxxxxxxxx111",
"legalName": "杨庆菊",
"legalMobile": "杨庆菊手机号",
"legalImg": "法人照片",
"idcard": "123身份证",
"idcardFront": "在正面",
"idcardBack": "反面",
"bankNo": "2222",
"bank": "开户行",
"bankImg": "这是银行卡照片",
"names": "山驴比1,山驴比2,山驴比3",
"capital": "到底是多少",
"domicile_id":"" // 注册地id
"domicileName":"" // 注册地名称
"businessScope_id": "12218127596000645",
"businessType": "太难了",
"businessScope": "太狠了",
},
"requestid": "7052de8f85684245b05067521a695e84"
}
```
## **<a name="assign"> 订单分配</a>**
[返回到目录](#menu)
#### 参数格式 `JSON`
#### HTTP请求方式 `POST`
``` javascript
{
"action`_process": "test",
"action_type": "orderAssign",
"action_body": {
"id": "13180532689003786", // 订单id
"deliverId": "13120681466000118", // 交付商id
"deliverName": "杨庆菊交付商222", // 交付商名称
"assignUcname": "杨庆菊", // 分配人
"deliverDivide": 3311 // 交付商分成比例
}
}
```
#### 返回结果
```javascript
{
"status": 0,
"msg": "success",
"data": "",
"requestid": "721e93dbdfb54115a76bf32a4900cd6e"
}
```
## **<a name="allList"> 全部订单</a>**
[返回到目录](#menu)
#### 参数格式 `JSON`
#### HTTP请求方式 `POST`
``` javascript
{
"action_process": "test",
"action_type": "allOrderList",
"action_body": {
"currentPage": "1",
"pageSize": "5",
"merchantId": "", // 商户id
"orderId": "", // 订单id
"status": "", // 订单状态 1000未付款, 1010待处理, 1020执照办理中, 1030已出执照, 1040刻章办理中, 1050已刻章,
// 1060银行开户中, 1070银行已开户, 1080税务报道中, 1090已税务报道, 1100已完成
"createdBegin": "", // 创建时间开始
"createdEnd": "", // 创建时间结束
"assignBegin": "", // 分配时间开始
"assignEnd": "", // 分配时间结束
}
}
```
#### 返回结果
```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": "反面", // 身份证反面图
"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": "", // 交付类型
"deliverNo": "", //
"deliverImg": "", //
"deliver": { // 交付商
"statusName": "待处理" // 办理状态名称
"status": "1020", // 办理状态
"deliverName": "开封交付商", // 交付商名称
"deliverDivide": 3311, // 交付商分成比例
}
},
...
]
},
"requestid": "ae2a9c2e2ff6497e8cc9fd2c7fac9fe8"
}
```
## **<a name="info"> 订单信息</a>**
[返回到目录](#menu)
#### 参数格式 `JSON`
#### HTTP请求方式 `POST`
``` javascript
{
"action_process": "test",
"action_type": "orderInfo",
"action_body": {
"id": "13180527789003380"
}
}
```
#### 返回结果
```javascript
{
"status": 0,
"msg": "success",
"data": {
"id": "13180527789003380", // 订单号\订单号
"merchant_id": "11064622752480048", // 商户id
"channelOrderNo": "xxxxxxxxx111", // 渠道订单号
"price": 300000, // 订单价格(分)
"price_y": "3000", // 订单价格(元)
"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", // 订单状态
"assignTime": null, // 分配时间
"created_at": "2019-10-05 06:57:28", // 创建时间
},
"requestid": "721e93dbdfb54115a76bf32a4900cd6e"
}
```
## **<a name="edit"> 订单编辑</a>**
[返回到目录](#menu)
#### 接口说明 该接口只编辑商户id和订单价格,(商户id随时可编辑),(订单价格只有在 1000未付款状态时可编辑)
#### 参数格式 `JSON`
#### HTTP请求方式 `POST`
``` javascript
{
"action_process": "test",
"action_type": "orderAssign",
"action_body": {
"id": "13180532689003786",
"deliverId": "13120681466000118",
"deliverName": "杨庆菊交付商222",
"deliverDivide": 3311
}
}
```
#### 返回结果
```javascript
{
"status": 0,
"msg": "success",
"data": {
"id": "13180527789003380", // 订单号\订单号
"merchant_id": "11064622752480048", // 商户id
"channelOrderNo": "xxxxxxxxx111", // 渠道订单号
"price": 300000, // 订单价格(分)
"price_y": "3000", // 订单价格(元)
"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", // 订单状态
"assignTime": null, // 分配时间
"created_at": "2019-10-05 06:57:28", // 创建时间
},
"requestid": "721e93dbdfb54115a76bf32a4900cd6e"
}
```
## **<a name="pc-myorders"> 我的订单-pc</a>**
[返回到目录](#menu)
#### 参数格式 `JSON`
#### HTTP请求方式 `POST`
``` javascript
{
"action_process": "test",
"action_type": "myOrderPage",
"action_body": {
"currentPage": "1",
"pageSize": "5",
"userId": "", // 用户id
"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": "反面", // 身份证反面图
"bankNo": "2222", // 银行卡号
"bank": "开户行", // 开户行
"bankImg": "这是银行卡照片", // 银行卡照片
"names": "山驴比1,山驴比2,山驴比3", // 2~3个注册名称,逗号分割
"domicile_id":"" // 注册地id
"domicileName":"" // 注册地名称
"domicile_id":"" // 注册地id
"domicileName":"" // 注册地名称
"businessScope_id": "12218127596000645", // 经营范围id
"businessType": "太难了", // 经营范围
"businessScope": "太狠了", // 经营范围详情
"capital": "到底是多少", // 注册资本
"statusName": "未付款", // 订单状态名称
"status": "1000", // 订单状态
"assignTime": null, // 分配时间
"created_at": "2019-10-05 06:57:28", // 创建时间
},
...domicile_id
]
},
"requestid": "ae2a9c2e2ff6497e8cc9fd2c7fac9fe8"
}
```
\ No newline at end of file
<a name="menu">目录</a>
1. [订单办理](#list)
1. [新建进度](#newStatus)
1. [订单办理查询](#info)
1. [订单办理编辑](#edit)
## **<a name="list"> 订单办理</a>**
[返回到目录](#menu)
#### 参数格式 `JSON`
#### HTTP请求方式 `POST`
``` javascript
{
"action_process": "test",
"action_type": "addOrder",
"action_body": {
"merchantId": "11064622752480048", // 商户id
"channelOrderNo": "xxxxxxxxx111", // 渠道订单号
"legalName": "杨庆菊", // 法人姓名
"legalMobile": "杨庆菊手机号", // 法人手机号
"legalImg": "法人照片", // 法人照皮那
"idcard": "123身份证", // 身份证
"idcardFront": "在正面", // 身份证正面照
"idcardBack": "反面", // 身份证反面照
"bankNo": "2222", // 银行卡号
"bank": "开户行", // 开户行
"bankImg": "这是银行卡照片", // 银行卡照片
"names": "山驴比1,山驴比2,山驴比3", // 姓名
"capital": "到底是多少" // 注册资金
"businessScope_id": "1221812759600065", // 经营范围id
"businessType": "太难了", // 经营范围
"businessScope": "太狠了", // 经营范围详情
}
}
```
#### 返回结果
```javascript
{
"status": 0,
"msg": "success",
"data": {
"count": 16,
"rows": [
{
"id": "12113463373001693", // 办理id
"order_id": "13180532598003688", // 订单id
"status": "1020", // 订单状态
"statusName": "执照办理11", // 订单状态名称
"nextStatus": "1030", // 订单下一个状态
"nextStatusName": "已出执照", // 订单下一个状态名称
"deliver_id": "13120681466000118", // 交付商id
"deliverName": "杨庆菊交付商222", // 交付商名称
"deliverDivide": 3311, // 交付商分成(分)
"deliverDivide_y": "33.11", // 交付商分成(元)
"breakReason": null, // 终止原因
"created_at": "2019-10-05 09:47:10", // 创建时间
"order": { // 交付商关联的订单
"id": "13180532598003688", // 订单id
"merchantId": "11064622752480048", // 商户id
"channelOrderNo": "xxxxxxxxx111", // 渠道订单号
"legalName": "杨庆菊", // 法人姓名
"legalMobile": "杨庆菊手机号", // 法人手机号
"legalImg": "法人照片", // 法人照皮那
"idcard": "123身份证", // 身份证
"idcardFront": "在正面", // 身份证正面照
"idcardBack": "反面", // 身份证反面照
"bankNo": "2222", // 银行卡号
"bank": "开户行", // 开户行
"bankImg": "这是银行卡照片", // 银行卡照片
"names": "山驴比1,山驴比2,山驴比3", // 姓名
"capital": "到底是多少" // 注册资金
"businessScope_id": "1221812759600065", // 经营范围id
"businessType": "太难了", // 经营范围
"businessScope": "太狠了", // 经营范围详情
}
},
]
},
"requestid": "6ae7c9592fbe41beae1ed68a15d9ca92"
}
```
## **<a name="newStatus"> 新建进度 </a>**
[返回到目录](#menu)
#### 参数格式 `JSON`
#### HTTP请求方式 `POST`
``` javascript
{
"action_process": "test",
"action_type": "addOrder",
"action_body": {
// 公共变量,所有情况都需要传
"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",
}
```
## **<a name="info"> 订单办理查询 </a>**
[返回到目录](#menu)
#### 参数格式 `JSON`
#### HTTP请求方式 `POST`
``` javascript
{
"action_process": "test",
"action_type": "orderDeliverInfo",
"action_body": {
"id": "12113458131000120" // 订单办理id
}
}
```
#### 返回结果
```javascript
{
"status": 0,
"msg": "success",
"data": {
// 订单办理信息
"deliverOrder": {
"id": "12113463373001693", // 办理id
"order_id": "13180532598003688", // 订单id
"status": "1020", // 订单状态
"statusName": "执照办理11", // 订单状态名称
"nextStatus": "1030", // 订单下一个状态
"nextStatusName": "已出执照", // 订单下一个状态名称
"deliver_id": "13120681466000118", // 交付商id
"deliverName": "杨庆菊交付商222", // 交付商名称
"deliverDivide": 3311, // 交付商分成(分)
"deliverDivide_y": "33.11", // 交付商分成(元)
"breakReason": null, // 终止原因
"created_at": "2019-10-05 09:47:10", // 创建时间
},
// 订单信息
"order": {
"id": "13180527789003380", // 订单号\订单号
"merchant_id": "11064622752480048", // 商户id
"channelOrderNo": "xxxxxxxxx111", // 渠道订单号
"price": 300000, // 订单价格(分)
"price_y": "3000", // 订单价格(元)
"legalName": "杨庆菊", // 法人姓名
"legalMobile": "杨庆菊手机号", // 法人手机号
"legalImg": "法人照片", // 法人照片
"idcard": "123身份证", // 身份证号码
"idcardFront": "在正面", // 身份证正面图
"idcardBack": "反面", // 身份证反面图
"bankNo": "2222", // 银行卡号
"bank": "开户行", // 开户行
"bankImg": "这是银行卡照片", // 银行卡照片
"names": "山驴比1,山驴比2,山驴比3", // 2~3个注册名称,逗号分割
"businessScope_id": "12218127596000645", // 经营范围id
"businessType": "太难了", // 经营范围
"businessScope": "太狠了", // 经营范围详情
"capital": "到底是多少", // 注册资本
"statusName": "未付款", // 订单状态名称
"status": "1000", // 订单状态
"assignTime": null, // 分配时间
"created_at": "2019-10-05 06:57:28", // 创建时间
},
// 个体工商户信息
"businessmen": {
"id": "12795594625000138", // 个体户id
"order_id": "13180532689003786", // 订单编号
"channelOrderNo": "xxxxxxxxx116", // 渠道订单那好
"status": "1100", // 个体户状态
"statusName": "待签约", // 个体户状态名称
// 个体工商户执照信息
"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": "快递交接图片", // 快递交接图片
"created_at": "2019-10-06 07:19:07",
"updated_at": "2019-10-06 07:38:57"
}
},
"requestid": "ce549dd87309421e94db1d50df06086d"
}
```
## **<a name="edit"> 订单办理编辑 </a>**
[返回到目录](#menu)
#### 参数格式 `JSON`
#### HTTP请求方式 `POST`
``` javascript
{
"action_process": "test",
"action_type": "addOrder",
"action_body": {
// 订单对象
"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",
}
```
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