添加登录日志
This commit is contained in:
parent
40f2908a2c
commit
52020807a9
|
@ -94,6 +94,7 @@ public class KcDetectionDetailedServiceImpl extends ServiceImpl<KcDetectionDetai
|
|||
|
||||
List<Callable<Boolean>> calls = Lists.newArrayList();
|
||||
|
||||
log.info("----------抓取图片开始--------------");
|
||||
|
||||
//新版,查询当前是否有课
|
||||
KcZhihuijiaoshi jiaoshi = new KcZhihuijiaoshi();
|
||||
|
@ -106,6 +107,7 @@ public class KcDetectionDetailedServiceImpl extends ServiceImpl<KcDetectionDetai
|
|||
String hh = "";
|
||||
KcJieci kcJieci = new KcJieci();
|
||||
List<KcJieci> kcJieciList = jieciService.getIndexJcList(kcJieci);
|
||||
log.info("----------kcJieciList--------------{}",kcJieciList);
|
||||
if(kcJieciList != null && !kcJieciList.isEmpty()){
|
||||
KcJieci kcJieciParam = kcJieciList.get(0);
|
||||
String[] jcArray = StringUtils.split(kcJieciParam.getJieci(),"、");
|
||||
|
@ -114,6 +116,7 @@ public class KcDetectionDetailedServiceImpl extends ServiceImpl<KcDetectionDetai
|
|||
}
|
||||
|
||||
|
||||
log.info("----------hh--------------{}",hh);
|
||||
KcKetangbiao kcKetangbiao = new KcKetangbiao();
|
||||
kcKetangbiao.setSfyzhjs("1");
|
||||
kcKetangbiao.setHh(hh);
|
||||
|
@ -123,15 +126,16 @@ public class KcDetectionDetailedServiceImpl extends ServiceImpl<KcDetectionDetai
|
|||
kcKetangbiao.setSbType("1");
|
||||
kcKetangbiao.setSftkb("1");
|
||||
kcKetangbiao.setYwskxs("");
|
||||
|
||||
// if(StringUtils.equals(",", hh)){
|
||||
// log.error("未查到节次,原因未知!");
|
||||
// return;
|
||||
// }
|
||||
log.info("----------kcKetangbiao--------------{}",kcKetangbiao);
|
||||
if(StringUtils.equals(",", hh)){
|
||||
log.error("未查到节次,原因未知!");
|
||||
return;
|
||||
}
|
||||
|
||||
Page<KcKetangbiao> page = new Page<>(1, -1);
|
||||
IPage<KcKetangbiao> pageList = kcKetangbiaoService.getKclblist(page, kcKetangbiao);
|
||||
|
||||
log.info("----------pageList--------------{},{}",pageList.getRecords().size(),pageList.getRecords());
|
||||
if(pageList != null){
|
||||
List<KcKetangbiao> list = pageList.getRecords();
|
||||
Set<String> jsbhSet = Sets.newHashSet();
|
||||
|
@ -140,6 +144,11 @@ public class KcDetectionDetailedServiceImpl extends ServiceImpl<KcDetectionDetai
|
|||
KcKetangbiaoMap.put(x.getJsbh(), x);
|
||||
jsbhSet.add(x.getJsbh());
|
||||
});
|
||||
log.info("----------jsbhSet--------------{}",jsbhSet);
|
||||
if(jsbhSet.isEmpty()){
|
||||
log.error("未找到对应的可线上听课课堂");
|
||||
return;
|
||||
}
|
||||
//取智慧教室信息
|
||||
//id: item.jsbh, ktId: item.id
|
||||
QueryWrapper<KcZhihuijiaoshi> zhjsQW = new QueryWrapper<>();
|
||||
|
@ -149,6 +158,7 @@ public class KcDetectionDetailedServiceImpl extends ServiceImpl<KcDetectionDetai
|
|||
|
||||
List<KcZhihuijiaoshi> zhihuijiaoshiList = zhihuijiaoshiService.list(zhjsQW);
|
||||
|
||||
log.info("----------zhihuijiaoshiList--------------{}",zhihuijiaoshiList);
|
||||
zhihuijiaoshiList.forEach(x -> {
|
||||
try {
|
||||
Thread.sleep(1000L);
|
||||
|
@ -180,11 +190,14 @@ public class KcDetectionDetailedServiceImpl extends ServiceImpl<KcDetectionDetai
|
|||
//qn更改-- 修复特殊字符上传后无法下载的问题,修复多个.名称错乱的问题END
|
||||
//截图
|
||||
String outImagePath = file.getPath() + File.separator + fileName;
|
||||
log.info("----------outImagePath--------------{}",outImagePath);
|
||||
FileUtil.touch(outImagePath);
|
||||
String miniOutImagePath = StringUtils.replace(outImagePath, uploadpathFilePath + File.separator, "");
|
||||
miniOutImagePath = StringUtils.replace(miniOutImagePath,"\\","/");
|
||||
log.info("----------x.getPullUrl()--------------{}",x.getPullUrl());
|
||||
boolean isSuccess = _FFmpegTools.videoScreenshot(x.getPullUrl(), outImagePath);
|
||||
|
||||
log.info("----------isSuccess--------------{}",isSuccess);
|
||||
FileUtil.copy(outImagePath,fileBak.getPath() + File.separator + fileName, true);
|
||||
if(isSuccess){
|
||||
|
||||
|
@ -247,9 +260,12 @@ public class KcDetectionDetailedServiceImpl extends ServiceImpl<KcDetectionDetai
|
|||
//取数量
|
||||
if(isSuccess){
|
||||
String rJson = authService.body_num(outImagePath);
|
||||
log.info("----------rJson--------------{}",rJson);
|
||||
detectionDetailed.setDetectionOutImgRes(rJson);
|
||||
//解析获取数
|
||||
JSONObject object= JSON.parseObject(rJson);
|
||||
|
||||
log.info("----------百度-object--------------{}",object);
|
||||
Integer num = object.getInteger("person_num");
|
||||
if(num == null){
|
||||
if(detectionDetailed.getNum() == null){
|
||||
|
@ -264,6 +280,7 @@ public class KcDetectionDetailedServiceImpl extends ServiceImpl<KcDetectionDetai
|
|||
allNum += detectionDetailed.getNum();
|
||||
detectionMain.setAllNum(allNum);
|
||||
detectionMain.setAverageNum(allNum/detectionNum);
|
||||
log.info("----------detectionMain--------------{}",detectionMain);
|
||||
//保存主表
|
||||
if(StringUtils.isBlank(detectionMain.getId())){
|
||||
kcDetectionMainService.save(detectionMain);
|
||||
|
@ -271,6 +288,7 @@ public class KcDetectionDetailedServiceImpl extends ServiceImpl<KcDetectionDetai
|
|||
kcDetectionMainService.updateById(detectionMain);
|
||||
}
|
||||
detectionDetailed.setPid(detectionMain.getId());
|
||||
log.info("----------detectionDetailed--------------{}",detectionDetailed);
|
||||
//保存子表
|
||||
save(detectionDetailed);
|
||||
|
||||
|
@ -284,6 +302,7 @@ public class KcDetectionDetailedServiceImpl extends ServiceImpl<KcDetectionDetai
|
|||
throw new RuntimeException(e);
|
||||
}
|
||||
});
|
||||
log.info("----------抓取图片结束--------------");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,49 @@
|
|||
package org.jeecg.modules.kc.wjxDjxx.entity;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @Description: 教学大纲
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2024-05-11
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class StudentWjglSys implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private String id;
|
||||
|
||||
@Excel(name = "学期学年", width = 15)
|
||||
private String xqxn;
|
||||
@Excel(name = "课程名称", width = 15)
|
||||
private String kcmc;
|
||||
@Excel(name = "授课教师", width = 15)
|
||||
private String skjs;
|
||||
@Excel(name = "作业名称", width = 15)
|
||||
private String title;
|
||||
@Excel(name = "学生姓名", width = 15)
|
||||
private String stuName;
|
||||
@Excel(name = "学号", width = 15)
|
||||
private String stuNo;
|
||||
@Excel(name = "作业状态", width = 15)
|
||||
private String status;
|
||||
@Excel(name = "测验时间", width = 15)
|
||||
private String createTime;
|
||||
|
||||
private String kcbh;
|
||||
private String kkdw;
|
||||
private String filePath;
|
||||
private String pdfPath;
|
||||
|
||||
private String jgh;
|
||||
private String atype;
|
||||
private String ywId;
|
||||
}
|
|
@ -0,0 +1,189 @@
|
|||
package org.jeecg.modules.kc.blLoginLog.controller;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLDecoder;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.constant.CommonConstant;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.common.util.text.StringUtils;
|
||||
import org.jeecg.modules.kc.blLoginLog.entity.BlLoginLog;
|
||||
import org.jeecg.modules.kc.blLoginLog.service.IBlLoginLogService;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.jeecg.modules.system.entity.SysUser;
|
||||
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
||||
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
||||
import org.jeecgframework.poi.excel.entity.ExportParams;
|
||||
import org.jeecgframework.poi.excel.entity.ImportParams;
|
||||
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
|
||||
import org.jeecg.common.system.base.controller.JeecgController;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
|
||||
/**
|
||||
* @Description: 登录日志
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2024-06-17
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Api(tags="登录日志")
|
||||
@RestController
|
||||
@RequestMapping("/blLoginLog/blLoginLog")
|
||||
@Slf4j
|
||||
public class BlLoginLogController extends JeecgController<BlLoginLog, IBlLoginLogService> {
|
||||
@Autowired
|
||||
private IBlLoginLogService blLoginLogService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param blLoginLog
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "登录日志-分页列表查询")
|
||||
@ApiOperation(value="登录日志-分页列表查询", notes="登录日志-分页列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<IPage<BlLoginLog>> queryPageList(BlLoginLog blLoginLog,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<BlLoginLog> queryWrapper = QueryGenerator.initQueryWrapper(blLoginLog, req.getParameterMap());
|
||||
Page<BlLoginLog> page = new Page<BlLoginLog>(pageNo, pageSize);
|
||||
queryWrapper.ge(StringUtils.isNotEmpty(blLoginLog.getStartTime()),"create_time",blLoginLog.getStartTime());
|
||||
queryWrapper.le(StringUtils.isNotEmpty(blLoginLog.getEndTime()),"create_time",blLoginLog.getEndTime()+" 23:59:59");
|
||||
IPage<BlLoginLog> pageList = blLoginLogService.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param blLoginLog
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "登录日志-添加")
|
||||
@ApiOperation(value="登录日志-添加", notes="登录日志-添加")
|
||||
@RequiresPermissions("blLoginLog:bl_login_log:add")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<String> add(@RequestBody BlLoginLog blLoginLog) {
|
||||
blLoginLogService.save(blLoginLog);
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param blLoginLog
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "登录日志-编辑")
|
||||
@ApiOperation(value="登录日志-编辑", notes="登录日志-编辑")
|
||||
@RequiresPermissions("blLoginLog:bl_login_log:edit")
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
|
||||
public Result<String> edit(@RequestBody BlLoginLog blLoginLog) {
|
||||
blLoginLogService.updateById(blLoginLog);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "登录日志-通过id删除")
|
||||
@ApiOperation(value="登录日志-通过id删除", notes="登录日志-通过id删除")
|
||||
@RequiresPermissions("blLoginLog:bl_login_log:delete")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
|
||||
blLoginLogService.removeById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "登录日志-批量删除")
|
||||
@ApiOperation(value="登录日志-批量删除", notes="登录日志-批量删除")
|
||||
@RequiresPermissions("blLoginLog:bl_login_log:deleteBatch")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
this.blLoginLogService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "登录日志-通过id查询")
|
||||
@ApiOperation(value="登录日志-通过id查询", notes="登录日志-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<BlLoginLog> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
BlLoginLog blLoginLog = blLoginLogService.getById(id);
|
||||
if(blLoginLog==null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(blLoginLog);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param blLoginLog
|
||||
*/
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, BlLoginLog blLoginLog) {
|
||||
return super.exportXls(request, blLoginLog, BlLoginLog.class, "登录日志");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过excel导入数据
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("blLoginLog:bl_login_log:importExcel")
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
return super.importExcel(request, response, BlLoginLog.class);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@PostMapping(value = "/addLog")
|
||||
public Result<String> addLog(@RequestBody SysUser sysUser) {
|
||||
blLoginLogService.addLog("用户名: " + sysUser.getUsername() + ",登录成功!", CommonConstant.LOG_TYPE_1, null,null);
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,98 @@
|
|||
package org.jeecg.modules.kc.blLoginLog.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.Date;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.jeecg.common.aspect.annotation.Dict;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* @Description: 登录日志
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2024-06-17
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("bl_login_log")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value="bl_login_log对象", description="登录日志")
|
||||
public class BlLoginLog implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**id*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value = "id")
|
||||
private java.lang.String id;
|
||||
/**日志类型(1登录日志,2操作日志, 3.租户操作日志)*/
|
||||
@ApiModelProperty(value = "日志类型(1登录日志,2操作日志, 3.租户操作日志)")
|
||||
private java.lang.Integer logType;
|
||||
/**日志内容*/
|
||||
@Excel(name = "日志内容", width = 35)
|
||||
@ApiModelProperty(value = "日志内容")
|
||||
private java.lang.String logContent;
|
||||
/**操作类型*/
|
||||
@ApiModelProperty(value = "操作类型")
|
||||
private java.lang.Integer operateType;
|
||||
/**操作用户账号*/
|
||||
@Excel(name = "操作用户账号", width = 15)
|
||||
@ApiModelProperty(value = "操作用户账号")
|
||||
private java.lang.String userid;
|
||||
/**操作用户名称*/
|
||||
@Excel(name = "操作用户名称", width = 15)
|
||||
@ApiModelProperty(value = "操作用户名称")
|
||||
private java.lang.String username;
|
||||
/**IP*/
|
||||
@Excel(name = "IP", width = 15)
|
||||
@ApiModelProperty(value = "IP")
|
||||
private java.lang.String ip;
|
||||
/**请求java方法*/
|
||||
@ApiModelProperty(value = "请求java方法")
|
||||
private java.lang.String method;
|
||||
/**请求路径*/
|
||||
@ApiModelProperty(value = "请求路径")
|
||||
private java.lang.String requestUrl;
|
||||
/**请求参数*/
|
||||
@ApiModelProperty(value = "请求参数")
|
||||
private java.lang.String requestParam;
|
||||
/**请求类型*/
|
||||
@ApiModelProperty(value = "请求类型")
|
||||
private java.lang.String requestType;
|
||||
/**耗时*/
|
||||
@ApiModelProperty(value = "耗时")
|
||||
private java.lang.Integer costTime;
|
||||
/**创建人*/
|
||||
@ApiModelProperty(value = "创建人")
|
||||
private java.lang.String createBy;
|
||||
/**创建时间*/
|
||||
@Excel(name = "登录时间", width = 30 ,format = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private java.util.Date createTime;
|
||||
/**更新人*/
|
||||
@ApiModelProperty(value = "更新人")
|
||||
private java.lang.String updateBy;
|
||||
/**更新时间*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
private java.util.Date updateTime;
|
||||
/**租户ID*/
|
||||
@ApiModelProperty(value = "租户ID")
|
||||
private java.lang.Integer tenantId;
|
||||
@TableField(exist = false)
|
||||
private String startTime;
|
||||
@TableField(exist = false)
|
||||
private String endTime;
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package org.jeecg.modules.kc.blLoginLog.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.jeecg.modules.kc.blLoginLog.entity.BlLoginLog;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @Description: 登录日志
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2024-06-17
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface BlLoginLogMapper extends BaseMapper<BlLoginLog> {
|
||||
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.jeecg.modules.kc.blLoginLog.mapper.BlLoginLogMapper">
|
||||
|
||||
</mapper>
|
|
@ -0,0 +1,17 @@
|
|||
package org.jeecg.modules.kc.blLoginLog.service;
|
||||
|
||||
import org.jeecg.common.system.vo.LoginUser;
|
||||
import org.jeecg.modules.kc.blLoginLog.entity.BlLoginLog;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.jeecg.modules.system.entity.SysUser;
|
||||
|
||||
/**
|
||||
* @Description: 登录日志
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2024-06-17
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface IBlLoginLogService extends IService<BlLoginLog> {
|
||||
|
||||
void addLog(String logContent, Integer logType, Integer operatetype, SysUser user);
|
||||
}
|
|
@ -0,0 +1,68 @@
|
|||
package org.jeecg.modules.kc.blLoginLog.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.jeecg.common.api.dto.LogDTO;
|
||||
import org.jeecg.common.system.vo.LoginUser;
|
||||
import org.jeecg.common.util.IpUtils;
|
||||
import org.jeecg.common.util.SpringContextUtils;
|
||||
import org.jeecg.modules.kc.blLoginLog.entity.BlLoginLog;
|
||||
import org.jeecg.modules.kc.blLoginLog.mapper.BlLoginLogMapper;
|
||||
import org.jeecg.modules.kc.blLoginLog.service.IBlLoginLogService;
|
||||
import org.jeecg.modules.system.entity.SysUser;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @Description: 登录日志
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2024-06-17
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class BlLoginLogServiceImpl extends ServiceImpl<BlLoginLogMapper, BlLoginLog> implements IBlLoginLogService {
|
||||
|
||||
|
||||
@Override
|
||||
public void addLog(String logContent, Integer logType, Integer operatetype, SysUser user) {
|
||||
BlLoginLog sysLog = new BlLoginLog();
|
||||
sysLog.setId(String.valueOf(IdWorker.getId()));
|
||||
//注解上的描述,操作日志内容
|
||||
sysLog.setLogContent(logContent);
|
||||
sysLog.setLogType(logType);
|
||||
sysLog.setOperateType(operatetype);
|
||||
try {
|
||||
//获取request
|
||||
HttpServletRequest request = SpringContextUtils.getHttpServletRequest();
|
||||
//设置IP地址
|
||||
sysLog.setIp(IpUtils.getIpAddr(request));
|
||||
} catch (Exception e) {
|
||||
sysLog.setIp("127.0.0.1");
|
||||
}
|
||||
//获取登录用户信息
|
||||
// if(user==null){
|
||||
// try {
|
||||
// user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
// } catch (Exception e) {
|
||||
// //e.printStackTrace();
|
||||
// }
|
||||
// }
|
||||
if(user!=null){
|
||||
sysLog.setUserid(user.getUsername());
|
||||
sysLog.setUsername(user.getRealname());
|
||||
sysLog.setCreateBy(user.getUsername());
|
||||
}
|
||||
sysLog.setCreateTime(new Date());
|
||||
//保存日志(异常捕获处理,防止数据太大存储失败,导致业务失败)JT-238
|
||||
try {
|
||||
baseMapper.insert(sysLog);
|
||||
} catch (Exception e) {
|
||||
log.warn(" LogContent length : "+sysLog.getLogContent().length());
|
||||
log.warn(e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -550,7 +550,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|||
//
|
||||
// baseCommonService.addLog("用户名: " + sysUser.getUsername() + ",登录成功!", CommonConstant.LOG_TYPE_1, null);
|
||||
try {
|
||||
blLoginLogService.addLog("用户名: " + sysUser.getUsername() + ",登录成功!", CommonConstant.LOG_TYPE_1, null,sysUser);
|
||||
blLoginLogService.addLog("用户名: " + sysUser.getRealname() + ",登录成功!", CommonConstant.LOG_TYPE_1, null,sysUser);
|
||||
}catch (Exception e) {
|
||||
System.out.println("Error---------->: " + sysUser.getUsername());
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@ spring:
|
|||
clusterCheckinInterval: 15000
|
||||
threadPool:
|
||||
class: org.quartz.simpl.SimpleThreadPool
|
||||
threadCount: 10
|
||||
threadCount: 100
|
||||
threadPriority: 5
|
||||
threadsInheritContextClassLoaderOfInitializingThread: true
|
||||
#json 时间戳统一转换
|
||||
|
|
Loading…
Reference in New Issue