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