更新
This commit is contained in:
parent
e103e09abe
commit
be16e90a64
@ -47,4 +47,16 @@ public class StatisticsController {
|
||||
public CommonResult<?> queryStaffStatisticsGroupByGoods(@RequestBody DlInspectionProject dlInspectionProject) {
|
||||
return CommonResult.success(statisticsService.queryStaffCountGroupByGoods(dlInspectionProject));
|
||||
}
|
||||
|
||||
/**
|
||||
* @description : 获取员工产值排行榜
|
||||
* @author xyc
|
||||
* @date 16:52 2025/10/11
|
||||
* @param dlInspectionProject {@link DlInspectionProject}
|
||||
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<?>
|
||||
**/
|
||||
@PostMapping("/queryOutputMoneyStatisticsRanking")
|
||||
public CommonResult<?> queryOutputMoneyStatisticsRanking(@RequestBody DlInspectionProject dlInspectionProject) {
|
||||
return CommonResult.success(statisticsService.queryOutputMoneyStatisticsRanking(dlInspectionProject));
|
||||
}
|
||||
}
|
||||
|
@ -81,4 +81,13 @@ public interface InspectionWorkNodeMapper extends BaseMapper<InspectionWorkNode>
|
||||
* @return: java.util.Map<java.lang.String,java.lang.Object>
|
||||
**/
|
||||
Map<String, Object> queryOutputMoneyStatistics(DlInspectionProject dlInspectionProject);
|
||||
|
||||
/**
|
||||
* @description : 获取员工项目统计排名
|
||||
* @author xyc
|
||||
* @date 16:48 2025/10/11
|
||||
* @param dlInspectionProject {@link DlInspectionProject}
|
||||
* @return java.util.Map<java.lang.String,java.lang.Object>
|
||||
**/
|
||||
List<Map<String, Object>> queryOutputMoneyStatisticsRanking(DlInspectionProject dlInspectionProject);
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.inspection.service;
|
||||
|
||||
import cn.iocoder.yudao.module.inspection.entity.DlInspectionProject;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface StatisticsService {
|
||||
@ -23,4 +24,13 @@ public interface StatisticsService {
|
||||
* @return: java.util.Map<java.lang.String,java.lang.Object>
|
||||
**/
|
||||
Map<String, Object> queryStaffCountGroupByGoods(DlInspectionProject dlInspectionProject);
|
||||
|
||||
/**
|
||||
* @description: 获取员工产值排行榜
|
||||
* @author: 许
|
||||
* @date: 2025/8/5 14:07
|
||||
* @param: [dlInspectionProject]
|
||||
* @return: java.util.Map<java.lang.String,java.lang.Object>
|
||||
**/
|
||||
List<Map<String, Object>> queryOutputMoneyStatisticsRanking(DlInspectionProject dlInspectionProject);
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.inspection.service.impl;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.iocoder.yudao.module.inspection.entity.DlInspectionProject;
|
||||
import cn.iocoder.yudao.module.inspection.entity.InspectionInfo;
|
||||
import cn.iocoder.yudao.module.inspection.mapper.InspectionWorkNodeMapper;
|
||||
import cn.iocoder.yudao.module.inspection.service.IInspectionInfoService;
|
||||
import cn.iocoder.yudao.module.inspection.service.IInspectionWorkNodeService;
|
||||
import cn.iocoder.yudao.module.inspection.service.StatisticsService;
|
||||
@ -33,6 +34,8 @@ public class StatisticsServiceImpl implements StatisticsService {
|
||||
private final IInspectionInfoService inspectionInfoService;
|
||||
|
||||
private final AdminUserApi adminUserApi;
|
||||
|
||||
private final InspectionWorkNodeMapper inspectionWorkNodeMapper;
|
||||
/**
|
||||
* @description: 获取员工统计信息
|
||||
* @author: 许
|
||||
@ -161,4 +164,9 @@ public class StatisticsServiceImpl implements StatisticsService {
|
||||
|
||||
return staffCount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> queryOutputMoneyStatisticsRanking(DlInspectionProject dlInspectionProject) {
|
||||
return inspectionWorkNodeMapper.queryOutputMoneyStatisticsRanking(dlInspectionProject);
|
||||
}
|
||||
}
|
||||
|
@ -521,4 +521,47 @@
|
||||
GROUP BY
|
||||
iw.deal_user_id;
|
||||
</select>
|
||||
<select id="queryOutputMoneyStatisticsRanking" resultType="java.util.Map"
|
||||
parameterType="cn.iocoder.yudao.module.inspection.entity.DlInspectionProject">
|
||||
SELECT
|
||||
users.nickname,
|
||||
s.user_id AS userId,
|
||||
|
||||
-- 初检公示产值:流程次数为1的订单公示价格
|
||||
COALESCE(SUM(CASE WHEN iw.node_count = 1 THEN oi.goods_price ELSE 0 END) / 100, 0) AS initialInspectionOutputValue,
|
||||
|
||||
-- 复检公示产值:流程次数大于1的订单公示价格总和
|
||||
COALESCE(SUM(CASE WHEN iw.node_count > 1 THEN oi.goods_price ELSE 0 END) / 100, 0) AS recheckInspectionOutputValue,
|
||||
|
||||
-- 初检合格产值
|
||||
COALESCE(SUM(CASE WHEN iw.node_count = 1 AND iw.status = '2' AND iw.type = '1' THEN oi.goods_price ELSE 0 END) / 100, 0) AS initialInspectionPassOutputValue,
|
||||
|
||||
-- 复检合格产值
|
||||
COALESCE(SUM(CASE WHEN iw.node_count > 1 AND iw.status = '2' AND iw.type = '1' THEN oi.goods_price ELSE 0 END) / 100, 0) AS recheckInspectionPassOutputValue,
|
||||
|
||||
-- 总合格产值(初检 + 复检)
|
||||
COALESCE(SUM(CASE WHEN iw.status = '2' AND iw.type = '1' THEN oi.goods_price ELSE 0 END) / 100, 0) AS totalPassOutputValue
|
||||
|
||||
FROM
|
||||
inspection_staff s
|
||||
LEFT JOIN inspection_work_node iw ON s.user_id = iw.deal_user_id
|
||||
LEFT JOIN inspection_info ii ON iw.inspection_info_id = ii.id
|
||||
LEFT JOIN order_info oi ON ii.inspection_order_id = oi.id
|
||||
LEFT JOIN system_users users on users.id = s.user_id
|
||||
|
||||
WHERE
|
||||
s.deleted = 0
|
||||
AND iw.deleted = 0
|
||||
AND ii.deleted = 0
|
||||
<if test="datetimeRange != null and datetimeRange.size() == 2">
|
||||
AND iw.create_time BETWEEN CONCAT(#{datetimeRange[0]}, ' 00:00:00')
|
||||
AND CONCAT(#{datetimeRange[1]}, ' 23:59:59')
|
||||
</if>
|
||||
|
||||
GROUP BY
|
||||
s.user_id, s.unique_code, s.school, s.educational, s.join_date, s.address, s.short_number
|
||||
|
||||
ORDER BY
|
||||
totalPassOutputValue DESC; -- 按总合格产值倒序排行
|
||||
</select>
|
||||
</mapper>
|
||||
|
Loading…
Reference in New Issue
Block a user