add popup增加显示次数控制

master
luoyang 5 years ago
parent 40cd2efb7b
commit ccfabff97d

@ -9,7 +9,7 @@
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>manage</artifactId>
<version>1.3.61</version>
<version>1.3.62</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jib-maven-plugin.version>1.8.0</jib-maven-plugin.version>

@ -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;
}
}

@ -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);
}
Loading…
Cancel
Save