Commit 871c5d01 authored by shiyu's avatar shiyu

上传藏品

parent bbbfac84
...@@ -472,6 +472,8 @@ public class SupplierItemServiceImpl implements SupplierItemService { ...@@ -472,6 +472,8 @@ public class SupplierItemServiceImpl implements SupplierItemService {
supplierItem.setImages(dto.getImages()); supplierItem.setImages(dto.getImages());
supplierItem.setVideos(dto.getVideos()); supplierItem.setVideos(dto.getVideos());
supplierItem.setSort(1); supplierItem.setSort(1);
supplierItem.setBuyLimitNum(1);
supplierItem.setStock(1);
Date now = new Date(); Date now = new Date();
supplierItem.setCreateTime(now); supplierItem.setCreateTime(now);
supplierItem.setUpdateTime(now); supplierItem.setUpdateTime(now);
......
package com.wwdz.ch.wx.web.distribution;
import com.alibaba.fastjson.JSON;
import com.wwdz.ch.core.consts.ResultCode;
import com.wwdz.ch.core.type.Result;
import com.wwdz.ch.db.dto.request.distribution.AuctionRecordRequestDto;
import com.wwdz.ch.db.dto.request.distribution.CollectionBookRequestDto;
import com.wwdz.ch.wx.service.distribution.CollectionBookService;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/wx/collectionBook")
public class CollectionBookController {
private static final Logger logger = LoggerFactory.getLogger(CollectionBookController.class);
@Autowired
CollectionBookService collectionBookService;
@ApiOperation(value = "新建藏品标签")
@PostMapping("/create")
public Result create(@RequestBody CollectionBookRequestDto dto) {
logger.info("新建藏品标签,请求参数:{}", JSON.toJSONString(dto));
if (dto.getUserId() == null) {
return Result.failed(ResultCode.PARAM_ERROR);
}
return collectionBookService.create(dto);
}
@ApiOperation(value = "查询藏品标签")
@PostMapping("/findList")
public Result findList(@RequestBody CollectionBookRequestDto dto) {
logger.info("查询藏品标签,请求参数:{}", JSON.toJSONString(dto));
if (dto.getUserId() == null) {
return Result.failed(ResultCode.PARAM_ERROR);
}
return collectionBookService.findList(dto);
}
@ApiOperation(value = "删除藏品标签")
@PostMapping("/delete")
public Result delete(@RequestBody CollectionBookRequestDto dto) {
logger.info("删除藏品标签,请求参数:{}", JSON.toJSONString(dto));
if (dto.getUserId() == null) {
return Result.failed(ResultCode.PARAM_ERROR);
}
return collectionBookService.delete(dto);
}
}
...@@ -80,4 +80,29 @@ public class SupplierItemController { ...@@ -80,4 +80,29 @@ public class SupplierItemController {
} }
return supplierItemService.findAuctionDetail(dto); return supplierItemService.findAuctionDetail(dto);
} }
@ApiOperation(value = "上传藏品")
@PostMapping("/upload")
public Result upload(@RequestBody SupplierItemRequestDto dto) {
logger.info("上传藏品,请求参数:{}", JSON.toJSONString(dto));
Validator validator = new Validator(FormHandler.ofEntity(dto));
validator.set("name", "商品名称").must().string()
.end();
if (!validator.isValid()) {
return Result.failed(validator.getErrorInfo());
}
return supplierItemService.create(dto);
}
@ApiOperation(value = "更新上传藏品")
@PostMapping("/updateItem")
public Result updateItem(@RequestBody SupplierItemRequestDto dto) {
logger.info("更新上传藏品,请求参数:{}", JSON.toJSONString(dto));
if (dto.getId() == null) {
return Result.failed(ResultCode.PARAM_ERROR);
}
return supplierItemService.update(dto);
}
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment