Merge remote-tracking branch 'origin/develop' into feature/ml
# Conflicts: # src/com/engine/organization/service/HrmResourceService.java # src/com/engine/organization/service/impl/HrmResourceServiceImpl.java # src/com/engine/organization/web/HrmResourceController.java # src/com/engine/organization/wrapper/HrmResourceWrapper.java
This commit is contained in:
commit
044f963f31
|
|
@ -0,0 +1,22 @@
|
|||
package com.engine.organization.entity.hrmresource.po;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2023/01/11
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class TransferDataPO {
|
||||
private String id;
|
||||
private String label;
|
||||
private String title;
|
||||
private String idx;
|
||||
}
|
||||
|
|
@ -55,7 +55,7 @@ public class CardAccessVO {
|
|||
@OrganizationTableColumn(text = "所有上级可见", width = "15%", column = "all_superior")
|
||||
private Integer allSuperior;
|
||||
|
||||
@OrganizationTableColumn(text = "查看自定义", width = "15%", column = "custom",transmethod = "com.engine.organization.transmethod.SystemTransMethod.getRoleName")
|
||||
@OrganizationTableColumn(text = "查看自定义", width = "30%", column = "custom",transmethod = "com.engine.organization.transmethod.SystemTransMethod.getRoleName")
|
||||
private String custom;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,8 +47,18 @@ public interface HrmResourceMapper {
|
|||
*/
|
||||
List<SearchTemplateParam> getSearchTemplatesByUser(@Param("userId") Integer userId);
|
||||
|
||||
/**
|
||||
* 根据用户ID获取列定制模板
|
||||
*
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
List<SearchTemplateParam> getCustomTemplatesByUser(@Param("userId") Integer userId);
|
||||
|
||||
SearchTemplatePO getSearchTemplateById(@Param("id") String id);
|
||||
|
||||
SearchTemplatePO getCustomTemplateById(@Param("id") String id);
|
||||
|
||||
Integer insertSearchTemplate(SearchTemplatePO templatePO);
|
||||
|
||||
Integer deleteSearchTemplate(@Param("id") Integer Id, @Param("userId") Integer userId);
|
||||
|
|
|
|||
|
|
@ -129,6 +129,21 @@
|
|||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="getCustomTemplateById"
|
||||
resultType="com.engine.organization.entity.hrmresource.po.SearchTemplatePO">
|
||||
select *
|
||||
from jcl_org_custom_template
|
||||
where id = #{id}
|
||||
</select>
|
||||
<select id="getCustomTemplatesByUser"
|
||||
resultType="com.engine.organization.entity.hrmresource.param.SearchTemplateParam">
|
||||
select id,
|
||||
name,
|
||||
'false' as selected
|
||||
from jcl_org_custom_template
|
||||
where creator = #{userId}
|
||||
</select>
|
||||
|
||||
<insert id="insertSearchTemplate" parameterType="com.engine.organization.entity.hrmresource.po.SearchTemplatePO"
|
||||
keyProperty="id"
|
||||
keyColumn="id" useGeneratedKeys="true">
|
||||
|
|
|
|||
|
|
@ -150,4 +150,12 @@ public interface HrmResourceService {
|
|||
* @return
|
||||
*/
|
||||
Map<String, Object> getCustomTemplate(Map<String,Object> params);
|
||||
|
||||
/**
|
||||
* 获取列定制穿梭框数据
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
Map<String, Object> getCustomTransferData(Map<String, Object> params);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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(",")));
|
||||
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(personalFields)) {
|
||||
selectKeys.addAll(Arrays.asList(personalFields.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);
|
||||
}
|
||||
if (StringUtils.isNotBlank(workflowFields)) {
|
||||
selectKeys.addAll(Arrays.asList(workflowFields.split(",")));
|
||||
}
|
||||
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;
|
||||
|
|
|
|||
|
|
@ -306,6 +306,19 @@ public class HrmResourceController {
|
|||
}
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/getCustomTransferData")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public ReturnResult getCustomTransferData(@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).getCustomTransferData(map)));
|
||||
} catch (Exception e) {
|
||||
return ReturnResult.exceptionHandle(e);
|
||||
}
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/getCustomTemplate")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
|
|
|
|||
|
|
@ -103,4 +103,8 @@ public class HrmResourceWrapper extends OrganizationWrapper {
|
|||
public Map<String, Object> getCustomTemplate(Map<String,Object> params){
|
||||
return getHrmResourceService(user).getCustomTemplate(params);
|
||||
}
|
||||
|
||||
public Map<String, Object> getCustomTransferData(Map<String, Object> params) {
|
||||
return getHrmResourceService(user).getCustomTransferData(params);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue