|
|
@@ -9,16 +9,19 @@ import com.sckw.manage.api.model.dto.res.EntAddressResDto;
|
|
|
import com.sckw.manage.api.model.dto.res.FindEntCooperateResVo;
|
|
|
import com.sckw.manage.dao.KwmAddressMapper;
|
|
|
import com.sckw.manage.model.entity.KwmAddress;
|
|
|
+import com.sckw.manage.model.entity.KwmCooperate;
|
|
|
+import com.sckw.manage.model.vo.req.FindCooperateByEntReqVo;
|
|
|
import com.sckw.manage.model.vo.req.FindEntCooperateReqVo;
|
|
|
+import com.sckw.manage.model.vo.res.FindCooperateByEntResVo;
|
|
|
import com.sckw.manage.service.KwmCooperateManageService;
|
|
|
+import com.sckw.system.api.RemoteSystemService;
|
|
|
+import com.sckw.system.api.model.dto.res.EntCacheResDto;
|
|
|
+import org.apache.dubbo.config.annotation.DubboReference;
|
|
|
import org.apache.dubbo.config.annotation.DubboService;
|
|
|
import org.checkerframework.checker.units.qual.A;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
|
-import java.util.Collections;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
+import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
@@ -35,6 +38,9 @@ public class RemoteManageServiceImpl implements RemoteManageService {
|
|
|
@Autowired
|
|
|
private KwmCooperateManageService kwmCooperateManageService;
|
|
|
|
|
|
+ @DubboReference(version = "1.0.0", group = "design", check = false)
|
|
|
+ private RemoteSystemService remoteSystemService;
|
|
|
+
|
|
|
/**
|
|
|
* @param idList 企业id集合
|
|
|
* @return Map<Long, List<EntAddressResDto>>
|
|
|
@@ -69,4 +75,57 @@ public class RemoteManageServiceImpl implements RemoteManageService {
|
|
|
}
|
|
|
return BeanUtils.copyToList(entCooperate, FindEntCooperateResVo.class);
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @param entId 集团企业id
|
|
|
+ * @return FindEntCooperateResVo
|
|
|
+ * @desc: 查询集团企业包括其主体单位下的合作单位所属的集团企业
|
|
|
+ * @author: czh
|
|
|
+ * @date: 2023/9/1
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public List<FindEntCooperateResVo> findAllCooperateEnt(Long entId) {
|
|
|
+ if (Objects.isNull(entId)) {
|
|
|
+ return Collections.emptyList();
|
|
|
+ }
|
|
|
+ List<Long> ourEntIds = new ArrayList<>();
|
|
|
+ ourEntIds.add(entId);
|
|
|
+ EntCacheResDto entCacheResDto = remoteSystemService.queryEntTreeById(entId);
|
|
|
+ if (Objects.nonNull(entCacheResDto)) {
|
|
|
+ List<EntCacheResDto> child = entCacheResDto.getChild();
|
|
|
+ if (CollectionUtils.isNotEmpty(child)) {
|
|
|
+ ourEntIds.addAll(child.stream().map(EntCacheResDto::getId).toList());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //获取当前集团下所有的企业id,遍历,找到合作单位
|
|
|
+ List<Long> list = new ArrayList<>();
|
|
|
+ List<FindEntCooperateResVo> findEntCooperateResVoList = new ArrayList<>();
|
|
|
+ for (Long ourEntId : ourEntIds) {
|
|
|
+ FindCooperateByEntReqVo findCooperateByEntReqVo = new FindCooperateByEntReqVo();
|
|
|
+ findCooperateByEntReqVo.setEntId(ourEntId);
|
|
|
+ List<FindCooperateByEntResVo> cooperateByEnt = kwmCooperateManageService.findCooperateByEnt(findCooperateByEntReqVo);
|
|
|
+ if (CollectionUtils.isNotEmpty(cooperateByEnt)) {
|
|
|
+ List<Long> targetEntIds = cooperateByEnt.stream().map(FindCooperateByEntResVo::getTargetEntId).toList();
|
|
|
+ Map<Long, EntCacheResDto> longEntCacheResDtoMap = remoteSystemService.queryEntTreeByIds(targetEntIds);
|
|
|
+ for (Long targetEntId : targetEntIds) {
|
|
|
+ EntCacheResDto entCacheResDto1 = longEntCacheResDtoMap.get(targetEntId);
|
|
|
+ if (Objects.nonNull(entCacheResDto1)) {
|
|
|
+ Long id = entCacheResDto1.getId();
|
|
|
+ if (list.contains(id)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ list.add(id);
|
|
|
+ FindEntCooperateResVo findEntCooperateResVo = new FindEntCooperateResVo();
|
|
|
+ findEntCooperateResVo.setEntId(id);
|
|
|
+ findEntCooperateResVo.setEntName(entCacheResDto1.getFirmName());
|
|
|
+ findEntCooperateResVoList.add(findEntCooperateResVo);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return findEntCooperateResVoList;
|
|
|
+ }
|
|
|
}
|