|
@@ -2,6 +2,7 @@ package com.sckw.system.service;
|
|
|
|
|
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
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.BusinessException;
|
|
@@ -14,7 +15,6 @@ import com.sckw.core.model.page.PageHelperUtil;
|
|
|
import com.sckw.core.model.page.PageResult;
|
|
import com.sckw.core.model.page.PageResult;
|
|
|
import com.sckw.core.utils.*;
|
|
import com.sckw.core.utils.*;
|
|
|
import com.sckw.core.web.constant.HttpStatus;
|
|
import com.sckw.core.web.constant.HttpStatus;
|
|
|
-import com.sckw.core.web.context.LoginEntHolder;
|
|
|
|
|
import com.sckw.core.web.context.LoginUserHolder;
|
|
import com.sckw.core.web.context.LoginUserHolder;
|
|
|
import com.sckw.core.web.model.EntCertificateInfo;
|
|
import com.sckw.core.web.model.EntCertificateInfo;
|
|
|
import com.sckw.core.web.response.HttpResult;
|
|
import com.sckw.core.web.response.HttpResult;
|
|
@@ -25,6 +25,7 @@ import com.sckw.stream.model.UserInfo;
|
|
|
import com.sckw.system.api.RemoteUserService;
|
|
import com.sckw.system.api.RemoteUserService;
|
|
|
import com.sckw.system.api.model.dto.req.RegisterReqDto;
|
|
import com.sckw.system.api.model.dto.req.RegisterReqDto;
|
|
|
import com.sckw.system.api.model.dto.res.EntCacheResDto;
|
|
import com.sckw.system.api.model.dto.res.EntCacheResDto;
|
|
|
|
|
+import com.sckw.system.api.model.dto.res.KwsEntDeptDto;
|
|
|
import com.sckw.system.api.model.dto.res.RegisterResDto;
|
|
import com.sckw.system.api.model.dto.res.RegisterResDto;
|
|
|
import com.sckw.system.dao.*;
|
|
import com.sckw.system.dao.*;
|
|
|
import com.sckw.system.dubbo.RemoteSystemServiceImpl;
|
|
import com.sckw.system.dubbo.RemoteSystemServiceImpl;
|
|
@@ -42,7 +43,6 @@ import com.sckw.system.repository.KwsEnterpriseRepository;
|
|
|
import jakarta.servlet.http.HttpServletRequest;
|
|
import jakarta.servlet.http.HttpServletRequest;
|
|
|
import jakarta.servlet.http.HttpServletResponse;
|
|
import jakarta.servlet.http.HttpServletResponse;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
import lombok.RequiredArgsConstructor;
|
|
|
-import org.apache.commons.collections4.MapUtils;
|
|
|
|
|
import org.jetbrains.annotations.NotNull;
|
|
import org.jetbrains.annotations.NotNull;
|
|
|
import org.redisson.api.RSet;
|
|
import org.redisson.api.RSet;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -1619,4 +1619,62 @@ public class KwsEnterpriseService {
|
|
|
entInfoResp.setEntInfos(entInfos);
|
|
entInfoResp.setEntInfos(entInfos);
|
|
|
return entInfoResp;
|
|
return entInfoResp;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ *
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ public List<EntFindInfoResp> querySupOrProEnt(EntFindInfoRequest request) {
|
|
|
|
|
+ List<EntCacheResDto> entResDtoList = new ArrayList<>();
|
|
|
|
|
+ //查询当前登录企业
|
|
|
|
|
+ EntCacheResDto entCacheResDto = remoteSystemService.queryEntCacheById(LoginUserHolder.getEntId());
|
|
|
|
|
+ if (entCacheResDto == null) {
|
|
|
|
|
+ throw new RuntimeException("entId:" + LoginUserHolder.getEntId() + ", 企业信息不存在!");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ int entType = Integer.parseInt(entCacheResDto.getEntTypes());
|
|
|
|
|
+ if (entType != EntTypeEnum.SUPPLIER.getCode()) {
|
|
|
|
|
+ throw new RuntimeException("entId:" + LoginUserHolder.getEntId() + ", 只有供应商企业可以创建钱包!");
|
|
|
|
|
+ }
|
|
|
|
|
+ //供应企业
|
|
|
|
|
+ if (EntTypeEnum.SUPPLIER.getCode() == request.getEntType()) {
|
|
|
|
|
+ entResDtoList.add(entCacheResDto);
|
|
|
|
|
+ //查询当前供应商的子级企业
|
|
|
|
|
+ List<KwsEntDeptDto> kwsEntDeptDtoList = remoteSystemService.queryEntDeptByPid(entCacheResDto.getParentId());
|
|
|
|
|
+ if (CollectionUtils.isEmpty(kwsEntDeptDtoList)){
|
|
|
|
|
+ return entResDtoList.stream().map(EntFindInfoResp::toPageResp).collect(Collectors.toList());
|
|
|
|
|
+ }
|
|
|
|
|
+ List<Long> parentId = kwsEntDeptDtoList.stream().map(KwsEntDeptDto::getEntId).collect(Collectors.toList());
|
|
|
|
|
+ List<EntCacheResDto> entDtoList = remoteSystemService.queryEntCacheByIds(parentId);
|
|
|
|
|
+ entResDtoList.addAll(entDtoList);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ //查询采购商企业信息
|
|
|
|
|
+ List<EntCacheResDto> entDtoList = queryKwsEnterpriseById();
|
|
|
|
|
+ entResDtoList.addAll(entDtoList);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return entResDtoList.stream().map(EntFindInfoResp::toPageResp).collect(Collectors.toList());
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+
|
|
|
|
|
+ * @return KwsEnterprise
|
|
|
|
|
+ * @desc: 放开接口
|
|
|
|
|
+ * @author: czh
|
|
|
|
|
+ * @date: 2023/7/26
|
|
|
|
|
+ */
|
|
|
|
|
+ public List<EntCacheResDto> queryKwsEnterpriseById() {
|
|
|
|
|
+ //查询采购商企业信息
|
|
|
|
|
+ LambdaQueryWrapper<KwsEntType> queryWrapper = Wrappers.<KwsEntType>lambdaQuery()
|
|
|
|
|
+ .eq(KwsEntType::getType, 2)
|
|
|
|
|
+ .eq(KwsEntType::getDelFlag, 0);
|
|
|
|
|
+ List<KwsEntType> kwsEntTypes = kwsEntTypeDao.selectList(queryWrapper);
|
|
|
|
|
+ if (kwsEntTypes.isEmpty()) {
|
|
|
|
|
+ return new ArrayList<>();
|
|
|
|
|
+ }
|
|
|
|
|
+ List<Long> entId = kwsEntTypes.stream().map(KwsEntType::getEntId).distinct().collect(Collectors.toList());
|
|
|
|
|
+ return remoteSystemService.queryEntCacheByIds(entId);
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
}
|
|
}
|