汇通 薪酬二开

This commit is contained in:
Harryxzy 2024-10-30 10:29:36 +08:00
parent 8bf0ca48a5
commit 93b95ce820
19 changed files with 897 additions and 43 deletions

View File

@ -120,6 +120,9 @@ public class DataCollectionEmployee {
//是否外部人员
private boolean extEmp;
// 安全级别
private Integer seclevel;
/**
* 扩展数据
*/

View File

@ -0,0 +1,46 @@
package com.engine.salary.entity.salaryacct.dto;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @author Harryxzy
* @ClassName HtSbqsListDTO
* @date 2024/10/29 15:45
* @description 汇通社保请示流程
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class HtSbqsListDTO {
// 保险类型id
private Long insuranceId;
// 保险类型名称
private String bxlx;
// 上期缴纳人数
private Integer sqjnrs;
// 增加人数
private Integer zjrs;
// 减少人数
private Integer jsrs;
// 本期人数
private Integer bqrs;
// 个人缴纳金额
private Double grjnje;
// 单位缴纳金额
private Double dwjnje;
// 缴纳总额
private Double jnze;
}

View File

@ -1,12 +1,14 @@
package com.engine.salary.entity.salaryacct.param;
import com.engine.salary.common.BaseQueryParam;
import com.engine.salary.entity.salaryacct.dto.HtXcssItemDTO;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
import java.util.List;
/**
* @ClassName HtjsApprovalParam
@ -29,5 +31,9 @@ public class HtjsApprovalParam extends BaseQueryParam {
// 单位id
Long subcompanyId;
Long schemeId;
List<HtXcssItemDTO> htXcssItemDTOList;
}

View File

@ -78,7 +78,8 @@
e.certificatenum as idNo,
e.enddate as dismissdate,
e.workyear,
e.companyworkyear
e.companyworkyear,
e.SECLEVEL
from hrmresource e
left join hrmdepartment d on e.departmentid = d.id
left join hrmjobtitles c on e.jobtitle = c.id

View File

@ -89,6 +89,8 @@ public interface InsuranceAccountDetailMapper {
List<InsuranceAccountDetailPO> queryList(@Param("billMonth") String billMonth, @Param("paymentOrganization") Long paymentOrganization, @Param("employeeIds") Collection<Long> employeeIds);
List<InsuranceAccountDetailPO> queryList4Ht(@Param("billMonth") String billMonth, @Param("paymentOrganization") Long paymentOrganization, @Param("socialSchemeId") Long socialSchemeId, @Param("fundSchemeId") Long fundSchemeId, @Param("otherSchemeId") Long otherSchemeId);
/**
* 查询正常缴纳数据
* @param billMonth 账单月份

View File

@ -1475,4 +1475,29 @@
AND t.payment_organization = #{paymentOrganization}
AND t.employee_id = #{employeeId}
</select>
<select id="queryList4Ht" resultMap="BaseResultMap">
SELECT
t.id,t.employee_id,t.social_per_json,t.social_com_json,
t.fund_per_json,t.fund_com_json,t.other_per_json,
t.other_com_json,t.social_per_sum,t.social_com_sum,
t.fund_per_sum,t.fund_com_sum,t.other_per_sum,
t.other_com_sum,t.per_sum,t.com_sum,t.payment_status,
t.social_payment_base_string,t.fund_payment_base_string,t.other_payment_base_string
FROM
hrsa_bill_detail t
WHERE t.delete_type = 0
-- AND t.payment_status = 0
AND t.bill_month = #{billMonth}
AND t.payment_organization = #{paymentOrganization}
<if test="socialSchemeId != null">
AND social_scheme_id = #{socialSchemeId}
</if>
<if test="fundSchemeId != null">
AND fund_scheme_id = #{fundSchemeId}
</if>
<if test="otherSchemeId != null">
AND otherSchemeId = #{otherSchemeId}
</if>
</select>
</mapper>

View File

@ -1,5 +1,6 @@
package com.engine.salary.service;
import com.engine.salary.entity.salaryacct.dto.HtSbqsListDTO;
import com.engine.salary.entity.siaccount.dto.InsuranceAccountTabDTO;
import com.engine.salary.entity.siaccount.dto.InsuranceAccountViewListDTO;
import com.engine.salary.entity.siaccount.param.*;
@ -209,6 +210,8 @@ public interface SIAccountService {
*/
List<Map<String, Object>> welfareData(String billMonth, List<Long> employeeIds,Long taxAgentId);
List<HtSbqsListDTO> welfareData4Htjs(String billMonth, Long socialSchemeId, Long fundSchemeId, Long otherSchemeId);
/**
* 给套账提供字段名对应字段释义
*

View File

@ -4,11 +4,13 @@ import com.cloudstore.eccom.pc.table.WeaTableColumn;
import com.engine.salary.entity.siarchives.param.InsuranceArchivesListParam;
import com.engine.salary.entity.siarchives.param.SIArchiveImportParam;
import com.engine.salary.entity.siarchives.po.InsuranceArchivesEmployeePO;
import com.engine.salary.entity.sischeme.dto.InsuranceSchemeDetailDTO;
import com.engine.salary.entity.sischeme.dto.InsuranceSchemeListDTO;
import com.engine.salary.entity.sischeme.param.InsuranceSchemeDetailUpdateParam;
import com.engine.salary.entity.sischeme.param.InsuranceSchemeParam;
import com.engine.salary.entity.sischeme.po.InsuranceSchemeDetailPO;
import com.engine.salary.entity.sischeme.po.InsuranceSchemePO;
import com.engine.salary.enums.sicategory.WelfareTypeEnum;
import com.engine.salary.util.page.PageInfo;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
@ -82,5 +84,7 @@ public interface SISchemeService {
*/
List<String> updateSchemeDetail(List<InsuranceSchemeDetailUpdateParam> schemeDetailList);
List<InsuranceSchemeDetailDTO> getSchemeDetailFormDTO(WelfareTypeEnum welfareTypeEnum, Long id);
List<InsuranceSchemePO> listAll();
}

View File

@ -60,7 +60,7 @@ public interface SalaryAcctEmployeeService {
* @param salaryAcctRecordIds 薪资核算记录id
* @return
*/
List<SalaryAcctEmployeePO> listBySalaryAcctRecordIds(Collection<Long> salaryAcctRecordIds);
List<SalaryAcctEmployeePO> listBySalaryAcctRecordIds(List<Long> salaryAcctRecordIds);
/**
* 根据薪资核算记录id个税扣缴义务人id查询薪资核算人员

View File

@ -2,6 +2,7 @@ package com.engine.salary.service;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.entity.salaryacct.dto.ConsolidatedTaxDetailDTO;
import com.engine.salary.entity.salaryacct.dto.HtSbqsListDTO;
import com.engine.salary.entity.salaryacct.dto.SalaryAcctResultDetailDTO;
import com.engine.salary.entity.salaryacct.dto.SalaryAcctResultListColumnDTO;
import com.engine.salary.entity.salaryacct.param.*;
@ -221,4 +222,8 @@ public interface SalaryAcctResultService {
Map<String, Object> htjsXcssList(HtjsApprovalParam param);
Map<String, Object> htjsXcssDataDetail(HtjsApprovalParam param);
Map<String, Object> htjsXczfsqList(HtjsApprovalParam param);
List<HtSbqsListDTO> htjsSbqsList(HtjsApprovalParam param);
}

View File

@ -1271,7 +1271,7 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction
boolean isAccounted = e.getStatus() > SalaryAcctRecordStatusEnum.NOT_ARCHIVED.getValue();
if (isAccounted) {
// list.addAll(getSalaryAcctEmployeeService(user).listBySalaryAcctRecordIds(Collections.singleton(salaryAcctRecords.get(0).getId())));
list.addAll(getSalaryAcctEmployeeService(user).listBySalaryAcctRecordIds(Collections.singleton(e.getId())));
list.addAll(getSalaryAcctEmployeeService(user).listBySalaryAcctRecordIds(Collections.singletonList(e.getId())));
}
});
@ -1292,7 +1292,7 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction
boolean isAccounted = e.getStatus() > SalaryAcctRecordStatusEnum.NOT_ARCHIVED.getValue();
if (isAccounted) {
// list.addAll(getSalaryAcctEmployeeService(user).listBySalaryAcctRecordIds(Collections.singleton(salaryAcctRecords.get(0).getId())));
list.addAll(getSalaryAcctEmployeeService(user).listBySalaryAcctRecordIds(Collections.singleton(e.getId())));
list.addAll(getSalaryAcctEmployeeService(user).listBySalaryAcctRecordIds(Collections.singletonList(e.getId())));
}
});

View File

@ -22,6 +22,7 @@ import com.engine.salary.constant.SalaryItemConstant;
import com.engine.salary.encrypt.EncryptUtil;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.entity.progress.ProgressDTO;
import com.engine.salary.entity.salaryacct.dto.HtSbqsListDTO;
import com.engine.salary.entity.siaccount.bo.InsuranceAccountBO;
import com.engine.salary.entity.siaccount.dto.*;
import com.engine.salary.entity.siaccount.param.*;
@ -30,6 +31,7 @@ import com.engine.salary.entity.siarchives.po.*;
import com.engine.salary.entity.sicategory.po.ICategoryPO;
import com.engine.salary.entity.siexport.param.InsuranceExportParam;
import com.engine.salary.entity.siexport.po.AccountExportPO;
import com.engine.salary.entity.sischeme.dto.InsuranceSchemeDetailDTO;
import com.engine.salary.entity.sischeme.po.InsuranceSchemeDetailPO;
import com.engine.salary.entity.sischeme.po.InsuranceSchemePO;
import com.engine.salary.entity.taxagent.po.TaxAgentPO;
@ -88,6 +90,7 @@ import weaver.hrm.User;
import java.io.InputStream;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.util.*;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
@ -241,6 +244,10 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
return MapperProxyFactory.getProxy(EmployMapper.class);
}
private SISchemeService getSiSchemeService() {
return ServiceUtil.getService(SISchemeServiceImpl.class, user);
}
@Override
public Map<String, Object> listPage(InsuranceAccountBatchParam queryParam) {
Long employeeId = (long) user.getUID();
@ -1213,6 +1220,104 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
return result;
}
/**
* 汇通建设 二开
* @param billMonth
* @return
*/
@Override
public List<HtSbqsListDTO> welfareData4Htjs(String billMonth, Long socialSchemeId, Long fundSchemeId, Long otherSchemeId) {
// 获取所有个税扣缴义务人
List<TaxAgentPO> taxAgentList = getTaxAgentService(user).listAll();
List<InsuranceAccountDetailPO> insuranceAccountDetailPOS = new ArrayList<>();
for (TaxAgentPO taxAgent : taxAgentList) {
InsuranceAccountBatchPO insuranceAccountBatchPO = getInsuranceAccountBatchMapper().getByBillMonth(billMonth, taxAgent.getId());
insuranceAccountBatchPO = encryptUtil.decrypt(insuranceAccountBatchPO, InsuranceAccountBatchPO.class);
if (insuranceAccountBatchPO == null || Objects.equals(BillStatusEnum.NOT_ARCHIVED.getValue(), insuranceAccountBatchPO.getBillStatus())) {
continue;
}
insuranceAccountDetailPOS.addAll(getInsuranceAccountDetailMapper().queryList4Ht(billMonth, taxAgent.getId(), socialSchemeId, fundSchemeId, otherSchemeId));
}
//退差数据不参与薪资核算
insuranceAccountDetailPOS = insuranceAccountDetailPOS.stream()
.filter(f -> f.getPaymentStatus().equals(PaymentStatusEnum.COMMON.getValue())
|| f.getPaymentStatus().equals(PaymentStatusEnum.REPAIR.getValue())
|| f.getPaymentStatus().equals(PaymentStatusEnum.BALANCE.getValue()) )
.collect(Collectors.toList());
Map<String, Object> resultMap = buildInsuranceApproInfo4Ht(insuranceAccountDetailPOS);
Map<String,Object> perValueMap = (Map<String,Object>)resultMap.getOrDefault("perValueMap", Collections.emptyMap());
Map<String,Object> comValueMap = (Map<String,Object>)resultMap.getOrDefault("comValueMap", Collections.emptyMap());
Map<String,List<Long>> empMap = (Map<String,List<Long>>)resultMap.getOrDefault("empMap", Collections.emptyMap());
// 获取上期社保数据
List<InsuranceAccountDetailPO> lastInsuranceAccountDetailPOS = new ArrayList<>();
for (TaxAgentPO taxAgent : taxAgentList) {
LocalDate localDate = SalaryDateUtil.dateToLocalDate(SalaryDateUtil.dateStrToLocalYearMonth(billMonth));
String lastMonth = SalaryDateUtil.getFormatYearMonth(localDate.minusMonths(1));
InsuranceAccountBatchPO insuranceAccountBatchPO = getInsuranceAccountBatchMapper().getByBillMonth(lastMonth, taxAgent.getId());
insuranceAccountBatchPO = encryptUtil.decrypt(insuranceAccountBatchPO, InsuranceAccountBatchPO.class);
if (insuranceAccountBatchPO == null || Objects.equals(BillStatusEnum.NOT_ARCHIVED.getValue(), insuranceAccountBatchPO.getBillStatus())) {
continue;
}
lastInsuranceAccountDetailPOS.addAll(getInsuranceAccountDetailMapper().queryList4Ht(lastMonth, taxAgent.getId(), socialSchemeId, fundSchemeId, otherSchemeId));
}
//退差数据不参与薪资核算
lastInsuranceAccountDetailPOS = lastInsuranceAccountDetailPOS.stream()
.filter(f -> f.getPaymentStatus().equals(PaymentStatusEnum.COMMON.getValue())
|| f.getPaymentStatus().equals(PaymentStatusEnum.REPAIR.getValue())
|| f.getPaymentStatus().equals(PaymentStatusEnum.BALANCE.getValue()) )
.collect(Collectors.toList());
Map<String, Object> lastResultMap = buildInsuranceApproInfo4Ht(lastInsuranceAccountDetailPOS);
Map<String,List<Long>> lastEmpMap = (Map<String,List<Long>>)lastResultMap.getOrDefault("empMap", Collections.emptyMap());
// 查询社保方案信息
List<InsuranceSchemeDetailDTO> insuranceSchemeDetailDTOList = Collections.emptyList();
if (socialSchemeId != null) {
insuranceSchemeDetailDTOList = getSiSchemeService().getSchemeDetailFormDTO(WelfareTypeEnum.SOCIAL_SECURITY, socialSchemeId);
} else if (fundSchemeId != null) {
insuranceSchemeDetailDTOList = getSiSchemeService().getSchemeDetailFormDTO(WelfareTypeEnum.ACCUMULATION_FUND, fundSchemeId);
} else if (otherSchemeId != null) {
insuranceSchemeDetailDTOList = getSiSchemeService().getSchemeDetailFormDTO(WelfareTypeEnum.OTHER, otherSchemeId);
}
// 获取所有开启缴纳的福利项
insuranceSchemeDetailDTOList = insuranceSchemeDetailDTOList.stream()
.filter(dto -> dto.getIsPayment() == null || dto.getIsPayment() == true)
.collect(Collectors.toMap(InsuranceSchemeDetailDTO::getInsuranceId, Function.identity(), (a, b) -> a))
.values()
.stream().collect(Collectors.toList());
List<HtSbqsListDTO> htSbqsListDTOS = new ArrayList<HtSbqsListDTO>();
for (InsuranceSchemeDetailDTO dto : insuranceSchemeDetailDTOList) {
List<Long> empList = empMap.getOrDefault(dto.getInsuranceId().toString(), Collections.emptyList());
empList = empList.stream().distinct().collect(Collectors.toList());
Object perPaymentObj = perValueMap.get(dto.getInsuranceId().toString());
BigDecimal perPayment = perPaymentObj != null && NumberUtils.isNumber(perPaymentObj.toString()) ? new BigDecimal(perPaymentObj.toString()) : BigDecimal.ZERO;
Object comPaymentObj = comValueMap.get(dto.getInsuranceId().toString());
BigDecimal comPayment = comPaymentObj != null && NumberUtils.isNumber(comPaymentObj.toString()) ? new BigDecimal(comPaymentObj.toString()) : BigDecimal.ZERO;
// 获取上期人数
List<Long> lastEmpList = lastEmpMap.getOrDefault(dto.getInsuranceId().toString(), Collections.emptyList());
lastEmpList = lastEmpList.stream().distinct().collect(Collectors.toList());
HtSbqsListDTO build = HtSbqsListDTO.builder()
.insuranceId(dto.getInsuranceId())
.bxlx(dto.getInsuranceName())
.sqjnrs(lastEmpList.size())
.zjrs(lastEmpList.size() < empList.size() ? empList.size() - lastEmpList.size() : 0)
.jsrs(lastEmpList.size() > empList.size() ? lastEmpList.size() - empList.size() : 0)
.bqrs(empList.size())
.grjnje(perPayment.doubleValue())
.dwjnje(comPayment.doubleValue())
.jnze(perPayment.add(comPayment).doubleValue())
.build();
htSbqsListDTOS.add(build);
}
return htSbqsListDTOS;
}
@Override
public Map<String, String> welfareColumns() {
List<ICategoryPO> listAll = getICategoryMapper().listAll().stream().filter(f -> f.getIsUse().equals(IsUseEnum.START.getValue())).collect(Collectors.toList());
@ -1532,6 +1637,279 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
}
public Map<String, Object> buildInsuranceApproInfo4Ht(List<InsuranceAccountDetailPO> list) {
// List<InsuranceAccountDetailPO> newList = new ArrayList<>();
if (CollectionUtils.isEmpty(list)) {
return Collections.emptyMap();
}
Map<Long, List<InsuranceAccountDetailPO>> employeeMap = list.stream().filter(item -> item.getEmployeeId() != null)
.collect(Collectors.groupingBy(InsuranceAccountDetailPO::getEmployeeId));
Map<String, String> perSumValueMap = new HashMap<>();
Map<String, String> comSumValueMap = new HashMap<>();
Map<String, List<Long>> payedEmpMap = new HashMap<>();
for (Map.Entry<Long, List<InsuranceAccountDetailPO>> entry : employeeMap.entrySet()) {
Long k = entry.getKey();
List<InsuranceAccountDetailPO> v = entry.getValue();
InsuranceAccountDetailPO insuranceAccountDetailPO = new InsuranceAccountDetailPO();
insuranceAccountDetailPO.setEmployeeId(k);
// 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<>();
// BigDecimal socialPer = new BigDecimal("0");
// BigDecimal socialCom = new BigDecimal("0");
// BigDecimal fundPer = new BigDecimal("0");
// BigDecimal fundCom = new BigDecimal("0");
// BigDecimal otherPer = new BigDecimal("0");
// BigDecimal otherCom = new BigDecimal("0");
// BigDecimal perSum = new BigDecimal("0");
// BigDecimal comSum = new BigDecimal("0");
for (InsuranceAccountDetailPO item : v) {
encryptUtil.decrypt(item, InsuranceAccountDetailPO.class);
insuranceAccountDetailPO.setId(item.getId());
insuranceAccountDetailPO.setSocialPaymentBaseString(item.getSocialPaymentBaseString());
insuranceAccountDetailPO.setFundPaymentBaseString(item.getFundPaymentBaseString());
insuranceAccountDetailPO.setOtherPaymentBaseString(item.getOtherPaymentBaseString());
// BigDecimal socialPerSum = StringUtils.isBlank(item.getSocialPerSum()) ? new BigDecimal("0") : new BigDecimal(item.getSocialPerSum());
// BigDecimal socialComSum = StringUtils.isBlank(item.getSocialComSum()) ? new BigDecimal("0") : new BigDecimal(item.getSocialComSum());
// BigDecimal fundPerSum = StringUtils.isBlank(item.getFundPerSum()) ? new BigDecimal("0") : new BigDecimal(item.getFundPerSum());
// BigDecimal fundComSum = StringUtils.isBlank(item.getFundComSum()) ? new BigDecimal("0") : new BigDecimal(item.getFundComSum());
// BigDecimal otherPerSum = StringUtils.isBlank(item.getOtherPerSum()) ? new BigDecimal("0") : new BigDecimal(item.getOtherPerSum());
// BigDecimal otherComSum = StringUtils.isBlank(item.getOtherComSum()) ? new BigDecimal("0") : new BigDecimal(item.getOtherComSum());
// BigDecimal perSumItem = StringUtils.isBlank(item.getPerSum()) ? new BigDecimal("0") : new BigDecimal(item.getPerSum());
// BigDecimal comSumItem = StringUtils.isBlank(item.getComSum()) ? new BigDecimal("0") : new BigDecimal(item.getComSum());
// socialPer = socialPer.add(socialPerSum);
// socialCom = socialCom.add(socialComSum);
// fundPer = fundPer.add(fundPerSum);
// fundCom = fundCom.add(fundComSum);
// otherPer = otherPer.add(otherPerSum);
// otherCom = otherCom.add(otherComSum);
// perSum = perSum.add(perSumItem);
// comSum = comSum.add(comSumItem);
if (StringUtils.isNotBlank(item.getSocialPerJson())) {
Map<String, String> socialJson = JSON.parseObject(item.getSocialPerJson(), new HashMap<String, String>().getClass());
if (socialJson != null) {
socialJson.forEach((insuranceId, num) -> {
// if (socialPerMap.get(insuranceId) == null) {
// socialPerMap.put(insuranceId, num);
// } else {
// String oldNum = socialPerMap.get(insuranceId);
// BigDecimal insuanceNum = new BigDecimal("0");
// BigDecimal oldDecimal = new BigDecimal(oldNum);
// BigDecimal numDecimal = num == null ? new BigDecimal("0") : new BigDecimal(num);
// insuanceNum = insuanceNum.add(numDecimal).add(oldDecimal);
// socialPerMap.put(insuranceId, insuanceNum.toPlainString());
// }
if (perSumValueMap.get(insuranceId) == null) {
perSumValueMap.put(insuranceId, num);
} else {
String oldNum = perSumValueMap.get(insuranceId);
BigDecimal insuanceNum = new BigDecimal("0");
BigDecimal oldDecimal = new BigDecimal(oldNum);
BigDecimal numDecimal = num == null ? new BigDecimal("0") : new BigDecimal(num);
insuanceNum = insuanceNum.add(numDecimal).add(oldDecimal);
perSumValueMap.put(insuranceId, insuanceNum.toPlainString());
}
if (StringUtils.isNotBlank(num) && NumberUtils.isNumber(num) && new BigDecimal(num).compareTo(BigDecimal.ZERO) != 0) {
List<Long> empList = payedEmpMap.computeIfAbsent(insuranceId, i -> new ArrayList<Long>());
empList.add(item.getEmployeeId());
}
});
}
}
if (StringUtils.isNotBlank(item.getSocialComJson())) {
Map<String, String> socialJson = JSON.parseObject(item.getSocialComJson(), new HashMap<String, String>().getClass());
if (socialJson != null) {
socialJson.forEach((insuranceId, num) -> {
// if (socialComMap.get(insuranceId) == null) {
// socialComMap.put(insuranceId, num);
// } else {
// String oldNum = socialComMap.get(insuranceId);
// BigDecimal insuanceNum = new BigDecimal("0");
// BigDecimal oldDecimal = new BigDecimal(oldNum);
// BigDecimal numDecimal = num == null ? new BigDecimal("0") : new BigDecimal(num);
// insuanceNum = insuanceNum.add(numDecimal).add(oldDecimal);
// socialComMap.put(insuranceId, insuanceNum.toPlainString());
// }
if (comSumValueMap.get(insuranceId) == null) {
comSumValueMap.put(insuranceId, num);
} else {
String oldNum = comSumValueMap.get(insuranceId);
BigDecimal insuanceNum = new BigDecimal("0");
BigDecimal oldDecimal = new BigDecimal(oldNum);
BigDecimal numDecimal = num == null ? new BigDecimal("0") : new BigDecimal(num);
insuanceNum = insuanceNum.add(numDecimal).add(oldDecimal);
comSumValueMap.put(insuranceId, insuanceNum.toPlainString());
}
if (StringUtils.isNotBlank(num) && NumberUtils.isNumber(num) && new BigDecimal(num).compareTo(BigDecimal.ZERO) != 0) {
List<Long> empList = payedEmpMap.computeIfAbsent(insuranceId, i -> new ArrayList<Long>());
empList.add(item.getEmployeeId());
}
});
}
}
if (StringUtils.isNotBlank(item.getFundPerJson())) {
Map<String, String> fundJson = JSON.parseObject(item.getFundPerJson(), new HashMap<String, String>().getClass());
if (fundJson != null) {
fundJson.forEach((insuranceId, num) -> {
// if (fundPerMap.get(insuranceId) == null) {
// fundPerMap.put(insuranceId, num);
// } else {
// String oldNum = fundPerMap.get(insuranceId);
// BigDecimal insuanceNum = new BigDecimal("0");
// BigDecimal oldDecimal = new BigDecimal(oldNum);
// BigDecimal numDecimal = num == null ? new BigDecimal("0") : new BigDecimal(num);
// insuanceNum = insuanceNum.add(numDecimal).add(oldDecimal);
// fundPerMap.put(insuranceId, insuanceNum.toPlainString());
// }
if (perSumValueMap.get(insuranceId) == null) {
perSumValueMap.put(insuranceId, num);
} else {
String oldNum = perSumValueMap.get(insuranceId);
BigDecimal insuanceNum = new BigDecimal("0");
BigDecimal oldDecimal = new BigDecimal(oldNum);
BigDecimal numDecimal = num == null ? new BigDecimal("0") : new BigDecimal(num);
insuanceNum = insuanceNum.add(numDecimal).add(oldDecimal);
perSumValueMap.put(insuranceId, insuanceNum.toPlainString());
}
if (StringUtils.isNotBlank(num) && NumberUtils.isNumber(num) && new BigDecimal(num).compareTo(BigDecimal.ZERO) != 0) {
List<Long> empList = payedEmpMap.computeIfAbsent(insuranceId, i -> new ArrayList<Long>());
empList.add(item.getEmployeeId());
}
});
}
}
if (StringUtils.isNotBlank(item.getFundComJson())) {
Map<String, String> fundJson = JSON.parseObject(item.getFundComJson(), new HashMap<String, String>().getClass());
if (fundJson != null) {
fundJson.forEach((insuranceId, num) -> {
// if (fundComMap.get(insuranceId) == null) {
// fundComMap.put(insuranceId, num);
// } else {
// String oldNum = fundComMap.get(insuranceId);
// BigDecimal insuanceNum = new BigDecimal("0");
// BigDecimal oldDecimal = new BigDecimal(oldNum);
// BigDecimal numDecimal = num == null ? new BigDecimal("0") : new BigDecimal(num);
// insuanceNum = insuanceNum.add(numDecimal).add(oldDecimal);
// fundComMap.put(insuranceId, insuanceNum.toPlainString());
// }
if (comSumValueMap.get(insuranceId) == null) {
comSumValueMap.put(insuranceId, num);
} else {
String oldNum = comSumValueMap.get(insuranceId);
BigDecimal insuanceNum = new BigDecimal("0");
BigDecimal oldDecimal = new BigDecimal(oldNum);
BigDecimal numDecimal = num == null ? new BigDecimal("0") : new BigDecimal(num);
insuanceNum = insuanceNum.add(numDecimal).add(oldDecimal);
comSumValueMap.put(insuranceId, insuanceNum.toPlainString());
}
if (StringUtils.isNotBlank(num) && NumberUtils.isNumber(num) && new BigDecimal(num).compareTo(BigDecimal.ZERO) != 0) {
List<Long> empList = payedEmpMap.computeIfAbsent(insuranceId, i -> new ArrayList<Long>());
empList.add(item.getEmployeeId());
}
});
}
}
if (StringUtils.isNotBlank(item.getOtherPerJson())) {
Map<String, String> otherJson = JSON.parseObject(item.getOtherPerJson(), new HashMap<String, String>().getClass());
if (otherJson != null) {
otherJson.forEach((insuranceId, num) -> {
// if (otherPerMap.get(insuranceId) == null) {
// otherPerMap.put(insuranceId, num);
// } else {
// String oldNum = otherPerMap.get(insuranceId);
// BigDecimal insuanceNum = new BigDecimal("0");
// BigDecimal oldDecimal = new BigDecimal(oldNum);
// BigDecimal numDecimal = num == null ? new BigDecimal("0") : new BigDecimal(num);
// insuanceNum = insuanceNum.add(numDecimal).add(oldDecimal);
// otherPerMap.put(insuranceId, insuanceNum.toPlainString());
// }
if (perSumValueMap.get(insuranceId) == null) {
perSumValueMap.put(insuranceId, num);
} else {
String oldNum = perSumValueMap.get(insuranceId);
BigDecimal insuanceNum = new BigDecimal("0");
BigDecimal oldDecimal = new BigDecimal(oldNum);
BigDecimal numDecimal = num == null ? new BigDecimal("0") : new BigDecimal(num);
insuanceNum = insuanceNum.add(numDecimal).add(oldDecimal);
perSumValueMap.put(insuranceId, insuanceNum.toPlainString());
}
if (StringUtils.isNotBlank(num) && NumberUtils.isNumber(num) && new BigDecimal(num).compareTo(BigDecimal.ZERO) != 0) {
List<Long> empList = payedEmpMap.computeIfAbsent(insuranceId, i -> new ArrayList<Long>());
empList.add(item.getEmployeeId());
}
});
}
}
if (StringUtils.isNotBlank(item.getOtherComJson())) {
Map<String, String> otherJson = JSON.parseObject(item.getOtherComJson(), new HashMap<String, String>().getClass());
if (otherJson != null) {
otherJson.forEach((insuranceId, num) -> {
// if (otherComMap.get(insuranceId) == null) {
// otherComMap.put(insuranceId, num);
// } else {
// String oldNum = otherComMap.get(insuranceId);
// BigDecimal insuanceNum = new BigDecimal("0");
// BigDecimal oldDecimal = new BigDecimal(oldNum);
// BigDecimal numDecimal = num == null ? new BigDecimal("0") : new BigDecimal(num);
// insuanceNum = insuanceNum.add(numDecimal).add(oldDecimal);
// otherComMap.put(insuranceId, insuanceNum.toPlainString());
// }
if (comSumValueMap.get(insuranceId) == null) {
comSumValueMap.put(insuranceId, num);
} else {
String oldNum = comSumValueMap.get(insuranceId);
BigDecimal insuanceNum = new BigDecimal("0");
BigDecimal oldDecimal = new BigDecimal(oldNum);
BigDecimal numDecimal = num == null ? new BigDecimal("0") : new BigDecimal(num);
insuanceNum = insuanceNum.add(numDecimal).add(oldDecimal);
comSumValueMap.put(insuranceId, insuanceNum.toPlainString());
}
if (StringUtils.isNotBlank(num) && NumberUtils.isNumber(num) && new BigDecimal(num).compareTo(BigDecimal.ZERO) != 0) {
List<Long> empList = payedEmpMap.computeIfAbsent(insuranceId, i -> new ArrayList<Long>());
empList.add(item.getEmployeeId());
}
});
}
}
}
// insuranceAccountDetailPO.setSocialPerJson(JSON.toJSONString(socialPerMap));
// insuranceAccountDetailPO.setSocialComJson(JSON.toJSONString(socialComMap));
// insuranceAccountDetailPO.setFundPerJson(JSON.toJSONString(fundPerMap));
// insuranceAccountDetailPO.setFundComJson(JSON.toJSONString(fundComMap));
// insuranceAccountDetailPO.setOtherPerJson(JSON.toJSONString(otherPerMap));
// insuranceAccountDetailPO.setOtherComJson(JSON.toJSONString(otherComMap));
// insuranceAccountDetailPO.setSocialPerSum(socialPer.toPlainString());
// insuranceAccountDetailPO.setSocialComSum(socialCom.toPlainString());
// insuranceAccountDetailPO.setFundPerSum(fundPer.toPlainString());
// insuranceAccountDetailPO.setFundComSum(fundCom.toPlainString());
// insuranceAccountDetailPO.setOtherPerSum(otherPer.toPlainString());
// insuranceAccountDetailPO.setOtherComSum(otherCom.toPlainString());
// insuranceAccountDetailPO.setPerSum(perSum.toPlainString());
// insuranceAccountDetailPO.setComSum(comSum.toPlainString());
// newList.add(insuranceAccountDetailPO);
}
Map<String, Object> resultMap = new HashMap<>();
resultMap.put("perValueMap", perSumValueMap);
resultMap.put("comValueMap", comSumValueMap);
resultMap.put("empMap", payedEmpMap);
return resultMap;
}
@Override
public List<InsuranceAccountInspectPO> allInspects(Collection<Long> ids, String billMonth) {
// InsuranceAccountInspectMapper siAccountInspectMapper = MapperProxyFactory.getProxy(InsuranceAccountInspectMapper.class);

View File

@ -4,6 +4,7 @@ import cn.hutool.core.util.StrUtil;
import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.salary.cache.SalaryCacheKey;
import com.engine.salary.common.LocalDateRange;
import com.engine.salary.constant.SalaryDefaultTenantConstant;
import com.engine.salary.constant.SalaryFormulaFieldConstant;
import com.engine.salary.entity.datacollection.AddUpDeduction;
@ -23,10 +24,13 @@ import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
import com.engine.salary.entity.salarysob.dto.SalarySobCycleDTO;
import com.engine.salary.entity.salarysob.po.SalarySobBackItemPO;
import com.engine.salary.entity.salarysob.po.SalarySobItemPO;
import com.engine.salary.entity.salarysob.po.SalarySobPO;
import com.engine.salary.enums.salaryaccounting.SalaryAcctRecordStatusEnum;
import com.engine.salary.enums.salaryformula.SalaryFormulaReferenceEnum;
import com.engine.salary.formlua.entity.standard.ExcelResult;
import com.engine.salary.service.*;
import com.engine.salary.sys.enums.TaxDeclarationFunctionEnum;
import com.engine.salary.util.SalaryDateUtil;
import com.engine.salary.util.SalaryEntityUtil;
import com.google.common.collect.Lists;
import lombok.extern.slf4j.Slf4j;
@ -38,6 +42,8 @@ import weaver.general.BaseBean;
import weaver.general.Util;
import weaver.hrm.User;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.Month;
import java.util.*;
import java.util.stream.Collectors;
@ -113,6 +119,15 @@ public class SalaryAcctCalculateServiceImpl extends Service implements SalaryAcc
return ServiceUtil.getService(VariableArchiveServiceImpl.class, user);
}
private SalarySobService getSalarySobService(User user) {
return ServiceUtil.getService(SalarySobServiceImpl.class, user);
}
private SalaryAcctRecordService getSalaryAcctRecordService(User user) {
return ServiceUtil.getService(SalaryAcctRecordServiceImpl.class, user);
}
@Override
public void calculate(SalaryAcctCalculateBO salaryAcctCalculateBO, DataCollectionEmployee simpleEmployee, List<SalarySobBackItemPO> salarySobBackItems) {
log.info("开始核算V3 {}", salaryAcctCalculateBO);
@ -191,6 +206,23 @@ public class SalaryAcctCalculateServiceImpl extends Service implements SalaryAcc
CalculateFormulaVarBO calculateFormulaVarBO = new CalculateFormulaVarBO(simpleEmployees, salaryArchiveData, addUpSituationPOS, addUpDeductionPOS, otherDeductionPOS, welfareData, attendQuoteDataDTOS, salaryAcctResultPOS, variableArchiveList);
Map<String, List<CalculateFormulaVarBO.FormulaVarValue>> formulaVarMap = calculateFormulaVarBO.convert2FormulaVar(salaryAcctCalculateBO);
sw.stop();
// 11汇通二开数据处理
// 获取汇通建设薪资项目id
BaseBean baseBean = new BaseBean();
// 绩效预发金额
Long jxyfSalaryItemId = NumberUtils.isCreatable(baseBean.getPropValue("htjsSalaryApproval", "jxyfje_salary_item_id")) ? Long.valueOf(baseBean.getPropValue("htjsSalaryApproval", "jxyfje_salary_item_id")) : 0L;
// 上季度结余绩效工资
Long sjdjyjxgzSalaryItemId = NumberUtils.isCreatable(baseBean.getPropValue("htjsSalaryApproval", "sjdjyjxgz_salary_item_id")) ? Long.valueOf(baseBean.getPropValue("htjsSalaryApproval", "sjdjyjxgz_salary_item_id")) : 0L;
// 绩效差额
Long jxceSalaryItemId = NumberUtils.isCreatable(baseBean.getPropValue("htjsSalaryApproval", "jxce_salary_item_id")) ? Long.valueOf(baseBean.getPropValue("htjsSalaryApproval", "jxce_salary_item_id")) : 0L;
// 获取二开薪资项目需要排除的员工id
List<Long> htjsExcludeEmpIds = Arrays.stream(baseBean.getPropValue("htjsSalaryApproval", "salary_acct_exclued_emp_ids").split(",")).filter(NumberUtils::isCreatable).map(Long::valueOf).collect(Collectors.toList());
// 获取上季度预发绩效数据
Map<Long, BigDecimal> lastQuarterJxMap = getLastQuarterJxData(salaryAcctCalculateBO.getSalaryAcctRecordPO(), salaryAcctCalculateBO.getSalarySobPO(), simpleEmployees, jxyfSalaryItemId, htjsExcludeEmpIds);
// 获取绩效查额数据(乘以绩效分值前的值)
Map<Long, BigDecimal> jxceMap = getJxceData(salaryAcctCalculateBO.getSalaryAcctRecordPO(), salaryAcctCalculateBO.getSalarySobPO(), simpleEmployees, jxyfSalaryItemId, htjsExcludeEmpIds);
sw.start("数据结构准备");
// 本次薪资核算所用的薪资账套下的薪资项目
Map<Long, SalarySobItemPO> salaryItemIdKeySalarySobItemPOMap = SalaryEntityUtil.convert2Map(salaryAcctCalculateBO.getSalarySobItemPOS(), SalarySobItemPO::getSalaryItemId);
@ -266,6 +298,25 @@ public class SalaryAcctCalculateServiceImpl extends Service implements SalaryAcc
String key = SalaryFormulaReferenceEnum.SALARY_ARCHIVES.getValue() + SalaryFormulaFieldConstant.FIELD_ID_SEPARATOR + salaryItemPO.getCode();
resultValue = formulaVarValueMap.getOrDefault(key, StringUtils.EMPTY);
}
// 处理汇通二开的2个薪资项目
// 上季度结余绩效工资
if (salaryItemId.equals(sjdjyjxgzSalaryItemId)) {
if (htjsExcludeEmpIds.contains(salaryAcctEmployeePO.getEmployeeId())) {
resultValue = "0";
} else {
resultValue = lastQuarterJxMap.getOrDefault(salaryAcctEmployeePO.getEmployeeId(), new BigDecimal(0)).divide(new BigDecimal(3), 10, BigDecimal.ROUND_HALF_UP).toString();
}
}
// 绩效差额
if (salaryItemId.equals(jxceSalaryItemId)) {
if (htjsExcludeEmpIds.contains(salaryAcctEmployeePO.getEmployeeId())) {
resultValue = "0";
} else {
BigDecimal jxfz = NumberUtils.isCreatable(resultValue) ? new BigDecimal(resultValue) : new BigDecimal(0);
resultValue = jxceMap.getOrDefault(salaryAcctEmployeePO.getEmployeeId(), new BigDecimal(0)).multiply(jxfz).toString();
}
}
// 处理合并计税
resultValue = handleConsolidatedTax(resultValue, salaryItemPO, salaryAcctCalculateBO, otherSalaryAcctEmployeePOMap.get(salaryAcctEmployeePO.getEmployeeId() + "_" + salaryAcctEmployeePO.getTaxAgentId()), otherSalaryAcctResultPOMap.get(salaryAcctEmployeePO.getEmployeeId() + "_" + salaryAcctEmployeePO.getTaxAgentId()));
@ -329,6 +380,131 @@ public class SalaryAcctCalculateServiceImpl extends Service implements SalaryAcc
}
}
/**
* 汇通建设 - 获取上季度预发绩效
* @param salaryAcctRecordPO
* @param jxyfSalaryItemId
* @return
*/
private Map<Long, BigDecimal> getLastQuarterJxData(SalaryAcctRecordPO salaryAcctRecordPO, SalarySobPO salarySob, List<DataCollectionEmployee> simpleEmployees, Long jxyfSalaryItemId, List<Long> htjsExcludeEmpIds) {
// 根据薪资所属月获取上季度月份
LocalDateRange lastQuarterRange = SalaryDateUtil.getLastQuarterRange(salaryAcctRecordPO.getSalaryMonth());
// 获取义务人下所有账套
List<SalarySobPO> salarySobPOS = getSalarySobService(user).listByTaxAgentId(salarySob.getTaxAgentId());
Set<Long> salarySobIds = SalaryEntityUtil.properties(salarySobPOS, SalarySobPO::getId);
List<SalaryAcctRecordPO> salaryAcctRecordPOS = getSalaryAcctRecordService(user).listBySalarySobIdsAndSalaryMonth(salarySobIds, lastQuarterRange);
// 过滤未归档的核算记录
salaryAcctRecordPOS = salaryAcctRecordPOS.stream().filter(record -> record.getStatus() > SalaryAcctRecordStatusEnum.NOT_ARCHIVED.getValue()).collect(Collectors.toList());
Set<Long> salaryAcctRecordIds = SalaryEntityUtil.properties(salaryAcctRecordPOS, SalaryAcctRecordPO::getId);
// 查询薪资核算结果
List<SalaryAcctResultPO> resultPOList = getSalaryAcctResultService(user).listBySalaryAcctRecordIdsAndSalaryItemIds(salaryAcctRecordIds, Collections.singletonList(jxyfSalaryItemId));
// 只取安全级别70以下的不含70
List<Long> empIds = simpleEmployees.stream()
.filter(emp -> emp.getSeclevel() != null && emp.getSeclevel().compareTo(new Integer(70)) == -1 && !htjsExcludeEmpIds.contains(emp.getEmployeeId()))
.map(DataCollectionEmployee::getEmployeeId).collect(Collectors.toList());
resultPOList = resultPOList.stream().filter(result -> empIds.contains(result.getEmployeeId())).collect(Collectors.toList());
// 根据人员汇总
Map<Long, List<SalaryAcctResultPO>> valueMap = SalaryEntityUtil.group2Map(resultPOList, SalaryAcctResultPO::getEmployeeId);
Map<Long, BigDecimal> resultMap = new HashMap<>();
for (Map.Entry<Long, List<SalaryAcctResultPO>> entry : valueMap.entrySet()) {
BigDecimal sumValue = entry.getValue().stream().map(SalaryAcctResultPO::getResultValue).filter(NumberUtils::isCreatable).map(BigDecimal::new).reduce(new BigDecimal(0), BigDecimal::add);
resultMap.put(entry.getKey(), sumValue);
}
return resultMap;
}
/**
* 汇通建设 - 获取绩效差额数据
* @param salaryAcctRecordPO
* @param jxyfSalaryItemId
* @return
*/
private Map<Long, BigDecimal> getJxceData(SalaryAcctRecordPO salaryAcctRecordPO, SalarySobPO salarySob, List<DataCollectionEmployee> employeeList, Long jxyfSalaryItemId, List<Long> htjsExcludeEmpIds) {
LocalDate salaryMonth = SalaryDateUtil.dateToLocalDate(salaryAcctRecordPO.getSalaryMonth());
Map<Long, BigDecimal> resultMap = new HashMap<>();
// 如果是1或者7月需要取计算绩效差额
if (salaryMonth.getMonthValue() == 1 || salaryMonth.getMonthValue() == 7) {
// 区分安全级别为70以下和 70及以上
// List<Long> managerEmpIdList = new ArrayList<>();
List<Long> normalEmpIdList = new ArrayList<>();
employeeList.stream().forEach(emp -> {
if (emp.getSeclevel() != null && emp.getSeclevel().compareTo(new Integer(70)) == -1 && !htjsExcludeEmpIds.contains(emp.getEmployeeId())) {
normalEmpIdList.add(emp.getEmployeeId());
}
});
// 获取义务人下所有账套
List<SalarySobPO> salarySobPOS = getSalarySobService(user).listByTaxAgentId(salarySob.getTaxAgentId());
Set<Long> salarySobIds = SalaryEntityUtil.properties(salarySobPOS, SalarySobPO::getId);
// 3个时间范围
LocalDate salaryMonthLocalDate = SalaryDateUtil.dateToLocalDate(salaryAcctRecordPO.getSalaryMonth());
LocalDate lastYearLocalDate = salaryMonthLocalDate.minusYears(1);
LocalDate fistMonthOfLastYear = lastYearLocalDate.withMonth(1).withDayOfMonth(1);
LocalDate lastMonthOfLastYear = lastYearLocalDate.withMonth(12).withDayOfMonth(1);
// LocalDateRange lastYearRange = LocalDateRange.builder().fromDate(SalaryDateUtil.localDateToDate(fistMonthOfLastYear)).endDate(SalaryDateUtil.localDateToDate(lastMonthOfLastYear)).build();
LocalDateRange lastYearHalfYearRange = LocalDateRange.builder().fromDate(SalaryDateUtil.localDateToDate(fistMonthOfLastYear.withMonth(7))).endDate(SalaryDateUtil.localDateToDate(lastMonthOfLastYear)).build();
LocalDateRange thisYearHalfYearRange = LocalDateRange.builder().fromDate(SalaryDateUtil.localDateToDate(salaryMonthLocalDate.withMonth(1).withDayOfMonth(1))).endDate(SalaryDateUtil.localDateToDate(salaryMonthLocalDate.withMonth(6).withDayOfMonth(1))).build();
if(salaryMonth.getMonthValue() == 1) {
// // 处理安全级别为70及以上的
// // 1月份取上年绩效预发金额合计/0.4*绩效分值
// List<SalaryAcctRecordPO> salaryAcctRecordPOS = getSalaryAcctRecordService(user).listBySalarySobIdsAndSalaryMonth(salarySobIds, lastYearRange);
// // 过滤未归档的核算记录
// salaryAcctRecordPOS = salaryAcctRecordPOS.stream().filter(record -> record.getStatus() > SalaryAcctRecordStatusEnum.NOT_ARCHIVED.getValue()).collect(Collectors.toList());
// Set<Long> salaryAcctRecordIds = SalaryEntityUtil.properties(salaryAcctRecordPOS, SalaryAcctRecordPO::getId);
// List<SalaryAcctEmployeePO> salaryAcctEmployeePOList = getSalaryAcctEmployeeService(user).listBySalaryAcctRecordIdsAndEmployeeIds(salaryAcctRecordIds, managerEmpIdList);
// List<Long> salaryAcctEmpIds = SalaryEntityUtil.properties(salaryAcctEmployeePOList, SalaryAcctEmployeePO::getId, Collectors.toList());
// // 查询薪资核算结果
// List<SalaryAcctResultPO> resultPOList = getSalaryAcctResultService(user).listByAcctEmployeeIdsAndSalaryItemIds(salaryAcctEmpIds, Collections.singletonList(jxyfSalaryItemId));
// // 根据人员汇总
// Map<Long, Set<String>> valueMap = SalaryEntityUtil.group2Map(resultPOList, SalaryAcctResultPO::getEmployeeId, SalaryAcctResultPO::getResultValue);
// BigDecimal base = BigDecimal.valueOf(0.4);
// for (Map.Entry<Long, Set<String>> entry : valueMap.entrySet()) {
// BigDecimal sumValue = entry.getValue().stream().filter(NumberUtils::isCreatable).map(BigDecimal::new).reduce(new BigDecimal(0), BigDecimal::add);
// resultMap.put(entry.getKey(), sumValue.divide(base,10, BigDecimal.ROUND_HALF_UP));
// }
// 处理安全级别为70以下的
// 1月份差额取去年7-12绩效预发金额合计*2*绩效分值
List<SalaryAcctRecordPO> salaryAcctRecordPOS = getSalaryAcctRecordService(user).listBySalarySobIdsAndSalaryMonth(salarySobIds, lastYearHalfYearRange);
// 过滤未归档的核算记录
salaryAcctRecordPOS = salaryAcctRecordPOS.stream().filter(record -> record.getStatus() > SalaryAcctRecordStatusEnum.NOT_ARCHIVED.getValue()).collect(Collectors.toList());
Set<Long> salaryAcctRecordIds = SalaryEntityUtil.properties(salaryAcctRecordPOS, SalaryAcctRecordPO::getId);
List<SalaryAcctEmployeePO> salaryAcctEmployeePOList = getSalaryAcctEmployeeService(user).listBySalaryAcctRecordIdsAndEmployeeIds(salaryAcctRecordIds, normalEmpIdList);
List<Long> salaryAcctEmpIds = SalaryEntityUtil.properties(salaryAcctEmployeePOList, SalaryAcctEmployeePO::getId, Collectors.toList());
// 查询薪资核算结果
List<SalaryAcctResultPO> resultPOList = getSalaryAcctResultService(user).listByAcctEmployeeIdsAndSalaryItemIds(salaryAcctEmpIds, Collections.singletonList(jxyfSalaryItemId));
// 根据人员汇总
Map<Long, List<SalaryAcctResultPO>> valueMap = SalaryEntityUtil.group2Map(resultPOList, SalaryAcctResultPO::getEmployeeId);
BigDecimal base = BigDecimal.valueOf(2);
for (Map.Entry<Long, List<SalaryAcctResultPO>> entry : valueMap.entrySet()) {
BigDecimal sumValue = entry.getValue().stream().map(SalaryAcctResultPO::getResultValue).filter(NumberUtils::isCreatable).map(BigDecimal::new).reduce(new BigDecimal(0), BigDecimal::add);
resultMap.put(entry.getKey(), sumValue.multiply(base));
}
}
if (salaryMonth.getMonthValue() == 7){
// 7月份差额取1-6月绩效预发金额合计*2*绩效分值
List<SalaryAcctRecordPO> salaryAcctRecordPOS = getSalaryAcctRecordService(user).listBySalarySobIdsAndSalaryMonth(salarySobIds, thisYearHalfYearRange);
// 过滤未归档的核算记录
salaryAcctRecordPOS = salaryAcctRecordPOS.stream().filter(record -> record.getStatus() > SalaryAcctRecordStatusEnum.NOT_ARCHIVED.getValue()).collect(Collectors.toList());
Set<Long> salaryAcctRecordIds = SalaryEntityUtil.properties(salaryAcctRecordPOS, SalaryAcctRecordPO::getId);
List<SalaryAcctEmployeePO> salaryAcctEmployeePOList = getSalaryAcctEmployeeService(user).listBySalaryAcctRecordIdsAndEmployeeIds(salaryAcctRecordIds, normalEmpIdList);
List<Long> salaryAcctEmpIds = SalaryEntityUtil.properties(salaryAcctEmployeePOList, SalaryAcctEmployeePO::getId, Collectors.toList());
// 查询薪资核算结果
List<SalaryAcctResultPO> resultPOList = getSalaryAcctResultService(user).listByAcctEmployeeIdsAndSalaryItemIds(salaryAcctEmpIds, Collections.singletonList(jxyfSalaryItemId));
// 根据人员汇总
Map<Long, List<SalaryAcctResultPO>> valueMap = SalaryEntityUtil.group2Map(resultPOList, SalaryAcctResultPO::getEmployeeId);
BigDecimal base = BigDecimal.valueOf(2);
for (Map.Entry<Long, List<SalaryAcctResultPO>> entry : valueMap.entrySet()) {
BigDecimal sumValue = entry.getValue().stream().map(SalaryAcctResultPO::getResultValue).filter(NumberUtils::isCreatable).map(BigDecimal::new).reduce(new BigDecimal(0), BigDecimal::add);
resultMap.put(entry.getKey(), sumValue.multiply(base));
}
}
}
return resultMap;
}
/**
* 运行公式
*

View File

@ -143,8 +143,16 @@ public class SalaryAcctEmployeeServiceImpl extends Service implements SalaryAcct
}
@Override
public List<SalaryAcctEmployeePO> listBySalaryAcctRecordIds(Collection<Long> salaryAcctRecordIds) {
return getSalaryAcctEmployeeMapper().listSome(SalaryAcctEmployeePO.builder().salaryAcctRecordIds(salaryAcctRecordIds).build());
public List<SalaryAcctEmployeePO> listBySalaryAcctRecordIds(List<Long> salaryAcctRecordIds) {
if (CollectionUtils.isEmpty(salaryAcctRecordIds)) {
return Collections.emptyList();
}
List<List<Long>> partition = Lists.partition(salaryAcctRecordIds, 500);
List<SalaryAcctEmployeePO> resultList = new ArrayList<>();
partition.forEach(part -> {
resultList.addAll(getSalaryAcctEmployeeMapper().listSome(SalaryAcctEmployeePO.builder().salaryAcctRecordIds(part).build()));
});
return resultList;
}
@Override
@ -298,7 +306,7 @@ public class SalaryAcctEmployeeServiceImpl extends Service implements SalaryAcct
}
Set<Long> lastMonthSalaryAcctRecordIds = SalaryEntityUtil.properties(salaryAcctRecordPOS, SalaryAcctRecordPO::getId);
// 上个月的核算人员
List<SalaryAcctEmployeePO> lastMonthSalaryAcctEmployeePOS = listBySalaryAcctRecordIds(lastMonthSalaryAcctRecordIds);
List<SalaryAcctEmployeePO> lastMonthSalaryAcctEmployeePOS = listBySalaryAcctRecordIds(lastMonthSalaryAcctRecordIds.stream().collect(Collectors.toList()));
Map<String, SalaryAcctEmployeePO> lastMonthSalaryAcctEmployeePOMap = SalaryEntityUtil.convert2Map(lastMonthSalaryAcctEmployeePOS, salaryAcctEmployeePO -> salaryAcctEmployeePO.getEmployeeId() + "-" + salaryAcctEmployeePO.getTaxAgentId());
// 本月的核算人员
List<SalaryAcctEmployeePO> salaryAcctEmployeePOS = listByParam(queryParam);
@ -323,7 +331,7 @@ public class SalaryAcctEmployeeServiceImpl extends Service implements SalaryAcct
}
Set<Long> lastMonthSalaryAcctRecordIds = SalaryEntityUtil.properties(salaryAcctRecordPOS, SalaryAcctRecordPO::getId);
// 上个月的核算人员
List<SalaryAcctEmployeePO> lastMonthSalaryAcctEmployeePOS = listBySalaryAcctRecordIds(lastMonthSalaryAcctRecordIds);
List<SalaryAcctEmployeePO> lastMonthSalaryAcctEmployeePOS = listBySalaryAcctRecordIds(lastMonthSalaryAcctRecordIds.stream().collect(Collectors.toList()));
Map<String, SalaryAcctEmployeePO> lastMonthSalaryAcctEmployeePOMap = SalaryEntityUtil.convert2Map(lastMonthSalaryAcctEmployeePOS, salaryAcctEmployeePO -> salaryAcctEmployeePO.getEmployeeId() + "-" + salaryAcctEmployeePO.getTaxAgentId());
// 本月的核算人员
List<SalaryAcctEmployeePO> salaryAcctEmployeePOS = listByParam(queryParam);

View File

@ -719,7 +719,7 @@ public class SalaryAcctRecordServiceImpl extends Service implements SalaryAcctRe
List<SalaryAcctEmployeePO> salaryAcctEmployeePOS = getSalaryAcctEmployeeService(user).listBySalaryAcctRecordId(id);
// 查询其他核算记录中的薪资核算人员
Set<Long> otherSalaryAcctRecordIds = SalaryEntityUtil.properties(otherSalaryAcctRecordPOS, SalaryAcctRecordPO::getId);
List<SalaryAcctEmployeePO> otherSalaryAcctEmployeePOS = getSalaryAcctEmployeeService(user).listBySalaryAcctRecordIds(otherSalaryAcctRecordIds);
List<SalaryAcctEmployeePO> otherSalaryAcctEmployeePOS = getSalaryAcctEmployeeService(user).listBySalaryAcctRecordIds(otherSalaryAcctRecordIds.stream().collect(Collectors.toList()));
// 有其他核算记录需要进一步判断本次核算的人员中是否存在合并计税
Set<String> keySet = SalaryEntityUtil.properties(otherSalaryAcctEmployeePOS, salaryAcctEmployeePO -> salaryAcctEmployeePO.getEmployeeId() + "-" + salaryAcctEmployeePO.getTaxAgentId());
boolean hasConsolidatedTax = salaryAcctEmployeePOS.stream().anyMatch(salaryAcctEmployeePO -> keySet.contains(salaryAcctEmployeePO.getEmployeeId() + "-" + salaryAcctEmployeePO.getTaxAgentId()));

View File

@ -1,6 +1,5 @@
package com.engine.salary.service.impl;
import com.alibaba.fastjson.JSON;
import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.hrmelog.entity.dto.LoggerContext;
@ -27,6 +26,7 @@ import com.engine.salary.entity.salaryformula.ExpressFormula;
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
import com.engine.salary.entity.salarysob.dto.*;
import com.engine.salary.entity.salarysob.po.*;
import com.engine.salary.entity.sischeme.po.InsuranceSchemePO;
import com.engine.salary.entity.taxagent.po.TaxAgentAdminPO;
import com.engine.salary.entity.taxagent.po.TaxAgentPO;
import com.engine.salary.enums.OperateTypeEnum;
@ -37,8 +37,10 @@ import com.engine.salary.enums.salaryaccounting.SalaryAcctRecordStatusEnum;
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.enums.sicategory.WelfareTypeEnum;
import com.engine.salary.exception.SalaryRunTimeException;
import com.engine.salary.mapper.salaryacct.SalaryAcctResultMapper;
import com.engine.salary.mapper.sischeme.InsuranceSchemeMapper;
import com.engine.salary.report.service.SalaryStatisticsReportService;
import com.engine.salary.report.service.impl.SalaryStatisticsReportServiceImpl;
import com.engine.salary.service.*;
@ -70,7 +72,6 @@ import weaver.general.BaseBean;
import weaver.general.Util;
import weaver.hrm.User;
import java.io.UnsupportedEncodingException;
import java.math.BigDecimal;
import java.util.*;
import java.util.concurrent.BlockingDeque;
@ -202,6 +203,10 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
return ServiceUtil.getService(SalaryAcctSobConfigServiceImpl.class, user);
}
private InsuranceSchemeMapper getInsuranceSchemeMapper() {
return MapperProxyFactory.getProxy(InsuranceSchemeMapper.class);
}
@Override
public List<SalaryAcctResultPO> listBySalaryAcctRecordIds(Collection<Long> salaryAcctRecordIds) {
if (CollectionUtils.isEmpty(salaryAcctRecordIds)) {
@ -1262,20 +1267,12 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
List<Long> salaryAcctEmpIds = salaryAcctEmployeePOList.stream().map(SalaryAcctEmployeePO::getId).collect(Collectors.toList());
List<Long> empIds = salaryAcctEmployeePOList.stream().map(SalaryAcctEmployeePO::getEmployeeId).distinct().collect(Collectors.toList());
List<DataCollectionEmployee> employeeList = getSalaryEmployeeService(user).listByIds(empIds);
// 获取需要查询的薪资项目
BaseBean baseBean = new BaseBean();
String xcssConfig = baseBean.getPropValue("htjsSalaryApproval", "xcss_config");
try {
xcssConfig = new String(xcssConfig.getBytes("ISO-8859-1"), "UTF-8");
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e);
}
List<HtXcssItemDTO> htXcssItemDTOList = JSON.parseArray(xcssConfig, HtXcssItemDTO.class);
Map<String, Long> salaryItemNameMap = SalaryEntityUtil.convert2Map(getSalaryItemService(user).listAll(), SalaryItemPO::getName, SalaryItemPO::getId);
for(HtXcssItemDTO dto : htXcssItemDTOList) {
for(HtXcssItemDTO dto : param.getHtXcssItemDTOList()) {
dto.setSalaryItemId(salaryItemNameMap.getOrDefault(dto.getSalaryItemName(), 0L));
}
List<Long> salaryItemIds = htXcssItemDTOList.stream().map(HtXcssItemDTO::getSalaryItemId).filter(salaryItemId -> salaryItemId != null && (!salaryItemId.equals(0L))).collect(Collectors.toList());
List<Long> salaryItemIds = param.getHtXcssItemDTOList().stream().map(HtXcssItemDTO::getSalaryItemId).filter(salaryItemId -> salaryItemId != null && (!salaryItemId.equals(0L))).collect(Collectors.toList());
List<SalaryAcctResultPO> acctResultList = listByAcctEmployeeIdsAndSalaryItemIds(salaryAcctEmpIds, salaryItemIds);
List<SalaryItemPO> salaryItemList = getSalaryItemService(user).listByIds(salaryItemIds);
List<TaxAgentPO> taxAgentList = getTaxAgentService(user).listAll();
@ -1295,7 +1292,7 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
resultMap = sortedMap;
List<Map<String, Object>> list = resultMap.values().stream().collect(Collectors.toList());
// 表头信息
List<HtjsApprovalColumn> columns = htXcssItemDTOList.stream().map(itemDTO -> {
List<HtjsApprovalColumn> columns = param.getHtXcssItemDTOList().stream().map(itemDTO -> {
return HtjsApprovalColumn.builder()
.fieldName(itemDTO.getFieldName())
.salaryItemId(Util.null2String(itemDTO.getSalaryItemId()))
@ -1329,21 +1326,14 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
// 分页
PageInfo<SalaryAcctEmployeePO> salaryAcctEmployeePageInfo = SalaryPageUtil.buildPage(param.getCurrent(), param.getPageSize(), salaryAcctEmployeePOList, SalaryAcctEmployeePO.class);
// 获取需要查询的薪资项目
BaseBean baseBean = new BaseBean();
String xcssConfig = baseBean.getPropValue("htjsSalaryApproval", "xcss_config");
try {
xcssConfig = new String(xcssConfig.getBytes("ISO-8859-1"), "UTF-8");
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e);
}
List<HtXcssItemDTO> htXcssItemDTOList = JSON.parseArray(xcssConfig, HtXcssItemDTO.class);
Map<String, Long> salaryItemNameMap = SalaryEntityUtil.convert2Map(getSalaryItemService(user).listAll(), SalaryItemPO::getName, SalaryItemPO::getId);
for(HtXcssItemDTO dto : htXcssItemDTOList) {
for(HtXcssItemDTO dto : param.getHtXcssItemDTOList()) {
dto.setSalaryItemId(salaryItemNameMap.getOrDefault(dto.getSalaryItemName(), 0L));
}
List<Long> salaryItemIds = htXcssItemDTOList.stream().map(HtXcssItemDTO::getSalaryItemId).filter(salaryItemId -> salaryItemId != null && (!salaryItemId.equals(0L))).collect(Collectors.toList());
List<Long> salaryItemIds = param.getHtXcssItemDTOList().stream().map(HtXcssItemDTO::getSalaryItemId).filter(salaryItemId -> salaryItemId != null && (!salaryItemId.equals(0L))).collect(Collectors.toList());
List<SalaryItemPO> salaryItemList = getSalaryItemService(user).listByIds(salaryItemIds);
Map<Long, SalaryItemPO> salaryItemMap = SalaryEntityUtil.convert2Map(salaryItemList, SalaryItemPO::getId);
List<Map<String, Object>> valueList = htjsListBySalaryAcctEmployees(salaryAcctEmployeePageInfo.getList(), salaryItemIds);
// 薪资核算结果的分页结果
PageInfo<Map<String, Object>> pageInfo = new PageInfo<>();
@ -1355,15 +1345,18 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
// 表头
List<WeaTableColumnGroup> columns = Lists.newArrayList();
// 员工信息字段
columns.add(new WeaTableColumnGroup(SalaryPageUtil.selfAdaption("个税扣缴义务人", 0), "个税扣缴义务人", "taxAgentname"));
columns.add(new WeaTableColumnGroup(SalaryPageUtil.selfAdaption("个税扣缴义务人", 0), "个税扣缴义务人", "taxAgentName"));
columns.add(new WeaTableColumnGroup(SalaryPageUtil.selfAdaption("姓名", 0), "姓名", "username"));
columns.add(new WeaTableColumnGroup(SalaryPageUtil.selfAdaption("分部", 0), "分部", "subcompanyName"));
columns.add(new WeaTableColumnGroup(SalaryPageUtil.selfAdaption("部门", 0), "部门", "departmentName"));
columns.add(new WeaTableColumnGroup(SalaryPageUtil.selfAdaption("状态", 0), "状态", "statusName"));
// 薪资项目
for (SalaryItemPO salaryItemPO : salaryItemList) {
columns.add(new WeaTableColumnGroup(SalaryPageUtil.selfAdaption(salaryItemPO.getName(), salaryItemPO.getWidth()), salaryItemPO.getName(), "" + salaryItemPO.getId(), LockStatusEnum.UNLOCK.getDefaultLabel()));
for (Long salaryItemId : salaryItemIds) {
SalaryItemPO salaryItemPO = salaryItemMap.get(salaryItemId);
if (salaryItemPO != null) {
columns.add(new WeaTableColumnGroup(SalaryPageUtil.selfAdaption(salaryItemPO.getName(), salaryItemPO.getWidth()), salaryItemPO.getName(), "" + salaryItemPO.getId(), LockStatusEnum.UNLOCK.getDefaultLabel()));
}
}
result.put("pageInfo", pageInfo);
result.put("columns", columns);
@ -1393,7 +1386,7 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
String[] split = entrySet.getKey().split("_split");
itemSum.put("subCompanyName", split.length > 1 ? split[1] : "");
itemSum.put("empNums", entrySet.getValue().size());
itemSum.put("subcompanyId", CollectionUtils.isEmpty(value) ? "" : value.get(0).get("subcompanyId") == null ? "0" : value.get(0).get("subcompanyId"));
itemSum.put("subCompanyId", CollectionUtils.isEmpty(value) ? "" : value.get(0).get("subcompanyId") == null ? "0" : value.get(0).get("subcompanyId"));
result.put(entrySet.getKey(), itemSum);
}
return result;
@ -1408,6 +1401,7 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
List<SalarySobEmpFieldPO> salarySobEmpFieldPOS = new ArrayList<>();
salarySobEmpFieldPOS.add(SalarySobEmpFieldPO.builder().fieldCode("taxAgentName").build());
salarySobEmpFieldPOS.add(SalarySobEmpFieldPO.builder().fieldCode("username").build());
salarySobEmpFieldPOS.add(SalarySobEmpFieldPO.builder().fieldCode("subcompanyName").build());
salarySobEmpFieldPOS.add(SalarySobEmpFieldPO.builder().fieldCode("departmentName").build());
salarySobEmpFieldPOS.add(SalarySobEmpFieldPO.builder().fieldCode("statusName").build());
List<SalaryItemPO> salaryItemPOS = getSalaryItemService(user).listByIds(salaryItemIds);
@ -1429,7 +1423,80 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
return SalaryAcctResultBO.buildTableData4Ht(salaryItemPOS, salarySobEmpFieldPOS, simpleEmployees, salaryAcctEmployeePOS, salaryAcctResultPOS, taxAgentPOS, false);
}
@Override
public Map<String, Object> htjsXczfsqList(HtjsApprovalParam param) {
if (StringUtils.isBlank(param.getSalaryMonth()) || param.getSubcompanyId() == null) {
throw new SalaryRunTimeException("参数错误");
}
// 明细数据
Map<String, Object> dataList = htjsXcssList(param);
// 获取累计数据
BaseBean baseBean = new BaseBean();
String itemId = baseBean.getPropValue("htjsSalaryApproval", "xczf_sum_item_id");
BigDecimal totalValueLastMonth = new BigDecimal(0);
BigDecimal totalValue = new BigDecimal(0);
if (NumberUtils.isCreatable(itemId)) {
SalaryItemPO salaryItemPO = getSalaryItemService(user).getById(Long.valueOf(itemId));
// 获取截至本月上一个月的核算记录
Date lastMonthDate = SalaryDateUtil.localDateToDate(SalaryDateUtil.dateToLocalDate(param.getSalaryMonthDate()).plusMonths(-1));
List<SalaryAcctRecordPO> salaryAcctRecordPOS = getSalaryAcctRecordService(user).listBySalaryMonth(LocalDateRange.builder().endDate(lastMonthDate).build());
salaryAcctRecordPOS = salaryAcctRecordPOS.stream().filter(record -> record.getStatus() > SalaryAcctRecordStatusEnum.NOT_ARCHIVED.getValue()).collect(Collectors.toList());
// 获取薪资核算人员
List<Long> salaryAcctRecordIds = salaryAcctRecordPOS.stream().map(SalaryAcctRecordPO::getId).collect(Collectors.toList());
List<SalaryAcctEmployeePO> salaryAcctEmployeeList = getSalaryAcctEmployeeService(user).listBySalaryAcctRecordIds(salaryAcctRecordIds);
// 过滤单位
salaryAcctEmployeeList = salaryAcctEmployeeList.stream().filter(acctEmp -> acctEmp.getSubcompanyId() != null && param.getSubcompanyId().equals(acctEmp.getSubcompanyId())).collect(Collectors.toList());
List<Long> salaryAcctEmpIds = SalaryEntityUtil.properties(salaryAcctEmployeeList, SalaryAcctEmployeePO::getId, Collectors.toList());
// 获取薪资核算结果
List<SalaryAcctResultPO> resultPOList = listByAcctEmployeeIdsAndSalaryItemIds(salaryAcctEmpIds, Collections.singletonList(salaryItemPO.getId()));
totalValueLastMonth = resultPOList.stream()
.map(SalaryAcctResultPO::getResultValue)
.filter(NumberUtils::isCreatable)
.map(BigDecimal::new)
.reduce(BigDecimal.ZERO, BigDecimal::add);
// 获取本月的数据
salaryAcctRecordPOS = getSalaryAcctRecordService(user).listBySalaryMonth(LocalDateRange.builder().fromDate(param.getSalaryMonthDate()).endDate(param.getSalaryMonthDate()).build());
salaryAcctRecordPOS = salaryAcctRecordPOS.stream().filter(record -> record.getStatus() > SalaryAcctRecordStatusEnum.NOT_ARCHIVED.getValue()).collect(Collectors.toList());
// 获取薪资核算人员
salaryAcctRecordIds = salaryAcctRecordPOS.stream().map(SalaryAcctRecordPO::getId).collect(Collectors.toList());
salaryAcctEmployeeList = getSalaryAcctEmployeeService(user).listBySalaryAcctRecordIds(salaryAcctRecordIds);
// 过滤单位
salaryAcctEmployeeList = salaryAcctEmployeeList.stream().filter(acctEmp -> acctEmp.getSubcompanyId() != null && param.getSubcompanyId().equals(acctEmp.getSubcompanyId())).collect(Collectors.toList());
salaryAcctEmpIds = SalaryEntityUtil.properties(salaryAcctEmployeeList, SalaryAcctEmployeePO::getId, Collectors.toList());
// 获取薪资核算结果
resultPOList = listByAcctEmployeeIdsAndSalaryItemIds(salaryAcctEmpIds, Collections.singletonList(salaryItemPO.getId()));
BigDecimal thisMonthValue = resultPOList.stream()
.map(SalaryAcctResultPO::getResultValue)
.filter(NumberUtils::isCreatable)
.map(BigDecimal::new)
.reduce(BigDecimal.ZERO, BigDecimal::add);
totalValue = totalValueLastMonth.add(thisMonthValue);
}
Map<String, Object> resultMap = new HashMap<>();
resultMap.put("columns", dataList.get("columns"));
resultMap.put("data", dataList.get("data"));
resultMap.put("ljjhzf",totalValue);
resultMap.put("ljyzf", totalValueLastMonth);
return resultMap;
}
@Override
public List<HtSbqsListDTO> htjsSbqsList(HtjsApprovalParam param) {
if (param.getSchemeId() == null || StringUtils.isBlank(param.getSalaryMonth())) {
return Collections.emptyList();
}
InsuranceSchemePO insuranceSchemePO = getInsuranceSchemeMapper().getById(param.getSchemeId());
if (insuranceSchemePO == null) {
throw new SalaryRunTimeException("社保福利方案不存在或已被删除");
}
Integer welfareType = insuranceSchemePO.getWelfareType();
if (welfareType.equals(WelfareTypeEnum.SOCIAL_SECURITY.getValue())) {
return getSIAccountService(user).welfareData4Htjs(param.getSalaryMonth(), param.getSchemeId(), null, null);
} else if (welfareType.equals(WelfareTypeEnum.ACCUMULATION_FUND.getValue())) {
return getSIAccountService(user).welfareData4Htjs(param.getSalaryMonth(), null, param.getSchemeId(), null);
} else {
return getSIAccountService(user).welfareData4Htjs(param.getSalaryMonth(), null, null, param.getSchemeId());
}
}
}

View File

@ -14,6 +14,7 @@ import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.*;
import java.time.format.DateTimeFormatter;
import java.time.temporal.TemporalAdjusters;
import java.util.Calendar;
import java.util.Date;
import java.util.Objects;
@ -604,6 +605,20 @@ public class SalaryDateUtil {
LocalDate localDate = SalaryDateUtil.dateToLocalDate(date).plusMonths(i);
return SalaryDateUtil.localDateToDate(localDate);
}
/**
* 获取上一季度日期范围
* @param salaryMonth
* @return
*/
public static LocalDateRange getLastQuarterRange(Date salaryMonth) {
LocalDate today = SalaryDateUtil.dateToLocalDate(salaryMonth);
LocalDate firstDayOfThisQuarter = today.with(TemporalAdjusters.firstDayOfNextMonth())
.minusMonths(today.getMonthValue() % 3 == 0 ? 3 : today.getMonthValue() % 3);
LocalDate firstDayOfLastQuarter = firstDayOfThisQuarter.minusMonths(3);
LocalDate lastDayOfLastQuarter = firstDayOfLastQuarter.plusMonths(3).minusDays(1);
return LocalDateRange.builder().fromDate(localDateToDate(firstDayOfLastQuarter)).endDate(localDateToDate(lastDayOfLastQuarter)).build();
}
}

View File

@ -960,5 +960,52 @@ public class SalaryAcctController {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<HtjsApprovalParam, Map<String, Object>>(user).run(getSalaryAcctResultWrapper(user)::htjsXcssDataDetail, param);
}
/**
* 薪酬支付申请list
* @param request
* @param response
* @param param
* @return
*/
@POST
@Path("/htjs/xczfsqList")
@Produces(MediaType.APPLICATION_JSON)
public String htjsXczfsqList(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody HtjsApprovalParam param) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<HtjsApprovalParam, Map<String, Object>>(user).run(getSalaryAcctResultWrapper(user)::htjsXczfsqList, param);
}
/**
* 薪酬支付申请 数据穿透
* @param request
* @param response
* @param param
* @return
*/
@POST
@Path("/htjs/xczfsqDataDetail")
@Produces(MediaType.APPLICATION_JSON)
public String htjsXczfsqDataDetail(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody HtjsApprovalParam param) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<HtjsApprovalParam, Map<String, Object>>(user).run(getSalaryAcctResultWrapper(user)::htjsXczfsqDataDetail, param);
}
/**
* 薪酬支付申请list
* @param request
* @param response
* @param param
* @return
*/
@POST
@Path("/htjs/sbqsList")
@Produces(MediaType.APPLICATION_JSON)
public String htjsSbqsList(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody HtjsApprovalParam param) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<HtjsApprovalParam, List<HtSbqsListDTO>>(user).run(getSalaryAcctResultWrapper(user)::htjsSbqsList, param);
}
/**********************************汇通建设送薪审批 end*********************************/
}

View File

@ -1,14 +1,13 @@
package com.engine.salary.wrapper;
import com.alibaba.fastjson.JSON;
import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.salary.cache.SalaryCacheKey;
import com.engine.salary.component.WeaTableColumnGroup;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.entity.progress.ProgressDTO;
import com.engine.salary.entity.salaryacct.dto.ConsolidatedTaxDetailDTO;
import com.engine.salary.entity.salaryacct.dto.SalaryAcctResultDetailDTO;
import com.engine.salary.entity.salaryacct.dto.SalaryAcctResultListColumnDTO;
import com.engine.salary.entity.salaryacct.dto.*;
import com.engine.salary.entity.salaryacct.param.*;
import com.engine.salary.entity.salaryacct.po.SalaryAcctRecordPO;
import com.engine.salary.exception.SalaryRunTimeException;
@ -23,8 +22,10 @@ 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 weaver.general.BaseBean;
import weaver.hrm.User;
import java.io.UnsupportedEncodingException;
import java.math.BigDecimal;
import java.util.*;
@ -267,14 +268,81 @@ public class SalaryAcctResultWrapper extends Service implements SalaryAcctResult
getSalaryAcctResultService(user).batchUpdate(param);
}
/**
* 薪酬送审列表
* @param param
* @return
*/
public Map<String, Object> htjsXcssList(HtjsApprovalParam param) {
// 获取需要查询的薪资项目
BaseBean baseBean = new BaseBean();
String xcssConfig = baseBean.getPropValue("htjsSalaryApproval", "xcss_config");
try {
xcssConfig = new String(xcssConfig.getBytes("ISO-8859-1"), "UTF-8");
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e);
}
List<HtXcssItemDTO> htXcssItemDTOList = JSON.parseArray(xcssConfig, HtXcssItemDTO.class);
param.setHtXcssItemDTOList(htXcssItemDTOList);
return getSalaryAcctResultService(user).htjsXcssList(param);
}
/**
* 薪酬送审数据穿透
* @param param
* @return
*/
public Map<String, Object> htjsXcssDataDetail(HtjsApprovalParam param) {
// 获取需要查询的薪资项目
BaseBean baseBean = new BaseBean();
String xcssConfig = baseBean.getPropValue("htjsSalaryApproval", "xcss_config");
try {
xcssConfig = new String(xcssConfig.getBytes("ISO-8859-1"), "UTF-8");
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e);
}
List<HtXcssItemDTO> htXcssItemDTOList = JSON.parseArray(xcssConfig, HtXcssItemDTO.class);
param.setHtXcssItemDTOList(htXcssItemDTOList);
return getSalaryAcctResultService(user).htjsXcssDataDetail(param);
}
/**
* 薪酬支付申请list
* @param param
* @return
*/
public Map<String, Object> htjsXczfsqList(HtjsApprovalParam param) {
// 获取需要查询的薪资项目
BaseBean baseBean = new BaseBean();
String xcssConfig = baseBean.getPropValue("htjsSalaryApproval", "xczf_config");
try {
xcssConfig = new String(xcssConfig.getBytes("ISO-8859-1"), "UTF-8");
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e);
}
List<HtXcssItemDTO> htXcssItemDTOList = JSON.parseArray(xcssConfig, HtXcssItemDTO.class);
param.setHtXcssItemDTOList(htXcssItemDTOList);
return getSalaryAcctResultService(user).htjsXczfsqList(param);
}
public Map<String, Object> htjsXczfsqDataDetail(HtjsApprovalParam param) {
// 获取需要查询的薪资项目
BaseBean baseBean = new BaseBean();
String xcssConfig = baseBean.getPropValue("htjsSalaryApproval", "xczf_config");
try {
xcssConfig = new String(xcssConfig.getBytes("ISO-8859-1"), "UTF-8");
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e);
}
List<HtXcssItemDTO> htXcssItemDTOList = JSON.parseArray(xcssConfig, HtXcssItemDTO.class);
param.setHtXcssItemDTOList(htXcssItemDTOList);
return getSalaryAcctResultService(user).htjsXcssDataDetail(param);
}
public List<HtSbqsListDTO> htjsSbqsList(HtjsApprovalParam param) {
return getSalaryAcctResultService(user).htjsSbqsList(param);
}
/**
* 薪资核算-校验
*