jiangqs
2023-07-16 bd1467a09752fa7b838fd6c1a98d8e7d7687c5a7
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
package com.ruoyi.shop.controller.staff;
 
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.security.utils.SecurityUtils;
import com.ruoyi.shop.domain.dto.StaffShopCCEditDto;
import com.ruoyi.shop.domain.dto.StaffShopECEditDto;
import com.ruoyi.shop.domain.dto.StaffShopEstimateEditDto;
import com.ruoyi.shop.domain.dto.StaffShopPageDto;
import com.ruoyi.shop.domain.vo.StaffHomeShopTotalVo;
import com.ruoyi.shop.domain.vo.StaffShopInfoGetVo;
import com.ruoyi.shop.domain.vo.StaffShopPageVo;
import com.ruoyi.shop.domain.vo.StaffShopSimpleTotalVo;
import com.ruoyi.shop.service.shop.ShopService;
import com.ruoyi.system.api.domain.dto.StaffBaseGetDto;
import com.ruoyi.system.api.service.RemoteSysStaffService;
import com.ruoyi.system.api.service.RemoteUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
 
import javax.annotation.Resource;
import java.util.List;
 
 
@Api(value = "员工端商户接口", tags = "员工端商户接口", description = "员工端商户接口")
@RestController
@RequestMapping("/staff/shop")
public class StaffShopController {
 
    @Resource
    private ShopService shopService;
    @Resource
    private RemoteUserService sysUserService;
    @Resource
    private RemoteSysStaffService remoteSysStaffService;
 
    /**
     * 未完成实际统计
     * @return
     */
    @RequestMapping(value = "/getStaffHomeTotal", method = RequestMethod.POST)
    @ApiOperation(value = "获取员工端商铺统计(首页)")
    public R<StaffHomeShopTotalVo> getStaffHomeTotal() {
        Long userId = SecurityUtils.getUserId();
        StaffHomeShopTotalVo staffHomeShopTotalVo = shopService.getStaffHomeTotal(userId);
        return R.ok(staffHomeShopTotalVo);
    }
 
    @RequestMapping(value = "/listStaffShop", method = RequestMethod.POST)
    @ApiOperation(value = "分页获取员工端商户列表")
    public R<Page<StaffShopPageVo>> listStaffShop(@RequestBody StaffShopPageDto staffShopPageDto) {
        Long userId = SecurityUtils.getUserId();
        if (remoteSysStaffService.isLeader()) {
            List<Long> userIds = sysUserService.getUserIdsByDept(userId).getData();
            userIds.add(userId);
            staffShopPageDto.setUserIdList(userIds);
        } else {
            staffShopPageDto.setBelongUserId(userId);
        }
        Page<StaffShopPageVo> page = new Page<>();
        page.setSize(staffShopPageDto.getPageSize());
        page.setCurrent(staffShopPageDto.getPageNum());
        List<StaffShopPageVo> staffShopPageVoList = shopService.pageStaffShop(page,staffShopPageDto);
        return R.ok(page.setRecords(staffShopPageVoList));
    }
 
    @RequestMapping(value = "/getStaffSimpleTotal", method = RequestMethod.POST)
    @ApiOperation(value = "获取员工端商铺数量统计")
    public R<StaffShopSimpleTotalVo> getStaffSimpleTotal() {
        Long userId = SecurityUtils.getUserId();
        StaffShopSimpleTotalVo staffShopSimpleTotalVo = shopService.getStaffSimpleTotal(userId);
        return R.ok(staffShopSimpleTotalVo);
    }
 
    @RequestMapping(value = "/getStaffShopInfo", method = RequestMethod.POST)
    @ApiOperation(value = "获取员工端商户信息")
    public R<StaffShopInfoGetVo> getStaffShopInfo(@RequestBody StaffBaseGetDto staffBaseGetDto) {
        Long userId = SecurityUtils.getUserId();
        StaffShopInfoGetVo staffShopInfoGetVo = shopService.getStaffShopInfo(Long.valueOf(staffBaseGetDto.getId()));
        return R.ok(staffShopInfoGetVo);
    }
 
 
    @RequestMapping(value = "/editShopEstimate", method = RequestMethod.POST)
    @ApiOperation(value = "修改店铺评估")
    public R editShopEstimate(@RequestBody StaffShopEstimateEditDto staffShopEstimateEditDto) {
        Long userId = SecurityUtils.getUserId();
        staffShopEstimateEditDto.setUserId(userId);
        shopService.editShopEstimate(staffShopEstimateEditDto);
        return R.ok();
    }
 
    @RequestMapping(value = "/editExtendContacts", method = RequestMethod.POST)
    @ApiOperation(value = "修改店铺扩展联系人")
    public R editExtendContacts(@RequestBody StaffShopECEditDto staffShopECEditDto) {
        Long userId = SecurityUtils.getUserId();
        staffShopECEditDto.setUserId(userId);
        shopService.editExtendContacts(staffShopECEditDto);
        return R.ok();
    }
 
    @RequestMapping(value = "/editShopCustomStatus", method = RequestMethod.POST)
    @ApiOperation(value = "修改店铺状态")
    public R editShopCustomStatus(@RequestBody StaffShopCCEditDto staffShopCCEditDto) {
        Long userId = SecurityUtils.getUserId();
        staffShopCCEditDto.setUserId(userId);
        shopService.editShopCustomStatus(staffShopCCEditDto);
        return R.ok();
    }
 
 
}