|
@@ -5,21 +5,27 @@ import com.alibaba.druid.util.StringUtils;
|
|
import com.qhtx.eta.common.constant.ETAConstants;
|
|
import com.qhtx.eta.common.constant.ETAConstants;
|
|
import com.qhtx.eta.common.eunms.ErrorEnum;
|
|
import com.qhtx.eta.common.eunms.ErrorEnum;
|
|
import com.qhtx.eta.common.exception.ETAException;
|
|
import com.qhtx.eta.common.exception.ETAException;
|
|
|
|
+import com.qhtx.eta.domain.annotation.DomainTransDataSource;
|
|
|
|
+import com.qhtx.eta.domain.convert.DWIndexDTOConverter;
|
|
import com.qhtx.eta.domain.convert.DWIndexFrameDTOConverter;
|
|
import com.qhtx.eta.domain.convert.DWIndexFrameDTOConverter;
|
|
|
|
+import com.qhtx.eta.domain.entity.DWIndexDTO;
|
|
import com.qhtx.eta.domain.entity.DWIndexFrameDTO;
|
|
import com.qhtx.eta.domain.entity.DWIndexFrameDTO;
|
|
import com.qhtx.eta.domain.service.DWIndexFrameService;
|
|
import com.qhtx.eta.domain.service.DWIndexFrameService;
|
|
import com.qhtx.eta.domain.utils.RedisUtils;
|
|
import com.qhtx.eta.domain.utils.RedisUtils;
|
|
-import com.qhtx.eta.infra.annotation.UseDataSource;
|
|
|
|
import com.qhtx.eta.infra.datasource.DataSourceContextHolder;
|
|
import com.qhtx.eta.infra.datasource.DataSourceContextHolder;
|
|
|
|
+import com.qhtx.eta.infra.entity.dw.DWIndex;
|
|
import com.qhtx.eta.infra.entity.dw.DWIndexFrame;
|
|
import com.qhtx.eta.infra.entity.dw.DWIndexFrame;
|
|
import com.qhtx.eta.infra.entity.dw.ETAClassifyIndexFrameMapping;
|
|
import com.qhtx.eta.infra.entity.dw.ETAClassifyIndexFrameMapping;
|
|
|
|
+import com.qhtx.eta.infra.entity.dw.TEtaIndexPushTask;
|
|
import com.qhtx.eta.infra.service.EtaApiClassifyService;
|
|
import com.qhtx.eta.infra.service.EtaApiClassifyService;
|
|
import com.qhtx.eta.infra.service.IndexFrameService;
|
|
import com.qhtx.eta.infra.service.IndexFrameService;
|
|
|
|
+import com.qhtx.eta.infra.service.TEtaIndexPushTaskService;
|
|
import lombok.Data;
|
|
import lombok.Data;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.jetbrains.annotations.NotNull;
|
|
import org.jetbrains.annotations.NotNull;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.transaction.TransactionStatus;
|
|
import org.springframework.transaction.TransactionStatus;
|
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.support.TransactionCallbackWithoutResult;
|
|
import org.springframework.transaction.support.TransactionCallbackWithoutResult;
|
|
import org.springframework.transaction.support.TransactionTemplate;
|
|
import org.springframework.transaction.support.TransactionTemplate;
|
|
import org.springframework.util.CollectionUtils;
|
|
import org.springframework.util.CollectionUtils;
|
|
@@ -34,7 +40,6 @@ import com.qhtx.eta.common.eunms.DataSourceType;
|
|
|
|
|
|
@Service
|
|
@Service
|
|
@Slf4j
|
|
@Slf4j
|
|
-@UseDataSource(dataSourceType = DataSourceType.DW)
|
|
|
|
public class DWIndexFrameServiceImpl implements DWIndexFrameService {
|
|
public class DWIndexFrameServiceImpl implements DWIndexFrameService {
|
|
|
|
|
|
@Resource
|
|
@Resource
|
|
@@ -49,6 +54,8 @@ public class DWIndexFrameServiceImpl implements DWIndexFrameService {
|
|
@Resource
|
|
@Resource
|
|
private EtaApiClassifyService etaApiClassifyService;
|
|
private EtaApiClassifyService etaApiClassifyService;
|
|
|
|
|
|
|
|
+ @Resource
|
|
|
|
+ private TEtaIndexPushTaskService etaIndexPushTaskService;
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public void syncIndexFrame() {
|
|
public void syncIndexFrame() {
|
|
@@ -117,6 +124,21 @@ public class DWIndexFrameServiceImpl implements DWIndexFrameService {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public DWIndex getIndexByIndexCode(String indexCode) {
|
|
|
|
+
|
|
|
|
+ return indexFrameService.getIndexByIndexCode(indexCode);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
|
+ public DWIndexDTO pushIndexToEta(String indexCode) {
|
|
|
|
+ DWIndex dwIndex = indexFrameService.getIndexByIndexCode(indexCode);
|
|
|
|
+ DWIndexDTO dwIndexDTO = DWIndexDTOConverter.INSTANCE.convertToDTO(dwIndex);
|
|
|
|
+ TEtaIndexPushTask tEtaIndexPushTask = DWIndexDTOConverter.INSTANCE.convertToTEtaIndexPushTask(dwIndexDTO);
|
|
|
|
+ etaIndexPushTaskService.insert(tEtaIndexPushTask);
|
|
|
|
+ return DWIndexDTOConverter.INSTANCE.convertToDTO(dwIndex);
|
|
|
|
+ }
|
|
|
|
|
|
private List<DWIndexFrameDTO> parseList(FrameNode node) {
|
|
private List<DWIndexFrameDTO> parseList(FrameNode node) {
|
|
if (node == null) {
|
|
if (node == null) {
|