2022-04-24 17:42:32 +08:00
|
|
|
package com.engine.salary.remote.attend.service.impl;
|
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
import com.engine.core.impl.Service;
|
|
|
|
|
import com.engine.salary.mapper.attend.AttendDataMapper;
|
2022-04-25 13:57:33 +08:00
|
|
|
import com.engine.salary.remote.attend.cmd.GetKQReportCmd;
|
2022-04-24 17:42:32 +08:00
|
|
|
import com.engine.salary.remote.attend.entity.Attend4Salary;
|
|
|
|
|
import com.engine.salary.remote.attend.service.RemoteAttend4SalaryService;
|
|
|
|
|
import com.engine.salary.util.db.MapperProxyFactory;
|
2022-04-25 13:57:33 +08:00
|
|
|
import com.google.common.collect.Maps;
|
|
|
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
2022-04-24 17:42:32 +08:00
|
|
|
|
2022-04-25 13:57:33 +08:00
|
|
|
import java.util.*;
|
2022-04-24 17:42:32 +08:00
|
|
|
|
|
|
|
|
public class RemoteAttend4SalaryServiceImpl extends Service implements RemoteAttend4SalaryService {
|
|
|
|
|
|
2022-04-25 13:57:33 +08:00
|
|
|
private AttendDataMapper getAttendDataMapper() {
|
2022-04-24 17:42:32 +08:00
|
|
|
return MapperProxyFactory.getProxy(AttendDataMapper.class);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
2022-04-25 13:57:33 +08:00
|
|
|
public List<Map<String, String>> getColumns() {
|
2022-04-24 17:42:32 +08:00
|
|
|
Map<String, Object> paramsMap = new HashMap<String, Object>();
|
2022-04-25 13:57:33 +08:00
|
|
|
paramsMap.put("pageIndex", 1);
|
|
|
|
|
paramsMap.put("pageSize", 10);
|
|
|
|
|
paramsMap.put("typeselect", "6");
|
|
|
|
|
// paramsMap.put("fromDate","2021-01-01");
|
|
|
|
|
// paramsMap.put("toDate","2023-01-01");
|
|
|
|
|
paramsMap.put("viewScope", "3");
|
|
|
|
|
// paramsMap.put("resourceId","22");
|
|
|
|
|
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<Map> datas = (List<Map>) commandExecutor.execute(new GetKQReportCmd(temp, user)).get("columns");
|
2022-04-24 17:42:32 +08:00
|
|
|
|
2022-04-25 13:57:33 +08:00
|
|
|
List<Map<String, String>> columns = new ArrayList<>();
|
|
|
|
|
datas.stream().filter(column -> Objects.nonNull(column.get("dataIndex"))).forEach(column -> {
|
|
|
|
|
String dataIndex = column.get("dataIndex").toString();
|
|
|
|
|
//请假
|
|
|
|
|
if (dataIndex.equals("leave") && column.get("children") != null) {
|
|
|
|
|
List<Map> list = (List<Map>) column.get("children");
|
|
|
|
|
if (CollectionUtils.isNotEmpty(list)) {
|
|
|
|
|
list.stream()
|
|
|
|
|
.filter(leave -> leave.get("dataIndex") != null && StringUtils.isNotBlank(leave.get("dataIndex").toString()))
|
|
|
|
|
.forEach(leave -> {
|
|
|
|
|
Map<String, String> map = Maps.newHashMapWithExpectedSize(2);
|
|
|
|
|
map.put("code", leave.get("dataIndex").toString());
|
|
|
|
|
map.put("name", leave.get("title") + "(" + leave.get("unit").toString() + ")");
|
|
|
|
|
columns.add(map);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//加班
|
|
|
|
|
else if (dataIndex.equals("overtime")) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
//普通考勤
|
|
|
|
|
else {
|
|
|
|
|
if (column.get("unit") != null && StringUtils.isNotBlank(column.get("unit").toString())) {
|
|
|
|
|
Map<String, String> map = Maps.newHashMapWithExpectedSize(2);
|
|
|
|
|
map.put("code", dataIndex);
|
|
|
|
|
map.put("name", column.get("title") + "(" + column.get("unit").toString() + ")");
|
|
|
|
|
columns.add(map);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
return columns;
|
2022-04-24 17:42:32 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
2022-04-25 13:57:33 +08:00
|
|
|
public List<Map<String, Object>> getDatas(Attend4Salary attend4Salary) {
|
2022-04-24 17:42:32 +08:00
|
|
|
|
|
|
|
|
// List<Long> onlyEmpIds = attend4Salary.getOnlyEmpIds();
|
|
|
|
|
|
|
|
|
|
// List<Map<String, Object>> attendData = getAttendDataMapper().getAttendData();
|
|
|
|
|
//
|
|
|
|
|
// return attendData;
|
|
|
|
|
|
|
|
|
|
Map<String, Object> paramsMap = new HashMap<String, Object>();
|
2022-04-25 13:57:33 +08:00
|
|
|
paramsMap.put("pageIndex", 1);
|
|
|
|
|
paramsMap.put("pageSize", 10);
|
|
|
|
|
paramsMap.put("typeselect", "6");
|
|
|
|
|
paramsMap.put("fromDate", "2021-01-01");
|
|
|
|
|
paramsMap.put("toDate", "2023-01-01");
|
|
|
|
|
paramsMap.put("viewScope", "3");
|
|
|
|
|
paramsMap.put("resourceId", "22");
|
|
|
|
|
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");
|
2022-04-24 17:42:32 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
Object datas = commandExecutor.execute(new GetKQReportCmd(temp, user)).get("datas");
|
|
|
|
|
System.out.println(datas);
|
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|