TBoardStatisticController.java 11.1 KB
Newer Older
yangtianyou's avatar
yangtianyou committed
1 2
package cn.wisenergy.chnmuseum.party.web.controller;

wzp's avatar
wzp committed
3 4 5
import cn.wisenergy.chnmuseum.party.common.log.MethodLog;
import cn.wisenergy.chnmuseum.party.common.log.OperModule;
import cn.wisenergy.chnmuseum.party.common.log.OperType;
yangtianyou's avatar
yangtianyou committed
6
import cn.wisenergy.chnmuseum.party.common.util.DateUtil;
yangtianyou's avatar
yangtianyou committed
7
import cn.wisenergy.chnmuseum.party.model.*;
yangtianyou's avatar
yangtianyou committed
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import cn.wisenergy.chnmuseum.party.web.controller.base.BaseController;
import cn.wisenergy.chnmuseum.party.service.TBoardStatisticService;
import cn.wisenergy.chnmuseum.party.common.enums.AuditStatusEnum;
import cn.wisenergy.chnmuseum.party.common.validator.groups.Add;
import cn.wisenergy.chnmuseum.party.common.validator.groups.Update;
import cn.wisenergy.chnmuseum.party.common.vo.GenericPageParam;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;

import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
wzp's avatar
wzp committed
25
import org.apache.shiro.authz.annotation.RequiresAuthentication;
yangtianyou's avatar
yangtianyou committed
26 27 28 29 30 31
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.constraints.NotNull;
yangtianyou's avatar
yangtianyou committed
32 33
import java.util.ArrayList;
import java.util.HashMap;
yangtianyou's avatar
yangtianyou committed
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
import java.util.List;
import java.util.Map;

/**
 * <pre>
 * 展板统计信息表 前端控制器
 * </pre>
 *
 * @author Danny Lee
 * @since 2021-03-25
 */
@Slf4j
@RestController
@RequestMapping("/tBoardStatistic")
@Api(tags = {"展板统计信息表操作接口"})
public class TBoardStatisticController extends BaseController {

    @Resource
    private TBoardStatisticService tBoardStatisticService;

yangtianyou's avatar
yangtianyou committed
54 55 56 57 58
//    @ApiImplicitParams(value = {
//            @ApiImplicitParam(name = "_index", value = "分页起始偏移量", paramType = "query", dataType = "Integer"),
//            @ApiImplicitParam(name = "_size", value = "返回条数", paramType = "query", dataType = "Integer")
//    })
    @PostMapping("/getBoardSurvey")
wzp's avatar
wzp committed
59
//    @RequiresAuthentication  //@RequiresPermissions("t:board:statistic:survey")
yangtianyou's avatar
yangtianyou committed
60
    @ApiOperation(value = "获取展板统计概况", notes = "获取展板统计概况")
wzp's avatar
wzp committed
61
//    @MethodLog(operModule = OperModule.OVERVIEW, operType = OperType.SELECT)
yangtianyou's avatar
yangtianyou committed
62
    public Map<String, Object> getBoardSurvey(TBoardSurvey survey) {
yangtianyou's avatar
yangtianyou committed
63

yangtianyou's avatar
yangtianyou committed
64 65 66 67
        TBoardSurvey result = this.tBoardStatisticService.getBoardSurvey(survey);

        return getResult(result);
    }
yangtianyou's avatar
yangtianyou committed
68 69 70 71 72 73

    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "_index", value = "分页起始偏移量", paramType = "query", dataType = "Integer"),
            @ApiImplicitParam(name = "_size", value = "返回条数", paramType = "query", dataType = "Integer")
    })
    @PostMapping("/getBoardRankPageList")
wzp's avatar
wzp committed
74
//    @RequiresAuthentication  //@RequiresPermissions("t:board:statistic:rankPage")
yangtianyou's avatar
yangtianyou committed
75
    @ApiOperation(value = "获取展板播放排行", notes = "获取展板播放排行")
wzp's avatar
wzp committed
76
//    @MethodLog(operModule = OperModule.OVERVIEW, operType = OperType.SELECT)
yangtianyou's avatar
yangtianyou committed
77 78 79 80 81 82 83 84 85 86 87 88 89 90
    public Map<String, Object> getBoardRankPageList(TBoardPlayRank rank) {

        Page<TBoardPlayRank> page = this.tBoardStatisticService.getBoardRankPageList(getPage(),rank);
        for (TBoardPlayRank tBoardStatistic : page.getRecords()) {

        }
        return getResult(page);
    }

    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "_index", value = "分页起始偏移量", paramType = "query", dataType = "Integer"),
            @ApiImplicitParam(name = "_size", value = "返回条数", paramType = "query", dataType = "Integer")
    })
    @PostMapping("/getBoardTrendPageList")
wzp's avatar
wzp committed
91
//    @RequiresAuthentication  //@RequiresPermissions("t:board:statistic:trendPage")
yangtianyou's avatar
yangtianyou committed
92
    @ApiOperation(value = "获取展板播放趋势", notes = "获取展板播放趋势")
wzp's avatar
wzp committed
93
//    @MethodLog(operModule = OperModule.OVERVIEW, operType = OperType.SELECT)
yangtianyou's avatar
yangtianyou committed
94
    public Map<String, Object> getBoardTrendPageList(TBoardPlayTrend trend) {
yangtianyou's avatar
yangtianyou committed
95
        // 如果查询日志为空,则默认当月
yangtianyou's avatar
yangtianyou committed
96
        if (StringUtils.isEmpty(trend.getPlayDate())){
yangtianyou's avatar
yangtianyou committed
97
            trend.setPlayDate(DateUtil.getCurrentDate("yyyyMM"));
yangtianyou's avatar
yangtianyou committed
98 99 100
        }

        Page<TBoardPlayTrend> page = this.tBoardStatisticService.getBoardTrendPageList(getPage(),trend);
yangtianyou's avatar
yangtianyou committed
101 102 103 104 105 106 107
        // 处理数据为展板趋势图
        Map map = new HashMap();
        List dateList = new ArrayList();
        List cntList = new ArrayList();
        for (TBoardPlayTrend t : page.getRecords()) {
            dateList.add(t.getPlayDate());
            cntList.add(t.getPlayNumber());
yangtianyou's avatar
yangtianyou committed
108
        }
yangtianyou's avatar
yangtianyou committed
109 110
        map.put("dateList",dateList);
        map.put("cntList",cntList);
wzp's avatar
wzp committed
111
        map.put("page",page);
yangtianyou's avatar
yangtianyou committed
112
        return getResult(map);
yangtianyou's avatar
yangtianyou committed
113 114 115 116 117 118 119 120
    }


    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "_index", value = "分页起始偏移量", paramType = "query", dataType = "Integer"),
            @ApiImplicitParam(name = "_size", value = "返回条数", paramType = "query", dataType = "Integer")
    })
    @PostMapping("/getBoardDistrictPageList")
wzp's avatar
wzp committed
121
//    @RequiresAuthentication  //@RequiresPermissions("t:board:statistic:districtPage")
yangtianyou's avatar
yangtianyou committed
122
    @ApiOperation(value = "获取地区展板播统计", notes = "获取地区展板播统计")
wzp's avatar
wzp committed
123
//    @MethodLog(operModule = OperModule.OVERVIEW, operType = OperType.SELECT)
yangtianyou's avatar
yangtianyou committed
124 125 126 127 128 129 130 131
    public Map<String, Object> getBoardDistrictPageList(TDistrictBoardStatistic district) {

        Page<TDistrictBoardStatistic> page = this.tBoardStatisticService.getBoardDistrictPageList(getPage(),district);
        for (TDistrictBoardStatistic tBoardStatistic : page.getRecords()) {

        }
        return getResult(page);
    }
yangtianyou's avatar
yangtianyou committed
132 133 134 135 136 137 138

    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "_index", value = "分页起始偏移量", paramType = "query", dataType = "Integer"),
            @ApiImplicitParam(name = "_size", value = "返回条数", paramType = "query", dataType = "Integer"),
            @ApiImplicitParam(name = "organId", value = "统计机构", paramType = "query", dataType = "String")
    })
    @PostMapping("/getBoardProvincePlayTotalList")
wzp's avatar
wzp committed
139
//    @RequiresAuthentication  //@RequiresPermissions("t:board:statistic:provPlayList")
yangtianyou's avatar
yangtianyou committed
140
    @ApiOperation(value = "获取省级展板播放统计", notes = "获取省级展板播放统计")
wzp's avatar
wzp committed
141
//    @MethodLog(operModule = OperModule.OVERVIEW, operType = OperType.SELECT)
yangtianyou's avatar
yangtianyou committed
142 143 144 145 146 147 148 149 150 151 152 153
    public Map<String, Object> getBoardProvincePlayTotalList(String organId) {

        List list = this.tBoardStatisticService.getBoardProvincePlayTotalList(organId);
        return getResult(list);
    }

    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "_index", value = "分页起始偏移量", paramType = "query", dataType = "Integer"),
            @ApiImplicitParam(name = "_size", value = "返回条数", paramType = "query", dataType = "Integer"),
            @ApiImplicitParam(name = "frequencyDate", value = "互动统计时间 年:yyyy 月:yyyyMM,默认当月", paramType = "query", dataType = "String")
    })
    @PostMapping("/getInteractionFrequencyPageList")
wzp's avatar
wzp committed
154
//    @RequiresAuthentication  //@RequiresPermissions("t:board:statistic:districtPage")
yangtianyou's avatar
yangtianyou committed
155
    @ApiOperation(value = "获取互动频次统计信息", notes = "获取互动频次统计信息")
wzp's avatar
wzp committed
156
//    @MethodLog(operModule = OperModule.OVERVIEW, operType = OperType.SELECT)
yangtianyou's avatar
yangtianyou committed
157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176
    public Map<String, Object> getInteractionFrequencyPageList(String frequencyDate) {
        if (StringUtils.isEmpty(frequencyDate)){
            frequencyDate = DateUtil.getCurrentDate("yyyyMM");
        }

        Page page = this.tBoardStatisticService.getInteractionFrequency(getPage(),frequencyDate);
        //
        Map map = new HashMap();
        List organList = new ArrayList<>();
        List cntList = new ArrayList();
        for (Object o : page.getRecords()){
            Map m = (HashMap) o;
            organList.add(m.get("organName"));
            cntList.add(m.get("frequencyCnt"));
        }
        map.put("organList",organList);
        map.put("cntList",cntList);
        map.put("page",page);
        return getResult(map);
    }
yangtianyou's avatar
yangtianyou committed
177

wzp's avatar
wzp committed
178 179 180 181 182 183 184 185 186 187 188

    /**
     * 以下两个接口是为方便区分日志模块
     * @param trend
     * @return
     */
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "_index", value = "分页起始偏移量", paramType = "query", dataType = "Integer"),
            @ApiImplicitParam(name = "_size", value = "返回条数", paramType = "query", dataType = "Integer")
    })
    @PostMapping("/getBoardPageList")
wzp's avatar
wzp committed
189
    @RequiresAuthentication  //@RequiresPermissions("t:board:statistic:Page")
wzp's avatar
wzp committed
190
    @ApiOperation(value = "获取展板播放趋势", notes = "获取展板播放趋势")
wzp's avatar
wzp committed
191
//    @MethodLog(operModule = OperModule.TEND, operType = OperType.SELECT)
wzp's avatar
wzp committed
192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219
    public Map<String, Object> getBoardPageList(TBoardPlayTrend trend) {
        // 如果查询日志为空,则默认当月
        if (StringUtils.isEmpty(trend.getPlayDate())){
            trend.setPlayDate(DateUtil.getCurrentDate("yyyyMM"));
        }

        Page<TBoardPlayTrend> page = this.tBoardStatisticService.getBoardTrendPageList(getPage(),trend);
        // 处理数据为展板趋势图
        Map map = new HashMap();
        List dateList = new ArrayList();
        List cntList = new ArrayList();
        for (TBoardPlayTrend t : page.getRecords()) {
            dateList.add(t.getPlayDate());
            cntList.add(t.getPlayNumber());
        }
        map.put("dateList",dateList);
        map.put("cntList",cntList);
        map.put("page",page);
        return getResult(map);
    }


    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "_index", value = "分页起始偏移量", paramType = "query", dataType = "Integer"),
            @ApiImplicitParam(name = "_size", value = "返回条数", paramType = "query", dataType = "Integer"),
            @ApiImplicitParam(name = "frequencyDate", value = "互动统计时间 年:yyyy 月:yyyyMM,默认当月", paramType = "query", dataType = "String")
    })
    @PostMapping("/getInteractionPageList")
wzp's avatar
wzp committed
220
    @RequiresAuthentication  //@RequiresPermissions("t:interaction:statistic:districtPage")
wzp's avatar
wzp committed
221
    @ApiOperation(value = "获取互动频次统计信息", notes = "获取互动频次统计信息")
wzp's avatar
wzp committed
222
//    @MethodLog(operModule = OperModule.INTERACTION, operType = OperType.SELECT)
wzp's avatar
wzp committed
223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242
    public Map<String, Object> getInteractionPageList(String frequencyDate) {
        if (StringUtils.isEmpty(frequencyDate)){
            frequencyDate = DateUtil.getCurrentDate("yyyyMM");
        }

        Page page = this.tBoardStatisticService.getInteractionFrequency(getPage(),frequencyDate);
        //
        Map map = new HashMap();
        List organList = new ArrayList<>();
        List cntList = new ArrayList();
        for (Object o : page.getRecords()){
            Map m = (HashMap) o;
            organList.add(m.get("organName"));
            cntList.add(m.get("frequencyCnt"));
        }
        map.put("organList",organList);
        map.put("cntList",cntList);
        map.put("page",page);
        return getResult(map);
    }
yangtianyou's avatar
yangtianyou committed
243 244
}