diff --git a/src/com/engine/organization/entity/staff/bo/StaffPlanBO.java b/src/com/engine/organization/entity/staff/bo/StaffPlanBO.java index 83efcb56..b8acb6f1 100644 --- a/src/com/engine/organization/entity/staff/bo/StaffPlanBO.java +++ b/src/com/engine/organization/entity/staff/bo/StaffPlanBO.java @@ -2,6 +2,8 @@ package com.engine.organization.entity.staff.bo; import com.engine.organization.entity.staff.param.StaffPlanSearchParam; import com.engine.organization.entity.staff.po.StaffPlanPO; +import weaver.common.DateUtil; +import weaver.general.StringUtil; import java.util.Date; @@ -21,15 +23,17 @@ public class StaffPlanBO { .planNo(param.getPlanNo()) .planName(param.getPlanName()) .planYear(param.getPlanYear()) - .timeStart(param.getTimeStart()) - .timeEnd(param.getTimeEnd()) + .timeStart(StringUtil.isEmpty(param.getTimeStart()) ? null : DateUtil.parseToDateTime(param.getTimeStart())) + .timeEnd(StringUtil.isEmpty(param.getTimeEnd()) ? null : DateUtil.parseToDateTime(param.getTimeEnd())) .companyId(param.getCompanyId()) .description(param.getDescription()) - .forbiddenTag(param.getForbiddenTag() == null ? 0 : param.getForbiddenTag() ? 0 : 1) + .forbiddenTag(param.getForbiddenTag() == null ? null : param.getForbiddenTag() ? 0 : 1) .deleteType(0) .createTime(new Date()) .updateTime(new Date()) .creator(employeeId) .build(); } + + } diff --git a/src/com/engine/organization/entity/staff/param/StaffPlanSearchParam.java b/src/com/engine/organization/entity/staff/param/StaffPlanSearchParam.java index fd55a60e..3e40f0ea 100644 --- a/src/com/engine/organization/entity/staff/param/StaffPlanSearchParam.java +++ b/src/com/engine/organization/entity/staff/param/StaffPlanSearchParam.java @@ -5,8 +5,6 @@ import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; -import java.util.Date; - /** * @description: TODO * @author:dxfeng @@ -37,11 +35,11 @@ public class StaffPlanSearchParam { /** * 时间开始 */ - private Date timeStart; + private String timeStart; /** * 时间结束 */ - private Date timeEnd; + private String timeEnd; /** * 适用公司 */ diff --git a/src/com/engine/organization/service/impl/CompServiceImpl.java b/src/com/engine/organization/service/impl/CompServiceImpl.java index 4a6e6c37..3631dbe7 100644 --- a/src/com/engine/organization/service/impl/CompServiceImpl.java +++ b/src/com/engine/organization/service/impl/CompServiceImpl.java @@ -22,6 +22,7 @@ import com.engine.organization.mapper.comp.CompMapper; import com.engine.organization.mapper.extend.ExtendGroupMapper; import com.engine.organization.service.CompService; import com.engine.organization.service.ExtService; +import com.engine.organization.util.HasRightUtil; import com.engine.organization.util.MenuBtn; import com.engine.organization.util.OrganizationAssert; import com.engine.organization.util.OrganizationFormItemUtil; @@ -33,7 +34,6 @@ import com.engine.organization.util.page.PageUtil; import weaver.crm.Maint.SectorInfoComInfo; import weaver.general.StringUtil; import weaver.general.Util; -import weaver.hrm.HrmUserVarify; import weaver.hrm.User; import weaver.hrm.resource.ResourceComInfo; @@ -63,6 +63,8 @@ public class CompServiceImpl extends Service implements CompService { */ private static final String JCL_ORG_COMPEXT_DT1 = "JCL_ORG_COMPEXT_DT1"; + private static final String RIGHT_NAME = "Company:All"; + private CompMapper getCompMapper() { return MapperProxyFactory.getProxy(CompMapper.class); } @@ -79,9 +81,9 @@ public class CompServiceImpl extends Service implements CompService { @Override public Map listPage(CompSearchParam params) { Map datas = new HashMap<>(); - - datas.put("hasRight", hasRight()); - if (!hasRight()) { + boolean hasRight = HasRightUtil.hasRight(user, RIGHT_NAME, true); + datas.put("hasRight", hasRight); + if (!hasRight) { return datas; } CompPO compPO = CompBO.convertParamToPO(params, (long) user.getUID()); @@ -125,7 +127,7 @@ public class CompServiceImpl extends Service implements CompService { @Override public int saveBaseComp(CompSearchParam params) { - OrganizationAssert.isTrue(hasRight(), "暂无权限"); + HasRightUtil.hasRight(user, RIGHT_NAME, false); // 自动编号 params.setCompNo(CodeRuleUtil.generateCode(RuleCodeType.SUBCOMPANY, params.getCompNo())); List list = getCompMapper().listByNo(Util.null2String(params.getCompNo())); @@ -136,14 +138,14 @@ public class CompServiceImpl extends Service implements CompService { @Override public int updateForbiddenTagById(CompSearchParam params) { - OrganizationAssert.isTrue(hasRight(), "暂无权限"); + HasRightUtil.hasRight(user, RIGHT_NAME, false); CompPO compPO = CompPO.builder().id(params.getId()).forbiddenTag(params.getForbiddenTag() ? 0 : 1).build(); return getCompMapper().updateForbiddenTagById(compPO); } @Override public int updateComp(Map params) { - OrganizationAssert.isTrue(hasRight(), "暂无权限"); + HasRightUtil.hasRight(user, RIGHT_NAME, false); CompSearchParam searchParam = JSONObject.parseObject(JSONObject.toJSONString(params), CompSearchParam.class); String groupId = (String) params.get("viewCondition"); CompPO compPO = CompBO.convertParamToPO(searchParam, (long) user.getUID()); @@ -160,14 +162,14 @@ public class CompServiceImpl extends Service implements CompService { @Override public int deleteByIds(Collection ids) { - OrganizationAssert.isTrue(hasRight(), "暂无权限"); + HasRightUtil.hasRight(user, RIGHT_NAME, false); OrganizationAssert.notEmpty(ids, "请选择要删除的数据"); return getCompMapper().deleteByIds(ids); } @Override public Map getSearchCondition(Map params) { - OrganizationAssert.isTrue(hasRight(), "暂无权限"); + HasRightUtil.hasRight(user, RIGHT_NAME, false); Map apiDatas = new HashMap<>(); List addGroups = new ArrayList<>(); List conditionItems = new ArrayList<>(); @@ -210,13 +212,13 @@ public class CompServiceImpl extends Service implements CompService { @Override public Map getHasRight() { - OrganizationAssert.isTrue(hasRight(), "暂无权限"); + HasRightUtil.hasRight(user, RIGHT_NAME, false); return MenuBtn.getDatasNoBtnColum(); } @Override public Map getCompBaseForm(Map params) { - OrganizationAssert.isTrue(hasRight(), "暂无权限"); + HasRightUtil.hasRight(user, RIGHT_NAME, false); OrganizationAssert.notNull(params.get("viewAttr"), "请标识操作类型"); // 2编辑 1查看 int viewAttr = Integer.parseInt((String) params.get("viewAttr")); @@ -252,7 +254,7 @@ public class CompServiceImpl extends Service implements CompService { @Override public Map getCompSaveForm() { - OrganizationAssert.isTrue(hasRight(), "暂无权限"); + HasRightUtil.hasRight(user, RIGHT_NAME, false); Map apiDatas = new HashMap<>(); List addGroups = new ArrayList<>(); List conditionItems = new ArrayList<>(); @@ -398,14 +400,5 @@ public class CompServiceImpl extends Service implements CompService { return conditionItems; } - /** - * 是否有该模块权限 - * - * @return - */ - private boolean hasRight() { - return HrmUserVarify.checkUserRight("Company:All", user); - } - } diff --git a/src/com/engine/organization/service/impl/DepartmentServiceImpl.java b/src/com/engine/organization/service/impl/DepartmentServiceImpl.java index e611b919..908b9d43 100644 --- a/src/com/engine/organization/service/impl/DepartmentServiceImpl.java +++ b/src/com/engine/organization/service/impl/DepartmentServiceImpl.java @@ -31,6 +31,7 @@ import com.engine.organization.mapper.extend.ExtendGroupMapper; import com.engine.organization.mapper.job.JobMapper; import com.engine.organization.service.DepartmentService; import com.engine.organization.service.ExtService; +import com.engine.organization.util.HasRightUtil; import com.engine.organization.util.MenuBtn; import com.engine.organization.util.OrganizationAssert; import com.engine.organization.util.OrganizationFormItemUtil; @@ -43,7 +44,6 @@ import com.engine.organization.util.tree.SearchTreeUtil; import org.apache.commons.collections4.CollectionUtils; import weaver.general.StringUtil; import weaver.general.Util; -import weaver.hrm.HrmUserVarify; import weaver.hrm.User; import java.util.*; @@ -73,6 +73,8 @@ public class DepartmentServiceImpl extends Service implements DepartmentService */ private static final String JCL_ORG_DEPTEXT_DT1 = "JCL_ORG_DEPTEXT_DT1"; + private static final String RIGHT_NAME = "Department:All"; + private DepartmentMapper getDepartmentMapper() { return MapperProxyFactory.getProxy(DepartmentMapper.class); @@ -93,7 +95,7 @@ public class DepartmentServiceImpl extends Service implements DepartmentService @Override public PageInfo getDeptListByPid(QuerySingleDeptListParam param) { - OrganizationAssert.isTrue(hasRight(), "暂无权限"); + HasRightUtil.hasRight(user, RIGHT_NAME, false); //1.查询分部下所有部门 //PageUtil.start(param.getCurrent(), param.getPageSize()); List departmentPOS = MapperProxyFactory.getProxy(DepartmentMapper.class).list(); @@ -109,7 +111,7 @@ public class DepartmentServiceImpl extends Service implements DepartmentService @Override public PageInfo getJobListByPid(QuerySingleDeptListParam param) { - OrganizationAssert.isTrue(hasRight(), "暂无权限"); + HasRightUtil.hasRight(user, RIGHT_NAME, false); List jobPOS = MapperProxyFactory.getProxy(JobMapper.class).listAll(); PageInfo pageInfo = new PageInfo<>(jobPOS); List singleDeptTreeVOS = JobBO.buildSingleJobTreeVOS(jobPOS, param.getParentDept()); @@ -123,7 +125,7 @@ public class DepartmentServiceImpl extends Service implements DepartmentService @Override public Map getSearchTree(SearchTreeParams params) { - OrganizationAssert.isTrue(hasRight(), "暂无权限"); + HasRightUtil.hasRight(user, RIGHT_NAME, false); String keyword = params.getKeyword(); String id = params.getId(); String type = Util.null2String(params.getType()); @@ -134,8 +136,9 @@ public class DepartmentServiceImpl extends Service implements DepartmentService @Override public Map listPage(DeptSearchParam param) { Map datas = new HashMap<>(); - datas.put("hasRight", hasRight()); - if (!hasRight()) { + boolean hasRight = HasRightUtil.hasRight(user, RIGHT_NAME, true); + datas.put("hasRight", hasRight); + if (!hasRight) { return datas; } DepartmentPO departmentPO = DepartmentBO.convertParamsToPO(param, user.getUID()); @@ -179,7 +182,7 @@ public class DepartmentServiceImpl extends Service implements DepartmentService @Override public int saveBaseForm(DeptSearchParam params) { - OrganizationAssert.isTrue(hasRight(), "暂无权限"); + HasRightUtil.hasRight(user, RIGHT_NAME, false); // 自动编号 params.setDeptNo(CodeRuleUtil.generateCode(RuleCodeType.DEPARTMENT, params.getDeptNo())); List list = getDepartmentMapper().listByNo(Util.null2String(params.getDeptNo())); @@ -190,14 +193,14 @@ public class DepartmentServiceImpl extends Service implements DepartmentService @Override public int updateForbiddenTagById(DeptSearchParam params) { - OrganizationAssert.isTrue(hasRight(), "暂无权限"); + HasRightUtil.hasRight(user, RIGHT_NAME, false); DepartmentPO departmentPO = DepartmentPO.builder().id(params.getId()).forbiddenTag(params.getForbiddenTag() ? 0 : 1).build(); return getDepartmentMapper().updateForbiddenTagById(departmentPO); } @Override public int updateForm(Map params) { - OrganizationAssert.isTrue(hasRight(), "暂无权限"); + HasRightUtil.hasRight(user, RIGHT_NAME, false); DeptSearchParam searchParam = JSONObject.parseObject(JSONObject.toJSONString(params), DeptSearchParam.class); String groupId = (String) params.get("viewCondition"); DepartmentPO departmentPO = DepartmentBO.convertParamsToPO(searchParam, user.getUID()); @@ -214,14 +217,14 @@ public class DepartmentServiceImpl extends Service implements DepartmentService @Override public int deleteByIds(Collection ids) { - OrganizationAssert.isTrue(hasRight(), "暂无权限"); + HasRightUtil.hasRight(user, RIGHT_NAME, false); OrganizationAssert.notEmpty(ids, "请选择要删除的数据"); return getDepartmentMapper().deleteByIds(ids); } @Override public Map getSearchCondition(Map params) { - OrganizationAssert.isTrue(hasRight(), "暂无权限"); + HasRightUtil.hasRight(user, RIGHT_NAME, false); Map apiDatas = new HashMap<>(); List addGroups = new ArrayList<>(); List conditionItems = new ArrayList<>(); @@ -263,13 +266,13 @@ public class DepartmentServiceImpl extends Service implements DepartmentService @Override public Map getHasRight() { - OrganizationAssert.isTrue(hasRight(), "暂无权限"); + HasRightUtil.hasRight(user, RIGHT_NAME, false); return MenuBtn.getDatasHasCopy(); } @Override public Map getDeptBaseForm(Map params) { - OrganizationAssert.isTrue(hasRight(), "暂无权限"); + HasRightUtil.hasRight(user, RIGHT_NAME, false); OrganizationAssert.notNull(params.get("viewAttr"), "请标识操作类型"); // 2编辑 1查看 @@ -305,7 +308,7 @@ public class DepartmentServiceImpl extends Service implements DepartmentService @Override public Map getSaveForm() { - OrganizationAssert.isTrue(hasRight(), "暂无权限"); + HasRightUtil.hasRight(user, RIGHT_NAME, false); Map apiDatas = new HashMap<>(); List addGroups = new ArrayList<>(); List conditionItems = new ArrayList<>(); @@ -358,7 +361,7 @@ public class DepartmentServiceImpl extends Service implements DepartmentService */ @Override public List getCopyForm() { - OrganizationAssert.isTrue(hasRight(), "暂无权限"); + HasRightUtil.hasRight(user, RIGHT_NAME, false); List addGroups = new ArrayList<>(); List condition = new ArrayList<>(); SearchConditionItem compBrowserItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 3, false, "复制到", "161", "company", "compBrowser"); @@ -382,7 +385,7 @@ public class DepartmentServiceImpl extends Service implements DepartmentService */ @Override public int copyDepartment(DeptCopyParam copyParam) { - OrganizationAssert.isTrue(hasRight(), "暂无权限"); + HasRightUtil.hasRight(user, RIGHT_NAME, false); OrganizationAssert.notBlank(copyParam.getCompany(), "请指定需要复制的公司/分部"); int insertCount = 0; List idList = Arrays.stream(copyParam.getIds().split(",")).map(Long::parseLong).collect(Collectors.toList()); @@ -410,7 +413,7 @@ public class DepartmentServiceImpl extends Service implements DepartmentService @Override public List getMergeForm(Long id) { - OrganizationAssert.isTrue(hasRight(), "暂无权限"); + HasRightUtil.hasRight(user, RIGHT_NAME, false); List addGroups = new ArrayList<>(); List condition = new ArrayList<>(); SearchConditionItem deptBrowserItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 3, false, "合并到部门", "161", "department", "deptBrowser"); @@ -428,7 +431,7 @@ public class DepartmentServiceImpl extends Service implements DepartmentService @Override public int mergeDepartment(DepartmentMergeParam mergeParam) { - OrganizationAssert.isTrue(hasRight(), "暂无权限"); + HasRightUtil.hasRight(user, RIGHT_NAME, false); int updateCount = 0; OrganizationAssert.isFalse(mergeParam.getId().equals(mergeParam.getDepartment()), "所选部门与待合并部门一致,无需操作"); OrganizationAssert.notNull(mergeParam.getDepartment(), "请选择需要合并的部门"); @@ -450,7 +453,7 @@ public class DepartmentServiceImpl extends Service implements DepartmentService @Override public List getMoveForm() { - OrganizationAssert.isTrue(hasRight(), "暂无权限"); + HasRightUtil.hasRight(user, RIGHT_NAME, false); List addGroups = new ArrayList<>(); List condition = new ArrayList<>(); SearchConditionItem compBrowserItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "请选择公司/分部", "161", "company", "compBrowser"); @@ -475,7 +478,7 @@ public class DepartmentServiceImpl extends Service implements DepartmentService @Override public int moveDepartment(DepartmentMoveParam moveParam) { - OrganizationAssert.isTrue(hasRight(), "暂无权限"); + HasRightUtil.hasRight(user, RIGHT_NAME, false); OrganizationAssert.notBlank(moveParam.getMoveType(), "请选择转移类型"); DepartmentPO deptById = getDepartmentMapper().getDeptById(moveParam.getId()); // 0:公司/分部 1:部门 @@ -653,12 +656,4 @@ public class DepartmentServiceImpl extends Service implements DepartmentService } } - /** - * 是否有该模块权限 - * - * @return - */ - private boolean hasRight() { - return HrmUserVarify.checkUserRight("Department:All", user); - } } diff --git a/src/com/engine/organization/service/impl/GradeServiceImpl.java b/src/com/engine/organization/service/impl/GradeServiceImpl.java index 21cdc09d..bc4d9a69 100644 --- a/src/com/engine/organization/service/impl/GradeServiceImpl.java +++ b/src/com/engine/organization/service/impl/GradeServiceImpl.java @@ -16,17 +16,13 @@ import com.engine.organization.mapper.scheme.GradeMapper; import com.engine.organization.mapper.scheme.LevelMapper; import com.engine.organization.mapper.scheme.SchemeMapper; import com.engine.organization.service.GradeService; -import com.engine.organization.util.MenuBtn; -import com.engine.organization.util.OrganizationAssert; -import com.engine.organization.util.OrganizationFormItemUtil; -import com.engine.organization.util.RefreshIsUsedUtil; +import com.engine.organization.util.*; import com.engine.organization.util.db.DBType; import com.engine.organization.util.db.MapperProxyFactory; import org.apache.commons.lang3.StringUtils; import weaver.conn.RecordSet; import weaver.general.StringUtil; import weaver.general.Util; -import weaver.hrm.HrmUserVarify; import java.util.*; @@ -39,6 +35,8 @@ import java.util.*; */ public class GradeServiceImpl extends Service implements GradeService { + private static final String RIGHT_NAME = "Grade:All"; + private GradeMapper getGradeMapper() { return MapperProxyFactory.getProxy(GradeMapper.class); } @@ -55,8 +53,9 @@ public class GradeServiceImpl extends Service implements GradeService { public Map listPage(Map params) { // 刷新引用状态 Map resultMap = new HashMap<>(); - resultMap.put("hasRight", hasRight()); - if (!hasRight()) { + boolean hasRight = HasRightUtil.hasRight(user, RIGHT_NAME, true); + resultMap.put("hasRight", hasRight); + if (!hasRight) { return resultMap; } RefreshIsUsedUtil.RefreshGrade("jcl_org_grade"); @@ -73,7 +72,7 @@ public class GradeServiceImpl extends Service implements GradeService { @Override public int saveGrade(GradeSearchParam param) { - OrganizationAssert.isTrue(hasRight(), "暂无权限"); + HasRightUtil.hasRight(user, RIGHT_NAME, false); List list = getGradeMapper().listByNo(Util.null2String(param.getGradeNo())); OrganizationAssert.isEmpty(list, "编号不允许重复"); GradePO gradePO = GradeDTO.convertParamToPO(param, (long) user.getUID()); @@ -82,21 +81,21 @@ public class GradeServiceImpl extends Service implements GradeService { @Override public int updateGrade(GradeSearchParam param) { - OrganizationAssert.isTrue(hasRight(), "暂无权限"); + HasRightUtil.hasRight(user, RIGHT_NAME, false); GradePO gradePO = GradeDTO.convertParamToPO(param, (long) user.getUID()); return getGradeMapper().updateGrade(gradePO); } @Override public int updateForbiddenTagById(GradeSearchParam params) { - OrganizationAssert.isTrue(hasRight(), "暂无权限"); + HasRightUtil.hasRight(user, RIGHT_NAME, false); GradePO gradePO = GradePO.builder().id(params.getId()).forbiddenTag(params.getForbiddenTag() ? 0 : 1).build(); return getGradeMapper().updateForbiddenTagById(gradePO); } @Override public int deleteByIds(Collection ids) { - OrganizationAssert.isTrue(hasRight(), "暂无权限"); + HasRightUtil.hasRight(user, RIGHT_NAME, false); OrganizationAssert.notEmpty(ids, "请选择要删除的数据"); return getGradeMapper().deleteByIds(ids); } @@ -104,7 +103,7 @@ public class GradeServiceImpl extends Service implements GradeService { @Override public Map getSearchCondition(Map params) { - OrganizationAssert.isTrue(hasRight(), "暂无权限"); + HasRightUtil.hasRight(user, RIGHT_NAME, false); Map apiDatas = new HashMap<>(); List addGroups = new ArrayList<>(); List conditionItems = new ArrayList<>(); @@ -120,7 +119,7 @@ public class GradeServiceImpl extends Service implements GradeService { @Override public Map getGradeForm(Map params) { - OrganizationAssert.isTrue(hasRight(), "暂无权限"); + HasRightUtil.hasRight(user, RIGHT_NAME, false); Map apiDatas = new HashMap<>(); List selectItems = new ArrayList<>(); List addGroups = new ArrayList<>(); @@ -172,13 +171,13 @@ public class GradeServiceImpl extends Service implements GradeService { @Override public Map getHasRight() { - OrganizationAssert.isTrue(hasRight(), "暂无权限"); + HasRightUtil.hasRight(user, RIGHT_NAME, false); return MenuBtn.getCommonBtnDatas(); } @Override public Map getTabInfo() { - OrganizationAssert.isTrue(hasRight(), "暂无权限"); + HasRightUtil.hasRight(user, RIGHT_NAME, false); Map apiDatas = new HashMap<>(); List topTabs = new ArrayList<>(); topTabs.add(TopTab.builder().color("#000000").groupId("flowAll").showcount(true).title("全部").viewCondition("-1").build()); @@ -220,12 +219,4 @@ public class GradeServiceImpl extends Service implements GradeService { return sqlWhere; } - /** - * 是否有该模块权限 - * - * @return - */ - private boolean hasRight() { - return HrmUserVarify.checkUserRight("Grade:All", user); - } } diff --git a/src/com/engine/organization/service/impl/GroupServiceImpl.java b/src/com/engine/organization/service/impl/GroupServiceImpl.java index e2a51b86..c34d97ce 100644 --- a/src/com/engine/organization/service/impl/GroupServiceImpl.java +++ b/src/com/engine/organization/service/impl/GroupServiceImpl.java @@ -5,13 +5,13 @@ import com.api.browser.bean.SearchConditionItem; import com.engine.core.impl.Service; import com.engine.organization.entity.TopTab; import com.engine.organization.service.GroupService; +import com.engine.organization.util.HasRightUtil; import com.engine.organization.util.MenuBtn; import com.engine.organization.util.OrganizationAssert; import com.engine.organization.util.OrganizationFormItemUtil; import weaver.conn.RecordSet; import weaver.general.StringUtil; import weaver.general.Util; -import weaver.hrm.HrmUserVarify; import java.util.ArrayList; import java.util.HashMap; @@ -25,9 +25,11 @@ import java.util.Map; * @version: 1.0 */ public class GroupServiceImpl extends Service implements GroupService { + private static final String RIGHT_NAME = "Group:All"; + @Override public Map getGroupFormField(Map params) { - OrganizationAssert.isTrue(hasRight(), "暂无权限"); + HasRightUtil.hasRight(user, RIGHT_NAME, false); Map apiDatas = new HashMap<>(); List selectItems = new ArrayList<>(); List addGroups = new ArrayList<>(); @@ -74,7 +76,7 @@ public class GroupServiceImpl extends Service implements GroupService { @Override public boolean updateGroup(Map params) { - OrganizationAssert.isTrue(hasRight(), "暂无权限"); + HasRightUtil.hasRight(user, RIGHT_NAME, false); String id = Util.null2String(params.get("id")); OrganizationAssert.notNull(id, "数据有误"); String companyname = (String) params.get("companyname"); @@ -87,7 +89,7 @@ public class GroupServiceImpl extends Service implements GroupService { @Override public Map getHasRight() { - OrganizationAssert.isTrue(hasRight(), "暂无权限"); + HasRightUtil.hasRight(user, RIGHT_NAME, false); Map btnDatas = new HashMap<>(); ArrayList topMenuList = new ArrayList<>(); ArrayList rightMenuList = new ArrayList<>(); @@ -102,21 +104,12 @@ public class GroupServiceImpl extends Service implements GroupService { @Override public Map getTabInfo() { - OrganizationAssert.isTrue(hasRight(), "暂无权限"); + HasRightUtil.hasRight(user, RIGHT_NAME, false); Map apiDatas = new HashMap<>(); List topTabs = new ArrayList<>(); topTabs.add(TopTab.builder().title("总部信息").viewCondition("1").build()); apiDatas.put("topTabs", topTabs); - return apiDatas; } - /** - * 是否有该模块权限 - * - * @return - */ - private boolean hasRight() { - return HrmUserVarify.checkUserRight("Group:All", user); - } } diff --git a/src/com/engine/organization/service/impl/JobServiceImpl.java b/src/com/engine/organization/service/impl/JobServiceImpl.java index 8b024799..0c61cb8d 100644 --- a/src/com/engine/organization/service/impl/JobServiceImpl.java +++ b/src/com/engine/organization/service/impl/JobServiceImpl.java @@ -40,6 +40,7 @@ import com.engine.organization.mapper.scheme.SchemeMapper; import com.engine.organization.mapper.sequence.SequenceMapper; import com.engine.organization.service.ExtService; import com.engine.organization.service.JobService; +import com.engine.organization.util.HasRightUtil; import com.engine.organization.util.MenuBtn; import com.engine.organization.util.OrganizationAssert; import com.engine.organization.util.OrganizationFormItemUtil; @@ -52,7 +53,6 @@ import com.engine.organization.util.tree.SearchTreeUtil; import org.apache.commons.collections4.CollectionUtils; import weaver.general.StringUtil; import weaver.general.Util; -import weaver.hrm.HrmUserVarify; import weaver.hrm.User; import java.util.*; @@ -92,6 +92,8 @@ public class JobServiceImpl extends Service implements JobService { */ private static final String JCL_ORG_JOBEXT_DT1 = "JCL_ORG_JOBEXT_DT1"; + private static final String RIGHT_NAME = "Job:All"; + private JobMapper getJobMapper() { return MapperProxyFactory.getProxy(JobMapper.class); } @@ -127,7 +129,7 @@ public class JobServiceImpl extends Service implements JobService { @Override public Map getSearchTree(SearchTreeParams params) { - OrganizationAssert.isTrue(hasRight(), "暂无权限"); + HasRightUtil.hasRight(user, RIGHT_NAME, false); String keyword = params.getKeyword(); String id = params.getId(); String type = Util.null2String(params.getType()); @@ -138,8 +140,9 @@ public class JobServiceImpl extends Service implements JobService { @Override public Map listPage(JobSearchParam param) { Map datas = new HashMap<>(); - datas.put("hasRight", hasRight()); - if (!hasRight()) { + boolean hasRight = HasRightUtil.hasRight(user, RIGHT_NAME, true); + datas.put("hasRight", hasRight); + if (!hasRight) { return datas; } JobPO jobPO = JobBO.convertParamsToPO(param, user.getUID()); @@ -183,13 +186,13 @@ public class JobServiceImpl extends Service implements JobService { @Override public Map getHasRight() { - OrganizationAssert.isTrue(hasRight(), "暂无权限"); + HasRightUtil.hasRight(user, RIGHT_NAME, false); return MenuBtn.getDatasHasCopy(); } @Override public Map getSearchCondition() { - OrganizationAssert.isTrue(hasRight(), "暂无权限"); + HasRightUtil.hasRight(user, RIGHT_NAME, false); Map apiDatas = new HashMap<>(); List addGroups = new ArrayList<>(); List conditionItems = new ArrayList<>(); @@ -251,7 +254,7 @@ public class JobServiceImpl extends Service implements JobService { @Override public Map getSaveForm() { - OrganizationAssert.isTrue(hasRight(), "暂无权限"); + HasRightUtil.hasRight(user, RIGHT_NAME, false); Map apiDatas = new HashMap<>(); List addGroups = new ArrayList<>(); List conditionItems = new ArrayList<>(); @@ -302,7 +305,7 @@ public class JobServiceImpl extends Service implements JobService { @Override public Map getJobBaseForm(Map params) { - OrganizationAssert.isTrue(hasRight(), "暂无权限"); + HasRightUtil.hasRight(user, RIGHT_NAME, false); OrganizationAssert.notNull(params.get("viewAttr"), "请标识操作类型"); // 2编辑 1查看 @@ -358,7 +361,7 @@ public class JobServiceImpl extends Service implements JobService { @Override public int saveBaseForm(JobSearchParam params) { - OrganizationAssert.isTrue(hasRight(), "暂无权限"); + HasRightUtil.hasRight(user, RIGHT_NAME, false); // 处理自动编号 params.setJobNo(CodeRuleUtil.generateCode(RuleCodeType.JOBTITLES, params.getJobNo())); List list = getJobMapper().listByNo(Util.null2String(params.getJobNo())); @@ -381,7 +384,7 @@ public class JobServiceImpl extends Service implements JobService { @Override public int updateForm(Map params) { - OrganizationAssert.isTrue(hasRight(), "暂无权限"); + HasRightUtil.hasRight(user, RIGHT_NAME, false); JobSearchParam searchParam = JSONObject.parseObject(JSONObject.toJSONString(params), JobSearchParam.class); String groupId = (String) params.get("viewCondition"); JobPO jobPO = JobBO.convertParamsToPO(searchParam, user.getUID()); @@ -407,7 +410,7 @@ public class JobServiceImpl extends Service implements JobService { @Override public int copyJobItem(String ids, String department) { - OrganizationAssert.isTrue(hasRight(), "暂无权限"); + HasRightUtil.hasRight(user, RIGHT_NAME, false); OrganizationAssert.notBlank(department, "请指定需要复制的部门"); int insertCount = 0; List idList = Arrays.stream(ids.split(",")).map(Long::parseLong).collect(Collectors.toList()); @@ -424,14 +427,14 @@ public class JobServiceImpl extends Service implements JobService { @Override public int updateForbiddenTagById(JobSearchParam params) { - OrganizationAssert.isTrue(hasRight(), "暂无权限"); + HasRightUtil.hasRight(user, RIGHT_NAME, false); JobPO jobPO = JobPO.builder().id(params.getId()).forbiddenTag(params.getForbiddenTag() ? 0 : 1).build(); return getJobMapper().updateForbiddenTagById(jobPO.getId(), jobPO.getForbiddenTag()); } @Override public int deleteByIds(Collection ids) { - OrganizationAssert.isTrue(hasRight(), "暂无权限"); + HasRightUtil.hasRight(user, RIGHT_NAME, false); OrganizationAssert.notEmpty(ids, "请选择要删除的数据"); Collection deleteIds = new ArrayList<>(); // 递归删除子节点 @@ -441,7 +444,7 @@ public class JobServiceImpl extends Service implements JobService { @Override public Map getHrmListByJobId(Long jobId) { - OrganizationAssert.isTrue(hasRight(), "暂无权限"); + HasRightUtil.hasRight(user, RIGHT_NAME, false); OrganizationWeaTable table = new OrganizationWeaTable<>(user, EmployeeTableVO.class); WeaResultMsg result = new WeaResultMsg(false); result.putAll(table.makeDataResult()); @@ -686,12 +689,4 @@ public class JobServiceImpl extends Service implements JobService { } } - /** - * 是否有该模块权限 - * - * @return - */ - private boolean hasRight() { - return HrmUserVarify.checkUserRight("Job:All", user); - } } diff --git a/src/com/engine/organization/service/impl/LevelServiceImpl.java b/src/com/engine/organization/service/impl/LevelServiceImpl.java index a122c11f..9aad6c50 100644 --- a/src/com/engine/organization/service/impl/LevelServiceImpl.java +++ b/src/com/engine/organization/service/impl/LevelServiceImpl.java @@ -15,17 +15,13 @@ import com.engine.organization.entity.scheme.vo.LevelTableVO; import com.engine.organization.mapper.scheme.LevelMapper; import com.engine.organization.mapper.scheme.SchemeMapper; import com.engine.organization.service.LevelService; -import com.engine.organization.util.MenuBtn; -import com.engine.organization.util.OrganizationAssert; -import com.engine.organization.util.OrganizationFormItemUtil; -import com.engine.organization.util.RefreshIsUsedUtil; +import com.engine.organization.util.*; import com.engine.organization.util.db.DBType; import com.engine.organization.util.db.MapperProxyFactory; import org.apache.commons.lang3.StringUtils; import weaver.conn.RecordSet; import weaver.general.StringUtil; import weaver.general.Util; -import weaver.hrm.HrmUserVarify; import java.util.*; @@ -38,6 +34,8 @@ import java.util.*; */ public class LevelServiceImpl extends Service implements LevelService { + private static final String RIGHT_NAME = "Level:All"; + private LevelMapper getLevelMapper() { return MapperProxyFactory.getProxy(LevelMapper.class); } @@ -49,8 +47,9 @@ public class LevelServiceImpl extends Service implements LevelService { @Override public Map listPage(Map params) { Map resultMap = new HashMap<>(); - resultMap.put("hasRight", hasRight()); - if (!hasRight()) { + boolean hasRight = HasRightUtil.hasRight(user, RIGHT_NAME, true); + resultMap.put("hasRight", hasRight); + if (!hasRight) { return resultMap; } // 刷新引用状态 @@ -68,7 +67,7 @@ public class LevelServiceImpl extends Service implements LevelService { @Override public int saveLevel(LevelSearchParam param) { - OrganizationAssert.isTrue(hasRight(), "暂无权限"); + HasRightUtil.hasRight(user, RIGHT_NAME, false); List list = getLevelMapper().listByNo(Util.null2String(param.getLevelNo())); OrganizationAssert.isEmpty(list, "编号不允许重复"); LevelPO levelPO = LevelDTO.convertParamToPO(param, (long) user.getUID()); @@ -77,21 +76,21 @@ public class LevelServiceImpl extends Service implements LevelService { @Override public int updateLevel(LevelSearchParam param) { - OrganizationAssert.isTrue(hasRight(), "暂无权限"); + HasRightUtil.hasRight(user, RIGHT_NAME, false); LevelPO levelPO = LevelDTO.convertParamToPO(param, (long) user.getUID()); return getLevelMapper().updateLevel(levelPO); } @Override public int updateForbiddenTagById(LevelSearchParam params) { - OrganizationAssert.isTrue(hasRight(), "暂无权限"); + HasRightUtil.hasRight(user, RIGHT_NAME, false); LevelPO levelPO = LevelPO.builder().id(params.getId()).forbiddenTag(params.getForbiddenTag() ? 0 : 1).build(); return getLevelMapper().updateForbiddenTagById(levelPO); } @Override public int deleteByIds(Collection ids) { - OrganizationAssert.isTrue(hasRight(), "暂无权限"); + HasRightUtil.hasRight(user, RIGHT_NAME, false); OrganizationAssert.notEmpty(ids, "请选择要删除的数据"); return getLevelMapper().deleteByIds(ids); } @@ -99,7 +98,7 @@ public class LevelServiceImpl extends Service implements LevelService { @Override public Map getSearchCondition(Map params) { - OrganizationAssert.isTrue(hasRight(), "暂无权限"); + HasRightUtil.hasRight(user, RIGHT_NAME, false); Map apiDatas = new HashMap<>(); List addGroups = new ArrayList<>(); List conditionItems = new ArrayList<>(); @@ -115,7 +114,7 @@ public class LevelServiceImpl extends Service implements LevelService { @Override public Map getLevelForm(Map params) { - OrganizationAssert.isTrue(hasRight(), "暂无权限"); + HasRightUtil.hasRight(user, RIGHT_NAME, false); Map apiDatas = new HashMap<>(); List selectItems = new ArrayList<>(); List addGroups = new ArrayList<>(); @@ -158,13 +157,13 @@ public class LevelServiceImpl extends Service implements LevelService { @Override public Map getTableBtn() { - OrganizationAssert.isTrue(hasRight(), "暂无权限"); + HasRightUtil.hasRight(user, RIGHT_NAME, false); return MenuBtn.getCommonBtnDatas(); } @Override public Map getTabInfo() { - OrganizationAssert.isTrue(hasRight(), "暂无权限"); + HasRightUtil.hasRight(user, RIGHT_NAME, false); Map apiDatas = new HashMap<>(); List topTabs = new ArrayList<>(); topTabs.add(TopTab.builder().color("#000000").groupId("flowAll").showcount(true).title("全部").viewCondition("-1").build()); @@ -205,13 +204,4 @@ public class LevelServiceImpl extends Service implements LevelService { } return sqlWhere; } - - /** - * 是否有该模块权限 - * - * @return - */ - private boolean hasRight() { - return HrmUserVarify.checkUserRight("Level:All", user); - } } diff --git a/src/com/engine/organization/service/impl/PostInfoServiceImpl.java b/src/com/engine/organization/service/impl/PostInfoServiceImpl.java index 09ac70af..3558f08c 100644 --- a/src/com/engine/organization/service/impl/PostInfoServiceImpl.java +++ b/src/com/engine/organization/service/impl/PostInfoServiceImpl.java @@ -14,6 +14,7 @@ import com.engine.organization.entity.postion.vo.PostInfoTableVO; import com.engine.organization.mapper.post.PostInfoMapper; import com.engine.organization.mapper.post.PostMapper; import com.engine.organization.service.PostInfoService; +import com.engine.organization.util.HasRightUtil; import com.engine.organization.util.MenuBtn; import com.engine.organization.util.OrganizationAssert; import com.engine.organization.util.OrganizationFormItemUtil; @@ -23,7 +24,6 @@ import org.apache.commons.lang3.StringUtils; import weaver.conn.RecordSet; import weaver.general.StringUtil; import weaver.general.Util; -import weaver.hrm.HrmUserVarify; import java.util.*; @@ -36,6 +36,8 @@ import java.util.*; */ public class PostInfoServiceImpl extends Service implements PostInfoService { + private static final String RIGHT_NAME = "PostInfo:All"; + private PostInfoMapper getPostInfoMapper() { return MapperProxyFactory.getProxy(PostInfoMapper.class); } @@ -47,8 +49,9 @@ public class PostInfoServiceImpl extends Service implements PostInfoService { @Override public Map listPage(Map params) { Map resultMap = new HashMap<>(); - resultMap.put("hasRight", hasRight()); - if (!hasRight()) { + boolean hasRight = HasRightUtil.hasRight(user, RIGHT_NAME, true); + resultMap.put("hasRight", hasRight); + if (!hasRight) { return resultMap; } OrganizationWeaTable table = new OrganizationWeaTable<>(user, PostInfoTableVO.class); @@ -64,7 +67,7 @@ public class PostInfoServiceImpl extends Service implements PostInfoService { @Override public int savePostInfo(PostInfoSearchParam param) { - OrganizationAssert.isTrue(hasRight(), "暂无权限"); + HasRightUtil.hasRight(user, RIGHT_NAME, false); List list = getPostInfoMapper().listByNo(Util.null2String(param.getPostInfoNo())); OrganizationAssert.isEmpty(list, "编号不允许重复"); PostInfoPO postInfoPO = PostInfoDTO.convertParamToPO(param, (long) user.getUID()); @@ -73,14 +76,14 @@ public class PostInfoServiceImpl extends Service implements PostInfoService { @Override public int updatePostInfo(PostInfoSearchParam param) { - OrganizationAssert.isTrue(hasRight(), "暂无权限"); + HasRightUtil.hasRight(user, RIGHT_NAME, false); PostInfoPO postInfoPO = PostInfoDTO.convertParamToPO(param, (long) user.getUID()); return getPostInfoMapper().updatePostInfo(postInfoPO); } @Override public int updateForbiddenTagById(PostInfoSearchParam params) { - OrganizationAssert.isTrue(hasRight(), "暂无权限"); + HasRightUtil.hasRight(user, RIGHT_NAME, false); PostInfoPO postInfoPO = PostInfoPO.builder().id(params.getId()).forbiddenTag(params.getForbiddenTag() ? 0 : 1).build(); return getPostInfoMapper().updateForbiddenTagById(postInfoPO); } @@ -88,7 +91,7 @@ public class PostInfoServiceImpl extends Service implements PostInfoService { @Override public int deleteByIds(Collection ids) { - OrganizationAssert.isTrue(hasRight(), "暂无权限"); + HasRightUtil.hasRight(user, RIGHT_NAME, false); OrganizationAssert.notEmpty(ids, "请选择要删除的数据"); return getPostInfoMapper().deleteByIds(ids); } @@ -96,7 +99,7 @@ public class PostInfoServiceImpl extends Service implements PostInfoService { @Override public Map getSearchCondition(Map params) { - OrganizationAssert.isTrue(hasRight(), "暂无权限"); + HasRightUtil.hasRight(user, RIGHT_NAME, false); Map apiDatas = new HashMap<>(); List addGroups = new ArrayList<>(); List conditionItems = new ArrayList<>(); @@ -112,7 +115,7 @@ public class PostInfoServiceImpl extends Service implements PostInfoService { @Override public Map getPostInfoForm(Map params) { - OrganizationAssert.isTrue(hasRight(), "暂无权限"); + HasRightUtil.hasRight(user, RIGHT_NAME, false); Map apiDatas = new HashMap<>(); List selectItems = new ArrayList<>(); List addGroups = new ArrayList<>(); @@ -170,7 +173,7 @@ public class PostInfoServiceImpl extends Service implements PostInfoService { @Override public Map getHasRight() { - OrganizationAssert.isTrue(hasRight(), "暂无权限"); + HasRightUtil.hasRight(user, RIGHT_NAME, false); return MenuBtn.getCommonBtnDatas(); } @@ -195,12 +198,4 @@ public class PostInfoServiceImpl extends Service implements PostInfoService { return sqlWhere; } - /** - * 是否有该模块权限 - * - * @return - */ - private boolean hasRight() { - return HrmUserVarify.checkUserRight("PostInfo:All", user); - } } diff --git a/src/com/engine/organization/service/impl/PostServiceImpl.java b/src/com/engine/organization/service/impl/PostServiceImpl.java index ce5e4a34..f3dcca44 100644 --- a/src/com/engine/organization/service/impl/PostServiceImpl.java +++ b/src/com/engine/organization/service/impl/PostServiceImpl.java @@ -8,12 +8,12 @@ import com.engine.organization.entity.postion.dto.PostDTO; import com.engine.organization.entity.postion.po.PostPO; import com.engine.organization.mapper.post.PostMapper; import com.engine.organization.service.PostService; +import com.engine.organization.util.HasRightUtil; import com.engine.organization.util.OrganizationAssert; import com.engine.organization.util.OrganizationFormItemUtil; import com.engine.organization.util.db.MapperProxyFactory; import weaver.general.StringUtil; import weaver.general.Util; -import weaver.hrm.HrmUserVarify; import java.util.*; @@ -25,13 +25,15 @@ import java.util.*; */ public class PostServiceImpl extends Service implements PostService { + private static final String RIGHT_NAME = "Post:All"; + private PostMapper getPostMapper() { return MapperProxyFactory.getProxy(PostMapper.class); } @Override public int savePost(PostPO postPO) { - OrganizationAssert.isTrue(hasRight(), "暂无权限"); + HasRightUtil.hasRight(user, RIGHT_NAME, false); List list = getPostMapper().listByNo(Util.null2String(postPO.getPostNo())); OrganizationAssert.isEmpty(list, "编号不允许重复"); return getPostMapper().insertIgnoreNull(PostDTO.convertPO(postPO, user.getUID())); @@ -39,20 +41,20 @@ public class PostServiceImpl extends Service implements PostService { @Override public int updatePost(PostPO postPO) { - OrganizationAssert.isTrue(hasRight(), "暂无权限"); + HasRightUtil.hasRight(user, RIGHT_NAME, false); return getPostMapper().updatePost(PostDTO.convertPO(postPO, user.getUID())); } @Override public int deleteByIds(Collection ids) { - OrganizationAssert.isTrue(hasRight(), "暂无权限"); + HasRightUtil.hasRight(user, RIGHT_NAME, false); OrganizationAssert.notEmpty(ids, "请选择要删除的数据"); return getPostMapper().deleteByIds(ids); } @Override public Map getPostForm(Map params) { - OrganizationAssert.isTrue(hasRight(), "暂无权限"); + HasRightUtil.hasRight(user, RIGHT_NAME, false); Map apiDatas = new HashMap<>(); List selectItems = new ArrayList<>(); List addGroups = new ArrayList<>(); @@ -84,17 +86,10 @@ public class PostServiceImpl extends Service implements PostService { @Override public TreeData getTreeData() { - OrganizationAssert.isTrue(hasRight(), "暂无权限"); + HasRightUtil.hasRight(user, RIGHT_NAME, false); ArrayList treeDataList = getPostMapper().getTreeData(); return TreeData.builder().children(treeDataList).title("全部类型").key("-1").build(); } - /** - * 是否有该模块权限 - * - * @return - */ - private boolean hasRight() { - return HrmUserVarify.checkUserRight("Post:All", user); - } + } diff --git a/src/com/engine/organization/service/impl/SchemeServiceImpl.java b/src/com/engine/organization/service/impl/SchemeServiceImpl.java index 3b675ac1..9b4519cc 100644 --- a/src/com/engine/organization/service/impl/SchemeServiceImpl.java +++ b/src/com/engine/organization/service/impl/SchemeServiceImpl.java @@ -11,17 +11,13 @@ import com.engine.organization.entity.scheme.po.SchemePO; import com.engine.organization.entity.scheme.vo.SchemeTableVO; import com.engine.organization.mapper.scheme.SchemeMapper; import com.engine.organization.service.SchemeService; -import com.engine.organization.util.MenuBtn; -import com.engine.organization.util.OrganizationAssert; -import com.engine.organization.util.OrganizationFormItemUtil; -import com.engine.organization.util.RefreshIsUsedUtil; +import com.engine.organization.util.*; import com.engine.organization.util.db.DBType; import com.engine.organization.util.db.MapperProxyFactory; import org.apache.commons.lang3.StringUtils; import weaver.conn.RecordSet; import weaver.general.StringUtil; import weaver.general.Util; -import weaver.hrm.HrmUserVarify; import java.util.*; @@ -33,15 +29,19 @@ import java.util.*; **/ public class SchemeServiceImpl extends Service implements SchemeService { + private static final String RIGHT_NAME = "Scheme:All"; + private SchemeMapper getSchemeMapper() { return MapperProxyFactory.getProxy(SchemeMapper.class); } + @Override public Map listPage(Map params) { Map resultMap = new HashMap<>(); - resultMap.put("hasRight", hasRight()); - if (!hasRight()) { + boolean hasRight = HasRightUtil.hasRight(user, RIGHT_NAME, true); + resultMap.put("hasRight", hasRight); + if (!hasRight) { return resultMap; } // 刷新引用状态 @@ -58,7 +58,7 @@ public class SchemeServiceImpl extends Service implements SchemeService { @Override public Map save(SchemeSearchParam param) { - OrganizationAssert.isTrue(hasRight(), "暂无权限"); + HasRightUtil.hasRight(user, RIGHT_NAME, false); Map apidatas = new HashMap<>(16); List list = getSchemeMapper().listByNo(Util.null2String(param.getSchemeNo())); OrganizationAssert.isEmpty(list, "编号不允许重复"); @@ -69,7 +69,7 @@ public class SchemeServiceImpl extends Service implements SchemeService { @Override public Map updateScheme(SchemeSearchParam param) { - OrganizationAssert.isTrue(hasRight(), "暂无权限"); + HasRightUtil.hasRight(user, RIGHT_NAME, false); Map apidatas = new HashMap<>(); SchemePO schemePO = SchemeDTO.convertParamToPO(param, (long) user.getUID()); getSchemeMapper().updateScheme(schemePO); @@ -78,7 +78,7 @@ public class SchemeServiceImpl extends Service implements SchemeService { @Override public void updateForbiddenTagById(SchemeSearchParam params) { - OrganizationAssert.isTrue(hasRight(), "暂无权限"); + HasRightUtil.hasRight(user, RIGHT_NAME, false); SchemePO schemePO = SchemePO.builder().id(params.getId()).forbiddenTag(params.getForbiddenTag() ? 0 : 1).build(); getSchemeMapper().updateForbiddenTagById(schemePO); } @@ -86,7 +86,7 @@ public class SchemeServiceImpl extends Service implements SchemeService { @Override public void deleteByIds(Collection ids) { - OrganizationAssert.isTrue(hasRight(), "暂无权限"); + HasRightUtil.hasRight(user, RIGHT_NAME, false); OrganizationAssert.notEmpty(ids, "请选择要删除的数据"); getSchemeMapper().deleteByIds(ids); } @@ -94,7 +94,7 @@ public class SchemeServiceImpl extends Service implements SchemeService { @Override public Map getSearchCondition(Map params) { - OrganizationAssert.isTrue(hasRight(), "暂无权限"); + HasRightUtil.hasRight(user, RIGHT_NAME, false); Map apiDatas = new HashMap<>(); List addGroups = new ArrayList<>(); List conditionItems = new ArrayList<>(); @@ -110,7 +110,7 @@ public class SchemeServiceImpl extends Service implements SchemeService { @Override public Map getSchemeForm(Map params) { - OrganizationAssert.isTrue(hasRight(), "暂无权限"); + HasRightUtil.hasRight(user, RIGHT_NAME, false); Map apiDatas = new HashMap<>(); List selectItems = new ArrayList<>(); List addGroups = new ArrayList<>(); @@ -143,7 +143,7 @@ public class SchemeServiceImpl extends Service implements SchemeService { @Override public Map getTableBtn() { - OrganizationAssert.isTrue(hasRight(), "暂无权限"); + HasRightUtil.hasRight(user, RIGHT_NAME, false); return MenuBtn.getCommonBtnDatas(); } @@ -167,13 +167,5 @@ public class SchemeServiceImpl extends Service implements SchemeService { return sqlWhere; } - /** - * 是否有该模块权限 - * - * @return - */ - private boolean hasRight() { - return HrmUserVarify.checkUserRight("Scheme:All", user); - } } diff --git a/src/com/engine/organization/service/impl/SequenceServiceImpl.java b/src/com/engine/organization/service/impl/SequenceServiceImpl.java index 779e7f41..c95fcf6e 100644 --- a/src/com/engine/organization/service/impl/SequenceServiceImpl.java +++ b/src/com/engine/organization/service/impl/SequenceServiceImpl.java @@ -12,20 +12,16 @@ import com.engine.organization.entity.sequence.dto.SequenceDTO; import com.engine.organization.entity.sequence.param.SequenceSearchParam; import com.engine.organization.entity.sequence.po.SequencePO; import com.engine.organization.entity.sequence.vo.SequenceTableVO; -import com.engine.organization.mapper.sequence.SequenceMapper; import com.engine.organization.mapper.scheme.SchemeMapper; +import com.engine.organization.mapper.sequence.SequenceMapper; import com.engine.organization.service.SequenceService; -import com.engine.organization.util.MenuBtn; -import com.engine.organization.util.OrganizationAssert; -import com.engine.organization.util.OrganizationFormItemUtil; -import com.engine.organization.util.RefreshIsUsedUtil; +import com.engine.organization.util.*; import com.engine.organization.util.db.DBType; import com.engine.organization.util.db.MapperProxyFactory; import org.apache.commons.lang3.StringUtils; import weaver.conn.RecordSet; import weaver.general.StringUtil; import weaver.general.Util; -import weaver.hrm.HrmUserVarify; import java.util.*; @@ -38,6 +34,8 @@ import java.util.*; */ public class SequenceServiceImpl extends Service implements SequenceService { + private static final String RIGHT_NAME = "Sequence:All"; + private SequenceMapper getSequenceMapper() { return MapperProxyFactory.getProxy(SequenceMapper.class); } @@ -49,8 +47,9 @@ public class SequenceServiceImpl extends Service implements SequenceService { @Override public Map listPage(Map params) { Map resultMap = new HashMap<>(); - resultMap.put("hasRight", hasRight()); - if (!hasRight()) { + boolean hasRight = HasRightUtil.hasRight(user, RIGHT_NAME, true); + resultMap.put("hasRight", hasRight); + if (!hasRight) { return resultMap; } // 刷新引用状态 @@ -68,7 +67,7 @@ public class SequenceServiceImpl extends Service implements SequenceService { @Override public int saveSequence(SequenceSearchParam param) { - OrganizationAssert.isTrue(hasRight(), "暂无权限"); + HasRightUtil.hasRight(user, RIGHT_NAME, false); List list = getSequenceMapper().listByNo(Util.null2String(param.getSequenceNo())); OrganizationAssert.isEmpty(list, "编号不允许重复"); SequencePO sequencePO = SequenceDTO.convertParamToPO(param, (long) user.getUID()); @@ -77,21 +76,21 @@ public class SequenceServiceImpl extends Service implements SequenceService { @Override public int updateSequence(SequenceSearchParam param) { - OrganizationAssert.isTrue(hasRight(), "暂无权限"); + HasRightUtil.hasRight(user, RIGHT_NAME, false); SequencePO sequencePO = SequenceDTO.convertParamToPO(param, (long) user.getUID()); return getSequenceMapper().updateSequence(sequencePO); } @Override public int updateForbiddenTagById(SequenceSearchParam params) { - OrganizationAssert.isTrue(hasRight(), "暂无权限"); + HasRightUtil.hasRight(user, RIGHT_NAME, false); SequencePO sequencePO = SequencePO.builder().id(params.getId()).forbiddenTag(params.getForbiddenTag() ? 0 : 1).build(); return getSequenceMapper().updateForbiddenTagById(sequencePO); } @Override public int deleteByIds(Collection ids) { - OrganizationAssert.isTrue(hasRight(), "暂无权限"); + HasRightUtil.hasRight(user, RIGHT_NAME, false); OrganizationAssert.notEmpty(ids, "请选择要删除的数据"); return getSequenceMapper().deleteByIds(ids); } @@ -99,7 +98,7 @@ public class SequenceServiceImpl extends Service implements SequenceService { @Override public Map getSearchCondition(Map params) { - OrganizationAssert.isTrue(hasRight(), "暂无权限"); + HasRightUtil.hasRight(user, RIGHT_NAME, false); Map apiDatas = new HashMap<>(); List addGroups = new ArrayList<>(); List conditionItems = new ArrayList<>(); @@ -115,7 +114,7 @@ public class SequenceServiceImpl extends Service implements SequenceService { @Override public Map getSequenceForm(Map params) { - OrganizationAssert.isTrue(hasRight(), "暂无权限"); + HasRightUtil.hasRight(user, RIGHT_NAME, false); Map apiDatas = new HashMap<>(); List selectItems = new ArrayList<>(); List addGroups = new ArrayList<>(); @@ -158,13 +157,13 @@ public class SequenceServiceImpl extends Service implements SequenceService { @Override public Map getHasRight() { - OrganizationAssert.isTrue(hasRight(), "暂无权限"); + HasRightUtil.hasRight(user, RIGHT_NAME, false); return MenuBtn.getCommonBtnDatas(); } @Override public Map getTabInfo() { - OrganizationAssert.isTrue(hasRight(), "暂无权限"); + HasRightUtil.hasRight(user, RIGHT_NAME, false); Map apiDatas = new HashMap<>(); List topTabs = new ArrayList<>(); topTabs.add(TopTab.builder().color("#000000").groupId("flowAll").showcount(true).title("全部").viewCondition("-1").build()); @@ -206,12 +205,4 @@ public class SequenceServiceImpl extends Service implements SequenceService { return sqlWhere; } - /** - * 是否有该模块权限 - * - * @return - */ - private boolean hasRight() { - return HrmUserVarify.checkUserRight("Sequence:All", user); - } } diff --git a/src/com/engine/organization/service/impl/StaffPlanServiceImpl.java b/src/com/engine/organization/service/impl/StaffPlanServiceImpl.java index 324b8fbf..80fa8253 100644 --- a/src/com/engine/organization/service/impl/StaffPlanServiceImpl.java +++ b/src/com/engine/organization/service/impl/StaffPlanServiceImpl.java @@ -15,17 +15,13 @@ import com.engine.organization.entity.staff.vo.StaffPlanTableVO; import com.engine.organization.mapper.comp.CompMapper; import com.engine.organization.mapper.staff.StaffPlanMapper; import com.engine.organization.service.StaffPlanService; -import com.engine.organization.util.MenuBtn; -import com.engine.organization.util.OrganizationAssert; -import com.engine.organization.util.OrganizationFormItemUtil; -import com.engine.organization.util.RefreshIsUsedUtil; +import com.engine.organization.util.*; import com.engine.organization.util.db.DBType; import com.engine.organization.util.db.MapperProxyFactory; import org.apache.commons.lang3.StringUtils; import weaver.conn.RecordSet; import weaver.general.StringUtil; import weaver.general.Util; -import weaver.hrm.HrmUserVarify; import java.util.*; @@ -37,6 +33,8 @@ import java.util.*; */ public class StaffPlanServiceImpl extends Service implements StaffPlanService { + private static final String RIGHT_NAME = "StaffPlan:All"; + private StaffPlanMapper getStaffPlanMapper() { return MapperProxyFactory.getProxy(StaffPlanMapper.class); } @@ -48,8 +46,9 @@ public class StaffPlanServiceImpl extends Service implements StaffPlanService { @Override public Map listPage(StaffPlanSearchParam params) { Map resultMap = new HashMap<>(); - resultMap.put("hasRight", hasRight()); - if (!hasRight()) { + boolean hasRight = HasRightUtil.hasRight(user, RIGHT_NAME, true); + resultMap.put("hasRight", hasRight); + if (!hasRight) { return resultMap; } // 刷新引用状态 @@ -67,7 +66,7 @@ public class StaffPlanServiceImpl extends Service implements StaffPlanService { @Override public int saveStaffPlan(StaffPlanSearchParam param) { - OrganizationAssert.isTrue(hasRight(), "暂无权限"); + HasRightUtil.hasRight(user, RIGHT_NAME, false); List list = getStaffPlanMapper().listByNo(Util.null2String(param.getPlanNo())); OrganizationAssert.isEmpty(list, "编号不允许重复"); StaffPlanPO staffPlanPO = StaffPlanBO.convertParamToPO(param, (long) user.getUID()); @@ -76,28 +75,28 @@ public class StaffPlanServiceImpl extends Service implements StaffPlanService { @Override public int updateStaffPlan(StaffPlanSearchParam param) { - OrganizationAssert.isTrue(hasRight(), "暂无权限"); + HasRightUtil.hasRight(user, RIGHT_NAME, false); StaffPlanPO staffPlanPO = StaffPlanBO.convertParamToPO(param, (long) user.getUID()); return getStaffPlanMapper().updateStaffPlan(staffPlanPO); } @Override public int updateForbiddenTagById(StaffPlanSearchParam params) { - OrganizationAssert.isTrue(hasRight(), "暂无权限"); + HasRightUtil.hasRight(user, RIGHT_NAME, false); StaffPlanPO staffPlanPO = StaffPlanPO.builder().id(params.getId()).forbiddenTag(params.getForbiddenTag() ? 0 : 1).build(); return getStaffPlanMapper().updateForbiddenTagById(staffPlanPO); } @Override public int deleteByIds(Collection ids) { - OrganizationAssert.isTrue(hasRight(), "暂无权限"); + HasRightUtil.hasRight(user, RIGHT_NAME, false); OrganizationAssert.notEmpty(ids, "请选择要删除的数据"); return getStaffPlanMapper().deleteByIds(ids); } @Override public Map getSearchCondition(Map params) { - OrganizationAssert.isTrue(hasRight(), "暂无权限"); + HasRightUtil.hasRight(user, RIGHT_NAME, false); Map apiDatas = new HashMap<>(); List addGroups = new ArrayList<>(); List conditionItems = new ArrayList<>(); @@ -113,7 +112,7 @@ public class StaffPlanServiceImpl extends Service implements StaffPlanService { // 时间结束 SearchConditionItem timeEndItem = OrganizationFormItemUtil.datePickerItem(user, 2, 16, false, 2, "时间结束", "timeEnd"); // 适用公司 - SearchConditionItem companyIdtItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "适用公司", "162", "companyId", "compBrowser"); + SearchConditionItem companyIdtItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "适用公司", "161", "companyId", "compBrowser"); // 说明 SearchConditionItem descriptionItem = OrganizationFormItemUtil.inputItem(user, 2, 16, 2, 50, "说明", "description"); // 状态 @@ -140,7 +139,7 @@ public class StaffPlanServiceImpl extends Service implements StaffPlanService { @Override public Map getForm(Map params) { - OrganizationAssert.isTrue(hasRight(), "暂无权限"); + HasRightUtil.hasRight(user, RIGHT_NAME, false); Map apiDatas = new HashMap<>(); List selectItems = new ArrayList<>(); List addGroups = new ArrayList<>(); @@ -173,9 +172,9 @@ public class StaffPlanServiceImpl extends Service implements StaffPlanService { OrganizationAssert.notNull(staffPlanPO, "选择的数据不存在,或数据已删除"); planNoItem.setValue(staffPlanPO.getPlanNo()); planNameItem.setValue(staffPlanPO.getPlanName()); - planYearItem.setValue(staffPlanPO.getPlanYear()); - timeStartItem.setValue(staffPlanPO.getTimeStart()); - timeEndItem.setValue(staffPlanPO.getTimeEnd()); + planYearItem.setValue(staffPlanPO.getPlanYear() + ""); + timeStartItem.setValue(staffPlanPO.getTimeStart() + ""); + timeEndItem.setValue(staffPlanPO.getTimeEnd() + ""); BrowserBean browserBean = companyIdtItem.getBrowserConditionParam(); List> maps = getCompMapper().listCompsByIds(DeleteParam.builder().ids(staffPlanPO.getCompanyId()).build().getIds()); @@ -202,7 +201,7 @@ public class StaffPlanServiceImpl extends Service implements StaffPlanService { @Override public Map getHasRight() { - OrganizationAssert.isTrue(hasRight(), "暂无权限"); + HasRightUtil.hasRight(user, RIGHT_NAME, false); return MenuBtn.getCommonBtnDatas(); } @@ -230,13 +229,13 @@ public class StaffPlanServiceImpl extends Service implements StaffPlanService { } Date timeStart = staffPlanPO.getTimeStart(); if (null != timeStart) { - sqlWhere += " AND t.time_start = '" + timeStart + "'"; + sqlWhere += " AND t.time_start >= '" + timeStart + "'"; } Date timeEnd = staffPlanPO.getTimeEnd(); if (null != timeEnd) { - sqlWhere += " AND t.time_end = '" + timeEnd + "'"; + sqlWhere += " AND t.time_end <= '" + timeEnd + "'"; } - String companyId = staffPlanPO.getDescription(); + String companyId = staffPlanPO.getCompanyId(); if (StringUtils.isNotBlank(companyId)) { sqlWhere += " AND t.companyId = '" + companyId + "'"; } @@ -252,12 +251,4 @@ public class StaffPlanServiceImpl extends Service implements StaffPlanService { return sqlWhere; } - /** - * 是否有该模块权限 - * - * @return - */ - private boolean hasRight() { - return HrmUserVarify.checkUserRight("StaffPlan:All", user); - } } diff --git a/src/com/engine/organization/service/impl/StaffServiceImpl.java b/src/com/engine/organization/service/impl/StaffServiceImpl.java index 8fe2b59f..9205e0da 100644 --- a/src/com/engine/organization/service/impl/StaffServiceImpl.java +++ b/src/com/engine/organization/service/impl/StaffServiceImpl.java @@ -18,17 +18,13 @@ import com.engine.organization.mapper.job.JobMapper; import com.engine.organization.mapper.staff.StaffMapper; import com.engine.organization.mapper.staff.StaffPlanMapper; import com.engine.organization.service.StaffService; -import com.engine.organization.util.MenuBtn; -import com.engine.organization.util.OrganizationAssert; -import com.engine.organization.util.OrganizationFormItemUtil; -import com.engine.organization.util.RefreshIsUsedUtil; +import com.engine.organization.util.*; import com.engine.organization.util.db.DBType; import com.engine.organization.util.db.MapperProxyFactory; import org.apache.commons.lang3.StringUtils; import weaver.conn.RecordSet; import weaver.general.StringUtil; import weaver.general.Util; -import weaver.hrm.HrmUserVarify; import java.util.*; @@ -39,6 +35,9 @@ import java.util.*; * @version: 1.0 */ public class StaffServiceImpl extends Service implements StaffService { + + private static final String RIGHT_NAME = "Staff:All"; + private StaffMapper getStaffMapper() { return MapperProxyFactory.getProxy(StaffMapper.class); } @@ -63,8 +62,9 @@ public class StaffServiceImpl extends Service implements StaffService { @Override public Map listPage(StaffSearchParam params) { Map resultMap = new HashMap<>(); - resultMap.put("hasRight", hasRight()); - if (!hasRight()) { + boolean hasRight = HasRightUtil.hasRight(user, RIGHT_NAME, true); + resultMap.put("hasRight", hasRight); + if (!hasRight) { return resultMap; } // 刷新引用状态 @@ -82,14 +82,14 @@ public class StaffServiceImpl extends Service implements StaffService { @Override public int saveStaff(StaffSearchParam param) { - OrganizationAssert.isTrue(hasRight(), "暂无权限"); + HasRightUtil.hasRight(user, RIGHT_NAME, false); StaffPO staffPO = StaffBO.convertParamToPO(param, (long) user.getUID()); return getStaffMapper().insertIgnoreNull(staffPO); } @Override public int updateStaff(StaffSearchParam param) { - OrganizationAssert.isTrue(hasRight(), "暂无权限"); + HasRightUtil.hasRight(user, RIGHT_NAME, false); StaffPO staffPlanPO = StaffBO.convertParamToPO(param, (long) user.getUID()); return getStaffMapper().updateStaff(staffPlanPO); } @@ -97,14 +97,14 @@ public class StaffServiceImpl extends Service implements StaffService { @Override public int deleteByIds(Collection ids) { - OrganizationAssert.isTrue(hasRight(), "暂无权限"); + HasRightUtil.hasRight(user, RIGHT_NAME, false); OrganizationAssert.notEmpty(ids, "请选择要删除的数据"); return getStaffMapper().deleteByIds(ids); } @Override public Map getSearchCondition(Map params) { - OrganizationAssert.isTrue(hasRight(), "暂无权限"); + HasRightUtil.hasRight(user, RIGHT_NAME, false); Map apiDatas = new HashMap<>(); List addGroups = new ArrayList<>(); List conditionItems = new ArrayList<>(); @@ -155,7 +155,7 @@ public class StaffServiceImpl extends Service implements StaffService { @Override public Map getForm(Map params) { - OrganizationAssert.isTrue(hasRight(), "暂无权限"); + HasRightUtil.hasRight(user, RIGHT_NAME, false); Map apiDatas = new HashMap<>(); List selectItems = new ArrayList<>(); List addGroups = new ArrayList<>(); @@ -229,7 +229,7 @@ public class StaffServiceImpl extends Service implements StaffService { @Override public Map getHasRight() { - OrganizationAssert.isTrue(hasRight(), "暂无权限"); + HasRightUtil.hasRight(user, RIGHT_NAME, false); return MenuBtn.getCommonBtnDatas(); } @@ -291,12 +291,4 @@ public class StaffServiceImpl extends Service implements StaffService { return sqlWhere; } - /** - * 是否有该模块权限 - * - * @return - */ - private boolean hasRight() { - return HrmUserVarify.checkUserRight("Staff:All", user); - } } diff --git a/src/com/engine/organization/util/HasRightUtil.java b/src/com/engine/organization/util/HasRightUtil.java new file mode 100644 index 00000000..b313907d --- /dev/null +++ b/src/com/engine/organization/util/HasRightUtil.java @@ -0,0 +1,29 @@ +package com.engine.organization.util; + +import weaver.hrm.HrmUserVarify; +import weaver.hrm.User; + +/** + * @description: TODO + * @author:dxfeng + * @createTime: 2022/06/07 + * @version: 1.0 + */ +public class HasRightUtil { + + /** + * 判断是否拥有对应权限 + * + * @param user + * @param rightName + * @param isReturnFalse + * @return + */ + public static boolean hasRight(User user, String rightName, boolean isReturnFalse) { + boolean hasRight = HrmUserVarify.checkUserRight("Scheme:All", user); + if (!isReturnFalse) { + OrganizationAssert.isTrue(hasRight, "暂无权限访问"); + } + return hasRight; + } +}