lxw
2023-05-25 f3c27fb78447449a950ba73c5e72ceda64ad8a12
src/main/java/com/whyc/controller/PowerInfController.java
@@ -6,10 +6,12 @@
import com.whyc.factory.BattinfGroupFactory;
import com.whyc.pojo.Battinf;
import com.whyc.pojo.PowerInf;
import com.whyc.pojo.StationInf;
import com.whyc.pojo.UserInf;
import com.whyc.service.BattInfService;
import com.whyc.service.PowerAppSysService;
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;
@@ -34,6 +36,8 @@
    private BattInfService battInfService;
    @Autowired
    private PowerAppSysService powerAppSysService;
    @Autowired
    private StationInfService stationInfService;
    @PostMapping
    @ApiOperation(value = "添加电源")
@@ -47,7 +51,18 @@
            if (battinf!=null) {
                powerInf.setStationId(battinf.getStationId());
            }else {
                powerInf.setStationId(String.valueOf(battInfService.searchMaxId_zj()));
                //站点不存在,需要新建站点记录
                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());
                stationInfService.insertStation(station);
                //powerInf.setStationId(String.valueOf(battInfService.searchMaxId_zj()));
                powerInf.setStationId(nextStationId);
            }
        }
        int devId = battInfService.getPowerDeviceId(powerInf.getPowerDeviceType());
@@ -168,5 +183,22 @@
        return service.getPowerInfoById(powerDeviceId);
    }*/
    @ApiOperation(value = "填写异常原因",notes = "传入字段 num,exceptionCause,exceptionCauseAnalysis")
    @PutMapping("exceptionCause")
    public Response updateExceptionCause(@RequestBody PowerInf powerInf){
        return service.updateExceptionCause(powerInf);
    }
    @ApiOperation(value = "取消异常原因",notes = "传入字段 num")
    @PutMapping("cancelExceptionCause")
    public Response updateCancelExceptionCause(@RequestParam int num){
        return service.updateCancelExceptionCause(num);
    }
    @ApiOperation(value = "查询异常原因",notes = "传入字段 num")
    @GetMapping("exceptionCause")
    public Response getExceptionCause(@RequestParam int num){
        return service.getExceptionCause(num);
    }
}