Commit 95791e57 by ilal Committed by chenzg

提交

parent 4285f65d
......@@ -16,6 +16,7 @@ import javax.script.ScriptEngineManager;
import javax.script.ScriptException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
......@@ -148,6 +149,10 @@ import io.swagger.annotations.ApiOperation;
@RestController
@RequestMapping(value = "/sala", produces = { "application/json" })
public class SalaryManagementController {
@Value("${config-8timer.prescription}")
public double prescription; // 一天工作小时数
// 薪酬管理-定薪
@Autowired
private XcglAssoXzdadxMapper xcglassoxzdadxmapper;
......@@ -1212,8 +1217,14 @@ public class SalaryManagementController {
zzx.setJxgzid(tjsal.getGroid());//计薪规则组id 0:未加入组
zzx.setRemarks("");//备注
zzx.setXzzid(tjsal.getId());
zzx.setDygk(xzxj.getDygk());
zzx.setDegk(xzxj.getDegk());
if(xzxj != null) {
zzx.setDygk(xzxj.getDygk() == null ? 0 : xzxj.getDygk());
zzx.setDegk(xzxj.getDegk() == null ? 0 : xzxj.getDegk());
}else {
zzx.setDygk(0.0);
zzx.setDegk(0.0);
}
gzzxlist.add(zzx);
}
}
......@@ -1511,7 +1522,7 @@ public class SalaryManagementController {
QueryWrapper<SbgjjAssoDetailed> queryWrapper = new QueryWrapper<>();
queryWrapper.select(fieldname).eq("coverage_name", lbcx.getOptionname().substring(0, 2)).eq("user_id", znr.getUserid()).eq("org_code", userBean.getOrgCode()).eq("attribution_time", xzyf);//select #{tablename} from yggl_main_emp where emp_num = ?
list = sbgjjassodetailedmapper.selectMaps(queryWrapper);
}else if(tablename.equals("kqgl_asso_relation_summary")) {//假期(32~41)、补卡次数15、工作日加班24、休息日加班25、节假日加班26
}else if(tablename.equals("kqgl_asso_relation_summary")) {//假期(32~41)[请假的总小时数]、补卡次数15、工作日加班24、休息日加班25、节假日加班26
if(lbcx.getId() == 32) {
HolidayInquiryDto balance = xcglassoxzbmapper.Holidayamount(orgcode, xzyf, 1, znr.getUserid());
vacation = balance.getBalance();
......@@ -1680,7 +1691,7 @@ public class SalaryManagementController {
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:哺乳假;
List<XcglAssoJsgzzx> sjbt = XcglAssoJsgzzx.builder().build().selectList(new QueryWrapper<XcglAssoJsgzzx>().lambda().eq(XcglAssoJsgzzx::getXzzid, calcomtiondto.getPay_group_id()));
List<XcglAssoJsgzzx> sjbt = xcglassojsgzzxmapper.SalaryRuleGroupItem(calcomtiondto.getPay_group_id());//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();
......@@ -1715,6 +1726,9 @@ public class SalaryManagementController {
double grgjj = 0;//个人公积金
double net_salary = 0;//实发工资
int matter_leave_num = 0;//事假次数
int sick_leave_num = 0;//病假次数
//薪资组内成员
for(XcglAssoXzury pag : paygrlist) {
......@@ -1732,8 +1746,18 @@ public class SalaryManagementController {
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() == 32) { matter_leave = xzb.getXzxjg(); }//事假
if(xzx.getIsCustom() == 0 && xzx.getOptionid() == 34) { sick_leave = xzb.getXzxjg(); }//病假
if(xzx.getIsCustom() == 0 && xzx.getOptionid() == 32) {
matter_leave = xzb.getXzxjg(); //
HolidayInquiryDto balance = xcglassoxzbmapper.HolidayamountNum(orgcode, salary_month, 1, pag.getUserid());
matter_leave_num = balance.getNum();
}//事假
if(xzx.getIsCustom() == 0 && xzx.getOptionid() == 34) {
sick_leave = xzb.getXzxjg(); //
HolidayInquiryDto balance = xcglassoxzbmapper.HolidayamountNum(orgcode, salary_month, 3, pag.getUserid());
sick_leave_num = balance.getNum();
}//病假
if(xzx.getIsCustom() == 0 && xzx.getOptionid() == 12) { absenteeism_days = xzb.getXzxjg(); }//旷工天数
if(xzx.getIsCustom() == 0 && xzx.getOptionid() == 72) { other_deductions = xzb.getXzxjg(); }//其他扣除
if(xzx.getIsCustom() == 0 && xzx.getOptionid() == 13) { late_cs = xzb.getXzxjg(); }//迟到次数
......@@ -1762,19 +1786,39 @@ public class SalaryManagementController {
result = Double.valueOf(String.valueOf(js.eval(qaz)));
}
if(xzx.getIsCustom() == 0 && xzx.getOptionid() == 27) {//事假扣款
String formula = xzx.getGsgs();//#基本工资#/#应出勤天数#*#事假# #事假#*200
String qaz = formula.replace("#基本工资#", String.valueOf(base_pay)).replace("#应出勤天数#", String.valueOf(attendance_days)).replace("#事假#", String.valueOf(matter_leave));
String formula = xzx.getGsgs();//#基本工资#/#应出勤天数#*#事假天数#
if(xzx.getGsid() == 3) {//事假天数
matter_leave = SalaryTool.formatDouble_(matter_leave/prescription);//转化天数
String qaz = formula.replace("#基本工资#", String.valueOf(base_pay)).replace("#应出勤天数#", String.valueOf(attendance_days)).replace("#事假天数#", String.valueOf(matter_leave));
if(attendance_days > 0) {
result = Double.valueOf(String.valueOf(js.eval(qaz)));
}
}else if(xzx.getGsid() == 4) {//事假次数 #事假次数#*200
String qaz = formula.replace("#事假次数#", String.valueOf(matter_leave_num));
if(attendance_days > 0) {
result = Double.valueOf(String.valueOf(js.eval(qaz)));
}
}
matter_leave_deduction = result;
}
if(xzx.getIsCustom() == 0 && xzx.getOptionid() == 28) {//病假扣款
String formula = xzx.getGsgs();//#基本工资#/#应出勤天数#*#病假#*0.4 #病假#*100
String qaz = formula.replace("#基本工资#", String.valueOf(base_pay)).replace("#应出勤天数#", String.valueOf(attendance_days)).replace("#病假#", String.valueOf(sick_leave));
String formula = xzx.getGsgs();//#基本工资#/#应出勤天数#*#病假天数#*0.4
if(xzx.getGsid() == 5) {//病假天数
sick_leave = SalaryTool.formatDouble_(sick_leave/prescription);//转化天数
String qaz = formula.replace("#基本工资#", String.valueOf(base_pay)).replace("#应出勤天数#", String.valueOf(attendance_days)).replace("#病假天数#", String.valueOf(sick_leave));
if(attendance_days > 0) {
result = Double.valueOf(String.valueOf(js.eval(qaz)));
}
}else if(xzx.getGsid() == 6) {//病假次数 #病假次数#*100
String qaz = formula.replace("#病假次数#", String.valueOf(sick_leave_num));
if(attendance_days > 0) {
result = Double.valueOf(String.valueOf(js.eval(qaz)));
}
}
sick_leave_deduction = result;
}
if(xzx.getIsCustom() == 0 && xzx.getOptionid() == 29) {//旷工扣款
......@@ -3288,7 +3332,8 @@ public class SalaryManagementController {
@PostMapping(value = "/pushpayslip")
@ApiOperation(value = "发送工资条", httpMethod = "POST", notes = "接口发布说明")
public Result<Object> PushPayslip(@CurrentUser UserBean userBean,@RequestBody PushPayslipDto pays) {
double prescription = 8;
String strY = new SimpleDateFormat("yyyy").format(new Date());
// double prescription = 8;
//顶层
AppPayslipDetailsDto top = new AppPayslipDetailsDto();
//工资条数据
......@@ -3326,13 +3371,20 @@ public class SalaryManagementController {
//事假扣款
if(xzx.getOptionid() == 27) {
spe.setItemname(xzx.getSalaryitem());//
spe.setDeduction(xzb == null ? 0 : xzb.getXzxjg());//
spe.setDeduction(xzb == null ? 0 : xzb.getXzxjg());//扣款金额
if(xzx.getGsid() == 3) {//天数
HolidayInquiryDto balance = xcglassoxzbmapper.Holidayamount(userBean.getOrgCode(), pays.getXzyf(), 1, pays.getUserid());
double ts = 0;
if(balance.getBalance() > 0) {
ts = balance.getBalance()/prescription;
}
spe.setFieldone("共"+balance.getBalance()+"小时="+SalaryTool.formatDouble_(ts)+"天");
}else if(xzx.getGsid() == 4) {//次数
HolidayInquiryDto balance = xcglassoxzbmapper.HolidayamountNum(userBean.getOrgCode(), pays.getXzyf(), 1, pays.getUserid());
spe.setFieldone("共"+balance.getNum()+"次");
}
spe.setFieldtwo("");
//事假详细
List<KqglAssoRelationSummary> holdet = kqglassorelationsummarymapper.HolidayDetails(userBean.getOrgCode(), pays.getXzyf(), 1, pays.getUserid());
......@@ -3350,12 +3402,19 @@ public class SalaryManagementController {
if(xzx.getOptionid() == 28) {
spe.setItemname(xzx.getSalaryitem());//
spe.setDeduction(xzb == null ? 0 : xzb.getXzxjg());//
if(xzx.getGsid() == 5) {//天数
HolidayInquiryDto balance = xcglassoxzbmapper.Holidayamount(userBean.getOrgCode(), pays.getXzyf(), 3, pays.getUserid());
double ts = 0;
if(balance.getBalance() > 0) {
ts = balance.getBalance()/prescription;
}
spe.setFieldone("共"+balance.getBalance()+"小时="+SalaryTool.formatDouble_(ts)+"天");
}else if(xzx.getGsid() == 6) {//次数
HolidayInquiryDto balance = xcglassoxzbmapper.HolidayamountNum(userBean.getOrgCode(), pays.getXzyf(), 3, pays.getUserid());
spe.setFieldone("共"+balance.getNum()+"次");
}
spe.setFieldtwo("");
//病假详细
List<KqglAssoRelationSummary> holdet = kqglassorelationsummarymapper.HolidayDetails(userBean.getOrgCode(), pays.getXzyf(), 3, pays.getUserid());
......@@ -3374,18 +3433,73 @@ public class SalaryManagementController {
spe.setDeduction(xzb == null ? 0 : xzb.getXzxjg());//
}
spe.setFieldtwo("");
specific.add(spe);
}
//迟到早退扣款
if(xzx.getOptionid() == 30) {
top.setSpecific(specific);
}
//司龄工资
if(xzx.getOptionid() == 31) {
spe.setItemname(xzx.getSalaryitem());//
spe.setDeduction(xzb == null ? 0 : xzb.getXzxjg());//
spe.setFieldone("");
spe.setFieldtwo("");
YgglMainEmp xzrz = YgglMainEmp.builder().build().selectOne(new QueryWrapper<YgglMainEmp>().lambda().eq(YgglMainEmp::getEmpNum, pays.getUserid()).eq(YgglMainEmp::getOrgCode, userBean.getOrgCode()));
String entry_date = ClockInTool.SunNovCSTYMD(xzrz.getRzTime());//yyyyMMdd
int jssl = Integer.valueOf(ClockInTool.SunNovCSTY(xzrz.getRzTime()));//yyyy
double slage = 0;
if(Integer.valueOf(strY) - jssl >= 0) {
slage = Integer.valueOf(strY) - jssl;
}
AppPaysSalaryTwoDto two = new AppPaysSalaryTwoDto();
two.setTerm("入职日期");
two.setSpecifictime(entry_date);
two.setField(slage);
detailed.add(two);
spe.setDetailed(detailed);
}
//个税
if(xzx.getOptionid() == 69) {
spe.setItemname(xzx.getSalaryitem());//
spe.setDeduction(0.0);//
spe.setFieldone("");
spe.setFieldtwo("");
String[] remarks = {"本月个税","税款所属月份","累计专项附加扣除","本期收入","本期专项扣除","累计收入额","累计减除费用","累计专项扣除","累计其他扣除","累计应纳税所得额","税率","速算扣除数","累计应纳税额","累计已预缴税额","累计应补(退)税额"};
String[] field = {"thmonth_personal","tax_month","cum_zxfjkc","current_income","current_special_deduction","cum_sre","cum_jcfy","cum_zxkc","cum_qtkc","cum_ynssde","tax_rate","quick_calculation_deduction","cum_ynse","cum_yyjse","cum_ybtse"};
//个税详情
for(int i=0;i<remarks.length;i++) {
AppPaysSalaryTwoDto two = new AppPaysSalaryTwoDto();
two.setTerm(remarks[i]);
QueryWrapper<XcglAssoGsjsmx> queryWrapper = new QueryWrapper<>();
queryWrapper.select(field[i]).eq("user_num", pays.getUserid()).eq("salary_month", pays.getXzyf()).eq("qyid", userBean.getOrgCode());
List<Map<String, Object>> list = xcglassogsjsmxmapper.selectMaps(queryWrapper);
String autacq = "";
if(list != null) {
for(Map<String, Object> aut:list) {
if(aut != null) {
autacq = aut.toString().substring(aut.toString().indexOf("=")+1).replace("}", "");
}
}
}
two.setSpecifictime(("").equals(autacq) ? "0" : autacq);
two.setField(0.0);
detailed.add(two);
}
spe.setDetailed(detailed);
}
specific.add(spe);
}
top.setSpecific(specific);
}
}
......
......@@ -29,4 +29,6 @@ public interface XcglAssoJsgzzxMapper extends BaseMapper<XcglAssoJsgzzx> {
List<CalculationOptionsDto> selectCalculationOptionsList(int xzzid,int userid);
List<XcglAssoJsgzzx> selectSalarySectionList(int xzzid);
List<XcglAssoJsgzzx> SalaryRuleGroupItem(int xzzid);
}
......@@ -38,6 +38,8 @@ public interface XcglAssoXzbMapper extends BaseMapper<XcglAssoXzb> {
void updateBatchXzxjg(List<XcglAssoXzb> list);
HolidayInquiryDto HolidayamountNum(int orgcode,String apptime,int rules_type,int userid);
HolidayInquiryDto Holidayamount(int orgcode,String apptime,int rules_type,int userid);
HolidayInquiryDto NumberOvertime(int orgcode,String apptime,int userid);
......
......@@ -194,6 +194,7 @@ config-8timer:
machine8timerUrl: 'http://test-8timer-fk.youlingrc.com'
#machine8timerUrl: 'http://192.168.3.38:8088'
authentication-code: '888888'
prescription: 8 #一天工作8小时
register-free-time: 90 #系统赠送时间
register-company-max-num: 100 #默认最大公司数量
register-childAccount-max-num: 10 #默认最大子账号数量
......
......@@ -169,6 +169,7 @@ config-8timer:
machine8timerUrl: 'http://record.8timer.cn'
#machine8timerUrl: 'http://192.168.3.38:8088'
authentication-code: ''
prescription: 8 #一天工作8小时
register-free-time: 90 #系统赠送时间
register-company-max-num: 100
register-childAccount-max-num: 10
......
......@@ -168,6 +168,7 @@ config-8timer:
machine8timerUrl: 'http://test-8timer-fk.youlingrc.com'
#machine8timerUrl: 'http://192.168.3.38:8088'
authentication-code: '888888'
prescription: 8 #一天工作8小时
register-free-time: 90 #系统赠送时间
register-company-max-num: 100
register-childAccount-max-num: 10
......
......@@ -45,6 +45,13 @@
<result column="rsz" property="rsz"/>
</resultMap>
<select id="SalaryRuleGroupItem" resultMap="BaseResultMap">
select * from xcgl_asso_jsgzzx js
where js.xzzid = #{xzzid}
ORDER BY js.rulestate = 2 or js.rulestate = 3 ASC,
js.id ASC
</select>
<select id="selectSalarySectionList" resultMap="BaseResultMap">
select jsgzzx.* from xcgl_asso_jsgzzx jsgzzx
LEFT JOIN xcgl_asso_option as opt on opt.id = jsgzzx.optionid
......
......@@ -94,6 +94,17 @@
where aa.orgcode = #{orgcode}
</select>
<select id="HolidayamountNum" resultMap="HolidayInquiryDtoMap">
select COUNT(*) as num
from kqgl_asso_relation_summary su
where su.approval_type = 2
and su.org_code = #{orgcode}
and su.ordernum = 1
and SUBSTR(su.app_time,1,7) = #{apptime}
and su.leave_type_id = (select ru.id from kqgl_asso_leave_rules ru where ru.org_code = #{orgcode} and ru.rules_type = #{rules_type})
and su.user_id = #{userid}
</select>
<select id="Holidayamount" resultMap="HolidayInquiryDtoMap">
select IFNULL(SUM(su.duration),0) as balance
from kqgl_asso_relation_summary su
......
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