Commit 9f5be791 authored by huyuchen's avatar huyuchen

年终奖测算工具修改

parent 39e243da
...@@ -58,6 +58,16 @@ public interface TSalaryAccountItemMapper extends BaseMapper<TSalaryAccountItem> ...@@ -58,6 +58,16 @@ public interface TSalaryAccountItemMapper extends BaseMapper<TSalaryAccountItem>
**/ **/
List<TSalaryAccountItem> getAllItemVoList(@Param("idCardList") List<String> idCardList, @Param("invoiceTitle") String invoiceTitle); List<TSalaryAccountItem> getAllItemVoList(@Param("idCardList") List<String> idCardList, @Param("invoiceTitle") String invoiceTitle);
/**
* @param idCardList
* @param invoiceTitle
* @Description: 获取所有工资报账,组装map,计算年终奖使用
* @Author: hgw
* @Date: 2022/1/27 17:04
* @return: java.util.List<com.yifu.cloud.v1.hrms.api.entity.TSalaryAccountItem>
**/
List<TSalaryAccountItem> getSalaryItemVoList(@Param("idCardList") List<String> idCardList, @Param("invoiceTitle") String invoiceTitle);
/** /**
* @param deptId 结算主体id * @param deptId 结算主体id
* @param javaFiedName 属性名 * @param javaFiedName 属性名
......
...@@ -41,6 +41,15 @@ public interface TSalaryAccountItemService extends IService<TSalaryAccountItem> ...@@ -41,6 +41,15 @@ public interface TSalaryAccountItemService extends IService<TSalaryAccountItem>
**/ **/
Map<String, List<TSalaryAccountItem>> getAllItemVoList(List<String> idCardList, String invoiceTitle); Map<String, List<TSalaryAccountItem>> getAllItemVoList(List<String> idCardList, String invoiceTitle);
/**
* @param idCardList
* @param invoiceTitle
* @Description: 获取所有工资报账,组装map,计算年终奖使用
* @Author: huyc
* @Date: 2022/1/27 17:25
* @return: java.util.Map<java.lang.String, java.util.List < com.yifu.cloud.v1.hrms.api.entity.TSalaryAccountItem>>
**/
Map<String, List<TSalaryAccountItem>> getSalaryItemVoList(List<String> idCardList, String invoiceTitle);
/** /**
* 工资报账表附加-工资明细简单分页查询 * 工资报账表附加-工资明细简单分页查询
......
...@@ -100,6 +100,32 @@ public class TSalaryAccountItemServiceImpl extends ServiceImpl<TSalaryAccountIte ...@@ -100,6 +100,32 @@ public class TSalaryAccountItemServiceImpl extends ServiceImpl<TSalaryAccountIte
return itemMap; return itemMap;
} }
/**
* @param idCardList
* @param invoiceTitle
* @Description: 获取所有工资报账,组装map,计算年终奖使用
* @Author: hgw
* @Date: 2022/1/27 17:25
* @return: java.util.Map<java.lang.String, java.util.List < com.yifu.cloud.v1.hrms.api.entity.TSalaryAccountItem>>
**/
@Override
public Map<String, List<TSalaryAccountItem>> getSalaryItemVoList(List<String> idCardList, String invoiceTitle) {
List<TSalaryAccountItem> list = baseMapper.getSalaryItemVoList(idCardList, invoiceTitle);
Map<String, List<TSalaryAccountItem>> itemMap = new HashMap<>();
if (list != null && !list.isEmpty()) {
List<TSalaryAccountItem> voList;
for (TSalaryAccountItem item : list) {
voList = itemMap.get(item.getEmpIdcard());
if (voList == null) {
voList = new ArrayList<>();
}
voList.add(item);
itemMap.put(item.getEmpIdcard(), voList);
}
}
return itemMap;
}
/** /**
* @param settleDepartId 结算主体id * @param settleDepartId 结算主体id
* @param javaFiedName 属性名 * @param javaFiedName 属性名
......
...@@ -32,6 +32,7 @@ import com.yifu.cloud.plus.v1.yifu.common.core.constant.SecurityConstants; ...@@ -32,6 +32,7 @@ import com.yifu.cloud.plus.v1.yifu.common.core.constant.SecurityConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.*; import com.yifu.cloud.plus.v1.yifu.common.core.util.*;
import com.yifu.cloud.plus.v1.yifu.common.dapr.config.DaprArchivesProperties; import com.yifu.cloud.plus.v1.yifu.common.dapr.config.DaprArchivesProperties;
import com.yifu.cloud.plus.v1.yifu.common.dapr.util.HttpDaprUtil; import com.yifu.cloud.plus.v1.yifu.common.dapr.util.HttpDaprUtil;
import com.yifu.cloud.plus.v1.yifu.common.dapr.util.SocialDaprUtils;
import com.yifu.cloud.plus.v1.yifu.salary.constants.SalaryConstants; import com.yifu.cloud.plus.v1.yifu.salary.constants.SalaryConstants;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryAccountItem; import com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryAccountItem;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryTaxConfig; import com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryTaxConfig;
...@@ -41,8 +42,10 @@ import com.yifu.cloud.plus.v1.yifu.salary.mapper.TStatisticsBonusMapper; ...@@ -41,8 +42,10 @@ import com.yifu.cloud.plus.v1.yifu.salary.mapper.TStatisticsBonusMapper;
import com.yifu.cloud.plus.v1.yifu.salary.service.TSalaryAccountItemService; import com.yifu.cloud.plus.v1.yifu.salary.service.TSalaryAccountItemService;
import com.yifu.cloud.plus.v1.yifu.salary.service.TSalaryTaxConfigService; import com.yifu.cloud.plus.v1.yifu.salary.service.TSalaryTaxConfigService;
import com.yifu.cloud.plus.v1.yifu.salary.service.TStatisticsBonusService; import com.yifu.cloud.plus.v1.yifu.salary.service.TStatisticsBonusService;
import com.yifu.cloud.plus.v1.yifu.salary.vo.TPaymentVo;
import com.yifu.cloud.plus.v1.yifu.salary.vo.TStatisticsBonusImportVo; import com.yifu.cloud.plus.v1.yifu.salary.vo.TStatisticsBonusImportVo;
import com.yifu.cloud.plus.v1.yifu.salary.vo.TStatisticsBonusSearchVo; import com.yifu.cloud.plus.v1.yifu.salary.vo.TStatisticsBonusSearchVo;
import com.yifu.cloud.plus.v1.yifu.social.entity.TPaymentInfo;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.log4j.Log4j2; import lombok.extern.log4j.Log4j2;
import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.boot.context.properties.EnableConfigurationProperties;
...@@ -76,6 +79,8 @@ public class TStatisticsBonusServiceImpl extends ServiceImpl<TStatisticsBonusMap ...@@ -76,6 +79,8 @@ public class TStatisticsBonusServiceImpl extends ServiceImpl<TStatisticsBonusMap
private final TSalaryAccountMapper accountMapper; private final TSalaryAccountMapper accountMapper;
private final SocialDaprUtils socialDaprUtils;
/** /**
* 全年一次性奖金申报表简单分页查询 * 全年一次性奖金申报表简单分页查询
* @param tStatisticsBonus 全年一次性奖金申报表 * @param tStatisticsBonus 全年一次性奖金申报表
...@@ -184,6 +189,8 @@ public class TStatisticsBonusServiceImpl extends ServiceImpl<TStatisticsBonusMap ...@@ -184,6 +189,8 @@ public class TStatisticsBonusServiceImpl extends ServiceImpl<TStatisticsBonusMap
BigDecimal finalSalaryWithSalary; BigDecimal finalSalaryWithSalary;
//12月已发工资税费 //12月已发工资税费
BigDecimal twlSalaryTax; BigDecimal twlSalaryTax;
//12月社保公积金扣费
BigDecimal socialFundTax;
try { try {
out = response.getOutputStream(); out = response.getOutputStream();
response.setContentType(CommonConstants.MULTIPART_FORM_DATA); response.setContentType(CommonConstants.MULTIPART_FORM_DATA);
...@@ -216,7 +223,7 @@ public class TStatisticsBonusServiceImpl extends ServiceImpl<TStatisticsBonusMap ...@@ -216,7 +223,7 @@ public class TStatisticsBonusServiceImpl extends ServiceImpl<TStatisticsBonusMap
idCardList.add(vo.getEmpIdcard()); idCardList.add(vo.getEmpIdcard());
} }
} }
Map<String, List<TSalaryAccountItem>> itemMap = tSalaryAccountItemService.getAllItemVoList(idCardList, invoiceTitle); Map<String, List<TSalaryAccountItem>> itemMap = tSalaryAccountItemService.getSalaryItemVoList(idCardList, invoiceTitle);
for (TStatisticsBonusImportVo infoVo: list) { for (TStatisticsBonusImportVo infoVo: list) {
//本次纳税额 //本次纳税额
res = BigDecimal.ZERO; res = BigDecimal.ZERO;
...@@ -243,23 +250,51 @@ public class TStatisticsBonusServiceImpl extends ServiceImpl<TStatisticsBonusMap ...@@ -243,23 +250,51 @@ public class TStatisticsBonusServiceImpl extends ServiceImpl<TStatisticsBonusMap
finalSalaryWithSalary = BigDecimal.ZERO; finalSalaryWithSalary = BigDecimal.ZERO;
//12月份应纳税所得额扣除费用 //12月份应纳税所得额扣除费用
BigDecimal deductTaxSalary = infoVo.getDeductTaxSalary(); BigDecimal deductTaxSalary = infoVo.getDeductTaxSalary();
//12月社保公积金扣费
socialFundTax = BigDecimal.ZERO;
//专项扣除列表
List<BigDecimal> sdSumList = new ArrayList<>(); List<BigDecimal> sdSumList = new ArrayList<>();
//减除费用列表
List<BigDecimal> costReductionList = new ArrayList<>();
//查询缴费库获取生成月为12月的社保公积金扣费
List<TPaymentInfo> paymentInfoList = new ArrayList<>();
TPaymentInfo paymentInfo = new TPaymentInfo();
paymentInfo.setEmpIdcard(infoVo.getEmpIdcard());
paymentInfo.setSettleDomainId(deptId);
R<TPaymentVo> paymentVo = socialDaprUtils.getPaymentSocialAndFound(paymentInfo);
if (paymentVo != null && paymentVo.getData() != null && paymentVo.getData().getPaymentInfoList() != null) {
paymentInfoList = paymentVo.getData().getPaymentInfoList();
}
for (TPaymentInfo infoPayment: paymentInfoList) {
socialFundTax = BigDecimalUtils.safeAdd(infoPayment.getSocialSecurityPersonalSum(),
infoPayment.getPersonalProvidentSum());
}
List<TSalaryAccountItem> list1 = itemMap.get(infoVo.getEmpIdcard()); List<TSalaryAccountItem> list1 = itemMap.get(infoVo.getEmpIdcard());
if (Common.isNotNull(list1)) { if (Common.isNotNull(list1)) {
for (TSalaryAccountItem item: list1) { for (TSalaryAccountItem item: list1) {
if (SalaryConstants.SPECIAL_DEDU_MONEY_SUM_JAVA.equals(item.getJavaFiedName())) {
sdSumList.add(item.getSalaryMoney());
}
if (SalaryConstants.RELAY_SALARY_JAVA.equals(item.getJavaFiedName())) { if (SalaryConstants.RELAY_SALARY_JAVA.equals(item.getJavaFiedName())) {
ySalary.add(item.getSalaryMoney()); ySalary = ySalary.add(item.getSalaryMoney());
} }
if (SalaryConstants.SALARY_TAX_JAVA.equals(item.getJavaFiedName())) { if (item.getSettlementMonth().contains(CommonConstants.TWELVE_STRING)) {
sumTax = sumTax.add(item.getSalaryMoney()); //减除费用
if (SalaryConstants.COST_REDUCTION_JAVA.equals(item.getJavaFiedName())) {
costReductionList.add(item.getSalaryMoney());
}
//专项扣除
if (SalaryConstants.SPECIAL_DEDU_MONEY_SUM_JAVA.equals(item.getJavaFiedName())) {
sdSumList.add(item.getSalaryMoney());
}
} }
//减除费用 if (SalaryConstants.SALARY_TAX_JAVA.equals(item.getJavaFiedName())) {
if (SalaryConstants.COST_REDUCTION_JAVA.equals(item.getJavaFiedName())) { //12月份个税
costReduction = costReduction.add(item.getSalaryMoney()); if (item.getSettlementMonth().contains(CommonConstants.TWELVE_STRING)) {
twlSalaryTax = twlSalaryTax.add(item.getSalaryMoney());
} else {
//1-11月份个税
sumTax = sumTax.add(item.getSalaryMoney());
}
} }
if (SalaryConstants.PERSONAL_SOCIAL_JAVA.equals(item.getJavaFiedName())) { if (SalaryConstants.PERSONAL_SOCIAL_JAVA.equals(item.getJavaFiedName())) {
isTax = isTax.add(item.getSalaryMoney()); isTax = isTax.add(item.getSalaryMoney());
...@@ -282,11 +317,6 @@ public class TStatisticsBonusServiceImpl extends ServiceImpl<TStatisticsBonusMap ...@@ -282,11 +317,6 @@ public class TStatisticsBonusServiceImpl extends ServiceImpl<TStatisticsBonusMap
if (SalaryConstants.ONLY_CHILD_JAVA.equals(item.getJavaFiedName())) { if (SalaryConstants.ONLY_CHILD_JAVA.equals(item.getJavaFiedName())) {
isTax = isTax.add(item.getSalaryMoney()); isTax = isTax.add(item.getSalaryMoney());
} }
if (item.getSettlementMonth().contains(CommonConstants.TWELVE_STRING)) {
if (SalaryConstants.SALARY_TAX.equals(item.getJavaFiedName())) {
twlSalaryTax.add(item.getSalaryMoney());
}
}
} }
} }
if (CommonConstants.IS_TRUE.equals(infoVo.getIsTSend())) { if (CommonConstants.IS_TRUE.equals(infoVo.getIsTSend())) {
...@@ -295,20 +325,30 @@ public class TStatisticsBonusServiceImpl extends ServiceImpl<TStatisticsBonusMap ...@@ -295,20 +325,30 @@ public class TStatisticsBonusServiceImpl extends ServiceImpl<TStatisticsBonusMap
if (Common.isNotNull(sdSumList)) { if (Common.isNotNull(sdSumList)) {
sdSum = Collections.max(sdSumList); sdSum = Collections.max(sdSumList);
} }
sumDeductSalary = BigDecimalUtils.safeAdd(sdSum,isTax,costReduction); if (Common.isNotNull(costReductionList)) {
costReduction = Collections.max(costReductionList);
//年终奖合并扣税 }
//当月工资已发
if (isSend) { if (isSend) {
//年终奖单独扣税 //年终奖单独扣税
finalSalaryNoSalary = BigDecimalUtils.safeAdd(calculationSalary(annousTax,infoVo.getAnnualBonus()),twlSalaryTax); finalSalaryNoSalary = BigDecimalUtils.safeAdd(calculationSalary(annousTax,infoVo.getAnnualBonus()),twlSalaryTax);
wSalary = infoVo.getAnnualBonus(); wSalary = infoVo.getAnnualBonus();
finalSalaryWithSalary = finalSalaryNoSalary; finalSalaryWithSalary = BigDecimalUtils.safeSubtract(calculationSalaryT(personTax,
BigDecimalUtils.safeSubtract(BigDecimalUtils.safeAdd(ySalary,infoVo.getAnnualBonus()),
BigDecimalUtils.safeAdd(sdSum,isTax,costReduction))),sumTax);
//12月薪资扣除额合计
sumDeductSalary = BigDecimalUtils.safeAdd(sdSum,isTax,costReduction);
} else { } else {
//当月工资未发
//年终奖单独扣税 //年终奖单独扣税
BigDecimal annualTSalary = calculationSalaryT(personTax,infoVo.getAnnualTSalary());
finalSalaryNoSalary = BigDecimalUtils.safeAdd(calculationSalary(annousTax,infoVo.getAnnualBonus()),annualTSalary);
wSalary = BigDecimalUtils.safeAdd(infoVo.getAnnualBonus(), infoVo.getAnnualTSalary()); wSalary = BigDecimalUtils.safeAdd(infoVo.getAnnualBonus(), infoVo.getAnnualTSalary());
finalSalaryWithSalary = calculationSalary(annousTax, wSalary); finalSalaryNoSalary = calculationSalary(annousTax,wSalary);
//年终奖合并扣税
finalSalaryWithSalary = BigDecimalUtils.safeSubtract(calculationSalaryT(personTax,BigDecimalUtils.safeSubtract(
BigDecimalUtils.safeAdd(wSalary,ySalary),BigDecimalUtils.safeAdd(
infoVo.getDeductTaxSalary(),isTax))),sumTax);
//12月薪资扣除额合计
sumDeductSalary = BigDecimalUtils.safeAdd(isTax,infoVo.getDeductTaxSalary());
} }
if (BigDecimalUtils.safeSubtract(BigDecimalUtils.safeAdd(ySalary, wSalary), sumDeductSalary). if (BigDecimalUtils.safeSubtract(BigDecimalUtils.safeAdd(ySalary, wSalary), sumDeductSalary).
...@@ -317,8 +357,8 @@ public class TStatisticsBonusServiceImpl extends ServiceImpl<TStatisticsBonusMap ...@@ -317,8 +357,8 @@ public class TStatisticsBonusServiceImpl extends ServiceImpl<TStatisticsBonusMap
if (isSend) { if (isSend) {
maxAnualSalary = wSalary; maxAnualSalary = wSalary;
} else { } else {
minSalary = deductTaxSalary; minSalary = socialFundTax;
maxAnualSalary = BigDecimalUtils.safeSubtract(wSalary,deductTaxSalary); maxAnualSalary = BigDecimalUtils.safeSubtract(wSalary,socialFundTax);
} }
}else { }else {
minSalary = BigDecimalUtils.safeSubtract(wSalary,new BigDecimal("36000")); minSalary = BigDecimalUtils.safeSubtract(wSalary,new BigDecimal("36000"));
...@@ -330,8 +370,8 @@ public class TStatisticsBonusServiceImpl extends ServiceImpl<TStatisticsBonusMap ...@@ -330,8 +370,8 @@ public class TStatisticsBonusServiceImpl extends ServiceImpl<TStatisticsBonusMap
if (isSend) { if (isSend) {
maxAnualSalary = wSalary; maxAnualSalary = wSalary;
} else { } else {
minSalary = deductTaxSalary; minSalary = socialFundTax;
maxAnualSalary = BigDecimalUtils.safeSubtract(wSalary,deductTaxSalary); maxAnualSalary = BigDecimalUtils.safeSubtract(wSalary,socialFundTax);
} }
}else { }else {
minSalary = BigDecimalUtils.safeSubtract(wSalary,new BigDecimal("36000")); minSalary = BigDecimalUtils.safeSubtract(wSalary,new BigDecimal("36000"));
...@@ -343,8 +383,8 @@ public class TStatisticsBonusServiceImpl extends ServiceImpl<TStatisticsBonusMap ...@@ -343,8 +383,8 @@ public class TStatisticsBonusServiceImpl extends ServiceImpl<TStatisticsBonusMap
if (isSend) { if (isSend) {
maxAnualSalary = wSalary; maxAnualSalary = wSalary;
} else { } else {
minSalary = deductTaxSalary; minSalary = socialFundTax;
maxAnualSalary = BigDecimalUtils.safeSubtract(wSalary,deductTaxSalary); maxAnualSalary = BigDecimalUtils.safeSubtract(wSalary,socialFundTax);
} }
}else { }else {
minSalary = BigDecimalUtils.safeSubtract(wSalary,new BigDecimal("36000")); minSalary = BigDecimalUtils.safeSubtract(wSalary,new BigDecimal("36000"));
...@@ -356,8 +396,8 @@ public class TStatisticsBonusServiceImpl extends ServiceImpl<TStatisticsBonusMap ...@@ -356,8 +396,8 @@ public class TStatisticsBonusServiceImpl extends ServiceImpl<TStatisticsBonusMap
if (isSend) { if (isSend) {
maxAnualSalary = wSalary; maxAnualSalary = wSalary;
} else { } else {
minSalary = deductTaxSalary; minSalary = socialFundTax;
maxAnualSalary = BigDecimalUtils.safeSubtract(wSalary,deductTaxSalary); maxAnualSalary = BigDecimalUtils.safeSubtract(wSalary,socialFundTax);
} }
}else { }else {
minSalary = BigDecimalUtils.safeSubtract(wSalary,new BigDecimal("144000")); minSalary = BigDecimalUtils.safeSubtract(wSalary,new BigDecimal("144000"));
...@@ -369,8 +409,8 @@ public class TStatisticsBonusServiceImpl extends ServiceImpl<TStatisticsBonusMap ...@@ -369,8 +409,8 @@ public class TStatisticsBonusServiceImpl extends ServiceImpl<TStatisticsBonusMap
if (isSend) { if (isSend) {
maxAnualSalary = wSalary; maxAnualSalary = wSalary;
} else { } else {
minSalary = deductTaxSalary; minSalary = socialFundTax;
maxAnualSalary = BigDecimalUtils.safeSubtract(wSalary,deductTaxSalary); maxAnualSalary = BigDecimalUtils.safeSubtract(wSalary,socialFundTax);
} }
}else { }else {
minSalary = BigDecimalUtils.safeSubtract(wSalary,new BigDecimal("36000")); minSalary = BigDecimalUtils.safeSubtract(wSalary,new BigDecimal("36000"));
...@@ -382,8 +422,8 @@ public class TStatisticsBonusServiceImpl extends ServiceImpl<TStatisticsBonusMap ...@@ -382,8 +422,8 @@ public class TStatisticsBonusServiceImpl extends ServiceImpl<TStatisticsBonusMap
if (isSend) { if (isSend) {
maxAnualSalary = wSalary; maxAnualSalary = wSalary;
} else { } else {
minSalary = deductTaxSalary; minSalary = socialFundTax;
maxAnualSalary = BigDecimalUtils.safeSubtract(wSalary,deductTaxSalary); maxAnualSalary = BigDecimalUtils.safeSubtract(wSalary,socialFundTax);
} }
}else { }else {
minSalary = BigDecimalUtils.safeSubtract(wSalary,new BigDecimal("300000")); minSalary = BigDecimalUtils.safeSubtract(wSalary,new BigDecimal("300000"));
...@@ -395,8 +435,8 @@ public class TStatisticsBonusServiceImpl extends ServiceImpl<TStatisticsBonusMap ...@@ -395,8 +435,8 @@ public class TStatisticsBonusServiceImpl extends ServiceImpl<TStatisticsBonusMap
if (isSend) { if (isSend) {
maxAnualSalary = wSalary; maxAnualSalary = wSalary;
} else { } else {
minSalary = deductTaxSalary; minSalary = socialFundTax;
maxAnualSalary = BigDecimalUtils.safeSubtract(wSalary,deductTaxSalary); maxAnualSalary = BigDecimalUtils.safeSubtract(wSalary,socialFundTax);
} }
}else { }else {
minSalary = BigDecimalUtils.safeSubtract(wSalary,new BigDecimal("420000")); minSalary = BigDecimalUtils.safeSubtract(wSalary,new BigDecimal("420000"));
...@@ -408,28 +448,32 @@ public class TStatisticsBonusServiceImpl extends ServiceImpl<TStatisticsBonusMap ...@@ -408,28 +448,32 @@ public class TStatisticsBonusServiceImpl extends ServiceImpl<TStatisticsBonusMap
if (isSend) { if (isSend) {
maxAnualSalary = wSalary; maxAnualSalary = wSalary;
} else { } else {
minSalary = deductTaxSalary; minSalary = socialFundTax;
maxAnualSalary = BigDecimalUtils.safeSubtract(wSalary,deductTaxSalary); maxAnualSalary = BigDecimalUtils.safeSubtract(wSalary,socialFundTax);
} }
}else { }else {
minSalary = BigDecimalUtils.safeSubtract(wSalary,new BigDecimal("660000")); minSalary = BigDecimalUtils.safeSubtract(wSalary,new BigDecimal("660000"));
maxAnualSalary = new BigDecimal("660000"); maxAnualSalary = new BigDecimal("660000");
} }
} }
JSONObject jsonObject = calculationPersonSalary(personTax, annousTax,minSalary, maxAnualSalary, wSalary, sumTax);
JSONObject jsonObject = calculationPersonSalary(personTax, annousTax, minSalary, maxAnualSalary,
wSalary, sumTax, ySalary, sumDeductSalary, twlSalaryTax);
res = jsonObject.getBigDecimal("zySalary"); res = jsonObject.getBigDecimal("zySalary");
Map<String,BigDecimal> map = jsonObject.getObject("anRes",Map.class); BigDecimal anRes = BigDecimal.ZERO;
if (Common.isNotNull(jsonObject.getBigDecimal("anRes"))) {
anRes = jsonObject.getBigDecimal("anRes");
}
infoVo.setBestPlanTax(res); infoVo.setBestPlanTax(res);
infoVo.setAnnualATax(finalSalaryNoSalary); infoVo.setAnnualATax(finalSalaryNoSalary);
infoVo.setAnnualSTax(finalSalaryWithSalary); infoVo.setAnnualSTax(finalSalaryWithSalary);
infoVo.setBestPlanTSalary(map.get(res.toString())); infoVo.setBestPlanTSalary(anRes);
infoVo.setBestPlanBonus(BigDecimalUtils.safeSubtract(wSalary,map.get(res.toString()))); infoVo.setBestPlanBonus(BigDecimalUtils.safeSubtract(wSalary,anRes));
} }
if (Common.isNotNull(list)) { if (Common.isNotNull(list)) {
WriteSheet writeSheet = EasyExcel.writerSheet("全年一次性奖金测算").build(); WriteSheet writeSheet = EasyExcel.writerSheet("全年一次性奖金测算").build();
excelWriter.write(list, writeSheet); excelWriter.write(list, writeSheet);
} }
}else { }else {
WriteSheet writeSheet = EasyExcel.writerSheet("全年一次性奖金测算").build(); WriteSheet writeSheet = EasyExcel.writerSheet("全年一次性奖金测算").build();
excelWriter.write(list,writeSheet); excelWriter.write(list,writeSheet);
...@@ -466,29 +510,39 @@ public class TStatisticsBonusServiceImpl extends ServiceImpl<TStatisticsBonusMap ...@@ -466,29 +510,39 @@ public class TStatisticsBonusServiceImpl extends ServiceImpl<TStatisticsBonusMap
**/ **/
private static JSONObject calculationPersonSalary(List<TSalaryTaxConfig> personTax, List<TSalaryTaxConfig> annousTax, private static JSONObject calculationPersonSalary(List<TSalaryTaxConfig> personTax, List<TSalaryTaxConfig> annousTax,
BigDecimal minSalary, BigDecimal maxAnualSalary, BigDecimal minSalary, BigDecimal maxAnualSalary,
BigDecimal wSalary, BigDecimal sumTax) { BigDecimal wSalary, BigDecimal sumTax, BigDecimal ySalary,
BigDecimal sumDeductSalary, BigDecimal twlSalaryTax) {
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
BigDecimal anRes; BigDecimal anRes;
BigDecimal res;
List<BigDecimal> zySalary = new ArrayList<>(); List<BigDecimal> zySalary = new ArrayList<>();
Map<String,BigDecimal> map = new HashMap<>(); Map<String,BigDecimal> map = new HashMap<>();
for (BigDecimal i = minSalary; i.compareTo(maxAnualSalary) <= 0; i = BigDecimalUtils.safeAdd(i,new BigDecimal(100)) ) { for (BigDecimal i = minSalary; i.compareTo(maxAnualSalary) <= 0; i = BigDecimalUtils.safeAdd(i,new BigDecimal(100)) ) {
//本次薪资纳税额 //本次薪资纳税额
BigDecimal res = BigDecimal.ZERO; res = BigDecimal.ZERO;
//本次年终奖纳税额 //本次年终奖纳税额
anRes = BigDecimal.ZERO;; anRes = BigDecimal.ZERO;;
//年终奖金额 //年终奖金额
BigDecimal annous = BigDecimalUtils.safeSubtract(wSalary,i); BigDecimal annous = BigDecimalUtils.safeSubtract(wSalary,i);
log.info("薪资应发:" + i.toString());
//计算个税 //计算个税
for (TSalaryTaxConfig sub : personTax) { if (i.compareTo(BigDecimal.ZERO) == SalaryConstants.MORE_THAN ) {
if (i.compareTo(sub.getMinIncome()) == SalaryConstants.MORE_THAN BigDecimal sumI = BigDecimalUtils.safeSubtract(BigDecimalUtils.safeAdd(i,ySalary),
&& i.compareTo(sub.getMaxIncome()) != SalaryConstants.MORE_THAN) { BigDecimalUtils.safeAdd(sumDeductSalary));
//i = realDeduSalary * ((double) ((i.getTaxRate() * 1.0) / 100)) - sumTax - sub.getQuick(); for (TSalaryTaxConfig sub : personTax) {
res = i.multiply(new BigDecimal(sub.getWithholdingRate()).divide( if (sumI.compareTo(sub.getMinIncome()) == SalaryConstants.MORE_THAN
SalaryConstants.B_ONEHUNDRED, SalaryConstants.PLACES, BigDecimal.ROUND_HALF_UP)) && sumI.compareTo(sub.getMaxIncome()) != SalaryConstants.MORE_THAN) {
.subtract(sumTax).subtract(sub.getQuickDeducation());// 应纳税额 //sumI = realDeduSalary * ((double) ((i.getTaxRate() * 1.0) / 100)) - sumTax - sub.getQuick();
break; res = BigDecimalUtils.safeSubtract(sumI.multiply(new BigDecimal(sub.getWithholdingRate()).divide(
SalaryConstants.B_ONEHUNDRED, SalaryConstants.PLACES, BigDecimal.ROUND_HALF_UP)),
BigDecimalUtils.safeAdd(sumTax,sub.getQuickDeducation()));
break;
}
} }
} }
BigDecimal a = BigDecimal.ZERO;
a = BigDecimalUtils.safeAdd(res,twlSalaryTax);
log.info("薪资个税:" + a.toString());
//计算年终奖税 //计算年终奖税
//年终奖 //年终奖
if (annous != null && annous.compareTo(SalaryConstants.B_ZERO) == SalaryConstants.MORE_THAN if (annous != null && annous.compareTo(SalaryConstants.B_ZERO) == SalaryConstants.MORE_THAN
...@@ -504,15 +558,17 @@ public class TStatisticsBonusServiceImpl extends ServiceImpl<TStatisticsBonusMap ...@@ -504,15 +558,17 @@ public class TStatisticsBonusServiceImpl extends ServiceImpl<TStatisticsBonusMap
break; break;
} }
} }
log.info("年终奖应发:" + annous.toString());
log.info("年终奖个税:" + anRes.toString());
} }
zySalary.add(BigDecimalUtils.safeAdd(res,anRes)); zySalary.add(BigDecimalUtils.safeAdd(res,anRes,twlSalaryTax));
map.put(BigDecimalUtils.safeAdd(res,anRes).toString(),i); map.put(BigDecimalUtils.safeAdd(res,anRes,twlSalaryTax).toString(),i);
} }
BigDecimal salary = BigDecimal.ZERO; BigDecimal salary = BigDecimal.ZERO;
if (Common.isNotNull(zySalary)) { if (Common.isNotNull(zySalary)) {
salary = Collections.min(zySalary); salary = Collections.min(zySalary);
} }
jsonObject.put("anRes",map); jsonObject.put("anRes",map.get(salary.toString()));
jsonObject.put("zySalary",salary); jsonObject.put("zySalary",salary);
map.clear(); map.clear();
zySalary.clear(); zySalary.clear();
......
...@@ -434,6 +434,36 @@ ...@@ -434,6 +434,36 @@
AND a.DELETE_FLAG = 0 and a.FORM_TYPE != 7 AND a.DELETE_FLAG = 0 and a.FORM_TYPE != 7
</where> </where>
</select> </select>
<!-- 获取所有数据,组装map,工资导入使用 -->
<select id="getSalaryItemVoList" resultMap="itemVoMap">
SELECT
i.ID,
i.SALARY_ACCOUNT_ID,
i.CN_NAME,
i.JAVA_FIED_NAME,
i.SALARY_MONEY,
i.TEXT_VALUE,
i.IS_TAX,
a.EMP_IDCARD,
a.SETTLEMENT_MONTH,
a.FORM_TYPE
FROM
t_salary_account_item i left join t_salary_account a on i.SALARY_ACCOUNT_ID = a.ID
<where>
a.SETTLEMENT_MONTH like DATE_FORMAT(now(),"%Y%")
<if test="idCardList != null">
AND a.EMP_IDCARD in
<foreach item="item" index="index" collection="idCardList" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="invoiceTitle != null and invoiceTitle.trim() != ''">
AND a.INVOICE_TITLE = #{invoiceTitle}
</if>
AND a.DELETE_FLAG = 0 and a.FORM_TYPE = 0
</where>
</select>
<select id="getSumByAccountId" resultType="java.util.Map"> <select id="getSumByAccountId" resultType="java.util.Map">
SELECT SELECT
a.SALARY_ACCOUNT_ID as 'key', a.SALARY_ACCOUNT_ID as 'key',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment