修改bug

This commit is contained in:
yangjun 2026-03-10 13:23:32 +08:00
parent 8044157d1d
commit 627d492f69
2 changed files with 64 additions and 56 deletions

View File

@ -698,6 +698,17 @@ public class EmployeesMQListener {
employeesInfoService.save(employeesInfo);
//审核通过 - 给员工添加账号
JSONObject deptInfo = sysBaseAPI.getDeptInfo();
JSONObject j = new JSONObject();
j.put("userName", employeesInfo.getTel());
j.put("realname", employeesInfo.getName());
j.put("orgCode", deptInfo.getString("id"));//这个参数要的是机构的id
j.put("opeType", "employee");
j.put("o_c_", deptInfo.getString("code"));
j.put("employees_id", dto.getEmployeeId());
employeesApplyService.initialization(j);
//去管理平台拉取资源
// {
// BizEmployeesInfo mediaData = new BizEmployeesInfo();

View File

@ -20,8 +20,10 @@ import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
/**
@ -84,53 +86,19 @@ public class ConfigSuppliersInfoServiceImpl extends ServiceImpl<ConfigSuppliersI
if (xsList == null || xsList.isEmpty()) {
return;
}
// 取两个列表的交集并设置suppliersId
List<ConfigMaterialInfo> commonList = wlList.stream()
.filter(wl -> wl != null) // 过滤掉null的物料
.filter(wl -> xsList.stream()
.filter(xs -> xs != null) // 过滤掉null的供应商物料
.anyMatch(xs -> {
// 安全的字段比较允许null值
// boolean materialNameMatch = (wl.getMaterialName() == null && xs.getMaterialName() == null) ||
// (wl.getMaterialName() != null && xs.getMaterialName() != null &&
// wl.getMaterialName().equals(xs.getMaterialName()));
//
// boolean specificationModelMatch = (wl.getSpecificationModel() == null && xs.getSpecificationModel() == null) ||
// (wl.getSpecificationModel() != null && xs.getSpecificationModel() != null &&
// wl.getSpecificationModel().equals(xs.getSpecificationModel()));
//
// boolean brandTypeMatch = (wl.getBrandType() == null && xs.getBrandType() == null) ||
// (wl.getBrandType() != null && xs.getBrandType() != null &&
// wl.getBrandType().equals(xs.getBrandType()));
return true;
})
)
.map(wl -> {
// 找到对应的xs项目
NuBizSuppliersMaterialInfo matchedXs = xsList.stream()
.filter(xs -> xs != null)
// .filter(xs -> {
// // 同样的匹配逻辑
// boolean materialNameMatch = (wl.getMaterialName() == null && xs.getMaterialName() == null) ||
// (wl.getMaterialName() != null && xs.getMaterialName() != null &&
// wl.getMaterialName().equals(xs.getMaterialName()));
//
// boolean specificationModelMatch = (wl.getSpecificationModel() == null && xs.getSpecificationModel() == null) ||
// (wl.getSpecificationModel() != null && xs.getSpecificationModel() != null &&
// wl.getSpecificationModel().equals(xs.getSpecificationModel()));
//
// boolean brandTypeMatch = (wl.getBrandType() == null && xs.getBrandType() == null) ||
// (wl.getBrandType() != null && xs.getBrandType() != null &&
// wl.getBrandType().equals(xs.getBrandType()));
//
// return materialNameMatch && specificationModelMatch && brandTypeMatch;
// })
List<ConfigMaterialInfo> inList = new ArrayList<>();
for (NuBizSuppliersMaterialInfo xs : xsList) {
ConfigMaterialInfo wl = wlList.stream()
.filter(wl1 -> Objects.equals(wl1.getMaterialName(), xs.getMaterialName())
&& Objects.equals(wl1.getSpecificationModel(), xs.getSpecificationModel())
&& Objects.equals(wl1.getBrandType(), xs.getBrandType()))
.findFirst()
.orElse(null);
if (matchedXs != null && matchedXs.getId() != null) {
if (wl != null) {
inList.add(wl);
}
}
for(ConfigMaterialInfo wl : inList){
String suppliers = wl.getSuppliers();
if (StringUtils.isEmpty( suppliers)) {
suppliers = configSuppliersInfo.getId();
@ -140,8 +108,37 @@ public class ConfigSuppliersInfoServiceImpl extends ServiceImpl<ConfigSuppliersI
wl.setSuppliers(suppliers);
configMaterialInfoService.updateById(wl);
}
return wl;
})
.collect(Collectors.toList());
// 取两个列表的交集并设置suppliersId
// List<ConfigMaterialInfo> commonList = wlList.stream()
// .filter(wl -> wl != null) // 过滤掉null的物料
// .filter(wl -> xsList.stream()
// .filter(xs -> xs != null) // 过滤掉null的供应商物料
// .anyMatch(xs -> {
// return true;
// })
// )
// .map(wl -> {
// // 找到对应的xs项目
// NuBizSuppliersMaterialInfo matchedXs = xsList.stream()
// .filter(xs -> xs != null)
// .findFirst()
// .orElse(null);
//
// if (matchedXs != null && matchedXs.getId() != null) {
// String suppliers = wl.getSuppliers();
// if (StringUtils.isEmpty( suppliers)) {
// suppliers = configSuppliersInfo.getId();
// }else{
// suppliers = suppliers +","+configSuppliersInfo.getId();
// }
// wl.setSuppliers(suppliers);
// configMaterialInfoService.updateById(wl);
// }
// return wl;
// })
// .collect(Collectors.toList());
}
}