新增集团配额时增加指定时间段内是否还有未完成的配额判断

dev
wuwenxiong 2021-09-14 16:50:30 +08:00
parent a7ac815703
commit 31ff341932
2 changed files with 23 additions and 0 deletions

View File

@ -356,6 +356,20 @@ public class OrderclusterService extends BaseService {
return Db.find(sql, ts.toArray());
}
public List<Record> undonlist(int supermarket_id, String start_time, String cutoff_time) {
List<Object> ts = new ArrayList<>();
ts.add(OrderStateEnum.RECEIVED.getStateid());
ts.add(cutoff_time + " 23:59:59");
ts.add(start_time + " 00:00:00");
ts.add(supermarket_id);
String sql = "select * from ordercluster t \n" +
" where t.state < ? \n" +
" and t.start_time <= ? \n" +
" and t.cutoff_time >= ? \n" +
" and t.supermarket_id = ?";
return Db.find(sql, ts.toArray());
}
/**
*
*

View File

@ -144,6 +144,15 @@ public class OrderclusterSyncService extends BaseSyncService {
return Result.failedstr("共计总配额达 %.2f元,客户余额(%.2f元)不足", plan_total_price, prepayCustomer.getSurplus());
}
// 超时在指定时间段内还有未完成的配额
String query_start_time = DateTimeUtil.sdf.get().format(start_time);
String query_cutoff_time = DateTimeUtil.sdf.get().format(cutoff_time);
List<Record> undonlist = OrderclusterService.me.undonlist(supermarket_id, query_start_time, query_cutoff_time);
if (undonlist != null && !undonlist.isEmpty()) {
return Result.failedstr("砂站[%s]在[%s]至[%s]内还有未完成的配额", SvrCacheData.SUP_CACHE.get(supermarket_id).getName(), query_start_time, query_cutoff_time);
}
Ordercluster model = new Ordercluster();
model.setCustomerId(customerObj.getId());
model.setCustomerAddress(customerObj.getAddress());