New file |
| | |
| | | package com.whyc.controller; |
| | | |
| | | import com.github.pagehelper.PageInfo; |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.pojo.web_site.AlarmDiagnosis; |
| | | import com.whyc.service.AlarmDiagnosisService; |
| | | import io.swagger.annotations.Api; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | @RestController |
| | | @RequestMapping("alarmDiagnosis") |
| | | @Api(tags = "告警诊断") |
| | | public class AlarmDiagnosisController { |
| | | |
| | | @Autowired |
| | | private AlarmDiagnosisService service; |
| | | |
| | | @GetMapping("getPage") |
| | | public Response<PageInfo<AlarmDiagnosis>> getPage(Integer pageNum, Integer pageSize) { |
| | | return service.getPage(pageNum, pageSize); |
| | | } |
| | | |
| | | @PostMapping("add") |
| | | public Response add(AlarmDiagnosis diagnosis) { |
| | | return service.add(diagnosis); |
| | | } |
| | | |
| | | } |
| | |
| | | package com.whyc.controller; |
| | | |
| | | import com.whyc.constant.BattStateEnum; |
| | | import com.whyc.constant.DevAlarmEnum; |
| | | import com.whyc.constant.PowerAlarmEnum; |
| | | import com.whyc.dto.AlarmParam; |
| | | import com.whyc.dto.Real.AlmDto; |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.dto.Station.Power; |
| | | import com.whyc.pojo.db_param.BattAlmparam; |
| | | import com.whyc.pojo.db_param.DevAlmparam; |
| | | import com.whyc.pojo.db_pwrdev_alarm.PwrdevAlarmParam; |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | @RestController |
| | |
| | | public Response setPwrAlmParam(@RequestBody List<PwrdevAlarmParam> almparamList){ |
| | | return pwrAlmparamService.setPwrAlmParam(almparamList); |
| | | } |
| | | |
| | | @GetMapping("getAlarmList") |
| | | @ApiOperation(value = "获取所有告警,1-电源,2-设备,3-电池",tags = "告警诊断") |
| | | public Response<List<AlarmParam>> getAlarmList(@RequestParam Integer type){ |
| | | List<AlarmParam> list = new ArrayList<>(); |
| | | if(type==1){ //电源告警 |
| | | //遍历枚举类型PowerAlarmEnum |
| | | for(PowerAlarmEnum powerAlarmEnum:PowerAlarmEnum.values()){ |
| | | list.add(new AlarmParam(powerAlarmEnum.getStateId(),powerAlarmEnum.getStateName())); |
| | | } |
| | | }else if (type==2){ //设备告警 |
| | | for (DevAlarmEnum devAlarmEnum:DevAlarmEnum.values()){ |
| | | list.add(new AlarmParam(devAlarmEnum.getStateId(),devAlarmEnum.getStateName())); |
| | | } |
| | | }else{ //电池告警 |
| | | for (BattStateEnum battStateEnum:BattStateEnum.values()){ |
| | | list.add(new AlarmParam(battStateEnum.getStateId(),battStateEnum.getStateName())); |
| | | } |
| | | } |
| | | return new Response<List<AlarmParam>>().set(1,list); |
| | | } |
| | | |
| | | } |
| | |
| | | import com.whyc.pojo.web_site.DeviceSpare; |
| | | import com.whyc.service.DeviceSpareService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | 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; |
| | | |
| | | @RestController |
| | | @RequestMapping("deviceSpare") |
| | |
| | | private DeviceSpareService service; |
| | | |
| | | @GetMapping("getPage") |
| | | @ApiOperation("分页查询") |
| | | public Response<PageInfo<DeviceSpare>> getPage(@RequestParam Integer pageNum, @RequestParam Integer pageSize, |
| | | @RequestParam(required = false) String type,@RequestParam(required = false) String name ) { |
| | | return service.getPage(pageNum, pageSize,type,name); |
| | | } |
| | | |
| | | @GetMapping("getList") |
| | | @ApiOperation(tags = "告警诊断", value = "获取所有所需工具") |
| | | public Response<List<DeviceSpare>> getList(@RequestParam(required = false) String name) { |
| | | return service.getList(name); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.whyc.dto; |
| | | |
| | | import lombok.Data; |
| | | import lombok.ToString; |
| | | |
| | | @ToString |
| | | @Data |
| | | public class AlarmParam{ |
| | | |
| | | private Integer almId; |
| | | private String almName; |
| | | |
| | | |
| | | public AlarmParam(Integer almId, String almName) { |
| | | this.almId = almId; |
| | | this.almName = almName; |
| | | } |
| | | } |
New file |
| | |
| | | package com.whyc.mapper; |
| | | |
| | | import com.whyc.pojo.web_site.AlarmDiagnosis; |
| | | |
| | | public interface AlarmDiagnosisMapper extends CustomMapper<AlarmDiagnosis>{ |
| | | } |
New file |
| | |
| | | package com.whyc.pojo.web_site; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.ToString; |
| | | |
| | | @ToString |
| | | @Data |
| | | @TableName(schema = "web_site",value ="tb_alarm_diagnosis") |
| | | @ApiModel("告警诊断") |
| | | public class AlarmDiagnosis { |
| | | |
| | | private Integer id; |
| | | @ApiModelProperty("告警类型:1-电源,2-设备,3-电池") |
| | | private String type; |
| | | @ApiModelProperty("告警id") |
| | | private String almId; |
| | | @ApiModelProperty("告警名称") |
| | | private String almName; |
| | | @ApiModelProperty("告警触发点") |
| | | private String almTriggerPoint; |
| | | @ApiModelProperty("告警原因") |
| | | private String almReason; |
| | | @ApiModelProperty("排查方案") |
| | | private String almSolution; |
| | | @ApiModelProperty("所需工具id,多个工具或器件用,隔开") |
| | | private String deviceSpareIds; |
| | | @ApiModelProperty("所需工具名称,多个工具或器件用,隔开") |
| | | private String deviceSpareNames; |
| | | |
| | | } |
New file |
| | |
| | | package com.whyc.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.Wrapper; |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.github.pagehelper.PageInfo; |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.mapper.AlarmDiagnosisMapper; |
| | | import com.whyc.pojo.web_site.AlarmDiagnosis; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | |
| | | import static com.whyc.util.ActionUtil.objeNull; |
| | | |
| | | @Service |
| | | public class AlarmDiagnosisService { |
| | | |
| | | @Resource |
| | | private AlarmDiagnosisMapper mapper; |
| | | |
| | | public Response<PageInfo<AlarmDiagnosis>> getPage(Integer pageNum, Integer pageSize) { |
| | | PageHelper.startPage(pageNum, pageSize); |
| | | List<AlarmDiagnosis> alarmDiagnoses = mapper.selectList((Wrapper<AlarmDiagnosis>) objeNull); |
| | | return new Response<PageInfo<AlarmDiagnosis>>().set(1, new PageInfo<AlarmDiagnosis>(alarmDiagnoses)); |
| | | |
| | | } |
| | | |
| | | public Response add(AlarmDiagnosis diagnosis) { |
| | | mapper.insert(diagnosis); |
| | | return new Response().setII(1,"增加完成"); |
| | | } |
| | | } |
| | |
| | | List<DeviceSpare> deviceSpares = mapper.selectList(query); |
| | | return new Response<PageInfo<DeviceSpare>>().set(1, new PageInfo<>(deviceSpares)); |
| | | } |
| | | |
| | | public Response<List<DeviceSpare>> getList(String name) { |
| | | QueryWrapper<DeviceSpare> query = Wrappers.query(); |
| | | query.eq(StringUtils.isNotBlank(name), "name", name); |
| | | return new Response<List<DeviceSpare>>().set(1, mapper.selectList(query)); |
| | | } |
| | | } |
| | |
| | | package com.whyc.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.github.pagehelper.PageInfo; |
| | | import com.whyc.dto.AlarmParam; |
| | | import com.whyc.dto.Real.AlmDto; |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.mapper.PwrdevAlarmParamMapper; |