|
|
@@ -21,6 +21,7 @@ import com.sckw.excel.utils.EasyExcelUtil;
|
|
|
import com.sckw.manage.dao.KwmCooperateMapper;
|
|
|
import com.sckw.manage.dao.KwmCooperateTypeMapper;
|
|
|
import com.sckw.manage.model.dto.req.CooperateManageQueryReqDto;
|
|
|
+import com.sckw.manage.model.dto.res.CooperateManageQueryResDto;
|
|
|
import com.sckw.manage.model.dto.res.CooperateQueryDto;
|
|
|
import com.sckw.manage.model.entity.KwmCooperate;
|
|
|
import com.sckw.manage.model.entity.KwmCooperateType;
|
|
|
@@ -72,8 +73,83 @@ public class KwmCooperateApplyService {
|
|
|
*/
|
|
|
public PageResult queryByPage(CooperateApplyQueryReqVo reqVo) {
|
|
|
PageHelper.startPage(reqVo.getPage(), reqVo.getPageSize());
|
|
|
- List<CooperateManageQueryResVo> list = commonBusinessService.findList(buildQueryParam(reqVo));
|
|
|
- return PageHelperUtil.getPageResult(new PageInfo<>(list));
|
|
|
+ CooperateManageQueryReqDto reqDto = buildQueryParam(reqVo);
|
|
|
+ List<CooperateManageQueryResDto> list = kwmCooperateMapper.findList(reqDto);
|
|
|
+ if (CollectionUtils.isEmpty(list)) {
|
|
|
+ return PageHelperUtil.getPageResult(new PageInfo<>());
|
|
|
+ }
|
|
|
+
|
|
|
+ List<CooperateManageQueryResVo> cooperateManageQueryResVos = getCooperateManageQueryResVos(reqDto, list);
|
|
|
+ return PageHelperUtil.getPageResult(new PageInfo<>(cooperateManageQueryResVos), list, reqVo.getPageSize());
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @param reqDto 入参 list数据
|
|
|
+ * @return CooperateManageQueryResVo
|
|
|
+ * @desc: 组装返参
|
|
|
+ * @author: czh
|
|
|
+ * @date: 2023/8/2
|
|
|
+ */
|
|
|
+ public List<CooperateManageQueryResVo> getCooperateManageQueryResVos(CooperateManageQueryReqDto reqDto, List<CooperateManageQueryResDto> list) {
|
|
|
+ //dubbo接口查用户和企业
|
|
|
+ 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<UserCacheResDto> userCacheResDtos = remoteSystemService.queryUserCacheByIds(userIds);
|
|
|
+ List<EntCacheResDto> entCacheResDtos = remoteSystemService.queryEntCacheByIds(targetEntIds);
|
|
|
+ Map<Long, String> userMap = new HashMap<>();
|
|
|
+ Map<Long, String> entMap = new HashMap<>();
|
|
|
+ if (!CollectionUtils.isEmpty(userCacheResDtos)) {
|
|
|
+ userMap = userCacheResDtos.stream().collect(Collectors.toMap(UserCacheResDto::getId, UserCacheResDto::getName, (oldValue, newValue) -> newValue));
|
|
|
+ }
|
|
|
+ if (!CollectionUtils.isEmpty(entCacheResDtos)) {
|
|
|
+ entMap = entCacheResDtos.stream().collect(Collectors.toMap(EntCacheResDto::getId, EntCacheResDto::getFirmName, (oldValue, newValue) -> newValue));
|
|
|
+ }
|
|
|
+
|
|
|
+ List<CooperateManageQueryResVo> result = new ArrayList<>();
|
|
|
+ for (CooperateManageQueryResDto cooperateManageQueryResDto : list) {
|
|
|
+ Long targetEntId = cooperateManageQueryResDto.getTargetEntId();
|
|
|
+ String targetEntName = entMap.get(targetEntId);
|
|
|
+ String keywords = reqDto.getKeywords();
|
|
|
+ if (StringUtils.isNotBlank(keywords)) {
|
|
|
+ if (StringUtils.isBlank(targetEntName) || (!targetEntName.contains(keywords) && !commonBusinessService.matchContacts(keywords, cooperateManageQueryResDto))) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ CooperateManageQueryResVo cooperateManageQueryResVo = new CooperateManageQueryResVo();
|
|
|
+ cooperateManageQueryResVo.setId(cooperateManageQueryResDto.getId());
|
|
|
+ cooperateManageQueryResVo.setCooperateTypes(cooperateManageQueryResDto.getTypes());
|
|
|
+ cooperateManageQueryResVo.setCreateTime(cooperateManageQueryResDto.getCreateTime());
|
|
|
+ cooperateManageQueryResVo.setRemark(cooperateManageQueryResDto.getRemark());
|
|
|
+ cooperateManageQueryResVo.setStatus(cooperateManageQueryResDto.getStatus());
|
|
|
+ cooperateManageQueryResVo.setApplyTypeCode(cooperateManageQueryResDto.getApplyTypeCode());
|
|
|
+ cooperateManageQueryResVo.setCreateByName(userMap.get(cooperateManageQueryResDto.getCreateBy()));
|
|
|
+ cooperateManageQueryResVo.setEntName(targetEntName);
|
|
|
+ cooperateManageQueryResVo.setEntId(targetEntId);
|
|
|
+ cooperateManageQueryResVo.setApprovalRemark(cooperateManageQueryResDto.getApprovalRemark());
|
|
|
+
|
|
|
+ //我方是发起方
|
|
|
+ if (entId.compareTo(cooperateManageQueryResDto.getInviterEntId()) == 0) {
|
|
|
+ cooperateManageQueryResVo.setContacts(cooperateManageQueryResDto.getInviteeContacts());
|
|
|
+ cooperateManageQueryResVo.setPhone(cooperateManageQueryResDto.getInviteePhone());
|
|
|
+ cooperateManageQueryResVo.setContactsId(cooperateManageQueryResDto.getInviteeContactsId());
|
|
|
+ cooperateManageQueryResVo.setManager(cooperateManageQueryResDto.getInviterContacts());
|
|
|
+ cooperateManageQueryResVo.setManagerPhone(cooperateManageQueryResDto.getInviterPhone());
|
|
|
+ cooperateManageQueryResVo.setManagerId(cooperateManageQueryResDto.getInviterContactsId());
|
|
|
+ } else {
|
|
|
+ cooperateManageQueryResVo.setContacts(cooperateManageQueryResDto.getInviterContacts());
|
|
|
+ cooperateManageQueryResVo.setPhone(cooperateManageQueryResDto.getInviterPhone());
|
|
|
+ cooperateManageQueryResVo.setContactsId(cooperateManageQueryResDto.getInviterContactsId());
|
|
|
+ cooperateManageQueryResVo.setManager(cooperateManageQueryResDto.getInviteeContacts());
|
|
|
+ cooperateManageQueryResVo.setManagerPhone(cooperateManageQueryResDto.getInviteePhone());
|
|
|
+ cooperateManageQueryResVo.setManagerId(cooperateManageQueryResDto.getInviteeContactsId());
|
|
|
+ }
|
|
|
+
|
|
|
+ result.add(cooperateManageQueryResVo);
|
|
|
+ }
|
|
|
+ return result;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -425,9 +501,17 @@ public class KwmCooperateApplyService {
|
|
|
* @date: 2023/7/11
|
|
|
*/
|
|
|
public void export(CooperateApplyQueryReqVo reqVo) {
|
|
|
- List<CooperateManageQueryResVo> list = commonBusinessService.findList(buildQueryParam(reqVo));
|
|
|
+ CooperateManageQueryReqDto reqDto = buildQueryParam(reqVo);
|
|
|
+ List<CooperateManageQueryResDto> list = kwmCooperateMapper.findList(reqDto);
|
|
|
+ if (CollectionUtils.isEmpty(list)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ List<CooperateManageQueryResVo> cooperateManageQueryResVos = getCooperateManageQueryResVos(reqDto, list);
|
|
|
+ if (CollectionUtils.isEmpty(cooperateManageQueryResVos)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
try {
|
|
|
- EasyExcelUtil.writeSingleExcel("合作申请.xlsx", "sheet1", list, CooperateManageQueryResVo.class);
|
|
|
+ EasyExcelUtil.writeSingleExcel("合作申请.xlsx", "sheet1", cooperateManageQueryResVos, CooperateManageQueryResVo.class);
|
|
|
} catch (IOException e) {
|
|
|
log.error("导出失败:", e);
|
|
|
throw new SystemException(HttpStatus.CODE_10301, HttpStatus.MSG_014);
|
|
|
@@ -446,13 +530,19 @@ public class KwmCooperateApplyService {
|
|
|
//初始化分组返参
|
|
|
List<FindListGroupResVo> result = commonBusinessService.init();
|
|
|
|
|
|
- List<CooperateManageQueryResVo> list = commonBusinessService.findList(buildQueryParam(reqVo));
|
|
|
+ CooperateManageQueryReqDto reqDto = buildQueryParam(reqVo);
|
|
|
+ List<CooperateManageQueryResDto> list = kwmCooperateMapper.findList(buildQueryParam(reqVo));
|
|
|
if (CollectionUtils.isEmpty(list)) {
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
+ List<CooperateManageQueryResVo> cooperateManageQueryResVos = getCooperateManageQueryResVos(reqDto, list);
|
|
|
+ if (CollectionUtils.isEmpty(cooperateManageQueryResVos)) {
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
//填充分组数据
|
|
|
- commonBusinessService.fillGroup(result, list);
|
|
|
+ commonBusinessService.fillGroup(result, cooperateManageQueryResVos);
|
|
|
return result;
|
|
|
}
|
|
|
|