feat(): 重点作业相关方端申请和企业端核查核实角标与列表数量统一

dev
lishiwei 2026-07-24 11:09:48 +08:00
parent 7e1693414b
commit 4a7f1229d9
5 changed files with 39 additions and 6 deletions

View File

@ -215,27 +215,29 @@ public class KeyProjectQueryExe {
} }
public KeyProjectCountCO count(Long id) { public KeyProjectCountCO count(Long id) {
// 与列表一致:同一 key_project_id 只统计最新一条
String latestVersionNotExists = "NOT EXISTS (SELECT 1 FROM key_project kp_latest WHERE kp_latest.delete_enum = 'FALSE' AND kp_latest.key_project_id = key_project.key_project_id AND kp_latest.id > key_project.id)";
QueryWrapper queryWrapper = new QueryWrapper(); QueryWrapper queryWrapper = new QueryWrapper();
queryWrapper.eq("jurisdiction_user_id", id); queryWrapper.eq("jurisdiction_user_id", id);
queryWrapper.eq("delete_enum", "FALSE"); queryWrapper.eq("delete_enum", "FALSE");
queryWrapper.in("apply_status",2,5); queryWrapper.in("apply_status",2,5);
queryWrapper.apply(latestVersionNotExists);
// 重点作业确认数量 // 重点作业确认数量
Long zdzyqrCount = keyProjectRepository.count(queryWrapper); Long zdzyqrCount = keyProjectRepository.count(queryWrapper);
queryWrapper.clear(); queryWrapper.clear();
queryWrapper.eq("xgf_master_user_id", id); queryWrapper.eq("xgf_master_user_id", id);
queryWrapper.eq("delete_enum", "FALSE"); queryWrapper.eq("delete_enum", "FALSE");
queryWrapper.in("apply_status",1,4); queryWrapper.in("apply_status",1,4,7);
queryWrapper.apply(latestVersionNotExists);
// 重点作业申请数量 // 重点作业申请数量
Long zdzysqCount = keyProjectRepository.count(queryWrapper); Long zdzysqCount = keyProjectRepository.count(queryWrapper);
// 检查核实数量 // 检查核实数量:与检查核实列表口径一致
Long jchsCount = safetyEnvironmentalInspectionUserRepository.countCheckVerifyByUserId(id);
List<SafetyEnvironmentalInspectionUserDO> insUserList = safetyEnvironmentalInspectionUserRepository.listByUserId(id); List<SafetyEnvironmentalInspectionUserDO> insUserList = safetyEnvironmentalInspectionUserRepository.listByUserId(id);
Long jchsCount = 0L;
Long shenbianclCount = 0L; Long shenbianclCount = 0L;
Long bjcrqrCount = 0L; Long bjcrqrCount = 0L;
for (SafetyEnvironmentalInspectionUserDO insUser : insUserList) { for (SafetyEnvironmentalInspectionUserDO insUser : insUserList) {
if (insUser.getType() == 2 || insUser.getType() == 5) { if (insUser.getType() == 4) {
jchsCount += 1;
} else if (insUser.getType() == 4) {
shenbianclCount += 1; shenbianclCount += 1;
} else if (insUser.getType() == 3 || insUser.getType() == 6) { } else if (insUser.getType() == 3 || insUser.getType() == 6) {
bjcrqrCount += 1; bjcrqrCount += 1;

View File

@ -19,5 +19,7 @@ public interface SafetyEnvironmentalInspectionUserMapper extends BaseMapper<Safe
List<SafetyEnvironmentalInspectionUserDO> selectListByInspectionId(@Param("params") Map<String, Object> params); List<SafetyEnvironmentalInspectionUserDO> selectListByInspectionId(@Param("params") Map<String, Object> params);
List<SafetyEnvironmentalInspectionUserDO> listByUserId(Long userId); List<SafetyEnvironmentalInspectionUserDO> listByUserId(Long userId);
Long countCheckVerifyByUserId(@Param("userId") Long userId);
} }

View File

@ -134,5 +134,10 @@ public class SafetyEnvironmentalInspectionUserRepositoryImpl extends BaseReposit
public List<SafetyEnvironmentalInspectionUserDO> listByUserId(Long userId) { public List<SafetyEnvironmentalInspectionUserDO> listByUserId(Long userId) {
return safetyEnvironmentalInspectionUserMapper.listByUserId(userId); return safetyEnvironmentalInspectionUserMapper.listByUserId(userId);
} }
@Override
public Long countCheckVerifyByUserId(Long userId) {
return safetyEnvironmentalInspectionUserMapper.countCheckVerifyByUserId(userId);
}
} }

View File

@ -35,5 +35,7 @@ public interface SafetyEnvironmentalInspectionUserRepository extends BaseReposit
List<SafetyEnvironmentalInspectionUserDO> listByUserId(Long userId); List<SafetyEnvironmentalInspectionUserDO> listByUserId(Long userId);
Long countCheckVerifyByUserId(Long userId);
} }

View File

@ -38,5 +38,27 @@
and iu.user_id = #{userId} and iu.user_id = #{userId}
GROUP BY iu.id GROUP BY iu.id
</select> </select>
<!-- 检查核实角标:与检查核实列表口径一致(待核实 + 当前最大核实节点) -->
<select id="countCheckVerifyByUserId" resultType="java.lang.Long">
WITH max_iu_type AS (
SELECT inspection_id, MAX(type) AS max_type
FROM safety_environmental_inspection_user
WHERE delete_enum = 'FALSE' AND type IN (2, 5)
GROUP BY inspection_id
)
SELECT COUNT(DISTINCT i.id)
FROM safety_environmental_inspection i
LEFT JOIN max_iu_type mt ON mt.inspection_id = i.inspection_id
LEFT JOIN safety_environmental_inspection_user iu
ON iu.inspection_id = i.inspection_id
AND iu.delete_enum = 'FALSE'
AND iu.type = mt.max_type
AND iu.STATUS = 0
AND iu.user_id = #{userId}
WHERE i.delete_enum = 'FALSE'
AND iu.user_id IS NOT NULL
AND i.status IN (1)
</select>
</mapper> </mapper>