| | |
| | | import com.yeshi.fanli.service.inter.goods.TaoBaoClassService;
|
| | | import com.yeshi.fanli.service.inter.lable.LabelClassService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.FilePathEnum;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | |
|
| | | @Service
|
| | |
| | | String type = contentType.substring(contentType.indexOf("/") + 1);
|
| | |
|
| | | // 文件路径
|
| | | String filePath = "/img/GoodsSubClass/" + UUID.randomUUID().toString().replace("-", "") + "." + type;
|
| | | String filePath =FilePathEnum.goodsSubClass.getPath() + UUID.randomUUID().toString().replace("-", "") + "." + type;
|
| | | // 执行上传
|
| | | String fileLink = COSManager.getInstance().uploadFile(inputStream, filePath).getUrl();
|
| | |
|
| | |
| | | */
|
| | | @Override
|
| | | public int removePicture(GoodsSubClass record) throws Exception {
|
| | |
|
| | | String fileUrl = record.getPicture();
|
| | |
|
| | | int result = -2;
|
| | | boolean deleteFile = true;
|
| | |
|
| | | String fileUrl = record.getPicture();
|
| | | if (StringUtil.isNullOrEmpty(fileUrl)) {
|
| | | return result;
|
| | | }
|
| | |
|
| | | deleteFile = COSManager.getInstance().deleteFile(fileUrl);
|
| | |
|
| | | boolean deleteFile = COSManager.getInstance().deleteFile(fileUrl);;
|
| | | if (deleteFile) {
|
| | | record.setPicture(null);
|
| | | // 更新数据库
|
| | | result = goodsSubClassMapper.updateByPrimaryKey(record);
|
| | | }
|
| | |
|
| | | return result;
|
| | | }
|
| | |
|
| | | |
| | | @Override
|
| | | public void switchState(Long id) throws GoodsSubClassException {
|
| | | if (id == null) {
|
| | | throw new GoodsSubClassException(1, "请传递正确参数");
|
| | | }
|
| | | GoodsSubClass resultObj = goodsSubClassMapper.selectByPrimaryKey(id);
|
| | | if (resultObj == null) {
|
| | | throw new GoodsSubClassException(1, "此内容已不存在");
|
| | | }
|
| | | |
| | | Integer state = resultObj.getState();
|
| | | if (state == null || state == 0) {
|
| | | state = 1;
|
| | | } else {
|
| | | state = 0;
|
| | | }
|
| | | |
| | | GoodsSubClass updateObj = new GoodsSubClass();
|
| | | updateObj.setId(id);
|
| | | updateObj.setState(state);
|
| | | goodsSubClassMapper.updateByPrimaryKeySelective(updateObj);
|
| | | }
|
| | | |
| | | |
| | | @Override
|
| | | public List<GoodsSubClass> queryByRootId(Long rootId, Integer state) throws Exception {
|
| | | return goodsSubClassMapper.queryByRootId(rootId, state, null);
|