소스 검색

Merge branch 'fuck'

# Conflicts:
#	src/main/java/com/chelvc/cloud/maintain/controller/CategoryController.java
#	src/main/java/com/chelvc/cloud/maintain/vo/CategoryVO.java
liude 1 년 전
부모
커밋
20e7399fc8

+ 8 - 5
src/main/java/com/chelvc/cloud/maintain/controller/CategoryController.java

@@ -4,14 +4,18 @@ import java.util.List;
 
 import com.chelvc.cloud.maintain.copier.CategoryCopier;
 import com.chelvc.cloud.maintain.vo.CategoryVO;
+import com.chelvc.cloud.vehicle.api.param.CategoryListParam;
 import com.chelvc.cloud.vehicle.api.service.CategoryService;
 import com.chelvc.framework.base.annotation.ResponseWrapping;
-import com.chelvc.framework.oauth.annotation.Authorize;
 import org.apache.dubbo.config.annotation.DubboReference;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RestController;
 
+import javax.validation.Valid;
+
 /**
  * 分类接口
  *
@@ -30,9 +34,8 @@ public class CategoryController {
      *
      * @return 分类信息列表
      */
-    @Authorize(enabled = false)
-    @GetMapping("/categories")
-    public List<CategoryVO> listCategories() {
-        return CategoryCopier.INSTANCE.copying(this.categoryService.listActiveCategories());
+    @PostMapping("/categories")
+    public List<CategoryVO> listCategories(@RequestBody @Valid CategoryListParam param) {
+        return CategoryCopier.INSTANCE.copying(this.categoryService.listActiveCategories(param));
     }
 }

+ 40 - 0
src/main/java/com/chelvc/cloud/maintain/controller/MerchantController.java

@@ -2,6 +2,7 @@ package com.chelvc.cloud.maintain.controller;
 
 import com.chelvc.cloud.maintain.copier.MerchantCopier;
 import com.chelvc.cloud.maintain.vo.SimpleMerchantVO;
+import com.chelvc.cloud.vehicle.api.constant.GoodsStatus;
 import com.chelvc.cloud.vehicle.api.dto.BalanceDetailDTO;
 import com.chelvc.cloud.vehicle.api.dto.MerchantDTO;
 import com.chelvc.cloud.vehicle.api.dto.MerchantDetailDTO;
@@ -9,6 +10,7 @@ import com.chelvc.cloud.vehicle.api.dto.MerchantRankDTO;
 import com.chelvc.cloud.vehicle.api.param.*;
 import com.chelvc.cloud.vehicle.api.service.BalanceDetailService;
 import com.chelvc.cloud.vehicle.api.service.FavoriteService;
+import com.chelvc.cloud.vehicle.api.service.GoodsService;
 import com.chelvc.cloud.vehicle.api.service.MerchantService;
 import com.chelvc.framework.base.annotation.ResponseWrapping;
 import com.chelvc.framework.base.context.SessionContextHolder;
@@ -18,10 +20,12 @@ import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
 import org.springframework.web.bind.annotation.RestController;
 
 import javax.validation.Valid;
 import javax.validation.constraints.Min;
+import javax.validation.constraints.NotEmpty;
 import java.util.List;
 
 /**
@@ -42,6 +46,8 @@ public class MerchantController {
 
     @DubboReference
     private BalanceDetailService balanceDetailService;
+    @DubboReference
+    private GoodsService goodsService;
 
     /**
      * 获取商家列表
@@ -118,4 +124,38 @@ public class MerchantController {
         return this.merchantService.getUserMineCartPaging(param);
     }
 
+
+    /**
+     * 上架商品
+     *
+     * @param goodsIds    商品ID集合
+     */
+    @PutMapping("/merchant/list-goods/{goodsIds}")
+    public void listGoods(@PathVariable("goodsIds") @NotEmpty(message = "商品ID不能为空") List<Long> goodsIds) {
+        this.goodsService.updateGoodsStatus(goodsIds, GoodsStatus.ONLINE);
+    }
+
+    /**
+     * 下架商品
+     *
+     * @param goodsIds    商品ID集合
+     */
+    @PutMapping("/merchant/delist-goods/{goodsIds}")
+    public void delistGoods(@PathVariable("goodsIds") @NotEmpty(message = "商品ID不能为空") List<Long> goodsIds) {
+        this.goodsService.updateGoodsStatus(goodsIds, GoodsStatus.OFFLINE);
+    }
+
+
+    /**
+     * 修改商家营业状态
+     *
+     * @param id    商家主键
+     * @param businessStatus 修改参数  营业状态 0-营业中,1-休息中
+     */
+    @PutMapping("/merchant/updateBusinessStatus/{id}")
+    public void updateMerchant(@PathVariable("id") @Min(value = 1, message = "商家主键不能小于1") Long id,
+                               String businessStatus) {
+        this.merchantService.updateMerchantBusinessStatus(id,businessStatus);
+    }
+
 }

+ 24 - 0
src/main/java/com/chelvc/cloud/maintain/controller/ReservationController.java

@@ -80,4 +80,28 @@ public class ReservationController {
     public void deleteReservation(@PathVariable("id") @Min(value = 1, message = "预约主键不能小于1") Long id) {
         this.reservationService.deleteReservation(id);
     }
+
+
+
+    /**
+     * 查询商家被预约列表
+     *
+     * @param param 查询参数
+     * @return 商家被预约列表
+     */
+    @PostMapping("/listMerchantReservations")
+    public List<ReservationVO> listMerchantReservations(@RequestBody @Valid ReservationQueryParam param) {
+        List<ReservationDTO> reservations = this.reservationService.listMerchantReservations(param);
+        if (CollectionUtils.isEmpty(reservations)) {
+            return Collections.emptyList();
+        }
+        return reservations
+                .stream()
+                .map(o -> {
+                    ReservationVO reservationVO = ReservationCopier.INSTANCE.copying(o);
+                    reservationVO.setSimpleMerchantVO(MerchantCopier.INSTANCE
+                            .merchantDTOToSimpleMerchantVO(o.getMerchant()));
+                    return reservationVO;
+                }).collect(Collectors.toList());
+    }
 }

+ 10 - 7
src/main/java/com/chelvc/cloud/maintain/vo/CategoryVO.java

@@ -5,7 +5,7 @@ import java.util.List;
 
 import com.chelvc.cloud.vehicle.api.constant.CategoryType;
 import com.chelvc.cloud.vehicle.api.dto.CategoryDTO;
-import com.chelvc.framework.common.serializer.JacksonEnumerateSerializer;
+import com.chelvc.framework.base.jackson.EnumerationFormatSerializer;
 import com.fasterxml.jackson.databind.annotation.JsonSerialize;
 import lombok.AllArgsConstructor;
 import lombok.Data;
@@ -28,12 +28,6 @@ public class CategoryVO implements Serializable {
      */
     private Long id;
 
-    /**
-     * 分类类型
-     */
-    @JsonSerialize(using = JacksonEnumerateSerializer.class)
-    private CategoryType type;
-
     /**
      * 分类图标
      */
@@ -47,4 +41,13 @@ public class CategoryVO implements Serializable {
      * 子集分类
      */
     private List<CategoryDTO> children;
+
+    /**
+     * 分类类型 分类类型 0-平台的分类 1-商家的分类
+     */
+    private String  type;
+    /**
+     * 商家ID
+     */
+    private Long merchantId;
 }

+ 5 - 0
src/main/java/com/chelvc/cloud/maintain/vo/ReservationVO.java

@@ -30,6 +30,11 @@ public class ReservationVO implements Serializable {
      */
     private Long userId;
 
+    /**
+     * 用户名称
+     */
+    private String username;
+
     /**
      * 商家ID
      */