|
|
|
@ -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<SingleDeptTreeVO> getDeptListByPid(QuerySingleDeptListParam param) {
|
|
|
|
|
OrganizationAssert.isTrue(hasRight(), "暂无权限");
|
|
|
|
|
HasRightUtil.hasRight(user, RIGHT_NAME, false);
|
|
|
|
|
//1.查询分部下所有部门
|
|
|
|
|
//PageUtil.start(param.getCurrent(), param.getPageSize());
|
|
|
|
|
List<DepartmentPO> departmentPOS = MapperProxyFactory.getProxy(DepartmentMapper.class).list();
|
|
|
|
@ -109,7 +111,7 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public PageInfo<SingleJobTreeVO> getJobListByPid(QuerySingleDeptListParam param) {
|
|
|
|
|
OrganizationAssert.isTrue(hasRight(), "暂无权限");
|
|
|
|
|
HasRightUtil.hasRight(user, RIGHT_NAME, false);
|
|
|
|
|
List<JobPO> jobPOS = MapperProxyFactory.getProxy(JobMapper.class).listAll();
|
|
|
|
|
PageInfo<JobPO> pageInfo = new PageInfo<>(jobPOS);
|
|
|
|
|
List<SingleJobTreeVO> singleDeptTreeVOS = JobBO.buildSingleJobTreeVOS(jobPOS, param.getParentDept());
|
|
|
|
@ -123,7 +125,7 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Map<String, Object> 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<String, Object> listPage(DeptSearchParam param) {
|
|
|
|
|
Map<String, Object> 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<DepartmentPO> 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<String, Object> 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<Long> ids) {
|
|
|
|
|
OrganizationAssert.isTrue(hasRight(), "暂无权限");
|
|
|
|
|
HasRightUtil.hasRight(user, RIGHT_NAME, false);
|
|
|
|
|
OrganizationAssert.notEmpty(ids, "请选择要删除的数据");
|
|
|
|
|
return getDepartmentMapper().deleteByIds(ids);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Map<String, Object> getSearchCondition(Map<String, Object> params) {
|
|
|
|
|
OrganizationAssert.isTrue(hasRight(), "暂无权限");
|
|
|
|
|
HasRightUtil.hasRight(user, RIGHT_NAME, false);
|
|
|
|
|
Map<String, Object> apiDatas = new HashMap<>();
|
|
|
|
|
List<SearchConditionGroup> addGroups = new ArrayList<>();
|
|
|
|
|
List<SearchConditionItem> conditionItems = new ArrayList<>();
|
|
|
|
@ -263,13 +266,13 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Map<String, Object> getHasRight() {
|
|
|
|
|
OrganizationAssert.isTrue(hasRight(), "暂无权限");
|
|
|
|
|
HasRightUtil.hasRight(user, RIGHT_NAME, false);
|
|
|
|
|
return MenuBtn.getDatasHasCopy();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Map<String, Object> getDeptBaseForm(Map<String, Object> 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<String, Object> getSaveForm() {
|
|
|
|
|
OrganizationAssert.isTrue(hasRight(), "暂无权限");
|
|
|
|
|
HasRightUtil.hasRight(user, RIGHT_NAME, false);
|
|
|
|
|
Map<String, Object> apiDatas = new HashMap<>();
|
|
|
|
|
List<SearchConditionGroup> addGroups = new ArrayList<>();
|
|
|
|
|
List<SearchConditionItem> conditionItems = new ArrayList<>();
|
|
|
|
@ -358,7 +361,7 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public List<SearchConditionGroup> getCopyForm() {
|
|
|
|
|
OrganizationAssert.isTrue(hasRight(), "暂无权限");
|
|
|
|
|
HasRightUtil.hasRight(user, RIGHT_NAME, false);
|
|
|
|
|
List<SearchConditionGroup> addGroups = new ArrayList<>();
|
|
|
|
|
List<SearchConditionItem> 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<Long> 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<SearchConditionGroup> getMergeForm(Long id) {
|
|
|
|
|
OrganizationAssert.isTrue(hasRight(), "暂无权限");
|
|
|
|
|
HasRightUtil.hasRight(user, RIGHT_NAME, false);
|
|
|
|
|
List<SearchConditionGroup> addGroups = new ArrayList<>();
|
|
|
|
|
List<SearchConditionItem> 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<SearchConditionGroup> getMoveForm() {
|
|
|
|
|
OrganizationAssert.isTrue(hasRight(), "暂无权限");
|
|
|
|
|
HasRightUtil.hasRight(user, RIGHT_NAME, false);
|
|
|
|
|
List<SearchConditionGroup> addGroups = new ArrayList<>();
|
|
|
|
|
List<SearchConditionItem> 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);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|