|
|
@@ -96,6 +96,8 @@ public class KwmCooperateApplyService {
|
|
|
Long entId = LoginUserHolder.getEntId();
|
|
|
List<Long> userIds = list.stream().map(CooperateManageQueryResDto::getCreateBy).distinct().toList();
|
|
|
List<Long> targetEntIds = list.stream().map(CooperateManageQueryResDto::getTargetEntId).distinct().toList();
|
|
|
+ List<Long> ourEntIds = list.stream().map(CooperateManageQueryResDto::getOurEntId).distinct().toList();
|
|
|
+ targetEntIds.addAll(ourEntIds);
|
|
|
List<UserCacheResDto> userCacheResDtos = remoteSystemService.queryUserCacheByIds(userIds);
|
|
|
List<EntCacheResDto> entCacheResDtos = remoteSystemService.queryEntCacheByIds(targetEntIds);
|
|
|
Map<Long, String> userMap = new HashMap<>();
|
|
|
@@ -126,12 +128,14 @@ public class KwmCooperateApplyService {
|
|
|
cooperateManageQueryResVo.setStatus(cooperateManageQueryResDto.getStatus());
|
|
|
cooperateManageQueryResVo.setApplyTypeCode(cooperateManageQueryResDto.getApplyTypeCode());
|
|
|
cooperateManageQueryResVo.setCreateByName(userMap.get(cooperateManageQueryResDto.getCreateBy()));
|
|
|
- cooperateManageQueryResVo.setEntName(targetEntName);
|
|
|
- cooperateManageQueryResVo.setEntId(targetEntId);
|
|
|
+ cooperateManageQueryResVo.setTargetEntName(targetEntName);
|
|
|
+ cooperateManageQueryResVo.setTargetEntId(targetEntId);
|
|
|
+ cooperateManageQueryResVo.setEntId(cooperateManageQueryResDto.getOurEntId());
|
|
|
+ cooperateManageQueryResVo.setEntName(entMap.get(cooperateManageQueryResDto.getOurEntId()));
|
|
|
cooperateManageQueryResVo.setApprovalRemark(cooperateManageQueryResDto.getApprovalRemark());
|
|
|
|
|
|
//我方是发起方
|
|
|
- if (entId.compareTo(cooperateManageQueryResDto.getInviterEntId()) == 0) {
|
|
|
+ if (entId.compareTo(cooperateManageQueryResDto.getEntId()) == 0) {
|
|
|
cooperateManageQueryResVo.setContacts(cooperateManageQueryResDto.getInviteeContacts());
|
|
|
cooperateManageQueryResVo.setPhone(cooperateManageQueryResDto.getInviteePhone());
|
|
|
cooperateManageQueryResVo.setContactsId(cooperateManageQueryResDto.getInviteeContactsId());
|
|
|
@@ -215,11 +219,11 @@ public class KwmCooperateApplyService {
|
|
|
*/
|
|
|
@Transactional(rollbackFor = {})
|
|
|
public void initiate(InitiateReqVo reqVo) {
|
|
|
- Long currentEntId = LoginUserHolder.getEntId();
|
|
|
+ Long currentEntId = reqVo.getEntId();
|
|
|
List<Integer> chooseCooperateTypes = Arrays.stream(reqVo.getChooseCooperateTypes().split(Global.COMMA)).map(Integer::parseInt).toList();
|
|
|
|
|
|
//查是否有在合作中、审核中的记录
|
|
|
- List<CooperateQueryDto> cooperateQueryDtoList = queryValidCooperate(reqVo.getEntId(), currentEntId);
|
|
|
+ List<CooperateQueryDto> cooperateQueryDtoList = queryValidCooperate(reqVo.getTargetEntId(), currentEntId);
|
|
|
if (!CollectionUtils.isEmpty(cooperateQueryDtoList)) {
|
|
|
//有待审核的记录不允许新增申请
|
|
|
for (CooperateQueryDto cooperateQueryDto : cooperateQueryDtoList) {
|
|
|
@@ -272,9 +276,9 @@ public class KwmCooperateApplyService {
|
|
|
if (Objects.isNull(reqVo.getId())) {
|
|
|
KwmCooperate kwmCooperate = new KwmCooperate();
|
|
|
id = new IdWorker(1L).nextId();
|
|
|
- kwmCooperate.setEntId(currentEntId);
|
|
|
+ kwmCooperate.setEntId(LoginUserHolder.getEntId());
|
|
|
kwmCooperate.setInviterEntId(currentEntId);
|
|
|
- kwmCooperate.setInviteeEntId(reqVo.getEntId());
|
|
|
+ kwmCooperate.setInviteeEntId(reqVo.getTargetEntId());
|
|
|
|
|
|
//我方联系人
|
|
|
UserCacheResDto contactDto = remoteSystemService.queryUserCacheById(reqVo.getUserId());
|
|
|
@@ -285,7 +289,7 @@ public class KwmCooperateApplyService {
|
|
|
}
|
|
|
|
|
|
//对方联系人
|
|
|
- UserCacheResDto userCacheResDto = remoteSystemService.queryManagerInfoByEntId(reqVo.getEntId());
|
|
|
+ UserCacheResDto userCacheResDto = remoteSystemService.queryManagerInfoByEntId(reqVo.getTargetEntId());
|
|
|
if (Objects.nonNull(userCacheResDto)) {
|
|
|
kwmCooperate.setInviteeContactsId(userCacheResDto.getId());
|
|
|
kwmCooperate.setInviteeContacts(contactDto.getName());
|