2022-04-21 14:15:56 +08:00
|
|
|
package com.engine.salary.wrapper;
|
|
|
|
|
|
|
|
|
|
import com.cloudstore.eccom.pc.table.WeaTable;
|
|
|
|
|
import com.cloudstore.eccom.pc.table.WeaTableColumn;
|
|
|
|
|
import com.cloudstore.eccom.result.WeaResultMsg;
|
|
|
|
|
import com.engine.common.util.ServiceUtil;
|
|
|
|
|
import com.engine.core.impl.Service;
|
|
|
|
|
import com.engine.salary.entity.datacollection.dto.AttendQuoteDataBaseDTO;
|
|
|
|
|
import com.engine.salary.entity.datacollection.param.AttendQuoteDataExportTemplateParam;
|
2022-04-22 15:46:03 +08:00
|
|
|
import com.engine.salary.entity.datacollection.param.AttendQuoteDataImportParam;
|
2022-04-21 14:15:56 +08:00
|
|
|
import com.engine.salary.entity.datacollection.param.AttendQuoteDataQueryParam;
|
|
|
|
|
import com.engine.salary.entity.datacollection.param.AttendQuoteDataSyncParam;
|
|
|
|
|
import com.engine.salary.entity.datacollection.po.AttendQuoteFieldPO;
|
|
|
|
|
import com.engine.salary.exception.SalaryRunTimeException;
|
|
|
|
|
import com.engine.salary.service.AttendQuoteDataService;
|
|
|
|
|
import com.engine.salary.service.AttendQuoteFieldService;
|
|
|
|
|
import com.engine.salary.service.impl.AttendQuoteDataServiceImpl;
|
|
|
|
|
import com.engine.salary.service.impl.AttendQuoteFieldServiceImpl;
|
|
|
|
|
import com.engine.salary.util.SalaryI18nUtil;
|
|
|
|
|
import com.engine.salary.util.page.PageInfo;
|
|
|
|
|
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.concurrent.ExecutorService;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 考勤数据
|
|
|
|
|
* <p>Copyright: Copyright (c) 2022</p>
|
|
|
|
|
* <p>Company: 泛微软件</p>
|
|
|
|
|
*
|
|
|
|
|
* @author qiantao
|
|
|
|
|
* @version 1.0
|
|
|
|
|
**/
|
|
|
|
|
public class AttendQuoteDataWrapper extends Service {
|
|
|
|
|
|
|
|
|
|
private AttendQuoteDataService getAttendQuoteDataService(User user) {
|
|
|
|
|
return (AttendQuoteDataService) ServiceUtil.getService(AttendQuoteDataServiceImpl.class, user);
|
|
|
|
|
}
|
2022-04-22 15:46:03 +08:00
|
|
|
|
2022-04-21 14:15:56 +08:00
|
|
|
private AttendQuoteFieldService getAttendQuoteFieldService(User user) {
|
|
|
|
|
return (AttendQuoteFieldService) ServiceUtil.getService(AttendQuoteFieldServiceImpl.class, user);
|
|
|
|
|
}
|
2022-04-22 15:46:03 +08:00
|
|
|
|
2022-04-21 14:15:56 +08:00
|
|
|
private ExecutorService taskExecutor;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 同步考勤引用数据
|
|
|
|
|
*
|
|
|
|
|
* @param syncParam
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public String syncAttendQuoteData(AttendQuoteDataSyncParam syncParam) {
|
|
|
|
|
return getAttendQuoteDataService(user).syncAttendQuoteData(syncParam);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 查看考勤引用数据
|
|
|
|
|
*
|
|
|
|
|
* @param queryParam
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
2022-04-22 15:46:03 +08:00
|
|
|
public Map<String, Object> view(AttendQuoteDataQueryParam queryParam) {
|
2022-04-21 14:15:56 +08:00
|
|
|
Long id = queryParam.getAttendQuoteId();
|
|
|
|
|
if (id == null) {
|
|
|
|
|
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(100253, "考勤引用id不能为空"));
|
|
|
|
|
}
|
|
|
|
|
// 考勤数据分页主数据
|
|
|
|
|
PageInfo<AttendQuoteDataBaseDTO> page = getAttendQuoteDataService(user).listPage(queryParam);
|
|
|
|
|
List<AttendQuoteDataBaseDTO> attendQuoteDataBases = page.getList();
|
|
|
|
|
// 所有考勤字段
|
|
|
|
|
List<AttendQuoteFieldPO> attendQuoteFields = getAttendQuoteFieldService(user).getAllAttendQuoteFields();
|
|
|
|
|
// 获取最终结果
|
|
|
|
|
List<Map<String, Object>> listMaps = getAttendQuoteDataService(user).getListMaps(attendQuoteDataBases);
|
|
|
|
|
|
|
|
|
|
PageInfo<Map<String, Object>> listPage = new PageInfo<>();
|
|
|
|
|
listPage.setList(listMaps);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 表格表头
|
|
|
|
|
List<WeaTableColumn> columns = new ArrayList<>();
|
2022-04-25 15:51:35 +08:00
|
|
|
columns.add(new WeaTableColumn("150", "username", SalaryI18nUtil.getI18nLabel(85429, "姓名")));
|
|
|
|
|
columns.add(new WeaTableColumn("150", "departmentName", SalaryI18nUtil.getI18nLabel(86185, "部门")));
|
|
|
|
|
columns.add(new WeaTableColumn("150", "mobile", SalaryI18nUtil.getI18nLabel(86186, "手机号")));
|
|
|
|
|
columns.add(new WeaTableColumn("150", "jobNum", SalaryI18nUtil.getI18nLabel(86317, "工号")));
|
2022-04-21 14:15:56 +08:00
|
|
|
// 动态列
|
|
|
|
|
if (CollectionUtils.isNotEmpty(listMaps)) {
|
|
|
|
|
Map<String, Object> map = listMaps.get(0);
|
|
|
|
|
for (AttendQuoteFieldPO attendQuoteField : attendQuoteFields) {
|
2022-04-25 15:51:35 +08:00
|
|
|
System.out.println();
|
2022-04-21 14:15:56 +08:00
|
|
|
if (map.containsKey(attendQuoteField.getId() + "_attendQuoteData")) {
|
2022-04-25 15:51:35 +08:00
|
|
|
columns.add(new WeaTableColumn("150", attendQuoteField.getId() + "_attendQuoteData", attendQuoteField.getFieldName() ));
|
2022-04-21 14:15:56 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
WeaTable weaTable = new WeaTable();
|
|
|
|
|
weaTable.setColumns(columns);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
WeaResultMsg result = new WeaResultMsg(false);
|
|
|
|
|
result.putAll(weaTable.makeDataResult());
|
|
|
|
|
result.success();
|
|
|
|
|
|
2022-04-22 15:46:03 +08:00
|
|
|
Map<String, Object> datas = new HashMap<>();
|
2022-04-21 14:15:56 +08:00
|
|
|
datas.put("pageInfo", listPage);
|
2022-04-22 15:46:03 +08:00
|
|
|
datas.put("dataKey", result.getResultMap());
|
2022-04-21 14:15:56 +08:00
|
|
|
|
|
|
|
|
return datas;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 下载导入模板
|
|
|
|
|
*
|
|
|
|
|
* @param templateParam
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public XSSFWorkbook downloadTemplate(AttendQuoteDataExportTemplateParam templateParam) {
|
2022-04-22 15:46:03 +08:00
|
|
|
return getAttendQuoteDataService(user).downloadTemplate(templateParam);
|
2022-04-21 14:15:56 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 到处考勤引用数据
|
|
|
|
|
*
|
|
|
|
|
* @param queryParam
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public XSSFWorkbook export(AttendQuoteDataQueryParam queryParam) {
|
|
|
|
|
return getAttendQuoteDataService(user).export(queryParam);
|
|
|
|
|
}
|
|
|
|
|
|
2022-04-22 15:46:03 +08:00
|
|
|
/**
|
|
|
|
|
* 预览
|
|
|
|
|
*
|
|
|
|
|
* @param param
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public Map<String, Object> preview(AttendQuoteDataImportParam param) {
|
|
|
|
|
return getAttendQuoteDataService(user).preview(param);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 导入
|
|
|
|
|
*
|
|
|
|
|
* @param param
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public Map<String, Object> importAttendQuoteData(AttendQuoteDataImportParam param) {
|
|
|
|
|
return getAttendQuoteDataService(user).importAttendQuoteData(param);
|
|
|
|
|
}
|
2022-04-21 14:15:56 +08:00
|
|
|
}
|