first commit
This commit is contained in:
@@ -0,0 +1,82 @@
|
||||
package com.budwk.app.base.model;
|
||||
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Table("audit")
|
||||
@Comment("审核记录表")
|
||||
@Data
|
||||
public class Audit extends BaseModel {
|
||||
|
||||
@Column
|
||||
@Name
|
||||
@Comment("ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@PrevInsert(uu32 = true)
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("审核人")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@PrevInsert(els = {@EL("$me.uid()")})
|
||||
private String auditor;
|
||||
|
||||
@Column
|
||||
@Comment("是否通过")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private Boolean auditPass;
|
||||
|
||||
@Column
|
||||
@Comment("审核时间")
|
||||
@Prev(els = {@EL("$me.nowDate()")})
|
||||
private Date auditTime;
|
||||
|
||||
@Column
|
||||
@Comment("审核意见")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 500)
|
||||
|
||||
private String auditOpinion;
|
||||
@Column
|
||||
@Comment("签字")
|
||||
@ColDefine(type = ColType.TEXT)
|
||||
private String auditSign;
|
||||
|
||||
@Column
|
||||
@Comment("审核人姓名")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
@PrevInsert(els = {@EL("$me.userName()")})
|
||||
private String username;
|
||||
|
||||
@Column
|
||||
@Comment("审核人工号")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
@PrevInsert(els = {@EL("$me.loginName()")})
|
||||
private String loginname;
|
||||
|
||||
@Column
|
||||
@Comment("审核类型(1.通过 2.拒绝 3.退回)")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer auditType;
|
||||
|
||||
public Date nowDate() {
|
||||
return new Date();
|
||||
}
|
||||
|
||||
public String uid() {
|
||||
return SecurityUtil.getUserId();
|
||||
}
|
||||
|
||||
public String userName() {
|
||||
return SecurityUtil.getUserUsername();
|
||||
}
|
||||
|
||||
public String loginName() {
|
||||
return SecurityUtil.getUserLoginname();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
package com.budwk.app.base.model;
|
||||
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import lombok.Data;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
import org.nutz.dao.interceptor.annotation.PrevUpdate;
|
||||
import org.nutz.json.Json;
|
||||
import org.nutz.json.JsonFormat;
|
||||
import org.nutz.lang.Strings;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* Created by wizzer on 2016/6/21.
|
||||
* Update by wizzer on 2021/8/30.
|
||||
*/
|
||||
@Data
|
||||
public abstract class BaseModel implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Column
|
||||
@Comment("创建人")
|
||||
@PrevInsert(els = @EL("$me.createdByUid()"))
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String createdBy;
|
||||
|
||||
/**
|
||||
* Long不要用ColDefine定义,兼容oracle/mysql,支持2038年以后的时间戳
|
||||
* 13位时间戳哦,不再是11位
|
||||
*/
|
||||
@Column
|
||||
@Comment("创建时间")
|
||||
@PrevInsert(now = true)
|
||||
private Long createdAt;
|
||||
|
||||
@Column
|
||||
@Comment("修改人")
|
||||
@PrevInsert(els = @EL("$me.updatedByUid()"))
|
||||
@PrevUpdate(els = @EL("$me.updatedByUid()"))
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String updatedBy;
|
||||
|
||||
/**
|
||||
* Long不要用ColDefine定义,兼容oracle/mysql,支持2038年以后的时间戳
|
||||
* 13位时间戳哦,不再是11位
|
||||
*/
|
||||
@Column
|
||||
@Comment("修改时间")
|
||||
@PrevInsert(now = true)
|
||||
@PrevUpdate(now = true)
|
||||
private Long updatedAt;
|
||||
|
||||
@Column
|
||||
@Comment("删除标记")
|
||||
@PrevInsert(els = @EL("$me.flag()"))
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private Boolean delFlag;
|
||||
|
||||
public String toJsonString() {
|
||||
return Json.toJson(this, JsonFormat.compact());
|
||||
}
|
||||
|
||||
public Boolean flag() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public String createdByUid() {
|
||||
String uid = getCreatedBy();
|
||||
if (Strings.isNotBlank(uid)) {
|
||||
return uid;
|
||||
}
|
||||
try {
|
||||
return StpUtil.getLoginIdAsString();
|
||||
} catch (Exception e) {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
public String updatedByUid() {
|
||||
String uid = getUpdatedBy();
|
||||
if (Strings.isNotBlank(uid)) {
|
||||
return uid;
|
||||
}
|
||||
try {
|
||||
return StpUtil.getLoginIdAsString();
|
||||
} catch (Exception e) {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.budwk.app.base.model;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class CustomFormField {
|
||||
|
||||
private String fieldName; // 字段名称
|
||||
private String fieldType; // 字段类型(如 "text", "date", "file" 等)
|
||||
private Boolean required; // 是否必填
|
||||
private Integer maxLength; // 最大字符数(仅适用于文本类型)
|
||||
private String dateRange; // 日期范围(仅适用于日期类型,格式为 "YYYY-MM-DD,YYYY-MM-DD")
|
||||
private List<String> allowedFileTypes; // 允许的文件类型(仅适用于文件类型,如 ["pdf", "jpg"])
|
||||
private Integer maxFiles; // 最大文件数量(仅适用于文件类型)
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.budwk.app.base.model;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* Excel导入错误信息
|
||||
*/
|
||||
public class ExcelImportError {
|
||||
|
||||
/**
|
||||
* 行号
|
||||
*/
|
||||
private int row;
|
||||
|
||||
/**
|
||||
* 错误信息
|
||||
*/
|
||||
@Getter
|
||||
private String errMsg;
|
||||
|
||||
public void setErrInfo(String errMsg, int row) {
|
||||
this.errMsg = errMsg;
|
||||
this.row = row;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.budwk.app.base.model;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Excel导入结果
|
||||
* @param <T>
|
||||
*/
|
||||
@Data
|
||||
public class ExcelImportRes<T extends ExcelImportError> {
|
||||
|
||||
private int totalRecords = 0;
|
||||
|
||||
private int successCount = 0;
|
||||
|
||||
private int failedCount = 0;
|
||||
|
||||
private List<T> errorDetails = new ArrayList<>();
|
||||
|
||||
// 失败数+1
|
||||
public void addFailedCount() {
|
||||
failedCount++;
|
||||
System.out.println(failedCount);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user