Commit d3a23d6f by java-李谡

修改:1、用户登出席位,恢复用户席位手机号为用户手机号

2、用户设置席位手机号为空时,设置为用户手机号
parent 23b74bb0
......@@ -331,6 +331,12 @@
AND st.status = '1'
AND t.status = '1'
</select>
<!--获取用户的席位信息-->
<select id="getUserSeatMobileBean" resultType="com.ejweb.modules.user.bean.UserSeatMobileBean">
SELECT * FROM foc_user2seat WHERE user_id=#{userId} AND seat_id=#{seatId}
</select>
<!-- 获取用户的席位列表 -->
<select id="getUserSeatByUserCode" resultType="com.ejweb.modules.user.entity.UserSeatEntity">
SELECT d.user_id,
......
......@@ -18,10 +18,7 @@ import com.ejweb.modules.role.entity.InformationEntity;
import com.ejweb.modules.role.entity.UserRolesEntity;
import com.ejweb.modules.role.service.UserRolesService;
import com.ejweb.modules.user.bean.*;
import com.ejweb.modules.user.entity.LoginUserEntity;
import com.ejweb.modules.user.entity.UserEntity;
import com.ejweb.modules.user.entity.UserLoginLogEntity;
import com.ejweb.modules.user.entity.UserSeatEntity;
import com.ejweb.modules.user.entity.*;
import com.ejweb.modules.user.service.UserService;
import com.jdair.util.http.client.HTTPClientUtil;
import org.apache.commons.lang3.StringUtils;
......@@ -556,13 +553,33 @@ public class UserController {
if (message == null) {
if(StringUtils.isNotBlank(bean.getSeatId())){
SeatLoginBean seatLoginBean = new SeatLoginBean();
seatLoginBean.setUserId(bean.getUserId());
seatLoginBean.setSeatId(bean.getSeatId());
userService.updateSeatUserLogout(seatLoginBean);
}
//退出登录检测该用户席位手机号是否和系统中存储的用户手机号相同,不同则修改为系统手机号
SeatLoginBean seatLoginBean = new SeatLoginBean();
seatLoginBean.setUserId(bean.getUserId());
seatLoginBean.setSeatId(bean.getSeatId());
//查询用户席位(主要用于获取用户席位手机号)
UserSeatMobileBean seatMobileBean = userService.getUserSeatMobileBean(seatLoginBean);
UserEntity userEntity = new UserEntity();
userEntity.setUsercode(bean.getUserId());
User user = userService.getUserByUserCode(userEntity);
if(StringUtils.isNotEmpty(user.getMobile()) && StringUtils.isNotEmpty(seatMobileBean.getSeatMobile())){
if(!user.getMobile().equals(seatMobileBean.getSeatMobile())){
seatMobileBean.setSeatMobile(user.getMobile());
seatMobileBean.setSeatMobileNumber(Util.formatedMobile(user.getMobile()));
userService.updateUserSeatMobile(seatMobileBean);
}
}
String clientip = StringUtils.isEmpty(bean.getClientip()) ? Util.getOnlineIP(request) : bean.getClientip();
UserLoginLogEntity logoutDeviceInfoEntity = new UserLoginLogEntity();
logoutDeviceInfoEntity.setUserId(bean.getUserId());
......@@ -909,10 +926,20 @@ public class UserController {
UserSeatMobileBean loginBean = requestBean.getObjectBean(UserSeatMobileBean.class);
message = userService.validate(loginBean);
if (message == null) {
loginBean.setSeatMobileNumber(Util.formatedMobile(loginBean.getSeatMobile()));
userService.updateUserSeatMobile(loginBean);
String seatMobilePhone = "";
//修改允许席位手机号为空,如果为空,则修改席位手机号为用户手机号
if(StringUtils.isEmpty(loginBean.getSeatMobile())){
UserEntity userEntity = new UserEntity();
userEntity.setUsercode(loginBean.getUserId());
User user = userService.getUserByUserCode(userEntity);
seatMobilePhone = user.getMobile();
}
if(StringUtils.isNotEmpty(seatMobilePhone)){
loginBean.setSeatMobile(seatMobilePhone);
loginBean.setSeatMobileNumber(Util.formatedMobile(seatMobilePhone));
userService.updateUserSeatMobile(loginBean);
}
responseBean.setData(loginBean);
responseBean.setMessage(GConstants.OK);
responseBean.setStatus(ErrorCode.STATUS_CODE_2000);
......
......@@ -23,7 +23,7 @@ public class UserSeatMobileBean extends GenericBean {
@JSONField(name="seatCode")
private String seatId;
@NotEmpty(message = "seatMobile不能为NULL")
// @NotEmpty(message = "seatMobile不能为NULL")
@JSONField(name="seatMobile")
private String seatMobile;
@JSONField(deserialize=false)
......
......@@ -47,7 +47,9 @@ public interface UserDao extends CurdDao<UserEntity> {
public Integer updateUserSeatLoginEmpty(SeatLoginBean bean);
public UserSeatEntity getUserSeat(SeatLoginBean seatloginBean);
public UserSeatMobileBean getUserSeatMobileBean(SeatLoginBean seatloginBean);
public List<UserListEntity> findtUserByOffice(OfficeBean officeBean);
public List<UserSeatEntity> getUserSeatByUserCode(LoginUserEntity entity);
......
......@@ -304,6 +304,10 @@ public class UserService extends CurdService<UserDao, UserEntity> {
return dao.getUserSeat(seatloginBean);
}
public UserSeatMobileBean getUserSeatMobileBean(SeatLoginBean seatloginBean){
return dao.getUserSeatMobileBean(seatloginBean);
}
public List<UserListEntity> findtUserByOffice(OfficeBean officeBean) {
return dao.findtUserByOffice(officeBean);
}
......
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