销售总统计查询数据和正式环境对比调试, 客户销售统计列表查询数据和正式环境对比调试,客户对账统计表和正式环境数据对比调试,
parent
abeb21fa6f
commit
9ee7bca346
|
|
@ -1,8 +1,8 @@
|
|||
package com.cowr.model.base;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import com.cowr.common.base.BaseModel;
|
||||
import com.jfinal.plugin.activerecord.IBean;
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
|
||||
/**
|
||||
* Generated by COWR Fri Apr 17 16:59:35 CST 2020
|
||||
|
|
@ -265,5 +265,27 @@ public abstract class BaseSysuser<M extends BaseSysuser<M>> extends BaseModel<M>
|
|||
return getInt("del");
|
||||
}
|
||||
|
||||
/**
|
||||
* name: last_online_time
|
||||
* type: Date
|
||||
* isNullable: NO
|
||||
* isPrimaryKey: NO
|
||||
* defaultValue: 0
|
||||
*
|
||||
* @param lastOnlineTime 最后在线时间
|
||||
*/
|
||||
@JSONField(name="last_online_time")
|
||||
public void setLastOnlineTime(java.util.Date lastOnlineTime) {
|
||||
set("last_online_time", lastOnlineTime);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return create_time 最后在线时间
|
||||
*/
|
||||
@JSONField(name="last_online_time")
|
||||
public java.util.Date getLastOnlineTime() {
|
||||
return get("last_online_time");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ import com.jfinal.plugin.activerecord.Record;
|
|||
import org.apache.poi.ss.usermodel.*;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
|
@ -463,23 +464,28 @@ public class OrderTempService extends BaseService {
|
|||
paraList.add(tm + STM_SUFFIX);
|
||||
paraList.add(tm + ETM_SUFFIX);
|
||||
}
|
||||
else{
|
||||
findSql = " AND CREATE_TIME < ? \n";
|
||||
paraList.add(LocalDate.now() + STM_SUFFIX);
|
||||
}
|
||||
|
||||
String sql = "SELECT\n" +
|
||||
"CUSTOMER_ID,\n" +
|
||||
"ifnull(CUSTOMER_ID, -1 ) CUSTOMER_ID,\n" +
|
||||
"DATE_FORMAT( CREATE_TIME, '%Y-%m-%d' ) DATE,\n" +
|
||||
"SUPERMARKET_ID,\n" +
|
||||
"SUM( WEIGHT ) WEIGHT,\n" +
|
||||
"SUM( TOTAL_PRICE ) TOTAL_PRICE,\n" +
|
||||
"SALE_TYPE,\n" +
|
||||
"COUNT( SN ) COUNT \n" +
|
||||
"ifnull(COUNT( SN ), 0 ) COUNT \n" +
|
||||
"FROM\n" +
|
||||
"ORDER_TEMP \n" +
|
||||
"WHERE CUSTOMER_ID > -1\n" +
|
||||
"AND SUPERMARKET_ID > -1\n" +
|
||||
"AND WEIGHT > -1\n" +
|
||||
"AND TOTAL_PRICE > -1 \n" +
|
||||
"AND SALE_TYPE > -1\n" +
|
||||
"AND STATE = 5 \n" +
|
||||
"WHERE STATE = 5 " +
|
||||
// "STOMER_ID > -1\n" +
|
||||
// "AND SUPERMARKET_ID > -1\n" +
|
||||
// "AND WEIGHT > -1\n" +
|
||||
// "AND TOTAL_PRICE > -1 \n" +
|
||||
// "AND SALE_TYPE > -1\n" +
|
||||
// "AND STATE = 5 \n" +
|
||||
findSql +
|
||||
"GROUP BY\n" +
|
||||
"CUSTOMER_ID,\n" +
|
||||
|
|
|
|||
|
|
@ -179,7 +179,7 @@ group by date
|
|||
" select \n" +
|
||||
" ifnull(sum(t.weight), 0) total_weight,\n" +
|
||||
" ifnull(sum(t.total_price), 0) total_price,\n" +
|
||||
" ifnull(count(t.count), 0) truck_cnt,\n" +
|
||||
" ifnull(sum(t.count), 0) truck_cnt,\n" +
|
||||
" ifnull(sum(case when t.date >= ? and t.sale_type = 0 then t.weight end ), 0) year_total_weight,\n" +
|
||||
" ifnull(sum(case when t.date >= ? and t.sale_type = 0 then t.total_price end ), 0) year_total_price,\n" +
|
||||
" ifnull(sum(case when t.date >= ? and t.sale_type = 0 then t.count else 0 end ), 0) year_truck_cnt,\n" +
|
||||
|
|
@ -208,7 +208,7 @@ group by date
|
|||
" order_temp t \n" +
|
||||
" WHERE\n" +
|
||||
" t.state = 5 \n" +
|
||||
" AND t.create_time = ? " +
|
||||
" AND t.create_time >= ? " +
|
||||
" union\n" +
|
||||
" select \n" +
|
||||
" 0 total_weight,\n" +
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@ import java.time.LocalDate;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static com.cowr.common.utils.DateTimeUtil.ETM_SUFFIX;
|
||||
import static com.cowr.common.utils.DateTimeUtil.STM_SUFFIX;
|
||||
|
||||
public class CustomerStatService {
|
||||
|
|
@ -44,14 +43,13 @@ public class CustomerStatService {
|
|||
tempSql = " select t.customer_id,\n" +
|
||||
" sum(ifnull((case when t.sale_type = 0 THEN t.total_price END), 0)) sh_total_price,\n" +
|
||||
" sum(ifnull((case when t.sale_type = 0 THEN t.weight END), 0)) sh_total_weight,\n" +
|
||||
" sum(ifnull((case when t.sale_type = 0 THEN 1 END), 0)) sh_total_cnt,\n" +
|
||||
" sum(ifnull((case when t.sale_type = 0 THEN t.count END), 0)) sh_total_cnt,\n" +
|
||||
" sum(ifnull((case when t.sale_type = 1 THEN t.total_price END), 0)) yh_total_price,\n" +
|
||||
" sum(ifnull((case when t.sale_type = 1 THEN t.weight END), 0)) yh_total_weight,\n" +
|
||||
" sum(ifnull((case when t.sale_type = 1 THEN 1 END), 0)) yh_total_cnt \n" +
|
||||
" sum(ifnull((case when t.sale_type = 1 THEN t.count END), 0)) yh_total_cnt \n" +
|
||||
" from order_end t\n" +
|
||||
" where t.customer_id > -1\n" +
|
||||
" and t.date <= ? \n" +
|
||||
|
||||
customerSql +
|
||||
" group by t.customer_id\n";
|
||||
paraList.add(tm);
|
||||
|
|
@ -61,6 +59,7 @@ public class CustomerStatService {
|
|||
|
||||
// 如果是当天的就加上销售订单数据
|
||||
if (LocalDate.now().toString().equals(tm)){
|
||||
|
||||
tempSql += "UNION select t.customer_id,\n" +
|
||||
" sum(ifnull((case when t.sale_type = 0 THEN t.total_price END), 0)) sh_total_price,\n" +
|
||||
" sum(ifnull((case when t.sale_type = 0 THEN t.weight END), 0)) sh_total_weight,\n" +
|
||||
|
|
@ -71,18 +70,30 @@ public class CustomerStatService {
|
|||
" from order_temp t\n" +
|
||||
" where t.customer_id is not null\n" +
|
||||
" and t.create_time >= ? \n" +
|
||||
" and t.create_time <= ? \n" +
|
||||
" and t.state = 5\n" +
|
||||
customerSql +
|
||||
" group by t.customer_id\n";
|
||||
|
||||
|
||||
tempSql = "select t.customer_id,\n" +
|
||||
" sum(ifnull(t.sh_total_price, 0)) sh_total_price,\n" +
|
||||
" sum(ifnull(t.sh_total_weight, 0)) sh_total_weight,\n" +
|
||||
" sum(ifnull(t.sh_total_cnt, 0)) sh_total_cnt,\n" +
|
||||
" sum(ifnull(t.yh_total_price, 0)) yh_total_price,\n" +
|
||||
" sum(ifnull(t.yh_total_weight, 0)) yh_total_weight,\n" +
|
||||
" sum(ifnull(t.yh_total_cnt, 0)) yh_total_cnt \n" +
|
||||
" from (\n" +
|
||||
tempSql +
|
||||
") t" +
|
||||
" group by t.customer_id";
|
||||
|
||||
paraList.add(tm + STM_SUFFIX);
|
||||
paraList.add(tm + ETM_SUFFIX);
|
||||
if (customer_id != null) {
|
||||
paraList.add(customer_id);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
sql = "select \n" +
|
||||
" t.customer_id id,\n" +
|
||||
" c.`name`,\n" +
|
||||
|
|
|
|||
|
|
@ -9,10 +9,7 @@ import com.jfinal.aop.Invocation;
|
|||
import com.jfinal.core.Controller;
|
||||
import com.jfinal.log.Log;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
public class AuthInterceptor implements Interceptor {
|
||||
private static Log log = Log.getLog(AuthInterceptor.class);
|
||||
|
|
@ -107,6 +104,11 @@ public class AuthInterceptor implements Interceptor {
|
|||
return;
|
||||
}
|
||||
|
||||
int update = SysuserSyncService.me.updateOnlineTime(sysuser.getId());
|
||||
// 保存最后登录时间
|
||||
log.info("保存最后登录时间 %s", update);
|
||||
|
||||
|
||||
inv.invoke();
|
||||
// }
|
||||
} catch (Exception e) {
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ import com.jfinal.plugin.redis.Redis;
|
|||
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
|
|
@ -957,6 +958,16 @@ public class SysuserSyncService extends BaseSyncService {
|
|||
return Db.find("select * " + sqlbuf.toString(), paraList.toArray());
|
||||
}
|
||||
|
||||
// 获取最后时间较近的用户数量
|
||||
public Long getOnlineNumber() {
|
||||
return Db.queryColumn("select count(id) from sysuser where last_online_time >= NOW() - INTERVAL 30 MINUTE;");
|
||||
}
|
||||
|
||||
// 获取最后时间较近的用户数量
|
||||
public int updateOnlineTime(Integer id) {
|
||||
return Db.update("update `sysuser` set `last_online_time` = ? where `id` = ?", new Date(), id);
|
||||
}
|
||||
|
||||
public Result register(Sysuser sysuser, Customer customer, CustomerReceiver receiver) {
|
||||
if (sysuser.checkDuplicate("phone")) {
|
||||
return Result.failedstr("手机号 %s 已存在", sysuser.getPhone());
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
# mysql
|
||||
jdbcUrl=jdbc:mysql://rm-wz9wa070076b2uge2ro.mysql.rds.aliyuncs.com:3306/ssjy_xsx_service_dev?characterEncoding=utf8&useSSL=false&zeroDateTimeBehavior=convertToNull&useInformationSchema=true&serverTimezone=GMT%2B8&autoReconnect=true
|
||||
user=dev_ssjy_xsx
|
||||
password=Ssjy_xs_890
|
||||
#jdbcUrl=jdbc:mysql://rm-wz9wa070076b2uge2ro.mysql.rds.aliyuncs.com:3306/ssjy_xsx_service_dev?characterEncoding=utf8&useSSL=false&zeroDateTimeBehavior=convertToNull&useInformationSchema=true&serverTimezone=GMT%2B8&autoReconnect=true
|
||||
#user=dev_ssjy_xsx
|
||||
#password=Ssjy_xs_890
|
||||
|
||||
# mysql
|
||||
#jdbcUrl=jdbc:mysql://192.168.1.165:3306/ssjy_xsx_service_dev?characterEncoding=utf8&useSSL=false&zeroDateTimeBehavior=convertToNull&useInformationSchema=true&serverTimezone=GMT%2B8&autoReconnect=true
|
||||
#user=root
|
||||
#password=Local_1
|
||||
jdbcUrl=jdbc:mysql://127.0.0.1:3306/ssjy_xsx_service_dev?characterEncoding=utf8&useSSL=false&zeroDateTimeBehavior=convertToNull&useInformationSchema=true&serverTimezone=GMT%2B8&autoReconnect=true
|
||||
user=root
|
||||
password=19999999
|
||||
|
||||
# redis
|
||||
redis.basekey=ssjcgl_xsx_dev
|
||||
|
|
|
|||
Loading…
Reference in New Issue