|
@@ -1,10 +1,12 @@
|
|
|
package com.sckw.manage.service;
|
|
package com.sckw.manage.service;
|
|
|
|
|
|
|
|
|
|
+import java.io.IOException;
|
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.github.pagehelper.PageHelper;
|
|
import com.github.pagehelper.PageHelper;
|
|
|
import com.github.pagehelper.PageInfo;
|
|
import com.github.pagehelper.PageInfo;
|
|
|
|
|
+import com.sckw.core.exception.BusinessException;
|
|
|
import com.sckw.core.exception.SystemException;
|
|
import com.sckw.core.exception.SystemException;
|
|
|
import com.sckw.core.model.constant.Global;
|
|
import com.sckw.core.model.constant.Global;
|
|
|
import com.sckw.core.model.enums.CooperateStatusEnum;
|
|
import com.sckw.core.model.enums.CooperateStatusEnum;
|
|
@@ -36,6 +38,8 @@ import com.sckw.stream.enums.MessageEnum;
|
|
|
import com.sckw.stream.model.UserInfo;
|
|
import com.sckw.stream.model.UserInfo;
|
|
|
import com.sckw.system.api.RemoteSystemService;
|
|
import com.sckw.system.api.RemoteSystemService;
|
|
|
import com.sckw.order.api.dubbo.TradeOrderInfoService;
|
|
import com.sckw.order.api.dubbo.TradeOrderInfoService;
|
|
|
|
|
+import com.sckw.system.api.RemoteUserService;
|
|
|
|
|
+import com.sckw.system.api.model.dto.res.FindEntUserResDto;
|
|
|
import com.sckw.system.api.model.dto.res.UserCacheResDto;
|
|
import com.sckw.system.api.model.dto.res.UserCacheResDto;
|
|
|
import com.sckw.transport.api.dubbo.TransportDubboService;
|
|
import com.sckw.transport.api.dubbo.TransportDubboService;
|
|
|
import com.sckw.payment.api.dubbo.PaymentDubboService;
|
|
import com.sckw.payment.api.dubbo.PaymentDubboService;
|
|
@@ -73,6 +77,9 @@ public class KwmCooperateManageService {
|
|
|
@DubboReference(version = "1.0.0", group = "design", check = false)
|
|
@DubboReference(version = "1.0.0", group = "design", check = false)
|
|
|
private RemoteSystemService remoteSystemService;
|
|
private RemoteSystemService remoteSystemService;
|
|
|
|
|
|
|
|
|
|
+ @DubboReference(version = "1.0.0", group = "design", check = false)
|
|
|
|
|
+ private RemoteUserService remoteUserService;
|
|
|
|
|
+
|
|
|
@DubboReference(version = "1.0.0", group = "design", check = false)
|
|
@DubboReference(version = "1.0.0", group = "design", check = false)
|
|
|
private TradeOrderInfoService tradeOrderInfoService;
|
|
private TradeOrderInfoService tradeOrderInfoService;
|
|
|
|
|
|
|
@@ -163,6 +170,13 @@ public class KwmCooperateManageService {
|
|
|
cooperateManageQueryReqDto.setTargetEntIdList(entCacheResDtos.stream().map(EntCacheResDto::getId).toList());
|
|
cooperateManageQueryReqDto.setTargetEntIdList(entCacheResDtos.stream().map(EntCacheResDto::getId).toList());
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ List<FindEntUserResDto> entUser = remoteUserService.findEntUser(entId);
|
|
|
|
|
+ if(CollectionUtils.isEmpty(entUser)) {
|
|
|
|
|
+ cooperateManageQueryReqDto.setCurrentUserIdList(Collections.singletonList(LoginUserHolder.getUserId()));
|
|
|
|
|
+ } else {
|
|
|
|
|
+ cooperateManageQueryReqDto.setCurrentUserIdList(entUser.stream().map(FindEntUserResDto::getUserId).toList());
|
|
|
|
|
+ }
|
|
|
return cooperateManageQueryReqDto;
|
|
return cooperateManageQueryReqDto;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -229,46 +243,49 @@ public class KwmCooperateManageService {
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
- Map<String, Object> map = new HashMap<>(Global.NUMERICAL_FOUR);
|
|
|
|
|
- for (KwmCooperate kwmCooperate : kwmCooperates) {
|
|
|
|
|
- Long targetEntId = kwmCooperate.getEntId().equals(LoginUserHolder.getEntId()) ? kwmCooperate.getInviteeEntId() : kwmCooperate.getInviterEntId();
|
|
|
|
|
- Long entId = kwmCooperate.getEntId().equals(LoginUserHolder.getEntId()) ? kwmCooperate.getInviterEntId() : kwmCooperate.getInviteeEntId();
|
|
|
|
|
- EntCacheResDto targetEntCacheResDto = remoteSystemService.queryEntCacheById(targetEntId);
|
|
|
|
|
- EntCacheResDto targetEntTreeCacheResDto = remoteSystemService.queryEntTreeById(targetEntId);
|
|
|
|
|
- EntCacheResDto ourEntCacheResDto = remoteSystemService.queryEntCacheById(entId);
|
|
|
|
|
- EntCacheResDto ourEntTopCacheResDto = remoteSystemService.queryEntCacheById(kwmCooperate.getEntId());
|
|
|
|
|
- if (type.equals(CooperateStatusEnum.PASS.getCode())) {
|
|
|
|
|
- map.put("entName", targetEntCacheResDto.getFirmName());
|
|
|
|
|
- map.put("createByName", LoginUserHolder.getUserName());
|
|
|
|
|
- commonBusinessService.sendSystemMessage(Collections.singletonList(new UserInfo().setUserId(ourEntTopCacheResDto.getContactsId()).setEntId(ourEntTopCacheResDto.getId())),
|
|
|
|
|
- MessageEnum.COOPERATE_DISSOLVE,
|
|
|
|
|
- map,
|
|
|
|
|
- cooperateManageUrl,
|
|
|
|
|
- appCooperateApplyUrl);
|
|
|
|
|
-
|
|
|
|
|
- map.put("entName", ourEntCacheResDto.getFirmName());
|
|
|
|
|
- commonBusinessService.sendSystemMessage(Collections.singletonList(new UserInfo().setUserId(targetEntTreeCacheResDto.getContactsId()).setEntId(targetEntTreeCacheResDto.getId())),
|
|
|
|
|
- MessageEnum.COOPERATE_DISSOLVED,
|
|
|
|
|
- map,
|
|
|
|
|
- cooperateManageUrl,
|
|
|
|
|
- appCooperateApplyUrl);
|
|
|
|
|
- } else {
|
|
|
|
|
- map.put("entName", targetEntCacheResDto.getFirmName());
|
|
|
|
|
- map.put("createByName", LoginUserHolder.getUserName());
|
|
|
|
|
- commonBusinessService.sendSystemMessage(Collections.singletonList(new UserInfo().setUserId(ourEntTopCacheResDto.getContactsId()).setEntId(ourEntTopCacheResDto.getId())),
|
|
|
|
|
- MessageEnum.COOPERATE_RESTORE,
|
|
|
|
|
- map,
|
|
|
|
|
- cooperateManageUrl,
|
|
|
|
|
- appCooperateApplyUrl);
|
|
|
|
|
-
|
|
|
|
|
- map.put("entName", ourEntCacheResDto.getFirmName());
|
|
|
|
|
- commonBusinessService.sendSystemMessage(Collections.singletonList(new UserInfo().setUserId(targetEntTreeCacheResDto.getContactsId()).setEntId(targetEntTreeCacheResDto.getId())),
|
|
|
|
|
- MessageEnum.COOPERATE_RESTORED,
|
|
|
|
|
- map,
|
|
|
|
|
- cooperateManageUrl,
|
|
|
|
|
- appCooperateApplyUrl);
|
|
|
|
|
|
|
+ try {
|
|
|
|
|
+ Map<String, Object> map = new HashMap<>(Global.NUMERICAL_FOUR);
|
|
|
|
|
+ for (KwmCooperate kwmCooperate : kwmCooperates) {
|
|
|
|
|
+ Long targetEntId = kwmCooperate.getEntId().equals(LoginUserHolder.getEntId()) ? kwmCooperate.getInviteeEntId() : kwmCooperate.getInviterEntId();
|
|
|
|
|
+ Long entId = kwmCooperate.getEntId().equals(LoginUserHolder.getEntId()) ? kwmCooperate.getInviterEntId() : kwmCooperate.getInviteeEntId();
|
|
|
|
|
+ EntCacheResDto targetEntCacheResDto = remoteSystemService.queryEntCacheById(targetEntId);
|
|
|
|
|
+ EntCacheResDto targetEntTreeCacheResDto = remoteSystemService.queryEntTreeById(targetEntId);
|
|
|
|
|
+ EntCacheResDto ourEntCacheResDto = remoteSystemService.queryEntCacheById(entId);
|
|
|
|
|
+ EntCacheResDto ourEntTopCacheResDto = remoteSystemService.queryEntCacheById(kwmCooperate.getEntId());
|
|
|
|
|
+ if (type.equals(CooperateStatusEnum.PASS.getCode())) {
|
|
|
|
|
+ map.put("entName", targetEntCacheResDto.getFirmName());
|
|
|
|
|
+ map.put("createByName", LoginUserHolder.getUserName());
|
|
|
|
|
+ commonBusinessService.sendSystemMessage(Collections.singletonList(new UserInfo().setUserId(ourEntTopCacheResDto.getContactsId()).setEntId(ourEntTopCacheResDto.getId())),
|
|
|
|
|
+ MessageEnum.COOPERATE_DISSOLVE,
|
|
|
|
|
+ map,
|
|
|
|
|
+ cooperateManageUrl,
|
|
|
|
|
+ appCooperateApplyUrl);
|
|
|
|
|
+
|
|
|
|
|
+ map.put("entName", ourEntCacheResDto.getFirmName());
|
|
|
|
|
+ commonBusinessService.sendSystemMessage(Collections.singletonList(new UserInfo().setUserId(targetEntTreeCacheResDto.getContactsId()).setEntId(targetEntTreeCacheResDto.getId())),
|
|
|
|
|
+ MessageEnum.COOPERATE_DISSOLVED,
|
|
|
|
|
+ map,
|
|
|
|
|
+ cooperateManageUrl,
|
|
|
|
|
+ appCooperateApplyUrl);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ map.put("entName", targetEntCacheResDto.getFirmName());
|
|
|
|
|
+ map.put("createByName", LoginUserHolder.getUserName());
|
|
|
|
|
+ commonBusinessService.sendSystemMessage(Collections.singletonList(new UserInfo().setUserId(ourEntTopCacheResDto.getContactsId()).setEntId(ourEntTopCacheResDto.getId())),
|
|
|
|
|
+ MessageEnum.COOPERATE_RESTORE,
|
|
|
|
|
+ map,
|
|
|
|
|
+ cooperateManageUrl,
|
|
|
|
|
+ appCooperateApplyUrl);
|
|
|
|
|
+
|
|
|
|
|
+ map.put("entName", ourEntCacheResDto.getFirmName());
|
|
|
|
|
+ commonBusinessService.sendSystemMessage(Collections.singletonList(new UserInfo().setUserId(targetEntTreeCacheResDto.getContactsId()).setEntId(targetEntTreeCacheResDto.getId())),
|
|
|
|
|
+ MessageEnum.COOPERATE_RESTORED,
|
|
|
|
|
+ map,
|
|
|
|
|
+ cooperateManageUrl,
|
|
|
|
|
+ appCooperateApplyUrl);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ log.error("合作关系恢复/解除消息出错:", e);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|
|
@@ -780,7 +797,7 @@ public class KwmCooperateManageService {
|
|
|
queryAllCooperateInfoResVo.setInviteeContacts(item.getInviteeContacts());
|
|
queryAllCooperateInfoResVo.setInviteeContacts(item.getInviteeContacts());
|
|
|
queryAllCooperateInfoResVo.setInviteeContactsPhone(item.getInviteePhone());
|
|
queryAllCooperateInfoResVo.setInviteeContactsPhone(item.getInviteePhone());
|
|
|
queryAllCooperateInfoResVo.setCreateTime(item.getCreateTime());
|
|
queryAllCooperateInfoResVo.setCreateTime(item.getCreateTime());
|
|
|
-
|
|
|
|
|
|
|
+ queryAllCooperateInfoResVo.setId(item.getId());
|
|
|
UserCacheResDto userCacheResDto = userCacheResDtoMap.get(item.getCreateBy());
|
|
UserCacheResDto userCacheResDto = userCacheResDtoMap.get(item.getCreateBy());
|
|
|
queryAllCooperateInfoResVo.setCreateByName(Objects.nonNull(userCacheResDto) ? userCacheResDto.getName() : "");
|
|
queryAllCooperateInfoResVo.setCreateByName(Objects.nonNull(userCacheResDto) ? userCacheResDto.getName() : "");
|
|
|
queryAllCooperateInfoResVo.setPhone(Objects.nonNull(userCacheResDto) ? userCacheResDto.getPhone() : "");
|
|
queryAllCooperateInfoResVo.setPhone(Objects.nonNull(userCacheResDto) ? userCacheResDto.getPhone() : "");
|
|
@@ -803,7 +820,12 @@ public class KwmCooperateManageService {
|
|
|
if (CollectionUtils.isEmpty(list)) {
|
|
if (CollectionUtils.isEmpty(list)) {
|
|
|
throw new SystemException("导出数据为空");
|
|
throw new SystemException("导出数据为空");
|
|
|
}
|
|
}
|
|
|
- ExcelUtil.downData(response, QueryAllCooperateInfoExcel.class, BeanUtils.copyToList(getAllCooperateInfoVo(list), QueryAllCooperateInfoExcel.class));
|
|
|
|
|
|
|
+ List<QueryAllCooperateInfoResVo> allCooperateInfoVo = getAllCooperateInfoVo(list);
|
|
|
|
|
+ if (CollectionUtils.isEmpty(allCooperateInfoVo)) {
|
|
|
|
|
+ throw new SystemException("导出数据为空");
|
|
|
|
|
+ }
|
|
|
|
|
+ List<QueryAllCooperateInfoExcel> queryAllCooperateInfoExcels = BeanUtils.copyToList(allCooperateInfoVo, QueryAllCooperateInfoExcel.class);
|
|
|
|
|
+ ExcelUtil.downData(response, QueryAllCooperateInfoExcel.class, queryAllCooperateInfoExcels);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|