2022-03-11 16:19:47 +08:00
|
|
|
|
package com.engine.salary.service.impl;
|
|
|
|
|
|
|
2022-03-11 18:14:19 +08:00
|
|
|
|
import com.cloudstore.eccom.result.WeaResultMsg;
|
2022-03-11 16:19:47 +08:00
|
|
|
|
import com.engine.core.impl.Service;
|
2022-03-15 09:55:58 +08:00
|
|
|
|
import com.engine.salary.biz.AttendQuoteFieldBiz;
|
2022-03-11 18:14:19 +08:00
|
|
|
|
import com.engine.salary.component.SalaryWeaTable;
|
2022-03-16 14:29:02 +08:00
|
|
|
|
import com.engine.salary.entity.datacollection.bo.AttendQuoteFieldBO;
|
2022-03-11 18:14:19 +08:00
|
|
|
|
import com.engine.salary.entity.datacollection.dto.AttendQuoteFieldListDTO;
|
2022-03-11 16:19:47 +08:00
|
|
|
|
import com.engine.salary.entity.datacollection.param.AttendQuoteFieldQueryParam;
|
2022-03-15 09:55:58 +08:00
|
|
|
|
import com.engine.salary.entity.datacollection.param.AttendQuoteFieldSaveParam;
|
|
|
|
|
|
import com.engine.salary.entity.datacollection.po.AttendQuoteFieldPO;
|
|
|
|
|
|
import com.engine.salary.enums.datacollection.AttendQuoteFieldSourceTypeEnum;
|
|
|
|
|
|
import com.engine.salary.enums.datacollection.AttendQuoteFieldTypeEnum;
|
|
|
|
|
|
import com.engine.salary.exception.SalaryRunTimeException;
|
2022-04-21 14:15:56 +08:00
|
|
|
|
import com.engine.salary.mapper.datacollection.AttendQuoteFieldMapper;
|
2022-03-11 16:19:47 +08:00
|
|
|
|
import com.engine.salary.service.AttendQuoteFieldService;
|
2022-03-16 14:29:02 +08:00
|
|
|
|
import com.engine.salary.util.SalaryI18nUtil;
|
2022-04-21 14:15:56 +08:00
|
|
|
|
import com.engine.salary.util.db.MapperProxyFactory;
|
|
|
|
|
|
import com.engine.salary.util.page.PageInfo;
|
|
|
|
|
|
import com.engine.salary.util.page.PageUtil;
|
2022-03-16 14:29:02 +08:00
|
|
|
|
import com.google.common.collect.Lists;
|
2022-03-12 17:45:39 +08:00
|
|
|
|
import org.apache.commons.collections4.CollectionUtils;
|
2022-03-15 09:55:58 +08:00
|
|
|
|
import org.springframework.beans.BeanUtils;
|
2022-03-11 16:19:47 +08:00
|
|
|
|
|
2022-03-15 09:55:58 +08:00
|
|
|
|
import java.util.*;
|
2022-03-12 17:45:39 +08:00
|
|
|
|
import java.util.stream.Collectors;
|
2022-03-11 16:19:47 +08:00
|
|
|
|
|
2022-03-15 09:55:58 +08:00
|
|
|
|
import static com.engine.salary.constant.SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY;
|
|
|
|
|
|
|
2022-03-11 16:19:47 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* 数据采集-考勤引用字段
|
|
|
|
|
|
* <p>Copyright: Copyright (c) 2022</p>
|
|
|
|
|
|
* <p>Company: 泛微软件</p>
|
|
|
|
|
|
*
|
|
|
|
|
|
* @author qiantao
|
|
|
|
|
|
* @version 1.0
|
|
|
|
|
|
**/
|
|
|
|
|
|
public class AttendQuoteFieldServiceImpl extends Service implements AttendQuoteFieldService {
|
2022-03-15 09:55:58 +08:00
|
|
|
|
|
|
|
|
|
|
AttendQuoteFieldBiz biz = new AttendQuoteFieldBiz();
|
2022-04-21 14:15:56 +08:00
|
|
|
|
private AttendQuoteFieldMapper getAttendQuoteFieldMapper() {
|
|
|
|
|
|
return MapperProxyFactory.getProxy(AttendQuoteFieldMapper.class);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-03-11 16:19:47 +08:00
|
|
|
|
// @RpcReference
|
|
|
|
|
|
// private RemoteAttendInitVacationService remoteAttendInitVacationService;
|
|
|
|
|
|
// @Autowired
|
|
|
|
|
|
// private LoggerTemplate attendQuoteFieldLoggerTemplate;
|
|
|
|
|
|
|
2022-04-21 14:15:56 +08:00
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public List<AttendQuoteFieldPO> getAllAttendQuoteFields() {
|
|
|
|
|
|
return getAttendQuoteFieldMapper().listAll();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public PageInfo<AttendQuoteFieldListDTO> listPage(AttendQuoteFieldQueryParam queryParam) {
|
|
|
|
|
|
PageUtil.start(queryParam.getCurrent(), queryParam.getPageSize());
|
|
|
|
|
|
List<AttendQuoteFieldListDTO> list = getAttendQuoteFieldMapper().list(queryParam);
|
|
|
|
|
|
return new PageInfo<>(list);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public AttendQuoteFieldPO getById(Long id) {
|
|
|
|
|
|
return getAttendQuoteFieldMapper().getById(id);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-03-11 16:19:47 +08:00
|
|
|
|
@Override
|
|
|
|
|
|
public Map<String, Object> list(AttendQuoteFieldQueryParam queryParam) {
|
2022-04-11 20:17:47 +08:00
|
|
|
|
syncAttendFields();
|
2022-03-11 16:19:47 +08:00
|
|
|
|
|
2022-03-15 09:55:58 +08:00
|
|
|
|
String fields = " t1.id," +
|
|
|
|
|
|
" t1.field_name as fieldName," +
|
|
|
|
|
|
" t1.source_type as sourceType," +
|
|
|
|
|
|
" t1.field_type as fieldType," +
|
|
|
|
|
|
" t1.enable_status as enableStatus," +
|
2022-03-11 18:14:19 +08:00
|
|
|
|
" t1.description";
|
|
|
|
|
|
|
2022-03-12 17:45:39 +08:00
|
|
|
|
String fromSql = " FROM" +
|
|
|
|
|
|
" hrsa_attend_quote_field t1 ";
|
2022-03-11 18:14:19 +08:00
|
|
|
|
|
|
|
|
|
|
SalaryWeaTable<AttendQuoteFieldListDTO> table = new SalaryWeaTable<AttendQuoteFieldListDTO>(user, AttendQuoteFieldListDTO.class);
|
|
|
|
|
|
table.setBackfields(fields);
|
|
|
|
|
|
table.setSqlform(fromSql);
|
2022-03-15 09:55:58 +08:00
|
|
|
|
table.setSqlwhere(AttendQuoteFieldQueryParam.genWhereSql(queryParam));
|
2022-03-12 17:45:39 +08:00
|
|
|
|
table.setSqlorderby("t1.source_type,t1.id DESC");
|
2022-03-11 18:14:19 +08:00
|
|
|
|
table.setSqlprimarykey("t1.id");
|
|
|
|
|
|
table.setSqlisdistinct("false");
|
|
|
|
|
|
|
|
|
|
|
|
WeaResultMsg result = new WeaResultMsg(false);
|
|
|
|
|
|
result.putAll(table.makeDataResult());
|
|
|
|
|
|
result.success();
|
|
|
|
|
|
return result.getResultMap();
|
2022-03-15 09:55:58 +08:00
|
|
|
|
}
|
2022-03-11 18:14:19 +08:00
|
|
|
|
|
2022-03-15 09:55:58 +08:00
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public AttendQuoteFieldPO getFrom(Long id) {
|
|
|
|
|
|
if (id != null) {
|
|
|
|
|
|
AttendQuoteFieldPO po = biz.getById(id);
|
|
|
|
|
|
if (po == null) {
|
|
|
|
|
|
throw new SalaryRunTimeException(String.format("字段不存在[id:%s]", id));
|
|
|
|
|
|
}
|
|
|
|
|
|
return po;
|
|
|
|
|
|
}
|
|
|
|
|
|
return null;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public String save(AttendQuoteFieldSaveParam saveParam) {
|
|
|
|
|
|
//参数校验
|
|
|
|
|
|
AttendQuoteFieldSaveParam.checkParam(saveParam);
|
|
|
|
|
|
|
|
|
|
|
|
List<AttendQuoteFieldPO> attendQuoteFields = biz.listSome(AttendQuoteFieldPO.builder().fieldName(saveParam.getFieldName()).build());
|
|
|
|
|
|
if (CollectionUtils.isNotEmpty(attendQuoteFields)) {
|
|
|
|
|
|
throw new SalaryRunTimeException("字段名称不允许重复");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Date now = new Date();
|
|
|
|
|
|
AttendQuoteFieldPO attendQuoteField = AttendQuoteFieldPO.builder()
|
|
|
|
|
|
.fieldName(saveParam.getFieldName())
|
|
|
|
|
|
.sourceType(AttendQuoteFieldSourceTypeEnum.DEFAULT.getValue())
|
|
|
|
|
|
.fieldType(saveParam.getFieldType().getValue())
|
|
|
|
|
|
.enableStatus(saveParam.getEnableStatus() ? 1 : 0)
|
|
|
|
|
|
.description(saveParam.getDescription())
|
|
|
|
|
|
.createTime(now)
|
|
|
|
|
|
.updateTime(now)
|
|
|
|
|
|
.creator((long) user.getUID())
|
|
|
|
|
|
.tenantKey(DEFAULT_TENANT_KEY)
|
|
|
|
|
|
.build();
|
|
|
|
|
|
// 保存
|
|
|
|
|
|
biz.save(attendQuoteField);
|
|
|
|
|
|
|
|
|
|
|
|
return null;
|
2022-03-11 16:19:47 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2022-03-15 09:55:58 +08:00
|
|
|
|
@Override
|
|
|
|
|
|
public String update(AttendQuoteFieldSaveParam saveParam) {
|
|
|
|
|
|
// 校验是否可以编辑
|
|
|
|
|
|
AttendQuoteFieldSaveParam.checkParam(saveParam);
|
|
|
|
|
|
if (saveParam.getId() == null) {
|
|
|
|
|
|
throw new SalaryRunTimeException("id为空");
|
|
|
|
|
|
}
|
|
|
|
|
|
AttendQuoteFieldPO attendQuoteField = biz.getById(saveParam.getId());
|
|
|
|
|
|
if (attendQuoteField == null) {
|
|
|
|
|
|
throw new SalaryRunTimeException("该字段不存在");
|
|
|
|
|
|
}
|
|
|
|
|
|
if (!attendQuoteField.getSourceType().equals(AttendQuoteFieldSourceTypeEnum.DEFAULT.getValue())) {
|
|
|
|
|
|
throw new SalaryRunTimeException("来源只能为自定义");
|
2022-03-12 17:45:39 +08:00
|
|
|
|
}
|
2022-03-15 09:55:58 +08:00
|
|
|
|
List<AttendQuoteFieldPO> attendQuoteFields = biz.listSome(AttendQuoteFieldPO.builder().fieldName(saveParam.getFieldName()).build());
|
|
|
|
|
|
if (CollectionUtils.isNotEmpty(attendQuoteFields)) {
|
|
|
|
|
|
boolean fieldNameExist = attendQuoteFields.stream().anyMatch(e -> !Objects.equals(e.getId(), saveParam.getId()));
|
|
|
|
|
|
if (fieldNameExist) {
|
|
|
|
|
|
throw new SalaryRunTimeException("字段名称不允许重复");
|
|
|
|
|
|
}
|
2022-03-12 17:45:39 +08:00
|
|
|
|
}
|
2022-03-15 09:55:58 +08:00
|
|
|
|
|
|
|
|
|
|
AttendQuoteFieldPO newAttendQuoteField = new AttendQuoteFieldPO();
|
|
|
|
|
|
BeanUtils.copyProperties(attendQuoteField, newAttendQuoteField);
|
|
|
|
|
|
newAttendQuoteField.setFieldName(saveParam.getFieldName());
|
|
|
|
|
|
newAttendQuoteField.setFieldType(saveParam.getFieldType().getValue());
|
|
|
|
|
|
newAttendQuoteField.setEnableStatus(saveParam.getEnableStatus() ? 1 : 0);
|
|
|
|
|
|
newAttendQuoteField.setDescription(saveParam.getDescription());
|
|
|
|
|
|
newAttendQuoteField.setUpdateTime(new Date());
|
|
|
|
|
|
// 更新
|
|
|
|
|
|
biz.update(newAttendQuoteField);
|
|
|
|
|
|
|
|
|
|
|
|
return null;
|
2022-03-12 17:45:39 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2022-03-15 09:55:58 +08:00
|
|
|
|
@Override
|
|
|
|
|
|
public String delete(Collection<Long> ids) {
|
|
|
|
|
|
if (CollectionUtils.isEmpty(ids)) {
|
|
|
|
|
|
throw new SalaryRunTimeException("参数错误");
|
|
|
|
|
|
}
|
|
|
|
|
|
List<AttendQuoteFieldListDTO> attendQuoteFields = biz.list(AttendQuoteFieldQueryParam.builder().ids(ids).build());
|
|
|
|
|
|
if (CollectionUtils.isEmpty(attendQuoteFields)) {
|
|
|
|
|
|
throw new SalaryRunTimeException("要删除的数据在不存在或已删除");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
List<AttendQuoteFieldListDTO> attendQuoteAttendFields = attendQuoteFields.stream().filter(e -> e.getSourceType().equals(String.valueOf(AttendQuoteFieldSourceTypeEnum.ATTEND.getValue()))).collect(Collectors.toList());
|
|
|
|
|
|
if (CollectionUtils.isNotEmpty(attendQuoteAttendFields)) {
|
|
|
|
|
|
throw new SalaryRunTimeException("考勤模块的字段不能删除");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// TODO 正在使用的记录不允许删除
|
|
|
|
|
|
biz.deleteByIds(ids);
|
|
|
|
|
|
return null;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public String updateEnableStatus(AttendQuoteFieldSaveParam param) {
|
|
|
|
|
|
// 校验是否可以编辑
|
|
|
|
|
|
Long id = param.getId();
|
|
|
|
|
|
Boolean enableStatus = param.getEnableStatus();
|
|
|
|
|
|
if (id == null || enableStatus == null) {
|
|
|
|
|
|
throw new SalaryRunTimeException("参数错误");
|
|
|
|
|
|
}
|
|
|
|
|
|
AttendQuoteFieldPO attendQuoteField = biz.getById(id);
|
|
|
|
|
|
if (attendQuoteField == null) {
|
|
|
|
|
|
throw new SalaryRunTimeException("该字段不存在");
|
|
|
|
|
|
}
|
|
|
|
|
|
if (!attendQuoteField.getSourceType().equals(AttendQuoteFieldSourceTypeEnum.DEFAULT.getValue())) {
|
|
|
|
|
|
throw new SalaryRunTimeException("来源只能为自定义");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
AttendQuoteFieldPO newAttendQuoteField = new AttendQuoteFieldPO();
|
|
|
|
|
|
BeanUtils.copyProperties(attendQuoteField, newAttendQuoteField);
|
|
|
|
|
|
newAttendQuoteField.setEnableStatus(enableStatus ? 1 : 0);
|
|
|
|
|
|
newAttendQuoteField.setUpdateTime(new Date());
|
|
|
|
|
|
// 更新
|
|
|
|
|
|
biz.update(newAttendQuoteField);
|
|
|
|
|
|
return null;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
2022-04-11 20:17:47 +08:00
|
|
|
|
public String syncAttendFields() {
|
2022-03-15 09:55:58 +08:00
|
|
|
|
// 所有字段管理的考勤模块引用字段
|
|
|
|
|
|
List<AttendQuoteFieldPO> attendQuoteFields = biz.listSome(AttendQuoteFieldPO.builder().sourceType(AttendQuoteFieldSourceTypeEnum.ATTEND.getValue()).build());
|
|
|
|
|
|
// 1.本地字段
|
|
|
|
|
|
List<String> localFieldCodes = attendQuoteFields.stream().map(AttendQuoteFieldPO::getCode).collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
|
|
// 2.考勤模块字段
|
|
|
|
|
|
// 请假类型
|
2022-03-11 16:19:47 +08:00
|
|
|
|
// List<AttendVacationType> attendVacationTypes;
|
|
|
|
|
|
// try {
|
|
|
|
|
|
// attendVacationTypes = remoteAttendInitVacationService.queryVacationTypes(Boolean.TRUE, currentTenantKey);
|
|
|
|
|
|
// } catch (Exception e) {
|
|
|
|
|
|
// log.error("同步考勤字段失败,请检查接口服务remoteAttendInitVacationService.queryVacationTypes:{}", e.getMessage());
|
|
|
|
|
|
// return WeaResult.success(StringUtils.EMPTY);
|
|
|
|
|
|
// }
|
|
|
|
|
|
// // 请假类型:按小时
|
2022-03-15 09:55:58 +08:00
|
|
|
|
// List<String> attendLeaveHourFieldCodes = CollectionUtils.emptyIfNull(attendVacationTypes).stream().map(m -> m.getId() + "_leave_hour").collect(Collectors.toList());
|
2022-03-11 16:19:47 +08:00
|
|
|
|
// // 请假类型:按天
|
2022-03-15 09:55:58 +08:00
|
|
|
|
// List<String> attendLeaveDayFieldCodes = CollectionUtils.emptyIfNull(attendVacationTypes).stream().map(m -> m.getId() + "_leave_day").collect(Collectors.toList());
|
2022-03-11 16:19:47 +08:00
|
|
|
|
// List<String> attendLeaveFieldCodes = Lists.newArrayList();
|
|
|
|
|
|
// attendLeaveFieldCodes.addAll(attendLeaveHourFieldCodes);
|
|
|
|
|
|
// attendLeaveFieldCodes.addAll(attendLeaveDayFieldCodes);
|
2022-03-16 14:29:02 +08:00
|
|
|
|
// 所有考勤模块字段编码
|
|
|
|
|
|
List<String> attendFieldCodes = Lists.newArrayList();
|
2022-03-11 16:19:47 +08:00
|
|
|
|
// attendFieldCodes.addAll(attendLeaveFieldCodes);
|
2022-03-16 14:29:02 +08:00
|
|
|
|
// 考勤模块固定字段
|
|
|
|
|
|
List<Map<String, String>> attendFixedFieldCodes = AttendQuoteFieldBO.buildAttendFixedFields();
|
|
|
|
|
|
attendFieldCodes.addAll(attendFixedFieldCodes.stream().map(m -> m.get("code")).collect(Collectors.toList()));
|
|
|
|
|
|
|
|
|
|
|
|
// 本地已存在则更新【交集】
|
|
|
|
|
|
List<String> updateCodes = localFieldCodes.stream().filter(item -> attendFieldCodes.contains(item)).collect(Collectors.toList());
|
|
|
|
|
|
// 本地比attend多,则删除【差集(local - attend)】
|
2022-03-16 18:26:49 +08:00
|
|
|
|
Collection<String> deleteCodes = localFieldCodes.stream().filter(item -> !attendFieldCodes.contains(item)).collect(Collectors.toList());
|
2022-03-16 14:29:02 +08:00
|
|
|
|
// attend比本地多,则新增【差集(attend - local)】
|
|
|
|
|
|
List<String> saveCodes = attendFieldCodes.stream().filter(item -> !localFieldCodes.contains(item)).collect(Collectors.toList());
|
|
|
|
|
|
String hourI18n = SalaryI18nUtil.getI18nLabel(100743, "小时");
|
|
|
|
|
|
String dayI18n = SalaryI18nUtil.getI18nLabel(100744, "天");
|
|
|
|
|
|
// 1.更新 == 目前除了请假类型其余都是固定,故只需更新请假类型部分
|
2022-03-11 16:19:47 +08:00
|
|
|
|
// List<AttendQuoteFieldPO> updates = Lists.newArrayList();
|
|
|
|
|
|
// CollectionUtils.emptyIfNull(updateCodes).forEach(e -> {
|
2022-03-15 09:55:58 +08:00
|
|
|
|
// Optional<AttendVacationType> optionalHour = CollectionUtils.emptyIfNull(attendVacationTypes).stream().filter(m -> (m.getId() + "_leave_hour").equals(e)).findFirst();
|
2022-03-11 16:19:47 +08:00
|
|
|
|
// if (optionalHour.isPresent()) {
|
|
|
|
|
|
// AttendVacationType hour = optionalHour.get();
|
|
|
|
|
|
// updates.add(AttendQuoteFieldPO.builder()
|
|
|
|
|
|
// .code(e)
|
2022-03-15 09:55:58 +08:00
|
|
|
|
// .fieldName(hour.getName() + "(" + hourI18n + ")")
|
2022-03-11 16:19:47 +08:00
|
|
|
|
// .updateTime(LocalDateTime.now())
|
|
|
|
|
|
// .build());
|
|
|
|
|
|
// }
|
2022-03-15 09:55:58 +08:00
|
|
|
|
// Optional<AttendVacationType> optionalDay = CollectionUtils.emptyIfNull(attendVacationTypes).stream().filter(m -> (m.getId() + "_leave_day").equals(e)).findFirst();
|
2022-03-11 16:19:47 +08:00
|
|
|
|
// if (optionalDay.isPresent()) {
|
|
|
|
|
|
// AttendVacationType day = optionalDay.get();
|
|
|
|
|
|
// updates.add(AttendQuoteFieldPO.builder()
|
|
|
|
|
|
// .code(e)
|
2022-03-15 09:55:58 +08:00
|
|
|
|
// .fieldName(day.getName() + "(" + dayI18n + ")")
|
2022-03-11 16:19:47 +08:00
|
|
|
|
// .updateTime(LocalDateTime.now())
|
|
|
|
|
|
// .build());
|
|
|
|
|
|
// }
|
|
|
|
|
|
// });
|
|
|
|
|
|
// if (CollectionUtils.isNotEmpty(updates)) {
|
2022-04-21 14:15:56 +08:00
|
|
|
|
// getAttendQuoteFieldMapper().updateNameByCode(updates);
|
2022-03-11 16:19:47 +08:00
|
|
|
|
// }
|
2022-03-16 14:29:02 +08:00
|
|
|
|
// 2.删除
|
|
|
|
|
|
if (CollectionUtils.isNotEmpty(deleteCodes)) {
|
|
|
|
|
|
//根据考勤字段编码删除考勤模块字段
|
|
|
|
|
|
biz.deleteAttendByCode(AttendQuoteFieldQueryParam.builder().codes(deleteCodes).sourceType(AttendQuoteFieldSourceTypeEnum.ATTEND.getValue()).build());
|
|
|
|
|
|
}
|
|
|
|
|
|
// 3.新增
|
|
|
|
|
|
List<AttendQuoteFieldPO> saves = new ArrayList<>();
|
|
|
|
|
|
saves.addAll(attendFixedFieldCodes.stream().filter(e -> saveCodes.contains(e.get("code"))).map(m ->
|
2022-04-21 14:15:56 +08:00
|
|
|
|
buildAttendQuoteField(m.get("code"), m.get("name"), (long) user.getUID())
|
2022-03-16 14:29:02 +08:00
|
|
|
|
).collect(Collectors.toList()));
|
|
|
|
|
|
// saveCodes.forEach(e -> {
|
2022-03-15 09:55:58 +08:00
|
|
|
|
// Optional<AttendVacationType> optionalHour = CollectionUtils.emptyIfNull(attendVacationTypes).stream().filter(m -> (m.getId() + "_leave_hour").equals(e)).findFirst();
|
2022-03-11 16:19:47 +08:00
|
|
|
|
// if (optionalHour.isPresent()) {
|
|
|
|
|
|
// AttendVacationType hour = optionalHour.get();
|
2022-03-15 09:55:58 +08:00
|
|
|
|
// saves.add(buildAttendQuoteField(e, hour.getName() + "(" + hourI18n + ")", currentEmployeeId, currentTenantKey));
|
2022-03-11 16:19:47 +08:00
|
|
|
|
// }
|
2022-03-15 09:55:58 +08:00
|
|
|
|
// Optional<AttendVacationType> optionalDay = CollectionUtils.emptyIfNull(attendVacationTypes).stream().filter(m -> (m.getId() + "_leave_day").equals(e)).findFirst();
|
2022-03-11 16:19:47 +08:00
|
|
|
|
// if (optionalDay.isPresent()) {
|
|
|
|
|
|
// AttendVacationType day = optionalDay.get();
|
2022-03-15 09:55:58 +08:00
|
|
|
|
// saves.add(buildAttendQuoteField(e, day.getName() + "(" + dayI18n + ")", currentEmployeeId, currentTenantKey));
|
2022-03-11 16:19:47 +08:00
|
|
|
|
// }
|
|
|
|
|
|
// });
|
2022-03-16 14:29:02 +08:00
|
|
|
|
|
|
|
|
|
|
if (CollectionUtils.isNotEmpty(saves)) {
|
|
|
|
|
|
biz.saveBatch(saves);
|
|
|
|
|
|
}
|
2022-03-15 09:55:58 +08:00
|
|
|
|
return null;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 构建考勤字段
|
|
|
|
|
|
*
|
|
|
|
|
|
* @param code
|
|
|
|
|
|
* @param name
|
|
|
|
|
|
* @param currentEmployeeId
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*/
|
|
|
|
|
|
private AttendQuoteFieldPO buildAttendQuoteField(String code, String name, Long currentEmployeeId) {
|
|
|
|
|
|
Date now = new Date();
|
|
|
|
|
|
return AttendQuoteFieldPO.builder()
|
|
|
|
|
|
.code(code)
|
|
|
|
|
|
.fieldName(name)
|
|
|
|
|
|
.sourceType(AttendQuoteFieldSourceTypeEnum.ATTEND.getValue())
|
|
|
|
|
|
.fieldType(AttendQuoteFieldTypeEnum.NUMBER.getValue())
|
|
|
|
|
|
.enableStatus(1)
|
|
|
|
|
|
.description("")
|
|
|
|
|
|
.createTime(now)
|
|
|
|
|
|
.updateTime(now)
|
|
|
|
|
|
.creator(currentEmployeeId)
|
|
|
|
|
|
.tenantKey(DEFAULT_TENANT_KEY)
|
|
|
|
|
|
.build();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
2022-04-11 20:17:47 +08:00
|
|
|
|
public List<AttendQuoteFieldListDTO> listAll() {
|
2022-03-15 09:55:58 +08:00
|
|
|
|
return biz.list(AttendQuoteFieldQueryParam.builder().build());
|
|
|
|
|
|
}
|
2022-03-11 16:19:47 +08:00
|
|
|
|
}
|