From e50d8c30b43dd30daa77da27101ce21d8ef2fcef Mon Sep 17 00:00:00 2001 From: whycxzp <glperry@163.com> Date: 星期一, 17 三月 2025 17:20:10 +0800 Subject: [PATCH] 锂电设备相关代码更新 --- src/main/java/com/whyc/service/DevLithiumInfService.java | 54 +++++++++++++++++++++++++++--------------------------- 1 files changed, 27 insertions(+), 27 deletions(-) diff --git a/src/main/java/com/whyc/service/DevInfService.java b/src/main/java/com/whyc/service/DevLithiumInfService.java similarity index 82% rename from src/main/java/com/whyc/service/DevInfService.java rename to src/main/java/com/whyc/service/DevLithiumInfService.java index 4065eb9..cd9f02c 100644 --- a/src/main/java/com/whyc/service/DevInfService.java +++ b/src/main/java/com/whyc/service/DevLithiumInfService.java @@ -10,10 +10,10 @@ 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; @@ -23,9 +23,9 @@ 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; @@ -38,7 +38,7 @@ //娣诲姞璁惧 @Transactional - public Response addDev(DevInf devInf) { + public Response addDev(DevLithiumInf devInf) { QueryWrapper wrapper=new QueryWrapper(); //鍒ゆ柇璁惧绫诲瀷鐢熸垚devId int devId=getDevId(devInf.getDevType()); @@ -78,12 +78,12 @@ 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); @@ -112,26 +112,26 @@ 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); } @@ -140,7 +140,7 @@ 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(); @@ -152,7 +152,7 @@ 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,"鑾峰彇璁惧淇℃伅(涓嶅垎椤电敤浜庡寘鏈虹粍)"); } @@ -161,7 +161,7 @@ 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鑾峰彇璁惧淇℃伅"); } //鍒犻櫎璁惧(鍚屾椂鍒犻櫎瀹炴椂鍜屽寘鏈虹粍淇℃伅) @@ -214,12 +214,12 @@ 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()); @@ -240,11 +240,11 @@ } //鏍规嵁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; } -- Gitblit v1.9.1