Commit 882da7ea by baochunxin

#G:通知问题修改,新增家长手机密码登录方式

parent 5dbb41ff
......@@ -85,7 +85,7 @@ spring:
devtools:
restart:
# 热部署开关
enabled: true
enabled: false
# redis 配置
redis:
# 地址
......
......@@ -112,7 +112,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
.antMatchers( "/ws/webSocket/**").anonymous()
.antMatchers( "/webSocket/**").anonymous()
.antMatchers("/login", "/register", "/captchaImage").anonymous()
.antMatchers("/wx/user/login").permitAll()
.antMatchers("/wx/user/login","/wx/user/getRoleType/**").permitAll()
.antMatchers("/dd/user/login").permitAll()
.antMatchers( "/common/**").permitAll()
.antMatchers( "/dd/school/**").permitAll()
......
......@@ -32,6 +32,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="employeeType" column="employee_type" />
<result property="studentId" column="student_id" />
<result property="sign" column="sign" />
<result property="ddUserId" column="dd_user_id" />
<result property="unionId" column="union_id" />
<association property="dept" column="dept_id" javaType="SysDept" resultMap="deptResult" />
<collection property="roles" javaType="java.util.List" resultMap="RoleResult" />
</resultMap>
......@@ -56,7 +58,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectUserVo">
select u.user_id, u.dept_id, u.user_name, u.login_name,u.user_type, u.user_login_type,u.email, u.avatar, u.phonenumber, u.password, u.salt,u.sex, u.status, u.del_flag, u.login_ip, u.login_date,u.pwd_update_date, u.create_by, u.create_time, u.remark,u.sign,u.employee_type,u.student_id,
select u.user_id, u.dept_id, u.user_name, u.login_name,u.user_type,u.union_id,u.dd_user_id, u.user_login_type,u.email, u.avatar, u.phonenumber, u.password, u.salt,u.sex, u.status, u.del_flag, u.login_ip, u.login_date,u.pwd_update_date, u.create_by, u.create_time, u.remark,u.sign,u.employee_type,u.student_id,
d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.status as dept_status,
r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.status as role_status
from sys_user u
......@@ -66,7 +68,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</sql>
<select id="selectUserList" parameterType="SysUser" resultMap="SysUserResult">
select u.user_id, u.dept_id, u.login_name, u.user_name,u.user_type, u.user_login_type, u.email, u.avatar, u.phonenumber, u.sex,u.salt, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, d.dept_name, d.leader from sys_user u
select u.user_id, u.dept_id, u.login_name, u.user_name,u.union_id,u.dd_user_id,u.user_type, u.user_login_type, u.email, u.avatar, u.phonenumber, u.sex,u.salt, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, d.dept_name, d.leader from sys_user u
left join sys_dept d on u.dept_id = d.dept_id
where u.del_flag = '0' and user_login_type = '0'
<if test="userId != null and userId != 0">
......@@ -96,7 +98,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectUserListTypeLogin" parameterType="SysUser" resultMap="SysUserResult">
select u.user_id, u.dept_id, u.login_name, u.user_name,u.user_type, u.user_login_type, u.email, u.avatar, u.phonenumber, u.sex,u.salt,u.student_id, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, d.dept_name, d.leader from sys_user u
select u.user_id, u.dept_id, u.login_name, u.union_id,u.dd_user_id,u.user_name,u.user_type, u.user_login_type, u.email, u.avatar, u.phonenumber, u.sex,u.salt,u.student_id, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, d.dept_name, d.leader from sys_user u
left join sys_dept d on u.dept_id = d.dept_id
where u.del_flag = '0'
<if test="userLoginType != null and userLoginType != 0">
......@@ -143,7 +145,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<select id="selectUnallocatedList" parameterType="SysUser" resultMap="SysUserResult">
select distinct u.user_id, u.dept_id, u.user_name, u.login_name,u.user_type, u.email, u.phonenumber, u.status, u.create_time
select distinct u.user_id, u.dept_id, u.user_name,u.union_id,u.dd_user_id, u.login_name,u.user_type, u.email, u.phonenumber, u.status, u.create_time
from sys_user u
left join sys_dept d on u.dept_id = d.dept_id
left join sys_user_role ur on u.user_id = ur.user_id
......@@ -203,6 +205,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="sign != null and sign != ''">sign,</if>
<if test="studentId != null and studentId != 0">student_id,</if>
<if test="employeeType != null and employeeType != ''">employee_type,</if>
<if test="unionId != null and employeeType != ''">union_id,</if>
<if test="ddUserId != null and employeeType != ''">dd_user_id,</if>
create_time
)values(
<if test="userId != null and userId != ''">#{userId},</if>
......@@ -224,6 +228,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="sign != null and sign != ''">#{sign},</if>
<if test="studentId != null and studentId != ''">#{studentId},</if>
<if test="employeeType != null and employeeType != ''">#{employeeType},</if>
<if test="employeeType != null and employeeType != ''">#{employeeType},</if>
<if test="unionId != null and unionId != ''">#{unionId},</if>
<if test="ddUserId != null and ddUserId != ''">#{ddUserId},</if>
sysdate()
)
</insert>
......
......@@ -84,8 +84,7 @@ public class SchoolNotificationGroupController extends BaseController {
* 根据分组id查询人员信息
*/
@GetMapping("/getUserList/{notificationId}")
public TableDataInfo selectOne(@PathVariable("notificationId") Long notificationId) {
startPage();
public AjaxResult selectOne(@PathVariable("notificationId") Long notificationId) {
LambdaQueryWrapper<SchoolNotificationUser> lqw = new LambdaQueryWrapper<>();
lqw.eq(SchoolNotificationUser::getNotificationId, notificationId);
List<SchoolNotificationUser> list = this.schoolNotificationUserService.list(lqw);
......@@ -94,7 +93,7 @@ public class SchoolNotificationGroupController extends BaseController {
SysUser sysUser = sysUserService.selectUserById(data.getUserId());
userList.add(sysUser);
});
return getDataTable(userList);
return AjaxResult.success(userList);
}
/**
......@@ -129,6 +128,10 @@ public class SchoolNotificationGroupController extends BaseController {
SchoolNotificationUser date = new SchoolNotificationUser();
date.setNotificationId(schoolNotificationUser.getNotificationId());
date.setUserId(id);
SchoolNotificationUser oneNotificationUser = schoolNotificationUserService.getOneNotificationUser(date);
if (null != oneNotificationUser){
throw new RuntimeException("当前用户存在分组中");
}
boolean save = this.schoolNotificationUserService.save(date);
}
return AjaxResult.success();
......
......@@ -31,6 +31,12 @@ public class SchoolMessagePush extends OurBaseEntity {
*/
private Long groupId;
/**
* 接收人分组名称
*/
private String groupName;
/** 消息类型 */
@Excel(name = "消息类型",readConverterExp = "1=通知,2=公告")
private String messageType;
......
......@@ -42,6 +42,8 @@ public interface SchoolStudentMapper extends BaseMapper<SchoolStudent> {
*/
List<SchoolStudent> getMemberByTeacher(Long teacherId);
Long getDdUserId(String foUserId);
/**
* 家长查看班级其他同学
* @param studentId
......
......@@ -10,18 +10,22 @@ import yangtz.cs.liu.wechat.vo.userInfo.UserInfoVo;
import java.util.List;
import java.util.Map;
@Mapper
public interface SchoolStudentParentMapper extends BaseMapper<SchoolStudentParent> {
List<SchoolStudentParent> queryList(SchoolStudentParent schoolStudentParent);
List<Map<String,Object>> getRoleTypeByPhoneNumber(String phonenumber);
/**
* 微信公众号登录查询(电话)
* @param parentTelephone
* @return
*/
SchoolStudentParent selectUserByParentTel(@Param("parentTelephone") String parentTelephone, @Param("studentIdCard") String studentIdCard);
SchoolStudentParent selectUserByParentTel(@Param("parentTelephone") String parentTelephone);
/**
* 公众号,获取用户信息
......
......@@ -26,6 +26,7 @@ import yangtz.cs.liu.wechat.vo.userInfo.UserInfoVo;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import static com.baomidou.mybatisplus.core.toolkit.ObjectUtils.isNotNull;
import static com.baomidou.mybatisplus.core.toolkit.ObjectUtils.isNull;
......@@ -67,6 +68,14 @@ public class SchoolStudentParentServiceImpl extends ServiceImpl<SchoolStudentPar
return schoolStudentParentMapper.selectList(lqw);
}
public List<Map<String,Object>> getRoleTypeByPhoneNumber(String phonenumber){
return schoolStudentParentMapper.getRoleTypeByPhoneNumber(phonenumber);
}
/**
* 公众号,获取用户信息
*
......
......@@ -419,6 +419,10 @@ public class SchoolStudentServiceImpl extends ServiceImpl<SchoolStudentMapper, S
return schoolStudentMapper.getMemberByTeacher(teacherId);
}
public Long getDdUserId(String foUserId ){
return schoolStudentMapper.getDdUserId(foUserId);
}
/**
* 家长查看班级其他同学
*
......
......@@ -57,6 +57,13 @@ public interface ISchoolStudentService extends IService<SchoolStudent> {
* @param teacherId
* @return
*/
Long getDdUserId(String foUserId);
/**
* 根据dduserId查找id
* @param teacherId
* @return
*/
List<SchoolStudent> getMemberByTeacher(Long teacherId);
/**
......
......@@ -19,6 +19,9 @@ import com.ruoyi.framework.manager.factory.AsyncFactory;
import com.ruoyi.framework.web.service.MpTokenService;
import com.ruoyi.framework.web.service.SysPermissionService;
import com.ruoyi.system.service.ISysUserService;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.commons.codec.binary.Base64;
import org.slf4j.Logger;
......@@ -30,6 +33,7 @@ import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.web.authentication.WebAuthenticationDetailsSource;
import org.springframework.web.bind.annotation.*;
import yangtz.cs.liu.campus.domain.student.SchoolStudent;
import yangtz.cs.liu.campus.service.impl.student.SchoolStudentParentServiceImpl;
import yangtz.cs.liu.campus.service.student.ISchoolStudentService;
import yangtz.cs.liu.wechat.domain.WxLoginBody;
import yangtz.cs.liu.wechat.service.api.IWxLoginService;
......@@ -75,6 +79,8 @@ public class WxLoginController extends BaseController {
@Autowired
private SysPermissionService permissionService;
@Autowired
private SchoolStudentParentServiceImpl schoolStudentParentService;
private Logger log = LoggerFactory.getLogger(WxLoginController.class);
/**
......@@ -97,6 +103,12 @@ public class WxLoginController extends BaseController {
String token = mpTokenService.createToken(user);
return AjaxResult.success().put(Constants.TOKEN, token);
}
@GetMapping("/getRoleType/{phonenumber}")
public AjaxResult getRoleType(@PathVariable("phonenumber") String phonenumber){
// 根据手机号查询家长手机号
List<Map<String,Object>> list = schoolStudentParentService.getRoleTypeByPhoneNumber(phonenumber);
return AjaxResult.success(list);
}
/**
* @author lyric
......
......@@ -57,11 +57,15 @@ public class WxLoginServiceImpl implements IWxLoginService {
// 教职工登录
mpLoginUser = loadUserB(wxLoginBody, user);
} else if (PARENT_LOGIN.equals(wxLoginBody.getType())) {
SchoolStudentParent schoolStudentParent = schoolStudentParentMapper.selectUserByParentTel(wxLoginBody.getParentTelephone(), wxLoginBody.getStudentIdCard());
SchoolStudentParent schoolStudentParent = schoolStudentParentMapper.selectUserByParentTel(wxLoginBody.getParentTelephone());
if(StringUtils.isNull(schoolStudentParent)){
throw new ServiceException("学生身份证号或家长手机号输入有误,请检查后重试");
throw new ServiceException("家长手机号输入有误,请检查后重试");
}
mpLoginUser = loadUserByParent(wxLoginBody, schoolStudentParent);
SysUser sysUser = new SysUser();
sysUser.setUserLoginType(PARENT_LOGIN);
sysUser.setPhonenumber(wxLoginBody.getPhonenumber());
SysUser user = userMapper.getUser(sysUser);
mpLoginUser = loadUserByParent(wxLoginBody, schoolStudentParent,user);
}
return mpLoginUser;
}
......@@ -112,11 +116,16 @@ public class WxLoginServiceImpl implements IWxLoginService {
// 教职工登录
mpLoginUser = loadUserByTeacher(wxLoginBody, user);
} else if (PARENT_LOGIN.equals(wxLoginBody.getType())) {
SchoolStudentParent schoolStudentParent = schoolStudentParentMapper.selectUserByParentTel(wxLoginBody.getParentTelephone(), wxLoginBody.getStudentIdCard());
//当前家长登录用手机号密码登录
SchoolStudentParent schoolStudentParent = schoolStudentParentMapper.selectUserByParentTel(wxLoginBody.getParentTelephone());
if(StringUtils.isNull(schoolStudentParent)){
throw new ServiceException("学生身份证号或家长手机号输入有误,请检查后重试");
throw new ServiceException("家长信息不存在,请检查后重试");
}
mpLoginUser = loadUserByParent(wxLoginBody, schoolStudentParent);
SysUser sysUser = new SysUser();
sysUser.setUserLoginType(PARENT_LOGIN);
sysUser.setPhonenumber(wxLoginBody.getParentTelephone());
SysUser user = userMapper.getUser(sysUser);
mpLoginUser = loadUserByParent(wxLoginBody, schoolStudentParent,user);
}
return mpLoginUser;
}
......@@ -188,17 +197,13 @@ public class WxLoginServiceImpl implements IWxLoginService {
// }
// }
public MpLoginUser loadUserByParent(WxLoginBody loginBody, SchoolStudentParent schoolStudentParent) {
public MpLoginUser loadUserByParent(WxLoginBody loginBody, SchoolStudentParent schoolStudentParent, SysUser users) {
String parentName = loginBody.getParentName();
String studentIdCard = loginBody.getStudentIdCard();
SchoolStudent schoolStudent = schoolStudentMapper.selectByIdCard(studentIdCard);
SysUser sysUser = userMapper.selectUserById(schoolStudentParent.getUserId());
if (StringUtils.isNull(schoolStudent)) {
throw new ServiceException("学生身份证:" + studentIdCard + "输入错误");
} else if (!loginBody.getStudentName().equals(schoolStudent.getStudentName())) {
throw new ServiceException("学生姓名:" + loginBody.getStudentName() + "输入错误");
} else if (UserStatus.DISABLE.getCode().equals(schoolStudent.getDelFlag())) {
SchoolStudent schoolStudent = schoolStudentMapper.selectById(schoolStudentParent.getStudentId());
if (!SecurityUtils.matchesPassword(loginBody.getPassword(), users.getPassword())) {
throw new ServiceException("密码错误");
}
if (UserStatus.DISABLE.getCode().equals(schoolStudent.getDelFlag())) {
throw new ServiceException("对不起,您的账号:" + parentName + " 已停用");
}else if(GRADUATION.equals(schoolStudent.getStudentStatus())){
throw new ServiceException("学生姓名:" + loginBody.getStudentName() + " 已毕业,无法登陆");
......@@ -221,22 +226,18 @@ public class WxLoginServiceImpl implements IWxLoginService {
user.setStudentId(schoolStudent.getId());
user.setParentName(schoolStudentParent.getParentName());
user.setStudentName(schoolStudent.getStudentName());
user.setStudentIdCard(schoolStudent.getIdCard());
user.setAvatar(schoolStudent.getAvatar());
//更新家长openId
SchoolStudentParent parent = new SchoolStudentParent();
parent.setId(schoolStudentParent.getId());
parent.setOpenId(loginBody.getOpenId());
schoolStudentParentMapper.updateById(parent);
/** 更新用户表openId */
SysUser u = new SysUser();
u.setUserId(schoolStudentParent.getUserId());
u.setOpenId(loginBody.getOpenId());
userMapper.updateUser(u);
// SchoolStudentParent parent = new SchoolStudentParent();
// parent.setId(schoolStudentParent.getId());
// parent.setOpenId(loginBody.getOpenId());
// schoolStudentParentMapper.updateById(parent);
//
// /** 更新用户表openId */
// SysUser u = new SysUser();
// u.setUserId(schoolStudentParent.getUserId());
// u.setOpenId(loginBody.getOpenId());
// userMapper.updateUser(u);
return user;
} else {
return null;
......
......@@ -4,13 +4,13 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="yangtz.cs.liu.campus.mapper.message.SchoolMessagePushMapper">
<select id="getInfo" resultType="yangtz.cs.liu.campus.vo.message.SchoolMessagePushExportVO">
select smp.id, smp.title, smp.content, smp.receive_packet,sr.role_name as receivePacketName, smp.message_type, smp.state from school_message_push smp
select smp.id, smp.title, smp.content, smp.receive_packet, smp.group_name,sr.role_name as receivePacketName, smp.message_type, smp.state from school_message_push smp
left join sys_role sr on sr.role_id = smp.receive_packet
where smp.id = #{id} and smp.del_flag = '0' and sr.del_flag = '0'
</select>
<select id="getList" resultType="yangtz.cs.liu.wechat.vo.message.MessagePushVO">
select mp.id,mp.title,mp.receive_packet,mp.message_type,mp.state,mp.content,mp.create_by,mp.create_time,pd.status from school_message_push mp
select mp.id,mp.title,mp.receive_packet,mp.message_type,mp.state,mp.group_name,mp.content,mp.create_by,mp.create_time,pd.status from school_message_push mp
left join school_message_push_details pd on pd.push_id = mp.id
where pd.user_id = #{userId} and pd.del_flag = '0' and mp.del_flag = '0' and mp.state = '0'
order by pd.status asc, mp.create_time desc
......
......@@ -289,6 +289,13 @@
order by sc.grade_value,sc.class_value
</select>
<select id="getDdUserId" resultType="Long">
select id FROM school_student where dd_user_id = #{foUserId}
</select>
<select id="getInfoByidCard" resultType="yangtz.cs.liu.campus.vo.student.SchoolStudentVO">
select ss.id,ss.class_id,ss.student_name,ss.sex,ss.birthday,ss.nation,ss.stu_telephone,ss.postal_code,
ss.nature,ss.provincial_number,ss.national_number,ss.enrollment_year,ss.home_address,
......
......@@ -36,6 +36,13 @@
</select>
<select id="getRoleTypeByPhoneNumber" parameterType="String" resultType="Map">
SELECT u.login_name,u.user_login_type FROM sys_user u WHERE u. phonenumber = #{phonenumber}
</select>
<select id="selectUserByParentTel" resultType="SchoolStudentParent">
select ssp.id,
ssp.student_id,
......@@ -46,8 +53,7 @@
ssp.user_id
from school_student_parent ssp
left join school_student s on s.id = ssp.student_id
where ssp.telephone = #{parentTelephone} and s.id_card = #{studentIdCard} and s.del_flag = '0' and ssp.del_flag = '0'
where ssp.telephone = #{parentTelephone} and s.del_flag = '0' and ssp.del_flag = '0'
</select>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment