|
|
@@ -4,6 +4,7 @@ import cn.hutool.core.date.DateTime;
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
+import com.cyksj.common.exception.BusinessRuntimeException;
|
|
|
import com.cyksj.dto.Result;
|
|
|
import com.cyksj.enums.GatewayResponse;
|
|
|
import com.cyksj.mapper.GoodsDonMapper;
|
|
|
@@ -21,9 +22,7 @@ import com.ejlchina.searcher.SearchResult;
|
|
|
import com.ejlchina.searcher.util.MapBuilder;
|
|
|
import com.ejlchina.searcher.util.MapUtils;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
-import org.springframework.web.bind.annotation.GetMapping;
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import java.math.BigDecimal;
|
|
|
@@ -37,7 +36,7 @@ import java.util.Optional;
|
|
|
*创建时间:2023/9/20 14:19
|
|
|
*/
|
|
|
@RestController
|
|
|
-@RequestMapping("/yhShop/manage/data")
|
|
|
+@RequestMapping("/yhShop/manage")
|
|
|
@RequiredArgsConstructor
|
|
|
public class YhShopDateController {
|
|
|
private final YhShopManageService yhShopManageService;
|
|
|
@@ -49,10 +48,64 @@ public class YhShopDateController {
|
|
|
private final GoodsDonMapper goodsDonMapper;
|
|
|
|
|
|
private final YhShopMapper yhShopMapper;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 店铺 信息详情
|
|
|
+ */
|
|
|
+ @GetMapping("/get/shop/detail/data")
|
|
|
+ public Result<YhShop> getShopDetail() {
|
|
|
+ long yhShopUserId = StpYhShopManageUser.getLoginIdAsLong();
|
|
|
+ YhShop yhShop = yhShopMapper.selectOne(Wrappers.lambdaQuery(YhShop.class)
|
|
|
+ .eq(YhShop::getUserId, yhShopUserId).last("limit 1"));
|
|
|
+ return GatewayResponse.SUCCESS.newBuilder().toResult(yhShop);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 设置联系方式
|
|
|
+ */
|
|
|
+ @PutMapping("/set/shop/contact")
|
|
|
+ public Result<String> setShopContact(@RequestBody YhShop yhShop) {
|
|
|
+ String contact = yhShop.getContact();
|
|
|
+ if (StrUtil.isEmpty(contact)) {
|
|
|
+ throw BusinessRuntimeException.getInstance("请输入联系方式");
|
|
|
+ }
|
|
|
+ Long id = yhShop.getId();
|
|
|
+ YhShop dbShop = yhShopMapper.selectById(id);
|
|
|
+ if (dbShop == null) {
|
|
|
+ throw BusinessRuntimeException.getInstance("店铺不存在");
|
|
|
+ }
|
|
|
+ yhShop.setContact(contact);
|
|
|
+ yhShopMapper.updateById(dbShop);
|
|
|
+ return GatewayResponse.SUCCESS.newBuilder().toResult();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 申请修改
|
|
|
+ */
|
|
|
+ @PutMapping("/update/shop")
|
|
|
+ public Result<String> updateShop(@RequestBody YhShop yhShop) {
|
|
|
+ Long id = yhShop.getId();
|
|
|
+ String name = yhShop.getName();
|
|
|
+ YhShop dbShop = yhShopMapper.selectById(id);
|
|
|
+ if (dbShop == null) {
|
|
|
+ throw BusinessRuntimeException.getInstance("店铺不存在");
|
|
|
+ }
|
|
|
+ if (StrUtil.isEmpty(name)) {
|
|
|
+ throw BusinessRuntimeException.getInstance("请输入申请修改的店铺名");
|
|
|
+ }
|
|
|
+ if (dbShop.getVerifyStatus() == YhShop.Status.modify) {
|
|
|
+ throw BusinessRuntimeException.getInstance("您已提交修改申请.");
|
|
|
+ }
|
|
|
+ yhShop.setVerifyStatus(YhShop.Status.modify);
|
|
|
+ yhShop.setModifyName(name);
|
|
|
+ yhShopMapper.updateById(yhShop);
|
|
|
+ return GatewayResponse.SUCCESS.newBuilder().toResult();
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 店铺分销平台数据详情
|
|
|
*/
|
|
|
- @GetMapping("/get/distribute/detail")
|
|
|
+ @GetMapping("/get/distribute/detail/data")
|
|
|
public Result<YhShopUserDistributeDetailView> getDistributeDetail() {
|
|
|
long yhShopUserId = StpYhShopManageUser.getLoginIdAsLong();
|
|
|
User user = beanSearcher.searchFirst(User.class, MapUtils.builder().field(User::getId, yhShopUserId).onlySelect(User::getPoints).build());
|
|
|
@@ -102,7 +155,7 @@ public class YhShopDateController {
|
|
|
/**
|
|
|
* 店铺分销订单收入统计
|
|
|
*/
|
|
|
- @GetMapping("/get/distribute/orders/statistics")
|
|
|
+ @GetMapping("/get/distribute/orders/statisticsData")
|
|
|
public Result<SearchResult<YhShopUserDistributeOrdersStatisticsView>> getUserDistributeOrdersStatisticsView(Long firstDate, Long lastDate) {
|
|
|
long yhShopUserId = StpYhShopManageUser.getLoginIdAsLong();
|
|
|
String first = null;
|
|
|
@@ -128,7 +181,7 @@ public class YhShopDateController {
|
|
|
/**
|
|
|
* 店铺分销订单收入详细
|
|
|
*/
|
|
|
- @GetMapping("/get/distribute/orders/detail")
|
|
|
+ @GetMapping("/get/distribute/orders/detail/data")
|
|
|
public Result<SearchResult<YhShopUserDistributeOrdersDetailView>> getUserDistributeOrdersDetailView(Long firstDate, Long lastDate) {
|
|
|
long yhShopUserId = StpYhShopManageUser.getLoginIdAsLong();
|
|
|
String first = null;
|
|
|
@@ -154,7 +207,7 @@ public class YhShopDateController {
|
|
|
/**
|
|
|
* 店铺分销商品列表
|
|
|
*/
|
|
|
- @GetMapping("/get/goods")
|
|
|
+ @GetMapping("/get/orders/goods")
|
|
|
public Result<List<GoodsDon>> getGoodsList() {
|
|
|
long yhShopUserId = StpYhShopManageUser.getLoginIdAsLong();
|
|
|
YhShop yhShop = yhShopMapper.selectById(Wrappers.lambdaQuery(YhShop.class)
|