2022-04-21 14:15:56 +08:00
|
|
|
package com.engine.salary.wrapper;
|
|
|
|
|
|
|
|
|
|
import com.engine.common.util.ServiceUtil;
|
|
|
|
|
import com.engine.core.impl.Service;
|
|
|
|
|
import com.engine.salary.common.LocalDateRange;
|
|
|
|
|
import com.engine.salary.entity.datacollection.dto.AttendQuoteListDTO;
|
2022-05-26 11:02:55 +08:00
|
|
|
import com.engine.salary.entity.datacollection.param.AttendQuoteCheckOperationParam;
|
2022-04-21 14:15:56 +08:00
|
|
|
import com.engine.salary.entity.datacollection.param.AttendQuoteQueryParam;
|
|
|
|
|
import com.engine.salary.entity.datacollection.param.QuerySalaryCycleAndAttendCycleParam;
|
|
|
|
|
import com.engine.salary.entity.salarysob.dto.SalarySobCycleDTO;
|
|
|
|
|
import com.engine.salary.entity.salarysob.po.SalarySobPO;
|
|
|
|
|
import com.engine.salary.enums.datacollection.AttendQuoteSourceTypeEnum;
|
|
|
|
|
import com.engine.salary.service.AttendQuoteService;
|
|
|
|
|
import com.engine.salary.service.SalarySobService;
|
|
|
|
|
import com.engine.salary.service.impl.AttendQuoteServiceImpl;
|
|
|
|
|
import com.engine.salary.service.impl.SalarySobServiceImpl;
|
2022-05-06 16:54:58 +08:00
|
|
|
import com.engine.salary.util.SalaryDateUtil;
|
2022-04-21 14:15:56 +08:00
|
|
|
import com.engine.salary.util.page.PageInfo;
|
2022-05-26 11:02:55 +08:00
|
|
|
import com.engine.salary.util.valid.ValidUtil;
|
2022-04-21 14:15:56 +08:00
|
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
|
|
|
import org.apache.commons.lang3.math.NumberUtils;
|
|
|
|
|
import weaver.hrm.User;
|
|
|
|
|
|
|
|
|
|
import java.time.YearMonth;
|
|
|
|
|
import java.util.Collection;
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 考勤引用
|
|
|
|
|
* <p>Copyright: Copyright (c) 2022</p>
|
|
|
|
|
* <p>Company: 泛微软件</p>
|
|
|
|
|
*
|
|
|
|
|
* @author qiantao
|
|
|
|
|
* @version 1.0
|
|
|
|
|
**/
|
|
|
|
|
public class AttendQuoteWrapper extends Service {
|
|
|
|
|
|
|
|
|
|
private AttendQuoteService getAttendQuoteService(User user) {
|
2022-06-28 16:46:42 +08:00
|
|
|
return ServiceUtil.getService(AttendQuoteServiceImpl.class, user);
|
2022-04-21 14:15:56 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private SalarySobService getSalarySobService(User user) {
|
2022-06-28 16:46:42 +08:00
|
|
|
return ServiceUtil.getService(SalarySobServiceImpl.class, user);
|
2022-04-21 14:15:56 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 考勤引用列表
|
|
|
|
|
*
|
|
|
|
|
* @param queryParam
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public PageInfo<AttendQuoteListDTO> list(AttendQuoteQueryParam queryParam) {
|
|
|
|
|
PageInfo<AttendQuoteListDTO> page = getAttendQuoteService(user).listPage(queryParam);
|
|
|
|
|
|
|
|
|
|
List<AttendQuoteListDTO> list = page.getList();
|
2022-06-09 17:45:28 +08:00
|
|
|
if (CollectionUtils.isNotEmpty(list)) {
|
|
|
|
|
list.forEach(m -> m.setSourceType(AttendQuoteSourceTypeEnum.getDefaultLabelByValue(Integer.valueOf(m.getSourceType()))));
|
|
|
|
|
page.setList(list);
|
|
|
|
|
}
|
2022-04-21 14:15:56 +08:00
|
|
|
|
|
|
|
|
return page;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取引用考勤表单
|
|
|
|
|
*
|
|
|
|
|
* @param employeeId
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
// public WeaForm getSyncForm(Long employeeId) {
|
|
|
|
|
// // 查询所有启用的薪资账套
|
|
|
|
|
// List<SalarySobPO> salarySobs = getSalarySobService(user).listByDisable(NumberUtils.INTEGER_ZERO);
|
|
|
|
|
// List<WeaFormOption> salarySobOptions = salarySobs.stream()
|
|
|
|
|
// .map(salarySobPO -> new WeaFormOption("" + salarySobPO.getId(), salarySobPO.getName()))
|
|
|
|
|
// .collect(Collectors.toList());
|
|
|
|
|
// // 构建表单
|
|
|
|
|
// WeaForm weaForm = FormatManager.<AttendQuoteSyncDataFormDTO>getInstance().genForm(AttendQuoteSyncDataFormDTO.class, AttendQuoteSyncDataFormDTO.builder().salarySobOptions(salarySobOptions).build());
|
|
|
|
|
//
|
|
|
|
|
// WeaFormItem descriptionItem = weaForm.getItems().get("description");
|
|
|
|
|
// Map<String, Object> otherParams = Maps.newHashMap();
|
|
|
|
|
// otherParams.put("showCount", true);
|
|
|
|
|
// otherParams.put("placeholder", SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 85987, "请输入"));
|
|
|
|
|
// descriptionItem.setOtherParams(otherParams);
|
|
|
|
|
// weaForm.getItems().put("description", descriptionItem);
|
|
|
|
|
//
|
|
|
|
|
// WeaFormItem salaryYearMonthItem = weaForm.getItems().get("salaryYearMonth");
|
|
|
|
|
// otherParams = Maps.newHashMap();
|
|
|
|
|
// otherParams.put("type", "month");
|
|
|
|
|
// salaryYearMonthItem.setOtherParams(otherParams);
|
|
|
|
|
// weaForm.getItems().put("salaryYearMonth", salaryYearMonthItem);
|
|
|
|
|
//
|
|
|
|
|
// return weaForm;
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 检查是否可以操作
|
2022-05-05 10:35:58 +08:00
|
|
|
*
|
2022-04-21 14:15:56 +08:00
|
|
|
* @return
|
|
|
|
|
*/
|
2022-05-26 11:02:55 +08:00
|
|
|
public Boolean checkOperation(AttendQuoteCheckOperationParam checkOperationParam) {
|
|
|
|
|
ValidUtil.doValidator(checkOperationParam);
|
2022-06-02 17:10:54 +08:00
|
|
|
|
|
|
|
|
String salaryYearMonthStr = checkOperationParam.getSalaryYearMonthStr();
|
|
|
|
|
YearMonth yearMonth = SalaryDateUtil.String2YearMonth(salaryYearMonthStr);
|
|
|
|
|
checkOperationParam.setSalaryYearMonth(yearMonth);
|
2022-05-26 11:02:55 +08:00
|
|
|
return getAttendQuoteService(user).checkOperation(checkOperationParam.getSalaryYearMonth(), checkOperationParam.getSalarySobId());
|
2022-04-21 14:15:56 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取薪资周期和考勤周期
|
|
|
|
|
*
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public Map<String, Object> getSalaryCycleAndAttendCycle(QuerySalaryCycleAndAttendCycleParam param) {
|
|
|
|
|
Long salarySobId = param.getSalarySobId();
|
|
|
|
|
YearMonth salaryYearMonth = param.getSalaryYearMonth();
|
|
|
|
|
SalarySobCycleDTO salarySobCycleDTO = getSalarySobService(user).getSalarySobCycle(salarySobId, salaryYearMonth);
|
|
|
|
|
|
|
|
|
|
LocalDateRange salaryCycleRange = salarySobCycleDTO.getSalaryCycle();
|
|
|
|
|
LocalDateRange attendCycleRange = salarySobCycleDTO.getAttendCycle();
|
|
|
|
|
|
|
|
|
|
Map<String, Object> salaryCycleAndAttendCycle = new HashMap<>(2);
|
2022-05-06 16:54:58 +08:00
|
|
|
salaryCycleAndAttendCycle.put("salaryCycle", SalaryDateUtil.getFormatLocalDate(salaryCycleRange.getFromDate()) + " ~ " + SalaryDateUtil.getFormatLocalDate(salaryCycleRange.getEndDate()));
|
|
|
|
|
salaryCycleAndAttendCycle.put("attendCycle", SalaryDateUtil.getFormatLocalDate(attendCycleRange.getFromDate()) + " ~ " + SalaryDateUtil.getFormatLocalDate(attendCycleRange.getEndDate()));
|
2022-04-21 14:15:56 +08:00
|
|
|
|
|
|
|
|
return salaryCycleAndAttendCycle;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取薪资账套下拉列表
|
|
|
|
|
*
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
2022-04-25 10:25:38 +08:00
|
|
|
public List<Map<String, Object>> selectSalarySobList() {
|
2022-04-21 14:15:56 +08:00
|
|
|
// 查询所有启用的薪资账套
|
|
|
|
|
List<SalarySobPO> salarySobs = getSalarySobService(user).listByDisable(NumberUtils.INTEGER_ZERO);
|
|
|
|
|
|
|
|
|
|
return salarySobs.stream().map(m -> {
|
|
|
|
|
Map<String, Object> map = new HashMap<>(2);
|
|
|
|
|
map.put("id", String.valueOf(m.getId()));
|
|
|
|
|
map.put("content", m.getName());
|
|
|
|
|
return map;
|
|
|
|
|
}).collect(Collectors.toList());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 删除考勤引用
|
|
|
|
|
*
|
|
|
|
|
* @param ids
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public String delete(Collection<Long> ids) {
|
|
|
|
|
return getAttendQuoteService(user).delete(ids);
|
|
|
|
|
}
|
|
|
|
|
}
|