|
@@ -3,10 +3,16 @@ package nckd.jimin.jyyy.fi.common.util;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import kd.bos.algo.DataSet;
|
|
import kd.bos.algo.DataSet;
|
|
|
|
+import kd.bos.dataentity.entity.DynamicObject;
|
|
|
|
+import kd.bos.dataentity.entity.DynamicObjectCollection;
|
|
import kd.bos.dataentity.utils.StringUtils;
|
|
import kd.bos.dataentity.utils.StringUtils;
|
|
import kd.bos.entity.operate.result.IOperateInfo;
|
|
import kd.bos.entity.operate.result.IOperateInfo;
|
|
import kd.bos.entity.operate.result.OperateErrorInfo;
|
|
import kd.bos.entity.operate.result.OperateErrorInfo;
|
|
import kd.bos.entity.operate.result.OperationResult;
|
|
import kd.bos.entity.operate.result.OperationResult;
|
|
|
|
+import kd.bos.orm.query.QCP;
|
|
|
|
+import kd.bos.orm.query.QFilter;
|
|
|
|
+import kd.bos.servicehelper.BusinessDataServiceHelper;
|
|
|
|
+import kd.bos.servicehelper.QueryServiceHelper;
|
|
|
|
|
|
|
|
|
|
import java.util.*;
|
|
import java.util.*;
|
|
@@ -96,4 +102,36 @@ public class CommonUtils {
|
|
calendar.setTime(date);
|
|
calendar.setTime(date);
|
|
return calendar.get(filed);
|
|
return calendar.get(filed);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ public static DynamicObject getUserByHrPersonId(Object hrPersonId){
|
|
|
|
+ DynamicObject hrPersonInfo = QueryServiceHelper.queryOne("hrpi_person", "number", new QFilter("id", QCP.equals, hrPersonId).toArray());
|
|
|
|
+ if(hrPersonInfo == null){
|
|
|
|
+ return null;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ String personNumber = hrPersonInfo.getString("number");
|
|
|
|
+ if(StringUtils.isEmpty(personNumber)){
|
|
|
|
+ return null;
|
|
|
|
+ }
|
|
|
|
+ return BusinessDataServiceHelper.loadSingleFromCache("bos_user", new QFilter("number",QCP.equals,personNumber).toArray());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public static Map<Long,Long> getUserByHrPersonId(List hrPersonIdList){
|
|
|
|
+ DynamicObjectCollection hrPersonCol = QueryServiceHelper.query("hrpi_person", "number", new QFilter("id", QCP.in, hrPersonIdList).toArray());
|
|
|
|
+ if(hrPersonCol == null || hrPersonCol.size() == 0){
|
|
|
|
+ return null;
|
|
|
|
+ }
|
|
|
|
+ Map<Long, String> idNumberMap = hrPersonCol.stream().collect(Collectors.toMap(dyn -> dyn.getLong("id"), dyn -> dyn.getString("number"), (k1, k2) -> k1));
|
|
|
|
+ DynamicObjectCollection userCol = QueryServiceHelper.query("bos_user", "id,number",new QFilter("number", QCP.in, idNumberMap.values()).toArray() );
|
|
|
|
+ Map<String, Long> userNumberMap = userCol.stream().collect(Collectors.toMap(dyn -> dyn.getString("number"), dyn -> dyn.getLong("id"), (k1, k2) -> k1));
|
|
|
|
+ Map<Long, Long> idMap = new HashMap<>();
|
|
|
|
+ for(Map.Entry<Long, String> entryRow : idNumberMap.entrySet()){
|
|
|
|
+ Long personId = entryRow.getKey();
|
|
|
|
+ String personNumber = entryRow.getValue();
|
|
|
|
+ if(userNumberMap.containsKey(personNumber)){
|
|
|
|
+ idMap.put(personId,userNumberMap.get(personNumber));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return idMap;
|
|
|
|
+ }
|
|
}
|
|
}
|