|
|
|
@ -95,7 +95,9 @@ public class ToolServiceImpl implements ToolService { |
|
|
|
//公共参数 |
|
|
|
String site = inData.getSite(); |
|
|
|
String toolId = inData.getToolId(); |
|
|
|
String toolType = inData.getToolType(); |
|
|
|
String alternativeToolId = inData.getAlternateToolId(); |
|
|
|
String calendarId = inData.getCalendarId(); |
|
|
|
if(toolId.equals(alternativeToolId)){ |
|
|
|
throw new RuntimeException("替代工具和当前工具不能相同!"); |
|
|
|
} |
|
|
|
@ -105,18 +107,27 @@ public class ToolServiceImpl implements ToolService { |
|
|
|
if(tool != null){ |
|
|
|
throw new RuntimeException("已存在当前工具信息!"); |
|
|
|
} |
|
|
|
IfsToolData alternativeTool = toolDao.getToolInfoByToolId(site, alternativeToolId); |
|
|
|
//如果存在 |
|
|
|
if(alternativeTool == null){ |
|
|
|
throw new RuntimeException("当前替代工具信息不存在!"); |
|
|
|
//1.调用存储过程 --校验数据 |
|
|
|
Map<String, Object> resultMap = this.checkInsertToolInfo(site, toolId, toolType, calendarId, alternativeToolId); |
|
|
|
//判断是否检验成功 |
|
|
|
String resultCode = String.valueOf(resultMap.get("result_code")); |
|
|
|
if ("400".equalsIgnoreCase(resultCode)) { |
|
|
|
String resultMsg = String.valueOf(resultMap.get("result_msg")); |
|
|
|
throw new RuntimeException(resultMsg); |
|
|
|
} |
|
|
|
//1.校验存在调用接口 |
|
|
|
//判断是否存在替代的 |
|
|
|
String toolURL = apiUrl + "/tool/ifs/syncToolDataToIfs"; |
|
|
|
|
|
|
|
//2.校验存在调用接口 |
|
|
|
/* String toolURL = apiUrl + "/tool/ifs/syncToolDataToIfs"; |
|
|
|
ResponseData toolResponse = HttpClientUtil.doPostByRawWithPLM(toolURL, inData); |
|
|
|
if (!"200".equals(toolResponse.getCode())) { |
|
|
|
throw new RuntimeException("IFS Tool新增异常:" + toolResponse.getMsg()); |
|
|
|
} |
|
|
|
// 更新 ifs_row_id ifs_row_version |
|
|
|
String objStr = String.valueOf(toolResponse.getObj()); |
|
|
|
IfsToolData ifsTool = JSON.parseObject(objStr, IfsToolData.class); |
|
|
|
inData.setCreateDate(new Date()); |
|
|
|
inData.setIfsRowId(ifsTool.getIfsRowId()); |
|
|
|
inData.setIfsRowVersion(ifsTool.getIfsRowVersion()); |
|
|
|
//删除工具信息默认的工具实例信息 |
|
|
|
IfsToolInstanceData toolInstance = new IfsToolInstanceData(); |
|
|
|
//属性拷贝 |
|
|
|
@ -126,38 +137,53 @@ public class ToolServiceImpl implements ToolService { |
|
|
|
toolResponse = HttpClientUtil.doPostByRawWithPLM(toolURL, toolInstance); |
|
|
|
if (!"200".equals(toolResponse.getCode())) { |
|
|
|
throw new RuntimeException("IFS ToolInstance新增异常:" + toolResponse.getMsg()); |
|
|
|
} |
|
|
|
// 更新 ifs_row_id ifs_row_version |
|
|
|
String objStr = String.valueOf(toolResponse.getObj()); |
|
|
|
IfsToolData ifsTool = JSON.parseObject(objStr, IfsToolData.class); |
|
|
|
inData.setCreateDate(new Date()); |
|
|
|
}*/ |
|
|
|
inData.setState("Active"); |
|
|
|
//2.调用方法保存当前的数据 |
|
|
|
toolDao.insertToolInfo(inData); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @description: 调用存储过程 校验工具新增 |
|
|
|
* @author LR |
|
|
|
* @date 2024/9/3 17:11 |
|
|
|
* @version 1.0 |
|
|
|
*/ |
|
|
|
public Map<String, Object> checkInsertToolInfo(String site, String toolId, String toolType, String calendarId, String alternativeToolId) { |
|
|
|
List<Object> params = new ArrayList<>(); |
|
|
|
params.add(site); |
|
|
|
params.add(toolId); |
|
|
|
params.add(toolType); |
|
|
|
params.add(calendarId); |
|
|
|
params.add(alternativeToolId); |
|
|
|
//调用存储过程 |
|
|
|
List<Map<String, Object>> resultList = procedureDao.getProcedureData("checkInsertToolInfo", params); |
|
|
|
//处理返回的结果 |
|
|
|
return resultList.get(0); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
@Transactional |
|
|
|
public void modifyToolInfo(IfsTool inData) { |
|
|
|
//公共参数 |
|
|
|
String site = inData.getSite(); |
|
|
|
String toolId = inData.getToolId(); |
|
|
|
String toolType = inData.getToolType(); |
|
|
|
String alternativeToolId = inData.getAlternateToolId(); |
|
|
|
String calendarId = inData.getCalendarId(); |
|
|
|
if(toolId.equals(alternativeToolId)){ |
|
|
|
throw new RuntimeException("替代工具和当前工具不能相同!"); |
|
|
|
} |
|
|
|
//查询是否存在 |
|
|
|
IfsToolData tool = toolDao.getToolInfoByToolId(site, toolId); |
|
|
|
//如果存在 |
|
|
|
if(tool == null){ |
|
|
|
throw new RuntimeException("当前工具信息不存在!"); |
|
|
|
} |
|
|
|
IfsToolData alternativeTool = toolDao.getToolInfoByToolId(site, alternativeToolId); |
|
|
|
//如果存在 |
|
|
|
if(alternativeTool == null){ |
|
|
|
throw new RuntimeException("当前替代工具信息不存在!"); |
|
|
|
//1.调用存储过程 --校验数据 |
|
|
|
Map<String, Object> resultMap = this.checkUpdateToolInfo(site, toolId, toolType, calendarId, alternativeToolId); |
|
|
|
//判断是否检验成功 |
|
|
|
String resultCode = String.valueOf(resultMap.get("result_code")); |
|
|
|
if ("400".equalsIgnoreCase(resultCode)) { |
|
|
|
String resultMsg = String.valueOf(resultMap.get("result_msg")); |
|
|
|
throw new RuntimeException(resultMsg); |
|
|
|
} |
|
|
|
//1.校验存在调用接口 |
|
|
|
//判断是否存在替代的 |
|
|
|
|
|
|
|
/* //2.校验存在调用接口 |
|
|
|
String toolURL = apiUrl + "/tool/ifs/modifyToolDataToIfs"; |
|
|
|
ResponseData toolResponse = HttpClientUtil.doPostByRawWithPLM(toolURL, inData); |
|
|
|
if (!"200".equals(toolResponse.getCode())) { |
|
|
|
@ -166,10 +192,31 @@ public class ToolServiceImpl implements ToolService { |
|
|
|
// 更新 ifs_row_id ifs_row_version |
|
|
|
String objStr = String.valueOf(toolResponse.getObj()); |
|
|
|
IfsToolData ifsTool = JSON.parseObject(objStr, IfsToolData.class); |
|
|
|
inData.setIfsRowId(ifsTool.getIfsRowId()); |
|
|
|
inData.setIfsRowVersion(ifsTool.getIfsRowVersion());*/ |
|
|
|
//2.调用方法保存当前的数据 |
|
|
|
toolDao.updateToolInfo(inData); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @description: 调用存储过程 校验工具信息的修改 |
|
|
|
* @author LR |
|
|
|
* @date 2024/9/3 17:41 |
|
|
|
* @version 1.0 |
|
|
|
*/ |
|
|
|
public Map<String, Object> checkUpdateToolInfo(String site, String toolId, String toolType, String calendarId, String alternativeToolId) { |
|
|
|
List<Object> params = new ArrayList<>(); |
|
|
|
params.add(site); |
|
|
|
params.add(toolId); |
|
|
|
params.add(toolType); |
|
|
|
params.add(calendarId); |
|
|
|
params.add(alternativeToolId); |
|
|
|
//调用存储过程 |
|
|
|
List<Map<String, Object>> resultList = procedureDao.getProcedureData("checkUpdateToolInfo", params); |
|
|
|
//处理返回的结果 |
|
|
|
return resultList.get(0); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
@Transactional |
|
|
|
public void removeToolInfo(IfsTool inData) { |
|
|
|
@ -183,7 +230,6 @@ public class ToolServiceImpl implements ToolService { |
|
|
|
throw new RuntimeException("当前工具信息不存在!"); |
|
|
|
} |
|
|
|
//1.调用存储过程判断是否可以删除 |
|
|
|
//调用存储过程 --向下移动派工单 |
|
|
|
Map<String, Object> resultMap = this.checkDeleteToolInfo(site, toolId); |
|
|
|
//判断是否检验成功 |
|
|
|
String resultCode = String.valueOf(resultMap.get("result_code")); |
|
|
|
@ -192,17 +238,16 @@ public class ToolServiceImpl implements ToolService { |
|
|
|
throw new RuntimeException(resultMsg); |
|
|
|
} |
|
|
|
//2.校验存在调用接口 |
|
|
|
//判断是否存在替代的 |
|
|
|
/*//判断是否存在替代的 |
|
|
|
String toolURL = apiUrl + "/tool/ifs/removeToolDataToIfs"; |
|
|
|
ResponseData toolResponse = HttpClientUtil.doPostByRawWithPLM(toolURL, inData); |
|
|
|
if (!"200".equals(toolResponse.getCode())) { |
|
|
|
throw new RuntimeException("IFS Tool删除异常:" + toolResponse.getMsg()); |
|
|
|
} |
|
|
|
// 更新 ifs_row_id ifs_row_version |
|
|
|
String objStr = String.valueOf(toolResponse.getObj()); |
|
|
|
IfsToolData ifsTool = JSON.parseObject(objStr, IfsToolData.class); |
|
|
|
//2.调用方法保存当前的数据 |
|
|
|
}*/ |
|
|
|
//3.调用方法保存当前的数据 |
|
|
|
toolDao.deleteToolInfo(inData); |
|
|
|
toolDao.deleteToolInstanceByTool(inData); |
|
|
|
toolDao.deleteToolInstanceDateByTool(inData); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
|