累计销售汇总短信定时任务修改
parent
9e41c0c0fc
commit
a40e760cbe
|
|
@ -236,12 +236,17 @@ public class StatSmsJob implements Job {
|
||||||
" and t.create_time >= ? \n" +
|
" and t.create_time >= ? \n" +
|
||||||
" and t.create_time < ?";
|
" and t.create_time < ?";
|
||||||
|
|
||||||
|
String subtractsql = "select ifnull(sum(t.weight), 0) weight, ifnull(sum(total_price), 0) total_price from order_temp t\n" +
|
||||||
|
" where t.state = 5\n" +
|
||||||
|
" and t.supermarket_id = 11\n";
|
||||||
|
|
||||||
JSONObject obj = new JSONObject();
|
JSONObject obj = new JSONObject();
|
||||||
Record orderobj = Db.findFirst(ordersql, year_start, daytm);
|
Record orderobj = Db.findFirst(ordersql, year_start, daytm);
|
||||||
Record revenueobj = Db.findFirst(revenuesql, year_start, daytm);
|
Record revenueobj = Db.findFirst(revenuesql, year_start, daytm);
|
||||||
Record allorderobj = Db.findFirst(allordersql);
|
Record allorderobj = Db.findFirst(allordersql);
|
||||||
Record customerobj = Db.findFirst(cusmersql);
|
Record customerobj = Db.findFirst(cusmersql);
|
||||||
Record dayobj = Db.findFirst(daysql);
|
Record dayobj = Db.findFirst(daysql);
|
||||||
|
Record subtractobj = Db.findFirst(subtractsql);
|
||||||
|
|
||||||
obj.put("time1", sendtmtext);
|
obj.put("time1", sendtmtext);
|
||||||
obj.put("time2", sendtmtext);
|
obj.put("time2", sendtmtext);
|
||||||
|
|
@ -250,6 +255,7 @@ public class StatSmsJob implements Job {
|
||||||
orderobj == null
|
orderobj == null
|
||||||
|| customerobj == null
|
|| customerobj == null
|
||||||
|| dayobj == null
|
|| dayobj == null
|
||||||
|
|| subtractobj == null
|
||||||
|| orderobj.get("aggr_cnt") == null
|
|| orderobj.get("aggr_cnt") == null
|
||||||
|| orderobj.get("aggr_weight") == null
|
|| orderobj.get("aggr_weight") == null
|
||||||
|| orderobj.get("aggr_price") == null
|
|| orderobj.get("aggr_price") == null
|
||||||
|
|
@ -260,12 +266,15 @@ public class StatSmsJob implements Job {
|
||||||
|| dayobj.get("total_price") == null
|
|| dayobj.get("total_price") == null
|
||||||
|| revenueobj.get("weight") == null
|
|| revenueobj.get("weight") == null
|
||||||
|| revenueobj.get("total_price") == null
|
|| revenueobj.get("total_price") == null
|
||||||
|
|| subtractobj.get("weight") == null
|
||||||
|
|| subtractobj.get("total_price") == null
|
||||||
) {
|
) {
|
||||||
log.error("sql 执行错误");
|
log.error("sql 执行错误");
|
||||||
log.error("1 执行错误 %s", orderobj == null ? null : orderobj.toJson());
|
log.error("1 执行错误 %s", orderobj == null ? null : orderobj.toJson());
|
||||||
log.error("2 执行错误 %s", customerobj == null ? null : customerobj.toJson());
|
log.error("2 执行错误 %s", customerobj == null ? null : customerobj.toJson());
|
||||||
log.error("3 执行错误 %s", dayobj == null ? null : dayobj.toJson());
|
log.error("3 执行错误 %s", dayobj == null ? null : dayobj.toJson());
|
||||||
log.error("4 执行错误 %s", revenueobj == null ? null : revenueobj.toJson());
|
log.error("4 执行错误 %s", revenueobj == null ? null : revenueobj.toJson());
|
||||||
|
log.error("5 执行错误 %s", subtractobj == null ? null : subtractobj.toJson());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -273,12 +282,16 @@ public class StatSmsJob implements Job {
|
||||||
obj.put("aggr_weight", String.format("%.2f万",
|
obj.put("aggr_weight", String.format("%.2f万",
|
||||||
orderobj.getBigDecimal("aggr_weight")
|
orderobj.getBigDecimal("aggr_weight")
|
||||||
.subtract(new BigDecimal("27.34"))
|
.subtract(new BigDecimal("27.34"))
|
||||||
|
.subtract(new BigDecimal("5853.39"))
|
||||||
|
.subtract(subtractobj.getBigDecimal("weight"))
|
||||||
.divide(new BigDecimal("10000"), 2, BigDecimal.ROUND_HALF_UP)
|
.divide(new BigDecimal("10000"), 2, BigDecimal.ROUND_HALF_UP)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
obj.put("aggr_price", String.format("%.2f万",
|
obj.put("aggr_price", String.format("%.2f万",
|
||||||
orderobj.getBigDecimal("aggr_price")
|
orderobj.getBigDecimal("aggr_price")
|
||||||
.subtract(new BigDecimal("2011.27"))
|
.subtract(new BigDecimal("2011.27"))
|
||||||
|
.subtract(new BigDecimal("410322.58"))
|
||||||
|
.subtract(subtractobj.getBigDecimal("total_price"))
|
||||||
.divide(new BigDecimal("10000"), 2, BigDecimal.ROUND_HALF_UP)
|
.divide(new BigDecimal("10000"), 2, BigDecimal.ROUND_HALF_UP)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue