|
@@ -7,6 +7,7 @@ import kd.bos.dataentity.serialization.SerializationUtils;
|
|
|
import kd.bos.entity.EntityType;
|
|
import kd.bos.entity.EntityType;
|
|
|
import kd.bos.orm.query.QFilter;
|
|
import kd.bos.orm.query.QFilter;
|
|
|
import kd.bos.util.StringUtils;
|
|
import kd.bos.util.StringUtils;
|
|
|
|
|
+import kd.hr.hbp.business.bgtask.HRBackgroundTaskHelper;
|
|
|
import kd.hr.hbp.business.servicehelper.HRBaseServiceHelper;
|
|
import kd.hr.hbp.business.servicehelper.HRBaseServiceHelper;
|
|
|
import kd.hr.hbp.common.cache.IHRAppCache;
|
|
import kd.hr.hbp.common.cache.IHRAppCache;
|
|
|
import kd.hr.hbp.common.cache.HRAppCache;
|
|
import kd.hr.hbp.common.cache.HRAppCache;
|
|
@@ -282,6 +283,52 @@ public class ImportTaskUtils {
|
|
|
taskHelper.updateOne(task);
|
|
taskHelper.updateOne(task);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
+ public static synchronized void updateImportDataProgress(int successCount, int failCount, String cacheKey, String fileUrl) {
|
|
|
|
|
+ IHRAppCache appCache = HRAppCache.get(String.format(Locale.ROOT, "import_cache_%s", cacheKey));
|
|
|
|
|
+ Integer existSuccCount = (Integer)appCache.get("successCount", Integer.class);
|
|
|
|
|
+ Integer existFailCount = (Integer)appCache.get("failCount", Integer.class);
|
|
|
|
|
+ if (existSuccCount == null) {
|
|
|
|
|
+ existSuccCount = 0;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (existFailCount == null) {
|
|
|
|
|
+ existFailCount = 0;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ existSuccCount = existSuccCount + successCount;
|
|
|
|
|
+ existFailCount = existFailCount + failCount;
|
|
|
|
|
+ appCache.put("successCount", existSuccCount);
|
|
|
|
|
+ appCache.put("failCount", existFailCount);
|
|
|
|
|
+ if (fileUrl != null) {
|
|
|
|
|
+ appCache.put("fileUrl", fileUrl);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ Integer sumCount = existSuccCount + existFailCount;
|
|
|
|
|
+ IHRAppCache bgAppCache = HRAppCache.get(String.format(Locale.ROOT, "bggroud_taskid_%s", cacheKey));
|
|
|
|
|
+ String bgTaskId = (String)bgAppCache.get("bgTaskId", String.class);
|
|
|
|
|
+ if (StringUtils.isNotEmpty(bgTaskId)) {
|
|
|
|
|
+ Integer totalCount = bgAppCache.get("totalCount", Integer.class) == null ? 0 : (Integer)bgAppCache.get("totalCount", Integer.class);
|
|
|
|
|
+ if (totalCount == 0) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ int progress;
|
|
|
|
|
+ if (sumCount.equals(totalCount)) {
|
|
|
|
|
+ progress = 100;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ progress = sumCount * 100 / totalCount;
|
|
|
|
|
+ if (progress == 100) {
|
|
|
|
|
+ progress = 99;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ HRBackgroundTaskHelper.getInstance().feedbackProgress(bgTaskId, progress, "", (Map)null);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
public static String join(Set<String> set, String str) {
|
|
public static String join(Set<String> set, String str) {
|
|
|
if (null != set && set.size() != 0) {
|
|
if (null != set && set.size() != 0) {
|
|
|
StringBuilder result = new StringBuilder();
|
|
StringBuilder result = new StringBuilder();
|