Merge branch 'cc_20251110_bugfix' into 'master'

Cc 20251110 bugfix

See merge request hangzhou/java/custom_zxjp!187
This commit is contained in:
苏竹红
2025-11-12 09:38:24 +00:00
5 changed files with 41 additions and 27 deletions

View File

@@ -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
<foreach collection="shopIds" item="shopId" separator="," open="(" close=")">
#{shopId}
</foreach>

View File

@@ -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<String, HuoMaAccountDTO> 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<StoreEquipmentDTO> getStoreEquipmentDataByStoreNumList(List<String> storeNumList, String token) {
Map<String,List<String>> 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) {

View File

@@ -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.

View File

@@ -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
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.

View File

@@ -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.