功能优化

This commit is contained in:
mashuai 2025-09-10 18:53:49 +08:00
parent 88f3da9eb7
commit 53f5e35bbf
3 changed files with 47 additions and 14 deletions

View File

@ -1426,11 +1426,7 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService {
// 计算新值处理num为null的情况若业务允许
BigDecimal currentNum = Optional.ofNullable(node.getNum()).orElse(BigDecimal.ZERO);
BigDecimal newNum = currentNum.subtract(subtractNum);
if (newNum.compareTo(BigDecimal.ZERO) == 0) {
iterator.remove();
} else {
node.setNum(newNum);
}
node.setNum(newNum.compareTo(BigDecimal.ZERO) < 0 ? BigDecimal.ZERO : newNum);
}
}
}

View File

@ -246,6 +246,9 @@ public class Machine extends BaseEntity {
@ApiModelProperty(value = "报告编号")
private String reportCode;
@ApiModelProperty(value = "报告路径")
private String reportUrl;
private String nextCheckTimeSynch;

View File

@ -144,22 +144,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
mt2.type_name AS typeName,
mt2.type_id AS thirdTypeId,
mt.type_name AS typeModelName,
SUM(
IFNULL(rad.repair_num, 0) - IFNULL(rad.repaired_num, 0) -
IFNULL(rad.scrap_num, 0)) AS repairNum,
sd.dept_name AS unitName
SUM(CASE WHEN tt.task_status = 0 and rad.is_ds = 1 THEN IFNULL(rad.repair_num, 0) ELSE 0 END) AS dsNum,
SUM(CASE WHEN tt.task_status = 4 and rad.is_ds = 0 THEN (IFNULL(rad.repair_num, 0) - IFNULL(rad.repaired_num, 0) - IFNULL(rad.scrap_num, 0)) ELSE 0 END) AS repairNum
FROM repair_apply_details rad
LEFT JOIN tm_task tt ON rad.task_id = tt.task_id
LEFT JOIN tm_task_agreement tta ON tt.task_id = tta.task_id
LEFT JOIN bm_agreement_info bai ON tta.agreement_id = bai.agreement_id
LEFT JOIN bm_project bp ON bai.project_id = bp.pro_id
LEFT JOIN ma_type mt ON mt.type_id = rad.type_id
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
LEFT JOIN ma_type mt3 ON mt3.type_id = mt2.parent_id
LEFT JOIN ma_type mt4 ON mt4.type_id = mt3.parent_id
LEFT JOIN tm_task tt ON rad.task_id = tt.task_id
LEFT JOIN tm_task_agreement tta ON tt.task_id = tta.task_id
LEFT JOIN bm_agreement_info bai ON tta.agreement_id = bai.agreement_id
LEFT JOIN bm_project bp ON bai.project_id = bp.pro_id
LEFT JOIN sys_dept sd ON sd.dept_id = bp.imp_unit
WHERE
rad.status = '0'
tt.task_status IN (0, 4)
AND tt.code is not null
<if test="unitName != null and unitName !=''">
AND sd.dept_name = #{unitName}
</if>
@ -171,6 +170,41 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</if>
GROUP BY
mt.type_id) AS subquery2 ON subquery2.type_id = mt.type_id
LEFT JOIN (
SELECT
mt.type_id,
mt4.type_name AS constructionType,
mt4.type_id AS firstTypeId,
mt3.type_name AS materialType,
mt3.type_id AS secondTypeId,
mt2.type_name AS typeName,
mt2.type_id AS thirdTypeId,
mt.type_name AS typeModelName,
SUM(IFNULL(rad.repair_num, 0) ) AS repairAuditNum
FROM repair_audit_details rad
LEFT JOIN ma_type mt ON mt.type_id = rad.type_id
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
LEFT JOIN ma_type mt3 ON mt3.type_id = mt2.parent_id
LEFT JOIN ma_type mt4 ON mt4.type_id = mt3.parent_id
LEFT JOIN tm_task tt ON rad.task_id = tt.task_id
LEFT JOIN tm_task_agreement tta ON tt.task_id = tta.task_id
LEFT JOIN bm_agreement_info bai ON tta.agreement_id = bai.agreement_id
LEFT JOIN bm_project bp ON bai.project_id = bp.pro_id
LEFT JOIN sys_dept sd ON sd.dept_id = bp.imp_unit
WHERE
tt.code is not null
and rad.`status` = '0'
<if test="unitName != null and unitName !=''">
AND sd.dept_name = #{unitName}
</if>
<if test="deptId != null">
AND sd.dept_id = #{deptId}
</if>
<if test="isStatics != null">
and mt2.is_statics = #{isStatics}
</if>
GROUP BY
mt.type_id) AS subquery3 ON subquery3.type_id = mt.type_id
LEFT JOIN ma_type mt2 on mt2.type_id = mt.parent_id
LEFT JOIN ma_type mt3 ON mt3.type_id = mt2.parent_id
LEFT JOIN ma_type mt4 ON mt4.type_id = mt3.parent_id