Commit e02e387c by 赵庆

薪比果接口

parent 7f5b74a2
...@@ -9,5 +9,36 @@ class ApiBase{ ...@@ -9,5 +9,36 @@ class ApiBase{
return system.getResult2(null,null,"ok","请检查您的授权KEY"); return system.getResult2(null,null,"ok","请检查您的授权KEY");
} }
} }
doTimeCondition(params, fields) {
if (!params || !fields || fields.length == 0) {
return;
}
for (var f of fields) {
if (params[f]) {
var suffix = this.endWith(f, 'Begin') ? " 00:00:00" : " 23:59:59";
params[f] = params[f] + suffix;
}
}
}
trim(o) {
if(!o) {
return "";
}
return o.toString().trim();
}
getSettleParams(search) {
var params = search || {};
if (this.trim(params.createBegin)) {
params.createBegin = this.trim(params.createBegin) + " 00:00:00";
}
if (this.trim(params.createEnd)) {
params.createEnd = this.trim(params.createEnd) + " 23:59:59";
}
return params;
}
} }
module.exports=ApiBase; module.exports=ApiBase;
var system = require("../../system");
const apiBase = require("../api.base");
class XbgApi extends apiBase{
constructor() {
super();
this.utilesignbaoSve = system.getObject("service.utilesignbaoSve");
this.etemplateSve = system.getObject("service.etemplateSve");
this.ecompanySve = system.getObject("service.ecompanySve");
this.econtractSve = system.getObject("service.econtractSve");
this.esettleSve = system.getObject("service.esettleSve")
}
//合同模板
async etemplateList(qobj) {
try {
var params = qobj || {};
var ecompanyId = params.ecompany_id;
if (ecompanyId.length > 1) {
params.ecompanyIds = ecompanyId;
delete params.ecompany_id;
} else {
params.ecompanyIds = [ecompanyId];
delete params.ecompany_id;
}
var page = await this.etemplateSve.signPage(params);
return system.getResult2(page);
} catch (e) {
console.log(e);
return system.getErrResult2("接口异常");
}
}
//已签合同
async acontractList(qobj) {
try {
var params = qobj || {};
var ecompanyId = params.ecompany_id;
if (ecompanyId.length > 1) {
params.ecompanyIds = [ecompanyId];
delete params.ecompany_id;
} else {
params.ecompanyIds = ecompanyId;
delete params.ecompany_id;
}
params.eflowstatusList = ['2'];
this.doTimeCondition(params, ["signBegin", "signEnd"]);
var page = await this.econtractSve.pageByCondition(params);
return system.getResult2(page);
} catch (e) {
console.log(e);
return system.getErrResult2("接口异常");
}
}
//纳税人人员
async ratepayingListToPe(qobj) {
try {
var params = qobj || {};
var params = this.getSettleParams(params);
var page = await this.esettleSve.ratepayingToPe(params);
return system.getResult2(page);
} catch (e) {
console.log(e);
return system.getErrResult2("接口异常");
}
}
//纳税人按月
async ratepayingListToMonth(qobj) {
try {
var params = qobj || {};
var params = this.getSettleParams(params);
var page = await this.esettleSve.ratepayingToMonth(params);
return system.getResult2(page);
} catch (e) {
console.log(e);
return system.getErrResult2("接口异常");
}
}
//纳税人个人详情
async ratepayingListToOne(qobj) {
try {
var params = qobj || {};
var params = this.getSettleParams(params);
var page = await this.esettleSve.ratepayingToOne(params);
return system.getResult2(page);
} catch (e) {
console.log(e);
return system.getErrResult2("接口异常");
}
}
//数据概览
async dataOverview(qobj){
try {
var params = qobj || {};
var ecompanyId = params.ecompany_id;
if (ecompanyId.length > 1) {
params.ecompanyIds = [ecompanyId];
delete params.ecompany_id;
} else {
params.ecompanyIds = ecompanyId;
delete params.ecompany_id;
}
var result = {};
result.contractCount = await this.econtractSve.getCount(params);
var list = await this.esettleSve.getPays(params);
result.actual_amt = list.actual_amt;
result.income_tax = list.income_tax;
return system.getResult2(result);
}catch (e) {
console.log(e);
return system.getErrResult2("接口异常");
}
}
}
module.exports = XbgApi;
\ No newline at end of file
...@@ -220,7 +220,7 @@ class EsettleCtl extends CtlBase { ...@@ -220,7 +220,7 @@ class EsettleCtl extends CtlBase {
} }
var params = this.getSettleParams(params); var params = this.getSettleParams(params);
var page = await this.service.settlePage(params); var page = await this.service.ratepayingList(params);
return system.getResult2(page); return system.getResult2(page);
} catch (e) { } catch (e) {
console.log(e); console.log(e);
......
...@@ -286,6 +286,17 @@ class EcontractService extends ServiceBase { ...@@ -286,6 +286,17 @@ class EcontractService extends ServiceBase {
return resultAll; return resultAll;
} }
async getCount(params){
var where = {};
if (params.ecompanyIds) {
where.ecompany_id = {
[this.db.Op.in]: params.ecompanyIds
};
}
let contractCount = await this.findCount(where);
return contractCount
}
async pageByCondition(params) { async pageByCondition(params) {
var currentPage = Number(params.currentPage || 0); var currentPage = Number(params.currentPage || 0);
var pageSize = Number(params.pageSize || 10); var pageSize = Number(params.pageSize || 10);
...@@ -708,7 +719,6 @@ class EcontractService extends ServiceBase { ...@@ -708,7 +719,6 @@ class EcontractService extends ServiceBase {
"contractName": item.name, "contractName": item.name,
"companyName": company.name, "companyName": company.name,
"statusName": item.eflowstatusname, "statusName": item.eflowstatusname,
"mobile": item.mobile,
"userName": item.userName, "userName": item.userName,
"mobile": item.mobile, "mobile": item.mobile,
"idCard": item.personsSign.toUpperCase(), "idCard": item.personsSign.toUpperCase(),
......
...@@ -100,7 +100,7 @@ class ServiceBase{ ...@@ -100,7 +100,7 @@ class ServiceBase{
} else { } else {
row[field] = moment(row[field]).format(pattern); row[field] = moment(row[field]).format(pattern);
} }
} }
} }
} }
...@@ -131,5 +131,12 @@ class ServiceBase{ ...@@ -131,5 +131,12 @@ class ServiceBase{
} }
return o.toString().trim(); return o.toString().trim();
} }
addmonth(params) {
if (this.trim(params.month)) {
params.createBegin = moment(params.month).format("YYYY-MM-DD") + " 00:00:00";
params.createEnd = moment(params.month).add(1, "months").subtract(1, 'days').format("YYYY-MM-DD") + " 23:59:59";
}
}
} }
module.exports=ServiceBase; module.exports=ServiceBase;
...@@ -3,15 +3,15 @@ var settings = { ...@@ -3,15 +3,15 @@ var settings = {
host: "43.247.184.32", host: "43.247.184.32",
port: 8967, port: 8967,
password: "Gongsibao2018", password: "Gongsibao2018",
db:10, db:11,
}, },
database: { database: {
dbname: "bpo", dbname: "bpo",
user: "root", user: "write",
password: "123456", password: "write",
config: { config: {
host: '43.247.184.35', host: '192.168.18.237',
port: 8899, port: 3306,
dialect: 'mysql', dialect: 'mysql',
operatorsAliases: false, operatorsAliases: false,
pool: { pool: {
......
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