This commit is contained in:
周源 2022-04-27 22:18:17 +08:00
parent 1e7f67440c
commit 14db546118
16 changed files with 107 additions and 30 deletions

View File

@ -27,6 +27,7 @@ import com.ydool.boot.modules.rddb.entity.Db;
import com.ydool.boot.modules.rddb.entity.Office;
import com.ydool.boot.modules.rddb.service.DbService;
import com.ydool.boot.modules.rddb.service.OfficeService;
import com.ydool.boot.modules.rddb.service.UserTypeService;
import com.ydool.boot.modules.sys.entity.Role;
import com.ydool.boot.modules.sys.entity.User;
import com.ydool.boot.modules.sys.entity.UserRole;
@ -70,6 +71,8 @@ public class ApiAuthController extends ApiBaseController {
private DbService dbService;
@Autowired
private OfficeService officeService;
@Autowired
UserTypeService userTypeService;
@Value("${sys.dingding.appId}")
private String appId;
@ -102,7 +105,9 @@ public class ApiAuthController extends ApiBaseController {
if ((!"admin".equals(type)) && (!"admin".equals(type)) && (!"street".equals(type)) && (!"contact".equals(type)) && (!"rddb".equals(type)) && (!"voter".equals(type)))
fail("请检查身份类型");
phone= CodecUtils.encrypt(phone);
User user = userService.getOne(new LambdaQueryWrapper<User>().eq(User::getLoginName, phone).eq(User::getAccountType, type));
User user = userService.getOne(new LambdaQueryWrapper<User>().eq(User::getLoginName, phone)
// .eq(User::getAccountType, type)
);
if (user != null) {
//直接登录
login(user);
@ -203,17 +208,66 @@ public class ApiAuthController extends ApiBaseController {
}
}
@PostMapping("reset")
@ResponseBody
@ApiOperation(value = "重新")
public void sendPhoneCode() {
List<User> list = userService.list();
list.forEach(user->{
user.setPassword(Ydool.password(user.getSalt(), "xsrd789"));
});
userService.updateBatchById(list);
render(Ret.ok());
}
// @PostMapping("reset")
// @ResponseBody
// @ApiOperation(value = "重新")
// public void sendPhoneCode() {
// List<User> list = userService.list();
// list.forEach(user->{
// user.setPassword(Ydool.password(user.getSalt(), "xsrd789"));
// });
// userService.updateBatchById(list);
// render(Ret.ok());
// }
// @PostMapping("recover")
// @ResponseBody
// @ApiOperation(value = "恢复")
// public void recover() {
// //有一批老的机关用户,在变更多角色之前,user表里存了其机关身份,改了多角色之后,userType里没有把机关算进去,在他们加了代表角色之后
// //userType里多了代表角色,然后删代表角色的时候判断userType只有代表角色,以为没有别的角色,把user,role信息也给删了,导致登录不上去
// //-把userType也造出来,防止出现下次
// List<Office> officeList = officeService.list();
// officeList.forEach(office->{
// String userId = office.getUserId();
// User user = userService.getById(userId);
// if(user==null){
// user = new User();
// user.setId(userId);
// user.setSalt(RandomUtil.randomString(6));
// user.setPassword(Ydool.password(user.getSalt(), Global.getConfig(ConfigUtils.USER_INIT_PASSWORD)));
// user.setInitPwd(true);
// user.setStatus(1);
// user.setAccountType(office.getDuty());
//
// user.setLoginName(office.getPhone());
// user.setAccountType(office.getDuty());
// user.setUserName(office.getName());
// user.setPhone(office.getPhone());
// user.setStreetId(office.getStreet());
// userService.save(user);
//
// UserType userType = new UserType();
// userType.setUserId(user.getId());
// userType.setType(office.getDuty());
// userTypeService.saveOrUpdate(userType);
//
// if ("admin".equals(office.getDuty())) {
// Role role = roleService.getOne(new QueryWrapper<Role>().eq("code", "admin"));
// if (role != null) {
// userRoleService.save(new UserRole(office.getUserId(), role.getId()));
// }
// } else {
// //默认权限
// Role role = roleService.getOne(new QueryWrapper<Role>().eq("code", "default"));
// if (role != null) {
// userRoleService.save(new UserRole(office.getUserId(), role.getId()));
// }
// }
// }
// });
// render(Ret.ok());
// }
@PostMapping("sendCode/login")
@ResponseBody
@ -289,6 +343,8 @@ public class ApiAuthController extends ApiBaseController {
userRoleService.save(new UserRole(user.getId(), role.getId()));
}
//只注册选民
//县级人大工作人员乡镇管理员联络站管理员 需创建机关人员信息
if ("admin".equals(type) || "street".equals(type) || "contact".equals(type)) {
Office office = new Office();

View File

@ -7,7 +7,6 @@ import com.ydool.boot.common.Ydool;
import com.ydool.boot.common.cache.ConfigUtils;
import com.ydool.boot.core.entity.BaseEntity;
import com.ydool.boot.core.validator.Phone;
import com.ydool.boot.core.validator.Unique;
import lombok.EqualsAndHashCode;
import javax.validation.constraints.Email;
@ -34,7 +33,7 @@ public class UserDto extends BaseEntity {
* 登录账号
*/
@NotBlank(message = "请输入登录账号")
@Unique(message = "登录账号必须是唯一的")
// @Unique(message = "登录账号必须是唯一的")
private String loginName;
private String openId;

View File

@ -81,7 +81,15 @@ public class DbService extends BaseService<DbMapper, Db> {
}
}
Db db = BeanUtil.copyProperties(vo, Db.class);
Db db=null;
if(repeatUser!=null){
db = getOne(new LambdaQueryWrapper<Db>().eq(Db::getUserId, repeatUser.getId()));
}
if(db!=null){
BeanUtil.copyProperties(vo, db,"id");
} else{
db= BeanUtil.copyProperties(vo, Db.class);
}
User user;
if (StrUtil.isBlank(vo.getId())) {
@ -89,7 +97,13 @@ public class DbService extends BaseService<DbMapper, Db> {
//写入其他身份
if (repeatFlag) {
user = userService.getOne(new QueryWrapper<User>().eq("phone", vo.getPhone()));
user = userService.getOne(new QueryWrapper<User>()
.eq("phone", vo.getPhone())
.eq("account_type","rddb"));
if(user==null) {
user = userService.getOne(new QueryWrapper<User>()
.eq("phone", vo.getPhone()));
}
} else {
//新增保存
user = this.getUser();

View File

@ -222,10 +222,14 @@ public class OfficeService extends BaseService<OfficeMapper, Office> {
user.setAccountType(list.get(0).getType());
userService.updateById(user);
} else {
User user = userService.getById(office.getUserId());
//多角色之前的老用户,是没有userType的..
if(user!=null&&!Const.TYPE_RDDB.equals(user)){
//没有整个user都删除
userRoleService.remove(new QueryWrapper<UserRole>().eq("user_id", office.getUserId()));
userService.removeById(office.getUserId());
}
}
//删除机关的角色
userTypeService.remove(new LambdaQueryWrapper<UserType>().eq(UserType::getUserId, office.getUserId()).eq(UserType::getType, Const.TYPE_ADMIN));

View File

@ -122,9 +122,13 @@ public class DbController extends BaseAdminController {
if (bean != null) {
List<UserType> list = userTypeService.list(new LambdaQueryWrapper<UserType>().eq(UserType::getUserId, bean.getUserId()).ne(UserType::getType, Const.TYPE_RDDB));
if (CollectionUtil.isEmpty(list)) {
User user = userService.getById(bean.getUserId());
//多角色之前的老用户,是没有userType的
if(user!=null&&Const.TYPE_RDDB.equals(user)){
//仅有代表角色时候删掉整个user
userRoleService.remove(new QueryWrapper<UserRole>().eq("user_id", bean.getUserId()));
userService.removeById(bean.getUserId());
}
} else {
//还有其他角色否则切换当前角色
User user = userService.getById(bean.getUserId());

View File

@ -13,7 +13,7 @@ db.driver = com.mysql.cj.jdbc.Driver
spring.servlet.multipart.max-file-size=500MB
spring.servlet.multipart.max-request-size=500MB
spring.redis.host=106.54.109.185
spring.redis.host=127.0.0.1
ydool.path=/admin
ydool.homeUrl=/page

View File

@ -1 +1 @@
*{box-sizing:border-box}body{background-color:#f8f8f8}body,button,input,select,textarea{font-family:PingFang SC,PingFang SC-Bold!important}img{max-width:100%}table{width:100%!important}#app{height:100%;display:flex;flex-direction:column}.van-tabs__line{background-color:#d03a29}.van-pagination{min-height:1.06667rem}.van-search{min-height:1.44rem}.van-tabs--line .van-tabs__wrap{min-height:1.17333rem}.navVar-box[data-v-fe379062]{min-height:1.22667rem}.navVar-box .van-nav-bar[data-v-fe379062]{background-color:#d03a29}.navVar-box .van-nav-bar[data-v-fe379062] .van-icon,.navVar-box .van-nav-bar[data-v-fe379062] .van-nav-bar__left,.navVar-box .van-nav-bar[data-v-fe379062] .van-nav-bar__right,.navVar-box .van-nav-bar[data-v-fe379062] .van-nav-bar__title{font-size:.42667rem;color:#fff}.navVar-box .van-nav-bar[data-v-fe379062] .van-nav-bar__title{font-weight:700}.navVar-box .van-nav-bar[data-v-fe379062] .van-nav-bar__right .right{display:flex;align-items:center}.tabbar[data-v-6e6a4500]{min-height:1.33333rem}blockquote,body,button,dd,dl,dt,fieldset,h1,h2,h3,h4,h5,h6,hr,input,lengend,li,ol,p,pre,td,textarea,th,ul{margin:0;padding:0}body,button,input,select,textarea{font:.32rem/1 Tahoma,Helvetica,Arial,"\5b8b\4f53",sans-serif}h1{font-size:.48rem}h2{font-size:.42667rem}h3{font-size:.37333rem}h4,h5,h6{font-size:100%}address,cite,dfn,em,var{font-style:normal}code,kbd,pre,samp,tt{font-family:Courier New,Courier,monospace}small{font-size:.32rem}ol,ul{list-style:none}a{text-decoration:none}a:hover{text-decoration:underline}abbr[title],acronym[title]{border-bottom:.02667rem dotted;cursor:help}q:after,q:before{content:""}legend{color:#000}fieldset,img{border:none}button,input,select,textarea{font-size:100%}table{border-collapse:collapse;border-spacing:0}hr{border:none;height:.02667rem}body,html{height:100%}.w-100{width:100%}.h-100{height:100%}.text-overflow{white-space:nowrap}.more-overflow,.text-overflow{overflow:hidden;text-overflow:ellipsis}.more-overflow{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}
*{box-sizing:border-box}body{background-color:#f8f8f8}body,button,input,select,textarea{font-family:PingFang SC,PingFang SC-Bold!important}img{max-width:100%}table{width:100%!important}#app{height:100%;display:flex;flex-direction:column}.van-tabs__line{background-color:#d03a29}.van-pagination{min-height:1.06667rem}.van-search{min-height:1.44rem}.van-tabs--line .van-tabs__wrap{min-height:1.17333rem}.navVar-box[data-v-fe379062]{min-height:1.22667rem}.navVar-box .van-nav-bar[data-v-fe379062]{background-color:#d03a29}.navVar-box .van-nav-bar[data-v-fe379062] .van-icon,.navVar-box .van-nav-bar[data-v-fe379062] .van-nav-bar__left,.navVar-box .van-nav-bar[data-v-fe379062] .van-nav-bar__right,.navVar-box .van-nav-bar[data-v-fe379062] .van-nav-bar__title{font-size:.42667rem;color:#fff}.navVar-box .van-nav-bar[data-v-fe379062] .van-nav-bar__title{font-weight:700}.navVar-box .van-nav-bar[data-v-fe379062] .van-nav-bar__right .right{display:flex;align-items:center}.tabbar[data-v-66576ee0]{min-height:1.33333rem}blockquote,body,button,dd,dl,dt,fieldset,h1,h2,h3,h4,h5,h6,hr,input,lengend,li,ol,p,pre,td,textarea,th,ul{margin:0;padding:0}body,button,input,select,textarea{font:.32rem/1 Tahoma,Helvetica,Arial,"\5b8b\4f53",sans-serif}h1{font-size:.48rem}h2{font-size:.42667rem}h3{font-size:.37333rem}h4,h5,h6{font-size:100%}address,cite,dfn,em,var{font-style:normal}code,kbd,pre,samp,tt{font-family:Courier New,Courier,monospace}small{font-size:.32rem}ol,ul{list-style:none}a{text-decoration:none}a:hover{text-decoration:underline}abbr[title],acronym[title]{border-bottom:.02667rem dotted;cursor:help}q:after,q:before{content:""}legend{color:#000}fieldset,img{border:none}button,input,select,textarea{font-size:100%}table{border-collapse:collapse;border-spacing:0}hr{border:none;height:.02667rem}body,html{height:100%}.w-100{width:100%}.h-100{height:100%}.text-overflow{white-space:nowrap}.more-overflow,.text-overflow{overflow:hidden;text-overflow:ellipsis}.more-overflow{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -148,7 +148,7 @@
<%
if (hasAuth("tzry:county_sage:resetpwd")) { %>
actions.push('<a href="${ctx}/rddb/voter/resetpwd?id=' + row.userId + '" class="btnList" title="密码重置" data-confirm="确认要将该选民密码重置到初始状态吗?"><i class="fa fa-check-circle-o"></i> </a>&nbsp;');
actions.push('<a href="${ctx}/rddb/voter/resetpwd?id=' + row.userId + '" class="btnList" title="密码重置" data-confirm="确认要将该密码重置到初始状态吗?"><i class="fa fa-check-circle-o"></i> </a>&nbsp;');
<%
}
%>

View File

@ -114,7 +114,7 @@
<% } %>
<% if(hasAuth('rddb:office:resetpwd')) { %>
actions.push('<a href="${ctx}/rddb/voter/resetpwd?id=' + row.userId + '" class="btnList" title="密码重置" data-confirm="确认要将该选民密码重置到初始状态吗?"><i class="fa fa-check-circle-o"></i> </a>&nbsp;');
actions.push('<a href="${ctx}/rddb/voter/resetpwd?id=' + row.userId + '" class="btnList" title="密码重置" data-confirm="确认要将该密码重置到初始状态吗?"><i class="fa fa-check-circle-o"></i> </a>&nbsp;');
<% } %>
return actions.join('');