weaver-hrm-salary/src/com/engine/salary/entity/salaryBill/param/SalaryTemplateSaveParam.java

92 lines
3.1 KiB
Java
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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 lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import java.util.List;
/**
* @Description: 工资单模板
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
//@ApiModel("工资单模板保存参数")
public class SalaryTemplateSaveParam {
// @ApiModelProperty("主键")
private Long id;
// @ApiModelProperty("模板名称")
private String name;
// @ApiModelProperty("薪资账套表的主键id")
private Long salarySobId;
// @ApiModelProperty("备注")
private String description;
// @ApiModelProperty("邮箱开启状态。false关、true开")
private Boolean emailStatus;
// @ApiModelProperty("发送地址")
private Long sendEmail;
// @ApiModelProperty("消息中心开启状态。false关、true开")
private Boolean msgStatus;
// @ApiModelProperty("主题")
private String theme;
// @ApiModelProperty("背景图")
private String background;
// @ApiModelProperty("文本内容")
private String textContent;
// @ApiModelProperty("文本内容位置。1薪资项目前、2薪资项目后")
private Integer textContentPosition;
// @ApiModelProperty("薪资项为空时不显示开启状态。false关、true开")
private Boolean salaryItemNullStatus;
// @ApiModelProperty("薪资项为0时不显示开启状态。false关、true开")
private Boolean salaryItemZeroStatus;
// @ApiModelProperty("薪资项目设置")
private List<SalaryTemplateSalaryItemSetListDTO> salaryItemSetting;
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 (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("文本内容位置参数不对");
}
}
}