审计记录

sk-module-datafill/src/main/java/com/skua/modules/dataAnalysis/controller/PowerAnalysisNewController.java 13.1 KB
张雷 committed
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 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 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 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319
package com.skua.modules.dataAnalysis.controller;

import com.skua.core.api.vo.Result;
import com.skua.core.aspect.annotation.AutoLog;
import com.skua.core.util.DateUtils;
import com.skua.modules.dataAnalysis.service.IPowerAnalysisNewService;
import com.skua.modules.dataAnalysis.vo.OperationMonthVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;
import java.util.List;
import java.util.Map;

@Slf4j
@Api(tags="能耗分析")
@RestController
@RequestMapping("/v1/dataAnalysis/power")
public class PowerAnalysisNewController {

    @Autowired
    private IPowerAnalysisNewService operationMonthService;

    /**
     * 电耗分析
     */
    @AutoLog(value = "电耗分析详情")
    @ApiOperation(value = "电耗分析详情", notes = "电耗分析详情")
    @GetMapping(value = "/powerConsumptionAnalysis")
    public Result powerConsumptionAnalysis(OperationMonthVO operationMonthVO) {
        Result result = new Result();
        Map<String, Object> resultMap = operationMonthService.powerConsumptionAnalysis(operationMonthVO);
        result.setSuccess(true);
        result.setResult(resultMap);
        return result;
    }

    /**
     * 电耗分析详情列表
     */
    @AutoLog(value = "电耗分析详情列表")
    @ApiOperation(value = "电耗分析详情列表", notes = "电耗分析详情列表")
    @GetMapping(value = "/powerConsumptionList")
    public Result powerConsumptionList(String startTime, String endTime, String factoryId) {
        Result result = new Result();
        Map<String, Object> resultMap = operationMonthService.powerConsumptionList(startTime, endTime,factoryId);
        result.setSuccess(true);
        result.setResult(resultMap);
        return result;
    }

    /**
     * 电耗分析
     */
    @AutoLog(value = "电耗分析电耗分布情况")
    @ApiOperation(value = "电耗分析电耗分布情况", notes = "电耗分析电耗分布情况")
    @GetMapping(value = "/powerConsumptionDistribution")
    public Result powerConsumptionDistribution(OperationMonthVO operationMonthVO) {
        Result result = new Result();
        Map<String, Object> resultMap = operationMonthService.powerConsumptionDistribution(operationMonthVO);
        result.setSuccess(true);
        result.setResult(resultMap);
        return result;
    }

    /**
     * 电耗分析电耗分布情况列表
     */
    @AutoLog(value = "电耗分析电耗分布情况列表")
    @ApiOperation(value = "电耗分析电耗分布情况列表", notes = "电耗分析电耗分布情况列表")
    @GetMapping(value = "/powerConsumptionDistributionList")
    public Result powerConsumptionDistributionList(String time, String type) {
        Result result = new Result();
        Map<String, Object> resultMap = operationMonthService.powerConsumptionDistributionList(type, time);
        result.setSuccess(true);
        result.setResult(resultMap);
        return result;
    }

    /**
     * 电耗分析关联分析
     */
    @AutoLog(value = "电耗分析关联分析")
    @ApiOperation(value = "电耗分析关联分析", notes = "电耗分析关联分析")
    @GetMapping(value = "/powerAssociation")
    public Result powerAssociation(OperationMonthVO operationMonthVO) {
        Result result = new Result();
        Map<String, Object> resultMap = operationMonthService.powerAssociation(operationMonthVO);
        result.setSuccess(true);
        result.setResult(resultMap);
        return result;
    }

    /**
     * 电耗分析吨水电耗曲线图
     */
    @AutoLog(value = "电耗分析吨水电耗曲线图")
    @ApiOperation(value = "电耗分析吨水电耗曲线图", notes = "电耗分析吨水电耗曲线图")
    @GetMapping(value = "/powerDSDHCurve")
    public Result powerDSDHCurve(String time, String type, String id) {
        Result result = new Result();
        Map<String, Object> resultMap = operationMonthService.powerDSDHCurve(id, type, time);
        result.setSuccess(true);
        result.setResult(resultMap);
        return result;
    }

    /**
     * 单位污染物削减电耗
     */
    @AutoLog(value = "电耗分析单位污染物削减电耗")
    @ApiOperation(value = "电耗分析单位污染物削减电耗", notes = "电耗分析单位污染物削减电耗")
    @GetMapping(value = "/powerCutDown")
    public Result powerCutDown(String time) {
        Result result = new Result();
        Map<String, Object> resultMap = operationMonthService.powerCutDown(time);
        result.setSuccess(true);
        result.setResult(resultMap);
        return result;
    }

    /**
     * 电耗分析根据厂站单位污染物削减电耗
     */
    @AutoLog(value = "电耗分析根据厂站单位污染物削减电耗")
    @ApiOperation(value = "电耗分析根据厂站单位污染物削减电耗", notes = "电耗分析根据厂站单位污染物削减电耗")
    @GetMapping(value = "/powerCutDownByFac")
    public Result powerCutDownByFac(String startTime, String endTime, String factoryId) {
        Result result = new Result();
        Map<String, Object> resultMap = operationMonthService.powerCutDownByFac(startTime, endTime, factoryId);
        result.setSuccess(true);
        result.setResult(resultMap);
        return result;
    }

    /**
     * 电耗分析获取所有单位污染物削减电耗列表
     */
    @AutoLog(value = "电耗分析获取所有单位污染物削减电耗列表")
    @ApiOperation(value = "电耗分析获取所有单位污染物削减电耗列表", notes = "电耗分析获取所有单位污染物削减电耗列表")
    @GetMapping(value = "/powerCutDownAllList")
    public Result powerCutDownAllList(String time) {
        Result result = new Result();
        Map<String, Object> resultMap = operationMonthService.powerCutDownAllList(time);
        result.setSuccess(true);
        result.setResult(resultMap);
        return result;
    }

    /**
     * 电耗分析根据厂站获取所有单位污染物削减电耗列表
     */
    @AutoLog(value = "电耗分析根据厂站获取所有单位污染物削减电耗列表")
    @ApiOperation(value = "电耗分析根据厂站获取所有单位污染物削减电耗列表", notes = "电耗分析根据厂站获取所有单位污染物削减电耗列表")
    @GetMapping(value = "/powerCutDownAllListByFac")
    public Result powerCutDownAllListByFac(String startTime, String endTime, String factoryId) {
        Result result = new Result();
        Map<String, Object> resultMap = operationMonthService.powerCutDownAllListByFac(startTime, endTime, factoryId);
        result.setSuccess(true);
        result.setResult(resultMap);
        return result;
    }
    /**
     * 电耗分析根据厂站获取所有单位污染物削减电耗列表
     */
    @AutoLog(value = "电耗分析根据厂站获取所有单位污染物削减电耗详情")
    @ApiOperation(value = "电耗分析根据厂站获取所有单位污染物削减电耗详情", notes = "电耗分析根据厂站获取所有单位污染物削减电耗详情")
    @GetMapping(value = "/powerCutDownListByFac")
    public Result powerCutDownListByFac(String startTime, String endTime, String factoryId) {
        Result result = new Result();
        Map<String, Object> resultMap = operationMonthService.powerCutDownListByFac(startTime, endTime, factoryId);
        result.setSuccess(true);
        result.setResult(resultMap);
        return result;
    }

    /**
     * 查詢月度公司级电耗统计
     *
     * @return
     */
    @AutoLog(value = "查詢月度公司级电耗统计")
    @ApiOperation(value = "查詢月度公司级电耗统计", notes = "查詢月度公司级电耗统计")
    @RequestMapping(value = "/queryMonthHDLData", method = RequestMethod.GET)
    public Result<List<Map<String, Object>>> queryMonthHDLData(String startTime,String endTime) {
        Result<List<Map<String, Object>>> result = new Result<>();
        if (StringUtils.isEmpty(startTime)){
            startTime = endTime+"-01";
            endTime = endTime+"-31";
        }
        List<Map<String, Object>> data = operationMonthService.queryMonthHDLData(null,startTime,endTime);
        result.setResult(data);
        result.setSuccess(true);
        return result;
    }

    /**
     * 查詢公司级电耗近半年曲线
     *
     * @return
     */
    @AutoLog(value = "查詢公司级电耗近半年曲线")
    @ApiOperation(value = "查詢公司级电耗近半年曲线", notes = "查詢公司级电耗近半年曲线")
    @RequestMapping(value = "/queryHDLByYear", method = RequestMethod.GET)
    public Result<List<Map<String, String>>> queryHDLByYear(String startTime,String endTime) {
        Result<List<Map<String, String>>> result = new Result<>();

        String startDate = startTime;
        String endDate = endTime;
        if (StringUtils.isEmpty(startDate)) {
            if (StringUtils.isEmpty(startDate)){
                Date date = DateUtils.str2Date(endDate, DateUtils.yyyyMM);
                Date date1 = new Date(date.getTime() - 13176000000L);
                startDate = DateUtils.date2Str(date1,DateUtils.yyyyMM);
            }
        }
        List<Map<String, String>> data = operationMonthService.queryHDLByYear(null,startDate+"-01",endDate+"-31");
        result.setResult(data);
        result.setSuccess(true);
        return result;
    }


    /**
     * 查询各公司电耗详情
     *
     * @return
     */
    @AutoLog(value = "查询各公司电耗详情")
    @ApiOperation(value = "查询各公司电耗详情", notes = "查询各公司电耗详情")
    @RequestMapping(value = "/queryHDLDetails", method = RequestMethod.GET)
    public Result<List<Map<String, Object>>> queryHDLDetails(String startTime, String endTime) {
        Result<List<Map<String, Object>>> result = new Result<>();
        if (StringUtils.isEmpty(startTime)){
            startTime = endTime+"-01";
            endTime = endTime+"-31";
        }
        List<Map<String, Object>> data = operationMonthService.queryHDLDetails(null,startTime,endTime);
        result.setResult(data);
        result.setSuccess(true);
        return result;
    }


    /**
     * 查詢月度厂级电耗统计
     *
     * @return
     */
    @AutoLog(value = "查詢月度厂级电耗统计")
    @ApiOperation(value = "查詢月度厂级电耗统计", notes = "查詢月度厂级电耗统计")
    @RequestMapping(value = "/queryMonthHDLDataByParentId", method = RequestMethod.GET)
    public Result<List<Map<String, Object>>> queryMonthHDLDataByParentId(String parentId,String startTime,String endTime) {
        Result<List<Map<String, Object>>> result = new Result<>();
        if (StringUtils.isEmpty(startTime)){
            startTime = endTime+"-01";
            endTime = endTime+"-31";
        }
        List<Map<String, Object>> data = operationMonthService.queryMonthHDLData(parentId,startTime,endTime);
        result.setResult(data);
        result.setSuccess(true);
        return result;
    }


    /**
     * 查詢公司级电耗近半年曲线
     *
     * @return
     */
    @AutoLog(value = "查詢厂级电耗近半年曲线")
    @ApiOperation(value = "查詢厂级电耗近半年曲线", notes = "查詢厂级电耗近半年曲线")
    @RequestMapping(value = "/queryHDLYearByParentId", method = RequestMethod.GET)
    public Result<List<Map<String, String>>> queryHDLYearByFactoryId(String factoryId,String startTime,String endTime) {
        Result<List<Map<String, String>>> result = new Result<>();

        String startDate = startTime;
        String endDate = endTime;
        if (StringUtils.isEmpty(startDate)) {
            if (StringUtils.isEmpty(startDate)){
                Date date = DateUtils.str2Date(endDate, DateUtils.yyyyMM);
                Date date1 = new Date(date.getTime() - 13176000000L);
                startDate = DateUtils.date2Str(date1,DateUtils.yyyyMM);
            }
        }
        List<Map<String, String>> data = operationMonthService.queryHDLByYear(factoryId,startDate+"-01",endDate+"-31");
        result.setResult(data);
        result.setSuccess(true);
        return result;
    }

    /**
     * 查询各公司电耗详情
     *
     * @return
     */
    @AutoLog(value = "根据公司查询厂级电耗详情")
    @ApiOperation(value = "根据公司查询厂级电耗详情", notes = "根据公司查询厂级电耗详情")
    @RequestMapping(value = "/queryHDLDetailsByParentId", method = RequestMethod.GET)
    public Result<List<Map<String, Object>>> queryHDLDetailsByParentId(String parentId,String startTime, String endTime) {
        Result<List<Map<String, Object>>> result = new Result<>();
        if (StringUtils.isEmpty(startTime)){
            startTime = endTime+"-01";
            endTime = endTime+"-31";
        }
        List<Map<String, Object>> data = operationMonthService.queryHDLDetails(parentId,startTime,endTime);
        result.setResult(data);
        result.setSuccess(true);
        return result;
    }

}