Merge branch 'feature/dxf' of http://221.226.25.34:3000/liang.cheng/weaver-hrm-organization into feature/dxf
This commit is contained in:
commit
51d34bd496
|
|
@ -5,6 +5,8 @@ import lombok.Builder;
|
|||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2023/01/05
|
||||
|
|
@ -19,4 +21,21 @@ public class SearchTemplateParam {
|
|||
//private boolean selected;
|
||||
private String showname;
|
||||
private String fields;
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
SearchTemplateParam that = (SearchTemplateParam) o;
|
||||
return key.equals(that.key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(key);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -64,4 +64,6 @@ public class JclOrgCustomTemplatePO implements Serializable {
|
|||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Integer overall;
|
||||
|
||||
}
|
||||
|
|
@ -26,4 +26,5 @@ public class SearchTemplatePO {
|
|||
private Integer creator;
|
||||
private Date createTime;
|
||||
private Date updateTime;
|
||||
private Integer overall;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,6 +55,8 @@ public interface HrmResourceMapper {
|
|||
*/
|
||||
List<SearchTemplateParam> getCustomTemplatesByUser(@Param("userId") Integer userId);
|
||||
|
||||
List<SearchTemplateParam> getCustomOverAll();
|
||||
|
||||
SearchTemplatePO getSearchTemplateById(@Param("id") String id);
|
||||
|
||||
SearchTemplatePO getSearchTemplateByName(@Param("userId") Integer userId, @Param("name") String name);
|
||||
|
|
@ -65,6 +67,10 @@ public interface HrmResourceMapper {
|
|||
|
||||
SearchTemplatePO getUsedCustomTemplateByUser(@Param("userId") Integer userId);
|
||||
|
||||
SearchTemplatePO getUsedSerarchTemplateByUser(@Param("userId") Integer userId);
|
||||
|
||||
SearchTemplatePO getOverallCustomTemplate();
|
||||
|
||||
Integer insertSearchTemplate(SearchTemplatePO templatePO);
|
||||
|
||||
Integer deleteSearchTemplate(@Param("id") Integer Id, @Param("userId") Integer userId);
|
||||
|
|
@ -73,6 +79,8 @@ public interface HrmResourceMapper {
|
|||
|
||||
Integer deleteCustomTemplate(@Param("id") Integer Id, @Param("userId") Integer userId);
|
||||
|
||||
Integer updateCustomTemplateUsed(@Param("userId") Integer userId);
|
||||
|
||||
|
||||
String queryLabelName(@Param("fieldName") String fieldName, @Param("scopeId") String scopeId, @Param("language") Integer language);
|
||||
|
||||
|
|
|
|||
|
|
@ -14,6 +14,9 @@
|
|||
<result column="name" property="showname"/>
|
||||
<!-- <result column="selected" property="selected"/>-->
|
||||
</resultMap>
|
||||
<update id="updateCustomTemplateUsed">
|
||||
update JCL_ORG_SEARCH_TEMPLATE set isused = null where creator = #{userId}
|
||||
</update>
|
||||
|
||||
|
||||
<select id="selectFilterDatas" resultType="com.engine.organization.entity.hrmresource.po.ResourcePO">
|
||||
|
|
@ -147,7 +150,14 @@
|
|||
select id,
|
||||
name
|
||||
from jcl_org_custom_template
|
||||
where creator = #{userId}
|
||||
where creator = #{userId} and overall is null
|
||||
</select>
|
||||
|
||||
<select id="getCustomOverAll" resultMap="SearchTemplateMap">
|
||||
select id,
|
||||
name
|
||||
from jcl_org_custom_template
|
||||
where overall = 1
|
||||
</select>
|
||||
|
||||
<insert id="insertSearchTemplate" parameterType="com.engine.organization.entity.hrmresource.po.SearchTemplatePO"
|
||||
|
|
@ -176,6 +186,9 @@
|
|||
<if test="workFields != null">
|
||||
work_fields,
|
||||
</if>
|
||||
<if test="isused != null">
|
||||
isused,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
|
||||
<if test="creator != null">
|
||||
|
|
@ -199,6 +212,9 @@
|
|||
<if test="workFields != null">
|
||||
#{workFields},
|
||||
</if>
|
||||
<if test="isused != null">
|
||||
#{isused},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
|
|
@ -445,9 +461,19 @@
|
|||
select *
|
||||
from jcl_org_custom_template
|
||||
where ISUSED = 1
|
||||
and overall is null
|
||||
and creator = #{userId}
|
||||
</select>
|
||||
|
||||
<select id="getOverallCustomTemplate"
|
||||
resultType="com.engine.organization.entity.hrmresource.po.SearchTemplatePO">
|
||||
select *
|
||||
from jcl_org_custom_template
|
||||
where overall = 1
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
<select id="selectByDepartmentId" resultType="com.engine.organization.entity.hrmresource.po.ResourceChartPO">
|
||||
select id,workcode,lastname,sex,departmentid,subcompanyid1,jobtitle,status,mobile
|
||||
from hrmresource where departmentid = #{departmentId} and status < 4 order by id
|
||||
|
|
@ -462,5 +488,12 @@
|
|||
</foreach>
|
||||
order by id
|
||||
</select>
|
||||
<select id="getUsedSerarchTemplateByUser"
|
||||
resultType="com.engine.organization.entity.hrmresource.po.SearchTemplatePO">
|
||||
select *
|
||||
from jcl_org_search_template
|
||||
where ISUSED = 1
|
||||
and creator = #{userId}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
@ -34,8 +34,10 @@ public interface JclOrgCustomTemplateMapper {
|
|||
|
||||
int deleteByIds(@Param("ids") Collection<Long> ids);
|
||||
|
||||
int updateUsed(@Param("isused")String isused,@Param("id") String id,@Param("creator") String creator);
|
||||
int updateUsed(@Param("overall")Integer overall,@Param("isused")String isused,@Param("id") String id,@Param("creator") String creator);
|
||||
|
||||
JclOrgCustomTemplatePO queryIsusedTemp(@Param("isused")String isused,@Param("creator") String creator);
|
||||
|
||||
JclOrgCustomTemplatePO queryOverAll();
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,12 +14,13 @@
|
|||
<result property="creator" column="creator" jdbcType="INTEGER"/>
|
||||
<result property="createTime" column="create_time" jdbcType="DATE"/>
|
||||
<result property="updateTime" column="update_time" jdbcType="DATE"/>
|
||||
<result property="overall" column="overall"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id,name,basic_fields,
|
||||
personal_fields,work_fields,isused,
|
||||
creator,create_time,update_time
|
||||
creator,create_time,update_time,overall
|
||||
</sql>
|
||||
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
|
||||
|
|
@ -132,8 +133,9 @@
|
|||
<update id="updateUsed" parameterType="java.lang.String">
|
||||
update JCL_ORG_CUSTOM_TEMPLATE set isused = #{isused}
|
||||
<where>
|
||||
overall is null
|
||||
<if test="id !=null">
|
||||
id = #{id}
|
||||
and id = #{id}
|
||||
</if>
|
||||
<if test="creator !=null">
|
||||
and creator = #{creator}
|
||||
|
|
@ -144,9 +146,17 @@
|
|||
<select id="queryIsusedTemp" parameterType="java.lang.String" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from JCL_ORG_CUSTOM_TEMPLATE t where t.isused = #{isused} and t.creator = #{creator}
|
||||
from JCL_ORG_CUSTOM_TEMPLATE t where t.isused = #{isused} and t.creator = #{creator} and overall is null
|
||||
</select>
|
||||
|
||||
<select id="queryOverAll" parameterType="java.lang.String" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from JCL_ORG_CUSTOM_TEMPLATE t where overall = 1
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
<select id="listAllIdByCreator" resultType="java.lang.Long">
|
||||
select
|
||||
id
|
||||
|
|
|
|||
|
|
@ -179,4 +179,12 @@ public interface HrmResourceService {
|
|||
Map<String, Object> chartResourceList(Integer departmentId,String versionId,String dimension,String statusValue);
|
||||
|
||||
|
||||
/**
|
||||
* @Description: 将当前模板应用到所有人
|
||||
* @Author: liang.cheng
|
||||
* @Date: 2024/7/23 3:02 PM
|
||||
* @param: [params]
|
||||
* @return: java.util.Map<java.lang.String,java.lang.Object>
|
||||
*/
|
||||
Map<String, Object> customOverall(Map<String, Object> params);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,12 +14,14 @@ import com.engine.organization.component.OrganizationWeaTable;
|
|||
import com.engine.organization.entity.department.bo.DepartmentBO;
|
||||
import com.engine.organization.entity.department.dto.DepartmentListDTO;
|
||||
import com.engine.organization.entity.department.po.DepartmentPO;
|
||||
import com.engine.organization.entity.hrmresource.po.JclOrgCustomTemplatePO;
|
||||
import com.engine.organization.entity.hrmresource.po.SearchTemplatePO;
|
||||
import com.engine.organization.entity.hrmresource.vo.HrmResourceVO;
|
||||
import com.engine.organization.entity.staff.po.StaffPO;
|
||||
import com.engine.organization.entity.staff.vo.StaffTableVO;
|
||||
import com.engine.organization.mapper.department.DepartmentMapper;
|
||||
import com.engine.organization.mapper.resource.HrmResourceMapper;
|
||||
import com.engine.organization.mapper.resource.JclOrgCustomTemplateMapper;
|
||||
import com.engine.organization.mapper.resource.ResourceMapper;
|
||||
import com.engine.organization.mapper.staff.StaffMapper;
|
||||
import com.engine.organization.mapper.staff.StaffPlanMapper;
|
||||
|
|
@ -141,18 +143,31 @@ public class ExportCommonServiceImpl extends Service implements ExportCommonServ
|
|||
HrmResourceServiceImpl hrmResourceService = ServiceUtil.getService(HrmResourceServiceImpl.class,user);
|
||||
List<SearchConditionGroup> allConditions = hrmResourceService.getAllConditions();
|
||||
|
||||
List<String> columnList;
|
||||
JclOrgCustomTemplatePO jclOrgCustomTemplatePO = MapperProxyFactory.getProxy(JclOrgCustomTemplateMapper.class).queryIsusedTemp("1", String.valueOf(user.getUID()));
|
||||
|
||||
// 查询当前台账定制列
|
||||
SearchTemplatePO usedCustomTemplate = MapperProxyFactory.getProxy(HrmResourceMapper.class).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";
|
||||
columnList = Arrays.asList(selectKeys.split(","));
|
||||
} else {
|
||||
columnList = hrmResourceService.getSelectKeys(usedCustomTemplate);
|
||||
//2.是否存在通用模板
|
||||
if (null == jclOrgCustomTemplatePO) {
|
||||
jclOrgCustomTemplatePO = MapperProxyFactory.getProxy(JclOrgCustomTemplateMapper.class).queryOverAll();
|
||||
}
|
||||
|
||||
String columns = "";
|
||||
if (jclOrgCustomTemplatePO != null) {
|
||||
if (org.apache.commons.lang3.StringUtils.isNotBlank(jclOrgCustomTemplatePO.getBasicFields())) {
|
||||
columns = jclOrgCustomTemplatePO.getBasicFields();
|
||||
}
|
||||
if (org.apache.commons.lang3.StringUtils.isNotBlank(jclOrgCustomTemplatePO.getPersonalFields())) {
|
||||
columns = columns + "," + jclOrgCustomTemplatePO.getPersonalFields();
|
||||
}
|
||||
if (org.apache.commons.lang3.StringUtils.isNotBlank(jclOrgCustomTemplatePO.getWorkFields())) {
|
||||
columns = columns + "," + jclOrgCustomTemplatePO.getWorkFields();
|
||||
}
|
||||
} else {
|
||||
//初次使用,无模板初始值
|
||||
columns = "-1_hrm_lastname,-1_hrm_departmentid,-1_hrm_subcompanyid1,-1_hrm_jobtitle,-1_hrm_mobile,-1_hrm_telephone,-1_hrm_managerid,-1_hrm_sporder";
|
||||
}
|
||||
|
||||
List<String> columnList = Arrays.asList(columns.split(","));
|
||||
|
||||
|
||||
|
||||
BigDecimal decimal = new BigDecimal(100 / columnList.size());
|
||||
|
|
@ -168,7 +183,8 @@ public class ExportCommonServiceImpl extends Service implements ExportCommonServ
|
|||
weaTableColumn.setText(MapperProxyFactory.getProxy(HrmResourceMapper.class).queryLabelName(fieldName, scopeId, user.getLanguage()));
|
||||
weaTableColumn.setColumn(hrmResourceService.buildTableSql(columnName).replace(".", "_"));
|
||||
weaTableColumn.setDisplay(columnList.contains(columnName) ? WeaBoolAttr.TRUE : WeaBoolAttr.FALSE);
|
||||
weaTableColumn.setTransmethod("com.engine.organization.transmethod.HrmResourceTransMethod.getFieldTrueValue");
|
||||
// 导出专用转换,去除html标签
|
||||
weaTableColumn.setTransmethod("com.engine.organization.transmethod.HrmResourceTransMethod.getFieldTrueValueExp");
|
||||
weaTableColumn.setOtherpara(columnName);
|
||||
weaTableColumn.setWidth(decimal.setScale(2, RoundingMode.HALF_UP).doubleValue() + "%");
|
||||
if (weaTableColumn.getDisplay().getBoolVal()) {
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
@ -149,6 +150,12 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
|
|||
table.setSqlwhere(sqlWhere);
|
||||
List<WeaTableColumn> weaTableColumnList = new ArrayList<>();
|
||||
JclOrgCustomTemplatePO jclOrgCustomTemplatePO = MapperProxyFactory.getProxy(JclOrgCustomTemplateMapper.class).queryIsusedTemp("1", String.valueOf(user.getUID()));
|
||||
|
||||
//2.是否存在通用模板
|
||||
if (null == jclOrgCustomTemplatePO) {
|
||||
jclOrgCustomTemplatePO = MapperProxyFactory.getProxy(JclOrgCustomTemplateMapper.class).queryOverAll();
|
||||
}
|
||||
|
||||
String columns = "";
|
||||
List<String> fields = new ArrayList<>();
|
||||
List<SearchConditionGroup> allConditions = getAllConditions();
|
||||
|
|
@ -266,6 +273,9 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
|
|||
templatePO.setCreator(user.getUID());
|
||||
templatePO.setCreateTime(new Date());
|
||||
templatePO.setUpdateTime(new Date());
|
||||
templatePO.setIsused("1");
|
||||
// 将之前的模板,isused置为null
|
||||
getHrmResourceMapper().updateCustomTemplateUsed(user.getUID());
|
||||
getHrmResourceMapper().insertSearchTemplate(templatePO);
|
||||
return templatePO.getId();
|
||||
}
|
||||
|
|
@ -314,20 +324,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);
|
||||
// SearchTemplatePO usedCustomTemplate = getHrmResourceMapper().getUsedCustomTemplateByUser(user.getUID());
|
||||
// if (null != usedCustomTemplate) {
|
||||
// returnMap.put("templateId", usedCustomTemplate.getId().toString());
|
||||
// } else {
|
||||
// returnMap.put("templateId", "-1");
|
||||
// }
|
||||
} else {
|
||||
templates = getHrmResourceMapper().getSearchTemplatesByUser(userUID);
|
||||
}
|
||||
templates.add(0, SearchTemplateParam.builder().key("-1").showname("默认模板").build());
|
||||
returnMap.put("templates", templates);
|
||||
if (addDefault) {
|
||||
templates.add(0, SearchTemplateParam.builder().key("-1").showname("默认模板").build());
|
||||
}
|
||||
|
||||
//1.增加全局模板
|
||||
if (userUID != 1) {
|
||||
templates.addAll(getHrmResourceMapper().getCustomOverAll());
|
||||
}
|
||||
LinkedHashSet<Object> objects = new LinkedHashSet<>(templates);
|
||||
returnMap.put("templates", objects);
|
||||
return returnMap;
|
||||
}
|
||||
|
||||
|
|
@ -345,6 +367,7 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
|
|||
templatePO.setIsused("0");
|
||||
templatePO.setCreateTime(new Date());
|
||||
templatePO.setUpdateTime(new Date());
|
||||
templatePO.setOverall(0);
|
||||
getHrmResourceMapper().insertCustomTemplate(templatePO);
|
||||
return templatePO.getId();
|
||||
}
|
||||
|
|
@ -417,20 +440,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);
|
||||
|
|
@ -447,18 +471,22 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
|
|||
SearchTemplatePO templatePO = buildSearchTemplateByFields(columns);
|
||||
JclOrgCustomTemplatePO jclOrgCustomTemplatePO = new JclOrgCustomTemplatePO();
|
||||
if (StringUtils.isNotBlank(templateId)) {
|
||||
if (templateId.equals("-1")) {
|
||||
getJclOrgCustomTemplateMapper().updateUsed("0", null, String.valueOf(user.getUID()));
|
||||
if ("-1".equals(templateId)) {
|
||||
getJclOrgCustomTemplateMapper().updateUsed(0,"0", null, String.valueOf(user.getUID()));
|
||||
} 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", null, String.valueOf(user.getUID()));
|
||||
|
||||
//启用当前模板
|
||||
getJclOrgCustomTemplateMapper().updateByPrimaryKeySelective(jclOrgCustomTemplatePO);
|
||||
}
|
||||
|
|
@ -524,6 +552,19 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
|
|||
return dataMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> customOverall(Map<String, Object> params) {
|
||||
RecordSet rs = new RecordSet();
|
||||
Map<String, Object> data = new HashMap<>(2);
|
||||
//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);
|
||||
return data;
|
||||
}
|
||||
|
||||
private List<ResourceListColumns> getTableColumns() {
|
||||
List<ResourceListColumns> list = new ArrayList<>();
|
||||
int language = user.getLanguage();
|
||||
|
|
@ -589,9 +630,52 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
|
|||
btnDatas.put("topMenu", topMenuList);
|
||||
btnDatas.put("rightMenu", rightMenuList);
|
||||
btnDatas.put("hasRight", true);
|
||||
btnDatas.put("loginId", user.getUID());
|
||||
//获取当前用户使用的列定制模板Id
|
||||
btnDatas.put("customTemplateId", getCustomTemplateId());
|
||||
btnDatas.put("searchTemplateId", getSearchTemplateId());
|
||||
|
||||
return btnDatas;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前用户使用的列定制模板Id
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private String getCustomTemplateId() {
|
||||
|
||||
String customTemplateId = "-1";
|
||||
SearchTemplatePO usedCustomTemplate = getHrmResourceMapper().getUsedCustomTemplateByUser(user.getUID());
|
||||
if (null != usedCustomTemplate) {
|
||||
customTemplateId = usedCustomTemplate.getId().toString();
|
||||
} else {
|
||||
//查询全局模板
|
||||
SearchTemplatePO overallCustomTemplate = getHrmResourceMapper().getOverallCustomTemplate();
|
||||
if (null != overallCustomTemplate) {
|
||||
customTemplateId = overallCustomTemplate.getId().toString();
|
||||
}
|
||||
}
|
||||
|
||||
return customTemplateId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前用户使用的查询模板Id
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private String getSearchTemplateId() {
|
||||
|
||||
String searchTemplateId = "-1";
|
||||
SearchTemplatePO usedCustomTemplate = getHrmResourceMapper().getUsedSerarchTemplateByUser(user.getUID());
|
||||
if (null != usedCustomTemplate) {
|
||||
searchTemplateId = usedCustomTemplate.getId().toString();
|
||||
}
|
||||
|
||||
return searchTemplateId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getTabForm(Map<String, Object> params) {
|
||||
Map<String, Object> apiDatas = new HashMap<>();
|
||||
|
|
|
|||
|
|
@ -16,6 +16,13 @@ import weaver.hrm.definedfield.HrmFieldManager;
|
|||
*/
|
||||
public class HrmResourceTransMethod {
|
||||
|
||||
/**
|
||||
* 字段展示内容转换,列表用
|
||||
*
|
||||
* @param id
|
||||
* @param para
|
||||
* @return
|
||||
*/
|
||||
public static String getFieldTrueValue(String id, String para) {
|
||||
HrmFieldManager hfm = new HrmFieldManager("HrmCustomFieldByInfoType", Integer.parseInt(para.split("_")[0]));
|
||||
String fieldName = para.substring(para.lastIndexOf("_") + 1);
|
||||
|
|
@ -32,6 +39,32 @@ public class HrmResourceTransMethod {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 字段展示内容转换,导出用
|
||||
*
|
||||
* @param id
|
||||
* @param para
|
||||
* @return
|
||||
*/
|
||||
public static String getFieldTrueValueExp(String id, String para) {
|
||||
HrmFieldManager hfm = new HrmFieldManager("HrmCustomFieldByInfoType", Integer.parseInt(para.split("_")[0]));
|
||||
String fieldName = para.substring(para.lastIndexOf("_") + 1);
|
||||
JSONObject hrmFieldConf = hfm.getHrmFieldConf(fieldName);
|
||||
User user = new User();
|
||||
user.setUid(1);
|
||||
try {
|
||||
if (hfm.isBaseField(fieldName) && "jobactivity".equals(fieldName)) {
|
||||
hrmFieldConf.put("type", 282);
|
||||
}
|
||||
String fieldvalue = hfm.getFieldvalue(null, user, null, hrmFieldConf.getString("dmlurl"), hrmFieldConf.getInt("id"), hrmFieldConf.getInt("fieldhtmltype"), hrmFieldConf.getInt("type"), id, 0, fieldName);
|
||||
// fieldvalue去除Html内容
|
||||
fieldvalue = fieldvalue.replaceAll("<[^>]*>", "").replaceAll(" ", "");
|
||||
return fieldvalue;
|
||||
} catch (Exception e) {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
public static String getDepartmentName(String departmentId) {
|
||||
return MapperProxyFactory.getProxy(DepartmentMapper.class).getDeptNameById(Integer.parseInt(departmentId));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -113,11 +113,11 @@ public class ReturnResult<T> implements Serializable {
|
|||
* @param data
|
||||
* @return
|
||||
*/
|
||||
//@Deprecated
|
||||
//public static <T> ReturnResult<T> successed(T data) {
|
||||
//
|
||||
// return new ReturnResult<>(ResultCode.SUCCESS.getCode(), ResultCode.SUCCESS.getMessage(), data);
|
||||
//}
|
||||
@Deprecated
|
||||
public static <T> ReturnResult<T> successed(T data) {
|
||||
|
||||
return new ReturnResult<>(ResultCode.SUCCESS.getCode(), ResultCode.SUCCESS.getMessage(), data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 多语言响应
|
||||
|
|
|
|||
|
|
@ -374,4 +374,18 @@ public class HrmResourceController {
|
|||
}
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/customOverall")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public ReturnResult customOverall(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
try {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
Map<String,Object> map = ParamUtil.request2Map(request);
|
||||
return ReturnResult.successed(user,getHrmResourceWrapper(user).customOverall(map));
|
||||
} catch (Exception e) {
|
||||
return ReturnResult.exceptionHandle(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -114,4 +114,8 @@ public class HrmResourceWrapper extends OrganizationWrapper {
|
|||
public Integer saveColumnsCustomTemplate(Map<String,Object> params) {
|
||||
return getHrmResourceService(user).saveColumnsCustomTemplate(params);
|
||||
}
|
||||
|
||||
public Object customOverall(Map<String, Object> params) {
|
||||
return getHrmResourceService(user).customOverall(params);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue