diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/equipment/domain/DeptConfigRateSummary.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/equipment/domain/DeptConfigRateSummary.java index a621d0b..a9c27c6 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/equipment/domain/DeptConfigRateSummary.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/equipment/domain/DeptConfigRateSummary.java @@ -33,4 +33,6 @@ public class DeptConfigRateSummary extends BaseEntity { private BigDecimal configRate; private BigDecimal orderCount; private BigDecimal FullScore; + + private String typeId; } diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/equipment/domain/NewOwnerdomin.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/equipment/domain/NewOwnerdomin.java index 23c1ce9..b076f41 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/equipment/domain/NewOwnerdomin.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/equipment/domain/NewOwnerdomin.java @@ -11,6 +11,7 @@ public class NewOwnerdomin { private String companyName; // 公司名称 private Integer maNum; // 数量 private String configType; + private String typeId; private BigDecimal fullScore; private BigDecimal baseNum; private BigDecimal orderCount; diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/equipment/service/impl/SysDeptServiceImpl.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/equipment/service/impl/SysDeptServiceImpl.java index 73739d6..325ce05 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/equipment/service/impl/SysDeptServiceImpl.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/equipment/service/impl/SysDeptServiceImpl.java @@ -89,12 +89,12 @@ public class SysDeptServiceImpl implements ISysDeptService { /*从自己配置的自有、外租表里面进行遍历 目的是放到对应的键里面去*/ for (Ownerdomin device : ownListFromManage) { - String key = device.getCompanyId() + "_" + device.getMaName(); + String key = device.getCompanyId() + "_" + device.getMaNameId(); ownIndex.computeIfAbsent(key, k -> new ArrayList<>()).add(device); } /*去ma_dev_info装置配置表里面获取可有重复装备的数据*/ for (NewOwnerdomin dev : ownListFromDevInfo) { - String key = dev.getCompanyId() + "_" + dev.getMaName(); + String key = dev.getCompanyId() + "_" + dev.getTypeId(); List existList = ownIndex.get(key); if (existList != null && !existList.isEmpty()) { for (Ownerdomin device : existList) { @@ -124,10 +124,11 @@ public class SysDeptServiceImpl implements ISysDeptService { String company = config.getCompanyName(); String type = config.getConfigType().toPlainString(); // 0:线路 1:电缆 2:变电 String maName = config.getDeptName(); + String typeId = config.getTypeId(); BigDecimal orderCount = config.getOrderCount(); Long configCompanyId = config.getCompanyId(); - String key = configCompanyId + "_" + maName; + String key = configCompanyId + "_" + typeId; List sameCompanyDevices = ownIndex.getOrDefault(key, Collections.emptyList()); BigDecimal score = computeScoreByMaName(orderCount, sameCompanyDevices, config,type); BigDecimal newscore = null; @@ -179,7 +180,7 @@ public class SysDeptServiceImpl implements ISysDeptService { // 5.x:补充未出现在 configList 的公司/设备项 Set configKeys = configList.stream() - .map(c -> c.getCompanyId() + "_" + c.getDeptName()) + .map(c -> c.getCompanyId() + "_" + c.getTypeId()) .collect(Collectors.toSet()); for (Map.Entry> entry : ownIndex.entrySet()) { @@ -361,13 +362,13 @@ public class SysDeptServiceImpl implements ISysDeptService { // 3. 建立原有设备索引,key = companyId + "_" + name Map indexMap = new LinkedHashMap<>(); for (EquipmentDetail item : equipmentDetails) { - String key = item.getCompanyId() + "_" + item.getName(); + String key = item.getCompanyId() + "_" + item.getTypeId(); indexMap.put(key, item); } // 4. 遍历 devInfoList,合并到 equipmentDetails for (NewmydevInfo devItem : devInfoList) { - String key = devItem.getCompanyId() + "_" + devItem.getTypeName(); + String key = devItem.getCompanyId() + "_" + devItem.getTypeId() ; EquipmentDetail existing = indexMap.get(key); if (existing != null) { diff --git a/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/equipment/SysDeptMapper.xml b/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/equipment/SysDeptMapper.xml index 1b5191f..afed426 100644 --- a/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/equipment/SysDeptMapper.xml +++ b/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/equipment/SysDeptMapper.xml @@ -105,6 +105,7 @@ resultType="com.bonus.material.equipment.domain.DeptConfigRateSummary"> SELECT my.type_name AS deptName, + my.type_id AS typeId, sd.dept_name AS companyName, grouped.dept_id AS companyId, grouped.config_type AS configType, diff --git a/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/owner/OwnerMapper.xml b/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/owner/OwnerMapper.xml index 8dfd95c..6ce3417 100644 --- a/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/owner/OwnerMapper.xml +++ b/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/owner/OwnerMapper.xml @@ -65,6 +65,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" md.own_co AS companyId, sd.dept_name as companyName, mt2.type_name AS maName, + mt2.type_id as typeId, COUNT(*) AS maNum FROM ma_dev_info md