Commit 161ed67e by ilal Committed by chenzg

提交薪酬计算

parent 231d9a6c
...@@ -512,19 +512,6 @@ public class SalaryManagementController { ...@@ -512,19 +512,6 @@ public class SalaryManagementController {
zzx.setRulestate(4);//规则状态[0:系统自动提取;1:系统固定值;2:固定公式计算;3:自定义公式计算;4:每月自动导入] zzx.setRulestate(4);//规则状态[0:系统自动提取;1:系统固定值;2:固定公式计算;3:自定义公式计算;4:每月自动导入]
} }
// zzx.setRule(xzxj.getGsxs());//规则********************************
// if(jsjsf[a].equals("个税")) {
// zzx.setGsid(0);
// }else {
// zzx.setGsid(xzxj.getId());//公式id 0:未关联规则
// }
// zzx.setGsgs(xzxj.getGsxs());//公式格式 系统提供/自定义公式
// if(jsjsf[a].equals("其他扣除")) {
// zzx.setRulestate(4);//规则状态[0:系统自动提取;1:系统固定值;2:固定公式计算;3:自定义公式计算;4:每月自动导入]
// }else {
// zzx.setRulestate(2);
// }
XcglAssoOption opt = new LambdaQueryChainWrapper<XcglAssoOption>(xcglassooptionmapper).eq(XcglAssoOption::getOptionname, jsjsf[a]).one(); XcglAssoOption opt = new LambdaQueryChainWrapper<XcglAssoOption>(xcglassooptionmapper).eq(XcglAssoOption::getOptionname, jsjsf[a]).one();
zzx.setOptionid(opt.getId()); zzx.setOptionid(opt.getId());
zzx.setType(2);//类型 1:系统项;2:非系统项 zzx.setType(2);//类型 1:系统项;2:非系统项
...@@ -541,7 +528,6 @@ public class SalaryManagementController { ...@@ -541,7 +528,6 @@ public class SalaryManagementController {
} }
} }
}else {//从其他薪资组复制规则 }else {//从其他薪资组复制规则
/*****************/
//未加入分组 //未加入分组
List<XcglAssoJsgzzx> wjrfzlist = new LambdaQueryChainWrapper<XcglAssoJsgzzx>(xcglassojsgzzxmapper).eq(XcglAssoJsgzzx::getXzzid, paygro.getPxfs()).eq(XcglAssoJsgzzx::getJxgzid,0).list(); List<XcglAssoJsgzzx> wjrfzlist = new LambdaQueryChainWrapper<XcglAssoJsgzzx>(xcglassojsgzzxmapper).eq(XcglAssoJsgzzx::getXzzid, paygro.getPxfs()).eq(XcglAssoJsgzzx::getJxgzid,0).list();
...@@ -567,7 +553,6 @@ public class SalaryManagementController { ...@@ -567,7 +553,6 @@ public class SalaryManagementController {
if(wjrfzzzxlist.size() > 0) { if(wjrfzzzxlist.size() > 0) {
xcglassojsgzzxmapper.insertxcglassojsgzzxList(wjrfzzzxlist); xcglassojsgzzxmapper.insertxcglassojsgzzxList(wjrfzzzxlist);
} }
/*************/
//计薪规则组 //计薪规则组
List<XcglAssoJxgz> jxgzlist = new LambdaQueryChainWrapper<XcglAssoJxgz>(xcglassojxgzmapper).eq(XcglAssoJxgz::getXzzid, paygro.getPxfs()).list(); List<XcglAssoJxgz> jxgzlist = new LambdaQueryChainWrapper<XcglAssoJxgz>(xcglassojxgzmapper).eq(XcglAssoJxgz::getXzzid, paygro.getPxfs()).list();
...@@ -1194,6 +1179,9 @@ public class SalaryManagementController { ...@@ -1194,6 +1179,9 @@ public class SalaryManagementController {
@PostMapping(value = "/payCustomitem") @PostMapping(value = "/payCustomitem")
@ApiOperation(value = "创建自定义计薪规则组项", httpMethod = "POST", notes = "接口发布说明") @ApiOperation(value = "创建自定义计薪规则组项", httpMethod = "POST", notes = "接口发布说明")
public ResponseResult PayCustomRuleGroupItem(@CurrentUser UserBean userBean,@RequestBody PayCustomZDYDto payc) { public ResponseResult PayCustomRuleGroupItem(@CurrentUser UserBean userBean,@RequestBody PayCustomZDYDto payc) {
XcglAssoJsgzzx sfcz = XcglAssoJsgzzx.builder().build().selectOne(new QueryWrapper<XcglAssoJsgzzx>().lambda().eq(XcglAssoJsgzzx::getXzzid, payc.getGid()).eq(XcglAssoJsgzzx::getSalaryitem, payc.getName()));
if(sfcz == null) {
XcglAssoJsgzzx zzx = XcglAssoJsgzzx.builder().build(); XcglAssoJsgzzx zzx = XcglAssoJsgzzx.builder().build();
zzx.setSalaryitem(payc.getName());//薪资项 zzx.setSalaryitem(payc.getName());//薪资项
zzx.setYhmbzd(payc.getName());//银行模板项 需与银行一一对应 zzx.setYhmbzd(payc.getName());//银行模板项 需与银行一一对应
...@@ -1218,6 +1206,9 @@ public class SalaryManagementController { ...@@ -1218,6 +1206,9 @@ public class SalaryManagementController {
zzx.setIsCustom(1);//是否自定义项(0:否;1:是) zzx.setIsCustom(1);//是否自定义项(0:否;1:是)
xcglassojsgzzxmapper.jsgzzxinsert(zzx); xcglassojsgzzxmapper.jsgzzxinsert(zzx);
return new ResponseResult().success("创建薪资组成功", zzx); return new ResponseResult().success("创建薪资组成功", zzx);
}else {
return new ResponseResult().error(payc.getName()+"重复添加");
}
} }
/** /**
...@@ -1651,7 +1642,7 @@ public class SalaryManagementController { ...@@ -1651,7 +1642,7 @@ public class SalaryManagementController {
double base_pay = 0;//基本工资 double base_pay = 0;//基本工资
double post_allowance = 0;//岗位津贴 double post_allowance = 0;//岗位津贴
double attendance_days = 0;//应出勤天数 double attendance_days = 0;//应出勤天数
double actual_attendance_days = 0;//实出勤天数 // double actual_attendance_days = 0;//实出勤天数
double matter_leave = 0;//事假 double matter_leave = 0;//事假
double sick_leave = 0;//病假 double sick_leave = 0;//病假
double absenteeism_days = 0;//旷工天数 double absenteeism_days = 0;//旷工天数
...@@ -1687,7 +1678,7 @@ public class SalaryManagementController { ...@@ -1687,7 +1678,7 @@ public class SalaryManagementController {
XcglAssoXzb xzb = XcglAssoXzb.builder().build().selectOne(new QueryWrapper<XcglAssoXzb>().lambda().eq(XcglAssoXzb::getXzxid, xzx.getId()).eq(XcglAssoXzb::getUserid, pag.getUserid())); XcglAssoXzb xzb = XcglAssoXzb.builder().build().selectOne(new QueryWrapper<XcglAssoXzb>().lambda().eq(XcglAssoXzb::getXzxid, xzx.getId()).eq(XcglAssoXzb::getUserid, pag.getUserid()));
if(xzx.getIsCustom() == 0 && xzx.getOptionid() == 10) { attendance_days = xzb.getXzxjg(); }//实出勤天数 if(xzx.getIsCustom() == 0 && xzx.getOptionid() == 10) { attendance_days = xzb.getXzxjg(); }//实出勤天数
if(xzx.getIsCustom() == 0 && xzx.getOptionid() == 11) { actual_attendance_days = xzb.getXzxjg(); }//实出勤天数 // if(xzx.getIsCustom() == 0 && xzx.getOptionid() == 11) { actual_attendance_days = xzb.getXzxjg(); }//实出勤天数
if(xzx.getIsCustom() == 0 && xzx.getOptionid() == 32) { matter_leave = xzb.getXzxjg(); }//事假 if(xzx.getIsCustom() == 0 && xzx.getOptionid() == 32) { matter_leave = xzb.getXzxjg(); }//事假
if(xzx.getIsCustom() == 0 && xzx.getOptionid() == 34) { sick_leave = xzb.getXzxjg(); }//病假 if(xzx.getIsCustom() == 0 && xzx.getOptionid() == 34) { sick_leave = xzb.getXzxjg(); }//病假
if(xzx.getIsCustom() == 0 && xzx.getOptionid() == 12) { absenteeism_days = xzb.getXzxjg(); }//旷工天数 if(xzx.getIsCustom() == 0 && xzx.getOptionid() == 12) { absenteeism_days = xzb.getXzxjg(); }//旷工天数
...@@ -1708,9 +1699,9 @@ public class SalaryManagementController { ...@@ -1708,9 +1699,9 @@ public class SalaryManagementController {
XcglAssoXzb.builder().xzxjg(secretary_ling).build().update(new QueryWrapper<XcglAssoXzb>().lambda().eq(XcglAssoXzb::getXzxid, xzx.getId()).eq(XcglAssoXzb::getUserid, pag.getUserid())); XcglAssoXzb.builder().xzxjg(secretary_ling).build().update(new QueryWrapper<XcglAssoXzb>().lambda().eq(XcglAssoXzb::getXzxid, xzx.getId()).eq(XcglAssoXzb::getUserid, pag.getUserid()));
} }
//公式计算 //公式计算 个税
//(固定公式计算):迟到早退扣款、事假扣款、病假扣款、旷工扣款、司龄工资、应发工资、实发工资 //(固定公式计算):迟到早退扣款、事假扣款、病假扣款、旷工扣款、司龄工资、应发工资、实发工资
if(xzx.getRulestate().equals(2)) { if(xzx.getRulestate().equals(2) || (xzx.getIsCustom() == 0 && xzx.getOptionid() == 69)) {
double result = 0; double result = 0;
if(xzx.getIsCustom() == 0 && xzx.getOptionid() == 31) {//司龄工资 if(xzx.getIsCustom() == 0 && xzx.getOptionid() == 31) {//司龄工资
String formula = xzx.getGsgs();//#司龄#*100 String formula = xzx.getGsgs();//#司龄#*100
...@@ -1732,7 +1723,7 @@ public class SalaryManagementController { ...@@ -1732,7 +1723,7 @@ public class SalaryManagementController {
if(xzx.getIsCustom() == 0 && xzx.getOptionid() == 29) {//旷工扣款 if(xzx.getIsCustom() == 0 && xzx.getOptionid() == 29) {//旷工扣款
String formula = xzx.getGsgs();//#基本工资#/#应出勤天数#*#旷工天数#*3 #旷工天数#*100 String formula = xzx.getGsgs();//#基本工资#/#应出勤天数#*#旷工天数#*3 #旷工天数#*100
String qaz = formula.replace("#基本工资#", String.valueOf(base_pay)).replace("#应出勤天数#", String.valueOf(attendance_days)).replace("#旷工天数#", String.valueOf(absenteeism_days)); String qaz = formula.replace("#基本工资#", String.valueOf(base_pay)).replace("#应出勤天数#", String.valueOf(attendance_days)).replace("#旷工天数#", String.valueOf(absenteeism_days));
result = Double.valueOf(String.valueOf(js.eval(qaz))); result = SalaryTool.formatDouble(Double.valueOf(String.valueOf(js.eval(qaz))));
} }
if(xzx.getIsCustom() == 0 && xzx.getOptionid() == 30) {//迟到早退扣款 if(xzx.getIsCustom() == 0 && xzx.getOptionid() == 30) {//迟到早退扣款
String qaz = ""; String qaz = "";
...@@ -1753,7 +1744,7 @@ public class SalaryManagementController { ...@@ -1753,7 +1744,7 @@ public class SalaryManagementController {
String qaz = formula.replace("#基本工资#", String.valueOf(base_pay)).replace("#岗位津贴#", String.valueOf(post_allowance)).replace("#绩效奖金#", String.valueOf(achievement_bonus)) String qaz = formula.replace("#基本工资#", String.valueOf(base_pay)).replace("#岗位津贴#", String.valueOf(post_allowance)).replace("#绩效奖金#", String.valueOf(achievement_bonus))
.replace("#业绩提成#", String.valueOf(performance_commission)).replace("#税前补差#", String.valueOf(pre_taxmakediff)) .replace("#业绩提成#", String.valueOf(performance_commission)).replace("#税前补差#", String.valueOf(pre_taxmakediff))
.replace("#事假扣款#", String.valueOf(matter_leave_deduction)).replace("#病假扣款#", String.valueOf(sick_leave_deduction)); .replace("#事假扣款#", String.valueOf(matter_leave_deduction)).replace("#病假扣款#", String.valueOf(sick_leave_deduction));
result = Double.valueOf(String.valueOf(js.eval(qaz))); result = SalaryTool.formatDouble(Double.valueOf(String.valueOf(js.eval(qaz))));
wages_payable = result; wages_payable = result;
} }
...@@ -1765,13 +1756,13 @@ public class SalaryManagementController { ...@@ -1765,13 +1756,13 @@ public class SalaryManagementController {
e.printStackTrace(); e.printStackTrace();
System.out.println("个税计算错误"); System.out.println("个税计算错误");
} }
result = personal_income_tax; result = personal_income_tax < 0 ? 0.0 : personal_income_tax;
} }
if(xzx.getIsCustom() == 0 && xzx.getOptionid() == 70) {//实发工资 if(xzx.getIsCustom() == 0 && xzx.getOptionid() == 70) {//实发工资
String formula = xzx.getGsgs();//#应发工资#-#个人社保#-#个人公积金#-#个税# String formula = xzx.getGsgs();//#应发工资#-#个人社保#-#个人公积金#-#个税#
String qaz = formula.replace("#应发工资#", String.valueOf(wages_payable)).replace("#个人社保#", String.valueOf(grsb)).replace("#个人公积金#", String.valueOf(grgjj)).replace("#个税#", String.valueOf(personal_income_tax)); String qaz = formula.replace("#应发工资#", String.valueOf(wages_payable)).replace("#个人社保#", String.valueOf(grsb)).replace("#个人公积金#", String.valueOf(grgjj)).replace("#个税#", String.valueOf(personal_income_tax < 0 ? 0.0 : personal_income_tax));
result = Double.valueOf(String.valueOf(js.eval(qaz))); result = SalaryTool.formatDouble(Double.valueOf(String.valueOf(js.eval(qaz))));
} }
XcglAssoXzb.builder().xzxjg(result).build().update(new QueryWrapper<XcglAssoXzb>().lambda().eq(XcglAssoXzb::getXzxid, xzx.getId()).eq(XcglAssoXzb::getUserid, pag.getUserid())); XcglAssoXzb.builder().xzxjg(result).build().update(new QueryWrapper<XcglAssoXzb>().lambda().eq(XcglAssoXzb::getXzxid, xzx.getId()).eq(XcglAssoXzb::getUserid, pag.getUserid()));
...@@ -1779,26 +1770,57 @@ public class SalaryManagementController { ...@@ -1779,26 +1770,57 @@ public class SalaryManagementController {
//(自定义公式计算): 应发工资、实发工资 //(自定义公式计算): 应发工资、实发工资
if(xzx.getRulestate() == 3) { if(xzx.getRulestate() == 3) {
double result = 0;
String qaz = "";
String formula = "";
//计薪规则组项中自定义项 //计薪规则组项中自定义项
List<XcglAssoJsgzzx> zdyx = XcglAssoJsgzzx.builder().build().selectList(new QueryWrapper<XcglAssoJsgzzx>().lambda().eq(XcglAssoJsgzzx::getXzzid, calcomtiondto.getPay_group_id()).eq(XcglAssoJsgzzx::getIsCustom, 1)); List<XcglAssoJsgzzx> zdyx = XcglAssoJsgzzx.builder().build().selectList(new QueryWrapper<XcglAssoJsgzzx>().lambda().eq(XcglAssoJsgzzx::getXzzid, calcomtiondto.getPay_group_id()).eq(XcglAssoJsgzzx::getIsCustom, 1));
if(xzx.getIsCustom() == 0 && xzx.getOptionid() == 48) {//应发工资 if(xzx.getIsCustom() == 0 && xzx.getOptionid() == 48) {//应发工资
String formula = xzx.getGsgs();//#基本工资#+#岗位津贴#+#绩效奖金#+#业绩提成#+#税前补差#-#事假扣款#-#病假扣款#? formula = xzx.getGsgs();//#基本工资#+#岗位津贴#+#绩效奖金#+#业绩提成#+#税前补差#-#事假扣款#-#病假扣款#?
String qaz = formula.replace("#基本工资#", String.valueOf(base_pay)).replace("#岗位津贴#", String.valueOf(post_allowance)).replace("#绩效奖金#", String.valueOf(achievement_bonus)) qaz = formula.replace("#基本工资#", String.valueOf(base_pay)).replace("#岗位津贴#", String.valueOf(post_allowance)).replace("#绩效奖金#", String.valueOf(achievement_bonus))
.replace("#业绩提成#", String.valueOf(performance_commission)).replace("#税前补差#", String.valueOf(pre_taxmakediff)) .replace("#业绩提成#", String.valueOf(performance_commission)).replace("#税前补差#", String.valueOf(pre_taxmakediff))
.replace("#事假扣款#", String.valueOf(matter_leave_deduction)).replace("#病假扣款#", String.valueOf(sick_leave_deduction)); .replace("#事假扣款#", String.valueOf(matter_leave_deduction)).replace("#病假扣款#", String.valueOf(sick_leave_deduction));
for(XcglAssoJsgzzx zdy : zdyx) {
} }
double result = Double.valueOf(String.valueOf(js.eval(qaz)));
}
if(xzx.getIsCustom() == 0 && xzx.getOptionid() == 70) {//实发工资 if(xzx.getIsCustom() == 0 && xzx.getOptionid() == 70) {//实发工资
formula = xzx.getGsgs();//#应发工资#-#个人社保#-#个人公积金#-#个税#
qaz = formula.replace("#应发工资#", String.valueOf(wages_payable)).replace("#个人社保#", String.valueOf(grsb)).replace("#个人公积金#", String.valueOf(grgjj)).replace("#个税#", String.valueOf(personal_income_tax));
}
for(XcglAssoJsgzzx zdy : zdyx) {
double custom_ = 0;//自定义
boolean status = qaz.contains("#"+zdy.getSalaryitem()+"#");//公式中是否存在自定义
if(status) {//存在
XcglAssoJsgzzx zdygsx = XcglAssoJsgzzx.builder().build().selectOne(new QueryWrapper<XcglAssoJsgzzx>().lambda().eq(XcglAssoJsgzzx::getRulestate, 4).eq(XcglAssoJsgzzx::getIsCustom, 1)
.eq(XcglAssoJsgzzx::getOptionid, 0).eq(XcglAssoJsgzzx::getSalaryitem, zdy.getSalaryitem()));
XcglAssoXzb xzb_custom = XcglAssoXzb.builder().build().selectOne(new QueryWrapper<XcglAssoXzb>().lambda().eq(XcglAssoXzb::getXzxid, zdygsx.getId()).eq(XcglAssoXzb::getUserid, pag.getUserid()));
custom_ = xzb_custom.getXzxjg();
qaz = formula.replace("#"+zdy.getSalaryitem()+"#", String.valueOf(custom_));
}
}
boolean status = qaz.contains("#");//再次确认公式中是否存在系统数据项
if(status) {
List<XcglAssoJsgzzx> system_zdyx = XcglAssoJsgzzx.builder().build().selectList(new QueryWrapper<XcglAssoJsgzzx>().lambda().eq(XcglAssoJsgzzx::getXzzid, calcomtiondto.getPay_group_id())
.eq(XcglAssoJsgzzx::getIsCustom, 0).ne(XcglAssoJsgzzx::getType, 1));
for(XcglAssoJsgzzx sys : system_zdyx) {
if(qaz.contains("#"+sys.getSalaryitem()+"#")) {
XcglAssoXzb xzb_custom = XcglAssoXzb.builder().build().selectOne(new QueryWrapper<XcglAssoXzb>().lambda().eq(XcglAssoXzb::getXzxid, sys.getId()).eq(XcglAssoXzb::getUserid, pag.getUserid()));
double custom_two = xzb_custom.getXzxjg();
qaz = formula.replace("#"+sys.getSalaryitem()+"#", String.valueOf(custom_two));
}
} }
} }
if(!qaz.contains("#")) {
result = Double.valueOf(String.valueOf(js.eval(qaz)));
}else {
System.err.println(xzx.getOptionid() + ":"+qaz+"有误!!!");
}
XcglAssoXzb.builder().xzxjg(result).build().update(new QueryWrapper<XcglAssoXzb>().lambda().eq(XcglAssoXzb::getXzxid, xzx.getId()).eq(XcglAssoXzb::getUserid, pag.getUserid()));
}
}//存在的计薪规则组项数据对应 写入薪资表 --结束 }//存在的计薪规则组项数据对应 写入薪资表 --结束
...@@ -1891,7 +1913,7 @@ public class SalaryManagementController { ...@@ -1891,7 +1913,7 @@ public class SalaryManagementController {
String[] miscalculation = getPersonalincometax(cumynssde); String[] miscalculation = getPersonalincometax(cumynssde);
gsmx.setTaxRate(Double.valueOf(miscalculation[0]));//税率 gsmx.setTaxRate(Double.valueOf(miscalculation[0]));//税率
gsmx.setQuickCalculationDeduction(Double.valueOf(miscalculation[1]));//速算扣除数 gsmx.setQuickCalculationDeduction(Double.valueOf(miscalculation[1]));//速算扣除数
gsmx.setCumYnse(Double.valueOf(miscalculation[3]));//累计应纳税额 【累计应纳税所得额*税率-速算扣除数】 gsmx.setCumYnse(Double.valueOf(miscalculation[2]));//累计应纳税额 【累计应纳税所得额*税率-速算扣除数】
double cumyyjse = 0; double cumyyjse = 0;
cumyyjse = (sygs == null ? 0 : sygs.getCumYyjse()) + (sygs == null ? 0 : sygs.getCumYbtse()); cumyyjse = (sygs == null ? 0 : sygs.getCumYyjse()) + (sygs == null ? 0 : sygs.getCumYbtse());
...@@ -1904,8 +1926,11 @@ public class SalaryManagementController { ...@@ -1904,8 +1926,11 @@ public class SalaryManagementController {
gsmx.setQyid(orgcode);//企业id gsmx.setQyid(orgcode);//企业id
gsmx.insert(); gsmx.insert();
if(cumybtse > 0) {
personalincome = cumybtse; personalincome = cumybtse;
} }
}
return personalincome; return personalincome;
} }
......
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