forked from I3-YF/i3plus-mes-yfai
Merge branch 'dev' of http://git.estsh.com/I3-YF/i3plus-mes-yfai into dev
commit
14ae5dcdf4
@ -1,51 +1,51 @@
|
|||||||
package cn.estsh.i3plus.ext.mes.apiservice.interceptor;
|
//package cn.estsh.i3plus.ext.mes.apiservice.interceptor;
|
||||||
|
//
|
||||||
import org.apache.cxf.binding.soap.SoapMessage;
|
//import org.apache.cxf.binding.soap.SoapMessage;
|
||||||
import org.apache.cxf.helpers.IOUtils;
|
//import org.apache.cxf.helpers.IOUtils;
|
||||||
import org.apache.cxf.interceptor.Fault;
|
//import org.apache.cxf.interceptor.Fault;
|
||||||
import org.apache.cxf.io.CachedOutputStream;
|
//import org.apache.cxf.io.CachedOutputStream;
|
||||||
import org.apache.cxf.phase.AbstractPhaseInterceptor;
|
//import org.apache.cxf.phase.AbstractPhaseInterceptor;
|
||||||
|
//
|
||||||
import java.io.ByteArrayInputStream;
|
//import java.io.ByteArrayInputStream;
|
||||||
import java.io.IOException;
|
//import java.io.IOException;
|
||||||
import java.io.InputStream;
|
//import java.io.InputStream;
|
||||||
|
//
|
||||||
import static java.nio.charset.StandardCharsets.UTF_8;
|
//import static java.nio.charset.StandardCharsets.UTF_8;
|
||||||
|
//
|
||||||
/**
|
///**
|
||||||
* @Description :
|
// * @Description :
|
||||||
* @Reference :
|
// * @Reference :
|
||||||
* @Author : Castle
|
// * @Author : Castle
|
||||||
* @CreateDate : 2024/6/12 16:20
|
// * @CreateDate : 2024/6/12 16:20
|
||||||
* @Modify:
|
// * @Modify:
|
||||||
**/
|
// **/
|
||||||
public class CxfInInterceptor extends AbstractPhaseInterceptor<SoapMessage> {
|
//public class CxfInInterceptor extends AbstractPhaseInterceptor<SoapMessage> {
|
||||||
|
//
|
||||||
public CxfInInterceptor(String phase) {
|
// public CxfInInterceptor(String phase) {
|
||||||
super(phase);
|
// super(phase);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
public void handleMessage(SoapMessage message) throws Fault {
|
// public void handleMessage(SoapMessage message) throws Fault {
|
||||||
// 获取消息内容
|
// // 获取消息内容
|
||||||
InputStream is = message.getContent(InputStream.class);
|
// InputStream is = message.getContent(InputStream.class);
|
||||||
try {
|
// try {
|
||||||
if (is != null) {
|
// if (is != null) {
|
||||||
CachedOutputStream bos = new CachedOutputStream();
|
// CachedOutputStream bos = new CachedOutputStream();
|
||||||
IOUtils.copy(is, bos);
|
// IOUtils.copy(is, bos);
|
||||||
String startXmlMessage = new String(bos.getBytes(), UTF_8);
|
// String startXmlMessage = new String(bos.getBytes(), UTF_8);
|
||||||
String afterMessage = "";
|
// String afterMessage = "";
|
||||||
if (startXmlMessage.contains("SyncMaximoEquip")) {
|
// if (startXmlMessage.contains("SyncMaximoEquip")) {
|
||||||
afterMessage = startXmlMessage.replaceAll("ws:", "").replaceAll("tem:info", "ws:assetInfo");
|
// afterMessage = startXmlMessage.replaceAll("ws:", "").replaceAll("tem:info", "ws:assetInfo");
|
||||||
} else if (startXmlMessage.contains("SyncMaximoInstrumen")) {
|
// } else if (startXmlMessage.contains("SyncMaximoInstrumen")) {
|
||||||
afterMessage = startXmlMessage.replaceAll("ws:", "").replaceAll("tem:info", "ws:meterInfo");
|
// afterMessage = startXmlMessage.replaceAll("ws:", "").replaceAll("tem:info", "ws:meterInfo");
|
||||||
}
|
// }
|
||||||
// 重新设置输入流,因为它已经被读取
|
// // 重新设置输入流,因为它已经被读取
|
||||||
message.setContent(InputStream.class, new ByteArrayInputStream(afterMessage.getBytes()));
|
// message.setContent(InputStream.class, new ByteArrayInputStream(afterMessage.getBytes()));
|
||||||
}
|
// }
|
||||||
} catch (IOException e) {
|
// } catch (IOException e) {
|
||||||
throw new RuntimeException(e);
|
// throw new RuntimeException(e);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
}
|
//}
|
||||||
|
@ -0,0 +1,30 @@
|
|||||||
|
package cn.estsh.i3plus.ext.mes.apiservice.serviceimpl.webservice;
|
||||||
|
|
||||||
|
import cn.estsh.i3plus.ext.mes.apiservice.model.MeterInfo;
|
||||||
|
import cn.estsh.i3plus.ext.mes.apiservice.serviceimpl.busi.MaximoServiceImpl;
|
||||||
|
import cn.estsh.i3plus.ext.mes.pojo.model.MaximoParamModel;
|
||||||
|
import cn.estsh.impp.framework.boot.util.SpringContextsUtil;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import javax.jws.WebMethod;
|
||||||
|
import javax.jws.WebParam;
|
||||||
|
import javax.jws.WebService;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@WebService(targetNamespace = "http://yfaiesb/services/ServiceSyncMaximoInstrument")
|
||||||
|
public class WebServiceServerIns {
|
||||||
|
public static final Logger LOGGER = LoggerFactory.getLogger(WebServiceServerIns.class);
|
||||||
|
|
||||||
|
@WebMethod(action = "SyncMaximoInstrument", operationName = "SyncMaximoInstrument")
|
||||||
|
public Map syncInstrument(@WebParam(name = "info") MeterInfo meterInfo) {
|
||||||
|
LOGGER.info("syncInstrument主数据:{}", meterInfo);
|
||||||
|
MaximoParamModel maximoParamModel = new MaximoParamModel();
|
||||||
|
maximoParamModel.setAssetNum(meterInfo.getASSETNUM());
|
||||||
|
maximoParamModel.setBaseMeasureUnitId(meterInfo.getBASEMEASUREUNITID());
|
||||||
|
maximoParamModel.setMeterName(meterInfo.getMETERNAME());
|
||||||
|
MaximoServiceImpl bean = (MaximoServiceImpl) SpringContextsUtil.getBean("maximoServiceImpl");
|
||||||
|
return bean.doAssetMainData(maximoParamModel);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue