diff --git a/ruoyi-modules/ruoyi-oa/src/main/java/org/dromara/oa/erp/controller/ProjectLedgerReportController.java b/ruoyi-modules/ruoyi-oa/src/main/java/org/dromara/oa/erp/controller/ProjectLedgerReportController.java new file mode 100644 index 00000000..44a67cce --- /dev/null +++ b/ruoyi-modules/ruoyi-oa/src/main/java/org/dromara/oa/erp/controller/ProjectLedgerReportController.java @@ -0,0 +1,66 @@ +package org.dromara.oa.erp.controller; + +import cn.dev33.satoken.annotation.SaCheckPermission; +import cn.idev.excel.FastExcel; +import jakarta.servlet.http.HttpServletResponse; +import lombok.RequiredArgsConstructor; +import org.dromara.common.log.annotation.Log; +import org.dromara.common.log.enums.BusinessType; +import org.dromara.common.mybatis.core.page.TableDataInfo; +import org.dromara.oa.erp.domain.vo.ProjectLedgerReportVo; +import org.dromara.oa.erp.service.IProjectLedgerReportService; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.net.URLEncoder; +import java.util.List; + +/** + * 项目台账报表 + * + * @author Yangk + * @date 2026-03-11 + */ +@Validated +@RequiredArgsConstructor +@RestController +@RequestMapping("/erp/projectLedgerReport") +public class ProjectLedgerReportController { + + private final IProjectLedgerReportService reportService; + + /** + * 获取项目台账报表列表 + */ + @SaCheckPermission("oa:erp:projectLedgerReport:list") + @GetMapping("/list") + public TableDataInfo list(ProjectLedgerReportVo bo) { + return reportService.queryProjectLedgerList(bo); + } + + /** + * 导出项目台账报表 + */ + @SaCheckPermission("oa:erp:projectLedgerReport:export") + @Log(title = "项目台账报表", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(ProjectLedgerReportVo bo, HttpServletResponse response) { + try { + List list = reportService.queryProjectLedgerAll(bo); + + response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); + response.setCharacterEncoding("utf-8"); + String fileName = URLEncoder.encode("项目台账报表", "UTF-8").replaceAll("\\+", "%20"); + response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx"); + + FastExcel.write(response.getOutputStream(), ProjectLedgerReportVo.class) + .sheet("项目台账报表") + .doWrite(list); + } catch (Exception e) { + throw new RuntimeException("导出失败", e); + } + } +} diff --git a/ruoyi-modules/ruoyi-oa/src/main/java/org/dromara/oa/erp/domain/vo/ProjectLedgerReportVo.java b/ruoyi-modules/ruoyi-oa/src/main/java/org/dromara/oa/erp/domain/vo/ProjectLedgerReportVo.java new file mode 100644 index 00000000..a49c43f2 --- /dev/null +++ b/ruoyi-modules/ruoyi-oa/src/main/java/org/dromara/oa/erp/domain/vo/ProjectLedgerReportVo.java @@ -0,0 +1,121 @@ +package org.dromara.oa.erp.domain.vo; + +import cn.idev.excel.annotation.ExcelIgnoreUnannotated; +import cn.idev.excel.annotation.ExcelProperty; +import cn.idev.excel.annotation.write.style.ColumnWidth; +import lombok.Data; + +import java.io.Serial; +import java.io.Serializable; +import java.math.BigDecimal; + +/** + * 项目台账报表 VO + * + * @author Yangk + * @date 2026-03-11 + */ +@Data +@ColumnWidth(18) +@ExcelIgnoreUnannotated +public class ProjectLedgerReportVo implements Serializable { + + @Serial + private static final long serialVersionUID = 1L; + + /** 项目ID */ + private Long projectId; + + /** 合同ID */ + private Long contractId; + + /** 项目编号 */ + @ExcelProperty(value = "项目编号") + private String projectCode; + + /** 客户名称 */ + @ExcelProperty(value = "客户名称") + private String customerName; + + /** 项目名称 */ + @ExcelProperty(value = "项目名称") + @ColumnWidth(25) + private String projectName; + + /** 项目经理 */ + @ExcelProperty(value = "项目经理") + private String managerName; + + /** 部门 */ + @ExcelProperty(value = "部门") + private String deptName; + + /** 项目类型 */ + @ExcelProperty(value = "项目类型") + private String typeName; + + /** 产品数量 */ + @ExcelProperty(value = "产品数量") + private BigDecimal productAmount; + + /** 项目阶段 */ + private String projectPhases; + + /** 项目类别 */ + private String projectCategory; + + /** 项目状态 */ + @ExcelProperty(value = "状态", converter = org.dromara.common.excel.convert.ExcelDictConvert.class) + @org.dromara.common.excel.annotation.ExcelDictFormat(dictType = "project_status") + private String projectStatus; + + /** 实际验收时间 */ + @ExcelProperty(value = "实际验收时间") + private String acceptanceDate; + + /** 签订时间 */ + @ExcelProperty(value = "签订时间") + private String contractDate; + + /** 合同额 */ + @ExcelProperty(value = "合同额") + private BigDecimal contractAmount; + + /** 客户经理 */ + @ExcelProperty(value = "客户经理") + private String contractManagerName; + + /** 付款方式 */ + @ExcelProperty(value = "付款方式") + private String paymentMethod; + + /** 预算 */ + @ExcelProperty(value = "预算") + private BigDecimal budgetCost; + + /** 预算毛利率 */ + @ExcelProperty(value = "预算毛利率") + private BigDecimal budgetRate; + + /** 降成本后预算 */ + @ExcelProperty(value = "降成本后预算") + private BigDecimal reduceBudgetCost; + + /** 降成本后预算毛利率 */ + @ExcelProperty(value = "降成本后预算毛利率") + private BigDecimal reduceBudgetRate; + + /** 收入(合同额/1.13) */ + @ExcelProperty(value = "收入") + private BigDecimal revenue; + + /** 累计工时 */ + @ExcelProperty(value = "累计工时") + private BigDecimal totalHours; + + /** 业务方向(查询条件用) */ + private String businessDirection; + + /** 请求参数 */ + private java.util.Map params; +} diff --git a/ruoyi-modules/ruoyi-oa/src/main/java/org/dromara/oa/erp/mapper/ProjectLedgerReportMapper.java b/ruoyi-modules/ruoyi-oa/src/main/java/org/dromara/oa/erp/mapper/ProjectLedgerReportMapper.java new file mode 100644 index 00000000..fa2e521a --- /dev/null +++ b/ruoyi-modules/ruoyi-oa/src/main/java/org/dromara/oa/erp/mapper/ProjectLedgerReportMapper.java @@ -0,0 +1,25 @@ +package org.dromara.oa.erp.mapper; + +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; +import org.dromara.oa.erp.domain.vo.ProjectLedgerReportVo; + +import java.util.List; + +/** + * 项目台账报表 Mapper + * + * @author Yangk + * @date 2026-03-11 + */ +@Mapper +public interface ProjectLedgerReportMapper { + + /** + * 查询项目台账报表列表 + * + * @param bo 查询条件 + * @return 列表 + */ + List selectProjectLedgerList(@Param("bo") ProjectLedgerReportVo bo); +} diff --git a/ruoyi-modules/ruoyi-oa/src/main/java/org/dromara/oa/erp/service/IProjectLedgerReportService.java b/ruoyi-modules/ruoyi-oa/src/main/java/org/dromara/oa/erp/service/IProjectLedgerReportService.java new file mode 100644 index 00000000..df2394a3 --- /dev/null +++ b/ruoyi-modules/ruoyi-oa/src/main/java/org/dromara/oa/erp/service/IProjectLedgerReportService.java @@ -0,0 +1,25 @@ +package org.dromara.oa.erp.service; + +import org.dromara.common.mybatis.core.page.TableDataInfo; +import org.dromara.oa.erp.domain.vo.ProjectLedgerReportVo; + +import java.util.List; + +/** + * 项目台账报表 Service 接口 + * + * @author Yangk + * @date 2026-03-11 + */ +public interface IProjectLedgerReportService { + + /** + * 查询项目台账报表列表(分页) + */ + TableDataInfo queryProjectLedgerList(ProjectLedgerReportVo bo); + + /** + * 查询项目台账报表全量(导出用) + */ + List queryProjectLedgerAll(ProjectLedgerReportVo bo); +} diff --git a/ruoyi-modules/ruoyi-oa/src/main/java/org/dromara/oa/erp/service/impl/ProjectLedgerReportServiceImpl.java b/ruoyi-modules/ruoyi-oa/src/main/java/org/dromara/oa/erp/service/impl/ProjectLedgerReportServiceImpl.java new file mode 100644 index 00000000..c3657613 --- /dev/null +++ b/ruoyi-modules/ruoyi-oa/src/main/java/org/dromara/oa/erp/service/impl/ProjectLedgerReportServiceImpl.java @@ -0,0 +1,34 @@ +package org.dromara.oa.erp.service.impl; + +import lombok.RequiredArgsConstructor; +import org.dromara.common.mybatis.core.page.TableDataInfo; +import org.dromara.oa.erp.domain.vo.ProjectLedgerReportVo; +import org.dromara.oa.erp.mapper.ProjectLedgerReportMapper; +import org.dromara.oa.erp.service.IProjectLedgerReportService; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 项目台账报表 Service 实现 + * + * @author Yangk + * @date 2026-03-11 + */ +@RequiredArgsConstructor +@Service +public class ProjectLedgerReportServiceImpl implements IProjectLedgerReportService { + + private final ProjectLedgerReportMapper reportMapper; + + @Override + public TableDataInfo queryProjectLedgerList(ProjectLedgerReportVo bo) { + List list = reportMapper.selectProjectLedgerList(bo); + return TableDataInfo.build(list); + } + + @Override + public List queryProjectLedgerAll(ProjectLedgerReportVo bo) { + return reportMapper.selectProjectLedgerList(bo); + } +} diff --git a/ruoyi-modules/ruoyi-oa/src/main/resources/mapper/oa/erp/ProjectLedgerReportMapper.xml b/ruoyi-modules/ruoyi-oa/src/main/resources/mapper/oa/erp/ProjectLedgerReportMapper.xml new file mode 100644 index 00000000..87351078 --- /dev/null +++ b/ruoyi-modules/ruoyi-oa/src/main/resources/mapper/oa/erp/ProjectLedgerReportMapper.xml @@ -0,0 +1,95 @@ + + + + + + +