记录操作日志,岗位优化
parent
3923dab45b
commit
278194a4a3
@ -0,0 +1,12 @@
|
||||
package com.api.organization.web;
|
||||
|
||||
import javax.ws.rs.Path;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2022/07/05
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Path("/bs/hrmorganization/log")
|
||||
public class LogViewController extends com.engine.organization.web.LogViewController{
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package com.engine.organization.entity.logview.param;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2022/07/05
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class LogViewSearchParam {
|
||||
private Long operatorId;
|
||||
private Long companyId;
|
||||
private Long departmentId;
|
||||
private String operateDate;
|
||||
private String operateModule;
|
||||
private String startDate;
|
||||
private String endDate;
|
||||
private String moduleType;
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
package com.engine.organization.entity.logview.vo;
|
||||
|
||||
import com.cloudstore.eccom.pc.table.WeaTableType;
|
||||
import com.engine.organization.annotation.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2022/07/05
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@OrganizationTable(pageId = "caef4d3e-fc3d-11ec-a203-00e04c680716",
|
||||
fields = "t.id, t.operator_name, t.create_time, t.operate_type, t.client_ip, t.operate_module_name",
|
||||
fromSql = "FROM hr_log t ",
|
||||
primarykey = "id",
|
||||
tableType = WeaTableType.NONE
|
||||
)
|
||||
public class LogViewVO {
|
||||
|
||||
@OrganizationTableColumn(text = "操作时间", width = "16%", column = "create_time", transmethod = "com.engine.organization.transmethod.StaffPlanTransMethod.getFormatDateString")
|
||||
private Date createTime;
|
||||
|
||||
@OrganizationTableColumn(text = "操作者", width = "16%", column = "operator_name")
|
||||
private String operator;
|
||||
|
||||
@OrganizationTableColumn(text = "操作类型", width = "16%", column = "operate_type", transmethod = "com.engine.organization.transmethod.LogViewTransMethod.getOperateType")
|
||||
private String operateType;
|
||||
|
||||
@OrganizationTableColumn(text = "所属模块", width = "16%", column = "operate_module_name")
|
||||
private String operateModuleName;
|
||||
|
||||
@OrganizationTableColumn(text = "操作IP", width = "16%", column = "client_ip")
|
||||
private String clientIp;
|
||||
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package com.engine.organization.service;
|
||||
|
||||
import com.engine.organization.entity.logview.param.LogViewSearchParam;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2022/07/05
|
||||
* @version: 1.0
|
||||
*/
|
||||
public interface LogViewService {
|
||||
/**
|
||||
* 日志列表
|
||||
*
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
Map<String, Object> listPage(LogViewSearchParam param);
|
||||
|
||||
Map<String, Object> getSearchCondition();
|
||||
}
|
@ -0,0 +1,133 @@
|
||||
package com.engine.organization.service;
|
||||
|
||||
import com.api.browser.bean.SearchConditionGroup;
|
||||
import com.api.browser.bean.SearchConditionItem;
|
||||
import com.api.browser.bean.SearchConditionOption;
|
||||
import com.cloudstore.eccom.result.WeaResultMsg;
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.organization.component.OrganizationWeaTable;
|
||||
import com.engine.organization.entity.logview.param.LogViewSearchParam;
|
||||
import com.engine.organization.entity.logview.vo.LogViewVO;
|
||||
import com.engine.organization.util.OrganizationFormItemUtil;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import weaver.general.TimeUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2022/07/05
|
||||
* @version: 1.0
|
||||
*/
|
||||
public class LogViewServiceImpl extends Service implements LogViewService {
|
||||
|
||||
@Override
|
||||
public Map<String, Object> listPage(LogViewSearchParam param) {
|
||||
Map<String, Object> resultMap = new HashMap<>();
|
||||
OrganizationWeaTable<LogViewVO> table = new OrganizationWeaTable<>(user, LogViewVO.class);
|
||||
String sqlWhere = buildSqlWhere(param);
|
||||
table.setSqlwhere(sqlWhere);
|
||||
WeaResultMsg result = new WeaResultMsg(false);
|
||||
result.putAll(table.makeDataResult());
|
||||
result.success();
|
||||
resultMap.putAll(result.getResultMap());
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getSearchCondition() {
|
||||
Map<String, Object> apiDatas = new HashMap<>();
|
||||
List<SearchConditionGroup> addGroups = new ArrayList<>();
|
||||
List<SearchConditionItem> conditionItems = new ArrayList<>();
|
||||
|
||||
// 操作者
|
||||
SearchConditionItem operatorId = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "操作者", "1", "operatorId", "");
|
||||
// 操作时间
|
||||
List<SearchConditionOption> selectOperateDate = new ArrayList<>();
|
||||
|
||||
selectOperateDate.add(new SearchConditionOption("-1", "全部"));
|
||||
selectOperateDate.add(new SearchConditionOption("1", "今天"));
|
||||
selectOperateDate.add(new SearchConditionOption("2", "本周"));
|
||||
selectOperateDate.add(new SearchConditionOption("3", "本月"));
|
||||
selectOperateDate.add(new SearchConditionOption("4", "本季"));
|
||||
selectOperateDate.add(new SearchConditionOption("5", "本年"));
|
||||
selectOperateDate.add(new SearchConditionOption("7", "上个月"));
|
||||
selectOperateDate.add(new SearchConditionOption("9", "上一季"));
|
||||
selectOperateDate.add(new SearchConditionOption("8", "上一年"));
|
||||
selectOperateDate.add(new SearchConditionOption("6", "指定日期范围"));
|
||||
|
||||
SearchConditionItem operateDate = OrganizationFormItemUtil.selectItem(user, selectOperateDate, 2, 16, 6, false, "操作时间", "operateDate");
|
||||
|
||||
// 操作者部门
|
||||
SearchConditionItem departmentId = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "操作者部门", "161", "departmentId", "deptBrowser");
|
||||
// 操作者分部
|
||||
SearchConditionItem companyId = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "操作者分部", "161", "companyId", "compBrowser");
|
||||
// 操作模块
|
||||
//List<SearchConditionOption> selectOperateModule = new ArrayList<>();
|
||||
//
|
||||
//selectOperateDate.add(new SearchConditionOption("-1", "全部"));
|
||||
//selectOperateDate.add(new SearchConditionOption("1", "等级方案"));
|
||||
//selectOperateDate.add(new SearchConditionOption("2", "职等"));
|
||||
//selectOperateDate.add(new SearchConditionOption("3", "职级"));
|
||||
//selectOperateDate.add(new SearchConditionOption("4", "岗位序列"));
|
||||
//selectOperateDate.add(new SearchConditionOption("5", "职务分类"));
|
||||
//selectOperateDate.add(new SearchConditionOption("6", "职务管理"));
|
||||
//selectOperateDate.add(new SearchConditionOption("7", "集团管理"));
|
||||
//selectOperateDate.add(new SearchConditionOption("8", "分部管理"));
|
||||
//selectOperateDate.add(new SearchConditionOption("9", "部门管理"));
|
||||
//selectOperateDate.add(new SearchConditionOption("10", "岗位管理"));
|
||||
//selectOperateDate.add(new SearchConditionOption("11", "人员管理"));
|
||||
//selectOperateDate.add(new SearchConditionOption("12", "编制方案"));
|
||||
//selectOperateDate.add(new SearchConditionOption("13", "编制上报"));
|
||||
//selectOperateDate.add(new SearchConditionOption("99", "其他模块"));
|
||||
//SearchConditionItem operateModule = OrganizationFormItemUtil.selectItem(user, selectOperateModule, 2, 16, 6, false, "操作模块", "operateModule");
|
||||
conditionItems.add(operatorId);
|
||||
conditionItems.add(operateDate);
|
||||
conditionItems.add(departmentId);
|
||||
conditionItems.add(companyId);
|
||||
//conditionItems.add(operateModule);
|
||||
|
||||
addGroups.add(new SearchConditionGroup("高级搜索条件", true, conditionItems));
|
||||
apiDatas.put("conditions", addGroups);
|
||||
return apiDatas;
|
||||
}
|
||||
|
||||
private String buildSqlWhere(LogViewSearchParam param) {
|
||||
if (null == param) {
|
||||
return "";
|
||||
}
|
||||
String sqlWhere = " where delete_type = 0 ";
|
||||
if(StringUtils.isNotBlank(param.getModuleType())){
|
||||
sqlWhere += " and operate_module = '" + param.getModuleType() + "'";
|
||||
}
|
||||
if (null != param.getOperatorId()) {
|
||||
sqlWhere += " and operator_id = '" + param.getOperatorId() + "'";
|
||||
}
|
||||
if (null != param.getCompanyId()) {
|
||||
sqlWhere += " and operator_id in (select id from hrmresource where subcompanyid1 = '" + param.getCompanyId() + "')";
|
||||
}
|
||||
if (null != param.getDepartmentId()) {
|
||||
sqlWhere += " and operator_id in (select id from hrmresource where departmentid = '" + param.getDepartmentId() + "')";
|
||||
}
|
||||
if (StringUtils.isNotBlank(param.getOperateDate()) && !"-1".equals(param.getOperateDate())) {
|
||||
if (!"6".equals(param.getOperateDate())) {
|
||||
sqlWhere += " and create_time >= '" + TimeUtil.getDateByOption(param.getOperateDate() + "", "0") + "'";
|
||||
sqlWhere += " and create_time <= '" + TimeUtil.getDateByOption(param.getOperateDate() + "", "") + "'";
|
||||
} else {
|
||||
if (StringUtils.isNotBlank(param.getStartDate())) {
|
||||
sqlWhere += " and create_time >= '" + param.getStartDate() + "'";
|
||||
}
|
||||
if (StringUtils.isNotBlank(param.getEndDate())) {
|
||||
sqlWhere += " and create_time <= '" + param.getEndDate() + "'";
|
||||
}
|
||||
}
|
||||
}
|
||||
//if (StringUtils.isNotBlank(param.getOperateModule()) && !"-1".equals(param.getOperateModule())) {
|
||||
// sqlWhere += " and operate_module = '" + param.getOperateModule() + "'";
|
||||
//}
|
||||
return sqlWhere;
|
||||
}
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
package com.engine.organization.transmethod;
|
||||
|
||||
import com.engine.organization.enums.OperateTypeEnum;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2022/07/05
|
||||
* @version: 1.0
|
||||
*/
|
||||
public class LogViewTransMethod {
|
||||
|
||||
public String getOperateType(String operateType) {
|
||||
if (StringUtils.isNotBlank(operateType)) {
|
||||
switch (operateType) {
|
||||
case "1":
|
||||
operateType = OperateTypeEnum.ADD.getLabel();
|
||||
break;
|
||||
case "2":
|
||||
operateType = OperateTypeEnum.UPDATE.getLabel();
|
||||
break;
|
||||
case "3":
|
||||
operateType = OperateTypeEnum.DELETE.getLabel();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
package com.engine.organization.web;
|
||||
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.organization.entity.logview.param.LogViewSearchParam;
|
||||
import com.engine.organization.util.response.ReturnResult;
|
||||
import com.engine.organization.wrapper.LogViewWrapper;
|
||||
import io.swagger.v3.oas.annotations.parameters.RequestBody;
|
||||
import weaver.hrm.HrmUserVarify;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.core.Context;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2022/07/05
|
||||
* @version: 1.0
|
||||
*/
|
||||
public class LogViewController {
|
||||
public LogViewWrapper getLogViewWrapper(User user) {
|
||||
return ServiceUtil.getService(LogViewWrapper.class, user);
|
||||
}
|
||||
|
||||
|
||||
@GET
|
||||
@Path("/listPage")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public ReturnResult listPage(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody LogViewSearchParam params) {
|
||||
try {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return ReturnResult.successed(getLogViewWrapper(user).listPage(params));
|
||||
} catch (Exception e) {
|
||||
return ReturnResult.exceptionHandle(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@GET
|
||||
@Path("/getSearchCondition")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public ReturnResult getSearchCondition(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
try {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return ReturnResult.successed(getLogViewWrapper(user).getSearchCondition());
|
||||
} catch (Exception e) {
|
||||
return ReturnResult.exceptionHandle(e);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
package com.engine.organization.wrapper;
|
||||
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.organization.entity.logview.param.LogViewSearchParam;
|
||||
import com.engine.organization.service.LogViewService;
|
||||
import com.engine.organization.service.LogViewServiceImpl;
|
||||
import com.engine.organization.util.OrganizationWrapper;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2022/07/05
|
||||
* @version: 1.0
|
||||
*/
|
||||
public class LogViewWrapper extends OrganizationWrapper {
|
||||
private LogViewService getLogViewService(User user) {
|
||||
return ServiceUtil.getService(LogViewServiceImpl.class, user);
|
||||
}
|
||||
|
||||
public Map<String, Object> listPage(LogViewSearchParam params) {
|
||||
return getLogViewService(user).listPage(params);
|
||||
}
|
||||
|
||||
public Map<String, Object> getSearchCondition() {
|
||||
return getLogViewService(user).getSearchCondition();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue