材料站

This commit is contained in:
mashuai 2025-07-10 09:22:11 +08:00
parent 93378c0796
commit 4fbaa07ccf
2 changed files with 36 additions and 25 deletions

View File

@ -16,6 +16,7 @@ import com.bonus.material.clz.mapper.BmTeamMapper;
import com.bonus.material.clz.mapper.MaterialMachineMapper;
import com.bonus.material.clz.service.MaterialMachineService;
import lombok.extern.slf4j.Slf4j;
import org.apache.http.client.utils.DateUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@ -349,7 +350,6 @@ public class MaterialMachineServiceImpl implements MaterialMachineService {
*/
@Override
public List<MaterialRetainedEquipmentInfo> getTeamWarnDetailsList(MaterialRetainedEquipmentInfo bean) {
String username = SecurityUtils.getLoginUser().getUsername();
List<MaterialRetainedEquipmentInfo> list = materialMachineMapper.getTeamUseNumDetailsList(bean);
Long deptId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
if (!CollectionUtils.isEmpty(list) && deptId != null) {
@ -359,29 +359,25 @@ public class MaterialMachineServiceImpl implements MaterialMachineService {
if (CollectionUtils.isEmpty(list)) {
return new ArrayList<>();
}
// 根据用户名判断用户是否为班组长
BmTeam teamData = materialMachineMapper.getTeamData(username);
if (!CollectionUtils.isEmpty(list)) {
if (teamData != null) {
// 将sortedList中班组身份证号与username相同的元素过滤处理
list = list.stream()
.filter(item -> StringUtils.isBlank(item.getIdCard()) || username.equals(item.getIdCard()))
.collect(Collectors.toList());
if (!CollectionUtil.isEmpty(list)) {
list = getMaterialRetainedEquipmentInfos(list);
if (StringUtils.isNotBlank(bean.getStatus())) {
return list.stream().filter(item -> {
return item.getStatus().equals(bean.getStatus());
}).collect(Collectors.toList());
}
return list;
}
} else {
list = filterInfo(list, username);
for (MaterialRetainedEquipmentInfo info : list) {
// 处理thisCheckTime
if (StringUtils.isNotBlank(info.getThisCheckTime())) {
// 提取日期部分假设格式为"yyyy-MM-dd HH:mm:ss"
String[] parts = info.getThisCheckTime().split(" ");
if (parts.length > 0) {
info.setThisCheckTime(parts[0]);
}
}
// 处理nextCheckTime
if (StringUtils.isNotBlank(info.getNextCheckTime())) {
String[] parts = info.getNextCheckTime().split(" ");
if (parts.length > 0) {
info.setNextCheckTime(parts[0]);
}
}
}
if (!CollectionUtil.isEmpty(list)) {
list = getMaterialRetainedEquipmentInfos(list);
if (StringUtils.isNotBlank(bean.getStatus())) {
return list.stream().filter(item -> {
return item.getStatus().equals(bean.getStatus());
@ -648,6 +644,21 @@ public class MaterialMachineServiceImpl implements MaterialMachineService {
retainedEquipmentInfo.setStatus("0");
}
}
// 处理thisCheckTime
if (StringUtils.isNotBlank(retainedEquipmentInfo.getThisCheckTime())) {
// 提取日期部分假设格式为"yyyy-MM-dd HH:mm:ss"
String[] parts = retainedEquipmentInfo.getThisCheckTime().split(" ");
if (parts.length > 0) {
retainedEquipmentInfo.setThisCheckTime(parts[0]);
}
}
// 处理nextCheckTime
if (StringUtils.isNotBlank(retainedEquipmentInfo.getNextCheckTime())) {
String[] parts = retainedEquipmentInfo.getNextCheckTime().split(" ");
if (parts.length > 0) {
retainedEquipmentInfo.setNextCheckTime(parts[0]);
}
}
}
if (StringUtils.isNotBlank(bean.getStatus())) {
return list.stream().filter(item -> {

View File

@ -280,10 +280,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="typeId != null">
and mt2.type_id = #{typeId}
</if>
<if test="teamId != null">
<if test="teamId != null and teamId != ''">
AND bt.unit_id = #{teamId}
</if>
<if test="teamName != null">
<if test="teamName != null and teamName != ''">
AND bt.unit_name LIKE concat('%',#{teamName},'%')
</if>
<if test="keyWord != null and keyWord != ''">
@ -514,7 +514,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LEFT JOIN bm_agreement_info bai ON sai.agreement_id = bai.agreement_id
LEFT JOIN bm_unit bt ON bai.unit_id = bt.unit_id
LEFT JOIN ma_type mt ON mt.type_id = sai.type_id
LEFT JOIN ma_type mt1 ON mt1.parent_id = mt1.type_id
LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id
LEFT JOIN ma_machine mm ON mm.ma_id = sai.ma_id
WHERE
sai.status = '0'