add acts log

master
wangning 7 years ago
parent b6daea5821
commit 9981c2b36f

@ -315,3 +315,21 @@ ADD COLUMN `globalpay_openid` varchar(100) NULL AFTER `kanga_openid`;
ALTER TABLE act_app_list ADD banner_img VARCHAR(200) NULL COMMENT 'App首页banner图片';
alter table act_app_list add column `msg_start_date` date DEFAULT NULL;
alter table act_app_list add column `msg_end_date` date DEFAULT NULL;
alter table act_app_list add column `msg_interval` smallint(3) DEFAULT NULL;
alter table sys_clients add column `manual_settle` tinyint(1) DEFAULT 0;
create table log_acts_clients(
id varchar(50) not null,
client_id int(11) not null,
act_id varchar(50) not null,
act_name varchar(100) NOT NULL COMMENT '活动名称',
create_time datetime not null,
operation TINYINT(3) default 0 comment '0:noop,1:参加活动2退出活动',
PRIMARY key(`id`)
);

@ -4,7 +4,9 @@ import au.com.royalpay.payment.manage.activities.monsettledelay.core.ActMonDelay
import au.com.royalpay.payment.manage.mappers.act.ActAppMapper;
import au.com.royalpay.payment.manage.mappers.act.ActMonDelaySettleMapper;
import au.com.royalpay.payment.manage.mappers.act.ActMonDelaySettleRedPackMapper;
import au.com.royalpay.payment.manage.mappers.log.ActsClientsLogMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientAccountMapper;
import au.com.royalpay.payment.manage.merchants.core.ClientManager;
import au.com.royalpay.payment.tools.device.DeviceSupport;
import au.com.royalpay.payment.tools.env.PlatformEnvironment;
import au.com.royalpay.payment.tools.exceptions.BadRequestException;
@ -18,6 +20,7 @@ import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import com.github.miemiedev.mybatis.paginator.domain.PageList;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;
import java.math.BigDecimal;
@ -40,7 +43,10 @@ public class ActMonDelaySettleServiceImp implements ActMonDelaySettleService {
private ClientAccountMapper clientAccountMapper;
@Resource
private ActAppMapper actAppMapper;
@Resource
private ActsClientsLogMapper actsClientsLogMapper;
@Resource
private ClientManager clientManager;
@Override
public JSONObject getActNotice(JSONObject device) {
@ -96,6 +102,7 @@ public class ActMonDelaySettleServiceImp implements ActMonDelaySettleService {
}
@Override
@Transactional
public void actApply(JSONObject device) {
LocalDateTime dt = LocalDateTime.now();
if(dt.getDayOfWeek()== DayOfWeek.MONDAY && dt.getHour()<18){
@ -112,8 +119,6 @@ public class ActMonDelaySettleServiceImp implements ActMonDelaySettleService {
if (new Date().compareTo(act.getDate("expire_date")) > 0) {
throw new BadRequestException("The activity has expired");
}
String clientType = device.getString("client_type");
deviceSupport.findRegister(clientType);
int client_id = device.getIntValue("client_id");
List<JSONObject> clientLogs = actMonDelaySettleMapper.clientLog(client_id);
if (!clientLogs.isEmpty()) {
@ -129,16 +134,20 @@ public class ActMonDelaySettleServiceImp implements ActMonDelaySettleService {
device.put("rate", params.getBigDecimal("rate") == null ? new BigDecimal(0.15) : params.getBigDecimal("rate"));
device.put("expire_time", act.getDate("expire_date"));
actMonDelaySettleMapper.save(device);
clientManager.changeManualSettle(client_id,true);
saveActClientLog(act.getString("act_id"),act.getString("act_name"), client_id,1);
}
@Override
@Transactional
public void cancelAct(JSONObject device) {
LocalDateTime dt = LocalDateTime.now();
if(dt.getDayOfWeek()== DayOfWeek.MONDAY && dt.getHour()<18){
throw new BadRequestException("每周一0点至18点为收益计算时间,暂停退出活动操作");
}
String clientType = device.getString("client_type");
deviceSupport.findRegister(clientType);
int client_id = device.getIntValue("client_id");
List<JSONObject> clientLogs = actMonDelaySettleMapper.clientLog(client_id);
if (clientLogs.isEmpty()) {
@ -148,6 +157,20 @@ public class ActMonDelaySettleServiceImp implements ActMonDelaySettleService {
clientLog.put("is_valid", 0);
clientLog.put("expire_time", new Date());
actMonDelaySettleMapper.update(clientLog);
JSONObject act = actAppMapper.getActDetail("1");
clientManager.changeManualSettle(client_id,false);
saveActClientLog(act.getString("act_id"),act.getString("act_name"), client_id,2);
}
private void saveActClientLog(String act_id,String act_name, int client_id,int operation) {
JSONObject actClientLog = new JSONObject();
actClientLog.put("act_id",act_id);
actClientLog.put("client_id",client_id);
actClientLog.put("act_name",act_name);
actClientLog.put("operation",operation);
actClientLog.put("create_time",new Date());
actsClientsLogMapper.save(actClientLog);
}
}

@ -0,0 +1,16 @@
package au.com.royalpay.payment.manage.mappers.log;
import com.alibaba.fastjson.JSONObject;
import cn.yixblog.support.mybatis.autosql.annotations.AutoMapper;
import cn.yixblog.support.mybatis.autosql.annotations.AutoSql;
import cn.yixblog.support.mybatis.autosql.annotations.SqlType;
/**
* Created by yixian on 2017-04-18.
*/
@AutoMapper(tablename = "log_acts_clients",pkName = "id")
public interface ActsClientsLogMapper {
@AutoSql(type = SqlType.INSERT)
void save(JSONObject review);
}

@ -231,6 +231,7 @@ public interface ClientManager {
void changePaymentPage(JSONObject account, String paypad_version);
void changeManualSettle(int client_id, boolean manual_settle);
void changeQRCodePaySurcharge(JSONObject account, boolean paySurcharge);

@ -2607,6 +2607,14 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
clearClientCache(clientId);
}
@Override
public void changeManualSettle(int client_id, boolean manual_settle) {
JSONObject record = new JSONObject();
record.put("client_id",client_id);
record.put("manual_settle",manual_settle);
clientMapper.update(record);
}
@Override
public void changeQRCodePaySurcharge(JSONObject account, boolean paySurcharge) {
int clientId = account.getIntValue("client_id");

Loading…
Cancel
Save