Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f831f4faf0 | ||
|
|
d7016b418e | ||
|
|
fd92109e2e |
22
pom.xml
22
pom.xml
@@ -6,7 +6,7 @@
|
||||
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-parent</artifactId>
|
||||
<version>2.0.0.rc2</version>
|
||||
<version>2.0.0.rc3</version>
|
||||
<packaging>pom</packaging>
|
||||
<name>springboot-parent</name>
|
||||
<description>杭州铁晟科技有限公司基础依赖</description>
|
||||
@@ -58,61 +58,61 @@
|
||||
<dependency>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-database</artifactId>
|
||||
<version>2.0.0.rc2</version>
|
||||
<version>2.0.0.rc3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-login</artifactId>
|
||||
<version>2.0.0.rc2</version>
|
||||
<version>2.0.0.rc3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-web</artifactId>
|
||||
<version>2.0.0.rc2</version>
|
||||
<version>2.0.0.rc3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-util</artifactId>
|
||||
<version>2.0.0.rc2</version>
|
||||
<version>2.0.0.rc3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-platform</artifactId>
|
||||
<version>2.0.0.rc2</version>
|
||||
<version>2.0.0.rc3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-message</artifactId>
|
||||
<version>2.0.0.rc2</version>
|
||||
<version>2.0.0.rc3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-encrypt</artifactId>
|
||||
<version>2.0.0.rc2</version>
|
||||
<version>2.0.0.rc3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-role</artifactId>
|
||||
<version>2.0.0.rc2</version>
|
||||
<version>2.0.0.rc3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-annotation</artifactId>
|
||||
<version>2.0.0.rc2</version>
|
||||
<version>2.0.0.rc3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-poi</artifactId>
|
||||
<version>2.0.0.rc2</version>
|
||||
<version>2.0.0.rc3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
||||
@@ -6,11 +6,11 @@
|
||||
<parent>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-parent</artifactId>
|
||||
<version>2.0.0.rc2</version>
|
||||
<version>2.0.0.rc3</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>springboot-ademo</artifactId>
|
||||
<version>2.0.0.rc2</version>
|
||||
<version>2.0.0.rc3</version>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-parent</artifactId>
|
||||
<version>2.0.0.rc2</version>
|
||||
<version>2.0.0.rc3</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>springboot-annotation</artifactId>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-parent</artifactId>
|
||||
<version>2.0.0.rc2</version>
|
||||
<version>2.0.0.rc3</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>springboot-database</artifactId>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-parent</artifactId>
|
||||
<version>2.0.0.rc2</version>
|
||||
<version>2.0.0.rc3</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>springboot-encrypt</artifactId>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-parent</artifactId>
|
||||
<version>2.0.0.rc2</version>
|
||||
<version>2.0.0.rc3</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>springboot-login</artifactId>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-parent</artifactId>
|
||||
<version>2.0.0.rc2</version>
|
||||
<version>2.0.0.rc3</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>springboot-message</artifactId>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-parent</artifactId>
|
||||
<version>2.0.0.rc2</version>
|
||||
<version>2.0.0.rc3</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>springboot-platform</artifactId>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-parent</artifactId>
|
||||
<version>2.0.0.rc2</version>
|
||||
<version>2.0.0.rc3</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>springboot-poi</artifactId>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-parent</artifactId>
|
||||
<version>2.0.0.rc2</version>
|
||||
<version>2.0.0.rc3</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>springboot-role</artifactId>
|
||||
|
||||
@@ -43,6 +43,7 @@ public class RoleController {
|
||||
public ApiResp<List<CoreRoleGroup>> groupList(@Valid GroupTypeDTO dto) {
|
||||
return ApiResp.respOK(coreRoleService.list(
|
||||
new QueryWrapper<CoreRoleGroup>()
|
||||
.eq("is_deleted", 0)
|
||||
.eq("type", dto.getType())
|
||||
.orderByAsc("sort")
|
||||
));
|
||||
|
||||
@@ -9,7 +9,6 @@ import com.tiesheng.role.pojos.dao.CoreRoleAuthority;
|
||||
import com.tiesheng.role.pojos.dao.CoreRoleGroup;
|
||||
import com.tiesheng.role.pojos.dao.CoreRoleGroupRx;
|
||||
import com.tiesheng.role.pojos.dto.GroupRxUpdateDTO;
|
||||
import com.tiesheng.role.pojos.dto.MenuListDTO;
|
||||
import com.tiesheng.role.pojos.dto.OwnerMenuDTO;
|
||||
import com.tiesheng.role.pojos.vo.ServiceMenuVO;
|
||||
import com.tiesheng.util.service.TsServiceBase;
|
||||
@@ -17,7 +16,10 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@@ -96,7 +98,10 @@ public class CoreRoleService extends TsServiceBase<CoreRoleGroupMapper, CoreRole
|
||||
coreRoleGroupRx.setMenuId(menuId);
|
||||
list.add(coreRoleGroupRx);
|
||||
}
|
||||
coreRoleGroupRxMapper.batchInsert(list);
|
||||
|
||||
if (CollUtil.isNotEmpty(list)) {
|
||||
coreRoleGroupRxMapper.batchInsert(list);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-parent</artifactId>
|
||||
<version>2.0.0.rc2</version>
|
||||
<version>2.0.0.rc3</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>springboot-util</artifactId>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-parent</artifactId>
|
||||
<version>2.0.0.rc2</version>
|
||||
<version>2.0.0.rc3</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>springboot-web</artifactId>
|
||||
|
||||
@@ -6,8 +6,9 @@ import cn.hutool.core.util.ArrayUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.tiesheng.annotation.operation.OperationIgnore;
|
||||
import com.tiesheng.annotation.operation.OperationLog;
|
||||
import com.tiesheng.web.service.CoreLogService;
|
||||
import com.tiesheng.util.ServletKit;
|
||||
import com.tiesheng.util.config.TsTokenConfig;
|
||||
import com.tiesheng.web.service.CoreLogService;
|
||||
import org.aspectj.lang.ProceedingJoinPoint;
|
||||
import org.aspectj.lang.annotation.Around;
|
||||
import org.aspectj.lang.annotation.Aspect;
|
||||
@@ -108,7 +109,7 @@ public class OperationAspect {
|
||||
}
|
||||
}
|
||||
|
||||
coreLogService.addOperationLog(title, subject, reqMaps);
|
||||
coreLogService.addOperationLog(TsTokenConfig.getWithoutThr(), title, subject, reqMaps);
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
@@ -7,6 +7,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.tiesheng.web.pojos.dao.CoreLogOperation;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface CoreLogOperationMapper extends BaseMapper<CoreLogOperation> {
|
||||
|
||||
|
||||
@@ -20,4 +22,12 @@ public interface CoreLogOperationMapper extends BaseMapper<CoreLogOperation> {
|
||||
Page<CoreLogOperation> page(IPage<CoreLogOperation> page, @Param("ew") QueryWrapper<CoreLogOperation> queryWrapper);
|
||||
|
||||
|
||||
/**
|
||||
* 批量插入日志
|
||||
*
|
||||
* @param coreLogOperations
|
||||
* @return
|
||||
*/
|
||||
int batchInsert(@Param("list") List<CoreLogOperation> coreLogOperations);
|
||||
|
||||
}
|
||||
|
||||
@@ -2,11 +2,17 @@ package com.tiesheng.web.service;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.thread.ThreadUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.extra.servlet.ServletUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.tiesheng.util.ServletKit;
|
||||
import com.tiesheng.util.config.Ip2regionConfig;
|
||||
import com.tiesheng.util.exception.ApiException;
|
||||
import com.tiesheng.util.pojos.TokenBean;
|
||||
import com.tiesheng.util.service.TsServiceBase;
|
||||
import com.tiesheng.web.mapper.CoreLogLoginMapper;
|
||||
import com.tiesheng.web.mapper.CoreLogMessageMapper;
|
||||
import com.tiesheng.web.mapper.CoreLogOperationMapper;
|
||||
@@ -19,12 +25,6 @@ import com.tiesheng.web.pojos.dao.CorePlatformUnique;
|
||||
import com.tiesheng.web.pojos.vo.ProcessDetailVo;
|
||||
import com.tiesheng.web.util.ProcessImportConsumer;
|
||||
import com.tiesheng.web.util.ProcessSyncConsumer;
|
||||
import com.tiesheng.util.config.TsTokenConfig;
|
||||
import com.tiesheng.util.pojos.TokenBean;
|
||||
import com.tiesheng.util.ServletKit;
|
||||
import com.tiesheng.util.config.Ip2regionConfig;
|
||||
import com.tiesheng.util.exception.ApiException;
|
||||
import com.tiesheng.util.service.TsServiceBase;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -38,6 +38,11 @@ import java.util.List;
|
||||
@Service
|
||||
public class CoreLogService extends TsServiceBase<CoreLogOperationMapper, CoreLogOperation> {
|
||||
|
||||
/**
|
||||
* 日志缓存
|
||||
*/
|
||||
private static final List<CoreLogOperation> cacheOperations = new ArrayList<>();
|
||||
|
||||
@Autowired
|
||||
TieshengWebConfigurer tieshengWebConfigurer;
|
||||
@Autowired
|
||||
@@ -177,14 +182,19 @@ public class CoreLogService extends TsServiceBase<CoreLogOperationMapper, CoreLo
|
||||
/**
|
||||
* 添加操作日志
|
||||
*/
|
||||
public void addOperationLog(String title, String subject, Object params) {
|
||||
TokenBean tokenBean = TsTokenConfig.getWithoutThr();
|
||||
if (tokenBean == null || StrUtil.isEmpty(tokenBean.getId())) {
|
||||
return;
|
||||
public void addOperationLog(TokenBean tokenBean, String title, String subject, Object params) {
|
||||
|
||||
RequestUserInfo requestUserInfo = null;
|
||||
if (tokenBean != null && !StrUtil.isEmpty(tokenBean.getId())) {
|
||||
requestUserInfo = tieshengWebConfigurer.getCurrentUserName(tokenBean);
|
||||
}
|
||||
if (requestUserInfo == null) {
|
||||
requestUserInfo = new RequestUserInfo();
|
||||
}
|
||||
|
||||
RequestUserInfo requestUserInfo = tieshengWebConfigurer.getCurrentUserName(tokenBean);
|
||||
CoreLogOperation operation = new CoreLogOperation();
|
||||
operation.setCreateTime(DateUtil.date());
|
||||
operation.setUpdateTime(DateUtil.date());
|
||||
operation.setUserId(requestUserInfo.getId());
|
||||
operation.setUserName(requestUserInfo.getName());
|
||||
operation.setTitle(title);
|
||||
@@ -192,7 +202,15 @@ public class CoreLogService extends TsServiceBase<CoreLogOperationMapper, CoreLo
|
||||
if (params != null) {
|
||||
operation.setParams(JSONUtil.toJsonStr(params));
|
||||
}
|
||||
save(operation);
|
||||
|
||||
synchronized (CoreLogOperation.class) {
|
||||
cacheOperations.add(operation);
|
||||
if (cacheOperations.size() >= 100) {
|
||||
getBaseMapper().batchInsert(cacheOperations);
|
||||
cacheOperations.clear();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -24,4 +24,18 @@
|
||||
${ew.customSqlSegment}
|
||||
</select>
|
||||
|
||||
<insert id="batchInsert">
|
||||
insert into core_log_operation(id, create_time, update_time, is_deleted, user_id, user_name, title, subject,
|
||||
params)
|
||||
values
|
||||
<foreach collection="list" item="it" separator=",">
|
||||
(uuid(), #{it.createTime}, #{it.updateTime}, 0,
|
||||
#{it.userId},
|
||||
#{it.userName},
|
||||
#{it.title},
|
||||
#{it.subject},
|
||||
#{it.params})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user