付款进度代码同步

This commit is contained in:
2025-06-07 15:15:55 +08:00
parent d5660ee8aa
commit ce5e217c0c
21 changed files with 515 additions and 99 deletions

View File

@@ -124,71 +124,66 @@
<select id="selectVoPagePlus" resultType="com.ruoyi.oa.domain.vo.OaProgressVo">
SELECT
op.progress_id,
op.project_id,
op.contact_phone,
op.type,
op.progress_name,
op.parent_id,
op.del_flag,
op.sort,
op.remark,
op.status,
op.amount,
op.time_remark,
sop.project_name,
sop.project_num,
sop.funds,
-- 获取 detail_status = 0 且 plan_start_date 最小的记录的 detail_name 作为 nowLevel
(
SELECT d.detail_name
SELECT op.progress_id,
op.project_id,
op.contact_phone,
op.type,
op.progress_name,
op.parent_id,
op.del_flag,
op.sort,
op.remark,
op.status,
op.amount,
op.time_remark,
sop.project_name,
sop.project_num,
sop.funds,
-- 获取 detail_status = 0 且 plan_start_date 最小的记录的 detail_name 作为 nowLevel
(SELECT d.detail_name
FROM oa_progress_detail d
WHERE d.progress_id = op.progress_id
AND d.detail_status = 0
ORDER BY d.plan_start_date ASC
LIMIT 1
) AS nowLevel,
(
SELECT d.detail_id
LIMIT 1) AS nowLevel,
(select op2.contact_phone
from oa_progress op2
where op2.progress_id = op.parent_id) as parentPhone,
(SELECT d.detail_id
FROM oa_progress_detail d
WHERE d.progress_id = op.progress_id
AND d.detail_status = 0
ORDER BY d.plan_start_date ASC
LIMIT 1
) AS nowLevelId,
-- 计算该记录 plan_end_date 与当前时间的天数差值作为 remainTime
(
SELECT TIMESTAMPDIFF(DAY, NOW(), d.plan_end_date)
LIMIT 1) AS nowLevelId,
-- 计算该记录 plan_end_date 与当前时间的天数差值作为 remainTime
(SELECT TIMESTAMPDIFF(DAY, NOW(), d.plan_end_date)
FROM oa_progress_detail d
WHERE d.progress_id = op.progress_id
AND d.detail_status = 0
ORDER BY d.plan_start_date ASC
LIMIT 1
) AS remainTime,
LIMIT 1) AS remainTime,
(SELECT d.department
FROM oa_progress_detail d
WHERE d.progress_id = op.progress_id
AND d.detail_status = 0
ORDER BY d.plan_start_date ASC
LIMIT 1) AS nowDepart,
(SELECT d.plan_end_date
FROM oa_progress_detail d
WHERE d.progress_id = op.progress_id
AND d.detail_status = 0
ORDER BY d.plan_start_date ASC
LIMIT 1) AS endTime,
(
SELECT d.plan_end_date
FROM oa_progress_detail d
WHERE d.progress_id = op.progress_id
AND d.detail_status = 0
ORDER BY d.plan_start_date ASC
LIMIT 1
) AS endTime,
(
SELECT d.plan_pay_date
(SELECT d.plan_pay_date
FROM oa_progress_detail d
WHERE d.progress_id = op.progress_id
ORDER BY d.plan_pay_date ASC
LIMIT 1
) AS payEndTime,
-- 计算当前 progress 对应的 detail 完成比例:满足 detail_status = 1 的条数 / 总条数避免除0
(
SELECT IF(COUNT(*) = 0, 0, ROUND(SUM(CASE WHEN d.detail_status = 1 THEN 1 ELSE 0 END) / COUNT(*), 2))
LIMIT 1) AS payEndTime,
-- 计算当前 progress 对应的 detail 完成比例:满足 detail_status = 1 的条数 / 总条数避免除0
(SELECT IF(COUNT(*) = 0, 0, ROUND(SUM(CASE WHEN d.detail_status = 1 THEN 1 ELSE 0 END) / COUNT(*), 2))
FROM oa_progress_detail d
WHERE d.progress_id = op.progress_id
) AS detailCompletePercent
WHERE d.progress_id = op.progress_id) AS detailCompletePercent
FROM oa_progress op
LEFT JOIN sys_oa_project sop ON sop.project_id = op.project_id
${ew.getCustomSqlSegment}