首页统计修改, 各砂站统计表修改, 用户余额扣费修改
parent
3ced98f089
commit
19da635792
|
|
@ -120,7 +120,7 @@ public class OrderEndService extends BaseService {
|
|||
try {
|
||||
queryList(tm,null);
|
||||
}catch (Exception e){
|
||||
log.error("同步数据异常 %s %s", e.getMessage(),e);
|
||||
log.error("同步数据异常 %s", e.getMessage(),e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import com.jfinal.plugin.activerecord.Db;
|
|||
import com.jfinal.plugin.activerecord.Record;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.util.*;
|
||||
|
||||
public class OverallService {
|
||||
|
|
@ -123,7 +124,7 @@ public class OverallService {
|
|||
select count(t.sn) cnt, sum(t.weight) weight, sum(t.total_price) total_price, date_format(t.create_time, '%Y-%m-%d') date from order_temp t
|
||||
where t.state = 5
|
||||
group by date
|
||||
|
||||
首页数据统计
|
||||
*/
|
||||
public Record stat(Integer supermarket_id) {
|
||||
Record out = new Record();
|
||||
|
|
@ -144,12 +145,18 @@ group by date
|
|||
c.set(Calendar.MONTH, 0);
|
||||
Date year = c.getTime(); // 当年
|
||||
|
||||
int year_total_price = 0;
|
||||
if (2024 == LocalDate.now().getYear()){
|
||||
// 久联认款1000万中出站销售金额
|
||||
year_total_price = 1000 * 10000;
|
||||
}
|
||||
|
||||
String sql_ordercluster = "select \n" +
|
||||
" ifnull(sum(g.total_weight), 0) total_weight,\n" +
|
||||
" ifnull(sum(g.total_price), 0) total_price,\n" +
|
||||
" ifnull(sum(g.truck_cnt), 0) truck_cnt,\n" +
|
||||
" ifnull(sum(g.year_total_weight), 0) year_total_weight,\n" +
|
||||
" ifnull(sum(g.year_total_price), 0) year_total_price,\n" +
|
||||
" ifnull(sum(g.year_total_price), 0) + " + year_total_price + " year_total_price,\n" +
|
||||
" ifnull(sum(g.year_truck_cnt), 0) year_truck_cnt,\n" +
|
||||
" ifnull(sum(g.month_total_weight), 0) month_total_weight,\n" +
|
||||
" ifnull(sum(g.month_total_price), 0) month_total_price,\n" +
|
||||
|
|
@ -183,17 +190,17 @@ group by date
|
|||
// " 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 >= ? 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 >= ? then t.total_price end ), 0) year_total_price,\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" +
|
||||
" ifnull(sum(case when t.date >= ? then t.count else 0 end ), 0) year_truck_cnt,\n" +
|
||||
" ifnull(sum(case when t.date >= ? then t.weight end ), 0) month_total_weight,\n" +
|
||||
" ifnull(sum(case when t.date >= ? then t.total_price end ), 0) month_total_price,\n" +
|
||||
" ifnull(sum(case when t.date >= ? and t.sale_type = 0 then t.total_price end ), 0) month_total_price,\n" +
|
||||
" ifnull(sum(case when t.date >= ? then t.count else 0 end ), 0) month_truck_cnt,\n" +
|
||||
" ifnull(sum(case when t.date >= ? then t.weight end ), 0) day_total_weight,\n" +
|
||||
" ifnull(sum(case when t.date >= ? then t.total_price end ), 0) day_total_price,\n" +
|
||||
" ifnull(sum(case when t.date >= ? and t.sale_type = 0 then t.total_price end ), 0) day_total_price,\n" +
|
||||
" ifnull(sum(case when t.date >= ? then t.count else 0 end ), 0) day_truck_cnt\n" +
|
||||
" from order_end t\n" +
|
||||
" WHERE t.sale_type = 0 \n" +
|
||||
// " WHERE t.sale_type = 0 \n" +
|
||||
|
||||
" UNION\n" +
|
||||
" SELECT\n" +
|
||||
|
|
@ -201,20 +208,20 @@ group by date
|
|||
" ifnull( sum( t.total_price ), 0 ) total_price,\n" +
|
||||
" ifnull( count( t.sn ), 0 ) truck_cnt,\n" +
|
||||
" ifnull( sum( t.weight ), 0 ) year_total_weight,\n" +
|
||||
" ifnull( sum( t.total_price ), 0 ) year_total_price,\n" +
|
||||
" ifnull( sum(case when t.sale_type = 0 then t.total_price end ), 0 ) year_total_price,\n" +
|
||||
" ifnull( count( t.sn ), 0 ) year_truck_cnt,\n" +
|
||||
" ifnull( sum( t.weight ), 0 ) month_total_weight,\n" +
|
||||
" ifnull( sum( t.total_price ), 0 ) month_total_price,\n" +
|
||||
" ifnull( sum( case when t.sale_type = 0 then t.total_price end ), 0 ) month_total_price,\n" +
|
||||
" ifnull( count( t.sn ), 0 ) month_truck_cnt,\n" +
|
||||
" ifnull( sum( t.weight ), 0 ) day_total_weight,\n" +
|
||||
" ifnull( sum( t.total_price ), 0 ) day_total_price,\n" +
|
||||
" ifnull( sum( case when t.sale_type = 0 then t.total_price end ), 0 ) day_total_price,\n" +
|
||||
" ifnull( count( t.sn ), 0 ) day_truck_cnt \n" +
|
||||
" FROM\n" +
|
||||
" order_temp t \n" +
|
||||
" WHERE\n" +
|
||||
" t.state = 5 \n" +
|
||||
" AND t.create_time >= ? " +
|
||||
" and t.sale_type = 0 \n" +
|
||||
// " and t.sale_type = 0 \n" +
|
||||
" union\n" +
|
||||
" select \n" +
|
||||
" 0 total_weight,\n" +
|
||||
|
|
|
|||
|
|
@ -2264,7 +2264,10 @@ public class OrderStatService {
|
|||
year = tm.substring(0, 4);
|
||||
}
|
||||
|
||||
Record rec = new Record().set("id", 99).set("name", "石畈处置砂").set("isdeploy", 1).set("del", 0);
|
||||
Record rec = new Record()
|
||||
.set("id", 99).set("name", "石畈处置砂").set("isdeploy", 1).set("del", 0)
|
||||
.set("id", 98).set("name", "竹瓦处置砂").set("isdeploy", 1).set("del", 0)
|
||||
.set("id", 97).set("name", "河东湾处置砂").set("isdeploy", 1).set("del", 0);
|
||||
List<Record> sups = Db.find("select t.*, s.yield from supermarket t \n" +
|
||||
" left join supermarket_yield s on s.supermarket_id = t.id and s.year = ? \n" +
|
||||
" where id <= 6 or id = 11 or id = 12 ", year);
|
||||
|
|
@ -2285,8 +2288,83 @@ public class OrderStatService {
|
|||
|
||||
String union_4 = "";
|
||||
String union_99 = "";
|
||||
String union_98 = "";
|
||||
String union_97 = "";
|
||||
String today = "";
|
||||
|
||||
// 石畈处置砂
|
||||
union_99 = " union select\n" +
|
||||
" ifnull(t.customer_id, 0) customer_id,\n" +
|
||||
" 99 supermarket_id,\n" +
|
||||
" ifnull(sum(t.weight), 0) weight,\n" +
|
||||
" ifnull(sum(t.total_price), 0) total_price\n" +
|
||||
" from order_temp t\n" +
|
||||
" where t.state = 5\n" +
|
||||
" and t.product_id = 4\n" ;
|
||||
if (invoice_type != null) {
|
||||
union_99 += "and t.invoice_type = " + invoice_type + " \n";
|
||||
}
|
||||
|
||||
if (sale_type != null && (sale_type == 0 || sale_type == 1)) {
|
||||
union_99 += " and t.sale_type = " + sale_type + " \n";
|
||||
}else{
|
||||
union_99 += " and t.sale_type = 0 \n";
|
||||
}
|
||||
|
||||
union_99 += " and t.supermarket_id = 4\n" +
|
||||
" and t.create_time >= ? \n" +
|
||||
" and t.create_time <= ?\n" +
|
||||
" group by t.customer_id\n";
|
||||
|
||||
// 竹瓦处置砂
|
||||
union_98 = " union select\n" +
|
||||
" ifnull(t.customer_id, 0) customer_id,\n" +
|
||||
" 98 supermarket_id,\n" +
|
||||
" ifnull(sum(t.weight), 0) weight,\n" +
|
||||
" ifnull(sum(t.total_price), 0) total_price\n" +
|
||||
" from order_temp t\n" +
|
||||
" where t.state = 5\n" +
|
||||
" and t.product_id = 4\n" ;
|
||||
if (invoice_type != null) {
|
||||
union_98 += "and t.invoice_type = " + invoice_type + " \n";
|
||||
}
|
||||
|
||||
if (sale_type != null && (sale_type == 0 || sale_type == 1)) {
|
||||
union_98 += " and t.sale_type = " + sale_type + " \n";
|
||||
}else{
|
||||
union_98 += " and t.sale_type = 0 \n";
|
||||
}
|
||||
|
||||
union_98 += " and t.supermarket_id = 1\n" +
|
||||
" and t.create_time >= ? \n" +
|
||||
" and t.create_time <= ?\n" +
|
||||
" group by t.customer_id\n";
|
||||
|
||||
// 河东湾处置砂
|
||||
union_97 = " union select\n" +
|
||||
" ifnull(t.customer_id, 0) customer_id,\n" +
|
||||
" 97 supermarket_id,\n" +
|
||||
" ifnull(sum(t.weight), 0) weight,\n" +
|
||||
" ifnull(sum(t.total_price), 0) total_price\n" +
|
||||
" from order_temp t\n" +
|
||||
" where t.state = 5\n" +
|
||||
" and t.product_id = 4\n" ;
|
||||
if (invoice_type != null) {
|
||||
union_97 += "and t.invoice_type = " + invoice_type + " \n";
|
||||
}
|
||||
|
||||
if (sale_type != null && (sale_type == 0 || sale_type == 1)) {
|
||||
union_97 += " and t.sale_type = " + sale_type + " \n";
|
||||
}else{
|
||||
union_97 += " and t.sale_type = 0 \n";
|
||||
}
|
||||
|
||||
union_97 += " and t.supermarket_id = 10\n" +
|
||||
" and t.create_time >= ? \n" +
|
||||
" and t.create_time <= ?\n" +
|
||||
" group by t.customer_id\n";
|
||||
|
||||
|
||||
String endDay = etm.split(" ")[0];
|
||||
if (LocalDate.now().toString().equals(endDay)) {
|
||||
|
||||
|
|
@ -2306,7 +2384,7 @@ public class OrderStatService {
|
|||
if (sale_type != null && (sale_type == 0 || sale_type == 1)) {
|
||||
union_4 += " and t.sale_type = " + sale_type + " \n";
|
||||
}else{
|
||||
union_4 += " and t.sale_type = 0 \n";
|
||||
// union_4 += " and t.sale_type = 0 \n";
|
||||
}
|
||||
|
||||
union_4 += " AND t.create_time >= CONCAT( CURDATE(), ' 00:00:00' )" +
|
||||
|
|
@ -2314,6 +2392,10 @@ public class OrderStatService {
|
|||
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
|
||||
// String endDay = etm.split(" ")[0];
|
||||
// if (LocalDate.now().toString().equals(endDay)) {
|
||||
//
|
||||
|
|
@ -2453,6 +2535,8 @@ public class OrderStatService {
|
|||
" ifnull(sum(case when g.supermarket_id = 6 or g.supermarket_id = 8 or g.supermarket_id = 10 then g.weight end), 0) xsl_6,\n" +
|
||||
" ifnull(sum(case when g.supermarket_id = 11 then g.weight end), 0) xsl_11,\n" +
|
||||
" ifnull(sum(case when g.supermarket_id = 12 then g.weight end), 0) xsl_12,\n" +
|
||||
" ifnull(sum(case when g.supermarket_id = 97 then g.weight end), 0) xsl_97,\n" +
|
||||
" ifnull(sum(case when g.supermarket_id = 98 then g.weight end), 0) xsl_98,\n" +
|
||||
" ifnull(sum(case when g.supermarket_id = 99 then g.weight end), 0) xsl_99,\n" +
|
||||
" ifnull(sum(case when g.supermarket_id = 1 or g.supermarket_id = 7 then g.total_price end), 0) xse_1,\n" +
|
||||
" ifnull(sum(case when g.supermarket_id = 2 then g.total_price end), 0) xse_2,\n" +
|
||||
|
|
@ -2462,6 +2546,8 @@ public class OrderStatService {
|
|||
" ifnull(sum(case when g.supermarket_id = 6 or g.supermarket_id = 8 or g.supermarket_id = 10 then g.total_price end), 0) xse_6,\n" +
|
||||
" ifnull(sum(case when g.supermarket_id = 11 then g.total_price end), 0) xse_11,\n" +
|
||||
" ifnull(sum(case when g.supermarket_id = 12 then g.total_price end), 0) xse_12,\n" +
|
||||
" ifnull(sum(case when g.supermarket_id = 97 then g.total_price end), 0) xse_97,\n" +
|
||||
" ifnull(sum(case when g.supermarket_id = 98 then g.total_price end), 0) xse_98,\n" +
|
||||
" ifnull(sum(case when g.supermarket_id = 99 then g.total_price end), 0) xse_99\n" +
|
||||
" from (\n" +
|
||||
today +
|
||||
|
|
@ -2479,7 +2565,10 @@ public class OrderStatService {
|
|||
" and t.date <= ?\n" +
|
||||
saleParam +
|
||||
" group by t.customer_id, t.supermarket_id\n" +
|
||||
union_4 + union_99 +
|
||||
union_4 +
|
||||
union_97 +
|
||||
union_98 +
|
||||
union_99 +
|
||||
" ) g\n" +
|
||||
" group by g.customer_id\n";
|
||||
|
||||
|
|
@ -2488,17 +2577,17 @@ public class OrderStatService {
|
|||
if (invoice_type != null) {
|
||||
if (sale_type != null && (sale_type == 0 || sale_type == 1)) {
|
||||
// customer_sale_list = Db.find(sql, stm, etm, sale_type, stm, etm, sale_type, stm, etm, sale_type);
|
||||
customer_sale_list = Db.find(sql, stm, etm, sale_type);
|
||||
customer_sale_list = Db.find(sql, stm, etm, sale_type, stm, etm, stm, etm, stm, etm);
|
||||
} else {
|
||||
// customer_sale_list = Db.find(sql, stm, etm, invoice_type, stm, etm, invoice_type, stm, etm, invoice_type);
|
||||
customer_sale_list = Db.find(sql, stm, etm);
|
||||
customer_sale_list = Db.find(sql, stm, etm, stm, etm, stm, etm, stm, etm);
|
||||
}
|
||||
} else {
|
||||
if (sale_type != null && (sale_type == 0 || sale_type == 1)) {
|
||||
// customer_sale_list = Db.find(sql,stm, etm, sale_type, stm, etm, sale_type, stm, etm, sale_type);
|
||||
customer_sale_list = Db.find(sql,stm, etm, sale_type);
|
||||
customer_sale_list = Db.find(sql,stm, etm, sale_type, stm, etm, stm, etm, stm, etm);
|
||||
} else {
|
||||
customer_sale_list = Db.find(sql, stm, etm);
|
||||
customer_sale_list = Db.find(sql, stm, etm, stm, etm, stm, etm, stm, etm);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2693,6 +2782,8 @@ public class OrderStatService {
|
|||
double all_xse_6 = 0.0;
|
||||
double all_xse_11 = 0.0;
|
||||
double all_xse_12 = 0.0;
|
||||
double all_xse_97 = 0.0;
|
||||
double all_xse_98 = 0.0;
|
||||
double all_xse_99 = 0.0;
|
||||
|
||||
for (Record record : typelist) {
|
||||
|
|
@ -2724,6 +2815,8 @@ public class OrderStatService {
|
|||
double xse_6 = 0.0;
|
||||
double xse_11 = 0.0;
|
||||
double xse_12 = 0.0;
|
||||
double xse_97 = 0.0;
|
||||
double xse_98 = 0.0;
|
||||
double xse_99 = 0.0;
|
||||
|
||||
for (Record r : list) {
|
||||
|
|
@ -2749,6 +2842,8 @@ public class OrderStatService {
|
|||
xse_6 += DataUtil.getDefaultByRecord(r, "xse_6");
|
||||
xse_11 += DataUtil.getDefaultByRecord(r, "xse_11");
|
||||
xse_12 += DataUtil.getDefaultByRecord(r, "xse_12");
|
||||
xse_97 += DataUtil.getDefaultByRecord(r, "xse_98");
|
||||
xse_98 += DataUtil.getDefaultByRecord(r, "xse_97");
|
||||
xse_99 += DataUtil.getDefaultByRecord(r, "xse_99");
|
||||
|
||||
all_prepay_total_amount += DataUtil.getDefaultByRecord(r, "prepay_total_amount");
|
||||
|
|
@ -2773,6 +2868,8 @@ public class OrderStatService {
|
|||
all_xse_6 += DataUtil.getDefaultByRecord(r, "xse_6");
|
||||
all_xse_11 += DataUtil.getDefaultByRecord(r, "xse_11");
|
||||
all_xse_12 += DataUtil.getDefaultByRecord(r, "xse_12");
|
||||
all_xse_97 += DataUtil.getDefaultByRecord(r, "xse_97");
|
||||
all_xse_98 += DataUtil.getDefaultByRecord(r, "xse_98");
|
||||
all_xse_99 += DataUtil.getDefaultByRecord(r, "xse_99");
|
||||
}
|
||||
|
||||
|
|
@ -2798,6 +2895,8 @@ public class OrderStatService {
|
|||
record.set("xse_6", xse_6);
|
||||
record.set("xse_11", xse_11);
|
||||
record.set("xse_12", xse_12);
|
||||
record.set("xse_97", xse_97);
|
||||
record.set("xse_98", xse_98);
|
||||
record.set("xse_99", xse_99);
|
||||
}
|
||||
}
|
||||
|
|
@ -2848,6 +2947,8 @@ public class OrderStatService {
|
|||
record.set("xse_6", all_xse_6);
|
||||
record.set("xse_11", all_xse_11);
|
||||
record.set("xse_12", all_xse_12);
|
||||
record.set("xse_97", all_xse_97);
|
||||
record.set("xse_98", all_xse_98);
|
||||
record.set("xse_99", all_xse_99);
|
||||
|
||||
typelist.add(record);
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ import java.io.File;
|
|||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
|
|
@ -453,8 +454,8 @@ public class LocalOrderService {
|
|||
clientTaxId = CacheData.print_vendorTaxId;
|
||||
}
|
||||
|
||||
out.put("goodsTareWeight", goodsTareWeight);
|
||||
out.put("goodsGrossWeight", goodsGrossWeight);
|
||||
out.put("goodsTareWeight", new BigDecimal(goodsTareWeight).setScale(2, RoundingMode.HALF_UP).toString());
|
||||
out.put("goodsGrossWeight", new BigDecimal(goodsGrossWeight).setScale(2, RoundingMode.HALF_UP).toString());
|
||||
// out.put("qrcode", sn);
|
||||
out.put("serial", sn);
|
||||
out.put("datetimePrint", sdf.get().format(new Date()));
|
||||
|
|
@ -472,8 +473,8 @@ public class LocalOrderService {
|
|||
out.put("origin", origin);
|
||||
out.put("dest", dest);
|
||||
out.put("goodsName", StrUtil.getRecordStr(order, "product_name"));
|
||||
out.put("goodsSetWeight", goodsSetWeight);
|
||||
out.put("goodsNetWeight", goodsNetWeight);
|
||||
out.put("goodsSetWeight", new BigDecimal(goodsSetWeight).setScale(2, RoundingMode.HALF_UP).toString());
|
||||
out.put("goodsNetWeight",new BigDecimal(goodsNetWeight).setScale(2, RoundingMode.HALF_UP).toString() );
|
||||
out.put("transDistance", transDistance);
|
||||
out.put("priceGoods", priceGoods);
|
||||
out.put("priceGoodsTotal", paid); // ? 重量总价?
|
||||
|
|
|
|||
|
|
@ -899,7 +899,7 @@ public class OrderTempSyncService {
|
|||
);
|
||||
|
||||
// 只更新本地 prepayCustomer 的 surplus
|
||||
prepayCustomer.setSurplus(prepayCustomer.getSurplus().subtract(order.getTotalPrice()));
|
||||
prepayCustomer.setSurplus(prepayCustomer.getSurplus().subtract(order.getTotalPrice())); // 本地修改金额
|
||||
|
||||
ret = prepayCustomer.update();
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ import com.cowr.model.PrepayCustomer;
|
|||
import com.cowr.service.ssjygl.main.Config;
|
||||
import com.cowr.service.ssjygl.main.SvrCacheData;
|
||||
import com.cowr.service.ssjygl.sms.log.SmsService;
|
||||
import com.cowr.sms.AliyunSmsService;
|
||||
import com.cowr.ssjygl.addsubtractitemrecord.AddSubtractItemRecordService;
|
||||
import com.jfinal.kit.StrKit;
|
||||
import com.jfinal.log.Log;
|
||||
|
|
@ -345,17 +344,19 @@ public class StatSmsJob implements Job {
|
|||
String sendtmtext = DateTimeUtil.sdfymd.get().format(c.getTime());
|
||||
String year_start = DateTimeUtil.year_start.get().format(now);
|
||||
|
||||
String ordersql = "select count(t.sn) aggr_cnt, ifnull(sum(t.weight), 0) aggr_weight, ifnull(sum(t.total_price), 0) aggr_price \n" +
|
||||
String ordersql = "select count(t.sn) aggr_cnt, ifnull(sum(t.weight), 0) aggr_weight, " +
|
||||
"ifnull(sum(case when t.sale_type = 0 then t.total_price end ), 0) aggr_price \n" +
|
||||
" from order_temp t \n" +
|
||||
" where t.state = 5 \n" +
|
||||
" and t.sale_type = 0 \n" +
|
||||
" and t.product_id != 4 \n" +
|
||||
" and t.create_time >= ? \n" +
|
||||
" and t.create_time < ? \n";
|
||||
|
||||
String daysql = "select count(t.sn) total_cnt, ifnull(sum(t.weight), 0) total_weight, ifnull(sum(t.total_price), 0) total_price \n" +
|
||||
String daysql = "select count(t.sn) total_cnt, ifnull(sum(t.weight), 0) total_weight, " +
|
||||
"ifnull(sum(case when t.sale_type = 0 then t.total_price end ), 0) total_price \n" +
|
||||
" from order_temp t \n" +
|
||||
" where t.state = 5 \n" +
|
||||
" and t.sale_type = 0 \n " +
|
||||
" and t.product_id != 4 \n " +
|
||||
" and t.create_time like '" + predaytm + "%'";
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -168,9 +168,9 @@ public class OrderTempSyncService {
|
|||
PrepayCustomer prepayCustomer = PrepayCustomerService.me.getPrepayCustomer(customer.getId());
|
||||
if (prepayCustomer != null) {
|
||||
if (prepayCustomer.getSurplus() == null) {
|
||||
prepayCustomer.setSurplus(order.getTotalPrice());
|
||||
prepayCustomer.setSurplus(order.getTotalPrice()); // 取消订单成功
|
||||
} else {
|
||||
prepayCustomer.setSurplus(prepayCustomer.getSurplus().add(order.getTotalPrice()));
|
||||
prepayCustomer.setSurplus(prepayCustomer.getSurplus().add(order.getTotalPrice()));// 取消订单成功
|
||||
}
|
||||
|
||||
synctaskincrement.addIncrementData(
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.cowr.service.ssjygl.overall;
|
|||
|
||||
import com.cowr.common.view.Result;
|
||||
import com.cowr.ssjygl.overall.OverallService;
|
||||
import com.jfinal.aop.Clear;
|
||||
import com.jfinal.core.Controller;
|
||||
import com.jfinal.plugin.activerecord.Record;
|
||||
import com.jfinal.plugin.redis.Redis;
|
||||
|
|
@ -10,15 +11,16 @@ import java.util.List;
|
|||
|
||||
public class OverallController extends Controller {
|
||||
|
||||
@Clear()
|
||||
public void stat() {
|
||||
String key = OverallCacheService.me.overallmapkey("stat");
|
||||
Record cachedata =
|
||||
Redis.use().get(key);
|
||||
if (cachedata == null) {
|
||||
// String key = OverallCacheService.me.overallmapkey("stat");
|
||||
Record cachedata = null;
|
||||
// Redis.use().get(key);
|
||||
// if (cachedata == null) {
|
||||
cachedata = OverallCacheService.me.stat(null);
|
||||
|
||||
Redis.use().setex(key, OverallCacheService.statExpireAt, cachedata);
|
||||
}
|
||||
// Redis.use().setex(key, OverallCacheService.statExpireAt, cachedata);
|
||||
// }
|
||||
|
||||
renderJson(Result.success(cachedata));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,13 +1,26 @@
|
|||
package com.cowr.service.ssjygl.prepay.prepaycustomer;
|
||||
|
||||
import com.cowr.common.Const;
|
||||
import com.cowr.model.PrepayCustomer;
|
||||
import com.cowr.model.SyncTask;
|
||||
import com.cowr.service.ssjygl.base.BaseSyncService;
|
||||
import com.cowr.service.ssjygl.main.Config;
|
||||
import com.cowr.service.ssjygl.synctask.SyncTaskService;
|
||||
import com.jfinal.plugin.redis.Redis;
|
||||
|
||||
public class PrepayCustomerSyncService extends BaseSyncService {
|
||||
public static PrepayCustomerSyncService me = new PrepayCustomerSyncService();
|
||||
|
||||
|
||||
public String redisbasekey() {
|
||||
return Config.dbprop.get("redis.basekey") + Const.REDIS_SEPARATE + "prepayCustomer" + Const.REDIS_SEPARATE;
|
||||
}
|
||||
|
||||
|
||||
public void redisClear() {
|
||||
Redis.use().del(redisbasekey() + "*");
|
||||
}
|
||||
|
||||
/**
|
||||
* 将服务端的客户预付费信息推送到客户端
|
||||
*
|
||||
|
|
|
|||
|
|
@ -155,7 +155,7 @@ public class PrepayDetailSyncService extends BaseSyncService {
|
|||
if (prepayCustomer[0] == null) {
|
||||
prepayCustomer[0] = new PrepayCustomer();
|
||||
prepayCustomer[0].setCustomerId(customer.getId());
|
||||
prepayCustomer[0].setSurplus(model.getAmount()); // 更新余额
|
||||
prepayCustomer[0].setSurplus(model.getAmount()); // 更新余额 预付费充值
|
||||
prepayCustomer[0].setRechargeTime(now); // 更新最后一次充值时间
|
||||
prepayCustomer[0].setFirstRechargeTime(now);
|
||||
prepayCustomer[0].setNotice(0);
|
||||
|
|
@ -164,7 +164,7 @@ public class PrepayDetailSyncService extends BaseSyncService {
|
|||
|
||||
synctask.addSaveData(prepayCustomer[0]);
|
||||
} else {
|
||||
prepayCustomer[0].setSurplus(prepayCustomer[0].getSurplus().add(model.getAmount())); // 更新余额
|
||||
prepayCustomer[0].setSurplus(prepayCustomer[0].getSurplus().add(model.getAmount())); // 更新余额 预付费充值
|
||||
prepayCustomer[0].setRechargeTime(now); // 更新最后一次充值时间
|
||||
prepayCustomer[0].setNotice(0);
|
||||
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ public class PresellOrderSyncService extends BaseSyncService {
|
|||
}
|
||||
}
|
||||
|
||||
prepayCustomer.setSurplus(prepayCustomer.getSurplus().subtract(model.getPresellAmount()));
|
||||
prepayCustomer.setSurplus(prepayCustomer.getSurplus().subtract(model.getPresellAmount())); // 新增预售单 扣费
|
||||
|
||||
// 余额变化需要广播
|
||||
synctaskincrement.addIncrementData(
|
||||
|
|
@ -215,7 +215,7 @@ public class PresellOrderSyncService extends BaseSyncService {
|
|||
return false;
|
||||
}
|
||||
|
||||
prepayCustomer.setSurplus(prepayCustomer.getSurplus().add(saveold.getPresellAmount()));
|
||||
prepayCustomer.setSurplus(prepayCustomer.getSurplus().add(saveold.getPresellAmount())); // 删除预售单 恢复余额
|
||||
|
||||
synctaskincrement.addIncrementData(
|
||||
prepayCustomer.getTablename(),
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ import com.cowr.model.Sysuser;
|
|||
import com.cowr.service.ssjygl.system.sysuser.SysuserSyncService;
|
||||
import com.cowr.ssjygl.stat.sale.OrderStatService;
|
||||
import com.jfinal.aop.Before;
|
||||
import com.jfinal.aop.Clear;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
|
||||
import java.util.Date;
|
||||
|
|
@ -443,6 +444,7 @@ public class OrderStatController extends BaseController {
|
|||
/**
|
||||
* 各砂站运输量统计表
|
||||
*/
|
||||
@Clear()
|
||||
public void trafficStatisticsOfEachSandStation() {
|
||||
String stm = get("stm");
|
||||
String etm = get("etm");
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import com.cowr.common.enums.OrderStateEnum;
|
|||
import com.cowr.model.*;
|
||||
import com.cowr.service.ssjygl.main.Config;
|
||||
import com.cowr.service.ssjygl.main.SvrCacheData;
|
||||
import com.cowr.service.ssjygl.prepay.prepaycustomer.PrepayCustomerSyncService;
|
||||
import com.cowr.service.ssjygl.truck.truckweightlimit.TruckWeightLimitService;
|
||||
import com.cowr.ssjygl.CacheData;
|
||||
import com.cowr.ssjygl.blacklist.BlacklistService;
|
||||
|
|
@ -525,11 +526,60 @@ public class SyncTaskService {
|
|||
}
|
||||
|
||||
if (change) {
|
||||
boolean ret = Db.update(tablename, pks, record);
|
||||
|
||||
if (!ret) {
|
||||
return false;
|
||||
// 当前方法可以修改余额 判断当前订单是否有修改过余额 判断是否是新增订单
|
||||
if ("prepay_customer".equals(tablename)
|
||||
&& Objects.nonNull(save_data)
|
||||
&& save_data.containsKey("order_temp") ){
|
||||
JSONObject orderTemp = save_data.getJSONObject("order_temp");
|
||||
if (Objects.nonNull(orderTemp) && orderTemp.containsKey("data")){
|
||||
JSONArray orderData = orderTemp.getJSONArray("data");
|
||||
if (CollectionUtils.isNotEmpty(orderData)){
|
||||
String sn = orderData.getJSONObject(0).getString("sn");
|
||||
if (StrKit.notBlank(sn)){
|
||||
// 判断sn是否添加过
|
||||
String statkey = PrepayCustomerSyncService.me.redisbasekey() + sn;
|
||||
if (! Redis.use().exists(statkey)) {
|
||||
|
||||
boolean ret = Db.update(tablename, pks, record);
|
||||
if (!ret) {
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
// 新增成功进行修改
|
||||
Redis.use().set(statkey, recvdata);
|
||||
|
||||
// 设置过期时间
|
||||
Redis.use().expire(statkey, 3* 86400);
|
||||
}catch (Exception e){
|
||||
log.error("修改余额操作redis失败 " + e.getMessage(),e);
|
||||
}
|
||||
|
||||
}else{
|
||||
// 当前sn 已添加过
|
||||
Record str = Redis.use().get(statkey);
|
||||
log.info("当前sn 数据 : " + recvdata.toJSONString());
|
||||
log.info("当前redis 数据" + str);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{
|
||||
|
||||
boolean ret = Db.update(tablename, pks, record);
|
||||
|
||||
if (!ret) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// boolean ret = Db.update(tablename, pks, record);
|
||||
//
|
||||
// if (!ret) {
|
||||
// return false;
|
||||
// }
|
||||
} else {
|
||||
log.debug("没有变化 %s", tablename);
|
||||
}
|
||||
|
|
@ -604,6 +654,8 @@ public class SyncTaskService {
|
|||
log.error(e.getMessage(), e);
|
||||
|
||||
log.debug("recv 3 time: %s", System.currentTimeMillis() - st);
|
||||
Redis.use().set(redisKey,"0");
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue