薪资明细表
This commit is contained in:
parent
18c496c009
commit
e3c528c649
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -110,4 +110,12 @@ public interface EmployMapper {
|
|||
* @return
|
||||
*/
|
||||
List<DataCollectionEmployee> listByDismissDate(String dismissDate);
|
||||
|
||||
/**
|
||||
* 根据分部、部门获取查询
|
||||
* @param subCompanyIds
|
||||
* @param departmentIds
|
||||
* @return
|
||||
*/
|
||||
List<DataCollectionEmployee> listBySubCompanyOrDepartment(@Param("subCompanyIds") List<Long> subCompanyIds, @Param("departmentIds") List<Long> departmentIds);
|
||||
}
|
||||
|
|
@ -446,4 +446,34 @@
|
|||
)
|
||||
</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>
|
||||
</mapper>
|
||||
|
|
@ -86,4 +86,7 @@ public interface ExternalEmployeeMapper {
|
|||
* @return
|
||||
*/
|
||||
Collection<DataCollectionEmployee> listAllForReport();
|
||||
|
||||
|
||||
List<DataCollectionEmployee> listSomeDataCollectionEmployee(ExtEmpPO po);
|
||||
}
|
||||
|
|
@ -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>
|
||||
|
||||
|
||||
<!-- 插入不为NULL的字段 -->
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
@ -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);
|
||||
|
||||
/**
|
||||
* 导出员工详情列表
|
||||
*
|
||||
|
|
|
|||
|
|
@ -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())) : 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());
|
||||
// // 获取核算数据
|
||||
|
|
|
|||
|
|
@ -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,55 @@ 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("/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;
|
||||
}
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 导出员工详情列表
|
||||
// *
|
||||
|
|
|
|||
|
|
@ -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,100 @@ 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()));
|
||||
}
|
||||
}
|
||||
}
|
||||
countResultMap.put(itemKey, ReportDataUtil.thousandthConvert(sumBigDecimal.toString()));
|
||||
}
|
||||
}
|
||||
PageInfo<Map<String, Object>> pageInfo = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), 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());
|
||||
} 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);
|
||||
resultMap.put("countResult", countResultMap);
|
||||
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(currentTenantKey, currentEmployeeId, 163974, "人员id不能为空"));
|
||||
// // 构建异步导出参数
|
||||
|
|
|
|||
|
|
@ -54,4 +54,6 @@ public interface ExtEmpService {
|
|||
Map<String, Object> previewImportExtEmp(ExtEmpImportParam param);
|
||||
|
||||
Map<String, Object> importExtEmp(ExtEmpImportParam param);
|
||||
|
||||
List<DataCollectionEmployee> listBySubCompanyOrDepartment(List<Long> subCompanyIds, List<Long> departmentIds);
|
||||
}
|
||||
|
|
@ -134,4 +134,12 @@ public interface SalaryEmployeeService {
|
|||
* @return
|
||||
*/
|
||||
EmployeeInfoExpandDTO getExpandFieldSettings(String module);
|
||||
|
||||
/**
|
||||
* 根据部门或者分部查询人员
|
||||
* @param subCompanyIds
|
||||
* @param departmentIds
|
||||
* @return
|
||||
*/
|
||||
List<DataCollectionEmployee> listBySubCompanyOrDepartment(List<Long> subCompanyIds, List<Long> departmentIds);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -617,4 +617,9 @@ public class ExtEmpServiceImpl extends Service implements ExtEmpService {
|
|||
resultPo.setModifier((long) user.getUID());
|
||||
return resultPo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DataCollectionEmployee> listBySubCompanyOrDepartment(List<Long> subCompanyIds, List<Long> departmentIds) {
|
||||
return getExternalEmployeeMapper().listSomeDataCollectionEmployee(ExtEmpPO.builder().subcompanyIds(subCompanyIds).departmentIds(departmentIds).build());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ import com.engine.salary.entity.salarysob.param.SalarySobRangeEmpQueryParam;
|
|||
import com.engine.salary.entity.salarysob.po.SalarySobRangePO;
|
||||
import com.engine.salary.enums.UserStatusEnum;
|
||||
import com.engine.salary.enums.datacollection.UseEmployeeTypeEnum;
|
||||
import com.engine.salary.mapper.datacollection.EmployMapper;
|
||||
import com.engine.salary.mapper.hrm.ExpandFieldSettingsMapper;
|
||||
import com.engine.salary.mapper.sys.SalarySysConfMapper;
|
||||
import com.engine.salary.service.ExtEmpService;
|
||||
|
|
@ -53,6 +54,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);
|
||||
}
|
||||
|
|
@ -428,4 +433,14 @@ public class SalaryEmployeeServiceImpl extends Service implements SalaryEmployee
|
|||
|
||||
return null;
|
||||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue