|
@@ -0,0 +1,70 @@
|
|
|
+package com.persagy.proxy.migration.service.Impl;
|
|
|
+
|
|
|
+import cn.hutool.core.collection.CollUtil;
|
|
|
+import com.persagy.dmp.basic.model.QueryCriteria;
|
|
|
+import com.persagy.dmp.common.model.response.CommonResult;
|
|
|
+import com.persagy.dmp.migrate.client.DigitalMigrateLogFacade;
|
|
|
+import com.persagy.dmp.rwd.migrate.entity.SyncData;
|
|
|
+import com.persagy.proxy.adm.request.AdmResponse;
|
|
|
+import com.persagy.proxy.common.entity.InstanceUrlParam;
|
|
|
+import com.persagy.proxy.migration.service.ISyncDataService;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+
|
|
|
+import java.util.Collections;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @author lvxianyun
|
|
|
+ * @title: SyncDataServiceImpl
|
|
|
+ * @projectName adm-middleware
|
|
|
+ * @description: 数据迁移日志实现类
|
|
|
+ * @date 2021/12/21 12:03
|
|
|
+ */
|
|
|
+@Service
|
|
|
+public class SyncDataServiceImpl implements ISyncDataService {
|
|
|
+ /**
|
|
|
+ * 查询
|
|
|
+ *
|
|
|
+ * @param context
|
|
|
+ * @param queryCriteria
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public AdmResponse doQuery(InstanceUrlParam context, QueryCriteria queryCriteria) {
|
|
|
+ CommonResult<List<SyncData>> dmpResult = DigitalMigrateLogFacade.query(context.getGroupCode(),context.getProjectId(),context.getAppId(), context.getUserId(), queryCriteria);
|
|
|
+ List<SyncData> syncDataList = dmpResult.getData();
|
|
|
+ // 设置返回值
|
|
|
+ AdmResponse response = AdmResponse.success(syncDataList);
|
|
|
+ Long total = dmpResult.getCount() == null ? null : dmpResult.getCount().longValue();
|
|
|
+ if(queryCriteria.isOnlyCount()){
|
|
|
+ response.setTotal(null);
|
|
|
+ response.setCount(total);
|
|
|
+ }else {
|
|
|
+ response.setTotal(total);
|
|
|
+ }
|
|
|
+ response.setPageNumber(queryCriteria.getPage().intValue());
|
|
|
+ response.setPageSize(queryCriteria.getSize().intValue());
|
|
|
+ return response;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 新增
|
|
|
+ *
|
|
|
+ * @param context
|
|
|
+ * @param voList
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public List<SyncData> doInsert(InstanceUrlParam context, List<SyncData> voList) {
|
|
|
+ if(CollUtil.isEmpty(voList)) {
|
|
|
+ return Collections.emptyList();
|
|
|
+ }
|
|
|
+ // 调用中台新增
|
|
|
+ List<SyncData> syncDataList = DigitalMigrateLogFacade.create(context.getGroupCode(),context.getProjectId(),context.getAppId(), context.getUserId(), voList);
|
|
|
+
|
|
|
+ if(CollUtil.isEmpty(syncDataList)) {
|
|
|
+ throw new RuntimeException("调用中台更新迁移日志出错");
|
|
|
+ }
|
|
|
+ return syncDataList;
|
|
|
+ }
|
|
|
+}
|