|
@@ -6,6 +6,7 @@ import org.apache.commons.lang.StringUtils;
|
|
|
import org.apache.shiro.SecurityUtils;
|
|
|
import org.jeecg.common.api.vo.Result;
|
|
|
import org.jeecg.common.system.vo.LoginUser;
|
|
|
+import org.jeecg.common.util.DateUtils;
|
|
|
import org.jeecg.common.util.encryption.AesEncryptUtil;
|
|
|
import org.jeecg.modules.salary.entity.*;
|
|
|
import org.jeecg.modules.salary.mapper.*;
|
|
@@ -36,6 +37,8 @@ public class SalaryManagementServiceImpl extends ServiceImpl<SalaryManagementMap
|
|
|
private SalaryManagementWorkOvertimeMapper salaryManagementWorkOvertimeMapper;
|
|
|
@Autowired
|
|
|
private SalaryManagementHolidayMapper salaryManagementHolidayMapper;
|
|
|
+ @Autowired
|
|
|
+ private SalaryManagementExtraMapper salaryManagementExtraMapper;
|
|
|
|
|
|
@Autowired
|
|
|
private SalaryAttendanceDetailMapper salaryAttendanceDetailMapper;
|
|
@@ -52,8 +55,13 @@ public class SalaryManagementServiceImpl extends ServiceImpl<SalaryManagementMap
|
|
|
String endDate = userParams.getEndDate();
|
|
|
|
|
|
try {
|
|
|
+ BigDecimal wagesNew = new BigDecimal("0");//基本薪资合计
|
|
|
|
|
|
for (SalaryChangeRecord o : pageList) {
|
|
|
+
|
|
|
+ BigDecimal wages = new BigDecimal(o.getBeforeAdjustment()==null || o.getBeforeAdjustment()=="" ? "0":o.getBeforeAdjustment());//基本薪资合计
|
|
|
+ wagesNew = wagesNew.add(wages);
|
|
|
+
|
|
|
String userId = o.getUserId();
|
|
|
List<SalaryManagementDetail> detailList = salaryManagementDetailMapper.selectByUserTotal(userId, beginDate, endDate);
|
|
|
List<SalaryManagementWorkOvertime> overTimeList = salaryManagementWorkOvertimeMapper.selectByUserTotal(userId, beginDate, endDate);
|
|
@@ -64,12 +72,9 @@ public class SalaryManagementServiceImpl extends ServiceImpl<SalaryManagementMap
|
|
|
BigDecimal housingSubsidies = new BigDecimal("0");//住房补贴
|
|
|
BigDecimal transportation = new BigDecimal("0");//交通补贴
|
|
|
BigDecimal fullAttendance = new BigDecimal("0");//全勤奖
|
|
|
-
|
|
|
BigDecimal overtimePay = new BigDecimal("0");//加班工资
|
|
|
BigDecimal yearSalary = new BigDecimal("0");//年休工资
|
|
|
-
|
|
|
BigDecimal totalPayable = new BigDecimal("0");//合计应发String
|
|
|
-
|
|
|
BigDecimal socialSecurity = new BigDecimal("0");//社保
|
|
|
BigDecimal accumulationFund = new BigDecimal("0");//公积金
|
|
|
BigDecimal personalTax = new BigDecimal("0");//个税
|
|
@@ -78,12 +83,11 @@ public class SalaryManagementServiceImpl extends ServiceImpl<SalaryManagementMap
|
|
|
BigDecimal sickCost = new BigDecimal("0");//病假扣费
|
|
|
BigDecimal marriageCost = new BigDecimal("0");//婚假扣费
|
|
|
BigDecimal funeralCost = new BigDecimal("0");//丧假扣费
|
|
|
-
|
|
|
BigDecimal totalDeduction = new BigDecimal("0");//合计应扣
|
|
|
-
|
|
|
BigDecimal actualOccurrence = new BigDecimal("0");//实发合计String
|
|
|
|
|
|
for (SalaryManagementDetail d : detailList) {
|
|
|
+
|
|
|
phoneBill = phoneBill.add(d.getPhoneBill() == null ? BigDecimal.ZERO : d.getPhoneBill());
|
|
|
lunch = lunch.add(d.getLunch() == null ? BigDecimal.ZERO : d.getLunch());
|
|
|
housingSubsidies = housingSubsidies.add(d.getHousingSubsidies() == null ? BigDecimal.ZERO : d.getHousingSubsidies());
|
|
@@ -155,7 +159,7 @@ public class SalaryManagementServiceImpl extends ServiceImpl<SalaryManagementMap
|
|
|
o.setFullAttendance(fullAttendance);
|
|
|
o.setOvertimePay(overtimePay);
|
|
|
o.setYearSalary(yearSalary);
|
|
|
- o.setTotalPayable(totalPayable.toString());
|
|
|
+ o.setTotalPayable(totalPayable);
|
|
|
o.setSocialSecurity(socialSecurity);
|
|
|
o.setAccumulationFund(accumulationFund);
|
|
|
o.setLatenessCost(latenessCost);
|
|
@@ -165,10 +169,29 @@ public class SalaryManagementServiceImpl extends ServiceImpl<SalaryManagementMap
|
|
|
o.setMarriageCost(marriageCost);
|
|
|
o.setFuneralCost(funeralCost);
|
|
|
o.setTotalDeduction(totalDeduction);
|
|
|
- o.setActualOccurrence(actualOccurrence.toString());
|
|
|
+ o.setActualOccurrence(actualOccurrence);
|
|
|
+
|
|
|
+ userParams.setPhoneBill(phoneBill.add(userParams.getPhoneBill() == null ? BigDecimal.ZERO : userParams.getPhoneBill()));
|
|
|
+ userParams.setLunch(lunch.add(userParams.getLunch() == null ? BigDecimal.ZERO : userParams.getLunch()));
|
|
|
+ userParams.setHousingSubsidies(housingSubsidies.add(userParams.getHousingSubsidies() == null ? BigDecimal.ZERO : userParams.getHousingSubsidies()));
|
|
|
+ userParams.setTransportation(transportation.add(userParams.getTransportation() == null ? BigDecimal.ZERO : userParams.getTransportation()));
|
|
|
+ userParams.setFullAttendance(fullAttendance.add(userParams.getFullAttendance() == null ? BigDecimal.ZERO : userParams.getFullAttendance()));
|
|
|
+ userParams.setOvertimePay(overtimePay.add(userParams.getOvertimePay() == null ? BigDecimal.ZERO : userParams.getOvertimePay()));
|
|
|
+ userParams.setYearSalary(yearSalary.add(userParams.getYearSalary() == null ? BigDecimal.ZERO : userParams.getYearSalary()));
|
|
|
+ userParams.setTotalPayable(totalPayable.add(userParams.getTotalPayable() == null ? BigDecimal.ZERO : userParams.getTotalPayable()));
|
|
|
+ userParams.setSocialSecurity(socialSecurity.add(userParams.getSocialSecurity() == null ? BigDecimal.ZERO : userParams.getSocialSecurity()));
|
|
|
+ userParams.setAccumulationFund(accumulationFund.add(userParams.getAccumulationFund() == null ? BigDecimal.ZERO : userParams.getAccumulationFund()));
|
|
|
+ userParams.setPersonalTax(personalTax.add(userParams.getPersonalTax() == null ? BigDecimal.ZERO : userParams.getPersonalTax()));
|
|
|
+ userParams.setLatenessCost(latenessCost.add(userParams.getLatenessCost() == null ? BigDecimal.ZERO : userParams.getLatenessCost()));
|
|
|
+ userParams.setPersonalCost(personalCost.add(userParams.getPersonalCost() == null ? BigDecimal.ZERO : userParams.getPersonalCost()));
|
|
|
+ userParams.setSickCost(sickCost.add(userParams.getSickCost() == null ? BigDecimal.ZERO : userParams.getSickCost()));
|
|
|
+ userParams.setMarriageCost(marriageCost.add(userParams.getMarriageCost() == null ? BigDecimal.ZERO : userParams.getMarriageCost()));
|
|
|
+ userParams.setFuneralCost(funeralCost.add(userParams.getFuneralCost() == null ? BigDecimal.ZERO : userParams.getFuneralCost()));
|
|
|
+ userParams.setTotalDeduction(totalDeduction.add(userParams.getTotalDeduction() == null ? BigDecimal.ZERO : userParams.getTotalDeduction()));
|
|
|
+ userParams.setActualOccurrence(actualOccurrence.add(userParams.getActualOccurrence() == null ? BigDecimal.ZERO : userParams.getActualOccurrence()));
|
|
|
|
|
|
}
|
|
|
-
|
|
|
+ userParams.setBeforeAdjustment(wagesNew.toString());
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
@@ -185,6 +208,200 @@ public class SalaryManagementServiceImpl extends ServiceImpl<SalaryManagementMap
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ @Transactional
|
|
|
+ public void saveMainExtra(SalaryManagement salaryManagement, List<SalaryManagementExtra> salaryManagementExtraList) throws Exception {
|
|
|
+
|
|
|
+ String yearWithMonth = salaryManagement.getYearWithMonth();
|
|
|
+ String type = salaryManagement.getType();
|
|
|
+
|
|
|
+ SalaryManagement salaryManagementMFY = new SalaryManagement(); //马非羊
|
|
|
+ SalaryManagement salaryManagementNBSY = new SalaryManagement();//宁波森语
|
|
|
+ SalaryManagement salaryManagementZZ = new SalaryManagement();//正织
|
|
|
+
|
|
|
+ //发放薪资合计(用于主表统计)
|
|
|
+ BigDecimal salaryMFY = new BigDecimal("0");
|
|
|
+ BigDecimal salaryNBSY = new BigDecimal("0");
|
|
|
+ BigDecimal salaryZZ = new BigDecimal("0");
|
|
|
+
|
|
|
+ //个税合计(用于主表统计)
|
|
|
+ BigDecimal personalTaxMFY = new BigDecimal("0");
|
|
|
+ BigDecimal personalTaxNBSY = new BigDecimal("0");
|
|
|
+ BigDecimal personalTaxZZ = new BigDecimal("0");
|
|
|
+
|
|
|
+ //附加信息
|
|
|
+ BigDecimal top36000 = new BigDecimal("36000");
|
|
|
+ BigDecimal top144000 = new BigDecimal("144000");
|
|
|
+ BigDecimal top300000 = new BigDecimal("300000");
|
|
|
+ BigDecimal top420000 = new BigDecimal("420000");
|
|
|
+ BigDecimal top660000 = new BigDecimal("660000");
|
|
|
+ BigDecimal top960000 = new BigDecimal("960000");
|
|
|
+
|
|
|
+ BigDecimal tax003 = new BigDecimal("0.03");
|
|
|
+ BigDecimal Tax01 = new BigDecimal("0.1");
|
|
|
+ BigDecimal Tax02 = new BigDecimal("0.2");
|
|
|
+ BigDecimal Tax025 = new BigDecimal("0.25");
|
|
|
+ BigDecimal Tax03 = new BigDecimal("0.3");
|
|
|
+ BigDecimal Tax035 = new BigDecimal("0.35");
|
|
|
+ BigDecimal Tax045 = new BigDecimal("0.45");
|
|
|
+
|
|
|
+ //月度工资单
|
|
|
+ List<SalaryManagementExtra> salaryAttendanceDetailListMFY = new ArrayList<>();//马非羊
|
|
|
+ List<SalaryManagementExtra> salaryAttendanceDetailListNBSY = new ArrayList<>();//宁波森语
|
|
|
+ List<SalaryManagementExtra> salaryAttendanceDetailListZZ = new ArrayList<>();//正织
|
|
|
+
|
|
|
+ if ("福利现金".equals(type)) {
|
|
|
+
|
|
|
+ for(SalaryManagementExtra o:salaryManagementExtraList){
|
|
|
+
|
|
|
+ String org = o.getOrgName();
|
|
|
+ String beforeTaxAmountTxt = o.getBeforeTaxAmount();
|
|
|
+
|
|
|
+ BigDecimal beforeTaxAmount = new BigDecimal(beforeTaxAmountTxt);
|
|
|
+ //加密后金额
|
|
|
+ String beforeTaxAmountEn = AesEncryptUtil.encrypt(String.format("%.2f", beforeTaxAmount));
|
|
|
+
|
|
|
+ if("马菲羊".equals(org)){
|
|
|
+
|
|
|
+ salaryMFY = salaryMFY.add(beforeTaxAmount);
|
|
|
+ salaryAttendanceDetailListMFY.add(o);
|
|
|
+
|
|
|
+ }else if("正织".equals(org)){
|
|
|
+
|
|
|
+ salaryZZ = salaryZZ.add(beforeTaxAmount);
|
|
|
+ salaryAttendanceDetailListZZ.add(o);
|
|
|
+
|
|
|
+ }else if("森语".equals(org)){
|
|
|
+
|
|
|
+ salaryNBSY = salaryNBSY.add(beforeTaxAmount);
|
|
|
+ salaryAttendanceDetailListNBSY.add(o);
|
|
|
+
|
|
|
+ }
|
|
|
+ o.setType("0");//0福利现金 1年终奖
|
|
|
+ o.setPersonalTax(new BigDecimal("0"));//个税
|
|
|
+ o.setBeforeTaxAmount(beforeTaxAmountEn);//税前金额
|
|
|
+ o.setAfterTaxAmount(beforeTaxAmountEn);//税后金额
|
|
|
+ o.setPayTaxes(beforeTaxAmountEn);//应纳税所得额
|
|
|
+ o.setCalculate("0");//0未计算,1计算
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ salaryManagementMFY.setSalary(AesEncryptUtil.encrypt(String.format("%.2f", salaryMFY)));
|
|
|
+ salaryManagementMFY.setPersonalTax("HV3ndEx8HV9kd1WNbxLgwg==");// 0.00
|
|
|
+
|
|
|
+ salaryManagementZZ.setSalary(AesEncryptUtil.encrypt(String.format("%.2f", salaryZZ)));
|
|
|
+ salaryManagementZZ.setPersonalTax("HV3ndEx8HV9kd1WNbxLgwg==");// 0.00
|
|
|
+
|
|
|
+ salaryManagementNBSY.setSalary(AesEncryptUtil.encrypt(String.format("%.2f", salaryNBSY)));
|
|
|
+ salaryManagementNBSY.setPersonalTax("HV3ndEx8HV9kd1WNbxLgwg==");// 0.00
|
|
|
+
|
|
|
+ saveExtra(type,yearWithMonth,salaryManagementMFY,salaryManagementNBSY,salaryManagementZZ
|
|
|
+ ,salaryAttendanceDetailListMFY,salaryAttendanceDetailListNBSY,salaryAttendanceDetailListZZ);
|
|
|
+
|
|
|
+
|
|
|
+ }else{
|
|
|
+
|
|
|
+ //年终奖
|
|
|
+ for(SalaryManagementExtra o:salaryManagementExtraList){
|
|
|
+
|
|
|
+ String org = o.getOrgName();
|
|
|
+ String beforeTaxAmountTxt = o.getBeforeTaxAmount();
|
|
|
+ BigDecimal beforeTaxAmount = new BigDecimal(beforeTaxAmountTxt);
|
|
|
+ //加密后金额
|
|
|
+ String beforeTaxAmountEn = AesEncryptUtil.encrypt(String.format("%.2f", beforeTaxAmount));
|
|
|
+
|
|
|
+ //累计个税 = 本年度当前人员所有已缴纳个税
|
|
|
+ BigDecimal cumulativeTax = new BigDecimal("0");
|
|
|
+ //累计所得额 = 本年度当前人员所有应纳税所得之和
|
|
|
+ BigDecimal cumulative = beforeTaxAmount;
|
|
|
+
|
|
|
+ //个税 = 累计所得额 * 对应税率 - 速算扣除数 - 累计税额 ===========================
|
|
|
+ BigDecimal personalTax = new BigDecimal("0");
|
|
|
+
|
|
|
+ if(cumulative.compareTo(BigDecimal.ZERO) == 0){
|
|
|
+ //如果应纳税额为0 则个税默认为0
|
|
|
+ }else{
|
|
|
+ if (top36000.compareTo(cumulative) != -1) { //top36000 >= cumulative
|
|
|
+ personalTax = cumulative.multiply(tax003).subtract(cumulativeTax);
|
|
|
+ }
|
|
|
+ if (top144000.compareTo(cumulative) != -1 && cumulative.compareTo(top36000) == 1) { //top144000 >= cumulative && cumulative > top36000
|
|
|
+ personalTax = cumulative.multiply(Tax01).subtract(new BigDecimal("2520")).subtract(cumulativeTax);
|
|
|
+ }
|
|
|
+ if (top300000.compareTo(cumulative) != -1 && cumulative.compareTo(top144000) == 1) { //top144000 >= cumulative && cumulative > top36000
|
|
|
+ personalTax = cumulative.multiply(Tax02).subtract(new BigDecimal("16920")).subtract(cumulativeTax);;
|
|
|
+ }
|
|
|
+ if (top420000.compareTo(cumulative) != -1 && cumulative.compareTo(top300000) == 1) { //top144000 >= cumulative && cumulative > top36000
|
|
|
+ personalTax = cumulative.multiply(Tax025).subtract(new BigDecimal("31920")).subtract(cumulativeTax);;
|
|
|
+ }
|
|
|
+ if (top660000.compareTo(cumulative) != -1 && cumulative.compareTo(top420000) == 1) { //top144000 >= cumulative && cumulative > top36000
|
|
|
+ personalTax = cumulative.multiply(Tax03).subtract(new BigDecimal("52920")).subtract(cumulativeTax);;
|
|
|
+ }
|
|
|
+ if (top960000.compareTo(cumulative) != -1 && cumulative.compareTo(top660000) == 1) { //top144000 >= cumulative && cumulative > top36000
|
|
|
+ personalTax = cumulative.multiply(Tax035).subtract(new BigDecimal("85920")).subtract(cumulativeTax);;
|
|
|
+ }
|
|
|
+ if (cumulative.compareTo(top960000) == 1) { //cumulative > top960000
|
|
|
+ personalTax = cumulative.multiply(Tax045).subtract(new BigDecimal("181920")).subtract(cumulativeTax);;
|
|
|
+ }
|
|
|
+ if(personalTax.compareTo(new BigDecimal("0")) < 0){
|
|
|
+ personalTax = new BigDecimal("0");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ o.setPersonalTax(personalTax);//个税
|
|
|
+
|
|
|
+ BigDecimal afterTaxAmount = beforeTaxAmount.subtract(personalTax);
|
|
|
+ //加密税后金额
|
|
|
+ String afterTaxAmountEn = AesEncryptUtil.encrypt(String.format("%.2f", afterTaxAmount));
|
|
|
+ o.setAfterTaxAmount(afterTaxAmountEn);//税后金额
|
|
|
+
|
|
|
+ if("马菲羊".equals(org)){
|
|
|
+
|
|
|
+ salaryMFY = salaryMFY.add(afterTaxAmount);
|
|
|
+ personalTaxMFY = personalTaxMFY.add(personalTax);
|
|
|
+
|
|
|
+ salaryAttendanceDetailListMFY.add(o);
|
|
|
+
|
|
|
+ }else if("正织".equals(org)){
|
|
|
+
|
|
|
+ salaryZZ = salaryZZ.add(afterTaxAmount);
|
|
|
+ personalTaxZZ = personalTaxZZ.add(personalTax);
|
|
|
+
|
|
|
+ salaryAttendanceDetailListZZ.add(o);
|
|
|
+
|
|
|
+ }else if("森语".equals(org)){
|
|
|
+
|
|
|
+ salaryNBSY = salaryNBSY.add(afterTaxAmount);
|
|
|
+ personalTaxNBSY = personalTaxNBSY.add(personalTax);
|
|
|
+
|
|
|
+ salaryAttendanceDetailListNBSY.add(o);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ o.setType("1");//0福利现金 1年终奖
|
|
|
+ o.setBeforeTaxAmount(beforeTaxAmountEn);//税前金额
|
|
|
+ o.setPayTaxes(beforeTaxAmountEn);//应纳税所得额
|
|
|
+ o.setCalculate("0");//0未计算,1计算
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ salaryManagementMFY.setSalary(AesEncryptUtil.encrypt(String.format("%.2f", salaryMFY)));
|
|
|
+ salaryManagementMFY.setPersonalTax(AesEncryptUtil.encrypt(String.format("%.2f", personalTaxMFY)));// 0.00
|
|
|
+
|
|
|
+ salaryManagementZZ.setSalary(AesEncryptUtil.encrypt(String.format("%.2f", salaryZZ)));
|
|
|
+ salaryManagementZZ.setPersonalTax(AesEncryptUtil.encrypt(String.format("%.2f", personalTaxZZ)));// 0.00
|
|
|
+
|
|
|
+ salaryManagementNBSY.setSalary(AesEncryptUtil.encrypt(String.format("%.2f", salaryNBSY)));
|
|
|
+ salaryManagementNBSY.setPersonalTax(AesEncryptUtil.encrypt(String.format("%.2f", personalTaxNBSY)));// 0.00
|
|
|
+
|
|
|
+ saveExtra(type,yearWithMonth,salaryManagementMFY,salaryManagementNBSY,salaryManagementZZ
|
|
|
+ ,salaryAttendanceDetailListMFY,salaryAttendanceDetailListNBSY,salaryAttendanceDetailListZZ);
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
@Transactional
|
|
|
public void updateMain(SalaryManagement salaryManagement, List<SalaryManagementDetail> salaryManagementDetailList) {
|
|
@@ -217,6 +434,55 @@ public class SalaryManagementServiceImpl extends ServiceImpl<SalaryManagementMap
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ @Transactional
|
|
|
+ public Result<?> generatePayrollBefore(SalaryManagement salaryManagement) {
|
|
|
+
|
|
|
+ String type = salaryManagement.getType();//月度工资单、年休工资单、加班工资单
|
|
|
+
|
|
|
+ if (StringUtils.isBlank(type)) {
|
|
|
+ return Result.error("参数异常type、yearWithMonth");
|
|
|
+ }
|
|
|
+
|
|
|
+ String yearWithMonth = salaryManagement.getYearWithMonth();
|
|
|
+ String yearWith = salaryManagement.getYearWith();
|
|
|
+
|
|
|
+ if ("月度工资单".equals(type)) {
|
|
|
+
|
|
|
+ QueryWrapper<SalaryManagement> queryWrapper = new QueryWrapper<>();
|
|
|
+ queryWrapper.eq("del_flag", "0");
|
|
|
+ queryWrapper.eq("year_with_month", yearWithMonth);
|
|
|
+ queryWrapper.eq("type", "月度工资单");
|
|
|
+ List<SalaryManagement> list = salaryManagementMapper.selectList(queryWrapper);
|
|
|
+ if(list.size() > 0){
|
|
|
+ return Result.error("已生成过"+yearWithMonth+"月度工资单,是否重新生成?");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if ("年休工资单".equals(type)) {
|
|
|
+ QueryWrapper<SalaryManagement> queryWrapper = new QueryWrapper<>();
|
|
|
+ queryWrapper.eq("del_flag", "0");
|
|
|
+ queryWrapper.eq("year_with_month", yearWith);
|
|
|
+ queryWrapper.eq("type", "年休工资单");
|
|
|
+ List<SalaryManagement> list = salaryManagementMapper.selectList(queryWrapper);
|
|
|
+ if(list.size() > 0){
|
|
|
+ return Result.error("已生成过"+yearWith+"年休工资单,是否重新生成?");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if ("加班工资单".equals(type)) {
|
|
|
+ QueryWrapper<SalaryManagement> queryWrapper = new QueryWrapper<>();
|
|
|
+ queryWrapper.eq("del_flag", "0");
|
|
|
+ queryWrapper.eq("year_with_month", yearWithMonth);
|
|
|
+ queryWrapper.eq("type", "加班工资单");
|
|
|
+ List<SalaryManagement> list = salaryManagementMapper.selectList(queryWrapper);
|
|
|
+ if(list.size() > 0){
|
|
|
+ return Result.error("已生成过"+yearWithMonth+"加班工资单,是否重新生成?");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return Result.ok();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
@Override
|
|
|
@Transactional
|
|
|
public Result<?> generatePayroll(SalaryManagement salaryManagement) {
|
|
@@ -239,6 +505,33 @@ public class SalaryManagementServiceImpl extends ServiceImpl<SalaryManagementMap
|
|
|
}
|
|
|
String withMonth = yearWithMonth.substring(0, 4);
|
|
|
|
|
|
+ QueryWrapper<SalaryManagement> queryWrapper1 = new QueryWrapper<>();
|
|
|
+ queryWrapper1.eq("del_flag", "0");
|
|
|
+ queryWrapper1.ne("salary", "nghotxDTNyeHgH0mlfbJig==");
|
|
|
+ queryWrapper1.ne("salary", "HV3ndEx8HV9kd1WNbxLgwg==");
|
|
|
+ queryWrapper1.ne("type", "福利现金");
|
|
|
+ queryWrapper1.ne("type", "年终奖");
|
|
|
+ if(type.equals("年休工资单")){
|
|
|
+
|
|
|
+ queryWrapper1.likeRight("year_with_month",yearWith);
|
|
|
+ queryWrapper1.last("and generation_time > " +
|
|
|
+ "(select generation_time from salary_management where year_with_month ='"+yearWith+"' and type ='年休工资单' and del_flag=0 limit 1 ) ");
|
|
|
+ }else if(type.equals("加班工资单")){
|
|
|
+
|
|
|
+ queryWrapper1.likeRight("year_with_month",withMonth);
|
|
|
+ queryWrapper1.last("and (year_with_month > '"+yearWithMonth+"' or generation_time > " +
|
|
|
+ "(select generation_time from salary_management where year_with_month ='"+yearWithMonth+"' and type ='加班工资单' and del_flag=0 limit 1 ) ) ");
|
|
|
+ }else{
|
|
|
+
|
|
|
+ queryWrapper1.likeRight("year_with_month",withMonth);
|
|
|
+ queryWrapper1.last("and (year_with_month > '"+yearWithMonth+"' or generation_time > " +
|
|
|
+ "(select generation_time from salary_management where year_with_month ='"+yearWithMonth+"' and type ='月度工资单' and del_flag=0 limit 1 ) ) ");
|
|
|
+ }
|
|
|
+
|
|
|
+ List<SalaryManagement> list1 = salaryManagementMapper.selectList(queryWrapper1);
|
|
|
+ if(list1.size() > 0){
|
|
|
+ return Result.error("后续薪资已计算,无法生成此月工资单!!");
|
|
|
+ }
|
|
|
|
|
|
SalaryManagement salaryManagementMFY = new SalaryManagement(); //马非羊
|
|
|
SalaryManagement salaryManagementNBSY = new SalaryManagement();//宁波森语
|
|
@@ -270,6 +563,8 @@ public class SalaryManagementServiceImpl extends ServiceImpl<SalaryManagementMap
|
|
|
BigDecimal Tax035 = new BigDecimal("0.35");
|
|
|
BigDecimal Tax045 = new BigDecimal("0.45");
|
|
|
|
|
|
+ List<SalaryManagementExtra> extraList = new ArrayList<>();
|
|
|
+
|
|
|
Map<String,Object> data = new HashMap<>();
|
|
|
data.put("MFY",null);
|
|
|
data.put("NBSY",null);
|
|
@@ -288,10 +583,11 @@ public class SalaryManagementServiceImpl extends ServiceImpl<SalaryManagementMap
|
|
|
List<SalaryManagementDetail> salaryAttendanceDetailListNBSY = new ArrayList<>();//宁波森语
|
|
|
List<SalaryManagementDetail> salaryAttendanceDetailListZZ = new ArrayList<>();//正织
|
|
|
|
|
|
- QueryWrapper<SalaryAttendanceDetail> queryWrapper = new QueryWrapper<>();
|
|
|
- queryWrapper.eq("del_flag", "0");
|
|
|
- queryWrapper.eq("year_with_month", yearWithMonth);
|
|
|
- List<SalaryAttendanceDetail> list = salaryAttendanceDetailMapper.selectList(queryWrapper);
|
|
|
+// QueryWrapper<SalaryAttendanceDetail> queryWrapper = new QueryWrapper<>();
|
|
|
+// queryWrapper.eq("del_flag", "0");
|
|
|
+// queryWrapper.eq("year_with_month", yearWithMonth);
|
|
|
+// List<SalaryAttendanceDetail> list = salaryAttendanceDetailMapper.selectList(queryWrapper);
|
|
|
+ List<SalaryAttendanceDetail> list = salaryAttendanceDetailMapper.selectListByDate(yearWithMonth);
|
|
|
|
|
|
if (list.size() < 1) {
|
|
|
return Result.error("执行失败,没有找到" + yearWithMonth + "的考勤数据!");
|
|
@@ -310,6 +606,7 @@ public class SalaryManagementServiceImpl extends ServiceImpl<SalaryManagementMap
|
|
|
BigDecimal bigWages = new BigDecimal(AesEncryptUtil.desEncrypt(wages).trim());//基本薪资 (明文)
|
|
|
|
|
|
BigDecimal personalLeave = o.getPersonalLeave() == null ? BigDecimal.ZERO : o.getPersonalLeave();//事假时间(分)
|
|
|
+ BigDecimal sickLeave = o.getSickLeave() == null ? BigDecimal.ZERO : o.getSickLeave();//病假时间(分)
|
|
|
BigDecimal workingHours = o.getWorkingHours() == null ? BigDecimal.ZERO : o.getWorkingHours();//每日工时
|
|
|
BigDecimal attendanceDays = o.getAttendanceDays() == null ? BigDecimal.ZERO : o.getAttendanceDays();//出勤天数
|
|
|
|
|
@@ -318,7 +615,7 @@ public class SalaryManagementServiceImpl extends ServiceImpl<SalaryManagementMap
|
|
|
*/
|
|
|
BigDecimal phoneBill = o.getPhoneBill() == null ? BigDecimal.ZERO : o.getPhoneBill();//话费补贴
|
|
|
BigDecimal lunch = o.getLunch() == null ? BigDecimal.ZERO : o.getLunch();
|
|
|
- ;//午餐补贴
|
|
|
+ //午餐补贴
|
|
|
BigDecimal housingSubsidies = o.getHousingSubsidies() == null ? BigDecimal.ZERO : o.getHousingSubsidies();//住房补贴
|
|
|
BigDecimal transportation = o.getTransportation() == null ? BigDecimal.ZERO : o.getTransportation();//交通补贴
|
|
|
BigDecimal fullAttendance = o.getFullAttendance() == null ? BigDecimal.ZERO : o.getFullAttendance();//全勤奖
|
|
@@ -333,7 +630,7 @@ public class SalaryManagementServiceImpl extends ServiceImpl<SalaryManagementMap
|
|
|
BigDecimal latenessCost = o.getLatenessCost() == null ? BigDecimal.ZERO : o.getLatenessCost();//迟到扣费
|
|
|
|
|
|
BigDecimal deduction = o.getDeduction() == null ? BigDecimal.ZERO : o.getDeduction();
|
|
|
- ;//工资抵扣
|
|
|
+ //工资抵扣
|
|
|
|
|
|
/*
|
|
|
赋值和计算
|
|
@@ -342,6 +639,7 @@ public class SalaryManagementServiceImpl extends ServiceImpl<SalaryManagementMap
|
|
|
salaryManagementDetail.setUserId(o.getUserId());
|
|
|
salaryManagementDetail.setCode(o.getCode());
|
|
|
salaryManagementDetail.setName(o.getName());
|
|
|
+ salaryManagementDetail.setSysOrgCode(o.getSysOrgCode());
|
|
|
salaryManagementDetail.setOrgName(o.getOrgName());
|
|
|
salaryManagementDetail.setCardNo(o.getCardNo());
|
|
|
|
|
@@ -366,22 +664,80 @@ public class SalaryManagementServiceImpl extends ServiceImpl<SalaryManagementMap
|
|
|
|
|
|
salaryManagementDetail.setAccumulationFund(o.getAccumulationFund());//公积金
|
|
|
|
|
|
+ //事假扣费 = 事假(转换成小时数)/(每日工时*天数)*基本薪资
|
|
|
+ BigDecimal personalCost = new BigDecimal("0");
|
|
|
+// personalCost = personalLeave.divide(new BigDecimal("60"), 2, BigDecimal.ROUND_HALF_UP)
|
|
|
+// .divide(workingHours.multiply(attendanceDays), 2, BigDecimal.ROUND_HALF_UP).multiply(bigWages);
|
|
|
+
|
|
|
+ if(personalLeave.compareTo(BigDecimal.ZERO)!=0){
|
|
|
+// 基本薪资/(每日工时*天数)/ 60 * 事假分钟
|
|
|
+ personalCost = bigWages.divide(workingHours.multiply(attendanceDays), 12, BigDecimal.ROUND_HALF_UP).divide(new BigDecimal("60"), 12, BigDecimal.ROUND_HALF_UP)
|
|
|
+ .multiply(personalLeave).setScale(2, BigDecimal.ROUND_HALF_UP);;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ salaryManagementDetail.setPersonalCost(personalCost);//事假扣费
|
|
|
+
|
|
|
+ BigDecimal sickCost = new BigDecimal("0");//病假扣费
|
|
|
+ if(personalLeave.compareTo(BigDecimal.ZERO)!=0){
|
|
|
+// 基本薪资/(每日工时*天数)/ 60 * 病假分钟
|
|
|
+ sickCost = bigWages.divide(workingHours.multiply(attendanceDays), 12, BigDecimal.ROUND_HALF_UP).divide(new BigDecimal("60"), 12, BigDecimal.ROUND_HALF_UP)
|
|
|
+ .multiply(sickLeave).setScale(2, BigDecimal.ROUND_HALF_UP);;
|
|
|
|
|
|
- //应纳税所得额 = 合计应发 - 五险一金 - 扣除数(deduction)
|
|
|
+ }
|
|
|
+
|
|
|
+ salaryManagementDetail.setSickCost(sickCost);//病假扣费
|
|
|
+
|
|
|
+ //应纳税所得额 = 合计应发 - 五险一金 - 5000 - 扣除数(考勤管理中的工资抵扣deduction) - 事假扣费 - 病假扣费 - 迟到扣费
|
|
|
BigDecimal payTaxes = new BigDecimal("0");
|
|
|
- payTaxes = totalPayable.subtract(socialSecurity).subtract(accumulationFund).subtract(deduction);
|
|
|
- String payTaxesText = AesEncryptUtil.encrypt(payTaxes.toString());
|
|
|
- salaryManagementDetail.setPayTaxes(payTaxesText);//应纳税所得额
|
|
|
+ payTaxes = totalPayable.subtract(socialSecurity).subtract(accumulationFund).subtract(new BigDecimal("5000")).subtract(deduction)
|
|
|
+ .subtract(personalCost).subtract(sickCost).subtract(latenessCost).setScale(2, BigDecimal.ROUND_HALF_UP);;
|
|
|
|
|
|
+ if(payTaxes.compareTo(BigDecimal.ZERO) < 0){
|
|
|
+ sb.append("实际应纳税所得额为"+payTaxes+"故默认为0!!");
|
|
|
+ payTaxes = new BigDecimal("0");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ //累计个税 = 本年度当前人员所有已缴纳个税
|
|
|
+ BigDecimal cumulativeTax = new BigDecimal("0");
|
|
|
//累计所得额 = 本年度当前人员所有应纳税所得之和
|
|
|
BigDecimal cumulative = new BigDecimal("0");
|
|
|
List<SalaryManagementDetail> cumulativeList = salaryManagementDetailMapper.selectByUser(userId, withMonth, yearWithMonth);
|
|
|
List<SalaryManagementWorkOvertime> cumulativeOvertimeList = salaryManagementWorkOvertimeMapper.selectByUser(userId, withMonth, yearWithMonth);
|
|
|
-// List<SalaryManagementHoliday> holidayList = salaryManagementHolidayMapper.selectByUser(userId,withMonth);
|
|
|
+ List<SalaryManagementHoliday> holidayList = salaryManagementHolidayMapper.selectByUser(userId,withMonth);
|
|
|
+ //0福利现金 1年终奖 福利现金需计算工资、加班费、年休累计纳税额,且参与入其他薪资累计
|
|
|
+ List<SalaryManagementExtra> extra = salaryManagementExtraMapper.selectByUser(userId,withMonth,null,"0");
|
|
|
+// extra = salaryManagementExtraMapper.selectByUser(userId,withMonth,yearWithMonth,"0");
|
|
|
+
|
|
|
+ //福利金
|
|
|
+ BigDecimal extraTax = new BigDecimal("0");
|
|
|
+ if (extra.size() > 0) {
|
|
|
+ for (SalaryManagementExtra detail : extra) {
|
|
|
+ extraList.add(detail);
|
|
|
+ BigDecimal personalTax = detail.getPersonalTax() == null ? BigDecimal.ZERO : detail.getPersonalTax();
|
|
|
+ cumulativeTax = cumulativeTax.add(personalTax);//个税
|
|
|
+
|
|
|
+ String hisPayTaxes = detail.getPayTaxes();//应纳税所得额
|
|
|
+ hisPayTaxes = AesEncryptUtil.desEncrypt(hisPayTaxes).trim();
|
|
|
+ BigDecimal bigPayTaxes = new BigDecimal(hisPayTaxes);
|
|
|
+ extraTax = extraTax.add(bigPayTaxes);
|
|
|
+// cumulative = cumulative.add(bigPayTaxes);上行已累计,此处无需累加
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ sb.append(withMonth + "年度,此时之前(" + yearWithMonth + ")有效福利现金" + cumulativeList.size() + "条,共计金额"+extraTax+"已计入应纳税所得额与累计所得额中;");
|
|
|
+ payTaxes = payTaxes.add(extraTax);
|
|
|
+ String payTaxesText = AesEncryptUtil.encrypt(payTaxes.toString());
|
|
|
+ salaryManagementDetail.setPayTaxes(payTaxesText);//应纳税所得额
|
|
|
|
|
|
if (cumulativeList.size() > 0) {
|
|
|
for (SalaryManagementDetail detail : cumulativeList) {
|
|
|
- String hisPayTaxes = detail.getPayTaxes();
|
|
|
+
|
|
|
+ BigDecimal personalTax = detail.getPersonalTax() == null ? BigDecimal.ZERO : detail.getPersonalTax();
|
|
|
+ cumulativeTax = cumulativeTax.add(personalTax);//个税
|
|
|
+
|
|
|
+ String hisPayTaxes = detail.getPayTaxes();//应纳税所得额
|
|
|
hisPayTaxes = AesEncryptUtil.desEncrypt(hisPayTaxes).trim();
|
|
|
BigDecimal bigPayTaxes = new BigDecimal(hisPayTaxes);
|
|
|
cumulative = cumulative.add(bigPayTaxes);
|
|
@@ -390,19 +746,27 @@ public class SalaryManagementServiceImpl extends ServiceImpl<SalaryManagementMap
|
|
|
}
|
|
|
sb.append(withMonth + "年度,此时之前(" + yearWithMonth + ")有效月度工资单" + cumulativeList.size() + "条,已累计入累计所得额中;");
|
|
|
|
|
|
-// if(holidayList.size() > 0){
|
|
|
-// for(SalaryManagementHoliday detail:holidayList){
|
|
|
-// String hisPayTaxes = detail.getPayTaxes();
|
|
|
-// hisPayTaxes = AesEncryptUtil.desEncrypt(hisPayTaxes).trim();
|
|
|
-// BigDecimal bigPayTaxes = new BigDecimal(hisPayTaxes);
|
|
|
-// cumulative = cumulative.add(bigPayTaxes);
|
|
|
-// }
|
|
|
-//
|
|
|
-// }
|
|
|
-// sb.append(withMonth+"年度,此时之前("+yearWithMonth+")有效年休工资单"+cumulativeList.size()+"条,已累计入累计所得额中;");
|
|
|
+ if(holidayList.size() > 0){
|
|
|
+ for(SalaryManagementHoliday detail:holidayList){
|
|
|
+
|
|
|
+ BigDecimal personalTax = detail.getPersonalTax() == null ? BigDecimal.ZERO : detail.getPersonalTax();
|
|
|
+ cumulativeTax = cumulativeTax.add(personalTax);//个税
|
|
|
+
|
|
|
+ String hisPayTaxes = detail.getPayTaxes();
|
|
|
+ hisPayTaxes = AesEncryptUtil.desEncrypt(hisPayTaxes).trim();
|
|
|
+ BigDecimal bigPayTaxes = new BigDecimal(hisPayTaxes);
|
|
|
+ cumulative = cumulative.add(bigPayTaxes);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ sb.append(withMonth+"年度,此时之前("+yearWithMonth+")有效年休工资单"+cumulativeList.size()+"条,已累计入累计所得额中;");
|
|
|
|
|
|
if (cumulativeOvertimeList.size() > 0) {
|
|
|
for (SalaryManagementWorkOvertime detail : cumulativeOvertimeList) {
|
|
|
+
|
|
|
+ BigDecimal personalTax = detail.getPersonalTax() == null ? BigDecimal.ZERO : detail.getPersonalTax();
|
|
|
+ cumulativeTax = cumulativeTax.add(personalTax);//个税
|
|
|
+
|
|
|
String hisPayTaxes = detail.getPayTaxes();
|
|
|
hisPayTaxes = AesEncryptUtil.desEncrypt(hisPayTaxes).trim();
|
|
|
BigDecimal bigPayTaxes = new BigDecimal(hisPayTaxes);
|
|
@@ -410,62 +774,68 @@ public class SalaryManagementServiceImpl extends ServiceImpl<SalaryManagementMap
|
|
|
}
|
|
|
}
|
|
|
sb.append(withMonth + "年度,此时之前(" + yearWithMonth + ")有效加班工资单" + cumulativeList.size() + "条,已累计入累计所得额中;");
|
|
|
- cumulative = cumulative.add(payTaxes);
|
|
|
+ cumulative = cumulative.add(payTaxes).setScale(2, BigDecimal.ROUND_HALF_UP);;
|
|
|
String cumulativeText = AesEncryptUtil.encrypt(cumulative.toString());
|
|
|
salaryManagementDetail.setCumulative(cumulativeText);//累计所得额
|
|
|
|
|
|
- //个税 ===========================
|
|
|
+ //个税 = 累计所得额 * 对应税率 - 速算扣除数 - 累计税额 ===========================
|
|
|
BigDecimal personalTax = new BigDecimal("0");
|
|
|
|
|
|
- if (top36000.compareTo(cumulative) != -1) { //top36000 >= cumulative
|
|
|
- personalTax = cumulative.multiply(tax003);
|
|
|
- }
|
|
|
- if (top144000.compareTo(cumulative) != -1 && cumulative.compareTo(top36000) == 1) { //top144000 >= cumulative && cumulative > top36000
|
|
|
- personalTax = cumulative.multiply(Tax01);
|
|
|
- }
|
|
|
- if (top300000.compareTo(cumulative) != -1 && cumulative.compareTo(top144000) == 1) { //top144000 >= cumulative && cumulative > top36000
|
|
|
- personalTax = cumulative.multiply(Tax02);
|
|
|
- }
|
|
|
- if (top420000.compareTo(cumulative) != -1 && cumulative.compareTo(top300000) == 1) { //top144000 >= cumulative && cumulative > top36000
|
|
|
- personalTax = cumulative.multiply(Tax025);
|
|
|
- }
|
|
|
- if (top660000.compareTo(cumulative) != -1 && cumulative.compareTo(top420000) == 1) { //top144000 >= cumulative && cumulative > top36000
|
|
|
- personalTax = cumulative.multiply(Tax03);
|
|
|
- }
|
|
|
- if (top960000.compareTo(cumulative) != -1 && cumulative.compareTo(top660000) == 1) { //top144000 >= cumulative && cumulative > top36000
|
|
|
- personalTax = cumulative.multiply(Tax035);
|
|
|
- }
|
|
|
- if (cumulative.compareTo(top960000) == 1) { //cumulative > top960000
|
|
|
- personalTax = cumulative.multiply(Tax045);
|
|
|
+ if(cumulative.compareTo(BigDecimal.ZERO) == 0){
|
|
|
+ //如果应纳税额为0 则个税默认为0
|
|
|
+ }else{
|
|
|
+ if (top36000.compareTo(cumulative) != -1) { //top36000 >= cumulative
|
|
|
+ personalTax = cumulative.multiply(tax003).subtract(cumulativeTax);
|
|
|
+ }
|
|
|
+ if (top144000.compareTo(cumulative) != -1 && cumulative.compareTo(top36000) == 1) { //top144000 >= cumulative && cumulative > top36000
|
|
|
+ personalTax = cumulative.multiply(Tax01).subtract(new BigDecimal("2520")).subtract(cumulativeTax);
|
|
|
+ }
|
|
|
+ if (top300000.compareTo(cumulative) != -1 && cumulative.compareTo(top144000) == 1) { //top144000 >= cumulative && cumulative > top36000
|
|
|
+ personalTax = cumulative.multiply(Tax02).subtract(new BigDecimal("16920")).subtract(cumulativeTax);;
|
|
|
+ }
|
|
|
+ if (top420000.compareTo(cumulative) != -1 && cumulative.compareTo(top300000) == 1) { //top144000 >= cumulative && cumulative > top36000
|
|
|
+ personalTax = cumulative.multiply(Tax025).subtract(new BigDecimal("31920")).subtract(cumulativeTax);;
|
|
|
+ }
|
|
|
+ if (top660000.compareTo(cumulative) != -1 && cumulative.compareTo(top420000) == 1) { //top144000 >= cumulative && cumulative > top36000
|
|
|
+ personalTax = cumulative.multiply(Tax03).subtract(new BigDecimal("52920")).subtract(cumulativeTax);;
|
|
|
+ }
|
|
|
+ if (top960000.compareTo(cumulative) != -1 && cumulative.compareTo(top660000) == 1) { //top144000 >= cumulative && cumulative > top36000
|
|
|
+ personalTax = cumulative.multiply(Tax035).subtract(new BigDecimal("85920")).subtract(cumulativeTax);;
|
|
|
+ }
|
|
|
+ if (cumulative.compareTo(top960000) == 1) { //cumulative > top960000
|
|
|
+ personalTax = cumulative.multiply(Tax045).subtract(new BigDecimal("181920")).subtract(cumulativeTax);;
|
|
|
+ }
|
|
|
+ if(personalTax.compareTo(new BigDecimal("0")) < 0){
|
|
|
+ personalTax = new BigDecimal("0");
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
salaryManagementDetail.setPersonalTax(personalTax);//个税
|
|
|
|
|
|
- salaryManagementDetail.setLatenessCost(o.getLatenessCost());//迟到扣费
|
|
|
+ salaryManagementDetail.setLatenessCost(latenessCost);//迟到扣费
|
|
|
|
|
|
// BigDecimal personalLeave = o.getPersonalLeave();//事假时间(分)
|
|
|
// BigDecimal workingHours = o.getWorkingHours();//每日工时
|
|
|
// BigDecimal attendanceDays = o.getAttendanceDays();//出勤天数
|
|
|
|
|
|
- //事假扣费 = 事假(转换成小时数)/(每日工时*天数)*基本薪资
|
|
|
- BigDecimal personalCost = new BigDecimal("0");
|
|
|
- personalCost = personalLeave.divide(new BigDecimal("60"), 2, BigDecimal.ROUND_HALF_UP)
|
|
|
- .divide(workingHours.multiply(attendanceDays), 2, BigDecimal.ROUND_HALF_UP).multiply(bigWages);
|
|
|
- salaryManagementDetail.setPersonalCost(personalCost);//事假扣费
|
|
|
|
|
|
- salaryManagementDetail.setSickCost(new BigDecimal("0"));//病假扣费====
|
|
|
+
|
|
|
salaryManagementDetail.setMarriageCost(new BigDecimal("0"));//婚假扣费====
|
|
|
salaryManagementDetail.setFuneralCost(new BigDecimal("0"));//丧假扣费====
|
|
|
|
|
|
- //合计应扣 = 个税+3保险(社保)+公积金+迟到扣费+事假扣费
|
|
|
+ //合计应扣 = 个税+3保险(社保)+公积金+迟到扣费+事假扣费+病假扣费
|
|
|
BigDecimal totalDeduction = new BigDecimal("0");
|
|
|
- totalDeduction = personalTax.add(socialSecurity).add(accumulationFund).add(latenessCost).add(personalCost);
|
|
|
+ totalDeduction = personalTax.add(socialSecurity).add(accumulationFund).add(latenessCost).add(personalCost).add(sickCost);
|
|
|
+
|
|
|
salaryManagementDetail.setTotalDeduction(totalDeduction);//合计应扣
|
|
|
|
|
|
//实发合计 = 合计应发-合计应扣
|
|
|
BigDecimal actualOccurrence = new BigDecimal("0");
|
|
|
actualOccurrence = totalPayable.subtract(totalDeduction).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
- ;
|
|
|
+ if(actualOccurrence.compareTo(BigDecimal.ZERO) < 0){
|
|
|
+ sb.append("实发合计为"+actualOccurrence+"故默认为0!!");
|
|
|
+ actualOccurrence = new BigDecimal("0");
|
|
|
+ }
|
|
|
String actualOccurrenceText = AesEncryptUtil.encrypt(actualOccurrence.toString());
|
|
|
salaryManagementDetail.setActualOccurrence(actualOccurrenceText);//实发合计
|
|
|
salaryManagementDetail.setDeduction(o.getDeduction());//工资抵扣
|
|
@@ -538,10 +908,13 @@ public class SalaryManagementServiceImpl extends ServiceImpl<SalaryManagementMap
|
|
|
|
|
|
}
|
|
|
else if ("年休工资单".equals(type)) {
|
|
|
+
|
|
|
if (StringUtils.isBlank(yearWith)) {
|
|
|
return Result.error("参数异常yearWith");
|
|
|
}
|
|
|
|
|
|
+ String newYear = String.valueOf(DateUtils.getYear());
|
|
|
+
|
|
|
//年休工资单
|
|
|
List<SalaryManagementHoliday> holidayListMFY = new ArrayList<>();//马非羊
|
|
|
List<SalaryManagementHoliday> holidayListNBSY = new ArrayList<>();//宁波森语
|
|
@@ -579,6 +952,7 @@ public class SalaryManagementServiceImpl extends ServiceImpl<SalaryManagementMap
|
|
|
salaryManagementHoliday.setUserId(userId);
|
|
|
salaryManagementHoliday.setCode(o.getCode());
|
|
|
salaryManagementHoliday.setName(o.getName());
|
|
|
+ salaryManagementHoliday.setSysOrgCode(o.getSysOrgCode());
|
|
|
salaryManagementHoliday.setOrgName(orgName);
|
|
|
salaryManagementHoliday.setCardNo(o.getCardNo());
|
|
|
salaryManagementHoliday.setAnnualLeave(o.getAnnualLeave());
|
|
@@ -591,21 +965,27 @@ public class SalaryManagementServiceImpl extends ServiceImpl<SalaryManagementMap
|
|
|
|
|
|
//应发薪资 = 基本薪资/(单休26,双休22)*剩余年休
|
|
|
BigDecimal wages = new BigDecimal("0");
|
|
|
- wages = salaryBaseBig.divide(workingHours, 2, BigDecimal.ROUND_HALF_UP).multiply(surplus);
|
|
|
+ wages = salaryBaseBig.divide(workingHours, 2, BigDecimal.ROUND_HALF_UP).multiply(surplus).setScale(2, BigDecimal.ROUND_HALF_UP);;
|
|
|
String wagesText = AesEncryptUtil.encrypt(wages.toString()).trim();
|
|
|
salaryManagementHoliday.setWages(wagesText);//应发薪资
|
|
|
salaryManagementHoliday.setPayTaxes(wagesText);//应纳税所得额
|
|
|
|
|
|
+ //累计个税 = 本年度当前人员所有缴纳个税之和
|
|
|
+ BigDecimal cumulativeTax = new BigDecimal("0");
|
|
|
//累计所得额 = 本年度当前人员所有应纳税所得之和
|
|
|
BigDecimal cumulative = new BigDecimal("0");
|
|
|
|
|
|
if (wages.compareTo(BigDecimal.ZERO) != 0) {
|
|
|
|
|
|
- List<SalaryManagementDetail> cumulativeList = salaryManagementDetailMapper.selectByUser(userId, yearWith, null);
|
|
|
- List<SalaryManagementWorkOvertime> cumulativeOvertimeList = salaryManagementWorkOvertimeMapper.selectByUser(userId, yearWith, null);
|
|
|
+ List<SalaryManagementDetail> cumulativeList = salaryManagementDetailMapper.selectByUser(userId, newYear, null);
|
|
|
+ List<SalaryManagementWorkOvertime> cumulativeOvertimeList = salaryManagementWorkOvertimeMapper.selectByUser(userId, newYear, null);
|
|
|
|
|
|
if (cumulativeList.size() > 0) {
|
|
|
for (SalaryManagementDetail detail : cumulativeList) {
|
|
|
+
|
|
|
+ BigDecimal personalTax = detail.getPersonalTax() == null ? BigDecimal.ZERO : detail.getPersonalTax();
|
|
|
+ cumulativeTax = cumulativeTax.add(personalTax);//个税
|
|
|
+
|
|
|
String hisPayTaxes = detail.getPayTaxes();
|
|
|
hisPayTaxes = AesEncryptUtil.desEncrypt(hisPayTaxes).trim();
|
|
|
BigDecimal bigPayTaxes = new BigDecimal(hisPayTaxes);
|
|
@@ -613,18 +993,22 @@ public class SalaryManagementServiceImpl extends ServiceImpl<SalaryManagementMap
|
|
|
}
|
|
|
|
|
|
}
|
|
|
- sb.append(withMonth + "年度,此时之前(" + yearWithMonth + ")有效月度工资单" + cumulativeList.size() + "条,已累计入累计所得额中;");
|
|
|
+ sb.append(withMonth + "年度,此时之前(" + newYear + ")有效月度工资单" + cumulativeList.size() + "条,已累计入累计所得额中;");
|
|
|
|
|
|
if (cumulativeOvertimeList.size() > 0) {
|
|
|
for (SalaryManagementWorkOvertime detail : cumulativeOvertimeList) {
|
|
|
+
|
|
|
+ BigDecimal personalTax = detail.getPersonalTax() == null ? BigDecimal.ZERO : detail.getPersonalTax();
|
|
|
+ cumulativeTax = cumulativeTax.add(personalTax);//个税
|
|
|
+
|
|
|
String hisPayTaxes = detail.getPayTaxes();
|
|
|
hisPayTaxes = AesEncryptUtil.desEncrypt(hisPayTaxes).trim();
|
|
|
BigDecimal bigPayTaxes = new BigDecimal(hisPayTaxes);
|
|
|
cumulative = cumulative.add(bigPayTaxes);
|
|
|
}
|
|
|
}
|
|
|
- sb.append(withMonth + "年度,此时之前(" + yearWithMonth + ")有效加班工资单" + cumulativeList.size() + "条,已累计入累计所得额中;");
|
|
|
- cumulative = cumulative.add(wages);
|
|
|
+ sb.append(withMonth + "年度,此时之前(" + newYear + ")有效加班工资单" + cumulativeList.size() + "条,已累计入累计所得额中;");
|
|
|
+ cumulative = cumulative.add(wages).setScale(2, BigDecimal.ROUND_HALF_UP);;
|
|
|
} else {
|
|
|
sb.append("本次应发薪资年休工资为0,不计入累计所得额中");
|
|
|
}
|
|
@@ -634,27 +1018,33 @@ public class SalaryManagementServiceImpl extends ServiceImpl<SalaryManagementMap
|
|
|
|
|
|
//个税 ===========================
|
|
|
BigDecimal personalTax = new BigDecimal("0");
|
|
|
-
|
|
|
- if (top36000.compareTo(cumulative) != -1) { //top36000 >= cumulative
|
|
|
- personalTax = cumulative.multiply(tax003);
|
|
|
- }
|
|
|
- if (top144000.compareTo(cumulative) != -1 && cumulative.compareTo(top36000) == 1) { //top144000 >= cumulative && cumulative > top36000
|
|
|
- personalTax = cumulative.multiply(Tax01);
|
|
|
- }
|
|
|
- if (top300000.compareTo(cumulative) != -1 && cumulative.compareTo(top144000) == 1) { //top144000 >= cumulative && cumulative > top36000
|
|
|
- personalTax = cumulative.multiply(Tax02);
|
|
|
- }
|
|
|
- if (top420000.compareTo(cumulative) != -1 && cumulative.compareTo(top300000) == 1) { //top144000 >= cumulative && cumulative > top36000
|
|
|
- personalTax = cumulative.multiply(Tax025);
|
|
|
- }
|
|
|
- if (top660000.compareTo(cumulative) != -1 && cumulative.compareTo(top420000) == 1) { //top144000 >= cumulative && cumulative > top36000
|
|
|
- personalTax = cumulative.multiply(Tax03);
|
|
|
- }
|
|
|
- if (top960000.compareTo(cumulative) != -1 && cumulative.compareTo(top660000) == 1) { //top144000 >= cumulative && cumulative > top36000
|
|
|
- personalTax = cumulative.multiply(Tax035);
|
|
|
- }
|
|
|
- if (cumulative.compareTo(top960000) == 1) { //cumulative > top960000
|
|
|
- personalTax = cumulative.multiply(Tax045);
|
|
|
+ if(cumulative.compareTo(BigDecimal.ZERO) == 0){
|
|
|
+ //如果应纳税额为0 则个税默认为0
|
|
|
+ }else{
|
|
|
+ if (top36000.compareTo(cumulative) != -1) { //top36000 >= cumulative
|
|
|
+ personalTax = cumulative.multiply(tax003).subtract(cumulativeTax);
|
|
|
+ }
|
|
|
+ if (top144000.compareTo(cumulative) != -1 && cumulative.compareTo(top36000) == 1) { //top144000 >= cumulative && cumulative > top36000
|
|
|
+ personalTax = cumulative.multiply(Tax01).subtract(new BigDecimal("2520")).subtract(cumulativeTax);
|
|
|
+ }
|
|
|
+ if (top300000.compareTo(cumulative) != -1 && cumulative.compareTo(top144000) == 1) { //top144000 >= cumulative && cumulative > top36000
|
|
|
+ personalTax = cumulative.multiply(Tax02).subtract(new BigDecimal("16920")).subtract(cumulativeTax);
|
|
|
+ }
|
|
|
+ if (top420000.compareTo(cumulative) != -1 && cumulative.compareTo(top300000) == 1) { //top144000 >= cumulative && cumulative > top36000
|
|
|
+ personalTax = cumulative.multiply(Tax025).subtract(new BigDecimal("31920")).subtract(cumulativeTax);
|
|
|
+ }
|
|
|
+ if (top660000.compareTo(cumulative) != -1 && cumulative.compareTo(top420000) == 1) { //top144000 >= cumulative && cumulative > top36000
|
|
|
+ personalTax = cumulative.multiply(Tax03).subtract(new BigDecimal("52920")).subtract(cumulativeTax);
|
|
|
+ }
|
|
|
+ if (top960000.compareTo(cumulative) != -1 && cumulative.compareTo(top660000) == 1) { //top144000 >= cumulative && cumulative > top36000
|
|
|
+ personalTax = cumulative.multiply(Tax035).subtract(new BigDecimal("85920")).subtract(cumulativeTax);
|
|
|
+ }
|
|
|
+ if (cumulative.compareTo(top960000) == 1) { //cumulative > top960000
|
|
|
+ personalTax = cumulative.multiply(Tax045).subtract(new BigDecimal("181920")).subtract(cumulativeTax);
|
|
|
+ }
|
|
|
+ if(personalTax.compareTo(new BigDecimal("0")) < 0){
|
|
|
+ personalTax = new BigDecimal("0");
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
salaryManagementHoliday.setPersonalTax(personalTax);//个税
|
|
@@ -778,27 +1168,36 @@ public class SalaryManagementServiceImpl extends ServiceImpl<SalaryManagementMap
|
|
|
salaryAttendanceWorkOvertime.setUserId(userId);
|
|
|
salaryAttendanceWorkOvertime.setCode(o.getCode());
|
|
|
salaryAttendanceWorkOvertime.setName(o.getName());
|
|
|
+ salaryAttendanceWorkOvertime.setSysOrgCode(o.getSysOrgCode());
|
|
|
salaryAttendanceWorkOvertime.setOrgName(orgName);
|
|
|
salaryAttendanceWorkOvertime.setCardNo(o.getCardNo());
|
|
|
|
|
|
//加班工资 = 工资基数÷出勤天数(22or26)÷420or480(每天的上班分钟数)×加班时间分钟数
|
|
|
BigDecimal workOverTotal = new BigDecimal("0");
|
|
|
- workOverTotal = salaryBaseBig.divide(attendanceDays, 2, BigDecimal.ROUND_HALF_UP)
|
|
|
- .divide(workingHours.multiply(new BigDecimal("60")), 2, BigDecimal.ROUND_HALF_UP).multiply(workOvertime);
|
|
|
+ workOverTotal = salaryBaseBig.divide(attendanceDays, 8, BigDecimal.ROUND_HALF_UP)
|
|
|
+ .divide(workingHours.multiply(new BigDecimal("60")), 8, BigDecimal.ROUND_HALF_UP).multiply(workOvertime).setScale(2, BigDecimal.ROUND_HALF_UP);;
|
|
|
salaryAttendanceWorkOvertime.setWorkOvertimeCost(workOverTotal);//加班工资
|
|
|
|
|
|
String payTaxesText = AesEncryptUtil.encrypt(workOverTotal.toString());
|
|
|
salaryAttendanceWorkOvertime.setPayTaxes(payTaxesText);//应纳税所得额
|
|
|
|
|
|
+ //累计个税 = 本年度当前人员所有个税之和
|
|
|
+ BigDecimal cumulativeTax = new BigDecimal("0");
|
|
|
//累计所得额 = 本年度当前人员所有应纳税所得之和
|
|
|
BigDecimal cumulative = new BigDecimal("0");
|
|
|
if (workOverTotal.compareTo(BigDecimal.ZERO) != 0) {
|
|
|
|
|
|
- List<SalaryManagementDetail> cumulativeList = salaryManagementDetailMapper.selectByUser(userId, withMonth, yearWithMonth);
|
|
|
+// List<SalaryManagementDetail> cumulativeList = salaryManagementDetailMapper.selectByUser(userId, withMonth, yearWithMonth);
|
|
|
+ List<SalaryManagementDetail> cumulativeList = salaryManagementDetailMapper.selectByUser(userId, withMonth, null);
|
|
|
List<SalaryManagementWorkOvertime> cumulativeOvertimeList = salaryManagementWorkOvertimeMapper.selectByUser(userId, withMonth, yearWithMonth);
|
|
|
+ List<SalaryManagementHoliday> holidayList = salaryManagementHolidayMapper.selectByUser(userId,withMonth);
|
|
|
|
|
|
if (cumulativeList.size() > 0) {
|
|
|
for (SalaryManagementDetail detail : cumulativeList) {
|
|
|
+
|
|
|
+ BigDecimal personalTax = detail.getPersonalTax() == null ? BigDecimal.ZERO : detail.getPersonalTax();
|
|
|
+ cumulativeTax = cumulativeTax.add(personalTax);//个税
|
|
|
+
|
|
|
String hisPayTaxes = detail.getPayTaxes();
|
|
|
hisPayTaxes = AesEncryptUtil.desEncrypt(hisPayTaxes).trim();
|
|
|
BigDecimal bigPayTaxes = new BigDecimal(hisPayTaxes);
|
|
@@ -810,6 +1209,10 @@ public class SalaryManagementServiceImpl extends ServiceImpl<SalaryManagementMap
|
|
|
|
|
|
if (cumulativeOvertimeList.size() > 0) {
|
|
|
for (SalaryManagementWorkOvertime detail : cumulativeOvertimeList) {
|
|
|
+
|
|
|
+ BigDecimal personalTax = detail.getPersonalTax() == null ? BigDecimal.ZERO : detail.getPersonalTax();
|
|
|
+ cumulativeTax = cumulativeTax.add(personalTax);//个税
|
|
|
+
|
|
|
String hisPayTaxes = detail.getPayTaxes();
|
|
|
hisPayTaxes = AesEncryptUtil.desEncrypt(hisPayTaxes).trim();
|
|
|
BigDecimal bigPayTaxes = new BigDecimal(hisPayTaxes);
|
|
@@ -817,7 +1220,23 @@ public class SalaryManagementServiceImpl extends ServiceImpl<SalaryManagementMap
|
|
|
}
|
|
|
}
|
|
|
sb.append(withMonth + "年度,此时之前(" + yearWithMonth + ")有效加班工资单" + cumulativeList.size() + "条,已累计入累计所得额中;");
|
|
|
- cumulative = cumulative.add(workOverTotal);
|
|
|
+
|
|
|
+ if(holidayList.size() > 0){
|
|
|
+ for(SalaryManagementHoliday detail:holidayList){
|
|
|
+
|
|
|
+ BigDecimal personalTax = detail.getPersonalTax() == null ? BigDecimal.ZERO : detail.getPersonalTax();
|
|
|
+ cumulativeTax = cumulativeTax.add(personalTax);//个税
|
|
|
+
|
|
|
+ String hisPayTaxes = detail.getPayTaxes();
|
|
|
+ hisPayTaxes = AesEncryptUtil.desEncrypt(hisPayTaxes).trim();
|
|
|
+ BigDecimal bigPayTaxes = new BigDecimal(hisPayTaxes);
|
|
|
+ cumulative = cumulative.add(bigPayTaxes);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ sb.append(withMonth+"年度,此时之前("+yearWithMonth+")有效年休工资单"+cumulativeList.size()+"条,已累计入累计所得额中;");
|
|
|
+
|
|
|
+ cumulative = cumulative.add(workOverTotal).setScale(2, BigDecimal.ROUND_HALF_UP);;
|
|
|
} else {
|
|
|
sb.append("本次应发加班工资为0,不计入累计所得额中");
|
|
|
}
|
|
@@ -828,26 +1247,34 @@ public class SalaryManagementServiceImpl extends ServiceImpl<SalaryManagementMap
|
|
|
//个税 ===========================
|
|
|
BigDecimal personalTax = new BigDecimal("0");
|
|
|
|
|
|
- if (top36000.compareTo(cumulative) != -1) { //top36000 >= cumulative
|
|
|
- personalTax = cumulative.multiply(tax003);
|
|
|
- }
|
|
|
- if (top144000.compareTo(cumulative) != -1 && cumulative.compareTo(top36000) == 1) { //top144000 >= cumulative && cumulative > top36000
|
|
|
- personalTax = cumulative.multiply(Tax01);
|
|
|
- }
|
|
|
- if (top300000.compareTo(cumulative) != -1 && cumulative.compareTo(top144000) == 1) { //top144000 >= cumulative && cumulative > top36000
|
|
|
- personalTax = cumulative.multiply(Tax02);
|
|
|
- }
|
|
|
- if (top420000.compareTo(cumulative) != -1 && cumulative.compareTo(top300000) == 1) { //top144000 >= cumulative && cumulative > top36000
|
|
|
- personalTax = cumulative.multiply(Tax025);
|
|
|
- }
|
|
|
- if (top660000.compareTo(cumulative) != -1 && cumulative.compareTo(top420000) == 1) { //top144000 >= cumulative && cumulative > top36000
|
|
|
- personalTax = cumulative.multiply(Tax03);
|
|
|
- }
|
|
|
- if (top960000.compareTo(cumulative) != -1 && cumulative.compareTo(top660000) == 1) { //top144000 >= cumulative && cumulative > top36000
|
|
|
- personalTax = cumulative.multiply(Tax035);
|
|
|
- }
|
|
|
- if (cumulative.compareTo(top960000) == 1) { //cumulative > top960000
|
|
|
- personalTax = cumulative.multiply(Tax045);
|
|
|
+ if(cumulative.compareTo(BigDecimal.ZERO) == 0){
|
|
|
+ //如果应纳税额为0 则个税默认为0
|
|
|
+ }else{
|
|
|
+
|
|
|
+ if (top36000.compareTo(cumulative) != -1) { //top36000 >= cumulative
|
|
|
+ personalTax = cumulative.multiply(tax003).subtract(cumulativeTax);
|
|
|
+ }
|
|
|
+ if (top144000.compareTo(cumulative) != -1 && cumulative.compareTo(top36000) == 1) { //top144000 >= cumulative && cumulative > top36000
|
|
|
+ personalTax = cumulative.multiply(Tax01).subtract(new BigDecimal("2520")).subtract(cumulativeTax);
|
|
|
+ }
|
|
|
+ if (top300000.compareTo(cumulative) != -1 && cumulative.compareTo(top144000) == 1) { //top144000 >= cumulative && cumulative > top36000
|
|
|
+ personalTax = cumulative.multiply(Tax02).subtract(new BigDecimal("16920")).subtract(cumulativeTax);
|
|
|
+ }
|
|
|
+ if (top420000.compareTo(cumulative) != -1 && cumulative.compareTo(top300000) == 1) { //top144000 >= cumulative && cumulative > top36000
|
|
|
+ personalTax = cumulative.multiply(Tax025).subtract(new BigDecimal("31920")).subtract(cumulativeTax);
|
|
|
+ }
|
|
|
+ if (top660000.compareTo(cumulative) != -1 && cumulative.compareTo(top420000) == 1) { //top144000 >= cumulative && cumulative > top36000
|
|
|
+ personalTax = cumulative.multiply(Tax03).subtract(new BigDecimal("52920")).subtract(cumulativeTax);
|
|
|
+ }
|
|
|
+ if (top960000.compareTo(cumulative) != -1 && cumulative.compareTo(top660000) == 1) { //top144000 >= cumulative && cumulative > top36000
|
|
|
+ personalTax = cumulative.multiply(Tax035).subtract(new BigDecimal("85920")).subtract(cumulativeTax);
|
|
|
+ }
|
|
|
+ if (cumulative.compareTo(top960000) == 1) { //cumulative > top960000
|
|
|
+ personalTax = cumulative.multiply(Tax045).subtract(new BigDecimal("181920")).subtract(cumulativeTax);
|
|
|
+ }
|
|
|
+ if(personalTax.compareTo(new BigDecimal("0")) < 0){
|
|
|
+ personalTax = new BigDecimal("0");
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
salaryAttendanceWorkOvertime.setPersonalTax(personalTax);//个税
|
|
@@ -940,6 +1367,19 @@ public class SalaryManagementServiceImpl extends ServiceImpl<SalaryManagementMap
|
|
|
return Result.error("type参数异常");
|
|
|
}
|
|
|
|
|
|
+ if(extraList.size() > 0){
|
|
|
+ for(SalaryManagementExtra e:extraList){
|
|
|
+ e.setCalculate("1");
|
|
|
+ if(StringUtils.isNotBlank(yearWithMonth)){
|
|
|
+ e.setCalculateDate(yearWithMonth);
|
|
|
+ }else{
|
|
|
+ e.setCalculateDate(yearWith);
|
|
|
+ }
|
|
|
+ e.setActionLog("计入工资单:"+type+"年度:"+yearWith+"年月:"+yearWithMonth);
|
|
|
+ salaryManagementExtraMapper.updateById(e);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
return Result.error("计算失败,请检查数据是否完整" + e.getMessage());
|
|
@@ -1276,6 +1716,116 @@ public class SalaryManagementServiceImpl extends ServiceImpl<SalaryManagementMap
|
|
|
salaryManagementMapper.deleteVersionDetail(yearWithMonth, ver);
|
|
|
|
|
|
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 保存数据 福利现金 年终奖
|
|
|
+ *
|
|
|
+ * @param salaryManagementMFY
|
|
|
+ * @param salaryManagementNBSY
|
|
|
+ * @param salaryManagementZZ
|
|
|
+ * @param salaryAttendanceDetailListMFY
|
|
|
+ * @param salaryAttendanceDetailListNBSY
|
|
|
+ * @param salaryAttendanceDetailListZZ
|
|
|
+ */
|
|
|
+ public void saveExtra(String type,String yearWithMonth,
|
|
|
+ SalaryManagement salaryManagementMFY, SalaryManagement salaryManagementNBSY, SalaryManagement salaryManagementZZ,
|
|
|
+ List<SalaryManagementExtra> salaryAttendanceDetailListMFY,
|
|
|
+ List<SalaryManagementExtra> salaryAttendanceDetailListNBSY,
|
|
|
+ List<SalaryManagementExtra> salaryAttendanceDetailListZZ
|
|
|
+ ) {
|
|
|
+
|
|
|
+ LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
|
+ Date date = new Date();
|
|
|
+
|
|
|
+ Integer ver = salaryManagementMapper.selectVersion(type, yearWithMonth);
|
|
|
+
|
|
|
+ if (ver == null) {
|
|
|
+ ver = 1;
|
|
|
+ } else {
|
|
|
+ ver = ver + 1;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (salaryAttendanceDetailListMFY != null && salaryAttendanceDetailListMFY.size() > 0) {
|
|
|
+
|
|
|
+ salaryManagementMFY.setId(IdUtil.simpleUUID());
|
|
|
+ salaryManagementMFY.setCreateBy(sysUser.getUsername());
|
|
|
+ salaryManagementMFY.setCreateTime(date);
|
|
|
+ salaryManagementMFY.setGenerationTime(date);
|
|
|
+ salaryManagementMFY.setOrgName("马菲羊");
|
|
|
+ salaryManagementMFY.setType(type);
|
|
|
+ salaryManagementMFY.setVersion(String.valueOf(ver));
|
|
|
+ salaryManagementMFY.setNumberPeople(salaryAttendanceDetailListMFY.size());
|
|
|
+ salaryManagementMFY.setYearWithMonth(yearWithMonth);
|
|
|
+ salaryManagementMapper.insert(salaryManagementMFY);
|
|
|
+
|
|
|
+ for (SalaryManagementExtra o : salaryAttendanceDetailListMFY) {
|
|
|
+ o.setHeadId(salaryManagementMFY.getId());
|
|
|
+ o.setId(IdUtil.simpleUUID());
|
|
|
+ o.setCreateBy(sysUser.getUsername());
|
|
|
+ o.setCreateTime(date);
|
|
|
+ o.setVersion(String.valueOf(ver));
|
|
|
+ salaryManagementExtraMapper.insert(o);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (salaryAttendanceDetailListNBSY != null && salaryAttendanceDetailListNBSY.size() > 0) {
|
|
|
+
|
|
|
+ salaryManagementNBSY.setId(IdUtil.simpleUUID());
|
|
|
+ salaryManagementNBSY.setCreateBy(sysUser.getUsername());
|
|
|
+ salaryManagementNBSY.setCreateTime(date);
|
|
|
+ salaryManagementNBSY.setGenerationTime(date);
|
|
|
+ salaryManagementNBSY.setOrgName("森语");
|
|
|
+ salaryManagementNBSY.setType(type);
|
|
|
+ salaryManagementNBSY.setVersion(String.valueOf(ver));
|
|
|
+ salaryManagementNBSY.setNumberPeople(salaryAttendanceDetailListNBSY.size());
|
|
|
+ salaryManagementNBSY.setYearWithMonth(yearWithMonth);
|
|
|
+ salaryManagementMapper.insert(salaryManagementNBSY);
|
|
|
+
|
|
|
+ for (SalaryManagementExtra o : salaryAttendanceDetailListNBSY) {
|
|
|
+ o.setHeadId(salaryManagementNBSY.getId());
|
|
|
+ o.setId(IdUtil.simpleUUID());
|
|
|
+ o.setCreateBy(sysUser.getUsername());
|
|
|
+ o.setCreateTime(date);
|
|
|
+ o.setVersion(String.valueOf(ver));
|
|
|
+ salaryManagementExtraMapper.insert(o);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ if (salaryAttendanceDetailListZZ != null && salaryAttendanceDetailListZZ.size() > 0) {
|
|
|
+
|
|
|
+ salaryManagementZZ.setId(IdUtil.simpleUUID());
|
|
|
+ salaryManagementZZ.setCreateBy(sysUser.getUsername());
|
|
|
+ salaryManagementZZ.setCreateTime(date);
|
|
|
+ salaryManagementZZ.setGenerationTime(date);
|
|
|
+ salaryManagementZZ.setOrgName("正织");
|
|
|
+ salaryManagementZZ.setType(type);
|
|
|
+ salaryManagementZZ.setVersion(String.valueOf(ver));
|
|
|
+ salaryManagementZZ.setNumberPeople(salaryAttendanceDetailListZZ.size());
|
|
|
+ salaryManagementZZ.setYearWithMonth(yearWithMonth);
|
|
|
+ salaryManagementMapper.insert(salaryManagementZZ);
|
|
|
+
|
|
|
+ for (SalaryManagementExtra o : salaryAttendanceDetailListZZ) {
|
|
|
+ o.setHeadId(salaryManagementZZ.getId());
|
|
|
+ o.setId(IdUtil.simpleUUID());
|
|
|
+ o.setCreateBy(sysUser.getUsername());
|
|
|
+ o.setCreateTime(date);
|
|
|
+ o.setVersion(String.valueOf(ver));
|
|
|
+ salaryManagementExtraMapper.insert(o);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ salaryManagementMapper.deleteVersion(type, yearWithMonth, ver);
|
|
|
+ if(type.equals("福利现金")){
|
|
|
+ salaryManagementMapper.deleteVersionExtra(yearWithMonth, "0", ver);
|
|
|
+ }else{
|
|
|
+ //年终奖
|
|
|
+ salaryManagementMapper.deleteVersionExtra(yearWithMonth, "1",ver);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
public static void main(String[] args) throws Exception {
|