【修改】 日志 操作类型
This commit is contained in:
+5
-2
@@ -16,10 +16,13 @@ public class LogDTO implements Serializable {
|
|||||||
/**内容*/
|
/**内容*/
|
||||||
private String logContent;
|
private String logContent;
|
||||||
|
|
||||||
/**日志类型(0:操作日志;1:登录日志;2:定时任务) */
|
/** 日志类型(1登录日志,2操作日志) */
|
||||||
private Integer logType;
|
private Integer logType;
|
||||||
|
|
||||||
/**操作类型(1:添加;2:修改;3:删除;) */
|
|
||||||
|
/**
|
||||||
|
* 操作类型(1查询,2添加,3修改,4删除,5导入,6导出)
|
||||||
|
*/
|
||||||
private Integer operateType;
|
private Integer operateType;
|
||||||
|
|
||||||
/**登录用户 */
|
/**登录用户 */
|
||||||
|
|||||||
+2
-1
@@ -84,7 +84,8 @@ public class YouBianCodeUtil {
|
|||||||
return getNextYouBianCode(localCode);
|
return getNextYouBianCode(localCode);
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
parentCode = parentCode + "A"+ getNextStrNum(0);
|
int num = Integer.parseInt(localCode.substring(localCode.length()-2,localCode.length()));
|
||||||
|
parentCode = parentCode + "A"+ getNextStrNum(num);
|
||||||
}
|
}
|
||||||
return parentCode;
|
return parentCode;
|
||||||
}
|
}
|
||||||
|
|||||||
+12
@@ -16,6 +16,7 @@ import com.jero.common.util.YouBianCodeUtil;
|
|||||||
import com.jero.common.util.oConvertUtils;
|
import com.jero.common.util.oConvertUtils;
|
||||||
import com.jero.modules.system.entity.SysDepart;
|
import com.jero.modules.system.entity.SysDepart;
|
||||||
import com.jero.modules.system.entity.SysUser;
|
import com.jero.modules.system.entity.SysUser;
|
||||||
|
import com.jero.modules.system.mapper.SysDepartMapper;
|
||||||
import com.jero.modules.system.model.DepartIdModel;
|
import com.jero.modules.system.model.DepartIdModel;
|
||||||
import com.jero.modules.system.service.ISysDepartService;
|
import com.jero.modules.system.service.ISysDepartService;
|
||||||
import com.jero.modules.system.service.ISysUserDepartService;
|
import com.jero.modules.system.service.ISysUserDepartService;
|
||||||
@@ -62,6 +63,9 @@ public class SysDepartController {
|
|||||||
private ISysUserService sysUserService;
|
private ISysUserService sysUserService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private ISysUserDepartService sysUserDepartService;
|
private ISysUserDepartService sysUserDepartService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SysDepartMapper sysDepartMapper;
|
||||||
/**
|
/**
|
||||||
* 查询数据 查出我的部门,并以树结构数据格式响应给前端
|
* 查询数据 查出我的部门,并以树结构数据格式响应给前端
|
||||||
*
|
*
|
||||||
@@ -171,6 +175,10 @@ public class SysDepartController {
|
|||||||
public Results<Object> add(@RequestBody SysDepart sysDepart, HttpServletRequest request) {
|
public Results<Object> add(@RequestBody SysDepart sysDepart, HttpServletRequest request) {
|
||||||
String username = JwtUtil.getUserNameByToken(request);
|
String username = JwtUtil.getUserNameByToken(request);
|
||||||
try {
|
try {
|
||||||
|
long count = sysDepartMapper.selectCountByPId(sysDepart);
|
||||||
|
if(count > 0){
|
||||||
|
return Results.error("同级目录下,名称不能重复");
|
||||||
|
}
|
||||||
sysDepart.setCreateBy(username);
|
sysDepart.setCreateBy(username);
|
||||||
sysDepartService.saveDepartData(sysDepart, username);
|
sysDepartService.saveDepartData(sysDepart, username);
|
||||||
return Results.OK("操作成功!");
|
return Results.OK("操作成功!");
|
||||||
@@ -191,6 +199,10 @@ public class SysDepartController {
|
|||||||
@PostMapping("/edit")
|
@PostMapping("/edit")
|
||||||
@CacheEvict(value= {CacheConstant.SYS_DEPARTS_CACHE,CacheConstant.SYS_DEPART_IDS_CACHE}, allEntries=true)
|
@CacheEvict(value= {CacheConstant.SYS_DEPARTS_CACHE,CacheConstant.SYS_DEPART_IDS_CACHE}, allEntries=true)
|
||||||
public Results<Object> edit(@RequestBody SysDepart sysDepart, HttpServletRequest request) {
|
public Results<Object> edit(@RequestBody SysDepart sysDepart, HttpServletRequest request) {
|
||||||
|
long count = sysDepartMapper.selectCountByPId(sysDepart);
|
||||||
|
if(count > 0){
|
||||||
|
return Results.error("同级目录下,名称不能重复");
|
||||||
|
}
|
||||||
String username = JwtUtil.getUserNameByToken(request);
|
String username = JwtUtil.getUserNameByToken(request);
|
||||||
sysDepart.setUpdateBy(username);
|
sysDepart.setUpdateBy(username);
|
||||||
SysDepart sysDepartEntity = sysDepartService.getById(sysDepart.getId());
|
SysDepart sysDepartEntity = sysDepartService.getById(sysDepart.getId());
|
||||||
|
|||||||
+14
-5
@@ -167,6 +167,8 @@ public class SysUserController {
|
|||||||
@PostMapping("/add")
|
@PostMapping("/add")
|
||||||
public Results<Object> add(@RequestBody JSONObject jsonObject) {
|
public Results<Object> add(@RequestBody JSONObject jsonObject) {
|
||||||
try {
|
try {
|
||||||
|
//开始时间
|
||||||
|
long startTime = System.currentTimeMillis();
|
||||||
String selectedRoles = jsonObject.getString(SELECTED_ROLES);
|
String selectedRoles = jsonObject.getString(SELECTED_ROLES);
|
||||||
String selectedDeparts = jsonObject.getString("selecteddeparts");
|
String selectedDeparts = jsonObject.getString("selecteddeparts");
|
||||||
String rsaPublicKey = jsonObject.getString(RSA_PUBLIC_KEY);
|
String rsaPublicKey = jsonObject.getString(RSA_PUBLIC_KEY);
|
||||||
@@ -176,7 +178,13 @@ public class SysUserController {
|
|||||||
this.setUserInfo(rsaPrivateKey, user);
|
this.setUserInfo(rsaPrivateKey, user);
|
||||||
|
|
||||||
// 保存用户走一个service 保证事务
|
// 保存用户走一个service 保证事务
|
||||||
|
String id = UUID.randomUUID().toString().replace("-", "");
|
||||||
|
user.setId(id);
|
||||||
sysUserService.saveUser(user, selectedRoles, selectedDeparts);
|
sysUserService.saveUser(user, selectedRoles, selectedDeparts);
|
||||||
|
long endTime = System.currentTimeMillis();
|
||||||
|
long costTime = endTime - startTime;
|
||||||
|
baseCommonService.addLog("新增用户,id: " +id ,CommonConstant.LOG_TYPE_2, 2,null,
|
||||||
|
costTime);
|
||||||
return Results.OK(OPTION_SUCCESS);
|
return Results.OK(OPTION_SUCCESS);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
SysUserController.log.error(e.getMessage(), e);
|
SysUserController.log.error(e.getMessage(), e);
|
||||||
@@ -235,7 +243,7 @@ public class SysUserController {
|
|||||||
//结束时间
|
//结束时间
|
||||||
long endTime = System.currentTimeMillis();
|
long endTime = System.currentTimeMillis();
|
||||||
long costTime = endTime - startTime;
|
long costTime = endTime - startTime;
|
||||||
baseCommonService.addLog("编辑用户,id: " +jsonObject.getString("id") ,CommonConstant.LOG_TYPE_2, 2,null,
|
baseCommonService.addLog("编辑用户,id: " +jsonObject.getString("id") ,CommonConstant.LOG_TYPE_2, 3,null,
|
||||||
costTime);
|
costTime);
|
||||||
return Results.OK(OPTION_SUCCESS);
|
return Results.OK(OPTION_SUCCESS);
|
||||||
}
|
}
|
||||||
@@ -281,7 +289,7 @@ public class SysUserController {
|
|||||||
this.sysUserService.deleteUser(id);
|
this.sysUserService.deleteUser(id);
|
||||||
long endTime = System.currentTimeMillis();
|
long endTime = System.currentTimeMillis();
|
||||||
long costTime = endTime - startTime;
|
long costTime = endTime - startTime;
|
||||||
baseCommonService.addLog("删除用户,id: " +id ,CommonConstant.LOG_TYPE_2, 3,null,costTime);
|
baseCommonService.addLog("删除用户,id: " +id ,CommonConstant.LOG_TYPE_2, 4,null,costTime);
|
||||||
return Results.OK("删除用户成功");
|
return Results.OK("删除用户成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -297,7 +305,7 @@ public class SysUserController {
|
|||||||
|
|
||||||
long endTime = System.currentTimeMillis();
|
long endTime = System.currentTimeMillis();
|
||||||
long costTime = endTime - startTime;
|
long costTime = endTime - startTime;
|
||||||
baseCommonService.addLog("批量删除用户, ids: " +ids ,CommonConstant.LOG_TYPE_2, 3,null,costTime);
|
baseCommonService.addLog("批量删除用户, ids: " +ids ,CommonConstant.LOG_TYPE_2, 4,null,costTime);
|
||||||
return Results.OK("批量删除用户成功");
|
return Results.OK("批量删除用户成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1281,7 +1289,8 @@ public class SysUserController {
|
|||||||
}
|
}
|
||||||
long endTime = System.currentTimeMillis();
|
long endTime = System.currentTimeMillis();
|
||||||
long costTime = endTime - startTime;
|
long costTime = endTime - startTime;
|
||||||
baseCommonService.addLog("移动端编辑用户,id: " +jsonObject.getString("id") ,CommonConstant.LOG_TYPE_2, 2,null,costTime);
|
baseCommonService.addLog("移动端编辑用户,id: " +jsonObject.getString("id") ,CommonConstant.LOG_TYPE_2, 3,null,
|
||||||
|
costTime);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
SysUserController.log.error(e.getMessage(), e);
|
SysUserController.log.error(e.getMessage(), e);
|
||||||
return Results.error("操作失败!");
|
return Results.error("操作失败!");
|
||||||
@@ -1475,7 +1484,7 @@ public class SysUserController {
|
|||||||
sysUserService.addRoleToUser(user, roles);
|
sysUserService.addRoleToUser(user, roles);
|
||||||
endTime = System.currentTimeMillis();
|
endTime = System.currentTimeMillis();
|
||||||
costTime = endTime - startTime;
|
costTime = endTime - startTime;
|
||||||
baseCommonService.addLog("编辑用户角色,id: " + id, CommonConstant.LOG_TYPE_2, 2,null,costTime);
|
baseCommonService.addLog("编辑用户角色,id: " + id, CommonConstant.LOG_TYPE_2, 3,null,costTime);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|||||||
+3
@@ -71,4 +71,7 @@ public interface SysDepartMapper extends BaseMapper<SysDepart> {
|
|||||||
*/
|
*/
|
||||||
@Select("SELECT * FROM sys_depart where del_flag ='0' AND parent_id = #{parentId,jdbcType=VARCHAR}")
|
@Select("SELECT * FROM sys_depart where del_flag ='0' AND parent_id = #{parentId,jdbcType=VARCHAR}")
|
||||||
List<SysDepart> queryDeptByPid(@Param("parentId")String parentId);
|
List<SysDepart> queryDeptByPid(@Param("parentId")String parentId);
|
||||||
|
|
||||||
|
|
||||||
|
long selectCountByPId(@org.apache.ibatis.annotations.Param("pageVO") SysDepart sysDepart);
|
||||||
}
|
}
|
||||||
|
|||||||
+20
@@ -52,4 +52,24 @@
|
|||||||
<select id="queryCompByOrgCode" resultType="com.jero.modules.system.entity.SysDepart">
|
<select id="queryCompByOrgCode" resultType="com.jero.modules.system.entity.SysDepart">
|
||||||
select * from sys_depart where del_flag = '0' and org_category='1' and org_code= #{orgCode,jdbcType=VARCHAR}
|
select * from sys_depart where del_flag = '0' and org_category='1' and org_code= #{orgCode,jdbcType=VARCHAR}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectCountByPId" resultType="java.lang.Long">
|
||||||
|
select count(1) from sys_depart
|
||||||
|
|
||||||
|
<where>
|
||||||
|
del_flag = '0'
|
||||||
|
<if test="pageVO.id != null and pageVO.id != ''">
|
||||||
|
and id != #{pageVO.id}
|
||||||
|
</if>
|
||||||
|
<if test="pageVO.parentId != null and pageVO.parentId != ''">
|
||||||
|
and parent_id = #{pageVO.parentId}
|
||||||
|
</if>
|
||||||
|
|
||||||
|
<if test="pageVO.departName != null and pageVO.departName != ''">
|
||||||
|
and depart_name = #{pageVO.departName}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
|
||||||
|
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
+15
-11
@@ -1,33 +1,37 @@
|
|||||||
package com.jero.modules.system.service.impl;
|
package com.jero.modules.system.service.impl;
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.jero.common.system.vo.SysDepartTreeModel;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.jero.common.util.oConvertUtils;
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
|
||||||
import com.jero.common.constant.CacheConstant;
|
import com.jero.common.constant.CacheConstant;
|
||||||
import com.jero.common.constant.CommonConstant;
|
import com.jero.common.constant.CommonConstant;
|
||||||
import com.jero.common.constant.FillRuleConstant;
|
import com.jero.common.constant.FillRuleConstant;
|
||||||
|
import com.jero.common.system.vo.SysDepartTreeModel;
|
||||||
import com.jero.common.util.FillRuleUtil;
|
import com.jero.common.util.FillRuleUtil;
|
||||||
import com.jero.common.util.YouBianCodeUtil;
|
import com.jero.common.util.YouBianCodeUtil;
|
||||||
import com.jero.modules.system.entity.*;
|
import com.jero.common.util.oConvertUtils;
|
||||||
import com.jero.modules.system.mapper.*;
|
import com.jero.modules.system.entity.SysDepart;
|
||||||
|
import com.jero.modules.system.entity.SysDepartPermission;
|
||||||
|
import com.jero.modules.system.entity.SysUser;
|
||||||
|
import com.jero.modules.system.entity.SysUserDepart;
|
||||||
|
import com.jero.modules.system.mapper.SysDepartMapper;
|
||||||
|
import com.jero.modules.system.mapper.SysDepartPermissionMapper;
|
||||||
|
import com.jero.modules.system.mapper.SysUserDepartMapper;
|
||||||
|
import com.jero.modules.system.mapper.SysUserMapper;
|
||||||
import com.jero.modules.system.model.DepartIdModel;
|
import com.jero.modules.system.model.DepartIdModel;
|
||||||
import com.jero.modules.system.service.ISysDepartService;
|
import com.jero.modules.system.service.ISysDepartService;
|
||||||
import com.jero.modules.system.util.FindsDepartsChildrenUtil;
|
import com.jero.modules.system.util.FindsDepartsChildrenUtil;
|
||||||
|
import io.netty.util.internal.StringUtil;
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.cache.annotation.Cacheable;
|
import org.springframework.cache.annotation.Cacheable;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import java.util.*;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
||||||
|
|
||||||
import io.netty.util.internal.StringUtil;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
|
|||||||
Reference in New Issue
Block a user