|
@@ -0,0 +1,59 @@
|
|
|
+package com.trade.client.tradingPlatform.service;
|
|
|
+
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.List;
|
|
|
+import java.util.stream.Collectors;
|
|
|
+
|
|
|
+import javax.annotation.Resource;
|
|
|
+
|
|
|
+import com.trade.client.consumer.domain.model.LoginUserInfo;
|
|
|
+import com.trade.client.security.utils.UserUtils;
|
|
|
+import com.trade.client.tradingPlatform.TradingPlatformService;
|
|
|
+import com.trade.common.exception.ServiceException;
|
|
|
+import com.trade.common.utils.bean.BeanCopyUtils;
|
|
|
+import com.trade.service.enterprise.domain.Enterprise;
|
|
|
+import com.trade.service.enterprise.service.EnterpriseBaseService;
|
|
|
+import org.slf4j.Logger;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+
|
|
|
+import com.trade.common.constant.HttpStatus;
|
|
|
+import com.trade.common.utils.LoggerUtil;
|
|
|
+import com.trade.service.tradingPlatform.domain.TradingPlatform;
|
|
|
+import com.trade.service.tradingPlatform.dto.*;
|
|
|
+import com.trade.service.tradingPlatform.service.TradingPlatformBaseService;
|
|
|
+
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 贸易平台服务实现类
|
|
|
+ *
|
|
|
+ * @author hlb
|
|
|
+ * @since 2024-06-05 17:00:44
|
|
|
+ */
|
|
|
+@Service("tradingPlatformService")
|
|
|
+public class TradingPlatformServiceImpl implements TradingPlatformService {
|
|
|
+
|
|
|
+ private static final Logger log = LoggerUtil.logger(LoggerUtil.LogFileNameEnum.SERVICES_LOG);
|
|
|
+ @Resource
|
|
|
+ private TradingPlatformBaseService tradingPlatformBaseService;
|
|
|
+ @Resource
|
|
|
+ private EnterpriseBaseService enterpriseBaseService;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<TradingPlatformDto> queryCanMatchTradingPlatforms() {
|
|
|
+ LoginUserInfo loginUserInfo = UserUtils.getLoginUser();
|
|
|
+ if (loginUserInfo == null) {
|
|
|
+ throw new ServiceException("请您重新登录", HttpStatus.BAD_REQUEST);
|
|
|
+ }
|
|
|
+ Enterprise enterprise = enterpriseBaseService.getEnterpriseByCustomerId(loginUserInfo.getCustomerUserId());
|
|
|
+ if (enterprise == null) {
|
|
|
+ throw new ServiceException("您没有关联的企业信息,请联系管理员", HttpStatus.BAD_REQUEST);
|
|
|
+ }
|
|
|
+ if (StrUtil.isEmpty(enterprise.getProxyDistrictCode())) {
|
|
|
+ return new ArrayList<>();
|
|
|
+ }
|
|
|
+ return tradingPlatformBaseService.lambdaQuery()
|
|
|
+ .eq(TradingPlatform::getDistrictCode, enterprise.getProxyDistrictCode()).list().stream()
|
|
|
+ .map(o -> BeanCopyUtils.copy(o, TradingPlatformDto.class)).collect(Collectors.toList());
|
|
|
+ }
|
|
|
+}
|