考勤引用修复

This commit is contained in:
钱涛 2022-06-13 10:52:32 +08:00
parent cea24499f7
commit 081747b334
3 changed files with 29 additions and 24 deletions

View File

@ -1,5 +1,6 @@
package com.engine.salary.remote.attend.service.impl;
import com.alibaba.druid.support.json.JSONUtils;
import com.alibaba.fastjson.JSONObject;
import com.engine.core.impl.Service;
import com.engine.salary.remote.attend.cmd.GetKQReportCmd;
@ -8,12 +9,14 @@ import com.engine.salary.remote.attend.service.RemoteAttend4SalaryService;
import com.engine.salary.util.SalaryDateUtil;
import com.engine.salary.util.valid.ValidUtil;
import com.google.common.collect.Maps;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import java.util.*;
import java.util.stream.Collectors;
@Slf4j
public class RemoteAttend4SalaryServiceImpl extends Service implements RemoteAttend4SalaryService {
@ -50,7 +53,7 @@ public class RemoteAttend4SalaryServiceImpl extends Service implements RemoteAtt
}
}
//加班
else if (dataIndex.equals("overtime")&& column.get("children") != null) {
else if (dataIndex.equals("overtime") && column.get("children") != null) {
List<Map> list = (List<Map>) column.get("children");
if (CollectionUtils.isNotEmpty(list)) {
list.stream()
@ -77,28 +80,33 @@ public class RemoteAttend4SalaryServiceImpl extends Service implements RemoteAtt
}
@Override
public List<Map<String,String>> getDatas(Attend4Salary attend4Salary) {
public List<Map<String, String>> getDatas(Attend4Salary attend4Salary) {
ValidUtil.doValidator(attend4Salary);
Map<String, Object> paramsMap = new HashMap<String, Object>();
log.info("开始获取的考勤数据,参数{}", attend4Salary);
List<Map<String, String>> list = new ArrayList<>();
try {
Map<String, Object> paramsMap = new HashMap<String, Object>();
// paramsMap.put("pageIndex", 1);
// paramsMap.put("pageSize", 500);
paramsMap.put("typeselect", "6");
paramsMap.put("fromDate", SalaryDateUtil.getFormatLocalDate(attend4Salary.getBeginDate()));
paramsMap.put("toDate", SalaryDateUtil.getFormatLocalDate(attend4Salary.getEndDate()));
paramsMap.put("viewScope", "3");
List<String> resourceIds = attend4Salary.getOnlyEmpIds().stream().map(String::valueOf).collect(Collectors.toList());
paramsMap.put("resourceId", String.join(",", resourceIds));
paramsMap.put("isNoAccount", "1");
paramsMap.put("attendanceSerial", "");
paramsMap.put("isFromMyAttendance", "1");
Map<String, Object> temp = new HashMap<String, Object>();
temp.put("data", JSONObject.toJSONString(paramsMap));
temp.put("reportType", "month");
paramsMap.put("typeselect", "6");
paramsMap.put("fromDate", SalaryDateUtil.getFormatLocalDate(attend4Salary.getBeginDate()));
paramsMap.put("toDate", SalaryDateUtil.getFormatLocalDate(attend4Salary.getEndDate()));
paramsMap.put("viewScope", "3");
List<String> resourceIds = attend4Salary.getOnlyEmpIds().stream().map(String::valueOf).collect(Collectors.toList());
paramsMap.put("resourceId", String.join(",", resourceIds));
paramsMap.put("isNoAccount", "1");
paramsMap.put("attendanceSerial", "");
paramsMap.put("isFromMyAttendance", "1");
Map<String, Object> temp = new HashMap<String, Object>();
temp.put("data", JSONObject.toJSONString(paramsMap));
temp.put("reportType", "month");
list = (List<Map<String, String>>) commandExecutor.execute(new GetKQReportCmd(temp, user)).get("datas");
log.info("获取的考勤数据,{}", JSONUtils.toJSONString(list));
} catch (Exception e) {
log.error("获取考勤数据失败", e);
}
List<Map<String,String>> list = (List<Map<String,String>>)commandExecutor.execute(new GetKQReportCmd(temp, user)).get("datas");
return list;

View File

@ -419,7 +419,7 @@ public class AttendQuoteDataServiceImpl extends Service implements AttendQuoteDa
// AttendQuoteDataBO.buildAttendDataFromRemote("day", attendResult.getData(), attendQuoteFields, attendQuoteSyncData);
}
} catch (Exception e) {
log.error("获取考勤数据错误失败:{}", String.format("参数:%s,错误信息:%s", JSONObject.toJSONString(attend4Salary), e.getMessage()));
log.error("获取考勤数据错误失败:{}", String.format("参数:%s,错误信息:%s", JSONObject.toJSONString(attend4Salary), e.getMessage()),e);
return attendQuoteSyncData;
}
log.info("同步的考勤数据:{}", JSONUtils.toJSONString(attendQuoteSyncData));

View File

@ -22,10 +22,7 @@ import org.apache.commons.collections4.CollectionUtils;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import weaver.hrm.User;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
/**
* 考勤数据
@ -86,7 +83,7 @@ public class AttendQuoteDataWrapper extends Service {
columns.add(new WeaTableColumn("150", SalaryI18nUtil.getI18nLabel(86317, "工号"), "jobNum"));
// 动态列
if (CollectionUtils.isNotEmpty(listMaps)) {
Map<String, Object> map = listMaps.get(0);
Map<String, Object> map = listMaps.stream().max(Comparator.comparingInt(m -> m.keySet().size())).get();
for (AttendQuoteFieldPO attendQuoteField : attendQuoteFields) {
if (map.containsKey(attendQuoteField.getId() + "_attendQuoteData")) {
columns.add(new WeaTableColumn("150", attendQuoteField.getFieldName(), attendQuoteField.getId() + "_attendQuoteData"));