Browse Source

refactor(sit): 标品类替换

Tyx 6 days ago
parent
commit
295f4629a8

+ 4 - 6
code/swc/nckd-jxccl-swc/src/main/java/nckd/jxccl/sit/hcsi/business/importtaskguide/ImportTaskGuideExportService.java

@@ -13,8 +13,6 @@ import kd.bos.logging.Log;
 import kd.bos.logging.LogFactory;
 import kd.bos.logging.LogFactory;
 import kd.bos.orm.query.QFilter;
 import kd.bos.orm.query.QFilter;
 import kd.bos.orm.util.CollectionUtils;
 import kd.bos.orm.util.CollectionUtils;
-import kd.swc.hsbp.common.enums.SWCShowType;
-import kd.swc.hsbp.common.util.SWCStringUtils;
 import nckd.jxccl.base.sit.helper.SITExportDataHelper;
 import nckd.jxccl.base.sit.helper.SITExportDataHelper;
 import nckd.jxccl.sit.hcsi.business.importtaskguide.utils.ImportTaskUtils;
 import nckd.jxccl.sit.hcsi.business.importtaskguide.utils.ImportTaskUtils;
 import nckd.jxccl.sit.hcsi.common.constant.enums.DataTypeEnum;
 import nckd.jxccl.sit.hcsi.common.constant.enums.DataTypeEnum;
@@ -377,21 +375,21 @@ public class ImportTaskGuideExportService {
         DataFormat dataFormat = wb.createDataFormat();
         DataFormat dataFormat = wb.createDataFormat();
         short format;
         short format;
         if (!isTmpl) {
         if (!isTmpl) {
-            if (SWCStringUtils.equals(SWCShowType.DATE.getCode(), columnType)) {
+            if (StringUtils.equals(SITShowType.DATE.getCode(), columnType)) {
                 format = dataFormat.getFormat("yyyy-MM-dd");
                 format = dataFormat.getFormat("yyyy-MM-dd");
             } else {
             } else {
                 String amountFormat;
                 String amountFormat;
-                if (SWCStringUtils.equals(SWCShowType.AMOUNT.getCode(), columnType)) {
+                if (StringUtils.equals(SITShowType.AMOUNT.getCode(), columnType)) {
                     amountFormat = getAmountFormat(precision);
                     amountFormat = getAmountFormat(precision);
                     format = dataFormat.getFormat(amountFormat);
                     format = dataFormat.getFormat(amountFormat);
-                } else if (SWCStringUtils.equals(SWCShowType.NUM.getCode(), columnType)) {
+                } else if (StringUtils.equals(SITShowType.NUM.getCode(), columnType)) {
                     amountFormat = getAmountFormat(scale);
                     amountFormat = getAmountFormat(scale);
                     format = dataFormat.getFormat(amountFormat);
                     format = dataFormat.getFormat(amountFormat);
                 } else {
                 } else {
                     format = dataFormat.getFormat("text");
                     format = dataFormat.getFormat("text");
                 }
                 }
             }
             }
-        } else if (SWCStringUtils.equals(SWCShowType.DATE.getCode(), columnType)) {
+        } else if (StringUtils.equals(SITShowType.DATE.getCode(), columnType)) {
             format = dataFormat.getFormat("yyyy-MM-dd");
             format = dataFormat.getFormat("yyyy-MM-dd");
         } else {
         } else {
             format = dataFormat.getFormat("text");
             format = dataFormat.getFormat("text");

+ 3 - 3
code/swc/nckd-jxccl-swc/src/main/java/nckd/jxccl/sit/hcsi/business/importtaskguide/ImportTaskGuideImportService.java

@@ -131,7 +131,7 @@ public class ImportTaskGuideImportService {
             if (!this.isCancel(cacheKey)) {
             if (!this.isCancel(cacheKey)) {
                 if (errDataList.size() > 0) {
                 if (errDataList.size() > 0) {
                     String fileUrl = service.getImportErrorExcelFile(dataHeadList, dataRowList, errDataList, migrationTplData.getInt("nckd_startline") - 2, writeTaskType, columnIndexMap, hasWorkStartDate);
                     String fileUrl = service.getImportErrorExcelFile(dataHeadList, dataRowList, errDataList, migrationTplData.getInt("nckd_startline") - 2, writeTaskType, columnIndexMap, hasWorkStartDate);
-                    kd.swc.hsas.business.importtaskguide.utils.ImportTaskUtils.updateImportDataProgress(0, 0, cacheKey, fileUrl);
+                    ImportTaskUtils.updateImportDataProgress(0, 0, cacheKey, fileUrl);
                 }
                 }
 
 
                 logger.info("importData end,importTaskId={}", this.importTaskId);
                 logger.info("importData end,importTaskId={}", this.importTaskId);
@@ -189,7 +189,7 @@ public class ImportTaskGuideImportService {
             return;
             return;
         } finally {
         } finally {
             allErrDataList.addAll(errDataList);
             allErrDataList.addAll(errDataList);
-            kd.swc.hsas.business.importtaskguide.utils.ImportTaskUtils.updateImportDataProgress(successCount, failCount, cacheKey, (String)null);
+            ImportTaskUtils.updateImportDataProgress(successCount, failCount, cacheKey, (String)null);
         }
         }
     }
     }
 
 
@@ -305,7 +305,7 @@ public class ImportTaskGuideImportService {
     }
     }
 
 
     private Map<Integer, List<Map<String, String>>> getColumnIndexMap() {
     private Map<Integer, List<Map<String, String>>> getColumnIndexMap() {
-        List<Map<String, String>> columnHeadList = kd.swc.hsas.business.importtaskguide.utils.ImportTaskUtils.getColumnHeadList(this.sinsurTplId, this.importTaskId);
+        List<Map<String, String>> columnHeadList = ImportTaskUtils.getColumnHeadList(this.sinsurTplId, this.importTaskId);
         Map<Integer, List<Map<String, String>>> columnIndexMap = new HashMap(columnHeadList.size());
         Map<Integer, List<Map<String, String>>> columnIndexMap = new HashMap(columnHeadList.size());
         List<Map<String, String>> tempMapList = null;
         List<Map<String, String>> tempMapList = null;
         Iterator var4 = columnHeadList.iterator();
         Iterator var4 = columnHeadList.iterator();

+ 47 - 0
code/swc/nckd-jxccl-swc/src/main/java/nckd/jxccl/sit/hcsi/business/importtaskguide/utils/ImportTaskUtils.java

@@ -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();

+ 1 - 1
code/wtc/nckd-jxccl-wtc/src/main/java/nckd/jxccl/wtc/wtabm/vaapply/VaApplyBillEditEx.java

@@ -11,8 +11,8 @@ import kd.bos.form.operate.AbstractOperate;
 import kd.bos.logging.Log;
 import kd.bos.logging.Log;
 import kd.bos.logging.LogFactory;
 import kd.bos.logging.LogFactory;
 import kd.hr.hbp.formplugin.web.HRCoreBaseBillEdit;
 import kd.hr.hbp.formplugin.web.HRCoreBaseBillEdit;
-import kd.wtc.wtbs.common.util.third.util.StringUtils;
 import nckd.jxccl.wtc.wtabm.web.common.util.WtcUtils;
 import nckd.jxccl.wtc.wtabm.web.common.util.WtcUtils;
+import org.apache.commons.lang3.StringUtils;
 
 
 import java.util.Date;
 import java.util.Date;
 
 

+ 38 - 1
code/wtc/nckd-jxccl-wtc/src/main/java/nckd/jxccl/wtc/wtabm/web/common/util/WtcUtils.java

@@ -2,6 +2,9 @@ package nckd.jxccl.wtc.wtabm.web.common.util;
 
 
 import kd.bos.dataentity.entity.DynamicObject;
 import kd.bos.dataentity.entity.DynamicObject;
 import kd.bos.dataentity.entity.DynamicObjectCollection;
 import kd.bos.dataentity.entity.DynamicObjectCollection;
+import kd.bos.dataentity.resource.ResManager;
+import kd.bos.entity.datamodel.IDataModel;
+import kd.bos.form.IFormView;
 import kd.bos.logging.Log;
 import kd.bos.logging.Log;
 import kd.bos.logging.LogFactory;
 import kd.bos.logging.LogFactory;
 import kd.bos.orm.query.QCP;
 import kd.bos.orm.query.QCP;
@@ -9,6 +12,9 @@ import kd.bos.orm.query.QFilter;
 import kd.bos.servicehelper.BusinessDataServiceHelper;
 import kd.bos.servicehelper.BusinessDataServiceHelper;
 import kd.bos.servicehelper.QueryServiceHelper;
 import kd.bos.servicehelper.QueryServiceHelper;
 import kd.hr.haos.business.domain.adminorg.service.impl.AdminOrgQueryServiceHelper;
 import kd.hr.haos.business.domain.adminorg.service.impl.AdminOrgQueryServiceHelper;
+import kd.hr.hbp.common.util.HRDateTimeUtils;
+import kd.hr.hbp.common.util.HRStringUtils;
+import kd.wtc.wtbs.common.helper.WTCAppContextHelper;
 import org.apache.commons.lang3.ObjectUtils;
 import org.apache.commons.lang3.ObjectUtils;
 
 
 import java.time.LocalDate;
 import java.time.LocalDate;
@@ -92,7 +98,6 @@ public class WtcUtils {
 
 
     /**
     /**
      * 获取下级组织
      * 获取下级组织
-     *
      * @param adminOrgDyn
      * @param adminOrgDyn
      * @return
      * @return
      */
      */
@@ -104,5 +109,37 @@ public class WtcUtils {
         return subOrgIdset;
         return subOrgIdset;
     }
     }
 
 
+    public static boolean checkQwndate(String beginDateKer, String endDateKer, IFormView view, String changeKey) {
+        if (!HRStringUtils.isEmpty(beginDateKer) && !HRStringUtils.isEmpty(endDateKer) && view != null) {
+            IDataModel model = view.getModel();
+            Date beginDate = model.getDataEntity().getDate(beginDateKer);
+            Date endDate = model.getDataEntity().getDate(endDateKer);
+            if (beginDate != null && endDate != null) {
+                int addMonth;
+                try {
+                    addMonth = WTCAppContextHelper.getWTCParamWithSystemCompat().getIntValue("kd.wtc.wtte.attreport.queryRangeMonth", 1);
+                    if (addMonth <= 0) {
+                        addMonth = 1;
+                    }
+                } catch (Exception var9) {
+                    addMonth = 1;
+                }
+
+                Date date = HRDateTimeUtils.addMonth(beginDate, addMonth);
+                if (!endDate.before(date)) {
+                    model.setValue(changeKey, (Object)null);
+                    view.showTipNotification(ResManager.loadKDString("查询日期跨度不能超过{0}个月。", "AttrecordConstants_02", "wtc-wtte-common", new Object[]{addMonth}));
+                    return false;
+                } else {
+                    return true;
+                }
+            } else {
+                return true;
+            }
+        } else {
+            return true;
+        }
+    }
+
 
 
 }
 }

+ 4 - 5
code/wtc/nckd-jxccl-wtc/src/main/java/nckd/jxccl/wtc/wtte/report/AttendanceRateReportFormPlugin.java

@@ -1,5 +1,6 @@
 package nckd.jxccl.wtc.wtte.report;
 package nckd.jxccl.wtc.wtte.report;
 
 
+import com.google.common.collect.Sets;
 import kd.bos.dataentity.resource.ResManager;
 import kd.bos.dataentity.resource.ResManager;
 import kd.bos.entity.datamodel.IDataModel;
 import kd.bos.entity.datamodel.IDataModel;
 import kd.bos.entity.datamodel.events.PropertyChangedArgs;
 import kd.bos.entity.datamodel.events.PropertyChangedArgs;
@@ -12,9 +13,7 @@ import kd.bos.report.ReportList;
 import kd.bos.report.ReportShowParameter;
 import kd.bos.report.ReportShowParameter;
 import kd.bos.report.plugin.AbstractReportFormPlugin;
 import kd.bos.report.plugin.AbstractReportFormPlugin;
 import kd.hr.hbp.common.util.HRStringUtils;
 import kd.hr.hbp.common.util.HRStringUtils;
-import kd.sdk.plugin.Plugin;
-import kd.wtc.wtbs.common.util.third.collect.Sets;
-import kd.wtc.wtte.business.viewcalsteps.AttRecordUtils;
+import nckd.jxccl.wtc.wtabm.web.common.util.WtcUtils;
 
 
 import java.util.EventObject;
 import java.util.EventObject;
 import java.util.Iterator;
 import java.util.Iterator;
@@ -51,10 +50,10 @@ public class AttendanceRateReportFormPlugin extends AbstractReportFormPlugin imp
         clearViewKey(name, this.getModel());
         clearViewKey(name, this.getModel());
         switch (name) {
         switch (name) {
             case "nckd_owndatestart":
             case "nckd_owndatestart":
-                AttRecordUtils.checkQwndate("nckd_owndatestart", "nckd_owndateend", this.getView(), name);
+                WtcUtils.checkQwndate("nckd_owndatestart", "nckd_owndateend", this.getView(), name);
                 break;
                 break;
             case "nckd_owndateend":
             case "nckd_owndateend":
-                AttRecordUtils.checkQwndate("nckd_owndatestart", "nckd_owndateend", this.getView(), name);
+                WtcUtils.checkQwndate("nckd_owndatestart", "nckd_owndateend", this.getView(), name);
         }
         }
     }
     }