ali
2025-02-14 25648562a9c396f9013a26b4a892155ee77becbb
zhitan-admin/src/main/java/com/zhitan/web/controller/energyMonitor/ElectricThreePhaseController.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,65 @@
package com.zhitan.web.controller.energyMonitor;
import com.zhitan.common.annotation.Log;
import com.zhitan.common.core.controller.BaseController;
import com.zhitan.common.core.domain.AjaxResult;
import com.zhitan.energyMonitor.service.IElectricThreePhaseService;
import com.zhitan.model.domain.EnergyIndex;
import com.zhitan.model.service.IEnergyIndexService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils;
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.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
 * @Description: ä¸‰ç›¸ä¸å¹³è¡¡
 * @Author: yxw
 * @Date: 2022-04-24
 * @Version: V1.2
 */
@Api(tags = "三相不平衡")
@RestController
@RequestMapping("/threePhaseUnbalanceAnalysis")
@Slf4j
public class ElectricThreePhaseController extends BaseController {
    @Autowired
    private IElectricThreePhaseService electricThreePhaseService;
    @Autowired
    private IEnergyIndexService energyIndexService;
    /**
     * èŽ·å–ç”¨èƒ½å•å…ƒä¸‹çš„æŸä¸ªç”µè¡¨çš„ä¸‰ç›¸ä¸å¹³è¡¡æ•°æ®
     *
     * @param nodeId èŠ‚ç‚¹id
     * @param meterId      ç”µè¡¨id
     * @param timeType     æ—¶é—´ç±»åž‹ DAY/MONTH/YEAR
     * @param timeCode     æ—¶é—´å€¼ ä¸Žæ—¶é—´ç±»åž‹å¯¹åº”:2022-03-21/2022-03/2022
     * @param requestType  è¯·æ±‚类型:0.电压;1.电流
     * @return
     */
    @Log(title = "根据电表id查询三相不平衡数据")
    @ApiOperation(value = "根据电表id查询三相不平衡数据", notes = "根据电表id查询三相不平衡数据")
    @GetMapping(value = "/detail")
    public AjaxResult list(@RequestParam(name = "nodeId") String nodeId,
                           @RequestParam(name = "meterId") String meterId,
                           @RequestParam(name = "timeType") String timeType,
                           @RequestParam(name = "timeCode") String timeCode,
                           @RequestParam(name = "requestType") String requestType) {
        if (ObjectUtils.isEmpty(meterId)){
            return AjaxResult.error("电表id不能为空");
        }
        List<EnergyIndex> energyIndexList = energyIndexService.listDeviceIndex(nodeId, meterId);
        return AjaxResult.success(electricThreePhaseService.list(timeType, timeCode, energyIndexList, requestType, meterId));
    }
}