|
|
|
@ -34,6 +34,7 @@ import com.engine.organization.entity.search.QuickSearchDetail;
|
|
|
|
|
import com.engine.organization.entity.searchtree.SearchTree;
|
|
|
|
|
import com.engine.organization.entity.searchtree.SearchTreeParams;
|
|
|
|
|
import com.engine.organization.enums.HrmGroupEnum;
|
|
|
|
|
import com.engine.organization.exception.OrganizationRunTimeException;
|
|
|
|
|
import com.engine.organization.mapper.comp.CompMapper;
|
|
|
|
|
import com.engine.organization.mapper.condition.QuickSearchMapper;
|
|
|
|
|
import com.engine.organization.mapper.department.DepartmentMapper;
|
|
|
|
@ -320,19 +321,32 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
|
|
|
|
|
int userUID = user.getUID();
|
|
|
|
|
// 根据ID查询所存储的模板
|
|
|
|
|
List<SearchTemplateParam> templates;
|
|
|
|
|
boolean addDefault = true;
|
|
|
|
|
if ("custom".equals(type)) {
|
|
|
|
|
templates = getHrmResourceMapper().getCustomTemplatesByUser(userUID);
|
|
|
|
|
SearchTemplatePO overallCustomTemplate = getHrmResourceMapper().getOverallCustomTemplate();
|
|
|
|
|
if (null != overallCustomTemplate) {
|
|
|
|
|
if("-1".equals(id)) {
|
|
|
|
|
id = overallCustomTemplate.getId().toString();
|
|
|
|
|
}
|
|
|
|
|
templates.add(SearchTemplateParam.builder().key(overallCustomTemplate.getId().toString()).showname(overallCustomTemplate.getName()).build());
|
|
|
|
|
//}
|
|
|
|
|
addDefault = false;
|
|
|
|
|
}
|
|
|
|
|
returnMap.put("id", id);
|
|
|
|
|
} else {
|
|
|
|
|
templates = getHrmResourceMapper().getSearchTemplatesByUser(userUID);
|
|
|
|
|
}
|
|
|
|
|
templates.add(0, SearchTemplateParam.builder().key("-1").showname("默认模板").build());
|
|
|
|
|
if (addDefault) {
|
|
|
|
|
templates.add(0, SearchTemplateParam.builder().key("-1").showname("默认模板").build());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//1.增加全局模板
|
|
|
|
|
if (userUID != 1) {
|
|
|
|
|
templates.addAll(getHrmResourceMapper().getCustomOverAll());
|
|
|
|
|
}
|
|
|
|
|
returnMap.put("templates", templates);
|
|
|
|
|
LinkedHashSet<Object> objects = new LinkedHashSet<>(templates);
|
|
|
|
|
returnMap.put("templates", objects);
|
|
|
|
|
return returnMap;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -423,20 +437,21 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
|
|
|
|
|
}
|
|
|
|
|
transferOptions.add(SearchTemplateParam.builder().key(Integer.toString(idx.getAndIncrement())).showname(allCondition.getTitle()).build());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 查询当前使用的模板,没有使用的,则展示默认模板
|
|
|
|
|
if ("-1".equals(templateId)) {
|
|
|
|
|
// 查询当前使用的模板,没有使用的,则展示默认模板
|
|
|
|
|
SearchTemplatePO usedCustomTemplate = getHrmResourceMapper().getUsedCustomTemplateByUser(user.getUID());
|
|
|
|
|
if (null == usedCustomTemplate) {
|
|
|
|
|
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 {
|
|
|
|
|
transferKeys = getSelectKeys(usedCustomTemplate);
|
|
|
|
|
templateId = usedCustomTemplate.getId().toString();
|
|
|
|
|
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(","));
|
|
|
|
|
SearchTemplatePO overallCustomTemplate = getHrmResourceMapper().getOverallCustomTemplate();
|
|
|
|
|
if (null != overallCustomTemplate) {
|
|
|
|
|
transferKeys = getSelectKeys(overallCustomTemplate);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
SearchTemplatePO searchTemplateById = getHrmResourceMapper().getCustomTemplateById(templateId);
|
|
|
|
|
transferKeys = getSelectKeys(searchTemplateById);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
transferOptions.add(0, SearchTemplateParam.builder().key("").showname("").build());
|
|
|
|
|
resultMap.put("transferDatas", transferDatas);
|
|
|
|
|
resultMap.put("transferKeys", transferKeys);
|
|
|
|
@ -458,13 +473,17 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
|
|
|
|
|
} else {
|
|
|
|
|
jclOrgCustomTemplatePO = getJclOrgCustomTemplateMapper().selectByPrimaryKey(Long.parseLong(templateId));
|
|
|
|
|
if (jclOrgCustomTemplatePO != null) {
|
|
|
|
|
//取消已启用模板
|
|
|
|
|
getJclOrgCustomTemplateMapper().updateUsed(0, "0", null, String.valueOf(user.getUID()));
|
|
|
|
|
if (!user.isAdmin() && jclOrgCustomTemplatePO.getOverall() != null && "1".equals(jclOrgCustomTemplatePO.getOverall().toString())) {
|
|
|
|
|
throw new OrganizationRunTimeException(SystemEnv.getHtmlLabelName(547857, user.getLanguage()));
|
|
|
|
|
}
|
|
|
|
|
jclOrgCustomTemplatePO.setId(Integer.valueOf(templateId));
|
|
|
|
|
jclOrgCustomTemplatePO.setBasicFields(templatePO.getBasicFields());
|
|
|
|
|
jclOrgCustomTemplatePO.setPersonalFields(templatePO.getPersonalFields());
|
|
|
|
|
jclOrgCustomTemplatePO.setWorkFields(templatePO.getWorkFields());
|
|
|
|
|
jclOrgCustomTemplatePO.setIsused(1);
|
|
|
|
|
//取消已启用模板
|
|
|
|
|
getJclOrgCustomTemplateMapper().updateUsed(0,"0", null, String.valueOf(user.getUID()));
|
|
|
|
|
|
|
|
|
|
//启用当前模板
|
|
|
|
|
getJclOrgCustomTemplateMapper().updateByPrimaryKeySelective(jclOrgCustomTemplatePO);
|
|
|
|
|
}
|
|
|
|
@ -535,11 +554,11 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
|
|
|
|
|
RecordSet rs = new RecordSet();
|
|
|
|
|
Map<String, Object> data = new HashMap<>(2);
|
|
|
|
|
//1.将已有所有人的模板状态改变
|
|
|
|
|
rs.executeUpdate("update jcl_org_custom_template set overall = 0 where overall = 1");
|
|
|
|
|
rs.executeUpdate("update jcl_org_custom_template set overall = null where overall = 1");
|
|
|
|
|
//2.应用当前模板到所有人
|
|
|
|
|
String templateId = Util.null2String(params.get("templateId"));
|
|
|
|
|
boolean b = rs.executeUpdate("update jcl_org_custom_template set overall = 1,isused=1 where id = ?", templateId);
|
|
|
|
|
data.put("result",b);
|
|
|
|
|
data.put("result", b);
|
|
|
|
|
return data;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -617,6 +636,7 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取当前用户使用的列定制模板Id
|
|
|
|
|
*
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
private String getCustomTemplateId() {
|
|
|
|
|