|
|
@@ -401,12 +401,10 @@ public class KwmCooperateManageService {
|
|
|
}
|
|
|
|
|
|
List<FindCooperateByEntResVo> list = new ArrayList<>();
|
|
|
- Long currentEntId = LoginUserHolder.getEntId();
|
|
|
for (KwmCooperate kwmCooperate : kwmCooperates) {
|
|
|
FindCooperateByEntResVo findCooperateByEntResVo = new FindCooperateByEntResVo();
|
|
|
findCooperateByEntResVo.setId(kwmCooperate.getId());
|
|
|
|
|
|
-
|
|
|
//设置合作属性
|
|
|
List<KwmCooperateType> kwmCooperateTypes1 = collect.get(kwmCooperate.getId());
|
|
|
if (CollectionUtils.isNotEmpty(kwmCooperateTypes1)) {
|
|
|
@@ -425,8 +423,13 @@ public class KwmCooperateManageService {
|
|
|
String inviterEntName = Objects.isNull(inviterEntCacheResDto) ? null : inviterEntCacheResDto.getFirmName();
|
|
|
String inviteeEntName = Objects.isNull(inviteeEntCacheResDto) ? null : inviteeEntCacheResDto.getFirmName();
|
|
|
|
|
|
+
|
|
|
+ Long entId = reqVo.getEntId();
|
|
|
+
|
|
|
+ Map<Long, EntCacheResDto> longEntCacheResDtoMap = remoteSystemService.queryEntTreeByIds(Collections.singletonList(entId));
|
|
|
+ Long topId = longEntCacheResDtoMap.get(entId).getId();
|
|
|
//设置我方和对方企业信息、联系人
|
|
|
- if (currentEntId.equals(kwmCooperate.getEntId())) {
|
|
|
+ if (topId.equals(kwmCooperate.getEntId())) {
|
|
|
findCooperateByEntResVo.setEntId(kwmCooperate.getInviterEntId());
|
|
|
findCooperateByEntResVo.setEntName(inviterEntName);
|
|
|
findCooperateByEntResVo.setContactsId(kwmCooperate.getInviterContactsId());
|
|
|
@@ -457,4 +460,41 @@ public class KwmCooperateManageService {
|
|
|
public void restore(String ids, Integer type) {
|
|
|
dissolve(ids, type);
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @param reqVo 企业id
|
|
|
+ * @return FindCooperateByEntResVo
|
|
|
+ * @desc: 查询对方企业的合作单位有哪些是我方的
|
|
|
+ * @author: czh
|
|
|
+ * @date: 2023/7/22
|
|
|
+ */
|
|
|
+ public List<FindCooperateByEntResVo> findTargetEntCooperateInOur(FindCooperateByEntReqVo reqVo) {
|
|
|
+ FindCooperateByEntReqVo param = new FindCooperateByEntReqVo();
|
|
|
+ param.setEntId(reqVo.getTargetEntId());
|
|
|
+ param.setCooperateType(reqVo.getCooperateType());
|
|
|
+ //查对方有哪些合作单位,再筛选出我方的单位(包括我方主体单位)
|
|
|
+ List<FindCooperateByEntResVo> cooperateByEnt = findCooperateByEnt(param);
|
|
|
+ if (CollectionUtils.isEmpty(cooperateByEnt)) {
|
|
|
+ return Collections.emptyList();
|
|
|
+ }
|
|
|
+
|
|
|
+ Map<Long, EntCacheResDto> longEntCacheResDtoMap = remoteSystemService.queryEntTreeByIds(Collections.singletonList(reqVo.getEntId()));
|
|
|
+ if (longEntCacheResDtoMap.isEmpty()) {
|
|
|
+ throw new SystemException(HttpStatus.QUERY_FAIL_CODE, HttpStatus.ENT_NOT_EXISTS);
|
|
|
+ }
|
|
|
+
|
|
|
+ EntCacheResDto entCacheResDto = longEntCacheResDtoMap.get(reqVo.getEntId());
|
|
|
+ if (Objects.isNull(entCacheResDto)) {
|
|
|
+ throw new SystemException(HttpStatus.QUERY_FAIL_CODE, HttpStatus.ENT_NOT_EXISTS);
|
|
|
+ }
|
|
|
+
|
|
|
+ List<Long> longs = new ArrayList<>();
|
|
|
+ longs.add(reqVo.getEntId());
|
|
|
+ List<EntCacheResDto> child = entCacheResDto.getChild();
|
|
|
+ if (CollectionUtils.isNotEmpty(child)) {
|
|
|
+ longs.addAll(child.stream().map(EntCacheResDto::getId).toList());
|
|
|
+ }
|
|
|
+ return cooperateByEnt.stream().filter(item -> longs.contains(item.getTargetEntId())).toList();
|
|
|
+ }
|
|
|
}
|