bug
jiangqs
2023-08-18 0b413f3fd67110cfd7752f27eb171bde06edc4b4
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
package com.ruoyi.system.controller.staff;
 
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.security.utils.SecurityUtils;
import com.ruoyi.system.api.domain.dto.StaffPageDto;
import com.ruoyi.system.api.domain.poji.sys.SysUser;
import com.ruoyi.system.domain.dto.MgtSysStaffImportDto;
import com.ruoyi.system.domain.dto.StaffUseSuggestDto;
import com.ruoyi.system.domain.pojo.staff.SysStaff;
import com.ruoyi.system.domain.vo.StaffSuggestPageVo;
import com.ruoyi.system.domain.vo.StaffUserGetVo;
import com.ruoyi.system.service.config.StaffSuggestService;
import com.ruoyi.system.service.staff.SysStaffService;
import com.ruoyi.system.service.sys.ISysUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
 
import javax.annotation.Resource;
import java.util.List;
 
import static com.ruoyi.common.core.web.domain.AjaxResult.success;
 
/**
 * @author jqs34
 * @version 1.0
 * @classname StaffUserController
 * @description: TODO
 * @date 2023 2023/7/16 12:02
 */
@Api(value = "员工端商户接口", tags = "员工端商户接口", description = "员工端商户接口")
@RestController
@RequestMapping("/staff/sys")
public class StaffSysController {
 
    @Resource
    private SysStaffService sysStaffService;
 
    @Resource
    private ISysUserService sysUserService;
 
    @Resource
    private StaffSuggestService staffSuggestService;
 
    @RequestMapping(value = "/getStaffShopInfo", method = RequestMethod.POST)
    @ApiOperation(value = "获取员工端商户信息")
    public R<StaffUserGetVo> getStaffShopInfo() {
        Long userId = SecurityUtils.getUserId();
        SysStaff sysStaff = sysStaffService.getByUserId(userId);
        SysUser sysUser = sysUserService.selectUserById(userId);
        StaffUserGetVo staffUserGetVo = new StaffUserGetVo();
        staffUserGetVo.setUserId(sysStaff.getUserId());
        staffUserGetVo.setStaffName(sysStaff.getStaffName());
        staffUserGetVo.setStaffMobile(sysStaff.getStaffMobile());
        staffUserGetVo.setStaffAvatar(sysStaff.getStaffAvatar());
        staffUserGetVo.setStaffDept(sysUser.getDept().getDeptName());
        staffUserGetVo.setStaffPost(sysStaff.getStaffPost());
        return R.ok(staffUserGetVo);
    }
 
    @RequestMapping(value = "/staffSuggest", method = RequestMethod.POST)
    @ApiOperation(value = "员工发起建议")
    public R userSuggest(@RequestBody StaffUseSuggestDto staffUseSuggestDto) {
        Long userId = SecurityUtils.getUserId();
        staffUseSuggestDto.setUserId(userId);
        staffSuggestService.staffSuggest(staffUseSuggestDto);
        return R.ok();
    }
 
    @RequestMapping(value = "/pageStaffShopSuggest", method = RequestMethod.POST)
    @ApiOperation(value = "分页获取员工建议")
    public R<Page<StaffSuggestPageVo>> pageStaffShopSuggest(@RequestBody StaffPageDto staffPageDto) {
        Long userId = SecurityUtils.getUserId();
        staffPageDto.setUserId(userId);
        Page<StaffSuggestPageVo> page = new Page<>();
        page.setSize(staffPageDto.getPageSize());
        page.setCurrent(staffPageDto.getPageNum());
        List<StaffSuggestPageVo> staffSuggestPageVoList = staffSuggestService.pageStaffShopSuggest(page,staffPageDto);
        return R.ok(page.setRecords(staffSuggestPageVoList));
    }
 
 
}