|
@@ -7,6 +7,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Component;
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
import cn.com.qmth.examcloud.commons.api.request.SyncBaseRequest;
|
|
import cn.com.qmth.examcloud.commons.api.request.SyncBaseRequest;
|
|
|
|
+import cn.com.qmth.examcloud.commons.base.exception.StatusException;
|
|
import cn.com.qmth.examcloud.commons.base.util.JsonUtil;
|
|
import cn.com.qmth.examcloud.commons.base.util.JsonUtil;
|
|
import cn.com.qmth.examcloud.task.base.AbstractTask;
|
|
import cn.com.qmth.examcloud.task.base.AbstractTask;
|
|
import cn.com.qmth.examcloud.task.base.ScheduleJob;
|
|
import cn.com.qmth.examcloud.task.base.ScheduleJob;
|
|
@@ -58,9 +59,14 @@ public class DataSyncTask extends AbstractTask {
|
|
Class<?> c = Class.forName(paramType);
|
|
Class<?> c = Class.forName(paramType);
|
|
Object obj = JsonUtil.fromJson(cur.getParamJson(), c);
|
|
Object obj = JsonUtil.fromJson(cur.getParamJson(), c);
|
|
SyncBaseRequest req = (SyncBaseRequest) obj;
|
|
SyncBaseRequest req = (SyncBaseRequest) obj;
|
|
- dataSyncService.sync(component, methodName, req, false);
|
|
|
|
|
|
+ boolean result = dataSyncService.sync(component, methodName, req, false);
|
|
|
|
+
|
|
|
|
+ if (result) {
|
|
|
|
+ dataSyncRepo.delete(cur);
|
|
|
|
+ } else {
|
|
|
|
+ throw new StatusException("T-102001", "同步失败");
|
|
|
|
+ }
|
|
|
|
|
|
- dataSyncRepo.delete(cur);
|
|
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|