You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
296 lines
12 KiB
296 lines
12 KiB
package com.spring.ifs.bean;
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.spring.ifs.api.IfsServer;
|
|
import com.spring.ifs.api.TechnicalClassApi;
|
|
import com.spring.modules.part.entity.APIEntity.PartIfsCatalogModel;
|
|
import com.spring.modules.part.entity.APIEntity.PartIfsCatalogProperty;
|
|
import ifs.fnd.ap.APException;
|
|
import ifs.fnd.ap.Server;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Component;
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.HashMap;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
|
|
/**
|
|
* @description: 技术等级实现类
|
|
* @author LR
|
|
* @date 2024/12/9 11:49
|
|
* @version 1.0
|
|
*/
|
|
@Component
|
|
public class TechnicalClassBean {
|
|
|
|
@Autowired
|
|
private IfsServer ifsServer;
|
|
|
|
private static final Logger logger = LoggerFactory.getLogger(TechnicalClassBean.class);
|
|
|
|
/**
|
|
* @description: 查询技术等级
|
|
* @author LR
|
|
* @date 2024/12/16 13:15
|
|
* @version 1.0
|
|
*/
|
|
public Map<String, String> getTechnicalClass(Server srv, PartIfsCatalogModel inData) {
|
|
logger.info("Technical Class 查询开始:"+ JSON.toJSONString(inData));
|
|
//公共参数
|
|
Map<String, String> returnMap = new HashMap<>();
|
|
String luName = inData.getLuName(); //
|
|
String keyRef = inData.getKeyRef(); //
|
|
try{
|
|
//查询对象
|
|
Map<String, String> resultMap = TechnicalClassApi.getTechnicalClass(srv, luName, keyRef);
|
|
//判断查询导数据
|
|
if(resultMap == null) {
|
|
throw new APException("查无此技术等级的信息!");
|
|
}
|
|
//设置ifs 信息
|
|
inData.setIfsRowId(resultMap.get("IFSROWID"));
|
|
inData.setIfsRowVersion(resultMap.get("IFSROWVERSION"));
|
|
returnMap.put("resultCode", "200");
|
|
returnMap.put("obj", JSON.toJSONString(inData));
|
|
} catch(APException e){
|
|
returnMap.put("resultCode", "400");
|
|
returnMap.put("resultMsg", e.getMessage());
|
|
logger.info("异常信息:"+e.getMessage());
|
|
}
|
|
//打印日志
|
|
logger.info("Technical Class 查询结束:"+JSON.toJSONString(inData));
|
|
//返回结果集
|
|
return returnMap;
|
|
}
|
|
|
|
/**
|
|
* @description: 新增
|
|
* @author LR
|
|
* @date 2024/12/16 13:37
|
|
* @version 1.0
|
|
*/
|
|
public Map<String, String> syncTechnicalClass(Server srv, PartIfsCatalogModel inData) {
|
|
logger.info("Technical Class 新增开始:"+JSON.toJSONString(inData));
|
|
//公共参数
|
|
Map<String, String> returnMap = new HashMap<>();
|
|
String luName = inData.getLuName(); //
|
|
String keyRef = inData.getKeyRef(); //
|
|
try{
|
|
//查询对象
|
|
Map<String, String> technicalMap = TechnicalClassApi.getTechnicalClass(srv, luName, keyRef);
|
|
//判断查询导数据
|
|
if(technicalMap != null && !technicalMap.isEmpty()) {
|
|
throw new APException("已存在此技术等级的信息!");
|
|
}
|
|
|
|
//调用api同步信息
|
|
Map<String, String> resultMap = TechnicalClassApi.insertTechnicalClass(srv, inData);
|
|
//设置唯一键和版本
|
|
inData.setIfsRowVersion(resultMap.get("OBJVERSION"));
|
|
returnMap.put("resultCode", "200");
|
|
returnMap.put("obj", JSON.toJSONString(inData));
|
|
} catch(APException e){
|
|
returnMap.put("resultCode", "400");
|
|
returnMap.put("resultMsg", e.getMessage());
|
|
logger.info("异常信息:"+e.getMessage());
|
|
}
|
|
//插入查询的记录数据
|
|
logger.info("Technical Class 新增结束:"+JSON.toJSONString(inData));
|
|
//返回结果集
|
|
return returnMap;
|
|
}
|
|
|
|
/**
|
|
* @description: 修改技术等级的数据
|
|
* @author LR
|
|
* @date 2024/12/16 13:45
|
|
* @version 1.0
|
|
*/
|
|
public Map<String, String> modifyTechnicalClass(Server srv, PartIfsCatalogModel inData) {
|
|
logger.info("Technical Class 修改开始:"+JSON.toJSONString(inData));
|
|
//公共参数
|
|
Map<String, String> returnMap = new HashMap<>();
|
|
String luName = inData.getLuName(); //
|
|
String keyRef = inData.getKeyRef();
|
|
try{
|
|
//查询对象
|
|
Map<String, String> technicalMap = TechnicalClassApi.getTechnicalClass(srv, luName, keyRef);
|
|
//判断查询导数据
|
|
if(technicalMap == null || technicalMap.isEmpty()) {
|
|
throw new APException("不存在此技术等级的信息!");
|
|
}
|
|
//设置IFS的信息
|
|
inData.setIfsRowId(technicalMap.get("IFSROWID"));
|
|
inData.setIfsRowVersion(technicalMap.get("IFSROWVERSION"));
|
|
|
|
//调用api同步信息
|
|
Map<String, String> resultMap = TechnicalClassApi.modifyTechnicalClass(srv, inData);
|
|
//设置唯一键和版本
|
|
inData.setIfsRowVersion(resultMap.get("OBJVERSION"));
|
|
returnMap.put("resultCode", "200");
|
|
returnMap.put("obj", JSON.toJSONString(inData));
|
|
} catch(APException e){
|
|
returnMap.put("resultCode", "400");
|
|
returnMap.put("resultMsg", e.getMessage());
|
|
logger.info("异常信息:"+e.getMessage());
|
|
}
|
|
//插入查询的记录数据
|
|
logger.info("Technical Class 修改结束:"+JSON.toJSONString(inData));
|
|
//返回结果集
|
|
return returnMap;
|
|
}
|
|
|
|
/**
|
|
* @description: 刪除技术等级的信息
|
|
* @author LR
|
|
* @date 2024/12/16 13:46
|
|
* @version 1.0
|
|
*/
|
|
public Map<String, String> removeTechnicalClass(Server srv, PartIfsCatalogModel inData) {
|
|
logger.info("Technical Class 删除开始:"+JSON.toJSONString(inData));
|
|
//公共参数
|
|
Map<String, String> returnMap = new HashMap<>();
|
|
String luName = inData.getLuName(); //
|
|
String keyRef = inData.getKeyRef(); //
|
|
try{
|
|
//查询对象
|
|
Map<String, String> technicalMap = TechnicalClassApi.getTechnicalClass(srv, luName, keyRef);
|
|
//判断查询导数据
|
|
if(technicalMap == null || technicalMap.isEmpty()) {
|
|
throw new APException("不存在此技术等级的信息!");
|
|
}
|
|
//设置IFS的信息
|
|
inData.setIfsRowId(technicalMap.get("IFSROWID"));
|
|
inData.setIfsRowVersion(technicalMap.get("IFSROWVERSION"));
|
|
//调用api同步信息
|
|
TechnicalClassApi.removeTechnicalClass(srv, inData);
|
|
returnMap.put("resultCode", "200");
|
|
returnMap.put("obj", JSON.toJSONString(inData));
|
|
} catch(APException e){
|
|
returnMap.put("resultCode", "400");
|
|
returnMap.put("resultMsg", e.getMessage());
|
|
logger.info("异常信息:"+e.getMessage());
|
|
}
|
|
//插入查询的记录数据
|
|
logger.info("Technical Class 删除结束:"+JSON.toJSONString(inData));
|
|
//返回结果集
|
|
return returnMap;
|
|
}
|
|
|
|
/**
|
|
* @description: 批量同步技术等级属性数据
|
|
* @author LR
|
|
* @date 2024/12/19 15:02
|
|
* @version 1.0
|
|
*/
|
|
public Map<String, String> modifyTechnicalClassAttributes(Server srv, List<PartIfsCatalogProperty> inDatas) {
|
|
logger.info("Technical Class Attributes 批量修改开始:"+JSON.toJSONString(inDatas));
|
|
Map<String, String> returnMap = new HashMap<>();
|
|
PartIfsCatalogProperty inData = inDatas.get(0);
|
|
// 公共参数
|
|
String luName = inData.getLuName(); //
|
|
String keyRef = inData.getKeyRef(); //
|
|
try{
|
|
//查询技术等级
|
|
Map<String, String> technicalMap = TechnicalClassApi.getTechnicalClass(srv, luName, keyRef);
|
|
//判断查询导数据
|
|
//判断查询导数据
|
|
if(technicalMap == null || technicalMap.isEmpty()) {
|
|
throw new APException("不存在此技术等级的信息!");
|
|
}
|
|
//设置唯一键和版本
|
|
String technicalSpecNo = technicalMap.get("TECHNICAL_SPEC_NO");
|
|
String technicalClass = inData.getTechnicalClass();
|
|
//循环设置参数
|
|
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("不存在此技术等级的属性信息!");
|
|
}
|
|
//设置替代的ifs的key
|
|
tempData.setIfsRowId(attributeMap.get("IFSROWID"));
|
|
tempData.setIfsRowVersion(attributeMap.get("IFSROWVERSION"));
|
|
tempData.setTechnicalSpecNo(technicalSpecNo);
|
|
//api修改参数
|
|
Map<String, String> resultMap = TechnicalClassApi.modifyTechnicalAttribute(srv, tempData);
|
|
//设置记录的版本
|
|
tempData.setIfsRowVersion(resultMap.get("OBJVERSION"));
|
|
}
|
|
returnMap.put("resultCode", "200");
|
|
returnMap.put("obj", JSON.toJSONString(inDatas));
|
|
} catch(APException e){
|
|
returnMap.put("resultCode", "400");
|
|
returnMap.put("resultMsg", e.getMessage());
|
|
logger.info("异常信息:"+e.getMessage());
|
|
}
|
|
//插入查询的记录数据
|
|
logger.info("Technical Class Attributes 批量修改结束:"+JSON.toJSONString(inDatas));
|
|
//返回结果集
|
|
return returnMap;
|
|
}
|
|
|
|
/**
|
|
* @description: 批量删除技术等级属性数据
|
|
* @author LR
|
|
* @date 2024/12/19 15:02
|
|
* @version 1.0
|
|
*/
|
|
public Map<String, String> removeTechnicalClassAttributes(Server srv, List<PartIfsCatalogProperty> inDatas) {
|
|
logger.info("Technical Class Attributes 批量删除开始:"+JSON.toJSONString(inDatas));
|
|
Map<String, String> returnMap = new HashMap<>();
|
|
PartIfsCatalogProperty inData = inDatas.get(0);
|
|
// 公共参数
|
|
String luName = inData.getLuName(); //
|
|
String keyRef = inData.getKeyRef(); //
|
|
try{
|
|
//查询技术等级
|
|
Map<String, String> technicalMap = TechnicalClassApi.getTechnicalClass(srv, luName, keyRef);
|
|
logger.info("技术等级查询");
|
|
//判断查询导数据
|
|
if(technicalMap == null || technicalMap.isEmpty()) {
|
|
throw new APException("不存在此技术等级的信息!");
|
|
}
|
|
//设置唯一键和版本
|
|
String technicalSpecNo = technicalMap.get("TECHNICAL_SPEC_NO");
|
|
String technicalClass = inData.getTechnicalClass();
|
|
//循环设置参数
|
|
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("不存在此技术等级的属性信息!");
|
|
}
|
|
logger.info("技术等级属性查询");
|
|
//设置替代的ifs的key
|
|
tempData.setIfsRowId(attributeMap.get("IFSROWID"));
|
|
tempData.setIfsRowVersion(attributeMap.get("IFSROWVERSION"));
|
|
tempData.setAttributeType(attributeMap.get("ATTRIBUTETYPE"));
|
|
tempData.setTechnicalSpecNo(technicalSpecNo);
|
|
logger.info("技术等级属性删除开始");
|
|
//api修改参数
|
|
TechnicalClassApi.removeTechnicalAttribute(srv, tempData);
|
|
logger.info("技术等级属性删除结束");
|
|
}
|
|
returnMap.put("resultCode", "200");
|
|
returnMap.put("obj", JSON.toJSONString(inDatas));
|
|
} catch(APException e){
|
|
returnMap.put("resultCode", "400");
|
|
returnMap.put("resultMsg", e.getMessage());
|
|
logger.info("异常信息:"+e.getMessage());
|
|
}
|
|
//插入查询的记录数据
|
|
logger.info("Technical Class Attributes 批量删除结束:"+JSON.toJSONString(inDatas));
|
|
//返回结果集
|
|
return returnMap;
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|