|
@@ -1,5 +1,6 @@
|
|
|
package com.sckw.auth.service.impl;
|
|
package com.sckw.auth.service.impl;
|
|
|
|
|
|
|
|
|
|
+import cn.hutool.core.date.DateUtil;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.sckw.auth.model.vo.req.ForgetPasswordReqVo;
|
|
import com.sckw.auth.model.vo.req.ForgetPasswordReqVo;
|
|
|
import com.sckw.auth.model.vo.req.LoginReqVo;
|
|
import com.sckw.auth.model.vo.req.LoginReqVo;
|
|
@@ -8,8 +9,10 @@ import com.sckw.auth.model.vo.res.DeptInfoResVo;
|
|
|
import com.sckw.auth.model.vo.res.EntInfoResVo;
|
|
import com.sckw.auth.model.vo.res.EntInfoResVo;
|
|
|
import com.sckw.auth.model.vo.res.LoginResVo;
|
|
import com.sckw.auth.model.vo.res.LoginResVo;
|
|
|
import com.sckw.auth.util.AsyncFactory;
|
|
import com.sckw.auth.util.AsyncFactory;
|
|
|
|
|
+import com.sckw.core.model.enums.ApprovalEnum;
|
|
|
import com.sckw.core.model.enums.SystemTypeEnum;
|
|
import com.sckw.core.model.enums.SystemTypeEnum;
|
|
|
import com.sckw.core.utils.StringUtils;
|
|
import com.sckw.core.utils.StringUtils;
|
|
|
|
|
+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.model.LoginEntInfo;
|
|
import com.sckw.core.web.model.LoginEntInfo;
|
|
|
import com.sckw.core.web.model.LoginUserInfo;
|
|
import com.sckw.core.web.model.LoginUserInfo;
|
|
@@ -97,7 +100,25 @@ public class AuthServiceImpl implements IAuthService {
|
|
|
/* 4、查资质*/
|
|
/* 4、查资质*/
|
|
|
List<EntCertificateResDto> entCertificateResDtoList = remoteUserService.queryCertificateByEntId(entId);
|
|
List<EntCertificateResDto> entCertificateResDtoList = remoteUserService.queryCertificateByEntId(entId);
|
|
|
entInfoResVo.setCertificateInfo(entCertificateResDtoList);
|
|
entInfoResVo.setCertificateInfo(entCertificateResDtoList);
|
|
|
- /*4、生成token,一些信息存redis*/
|
|
|
|
|
|
|
+
|
|
|
|
|
+ //企业资质有效性判断 1、当前资质没过期,且状态是已认证 2、只要有认证过一次就算有效 参数判断
|
|
|
|
|
+ String checkType = "2";
|
|
|
|
|
+ if (checkType.equals("1")) {
|
|
|
|
|
+ for (EntCertificateResDto entCertificateResDto : entCertificateResDtoList) {
|
|
|
|
|
+ Date expireTime = entCertificateResDto.getExpireTime();
|
|
|
|
|
+ entInfoResVo.setValid(DateUtil.compare(new Date(), expireTime) <= 0);
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ List<EntCheckTrackResDto> entCheckTrackResDtoList = remoteUserService.checkTrackByEntId(entId);
|
|
|
|
|
+ if (CollectionUtils.isEmpty(entCheckTrackResDtoList)) {
|
|
|
|
|
+ entInfoResVo.setValid(false);
|
|
|
|
|
+ afterProcessor(loginResVo);
|
|
|
|
|
+ return loginResVo;
|
|
|
|
|
+ }
|
|
|
|
|
+ entInfoResVo.setValid(entCheckTrackResDtoList.stream().anyMatch(item -> item.getStatus() == Global.YES));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /*5、生成token,一些信息存redis*/
|
|
|
afterProcessor(loginResVo);
|
|
afterProcessor(loginResVo);
|
|
|
return loginResVo;
|
|
return loginResVo;
|
|
|
}
|
|
}
|
|
@@ -209,7 +230,7 @@ public class AuthServiceImpl implements IAuthService {
|
|
|
loginEntInfo.setApproval(entInfo.getApproval());
|
|
loginEntInfo.setApproval(entInfo.getApproval());
|
|
|
loginEntInfo.setRegTime(entInfo.getRegTime());
|
|
loginEntInfo.setRegTime(entInfo.getRegTime());
|
|
|
loginEntInfo.setCertificateInfo(BeanUtils.copyToList(entInfo.getCertificateInfo(), EntCertificateInfo.class));
|
|
loginEntInfo.setCertificateInfo(BeanUtils.copyToList(entInfo.getCertificateInfo(), EntCertificateInfo.class));
|
|
|
-
|
|
|
|
|
|
|
+ loginEntInfo.setValid(entInfo.getValid());
|
|
|
RedissonUtils.putString(Global.REDIS_ENTERPRISE_PREFIX + entInfo.getId(), JSON.toJSONString(loginEntInfo), Global.PC_TOKEN_EXPIRE);
|
|
RedissonUtils.putString(Global.REDIS_ENTERPRISE_PREFIX + entInfo.getId(), JSON.toJSONString(loginEntInfo), Global.PC_TOKEN_EXPIRE);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -234,7 +255,7 @@ public class AuthServiceImpl implements IAuthService {
|
|
|
loginUserInfo.setEntId(entInfo.getId());
|
|
loginUserInfo.setEntId(entInfo.getId());
|
|
|
List<DeptInfoResVo> deptInfo = entInfo.getDeptInfo();
|
|
List<DeptInfoResVo> deptInfo = entInfo.getDeptInfo();
|
|
|
if (!CollectionUtils.isEmpty(deptInfo)) {
|
|
if (!CollectionUtils.isEmpty(deptInfo)) {
|
|
|
- loginUserInfo.setDeptIds(String.join(",", deptInfo.stream().map(item-> String.valueOf(item.getId())).toList()));
|
|
|
|
|
|
|
+ loginUserInfo.setDeptIds(String.join(",", deptInfo.stream().map(item -> String.valueOf(item.getId())).toList()));
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
RedissonUtils.putString(Global.getFullUserLoginKey(loginResVo.getSystemType(), loginResVo.getId(), loginResVo.getClientType()), JSON.toJSONString(loginUserInfo), Global.PC_TOKEN_EXPIRE);
|
|
RedissonUtils.putString(Global.getFullUserLoginKey(loginResVo.getSystemType(), loginResVo.getId(), loginResVo.getClientType()), JSON.toJSONString(loginUserInfo), Global.PC_TOKEN_EXPIRE);
|