1212import com .codingapi .tx .model .Request ;
1313import com .codingapi .tx .model .TxGroup ;
1414import com .codingapi .tx .netty .service .MQTxManagerService ;
15+ import com .codingapi .tx .netty .service .TxManagerHttpRequestHelper ;
1516import com .lorne .core .framework .utils .encode .Base64Utils ;
16- import com .lorne .core .framework .utils .http .HttpUtils ;
1717import org .springframework .beans .factory .annotation .Autowired ;
1818import org .springframework .stereotype .Service ;
1919
@@ -33,6 +33,8 @@ public class MQTxManagerServiceImpl implements MQTxManagerService {
3333 @ Autowired
3434 private CompensateService compensateService ;
3535
36+ @ Autowired
37+ private TxManagerHttpRequestHelper managerHelper ;
3638
3739
3840 @ Override
@@ -102,7 +104,8 @@ public int checkTransactionInfo(String groupId, String taskId) {
102104
103105 @ Override
104106 public int getTransaction (String groupId , String waitTaskId ) {
105- String json = HttpUtils .get (configReader .getTxUrl () + "getTransaction?groupId=" + groupId + "&taskId=" + waitTaskId );
107+
108+ String json = managerHelper .httpGet (configReader .getTxUrl () + "getTransaction?groupId=" + groupId + "&taskId=" + waitTaskId );
106109 if (json == null ) {
107110 return -2 ;
108111 }
@@ -117,8 +120,8 @@ public int getTransaction(String groupId, String waitTaskId) {
117120
118121 @ Override
119122 public int clearTransaction (String groupId , String waitTaskId , boolean isGroup ) {
120- String murl = configReader .getTxUrl () + "clearTransaction?groupId=" + groupId + "&taskId=" + waitTaskId + "&isGroup=" + (isGroup ? 1 : 0 );
121- String clearRes = HttpUtils . get ( murl );
123+ String url = configReader .getTxUrl () + "clearTransaction?groupId=" + groupId + "&taskId=" + waitTaskId + "&isGroup=" + (isGroup ? 1 : 0 );
124+ String clearRes = managerHelper . httpGet ( url );
122125 if (clearRes ==null ){
123126 return -1 ;
124127 }
@@ -128,8 +131,8 @@ public int clearTransaction(String groupId, String waitTaskId, boolean isGroup)
128131
129132 @ Override
130133 public String httpGetServer () {
131- String murl = configReader .getTxUrl () + "getServer" ;
132- return HttpUtils . get ( murl );
134+ String url = configReader .getTxUrl () + "getServer" ;
135+ return managerHelper . httpGet ( url );
133136 }
134137
135138 @ Override
@@ -150,7 +153,7 @@ public void sendCompensateMsg(String groupId, long time, TxTransactionInfo info)
150153
151154 CompensateInfo compensateInfo = new CompensateInfo (currentTime , modelName , uniqueKey , data , methodStr , className , groupId , address , time );
152155
153- String json = HttpUtils . post (configReader .getTxUrl () + "sendCompensateMsg" , compensateInfo .toParamsString ());
156+ String json = managerHelper . httpPost (configReader .getTxUrl () + "sendCompensateMsg" , compensateInfo .toParamsString ());
154157
155158 compensateInfo .setResJson (json );
156159
0 commit comments