修改名字一致性
This commit is contained in:
@@ -37,7 +37,7 @@ public class KafkaController {
|
|||||||
kafkaservice.msgSend(topicName, msg);
|
kafkaservice.msgSend(topicName, msg);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
try {
|
try {
|
||||||
String jsonStr = exchangeService.xmlToJson(msg);
|
String jsonStr = exchangeService.xmlstrToJson(msg);
|
||||||
kafkaservice.msgSend(topicName, jsonStr);
|
kafkaservice.msgSend(topicName, jsonStr);
|
||||||
} catch (Exception e2) {
|
} catch (Exception e2) {
|
||||||
throw new RuntimeException(e2);
|
throw new RuntimeException(e2);
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ public class FlopBaseHandler implements IBaseHandler {
|
|||||||
kafkaservice.msgSend("schd", schdMsg);
|
kafkaservice.msgSend("schd", schdMsg);
|
||||||
|
|
||||||
//send msg
|
//send msg
|
||||||
String msg = exchangeService.xmlToJson(
|
String msg = exchangeService.xmlstrToJson(
|
||||||
cminmsg.getCminmsgsClobMsg()
|
cminmsg.getCminmsgsClobMsg()
|
||||||
);
|
);
|
||||||
kafkaservice.msgSend("msg", msg);
|
kafkaservice.msgSend("msg", msg);
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import com.gzzn.omms.msgexchangeapi.exception.ExchangeServiceException;
|
|||||||
public class ExchangeServiceImpl implements IExchangeService {
|
public class ExchangeServiceImpl implements IExchangeService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String xmlToJson(String xml) throws ExchangeServiceException {
|
public String xmlstrToJson(String xml) throws ExchangeServiceException {
|
||||||
try {
|
try {
|
||||||
Map map;
|
Map map;
|
||||||
ObjectMapper xmlMapper = new XmlMapper();
|
ObjectMapper xmlMapper = new XmlMapper();
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import com.gzzn.omms.msgexchangeapi.exception.ExchangeServiceException;
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public interface IExchangeService {
|
public interface IExchangeService {
|
||||||
public String xmlToJson(String xml) throws ExchangeServiceException;
|
public String xmlstrToJson(String xml) throws ExchangeServiceException;
|
||||||
public <T> T xmlstrToObject(String xml,Class<T> valueType) throws ExchangeServiceException;
|
public <T> T xmlstrToObject(String xml,Class<T> valueType) throws ExchangeServiceException;
|
||||||
public String objectToXmlstr(Object object) throws ExchangeServiceException;
|
public String objectToXmlstr(Object object) throws ExchangeServiceException;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ public class ExchangeServiceImplTest {
|
|||||||
"</PSDT>\r\n" +
|
"</PSDT>\r\n" +
|
||||||
"</FLOP>\r\n" +
|
"</FLOP>\r\n" +
|
||||||
"</MSG>";
|
"</MSG>";
|
||||||
String jsonString = exchangeService.xmlToJson(xmlString);
|
String jsonString = exchangeService.xmlstrToJson(xmlString);
|
||||||
System.out.println(jsonString);
|
System.out.println(jsonString);
|
||||||
|
|
||||||
//assertThat(jsonPath("$.", matcher)).
|
//assertThat(jsonPath("$.", matcher)).
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ public class ToolTest {
|
|||||||
try {
|
try {
|
||||||
for(Cminmsg x : lsCmin)
|
for(Cminmsg x : lsCmin)
|
||||||
{
|
{
|
||||||
String json = exchangeService.xmlToJson(x.getCminmsgsClobMsg());
|
String json = exchangeService.xmlstrToJson(x.getCminmsgsClobMsg());
|
||||||
Msg msg;
|
Msg msg;
|
||||||
|
|
||||||
msg = JsonUtil.getObject(json,Msg.class);
|
msg = JsonUtil.getObject(json,Msg.class);
|
||||||
@@ -121,7 +121,7 @@ public class ToolTest {
|
|||||||
//
|
//
|
||||||
File f = new File(path.toString());
|
File f = new File(path.toString());
|
||||||
try (FileOutputStream fop = new FileOutputStream(f)) {
|
try (FileOutputStream fop = new FileOutputStream(f)) {
|
||||||
String jsonString = exchangeService.xmlToJson(x.getCminmsgsClobMsg());
|
String jsonString = exchangeService.xmlstrToJson(x.getCminmsgsClobMsg());
|
||||||
jsonString = jsonString.replace("\"noNamespaceSchemaLocation\":\"unisysaodbsis.xsd\",", "");
|
jsonString = jsonString.replace("\"noNamespaceSchemaLocation\":\"unisysaodbsis.xsd\",", "");
|
||||||
byte[] contentInBytes = jsonString.getBytes("UTF-8");
|
byte[] contentInBytes = jsonString.getBytes("UTF-8");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user