Helius
2021-01-11 854d9d55a86b7076abc4f526e90001bd806d324c
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
package com.matrix.system.app.action;
 
import com.matrix.core.pojo.AjaxResult;
import com.matrix.core.tools.DateUtil;
import com.matrix.system.app.dto.RankingDto;
import com.matrix.system.app.vo.RankingVo;
import com.matrix.system.common.tools.DataAuthUtil;
import com.matrix.system.hive.action.util.QueryUtil;
import com.matrix.system.hive.bean.AchieveNew;
import com.matrix.system.hive.bean.SysOrder;
import com.matrix.system.hive.dao.AchieveNewDao;
import com.matrix.system.hive.service.AchieveNewService;
import com.matrix.system.hive.service.SysOrderService;
import io.swagger.annotations.Api;
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.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
 
import java.util.Date;
import java.util.List;
 
/**
 * @author wzy
 * @date 2020-12-28
 **/
@Api(value = "ApiRankingAction", tags = "排行榜接口类")
@RestController
@RequestMapping(value ="/api/ranking")
public class ApiRankingAction {
 
    @Autowired
    private SysOrderService sysOrderService;
 
    @Autowired
    private AchieveNewDao achieveNewDao;
 
    @ApiOperation(value = "顾问业绩排行榜", notes = "顾问业绩排行榜")
    @ApiResponses({
            @ApiResponse(code = 200, message = "ok", response = RankingVo.class)
    })
    @PostMapping(value = "/findStaffAchieveRanking")
    public AjaxResult findStaffAchieveRanking(@RequestBody RankingDto rankingDto) {
        SysOrder sysOrder = new SysOrder();
        if (DataAuthUtil.hasAllShopAuth()) {
            QueryUtil.setQueryLimitCom(sysOrder);
        } else {
            QueryUtil.setQueryLimit(sysOrder);
        }
        sysOrder.setOrderTime(new Date());
        sysOrder.setType(rankingDto.getType());
        return AjaxResult.buildSuccessInstance(sysOrderService.findStaffSaleAchieveRanking(sysOrder));
    }
 
    @ApiOperation(value = "门店业绩排行榜", notes = "门店业绩排行榜")
    @ApiResponses({
            @ApiResponse(code = 200, message = "ok", response = RankingVo.class)
    })
    @PostMapping(value = "/findShopAchieveRanking")
    public AjaxResult findShopAchieveRanking(@RequestBody RankingDto rankingDto) {
        AjaxResult ajaxResult = AjaxResult.buildSuccessInstance("");
        if (RankingDto.SALE.equals(rankingDto.getDataType())) {
            SysOrder sysOrder = new SysOrder();
            QueryUtil.setQueryLimitCom(sysOrder);
            sysOrder.setType(rankingDto.getType());
            sysOrder.setOrderTime(new Date());
            List<RankingVo> list = sysOrderService.findApiShopAchieveRanking(sysOrder);
            ajaxResult.setRows(list);
        } else {
            AchieveNew achieveNew = new AchieveNew();
            QueryUtil.setQueryLimitCom(achieveNew);
            achieveNew.setDatatime(new Date());
            achieveNew.setT1(rankingDto.getType());
            List<RankingVo> rankingVos = achieveNewDao.selectShopConsumeAchieveRanking(achieveNew);
            ajaxResult.setRows(rankingVos);
        }
        return ajaxResult;
    }
 
    @ApiOperation(value = "美疗师业绩排行榜", notes = "美疗师业绩排行榜")
    @ApiResponses({
            @ApiResponse(code = 200, message = "ok", response = RankingVo.class)
    })
    @PostMapping(value = "/findBeauticianAchieveRanking")
    public AjaxResult findBeauticianAchieveRanking(@RequestBody RankingDto rankingDto) {
        AchieveNew achieveNew = new AchieveNew();
        if (DataAuthUtil.hasAllShopAuth()) {
            QueryUtil.setQueryLimitCom(achieveNew);
        } else {
            QueryUtil.setQueryLimit(achieveNew);
        }
        achieveNew.setDatatime(new Date());
        achieveNew.setT1(rankingDto.getType());
        return AjaxResult.buildSuccessInstance(achieveNewDao.selectBeauticianConsumeAchieveRanking(achieveNew));
    }
}