|
|
@@ -15,11 +15,12 @@ public class OrderAutoCheck extends ServiceController {
|
|
|
@Override
|
|
|
public void serviceRun() throws Exception {
|
|
|
|
|
|
- Rows orderRows = dbConnect.runSqlQuery("select t1.sa_orderid,t1.sys_enterpriseid,sum(t2.amount)as amount from sa_order t1\n" +
|
|
|
+ Rows orderRows = dbConnect.runSqlQuery("select t1.sa_orderid,t1.sys_enterpriseid,t1.sonum,sum(t2.amount)as amount from sa_order t1\n" +
|
|
|
"inner join sa_orderitems t2 on t1.sa_orderid=t2.sa_orderid \n" +
|
|
|
"inner join sa_agents t3 on t1.sys_enterpriseid=t3.sys_enterpriseid and t3.submitautocheck=1 \n" +
|
|
|
"where t1.status='提交' and not exists(select * from sa_orderitems t4 where t1.sa_orderid=t4.sa_orderid and t4.remarks is not null)\n" +
|
|
|
- "group by t1.sa_orderid,t1.sys_enterpriseid having sum(t2.amount)>0 order by t1.sys_enterpriseid,sum(t2.amount)");
|
|
|
+ " and exists(select * from sa_cashbill t5 where t5.type=1 and t5.status='审核' and t5.sys_enterpriseid=t1.sys_enterpriseid and t5.billdate>=date(now()))\n" +
|
|
|
+ "group by t1.sa_orderid,t1.sys_enterpriseid,t1.sonum having sum(t2.amount)>0 order by t1.sys_enterpriseid,sum(t2.amount)");
|
|
|
logger.info("监测到有{}个订单待审核", orderRows.size());
|
|
|
|
|
|
Controller md = getSysController("MD");
|