From 585a05bef033fa4b6a02b5d3afd3b305b3914abb Mon Sep 17 00:00:00 2001 From: yujian <yujian> Date: 星期五, 15 三月 2019 15:24:06 +0800 Subject: [PATCH] 券推送、今天推荐加入版本推送 用户活跃检测开启任务 --- fanli/src/main/java/com/yeshi/fanli/service/impl/push/PushCouponServiceImpl.java | 19 +++++++++++++++++-- 1 files changed, 17 insertions(+), 2 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/push/PushCouponServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/push/PushCouponServiceImpl.java index 007f2f0..bb45644 100644 --- a/fanli/src/main/java/com/yeshi/fanli/service/impl/push/PushCouponServiceImpl.java +++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/push/PushCouponServiceImpl.java @@ -1,5 +1,6 @@ package com.yeshi.fanli.service.impl.push; +import java.math.BigDecimal; import java.util.Arrays; import java.util.Date; import java.util.List; @@ -94,9 +95,18 @@ } Integer amount = record.getAmount(); - if (amount == null || amount < 1) { - throw new PushCouponException(1, "鍒告暟閲忎笉鑳藉皬浜�1"); + if (amount == null) { + throw new PushCouponException(1, "鍒告暟閲忎笉鑳戒负绌�"); + } else if (amount < 1 || amount > 5) { + throw new PushCouponException(1, "鍒告暟閲忚寖鍥存槸 1~5"); } + + BigDecimal percent = record.getPercent(); + if (percent != null && (percent.compareTo(new BigDecimal(60)) > 0 + || percent.compareTo(new BigDecimal(1)) < 0)) { + throw new PushCouponException(1, "鍒告瘮渚嬭寖鍥存槸1~60 鐨勬鏁存暟"); + } + Long id = record.getId(); if (id == null) { @@ -112,6 +122,10 @@ PushCoupon current = selectByPrimaryKey(id); if (current == null) { throw new PushCouponException(1, "璇ヨ褰曞凡涓嶅瓨鍦�"); + } + + if(current.isPushed()) { + throw new PushCouponException(1, "宸叉帹閫佺殑淇℃伅涓嶈兘淇敼"); } current.setTitle(title); @@ -199,6 +213,7 @@ for (Long id: list) { long receivedCount = pushCouponRecordService.countByPushId(id); + // 棰嗗彇鏁伴噺 if (receivedCount > 0) { continue; } -- Gitblit v1.8.0