whyclxw
2025-05-28 e16302f9d475c7cc4dd18c5abf1a23cb5502e362
src/main/java/com/whyc/controller/PowerInfController.java
@@ -1,8 +1,7 @@
package com.whyc.controller;
import com.baomidou.mybatisplus.extension.api.R;
import com.github.pagehelper.PageInfo;
import com.whyc.dto.Response;
import com.whyc.dto.paramter.PowerInfPar;
import com.whyc.factory.BattinfGroupFactory;
import com.whyc.pojo.Battinf;
import com.whyc.pojo.PowerInf;
@@ -13,23 +12,19 @@
import com.whyc.service.PowerInfService;
import com.whyc.service.StationInfService;
import com.whyc.util.ActionUtil;
import com.whyc.util.CommonUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.poi.util.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.io.PipedWriter;
import java.util.List;
@RequestMapping("powerInf")
@RestController
@Api(tags = "数据管理-电源信息")
public class PowerInfController {
public class PowerInfController extends BaseController{
    @Autowired
    private PowerInfService service;
    @Autowired
@@ -55,11 +50,11 @@
                String nextStationId = battInfService.getNextStationId();
                StationInf station = new StationInf();
                station.setStationId(nextStationId);
                station.setStationName(battinf.getStationName());
                station.setStationName1(battinf.getStationName1());
                station.setStationName2(battinf.getStationName2());
                station.setStationName3(battinf.getStationName3());
                station.setStationName5(battinf.getStationName5());
                station.setStationName(powerInf.getStationName());
                station.setStationName1(powerInf.getStationName1());
                station.setStationName2(powerInf.getStationName2());
                station.setStationName3(powerInf.getStationName3());
                station.setStationName5(powerInf.getStationName5());
                stationInfService.insertStation(station);
                //powerInf.setStationId(String.valueOf(battInfService.searchMaxId_zj()));
                powerInf.setStationId(nextStationId);
@@ -90,19 +85,25 @@
        return res;
    }
    @PutMapping
    @PostMapping("update")
    @ApiOperation(value = "更新电源")
    public Response update(@RequestBody PowerInf powerInf){
        service.updateByPowerDeviceId(powerInf);
        return new Response().set(1,true,"更新成功");
    }
    @DeleteMapping
    @PostMapping("delete")
    @ApiOperation(value = "删除电源")
    public Response delete(@RequestParam Integer powerDeviceId){
        service.deleteByPowerDeviceId(powerDeviceId);
        return new Response().set(1,true,"删除成功");
    }
    @GetMapping("updateSwtichNum")
    @ApiOperation(value = "更新开关路数")
    public Response updateSwtichNum(@RequestParam int swtichNum,@RequestParam int powerId){
        service.updateSwtichNum(swtichNum,powerId);
        return new Response().set(1,true,"更新成功");
    }
    @GetMapping("getProvincesContainBatt")
@@ -156,11 +157,12 @@
        return service.getStations(userInf.getUId(),stationName5);
    }
    @GetMapping("getPowerDevicesPage")
    @PostMapping("getPowerDevicesPage")
    @ApiOperation(value = "用户管理的电源信息分页")
    public Response getPowerDevicesPage(@RequestParam int pageNum,@RequestParam int pageSize,@RequestParam(required = false) String stationId, @RequestParam(required = false) String stationName1,@RequestParam(required = false) String stationName2,@RequestParam(required = false) String stationName5){
    public Response getPowerDevicesPage(@RequestParam int pageNum, @RequestParam int pageSize
            , @RequestBody PowerInfPar powerInfPar) {
        UserInf userInf = (UserInf) ActionUtil.getUser();
        return service.getPowerDevicesPage(pageNum,pageSize,userInf.getUId(),stationId, stationName1,stationName2,stationName5);
        return service.getPowerDevicesPage(pageNum, pageSize, userInf.getUId(), powerInfPar);
    }
@@ -184,21 +186,47 @@
    }*/
    @ApiOperation(value = "填写异常原因",notes = "传入字段 num,exceptionCause,exceptionCauseAnalysis")
    @PutMapping("exceptionCause")
    @PostMapping("exceptionCause")
    public Response updateExceptionCause(@RequestBody PowerInf powerInf){
        return service.updateExceptionCause(powerInf);
    }
    @ApiOperation(value = "取消异常原因",notes = "传入字段 num")
    @PutMapping("cancelExceptionCause")
    public Response updateCancelExceptionCause(@RequestParam int num){
    @ApiOperation(value = "取消异常原因", notes = "传入字段 num")
    @PostMapping("cancelExceptionCause")
    public Response updateCancelExceptionCause(@RequestParam int num) {
        return service.updateCancelExceptionCause(num);
    }
    @ApiOperation(value = "查询异常原因",notes = "传入字段 num")
    @ApiOperation(value = "查询异常原因", notes = "传入字段 num")
    @GetMapping("exceptionCause")
    public Response getExceptionCause(@RequestParam int num){
    public Response getExceptionCause(@RequestParam int num) {
        return service.getExceptionCause(num);
    }
    @GetMapping("getPwrInf")
    @ApiOperation(value = "获取用户管理的机房")
    public Response getPwrInf() {
        UserInf userInf = (UserInf) ActionUtil.getUser();
        return service.getPwrInf(userInf.getUId());
    }
    @GetMapping("getPwrProducer")
    @ApiOperation(value = "获取所有的电源品牌")
    public Response getPwrProducer() {
        return service.getPwrProducer();
    }
    @GetMapping("modelList")
    @ApiOperation(value = "获取所有的型号")
    public Response getModelList() {
        return service.getModelList();
    }
    @PostMapping("getModelListByPwrProducer")
    @ApiOperation(value = "根据品牌查询型号")
    public Response getModelListByPwrProducer(@RequestBody List<String> producer) {
        return service.getModelListByPwrProducer(producer);
    }
}