| | |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.github.pagehelper.PageInfo; |
| | | import com.whyc.dto.BattState; |
| | | import com.whyc.dto.BattMaintDealarm; |
| | | import com.whyc.dto.BattTestData; |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.mapper.BattRtstateMapper; |
| | | import com.whyc.pojo.BattRtstate; |
| | | import com.whyc.pojo.Battinf; |
| | | import com.whyc.pojo.UserInf; |
| | | import com.whyc.util.ActionUtil; |
| | | import com.whyc.util.MessageUtils; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | |
| | | private BattRtstateMapper battRtstateMapper; |
| | | |
| | | /** |
| | | * @param bmd binf.battGroupId、binf.num、binf.stationname.binf、stationname1、uinf.uId、page |
| | | * @param binf binf.battGroupId、binf.num、binf.stationname.binf、stationname1 |
| | | * uId |
| | | * 落后单体查询:根据条件查询落后单体 |
| | | * @return |
| | | */ |
| | | public Response<List<BattState>> searchBattLife(BattMaintDealarm bmd) { |
| | | |
| | | //分页信息 |
| | | PageHelper.startPage(bmd.getPage().getPageCurr(), bmd.getPage().getPageSize()); |
| | | List<BattState> list = battRtstateMapper.searchBattLife(bmd); |
| | | PageInfo<BattState> pageInfo = new PageInfo<BattState>(list); |
| | | if (list != null && list.size() > 0) { |
| | | // System.out.println("list = " + list); |
| | | return new Response<List<BattState>>().set(1, list, String.valueOf(pageInfo.getTotal())); |
| | | } else { |
| | | return new Response<List<BattState>>().set(0, null, String.valueOf(pageInfo.getTotal())); |
| | | public Response searchBattLife(int pageNum, int pageSize, Battinf binf) { |
| | | PageHelper.startPage(pageNum, pageSize); |
| | | UserInf userInf = ActionUtil.getUser(); |
| | | String lang = ActionUtil.getLang(); |
| | | List<BattState> list = battRtstateMapper.searchBattLife(binf, userInf.getUId().intValue()); |
| | | for (BattState bs : list) { |
| | | Battinf battinf = bs.getBinf(); |
| | | battinf.setStationName9(MessageUtils.getMessageSocket(BattTestData.battState(battinf.getNum()), lang)); |
| | | } |
| | | PageInfo<BattState> pageInfo = new PageInfo<>(list); |
| | | return new Response().set(1, pageInfo, "查询成功"); |
| | | } |
| | | |
| | | //查询实时组端信息 |
| | | public Response serchByCondition(int battGroupId) { |
| | | PageHelper.startPage(1,1); |
| | | QueryWrapper wrapper=new QueryWrapper(); |
| | | wrapper.eq("BattGroupId",battGroupId); |
| | | BattRtstate brt=battRtstateMapper.selectOne(wrapper); |
| | | return new Response().set(1,brt); |
| | | @Transactional |
| | | public Response<BattRtstate> serchByCondition(int battGroupId) { |
| | | QueryWrapper wrapper = new QueryWrapper(); |
| | | wrapper.eq("BattGroupId", battGroupId); |
| | | wrapper.last(" limit 1"); |
| | | BattRtstate brt = battRtstateMapper.selectOne(wrapper); |
| | | return new Response().setII(1, brt == null ? false : true, brt, ""); |
| | | } |
| | | |
| | | //9140设备要将2组电池的组端信息都给他 |
| | | public Response serch9140Info(int devId) { |
| | | List<BattRtstate> list = battRtstateMapper.serch9140Info(devId); |
| | | return new Response().setII(1, list.size() > 0 ? true : false, list, "9140数据"); |
| | | } |
| | | |
| | | //3D查询机房下电池组端信息 |
| | | public Response getStation3D(String stationId) { |
| | | List<BattRtstate> list = battRtstateMapper.getStation3D(stationId); |
| | | PageInfo pageInfo = new PageInfo(list); |
| | | return new Response().setII(1, list.size() > 0 ? true : false, pageInfo, ""); |
| | | } |
| | | |
| | | |
| | | } |