|
|
|
@ -14,11 +14,13 @@ import com.sztzjy.trade.mapper.StuPublicNoticeReadInfoMapper;
|
|
|
|
|
import com.sztzjy.trade.mapper.StuUserMapper;
|
|
|
|
|
import com.sztzjy.trade.mapper.TchLoginLogMapper;
|
|
|
|
|
import com.sztzjy.trade.service.TchLoginLogAndStuListService;
|
|
|
|
|
import com.sztzjy.trade.util.RedisUtil;
|
|
|
|
|
import com.sztzjy.trade.util.ResultEntity;
|
|
|
|
|
import com.sztzjy.trade.util.excel.FilePortUtil;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.apache.commons.io.IOUtils;
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
import org.geolatte.geom.V;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.core.io.ClassPathResource;
|
|
|
|
|
import org.springframework.http.HttpStatus;
|
|
|
|
@ -47,6 +49,9 @@ public class TchLoginLogAndStuListServiceImpl implements TchLoginLogAndStuListSe
|
|
|
|
|
@Autowired
|
|
|
|
|
private StuUserMapper stuUserMapper;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private RedisUtil redisUtil;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 登录/退出统计
|
|
|
|
|
*
|
|
|
|
@ -74,11 +79,11 @@ public class TchLoginLogAndStuListServiceImpl implements TchLoginLogAndStuListSe
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//登录时间不为空
|
|
|
|
|
if (loginLogDTO.getLoginTimeLast() != null) {
|
|
|
|
|
if (loginLogDTO.getLoginTimeLast() != null ) {
|
|
|
|
|
//loginTimeLast 都不为 null 的情况
|
|
|
|
|
|
|
|
|
|
TchLoginLogExample example = new TchLoginLogExample();
|
|
|
|
|
example.setOrderByClause("exit_time_last desc");
|
|
|
|
|
example.setOrderByClause("login_time_last desc");
|
|
|
|
|
example.createCriteria().andUserIdEqualTo(loginLogDTO.getUserId()).andSchoolIdEqualTo(loginLogDTO.getSchoolId());
|
|
|
|
|
List<TchLoginLog> tchLoginLogList = tchLoginLogMapper.selectByExample(example);
|
|
|
|
|
|
|
|
|
@ -135,19 +140,30 @@ public class TchLoginLogAndStuListServiceImpl implements TchLoginLogAndStuListSe
|
|
|
|
|
tchLoginLogMapper.insertSelective(tchLoginLogOld);
|
|
|
|
|
return new ResultEntity<>(HttpStatus.OK, "success");
|
|
|
|
|
}
|
|
|
|
|
}else if (loginLogDTO.getExitTimeLast() != null) {
|
|
|
|
|
|
|
|
|
|
exitLogin(loginLogDTO,ip,ipAddress);
|
|
|
|
|
return new ResultEntity(HttpStatus.BAD_REQUEST, "请重新登录!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return new ResultEntity(HttpStatus.BAD_REQUEST, "请重新登录!");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void exitLogin(LoginLogDTO loginLogDTO,String ip,String ipAddress){
|
|
|
|
|
//退出时间不为空
|
|
|
|
|
if (loginLogDTO.getExitTimeLast() != null) {
|
|
|
|
|
|
|
|
|
|
TchLoginLogExample example = new TchLoginLogExample();
|
|
|
|
|
example.setOrderByClause("exit_time_last desc");
|
|
|
|
|
example.createCriteria().andUserIdEqualTo(loginLogDTO.getUserId()).andSchoolIdEqualTo(loginLogDTO.getSchoolId());
|
|
|
|
|
|
|
|
|
|
example.createCriteria().andUserIdEqualTo(loginLogDTO.getUserId()).andSchoolIdEqualTo(loginLogDTO.getSchoolId()).andExitTimeLastIsNull();
|
|
|
|
|
List<TchLoginLog> tchLoginLogList = tchLoginLogMapper.selectByExample(example);
|
|
|
|
|
|
|
|
|
|
if (tchLoginLogList.isEmpty()) { //首次登录
|
|
|
|
|
return new ResultEntity(HttpStatus.BAD_REQUEST, "请重新登录!");
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
@ -176,15 +192,13 @@ public class TchLoginLogAndStuListServiceImpl implements TchLoginLogAndStuListSe
|
|
|
|
|
tchLoginLog.setOnline((byte) 0);
|
|
|
|
|
|
|
|
|
|
tchLoginLogMapper.updateByPrimaryKeySelective(tchLoginLog);
|
|
|
|
|
redisUtil.del("userId:"+loginLogDTO.getUserId());
|
|
|
|
|
|
|
|
|
|
return new ResultEntity<>(HttpStatus.OK, "success");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return new ResultEntity(HttpStatus.BAD_REQUEST, "请重新登录!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//分页查询登录日志
|
|
|
|
|