|
@@ -9,6 +9,7 @@ import com.ruoyi.common.constant.UserConstants;
|
|
|
import com.ruoyi.common.utils.DateUtils;
|
|
|
import com.ruoyi.post.domain.PostCollection;
|
|
|
import com.ruoyi.post.service.IPostCollectionService;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
@@ -29,15 +30,14 @@ import com.ruoyi.common.utils.poi.ExcelUtil;
|
|
|
import com.ruoyi.common.core.page.TableDataInfo;
|
|
|
|
|
|
/**
|
|
|
- * 邮贝套系信息;
|
|
|
- *
|
|
|
+ * 邮贝套系信息;
|
|
|
+ *
|
|
|
* @author huianan
|
|
|
* @date 2023-02-11
|
|
|
*/
|
|
|
@RestController
|
|
|
@RequestMapping("/post/series")
|
|
|
-public class PostSeriesController extends BaseController
|
|
|
-{
|
|
|
+public class PostSeriesController extends BaseController {
|
|
|
@Autowired
|
|
|
private IPostSeriesService postSeriesService;
|
|
|
|
|
@@ -47,10 +47,10 @@ public class PostSeriesController extends BaseController
|
|
|
/**
|
|
|
* 查询邮贝套系信息;
|
|
|
*/
|
|
|
+ @ApiOperation("查询邮贝套系信息")
|
|
|
@PreAuthorize("@ss.hasPermi('system:series:list')")
|
|
|
@GetMapping("/list")
|
|
|
- public TableDataInfo list(PostSeries postSeries)
|
|
|
- {
|
|
|
+ public TableDataInfo list(PostSeries postSeries) {
|
|
|
startPage();
|
|
|
List<PostSeries> list = postSeriesService.selectPostSeriesList(postSeries);
|
|
|
return getDataTable(list);
|
|
@@ -59,18 +59,18 @@ public class PostSeriesController extends BaseController
|
|
|
/**
|
|
|
* 查询当前邮贝套系所含藏品信息;
|
|
|
*/
|
|
|
+ @ApiOperation("查询套系所含藏品信息")
|
|
|
@PreAuthorize("@ss.hasPermi('system:series:list')")
|
|
|
@GetMapping("/list/{seriesId}")
|
|
|
- public TableDataInfo listCollection(@PathVariable("seriesId")Long seriesId,PostCollection postCollection)
|
|
|
- {
|
|
|
+ public TableDataInfo listCollection(@PathVariable("seriesId") Long seriesId, PostCollection postCollection) {
|
|
|
startPage();
|
|
|
PostSeries postSeries = postSeriesService.selectPostSeriesBySeriesId(seriesId);
|
|
|
//获取对应匹配的套系昵称
|
|
|
String seriesName = postSeries.getSeriesName();
|
|
|
//通过匹配查询出对应的藏品
|
|
|
- postCollection.setSeriesName(seriesName);
|
|
|
- List<PostCollection> postCollections = postCollectionService.selectPostCollectionList(postCollection);
|
|
|
- return getDataTable(postCollections);
|
|
|
+ postCollection.setSeriesName(seriesName);
|
|
|
+ List<PostCollection> postCollections = postCollectionService.selectPostCollectionList(postCollection);
|
|
|
+ return getDataTable(postCollections);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -87,10 +87,10 @@ public class PostSeriesController extends BaseController
|
|
|
/**
|
|
|
* 查询邮贝在售套系信息;
|
|
|
*/
|
|
|
+ @ApiOperation("查询套系所含在售藏品信息")
|
|
|
@PreAuthorize("@ss.hasPermi('system:series:list')")
|
|
|
@GetMapping("/sale")
|
|
|
- public TableDataInfo Sale(PostSeries postSeries)
|
|
|
- {
|
|
|
+ public TableDataInfo Sale(PostSeries postSeries) {
|
|
|
startPage();
|
|
|
List<PostSeries> list = postSeriesService.selectPostSeriesSale(postSeries);
|
|
|
return getDataTable(list);
|
|
@@ -99,10 +99,10 @@ public class PostSeriesController extends BaseController
|
|
|
/**
|
|
|
* 查询邮贝预售套系信息;
|
|
|
*/
|
|
|
+ @ApiOperation("查询套系所含预售藏品信息")
|
|
|
@PreAuthorize("@ss.hasPermi('system:series:list')")
|
|
|
@GetMapping("/presale")
|
|
|
- public TableDataInfo PreSale(PostSeries postSeries)
|
|
|
- {
|
|
|
+ public TableDataInfo PreSale(PostSeries postSeries) {
|
|
|
startPage();
|
|
|
List<PostSeries> list = postSeriesService.selectPostSeriesPreSale(postSeries);
|
|
|
return getDataTable(list);
|
|
@@ -112,10 +112,10 @@ public class PostSeriesController extends BaseController
|
|
|
/**
|
|
|
* 查询邮贝过期套系信息;
|
|
|
*/
|
|
|
+ @ApiOperation("查询套系所含过期藏品信息")
|
|
|
@PreAuthorize("@ss.hasPermi('system:series:list')")
|
|
|
@GetMapping("/overdue")
|
|
|
- public TableDataInfo Overdue(PostSeries postSeries)
|
|
|
- {
|
|
|
+ public TableDataInfo Overdue(PostSeries postSeries) {
|
|
|
startPage();
|
|
|
List<PostSeries> list = postSeriesService.selectPostSeriesOverdue(postSeries);
|
|
|
return getDataTable(list);
|
|
@@ -124,22 +124,24 @@ public class PostSeriesController extends BaseController
|
|
|
/**
|
|
|
* 上链功能;
|
|
|
*/
|
|
|
+ @ApiOperation("套系上链")
|
|
|
@PreAuthorize("@ss.hasPermi('system:series:list')")
|
|
|
@PutMapping("/onchain/{seriesId}")
|
|
|
- public AjaxResult OnChain(@PathVariable("seriesId")Long seriesId, PostSeries postSeries)
|
|
|
- {
|
|
|
+ public AjaxResult OnChain(@PathVariable("seriesId") Long seriesId, PostSeries postSeries) {
|
|
|
+ if (postSeries.getExchangeFlag().equals('0')) {
|
|
|
+ return AjaxResult.error("不可重复上链");
|
|
|
+ }
|
|
|
postSeries = postSeriesService.selectPostSeriesBySeriesId(seriesId);
|
|
|
- return toAjax(postSeriesService.OnChain(postSeries));
|
|
|
+ return toAjax(postSeriesService.OnChain(postSeries));
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 导出邮贝套系信息;
|
|
|
+ * 导出邮贝套系信息;
|
|
|
*/
|
|
|
@PreAuthorize("@ss.hasPermi('system:series:export')")
|
|
|
@Log(title = "邮贝套系信息; ", businessType = BusinessType.EXPORT)
|
|
|
@PostMapping("/export")
|
|
|
- public void export(HttpServletResponse response, PostSeries postSeries)
|
|
|
- {
|
|
|
+ public void export(HttpServletResponse response, PostSeries postSeries) {
|
|
|
List<PostSeries> list = postSeriesService.selectPostSeriesList(postSeries);
|
|
|
ExcelUtil<PostSeries> util = new ExcelUtil<PostSeries>(PostSeries.class);
|
|
|
util.exportExcel(response, list, "邮贝套系信息; ");
|
|
@@ -148,93 +150,104 @@ public class PostSeriesController extends BaseController
|
|
|
/**
|
|
|
* 获取邮贝套系信息; 详细信息
|
|
|
*/
|
|
|
+ @ApiOperation("查询套系详细信息")
|
|
|
@PreAuthorize("@ss.hasPermi('system:series:query')")
|
|
|
@GetMapping(value = "/{seriesId}")
|
|
|
- public AjaxResult getInfo(@PathVariable("seriesId") Long seriesId)
|
|
|
- {
|
|
|
+ public AjaxResult getInfo(@PathVariable("seriesId") Long seriesId) {
|
|
|
return success(postSeriesService.selectPostSeriesBySeriesId(seriesId));
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 新增邮贝套系信息;
|
|
|
+ * 新增邮贝套系信息;
|
|
|
*/
|
|
|
+ @ApiOperation("新增套系信息")
|
|
|
@PreAuthorize("@ss.hasPermi('system:series:add')")
|
|
|
@Log(title = "邮贝套系信息; ", businessType = BusinessType.INSERT)
|
|
|
@PostMapping("/add")
|
|
|
- public AjaxResult add(@RequestBody PostSeries postSeries)
|
|
|
- {
|
|
|
- if(UserConstants.NOT_UNIQUE.equals(postSeriesService.checkSeriesNameUnique(postSeries)))
|
|
|
- {
|
|
|
- return AjaxResult.error("新增消息"+postSeries.getSeriesName()+"失败,套系已经存在");
|
|
|
+ public AjaxResult add(@RequestBody PostSeries postSeries) {
|
|
|
+ if (postSeries.getExchangeFlag().equals('0')) {
|
|
|
+ return AjaxResult.error("新增套系消息" + postSeries.getSeriesName() + "失败,套系已经上链");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (UserConstants.NOT_UNIQUE.equals(postSeriesService.checkSeriesNameUnique(postSeries))) {
|
|
|
+ return AjaxResult.error("新增套系消息" + postSeries.getSeriesName() + "失败,套系已经存在");
|
|
|
}
|
|
|
postSeries.setCreateBy(getUsername());
|
|
|
/**
|
|
|
* 根据套系时间,自动识别套系藏品所在table“在售/预售/以过期”根据当前时间,
|
|
|
* 对比套系时间,当前小于套系时间,该套系藏品为“以过期”, 当前时间大于套系时间为“预售”
|
|
|
*/
|
|
|
- Date nowDate=new Date();
|
|
|
- nowDate=DateUtils.getNowDate();
|
|
|
+ Date nowDate = new Date();
|
|
|
+ nowDate = DateUtils.getNowDate();
|
|
|
/**
|
|
|
* 展示时间 结束时间
|
|
|
* 当前时间大于结束时间 过期 2
|
|
|
* 当前时间在展示时间以及结束时间区间 在售 0
|
|
|
* 当前时间小于展示时间 预售 1
|
|
|
*/
|
|
|
- if(nowDate.compareTo(postSeries.getEndTime())>0){
|
|
|
+ if (nowDate.compareTo(postSeries.getEndTime()) > 0) {
|
|
|
postSeries.setStatus(String.valueOf(2));
|
|
|
- }
|
|
|
- else if (postSeries.getStartTime().compareTo(nowDate)>0){
|
|
|
+ } else if (postSeries.getStartTime().compareTo(nowDate) > 0) {
|
|
|
postSeries.setStatus(String.valueOf(1));
|
|
|
- }
|
|
|
- else{
|
|
|
- postSeries.setStatus(String.valueOf(0));
|
|
|
+ } else {
|
|
|
+ postSeries.setStatus(String.valueOf(0));
|
|
|
}
|
|
|
return toAjax(postSeriesService.insertPostSeries(postSeries));
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 修改邮贝套系信息;
|
|
|
+ * 修改邮贝套系信息;
|
|
|
*/
|
|
|
+ @ApiOperation("修改套系信息")
|
|
|
@PreAuthorize("@ss.hasPermi('system:series:edit')")
|
|
|
@Log(title = "邮贝套系信息; ", businessType = BusinessType.UPDATE)
|
|
|
@PutMapping("/edit")
|
|
|
- public AjaxResult edit(@RequestBody PostSeries postSeries)
|
|
|
- {
|
|
|
+ public AjaxResult edit(@RequestBody PostSeries postSeries) {
|
|
|
//只能进行时间的后面修改
|
|
|
|
|
|
- if(UserConstants.NOT_UNIQUE.equals(postSeriesService.checkSeriesNameUnique(postSeries)))
|
|
|
- {
|
|
|
- return AjaxResult.error("修改消息"+postSeries.getSeriesName()+"失败,套系已经存在");
|
|
|
+ if (postSeries.getExchangeFlag().equals('0')) {
|
|
|
+ return AjaxResult.error("修改套系消息" + postSeries.getSeriesName() + "失败,套系已经上链");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ if (UserConstants.NOT_UNIQUE.equals(postSeriesService.checkSeriesNameUnique(postSeries))) {
|
|
|
+ return AjaxResult.error("修改消息" + postSeries.getSeriesName() + "失败,套系已经存在");
|
|
|
}
|
|
|
postSeries.setUpdateBy(getUsername());
|
|
|
- Date nowDate=new Date();
|
|
|
- nowDate=DateUtils.getNowDate();
|
|
|
+ Date nowDate = new Date();
|
|
|
+ nowDate = DateUtils.getNowDate();
|
|
|
/**
|
|
|
* 展示时间 结束时间
|
|
|
* 当前时间大于结束时间 过期 2
|
|
|
* 当前时间在展示时间以及结束时间区间 在售 0
|
|
|
* 当前时间小于展示时间 预售 1
|
|
|
*/
|
|
|
- if(nowDate.compareTo(postSeries.getEndTime())>0){
|
|
|
+ if (nowDate.compareTo(postSeries.getEndTime()) > 0) {
|
|
|
postSeries.setStatus(String.valueOf(2));
|
|
|
- }
|
|
|
- else if (postSeries.getStartTime().compareTo(nowDate)>0){
|
|
|
+ } else if (postSeries.getStartTime().compareTo(nowDate) > 0) {
|
|
|
postSeries.setStatus(String.valueOf(1));
|
|
|
- }
|
|
|
- else{
|
|
|
+ } else {
|
|
|
postSeries.setStatus(String.valueOf(0));
|
|
|
}
|
|
|
return toAjax(postSeriesService.updatePostSeries(postSeries));
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 删除邮贝套系信息;
|
|
|
+ * 删除邮贝套系信息;
|
|
|
*/
|
|
|
+ @ApiOperation("删除套系信息")
|
|
|
@PreAuthorize("@ss.hasPermi('system:series:remove')")
|
|
|
@Log(title = "邮贝套系信息; ", businessType = BusinessType.DELETE)
|
|
|
- @DeleteMapping("/{seriesIds}")
|
|
|
- public AjaxResult remove(@PathVariable Long[] seriesIds)
|
|
|
- {
|
|
|
+ @DeleteMapping("/{seriesIds}")
|
|
|
+ public AjaxResult remove(@PathVariable Long[] seriesIds) {
|
|
|
+
|
|
|
+ for (int i = 0; i < seriesIds.length; i++) {
|
|
|
+ PostSeries postSeries = postSeriesService.selectPostSeriesBySeriesId(seriesIds[i]);
|
|
|
+ if (postSeries.getExchangeFlag().equals('0')) {
|
|
|
+ return AjaxResult.error("删除套系消息" + postSeries.getSeriesName() + "失败,套系已经上链");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
return toAjax(postSeriesService.deletePostSeriesBySeriesIds(seriesIds));
|
|
|
}
|
|
|
|