From 106a09463e66ffe39383bdab28f501ec47b5fcc4 Mon Sep 17 00:00:00 2001 From: yujian <yujian@163.com> Date: 星期一, 18 五月 2020 14:07:16 +0800 Subject: [PATCH] 最新订单号 --- fanli/src/main/java/com/yeshi/fanli/service/impl/dynamic/GoodsEvaluateServiceImpl.java | 49 ++++++++++++++++++++++++++++++++++++++++++++----- 1 files changed, 44 insertions(+), 5 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/dynamic/GoodsEvaluateServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/dynamic/GoodsEvaluateServiceImpl.java index 2ff11ab..c720981 100644 --- a/fanli/src/main/java/com/yeshi/fanli/service/impl/dynamic/GoodsEvaluateServiceImpl.java +++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/dynamic/GoodsEvaluateServiceImpl.java @@ -253,6 +253,31 @@ } return null; } + + private ImgInfo uploadOriginalPicture(MultipartFile file) { + try { + InputStream inputStream = file.getInputStream(); + String contentType = file.getContentType(); + String type = contentType.substring(contentType.indexOf("/") + 1); + String filePath = FilePathEnum.goodsEvaluate.getPath() + UUID.randomUUID().toString().replace("-", "") + "."+ type; + + BufferedImage sourceImg = ImageIO.read(inputStream); + ImgInfo info = new ImgInfo(); + int width = sourceImg.getWidth(); + int height = sourceImg.getHeight(); + + String picLink = COSManager.getInstance().uploadFile(file.getInputStream(), filePath).getUrl(); + + info.setH(height); + info.setW(width); + info.setUrl(picLink); + return info; + } catch (Exception e) { + e.printStackTrace(); + } + return null; + } + private String uploadPicture(File file, String contentType) throws Exception { InputStream inputStream = new FileInputStream(file); @@ -1078,6 +1103,7 @@ } } + String activityUrl = imgInfo.getActivityUrl(); // 缂栬緫鍥剧墖 List<ImgInfo> tempList = new ArrayList<ImgInfo>(); if (!StringUtil.isNullOrEmpty(picUrls)) { @@ -1089,6 +1115,7 @@ if (listOld != null) { for (ImgInfo info: listOld) { if (info.getUrl().equals(picLink)) { + info.setActivityUrl(activityUrl); tempList.add(info); break; } @@ -1099,22 +1126,23 @@ } } + // 涓婁紶鏂囦欢鏇挎崲 if (fileRequest != null) { for (int i = 0; i < 9; i++) { MultipartFile file = fileRequest.getFile("file" + i); if (file != null) { - ImgInfo info = uploadVideoPicture(file); + ImgInfo info = uploadOriginalPicture(file); ImgInfo imgInfo0 = new ImgInfo(); imgInfo0.setId(UUID.randomUUID().toString().replace("-", "")); imgInfo0.setLarge(false); imgInfo0.setPid(pid); imgInfo0.setUrl(info.getUrl()); imgInfo0.setUrlHD(info.getUrl()); - imgInfo0.setType(ImgEnum.img); + imgInfo0.setType(ImgEnum.activity); imgInfo0.setW(info.getW()); imgInfo0.setH(info.getH()); - + imgInfo0.setActivityUrl(activityUrl); if (i < tempList.size()) { tempList.set(i, imgInfo0); } else { @@ -1123,6 +1151,7 @@ } } } + int lineNum = 0; int totalImg = tempList.size(); @@ -1136,6 +1165,11 @@ } else { lineNum = 3; } + } + + // 涓�寮犲浘鏄剧ず涓哄ぇ鍥� + if (tempList.size() == 1) { + tempList.get(0).setLarge(true); } if (tempList.size() > 0) { @@ -1157,7 +1191,7 @@ } } - resultObj.setJumpLink(imgInfo.getActivityUrl()); + resultObj.setJumpLink(activityUrl); resultObj.setLineNum(lineNum); resultObj.setImgList(listImg); goodsEvaluateDao.save(resultObj); @@ -1596,7 +1630,7 @@ } // 鎸夌収鍙戝竷鏄剧ず鏃堕棿娈佃捣濮嬫椂闂翠负鍑嗐�� - goodsEvaluate.setPublishTime(goodsEvaluate.getStartTime()); + evaluateNew.setPublishTime(evaluateNew.getStartTime()); List<CommentInfo> comments = evaluateNew.getComments(); if (comments != null && comments.size() > 0) { @@ -2425,6 +2459,9 @@ * 鍒犻櫎宸茶繃鏈熸椂闂� */ private void removeOverdue() { + if(1>0) + return; + List<GoodsEvaluate> list = goodsEvaluateDao.queryOverdue(); if (list == null || list.size() == 0) { return; @@ -2449,6 +2486,8 @@ * 鍒犻櫎鍟嗗搧宸蹭笅鏋�-鍗曞搧 */ private void removeDownGoods() { + if(1>0) + return; try { List<GoodsEvaluate> list = goodsEvaluateDao.removeDownGoods(); if (list == null || list.size() == 0) { -- Gitblit v1.8.0