|
|
@@ -17,12 +17,14 @@ import com.kym.common.utils.CommUtil;
|
|
|
import com.kym.common.utils.IDGenerator;
|
|
|
import com.kym.entity.admin.AdminUser;
|
|
|
import com.kym.entity.admin.AdminUserRole;
|
|
|
+import com.kym.entity.admin.InvestorInfo;
|
|
|
import com.kym.entity.admin.queryParams.CommonQueryParam;
|
|
|
import com.kym.entity.admin.vo.AdminUserVo;
|
|
|
import com.kym.entity.common.PageBean;
|
|
|
import com.kym.mapper.admin.AdminUserMapper;
|
|
|
import com.kym.service.admin.AdminUserRoleService;
|
|
|
import com.kym.service.admin.AdminUserService;
|
|
|
+import com.kym.service.admin.InvestorInfoService;
|
|
|
import jakarta.annotation.Resource;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
@@ -51,22 +53,22 @@ import java.util.Map;
|
|
|
public class AdminUserServiceImpl extends MPJBaseServiceImpl<AdminUserMapper, AdminUser> implements AdminUserService {
|
|
|
final static Digester MD5 = new Digester(DigestAlgorithm.MD5);
|
|
|
private static final Logger LOGGER = LoggerFactory.getLogger(AdminUserServiceImpl.class);
|
|
|
-
|
|
|
+ private final InvestorInfoService investorInfoService;
|
|
|
@Value("${password.privateKey}")
|
|
|
private String privateKey;
|
|
|
-
|
|
|
-
|
|
|
@Value("${password.publicKey}")
|
|
|
private String publicKey;
|
|
|
-
|
|
|
-
|
|
|
@Resource
|
|
|
private AdminUserRoleService adminUserRoleService;
|
|
|
|
|
|
+ public AdminUserServiceImpl(InvestorInfoService investorInfoService) {
|
|
|
+ this.investorInfoService = investorInfoService;
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public R<?> login(String mobilePhone, String password) {
|
|
|
var user = lambdaQuery().eq(AdminUser::getMobilePhone, mobilePhone).one();
|
|
|
- if(user.getStatus() == AdminUser.STATUS_禁用){
|
|
|
+ if (user.getStatus() == AdminUser.STATUS_禁用) {
|
|
|
throw new BusinessException("用户状态异常,无法登录");
|
|
|
}
|
|
|
RSA rsa = new RSA(privateKey, publicKey);
|
|
|
@@ -162,10 +164,18 @@ public class AdminUserServiceImpl extends MPJBaseServiceImpl<AdminUserMapper, Ad
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ @Transactional
|
|
|
public void updateAdminUser(AdminUserVo adminUserVo) {
|
|
|
- AdminUser entity = new AdminUser();
|
|
|
- BeanUtil.copyProperties(adminUserVo, entity);
|
|
|
- baseMapper.updateById(entity);
|
|
|
+ AdminUser adminUser = new AdminUser();
|
|
|
+ if (adminUserVo.getStatus() == AdminUser.STATUS_禁用) {
|
|
|
+ adminUser.setStatus(AdminUser.STATUS_禁用);
|
|
|
+ investorInfoService.lambdaUpdate().set(InvestorInfo::getStatus, InvestorInfo.STATUS_无效).eq(InvestorInfo::getAdminUserId, adminUserVo.getId()).update();
|
|
|
+ } else {
|
|
|
+ adminUser.setStatus(AdminUser.STATUS_启用);
|
|
|
+ investorInfoService.lambdaUpdate().set(InvestorInfo::getStatus, InvestorInfo.STATUS_有效).eq(InvestorInfo::getAdminUserId, adminUserVo.getId()).update();
|
|
|
+ }
|
|
|
+ BeanUtil.copyProperties(adminUserVo, adminUser);
|
|
|
+ baseMapper.updateById(adminUser);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -228,9 +238,9 @@ public class AdminUserServiceImpl extends MPJBaseServiceImpl<AdminUserMapper, Ad
|
|
|
var adminUser = lambdaQuery()
|
|
|
.eq(AdminUser::getOpenId, user.getOpenId())
|
|
|
.eq(AdminUser::getStatus, AdminUser.STATUS_启用).one();
|
|
|
- if(null==adminUser){
|
|
|
+ if (null == adminUser) {
|
|
|
return Collections.emptyMap();
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
StpUtil.login(adminUser.getId());
|
|
|
// 用户名存入session,统一日志读取使用
|
|
|
StpUtil.getSession().set("mobilePhone", adminUser.getMobilePhone());
|