From cbc53d3765e0ec38b4195a5157b82cc6f32e7aa5 Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期五, 15 三月 2019 17:44:37 +0800 Subject: [PATCH] 删除ConfigDao --- fanli/src/main/java/com/yeshi/fanli/service/impl/push/PushCouponServiceImpl.java | 39 ++++++++++++++++++++++++++++----------- 1 files changed, 28 insertions(+), 11 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 a0e3225..007f2f0 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.util.Arrays; import java.util.Date; import java.util.List; @@ -134,6 +135,11 @@ if (pushCoupon == null) { throw new PushCouponException(1, "鎺ㄩ�佷俊鎭凡涓嶅瓨鍦�"); } + + if(pushCoupon.isPushed()) { + throw new PushCouponException(1, "璇ヤ俊鎭笉鑳介噸澶嶆帹閫�"); + } + String title = pushCoupon.getTitle(); String content = pushCoupon.getContent(); @@ -142,24 +148,35 @@ } + List<String> listuid = null; String uids = pushCoupon.getUids(); - if (uids == null || uids.trim().length() == 0) { + if (uids != null && uids.trim().length() > 0) { + listuid = Arrays.asList(uids.split(",")); + if (listuid == null || listuid.size() == 0) { + throw new PushCouponException(1, "鐢ㄦ埛id鏍煎紡涓嶆纭�"); + } + } + + List<String> listVersion = null; + String versions = pushCoupon.getVersions(); + if (versions != null && versions.trim().length() > 0) { + listVersion = Arrays.asList(versions.split(",")); + if (listVersion == null || listVersion.size() == 0) { + throw new PushCouponException(1, "鐗堟湰鍙锋牸寮忎笉姝g‘\""); + } + } + + if (listuid == null) { // 鍏ㄦ帹 - pushService.pushWelfareCenter(null, title, content); + pushService.pushWelfareCenter(null, title, content, listVersion); } else { // 鎸囧畾鐢ㄦ埛鎺ㄩ�� - String[] uidArray = uids.split(","); - - if (uidArray != null) { - for (int i = 0; i < uidArray.length; i++) { - String str_uid = uidArray[i]; - if (str_uid != null && str_uid.trim().length() > 0) { - pushService.pushWelfareCenter(Long.parseLong(str_uid), title, content); - } + for (String str_uid: listuid) { + if (str_uid != null && str_uid.trim().length() > 0) { + pushService.pushWelfareCenter(Long.parseLong(str_uid), title, content, listVersion); } } - } // 宸叉帹閫� -- Gitblit v1.8.0