This commit is contained in:
parent
876b06ab01
commit
b7d861f9b6
|
|
@ -192,12 +192,12 @@ public class ComplexQueryServiceImpl implements ComplexQueryService {
|
|||
BigDecimal totalPendingScrapNum = BigDecimal.ZERO.setScale(3, RoundingMode.HALF_UP);
|
||||
BigDecimal totalScrapNum = BigDecimal.ZERO.setScale(3, RoundingMode.HALF_UP);
|
||||
BigDecimal totalAllNum = BigDecimal.ZERO.setScale(3, RoundingMode.HALF_UP);
|
||||
BigDecimal fiveReplacementNum = BigDecimal.ZERO.setScale(3, RoundingMode.HALF_UP);
|
||||
/*BigDecimal fiveReplacementNum = BigDecimal.ZERO.setScale(3, RoundingMode.HALF_UP);
|
||||
BigDecimal tenReplacementNum = BigDecimal.ZERO.setScale(3, RoundingMode.HALF_UP);
|
||||
BigDecimal tenPlusReplacementNum = BigDecimal.ZERO.setScale(3, RoundingMode.HALF_UP);
|
||||
String fiveReplacementRate = "0%";
|
||||
String tenReplacementRate = "0%";
|
||||
String tenPlusReplacementRate = "0%";
|
||||
String tenPlusReplacementRate = "0%";*/
|
||||
List<RetainedEquipmentInfo> recordList = complexQueryMapper.getRetainedEquipmentList(bean);
|
||||
if (CollectionUtils.isNotEmpty(recordList)) {
|
||||
for (RetainedEquipmentInfo retainedEquipmentInfo : recordList) {
|
||||
|
|
@ -209,15 +209,15 @@ public class ComplexQueryServiceImpl implements ComplexQueryService {
|
|||
totalPendingScrapNum = totalPendingScrapNum.add(retainedEquipmentInfo.getPendingScrapNum());
|
||||
totalScrapNum = totalScrapNum.add(retainedEquipmentInfo.getScrapNum());
|
||||
totalAllNum = totalAllNum.add(retainedEquipmentInfo.getAllNum());
|
||||
fiveReplacementNum = fiveReplacementNum.add(retainedEquipmentInfo.getFiveReplacementNum());
|
||||
/*fiveReplacementNum = fiveReplacementNum.add(retainedEquipmentInfo.getFiveReplacementNum());
|
||||
tenReplacementNum = tenReplacementNum.add(retainedEquipmentInfo.getTenReplacementNum());
|
||||
tenPlusReplacementNum = tenPlusReplacementNum.add(retainedEquipmentInfo.getTenPlusReplacementNum());
|
||||
tenPlusReplacementNum = tenPlusReplacementNum.add(retainedEquipmentInfo.getTenPlusReplacementNum());*/
|
||||
BigDecimal equipmentPrice = retainedEquipmentInfo.getAllNum()
|
||||
.multiply(retainedEquipmentInfo.getBuyPrice())
|
||||
.divide(new BigDecimal(10000), 2, RoundingMode.HALF_UP);
|
||||
totalPrice = totalPrice.add(equipmentPrice);
|
||||
BigDecimal allNum = retainedEquipmentInfo.getAllNum();
|
||||
if (allNum.compareTo(BigDecimal.ZERO) == 0) {
|
||||
/*if (allNum.compareTo(BigDecimal.ZERO) == 0) {
|
||||
fiveReplacementRate = "0%";
|
||||
tenReplacementRate = "0%";
|
||||
tenPlusReplacementRate = "0%";
|
||||
|
|
@ -234,13 +234,13 @@ public class ComplexQueryServiceImpl implements ComplexQueryService {
|
|||
.divide(allNum, 4, RoundingMode.HALF_DOWN)
|
||||
.multiply(new BigDecimal(100))
|
||||
.setScale(2, RoundingMode.HALF_UP) + "%";
|
||||
}
|
||||
}*/
|
||||
retainedEquipmentInfo.setTotalPrice(equipmentPrice);
|
||||
retainedEquipmentInfo.setFiveReplacementRate(fiveReplacementRate);
|
||||
/*retainedEquipmentInfo.setFiveReplacementRate(fiveReplacementRate);
|
||||
retainedEquipmentInfo.setTenReplacementRate(tenReplacementRate);
|
||||
retainedEquipmentInfo.setTenPlusReplacementRate(tenPlusReplacementRate);
|
||||
retainedEquipmentInfo.setTenPlusReplacementRate(tenPlusReplacementRate);*/
|
||||
}
|
||||
if (totalAllNum.compareTo(BigDecimal.ZERO) == 0) {
|
||||
/*if (totalAllNum.compareTo(BigDecimal.ZERO) == 0) {
|
||||
fiveReplacementRate = "0%";
|
||||
tenReplacementRate = "0%";
|
||||
tenPlusReplacementRate = "0%";
|
||||
|
|
@ -257,7 +257,7 @@ public class ComplexQueryServiceImpl implements ComplexQueryService {
|
|||
.divide(totalAllNum, 4, RoundingMode.HALF_DOWN)
|
||||
.multiply(new BigDecimal(100))
|
||||
.setScale(2, RoundingMode.HALF_UP) + "%";
|
||||
}
|
||||
}*/
|
||||
if (bean.getIsExport() == 0) {
|
||||
RetainedEquipmentInfo retainedEquipmentInfo = new RetainedEquipmentInfo();
|
||||
retainedEquipmentInfo.setStoreNum(totalStoreNum);
|
||||
|
|
@ -269,9 +269,9 @@ public class ComplexQueryServiceImpl implements ComplexQueryService {
|
|||
retainedEquipmentInfo.setScrapNum(totalScrapNum);
|
||||
retainedEquipmentInfo.setAllNum(totalAllNum);
|
||||
retainedEquipmentInfo.setTotalPrice(totalPrice);
|
||||
retainedEquipmentInfo.setFiveReplacementRate(fiveReplacementRate);
|
||||
/*retainedEquipmentInfo.setFiveReplacementRate(fiveReplacementRate);
|
||||
retainedEquipmentInfo.setTenReplacementRate(tenReplacementRate);
|
||||
retainedEquipmentInfo.setTenPlusReplacementRate(tenPlusReplacementRate);
|
||||
retainedEquipmentInfo.setTenPlusReplacementRate(tenPlusReplacementRate);*/
|
||||
retainedEquipmentInfo.setUnit("合计");
|
||||
recordList.add(0, retainedEquipmentInfo);
|
||||
}
|
||||
|
|
@ -397,6 +397,10 @@ public class ComplexQueryServiceImpl implements ComplexQueryService {
|
|||
Map<Long, UseStorageInfo> leaseInfoMap = Collections.emptyMap();
|
||||
if (!leaseIds.isEmpty()) {
|
||||
leaseInfoMap = complexQueryMapper.batchSelectInfo(leaseIds).stream()
|
||||
// 先过滤掉null元素,避免后续调用方法时空指针
|
||||
.filter(Objects::nonNull)
|
||||
// 再过滤LeaseId为null的元素
|
||||
.filter(info -> info.getLeaseId() != null)
|
||||
.collect(Collectors.toMap(
|
||||
UseStorageInfo::getLeaseId,
|
||||
info -> info,
|
||||
|
|
|
|||
|
|
@ -62,11 +62,15 @@ public class PushProDataUseInfoController extends BaseController {
|
|||
}
|
||||
}
|
||||
|
||||
// 查询七大类设备保有量、在用量、再修量、库存量
|
||||
/**
|
||||
* 查询七大类设备保有量、在用量、再修量、库存量
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "getNumsByStatics")
|
||||
public AjaxResult getNumsByStatics(ProIdsBean bean) {
|
||||
try {
|
||||
HashMap<String, Object> results = service.getNumsByStatics(bean);
|
||||
List<TotalNumsBean> results = service.getNumsByStatics(bean);
|
||||
return AjaxResult.success(results);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.toString(), e);
|
||||
|
|
|
|||
|
|
@ -21,9 +21,19 @@ public class ProIdsBean {
|
|||
private String proCenter;
|
||||
private Integer deptId;
|
||||
private BigDecimal typeNum;
|
||||
// 1 牵张设备 2 抱杆 3动力设备 4 变电专业设备 5安全工器具 6自主创新设备 7其他
|
||||
|
||||
/**
|
||||
* 1 牵张设备 2 抱杆 3动力设备 4 变电专业设备 5安全工器具 6自主创新设备 7其他
|
||||
*/
|
||||
private Integer isStatics;
|
||||
|
||||
// 0 检验临期 1 检验超期
|
||||
/**
|
||||
* 0 检验临期 1 检验超期
|
||||
*/
|
||||
private Integer type;
|
||||
|
||||
/**
|
||||
* 公司名称
|
||||
*/
|
||||
private String unitName;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,8 +14,24 @@ public class StaticsNumsBean {
|
|||
private BigDecimal useNum;
|
||||
private BigDecimal repairNum;
|
||||
private BigDecimal num;
|
||||
// 检验临期数量
|
||||
|
||||
/**
|
||||
* 检验临期数量
|
||||
*/
|
||||
private BigDecimal ApproachingNum;
|
||||
// 检验超期数量
|
||||
|
||||
/**
|
||||
* 检验超期数量
|
||||
*/
|
||||
private BigDecimal TimeoutNum;
|
||||
|
||||
/**
|
||||
* 1 牵张设备 2 抱杆 3动力设备 4 变电专业设备 5安全工器具 6自主创新设备 7其他
|
||||
*/
|
||||
private Integer isStatics;
|
||||
|
||||
/**
|
||||
* 单位名称
|
||||
*/
|
||||
private String unitName;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,47 @@
|
|||
package com.bonus.material.push.domain;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author:liang.chao
|
||||
* @Date:2025/8/23 - 16:29
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("装备总览")
|
||||
public class TotalNumsBean {
|
||||
|
||||
@ApiModelProperty(value = "装备总览")
|
||||
private BigDecimal total;
|
||||
|
||||
@ApiModelProperty("分层列表")
|
||||
List<SingleEquipmentStatistic> list;
|
||||
|
||||
/**
|
||||
* 单个分层
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("单个分层实体vo")
|
||||
public static class SingleEquipmentStatistic {
|
||||
|
||||
@ApiModelProperty("类别名称")
|
||||
private String equipmentName;
|
||||
|
||||
@ApiModelProperty("保有量")
|
||||
private BigDecimal inventoryNum;
|
||||
|
||||
@ApiModelProperty("在用量")
|
||||
private BigDecimal useNum;
|
||||
|
||||
@ApiModelProperty("维修数量")
|
||||
private BigDecimal repairNum;
|
||||
|
||||
@ApiModelProperty("库存量")
|
||||
private BigDecimal num;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,9 +1,6 @@
|
|||
package com.bonus.material.push.service;
|
||||
|
||||
import com.bonus.material.push.domain.InventoryAlertBean;
|
||||
import com.bonus.material.push.domain.ProIdsBean;
|
||||
import com.bonus.material.push.domain.MachineInfoBean;
|
||||
import com.bonus.material.push.domain.StaticsNumsBean;
|
||||
import com.bonus.material.push.domain.*;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
|
@ -22,7 +19,7 @@ public interface ProDataUseInfoService {
|
|||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
HashMap<String, Object> getNumsByStatics(ProIdsBean bean);
|
||||
List<TotalNumsBean> getNumsByStatics(ProIdsBean bean);
|
||||
|
||||
List<StaticsNumsBean> getApproachingAndTimeout(ProIdsBean bean);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,8 @@
|
|||
package com.bonus.material.push.service.impl;
|
||||
|
||||
import com.bonus.material.push.domain.InventoryAlertBean;
|
||||
import com.bonus.material.push.domain.MachineInfoBean;
|
||||
import com.bonus.material.push.domain.ProIdsBean;
|
||||
import com.alibaba.nacos.common.utils.CollectionUtils;
|
||||
import com.bonus.material.push.domain.*;
|
||||
|
||||
import com.bonus.material.push.domain.StaticsNumsBean;
|
||||
import com.bonus.material.push.mapper.ProDataUseInfoMapper;
|
||||
import com.bonus.material.push.service.ProDataUseInfoService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
|
@ -54,18 +52,18 @@ public class ProDataUseInfoImpl implements ProDataUseInfoService {
|
|||
* @return
|
||||
*/
|
||||
@Override
|
||||
public HashMap<String, Object> getNumsByStatics(ProIdsBean bean) {
|
||||
HashMap<String, Object> hashMap = new HashMap<>(2);
|
||||
public List<TotalNumsBean> getNumsByStatics(ProIdsBean bean) {
|
||||
TotalNumsBean totalNumsBean = new TotalNumsBean();
|
||||
List<TotalNumsBean> beans = new ArrayList<>();
|
||||
BigDecimal totalNum = BigDecimal.ZERO.setScale(3, RoundingMode.HALF_UP);
|
||||
List<StaticsNumsBean> list = proDataUseInfoMapper.getNumsByStatics(bean);
|
||||
for (StaticsNumsBean staticsNumsBean : list) {
|
||||
totalNum = totalNum.add(staticsNumsBean.getInventoryNum());
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
for (StaticsNumsBean staticsNumsBean : list) {
|
||||
totalNum = totalNum.add(staticsNumsBean.getInventoryNum());
|
||||
|
||||
}
|
||||
}
|
||||
//总数量
|
||||
hashMap.put("total", totalNum);
|
||||
// 数据集合
|
||||
hashMap.put("list", list);
|
||||
return hashMap;
|
||||
return beans;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -74,7 +74,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
IFNULL(subquery0.num, 0) + IFNULL(subquery1.usNum, 0) + IFNULL(subquery2.repairNum, 0)
|
||||
ELSE
|
||||
IFNULL(mt.storage_num, 0) + IFNULL(subquery1.usNum, 0) + IFNULL(subquery2.repairNum, 0)
|
||||
END AS inventoryNum
|
||||
END AS inventoryNum,
|
||||
subquery1.unitName AS unitName,
|
||||
mt2.is_statics AS isStatics
|
||||
FROM ma_type mt
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
|
|
@ -104,7 +106,8 @@ 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( sai.num, 0 )) AS usNum
|
||||
SUM(IFNULL( sai.num, 0 )) AS usNum,
|
||||
sd.dept_name AS unitName
|
||||
FROM
|
||||
slt_agreement_info sai
|
||||
left join bm_agreement_info bai on sai.agreement_id = bai.agreement_id
|
||||
|
|
@ -113,9 +116,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
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 sys_dept sd ON sd.dept_id = bp.imp_unit
|
||||
WHERE
|
||||
sai.`status` = '0' and sai.`is_slt` = '0'
|
||||
AND bp.pro_id = #{proId}
|
||||
<if test="unitName != null and unitName !=''">
|
||||
AND sd.dept_name = #{unitName}
|
||||
</if>
|
||||
<if test="proId != null">
|
||||
AND bp.pro_id = #{proId}
|
||||
</if>
|
||||
<if test="isStatics != null">
|
||||
and mt2.is_statics = #{isStatics}
|
||||
</if>
|
||||
AND sai.end_time IS NULL
|
||||
AND sai.back_id IS NULL
|
||||
GROUP BY mt.type_id
|
||||
|
|
@ -133,7 +145,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
mt.type_name AS typeModelName,
|
||||
SUM(
|
||||
IFNULL(rad.repair_num, 0) - IFNULL(rad.repaired_num, 0) -
|
||||
IFNULL(rad.scrap_num, 0)) AS repairNum
|
||||
IFNULL(rad.scrap_num, 0)) AS repairNum,
|
||||
sd.dept_name AS unitName
|
||||
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
|
||||
|
|
@ -143,9 +156,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
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 sys_dept sd ON sd.dept_id = bp.imp_unit
|
||||
WHERE
|
||||
rad.status = '0'
|
||||
AND bp.pro_id = #{proId}
|
||||
<if test="unitName != null and unitName !=''">
|
||||
AND sd.dept_name = #{unitName}
|
||||
</if>
|
||||
<if test="proId != null">
|
||||
AND bp.pro_id = #{proId}
|
||||
</if>
|
||||
<if test="isStatics != null">
|
||||
and mt2.is_statics = #{isStatics}
|
||||
</if>
|
||||
GROUP BY
|
||||
mt.type_id) AS subquery2 ON subquery2.type_id = mt.type_id
|
||||
LEFT JOIN ma_type mt2 on mt2.type_id = mt.parent_id
|
||||
|
|
|
|||
Loading…
Reference in New Issue