From 9e428b3f4a90df003848d28aca5f358c7b6ef969 Mon Sep 17 00:00:00 2001 From: whyclxw <810412026@qq.com> Date: 星期三, 25 六月 2025 14:43:58 +0800 Subject: [PATCH] 蓄电池对比分析中弹窗根据设置的权重表格评分 --- src/main/java/com/whyc/service/BattInfService.java | 118 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 115 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/whyc/service/BattInfService.java b/src/main/java/com/whyc/service/BattInfService.java index 975e334..ddaa507 100644 --- a/src/main/java/com/whyc/service/BattInfService.java +++ b/src/main/java/com/whyc/service/BattInfService.java @@ -4,17 +4,19 @@ import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; +import com.whyc.constant.BattCapperformanceEnum; import com.whyc.dto.BattDto; import com.whyc.dto.InfoDto; +import com.whyc.dto.Param.ParamAlmDto; import com.whyc.dto.Real.QuarterDto; import com.whyc.dto.Response; +import com.whyc.dto.SocreHehaviorDto; +import com.whyc.dto.Statistic.*; import com.whyc.factory.InfoFactory; import com.whyc.mapper.BattInfMapper; import com.whyc.mapper.PowerInfMapper; import com.whyc.mapper.StationInfMapper; -import com.whyc.pojo.db_station.BattInf; -import com.whyc.pojo.db_station.PowerInf; -import com.whyc.pojo.db_station.StationInf; +import com.whyc.pojo.db_station.*; import com.whyc.pojo.db_user.User; import com.whyc.util.ActionUtil; import org.springframework.beans.factory.annotation.Autowired; @@ -24,6 +26,7 @@ import java.util.ArrayList; import java.util.Date; import java.util.List; +import java.util.Map; @Service public class BattInfService { @@ -38,6 +41,9 @@ @Autowired(required = false) private BaojigroupService bjService; + + @Autowired(required = false) + private InfoChangeService changeService; /*鏂板缓鐢垫睜缁勶紙鏂扮殑璁惧鏂扮殑鐢垫睜缁勶級 * @param binf @@ -199,6 +205,9 @@ if(sinf.getLatitude()!=null){ wrapper1.set("latitude",sinf.getLatitude()); } + if(sinf.getNodeStation()!=null){ + wrapper1.set("node_station",sinf.getNodeStation()); + } wrapper1.eq("station_id",sinf.getStationId()); //鍐嶄慨鏀圭數婧愪俊鎭� @@ -217,6 +226,12 @@ } if(pinf.getPowerType()!=null){ wrapper2.set("power_type",pinf.getPowerType()); + } + if(pinf.getPowerInuseTime()!=null){ + wrapper2.set("power_inuse_time",pinf.getPowerInuseTime()); + } + if(pinf.getModelCfg()!=null){ + wrapper2.set("model_cfg",pinf.getModelCfg()); } /*if(pinf.getPowerName()!=null){ //妫�娴嬭鏈烘埧涓嬭淇敼鐨勭數婧愬悕鏄惁瀛樺湪 @@ -288,12 +303,20 @@ if (binf.getBattModel() != null) { wrapper4.set("batt_model", binf.getBattModel()); } + if (binf.getInuseTime() != null) { + wrapper4.set("inuse_time", binf.getInuseTime()); + } wrapper4.eq("battgroup_id", binf.getBattgroupId()); mapper.update((BattInf) ActionUtil.objeNull,wrapper3); mapper.update((BattInf) ActionUtil.objeNull,wrapper4); } sinfMapper.update((StationInf) ActionUtil.objeNull,wrapper1); pinfMapper.update((PowerInf) ActionUtil.objeNull,wrapper2); + //瀛樺叆鍙樻洿淇℃伅璁板綍 + pinf.setStationId(sinf.getStationId()); + binf.setStationId(sinf.getStationId()); + binf.setPowerId(pinf.getPowerId()); + changeService.addInfoChange(sinf,pinf,binf,info.getUpdateReason()); return new Response().set(1,true,"淇敼淇℃伅鎴愬姛"); } /*//淇敼鐢垫睜缁� @@ -385,6 +408,8 @@ wrapper.eq("battgroup_id",battgroupId); wrapper.last("limit 1"); BattInf binf=mapper.selectOne(wrapper); + List<BattInfChange> binfChangeList=changeService.getBinfChange(battgroupId); + binf.setBinfChangeList(binfChangeList); return binf; } //褰撴病鏈夊唴鍔╂祴璇曟椂鍒濆鍐呴樆鍊间负鏍囩О鍐呴樆 @@ -403,4 +428,91 @@ } return list; } + + //璁惧淇℃伅缁熻 + public Response getDevStatistic(StationStic stic) { + PageHelper.startPage(stic.getPageNum(),stic.getPageSize()); + List<BattInf> list=mapper.getDevStatistic(stic); + for (BattInf binf:list) { + //鑾峰彇璁惧涓嬬數姹犵粍涓暟 + int battCount=mapper.getBattCountBydevId(binf.getDevId()); + binf.setBattCount(battCount); + } + PageInfo<BattInf> pageInfo=new PageInfo<>(list); + return new Response().setII(1,list.size()>0,pageInfo,"璁惧淇℃伅缁熻"); + } + //钃勭數姹犵粍淇℃伅缁熻 + public Response getBattStatistic(StationStic stic) { + PageHelper.startPage(stic.getPageNum(),stic.getPageSize()); + List<BattInf> list=mapper.getBattStatistic(stic); + PageInfo<BattInf> pageInfo=new PageInfo<>(list); + return new Response().setII(1,list.size()>0,pageInfo,"钃勭數姹犵粍淇℃伅缁熻"); + } + //鍗曚綋缁熻鏌ヨ绗﹀悎鏉′欢鐨勭數姹犵粍 + public List<BattInf> getMonStatistic(MonStic stic) { + return mapper.getMonStatistic(stic); + } + //钃勭數姹犵粍瀵规瘮鍒嗘瀽鐣岄潰15 + public List<BattInf> getBattCompare15Statistic(BattCompareStic stic) { + return mapper.getBattCompare15Statistic(stic); + } + //鑾峰彇瀹归噺鎬ц兘(涓嬫媺) + public Response getCapperformance() { + Map<Integer,String> map= BattCapperformanceEnum.getOpInfo(); + return new Response().setII(1,true,map,"鑾峰彇瀹归噺鎬ц兘(涓嬫媺)"); + } + //钃勭數姹犵粍瀵规瘮鍒嗘瀽鐣岄潰16 + public List<BattInf> getBattCompare16Statistic(BattCompareStic stic) { + return mapper.getBattCompare16Statistic(stic); + } + //钃勭數姹犵粍瀵规瘮鍒嗘瀽鐣岄潰17 + public List<BattInf> getBattCompare17Statistic(BattCompareStic stic) { + return mapper.getBattCompare17Statistic(stic); + } + //鏈勾搴﹀凡鏀剧數鏁伴噺缁熻(1.2.5) + public List<BattInf> getDischr5Statistic(DisChargeStic stic) { + return mapper.getDischr5Statistic(stic); + } + //鏈勾搴﹀凡鏀剧數鏁伴噺缁熻(1.2.6) + public List<BattInf> getDischr6Statistic(DisChargeStic stic) { + return mapper.getDischr6Statistic(stic); + } + //鐢垫睜缁勭數姹犳�ц兘缁熻锛堟湭鏀剧數锛屼紭绉�锛屽姡鍖栵紝鎹熷潖锛夌粺璁�(1.2.8/9/10) + public List<BattInf> getPerformanceStatistic(PerformanceStic stic) { + return mapper.getPerformanceStatistic(stic); + } + //鏈勾搴﹀凡/鏈斁鐢垫暟閲忕粺璁″彸渚у浘琛�(1.2.5) + public List<BattInf> getDischrChart(Integer uid) { + return mapper.getDischrChart(uid); + } + + public List<BattInf> getListByUserId(Integer userId) { + return mapper.getListByUserId(userId); + } + + public List<BattInf> getListByCondition(Integer userId, BattInf battInf) { + return mapper.getListByCondition(userId, battInf); + } + + //鑾峰彇绔欑偣涓嬬殑鐢垫睜缁�(涓嬫媺) + public Response getBattByUid(Integer uid, String provice, String city, String country, String stationName) { + List<BattInf> list=mapper.getBattByUid(uid,provice,city,country,stationName); + return new Response().setII(1,list.size()>0,list,"鑾峰彇绔欑偣涓嬬殑鐢垫睜缁�(涓嬫媺)"); + } + //鏍规嵁鏌ヨ鏉′欢鑾峰彇鐢垫睜缁� + public BattInf getBattgroupIdInf(Integer battgroupId) { + return mapper.getBattgroupIdInf(battgroupId); + } + //鏌ヨ鐢垫簮涓嬫墍鏈夌殑鐢垫睜缁刬d + public List<BattInf> getBattgroupIdListByPowerId(Integer powerId) { + return mapper.getBattgroupIdListByPowerId(powerId); + } + //鏌ヨ璁惧涓嬫墍鏈夌殑鐢垫睜缁刬d + public List<BattInf> getBattgroupIdListByDevId(Integer devId) { + return mapper.getBattgroupIdListByDevId(devId); + } + //璇㈢鍚堟潯浠剁殑鐢垫睜缁勬潈閲嶈〃鏍艰瘎鍒� + public List<BattInf> getScoreByHehavior(SocreHehaviorDto dto) { + return mapper.getScoreByHehavior(dto); + } } \ No newline at end of file -- Gitblit v1.9.1