74 lines
2.7 KiB
Java
74 lines
2.7 KiB
Java
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;
|
|
|
|
/**
|
|
* 考勤引用数据
|
|
* <p>Copyright: Copyright (c) 2022</p>
|
|
* <p>Company: 泛微软件</p>
|
|
*
|
|
* @author qiantao
|
|
* @version 1.0
|
|
**/
|
|
public class AttendQuoteDataBO {
|
|
|
|
@Override
|
|
public String toString() {
|
|
return "AttendQuoteDataBO{}";
|
|
}
|
|
|
|
/**
|
|
* 根据考勤模块来构建考勤数据
|
|
*/
|
|
public static void buildAttendDataFromRemote( List<Map<String, String>> list, List<AttendQuoteFieldPO> attendQuoteFields, List<Map<String, Object>> attendQuoteSyncData) {
|
|
if (CollectionUtils.isEmpty(list)) {
|
|
return;
|
|
}
|
|
list.forEach(m-> {
|
|
for (AttendQuoteFieldPO field : attendQuoteFields) {
|
|
if (StringUtils.isEmpty(field.getCode())) {
|
|
continue;
|
|
}
|
|
String key = field.getCode().replaceAll("_hour", "").replaceAll("_day", "").replaceAll("_leave", "");
|
|
if (m.containsKey(key) || m.containsKey("leaveHour"+key)) {
|
|
Map<String, Object> map = new LinkedHashMap<>();
|
|
map.put("employeeId", m.get("employeeid"));
|
|
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));
|
|
}else {
|
|
map.put("dataValue", m.get(0));
|
|
}
|
|
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;
|
|
// }
|
|
}
|