package org.fanli.config;
|
|
import java.util.Date;
|
|
import org.junit.Test;
|
import org.yeshi.utils.DateUtil;
|
|
import com.yeshi.fanli.entity.brand.BrandInfo;
|
import com.yeshi.fanli.service.inter.brand.BrandGoodsCaheService;
|
import com.yeshi.fanli.service.inter.brand.BrandInfoService;
|
import com.yeshi.fanli.util.BeanUtil;
|
import com.yeshi.fanli.util.ThreadUtil;
|
|
public class Test_Brand {
|
|
public static void main(String[] args) {
|
BrandInfoService service = BeanUtil.getBean(BrandInfoService.class);
|
long count = service.countValidByCid(null);
|
if (count == 0)
|
return;
|
|
for (int page = 0; page < (count / 50) + 1; page++) {
|
int p = page;
|
ThreadUtil.run(new Runnable() {
|
public void run() {
|
service.addShopAndGoods(p*50, 50);
|
}
|
});
|
}
|
|
}
|
|
|
// @Test
|
public void addBrandGoods() {
|
try {
|
BrandGoodsCaheService service = BeanUtil.getBean(BrandGoodsCaheService.class);
|
BrandInfo brandInfo = new BrandInfo();
|
brandInfo.setId(50L);
|
brandInfo.setName("GAP");
|
brandInfo.setShopKey("GAP");
|
brandInfo.setIcon("http://ec-1255749512.file.myqcloud.com/img/TaoBaoShop/2bb853de35d845da85b7b10df42424d4.jpeg");
|
brandInfo.setSearchKey("GAP");
|
|
service.addBrandGoods(brandInfo);
|
System.out.println("test");
|
} catch (Exception e) {
|
e.printStackTrace();
|
}
|
}
|
|
|
// @Test
|
public void removeAgoByDate() {
|
try {
|
BrandInfoService service = BeanUtil.getBean(BrandInfoService.class);
|
|
service.removeAgoByDate(DateUtil.reduceDay(1, new Date()));
|
|
System.out.println("test");
|
} catch (Exception e) {
|
e.printStackTrace();
|
}
|
}
|
|
|
|
|
|
}
|