|
|
@@ -116,7 +116,6 @@ public class KwmCooperateApplyService {
|
|
|
allEntIds.addAll(targetEntIds);
|
|
|
Map<Long, UserCacheResDto> userCacheResDtoMap = remoteSystemService.queryUserCacheMapByIds(userIds);
|
|
|
List<EntCacheResDto> entCacheResDtos = remoteSystemService.queryEntCacheByIds(allEntIds);
|
|
|
- Map<Long, String> userMap = new HashMap<>(Global.NUMERICAL_SIXTEEN);
|
|
|
Map<Long, String> entMap = new HashMap<>(Global.NUMERICAL_SIXTEEN);
|
|
|
if (!CollectionUtils.isEmpty(entCacheResDtos)) {
|
|
|
entMap = entCacheResDtos.stream().collect(Collectors.toMap(EntCacheResDto::getId, EntCacheResDto::getFirmName, (oldValue, newValue) -> newValue));
|
|
|
@@ -134,13 +133,11 @@ public class KwmCooperateApplyService {
|
|
|
cooperateManageQueryResVo.setStatus(cooperateManageQueryResDto.getStatus());
|
|
|
|
|
|
UserCacheResDto userCacheResDto = userCacheResDtoMap.get(cooperateManageQueryResDto.getCreateBy());
|
|
|
- if (Objects.nonNull(userCacheResDto)) {
|
|
|
- cooperateManageQueryResVo.setCreateByName(userCacheResDto.getName());
|
|
|
- EntCacheResDto entInfo = userCacheResDto.getEntInfo();
|
|
|
- if (Objects.nonNull(entInfo)) {
|
|
|
- cooperateManageQueryResVo.setApplyTypeCode(entId.equals(entInfo.getId()) ? Global.NUMERICAL_ONE : Global.NUMERICAL_TWO);
|
|
|
- }
|
|
|
- }
|
|
|
+ cooperateManageQueryResVo.setCreateByName(userCacheResDto.getName());
|
|
|
+ EntCacheResDto entInfo = userCacheResDto.getEntInfo();
|
|
|
+ boolean isOur = entId.equals(entInfo.getId());
|
|
|
+ cooperateManageQueryResVo.setApplyTypeCode(isOur ? Global.NUMERICAL_ONE : Global.NUMERICAL_TWO);
|
|
|
+
|
|
|
cooperateManageQueryResVo.setTargetEntName(targetEntName);
|
|
|
cooperateManageQueryResVo.setTargetEntId(targetEntId);
|
|
|
cooperateManageQueryResVo.setEntId(cooperateManageQueryResDto.getOurEntId());
|
|
|
@@ -148,7 +145,7 @@ public class KwmCooperateApplyService {
|
|
|
cooperateManageQueryResVo.setApprovalRemark(cooperateManageQueryResDto.getApprovalRemark());
|
|
|
|
|
|
//我方是发起方
|
|
|
- if (entId.compareTo(cooperateManageQueryResDto.getEntId()) == 0) {
|
|
|
+ if (isOur) {
|
|
|
cooperateManageQueryResVo.setContacts(cooperateManageQueryResDto.getInviteeContacts());
|
|
|
cooperateManageQueryResVo.setPhone(cooperateManageQueryResDto.getInviteePhone());
|
|
|
cooperateManageQueryResVo.setContactsId(cooperateManageQueryResDto.getInviteeContactsId());
|
|
|
@@ -156,7 +153,6 @@ public class KwmCooperateApplyService {
|
|
|
cooperateManageQueryResVo.setManagerPhone(cooperateManageQueryResDto.getInviterPhone());
|
|
|
cooperateManageQueryResVo.setManagerId(cooperateManageQueryResDto.getInviterContactsId());
|
|
|
cooperateManageQueryResVo.setCooperateTypes(cooperateManageQueryResDto.getTypes());
|
|
|
-
|
|
|
} else {
|
|
|
cooperateManageQueryResVo.setContacts(cooperateManageQueryResDto.getInviterContacts());
|
|
|
cooperateManageQueryResVo.setPhone(cooperateManageQueryResDto.getInviterPhone());
|
|
|
@@ -165,7 +161,6 @@ public class KwmCooperateApplyService {
|
|
|
cooperateManageQueryResVo.setManagerPhone(cooperateManageQueryResDto.getInviteePhone());
|
|
|
cooperateManageQueryResVo.setManagerId(cooperateManageQueryResDto.getInviteeContactsId());
|
|
|
cooperateManageQueryResVo.setCooperateTypes(commonBusinessService.changeCooperateType(cooperateManageQueryResDto.getTypes()));
|
|
|
-
|
|
|
}
|
|
|
|
|
|
result.add(cooperateManageQueryResVo);
|
|
|
@@ -257,30 +252,28 @@ public class KwmCooperateApplyService {
|
|
|
}
|
|
|
|
|
|
for (KwmCooperateType kwmCooperateType : kwmCooperateTypeList) {
|
|
|
- if (cooperateQueryDto.getKwmCooperate().getEntId().equals(currentEntId) && kwmCooperateType.getStatus() == CooperateStatusEnum.PROCESS.getCode()) {
|
|
|
+ if (kwmCooperateType.getStatus().equals(CooperateStatusEnum.PROCESS.getCode())) {
|
|
|
throw new SystemException(HttpStatus.QUERY_FAIL_CODE, HttpStatus.MSG_015);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//已合作的可以新增,但不能重复新增
|
|
|
List<Integer> typeList = kwmCooperateTypeList.stream().map(KwmCooperateType::getType).toList();
|
|
|
- if (cooperateQueryDto.getKwmCooperate().getInviterEntId().equals(currentEntId)) {
|
|
|
- chooseCooperateTypes.forEach(item -> {
|
|
|
- if (typeList.contains(item)) {
|
|
|
- throw new SystemException(HttpStatus.CODE_10301, HttpStatus.MSG_016);
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
+ chooseCooperateTypes.forEach(item -> {
|
|
|
+ if (typeList.contains(item)) {
|
|
|
+ throw new SystemException(HttpStatus.CODE_10301, HttpStatus.MSG_016);
|
|
|
+ }
|
|
|
+ });
|
|
|
|
|
|
- //对方发起了与之相对的申请,也不能再申请
|
|
|
- if (cooperateQueryDto.getKwmCooperate().getInviteeEntId().equals(currentEntId)) {
|
|
|
- chooseCooperateTypes.forEach(item -> {
|
|
|
- Integer relative = commonBusinessService.changeAttribute(item);
|
|
|
- if (typeList.contains(relative)) {
|
|
|
- throw new SystemException(HttpStatus.CODE_10301, HttpStatus.MSG_016);
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
+// //对方发起了与之相对的申请,也不能再申请
|
|
|
+// if (cooperateQueryDto.getKwmCooperate().getInviteeEntId().equals(currentEntId)) {
|
|
|
+// chooseCooperateTypes.forEach(item -> {
|
|
|
+// Integer relative = commonBusinessService.changeAttribute(item);
|
|
|
+// if (typeList.contains(relative)) {
|
|
|
+// throw new SystemException(HttpStatus.CODE_10301, HttpStatus.MSG_016);
|
|
|
+// }
|
|
|
+// });
|
|
|
+// }
|
|
|
}
|
|
|
}
|
|
|
//保存发起申请
|
|
|
@@ -448,10 +441,25 @@ public class KwmCooperateApplyService {
|
|
|
}
|
|
|
|
|
|
List<CooperateQueryDto> list = new ArrayList<>();
|
|
|
+ EntCacheResDto entCacheResDto = remoteSystemService.queryEntTreeById(currentEntId);
|
|
|
+
|
|
|
for (KwmCooperate kwmCooperate : kwmCooperates) {
|
|
|
CooperateQueryDto cooperateQueryDto = new CooperateQueryDto();
|
|
|
cooperateQueryDto.setKwmCooperate(kwmCooperate);
|
|
|
- cooperateQueryDto.setKwmCooperateTypeList(map.get(kwmCooperate.getId()));
|
|
|
+
|
|
|
+ List<KwmCooperateType> kwmCooperateTypeList = map.get(kwmCooperate.getId());
|
|
|
+ if (CollectionUtils.isNotEmpty(kwmCooperateTypeList)) {
|
|
|
+ List<Long> longs = kwmCooperateTypeList.stream().map(KwmCooperateType::getCreateBy).toList();
|
|
|
+ Map<Long, UserCacheResDto> longUserCacheResDtoMap = remoteSystemService.queryUserCacheMapByIds(longs);
|
|
|
+ for (KwmCooperateType kwmCooperateType : kwmCooperateTypeList) {
|
|
|
+ Long createBy = kwmCooperateType.getCreateBy();
|
|
|
+ if (!entCacheResDto.getId().equals(longUserCacheResDtoMap.get(createBy).getEntInfo().getId())) {
|
|
|
+ kwmCooperateType.setType(commonBusinessService.changeCooperateType(kwmCooperateType.getType()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ cooperateQueryDto.setKwmCooperateTypeList(kwmCooperateTypeList);
|
|
|
list.add(cooperateQueryDto);
|
|
|
}
|
|
|
|