weaver-hrm-salary/src/com/engine/salary/entity/datacollection/bo/AttendQuoteDataBO.java

74 lines
2.7 KiB
Java
Raw Normal View History

2022-04-21 20:29:11 +08:00
package com.engine.salary.entity.datacollection.bo;
import com.engine.salary.entity.datacollection.po.AttendQuoteFieldPO;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
/**
2022-04-24 17:42:32 +08:00
* 考勤引用数据
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
2022-04-21 20:29:11 +08:00
public class AttendQuoteDataBO {
@Override
public String toString() {
return "AttendQuoteDataBO{}";
}
/**
* 根据考勤模块来构建考勤数据
*/
2022-04-24 17:42:32 +08:00
public static void buildAttendDataFromRemote( List<Map<String, Object>> list, List<AttendQuoteFieldPO> attendQuoteFields, List<Map<String, Object>> attendQuoteSyncData) {
2022-04-21 20:29:11 +08:00
if (CollectionUtils.isEmpty(list)) {
return;
}
list.forEach(m-> {
for (AttendQuoteFieldPO field : attendQuoteFields) {
if (StringUtils.isEmpty(field.getCode())) {
continue;
}
2022-04-24 17:42:32 +08:00
String key = field.getCode().replaceAll("_hour", "").replaceAll("_day", "").replaceAll("_leave", "");
2022-04-21 20:29:11 +08:00
if (m.containsKey(key) || m.containsKey("leaveHour"+key)) {
Map<String, Object> map = new LinkedHashMap<>();
2022-04-24 17:42:32 +08:00
map.put("employeeId", m.get("employeeid"));
2022-04-21 20:29:11 +08:00
map.put("attendQuoteFieldId", field.getId());
if (m.containsKey(key)) {
map.put("dataValue", m.get(key));
} else if (m.containsKey("leaveHour"+key)) {
map.put("dataValue", m.get("leaveHour"+key));
2022-04-24 17:42:32 +08:00
}else {
map.put("dataValue", m.get(0));
2022-04-21 20:29:11 +08:00
}
attendQuoteSyncData.add(map);
}
}
});
}
// public static SimpleEmployee getCurrentUser4Remote() {
// SimpleEmployee se = UserContext.getCurrentUser();
// if(se != null){
// SimpleEmployee simple = new SimpleEmployee();
// simple.setId(se.getId());
// simple.setUserId(se.getUserId());
// simple.setUsername(se.getUsername());
// simple.setPinyin(se.getPinyin());
// simple.setImUid(se.getImUid());
// simple.setImCid(se.getImCid());
// simple.setTenantKey(se.getTenantKey());
// simple.setDepartment(se.getDepartment());
// simple.setAuthorities(null);
// return simple;
// }
// return null;
// }
}