163 lines
5.5 KiB
Java
163 lines
5.5 KiB
Java
package com.engine.salary.entity.salaryBill.param;
|
||
|
||
import com.engine.salary.entity.salaryBill.dto.SalaryTemplateSalaryItemSetListDTO;
|
||
import com.engine.salary.enums.salarybill.SalaryTemplateTextContentPositionEnum;
|
||
import com.engine.salary.exception.SalaryRunTimeException;
|
||
import com.engine.salary.util.SalaryI18nUtil;
|
||
import lombok.AllArgsConstructor;
|
||
import lombok.Builder;
|
||
import lombok.Data;
|
||
import lombok.NoArgsConstructor;
|
||
import org.apache.commons.collections4.CollectionUtils;
|
||
import org.apache.commons.lang3.StringUtils;
|
||
|
||
import java.util.List;
|
||
import java.util.Objects;
|
||
|
||
/**
|
||
* @Description: 工资单模板
|
||
*/
|
||
@Data
|
||
@Builder
|
||
@NoArgsConstructor
|
||
@AllArgsConstructor
|
||
//"工资单模板保存参数
|
||
public class SalaryTemplateSaveParam {
|
||
|
||
// 主键
|
||
private Long id;
|
||
|
||
// 模板名称
|
||
private String name;
|
||
|
||
// 薪资账套表的主键id
|
||
private Long salarySobId;
|
||
|
||
// 备注
|
||
private String description;
|
||
|
||
// 邮箱开启状态。false:关、true:开
|
||
private Boolean emailStatus;
|
||
|
||
// 发送地址
|
||
private Long sendEmail;
|
||
|
||
// 消息中心开启状态。false:关、true:开
|
||
private Boolean msgStatus;
|
||
|
||
// 主题
|
||
private String theme;
|
||
|
||
// 背景图
|
||
private String background;
|
||
|
||
// 文本内容
|
||
private String textContent;
|
||
|
||
// 文本内容位置。1:薪资项目前、2:薪资项目后
|
||
private Integer textContentPosition;
|
||
|
||
// 薪资项为空时不显示开启状态。false:关、true:开
|
||
private Boolean salaryItemNullStatus;
|
||
|
||
// 薪资项为0时不显示开启状态。false:关、true:开
|
||
private Boolean salaryItemZeroStatus;
|
||
|
||
// 是否启用工资单定时发送。0:未启用、1:已启用
|
||
private Boolean autoSendStatus;
|
||
|
||
// 自动发送工资单周期1:本月、2:上月
|
||
private Integer autoSendCycleType;
|
||
|
||
// 每月几号自动发送工资单
|
||
private String autoSendDayOfMonth;
|
||
|
||
// 自动发放时间
|
||
private String autoSendTimeOfDay;
|
||
|
||
// 薪资项目设置
|
||
private List<SalaryTemplateSalaryItemSetListDTO> salaryItemSetting;
|
||
|
||
|
||
// 补发工资单模板名称
|
||
private String replenishName;
|
||
|
||
// 补发工资单名单生成规则
|
||
private String replenishRule;
|
||
|
||
// 补发薪资项目设置
|
||
private List<SalaryTemplateSalaryItemSetListDTO> replenishSalaryItemSetting;
|
||
|
||
/**
|
||
* 工资单确认反馈状态
|
||
*/
|
||
private Boolean ackFeedbackStatus;
|
||
|
||
/**
|
||
* 自动确认超时天数
|
||
*/
|
||
private Integer autoAckDays;
|
||
|
||
/**
|
||
* 反馈流程地址
|
||
*
|
||
*/
|
||
private String feedbackUrl;
|
||
|
||
public static void checkParam(SalaryTemplateSaveParam saveParam) {
|
||
if (saveParam.getSalarySobId() == null) {
|
||
throw new SalaryRunTimeException("薪资账套表的主键id必传;");
|
||
}
|
||
|
||
if (StringUtils.isEmpty(saveParam.getName())) {
|
||
throw new SalaryRunTimeException("工资单模板名称必填;");
|
||
}
|
||
|
||
if (StringUtils.isEmpty(saveParam.getTheme())) {
|
||
throw new SalaryRunTimeException("工资单主题必填;");
|
||
}
|
||
|
||
if (StringUtils.isEmpty(saveParam.getReplenishName())) {
|
||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(139737, "补发工资单模板名称必填"));
|
||
}
|
||
|
||
if (saveParam.getName().equals(saveParam.getReplenishName())) {
|
||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(140557, "工资单模板名称和补发工资单模板名称不可相同"));
|
||
}
|
||
|
||
if (StringUtils.isEmpty(saveParam.getReplenishRule())) {
|
||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(139738, "补发工资单名单生成规则必填"));
|
||
}
|
||
|
||
|
||
// if (saveParam.getEmailStatus() && saveParam.getSendEmail() == null) {
|
||
// throw new SalaryRunTimeException("开启邮箱后,发送地址必选;");
|
||
// }
|
||
|
||
if (StringUtils.isNotEmpty(saveParam.getTextContent()) && saveParam.getTextContentPosition() == null) {
|
||
throw new SalaryRunTimeException("文本内容不为空时,文本内容位置必选;");
|
||
}
|
||
|
||
if (saveParam.getTextContentPosition() != null && saveParam.getTextContentPosition().equals(SalaryTemplateTextContentPositionEnum.BEFORE.getValue()) && saveParam.getTextContentPosition().equals(SalaryTemplateTextContentPositionEnum.AFTER.getValue())) {
|
||
throw new SalaryRunTimeException("文本内容位置参数不对;");
|
||
}
|
||
|
||
if (CollectionUtils.isEmpty(saveParam.getReplenishSalaryItemSetting())) {
|
||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(140509, "补发工资单模板的薪资项目设置不能为空"));
|
||
}
|
||
|
||
if (Objects.isNull(saveParam.getAutoSendStatus())) {
|
||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(140509, "是否启用自动发放不能为空"));
|
||
}
|
||
|
||
if (saveParam.getAutoSendStatus() == Boolean.TRUE) {
|
||
if(StringUtils.isBlank(saveParam.getAutoSendDayOfMonth()))
|
||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(140509, "自动发放日期不能为空"));
|
||
if(Objects.isNull(saveParam.getAutoSendCycleType()))
|
||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(140509, "自动发放周期不能为空"));
|
||
if(StringUtils.isBlank(saveParam.getAutoSendTimeOfDay()))
|
||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(140509, "自动发放时间不能为空"));
|
||
}
|
||
}
|
||
}
|