From 553e4585a5ec8e2c22b50e33a27d14ead6fd034d Mon Sep 17 00:00:00 2001 From: yujian <yujian> Date: 星期五, 26 四月 2019 15:16:07 +0800 Subject: [PATCH] 店铺足迹删除+ 假删除 --- fanli/src/main/java/com/yeshi/fanli/service/impl/goods/GoodsSubClassServiceImpl.java | 30 ++++++++++++++++++++++++++++-- 1 files changed, 28 insertions(+), 2 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/goods/GoodsSubClassServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/goods/GoodsSubClassServiceImpl.java index 30f95ce..6f618fd 100644 --- a/fanli/src/main/java/com/yeshi/fanli/service/impl/goods/GoodsSubClassServiceImpl.java +++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/goods/GoodsSubClassServiceImpl.java @@ -6,10 +6,10 @@ import java.util.UUID; import javax.annotation.Resource; -import javax.transaction.Transactional; import org.springframework.cache.annotation.Cacheable; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import org.springframework.web.multipart.MultipartFile; import org.yeshi.utils.tencentcloud.COSManager; @@ -96,6 +96,12 @@ COSManager.getInstance().deleteFile(picture); } + /* 鍒犻櫎缃戠粶鍥剧墖 */ + String pictureSecond = goodsSubClass.getPictureSecond(); + if (!StringUtil.isNullOrEmpty(pictureSecond)) { + COSManager.getInstance().deleteFile(pictureSecond); + } + /* 鍒犻櫎鎵�鏈夊叧鑱斿瓙绫� */ List<GoodsSubClass> subList = goodsSubClassMapper.queryByPid(recordId, null); if (subList != null && subList.size() > 0) { @@ -116,7 +122,7 @@ @Override - public void saveObject(MultipartFile file, GoodsSubClass record, Integer type, Long pid) throws GoodsSubClassException, Exception{ + public void saveObject(MultipartFile file, MultipartFile file2, GoodsSubClass record, Integer type, Long pid) throws GoodsSubClassException, Exception{ String name = record.getName(); if (name == null || name.trim().length() == 0) { @@ -129,9 +135,18 @@ picture = uploadPicture(file); } + // 鍥剧墖涓婁紶 + String pictureSecond = null; + if (file2 != null) { + pictureSecond = uploadPicture(file2); + } + + String params = record.getSearchParam(); if (params== null || params.trim().length() == 0 || "null".equalsIgnoreCase(params)) { record.setSearchJson(null); + } else if (!StringUtil.isJson(params)) { + throw new GoodsSubClassException(1, "绛涢�夋潯浠堕潪JSON鏍煎紡"); } else { record.setSearchJson(params); } @@ -168,6 +183,7 @@ record.setLevel(type); record.setPicture(picture); + record.setPictureSecond(pictureSecond); record.setState(0); record.setAndroidClick(0L); record.setIosClick(0L); @@ -197,6 +213,16 @@ record.setPicture(resultObj.getPicture()); } + + if (pictureSecond != null && pictureSecond.trim().length() > 0) { + // 鍒犻櫎鑰佸浘 + removePicture(resultObj.getPictureSecond()); + // 瀛樺偍鏂板浘 + record.setPictureSecond(pictureSecond); + } else { + record.setPictureSecond(resultObj.getPictureSecond()); + } + record.setLevel(resultObj.getLevel()); record.setRootClass(resultObj.getRootClass()); record.setWeight(resultObj.getWeight()); -- Gitblit v1.8.0