花名册高级搜索BUG修复
This commit is contained in:
parent
f7ce6b028a
commit
832fb2b9c4
|
|
@ -5,8 +5,6 @@ import lombok.Builder;
|
|||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2023/01/05
|
||||
|
|
@ -20,5 +18,5 @@ public class SearchTemplateParam {
|
|||
private String key;
|
||||
private boolean selected;
|
||||
private String showname;
|
||||
private List<String> fields;
|
||||
private String fields;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import com.engine.organization.entity.hrmresource.param.HrmRelationSaveParam;
|
|||
import com.engine.organization.entity.hrmresource.param.SearchTemplateParam;
|
||||
import com.engine.organization.entity.searchtree.SearchTreeParams;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
|
|
@ -118,4 +119,12 @@ public interface HrmResourceService {
|
|||
* @return
|
||||
*/
|
||||
String getTemplateSelectKeys(Map<String, Object> params);
|
||||
|
||||
/**
|
||||
* 展示所有搜索模板
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
List<SearchTemplateParam> getSearchTemplate(Map<String, Object> params);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -144,7 +144,7 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
|
|||
|
||||
@Override
|
||||
public Integer saveSearchTemplate(SearchTemplateParam params) {
|
||||
SearchTemplatePO templatePO = buildSearchTemplateByFields(StringUtils.join(params.getFields(), ","));
|
||||
SearchTemplatePO templatePO = buildSearchTemplateByFields(params.getFields());
|
||||
if (null == templatePO) {
|
||||
return -1;
|
||||
}
|
||||
|
|
@ -188,6 +188,21 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
|
|||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SearchTemplateParam> getSearchTemplate(Map<String, Object> params) {
|
||||
String templateId = StringUtils.isNotBlank(Util.null2String(params.get("templateId"))) ? Util.null2String(params.get("templateId")) : "-1";
|
||||
int userUID = user.getUID();
|
||||
// 根据ID查询所存储的模板
|
||||
List<SearchTemplateParam> 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;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getSearchCondition(Map<String, Object> params) {
|
||||
String templateId = Util.null2String(params.get("templateId"));
|
||||
|
|
@ -219,14 +234,6 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
|
|||
}
|
||||
apiDatas.put("defaultcondition", addGroups);
|
||||
apiDatas.put("conditions", allConditions);
|
||||
List<SearchTemplateParam> searchTemplate = getSearchTemplate();
|
||||
String finalTemplateId = templateId;
|
||||
searchTemplate.forEach(item -> {
|
||||
if (finalTemplateId.equals(item.getKey())) {
|
||||
item.setSelected(true);
|
||||
}
|
||||
});
|
||||
apiDatas.put("templates", searchTemplate);
|
||||
return apiDatas;
|
||||
}
|
||||
|
||||
|
|
@ -563,19 +570,6 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取当前人员所有的模板信息
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public List<SearchTemplateParam> getSearchTemplate() {
|
||||
int userUID = user.getUID();
|
||||
// 根据ID查询所存储的模板
|
||||
List<SearchTemplateParam> templates = getHrmResourceMapper().getSearchTemplatesByUser(userUID);
|
||||
templates.add(0, SearchTemplateParam.builder().key("-1").selected(false).showname("默认模板").build());
|
||||
return templates;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有搜索字段信息构建的高级搜索表单
|
||||
*
|
||||
|
|
@ -620,6 +614,10 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
|
|||
*/
|
||||
private void createConditionItems(HrmFieldSearchConditionComInfo hrmFieldSearchConditionComInfo, List<CusFormFieldPO> formFields, List<SearchConditionItem> conditionItems) {
|
||||
for (CusFormFieldPO cusFormFieldPO : formFields) {
|
||||
if ("jobactivity".equals(cusFormFieldPO.getFieldName())) {
|
||||
// 职务:282
|
||||
cusFormFieldPO.setType("282");
|
||||
}
|
||||
HrmFieldBean hrmFieldBean = new HrmFieldBean();
|
||||
hrmFieldBean.setFieldid(Util.null2String(cusFormFieldPO.getFieldId()));
|
||||
hrmFieldBean.setFieldname(cusFormFieldPO.getScopeId() + "_" + cusFormFieldPO.getTableName() + "_" + cusFormFieldPO.getFieldName());
|
||||
|
|
@ -673,6 +671,10 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
|
|||
hrmFieldBean.setIsFormField(true);
|
||||
hrmFieldBean.setIsQuickSearch(false);
|
||||
hrmFieldBean.setIsScope(false);
|
||||
if ("jobactivity".equals(fieldName)) {
|
||||
// 职务:282
|
||||
hrmFieldBean.setType("282");
|
||||
}
|
||||
SearchConditionItem searchConditionItem = hrmFieldSearchConditionComInfo.getSearchConditionItem(hrmFieldBean, user);
|
||||
conditionItems.add(searchConditionItem);
|
||||
// 如果为下拉框,添加一条空选项
|
||||
|
|
@ -798,6 +800,9 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
|
|||
String scopeId = s[0];
|
||||
String tableName = s[1];
|
||||
String fieldName = s[2];
|
||||
if ("jobactivity".equals(fieldName)) {
|
||||
fieldName = "jobactivitydesc";
|
||||
}
|
||||
if ("hrm".equals(tableName)) {
|
||||
sb.append("t.").append(fieldName);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -209,6 +209,19 @@ public class HrmResourceController {
|
|||
}
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/getSearchTemplate")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public ReturnResult getSearchTemplate(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
try {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
Map<String, Object> map = ParamUtil.request2Map(request);
|
||||
return ReturnResult.successed(JSON.toJSON(getHrmResourceWrapper(user).getSearchTemplate(map)));
|
||||
} catch (Exception e) {
|
||||
return ReturnResult.exceptionHandle(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表页顶部按钮
|
||||
*
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ import com.engine.organization.service.impl.HrmResourceServiceImpl;
|
|||
import com.engine.organization.util.OrganizationWrapper;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
|
|
@ -87,4 +88,7 @@ public class HrmResourceWrapper extends OrganizationWrapper {
|
|||
return getHrmResourceService(user).updateTabForm(params);
|
||||
}
|
||||
|
||||
public List<SearchTemplateParam> getSearchTemplate(Map<String, Object> params) {
|
||||
return getHrmResourceService(user).getSearchTemplate(params);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue