diff --git a/ssjygl-xsx-common/src/main/java/com/cowr/ssjygl/stat/customer/CustomerStatService.java b/ssjygl-xsx-common/src/main/java/com/cowr/ssjygl/stat/customer/CustomerStatService.java index 1a57920..7517eb6 100644 --- a/ssjygl-xsx-common/src/main/java/com/cowr/ssjygl/stat/customer/CustomerStatService.java +++ b/ssjygl-xsx-common/src/main/java/com/cowr/ssjygl/stat/customer/CustomerStatService.java @@ -47,7 +47,7 @@ public class CustomerStatService { " a.total_cnt,\n" + " b.amount,\n" + " b.refund_amount,\n" + - " b.amount - a.total_price - b.refund_amount then_surplus\n" + + " b.amount - ifnull(a.total_price,0) - b.refund_amount then_surplus\n" + " from prepay_customer t\n" + " left join customer c on c.id= t.customer_id\n" + " left join(\n" + @@ -93,7 +93,7 @@ public class CustomerStatService { " a.total_cnt,\n" + " b.amount,\n" + " b.refund_amount,\n" + - " b.amount - a.total_price - b.refund_amount then_surplus\n" + + " b.amount - ifnull(a.total_price,0) - b.refund_amount then_surplus\n" + " from prepay_customer t\n" + " left join customer c on c.id= t.customer_id\n" + " left join(\n" + diff --git a/ssjygl-xsx-service/src/main/java/com/cowr/service/ssjygl/jobs/CheckExceptionDataJob.java b/ssjygl-xsx-service/src/main/java/com/cowr/service/ssjygl/jobs/CheckExceptionDataJob.java index dc79d72..e5fb4d1 100644 --- a/ssjygl-xsx-service/src/main/java/com/cowr/service/ssjygl/jobs/CheckExceptionDataJob.java +++ b/ssjygl-xsx-service/src/main/java/com/cowr/service/ssjygl/jobs/CheckExceptionDataJob.java @@ -35,27 +35,28 @@ public class CheckExceptionDataJob implements Job { } } - int cnt = 0; - - if (!onlineids.isEmpty()) { - cnt = Db.queryInt("select count(t.sn) cnt from order_temp t\n" + - " left join transport p on t.sn = p.order_sn\n" + - " where t.state = 5 \n" + - " and t.supermarket_id in(" + StrKit.join(onlineids, ",") + ") \n" + - " and p.id is null"); - } else { - content += "没有找到在线砂站信息。"; - log.error("没有找到在线砂站信息。"); - } - - int sync = Db.queryInt("select count(t.id) cnt from sync_task t where t.state = 0"); + int cnt = Db.queryInt("select count(t.sn) cnt from order_temp t\n" + + " left join transport p on t.sn = p.order_sn\n" + + " where t.state = 5 \n" + + " and p.id is null"); if (cnt > 0) { content += "浠水砂石系统有 " + cnt + " 条订单异常数据。"; } - if (sync > 0) { - content += "浠水砂石系统有 " + sync + " 条数据下发失败。"; + int sync = 0; + + if (!onlineids.isEmpty()) { + sync = Db.queryInt("select count(t.id) cnt from sync_task t \n" + + " where t.state = 0 \n" + + " and t.supermarket_id in(" + StrKit.join(onlineids, ",") + ") "); + + if (sync > 0) { + content += "浠水砂石系统有 " + sync + " 条数据下发失败。"; + } + } else { + content += "没有找到在线砂站信息。"; + log.error("没有找到在线砂站信息。"); } if (StrKit.notBlank(content) && content.length() > 1) {