修改
This commit is contained in:
@@ -4,6 +4,9 @@
|
||||
*/
|
||||
package com.jeesite.modules;
|
||||
|
||||
import com.jeesite.common.config.Global;
|
||||
import com.jeesite.common.io.FileUtils;
|
||||
import com.jeesite.modules.utils.IpUtils;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||
@@ -11,19 +14,20 @@ import org.springframework.boot.web.servlet.support.SpringBootServletInitializer
|
||||
|
||||
/**
|
||||
* Application
|
||||
*
|
||||
* @author ThinkGem
|
||||
*/
|
||||
@SpringBootApplication
|
||||
public class ApiApplication extends SpringBootServletInitializer {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(ApiApplication.class, args);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
|
||||
this.setRegisterErrorPageFilter(false);
|
||||
return builder.sources(ApiApplication.class);
|
||||
}
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(ApiApplication.class, args);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
|
||||
this.setRegisterErrorPageFilter(false);
|
||||
return builder.sources(ApiApplication.class);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -48,7 +48,7 @@ import java.io.Serial;
|
||||
columns = {
|
||||
@Column(name = "province_name", attrName = "provinceName", label = "省份名称"),
|
||||
}),
|
||||
}, orderBy = "a.id DESC"
|
||||
}, orderBy = "a.create_time DESC"
|
||||
)
|
||||
@Data
|
||||
public class BizCities extends DataEntity<BizCities> implements Serializable {
|
||||
|
||||
@@ -2,9 +2,12 @@ package com.jeesite.modules.biz.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
import com.jeesite.common.mybatis.annotation.JoinTable;
|
||||
import com.jeesite.common.mybatis.annotation.JoinTable.Type;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.jeesite.modules.sys.entity.User;
|
||||
import com.jeesite.modules.sys.utils.UserUtils;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
@@ -23,88 +26,94 @@ import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 通知列表项表Entity
|
||||
*
|
||||
* @author gaoxq
|
||||
* @version 2025-11-26
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Table(name="biz_list_item", alias="a", label="通知列表项表信息", columns={
|
||||
@Column(name="create_time", attrName="createTime", label="创建时间", isUpdate=false, isUpdateForce=true),
|
||||
@Column(name="id", attrName="id", label="唯一标识", isPK=true),
|
||||
@Column(name="avatar", attrName="avatar", label="头像图标", isQuery=false),
|
||||
@Column(name="title", attrName="title", label="通知标题", queryType=QueryType.LIKE),
|
||||
@Column(name="title_delete", attrName="titleDelete", label="是否删除", isQuery=false),
|
||||
@Column(name="datetime", attrName="datetime", label="发送时间", isQuery=false),
|
||||
@Column(name="type", attrName="type", label="类型标识"),
|
||||
@Column(name="read_flag", attrName="readFlag", label="是否已读"),
|
||||
@Column(name="description", attrName="description", label="描述信息", isQuery=false),
|
||||
@Column(name="click_close", attrName="clickClose", label="是否关闭"),
|
||||
@Column(name="extra", attrName="extra", label="待办状态"),
|
||||
@Column(name="color", attrName="color", label="颜色值", isQuery=false),
|
||||
@Column(name="update_time", attrName="updateTime", label="更新时间", isQuery=false),
|
||||
@Column(name="f_tenant_id", attrName="ftenantId", label="租户id", isUpdate=false, isQuery=false),
|
||||
@Column(name="f_flow_id", attrName="fflowId", label="流程id", isUpdate=false, isQuery=false),
|
||||
@Column(name="f_flow_task_id", attrName="fflowTaskId", label="流程任务主键", isUpdate=false, isQuery=false),
|
||||
@Column(name="f_flow_state", attrName="fflowState", label="流程任务状态", isUpdate=false, isQuery=false, isUpdateForce=true),
|
||||
}, orderBy="a.create_time DESC"
|
||||
@Table(name = "biz_list_item", alias = "a", label = "通知列表项表信息", columns = {
|
||||
@Column(name = "create_time", attrName = "createTime", label = "创建时间", isUpdate = false, isUpdateForce = true),
|
||||
@Column(name = "id", attrName = "id", label = "唯一标识", isPK = true),
|
||||
@Column(name = "avatar", attrName = "avatar", label = "头像图标", isUpdate = false, isUpdateForce = true),
|
||||
@Column(name = "title", attrName = "title", label = "通知标题", queryType = QueryType.LIKE),
|
||||
@Column(name = "title_delete", attrName = "titleDelete", label = "是否删除", isQuery = false),
|
||||
@Column(name = "datetime", attrName = "datetime", label = "发送时间", isQuery = false),
|
||||
@Column(name = "type", attrName = "type", label = "类型标识"),
|
||||
@Column(name = "read_flag", attrName = "readFlag", label = "是否已读"),
|
||||
@Column(name = "description", attrName = "description", label = "描述信息", isQuery = false),
|
||||
@Column(name = "click_close", attrName = "clickClose", label = "是否关闭"),
|
||||
@Column(name = "extra", attrName = "extra", label = "待办状态"),
|
||||
@Column(name = "color", attrName = "color", label = "颜色值", isQuery = false),
|
||||
@Column(name = "update_time", attrName = "updateTime", label = "更新时间", isQuery = false),
|
||||
@Column(name = "login_user", attrName = "loginUser", label = "接收用户"),
|
||||
@Column(name = "user_name", attrName = "userName", label = "接收用户"),
|
||||
@Column(name = "create_user", attrName = "createUser", label = "创建用户", isUpdate = false, isUpdateForce = true),
|
||||
@Column(name = "f_tenant_id", attrName = "ftenantId", label = "租户id", isUpdate = false, isQuery = false),
|
||||
@Column(name = "f_flow_id", attrName = "fflowId", label = "流程id", isUpdate = false, isQuery = false),
|
||||
@Column(name = "f_flow_task_id", attrName = "fflowTaskId", label = "流程任务主键", isUpdate = false, isQuery = false),
|
||||
@Column(name = "f_flow_state", attrName = "fflowState", label = "流程任务状态", isUpdate = false, isQuery = false, isUpdateForce = true),
|
||||
}, orderBy = "a.create_time DESC"
|
||||
)
|
||||
@Data
|
||||
public class BizListItem extends DataEntity<BizListItem> implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
private Date createTime; // 创建时间
|
||||
private String avatar; // 头像图标
|
||||
private String title; // 通知标题
|
||||
private boolean titleDelete; // 是否删除
|
||||
private String datetime; // 发送时间
|
||||
private String type; // 类型标识
|
||||
private boolean readFlag; // 是否已读
|
||||
private String description; // 描述信息
|
||||
private boolean clickClose; // 是否关闭
|
||||
private String extra; // 待办状态
|
||||
private String color; // 颜色值
|
||||
private Date updateTime; // 更新时间
|
||||
private String ftenantId; // 租户id
|
||||
private String fflowId; // 流程id
|
||||
private String fflowTaskId; // 流程任务主键
|
||||
private Integer fflowState; // 流程任务状态
|
||||
|
||||
@ExcelFields({
|
||||
@ExcelField(title="创建时间", attrName="createTime", align=Align.CENTER, sort=10, dataFormat="yyyy-MM-dd hh:mm"),
|
||||
@ExcelField(title="唯一标识", attrName="id", align=Align.CENTER, sort=20),
|
||||
@ExcelField(title="头像图标", attrName="avatar", align=Align.CENTER, sort=30),
|
||||
@ExcelField(title="通知标题", attrName="title", align=Align.CENTER, sort=40),
|
||||
@ExcelField(title="是否删除", attrName="titleDelete", align=Align.CENTER, sort=50),
|
||||
@ExcelField(title="发送时间", attrName="datetime", align=Align.CENTER, sort=60, dataFormat="yyyy-MM-dd"),
|
||||
@ExcelField(title="类型标识", attrName="type", align=Align.CENTER, sort=70),
|
||||
@ExcelField(title="是否已读", attrName="readFlag", align=Align.CENTER, sort=80),
|
||||
@ExcelField(title="描述信息", attrName="description", align=Align.CENTER, sort=90),
|
||||
@ExcelField(title="是否关闭", attrName="clickClose", align=Align.CENTER, sort=100),
|
||||
@ExcelField(title="待办状态", attrName="extra", align=Align.CENTER, sort=110),
|
||||
@ExcelField(title="颜色值", attrName="color", align=Align.CENTER, sort=120),
|
||||
})
|
||||
public BizListItem() {
|
||||
this(null);
|
||||
}
|
||||
|
||||
public BizListItem(String id){
|
||||
super(id);
|
||||
}
|
||||
|
||||
public Date getCreateTime_gte() {
|
||||
return sqlMap.getWhere().getValue("create_time", QueryType.GTE);
|
||||
}
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
private Date createTime; // 创建时间
|
||||
private String avatar; // 头像图标
|
||||
private String title; // 通知标题
|
||||
private Boolean titleDelete; // 是否删除
|
||||
private String datetime; // 发送时间
|
||||
private String type; // 类型标识
|
||||
private Boolean readFlag; // 是否已读
|
||||
private String description; // 描述信息
|
||||
private Boolean clickClose; // 是否关闭
|
||||
private String extra; // 待办状态
|
||||
private String color; // 颜色值
|
||||
private Date updateTime; // 更新时间
|
||||
private String loginUser;
|
||||
private String userName;
|
||||
private String createUser;
|
||||
private String ftenantId; // 租户id
|
||||
private String fflowId; // 流程id
|
||||
private String fflowTaskId; // 流程任务主键
|
||||
private Integer fflowState; // 流程任务状态
|
||||
|
||||
public void setCreateTime_gte(Date createTime) {
|
||||
sqlMap.getWhere().and("create_time", QueryType.GTE, createTime);
|
||||
}
|
||||
|
||||
public Date getCreateTime_lte() {
|
||||
return sqlMap.getWhere().getValue("create_time", QueryType.LTE);
|
||||
}
|
||||
@ExcelFields({
|
||||
@ExcelField(title = "创建时间", attrName = "createTime", align = Align.CENTER, sort = 10, dataFormat = "yyyy-MM-dd hh:mm"),
|
||||
@ExcelField(title = "唯一标识", attrName = "id", align = Align.CENTER, sort = 20),
|
||||
@ExcelField(title = "头像图标", attrName = "avatar", align = Align.CENTER, sort = 30),
|
||||
@ExcelField(title = "通知标题", attrName = "title", align = Align.CENTER, sort = 40),
|
||||
@ExcelField(title = "是否删除", attrName = "titleDelete", align = Align.CENTER, sort = 50),
|
||||
@ExcelField(title = "发送时间", attrName = "datetime", align = Align.CENTER, sort = 60, dataFormat = "yyyy-MM-dd"),
|
||||
@ExcelField(title = "类型标识", attrName = "type", align = Align.CENTER, sort = 70),
|
||||
@ExcelField(title = "是否已读", attrName = "readFlag", align = Align.CENTER, sort = 80),
|
||||
@ExcelField(title = "描述信息", attrName = "description", align = Align.CENTER, sort = 90),
|
||||
@ExcelField(title = "是否关闭", attrName = "clickClose", align = Align.CENTER, sort = 100),
|
||||
@ExcelField(title = "待办状态", attrName = "extra", align = Align.CENTER, sort = 110),
|
||||
})
|
||||
public BizListItem() {
|
||||
this(null);
|
||||
}
|
||||
|
||||
public BizListItem(String id) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
public Date getCreateTime_gte() {
|
||||
return sqlMap.getWhere().getValue("create_time", QueryType.GTE);
|
||||
}
|
||||
|
||||
public void setCreateTime_gte(Date createTime) {
|
||||
sqlMap.getWhere().and("create_time", QueryType.GTE, createTime);
|
||||
}
|
||||
|
||||
public Date getCreateTime_lte() {
|
||||
return sqlMap.getWhere().getValue("create_time", QueryType.LTE);
|
||||
}
|
||||
|
||||
public void setCreateTime_lte(Date createTime) {
|
||||
sqlMap.getWhere().and("create_time", QueryType.LTE, createTime);
|
||||
}
|
||||
|
||||
public void setCreateTime_lte(Date createTime) {
|
||||
sqlMap.getWhere().and("create_time", QueryType.LTE, createTime);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package com.jeesite.modules.biz.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
import com.jeesite.common.mybatis.annotation.JoinTable;
|
||||
import com.jeesite.common.mybatis.annotation.JoinTable.Type;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
@@ -22,93 +23,121 @@ import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 需求信息Entity
|
||||
*
|
||||
* @author gaoxq
|
||||
* @version 2025-11-27
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Table(name="biz_project_requirements", alias="a", label="需求信息信息", columns={
|
||||
@Column(name="create_time", attrName="createTime", label="记录日期", isUpdate=false, isUpdateForce=true),
|
||||
@Column(name="requirement_id", attrName="requirementId", label="需求标识", isPK=true),
|
||||
@Column(name="requirement_name", attrName="requirementName", label="需求名称", queryType=QueryType.LIKE),
|
||||
@Column(name="requirement_code", attrName="requirementCode", label="需求编号"),
|
||||
@Column(name="area_code", attrName="areaCode", label="项目区域"),
|
||||
@Column(name="requirement_description", attrName="requirementDescription", label="需求描述"),
|
||||
@Column(name="start_time", attrName="startTime", label="开始时间", isQuery=false, isUpdateForce=true),
|
||||
@Column(name="end_time", attrName="endTime", label="结束时间", isQuery=false, isUpdateForce=true),
|
||||
@Column(name="priority", attrName="priority", label="优先级"),
|
||||
@Column(name="update_time", attrName="updateTime", label="更新时间", isQuery=false, isUpdateForce=true),
|
||||
@Column(name="project_id", attrName="projectId", label="项目ID"),
|
||||
@Column(name="employee_id", attrName="employeeId", label="用户ID"),
|
||||
@Column(name="remark", attrName="remark", label="需求备注"),
|
||||
@Column(name="requirements_status", attrName="requirementsStatus", label="状态"),
|
||||
@Column(name="f_tenant_id", attrName="ftenantId", label="租户id", isUpdate=false, isQuery=false),
|
||||
@Column(name="f_flow_id", attrName="fflowId", label="流程id", isUpdate=false, isQuery=false),
|
||||
@Column(name="f_flow_task_id", attrName="fflowTaskId", label="流程任务主键", isUpdate=false, isQuery=false),
|
||||
@Column(name="f_flow_state", attrName="fflowState", label="流程任务状态", isUpdate=false, isQuery=false, isUpdateForce=true),
|
||||
}, orderBy="a.create_time DESC"
|
||||
@Table(name = "biz_project_requirements", alias = "a", label = "需求信息信息", columns = {
|
||||
@Column(name = "create_time", attrName = "createTime", label = "记录日期", isUpdate = false, isUpdateForce = true),
|
||||
@Column(name = "requirement_id", attrName = "requirementId", label = "需求标识", isPK = true),
|
||||
@Column(name = "requirement_name", attrName = "requirementName", label = "需求名称", queryType = QueryType.LIKE),
|
||||
@Column(name = "requirement_code", attrName = "requirementCode", label = "需求编号"),
|
||||
@Column(name = "area_code", attrName = "areaCode", label = "项目区域"),
|
||||
@Column(name = "requirement_description", attrName = "requirementDescription", label = "需求描述"),
|
||||
@Column(name = "start_time", attrName = "startTime", label = "开始时间", isQuery = false, isUpdateForce = true),
|
||||
@Column(name = "end_time", attrName = "endTime", label = "结束时间", isQuery = false, isUpdateForce = true),
|
||||
@Column(name = "priority", attrName = "priority", label = "优先级"),
|
||||
@Column(name = "update_time", attrName = "updateTime", label = "更新时间", isQuery = false, isUpdateForce = true),
|
||||
@Column(name = "project_id", attrName = "projectId", label = "项目ID"),
|
||||
@Column(name = "employee_id", attrName = "employeeId", label = "用户ID"),
|
||||
@Column(name = "remark", attrName = "remark", label = "需求备注"),
|
||||
@Column(name = "requirements_status", attrName = "requirementsStatus", label = "状态"),
|
||||
@Column(name = "f_tenant_id", attrName = "ftenantId", label = "租户id", isUpdate = false, isQuery = false),
|
||||
@Column(name = "f_flow_id", attrName = "fflowId", label = "流程id", isUpdate = false, isQuery = false),
|
||||
@Column(name = "f_flow_task_id", attrName = "fflowTaskId", label = "流程任务主键", isUpdate = false, isQuery = false),
|
||||
@Column(name = "f_flow_state", attrName = "fflowState", label = "流程任务状态", isUpdate = false, isQuery = false, isUpdateForce = true),
|
||||
}, joinTable = {
|
||||
@JoinTable(type = Type.LEFT_JOIN, entity = BizResumeEmployee.class, attrName = "this", alias = "b",
|
||||
on = "a.employee_id = b.employee_id",
|
||||
columns = {
|
||||
@Column(name = "employee_name", attrName = "employeeName", label = "员工姓名"),
|
||||
@Column(name = "employee_code", attrName = "employeeCode", label = "员工编号"),
|
||||
}),
|
||||
@JoinTable(type = Type.LEFT_JOIN, entity = BizProjectInfo.class, attrName = "this", alias = "c",
|
||||
on = "a.project_id = c.project_id",
|
||||
columns = {
|
||||
@Column(name = "project_code", attrName = "projectCode", label = "项目编码"),
|
||||
@Column(name = "project_name", attrName = "projectName", label = "项目名称"),
|
||||
}),
|
||||
@JoinTable(type = Type.LEFT_JOIN, entity = BizProvince.class, attrName = "this", alias = "d",
|
||||
on = "a.area_code = d.province_code",
|
||||
columns = {
|
||||
@Column(name = "province_name", attrName = "provinceName", label = "省份名称"),
|
||||
}),
|
||||
}, orderBy = "a.create_time DESC"
|
||||
)
|
||||
@Data
|
||||
public class BizProjectRequirements extends DataEntity<BizProjectRequirements> implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
private Date createTime; // 记录日期
|
||||
private String requirementId; // 需求标识
|
||||
private String requirementName; // 需求名称
|
||||
private String requirementCode; // 需求编号
|
||||
private String areaCode; // 项目区域
|
||||
private String requirementDescription; // 需求描述
|
||||
private Date startTime; // 开始时间
|
||||
private Date endTime; // 结束时间
|
||||
private String priority; // 优先级
|
||||
private Date updateTime; // 更新时间
|
||||
private String projectId; // 项目ID
|
||||
private String employeeId; // 用户ID
|
||||
private String remark; // 需求备注
|
||||
private String requirementsStatus; // 状态
|
||||
private String ftenantId; // 租户id
|
||||
private String fflowId; // 流程id
|
||||
private String fflowTaskId; // 流程任务主键
|
||||
private Integer fflowState; // 流程任务状态
|
||||
|
||||
@ExcelFields({
|
||||
@ExcelField(title="记录日期", attrName="createTime", align=Align.CENTER, sort=10, dataFormat="yyyy-MM-dd hh:mm"),
|
||||
@ExcelField(title="需求标识", attrName="requirementId", align=Align.CENTER, sort=20),
|
||||
@ExcelField(title="需求名称", attrName="requirementName", align=Align.CENTER, sort=30),
|
||||
@ExcelField(title="需求编号", attrName="requirementCode", align=Align.CENTER, sort=40),
|
||||
@ExcelField(title="项目区域", attrName="areaCode", align=Align.CENTER, sort=50),
|
||||
@ExcelField(title="需求描述", attrName="requirementDescription", align=Align.CENTER, sort=60),
|
||||
@ExcelField(title="开始时间", attrName="startTime", align=Align.CENTER, sort=70, dataFormat="yyyy-MM-dd hh:mm"),
|
||||
@ExcelField(title="结束时间", attrName="endTime", align=Align.CENTER, sort=80, dataFormat="yyyy-MM-dd hh:mm"),
|
||||
@ExcelField(title="优先级", attrName="priority", align=Align.CENTER, sort=90),
|
||||
@ExcelField(title="更新时间", attrName="updateTime", align=Align.CENTER, sort=100, dataFormat="yyyy-MM-dd hh:mm"),
|
||||
@ExcelField(title="项目ID", attrName="projectId", align=Align.CENTER, sort=110),
|
||||
@ExcelField(title="用户ID", attrName="employeeId", align=Align.CENTER, sort=120),
|
||||
@ExcelField(title="需求备注", attrName="remark", align=Align.CENTER, sort=130),
|
||||
@ExcelField(title="状态", attrName="requirementsStatus", align=Align.CENTER, sort=140),
|
||||
})
|
||||
public BizProjectRequirements() {
|
||||
this(null);
|
||||
}
|
||||
|
||||
public BizProjectRequirements(String id){
|
||||
super(id);
|
||||
}
|
||||
|
||||
public Date getCreateTime_gte() {
|
||||
return sqlMap.getWhere().getValue("create_time", QueryType.GTE);
|
||||
}
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
private Date createTime; // 记录日期
|
||||
private String requirementId; // 需求标识
|
||||
private String requirementName; // 需求名称
|
||||
private String requirementCode; // 需求编号
|
||||
private String areaCode; // 项目区域
|
||||
private String requirementDescription; // 需求描述
|
||||
private Date startTime; // 开始时间
|
||||
private Date endTime; // 结束时间
|
||||
private String priority; // 优先级
|
||||
private Date updateTime; // 更新时间
|
||||
private String projectId; // 项目ID
|
||||
private String employeeId; // 用户ID
|
||||
private String remark; // 需求备注
|
||||
private String requirementsStatus; // 状态
|
||||
private String ftenantId; // 租户id
|
||||
private String fflowId; // 流程id
|
||||
private String fflowTaskId; // 流程任务主键
|
||||
private Integer fflowState; // 流程任务状态
|
||||
|
||||
public void setCreateTime_gte(Date createTime) {
|
||||
sqlMap.getWhere().and("create_time", QueryType.GTE, createTime);
|
||||
}
|
||||
|
||||
public Date getCreateTime_lte() {
|
||||
return sqlMap.getWhere().getValue("create_time", QueryType.LTE);
|
||||
}
|
||||
private String employeeName;
|
||||
private String employeeCode;
|
||||
private String projectCode;
|
||||
private String projectName;
|
||||
|
||||
private String provinceName;
|
||||
|
||||
@ExcelFields({
|
||||
@ExcelField(title = "记录日期", attrName = "createTime", align = Align.CENTER, sort = 10, dataFormat = "yyyy-MM-dd hh:mm"),
|
||||
@ExcelField(title = "需求标识", attrName = "requirementId", align = Align.CENTER, sort = 20),
|
||||
@ExcelField(title = "需求名称", attrName = "requirementName", align = Align.CENTER, sort = 30),
|
||||
@ExcelField(title = "需求编号", attrName = "requirementCode", align = Align.CENTER, sort = 40),
|
||||
@ExcelField(title = "区域编码", attrName = "areaCode", align = Align.CENTER, sort = 50),
|
||||
@ExcelField(title = "区域名称", attrName = "provinceName", align = Align.CENTER, sort = 50),
|
||||
@ExcelField(title = "需求描述", attrName = "requirementDescription", align = Align.CENTER, sort = 60),
|
||||
@ExcelField(title = "开始时间", attrName = "startTime", align = Align.CENTER, sort = 70, dataFormat = "yyyy-MM-dd hh:mm"),
|
||||
@ExcelField(title = "结束时间", attrName = "endTime", align = Align.CENTER, sort = 80, dataFormat = "yyyy-MM-dd hh:mm"),
|
||||
@ExcelField(title = "优先等级", attrName = "priority", dictType = "priority", align = Align.CENTER, sort = 90),
|
||||
@ExcelField(title = "更新时间", attrName = "updateTime", align = Align.CENTER, sort = 100, dataFormat = "yyyy-MM-dd hh:mm"),
|
||||
@ExcelField(title = "项目编号", attrName = "projectCode", align = Align.CENTER, sort = 110),
|
||||
@ExcelField(title = "项目名称", attrName = "projectName", align = Align.CENTER, sort = 110),
|
||||
@ExcelField(title = "需求用户", attrName = "employeeName", align = Align.CENTER, sort = 120),
|
||||
@ExcelField(title = "需求备注", attrName = "remark", align = Align.CENTER, sort = 130),
|
||||
@ExcelField(title = "状态", attrName = "requirementsStatus", dictType = "requirements_status", align = Align.CENTER, sort = 140),
|
||||
})
|
||||
public BizProjectRequirements() {
|
||||
this(null);
|
||||
}
|
||||
|
||||
public BizProjectRequirements(String id) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
public Date getCreateTime_gte() {
|
||||
return sqlMap.getWhere().getValue("create_time", QueryType.GTE);
|
||||
}
|
||||
|
||||
public void setCreateTime_gte(Date createTime) {
|
||||
sqlMap.getWhere().and("create_time", QueryType.GTE, createTime);
|
||||
}
|
||||
|
||||
public Date getCreateTime_lte() {
|
||||
return sqlMap.getWhere().getValue("create_time", QueryType.LTE);
|
||||
}
|
||||
|
||||
public void setCreateTime_lte(Date createTime) {
|
||||
sqlMap.getWhere().and("create_time", QueryType.LTE, createTime);
|
||||
}
|
||||
|
||||
public void setCreateTime_lte(Date createTime) {
|
||||
sqlMap.getWhere().and("create_time", QueryType.LTE, createTime);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,13 +3,18 @@ package com.jeesite.modules.biz.web;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.jeesite.modules.dao.TabItem;
|
||||
import com.jeesite.modules.dict.NotifyType;
|
||||
import com.jeesite.modules.sys.entity.User;
|
||||
import com.jeesite.modules.sys.utils.UserUtils;
|
||||
import com.jeesite.modules.utils.IpUtils;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.poi.ss.formula.atp.Switch;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
@@ -71,6 +76,8 @@ public class BizListItemController extends BaseController {
|
||||
@RequestMapping(value = "listData")
|
||||
@ResponseBody
|
||||
public Page<BizListItem> listData(BizListItem bizListItem, HttpServletRequest request, HttpServletResponse response) {
|
||||
User user = UserUtils.getUser();
|
||||
bizListItem.setCreateUser(user.getUserCode());
|
||||
bizListItem.setPage(new Page<>(request, response));
|
||||
Page<BizListItem> page = bizListItemService.findPage(bizListItem);
|
||||
return page;
|
||||
@@ -93,8 +100,13 @@ public class BizListItemController extends BaseController {
|
||||
@PostMapping(value = "save")
|
||||
@ResponseBody
|
||||
public String save(@Validated BizListItem bizListItem) {
|
||||
User user = UserUtils.getUser();
|
||||
User loginUser = UserUtils.getByLoginCode(bizListItem.getLoginUser());
|
||||
bizListItem.setUserName(loginUser.getUserName());
|
||||
bizListItem.setCreateUser(user.getLoginCode());
|
||||
bizListItem.setAvatar(IpUtils.getServerHttp() + user.getAvatar());
|
||||
bizListItemService.save(bizListItem);
|
||||
return renderResult(Global.TRUE, text("保存通知列表项表成功!"));
|
||||
return renderResult(Global.TRUE, text("保存通知列表项成功!"));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -103,9 +115,11 @@ public class BizListItemController extends BaseController {
|
||||
@RequiresPermissions("biz:listItem:view")
|
||||
@RequestMapping(value = "exportData")
|
||||
public void exportData(BizListItem bizListItem, HttpServletResponse response) {
|
||||
User user = UserUtils.getUser();
|
||||
bizListItem.setCreateUser(user.getLoginCode());
|
||||
List<BizListItem> list = bizListItemService.findList(bizListItem);
|
||||
String fileName = "通知列表项表" + DateUtils.getDate("yyyyMMddHHmmss") + ".xlsx";
|
||||
try (ExcelExport ee = new ExcelExport("通知列表项表", BizListItem.class)) {
|
||||
try (ExcelExport ee = new ExcelExport("通知列表项", BizListItem.class)) {
|
||||
ee.setDataList(list).write(response, fileName);
|
||||
}
|
||||
}
|
||||
@@ -119,7 +133,7 @@ public class BizListItemController extends BaseController {
|
||||
BizListItem bizListItem = new BizListItem();
|
||||
List<BizListItem> list = ListUtils.newArrayList(bizListItem);
|
||||
String fileName = "通知列表项表模板.xlsx";
|
||||
try (ExcelExport ee = new ExcelExport("通知列表项表", BizListItem.class, Type.IMPORT)) {
|
||||
try (ExcelExport ee = new ExcelExport("通知列表项", BizListItem.class, Type.IMPORT)) {
|
||||
ee.setDataList(list).write(response, fileName);
|
||||
}
|
||||
}
|
||||
@@ -147,17 +161,43 @@ public class BizListItemController extends BaseController {
|
||||
@ResponseBody
|
||||
public String delete(BizListItem bizListItem) {
|
||||
bizListItemService.delete(bizListItem);
|
||||
return renderResult(Global.TRUE, text("删除通知列表项表成功!"));
|
||||
return renderResult(Global.TRUE, text("删除通知列表项成功!"));
|
||||
}
|
||||
|
||||
@RequestMapping(value = "sflow")
|
||||
@ResponseBody
|
||||
public String sflow(BizListItem bizListItem) {
|
||||
String status = Objects.requireNonNullElse(bizListItem.getExtra(), "未开始");
|
||||
switch (status) {
|
||||
case "未开始" -> {
|
||||
bizListItem.setColor("red");
|
||||
bizListItem.setExtra("进行中");
|
||||
}
|
||||
case "进行中" -> {
|
||||
bizListItem.setColor("green");
|
||||
bizListItem.setExtra("已完成");
|
||||
}
|
||||
case "已完成" -> {
|
||||
bizListItem.setColor("white");
|
||||
bizListItem.setReadFlag(true);
|
||||
bizListItem.setClickClose(true);
|
||||
}
|
||||
}
|
||||
bizListItemService.update(bizListItem);
|
||||
return renderResult(Global.TRUE, text("操作通知列表项成功!"));
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = "getTabListData")
|
||||
@ResponseBody
|
||||
public List<TabItem> getTabListData() {
|
||||
User user = UserUtils.getUser();
|
||||
return Arrays.stream(NotifyType.values())
|
||||
.map(type -> {
|
||||
BizListItem listItem = new BizListItem();
|
||||
listItem.setReadFlag(false);
|
||||
listItem.setType(type.getCode());
|
||||
listItem.setLoginUser(user.getLoginCode());
|
||||
List<BizListItem> dataList = bizListItemService.findList(listItem);
|
||||
return new TabItem(type.getCode(), type.getName(), dataList.size(), dataList);
|
||||
})
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.jeesite.modules.biz.web;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
||||
@@ -26,6 +27,7 @@ import com.jeesite.modules.biz.service.BizProjectInfoService;
|
||||
|
||||
/**
|
||||
* 项目信息Controller
|
||||
*
|
||||
* @author gaoxq
|
||||
* @version 2025-11-27
|
||||
*/
|
||||
@@ -33,114 +35,120 @@ import com.jeesite.modules.biz.service.BizProjectInfoService;
|
||||
@RequestMapping(value = "${adminPath}/biz/projectInfo")
|
||||
public class BizProjectInfoController extends BaseController {
|
||||
|
||||
private final BizProjectInfoService bizProjectInfoService;
|
||||
private final BizProjectInfoService bizProjectInfoService;
|
||||
|
||||
public BizProjectInfoController(BizProjectInfoService bizProjectInfoService) {
|
||||
this.bizProjectInfoService = bizProjectInfoService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取数据
|
||||
*/
|
||||
@ModelAttribute
|
||||
public BizProjectInfo get(String projectId, boolean isNewRecord) {
|
||||
return bizProjectInfoService.get(projectId, isNewRecord);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表
|
||||
*/
|
||||
@RequiresPermissions("biz:projectInfo:view")
|
||||
@RequestMapping(value = {"list", ""})
|
||||
public String list(BizProjectInfo bizProjectInfo, Model model) {
|
||||
model.addAttribute("bizProjectInfo", bizProjectInfo);
|
||||
return "modules/biz/bizProjectInfoList";
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表数据
|
||||
*/
|
||||
@RequiresPermissions("biz:projectInfo:view")
|
||||
@RequestMapping(value = "listData")
|
||||
public BizProjectInfoController(BizProjectInfoService bizProjectInfoService) {
|
||||
this.bizProjectInfoService = bizProjectInfoService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取数据
|
||||
*/
|
||||
@ModelAttribute
|
||||
public BizProjectInfo get(String projectId, boolean isNewRecord) {
|
||||
return bizProjectInfoService.get(projectId, isNewRecord);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表
|
||||
*/
|
||||
@RequiresPermissions("biz:projectInfo:view")
|
||||
@RequestMapping(value = {"list", ""})
|
||||
public String list(BizProjectInfo bizProjectInfo, Model model) {
|
||||
model.addAttribute("bizProjectInfo", bizProjectInfo);
|
||||
return "modules/biz/bizProjectInfoList";
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表数据
|
||||
*/
|
||||
@RequiresPermissions("biz:projectInfo:view")
|
||||
@RequestMapping(value = "listData")
|
||||
@ResponseBody
|
||||
public Page<BizProjectInfo> listData(BizProjectInfo bizProjectInfo, HttpServletRequest request, HttpServletResponse response) {
|
||||
bizProjectInfo.setPage(new Page<>(request, response));
|
||||
Page<BizProjectInfo> page = bizProjectInfoService.findPage(bizProjectInfo);
|
||||
return page;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看编辑表单
|
||||
*/
|
||||
@RequiresPermissions("biz:projectInfo:view")
|
||||
@RequestMapping(value = "form")
|
||||
public String form(BizProjectInfo bizProjectInfo, Model model) {
|
||||
model.addAttribute("bizProjectInfo", bizProjectInfo);
|
||||
return "modules/biz/bizProjectInfoForm";
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存数据
|
||||
*/
|
||||
@RequiresPermissions("biz:projectInfo:edit")
|
||||
@PostMapping(value = "save")
|
||||
@ResponseBody
|
||||
public String save(@Validated BizProjectInfo bizProjectInfo) {
|
||||
bizProjectInfoService.save(bizProjectInfo);
|
||||
return renderResult(Global.TRUE, text("保存项目信息成功!"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出数据
|
||||
*/
|
||||
@RequiresPermissions("biz:projectInfo:view")
|
||||
@RequestMapping(value = "exportData")
|
||||
public void exportData(BizProjectInfo bizProjectInfo, HttpServletResponse response) {
|
||||
List<BizProjectInfo> list = bizProjectInfoService.findList(bizProjectInfo);
|
||||
String fileName = "项目信息" + DateUtils.getDate("yyyyMMddHHmmss") + ".xlsx";
|
||||
try (ExcelExport ee = new ExcelExport("项目信息", BizProjectInfo.class)) {
|
||||
ee.setDataList(list).write(response, fileName);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载模板
|
||||
*/
|
||||
@RequiresPermissions("biz:projectInfo:view")
|
||||
@RequestMapping(value = "importTemplate")
|
||||
public void importTemplate(HttpServletResponse response) {
|
||||
BizProjectInfo bizProjectInfo = new BizProjectInfo();
|
||||
List<BizProjectInfo> list = ListUtils.newArrayList(bizProjectInfo);
|
||||
String fileName = "项目信息模板.xlsx";
|
||||
try (ExcelExport ee = new ExcelExport("项目信息", BizProjectInfo.class, Type.IMPORT)) {
|
||||
ee.setDataList(list).write(response, fileName);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入数据
|
||||
*/
|
||||
@ResponseBody
|
||||
@RequiresPermissions("biz:projectInfo:edit")
|
||||
@PostMapping(value = "importData")
|
||||
public String importData(MultipartFile file) {
|
||||
try {
|
||||
String message = bizProjectInfoService.importData(file);
|
||||
return renderResult(Global.TRUE, "posfull:" + message);
|
||||
} catch (Exception ex) {
|
||||
return renderResult(Global.FALSE, "posfull:" + ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
*/
|
||||
@RequiresPermissions("biz:projectInfo:edit")
|
||||
@RequestMapping(value = "delete")
|
||||
@ResponseBody
|
||||
public String delete(BizProjectInfo bizProjectInfo) {
|
||||
bizProjectInfoService.delete(bizProjectInfo);
|
||||
return renderResult(Global.TRUE, text("删除项目信息成功!"));
|
||||
}
|
||||
|
||||
@RequestMapping(value = "listAll")
|
||||
@ResponseBody
|
||||
public Page<BizProjectInfo> listData(BizProjectInfo bizProjectInfo, HttpServletRequest request, HttpServletResponse response) {
|
||||
bizProjectInfo.setPage(new Page<>(request, response));
|
||||
Page<BizProjectInfo> page = bizProjectInfoService.findPage(bizProjectInfo);
|
||||
return page;
|
||||
}
|
||||
public List<BizProjectInfo> listAll(BizProjectInfo bizProjectInfo) {
|
||||
return bizProjectInfoService.findList(bizProjectInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看编辑表单
|
||||
*/
|
||||
@RequiresPermissions("biz:projectInfo:view")
|
||||
@RequestMapping(value = "form")
|
||||
public String form(BizProjectInfo bizProjectInfo, Model model) {
|
||||
model.addAttribute("bizProjectInfo", bizProjectInfo);
|
||||
return "modules/biz/bizProjectInfoForm";
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存数据
|
||||
*/
|
||||
@RequiresPermissions("biz:projectInfo:edit")
|
||||
@PostMapping(value = "save")
|
||||
@ResponseBody
|
||||
public String save(@Validated BizProjectInfo bizProjectInfo) {
|
||||
bizProjectInfoService.save(bizProjectInfo);
|
||||
return renderResult(Global.TRUE, text("保存项目信息成功!"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出数据
|
||||
*/
|
||||
@RequiresPermissions("biz:projectInfo:view")
|
||||
@RequestMapping(value = "exportData")
|
||||
public void exportData(BizProjectInfo bizProjectInfo, HttpServletResponse response) {
|
||||
List<BizProjectInfo> list = bizProjectInfoService.findList(bizProjectInfo);
|
||||
String fileName = "项目信息" + DateUtils.getDate("yyyyMMddHHmmss") + ".xlsx";
|
||||
try(ExcelExport ee = new ExcelExport("项目信息", BizProjectInfo.class)){
|
||||
ee.setDataList(list).write(response, fileName);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载模板
|
||||
*/
|
||||
@RequiresPermissions("biz:projectInfo:view")
|
||||
@RequestMapping(value = "importTemplate")
|
||||
public void importTemplate(HttpServletResponse response) {
|
||||
BizProjectInfo bizProjectInfo = new BizProjectInfo();
|
||||
List<BizProjectInfo> list = ListUtils.newArrayList(bizProjectInfo);
|
||||
String fileName = "项目信息模板.xlsx";
|
||||
try(ExcelExport ee = new ExcelExport("项目信息", BizProjectInfo.class, Type.IMPORT)){
|
||||
ee.setDataList(list).write(response, fileName);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入数据
|
||||
*/
|
||||
@ResponseBody
|
||||
@RequiresPermissions("biz:projectInfo:edit")
|
||||
@PostMapping(value = "importData")
|
||||
public String importData(MultipartFile file) {
|
||||
try {
|
||||
String message = bizProjectInfoService.importData(file);
|
||||
return renderResult(Global.TRUE, "posfull:"+message);
|
||||
} catch (Exception ex) {
|
||||
return renderResult(Global.FALSE, "posfull:"+ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
*/
|
||||
@RequiresPermissions("biz:projectInfo:edit")
|
||||
@RequestMapping(value = "delete")
|
||||
@ResponseBody
|
||||
public String delete(BizProjectInfo bizProjectInfo) {
|
||||
bizProjectInfoService.delete(bizProjectInfo);
|
||||
return renderResult(Global.TRUE, text("删除项目信息成功!"));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.jeesite.modules.erp.dao;
|
||||
|
||||
import com.jeesite.common.dao.CrudDao;
|
||||
import com.jeesite.common.mybatis.annotation.MyBatisDao;
|
||||
import com.jeesite.modules.erp.entity.ErpAccount;
|
||||
|
||||
/**
|
||||
* 账户信息DAO接口
|
||||
* @author gaoxq
|
||||
* @version 2025-11-29
|
||||
*/
|
||||
@MyBatisDao(dataSourceName="work")
|
||||
public interface ErpAccountDao extends CrudDao<ErpAccount> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.jeesite.modules.erp.dao;
|
||||
|
||||
import com.jeesite.common.dao.CrudDao;
|
||||
import com.jeesite.common.mybatis.annotation.MyBatisDao;
|
||||
import com.jeesite.modules.erp.entity.ErpCategory;
|
||||
|
||||
/**
|
||||
* 分类信息DAO接口
|
||||
* @author gaoxq
|
||||
* @version 2025-11-29
|
||||
*/
|
||||
@MyBatisDao(dataSourceName="work")
|
||||
public interface ErpCategoryDao extends CrudDao<ErpCategory> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.jeesite.modules.erp.dao;
|
||||
|
||||
import com.jeesite.common.dao.CrudDao;
|
||||
import com.jeesite.common.mybatis.annotation.MyBatisDao;
|
||||
import com.jeesite.modules.erp.entity.ErpExpense;
|
||||
|
||||
/**
|
||||
* 支出信息DAO接口
|
||||
* @author gaoxq
|
||||
* @version 2025-11-29
|
||||
*/
|
||||
@MyBatisDao(dataSourceName="work")
|
||||
public interface ErpExpenseDao extends CrudDao<ErpExpense> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.jeesite.modules.erp.dao;
|
||||
|
||||
import com.jeesite.common.dao.CrudDao;
|
||||
import com.jeesite.common.mybatis.annotation.MyBatisDao;
|
||||
import com.jeesite.modules.erp.entity.ErpIncome;
|
||||
|
||||
/**
|
||||
* 收入信息DAO接口
|
||||
* @author gaoxq
|
||||
* @version 2025-11-29
|
||||
*/
|
||||
@MyBatisDao(dataSourceName="work")
|
||||
public interface ErpIncomeDao extends CrudDao<ErpIncome> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.jeesite.modules.erp.dao;
|
||||
|
||||
import com.jeesite.common.dao.CrudDao;
|
||||
import com.jeesite.common.mybatis.annotation.MyBatisDao;
|
||||
import com.jeesite.modules.erp.entity.ErpTransactionFlow;
|
||||
|
||||
/**
|
||||
* 明细信息DAO接口
|
||||
* @author gaoxq
|
||||
* @version 2025-11-29
|
||||
*/
|
||||
@MyBatisDao(dataSourceName="work")
|
||||
public interface ErpTransactionFlowDao extends CrudDao<ErpTransactionFlow> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
package com.jeesite.modules.erp.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
import com.jeesite.common.mybatis.annotation.JoinTable;
|
||||
import com.jeesite.common.mybatis.annotation.JoinTable.Type;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
||||
import com.jeesite.common.entity.DataEntity;
|
||||
import com.jeesite.common.mybatis.annotation.Column;
|
||||
import com.jeesite.common.mybatis.annotation.Table;
|
||||
import com.jeesite.common.mybatis.mapper.query.QueryType;
|
||||
import com.jeesite.common.utils.excel.annotation.ExcelField;
|
||||
import com.jeesite.common.utils.excel.annotation.ExcelField.Align;
|
||||
import com.jeesite.common.utils.excel.annotation.ExcelFields;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 账户信息Entity
|
||||
*
|
||||
* @author gaoxq
|
||||
* @version 2025-11-29
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Table(name = "erp_account", alias = "a", label = "账户信息信息", columns = {
|
||||
@Column(name = "create_time", attrName = "createTime", label = "记录时间", isUpdate = false, isQuery = false, isUpdateForce = true),
|
||||
@Column(name = "account_id", attrName = "accountId", label = "账户标识", isPK = true),
|
||||
@Column(name = "account_name", attrName = "accountName", label = "账户名称", queryType = QueryType.LIKE),
|
||||
@Column(name = "account_type", attrName = "accountType", label = "账户类型"),
|
||||
@Column(name = "account_code", attrName = "accountCode", label = "账户卡号", isQuery = false),
|
||||
@Column(name = "initial_balance", attrName = "initialBalance", label = "初始余额", isQuery = false),
|
||||
@Column(name = "current_balance", attrName = "currentBalance", label = "当前余额", isQuery = false),
|
||||
@Column(name = "is_active", attrName = "isActive", label = "是否激活"),
|
||||
@Column(name = "update_time", attrName = "updateTime", label = "更新时间", isQuery = false, isUpdateForce = true),
|
||||
@Column(name = "f_tenant_id", attrName = "ftenantId", label = "租户id", isUpdate = false, isQuery = false),
|
||||
@Column(name = "f_flow_id", attrName = "fflowId", label = "流程id", isUpdate = false, isQuery = false),
|
||||
@Column(name = "f_flow_task_id", attrName = "fflowTaskId", label = "流程任务主键", isUpdate = false, isQuery = false),
|
||||
@Column(name = "f_flow_state", attrName = "fflowState", label = "流程任务状态", isUpdate = false, isQuery = false, isUpdateForce = true),
|
||||
}, orderBy = "a.create_time DESC"
|
||||
)
|
||||
@Data
|
||||
public class ErpAccount extends DataEntity<ErpAccount> implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
private Date createTime; // 记录时间
|
||||
private String accountId; // 账户标识
|
||||
private String accountName; // 账户名称
|
||||
private String accountType; // 账户类型
|
||||
private String accountCode; // 账户卡号
|
||||
private BigDecimal initialBalance; // 初始余额
|
||||
private BigDecimal currentBalance; // 当前余额
|
||||
private String isActive; // 是否激活
|
||||
private Date updateTime; // 更新时间
|
||||
private String ftenantId; // 租户id
|
||||
private String fflowId; // 流程id
|
||||
private String fflowTaskId; // 流程任务主键
|
||||
private Integer fflowState; // 流程任务状态
|
||||
|
||||
@ExcelFields({
|
||||
@ExcelField(title = "记录时间", attrName = "createTime", align = Align.CENTER, sort = 10, dataFormat = "yyyy-MM-dd hh:mm"),
|
||||
@ExcelField(title = "账户标识", attrName = "accountId", align = Align.CENTER, sort = 20),
|
||||
@ExcelField(title = "账户名称", attrName = "accountName", align = Align.CENTER, sort = 30),
|
||||
@ExcelField(title = "账户类型", attrName = "accountType", dictType = "account_type", align = Align.CENTER, sort = 40),
|
||||
@ExcelField(title = "账户卡号", attrName = "accountCode", align = Align.CENTER, sort = 50),
|
||||
@ExcelField(title = "初始余额", attrName = "initialBalance", align = Align.CENTER, sort = 60),
|
||||
@ExcelField(title = "当前余额", attrName = "currentBalance", align = Align.CENTER, sort = 70),
|
||||
@ExcelField(title = "是否激活", attrName = "isActive", dictType = "is_active", align = Align.CENTER, sort = 80),
|
||||
@ExcelField(title = "更新时间", attrName = "updateTime", align = Align.CENTER, sort = 90, dataFormat = "yyyy-MM-dd hh:mm"),
|
||||
})
|
||||
public ErpAccount() {
|
||||
this(null);
|
||||
}
|
||||
|
||||
public ErpAccount(String id) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
package com.jeesite.modules.erp.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
import com.jeesite.common.mybatis.annotation.JoinTable;
|
||||
import com.jeesite.common.mybatis.annotation.JoinTable.Type;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.Size;
|
||||
|
||||
import com.jeesite.common.entity.DataEntity;
|
||||
import com.jeesite.common.mybatis.annotation.Column;
|
||||
import com.jeesite.common.mybatis.annotation.Table;
|
||||
import com.jeesite.common.mybatis.mapper.query.QueryType;
|
||||
import com.jeesite.common.utils.excel.annotation.ExcelField;
|
||||
import com.jeesite.common.utils.excel.annotation.ExcelField.Align;
|
||||
import com.jeesite.common.utils.excel.annotation.ExcelFields;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 分类信息Entity
|
||||
*
|
||||
* @author gaoxq
|
||||
* @version 2025-11-29
|
||||
*/
|
||||
@Table(name = "erp_category", alias = "a", label = "分类信息信息", columns = {
|
||||
@Column(name = "create_time", attrName = "createTime", label = "记录时间", isUpdate = false, isQuery = false),
|
||||
@Column(name = "category_id", attrName = "categoryId", label = "分类标识", isPK = true),
|
||||
@Column(name = "category_name", attrName = "categoryName", label = "分类名称", queryType = QueryType.LIKE),
|
||||
@Column(name = "category_type", attrName = "categoryType", label = "分类类型"),
|
||||
@Column(name = "parent_id", attrName = "parentId", label = "父级分类", isQuery = false),
|
||||
@Column(name = "sort_order", attrName = "sortOrder", label = "排序序号", isQuery = false),
|
||||
@Column(name = "is_active", attrName = "isActive", label = "是否启用"),
|
||||
@Column(name = "update_time", attrName = "updateTime", label = "更新时间", isQuery = false, isUpdateForce = true),
|
||||
@Column(name = "f_tenant_id", attrName = "ftenantId", label = "租户id", isInsert = false, isUpdate = false, isQuery = false),
|
||||
@Column(name = "f_flow_id", attrName = "fflowId", label = "流程id", isInsert = false, isUpdate = false, isQuery = false),
|
||||
@Column(name = "f_flow_task_id", attrName = "fflowTaskId", label = "流程任务主键", isInsert = false, isUpdate = false, isQuery = false),
|
||||
@Column(name = "f_flow_state", attrName = "fflowState", label = "流程任务状态", isInsert = false, isUpdate = false, isQuery = false, isUpdateForce = true),
|
||||
}, orderBy = "a.create_time DESC"
|
||||
)
|
||||
@Data
|
||||
public class ErpCategory extends DataEntity<ErpCategory> implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
private Date createTime; // 记录时间
|
||||
private String categoryId; // 分类标识
|
||||
private String categoryName; // 分类名称
|
||||
private String categoryType; // 分类类型
|
||||
private String parentId; // 父级分类
|
||||
private String sortOrder; // 排序序号
|
||||
private String isActive; // 是否启用
|
||||
private Date updateTime; // 更新时间
|
||||
private String ftenantId; // 租户id
|
||||
private String fflowId; // 流程id
|
||||
private String fflowTaskId; // 流程任务主键
|
||||
private Integer fflowState; // 流程任务状态
|
||||
|
||||
@ExcelFields({
|
||||
@ExcelField(title = "记录时间", attrName = "createTime", align = Align.CENTER, sort = 10, dataFormat = "yyyy-MM-dd hh:mm"),
|
||||
@ExcelField(title = "分类标识", attrName = "categoryId", align = Align.CENTER, sort = 20),
|
||||
@ExcelField(title = "分类名称", attrName = "categoryName", align = Align.CENTER, sort = 30),
|
||||
@ExcelField(title = "分类类型", attrName = "categoryType", dictType = "category_type", align = Align.CENTER, sort = 40),
|
||||
@ExcelField(title = "父级分类", attrName = "parentId", dictType = "parent_type", align = Align.CENTER, sort = 50),
|
||||
@ExcelField(title = "排序序号", attrName = "sortOrder", align = Align.CENTER, sort = 60),
|
||||
@ExcelField(title = "是否启用", attrName = "isActive", dictType = "is_active", align = Align.CENTER, sort = 70),
|
||||
@ExcelField(title = "更新时间", attrName = "updateTime", align = Align.CENTER, sort = 80, dataFormat = "yyyy-MM-dd hh:mm"),
|
||||
})
|
||||
public ErpCategory() {
|
||||
this(null);
|
||||
}
|
||||
|
||||
public ErpCategory(String id) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,124 @@
|
||||
package com.jeesite.modules.erp.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
import com.jeesite.common.mybatis.annotation.JoinTable;
|
||||
import com.jeesite.common.mybatis.annotation.JoinTable.Type;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
||||
import com.jeesite.common.entity.DataEntity;
|
||||
import com.jeesite.common.mybatis.annotation.Column;
|
||||
import com.jeesite.common.mybatis.annotation.Table;
|
||||
import com.jeesite.common.mybatis.mapper.query.QueryType;
|
||||
import com.jeesite.common.utils.excel.annotation.ExcelField;
|
||||
import com.jeesite.common.utils.excel.annotation.ExcelField.Align;
|
||||
import com.jeesite.common.utils.excel.annotation.ExcelFields;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 支出信息Entity
|
||||
*
|
||||
* @author gaoxq
|
||||
* @version 2025-11-29
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Table(name = "erp_expense", alias = "a", label = "支出信息信息", columns = {
|
||||
@Column(name = "create_time", attrName = "createTime", label = "记录时间", isUpdate = false, isUpdateForce = true),
|
||||
@Column(name = "expense_id", attrName = "expenseId", label = "支出ID", isPK = true),
|
||||
@Column(name = "zflow_id", attrName = "zflowId", label = "关联流水ID", isQuery = false),
|
||||
@Column(name = "account_id", attrName = "accountId", label = "支出账户ID", isQuery = false),
|
||||
@Column(name = "category_id", attrName = "categoryId", label = "支出分类ID"),
|
||||
@Column(name = "amount", attrName = "amount", label = "交易金额", isQuery = false),
|
||||
@Column(name = "update_time", attrName = "updateTime", label = "更新时间", isQuery = false, isUpdateForce = true),
|
||||
@Column(name = "f_tenant_id", attrName = "ftenantId", label = "租户id", isUpdate = false, isQuery = false),
|
||||
@Column(name = "f_flow_id", attrName = "fflowId", label = "流程id", isUpdate = false, isQuery = false),
|
||||
@Column(name = "f_flow_task_id", attrName = "fflowTaskId", label = "流程任务主键", isUpdate = false, isQuery = false),
|
||||
@Column(name = "f_flow_state", attrName = "fflowState", label = "流程任务状态", isUpdate = false, isQuery = false, isUpdateForce = true),
|
||||
}, joinTable = {
|
||||
@JoinTable(type = Type.LEFT_JOIN, entity = ErpAccount.class, attrName = "this", alias = "b",
|
||||
on = "a.account_id = b.account_id",
|
||||
columns = {
|
||||
@Column(name = "account_name", attrName = "accountName", label = "账户名称"),
|
||||
}),
|
||||
@JoinTable(type = Type.LEFT_JOIN, entity = ErpCategory.class, attrName = "this", alias = "c",
|
||||
on = "a.category_id = c.category_id",
|
||||
columns = {
|
||||
@Column(name = "parent_id", attrName = "parentId", label = "父级分类"),
|
||||
@Column(name = "category_name", attrName = "categoryName", label = "分类名称"),
|
||||
}),
|
||||
@JoinTable(type = Type.LEFT_JOIN, entity = ErpTransactionFlow.class, attrName = "this", alias = "d",
|
||||
on = "a.zflow_id = d.flow_id",
|
||||
columns = {
|
||||
@Column(name = "flow_name", attrName = "flowName", label = "交易名称"),
|
||||
@Column(name = "is_finish", attrName = "isFinish", label = "是否记账"),
|
||||
}),
|
||||
}, orderBy = "a.create_time DESC"
|
||||
)
|
||||
@Data
|
||||
public class ErpExpense extends DataEntity<ErpExpense> implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
private Date createTime; // 记录时间
|
||||
private String expenseId; // 支出ID
|
||||
private String zflowId; // 关联流水ID
|
||||
private String accountId; // 支出账户ID
|
||||
private String categoryId; // 支出分类ID
|
||||
private BigDecimal amount; // 交易金额
|
||||
private Date updateTime; // 更新时间
|
||||
private String ftenantId; // 租户id
|
||||
private String fflowId; // 流程id
|
||||
private String fflowTaskId; // 流程任务主键
|
||||
private Integer fflowState; // 流程任务状态
|
||||
|
||||
private String accountName;
|
||||
|
||||
private String parentId;
|
||||
|
||||
private String categoryName;
|
||||
|
||||
private String flowName;
|
||||
|
||||
@ExcelFields({
|
||||
@ExcelField(title = "记录时间", attrName = "createTime", align = Align.CENTER, sort = 10, dataFormat = "yyyy-MM-dd hh:mm"),
|
||||
@ExcelField(title = "支出编号", attrName = "expenseId", align = Align.CENTER, sort = 20),
|
||||
@ExcelField(title = "交易名称", attrName = "flowName", align = Align.CENTER, sort = 30),
|
||||
@ExcelField(title = "支出账号", attrName = "accountName", align = Align.CENTER, sort = 40),
|
||||
@ExcelField(title = "支出分类", attrName = "categoryName", align = Align.CENTER, sort = 50),
|
||||
@ExcelField(title = "父级分类", attrName = "parentId", dictType = "parent_type", align = Align.CENTER, sort = 50),
|
||||
@ExcelField(title = "交易金额", attrName = "amount", align = Align.CENTER, sort = 60),
|
||||
@ExcelField(title = "更新时间", attrName = "updateTime", align = Align.CENTER, sort = 70, dataFormat = "yyyy-MM-dd hh:mm"),
|
||||
})
|
||||
public ErpExpense() {
|
||||
this(null);
|
||||
}
|
||||
|
||||
public ErpExpense(String id) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
public Date getCreateTime_gte() {
|
||||
return sqlMap.getWhere().getValue("create_time", QueryType.GTE);
|
||||
}
|
||||
|
||||
public void setCreateTime_gte(Date createTime) {
|
||||
sqlMap.getWhere().and("create_time", QueryType.GTE, createTime);
|
||||
}
|
||||
|
||||
public Date getCreateTime_lte() {
|
||||
return sqlMap.getWhere().getValue("create_time", QueryType.LTE);
|
||||
}
|
||||
|
||||
public void setCreateTime_lte(Date createTime) {
|
||||
sqlMap.getWhere().and("create_time", QueryType.LTE, createTime);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,124 @@
|
||||
package com.jeesite.modules.erp.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
import com.jeesite.common.mybatis.annotation.JoinTable;
|
||||
import com.jeesite.common.mybatis.annotation.JoinTable.Type;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
||||
import com.jeesite.common.entity.DataEntity;
|
||||
import com.jeesite.common.mybatis.annotation.Column;
|
||||
import com.jeesite.common.mybatis.annotation.Table;
|
||||
import com.jeesite.common.mybatis.mapper.query.QueryType;
|
||||
import com.jeesite.common.utils.excel.annotation.ExcelField;
|
||||
import com.jeesite.common.utils.excel.annotation.ExcelField.Align;
|
||||
import com.jeesite.common.utils.excel.annotation.ExcelFields;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 收入信息Entity
|
||||
*
|
||||
* @author gaoxq
|
||||
* @version 2025-11-29
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Table(name = "erp_income", alias = "a", label = "收入信息信息", columns = {
|
||||
@Column(name = "create_time", attrName = "createTime", label = "记录时间", isUpdate = false, isUpdateForce = true),
|
||||
@Column(name = "income_id", attrName = "incomeId", label = "收入ID", isPK = true),
|
||||
@Column(name = "sflow_id", attrName = "sflowId", label = "关联流水ID", isQuery = false),
|
||||
@Column(name = "account_id", attrName = "accountId", label = "收入账户ID", isQuery = false),
|
||||
@Column(name = "category_id", attrName = "categoryId", label = "收入分类ID"),
|
||||
@Column(name = "amount", attrName = "amount", label = "交易金额", comment = "交易金额(正数)", isQuery = false),
|
||||
@Column(name = "update_time", attrName = "updateTime", label = "更新时间", isQuery = false, isUpdateForce = true),
|
||||
@Column(name = "f_tenant_id", attrName = "ftenantId", label = "租户id", isUpdate = false, isQuery = false),
|
||||
@Column(name = "f_flow_id", attrName = "fflowId", label = "流程id", isUpdate = false, isQuery = false),
|
||||
@Column(name = "f_flow_task_id", attrName = "fflowTaskId", label = "流程任务主键", isUpdate = false, isQuery = false),
|
||||
@Column(name = "f_flow_state", attrName = "fflowState", label = "流程任务状态", isUpdate = false, isQuery = false, isUpdateForce = true),
|
||||
}, joinTable = {
|
||||
@JoinTable(type = Type.LEFT_JOIN, entity = ErpAccount.class, attrName = "this", alias = "b",
|
||||
on = "a.account_id = b.account_id",
|
||||
columns = {
|
||||
@Column(name = "account_name", attrName = "accountName", label = "账户名称"),
|
||||
}),
|
||||
@JoinTable(type = Type.LEFT_JOIN, entity = ErpCategory.class, attrName = "this", alias = "c",
|
||||
on = "a.category_id = c.category_id",
|
||||
columns = {
|
||||
@Column(name = "parent_id", attrName = "parentId", label = "父级分类"),
|
||||
@Column(name = "category_name", attrName = "categoryName", label = "分类名称"),
|
||||
}),
|
||||
@JoinTable(type = Type.LEFT_JOIN, entity = ErpTransactionFlow.class, attrName = "this", alias = "d",
|
||||
on = "a.sflow_id = d.flow_id",
|
||||
columns = {
|
||||
@Column(name = "flow_name", attrName = "flowName", label = "交易名称"),
|
||||
@Column(name = "is_finish", attrName = "isFinish", label = "是否记账"),
|
||||
}),
|
||||
}, orderBy = "a.create_time DESC"
|
||||
)
|
||||
@Data
|
||||
public class ErpIncome extends DataEntity<ErpIncome> implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
private Date createTime; // 记录时间
|
||||
private String incomeId; // 收入ID
|
||||
private String sflowId; // 关联流水ID
|
||||
private String accountId; // 收入账户ID
|
||||
private String categoryId; // 收入分类ID
|
||||
private BigDecimal amount; // 交易金额(正数)
|
||||
private Date updateTime; // 更新时间
|
||||
private String ftenantId; // 租户id
|
||||
private String fflowId; // 流程id
|
||||
private String fflowTaskId; // 流程任务主键
|
||||
private Integer fflowState; // 流程任务状态
|
||||
|
||||
private String accountName;
|
||||
|
||||
private String parentId;
|
||||
|
||||
private String categoryName;
|
||||
|
||||
private String flowName;
|
||||
|
||||
@ExcelFields({
|
||||
@ExcelField(title = "记录时间", attrName = "createTime", align = Align.CENTER, sort = 10, dataFormat = "yyyy-MM-dd hh:mm"),
|
||||
@ExcelField(title = "收入编号", attrName = "incomeId", align = Align.CENTER, sort = 20),
|
||||
@ExcelField(title = "交易名称", attrName = "flowName", align = Align.CENTER, sort = 30),
|
||||
@ExcelField(title = "收入账户", attrName = "accountName", align = Align.CENTER, sort = 40),
|
||||
@ExcelField(title = "收入分类", attrName = "categoryName", align = Align.CENTER, sort = 50),
|
||||
@ExcelField(title = "父级分类", attrName = "parentId", dictType = "parent_type", align = Align.CENTER, sort = 50),
|
||||
@ExcelField(title = "交易金额", attrName = "amount", align = Align.CENTER, sort = 60),
|
||||
@ExcelField(title = "更新时间", attrName = "updateTime", align = Align.CENTER, sort = 70, dataFormat = "yyyy-MM-dd hh:mm"),
|
||||
})
|
||||
public ErpIncome() {
|
||||
this(null);
|
||||
}
|
||||
|
||||
public ErpIncome(String id) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
public Date getCreateTime_gte() {
|
||||
return sqlMap.getWhere().getValue("create_time", QueryType.GTE);
|
||||
}
|
||||
|
||||
public void setCreateTime_gte(Date createTime) {
|
||||
sqlMap.getWhere().and("create_time", QueryType.GTE, createTime);
|
||||
}
|
||||
|
||||
public Date getCreateTime_lte() {
|
||||
return sqlMap.getWhere().getValue("create_time", QueryType.LTE);
|
||||
}
|
||||
|
||||
public void setCreateTime_lte(Date createTime) {
|
||||
sqlMap.getWhere().and("create_time", QueryType.LTE, createTime);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
package com.jeesite.modules.erp.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
import com.jeesite.common.mybatis.annotation.JoinTable;
|
||||
import com.jeesite.common.mybatis.annotation.JoinTable.Type;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.jeesite.modules.biz.entity.BizProvince;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
||||
import com.jeesite.common.entity.DataEntity;
|
||||
import com.jeesite.common.mybatis.annotation.Column;
|
||||
import com.jeesite.common.mybatis.annotation.Table;
|
||||
import com.jeesite.common.mybatis.mapper.query.QueryType;
|
||||
import com.jeesite.common.utils.excel.annotation.ExcelField;
|
||||
import com.jeesite.common.utils.excel.annotation.ExcelField.Align;
|
||||
import com.jeesite.common.utils.excel.annotation.ExcelFields;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 明细信息Entity
|
||||
*
|
||||
* @author gaoxq
|
||||
* @version 2025-11-29
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Table(name = "erp_transaction_flow", alias = "a", label = "明细信息信息", columns = {
|
||||
@Column(name = "create_time", attrName = "createTime", label = "记录时间", isUpdate = false, isUpdateForce = true),
|
||||
@Column(name = "flow_id", attrName = "flowId", label = "流水编号", isPK = true),
|
||||
@Column(name = "flow_name", attrName = "flowName", label = "交易名称", queryType = QueryType.LIKE),
|
||||
@Column(name = "transaction_type", attrName = "transactionType", label = "交易类型"),
|
||||
@Column(name = "amount", attrName = "amount", label = "交易金额", isQuery = false),
|
||||
@Column(name = "transaction_time", attrName = "transactionTime", label = "交易时间", isQuery = false, isUpdateForce = true),
|
||||
@Column(name = "account_id", attrName = "accountId", label = "交易账户"),
|
||||
@Column(name = "category_id", attrName = "categoryId", label = "交易分类"),
|
||||
@Column(name = "remark", attrName = "remark", label = "交易备注", isQuery = false),
|
||||
@Column(name = "is_finish", attrName = "isFinish", label = "是否记账"),
|
||||
@Column(name = "update_time", attrName = "updateTime", label = "更新时间", isQuery = false, isUpdateForce = true),
|
||||
@Column(name = "f_tenant_id", attrName = "ftenantId", label = "租户id", isUpdate = false, isQuery = false),
|
||||
@Column(name = "f_flow_id", attrName = "fflowId", label = "流程id", isUpdate = false, isQuery = false),
|
||||
@Column(name = "f_flow_task_id", attrName = "fflowTaskId", label = "流程任务主键", isUpdate = false, isQuery = false),
|
||||
@Column(name = "f_flow_state", attrName = "fflowState", label = "流程任务状态", isUpdate = false, isQuery = false, isUpdateForce = true),
|
||||
}, joinTable = {
|
||||
@JoinTable(type = Type.LEFT_JOIN, entity = ErpAccount.class, attrName = "this", alias = "b",
|
||||
on = "a.account_id = b.account_id",
|
||||
columns = {
|
||||
@Column(name = "account_name", attrName = "accountName", label = "账户名称"),
|
||||
}),
|
||||
|
||||
@JoinTable(type = Type.LEFT_JOIN, entity = ErpCategory.class, attrName = "this", alias = "c",
|
||||
on = "a.category_id = c.category_id",
|
||||
columns = {
|
||||
@Column(name = "parent_id", attrName = "parentId", label = "父级分类"),
|
||||
@Column(name = "category_name", attrName = "categoryName", label = "分类名称"),
|
||||
}),
|
||||
}, orderBy = "a.create_time DESC"
|
||||
)
|
||||
@Data
|
||||
public class ErpTransactionFlow extends DataEntity<ErpTransactionFlow> implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
private Date createTime; // 记录时间
|
||||
private String flowId; // 流水编号
|
||||
private String flowName; // 交易名称
|
||||
private String transactionType; // 交易类型
|
||||
private BigDecimal amount; // 交易金额
|
||||
private Date transactionTime; // 交易时间
|
||||
private String accountId; // 交易账户
|
||||
private String categoryId; // 交易分类
|
||||
private String remark; // 交易备注
|
||||
private String isFinish; // 是否记账
|
||||
private Date updateTime; // 更新时间
|
||||
private String ftenantId; // 租户id
|
||||
private String fflowId; // 流程id
|
||||
private String fflowTaskId; // 流程任务主键
|
||||
private Integer fflowState; // 流程任务状态
|
||||
|
||||
private String accountName;
|
||||
|
||||
private String parentId;
|
||||
|
||||
private String categoryName;
|
||||
|
||||
|
||||
@ExcelFields({
|
||||
@ExcelField(title = "记录时间", attrName = "createTime", align = Align.CENTER, sort = 10, dataFormat = "yyyy-MM-dd hh:mm"),
|
||||
@ExcelField(title = "流水编号", attrName = "flowId", align = Align.CENTER, sort = 20),
|
||||
@ExcelField(title = "交易名称", attrName = "flowName", align = Align.CENTER, sort = 30),
|
||||
@ExcelField(title = "交易类型", attrName = "transactionType", dictType = "transaction_type", align = Align.CENTER, sort = 40),
|
||||
@ExcelField(title = "交易金额", attrName = "amount", align = Align.CENTER, sort = 50),
|
||||
@ExcelField(title = "交易时间", attrName = "transactionTime", align = Align.CENTER, sort = 60, dataFormat = "yyyy-MM-dd hh:mm"),
|
||||
@ExcelField(title = "交易账户", attrName = "accountName", align = Align.CENTER, sort = 70),
|
||||
@ExcelField(title = "父级分类", attrName = "parentId", dictType = "parent_type", align = Align.CENTER, sort = 80),
|
||||
@ExcelField(title = "交易分类", attrName = "categoryName", align = Align.CENTER, sort = 80),
|
||||
@ExcelField(title = "交易备注", attrName = "remark", align = Align.CENTER, sort = 90),
|
||||
@ExcelField(title = "是否记账", attrName = "isFinish", dictType = "is_finish", align = Align.CENTER, sort = 100),
|
||||
@ExcelField(title = "更新时间", attrName = "updateTime", align = Align.CENTER, sort = 110, dataFormat = "yyyy-MM-dd hh:mm"),
|
||||
})
|
||||
public ErpTransactionFlow() {
|
||||
this(null);
|
||||
}
|
||||
|
||||
public ErpTransactionFlow(String id) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
public Date getCreateTime_gte() {
|
||||
return sqlMap.getWhere().getValue("create_time", QueryType.GTE);
|
||||
}
|
||||
|
||||
public void setCreateTime_gte(Date createTime) {
|
||||
sqlMap.getWhere().and("create_time", QueryType.GTE, createTime);
|
||||
}
|
||||
|
||||
public Date getCreateTime_lte() {
|
||||
return sqlMap.getWhere().getValue("create_time", QueryType.LTE);
|
||||
}
|
||||
|
||||
public void setCreateTime_lte(Date createTime) {
|
||||
sqlMap.getWhere().and("create_time", QueryType.LTE, createTime);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
package com.jeesite.modules.erp.service;
|
||||
|
||||
import java.util.List;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.jeesite.common.entity.Page;
|
||||
import com.jeesite.common.service.CrudService;
|
||||
import com.jeesite.modules.erp.entity.ErpAccount;
|
||||
import com.jeesite.modules.erp.dao.ErpAccountDao;
|
||||
import com.jeesite.common.service.ServiceException;
|
||||
import com.jeesite.common.config.Global;
|
||||
import com.jeesite.common.validator.ValidatorUtils;
|
||||
import com.jeesite.common.utils.excel.ExcelImport;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import jakarta.validation.ConstraintViolation;
|
||||
import jakarta.validation.ConstraintViolationException;
|
||||
|
||||
/**
|
||||
* 账户信息Service
|
||||
* @author gaoxq
|
||||
* @version 2025-11-29
|
||||
*/
|
||||
@Service
|
||||
public class ErpAccountService extends CrudService<ErpAccountDao, ErpAccount> {
|
||||
|
||||
/**
|
||||
* 获取单条数据
|
||||
* @param erpAccount 主键
|
||||
*/
|
||||
@Override
|
||||
public ErpAccount get(ErpAccount erpAccount) {
|
||||
return super.get(erpAccount);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询分页数据
|
||||
* @param erpAccount 查询条件
|
||||
* @param erpAccount page 分页对象
|
||||
*/
|
||||
@Override
|
||||
public Page<ErpAccount> findPage(ErpAccount erpAccount) {
|
||||
return super.findPage(erpAccount);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表数据
|
||||
* @param erpAccount 查询条件
|
||||
*/
|
||||
@Override
|
||||
public List<ErpAccount> findList(ErpAccount erpAccount) {
|
||||
return super.findList(erpAccount);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存数据(插入或更新)
|
||||
* @param erpAccount 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void save(ErpAccount erpAccount) {
|
||||
super.save(erpAccount);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入数据
|
||||
* @param file 导入的数据文件
|
||||
*/
|
||||
@Transactional
|
||||
public String importData(MultipartFile file) {
|
||||
if (file == null){
|
||||
throw new ServiceException(text("请选择导入的数据文件!"));
|
||||
}
|
||||
int successNum = 0; int failureNum = 0;
|
||||
StringBuilder successMsg = new StringBuilder();
|
||||
StringBuilder failureMsg = new StringBuilder();
|
||||
try(ExcelImport ei = new ExcelImport(file, 2, 0)){
|
||||
List<ErpAccount> list = ei.getDataList(ErpAccount.class);
|
||||
for (ErpAccount erpAccount : list) {
|
||||
try{
|
||||
ValidatorUtils.validateWithException(erpAccount);
|
||||
this.save(erpAccount);
|
||||
successNum++;
|
||||
successMsg.append("<br/>" + successNum + "、编号 " + erpAccount.getId() + " 导入成功");
|
||||
} catch (Exception e) {
|
||||
failureNum++;
|
||||
String msg = "<br/>" + failureNum + "、编号 " + erpAccount.getId() + " 导入失败:";
|
||||
if (e instanceof ConstraintViolationException){
|
||||
ConstraintViolationException cve = (ConstraintViolationException)e;
|
||||
for (ConstraintViolation<?> violation : cve.getConstraintViolations()) {
|
||||
msg += Global.getText(violation.getMessage()) + " ("+violation.getPropertyPath()+")";
|
||||
}
|
||||
}else{
|
||||
msg += e.getMessage();
|
||||
}
|
||||
failureMsg.append(msg);
|
||||
logger.error(msg, e);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getMessage(), e);
|
||||
failureMsg.append(e.getMessage());
|
||||
return failureMsg.toString();
|
||||
}
|
||||
if (failureNum > 0) {
|
||||
failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:");
|
||||
throw new ServiceException(failureMsg.toString());
|
||||
}else{
|
||||
successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:");
|
||||
}
|
||||
return successMsg.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新状态
|
||||
* @param erpAccount 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void updateStatus(ErpAccount erpAccount) {
|
||||
super.updateStatus(erpAccount);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
* @param erpAccount 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void delete(ErpAccount erpAccount) {
|
||||
super.delete(erpAccount);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
package com.jeesite.modules.erp.service;
|
||||
|
||||
import java.util.List;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.jeesite.common.entity.Page;
|
||||
import com.jeesite.common.service.CrudService;
|
||||
import com.jeesite.modules.erp.entity.ErpCategory;
|
||||
import com.jeesite.modules.erp.dao.ErpCategoryDao;
|
||||
import com.jeesite.common.service.ServiceException;
|
||||
import com.jeesite.common.config.Global;
|
||||
import com.jeesite.common.validator.ValidatorUtils;
|
||||
import com.jeesite.common.utils.excel.ExcelImport;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import jakarta.validation.ConstraintViolation;
|
||||
import jakarta.validation.ConstraintViolationException;
|
||||
|
||||
/**
|
||||
* 分类信息Service
|
||||
* @author gaoxq
|
||||
* @version 2025-11-29
|
||||
*/
|
||||
@Service
|
||||
public class ErpCategoryService extends CrudService<ErpCategoryDao, ErpCategory> {
|
||||
|
||||
/**
|
||||
* 获取单条数据
|
||||
* @param erpCategory 主键
|
||||
*/
|
||||
@Override
|
||||
public ErpCategory get(ErpCategory erpCategory) {
|
||||
return super.get(erpCategory);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询分页数据
|
||||
* @param erpCategory 查询条件
|
||||
* @param erpCategory page 分页对象
|
||||
*/
|
||||
@Override
|
||||
public Page<ErpCategory> findPage(ErpCategory erpCategory) {
|
||||
return super.findPage(erpCategory);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表数据
|
||||
* @param erpCategory 查询条件
|
||||
*/
|
||||
@Override
|
||||
public List<ErpCategory> findList(ErpCategory erpCategory) {
|
||||
return super.findList(erpCategory);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存数据(插入或更新)
|
||||
* @param erpCategory 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void save(ErpCategory erpCategory) {
|
||||
super.save(erpCategory);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入数据
|
||||
* @param file 导入的数据文件
|
||||
*/
|
||||
@Transactional
|
||||
public String importData(MultipartFile file) {
|
||||
if (file == null){
|
||||
throw new ServiceException(text("请选择导入的数据文件!"));
|
||||
}
|
||||
int successNum = 0; int failureNum = 0;
|
||||
StringBuilder successMsg = new StringBuilder();
|
||||
StringBuilder failureMsg = new StringBuilder();
|
||||
try(ExcelImport ei = new ExcelImport(file, 2, 0)){
|
||||
List<ErpCategory> list = ei.getDataList(ErpCategory.class);
|
||||
for (ErpCategory erpCategory : list) {
|
||||
try{
|
||||
ValidatorUtils.validateWithException(erpCategory);
|
||||
this.save(erpCategory);
|
||||
successNum++;
|
||||
successMsg.append("<br/>" + successNum + "、编号 " + erpCategory.getId() + " 导入成功");
|
||||
} catch (Exception e) {
|
||||
failureNum++;
|
||||
String msg = "<br/>" + failureNum + "、编号 " + erpCategory.getId() + " 导入失败:";
|
||||
if (e instanceof ConstraintViolationException){
|
||||
ConstraintViolationException cve = (ConstraintViolationException)e;
|
||||
for (ConstraintViolation<?> violation : cve.getConstraintViolations()) {
|
||||
msg += Global.getText(violation.getMessage()) + " ("+violation.getPropertyPath()+")";
|
||||
}
|
||||
}else{
|
||||
msg += e.getMessage();
|
||||
}
|
||||
failureMsg.append(msg);
|
||||
logger.error(msg, e);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getMessage(), e);
|
||||
failureMsg.append(e.getMessage());
|
||||
return failureMsg.toString();
|
||||
}
|
||||
if (failureNum > 0) {
|
||||
failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:");
|
||||
throw new ServiceException(failureMsg.toString());
|
||||
}else{
|
||||
successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:");
|
||||
}
|
||||
return successMsg.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新状态
|
||||
* @param erpCategory 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void updateStatus(ErpCategory erpCategory) {
|
||||
super.updateStatus(erpCategory);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
* @param erpCategory 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void delete(ErpCategory erpCategory) {
|
||||
super.delete(erpCategory);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
package com.jeesite.modules.erp.service;
|
||||
|
||||
import java.util.List;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.jeesite.common.entity.Page;
|
||||
import com.jeesite.common.service.CrudService;
|
||||
import com.jeesite.modules.erp.entity.ErpExpense;
|
||||
import com.jeesite.modules.erp.dao.ErpExpenseDao;
|
||||
import com.jeesite.common.service.ServiceException;
|
||||
import com.jeesite.common.config.Global;
|
||||
import com.jeesite.common.validator.ValidatorUtils;
|
||||
import com.jeesite.common.utils.excel.ExcelImport;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import jakarta.validation.ConstraintViolation;
|
||||
import jakarta.validation.ConstraintViolationException;
|
||||
|
||||
/**
|
||||
* 支出信息Service
|
||||
* @author gaoxq
|
||||
* @version 2025-11-29
|
||||
*/
|
||||
@Service
|
||||
public class ErpExpenseService extends CrudService<ErpExpenseDao, ErpExpense> {
|
||||
|
||||
/**
|
||||
* 获取单条数据
|
||||
* @param erpExpense 主键
|
||||
*/
|
||||
@Override
|
||||
public ErpExpense get(ErpExpense erpExpense) {
|
||||
return super.get(erpExpense);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询分页数据
|
||||
* @param erpExpense 查询条件
|
||||
* @param erpExpense page 分页对象
|
||||
*/
|
||||
@Override
|
||||
public Page<ErpExpense> findPage(ErpExpense erpExpense) {
|
||||
return super.findPage(erpExpense);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表数据
|
||||
* @param erpExpense 查询条件
|
||||
*/
|
||||
@Override
|
||||
public List<ErpExpense> findList(ErpExpense erpExpense) {
|
||||
return super.findList(erpExpense);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存数据(插入或更新)
|
||||
* @param erpExpense 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void save(ErpExpense erpExpense) {
|
||||
super.save(erpExpense);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入数据
|
||||
* @param file 导入的数据文件
|
||||
*/
|
||||
@Transactional
|
||||
public String importData(MultipartFile file) {
|
||||
if (file == null){
|
||||
throw new ServiceException(text("请选择导入的数据文件!"));
|
||||
}
|
||||
int successNum = 0; int failureNum = 0;
|
||||
StringBuilder successMsg = new StringBuilder();
|
||||
StringBuilder failureMsg = new StringBuilder();
|
||||
try(ExcelImport ei = new ExcelImport(file, 2, 0)){
|
||||
List<ErpExpense> list = ei.getDataList(ErpExpense.class);
|
||||
for (ErpExpense erpExpense : list) {
|
||||
try{
|
||||
ValidatorUtils.validateWithException(erpExpense);
|
||||
this.save(erpExpense);
|
||||
successNum++;
|
||||
successMsg.append("<br/>" + successNum + "、编号 " + erpExpense.getId() + " 导入成功");
|
||||
} catch (Exception e) {
|
||||
failureNum++;
|
||||
String msg = "<br/>" + failureNum + "、编号 " + erpExpense.getId() + " 导入失败:";
|
||||
if (e instanceof ConstraintViolationException){
|
||||
ConstraintViolationException cve = (ConstraintViolationException)e;
|
||||
for (ConstraintViolation<?> violation : cve.getConstraintViolations()) {
|
||||
msg += Global.getText(violation.getMessage()) + " ("+violation.getPropertyPath()+")";
|
||||
}
|
||||
}else{
|
||||
msg += e.getMessage();
|
||||
}
|
||||
failureMsg.append(msg);
|
||||
logger.error(msg, e);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getMessage(), e);
|
||||
failureMsg.append(e.getMessage());
|
||||
return failureMsg.toString();
|
||||
}
|
||||
if (failureNum > 0) {
|
||||
failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:");
|
||||
throw new ServiceException(failureMsg.toString());
|
||||
}else{
|
||||
successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:");
|
||||
}
|
||||
return successMsg.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新状态
|
||||
* @param erpExpense 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void updateStatus(ErpExpense erpExpense) {
|
||||
super.updateStatus(erpExpense);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
* @param erpExpense 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void delete(ErpExpense erpExpense) {
|
||||
super.delete(erpExpense);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
package com.jeesite.modules.erp.service;
|
||||
|
||||
import java.util.List;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.jeesite.common.entity.Page;
|
||||
import com.jeesite.common.service.CrudService;
|
||||
import com.jeesite.modules.erp.entity.ErpIncome;
|
||||
import com.jeesite.modules.erp.dao.ErpIncomeDao;
|
||||
import com.jeesite.common.service.ServiceException;
|
||||
import com.jeesite.common.config.Global;
|
||||
import com.jeesite.common.validator.ValidatorUtils;
|
||||
import com.jeesite.common.utils.excel.ExcelImport;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import jakarta.validation.ConstraintViolation;
|
||||
import jakarta.validation.ConstraintViolationException;
|
||||
|
||||
/**
|
||||
* 收入信息Service
|
||||
* @author gaoxq
|
||||
* @version 2025-11-29
|
||||
*/
|
||||
@Service
|
||||
public class ErpIncomeService extends CrudService<ErpIncomeDao, ErpIncome> {
|
||||
|
||||
/**
|
||||
* 获取单条数据
|
||||
* @param erpIncome 主键
|
||||
*/
|
||||
@Override
|
||||
public ErpIncome get(ErpIncome erpIncome) {
|
||||
return super.get(erpIncome);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询分页数据
|
||||
* @param erpIncome 查询条件
|
||||
* @param erpIncome page 分页对象
|
||||
*/
|
||||
@Override
|
||||
public Page<ErpIncome> findPage(ErpIncome erpIncome) {
|
||||
return super.findPage(erpIncome);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表数据
|
||||
* @param erpIncome 查询条件
|
||||
*/
|
||||
@Override
|
||||
public List<ErpIncome> findList(ErpIncome erpIncome) {
|
||||
return super.findList(erpIncome);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存数据(插入或更新)
|
||||
* @param erpIncome 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void save(ErpIncome erpIncome) {
|
||||
super.save(erpIncome);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入数据
|
||||
* @param file 导入的数据文件
|
||||
*/
|
||||
@Transactional
|
||||
public String importData(MultipartFile file) {
|
||||
if (file == null){
|
||||
throw new ServiceException(text("请选择导入的数据文件!"));
|
||||
}
|
||||
int successNum = 0; int failureNum = 0;
|
||||
StringBuilder successMsg = new StringBuilder();
|
||||
StringBuilder failureMsg = new StringBuilder();
|
||||
try(ExcelImport ei = new ExcelImport(file, 2, 0)){
|
||||
List<ErpIncome> list = ei.getDataList(ErpIncome.class);
|
||||
for (ErpIncome erpIncome : list) {
|
||||
try{
|
||||
ValidatorUtils.validateWithException(erpIncome);
|
||||
this.save(erpIncome);
|
||||
successNum++;
|
||||
successMsg.append("<br/>" + successNum + "、编号 " + erpIncome.getId() + " 导入成功");
|
||||
} catch (Exception e) {
|
||||
failureNum++;
|
||||
String msg = "<br/>" + failureNum + "、编号 " + erpIncome.getId() + " 导入失败:";
|
||||
if (e instanceof ConstraintViolationException){
|
||||
ConstraintViolationException cve = (ConstraintViolationException)e;
|
||||
for (ConstraintViolation<?> violation : cve.getConstraintViolations()) {
|
||||
msg += Global.getText(violation.getMessage()) + " ("+violation.getPropertyPath()+")";
|
||||
}
|
||||
}else{
|
||||
msg += e.getMessage();
|
||||
}
|
||||
failureMsg.append(msg);
|
||||
logger.error(msg, e);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getMessage(), e);
|
||||
failureMsg.append(e.getMessage());
|
||||
return failureMsg.toString();
|
||||
}
|
||||
if (failureNum > 0) {
|
||||
failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:");
|
||||
throw new ServiceException(failureMsg.toString());
|
||||
}else{
|
||||
successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:");
|
||||
}
|
||||
return successMsg.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新状态
|
||||
* @param erpIncome 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void updateStatus(ErpIncome erpIncome) {
|
||||
super.updateStatus(erpIncome);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
* @param erpIncome 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void delete(ErpIncome erpIncome) {
|
||||
super.delete(erpIncome);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
package com.jeesite.modules.erp.service;
|
||||
|
||||
import java.util.List;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.jeesite.common.entity.Page;
|
||||
import com.jeesite.common.service.CrudService;
|
||||
import com.jeesite.modules.erp.entity.ErpTransactionFlow;
|
||||
import com.jeesite.modules.erp.dao.ErpTransactionFlowDao;
|
||||
import com.jeesite.common.service.ServiceException;
|
||||
import com.jeesite.common.config.Global;
|
||||
import com.jeesite.common.validator.ValidatorUtils;
|
||||
import com.jeesite.common.utils.excel.ExcelImport;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import jakarta.validation.ConstraintViolation;
|
||||
import jakarta.validation.ConstraintViolationException;
|
||||
|
||||
/**
|
||||
* 明细信息Service
|
||||
* @author gaoxq
|
||||
* @version 2025-11-29
|
||||
*/
|
||||
@Service
|
||||
public class ErpTransactionFlowService extends CrudService<ErpTransactionFlowDao, ErpTransactionFlow> {
|
||||
|
||||
/**
|
||||
* 获取单条数据
|
||||
* @param erpTransactionFlow 主键
|
||||
*/
|
||||
@Override
|
||||
public ErpTransactionFlow get(ErpTransactionFlow erpTransactionFlow) {
|
||||
return super.get(erpTransactionFlow);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询分页数据
|
||||
* @param erpTransactionFlow 查询条件
|
||||
* @param erpTransactionFlow page 分页对象
|
||||
*/
|
||||
@Override
|
||||
public Page<ErpTransactionFlow> findPage(ErpTransactionFlow erpTransactionFlow) {
|
||||
return super.findPage(erpTransactionFlow);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表数据
|
||||
* @param erpTransactionFlow 查询条件
|
||||
*/
|
||||
@Override
|
||||
public List<ErpTransactionFlow> findList(ErpTransactionFlow erpTransactionFlow) {
|
||||
return super.findList(erpTransactionFlow);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存数据(插入或更新)
|
||||
* @param erpTransactionFlow 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void save(ErpTransactionFlow erpTransactionFlow) {
|
||||
super.save(erpTransactionFlow);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入数据
|
||||
* @param file 导入的数据文件
|
||||
*/
|
||||
@Transactional
|
||||
public String importData(MultipartFile file) {
|
||||
if (file == null){
|
||||
throw new ServiceException(text("请选择导入的数据文件!"));
|
||||
}
|
||||
int successNum = 0; int failureNum = 0;
|
||||
StringBuilder successMsg = new StringBuilder();
|
||||
StringBuilder failureMsg = new StringBuilder();
|
||||
try(ExcelImport ei = new ExcelImport(file, 2, 0)){
|
||||
List<ErpTransactionFlow> list = ei.getDataList(ErpTransactionFlow.class);
|
||||
for (ErpTransactionFlow erpTransactionFlow : list) {
|
||||
try{
|
||||
ValidatorUtils.validateWithException(erpTransactionFlow);
|
||||
this.save(erpTransactionFlow);
|
||||
successNum++;
|
||||
successMsg.append("<br/>" + successNum + "、编号 " + erpTransactionFlow.getId() + " 导入成功");
|
||||
} catch (Exception e) {
|
||||
failureNum++;
|
||||
String msg = "<br/>" + failureNum + "、编号 " + erpTransactionFlow.getId() + " 导入失败:";
|
||||
if (e instanceof ConstraintViolationException){
|
||||
ConstraintViolationException cve = (ConstraintViolationException)e;
|
||||
for (ConstraintViolation<?> violation : cve.getConstraintViolations()) {
|
||||
msg += Global.getText(violation.getMessage()) + " ("+violation.getPropertyPath()+")";
|
||||
}
|
||||
}else{
|
||||
msg += e.getMessage();
|
||||
}
|
||||
failureMsg.append(msg);
|
||||
logger.error(msg, e);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getMessage(), e);
|
||||
failureMsg.append(e.getMessage());
|
||||
return failureMsg.toString();
|
||||
}
|
||||
if (failureNum > 0) {
|
||||
failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:");
|
||||
throw new ServiceException(failureMsg.toString());
|
||||
}else{
|
||||
successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:");
|
||||
}
|
||||
return successMsg.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新状态
|
||||
* @param erpTransactionFlow 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void updateStatus(ErpTransactionFlow erpTransactionFlow) {
|
||||
super.updateStatus(erpTransactionFlow);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
* @param erpTransactionFlow 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void delete(ErpTransactionFlow erpTransactionFlow) {
|
||||
super.delete(erpTransactionFlow);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,146 @@
|
||||
package com.jeesite.modules.erp.web;
|
||||
|
||||
import java.util.List;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import com.jeesite.common.config.Global;
|
||||
import com.jeesite.common.collect.ListUtils;
|
||||
import com.jeesite.common.entity.Page;
|
||||
import com.jeesite.common.lang.DateUtils;
|
||||
import com.jeesite.common.utils.excel.ExcelExport;
|
||||
import com.jeesite.common.utils.excel.annotation.ExcelField.Type;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import com.jeesite.common.web.BaseController;
|
||||
import com.jeesite.modules.erp.entity.ErpAccount;
|
||||
import com.jeesite.modules.erp.service.ErpAccountService;
|
||||
|
||||
/**
|
||||
* 账户信息Controller
|
||||
* @author gaoxq
|
||||
* @version 2025-11-29
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping(value = "${adminPath}/erp/account")
|
||||
public class ErpAccountController extends BaseController {
|
||||
|
||||
private final ErpAccountService erpAccountService;
|
||||
|
||||
public ErpAccountController(ErpAccountService erpAccountService) {
|
||||
this.erpAccountService = erpAccountService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取数据
|
||||
*/
|
||||
@ModelAttribute
|
||||
public ErpAccount get(String accountId, boolean isNewRecord) {
|
||||
return erpAccountService.get(accountId, isNewRecord);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表
|
||||
*/
|
||||
@RequiresPermissions("erp:account:view")
|
||||
@RequestMapping(value = {"list", ""})
|
||||
public String list(ErpAccount erpAccount, Model model) {
|
||||
model.addAttribute("erpAccount", erpAccount);
|
||||
return "modules/erp/erpAccountList";
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表数据
|
||||
*/
|
||||
@RequiresPermissions("erp:account:view")
|
||||
@RequestMapping(value = "listData")
|
||||
@ResponseBody
|
||||
public Page<ErpAccount> listData(ErpAccount erpAccount, HttpServletRequest request, HttpServletResponse response) {
|
||||
erpAccount.setPage(new Page<>(request, response));
|
||||
Page<ErpAccount> page = erpAccountService.findPage(erpAccount);
|
||||
return page;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看编辑表单
|
||||
*/
|
||||
@RequiresPermissions("erp:account:view")
|
||||
@RequestMapping(value = "form")
|
||||
public String form(ErpAccount erpAccount, Model model) {
|
||||
model.addAttribute("erpAccount", erpAccount);
|
||||
return "modules/erp/erpAccountForm";
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存数据
|
||||
*/
|
||||
@RequiresPermissions("erp:account:edit")
|
||||
@PostMapping(value = "save")
|
||||
@ResponseBody
|
||||
public String save(@Validated ErpAccount erpAccount) {
|
||||
erpAccountService.save(erpAccount);
|
||||
return renderResult(Global.TRUE, text("保存账户信息成功!"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出数据
|
||||
*/
|
||||
@RequiresPermissions("erp:account:view")
|
||||
@RequestMapping(value = "exportData")
|
||||
public void exportData(ErpAccount erpAccount, HttpServletResponse response) {
|
||||
List<ErpAccount> list = erpAccountService.findList(erpAccount);
|
||||
String fileName = "账户信息" + DateUtils.getDate("yyyyMMddHHmmss") + ".xlsx";
|
||||
try(ExcelExport ee = new ExcelExport("账户信息", ErpAccount.class)){
|
||||
ee.setDataList(list).write(response, fileName);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载模板
|
||||
*/
|
||||
@RequiresPermissions("erp:account:view")
|
||||
@RequestMapping(value = "importTemplate")
|
||||
public void importTemplate(HttpServletResponse response) {
|
||||
ErpAccount erpAccount = new ErpAccount();
|
||||
List<ErpAccount> list = ListUtils.newArrayList(erpAccount);
|
||||
String fileName = "账户信息模板.xlsx";
|
||||
try(ExcelExport ee = new ExcelExport("账户信息", ErpAccount.class, Type.IMPORT)){
|
||||
ee.setDataList(list).write(response, fileName);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入数据
|
||||
*/
|
||||
@ResponseBody
|
||||
@RequiresPermissions("erp:account:edit")
|
||||
@PostMapping(value = "importData")
|
||||
public String importData(MultipartFile file) {
|
||||
try {
|
||||
String message = erpAccountService.importData(file);
|
||||
return renderResult(Global.TRUE, "posfull:"+message);
|
||||
} catch (Exception ex) {
|
||||
return renderResult(Global.FALSE, "posfull:"+ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
*/
|
||||
@RequiresPermissions("erp:account:edit")
|
||||
@RequestMapping(value = "delete")
|
||||
@ResponseBody
|
||||
public String delete(ErpAccount erpAccount) {
|
||||
erpAccountService.delete(erpAccount);
|
||||
return renderResult(Global.TRUE, text("删除账户信息成功!"));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,154 @@
|
||||
package com.jeesite.modules.erp.web;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import com.jeesite.common.config.Global;
|
||||
import com.jeesite.common.collect.ListUtils;
|
||||
import com.jeesite.common.entity.Page;
|
||||
import com.jeesite.common.lang.DateUtils;
|
||||
import com.jeesite.common.utils.excel.ExcelExport;
|
||||
import com.jeesite.common.utils.excel.annotation.ExcelField.Type;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import com.jeesite.common.web.BaseController;
|
||||
import com.jeesite.modules.erp.entity.ErpCategory;
|
||||
import com.jeesite.modules.erp.service.ErpCategoryService;
|
||||
|
||||
/**
|
||||
* 分类信息Controller
|
||||
*
|
||||
* @author gaoxq
|
||||
* @version 2025-11-29
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping(value = "${adminPath}/erp/category")
|
||||
public class ErpCategoryController extends BaseController {
|
||||
|
||||
private final ErpCategoryService erpCategoryService;
|
||||
|
||||
public ErpCategoryController(ErpCategoryService erpCategoryService) {
|
||||
this.erpCategoryService = erpCategoryService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取数据
|
||||
*/
|
||||
@ModelAttribute
|
||||
public ErpCategory get(String categoryId, boolean isNewRecord) {
|
||||
return erpCategoryService.get(categoryId, isNewRecord);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表
|
||||
*/
|
||||
@RequiresPermissions("erp:category:view")
|
||||
@RequestMapping(value = {"list", ""})
|
||||
public String list(ErpCategory erpCategory, Model model) {
|
||||
model.addAttribute("erpCategory", erpCategory);
|
||||
return "modules/erp/erpCategoryList";
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表数据
|
||||
*/
|
||||
@RequiresPermissions("erp:category:view")
|
||||
@RequestMapping(value = "listData")
|
||||
@ResponseBody
|
||||
public Page<ErpCategory> listData(ErpCategory erpCategory, HttpServletRequest request, HttpServletResponse response) {
|
||||
erpCategory.setPage(new Page<>(request, response));
|
||||
Page<ErpCategory> page = erpCategoryService.findPage(erpCategory);
|
||||
return page;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看编辑表单
|
||||
*/
|
||||
@RequiresPermissions("erp:category:view")
|
||||
@RequestMapping(value = "form")
|
||||
public String form(ErpCategory erpCategory, Model model) {
|
||||
model.addAttribute("erpCategory", erpCategory);
|
||||
return "modules/erp/erpCategoryForm";
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存数据
|
||||
*/
|
||||
@RequiresPermissions("erp:category:edit")
|
||||
@PostMapping(value = "save")
|
||||
@ResponseBody
|
||||
public String save(@Validated ErpCategory erpCategory) {
|
||||
erpCategoryService.save(erpCategory);
|
||||
return renderResult(Global.TRUE, text("保存分类信息成功!"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出数据
|
||||
*/
|
||||
@RequiresPermissions("erp:category:view")
|
||||
@RequestMapping(value = "exportData")
|
||||
public void exportData(ErpCategory erpCategory, HttpServletResponse response) {
|
||||
List<ErpCategory> list = erpCategoryService.findList(erpCategory);
|
||||
String fileName = "分类信息" + DateUtils.getDate("yyyyMMddHHmmss") + ".xlsx";
|
||||
try (ExcelExport ee = new ExcelExport("分类信息", ErpCategory.class)) {
|
||||
ee.setDataList(list).write(response, fileName);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载模板
|
||||
*/
|
||||
@RequiresPermissions("erp:category:view")
|
||||
@RequestMapping(value = "importTemplate")
|
||||
public void importTemplate(HttpServletResponse response) {
|
||||
ErpCategory erpCategory = new ErpCategory();
|
||||
List<ErpCategory> list = ListUtils.newArrayList(erpCategory);
|
||||
String fileName = "分类信息模板.xlsx";
|
||||
try (ExcelExport ee = new ExcelExport("分类信息", ErpCategory.class, Type.IMPORT)) {
|
||||
ee.setDataList(list).write(response, fileName);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入数据
|
||||
*/
|
||||
@ResponseBody
|
||||
@RequiresPermissions("erp:category:edit")
|
||||
@PostMapping(value = "importData")
|
||||
public String importData(MultipartFile file) {
|
||||
try {
|
||||
String message = erpCategoryService.importData(file);
|
||||
return renderResult(Global.TRUE, "posfull:" + message);
|
||||
} catch (Exception ex) {
|
||||
return renderResult(Global.FALSE, "posfull:" + ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
*/
|
||||
@RequiresPermissions("erp:category:edit")
|
||||
@RequestMapping(value = "delete")
|
||||
@ResponseBody
|
||||
public String delete(ErpCategory erpCategory) {
|
||||
erpCategoryService.delete(erpCategory);
|
||||
return renderResult(Global.TRUE, text("删除分类信息成功!"));
|
||||
}
|
||||
|
||||
@RequestMapping(value = "listAll")
|
||||
@ResponseBody
|
||||
public List<ErpCategory> listAll(ErpCategory erpCategory) {
|
||||
return erpCategoryService.findList(erpCategory);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,146 @@
|
||||
package com.jeesite.modules.erp.web;
|
||||
|
||||
import java.util.List;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import com.jeesite.common.config.Global;
|
||||
import com.jeesite.common.collect.ListUtils;
|
||||
import com.jeesite.common.entity.Page;
|
||||
import com.jeesite.common.lang.DateUtils;
|
||||
import com.jeesite.common.utils.excel.ExcelExport;
|
||||
import com.jeesite.common.utils.excel.annotation.ExcelField.Type;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import com.jeesite.common.web.BaseController;
|
||||
import com.jeesite.modules.erp.entity.ErpExpense;
|
||||
import com.jeesite.modules.erp.service.ErpExpenseService;
|
||||
|
||||
/**
|
||||
* 支出信息Controller
|
||||
* @author gaoxq
|
||||
* @version 2025-11-29
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping(value = "${adminPath}/erp/expense")
|
||||
public class ErpExpenseController extends BaseController {
|
||||
|
||||
private final ErpExpenseService erpExpenseService;
|
||||
|
||||
public ErpExpenseController(ErpExpenseService erpExpenseService) {
|
||||
this.erpExpenseService = erpExpenseService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取数据
|
||||
*/
|
||||
@ModelAttribute
|
||||
public ErpExpense get(String expenseId, boolean isNewRecord) {
|
||||
return erpExpenseService.get(expenseId, isNewRecord);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表
|
||||
*/
|
||||
@RequiresPermissions("erp:expense:view")
|
||||
@RequestMapping(value = {"list", ""})
|
||||
public String list(ErpExpense erpExpense, Model model) {
|
||||
model.addAttribute("erpExpense", erpExpense);
|
||||
return "modules/erp/erpExpenseList";
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表数据
|
||||
*/
|
||||
@RequiresPermissions("erp:expense:view")
|
||||
@RequestMapping(value = "listData")
|
||||
@ResponseBody
|
||||
public Page<ErpExpense> listData(ErpExpense erpExpense, HttpServletRequest request, HttpServletResponse response) {
|
||||
erpExpense.setPage(new Page<>(request, response));
|
||||
Page<ErpExpense> page = erpExpenseService.findPage(erpExpense);
|
||||
return page;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看编辑表单
|
||||
*/
|
||||
@RequiresPermissions("erp:expense:view")
|
||||
@RequestMapping(value = "form")
|
||||
public String form(ErpExpense erpExpense, Model model) {
|
||||
model.addAttribute("erpExpense", erpExpense);
|
||||
return "modules/erp/erpExpenseForm";
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存数据
|
||||
*/
|
||||
@RequiresPermissions("erp:expense:edit")
|
||||
@PostMapping(value = "save")
|
||||
@ResponseBody
|
||||
public String save(@Validated ErpExpense erpExpense) {
|
||||
erpExpenseService.save(erpExpense);
|
||||
return renderResult(Global.TRUE, text("保存支出信息成功!"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出数据
|
||||
*/
|
||||
@RequiresPermissions("erp:expense:view")
|
||||
@RequestMapping(value = "exportData")
|
||||
public void exportData(ErpExpense erpExpense, HttpServletResponse response) {
|
||||
List<ErpExpense> list = erpExpenseService.findList(erpExpense);
|
||||
String fileName = "支出信息" + DateUtils.getDate("yyyyMMddHHmmss") + ".xlsx";
|
||||
try(ExcelExport ee = new ExcelExport("支出信息", ErpExpense.class)){
|
||||
ee.setDataList(list).write(response, fileName);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载模板
|
||||
*/
|
||||
@RequiresPermissions("erp:expense:view")
|
||||
@RequestMapping(value = "importTemplate")
|
||||
public void importTemplate(HttpServletResponse response) {
|
||||
ErpExpense erpExpense = new ErpExpense();
|
||||
List<ErpExpense> list = ListUtils.newArrayList(erpExpense);
|
||||
String fileName = "支出信息模板.xlsx";
|
||||
try(ExcelExport ee = new ExcelExport("支出信息", ErpExpense.class, Type.IMPORT)){
|
||||
ee.setDataList(list).write(response, fileName);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入数据
|
||||
*/
|
||||
@ResponseBody
|
||||
@RequiresPermissions("erp:expense:edit")
|
||||
@PostMapping(value = "importData")
|
||||
public String importData(MultipartFile file) {
|
||||
try {
|
||||
String message = erpExpenseService.importData(file);
|
||||
return renderResult(Global.TRUE, "posfull:"+message);
|
||||
} catch (Exception ex) {
|
||||
return renderResult(Global.FALSE, "posfull:"+ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
*/
|
||||
@RequiresPermissions("erp:expense:edit")
|
||||
@RequestMapping(value = "delete")
|
||||
@ResponseBody
|
||||
public String delete(ErpExpense erpExpense) {
|
||||
erpExpenseService.delete(erpExpense);
|
||||
return renderResult(Global.TRUE, text("删除支出信息成功!"));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,146 @@
|
||||
package com.jeesite.modules.erp.web;
|
||||
|
||||
import java.util.List;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import com.jeesite.common.config.Global;
|
||||
import com.jeesite.common.collect.ListUtils;
|
||||
import com.jeesite.common.entity.Page;
|
||||
import com.jeesite.common.lang.DateUtils;
|
||||
import com.jeesite.common.utils.excel.ExcelExport;
|
||||
import com.jeesite.common.utils.excel.annotation.ExcelField.Type;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import com.jeesite.common.web.BaseController;
|
||||
import com.jeesite.modules.erp.entity.ErpIncome;
|
||||
import com.jeesite.modules.erp.service.ErpIncomeService;
|
||||
|
||||
/**
|
||||
* 收入信息Controller
|
||||
* @author gaoxq
|
||||
* @version 2025-11-29
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping(value = "${adminPath}/erp/income")
|
||||
public class ErpIncomeController extends BaseController {
|
||||
|
||||
private final ErpIncomeService erpIncomeService;
|
||||
|
||||
public ErpIncomeController(ErpIncomeService erpIncomeService) {
|
||||
this.erpIncomeService = erpIncomeService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取数据
|
||||
*/
|
||||
@ModelAttribute
|
||||
public ErpIncome get(String incomeId, boolean isNewRecord) {
|
||||
return erpIncomeService.get(incomeId, isNewRecord);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表
|
||||
*/
|
||||
@RequiresPermissions("erp:income:view")
|
||||
@RequestMapping(value = {"list", ""})
|
||||
public String list(ErpIncome erpIncome, Model model) {
|
||||
model.addAttribute("erpIncome", erpIncome);
|
||||
return "modules/erp/erpIncomeList";
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表数据
|
||||
*/
|
||||
@RequiresPermissions("erp:income:view")
|
||||
@RequestMapping(value = "listData")
|
||||
@ResponseBody
|
||||
public Page<ErpIncome> listData(ErpIncome erpIncome, HttpServletRequest request, HttpServletResponse response) {
|
||||
erpIncome.setPage(new Page<>(request, response));
|
||||
Page<ErpIncome> page = erpIncomeService.findPage(erpIncome);
|
||||
return page;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看编辑表单
|
||||
*/
|
||||
@RequiresPermissions("erp:income:view")
|
||||
@RequestMapping(value = "form")
|
||||
public String form(ErpIncome erpIncome, Model model) {
|
||||
model.addAttribute("erpIncome", erpIncome);
|
||||
return "modules/erp/erpIncomeForm";
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存数据
|
||||
*/
|
||||
@RequiresPermissions("erp:income:edit")
|
||||
@PostMapping(value = "save")
|
||||
@ResponseBody
|
||||
public String save(@Validated ErpIncome erpIncome) {
|
||||
erpIncomeService.save(erpIncome);
|
||||
return renderResult(Global.TRUE, text("保存收入信息成功!"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出数据
|
||||
*/
|
||||
@RequiresPermissions("erp:income:view")
|
||||
@RequestMapping(value = "exportData")
|
||||
public void exportData(ErpIncome erpIncome, HttpServletResponse response) {
|
||||
List<ErpIncome> list = erpIncomeService.findList(erpIncome);
|
||||
String fileName = "收入信息" + DateUtils.getDate("yyyyMMddHHmmss") + ".xlsx";
|
||||
try(ExcelExport ee = new ExcelExport("收入信息", ErpIncome.class)){
|
||||
ee.setDataList(list).write(response, fileName);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载模板
|
||||
*/
|
||||
@RequiresPermissions("erp:income:view")
|
||||
@RequestMapping(value = "importTemplate")
|
||||
public void importTemplate(HttpServletResponse response) {
|
||||
ErpIncome erpIncome = new ErpIncome();
|
||||
List<ErpIncome> list = ListUtils.newArrayList(erpIncome);
|
||||
String fileName = "收入信息模板.xlsx";
|
||||
try(ExcelExport ee = new ExcelExport("收入信息", ErpIncome.class, Type.IMPORT)){
|
||||
ee.setDataList(list).write(response, fileName);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入数据
|
||||
*/
|
||||
@ResponseBody
|
||||
@RequiresPermissions("erp:income:edit")
|
||||
@PostMapping(value = "importData")
|
||||
public String importData(MultipartFile file) {
|
||||
try {
|
||||
String message = erpIncomeService.importData(file);
|
||||
return renderResult(Global.TRUE, "posfull:"+message);
|
||||
} catch (Exception ex) {
|
||||
return renderResult(Global.FALSE, "posfull:"+ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
*/
|
||||
@RequiresPermissions("erp:income:edit")
|
||||
@RequestMapping(value = "delete")
|
||||
@ResponseBody
|
||||
public String delete(ErpIncome erpIncome) {
|
||||
erpIncomeService.delete(erpIncome);
|
||||
return renderResult(Global.TRUE, text("删除收入信息成功!"));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,205 @@
|
||||
package com.jeesite.modules.erp.web;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.jeesite.modules.erp.entity.ErpAccount;
|
||||
import com.jeesite.modules.erp.entity.ErpExpense;
|
||||
import com.jeesite.modules.erp.entity.ErpIncome;
|
||||
import com.jeesite.modules.erp.service.ErpAccountService;
|
||||
import com.jeesite.modules.erp.service.ErpExpenseService;
|
||||
import com.jeesite.modules.erp.service.ErpIncomeService;
|
||||
import com.jeesite.modules.utils.BigDecimalUtils;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import com.jeesite.common.config.Global;
|
||||
import com.jeesite.common.collect.ListUtils;
|
||||
import com.jeesite.common.entity.Page;
|
||||
import com.jeesite.common.lang.DateUtils;
|
||||
import com.jeesite.common.utils.excel.ExcelExport;
|
||||
import com.jeesite.common.utils.excel.annotation.ExcelField.Type;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import com.jeesite.common.web.BaseController;
|
||||
import com.jeesite.modules.erp.entity.ErpTransactionFlow;
|
||||
import com.jeesite.modules.erp.service.ErpTransactionFlowService;
|
||||
|
||||
/**
|
||||
* 明细信息Controller
|
||||
*
|
||||
* @author gaoxq
|
||||
* @version 2025-11-29
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping(value = "${adminPath}/erp/transactionFlow")
|
||||
public class ErpTransactionFlowController extends BaseController {
|
||||
|
||||
|
||||
@Resource
|
||||
private ErpAccountService erpAccountService;
|
||||
|
||||
@Resource
|
||||
private ErpExpenseService erpExpenseService;
|
||||
|
||||
@Resource
|
||||
private ErpIncomeService erpIncomeService;
|
||||
|
||||
private final ErpTransactionFlowService erpTransactionFlowService;
|
||||
|
||||
public ErpTransactionFlowController(ErpTransactionFlowService erpTransactionFlowService) {
|
||||
this.erpTransactionFlowService = erpTransactionFlowService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取数据
|
||||
*/
|
||||
@ModelAttribute
|
||||
public ErpTransactionFlow get(String flowId, boolean isNewRecord) {
|
||||
return erpTransactionFlowService.get(flowId, isNewRecord);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表
|
||||
*/
|
||||
@RequiresPermissions("erp:transactionFlow:view")
|
||||
@RequestMapping(value = {"list", ""})
|
||||
public String list(ErpTransactionFlow erpTransactionFlow, Model model) {
|
||||
model.addAttribute("erpTransactionFlow", erpTransactionFlow);
|
||||
return "modules/erp/erpTransactionFlowList";
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表数据
|
||||
*/
|
||||
@RequiresPermissions("erp:transactionFlow:view")
|
||||
@RequestMapping(value = "listData")
|
||||
@ResponseBody
|
||||
public Page<ErpTransactionFlow> listData(ErpTransactionFlow erpTransactionFlow, HttpServletRequest request, HttpServletResponse response) {
|
||||
erpTransactionFlow.setPage(new Page<>(request, response));
|
||||
Page<ErpTransactionFlow> page = erpTransactionFlowService.findPage(erpTransactionFlow);
|
||||
return page;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看编辑表单
|
||||
*/
|
||||
@RequiresPermissions("erp:transactionFlow:view")
|
||||
@RequestMapping(value = "form")
|
||||
public String form(ErpTransactionFlow erpTransactionFlow, Model model) {
|
||||
model.addAttribute("erpTransactionFlow", erpTransactionFlow);
|
||||
return "modules/erp/erpTransactionFlowForm";
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存数据
|
||||
*/
|
||||
@RequiresPermissions("erp:transactionFlow:edit")
|
||||
@PostMapping(value = "save")
|
||||
@ResponseBody
|
||||
public String save(@Validated ErpTransactionFlow erpTransactionFlow) {
|
||||
erpTransactionFlowService.save(erpTransactionFlow);
|
||||
return renderResult(Global.TRUE, text("保存明细信息成功!"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出数据
|
||||
*/
|
||||
@RequiresPermissions("erp:transactionFlow:view")
|
||||
@RequestMapping(value = "exportData")
|
||||
public void exportData(ErpTransactionFlow erpTransactionFlow, HttpServletResponse response) {
|
||||
List<ErpTransactionFlow> list = erpTransactionFlowService.findList(erpTransactionFlow);
|
||||
String fileName = "明细信息" + DateUtils.getDate("yyyyMMddHHmmss") + ".xlsx";
|
||||
try (ExcelExport ee = new ExcelExport("明细信息", ErpTransactionFlow.class)) {
|
||||
ee.setDataList(list).write(response, fileName);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载模板
|
||||
*/
|
||||
@RequiresPermissions("erp:transactionFlow:view")
|
||||
@RequestMapping(value = "importTemplate")
|
||||
public void importTemplate(HttpServletResponse response) {
|
||||
ErpTransactionFlow erpTransactionFlow = new ErpTransactionFlow();
|
||||
List<ErpTransactionFlow> list = ListUtils.newArrayList(erpTransactionFlow);
|
||||
String fileName = "明细信息模板.xlsx";
|
||||
try (ExcelExport ee = new ExcelExport("明细信息", ErpTransactionFlow.class, Type.IMPORT)) {
|
||||
ee.setDataList(list).write(response, fileName);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入数据
|
||||
*/
|
||||
@ResponseBody
|
||||
@RequiresPermissions("erp:transactionFlow:edit")
|
||||
@PostMapping(value = "importData")
|
||||
public String importData(MultipartFile file) {
|
||||
try {
|
||||
String message = erpTransactionFlowService.importData(file);
|
||||
return renderResult(Global.TRUE, "posfull:" + message);
|
||||
} catch (Exception ex) {
|
||||
return renderResult(Global.FALSE, "posfull:" + ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
*/
|
||||
@RequiresPermissions("erp:transactionFlow:edit")
|
||||
@RequestMapping(value = "delete")
|
||||
@ResponseBody
|
||||
public String delete(ErpTransactionFlow erpTransactionFlow) {
|
||||
erpTransactionFlowService.delete(erpTransactionFlow);
|
||||
return renderResult(Global.TRUE, text("删除明细信息成功!"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 记账明细
|
||||
*/
|
||||
@RequiresPermissions("erp:transactionFlow:edit")
|
||||
@RequestMapping(value = "finish")
|
||||
@ResponseBody
|
||||
public String finish(ErpTransactionFlow erpTransactionFlow) {
|
||||
ErpTransactionFlow flow = erpTransactionFlowService.get(erpTransactionFlow);
|
||||
ErpAccount account = erpAccountService.get(flow.getAccountId());
|
||||
switch (flow.getTransactionType()) {
|
||||
case "1":
|
||||
ErpExpense expense = new ErpExpense();
|
||||
expense.setZflowId(flow.getFlowId());
|
||||
expense.setAccountId(flow.getAccountId());
|
||||
expense.setCategoryId(flow.getCategoryId());
|
||||
expense.setAmount(flow.getAmount());
|
||||
erpExpenseService.save(expense);
|
||||
account.setCurrentBalance(BigDecimalUtils.subtract(account.getCurrentBalance(), flow.getAmount()));
|
||||
break;
|
||||
case "2":
|
||||
ErpIncome income = new ErpIncome();
|
||||
income.setSflowId(flow.getFlowId());
|
||||
income.setAccountId(flow.getAccountId());
|
||||
income.setCategoryId(flow.getCategoryId());
|
||||
income.setAmount(flow.getAmount());
|
||||
erpIncomeService.save(income);
|
||||
account.setCurrentBalance(BigDecimalUtils.add(account.getCurrentBalance(), flow.getAmount()));
|
||||
break;
|
||||
}
|
||||
|
||||
flow.setIsFinish("1");
|
||||
flow.setTransactionTime(new Date());
|
||||
account.setUpdateTime(new Date());
|
||||
erpAccountService.save(account);
|
||||
erpTransactionFlowService.save(flow);
|
||||
return renderResult(Global.TRUE, text("记账明细信息成功!"));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
package com.jeesite.modules.utils;
|
||||
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
public class BigDecimalUtils {
|
||||
|
||||
|
||||
/**
|
||||
* 加法运算
|
||||
*
|
||||
* @param num1 第一个数
|
||||
* @param num2 第二个数
|
||||
* @return 两数之和
|
||||
*/
|
||||
public static BigDecimal add(BigDecimal num1, BigDecimal num2) {
|
||||
// 避免空指针,默认空值为 0
|
||||
if (num1 == null) {
|
||||
num1 = BigDecimal.ZERO;
|
||||
}
|
||||
if (num2 == null) {
|
||||
num2 = BigDecimal.ZERO;
|
||||
}
|
||||
return num1.add(num2);
|
||||
}
|
||||
|
||||
/**
|
||||
* 减法运算
|
||||
*
|
||||
* @param num1 被减数
|
||||
* @param num2 减数
|
||||
* @return 两数之差(num1 - num2)
|
||||
*/
|
||||
public static BigDecimal subtract(BigDecimal num1, BigDecimal num2) {
|
||||
if (num1 == null) {
|
||||
num1 = BigDecimal.ZERO;
|
||||
}
|
||||
if (num2 == null) {
|
||||
num2 = BigDecimal.ZERO;
|
||||
}
|
||||
return num1.subtract(num2);
|
||||
}
|
||||
|
||||
/**
|
||||
* 乘法运算
|
||||
*
|
||||
* @param num1 第一个数
|
||||
* @param num2 第二个数
|
||||
* @return 两数之积
|
||||
*/
|
||||
public static BigDecimal multiply(BigDecimal num1, BigDecimal num2) {
|
||||
if (num1 == null || num2 == null) {
|
||||
return BigDecimal.ZERO;
|
||||
}
|
||||
return num1.multiply(num2);
|
||||
}
|
||||
|
||||
/**
|
||||
* 除法运算(处理除不尽的情况,默认保留2位小数,四舍五入)
|
||||
*
|
||||
* @param num1 被除数
|
||||
* @param num2 除数
|
||||
* @return 两数之商(num1 / num2)
|
||||
*/
|
||||
public static BigDecimal divide(BigDecimal num1, BigDecimal num2) {
|
||||
return divide(num1, num2, 2, RoundingMode.HALF_UP);
|
||||
}
|
||||
|
||||
/**
|
||||
* 除法运算(自定义精度和舍入模式)
|
||||
*
|
||||
* @param num1 被除数
|
||||
* @param num2 除数
|
||||
* @param scale 保留小数位数
|
||||
* @param roundingMode 舍入模式(如四舍五入、向上取整等)
|
||||
* @return 两数之商(num1 / num2)
|
||||
*/
|
||||
public static BigDecimal divide(BigDecimal num1, BigDecimal num2, int scale, RoundingMode roundingMode) {
|
||||
if (num1 == null) {
|
||||
return BigDecimal.ZERO;
|
||||
}
|
||||
if (num2 == null || num2.compareTo(BigDecimal.ZERO) == 0) {
|
||||
throw new ArithmeticException("除数不能为 null 或 0");
|
||||
}
|
||||
// 注意:divide 方法必须指定精度和舍入模式,否则除不尽时会抛异常
|
||||
return num1.divide(num2, scale, roundingMode);
|
||||
}
|
||||
|
||||
}
|
||||
92
web-api/src/main/java/com/jeesite/modules/utils/IpUtils.java
Normal file
92
web-api/src/main/java/com/jeesite/modules/utils/IpUtils.java
Normal file
@@ -0,0 +1,92 @@
|
||||
package com.jeesite.modules.utils;
|
||||
|
||||
import com.jeesite.common.config.Global;
|
||||
import com.jeesite.common.io.FileUtils;
|
||||
|
||||
import java.net.*;
|
||||
import java.util.Enumeration;
|
||||
|
||||
/**
|
||||
* 获取当前运行程序的IP地址工具类
|
||||
*/
|
||||
public class IpUtils {
|
||||
|
||||
/**
|
||||
* 获取本地有效IP地址(优先IPv4,排除回环/虚拟网卡)
|
||||
*
|
||||
* @return 本地IP地址,获取失败返回null
|
||||
*/
|
||||
public static String getLocalIp() {
|
||||
try {
|
||||
// 遍历所有网络接口
|
||||
Enumeration<NetworkInterface> interfaces = NetworkInterface.getNetworkInterfaces();
|
||||
while (interfaces.hasMoreElements()) {
|
||||
NetworkInterface ni = interfaces.nextElement();
|
||||
// 跳过虚拟网卡、未启用的网卡
|
||||
if (ni.isLoopback() || ni.isVirtual() || !ni.isUp()) {
|
||||
continue;
|
||||
}
|
||||
// 遍历该网卡下的所有IP地址
|
||||
Enumeration<InetAddress> addresses = ni.getInetAddresses();
|
||||
while (addresses.hasMoreElements()) {
|
||||
InetAddress addr = addresses.nextElement();
|
||||
// 仅保留IPv4地址,且排除回环地址
|
||||
if (addr instanceof Inet4Address && !addr.isLoopbackAddress()) {
|
||||
String ip = addr.getHostAddress();
|
||||
// 过滤掉docker等虚拟网卡的IP(可选,根据实际场景调整)
|
||||
if (!ip.startsWith("172.") && !ip.startsWith("192.168.99.")) {
|
||||
return ip;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (SocketException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return getLoopbackIp();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取回环地址(127.0.0.1)
|
||||
*
|
||||
* @return 回环IP
|
||||
*/
|
||||
private static String getLoopbackIp() {
|
||||
try {
|
||||
return InetAddress.getLocalHost().getHostAddress();
|
||||
} catch (UnknownHostException e) {
|
||||
return "127.0.0.1";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前机器的所有网卡IP(含IPv4/IPv6)
|
||||
*
|
||||
* @return 所有IP数组
|
||||
*/
|
||||
public static String[] getAllLocalIps() {
|
||||
try {
|
||||
java.util.List<String> ipList = new java.util.ArrayList<>();
|
||||
Enumeration<NetworkInterface> interfaces = NetworkInterface.getNetworkInterfaces();
|
||||
while (interfaces.hasMoreElements()) {
|
||||
NetworkInterface ni = interfaces.nextElement();
|
||||
if (!ni.isUp()) continue;
|
||||
Enumeration<InetAddress> addresses = ni.getInetAddresses();
|
||||
while (addresses.hasMoreElements()) {
|
||||
InetAddress addr = addresses.nextElement();
|
||||
ipList.add(addr.getHostAddress());
|
||||
}
|
||||
}
|
||||
return ipList.toArray(new String[0]);
|
||||
} catch (SocketException e) {
|
||||
e.printStackTrace();
|
||||
return new String[0];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static String getServerHttp() {
|
||||
return "http://" + getLocalIp() + ":" + Global.getProperty("server.port") + FileUtils.path("/"
|
||||
+ Global.getProperty("server.servlet.context-path"));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user