Commit d958118e by ilal Committed by chenzg

临时提交

parent 8c8e2c62
...@@ -56,5 +56,12 @@ public class XcglAssoXcjsgz extends Model<XcglAssoXcjsgz> { ...@@ -56,5 +56,12 @@ public class XcglAssoXcjsgz extends Model<XcglAssoXcjsgz> {
@ApiModelProperty(value = "", example = "") @ApiModelProperty(value = "", example = "")
private Integer optionid; private Integer optionid;
@ApiModelProperty(value = "", example = "")
private String dygkText;
@ApiModelProperty(value = "", example = "")
private String degkText;
@ApiModelProperty(value = "", example = "")
private Integer rulestate;
} }
\ No newline at end of file
...@@ -37,6 +37,7 @@ import cn.timer.api.bean.kqgl.PunchRecord; ...@@ -37,6 +37,7 @@ import cn.timer.api.bean.kqgl.PunchRecord;
import cn.timer.api.bean.kqgl.Schedule; import cn.timer.api.bean.kqgl.Schedule;
import cn.timer.api.bean.kqgl.SpecialDate; import cn.timer.api.bean.kqgl.SpecialDate;
import cn.timer.api.bean.kqmk.KqglAssoMonthPunchSummary; 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.sbgjj.SbgjjAssoYjzd;
import cn.timer.api.bean.xcgl.XcglAdminXzz; import cn.timer.api.bean.xcgl.XcglAdminXzz;
import cn.timer.api.bean.xcgl.XcglAssoBszqsz; import cn.timer.api.bean.xcgl.XcglAssoBszqsz;
...@@ -65,6 +66,7 @@ import cn.timer.api.dao.kqgl.PunchRecordMapper; ...@@ -65,6 +66,7 @@ import cn.timer.api.dao.kqgl.PunchRecordMapper;
import cn.timer.api.dao.kqgl.ScheduleMapper; import cn.timer.api.dao.kqgl.ScheduleMapper;
import cn.timer.api.dao.kqgl.SpecialDateMapper; import cn.timer.api.dao.kqgl.SpecialDateMapper;
import cn.timer.api.dao.kqmk.KqglAssoMonthPunchSummaryMapper; 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.sbgjj.SbgjjAssoYjzdMapper;
import cn.timer.api.dao.xcgl.XcglAdminXzzMapper; import cn.timer.api.dao.xcgl.XcglAdminXzzMapper;
import cn.timer.api.dao.xcgl.XcglAssoGsjsmxMapper; import cn.timer.api.dao.xcgl.XcglAssoGsjsmxMapper;
...@@ -403,7 +405,7 @@ public class SalaryManagementController { ...@@ -403,7 +405,7 @@ public class SalaryManagementController {
xcglassojsgzzxmapper.insertxcglassojsgzzxList(gzzxlist); xcglassojsgzzxmapper.insertxcglassojsgzzxList(gzzxlist);
} }
}else if(("考勤").equals(grouping[g])) { }else if(("考勤").equals(grouping[g])) {
String[] att = {"应出勤天数","实出勤天数","事假","病假","事假扣款","病假扣款"}; String[] att = {"应出勤天数","实出勤天数","事假","病假","事假扣款","病假扣款","迟到次数","迟到时长","早退次数","迟到早退扣款"};
List<XcglAssoJsgzzx> gzzxlist=new ArrayList<XcglAssoJsgzzx>(); List<XcglAssoJsgzzx> gzzxlist=new ArrayList<XcglAssoJsgzzx>();
for(int a=0;a<att.length;a++) { for(int a=0;a<att.length;a++) {
XcglAssoXcjsgz xzxj = xcglassoxcjsgzmapper.QuerySalaryRules(att[a]); XcglAssoXcjsgz xzxj = xcglassoxcjsgzmapper.QuerySalaryRules(att[a]);
...@@ -411,10 +413,10 @@ public class SalaryManagementController { ...@@ -411,10 +413,10 @@ public class SalaryManagementController {
zzx.setSalaryitem(att[a]);//薪资项 zzx.setSalaryitem(att[a]);//薪资项
zzx.setYhmbzd(att[a]);//银行模板项 需与银行一一对应 zzx.setYhmbzd(att[a]);//银行模板项 需与银行一一对应
if(xzxj != null) {//系统有规则 if(xzxj != null) {//系统有规则
zzx.setRule(xzxj.getGsxs());//规则******************************** zzx.setRule(xzxj.getGsxs().replace("{{", "").replace("}}", ""));//规则********************************
zzx.setGsid(xzxj.getId());//公式id 0:未关联规则 zzx.setGsid(xzxj.getId());//公式id 0:未关联规则
zzx.setGsgs(xzxj.getGsxs());//公式格式 系统提供/自定义公式 zzx.setGsgs(xzxj.getGsxs().replace("{{", "").replace("}}", ""));//公式格式 系统提供/自定义公式
zzx.setRulestate(2);//规则状态[0:系统自动提取;1:系统固定值;2:固定公式计算;3:自定义公式计算;4:每月自动导入] zzx.setRulestate(xzxj.getRulestate());//规则状态[0:系统自动提取;1:系统固定值;2:固定公式计算;3:自定义公式计算;4:每月自动导入]
}else { }else {
String xxs = "自动提取数据"; String xxs = "自动提取数据";
String[] strxz = {"从月度汇总-"}; String[] strxz = {"从月度汇总-"};
...@@ -469,10 +471,10 @@ public class SalaryManagementController { ...@@ -469,10 +471,10 @@ public class SalaryManagementController {
zzx.setSalaryitem(yingfa[a]);//薪资项 zzx.setSalaryitem(yingfa[a]);//薪资项
zzx.setYhmbzd(yingfa[a]);//银行模板项 需与银行一一对应 zzx.setYhmbzd(yingfa[a]);//银行模板项 需与银行一一对应
if(xzxj != null) {//系统有规则 if(xzxj != null) {//系统有规则
zzx.setRule(xzxj.getGsxs());//规则******************************** zzx.setRule(xzxj.getGsxs().replace("{{", "").replace("}}", ""));//规则********************************
zzx.setGsid(xzxj.getId());//公式id 0:未关联规则 zzx.setGsid(xzxj.getId());//公式id 0:未关联规则
zzx.setGsgs(xzxj.getGsxs());//公式格式 系统提供/自定义公式 zzx.setGsgs(xzxj.getGsxs().replace("{{", "").replace("}}", ""));//公式格式 系统提供/自定义公式
zzx.setRulestate(2);//规则状态[0:系统自动提取;1:系统固定值;2:固定公式计算;3:自定义公式计算;4:每月自动导入] zzx.setRulestate(xzxj.getRulestate());//规则状态[0:系统自动提取;1:系统固定值;2:固定公式计算;3:自定义公式计算;4:每月自动导入]
}else { }else {
zzx.setRule("每月手动导入");//规则******************************** zzx.setRule("每月手动导入");//规则********************************
zzx.setGsid(0);//公式id 0:未关联规则 zzx.setGsid(0);//公式id 0:未关联规则
...@@ -523,26 +525,36 @@ public class SalaryManagementController { ...@@ -523,26 +525,36 @@ public class SalaryManagementController {
List<XcglAssoJsgzzx> gzzxlist=new ArrayList<XcglAssoJsgzzx>(); List<XcglAssoJsgzzx> gzzxlist=new ArrayList<XcglAssoJsgzzx>();
for(int a=0;a<jsjsf.length;a++) { for(int a=0;a<jsjsf.length;a++) {
XcglAssoXcjsgz xzxj = xcglassoxcjsgzmapper.QuerySalaryRules(jsjsf[a]); XcglAssoXcjsgz xzxj = xcglassoxcjsgzmapper.QuerySalaryRules(jsjsf[a]);
XcglAssoJsgzzx zzx = XcglAssoJsgzzx.builder().build(); XcglAssoJsgzzx zzx = XcglAssoJsgzzx.builder().build();
zzx.setSalaryitem(jsjsf[a]);//薪资项 zzx.setSalaryitem(jsjsf[a]);//薪资项
zzx.setYhmbzd(jsjsf[a]);//银行模板项 需与银行一一对应 zzx.setYhmbzd(jsjsf[a]);//银行模板项 需与银行一一对应
zzx.setRule(xzxj.getGsxs());//规则********************************
if(jsjsf[a].equals("个税")) { if(xzxj != null) {
zzx.setGsid(0); zzx.setRule(xzxj.getGsxs().replace("{{", "").replace("}}", ""));//规则********************************
}else {
zzx.setGsid(xzxj.getId());//公式id 0:未关联规则 zzx.setGsid(xzxj.getId());//公式id 0:未关联规则
} zzx.setGsgs(xzxj.getGsxs().replace("{{", "").replace("}}", ""));//公式格式 系统提供/自定义公式
zzx.setGsgs(xzxj.getGsxs());//公式格式 系统提供/自定义公式 zzx.setRulestate(xzxj.getRulestate());//规则状态[0:系统自动提取;1:系统固定值;2:固定公式计算;3:自定义公式计算;4:每月自动导入]
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 { }else {
zzx.setRulestate(2); zzx.setRule("每月手动导入");//规则********************************
zzx.setGsid(0);//公式id 0:未关联规则
zzx.setGsgs("每月手动导入");//公式格式 系统提供/自定义公式
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:非系统项
...@@ -661,6 +673,7 @@ public class SalaryManagementController { ...@@ -661,6 +673,7 @@ public class SalaryManagementController {
} }
/** /**
* 弹出薪资规则
* @param userBean * @param userBean
* @param id 薪资选项id * @param id 薪资选项id
* @return * @return
...@@ -891,7 +904,7 @@ public class SalaryManagementController { ...@@ -891,7 +904,7 @@ public class SalaryManagementController {
@ApiOperation(value = "初始化薪资档案自定义", httpMethod = "GET", notes = "接口发布说明") @ApiOperation(value = "初始化薪资档案自定义", httpMethod = "GET", notes = "接口发布说明")
public ResponseResult Initialization(@CurrentUser UserBean userBean) { public ResponseResult Initialization(@CurrentUser UserBean userBean) {
List<XcglAssoXzdazdy> cshsj = xcglassoxzdazdymapper.selectxcglassoxzdazdy(userBean.getOrgCode()); List<XcglAssoXzdazdy> cshsj = xcglassoxzdazdymapper.selectxcglassoxzdazdy(userBean.getOrgCode());
String[] zdmc = { "基本工资", "绩效工资", "岗位津贴", "加班工资" }; String[] zdmc = { "基本工资", "岗位津贴" };
// 检查是否有初始化数据 // 检查是否有初始化数据
if (cshsj.size() == 0) { if (cshsj.size() == 0) {
for (int z = 0; z < zdmc.length; z++) { for (int z = 0; z < zdmc.length; z++) {
...@@ -1133,9 +1146,9 @@ public class SalaryManagementController { ...@@ -1133,9 +1146,9 @@ public class SalaryManagementController {
zzx.setSalaryitem(term[a].getOptname());//薪资项 zzx.setSalaryitem(term[a].getOptname());//薪资项
zzx.setYhmbzd(term[a].getOptname());//银行模板项 需与银行一一对应 zzx.setYhmbzd(term[a].getOptname());//银行模板项 需与银行一一对应
if(xzxj != null && term[a].getOptitemid() != 0) {//系统有规则 if(xzxj != null && term[a].getOptitemid() != 0) {//系统有规则
zzx.setRule(xzxj.getGsxs());//规则******************************** zzx.setRule(xzxj.getGsxs().replace("{{", "").replace("}}", ""));//规则********************************
zzx.setGsid(xzxj.getId());//公式id 0:未关联规则 zzx.setGsid(xzxj.getId());//公式id 0:未关联规则
zzx.setGsgs(xzxj.getGsxs());//公式格式 系统提供/自定义公式 zzx.setGsgs(xzxj.getGsxs().replace("{{", "").replace("}}", ""));//公式格式 系统提供/自定义公式
zzx.setRulestate(2);//规则状态[0:系统自动提取;1:系统固定值;2:固定公式计算;3:自定义公式计算;4:每月自动导入] zzx.setRulestate(2);//规则状态[0:系统自动提取;1:系统固定值;2:固定公式计算;3:自定义公式计算;4:每月自动导入]
}else {//系统无规则 }else {//系统无规则
//薪资档案自定义 //薪资档案自定义
...@@ -1386,13 +1399,15 @@ public class SalaryManagementController { ...@@ -1386,13 +1399,15 @@ public class SalaryManagementController {
private KqglAssoMonthPunchSummaryMapper kqglassomonthpunchsummarymapper; private KqglAssoMonthPunchSummaryMapper kqglassomonthpunchsummarymapper;
@Autowired @Autowired
private SbgjjAssoYjzdMapper sbgjjassoyjzdmapper; private SbgjjAssoYjzdMapper sbgjjassoyjzdmapper;
@Autowired
private SbgjjAssoDetailedMapper sbgjjassodetailedmapper;
/** /**
* (保存,下一步)计算薪资 ()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()() * (保存,下一步)计算薪资 ()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()
*/ */
@GetMapping(value = "/calculatesalary/{id}") @GetMapping(value = "/calculatesalary/{id}")
@ApiOperation(value = "计算薪资", httpMethod = "GET", notes = "接口发布说明") @ApiOperation(value = "计算薪资", httpMethod = "GET", notes = "接口发布说明")
public ResponseResult CalculateSalary(@CurrentUser UserBean userBean,@PathVariable Integer id) { public ResponseResult CalculateSalary(@CurrentUser UserBean userBean,@PathVariable Integer id) {
int orgcode = userBean.getOrgCode();
String xzyf = ""; String xzyf = "";
//typeid--1:计算 2:重新计算 //typeid--1:计算 2:重新计算
...@@ -1455,6 +1470,8 @@ public class SalaryManagementController { ...@@ -1455,6 +1470,8 @@ public class SalaryManagementController {
String tablename = lbcx.getTablename();//对应库表名 String tablename = lbcx.getTablename();//对应库表名
String fieldname = lbcx.getFieldname();//对应库字段名 String fieldname = lbcx.getFieldname();//对应库字段名
List<Map<String, Object>> list = null; List<Map<String, Object>> list = null;
double vacation = 0;//假期
int numover = 0;
if(tablename.equals("yggl_main_emp")) {//员工管理 if(tablename.equals("yggl_main_emp")) {//员工管理
QueryWrapper<YgglMainEmp> queryWrapper = new QueryWrapper<>(); 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 = ? queryWrapper.select(fieldname).eq("emp_num", znr.getUserid()).eq("org_code", userBean.getOrgCode());//select #{tablename} from yggl_main_emp where emp_num = ?
...@@ -1464,10 +1481,28 @@ public class SalaryManagementController { ...@@ -1464,10 +1481,28 @@ 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 = ? 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); list = kqglassomonthpunchsummarymapper.selectMaps(queryWrapper);
}else if(tablename.equals("sbgjj_asso_yjzd")) { }else if(tablename.equals("sbgjj_asso_yjzd")) {
QueryWrapper<SbgjjAssoYjzd> queryWrapper = new QueryWrapper<>(); 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 = ? 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); 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 = ""; String autacq = "";
...@@ -1477,6 +1512,9 @@ public class SalaryManagementController { ...@@ -1477,6 +1512,9 @@ public class SalaryManagementController {
autacq = aut.toString().substring(aut.toString().indexOf("=")+1).replace("}", ""); autacq = aut.toString().substring(aut.toString().indexOf("=")+1).replace("}", "");
} }
} }
}else {
autacq = String.valueOf(vacation);
autacq = String.valueOf(numover);
} }
//处理结果 //处理结果
if(fieldname.equals("job_type")) { if(fieldname.equals("job_type")) {
...@@ -1538,9 +1576,9 @@ public class SalaryManagementController { ...@@ -1538,9 +1576,9 @@ public class SalaryManagementController {
List<XcglAssoJsgzzx> xtzdtqother = new LambdaQueryChainWrapper<XcglAssoJsgzzx>(xcglassojsgzzxmapper).eq(XcglAssoJsgzzx::getXzzid, id).list(); List<XcglAssoJsgzzx> xtzdtqother = new LambdaQueryChainWrapper<XcglAssoJsgzzx>(xcglassojsgzzxmapper).eq(XcglAssoJsgzzx::getXzzid, id).list();
for(XcglAssoJsgzzx xtzd:xtzdtqother) { for(XcglAssoJsgzzx xtzd:xtzdtqother) {
if(xtzd.getRulestate() == 2 || xtzd.getRulestate() == 3 || xtzd.getRulestate() == 4) { if(xtzd.getRulestate() == 2 || xtzd.getRulestate() == 3 || xtzd.getRulestate() == 4) {
if(xtzd.getOptionid() > 0) {//说明阔以根据表查出结果 if(xtzd.getOptionid() > 0 || xtzd.getIsCustom() == 1) {//说明阔以根据表查出结果
XcglAssoOption lbcx = new LambdaQueryChainWrapper<XcglAssoOption>(xcglassooptionmapper).eq(XcglAssoOption::getId,xtzd.getOptionid()).one(); XcglAssoOption lbcx = new LambdaQueryChainWrapper<XcglAssoOption>(xcglassooptionmapper).eq(XcglAssoOption::getId,xtzd.getOptionid()).one();
if(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") @SuppressWarnings("unused")
String tablename = lbcx.getTablename();//对应库表名 String tablename = lbcx.getTablename();//对应库表名
@SuppressWarnings("unused") @SuppressWarnings("unused")
...@@ -1597,40 +1635,164 @@ public class SalaryManagementController { ...@@ -1597,40 +1635,164 @@ public class SalaryManagementController {
@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) {
int orgcode = userBean.getOrgCode();
//#1、计算个税 (薪资组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:哺乳假;
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();
String start = xzz.getPayrollcycle().substring(0, 10);//开始 //算薪月周期
String end = xzz.getPayrollcycle().substring(11, 21);//结束 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;//病假
//查询出薪资组内成员
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 String[] noperincuser = new String[paygrlist.size()];//用来储存没有个税的用户id
int i = 0; int i = 0;
//薪资组内成员
for(XcglAssoXzury pag : paygrlist) { for(XcglAssoXzury pag : paygrlist) {
XcglAssoGsjsmx gsjs = XcglAssoGsjsmx.builder().build().selectOne(new QueryWrapper<XcglAssoGsjsmx>().lambda().eq(XcglAssoGsjsmx::getQyid, userBean.getOrgCode()).eq(XcglAssoGsjsmx::getUserNum, pag.getUserid()) XcglAssoGsjsmx gsjs = XcglAssoGsjsmx.builder().build().selectOne(new QueryWrapper<XcglAssoGsjsmx>().lambda().eq(XcglAssoGsjsmx::getQyid, userBean.getOrgCode()).eq(XcglAssoGsjsmx::getUserNum, pag.getUserid())
.eq(XcglAssoGsjsmx::getSalaryMonth, calcomtiondto.getSalary_month())); .eq(XcglAssoGsjsmx::getSalaryMonth, salary_month));
if(gsjs == null) { if(gsjs == null) {
noperincuser[i] = String.valueOf(pag.getUserid()); noperincuser[i] = String.valueOf(pag.getUserid());
i++; i++;
} }
} //存在的计薪规则组项数据对应
//循环计算当前薪资月没有个税的用户 根据 for(XcglAssoJsgzzx xzx : sjbt) {
for(String gsus : ClockInTool.deleteArrayNull(noperincuser)) { if(xzx.getRulestate() == 1 && xzx.getIsCustom() == 0 && xzx.getOptionid() == 0 && xzx.getSalaryitem().equals("基本工资")) {
// XcglAssoGsjsmx gsjs = XcglAssoGsjsmx.builder().build(). 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();
}
}
} }
//#2、考勤数据
//#3、套公式算结果
//#4、数据写入薪资表
//#计算个税 (薪资组id、薪资月份)
//循环计算当前薪资月没有个税的用户 根据
for(String gsus : ClockInTool.deleteArrayNull(noperincuser)) {
}
return ResultUtil.data(null, "计算完成"); 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));
//对应算薪月份的专项附加扣除
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");
}
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;
}
/** /**
......
...@@ -8,6 +8,7 @@ import java.util.Date; ...@@ -8,6 +8,7 @@ import java.util.Date;
public class SalaryTool { public class SalaryTool {
static SimpleDateFormat mat = new SimpleDateFormat("yyyy-MM-dd"); static SimpleDateFormat mat = new SimpleDateFormat("yyyy-MM-dd");
static SimpleDateFormat matM = new SimpleDateFormat("yyyy-MM");
public static Date strToDateLong(String strDate) { public static Date strToDateLong(String strDate) {
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
...@@ -119,6 +120,28 @@ public class SalaryTool { ...@@ -119,6 +120,28 @@ public class SalaryTool {
return mat.format(calendar.getTime()); return mat.format(calendar.getTime());
} }
// 下个月
public static String getfirstnextMo(String time) {
String firstnext;
Calendar c1 = Calendar.getInstance();
c1.setTime(strToDateLong(time)); // 设置为当前时间
c1.add(Calendar.MONTH, 1);
c1.set(Calendar.DAY_OF_MONTH, 1);
firstnext = matM.format(c1.getTime());
return firstnext;
}
// 上个月
public static String getfirstlastMo(String time) {
String firstnext;
Calendar c1 = Calendar.getInstance();
c1.setTime(strToDateLong(time)); // 设置为当前时间
c1.add(Calendar.MONTH, -1);
c1.set(Calendar.DAY_OF_MONTH, 1);
firstnext = matM.format(c1.getTime());
return firstnext;
}
//################################################################################################################################## //##################################################################################################################################
// 上个月 // 上个月
......
...@@ -34,4 +34,10 @@ public interface XcglAssoXzbMapper extends BaseMapper<XcglAssoXzb> { ...@@ -34,4 +34,10 @@ public interface XcglAssoXzbMapper extends BaseMapper<XcglAssoXzb> {
int ModifyImportedSalary(XcglAssoXzb xcglassoxzb); int ModifyImportedSalary(XcglAssoXzb xcglassoxzb);
void updateBatchXzxjg(List<XcglAssoXzb> list); void updateBatchXzxjg(List<XcglAssoXzb> list);
double Holidayamount(int orgcode,String apptime,int rules_type,int userid);
int NumberOvertime(int orgcode,String apptime,int userid);
int PeriodsOvertime(int orgcode,String apptime,int overtimetypeid,int userid);
} }
...@@ -10,7 +10,7 @@ import lombok.NoArgsConstructor; ...@@ -10,7 +10,7 @@ import lombok.NoArgsConstructor;
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
public class CalculatingCompensationDto { public class CalculatingCompensationDto {
private String salary_month;//薪资月 // private String salary_month;//薪资月
private Integer pay_group_id;//薪资组id private Integer pay_group_id;//薪资组id
} }
...@@ -15,5 +15,5 @@ public class ModifysalaryruleDto { ...@@ -15,5 +15,5 @@ public class ModifysalaryruleDto {
private Integer xcjsgzid;// 薪酬计算规则公式id private Integer xcjsgzid;// 薪酬计算规则公式id
private String formula;// 公式 private String formula;// 公式
} }
...@@ -126,6 +126,10 @@ ...@@ -126,6 +126,10 @@
</foreach> </foreach>
</insert> </insert>
<delete id="deleteBycbfaid" >
DELETE FROM sbgjj_asso_cbfzmx
WHERE cbfaid = #{cbfaid}
</delete>
<!-- <insert id="insert" parameterType="cn.timer.api.bean.sbgjj.SbgjjAssoCbfzmx" useGeneratedKeys="true" keyProperty="id"> <!-- <insert id="insert" parameterType="cn.timer.api.bean.sbgjj.SbgjjAssoCbfzmx" useGeneratedKeys="true" keyProperty="id">
INSERT INTO sbgjj_asso_cbfzmx INSERT INTO sbgjj_asso_cbfzmx
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
......
...@@ -11,6 +11,10 @@ ...@@ -11,6 +11,10 @@
<result column="degk" property="degk" /> <result column="degk" property="degk" />
<result column="type" property="type" /> <result column="type" property="type" />
<result column="optionid" property="optionid" /> <result column="optionid" property="optionid" />
<result column="dygk_text" property="dygkText" />
<result column="degk_text" property="degkText" />
<result column="rulestate" property="rulestate" />
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
......
...@@ -52,6 +52,36 @@ ...@@ -52,6 +52,36 @@
xzxjg XcglAssoXzb_xzxjg, xzxjg XcglAssoXzb_xzxjg,
qyid XcglAssoXzb_qyid qyid XcglAssoXzb_qyid
</sql> </sql>
<select id="Holidayamount">
select IFNULL(SUM(su.duration),0)
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="NumberOvertime">
select COUNT(*)
from kqgl_asso_relation_summary su
where su.approval_type = 5
and su.org_code = #{orgcode}
and SUBSTR(su.app_time,1,7) = #{apptime}
and su.user_id = #{userid}
</select>
<select id="PeriodsOvertime">
select IFNULL(SUM(su.duration),0)
from kqgl_asso_relation_summary su
where su.approval_type = 1
and su.org_code = #{orgcode}
and SUBSTR(su.app_time,1,7) = #{apptime}
and su.overtime_type_id = #{overtimetypeid}
and su.user_id = #{userid}
</select>
<select id="CalculationResults" resultMap="CalculationDtoMap"> <select id="CalculationResults" resultMap="CalculationDtoMap">
select aa.orgcode,aa.empid,aa.empnum,aa.empname,aa.xzbid,aa.xzyf, select aa.orgcode,aa.empid,aa.empnum,aa.empname,aa.xzbid,aa.xzyf,
......
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