| | |
| | | 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;
|
| | |
|
| | |
| | | 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) {
|
| | |
| | |
|
| | |
|
| | | @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) {
|
| | |
| | | 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 {
|
| | | record.setSearchJson(params);
|
| | | } else if (!StringUtil.isJson(params)) {
|
| | | throw new GoodsSubClassException(1, "筛选条件非JSON格式");
|
| | | }
|
| | |
|
| | | Long id = record.getId();
|
| | |
| | |
|
| | | record.setLevel(type);
|
| | | record.setPicture(picture);
|
| | | record.setPictureSecond(pictureSecond);
|
| | | record.setState(0);
|
| | | record.setAndroidClick(0L);
|
| | | record.setIosClick(0L);
|
| | |
| | | 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());
|