From bc8074c56893eac3eb5002dcefeacd644d827a29 Mon Sep 17 00:00:00 2001
From: zhanghua <314079846@qq.com>
Date: 星期日, 21 一月 2024 20:54:27 +0800
Subject: [PATCH] 优化
---
ycl-platform/src/main/java/com/ycl/controller/store/StoreInfoController.java | 63 ++++++++++++++++++++++++++-----
1 files changed, 52 insertions(+), 11 deletions(-)
diff --git a/ycl-platform/src/main/java/com/ycl/controller/store/StoreInfoController.java b/ycl-platform/src/main/java/com/ycl/controller/store/StoreInfoController.java
index 403db6f..d63a3ba 100644
--- a/ycl-platform/src/main/java/com/ycl/controller/store/StoreInfoController.java
+++ b/ycl-platform/src/main/java/com/ycl/controller/store/StoreInfoController.java
@@ -2,13 +2,19 @@
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ycl.annotation.LogSave;
import com.ycl.api.CommonPage;
import com.ycl.api.CommonResult;
-import com.ycl.dto.UmsStoreInfoParam;
+import com.ycl.common.util.UtilNumber;
+import com.ycl.dto.store.UmsStoreInfoParam;
import com.ycl.entity.store.StoreInfo;
+import com.ycl.entity.store.StoreScore;
import com.ycl.service.store.StoreInfoService;
+import com.ycl.service.video.impl.IVideoPointService;
+import com.ycl.vo.store.StoreInfoVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@@ -29,6 +35,13 @@
private StoreInfoService storeInfoService;
@Autowired
+ UtilNumber utilNumber;
+
+ @Autowired
+ private IVideoPointService videoPointService;
+
+
+ @Autowired
public void setUmsStoreInfoService(StoreInfoService umsStoreInfoService) {
this.storeInfoService = umsStoreInfoService;
}
@@ -36,33 +49,47 @@
@ApiOperation("鏍规嵁闂ㄥ簵鍚嶇О鍒嗛〉鑾峰彇闂ㄥ簵鍒楄〃鍒楄〃")
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
- public CommonResult<CommonPage<StoreInfo>> list(@RequestParam(value = "keyword", required = false) String keyword,
- @RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
- @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
- Page<StoreInfo> storeInfoPage = storeInfoService.list(keyword, pageSize, pageNum);
+ @LogSave(operationType = "闂ㄥ簵绠$悊", contain = "鏌ヨ闂ㄥ簵")
+ public CommonResult<CommonPage<StoreInfoVO>> list(@RequestParam(value = "keyword", required = false) String keyword,
+ @RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
+ @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
+ @RequestParam(value = "status", required = false) String status
+ ) {
+ Page<StoreInfoVO> storeInfoPage = storeInfoService.list(keyword, pageSize, pageNum,status);
return CommonResult.success(CommonPage.restPage(storeInfoPage));
}
@ApiOperation("鏍规嵁id鑾峰彇闂ㄥ簵淇℃伅")
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ResponseBody
- public CommonResult<StoreInfo> getItem(@PathVariable Long id) {
+ @LogSave(operationType = "闂ㄥ簵绠$悊", contain = "鏌ヨ闂ㄥ簵")
+ public CommonResult<StoreInfoVO> getItem(@PathVariable Long id) {
StoreInfo storeInfo = storeInfoService.getById(id);
- return CommonResult.success(storeInfo);
+ StoreInfoVO vo = new StoreInfoVO();
+ BeanUtils.copyProperties(storeInfo, vo);
+ vo.setVideoPoint(videoPointService.getById(storeInfo.getVideoId()));
+ return CommonResult.success(vo);
}
@ApiOperation(value = "娣诲姞闂ㄥ簵淇℃伅")
@RequestMapping(value = "/add", method = RequestMethod.POST)
@ResponseBody
+ @LogSave(operationType = "闂ㄥ簵绠$悊", contain = "娣诲姞闂ㄥ簵")
public CommonResult<StoreInfo> add(@Validated @RequestBody UmsStoreInfoParam umsStoreInfoParam) {
StoreInfo storeInfo = StoreInfo.builder()
.owner(umsStoreInfoParam.getOwner())
- .storeName(umsStoreInfoParam.getStorename())
+ .storeName(umsStoreInfoParam.getStoreName())
.contact(umsStoreInfoParam.getContact())
- .storeAddress(umsStoreInfoParam.getStoreaddr())
+ .storeAddress(umsStoreInfoParam.getStoreAddress())
.storePhoto(umsStoreInfoParam.getStorephoto())
.idCardInfo(umsStoreInfoParam.getIdcardinfo())
- .storeScore(umsStoreInfoParam.getStorescore()).build();
+ .storeNumber(utilNumber.createShopCode())
+ .type(umsStoreInfoParam.getType())
+ .description(umsStoreInfoParam.getDescription())
+ .videoId(umsStoreInfoParam.getRelationVideo())
+ .storeScore(100.0)
+ .status(umsStoreInfoParam.getStatus())
+ .build();
boolean success = storeInfoService.save(storeInfo);
if (success) {
return CommonResult.success(null);
@@ -74,6 +101,7 @@
@ApiOperation(value = "鏍规嵁id鍒犻櫎闂ㄥ簵淇℃伅")
@RequestMapping(value = "/delete/{id}", method = RequestMethod.GET)
@ResponseBody
+ @LogSave(operationType = "闂ㄥ簵绠$悊", contain = "鍒犻櫎闂ㄥ簵")
public CommonResult delete(@PathVariable Long id) {
boolean success = storeInfoService.removeById(id);
if (success) {
@@ -84,8 +112,9 @@
}
@ApiOperation(value = "淇敼闂ㄥ簵淇℃伅")
- @RequestMapping(value = "/update", method = RequestMethod.GET)
+ @RequestMapping(value = "/update", method = RequestMethod.PUT)
@ResponseBody
+ @LogSave(operationType = "闂ㄥ簵绠$悊", contain = "淇敼闂ㄥ簵")
public CommonResult update(@RequestBody StoreInfo storeInfo) {
boolean success = storeInfoService.updateById(storeInfo);
if (success) {
@@ -98,6 +127,7 @@
@ApiOperation(value = "鏍规嵁excel妯℃澘鎵归噺瀵煎叆闂ㄥ簵淇℃伅")
@RequestMapping(value = "/add/excel", method = RequestMethod.POST)
@ResponseBody
+ @LogSave(operationType = "闂ㄥ簵绠$悊", contain = "瀵煎叆闂ㄥ簵")
public CommonResult addByExcel(MultipartFile file) {
boolean success = storeInfoService.addByExcel(file);
if (success) {
@@ -106,5 +136,16 @@
return CommonResult.failed();
}
}
+
+ @ApiOperation("鏍规嵁id鑾峰彇闂ㄥ簵绉垎璇︽儏")
+ @RequestMapping(value = "/{id}/storeScore", method = RequestMethod.GET)
+ @ResponseBody
+ @LogSave(operationType = "闂ㄥ簵绉垎璇︽儏", contain = "闂ㄥ簵绉垎璇︽儏")
+ public CommonResult<Page<StoreScore>> getScoreList(@PathVariable Long id,
+ @RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
+ @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
+ Page<StoreScore> page = storeInfoService.getScoreList(id, pageSize, pageNum);
+ return CommonResult.success(page);
+ }
}
--
Gitblit v1.8.0