装备管理 youhua

This commit is contained in:
lizhenhua 2025-07-10 18:41:40 +08:00
parent 9af0b8e332
commit e4d2e7abf8
5 changed files with 12 additions and 6 deletions

View File

@ -33,4 +33,6 @@ public class DeptConfigRateSummary extends BaseEntity {
private BigDecimal configRate; private BigDecimal configRate;
private BigDecimal orderCount; private BigDecimal orderCount;
private BigDecimal FullScore; private BigDecimal FullScore;
private String typeId;
} }

View File

@ -11,6 +11,7 @@ public class NewOwnerdomin {
private String companyName; // 公司名称 private String companyName; // 公司名称
private Integer maNum; // 数量 private Integer maNum; // 数量
private String configType; private String configType;
private String typeId;
private BigDecimal fullScore; private BigDecimal fullScore;
private BigDecimal baseNum; private BigDecimal baseNum;
private BigDecimal orderCount; private BigDecimal orderCount;

View File

@ -89,12 +89,12 @@ public class SysDeptServiceImpl implements ISysDeptService {
/*从自己配置的自有、外租表里面进行遍历 目的是放到对应的键里面去*/ /*从自己配置的自有、外租表里面进行遍历 目的是放到对应的键里面去*/
for (Ownerdomin device : ownListFromManage) { for (Ownerdomin device : ownListFromManage) {
String key = device.getCompanyId() + "_" + device.getMaName(); String key = device.getCompanyId() + "_" + device.getMaNameId();
ownIndex.computeIfAbsent(key, k -> new ArrayList<>()).add(device); ownIndex.computeIfAbsent(key, k -> new ArrayList<>()).add(device);
} }
/*去ma_dev_info装置配置表里面获取可有重复装备的数据*/ /*去ma_dev_info装置配置表里面获取可有重复装备的数据*/
for (NewOwnerdomin dev : ownListFromDevInfo) { for (NewOwnerdomin dev : ownListFromDevInfo) {
String key = dev.getCompanyId() + "_" + dev.getMaName(); String key = dev.getCompanyId() + "_" + dev.getTypeId();
List<Ownerdomin> existList = ownIndex.get(key); List<Ownerdomin> existList = ownIndex.get(key);
if (existList != null && !existList.isEmpty()) { if (existList != null && !existList.isEmpty()) {
for (Ownerdomin device : existList) { for (Ownerdomin device : existList) {
@ -124,10 +124,11 @@ public class SysDeptServiceImpl implements ISysDeptService {
String company = config.getCompanyName(); String company = config.getCompanyName();
String type = config.getConfigType().toPlainString(); // 0:线路 1:电缆 2:变电 String type = config.getConfigType().toPlainString(); // 0:线路 1:电缆 2:变电
String maName = config.getDeptName(); String maName = config.getDeptName();
String typeId = config.getTypeId();
BigDecimal orderCount = config.getOrderCount(); BigDecimal orderCount = config.getOrderCount();
Long configCompanyId = config.getCompanyId(); Long configCompanyId = config.getCompanyId();
String key = configCompanyId + "_" + maName; String key = configCompanyId + "_" + typeId;
List<Ownerdomin> sameCompanyDevices = ownIndex.getOrDefault(key, Collections.emptyList()); List<Ownerdomin> sameCompanyDevices = ownIndex.getOrDefault(key, Collections.emptyList());
BigDecimal score = computeScoreByMaName(orderCount, sameCompanyDevices, config,type); BigDecimal score = computeScoreByMaName(orderCount, sameCompanyDevices, config,type);
BigDecimal newscore = null; BigDecimal newscore = null;
@ -179,7 +180,7 @@ public class SysDeptServiceImpl implements ISysDeptService {
// 5.x补充未出现在 configList 的公司/设备项 // 5.x补充未出现在 configList 的公司/设备项
Set<String> configKeys = configList.stream() Set<String> configKeys = configList.stream()
.map(c -> c.getCompanyId() + "_" + c.getDeptName()) .map(c -> c.getCompanyId() + "_" + c.getTypeId())
.collect(Collectors.toSet()); .collect(Collectors.toSet());
for (Map.Entry<String, List<Ownerdomin>> entry : ownIndex.entrySet()) { for (Map.Entry<String, List<Ownerdomin>> entry : ownIndex.entrySet()) {
@ -361,13 +362,13 @@ public class SysDeptServiceImpl implements ISysDeptService {
// 3. 建立原有设备索引key = companyId + "_" + name // 3. 建立原有设备索引key = companyId + "_" + name
Map<String, EquipmentDetail> indexMap = new LinkedHashMap<>(); Map<String, EquipmentDetail> indexMap = new LinkedHashMap<>();
for (EquipmentDetail item : equipmentDetails) { for (EquipmentDetail item : equipmentDetails) {
String key = item.getCompanyId() + "_" + item.getName(); String key = item.getCompanyId() + "_" + item.getTypeId();
indexMap.put(key, item); indexMap.put(key, item);
} }
// 4. 遍历 devInfoList合并到 equipmentDetails // 4. 遍历 devInfoList合并到 equipmentDetails
for (NewmydevInfo devItem : devInfoList) { for (NewmydevInfo devItem : devInfoList) {
String key = devItem.getCompanyId() + "_" + devItem.getTypeName(); String key = devItem.getCompanyId() + "_" + devItem.getTypeId() ;
EquipmentDetail existing = indexMap.get(key); EquipmentDetail existing = indexMap.get(key);
if (existing != null) { if (existing != null) {

View File

@ -105,6 +105,7 @@
resultType="com.bonus.material.equipment.domain.DeptConfigRateSummary"> resultType="com.bonus.material.equipment.domain.DeptConfigRateSummary">
SELECT SELECT
my.type_name AS deptName, my.type_name AS deptName,
my.type_id AS typeId,
sd.dept_name AS companyName, sd.dept_name AS companyName,
grouped.dept_id AS companyId, grouped.dept_id AS companyId,
grouped.config_type AS configType, grouped.config_type AS configType,

View File

@ -65,6 +65,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
md.own_co AS companyId, md.own_co AS companyId,
sd.dept_name as companyName, sd.dept_name as companyName,
mt2.type_name AS maName, mt2.type_name AS maName,
mt2.type_id as typeId,
COUNT(*) AS maNum COUNT(*) AS maNum
FROM FROM
ma_dev_info md ma_dev_info md