|
|
|
@ -24,6 +24,7 @@ import com.engine.organization.entity.hrmresource.param.SearchTemplateParam;
|
|
|
|
|
import com.engine.organization.entity.hrmresource.po.HrmRelationPO;
|
|
|
|
|
import com.engine.organization.entity.hrmresource.po.JclOrgCustomTemplatePO;
|
|
|
|
|
import com.engine.organization.entity.hrmresource.po.SearchTemplatePO;
|
|
|
|
|
import com.engine.organization.entity.hrmresource.po.TransferDataPO;
|
|
|
|
|
import com.engine.organization.entity.hrmresource.vo.HrmResourceVO;
|
|
|
|
|
import com.engine.organization.entity.jclimport.po.CusFormFieldPO;
|
|
|
|
|
import com.engine.organization.entity.job.bo.JobBO;
|
|
|
|
@ -194,42 +195,43 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
|
|
|
|
|
@Override
|
|
|
|
|
public String getTemplateSelectKeys(Map<String, Object> params) {
|
|
|
|
|
String templateId = Util.null2String(params.get("templateId"));
|
|
|
|
|
String column = Util.null2String(params.get("column"));
|
|
|
|
|
templateId = StringUtils.isBlank(templateId) ? "-1" : templateId;
|
|
|
|
|
String type = Util.null2String(params.get("type"));
|
|
|
|
|
OrganizationAssert.isTrue(StringUtils.isNotBlank(templateId), "数据有误,未找到对应数据");
|
|
|
|
|
// 判断是否为搜索模板
|
|
|
|
|
if (StringUtils.isBlank(column)) {
|
|
|
|
|
SearchTemplatePO searchTemplateById = getHrmResourceMapper().getSearchTemplateById(templateId);
|
|
|
|
|
String basicFields = searchTemplateById.getBasicFields();
|
|
|
|
|
String personalFields = searchTemplateById.getPersonalFields();
|
|
|
|
|
String workflowFields = searchTemplateById.getWorkFields();
|
|
|
|
|
List<String> selectKeys = new ArrayList<>();
|
|
|
|
|
if (StringUtils.isNotBlank(basicFields)) {
|
|
|
|
|
selectKeys.addAll(Arrays.asList(basicFields.split(",")));
|
|
|
|
|
}
|
|
|
|
|
if (StringUtils.isNotBlank(personalFields)) {
|
|
|
|
|
selectKeys.addAll(Arrays.asList(personalFields.split(",")));
|
|
|
|
|
SearchTemplatePO searchTemplateById;
|
|
|
|
|
List<String> selectKeys;
|
|
|
|
|
if ("custom".equals(type)) {
|
|
|
|
|
if ("-1".equals(templateId)) {
|
|
|
|
|
selectKeys = Arrays.asList("-1_hrm_lastname,-1_hrm_departmentid,-1_hrm_jobtitle,-1_hrm_mobile,-1_hrm_telephone,-1_hrm_managerid".split(","));
|
|
|
|
|
} else {
|
|
|
|
|
searchTemplateById = getHrmResourceMapper().getCustomTemplateById(templateId);
|
|
|
|
|
selectKeys = getSelectKeys(searchTemplateById);
|
|
|
|
|
}
|
|
|
|
|
if (StringUtils.isNotBlank(workflowFields)) {
|
|
|
|
|
selectKeys.addAll(Arrays.asList(workflowFields.split(",")));
|
|
|
|
|
} else {
|
|
|
|
|
if ("-1".equals(templateId)) {
|
|
|
|
|
selectKeys = getAllConditions().get(0).getItems().stream().map(item -> item.getDomkey()[0]).collect(Collectors.toList());
|
|
|
|
|
} else {
|
|
|
|
|
searchTemplateById = getHrmResourceMapper().getSearchTemplateById(templateId);
|
|
|
|
|
selectKeys = getSelectKeys(searchTemplateById);
|
|
|
|
|
}
|
|
|
|
|
return StringUtils.join(selectKeys, ",");
|
|
|
|
|
}
|
|
|
|
|
return "";
|
|
|
|
|
|
|
|
|
|
return StringUtils.join(selectKeys, ",");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<SearchTemplateParam> getSearchTemplate(Map<String, Object> params) {
|
|
|
|
|
String templateId = StringUtils.isNotBlank(Util.null2String(params.get("templateId"))) ? Util.null2String(params.get("templateId")) : "-1";
|
|
|
|
|
String type = Util.null2String(params.get("type"));
|
|
|
|
|
int userUID = user.getUID();
|
|
|
|
|
// 根据ID查询所存储的模板
|
|
|
|
|
List<SearchTemplateParam> templates = getHrmResourceMapper().getSearchTemplatesByUser(userUID);
|
|
|
|
|
List<SearchTemplateParam> templates;
|
|
|
|
|
if ("custom".equals(type)) {
|
|
|
|
|
templates = getHrmResourceMapper().getCustomTemplatesByUser(userUID);
|
|
|
|
|
} else {
|
|
|
|
|
templates = getHrmResourceMapper().getSearchTemplatesByUser(userUID);
|
|
|
|
|
}
|
|
|
|
|
templates.add(0, SearchTemplateParam.builder().key("-1").selected(false).showname("默认模板").build());
|
|
|
|
|
templates.forEach(item -> {
|
|
|
|
|
if (templateId.equals(item.getKey())) {
|
|
|
|
|
item.setSelected(true);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
return templates;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -252,6 +254,38 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
|
|
|
|
|
getHrmResourceMapper().deleteCustomTemplate(id, user.getUID());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Map<String, Object> getCustomTransferData(Map<String, Object> params) {
|
|
|
|
|
Map<String, Object> resultMap = new HashMap<>();
|
|
|
|
|
String templateId = StringUtils.isNotBlank(Util.null2String(params.get("templateId"))) ? Util.null2String(params.get("templateId")) : "-1";
|
|
|
|
|
List<TransferDataPO> transferDatas = new ArrayList<>();
|
|
|
|
|
List<String> transferKeys = new ArrayList<>();
|
|
|
|
|
List<SearchTemplateParam> transferOptions = new ArrayList<>();
|
|
|
|
|
List<SearchConditionGroup> allConditions = getAllConditions();
|
|
|
|
|
AtomicInteger idx = new AtomicInteger(0);
|
|
|
|
|
for (SearchConditionGroup allCondition : allConditions) {
|
|
|
|
|
List<SearchConditionItem> items = allCondition.getItems();
|
|
|
|
|
List<TransferDataPO> collect = items.stream().map(item -> TransferDataPO.builder().id(item.getDomkey()[0]).label(item.getLabel()).title(allCondition.getTitle()).idx(Integer.toString(idx.get())).build()).collect(Collectors.toList());
|
|
|
|
|
if (CollectionUtils.isNotEmpty(collect)) {
|
|
|
|
|
transferDatas.addAll(collect);
|
|
|
|
|
}
|
|
|
|
|
transferOptions.add(SearchTemplateParam.builder().key(Integer.toString(idx.getAndIncrement())).showname(allCondition.getTitle()).build());
|
|
|
|
|
}
|
|
|
|
|
if ("-1".equals(templateId)) {
|
|
|
|
|
String selectKeys = "-1_hrm_lastname,-1_hrm_departmentid,-1_hrm_jobtitle,-1_hrm_mobile,-1_hrm_telephone,-1_hrm_managerid";
|
|
|
|
|
transferKeys = Arrays.asList(selectKeys.split(","));
|
|
|
|
|
} else {
|
|
|
|
|
SearchTemplatePO searchTemplateById = getHrmResourceMapper().getCustomTemplateById(templateId);
|
|
|
|
|
transferKeys = getSelectKeys(searchTemplateById);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
resultMap.put("transferDatas", transferDatas);
|
|
|
|
|
resultMap.put("transferKeys", transferKeys);
|
|
|
|
|
resultMap.put("transferOptions", transferOptions);
|
|
|
|
|
|
|
|
|
|
return resultMap;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Map<String, Object> getSearchCondition(Map<String, Object> params) {
|
|
|
|
|
String templateId = Util.null2String(params.get("templateId"));
|
|
|
|
@ -946,6 +980,11 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
|
|
|
|
|
return sb.toString();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 为下拉框搜索条件、添加空选项
|
|
|
|
|
*
|
|
|
|
|
* @param searchConditionItem
|
|
|
|
|
*/
|
|
|
|
|
private void addEmptyForSelect(SearchConditionItem searchConditionItem) {
|
|
|
|
|
searchConditionItem.setValue("");
|
|
|
|
|
List<SearchConditionOption> options = searchConditionItem.getOptions();
|
|
|
|
@ -959,6 +998,29 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 根据模板示例,组装所有selectKeys
|
|
|
|
|
*
|
|
|
|
|
* @param searchTemplatePO
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
private List<String> getSelectKeys(SearchTemplatePO searchTemplatePO) {
|
|
|
|
|
List<String> selectKeys = new ArrayList<>();
|
|
|
|
|
String basicFields = searchTemplatePO.getBasicFields();
|
|
|
|
|
String personalFields = searchTemplatePO.getPersonalFields();
|
|
|
|
|
String workflowFields = searchTemplatePO.getWorkFields();
|
|
|
|
|
if (StringUtils.isNotBlank(basicFields)) {
|
|
|
|
|
selectKeys.addAll(Arrays.asList(basicFields.split(",")));
|
|
|
|
|
}
|
|
|
|
|
if (StringUtils.isNotBlank(personalFields)) {
|
|
|
|
|
selectKeys.addAll(Arrays.asList(personalFields.split(",")));
|
|
|
|
|
}
|
|
|
|
|
if (StringUtils.isNotBlank(workflowFields)) {
|
|
|
|
|
selectKeys.addAll(Arrays.asList(workflowFields.split(",")));
|
|
|
|
|
}
|
|
|
|
|
return selectKeys;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static String getFieldName(String fieldabel) {
|
|
|
|
|
RecordSet recordSet = new RecordSet();
|
|
|
|
|
String fieldname = null;
|
|
|
|
|