From ccfabff97d050bc2b88bf6a76fa3cf49191e250c Mon Sep 17 00:00:00 2001 From: luoyang Date: Thu, 27 Feb 2020 10:03:25 +0800 Subject: [PATCH] =?UTF-8?q?add=20popup=E5=A2=9E=E5=8A=A0=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E6=AC=A1=E6=95=B0=E6=8E=A7=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 2 +- .../core/impls/RetailAppServiceImp.java | 67 ++++++++++++++----- .../mappers/notice/ActPartnerReadMapper.java | 23 +++++++ 3 files changed, 76 insertions(+), 16 deletions(-) create mode 100644 src/main/java/au/com/royalpay/payment/manage/mappers/notice/ActPartnerReadMapper.java diff --git a/pom.xml b/pom.xml index d3b9e1baa..eef42473c 100644 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,7 @@ 4.0.0 manage - 1.3.61 + 1.3.62 UTF-8 1.8.0 diff --git a/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailAppServiceImp.java b/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailAppServiceImp.java index a914862d4..5655d5423 100644 --- a/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailAppServiceImp.java +++ b/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailAppServiceImp.java @@ -22,6 +22,7 @@ import au.com.royalpay.payment.manage.kyc.enums.FilesAuthTypeEnum; import au.com.royalpay.payment.manage.management.clearing.core.CleanService; import au.com.royalpay.payment.manage.mappers.client.AuthAppMessageMapper; import au.com.royalpay.payment.manage.mappers.log.*; +import au.com.royalpay.payment.manage.mappers.notice.ActPartnerReadMapper; import au.com.royalpay.payment.manage.mappers.notice.NoticePartnerMapper; import au.com.royalpay.payment.manage.mappers.payment.OrderMapper; import au.com.royalpay.payment.manage.mappers.payment.TransactionMapper; @@ -227,9 +228,7 @@ public class RetailAppServiceImp implements RetailAppService { @Resource private RetailAppService retailAppService; @Resource - private ClientIncrementalMapper clientIncrementalMapper; - @Resource - private ClientServicesApplyMapper clientServicesApplyMapper; + private ActPartnerReadMapper actPartnerReadMapper; @Resource private DeviceManager deviceManager; private final String CBBANK_AGGREGATE_FILE = "https://file.royalpay.com.au/open/2019/08/05/1564972204689_uwZvpTBjtLUMcN8c540xcZvux1Rd3O.pdf"; @@ -1584,6 +1583,9 @@ public class RetailAppServiceImp implements RetailAppService { JSONObject latestAct = appActService.getAppActPopup(); if (latestAct != null) { + if (accountIsRead(device.getString("account_id"), latestAct)) { + return result; + } latestAct.put("id", latestAct.getString("act_id")); latestAct.put("url", latestAct.getString("act_url")); latestAct.put("title", latestAct.getString("act_name")); @@ -1592,19 +1594,17 @@ public class RetailAppServiceImp implements RetailAppService { act.put("data", latestAct); act.put("type", "popup"); if (StringUtils.equalsIgnoreCase("跨境商城", latestAct.getString("act_name"))) { - if (clientConfig !=null && !clientConfig.getBooleanValue("geek_shop_status") - && geekShowActVersion(device.getString("version"))) { - latestAct.remove("act_id"); - latestAct.remove("act_name"); - latestAct.remove("act_url"); - result.add(act); + boolean geekPopupShow = clientConfig != null + && !clientConfig.getBooleanValue("geek_shop_status") + && geekShowActVersion(device.getString("version")); + if (!geekPopupShow) { + return result; } - }else { - latestAct.remove("act_id"); - latestAct.remove("act_name"); - latestAct.remove("act_url"); - result.add(act); } + latestAct.remove("act_id"); + latestAct.remove("act_name"); + latestAct.remove("act_url"); + result.add(act); } return result; } @@ -2163,8 +2163,9 @@ public class RetailAppServiceImp implements RetailAppService { return; } JSONObject account = clientAccountMapper.findById(device.getString("account_id")); - if (account == null) + if (account == null) { account = new JSONObject(); + } riskProcessLogService.addRiskProcessLog(material.getString("risk_id"), account.getString("account_id"), account.getString("display_name"), @@ -3079,4 +3080,40 @@ public class RetailAppServiceImp implements RetailAppService { } return result; } + + private boolean accountIsRead(String accountId, JSONObject act) { + int displayCount = act.getIntValue("display_count"); + //0为显示无数次 + if (displayCount == 0) { + return false; + } + JSONObject account = clientAccountMapper.findById(accountId); + if (PartnerRole.getRole(account.getIntValue("role")) != PartnerRole.ADMIN + && PartnerRole.getRole(account.getIntValue("role")) != PartnerRole.MANAGER) { + return true; + } + String actId = act.getString("act_id"); + int clientId = account.getIntValue("client_id"); + JSONObject displayInfo = actPartnerReadMapper.displayInfo(actId, clientId, accountId); + if (displayInfo == null) { + displayInfo = new JSONObject(){{ + put("display_client_id", UUID.randomUUID().toString()); + put("act_id", actId); + put("client_id", clientId); + put("account_id", accountId); + put("last_read_time", new Date()); + put("display_count", 1); + }}; + actPartnerReadMapper.save(displayInfo); + return false; + } + int accountDisplayCount = displayInfo.getIntValue("display_count"); + if (accountDisplayCount < displayCount) { + displayInfo.put("last_read_time", new Date()); + displayInfo.put("display_count", (accountDisplayCount+1)); + actPartnerReadMapper.update(displayInfo); + return false; + } + return true; + } } diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/notice/ActPartnerReadMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/notice/ActPartnerReadMapper.java new file mode 100644 index 000000000..d03ea973d --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/notice/ActPartnerReadMapper.java @@ -0,0 +1,23 @@ +package au.com.royalpay.payment.manage.mappers.notice; + +import cn.yixblog.support.mybatis.autosql.annotations.AutoMapper; +import cn.yixblog.support.mybatis.autosql.annotations.AutoSql; +import cn.yixblog.support.mybatis.autosql.annotations.SqlType; +import com.alibaba.fastjson.JSONObject; +import org.apache.ibatis.annotations.Param; + + +/** + * Created by yishuqian on 29/09/2016. + */ +@AutoMapper(tablename = "sys_act_client_display", pkName = "display_client_id") +public interface ActPartnerReadMapper { + @AutoSql(type = SqlType.INSERT) + void save(JSONObject displayInfo); + + @AutoSql(type = SqlType.UPDATE) + void update(JSONObject displayInfo); + + @AutoSql(type = SqlType.SELECT) + JSONObject displayInfo(@Param("act_id") String actId, @Param("client_id") int clientId, @Param("account_id") String accountId); +}