From 69bee82b81626b82b7f39f0e459e4f56b1699b51 Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期三, 13 三月 2019 12:02:16 +0800 Subject: [PATCH] 正式数据库修改 --- fanli/src/main/java/com/yeshi/fanli/service/impl/push/PushServiceImpl.java | 55 +++++++++++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 49 insertions(+), 6 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/push/PushServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/push/PushServiceImpl.java index 458d1ac..9cf9fcd 100644 --- a/fanli/src/main/java/com/yeshi/fanli/service/impl/push/PushServiceImpl.java +++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/push/PushServiceImpl.java @@ -22,6 +22,7 @@ import com.yeshi.fanli.service.inter.user.AccountMessageService; import com.yeshi.fanli.service.inter.user.SystemZnxService; import com.yeshi.fanli.util.Constant; +import com.yeshi.fanli.util.StringUtil; @Service public class PushServiceImpl implements PushService { @@ -54,20 +55,24 @@ @Resource private XMPushService xmPushService; - @Resource private PushRecordMapper pushRecordMapper; - + @Resource private AccountMessageMapper accountMessageMapper; - - + @Async("pushExecutor") @Override public void pushGoods(Long uid, String url, String title, String content) throws PushException { String gids = url.split("id=")[1]; String gid = gids.split("&")[0]; + if (StringUtil.isNullOrEmpty(gid)) + throw new PushException(1, "鍟嗗搧瑙f瀽澶辫触"); + if (StringUtil.isNullOrEmpty(title)) + throw new PushException(1, "璇峰~鍐欐帹閫佹爣棰�"); + if (StringUtil.isNullOrEmpty(content)) + throw new PushException(1, "璇峰~鍐欐帹閫佸唴瀹�"); PushRecord pushRecord = new PushRecord(); pushRecord.setState(1); @@ -76,10 +81,11 @@ pushRecord.setTitle(title); pushRecord.setAppName(Constant.systemCommonConfig.getProjectChineseName()); pushRecord.setAccount(1); + pushRecord.setCreatetime(java.lang.System.currentTimeMillis()); xmPushService.pushGoods(uid, Long.parseLong(gid), title, content); iosPushService.pushGoods(uid, Long.parseLong(gid), title, content); - //hwPushService.pushGoods(uid, Long.parseLong(gid), title, content); + // hwPushService.pushGoods(uid, Long.parseLong(gid), title, content); pushRecordMapper.insertSelective(pushRecord); } @@ -87,12 +93,21 @@ @Async("pushExecutor") @Override public void pushUrl(Long uid, String url, String title, String content) throws PushException { + + if (StringUtil.isNullOrEmpty(url)) + throw new PushException(1, "鏃犳帹閫侀摼鎺�"); + if (StringUtil.isNullOrEmpty(title)) + throw new PushException(1, "鏃犳帹閫佹爣棰�"); + if (StringUtil.isNullOrEmpty(content)) + throw new PushException(1, "鏃犳帹閫佸唴瀹�"); + PushRecord pushRecord = new PushRecord(); pushRecord.setState(1); pushRecord.setType(PushController.URL); pushRecord.setUrl(url); pushRecord.setTitle(title); pushRecord.setAppName(Constant.systemCommonConfig.getProjectChineseName()); + pushRecord.setCreatetime(java.lang.System.currentTimeMillis()); xmPushService.pushUrl(uid, url, title, content); iosPushService.pushUrl(uid, url, title, content); @@ -103,9 +118,13 @@ @Async("pushExecutor") @Override public void pushZNX(Long uId, String title, String content) throws PushException { + if (StringUtil.isNullOrEmpty(title)) + throw new PushException(1, "鏃犳帹閫佹爣棰�"); + if (StringUtil.isNullOrEmpty(content)) + throw new PushException(1, "鏃犳帹閫佸唴瀹�"); /* 鏃爑id , 骞挎挱 鏁版嵁鎻掑叆绯荤粺琛� */ - if (uId == null||uId==0) { + if (uId == null || uId == 0) { // 鎻掑叆鏁版嵁搴擄紙绯荤粺绔欏唴淇℃暟鎹級 SystemZnx systemZnx = new SystemZnx(); systemZnx.setTitle(title); @@ -118,6 +137,8 @@ pushRecord.setState(1); // 鎴愬姛 pushRecord.setType(4); // 绫诲瀷锛氱珯鍐呬俊 pushRecord.setAppName(Constant.systemCommonConfig.getProjectChineseName()); + pushRecord.setCreatetime(java.lang.System.currentTimeMillis()); + xmPushService.pushZNX(uId, null, systemZnx); iosPushService.pushZNX(uId, null, systemZnx); hwPushService.pushZNX(uId, null, systemZnx); @@ -143,9 +164,31 @@ pushRecord.setState(1); // 鎴愬姛 pushRecord.setType(PushController.ZNX); // 绫诲瀷锛氱珯鍐呬俊 pushRecord.setAppName(Constant.systemCommonConfig.getProjectChineseName()); + pushRecord.setCreatetime(java.lang.System.currentTimeMillis()); + pushRecordMapper.insertSelective(pushRecord); } } + @Override + public void pushWEEX(Long uid, String title, String content, String weexUrl) throws PushException { + if (StringUtil.isNullOrEmpty(title)) + throw new PushException(1, "鏃犳帹閫佹爣棰�"); + if (StringUtil.isNullOrEmpty(content)) + throw new PushException(1, "鏃犳帹閫佸唴瀹�"); + iosPushService.pushWEEX(uid, title, content, weexUrl); + } + + @Override + public void pushBaiChuanUrl(Long uid, String title, String content, String url) throws PushException { + iosPushService.pushBaiChuanUrl(uid, title, content, url); + xmPushService.pushBaiChuanUrl(uid, title, content, url); + } + + @Override + public void pushWelfareCenter(Long uid, String title, String content) throws PushException { + iosPushService.pushWelfareCenter(uid, title, content); + xmPushService.pushWelfareCenter(uid, title, content); + } } -- Gitblit v1.8.0