|
|
@@ -3,6 +3,7 @@ package com.sckw.manage.service;
|
|
|
import java.io.IOException;
|
|
|
import java.util.Date;
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
import com.sckw.core.exception.SystemException;
|
|
|
@@ -23,10 +24,10 @@ import com.sckw.manage.model.entity.KwmCooperate;
|
|
|
import com.sckw.manage.model.vo.req.BindManagerReqVo;
|
|
|
import com.sckw.manage.model.vo.req.CooperateManageQueryReqVo;
|
|
|
import com.sckw.manage.model.vo.res.CooperateManageQueryResVo;
|
|
|
+import com.sckw.manage.model.vo.res.FindEntCooperateResVo;
|
|
|
import com.sckw.manage.model.vo.res.FindListGroupResVo;
|
|
|
import com.sckw.manage.model.vo.res.QueryDetailResVo;
|
|
|
import com.sckw.system.api.RemoteSystemService;
|
|
|
-import com.sckw.system.api.RemoteUserService;
|
|
|
import com.sckw.system.api.model.dto.res.EntCacheResDto;
|
|
|
import com.sckw.system.api.model.dto.res.UserCacheResDto;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
@@ -55,9 +56,6 @@ public class KwmCooperateManageService {
|
|
|
@DubboReference(version = "2.0.0", group = "design", check = false)
|
|
|
private RemoteSystemService remoteSystemService;
|
|
|
|
|
|
- @DubboReference(version = "2.0.0", group = "design", check = false)
|
|
|
- private RemoteUserService remoteUserService;
|
|
|
-
|
|
|
|
|
|
/**
|
|
|
* @param reqVo 分页入参
|
|
|
@@ -276,4 +274,61 @@ public class KwmCooperateManageService {
|
|
|
commonBusinessService.fillGroup(result, list);
|
|
|
return result;
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @param id 企业id
|
|
|
+ * @return FindEntCooperateResVo
|
|
|
+ * @desc: 查询企业的合作单位
|
|
|
+ * @author: czh
|
|
|
+ * @date: 2023/7/22
|
|
|
+ */
|
|
|
+ public List<FindEntCooperateResVo> findEntCooperate(Long id) {
|
|
|
+ LambdaQueryWrapper<KwmCooperate> wrapper = new LambdaQueryWrapper<>();
|
|
|
+ wrapper.eq(KwmCooperate::getInviterEntId, id).or().
|
|
|
+ eq(KwmCooperate::getInviteeEntId, id).and(
|
|
|
+ wp -> wp.eq(KwmCooperate::getDelFlag, Global.NO).
|
|
|
+ eq(KwmCooperate::getStatus, CooperateStatusEnum.OK.getCode())
|
|
|
+ );
|
|
|
+ List<KwmCooperate> kwmCooperates = kwmCooperateMapper.selectList(wrapper);
|
|
|
+ if (CollectionUtils.isEmpty(kwmCooperates)) {
|
|
|
+ return Collections.emptyList();
|
|
|
+ }
|
|
|
+
|
|
|
+ //装对方企业的id
|
|
|
+ List<Long> targetEntIdList = new ArrayList<>();
|
|
|
+ kwmCooperates.forEach(item -> targetEntIdList.add(item.getInviterEntId().equals(id) ? item.getInviteeEntId() : item.getInviterEntId()));
|
|
|
+
|
|
|
+ List<EntCacheResDto> entCacheResDtos = remoteSystemService.queryEntCacheByIds(targetEntIdList);
|
|
|
+ if (CollectionUtils.isEmpty(entCacheResDtos)) {
|
|
|
+ return Collections.emptyList();
|
|
|
+ }
|
|
|
+
|
|
|
+ //装对方企业信息
|
|
|
+ List<FindEntCooperateResVo> list = new ArrayList<>();
|
|
|
+ entCacheResDtos.forEach(item -> {
|
|
|
+ FindEntCooperateResVo findEntCooperateResVo = new FindEntCooperateResVo();
|
|
|
+ findEntCooperateResVo.setEntId(item.getId());
|
|
|
+ findEntCooperateResVo.setEntName(item.getFirmName());
|
|
|
+ list.add(findEntCooperateResVo);
|
|
|
+ });
|
|
|
+
|
|
|
+ //装对方企业的主体单位
|
|
|
+ Map<Long, List<EntCacheResDto>> longListMap = remoteSystemService.queryEntDeptCacheByIds(targetEntIdList);
|
|
|
+ List<Long> longs = list.stream().map(FindEntCooperateResVo::getEntId).toList();
|
|
|
+ longs.forEach(item -> {
|
|
|
+ List<EntCacheResDto> entCacheResDtos1 = longListMap.get(item);
|
|
|
+ if (CollectionUtils.isEmpty(entCacheResDtos1)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ entCacheResDtos1.forEach(x -> {
|
|
|
+ FindEntCooperateResVo findEntCooperateResVo = new FindEntCooperateResVo();
|
|
|
+ findEntCooperateResVo.setEntId(x.getId());
|
|
|
+ findEntCooperateResVo.setEntName(x.getFirmName());
|
|
|
+ list.add(findEntCooperateResVo);
|
|
|
+ });
|
|
|
+ });
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+
|
|
|
}
|