eason.qian 7 years ago
parent 95c379892f
commit 288f7d5e1f

@ -261,23 +261,23 @@ CREATE TABLE act_mon_delay_settle_redpack
send_time DATETIME COMMENT '奖励发放时间' send_time DATETIME COMMENT '奖励发放时间'
); );
create table act_app_list CREATE TABLE `act_app_list` (
( `act_id` varchar(50) NOT NULL,
act_id varchar(50) not null `act_name` varchar(100) NOT NULL COMMENT '活动名称',
primary key, `act_url` varchar(400) DEFAULT NULL COMMENT '活动链接',
act_name varchar(100) not null comment '活动名称', `is_valid` tinyint(1) NOT NULL DEFAULT 0,
act_url varchar(400) default null comment '活动链接', `params_json` text DEFAULT NULL COMMENT '活动参数',
is_valid tinyint(1) default '0' not null, `create_time` datetime DEFAULT NULL,
params_json text default null comment '活动参数', `desc` varchar(400) DEFAULT NULL COMMENT '活动简介',
create_time datetime default null, `act_content` text DEFAULT NULL COMMENT 'html',
`desc` varchar(400) default null comment '活动简介', `show_type` smallint(6) DEFAULT 0 COMMENT '0:url;1:content',
act_content text default null comment 'html', `is_show_window` tinyint(4) DEFAULT 0 COMMENT 'app是否弹框',
show_type smallint(6) default '0' null comment '0:url;1:content', `act_img` varchar(200) DEFAULT NULL COMMENT '广告位图片',
is_show_window tinyint default '0' null comment 'app是否弹框', `window_img` varchar(200) DEFAULT NULL COMMENT 'app弹框图片',
act_img varchar(200) default null comment '广告位图片', `update_time` datetime DEFAULT NULL,
window_img varchar(200) default null comment 'app弹框图片', `active_date` date NOT NULL COMMENT '生效日期',
update_time datetime default null `expire_date` date DEFAULT NULL COMMENT '活动结束日期',
) PRIMARY KEY (`act_id`)
comment 'app活动' engine=InnoDB ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='app活动'
;

@ -1,6 +1,7 @@
package au.com.royalpay.payment.manage.activities.monsettledelay.core.impls; package au.com.royalpay.payment.manage.activities.monsettledelay.core.impls;
import au.com.royalpay.payment.manage.activities.monsettledelay.core.ActMonDelaySettleService; import au.com.royalpay.payment.manage.activities.monsettledelay.core.ActMonDelaySettleService;
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.ActMonDelaySettleMapper;
import au.com.royalpay.payment.manage.mappers.act.ActMonDelaySettleRedPackMapper; import au.com.royalpay.payment.manage.mappers.act.ActMonDelaySettleRedPackMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientAccountMapper; import au.com.royalpay.payment.manage.mappers.system.ClientAccountMapper;
@ -14,6 +15,7 @@ import com.github.miemiedev.mybatis.paginator.domain.Order;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds; import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import com.github.miemiedev.mybatis.paginator.domain.PageList; import com.github.miemiedev.mybatis.paginator.domain.PageList;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestBody;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.math.BigDecimal; import java.math.BigDecimal;
@ -31,8 +33,9 @@ public class ActMonDelaySettleServiceImp implements ActMonDelaySettleService{
private DeviceSupport deviceSupport; private DeviceSupport deviceSupport;
@Resource @Resource
private ClientAccountMapper clientAccountMapper; private ClientAccountMapper clientAccountMapper;
@Resource
private ActAppMapper actAppMapper;
private final static LocalDate endDate = LocalDate.of(2018,07,01);
@Override @Override
public JSONObject getActNotice(JSONObject device){ public JSONObject getActNotice(JSONObject device){
@ -50,6 +53,10 @@ public class ActMonDelaySettleServiceImp implements ActMonDelaySettleService{
@Override @Override
public JSONObject getActDetail(JSONObject device){ public JSONObject getActDetail(JSONObject device){
JSONObject act = actAppMapper.getActDetail("1");
if (!act.getBoolean("is_valid")){
throw new BadRequestException("Activity is not valid");
}
String clientType = device.getString("client_type"); String clientType = device.getString("client_type");
deviceSupport.findRegister(clientType); deviceSupport.findRegister(clientType);
int client_id = device.getIntValue("client_id"); int client_id = device.getIntValue("client_id");
@ -59,6 +66,17 @@ public class ActMonDelaySettleServiceImp implements ActMonDelaySettleService{
if (!clientLogs.isEmpty() && clientLogs.size()>0){ if (!clientLogs.isEmpty() && clientLogs.size()>0){
apply = true; apply = true;
} }
if (new Date().compareTo(act.getDate("active_date"))<0){
res.put("active",false);
res.put("active_date",act.getDate("active_date"));
res.put("expire",false);
}else if (new Date().compareTo(act.getDate("expire_date"))>0){
res.put("active",false);
res.put("expire",true);
}else {
res.put("active",true);
res.put("expire",false);
}
BigDecimal total_redpack = actMonDelaySettleRedPackMapper.getTotalRedPack(client_id); BigDecimal total_redpack = actMonDelaySettleRedPackMapper.getTotalRedPack(client_id);
PageList<JSONObject> list = actMonDelaySettleRedPackMapper.listRedpacks(client_id,new PageBounds(Order.formString("create_time.desc"))); PageList<JSONObject> list = actMonDelaySettleRedPackMapper.listRedpacks(client_id,new PageBounds(Order.formString("create_time.desc")));
res.put("apply",apply); res.put("apply",apply);
@ -69,6 +87,16 @@ public class ActMonDelaySettleServiceImp implements ActMonDelaySettleService{
@Override @Override
public void actApply(JSONObject device){ public void actApply(JSONObject device){
JSONObject act = actAppMapper.getActDetail("1");
if (!act.getBoolean("is_valid")){
throw new BadRequestException("The activity is not valid");
}
if (new Date().compareTo(act.getDate("active_date"))<0){
throw new BadRequestException("The activity has not yet begin");
}
if (new Date().compareTo(act.getDate("expire_date"))>0){
throw new BadRequestException("The activity has expired");
}
String clientType = device.getString("client_type"); String clientType = device.getString("client_type");
deviceSupport.findRegister(clientType); deviceSupport.findRegister(clientType);
int client_id = device.getIntValue("client_id"); int client_id = device.getIntValue("client_id");
@ -83,7 +111,7 @@ public class ActMonDelaySettleServiceImp implements ActMonDelaySettleService{
device.put("account_name",account.getString("display_name")); device.put("account_name",account.getString("display_name"));
device.put("create_time",new Date()); device.put("create_time",new Date());
device.put("rate",new BigDecimal(12)); device.put("rate",new BigDecimal(12));
device.put("expire_time",endDate); device.put("expire_time",act.getDate("expire_date"));
actMonDelaySettleMapper.save(device); actMonDelaySettleMapper.save(device);
} }

Loading…
Cancel
Save