diff --git a/coolstore-partner-dao/src/main/resources/mapper/ShopInfoMapper.xml b/coolstore-partner-dao/src/main/resources/mapper/ShopInfoMapper.xml
index 20bb1dbd7..f8673e868 100644
--- a/coolstore-partner-dao/src/main/resources/mapper/ShopInfoMapper.xml
+++ b/coolstore-partner-dao/src/main/resources/mapper/ShopInfoMapper.xml
@@ -278,7 +278,9 @@
from
xfsg_shop_info a
left join store_${enterpriseId} b on a.shop_code = b.store_num
- where b.store_id is not null and a.id in
+ where a.shop_code is not null
+ and a.shop_code !=''
+ and b.store_id is not null and a.id in
#{shopId}
diff --git a/coolstore-partner-service/src/main/java/com/cool/store/service/xinfa/XinFaDeviceService.java b/coolstore-partner-service/src/main/java/com/cool/store/service/xinfa/XinFaDeviceService.java
index 144b447d1..0c3d4667b 100644
--- a/coolstore-partner-service/src/main/java/com/cool/store/service/xinfa/XinFaDeviceService.java
+++ b/coolstore-partner-service/src/main/java/com/cool/store/service/xinfa/XinFaDeviceService.java
@@ -23,8 +23,10 @@ import org.springframework.web.bind.annotation.RequestParam;
import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import java.io.IOException;
+import java.net.SocketTimeoutException;
import java.text.MessageFormat;
import java.util.*;
+import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
/**
@@ -68,6 +70,12 @@ public class XinFaDeviceService {
private final Map accountMap = new HashMap<>();
+ private final OkHttpClient httpClient = new OkHttpClient.Builder()
+ .connectTimeout(10, TimeUnit.SECONDS)
+ .readTimeout(30, TimeUnit.SECONDS)
+ .writeTimeout(30, TimeUnit.SECONDS)
+ .build();
+
@PostConstruct
public void initAccountMap() {
accountMap.put("restaurant", new HuoMaAccountDTO(huoMaRestaurantStoresAccount, huoMaRestaurantStoresPassword));
@@ -102,7 +110,7 @@ public class XinFaDeviceService {
public List getStoreEquipmentDataByStoreNumList(List storeNumList, String token) {
Map> requestBody = new HashMap<>();
requestBody.put("codeList", storeNumList);
- String responseBody = sendPostRequestByToken(JSONObject.toJSONString(requestBody), huoMaGetPointTerminalUrl,token);
+ String responseBody = sendPostRequestNoRetryByToken(JSONObject.toJSONString(requestBody), huoMaGetPointTerminalUrl,token);
try{
ObjectMapper mapper = new ObjectMapper();
JsonNode rootNode = mapper.readTree(responseBody);
@@ -127,7 +135,7 @@ public class XinFaDeviceService {
}
}
StoreRequestDTO requestBody = new StoreRequestDTO("point_report", 0, 10, storeNum);
- String responseBody = sendPostRequestByToken(JSONObject.toJSONString(requestBody), huoMaGetStoreIdUrl,token);
+ String responseBody = sendPostRequestNoRetryByToken(JSONObject.toJSONString(requestBody), huoMaGetStoreIdUrl,token);
try{
Integer storeId = extractIdsFromResponse(responseBody);
redisUtilPool.hashSet(RedisConstant.HUO_MA_STORE_ID, storeNum, storeId.toString());
@@ -186,7 +194,7 @@ public class XinFaDeviceService {
TagDTO tagDTO = new TagDTO("DEFAULT", 0, 30,"program");
String responseBody = null;
try{
- responseBody = sendPostRequestByToken(JSONObject.toJSONString(tagDTO), huoMaGetTagUrl,token);
+ responseBody = sendPostRequestNoRetryByToken(JSONObject.toJSONString(tagDTO), huoMaGetTagUrl,token);
ObjectMapper mapper = new ObjectMapper();
JsonNode rootNode = mapper.readTree(responseBody);
@@ -238,7 +246,7 @@ public class XinFaDeviceService {
String token = getStoreToken(huoMaAccountDTO.getAccount(), huoMaAccountDTO.getPassword());
String responseBody = null;
try{
- responseBody = sendPostRequestByToken(JSONObject.toJSONString(programReqDTO), huoMaGetProgramUrl,token);
+ responseBody = sendPostRequestNoRetryByToken(JSONObject.toJSONString(programReqDTO), huoMaGetProgramUrl,token);
ObjectMapper mapper = new ObjectMapper();
JsonNode rootNode = mapper.readTree(responseBody);
@@ -270,7 +278,7 @@ public class XinFaDeviceService {
String token = getStoreToken(huoMaAccountDTO.getAccount(), huoMaAccountDTO.getPassword());
String responseBody = null;
try{
- responseBody = sendPostRequestByToken(JSONObject.toJSONString(publishDTO), huoMaGetPublishUrl,token);
+ responseBody = sendPostRequestNoRetryByToken(JSONObject.toJSONString(publishDTO), huoMaGetPublishUrl,token);
ObjectMapper mapper = new ObjectMapper();
JsonNode rootNode = mapper.readTree(responseBody);
int code = rootNode.get("code").asInt();
@@ -294,7 +302,7 @@ public class XinFaDeviceService {
StoreXinFaDetailRequestDTO storeXinFaDetailRequestDTO = new StoreXinFaDetailRequestDTO(0, 10, pointId);
String responseBody = null;
try{
- responseBody = sendPostRequestByToken(JSONObject.toJSONString(storeXinFaDetailRequestDTO), huoMaGetStoreXinFaDeviceDetailUrl,token);
+ responseBody = sendPostRequestNoRetryByToken(JSONObject.toJSONString(storeXinFaDetailRequestDTO), huoMaGetStoreXinFaDeviceDetailUrl,token);
ObjectMapper mapper = new ObjectMapper();
JsonNode rootNode = mapper.readTree(responseBody);
@@ -502,8 +510,8 @@ public class XinFaDeviceService {
}
@NotNull
- private static String sendPost(String requestUrl, Request request) {
- try (Response response = new OkHttpClient().newCall(request).execute()) {
+ private String sendPost(String requestUrl, Request request) {
+ try (Response response = httpClient.newCall(request).execute()) {
log.info("发起请求 time:{}", System.currentTimeMillis());
if (!response.isSuccessful()) {
log.info("HTTP请求失败,msg: " + response.message());
@@ -513,6 +521,9 @@ public class XinFaDeviceService {
String responseBody = response.body().string();
log.info("请求成功responseBody:{}", JSONObject.toJSONString(responseBody));
return responseBody;
+ } catch (SocketTimeoutException e) {
+ log.error("API调用超时 - URL: {}, 错误: {}", requestUrl, e.getMessage(), e);
+ throw new ServiceException(ErrorCodeEnum.THIRD_API_ERROR, "接口调用超时: " + e.getMessage());
} catch (ServiceException e) {
throw e;
} catch (Exception e) {
diff --git a/coolstore-partner-web/src/main/resources/application-ab.properties b/coolstore-partner-web/src/main/resources/application-ab.properties
index 02d7bbe98..b9fa41e38 100644
--- a/coolstore-partner-web/src/main/resources/application-ab.properties
+++ b/coolstore-partner-web/src/main/resources/application-ab.properties
@@ -150,9 +150,10 @@ huoMa.get.point.terminal.url = https://www.huoMayunping.com/api/terminal/getPoin
huoMa.get.tag.url = https://www.huomayunping.com/api/tag/search
huoMa.get.program.url = https://www.huomayunping.com/api/program/search
huoMa.get.publish.url = https://www.huomayunping.com/api/channelPublish/target/v2/quick-publish
-huoMa.direct.stores.account = 15370309163
-huoMa.direct.stores.password = Zx@123456.
-huoMa.franchise.stores.account = 13563273279
-huoMa.franchise.stores.password = Zx@123456.
-huoMa.restaurant.stores.account = 18656552865
-huoMa.restaurant.stores.password = ZX123456
+huoMa.direct.stores.account = 18375320931
+huoMa.direct.stores.password = Huoma@123456.
+huoMa.franchise.stores.account = 13345565081
+huoMa.franchise.stores.password = Huoma@123456.
+huoMa.restaurant.stores.account = 15167817007
+huoMa.restaurant.stores.password = Huoma@123456.
+
diff --git a/coolstore-partner-web/src/main/resources/application-online.properties b/coolstore-partner-web/src/main/resources/application-online.properties
index bb4f1e31f..8e0948fe6 100644
--- a/coolstore-partner-web/src/main/resources/application-online.properties
+++ b/coolstore-partner-web/src/main/resources/application-online.properties
@@ -153,9 +153,9 @@ huoMa.get.point.terminal.url = https://www.huoMayunping.com/api/terminal/getPoin
huoMa.get.tag.url = https://www.huomayunping.com/api/tag/search
huoMa.get.program.url = https://www.huomayunping.com/api/program/search
huoMa.get.publish.url = https://www.huomayunping.com/api/channelPublish/target/v2/quick-publish
-huoMa.direct.stores.account = 15370309163
-huoMa.direct.stores.password = Zx@123456.
-huoMa.franchise.stores.account = 13563273279
-huoMa.franchise.stores.password = Zx@123456.
-huoMa.restaurant.stores.account = 18656552865
-huoMa.restaurant.stores.password = ZX123456
\ No newline at end of file
+huoMa.direct.stores.account = 18375320931
+huoMa.direct.stores.password = Huoma@123456.
+huoMa.franchise.stores.account = 13345565081
+huoMa.franchise.stores.password = Huoma@123456.
+huoMa.restaurant.stores.account = 15167817007
+huoMa.restaurant.stores.password = Huoma@123456.
\ No newline at end of file
diff --git a/coolstore-partner-web/src/main/resources/application-test.properties b/coolstore-partner-web/src/main/resources/application-test.properties
index b9182bd10..c217e17df 100644
--- a/coolstore-partner-web/src/main/resources/application-test.properties
+++ b/coolstore-partner-web/src/main/resources/application-test.properties
@@ -163,9 +163,9 @@ huoMa.get.point.terminal.url = https://www.huoMayunping.com/api/terminal/getPoin
huoMa.get.tag.url = https://www.huomayunping.com/api/tag/search
huoMa.get.program.url = https://www.huomayunping.com/api/program/search
huoMa.get.publish.url = https://www.huomayunping.com/api/channelPublish/target/v2/quick-publish
-huoMa.direct.stores.account = 15370309163
-huoMa.direct.stores.password = Zx@123456.
-huoMa.franchise.stores.account = 13563273279
-huoMa.franchise.stores.password = Zx@123456.
-huoMa.restaurant.stores.account = 18656552865
-huoMa.restaurant.stores.password = ZX123456
+huoMa.direct.stores.account = 18375320931
+huoMa.direct.stores.password = Huoma@123456.
+huoMa.franchise.stores.account = 13345565081
+huoMa.franchise.stores.password = Huoma@123456.
+huoMa.restaurant.stores.account = 15167817007
+huoMa.restaurant.stores.password = Huoma@123456.