扩展维度属性
This commit is contained in:
parent
0634a139b9
commit
74f7c71ffe
|
|
@ -1,4 +1,4 @@
|
|||
package com.engine.salary.entity.hrm.param;
|
||||
package com.engine.salary.entity.hrm.dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
|
|
@ -19,11 +19,30 @@ import java.util.List;
|
|||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class EmployeeInfoExpandParam {
|
||||
public class EmployeeInfoExpandDTO {
|
||||
|
||||
private Long id;
|
||||
/**
|
||||
* 功能模块
|
||||
*/
|
||||
private String module;
|
||||
/**
|
||||
* 模块信息
|
||||
*/
|
||||
private String moduleInfo;
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
private String primaryKey;
|
||||
|
||||
private String sql;
|
||||
/**
|
||||
* sql
|
||||
*/
|
||||
private String expandSql;
|
||||
|
||||
/**
|
||||
* 字段设置
|
||||
*/
|
||||
private List<FieldSetting> fieldSettings;
|
||||
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.engine.salary.entity.hrm.param;
|
||||
package com.engine.salary.entity.hrm.dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
|
|
@ -0,0 +1,74 @@
|
|||
package com.engine.salary.entity.hrm.po;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 人员维度扩展表
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ExpandFieldSettingsPO {
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 功能模块
|
||||
*/
|
||||
private String module;
|
||||
|
||||
/**
|
||||
* 模块信息
|
||||
*/
|
||||
private String moduleInfo;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
private String primaryKey;
|
||||
|
||||
/**
|
||||
* sql
|
||||
*/
|
||||
private String expandSql;
|
||||
|
||||
/**
|
||||
* 字段设置
|
||||
*/
|
||||
private String fieldSetting;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private Long creator;
|
||||
|
||||
/**
|
||||
* 是否已删除。0:未删除、1:已删除
|
||||
*/
|
||||
private Integer deleteType;
|
||||
|
||||
/**
|
||||
* 租户ID
|
||||
*/
|
||||
private String tenantKey;
|
||||
|
||||
//主键id集合
|
||||
private Collection<Long> ids;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,73 @@
|
|||
package com.engine.salary.mapper.hrm;
|
||||
|
||||
import com.engine.salary.entity.hrm.po.ExpandFieldSettingsPO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
public interface ExpandFieldSettingsMapper {
|
||||
|
||||
/**
|
||||
* 查询所有记录
|
||||
*
|
||||
* @return 返回集合,没有返回空List
|
||||
*/
|
||||
List<ExpandFieldSettingsPO> listAll();
|
||||
|
||||
/**
|
||||
* 条件查询
|
||||
*
|
||||
* @return 返回集合,没有返回空List
|
||||
*/
|
||||
List<ExpandFieldSettingsPO> listSome(ExpandFieldSettingsPO expandFieldSettings);
|
||||
|
||||
|
||||
/**
|
||||
* 根据主键查询
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 返回记录,没有返回null
|
||||
*/
|
||||
ExpandFieldSettingsPO getById(Long id);
|
||||
|
||||
/**
|
||||
* 新增,忽略null字段
|
||||
*
|
||||
* @param expandFieldSettings 新增的记录
|
||||
* @return 返回影响行数
|
||||
*/
|
||||
int insertIgnoreNull(ExpandFieldSettingsPO expandFieldSettings);
|
||||
|
||||
/**
|
||||
* 修改,修改所有字段
|
||||
*
|
||||
* @param expandFieldSettings 修改的记录
|
||||
* @return 返回影响行数
|
||||
*/
|
||||
int update(ExpandFieldSettingsPO expandFieldSettings);
|
||||
|
||||
/**
|
||||
* 修改,忽略null字段
|
||||
*
|
||||
* @param expandFieldSettings 修改的记录
|
||||
* @return 返回影响行数
|
||||
*/
|
||||
int updateIgnoreNull(ExpandFieldSettingsPO expandFieldSettings);
|
||||
|
||||
/**
|
||||
* 删除记录
|
||||
*
|
||||
* @param expandFieldSettings 待删除的记录
|
||||
* @return 返回影响行数
|
||||
*/
|
||||
int delete(ExpandFieldSettingsPO expandFieldSettings);
|
||||
|
||||
/**
|
||||
* 批量删除记录
|
||||
* @param ids 主键id集合
|
||||
*/
|
||||
void deleteByIds(@Param("ids") Collection<Long> ids);
|
||||
|
||||
ExpandFieldSettingsPO getByModule(String module);
|
||||
}
|
||||
|
|
@ -0,0 +1,259 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="com.engine.salary.mapper.hrm.ExpandFieldSettingsMapper">
|
||||
<resultMap id="BaseResultMap" type="com.engine.salary.entity.hrm.po.ExpandFieldSettingsPO">
|
||||
<result column="id" property="id"/>
|
||||
<result column="module" property="module"/>
|
||||
<result column="module_info" property="moduleInfo"/>
|
||||
<result column="primaryKey" property="primaryKey"/>
|
||||
<result column="expand_sql" property="expandSql"/>
|
||||
<result column="field_setting" property="fieldSetting"/>
|
||||
<result column="create_time" property="createTime"/>
|
||||
<result column="update_time" property="updateTime"/>
|
||||
<result column="creator" property="creator"/>
|
||||
<result column="delete_type" property="deleteType"/>
|
||||
<result column="tenant_key" property="tenantKey"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- 表字段 -->
|
||||
<sql id="baseColumns">
|
||||
t
|
||||
.
|
||||
id
|
||||
, t.module
|
||||
, t.module_info
|
||||
, t.primaryKey
|
||||
, t.expand_sql
|
||||
, t.field_setting
|
||||
, t.create_time
|
||||
, t.update_time
|
||||
, t.creator
|
||||
, t.delete_type
|
||||
, t.tenant_key
|
||||
</sql>
|
||||
|
||||
<!-- 查询全部 -->
|
||||
<select id="listAll" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="baseColumns"/>
|
||||
FROM hrsa_expand_field_settings t
|
||||
WHERE delete_type = 0
|
||||
</select>
|
||||
|
||||
<!-- 根据主键获取单条记录 -->
|
||||
<select id="getById" resultMap="BaseResultMap" parameterType="Long">
|
||||
SELECT
|
||||
<include refid="baseColumns"/>
|
||||
FROM hrsa_expand_field_settings t
|
||||
WHERE id = #{id} AND delete_type = 0
|
||||
</select>
|
||||
|
||||
<!-- 条件查询 -->
|
||||
<select id="listSome" resultMap="BaseResultMap"
|
||||
parameterType="com.engine.salary.entity.hrm.po.ExpandFieldSettingsPO">
|
||||
SELECT
|
||||
<include refid="baseColumns"/>
|
||||
FROM hrsa_expand_field_settings t
|
||||
WHERE delete_type = 0
|
||||
<if test="module != null">
|
||||
AND module = #{module}
|
||||
</if>
|
||||
<if test="moduleInfo != null">
|
||||
AND module_info = #{moduleInfo}
|
||||
</if>
|
||||
<if test="primaryKey != null">
|
||||
AND primaryKey = #{primaryKey}
|
||||
</if>
|
||||
<if test="expandSql != null">
|
||||
AND expand_sql = #{expandSql}
|
||||
</if>
|
||||
<if test="fieldSetting != null">
|
||||
AND field_setting = #{fieldSetting}
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
AND create_time = #{createTime}
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
AND update_time = #{updateTime}
|
||||
</if>
|
||||
<if test="creator != null">
|
||||
AND creator = #{creator}
|
||||
</if>
|
||||
<if test="deleteType != null">
|
||||
AND delete_type = #{deleteType}
|
||||
</if>
|
||||
<if test="tenantKey != null">
|
||||
AND tenant_key = #{tenantKey}
|
||||
</if>
|
||||
<if test="ids != null and ids.size()>0">
|
||||
AND id IN
|
||||
<foreach collection="ids" open="(" item="id" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
ORDER BY id DESC
|
||||
</select>
|
||||
|
||||
|
||||
<!-- 插入不为NULL的字段 -->
|
||||
<insert id="insertIgnoreNull" parameterType="com.engine.salary.entity.hrm.po.ExpandFieldSettingsPO">
|
||||
INSERT INTO hrsa_expand_field_settings
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
id,
|
||||
</if>
|
||||
<if test="module != null">
|
||||
module,
|
||||
</if>
|
||||
<if test="moduleInfo != null">
|
||||
module_info,
|
||||
</if>
|
||||
<if test="primaryKey != null">
|
||||
primaryKey,
|
||||
</if>
|
||||
<if test="expandSql != null">
|
||||
expand_sql,
|
||||
</if>
|
||||
<if test="fieldSetting != null">
|
||||
field_setting,
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time,
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time,
|
||||
</if>
|
||||
<if test="creator != null">
|
||||
creator,
|
||||
</if>
|
||||
<if test="deleteType != null">
|
||||
delete_type,
|
||||
</if>
|
||||
<if test="tenantKey != null">
|
||||
tenant_key,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
#{id},
|
||||
</if>
|
||||
<if test="module != null">
|
||||
#{module},
|
||||
</if>
|
||||
<if test="moduleInfo != null">
|
||||
#{moduleInfo},
|
||||
</if>
|
||||
<if test="primaryKey != null">
|
||||
#{primaryKey},
|
||||
</if>
|
||||
<if test="expandSql != null">
|
||||
#{expandSql},
|
||||
</if>
|
||||
<if test="fieldSetting != null">
|
||||
#{fieldSetting},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
#{createTime},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
#{updateTime},
|
||||
</if>
|
||||
<if test="creator != null">
|
||||
#{creator},
|
||||
</if>
|
||||
<if test="deleteType != null">
|
||||
#{deleteType},
|
||||
</if>
|
||||
<if test="tenantKey != null">
|
||||
#{tenantKey},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
|
||||
|
||||
<!-- 更新,更新全部字段 -->
|
||||
<update id="update" parameterType="com.engine.salary.entity.hrm.po.ExpandFieldSettingsPO">
|
||||
UPDATE hrsa_expand_field_settings
|
||||
<set>
|
||||
module=#{module},
|
||||
module_info=#{moduleInfo},
|
||||
primaryKey=#{primaryKey},
|
||||
expand_sql=#{expandSql},
|
||||
field_setting=#{fieldSetting},
|
||||
create_time=#{createTime},
|
||||
update_time=#{updateTime},
|
||||
creator=#{creator},
|
||||
delete_type=#{deleteType},
|
||||
tenant_key=#{tenantKey},
|
||||
</set>
|
||||
WHERE id = #{id} AND delete_type = 0
|
||||
</update>
|
||||
|
||||
|
||||
<!-- 更新不为NULL的字段 -->
|
||||
<update id="updateIgnoreNull" parameterType="com.engine.salary.entity.hrm.po.ExpandFieldSettingsPO">
|
||||
UPDATE hrsa_expand_field_settings
|
||||
<set>
|
||||
<if test="module != null">
|
||||
module=#{module},
|
||||
</if>
|
||||
<if test="moduleInfo != null">
|
||||
module_info=#{moduleInfo},
|
||||
</if>
|
||||
<if test="primaryKey != null">
|
||||
primaryKey=#{primaryKey},
|
||||
</if>
|
||||
<if test="expandSql != null">
|
||||
expand_sql=#{expandSql},
|
||||
</if>
|
||||
<if test="fieldSetting != null">
|
||||
field_setting=#{fieldSetting},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time=#{createTime},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time=#{updateTime},
|
||||
</if>
|
||||
<if test="creator != null">
|
||||
creator=#{creator},
|
||||
</if>
|
||||
<if test="deleteType != null">
|
||||
delete_type=#{deleteType},
|
||||
</if>
|
||||
<if test="tenantKey != null">
|
||||
tenant_key=#{tenantKey},
|
||||
</if>
|
||||
</set>
|
||||
WHERE id = #{id} AND delete_type = 0
|
||||
</update>
|
||||
|
||||
|
||||
<!-- 根据主键删除记录 -->
|
||||
<delete id="delete">
|
||||
UPDATE hrsa_expand_field_settings
|
||||
SET delete_type=1
|
||||
WHERE id = #{id}
|
||||
AND delete_type = 0
|
||||
</delete>
|
||||
|
||||
<delete id="deleteByIds">
|
||||
UPDATE hrsa_expand_field_settings
|
||||
SET delete_type = 1
|
||||
WHERE delete_type = 0
|
||||
AND id IN
|
||||
<foreach collection="ids" open="(" item="id" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<!-- 根据主键获取单条记录 -->
|
||||
<select id="getByModule" resultMap="BaseResultMap" >
|
||||
SELECT
|
||||
<include refid="baseColumns"/>
|
||||
FROM hrsa_expand_field_settings t
|
||||
WHERE module = #{module} AND delete_type = 0
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
@ -2,7 +2,10 @@ package com.engine.salary.report.entity.bo;
|
|||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.cloudstore.eccom.pc.table.WeaTableColumn;
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.salary.component.WeaTableColumnGroup;
|
||||
import com.engine.salary.entity.hrm.dto.EmployeeInfoExpandDTO;
|
||||
import com.engine.salary.entity.hrm.dto.FieldSetting;
|
||||
import com.engine.salary.entity.salaryacct.po.SalaryAcctEmployeePO;
|
||||
import com.engine.salary.report.common.constant.SalaryStatisticsDimensionConstant;
|
||||
import com.engine.salary.report.entity.dto.SalaryStatisticsItemRuleDTO;
|
||||
|
|
@ -14,6 +17,8 @@ import com.engine.salary.report.entity.po.SalaryStatisticsDimensionPO;
|
|||
import com.engine.salary.report.entity.po.SalaryStatisticsItemPO;
|
||||
import com.engine.salary.report.entity.po.SalaryStatisticsReportPO;
|
||||
import com.engine.salary.report.enums.UnitTypeEnum;
|
||||
import com.engine.salary.report.service.SalaryStatisticsDimensionService;
|
||||
import com.engine.salary.report.service.impl.SalaryStatisticsDimensionServiceImpl;
|
||||
import com.engine.salary.report.util.ReportDataUtil;
|
||||
import com.engine.salary.report.util.ReportTimeUtil;
|
||||
import com.engine.salary.util.SalaryDateUtil;
|
||||
|
|
@ -27,6 +32,7 @@ import org.apache.commons.collections4.MapUtils;
|
|||
import org.apache.commons.compress.utils.Lists;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
|
|
@ -80,6 +86,10 @@ public class SalaryStatisticsReportBO {
|
|||
public static final String G_YEAR = "year";
|
||||
public static final String G_ITEM = "ITEM";
|
||||
|
||||
private static SalaryStatisticsDimensionService getSalaryStatisticsDimensionService() {
|
||||
return ServiceUtil.getService(SalaryStatisticsDimensionServiceImpl.class, new User(1));
|
||||
}
|
||||
|
||||
/**
|
||||
* 参数转换
|
||||
*
|
||||
|
|
@ -832,11 +842,12 @@ public class SalaryStatisticsReportBO {
|
|||
|
||||
result.add(new WeaTableColumnGroup("150", dimensionName.getDimName(), "dimension"));
|
||||
|
||||
//人员维度新增部门和工号
|
||||
if (SalaryStatisticsDimensionConstant.DM_EMPLOYEE.equals(dimensionName.getDimCode())) {
|
||||
result.add(new WeaTableColumnGroup("150", "部门", "departmentName"));
|
||||
result.add(new WeaTableColumnGroup("150", "工号", "workcode"));
|
||||
}
|
||||
//扩展维度属性
|
||||
EmployeeInfoExpandDTO expandFieldSettings = getSalaryStatisticsDimensionService().getExpandFieldSettings("dim_" + dimensionName.getDimCode());
|
||||
List<FieldSetting> fieldSettings = Optional.ofNullable(Optional.ofNullable(expandFieldSettings).orElse(new EmployeeInfoExpandDTO()).getFieldSettings()).orElse(new ArrayList<>());
|
||||
fieldSettings.stream().sorted(Comparator.comparing(FieldSetting::getIndex)).forEach(setting -> {
|
||||
result.add(new WeaTableColumnGroup("150", setting.getName(), setting.getField()));
|
||||
});
|
||||
|
||||
Map<Long, SalaryStatisticsItemPO> itemMap = salaryStatisticsItemList.stream().collect(Collectors.toMap(SalaryStatisticsItemPO::getId, Function.identity()));
|
||||
Map<Long, String> itemIdNameMap = salaryStatisticsItemList.stream().collect(LinkedHashMap::new, (map, item) -> map.put(item.getId(), item.getItemName()), LinkedHashMap::putAll);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.engine.salary.report.service;
|
||||
|
||||
import com.engine.salary.entity.hrm.dto.EmployeeInfoExpandDTO;
|
||||
import com.engine.salary.report.entity.param.SalaryStatisticsDimensionQueryParam;
|
||||
import com.engine.salary.report.entity.param.SalaryStatisticsDimensionSaveParam;
|
||||
import com.engine.salary.report.entity.po.SalaryStatisticsDimensionPO;
|
||||
|
|
@ -58,6 +59,20 @@ public interface SalaryStatisticsDimensionService {
|
|||
*/
|
||||
String save(SalaryStatisticsDimensionSaveParam saveParam);
|
||||
|
||||
/**
|
||||
* 保存字段扩展
|
||||
* @param saveParam
|
||||
* @return
|
||||
*/
|
||||
void saveExpandFieldSettings(EmployeeInfoExpandDTO saveParam);
|
||||
|
||||
/**
|
||||
* 查询薪酬统计维度扩展字段设置
|
||||
* @param module
|
||||
* @return
|
||||
*/
|
||||
EmployeeInfoExpandDTO getExpandFieldSettings(String module);
|
||||
|
||||
/**
|
||||
* 删除薪酬统计维度
|
||||
*
|
||||
|
|
@ -72,4 +87,5 @@ public interface SalaryStatisticsDimensionService {
|
|||
* @return
|
||||
*/
|
||||
List<SalaryStatisticsDimensionPO> listAllDefaultDimension();
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package com.engine.salary.report.service.impl;
|
|||
import com.alibaba.fastjson.JSON;
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.salary.entity.hrm.dto.EmployeeInfoExpandDTO;
|
||||
import com.engine.salary.exception.SalaryRunTimeException;
|
||||
import com.engine.salary.mapper.report.SalaryStatisticsDimensionMapper;
|
||||
import com.engine.salary.report.common.constant.SalaryStatisticsDimensionConstant;
|
||||
|
|
@ -13,6 +14,8 @@ import com.engine.salary.report.entity.po.SalaryStatisticsReportPO;
|
|||
import com.engine.salary.report.enums.SalaryStatisticsDimensionTypeEnum;
|
||||
import com.engine.salary.report.service.SalaryStatisticsDimensionService;
|
||||
import com.engine.salary.report.service.SalaryStatisticsReportService;
|
||||
import com.engine.salary.service.SalaryEmployeeService;
|
||||
import com.engine.salary.service.impl.SalaryEmployeeServiceImpl;
|
||||
import com.engine.salary.util.SalaryI18nUtil;
|
||||
import com.engine.salary.util.db.MapperProxyFactory;
|
||||
import com.engine.salary.util.page.PageInfo;
|
||||
|
|
@ -46,6 +49,10 @@ public class SalaryStatisticsDimensionServiceImpl extends Service implements Sal
|
|||
return ServiceUtil.getService(SalaryStatisticsReportServiceImpl.class, user);
|
||||
}
|
||||
|
||||
private SalaryEmployeeService getSalaryEmployeeService(User user) {
|
||||
return ServiceUtil.getService(SalaryEmployeeServiceImpl.class, user);
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化默认维度
|
||||
*/
|
||||
|
|
@ -197,6 +204,16 @@ public class SalaryStatisticsDimensionServiceImpl extends Service implements Sal
|
|||
return StringUtils.EMPTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveExpandFieldSettings(EmployeeInfoExpandDTO saveParam) {
|
||||
getSalaryEmployeeService(user).saveEmployeeExpandFieldSettings(saveParam);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EmployeeInfoExpandDTO getExpandFieldSettings(String module) {
|
||||
return getSalaryEmployeeService(user).getExpandFieldSettings(module);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> delete(Collection<Long> ids) {
|
||||
if (CollectionUtils.isEmpty(ids)) {
|
||||
|
|
|
|||
|
|
@ -6,6 +6,8 @@ import com.engine.core.impl.Service;
|
|||
import com.engine.salary.cache.SalaryCacheKey;
|
||||
import com.engine.salary.constant.SalaryDefaultTenantConstant;
|
||||
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
|
||||
import com.engine.salary.entity.hrm.dto.EmployeeInfoExpandDTO;
|
||||
import com.engine.salary.entity.hrm.dto.FieldSetting;
|
||||
import com.engine.salary.entity.salaryacct.po.SalaryAcctEmployeePO;
|
||||
import com.engine.salary.entity.salaryacct.po.SalaryAcctRecordPO;
|
||||
import com.engine.salary.entity.salaryacct.po.SalaryAcctResultPO;
|
||||
|
|
@ -22,6 +24,7 @@ import com.engine.salary.report.entity.po.SalaryStatisticsDimensionPO;
|
|||
import com.engine.salary.report.entity.po.SalaryStatisticsItemPO;
|
||||
import com.engine.salary.report.entity.po.SalaryStatisticsReportPO;
|
||||
import com.engine.salary.report.enums.SalaryStatisticsDimensionTypeEnum;
|
||||
import com.engine.salary.report.service.SalaryStatisticsDimensionService;
|
||||
import com.engine.salary.report.service.SalaryStatisticsItemService;
|
||||
import com.engine.salary.report.service.SalaryStatisticsReportService;
|
||||
import com.engine.salary.report.util.ReportTimeUtil;
|
||||
|
|
@ -70,6 +73,10 @@ public class SalaryStatisticsReportServiceImpl extends Service implements Salary
|
|||
return MapperProxyFactory.getProxy(SalaryStatisticsReportMapper.class);
|
||||
}
|
||||
|
||||
private SalaryStatisticsDimensionService getSalaryStatisticsDimensionService(User user) {
|
||||
return ServiceUtil.getService(SalaryStatisticsDimensionServiceImpl.class, user);
|
||||
}
|
||||
|
||||
private SalaryStatisticsItemService getSalaryStatisticsItemService(User user) {
|
||||
return ServiceUtil.getService(SalaryStatisticsItemServiceImpl.class, user);
|
||||
}
|
||||
|
|
@ -392,8 +399,8 @@ public class SalaryStatisticsReportServiceImpl extends Service implements Salary
|
|||
|
||||
Map<Long, Map<String, String>> resultMap = new HashMap<>();
|
||||
List<Long> salaryAcctEmployeeIds = salaryAcctEmployeeList.stream().map(SalaryAcctEmployeePO::getId).collect(Collectors.toList());
|
||||
if( NumberUtils.isCreatable(dimension.getDimCode()) ){
|
||||
List<SalaryAcctResultPO> salaryAcctResultValues = getSalaryAcctResultService(user).listByAcctEmployeeIdsAndSalaryItemIds(salaryAcctEmployeeIds,Collections.singleton(Long.valueOf(dimension.getDimCode())));
|
||||
if (NumberUtils.isCreatable(dimension.getDimCode())) {
|
||||
List<SalaryAcctResultPO> salaryAcctResultValues = getSalaryAcctResultService(user).listByAcctEmployeeIdsAndSalaryItemIds(salaryAcctEmployeeIds, Collections.singleton(Long.valueOf(dimension.getDimCode())));
|
||||
List<Long> finalSalaryAcctEmpIds = getSalaryAcctResultService(user).listAcctEmpIdByAcctEmpId(salaryAcctEmployeeIds);
|
||||
Map<Long, List<SalaryAcctResultPO>> salaryAcctEmpResultMap = SalaryEntityUtil.group2Map(salaryAcctResultValues, SalaryAcctResultPO::getSalaryAcctEmpId);
|
||||
salaryAcctEmpResultMap.forEach((k, v) -> {
|
||||
|
|
@ -401,8 +408,8 @@ public class SalaryStatisticsReportServiceImpl extends Service implements Salary
|
|||
resultMap.put(k, collect);
|
||||
});
|
||||
salaryAcctEmployeeIds.stream().forEach(id -> {
|
||||
if(!resultMap.containsKey(id) && finalSalaryAcctEmpIds.contains(id))
|
||||
resultMap.put(id,Collections.emptyMap());
|
||||
if (!resultMap.containsKey(id) && finalSalaryAcctEmpIds.contains(id))
|
||||
resultMap.put(id, Collections.emptyMap());
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -464,7 +471,7 @@ public class SalaryStatisticsReportServiceImpl extends Service implements Salary
|
|||
}
|
||||
|
||||
public List getReportCache() {
|
||||
List report = new ArrayList<>();
|
||||
List report = new ArrayList<>();
|
||||
|
||||
//获取所有缓存报表的id
|
||||
String salaryReportIds = Utils.null2String(getSalaryCacheService(user).get(SalaryCacheKey.SALARY_REPORT_IDS));
|
||||
|
|
@ -473,13 +480,13 @@ public class SalaryStatisticsReportServiceImpl extends Service implements Salary
|
|||
if (StringUtils.isNotBlank(id)) {
|
||||
//报表下条件id
|
||||
String salaryReportConditions = getSalaryCacheService(user).get(SalaryCacheKey.SALARY_REPORT_CONDITIONS + id);
|
||||
List c= new ArrayList<>();
|
||||
List c = new ArrayList<>();
|
||||
if (StringUtils.isNotBlank(salaryReportConditions)) {
|
||||
Arrays.asList(salaryReportConditions.split(",")).forEach(paramMd5 -> {
|
||||
if (StringUtils.isNotBlank(paramMd5)) {
|
||||
Map<String, Object> data = getSalaryCacheService(user).get(SalaryCacheKey.SALARY_REPORT_DATA + paramMd5);
|
||||
Map kv= new HashMap<>();
|
||||
kv.put(paramMd5,data);
|
||||
Map kv = new HashMap<>();
|
||||
kv.put(paramMd5, data);
|
||||
c.add(kv);
|
||||
}
|
||||
}
|
||||
|
|
@ -1014,7 +1021,14 @@ public class SalaryStatisticsReportServiceImpl extends Service implements Salary
|
|||
Map<Long, List<SalaryAcctEmployeePO>> employeeListMap = accountDetailPOList.stream().collect(Collectors.groupingBy(SalaryAcctEmployeePO::getEmployeeId));
|
||||
Map<Long, List<SalaryAcctEmployeePO>> lastEmployeeListMap = data.getLastList().stream().collect(Collectors.groupingBy(SalaryAcctEmployeePO::getEmployeeId));
|
||||
Map<Long, List<SalaryAcctEmployeePO>> sameEmployeeListMap = data.getSameList().stream().collect(Collectors.groupingBy(SalaryAcctEmployeePO::getEmployeeId));
|
||||
Map<Long, DataCollectionEmployee> employeeByIdMap = getSalaryEmployeeService(user).getEmployeeByIdsAll(accountDetailPOList.stream().map(SalaryAcctEmployeePO::getEmployeeId).distinct().collect(Collectors.toList())).stream().collect(Collectors.toMap(DataCollectionEmployee::getEmployeeId, o -> o));
|
||||
|
||||
//人员维度扩展属性
|
||||
EmployeeInfoExpandDTO employeeInfoExpandDTO = getSalaryStatisticsDimensionService(user).getExpandFieldSettings("dim_employee");
|
||||
List<FieldSetting> fieldSettings = Optional.ofNullable(Optional.ofNullable(employeeInfoExpandDTO).orElse(new EmployeeInfoExpandDTO()).getFieldSettings()).orElse(new ArrayList<>());
|
||||
|
||||
Map<Long, DataCollectionEmployee> employeeByIdMap = getSalaryEmployeeService(user).expandEmployeeInfo(accountDetailPOList.stream().map(SalaryAcctEmployeePO::getEmployeeId).distinct().collect(Collectors.toList()), employeeInfoExpandDTO)
|
||||
.stream()
|
||||
.collect(Collectors.toMap(DataCollectionEmployee::getEmployeeId, o -> o));
|
||||
|
||||
// List<ExtEmployeePO> extEmployees = extEmployeeService.listByIdsWithDeleted(accountDetailPOList.stream().filter(e -> EmployeeTypeEnum.EXT_EMPLOYEE.getValue().equals(e.getEmployeeType())).map(SalaryAcctEmployeePO::getEmployeeId).distinct().collect(Collectors.toList()), data.getTenantKey());
|
||||
// Map<Long, String> employeeExtByIdMap = SalaryEntityUtil.convert2Map(extEmployees, ExtEmployeePO::getId, ExtEmployeePO::getUsername);
|
||||
|
|
@ -1025,8 +1039,11 @@ public class SalaryStatisticsReportServiceImpl extends Service implements Salary
|
|||
Map<String, Object> temp = new HashMap<>();
|
||||
// temp.put(DM, Objects.nonNull(employeeByIdMap.get(k)) ? employeeByIdMap.get(k) : employeeExtByIdMap.get(k));
|
||||
temp.put(DM, employeeByIdMap.get(k).getUsername());
|
||||
temp.put("departmentName", employeeByIdMap.get(k).getDepartmentName());
|
||||
temp.put("workcode", employeeByIdMap.get(k).getWorkcode());
|
||||
fieldSettings.forEach(
|
||||
fieldSetting -> {
|
||||
temp.put(fieldSetting.getField(), employeeByIdMap.get(k).getExtendData().get(fieldSetting.getField()));
|
||||
}
|
||||
);
|
||||
temp.putAll(SalaryStatisticsReportBO.calculateItem(v, lastEmployeeListMap.get(k), sameEmployeeListMap.get(k), salaryAcctResultValueMap, data.getSalaryStatisticsItemList()));
|
||||
records.add(temp);
|
||||
} else if (StringUtils.equals(dimensionValue, employeeByIdMap.get(k).getUsername())) {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.engine.salary.report.web;
|
||||
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.salary.entity.hrm.dto.EmployeeInfoExpandDTO;
|
||||
import com.engine.salary.report.entity.dto.SalaryStatisticsDimensionFormDTO;
|
||||
import com.engine.salary.report.entity.dto.SalaryStatisticsDimensionListDTO;
|
||||
import com.engine.salary.report.entity.param.SalaryStatisticsDimensionQueryParam;
|
||||
|
|
@ -58,7 +59,7 @@ public class SalaryStatisticsDimensionController {
|
|||
@GET
|
||||
@Path("/getForm")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String getForm(@Context HttpServletRequest request, @Context HttpServletResponse response, @QueryParam(value = "id")Long id) {
|
||||
public String getForm(@Context HttpServletRequest request, @Context HttpServletResponse response, @QueryParam(value = "id") Long id) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return new ResponseResult<Long, SalaryStatisticsDimensionFormDTO>(user).run(getSalaryStatisticsDimensionWrapper(user)::getFrom, id);
|
||||
}
|
||||
|
|
@ -78,6 +79,33 @@ public class SalaryStatisticsDimensionController {
|
|||
return new ResponseResult<SalaryStatisticsDimensionSaveParam, String>(user).run(getSalaryStatisticsDimensionWrapper(user)::save, saveParam);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存薪酬统计维度扩展字段设置
|
||||
*
|
||||
* @param saveParam
|
||||
* @return
|
||||
*/
|
||||
@POST
|
||||
@Path("/saveExpandFieldSettings")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String saveExpandFieldSettings(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody EmployeeInfoExpandDTO saveParam) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return new ResponseResult<EmployeeInfoExpandDTO, String>(user).run(getSalaryStatisticsDimensionWrapper(user)::saveExpandFieldSettings, saveParam);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询薪酬统计维度扩展字段设置
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GET
|
||||
@Path("/getExpandFieldSettings")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String getExpandFieldSettings(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return new ResponseResult<String, EmployeeInfoExpandDTO>(user).run(getSalaryStatisticsDimensionWrapper(user)::getExpandFieldSettings);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除薪酬统计维度
|
||||
*
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package com.engine.salary.report.wrapper;
|
|||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.salary.component.WeaFormOption;
|
||||
import com.engine.salary.entity.hrm.dto.EmployeeInfoExpandDTO;
|
||||
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
|
||||
import com.engine.salary.enums.salaryitem.SalaryDataTypeEnum;
|
||||
import com.engine.salary.exception.SalaryRunTimeException;
|
||||
|
|
@ -22,6 +23,7 @@ import com.engine.salary.service.SalaryItemService;
|
|||
import com.engine.salary.service.impl.SalaryItemServiceImpl;
|
||||
import com.engine.salary.util.JsonUtil;
|
||||
import com.engine.salary.util.SalaryI18nUtil;
|
||||
import com.engine.salary.util.XssSQL;
|
||||
import com.engine.salary.util.page.PageInfo;
|
||||
import com.engine.salary.util.page.SalaryPageUtil;
|
||||
import com.google.common.collect.Lists;
|
||||
|
|
@ -43,11 +45,11 @@ public class SalaryStatisticsDimensionWrapper extends Service {
|
|||
|
||||
|
||||
private SalaryStatisticsDimensionService salaryStatisticsDimensionService(User user) {
|
||||
return ServiceUtil.getService(SalaryStatisticsDimensionServiceImpl.class, user);
|
||||
return ServiceUtil.getService(SalaryStatisticsDimensionServiceImpl.class, user);
|
||||
}
|
||||
|
||||
private SalaryItemService salaryItemService(User user) {
|
||||
return ServiceUtil.getService(SalaryItemServiceImpl.class, user);
|
||||
return ServiceUtil.getService(SalaryItemServiceImpl.class, user);
|
||||
}
|
||||
|
||||
private SalaryStatisticsDimensionService getSalaryStatisticsDimensionService(User user) {
|
||||
|
|
@ -67,7 +69,7 @@ public class SalaryStatisticsDimensionWrapper extends Service {
|
|||
public PageInfo<SalaryStatisticsDimensionListDTO> list(SalaryStatisticsDimensionQueryParam queryParam) {
|
||||
PageInfo<SalaryStatisticsDimensionPO> page = salaryStatisticsDimensionService(user).listPage(queryParam);
|
||||
List<SalaryStatisticsDimensionPO> list = page.getList();
|
||||
List<SalaryStatisticsDimensionListDTO> dtoList= new ArrayList<>();
|
||||
List<SalaryStatisticsDimensionListDTO> dtoList = new ArrayList<>();
|
||||
|
||||
// 获取默认维度统计
|
||||
List<SalaryStatisticsDimensionPO> defaultSalaryStatisticsDimensions = getSalaryStatisticsDimensionService(user).listAllDefaultDimension();
|
||||
|
|
@ -87,11 +89,11 @@ public class SalaryStatisticsDimensionWrapper extends Service {
|
|||
.canEdit(true)
|
||||
.canDelete(true)
|
||||
.build();
|
||||
if (defaultDimensionIds.contains(dto.getId())){
|
||||
if (defaultDimensionIds.contains(dto.getId())) {
|
||||
// 默认维度不允许修改、删除
|
||||
dto.setCanEdit(false);
|
||||
dto.setCanDelete(false);
|
||||
}else if(haveUsedDimIds.contains(dto.getId().toString())){
|
||||
} else if (haveUsedDimIds.contains(dto.getId().toString())) {
|
||||
// 被薪资统计报表引用的不能删除
|
||||
dto.setCanDelete(false);
|
||||
}
|
||||
|
|
@ -99,7 +101,7 @@ public class SalaryStatisticsDimensionWrapper extends Service {
|
|||
});
|
||||
}
|
||||
|
||||
PageInfo<SalaryStatisticsDimensionListDTO> salaryStatisticsDimensionListDTOPageInfo = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize());
|
||||
PageInfo<SalaryStatisticsDimensionListDTO> salaryStatisticsDimensionListDTOPageInfo = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize());
|
||||
salaryStatisticsDimensionListDTOPageInfo.setList(dtoList);
|
||||
salaryStatisticsDimensionListDTOPageInfo.setTotal(page.getTotal());
|
||||
return salaryStatisticsDimensionListDTOPageInfo;
|
||||
|
|
@ -138,8 +140,8 @@ public class SalaryStatisticsDimensionWrapper extends Service {
|
|||
.map(item -> new WeaFormOption(item.getId().toString(), item.getName())).collect(Collectors.toList()));
|
||||
// 1.构建基础信息表单
|
||||
Map baseForm = new HashMap<>();
|
||||
baseForm.put("statsDimOptions",statsDimOptions);
|
||||
baseForm.put("groupDimOptions",groupDimOptions);
|
||||
baseForm.put("statsDimOptions", statsDimOptions);
|
||||
baseForm.put("groupDimOptions", groupDimOptions);
|
||||
// 2.分组设置
|
||||
String groupSetting = "[]";
|
||||
if (id != null) {
|
||||
|
|
@ -187,6 +189,28 @@ public class SalaryStatisticsDimensionWrapper extends Service {
|
|||
return salaryStatisticsDimensionService(user).save(saveParam);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存薪酬统计维度扩展设置
|
||||
*
|
||||
* @param saveParam
|
||||
* @return
|
||||
*/
|
||||
public void saveExpandFieldSettings(EmployeeInfoExpandDTO saveParam) {
|
||||
saveParam.setExpandSql(XssSQL.handleXSSContent(saveParam.getExpandSql()));
|
||||
saveParam.setModule("dim_employee");
|
||||
salaryStatisticsDimensionService(user).saveExpandFieldSettings(saveParam);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询薪酬统计维度扩展字段设置
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public EmployeeInfoExpandDTO getExpandFieldSettings() {
|
||||
return salaryStatisticsDimensionService(user).getExpandFieldSettings("dim_employee");
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除薪酬统计维度
|
||||
*
|
||||
|
|
@ -211,4 +235,5 @@ public class SalaryStatisticsDimensionWrapper extends Service {
|
|||
return map;
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -305,13 +305,13 @@ public class SalaryStatisticsReportWrapper extends Service {
|
|||
//已缓存的报表id
|
||||
String salaryReportIds = Utils.null2String(getSalaryCacheService(user).get(SalaryCacheKey.SALARY_REPORT_IDS));
|
||||
String salaryReportConditions = "";
|
||||
if (StringUtils.isNotBlank(salaryReportIds) && salaryReportIds.contains(id + "")) {
|
||||
//报表中缓存的条件
|
||||
salaryReportConditions = Utils.null2String(getSalaryCacheService(user).get(SalaryCacheKey.SALARY_REPORT_CONDITIONS + id));
|
||||
if (StringUtils.isNotBlank(salaryReportConditions) && salaryReportConditions.contains(paramMd5)) {
|
||||
return getSalaryCacheService(user).get(SalaryCacheKey.SALARY_REPORT_DATA + paramMd5);
|
||||
}
|
||||
}
|
||||
// if (StringUtils.isNotBlank(salaryReportIds) && salaryReportIds.contains(id + "")) {
|
||||
// //报表中缓存的条件
|
||||
// salaryReportConditions = Utils.null2String(getSalaryCacheService(user).get(SalaryCacheKey.SALARY_REPORT_CONDITIONS + id));
|
||||
// if (StringUtils.isNotBlank(salaryReportConditions) && salaryReportConditions.contains(paramMd5)) {
|
||||
// return getSalaryCacheService(user).get(SalaryCacheKey.SALARY_REPORT_DATA + paramMd5);
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
// 列表data
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import com.engine.salary.entity.datacollection.DataCollectionEmployee;
|
|||
import com.engine.salary.entity.hrm.DeptInfo;
|
||||
import com.engine.salary.entity.hrm.PositionInfo;
|
||||
import com.engine.salary.entity.hrm.SubCompanyInfo;
|
||||
import com.engine.salary.entity.hrm.param.EmployeeInfoExpandParam;
|
||||
import com.engine.salary.entity.hrm.dto.EmployeeInfoExpandDTO;
|
||||
import com.engine.salary.entity.salarysob.param.SalarySobRangeEmpQueryParam;
|
||||
import com.engine.salary.enums.datacollection.UseEmployeeTypeEnum;
|
||||
|
||||
|
|
@ -101,7 +101,25 @@ public interface SalaryEmployeeService {
|
|||
*/
|
||||
Map<Long, String> getResignationMapByDate(String formatDate);
|
||||
|
||||
/**
|
||||
* 扩展人员信息
|
||||
* @param ids
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
List<DataCollectionEmployee> expandEmployeeInfo(List<Long> ids, EmployeeInfoExpandDTO param);
|
||||
|
||||
|
||||
List<DataCollectionEmployee> extendEmployeeInfo(List<Long> ids, EmployeeInfoExpandParam param);
|
||||
/**
|
||||
* 保存扩展信息
|
||||
* @param param
|
||||
*/
|
||||
void saveEmployeeExpandFieldSettings(EmployeeInfoExpandDTO param);
|
||||
|
||||
/**
|
||||
* 获取扩展信息
|
||||
* @param module
|
||||
* @return
|
||||
*/
|
||||
EmployeeInfoExpandDTO getExpandFieldSettings(String module);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,22 +1,25 @@
|
|||
package com.engine.salary.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.api.formmode.mybatis.util.SqlProxyHandle;
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.salary.biz.EmployBiz;
|
||||
import com.engine.salary.constant.SalaryDefaultTenantConstant;
|
||||
import com.engine.salary.entity.SalarySobExtRangePO;
|
||||
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
|
||||
import com.engine.salary.entity.hrm.DeptInfo;
|
||||
import com.engine.salary.entity.hrm.PositionInfo;
|
||||
import com.engine.salary.entity.hrm.SubCompanyInfo;
|
||||
import com.engine.salary.entity.hrm.param.EmployeeInfoExpandParam;
|
||||
import com.engine.salary.entity.hrm.param.FieldSetting;
|
||||
import com.engine.salary.entity.hrm.dto.EmployeeInfoExpandDTO;
|
||||
import com.engine.salary.entity.hrm.dto.FieldSetting;
|
||||
import com.engine.salary.entity.hrm.po.ExpandFieldSettingsPO;
|
||||
import com.engine.salary.entity.salarysob.bo.SalarySobRangeBO;
|
||||
import com.engine.salary.entity.salarysob.param.SalarySobRangeEmpQueryParam;
|
||||
import com.engine.salary.entity.salarysob.po.SalarySobRangePO;
|
||||
import com.engine.salary.enums.UserStatusEnum;
|
||||
import com.engine.salary.enums.datacollection.UseEmployeeTypeEnum;
|
||||
import com.engine.salary.mapper.datacollection.EmployMapper;
|
||||
import com.engine.salary.mapper.hrm.ExpandFieldSettingsMapper;
|
||||
import com.engine.salary.mapper.sys.SalarySysConfMapper;
|
||||
import com.engine.salary.service.ExtEmpService;
|
||||
import com.engine.salary.service.SalaryEmployeeService;
|
||||
|
|
@ -24,8 +27,8 @@ import com.engine.salary.service.SalarySobExtRangeService;
|
|||
import com.engine.salary.service.SalarySobRangeService;
|
||||
import com.engine.salary.sys.entity.po.SalarySysConfPO;
|
||||
import com.engine.salary.util.SalaryEntityUtil;
|
||||
import com.engine.salary.util.db.MapperProxyFactory;
|
||||
import com.google.common.collect.Lists;
|
||||
import dm.jdbc.util.IdGenerator;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.math.NumberUtils;
|
||||
|
|
@ -51,15 +54,16 @@ public class SalaryEmployeeServiceImpl extends Service implements SalaryEmployee
|
|||
return ServiceUtil.getService(SalarySobRangeServiceImpl.class, user);
|
||||
}
|
||||
|
||||
private EmployMapper getEmployMapper() {
|
||||
return MapperProxyFactory.getProxy(EmployMapper.class);
|
||||
}
|
||||
|
||||
private SalarySysConfMapper getSalarySysConfMapper() {
|
||||
return SqlProxyHandle.getProxy(SalarySysConfMapper.class);
|
||||
}
|
||||
|
||||
|
||||
private ExpandFieldSettingsMapper getExpandFieldSettingsMapper() {
|
||||
return SqlProxyHandle.getProxy(ExpandFieldSettingsMapper.class);
|
||||
}
|
||||
|
||||
|
||||
private ExtEmpService getExtEmpService(User user) {
|
||||
return ServiceUtil.getService(ExtEmpServiceImpl.class, user);
|
||||
}
|
||||
|
|
@ -289,37 +293,91 @@ public class SalaryEmployeeServiceImpl extends Service implements SalaryEmployee
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<DataCollectionEmployee> extendEmployeeInfo(List<Long> ids, EmployeeInfoExpandParam param) {
|
||||
public List<DataCollectionEmployee> expandEmployeeInfo(List<Long> ids, EmployeeInfoExpandDTO param) {
|
||||
|
||||
List<DataCollectionEmployee> employees = getEmployeeByIdsAll(ids);
|
||||
|
||||
EmployeeInfoExpandParam employeeInfoExpandParam = new EmployeeInfoExpandParam();
|
||||
employeeInfoExpandParam.setSql("select id,lastname from hrmresource where id =$人员id$ ");
|
||||
employeeInfoExpandParam.setPrimaryKey("id");
|
||||
FieldSetting build = FieldSetting.builder().name("名称").field("lastname").build();
|
||||
List<FieldSetting> list = new ArrayList<>();
|
||||
list.add(build);
|
||||
employeeInfoExpandParam.setFieldSettings(list);
|
||||
if (param != null) {
|
||||
RecordSet rs = new RecordSet();
|
||||
String sql = param.getExpandSql().replace("=$人员id$", "in (" + StringUtils.join(ids, ",") + ")")
|
||||
.replace("in($人员id$)", "in (" + StringUtils.join(ids, ",") + ")");
|
||||
String primaryKey = param.getPrimaryKey();
|
||||
rs.executeQuery(sql);
|
||||
while (rs.next()) {
|
||||
Map<String, String> extendData = new HashMap<>();
|
||||
param.getFieldSettings().forEach(setting -> {
|
||||
String field = setting.getField();
|
||||
String value = rs.getString(field);
|
||||
setting.setValue(value);
|
||||
extendData.put(field, value);
|
||||
});
|
||||
|
||||
RecordSet rs = new RecordSet();
|
||||
|
||||
String sql = employeeInfoExpandParam.getSql().replace("=$人员id$", "in" + StringUtils.join(ids, ","));
|
||||
String primaryKey = employeeInfoExpandParam.getPrimaryKey();
|
||||
rs.executeQuery(sql);
|
||||
while (rs.next()) {
|
||||
Map<String, String> extendData = new HashMap<>();
|
||||
list.forEach(setting -> {
|
||||
String field = setting.getField();
|
||||
String value = rs.getString(field);
|
||||
setting.setValue(value);
|
||||
extendData.put(field,value);
|
||||
});
|
||||
|
||||
rs.getString(primaryKey);
|
||||
employees.stream()
|
||||
.filter(e->primaryKey.equals(e.getEmployeeId().toString()))
|
||||
.forEach(e->e.setExtendData(extendData));
|
||||
String id = rs.getString(primaryKey);
|
||||
employees.stream()
|
||||
.filter(e -> id.equals(e.getEmployeeId().toString()))
|
||||
.forEach(e -> e.setExtendData(extendData));
|
||||
}
|
||||
}
|
||||
return employees;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveEmployeeExpandFieldSettings(EmployeeInfoExpandDTO param) {
|
||||
String settings = JSON.toJSONString(param.getFieldSettings());
|
||||
|
||||
Date now = new Date();
|
||||
|
||||
if (Objects.nonNull(param.getId())) {
|
||||
ExpandFieldSettingsPO po = getExpandFieldSettingsMapper().getById(param.getId());
|
||||
if (po == null) {
|
||||
throw new RuntimeException("配置不存在!");
|
||||
}
|
||||
|
||||
po.setPrimaryKey(param.getPrimaryKey());
|
||||
po.setExpandSql(param.getExpandSql());
|
||||
po.setFieldSetting(settings);
|
||||
po.setCreator((long) user.getUID());
|
||||
po.setUpdateTime(now);
|
||||
getExpandFieldSettingsMapper().update(po);
|
||||
|
||||
} else {
|
||||
ExpandFieldSettingsPO po = ExpandFieldSettingsPO.builder()
|
||||
.id(IdGenerator.generate())
|
||||
.module(param.getModule())
|
||||
.moduleInfo(param.getModuleInfo())
|
||||
.primaryKey(param.getPrimaryKey())
|
||||
.fieldSetting(settings)
|
||||
.expandSql(param.getExpandSql())
|
||||
.deleteType(0)
|
||||
.creator((long) user.getUID())
|
||||
.createTime(now)
|
||||
.updateTime(now)
|
||||
.tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY)
|
||||
.build();
|
||||
getExpandFieldSettingsMapper().insertIgnoreNull(po);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public EmployeeInfoExpandDTO getExpandFieldSettings(String module) {
|
||||
|
||||
ExpandFieldSettingsPO po = getExpandFieldSettingsMapper().getByModule(module);
|
||||
|
||||
if (po != null) {
|
||||
List<FieldSetting> list = JSON.parseArray(po.getFieldSetting(), FieldSetting.class);
|
||||
return EmployeeInfoExpandDTO.builder()
|
||||
.id(po.getId())
|
||||
.module(po.getModule())
|
||||
.moduleInfo(po.getModuleInfo())
|
||||
.primaryKey(po.getPrimaryKey())
|
||||
.expandSql(po.getExpandSql())
|
||||
.fieldSettings(list)
|
||||
.build();
|
||||
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,25 @@
|
|||
package com.engine.salary.util;
|
||||
|
||||
public class XssSQL {
|
||||
|
||||
public static String handleXSSContent(String xss) {
|
||||
return xss.replace("select", "select")
|
||||
.replace("SELECT", "SELECT")
|
||||
.replace("join", "join")
|
||||
.replace("JOIN", "JOIN")
|
||||
.replace("and", "and")
|
||||
.replace("AND", "AND")
|
||||
.replace("or", "or")
|
||||
.replace("OR", "OR")
|
||||
.replace("in", "in")
|
||||
.replace("IN", "IN")
|
||||
.replace("like", "like")
|
||||
.replace("LIKE", "like")
|
||||
.replace("exists", "exists")
|
||||
.replace("EXISTS", "EXISTS")
|
||||
.replace("between", "between")
|
||||
.replace("BETWEEN", "BETWEEN")
|
||||
.replace("union", "union")
|
||||
.replace("UNION", "UNION");
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue