V13
This commit is contained in:
2
doc/2025-08-12.sql
Normal file
2
doc/2025-08-12.sql
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
ALTER TABLE `cai_batch_add_user`
|
||||||
|
ADD COLUMN `password_type` int NOT NULL DEFAULT 1 COMMENT '1=规则生成 2-随机密码';
|
||||||
@@ -49,6 +49,10 @@ public class BatchAddUser implements Serializable {
|
|||||||
* 手机后缀起点(后4位)
|
* 手机后缀起点(后4位)
|
||||||
*/
|
*/
|
||||||
private Integer phoneSuffixStart;
|
private Integer phoneSuffixStart;
|
||||||
|
/**
|
||||||
|
* 1-规则生成 2-随机密码
|
||||||
|
*/
|
||||||
|
private Integer passwordType;
|
||||||
/**
|
/**
|
||||||
* 密码前缀
|
* 密码前缀
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.ruoyi.cai.service.impl;
|
package com.ruoyi.cai.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.RandomUtil;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
@@ -82,7 +83,12 @@ public class BatchAddUserServiceImpl extends ServiceImpl<BatchAddUserMapper,Batc
|
|||||||
log.error("新增用户:手机号非法 mobile={}",phone);
|
log.error("新增用户:手机号非法 mobile={}",phone);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
String password = String.format("%s%s", batchAddUser.getPasswordPrefix(), batchAddUser.getPasswordSuffixStart()+i);
|
String password = null;
|
||||||
|
if(batchAddUser.getPasswordType() == null || batchAddUser.getPasswordType() == 1){
|
||||||
|
password = String.format("%s%s", batchAddUser.getPasswordPrefix(), batchAddUser.getPasswordSuffixStart()+i);
|
||||||
|
}else{
|
||||||
|
password = RandomUtil.randomNumbers(8);
|
||||||
|
}
|
||||||
String code = systemConfigManager.getSystemConfig(SystemConfigEnum.SMS_CODE_ADMIN);
|
String code = systemConfigManager.getSystemConfig(SystemConfigEnum.SMS_CODE_ADMIN);
|
||||||
CaiRegisterUser registerUser = new CaiRegisterUser();
|
CaiRegisterUser registerUser = new CaiRegisterUser();
|
||||||
registerUser.setUsername(phone);
|
registerUser.setUsername(phone);
|
||||||
|
|||||||
Reference in New Issue
Block a user