Commit 697ed7a7 authored by mcb's avatar mcb

Merge branch 'dmp_dev' of http://gitlab.ioubuy.cn/yaobenzhang/jz-dmp-service into dmp_dev

parents 75ecc423 2640489e
......@@ -17,4 +17,6 @@ public @interface SysOperationLogAnnotation {
//定义成员
String descrption() default "" ;//描述
String actionType() default "" ;//操作的类型,1、添加 2、修改 3、删除 4、查询
String optModular() default "" ;//操作功能模块
boolean isProjOpt() default true ;//是否项目操作
}
......@@ -3,7 +3,9 @@ package com.jz.common.aspect;
import java.lang.reflect.Method;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletRequest;
......@@ -22,7 +24,9 @@ import com.alibaba.fastjson.JSONObject;
import com.jz.common.annotation.SysOperationLogAnnotation;
import com.jz.common.utils.HttpRequestUtil;
import com.jz.common.utils.web.SessionUtils;
import com.jz.dmp.modules.model.DmpMember;
import com.jz.dmp.modules.model.DmpOptLog;
import com.jz.dmp.modules.model.DmpRole;
import com.jz.dmp.modules.service.DmpOptLogService;
/**系统操作日志
......@@ -56,6 +60,13 @@ public class SysOperationLogAspect {
//设置操作时间
dmpOptLog.setOptTime(optTime);
dmpOptLog.setCreateTime(optTime);
// 保存操作用户信息
DmpMember dmpMember = SessionUtils.getSecurityUser();
dmpOptLog.setUserId(dmpMember.getUserId());
dmpOptLog.setUserName(dmpMember.getUserName());
dmpOptLog.setCreateUserId(dmpMember.getUserId());
//从切面织入点处通过反射机制获取织入点处的方法
MethodSignature signature = (MethodSignature) pjp.getSignature();
......@@ -66,8 +77,25 @@ public class SysOperationLogAspect {
if (operationLogAnnotation != null) {
String optType = operationLogAnnotation.actionType();
String optDesc = operationLogAnnotation.descrption();
String optModular = operationLogAnnotation.optModular();
boolean isProjOpt = operationLogAnnotation.isProjOpt();
dmpOptLog.setOptType(optType);//保存获取的操作
dmpOptLog.setOptDesc(optDesc);
dmpOptLog.setOptModular(optModular);
if (isProjOpt) {
dmpOptLog.setProjectId(dmpMember.getCurrentProjectId());
List<DmpRole> mprojRoleList = dmpMember.getMemberProjectRoleList();
String userRoles = mprojRoleList.stream().map(x->{
return x.getRoleName();
}).collect(Collectors.joining(","));
dmpOptLog.setUserRoles(userRoles);
}else {
List<DmpRole> memberRoleList = dmpMember.getMemberRoleList();
String userRoles = memberRoleList.stream().map(x->{
return x.getRoleName();
}).collect(Collectors.joining(","));
dmpOptLog.setUserRoles(userRoles);
}
}
//获取请求的类名
String className = pjp.getTarget().getClass().getName();
......@@ -89,12 +117,6 @@ public class SysOperationLogAspect {
}
dmpOptLog.setRequestParam(JSONObject.toJSONString(paramMap));
// 保存操作用户信息
String userId = SessionUtils.getCurrentUserId();
dmpOptLog.setUserId(Integer.parseInt(userId));
dmpOptLog.setUserName(SessionUtils.getCurrentUserName());
dmpOptLog.setCreateUserId(Integer.parseInt(userId));
//设置ip
String optIp = "";
try {
......
......@@ -46,7 +46,7 @@ public class DmpDevelopTaskController {
*/
@RequestMapping(method = RequestMethod.POST, value = "/findListWithPage")
@ApiOperation(value = "分頁列表查询任务开发", notes = "分頁列表查询任务开发")
@SysOperationLogAnnotation(actionType = "分頁列表查询任务开发", descrption = "分頁列表查询任务开发")
@SysOperationLogAnnotation(actionType = "列表查询", descrption = "分頁列表查询任务开发", optModular = "任务开发--查询", isProjOpt = true)
public PageInfoResponse<DmpDevelopTaskDto> findListWithPage(@RequestBody DmpDevelopTaskRequest dmpDevelopTaskRequest, HttpServletRequest httpRequest){
PageInfoResponse<DmpDevelopTaskDto> pageInfo = new PageInfoResponse<DmpDevelopTaskDto>();
try {
......
package com.jz.dmp.modules.controller.bean;
import java.util.List;
import com.jz.dmp.modules.model.DmpOptLog;
/**
......
......@@ -16,107 +16,142 @@ public class DmpOptLogRequest extends BasePageBean {
* 主键
*/
@ApiModelProperty(value = "主键")
@FieldAssist(orderBy = "log.opt_id")
@FieldAssist(orderBy = "_log.opt_id")
private Integer optId;
/**
* 操作人ID
*/
@ApiModelProperty(value = "操作人ID")
@FieldAssist(orderBy = "log.user_id")
@FieldAssist(orderBy = "_log.user_id")
private Integer userId;
/**
* 操作人姓名
*/
@ApiModelProperty(value = "操作人姓名")
@FieldAssist(orderBy = "log.user_name")
@FieldAssist(orderBy = "_log.user_name")
private String userName;
/**
* 操作时间起
*/
/**
*
*/
@ApiModelProperty(value = "")
@FieldAssist(orderBy = "_log.user_roles")
private String userRoles;
/**
* 操作时间
*/
@ApiModelProperty(value = "操作时间")
@FieldAssist(orderBy = "_log.opt_time")
private Date optTime;
/**
* 操作时间起
*/
@ApiModelProperty(value = "操作时间起")
private Date optTimeStart;
/**
* 操作时间止
*/
/**
* 操作时间止
*/
@ApiModelProperty(value = "操作时间止")
private Date optTimeEnd;
/**
* 操作功能模块
*/
@ApiModelProperty(value = "操作功能模块")
@FieldAssist(orderBy = "_log.opt_modular")
private String optModular;
/**
* 操作类型
*/
@ApiModelProperty(value = "操作类型")
@FieldAssist(orderBy = "log.opt_type")
@FieldAssist(orderBy = "_log.opt_type")
private String optType;
/**
* 操作描述
*/
@ApiModelProperty(value = "操作描述")
@FieldAssist(orderBy = "log.opt_desc")
@FieldAssist(orderBy = "_log.opt_desc")
private String optDesc;
/**
* 操作方法
*/
@ApiModelProperty(value = "操作方法")
@FieldAssist(orderBy = "log.method")
@FieldAssist(orderBy = "_log.method")
private String method;
/**
* 请求参数
*/
@ApiModelProperty(value = "请求参数")
@FieldAssist(orderBy = "log.request_param")
@FieldAssist(orderBy = "_log.request_param")
private String requestParam;
/**
* 操作结果
*/
@ApiModelProperty(value = "操作结果")
@FieldAssist(orderBy = "log.opt_result")
@FieldAssist(orderBy = "_log.opt_result")
private String optResult;
/**
* IP地址
*/
@ApiModelProperty(value = "IP地址")
@FieldAssist(orderBy = "log.opt_ip")
@FieldAssist(orderBy = "_log.opt_ip")
private String optIp;
/**
*
*/
@ApiModelProperty(value = "")
@FieldAssist(orderBy = "_log.project_id")
private Integer projectId;
/**
* 备注
*/
@ApiModelProperty(value = "备注")
@FieldAssist(orderBy = "log.remark")
@FieldAssist(orderBy = "_log.remark")
private String remark;
/**
* 数据状态(0:删除,1,未删除)
*/
@ApiModelProperty(value = "数据状态(0:删除,1,未删除)")
@FieldAssist(orderBy = "log.data_status")
@FieldAssist(orderBy = "_log.data_status")
private String dataStatus;
/**
* 创建用户ID
*/
@ApiModelProperty(value = "创建用户ID")
@FieldAssist(orderBy = "log.create_user_id")
@FieldAssist(orderBy = "_log.create_user_id")
private Integer createUserId;
/**
* 创建时间起
*/
/**
* 创建时间
*/
@ApiModelProperty(value = "创建时间")
@FieldAssist(orderBy = "_log.create_time")
private Date createTime;
/**
* 创建时间起
*/
@ApiModelProperty(value = "创建时间起")
private Date createTimeStart;
/**
* 创建时间止
*/
/**
* 创建时间止
*/
@ApiModelProperty(value = "创建时间止")
private Date createTimeEnd;
......@@ -124,18 +159,25 @@ public class DmpOptLogRequest extends BasePageBean {
* 修改用户ID
*/
@ApiModelProperty(value = "修改用户ID")
@FieldAssist(orderBy = "log.update_user_id")
@FieldAssist(orderBy = "_log.update_user_id")
private Integer updateUserId;
/**
* 修改时间起
*/
/**
* 修改时间
*/
@ApiModelProperty(value = "修改时间")
@FieldAssist(orderBy = "_log.update_time")
private Date updateTime;
/**
* 修改时间起
*/
@ApiModelProperty(value = "修改时间起")
private Date updateTimeStart;
/**
* 修改时间止
*/
/**
* 修改时间止
*/
@ApiModelProperty(value = "修改时间止")
private Date updateTimeEnd;
......@@ -163,6 +205,22 @@ public class DmpOptLogRequest extends BasePageBean {
this.userName = userName;
}
public String getUserRoles() {
return userRoles;
}
public void setUserRoles(String userRoles) {
this.userRoles = userRoles;
}
public Date getOptTime() {
return optTime;
}
public void setOptTime(Date optTime) {
this.optTime = optTime;
}
public Date getOptTimeStart() {
return optTimeStart;
}
......@@ -179,6 +237,14 @@ public class DmpOptLogRequest extends BasePageBean {
this.optTimeEnd = optTimeEnd;
}
public String getOptModular() {
return optModular;
}
public void setOptModular(String optModular) {
this.optModular = optModular;
}
public String getOptType() {
return optType;
}
......@@ -227,6 +293,14 @@ public class DmpOptLogRequest extends BasePageBean {
this.optIp = optIp;
}
public Integer getProjectId() {
return projectId;
}
public void setProjectId(Integer projectId) {
this.projectId = projectId;
}
public String getRemark() {
return remark;
}
......@@ -251,6 +325,14 @@ public class DmpOptLogRequest extends BasePageBean {
this.createUserId = createUserId;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getCreateTimeStart() {
return createTimeStart;
}
......@@ -275,6 +357,14 @@ public class DmpOptLogRequest extends BasePageBean {
this.updateUserId = updateUserId;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public Date getUpdateTimeStart() {
return updateTimeStart;
}
......
......@@ -27,6 +27,9 @@ public class MyDmpDevelopTaskConverter {
}
public DmpDevelopTaskDto domain2dto(DmpDevelopTask dmpDevelopTask) {
if (dmpDevelopTask == null) {
return null;
}
DmpDevelopTaskDto dmpDevelopTaskDto = new DmpDevelopTaskDto();
BeanUtils.copyProperties(dmpDevelopTask, dmpDevelopTaskDto);
......
package com.jz.dmp.modules.controller.bean;
import java.util.ArrayList;
import java.util.List;
import org.springframework.beans.BeanUtils;
import com.jz.dmp.modules.controller.sys.bean.DmpMemberDto;
import com.jz.dmp.modules.model.DmpMember;
public class MyDmpMemberConverter {
private static MyDmpMemberConverter instance;
private MyDmpMemberConverter() {};
public synchronized static MyDmpMemberConverter INSTANCE() {
if (instance==null) {
instance = new MyDmpMemberConverter();
}
return instance;
}
public DmpMemberDto domain2dto(DmpMember dmpMember) {
if (dmpMember==null) {
return null;
}
DmpMemberDto dmpMemberDto = new DmpMemberDto();
BeanUtils.copyProperties(dmpMember, dmpMemberDto);
return dmpMemberDto;
}
public List<DmpMemberDto> domain2dto(List<DmpMember> dmpMembers) {
List<DmpMemberDto> dmpMemberDtos = new ArrayList<DmpMemberDto>();
dmpMembers.stream().forEach(x -> {
dmpMemberDtos.add(domain2dto(x));
});
return dmpMemberDtos;
}
public DmpMember dto2domain(DmpMemberDto dmpMemberDto) {
if (dmpMemberDto==null) {
return null;
}
DmpMember dmpMember = new DmpMember();
BeanUtils.copyProperties(dmpMemberDto, dmpMember);
return dmpMember;
}
public List<DmpMember> dto2domain(List<DmpMemberDto> dmpMemberDtos) {
List<DmpMember> dmpMembers = new ArrayList<DmpMember>();
dmpMemberDtos.stream().forEach(x -> {
dmpMembers.add(dto2domain(x));
});
return dmpMembers;
}
}
......@@ -45,7 +45,7 @@ public class MyDmpOptLogConverter {
public List<DmpOptLog> dto2domain(List<DmpOptLogDto> dmpOptLogDtos) {
List<DmpOptLog> dmpOptLogs = new ArrayList<DmpOptLog>();
dmpOptLogDtos.stream().forEach(x -> {
dmpOptLogs.add(domain2dto(x));
dmpOptLogs.add(dto2domain(x));
});
return dmpOptLogs;
......
......@@ -99,6 +99,25 @@ public class DmpMemberController {
return baseBeanResponse;
}
/**获取登录用户信息
* @param dmpMemberRequest
* @return
*/
@RequestMapping(method = RequestMethod.GET, value = "/getLoginUserInfo")
@ApiOperation(value = "获取登录用户信息", notes = "获取登录用户信息")
public BaseBeanResponse<DmpMemberDto> getLoginUserInfo(HttpServletRequest httpRequest){
BaseBeanResponse<DmpMemberDto> baseBeanResponse = new BaseBeanResponse<DmpMemberDto>();
try {
baseBeanResponse = dmpMemberService.getLoginUserInfo(httpRequest);
} catch (Exception e) {
baseBeanResponse.setMessage("请求失败");
baseBeanResponse.setCode(ResultCode.INTERNAL_SERVER_ERROR.val());
e.printStackTrace();
}
return baseBeanResponse;
}
/**删除用户表
* @param userId
* @return
......
......@@ -36,6 +36,12 @@ public class DmpOptLog implements Serializable{
@ApiModelProperty(value = "操作人姓名")
private String userName;
/**
*
*/
@ApiModelProperty(value = "")
private String userRoles;
/**
* 操作时间
*/
......@@ -43,6 +49,12 @@ public class DmpOptLog implements Serializable{
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date optTime;
/**
* 操作功能模块
*/
@ApiModelProperty(value = "操作功能模块")
private String optModular;
/**
* 操作类型
*/
......@@ -79,6 +91,12 @@ public class DmpOptLog implements Serializable{
@ApiModelProperty(value = "IP地址")
private String optIp;
/**
*
*/
@ApiModelProperty(value = "")
private Integer projectId;
/**
* 备注
*/
......@@ -141,6 +159,14 @@ public class DmpOptLog implements Serializable{
this.userName = userName;
}
public String getUserRoles() {
return userRoles;
}
public void setUserRoles(String userRoles) {
this.userRoles = userRoles;
}
public Date getOptTime() {
return optTime;
}
......@@ -149,6 +175,14 @@ public class DmpOptLog implements Serializable{
this.optTime = optTime;
}
public String getOptModular() {
return optModular;
}
public void setOptModular(String optModular) {
this.optModular = optModular;
}
public String getOptType() {
return optType;
}
......@@ -197,6 +231,14 @@ public class DmpOptLog implements Serializable{
this.optIp = optIp;
}
public Integer getProjectId() {
return projectId;
}
public void setProjectId(Integer projectId) {
this.projectId = projectId;
}
public String getRemark() {
return remark;
}
......
......@@ -5,9 +5,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletRequest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -15,7 +13,6 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
......@@ -78,6 +75,10 @@ public class DmpOptLogServiceImpl extends BaseService implements DmpOptLogServic
if (dmpOptLogRequest.getOptTimeEnd() != null) {
param.put("optTimeEnd", dmpOptLogRequest.getOptTimeEnd());
}
//操作功能模块
if (!StringUtils.isEmpty(dmpOptLogRequest.getOptModular())) {
param.put("optModular", dmpOptLogRequest.getOptModular());
}
//操作类型
if (!StringUtils.isEmpty(dmpOptLogRequest.getOptType())) {
param.put("optType", dmpOptLogRequest.getOptType());
......@@ -187,6 +188,10 @@ public class DmpOptLogServiceImpl extends BaseService implements DmpOptLogServic
if (dmpOptLogRequest.getOptTimeEnd() != null) {
param.put("optTimeEnd", dmpOptLogRequest.getOptTimeEnd());
}
//操作功能模块
if (!StringUtils.isEmpty(dmpOptLogRequest.getOptModular())) {
param.put("optModular", dmpOptLogRequest.getOptModular());
}
//操作类型
if (!StringUtils.isEmpty(dmpOptLogRequest.getOptType())) {
param.put("optType", dmpOptLogRequest.getOptType());
......@@ -444,6 +449,10 @@ public class DmpOptLogServiceImpl extends BaseService implements DmpOptLogServic
if (dmpOptLogRequest.getOptTimeEnd() != null) {
param.put("optTimeEnd", dmpOptLogRequest.getOptTimeEnd());
}
//操作功能模块
if (!StringUtils.isEmpty(dmpOptLogRequest.getOptModular())) {
param.put("optModular", dmpOptLogRequest.getOptModular());
}
//操作类型
if (!StringUtils.isEmpty(dmpOptLogRequest.getOptType())) {
param.put("optType", dmpOptLogRequest.getOptType());
......@@ -542,6 +551,10 @@ public class DmpOptLogServiceImpl extends BaseService implements DmpOptLogServic
if (dmpOptLogRequest.getOptTimeEnd() != null) {
param.put("optTimeEnd", dmpOptLogRequest.getOptTimeEnd());
}
//操作功能模块
if (!StringUtils.isEmpty(dmpOptLogRequest.getOptModular())) {
param.put("optModular", dmpOptLogRequest.getOptModular());
}
//操作类型
if (!StringUtils.isEmpty(dmpOptLogRequest.getOptType())) {
param.put("optType", dmpOptLogRequest.getOptType());
......
......@@ -145,4 +145,15 @@ public interface DmpMemberService {
*/
public BaseResponse softDeleteByIds(List<Integer> idList, HttpServletRequest httpRequest)throws Exception;
/**
* @Title: getLoginUserInfo
* @Description: TODO(获取当前登录用户信息)
* @param @param httpRequest
* @param @return
* @param @throws Exception 参数
* @return BaseBeanResponse<DmpMemberDto> 返回类型
* @throws
*/
public BaseBeanResponse<DmpMemberDto> getLoginUserInfo(HttpServletRequest httpRequest)throws Exception;
}
......@@ -31,6 +31,7 @@ import com.jz.common.constant.ResultCode;
import com.jz.common.constant.StatuConstant;
import com.jz.common.persistence.BaseService;
import com.jz.common.utils.web.SessionUtils;
import com.jz.dmp.modules.controller.bean.MyDmpMemberConverter;
import com.jz.dmp.modules.controller.sys.bean.DmpMemberBatch;
import com.jz.dmp.modules.controller.sys.bean.DmpMemberDto;
import com.jz.dmp.modules.controller.sys.bean.DmpMemberRequest;
......@@ -543,5 +544,22 @@ public class DmpMemberServiceImpl extends BaseService implements DmpMemberServic
return baseResponse;
}
/**
*获取当前登录用户信息
*/
@Override
public BaseBeanResponse<DmpMemberDto> getLoginUserInfo(HttpServletRequest httpRequest) throws Exception {
BaseBeanResponse<DmpMemberDto> baseBeanResponse = new BaseBeanResponse<>();
DmpMember dmpMember = SessionUtils.getSecurityUser();
DmpMemberDto dmpMemberDto = MyDmpMemberConverter.INSTANCE().domain2dto(dmpMember);
baseBeanResponse.setCode(ResultCode.SUCCESS.val());
baseBeanResponse.setMessage("查询成功");
baseBeanResponse.setData(dmpMemberDto);
return baseBeanResponse;
}
}
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