mitao
2025-02-21 31573d6180d15ef65ed0df9c2732495f40b12663
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
package com.panzhihua.applets.api;
 
import java.util.Objects;
 
import javax.annotation.Resource;
import javax.validation.Valid;
 
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.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
 
import com.panzhihua.common.controller.BaseController;
import com.panzhihua.common.model.dtos.community.PageComCvtBusinessAppletsDTO;
import com.panzhihua.common.model.dtos.community.convenient.PageClassifyMerchantDTO;
import com.panzhihua.common.model.dtos.community.convenient.PagePopularMerchantDTO;
import com.panzhihua.common.model.dtos.community.convenient.PageSearchDTO;
import com.panzhihua.common.model.vos.LoginUserInfoVO;
import com.panzhihua.common.model.vos.R;
import com.panzhihua.common.model.vos.community.ComCvtBusinessDetailVO;
import com.panzhihua.common.model.vos.community.ComCvtBusinessVO;
import com.panzhihua.common.model.vos.community.convenient.ConvenientMerchantVO;
import com.panzhihua.common.model.vos.community.convenient.ConvenientProductLevelInfoVO;
import com.panzhihua.common.model.vos.community.convenient.ConvenientProductVO;
import com.panzhihua.common.model.vos.community.convenient.ConvenientServiceCategoryVO;
import com.panzhihua.common.service.community.CommunityService;
 
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
 
/**
 * @description: 社区便民服务商家接口
 * @author: Null
 * @date: 2021/3/11 13:26
 */
@Slf4j
@Api(tags = {"社区运营/便民服务"})
@RestController
@RequestMapping("/convenient")
public class CommunityConvenientApi extends BaseController {
 
    @Resource
    private CommunityService communityService;
 
    @Deprecated
    @ApiOperation(value = "分页查询便民服务商家", response = ComCvtBusinessVO.class)
    @PostMapping("/business/area/page")
    public R pageComCvtBusiness(@RequestBody PageComCvtBusinessAppletsDTO comCvtBusinessAppletsDTO) {
        LoginUserInfoVO loginUserInfo = this.getLoginUserInfoSureNoLogin();
        if (loginUserInfo != null) {
            comCvtBusinessAppletsDTO.setCommunityId(loginUserInfo.getCommunityId());
        }
        return communityService.pageComCvtBusinessByServiceArea(comCvtBusinessAppletsDTO);
    }
 
    @Deprecated
    @ApiOperation(value = "查询便民服务商家详情", response = ComCvtBusinessDetailVO.class)
    @GetMapping("/business/get")
    public R getComCvtBusinessServeDetail(@RequestParam("id") Long id) {
        return communityService.getComCvtBusinessServeDetail(id);
    }
 
    @ApiOperation(value = "获取商家数量大于0的服务类型", response = ConvenientServiceCategoryVO.class)
    @GetMapping("/service-category/suitable")
    public R getSuitableServiceCategories(@RequestParam("communityId") Long communityId) {
        if (Objects.isNull(communityId)) {
            return R.fail("社区id不能为空");
        }
        return communityService.getSuitableServiceCategories(communityId,this.getAreaCode());
    }
 
    @ApiOperation(value = "分页获取热门商家", response = ConvenientMerchantVO.class)
    @PostMapping("/merchant/popular")
    public R getPopularMerchants(@RequestBody @Valid PagePopularMerchantDTO pagePopularMerchantDTO) {
        pagePopularMerchantDTO.setAreaCode(this.getAreaCode());
        return communityService.getPopularMerchants(pagePopularMerchantDTO);
    }
 
    @ApiOperation(value = "分页获取服务类型下商家", response = ConvenientMerchantVO.class)
    @PostMapping("/merchant/classify")
    public R getClassifyMerchants(@RequestBody @Valid PageClassifyMerchantDTO pageClassifyMerchantDTO) {
        pageClassifyMerchantDTO.setAreaCode(this.getAreaCode());
        return communityService.getClassifyMerchants(pageClassifyMerchantDTO);
    }
 
    @ApiOperation(value = "商家详情", response = ConvenientMerchantVO.class)
    @GetMapping("/merchant/detail")
    public R getMerchantDetail(@RequestParam("merchantId") Long merchantId) {
        return communityService.getMerchantDetail(merchantId);
    }
 
    @ApiOperation(value = "获取商家产品", response = ConvenientProductLevelInfoVO.class)
    @GetMapping("/product/list")
    public R getMerchantProduct(@RequestParam("merchantId") Long merchantId) {
        return communityService.getMerchantProduct(merchantId);
    }
 
    @ApiOperation(value = "获取产品详情", response = ConvenientProductVO.class)
    @GetMapping("/product/detail")
    public R getProductDetail(@RequestParam("productId") Long productId) {
        return communityService.getProductDetail(productId);
    }
 
    @ApiOperation(value = "商家分页搜索", response = ConvenientMerchantVO.class)
    @PostMapping("/merchant/search")
    public R pageSearchMerchant(@RequestBody @Valid PageSearchDTO pageSearchDTO) {
        return communityService.pageSearchMerchant(pageSearchDTO);
    }
 
    @ApiOperation(value = "商品分页搜索", response = ConvenientProductVO.class)
    @PostMapping("/product/search")
    public R pageSearchProduct(@RequestBody @Valid PageSearchDTO pageSearchDTO) {
        return communityService.pageSearchProduct(pageSearchDTO);
    }
 
    @ApiOperation(value = "增加商家咨询量")
    @GetMapping("/merchant/incr-consult")
    public R incrMerchantConsult(@RequestParam("merchantId") Long merchantId) {
        return communityService.consultMerchant(merchantId);
    }
 
    @ApiOperation(value = "增加商家浏览量")
    @GetMapping("/merchant/incr-view")
    public R incrMerchantView(@RequestParam("merchantId") Long merchantId) {
        return communityService.incrMerchantView(merchantId);
    }
 
    @ApiOperation(value = "增加产品浏览量")
    @GetMapping("/product/incr-view")
    public R incrProductView(@RequestParam("productId") Long productId) {
        return communityService.incrProductView(productId);
    }
}