Commit 6c49815c authored by 李秀明's avatar 李秀明

fix: BUG#23962 站端设备平台v5>消防自动化>消防资源>消防设施>消防装备,左下角装备定义的数量的查询接口查询出的数据,和设备卡片的数据不一致

parent 121d2911
......@@ -537,10 +537,10 @@ public class FireFightingSystemController extends AbstractBaseController {
}
}
if (flag == 0) {
String classificationCode = equipTypeAmountPage.getEquipmentClassificationCode().replaceAll("0+$", "");
String classificationCode = equipTypeAmountPage.getEquipmentClassificationCode().replaceAll("0+$", "").trim();
return fireFightingSystemService.getColaCategoryAmountEquList(inhierarchy, classificationCode, equipTypeAmountPage);
} else {
String classificationCode = equipTypeAmountPage.getEquipmentClassificationCode().replaceAll("0+$", "");
String classificationCode = equipTypeAmountPage.getEquipmentClassificationCode().replaceAll("0+$", "").trim();
return fireFightingSystemService.getColaCategoryAmountEquList(inhierarchy, classificationCode.length() % 2 == 0 ? classificationCode : classificationCode + "0", equipTypeAmountPage);
}
// return fireFightingSystemService.getColaCategoryAmountEquList(inhierarchy, equipTypeAmountPage.getEquipmentClassificationCode(), equipTypeAmountPage);
......
......@@ -12,7 +12,7 @@ public interface ISourceStatistics {
* @param categoryCode 资源分类code
* @return int 数量
*/
int equipCategoryStatistics(String bizOrgCode, SourceTypeEnum sourceType, String categoryCode);
int equipCategoryStatistics(String bizOrgCode, SourceTypeEnum sourceType, String categoryCode, boolean isRoot);
/**
* 初始化所有有分类数据(装备、车辆),bizOrgCode + "_" + sourceType.getCode() + "_" + categoryCode
......
......@@ -1350,7 +1350,7 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
List<EquipmentCategory> list = new ArrayList<>();
Map<String, List<EquipmentCategory>> tmpMap = new HashMap<String, List<EquipmentCategory>>();
equipmentCategorys.forEach(action -> {
int num = sourceStatistics.equipCategoryStatistics(bizOrgCode, sourceTypeEnum, action.getCode());
int num = sourceStatistics.equipCategoryStatistics(bizOrgCode, sourceTypeEnum, action.getCode(), Objects.isNull(action.getParentId()));
action.setCount(Double.parseDouble(num + ""));
if (action.getParentId() == null) {
list.add(action);
......
......@@ -23,12 +23,14 @@ public class SourcesStatisticsImpl implements ISourceStatistics {
@Override
public int equipCategoryStatistics(String bizOrgCode, SourceTypeEnum sourceType, String categoryCode) {
public int equipCategoryStatistics(String bizOrgCode, SourceTypeEnum sourceType, String categoryCode, boolean isRoot) {
// 计算处通用code,用来上下级匹配如12001010000->1200101
String treeCode = subStringZero(categoryCode);
treeCode = treeCode.length() % 2 == 0 ? treeCode : treeCode + "0";
if (!isRoot && treeCode.length() % 2 != 0) {
treeCode = treeCode + "0";
}
Set<String> keys = redisUtil.getKeys(buildPattenKey(bizOrgCode, sourceType.getCode(), treeCode));
if (keys.size() > 0) {
if (!keys.isEmpty()) {
//求和
return this.sumNumber(keys);
} else {
......
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment