初始化项目

This commit is contained in:
2026-03-22 00:27:15 +08:00
parent b40a1634ef
commit 1b9448a5a3
105 changed files with 11434 additions and 193 deletions

View File

@@ -0,0 +1,4 @@
package com.jeesite.modules.apps;
public class Start {
}

View File

@@ -0,0 +1,15 @@
package com.jeesite.modules.biz.dao;
import com.jeesite.common.dao.CrudDao;
import com.jeesite.common.mybatis.annotation.MyBatisDao;
import com.jeesite.modules.biz.entity.MyChartInfo;
/**
* 图表信息 DAO 接口
* @author gaoxq
* @version 2026-03-21
*/
@MyBatisDao(dataSourceName="work")
public interface MyChartInfoDao extends CrudDao<MyChartInfo> {
}

View File

@@ -0,0 +1,15 @@
package com.jeesite.modules.biz.dao;
import com.jeesite.common.dao.CrudDao;
import com.jeesite.common.mybatis.annotation.MyBatisDao;
import com.jeesite.modules.biz.entity.MyProjectInfo;
/**
* 项目信息 DAO 接口
* @author gaoxq
* @version 2026-03-21
*/
@MyBatisDao(dataSourceName="work")
public interface MyProjectInfoDao extends CrudDao<MyProjectInfo> {
}

View File

@@ -26,7 +26,7 @@ import java.io.Serial;
@Column(name = "area_code", attrName = "areaCode", label = "区域编号"),
@Column(name = "area_name", attrName = "areaName", label = "区域名称", queryType = QueryType.LIKE),
@Column(name = "p_area_code", attrName = "pareaCode", label = "上级编码"),
@Column(name = "area_level", attrName = "areaLevel", label = "区域级别"),
@Column(name = "area_level", attrName = "areaLevel", label = "区域级别", queryType = QueryType.LTE),
@Column(name = "tree_name", attrName = "treeName", label = "树形名称", isQuery = false),
@Column(name = "update_time", attrName = "updateTime", label = "更新时间", isQuery = false, isUpdateForce = true),
@Column(name = "ustatus", attrName = "ustatus", label = "状态"),

View File

@@ -0,0 +1,118 @@
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 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 lombok.EqualsAndHashCode;
import java.io.Serial;
/**
* 图表信息 Entity
*
* @author gaoxq
* @version 2026-03-21
*/
@EqualsAndHashCode(callSuper = true)
@Table(name = "my_chart_info", alias = "a", label = "图表信息", columns = {
@Column(name = "create_time", attrName = "createTime", label = "记录时间", isUpdate = false, isUpdateForce = true),
@Column(name = "chart_id", attrName = "chartId", label = "唯一标识", isPK = true),
@Column(name = "chart_name", attrName = "chartName", label = "图表名称", queryType = QueryType.LIKE),
@Column(name = "chart_code", attrName = "chartCode", label = "图表编号"),
@Column(name = "sort", attrName = "sort", label = "序号", isQuery = false, isUpdateForce = true),
@Column(name = "vue_name", attrName = "vueName", label = "组件名称", isQuery = false),
@Column(name = "grid", attrName = "grid", label = "间距", isQuery = false),
@Column(name = "ustatus", attrName = "ustatus", label = "状态"),
@Column(name = "chart_type", attrName = "chartType", label = "图表类型"),
@Column(name = "item_name", attrName = "itemName", label = "项目名称", isQuery = false),
@Column(name = "item_code", attrName = "itemCode", label = "项目编号"),
@Column(name = "remark", attrName = "remark", label = "备注描述", isQuery = false),
@Column(name = "update_time", attrName = "updateTime", label = "更新时间", isQuery = false, isUpdateForce = true),
}, joinTable = {
@JoinTable(type = Type.LEFT_JOIN, entity = MyScreenInfo.class, alias = "b",
on = "a.chart_code = b.screen_code", attrName = "this",
columns = {
@Column(name = "screen_name", attrName = "screenName", label = "大屏名称"),
@Column(name = "screen_code", attrName = "screenCode", label = "大屏编码"),
@Column(name = "screen_title", attrName = "screenTitle", label = "大屏标题"),
}),
}, orderBy = "a.create_time DESC"
)
@Data
public class MyChartInfo extends DataEntity<MyChartInfo> implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
private Date createTime; // 记录时间
private String chartId; // 唯一标识
private String chartName; // 图表名称
private String chartCode; // 图表编号
private Long sort; // 序号
private String vueName; // 组件名称
private String grid; // 间距
private String ustatus; // 状态
private String chartType; // 图表类型
private String itemName; // 项目名称
private String itemCode; // 项目编号
private String remark; // 备注描述
private Date updateTime; // 更新时间
private String screenName;
private String screenCode;
private String screenTitle;
@ExcelFields({
@ExcelField(title = "记录时间", attrName = "createTime", align = Align.CENTER, sort = 10, dataFormat = "yyyy-MM-dd hh:mm"),
@ExcelField(title = "唯一标识", attrName = "chartId", align = Align.CENTER, sort = 20),
@ExcelField(title = "图表名称", attrName = "chartName", align = Align.CENTER, sort = 30),
@ExcelField(title = "图表编号", attrName = "chartCode", align = Align.CENTER, sort = 40),
@ExcelField(title = "序号", attrName = "sort", align = Align.CENTER, sort = 50),
@ExcelField(title = "组件名称", attrName = "vueName", align = Align.CENTER, sort = 60),
@ExcelField(title = "间距", attrName = "grid", align = Align.CENTER, sort = 70),
@ExcelField(title = "状态", attrName = "ustatus", dictType = "biz_status", align = Align.CENTER, sort = 80),
@ExcelField(title = "图表类型", attrName = "chartType", align = Align.CENTER, sort = 90),
@ExcelField(title = "项目名称", attrName = "itemName", align = Align.CENTER, sort = 100),
@ExcelField(title = "项目编号", attrName = "itemCode", align = Align.CENTER, sort = 110),
@ExcelField(title = "备注描述", attrName = "remark", align = Align.CENTER, sort = 120),
@ExcelField(title = "更新时间", attrName = "updateTime", align = Align.CENTER, sort = 130, dataFormat = "yyyy-MM-dd hh:mm"),
})
public MyChartInfo() {
this(null);
}
public MyChartInfo(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);
}
}

View File

@@ -63,12 +63,12 @@ public class MyCities extends DataEntity<MyCities> implements Serializable {
@ExcelFields({
@ExcelField(title = "唯一主键", attrName = "cityId", align = Align.CENTER, sort = 10),
@ExcelField(title = "记录时间", attrName = "createTime", align = Align.CENTER, sort = 20, dataFormat = "yyyy-MM-dd hh:mm"),
@ExcelField(title = "省份名称", attrName = "provinceName", align = Align.CENTER, sort = 30),
@ExcelField(title = "省份编码", attrName = "provinceCode", align = Align.CENTER, sort = 30),
@ExcelField(title = "省份名称", attrName = "provinceName", align = Align.CENTER, sort = 30),
@ExcelField(title = "市区编码", attrName = "cityCode", align = Align.CENTER, sort = 40),
@ExcelField(title = "市区名称", attrName = "cityName", align = Align.CENTER, sort = 50),
@ExcelField(title = "市区区号", attrName = "areaCode", align = Align.CENTER, sort = 60),
@ExcelField(title = "市区级别", attrName = "areaType", align = Align.CENTER, sort = 70),
@ExcelField(title = "市区级别", attrName = "areaType", dictType = "area_level", align = Align.CENTER, sort = 70),
@ExcelField(title = "更新时间", attrName = "updateTime", align = Align.CENTER, sort = 80, dataFormat = "yyyy-MM-dd hh:mm"),
@ExcelField(title = "状态", attrName = "ustatus", dictType = "biz_status", align = Align.CENTER, sort = 90),
})

View File

@@ -5,10 +5,6 @@ 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;

View File

@@ -0,0 +1,132 @@
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 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 2026-03-21
*/
@EqualsAndHashCode(callSuper = true)
@Table(name = "my_project_info", alias = "a", label = "项目信息", columns = {
@Column(name = "create_time", attrName = "createTime", label = "记录创建时间", isUpdate = false, isUpdateForce = true),
@Column(name = "project_id", attrName = "projectId", label = "唯一主键", isPK = true),
@Column(name = "project_code", attrName = "projectCode", label = "项目编码", isQuery = false),
@Column(name = "project_name", attrName = "projectName", label = "项目名称", queryType = QueryType.LIKE),
@Column(name = "project_desc", attrName = "projectDesc", label = "项目描述", isQuery = false),
@Column(name = "person_id", attrName = "personId", label = "人员编号"),
@Column(name = "priority", attrName = "priority", label = "级别"),
@Column(name = "area_level", attrName = "areaLevel", label = "区域级别"),
@Column(name = "area_code", attrName = "areaCode", label = "区域编号"),
@Column(name = "start_date", attrName = "startDate", label = "预计开始日期", isQuery = false, isUpdateForce = true),
@Column(name = "end_date", attrName = "endDate", label = "预计结束日期", isQuery = false, isUpdateForce = true),
@Column(name = "actual_end_date", attrName = "actualEndDate", label = "实际结束日期", isQuery = false, isUpdateForce = true),
@Column(name = "budget", attrName = "budget", label = "项目预算", comment = "项目预算(元)", isQuery = false),
@Column(name = "project_type", attrName = "projectType", label = "项目类型", isQuery = false),
@Column(name = "project_status", attrName = "projectStatus", label = "项目状态"),
@Column(name = "update_time", attrName = "updateTime", label = "更新时间", isQuery = false, isUpdateForce = true),
}, joinTable = {
@JoinTable(type = Type.LEFT_JOIN, entity = MyAreaSource.class, alias = "b",
on = "a.area_code = b.area_code", attrName = "this",
columns = {
@Column(name = "area_name", attrName = "areaName", label = "区域名称"),
@Column(name = "tree_name", attrName = "treeName", label = "树形名称"),
}),
@JoinTable(type = Type.LEFT_JOIN, entity = MyPerson.class, alias = "c",
on = "a.person_id = c.person_id", attrName = "this",
columns = {
@Column(name = "person_name", attrName = "personName", label = "姓名"),
}),
}, orderBy = "a.create_time DESC"
)
@Data
public class MyProjectInfo extends DataEntity<MyProjectInfo> implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
private Date createTime; // 记录创建时间
private String projectId; // 唯一主键
private String projectCode; // 项目编码
private String projectName; // 项目名称
private String projectDesc; // 项目描述
private String personId; // 人员编号
private String priority; // 级别
private String areaLevel; // 区域级别
private String areaCode; // 区域编号
private Date startDate; // 预计开始日期
private Date endDate; // 预计结束日期
private Date actualEndDate; // 实际结束日期
private Double budget; // 项目预算(元)
private String projectType; // 项目类型
private String projectStatus; // 项目状态
private Date updateTime; // 更新时间
private String areaName;
private String treeName;
private String personName;
@ExcelFields({
@ExcelField(title = "记录创建时间", attrName = "createTime", align = Align.CENTER, sort = 10, dataFormat = "yyyy-MM-dd hh:mm"),
@ExcelField(title = "唯一主键", attrName = "projectId", align = Align.CENTER, sort = 20),
@ExcelField(title = "项目编码", attrName = "projectCode", align = Align.CENTER, sort = 30),
@ExcelField(title = "项目名称", attrName = "projectName", align = Align.CENTER, sort = 40),
@ExcelField(title = "项目描述", attrName = "projectDesc", align = Align.CENTER, sort = 50),
@ExcelField(title = "人员姓名", attrName = "personName", align = Align.CENTER, sort = 60),
@ExcelField(title = "区域级别", attrName = "areaLevel", align = Align.CENTER, sort = 70),
@ExcelField(title = "区域名称", attrName = "treeName", align = Align.CENTER, sort = 80),
@ExcelField(title = "预计开始日期", attrName = "startDate", align = Align.CENTER, sort = 90, dataFormat = "yyyy-MM-dd hh:mm"),
@ExcelField(title = "预计结束日期", attrName = "endDate", align = Align.CENTER, sort = 100, dataFormat = "yyyy-MM-dd hh:mm"),
@ExcelField(title = "实际结束日期", attrName = "actualEndDate", align = Align.CENTER, sort = 110, dataFormat = "yyyy-MM-dd hh:mm"),
@ExcelField(title = "项目预算", attrName = "budget", align = Align.CENTER, sort = 120),
@ExcelField(title = "项目类型", attrName = "projectType", align = Align.CENTER, sort = 130),
@ExcelField(title = "级别", attrName = "priority", dictType = "biz_priority", align = Align.CENTER, sort = 135),
@ExcelField(title = "项目状态", attrName = "projectStatus", align = Align.CENTER, sort = 140),
@ExcelField(title = "更新时间", attrName = "updateTime", align = Align.CENTER, sort = 150, dataFormat = "yyyy-MM-dd hh:mm"),
})
public MyProjectInfo() {
this(null);
}
public MyProjectInfo(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);
}
}

View File

@@ -0,0 +1,134 @@
package com.jeesite.modules.biz.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.biz.entity.MyChartInfo;
import com.jeesite.modules.biz.dao.MyChartInfoDao;
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 2026-03-21
*/
@Service
public class MyChartInfoService extends CrudService<MyChartInfoDao, MyChartInfo> {
/**
* 获取单条数据
* @param myChartInfo 主键
*/
@Override
public MyChartInfo get(MyChartInfo myChartInfo) {
return super.get(myChartInfo);
}
/**
* 查询分页数据
* @param myChartInfo 查询条件
* @param myChartInfo page 分页对象
*/
@Override
public Page<MyChartInfo> findPage(MyChartInfo myChartInfo) {
return super.findPage(myChartInfo);
}
/**
* 查询列表数据
* @param myChartInfo 查询条件
*/
@Override
public List<MyChartInfo> findList(MyChartInfo myChartInfo) {
return super.findList(myChartInfo);
}
/**
* 保存数据(插入或更新)
* @param myChartInfo 数据对象
*/
@Override
@Transactional
public void save(MyChartInfo myChartInfo) {
super.save(myChartInfo);
}
/**
* 导入数据
* @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<MyChartInfo> list = ei.getDataList(MyChartInfo.class);
for (MyChartInfo myChartInfo : list) {
try{
ValidatorUtils.validateWithException(myChartInfo);
this.save(myChartInfo);
successNum++;
successMsg.append("<br/>" + successNum + "、编号 " + myChartInfo.getId() + " 导入成功");
} catch (Exception e) {
failureNum++;
String msg = "<br/>" + failureNum + "、编号 " + myChartInfo.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 myChartInfo 数据对象
*/
@Override
@Transactional
public void updateStatus(MyChartInfo myChartInfo) {
super.updateStatus(myChartInfo);
}
/**
* 删除数据
* @param myChartInfo 数据对象
*/
@Override
@Transactional
public void delete(MyChartInfo myChartInfo) {
super.delete(myChartInfo);
}
}

View File

@@ -0,0 +1,137 @@
package com.jeesite.modules.biz.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.biz.entity.MyProjectInfo;
import com.jeesite.modules.biz.dao.MyProjectInfoDao;
import com.jeesite.common.service.ServiceException;
import com.jeesite.modules.file.utils.FileUploadUtils;
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 2026-03-21
*/
@Service
public class MyProjectInfoService extends CrudService<MyProjectInfoDao, MyProjectInfo> {
/**
* 获取单条数据
* @param myProjectInfo 主键
*/
@Override
public MyProjectInfo get(MyProjectInfo myProjectInfo) {
return super.get(myProjectInfo);
}
/**
* 查询分页数据
* @param myProjectInfo 查询条件
* @param myProjectInfo page 分页对象
*/
@Override
public Page<MyProjectInfo> findPage(MyProjectInfo myProjectInfo) {
return super.findPage(myProjectInfo);
}
/**
* 查询列表数据
* @param myProjectInfo 查询条件
*/
@Override
public List<MyProjectInfo> findList(MyProjectInfo myProjectInfo) {
return super.findList(myProjectInfo);
}
/**
* 保存数据(插入或更新)
* @param myProjectInfo 数据对象
*/
@Override
@Transactional
public void save(MyProjectInfo myProjectInfo) {
super.save(myProjectInfo);
// 保存上传附件
FileUploadUtils.saveFileUpload(myProjectInfo, myProjectInfo.getId(), "myProjectInfo_file");
}
/**
* 导入数据
* @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<MyProjectInfo> list = ei.getDataList(MyProjectInfo.class);
for (MyProjectInfo myProjectInfo : list) {
try{
ValidatorUtils.validateWithException(myProjectInfo);
this.save(myProjectInfo);
successNum++;
successMsg.append("<br/>" + successNum + "、编号 " + myProjectInfo.getId() + " 导入成功");
} catch (Exception e) {
failureNum++;
String msg = "<br/>" + failureNum + "、编号 " + myProjectInfo.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 myProjectInfo 数据对象
*/
@Override
@Transactional
public void updateStatus(MyProjectInfo myProjectInfo) {
super.updateStatus(myProjectInfo);
}
/**
* 删除数据
* @param myProjectInfo 数据对象
*/
@Override
@Transactional
public void delete(MyProjectInfo myProjectInfo) {
super.delete(myProjectInfo);
}
}

View File

@@ -0,0 +1,157 @@
package com.jeesite.modules.biz.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.biz.entity.MyChartInfo;
import com.jeesite.modules.biz.service.MyChartInfoService;
/**
* 图表信息 Controller
*
* @author gaoxq
* @version 2026-03-21
*/
@Controller
@RequestMapping(value = "${adminPath}/biz/myChartInfo")
public class MyChartInfoController extends BaseController {
private final MyChartInfoService myChartInfoService;
public MyChartInfoController(MyChartInfoService myChartInfoService) {
this.myChartInfoService = myChartInfoService;
}
/**
* 获取数据
*/
@ModelAttribute
public MyChartInfo get(String chartId, boolean isNewRecord) {
return myChartInfoService.get(chartId, isNewRecord);
}
/**
* 查询列表
*/
@RequiresPermissions("biz:myChartInfo:view")
@RequestMapping(value = {"list", ""})
public String list(MyChartInfo myChartInfo, Model model) {
model.addAttribute("myChartInfo", myChartInfo);
return "modules/biz/myChartInfoList";
}
/**
* 查询列表数据
*/
@RequiresPermissions("biz:myChartInfo:view")
@RequestMapping(value = "listData")
@ResponseBody
public Page<MyChartInfo> listData(MyChartInfo myChartInfo, HttpServletRequest request, HttpServletResponse response) {
myChartInfo.setPage(new Page<>(request, response));
Page<MyChartInfo> page = myChartInfoService.findPage(myChartInfo);
return page;
}
/**
* 查看编辑表单
*/
@RequiresPermissions("biz:myChartInfo:view")
@RequestMapping(value = "form")
public String form(MyChartInfo myChartInfo, Model model) {
model.addAttribute("myChartInfo", myChartInfo);
return "modules/biz/myChartInfoForm";
}
/**
* 保存数据
*/
@RequiresPermissions("biz:myChartInfo:edit")
@PostMapping(value = "save")
@ResponseBody
public String save(@Validated MyChartInfo myChartInfo) {
myChartInfoService.save(myChartInfo);
return renderResult(Global.TRUE, text("保存图表成功!"));
}
/**
* 导出数据
*/
@RequiresPermissions("biz:myChartInfo:view")
@RequestMapping(value = "exportData")
public void exportData(MyChartInfo myChartInfo, HttpServletResponse response) {
List<MyChartInfo> list = myChartInfoService.findList(myChartInfo);
String fileName = "图表" + DateUtils.getDate("yyyyMMddHHmmss") + ".xlsx";
try (ExcelExport ee = new ExcelExport("图表", MyChartInfo.class)) {
ee.setDataList(list).write(response, fileName);
}
}
/**
* 下载模板
*/
@RequiresPermissions("biz:myChartInfo:view")
@RequestMapping(value = "importTemplate")
public void importTemplate(HttpServletResponse response) {
MyChartInfo myChartInfo = new MyChartInfo();
List<MyChartInfo> list = ListUtils.newArrayList(myChartInfo);
String fileName = "图表模板.xlsx";
try (ExcelExport ee = new ExcelExport("图表", MyChartInfo.class, Type.IMPORT)) {
ee.setDataList(list).write(response, fileName);
}
}
/**
* 导入数据
*/
@ResponseBody
@RequiresPermissions("biz:myChartInfo:edit")
@PostMapping(value = "importData")
public String importData(MultipartFile file) {
try {
String message = myChartInfoService.importData(file);
return renderResult(Global.TRUE, "posfull:" + message);
} catch (Exception ex) {
return renderResult(Global.FALSE, "posfull:" + ex.getMessage());
}
}
/**
* 删除数据
*/
@RequiresPermissions("biz:myChartInfo:edit")
@RequestMapping(value = "delete")
@ResponseBody
public String delete(MyChartInfo myChartInfo) {
myChartInfoService.delete(myChartInfo);
return renderResult(Global.TRUE, text("删除图表成功!"));
}
/**
* 列表数据
*/
@RequestMapping(value = "listAll")
@ResponseBody
public List<MyChartInfo> listAll(MyChartInfo myChartInfo) {
return myChartInfoService.findList(myChartInfo);
}
}

View File

@@ -0,0 +1,146 @@
package com.jeesite.modules.biz.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.biz.entity.MyProjectInfo;
import com.jeesite.modules.biz.service.MyProjectInfoService;
/**
* 项目信息 Controller
* @author gaoxq
* @version 2026-03-21
*/
@Controller
@RequestMapping(value = "${adminPath}/biz/myProjectInfo")
public class MyProjectInfoController extends BaseController {
private final MyProjectInfoService myProjectInfoService;
public MyProjectInfoController(MyProjectInfoService myProjectInfoService) {
this.myProjectInfoService = myProjectInfoService;
}
/**
* 获取数据
*/
@ModelAttribute
public MyProjectInfo get(String projectId, boolean isNewRecord) {
return myProjectInfoService.get(projectId, isNewRecord);
}
/**
* 查询列表
*/
@RequiresPermissions("biz:myProjectInfo:view")
@RequestMapping(value = {"list", ""})
public String list(MyProjectInfo myProjectInfo, Model model) {
model.addAttribute("myProjectInfo", myProjectInfo);
return "modules/biz/myProjectInfoList";
}
/**
* 查询列表数据
*/
@RequiresPermissions("biz:myProjectInfo:view")
@RequestMapping(value = "listData")
@ResponseBody
public Page<MyProjectInfo> listData(MyProjectInfo myProjectInfo, HttpServletRequest request, HttpServletResponse response) {
myProjectInfo.setPage(new Page<>(request, response));
Page<MyProjectInfo> page = myProjectInfoService.findPage(myProjectInfo);
return page;
}
/**
* 查看编辑表单
*/
@RequiresPermissions("biz:myProjectInfo:view")
@RequestMapping(value = "form")
public String form(MyProjectInfo myProjectInfo, Model model) {
model.addAttribute("myProjectInfo", myProjectInfo);
return "modules/biz/myProjectInfoForm";
}
/**
* 保存数据
*/
@RequiresPermissions("biz:myProjectInfo:edit")
@PostMapping(value = "save")
@ResponseBody
public String save(@Validated MyProjectInfo myProjectInfo) {
myProjectInfoService.save(myProjectInfo);
return renderResult(Global.TRUE, text("保存项目成功!"));
}
/**
* 导出数据
*/
@RequiresPermissions("biz:myProjectInfo:view")
@RequestMapping(value = "exportData")
public void exportData(MyProjectInfo myProjectInfo, HttpServletResponse response) {
List<MyProjectInfo> list = myProjectInfoService.findList(myProjectInfo);
String fileName = "项目" + DateUtils.getDate("yyyyMMddHHmmss") + ".xlsx";
try(ExcelExport ee = new ExcelExport("项目", MyProjectInfo.class)){
ee.setDataList(list).write(response, fileName);
}
}
/**
* 下载模板
*/
@RequiresPermissions("biz:myProjectInfo:view")
@RequestMapping(value = "importTemplate")
public void importTemplate(HttpServletResponse response) {
MyProjectInfo myProjectInfo = new MyProjectInfo();
List<MyProjectInfo> list = ListUtils.newArrayList(myProjectInfo);
String fileName = "项目模板.xlsx";
try(ExcelExport ee = new ExcelExport("项目", MyProjectInfo.class, Type.IMPORT)){
ee.setDataList(list).write(response, fileName);
}
}
/**
* 导入数据
*/
@ResponseBody
@RequiresPermissions("biz:myProjectInfo:edit")
@PostMapping(value = "importData")
public String importData(MultipartFile file) {
try {
String message = myProjectInfoService.importData(file);
return renderResult(Global.TRUE, "posfull:"+message);
} catch (Exception ex) {
return renderResult(Global.FALSE, "posfull:"+ex.getMessage());
}
}
/**
* 删除数据
*/
@RequiresPermissions("biz:myProjectInfo:edit")
@RequestMapping(value = "delete")
@ResponseBody
public String delete(MyProjectInfo myProjectInfo) {
myProjectInfoService.delete(myProjectInfo);
return renderResult(Global.TRUE, text("删除项目成功!"));
}
}

View File

@@ -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 2026-03-21
*/
@MyBatisDao(dataSourceName="work")
public interface ErpAccountDao extends CrudDao<ErpAccount> {
}

View File

@@ -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 2026-03-22
*/
@MyBatisDao(dataSourceName="work")
public interface ErpCategoryDao extends CrudDao<ErpCategory> {
}

View File

@@ -0,0 +1,71 @@
package com.jeesite.modules.erp.entity;
import java.io.Serializable;
import java.util.Date;
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 2026-03-21
*/
@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),
}, orderBy = "a.account_id 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 Double initialBalance; // 初始余额
private Double currentBalance; // 当前余额
private String isActive; // 是否激活
private Date updateTime; // 更新时间
@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", 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", 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);
}
}

View File

@@ -0,0 +1,74 @@
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.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 2026-03-22
*/
@EqualsAndHashCode(callSuper = true)
@Table(name = "erp_category", alias = "a", label = "分类信息", columns = {
@Column(name = "create_time", attrName = "createTime", label = "记录时间", isUpdate = false, isQuery = false, isUpdateForce = true),
@Column(name = "category_id", attrName = "categoryId", label = "分类标识", isPK = true),
@Column(name = "parent_name", attrName = "parentName", label = "父级名称", isQuery = false),
@Column(name = "category_name", attrName = "categoryName", label = "分类名称", queryType = QueryType.LIKE),
@Column(name = "category_type", attrName = "categoryType", label = "分类类型"),
@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),
}, 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 parentName; // 父级名称
private String categoryName; // 分类名称
private String categoryType; // 分类类型
private Long sortOrder; // 排序序号
private String isActive; // 是否启用
private Date updateTime; // 更新时间
@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 = "parentName", align = Align.CENTER, sort = 30),
@ExcelField(title = "分类名称", attrName = "categoryName", align = Align.CENTER, sort = 40),
@ExcelField(title = "分类类型", attrName = "categoryType", align = Align.CENTER, sort = 50),
@ExcelField(title = "排序序号", attrName = "sortOrder", align = Align.CENTER, sort = 60),
@ExcelField(title = "是否启用", attrName = "isActive", 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);
}
}

View File

@@ -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 2026-03-21
*/
@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);
}
}

View File

@@ -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 2026-03-22
*/
@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);
}
}

View File

@@ -0,0 +1,157 @@
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 2026-03-21
*/
@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("删除账户成功!"));
}
/**
* 列表数据
*/
@RequestMapping(value = "listAll")
@ResponseBody
public List<ErpAccount> listAll(ErpAccount erpAccount) {
return erpAccountService.findList(erpAccount);
}
}

View File

@@ -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.ErpCategory;
import com.jeesite.modules.erp.service.ErpCategoryService;
/**
* 收支分类 Controller
* @author gaoxq
* @version 2026-03-22
*/
@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("删除分类成功!"));
}
}

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.jeesite.modules.biz.dao.MyChartInfoDao">
<!-- 查询数据
<select id="findList" resultType="MyChartInfo">
SELECT ${sqlMap.column.toSql()}
FROM ${sqlMap.table.toSql()}
<where>
${sqlMap.where.toSql()}
</where>
ORDER BY ${sqlMap.order.toSql()}
</select> -->
</mapper>

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.jeesite.modules.biz.dao.MyProjectInfoDao">
<!-- 查询数据
<select id="findList" resultType="MyProjectInfo">
SELECT ${sqlMap.column.toSql()}
FROM ${sqlMap.table.toSql()}
<where>
${sqlMap.where.toSql()}
</where>
ORDER BY ${sqlMap.order.toSql()}
</select> -->
</mapper>

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.jeesite.modules.erp.dao.ErpAccountDao">
<!-- 查询数据
<select id="findList" resultType="ErpAccount">
SELECT ${sqlMap.column.toSql()}
FROM ${sqlMap.table.toSql()}
<where>
${sqlMap.where.toSql()}
</where>
ORDER BY ${sqlMap.order.toSql()}
</select> -->
</mapper>

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.jeesite.modules.erp.dao.ErpCategoryDao">
<!-- 查询数据
<select id="findList" resultType="ErpCategory">
SELECT ${sqlMap.column.toSql()}
FROM ${sqlMap.table.toSql()}
<where>
${sqlMap.where.toSql()}
</where>
ORDER BY ${sqlMap.order.toSql()}
</select> -->
</mapper>