Commit 1292d3ce by zhaoxiqing

gsb

parent 06c05ef8
......@@ -10,6 +10,8 @@ class ActionAPI extends APIBase {
this.iproductSve = system.getObject("service.product.iproductSve");
this.iprocessSve = system.getObject("service.product.iprocessSve");
this.saasinvoiceSve = system.getObject("service.invoice.saasinvoiceSve")
}
/**
* 接口跳转
......@@ -54,6 +56,11 @@ class ActionAPI extends APIBase {
case "uploadDetail": // 查询发票详细信息
opResult = await this.iinvoiceSve.uploadDetailSve(action_body);
break;
case "saasinvoicePage" : //发票列表
opResult = await this.saasinvoiceSve.saasinvoicePage(action_body);
break;
// case "verificationAndCalculation": // 发票试算接口
// opResult = await rule.dispatcher(action_body);
// break;
......@@ -76,7 +83,7 @@ class ActionAPI extends APIBase {
// case "apiCancelInvoice": // 发票申请单撤回
// opResult = await this.applySve.apiCancelInvoice(action_body);
// break;
// case "queryApplyInvoices": // 发票申请列表(平台)
// opResult = await this.applySve.apiQueryApplyInvoices(action_body);
// break;
......@@ -113,13 +120,13 @@ class ActionAPI extends APIBase {
// case "statDeliverData": //交付商业务概览
// opResult = await this.delivererSve.apiStatDeliverData(action_body);
// break;
// case "delivererApplyInvoices": //发票申请列表(交付商)
// opResult = await this.delivererSve.apiDelivererApplyInvoices(action_body);
// break;
// case "delivererInvoices": //发票列表(交付商)
// opResult = await this.delivererSve.apiDelInvs(action_body);
// break;
// break;
// case "queryInvoiceDeliverer": // 发票明细(交付商)
// opResult = await this.delivererSve.apiQueryInvoiceDeliverer(action_body);
// break;
......@@ -135,7 +142,7 @@ class ActionAPI extends APIBase {
// case "delStatBusinessData": //发票办理(交付商)
// opResult = await this.delivererSve.apiDelStatBusinessData(action_body);
// break;
case "test": // 查询业务进度
opResult = await this.iinvoiceSve.buildProcess(action_body);
break;
......@@ -197,4 +204,4 @@ class ActionAPI extends APIBase {
];
}
}
module.exports = ActionAPI;
\ No newline at end of file
module.exports = ActionAPI;
const system = require("../../../system");
const Dao = require("../../dao.base");
class SaasinvoiceDao extends Dao {
constructor() {
super(Dao.getModelName(SaasinvoiceDao));
}
async countByParams(params) {
var sql = [];
sql.push("SELECT COUNT(1) as total FROM saas_invoice t1 WHERE 1 = 1");
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 * FROM saas_invoice t1 WHERE 1 = 1 ");
this.setCondition(params, sql);
sql.push("ORDER BY t1.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) {
sql.push("AND t1.`saas_merchant_id` = :saas_merchant_id");
if (params.apply_no) {
sql.push("AND t1.`apply_no` = :apply_no");
}
if (params.invoice_no) {
sql.push("AND t1.`invoice_no` = :invoice_no");
}
if (params.from_name) {
sql.push("AND t1.`from_name` = :from_name");
}
if (params.begin_time) {
sql.push("AND t1.`created_at` >= :begin_time");
}
if (params.end_time) {
sql.push("AND t1.`created_at` <= :end_time");
}
};
}
module.exports = SaasinvoiceDao;
/* jshint indent: 2 */
module.exports = function (sequelize, DataTypes) {
return sequelize.define('saasinvoice', {
id: {
type: DataTypes.STRING(32),
allowNull: false,
primaryKey: true
},
saas_id: {
type: DataTypes.STRING(32),
allowNull: true
},
saas_merchant_id: {
type: DataTypes.STRING(32),
allowNull: true,
defaultValue: ''
},
batch_no: {
type: DataTypes.STRING(32),
allowNull: true
},
owner_type: {
type: DataTypes.STRING(4),
allowNull: true,
defaultValue: '00'
},
fee_type: {
type: DataTypes.STRING(2),
allowNull: true,
defaultValue: ''
},
invoice_type: {
type: DataTypes.STRING(4),
allowNull: true
},
province: {
type: DataTypes.STRING(10),
allowNull: true
},
invoice_join: {
type: DataTypes.STRING(4),
allowNull: true
},
invoice_no: {
type: DataTypes.STRING(20),
allowNull: true
},
invoice_number: {
type: DataTypes.STRING(20),
allowNull: true
},
invoice_time: {
type: DataTypes.DATE,
allowNull: true
},
invoice_amount: {
type: DataTypes.BIGINT,
allowNull: true
},
sve_invoice_id: {
type: DataTypes.STRING(32),
allowNull: true,
defaultValue: ''
},
apply_no: {
type: DataTypes.STRING(32),
allowNull: true
},
from_name: {
type: DataTypes.STRING(45),
allowNull: false
},
from_credit_code: {
type: DataTypes.STRING(45),
allowNull: false
},
from_addr: {
type: DataTypes.STRING(45),
allowNull: false
},
from_mobile: {
type: DataTypes.STRING(45),
allowNull: false
},
from_bank: {
type: DataTypes.STRING(45),
allowNull: false
},
from_account: {
type: DataTypes.STRING(45),
allowNull: false
},
to_name: {
type: DataTypes.STRING(45),
allowNull: false
},
to_credit_code: {
type: DataTypes.STRING(45),
allowNull: false
},
to_addr: {
type: DataTypes.STRING(45),
allowNull: false
},
to_mobile: {
type: DataTypes.STRING(45),
allowNull: false
},
to_bank: {
type: DataTypes.STRING(45),
allowNull: false
},
to_account: {
type: DataTypes.STRING(45),
allowNull: false
},
mail_to: {
type: DataTypes.STRING(45),
allowNull: true
},
mail_mobile: {
type: DataTypes.STRING(20),
allowNull: true
},
mail_addr: {
type: DataTypes.STRING(200),
allowNull: true
},
personal_invoice_tax: {
type: DataTypes.INTEGER(11),
allowNull: true
},
additional_tax: {
type: DataTypes.BIGINT,
allowNull: true
},
value_added_tax: {
type: DataTypes.BIGINT,
allowNull: true
},
service_tax: {
type: DataTypes.BIGINT,
allowNull: true
},
summary: {
type: DataTypes.TEXT,
allowNull: true
},
created_at: {
type: DataTypes.DATE,
allowNull: false,
defaultValue: DataTypes.NOW
},
updated_at: {
type: DataTypes.DATE,
allowNull: false,
defaultValue: DataTypes.NOW
},
deleted_at: {
type: DataTypes.DATE,
allowNull: true
}
}, {
timestamps: false,
paranoid: true,
version: true,
tableName: 'saas_invoice',
comment: '发票列表(商户)',
});
};
const ServiceBase = require("../../sve.base");
const system = require("../../../system");
const moment = require('moment');
/**
* 平台提交的信息
*/
class SaasinvoiceService extends ServiceBase {
constructor() {
super("invoice", ServiceBase.getDaoName(SaasinvoiceService));
}
async saasinvoicePage(params) {
params.currentPage = Number(params.currentPage || 1);
params.pageSize = Number(params.pageSize || 10);
params.startRow = Number((params.currentPage - 1) * params.pageSize);
let total = await this.dao.countByParams(params);
if (total == 0) {
return system.getResult({count: 0, rows: []});
}
let list = await this.dao.pageByParams(params);
if (list) {
for (var item of list) {
this.handleDate(item, ['updated_at', 'created_at'], 'YYYY-MM-DD HH:mm:ss');
this.handleDate(item, ['invoice_time'], 'YYYY-MM-DD');
}
}
return system.getResultSuccess({count: total, rows: list});
}
}
module.exports = SaasinvoiceService;
This source diff could not be displayed because it is too large. You can view the blob instead.
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