| | |
| | | package com.yeshi.fanli.controller;
|
| | |
|
| | | import java.io.File;
|
| | | import java.io.IOException;
|
| | | import java.io.InputStream;
|
| | | import java.io.PrintWriter;
|
| | | import java.math.BigDecimal;
|
| | |
| | | import javax.annotation.Resource;
|
| | | import javax.servlet.http.HttpServletRequest;
|
| | |
|
| | | import org.jsoup.Jsoup;
|
| | | import org.jsoup.nodes.Document;
|
| | | import org.jsoup.select.Elements;
|
| | | import org.quartz.JobExecutionContext;
|
| | | import org.quartz.Scheduler;
|
| | | import org.quartz.SchedulerException;
|
| | | import org.springframework.cache.ehcache.EhCacheCacheManager;
|
| | | import org.springframework.stereotype.Controller;
|
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | | import org.yeshi.utils.HttpUtil;
|
| | |
| | | import com.yeshi.fanli.exception.taobao.TaobaoGoodsDownException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.activity.ActivityService;
|
| | | import com.yeshi.fanli.service.inter.config.ConfigService;
|
| | | import com.yeshi.fanli.service.inter.dynamic.DynamicInfoService;
|
| | | import com.yeshi.fanli.service.inter.goods.TaoBaoGoodsBriefService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.FileUtil;
|
| | | import com.yeshi.fanli.util.RedisManager;
|
| | |
| | | private HelpCenterMapper helpCenterMapper;
|
| | | @Resource
|
| | | private Scheduler scheduler;
|
| | | |
| | | @Resource
|
| | | private DynamicInfoService dynamicInfoService;
|
| | | |
| | | @Resource
|
| | | private TaoBaoGoodsBriefService taoBaoGoodsBriefService;
|
| | | |
| | |
|
| | | @Resource
|
| | | private EhCacheCacheManager ehCacheCacheManager;
|
| | |
|
| | | @Resource
|
| | | private ConfigService configService;
|
| | |
|
| | | @RequestMapping(value = "testimg")
|
| | | public void testImg(HttpServletRequest request, PrintWriter out) {
|
| | |
| | | long startDTime = System.currentTimeMillis();
|
| | |
|
| | | /*
|
| | | * try { //ImageUtil.drawGoodsShareImg(new FileInputStream(new
|
| | | * File(destPath)), portrait, goods, shareImgPath); } catch
|
| | | * (FileNotFoundException e) { e.printStackTrace(); }
|
| | | * try { //ImageUtil.drawGoodsShareImg(new FileInputStream(new File(destPath)),
|
| | | * portrait, goods, shareImgPath); } catch (FileNotFoundException e) {
|
| | | * e.printStackTrace(); }
|
| | | */
|
| | | System.out.println(System.currentTimeMillis() - startDTime);
|
| | |
|
| | |
| | | @RequestMapping(value = "testactivity")
|
| | | public void test2(PrintWriter out) {
|
| | | List<RecommendActivity> list = activityService.getRecommendActivityList(1, Constant.PAGE_SIZE);
|
| | | long count = activityService.getRecommendActivityCount();
|
| | | long count = activityService.getRecommendActivityCount(null);
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("data", getGson().toJson(list));
|
| | | data.put("count", count);
|
| | |
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | @RequestMapping(value = "testhtml")
|
| | | public void testhtml(PrintWriter out) {
|
| | | out.print("<script>yestv.finishPage();</script>");
|
| | | out.close();
|
| | | }
|
| | | |
| | | |
| | | /**
|
| | | * 清除缓存
|
| | | * |
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "removeCache")
|
| | | public void removeCache(PrintWriter out) {
|
| | | ehCacheCacheManager.getCacheManager().clearAll();
|
| | | }
|
| | |
|
| | | @RequestMapping(value = "testConfig")
|
| | | public void getTestConfig(PrintWriter pw) {
|
| | | pw.print(configService.get("test"));
|
| | | }
|
| | |
|
| | | @RequestMapping(value = "testDaTaoKe")
|
| | | public void getTestDaTaoKe(PrintWriter pw) {
|
| | | try {
|
| | | Document doc = Jsoup.connect("http://www.dataoke.com/brandFeature").get();
|
| | | Elements els = doc.getElementsByTag("script");
|
| | | for (int i = 0; i < els.size(); i++) {
|
| | | if (els.get(i).html().contains("var brandData")) {
|
| | | pw.print(els.get(i).html().replace("var brandData =", "").trim().split("};")[0] + "}");
|
| | | }
|
| | | }
|
| | | } catch (IOException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | | @RequestMapping(value = "insetDynamicInfo")
|
| | | public void insetDynamicInfo(PrintWriter out) {
|
| | | String content= "emoji六一儿童节来了\r\n" + |
| | | "老少儿童们到快活起来吧:用童真憧憬人生\r\n" + |
| | | "emoji用童趣装点人生emoji\r\n" + |
| | | "用童话描绘人生emoji\r\n" + |
| | | "用童心度过人生 emoji \r\n" + |
| | | "--------------------- \r\n今天 : 6月1日 ️ 星期四\r\n" + |
| | | "天气 : 晴转多云 15-24℃\r\n" + |
| | | "各位亲爱的你 早安~\r\n" + |
| | | "购物省钱返利券App:【邀请链接】\r\n" + |
| | | "我的邀请码:【邀请码】" ;
|
| | | |
| | | dynamicInfoService.insertInviteMaterial(content, null, null, null);
|
| | | |
| | | |
| | | String content2= "emoji六一儿童节来了\r\n" + |
| | | "老少儿童们到快活起来吧:用童真憧憬人生\r\n" + |
| | | "emoji用童趣装点人生emoji\r\n" + |
| | | "用童话描绘人生emoji\r\n" + |
| | | "用童心度过人生 emoji \r\n" + |
| | | "--------------------- \r\n今天 : 6月1日 ️ 星期四\r\n" + |
| | | "天气 : 晴转多云 15-24℃\r\n" + |
| | | "各位亲爱的你 早安~\r\n" + |
| | | "购物省钱返利券App:【邀请链接】\r\n" + |
| | | "我的邀请码:【邀请码】" ;
|
| | | |
| | | dynamicInfoService.insertInviteMaterial(content2, "http://ec-1255749512.file.myqcloud.com/img/invite/53420a05de1644bd947fa23800ab0131.jpeg", null, null);
|
| | | }
|
| | |
|
| | | |
| | | @RequestMapping(value = "insertShop")
|
| | | public void insertShop(PrintWriter out) {
|
| | | try {
|
| | | dynamicInfoService.insertShopInfo();
|
| | | dynamicInfoService.insertTimeHotSale();
|
| | | dynamicInfoService.insertTimeRecommend();
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | | |
| | | }
|