Commit d3a23d6f by java-李谡

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

2、用户设置席位手机号为空时,设置为用户手机号
parent 23b74bb0
...@@ -331,6 +331,12 @@ ...@@ -331,6 +331,12 @@
AND st.status = '1' AND st.status = '1'
AND t.status = '1' AND t.status = '1'
</select> </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 id="getUserSeatByUserCode" resultType="com.ejweb.modules.user.entity.UserSeatEntity">
SELECT d.user_id, SELECT d.user_id,
......
...@@ -18,10 +18,7 @@ import com.ejweb.modules.role.entity.InformationEntity; ...@@ -18,10 +18,7 @@ import com.ejweb.modules.role.entity.InformationEntity;
import com.ejweb.modules.role.entity.UserRolesEntity; import com.ejweb.modules.role.entity.UserRolesEntity;
import com.ejweb.modules.role.service.UserRolesService; import com.ejweb.modules.role.service.UserRolesService;
import com.ejweb.modules.user.bean.*; import com.ejweb.modules.user.bean.*;
import com.ejweb.modules.user.entity.LoginUserEntity; import com.ejweb.modules.user.entity.*;
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.service.UserService; import com.ejweb.modules.user.service.UserService;
import com.jdair.util.http.client.HTTPClientUtil; import com.jdair.util.http.client.HTTPClientUtil;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
...@@ -556,13 +553,33 @@ public class UserController { ...@@ -556,13 +553,33 @@ public class UserController {
if (message == null) { if (message == null) {
if(StringUtils.isNotBlank(bean.getSeatId())){ if(StringUtils.isNotBlank(bean.getSeatId())){
SeatLoginBean seatLoginBean = new SeatLoginBean(); SeatLoginBean seatLoginBean = new SeatLoginBean();
seatLoginBean.setUserId(bean.getUserId()); seatLoginBean.setUserId(bean.getUserId());
seatLoginBean.setSeatId(bean.getSeatId()); seatLoginBean.setSeatId(bean.getSeatId());
userService.updateSeatUserLogout(seatLoginBean); 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(); String clientip = StringUtils.isEmpty(bean.getClientip()) ? Util.getOnlineIP(request) : bean.getClientip();
UserLoginLogEntity logoutDeviceInfoEntity = new UserLoginLogEntity(); UserLoginLogEntity logoutDeviceInfoEntity = new UserLoginLogEntity();
logoutDeviceInfoEntity.setUserId(bean.getUserId()); logoutDeviceInfoEntity.setUserId(bean.getUserId());
...@@ -909,10 +926,20 @@ public class UserController { ...@@ -909,10 +926,20 @@ public class UserController {
UserSeatMobileBean loginBean = requestBean.getObjectBean(UserSeatMobileBean.class); UserSeatMobileBean loginBean = requestBean.getObjectBean(UserSeatMobileBean.class);
message = userService.validate(loginBean); message = userService.validate(loginBean);
if (message == null) { if (message == null) {
String seatMobilePhone = "";
loginBean.setSeatMobileNumber(Util.formatedMobile(loginBean.getSeatMobile())); //修改允许席位手机号为空,如果为空,则修改席位手机号为用户手机号
userService.updateUserSeatMobile(loginBean); 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.setData(loginBean);
responseBean.setMessage(GConstants.OK); responseBean.setMessage(GConstants.OK);
responseBean.setStatus(ErrorCode.STATUS_CODE_2000); responseBean.setStatus(ErrorCode.STATUS_CODE_2000);
......
...@@ -23,7 +23,7 @@ public class UserSeatMobileBean extends GenericBean { ...@@ -23,7 +23,7 @@ public class UserSeatMobileBean extends GenericBean {
@JSONField(name="seatCode") @JSONField(name="seatCode")
private String seatId; private String seatId;
@NotEmpty(message = "seatMobile不能为NULL") // @NotEmpty(message = "seatMobile不能为NULL")
@JSONField(name="seatMobile") @JSONField(name="seatMobile")
private String seatMobile; private String seatMobile;
@JSONField(deserialize=false) @JSONField(deserialize=false)
......
...@@ -47,7 +47,9 @@ public interface UserDao extends CurdDao<UserEntity> { ...@@ -47,7 +47,9 @@ public interface UserDao extends CurdDao<UserEntity> {
public Integer updateUserSeatLoginEmpty(SeatLoginBean bean); public Integer updateUserSeatLoginEmpty(SeatLoginBean bean);
public UserSeatEntity getUserSeat(SeatLoginBean seatloginBean); public UserSeatEntity getUserSeat(SeatLoginBean seatloginBean);
public UserSeatMobileBean getUserSeatMobileBean(SeatLoginBean seatloginBean);
public List<UserListEntity> findtUserByOffice(OfficeBean officeBean); public List<UserListEntity> findtUserByOffice(OfficeBean officeBean);
public List<UserSeatEntity> getUserSeatByUserCode(LoginUserEntity entity); public List<UserSeatEntity> getUserSeatByUserCode(LoginUserEntity entity);
......
...@@ -304,6 +304,10 @@ public class UserService extends CurdService<UserDao, UserEntity> { ...@@ -304,6 +304,10 @@ public class UserService extends CurdService<UserDao, UserEntity> {
return dao.getUserSeat(seatloginBean); return dao.getUserSeat(seatloginBean);
} }
public UserSeatMobileBean getUserSeatMobileBean(SeatLoginBean seatloginBean){
return dao.getUserSeatMobileBean(seatloginBean);
}
public List<UserListEntity> findtUserByOffice(OfficeBean officeBean) { public List<UserListEntity> findtUserByOffice(OfficeBean officeBean) {
return dao.findtUserByOffice(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