|
|
|
@ -1,6 +1,7 @@
|
|
|
|
|
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.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.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.PageList;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
@ -31,8 +33,9 @@ public class ActMonDelaySettleServiceImp implements ActMonDelaySettleService{
|
|
|
|
|
private DeviceSupport deviceSupport;
|
|
|
|
|
@Resource
|
|
|
|
|
private ClientAccountMapper clientAccountMapper;
|
|
|
|
|
@Resource
|
|
|
|
|
private ActAppMapper actAppMapper;
|
|
|
|
|
|
|
|
|
|
private final static LocalDate endDate = LocalDate.of(2018,07,01);
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public JSONObject getActNotice(JSONObject device){
|
|
|
|
@ -50,6 +53,10 @@ public class ActMonDelaySettleServiceImp implements ActMonDelaySettleService{
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
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");
|
|
|
|
|
deviceSupport.findRegister(clientType);
|
|
|
|
|
int client_id = device.getIntValue("client_id");
|
|
|
|
@ -59,6 +66,17 @@ public class ActMonDelaySettleServiceImp implements ActMonDelaySettleService{
|
|
|
|
|
if (!clientLogs.isEmpty() && clientLogs.size()>0){
|
|
|
|
|
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);
|
|
|
|
|
PageList<JSONObject> list = actMonDelaySettleRedPackMapper.listRedpacks(client_id,new PageBounds(Order.formString("create_time.desc")));
|
|
|
|
|
res.put("apply",apply);
|
|
|
|
@ -69,6 +87,16 @@ public class ActMonDelaySettleServiceImp implements ActMonDelaySettleService{
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
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");
|
|
|
|
|
deviceSupport.findRegister(clientType);
|
|
|
|
|
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("create_time",new Date());
|
|
|
|
|
device.put("rate",new BigDecimal(12));
|
|
|
|
|
device.put("expire_time",endDate);
|
|
|
|
|
device.put("expire_time",act.getDate("expire_date"));
|
|
|
|
|
actMonDelaySettleMapper.save(device);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|