| | |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.github.pagehelper.PageInfo; |
| | | import com.whyc.constant.BattAlarmIdEnum; |
| | | import com.whyc.dto.Param.ParamAlmDto; |
| | | import com.whyc.dto.Real.AlmDto; |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.mapper.BattAlmparamMapper; |
| | | import com.whyc.pojo.db_param.BattAlmparam; |
| | | import com.whyc.pojo.db_station.BattInf; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Service |
| | | public class BattAlmparamService { |
| | | @Autowired(required = false) |
| | | private BattAlmparamMapper mapper; |
| | | |
| | | @Autowired(required = false) |
| | | private BattInfService binfService; |
| | | //获取电池告警参数 |
| | | public Response getBattAlmParam(Integer battgroupId) { |
| | | public Response getBattAlmParam(ParamAlmDto dto) { |
| | | //根据查询条件获取电池组集合 |
| | | BattInf binf=binfService.getBattgroupIdList(dto.getBattgroupId()); |
| | | QueryWrapper wrapper=new QueryWrapper(); |
| | | wrapper.eq("battgroup_id",battgroupId); |
| | | wrapper.eq("battgroup_id",dto.getBattgroupId()); |
| | | if(dto.getAlmIdList()!=null){ |
| | | wrapper.in("alm_id",dto.getAlmIdList()); |
| | | } |
| | | wrapper.orderByAsc("alm_id"); |
| | | //PageHelper.startPage(dto.getPageNum(),dto.getPageSize()); |
| | | List<BattAlmparam> list = mapper.selectList(wrapper); |
| | | //PageInfo<BattAlmparam> pageInfo=new PageInfo<>(list); |
| | | return new Response().setIII(1,list!=null,list,binf,"获取电池告警参数"); |
| | | } |
| | | //获取电池告警参数(无参用于导出) |
| | | public Response getBattAlmParamToExport(Integer uid) { |
| | | //获取所有的电池组id |
| | | List<BattAlmparam> list = mapper.getBattAlmParamToExport(uid); |
| | | return new Response().setII(1,list!=null,list,"获取电池告警参数"); |
| | | } |
| | | //修改电池告警参数 |
| | |
| | | return new Response().set(1,true,"修改电池告警参数"); |
| | | } |
| | | |
| | | |
| | | //查询当前电池组当前单体电压或者单体内阻低于其单体电压的下下限或高于上上限判定当前电池组劣化 |
| | | public List<BattAlmparam> getAlmParamVolAndRes(Integer battgroupId) { |
| | | QueryWrapper wrapper=new QueryWrapper(); |
| | | wrapper.eq("battgroup_id",battgroupId); |
| | | wrapper.in("alm_id", Arrays.asList(BattAlarmIdEnum.ALARM_119005, BattAlarmIdEnum.ALARM_119007)); |
| | | wrapper.orderByAsc("alm_id"); |
| | | List<BattAlmparam> list = mapper.selectList(wrapper); |
| | | return list; |
| | | } |
| | | } |