Commit c9c7462a by ilal Committed by chenzg

提交

parent 873b80fc
...@@ -762,5 +762,15 @@ public class ClockInTool { ...@@ -762,5 +762,15 @@ public class ClockInTool {
cst = simpleDateFormat.format(date2); cst = simpleDateFormat.format(date2);
return cst; return cst;
} }
/**
* Sun Nov 01 00:00:00 CST 2020
*/
public static String SunNovCSTY(Date date2){
String cst;
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy");
cst = simpleDateFormat.format(date2);
return cst;
}
} }
...@@ -11,6 +11,9 @@ import java.util.List; ...@@ -11,6 +11,9 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
import javax.script.ScriptException;
import cn.timer.api.dto.xcgl.*; import cn.timer.api.dto.xcgl.*;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -1602,16 +1605,22 @@ public class SalaryManagementController { ...@@ -1602,16 +1605,22 @@ public class SalaryManagementController {
* @param userBean * @param userBean
* @param calcomtiondto * @param calcomtiondto
* @return * @return
* @throws ScriptException
* @throws NumberFormatException
*/ */
@PostMapping(value = "/salary_calculation") @PostMapping(value = "/salary_calculation")
@ApiOperation(value = "计算薪资", httpMethod = "POST", notes = "接口发布说明") @ApiOperation(value = "计算薪资", httpMethod = "POST", notes = "接口发布说明")
public Result<Object> SalaryCalculation(@CurrentUser UserBean userBean, @RequestBody CalculatingCompensationDto calcomtiondto) { public Result<Object> SalaryCalculation(@CurrentUser UserBean userBean, @RequestBody CalculatingCompensationDto calcomtiondto) throws NumberFormatException, ScriptException {
int orgcode = userBean.getOrgCode(); int orgcode = userBean.getOrgCode();
String strY = new SimpleDateFormat("yyyy").format(new Date());
ScriptEngine js = new ScriptEngineManager().getEngineByName("JavaScript");
//查询出薪资组内成员 //查询出薪资组内成员
List<XcglAssoXzury> paygrlist = XcglAssoXzury.builder().build().selectList(new QueryWrapper<XcglAssoXzury>().lambda().eq(XcglAssoXzury::getXzzid, calcomtiondto.getPay_group_id())); List<XcglAssoXzury> paygrlist = XcglAssoXzury.builder().build().selectList(new QueryWrapper<XcglAssoXzury>().lambda().eq(XcglAssoXzury::getXzzid, calcomtiondto.getPay_group_id()));
//查询出当前薪资组里所有列表头 计薪规则组项 固定数值 //查询出当前薪资组里所有列表头 计薪规则组项 固定数值
//32:事假、33:调休、34:病假、35:年假、36:产假、37:陪产假、38:婚假、39:例假、40:丧假、41:哺乳假; //32:事假、33:调休、34:病假、35:年假、36:产假、37:陪产假、38:婚假、39:例假、40:丧假、41:哺乳假;
List<XcglAssoJsgzzx> sjbt = XcglAssoJsgzzx.builder().build().selectList(new QueryWrapper<XcglAssoJsgzzx>().lambda().eq(XcglAssoJsgzzx::getXzzid, calcomtiondto.getPay_group_id())); List<XcglAssoJsgzzx> sjbt = XcglAssoJsgzzx.builder().build().selectList(new QueryWrapper<XcglAssoJsgzzx>().lambda().eq(XcglAssoJsgzzx::getXzzid, calcomtiondto.getPay_group_id()));
//薪资组信息 //薪资组信息
XcglAdminXzz xzz = XcglAdminXzz.builder().id(calcomtiondto.getPay_group_id()).build().selectById(); XcglAdminXzz xzz = XcglAdminXzz.builder().id(calcomtiondto.getPay_group_id()).build().selectById();
//算薪月周期 //算薪月周期
...@@ -1633,43 +1642,70 @@ public class SalaryManagementController { ...@@ -1633,43 +1642,70 @@ public class SalaryManagementController {
double other_deductions = 0;//其他扣除 double other_deductions = 0;//其他扣除
double wages_payable = 0;//应发工资 double wages_payable = 0;//应发工资
double achievement_bonus = 0;//绩效奖金
double performance_commission = 0;//业绩提成
double pre_taxmakediff = 0;//税前补差
double secretary_ling = 0;//司龄
//薪资组内成员 //薪资组内成员
for(XcglAssoXzury pag : paygrlist) { for(XcglAssoXzury pag : paygrlist) {
//存在的计薪规则组项数据对应 //存在的计薪规则组项数据对应 写入薪资表
for(XcglAssoJsgzzx xzx : sjbt) { for(XcglAssoJsgzzx xzx : sjbt) {
if(xzx.getRulestate() == 1 && xzx.getIsCustom() == 0 && xzx.getOptionid() == 0 && xzx.getSalaryitem().equals("基本工资")) { if(xzx.getRulestate() == 1 && xzx.getIsCustom() == 0 && xzx.getOptionid() == 0 && xzx.getSalaryitem().equals("基本工资")) {
XcglAssoXzb xzb = XcglAssoXzb.builder().build().selectOne(new QueryWrapper<XcglAssoXzb>().lambda().eq(XcglAssoXzb::getXzxid, xzx.getId())); XcglAssoXzb xzb = XcglAssoXzb.builder().build().selectOne(new QueryWrapper<XcglAssoXzb>().lambda().eq(XcglAssoXzb::getXzxid, xzx.getId()).eq(XcglAssoXzb::getUserid, pag.getUserid()));
base_pay = xzb.getXzxjg(); base_pay = xzb.getXzxjg();
} }
if(xzx.getRulestate() == 1 && xzx.getIsCustom() == 0 && xzx.getOptionid() == 0 && xzx.getSalaryitem().equals("岗位津贴")) { if(xzx.getRulestate() == 1 && xzx.getIsCustom() == 0 && xzx.getOptionid() == 0 && xzx.getSalaryitem().equals("岗位津贴")) {
XcglAssoXzb xzb = XcglAssoXzb.builder().build().selectOne(new QueryWrapper<XcglAssoXzb>().lambda().eq(XcglAssoXzb::getXzxid, xzx.getId())); XcglAssoXzb xzb = XcglAssoXzb.builder().build().selectOne(new QueryWrapper<XcglAssoXzb>().lambda().eq(XcglAssoXzb::getXzxid, xzx.getId()).eq(XcglAssoXzb::getUserid, pag.getUserid()));
post_allowance = xzb.getXzxjg(); post_allowance = xzb.getXzxjg();
} }
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) {//应出勤天数 if(xzx.getIsCustom() == 0 && xzx.getOptionid() == 10) {//应出勤天数
XcglAssoXzb xzb = XcglAssoXzb.builder().build().selectOne(new QueryWrapper<XcglAssoXzb>().lambda().eq(XcglAssoXzb::getXzxid, xzx.getId()));
attendance_days = xzb.getXzxjg(); attendance_days = xzb.getXzxjg();
} }
if(xzx.getIsCustom() == 0 && xzx.getOptionid() == 11) {//实出勤天数 if(xzx.getIsCustom() == 0 && xzx.getOptionid() == 11) {//实出勤天数
XcglAssoXzb xzb = XcglAssoXzb.builder().build().selectOne(new QueryWrapper<XcglAssoXzb>().lambda().eq(XcglAssoXzb::getXzxid, xzx.getId()));
actual_attendance_days = xzb.getXzxjg(); actual_attendance_days = xzb.getXzxjg();
} }
if(xzx.getIsCustom() == 0 && xzx.getOptionid() == 32) {//事假 if(xzx.getIsCustom() == 0 && xzx.getOptionid() == 32) {//事假
XcglAssoXzb xzb = XcglAssoXzb.builder().build().selectOne(new QueryWrapper<XcglAssoXzb>().lambda().eq(XcglAssoXzb::getXzxid, xzx.getId()));
matter_leave = xzb.getXzxjg(); matter_leave = xzb.getXzxjg();
} }
if(xzx.getIsCustom() == 0 && xzx.getOptionid() == 34) {//病假 if(xzx.getIsCustom() == 0 && xzx.getOptionid() == 34) {//病假
XcglAssoXzb xzb = XcglAssoXzb.builder().build().selectOne(new QueryWrapper<XcglAssoXzb>().lambda().eq(XcglAssoXzb::getXzxid, xzx.getId()));
sick_leave = xzb.getXzxjg(); sick_leave = xzb.getXzxjg();
} }
if(xzx.getIsCustom() == 0 && xzx.getOptionid() == 72) {//其他扣除 if(xzx.getIsCustom() == 0 && xzx.getOptionid() == 72) {//其他扣除
XcglAssoXzb xzb = XcglAssoXzb.builder().build().selectOne(new QueryWrapper<XcglAssoXzb>().lambda().eq(XcglAssoXzb::getXzxid, xzx.getId()));
other_deductions = xzb.getXzxjg(); other_deductions = xzb.getXzxjg();
} }
if(xzx.getIsCustom() == 0 && xzx.getOptionid() == 43) {//司龄
YgglMainEmp xzrz = YgglMainEmp.builder().build().selectOne(new QueryWrapper<YgglMainEmp>().lambda().eq(YgglMainEmp::getEmpNum, pag.getUserid()).eq(YgglMainEmp::getOrgCode, orgcode));
int entry_date = Integer.valueOf(ClockInTool.SunNovCSTY(xzrz.getRzTime()));//yyyy
if(Integer.valueOf(strY) - entry_date >= 0) {
secretary_ling = Integer.valueOf(strY) - entry_date;
}
XcglAssoXzb.builder().xzxjg(secretary_ling).build().update(new QueryWrapper<XcglAssoXzb>().lambda().eq(XcglAssoXzb::getXzxid, xzx.getId()).eq(XcglAssoXzb::getUserid, pag.getUserid()));
}
//公式计算
//(固定公式计算):迟到早退扣款、事假扣款、病假扣款、旷工扣款、司龄工资、应发工资、实发工资
if(xzx.getRulestate() == 2) {
if(xzx.getIsCustom() == 0 && xzx.getOptionid() == 43) {//司龄工资
String formula = xzx.getGsgs();//#司龄#*100
String qaz = formula.replace("#司龄#", "+secretary_ling+");
double result = 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()));
}
}
//(自定义公式计算): 应发工资、实发工资
if(xzx.getRulestate() == 3) {
}
} }
......
...@@ -23,5 +23,6 @@ public class PayTermDto implements Serializable { ...@@ -23,5 +23,6 @@ public class PayTermDto implements Serializable {
Integer xgsid;// 项对应的公式id Integer xgsid;// 项对应的公式id
String xgsgs;// 项公式 String xgsgs;// 项公式
Integer xjxgzid;// Integer xjxgzid;//
Integer xoptionid;
} }
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
<result column="xgsid" property="xgsid"/> <result column="xgsid" property="xgsid"/>
<result column="xgsgs" property="xgsgs"/> <result column="xgsgs" property="xgsgs"/>
<result column="xjxgzid" property="xjxgzid"/> <result column="xjxgzid" property="xjxgzid"/>
<result column="xoptionid" property="xoptionid"/>
</collection> </collection>
</resultMap> </resultMap>
...@@ -180,6 +181,7 @@ ...@@ -180,6 +181,7 @@
gzzx.gsid as xgsid, gzzx.gsid as xgsid,
gzzx.gsgs as xgsgs, gzzx.gsgs as xgsgs,
gzzx.jxgzid as xjxgzid, gzzx.jxgzid as xjxgzid,
gzzx.optionid as xoptionid,
jxgz.xzzid as zxzzid jxgz.xzzid as zxzzid
from xcgl_asso_jxgz jxgz from xcgl_asso_jxgz jxgz
LEFT JOIN xcgl_asso_jsgzzx as gzzx on gzzx.jxgzid = jxgz.id LEFT JOIN xcgl_asso_jsgzzx as gzzx on gzzx.jxgzid = jxgz.id
......
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