财务门户设计
This commit is contained in:
@@ -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.ErpAccountCycle;
|
||||
|
||||
/**
|
||||
* VIEWDAO接口
|
||||
* @author gaoxq
|
||||
* @version 2026-02-17
|
||||
*/
|
||||
@MyBatisDao(dataSourceName="work")
|
||||
public interface ErpAccountCycleDao extends CrudDao<ErpAccountCycle> {
|
||||
|
||||
}
|
||||
@@ -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.ErpAccountIncomeExpense;
|
||||
|
||||
/**
|
||||
* 账户收支DAO接口
|
||||
* @author gaoxq
|
||||
* @version 2026-02-17
|
||||
*/
|
||||
@MyBatisDao(dataSourceName="work")
|
||||
public interface ErpAccountIncomeExpenseDao extends CrudDao<ErpAccountIncomeExpense> {
|
||||
|
||||
}
|
||||
@@ -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.ErpCategoryIncomeExpense;
|
||||
|
||||
/**
|
||||
* 类别收支DAO接口
|
||||
* @author gaoxq
|
||||
* @version 2026-02-17
|
||||
*/
|
||||
@MyBatisDao(dataSourceName="work")
|
||||
public interface ErpCategoryIncomeExpenseDao extends CrudDao<ErpCategoryIncomeExpense> {
|
||||
|
||||
}
|
||||
@@ -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.ErpIncomeExpenseCycle;
|
||||
|
||||
/**
|
||||
* 年度收支信息DAO接口
|
||||
* @author gaoxq
|
||||
* @version 2026-02-17
|
||||
*/
|
||||
@MyBatisDao(dataSourceName="work")
|
||||
public interface ErpIncomeExpenseCycleDao extends CrudDao<ErpIncomeExpenseCycle> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
package com.jeesite.modules.erp.entity;
|
||||
|
||||
|
||||
import com.jeesite.common.entity.DataEntity;
|
||||
import com.jeesite.common.mybatis.annotation.Column;
|
||||
import com.jeesite.common.mybatis.annotation.JoinTable;
|
||||
import com.jeesite.common.mybatis.annotation.Table;
|
||||
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;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* VIEWEntity
|
||||
*
|
||||
* @author gaoxq
|
||||
* @version 2026-02-17
|
||||
*/
|
||||
@Table(name = "erp_account_cycle_view", alias = "a", label = "VIEW信息", columns = {
|
||||
@Column(name = "account_id", attrName = "accountId", label = "交易账户", isPK = true),
|
||||
@Column(name = "transaction_type", attrName = "transactionType", label = "交易类型", isPK = true),
|
||||
@Column(name = "year_date", attrName = "yearDate", label = "年度", isPK = true),
|
||||
@Column(name = "amount_01", attrName = "amount01", label = "01月", isUpdateForce = true),
|
||||
@Column(name = "amount_02", attrName = "amount02", label = "02月", isUpdateForce = true),
|
||||
@Column(name = "amount_03", attrName = "amount03", label = "03月", isUpdateForce = true),
|
||||
@Column(name = "amount_04", attrName = "amount04", label = "04月", isUpdateForce = true),
|
||||
@Column(name = "amount_05", attrName = "amount05", label = "05月", isUpdateForce = true),
|
||||
@Column(name = "amount_06", attrName = "amount06", label = "06月", isUpdateForce = true),
|
||||
@Column(name = "amount_07", attrName = "amount07", label = "07月", isUpdateForce = true),
|
||||
@Column(name = "amount_08", attrName = "amount08", label = "08月", isUpdateForce = true),
|
||||
@Column(name = "amount_09", attrName = "amount09", label = "09月", isUpdateForce = true),
|
||||
@Column(name = "amount_10", attrName = "amount10", label = "10月", isUpdateForce = true),
|
||||
@Column(name = "amount_11", attrName = "amount11", label = "11月", isUpdateForce = true),
|
||||
@Column(name = "amount_12", attrName = "amount12", label = "12月", isUpdateForce = true),
|
||||
}, joinTable = {
|
||||
@JoinTable(type = JoinTable.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 = "账户名称"),
|
||||
}),
|
||||
}, orderBy = "a.account_id DESC, a.transaction_type DESC, a.year_date DESC"
|
||||
)
|
||||
@Data
|
||||
public class ErpAccountCycle extends DataEntity<ErpAccountCycle> implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
private String accountId; // 交易账户
|
||||
private String transactionType; // 交易类型
|
||||
private String yearDate; // 年度
|
||||
private Double amount01; // 01月
|
||||
private Double amount02; // 02月
|
||||
private Double amount03; // 03月
|
||||
private Double amount04; // 04月
|
||||
private Double amount05; // 05月
|
||||
private Double amount06; // 06月
|
||||
private Double amount07; // 07月
|
||||
private Double amount08; // 08月
|
||||
private Double amount09; // 09月
|
||||
private Double amount10; // 10月
|
||||
private Double amount11; // 11月
|
||||
private Double amount12; // 12月
|
||||
|
||||
private String accountName;
|
||||
|
||||
@ExcelFields({
|
||||
@ExcelField(title = "交易账户", attrName = "accountName", align = Align.CENTER, sort = 10),
|
||||
@ExcelField(title = "交易类型", attrName = "transactionType", dictType = "transaction_type", align = Align.CENTER, sort = 20),
|
||||
@ExcelField(title = "年度", attrName = "yearDate", align = Align.CENTER, sort = 30),
|
||||
@ExcelField(title = "01月", attrName = "amount01", align = Align.CENTER, sort = 40),
|
||||
@ExcelField(title = "02月", attrName = "amount02", align = Align.CENTER, sort = 50),
|
||||
@ExcelField(title = "03月", attrName = "amount03", align = Align.CENTER, sort = 60),
|
||||
@ExcelField(title = "04月", attrName = "amount04", align = Align.CENTER, sort = 70),
|
||||
@ExcelField(title = "05月", attrName = "amount05", align = Align.CENTER, sort = 80),
|
||||
@ExcelField(title = "06月", attrName = "amount06", align = Align.CENTER, sort = 90),
|
||||
@ExcelField(title = "07月", attrName = "amount07", align = Align.CENTER, sort = 100),
|
||||
@ExcelField(title = "08月", attrName = "amount08", align = Align.CENTER, sort = 110),
|
||||
@ExcelField(title = "09月", attrName = "amount09", align = Align.CENTER, sort = 120),
|
||||
@ExcelField(title = "10月", attrName = "amount10", align = Align.CENTER, sort = 130),
|
||||
@ExcelField(title = "11月", attrName = "amount11", align = Align.CENTER, sort = 140),
|
||||
@ExcelField(title = "12月", attrName = "amount12", align = Align.CENTER, sort = 150),
|
||||
})
|
||||
public ErpAccountCycle() {
|
||||
this(null, null, null);
|
||||
}
|
||||
|
||||
public ErpAccountCycle(String accountId, String transactionType, String yearDate) {
|
||||
this.accountId = accountId;
|
||||
this.transactionType = transactionType;
|
||||
this.yearDate = yearDate;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.jeesite.modules.erp.entity;
|
||||
|
||||
|
||||
import com.jeesite.common.entity.DataEntity;
|
||||
import com.jeesite.common.mybatis.annotation.Column;
|
||||
import com.jeesite.common.mybatis.annotation.JoinTable;
|
||||
import com.jeesite.common.mybatis.annotation.Table;
|
||||
import com.jeesite.common.mybatis.mapper.query.QueryType;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 账户收支Entity
|
||||
*
|
||||
* @author gaoxq
|
||||
* @version 2026-02-17
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Table(name = "erp_account_income_expense_view", alias = "a", label = "账户收支信息", columns = {
|
||||
@Column(name = "account_id", attrName = "accountId", label = "交易账户", isPK = true),
|
||||
@Column(name = "year_date", attrName = "yearDate", label = "year_date", isPK = true),
|
||||
@Column(name = "income_amount", attrName = "incomeAmount", label = "income_amount", isUpdateForce = true),
|
||||
@Column(name = "expense_amount", attrName = "expenseAmount", label = "expense_amount", isUpdateForce = true),
|
||||
}, joinTable = {
|
||||
@JoinTable(type = JoinTable.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 = "账户名称"),
|
||||
}),
|
||||
}, orderBy = "a.account_id DESC, a.year_date DESC"
|
||||
)
|
||||
@Data
|
||||
public class ErpAccountIncomeExpense extends DataEntity<ErpAccountIncomeExpense> implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
private String accountId; // 交易账户
|
||||
private String yearDate; // year_date
|
||||
private Double incomeAmount; // income_amount
|
||||
private Double expenseAmount; // expense_amount
|
||||
|
||||
private String accountName;
|
||||
|
||||
public ErpAccountIncomeExpense() {
|
||||
this(null, null);
|
||||
}
|
||||
|
||||
public ErpAccountIncomeExpense(String accountId, String yearDate) {
|
||||
this.accountId = accountId;
|
||||
this.yearDate = yearDate;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.jeesite.modules.erp.entity;
|
||||
|
||||
|
||||
import com.jeesite.common.entity.DataEntity;
|
||||
import com.jeesite.common.mybatis.annotation.Column;
|
||||
import com.jeesite.common.mybatis.annotation.JoinTable;
|
||||
import com.jeesite.common.mybatis.annotation.Table;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 类别收支Entity
|
||||
*
|
||||
* @author gaoxq
|
||||
* @version 2026-02-17
|
||||
*/
|
||||
@Table(name = "erp_category_income_expense_view", alias = "a", label = "类别收支信息", columns = {
|
||||
@Column(name = "category_id", attrName = "categoryId", label = "交易分类", isPK = true),
|
||||
@Column(name = "year_date", attrName = "yearDate", label = "year_date", isPK = true),
|
||||
@Column(name = "income_amount", attrName = "incomeAmount", label = "income_amount", isUpdateForce = true),
|
||||
@Column(name = "expense_amount", attrName = "expenseAmount", label = "expense_amount", isUpdateForce = true),
|
||||
}, joinTable = {
|
||||
@JoinTable(type = JoinTable.Type.LEFT_JOIN, entity = ErpCategory.class, attrName = "this", alias = "b",
|
||||
on = "a.category_id = b.category_id",
|
||||
columns = {
|
||||
@Column(name = "parent_id", attrName = "parentId", label = "父级分类"),
|
||||
@Column(name = "category_name", attrName = "categoryName", label = "分类名称"),
|
||||
}),
|
||||
}, orderBy = "a.category_id DESC, a.year_date DESC"
|
||||
)
|
||||
@Data
|
||||
public class ErpCategoryIncomeExpense extends DataEntity<ErpCategoryIncomeExpense> implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
private String categoryId; // 交易分类
|
||||
private String yearDate; // year_date
|
||||
private Double incomeAmount; // income_amount
|
||||
private Double expenseAmount; // expense_amount
|
||||
|
||||
private String categoryName;
|
||||
|
||||
public ErpCategoryIncomeExpense() {
|
||||
this(null, null);
|
||||
}
|
||||
|
||||
public ErpCategoryIncomeExpense(String categoryId, String yearDate) {
|
||||
this.categoryId = categoryId;
|
||||
this.yearDate = yearDate;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.jeesite.modules.erp.entity;
|
||||
|
||||
|
||||
import com.jeesite.common.entity.DataEntity;
|
||||
import com.jeesite.common.mybatis.annotation.Column;
|
||||
import com.jeesite.common.mybatis.annotation.Table;
|
||||
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;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 年度收支信息Entity
|
||||
*
|
||||
* @author gaoxq
|
||||
* @version 2026-02-17
|
||||
*/
|
||||
@Table(name = "erp_income_expense_cycle_view", alias = "a", label = "年度收支信息信息", columns = {
|
||||
@Column(name = "year_date", attrName = "yearDate", label = "year_date", isPK = true),
|
||||
@Column(name = "month_date", attrName = "monthDate", label = "month_date", isPK = true),
|
||||
@Column(name = "income_amount", attrName = "incomeAmount", label = "income_amount", isUpdateForce = true),
|
||||
@Column(name = "expense_amount", attrName = "expenseAmount", label = "expense_amount", isUpdateForce = true),
|
||||
}, orderBy = "a.year_date DESC, a.month_date DESC"
|
||||
)
|
||||
@Data
|
||||
public class ErpIncomeExpenseCycle extends DataEntity<ErpIncomeExpenseCycle> implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
private String yearDate; // year_date
|
||||
private String monthDate; // month_date
|
||||
private Double incomeAmount; // income_amount
|
||||
private Double expenseAmount; // expense_amount
|
||||
|
||||
@ExcelFields({
|
||||
@ExcelField(title = "year_date", attrName = "yearDate", align = Align.CENTER, sort = 10),
|
||||
@ExcelField(title = "month_date", attrName = "monthDate", align = Align.CENTER, sort = 20),
|
||||
@ExcelField(title = "income_amount", attrName = "incomeAmount", align = Align.CENTER, sort = 30),
|
||||
@ExcelField(title = "expense_amount", attrName = "expenseAmount", align = Align.CENTER, sort = 40),
|
||||
})
|
||||
public ErpIncomeExpenseCycle() {
|
||||
this(null, null);
|
||||
}
|
||||
|
||||
public ErpIncomeExpenseCycle(String yearDate, String monthDate) {
|
||||
this.yearDate = yearDate;
|
||||
this.monthDate = monthDate;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,135 @@
|
||||
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.ErpAccountCycle;
|
||||
import com.jeesite.modules.erp.dao.ErpAccountCycleDao;
|
||||
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;
|
||||
|
||||
/**
|
||||
* VIEWService
|
||||
* @author gaoxq
|
||||
* @version 2026-02-17
|
||||
*/
|
||||
@Service
|
||||
public class ErpAccountCycleService extends CrudService<ErpAccountCycleDao, ErpAccountCycle> {
|
||||
|
||||
/**
|
||||
* 获取单条数据
|
||||
* @param erpAccountCycle 主键
|
||||
*/
|
||||
@Override
|
||||
public ErpAccountCycle get(ErpAccountCycle erpAccountCycle) {
|
||||
return super.get(erpAccountCycle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询分页数据
|
||||
* @param erpAccountCycle 查询条件
|
||||
* @param erpAccountCycle page 分页对象
|
||||
*/
|
||||
@Override
|
||||
public Page<ErpAccountCycle> findPage(ErpAccountCycle erpAccountCycle) {
|
||||
return super.findPage(erpAccountCycle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表数据
|
||||
* @param erpAccountCycle 查询条件
|
||||
*/
|
||||
@Override
|
||||
public List<ErpAccountCycle> findList(ErpAccountCycle erpAccountCycle) {
|
||||
return super.findList(erpAccountCycle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存数据(插入或更新)
|
||||
* @param erpAccountCycle 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void save(ErpAccountCycle erpAccountCycle) {
|
||||
super.save(erpAccountCycle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入数据
|
||||
* @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<ErpAccountCycle> list = ei.getDataList(ErpAccountCycle.class);
|
||||
for (ErpAccountCycle erpAccountCycle : list) {
|
||||
try{
|
||||
ValidatorUtils.validateWithException(erpAccountCycle);
|
||||
this.save(erpAccountCycle);
|
||||
successNum++;
|
||||
successMsg.append("<br/>" + successNum + "、编号 " + erpAccountCycle.getId() + " 导入成功");
|
||||
} catch (Exception e) {
|
||||
failureNum++;
|
||||
String msg = "<br/>" + failureNum + "、编号 " + erpAccountCycle.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 erpAccountCycle 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void updateStatus(ErpAccountCycle erpAccountCycle) {
|
||||
super.updateStatus(erpAccountCycle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
* @param erpAccountCycle 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void delete(ErpAccountCycle erpAccountCycle) {
|
||||
erpAccountCycle.sqlMap().markIdDelete(); // 逻辑删除时标记ID值
|
||||
super.delete(erpAccountCycle);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
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.ErpAccountIncomeExpense;
|
||||
import com.jeesite.modules.erp.dao.ErpAccountIncomeExpenseDao;
|
||||
|
||||
/**
|
||||
* 账户收支Service
|
||||
* @author gaoxq
|
||||
* @version 2026-02-17
|
||||
*/
|
||||
@Service
|
||||
public class ErpAccountIncomeExpenseService extends CrudService<ErpAccountIncomeExpenseDao, ErpAccountIncomeExpense> {
|
||||
|
||||
/**
|
||||
* 获取单条数据
|
||||
* @param erpAccountIncomeExpense 主键
|
||||
*/
|
||||
@Override
|
||||
public ErpAccountIncomeExpense get(ErpAccountIncomeExpense erpAccountIncomeExpense) {
|
||||
return super.get(erpAccountIncomeExpense);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询分页数据
|
||||
* @param erpAccountIncomeExpense 查询条件
|
||||
* @param erpAccountIncomeExpense page 分页对象
|
||||
*/
|
||||
@Override
|
||||
public Page<ErpAccountIncomeExpense> findPage(ErpAccountIncomeExpense erpAccountIncomeExpense) {
|
||||
return super.findPage(erpAccountIncomeExpense);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表数据
|
||||
* @param erpAccountIncomeExpense 查询条件
|
||||
*/
|
||||
@Override
|
||||
public List<ErpAccountIncomeExpense> findList(ErpAccountIncomeExpense erpAccountIncomeExpense) {
|
||||
return super.findList(erpAccountIncomeExpense);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存数据(插入或更新)
|
||||
* @param erpAccountIncomeExpense 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void save(ErpAccountIncomeExpense erpAccountIncomeExpense) {
|
||||
super.save(erpAccountIncomeExpense);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新状态
|
||||
* @param erpAccountIncomeExpense 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void updateStatus(ErpAccountIncomeExpense erpAccountIncomeExpense) {
|
||||
super.updateStatus(erpAccountIncomeExpense);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
* @param erpAccountIncomeExpense 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void delete(ErpAccountIncomeExpense erpAccountIncomeExpense) {
|
||||
erpAccountIncomeExpense.sqlMap().markIdDelete(); // 逻辑删除时标记ID值
|
||||
super.delete(erpAccountIncomeExpense);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
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.ErpCategoryIncomeExpense;
|
||||
import com.jeesite.modules.erp.dao.ErpCategoryIncomeExpenseDao;
|
||||
|
||||
/**
|
||||
* 类别收支Service
|
||||
* @author gaoxq
|
||||
* @version 2026-02-17
|
||||
*/
|
||||
@Service
|
||||
public class ErpCategoryIncomeExpenseService extends CrudService<ErpCategoryIncomeExpenseDao, ErpCategoryIncomeExpense> {
|
||||
|
||||
/**
|
||||
* 获取单条数据
|
||||
* @param erpCategoryIncomeExpense 主键
|
||||
*/
|
||||
@Override
|
||||
public ErpCategoryIncomeExpense get(ErpCategoryIncomeExpense erpCategoryIncomeExpense) {
|
||||
return super.get(erpCategoryIncomeExpense);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询分页数据
|
||||
* @param erpCategoryIncomeExpense 查询条件
|
||||
* @param erpCategoryIncomeExpense page 分页对象
|
||||
*/
|
||||
@Override
|
||||
public Page<ErpCategoryIncomeExpense> findPage(ErpCategoryIncomeExpense erpCategoryIncomeExpense) {
|
||||
return super.findPage(erpCategoryIncomeExpense);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表数据
|
||||
* @param erpCategoryIncomeExpense 查询条件
|
||||
*/
|
||||
@Override
|
||||
public List<ErpCategoryIncomeExpense> findList(ErpCategoryIncomeExpense erpCategoryIncomeExpense) {
|
||||
return super.findList(erpCategoryIncomeExpense);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存数据(插入或更新)
|
||||
* @param erpCategoryIncomeExpense 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void save(ErpCategoryIncomeExpense erpCategoryIncomeExpense) {
|
||||
super.save(erpCategoryIncomeExpense);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新状态
|
||||
* @param erpCategoryIncomeExpense 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void updateStatus(ErpCategoryIncomeExpense erpCategoryIncomeExpense) {
|
||||
super.updateStatus(erpCategoryIncomeExpense);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
* @param erpCategoryIncomeExpense 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void delete(ErpCategoryIncomeExpense erpCategoryIncomeExpense) {
|
||||
erpCategoryIncomeExpense.sqlMap().markIdDelete(); // 逻辑删除时标记ID值
|
||||
super.delete(erpCategoryIncomeExpense);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,135 @@
|
||||
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.ErpIncomeExpenseCycle;
|
||||
import com.jeesite.modules.erp.dao.ErpIncomeExpenseCycleDao;
|
||||
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-02-17
|
||||
*/
|
||||
@Service
|
||||
public class ErpIncomeExpenseCycleService extends CrudService<ErpIncomeExpenseCycleDao, ErpIncomeExpenseCycle> {
|
||||
|
||||
/**
|
||||
* 获取单条数据
|
||||
* @param erpIncomeExpenseCycle 主键
|
||||
*/
|
||||
@Override
|
||||
public ErpIncomeExpenseCycle get(ErpIncomeExpenseCycle erpIncomeExpenseCycle) {
|
||||
return super.get(erpIncomeExpenseCycle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询分页数据
|
||||
* @param erpIncomeExpenseCycle 查询条件
|
||||
* @param erpIncomeExpenseCycle page 分页对象
|
||||
*/
|
||||
@Override
|
||||
public Page<ErpIncomeExpenseCycle> findPage(ErpIncomeExpenseCycle erpIncomeExpenseCycle) {
|
||||
return super.findPage(erpIncomeExpenseCycle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表数据
|
||||
* @param erpIncomeExpenseCycle 查询条件
|
||||
*/
|
||||
@Override
|
||||
public List<ErpIncomeExpenseCycle> findList(ErpIncomeExpenseCycle erpIncomeExpenseCycle) {
|
||||
return super.findList(erpIncomeExpenseCycle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存数据(插入或更新)
|
||||
* @param erpIncomeExpenseCycle 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void save(ErpIncomeExpenseCycle erpIncomeExpenseCycle) {
|
||||
super.save(erpIncomeExpenseCycle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入数据
|
||||
* @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<ErpIncomeExpenseCycle> list = ei.getDataList(ErpIncomeExpenseCycle.class);
|
||||
for (ErpIncomeExpenseCycle erpIncomeExpenseCycle : list) {
|
||||
try{
|
||||
ValidatorUtils.validateWithException(erpIncomeExpenseCycle);
|
||||
this.save(erpIncomeExpenseCycle);
|
||||
successNum++;
|
||||
successMsg.append("<br/>" + successNum + "、编号 " + erpIncomeExpenseCycle.getId() + " 导入成功");
|
||||
} catch (Exception e) {
|
||||
failureNum++;
|
||||
String msg = "<br/>" + failureNum + "、编号 " + erpIncomeExpenseCycle.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 erpIncomeExpenseCycle 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void updateStatus(ErpIncomeExpenseCycle erpIncomeExpenseCycle) {
|
||||
super.updateStatus(erpIncomeExpenseCycle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
* @param erpIncomeExpenseCycle 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void delete(ErpIncomeExpenseCycle erpIncomeExpenseCycle) {
|
||||
erpIncomeExpenseCycle.sqlMap().markIdDelete(); // 逻辑删除时标记ID值
|
||||
super.delete(erpIncomeExpenseCycle);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,144 @@
|
||||
package com.jeesite.modules.erp.web;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
||||
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.ErpAccountCycle;
|
||||
import com.jeesite.modules.erp.service.ErpAccountCycleService;
|
||||
|
||||
/**
|
||||
* VIEWController
|
||||
*
|
||||
* @author gaoxq
|
||||
* @version 2026-02-17
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping(value = "${adminPath}/erp/accountCycle")
|
||||
public class ErpAccountCycleController extends BaseController {
|
||||
|
||||
private final ErpAccountCycleService erpAccountCycleService;
|
||||
|
||||
public ErpAccountCycleController(ErpAccountCycleService erpAccountCycleService) {
|
||||
this.erpAccountCycleService = erpAccountCycleService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取数据
|
||||
*/
|
||||
@ModelAttribute
|
||||
public ErpAccountCycle get(String accountId, String transactionType, String yearDate, boolean isNewRecord) {
|
||||
ErpAccountCycle erpAccountCycle = new ErpAccountCycle();
|
||||
erpAccountCycle.setAccountId(accountId);
|
||||
erpAccountCycle.setTransactionType(transactionType);
|
||||
erpAccountCycle.setYearDate(yearDate);
|
||||
erpAccountCycle.setIsNewRecord(isNewRecord);
|
||||
return erpAccountCycleService.getAndValid(erpAccountCycle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表
|
||||
*/
|
||||
@RequestMapping(value = {"list", ""})
|
||||
public String list(ErpAccountCycle erpAccountCycle, Model model) {
|
||||
model.addAttribute("erpAccountCycle", erpAccountCycle);
|
||||
return "modules/erp/erpAccountCycleList";
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表数据
|
||||
*/
|
||||
@RequestMapping(value = "listData")
|
||||
@ResponseBody
|
||||
public Page<ErpAccountCycle> listData(ErpAccountCycle erpAccountCycle, HttpServletRequest request, HttpServletResponse response) {
|
||||
erpAccountCycle.setPage(new Page<>(request, response));
|
||||
Page<ErpAccountCycle> page = erpAccountCycleService.findPage(erpAccountCycle);
|
||||
return page;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看编辑表单
|
||||
*/
|
||||
@RequestMapping(value = "form")
|
||||
public String form(ErpAccountCycle erpAccountCycle, Model model) {
|
||||
model.addAttribute("erpAccountCycle", erpAccountCycle);
|
||||
return "modules/erp/erpAccountCycleForm";
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存数据
|
||||
*/
|
||||
@PostMapping(value = "save")
|
||||
@ResponseBody
|
||||
public String save(@Validated ErpAccountCycle erpAccountCycle) {
|
||||
erpAccountCycleService.save(erpAccountCycle);
|
||||
return renderResult(Global.TRUE, text("保存账户明细成功!"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出数据
|
||||
*/
|
||||
@RequestMapping(value = "exportData")
|
||||
public void exportData(ErpAccountCycle erpAccountCycle, HttpServletResponse response) {
|
||||
List<ErpAccountCycle> list = erpAccountCycleService.findList(erpAccountCycle);
|
||||
String fileName = "账户明细" + DateUtils.getDate("yyyyMMddHHmmss") + ".xlsx";
|
||||
try (ExcelExport ee = new ExcelExport("账户明细", ErpAccountCycle.class)) {
|
||||
ee.setDataList(list).write(response, fileName);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载模板
|
||||
*/
|
||||
@RequestMapping(value = "importTemplate")
|
||||
public void importTemplate(HttpServletResponse response) {
|
||||
ErpAccountCycle erpAccountCycle = new ErpAccountCycle();
|
||||
List<ErpAccountCycle> list = ListUtils.newArrayList(erpAccountCycle);
|
||||
String fileName = "账户明细模板.xlsx";
|
||||
try (ExcelExport ee = new ExcelExport("账户明细", ErpAccountCycle.class, Type.IMPORT)) {
|
||||
ee.setDataList(list).write(response, fileName);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入数据
|
||||
*/
|
||||
@ResponseBody
|
||||
@PostMapping(value = "importData")
|
||||
public String importData(MultipartFile file) {
|
||||
try {
|
||||
String message = erpAccountCycleService.importData(file);
|
||||
return renderResult(Global.TRUE, "posfull:" + message);
|
||||
} catch (Exception ex) {
|
||||
return renderResult(Global.FALSE, "posfull:" + ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
*/
|
||||
@RequestMapping(value = "delete")
|
||||
@ResponseBody
|
||||
public String delete(ErpAccountCycle erpAccountCycle) {
|
||||
erpAccountCycleService.delete(erpAccountCycle);
|
||||
return renderResult(Global.TRUE, text("删除账户明细成功!"));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
package com.jeesite.modules.erp.web;
|
||||
|
||||
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.entity.Page;
|
||||
import com.jeesite.common.web.BaseController;
|
||||
import com.jeesite.modules.erp.entity.ErpAccountIncomeExpense;
|
||||
import com.jeesite.modules.erp.service.ErpAccountIncomeExpenseService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 账户收支Controller
|
||||
*
|
||||
* @author gaoxq
|
||||
* @version 2026-02-17
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping(value = "${adminPath}/erp/accountIncomeExpense")
|
||||
public class ErpAccountIncomeExpenseController extends BaseController {
|
||||
|
||||
private final ErpAccountIncomeExpenseService erpAccountIncomeExpenseService;
|
||||
|
||||
public ErpAccountIncomeExpenseController(ErpAccountIncomeExpenseService erpAccountIncomeExpenseService) {
|
||||
this.erpAccountIncomeExpenseService = erpAccountIncomeExpenseService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取数据
|
||||
*/
|
||||
@ModelAttribute
|
||||
public ErpAccountIncomeExpense get(String accountId, String yearDate, boolean isNewRecord) {
|
||||
ErpAccountIncomeExpense erpAccountIncomeExpense = new ErpAccountIncomeExpense();
|
||||
erpAccountIncomeExpense.setAccountId(accountId);
|
||||
erpAccountIncomeExpense.setYearDate(yearDate);
|
||||
erpAccountIncomeExpense.setIsNewRecord(isNewRecord);
|
||||
return erpAccountIncomeExpenseService.getAndValid(erpAccountIncomeExpense);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表
|
||||
*/
|
||||
@RequestMapping(value = {"list", ""})
|
||||
public String list(ErpAccountIncomeExpense erpAccountIncomeExpense, Model model) {
|
||||
model.addAttribute("erpAccountIncomeExpense", erpAccountIncomeExpense);
|
||||
return "modules/erp/erpAccountIncomeExpenseList";
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表数据
|
||||
*/
|
||||
@RequestMapping(value = "listData")
|
||||
@ResponseBody
|
||||
public Page<ErpAccountIncomeExpense> listData(ErpAccountIncomeExpense erpAccountIncomeExpense, HttpServletRequest request, HttpServletResponse response) {
|
||||
erpAccountIncomeExpense.setPage(new Page<>(request, response));
|
||||
Page<ErpAccountIncomeExpense> page = erpAccountIncomeExpenseService.findPage(erpAccountIncomeExpense);
|
||||
return page;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看编辑表单
|
||||
*/
|
||||
@RequestMapping(value = "form")
|
||||
public String form(ErpAccountIncomeExpense erpAccountIncomeExpense, Model model) {
|
||||
model.addAttribute("erpAccountIncomeExpense", erpAccountIncomeExpense);
|
||||
return "modules/erp/erpAccountIncomeExpenseForm";
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存数据
|
||||
*/
|
||||
@PostMapping(value = "save")
|
||||
@ResponseBody
|
||||
public String save(@Validated ErpAccountIncomeExpense erpAccountIncomeExpense) {
|
||||
erpAccountIncomeExpenseService.save(erpAccountIncomeExpense);
|
||||
return renderResult(Global.TRUE, text("保存账户收支成功!"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
*/
|
||||
@RequestMapping(value = "delete")
|
||||
@ResponseBody
|
||||
public String delete(ErpAccountIncomeExpense erpAccountIncomeExpense) {
|
||||
erpAccountIncomeExpenseService.delete(erpAccountIncomeExpense);
|
||||
return renderResult(Global.TRUE, text("删除账户收支成功!"));
|
||||
}
|
||||
|
||||
@RequestMapping(value = "listAll")
|
||||
@ResponseBody
|
||||
public List<ErpAccountIncomeExpense> listAll(ErpAccountIncomeExpense erpAccountIncomeExpense) {
|
||||
return erpAccountIncomeExpenseService.findList(erpAccountIncomeExpense);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
package com.jeesite.modules.erp.web;
|
||||
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
||||
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.entity.Page;
|
||||
import com.jeesite.common.web.BaseController;
|
||||
import com.jeesite.modules.erp.entity.ErpCategoryIncomeExpense;
|
||||
import com.jeesite.modules.erp.service.ErpCategoryIncomeExpenseService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 类别收支Controller
|
||||
*
|
||||
* @author gaoxq
|
||||
* @version 2026-02-17
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping(value = "${adminPath}/erp/categoryIncomeExpense")
|
||||
public class ErpCategoryIncomeExpenseController extends BaseController {
|
||||
|
||||
private final ErpCategoryIncomeExpenseService erpCategoryIncomeExpenseService;
|
||||
|
||||
public ErpCategoryIncomeExpenseController(ErpCategoryIncomeExpenseService erpCategoryIncomeExpenseService) {
|
||||
this.erpCategoryIncomeExpenseService = erpCategoryIncomeExpenseService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取数据
|
||||
*/
|
||||
@ModelAttribute
|
||||
public ErpCategoryIncomeExpense get(String categoryId, String yearDate, boolean isNewRecord) {
|
||||
ErpCategoryIncomeExpense erpCategoryIncomeExpense = new ErpCategoryIncomeExpense();
|
||||
erpCategoryIncomeExpense.setCategoryId(categoryId);
|
||||
erpCategoryIncomeExpense.setYearDate(yearDate);
|
||||
erpCategoryIncomeExpense.setIsNewRecord(isNewRecord);
|
||||
return erpCategoryIncomeExpenseService.getAndValid(erpCategoryIncomeExpense);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表
|
||||
*/
|
||||
@RequestMapping(value = {"list", ""})
|
||||
public String list(ErpCategoryIncomeExpense erpCategoryIncomeExpense, Model model) {
|
||||
model.addAttribute("erpCategoryIncomeExpense", erpCategoryIncomeExpense);
|
||||
return "modules/erp/erpCategoryIncomeExpenseList";
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表数据
|
||||
*/
|
||||
@RequestMapping(value = "listData")
|
||||
@ResponseBody
|
||||
public Page<ErpCategoryIncomeExpense> listData(ErpCategoryIncomeExpense erpCategoryIncomeExpense, HttpServletRequest request, HttpServletResponse response) {
|
||||
erpCategoryIncomeExpense.setPage(new Page<>(request, response));
|
||||
Page<ErpCategoryIncomeExpense> page = erpCategoryIncomeExpenseService.findPage(erpCategoryIncomeExpense);
|
||||
return page;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看编辑表单
|
||||
*/
|
||||
@RequestMapping(value = "form")
|
||||
public String form(ErpCategoryIncomeExpense erpCategoryIncomeExpense, Model model) {
|
||||
model.addAttribute("erpCategoryIncomeExpense", erpCategoryIncomeExpense);
|
||||
return "modules/erp/erpCategoryIncomeExpenseForm";
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存数据
|
||||
*/
|
||||
@PostMapping(value = "save")
|
||||
@ResponseBody
|
||||
public String save(@Validated ErpCategoryIncomeExpense erpCategoryIncomeExpense) {
|
||||
erpCategoryIncomeExpenseService.save(erpCategoryIncomeExpense);
|
||||
return renderResult(Global.TRUE, text("保存类别收支成功!"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
*/
|
||||
@RequestMapping(value = "delete")
|
||||
@ResponseBody
|
||||
public String delete(ErpCategoryIncomeExpense erpCategoryIncomeExpense) {
|
||||
erpCategoryIncomeExpenseService.delete(erpCategoryIncomeExpense);
|
||||
return renderResult(Global.TRUE, text("删除类别收支成功!"));
|
||||
}
|
||||
|
||||
@RequestMapping(value = "listAll")
|
||||
@ResponseBody
|
||||
public List<ErpCategoryIncomeExpense> listAll(ErpCategoryIncomeExpense erpCategoryIncomeExpense) {
|
||||
return erpCategoryIncomeExpenseService.findList(erpCategoryIncomeExpense);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,151 @@
|
||||
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.ErpIncomeExpenseCycle;
|
||||
import com.jeesite.modules.erp.service.ErpIncomeExpenseCycleService;
|
||||
|
||||
/**
|
||||
* 年度收支信息Controller
|
||||
*
|
||||
* @author gaoxq
|
||||
* @version 2026-02-17
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping(value = "${adminPath}/erp/incomeExpenseCycle")
|
||||
public class ErpIncomeExpenseCycleController extends BaseController {
|
||||
|
||||
private final ErpIncomeExpenseCycleService erpIncomeExpenseCycleService;
|
||||
|
||||
public ErpIncomeExpenseCycleController(ErpIncomeExpenseCycleService erpIncomeExpenseCycleService) {
|
||||
this.erpIncomeExpenseCycleService = erpIncomeExpenseCycleService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取数据
|
||||
*/
|
||||
@ModelAttribute
|
||||
public ErpIncomeExpenseCycle get(String yearDate, String monthDate, boolean isNewRecord) {
|
||||
ErpIncomeExpenseCycle erpIncomeExpenseCycle = new ErpIncomeExpenseCycle();
|
||||
erpIncomeExpenseCycle.setYearDate(yearDate);
|
||||
erpIncomeExpenseCycle.setMonthDate(monthDate);
|
||||
erpIncomeExpenseCycle.setIsNewRecord(isNewRecord);
|
||||
return erpIncomeExpenseCycleService.getAndValid(erpIncomeExpenseCycle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表
|
||||
*/
|
||||
@RequestMapping(value = {"list", ""})
|
||||
public String list(ErpIncomeExpenseCycle erpIncomeExpenseCycle, Model model) {
|
||||
model.addAttribute("erpIncomeExpenseCycle", erpIncomeExpenseCycle);
|
||||
return "modules/erp/erpIncomeExpenseCycleList";
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表数据
|
||||
*/
|
||||
@RequestMapping(value = "listData")
|
||||
@ResponseBody
|
||||
public Page<ErpIncomeExpenseCycle> listData(ErpIncomeExpenseCycle erpIncomeExpenseCycle, HttpServletRequest request, HttpServletResponse response) {
|
||||
erpIncomeExpenseCycle.setPage(new Page<>(request, response));
|
||||
Page<ErpIncomeExpenseCycle> page = erpIncomeExpenseCycleService.findPage(erpIncomeExpenseCycle);
|
||||
return page;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看编辑表单
|
||||
*/
|
||||
@RequestMapping(value = "form")
|
||||
public String form(ErpIncomeExpenseCycle erpIncomeExpenseCycle, Model model) {
|
||||
model.addAttribute("erpIncomeExpenseCycle", erpIncomeExpenseCycle);
|
||||
return "modules/erp/erpIncomeExpenseCycleForm";
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存数据
|
||||
*/
|
||||
@PostMapping(value = "save")
|
||||
@ResponseBody
|
||||
public String save(@Validated ErpIncomeExpenseCycle erpIncomeExpenseCycle) {
|
||||
erpIncomeExpenseCycleService.save(erpIncomeExpenseCycle);
|
||||
return renderResult(Global.TRUE, text("保存年度收支信息成功!"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出数据
|
||||
*/
|
||||
@RequestMapping(value = "exportData")
|
||||
public void exportData(ErpIncomeExpenseCycle erpIncomeExpenseCycle, HttpServletResponse response) {
|
||||
List<ErpIncomeExpenseCycle> list = erpIncomeExpenseCycleService.findList(erpIncomeExpenseCycle);
|
||||
String fileName = "年度收支信息" + DateUtils.getDate("yyyyMMddHHmmss") + ".xlsx";
|
||||
try (ExcelExport ee = new ExcelExport("年度收支信息", ErpIncomeExpenseCycle.class)) {
|
||||
ee.setDataList(list).write(response, fileName);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载模板
|
||||
*/
|
||||
@RequestMapping(value = "importTemplate")
|
||||
public void importTemplate(HttpServletResponse response) {
|
||||
ErpIncomeExpenseCycle erpIncomeExpenseCycle = new ErpIncomeExpenseCycle();
|
||||
List<ErpIncomeExpenseCycle> list = ListUtils.newArrayList(erpIncomeExpenseCycle);
|
||||
String fileName = "年度收支信息模板.xlsx";
|
||||
try (ExcelExport ee = new ExcelExport("年度收支信息", ErpIncomeExpenseCycle.class, Type.IMPORT)) {
|
||||
ee.setDataList(list).write(response, fileName);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入数据
|
||||
*/
|
||||
@ResponseBody
|
||||
@PostMapping(value = "importData")
|
||||
public String importData(MultipartFile file) {
|
||||
try {
|
||||
String message = erpIncomeExpenseCycleService.importData(file);
|
||||
return renderResult(Global.TRUE, "posfull:" + message);
|
||||
} catch (Exception ex) {
|
||||
return renderResult(Global.FALSE, "posfull:" + ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
*/
|
||||
@RequestMapping(value = "delete")
|
||||
@ResponseBody
|
||||
public String delete(ErpIncomeExpenseCycle erpIncomeExpenseCycle) {
|
||||
erpIncomeExpenseCycleService.delete(erpIncomeExpenseCycle);
|
||||
return renderResult(Global.TRUE, text("删除年度收支信息成功!"));
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = "listAll")
|
||||
@ResponseBody
|
||||
public List<ErpIncomeExpenseCycle> listAll(ErpIncomeExpenseCycle erpIncomeExpenseCycle) {
|
||||
return erpIncomeExpenseCycleService.findList(erpIncomeExpenseCycle);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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.ErpAccountCycleDao">
|
||||
|
||||
<!-- 查询数据
|
||||
<select id="findList" resultType="ErpAccountCycle">
|
||||
SELECT ${sqlMap.column.toSql()}
|
||||
FROM ${sqlMap.table.toSql()}
|
||||
<where>
|
||||
${sqlMap.where.toSql()}
|
||||
</where>
|
||||
ORDER BY ${sqlMap.order.toSql()}
|
||||
</select> -->
|
||||
|
||||
</mapper>
|
||||
@@ -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.ErpAccountIncomeExpenseDao">
|
||||
|
||||
<!-- 查询数据
|
||||
<select id="findList" resultType="ErpAccountIncomeExpense">
|
||||
SELECT ${sqlMap.column.toSql()}
|
||||
FROM ${sqlMap.table.toSql()}
|
||||
<where>
|
||||
${sqlMap.where.toSql()}
|
||||
</where>
|
||||
ORDER BY ${sqlMap.order.toSql()}
|
||||
</select> -->
|
||||
|
||||
</mapper>
|
||||
@@ -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.ErpCategoryIncomeExpenseDao">
|
||||
|
||||
<!-- 查询数据
|
||||
<select id="findList" resultType="ErpCategoryIncomeExpense">
|
||||
SELECT ${sqlMap.column.toSql()}
|
||||
FROM ${sqlMap.table.toSql()}
|
||||
<where>
|
||||
${sqlMap.where.toSql()}
|
||||
</where>
|
||||
ORDER BY ${sqlMap.order.toSql()}
|
||||
</select> -->
|
||||
|
||||
</mapper>
|
||||
@@ -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.ErpIncomeExpenseCycleDao">
|
||||
|
||||
<!-- 查询数据
|
||||
<select id="findList" resultType="ErpIncomeExpenseCycle">
|
||||
SELECT ${sqlMap.column.toSql()}
|
||||
FROM ${sqlMap.table.toSql()}
|
||||
<where>
|
||||
${sqlMap.where.toSql()}
|
||||
</where>
|
||||
ORDER BY ${sqlMap.order.toSql()}
|
||||
</select> -->
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user