光阳摩托
This commit is contained in:
parent
3400cff4d0
commit
5c256635ff
|
|
@ -181,7 +181,12 @@ public class EmployBiz extends BaseBean {
|
|||
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
|
||||
try {
|
||||
EmployMapper mapper = sqlSession.getMapper(EmployMapper.class);
|
||||
return mapper.getDeptInfoList(list);
|
||||
List<List<Long>> partition = Lists.partition(list, 500);
|
||||
List<DeptInfo> resultList = new ArrayList<>();
|
||||
partition.forEach(part -> {
|
||||
resultList.addAll(mapper.getDeptInfoList(part));
|
||||
});
|
||||
return resultList;
|
||||
} finally {
|
||||
sqlSession.close();
|
||||
}
|
||||
|
|
@ -244,4 +249,13 @@ public class EmployBiz extends BaseBean {
|
|||
}
|
||||
}
|
||||
|
||||
public List<DeptInfo> listAllDeptInfo() {
|
||||
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
|
||||
try {
|
||||
EmployMapper mapper = sqlSession.getMapper(EmployMapper.class);
|
||||
return mapper.listAllDeptInfo();
|
||||
} finally {
|
||||
sqlSession.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,4 +32,6 @@ public class DeptInfo {
|
|||
* 所属分部id
|
||||
*/
|
||||
private Long subcompanyid1;
|
||||
|
||||
private double showorder;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ import com.engine.salary.enums.SalaryValueTypeEnum;
|
|||
import com.engine.salary.enums.UserStatusEnum;
|
||||
import com.engine.salary.enums.salaryaccounting.LockStatusEnum;
|
||||
import com.engine.salary.enums.salaryitem.SalaryDataTypeEnum;
|
||||
import com.engine.salary.util.SalaryDateUtil;
|
||||
import com.engine.salary.util.SalaryEntityUtil;
|
||||
import com.engine.salary.util.SalaryI18nUtil;
|
||||
import com.engine.salary.util.page.SalaryPageUtil;
|
||||
|
|
@ -893,4 +894,67 @@ public class SalaryAcctResultBO {
|
|||
}
|
||||
|
||||
|
||||
public static List<Map<String, Object>> buildData4Gymt(List<SalaryItemPO> salaryItems,
|
||||
List<SalarySobEmpFieldPO> salarySobEmpFields,
|
||||
List<DataCollectionEmployee> simpleEmployees,
|
||||
List<SalaryAcctEmployeePO> salaryAcctEmployees,
|
||||
List<SalaryAcctResultPO> salaryAccountingResults,
|
||||
Date salaryMonth,
|
||||
boolean dynamicEmpInfo) {
|
||||
if (CollectionUtils.isEmpty(salaryAcctEmployees)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
String gfr = SalaryDateUtil.getFormatYearMonth(salaryMonth) + "-10";
|
||||
SalaryI18nUtil.i18nList(salaryAcctEmployees);
|
||||
Map<Long, DataCollectionEmployee> employeeMap = SalaryEntityUtil.convert2Map(simpleEmployees, DataCollectionEmployee::getEmployeeId);
|
||||
Map<Long, List<SalaryAcctResultPO>> acctResultMap = SalaryEntityUtil.group2Map(salaryAccountingResults, SalaryAcctResultPO::getSalaryAcctEmpId);
|
||||
return salaryAcctEmployees.stream().map(e -> {
|
||||
Map<Long, Object> resultValueMap = SalaryEntityUtil.convert2Map(acctResultMap.getOrDefault(e.getId(), Collections.emptyList()),
|
||||
SalaryAcctResultPO::getSalaryItemId, SalaryAcctResultPO::getResultValue);
|
||||
// 薪资项目的值
|
||||
Map<String, Object> map = SalaryEntityUtil.convert2Map(salaryItems, o -> "" + o.getId(), o -> resultValueMap.getOrDefault(o.getId(), StringUtils.EMPTY));
|
||||
// 人员信息字段的值
|
||||
Map<String, String> fieldValueMap = SalaryAcctFormulaBO.convert2FormulaEmployee(employeeMap.get(e.getEmployeeId()), e, false );
|
||||
for (SalarySobEmpFieldPO salarySobEmpField : salarySobEmpFields) {
|
||||
// 员工信息字段的字段类型
|
||||
if (dynamicEmpInfo) {
|
||||
map.put(salarySobEmpField.getFieldCode(), fieldValueMap.get(salarySobEmpField.getFieldCode()));
|
||||
} else {
|
||||
if ("departmentName".equals(salarySobEmpField.getFieldCode())) {
|
||||
map.put("departmentName", e.getDepartmentName());
|
||||
} else if ("departmentId".equals(salarySobEmpField.getFieldCode())) {
|
||||
map.put("departmentId", e.getDepartmentId());
|
||||
} else if ("subcompanyName".equals(salarySobEmpField.getFieldCode())) {
|
||||
map.put("subcompanyName", e.getSubcompanyName());
|
||||
} else if ("jobcall".equals(salarySobEmpField.getFieldCode())) {
|
||||
map.put("jobcall", e.getJobcall());
|
||||
} else if ("jobcallId".equals(salarySobEmpField.getFieldCode())) {
|
||||
map.put("jobcallId", e.getJobcallId());
|
||||
} else if ("jobtitleName".equals(salarySobEmpField.getFieldCode())) {
|
||||
map.put("jobtitleName", e.getJobtitleName());
|
||||
} else if ("jobtitleId".equals(salarySobEmpField.getFieldCode())) {
|
||||
map.put("jobtitleId", e.getJobtitleId());
|
||||
} else if ("status".equals(salarySobEmpField.getFieldCode())) {
|
||||
map.put("status", e.getStatus());
|
||||
} else if ("statusName".equals(salarySobEmpField.getFieldCode())) {
|
||||
map.put("statusName", UserStatusEnum.getDefaultLabelByValue(new Integer(e.getStatus())));
|
||||
} else {
|
||||
map.put(salarySobEmpField.getFieldCode(), fieldValueMap.get(salarySobEmpField.getFieldCode()));
|
||||
}
|
||||
}
|
||||
map.put(salarySobEmpField.getFieldCode() + DATA_TYPE_SUFFIX, SalaryDataTypeEnum.STRING.getValue());
|
||||
}
|
||||
// 主键id
|
||||
map.put("id", e.getId());
|
||||
//人员id
|
||||
map.put("employeeId", e.getEmployeeId());
|
||||
map.put("userName", fieldValueMap.get("username"));
|
||||
map.put("gfr", gfr);
|
||||
// 个税扣缴义务人
|
||||
// String taxAgentName = taxAgentNameMap.getOrDefault(e.getTaxAgentId(), StringUtils.EMPTY);
|
||||
// map.put("taxAgentName", taxAgentName);
|
||||
return map;
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,44 @@
|
|||
package com.engine.salary.entity.salaryacct.param;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 光阳摩托报表查询参数
|
||||
* <p>Copyright: Copyright (c) 2025</p>
|
||||
* <p>Company: 泛微软件</p>
|
||||
*
|
||||
* @author xzy
|
||||
* @version 1.0
|
||||
**/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class GyReportQueryParam {
|
||||
|
||||
|
||||
// 课别ids
|
||||
private List<Long> kbIds;
|
||||
|
||||
//人员姓名
|
||||
private String employeeName;
|
||||
|
||||
// 年月
|
||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||
private Date salaryMonth;
|
||||
|
||||
// 用工性质
|
||||
private List<Integer> ygxzs;
|
||||
|
||||
// 薪资账套
|
||||
private List<Long> salarySobIds;
|
||||
|
||||
private boolean export;
|
||||
}
|
||||
|
|
@ -12,7 +12,7 @@ import com.engine.salary.enums.BaseEnum;
|
|||
public enum PaymentStatusEnum implements BaseEnum<Integer> {
|
||||
|
||||
COMMON(0, "正常缴纳", 92265),
|
||||
REPAIR(1, "补缴", 92266),
|
||||
REPAIR(1, "hide_edit_button", 92266),
|
||||
PAYMENT(2,"代缴",121755),
|
||||
RECESSION(3,"退差",134057),
|
||||
BALANCE(4,"补差",139823);
|
||||
|
|
|
|||
|
|
@ -175,4 +175,6 @@ public interface EmployMapper {
|
|||
List<DataCollectionEmployee> listBySubCompanyOrDepartment(@Param("subCompanyIds") List<Long> subCompanyIds, @Param("departmentIds") List<Long> departmentIds);
|
||||
|
||||
JobCallInfo getJobCallInfoById(@Param("jobCallId") Long jobCallId);
|
||||
|
||||
List<DeptInfo> listAllDeptInfo();
|
||||
}
|
||||
|
|
@ -342,7 +342,8 @@
|
|||
|
||||
<select id="getDeptInfoList" resultType="com.engine.salary.entity.hrm.DeptInfo">
|
||||
select d.departmentname as name,
|
||||
d.id as id
|
||||
d.id as id,
|
||||
d.showorder
|
||||
from hrmdepartment d
|
||||
where 1=1
|
||||
<if test="departmentIds != null and departmentIds.size()>0">
|
||||
|
|
@ -628,4 +629,11 @@
|
|||
from hrmjobcall job
|
||||
where job.id = #{jobCallId}
|
||||
</select>
|
||||
<select id="listAllDeptInfo" resultType="com.engine.salary.entity.hrm.DeptInfo">
|
||||
select d.departmentname as name,
|
||||
d.id as id,
|
||||
d.subcompanyid1 as subcompanyid1,
|
||||
d.showorder
|
||||
from hrmdepartment d
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -7,6 +7,7 @@ import com.engine.salary.entity.salaryacct.dto.SalaryAcctResultListColumnDTO;
|
|||
import com.engine.salary.entity.salaryacct.param.*;
|
||||
import com.engine.salary.entity.salaryacct.po.SalaryAcctResultPO;
|
||||
import com.engine.salary.util.page.PageInfo;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
|
@ -217,4 +218,17 @@ public interface SalaryAcctResultService {
|
|||
* @param param
|
||||
*/
|
||||
void batchUpdate(SalaryAcctResultBatchUpdateParam param);
|
||||
|
||||
/**
|
||||
* 实发工资报表列表
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
Map<String, Object> listGysfgzReport(GyReportQueryParam param);
|
||||
|
||||
XSSFWorkbook exportGysfgzReport(GyReportQueryParam param);
|
||||
|
||||
Map<String, Object> listGyDepartmentSalaryReport(GyReportQueryParam param);
|
||||
|
||||
XSSFWorkbook exportGyDepartmentSalaryReport(GyReportQueryParam param);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -105,6 +105,8 @@ public interface SalaryEmployeeService {
|
|||
|
||||
List<DeptInfo> getDeptInfoList(List<Long> departmentIds);
|
||||
|
||||
List<DeptInfo> listAllDeptInfo();
|
||||
|
||||
DeptInfo getDeptInfoById(Long departmentId);
|
||||
|
||||
List<DeptInfo> getVirtualDeptInfoList(List<Long> virtualDepartmentIds);
|
||||
|
|
|
|||
|
|
@ -1,10 +1,13 @@
|
|||
package com.engine.salary.service.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.api.formmode.mybatis.util.SqlProxyHandle;
|
||||
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.common.LocalDateRange;
|
||||
import com.engine.salary.component.WeaTableColumnGroup;
|
||||
import com.engine.salary.config.SalaryElogConfig;
|
||||
import com.engine.salary.constant.SalaryDefaultTenantConstant;
|
||||
import com.engine.salary.encrypt.EncryptUtil;
|
||||
|
|
@ -15,6 +18,8 @@ import com.engine.salary.entity.hrm.DeptInfo;
|
|||
import com.engine.salary.entity.hrm.JobCallInfo;
|
||||
import com.engine.salary.entity.hrm.PositionInfo;
|
||||
import com.engine.salary.entity.hrm.SubCompanyInfo;
|
||||
import com.engine.salary.entity.hrm.dto.HrmInfoDTO;
|
||||
import com.engine.salary.entity.hrm.param.HrmQueryParam;
|
||||
import com.engine.salary.entity.progress.ProgressDTO;
|
||||
import com.engine.salary.entity.report.po.SalaryAcctResultReportPO;
|
||||
import com.engine.salary.entity.salaryacct.bo.*;
|
||||
|
|
@ -38,6 +43,7 @@ import com.engine.salary.enums.salaryaccounting.SalaryAcctResultDataSourceEnum;
|
|||
import com.engine.salary.enums.salaryitem.SalaryDataTypeEnum;
|
||||
import com.engine.salary.enums.salarysob.IncomeCategoryEnum;
|
||||
import com.engine.salary.exception.SalaryRunTimeException;
|
||||
import com.engine.salary.mapper.datacollection.EmployMapper;
|
||||
import com.engine.salary.mapper.salaryacct.SalaryAcctResultMapper;
|
||||
import com.engine.salary.report.service.SalaryStatisticsReportService;
|
||||
import com.engine.salary.report.service.impl.SalaryStatisticsReportServiceImpl;
|
||||
|
|
@ -51,6 +57,7 @@ import com.engine.salary.util.SalaryDateUtil;
|
|||
import com.engine.salary.util.SalaryEntityUtil;
|
||||
import com.engine.salary.util.SalaryI18nUtil;
|
||||
import com.engine.salary.util.db.MapperProxyFactory;
|
||||
import com.engine.salary.util.excel.ExcelUtilPlus;
|
||||
import com.engine.salary.util.page.PageInfo;
|
||||
import com.engine.salary.util.page.SalaryPageUtil;
|
||||
import com.engine.salary.util.valid.ValidUtil;
|
||||
|
|
@ -64,10 +71,14 @@ import org.apache.commons.collections4.CollectionUtils;
|
|||
import org.apache.commons.collections4.MapUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.math.NumberUtils;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
|
||||
import org.springframework.util.StopWatch;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.User;
|
||||
import weaver.wechat.util.Utils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
|
|
@ -126,6 +137,10 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
|
|||
return ServiceUtil.getService(SalaryEmployeeServiceImpl.class, user);
|
||||
}
|
||||
|
||||
private EmployMapper getEmployMapper() {
|
||||
return SqlProxyHandle.getProxy(EmployMapper.class);
|
||||
}
|
||||
|
||||
private SalaryFormulaService getSalaryFormulaService(User user) {
|
||||
return ServiceUtil.getService(SalaryFormulaServiceImpl.class, user);
|
||||
}
|
||||
|
|
@ -1258,4 +1273,498 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
|
|||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 实发工资报表列表
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Object> listGysfgzReport(GyReportQueryParam param) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
BaseBean baseBean = new BaseBean();
|
||||
if (param.getSalaryMonth() == null ) {
|
||||
return result;
|
||||
}
|
||||
// 查询薪资核算记录
|
||||
List<SalaryAcctRecordPO> salaryAcctRecordList = getSalaryAcctRecordService(user).listBySalaryMonth(LocalDateRange.builder().fromDate(param.getSalaryMonth()).endDate(param.getSalaryMonth()).build());
|
||||
// 过滤未归档数据
|
||||
// salaryAcctRecordList = salaryAcctRecordList.stream().filter(record -> record.getStatus() > SalaryAcctRecordStatusEnum.NOT_ARCHIVED.getValue()).collect(Collectors.toList());
|
||||
List<Long> salaryAcctRecordIds = salaryAcctRecordList.stream().map(SalaryAcctRecordPO::getId).collect(Collectors.toList());
|
||||
if (CollectionUtils.isEmpty(salaryAcctRecordIds)) {
|
||||
return result;
|
||||
}
|
||||
// 查询薪资核算人员
|
||||
List<SalaryAcctEmployeePO> salaryAcctEmployeePOList = getSalaryAcctEmployeeService(user).listByParam(SalaryAcctEmployeeQueryParam.builder().salaryAcctRecordIds(salaryAcctRecordIds).build());
|
||||
if (CollectionUtils.isNotEmpty(param.getSalarySobIds())) {
|
||||
salaryAcctEmployeePOList = salaryAcctEmployeePOList.stream().filter(acctEmp ->
|
||||
param.getSalarySobIds().contains(acctEmp.getSalarySobId())
|
||||
).collect(Collectors.toList());
|
||||
}
|
||||
if (StringUtils.isNotBlank(param.getEmployeeName())) {
|
||||
List<HrmInfoDTO> hrmInfoDTOS = getEmployMapper().listHrmInfoByIdAndName(HrmQueryParam.builder().userName(param.getEmployeeName()).build());
|
||||
List<Long> empIds = hrmInfoDTOS.stream().map(HrmInfoDTO::getEmployeeId).collect(Collectors.toList());
|
||||
salaryAcctEmployeePOList = salaryAcctEmployeePOList.stream().filter(acctEmp ->
|
||||
empIds.contains(acctEmp.getEmployeeId())
|
||||
).collect(Collectors.toList());
|
||||
}
|
||||
if (CollectionUtils.isEmpty(salaryAcctEmployeePOList)) {
|
||||
return result;
|
||||
}
|
||||
// 获取员工信息
|
||||
List<Long> salaryAcctEmpIds = salaryAcctEmployeePOList.stream().map(SalaryAcctEmployeePO::getId).distinct().collect(Collectors.toList());
|
||||
List<Long> empIds = salaryAcctEmployeePOList.stream().map(SalaryAcctEmployeePO::getEmployeeId).distinct().collect(Collectors.toList());
|
||||
List<DataCollectionEmployee> employeeList = getSalaryEmployeeService(user).listByIds(empIds);
|
||||
// 获取需要统计的薪资项目
|
||||
RecordSet rs = new RecordSet();
|
||||
List<Long> reportItemIds = new ArrayList<>();
|
||||
rs.execute("select xzxm from uf_gwsfgzbbpz order by px");
|
||||
while (rs.next()) {
|
||||
String xzxm = rs.getString("xzxm");
|
||||
if (NumberUtils.isCreatable(xzxm)) {
|
||||
reportItemIds.add(Long.valueOf(xzxm));
|
||||
}
|
||||
}
|
||||
Long ygxzItemId = SalaryEntityUtil.string2Long(baseBean.getPropValue("czgymtSalaryReport", "ygxz_item_id"));
|
||||
Long kebItemId = SalaryEntityUtil.string2Long(baseBean.getPropValue("czgymtSalaryReport", "kb_item_id"));
|
||||
Long shijItemId = SalaryEntityUtil.string2Long(baseBean.getPropValue("czgymtSalaryReport", "shij_item_id"));
|
||||
Long bingjItemId = SalaryEntityUtil.string2Long(baseBean.getPropValue("czgymtSalaryReport", "bingj_item_id"));
|
||||
Long qingjItemId = SalaryEntityUtil.string2Long(baseBean.getPropValue("czgymtSalaryReport", "qingj_item_id"));
|
||||
Long sangjItemId = SalaryEntityUtil.string2Long(baseBean.getPropValue("czgymtSalaryReport", "sangj_item_id"));
|
||||
List<Long> otherItemIds = Arrays.stream(baseBean.getPropValue("czgymtSalaryReport", "need_sum_item_ids_in_qj").split(","))
|
||||
.filter(NumberUtils::isCreatable).map(Long::valueOf).collect(Collectors.toList());
|
||||
|
||||
|
||||
List<Long> salaryItemIdList = new ArrayList<>();
|
||||
salaryItemIdList.addAll(reportItemIds);
|
||||
salaryItemIdList.add(shijItemId == null ? 0L : shijItemId);
|
||||
salaryItemIdList.add(bingjItemId == null ? 0L : bingjItemId);
|
||||
salaryItemIdList.add(qingjItemId == null ? 0L : qingjItemId);
|
||||
salaryItemIdList.add(sangjItemId == null ? 0L : sangjItemId);
|
||||
salaryItemIdList.addAll(otherItemIds);
|
||||
salaryItemIdList.add(kebItemId == null ? 0L : kebItemId);
|
||||
salaryItemIdList = salaryItemIdList.stream().filter(id -> id != null).distinct().collect(Collectors.toList());
|
||||
// 查询薪资核算结果
|
||||
List<SalaryAcctResultPO> acctResultList = getSalaryAcctResultService(user).listByAcctEmployeeIdsAndSalaryItemIds(salaryAcctEmpIds, salaryItemIdList);
|
||||
List<SalaryItemPO> salaryItemPOList = getSalaryItemService(user).listAll();
|
||||
Map<Long, String> salaryItemMap = SalaryEntityUtil.convert2Map(salaryItemPOList, SalaryItemPO::getId, SalaryItemPO::getName);
|
||||
Map<Long, SalaryItemPO> salaryItemPOMap = SalaryEntityUtil.convert2Map(salaryItemPOList, SalaryItemPO::getId);
|
||||
|
||||
// 查询薪资核算结果
|
||||
List<SalarySobEmpFieldPO> salarySobEmpFields = new ArrayList<>();
|
||||
salarySobEmpFields.add(SalarySobEmpFieldPO.builder().fieldCode("workcode").build());
|
||||
List<Long> finalSalaryItemIdList = salaryItemIdList;
|
||||
List<SalaryItemPO> salaryItems = salaryItemPOList.stream().filter(itemPO -> finalSalaryItemIdList.contains(itemPO.getId())).collect(Collectors.toList());
|
||||
List<Map<String, Object>> acctResultMap = SalaryAcctResultBO.buildData4Gymt(salaryItems, salarySobEmpFields, employeeList, salaryAcctEmployeePOList, acctResultList, param.getSalaryMonth(),false);
|
||||
|
||||
// 获取所有部门信息
|
||||
Map<Long, String> departmentNameMap = SalaryEntityUtil.convert2Map(getSalaryEmployeeService(user).listAllDeptInfo(), DeptInfo::getId, DeptInfo::getName);
|
||||
// 处理请假字段
|
||||
for (Map<String, Object> map : acctResultMap) {
|
||||
StringBuilder qjSb = new StringBuilder();
|
||||
qjSb.append(Utils.null2String(salaryItemMap.get(qingjItemId))).append(Utils.null2String(map.get(Utils.null2String(qingjItemId)))).append(" ")
|
||||
.append(Utils.null2String(salaryItemMap.get(shijItemId))).append(Utils.null2String(map.get(Utils.null2String(shijItemId)))).append(" ")
|
||||
.append(Utils.null2String(salaryItemMap.get(bingjItemId))).append(Utils.null2String(map.get(Utils.null2String(bingjItemId)))).append(" ")
|
||||
.append(Utils.null2String(salaryItemMap.get(sangjItemId))).append(Utils.null2String(map.get(Utils.null2String(sangjItemId)))).append(" ");
|
||||
|
||||
BigDecimal sumVal = new BigDecimal("0");
|
||||
for (Long id : otherItemIds) {
|
||||
String value = Utils.null2String(map.get(Utils.null2String(id)));
|
||||
if (NumberUtils.isCreatable(value)) {
|
||||
sumVal = sumVal.add(new BigDecimal(value));
|
||||
}
|
||||
}
|
||||
qjSb.append("其他").append(sumVal.toString());
|
||||
map.put(Utils.null2String(qingjItemId), qjSb.toString());
|
||||
String kebId = Utils.null2String(map.get(kebItemId.toString()));
|
||||
String kebName = departmentNameMap.getOrDefault(SalaryEntityUtil.string2Long(kebId), "");
|
||||
map.put("departmentName", kebName);
|
||||
}
|
||||
|
||||
if (CollectionUtils.isNotEmpty(param.getKbIds())) {
|
||||
acctResultMap = acctResultMap.stream().filter(map -> param.getKbIds().contains(Utils.null2String(map.get(kebItemId.toString())))).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
if (CollectionUtils.isNotEmpty(param.getYgxzs())) {
|
||||
List<String> ygxzList = new ArrayList<>();
|
||||
rs.execute("select id,name from hrmusekind and id in (" + StringUtils.join(param.getYgxzs(), ",") + ")");
|
||||
while (rs.next()) {
|
||||
ygxzList.add(rs.getString("name"));
|
||||
}
|
||||
acctResultMap = acctResultMap.stream().filter(map -> ygxzList.contains(Utils.null2String(map.get(ygxzItemId.toString())))).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
// 构建表头
|
||||
List<WeaTableColumnGroup> columns = new ArrayList<>();
|
||||
columns.add(new WeaTableColumnGroup("150px", "所属部门", "departmentName"));
|
||||
columns.add(new WeaTableColumnGroup("150px", "工号", "workcode"));
|
||||
columns.add(new WeaTableColumnGroup("150px", "姓名", "userName"));
|
||||
columns.add(new WeaTableColumnGroup("150px", "给付日", "gfr"));
|
||||
for (Long itemId : reportItemIds) {
|
||||
String itemName = salaryItemMap.getOrDefault(itemId, "");
|
||||
columns.add(new WeaTableColumnGroup("150px", itemName, itemId.toString()));
|
||||
}
|
||||
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
// 合计或导出需要合计行
|
||||
Map<String, Object> sumResultMap = new HashMap<>();
|
||||
sumResultMap.put("departmentName", "合计");
|
||||
for (Long itemId : reportItemIds) {
|
||||
SalaryItemPO salaryItemPO = salaryItemPOMap.get(itemId);
|
||||
if (salaryItemPO != null && salaryItemPO.getDataType().equals(SalaryDataTypeEnum.NUMBER.getValue())) {
|
||||
BigDecimal sumValue = acctResultMap.stream()
|
||||
.map(m -> m.get(itemId.toString()))
|
||||
.filter(value -> value != null && NumberUtils.isCreatable(value.toString()))
|
||||
.map(e -> SalaryEntityUtil.empty2Zero(e.toString()))
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
sumResultMap.put(itemId.toString(),sumValue);
|
||||
}
|
||||
}
|
||||
sumResultMap.put(Utils.null2String(qingjItemId), "");
|
||||
acctResultMap.add(sumResultMap);
|
||||
map.put("column", columns);
|
||||
map.put("data", acctResultMap);
|
||||
return map;
|
||||
}
|
||||
|
||||
@Override
|
||||
public XSSFWorkbook exportGysfgzReport(GyReportQueryParam param) {
|
||||
param.setExport(true);
|
||||
Map<String, Object> resultMap = listGysfgzReport(param);
|
||||
List<Map<String, Object>> resultList = (List<Map<String, Object>>)resultMap.get("data");
|
||||
// Map<String, Object> sumResultMap = (Map<String, Object>)resultMap.get("sumRow");
|
||||
List<WeaTableColumnGroup> columns = (List<WeaTableColumnGroup>)resultMap.getOrDefault("column", Collections.emptyList());
|
||||
// 1.工作簿名称
|
||||
String sheetName = SalaryI18nUtil.getI18nLabel(0, "实发工资报表");
|
||||
// 2.表头
|
||||
List<Object> headerList = new ArrayList<>();
|
||||
columns.stream().map(WeaTableColumnGroup::getText).forEach(headerList::add);
|
||||
// 组装数据
|
||||
List<List<Object>> rows = new ArrayList<>();
|
||||
rows.add(headerList);
|
||||
|
||||
// 3.表数据
|
||||
// resultList.add(sumResultMap);
|
||||
for (Map<String, Object> map : resultList) {
|
||||
List<Object> row = new ArrayList<>();
|
||||
for (WeaTableColumnGroup col : columns) {
|
||||
row.add(map.getOrDefault(col.getColumn(), ""));
|
||||
}
|
||||
rows.add(row);
|
||||
}
|
||||
|
||||
return ExcelUtilPlus.genWorkbookV2(rows, sheetName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> listGyDepartmentSalaryReport(GyReportQueryParam param) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
if(param.getSalaryMonth() == null) {
|
||||
return result;
|
||||
}
|
||||
BaseBean baseBean = new BaseBean();
|
||||
// 查询薪资核算记录
|
||||
List<SalaryAcctRecordPO> salaryAcctRecordList = getSalaryAcctRecordService(user).listBySalaryMonth(LocalDateRange.builder().fromDate(param.getSalaryMonth()).endDate(param.getSalaryMonth()).build());
|
||||
// 过滤未归档数据
|
||||
// salaryAcctRecordList = salaryAcctRecordList.stream().filter(record -> record.getStatus() > SalaryAcctRecordStatusEnum.NOT_ARCHIVED.getValue()).collect(Collectors.toList());
|
||||
List<Long> salaryAcctRecordIds = salaryAcctRecordList.stream().map(SalaryAcctRecordPO::getId).collect(Collectors.toList());
|
||||
if (CollectionUtils.isEmpty(salaryAcctRecordIds)) {
|
||||
return result;
|
||||
}
|
||||
// 查询薪资核算人员
|
||||
List<SalaryAcctEmployeePO> salaryAcctEmployeePOList = getSalaryAcctEmployeeService(user).listBySalaryAcctRecordIds(salaryAcctRecordIds);
|
||||
if (CollectionUtils.isNotEmpty(param.getSalarySobIds())) {
|
||||
salaryAcctEmployeePOList = salaryAcctEmployeePOList.stream().filter(acctEmp ->
|
||||
param.getSalarySobIds().contains(acctEmp.getSalarySobId())
|
||||
).collect(Collectors.toList());
|
||||
}
|
||||
// if (CollectionUtils.isNotEmpty(param.getSubCompanyIds())) {
|
||||
// salaryAcctEmployeePOList = salaryAcctEmployeePOList.stream().filter(acctEmp ->
|
||||
// param.getSubCompanyIds().contains(acctEmp.getSubcompanyId())
|
||||
// ).collect(Collectors.toList());
|
||||
// }
|
||||
//
|
||||
// if (CollectionUtils.isNotEmpty(param.getDepartmentIds())) {
|
||||
// salaryAcctEmployeePOList = salaryAcctEmployeePOList.stream().filter(acctEmp ->
|
||||
// param.getDepartmentIds().contains(acctEmp.getDepartmentId())
|
||||
// ).collect(Collectors.toList());
|
||||
// }
|
||||
if (CollectionUtils.isEmpty(salaryAcctEmployeePOList)) {
|
||||
return result;
|
||||
}
|
||||
// 获取员工信息
|
||||
List<Long> salaryAcctEmpIds = salaryAcctEmployeePOList.stream().map(SalaryAcctEmployeePO::getId).distinct().collect(Collectors.toList());
|
||||
List<Long> empIds = salaryAcctEmployeePOList.stream().map(SalaryAcctEmployeePO::getEmployeeId).distinct().collect(Collectors.toList());
|
||||
List<DataCollectionEmployee> employeeList = getSalaryEmployeeService(user).listByIds(empIds);
|
||||
// 获取需要统计的薪资项目
|
||||
List<SalaryItemPO> salaryItemPOList = getSalaryItemService(user).listAll();
|
||||
Map<Long, SalaryItemPO> salaryItemNameMap = SalaryEntityUtil.convert2Map(salaryItemPOList, SalaryItemPO::getId);
|
||||
Long ygxzItemId = SalaryEntityUtil.string2Long(baseBean.getPropValue("czgymtSalaryReport", "ygxz_item_id"));
|
||||
Long kebItemId = SalaryEntityUtil.string2Long(baseBean.getPropValue("czgymtSalaryReport", "kb_item_id"));
|
||||
// 获取薪资项目配置
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.execute("select xzxm from uf_gwgzhzbbpz order by px");
|
||||
List<Long> xzxmList = new ArrayList<>();
|
||||
while (rs.next()) {
|
||||
xzxmList.add(NumberUtils.isCreatable(rs.getString("xzxm")) ? Long.valueOf(rs.getString("xzxm")) : 0L);
|
||||
}
|
||||
List<SalaryItemPO> salaryItemList = xzxmList.stream()
|
||||
.map(id -> salaryItemNameMap.get(id))
|
||||
.filter(ObjectUtil::isNotNull)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
List<Long> salaryItemIdList = salaryItemList.stream().map(SalaryItemPO::getId).collect(Collectors.toList());
|
||||
salaryItemIdList.add(kebItemId == null ? 0L : kebItemId);
|
||||
salaryItemIdList.add(ygxzItemId == null ? 0L : ygxzItemId);
|
||||
// 查询薪资核算结果
|
||||
List<SalaryAcctResultPO> acctResultList = getSalaryAcctResultService(user).listByAcctEmployeeIdsAndSalaryItemIds(salaryAcctEmpIds, salaryItemIdList);
|
||||
|
||||
// 查询薪资核算结果
|
||||
List<SalarySobEmpFieldPO> salarySobEmpFields = new ArrayList<>();
|
||||
List<Long> finalSalaryItemIdList = salaryItemIdList;
|
||||
List<SalaryItemPO> salaryItems = salaryItemPOList.stream().filter(itemPO -> finalSalaryItemIdList.contains(itemPO.getId())).collect(Collectors.toList());
|
||||
List<Map<String, Object>> acctResultMap = SalaryAcctResultBO.buildData4Gymt(salaryItems, salarySobEmpFields, employeeList, salaryAcctEmployeePOList, acctResultList, param.getSalaryMonth() ,false);
|
||||
if (CollectionUtils.isNotEmpty(param.getKbIds())) {
|
||||
List<DeptInfo> deptInfoList = getSalaryEmployeeService(user).getDeptInfoList(param.getKbIds());
|
||||
List<String> depNames = deptInfoList.stream().map(DeptInfo::getName).collect(Collectors.toList());
|
||||
acctResultMap = acctResultMap.stream().filter(map -> depNames.contains(Utils.null2String(map.get(kebItemId.toString())))).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
if (CollectionUtils.isNotEmpty(param.getYgxzs())) {
|
||||
List<String> ygxzList = new ArrayList<>();
|
||||
rs.execute("select id,name from hrmusekind and id in (" + StringUtils.join(param.getYgxzs(), ",") + ")");
|
||||
while (rs.next()) {
|
||||
ygxzList.add(rs.getString("name"));
|
||||
}
|
||||
acctResultMap = acctResultMap.stream().filter(map -> ygxzList.contains(Utils.null2String(map.get(ygxzItemId.toString())))).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
// 用工性质id和部门id分组
|
||||
Map<String, List<Map<String, Object>>> acctResultGroupMap = SalaryEntityUtil.group2Map(acctResultMap, resultMap -> resultMap.getOrDefault(Utils.null2String(ygxzItemId), "") + "_split" + resultMap.getOrDefault(Utils.null2String(kebItemId), ""));
|
||||
List<SalaryItemPO> numberItems = salaryItems.stream().filter(item -> item.getDataType().equals(SalaryDataTypeEnum.NUMBER.getValue())).collect(Collectors.toList());
|
||||
LinkedHashMap<String, Map<String, Object>> sumResultByGroup = getSumResultByGroup4Gw(acctResultGroupMap, Collections.emptyList(), numberItems, kebItemId, ygxzItemId);
|
||||
|
||||
Map<Long, List<Map<String, Object>>> groupByYgxz = new HashMap<>();
|
||||
for (Map.Entry<String, Map<String, Object>> entry : sumResultByGroup.entrySet()) {
|
||||
String[] split = entry.getKey().split("_split");
|
||||
Long ygxzId = split != null && split.length > 0 && NumberUtils.isCreatable(split[0])? Long.valueOf(split[0]) : 0L;
|
||||
List<Map<String, Object>> list = groupByYgxz.computeIfAbsent(ygxzId, k -> new ArrayList<Map<String, Object>>());
|
||||
list.add(entry.getValue());
|
||||
}
|
||||
// 获取所有的用工性质信息
|
||||
rs.execute("select id,name from hrmusekind order by id");
|
||||
LinkedHashMap<Long, String> hrmusekindMap = new LinkedHashMap<>();
|
||||
while (rs.next()) {
|
||||
hrmusekindMap.put(Long.valueOf(rs.getInt("id")), Util.formatMultiLang(rs.getString("name")));
|
||||
}
|
||||
// 每个用工性质需要有一个小记
|
||||
ArrayList<Map<String, Object>> dataList = new ArrayList<>();
|
||||
List<Long> notExitYgxzIds = groupByYgxz.keySet().stream().filter(id -> !hrmusekindMap.containsKey(id)).collect(Collectors.toList());
|
||||
for (Map.Entry<Long, String> entry : hrmusekindMap.entrySet()) {
|
||||
List<Map<String, Object>> maps = groupByYgxz.get(entry.getKey());
|
||||
if (maps != null && CollectionUtils.isNotEmpty(maps)) {
|
||||
dataList.addAll(maps);
|
||||
// 加入合计行
|
||||
Map<String, Object> ygxzSumMap = new HashMap<>();
|
||||
for (SalaryItemPO item : salaryItemList) {
|
||||
BigDecimal sumValue = maps.stream()
|
||||
.map(e -> Utils.null2String(e.get(item.getId().toString())))
|
||||
.filter(NumberUtils::isCreatable)
|
||||
.map(BigDecimal::new)
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
ygxzSumMap.put(item.getId().toString(), sumValue.toPlainString());
|
||||
}
|
||||
// 用工性质名称
|
||||
ygxzSumMap.put("kebie", entry.getValue() + "合计");
|
||||
BigDecimal sumValue = maps.stream()
|
||||
.map(e -> Utils.null2String(e.get("empNums")))
|
||||
.filter(NumberUtils::isCreatable)
|
||||
.map(BigDecimal::new)
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
ygxzSumMap.put("empNums", sumValue.toString());
|
||||
dataList.add(ygxzSumMap);
|
||||
}
|
||||
}
|
||||
for (Long id : notExitYgxzIds) {
|
||||
List<Map<String, Object>> maps = groupByYgxz.get(id);
|
||||
if (maps != null && CollectionUtils.isNotEmpty(maps)) {
|
||||
dataList.addAll(maps);
|
||||
// 加入合计行
|
||||
Map<String, Object> ygxzSumMap = new HashMap<>();
|
||||
for (SalaryItemPO item : salaryItemList) {
|
||||
BigDecimal sumValue = maps.stream()
|
||||
.map(e -> Utils.null2String(e.get(item.getId().toString())))
|
||||
.filter(NumberUtils::isCreatable)
|
||||
.map(BigDecimal::new)
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
ygxzSumMap.put(item.getId().toString(), sumValue.toPlainString());
|
||||
}
|
||||
// 用工性质名称
|
||||
ygxzSumMap.put("kebie", String.valueOf(id));
|
||||
BigDecimal sumValue = maps.stream()
|
||||
.map(e -> Utils.null2String(e.get("empNums")))
|
||||
.filter(NumberUtils::isCreatable)
|
||||
.map(BigDecimal::new)
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
ygxzSumMap.put("empNums", sumValue.toString());
|
||||
dataList.add(ygxzSumMap);
|
||||
}
|
||||
}
|
||||
|
||||
// 构建表头
|
||||
List<WeaTableColumnGroup> columns = new ArrayList<>();
|
||||
columns.add(new WeaTableColumnGroup("150px", "项目", "kebie"));
|
||||
columns.add(new WeaTableColumnGroup("150px", "人数", "empNums"));
|
||||
for (SalaryItemPO salaryItemPO : salaryItemList) {
|
||||
columns.add(new WeaTableColumnGroup("150px", salaryItemPO.getName(), salaryItemPO.getId().toString()));
|
||||
}
|
||||
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
// 合计行
|
||||
Map<String, Object> sumResultMap = new HashMap<>();
|
||||
sumResultMap.put("kebie", "合计");
|
||||
for (SalaryItemPO salaryItem : salaryItemList) {
|
||||
BigDecimal sumValue = sumResultByGroup.values().stream()
|
||||
.map(m -> m.get(salaryItem.getId().toString()))
|
||||
.filter(value -> value != null && NumberUtils.isCreatable(value.toString()))
|
||||
.map(e -> SalaryEntityUtil.empty2Zero(e.toString()))
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
sumResultMap.put(salaryItem.getId().toString(),sumValue);
|
||||
}
|
||||
BigDecimal totalEmpNum = sumResultByGroup.values().stream()
|
||||
.map(m -> m.get("empNums"))
|
||||
.filter(value -> value != null && NumberUtils.isCreatable(value.toString()))
|
||||
.map(e -> SalaryEntityUtil.empty2Zero(e.toString()))
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
sumResultMap.put("empNums",totalEmpNum);
|
||||
dataList.add(sumResultMap);
|
||||
|
||||
map.put("column", columns);
|
||||
map.put("data", dataList);
|
||||
return map;
|
||||
}
|
||||
|
||||
@Override
|
||||
public XSSFWorkbook exportGyDepartmentSalaryReport(GyReportQueryParam param) {
|
||||
Map<String, Object> resultMap = listGyDepartmentSalaryReport(param);
|
||||
List<Map<String, Object>> resultList = (List<Map<String, Object>>)resultMap.get("data");
|
||||
List<WeaTableColumnGroup> columns = (List<WeaTableColumnGroup>)resultMap.getOrDefault("column", Collections.emptyList());
|
||||
// 1.工作簿名称
|
||||
String sheetName = SalaryI18nUtil.getI18nLabel(0, "工资汇总报表");
|
||||
// 2.表头
|
||||
List<Object> headerList = new ArrayList<>();
|
||||
columns.stream().map(WeaTableColumnGroup::getText).forEach(headerList::add);
|
||||
// 组装数据
|
||||
List<List<Object>> rows = new ArrayList<>();
|
||||
rows.add(headerList);
|
||||
|
||||
// 3.表数据
|
||||
for (Map<String, Object> map : resultList) {
|
||||
List<Object> row = new ArrayList<>();
|
||||
for (WeaTableColumnGroup col : columns) {
|
||||
row.add(map.getOrDefault(col.getColumn(), ""));
|
||||
}
|
||||
rows.add(row);
|
||||
}
|
||||
|
||||
return ExcelUtilPlus.genWorkbookV2(rows, sheetName);
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public Map<String, Object> xhcDepartmentReportSum(XhcDepartmentReportParam param) {
|
||||
// Map<String, Object> resultMap = xhcDepartmentReportList(param);
|
||||
// List<Map<String, Object>> resultList = (List<Map<String, Object>>)resultMap.get("data");
|
||||
// // BaseBean baseBean = new BaseBean();
|
||||
// // String itemNameStr = baseBean.getPropValue("xhcSalaryReport", "salary_item_name");
|
||||
// // 获取薪资项目配置
|
||||
// RecordSet rs = new RecordSet();
|
||||
// rs.execute("select salary_item_name from uf_xcbbpz order by show_order asc");
|
||||
// List<String> salaryItemNameList = new ArrayList<>();
|
||||
// while (rs.next()) {
|
||||
// salaryItemNameList.add(rs.getString("salary_item_name"));
|
||||
// }
|
||||
//
|
||||
// // 获取需要统计的薪资项目
|
||||
// List<SalaryItemPO> salaryItemPOList = getSalaryItemService(user).listAll();
|
||||
// Map<String, SalaryItemPO> salaryItemNameMap = SalaryEntityUtil.convert2Map(salaryItemPOList, SalaryItemPO::getName);
|
||||
// List<SalaryItemPO> salaryItemList = salaryItemNameList.stream()
|
||||
// .filter(StringUtils::isNotBlank)
|
||||
// .map(name -> salaryItemNameMap.get(name))
|
||||
// .filter(ObjectUtil::isNotNull)
|
||||
// .collect(Collectors.toList());
|
||||
//
|
||||
// Map<String, Object> sumResultMap = new HashMap<>();
|
||||
// for (SalaryItemPO salaryItem : salaryItemList) {
|
||||
// BigDecimal sumValue = resultList.stream()
|
||||
// .map(map -> map.get(salaryItem.getId().toString()))
|
||||
// .filter(value -> value != null && NumberUtils.isCreatable(value.toString()))
|
||||
// .map(e -> SalaryEntityUtil.empty2Zero(e.toString()))
|
||||
// .reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
// sumResultMap.put(salaryItem.getId().toString(),sumValue);
|
||||
// }
|
||||
// BigDecimal totalEmpNum = resultList.stream()
|
||||
// .map(map -> map.get("empNums"))
|
||||
// .filter(value -> value != null && NumberUtils.isCreatable(value.toString()))
|
||||
// .map(e -> SalaryEntityUtil.empty2Zero(e.toString()))
|
||||
// .reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
// sumResultMap.put("empNums",totalEmpNum);
|
||||
// Map<String, Object> map = new HashMap<>();
|
||||
// map.put("sumRow", sumResultMap);
|
||||
// return map;
|
||||
// }
|
||||
//
|
||||
private LinkedHashMap<String, Map<String, Object>> getSumResultByGroup4Gw(Map<String, List<Map<String, Object>>> groupBy,
|
||||
List<SalarySobItemPO> salarySobItemPOS,
|
||||
List<SalaryItemPO> numberItems,
|
||||
Long kebItemId,
|
||||
Long ygxzItemId) {
|
||||
LinkedHashMap<String, List<Map<String, Object>>> sortedGroupBy = new LinkedHashMap<>();
|
||||
List<Long> deptIdList = groupBy.keySet().stream().map(key -> {
|
||||
String[] split = key.split("_split");
|
||||
return split != null && split.length > 1 && NumberUtils.isCreatable(split[1])? Long.valueOf(split[1]) : 0L;
|
||||
}).distinct().collect(Collectors.toList());
|
||||
List<DeptInfo> deptInfoList = getSalaryEmployeeService(user).getDeptInfoList(deptIdList);
|
||||
Map<Long, Double> deptOrderMap = SalaryEntityUtil.convert2Map(deptInfoList, DeptInfo::getId, DeptInfo::getShoworder);
|
||||
Map<Long, String> deptNameMap = SalaryEntityUtil.convert2Map(deptInfoList, DeptInfo::getId, DeptInfo::getName);
|
||||
groupBy.entrySet().stream()
|
||||
.sorted((k1,k2) -> {
|
||||
String[] split1 = k1.getKey().split("_split");
|
||||
Long dept1 = split1 != null && split1.length > 1 && NumberUtils.isCreatable(split1[1])? Long.valueOf(split1[1]) : 0L;
|
||||
Double order1 = deptOrderMap.get(dept1) == null ? new Double(0) : deptOrderMap.get(dept1);
|
||||
String[] split2 = k2.getKey().split("_split");
|
||||
Long dept2 = split2 != null && split2.length > 1 && NumberUtils.isCreatable(split2[1]) ? Long.valueOf(split2[1]) : 0L;
|
||||
Double order2 = deptOrderMap.get(dept2) == null ? new Double(0) : deptOrderMap.get(dept2);
|
||||
return order1.compareTo(order2);
|
||||
})
|
||||
.forEachOrdered(x -> sortedGroupBy.put(x.getKey(), x.getValue()));
|
||||
LinkedHashMap<String, Map<String, Object>> result = new LinkedHashMap<>();
|
||||
// 本次薪资核算所用的薪资账套下的薪资项目
|
||||
Map<Long, SalarySobItemPO> salaryItemIdKeySalarySobItemPOMap = SalaryEntityUtil.convert2Map(salarySobItemPOS, SalarySobItemPO::getSalaryItemId);
|
||||
for(Map.Entry<String, List<Map<String, Object>>> entrySet : sortedGroupBy.entrySet()){
|
||||
// 每个分类中的核算数据
|
||||
List<Map<String, Object>> value = entrySet.getValue();
|
||||
String[] split = entrySet.getKey().split("_split");
|
||||
String bmbm = split != null && split.length > 1 ? split[1] : "";
|
||||
|
||||
Map<String, Object> itemSum = new HashMap<>();
|
||||
numberItems.forEach(item -> {
|
||||
List<String> itemValue = value.stream().filter(v -> v.get(item.getId().toString()) != null).map(v -> (String)v.get(item.getId().toString())).collect(Collectors.toList());
|
||||
BigDecimal sum = itemValue
|
||||
.stream()
|
||||
.filter(NumberUtils::isCreatable)
|
||||
.map(BigDecimal::new)
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
itemSum.put( item.getId().toString(), SalaryAcctFormulaBO.roundResultValue(sum.toString(), item, Collections.emptyList(), Collections.emptyMap(), salaryItemIdKeySalarySobItemPOMap) );
|
||||
});
|
||||
itemSum.put("empNums", entrySet.getValue().size());
|
||||
itemSum.put("kebie", (CollectionUtils.isEmpty(value) || !NumberUtils.isCreatable(Utils.null2String(value.get(0).get(kebItemId.toString())))) ? "" : deptNameMap.getOrDefault(Long.valueOf(Utils.null2String(value.get(0).get(kebItemId.toString()))), ""));
|
||||
itemSum.put("kebieId", CollectionUtils.isEmpty(value) ? "" : Utils.null2String(value.get(0).get(kebItemId.toString())));
|
||||
|
||||
result.put(entrySet.getKey(), itemSum);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -343,6 +343,11 @@ public class SalaryEmployeeServiceImpl extends Service implements SalaryEmployee
|
|||
return SalaryI18nUtil.i18nList(employBiz.getDeptInfoList(departmentIds));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DeptInfo> listAllDeptInfo() {
|
||||
return SalaryI18nUtil.i18nList(employBiz.listAllDeptInfo());
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeptInfo getDeptInfoById(Long departmentId) {
|
||||
if (departmentId == null) {
|
||||
|
|
|
|||
|
|
@ -928,4 +928,88 @@ public class SalaryAcctController {
|
|||
}
|
||||
|
||||
/**********************************线下对比 end*********************************/
|
||||
/**********************************光阳摩托报表 start*********************************/
|
||||
// 实发工资报表列表
|
||||
@POST
|
||||
@Path("/acctresult/gysfgzReport/list")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String listGysfgzReport(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody GyReportQueryParam param) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return new ResponseResult<GyReportQueryParam, Map<String, Object>>(user).run(getSalaryAcctResultWrapper(user)::listGysfgzReport, param);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出实发工资报表列表
|
||||
*/
|
||||
@POST
|
||||
@Path("/acctresult/gysfgzReport/export")
|
||||
@Produces(MediaType.APPLICATION_OCTET_STREAM)
|
||||
public Response exportGysfgzReport(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody GyReportQueryParam param) {
|
||||
try {
|
||||
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
XSSFWorkbook workbook = getSalaryAcctResultWrapper(user).exportGysfgzReport(param);
|
||||
String time = LocalDate.now().toString();
|
||||
String fileName = SalaryDateUtil.getFormatYearMonth(param.getSalaryMonth()) + "实发工资报表" + 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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 工资汇总表列表
|
||||
@POST
|
||||
@Path("/acctresult/gyDepartmentSalaryReport/list")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String listGyDepartmentSalaryReport(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody GyReportQueryParam param) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return new ResponseResult<GyReportQueryParam, Map<String, Object>>(user).run(getSalaryAcctResultWrapper(user)::listGyDepartmentSalaryReport, param);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出工资汇总报表
|
||||
*/
|
||||
@POST
|
||||
@Path("/acctresult/gyDepartmentSalaryReport/export")
|
||||
@Produces(MediaType.APPLICATION_OCTET_STREAM)
|
||||
public Response exportGyDepartmentSalaryReport(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody GyReportQueryParam param) {
|
||||
try {
|
||||
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
XSSFWorkbook workbook = getSalaryAcctResultWrapper(user).exportGyDepartmentSalaryReport(param);
|
||||
String time = LocalDate.now().toString();
|
||||
String fileName = SalaryDateUtil.getFormatYearMonth(param.getSalaryMonth()) + "工资汇总报表" + 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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**********************************光阳摩托报表 end*********************************/
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ import com.engine.salary.wrapper.proxy.SalaryAcctResultWrapperProxy;
|
|||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang.math.NumberUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
|
@ -278,6 +279,34 @@ public class SalaryAcctResultWrapper extends Service implements SalaryAcctResult
|
|||
getSalaryAcctResultService(user).batchUpdate(param);
|
||||
}
|
||||
|
||||
/**
|
||||
* 实发工资报表列表
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
|
||||
public Map<String, Object> listGysfgzReport(GyReportQueryParam param) {
|
||||
return getSalaryAcctResultService(user).listGysfgzReport(param);
|
||||
}
|
||||
|
||||
public XSSFWorkbook exportGysfgzReport(GyReportQueryParam param) {
|
||||
return getSalaryAcctResultService(user).exportGysfgzReport(param);
|
||||
}
|
||||
|
||||
/**
|
||||
* 部门工资报表列表
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
|
||||
public Map<String, Object> listGyDepartmentSalaryReport(GyReportQueryParam param) {
|
||||
return getSalaryAcctResultService(user).listGyDepartmentSalaryReport(param);
|
||||
}
|
||||
|
||||
public XSSFWorkbook exportGyDepartmentSalaryReport(GyReportQueryParam param) {
|
||||
return getSalaryAcctResultService(user).exportGyDepartmentSalaryReport(param);
|
||||
}
|
||||
|
||||
/**
|
||||
* 薪资核算-校验
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in New Issue