|
|
|
@ -21,6 +21,7 @@ import com.engine.organization.util.db.MapperProxyFactory;
|
|
|
|
|
import com.engine.organization.util.page.Column;
|
|
|
|
|
import com.engine.organization.util.page.PageInfo;
|
|
|
|
|
import com.engine.organization.util.page.PageUtil;
|
|
|
|
|
import weaver.general.StringUtil;
|
|
|
|
|
|
|
|
|
|
import java.util.*;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
@ -38,16 +39,24 @@ public class CompServiceImpl extends Service implements CompService {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Map<String, Object> listPage(CompSearchParam params) {
|
|
|
|
|
Map<String,Object> datas = new HashMap<>();
|
|
|
|
|
Map<String, Object> datas = new HashMap<>();
|
|
|
|
|
PageUtil.start(params.getCurrent(), params.getPageSize());
|
|
|
|
|
List<CompPO> list = getCompMapper().list(CompBO.convertParamToPO(params,(long) user.getUID()));
|
|
|
|
|
List<CompPO> list = getCompMapper().list(CompBO.convertParamToPO(params, (long) user.getUID()));
|
|
|
|
|
PageInfo<CompPO> pageInfo = new PageInfo<>(list, CompPO.class);
|
|
|
|
|
Collection<CompPO> compPOS = pageInfo.getList();
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
List<CompListDTO> compListDTOS = CompBO.buildCompDTOList(compPOS);
|
|
|
|
|
// 搜索条件过滤数据
|
|
|
|
|
List<CompPO> filterList = filterListByParams(compPOS, params);
|
|
|
|
|
// 递归添加父级数据
|
|
|
|
|
Map<Long, CompPO> poMaps = list.stream().collect(Collectors.toMap(item -> item.getId(), item -> item));
|
|
|
|
|
List<CompPO> addedList = new ArrayList<>();
|
|
|
|
|
for (CompPO po : filterList) {
|
|
|
|
|
dealParentData(addedList, po, poMaps);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<CompListDTO> compListDTOS = CompBO.buildCompDTOList(addedList);
|
|
|
|
|
PageInfo<CompListDTO> pageInfos = new PageInfo<>(compListDTOS, CompListDTO.class);
|
|
|
|
|
pageInfos.setTotal(pageInfo.getTotal());
|
|
|
|
|
pageInfos.setTotal(pageInfos.getTotal());
|
|
|
|
|
pageInfos.setPageNum(params.getCurrent());
|
|
|
|
|
pageInfos.setPageSize(params.getPageSize());
|
|
|
|
|
|
|
|
|
@ -55,6 +64,7 @@ public class CompServiceImpl extends Service implements CompService {
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
WeaResultMsg result = new WeaResultMsg(false);
|
|
|
|
@ -63,7 +73,7 @@ public class CompServiceImpl extends Service implements CompService {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
datas.put("pageInfo", pageInfos);
|
|
|
|
|
datas.put("dataKey",result.getResultMap());
|
|
|
|
|
datas.put("dataKey", result.getResultMap());
|
|
|
|
|
return datas;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -101,11 +111,11 @@ public class CompServiceImpl extends Service implements CompService {
|
|
|
|
|
SearchConditionItem compPrincipalItem = OrganizationFormItemUtil.inputItem(user, 2, 16, 2, 50, "负责人", "compPrincipal");
|
|
|
|
|
// 禁用标记
|
|
|
|
|
List<SearchConditionOption> selectOptions = new ArrayList<>();
|
|
|
|
|
SearchConditionOption enableOption = new SearchConditionOption("0","启用");
|
|
|
|
|
SearchConditionOption disableOption = new SearchConditionOption("1","禁用");
|
|
|
|
|
SearchConditionOption enableOption = new SearchConditionOption("0", "启用");
|
|
|
|
|
SearchConditionOption disableOption = new SearchConditionOption("1", "禁用");
|
|
|
|
|
selectOptions.add(enableOption);
|
|
|
|
|
selectOptions.add(disableOption);
|
|
|
|
|
SearchConditionItem forbiddenTagItem= OrganizationFormItemUtil.selectItem(user,selectOptions,2,16,6,false,"禁用标记","forbiddenTag");
|
|
|
|
|
SearchConditionItem forbiddenTagItem = OrganizationFormItemUtil.selectItem(user, selectOptions, 2, 16, 6, false, "禁用标记", "forbiddenTag");
|
|
|
|
|
|
|
|
|
|
conditionItems.add(compNoItem);
|
|
|
|
|
conditionItems.add(compNameItem);
|
|
|
|
@ -125,4 +135,43 @@ public class CompServiceImpl extends Service implements CompService {
|
|
|
|
|
public Map<String, Object> getHasRight() {
|
|
|
|
|
return MenuBtn.getCommonBtnDatas();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private List<CompPO> filterListByParams(Collection<CompPO> compPOS, CompSearchParam params) {
|
|
|
|
|
// 搜索后的数据
|
|
|
|
|
List<CompPO> filterList = new ArrayList<>();
|
|
|
|
|
// 筛选数据
|
|
|
|
|
for (Iterator<CompPO> iterator = compPOS.iterator(); iterator.hasNext(); ) {
|
|
|
|
|
CompPO next = iterator.next();
|
|
|
|
|
boolean isAdd = (StringUtil.isEmpty(params.getCompName()) || next.getCompName().contains(params.getCompName())) // 名称
|
|
|
|
|
&& (StringUtil.isEmpty(params.getCompNo()) || next.getCompNo().contains(params.getCompNo()))//编号
|
|
|
|
|
&& (StringUtil.isEmpty(params.getCompNameShort()) || next.getCompNameShort().contains(params.getCompNameShort()))//简称
|
|
|
|
|
&& (null == params.getParentCompany() || next.getParentCompany().equals(params.getParentCompany()))//上级公司
|
|
|
|
|
&& (StringUtil.isEmpty(params.getOrgCode()) || next.getOrgCode().contains(params.getOrgCode()))//组织机构代码
|
|
|
|
|
&& (null == params.getIndustry() || next.getIndustry().equals(params.getIndustry()))//行业
|
|
|
|
|
&& (null == params.getCompPrincipal() || next.getCompPrincipal().equals(params.getCompPrincipal()))//负责人
|
|
|
|
|
&& (null == params.getForbiddenTag() || next.getForbiddenTag().equals(params.getForbiddenTag()));//禁用标记
|
|
|
|
|
if (isAdd) {
|
|
|
|
|
filterList.add(next);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
return filterList;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 递归获取查询后数据的父级数据
|
|
|
|
|
*
|
|
|
|
|
* @param addedList
|
|
|
|
|
* @param po
|
|
|
|
|
* @param poMaps
|
|
|
|
|
*/
|
|
|
|
|
private void dealParentData(List<CompPO> addedList, CompPO po, Map<Long, CompPO> poMaps) {
|
|
|
|
|
if (!addedList.contains(po)) {
|
|
|
|
|
addedList.add(po);
|
|
|
|
|
}
|
|
|
|
|
CompPO parentCompPO = poMaps.get(po.getParentCompany());
|
|
|
|
|
if (null != parentCompPO) {
|
|
|
|
|
dealParentData(addedList, parentCompPO, poMaps);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|