|
|
|
@ -11,6 +11,7 @@ import com.engine.common.util.ServiceUtil;
|
|
|
|
|
import com.engine.core.impl.Service;
|
|
|
|
|
import com.engine.hrm.entity.RuleCodeType;
|
|
|
|
|
import com.engine.organization.component.OrganizationWeaTable;
|
|
|
|
|
import com.engine.organization.entity.DeleteParam;
|
|
|
|
|
import com.engine.organization.entity.codesetting.po.CodeRulePO;
|
|
|
|
|
import com.engine.organization.entity.company.bo.CompBO;
|
|
|
|
|
import com.engine.organization.entity.company.dto.CompListDTO;
|
|
|
|
@ -294,11 +295,29 @@ public class CompServiceImpl extends Service implements CompService {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<SearchConditionGroup> getMoveForm() {
|
|
|
|
|
List<SearchConditionGroup> addGroups = new ArrayList<>();
|
|
|
|
|
List<SearchConditionItem> condition = new ArrayList<>();
|
|
|
|
|
SearchConditionItem compBrowserItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "转移到", "161", "company", "compBrowser");
|
|
|
|
|
condition.add(compBrowserItem);
|
|
|
|
|
addGroups.add(new SearchConditionGroup("", true, condition));
|
|
|
|
|
return addGroups;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public int moveCompany(DepartmentMoveParam moveParam) {
|
|
|
|
|
Long targetCompanyId = moveParam.getCompany();
|
|
|
|
|
OrganizationAssert.notNull(targetCompanyId, "请选择要转移到的分部");
|
|
|
|
|
Long companyId = moveParam.getId();
|
|
|
|
|
// 判断目标分部是否为它本身以及子元素
|
|
|
|
|
Set<Long> disableIds = new HashSet<>();
|
|
|
|
|
disableIds.add(companyId);
|
|
|
|
|
List<CompPO> compPOS = getCompMapper().listChild(DeleteParam.builder().ids(companyId.toString()).build().getIds());
|
|
|
|
|
if (CollectionUtils.isNotEmpty(compPOS)) {
|
|
|
|
|
addDisableIds(disableIds, compPOS);
|
|
|
|
|
}
|
|
|
|
|
OrganizationAssert.isFalse(disableIds.contains(targetCompanyId), "请勿选择当前分部本身及其子分部");
|
|
|
|
|
CompPO compPO = getCompMapper().listById(companyId);
|
|
|
|
|
compPO.setParentCompany(targetCompanyId);
|
|
|
|
|
return getCompMapper().updateBaseComp(compPO);
|
|
|
|
@ -356,4 +375,18 @@ public class CompServiceImpl extends Service implements CompService {
|
|
|
|
|
return generateCode;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 添加子元素ID
|
|
|
|
|
*
|
|
|
|
|
* @param disableIds
|
|
|
|
|
* @param compPOS
|
|
|
|
|
*/
|
|
|
|
|
private void addDisableIds(Set<Long> disableIds, List<CompPO> compPOS) {
|
|
|
|
|
for (CompPO compPO : compPOS) {
|
|
|
|
|
disableIds.add(compPO.getId());
|
|
|
|
|
List<CompPO> childCompPOS = getCompMapper().listChild(DeleteParam.builder().ids(compPO.getId().toString()).build().getIds());
|
|
|
|
|
addDisableIds(disableIds, childCompPOS);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|