diff --git a/src/main/java/com/hivekion/baseData/mapper/FightpowerstaffMapper.java b/src/main/java/com/hivekion/baseData/mapper/FightpowerstaffMapper.java index 8a036de..82ed3a1 100644 --- a/src/main/java/com/hivekion/baseData/mapper/FightpowerstaffMapper.java +++ b/src/main/java/com/hivekion/baseData/mapper/FightpowerstaffMapper.java @@ -2,6 +2,7 @@ package com.hivekion.baseData.mapper; import com.hivekion.baseData.entity.Fightpowerstaff; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import java.util.List; /** *

@@ -12,5 +13,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; * @since 2025-08-07 */ public interface FightpowerstaffMapper extends BaseMapper { - + List queryByOrgIds(List ids); } diff --git a/src/main/java/com/hivekion/baseData/service/FightpowerstaffService.java b/src/main/java/com/hivekion/baseData/service/FightpowerstaffService.java index 9dec0ed..6836223 100644 --- a/src/main/java/com/hivekion/baseData/service/FightpowerstaffService.java +++ b/src/main/java/com/hivekion/baseData/service/FightpowerstaffService.java @@ -14,4 +14,5 @@ import java.util.List; */ public interface FightpowerstaffService extends IService { List queryListByOrgId(Integer orgId); + List queryByOrgIds(List ids); } diff --git a/src/main/java/com/hivekion/baseData/service/impl/FightpowerstaffServiceImpl.java b/src/main/java/com/hivekion/baseData/service/impl/FightpowerstaffServiceImpl.java index aab299d..681ed37 100644 --- a/src/main/java/com/hivekion/baseData/service/impl/FightpowerstaffServiceImpl.java +++ b/src/main/java/com/hivekion/baseData/service/impl/FightpowerstaffServiceImpl.java @@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.hivekion.baseData.entity.Fightpowerstaff; import com.hivekion.baseData.mapper.FightpowerstaffMapper; import com.hivekion.baseData.service.FightpowerstaffService; +import java.util.Collections; import java.util.List; import org.springframework.stereotype.Service; @@ -27,4 +28,9 @@ public class FightpowerstaffServiceImpl extends queryWrapper.eq("parent_id", orgId); return this.list(queryWrapper); } + + @Override + public List queryByOrgIds(List ids) { + return this.baseMapper.queryByOrgIds(ids); + } } diff --git a/src/main/java/com/hivekion/statistic/service/impl/StatisticServiceImpl.java b/src/main/java/com/hivekion/statistic/service/impl/StatisticServiceImpl.java index 9570c48..f296fbf 100644 --- a/src/main/java/com/hivekion/statistic/service/impl/StatisticServiceImpl.java +++ b/src/main/java/com/hivekion/statistic/service/impl/StatisticServiceImpl.java @@ -1,6 +1,8 @@ package com.hivekion.statistic.service.impl; +import com.hivekion.baseData.entity.Fightpowerstaff; import com.hivekion.baseData.entity.OrgSupplier; +import com.hivekion.baseData.service.FightpowerstaffService; import com.hivekion.baseData.service.OrgSupplierService; import com.hivekion.scenario.entity.ScenarioOrgPost; import com.hivekion.scenario.entity.ScenarioResource; @@ -38,6 +40,8 @@ public class StatisticServiceImpl implements StatisticService { private SuppliesDictService suppliesDictService; @Resource private IScenarioOrgPostService scenarioOrgPostService; + @Resource + private FightpowerstaffService fightpowerstaffService; @Override public StatisticBean statistic(String resourceId) { StatisticBean statisticBean = new StatisticBean(); @@ -58,16 +62,21 @@ public class StatisticServiceImpl implements StatisticService { List orgList = orgPostList.stream().map(ScenarioOrgPost::getOrgId) .collect(Collectors.toList()); //获取人员信息 - + List staffList = fightpowerstaffService.queryByOrgIds(orgList); + int sum = staffList.stream() + .mapToInt(Fightpowerstaff::getNumber) + .sum(); + statisticBean.getPerson().setCurrent(sum); + statisticBean.getPerson().setTotal(sum); //获取物资信息 List suppliers = orgSupplierService.selectByOrgIds(orgList); - log.info("suppliers size::{}",suppliers.size()); + Map supplierMap = suppliesDictService.supplierDictMap(); - log.info("supplierMap::{}",supplierMap); + suppliers.forEach(supplier -> { - log.info("supplier:{},{}",supplier,supplier.getId()); + SuppliesDict dict = supplierMap.get(supplier.getSupplierId()); - log.info("dict:{}",dict); + if (dict != null) { switch (dict.getCode()) { case "FOOD": diff --git a/src/main/java/com/hivekion/ws/WsServer.java b/src/main/java/com/hivekion/ws/WsServer.java index ae05bcb..9739497 100644 --- a/src/main/java/com/hivekion/ws/WsServer.java +++ b/src/main/java/com/hivekion/ws/WsServer.java @@ -61,7 +61,9 @@ public class WsServer { } try{ - session.getBasicRemote().sendText(testWeatherJson()); + session.getBasicRemote().sendText(testWeatherJson("start_rain")); + Thread.sleep(10000); + session.getBasicRemote().sendText(testWeatherJson("start_snow")); }catch (Exception e){ log.error("error::",e); } @@ -130,9 +132,9 @@ public class WsServer { } } } - private String testWeatherJson(){ + private String testWeatherJson(String tag){ ResponseCmdInfo responseCmdInfo = new ResponseCmdInfo(); - responseCmdInfo.setCmdType("66-raining"); + responseCmdInfo.setCmdType(tag); responseCmdInfo.setRoom("123"); responseCmdInfo.setScenarioId(2746); Map data = new HashMap<>(); diff --git a/src/main/resources/mapper/tbl/FightpowerstaffMapper.xml b/src/main/resources/mapper/tbl/FightpowerstaffMapper.xml index e6c7d77..6d6b815 100644 --- a/src/main/resources/mapper/tbl/FightpowerstaffMapper.xml +++ b/src/main/resources/mapper/tbl/FightpowerstaffMapper.xml @@ -1,5 +1,10 @@ - +