This commit is contained in:
hayu 2025-09-13 15:29:31 +08:00
parent 4bc97b87ac
commit 513d96dca7
4 changed files with 110 additions and 36 deletions

View File

@ -61,6 +61,9 @@ public class MaterialStorageInfo {
@ApiModelProperty(value = "关键字")
private String keyWord;
@ApiModelProperty(value = "班组id")
private String teamId;
@ApiModelProperty(value = "班组名称")
private String teamName;

View File

@ -214,4 +214,11 @@ public interface MaterialMachineMapper {
* @return
*/
List<MaterialRetainedEquipmentInfo> getUsInfoList(MaterialRetainedEquipmentInfo bean);
/**
* 获取材料站设备详情
* @param bean
* @return
*/
List<MaterialStorageInfo> getMaCodeDetails(MaterialStorageInfo bean);
}

View File

@ -20,6 +20,7 @@ import com.bonus.material.clz.domain.machine.MaterialStorageInfo;
import com.bonus.material.clz.mapper.MaterialMachineMapper;
import com.bonus.material.clz.service.MaterialMachineService;
import lombok.extern.slf4j.Slf4j;
import org.hibernate.validator.internal.util.StringHelper;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@ -173,16 +174,26 @@ public class MaterialMachineServiceImpl implements MaterialMachineService {
String subUnitName = iwsTeamUserMapper.getTeamName(materialRetainedEquipmentInfo.getTeamName());
materialRetainedEquipmentInfo.setSubUnitName(subUnitName);
}
// 数据合并
if (!CollectionUtils.isEmpty(recordList)) {
usList.addAll(recordList);
}
if (teamData != null) {
}
// 数据合并
if (!CollectionUtils.isEmpty(recordList)) {
usList.addAll(recordList);
}
if (!CollectionUtils.isEmpty(usList)){
if (teamData != null){
// 将sortedList中班组身份证号与username相同的元素过滤处理
usList = usList.stream()
.filter(item -> StringUtils.isBlank(item.getIdCard()) || username.equals(item.getIdCard()))
.collect(Collectors.toList());
}
String subUnitName = bean.getSubUnitName();
if (!CollectionUtils.isEmpty(usList)) {
usList = usList.stream()
.filter(item -> StringUtils.isBlank(subUnitName)
|| (item.getSubUnitName() != null && item.getSubUnitName().contains(subUnitName)))
.collect(Collectors.toList());
}
}
return usList;
}
@ -226,23 +237,31 @@ public class MaterialMachineServiceImpl implements MaterialMachineService {
@Override
public List<MaterialStorageInfo> getMaCodeList(MaterialStorageInfo bean) {
try {
// 查询库管员
List<MaterialStorageInfo> list = materialMachineMapper.getMaCodeList(bean);
MaterialUseStorageInfo materialUseStorageInfo = new MaterialUseStorageInfo();
materialUseStorageInfo.setProId(StringUtils.isNotBlank(bean.getProId()) ? bean.getProId() : null);
materialUseStorageInfo.setTypeId(bean.getTypeId() != null ? bean.getTypeId() : null);
List<MaterialUseStorageInfo> userList = materialMachineMapper.getUserRecords(materialUseStorageInfo);
if (CollectionUtils.isNotEmpty(list)) {
if (CollectionUtils.isNotEmpty(userList)) {
list.removeIf(info -> {
for (MaterialUseStorageInfo useStorageInfo : userList) {
if (info.getMaId().equals(useStorageInfo.getMaId())) {
return true;
}
}
return false;
});
}
// // 查询库管员
// List<MaterialStorageInfo> list = materialMachineMapper.getMaCodeList(bean);
// MaterialUseStorageInfo materialUseStorageInfo = new MaterialUseStorageInfo();
// materialUseStorageInfo.setProId(StringUtils.isNotBlank(bean.getProId()) ? bean.getProId() : null);
// materialUseStorageInfo.setTypeId(bean.getTypeId() != null ? bean.getTypeId() : null);
// List<MaterialUseStorageInfo> userList = materialMachineMapper.getUserRecords(materialUseStorageInfo);
// if (CollectionUtils.isNotEmpty(list)) {
// if (CollectionUtils.isNotEmpty(userList)) {
// list.removeIf(info -> {
// for (MaterialUseStorageInfo useStorageInfo : userList) {
// if (info.getMaId()!=null && useStorageInfo.getMaId()!=null){
// if (info.getMaId().equals(useStorageInfo.getMaId())) {
// return true;
// }
// }
// }
// return false;
// });
// }
// }
List<MaterialStorageInfo> list = new ArrayList<>();
if (!StringHelper.isNullOrEmptyString(bean.getTeamId())){
list = materialMachineMapper.getMaCodeDetails(bean);
} else {
list = materialMachineMapper.getMaCodeList(bean);
}
if (CollectionUtils.isNotEmpty(list)) {
for (MaterialStorageInfo useStorageInfo : list) {

View File

@ -1197,7 +1197,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
IFNULL(subquery3.usNum, 0) AS usNum,
IFNULL(subquery1.usNum, 0) AS allNum,
subquery1.proCenter AS departName,
subquery1.departName AS impUnitName
subquery1.departName AS impUnitName,
CASE mt.manage_type
WHEN 0 THEN
'编码'
ELSE
'数量'
END manageType
FROM ma_type mt
LEFT JOIN (
SELECT
@ -1278,19 +1284,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
WHERE mt.`level` = 4 and mt.del_flag = '0'
AND IFNULL(subquery1.usNum, 0) - IFNULL(subquery3.usNum, 0) > 0
<if test="impUnitName != null and impUnitName != ''">
AND subquery1.departName = #{impUnitName}
AND subquery1.departName like concat('%',#{impUnitName},'%')
</if>
<if test="proName != null and proName != ''">
AND subquery1.proName = #{proName}
AND subquery1.proName like concat('%',#{proName},'%')
</if>
<if test="departName != null and departName != ''">
AND subquery1.proCenter = #{departName}
AND subquery1.proCenter like concat('%',#{departName},'%')
</if>
<if test="typeName != null and typeName != ''">
AND mt2.type_name = #{typeName}
AND mt2.type_name like concat('%',#{typeName},'%')
</if>
<if test="typeModelName != null and typeModelName != ''">
AND mt.type_name = #{typeModelName}
AND mt.type_name like concat('%',#{typeModelName},'%')
</if>
<if test="projectIdList != null and projectIdList.size() > 0">
and subquery1.externalId in
@ -1306,7 +1312,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="getUsInfoList" resultType="com.bonus.material.clz.domain.vo.MaterialRetainedEquipmentInfo">
SELECT
mt.type_id,
mt.type_id as typeId,
mt4.type_name AS constructionType,
mt4.type_id AS firstTypeId,
mt3.type_name AS materialType,
@ -1315,6 +1321,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
mt2.type_id AS thirdTypeId,
mt.type_name AS typeModelName,
SUM(IFNULL( sai.num, 0 )) AS allNum,
bu.unit_id as teamId,
bu.unit_name AS teamName,
bp.pro_name as proName,
bp.pro_id as proId,
@ -1323,7 +1330,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
bu.bzz_idcard AS idCard,
bp.pro_center AS departName,
mt.unit_name AS unit,
sd.dept_name AS impUnitName
sd.dept_name AS impUnitName,
CASE mt.manage_type
WHEN 0 THEN
'编码'
ELSE
'数量'
END manageType
FROM
clz_slt_agreement_info sai
LEFT JOIN ma_type mt ON mt.type_id = sai.type_id
@ -1341,22 +1354,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND bu.unit_name is not null
AND bp.external_id is not NULL
<if test="impUnitName != null and impUnitName != ''">
AND sd.dept_name = #{impUnitName}
AND sd.dept_name like concat('%',#{impUnitName},'%')
</if>
<if test="proName != null and proName != ''">
AND bp.pro_name = #{proName}
AND bp.pro_name like concat('%',#{proName},'%')
</if>
<if test="departName != null and departName != ''">
AND bp.pro_center = #{departName}
AND bp.pro_center like concat('%',#{departName},'%')
</if>
<if test="teamName != null and teamName != ''">
AND bu.unit_name = #{teamName}
AND bu.unit_name like concat('%',#{teamName},'%')
</if>
<if test="typeName != null and typeName != ''">
AND mt2.type_name = #{typeName}
AND mt2.type_name like concat('%',#{typeName},'%')
</if>
<if test="typeModelName != null and typeModelName != ''">
AND mt.type_name = #{typeModelName}
AND mt.type_name like concat('%',#{typeModelName},'%')
</if>
<if test="projectIdList != null and projectIdList.size() > 0">
and bp.external_id in
@ -1371,5 +1384,37 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
bu.unit_name,
bp.pro_name
</select>
<select id="getMaCodeDetails" resultType="com.bonus.material.clz.domain.machine.MaterialStorageInfo">
SELECT mt2.type_name AS typeName,
mt.type_name AS typeModelName,
mt.lease_price AS buyPrice,
sai.num AS storeNum,
mm.ma_code AS maCode,
bt.unit_name AS teamName,
sai.lease_id AS leaseId,
sai.type_id AS typeId,
lai.code AS code,
sai.ma_id AS maId
FROM clz_slt_agreement_info sai
LEFT JOIN ma_type mt ON mt.type_id = sai.type_id
LEFT JOIN ma_type mt2 ON mt.parent_id = mt2.type_id
LEFT JOIN ma_machine mm ON mm.ma_id = sai.ma_id
LEFT JOIN clz_bm_agreement_info bai ON bai.agreement_id = sai.agreement_id
LEFT JOIN bm_unit bt ON bai.unit_id = bt.unit_id AND bt.del_flag = '0'
LEFT JOIN lease_apply_info lai ON lai.id = sai.lease_id
LEFT JOIN bm_project bp ON bai.project_id = bp.pro_id
WHERE sai.status = '0'
AND sai.end_time IS NULL
AND sai.back_id IS NULL
<if test="typeId !=null ">
AND sai.type_id = #{typeId}
</if>
<if test="proId !=null ">
AND bp.pro_id = #{proId}
</if>
<if test="teamId !=null ">
AND bt.unit_id = #{teamId}
</if>
</select>
</mapper>