| | |
| | | package com.whyc.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.Wrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.github.pagehelper.PageInfo; |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.mapper.BattAlarmParamMapper; |
| | | import com.whyc.pojo.db_param.BattalarmParam; |
| | | import com.whyc.pojo.db_param.BattAlarmParam; |
| | | import com.whyc.util.ActionUtil; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | //查询电池优劣好坏的标准 |
| | | public Response serchQuality() { |
| | | //0.查询劣化(告警)和损坏(更换)的阈值 |
| | | QueryWrapper<BattalarmParam> alarmWrapper = new QueryWrapper(); |
| | | QueryWrapper<BattAlarmParam> alarmWrapper = new QueryWrapper(); |
| | | alarmWrapper.and(wrapper -> { |
| | | return wrapper.eq("alm_name", "Batt_Alarm_Type_CapAlarm").or().eq("alm_name", "Batt_Alarm_Type_CapChange"); |
| | | }); |
| | | alarmWrapper.orderByAsc("alm_id"); |
| | | List<BattalarmParam> paramList = mapper.selectList(alarmWrapper); |
| | | List<BattAlarmParam> paramList = mapper.selectList(alarmWrapper); |
| | | float capAlarm = 0f; |
| | | float capChange = 0f; |
| | | if (paramList != null && paramList.size() > 0) { |
| | |
| | | |
| | | //告警参数设置 |
| | | @Transactional |
| | | public Response setBattParam(List<BattalarmParam> list) { |
| | | public Response setBattParam(List<BattAlarmParam> list) { |
| | | if (list != null && list.size() > 0) { |
| | | for (BattalarmParam p : list) { |
| | | for (BattAlarmParam p : list) { |
| | | UpdateWrapper wrapper = new UpdateWrapper(); |
| | | wrapper.set("alm_low_coe", p.getAlmLowCoe()); |
| | | wrapper.eq("alm_id", p.getAlmId()); |
| | | mapper.update((BattalarmParam) ActionUtil.objeNull, wrapper); |
| | | mapper.update((BattAlarmParam) ActionUtil.objeNull, wrapper); |
| | | } |
| | | } |
| | | return new Response().set(1, true); |
| | | } |
| | | |
| | | public List<BattAlarmParam> getList() { |
| | | QueryWrapper<BattAlarmParam> query = Wrappers.query(); |
| | | query.orderByAsc("num"); |
| | | return mapper.selectList(query); |
| | | } |
| | | |
| | | public Response updateByNum(BattAlarmParam param) { |
| | | mapper.updateById(param); |
| | | return new Response().setII(1,"修改完成"); |
| | | } |
| | | |
| | | public BattAlarmParam getTempAlarmParam() { |
| | | QueryWrapper<BattAlarmParam> query = Wrappers.query(); |
| | | query.eq("alm_id", 119006); |
| | | query.last(" limit 1"); |
| | | return mapper.selectOne(query); |
| | | } |
| | | } |