Commit fb95a7d2 by Java - 段鹏举

席位的修改

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