Переглянути джерело

数据迁移 查询删除日志 返回值调整为CommonResult

lvxianyun 2 роки тому
батько
коміт
f0835c96db

+ 2 - 2
adm-business/adm-middleware/src/main/java/com/persagy/proxy/migration/controller/DataMigrationController.java

@@ -204,7 +204,7 @@ public class DataMigrationController {
      *  return AdmResponse
      */
     @PostMapping("/log")
-    public AdmResponse queryMigrateForLog(@RequestBody QueryCriteria request) {
+    public CommonResult queryMigrateForLog(@RequestBody QueryCriteria request) {
         InstanceUrlParam context = AdmContextUtil.toDmpContext();
         return logService.queryMigrationLog(context, request);
     }
@@ -229,7 +229,7 @@ public class DataMigrationController {
      * @return
      */
     @PostMapping("/deleteLog")
-    public AdmResponse deleteMigrateForLog(@RequestBody QueryCriteria request) {
+    public CommonResult deleteMigrateForLog(@RequestBody QueryCriteria request) {
         InstanceUrlParam context = AdmContextUtil.toDmpContext();
         return logService.deleteMigrationLog(context, request);
     }

+ 3 - 4
adm-business/adm-middleware/src/main/java/com/persagy/proxy/migration/service/IMigrationLogService.java

@@ -1,8 +1,7 @@
 package com.persagy.proxy.migration.service;
 
 import com.persagy.dmp.basic.model.QueryCriteria;
-import com.persagy.proxy.adm.request.AdmQueryCriteria;
-import com.persagy.proxy.adm.request.AdmResponse;
+import com.persagy.dmp.common.model.response.CommonResult;
 import com.persagy.proxy.common.entity.InstanceUrlParam;
 
 /**
@@ -14,6 +13,6 @@ import com.persagy.proxy.common.entity.InstanceUrlParam;
  */
 public interface IMigrationLogService {
 
-    AdmResponse queryMigrationLog(InstanceUrlParam context, QueryCriteria queryCriteria);
-    AdmResponse deleteMigrationLog(InstanceUrlParam context, QueryCriteria queryCriteria);
+    CommonResult queryMigrationLog(InstanceUrlParam context, QueryCriteria queryCriteria);
+    CommonResult deleteMigrationLog(InstanceUrlParam context, QueryCriteria queryCriteria);
 }

+ 6 - 21
adm-business/adm-middleware/src/main/java/com/persagy/proxy/migration/service/Impl/MigrationLogServiceImpl.java

@@ -37,43 +37,28 @@ import java.util.stream.Collectors;
 @Slf4j
 public class MigrationLogServiceImpl implements IMigrationLogService {
     @Override
-    public AdmResponse queryMigrationLog(InstanceUrlParam context, QueryCriteria queryCriteria) {
+    public CommonResult queryMigrationLog(InstanceUrlParam context, QueryCriteria queryCriteria) {
         String groupCode = context.getGroupCode();
         String projectId = context.getProjectId();
         CommonResult<List<SyncData>> result = DigitalMigrateLogFacade.query(groupCode, projectId, context.getAppId(), context.getUserId(),queryCriteria);
         if(result.getResult().equals(DmpResult.SUCCESS)){
             if(CollUtil.isEmpty(result.getData())){
-                return AdmResponse.success();
+                return result;
             }
             // 处理返回值
             List<SyncData> syncDatas = result.getData();
             processSynDatas(groupCode, projectId, syncDatas);
-            AdmResponse response = AdmResponse.success(syncDatas);
-            Long total = result.getCount() == null ? null : result.getCount().longValue();
-            if(queryCriteria.isOnlyCount()){
-                response.setTotal(null);
-                response.setCount(total);
-            }else {
-                response.setTotal(total);
-            }
-            response.setPageNumber(queryCriteria.getPage() == null ? 0 : queryCriteria.getPage().intValue());
-            response.setPageSize(queryCriteria.getSize() == null ? 50 : queryCriteria.getSize().intValue());
-            return response;
-        } else {
-            return AdmResponse.failure(result.getMessage());
+            result.setData(syncDatas);
         }
+        return result;
     }
 
     @Override
-    public AdmResponse deleteMigrationLog(InstanceUrlParam context, QueryCriteria queryCriteria) {
+    public CommonResult deleteMigrationLog(InstanceUrlParam context, QueryCriteria queryCriteria) {
         String groupCode = context.getGroupCode();
         String projectId = context.getProjectId();
         CommonResult result = DigitalMigrateLogFacade.deleteAllLog(groupCode, projectId, context.getAppId(), context.getUserId(),queryCriteria);
-        if(result.getMessage().equals(DmpResult.SUCCESS)){
-            return AdmResponse.success();
-        }else{
-            return AdmResponse.failure(result.getMessage());
-        }
+        return result;
     }