This commit is contained in:
ziming 2025-07-02 15:00:17 +08:00
parent 6fac29bc9b
commit a0728d9d23
2 changed files with 8 additions and 1 deletions

View File

@ -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 {
exist := make(map[string]bool, 0)
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 {
log.Context(ctx).Errorf("预警查询,处理失败: %s", err)
}

View File

@ -37,7 +37,6 @@ func (r *ProductRepoImpl) FindWarningBudget(ctx context.Context, fun func(ctx co
nowTime := time.Now().Format(time.DateTime)
result := r.db.DB(ctx).
Select("DISTINCT batch_no, product.*").
Where("start_time < ?", nowTime).
Where("end_time > ?", nowTime).
Where("warning_budget > 0").