Merge remote-tracking branch 'origin/cc_20250325_select' into cc_20250325_select

This commit is contained in:
shuo.wang
2025-04-16 19:27:42 +08:00
6 changed files with 40 additions and 6 deletions

View File

@@ -69,6 +69,13 @@ public interface ShopAccountService {
*/
Boolean pushData(AccountAuditDTO accountAuditDTO);
/**
* shopCode
* @param shopId
* @return
*/
String shopCodeToYlsCode(Long shopId);

View File

@@ -128,7 +128,7 @@ public class PushServiceImpl implements PushService {
@Override
public String getYlsToken(GetAccessTokenDTO dto) {
String apiUrl = ylsUrl + "XXX";
String apiUrl = ylsUrl + "/Store.axd?action=getToken";
return executeApiCall(apiUrl, dto, String.class, ylsUsername, ylsSecret);
}

View File

@@ -19,6 +19,7 @@ import com.cool.store.request.PostAndOrderRequest;
import com.cool.store.request.ZxjpApiRequest;
import com.cool.store.response.MiniShopsResponse;
import com.cool.store.service.*;
import com.cool.store.utils.StringUtil;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -228,5 +229,23 @@ public class ShopAccountServiceImpl implements ShopAccountService {
return Boolean.TRUE;
}
@Override
public String shopCodeToYlsCode(Long shopId) {
ShopInfoDO shopInfo = shopInfoDAO.getShopInfo(shopId);
if (Objects.isNull(shopInfo)){
throw new ServiceException(ErrorCodeEnum.SHOP_NOT_EXIST);
}
List<ShopAccountDO> accountDOS = shopAccountDAO.selectByShopId(shopId);
if (CollectionUtils.isEmpty(accountDOS)){
throw new ServiceException(ErrorCodeEnum.SYSTEM_DATA_ERROR);
}
Map<String, ShopAccountDO> map = accountDOS.stream().collect(Collectors.toMap(ShopAccountDO::getSystemName, data -> data));
ShopAccountDO shopAccountDO = map.get(ShopAccountEnum.YLS.getSystemName());
if (Objects.isNull(shopAccountDO)){
throw new ServiceException(ErrorCodeEnum.SYSTEM_DATA_ERROR);
}
return StringUtil.isEmpty(shopAccountDO.getAccount())?shopInfo.getShopCode():shopAccountDO.getAccount();
}
}