|
|
@ -204,17 +204,17 @@ public class TechnicalClassBean { |
|
|
//设置唯一键和版本 |
|
|
//设置唯一键和版本 |
|
|
String technicalSpecNo = technicalMap.get("TECHNICAL_SPEC_NO"); |
|
|
String technicalSpecNo = technicalMap.get("TECHNICAL_SPEC_NO"); |
|
|
String technicalClass = inData.getTechnicalClass(); |
|
|
String technicalClass = inData.getTechnicalClass(); |
|
|
|
|
|
//打印日志 |
|
|
|
|
|
//查询当前技术等级下的所有属性的数据 |
|
|
|
|
|
List<Map<String, String>> resultList = TechnicalClassApi.getTechnicalAttributesMap(srv, technicalSpecNo, technicalClass); |
|
|
|
|
|
//打印日志 |
|
|
|
|
|
logger.info("Technical Class Attributes 最终批量修改:"+JSON.toJSONString(resultList)); |
|
|
|
|
|
logger.info("Technical Class Attributes 最终批量数量:"+JSON.toJSONString(resultList.size())); |
|
|
|
|
|
//调用方法 获取需要修改的数据 |
|
|
|
|
|
List<PartIfsCatalogProperty> paramList = this.getAndCheckNeedUpdateList(resultList, inDatas); |
|
|
//循环设置参数 |
|
|
//循环设置参数 |
|
|
for(PartIfsCatalogProperty tempData : inDatas) { |
|
|
|
|
|
String attribute = tempData.getAttribute(); |
|
|
|
|
|
//查询属性信息 |
|
|
|
|
|
Map<String, String> attributeMap = TechnicalClassApi.getTechnicalAttribute(srv, technicalSpecNo, technicalClass, attribute); |
|
|
|
|
|
if(attributeMap == null || attributeMap.isEmpty()) { |
|
|
|
|
|
throw new APException("不存在此技术等级的属性信息!"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
for(PartIfsCatalogProperty tempData : paramList) { |
|
|
//设置替代的ifs的key |
|
|
//设置替代的ifs的key |
|
|
tempData.setIfsRowId(attributeMap.get("IFSROWID")); |
|
|
|
|
|
tempData.setIfsRowVersion(attributeMap.get("IFSROWVERSION")); |
|
|
|
|
|
tempData.setTechnicalSpecNo(technicalSpecNo); |
|
|
tempData.setTechnicalSpecNo(technicalSpecNo); |
|
|
//api修改参数 |
|
|
//api修改参数 |
|
|
Map<String, String> resultMap = TechnicalClassApi.modifyTechnicalAttribute(srv, tempData); |
|
|
Map<String, String> resultMap = TechnicalClassApi.modifyTechnicalAttribute(srv, tempData); |
|
|
@ -234,6 +234,62 @@ public class TechnicalClassBean { |
|
|
return returnMap; |
|
|
return returnMap; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* @description: 获取需要修改的数据 不需要修改的数据不再放入循环操作中 |
|
|
|
|
|
* @author LR |
|
|
|
|
|
* @date 2025/4/28 09:45 |
|
|
|
|
|
* @version 1.0 |
|
|
|
|
|
*/ |
|
|
|
|
|
public List<PartIfsCatalogProperty> getAndCheckNeedUpdateList(List<Map<String, String>> resultList, List<PartIfsCatalogProperty> inDatas) { |
|
|
|
|
|
//数据转Map 键为属性名称 |
|
|
|
|
|
Map<String, PartIfsCatalogProperty> newMap = new HashMap<>(); |
|
|
|
|
|
List<PartIfsCatalogProperty> updateList = new ArrayList<>(); |
|
|
|
|
|
//循环转换 |
|
|
|
|
|
for(PartIfsCatalogProperty bean : inDatas) { |
|
|
|
|
|
newMap.put(bean.getAttribute(), bean); |
|
|
|
|
|
} |
|
|
|
|
|
//循环比较数据是否一直 |
|
|
|
|
|
for (Map<String, String> resultMap : resultList){ |
|
|
|
|
|
String attribute = resultMap.get("ATTRIBUTE"); // 属性编码 |
|
|
|
|
|
String attributeType = resultMap.get("ATTRIBUTETYPE"); // 属性类型 |
|
|
|
|
|
String valueText = resultMap.get("VALUE_TEXT"); // 文本值 |
|
|
|
|
|
String valueNo = resultMap.get("VALUE_NO"); // 数字值 |
|
|
|
|
|
//接口路传过来的新值 |
|
|
|
|
|
if (!newMap.containsKey(attribute)){ |
|
|
|
|
|
continue; |
|
|
|
|
|
} |
|
|
|
|
|
PartIfsCatalogProperty tempBean = newMap.get(attribute); |
|
|
|
|
|
//针对文本和数据使用不同的比较方式 |
|
|
|
|
|
if(attributeType.equals("Alpha")) { |
|
|
|
|
|
String newValueText = tempBean.getValueText(); |
|
|
|
|
|
//如果都是空字符串 或者都是null 跳过修改 |
|
|
|
|
|
if ((null == newValueText || "NULL".equalsIgnoreCase(newValueText) || newValueText.trim().isEmpty()) |
|
|
|
|
|
&& (null == valueText || "NULL".equalsIgnoreCase(valueText) || valueText.trim().isEmpty())){ |
|
|
|
|
|
continue; |
|
|
|
|
|
}else if (newValueText.equals(valueText)){ |
|
|
|
|
|
continue; |
|
|
|
|
|
} |
|
|
|
|
|
} else if (attributeType.equals("Numeric")) { |
|
|
|
|
|
String newValueNo = tempBean.getValueNo(); |
|
|
|
|
|
//如果都是空字符串 或者都是null 跳过修改 |
|
|
|
|
|
if ((null == newValueNo || "NULL".equalsIgnoreCase(newValueNo) || newValueNo.trim().isEmpty()) |
|
|
|
|
|
&& (null == valueNo || "NULL".equalsIgnoreCase(valueNo) || valueNo.trim().isEmpty())){ |
|
|
|
|
|
continue; |
|
|
|
|
|
}else if (newValueNo.equals(valueNo)){ |
|
|
|
|
|
continue; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
//添加ifsRowId ifsRowVersion |
|
|
|
|
|
String ifsRowId = resultMap.get("IFSROWID"); |
|
|
|
|
|
String ifsRowVersion = resultMap.get("IFSROWVERSION"); |
|
|
|
|
|
tempBean.setIfsRowId(ifsRowId); |
|
|
|
|
|
tempBean.setIfsRowVersion(ifsRowVersion); |
|
|
|
|
|
updateList.add(tempBean); |
|
|
|
|
|
} |
|
|
|
|
|
//返回需要处理的数据 |
|
|
|
|
|
return updateList; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* @description: 批量删除技术等级属性数据 |
|
|
* @description: 批量删除技术等级属性数据 |
|
|
* @author LR |
|
|
* @author LR |
|
|
|