预警35
This commit is contained in:
parent
6fac29bc9b
commit
a0728d9d23
|
|
@ -98,8 +98,16 @@ func (this *VoucherBiz) cronWarningBudget(ctx context.Context) error {
|
||||||
|
|
||||||
return this.ProductRepo.FindWarningBudget(ctx, func(ctx context.Context, rows []*bo.ProductBo) error {
|
return this.ProductRepo.FindWarningBudget(ctx, func(ctx context.Context, rows []*bo.ProductBo) error {
|
||||||
|
|
||||||
|
exist := make(map[string]bool, 0)
|
||||||
for _, row := range rows {
|
for _, row := range rows {
|
||||||
|
|
||||||
|
_, ok := exist[row.ProductNo]
|
||||||
|
if ok {
|
||||||
|
log.Warnf("预警查询,微信批次号%s忽略处理", row.BatchNo)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
exist[row.ProductNo] = true
|
||||||
|
|
||||||
if err := this.WarningBudget(ctx, row); err != nil {
|
if err := this.WarningBudget(ctx, row); err != nil {
|
||||||
log.Context(ctx).Errorf("预警查询,处理失败: %s", err)
|
log.Context(ctx).Errorf("预警查询,处理失败: %s", err)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,6 @@ func (r *ProductRepoImpl) FindWarningBudget(ctx context.Context, fun func(ctx co
|
||||||
nowTime := time.Now().Format(time.DateTime)
|
nowTime := time.Now().Format(time.DateTime)
|
||||||
|
|
||||||
result := r.db.DB(ctx).
|
result := r.db.DB(ctx).
|
||||||
Select("DISTINCT batch_no, product.*").
|
|
||||||
Where("start_time < ?", nowTime).
|
Where("start_time < ?", nowTime).
|
||||||
Where("end_time > ?", nowTime).
|
Where("end_time > ?", nowTime).
|
||||||
Where("warning_budget > 0").
|
Where("warning_budget > 0").
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue