diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/service/impl/BmTeamServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/service/impl/BmTeamServiceImpl.java index 273e5c44..1c15d208 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/service/impl/BmTeamServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/service/impl/BmTeamServiceImpl.java @@ -129,15 +129,20 @@ public class BmTeamServiceImpl implements BmTeamService { @Override public AjaxResult getList(BmTeam tbTeam) { - List iwsTeamUserVos = iwsTeamUserMapper.selectProjectTeamInfoByIdCard(tbTeam.getIdCard()); - if (CollectionUtil.isNotEmpty(iwsTeamUserVos)) { - return AjaxResult.success(iwsTeamUserVos); + List iwsTeamUserVos = new ArrayList<>(); + if (StringUtils.isNotBlank(tbTeam.getIdCard())) { + iwsTeamUserVos = iwsTeamUserMapper.selectProjectTeamInfoByIdCard(tbTeam.getIdCard()); + if (CollectionUtil.isNotEmpty(iwsTeamUserVos)) { + return AjaxResult.success(iwsTeamUserVos); + } } // 根据i8工程id查询班组信息 - List ids = Collections.singletonList(tbTeam.getProjectId()); - iwsTeamUserVos = iwsTeamUserMapper.selectProjectTeamInfoByProjectIds(ids); - if (CollectionUtil.isNotEmpty(iwsTeamUserVos)) { - return AjaxResult.success(iwsTeamUserVos); + if (StringUtils.isNotBlank(tbTeam.getProjectId())) { + List ids = Collections.singletonList(tbTeam.getProjectId()); + iwsTeamUserVos = iwsTeamUserMapper.selectProjectTeamInfoByProjectIds(ids); + if (CollectionUtil.isNotEmpty(iwsTeamUserVos)) { + return AjaxResult.success(iwsTeamUserVos); + } } return AjaxResult.success(new ArrayList<>()); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/service/impl/MaterialBackApplyInfoServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/service/impl/MaterialBackApplyInfoServiceImpl.java index 89beb5f3..80cdbbe1 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/service/impl/MaterialBackApplyInfoServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/service/impl/MaterialBackApplyInfoServiceImpl.java @@ -336,16 +336,15 @@ public class MaterialBackApplyInfoServiceImpl implements MaterialBackApplyInfoSe // 先查第四层类型 List listL4 = materialBackInfoMapper.getUseTypeTreeL4(backApplyInfo); for (MaterialBackApplyDetails details : backApplyDetailsList) { + // 将listL4转换为Map以typeId为键,提高查询效率 + Map typeNumMap = new HashMap<>(); if (CollectionUtils.isNotEmpty(listL4)) { for (TypeTreeNode node : listL4) { - if (node.getTypeId() == details.getTypeId()) { - details.setNum(node.getNum()); - break; - } + typeNumMap.put(node.getTypeId(), node.getNum()); } - } else { - details.setNum(BigDecimal.ZERO); } + // 从Map中获取num,不存在则设为0 + details.setNum(typeNumMap.getOrDefault(details.getTypeId(), BigDecimal.ZERO)); // 为每个退料详情设置附件信息 setBmFileInfosForDetails(details, bmFileInfos); // 如果是编码设备,查询并设置相关的编码信息和附件 @@ -462,7 +461,7 @@ public class MaterialBackApplyInfoServiceImpl implements MaterialBackApplyInfoSe // 保存退料信息到 tm_task 表中 result += taskMapper.insertTmTask(tmTask); if (result > 0) { - TmTaskAgreement tmTaskAgreement = new TmTaskAgreement(tmTask.getTaskId(), dto.getBackApplyInfo().getAgreementId()); + TmTaskAgreement tmTaskAgreement = new TmTaskAgreement(tmTask.getTaskId(), Long.valueOf(dto.getBackApplyInfo().getAgreementIds().get(0))); tmTaskAgreement.setCreateTime(DateUtils.getNowDate()); tmTaskAgreement.setCreateBy(createBy); // 增加任务和协议关联表数据 diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/clz/MaterialBackInfoMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/clz/MaterialBackInfoMapper.xml index 7340be24..88be8ad3 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/clz/MaterialBackInfoMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/clz/MaterialBackInfoMapper.xml @@ -594,9 +594,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" FROM clz_slt_agreement_info WHERE - agreement_id = #{agreementId} + status = 0 + + AND agreement_id in + + #{item} + + AND type_id = #{typeId} - AND status = 0 AND ma_id = #{maId} diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/lease/LeaseApplyDetailsMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/lease/LeaseApplyDetailsMapper.xml index 9a6ff674..91b8167d 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/lease/LeaseApplyDetailsMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/lease/LeaseApplyDetailsMapper.xml @@ -233,7 +233,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"