package com.pgf.mqspring; import javax.jms.BytesMessage; import javax.jms.JMSException; import javax.xml.bind.DatatypeConverter; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.springframework.stereotype.Component; @Component public class MqMessageBuilder { final static String mqmd1 = "4d442020000000010000000000000002ffffffff0000000000000311000013a24d5143494353202000000000000000003040f01d31313131313131313131313131313131313131313040f01d3230323230393132303933323436383831313739000000005047462e53544154494f4e2e524551554553542e535420202020202020202020202020202020202020202020202020204d51493120202020202020202020202020202020202020202020202020202020202020202020202020202020202020206765747320202020202020201910d1d7d7c6d1f0f0f14bc3c9c3e2c9f1f8187dcb18807600010000000000002020202020202020202020202020202020202020202020202020202020202020000000014349435349313820434b4250202020202020202020202020202020203230323230393132303933323434373620202020"; final static String mqmd2 = "4d442020000000010000000000000002ffffffff0000000000000311000013a24d5143494353202000000000000000003040f01d31313131313131313131313131313131313131313040f01d3230323230393132303933323437313336313830000000005047462e53544154494f4e2e524551554553542e535420202020202020202020202020202020202020202020202020204d51493120202020202020202020202020202020202020202020202020202020202020202020202020202020202020206765747320202020202020201910d1d7d7c6d1f0f0f14bc3c9c3e2c9f1f8187dcb48d79200010000000000002020202020202020202020202020202020202020202020202020202020202020000000014349435349313820434b4250202020202020202020202020202020203230323230393132303933323434383520202020"; final static String mqmd3 = "4d442020000000010000000000000002ffffffff0000000000000311000013a24d5143494353202000000000000000003040f01d31313131313131313131313131313131313131313040f01d3230323230393132303933323437323233313831000000005047462e53544154494f4e2e524551554553542e535420202020202020202020202020202020202020202020202020204d51493120202020202020202020202020202020202020202020202020202020202020202020202020202020202020206765747320202020202020201910d1d7d7c6d1f0f0f14bc3c9c3e2c9f1f8187dcb5f0dea00010000000000002020202020202020202020202020202020202020202020202020202020202020000000014349435349313820434b4250202020202020202020202020202020203230323230393132303933323434393320202020"; final static String mqmd4 = "4d442020000000010000000000000002ffffffff0000000000000311000013a24d5143494353202000000000000000003040f01d31313131313131313131313131313131313131313040f01d3230323230393132303933323437333035313832000000005047462e53544154494f4e2e524551554553542e535420202020202020202020202020202020202020202020202020204d51493120202020202020202020202020202020202020202020202020202020202020202020202020202020202020206765747320202020202020201910d1d7d7c6d1f0f0f14bc3c9c3e2c9f1f8187dcb747c1000010000000000002020202020202020202020202020202020202020202020202020202020202020000000014349435349313820434b4250202020202020202020202020202020203230323230393132303933323434393820202020"; final static String mqmd5 = "4d442020000000010000000000000002ffffffff0000000000000311000013a24d5143494353202000000000000000003040f01d31313131313131313131313131313131313131313040f01d3230323230393132303933323437333633313833000000005047462e53544154494f4e2e524551554553542e535420202020202020202020202020202020202020202020202020204d51493120202020202020202020202020202020202020202020202020202020202020202020202020202020202020206765747320202020202020201910d1d7d7c6d1f0f0f14bc3c9c3e2c9f1f8187dcb82dd5c00010000000000002020202020202020202020202020202020202020202020202020202020202020000000014349435349313820434b4250202020202020202020202020202020203230323230393132303933323435303620202020"; final static String mqmd6 = "4d442020000000010000000000000002ffffffff0000000000000311000013a24d5143494353202000000000000000003040f01d31313131313131313131313131313131313131313040f01d3230323230393132303933323437343435313834000000005047462e53544154494f4e2e524551554553542e535420202020202020202020202020202020202020202020202020204d51493120202020202020202020202020202020202020202020202020202020202020202020202020202020202020206765747320202020202020201910d1d7d7c6d1f0f0f14bc3c9c3e2c9f1f8187dcb969f2a00010000000000002020202020202020202020202020202020202020202020202020202020202020000000014349435349313820434b4250202020202020202020202020202020203230323230393132303933323436323020202020"; final static String mqcih1 = "c3c9c84000000002000000b40000000000000000c3e2d8c3c2c4c3d600000000000000000000000000000000000001110002bf2000000002000001c8000000b4000000000000000000010000013800010000000100000000404040405c5c5c5c5c5c5c5c40404040404040404040404040404040c3c9f1f840404040c7c5f0f140404040404040404040404040404040c7c5f0f14040404040404040404040404040404000000000000000000000000100000000"; final static String mqcih2 = "c3c9c84000000002000000b40000000000000000c3e2d8c3c2c4c3d600000000000000000000000000000000000001110002bf2000000002000000b4000000b4000000000000000000010000013800010000000100000000404040405c5c5c5c5c5c5c5c40404040404040404040404040404040c3c9f1f840404040c7c5f0f140404040404040404040404040404040c7c5f0f24040404040404040404040404040404000000000000000000000000200000000"; final static String mqcih3 = "c3c9c84000000002000000b40000000000000000c3e2d8c3c2c4c3d600000000000000000000000000000000000001110002bf2000000002000001d4000000b4000000000000000000010000013800010000000100000000404040405c5c5c5c5c5c5c5c40404040404040404040404040404040c3c9f1f840404040c7c5f0f240404040404040404040404040404040c7c5f0f24040404040404040404040404040404000000000000000000000000300000000"; final static String mqcih4 = "c3c9c84000000002000000b40000000000000000c3e2d8c3c2c4c3d600000000000000000000000000000000000001110002bf2000000002000000b4000000b4000000000000000000010000013800010000000100000000404040405c5c5c5c5c5c5c5c40404040404040404040404040404040c3c9f1f840404040c7c5f0f240404040404040404040404040404040c5d4f0f44040404040404040404040404040404000000000000000000000000400000000"; final static String mqcih5 = "c3c9c84000000002000000b40000000000000000c3e2d8c3c2c4c3d600000000000000000000000000000000000001110002bf200000000200000aa8000000b4000000000000000000010000013800010000000100000000404040405c5c5c5c5c5c5c5c40404040404040404040404040404040c3c9f1f840404040c5d4f0f440404040404040404040404040404040c5d4f0f44040404040404040404040404040404000000000000000000000000500000000"; final static String mqcih6 = "c3c9c84000000002000000b40000000000000000c3e2d8c3c2c4c3d600000000000000000000000000000000000001110002bf200000000200000aa8000000b4000000000000000000010000013800010000000100000000404040405c5c5c5c5c5c5c5c40404040404040404040404040404040c3c9f1f840404040c5d4f0f440404040404040404040404040404040c5d4f0f44040404040404040404040404040404000000000000000000000000600000000"; final static String vecAds1 = "00000113f1f8f0f4d6404040f0f0f0f0c5404040d5404040e8404040d5404040d5404040d5404040d5404040ffffffff00000000d4c7c5f0f1f0f040d4c7c5f0f1f0f040d5404040000000bb0000005800000000000001130000000000000000000000000000000000d4c7c5f0f1f0f0400000000000f0f961f1f261f2f20000000000f0f97af3f27af4f4ffffc10000404040404040404000004d0000404040404040404000004d0000404040404040404000004d00004040404040404040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"; final static String vecAds2 = ""; final static String vecAds3 = "0000011ef1f8f0f4d6404040f0f0f0f0c5404040d5404040e8404040d5404040d5404040d5404040d5404040ffffffff00000000d4c7c5f0f2f0f040d4c7c5f0f2f0f040d5404040000000c600000058000000000000011e000000000000000000000000000000000040404040404040400000000000f0f961f1f261f2f200000000000000000000000000004040404040404040404040404040404040404040404040404040404040404040404040404040404040400000000000f0f97af3f27af4f4ffffc100004040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"; final static String vecAds4 = ""; final static String vecAds5 = "000009f2f1f8f0f4d6404040f0f0f0f0c5404040d5404040e8404040d5404040d5404040d5404040d5404040ffffffff00000000d4c5d4f0f4f0f040d4c5d4f0f4f0f040d54040400000099a0000005800000000000009f20000000000000000000000000000000000d4c5d4f0f4f0f0400000000000f0f961f1f261f2f200000000004040404040404040404040000000000040404040404040400000000000404040404040404040404000000000004040404040404040404040ffffc10000404040404040404040400000000000404040404040404000000000004040404040404040000000000040000000000040000000000040404040404040000000000040404040404000000000004040404040404040404040000000000040404040404040404040404000000000004040404040000000000040400000000000404040404040404040404000000000004040404040404040404040000000000040404040404040404040404040404040404040404040404040404040404040400000000000404040404040404040404040000000000040404040400000000000404000000000004040404040404040404040000000000040404040404040404040400000000000404040404040404040404040404040404040404040404040404040404040404000000000000e45af49e249c64688488d0f0000000000404040404000000000004040000000000040404040404040404040400000000000404040404040404040404000000000004040404040404040404040404040404040404040404040404040404040404040000000000040404040404040404040404000000000004040404040000000000040400000000000404040404040404040404000000000004040404040404040404040000000000040404040404040404040404040404040404040404040404040404040404040400000000000404040404040404040404040000000000040404040400000000000404000000000004040404040404040404040000000000040404040404040404040400000000000404040404040404040404040404040404040404040404040404040404040404000000000004040404040404040404040400000000000404040404000000000004040000000000040404040404040404040400000000000404040404040404040404000000000004040404040404040404040404040404040404040404040404040404040404040000000000040404040404040404040404000000000004040404040000000000040400000000000404040404040404040404000000000004040404040404040404040000000000040404040404040404040404040404040404040404040404040404040404040400000000000404040404040404040404040000000000040404040400000000000404000000000004040404040404040404040000000000040404040404040404040400000000000404040404040404040404040404040404040404040404040404040404040404000000000000e42c142d742d3485f49b80f00000000004040404040000000000040400000000000404040404040404040404000000000004040404040404040404040000000000040404040404040404040404040404040404040404040404040404040404040400000000000404040404040404040404040000000000040404040400000000000404000000000004040404040404040404040000000000040404040404040404040400000000000404040404040404040404040404040404040404040404040404040404040404000000000004040404040404040404040400000000000404040404000000000004040000000000040404040404040404040400000000000404040404040404040404000000000004040404040404040404040404040404040404040404040404040404040404040000000000040404040404040404040404000000000004040404040000000000040400000000000404040404040404040404000000000004040404040404040404040000000000040404040404040404040404040404040404040404040404040404040404040400000000000404040404040404040404040000000000040404040400000000000404000000000004040404040404040404040000000000040404040404040404040400000000000404040404040404040404040404040404040404040404040404040404040404000000000000e42d742d3485f49b840400f0000000000404040404000000000004040000000000040404040404040404040400000000000404040404040404040404000000000004040404040404040404040404040404040404040404040404040404040404040000000000040404040404040404040404000000000004040404040000000000040400000000000404040404040404040404000000000004040404040404040404040000000000040404040404040404040404040404040404040404040404040404040404040400000000000404040404040404040404040000000000040404040400000000000404000000000004040404040404040404040000000000040404040404040404040400000000000404040404040404040404040404040404040404040404040404040404040404000000000004040404040404040404040400000000000404040404000000000004040000000000040404040404040404040400000000000404040404040404040404000000000004040404040404040404040404040404040404040404040404040404040404040000000000040404040404040404040404000000000004040404040000000000040400000000000404040404040404040404000000000004040404040404040404040000000000040404040404040404040404040404040404040404040404040404040404040400000000000404040404040404040404040000000000040404040400000000000404000000000004040404040404040404040000000000040404040404040404040400000000000404040404040404040404040404040404040404040404040404040404040404000000000004040404040404040404040400000000000404040404000000000004040000000000040404040404040404040400000000000404040404040404040404000000000004040404040404040404040404040404040404040404040404040404040404040000000000040404040404040404040404000000000004040404040404040404040000000000040404040404040404040400000000000404040404040404000000000004040404040400000000000404040404040404040404000000000004040404040404040404040400000000000404040404040404040404040000000000040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040"; final static String vecAds6 = "000009f2f1f8f0f4d6404040f0f0f0f0c5404040d5404040e8404040d5404040d5404040d5404040d5404040ffffffff00000000d4c5d4f0f4f0f040d4c5d4f0f4f0f040d54040400000099a0000005800000000000009f20000000000000000000000000000000000d4c5d4f0f4f0f0400000000000f0f961f1f261f2f20000000000f0f0f0f1f8f7f5f8f7f8f0000000000040404040404040400000000000f0f0f0f0f0f0f0f0f0f0f00000000000f0f0f0f0f0f0f0f0f0f0f0ffffc10000f8f9f7f4f8f6f4f2f9f10000000000f2f0f2f5f0f4f3f00000000000f2f0f2f5f0f7f2f800000000004000000000004000000000004040404040404000000000004040404040400000000000f0f0f0f1f8f7f5f8f7f8f00000000000f0f0f0f0f0f0f0f0f0f0f0400000000000f2f1c2f1f50000000000f6f10000000000f0f0f0f2f1f9f0f0f0f0f00000000000f0f0f0f0f8f4f9f8f7f3f3000000000049f4479c45aa4a6c4040404040404040404040404040404040404040404040400000000000f0f0f0f1f8f1f1f7f0f5f440000000000040404040400000000000404000000000004040404040404040404040000000000040404040404040404040400000000000404040404040404040404040404040404040404040404040404040404040404000000000000e45af49e249c64688488d0f00000000004040404040000000000040400000000000404040404040404040404000000000004040404040404040404040000000000040404040404040404040404040404040404040404040404040404040404040400000000000f0f0f0f0f9f4f5f7f0f1f34000000000004040404040000000000040400000000000404040404040404040404000000000004040404040404040404040000000000040404040404040404040404040404040404040404040404040404040404040400000000000f0f0f0f0f0f0f0f0f0f0f04000000000004040404040000000000040400000000000404040404040404040404000000000004040404040404040404040000000000040404040404040404040404040404040404040404040404040404040404040400000000000f0f0f0f0f8f4f9f8f7f3f34000000000004040404040000000000040400000000000404040404040404040404000000000004040404040404040404040000000000040404040404040404040404040404040404040404040404040404040404040400000000000f0f0f0f0f0f0f0f0f0f0f04000000000004040404040000000000040400000000000404040404040404040404000000000004040404040404040404040000000000040404040404040404040404040404040404040404040404040404040404040400000000000f0f0f0f0f0f0f0f0f0f0f040000000000040404040400000000000404000000000004040404040404040404040000000000040404040404040404040400000000000404040404040404040404040404040404040404040404040404040404040404000000000000e42c142d742d3485f49b80f00000000004040404040000000000040400000000000404040404040404040404000000000004040404040404040404040000000000040404040404040404040404040404040404040404040404040404040404040400000000000f0f0f0f0f0f0f0f0f0f0f04000000000004040404040000000000040400000000000404040404040404040404000000000004040404040404040404040000000000040404040404040404040404040404040404040404040404040404040404040400000000000f0f0f0f0f0f0f0f0f0f0f0400000000000404040404000000000004040000000000040404040404040404040400000000000404040404040404040404000000000004040404040404040404040404040404040404040404040404040404040404040000000000040404040404040404040404000000000004040404040000000000040400000000000404040404040404040404000000000004040404040404040404040000000000040404040404040404040404040404040404040404040404040404040404040400000000000f2f0f2f5f0f7f2f840404040000000000040404040400000000000404000000000004040404040404040404040000000000040404040404040404040400000000000404040404040404040404040404040404040404040404040404040404040404000000000000e42d742d3485f49b840400f00000000004040404040000000000040400000000000404040404040404040404000000000004040404040404040404040000000000040404040404040404040404040404040404040404040404040404040404040400000000000f0f0f0f0f0f0f0f0f0f0f04000000000004040404040000000000040400000000000404040404040404040404000000000004040404040404040404040000000000040404040404040404040404040404040404040404040404040404040404040400000000000f0f0f0f0f0f0f0f0f0f0f04000000000004040404040000000000040400000000000404040404040404040404000000000004040404040404040404040000000000040404040404040404040404040404040404040404040404040404040404040400000000000404040404040404040404040000000000040404040400000000000404000000000004040404040404040404040000000000040404040404040404040400000000000404040404040404040404040404040404040404040404040404040404040404000000000004040404040404040404040400000000000404040404000000000004040000000000040404040404040404040400000000000404040404040404040404000000000004040404040404040404040404040404040404040404040404040404040404040000000000040404040404040404040404000000000004040404040000000000040400000000000404040404040404040404000000000004040404040404040404040000000000040404040404040404040404040404040404040404040404040404040404040400000000000404040404040404040404040000000000040404040400000000000404000000000004040404040404040404040000000000040404040404040404040400000000000404040404040404040404040404040404040404040404040404040404040404000000000004040404040404040404040400000000000f0f0f0f0f0f0f0f0f0f0f00000000000f0f0f0f0f0f0f0f0f0f0f00000000000f0f0f0f0f0f0f0f000000000004040f04bf0f0000000000040404040404040404040400000000000f0f0f0f0f0f1f6f1f3f0f8400000000000f0f0f0f0f0f0f0f0f0f0f040000000000040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040"; final static int mqmdLen = 380; final static int mqcihLen = 180; private MqMessageBuilder() { } public static byte[] buildMessage(BytesMessage bm) throws JMSException { Logger logger = LogManager.getLogger(); byte[] ret = null; byte[] body = bm.getBody(byte[].class); //byte[] id = Arrays.copyOfRange(body, mqmdLen + 127, mqmdLen + 129); //logger.info("id =" + id); String screenId = "99";//commonService.decodeEbcdic(id); logger.info("Screen ID =" + screenId); boolean is2ndReq = body.length > mqmdLen + mqcihLen; switch (screenId) { case "01": ret = is2ndReq ? DatatypeConverter.parseHexBinary(mqmd2 + mqcih2 + vecAds2) : DatatypeConverter.parseHexBinary(mqmd1 + mqcih1 + vecAds1); break; case "02": ret = is2ndReq ? DatatypeConverter.parseHexBinary(mqmd4 + mqcih4 + vecAds4) : DatatypeConverter.parseHexBinary(mqmd3 + mqcih3 + vecAds3); break; case "04": ret = is2ndReq ? DatatypeConverter.parseHexBinary(mqmd6 + mqcih6 + vecAds6) : DatatypeConverter.parseHexBinary(mqmd5 + mqcih5 + vecAds5); break; default: ret = DatatypeConverter.parseHexBinary(mqcih1); break; } return ret; } }