Customer impression task

master
wangning 7 years ago
parent 743662719f
commit 974d1e09ea

@ -0,0 +1,35 @@
package au.com.royalpay.payment.manage.task;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import com.alibaba.fastjson.JSONObject;
import au.com.royalpay.payment.manage.apps.core.CustomerImpressionService;
import au.com.royalpay.payment.manage.mappers.system.ClientMapper;
/**
* Created by yishuqian on 12/03/2017.
*/
@Component
@ConditionalOnProperty(value = "app.run-tasks", havingValue = "true")
public class CustomerImpressionTask {
@Resource
private ClientMapper clientMapper;
@Resource
private CustomerImpressionService customerImpressionService;
// @Scheduled(cron = "0 0 9 * * ?")
// TODO: 10/01/2018 kira 启动执行
public void generate() {
List<JSONObject> clients = clientMapper.listValidClient();
clients.forEach(p -> {
customerImpressionService.generate(p.getIntValue("client_id"));
});
}
}

@ -1,6 +1,9 @@
package au.com.royalpay.payment.manage.apps.core.impls; package au.com.royalpay.payment.manage.apps.core.impls;
import au.com.royalpay.payment.manage.apps.core.CustomerImpressionService; import au.com.royalpay.payment.manage.apps.core.CustomerImpressionService;
import au.com.royalpay.payment.manage.mappers.system.ClientMapper;
import com.alibaba.fastjson.JSONObject;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
@ -8,20 +11,32 @@ import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.context.junit4.SpringRunner;
import java.util.List;
import javax.annotation.Resource; import javax.annotation.Resource;
/** /**
* Created by wangning on 05/01/2018. * Created by wangning on 05/01/2018.
*/ */
@SpringBootTest @SpringBootTest
@ActiveProfiles({"proxy","alipay","wechat","jd","bestpay"}) @ActiveProfiles({"local","alipay","wechat","jd","bestpay"})
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
public class CustomerImpressionImplTest { public class CustomerImpressionImplTest {
@Resource @Resource
private CustomerImpressionService customerImpression; private CustomerImpressionService customerImpression;
@Resource
private ClientMapper clientMapper;
@Test @Test
public void generate() throws Exception { public void generate() throws Exception {
customerImpression.generate(9); customerImpression.generate(9);
} }
@Test
public void generateAll(){
List<JSONObject> clients = clientMapper.listValidClient();
clients.forEach(p -> {
customerImpression.generate(p.getIntValue("client_id"));
});
}
} }
Loading…
Cancel
Save