rk
2 天以前 467fe3b3ec6aa9d449b094bdd9df4611323d88d1
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
package com.doumee.api.web;
 
import com.doumee.core.annotation.LoginRequired;
import com.doumee.core.annotation.LoginShopRequired;
import com.doumee.core.annotation.trace.Trace;
import com.doumee.config.jwt.JwtTokenUtil;
import com.doumee.core.model.ApiResponse;
import com.doumee.core.model.PageData;
import com.doumee.core.model.PageWrap;
import com.doumee.dao.business.model.Member;
import com.doumee.dao.dto.ShopApplyDTO;
import com.doumee.dao.dto.ShopDetailQueryDTO;
import com.doumee.dao.dto.ShopInfoMaintainDTO;
import com.doumee.dao.dto.ShopNearbyDTO;
import com.doumee.dao.vo.ShopDetailVO;
import com.doumee.dao.vo.ShopCenterVO;
import com.doumee.dao.vo.ShopNearbyVO;
import com.doumee.dao.vo.ShopSalesStatsVO;
import com.doumee.dao.vo.ShopWebDetailVO;
import com.doumee.dao.vo.PayResponse;
import com.doumee.service.business.OrdersService;
import com.doumee.service.business.ShopInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
 
/**
 * 门店入驻(小程序端)
 * @author rk
 * @date 2026/04/10
 */
@Api(tags = "门店入驻")
@RestController
@RequestMapping("/web/shopInfo")
public class ShopInfoApi extends ApiController {
 
    @Autowired
    private ShopInfoService shopInfoService;
 
    @Autowired
    private OrdersService ordersService;
 
    @LoginRequired
    @ApiOperation("门店入驻申请/修改")
    @PostMapping("/apply")
    public ApiResponse apply(@RequestBody @Validated ShopApplyDTO request) {
        request.setMemberId(getMemberId());
        shopInfoService.applyShop(request);
        return ApiResponse.success("操作成功");
    }
 
    @LoginRequired
    @ApiOperation("查询我的门店信息")
    @GetMapping("/myShop")
    public ApiResponse<ShopDetailVO> myShop() {
        return ApiResponse.success(shopInfoService.getMyShop(this.getMemberId()));
    }
 
    @ApiOperation("附近门店分页列表")
    @PostMapping("/nearby")
    public ApiResponse<PageData<ShopNearbyVO>> nearby(@RequestBody @Validated PageWrap<ShopNearbyDTO> pageWrap) {
        return ApiResponse.success(shopInfoService.findNearbyShops(pageWrap));
    }
 
    @ApiOperation("门店详情")
    @PostMapping("/detail")
    public ApiResponse<ShopWebDetailVO> detail(@RequestBody @Validated ShopDetailQueryDTO dto) {
        return ApiResponse.success(shopInfoService.getShopWebDetail(dto));
    }
 
    @LoginShopRequired
    @ApiOperation("获取门店登录后信息")
    @GetMapping("/getShopInfo")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "header", dataType = "String", name = "token", value = "门店token值", required = true)
    })
    public ApiResponse<ShopCenterVO> getShopInfo() {
        return ApiResponse.success("查询成功", shopInfoService.getShopCenterInfo(getShopId()));
    }
 
    @LoginShopRequired
    @ApiOperation("门店销售统计")
    @GetMapping("/salesStats")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "header", dataType = "String", name = "token", value = "门店token值", required = true),
            @ApiImplicitParam(paramType = "query", dataType = "Integer", name = "period", value = "统计周期:0=今日, 1=本月, 2=上月", required = true)
    })
    public ApiResponse<ShopSalesStatsVO> salesStats(@RequestParam Integer period) {
        return ApiResponse.success("查询成功", shopInfoService.getShopSalesStats(getShopId(), period));
    }
 
    @LoginShopRequired
    @ApiOperation("维护门店信息(支付押金后)")
    @PostMapping("/maintain")
    public ApiResponse maintain(@RequestBody ShopInfoMaintainDTO dto) {
        shopInfoService.maintainShopInfo(this.getMemberId(), dto);
        return ApiResponse.success("操作成功");
    }
 
    @LoginShopRequired
    @ApiOperation("查询门店维护信息")
    @PostMapping("/maintainInfo")
    public ApiResponse<ShopInfoMaintainDTO> maintainInfo() {
        return ApiResponse.success(shopInfoService.getShopMaintainInfo(this.getMemberId()));
    }
 
    @LoginRequired
    @ApiOperation("门店支付押金")
    @PostMapping("/payDeposit")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "header", dataType = "String", name = "token", value = "门店token值", required = true)
    })
    public ApiResponse<PayResponse> payDeposit() {
        return ApiResponse.success("操作成功", ordersService.payShopDeposit(getMemberId()));
    }
 
    @LoginShopRequired
    @Trace
    @ApiOperation(value = "门店修改密码", notes = "新密码必须同时包含字母和数字,修改成功后需重新登录")
    @PostMapping("/changePassword")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "header", dataType = "String", name = "token", value = "门店token值", required = true),
    })
    public ApiResponse changePassword(@RequestParam String newPassword) {
        String token = this.getRequest().getHeader(JwtTokenUtil.HEADER_KEY);
        shopInfoService.changePassword(this.getShopId(), newPassword, token);
        return ApiResponse.success("密码修改成功,请重新登录");
    }
 
}