package com.engine.salary.entity.datacollection.bo; import com.engine.salary.entity.datacollection.po.AttendQuoteFieldPO; import com.engine.salary.util.JsonUtil; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; /** * @Description: 考勤引用数据 * @Author: wangxiangzhong * @Date: 2021/11/30 16:10 */ public class AttendQuoteDataBO { @Override public String toString() { return "AttendQuoteDataBO{}"; } /** * 根据考勤模块来构建考勤数据 * @param unit * @param dataMap * @param attendQuoteFields * @param attendQuoteSyncData */ public static void buildAttendDataFromRemote(String unit, Map dataMap, List attendQuoteFields, List> attendQuoteSyncData) { if (dataMap.containsKey("datas")) { List list = JsonUtil.parseList(dataMap.get("datas"), HashMap.class); if (CollectionUtils.isEmpty(list)) { return; } list.forEach(m-> { for (AttendQuoteFieldPO field : attendQuoteFields) { if (StringUtils.isEmpty(field.getCode())) { continue; } String key = field.getCode().replaceAll("_"+unit, "").replaceAll("_leave", ""); if (m.containsKey(key) || m.containsKey("leaveHour"+key)) { Map map = new LinkedHashMap<>(); map.put("employeeId", m.get("empId")); 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)); } 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; // } }