|
|
@ -1,16 +1,20 @@ |
|
|
package com.spring.modules.base.service.Impl; |
|
|
package com.spring.modules.base.service.Impl; |
|
|
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
import com.spring.common.exception.XJException; |
|
|
import com.spring.common.exception.XJException; |
|
|
import com.spring.common.utils.Constant; |
|
|
|
|
|
import com.spring.common.utils.PageUtils; |
|
|
import com.spring.common.utils.PageUtils; |
|
|
|
|
|
import com.spring.modules.Tooling.dao.BaseConfigDao; |
|
|
|
|
|
import com.spring.modules.Tooling.data.TechnicalClass; |
|
|
|
|
|
import com.spring.modules.Tooling.data.TechnicalClassAttribute; |
|
|
import com.spring.modules.base.dao.PropertiesMapper; |
|
|
import com.spring.modules.base.dao.PropertiesMapper; |
|
|
import com.spring.modules.base.data.*; |
|
|
import com.spring.modules.base.data.*; |
|
|
import com.spring.modules.base.entity.*; |
|
|
import com.spring.modules.base.entity.*; |
|
|
import com.spring.modules.base.service.PropertiesBUService; |
|
|
import com.spring.modules.base.service.PropertiesBUService; |
|
|
import com.spring.modules.base.service.PropertiesGroupService; |
|
|
import com.spring.modules.base.service.PropertiesGroupService; |
|
|
import com.spring.modules.base.service.PropertiesService; |
|
|
import com.spring.modules.base.service.PropertiesService; |
|
|
|
|
|
import com.spring.modules.base.utils.HttpClientUtil; |
|
|
import com.spring.modules.base.utils.ResponseData; |
|
|
import com.spring.modules.base.utils.ResponseData; |
|
|
import com.spring.modules.part.mapper.PartInformationMapper; |
|
|
import com.spring.modules.part.mapper.PartInformationMapper; |
|
|
import com.spring.modules.project.dao.ProjectDao; |
|
|
import com.spring.modules.project.dao.ProjectDao; |
|
|
@ -21,13 +25,12 @@ import com.spring.modules.sys.entity.SysMenuEntity; |
|
|
import com.spring.modules.sys.entity.SysUserEntity; |
|
|
import com.spring.modules.sys.entity.SysUserEntity; |
|
|
import org.apache.shiro.SecurityUtils; |
|
|
import org.apache.shiro.SecurityUtils; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
|
|
import org.springframework.beans.factory.annotation.Value; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
|
import java.util.List; |
|
|
|
|
|
import java.util.Map; |
|
|
|
|
|
import java.util.Objects; |
|
|
|
|
|
|
|
|
import java.math.BigDecimal; |
|
|
|
|
|
import java.util.*; |
|
|
import java.util.stream.Collectors; |
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
@Service |
|
|
@Service |
|
|
@ -44,6 +47,15 @@ public class PropertiesServiceImpl implements PropertiesService { |
|
|
private PropertiesBUService propertiesBUService; |
|
|
private PropertiesBUService propertiesBUService; |
|
|
@Autowired |
|
|
@Autowired |
|
|
private PartInformationMapper partInformationMapper; |
|
|
private PartInformationMapper partInformationMapper; |
|
|
|
|
|
@Autowired |
|
|
|
|
|
private BaseConfigDao baseConfigDao; |
|
|
|
|
|
|
|
|
|
|
|
//接口使用的参数 |
|
|
|
|
|
@Value("${ifs-api.api-url}") |
|
|
|
|
|
private String apiUrl; |
|
|
|
|
|
@Value("${ifs-control.control-flag}") |
|
|
|
|
|
private Boolean controlFlag; |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public PageUtils propertiesItemSearch(PlmPropertiesItemData inData){ |
|
|
public PageUtils propertiesItemSearch(PlmPropertiesItemData inData){ |
|
|
IPage<PlmPropertiesItemData> resultList = this.propertiesMapper.plmPropertiesItemSearch(new Page<PlmPropertiesItemData>(inData.getPage(), inData.getLimit()), inData); |
|
|
IPage<PlmPropertiesItemData> resultList = this.propertiesMapper.plmPropertiesItemSearch(new Page<PlmPropertiesItemData>(inData.getPage(), inData.getLimit()), inData); |
|
|
@ -391,12 +403,90 @@ public class PropertiesServiceImpl implements PropertiesService { |
|
|
@Override |
|
|
@Override |
|
|
@Transactional |
|
|
@Transactional |
|
|
public void updatePropertiesList(List<PartSubPropertiesValue> data){ |
|
|
public void updatePropertiesList(List<PartSubPropertiesValue> data){ |
|
|
|
|
|
//判断是否有数据要保存 |
|
|
|
|
|
if(data.size() > 0){ |
|
|
|
|
|
String recordType = data.get(0).getRecordType(); |
|
|
|
|
|
if(controlFlag && ("TL".equalsIgnoreCase(recordType) || "TLI".equalsIgnoreCase(recordType))){ |
|
|
|
|
|
//调用接口同步方法 同步数据 |
|
|
|
|
|
this.syncToolPropertyValues(data, recordType); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
for (PartSubPropertiesValue itemDate : data){ |
|
|
for (PartSubPropertiesValue itemDate : data){ |
|
|
|
|
|
|
|
|
propertiesMapper.updatePropertiesList(itemDate); |
|
|
propertiesMapper.updatePropertiesList(itemDate); |
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* @description: 批量同步工具的参数 |
|
|
|
|
|
* @author LR |
|
|
|
|
|
* @date 2024/10/28 17:10 |
|
|
|
|
|
* @version 1.0 |
|
|
|
|
|
*/ |
|
|
|
|
|
public void syncToolPropertyValues(List<PartSubPropertiesValue> datas, String recordType) { |
|
|
|
|
|
//需要区分是工具的属性还是工具实例的属性 |
|
|
|
|
|
String site = datas.get(0).getSite(); |
|
|
|
|
|
String partNo = datas.get(0).getPartNo(); |
|
|
|
|
|
String technicalClassNo = datas.get(0).getCodeNo(); |
|
|
|
|
|
String luName = ""; |
|
|
|
|
|
String keyRef = ""; |
|
|
|
|
|
//不同的属性 调用不同的组合方式 |
|
|
|
|
|
if("TL".equalsIgnoreCase(recordType)){ |
|
|
|
|
|
luName = "ManufTool"; |
|
|
|
|
|
keyRef = "CONTRACT="+site+"^TOOL_ID="+partNo+"^"; |
|
|
|
|
|
}else if("TLI".equalsIgnoreCase(recordType)){ |
|
|
|
|
|
luName = "ManufToolDetail"; |
|
|
|
|
|
String[] toolArr = partNo.split("#"); |
|
|
|
|
|
keyRef = "CONTRACT="+site+"^TOOL_ID="+toolArr[0]+"^TOOL_INSTANCE="+toolArr[1]+"^"; |
|
|
|
|
|
} |
|
|
|
|
|
//循环产生数据 |
|
|
|
|
|
List<TechnicalClass> propertyList = new ArrayList<>(); |
|
|
|
|
|
//遍历插入数据 |
|
|
|
|
|
for(PartSubPropertiesValue propertyValue : datas){ |
|
|
|
|
|
String attribute = propertyValue.getPropertiesItemNo(); |
|
|
|
|
|
String valueTypeDb = propertyValue.getValueTypeDb(); |
|
|
|
|
|
String textValue = propertyValue.getTextValue(); |
|
|
|
|
|
Double numValue = propertyValue.getNumValue(); |
|
|
|
|
|
String numValueStr = ""; |
|
|
|
|
|
//null处理 |
|
|
|
|
|
if(null == textValue){ |
|
|
|
|
|
textValue = ""; |
|
|
|
|
|
} |
|
|
|
|
|
if(null == numValue){ |
|
|
|
|
|
numValueStr = ""; |
|
|
|
|
|
}else { |
|
|
|
|
|
numValueStr = String.valueOf(numValue); |
|
|
|
|
|
BigDecimal bd = new BigDecimal(numValueStr).stripTrailingZeros(); |
|
|
|
|
|
numValueStr = bd.toString(); |
|
|
|
|
|
} |
|
|
|
|
|
TechnicalClassAttribute technicalAttribute = new TechnicalClassAttribute(); |
|
|
|
|
|
technicalAttribute.setLuName(luName); |
|
|
|
|
|
technicalAttribute.setKeyRef(keyRef); |
|
|
|
|
|
technicalAttribute.setTechnicalClass(technicalClassNo); |
|
|
|
|
|
technicalAttribute.setAttribute(attribute); |
|
|
|
|
|
if("T".equalsIgnoreCase(valueTypeDb)){ |
|
|
|
|
|
technicalAttribute.setAttributeType("Alpha"); |
|
|
|
|
|
}else if("N".equalsIgnoreCase(valueTypeDb)){ |
|
|
|
|
|
technicalAttribute.setAttributeType("Numeric"); |
|
|
|
|
|
} |
|
|
|
|
|
//设置数值 针对空值需要特殊处理 |
|
|
|
|
|
technicalAttribute.setValueText(textValue); |
|
|
|
|
|
technicalAttribute.setValueNo(numValueStr); |
|
|
|
|
|
technicalAttribute.setLowerLimit(""); |
|
|
|
|
|
technicalAttribute.setUpperLimit(""); |
|
|
|
|
|
technicalAttribute.setInfo(""); |
|
|
|
|
|
propertyList.add(technicalAttribute); |
|
|
|
|
|
} |
|
|
|
|
|
//调用ifs的api |
|
|
|
|
|
String toolURL = apiUrl + "/technical/class/modifyTechnicalClassAttributes"; |
|
|
|
|
|
ResponseData toolResponse = HttpClientUtil.doPostByRawWithPLM(toolURL, propertyList); |
|
|
|
|
|
if (!"200".equals(toolResponse.getCode())) { |
|
|
|
|
|
throw new RuntimeException("IFS Tool属性修改异常:" + toolResponse.getMsg()); |
|
|
|
|
|
} |
|
|
|
|
|
// 更新 ifs_row_id ifs_row_version |
|
|
|
|
|
String objStr = String.valueOf(toolResponse.getObj()); |
|
|
|
|
|
TechnicalClass ifsTool = JSON.parseObject(objStr, TechnicalClass.class); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public void deleteModalDetailForBM(PlmBmModelDetailData inData){ |
|
|
public void deleteModalDetailForBM(PlmBmModelDetailData inData){ |
|
|
propertiesMapper.deleteModalDetailsForBM(inData); |
|
|
propertiesMapper.deleteModalDetailsForBM(inData); |
|
|
|