|
@@ -31,6 +31,7 @@ import org.springframework.web.bind.annotation.RequestBody;
|
|
|
import javax.transaction.xa.XAException;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
+import java.util.Objects;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
@@ -131,6 +132,7 @@ public class IprPersonService extends ServiceImpl<IprPersonMapper, IprPerson> {
|
|
|
List<IprPerson> iprPersonList = new ArrayList<>();
|
|
|
String name = queryIprPersonDTO.getName();
|
|
|
String email = queryIprPersonDTO.getEmail();
|
|
|
+ Integer type = queryIprPersonDTO.getType();
|
|
|
Boolean ifDefault = queryIprPersonDTO.getIfDefault();
|
|
|
Long current = queryIprPersonDTO.getCurrent();
|
|
|
Long size = queryIprPersonDTO.getSize();
|
|
@@ -147,6 +149,9 @@ public class IprPersonService extends ServiceImpl<IprPersonMapper, IprPerson> {
|
|
|
if (email != null && !email.trim().equals("")) {
|
|
|
queryWrapper.like(IprPerson::getEmail, email);
|
|
|
}
|
|
|
+ if (type != null) {
|
|
|
+ queryWrapper.eq(IprPerson::getType, type);
|
|
|
+ }
|
|
|
if (ifDefault != null) {
|
|
|
queryWrapper.eq(IprPerson::getIfDefault, ifDefault);
|
|
|
}
|
|
@@ -172,17 +177,26 @@ public class IprPersonService extends ServiceImpl<IprPersonMapper, IprPerson> {
|
|
|
return queryIprPersonVOS;
|
|
|
}
|
|
|
List<Personnel> personnels = new ArrayList<>();
|
|
|
- List<String> createIds = iprPersonList.stream().map(IprPerson::getCreateId).collect(Collectors.toList());
|
|
|
+ List<String> createIds = iprPersonList.stream()
|
|
|
+ .map(IprPerson::getCreateId)
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ List<String> assoAccountStrIds = iprPersonList.stream()
|
|
|
+ .map(IprPerson::getAssoAccountId)//提取Integer
|
|
|
+ .filter(Objects::nonNull)//过滤null值
|
|
|
+ .map(String::valueOf)//转换为String
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ createIds.addAll(assoAccountStrIds);
|
|
|
+
|
|
|
if (!CollectionUtils.isEmpty(createIds)) {
|
|
|
try {
|
|
|
String res = permissionService.getPersonnelByIdsFromPCS(createIds);
|
|
|
JSONObject jsonObject = JSON.parseObject(res);
|
|
|
personnels = JSONObject.parseArray(jsonObject.getString("data"), Personnel.class);
|
|
|
} catch (Exception e) {
|
|
|
+ throw new XiaoShiException(ExceptionEnum.BUSINESS_ERROR, "人员查询错误");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
for (IprPerson iprPerson : iprPersonList) {
|
|
|
QueryIprPersonVO queryIprPersonVO = new QueryIprPersonVO();
|
|
|
BeanUtils.copyProperties(iprPerson, queryIprPersonVO);
|
|
@@ -200,6 +214,22 @@ public class IprPersonService extends ServiceImpl<IprPersonMapper, IprPerson> {
|
|
|
if (personnel != null) {
|
|
|
queryIprPersonVO.setCreateName(personnel.getPersonnelName());
|
|
|
}
|
|
|
+
|
|
|
+ Personnel assoAccount = personnels.stream()
|
|
|
+ .filter(item -> {
|
|
|
+ // 获取Integer类型的关联id
|
|
|
+ Integer targetId = iprPerson.getAssoAccountId();
|
|
|
+ // 当目标id为空时 直接跳过匹配
|
|
|
+ if (targetId == null) return false;
|
|
|
+ // 将Integer转换为String进行比较
|
|
|
+ return String.valueOf(targetId).equals(item.getId());
|
|
|
+ })
|
|
|
+ .findFirst()
|
|
|
+ .orElse(null);
|
|
|
+ if (assoAccount != null) {
|
|
|
+ queryIprPersonVO.setAccountName(personnel.getPersonnelName());
|
|
|
+ queryIprPersonVO.setAccountUserName(personnel.getPersonnelUserName());
|
|
|
+ }
|
|
|
queryIprPersonVOS.add(queryIprPersonVO);
|
|
|
}
|
|
|
return queryIprPersonVOS;
|