zoujiajian 2 лет назад
Родитель
Сommit
c2d4de1472

+ 10 - 0
netflix-dao/src/main/java/com/cyksj/model/manage/entity/YhShop.java

@@ -1,5 +1,7 @@
 package com.cyksj.model.manage.entity;
 
+import com.baomidou.mybatisplus.annotation.FieldStrategy;
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.cyksj.model.BaseEntity;
 import lombok.Getter;
 import lombok.Setter;
@@ -50,6 +52,7 @@ public class YhShop extends BaseEntity {
 	/**
 	 * 审核失败原因
 	 */
+	@TableField(updateStrategy = FieldStrategy.IGNORED)
 	private String reason;
 
 	/**
@@ -57,9 +60,16 @@ public class YhShop extends BaseEntity {
 	 */
 	private String contact;
 
+	/**
+	 * 申请修改的 店铺名
+	 */
+	private String modifyName;
+
 	@Getter
 	public enum Status {
 		verify("审核中"),
+		modify("申请修改"),
+		modify_fail("申请修改失败"),
 		success("审核通过"),
 		fail("审核失败");
 		String desc;

+ 6 - 0
netflix-dao/src/main/java/com/cyksj/model/request/YhShopVerifyReq.java

@@ -5,6 +5,7 @@ import lombok.Getter;
 import lombok.Setter;
 
 import javax.validation.constraints.NotNull;
+import java.util.List;
 
 /*
  *项目名: yhlxj
@@ -25,4 +26,9 @@ public class YhShopVerifyReq {
 	private YhShop.Status verifyStatus;
 
 	private String reason;
+
+	/**
+	 * 多条记录id
+	 */
+	private List<Long> ids;
 }

+ 7 - 7
netflix-service/src/main/java/com/cyksj/service/mange/goods/CmsYhShopCommonServiceImpl.java

@@ -89,10 +89,10 @@ public class CmsYhShopCommonServiceImpl implements CmsYhShopCommonService {
 		String reason = verifyReq.getReason();
 		YhShop yhShop = yhShopMapper.selectById(id);
 		Assert.notNull(yhShop, "开店申请不存在");
-		if (yhShop.getVerifyStatus() != YhShop.Status.verify) {
+		if (yhShop.getVerifyStatus() != YhShop.Status.verify && yhShop.getVerifyStatus() != YhShop.Status.modify) {
 			throw BusinessRuntimeException.getInstance("该开店申请已审核");
 		}
-		if (verifyStatus == YhShop.Status.verify) {
+		if (verifyStatus != YhShop.Status.success || verifyStatus != YhShop.Status.fail) {
 			throw BusinessRuntimeException.getInstance("请选择正确的审核状态");
 		}
 		if (verifyStatus == YhShop.Status.fail) {
@@ -100,14 +100,14 @@ public class CmsYhShopCommonServiceImpl implements CmsYhShopCommonService {
 				throw BusinessRuntimeException.getInstance("请输入审核失败原因");
 			}
 			yhShop.setReason(reason);
+			//申请修改
+			if (yhShop.getVerifyStatus() == YhShop.Status.modify) {
+				yhShop.setVerifyStatus(YhShop.Status.modify_fail);
+			}
 		} else {
 			yhShop.setReason(null);
 		}
-		yhShopMapper.update(null, Wrappers.lambdaUpdate(YhShop.class)
-				.set(YhShop::getVerifyStatus, verifyStatus)
-				.set(verifyStatus == YhShop.Status.fail, YhShop::getReason, reason)
-				.set(verifyStatus == YhShop.Status.success, YhShop::getReason, null)
-				.eq(YhShop::getId, id));
+		yhShopMapper.updateById(yhShop);
 	}
 
 	@Override

+ 61 - 8
netflix-web/src/main/java/com/cyksj/web/controller/cps/shop/YhShopDateController.java

@@ -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)

+ 18 - 1
netflix-web/src/main/java/com/cyksj/web/controller/manage/goods/CmsYhShopGoodsController.java

@@ -1,6 +1,7 @@
 package com.cyksj.web.controller.manage.goods;
 
 import cn.dev33.satoken.stp.StpUtil;
+import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.util.StrUtil;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.cyksj.common.annotation.NoSubmit;
@@ -379,11 +380,27 @@ public class CmsYhShopGoodsController {
     @GetMapping("/get/apply")
     public Result<SearchResult<YhShopView>> getUserShopApply() {
         SearchResult<YhShopView> search = beanSearcher.search(YhShopView.class, MapUtils.flatBuilder(request.getParameterMap())
-                .field(YhShopView::getVerifyStatus, YhShop.Status.verify)
+                .field(YhShopView::getVerifyStatus, List.of(YhShop.Status.verify.name(), YhShop.Status.modify.name())).op(Operator.InList)
                 .build());
         return GatewayResponse.SUCCESS.newBuilder().toResult(search);
     }
 
+    /**
+     * 一键审核
+     */
+    @PutMapping("/batch/verify")
+    public Result<String> batchVerify(@RequestBody YhShopVerifyReq verifyReq) {
+	    List<Long> ids = verifyReq.getIds();
+	    if (CollUtil.isEmpty(ids)) {
+		    throw BusinessRuntimeException.getInstance("请选择对应的审核记录");
+	    }
+	    ids.forEach(id -> {
+		    verifyReq.setId(id);
+		    cmsYhShopCommonService.verifyYhShopApply(verifyReq);
+	    });
+	    return GatewayResponse.SUCCESS.newBuilder().toResult();
+    }
+
 
     /**
      * 店铺审核