财务门户设计
This commit is contained in:
@@ -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.BizItemInfo;
|
||||
|
||||
/**
|
||||
* 指标信息DAO接口
|
||||
* @author gaoxq
|
||||
* @version 2026-02-17
|
||||
*/
|
||||
@MyBatisDao(dataSourceName="work")
|
||||
public interface BizItemInfoDao extends CrudDao<BizItemInfo> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,130 @@
|
||||
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 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-02-17
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Table(name = "biz_item_info", alias = "a", label = "指标信息信息", columns = {
|
||||
@Column(name = "create_time", attrName = "createTime", label = "创建时间", isUpdate = false, isQuery = false, isUpdateForce = true),
|
||||
@Column(name = "id", attrName = "id", label = "主键ID", isPK = true),
|
||||
@Column(name = "item_name", attrName = "itemName", label = "项目名称", queryType = QueryType.LIKE),
|
||||
@Column(name = "item_code", attrName = "itemCode", label = "项目编号"),
|
||||
@Column(name = "title", attrName = "title", label = "备注描述", queryType = QueryType.LIKE),
|
||||
@Column(name = "seq", attrName = "seq", label = "序号", isQuery = false, isUpdateForce = true),
|
||||
@Column(name = "ym", attrName = "ym", label = "请求日期"),
|
||||
@Column(name = "cycle", attrName = "cycle", label = "指标周期"),
|
||||
@Column(name = "req_param", attrName = "reqParam", label = "请求参数"),
|
||||
@Column(name = "x_axis", attrName = "xAxis", label = "x轴名称"),
|
||||
@Column(name = "index_01", attrName = "index01", label = "指标01", isQuery = false),
|
||||
@Column(name = "index_02", attrName = "index02", label = "指标02", isQuery = false),
|
||||
@Column(name = "index_03", attrName = "index03", label = "指标03", isQuery = false),
|
||||
@Column(name = "index_04", attrName = "index04", label = "指标04", isQuery = false),
|
||||
@Column(name = "index_05", attrName = "index05", label = "指标05", isQuery = false),
|
||||
@Column(name = "index_06", attrName = "index06", label = "指标06", isQuery = false),
|
||||
@Column(name = "index_07", attrName = "index07", label = "指标07", isQuery = false),
|
||||
@Column(name = "index_08", attrName = "index08", label = "指标08", isQuery = false),
|
||||
@Column(name = "index_09", attrName = "index09", label = "指标09", isQuery = false),
|
||||
@Column(name = "index_10", attrName = "index10", label = "指标10", isQuery = false),
|
||||
@Column(name = "index_11", attrName = "index11", label = "指标11", isQuery = false),
|
||||
@Column(name = "index_12", attrName = "index12", label = "指标12", isQuery = false),
|
||||
@Column(name = "index_13", attrName = "index13", label = "指标13", isQuery = false),
|
||||
@Column(name = "index_14", attrName = "index14", label = "指标14", isQuery = false),
|
||||
@Column(name = "index_15", attrName = "index15", label = "指标15", isQuery = false),
|
||||
@Column(name = "update_time", attrName = "updateTime", label = "更新时间", isQuery = false, isUpdateForce = true),
|
||||
@Column(name = "is_deleted", attrName = "isDeleted", label = "删除标识", comment = "删除标识(1-未删,0-已删)", isQuery = false),
|
||||
}, orderBy = "a.item_code , seq"
|
||||
)
|
||||
@Data
|
||||
public class BizItemInfo extends DataEntity<BizItemInfo> implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
private Date createTime; // 创建时间
|
||||
private String itemName; // 项目名称
|
||||
private String itemCode; // 项目编号
|
||||
private String title; // 备注描述
|
||||
private Long seq; // 序号
|
||||
private String ym; // 请求日期
|
||||
private String cycle; // 指标周期
|
||||
private String reqParam; // 请求参数
|
||||
private String xAxis; // x轴名称
|
||||
private String index01; // 指标01
|
||||
private String index02; // 指标02
|
||||
private String index03; // 指标03
|
||||
private String index04; // 指标04
|
||||
private String index05; // 指标05
|
||||
private String index06; // 指标06
|
||||
private String index07; // 指标07
|
||||
private String index08; // 指标08
|
||||
private String index09; // 指标09
|
||||
private String index10; // 指标10
|
||||
private String index11; // 指标11
|
||||
private String index12; // 指标12
|
||||
private String index13; // 指标13
|
||||
private String index14; // 指标14
|
||||
private String index15; // 指标15
|
||||
private Date updateTime; // 更新时间
|
||||
private String isDeleted; // 删除标识(1-未删,0-已删)
|
||||
|
||||
@ExcelFields({
|
||||
@ExcelField(title = "创建时间", attrName = "createTime", align = Align.CENTER, sort = 10, dataFormat = "yyyy-MM-dd hh:mm"),
|
||||
@ExcelField(title = "主键ID", attrName = "id", align = Align.CENTER, sort = 20),
|
||||
@ExcelField(title = "项目名称", attrName = "itemName", align = Align.CENTER, sort = 30),
|
||||
@ExcelField(title = "项目编号", attrName = "itemCode", align = Align.CENTER, sort = 40),
|
||||
@ExcelField(title = "备注描述", attrName = "title", align = Align.CENTER, sort = 50),
|
||||
@ExcelField(title = "序号", attrName = "seq", align = Align.CENTER, sort = 60),
|
||||
@ExcelField(title = "请求日期", attrName = "ym", align = Align.CENTER, sort = 70),
|
||||
@ExcelField(title = "指标周期", attrName = "cycle", align = Align.CENTER, sort = 80),
|
||||
@ExcelField(title = "请求参数", attrName = "reqParam", align = Align.CENTER, sort = 90),
|
||||
@ExcelField(title = "x轴名称", attrName = "xAxis", align = Align.CENTER, sort = 100),
|
||||
@ExcelField(title = "指标01", attrName = "index01", align = Align.CENTER, sort = 110),
|
||||
@ExcelField(title = "指标02", attrName = "index02", align = Align.CENTER, sort = 120),
|
||||
@ExcelField(title = "指标03", attrName = "index03", align = Align.CENTER, sort = 130),
|
||||
@ExcelField(title = "指标04", attrName = "index04", align = Align.CENTER, sort = 140),
|
||||
@ExcelField(title = "指标05", attrName = "index05", align = Align.CENTER, sort = 150),
|
||||
@ExcelField(title = "指标06", attrName = "index06", align = Align.CENTER, sort = 160),
|
||||
@ExcelField(title = "指标07", attrName = "index07", align = Align.CENTER, sort = 170),
|
||||
@ExcelField(title = "指标08", attrName = "index08", align = Align.CENTER, sort = 180),
|
||||
@ExcelField(title = "指标09", attrName = "index09", align = Align.CENTER, sort = 190),
|
||||
@ExcelField(title = "指标10", attrName = "index10", align = Align.CENTER, sort = 200),
|
||||
@ExcelField(title = "指标11", attrName = "index11", align = Align.CENTER, sort = 210),
|
||||
@ExcelField(title = "指标12", attrName = "index12", align = Align.CENTER, sort = 220),
|
||||
@ExcelField(title = "指标13", attrName = "index13", align = Align.CENTER, sort = 230),
|
||||
@ExcelField(title = "指标14", attrName = "index14", align = Align.CENTER, sort = 240),
|
||||
@ExcelField(title = "指标15", attrName = "index15", align = Align.CENTER, sort = 250),
|
||||
@ExcelField(title = "更新时间", attrName = "updateTime", align = Align.CENTER, sort = 260, dataFormat = "yyyy-MM-dd hh:mm"),
|
||||
@ExcelField(title = "删除标识", attrName = "isDeleted", align = Align.CENTER, sort = 270),
|
||||
})
|
||||
public BizItemInfo() {
|
||||
this(null);
|
||||
}
|
||||
|
||||
public BizItemInfo(String id) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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.BizItemInfo;
|
||||
import com.jeesite.modules.biz.dao.BizItemInfoDao;
|
||||
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 BizItemInfoService extends CrudService<BizItemInfoDao, BizItemInfo> {
|
||||
|
||||
/**
|
||||
* 获取单条数据
|
||||
* @param bizItemInfo 主键
|
||||
*/
|
||||
@Override
|
||||
public BizItemInfo get(BizItemInfo bizItemInfo) {
|
||||
return super.get(bizItemInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询分页数据
|
||||
* @param bizItemInfo 查询条件
|
||||
* @param bizItemInfo page 分页对象
|
||||
*/
|
||||
@Override
|
||||
public Page<BizItemInfo> findPage(BizItemInfo bizItemInfo) {
|
||||
return super.findPage(bizItemInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表数据
|
||||
* @param bizItemInfo 查询条件
|
||||
*/
|
||||
@Override
|
||||
public List<BizItemInfo> findList(BizItemInfo bizItemInfo) {
|
||||
return super.findList(bizItemInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存数据(插入或更新)
|
||||
* @param bizItemInfo 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void save(BizItemInfo bizItemInfo) {
|
||||
super.save(bizItemInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入数据
|
||||
* @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<BizItemInfo> list = ei.getDataList(BizItemInfo.class);
|
||||
for (BizItemInfo bizItemInfo : list) {
|
||||
try{
|
||||
ValidatorUtils.validateWithException(bizItemInfo);
|
||||
this.save(bizItemInfo);
|
||||
successNum++;
|
||||
successMsg.append("<br/>" + successNum + "、编号 " + bizItemInfo.getId() + " 导入成功");
|
||||
} catch (Exception e) {
|
||||
failureNum++;
|
||||
String msg = "<br/>" + failureNum + "、编号 " + bizItemInfo.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 bizItemInfo 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void updateStatus(BizItemInfo bizItemInfo) {
|
||||
super.updateStatus(bizItemInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
* @param bizItemInfo 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void delete(BizItemInfo bizItemInfo) {
|
||||
super.delete(bizItemInfo);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,147 @@
|
||||
package com.jeesite.modules.biz.web;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.jeesite.modules.app.utils.vDate;
|
||||
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.BizItemInfo;
|
||||
import com.jeesite.modules.biz.service.BizItemInfoService;
|
||||
|
||||
/**
|
||||
* 指标信息Controller
|
||||
* @author gaoxq
|
||||
* @version 2026-02-17
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping(value = "${adminPath}/biz/itemInfo")
|
||||
public class BizItemInfoController extends BaseController {
|
||||
|
||||
private final BizItemInfoService bizItemInfoService;
|
||||
|
||||
public BizItemInfoController(BizItemInfoService bizItemInfoService) {
|
||||
this.bizItemInfoService = bizItemInfoService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取数据
|
||||
*/
|
||||
@ModelAttribute
|
||||
public BizItemInfo get(String id, boolean isNewRecord) {
|
||||
return bizItemInfoService.get(id, isNewRecord);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表
|
||||
*/
|
||||
@RequestMapping(value = {"list", ""})
|
||||
public String list(BizItemInfo bizItemInfo, Model model) {
|
||||
model.addAttribute("bizItemInfo", bizItemInfo);
|
||||
return "modules/biz/bizItemInfoList";
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表数据
|
||||
*/
|
||||
@RequestMapping(value = "listData")
|
||||
@ResponseBody
|
||||
public Page<BizItemInfo> listData(BizItemInfo bizItemInfo, HttpServletRequest request, HttpServletResponse response) {
|
||||
bizItemInfo.setPage(new Page<>(request, response));
|
||||
Page<BizItemInfo> page = bizItemInfoService.findPage(bizItemInfo);
|
||||
return page;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看编辑表单
|
||||
*/
|
||||
@RequestMapping(value = "form")
|
||||
public String form(BizItemInfo bizItemInfo, Model model) {
|
||||
model.addAttribute("bizItemInfo", bizItemInfo);
|
||||
return "modules/biz/bizItemInfoForm";
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存数据
|
||||
*/
|
||||
@PostMapping(value = "save")
|
||||
@ResponseBody
|
||||
public String save(@Validated BizItemInfo bizItemInfo) {
|
||||
bizItemInfoService.save(bizItemInfo);
|
||||
return renderResult(Global.TRUE, text("保存指标信息成功!"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出数据
|
||||
*/
|
||||
@RequestMapping(value = "exportData")
|
||||
public void exportData(BizItemInfo bizItemInfo, HttpServletResponse response) {
|
||||
List<BizItemInfo> list = bizItemInfoService.findList(bizItemInfo);
|
||||
String fileName = "指标信息" + DateUtils.getDate("yyyyMMddHHmmss") + ".xlsx";
|
||||
try(ExcelExport ee = new ExcelExport("指标信息", BizItemInfo.class)){
|
||||
ee.setDataList(list).write(response, fileName);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载模板
|
||||
*/
|
||||
@RequestMapping(value = "importTemplate")
|
||||
public void importTemplate(HttpServletResponse response) {
|
||||
BizItemInfo bizItemInfo = new BizItemInfo();
|
||||
List<BizItemInfo> list = ListUtils.newArrayList(bizItemInfo);
|
||||
String fileName = "指标信息模板.xlsx";
|
||||
try(ExcelExport ee = new ExcelExport("指标信息", BizItemInfo.class, Type.IMPORT)){
|
||||
ee.setDataList(list).write(response, fileName);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入数据
|
||||
*/
|
||||
@ResponseBody
|
||||
@PostMapping(value = "importData")
|
||||
public String importData(MultipartFile file) {
|
||||
try {
|
||||
String message = bizItemInfoService.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(BizItemInfo bizItemInfo) {
|
||||
bizItemInfoService.delete(bizItemInfo);
|
||||
return renderResult(Global.TRUE, text("删除指标信息成功!"));
|
||||
}
|
||||
|
||||
@RequestMapping(value = "listAll")
|
||||
@ResponseBody
|
||||
public List<BizItemInfo> listAll(BizItemInfo bizItemInfo){
|
||||
bizItemInfo.setYm(vDate.dsValue());
|
||||
return bizItemInfoService.findList(bizItemInfo);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user