15 文件已重命名
5个文件已删除
19个文件已修改
4个文件已添加
2 文件已复制
New file |
| | |
| | | package com.whyc.controller; |
| | | |
| | | import com.whyc.dto.DevA200AlarmDto; |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.pojo.db_user.UserInf; |
| | | import com.whyc.service.DevLithiumAlarmDataService; |
| | | 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.*; |
| | | |
| | | import java.text.ParseException; |
| | | |
| | | /** |
| | | * 锂电设备告警-实时 |
| | | */ |
| | | @RestController |
| | | @Api(tags = "锂电设备告警") |
| | | @RequestMapping("devLithiumAlarmData") |
| | | public class DevLithiumAlarmDataController { |
| | | @Autowired |
| | | private DevLithiumAlarmDataService dataService; |
| | | |
| | | @ApiOperation(value = "实时告警") |
| | | @PostMapping("getPage") |
| | | public Response getPage(@RequestParam int uid, @RequestBody DevA200AlarmDto dto){ |
| | | return dataService.getPage(uid,dto); |
| | | } |
| | | @ApiOperation(value = "弹窗告警") |
| | | @GetMapping("getPopup") |
| | | public Response getPopup(){ |
| | | UserInf uinf= ActionUtil.getUser(); |
| | | return dataService.getPopup(uinf.getUid()); |
| | | } |
| | | |
| | | @ApiOperation(value = "确认实时告警") |
| | | @GetMapping("confirm") |
| | | public Response confirm(@RequestParam int num){ |
| | | return dataService.confirm(num); |
| | | } |
| | | |
| | | @ApiOperation(value = "获取所有的告警类型") |
| | | @GetMapping("getAllAlmName") |
| | | public Response getAllAlmName(){ |
| | | return dataService.getAllAlmName(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.whyc.controller; |
| | | |
| | | import com.whyc.dto.DevA200AlarmDto; |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.pojo.db_user.UserInf; |
| | | import com.whyc.service.DevLithiumAlarmDataService; |
| | | 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.*; |
| | | |
| | | import java.text.ParseException; |
| | | |
| | | /** |
| | | * 锂电设备告警-历史 |
| | | */ |
| | | @RestController |
| | | @Api(tags = "锂电设备告警历史") |
| | | @RequestMapping("devLithiumAlarmDataHistory") |
| | | public class DevLithiumAlarmDataHisController { |
| | | @Autowired |
| | | private DevLithiumAlarmDataService dataService; |
| | | |
| | | @ApiOperation(value = "获取历史告警") |
| | | @PostMapping("getPage") |
| | | public Response getPage( @RequestBody DevA200AlarmDto dto) throws ParseException { |
| | | return dataService.getPage(dto); |
| | | } |
| | | |
| | | } |
File was renamed from src/main/java/com/whyc/controller/DevInfController.java |
| | |
| | | |
| | | import com.whyc.dto.DevInfDto; |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.pojo.db_lithium_ram_db.DevInf; |
| | | import com.whyc.service.DevInfService; |
| | | import com.whyc.pojo.db_lithium_ram_db.DevLithiumInf; |
| | | import com.whyc.service.DevLithiumInfService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | import java.util.Map; |
| | | |
| | | @RestController |
| | | @Api(tags = "设备") |
| | | @Api(tags = "锂电设备信息") |
| | | @RequestMapping("devInf") |
| | | public class DevInfController { |
| | | public class DevLithiumInfController { |
| | | @Autowired |
| | | private DevInfService service; |
| | | private DevLithiumInfService service; |
| | | |
| | | |
| | | |
| | | @ApiOperation(value = "添加设备") |
| | | @PostMapping("addDev") |
| | | public Response addDev(@RequestBody DevInf devInf){ |
| | | public Response addDev(@RequestBody DevLithiumInf devInf){ |
| | | return service.addDev(devInf); |
| | | } |
| | | |
| | |
| | | |
| | | @ApiOperation(value = "编辑设备信息") |
| | | @PostMapping("updateInf") |
| | | public Response updateInf(@RequestBody DevInf dinf){ |
| | | public Response updateInf(@RequestBody DevLithiumInf dinf){ |
| | | return service.updateInf(dinf); |
| | | } |
| | | |
File was renamed from src/main/java/com/whyc/dto/DalmDto.java |
| | |
| | | import java.util.Date; |
| | | |
| | | @Data |
| | | public class DalmDto { |
| | | public class DevA200AlarmDto { |
| | | private Integer devId; |
| | | private Integer devType; |
| | | private Integer almId; |
| | |
| | | package com.whyc.mapper; |
| | | |
| | | import com.whyc.pojo.db_lithium_ram_db.A200Realstate; |
| | | import com.whyc.pojo.db_lithium_ram_db.A200RealState; |
| | | |
| | | public interface A200RealStateMapper extends CustomMapper<A200Realstate>{ |
| | | public interface A200RealStateMapper extends CustomMapper<A200RealState>{ |
| | | } |
| | |
| | | package com.whyc.mapper; |
| | | |
| | | import com.whyc.pojo.db_lithium_ram_db.ActmRealstate; |
| | | import com.whyc.pojo.db_lithium_ram_db.ActmRealState; |
| | | |
| | | public interface ActmRealStateMapper extends CustomMapper<ActmRealstate>{ |
| | | public interface ActmRealStateMapper extends CustomMapper<ActmRealState>{ |
| | | } |
New file |
| | |
| | | package com.whyc.mapper; |
| | | |
| | | import com.whyc.dto.DevA200AlarmDto; |
| | | import com.whyc.pojo.db_alarm.DevLithiumAlarmData; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface DevLithiumAlarmDataMapper extends CustomMapper<DevLithiumAlarmData>{ |
| | | //获取设备告警信息 |
| | | List<DevLithiumAlarmData> getDevAlmInf(@Param("dto") DevA200AlarmDto dto); |
| | | //弹窗告警 |
| | | List<DevLithiumAlarmData> getPopup(@Param("uid") int uid); |
| | | } |
New file |
| | |
| | | package com.whyc.mapper; |
| | | |
| | | import com.whyc.dto.DevInfDto; |
| | | import com.whyc.pojo.db_lithium_ram_db.DevLithiumInf; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface DevLithiumInfMapper extends CustomMapper<DevLithiumInf>{ |
| | | //查询包机人管理的设备id |
| | | List<DevLithiumInf> getAllInf(@Param("dto") DevInfDto dto); |
| | | //查询该类型最大设备编号 |
| | | Integer getMaxDevId(Integer devType); |
| | | //获取左侧泪飙 |
| | | List<DevLithiumInf> getLine(@Param("uid") Integer uid); |
| | | |
| | | //获取左侧泪飙 |
| | | List<DevLithiumInf> getDevType(@Param("uid") Integer uid, @Param("devType") Integer devType); |
| | | |
| | | //设备分类总数统计 |
| | | List<DevLithiumInf> getDevStaticByType(@Param("uid") Integer userId); |
| | | |
| | | } |
File was renamed from src/main/java/com/whyc/pojo/db_alarm/DevAlarmData.java |
| | |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.whyc.pojo.db_lithium_ram_db.DevInf; |
| | | import com.whyc.pojo.db_lithium_ram_db.DevLithiumInf; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * <p> |
| | | * 设备实时告警记录表 |
| | | * </p> |
| | | * |
| | | * @author lxw |
| | | * @since 2024-09-11 |
| | | * 设备实时告警记录表 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @Accessors(chain = true) |
| | | @TableName(schema = "db_alarm",value ="tb_devalarm_data") |
| | | @ApiModel(value="DevalarmData对象", description="设备实时告警记录表") |
| | | public class DevAlarmData implements Serializable { |
| | | public class DevLithiumAlarmData implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | |
| | | private Integer almClearedType; |
| | | |
| | | @TableField(exist = false) |
| | | private DevInf devInf; |
| | | private DevLithiumInf devInf; |
| | | |
| | | |
| | | } |
File was renamed from src/main/java/com/whyc/pojo/db_alarm/DevAlarmDataYear.java |
| | |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.whyc.pojo.db_lithium_ram_db.DevInf; |
| | | import com.whyc.pojo.db_lithium_ram_db.DevLithiumInf; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * <p> |
| | | * 设备历史告警记录表 |
| | | * </p> |
| | | * |
| | | * @author lxw |
| | | * @since 2024-09-11 |
| | | * 锂电设备历史告警记录表 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @Accessors(chain = true) |
| | | @TableName("tb_devalarm_data_Year") |
| | | @ApiModel(value="DevalarmDataYear对象", description="设备历史告警记录表") |
| | | public class DevAlarmDataYear implements Serializable { |
| | | public class DevLithiumAlarmDataYear implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | |
| | | private Integer almClearedType; |
| | | |
| | | @TableField(exist = false) |
| | | private DevInf devInf; |
| | | private DevLithiumInf devInf; |
| | | } |
File was renamed from src/main/java/com/whyc/pojo/db_lithium_ram_db/A200Realstate.java |
| | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * <p> |
| | | * A200 设备实时状态表 |
| | | * </p> |
| | | * |
| | | * @author lxw |
| | | * @since 2024-08-28 |
| | | * A200 设备实时状态表 |
| | | * |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @Accessors(chain = true) |
| | | @TableName(schema = "db_lithium_ram_db",value ="tb_a200_realstate") |
| | | @ApiModel(value="A200Realstate对象", description="A200 设备实时状态表") |
| | | public class A200Realstate implements Serializable { |
| | | public class A200RealState implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
File was renamed from src/main/java/com/whyc/pojo/db_lithium_ram_db/ActmRealstate.java |
| | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * <p> |
| | | * ACTM 设备实时状态表 |
| | | * </p> |
| | | * |
| | | * @author lxw |
| | | * @since 2024-08-28 |
| | | * ACTM 设备实时状态表 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @Accessors(chain = true) |
| | | @TableName(schema = "db_lithium_ram_db",value ="tb_actm_realstate") |
| | | @ApiModel(value="ActmRealstate对象", description="ACTM 设备实时状态表") |
| | | public class ActmRealstate implements Serializable { |
| | | public class ActmRealState implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * <p> |
| | | * A200测试参数表 |
| | | * </p> |
| | | * |
| | | * @author lxw |
| | | * @since 2024-08-28 |
| | | * A200测试参数表 |
| | | * |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * <p> |
| | | * actm 测试参数表 |
| | | * </p> |
| | | * |
| | | * @author lxw |
| | | * @since 2024-08-28 |
| | | * actm 测试参数表 |
| | | * |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
File was renamed from src/main/java/com/whyc/pojo/db_lithium_ram_db/DevInf.java |
| | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * |
| | | * </p> |
| | | * |
| | | * @author lxw |
| | | * @since 2024-08-28 |
| | | * 锂电设备信息表 |
| | | * 包含a200和actm |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @Accessors(chain = true) |
| | | @TableName(schema = "db_lithium_ram_db",value ="tb_dev_inf") |
| | | @ApiModel(value="DevInf对象", description="") |
| | | public class DevInf implements Serializable { |
| | | @ApiModel(value="DevLithiumInf对象", description="") |
| | | public class DevLithiumInf implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * <p> |
| | | * 设备工作切换描述配置表 |
| | | * </p> |
| | | * |
| | | * @author lxw |
| | | * @since 2024-09-04 |
| | | * 设备工作切换描述配置表 |
| | | * |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * <p> |
| | | * 设备工作状态切换事件表 |
| | | * </p> |
| | | * |
| | | * @author lxw |
| | | * @since 2024-09-02 |
| | | * 设备工作状态切换事件表 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | |
| | | |
| | | /** |
| | | * <p> |
| | | * |
| | | * |
| | | * </p> |
| | | * |
| | | * @author lxw |
| | |
| | | |
| | | /** |
| | | * <p> |
| | | * |
| | | * |
| | | * </p> |
| | | * |
| | | * @author lxw |
| | |
| | | |
| | | /** |
| | | * <p> |
| | | * |
| | | * |
| | | * </p> |
| | | * |
| | | * @author lxw |
| | |
| | | |
| | | /** |
| | | * <p> |
| | | * |
| | | * |
| | | * </p> |
| | | * |
| | | * @author lxw |
| | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.whyc.pojo.db_lithium_ram_db.DevInf; |
| | | import com.whyc.pojo.db_lithium_ram_db.DevLithiumInf; |
| | | import io.swagger.annotations.ApiModel; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | |
| | | |
| | | /** |
| | | * <p> |
| | | * |
| | | * |
| | | * </p> |
| | | * |
| | | * @author lxw |
| | |
| | | private List<UserInf> usrList; |
| | | |
| | | @TableField(exist = false) |
| | | private List<DevInf> devList; |
| | | private List<DevLithiumInf> devList; |
| | | |
| | | |
| | | } |
| | |
| | | |
| | | /** |
| | | * <p> |
| | | * |
| | | * |
| | | * </p> |
| | | * |
| | | * @author lxw |
| | |
| | | |
| | | /** |
| | | * <p> |
| | | * |
| | | * |
| | | * </p> |
| | | * |
| | | * @author lxw |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.mapper.A200RealStateMapper; |
| | | import com.whyc.pojo.db_lithium_ram_db.A200Realstate; |
| | | import com.whyc.pojo.db_lithium_ram_db.A200RealState; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | |
| | | QueryWrapper wrapper=new QueryWrapper(); |
| | | wrapper.eq("dev_id",devId); |
| | | wrapper.last("limit 1"); |
| | | A200Realstate a200state=mapper.selectOne(wrapper); |
| | | A200RealState a200state=mapper.selectOne(wrapper); |
| | | return new Response().setII(1,a200state!=null,a200state,"一体机A200实时数据"); |
| | | } |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.mapper.ActmRealStateMapper; |
| | | import com.whyc.pojo.db_lithium_ram_db.ActmRealstate; |
| | | import com.whyc.pojo.db_lithium_ram_db.ActmRealState; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | |
| | | public Response getActmState(int devId) { |
| | | QueryWrapper wrapper=new QueryWrapper(); |
| | | wrapper.eq("dev_id",devId); |
| | | List<ActmRealstate> list=mapper.selectList(wrapper); |
| | | List<ActmRealState> list=mapper.selectList(wrapper); |
| | | return new Response().setII(1,list!=null,list,"均衡仪Actm实时数据"); |
| | | } |
| | | } |
| | |
| | | import com.whyc.dto.ResultA200Dto; |
| | | import com.whyc.factory.ThreadPoolExecutorFactory; |
| | | import com.whyc.mapper.DevA200TestParamMapper; |
| | | import com.whyc.mapper.DevInfMapper; |
| | | import com.whyc.mapper.DevLithiumInfMapper; |
| | | import com.whyc.pojo.db_lithium_ram_db.DevA200TestParam; |
| | | import com.whyc.pojo.db_lithium_ram_db.DevInf; |
| | | import com.whyc.pojo.db_lithium_ram_db.DevLithiumInf; |
| | | import com.whyc.util.ActionUtil; |
| | | import com.whyc.util.JsonUtil; |
| | | import com.whyc.util.TestParamHttpUtil; |
| | |
| | | private DevA200TestParamMapper mapper; |
| | | |
| | | @Autowired(required = false) |
| | | private DevInfMapper devInfMapper; |
| | | private DevLithiumInfMapper devLithiumInfMapper; |
| | | |
| | | private final RestTemplate restTemplate; |
| | | |
| | |
| | | QueryWrapper wrapper=new QueryWrapper(); |
| | | wrapper.eq("dev_id",devId); |
| | | wrapper.last("limit 1"); |
| | | DevInf dinf=devInfMapper.selectOne(wrapper); |
| | | DevLithiumInf dinf= devLithiumInfMapper.selectOne(wrapper); |
| | | String url="http://"+dinf.getDevIp()+":8080/webService/getTestParameter"; |
| | | ResultA200Dto dto= getA200Dto(url); |
| | | if(dto.getCode().equals("200")){ |
| | |
| | | QueryWrapper wrapper=new QueryWrapper(); |
| | | wrapper.eq("dev_id",param.getDevId()); |
| | | wrapper.last("limit 1"); |
| | | DevInf dinf=devInfMapper.selectOne(wrapper); |
| | | DevLithiumInf dinf= devLithiumInfMapper.selectOne(wrapper); |
| | | String url="http://"+dinf.getDevIp()+":8080/webService/setTestParameter"; |
| | | //将请求头部和参数合成一个请求 |
| | | MultiValueMap<String, Object> paramMap = new LinkedMultiValueMap<>(); |
| | |
| | | QueryWrapper wrapper=new QueryWrapper(); |
| | | wrapper.eq("dev_id",devId); |
| | | wrapper.last("limit 1"); |
| | | DevInf dinf=devInfMapper.selectOne(wrapper); |
| | | DevLithiumInf dinf= devLithiumInfMapper.selectOne(wrapper); |
| | | String url="http://"+dinf.getDevIp()+":8080/webService/startTest"; |
| | | //将请求头部和参数合成一个请求 |
| | | MultiValueMap<String, Object> paramMap = new LinkedMultiValueMap<>(); |
| | |
| | | QueryWrapper wrapper=new QueryWrapper(); |
| | | wrapper.eq("dev_id",devId); |
| | | wrapper.last("limit 1"); |
| | | DevInf dinf=devInfMapper.selectOne(wrapper); |
| | | DevLithiumInf dinf= devLithiumInfMapper.selectOne(wrapper); |
| | | String url="http://"+dinf.getDevIp()+":8080/webService/pauseTest"; |
| | | //将请求头部和参数合成一个请求 |
| | | MultiValueMap<String, Object> paramMap = new LinkedMultiValueMap<>(); |
| | |
| | | QueryWrapper wrapper=new QueryWrapper(); |
| | | wrapper.eq("dev_id",devId); |
| | | wrapper.last("limit 1"); |
| | | DevInf dinf=devInfMapper.selectOne(wrapper); |
| | | DevLithiumInf dinf= devLithiumInfMapper.selectOne(wrapper); |
| | | String url="http://"+dinf.getDevIp()+":8080/webService/stopTest"; |
| | | ResultA200Dto dto= getA200Dto(url); |
| | | return dto; |
| | |
| | | UpdateWrapper wrapper=new UpdateWrapper(); |
| | | wrapper.eq("dev_id",devId); |
| | | wrapper.set("batch_state",1); |
| | | devInfMapper.update(null,wrapper); |
| | | devLithiumInfMapper.update(null,wrapper); |
| | | map.put(devId,dto); |
| | | } |
| | | return new Response().setII(1,true,map,"批量控制a200一体机"); |
| | |
| | | UpdateWrapper wrapper=new UpdateWrapper(); |
| | | wrapper.eq("dev_id",devId); |
| | | wrapper.set("batch_state",1); |
| | | devInfMapper.update(null,wrapper); |
| | | devLithiumInfMapper.update(null,wrapper); |
| | | map.put(devId,dto); |
| | | } |
| | | return new Response().setII(1,true,map,"批量控制a200一体机"); |
| | |
| | | import com.whyc.dto.*; |
| | | import com.whyc.factory.ThreadPoolExecutorFactory; |
| | | import com.whyc.mapper.DevActmTestParamMapper; |
| | | import com.whyc.mapper.DevInfMapper; |
| | | import com.whyc.mapper.DevLithiumInfMapper; |
| | | import com.whyc.pojo.db_lithium_ram_db.DevActmTestParam; |
| | | import com.whyc.pojo.db_lithium_ram_db.DevInf; |
| | | import com.whyc.pojo.db_lithium_ram_db.DevLithiumInf; |
| | | import com.whyc.util.TestParamHttpUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | private DevActmTestParamMapper mapper; |
| | | |
| | | @Autowired(required = false) |
| | | private DevInfMapper devInfMapper; |
| | | private DevLithiumInfMapper devLithiumInfMapper; |
| | | |
| | | private final RestTemplate restTemplate; |
| | | |
| | |
| | | QueryWrapper wrapper=new QueryWrapper(); |
| | | wrapper.eq("dev_id",devId); |
| | | wrapper.last("limit 1"); |
| | | DevInf dinf=devInfMapper.selectOne(wrapper); |
| | | DevLithiumInf dinf= devLithiumInfMapper.selectOne(wrapper); |
| | | String url="http://"+dinf.getDevIp()+":8080/webService/getTestParameter"; |
| | | //将请求头部和参数合成一个请求 |
| | | MultiValueMap<String, Object> paramMap = new LinkedMultiValueMap<>(); |
| | |
| | | QueryWrapper wrapper=new QueryWrapper(); |
| | | wrapper.eq("dev_id",param.getDevId()); |
| | | wrapper.last("limit 1"); |
| | | DevInf dinf=devInfMapper.selectOne(wrapper); |
| | | DevLithiumInf dinf= devLithiumInfMapper.selectOne(wrapper); |
| | | String url="http://"+dinf.getDevIp()+":8080/webService/setTestParameter"; |
| | | //将请求头部和参数合成一个请求 |
| | | MultiValueMap<String, Object> paramMap = new LinkedMultiValueMap<>(); |
| | |
| | | QueryWrapper wrapper=new QueryWrapper(); |
| | | wrapper.eq("dev_id",devId); |
| | | wrapper.last("limit 1"); |
| | | DevInf dinf=devInfMapper.selectOne(wrapper); |
| | | DevLithiumInf dinf= devLithiumInfMapper.selectOne(wrapper); |
| | | String url="http://"+dinf.getDevIp()+":8080/webService"; |
| | | //将请求头部和参数合成一个请求 |
| | | MultiValueMap<String, Object> paramMap = new LinkedMultiValueMap<>(); |
| | |
| | | UpdateWrapper wrapper=new UpdateWrapper(); |
| | | wrapper.eq("dev_id",devId); |
| | | wrapper.set("batch_state",1); |
| | | devInfMapper.update(null,wrapper); |
| | | devLithiumInfMapper.update(null,wrapper); |
| | | } |
| | | map.put(devId,dto); |
| | | } |
| | |
| | | QueryWrapper wrapper=new QueryWrapper(); |
| | | wrapper.eq("dev_id",param.getDevId()); |
| | | wrapper.last("limit 1"); |
| | | DevInf dinf=devInfMapper.selectOne(wrapper); |
| | | DevLithiumInf dinf= devLithiumInfMapper.selectOne(wrapper); |
| | | String url="http://"+dinf.getDevIp()+":8080/webService/setBatteryStorageNumber"; |
| | | //将请求头部和参数合成一个请求 |
| | | MultiValueMap<String, Object> paramMap = new LinkedMultiValueMap<>(); |
File was renamed from src/main/java/com/whyc/service/DevAlarmDataService.java |
| | |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.github.pagehelper.PageInfo; |
| | | import com.whyc.constant.DevAlmEnum; |
| | | import com.whyc.dto.DalmDto; |
| | | import com.whyc.dto.DevA200AlarmDto; |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.mapper.DevAlarmDataMapper; |
| | | import com.whyc.pojo.db_alarm.DevAlarmData; |
| | | import com.whyc.mapper.DevLithiumAlarmDataMapper; |
| | | import com.whyc.pojo.db_alarm.DevLithiumAlarmData; |
| | | import com.whyc.pojo.db_user.UserInf; |
| | | import com.whyc.util.ActionUtil; |
| | | import com.whyc.util.SubTablePageInfoUtil; |
| | |
| | | import java.util.Map; |
| | | |
| | | @Service |
| | | public class DevAlarmDataService { |
| | | public class DevLithiumAlarmDataService { |
| | | |
| | | @Autowired(required = false) |
| | | private DevAlarmDataMapper mapper; |
| | | private DevLithiumAlarmDataMapper mapper; |
| | | |
| | | @Autowired(required = false) |
| | | private SubTablePageInfoUtil service; |
| | |
| | | private UserInfService uerInfService; |
| | | |
| | | //获取设备告警信息 |
| | | public Response getDevAlmInf(int uid, DalmDto dto) { |
| | | public Response getPage(int uid, DevA200AlarmDto dto) { |
| | | PageHelper.startPage(dto.getPageNum(),dto.getPageSize()); |
| | | dto.setUid(uid); |
| | | List<DevAlarmData> list=mapper.getDevAlmInf(dto); |
| | | for (DevAlarmData data:list) { |
| | | List<DevLithiumAlarmData> list=mapper.getDevAlmInf(dto); |
| | | for (DevLithiumAlarmData data:list) { |
| | | UserInf uinf=uerInfService.getUinfByUId(data.getConfirmedUid()); |
| | | data.setConfirmedUname(uinf!=null?uinf.getUname():""); |
| | | int almId=data.getAlmId(); |
| | | data.setAlmName(DevAlmEnum.getValue(almId)); |
| | | } |
| | | PageInfo pageInfo=new PageInfo(list); |
| | | return new Response().setII(1,list!=null,pageInfo,"获取设备告警信息"); |
| | | return new Response().setII(1,list!=null,pageInfo,null); |
| | | } |
| | | //获取历史告警 |
| | | public Response getDevAlmHis(DalmDto dto) throws ParseException { |
| | | public Response getPage(DevA200AlarmDto dto) throws ParseException { |
| | | UserInf uinf= ActionUtil.getUser(); |
| | | dto.setUid(uinf.getUid()); |
| | | if(dto.getStartTime()==null){ |
| | |
| | | } |
| | | PageInfo pageInfo=service.getPageInfo(dto.getPageNum(),dto.getPageSize(),dto.getStartTime(),dto.getEndTime() |
| | | ,"db_alarm", "tb_devalarm_data", dto); |
| | | return new Response().setII(1,pageInfo!=null,pageInfo,"获取设备告警信息"); |
| | | return new Response().setII(1,pageInfo!=null,pageInfo,null); |
| | | } |
| | | //确认实时告警 |
| | | public Response confirmAlm(int num) { |
| | | public Response confirm(int num) { |
| | | UserInf uinf= ActionUtil.getUser(); |
| | | UpdateWrapper wrapper=new UpdateWrapper(); |
| | | wrapper.set("alm_is_confirmed",1); |
| | | wrapper.set("confirmed_uid",uinf.getUid()); |
| | | wrapper.set("confirmed_time",new Date()); |
| | | wrapper.eq("num",num); |
| | | int flag=mapper.update((DevAlarmData) ActionUtil.objeNull,wrapper); |
| | | return new Response().set(1,flag>0,"确认实时告警"); |
| | | int flag=mapper.update((DevLithiumAlarmData) ActionUtil.objeNull,wrapper); |
| | | return new Response().set(1,flag>0,null); |
| | | } |
| | | //获取所有的告警类型 |
| | | public Response getAllAlmName() { |
| | | Map<Integer,String> map=DevAlmEnum.getOpInfo(); |
| | | return new Response().setII(1,true,map,"获取所有的告警类型"); |
| | | return new Response().setII(1,true,map,null); |
| | | } |
| | | //弹窗告警 |
| | | public Response getDevAlmPopUp(Integer uid) { |
| | | List<DevAlarmData> list=mapper.getDevAlmPopUp(uid); |
| | | for (DevAlarmData data:list) { |
| | | public Response getPopup(Integer uid) { |
| | | List<DevLithiumAlarmData> list=mapper.getPopup(uid); |
| | | for (DevLithiumAlarmData data:list) { |
| | | int almId=data.getAlmId(); |
| | | data.setAlmName(DevAlmEnum.getValue(almId)); |
| | | } |
| | | return new Response().setII(1,list!=null,list,"弹窗告警"); |
| | | return new Response().setII(1,list!=null,list,null); |
| | | } |
| | | } |
File was renamed from src/main/java/com/whyc/service/DevInfService.java |
| | |
| | | import com.whyc.mapper.A200RealStateMapper; |
| | | import com.whyc.mapper.ActmRealStateMapper; |
| | | import com.whyc.mapper.BattGroupBaojiGroupMapper; |
| | | import com.whyc.mapper.DevInfMapper; |
| | | import com.whyc.pojo.db_lithium_ram_db.A200Realstate; |
| | | import com.whyc.pojo.db_lithium_ram_db.ActmRealstate; |
| | | import com.whyc.pojo.db_lithium_ram_db.DevInf; |
| | | import com.whyc.mapper.DevLithiumInfMapper; |
| | | import com.whyc.pojo.db_lithium_ram_db.A200RealState; |
| | | import com.whyc.pojo.db_lithium_ram_db.ActmRealState; |
| | | import com.whyc.pojo.db_lithium_ram_db.DevLithiumInf; |
| | | import com.whyc.pojo.db_user.BattGroupBaojiGroup; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Service |
| | | public class DevInfService { |
| | | public class DevLithiumInfService { |
| | | @Autowired(required = false) |
| | | private DevInfMapper mapper; |
| | | private DevLithiumInfMapper mapper; |
| | | |
| | | @Autowired(required = false) |
| | | private A200RealStateMapper a200Mapper; |
| | |
| | | |
| | | //添加设备 |
| | | @Transactional |
| | | public Response addDev(DevInf devInf) { |
| | | public Response addDev(DevLithiumInf devInf) { |
| | | QueryWrapper wrapper=new QueryWrapper(); |
| | | //判断设备类型生成devId |
| | | int devId=getDevId(devInf.getDevType()); |
| | |
| | | Map<String, Object> allMap = new HashMap<>(); |
| | | PageHelper.startPage(devInfDto.getPageNum(), devInfDto.getPageSize()); |
| | | devInfDto.setUid(uid); |
| | | List<DevInf> listype=mapper.getAllInf(devInfDto); |
| | | List<DevLithiumInf> listype=mapper.getAllInf(devInfDto); |
| | | PageInfo pageInfo=new PageInfo(listype); |
| | | |
| | | List<DevInf> list=mapper.getLine(uid); |
| | | Map<Integer, List<DevInf>> typeDevMap = list.stream().collect(Collectors.groupingBy(DevInf::getDevType)); |
| | | Map<Integer, List<DevInf>> onlineDevMap = list.stream().collect(Collectors.groupingBy(DevInf::getDevOnline)); |
| | | List<DevLithiumInf> list=mapper.getLine(uid); |
| | | Map<Integer, List<DevLithiumInf>> typeDevMap = list.stream().collect(Collectors.groupingBy(DevLithiumInf::getDevType)); |
| | | Map<Integer, List<DevLithiumInf>> onlineDevMap = list.stream().collect(Collectors.groupingBy(DevLithiumInf::getDevOnline)); |
| | | Map<Integer, Object> typeMap = new HashMap<>(); |
| | | typeMap.put(1,0); |
| | | typeMap.put(2,0); |
| | |
| | | wrapper.eq("dev_type",devType); |
| | | } |
| | | wrapper.orderByAsc("dev_id"); |
| | | List<DevInf> list=mapper.selectList(wrapper); |
| | | List<DevLithiumInf> list=mapper.selectList(wrapper); |
| | | return new Response().setII(1,list!=null,list,"获取左侧列表"); |
| | | } |
| | | //获取左侧泪飙 |
| | | public Response getDevType(int uid) { |
| | | Map<String, Object> allMap = new HashMap<>(); |
| | | List<DevInf> a200List=mapper.getDevType(uid,1); |
| | | for (DevInf a200:a200List) { |
| | | List<DevLithiumInf> a200List=mapper.getDevType(uid,1); |
| | | for (DevLithiumInf a200:a200List) { |
| | | QueryWrapper a200wrapper= Wrappers.query(); |
| | | a200wrapper.eq("dev_id",a200.getDevId()); |
| | | a200wrapper.last("limit 1"); |
| | | A200Realstate a200state=a200Mapper.selectOne(a200wrapper); |
| | | A200RealState a200state=a200Mapper.selectOne(a200wrapper); |
| | | //a200.setA200sTate(a200state); |
| | | a200.setState(a200state!=null?a200state:null); |
| | | } |
| | | List<DevInf> actmList=mapper.getDevType(uid,2); |
| | | for (DevInf actm:actmList) { |
| | | List<DevLithiumInf> actmList=mapper.getDevType(uid,2); |
| | | for (DevLithiumInf actm:actmList) { |
| | | QueryWrapper actmwrapper= Wrappers.query(); |
| | | actmwrapper.eq("dev_id",actm.getDevId()); |
| | | List<ActmRealstate> actmstates=actmMapper.selectList(actmwrapper); |
| | | List<ActmRealState> actmstates=actmMapper.selectList(actmwrapper); |
| | | //actm.setActmsTate(actmstate); |
| | | actm.setActmstates(actmstates!=null?actmstates:null); |
| | | } |
| | |
| | | return new Response().setII(1,allMap.size()>0,allMap,"获取左侧列表"); |
| | | } |
| | | //编辑设备信息 |
| | | public Response updateInf(DevInf dinf) { |
| | | public Response updateInf(DevLithiumInf dinf) { |
| | | //编辑设备就重置加载 |
| | | dinf.setReloadEn(1); |
| | | UpdateWrapper wrapper=new UpdateWrapper(); |
| | |
| | | public Response getDevInf() { |
| | | QueryWrapper wrapper=new QueryWrapper(); |
| | | wrapper.orderByAsc("dev_id"); |
| | | List<DevInf> list=mapper.selectList(wrapper); |
| | | List<DevLithiumInf> list=mapper.selectList(wrapper); |
| | | return new Response().setII(1,list!=null,list,"获取设备信息(不分页用于包机组)"); |
| | | } |
| | | |
| | |
| | | QueryWrapper wrapper=new QueryWrapper(); |
| | | wrapper.eq("dev_id",devId); |
| | | wrapper.last("limit 1"); |
| | | DevInf dinf=mapper.selectOne(wrapper); |
| | | DevLithiumInf dinf=mapper.selectOne(wrapper); |
| | | return new Response().setII(1,dinf!=null,dinf,"根据设备id获取设备信息"); |
| | | } |
| | | //删除设备(同时删除实时和包机组信息) |
| | |
| | | Map<String,Object> typestateMap=new HashMap<>(); |
| | | typestateMap.put("a200",a200staticStateMap); |
| | | typestateMap.put("actm",actmstaticStateMap); |
| | | List<DevInf> list=mapper.getDevStaticByType(userId); |
| | | Map<Integer, List<DevInf>> typeMap = list.stream().collect(Collectors.groupingBy(DevInf::getDevType)); |
| | | List<DevLithiumInf> list=mapper.getDevStaticByType(userId); |
| | | Map<Integer, List<DevLithiumInf>> typeMap = list.stream().collect(Collectors.groupingBy(DevLithiumInf::getDevType)); |
| | | for (Integer type : typeMap.keySet()) { |
| | | staticTypeMap.put(type, typeMap.get(type).size()); |
| | | List<DevInf> typeList= typeMap.get(type); |
| | | Map<Integer, List<DevInf>> stateMap = typeList.stream().collect(Collectors.groupingBy(DevInf::getDevOnline)); |
| | | List<DevLithiumInf> typeList= typeMap.get(type); |
| | | Map<Integer, List<DevLithiumInf>> stateMap = typeList.stream().collect(Collectors.groupingBy(DevLithiumInf::getDevOnline)); |
| | | if(type==1){ |
| | | for (Integer state : stateMap.keySet()) { |
| | | a200staticStateMap.put(state, stateMap.get(state).size()); |
| | |
| | | } |
| | | |
| | | //根据devId获取设备信息 |
| | | public DevInf getDinfByDevId(int devId){ |
| | | public DevLithiumInf getDinfByDevId(int devId){ |
| | | QueryWrapper wrapper=new QueryWrapper(); |
| | | wrapper.eq("dev_id",devId); |
| | | wrapper.last("limit 1"); |
| | | DevInf dinf=mapper.selectOne(wrapper); |
| | | DevLithiumInf dinf=mapper.selectOne(wrapper); |
| | | return dinf; |
| | | } |
| | | |
| | |
| | | package com.whyc.service; |
| | | |
| | | import com.whyc.dto.DalmDto; |
| | | import com.whyc.dto.DevA200AlarmDto; |
| | | import com.whyc.mapper.CallBack; |
| | | import com.whyc.pojo.db_alarm.DevAlarmDataYear; |
| | | import com.whyc.pojo.db_alarm.DevLithiumAlarmDataYear; |
| | | import com.whyc.pojo.db_batt_testdata.BattTestDataId; |
| | | import com.whyc.util.ThreadLocalUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | return list; |
| | | } |
| | | //查询DevAlm历史告警数量 |
| | | public int getCountForDevAlm(DalmDto dto) { |
| | | public int getCountForDevAlm(DevA200AlarmDto dto) { |
| | | String sql="select count(distinct num) as number from db_alarm." +dto.getTableName() |
| | | +" where 1=1 "; |
| | | |
| | |
| | | return num; |
| | | } |
| | | //查询devalm历史告警 |
| | | public List getListDevAlm(DalmDto dto){ |
| | | public List getListDevAlm(DevA200AlarmDto dto){ |
| | | String sql="select * from db_alarm." +dto.getTableName() |
| | | +" where 1=1 "; |
| | | |
| | |
| | | List list = sqlExecuteService.executeQuery_call(sql, new CallBack() { |
| | | @Override |
| | | public List getResults(ResultSet rs) throws SQLException { |
| | | List<DevAlarmDataYear> list=new ArrayList<>(); |
| | | List<DevLithiumAlarmDataYear> list=new ArrayList<>(); |
| | | while (rs.next()){ |
| | | DevAlarmDataYear dataYear=new DevAlarmDataYear(); |
| | | DevLithiumAlarmDataYear dataYear=new DevLithiumAlarmDataYear(); |
| | | dataYear.setNum(rs.getInt("num")); |
| | | dataYear.setDevId(rs.getInt("dev_id")); |
| | | dataYear.setAlmId(rs.getInt("alm_id")); |
copy from src/main/java/com/whyc/webSocket/DevInfSocket.java
copy to src/main/java/com/whyc/webSocket/DevLithiumAlarmSocket.java
File was copied from src/main/java/com/whyc/webSocket/DevInfSocket.java |
| | |
| | | package com.whyc.webSocket; |
| | | |
| | | import com.whyc.config.WebSocketConfig; |
| | | import com.whyc.dto.DevInfDto; |
| | | import com.whyc.dto.DevA200AlarmDto; |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.pojo.db_user.UserInf; |
| | | import com.whyc.service.DevInfService; |
| | | import com.whyc.service.DevLithiumAlarmDataService; |
| | | import com.whyc.util.ActionUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | |
| | | * 设备实时连接信息 |
| | | */ |
| | | @Component |
| | | @ServerEndpoint(value = "/dinfSocket",encoders = WebSocketEncoder.class,configurator = WebSocketConfig.class) |
| | | public class DevInfSocket { |
| | | @ServerEndpoint(value = "/devLithiumAlarm",encoders = WebSocketEncoder.class,configurator = WebSocketConfig.class) |
| | | public class DevLithiumAlarmSocket { |
| | | private Session session; |
| | | |
| | | private Thread thread; |
| | | |
| | | private static DevInfService dinfService; |
| | | private static DevLithiumAlarmDataService service; |
| | | |
| | | private HttpSession httpSession; |
| | | |
| | |
| | | private volatile Map<Long,Boolean> threadFlagMap = new HashMap<>(); |
| | | |
| | | @Autowired |
| | | public void setDevInfService(DevInfService dinfService) { |
| | | DevInfSocket.dinfService = dinfService; |
| | | public void setService(DevLithiumAlarmDataService service) { |
| | | DevLithiumAlarmSocket.service = service; |
| | | } |
| | | |
| | | @OnOpen |
| | |
| | | } |
| | | @OnMessage |
| | | public void onMessage(Session session, String message) { |
| | | DevInfDto devInfDto = ActionUtil.getGson("yyyy-MM-dd").fromJson(message, DevInfDto.class); |
| | | DevA200AlarmDto dto = ActionUtil.getGson("yyyy-MM-dd HH:mm:ss").fromJson(message, DevA200AlarmDto.class); |
| | | UserInf user = (UserInf) this.httpSession.getAttribute("user"); |
| | | final int userId = user.getUid(); |
| | | //final int userId = 101; |
| | | thread = new Thread("Thread_DinfSocket") { |
| | | thread = new Thread("Thread_DevLithiumAlarmSocket") { |
| | | @Override |
| | | public void run() { |
| | | while (runFlag && !isInterrupted()) { |
| | | Thread thread = currentThread(); |
| | | threadFlagMap.put(thread.getId(), true); |
| | | try { |
| | | Response res=dinfService.getAllInf(userId, devInfDto); |
| | | Response res=service.getPage(userId, dto); |
| | | if (session.isOpen()) { |
| | | //推送信息 |
| | | synchronized (session) { |
copy from src/main/java/com/whyc/webSocket/DevLineSocket.java
copy to src/main/java/com/whyc/webSocket/DevLithiumAlmPopupSocket.java
File was copied from src/main/java/com/whyc/webSocket/DevLineSocket.java |
| | |
| | | import com.whyc.config.WebSocketConfig; |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.pojo.db_user.UserInf; |
| | | import com.whyc.service.DevInfService; |
| | | import com.whyc.service.DevLithiumAlarmDataService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | |
| | | import java.io.IOException; |
| | | |
| | | /** |
| | | * 左侧列表 |
| | | * 锂电设备告警弹窗 |
| | | */ |
| | | @Component |
| | | @ServerEndpoint(value = "/lineSocket",encoders = WebSocketEncoder.class,configurator = WebSocketConfig.class) |
| | | public class DevLineSocket{ |
| | | @ServerEndpoint(value = "/devLithiumAlmPopup",encoders = WebSocketEncoder.class,configurator = WebSocketConfig.class) |
| | | public class DevLithiumAlmPopupSocket { |
| | | |
| | | private Session session; |
| | | |
| | | private Thread thread; |
| | | private static DevInfService dinfService; |
| | | private static DevLithiumAlarmDataService devLithiumAlarmDataService; |
| | | |
| | | private HttpSession httpSession; |
| | | |
| | | @Autowired |
| | | public void setDevInfService(DevInfService dinfService) { |
| | | DevLineSocket.dinfService = dinfService; |
| | | public void setDevLithiumAlarmDataService(DevLithiumAlarmDataService devLithiumAlarmDataService) { |
| | | DevLithiumAlmPopupSocket.devLithiumAlarmDataService = devLithiumAlarmDataService; |
| | | } |
| | | |
| | | @OnOpen |
| | |
| | | UserInf user = (UserInf) this.httpSession.getAttribute("user"); |
| | | final int userId = user.getUid(); |
| | | //final int userId = 101; |
| | | Thread thread = new Thread() { |
| | | Thread thread = new Thread("Thread_DevLithiumAlmPopupSocket") { |
| | | @Override |
| | | public void run() { |
| | | try { |
| | | while (!currentThread().isInterrupted()) { |
| | | Response res = dinfService.getDevType(userId); |
| | | Response res = devLithiumAlarmDataService.getPopup(userId); |
| | | session.getBasicRemote().sendObject(res); |
| | | sleep(4000); |
| | | } |
File was renamed from src/main/java/com/whyc/webSocket/DevInfSocket.java |
| | |
| | | import com.whyc.dto.DevInfDto; |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.pojo.db_user.UserInf; |
| | | import com.whyc.service.DevInfService; |
| | | import com.whyc.service.DevLithiumInfService; |
| | | import com.whyc.util.ActionUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | |
| | | |
| | | |
| | | /** |
| | | * 设备实时连接信息 |
| | | * 锂电设备实时连接信息 |
| | | */ |
| | | @Component |
| | | @ServerEndpoint(value = "/dinfSocket",encoders = WebSocketEncoder.class,configurator = WebSocketConfig.class) |
| | | public class DevInfSocket { |
| | | @ServerEndpoint(value = "/devLithiumInf",encoders = WebSocketEncoder.class,configurator = WebSocketConfig.class) |
| | | public class DevLithiumInfSocket { |
| | | private Session session; |
| | | |
| | | private Thread thread; |
| | | |
| | | private static DevInfService dinfService; |
| | | private static DevLithiumInfService service; |
| | | |
| | | private HttpSession httpSession; |
| | | |
| | |
| | | private volatile Map<Long,Boolean> threadFlagMap = new HashMap<>(); |
| | | |
| | | @Autowired |
| | | public void setDevInfService(DevInfService dinfService) { |
| | | DevInfSocket.dinfService = dinfService; |
| | | public void setService(DevLithiumInfService service) { |
| | | DevLithiumInfSocket.service = service; |
| | | } |
| | | |
| | | @OnOpen |
| | |
| | | UserInf user = (UserInf) this.httpSession.getAttribute("user"); |
| | | final int userId = user.getUid(); |
| | | //final int userId = 101; |
| | | thread = new Thread("Thread_DinfSocket") { |
| | | thread = new Thread("Thread_DevLithiumInfSocket") { |
| | | @Override |
| | | public void run() { |
| | | while (runFlag && !isInterrupted()) { |
| | | Thread thread = currentThread(); |
| | | threadFlagMap.put(thread.getId(), true); |
| | | try { |
| | | Response res=dinfService.getAllInf(userId, devInfDto); |
| | | Response res=service.getAllInf(userId, devInfDto); |
| | | if (session.isOpen()) { |
| | | //推送信息 |
| | | synchronized (session) { |
File was renamed from src/main/java/com/whyc/webSocket/DevLineSocket.java |
| | |
| | | import com.whyc.config.WebSocketConfig; |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.pojo.db_user.UserInf; |
| | | import com.whyc.service.DevInfService; |
| | | import com.whyc.service.DevLithiumInfService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | |
| | | * 左侧列表 |
| | | */ |
| | | @Component |
| | | @ServerEndpoint(value = "/lineSocket",encoders = WebSocketEncoder.class,configurator = WebSocketConfig.class) |
| | | public class DevLineSocket{ |
| | | @ServerEndpoint(value = "/devLithiumLine",encoders = WebSocketEncoder.class,configurator = WebSocketConfig.class) |
| | | public class DevLithiumLineSocket { |
| | | |
| | | private Session session; |
| | | |
| | | private Thread thread; |
| | | private static DevInfService dinfService; |
| | | private static DevLithiumInfService service; |
| | | |
| | | private HttpSession httpSession; |
| | | |
| | | @Autowired |
| | | public void setDevInfService(DevInfService dinfService) { |
| | | DevLineSocket.dinfService = dinfService; |
| | | public void setService(DevLithiumInfService service) { |
| | | DevLithiumLineSocket.service = service; |
| | | } |
| | | |
| | | @OnOpen |
| | |
| | | public void run() { |
| | | try { |
| | | while (!currentThread().isInterrupted()) { |
| | | Response res = dinfService.getDevType(userId); |
| | | Response res = service.getDevType(userId); |
| | | session.getBasicRemote().sendObject(res); |
| | | sleep(4000); |
| | | } |
File was renamed from src/main/java/com/whyc/webSocket/DevRtStateSocket.java |
| | |
| | | |
| | | |
| | | /** |
| | | * 设备实时连接信息 |
| | | * 锂电设备实时连接信息 |
| | | */ |
| | | @Component |
| | | @ServerEndpoint(value = "/rtstateSocket",encoders = WebSocketEncoder.class,configurator = WebSocketConfig.class) |
| | | public class DevRtStateSocket { |
| | | @ServerEndpoint(value = "/DevLithiumRtState",encoders = WebSocketEncoder.class,configurator = WebSocketConfig.class) |
| | | public class DevLithiumRtStateSocket { |
| | | private Session session; |
| | | |
| | | private Thread thread; |
| | | |
| | | private static BattRtDataService rtdataService; |
| | | private static BattRtDataService battRtDataService; |
| | | |
| | | private static A200RealStateService a200Service; |
| | | private static A200RealStateService a200RtStateService; |
| | | |
| | | private static ActmRealStateService actmService; |
| | | private static ActmRealStateService actmRtStateService; |
| | | |
| | | private static WorkStateChangeEventService eventService; |
| | | |
| | |
| | | private volatile Map<Long,Boolean> threadFlagMap = new HashMap<>(); |
| | | |
| | | @Autowired |
| | | public void setBattRtdataService(BattRtDataService rtdataService) { |
| | | DevRtStateSocket.rtdataService = rtdataService; |
| | | public void setBattRtDataService(BattRtDataService battRtDataService) { |
| | | DevLithiumRtStateSocket.battRtDataService = battRtDataService; |
| | | } |
| | | |
| | | @Autowired |
| | | public void setA200RealstateService(A200RealStateService a200Service) { |
| | | DevRtStateSocket.a200Service = a200Service; |
| | | public void setA200RealStateService(A200RealStateService a200RtStateService) { |
| | | DevLithiumRtStateSocket.a200RtStateService = a200RtStateService; |
| | | } |
| | | |
| | | @Autowired |
| | | public void setActmRealstateService(ActmRealStateService actmService) { |
| | | DevRtStateSocket.actmService = actmService; |
| | | public void setActmRealStateService(ActmRealStateService actmRtStateService) { |
| | | DevLithiumRtStateSocket.actmRtStateService = actmRtStateService; |
| | | } |
| | | |
| | | @Autowired |
| | | public void setWorkstateChangeeventService(WorkStateChangeEventService eventService) { |
| | | DevRtStateSocket.eventService = eventService; |
| | | public void setWorkStateChangeEventService(WorkStateChangeEventService eventService) { |
| | | DevLithiumRtStateSocket.eventService = eventService; |
| | | } |
| | | |
| | | @OnOpen |
| | |
| | | @OnMessage |
| | | public void onMessage(Session session, String message) { |
| | | RtStateDto dto= ActionUtil.getGson().fromJson(message, RtStateDto.class); |
| | | thread = new Thread("Thread_RtstateSocket") { |
| | | thread = new Thread("DevLithiumRtStateSocket") { |
| | | @Override |
| | | public void run() { |
| | | while (runFlag && !isInterrupted()) { |
| | |
| | | //均衡仪Actm实时数据 |
| | | private Response getActmState(int devId) { |
| | | Map<String, Response> map = new HashMap<>(); |
| | | Response resActmState=actmService.getActmState(devId); |
| | | Response rtdataState0=rtdataService.getActmRtdataState(devId,0); |
| | | Response rtdataState1=rtdataService.getActmRtdataState(devId,1); |
| | | Response resActmState=actmRtStateService.getActmState(devId); |
| | | Response rtDataState0=battRtDataService.getActmRtdataState(devId,0); |
| | | Response rtDataState1=battRtDataService.getActmRtdataState(devId,1); |
| | | Response event=eventService.getWorkEvent(devId); |
| | | map.put("resActmState",resActmState); |
| | | map.put("rtdataState0",rtdataState0); |
| | | map.put("rtdataState1",rtdataState1); |
| | | map.put("rtDataState0",rtDataState0); |
| | | map.put("rtDataState1",rtDataState1); |
| | | map.put("event",event); |
| | | return new Response().setII(1,true,map,"均衡仪Actm实时数据"); |
| | | } |
| | |
| | | //一体机A200实时数据 |
| | | private Response getA200State(int devId) { |
| | | Map<String, Response> map = new HashMap<>(); |
| | | Response resA200State=a200Service.getA200State(devId); |
| | | Response rtdataState=rtdataService.getA200RtdataState(devId); |
| | | Response resA200State=a200RtStateService.getA200State(devId); |
| | | Response rtDataState=battRtDataService.getA200RtdataState(devId); |
| | | Response event=eventService.getWorkEvent(devId); |
| | | map.put("resA200State",resA200State); |
| | | map.put("rtdataState",rtdataState); |
| | | map.put("rtDataState",rtDataState); |
| | | map.put("event",event); |
| | | return new Response().setII(1,true,map,"一体机A200实时数据"); |
| | | } |
File was renamed from src/main/java/com/whyc/webSocket/DevStaticSocket.java |
| | |
| | | import com.whyc.factory.ThreadPoolExecutorFactory; |
| | | import com.whyc.pojo.db_user.UserInf; |
| | | import com.whyc.service.BattTestDataInfService; |
| | | import com.whyc.service.DevInfService; |
| | | import com.whyc.service.DevLithiumInfService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | |
| | | * 左侧列表 |
| | | */ |
| | | @Component |
| | | @ServerEndpoint(value = "/staticSocket",encoders = WebSocketEncoder.class,configurator = WebSocketConfig.class) |
| | | public class DevStaticSocket{ |
| | | @ServerEndpoint(value = "/devLithiumStatistic",encoders = WebSocketEncoder.class,configurator = WebSocketConfig.class) |
| | | public class DevLithiumStatisticSocket { |
| | | |
| | | private Session session; |
| | | |
| | | private Thread thread; |
| | | |
| | | private static DevInfService dinfService; |
| | | private static DevLithiumInfService devLithiumInfService; |
| | | |
| | | private static BattTestDataInfService tinfService; |
| | | private static BattTestDataInfService battTestDataInfService; |
| | | |
| | | |
| | | private HttpSession httpSession; |
| | | |
| | | @Autowired |
| | | public void setDevInfService(DevInfService dinfService) { |
| | | DevStaticSocket.dinfService = dinfService; |
| | | public void setDevLithiumInfService(DevLithiumInfService devLithiumInfService) { |
| | | DevLithiumStatisticSocket.devLithiumInfService = devLithiumInfService; |
| | | } |
| | | |
| | | @Autowired |
| | | public void setBatttestdataInfService(BattTestDataInfService tinfService) { |
| | | DevStaticSocket.tinfService = tinfService; |
| | | public void setBattTestDataInfService(BattTestDataInfService battTestDataInfService) { |
| | | DevLithiumStatisticSocket.battTestDataInfService = battTestDataInfService; |
| | | } |
| | | |
| | | |
| | |
| | | public void run() { |
| | | try { |
| | | while (!currentThread().isInterrupted()) { |
| | | Response res = getDevStatic(userId); |
| | | Response res = getStatistics(userId); |
| | | session.getBasicRemote().sendObject(res); |
| | | sleep(4000); |
| | | } |
| | |
| | | this.thread = thread; |
| | | } |
| | | //获取统计信息 |
| | | private Response getDevStatic(int userId) { |
| | | private Response getStatistics(int userId) { |
| | | Map<String,Object> map=new HashMap<>(); |
| | | try { |
| | | ThreadPoolExecutor poolExecutor = ThreadPoolExecutorFactory.getPoolExecutor(); |
| | | CountDownLatch latch = new CountDownLatch(3); |
| | | //充放电一体机测试统计/锂电均衡仪测试统计 |
| | | poolExecutor.execute(() -> { |
| | | Map<String,Object> devTinfMap=tinfService.getDevTinfByYearMonth(userId); |
| | | map.put("devTinf",devTinfMap); |
| | | Map<String,Object> lithiumTestInfMap = battTestDataInfService.getDevTinfByYearMonth(userId); |
| | | map.put("lithiumTestInf",lithiumTestInfMap); |
| | | latch.countDown(); |
| | | }); |
| | | //设备分类总数统计/设备状态统计/地图信息 |
| | | poolExecutor.execute(() -> { |
| | | Map<String,Object> devSaticMap=dinfService.getDevStaticByType(userId); |
| | | map.put("devSatic",devSaticMap); |
| | | Map<String,Object> devSaticMap=devLithiumInfService.getDevStaticByType(userId); |
| | | map.put("devLithiumStatistics",devSaticMap); |
| | | latch.countDown(); |
| | | }); |
| | | //近一周电池测试趋势统计(从当前时间开始) |
| | | poolExecutor.execute(() -> { |
| | | Map<String,Object> devTestByWeekMap=tinfService.getDevTinfByWeek(userId); |
| | | map.put("devTestByWeek",devTestByWeekMap); |
| | | Map<String,Object> devTestByWeekMap=battTestDataInfService.getDevTinfByWeek(userId); |
| | | map.put("devLithiumTestByWeek",devTestByWeekMap); |
| | | latch.countDown(); |
| | | }); |
| | | latch.await(10, TimeUnit.MINUTES); |
| | |
| | | <collection property="usrList" javaType="java.util.ArrayList" ofType="com.whyc.pojo.db_user.UserInf" column="{baojiGroupId=baoji_group_id}" |
| | | select="selectUsrList"> |
| | | </collection> |
| | | <collection property="devList" javaType="java.util.ArrayList" ofType="com.whyc.pojo.db_lithium_ram_db.DevInf" column="{baojiGroupId=baoji_group_id}" |
| | | <collection property="devList" javaType="java.util.ArrayList" ofType="com.whyc.pojo.db_lithium_ram_db.DevLithiumInf" column="{baojiGroupId=baoji_group_id}" |
| | | select="selectDevList"> |
| | | </collection> |
| | | </resultMap> |
| | |
| | | order by uid asc |
| | | </select> |
| | | |
| | | <select id="selectDevList" resultType="devInf"> |
| | | <select id="selectDevList" resultType="DevLithiumInf"> |
| | | select * from db_lithium_ram_db.tb_dev_inf |
| | | <where> |
| | | dev_id in ( |
File was renamed from src/main/resources/mapper/DevAlarmDataMapper.xml |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.whyc.mapper.DevAlarmDataMapper"> |
| | | <resultMap type="com.whyc.pojo.db_alarm.DevAlarmData" id="almDev"> |
| | | <mapper namespace="com.whyc.mapper.DevLithiumAlarmDataMapper"> |
| | | <resultMap type="com.whyc.pojo.db_alarm.DevLithiumAlarmData" id="almDev"> |
| | | <id column="num" property="num"/> |
| | | <result column="dev_id" property="devId"/> |
| | | <result column="alm_id" property="almId"/> |
| | |
| | | <result column="alm_endtime" property="almEndtime"/> |
| | | <result column="alm_cleared_type" property="almClearedType"/> |
| | | <!-- 它是用于指定从表方的引用实体属性的 --> |
| | | <association property="devInf" javaType="devInf" |
| | | <association property="devInf" javaType="DevLithiumInf" |
| | | select="selectDinf" |
| | | column="dev_id"> |
| | | </association> |
| | |
| | | order by alm_starttime desc |
| | | </where> |
| | | </select> |
| | | <select id="selectDinf" resultType="devInf" parameterType="int" > |
| | | <select id="selectDinf" resultType="DevLithiumInf" parameterType="int" > |
| | | select * from db_lithium_ram_db.tb_dev_inf where dev_id = #{dev_id} |
| | | </select> |
| | | <select id="getDevAlmPopUp" resultMap="almDev"> |
| | | <select id="getPopup" resultMap="almDev"> |
| | | select * from db_alarm.tb_devalarm_data |
| | | <where> |
| | | alm_is_confirmed=0 |
File was renamed from src/main/resources/mapper/DevInfMapper.xml |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.whyc.mapper.DevInfMapper"> |
| | | <mapper namespace="com.whyc.mapper.DevLithiumInfMapper"> |
| | | |
| | | <select id="getAllInf" resultType="com.whyc.pojo.db_lithium_ram_db.DevInf"> |
| | | <select id="getAllInf" resultType="com.whyc.pojo.db_lithium_ram_db.DevLithiumInf"> |
| | | select * from db_lithium_ram_db.tb_dev_inf |
| | | <where> |
| | | dev_type=#{dto.devType} |
| | |
| | | </where> |
| | | limit 1 |
| | | </select> |
| | | <select id="getLine" resultType="com.whyc.pojo.db_lithium_ram_db.DevInf"> |
| | | <select id="getLine" resultType="com.whyc.pojo.db_lithium_ram_db.DevLithiumInf"> |
| | | select * from db_lithium_ram_db.tb_dev_inf |
| | | <where> |
| | | dev_id in ( |
| | |
| | | </where> |
| | | </select> |
| | | |
| | | <select id="getDevType" resultType="com.whyc.pojo.db_lithium_ram_db.DevInf"> |
| | | <select id="getDevType" resultType="com.whyc.pojo.db_lithium_ram_db.DevLithiumInf"> |
| | | select * from db_lithium_ram_db.tb_dev_inf |
| | | <where> |
| | | dev_type=#{devType} |
| | |
| | | ) |
| | | </where> |
| | | </select> |
| | | <select id="getDevStaticByType" resultType="com.whyc.pojo.db_lithium_ram_db.DevInf"> |
| | | <select id="getDevStaticByType" resultType="com.whyc.pojo.db_lithium_ram_db.DevLithiumInf"> |
| | | select * from db_lithium_ram_db.tb_dev_inf |
| | | <where> |
| | | dev_id in ( |