From 14a0ac73a4cd9dcb4fd3d14363de639ab830c003 Mon Sep 17 00:00:00 2001 From: yujian <yujian@163.com> Date: 星期二, 10 十二月 2019 17:40:29 +0800 Subject: [PATCH] 清理test --- fanli/src/main/java/com/yeshi/fanli/controller/TestController.java | 262 ---------------------------------------------------- 1 files changed, 1 insertions(+), 261 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/TestController.java b/fanli/src/main/java/com/yeshi/fanli/controller/TestController.java index 3dc6394..a69f674 100644 --- a/fanli/src/main/java/com/yeshi/fanli/controller/TestController.java +++ b/fanli/src/main/java/com/yeshi/fanli/controller/TestController.java @@ -310,233 +310,7 @@ } } - /** - * 鎻掑叆閭�璇风礌鏉� - * - * @param out - */ - @RequestMapping(value = "uploadInviteMaterial") - public void uploadInviteMaterial(PrintWriter out) { - try { - List<InviteMaterial> list = new ArrayList<InviteMaterial>(); - // 鍥剧墖鏂囦欢 - File file = new File("E:\\Invite\\Picture"); - File[] files = file.listFiles(); - for (File filePic : files) {// 閬嶅巻杩欎釜鏁扮粍 - String name = filePic.getName(); - String prefix = name.substring(name.lastIndexOf(".") + 1); - // 涓婁紶鏂囦欢鐩稿浣嶇疆 - String filePath = "/resource/invite/everyday/" + UUID.randomUUID().toString().replace("-", "") + "." - + prefix; - - String fileUrl = COSManager.getInstance().uploadFile(filePic, filePath).getUrl(); - - System.out.println("FileName:" + name); - System.out.println("url:" + fileUrl); - - InviteMaterial inviteMaterial = new InviteMaterial(); - inviteMaterial.setState(0); - inviteMaterial.setPicture(fileUrl); - list.add(inviteMaterial); - } - - List<String> listTxt = new ArrayList<String>(); - File textfile = new File("E:\\Invite\\content.txt");// Text鏂囦欢 - BufferedReader br = new BufferedReader(new FileReader(textfile));// 鏋勯�犱竴涓狟ufferedReader绫绘潵璇诲彇鏂囦欢 - String s = ""; - while ((s = br.readLine()) != null) {// 浣跨敤readLine鏂规硶锛屼竴娆¤涓�琛� - if (StringUtil.isNullOrEmpty(s)) { - continue; - } - listTxt.add(s); - } - br.close(); - - if (list.size() == 0 || listTxt.size() == 0 || listTxt.size() < list.size()) { - return; - } - - for (int i = 0; i < list.size(); i++) { - InviteMaterial invite = list.get(i); - invite.setText(listTxt.get(i)); - inviteMaterialService.insert(invite); - } - JsonUtil.printMode(out, null, JsonUtil.loadTrueResult("涓婁紶鎴愬姛")); - } catch (Exception e) { - JsonUtil.printMode(out, null, JsonUtil.loadFalseResult("涓婁紶澶辫触")); - e.printStackTrace(); - } - } - - /** - * 鎻掑叆閭�璇风礌鏉� - * - * @param out - */ - @RequestMapping(value = "uploadInviteMaterial2") - public void uploadInviteMaterial2(PrintWriter out) { - try { - List<InviteMaterial> list = new ArrayList<InviteMaterial>(); - File picfile = new File("E:\\Invite\\pic.txt");// Text鏂囦欢 - BufferedReader brp = new BufferedReader(new FileReader(picfile));// 鏋勯�犱竴涓狟ufferedReader绫绘潵璇诲彇鏂囦欢 - String fileUrl = ""; - while ((fileUrl = brp.readLine()) != null) {// 浣跨敤readLine鏂规硶锛屼竴娆¤涓�琛� - if (StringUtil.isNullOrEmpty(fileUrl)) { - continue; - } - InviteMaterial inviteMaterial = new InviteMaterial(); - inviteMaterial.setId(UUID.randomUUID().toString().replace("-", "")); - inviteMaterial.setState(0); - inviteMaterial.setPicture(fileUrl); - list.add(inviteMaterial); - } - brp.close(); - - List<String> listTxt = new ArrayList<String>(); - File textfile = new File("E:\\Invite\\content.txt");// Text鏂囦欢 - BufferedReader br = new BufferedReader(new FileReader(textfile));// 鏋勯�犱竴涓狟ufferedReader绫绘潵璇诲彇鏂囦欢 - String s = ""; - while ((s = br.readLine()) != null) {// 浣跨敤readLine鏂规硶锛屼竴娆¤涓�琛� - if (StringUtil.isNullOrEmpty(s)) { - continue; - } - listTxt.add(s); - } - br.close(); - - if (list.size() == 0 || listTxt.size() == 0 || listTxt.size() < list.size()) { - return; - } - - for (int i = 0; i < list.size(); i++) { - InviteMaterial invite = list.get(i); - invite.setText(listTxt.get(i)); - inviteMaterialService.insert(invite); - } - JsonUtil.printMode(out, null, JsonUtil.loadTrueResult("涓婁紶鎴愬姛")); - } catch (Exception e) { - JsonUtil.printMode(out, null, JsonUtil.loadFalseResult("涓婁紶澶辫触")); - e.printStackTrace(); - } - } - - /** - * 鎻掑叆閭�璇风礌鏉� - * - * @param out - */ - @RequestMapping(value = "saveInvite") - public void saveInvite(InviteMaterial inviteMaterial, PrintWriter out) { - try { - inviteMaterial.setState(0); - inviteMaterialService.insert(inviteMaterial); - JsonUtil.printMode(out, null, JsonUtil.loadTrueResult("涓婁紶鎴愬姛")); - } catch (Exception e) { - JsonUtil.printMode(out, null, JsonUtil.loadFalseResult("涓婁紶澶辫触")); - e.printStackTrace(); - } - } - - /** - * 鎻掑叆閭�璇风礌鏉� - * - * @param out - */ - @RequestMapping(value = "insertTimeInvite") - public void insertTimeInvite(PrintWriter out) { - try { - dynamicInfoService.insertTimeInvite(); - JsonUtil.printMode(out, null, JsonUtil.loadTrueResult("鎿嶄綔鎴愬姛")); - } catch (Exception e) { - JsonUtil.printMode(out, null, JsonUtil.loadFalseResult("鎿嶄綔澶辫触")); - e.printStackTrace(); - } - } - - /** - * 鎻掑叆閭�璇风礌鏉� - * - * @param out - */ - @RequestMapping(value = "getJingFenList") - public void getJingFenList(String callback, Integer page, Integer eliteId, PrintWriter out) { - try { - JDSearchResult result = JDApiUtil.getJingFenGoods(page, eliteId); - long count = 0; - JSONObject data = new JSONObject(); - JSONArray array = new JSONArray(); - if (result != null) { - PageEntity pageEntity = result.getPageEntity(); - if (pageEntity != null) { - count = pageEntity.getTotalCount(); - } - - List<JDGoods> goodsList = result.getGoodsList(); - if (goodsList != null && goodsList.size() > 0) { - BigDecimal fanLiRate = hongBaoManageService.getFanLiRate(); - BigDecimal shareRate = hongBaoManageService.getShareRate(); - ConfigParamsDTO paramsDTO = new ConfigParamsDTO(fanLiRate, shareRate, Constant.MAX_REWARD_RATE); - - Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder()) - .excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create(); - for (JDGoods goods : goodsList) { - GoodsDetailVO goodsDetailVO = GoodsDetailVOFactory.convertJDGoods(goods, paramsDTO); - array.add(gson.toJson(goodsDetailVO)); - } - } - } - - data.put("count", count); - data.put("list", array); - JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data)); - } catch (Exception e) { - JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鎿嶄綔澶辫触")); - e.printStackTrace(); - } - } - - /** - * 鎻掑叆閭�璇风礌鏉� - * - * @param out - */ - @RequestMapping(value = "queryExistsId") - public void queryExistsAuctionId(PrintWriter out) { - try { - List<DynamicInfo> list = dynamicInfoDao.queryExistsAuctionId(); - for (DynamicInfo dynamicInfo : list) { - List<GoodsPicture> imgs = dynamicInfo.getImgs(); - if (imgs == null || imgs.size() == 0) { - continue; - } - - boolean update = false; - for (GoodsPicture goodsPicture : imgs) { - TaoBaoGoodsBriefExtra goods = goodsPicture.getGoods(); - if (goods == null) { - continue; - } - - if (goods.getAuctionId() == null) { - update = true; - goods.setAuctionId(goods.getId()); - } - } - - if (update) { - dynamicInfo.setImgs(imgs); - dynamicInfoDao.updateGoodInfo(dynamicInfo); - } - } - JsonUtil.printMode(out, null, JsonUtil.loadTrueResult("鎿嶄綔鎴愬姛")); - // JsonUtil.printMode(out, null, - // JsonUtil.loadTrueResult(JsonUtil.getSimpleGson().toJson(list))); - } catch (Exception e) { - JsonUtil.printMode(out, null, JsonUtil.loadFalseResult("鎿嶄綔澶辫触")); - e.printStackTrace(); - } - } @RequestMapping(value = "getWaitingThreadsCount") public void getWaitingThreadsCount(PrintWriter out) { @@ -592,42 +366,8 @@ out.print("success"); } - @RequestMapping(value = "testListTLJGoods") - public void getGoodsList(String callback, PrintWriter out) { - SearchFilter sf = new SearchFilter(); - sf.setQuan(1); - sf.setTmall(true); - // sf.setEndPrice(new BigDecimal(1000)); - sf.setPage(1); - sf.setPage(100); - sf.setCateIds("16"); - sf.setSort(TaoBaoUtil.SORT_SALE_HIGH_TO_LOW); - TaoBaoSearchResult result = TaoKeApiUtil.searchWuLiao(sf); - Gson gson = new Gson(); - JSONArray array = new JSONArray(); - for (TaoBaoGoodsBrief goods : result.getTaoBaoGoodsBriefs()) { - array.add(gson.toJson(TaoBaoUtil.getTaoBaoGoodsBriefExtra(goods, "100", null))); - } - out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(array))); - } - - /** - * 鎻掑叆閭�璇风礌鏉� - * - * @param out - */ - @RequestMapping(value = "addInviteOrderLevelOne") - public void addInviteOrderLevelOne(PrintWriter out) { - try { - System.out.println("-------------璇锋眰---------------"); - integralGetService.addShareSingleGoods(974767L); - JsonUtil.printMode(out, null, JsonUtil.loadTrueResult("鎿嶄綔鎴愬姛")); - } catch (Exception e) { - JsonUtil.printMode(out, null, JsonUtil.loadFalseResult("鎿嶄綔澶辫触")); - e.printStackTrace(); - } - } + @RequestMapping("getLocalTime") public void getLocalTime(PrintWriter out) { -- Gitblit v1.8.0