Commit 4bfd373a by mobh Committed by chenzg

发送工资条 接口

parent d958118e
......@@ -12,6 +12,7 @@ import java.util.Map;
import javax.annotation.Resource;
import cn.timer.api.dto.xcgl.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
......@@ -37,7 +38,6 @@ import cn.timer.api.bean.kqgl.PunchRecord;
import cn.timer.api.bean.kqgl.Schedule;
import cn.timer.api.bean.kqgl.SpecialDate;
import cn.timer.api.bean.kqmk.KqglAssoMonthPunchSummary;
import cn.timer.api.bean.sbgjj.SbgjjAssoDetailed;
import cn.timer.api.bean.sbgjj.SbgjjAssoYjzd;
import cn.timer.api.bean.xcgl.XcglAdminXzz;
import cn.timer.api.bean.xcgl.XcglAssoBszqsz;
......@@ -66,7 +66,6 @@ import cn.timer.api.dao.kqgl.PunchRecordMapper;
import cn.timer.api.dao.kqgl.ScheduleMapper;
import cn.timer.api.dao.kqgl.SpecialDateMapper;
import cn.timer.api.dao.kqmk.KqglAssoMonthPunchSummaryMapper;
import cn.timer.api.dao.sbgjj.SbgjjAssoDetailedMapper;
import cn.timer.api.dao.sbgjj.SbgjjAssoYjzdMapper;
import cn.timer.api.dao.xcgl.XcglAdminXzzMapper;
import cn.timer.api.dao.xcgl.XcglAssoGsjsmxMapper;
......@@ -86,41 +85,6 @@ import cn.timer.api.dao.xcgl.XcglSalaryItemMapper;
import cn.timer.api.dao.yggl.YgglMainEmpMapper;
import cn.timer.api.dto.kqmk.CalculatingCompensationDto;
import cn.timer.api.dto.sbgjj.InspersonnelDto;
import cn.timer.api.dto.xcgl.AdditionalDeductionDto;
import cn.timer.api.dto.xcgl.BuildPayGroupDto;
import cn.timer.api.dto.xcgl.CalculatedFieldDto;
import cn.timer.api.dto.xcgl.CalculationDto;
import cn.timer.api.dto.xcgl.CalculationOptionsDto;
import cn.timer.api.dto.xcgl.ChangeSalaryDto;
import cn.timer.api.dto.xcgl.CheckSalaryStaffDto;
import cn.timer.api.dto.xcgl.CjPayrollGroupDto;
import cn.timer.api.dto.xcgl.CustomDto;
import cn.timer.api.dto.xcgl.FixedSalaryStaffDto;
import cn.timer.api.dto.xcgl.FixedsalaryDto;
import cn.timer.api.dto.xcgl.ImportDescriptionDto;
import cn.timer.api.dto.xcgl.ImportSalaryDto;
import cn.timer.api.dto.xcgl.ImportSalarySetDto;
import cn.timer.api.dto.xcgl.IndividualTaxDetailsDto;
import cn.timer.api.dto.xcgl.ModifyPayslipDto;
import cn.timer.api.dto.xcgl.ModifysalaryruleDto;
import cn.timer.api.dto.xcgl.PayCustomDto;
import cn.timer.api.dto.xcgl.PayCustomZDYDto;
import cn.timer.api.dto.xcgl.PayGroupedDataDto;
import cn.timer.api.dto.xcgl.PayTermDto;
import cn.timer.api.dto.xcgl.PayrollExceptionDto;
import cn.timer.api.dto.xcgl.PayrollGroupDto;
import cn.timer.api.dto.xcgl.PayslipDetailsDto;
import cn.timer.api.dto.xcgl.PayslipListDto;
import cn.timer.api.dto.xcgl.SalaryCustomizationDto;
import cn.timer.api.dto.xcgl.SalaryFieldDto;
import cn.timer.api.dto.xcgl.SalaryGroupGroupingDto;
import cn.timer.api.dto.xcgl.SalaryItemRulesDto;
import cn.timer.api.dto.xcgl.SearchSalariedPeopleDto;
import cn.timer.api.dto.xcgl.SpecialDeductionDto;
import cn.timer.api.dto.xcgl.TjSalaryItemDot;
import cn.timer.api.dto.xcgl.XcglAssoGsjsmxDto;
import cn.timer.api.dto.xcgl.XcglAssoOptionDto;
import cn.timer.api.dto.xcgl.YdMobilePacketDto;
import cn.timer.api.utils.DateUtil;
import cn.timer.api.utils.ResponseResult;
import cn.timer.api.utils.Result;
......@@ -405,7 +369,7 @@ public class SalaryManagementController {
xcglassojsgzzxmapper.insertxcglassojsgzzxList(gzzxlist);
}
}else if(("考勤").equals(grouping[g])) {
String[] att = {"应出勤天数","实出勤天数","事假","病假","事假扣款","病假扣款","迟到次数","迟到时长","早退次数","迟到早退扣款"};
String[] att = {"应出勤天数","实出勤天数","事假","病假","事假扣款","病假扣款"};
List<XcglAssoJsgzzx> gzzxlist=new ArrayList<XcglAssoJsgzzx>();
for(int a=0;a<att.length;a++) {
XcglAssoXcjsgz xzxj = xcglassoxcjsgzmapper.QuerySalaryRules(att[a]);
......@@ -413,10 +377,10 @@ public class SalaryManagementController {
zzx.setSalaryitem(att[a]);//薪资项
zzx.setYhmbzd(att[a]);//银行模板项 需与银行一一对应
if(xzxj != null) {//系统有规则
zzx.setRule(xzxj.getGsxs().replace("{{", "").replace("}}", ""));//规则********************************
zzx.setRule(xzxj.getGsxs());//规则********************************
zzx.setGsid(xzxj.getId());//公式id 0:未关联规则
zzx.setGsgs(xzxj.getGsxs().replace("{{", "").replace("}}", ""));//公式格式 系统提供/自定义公式
zzx.setRulestate(xzxj.getRulestate());//规则状态[0:系统自动提取;1:系统固定值;2:固定公式计算;3:自定义公式计算;4:每月自动导入]
zzx.setGsgs(xzxj.getGsxs());//公式格式 系统提供/自定义公式
zzx.setRulestate(2);//规则状态[0:系统自动提取;1:系统固定值;2:固定公式计算;3:自定义公式计算;4:每月自动导入]
}else {
String xxs = "自动提取数据";
String[] strxz = {"从月度汇总-"};
......@@ -471,10 +435,10 @@ public class SalaryManagementController {
zzx.setSalaryitem(yingfa[a]);//薪资项
zzx.setYhmbzd(yingfa[a]);//银行模板项 需与银行一一对应
if(xzxj != null) {//系统有规则
zzx.setRule(xzxj.getGsxs().replace("{{", "").replace("}}", ""));//规则********************************
zzx.setRule(xzxj.getGsxs());//规则********************************
zzx.setGsid(xzxj.getId());//公式id 0:未关联规则
zzx.setGsgs(xzxj.getGsxs().replace("{{", "").replace("}}", ""));//公式格式 系统提供/自定义公式
zzx.setRulestate(xzxj.getRulestate());//规则状态[0:系统自动提取;1:系统固定值;2:固定公式计算;3:自定义公式计算;4:每月自动导入]
zzx.setGsgs(xzxj.getGsxs());//公式格式 系统提供/自定义公式
zzx.setRulestate(2);//规则状态[0:系统自动提取;1:系统固定值;2:固定公式计算;3:自定义公式计算;4:每月自动导入]
}else {
zzx.setRule("每月手动导入");//规则********************************
zzx.setGsid(0);//公式id 0:未关联规则
......@@ -525,36 +489,26 @@ public class SalaryManagementController {
List<XcglAssoJsgzzx> gzzxlist=new ArrayList<XcglAssoJsgzzx>();
for(int a=0;a<jsjsf.length;a++) {
XcglAssoXcjsgz xzxj = xcglassoxcjsgzmapper.QuerySalaryRules(jsjsf[a]);
XcglAssoJsgzzx zzx = XcglAssoJsgzzx.builder().build();
zzx.setSalaryitem(jsjsf[a]);//薪资项
zzx.setYhmbzd(jsjsf[a]);//银行模板项 需与银行一一对应
if(xzxj != null) {
zzx.setRule(xzxj.getGsxs().replace("{{", "").replace("}}", ""));//规则********************************
zzx.setGsid(xzxj.getId());//公式id 0:未关联规则
zzx.setGsgs(xzxj.getGsxs().replace("{{", "").replace("}}", ""));//公式格式 系统提供/自定义公式
zzx.setRulestate(xzxj.getRulestate());//规则状态[0:系统自动提取;1:系统固定值;2:固定公式计算;3:自定义公式计算;4:每月自动导入]
zzx.setRule(xzxj.getGsxs());//规则********************************
if(jsjsf[a].equals("个税")) {
zzx.setGsid(0);
}else {
zzx.setRule("每月手动导入");//规则********************************
zzx.setGsid(0);//公式id 0:未关联规则
zzx.setGsgs("每月手动导入");//公式格式 系统提供/自定义公式
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);
}
if(jsjsf[a].equals("个税")) {
zzx.setRulestate(0);//规则状态[0:系统自动提取;1:系统固定值;2:固定公式计算;3:自定义公式计算;4:每月自动导入]
}else {
zzx.setRulestate(2);
}
// 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();
zzx.setOptionid(opt.getId());
zzx.setType(2);//类型 1:系统项;2:非系统项
......@@ -673,7 +627,6 @@ public class SalaryManagementController {
}
/**
* 弹出薪资规则
* @param userBean
* @param id 薪资选项id
* @return
......@@ -904,7 +857,7 @@ public class SalaryManagementController {
@ApiOperation(value = "初始化薪资档案自定义", httpMethod = "GET", notes = "接口发布说明")
public ResponseResult Initialization(@CurrentUser UserBean userBean) {
List<XcglAssoXzdazdy> cshsj = xcglassoxzdazdymapper.selectxcglassoxzdazdy(userBean.getOrgCode());
String[] zdmc = { "基本工资", "岗位津贴" };
String[] zdmc = { "基本工资", "绩效工资", "岗位津贴", "加班工资" };
// 检查是否有初始化数据
if (cshsj.size() == 0) {
for (int z = 0; z < zdmc.length; z++) {
......@@ -1146,9 +1099,9 @@ public class SalaryManagementController {
zzx.setSalaryitem(term[a].getOptname());//薪资项
zzx.setYhmbzd(term[a].getOptname());//银行模板项 需与银行一一对应
if(xzxj != null && term[a].getOptitemid() != 0) {//系统有规则
zzx.setRule(xzxj.getGsxs().replace("{{", "").replace("}}", ""));//规则********************************
zzx.setRule(xzxj.getGsxs());//规则********************************
zzx.setGsid(xzxj.getId());//公式id 0:未关联规则
zzx.setGsgs(xzxj.getGsxs().replace("{{", "").replace("}}", ""));//公式格式 系统提供/自定义公式
zzx.setGsgs(xzxj.getGsxs());//公式格式 系统提供/自定义公式
zzx.setRulestate(2);//规则状态[0:系统自动提取;1:系统固定值;2:固定公式计算;3:自定义公式计算;4:每月自动导入]
}else {//系统无规则
//薪资档案自定义
......@@ -1399,15 +1352,13 @@ public class SalaryManagementController {
private KqglAssoMonthPunchSummaryMapper kqglassomonthpunchsummarymapper;
@Autowired
private SbgjjAssoYjzdMapper sbgjjassoyjzdmapper;
@Autowired
private SbgjjAssoDetailedMapper sbgjjassodetailedmapper;
/**
* (保存,下一步)计算薪资 ()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()
*/
@GetMapping(value = "/calculatesalary/{id}")
@ApiOperation(value = "计算薪资", httpMethod = "GET", notes = "接口发布说明")
public ResponseResult CalculateSalary(@CurrentUser UserBean userBean,@PathVariable Integer id) {
int orgcode = userBean.getOrgCode();
String xzyf = "";
//typeid--1:计算 2:重新计算
......@@ -1470,8 +1421,6 @@ public class SalaryManagementController {
String tablename = lbcx.getTablename();//对应库表名
String fieldname = lbcx.getFieldname();//对应库字段名
List<Map<String, Object>> list = null;
double vacation = 0;//假期
int numover = 0;
if(tablename.equals("yggl_main_emp")) {//员工管理
QueryWrapper<YgglMainEmp> queryWrapper = new QueryWrapper<>();
queryWrapper.select(fieldname).eq("emp_num", znr.getUserid()).eq("org_code", userBean.getOrgCode());//select #{tablename} from yggl_main_emp where emp_num = ?
......@@ -1481,28 +1430,10 @@ public class SalaryManagementController {
queryWrapper.select(fieldname).eq("num", znr.getUserid()).eq("org_code", userBean.getOrgCode()).eq("belong_year", xzyf.substring(0, 4)).eq("belong_month", Integer.valueOf(xzyf.substring(5, 7)));//select #{tablename} from yggl_main_emp where emp_num = ?
list = kqglassomonthpunchsummarymapper.selectMaps(queryWrapper);
}else if(tablename.equals("sbgjj_asso_yjzd")) {
QueryWrapper<SbgjjAssoYjzd> queryWrapper = new QueryWrapper<>();
queryWrapper.select(fieldname).eq("user_num", znr.getUserid()).eq("qyid", userBean.getOrgCode()).eq("zymonth", xzyf);//select #{tablename} from yggl_main_emp where emp_num = ?
list = sbgjjassoyjzdmapper.selectMaps(queryWrapper);
}else if(tablename.equals("sbgjj_asso_detailed")) {//社保公积金
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
if(lbcx.getId() == 32) { vacation = xcglassoxzbmapper.Holidayamount(orgcode, xzyf, 1, znr.getUserid()); }
if(lbcx.getId() == 33) { vacation = xcglassoxzbmapper.Holidayamount(orgcode, xzyf, 2, znr.getUserid()); }
if(lbcx.getId() == 34) { vacation = xcglassoxzbmapper.Holidayamount(orgcode, xzyf, 3, znr.getUserid()); }
if(lbcx.getId() == 35) { vacation = xcglassoxzbmapper.Holidayamount(orgcode, xzyf, 4, znr.getUserid()); }
if(lbcx.getId() == 36) { vacation = xcglassoxzbmapper.Holidayamount(orgcode, xzyf, 5, znr.getUserid()); }
if(lbcx.getId() == 37) { vacation = xcglassoxzbmapper.Holidayamount(orgcode, xzyf, 6, znr.getUserid()); }
if(lbcx.getId() == 38) { vacation = xcglassoxzbmapper.Holidayamount(orgcode, xzyf, 7, znr.getUserid()); }
if(lbcx.getId() == 39) { vacation = xcglassoxzbmapper.Holidayamount(orgcode, xzyf, 8, znr.getUserid()); }
if(lbcx.getId() == 40) { vacation = xcglassoxzbmapper.Holidayamount(orgcode, xzyf, 9, znr.getUserid()); }
if(lbcx.getId() == 41) { vacation = xcglassoxzbmapper.Holidayamount(orgcode, xzyf, 10, znr.getUserid()); }
if(lbcx.getId() == 15) { numover = xcglassoxzbmapper.NumberOvertime(orgcode, xzyf, znr.getUserid());}
if(lbcx.getId() == 24) { numover = xcglassoxzbmapper.PeriodsOvertime(orgcode, xzyf, 1, znr.getUserid());}
if(lbcx.getId() == 25) { numover = xcglassoxzbmapper.PeriodsOvertime(orgcode, xzyf, 2, znr.getUserid());}
if(lbcx.getId() == 26) { numover = xcglassoxzbmapper.PeriodsOvertime(orgcode, xzyf, 3, znr.getUserid());}
}
String autacq = "";
......@@ -1512,9 +1443,6 @@ public class SalaryManagementController {
autacq = aut.toString().substring(aut.toString().indexOf("=")+1).replace("}", "");
}
}
}else {
autacq = String.valueOf(vacation);
autacq = String.valueOf(numover);
}
//处理结果
if(fieldname.equals("job_type")) {
......@@ -1576,9 +1504,9 @@ public class SalaryManagementController {
List<XcglAssoJsgzzx> xtzdtqother = new LambdaQueryChainWrapper<XcglAssoJsgzzx>(xcglassojsgzzxmapper).eq(XcglAssoJsgzzx::getXzzid, id).list();
for(XcglAssoJsgzzx xtzd:xtzdtqother) {
if(xtzd.getRulestate() == 2 || xtzd.getRulestate() == 3 || xtzd.getRulestate() == 4) {
if(xtzd.getOptionid() > 0 || xtzd.getIsCustom() == 1) {//说明阔以根据表查出结果
if(xtzd.getOptionid() > 0) {//说明阔以根据表查出结果
XcglAssoOption lbcx = new LambdaQueryChainWrapper<XcglAssoOption>(xcglassooptionmapper).eq(XcglAssoOption::getId,xtzd.getOptionid()).one();
if(lbcx!= null && lbcx.getTablename() != null && !lbcx.getTablename().equals("") && lbcx.getFieldname() != null && !lbcx.getFieldname().equals("")) {
if(lbcx != null && lbcx.getTablename() != null && !lbcx.getTablename().equals("") && lbcx.getFieldname() != null && !lbcx.getFieldname().equals("")) {
@SuppressWarnings("unused")
String tablename = lbcx.getTablename();//对应库表名
@SuppressWarnings("unused")
......@@ -1635,162 +1563,38 @@ public class SalaryManagementController {
@PostMapping(value = "/salary_calculation")
@ApiOperation(value = "计算薪资", httpMethod = "POST", notes = "接口发布说明")
public Result<Object> SalaryCalculation(@CurrentUser UserBean userBean, @RequestBody CalculatingCompensationDto calcomtiondto) {
int orgcode = userBean.getOrgCode();
//查询出薪资组内成员
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()));
//#1、计算个税 (薪资组id、薪资月份)
//薪资组信息
XcglAdminXzz xzz = XcglAdminXzz.builder().id(calcomtiondto.getPay_group_id()).build().selectById();
//算薪月周期
String startcycle = xzz.getPayrollcycle().substring(0, 10);//开始
String endcycle = xzz.getPayrollcycle().substring(11, 21);//结束
//算薪月份
String salary_month = xzz.getXzyf();//算薪月份
//个税
double perinctax = 0;
//基本工资,岗位津贴,应出勤天数,实出勤天数,事假,病假
double base_pay = 0;//基本工资
double post_allowance = 0;//岗位津贴
double attendance_days = 0;//应出勤天数
double actual_attendance_days = 0;//实出勤天数
double matter_leave = 0;//事假
double sick_leave;//病假
String start = xzz.getPayrollcycle().substring(0, 10);//开始
String end = xzz.getPayrollcycle().substring(11, 21);//结束
//查询出薪资组内成员
List<XcglAssoXzury> paygrlist = XcglAssoXzury.builder().build().selectList(new QueryWrapper<XcglAssoXzury>().lambda().eq(XcglAssoXzury::getXzzid, calcomtiondto.getPay_group_id()));
String[] noperincuser = new String[paygrlist.size()];//用来储存没有个税的用户id
int i = 0;
//薪资组内成员
for(XcglAssoXzury pag : paygrlist) {
XcglAssoGsjsmx gsjs = XcglAssoGsjsmx.builder().build().selectOne(new QueryWrapper<XcglAssoGsjsmx>().lambda().eq(XcglAssoGsjsmx::getQyid, userBean.getOrgCode()).eq(XcglAssoGsjsmx::getUserNum, pag.getUserid())
.eq(XcglAssoGsjsmx::getSalaryMonth, salary_month));
.eq(XcglAssoGsjsmx::getSalaryMonth, calcomtiondto.getSalary_month()));
if(gsjs == null) {
noperincuser[i] = String.valueOf(pag.getUserid());
i++;
}
//存在的计薪规则组项数据对应
for(XcglAssoJsgzzx xzx : sjbt) {
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()));
base_pay = xzb.getXzxjg();
}
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()));
post_allowance = xzb.getXzxjg();
}
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();
}
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();
}
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();
}
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();
}
}
}
//#计算个税 (薪资组id、薪资月份)
//循环计算当前薪资月没有个税的用户 根据
for(String gsus : ClockInTool.deleteArrayNull(noperincuser)) {
// XcglAssoGsjsmx gsjs = XcglAssoGsjsmx.builder().build().
}
//#2、考勤数据
return ResultUtil.data(null, "计算完成");
}
/**
* 计算个税
* @param gsus 用户id
* @param salary_month 计算薪资月
* @param orgcode 企业id
* @param wages_payable 应发工资
* @return
*/
public double CalculationOfIndividualIncomeTax(String gsus,String salary_month,int orgcode,int wages_payable) {
double personalincome = 0;
//当月个税存在则直接获取 无则根据计算薪资月的上月个税为基准计算
XcglAssoGsjsmx dyxzgs = XcglAssoGsjsmx.builder().build().selectOne(new QueryWrapper<XcglAssoGsjsmx>().lambda().eq(XcglAssoGsjsmx::getUserNum, gsus).eq(XcglAssoGsjsmx::getQyid, orgcode)
.eq(XcglAssoGsjsmx::getSalaryMonth, salary_month));
if(dyxzgs != null) {
personalincome = dyxzgs.getThmonthPersonal();
}else {
//#(上月)# 对应薪资月的-1 个税对标数据 (九月工资:对应8月的个税来计算九月的个税)
XcglAssoGsjsmx sygs = XcglAssoGsjsmx.builder().build().selectOne(new QueryWrapper<XcglAssoGsjsmx>().lambda().eq(XcglAssoGsjsmx::getUserNum, gsus).eq(XcglAssoGsjsmx::getQyid, orgcode)
.eq(XcglAssoGsjsmx::getSalaryMonth, SalaryTool.getfirstlastMo(salary_month+"-01 00:00:00")));
YgglMainEmp yh = YgglMainEmp.builder().build().selectOne(new QueryWrapper<YgglMainEmp>().lambda().eq(YgglMainEmp::getEmpNum, gsus).eq(YgglMainEmp::getOrgCode, orgcode));
//#3、套公式算结果
//对应算薪月份的专项附加扣除
XcglAssoZxfjkc zxf = XcglAssoZxfjkc.builder().build().selectOne(new QueryWrapper<XcglAssoZxfjkc>().lambda().eq(XcglAssoZxfjkc::getUserid, gsus)
.eq(XcglAssoZxfjkc::getQyid, orgcode).eq(XcglAssoZxfjkc::getTaxmonth, salary_month));
//写入个税明细表*****************
XcglAssoGsjsmx gsmx = XcglAssoGsjsmx.builder().build();
gsmx.setUserNum(gsus);//用户id
gsmx.setUserName(yh.getName());//用户姓名
gsmx.setSalaryMonth(salary_month);//薪资月
//报税周期:(1:当月报税;2:次月报税)
XcglAssoBszqsz bssz = XcglAssoBszqsz.builder().build().selectOne(new QueryWrapper<XcglAssoBszqsz>().lambda().eq(XcglAssoBszqsz::getQyid, orgcode));
String taxmonth = "";
if(bssz.getTaxReturnCycle().equals(1)) {
taxmonth = salary_month;
}else{
taxmonth = SalaryTool.getfirstnextMo(salary_month+"-01 00:00:00");
}
//#4、数据写入薪资表
gsmx.setTaxMonth(taxmonth);//税款所属月份
// gsmx.setThmonthPersonal(thmonthPersonal);//本月个税
// gsmx.setCumZljy(zxf == null ? 0 : zxf.getChildrenedu());//累计子女教育
// gsmx.setCumZfdklx(zxf == null ? 0 : zxf.getHouseloans());//累计住房贷款利息
// gsmx.setCumZfzj(zxf == null ? 0 : zxf.getHouserents());//累计住房租金
// gsmx.setCumSylr(zxf == null ? 0 : zxf.getSupportolder());//累计赡养老人
// gsmx.setCumJxjy(zxf == null ? 0 : zxf.getContinueedu());//累计继续教育
// gsmx.setCumZxfjkc(zxf == null ? 0 : zxf.getTotalmoney());//累计专项附加扣除
// gsmx.setTaxType("工资薪金所得");//计税类型
// gsmx.setCurrentIncome(currentIncome);//本期收入 【应发工资】
// gsmx.setCurrentSpecialDeduction(currentSpecialDeduction);//本期专项扣除 【个人的社保公积金缴纳扣除】
// gsmx.setCumSre(cumSre);//累计收入额 【本期收入+累计收入额(上月)】
// gsmx.setCumJcfy(cumJcfy);//累计减除费用 【5000*在职月份数】
// gsmx.setCumZxkc(cumZxkc);//累计专项扣除 【本期专项扣除+累计专项扣除(上月)】
// gsmx.setCumQtkc(cumQtkc);//累计其他扣除 【本期其他扣除+累计其他扣除(上月)】
// gsmx.setCumYnssde(cumYnssde);//累计应纳税所得额 【累计收入额-累计减除费用-累计专项扣除-累计专项附加扣除-累计其他扣除】
// gsmx.setTaxRate(taxRate);//税率
// gsmx.setQuickCalculationDeduction(quickCalculationDeduction);//速算扣除数
// gsmx.setCumYnse(cumYnse);//累计应纳税额 【累计应纳税所得额*税率-速算扣除数】
// gsmx.setCumYyjse(cumYyjse);//累计已预缴纳税额 【累计已预缴税额(上月)+累计应补(退)税额(上月)】
// gsmx.setCumYbtse(cumYbtse);//累计应补(退)税额(本月个税) 【累计应纳税额-累计已预缴纳税额】
// gsmx.setQyid(userBean.getOrgCode());//企业id
gsmx.insert();
}
return personalincome;
return ResultUtil.data(null, "计算完成");
}
......@@ -2584,10 +2388,10 @@ public class SalaryManagementController {
return new ResponseResult().success("成功", paydan);
}
@GetMapping(value = "/details/{id}")
@ApiOperation(value = "工资条明细", httpMethod = "GET", notes = "接口发布说明")
public ResponseResult PayslipDetails(@CurrentUser UserBean userBean,@PathVariable Integer id) {
List<PayslipDetailsDto> paydetlist = xcglassogztztmapper.PayslipDetails(id,userBean.getOrgCode());
@PostMapping(value = "/payslipSearch")
@ApiOperation(value = "工资条搜索", httpMethod = "POST", notes = "接口发布说明")
public ResponseResult payslipSearch(@CurrentUser UserBean userBean, @RequestBody PayslipSearchDto dto) {
List<PayslipDetailsDto> paydetlist = xcglassogztztmapper.payslipSearch(dto);
return new ResponseResult().success("成功", paydetlist);
}
......@@ -2942,4 +2746,11 @@ public class SalaryManagementController {
xcglassoxzbmapper.updateBatchXzxjg(list);
return new ResponseResult().success("保存成功");
}
@PostMapping(value = "/sendpayslip/{id}/{fsType}")
@ApiOperation(value = "发送工资条--操作", httpMethod = "POST", notes = "接口发布说明")
public ResponseResult sendpayslip(@CurrentUser UserBean userBean, @PathVariable Integer id, @PathVariable Integer fsType) {
xcglassogztztmapper.payslipSend(id, fsType);
return new ResponseResult().success("成功");
}
}
package cn.timer.api.dao.xcgl;
import java.util.List;
import cn.timer.api.dto.xcgl.PayslipSearchDto;
import org.springframework.stereotype.Repository;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
......@@ -19,8 +20,14 @@ public interface XcglAssoGztztMapper extends BaseMapper<XcglAssoGztzt> {
int deletexcglassogztzt(int gztszid);
List<PayslipDetailsDto> PayslipDetails(int gztszid,int qyid);
List<PayslipDetailsDto> payslipSearch(PayslipSearchDto dto);
int deletegztztByxzzid(int xzzid);
/**
* 发送
* @param id
* @param fsType
*/
void payslipSend(Integer id, Integer fsType);
}
......@@ -23,4 +23,8 @@ public class PayslipDetailsDto implements Serializable {
String dept;
String post;
/**
* 实发工资
*/
private double sfgz;
}
package cn.timer.api.dto.xcgl;
import cn.timer.api.utils.Page;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class PayslipSearchDto extends Page {
@ApiModelProperty(value="姓名/工号 ",example="姓名/工号")
String text;
@ApiModelProperty(value="薪资组id ",example="薪资组id")
Integer xzzid;
@ApiModelProperty(value="工资条组id ",example="工资条组id")
Integer gztszid;
@ApiModelProperty(value="发送状态 ",example="发送状态")
private Integer fsType;
@ApiModelProperty(value="确认状态 ",example="确认状态")
private Integer qrType;
@ApiModelProperty(value="企业编号 ",example="企业编号")
Integer orgcode;
}
......@@ -14,6 +14,7 @@
<result column="yhqm" property="yhqm" />
<result column="qyid" property="qyid" />
<result column="gztszid" property="gztszid" />
<result column="sfgz" property="sfgz" />
</resultMap>
<resultMap id="PayslipDetailsMap" type="cn.timer.api.dto.xcgl.PayslipDetailsDto" >
......@@ -23,6 +24,7 @@
<result column="fstype" property="fstype" />
<result column="cktype" property="cktype" />
<result column="qrtype" property="qrtype" />
<result column="sfgz" property="sfgz" />
<result column="dept" property="dept" />
<result column="post" property="post" />
</resultMap>
......@@ -37,7 +39,8 @@
fkyj,
yhqm,
qyid,
gztszid
gztszid,
sfgz
</sql>
<sql id="Base_Column_List_Alias">
......@@ -47,13 +50,14 @@
fs_type XcglAssoGztzt_fs_type,
ck_type XcglAssoGztzt_ck_type,
qr_type XcglAssoGztzt_qr_type,
sfgz XcglAssoGztzt_sfgz,
fkyj XcglAssoGztzt_fkyj,
yhqm XcglAssoGztzt_yhqm,
qyid XcglAssoGztzt_qyid,
gztszid XcglAssoGztzt_gztszid
</sql>
<select id="PayslipDetails" resultMap="PayslipDetailsMap">
<select id="payslipSearch" resultMap="PayslipDetailsMap">
select emp.`name` as empname,
case emp.job_status
when 0 then '试用'
......@@ -64,16 +68,25 @@
gztzt.ck_type as cktype,
gztzt.qr_type as qrtype,
gztzt.id,
gztzt.sfgz,
bmgw.dept,
bmgw.post
from xcgl_asso_gztzt gztzt
LEFT JOIN yggl_main_emp as emp on emp.emp_num = gztzt.userid and emp.org_code = #{qyid}
LEFT JOIN yggl_main_emp as emp on emp.emp_num = gztzt.userid and emp.org_code = #{orgcode}
LEFT JOIN (select m.name as post,um.name as dept,m.id as mid
from zzgl_bmgw_m m
left join zzgl_bmgw_m um on um.id = m.up_id
) as bmgw on bmgw.mid = emp.bmgw_id
where gztzt.gztszid = #{gztszid}
and gztzt.qyid = #{qyid}
<if test="xzzid != null">
LEFT JOIN xcgl_asso_xzury xzury ON xzury.userid = emp.id and xzury.xzzid = #{xzzid}
</if>
where gztzt.qyid = #{orgcode}
<if test="gztszid != null"> and gztzt.gztszid = #{gztszid} </if>
<if test="fsType != null"> and gztzt.fs_type = #{fsType} </if>
<if test="qrType != null"> and gztzt.qr_type = #{qrType} </if>
<if test="text != null and text != ''" >
and (emp.`name` like CONCAT('%',#{text},'%') or emp.emp_num = #{text})
</if>
</select>
<delete id="deletexcglassogztzt" >
......@@ -89,7 +102,7 @@
</delete>
<insert id="insertxcglassogztztList" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id" >
insert into xcgl_asso_gztzt (userid,xzyf,fs_type,ck_type,qr_type,fkyj,yhqm,qyid,gztszid)
insert into xcgl_asso_gztzt (userid,xzyf,fs_type,ck_type,qr_type,fkyj,yhqm,qyid,gztszid,sfgz)
<foreach collection="list" item="item" index="index" open="values " close="" separator=",">
(
<if test="item.userid != null" >
......@@ -113,6 +126,9 @@
<if test="item.yhqm != null" >
#{item.yhqm,jdbcType=VARCHAR},
</if>
<if test="item.sfgz != null" >
#{item.sfgz,jdbcType=DOUBLE},
</if>
<if test="item.qyid != null" >
#{item.qyid,jdbcType=INTEGER},
</if>
......@@ -123,107 +139,9 @@
</foreach>
</insert>
<!-- <insert id="insert" useGeneratedKeys="true" keyColumn="id" parameterType="cn.timer.api.bean.xcgl.XcglAssoGztzt">
INSERT INTO xcgl_asso_gztzt
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test ='null != userid'>
userid,
</if>
<if test ='null != xzyf'>
xzyf,
</if>
<if test ='null != fsType'>
fs_type,
</if>
<if test ='null != ckType'>
ck_type,
</if>
<if test ='null != qrType'>
qr_type,
</if>
<if test ='null != fkyj'>
fkyj,
</if>
<if test ='null != yhqm'>
yhqm,
</if>
<if test ='null != qyid'>
qyid,
</if>
<if test ='null != gztszid'>
gztszid
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test ='null != userid'>
#{userid},
</if>
<if test ='null != xzyf'>
#{xzyf},
</if>
<if test ='null != fsType'>
#{fsType},
</if>
<if test ='null != ckType'>
#{ckType},
</if>
<if test ='null != qrType'>
#{qrType},
</if>
<if test ='null != fkyj'>
#{fkyj},
</if>
<if test ='null != yhqm'>
#{yhqm},
</if>
<if test ='null != qyid'>
#{qyid},
</if>
<if test ='null != gztszid'>
#{gztszid}
</if>
</trim>
</insert>
<delete id="delete" >
DELETE FROM xcgl_asso_gztzt
WHERE id = #{id}
</delete>
<update id="update" parameterType="cn.timer.api.bean.xcgl.XcglAssoGztzt">
UPDATE xcgl_asso_gztzt
<set>
<if test ='null != userid'>userid = #{userid},</if>
<if test ='null != xzyf'>xzyf = #{xzyf},</if>
<if test ='null != fsType'>fs_type = #{fsType},</if>
<if test ='null != ckType'>ck_type = #{ckType},</if>
<if test ='null != qrType'>qr_type = #{qrType},</if>
<if test ='null != fkyj'>fkyj = #{fkyj},</if>
<if test ='null != yhqm'>yhqm = #{yhqm},</if>
<if test ='null != qyid'>qyid = #{qyid},</if>
<if test ='null != qyid'>gztszid = #{gztszid}</if>
</set>
<!-- 发送工资条 操作 -->
<update id="payslipSend" parameterType="java.lang.Integer">
UPDATE xcgl_asso_gztzt SET fs_type = #{fsType}
WHERE id = #{id}
</update>
<select id="load" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List" />
FROM xcgl_asso_gztzt
WHERE id = #{id}
</select>
<select id="pageList" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List" />
FROM xcgl_asso_gztzt
LIMIT #{offset}, #{pageSize}
</select>
<select id="pageListCount" resultType="java.lang.Integer">
SELECT count(1)
FROM xcgl_asso_gztzt
</select>
-->
</mapper>
\ No newline at end of file
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