Merge remote-tracking branch 'origin/develop' into feature/ml

# Conflicts:
#	src/com/engine/organization/mapper/resource/HrmResourceMapper.xml
#	src/com/engine/organization/service/impl/HrmResourceServiceImpl.java
pull/141/head^2
Mlin 2 years ago
commit 2fba3b50b9

@ -81,6 +81,36 @@ public class ExtendInfoBO {
}
/**
* viewAttr
* @param user
* @param infoPOList
* @param showLabel
* @param checkBox
* @return
*/
public static List<Map<String, Object>> convertInfoListToTable(User user, List<ExtendInfoPO> infoPOList, boolean showLabel, boolean checkBox) {
List<Map<String, Object>> lsCol = new ArrayList<>();
Map<String, Object> col;
int width = 100 / infoPOList.size();
for (ExtendInfoPO extendInfoPO : infoPOList) {
String tmpkey = extendInfoPO.getFieldName();
col = new HashMap<>();
col.put("title", extendInfoPO.getFieldNameDesc());
col.put("key", tmpkey);
col.put("dataIndex", tmpkey);
col.put("com", getFieldDetailInfo(user, extendInfoPO, extendInfoPO.getViewAttr(), showLabel, width));
col.put("width", width + "%");
if (checkBox && Integer.valueOf(7).equals(extendInfoPO.getControlType())) {
col.put("checkType", "checkbox");
}
lsCol.add(col);
}
return lsCol;
}
public static List<Map<String, Object>> convertInfoListToTable(User user, List<ExtendInfoPO> infoPOList, int viewAttr, boolean showLabel) {
return convertInfoListToTable(user, infoPOList, viewAttr, showLabel, false);
}

@ -131,4 +131,6 @@ public class ExtendInfoPO {
private int deleteType;
private Date createTime;
private Date updateTime;
private Integer viewAttr;
}

@ -16,7 +16,7 @@ import lombok.NoArgsConstructor;
@NoArgsConstructor
public class SearchTemplateParam {
private String key;
private boolean selected;
//private boolean selected;
private String showname;
private String fields;
}

@ -57,8 +57,12 @@ public interface HrmResourceMapper {
SearchTemplatePO getSearchTemplateById(@Param("id") String id);
SearchTemplatePO getSearchTemplateByName(@Param("userId") Integer userId, @Param("name") String name);
SearchTemplatePO getCustomTemplateById(@Param("id") String id);
SearchTemplatePO getCustomTemplateByName(@Param("userId") Integer userId, @Param("name") String name);
Integer insertSearchTemplate(SearchTemplatePO templatePO);
Integer deleteSearchTemplate(@Param("id") Integer Id, @Param("userId") Integer userId);

@ -12,7 +12,7 @@
<resultMap id="SearchTemplateMap" type="com.engine.organization.entity.hrmresource.param.SearchTemplateParam">
<result column="id" property="key"/>
<result column="name" property="showname"/>
<result column="selected" property="selected"/>
<!-- <result column="selected" property="selected"/>-->
</resultMap>
@ -117,8 +117,7 @@
</select>
<select id="getSearchTemplatesByUser" resultMap="SearchTemplateMap">
select id,
name,
'false' as selected
name
from jcl_org_search_template
where creator = #{userId}
</select>
@ -138,8 +137,7 @@
<select id="getCustomTemplatesByUser"
resultMap="SearchTemplateMap">
select id,
name,
'false' as selected
name
from jcl_org_custom_template
where creator = #{userId}
</select>
@ -390,5 +388,19 @@
from hrm_formfield a
inner join htmllabelinfo b on a.fieldlabel = b.indexid and b.languageid = 7
</select>
<select id="getSearchTemplateByName"
resultType="com.engine.organization.entity.hrmresource.po.SearchTemplatePO">
select *
from jcl_org_search_template
where creator = #{userId}
and name = #{name}
</select>
<select id="getCustomTemplateByName"
resultType="com.engine.organization.entity.hrmresource.po.SearchTemplatePO">
select *
from jcl_org_custom_template
where creator = #{userId}
and name = #{name}
</select>
</mapper>

@ -18,7 +18,6 @@ import com.engine.organization.entity.company.po.CompPO;
import com.engine.organization.entity.department.bo.DepartmentBO;
import com.engine.organization.entity.department.po.DepartmentPO;
import com.engine.organization.entity.extend.bo.ExtendInfoBO;
import com.engine.organization.entity.extend.param.ExtendInfoParams;
import com.engine.organization.entity.extend.po.ExtendInfoPO;
import com.engine.organization.entity.hrmresource.bo.HrmRelationBO;
import com.engine.organization.entity.hrmresource.param.HrmRelationSaveParam;
@ -36,7 +35,6 @@ import com.engine.organization.entity.searchtree.SearchTreeParams;
import com.engine.organization.enums.HrmGroupEnum;
import com.engine.organization.mapper.comp.CompMapper;
import com.engine.organization.mapper.department.DepartmentMapper;
import com.engine.organization.mapper.extend.ExtMapper;
import com.engine.organization.mapper.hrmresource.HrmRelationMapper;
import com.engine.organization.mapper.hrmresource.SystemDataMapper;
import com.engine.organization.mapper.job.JobMapper;
@ -56,12 +54,12 @@ import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONException;
import org.json.JSONObject;
import weaver.common.DateUtil;
import weaver.conn.RecordSet;
import weaver.general.StringUtil;
import weaver.general.Util;
import weaver.hrm.definedfield.HrmFieldManager;
import java.time.LocalDateTime;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
@ -205,6 +203,9 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
@Override
public Integer saveSearchTemplate(SearchTemplateParam params) {
// 重复名称校验
SearchTemplatePO searchTemplateByName = getHrmResourceMapper().getSearchTemplateByName(user.getUID(), params.getShowname());
OrganizationAssert.isNull(searchTemplateByName, "改模板名称已存在");
SearchTemplatePO templatePO = buildSearchTemplateByFields(params.getFields());
if (null == templatePO) {
return -1;
@ -261,12 +262,15 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
} else {
templates = getHrmResourceMapper().getSearchTemplatesByUser(userUID);
}
templates.add(0, SearchTemplateParam.builder().key("-1").selected(false).showname("默认模板").build());
templates.add(0, SearchTemplateParam.builder().key("-1").showname("默认模板").build());
return templates;
}
@Override
public Integer saveCustomTemplate(SearchTemplateParam params) {
// 重复名称校验
SearchTemplatePO searchTemplateByName = getHrmResourceMapper().getCustomTemplateByName(user.getUID(), params.getShowname());
OrganizationAssert.isNull(searchTemplateByName, "改模板名称已存在");
SearchTemplatePO templatePO = buildSearchTemplateByFields(params.getFields());
if (null == templatePO) {
return -1;
@ -502,10 +506,10 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
@Override
public Map<String, Object> getCustomTemplate(Map<String, Object> params) {
List<ExtendInfoPO> infoPOList = new ArrayList<>();
infoPOList.add(ExtendInfoPO.builder().id(null).fieldName("name").fieldNameDesc("模板名称").fieldType("varchar(255)").controlType(1).browserType("1").customValue("[\"input\",\"text\",\"50\"]").showOrder(1).isrequired(0).isSystemDefault(0).build());
infoPOList.add(ExtendInfoPO.builder().id(null).fieldName("createTime").fieldNameDesc("创建时间").fieldType("date").controlType(1).browserType("1").customValue("[\"input\",\"text\",\"50\"]").showOrder(2).isrequired(0).isSystemDefault(0).build());
infoPOList.add(ExtendInfoPO.builder().viewAttr(2).id(null).fieldName("name").fieldNameDesc("模板名称").fieldType("varchar(255)").controlType(1).browserType("1").customValue("[\"input\",\"text\",\"50\"]").showOrder(1).isrequired(0).isSystemDefault(0).build());
infoPOList.add(ExtendInfoPO.builder().viewAttr(1).id(null).fieldName("createTime").fieldNameDesc("创建时间").fieldType("date").controlType(1).browserType("1").customValue("[\"input\",\"text\",\"50\"]").showOrder(2).isrequired(0).isSystemDefault(0).build());
Map<String, Object> tabInfoMap = new HashMap<>();
tabInfoMap.put("columns", ExtendInfoBO.convertInfoListToTable(user, infoPOList, 2, false, true));
tabInfoMap.put("columns", ExtendInfoBO.convertInfoListToTable(user, infoPOList, false, true));
List<JclOrgCustomTemplatePO> jclOrgCustomTemplatePOS = MapperProxyFactory.getProxy(JclOrgCustomTemplateMapper.class).listAll();
List<Integer> isUsed = new ArrayList<>();
AtomicInteger index = new AtomicInteger(0);
@ -513,7 +517,7 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
Map<String, Object> resultMap = new HashMap<>();
resultMap.put("id", item.getId());
resultMap.put("name", item.getName());
resultMap.put("createTime", item.getCreateTime());
resultMap.put("createTime", DateUtil.getDate(item.getCreateTime(), DateUtil.FORMAT_FULL));
if (item.getIsused() != null) {
@ -571,6 +575,9 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
continue;
}
String key = entry.getKey();
if ("lastName".equals(key)) {
sb.append(" and t.lastname ").append(dbType.like(value));
}
SearchConditionItem searchConditionItem = allFieldsMap.get(key);
buildDynamicSql(searchConditionItem, key, value, sb, dbType);
// 根据不同的类型,不同的查询方式

@ -332,6 +332,7 @@ public class HrmResourceController {
}
}
@POST
@Path("/updateCustomTemplate")
@Produces(MediaType.APPLICATION_JSON)
public ReturnResult updateCustomTemplate(@Context HttpServletRequest request, @Context HttpServletResponse response) {

Loading…
Cancel
Save