Commit f862b48d by 赵庆

gsb

parent 1d5afa98
......@@ -42,7 +42,7 @@ class MerchantCtl extends CtlBase {
}
}
//统计商户报表
async commercialCount(){
async commercialCount(qobj){
var params = qobj || {};
try {
var page = await this.service.commercialCount(params);
......@@ -52,8 +52,8 @@ class MerchantCtl extends CtlBase {
return system.getErrResult2("您的网络不稳, 请稍后重试");
}
}
async commercialList(){
//统计商户报表 详情
async commercialList(qobj){
var params = qobj || {};
try {
var page = await this.service.commercialList(params);
......
......@@ -10,6 +10,12 @@ class MerchantService extends ServiceBase {
this.recruitDao = system.getObject("db.all.recruitDao");
this.taxinfoDao = system.getObject("db.all.taxinfoDao");
this.transactioninDao = system.getObject("db.all.transactioninDao");
this.recruitSve = system.getObject("service.all.recruitSve");
this.electroniccontractSve = system.getObject("service.all.electroniccontractSve");
this.loadSve = system.getObject("service.all.loadSve");
this.taxinfoSve = system.getObject("service.all.taxinfoSve");
this.transactioninSve = system.getObject("service.all.transactioninSve");
}
async signPage(params) {
......@@ -180,18 +186,50 @@ class MerchantService extends ServiceBase {
}
async commercialList(params){
var result = [];
var currentPage = Number(params.currentPage || 1);
var pageSize = Number(params.pageSize || 10);
var sql = "";
var db = "";
var firlt = "";
var page = {};
if(params.type == 1){ //招工
db = "recruit_info";
firlt = "publish_date"
page = await this.recruitSve.signPage(params);
}else if(params.type == 2){//电子签约
db = "electronic_contract_info";
firlt = "completed_date";
page = await this.electroniccontractSve.signPage(params);
}else if(params.type == 3){//工作量
db = "load_info";
firlt = "affirm_time";
page = await this.loadSve.signPage(params);
}else if(params.type == 4){//交易
db = "transaction_info";
firlt = "transaction_time";
page = await this.transactioninSve.signPage(params);
}else {//完税
db = "tax_info";
firlt = "tax_time";
page = await this.taxinfoSve.signPage(params);
}
var sql = "SELECT DATE_FORMAT("+firlt+",'%Y-%m-%d') days,COUNT(id) COUNT FROM "+db+" WHERE 1=1";
if (params.company_name) {
sql = sql + " ANN company_name = " + params.company_name;
}
if (params.sign_body) {
sql = sql + " AND sign_body = " + params.sign_body;
}
var charts = [[],[]];
var chart = await this.customQuery(sql);
for(let i=0;i< chart.length;i++){
charts[0].push(chart[i].days)
charts[1].push(chart[i].COUNT)
}
page.charts = charts;
return page;
}
......
......@@ -5,37 +5,37 @@ var userCtl = system.getObject("web.auth.userCtl");
const redisClient = system.getObject("util.redisClient");
module.exports = function (app) {
app.all("/web/*", async function (req, res, next) {
let bpostatsid = req.headers["bpostatsid"] || "";
jsonUser = await redisClient.get(bpostatsid);
if (jsonUser) {
jsonUser = JSON.parse(jsonUser);
}
if (req.url.indexOf("auth/userCtl/login") > 0 ||
req.url.indexOf("auth/userCtl/register") > 0 ||
req.url.indexOf("getRsConfig") > 0) {
if (jsonUser) {
req.loginUser = jsonUser;
} else {
req.loginUser = null;
}
return next();
}
if (!jsonUser) {
res.end(JSON.stringify({status: -99, msg: "no login"}));
return;
}
if (bpostatsid) {
redisClient.setWithEx(bpostatsid, JSON.stringify(jsonUser), 60 * 60 * 60);
}
req.loginUser = jsonUser;
next();
});
// app.all("/web/*", async function (req, res, next) {
// let bpostatsid = req.headers["bpostatsid"] || "";
// jsonUser = await redisClient.get(bpostatsid);
// if (jsonUser) {
// jsonUser = JSON.parse(jsonUser);
// }
//
// if (req.url.indexOf("auth/userCtl/login") > 0 ||
// req.url.indexOf("auth/userCtl/register") > 0 ||
// req.url.indexOf("getRsConfig") > 0) {
//
// if (jsonUser) {
// req.loginUser = jsonUser;
// } else {
// req.loginUser = null;
// }
// return next();
// }
//
// if (!jsonUser) {
// res.end(JSON.stringify({status: -99, msg: "no login"}));
// return;
// }
//
// if (bpostatsid) {
// redisClient.setWithEx(bpostatsid, JSON.stringify(jsonUser), 60 * 60 * 60);
// }
//
// req.loginUser = jsonUser;
// next();
// });
app.get("/", async function (req, res) {
res.render("index", {appinfo: null, app: null});
......
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