|
@@ -30,10 +30,9 @@ import com.sckw.stream.enums.MessageEnum;
|
|
|
import com.sckw.stream.model.UserInfo;
|
|
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.KwsEntDeptDto;
|
|
|
|
|
-import com.sckw.system.api.model.dto.res.RegisterResDto;
|
|
|
|
|
|
|
+import com.sckw.system.api.model.dto.res.*;
|
|
|
import com.sckw.system.dao.*;
|
|
import com.sckw.system.dao.*;
|
|
|
|
|
+import com.sckw.system.dubbo.RemoteBaseService;
|
|
|
import com.sckw.system.dubbo.RemoteSystemServiceImpl;
|
|
import com.sckw.system.dubbo.RemoteSystemServiceImpl;
|
|
|
import com.sckw.system.model.*;
|
|
import com.sckw.system.model.*;
|
|
|
import com.sckw.system.model.pojo.FindEntListPojo;
|
|
import com.sckw.system.model.pojo.FindEntListPojo;
|
|
@@ -51,6 +50,7 @@ import jakarta.servlet.http.HttpServletResponse;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.jetbrains.annotations.NotNull;
|
|
import org.jetbrains.annotations.NotNull;
|
|
|
|
|
+import org.jetbrains.annotations.Nullable;
|
|
|
import org.redisson.api.RSet;
|
|
import org.redisson.api.RSet;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
@@ -122,7 +122,8 @@ public class KwsEnterpriseService {
|
|
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private KwsSpecialDao specialDao;
|
|
private KwsSpecialDao specialDao;
|
|
|
-
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private RemoteBaseService remoteBaseService;
|
|
|
private final KwsEntTypeRepository kwsEntTypeRepository;
|
|
private final KwsEntTypeRepository kwsEntTypeRepository;
|
|
|
private final KwsEnterpriseRepository kwsEnterpriseRepository;
|
|
private final KwsEnterpriseRepository kwsEnterpriseRepository;
|
|
|
|
|
|
|
@@ -1686,4 +1687,55 @@ public class KwsEnterpriseService {
|
|
|
List<KwsEnterprise> kwsEnterprises = kwsEnterpriseDao.selectList(new LambdaQueryWrapper<KwsEnterprise>().eq(KwsEnterprise::getPid, 0).eq(KwsEnterprise::getApproval, 1).eq(KwsEnterprise::getStatus, 0));
|
|
List<KwsEnterprise> kwsEnterprises = kwsEnterpriseDao.selectList(new LambdaQueryWrapper<KwsEnterprise>().eq(KwsEnterprise::getPid, 0).eq(KwsEnterprise::getApproval, 1).eq(KwsEnterprise::getStatus, 0));
|
|
|
return kwsEnterprises.stream().map(d -> BeanUtils.toBean(d, EntBaseInfo.class)).collect(Collectors.toList());
|
|
return kwsEnterprises.stream().map(d -> BeanUtils.toBean(d, EntBaseInfo.class)).collect(Collectors.toList());
|
|
|
}
|
|
}
|
|
|
|
|
+ @Nullable
|
|
|
|
|
+ private EntCacheResDto getEntCacheResDto(Long entId) {
|
|
|
|
|
+ KwsEnterpriseResDto kwsEnterpriseResDto = remoteBaseService.queryEnterpriseById(entId);
|
|
|
|
|
+ if (Objects.isNull(kwsEnterpriseResDto)) {
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ EntCacheResDto entCacheResDto = new EntCacheResDto();
|
|
|
|
|
+ BeanUtils.copyProperties(kwsEnterpriseResDto, entCacheResDto);
|
|
|
|
|
+// entCacheResDto.setDeptInfo(remoteBaseService.queryDeftInfoByEntId(entId));
|
|
|
|
|
+ entCacheResDto.setCertificateInfo(remoteBaseService.queryCertificateByEntId(entId));
|
|
|
|
|
+ KwsUser kwsUser = remoteBaseService.queryManageByEntId(entId);
|
|
|
|
|
+ if (Objects.nonNull(kwsUser)) {
|
|
|
|
|
+ entCacheResDto.setContactsId(kwsUser.getId());
|
|
|
|
|
+ entCacheResDto.setContacts(kwsUser.getName());
|
|
|
|
|
+ entCacheResDto.setPhone(kwsUser.getPhone());
|
|
|
|
|
+ }
|
|
|
|
|
+ List<EntTypeResDto> entTypeResDtos = remoteBaseService.queryEntTypeById(entId);
|
|
|
|
|
+ if (CollectionUtils.isNotEmpty(entTypeResDtos)) {
|
|
|
|
|
+ entCacheResDto.setEntTypes(String.join(Global.COMMA, entTypeResDtos.stream().map(EntTypeResDto::getType).map(String::valueOf).distinct().toList()));
|
|
|
|
|
+ entCacheResDto.setEntTypeNames(EntTypeEnum.getNames(entCacheResDto.getEntTypes()));
|
|
|
|
|
+ }
|
|
|
|
|
+ return entCacheResDto;
|
|
|
|
|
+ }
|
|
|
|
|
+ public EntCacheResDto queryEntCacheById(Long entId) {
|
|
|
|
|
+ if (Objects.isNull(entId)) {
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+ String key = Global.REDIS_ENTERPRISE_PREFIX + entId;
|
|
|
|
|
+ String dictCache = RedissonUtils.getString(key);
|
|
|
|
|
+ //从redis查,查不到从数据库查,并写入redis
|
|
|
|
|
+ if (StringUtils.isBlank(dictCache)) {
|
|
|
|
|
+ EntCacheResDto entCacheResDto = getEntCacheResDto(entId);
|
|
|
|
|
+ if (Objects.isNull(entCacheResDto)) {
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+ RedissonUtils.putString(key, JSON.toJSONString(entCacheResDto), Global.COMMON_EXPIRE);
|
|
|
|
|
+ return entCacheResDto;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ EntCacheResDto entCacheResDto = JSONObject.parseObject(dictCache, EntCacheResDto.class);
|
|
|
|
|
+ if (Objects.isNull(entCacheResDto.getContactsId())) {
|
|
|
|
|
+ entCacheResDto = getEntCacheResDto(entId);
|
|
|
|
|
+ if (Objects.isNull(entCacheResDto)) {
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ RedissonUtils.putString(key, dictCache, Global.COMMON_EXPIRE);
|
|
|
|
|
+ return entCacheResDto;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|