xiaoyong931011
2021-03-12 47f0d9fe4cac4f0eccbb26aa6b7a4903d1749d43
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
package com.matrix.system.fenxiao.action;
 
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.matrix.core.constance.MatrixConstance;
import com.matrix.core.pojo.AjaxResult;
import com.matrix.core.tools.StringUtils;
import com.matrix.core.tools.WebUtil;
import com.matrix.system.common.bean.SysUsers;
import com.matrix.system.fenxiao.dto.ShopSalesmanAppliingDto;
import com.matrix.system.fenxiao.dto.ShopSalesmanApplyDto;
import com.matrix.system.fenxiao.service.ShopSalesmanApplyService;
import com.matrix.system.fenxiao.vo.ShopSalesmanAppliingVo;
import com.matrix.system.fenxiao.vo.ShopSalesmanApplyVo;
import com.matrix.system.fenxiao.vo.ShopSalesmanGradeVo;
import com.matrix.system.hive.action.util.QueryUtil;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
 
import java.util.List;
 
@RestController
@RequestMapping(value = "/fenXiao/fenXiaoUser")
public class FenXiaoUserAction {
    
    @Autowired
    private ShopSalesmanApplyService shopSalesmanApplyService;
 
    /**
     * 查询分销员审核记录
     */
    @ApiOperation(value = "查询分销员审核记录")
    @ApiResponses({
            @ApiResponse(code = 200, message = "OK",  response = ShopSalesmanApplyVo.class)
    })
    @PostMapping(value = "/findShopSalesmanApplyList")
    public @ResponseBody
    AjaxResult findShopSalesmanApplyList(@RequestBody ShopSalesmanApplyDto shopSalesmanApplyDto) {
        //设置用户公司ID
        QueryUtil.setQueryLimitCom(shopSalesmanApplyDto);
        //排序
        if(StringUtils.isBlank(shopSalesmanApplyDto.getSort())){
            shopSalesmanApplyDto.setSort("create_time");
            shopSalesmanApplyDto.setOrder("desc");
        }
        
        Page<ShopSalesmanApplyVo> page = new Page(shopSalesmanApplyDto.getPageNum(), shopSalesmanApplyDto.getPageSize());
        IPage<ShopSalesmanApplyVo> rows = shopSalesmanApplyService.findShopSalesmanApplyList(page,shopSalesmanApplyDto);
        AjaxResult result = AjaxResult.buildSuccessInstance(rows.getRecords(),rows.getTotal());
 
        return result;
    }
    
    /**
     *获取分销员待审核记录
     */
    @ApiOperation(value = "查询分销员审核记录")
    @ApiResponses({
            @ApiResponse(code = 200, message = "OK",  response = ShopSalesmanAppliingVo.class)
    })
    @PostMapping(value = "/findShopSalesmanAppliingList")
    public @ResponseBody
    AjaxResult findShopSalesmanAppliingList(@RequestBody ShopSalesmanAppliingDto shopSalesmanAppliingDto) {
        //设置用户公司ID
        QueryUtil.setQueryLimitCom(shopSalesmanAppliingDto);
        //排序
        if(StringUtils.isBlank(shopSalesmanAppliingDto.getSort())){
            shopSalesmanAppliingDto.setSort("create_time");
            shopSalesmanAppliingDto.setOrder("desc");
        }
 
        Page<ShopSalesmanAppliingVo> page = new Page(shopSalesmanAppliingDto.getPageNum(), shopSalesmanAppliingDto.getPageSize());
        IPage<ShopSalesmanAppliingVo> rows = shopSalesmanApplyService.selectBizUserApplyList(page,shopSalesmanAppliingDto);
 
        //IPage<ShopSalesmanAppliingVo> rows = shopSalesmanApplyService.findShopSalesmanAppliingList(page,shopSalesmanAppliingDto);
        AjaxResult result = AjaxResult.buildSuccessInstance(rows.getRecords(),rows.getTotal());
        return result;
    }
 
    /**
     *获取对应的分销员等级
     */
    @RequestMapping(value = "/getShopSalesmanGrade")
    private @ResponseBody AjaxResult getShopSalesmanGradeVo(){
        AjaxResult result= AjaxResult.buildSuccessInstance("查询成功");
        SysUsers user = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY);
        
        List<ShopSalesmanGradeVo> dataList = shopSalesmanApplyService.getShopSalesmanGradeVo(user.getCompanyId());
        result.putInMap("salesGrade", dataList);
        return result;
    }
    /**
      * 改变发布状态:已发布
      * @param userId
      * 
      */
     @RequestMapping(value = "/addSaleManApply")
     public @ResponseBody AjaxResult addSaleManApply(String userId,long gradeId) {
         AjaxResult result= AjaxResult.buildSuccessInstance("设置成功");
        SysUsers user = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY);
        shopSalesmanApplyService.addSaleManApply(userId,gradeId);
        return result;
    }
 
}