|
|
|
@ -5,16 +5,14 @@ import au.com.royalpay.payment.manage.merchants.core.ClientConfigService;
|
|
|
|
|
import au.com.royalpay.payment.manage.merchants.core.ClientManager;
|
|
|
|
|
import au.com.royalpay.payment.manage.merchants.events.ClientSignEvent;
|
|
|
|
|
import au.com.royalpay.payment.tools.merchants.core.MerchantInfoProvider;
|
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
|
|
|
|
|
import org.joda.time.DateTime;
|
|
|
|
|
import org.springframework.context.ApplicationListener;
|
|
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Created by yixian on 2017-04-11.
|
|
|
|
@ -32,16 +30,16 @@ public class NewRateEventListener implements ApplicationListener<ClientSignEvent
|
|
|
|
|
public void onApplicationEvent(ClientSignEvent event) {
|
|
|
|
|
if (event.getEventId() == 1) {
|
|
|
|
|
JSONObject client = clientManager.getClientInfo(event.getClientId());
|
|
|
|
|
if(client == null){
|
|
|
|
|
if (client == null) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
JSONObject clientConfig = clientConfigService.find(event.getClientId());
|
|
|
|
|
JSONObject currentRate = merchantInfoProvider.clientCurrentRate(event.getClientId(), new Date(),"Wechat");
|
|
|
|
|
JSONObject currentRate = merchantInfoProvider.clientCurrentRate(event.getClientId(), new Date(), "Wechat");
|
|
|
|
|
ClientRateConfig rate = new ClientRateConfig();
|
|
|
|
|
rate.setActiveTime(new DateTime(2017, 5, 1, 0, 0, 0, 0).toDate());
|
|
|
|
|
rate.setExpiryTime(new DateTime(2018, 5, 1, 0, 0, 0, 0).toDate());
|
|
|
|
|
rate.setCleanDays(currentRate.getInteger("clean_days") == null ? clientConfig.getIntValue("clean_days") : currentRate.getIntValue("clean_days"));
|
|
|
|
|
rate.setRateValue(Math.min(1.4, currentRate.getDoubleValue("rate_value")));
|
|
|
|
|
rate.setRateValue(BigDecimal.valueOf(1.4).min(currentRate.getBigDecimal("rate_value")));
|
|
|
|
|
JSONObject mockManager = new JSONObject();
|
|
|
|
|
mockManager.put("manager_id", 0);
|
|
|
|
|
mockManager.put("display_name", "System");
|
|
|
|
|