|
|
|
@ -43,6 +43,7 @@ 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,7 +93,7 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public PageInfo<SingleDeptTreeVO> getDeptListByPid(QuerySingleDeptListParam param) {
|
|
|
|
|
|
|
|
|
|
OrganizationAssert.isTrue(hasRight(), "暂无权限");
|
|
|
|
|
//1.查询分部下所有部门
|
|
|
|
|
//PageUtil.start(param.getCurrent(), param.getPageSize());
|
|
|
|
|
List<DepartmentPO> departmentPOS = MapperProxyFactory.getProxy(DepartmentMapper.class).list();
|
|
|
|
@ -108,6 +109,7 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public PageInfo<SingleJobTreeVO> getJobListByPid(QuerySingleDeptListParam param) {
|
|
|
|
|
OrganizationAssert.isTrue(hasRight(), "暂无权限");
|
|
|
|
|
List<JobPO> jobPOS = MapperProxyFactory.getProxy(JobMapper.class).listAll();
|
|
|
|
|
PageInfo<JobPO> pageInfo = new PageInfo<>(jobPOS);
|
|
|
|
|
List<SingleJobTreeVO> singleDeptTreeVOS = JobBO.buildSingleJobTreeVOS(jobPOS, param.getParentDept());
|
|
|
|
@ -121,6 +123,7 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Map<String, Object> getSearchTree(SearchTreeParams params) {
|
|
|
|
|
OrganizationAssert.isTrue(hasRight(), "暂无权限");
|
|
|
|
|
String keyword = params.getKeyword();
|
|
|
|
|
String id = params.getId();
|
|
|
|
|
String type = Util.null2String(params.getType());
|
|
|
|
@ -131,6 +134,10 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|
|
|
|
@Override
|
|
|
|
|
public Map<String, Object> listPage(DeptSearchParam param) {
|
|
|
|
|
Map<String, Object> datas = new HashMap<>();
|
|
|
|
|
datas.put("hasRight", hasRight());
|
|
|
|
|
if (!hasRight()) {
|
|
|
|
|
return datas;
|
|
|
|
|
}
|
|
|
|
|
DepartmentPO departmentPO = DepartmentBO.convertParamsToPO(param, user.getUID());
|
|
|
|
|
boolean filter = isFilter(departmentPO);
|
|
|
|
|
PageInfo<DepartmentListDTO> pageInfos;
|
|
|
|
@ -172,6 +179,7 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public int saveBaseForm(DeptSearchParam params) {
|
|
|
|
|
OrganizationAssert.isTrue(hasRight(), "暂无权限");
|
|
|
|
|
// 自动编号
|
|
|
|
|
params.setDeptNo(CodeRuleUtil.generateCode(RuleCodeType.DEPARTMENT, params.getDeptNo()));
|
|
|
|
|
List<DepartmentPO> list = getDepartmentMapper().listByNo(Util.null2String(params.getDeptNo()));
|
|
|
|
@ -182,12 +190,14 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public int updateForbiddenTagById(DeptSearchParam params) {
|
|
|
|
|
OrganizationAssert.isTrue(hasRight(), "暂无权限");
|
|
|
|
|
DepartmentPO departmentPO = DepartmentPO.builder().id(params.getId()).forbiddenTag(params.getForbiddenTag() ? 0 : 1).build();
|
|
|
|
|
return getDepartmentMapper().updateForbiddenTagById(departmentPO);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public int updateForm(Map<String, Object> params) {
|
|
|
|
|
OrganizationAssert.isTrue(hasRight(), "暂无权限");
|
|
|
|
|
DeptSearchParam searchParam = JSONObject.parseObject(JSONObject.toJSONString(params), DeptSearchParam.class);
|
|
|
|
|
String groupId = (String) params.get("viewCondition");
|
|
|
|
|
DepartmentPO departmentPO = DepartmentBO.convertParamsToPO(searchParam, user.getUID());
|
|
|
|
@ -204,12 +214,14 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public int deleteByIds(Collection<Long> ids) {
|
|
|
|
|
OrganizationAssert.isTrue(hasRight(), "暂无权限");
|
|
|
|
|
OrganizationAssert.notEmpty(ids, "请选择要删除的数据");
|
|
|
|
|
return getDepartmentMapper().deleteByIds(ids);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Map<String, Object> getSearchCondition(Map<String, Object> params) {
|
|
|
|
|
OrganizationAssert.isTrue(hasRight(), "暂无权限");
|
|
|
|
|
Map<String, Object> apiDatas = new HashMap<>();
|
|
|
|
|
List<SearchConditionGroup> addGroups = new ArrayList<>();
|
|
|
|
|
List<SearchConditionItem> conditionItems = new ArrayList<>();
|
|
|
|
@ -251,28 +263,13 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Map<String, Object> getHasRight() {
|
|
|
|
|
Map<String, Object> btnDatas = new HashMap<>();
|
|
|
|
|
ArrayList<MenuBtn> topMenuList = new ArrayList<>();
|
|
|
|
|
ArrayList<MenuBtn> rightMenuList = new ArrayList<>();
|
|
|
|
|
// 新增
|
|
|
|
|
topMenuList.add(MenuBtn.topMenu_addNew());
|
|
|
|
|
// 批量删除
|
|
|
|
|
topMenuList.add(MenuBtn.topMenu_batchDelete());
|
|
|
|
|
// 复制
|
|
|
|
|
topMenuList.add(MenuBtn.topMenu_copy());
|
|
|
|
|
btnDatas.put("topMenu", topMenuList);
|
|
|
|
|
// 新增
|
|
|
|
|
rightMenuList.add(MenuBtn.rightMenu_addNew());
|
|
|
|
|
// 复制
|
|
|
|
|
rightMenuList.add(MenuBtn.rightMenu_copy());
|
|
|
|
|
// 日志
|
|
|
|
|
rightMenuList.add(MenuBtn.rightMenu_btnLog());
|
|
|
|
|
btnDatas.put("rightMenu", rightMenuList);
|
|
|
|
|
return btnDatas;
|
|
|
|
|
OrganizationAssert.isTrue(hasRight(), "暂无权限");
|
|
|
|
|
return MenuBtn.getDatasHasCopy();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Map<String, Object> getDeptBaseForm(Map<String, Object> params) {
|
|
|
|
|
OrganizationAssert.isTrue(hasRight(), "暂无权限");
|
|
|
|
|
OrganizationAssert.notNull(params.get("viewAttr"), "请标识操作类型");
|
|
|
|
|
|
|
|
|
|
// 2编辑 1查看
|
|
|
|
@ -308,6 +305,7 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Map<String, Object> getSaveForm() {
|
|
|
|
|
OrganizationAssert.isTrue(hasRight(), "暂无权限");
|
|
|
|
|
Map<String, Object> apiDatas = new HashMap<>();
|
|
|
|
|
List<SearchConditionGroup> addGroups = new ArrayList<>();
|
|
|
|
|
List<SearchConditionItem> conditionItems = new ArrayList<>();
|
|
|
|
@ -360,6 +358,7 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public List<SearchConditionGroup> getCopyForm() {
|
|
|
|
|
OrganizationAssert.isTrue(hasRight(), "暂无权限");
|
|
|
|
|
List<SearchConditionGroup> addGroups = new ArrayList<>();
|
|
|
|
|
List<SearchConditionItem> condition = new ArrayList<>();
|
|
|
|
|
SearchConditionItem compBrowserItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 3, false, "复制到", "161", "company", "compBrowser");
|
|
|
|
@ -367,7 +366,7 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|
|
|
|
List<SearchConditionOption> selectOptions = new ArrayList<>();
|
|
|
|
|
SearchConditionOption Option = new SearchConditionOption("1", "");
|
|
|
|
|
selectOptions.add(Option);
|
|
|
|
|
SearchConditionItem isCheckItem = OrganizationFormItemUtil.selectItem(user, selectOptions, 2, 16, 6, false, "是否复制岗位信息", "copyJob");
|
|
|
|
|
SearchConditionItem isCheckItem = OrganizationFormItemUtil.selectItem(user, selectOptions, 2, 5, 10, false, "是否复制岗位信息", "copyJob");
|
|
|
|
|
isCheckItem.setDetailtype(2);
|
|
|
|
|
condition.add(compBrowserItem);
|
|
|
|
|
condition.add(isCheckItem);
|
|
|
|
@ -383,6 +382,7 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public int copyDepartment(DeptCopyParam copyParam) {
|
|
|
|
|
OrganizationAssert.isTrue(hasRight(), "暂无权限");
|
|
|
|
|
OrganizationAssert.notBlank(copyParam.getCompany(), "请指定需要复制的公司/分部");
|
|
|
|
|
int insertCount = 0;
|
|
|
|
|
List<Long> idList = Arrays.stream(copyParam.getIds().split(",")).map(Long::parseLong).collect(Collectors.toList());
|
|
|
|
@ -410,6 +410,7 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<SearchConditionGroup> getMergeForm(Long id) {
|
|
|
|
|
OrganizationAssert.isTrue(hasRight(), "暂无权限");
|
|
|
|
|
List<SearchConditionGroup> addGroups = new ArrayList<>();
|
|
|
|
|
List<SearchConditionItem> condition = new ArrayList<>();
|
|
|
|
|
SearchConditionItem deptBrowserItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 3, false, "合并到部门", "161", "department", "deptBrowser");
|
|
|
|
@ -427,6 +428,7 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public int mergeDepartment(DepartmentMergeParam mergeParam) {
|
|
|
|
|
OrganizationAssert.isTrue(hasRight(), "暂无权限");
|
|
|
|
|
int updateCount = 0;
|
|
|
|
|
OrganizationAssert.isFalse(mergeParam.getId().equals(mergeParam.getDepartment()), "所选部门与待合并部门一致,无需操作");
|
|
|
|
|
OrganizationAssert.notNull(mergeParam.getDepartment(), "请选择需要合并的部门");
|
|
|
|
@ -448,6 +450,7 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<SearchConditionGroup> getMoveForm() {
|
|
|
|
|
OrganizationAssert.isTrue(hasRight(), "暂无权限");
|
|
|
|
|
List<SearchConditionGroup> addGroups = new ArrayList<>();
|
|
|
|
|
List<SearchConditionItem> condition = new ArrayList<>();
|
|
|
|
|
SearchConditionItem compBrowserItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "请选择公司/分部", "161", "company", "compBrowser");
|
|
|
|
@ -461,6 +464,7 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|
|
|
|
selectOptions.add(deptOption);
|
|
|
|
|
SearchConditionItem moveTypeItem = OrganizationFormItemUtil.selectItem(user, selectOptions, 2, 16, 6, false, "转移到", "moveType");
|
|
|
|
|
moveTypeItem.setDetailtype(3);
|
|
|
|
|
moveTypeItem.setValue("0");
|
|
|
|
|
|
|
|
|
|
condition.add(moveTypeItem);
|
|
|
|
|
condition.add(compBrowserItem);
|
|
|
|
@ -471,6 +475,7 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public int moveDepartment(DepartmentMoveParam moveParam) {
|
|
|
|
|
OrganizationAssert.isTrue(hasRight(), "暂无权限");
|
|
|
|
|
OrganizationAssert.notBlank(moveParam.getMoveType(), "请选择转移类型");
|
|
|
|
|
DepartmentPO deptById = getDepartmentMapper().getDeptById(moveParam.getId());
|
|
|
|
|
// 0:公司/分部 1:部门
|
|
|
|
@ -648,5 +653,12 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 是否有该模块权限
|
|
|
|
|
*
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
private boolean hasRight() {
|
|
|
|
|
return HrmUserVarify.checkUserRight("Department:All", user);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|