|
|
|
@ -12,16 +12,16 @@ import com.engine.core.impl.Service;
|
|
|
|
|
import com.engine.hrm.service.impl.OrganizationServiceImpl;
|
|
|
|
|
import com.engine.organization.component.OrganizationWeaTable;
|
|
|
|
|
import com.engine.organization.entity.DeleteParam;
|
|
|
|
|
import com.engine.organization.entity.company.bo.CompanyBO;
|
|
|
|
|
import com.engine.organization.entity.company.dto.CompanyListDTO;
|
|
|
|
|
import com.engine.organization.entity.company.param.CompanyParam;
|
|
|
|
|
import com.engine.organization.entity.company.po.CompanyPO;
|
|
|
|
|
import com.engine.organization.entity.company.bo.CompBO;
|
|
|
|
|
import com.engine.organization.entity.company.dto.CompListDTO;
|
|
|
|
|
import com.engine.organization.entity.company.param.CompParam;
|
|
|
|
|
import com.engine.organization.entity.company.po.CompPO;
|
|
|
|
|
import com.engine.organization.entity.department.param.DepartmentMoveParam;
|
|
|
|
|
import com.engine.organization.entity.extend.po.ExtendTitlePO;
|
|
|
|
|
import com.engine.organization.enums.LogModuleNameEnum;
|
|
|
|
|
import com.engine.organization.enums.OperateTypeEnum;
|
|
|
|
|
import com.engine.organization.exception.OrganizationRunTimeException;
|
|
|
|
|
import com.engine.organization.mapper.comp.CompanyMapper;
|
|
|
|
|
import com.engine.organization.mapper.comp.CompMapper;
|
|
|
|
|
import com.engine.organization.mapper.extend.ExtendTitleMapper;
|
|
|
|
|
import com.engine.organization.service.CompService;
|
|
|
|
|
import com.engine.organization.service.ExtService;
|
|
|
|
@ -81,8 +81,8 @@ public class CompServiceImpl extends Service implements CompService {
|
|
|
|
|
*/
|
|
|
|
|
private static final Long GROUP_ID = 1L;
|
|
|
|
|
|
|
|
|
|
private static CompanyMapper getCompanyMapper() {
|
|
|
|
|
return MapperProxyFactory.getProxy(CompanyMapper.class);
|
|
|
|
|
private static CompMapper getCompMapper() {
|
|
|
|
|
return MapperProxyFactory.getProxy(CompMapper.class);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private ExtendTitleMapper getExtendTitleMapper() {
|
|
|
|
@ -95,44 +95,44 @@ public class CompServiceImpl extends Service implements CompService {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Map<String, Object> listPage(CompanyParam params) {
|
|
|
|
|
public Map<String, Object> listPage(CompParam params) {
|
|
|
|
|
Map<String, Object> datas = new HashMap<>();
|
|
|
|
|
boolean hasRight = HasRightUtil.hasRight(user, RIGHT_NAME, true);
|
|
|
|
|
datas.put("hasRight", hasRight);
|
|
|
|
|
if (!hasRight) {
|
|
|
|
|
return datas;
|
|
|
|
|
}
|
|
|
|
|
CompanyPO companyPO = CompanyBO.convertParamToPO(params, user.getUID());
|
|
|
|
|
CompPO companyPO = CompBO.convertParamToPO(params, user.getUID());
|
|
|
|
|
boolean filter = isFilter(companyPO);
|
|
|
|
|
PageInfo<CompanyListDTO> pageInfos;
|
|
|
|
|
PageInfo<CompListDTO> pageInfos;
|
|
|
|
|
String orderSql = PageInfoSortUtil.getSortSql(params.getSortParams()," showorder ");
|
|
|
|
|
List<CompanyPO> allList = getCompanyMapper().listAll(orderSql);
|
|
|
|
|
List<CompPO> allList = getCompMapper().listAll(orderSql);
|
|
|
|
|
|
|
|
|
|
new DetachUtil(user.getUID()).filterCompanyList(allList);
|
|
|
|
|
|
|
|
|
|
// 通过子级遍历父级元素
|
|
|
|
|
if (filter) {
|
|
|
|
|
// 根据条件获取元素
|
|
|
|
|
List<CompanyPO> filterCompPOs = getCompanyMapper().listByFilter(companyPO, orderSql);
|
|
|
|
|
List<CompPO> filterCompPOs = getCompMapper().listByFilter(companyPO, orderSql);
|
|
|
|
|
new DetachUtil(user.getUID()).filterCompanyList(filterCompPOs);
|
|
|
|
|
|
|
|
|
|
// 添加父级元素
|
|
|
|
|
List<CompanyListDTO> compListDTOS = CompanyBO.buildCompDTOList(allList, filterCompPOs);
|
|
|
|
|
List<CompanyListDTO> subList = PageUtil.subList(params.getCurrent(), params.getPageSize(), compListDTOS);
|
|
|
|
|
pageInfos = new PageInfo<>(subList, CompanyListDTO.class);
|
|
|
|
|
List<CompListDTO> compListDTOS = CompBO.buildCompDTOList(allList, filterCompPOs);
|
|
|
|
|
List<CompListDTO> subList = PageUtil.subList(params.getCurrent(), params.getPageSize(), compListDTOS);
|
|
|
|
|
pageInfos = new PageInfo<>(subList, CompListDTO.class);
|
|
|
|
|
pageInfos.setTotal(compListDTOS.size());
|
|
|
|
|
} else {
|
|
|
|
|
// 组合list
|
|
|
|
|
List<CompanyListDTO> compListDTOS = CompanyBO.buildCompDTOList(allList);
|
|
|
|
|
List<CompanyListDTO> subList = PageUtil.subList(params.getCurrent(), params.getPageSize(), compListDTOS);
|
|
|
|
|
pageInfos = new PageInfo<>(subList, CompanyListDTO.class);
|
|
|
|
|
List<CompListDTO> compListDTOS = CompBO.buildCompDTOList(allList);
|
|
|
|
|
List<CompListDTO> subList = PageUtil.subList(params.getCurrent(), params.getPageSize(), compListDTOS);
|
|
|
|
|
pageInfos = new PageInfo<>(subList, CompListDTO.class);
|
|
|
|
|
pageInfos.setTotal(compListDTOS.size());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pageInfos.setPageNum(params.getCurrent());
|
|
|
|
|
pageInfos.setPageSize(params.getPageSize());
|
|
|
|
|
|
|
|
|
|
OrganizationWeaTable<CompanyListDTO> table = new OrganizationWeaTable<>(user, CompanyListDTO.class);
|
|
|
|
|
OrganizationWeaTable<CompListDTO> table = new OrganizationWeaTable<>(user, CompListDTO.class);
|
|
|
|
|
List<Column> columns = pageInfos.getColumns();
|
|
|
|
|
List<WeaTableColumn> weaTableColumn = columns.stream().map(v -> new WeaTableColumn("100", v.getTitle(), v.getKey())).collect(Collectors.toList());
|
|
|
|
|
table.setColumns(weaTableColumn);
|
|
|
|
@ -156,9 +156,9 @@ public class CompServiceImpl extends Service implements CompService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public int updateForbiddenTagById(CompanyParam params) {
|
|
|
|
|
public int updateForbiddenTagById(CompParam params) {
|
|
|
|
|
HasRightUtil.hasRight(user, RIGHT_NAME, false);
|
|
|
|
|
CompanyPO compPO = CompanyPO.builder().id(params.getId()).canceled(params.getCanceled() ? 0 : 1).build();
|
|
|
|
|
CompPO compPO = CompPO.builder().id(params.getId()).canceled(params.getCanceled() ? 0 : 1).build();
|
|
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
|
|
map.put("id", compPO.getId().toString());
|
|
|
|
|
map.put("forbiddenTag", compPO.getCanceled());
|
|
|
|
@ -415,7 +415,7 @@ public class CompServiceImpl extends Service implements CompService {
|
|
|
|
|
// 判断目标分部是否为它本身以及子元素
|
|
|
|
|
Set<Integer> disableIds = new HashSet<>();
|
|
|
|
|
disableIds.add(companyId);
|
|
|
|
|
List<CompanyPO> compPOS = getCompanyMapper().listChild(DeleteParam.builder().ids(companyId.toString()).build().getIds());
|
|
|
|
|
List<CompPO> compPOS = getCompMapper().listChild(DeleteParam.builder().ids(companyId.toString()).build().getIds());
|
|
|
|
|
if (CollectionUtils.isNotEmpty(compPOS)) {
|
|
|
|
|
addDisableIds(disableIds, compPOS);
|
|
|
|
|
}
|
|
|
|
@ -435,7 +435,7 @@ public class CompServiceImpl extends Service implements CompService {
|
|
|
|
|
* @param companyPO
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
private boolean isFilter(CompanyPO companyPO) {
|
|
|
|
|
private boolean isFilter(CompPO companyPO) {
|
|
|
|
|
return StringUtils.isNotBlank(companyPO.getSubCompanyCode()) || StringUtils.isNotBlank(companyPO.getSubCompanyDesc()) || StringUtils.isNotBlank(companyPO.getSubCompanyName()) || null != companyPO.getSupSubComId();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -479,10 +479,10 @@ public class CompServiceImpl extends Service implements CompService {
|
|
|
|
|
* @param disableIds
|
|
|
|
|
* @param compPOS
|
|
|
|
|
*/
|
|
|
|
|
private void addDisableIds(Set<Integer> disableIds, List<CompanyPO> compPOS) {
|
|
|
|
|
for (CompanyPO compPO : compPOS) {
|
|
|
|
|
private void addDisableIds(Set<Integer> disableIds, List<CompPO> compPOS) {
|
|
|
|
|
for (CompPO compPO : compPOS) {
|
|
|
|
|
disableIds.add(compPO.getId());
|
|
|
|
|
List<CompanyPO> childCompPOS = getCompanyMapper().listChild(DeleteParam.builder().ids(compPO.getId().toString()).build().getIds());
|
|
|
|
|
List<CompPO> childCompPOS = getCompMapper().listChild(DeleteParam.builder().ids(compPO.getId().toString()).build().getIds());
|
|
|
|
|
addDisableIds(disableIds, childCompPOS);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|