重要机具接口推送信息开发

This commit is contained in:
bonus 2025-09-28 17:03:12 +08:00
parent 58dc019e3b
commit 3e1b591873
8 changed files with 580 additions and 4 deletions

View File

@ -1,7 +1,7 @@
package com.bonus.common.biz.utils; package com.bonus.common.biz.utils;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson2.JSONObject;
import com.bonus.common.security.utils.SecurityUtils; import com.bonus.common.security.utils.SecurityUtils;
import org.apache.http.HttpEntity; import org.apache.http.HttpEntity;
import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.CloseableHttpResponse;
@ -245,4 +245,4 @@ public class HttpHelper {
} }
} }

View File

@ -98,6 +98,22 @@ public class PushProDataUseInfoController extends BaseController {
throw new ServiceException("数据查询异常,请联系运维人员查询日志处理"); throw new ServiceException("数据查询异常,请联系运维人员查询日志处理");
} }
} }
/**
* 查询重要机具详情
*
* @param bean
* @return
*/
@GetMapping(value = "getDeviceNumByType")
public AjaxResult getDeviceNumByType(ProIdsBean bean) {
try {
List<TotalNumsBean> results = service.getDeviceNumByType(bean);
return AjaxResult.success(results);
} catch (Exception e) {
logger.error(e.toString(), e);
throw new ServiceException("数据查询异常,请联系运维人员查询日志处理");
}
}
/** /**
* 保有量在用量再修量库存量 装备详情 * 保有量在用量再修量库存量 装备详情

View File

@ -34,4 +34,9 @@ public class StaticsNumsBean {
* 单位名称 * 单位名称
*/ */
private String unitName; private String unitName;
/**
* 单位名称
*/
private String deviceName;
} }

View File

@ -2,6 +2,7 @@ package com.bonus.material.push.domain;
import lombok.Data; import lombok.Data;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.List;
@Data @Data
public class TotalNumsBean { public class TotalNumsBean {
@ -17,6 +18,13 @@ public class TotalNumsBean {
private BigDecimal num; private BigDecimal num;
private BigDecimal ApproachingNum; private BigDecimal ApproachingNum;
private BigDecimal TimeoutNum; private BigDecimal TimeoutNum;
private BigDecimal stNum;
private BigDecimal leaseNum;
private String deviceName;
private List<String> projectIds;
// 可以根据需要添加分类名称getter方法 // 可以根据需要添加分类名称getter方法
public String getCategoryName() { public String getCategoryName() {
@ -34,4 +42,4 @@ public class TotalNumsBean {
default: return "未知分类"; default: return "未知分类";
} }
} }
} }

View File

@ -57,4 +57,6 @@ public interface ProDataUseInfoMapper {
List<MachineInfoBean> getCompletionNotRefundedSub(ProIdsBean bean); List<MachineInfoBean> getCompletionNotRefundedSub(ProIdsBean bean);
List<MachineInfoBean> getCompletionNotRefundedDetailsSub(ProIdsBean bean); List<MachineInfoBean> getCompletionNotRefundedDetailsSub(ProIdsBean bean);
List<TotalNumsBean> getDeviceNumByType(ProIdsBean bean);
} }

View File

@ -48,4 +48,6 @@ public interface ProDataUseInfoService {
List<MachineInfoBean> getCompletionNotRefundedSub(ProIdsBean bean); List<MachineInfoBean> getCompletionNotRefundedSub(ProIdsBean bean);
List<MachineInfoBean> getCompletionNotRefundedDetailsSub(ProIdsBean bean); List<MachineInfoBean> getCompletionNotRefundedDetailsSub(ProIdsBean bean);
List<TotalNumsBean> getDeviceNumByType(ProIdsBean bean);
} }

View File

@ -218,4 +218,9 @@ public class ProDataUseInfoImpl implements ProDataUseInfoService {
public List<MachineInfoBean> getCompletionNotRefundedDetailsSub(ProIdsBean bean) { public List<MachineInfoBean> getCompletionNotRefundedDetailsSub(ProIdsBean bean) {
return proDataUseInfoMapper.getCompletionNotRefundedDetailsSub(bean); return proDataUseInfoMapper.getCompletionNotRefundedDetailsSub(bean);
} }
@Override
public List<TotalNumsBean> getDeviceNumByType(ProIdsBean bean) {
return proDataUseInfoMapper.getDeviceNumByType(bean);
}
} }

View File

@ -737,4 +737,542 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</if> </if>
</select> </select>
<select id="getDeviceNumByType" resultType="com.bonus.material.push.domain.TotalNumsBean">
SELECT
res.typeName as deviceName,
SUM( res.storeNum ) + SUM( dsNum )+ SUM( repairNum )+ SUM( repairAuditNum )+ SUM( repairInputNum )+ SUM( inputNum ) AS stNum,
SUM( res.usNum ) AS leaseNum
FROM
(
SELECT
mt.type_id AS typeId,
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,
mt.unit_name AS unit,
IFNULL( mt.buy_price, 0 ) AS buyPrice,
CASE
mt.manage_type
WHEN 0 THEN
IFNULL( subquery0.num, 0 ) ELSE IFNULL( mt.storage_num, 0 )
END AS storeNum,
IFNULL( subquery1.usNum, 0 ) AS usNum,
IFNULL( subquery2.dsNum, 0 ) AS dsNum,
IFNULL( subquery2.repairNum, 0 ) AS repairNum,
IFNULL( subquery12.repairAuditNum, 0 ) AS repairAuditNum,
IFNULL( subquery3.repairInputNum, 0 ) AS repairInputNum,
IFNULL( subquery4.inputNum, 0 ) AS inputNum,
CASE
mt.manage_type
WHEN 0 THEN
IFNULL( subquery0.num, 0 )+ IFNULL( subquery1.usNum, 0 ) + IFNULL( subquery2.dsNum, 0 ) + IFNULL( subquery2.repairNum, 0 ) + IFNULL( subquery3.repairInputNum, 0 ) + IFNULL( subquery12.repairAuditNum, 0 ) + IFNULL( subquery4.inputNum, 0 ) ELSE IFNULL( mt.storage_num, 0 )+ IFNULL( subquery1.usNum, 0 ) + IFNULL( subquery2.dsNum, 0 ) + IFNULL( subquery2.repairNum, 0 ) + IFNULL( subquery3.repairInputNum, 0 ) + IFNULL( subquery12.repairAuditNum, 0 ) + IFNULL( subquery4.inputNum, 0 )
END AS allNum,
CASE
mt.manage_type
WHEN 0 THEN
'编码' ELSE '数量'
END manageType
FROM
ma_type mt
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,
count( mm.ma_id ) AS num
FROM
ma_machine mm
LEFT JOIN ma_type mt ON mt.type_id = mm.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
WHERE
mm.ma_code IS NOT NULL
AND mm.ma_status IN ( 1 )
GROUP BY
mt.type_id
) AS subquery0 ON subquery0.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( sai.num, 0 )) AS usNum
FROM
slt_agreement_info sai
LEFT JOIN bm_agreement_info bai ON bai.agreement_id = sai.agreement_id
LEFT JOIN bm_project_info bp ON bp.project_id = bai.project_id
LEFT JOIN ma_type mt ON mt.type_id = sai.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
WHERE
sai.`status` = '0'
AND sai.`is_slt` = '0'
AND ( sai.source = 1 OR sai.source IS NULL )
AND sai.end_time IS NULL
AND sai.back_id IS NULL
AND mt.type_id IN (
2598,
2599,
2600,
2601,
2602,
2603,
2604,
2605,
2606,
2608,
2609,
2610,
2611,
2612,
2613,
2614,
2615,
2616,
2617,
2618,
2619,
2620,
2621,
4341,
4374,
4678,
2624,
2625,
2626,
2627,
2628,
2629,
2630,
2631,
2632,
2633,
2634,
2635,
2636,
2637,
2638,
2639,
2640,
2641,
2623,
2164,
2165,
2166,
4359,
4360,
4519,
2411,
4353,
2404,
2405,
2406,
2407,
2408,
2409,
2410,
2525,
3281
)
<if test="projectIds != null and projectIds.size() > 0">
AND bp.external_id in
<foreach item="item" index="index" collection="projectIds" open="(" separator="," close=")">
#{item}
</foreach>
</if>
GROUP BY
mt.type_id
) AS subquery1 ON mt.type_id = subquery1.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( 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 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
INNER JOIN tm_task tt ON rad.task_id = tt.task_id
WHERE
tt.task_status IN ( 0, 4 )
AND tt.CODE IS NOT NULL
AND mt.type_id IN (
2598,
2599,
2600,
2601,
2602,
2603,
2604,
2605,
2606,
2608,
2609,
2610,
2611,
2612,
2613,
2614,
2615,
2616,
2617,
2618,
2619,
2620,
2621,
4341,
4374,
4678,
2624,
2625,
2626,
2627,
2628,
2629,
2630,
2631,
2632,
2633,
2634,
2635,
2636,
2637,
2638,
2639,
2640,
2641,
2623,
2164,
2165,
2166,
4359,
4360,
4519,
2411,
4353,
2404,
2405,
2406,
2407,
2408,
2409,
2410,
2525,
3281
)
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
WHERE
tt.CODE IS NOT NULL
AND rad.`status` = '0'
GROUP BY
mt.type_id
) AS subquery12 ON subquery12.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( rid.repair_num, 0 ) - IFNULL( rid.input_num, 0 ) - IFNULL( rid.reject_num, 0 )) AS repairInputNum
FROM
repair_input_details rid
LEFT JOIN ma_type mt ON mt.type_id = rid.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 rid.task_id = tt.task_id
WHERE
IFNULL( rid.repair_num, 0 ) - IFNULL( rid.input_num, 0 ) - IFNULL( rid.reject_num, 0 ) > 0
AND tt.task_status = 0
AND mt.type_id IN (
2598,
2599,
2600,
2601,
2602,
2603,
2604,
2605,
2606,
2608,
2609,
2610,
2611,
2612,
2613,
2614,
2615,
2616,
2617,
2618,
2619,
2620,
2621,
4341,
4374,
4678,
2624,
2625,
2626,
2627,
2628,
2629,
2630,
2631,
2632,
2633,
2634,
2635,
2636,
2637,
2638,
2639,
2640,
2641,
2623,
2164,
2165,
2166,
4359,
4360,
4519,
2411,
4353,
2404,
2405,
2406,
2407,
2408,
2409,
2410,
2525,
3281
)
GROUP BY
mt.type_id
) AS subquery3 ON subquery3.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( pcd.check_num, 0 ) - IFNULL( pcd.input_num, 0 )) AS inputNum
FROM
purchase_check_details pcd
LEFT JOIN ma_type mt ON mt.type_id = pcd.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
WHERE
IFNULL( pcd.check_num, 0 ) - IFNULL( pcd.input_num, 0 ) > 0
AND pcd.STATUS IN ( 3, 4, 13, 14 )
AND mt.type_id IN (
2598,
2599,
2600,
2601,
2602,
2603,
2604,
2605,
2606,
2608,
2609,
2610,
2611,
2612,
2613,
2614,
2615,
2616,
2617,
2618,
2619,
2620,
2621,
4341,
4374,
4678,
2624,
2625,
2626,
2627,
2628,
2629,
2630,
2631,
2632,
2633,
2634,
2635,
2636,
2637,
2638,
2639,
2640,
2641,
2623,
2164,
2165,
2166,
4359,
4360,
4519,
2411,
4353,
2404,
2405,
2406,
2407,
2408,
2409,
2410,
2525,
3281
)
GROUP BY
mt.type_id
) AS subquery4 ON subquery4.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
WHERE
mt.del_flag = '0'
AND mt.type_id IN (
2598,
2599,
2600,
2601,
2602,
2603,
2604,
2605,
2606,
2608,
2609,
2610,
2611,
2612,
2613,
2614,
2615,
2616,
2617,
2618,
2619,
2620,
2621,
4341,
4374,
4678,
2624,
2625,
2626,
2627,
2628,
2629,
2630,
2631,
2632,
2633,
2634,
2635,
2636,
2637,
2638,
2639,
2640,
2641,
2623,
2164,
2165,
2166,
4359,
4360,
4519,
2411,
4353,
2404,
2405,
2406,
2407,
2408,
2409,
2410,
2525,
3281
)
) res
GROUP BY
res.typeName
</select>
</mapper> </mapper>