材料站优化
This commit is contained in:
parent
e7cecc89f3
commit
99b47f9fed
|
|
@ -1830,16 +1830,13 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService {
|
|||
// 第1步:从协议中获取总领料数量(原listL5逻辑)
|
||||
Map<Long, BigDecimal> totalLeaseNums = new HashMap<>();
|
||||
if (!CollectionUtils.isEmpty(agreementList)) {
|
||||
for (AgreementVo agreementVo : agreementList) {
|
||||
BackApplyInfo backApplyInfo = new BackApplyInfo();
|
||||
backApplyInfo.setAgreementId(Long.valueOf(agreementVo.getAgreementId()));
|
||||
List<TypeTreeNode> listL4 = mapper.getUseTypeTreeL4(backApplyInfo);
|
||||
|
||||
if (!CollectionUtils.isEmpty(listL4)) {
|
||||
for (TypeTreeNode node : listL4) {
|
||||
if (node.getTypeId() != 0L && node.getNum() != null) {
|
||||
totalLeaseNums.merge(node.getTypeId(), node.getNum(), BigDecimal::add);
|
||||
}
|
||||
// 获取agreementList中的协议id集合
|
||||
List<Long> agreementIds = agreementList.stream().map(agreementVo -> Long.valueOf(agreementVo.getAgreementId())).collect(Collectors.toList());
|
||||
List<TypeTreeNode> listL4 = mapper.getTeamClzTree(agreementIds);
|
||||
if (!CollectionUtils.isEmpty(listL4)) {
|
||||
for (TypeTreeNode node : listL4) {
|
||||
if (node.getTypeId() != 0L && node.getNum() != null) {
|
||||
totalLeaseNums.merge(node.getTypeId(), node.getNum(), BigDecimal::add);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1852,15 +1849,11 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService {
|
|||
List<BmAgreementInfo> listAgreement = materialLeaseInfoMapper.getAgreementIdByProId(bean);
|
||||
|
||||
if (!CollectionUtils.isEmpty(listAgreement)) {
|
||||
for (BmAgreementInfo agreementInfo : listAgreement) {
|
||||
bean.setAgreementId(agreementInfo.getAgreementId());
|
||||
List<TypeTreeNode> list6 = materialLeaseInfoMapper.getUseTypeTree(bean);
|
||||
|
||||
if (!CollectionUtils.isEmpty(list6)) {
|
||||
for (TypeTreeNode node : list6) {
|
||||
if (node.getTypeId() != 0L && node.getNum() != null) {
|
||||
usedNums.merge(node.getTypeId(), node.getNum(), BigDecimal::add);
|
||||
}
|
||||
List<TypeTreeNode> list6 = materialLeaseInfoMapper.getPlUseTypeTree(listAgreement);
|
||||
if (!CollectionUtils.isEmpty(list6)) {
|
||||
for (TypeTreeNode node : list6) {
|
||||
if (node.getTypeId() != 0L && node.getNum() != null) {
|
||||
usedNums.merge(node.getTypeId(), node.getNum(), BigDecimal::add);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -793,7 +793,6 @@ public class MaterialMachineServiceImpl implements MaterialMachineService {
|
|||
|
||||
//查询目前还有库存的设备
|
||||
List<MaterialRetainedEquipmentInfo> recordList = materialMachineMapper.getRetainInfoList(bean);
|
||||
List<MaterialRetainedEquipmentInfo> infos = new ArrayList<>();
|
||||
if (CollectionUtils.isNotEmpty(recordList)) {
|
||||
inCountNum = recordList.stream()
|
||||
.filter(item -> "0".equals(item.getUnitValue()))
|
||||
|
|
@ -811,17 +810,6 @@ public class MaterialMachineServiceImpl implements MaterialMachineService {
|
|||
.filter(Objects::nonNull)
|
||||
.distinct()
|
||||
.count());
|
||||
// 获取集合中departName不为空,且去重的数据存放在新集合中
|
||||
List<MaterialRetainedEquipmentInfo> distinctDepartNames = recordList.stream()
|
||||
// 过滤出departName不为空的元素
|
||||
.filter(entity -> StringUtils.isNotBlank(entity.getDepartName()))
|
||||
// 根据departName进行去重
|
||||
.distinct()
|
||||
// 收集到新的List集合中
|
||||
.collect(Collectors.toList());
|
||||
if (CollectionUtils.isNotEmpty(distinctDepartNames)) {
|
||||
infos.addAll(distinctDepartNames);
|
||||
}
|
||||
} else {
|
||||
info.setProNum(0);
|
||||
}
|
||||
|
|
@ -834,26 +822,12 @@ public class MaterialMachineServiceImpl implements MaterialMachineService {
|
|||
.filter(Objects::nonNull)
|
||||
.distinct()
|
||||
.count());
|
||||
// 获取集合中departName不为空,且去重的数据存放在新集合中
|
||||
List<MaterialRetainedEquipmentInfo> userInfoList = usList.stream()
|
||||
// 过滤出departName不为空的元素
|
||||
.filter(entity -> StringUtils.isNotBlank(entity.getDepartName()))
|
||||
// 根据departName进行去重
|
||||
.distinct()
|
||||
// 收集到新的List集合中
|
||||
.collect(Collectors.toList());
|
||||
if (CollectionUtils.isNotEmpty(userInfoList)) {
|
||||
infos.addAll(userInfoList);
|
||||
}
|
||||
} else {
|
||||
info.setTeamNum(0);
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(infos)) {
|
||||
info.setDepartNum((int) infos.stream()
|
||||
.map(MaterialRetainedEquipmentInfo::getDepartName)
|
||||
.filter(Objects::nonNull)
|
||||
.distinct()
|
||||
.count());
|
||||
List<MaterialRetainedEquipmentInfo> departNameList = materialMachineMapper.getDepartNameList(bean);
|
||||
if (CollectionUtils.isNotEmpty(departNameList)) {
|
||||
info.setDepartNum(departNameList.size());
|
||||
} else {
|
||||
info.setDepartNum(0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -770,8 +770,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
LEFT JOIN sys_dept sd ON sd.dept_id = bp.imp_unit
|
||||
WHERE
|
||||
sai.`status` = '0'
|
||||
AND mm.ma_status = 2
|
||||
AND mt.jiju_type = 2
|
||||
AND sai.ma_id IS NOT NULL
|
||||
AND mt2.type_id not in (6032,6008,6270,6012,6761)
|
||||
<if test="impUnitName != null and impUnitName != ''">
|
||||
and sd.dept_name LIKE CONCAT('%', #{impUnitName}, '%')
|
||||
</if>
|
||||
|
|
@ -1597,14 +1599,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</select>
|
||||
|
||||
<select id="getDepartNameList" resultType="com.bonus.material.clz.domain.vo.MaterialRetainedEquipmentInfo">
|
||||
SELECT
|
||||
DISTINCT df.project_dept AS departName
|
||||
SELECT DISTINCT
|
||||
sp.`name` AS departName
|
||||
FROM
|
||||
bm_project bp
|
||||
LEFT JOIN sys_dept sd ON sd.dept_id = bp.imp_unit
|
||||
LEFT JOIN data_center.dx_fb_son df ON bp.external_id = df.id
|
||||
LEFT JOIN sys_dept sd ON sd.dept_id = bp.imp_unit
|
||||
LEFT JOIN sbd_audit.sg_project_department sp ON sd.company_code = sp.parent_id
|
||||
WHERE
|
||||
df.project_dept IS NOT NULL
|
||||
sp.`name` IS NOT NULL
|
||||
AND sp.`status` = 1
|
||||
<if test="impUnitName != null and impUnitName != ''">
|
||||
AND sd.dept_name LIKE CONCAT('%', #{impUnitName}, '%')
|
||||
</if>
|
||||
|
|
@ -1612,7 +1615,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
AND bp.pro_name LIKE CONCAT('%', #{proName}, '%')
|
||||
</if>
|
||||
<if test="departName != null and departName != ''">
|
||||
AND df.project_dept LIKE CONCAT('%', #{departName}, '%')
|
||||
AND sp.`name` LIKE CONCAT('%', #{departName}, '%')
|
||||
</if>
|
||||
<if test="projectIdList != null and projectIdList.size() > 0">
|
||||
AND bp.external_id in
|
||||
|
|
@ -1623,7 +1626,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="impUnit != null and impUnit != ''">
|
||||
AND bp.imp_unit = #{impUnit}
|
||||
</if>
|
||||
GROUP BY bp.pro_center
|
||||
GROUP BY sp.`name`
|
||||
</select>
|
||||
|
||||
<select id="getProjectList" resultType="com.bonus.material.clz.domain.vo.MaterialRetainedEquipmentInfo">
|
||||
|
|
|
|||
Loading…
Reference in New Issue