| | |
| | | |
| | | if(YamlProperties.runModel == 1) { |
| | | //开发路径 |
| | | baseDirPath = jarFile.getParentFile().toString()+File.separator+"battery_gwm_file"+File.separator; |
| | | baseDirPath = jarFile.getParentFile().toString()+File.separator+"pis_file"+File.separator; |
| | | }else { |
| | | //打包路径 |
| | | baseDirPath = jarFile.toString()+File.separator+"battery_gwm_file"+File.separator; |
| | | baseDirPath = jarFile.toString()+File.separator+"pis_file"+File.separator; |
| | | } |
| | | registry.addResourceHandler("/battery_gwm_file/**").addResourceLocations("file:/"+baseDirPath); |
| | | registry.addResourceHandler("/pis_file/**").addResourceLocations("file:/"+baseDirPath); |
| | | |
| | | super.addResourceHandlers(registry); |
| | | |
| | |
| | | package com.whyc.controller; |
| | | |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.pojo.web_site.AlarmInspectionResult; |
| | | import com.whyc.service.AlarmInspectionService; |
| | | import com.whyc.util.CommonUtil; |
| | | import com.whyc.util.JsonUtil; |
| | | 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 org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.io.File; |
| | | import java.io.IOException; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 要实现告警巡检单,创建巡检工单表. |
| | | * 在发生告警的情况下,加入到实时巡检工单表中 |
| | | * 在点击某个站点的时候,能列出所有未处理过的实时巡检工单 |
| | | * 进行巡检结果提交的时候,选中已处理的巡检工单,对选中的告警进行是否已经消失的校验(还存在则无法提交巡检处理结果),将实时巡检工单的相关记录移入到巡检工单处理表,并删除实时工单内相关内容 |
| | | * TODO 有两个定时任务:1.告警产生,加入到巡检实时表,2.告警是否消失,同步到巡检实时表 |
| | | * 有两个定时任务:1.告警产生,加入到巡检实时表,2.告警是否消失,同步到巡检实时表 |
| | | */ |
| | | |
| | | @RestController |
| | |
| | | @Autowired |
| | | private AlarmInspectionService service; |
| | | |
| | | @ApiOperation("查询站点对应的巡检单") |
| | | @GetMapping("") |
| | | public Response getList(@RequestParam Integer stationId,@RequestParam Integer inspectionType){ |
| | | @ApiOperation(value = "查询站点对应的巡检单",notes = "inspectionType=1表示告警级别为1的故障工单,inspectionType=2表示告警级别不为1的巡检备忘录") |
| | | @GetMapping("getList") |
| | | public Response getList(@RequestParam int stationId,@RequestParam int inspectionType){ |
| | | return service.getList(stationId,inspectionType); |
| | | } |
| | | |
| | | @PostMapping("submitInspection") |
| | | @ApiOperation(value = "提交巡检结果",notes = "alarmInspectionResultJsonStr填json字符串,字段包含stationId,stationName,inspectionType,inspectionResult,finishSuggestion") |
| | | public Response submitInspection(@RequestPart(value = "file",required = false) List<MultipartFile> file, @RequestParam String alarmInspectionResultJsonStr) throws IOException { |
| | | AlarmInspectionResult result = JsonUtil.getGson().fromJson(alarmInspectionResultJsonStr,AlarmInspectionResult.class); |
| | | return service.submitInspection(result,file); |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.whyc.controller; |
| | | |
| | | import com.github.pagehelper.PageInfo; |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.pojo.web_site.AlarmInspectionResult; |
| | | import com.whyc.service.AlarmInspectionResultService; |
| | | 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; |
| | | |
| | | @RestController |
| | | @RequestMapping("alarmInspectionResult") |
| | | @Api(tags = "告警巡检历史表") |
| | | public class AlarmInspectionResultController { |
| | | |
| | | @Autowired |
| | | private AlarmInspectionResultService service; |
| | | |
| | | @ApiOperation("查询分页") |
| | | @GetMapping("getPage") |
| | | public Response<PageInfo<AlarmInspectionResult>> getPage(@RequestParam Integer pageNum,@RequestParam Integer pageSize, |
| | | @RequestParam(required = false) Integer stationId,@RequestParam(required = false) Integer inspectionType) { |
| | | return service.getPage(pageNum, pageSize,stationId,inspectionType); |
| | | } |
| | | |
| | | } |
| | |
| | | package com.whyc.controller; |
| | | |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.pojo.db_user.Baojigroup; |
| | | import com.whyc.pojo.db_user.User; |
| | | import com.whyc.service.*; |
| | | import com.whyc.util.ActionUtil; |
| | |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | |
| | | @RestController |
| | | @Api(tags = "下拉条件管理") |
| | |
| | | return rtstateService.getBattState(); |
| | | } |
| | | |
| | | @ApiOperation(value = "获取所有的班组(下拉)") |
| | | @GetMapping("getBattGroupBZ") |
| | | public Response getBattGroupBZ(){ |
| | | List<Baojigroup> list=bjGroupService.getGroupList(); |
| | | return new Response().setII(1,true,list,"获取所有的班组(下拉)"); |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.pojo.web_site.DeviceSpare; |
| | | import com.whyc.service.DeviceSpareService; |
| | | import com.whyc.util.JsonUtil; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.List; |
| | | |
| | | @RestController |
| | |
| | | |
| | | @PostMapping("add") |
| | | @ApiOperation("添加") |
| | | public Response add(@RequestBody DeviceSpare spare) { |
| | | return service.add(spare); |
| | | public Response add(@RequestPart(value = "file",required = false) List<MultipartFile> file,@RequestParam String deviceSpareJsonStr) throws IOException { |
| | | DeviceSpare spare = JsonUtil.getGson().fromJson(deviceSpareJsonStr, DeviceSpare.class); |
| | | return service.add(spare,file); |
| | | } |
| | | |
| | | @PostMapping("update") |
| | |
| | | |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.dto.Statistic.*; |
| | | import com.whyc.pojo.db_param.AppParam; |
| | | import com.whyc.pojo.db_user.User; |
| | | import com.whyc.service.*; |
| | | import com.whyc.util.ActionUtil; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @RestController |
| | |
| | | |
| | | @Autowired |
| | | private DeviceStateService deviceStateService; |
| | | |
| | | @Autowired |
| | | private AppParamService appParamService; |
| | | |
| | | @ApiOperation(value = "电源信息统计(1.2.1/1.2.13)") |
| | | @PostMapping("getPowerStatistic") |
| | |
| | | stic.setUid(uinf.getId()); |
| | | return battTinfService.getDischr5Statistic(stic); |
| | | } |
| | | |
| | | @ApiOperation(value = "本年度未放电数量统计(1.2.6)") |
| | | @PostMapping("getDischr6Statistic") |
| | | public Response getDischr6Statistic(@RequestBody DisChargeStic stic){ |
| | |
| | | } |
| | | return battTinfService.getDischr6Statistic(stic); |
| | | } |
| | | |
| | | @ApiOperation(value = "优良电源数量统计(1.2.7)") |
| | | @PostMapping("getPwr7Statistic") |
| | | public Response getPwr7Statistic(@RequestBody Pwr7Stic stic){ |
| | | User uinf= ActionUtil.getUser(); |
| | | stic.setUid(uinf.getId()); |
| | | return battTinfService.getPwr7Statistic(stic); |
| | | } |
| | | @ApiOperation(value = "电池组电池性能统计(未放电,优秀,劣化,损坏)统计(1.2.8/9/10)") |
| | | @PostMapping("getPerformanceStatistic") |
| | | public Response getPerformanceStatistic(@RequestBody PerformanceStic stic){ |
| | |
| | | return deviceStateService.getDeviceStateStatistic(stic); |
| | | } |
| | | |
| | | @ApiOperation(value = "设置权重(1.2.16)") |
| | | @PostMapping("setHehavior") |
| | | public Response setHehavior(@RequestBody List<AppParam> List){ |
| | | return appParamService.setHehavior(List); |
| | | } |
| | | |
| | | @ApiOperation(value = "读取权重(1.2.16)") |
| | | @GetMapping("getHehavior") |
| | | public Response getHehavior(){ |
| | | return appParamService.getHehavior(); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | private T data; |
| | | private T data2; |
| | | private T data3; |
| | | private T data4; |
| | | private String msg; |
| | | |
| | | public Response<T> setCode(Integer code) { |
| | |
| | | this.data3 = data3; |
| | | return this; |
| | | } |
| | | public Response<T> setIIII(Integer code, T data, T data2, T data3,T data4, String msg) { |
| | | this.code = code; |
| | | this.msg = msg; |
| | | this.data = data; |
| | | this.data2 = data2; |
| | | this.data3 = data3; |
| | | this.data4 = data4; |
| | | return this; |
| | | } |
| | | |
| | | public Integer getCode() { |
| | | return code; |
| | |
| | | public void setData3(T data3) { |
| | | this.data3 = data3; |
| | | } |
| | | |
| | | public T getData4() { |
| | | return data4; |
| | | } |
| | | |
| | | public void setData4(T data4) { |
| | | this.data4 = data4; |
| | | } |
| | | } |
New file |
| | |
| | | package com.whyc.dto.Statistic; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | @Data |
| | | public class Pwr7Stic { |
| | | private String provice; |
| | | private String city; |
| | | private String country; |
| | | private String stationName; |
| | | private String company; |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | private Date inuseStartTime;//开始时间 |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | private Date inuseEndTime;//结束时间 |
| | | private String stationType; |
| | | private Integer performance;//电池性能:1优秀,2劣化,3损坏 4未放电 不传全部 |
| | | private String groupName; |
| | | private Integer uid; |
| | | private Integer pageNum; |
| | | private Integer pageSize; |
| | | } |
New file |
| | |
| | | package com.whyc.dto.Statistic; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | @Data |
| | | public class QuarterPwr7Res { |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
| | | private Date recordDatetime; |
| | | private Float acin1Vola; |
| | | private Float acoutVola; |
| | | private Float dcoutVol; |
| | | private Float dcoutCurr; |
| | | } |
| | |
| | | private String stopReason; //停止原因 |
| | | private String capperformance; //电池性能 |
| | | private Integer disChargeType; //1.已放电 2.未放电 不传全部 |
| | | private Integer testRecordCount; |
| | | private String dischargeName; |
| | | } |
| | |
| | | private String product; |
| | | private Integer errorNum; |
| | | private List<String> stopList; |
| | | private BatttestdataInf tinf; |
| | | private Integer testRecordCount; |
| | | private String dischargeName; |
| | | private Integer stopReasonType; //0全部,1符合筛选条件的放电记录 |
| | | } |
New file |
| | |
| | | package com.whyc.dto.Statistic; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | @Data |
| | | public class SticPwr7Res { |
| | | private String provice; |
| | | private String city; |
| | | private String country; |
| | | private String stationName; |
| | | private String powerName; |
| | | private String company; |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | private Date inuseTime; |
| | | private String stationType; |
| | | private String groupName; |
| | | private String performanceName;//电池性能:1优秀,2劣化,3损坏 4未放电 不传全部 |
| | | } |
New file |
| | |
| | | package com.whyc.mapper; |
| | | |
| | | import com.whyc.pojo.web_site.AlarmInspectionId; |
| | | |
| | | public interface AlarmInspectionIdMapper extends CustomMapper<AlarmInspectionId>{ |
| | | } |
| | |
| | | import java.util.List; |
| | | |
| | | public interface AlarmInspectionMapper extends CustomMapper<AlarmInspection>{ |
| | | List<AlarmInspection> getList(Integer stationId); |
| | | List<AlarmInspection> getList(Integer stationId, Integer inspectionType); |
| | | |
| | | } |
New file |
| | |
| | | package com.whyc.mapper; |
| | | |
| | | import com.whyc.pojo.web_site.AlarmInspectionResult; |
| | | |
| | | public interface AlarmInspectionResultMapper extends CustomMapper<AlarmInspectionResult>{ |
| | | } |
| | |
| | | List<BattInf> getDischr6Statistic(@Param("stic") DisChargeStic stic); |
| | | //电池组电池性能统计(未放电,优秀,劣化,损坏)统计(1.2.8/9/10) |
| | | List<BattInf> getPerformanceStatistic(@Param("stic") PerformanceStic stic); |
| | | //本年度已/未放电数量统计右侧图表(1.2.5) |
| | | List<BattInf> getDischrChart(@Param("uid") Integer uid); |
| | | |
| | | } |
| | |
| | | |
| | | import com.whyc.dto.Real.AlmDto; |
| | | import com.whyc.pojo.db_alarm.BattalarmData; |
| | | import com.whyc.pojo.web_site.AlarmInspection; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface BattalarmDataMapper extends CustomMapper<BattalarmData>{ |
| | | //获取电池组实时告警信息 |
| | | List<BattalarmData> getBattAlmReal(AlmDto almDto); |
| | | |
| | | List<AlarmInspection> getListGreatThan(Long battAlarmId); |
| | | |
| | | } |
| | |
| | | import com.whyc.dto.Real.AlmDto; |
| | | import com.whyc.pojo.db_alarm.BattalarmData; |
| | | import com.whyc.pojo.db_alarm.DevalarmData; |
| | | import com.whyc.pojo.web_site.AlarmInspection; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface DevalarmDataMapper extends CustomMapper<DevalarmData>{ |
| | | //获取设备实时告警信息 |
| | | List<DevalarmData> getDevAlmReal(AlmDto almDto); |
| | | |
| | | List<AlarmInspection> getListGreatThan(Long devAlarmId); |
| | | } |
| | |
| | | package com.whyc.mapper; |
| | | |
| | | import com.whyc.dto.PowerDto; |
| | | import com.whyc.dto.Statistic.Pwr7Stic; |
| | | import com.whyc.dto.Statistic.StationStic; |
| | | import com.whyc.pojo.db_station.BattInf; |
| | | import com.whyc.pojo.db_station.PowerInf; |
| | | import com.whyc.pojo.db_station.StationInf; |
| | | import org.apache.ibatis.annotations.Param; |
| | |
| | | List<PowerInf> getPowerStatistic(@Param("stic") StationStic stic); |
| | | //查询机房所在的班组 |
| | | String getGroupName(Integer powerId); |
| | | |
| | | //优良电源数量统计(1.2.7) |
| | | List<PowerInf> getPwr7Statistic(@Param("stic") Pwr7Stic stic); |
| | | } |
| | |
| | | |
| | | import com.whyc.dto.Real.AlmDto; |
| | | import com.whyc.pojo.db_pwrdev_alarm.PwrdevAlarm; |
| | | import com.whyc.pojo.web_site.AlarmInspection; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface PwrdevAlarmMapper extends CustomMapper<PwrdevAlarm>{ |
| | | //获取电源实时告警信息 |
| | | List<PwrdevAlarm> getPwrAlmReal(AlmDto almDto); |
| | | |
| | | List<AlarmInspection> getListGreatThan(Long id); |
| | | |
| | | } |
| | |
| | | private Integer battGroupId; |
| | | |
| | | private String battGroupName; |
| | | |
| | | @ApiModelProperty("单体编号") |
| | | private Integer monNum; |
| | | @ApiModelProperty("告警属于哪种设备.1-电源,2-设备,3-电池") |
| | | private Integer type; |
| | | |
New file |
| | |
| | | package com.whyc.pojo.web_site; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import io.swagger.annotations.ApiModel; |
| | | import lombok.Data; |
| | | import lombok.ToString; |
| | | |
| | | /** |
| | | * 告警巡检模块的告警实时id表,记录已经存入的告警id最大值 |
| | | * 必须注意: 初始化1条记录,1,0,0,0 |
| | | */ |
| | | @ToString |
| | | @Data |
| | | @TableName(schema = "web_site",value ="tb_alarm_inspection_id") |
| | | @ApiModel("告警巡检的告警id标记表") |
| | | public class AlarmInspectionId { |
| | | |
| | | private Integer id; |
| | | private Long powerAlarmId; |
| | | private Long devAlarmId; |
| | | private Long battAlarmId; |
| | | } |
New file |
| | |
| | | package com.whyc.pojo.web_site; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.ToString; |
| | | |
| | | import java.util.Date; |
| | | |
| | | @ToString |
| | | @Data |
| | | @TableName(schema = "web_site",value ="tb_alarm_inspection_result") |
| | | @ApiModel("告警巡检实时表") |
| | | public class AlarmInspectionResult { |
| | | |
| | | private Long id; |
| | | |
| | | private Integer stationId; |
| | | |
| | | private String stationName; |
| | | |
| | | @ApiModelProperty("1表示告警级别为1的故障工单,2表示告警级别不为1的巡检备忘录") |
| | | private Integer inspectionType; |
| | | |
| | | /** |
| | | * A电源在2025-06-12 9:00:00发生某某告警 |
| | | * B设备在2025-06-12 9:00:00发生某某告警 |
| | | * C电池在2025-06-12 9:00:00发生某某告警 |
| | | * D电池2号单体在2025-06-12 9:00:00发生某某告警 |
| | | */ |
| | | @ApiModelProperty("告警描述,综合了所有告警细节的告警描述") |
| | | private String alarmDescription; |
| | | |
| | | @ApiModelProperty("巡检结果") |
| | | private String inspectionResult; |
| | | |
| | | @ApiModelProperty("图片地址,多个地址用,隔开") |
| | | private String pictureUrl; |
| | | |
| | | @ApiModelProperty("完成建议") |
| | | private String finishSuggestion; |
| | | |
| | | private Integer submitUserId; |
| | | |
| | | private String submitUserName; |
| | | |
| | | private Integer baoJiGroupId; |
| | | |
| | | private String baoJiGroupName; |
| | | |
| | | private Date createTime; |
| | | |
| | | } |
New file |
| | |
| | | package com.whyc.schedule; |
| | | |
| | | import com.whyc.pojo.db_pwrdev_alarm.PwrdevAlarm; |
| | | import com.whyc.pojo.web_site.AlarmInspection; |
| | | import com.whyc.pojo.web_site.AlarmInspectionId; |
| | | import com.whyc.service.*; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.scheduling.annotation.EnableScheduling; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * 有两个定时任务:1.告警产生,加入到巡检实时表,2.告警是否消失,同步到巡检实时表 |
| | | */ |
| | | @EnableScheduling |
| | | @Component |
| | | public class AlarmInspectionSchedule { |
| | | |
| | | @Autowired |
| | | private AlarmInspectionService inspectionService; |
| | | |
| | | @Autowired |
| | | private AlarmInspectionIdService alarmIdService; |
| | | |
| | | @Autowired |
| | | private PwrdevAlarmService powerAlarmService; |
| | | |
| | | @Autowired |
| | | private DevalarmDataService devAlarmService; |
| | | |
| | | @Autowired |
| | | private BattalarmDataService battAlarmService; |
| | | |
| | | |
| | | /** |
| | | * 数据4秒钟获取一次 |
| | | * 告警产生,加入到巡检实时表 |
| | | * */ |
| | | @Scheduled(cron = "0/4 * * * * ? ") |
| | | @Transactional |
| | | public void getAndRecord(){ |
| | | AlarmInspectionId alarmInspectionId = alarmIdService.get(); |
| | | List<AlarmInspection> inspectionList = new ArrayList<>(); |
| | | //查询新的电源告警 |
| | | List<AlarmInspection> powerAlarmList = powerAlarmService.getListGreatThan(alarmInspectionId.getPowerAlarmId()); |
| | | //查询新的设备告警 |
| | | List<AlarmInspection> devAlarmList = devAlarmService.getListGreatThan(alarmInspectionId.getDevAlarmId()); |
| | | //查询新的电池告警 |
| | | List<AlarmInspection> battAlarmList = battAlarmService.getListGreatThan(alarmInspectionId.getBattAlarmId()); |
| | | |
| | | inspectionList.addAll(powerAlarmList); |
| | | inspectionList.addAll(devAlarmList); |
| | | inspectionList.addAll(battAlarmList); |
| | | if(inspectionList.size() != 0) { |
| | | //插入到巡检实时表 |
| | | inspectionService.addBatch(inspectionList); |
| | | |
| | | //获取本次截止的告警id,并更新巡检告警的告警id |
| | | Long powerAlmId = powerAlarmList.get(powerAlarmList.size() - 1).getAlmNum(); |
| | | Long devAlmId = devAlarmList.get(devAlarmList.size() - 1).getAlmNum(); |
| | | Long battAlmId = battAlarmList.get(battAlarmList.size() - 1).getAlmNum(); |
| | | |
| | | alarmInspectionId.setPowerAlarmId(powerAlmId); |
| | | alarmInspectionId.setDevAlarmId(devAlmId); |
| | | alarmInspectionId.setBattAlarmId(battAlmId); |
| | | alarmIdService.update(alarmInspectionId); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 数据4秒钟获取一次 |
| | | * 告警是否消失,同步到巡检实时表 |
| | | * */ |
| | | @Scheduled(cron = "0/4 * * * * ? ") |
| | | public void checkAlarm(){ |
| | | List<AlarmInspection> alarmExistList =inspectionService.getAlarmExistList(); |
| | | //按电源,设备,电池告警进行分类,再分别进行查询 |
| | | List<AlarmInspection> powerAlarmInspectionList = alarmExistList.stream().filter(alarmInspection -> alarmInspection.getType() == 1).collect(Collectors.toList()); |
| | | List<Long> powerAlarmNumList = powerAlarmInspectionList.stream().map(AlarmInspection::getAlmNum).collect(Collectors.toList()); |
| | | |
| | | List<AlarmInspection> devAlarmInspectionList = alarmExistList.stream().filter(alarmInspection -> alarmInspection.getType() == 2).collect(Collectors.toList()); |
| | | List<Long> devAlarmNumList = devAlarmInspectionList.stream().map(AlarmInspection::getAlmNum).collect(Collectors.toList()); |
| | | |
| | | List<AlarmInspection> battAlarmInspectionList = alarmExistList.stream().filter(alarmInspection -> alarmInspection.getType() == 3).collect(Collectors.toList()); |
| | | List<Long> battAlarmNumList = battAlarmInspectionList.stream().map(AlarmInspection::getAlmNum).collect(Collectors.toList()); |
| | | |
| | | //告警消失了的巡检实时表id |
| | | List<Long> notExistIdList = new ArrayList<>(); |
| | | if(powerAlarmNumList.size() != 0){ |
| | | //查询id是否还存在 |
| | | List<Long> powerNumListInDB = powerAlarmService.getNumListInDB(powerAlarmNumList); |
| | | for (AlarmInspection alarm : powerAlarmInspectionList) { |
| | | Long almNum = alarm.getAlmNum(); |
| | | if(!powerNumListInDB.contains(almNum)){ |
| | | notExistIdList.add(alarm.getId()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | if(devAlarmNumList.size() != 0){ |
| | | //查询id是否还存在 |
| | | List<Long> devNumListInDB = devAlarmService.getNumListInDB(devAlarmNumList); |
| | | for (AlarmInspection alarm : devAlarmInspectionList) { |
| | | Long almNum = alarm.getAlmNum(); |
| | | if(!devNumListInDB.contains(almNum)){ |
| | | notExistIdList.add(alarm.getId()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | if(battAlarmNumList.size() != 0){ |
| | | //查询id是否还存在 |
| | | List<Long> battNumListInDB = battAlarmService.getNumListInDB(battAlarmNumList); |
| | | for (AlarmInspection alarm : battAlarmInspectionList) { |
| | | Long almNum = alarm.getAlmNum(); |
| | | if(!battNumListInDB.contains(almNum)){ |
| | | notExistIdList.add(alarm.getId()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | if(notExistIdList.size() != 0){ |
| | | //更新巡检实时表 |
| | | inspectionService.updateIsExist(notExistIdList); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.whyc.service; |
| | | |
| | | import com.whyc.mapper.AlarmInspectionIdMapper; |
| | | import com.whyc.pojo.web_site.AlarmInspectionId; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | @Service |
| | | public class AlarmInspectionIdService { |
| | | |
| | | @Resource |
| | | private AlarmInspectionIdMapper mapper; |
| | | |
| | | public AlarmInspectionId get(){ |
| | | return mapper.selectById(1); |
| | | } |
| | | |
| | | public void update(AlarmInspectionId inspectionId){ |
| | | mapper.updateById(inspectionId); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.whyc.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.github.pagehelper.PageInfo; |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.mapper.AlarmInspectionResultMapper; |
| | | import com.whyc.pojo.web_site.AlarmInspectionResult; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | public class AlarmInspectionResultService { |
| | | |
| | | @Resource |
| | | private AlarmInspectionResultMapper mapper; |
| | | |
| | | public void add(AlarmInspectionResult result) { |
| | | mapper.insert(result); |
| | | } |
| | | |
| | | public Response<PageInfo<AlarmInspectionResult>> getPage(Integer pageNum, Integer pageSize, Integer stationId, Integer inspectionType) { |
| | | PageHelper.startPage(pageNum, pageSize); |
| | | QueryWrapper<AlarmInspectionResult> query = Wrappers.query(); |
| | | query.eq(stationId != null,"station_id", stationId); |
| | | query.eq(inspectionType != null,"inspection_type", inspectionType); |
| | | query.orderByDesc("id"); |
| | | List<AlarmInspectionResult> list = mapper.selectList(query); |
| | | PageInfo<AlarmInspectionResult> pageInfo = new PageInfo<>(list); |
| | | return new Response<PageInfo<AlarmInspectionResult>>().set(1, pageInfo); |
| | | } |
| | | } |
| | |
| | | package com.whyc.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.whyc.constant.BattSingalIdEnum; |
| | | import com.whyc.constant.DevAlarmEnum; |
| | | import com.whyc.constant.PowerAlarmEnum; |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.mapper.AlarmInspectionMapper; |
| | | import com.whyc.pojo.db_user.Baojigroup; |
| | | import com.whyc.pojo.db_user.User; |
| | | import com.whyc.pojo.web_site.AlarmInspection; |
| | | import com.whyc.pojo.web_site.AlarmInspectionResult; |
| | | import com.whyc.util.CommonUtil; |
| | | import com.whyc.util.DateUtil; |
| | | import com.whyc.util.ThreadLocalUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.io.File; |
| | | import java.io.IOException; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Service |
| | | public class AlarmInspectionService { |
| | |
| | | @Resource |
| | | private AlarmInspectionMapper mapper; |
| | | |
| | | @Autowired |
| | | private AlarmInspectionResultService resultService; |
| | | |
| | | public Response getList(Integer stationId, Integer inspectionType) { |
| | | //需要附加填充 负责班组信息 及 告警诊断信息 |
| | | List<AlarmInspection> list = mapper.getList(stationId); |
| | | List<AlarmInspection> list = mapper.getList(stationId,inspectionType); |
| | | return new Response().set(1,list); |
| | | } |
| | | |
| | | @Transactional |
| | | public Response submitInspection(AlarmInspectionResult result, List<MultipartFile> file) throws IOException { |
| | | //对file进行处理,保存到文件夹中 |
| | | //对存储路径进行定义 |
| | | String stationName = result.getStationName(); |
| | | Date now = new Date(); |
| | | String timeFormat = ThreadLocalUtil.format(ThreadLocalUtil.TIME_YYYY_MM_DD_HH_MM_SS_UNION, now); |
| | | String dirMonth = ThreadLocalUtil.format(ThreadLocalUtil.TIME_YYYY_MM, now); |
| | | |
| | | String fileDirPath = CommonUtil.getRootFile() + "alarmInspection" + File.separator + dirMonth + File.separator + stationName + "_" + timeFormat; |
| | | File fileDir = new File(fileDirPath); |
| | | //如果文件夹不存在则创建 |
| | | if (!fileDir.exists()) { |
| | | fileDir.mkdirs(); |
| | | } |
| | | StringBuilder pictureUrlSb = new StringBuilder(); |
| | | if (file != null && file.size() > 0) { |
| | | for (int j = 0; j < file.size(); j++) { |
| | | MultipartFile multipartFile = file.get(j); |
| | | String fileName = multipartFile.getOriginalFilename(); |
| | | //将fileName中可能存在的,去掉 |
| | | fileName = fileName.replace(",",""); |
| | | String filePath = fileDirPath + File.separator + fileName; |
| | | |
| | | multipartFile.transferTo(new File(filePath)); |
| | | String split = "pis_file"+File.separator+"alarmInspection"; |
| | | String picUrl = File.separator + filePath.substring(filePath.indexOf(split)); |
| | | //最后一个元素 |
| | | if (j == file.size() - 1) { |
| | | pictureUrlSb.append(picUrl); |
| | | }else { |
| | | pictureUrlSb.append(picUrl).append(","); |
| | | } |
| | | } |
| | | } |
| | | result.setPictureUrl(pictureUrlSb.toString()); |
| | | |
| | | //根据提交的站点id和inspectionType查询出对应的工单 |
| | | List<AlarmInspection> list = mapper.getList(result.getStationId(),result.getInspectionType()); |
| | | //校验告警是否全部消失,是则通过 |
| | | for (int i = 0; i < list.size(); i++) { |
| | | if (list.get(i).getIsExist() == 1) { |
| | | return new Response().set(1,false,"当前巡检单内告警未全部消失"); |
| | | } |
| | | } |
| | | //检验通过,进行巡检结果提交,形成巡检历史 |
| | | //判断stationName,powerName,devName,battGroupName是否存在,逐个存在则拼接成一个字符串 |
| | | StringBuilder alarmDescriptionSb = new StringBuilder(); |
| | | for (int i = 0; i < list.size(); i++) { |
| | | AlarmInspection temp = list.get(i); |
| | | if (temp.getStationName() != null) { |
| | | alarmDescriptionSb.append(temp.getStationName()).append("-"); |
| | | } |
| | | if (temp.getPowerName() != null) { |
| | | alarmDescriptionSb.append(temp.getPowerName()).append("-"); |
| | | } |
| | | if (temp.getDevName() != null) { |
| | | alarmDescriptionSb.append(temp.getDevName()).append("-"); |
| | | } |
| | | if (temp.getBattGroupName() != null) { |
| | | alarmDescriptionSb.append(temp.getBattGroupName()); |
| | | } |
| | | if(temp.getMonNum() != null){ |
| | | alarmDescriptionSb.append("单体编号:").append(temp.getMonNum()); |
| | | } |
| | | if(temp.getType() == 1) { //电源告警 |
| | | alarmDescriptionSb.append("在" + DateUtil.YYYY_MM_DD_HH_MM_SS.format(temp.getAlmStartTime()) + "发生" + PowerAlarmEnum.getValue(temp.getAlmId()) + "告警,告警级别为" + temp.getAlmLevel() + ".\n"); |
| | | } |
| | | else if(temp.getType() == 2) { //设备告警 |
| | | alarmDescriptionSb.append("在" + DateUtil.YYYY_MM_DD_HH_MM_SS.format(temp.getAlmStartTime()) + "发生" + DevAlarmEnum.getValue(temp.getAlmId()) + "告警,告警级别为" + temp.getAlmLevel() + ".\n"); |
| | | }else{ //电池告警 |
| | | alarmDescriptionSb.append("在" + DateUtil.YYYY_MM_DD_HH_MM_SS.format(temp.getAlmStartTime()) + "发生" + BattSingalIdEnum.getValue(temp.getAlmId()) +"告警,告警级别为" + temp.getAlmLevel() + ".\n"); |
| | | } |
| | | } |
| | | result.setAlarmDescription(alarmDescriptionSb.toString()); |
| | | User user = CommonUtil.getUser(); |
| | | result.setSubmitUserId(user.getId()); |
| | | result.setSubmitUserName(user.getName()); |
| | | result.setCreateTime(new Date()); |
| | | //所属班组 |
| | | Baojigroup baoJiGroup = list.get(0).getBaoJiGroup(); |
| | | result.setBaoJiGroupId(baoJiGroup.getBaojiGroupId()); |
| | | result.setBaoJiGroupName(baoJiGroup.getBaojiGroupName()); |
| | | resultService.add(result); |
| | | |
| | | //删除当前巡检单记录 |
| | | List<Long> ids = list.stream().map(AlarmInspection::getId).collect(Collectors.toList()); |
| | | mapper.deleteBatchIds(ids); |
| | | |
| | | return new Response().set(1,true,"提交完成"); |
| | | } |
| | | |
| | | public void addBatch(List<AlarmInspection> inspectionList) { |
| | | mapper.insertBatchSomeColumn(inspectionList); |
| | | } |
| | | |
| | | public List<AlarmInspection> getAlarmExistList() { |
| | | QueryWrapper<AlarmInspection> query = Wrappers.query(); |
| | | query.eq("is_exist",1); |
| | | return mapper.selectList(query); |
| | | } |
| | | |
| | | public void updateIsExist(List<Long> notExistIdList) { |
| | | QueryWrapper<AlarmInspection> query = Wrappers.query(); |
| | | query.in("id",notExistIdList); |
| | | AlarmInspection alarmInspection = new AlarmInspection(); |
| | | alarmInspection.setIsExist(0); |
| | | mapper.update(alarmInspection,query); |
| | | } |
| | | } |
| | |
| | | package com.whyc.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.mapper.AppParamMapper; |
| | | import com.whyc.pojo.db_param.AppParam; |
| | | import com.whyc.pojo.db_pwrdev_alarm.PwrdevAlarmParam; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | |
| | | wrapper.orderByAsc("id"); |
| | | return mapper.selectList(wrapper); |
| | | } |
| | | //读取权重(1.2.16) |
| | | public Response getHehavior() { |
| | | QueryWrapper wrapper=new QueryWrapper(); |
| | | wrapper.eq("category_id",2); |
| | | wrapper.orderByAsc("id"); |
| | | List<AppParam> list=mapper.selectList(wrapper); |
| | | return new Response().setII(1,list!=null,list,"读取权重"); |
| | | } |
| | | //设置权重(1.2.16) |
| | | public Response setHehavior(List<AppParam> list) { |
| | | for (AppParam param:list) { |
| | | UpdateWrapper wrapper=new UpdateWrapper(); |
| | | wrapper.eq("param_name_psx",param.getParamNamePsx()); |
| | | mapper.update(param,wrapper); |
| | | } |
| | | return new Response().set(1,true,"设置权重(1.2.16)"); |
| | | } |
| | | } |
| | |
| | | String groupName = powerInfMapper.getGroupName(powerId); |
| | | return groupName; |
| | | } |
| | | //查询所有的包机组名集合 |
| | | //查询所有的包机组名集合(班组) |
| | | public List<Baojigroup> getGroupList() { |
| | | QueryWrapper wrapper=new QueryWrapper(); |
| | | wrapper.eq("team_flag",1); |
| | |
| | | public List<BattInf> getPerformanceStatistic(PerformanceStic stic) { |
| | | return mapper.getPerformanceStatistic(stic); |
| | | } |
| | | //本年度已/未放电数量统计右侧图表(1.2.5) |
| | | public List<BattInf> getDischrChart(Integer uid) { |
| | | return mapper.getDischrChart(uid); |
| | | } |
| | | } |
| | |
| | | |
| | | 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.constant.BattAlarmIdEnum; |
| | |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.mapper.BattalarmDataMapper; |
| | | import com.whyc.pojo.db_alarm.BattalarmData; |
| | | import com.whyc.pojo.web_site.AlarmInspection; |
| | | import com.whyc.util.ActionUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Service |
| | | public class BattalarmDataService { |
| | |
| | | Map<Integer,String> map= BattAlarmIdEnum.getOpInfo(); |
| | | return new Response().setII(1,true,map,"获取电池告警类型(下拉)"); |
| | | } |
| | | |
| | | public List<AlarmInspection> getListGreatThan(Long battAlarmId) { |
| | | List<AlarmInspection> listGreatThan = mapper.getListGreatThan(battAlarmId); |
| | | Date now = new Date(); |
| | | listGreatThan.forEach(data->{ |
| | | data.setType(3); |
| | | data.setIsExist(1); |
| | | data.setCreateTime(now); |
| | | }); |
| | | return listGreatThan; |
| | | } |
| | | |
| | | public List<Long> getNumListInDB(List<Long> battAlarmNumList) { |
| | | QueryWrapper<BattalarmData> query = Wrappers.query(); |
| | | query.select("num"); |
| | | query.in("num",battAlarmNumList); |
| | | return mapper.selectList(query).stream().map(BattalarmData::getNum).collect(Collectors.toList()); |
| | | } |
| | | } |
| | |
| | | import com.whyc.pojo.db_ram_db.BattRtdata; |
| | | import com.whyc.pojo.db_ram_db.BattRtstate; |
| | | import com.whyc.pojo.db_station.BattInf; |
| | | import com.whyc.pojo.db_station.PowerInf; |
| | | import com.whyc.pojo.db_user.Baojigroup; |
| | | import com.whyc.util.ActionUtil; |
| | | import com.whyc.util.PageInfoUtils; |
| | |
| | | @Autowired(required = false) |
| | | private BaojigroupService bjService; |
| | | |
| | | @Autowired(required = false) |
| | | private PowerInfService powerInfService; |
| | | |
| | | |
| | | @Autowired(required = false) |
| | | private PwrdevHistorydataIdService pwrHisdataIdService; |
| | | |
| | | |
| | | //获取最后一次测试数据并计算剩余容量 |
| | |
| | | List<TestDataDto> List3=new ArrayList<>(); |
| | | List<TestDataDto> List4=new ArrayList<>(); |
| | | List<TestDataDto> List5=new ArrayList<>(); |
| | | map.put("1",List1); //核容放电 |
| | | map.put("2",List2); //核容充电 |
| | | map.put("3",List3); //监测放电 |
| | | map.put("4",List4); //监测充电 |
| | | map.put("5",List5); //停电放电 |
| | | map.put("核容放电",List1); //核容放电 |
| | | map.put("核容充电",List2); //核容充电 |
| | | map.put("监测放电",List3); //监测放电 |
| | | map.put("监测充电",List4); //监测充电 |
| | | map.put("停电放电",List5); //停电放电 |
| | | QueryWrapper wrapper=new QueryWrapper(); |
| | | wrapper.eq("battgroup_id",battgroupId); |
| | | wrapper.orderByDesc("test_starttime"); |
| | |
| | | } |
| | | return new Response().setII(1,true,map,"历史测试记录"); |
| | | } |
| | | //本年度已放电数量统计(1.2.5) |
| | | //本年度已放电数量统计(1.2.5)<只查看已放电数据> |
| | | public Response getDischr5Statistic(DisChargeStic stic) { |
| | | Map<String, Object> map=new HashMap<>(); |
| | | //班组 |
| | | Map<String, Object> bzmap=new HashMap<>(); |
| | | //性能 |
| | | Map<String, Integer> xnmap=new HashMap<>(); |
| | | xnmap.put("优秀",0); |
| | | xnmap.put("劣化",0); |
| | | xnmap.put("损坏",0); |
| | | xnmap.put("未放电",0); |
| | | //查询出所有的班组并赋予初始值 |
| | | setBanZuDefault(map); |
| | | setBanZuDefault(bzmap); |
| | | //获取核容优劣,损坏参数 |
| | | List<AppParam> paramList=appParamService.getHrParam(); |
| | | Float badValue=0f; |
| | |
| | | //2.获取电池组在给定时间段的放电记录(指定时间段的标准核容放电) |
| | | BatttestdataInf tinf =getLastStandardTestDataByTime(binf.getBattgroupId(),stic.getTestStartTime(),stic.getTestEndTime()); |
| | | if(tinf==null){ |
| | | res.setRealCap(0f); |
| | | res.setTestStartTime(ThreadLocalUtil.parse("1972-01-01 00:00:00",1)); |
| | | res.setTestTimelong(0); |
| | | res.setTestCap(0f); |
| | | res.setStopReason(""); |
| | | res.setCapperformance(Capperformance.getValue(Capperformance.BATTSTATE_4.getStateId())); |
| | | res.setDisChargeType(2); |
| | | if(!groupName.equals("none")){ |
| | | BanZu bz= (BanZu) map.get(groupName); |
| | | int nochargeNum=bz.getNochargeNum(); |
| | | bz.setNochargeNum(nochargeNum+1); |
| | | map.put(groupName,bz); |
| | | } |
| | | continue; |
| | | } |
| | | if(!groupName.equals("none")){ |
| | | BanZu bz= (BanZu) map.get(groupName); |
| | | BanZu bz= (BanZu) bzmap.get(groupName); |
| | | int dischargeNum=bz.getDischargeNum(); |
| | | bz.setDischargeNum(dischargeNum+1); |
| | | map.put(groupName,bz); |
| | | bzmap.put(groupName,bz); |
| | | } |
| | | res.setTestStartTime(tinf.getTestStarttime()); |
| | | res.setTestTimelong(tinf.getTestTimelong()); |
| | | res.setTestCap(tinf.getTestCap()); |
| | | res.setStopReason(StopReasonEnum.getValue(tinf.getTestStoptype())); |
| | | if (tinf.getTestType() == 3) { |
| | | // 测试类型为放电 |
| | | if (tinf.getTestStarttype() == 3) { |
| | | res.setDischargeName("核容放电"); |
| | | } else if(tinf.getTestStarttype() == 4){ |
| | | res.setDischargeName("停电放电"); |
| | | }else { |
| | | res.setDischargeName("监测放电"); |
| | | } |
| | | } |
| | | res.setTestRecordCount(tinf.getTestRecordCount()); |
| | | Float moncapStd=binf.getMoncapstd(); |
| | | int hourRate = BattCapFactory.GetHourRate(tinf.getTestCap(), tinf.getTestCurr()); |
| | | Float grouprealCap = (float) BattCapFactory.GetMonomerCap(tinf.getTestCap(), hourRate, tinf.getTestCap(), tinf.getMaxMonvol(), tinf.getMinMonvol(), tinf.getGroupVol(), BattCapFactory.CapType_Real); |
| | | res.setRealCap(grouprealCap); |
| | | res.setDisChargeType(1); |
| | | //res.setDisChargeType(1); |
| | | if(grouprealCap>=moncapStd*badValue){ |
| | | res.setCapperformance(Capperformance.getValue(Capperformance.BATTSTATE_1.getStateId())); |
| | | int value=xnmap.get(Capperformance.getValue(Capperformance.BATTSTATE_1.getStateId())); |
| | | xnmap.put(Capperformance.getValue(Capperformance.BATTSTATE_1.getStateId()),value+1); |
| | | } |
| | | if(grouprealCap<=moncapStd*damageValue){ |
| | | res.setCapperformance(Capperformance.getValue(Capperformance.BATTSTATE_3.getStateId())); |
| | | int value=xnmap.get(Capperformance.getValue(Capperformance.BATTSTATE_3.getStateId())); |
| | | xnmap.put(Capperformance.getValue(Capperformance.BATTSTATE_3.getStateId()),value+1); |
| | | } |
| | | if((grouprealCap>moncapStd*damageValue)&&(grouprealCap<moncapStd*badValue)){ |
| | | res.setCapperformance(Capperformance.getValue(Capperformance.BATTSTATE_2.getStateId())); |
| | | int value=xnmap.get(Capperformance.getValue(Capperformance.BATTSTATE_2.getStateId())); |
| | | xnmap.put(Capperformance.getValue(Capperformance.BATTSTATE_2.getStateId()),value+1); |
| | | } |
| | | if(stic.getDisChargeType()==null){ |
| | | reslist.add(res); |
| | | }else{ |
| | | if(res.getDisChargeType()==stic.getDisChargeType()){ |
| | | reslist.add(res); |
| | | } |
| | | } |
| | | reslist.add(res); |
| | | } |
| | | PageInfo pageInfo=PageInfoUtils.list2PageInfo(reslist, stic.getPageNum(), stic.getPageSize()); |
| | | return new Response().setIII(1,reslist.size()>0,pageInfo,map,"本年度已放电数量统计"); |
| | | return new Response().setIIII(1,reslist.size()>0,pageInfo,bzmap,xnmap,"本年度已放电数量统计"); |
| | | } |
| | | |
| | | //查询出所有的班组并赋予初始值 |
| | | private void setBanZuDefault(Map<String, Object> map) { |
| | | List<Baojigroup> banZuList=bjService.getGroupList(); |
| | |
| | | |
| | | //本年度未放电数量统计(1.2.6) |
| | | public Response getDischr6Statistic(DisChargeStic stic) { |
| | | Map<String, Object> map=new HashMap<>(); |
| | | //班组 |
| | | Map<String, Object> bzmap=new HashMap<>(); |
| | | //查询出所有的班组并赋予初始值 |
| | | setBanZuDefault(map); |
| | | |
| | | setBanZuDefault(bzmap); |
| | | //1查询符合条件的电池组 |
| | | List<BattInf> binfList=battInfService.getDischr6Statistic(stic); |
| | | if(binfList==null||binfList.size()==0){ |
| | |
| | | res.setProduct(binf.getProduct()); |
| | | //获取电池组未放电记录(指定时间段的标准核容放电) |
| | | getNoDischargeData(binf.getBattgroupId(),stic.getTestStartTime(),stic.getTestEndTime(),stic.getTypeList(),res); |
| | | //2.获取电池组在给定时间段的放电记录(指定时间段的标准核容放电) |
| | | BatttestdataInf tinf =getLastStandardTestDataByTime(binf.getBattgroupId(),stic.getTestStartTime(),stic.getTestEndTime()); |
| | | res.setTinf(tinf); |
| | | if(stic.getStopReasonType()==0){ |
| | | reslist.add(res); |
| | | }else { |
| | |
| | | reslist.add(res); |
| | | } |
| | | } |
| | | if(tinf==null){ |
| | | if(!groupName.equals("none")){ |
| | | BanZu bz= (BanZu) map.get(groupName); |
| | | int nochargeNum=bz.getNochargeNum(); |
| | | bz.setNochargeNum(nochargeNum+1); |
| | | map.put(groupName,bz); |
| | | } |
| | | continue; |
| | | } |
| | | if(!groupName.equals("none")){ |
| | | BanZu bz= (BanZu) map.get(groupName); |
| | | int dischargeNum=bz.getDischargeNum(); |
| | | bz.setDischargeNum(dischargeNum+1); |
| | | map.put(groupName,bz); |
| | | BanZu bz= (BanZu) bzmap.get(groupName); |
| | | int nochargeNum=bz.getNochargeNum(); |
| | | bz.setNochargeNum(nochargeNum+1); |
| | | bzmap.put(groupName,bz); |
| | | } |
| | | } |
| | | PageInfo pageInfo=PageInfoUtils.list2PageInfo(reslist, stic.getPageNum(), stic.getPageSize()); |
| | | return new Response().setIII(1,reslist.size()>0,pageInfo,map,"本年度未放电数量统计"); |
| | | return new Response().setIII(1,reslist.size()>0,pageInfo,bzmap,"本年度未放电数量统计"); |
| | | } |
| | | //2.获取电池组未放电记录(指定时间段的标准核容放电) |
| | | private void getNoDischargeData(Integer battgroupId, Date testStartTime, Date testEndTime, List<Integer> typeList, SticDischarge6Res res) { |
| | |
| | | if(tinfList!=null&&tinfList.size()>0){ |
| | | res.setErrorNum(tinfList.size()); |
| | | res.setStopReasonType(1); |
| | | for (BatttestdataInf tinf:tinfList) { |
| | | for (int i=0;i<tinfList.size();i++) { |
| | | BatttestdataInf tinf=tinfList.get(i); |
| | | if(i==0){ |
| | | res.setTestRecordCount(tinf.getTestRecordCount()); |
| | | if (tinf.getTestType() == 3) { |
| | | // 测试类型为放电 |
| | | if (tinf.getTestStarttype() == 3) { |
| | | res.setDischargeName("核容放电"); |
| | | } else if(tinf.getTestStarttype() == 4){ |
| | | res.setDischargeName("停电放电"); |
| | | }else { |
| | | res.setDischargeName("监测放电"); |
| | | } |
| | | } |
| | | } |
| | | String stopReason=StopReasonEnum.getValue(tinf.getTestStoptype()); |
| | | stopList.add(stopReason); |
| | | } |
| | |
| | | PageInfo pageInfo=PageInfoUtils.list2PageInfo(reslist, stic.getPageNum(), stic.getPageSize()); |
| | | return new Response().setII(1,reslist.size()>0,pageInfo,"电池组电池性能统计(未放电,优秀,劣化,损坏)统计(1.2.8/9/10)"); |
| | | } |
| | | //优良电源数量统计(1.2.7) |
| | | public Response getPwr7Statistic(Pwr7Stic stic) { |
| | | //1查询符合条件的电池组 |
| | | List<PowerInf> pinfList=powerInfService.getPwr7Statistic(stic); |
| | | if(pinfList==null||pinfList.size()==0){ |
| | | return new Response().set(1,false,"当前用户未管理满足条件的电池组"); |
| | | } |
| | | List<SticPwr7Res> reslist=new ArrayList<>(); |
| | | for (PowerInf pinf:pinfList) { |
| | | SticPwr7Res res=new SticPwr7Res(); |
| | | //查询电池组所在的班组 |
| | | String groupName = bjService.getGroupName(pinf.getPowerId()); |
| | | if(groupName.equals("none")){ |
| | | continue; |
| | | }else{ |
| | | if(stic.getGroupName()==null||res.getGroupName()==stic.getGroupName()){ |
| | | res.setProvice(pinf.getProvice()); |
| | | res.setCity(pinf.getCity()); |
| | | res.setCountry(pinf.getCountry()); |
| | | res.setStationName(pinf.getStationName()); |
| | | res.setPowerName(pinf.getPowerName()); |
| | | res.setCompany(pinf.getCompany()); |
| | | res.setStationType(pinf.getStationType()); |
| | | res.setGroupName(groupName); |
| | | res.setInuseTime(pinf.getPowerInuseTime()); |
| | | Map<String,Integer> map=pwrHisdataIdService.getPwrQuarter7(pinf.getPowerId(),null); |
| | | reslist.add(res); |
| | | } |
| | | } |
| | | } |
| | | |
| | | PageInfo pageInfo=PageInfoUtils.list2PageInfo(reslist, stic.getPageNum(), stic.getPageSize()); |
| | | return new Response().setII(1,reslist.size()>0,pageInfo,"优良电源数量统计(1.2.7)"); |
| | | } |
| | | } |
| | |
| | | |
| | | 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.constant.BattAlarmIdEnum; |
| | |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.mapper.DevalarmDataMapper; |
| | | import com.whyc.pojo.db_alarm.DevalarmData; |
| | | import com.whyc.pojo.web_site.AlarmInspection; |
| | | import com.whyc.util.ActionUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Service |
| | | public class DevalarmDataService { |
| | |
| | | Map<Integer,String> map= DevAlarmEnum.getOpInfo(); |
| | | return new Response().setII(1,true,map,"获取设备告警类型(下拉)"); |
| | | } |
| | | |
| | | public List<AlarmInspection> getListGreatThan(Long devAlarmId) { |
| | | List<AlarmInspection> listGreatThan = mapper.getListGreatThan(devAlarmId); |
| | | Date now = new Date(); |
| | | listGreatThan.forEach(data->{ |
| | | data.setType(2); |
| | | data.setIsExist(1); |
| | | data.setCreateTime(now); |
| | | }); |
| | | return listGreatThan; |
| | | } |
| | | |
| | | public List<Long> getNumListInDB(List<Long> devAlarmNumList) { |
| | | QueryWrapper<DevalarmData> query = Wrappers.query(); |
| | | query.select("num"); |
| | | query.in("num",devAlarmNumList); |
| | | return mapper.selectList(query).stream().map(DevalarmData::getNum).collect(Collectors.toList()); |
| | | } |
| | | } |
| | |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.mapper.DeviceSpareMapper; |
| | | import com.whyc.pojo.web_site.DeviceSpare; |
| | | import com.whyc.util.CommonUtil; |
| | | import com.whyc.util.ThreadLocalUtil; |
| | | import org.apache.commons.lang.StringUtils; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.io.File; |
| | | import java.io.IOException; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | @Service |
| | |
| | | return new Response<List<DeviceSpare>>().set(1, mapper.selectList(query)); |
| | | } |
| | | |
| | | public Response add(DeviceSpare spare) { |
| | | public Response add(DeviceSpare spare, List<MultipartFile> file) throws IOException { |
| | | //对file进行处理,保存到文件夹中 |
| | | //对存储路径进行定义 |
| | | Date now = new Date(); |
| | | String timeFormat = ThreadLocalUtil.format(ThreadLocalUtil.TIME_YYYY_MM_DD_HH_MM_SS_UNION, now); |
| | | String dirMonth = ThreadLocalUtil.format(ThreadLocalUtil.TIME_YYYY_MM, now); |
| | | String fileDirPath = CommonUtil.getRootFile() + "deviceSpare" + File.separator + dirMonth; |
| | | File fileDir = new File(fileDirPath); |
| | | //如果文件夹不存在则创建 |
| | | if (!fileDir.exists()) { |
| | | fileDir.mkdirs(); |
| | | } |
| | | StringBuilder pictureUrlSb = new StringBuilder(); |
| | | if (file != null && file.size() > 0) { |
| | | for (int i = 0; i < file.size(); i++) { |
| | | MultipartFile multipartFile = file.get(i); |
| | | String fileName = multipartFile.getOriginalFilename(); |
| | | //将fileName中可能存在的,去掉 |
| | | fileName = fileName.replace(",",""); |
| | | String filePath = fileDirPath + File.separator + timeFormat+"_"+fileName; |
| | | |
| | | multipartFile.transferTo(new File(filePath)); |
| | | String split = "pis_file"+File.separator+"deviceSpare"; |
| | | String picUrl = File.separator + filePath.substring(filePath.indexOf(split)); |
| | | if(i == file.size()-1) { |
| | | pictureUrlSb.append(picUrl); |
| | | }else { |
| | | pictureUrlSb.append(picUrl).append(","); |
| | | } |
| | | } |
| | | } |
| | | spare.setPictureUrl(pictureUrlSb.toString()); |
| | | mapper.insert(spare); |
| | | return new Response().setII(1,"增加完成"); |
| | | } |
| | |
| | | import com.github.pagehelper.PageInfo; |
| | | import com.whyc.dto.PowerDto; |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.dto.Statistic.Pwr7Stic; |
| | | import com.whyc.dto.Statistic.StationStic; |
| | | import com.whyc.mapper.BaojigroupPowerMapper; |
| | | import com.whyc.mapper.BaojigroupUsrMapper; |
| | |
| | | PageInfo<PowerInf> pageInfo=new PageInfo<>(list); |
| | | return new Response().setII(1,list.size()>0,pageInfo,"电源信息统计"); |
| | | } |
| | | //优良电源数量统计(1.2.7) |
| | | public List<PowerInf> getPwr7Statistic(Pwr7Stic stic) { |
| | | return mapper.getPwr7Statistic(stic); |
| | | } |
| | | } |
| | |
| | | |
| | | 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.constant.DevAlarmEnum; |
| | |
| | | import com.whyc.mapper.PwrdevAlarmMapper; |
| | | import com.whyc.pojo.db_alarm.DevalarmData; |
| | | import com.whyc.pojo.db_pwrdev_alarm.PwrdevAlarm; |
| | | import com.whyc.pojo.web_site.AlarmInspection; |
| | | import com.whyc.util.ActionUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Service |
| | | public class PwrdevAlarmService { |
| | |
| | | Map<String,Map<Integer,String>> map= PowerAlarmEnum.getOpInfo(); |
| | | return new Response().setII(1,true,map,"获取电源告警类型(下拉)"); |
| | | } |
| | | |
| | | public List<AlarmInspection> getListGreatThan(Long id) { |
| | | List<AlarmInspection> listGreatThan = mapper.getListGreatThan(id); |
| | | Date now = new Date(); |
| | | listGreatThan.forEach(data->{ |
| | | data.setType(1); |
| | | data.setIsExist(1); |
| | | data.setCreateTime(now); |
| | | }); |
| | | return listGreatThan; |
| | | } |
| | | |
| | | public List<Long> getNumListInDB(List<Long> powerAlarmNumList) { |
| | | QueryWrapper<PwrdevAlarm> query = Wrappers.query(); |
| | | query.select("num"); |
| | | query.in("num",powerAlarmNumList); |
| | | return mapper.selectList(query).stream().map(PwrdevAlarm::getNum).collect(Collectors.toList()); |
| | | } |
| | | } |
| | |
| | | package com.whyc.service; |
| | | |
| | | import com.whyc.dto.Real.CompareDto; |
| | | import com.whyc.dto.Real.PwrHisRealAcInDto; |
| | | import com.whyc.dto.Real.PwrHisRealDcoutInDto; |
| | | import com.whyc.dto.Real.QuarterDto; |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.dto.Statistic.QuarterPwr7Res; |
| | | import com.whyc.mapper.CommonMapper; |
| | | import com.whyc.pojo.db_data_history.BattRealdataId; |
| | | import com.whyc.pojo.db_data_history.PwrdevHistorydataId; |
| | |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @Service |
| | | public class PwrdevHistorydataIdService { |
| | |
| | | } |
| | | return new Response().setIII(1,datalist.size()>0,datalist,modelCfg,"获取半小时内直流输出统计"); |
| | | } |
| | | //1.2.7优良电源统计上一季度的电源某一属性和参数阈值超过的次数 |
| | | public Map<String,Integer> getPwrQuarter7(Integer powerId, Map<String,Float> paramValue) { |
| | | Map<String,Integer> map=new HashMap<>(); |
| | | map.put("acin1Vola",0); |
| | | map.put("acoutVola",0); |
| | | map.put("dcoutVol",0); |
| | | map.put("dcoutCurr",0); |
| | | List<String> datelist = ActionUtil.getLastQuarterYearMonths(); |
| | | for (int i=0;i<datelist.size();i++) { |
| | | String date=datelist.get(i); |
| | | String tableName ="db_data_history.tb_pwrdev_historydata_"+powerId+"_"+date; |
| | | String existTableName = commonMapper.existTable("db_data_history", "tb_pwrdev_historydata_"+powerId+"_"+date); |
| | | //判断表是否存在 |
| | | if(existTableName == null){ |
| | | continue; |
| | | } |
| | | List<QuarterPwr7Res> datalist=subTablePageInfoService.getPwrQuarter7(tableName); |
| | | // 遍历 dataList 并比较属性值 |
| | | for (QuarterPwr7Res data : datalist) { |
| | | if (data.getAcin1Vola() > paramValue.get("acin1Vola")) { |
| | | map.put("acin1Vola", map.get("acin1Vola") + 1); |
| | | } |
| | | if (data.getAcoutVola() > paramValue.get("acoutVola")) { |
| | | map.put("acoutVola", map.get("acoutVola") + 1); |
| | | } |
| | | if (data.getDcoutVol() > paramValue.get("dcoutVol")) { |
| | | map.put("dcoutVol", map.get("dcoutVol") + 1); |
| | | } |
| | | if (data.getDcoutCurr() > paramValue.get("dcoutCurr")) { |
| | | map.put("dcoutCurr", map.get("dcoutCurr") + 1); |
| | | } |
| | | } |
| | | } |
| | | return map; |
| | | } |
| | | } |
| | |
| | | import com.whyc.dto.AlmHis.DevAlmPar; |
| | | import com.whyc.dto.AlmHis.PwrAlmPar; |
| | | import com.whyc.dto.Real.*; |
| | | import com.whyc.dto.Statistic.QuarterPwr7Res; |
| | | import com.whyc.mapper.CallBack; |
| | | import com.whyc.pojo.db_alarm.BattalarmDataHistory; |
| | | import com.whyc.pojo.db_alarm.DevalarmDataHistory; |
| | |
| | | }); |
| | | return list; |
| | | } |
| | | //1.2.7优良电源统计上一季度的电源某一属性和参数阈值超过的次数 |
| | | public List<QuarterPwr7Res> getPwrQuarter7(String tableName) { |
| | | String sql=" select distinct record_datetime,acin1_vola,acout_vola,dcout_vol,dcout_curr " + |
| | | " from "+tableName+" " ; |
| | | sql+=" order by record_datetime asc"; |
| | | List<QuarterPwr7Res> list = sqlExecuteService.executeQuery_call(sql, new CallBack() { |
| | | @Override |
| | | public List getResults(ResultSet rs) throws SQLException { |
| | | List<QuarterPwr7Res> list=new ArrayList<>(); |
| | | while (rs.next()){ |
| | | QuarterPwr7Res data=new QuarterPwr7Res(); |
| | | data.setRecordDatetime(rs.getTimestamp("record_datetime")); |
| | | data.setAcin1Vola(rs.getFloat("acin1_vola")); |
| | | data.setAcoutVola(rs.getFloat("acout_vola")); |
| | | data.setDcoutVol(rs.getFloat("dcout_vol")); |
| | | data.setDcoutCurr(rs.getFloat("dcout_curr")); |
| | | list.add(data); |
| | | } |
| | | return list; |
| | | } |
| | | }); |
| | | return list; |
| | | } |
| | | } |
| | |
| | | import com.whyc.constant.YamlProperties; |
| | | import com.whyc.pojo.db_user.User; |
| | | import com.whyc.service.UserLogService; |
| | | import org.apache.shiro.SecurityUtils; |
| | | import org.apache.shiro.subject.Subject; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.boot.system.ApplicationHome; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.io.File; |
| | | |
| | | import static org.apache.shiro.web.filter.mgt.DefaultFilter.user; |
| | | |
| | | /** |
| | | * 通用工具列 |
| | |
| | | return (User) request.getSession().getAttribute("user"); |
| | | } |
| | | |
| | | /** |
| | | * Shiro框架下的用户获取 |
| | | * @return |
| | | */ |
| | | public static User getUser() { |
| | | User user; |
| | | Subject currentUser = SecurityUtils.getSubject(); |
| | | if(currentUser!=null && currentUser.isAuthenticated()){ |
| | | user = (User) currentUser.getPrincipal(); |
| | | }else{ |
| | | user = new User(); |
| | | user.setName("unlogged_user"); |
| | | user.setId(0); |
| | | } |
| | | return user; |
| | | } |
| | | |
| | | public static String classesPath(){ |
| | | ApplicationHome applicationHome = new ApplicationHome(CommonUtil.class); |
| | | File jarFile = applicationHome.getDir(); |
| | |
| | | import java.util.Date; |
| | | |
| | | public class ThreadLocalUtil { |
| | | |
| | | public static String TIME_YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss"; |
| | | public static String TIME_YYYY_MM_DD = "yyyy-MM-dd"; |
| | | public static String TIME_YYYY_MM = "yyyy-MM"; |
| | | public static String TIME_YYYY_MM_DD_HH_MM_SS_UNION = "yyyyMMddHHmmss"; |
| | | public static String TIME_YYYY_MM_DD_HH_MM_SS_UNION2 = "yyyy-MM-dd_HH_mm_ss"; |
| | | |
| | | public static ThreadLocal<SimpleDateFormat> sdf = ThreadLocal.withInitial(() -> new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")); |
| | | public static ThreadLocal<SimpleDateFormat> sdfwithOutday = ThreadLocal.withInitial(() -> new SimpleDateFormat("yyyy_MM")); |
| | | public static ThreadLocal<SimpleDateFormat> sdfwithday = ThreadLocal.withInitial(() -> new SimpleDateFormat("yyyy-MM-dd")); |
| | |
| | | } |
| | | return timeStr; |
| | | } |
| | | |
| | | public static String format(String timeFormat,Date date) { |
| | | ThreadLocal<SimpleDateFormat> formatThreadLocal = ThreadLocal.withInitial(() -> new SimpleDateFormat(timeFormat)); |
| | | SimpleDateFormat format = formatThreadLocal.get(); |
| | | return format.format(date); |
| | | } |
| | | } |
| | |
| | | <result column="dev_name" property="devName" /> |
| | | <result column="batt_group_id" property="battGroupId" /> |
| | | <result column="batt_group_name" property="battGroupName" /> |
| | | <result column="mon_num" property="monNum"/> |
| | | <result column="type" property="type" /> |
| | | <result column="alm_num" property="almNum" /> |
| | | <result column="alm_id" property="almId" /> |
| | |
| | | ai.dev_name, |
| | | ai.batt_group_id, |
| | | ai.batt_group_name, |
| | | ai.mon_num, |
| | | ai.type, |
| | | ai.alm_num, |
| | | ai.alm_id, |
| | |
| | | and ai.station_id = bgp.station_id |
| | | and bg.baoji_group_id = bgp.baoji_group_id |
| | | and ai.station_id = #{stationId} |
| | | <if test="inspectionType == 1"> |
| | | and ai.alm_level = 1 |
| | | </if> |
| | | <if test="inspectionType == 2"> |
| | | and ai.alm_level != 1 |
| | | </if> |
| | | </select> |
| | | </mapper> |
| | |
| | | order by tb_batt_inf.dev_id asc,battgroup_id asc |
| | | </where> |
| | | </select> |
| | | <select id="getDischrChart" resultType="com.whyc.pojo.db_station.BattInf"> |
| | | select distinct tb_batt_inf.* |
| | | ,tb_station_inf.station_type,tb_station_inf.station_name,tb_station_inf.provice,tb_station_inf.city,tb_station_inf.country,tb_station_inf.full_name |
| | | from db_station.tb_batt_inf,db_station.tb_station_inf |
| | | <where> |
| | | tb_batt_inf.station_id=tb_station_inf.station_id |
| | | <if test="uid>100"> |
| | | and tb_batt_inf.station_id in( |
| | | select distinct station_id from db_user.tb_baojigroup_power,db_user.tb_baojigroup_usr |
| | | where tb_baojigroup_power.baoji_group_id=tb_baojigroup_usr.baoji_group_id |
| | | and tb_baojigroup_usr.uid=#{uid} |
| | | ) |
| | | </if> |
| | | order by tb_batt_inf.dev_id asc,battgroup_id asc |
| | | </where> |
| | | </select> |
| | | </mapper> |
| | |
| | | |
| | | </where> |
| | | </select> |
| | | <select id="getListGreatThan" resultType="com.whyc.pojo.web_site.AlarmInspection"> |
| | | select bd.mon_num,bd.alm_signal_id as alm_id,bd.alm_id as alm_id_origin,bd.alm_level,bd.alm_start_time, |
| | | bd.num as alm_num,bi.battgroup_id,bi.battgroup_name,bi.dev_id,bi.dev_name,si.station_id,si.station_name from db_alarm.tb_battalarm_data bd,db_station.tb_batt_inf bi,db_station.tb_station_inf si |
| | | where bd.battgroup_id=bi.battgroup_id |
| | | and bi.station_id=si.station_id |
| | | and bd.num>#{id} |
| | | </select> |
| | | </mapper> |
| | |
| | | </foreach> |
| | | </if> |
| | | </where> |
| | | order by test_starttime desc |
| | | </select> |
| | | </mapper> |
| | |
| | | |
| | | </where> |
| | | </select> |
| | | <select id="getListGreatThan" resultType="com.whyc.pojo.web_site.AlarmInspection"> |
| | | select distinct dd.*,dd.num as alm_num,bi.dev_id,bi.dev_name,si.station_id,si.station_name from db_alarm.tb_devalarm_data dd,db_station.tb_batt_inf bi,db_station.tb_station_inf si |
| | | where dd.dev_id=bi.dev_id |
| | | and bi.station_id=si.station_id |
| | | and dd.num>#{id} |
| | | </select> |
| | | </mapper> |
| | |
| | | </if> |
| | | </where> |
| | | </select> |
| | | <select id="getPwr7Statistic" resultType="com.whyc.pojo.db_station.PowerInf"> |
| | | select distinct tb_power_inf.* |
| | | ,tb_station_inf.station_type,tb_station_inf.station_name,tb_station_inf.provice,tb_station_inf.city,tb_station_inf.country,tb_station_inf.full_name |
| | | from db_station.tb_power_inf,db_station.tb_station_inf |
| | | <where> |
| | | tb_power_inf.station_id=tb_station_inf.station_id |
| | | <if test="stic.provice!=null"> |
| | | and tb_station_inf.provice=#{stic.provice} |
| | | </if> |
| | | <if test="stic.city!=null"> |
| | | and tb_station_inf.city=#{stic.city} |
| | | </if> |
| | | <if test="stic.country!=null"> |
| | | and tb_station_inf.country=#{stic.country} |
| | | </if> |
| | | <if test="stic.stationName!=null"> |
| | | and tb_station_inf.station_name=#{stic.stationName} |
| | | </if> |
| | | <if test="stic.stationType!=null"> |
| | | and tb_station_inf.station_type=#{stic.stationType} |
| | | </if> |
| | | <if test="stic.company!=null"> |
| | | and tb_power_inf.company=#{stic.company} |
| | | </if> |
| | | <if test="stic.inuseStartTime!=null"> |
| | | and tb_power_inf.power_inuse_time>=#{stic.inuseStartTime} |
| | | </if> |
| | | <if test="stic.inuseEndTime!=null"> |
| | | and tb_power_inf.power_inuse_time<=#{stic.inuseEndTimee} |
| | | </if> |
| | | <if test="stic.uid>100"> |
| | | and tb_power_inf.power_id in( |
| | | select distinct power_id from db_user.tb_baojigroup_power,db_user.tb_baojigroup_usr |
| | | where tb_baojigroup_power.baoji_group_id=tb_baojigroup_usr.baoji_group_id |
| | | and tb_baojigroup_usr.uid=#{stic.uid} |
| | | ) |
| | | </if> |
| | | order by tb_power_inf.power_id asc |
| | | </where> |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | |
| | | </where> |
| | | </select> |
| | | <select id="getListGreatThan" resultType="com.whyc.pojo.web_site.AlarmInspection"> |
| | | select pa.*,pa.num as alm_num,pi.power_name,pi.power_id,si.station_id,si.station_name from db_pwrdev_alarm.tb_pwrdev_alarm pa,db_station.tb_power_inf pi,db_station.tb_station_inf si |
| | | where pa.power_id=pi.power_id |
| | | and pi.station_id=si.station_id |
| | | and pa.num>#{id} |
| | | </select> |
| | | </mapper> |