feat(oa/erp): 新增合同台账报表功能

- 创建ContractLedgerReportController提供查询和导出接口
- 实现IContractLedgerReportService和ContractLedgerReportServiceImpl业务逻辑
- 定义ContractLedgerReportVo数据传输对象支持Excel导出格式
- 配置ContractLedgerReportMapper及XML映射文件实现数据库查询
- 集成ExcelUtil工具类支持报表导出功能
dev
Yangk 2 days ago
parent 7a30f3b174
commit 08c7e7f07f

@ -0,0 +1,50 @@
package org.dromara.oa.erp.controller;
import jakarta.servlet.http.HttpServletResponse;
import lombok.RequiredArgsConstructor;
import org.dromara.common.excel.utils.ExcelUtil;
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.common.web.core.BaseController;
import org.dromara.oa.erp.domain.vo.ContractLedgerReportVo;
import org.dromara.oa.erp.service.IContractLedgerReportService;
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.util.List;
/**
* Controller
*/
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/erp/contractLedgerReport")
public class ContractLedgerReportController extends BaseController {
private final IContractLedgerReportService reportService;
/**
*
*/
// @SaCheckPermission("oa:erp:contractLedgerReport:list")
@GetMapping("/list")
public TableDataInfo<ContractLedgerReportVo> list(ContractLedgerReportVo bo) {
return reportService.queryContractLedgerList(bo);
}
/**
*
*/
// @SaCheckPermission("oa:erp:contractLedgerReport:export")
@Log(title = "合同台账报表", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(ContractLedgerReportVo bo, HttpServletResponse response) {
List<ContractLedgerReportVo> list = reportService.queryContractLedgerAll(bo);
ExcelUtil.exportExcel(list, "合同台账报表", ContractLedgerReportVo.class, response);
}
}

@ -0,0 +1,119 @@
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;
import java.util.Map;
import java.util.List;
/**
* VO
*/
@Data
@ColumnWidth(18)
@ExcelIgnoreUnannotated
public class ContractLedgerReportVo implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
private Long contractId;
private List<Long> contractIdList;
@ExcelProperty({"月份", "月份"})
private String month;
/**
* ================== ==================
*/
@ExcelProperty({"合同信息", "海威SAP订单号"})
@ColumnWidth(20)
private String internalContractCode;
@ExcelProperty({"合同信息", "海威合同归档编号"})
@ColumnWidth(25)
private String externalContractCode;
@ExcelProperty({"合同信息", "客户合同编号"})
@ColumnWidth(20)
private String customerContractCode;
@ExcelProperty({"合同信息", "签订时间"})
private String contractDate;
@ExcelProperty({"合同信息", "软控SAP订单号"})
@ColumnWidth(20)
private String orderContractCode;
@ExcelProperty({"合同信息", "软控SAP项目号"})
@ColumnWidth(20)
private String projectContractCode;
@ExcelProperty({"合同信息", "客户名称"})
@ColumnWidth(25)
private String customerName;
@ExcelProperty({"合同信息", "产品名称"})
@ColumnWidth(25)
private String productName;
@ExcelProperty({"合同信息", "软控合同额(元)"})
@ColumnWidth(20)
private BigDecimal mesnacContractPrice;
@ExcelProperty({"合同信息", "海威合同额(元)"})
@ColumnWidth(20)
private BigDecimal totalPrice;
@ExcelProperty({"合同信息", "付款方式"})
@ColumnWidth(20)
private String paymentMethod;
@ExcelProperty({"合同信息", "交货期"})
private Integer deliveryStart;
@ExcelProperty({"合同信息", "质保期"})
private Integer warrantyPeriod;
@ExcelProperty({"合同信息", "签订人"})
private String contractManagerName;
@ExcelProperty({"合同信息", "部门"})
private String contractDeptName;
@ExcelProperty(value = {"合同信息", "业务方向"}, converter = org.dromara.common.excel.convert.ExcelDictConvert.class)
@org.dromara.common.excel.annotation.ExcelDictFormat(dictType = "business_direction")
private String businessDirection;
/**
* ================== ==================
*/
@ExcelProperty({"项目基本信息", "项目编号"})
@ColumnWidth(20)
private String projectCode;
@ExcelProperty({"项目基本信息", "项目名称"})
@ColumnWidth(25)
private String projectName;
@ExcelProperty({"项目基本信息", "项目经理"})
private String managerName;
@ExcelProperty({"项目基本信息", "项目类型"})
private String typeName;
/**
* ================== ==================
*/
@ExcelProperty({"备注", "最终客户"})
@ColumnWidth(25)
private String finalCustomerName;
/** 搜索参数预留 */
private Map<String, Object> params;
}

@ -0,0 +1,18 @@
package org.dromara.oa.erp.mapper;
import org.apache.ibatis.annotations.Param;
import org.dromara.oa.erp.domain.vo.ContractLedgerReportVo;
import java.util.List;
/**
* Mapper
*/
public interface ContractLedgerReportMapper {
/**
*
*/
List<ContractLedgerReportVo> selectContractLedgerList(@Param("bo") ContractLedgerReportVo bo);
}

@ -0,0 +1,23 @@
package org.dromara.oa.erp.service;
import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.oa.erp.domain.vo.ContractLedgerReportVo;
import java.util.List;
/**
* Service
*/
public interface IContractLedgerReportService {
/**
*
*/
TableDataInfo<ContractLedgerReportVo> queryContractLedgerList(ContractLedgerReportVo bo);
/**
* (使)
*/
List<ContractLedgerReportVo> queryContractLedgerAll(ContractLedgerReportVo bo);
}

@ -0,0 +1,32 @@
package org.dromara.oa.erp.service.impl;
import lombok.RequiredArgsConstructor;
import org.dromara.common.mybatis.core.page.PageQuery;
import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.oa.erp.domain.vo.ContractLedgerReportVo;
import org.dromara.oa.erp.mapper.ContractLedgerReportMapper;
import org.dromara.oa.erp.service.IContractLedgerReportService;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* Service
*/
@RequiredArgsConstructor
@Service
public class ContractLedgerReportServiceImpl implements IContractLedgerReportService {
private final ContractLedgerReportMapper reportMapper;
@Override
public TableDataInfo<ContractLedgerReportVo> queryContractLedgerList(ContractLedgerReportVo bo) {
List<ContractLedgerReportVo> list = reportMapper.selectContractLedgerList(bo);
return TableDataInfo.build(list);
}
@Override
public List<ContractLedgerReportVo> queryContractLedgerAll(ContractLedgerReportVo bo) {
return reportMapper.selectContractLedgerList(bo);
}
}

@ -0,0 +1,79 @@
<?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="org.dromara.oa.erp.mapper.ContractLedgerReportMapper">
<select id="selectContractLedgerList" resultType="org.dromara.oa.erp.domain.vo.ContractLedgerReportVo">
SELECT
c.contract_id,
<!-- 合同信息 -->
c.internal_contract_code,
c.external_contract_code,
c.customer_contract_code,
DATE_FORMAT(c.contract_date, '%Y-%m-%d') AS contract_date,
DATE_FORMAT(c.create_time, '%Y-%m') AS month,
c.order_contract_code,
c.project_contract_code,
cust.customer_name AS customer_name,
mat_sub.product_name AS product_name,
c.mesnac_contract_price,
c.total_price,
c.payment_method,
c.delivery_start,
c.warranty_period,
u1.nick_name AS contract_manager_name,
d.dept_name AS contract_dept_name,
c.business_direction,
<!-- 项目基本信息 -->
p.project_code,
p.project_name,
u2.nick_name AS manager_name,
pt.type_name,
<!-- 备注 -->
fcust.customer_name AS final_customer_name
FROM erp_contract_info c
LEFT JOIN (
SELECT contract_id, GROUP_CONCAT(DISTINCT product_name SEPARATOR '') AS product_name
FROM erp_contract_material
WHERE del_flag = '0'
GROUP BY contract_id
) mat_sub ON c.contract_id = mat_sub.contract_id
LEFT JOIN crm_customer_info cust ON c.one_customer_id = cust.customer_id AND cust.del_flag = '0'
LEFT JOIN sys_user u1 ON u1.user_id = c.contract_manager_id
LEFT JOIN sys_dept d ON d.dept_id = c.contract_dept_id
LEFT JOIN erp_project_contracts pc ON pc.contract_id = c.contract_id AND pc.del_flag = '0'
LEFT JOIN erp_project_info p ON p.project_id = pc.project_id AND p.del_flag = '0'
LEFT JOIN sys_user u2 ON u2.user_id = p.manager_id
LEFT JOIN erp_project_type pt ON pt.project_type_id = p.project_type_id
LEFT JOIN crm_customer_info fcust ON c.final_customer_id = fcust.customer_id AND fcust.del_flag = '0'
<where>
c.del_flag = '0'
<if test="bo.contractIdList != null and bo.contractIdList.size() > 0">
AND c.contract_id IN
<foreach collection="bo.contractIdList" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</if>
<if test="bo.customerContractCode != null and bo.customerContractCode != ''">
AND c.customer_contract_code LIKE CONCAT('%', #{bo.customerContractCode}, '%')
</if>
<if test="bo.internalContractCode != null and bo.internalContractCode != ''">
AND c.internal_contract_code LIKE CONCAT('%', #{bo.internalContractCode}, '%')
</if>
<if test="bo.projectCode != null and bo.projectCode != ''">
AND p.project_code LIKE CONCAT('%', #{bo.projectCode}, '%')
</if>
<if test="bo.businessDirection != null and bo.businessDirection != ''">
AND c.business_direction = #{bo.businessDirection}
</if>
<if test="bo.params != null and bo.params.beginContractDate != null and bo.params.beginContractDate != ''">
AND DATE_FORMAT(c.contract_date,'%y%m%d') &gt;= DATE_FORMAT(#{bo.params.beginContractDate},'%y%m%d')
</if>
<if test="bo.params != null and bo.params.endContractDate != null and bo.params.endContractDate != ''">
AND DATE_FORMAT(c.contract_date,'%y%m%d') &lt;= DATE_FORMAT(#{bo.params.endContractDate},'%y%m%d')
</if>
</where>
ORDER BY c.create_time DESC
</select>
</mapper>
Loading…
Cancel
Save