Commit fb95a7d2 by Java - 段鹏举

席位的修改

parent 2ecd2ea5
...@@ -312,7 +312,7 @@ ...@@ -312,7 +312,7 @@
p.device_token, p.device_token,
p.version, p.version,
a.login_id a.login_id
FROM foc_seats a FROM foc_seats a
LEFT JOIN foc_seat_type st LEFT JOIN foc_seat_type st
ON a.seat_type=st.id ON a.seat_type=st.id
LEFT JOIN foc_station t LEFT JOIN foc_station t
...@@ -871,4 +871,31 @@ ...@@ -871,4 +871,31 @@
UPDATE foc_user2seat SET seat_mobile=#{seatMobile},seat_mobile_number=#{seatMobileNumber} UPDATE foc_user2seat SET seat_mobile=#{seatMobile},seat_mobile_number=#{seatMobileNumber}
WHERE user_id=#{userId} AND seat_id=#{seatId} WHERE user_id=#{userId} AND seat_id=#{seatId}
</update> </update>
<!-- 查询登录日志 -->
<select id="findUserLoginLogList" resultType="com.ejweb.modules.user.entity.UserLoginLogEntity">
SELECT r.id,
r.type,
r.user_id,
r.seat_id,
r.platform,
r.app_code,
r.version,
r.device_token,
r.device_name,
r.login_ip,
r.login_date
FROM sys_login_log r
WHERE 1 = 1
<if test="userId != null and userId != ''">
AND r.user_id = #{userId}
</if>
<if test="seatId != null and seatId != ''">
AND r.seat_id = #{seatId}
</if>
<if test="type != null and type != ''">
AND r.type = #{type}
</if>
ORDER BY r.login_date DESC
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -23,7 +23,6 @@ import com.ejweb.modules.user.entity.UserEntity; ...@@ -23,7 +23,6 @@ import com.ejweb.modules.user.entity.UserEntity;
import com.ejweb.modules.user.entity.UserLoginLogEntity; import com.ejweb.modules.user.entity.UserLoginLogEntity;
import com.ejweb.modules.user.entity.UserSeatEntity; import com.ejweb.modules.user.entity.UserSeatEntity;
import com.ejweb.modules.user.service.UserService; import com.ejweb.modules.user.service.UserService;
import com.huawei.esdk.uc.professional.local.bean.south.UserState;
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;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
...@@ -432,34 +431,49 @@ public class UserController { ...@@ -432,34 +431,49 @@ public class UserController {
// 同一个账户只能登录一个身份 // 同一个账户只能登录一个身份
// 查询用户的所有身份 // 查询用户的所有身份
LoginUserEntity userEntity = new LoginUserEntity(); // LoginUserEntity userEntity = new LoginUserEntity();
userEntity.setId(seatloginBean.getUserId()); // userEntity.setId(seatloginBean.getUserId());
List<UserSeatEntity> userSeatList = userService.getUserSeatByUserCode(userEntity); // List<UserSeatEntity> userSeatList = userService.getUserSeatByUserCode(userEntity);
if (userSeatList != null && userSeatList.size() > 0) { // if (userSeatList != null && userSeatList.size() > 0) {
// 查询所有身份的状态 // // 查询所有身份的状态
List<String> seatIds = new ArrayList<>(); // List<String> seatIds = new ArrayList<>();
Map<String, UserSeatEntity> userSeatEntityMap = new HashMap<>(); // Map<String, UserSeatEntity> userSeatEntityMap = new HashMap<>();
for (UserSeatEntity userSeatEntity : userSeatList) { // for (UserSeatEntity userSeatEntity : userSeatList) {
seatIds.add(userSeatEntity.getSeatId()); // seatIds.add(userSeatEntity.getSeatId());
userSeatEntityMap.put(userSeatEntity.getSeatId(), userSeatEntity); // userSeatEntityMap.put(userSeatEntity.getSeatId(), userSeatEntity);
} // }
if (seatIds.size() > 0) { // if (seatIds.size() > 0) {
// 调用华为接口查询席位状态列表 // // 调用华为接口查询席位状态列表
List<UserState> seatStates = huaweiInterfaseService.queryUserStateList(seatIds); // List<UserState> seatStates = huaweiInterfaseService.queryUserStateList(seatIds);
if (seatStates != null && seatStates.size() > 0) { // if (seatStates != null && seatStates.size() > 0) {
for (UserState userState : seatStates) { // for (UserState userState : seatStates) {
// 如果有身份处于在线状态,且不是当前正在登录的,则返回在线席位的信息 // System.out.println("-----1-----" + seatloginBean.getSeatId());
if (Util.isInValue(String.valueOf(userState.getNewState()), "1", "3", "4") // System.out.println("-----2-----" + userState.getOrigin());
&& !seatloginBean.getSeatId().equals(userState.getOrigin())) { // // 如果有身份处于在线状态,且该身份不是当前正在登录的
responseBean.setData(userSeatEntityMap.get(userState.getOrigin())); // if (Util.isInValue(String.valueOf(userState.getNewState()), "1", "3", "4")
responseBean.setMessage("用户已在其他席位登录"); // && !seatloginBean.getSeatId().equals(userState.getOrigin())) {
responseBean.setStatus(ErrorCode.STATUS_CODE_4301); // // 查询当前席位的登录日志
return responseBean; // UserLoginLogEntity userLoginLogEntity = new UserLoginLogEntity();
} // userLoginLogEntity.setSeatId(seatloginBean.getSeatId());
} // userLoginLogEntity.setType("LOGIN");
} // List<UserLoginLogEntity> userLoginLogEntityList = userService.findUserLoginLogList(userLoginLogEntity);
} // if (userLoginLogEntityList != null && userLoginLogEntityList.size() > 0) {
} // userLoginLogEntity = userLoginLogEntityList.get(0);
// System.out.println("-----3-----" + seatloginBean.getUserId());
// System.out.println("-----4-----" + userLoginLogEntity.getUserId());
// // 如果最后一条登录的用户是当前用户
// if (seatloginBean.getUserId().equals(userLoginLogEntity.getUserId())) {
// responseBean.setData(userSeatEntityMap.get(userState.getOrigin()));
// responseBean.setMessage("用户已在其他席位登录");
// responseBean.setStatus(ErrorCode.STATUS_CODE_4301);
// return responseBean;
// }
// }
// }
// }
// }
// }
// }
String clientip = StringUtils.isEmpty(seatloginBean.getClientip()) ? Util.getOnlineIP(request) : seatloginBean.getClientip(); String clientip = StringUtils.isEmpty(seatloginBean.getClientip()) ? Util.getOnlineIP(request) : seatloginBean.getClientip();
UserLoginLogEntity deviceInfoEntity = new UserLoginLogEntity(); UserLoginLogEntity deviceInfoEntity = new UserLoginLogEntity();
......
package com.ejweb.modules.user.dao; package com.ejweb.modules.user.dao;
import org.apache.ibatis.annotations.Param;
import com.ejweb.core.base.CurdDao; import com.ejweb.core.base.CurdDao;
import com.ejweb.core.base.FindEntity; import com.ejweb.core.base.FindEntity;
import com.ejweb.modules.im.bean.ImUserListBean; import com.ejweb.modules.im.bean.ImUserListBean;
import com.ejweb.modules.im.bean.OfficeBean; import com.ejweb.modules.im.bean.OfficeBean;
import com.ejweb.modules.im.bean.SearchUserBean; import com.ejweb.modules.im.bean.SearchUserBean;
import com.ejweb.modules.im.entity.UserSeatListEntity; import com.ejweb.modules.im.entity.UserSeatListEntity;
import com.ejweb.modules.user.bean.LoginBean; import com.ejweb.modules.user.bean.*;
import com.ejweb.modules.user.bean.OuterUserAddBean; import com.ejweb.modules.user.entity.*;
import com.ejweb.modules.user.bean.OuterUserBean; import org.apache.ibatis.annotations.Param;
import com.ejweb.modules.user.bean.SeatLoginBean;
import com.ejweb.modules.user.bean.UserByTypeBean;
import com.ejweb.modules.user.bean.UserListBean;
import com.ejweb.modules.user.bean.UserPhotoBean;
import com.ejweb.modules.user.bean.UserSeatListBean;
import com.ejweb.modules.user.bean.UserSeatMobileBean;
import com.ejweb.modules.user.entity.LoginUserEntity;
import com.ejweb.modules.user.entity.User;
import com.ejweb.modules.user.entity.UserDeviceInfoEntity;
import com.ejweb.modules.user.entity.UserEntity;
import com.ejweb.modules.user.entity.UserListEntity;
import com.ejweb.modules.user.entity.UserLoginInfoEntity;
import com.ejweb.modules.user.entity.UserLoginLogEntity;
import com.ejweb.modules.user.entity.UserSeatEntity;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -113,4 +97,6 @@ public interface UserDao extends CurdDao<UserEntity> { ...@@ -113,4 +97,6 @@ public interface UserDao extends CurdDao<UserEntity> {
public void updateOuterUser(OuterUserBean bean); public void updateOuterUser(OuterUserBean bean);
List<UserLoginLogEntity> findUserLoginLogList(UserLoginLogEntity userLoginLogEntity);
} }
package com.ejweb.modules.user.service; package com.ejweb.modules.user.service;
import java.net.URLEncoder;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.ejweb.core.base.CurdService; import com.ejweb.core.base.CurdService;
...@@ -24,28 +14,22 @@ import com.ejweb.modules.im.bean.ImUserListBean; ...@@ -24,28 +14,22 @@ import com.ejweb.modules.im.bean.ImUserListBean;
import com.ejweb.modules.im.bean.OfficeBean; import com.ejweb.modules.im.bean.OfficeBean;
import com.ejweb.modules.im.bean.SearchUserBean; import com.ejweb.modules.im.bean.SearchUserBean;
import com.ejweb.modules.im.entity.UserSeatListEntity; import com.ejweb.modules.im.entity.UserSeatListEntity;
import com.ejweb.modules.user.bean.LoginBean; import com.ejweb.modules.user.bean.*;
import com.ejweb.modules.user.bean.OuterUserAddBean;
import com.ejweb.modules.user.bean.OuterUserBean;
import com.ejweb.modules.user.bean.SeatLoginBean;
import com.ejweb.modules.user.bean.UserByTypeBean;
import com.ejweb.modules.user.bean.UserListBean;
import com.ejweb.modules.user.bean.UserPhotoBean;
import com.ejweb.modules.user.bean.UserSeatListBean;
import com.ejweb.modules.user.bean.UserSeatMobileBean;
import com.ejweb.modules.user.dao.UserDao; import com.ejweb.modules.user.dao.UserDao;
import com.ejweb.modules.user.entity.LoginUserEntity; import com.ejweb.modules.user.entity.*;
import com.ejweb.modules.user.entity.User;
import com.ejweb.modules.user.entity.UserDeviceInfoEntity;
import com.ejweb.modules.user.entity.UserEntity;
import com.ejweb.modules.user.entity.UserListEntity;
import com.ejweb.modules.user.entity.UserLoginInfoEntity;
import com.ejweb.modules.user.entity.UserLoginLogEntity;
import com.ejweb.modules.user.entity.UserSeatEntity;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.jdair.util.http.client.HTTPClientUtil; import com.jdair.util.http.client.HTTPClientUtil;
import com.jdair.util.security.DESPlus; import com.jdair.util.security.DESPlus;
import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.net.URLEncoder;
import java.util.List;
import java.util.Map;
@Service @Service
public class UserService extends CurdService<UserDao, UserEntity> { public class UserService extends CurdService<UserDao, UserEntity> {
...@@ -704,4 +688,13 @@ public class UserService extends CurdService<UserDao, UserEntity> { ...@@ -704,4 +688,13 @@ public class UserService extends CurdService<UserDao, UserEntity> {
dao.updateOuterUser( bean); dao.updateOuterUser( bean);
} }
/**
* 查询登录日志
*
* @return
*/
public List<UserLoginLogEntity> findUserLoginLogList(UserLoginLogEntity userLoginLogEntity) {
return dao.findUserLoginLogList(userLoginLogEntity);
}
} }
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