Merge branch 'release/2.12.1.2403.02' into release/个税版本

# Conflicts:
#	src/com/engine/salary/mapper/datacollection/EmployMapper.java
#	src/com/engine/salary/mapper/datacollection/EmployMapper.xml
#	src/com/engine/salary/mapper/extemp/ExternalEmployeeMapper.java
#	src/com/engine/salary/service/ExtEmpService.java
#	src/com/engine/salary/service/SalaryEmployeeService.java
#	src/com/engine/salary/service/impl/ExtEmpServiceImpl.java
#	src/com/engine/salary/service/impl/SalaryEmployeeServiceImpl.java
This commit is contained in:
钱涛 2024-03-29 14:37:00 +08:00
commit 5f64acc269
34 changed files with 1426 additions and 61 deletions

View File

@ -1,5 +1,5 @@
log=false
defaultCloseNonStandard149=true
AESEncryptScrect=990EB004A1C862721C1513AE90038C9E
version=2.11.2.2403.01
version=2.12.1.2403.02
openFormulaForcedEditing=false

View File

@ -13,6 +13,7 @@ import weaver.conn.mybatis.MyBatisFactory;
import weaver.general.BaseBean;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class EmployBiz extends BaseBean {
@ -115,6 +116,24 @@ public class EmployBiz extends BaseBean {
}
}
public List<DataCollectionEmployee> listByVirtualParams(List<SalarySobRangeEmpQueryParam> virtualQueryParams) {
if (CollectionUtils.isEmpty(virtualQueryParams)) {
return Collections.emptyList();
}
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
EmployMapper mapper = sqlSession.getMapper(EmployMapper.class);
List<DataCollectionEmployee> emps = new ArrayList<>();
List<List<SalarySobRangeEmpQueryParam>> partition = Lists.partition(virtualQueryParams, 100);
partition.forEach(list->{
emps.addAll(mapper.listByVirtualParams(list));
});
return emps;
} finally {
sqlSession.close();
}
}
public DataCollectionEmployee getEmployeeById(Long employeeId) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {

View File

@ -183,6 +183,8 @@ public class ExtEmpPO {
private String tenantKey;
private Collection<Long> ids;
private Collection<Long> subcompanyIds;
private Collection<Long> departmentIds;
private String departmentOrgName;

View File

@ -1,5 +1,6 @@
package com.engine.salary.entity.hrm;
import com.engine.salary.annotation.I18n;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
@ -24,6 +25,7 @@ public class DeptInfo {
/**
* 名称
*/
@I18n
private String name;
/**

View File

@ -45,7 +45,12 @@ public class SalarySendDetailListQueryParam extends BaseQueryParam {
private Long taxAgent;
// 部门id")
private Long department;
private List<Long> departmentIds;
private String departmentIdStr;
// 分部id
private List<Long> subCompanyIds;
private String subCompanyIdStr;
// 岗位id")
private Long position;

View File

@ -47,6 +47,9 @@ public class SalarySendDetailQueryParam extends BaseQueryParam {
// 部门id")
private List<Long> departmentIds;
// 分部id
private List<Long> subCompanyIds;
// 岗位id")
private List<Long> positionIds;

View File

@ -47,6 +47,9 @@ public class SalarySendInfoQueryParam extends BaseQueryParam {
// 部门id")
private List<Long> departmentIds;
// 分部id
private List<Long> subCompanyIds;
// 岗位id")
private List<Long> positionIds;
@ -77,6 +80,10 @@ public class SalarySendInfoQueryParam extends BaseQueryParam {
// @JsonIgnore
private List<Integer> sendStatuss;
private String departmentIdStr;
private String subCompanyIdStr;
public static String checkParam(SalarySendInfoQueryParam saveParam) {
if (saveParam.getSalarySendId() == null) {
throw new SalaryRunTimeException("工资单发放Id必传");

View File

@ -42,4 +42,8 @@ public class InsuranceAccountDetailParam extends BaseQueryParam {
private Long creator;
private String workcode;
private List<Long> departmentIds;
private List<Long> subCompanyIds;
}

View File

@ -51,6 +51,9 @@ public interface EmployMapper {
*/
List<DataCollectionEmployee> listByParams(@Param("params") Collection<SalarySobRangeEmpQueryParam> queryParams);
List<DataCollectionEmployee> listByVirtualParams(@Param("params") Collection<SalarySobRangeEmpQueryParam> queryParams);
/**
* 多表详细信息
* @param employeeId
@ -78,6 +81,15 @@ public interface EmployMapper {
*/
List<DeptInfo> getDeptInfoList(@Param("departmentIds") List<Long> departmentIds);
/**
* 虚拟部门其他组织维度
* @param virtualDepartmentIds
* @return
*/
List<DeptInfo> getVirtualDeptInfoList(@Param("virtualDepartmentIds") List<Long> virtualDepartmentIds);
/**
* 所以分部
* @param subDepartmentIds
@ -85,6 +97,13 @@ public interface EmployMapper {
*/
List<SubCompanyInfo> getSubCompanyInfoList(@Param("subDepartmentIds") List<Long> subDepartmentIds);
/**
* 虚拟分部
* @param virtualSubCompanyIds
* @return
*/
List<SubCompanyInfo> getVirtualSubCompanyInfoList(@Param("virtualSubCompanyIds") List<Long> virtualSubCompanyIds);
List<HrmInfoDTO> listHrmInfoByIdAndName(@Param("param") HrmQueryParam param);
List<HrmInfoDTO> listExtHrmInfoByIdAndName(@Param("param") HrmQueryParam param);
@ -111,6 +130,28 @@ public interface EmployMapper {
*/
List<DataCollectionEmployee> listByDismissDate(String dismissDate);
/**
* 根据虚拟部门获取人员信息
* @param virtualDepartmentIds
* @return
*/
List<DataCollectionEmployee> listVirtualEmpByVirtualDepIds(@Param("virtualDepartmentIds") List<Long> virtualDepartmentIds);
/**
* 根据虚拟分部获取人员信息
* @param virtualSubCompanyIds
* @return
*/
List<DataCollectionEmployee> listVirtualEmpByVirtualSubCompanyIds(@Param("virtualSubCompanyIds") List<Long> virtualSubCompanyIds);
/**
* 根据分部部门获取查询
* @param subCompanyIds
* @param departmentIds
* @return
*/
List<DataCollectionEmployee> listBySubCompanyOrDepartment(@Param("subCompanyIds") List<Long> subCompanyIds, @Param("departmentIds") List<Long> departmentIds);
/**
* 根据用户名和工号模糊查询
* @param keyword

View File

@ -151,6 +151,54 @@
</if>
</select>
<select id="listByVirtualParams" resultType="com.engine.salary.entity.datacollection.DataCollectionEmployee">
select h.id as employeeId,
h.lastname as username,
h.status as status,
h.certificatenum as idNo,
h.workcode as workcode,
h.companystartdate as companystartdate,
h.mobile as mobile
from hrmresourcevirtual v
left join hrmresource h on v.resourceid=h.id
WHERE h.status not in (7) and (h.accounttype is null or h.accounttype = 0)
<if test="params != null and params.size() > 0">
AND ( 1=2
<foreach collection="params" item="param">
OR
(
<if test="param.targetType == 'DEPT'">
v.departmentid IN
<foreach collection="param.targetIds" open="(" item="targetId" separator="," close=")">
#{targetId}
</foreach>
</if>
<if test="param.targetType == 'SUBCOMPANY'">
v.subcompanyid IN
<foreach collection="param.targetIds" open="(" item="targetId" separator="," close=")">
#{targetId}
</foreach>
</if>
<if test="param.employeeStatus != null and param.employeeStatus.size() > 0">
AND h.status IN
<foreach collection="param.employeeStatus" open="(" item="status" separator="," close=")">
#{status}
</foreach>
</if>
<!-- &#45;&#45; 在职-->
<!-- <if test="param.employeeStatus != null and param.employeeStatus == 'normal'">-->
<!-- AND em.status in (0,1,2,3)-->
<!-- </if>-->
<!-- &#45;&#45; 离职-->
<!-- <if test="param.employeeStatus != null and param.employeeStatus == 'unavailable'">-->
<!-- AND em.status in (4,5,6)-->
<!-- </if>-->
)
</foreach>
)
</if>
</select>
<select id="getEmployeeById" resultType="com.engine.salary.entity.datacollection.DataCollectionEmployee">
select e.id as employeeId,
@ -278,6 +326,19 @@
</if>
</select>
<select id="getVirtualDeptInfoList" resultType="com.engine.salary.entity.hrm.DeptInfo">
select d.departmentname as name,
d.id as id
from hrmdepartmentvirtual d
where 1=1
<if test="virtualDepartmentIds != null and virtualDepartmentIds.size()>0">
AND d.id IN
<foreach collection="virtualDepartmentIds" open="(" item="virtualDepartmentId" separator="," close=")">
#{virtualDepartmentId}
</foreach>
</if>
</select>
<select id="getSubCompanyInfoList" resultType="com.engine.salary.entity.hrm.SubCompanyInfo">
select d.subcompanyname as name,
d.id as id
@ -291,6 +352,19 @@
</if>
</select>
<select id="getVirtualSubCompanyInfoList" resultType="com.engine.salary.entity.hrm.SubCompanyInfo">
select d.subcompanyname as name,
d.id as id
from hrmsubcompanyvirtual d
where 1=1
<if test="virtualSubCompanyIds != null and virtualSubCompanyIds.size()>0">
AND d.id IN
<foreach collection="virtualSubCompanyIds" open="(" item="virtualSubCompanyId" separator="," close=")">
#{virtualSubCompanyId}
</foreach>
</if>
</select>
<select id="listHrmInfoByIdAndName" resultType="com.engine.salary.entity.hrm.dto.HrmInfoDTO">
select e.id as employeeId,
e.lastname as username
@ -446,6 +520,69 @@
)
</if>
</select>
<select id="listBySubCompanyOrDepartment"
resultType="com.engine.salary.entity.datacollection.DataCollectionEmployee">
select e.id as employeeId,
e.lastname as username,
e.status as status,
e.certificatenum as idNo,
e.workcode as workcode,
d.departmentname as departmentName,
d.id as departmentId,
c.jobtitlename as jobtitleName,
c.id as jobtitleId,
e.companystartdate as companystartdate,
e.mobile as mobile
from hrmresource e
left join hrmdepartment d on e.departmentid = d.id
left join hrmjobtitles c on e.jobtitle = c.id
WHERE e.status not in (7) and (e.accounttype is null or e.accounttype = 0)
<if test="subCompanyIds != null and subCompanyIds.size()>0">
AND e.subcompanyid1 IN
<foreach collection="subCompanyIds" open="(" item="subCompanyId" separator="," close=")">
#{subCompanyId}
</foreach>
</if>
<if test="departmentIds != null and departmentIds.size()>0">
AND d.id IN
<foreach collection="departmentIds" open="(" item="departmentId" separator="," close=")">
#{departmentId}
</foreach>
</if>
</select>
<select id="listVirtualEmpByVirtualDepIds"
resultType="com.engine.salary.entity.datacollection.DataCollectionEmployee">
select e.RESOURCEID as employeeId,
e.SUBCOMPANYID as subcompanyid,
e.DEPARTMENTID as departmentId
from hrmresourcevirtual e
left join hrmresource h on e.RESOURCEID=h.id
where h.status not in (7)
<if test="virtualDepartmentIds != null and virtualDepartmentIds.size()>0">
AND e.DEPARTMENTID IN
<foreach collection="virtualDepartmentIds" open="(" item="virtualDepartmentId" separator="," close=")">
#{virtualDepartmentId}
</foreach>
</if>
</select>
<select id="listVirtualEmpByVirtualSubCompanyIds"
resultType="com.engine.salary.entity.datacollection.DataCollectionEmployee">
select
e.RESOURCEID as employeeId,
e.SUBCOMPANYID as subcompanyid,
e.DEPARTMENTID as departmentId
from hrmresourcevirtual e
left join hrmresource h on e.RESOURCEID=h.id
where h.status not in (7)
<if test="virtualSubCompanyIds != null and virtualSubCompanyIds.size()>0">
AND e.SUBCOMPANYID IN
<foreach collection="virtualSubCompanyIds" open="(" item="virtualSubCompanyId" separator="," close=")">
#{virtualSubCompanyId}
</foreach>
</if>
</select>
<select id="listByKeyword" resultType="com.engine.salary.entity.datacollection.DataCollectionEmployee">
select e.id as employeeId,

View File

@ -93,4 +93,7 @@ public interface ExternalEmployeeMapper {
* @return
*/
List<DataCollectionEmployee> listByKeyword(@Param("keyword") String keyword);
List<DataCollectionEmployee> listSomeDataCollectionEmployee(ExtEmpPO po);
}

View File

@ -168,6 +168,18 @@
#{id}
</foreach>
</if>
<if test="subcompanyIds != null and subcompanyIds.size()>0">
AND subcompany_id IN
<foreach collection="subcompanyIds" open="(" item="subcompanyId" separator="," close=")">
#{subcompanyId}
</foreach>
</if>
<if test="departmentIds != null and departmentIds.size()>0">
AND department_id IN
<foreach collection="departmentIds" open="(" item="departmentId" separator="," close=")">
#{departmentId}
</foreach>
</if>
ORDER BY id DESC
</select>
<select id="listByParams" resultType="com.engine.salary.entity.datacollection.DataCollectionEmployee">
@ -291,6 +303,129 @@
from hrsa_external_employee e
left join hrmdepartment d on e.department_id = d.id
</select>
<select id="listSomeDataCollectionEmployee"
resultType="com.engine.salary.entity.datacollection.DataCollectionEmployee">
SELECT
e.id as employeeId,
e.username as username,
d.departmentname as departmentName,
d.id as departmentId,
sc.SUBCOMPANYNAME as subcompanyName,
c.jobtitlename as jobtitleName,
c.id as jobtitleId,
e.companystartdate as companystartdate,
e.mobile as mobile,
e.status as status,
e.workcode as workcode,
e.sex as sex,
e.email as email,
e.telephone as telephone,
e.jobcall as jobcall,
e.birthday as birthday,
c.id as jobtitleId
from hrsa_external_employee e
left join hrmdepartment d on e.department_id = d.id
left join hrmjobtitles c on e.jobtitle_id = c.id
left join HrmSubCompany sc on e.SUBCOMPANY_ID=sc.id
WHERE e.delete_type = 0
<if test="id != null">
AND e.id = #{id}
</if>
<if test="username != null and username!=''">
AND e.username = #{username}
</if>
<if test="departmentName != null">
AND e.department_name = #{departmentName}
</if>
<if test="departmentId != null">
AND e.department_id = #{departmentId}
</if>
<if test="subcompanyName != null">
AND e.subcompany_name = #{subcompanyName}
</if>
<if test="subcompanyId != null">
AND e.subcompany_id = #{subcompanyId}
</if>
<if test="jobtitleName != null">
AND e.jobtitle_name = #{jobtitleName}
</if>
<if test="jobtitleId != null">
AND e.jobtitle_id = #{jobtitleId}
</if>
<if test="companystartdate != null">
AND e.companystartdate = #{companystartdate}
</if>
<if test="mobile != null">
AND e.mobile = #{mobile}
</if>
<if test="status != null">
AND e.status = #{status}
</if>
<if test="workcode != null">
AND e.workcode = #{workcode}
</if>
<if test="sex != null">
AND e.sex = #{sex}
</if>
<if test="email != null">
AND e.email = #{email}
</if>
<if test="telephone != null">
AND e.telephone = #{telephone}
</if>
<if test="jobcall != null">
AND e.jobcall = #{jobcall}
</if>
<if test="birthday != null">
AND e.birthday = #{birthday}
</if>
<if test="idNo != null">
AND e.id_no = #{idNo}
</if>
<if test="bankCardNum != null">
AND e.bank_card_num = #{bankCardNum}
</if>
<if test="bankName != null">
AND e.bank_name = #{bankName}
</if>
<if test="deleteType != null">
AND e.delete_type = #{deleteType}
</if>
<if test="creator != null">
AND e.creator = #{creator}
</if>
<if test="modifier != null">
AND e.modifier = #{modifier}
</if>
<if test="createTime != null">
AND e.create_time = #{createTime}
</if>
<if test="updateTime != null">
AND e.update_time = #{updateTime}
</if>
<if test="tenantKey != null">
AND e.tenant_key = #{tenantKey}
</if>
<if test="ids != null and ids.size()>0">
AND e.id IN
<foreach collection="ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</if>
<if test="subcompanyIds != null and subcompanyIds.size()>0">
AND e.subcompany_id IN
<foreach collection="subcompanyIds" open="(" item="subcompanyId" separator="," close=")">
#{subcompanyId}
</foreach>
</if>
<if test="departmentIds != null and departmentIds.size()>0">
AND e.department_id IN
<foreach collection="departmentIds" open="(" item="departmentId" separator="," close=")">
#{departmentId}
</foreach>
</if>
ORDER BY e.id DESC
</select>
<select id="listByKeyword" resultType="com.engine.salary.entity.datacollection.DataCollectionEmployee">
select e.id as employeeId,

View File

@ -381,6 +381,13 @@
and t1.send_status in (0, 2)
</if>
</if>
<!-- 分部 -->
<if test="param.subCompanyIds != null and param.subCompanyIds.size()>0">
AND e.subcompanyid1 IN
<foreach collection="param.subCompanyIds" open="(" item="subCompanyId" separator="," close=")">
#{subCompanyId}
</foreach>
</if>
<include refid="paramSql"/>
<!-- 排序 -->
<if test="param.orderRule != null">
@ -411,6 +418,12 @@
<if test="!param.isGranted">
and t1.send_status in (0, 2)
</if>
</if>
<if test="param.subCompanyIds != null and param.subCompanyIds.size()>0">
AND e.subcompanyid1 IN
<foreach collection="param.subCompanyIds" open="(" item="subCompanyId" separator="," close=")">
#{subCompanyId}
</foreach>
</if>
<include refid="paramSql"/>
<!-- 排序 -->
@ -441,7 +454,12 @@
and t1.send_status in (0, 2)
</if>
</if>
<if test="param.subCompanyIds != null and param.subCompanyIds.size()>0">
AND e.subcompanyid1 IN
<foreach collection="param.subCompanyIds" open="(" item="subCompanyId" separator="," close=")">
#{subCompanyId}
</foreach>
</if>
<include refid="paramSql"/>
<!-- 排序 -->
<if test="param.orderRule != null">
@ -513,6 +531,12 @@
</foreach>
))
</if>
<if test="param.subCompanyIds != null and param.subCompanyIds.size()>0">
AND e.subcompanyid1 IN
<foreach collection="param.subCompanyIds" open="(" item="subCompanyId" separator="," close=")">
#{subCompanyId}
</foreach>
</if>
<include refid="paramSql"/>
<!-- 排序 -->
<if test="param.orderRule != null">

View File

@ -203,6 +203,18 @@
#{taxAgent}
</foreach>
</if>
<if test="param.departmentIds != null and param.departmentIds.size()>0">
AND e.departmentid IN
<foreach collection="param.departmentIds" open="(" item="departmentId" separator="," close=")">
#{departmentId}
</foreach>
</if>
<if test="param.subCompanyIds != null and param.subCompanyIds.size()>0">
AND e.subcompanyid1 IN
<foreach collection="param.subCompanyIds" open="(" item="subCompanyId" separator="," close=")">
#{subCompanyId}
</foreach>
</if>
</sql>
<sql id="paramSql" databaseId="oracle">
<if test="param.userName != null and param.userName != ''">
@ -232,6 +244,18 @@
#{taxAgent}
</foreach>
</if>
<if test="param.departmentIds != null and param.departmentIds.size()>0">
AND e.departmentid IN
<foreach collection="param.departmentIds" open="(" item="departmentId" separator="," close=")">
#{departmentId}
</foreach>
</if>
<if test="param.subCompanyIds != null and param.subCompanyIds.size()>0">
AND e.subcompanyid1 IN
<foreach collection="param.subCompanyIds" open="(" item="subCompanyId" separator="," close=")">
#{subCompanyId}
</foreach>
</if>
</sql>
<sql id="paramSql" databaseId="sqlserver">
<if test="param.userName != null and param.userName != ''">
@ -261,6 +285,18 @@
#{taxAgent}
</foreach>
</if>
<if test="param.departmentIds != null and param.departmentIds.size()>0">
AND e.departmentid IN
<foreach collection="param.departmentIds" open="(" item="departmentId" separator="," close=")">
#{departmentId}
</foreach>
</if>
<if test="param.subCompanyIds != null and param.subCompanyIds.size()>0">
AND e.subcompanyid1 IN
<foreach collection="param.subCompanyIds" open="(" item="subCompanyId" separator="," close=")">
#{subCompanyId}
</foreach>
</if>
</sql>
<sql id="extParamSql">
@ -291,6 +327,18 @@
#{taxAgent}
</foreach>
</if>
<if test="param.departmentIds != null and param.departmentIds.size()>0">
AND e.department_id IN
<foreach collection="param.departmentIds" open="(" item="departmentId" separator="," close=")">
#{departmentId}
</foreach>
</if>
<if test="param.subCompanyIds != null and param.subCompanyIds.size()>0">
AND e.subcompany_id IN
<foreach collection="param.subCompanyIds" open="(" item="subCompanyId" separator="," close=")">
#{subCompanyId}
</foreach>
</if>
</sql>
<sql id="extParamSql" databaseId="oracle">
<if test="param.userName != null and param.userName != ''">
@ -320,6 +368,18 @@
#{taxAgent}
</foreach>
</if>
<if test="param.departmentIds != null and param.departmentIds.size()>0">
AND e.department_id IN
<foreach collection="param.departmentIds" open="(" item="departmentId" separator="," close=")">
#{departmentId}
</foreach>
</if>
<if test="param.subCompanyIds != null and param.subCompanyIds.size()>0">
AND e.subcompany_id IN
<foreach collection="param.subCompanyIds" open="(" item="subCompanyId" separator="," close=")">
#{subCompanyId}
</foreach>
</if>
</sql>
<sql id="extParamSql" databaseId="sqlserver">
<if test="param.userName != null and param.userName != ''">
@ -349,6 +409,18 @@
#{taxAgent}
</foreach>
</if>
<if test="param.departmentIds != null and param.departmentIds.size()>0">
AND e.department_id IN
<foreach collection="param.departmentIds" open="(" item="departmentId" separator="," close=")">
#{departmentId}
</foreach>
</if>
<if test="param.subCompanyIds != null and param.subCompanyIds.size()>0">
AND e.subcompany_id IN
<foreach collection="param.subCompanyIds" open="(" item="subCompanyId" separator="," close=")">
#{subCompanyId}
</foreach>
</if>
</sql>

View File

@ -129,7 +129,9 @@ public class SalaryStatisticsReportBO {
}
// param.setGrade(((List<Map>) JSON.parseArray(po.getGradeSetting(), Map.class)).stream().map(m -> Long.valueOf(m.get(key).toString())).collect(Collectors.toList()));
// param.setPosition(((List<Map>) JSON.parseArray(po.getPositionSetting(), Map.class)).stream().map(m -> Long.valueOf(m.get(key).toString())).collect(Collectors.toList()));
// param.setStatus(((List<Map>) JSON.parseArray(po.getStatusSetting(), Map.class)).stream().map(m -> m.get(key).toString()).collect(Collectors.toList()));
if (po.getStatusSetting() != null) {
param.setStatus(((List<Map>) JSON.parseArray(po.getStatusSetting(), Map.class)).stream().map(m -> m.get(key).toString()).collect(Collectors.toList()));
}
if (po.getEmployeeSetting() != null) {
param.setEmployee(((List<Map>) JSON.parseArray(po.getEmployeeSetting(), Map.class)).stream().map(m -> Long.valueOf(m.get(key).toString())).collect(Collectors.toList()));
}

View File

@ -1,7 +1,7 @@
package com.engine.salary.report.entity.param;
import com.engine.salary.common.BaseQueryParam;
import com.engine.salary.enums.salaryaccounting.EmployeeTypeEnum;
import com.engine.salary.report.enums.EmployeeTypeEnum;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
@ -24,7 +24,6 @@ import java.util.List;
@AllArgsConstructor
//"薪酬统计员工明细查询参数")
public class SalaryStatisticsEmployeeQueryParam extends BaseQueryParam {
//关键字")
private String keyword;

View File

@ -0,0 +1,50 @@
package com.engine.salary.report.entity.param;
import com.engine.salary.common.BaseQueryParam;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
import java.util.List;
/**
* @author Harryxzy
* @ClassName f
* @date 2024/03/25 9:56
* @description
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
//"薪酬统计员工明细查询参数")
public class SalaryStatisticsEmployeeSalaryQueryParam extends BaseQueryParam {
// 关键字
private String keyword;
// 起始年月
private String startDateStr;
private Date startDate;
// 结束年月
private String endDateStr;
private Date endDate;
// 个税扣缴义务人id
private List<Long> taxAgentIds;
// 分部id
private List<Long> subCompanyIds;
// 部门id
private List<Long> departmentIds;
// 是否是导出
private boolean isExport;
// 部分导出id
private List<Long> ids;
}

View File

@ -1,9 +1,11 @@
package com.engine.salary.report.service;
import com.engine.salary.entity.salaryacct.po.SalaryAcctEmployeePO;
import com.engine.salary.report.entity.dto.SalaryStatisticsEmployeeDetailResultDTO;
import com.engine.salary.report.entity.dto.SalaryStatisticsEmployeeListDTO;
import com.engine.salary.report.entity.param.SalaryStatisticsEmployeeDetailQueryParam;
import com.engine.salary.report.entity.param.SalaryStatisticsEmployeeQueryParam;
import com.engine.salary.report.entity.param.SalaryStatisticsEmployeeSalaryQueryParam;
import com.engine.salary.util.page.PageInfo;
import java.util.List;
@ -44,6 +46,10 @@ public interface SalaryStatisticsEmployeeService {
*/
List<Map<String, Object>> listDetailPage(SalaryStatisticsEmployeeDetailResultDTO salaryStatisticsEmployeeDetailResult, SalaryStatisticsEmployeeDetailQueryParam queryParam);
PageInfo<SalaryAcctEmployeePO> listSalaryAcctEmp(SalaryStatisticsEmployeeSalaryQueryParam queryParam);
SalaryStatisticsEmployeeDetailResultDTO getDetailSalaryAcctResultByAcctEmp(List<SalaryAcctEmployeePO> salaryAcctEmployeeList);
/**
* 导出员工详情列表
*

View File

@ -1,5 +1,6 @@
package com.engine.salary.report.service.impl;
import cn.hutool.core.util.NumberUtil;
import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
@ -11,6 +12,7 @@ import com.engine.salary.entity.salarysob.po.SalarySobPO;
import com.engine.salary.entity.taxagent.po.TaxAgentPO;
import com.engine.salary.enums.UserStatusEnum;
import com.engine.salary.enums.datacollection.UseEmployeeTypeEnum;
import com.engine.salary.enums.salarysob.SalaryEmployeeStatusEnum;
import com.engine.salary.mapper.salaryacct.SalaryAcctEmployeeMapper;
import com.engine.salary.report.common.constant.SalaryConstant;
import com.engine.salary.report.entity.bo.SalaryStatisticsEmployeeBO;
@ -18,6 +20,7 @@ import com.engine.salary.report.entity.dto.SalaryStatisticsEmployeeDetailResultD
import com.engine.salary.report.entity.dto.SalaryStatisticsEmployeeListDTO;
import com.engine.salary.report.entity.param.SalaryStatisticsEmployeeDetailQueryParam;
import com.engine.salary.report.entity.param.SalaryStatisticsEmployeeQueryParam;
import com.engine.salary.report.entity.param.SalaryStatisticsEmployeeSalaryQueryParam;
import com.engine.salary.report.service.SalaryStatisticsEmployeeService;
import com.engine.salary.service.*;
import com.engine.salary.service.impl.*;
@ -31,6 +34,7 @@ import com.engine.salary.util.page.SalaryPageUtil;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import com.wbi.util.Util;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
@ -257,7 +261,9 @@ public class SalaryStatisticsEmployeeServiceImpl extends Service implements Sala
acctResultValueMap.put(k, map);
});
// 获取人员信息
List<DataCollectionEmployee> employeeList = getSalaryEmployeeService(user).listByIds(salaryStatisticsEmployeeDetailResult.getSalaryAcctEmployeeList().stream().map(SalaryAcctEmployeePO::getEmployeeId).distinct().collect(Collectors.toList()));
Map<Long, DataCollectionEmployee> empMap = SalaryEntityUtil.convert2Map(employeeList, DataCollectionEmployee::getEmployeeId);
List<Map<String, Object>> list = Lists.newArrayList();
Map<String, Object> map;
for (SalaryAcctEmployeePO se : salaryStatisticsEmployeeDetailResult.getSalaryAcctEmployeeList()) {
@ -267,11 +273,19 @@ public class SalaryStatisticsEmployeeServiceImpl extends Service implements Sala
resultValueMap.forEach((k, v) -> {
finalMap.put(k + SalaryConstant.DYNAMIC_SUFFIX, v);
});
DataCollectionEmployee emp = empMap.getOrDefault(se.getEmployeeId(), DataCollectionEmployee.builder().build());
map.put("id", se.getId().toString());
map.put("salaryMonth", SalaryDateUtil.getFormatYearMonth(se.getSalaryMonth()));
map.put("taxAgent", taxAgentMap.get(se.getTaxAgentId()));
map.put("salarySob",SalarySobMap.get(se.getSalarySobId()));
map.put("acctTimes", salaryAcctRecordMap.get(se.getSalaryAcctRecordId()));
map.put("userName", Util.null2String(emp.getUsername()));
map.put("subCompany", Util.null2String(emp.getSubcompanyName()));
map.put("department", Util.null2String(emp.getDepartmentName()));
map.put("jobTitle", Util.null2String(emp.getJobtitleName()));
map.put("status", Util.null2String(NumberUtil.isNumber(emp.getStatus()) ? SalaryEmployeeStatusEnum.parseByValue(Integer.valueOf(emp.getStatus())).getDefaultLabel() : null));
map.put("workCode", Util.null2String(emp.getWorkcode()));
// IncomeCategoryEnum incomeCategoryEnum = IncomeCategoryEnum.parseByValue(Integer.parseInt(se.getIncomeCategory()));
// map.put("incomeCategory", Objects.isNull(incomeCategoryEnum) ? "" : SalaryI18nUtil.getI18nLabel(incomeCategoryEnum.getLabelId(), incomeCategoryEnum.getDefaultLabel()));
list.add(map);
@ -279,7 +293,92 @@ public class SalaryStatisticsEmployeeServiceImpl extends Service implements Sala
return list;
}
// @Override
@Override
public PageInfo<SalaryAcctEmployeePO> listSalaryAcctEmp(SalaryStatisticsEmployeeSalaryQueryParam queryParam) {
List<SalaryStatisticsEmployeeListDTO> list = Collections.emptyList();
PageInfo<SalaryStatisticsEmployeeListDTO> page = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), list, SalaryStatisticsEmployeeListDTO.class);
// 1.分权处理, 首先获取个税扣缴义务人参数
Collection<TaxAgentPO> taxAgentViews = getTaxAgentService(user).listAllTaxAgents((long) user.getUID());
List<Long> taxAgentIds = Objects.isNull(taxAgentViews) ? Lists.newArrayList() : taxAgentViews.stream().map(TaxAgentPO::getId).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(queryParam.getTaxAgentIds())) {
taxAgentIds = taxAgentIds.stream().filter(queryParam.getTaxAgentIds()::contains).collect(Collectors.toList());
}
if (CollectionUtils.isEmpty(taxAgentIds)) {
return new PageInfo<>();
}
// 2.年月参数处理注意薪资所属月居然是用字符串存储的无法通过sql between处理
List<Date> dataParam = new ArrayList<>();
if (StringUtils.isNotBlank(queryParam.getStartDateStr())) {
dataParam.add(SalaryDateUtil.dateStrToLocalTime(queryParam.getStartDateStr()+ "-01 00:00:00"));
}
if (StringUtils.isNotBlank(queryParam.getEndDateStr())) {
dataParam.add(SalaryDateUtil.dateStrToLocalTime(queryParam.getEndDateStr()+ "-01 00:00:00"));
}
Set<Date> salaryMonths = SalaryStatisticsEmployeeBO.getSalaryMonths(null, dataParam)
.stream()
.map(SalaryDateUtil::dateStrToLocalYearMonth)
.collect(Collectors.toSet());
// 查询薪资核算人员
List<SalaryAcctEmployeePO> salaryAcctEmployeeList = getSalaryAcctEmployeeService(user).listByTaxAgentAndSalaryMonth(taxAgentIds, salaryMonths);
if (CollectionUtils.isNotEmpty(queryParam.getSubCompanyIds()) || CollectionUtils.isNotEmpty(queryParam.getDepartmentIds()) || StringUtils.isNotBlank(queryParam.getKeyword())) {
// 根据分部部门筛选
List<DataCollectionEmployee> employeeList = getSalaryEmployeeService(user).listBySubCompanyOrDepartment(queryParam.getSubCompanyIds(), queryParam.getDepartmentIds());
// 根据关键词过滤
if(StringUtils.isNotBlank(queryParam.getKeyword())) {
employeeList = employeeList.stream()
.filter(e -> (e.getUsername().contains(queryParam.getKeyword()) || (StringUtils.isNotEmpty(e.getWorkcode()) && e.getWorkcode().contains(queryParam.getKeyword()))))
.collect(Collectors.toList());
}
List<Long> employeeIds = employeeList.stream().map(DataCollectionEmployee::getEmployeeId).collect(Collectors.toList());
salaryAcctEmployeeList = salaryAcctEmployeeList.stream().filter( acctEmp -> employeeIds.contains(acctEmp.getEmployeeId())).collect(Collectors.toList());
}
if (CollectionUtils.isEmpty(salaryAcctEmployeeList)) {
return new PageInfo<>();
}
// 分页
if (CollectionUtils.isNotEmpty(queryParam.getIds())) {
salaryAcctEmployeeList = salaryAcctEmployeeList.stream().filter(emp -> queryParam.getIds().contains(emp.getId())).collect(Collectors.toList());
}
salaryAcctEmployeeList = salaryAcctEmployeeList.stream().sorted(Comparator.comparing(SalaryAcctEmployeePO::getSalaryMonth)).collect(Collectors.toList());
Collections.reverse(salaryAcctEmployeeList);
PageInfo<SalaryAcctEmployeePO> SalaryAcctEmployeePageInfo = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), salaryAcctEmployeeList);
if (queryParam.isExport()) {
SalaryAcctEmployeePageInfo.setList(salaryAcctEmployeeList);
}
return SalaryAcctEmployeePageInfo;
}
@Override
public SalaryStatisticsEmployeeDetailResultDTO getDetailSalaryAcctResultByAcctEmp(List<SalaryAcctEmployeePO> salaryAcctEmployeeList) {
if (CollectionUtils.isEmpty(salaryAcctEmployeeList)) {
return SalaryStatisticsEmployeeDetailResultDTO.builder()
.salaryAcctEmployeeList(Collections.emptyList())
.salaryAcctResultValueList(Collections.emptyList())
.salaryItemList(Collections.emptyList())
.build();
}
// 获取核算结果数据
List<Long> salaryAcctEmployeeIds = salaryAcctEmployeeList.stream().map(SalaryAcctEmployeePO::getId).collect(Collectors.toList());
List<SalaryAcctResultPO> salaryAcctResultValues = getSalaryAcctResultService(user).listBySalaryAcctEmployeeIds(salaryAcctEmployeeIds);
// 3.获取薪资项目
List<Long> salaryItemIds = salaryAcctResultValues.stream().map(SalaryAcctResultPO::getSalaryItemId).distinct().collect(Collectors.toList());
List<SalaryItemPO> salaryItemList = CollectionUtils.isEmpty(salaryItemIds) ? Lists.newArrayList() : getSalaryItemService(user).listByIds(salaryItemIds);
return SalaryStatisticsEmployeeDetailResultDTO.builder()
.salaryAcctEmployeeList(salaryAcctEmployeeList)
.salaryAcctResultValueList(salaryAcctResultValues)
.salaryItemList(salaryItemList)
.build();
}
// @Override
// public void exportDetailList(Map<String, Object> map, SalaryStatisticsEmployeeDetailQueryParam queryParam) {
// DataCollectionEmployee employee = getSalaryEmployeeService(user).getEmployeeById(queryParam.getEmployeeId());
// // 获取核算数据

View File

@ -4,10 +4,13 @@ import com.engine.common.util.ServiceUtil;
import com.engine.salary.report.entity.dto.SalaryStatisticsEmployeeListDTO;
import com.engine.salary.report.entity.param.SalaryStatisticsEmployeeDetailQueryParam;
import com.engine.salary.report.entity.param.SalaryStatisticsEmployeeQueryParam;
import com.engine.salary.report.entity.param.SalaryStatisticsEmployeeSalaryQueryParam;
import com.engine.salary.report.wrapper.SalaryStatisticsEmployeeWrapper;
import com.engine.salary.util.ResponseResult;
import com.engine.salary.util.page.PageInfo;
import io.swagger.v3.oas.annotations.parameters.RequestBody;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import weaver.hrm.HrmUserVarify;
import weaver.hrm.User;
@ -18,8 +21,14 @@ import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.StreamingOutput;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.time.LocalDate;
import java.util.Map;
/**
* 薪酬统计员工明细
* <p>Copyright: Copyright (c) 2022</p>
@ -28,6 +37,7 @@ import java.util.Map;
* @author qiantao
* @version 1.0
**/
@Slf4j
public class SalaryStatisticsEmployeeController {
private SalaryStatisticsEmployeeWrapper getSalaryStatisticsEmployeeWrapper(User user) {
@ -62,6 +72,69 @@ public class SalaryStatisticsEmployeeController {
return new ResponseResult<SalaryStatisticsEmployeeDetailQueryParam, Map<String, Object>>(user).run(getSalaryStatisticsEmployeeWrapper(user)::detailList, queryParam);
}
/**
* 员工薪资列表
*
* @param queryParam
* @return
*/
@POST
@Path("/salaryList")
@Produces(MediaType.APPLICATION_JSON)
public String salaryList(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalaryStatisticsEmployeeSalaryQueryParam queryParam) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<SalaryStatisticsEmployeeSalaryQueryParam, Map<String, Object>>(user).run(getSalaryStatisticsEmployeeWrapper(user)::salaryList, queryParam);
}
/**
* 员工薪资列表合计行
*
* @param queryParam
* @return
*/
@POST
@Path("/salaryListSum")
@Produces(MediaType.APPLICATION_JSON)
public String salaryListSum(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalaryStatisticsEmployeeSalaryQueryParam queryParam) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<SalaryStatisticsEmployeeSalaryQueryParam, Map<String, Object>>(user).run(getSalaryStatisticsEmployeeWrapper(user)::salaryListSum, queryParam);
}
/**
* 导出员工薪资列表
*
* @param queryParam
* @return
*/
@POST
@Path("/exportSalaryList")
@Produces(MediaType.APPLICATION_OCTET_STREAM)
public Response exportSalaryList(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalaryStatisticsEmployeeSalaryQueryParam queryParam) {
try {
User user = HrmUserVarify.getUser(request, response);
XSSFWorkbook workbook = getSalaryStatisticsEmployeeWrapper(user).exportSalaryList(queryParam);
String fileName = "薪资明细" + LocalDate.now();
try {
fileName = URLEncoder.encode(fileName + ".xlsx", "UTF-8");
} catch (UnsupportedEncodingException e) {
log.error(e.getMessage(), e);
}
StreamingOutput output = outputStream -> {
workbook.write(outputStream);
outputStream.flush();
};
response.setContentType("application/octet-stream");
return Response.ok(output).header("Content-disposition", "attachment;filename=" + fileName).header("Cache-Control", "no-cache").build();
} catch (Exception e) {
log.error("薪资明细导出异常", e);
throw e;
}
}
// /**
// * 导出员工详情列表
// *

View File

@ -199,9 +199,36 @@ public class SalaryStatisticsReportController {
*/
@POST
@Path("/getDataPerspective")
@Produces(MediaType.APPLICATION_OCTET_STREAM)
@Produces(MediaType.APPLICATION_JSON)
public String getDataPerspective(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalaryStatisticsDataPerspectiveQueryParam param) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<SalaryStatisticsDataPerspectiveQueryParam, Map<String, Object>>(user).run(getSalaryStatisticsReportWrapper(user)::getDataPerspective, param);
}
@POST
@Path("/exportDataPerspective")
@Produces(MediaType.APPLICATION_OCTET_STREAM)
public Response exportDataPerspective(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalaryStatisticsDataPerspectiveQueryParam param) {
try {
User user = HrmUserVarify.getUser(request, response);
Map<String, Object> map = getSalaryStatisticsReportWrapper(user).exportDataPerspective(param);
XSSFWorkbook workbook = (XSSFWorkbook) map.get("workbook");
String time = LocalDate.now().toString();
String fileName = map.get("fileName") + "-" + time;
try {
fileName = URLEncoder.encode(fileName + ".xlsx", "UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
StreamingOutput output = outputStream -> {
workbook.write(outputStream);
outputStream.flush();
};
response.setContentType("application/octet-stream");
return Response.ok(output).header("Content-disposition", "attachment;filename=" + fileName).header("Cache-Control", "no-cache").build();
} catch (Exception e) {
log.error("报表明细内容导出异常", e);
throw e;
}
}
}

View File

@ -1,11 +1,13 @@
package com.engine.salary.report.wrapper;
import com.cloudstore.eccom.constant.WeaBoolAttr;
import com.cloudstore.eccom.pc.table.WeaTable;
import com.cloudstore.eccom.pc.table.WeaTableColumn;
import com.cloudstore.eccom.result.WeaResultMsg;
import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.salary.component.SalaryWeaTable;
import com.engine.salary.entity.salaryacct.po.SalaryAcctEmployeePO;
import com.engine.salary.entity.salaryarchive.dto.SalaryArchiveListDTO;
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
import com.engine.salary.report.common.constant.SalaryConstant;
@ -14,16 +16,21 @@ import com.engine.salary.report.entity.dto.SalaryStatisticsEmployeeDetailResultD
import com.engine.salary.report.entity.dto.SalaryStatisticsEmployeeListDTO;
import com.engine.salary.report.entity.param.SalaryStatisticsEmployeeDetailQueryParam;
import com.engine.salary.report.entity.param.SalaryStatisticsEmployeeQueryParam;
import com.engine.salary.report.entity.param.SalaryStatisticsEmployeeSalaryQueryParam;
import com.engine.salary.report.service.SalaryStatisticsEmployeeService;
import com.engine.salary.report.service.impl.SalaryStatisticsEmployeeServiceImpl;
import com.engine.salary.report.util.ReportDataUtil;
import com.engine.salary.util.SalaryI18nUtil;
import com.engine.salary.util.excel.ExcelUtilPlus;
import com.engine.salary.util.page.PageInfo;
import com.engine.salary.util.page.SalaryPageUtil;
import com.google.common.collect.Maps;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import weaver.general.PageIdConst;
import weaver.general.Util;
import weaver.hrm.User;
import java.math.BigDecimal;
@ -31,6 +38,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;
/**
* 薪酬统计员工明细
@ -87,7 +95,7 @@ public class SalaryStatisticsEmployeeWrapper extends Service {
PageInfo<Map<String, Object>> pageInfo = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), records);
// 列表columns
List<WeaTableColumn> weaTableColumns = buildDetailTableColumns(salaryStatisticsEmployeeDetailResult);
List<WeaTableColumn> weaTableColumns = buildDetailTableColumns(salaryStatisticsEmployeeDetailResult, false);
SalaryWeaTable<SalaryArchiveListDTO> table = new SalaryWeaTable<SalaryArchiveListDTO>(user, SalaryStatisticsEmployeeDetailResultDTO.class);
table.setColumns(weaTableColumns);
@ -105,12 +113,20 @@ public class SalaryStatisticsEmployeeWrapper extends Service {
return resultMap;
}
private List<WeaTableColumn> buildDetailTableColumns(SalaryStatisticsEmployeeDetailResultDTO salaryStatisticsEmployeeDetailResult) {
private List<WeaTableColumn> buildDetailTableColumns(SalaryStatisticsEmployeeDetailResultDTO salaryStatisticsEmployeeDetailResult, boolean isSalaryList) {
// 表格表头
List<WeaTableColumn> columns = new ArrayList<>();
columns.add(new WeaTableColumn("100px", SalaryI18nUtil.getI18nLabel(87614, "薪资所属月"), "salaryMonth"));
columns.add(new WeaTableColumn("100px", SalaryI18nUtil.getI18nLabel(86184, "个税扣缴义务人"), "taxAgent"));
columns.add(new WeaTableColumn("100px", SalaryI18nUtil.getI18nLabel(86184, "账套"), "salarySob"));
if (isSalaryList) {
columns.add(new WeaTableColumn("100px", SalaryI18nUtil.getI18nLabel(0, "姓名"), "userName"));
columns.add(new WeaTableColumn("100px", SalaryI18nUtil.getI18nLabel(0, "分部"), "subCompany"));
columns.add(new WeaTableColumn("100px", SalaryI18nUtil.getI18nLabel(0, "部门"), "department"));
columns.add(new WeaTableColumn("100px", SalaryI18nUtil.getI18nLabel(0, "岗位"), "jobTitle"));
columns.add(new WeaTableColumn("100px", SalaryI18nUtil.getI18nLabel(0, "员工状态"), "status"));
columns.add(new WeaTableColumn("100px", SalaryI18nUtil.getI18nLabel(0, "工号"), "workCode"));
}
columns.add(new WeaTableColumn("100px", SalaryI18nUtil.getI18nLabel(86184, "次数"), "acctTimes").setDisplay(WeaBoolAttr.FALSE));
// columns.add(new WeaTableColumn("100px",SalaryI18nUtil.getI18nLabel( 121908, "收入所得项目"), "incomeCategory"));
salaryStatisticsEmployeeDetailResult.getSalaryItemList().forEach(item -> {
@ -119,6 +135,142 @@ public class SalaryStatisticsEmployeeWrapper extends Service {
return columns;
}
/**
* 获取员工发薪明细列表
* @param queryParam
*/
public Map<String, Object> salaryList(SalaryStatisticsEmployeeSalaryQueryParam queryParam) {
Map<String, Object> resultMap = Maps.newHashMap();
if (StringUtils.isBlank(queryParam.getStartDateStr()) || StringUtils.isBlank(queryParam.getEndDateStr())) {
return resultMap;
}
// 获取发薪人员
PageInfo<SalaryAcctEmployeePO> salaryAcctEmployeePageInfo = getSalaryStatisticsEmployeeService(user).listSalaryAcctEmp(queryParam);
// 获取薪资核算结果
SalaryStatisticsEmployeeDetailResultDTO salaryStatisticsEmployeeDetailResult = getSalaryStatisticsEmployeeService(user).getDetailSalaryAcctResultByAcctEmp(salaryAcctEmployeePageInfo.getList());
List<Map<String, Object>> records = getSalaryStatisticsEmployeeService(user).listDetailPage(salaryStatisticsEmployeeDetailResult, null);
Map<String, Object> countResultMap = Maps.newHashMap();
if (CollectionUtils.isNotEmpty(records)) {
List<SalaryItemPO> salaryItems = salaryStatisticsEmployeeDetailResult.getSalaryItemList();
for (SalaryItemPO item : salaryItems) {
BigDecimal sumBigDecimal = new BigDecimal(SalaryStatisticsReportBO.ZERO);
String itemKey = item.getId() + SalaryConstant.DYNAMIC_SUFFIX;
for (Map<String, Object> record : records) {
if (record.containsKey(itemKey)) {
if (Objects.nonNull(record.get(itemKey)) && StringUtils.isNotEmpty(record.get(itemKey).toString()) && NumberUtils.isCreatable(record.get(itemKey).toString())) {
sumBigDecimal = sumBigDecimal.add(new BigDecimal(record.get(itemKey).toString()));
record.put(itemKey, ReportDataUtil.thousandthConvert(record.get(itemKey).toString()));
}
}
}
// 薪资项目合计
if (queryParam.isExport()) {
countResultMap.put(itemKey, ReportDataUtil.thousandthConvert(sumBigDecimal.toString()));
}
}
}
PageInfo<Map<String, Object>> pageInfo = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize());
pageInfo.setList(records);
if (queryParam.isExport()) {
pageInfo.setList(records);
}
pageInfo.setTotal(salaryAcctEmployeePageInfo.getTotal());
// 列表columns
List<WeaTableColumn> weaTableColumns = buildDetailTableColumns(salaryStatisticsEmployeeDetailResult, true);
// 结果
if (queryParam.isExport()) {
resultMap.put("columns", weaTableColumns);
resultMap.put("salaryItems",salaryStatisticsEmployeeDetailResult.getSalaryItemList());
resultMap.put("countResult", countResultMap);
} else {
WeaTable table = new WeaTable();
String pageId = "b72ed4bb-725e-45de-aea1-4eb4c9184af7";
table.setPageID(pageId);
table.setPageUID(pageId + user.getUID());
table.setPagesize(PageIdConst.getPageSize(pageId, user.getUID()));
table.setBackfields("");
table.setColumns(weaTableColumns);
WeaResultMsg result = new WeaResultMsg(false);
result.putAll(table.makeDataResult());
result.success();
resultMap.put("dataKey", result.getResultMap());
}
resultMap.put("pageInfo", pageInfo);
return resultMap;
}
/**
* 获取员工发薪明细列表
* @param queryParam
*/
public Map<String, Object> salaryListSum(SalaryStatisticsEmployeeSalaryQueryParam queryParam) {
Map<String, Object> resultMap = Maps.newHashMap();
if (StringUtils.isBlank(queryParam.getStartDateStr()) || StringUtils.isBlank(queryParam.getEndDateStr())) {
return resultMap;
}
queryParam.setExport(true);
// 获取发薪人员
PageInfo<SalaryAcctEmployeePO> salaryAcctEmployeePageInfo = getSalaryStatisticsEmployeeService(user).listSalaryAcctEmp(queryParam);
// 获取薪资核算结果
SalaryStatisticsEmployeeDetailResultDTO salaryStatisticsEmployeeDetailResult = getSalaryStatisticsEmployeeService(user).getDetailSalaryAcctResultByAcctEmp(salaryAcctEmployeePageInfo.getList());
List<Map<String, Object>> records = getSalaryStatisticsEmployeeService(user).listDetailPage(salaryStatisticsEmployeeDetailResult, null);
Map<String, Object> sumResultMap = Maps.newHashMap();
if (CollectionUtils.isNotEmpty(records)) {
List<SalaryItemPO> salaryItems = salaryStatisticsEmployeeDetailResult.getSalaryItemList();
for (SalaryItemPO item : salaryItems) {
BigDecimal sumBigDecimal = new BigDecimal(SalaryStatisticsReportBO.ZERO);
String itemKey = item.getId() + SalaryConstant.DYNAMIC_SUFFIX;
for (Map<String, Object> record : records) {
if (record.containsKey(itemKey)) {
if (Objects.nonNull(record.get(itemKey)) && StringUtils.isNotEmpty(record.get(itemKey).toString()) && NumberUtils.isCreatable(record.get(itemKey).toString())) {
sumBigDecimal = sumBigDecimal.add(new BigDecimal(record.get(itemKey).toString()));
}
}
}
// 薪资项目合计
sumResultMap.put(itemKey, ReportDataUtil.thousandthConvert(sumBigDecimal.toString()));
}
}
resultMap.put("sumRow", sumResultMap);
return resultMap;
}
public XSSFWorkbook exportSalaryList(SalaryStatisticsEmployeeSalaryQueryParam queryParam) {
queryParam.setCurrent(1);
queryParam.setExport(true);
Map<String, Object> resultMap = salaryList(queryParam);
List<WeaTableColumn> columns = (List<WeaTableColumn>)resultMap.get("columns");
List<SalaryItemPO> salaryItemList = ((List<SalaryItemPO>)resultMap.get("salaryItems"));
List<Map<String, Object>> resultList = ((PageInfo<Map<String, Object>>) resultMap.get("pageInfo")).getList();
Map<String, Object> countResult = (Map<String, Object>)resultMap.get("countResult");
List<List<Object>> rowList = new ArrayList<>();
// 表头
rowList.add(columns.stream().map(WeaTableColumn::getText).collect(Collectors.toList()));
// 数据
for (Map<String, Object> valueMap : resultList) {
List<Object> list = new ArrayList<>();
for (WeaTableColumn column : columns) {
list.add(Util.null2String(valueMap.get(column.getColumn())));
}
rowList.add(list);
}
// 合计
List<Object> sumRow = new ArrayList<>();
sumRow.add("总计");
for (int i=1; i<columns.size(); i++) {
sumRow.add(Util.null2String(countResult.get(columns.get(i).getColumn())));
}
rowList.add(sumRow);
return ExcelUtilPlus.genWorkbookV2(rowList,"薪资明细",true);
}
// public Map<String, Object> exportDetailList(SalaryStatisticsEmployeeDetailQueryParam queryParam) {
// SalaryAssert.notNull(queryParam.getEmployeeId(), SalaryI18nUtil.getI18nLabel( 163974, "人员id不能为空"));
// // 构建异步导出参数

View File

@ -7,13 +7,14 @@ import com.cloudstore.eccom.pc.table.WeaTableColumn;
import com.cloudstore.eccom.result.WeaResultMsg;
import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.hrmelog.entity.dto.LoggerContext;
import com.engine.salary.cache.SalaryCacheKey;
import com.engine.salary.component.WeaFormOption;
import com.engine.salary.component.WeaTableColumnGroup;
import com.engine.salary.config.SalaryElogConfig;
import com.engine.hrmelog.entity.dto.LoggerContext;
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
import com.engine.salary.enums.OperateTypeEnum;
import com.engine.salary.enums.salaryitem.SalaryDataTypeEnum;
import com.engine.salary.exception.SalaryRunTimeException;
import com.engine.salary.report.common.constant.SalaryConstant;
import com.engine.salary.report.entity.bo.SalaryStatisticsReportBO;
@ -40,6 +41,7 @@ import weaver.general.PageIdConst;
import weaver.hrm.User;
import weaver.wechat.util.Utils;
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;
@ -498,6 +500,74 @@ public class SalaryStatisticsReportWrapper extends Service {
return resultMap;
}
/**
* 获取报表透视数据
*
* @param param
* @return
*/
public Map<String, Object> exportDataPerspective(SalaryStatisticsDataPerspectiveQueryParam param) {
if (param.getId() == null || param.getDimensionId() == null) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(84026, "参数错误"));
}
SalaryStatisticsReportPO po = this.getSalaryStatisticsReportService(user).getById(param.getId());
if (po == null) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(161845, "薪酬统计报表不存在"));
}
SalaryStatisticsDimensionPO dimension = getSalaryStatisticsDimensionService(user).getById(param.getDimensionId());
if (dimension == null) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(161300, "统计维度不存在"));
}
// 校验报表权限如果是被分享报表修改User
sharedReportCheck(param.isShare(), po);
// 查询自定义统计项目中所有薪资项目id
List<SalaryStatisticsItemPO> salaryStatisticsItemPOS = getSalaryStatisticsItemService(user).listByStatisticsReportId(param.getId());
List<Long> salaryItemIds = salaryStatisticsItemPOS.stream().filter(item -> StringUtils.isNotBlank(item.getItemValue())).map(p -> p.getItemValue().split(","))
.flatMap(Arrays::stream).map(Long::valueOf).collect(Collectors.toList());
param.setCurrent(1);
param.setPageSize(1000000000);
PageInfo<Map<String, Object>> pageInfo = getSalaryStatisticsReportService(user).buildDataPerspectiveRecords(param, po, dimension, salaryStatisticsItemPOS);
List<List<Object>> resultList = new ArrayList<>();
List<SalaryItemPO> itemList = getSalaryItemService(user).listByIds(salaryItemIds);
// 表格表头
List<WeaTableColumn> weaTableColumns = buildDataPerspectiveTableColumns(itemList);
List<Object> columns = new ArrayList<>();
for (WeaTableColumn column : weaTableColumns) {
columns.add(column.getText());
}
resultList.add(columns);
List<Map<String, Object>> list = pageInfo.getList();
for (Map<String, Object> resultMap : list) {
List<Object> row = new ArrayList<>();
for (WeaTableColumn column : weaTableColumns) {
try {
if (StringUtils.isNotBlank(column.getOtherpara()) && column.getOtherpara().equals(SalaryDataTypeEnum.NUMBER.getValue())) {
// 数值
row.add(new BigDecimal(resultMap.get(column.getColumn()).toString()));
} else {
row.add(Utils.null2String(resultMap.get(column.getColumn())));
}
} catch (Exception e) {
row.add(Utils.null2String(resultMap.get(column.getColumn())));
}
}
resultList.add(row);
}
String sheetName = SalaryI18nUtil.getI18nLabel(179263, "薪酬统计报表明细") + "-" + dimension.getDimName();
XSSFWorkbook book = ExcelUtilPlus.genWorkbookV2(resultList, sheetName);
Map<String, Object> map = new HashMap<>();
map.put("workbook", book);
map.put("fileName", sheetName);
return map;
}
/**
* 权限校验
*
@ -533,7 +603,9 @@ public class SalaryStatisticsReportWrapper extends Service {
columns.add(new WeaTableColumn("100px", SalaryI18nUtil.getI18nLabel(86184, "账套"), "salarySob"));
// columns.add(new WeaTableColumn("100px", SalaryI18nUtil.getI18nLabel(86184, "次数"), "acctTimes").setDisplay(WeaBoolAttr.FALSE));
salaryItems.forEach(item -> {
columns.add(new WeaTableColumn("100px", item.getName(), item.getId() + SalaryConstant.DYNAMIC_SUFFIX));
WeaTableColumn weaTableColumn = new WeaTableColumn("100px", item.getName(), item.getId() + SalaryConstant.DYNAMIC_SUFFIX);
weaTableColumn.setOtherpara(item.getDataType());
columns.add(weaTableColumn);
});
return columns;
}

View File

@ -60,4 +60,6 @@ public interface ExtEmpService {
Map<String, Object> importExtEmp(ExtEmpImportParam param);
List<DataCollectionEmployee> listByKeyword(String keyword);
List<DataCollectionEmployee> listBySubCompanyOrDepartment(List<Long> subCompanyIds, List<Long> departmentIds);
}

View File

@ -94,8 +94,12 @@ public interface SalaryEmployeeService {
List<DeptInfo> getDeptInfoList(List<Long> departmentIds);
List<DeptInfo> getVirtualDeptInfoList(List<Long> virtualDepartmentIds);
List<SubCompanyInfo> getSubCompanyInfoList(List<Long> subDepartmentIds);
List<SubCompanyInfo> getVirtualSubCompanyInfoList(List<Long> virtualSubDepartmentIds);
List<PositionInfo> listPositionInfo(List<Long> positionIds);
List<DataCollectionEmployee> listEmployee();
@ -135,6 +139,26 @@ public interface SalaryEmployeeService {
* @return
*/
EmployeeInfoExpandDTO getExpandFieldSettings(String module);
/**
* 根据虚拟部门获取人员信息
* @param virtualDepartmentIds
*/
List<DataCollectionEmployee> getVirtualEmpByVirtualDepIds(List<Long> virtualDepartmentIds);
/**
* 根据虚拟分部获取人员信息
* @param virtualSubCompanyIds
*/
List<DataCollectionEmployee> getVirtualEmpByVirtualSubCompanyIds(List<Long> virtualSubCompanyIds);
/**
* 根据部门或者分部查询人员
* @param subCompanyIds
* @param departmentIds
* @return
*/
List<DataCollectionEmployee> listBySubCompanyOrDepartment(List<Long> subCompanyIds, List<Long> departmentIds);
/**
* 根据人员id查询身份证
*

View File

@ -642,4 +642,9 @@ public class ExtEmpServiceImpl extends Service implements ExtEmpService {
}
return getExternalEmployeeMapper().listByKeyword(keyword);
}
@Override
public List<DataCollectionEmployee> listBySubCompanyOrDepartment(List<Long> subCompanyIds, List<Long> departmentIds) {
return getExternalEmployeeMapper().listSomeDataCollectionEmployee(ExtEmpPO.builder().subcompanyIds(subCompanyIds).departmentIds(departmentIds).build());
}
}

View File

@ -1704,6 +1704,8 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
}
//存储待更新的InsuranceAccountDetailPO数据
List<InsuranceAccountDetailPO> updateInsuranceAccountDetailList = new ArrayList<>();
//存储待新增的InsuranceAccountDetailPO数据
List<InsuranceAccountDetailPO> insertInsuranceAccountDetailList = new ArrayList<>();
//遍历excel表具体数据
for (int i = 0; i < data.size(); i++) {
@ -1810,10 +1812,52 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
}
if (list.isEmpty()) {
isError = true;
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", row + SalaryI18nUtil.getI18nLabel(100579, "本次福利核算不包含该人员"));
excelComments.add(errorMessageMap);
if (headers.contains("补缴月份")) {
// 如果是补缴列表没有则新增
if (supplementaryMonth.substring(0, 7).equals(billMonth.substring(0, 7))) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(100481, "当前月走正常缴纳"));
}
//校验补缴人员是否存在福利档案基础信息并且runStatus处于正在缴纳或者待减员
InsuranceArchivesBaseInfoPO insuranceBaseInfo = getInsuranceBaseInfoMapper().getOneByEmployeeIdAndPayOrg(paymentOrganization, employeeId);
if (insuranceBaseInfo == null || !(insuranceBaseInfo.getRunStatus().equals(EmployeeStatusEnum.STAY_DEL.getValue()) || insuranceBaseInfo.getRunStatus().equals(EmployeeStatusEnum.PAYING.getValue())) ) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0, "补缴人员中存在未设置福利档案人员或相关人员不在福利在缴人员中,不可新建补缴信息!"));
}
List<Long> empIdsInPayMonthRange = listCanPayEmpIds(paymentOrganization, billMonth.substring(0, 7));
if (!empIdsInPayMonthRange.contains(employeeId)) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(99920, "无核算人员"));
}
// 封装InsuranceAccountDetailPO
Date now = new Date();
InsuranceAccountDetailPO insuranceAccountDetailPO = new InsuranceAccountDetailPO();
insuranceAccountDetailPO.setBillStatus(0);
insuranceAccountDetailPO.setEmployeeId(employeeId);
insuranceAccountDetailPO.setPaymentOrganization(paymentOrganization);
insuranceAccountDetailPO.setPaymentStatus(1);
insuranceAccountDetailPO.setResourceFrom(0);
insuranceAccountDetailPO.setSupplementaryProjects("0,1,2,3,4,5");
insuranceAccountDetailPO.setSocialPayOrg(paymentOrganization);
insuranceAccountDetailPO.setFundPayOrg(paymentOrganization);
insuranceAccountDetailPO.setOtherPayOrg(paymentOrganization);
insuranceAccountDetailPO.setCreator(Long.valueOf(user.getUID()));
insuranceAccountDetailPO.setCreateTime(now);
insuranceAccountDetailPO.setUpdateTime(now);
insuranceAccountDetailPO.setTenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY);
insuranceAccountDetailPO.setDeleteType(0);
InsuranceAccountDetailPO insertPO = handleInsuranceAccountDetail4AddSupplementary(insuranceAccountDetailPO, map);
if(!checkBalancePayInsurance(insertPO)) {
isError = true;
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", row + SalaryI18nUtil.getI18nLabel(0, "导入数据中存在福利档案中未设置的福利项缴纳数值!"));
excelComments.add(errorMessageMap);
} else {
insertInsuranceAccountDetailList.add(insertPO);
}
} else {
isError = true;
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", row + SalaryI18nUtil.getI18nLabel(100579, "本次福利核算不包含该人员"));
excelComments.add(errorMessageMap);
}
} else if (list.size() > 1) {
isError = true;
Map<String, String> errorMessageMap = Maps.newHashMap();
@ -1847,13 +1891,20 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
}
//将待更新列表加密
encryptUtil.encryptList(updateInsuranceAccountDetailList, InsuranceAccountDetailPO.class);
// 将待插入列表加密
encryptUtil.encryptList(insertInsuranceAccountDetailList, InsuranceAccountDetailPO.class);
//更新
for(InsuranceAccountDetailPO po : updateInsuranceAccountDetailList) {
// getSiAccountBiz(user).updateByEmployeeIdAndBillMonth(po);
updateByEmployeeIdAndBillMonth(po);
}
// 插入
if (CollectionUtils.isNotEmpty(insertInsuranceAccountDetailList)) {
getInsuranceAccountDetailMapper().batchSaveAccountDetails(insertInsuranceAccountDetailList);
}
//刷新hrsa_bill_batch中数据统计信息
updateInsuranceAccountDetailList.addAll(insertInsuranceAccountDetailList);
if (updateInsuranceAccountDetailList.size() > 0) {
refreshBillBatch(updateInsuranceAccountDetailList.get(0).getPaymentOrganization(), updateInsuranceAccountDetailList.get(0).getBillMonth());
//记录操作日志
@ -2237,6 +2288,213 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
return insuranceAccountDetailPO;
}
private InsuranceAccountDetailPO handleInsuranceAccountDetail4AddSupplementary(InsuranceAccountDetailPO po, Map<String, Object> baseMap) {
//组装json数据,格式Map<String, Object>
Map<String, String> socialPerMap = new HashMap<>();
Map<String, String> fundPerMap = new HashMap<>();
Map<String, String> otherPerMap = new HashMap<>();
Map<String, String> socialComMap = new HashMap<>();
Map<String, String> fundComMap = new HashMap<>();
Map<String, String> otherComMap = new HashMap<>();
//筛选出福利核算项
Map<String, Object> toDealMap =
baseMap.entrySet().stream()
.filter(map -> !"姓名".equals(map.getKey())
&& !"部门".equals(map.getKey())
&& !"手机号".equals(map.getKey())
&& !"个税扣缴义务人".equals(map.getKey())
&& !"账单月份".equals(map.getKey()))
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
for(Map.Entry<String, Object> entry : toDealMap.entrySet()) {
//判断元素是否属于福利类
String keyName = entry.getKey();
//获取元素名后缀方便之后判断个人单位
String payScope = keyName.substring(keyName.length() - 2);
//获取福利类型
Integer welfareType;
// List<ICategoryPO> categoryPOList = siCategoryBiz.listByName(entry.getKey().substring(0, keyName.length() - 2));
List<ICategoryPO> categoryPOList = getSICategoryService(user).listByName(entry.getKey().substring(0, keyName.length() - 2));
if (categoryPOList.size() == 1) {
ICategoryPO iCategoryPO = categoryPOList.get(0);
welfareType = iCategoryPO.getWelfareType();
if ("个人".equals(payScope)) {
switch (welfareType) {
case 1:
socialPerMap.put(iCategoryPO.getId().toString(), entry.getValue().toString());
break;
case 2:
fundPerMap.put(iCategoryPO.getId().toString(), entry.getValue().toString());
break;
case 3:
otherPerMap.put(iCategoryPO.getId().toString(), entry.getValue().toString());
break;
default:
throw new SalaryRunTimeException("福利类型不存在");
}
} else if ("单位".equals(payScope)) {
switch (welfareType) {
case 1:
socialComMap.put(iCategoryPO.getId().toString(), entry.getValue().toString());
break;
case 2:
fundComMap.put(iCategoryPO.getId().toString(), entry.getValue().toString());
break;
case 3:
otherComMap.put(iCategoryPO.getId().toString(), entry.getValue().toString());
break;
default:
throw new SalaryRunTimeException("福利类型不存在");
}
}
}
}
//组装新的insuranceAccountDetailPO对象数据
if (!socialPerMap.isEmpty()) {
//对比新旧json中数据并输出最终json
checkJsonMap(socialPerMap, null);
po.setSocialPerJson(JSON.toJSONString(socialPerMap));
}
if (!socialComMap.isEmpty()) {
checkJsonMap(socialComMap, null);
po.setSocialComJson(JSON.toJSONString(socialComMap));
}
if (!fundPerMap.isEmpty()) {
checkJsonMap(fundPerMap, null);
po.setFundPerJson(JSON.toJSONString(fundPerMap));
}
if (!fundComMap.isEmpty()) {
checkJsonMap(fundComMap, null);
po.setFundComJson(JSON.toJSONString(fundComMap));
}
if (!otherPerMap.isEmpty()) {
checkJsonMap(otherPerMap, null);
po.setOtherPerJson(JSON.toJSONString(otherPerMap));
}
if (!otherComMap.isEmpty()) {
checkJsonMap(otherComMap, null);
po.setOtherComJson(JSON.toJSONString(otherComMap));
}
if (!StringUtils.isEmpty(baseMap.getOrDefault("社保个人合计", "").toString())) {
po.setSocialPerSum(baseMap.get("社保个人合计").toString());
} else if (!socialPerMap.isEmpty()) {
po.setSocialPerSum(sumOfMapValue(socialPerMap));
} else {
po.setSocialPerSum("0");
}
if (!StringUtils.isEmpty(baseMap.getOrDefault("公积金个人合计", "").toString())) {
po.setFundPerSum(baseMap.get("公积金个人合计").toString());
} else if (!fundPerMap.isEmpty()) {
po.setFundPerSum(sumOfMapValue(fundPerMap));
} else {
po.setFundPerSum("0");
}
if (!StringUtils.isEmpty(baseMap.getOrDefault("其他福利个人合计", "").toString())) {
po.setOtherPerSum(baseMap.get("其他福利个人合计").toString());
} else if (!otherPerMap.isEmpty()) {
po.setOtherPerSum(sumOfMapValue(otherPerMap));
} else {
po.setOtherPerSum("0");
}
if (!StringUtils.isEmpty(baseMap.getOrDefault("个人合计", "").toString())) {
po.setPerSum(baseMap.get("个人合计").toString());
} else {
po.setPerSum(new BigDecimal(po.getSocialPerSum() == null ? "0" : po.getSocialPerSum())
.add(new BigDecimal(po.getFundPerSum() == null ? "0" : po.getFundPerSum()))
.add(new BigDecimal(po.getOtherPerSum() == null ? "0" : po.getOtherPerSum())).toString());
}
if (!StringUtils.isEmpty(baseMap.getOrDefault("社保单位合计", "").toString())) {
po.setSocialComSum(baseMap.get("社保单位合计").toString());
} else if (!socialComMap.isEmpty()) {
po.setSocialComSum(sumOfMapValue(socialComMap));
} else {
po.setSocialComSum("0");
}
if (!StringUtils.isEmpty(baseMap.getOrDefault("公积金单位合计", "").toString())) {
po.setFundComSum(baseMap.get("公积金单位合计").toString());
} else if (!fundComMap.isEmpty()) {
po.setFundComSum(sumOfMapValue(fundComMap));
} else {
po.setFundComSum("0");
}
if (!StringUtils.isEmpty(baseMap.getOrDefault("其他福利单位合计", "").toString())) {
po.setOtherComSum(baseMap.get("其他福利单位合计").toString());
} else if (!otherComMap.isEmpty()) {
po.setOtherComSum(sumOfMapValue(otherComMap));
} else {
po.setOtherComSum("0");
}
if (!StringUtils.isEmpty(baseMap.getOrDefault("单位合计", "").toString())) {
po.setComSum(baseMap.get("单位合计").toString());
} else {
po.setComSum(new BigDecimal(po.getSocialComSum() == null ? "0" : po.getSocialComSum())
.add(new BigDecimal(po.getFundComSum() == null ? "0" : po.getFundComSum()))
.add(new BigDecimal(po.getOtherComSum() == null ? "0" : po.getOtherComSum())).toString());
}
if (!StringUtils.isEmpty(baseMap.getOrDefault("账单月份", "").toString())) {
po.setBillMonth(baseMap.get("账单月份").toString().substring(0, 7));
}
if (!StringUtils.isEmpty(baseMap.getOrDefault("社保合计", "").toString())) {
po.setSocialSum(baseMap.get("社保合计").toString());
} else {
po.setSocialSum(new BigDecimal(po.getSocialComSum() == null ? "0" : po.getSocialComSum())
.add(new BigDecimal(po.getSocialPerSum() == null ? "0" : po.getSocialPerSum()))
.toString());
}
if (!StringUtils.isEmpty(baseMap.getOrDefault("公积金合计", "").toString())) {
po.setFundSum(baseMap.get("公积金合计").toString());
} else {
po.setFundSum(new BigDecimal(po.getFundComSum() == null ? "0" : po.getFundComSum())
.add(new BigDecimal(po.getFundPerSum() == null ? "0" : po.getFundPerSum()))
.toString());
}
if (!StringUtils.isEmpty(baseMap.getOrDefault("其他福利合计", "").toString())) {
po.setOtherSum(baseMap.get("其他福利合计").toString());
} else {
po.setOtherSum(new BigDecimal(po.getOtherComSum() == null ? "0" : po.getOtherComSum())
.add(new BigDecimal(po.getOtherPerSum() == null ? "0" : po.getOtherPerSum()))
.toString());
}
if (!StringUtils.isEmpty(baseMap.getOrDefault("合计", "").toString())) {
po.setTotal(baseMap.get("合计").toString());
} else {
po.setTotal(new BigDecimal(po.getPerSum() == null ? "0" : po.getPerSum())
.add(new BigDecimal(po.getComSum() == null ? "0" : po.getComSum()))
.toString());
}
//如果导入的时补缴数据还会包含补缴月份
if (!StringUtils.isEmpty(baseMap.getOrDefault("补缴月份", "").toString())) {
po.setSupplementaryMonth(baseMap.get("补缴月份").toString().substring(0, 7));
}
po.setUpdateTime(new Date());
return po;
}
/**
* map中value值求和
*/

View File

@ -3,10 +3,12 @@ package com.engine.salary.service.impl;
import com.alibaba.fastjson.JSON;
import com.engine.core.impl.Service;
import com.engine.salary.encrypt.EncryptUtil;
import com.engine.salary.entity.siaccount.param.SaveSupplementaryAccountParam;
import com.engine.salary.entity.siaccount.param.SupplementAccountBaseParam;
import com.engine.salary.entity.siaccount.po.InsuranceAccountDetailPO;
import com.engine.salary.entity.siarchives.po.*;
import com.engine.salary.entity.siarchives.po.InsuranceArchivesEmployeePO;
import com.engine.salary.entity.siarchives.po.InsuranceArchivesFundSchemePO;
import com.engine.salary.entity.siarchives.po.InsuranceArchivesOtherSchemePO;
import com.engine.salary.entity.siarchives.po.InsuranceArchivesSocialSchemePO;
import com.engine.salary.entity.sicategory.po.ICategoryPO;
import com.engine.salary.entity.sischeme.po.InsuranceSchemeDetailPO;
import com.engine.salary.enums.siaccount.ProjectTypeEnum;
@ -24,10 +26,12 @@ import com.engine.salary.service.SIRepairService;
import com.engine.salary.util.SalaryEntityUtil;
import com.engine.salary.util.SalaryI18nUtil;
import com.engine.salary.util.db.MapperProxyFactory;
import com.google.common.collect.Maps;
import org.apache.commons.lang3.StringUtils;
import java.util.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
@ -227,8 +231,8 @@ public class SIRepairServiceImpl extends Service implements SIRepairService {
//查询该福利方案下开启缴纳的福利项
List<String> insuranceIdAndScopeList = payInsuranceIdAndScopeList(socialSchemePO.getSocialSchemeId());
socialMap.forEach((k, v) -> {
String welfareTypeName = welfareTypeMap.get(Long.valueOf(k)) == 1 ? "社保" : (welfareTypeMap.get(Long.valueOf(k)) == 2 ? "公积金" : "企业年金及其它福利" );
String welfareTypeSign = welfareTypeMap.get(Long.valueOf(k)) == 1 ? "social" : (welfareTypeMap.get(Long.valueOf(k)) == 2 ? "fund" : "other" );
String welfareTypeName = welfareTypeMap.get(Long.valueOf(k)) != null && welfareTypeMap.get(Long.valueOf(k)) == 1 ? "社保" : (welfareTypeMap.get(Long.valueOf(k)) != null && welfareTypeMap.get(Long.valueOf(k)) == 2 ? "公积金" : "企业年金及其它福利" );
String welfareTypeSign = welfareTypeMap.get(Long.valueOf(k)) != null && welfareTypeMap.get(Long.valueOf(k)) == 1 ? "social" : (welfareTypeMap.get(Long.valueOf(k)) != null && welfareTypeMap.get(Long.valueOf(k)) == 2 ? "fund" : "other" );
if (insuranceIdAndScopeList.contains(k + "-" + PaymentScopeEnum.SCOPE_COMPANY.getValue())) {
Map<String, String> comMap = new HashMap<>();
comMap.put("title", welfareTypeName);
@ -257,8 +261,8 @@ public class SIRepairServiceImpl extends Service implements SIRepairService {
//查询该福利方案下开启缴纳的福利项
List<String> insuranceIdAndScopeList = payInsuranceIdAndScopeList(fundSchemePO.getFundSchemeId());
fundMap.forEach((k, v) -> {
String welfareTypeName = welfareTypeMap.get(Long.valueOf(k)) == 1 ? "社保" : (welfareTypeMap.get(Long.valueOf(k)) == 2 ? "公积金" : "企业年金及其它福利" );
String welfareTypeSign = welfareTypeMap.get(Long.valueOf(k)) == 1 ? "social" : (welfareTypeMap.get(Long.valueOf(k)) == 2 ? "fund" : "other" );
String welfareTypeName = welfareTypeMap.get(Long.valueOf(k)) != null && welfareTypeMap.get(Long.valueOf(k)) == 1 ? "社保" : (welfareTypeMap.get(Long.valueOf(k)) != null && welfareTypeMap.get(Long.valueOf(k)) == 2 ? "公积金" : "企业年金及其它福利" );
String welfareTypeSign = welfareTypeMap.get(Long.valueOf(k)) != null && welfareTypeMap.get(Long.valueOf(k)) == 1 ? "social" : (welfareTypeMap.get(Long.valueOf(k)) != null && welfareTypeMap.get(Long.valueOf(k)) == 2 ? "fund" : "other" );
if (insuranceIdAndScopeList.contains(k + "-" + PaymentScopeEnum.SCOPE_COMPANY.getValue())) {
Map<String, String> comMap = new HashMap<>();
comMap.put("title", welfareTypeName);
@ -319,8 +323,8 @@ public class SIRepairServiceImpl extends Service implements SIRepairService {
//查询该福利方案下开启缴纳的福利项
List<String> insuranceIdAndScopeList = payInsuranceIdAndScopeList(socialSchemePO.getSocialSchemeId());
socialMap.forEach((k, v) -> {
String welfareTypeName = welfareTypeMap.get(Long.valueOf(k)) == 1 ? "社保" : (welfareTypeMap.get(Long.valueOf(k)) == 2 ? "公积金" : "企业年金及其它福利" );
String welfareTypeSign = welfareTypeMap.get(Long.valueOf(k)) == 1 ? "social" : (welfareTypeMap.get(Long.valueOf(k)) == 2 ? "fund" : "other" );
String welfareTypeName = welfareTypeMap.get(Long.valueOf(k)) != null && welfareTypeMap.get(Long.valueOf(k)) == 1 ? "社保" : (welfareTypeMap.get(Long.valueOf(k)) != null && welfareTypeMap.get(Long.valueOf(k)) == 2 ? "公积金" : "企业年金及其它福利" );
String welfareTypeSign = welfareTypeMap.get(Long.valueOf(k)) != null && welfareTypeMap.get(Long.valueOf(k)) == 1 ? "social" : (welfareTypeMap.get(Long.valueOf(k)) != null && welfareTypeMap.get(Long.valueOf(k)) == 2 ? "fund" : "other" );
if (insuranceIdAndScopeList.contains(k + "-" + PaymentScopeEnum.SCOPE_COMPANY.getValue())) {
Map<String, String> comMap = new HashMap<>();
comMap.put("title", welfareTypeName);
@ -355,8 +359,8 @@ public class SIRepairServiceImpl extends Service implements SIRepairService {
//查询该福利方案下开启缴纳的福利项
List<String> insuranceIdAndScopeList = payInsuranceIdAndScopeList(socialSchemePO.getSocialSchemeId());
socialMap.forEach((k, v) -> {
String welfareTypeName = welfareTypeMap.get(Long.valueOf(k)) == 1 ? "社保" : (welfareTypeMap.get(Long.valueOf(k)) == 2 ? "公积金" : "企业年金及其它福利" );
String welfareTypeSign = welfareTypeMap.get(Long.valueOf(k)) == 1 ? "social" : (welfareTypeMap.get(Long.valueOf(k)) == 2 ? "fund" : "other" );
String welfareTypeName = welfareTypeMap.get(Long.valueOf(k)) != null && welfareTypeMap.get(Long.valueOf(k)) == 1 ? "社保" : (welfareTypeMap.get(Long.valueOf(k)) != null && welfareTypeMap.get(Long.valueOf(k)) == 2 ? "公积金" : "企业年金及其它福利" );
String welfareTypeSign = welfareTypeMap.get(Long.valueOf(k)) != null && welfareTypeMap.get(Long.valueOf(k)) == 1 ? "social" : (welfareTypeMap.get(Long.valueOf(k)) != null && welfareTypeMap.get(Long.valueOf(k)) == 2 ? "fund" : "other" );
if (insuranceIdAndScopeList.contains(k + "-" + PaymentScopeEnum.SCOPE_COMPANY.getValue())) {
Map<String, String> comMap = new HashMap<>();
comMap.put("title", welfareTypeName);
@ -391,8 +395,8 @@ public class SIRepairServiceImpl extends Service implements SIRepairService {
//查询该福利方案下开启缴纳的福利项
List<String> insuranceIdAndScopeList = payInsuranceIdAndScopeList(socialSchemePO.getSocialSchemeId());
socialMap.forEach((k, v) -> {
String welfareTypeName = welfareTypeMap.get(Long.valueOf(k)) == 1 ? "社保" : (welfareTypeMap.get(Long.valueOf(k)) == 2 ? "公积金" : "企业年金及其它福利" );
String welfareTypeSign = welfareTypeMap.get(Long.valueOf(k)) == 1 ? "social" : (welfareTypeMap.get(Long.valueOf(k)) == 2 ? "fund" : "other" );
String welfareTypeName = welfareTypeMap.get(Long.valueOf(k)) != null && welfareTypeMap.get(Long.valueOf(k)) == 1 ? "社保" : (welfareTypeMap.get(Long.valueOf(k)) != null && welfareTypeMap.get(Long.valueOf(k)) == 2 ? "公积金" : "企业年金及其它福利" );
String welfareTypeSign = welfareTypeMap.get(Long.valueOf(k)) != null && welfareTypeMap.get(Long.valueOf(k)) == 1 ? "social" : (welfareTypeMap.get(Long.valueOf(k)) != null && welfareTypeMap.get(Long.valueOf(k)) == 2 ? "fund" : "other" );
if (insuranceIdAndScopeList.contains(k + "-" + PaymentScopeEnum.SCOPE_COMPANY.getValue())) {
Map<String, String> comMap = new HashMap<>();
comMap.put("title", welfareTypeName);
@ -427,8 +431,8 @@ public class SIRepairServiceImpl extends Service implements SIRepairService {
//查询该福利方案下开启缴纳的福利项
List<String> insuranceIdAndScopeList = payInsuranceIdAndScopeList(socialSchemePO.getSocialSchemeId());
socialMap.forEach((k, v) -> {
String welfareTypeName = welfareTypeMap.get(Long.valueOf(k)) == 1 ? "社保" : (welfareTypeMap.get(Long.valueOf(k)) == 2 ? "公积金" : "企业年金及其它福利" );
String welfareTypeSign = welfareTypeMap.get(Long.valueOf(k)) == 1 ? "social" : (welfareTypeMap.get(Long.valueOf(k)) == 2 ? "fund" : "other" );
String welfareTypeName = welfareTypeMap.get(Long.valueOf(k)) != null && welfareTypeMap.get(Long.valueOf(k)) == 1 ? "社保" : (welfareTypeMap.get(Long.valueOf(k)) != null && welfareTypeMap.get(Long.valueOf(k)) == 2 ? "公积金" : "企业年金及其它福利" );
String welfareTypeSign = welfareTypeMap.get(Long.valueOf(k)) != null && welfareTypeMap.get(Long.valueOf(k)) == 1 ? "social" : (welfareTypeMap.get(Long.valueOf(k)) != null && welfareTypeMap.get(Long.valueOf(k)) == 2 ? "fund" : "other" );
if (insuranceIdAndScopeList.contains(k + "-" + PaymentScopeEnum.SCOPE_COMPANY.getValue())) {
Map<String, String> comMap = new HashMap<>();
comMap.put("title", welfareTypeName);
@ -459,8 +463,8 @@ public class SIRepairServiceImpl extends Service implements SIRepairService {
//查询该福利方案下开启缴纳的福利项
List<String> insuranceIdAndScopeList = payInsuranceIdAndScopeList(fundSchemePO.getFundSchemeId());
fundMap.forEach((k, v) -> {
String welfareTypeName = welfareTypeMap.get(Long.valueOf(k)) == 1 ? "社保" : (welfareTypeMap.get(Long.valueOf(k)) == 2 ? "公积金" : "企业年金及其它福利" );
String welfareTypeSign = welfareTypeMap.get(Long.valueOf(k)) == 1 ? "social" : (welfareTypeMap.get(Long.valueOf(k)) == 2 ? "fund" : "other" );
String welfareTypeName = welfareTypeMap.get(Long.valueOf(k)) != null && welfareTypeMap.get(Long.valueOf(k)) == 1 ? "社保" : (welfareTypeMap.get(Long.valueOf(k)) != null && welfareTypeMap.get(Long.valueOf(k)) == 2 ? "公积金" : "企业年金及其它福利" );
String welfareTypeSign = welfareTypeMap.get(Long.valueOf(k)) != null && welfareTypeMap.get(Long.valueOf(k)) == 1 ? "social" : (welfareTypeMap.get(Long.valueOf(k)) != null && welfareTypeMap.get(Long.valueOf(k)) == 2 ? "fund" : "other" );
if (insuranceIdAndScopeList.contains(k + "-" + PaymentScopeEnum.SCOPE_COMPANY.getValue())) {
Map<String, String> comMap = new HashMap<>();
comMap.put("title", welfareTypeName);
@ -491,8 +495,8 @@ public class SIRepairServiceImpl extends Service implements SIRepairService {
//查询该福利方案下开启缴纳的福利项
List<String> insuranceIdAndScopeList = payInsuranceIdAndScopeList(otherSchemePO.getOtherSchemeId());
otherMap.forEach((k, v) -> {
String welfareTypeName = welfareTypeMap.get(Long.valueOf(k)) == 1 ? "社保" : (welfareTypeMap.get(Long.valueOf(k)) == 2 ? "公积金" : "企业年金及其它福利" );
String welfareTypeSign = welfareTypeMap.get(Long.valueOf(k)) == 1 ? "social" : (welfareTypeMap.get(Long.valueOf(k)) == 2 ? "fund" : "other" );
String welfareTypeName = welfareTypeMap.get(Long.valueOf(k)) != null && welfareTypeMap.get(Long.valueOf(k)) == 1 ? "社保" : (welfareTypeMap.get(Long.valueOf(k)) != null && welfareTypeMap.get(Long.valueOf(k)) == 2 ? "公积金" : "企业年金及其它福利" );
String welfareTypeSign = welfareTypeMap.get(Long.valueOf(k)) != null && welfareTypeMap.get(Long.valueOf(k)) == 1 ? "social" : (welfareTypeMap.get(Long.valueOf(k)) != null && welfareTypeMap.get(Long.valueOf(k)) == 2 ? "fund" : "other" );
if (insuranceIdAndScopeList.contains(k + "-" + PaymentScopeEnum.SCOPE_COMPANY.getValue())) {
Map<String, String> comMap = new HashMap<>();
comMap.put("title", welfareTypeName);

View File

@ -702,19 +702,19 @@ public class SalaryAcctEmployeeServiceImpl extends Service implements SalaryAcct
// }
// list = list.stream().filter(po -> employeeIdsByPostionFilter.contains(po.getEmployeeId())).collect(Collectors.toList());
// }
// // 人事状态过滤
// if (CollectionUtils.isNotEmpty(param.getStatus())) {
// Set<Long> employeeIdsByStatus = new HashSet<>();
// simpleEmployeeList.forEach(simpleEmployee -> {
// if (simpleEmployee.getStatus() != null && param.getStatus().contains(simpleEmployee.getPersonnelStatus())) {
// employeeIdsByStatus.add(simpleEmployee.getEmployeeId());
// }
// });
// if (CollectionUtils.isEmpty(employeeIdsByStatus)) {
// return Lists.newArrayList();
// }
// list = list.stream().filter(po -> employeeIdsByStatus.contains(po.getEmployeeId())).collect(Collectors.toList());
// }
// 人事状态过滤
if (CollectionUtils.isNotEmpty(param.getStatus())) {
Set<Long> employeeIdsByStatus = new HashSet<>();
employeeList.forEach(simpleEmployee -> {
if (simpleEmployee.getStatus() != null && param.getStatus().contains(simpleEmployee.getStatus())) {
employeeIdsByStatus.add(simpleEmployee.getEmployeeId());
}
});
if (CollectionUtils.isEmpty(employeeIdsByStatus)) {
return Lists.newArrayList();
}
list = list.stream().filter(po -> employeeIdsByStatus.contains(po.getEmployeeId())).collect(Collectors.toList());
}
// 入职日期
if (CollectionUtils.isNotEmpty(param.getHiredate())) {
Set<Long> employeeIdsByHiredate = new HashSet<>();

View File

@ -20,6 +20,8 @@ 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.enums.salarysob.TargetTypeEnum;
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;
@ -54,6 +56,10 @@ public class SalaryEmployeeServiceImpl extends Service implements SalaryEmployee
private EmployBiz employBiz = new EmployBiz();
private EmployMapper getEmployMapper() {
return SqlProxyHandle.getProxy(EmployMapper.class);
}
private SalarySobRangeService getSalarySobRangeService(User user) {
return ServiceUtil.getService(SalarySobRangeServiceImpl.class, user);
}
@ -265,14 +271,32 @@ public class SalaryEmployeeServiceImpl extends Service implements SalaryEmployee
@Override
public List<DeptInfo> getDeptInfoList(List<Long> departmentIds) {
return employBiz.getDeptInfoList(departmentIds);
return SalaryI18nUtil.i18nList(employBiz.getDeptInfoList(departmentIds));
}
@Override
public List<DeptInfo> getVirtualDeptInfoList(List<Long> virtualDepartmentIds) {
if (CollectionUtils.isEmpty(virtualDepartmentIds)) {
return Collections.emptyList();
}
return SalaryI18nUtil.i18nList(getEmployMapper().getVirtualDeptInfoList(virtualDepartmentIds));
}
@Override
public List<SubCompanyInfo> getSubCompanyInfoList(List<Long> subDepartmentIds) {
return SalaryI18nUtil.i18nList(employBiz.getSubCompanyInfoList(subDepartmentIds));
}
@Override
public List<SubCompanyInfo> getVirtualSubCompanyInfoList(List<Long> virtualSubDepartmentIds) {
if (CollectionUtils.isEmpty(virtualSubDepartmentIds)) {
return Collections.emptyList();
}
return SalaryI18nUtil.i18nList(getEmployMapper().getVirtualSubCompanyInfoList(virtualSubDepartmentIds));
}
@Override
public List<PositionInfo> listPositionInfo(List<Long> positionIds) {
return SalaryI18nUtil.i18nList(employBiz.listPositionInfo(positionIds));
@ -289,10 +313,24 @@ public class SalaryEmployeeServiceImpl extends Service implements SalaryEmployee
@Override
public List<DataCollectionEmployee> listByParams(List<SalarySobRangeEmpQueryParam> includeQueryParams) {
if (CollectionUtils.isEmpty(includeQueryParams)) {
return Collections.emptyList();
}
List<DataCollectionEmployee> result = employBiz.listByParams(includeQueryParams);
if (openExtEmp) {
result.addAll(getExtEmpService(user).listByParams(includeQueryParams));
}
// 查询虚拟部门分部人员信息
List<SalarySobRangeEmpQueryParam> virtualParams = includeQueryParams.stream().filter(param ->
(param.getTargetType().equals(TargetTypeEnum.SUBCOMPANY.name()) || param.getTargetType().equals(TargetTypeEnum.DEPT.name())) && ((List<Long>) param.getTargetIds()).get(0).compareTo(0L) < 0
).collect(Collectors.toList());
result.addAll(employBiz.listByVirtualParams(virtualParams));
// 从hrmresource和hrmresourcevirtual可能获取到重复人员数据需要根据人员id去重
result = result.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparingLong(DataCollectionEmployee::getEmployeeId))), ArrayList::new));
return SalaryI18nUtil.i18nList(result);
}
@ -435,6 +473,32 @@ public class SalaryEmployeeServiceImpl extends Service implements SalaryEmployee
return null;
}
@Override
public List<DataCollectionEmployee> getVirtualEmpByVirtualDepIds(List<Long> virtualDepartmentIds) {
if (CollectionUtils.isEmpty(virtualDepartmentIds)) {
return Collections.emptyList();
}
return getEmployMapper().listVirtualEmpByVirtualDepIds(virtualDepartmentIds);
}
@Override
public List<DataCollectionEmployee> getVirtualEmpByVirtualSubCompanyIds(List<Long> virtualSubCompanyIds) {
if (CollectionUtils.isEmpty(virtualSubCompanyIds)) {
return Collections.emptyList();
}
return getEmployMapper().listVirtualEmpByVirtualSubCompanyIds(virtualSubCompanyIds);
}
@Override
public List<DataCollectionEmployee> listBySubCompanyOrDepartment(List<Long> subCompanyIds, List<Long> departmentIds) {
List<DataCollectionEmployee> employeeList = new ArrayList<>();
employeeList.addAll(getEmployMapper().listBySubCompanyOrDepartment(subCompanyIds, departmentIds));
if (openExtEmp) {
employeeList.addAll(getExtEmpService(user).listBySubCompanyOrDepartment(subCompanyIds, departmentIds));
}
return SalaryI18nUtil.i18nList(employeeList);
}
@Override
public Map<Long, String> mapByEmployeeIds(Collection<Long> employeeIds) {
List<DataCollectionEmployee> simpleUserInfos = getEmployeeByIdsAll(new ArrayList<>(employeeIds));

View File

@ -176,8 +176,21 @@ public class TaxAgentManageRangeServiceImpl extends Service implements TaxAgentM
if (CollectionUtils.isEmpty(taxAgentManageRanges) || CollectionUtils.isEmpty(salaryEmployees)) {
return Collections.emptyList();
}
// 获取虚拟部门下人员信息
List<Long> virtualDepartmentIds = taxAgentManageRanges.stream().filter(manageRange -> manageRange.getTargetType().equals(TargetTypeEnum.DEPT.getValue()) && manageRange.getTargetId().compareTo(0L) < 0)
.map(TaxAgentManageRangePO::getTargetId).collect(Collectors.toList());
List<DataCollectionEmployee> virtualEmpListByDep = getSalaryEmployeeService(user).getVirtualEmpByVirtualDepIds(virtualDepartmentIds);
Map<Long, Set<Long>> virtualDepMap = SalaryEntityUtil.group2Map(virtualEmpListByDep, DataCollectionEmployee::getDepartmentId, DataCollectionEmployee::getEmployeeId);
// 获取虚拟分部下人员信息
List<Long> virtualSubCompanyIds = taxAgentManageRanges.stream().filter(manageRange -> manageRange.getTargetType().equals(TargetTypeEnum.SUBCOMPANY.getValue()) && manageRange.getTargetId().compareTo(0L) < 0)
.map(TaxAgentManageRangePO::getTargetId).collect(Collectors.toList());
List<DataCollectionEmployee> virtualEmpListBySubCom = getSalaryEmployeeService(user).getVirtualEmpByVirtualSubCompanyIds(virtualSubCompanyIds);
Map<Long, Set<Long>> virtualSubCompanyMap = SalaryEntityUtil.group2Map(virtualEmpListBySubCom, DataCollectionEmployee::getSubcompanyid, DataCollectionEmployee::getEmployeeId);
List<DataCollectionEmployee> salaryEmployeeList = Lists.newArrayList();
for (TaxAgentManageRangePO manageRange : taxAgentManageRanges) {
boolean isVirtual = manageRange.getTargetId().compareTo(0L) < 0 ? true : false;
salaryEmployeeList.addAll(salaryEmployees.stream().filter(salaryEmployee -> {
if (StringUtils.isEmpty(manageRange.getEmployeeStatus()) || !manageRange.getEmployeeStatus().contains("\"" + salaryEmployee.getStatus() + "\"")) {
return false;
@ -188,11 +201,26 @@ public class TaxAgentManageRangeServiceImpl extends Service implements TaxAgentM
if (Objects.equals(manageRange.getTargetType(), TargetTypeEnum.EMPLOYEE.getValue()) && Objects.equals(manageRange.getTargetId(), salaryEmployee.getEmployeeId())) {
return true;
}
if (Objects.equals(manageRange.getTargetType(), TargetTypeEnum.DEPT.getValue()) && Objects.equals(manageRange.getTargetId(), salaryEmployee.getDepartmentId())) {
return true;
}
if (Objects.equals(manageRange.getTargetType(), TargetTypeEnum.SUBCOMPANY.getValue()) && Objects.equals(manageRange.getTargetId(), salaryEmployee.getSubcompanyid())) {
return true;
if (isVirtual) {
if (Objects.equals(manageRange.getTargetType(), TargetTypeEnum.DEPT.getValue())) {
Set<Long> empIds = virtualDepMap.get(manageRange.getTargetId());
if (CollectionUtils.isNotEmpty(empIds) && empIds.contains(salaryEmployee.getEmployeeId())) {
return true;
}
}
if (Objects.equals(manageRange.getTargetType(), TargetTypeEnum.SUBCOMPANY.getValue())) {
Set<Long> empIds = virtualSubCompanyMap.get(manageRange.getTargetId());
if (CollectionUtils.isNotEmpty(empIds) && empIds.contains(salaryEmployee.getEmployeeId())) {
return true;
}
}
} else {
if (Objects.equals(manageRange.getTargetType(), TargetTypeEnum.DEPT.getValue()) && Objects.equals(manageRange.getTargetId(), salaryEmployee.getDepartmentId())) {
return true;
}
if (Objects.equals(manageRange.getTargetType(), TargetTypeEnum.SUBCOMPANY.getValue()) && Objects.equals(manageRange.getTargetId(), salaryEmployee.getSubcompanyid())) {
return true;
}
}
if (Objects.equals(manageRange.getTargetType(), TargetTypeEnum.POSITION.getValue()) && Objects.equals(manageRange.getTargetId(), salaryEmployee.getJobtitleId())) {
return true;
@ -250,10 +278,17 @@ public class TaxAgentManageRangeServiceImpl extends Service implements TaxAgentM
// 查询部门信息
List<Long> departmentIds = taxAgentManageRanges.stream().filter(e -> Objects.equals(e.getTargetType(), TargetTypeEnum.DEPT.getValue())).map(TaxAgentManageRangePO::getTargetId).collect(Collectors.toList());
List<DeptInfo> departmentComInfos = getSalaryEmployeeService().getDeptInfoList(departmentIds);
// 虚拟部门
List<Long> virtualDepIds = departmentIds.stream().filter(id -> id.compareTo(0L) < 0).collect(Collectors.toList());
departmentComInfos.addAll(getSalaryEmployeeService().getVirtualDeptInfoList(virtualDepIds));
// 查询分部信息
List<Long> subDepartmentIds = taxAgentManageRanges.stream().filter(e -> Objects.equals(e.getTargetType(), TargetTypeEnum.SUBCOMPANY.getValue())).map(TaxAgentManageRangePO::getTargetId).collect(Collectors.toList());
List<SubCompanyInfo> subDepartmentComInfos = getSalaryEmployeeService().getSubCompanyInfoList(subDepartmentIds);
// 虚拟分部
List<Long> virtualSubCompanyIds = subDepartmentIds.stream().filter(id -> id.compareTo(0L) < 0).collect(Collectors.toList());
subDepartmentComInfos.addAll(getSalaryEmployeeService().getVirtualSubCompanyInfoList(virtualSubCompanyIds));
// 查询岗位信息
List<Long> positionIds = taxAgentManageRanges.stream().filter(e -> Objects.equals(e.getTargetType(), TargetTypeEnum.POSITION.getValue())).map(TaxAgentManageRangePO::getTargetId).collect(Collectors.toList());
List<PositionInfo> positionComInfos = getSalaryEmployeeService().listPositionInfo(positionIds);

View File

@ -347,6 +347,12 @@ public class SalaryBillController {
@Produces(MediaType.APPLICATION_JSON)
public String infoList(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalarySendInfoQueryParam queryParam) {
User user = HrmUserVarify.getUser(request, response);
if (StringUtils.isNotBlank(queryParam.getDepartmentIdStr())) {
queryParam.setDepartmentIds(Arrays.stream(StringUtils.split(queryParam.getDepartmentIdStr(), ",")).map(Long::valueOf).collect(Collectors.toList()));
}
if (StringUtils.isNotBlank(queryParam.getSubCompanyIdStr())) {
queryParam.setSubCompanyIds(Arrays.stream(StringUtils.split(queryParam.getSubCompanyIdStr(), ",")).map(Long::valueOf).collect(Collectors.toList()));
}
return new ResponseResult<SalarySendInfoQueryParam, PageInfo<SalarySendInfoListDTO>>(user).run(getSalarySendWrapper(user)::infoList, queryParam);
}
@ -487,7 +493,7 @@ public class SalaryBillController {
// 处理入参复用方法
SalarySendDetailQueryParam detailQueryParam = SalarySendDetailQueryParam.builder()
.userId(queryParam.getUserId())
.departmentIds(SalaryEntityUtil.isNullOrEmpty(queryParam.getDepartment()) ? null : Collections.singletonList(queryParam.getDepartment()))
.departmentIds(CollectionUtils.isEmpty(queryParam.getDepartmentIds()) ? null : queryParam.getDepartmentIds())
.salarySendId(queryParam.getSalarySendId())
.mergeCountTax(queryParam.getMergeCountTax())
.positionIds(SalaryEntityUtil.isNullOrEmpty(queryParam.getPosition()) ? null : Collections.singletonList(queryParam.getPosition()))
@ -497,6 +503,12 @@ public class SalaryBillController {
detailQueryParam.setCurrent(queryParam.getCurrent());
detailQueryParam.setPageSize(queryParam.getPageSize());
if (StringUtils.isNotBlank(queryParam.getSubCompanyIdStr())) {
detailQueryParam.setSubCompanyIds(Arrays.asList(StringUtils.split(queryParam.getSubCompanyIdStr(), ",")).stream().map(Long::new).collect(Collectors.toList()));
}
if (StringUtils.isNotBlank(queryParam.getDepartmentIdStr())) {
detailQueryParam.setDepartmentIds(Arrays.asList(StringUtils.split(queryParam.getDepartmentIdStr(), ",")).stream().map(Long::new).collect(Collectors.toList()));
}
return new ResponseResult<SalarySendDetailQueryParam, Map<String, Object>>(user).run(getSalarySendWrapper(user)::detailList, detailQueryParam);
}

View File

@ -87,7 +87,6 @@ public class SalaryArchiveItemWrapper extends Service implements SalaryArchiveIt
data.put("adjustReason", adjustReason);
data.put("description", description);
data.put("adjustReasonList", SalaryArchiveItemAdjustReasonEnum.getList());
return data;
}
@ -115,6 +114,7 @@ public class SalaryArchiveItemWrapper extends Service implements SalaryArchiveIt
salaryItemMap.put("id", String.valueOf(m.getId()));
salaryItemMap.put("content", m.getName());
salaryItemMap.put("dataType", m.getDataType());
salaryItemMap.put("pattern", m.getPattern());
return salaryItemMap;
}).collect(Collectors.toList());

View File

@ -256,8 +256,20 @@ public class SalarySendWrapper extends Service implements SalarySendWrapperProxy
taxAgent.setLabel("个税扣缴义务人"); //设置文本值 这个将覆盖多语言标签的值
conditionItems.add(taxAgent);
// 分部
SearchConditionItem subCompany = conditionFactory.createCondition(ConditionType.BROWSER, 502227, "subCompanyIdStr", "194");
subCompany.setColSpan(2);
subCompany.setFieldcol(16);
subCompany.setLabelcol(8);
subCompany.setViewAttr(2);
subCompany.setIsQuickSearch(false);
subCompany.setLabel("分部");
subCompany.setInputType("");
subCompany.getBrowserConditionParam().setIsSingle(false);
conditionItems.add(subCompany);
// 部门
SearchConditionItem departmentName = conditionFactory.createCondition(ConditionType.BROWSER, 502227, "departmentIds", "4");
SearchConditionItem departmentName = conditionFactory.createCondition(ConditionType.BROWSER, 502227, "departmentIdStr", "4");
departmentName.setColSpan(2);
departmentName.setFieldcol(16);
departmentName.setLabelcol(8);
@ -265,6 +277,7 @@ public class SalarySendWrapper extends Service implements SalarySendWrapperProxy
departmentName.setIsQuickSearch(false);
departmentName.setLabel("部门");
departmentName.setInputType("");
departmentName.getBrowserConditionParam().setIsSingle(false);
conditionItems.add(departmentName);
// 岗位
@ -417,8 +430,21 @@ public class SalarySendWrapper extends Service implements SalarySendWrapperProxy
taxAgent.setLabel("个税扣缴义务人"); //设置文本值 这个将覆盖多语言标签的值
conditionItems.add(taxAgent);
// 分部
SearchConditionItem subCompany = conditionFactory.createCondition(ConditionType.BROWSER, 502227, "subCompanyIdStr", "194");
subCompany.setColSpan(2);
subCompany.setFieldcol(16);
subCompany.setLabelcol(8);
subCompany.setViewAttr(2);
subCompany.setInputType("");
subCompany.setIsQuickSearch(false);
subCompany.setLabel("分部");
subCompany.getBrowserConditionParam().setIsSingle(false);
conditionItems.add(subCompany);
// 部门
SearchConditionItem departmentName = conditionFactory.createCondition(ConditionType.BROWSER, 502227, "department", "4");
SearchConditionItem departmentName = conditionFactory.createCondition(ConditionType.BROWSER, 502227, "departmentIdStr", "4");
departmentName.setColSpan(2);
departmentName.setFieldcol(16);
departmentName.setLabelcol(8);
@ -426,6 +452,7 @@ public class SalarySendWrapper extends Service implements SalarySendWrapperProxy
departmentName.setInputType("");
departmentName.setIsQuickSearch(false);
departmentName.setLabel("部门");
departmentName.getBrowserConditionParam().setIsSingle(false);
conditionItems.add(departmentName);
// 岗位