From 64420be6be4b70d3fa7af9c5983e6e51ee03cba3 Mon Sep 17 00:00:00 2001 From: Chengliang <1546584672@qq.com> Date: Wed, 28 May 2025 13:47:57 +0800 Subject: [PATCH] =?UTF-8?q?=E9=9D=92=E5=B2=9B=E6=96=B0=E6=A0=B8=E8=8A=AF?= =?UTF-8?q?=20=E5=8E=86=E5=8F=B2=E9=A1=B9=E7=9B=AE=E8=BF=81=E7=A7=BB?= =?UTF-8?q?=E5=A4=87=E4=BB=BD=20=E9=9D=9E=E5=85=A8=E9=83=A8=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../web/HrmSalaryDiffReportActionApi.java | 15 + .../qdhx/biz/HrmSalaryDiffReportBiz.java | 390 +++++++++ src/com/engine/qdhx/biz/HrmTaxDiffBiz.java | 212 +++++ .../qdhx/cmd/HrmSalaryDiffReportCmd.java | 412 ++++++++++ .../cmd/HrmSalaryDiffReportConditionCmd.java | 40 + .../qdhx/cmd/HrmSalarySaveReportCmd.java | 157 ++++ src/com/engine/qdhx/entity/Builder.java | 132 ++++ src/com/engine/qdhx/entity/Context.java | 33 + .../engine/qdhx/entity/HrmSalaryEntity.java | 461 +++++++++++ src/com/engine/qdhx/entity/TaxRateEntity.java | 260 ++++++ .../qdhx/entity/TaxRateNoResidentEntity.java | 189 +++++ .../engine/qdhx/entity/TaxTableEntity.java | 94 +++ .../qdhx/entity/TaxTableNoResidentEntity.java | 56 ++ src/com/engine/qdhx/enums/DateTypeEnum.java | 14 + .../service/HrmSalaryDiffReportService.java | 36 + .../qdhx/service/Impl/AddSalaryStrategy.java | 22 + .../service/Impl/DivisionSalaryStrategy.java | 22 + .../Impl/HrmSalaryDiffReportServiceImpl.java | 36 + .../service/Impl/MultiplySalaryStrategy.java | 22 + .../Impl/SubtractionSalaryStrategy.java | 23 + .../engine/qdhx/service/SalaryStrategy.java | 13 + src/com/engine/qdhx/util/SalaryUtil.java | 737 ++++++++++++++++++ src/com/engine/qdhx/util/TaxRateUtil.java | 121 +++ .../qdhx/web/HrmSalaryDiffReportAction.java | 106 +++ .../interface/HrmSalaryDiffReportExcelE9.jsp | 176 +++++ src/com/test/TestMain.java | 40 + 26 files changed, 3819 insertions(+) create mode 100644 src/com/api/qdhx/web/HrmSalaryDiffReportActionApi.java create mode 100644 src/com/engine/qdhx/biz/HrmSalaryDiffReportBiz.java create mode 100644 src/com/engine/qdhx/biz/HrmTaxDiffBiz.java create mode 100644 src/com/engine/qdhx/cmd/HrmSalaryDiffReportCmd.java create mode 100644 src/com/engine/qdhx/cmd/HrmSalaryDiffReportConditionCmd.java create mode 100644 src/com/engine/qdhx/cmd/HrmSalarySaveReportCmd.java create mode 100644 src/com/engine/qdhx/entity/Builder.java create mode 100644 src/com/engine/qdhx/entity/Context.java create mode 100644 src/com/engine/qdhx/entity/HrmSalaryEntity.java create mode 100644 src/com/engine/qdhx/entity/TaxRateEntity.java create mode 100644 src/com/engine/qdhx/entity/TaxRateNoResidentEntity.java create mode 100644 src/com/engine/qdhx/entity/TaxTableEntity.java create mode 100644 src/com/engine/qdhx/entity/TaxTableNoResidentEntity.java create mode 100644 src/com/engine/qdhx/enums/DateTypeEnum.java create mode 100644 src/com/engine/qdhx/service/HrmSalaryDiffReportService.java create mode 100644 src/com/engine/qdhx/service/Impl/AddSalaryStrategy.java create mode 100644 src/com/engine/qdhx/service/Impl/DivisionSalaryStrategy.java create mode 100644 src/com/engine/qdhx/service/Impl/HrmSalaryDiffReportServiceImpl.java create mode 100644 src/com/engine/qdhx/service/Impl/MultiplySalaryStrategy.java create mode 100644 src/com/engine/qdhx/service/Impl/SubtractionSalaryStrategy.java create mode 100644 src/com/engine/qdhx/service/SalaryStrategy.java create mode 100644 src/com/engine/qdhx/util/SalaryUtil.java create mode 100644 src/com/engine/qdhx/util/TaxRateUtil.java create mode 100644 src/com/engine/qdhx/web/HrmSalaryDiffReportAction.java create mode 100644 src/com/interface/HrmSalaryDiffReportExcelE9.jsp create mode 100644 src/com/test/TestMain.java diff --git a/src/com/api/qdhx/web/HrmSalaryDiffReportActionApi.java b/src/com/api/qdhx/web/HrmSalaryDiffReportActionApi.java new file mode 100644 index 0000000..85d3cee --- /dev/null +++ b/src/com/api/qdhx/web/HrmSalaryDiffReportActionApi.java @@ -0,0 +1,15 @@ +package com.api.qdhx.web; + +import com.engine.qdhx.web.HrmSalaryDiffReportAction; + +import javax.ws.rs.Path; + +/** + * @Author weaver_cl + * @Description: TODO + * @Date 2022/2/16 + * @Version V1.0 + **/ +@Path("/salarydiffreport") +public class HrmSalaryDiffReportActionApi extends HrmSalaryDiffReportAction { +} diff --git a/src/com/engine/qdhx/biz/HrmSalaryDiffReportBiz.java b/src/com/engine/qdhx/biz/HrmSalaryDiffReportBiz.java new file mode 100644 index 0000000..3a46aa4 --- /dev/null +++ b/src/com/engine/qdhx/biz/HrmSalaryDiffReportBiz.java @@ -0,0 +1,390 @@ +package com.engine.qdhx.biz; + +import com.cloudstore.dev.api.util.Util_DataCache; +import com.engine.qdhx.entity.Builder; +import com.engine.qdhx.entity.Context; +import com.engine.qdhx.entity.HrmSalaryEntity; +import com.engine.qdhx.service.impl.AddSalaryStrategy; +import com.engine.qdhx.service.impl.DivisionSalaryStrategy; +import com.engine.qdhx.service.impl.MultiplySalaryStrategy; +import com.engine.qdhx.service.impl.SubtractionSalaryStrategy; +import com.engine.qdhx.util.SalaryUtil; +import weaver.conn.RecordSet; +import weaver.conn.RecordSetTrans; +import weaver.general.BaseBean; +import weaver.general.Util; + + +import java.time.LocalDate; +import java.time.format.DateTimeFormatter; +import java.util.*; +import java.util.stream.Collectors; + + +/** + * @Author weaver_cl + * @Description: TODO + * @Date 2022/2/21 + * @Version V1.0 + **/ +public class HrmSalaryDiffReportBiz extends BaseBean { + + private static final double DEFAULTVALUE = 0.00; + + + + /** + * 获取薪资报表数据 + * @param fromDate + * @param toDate + * @param subCompanyId + * @param departmentId + * @param resourceId + * @return + */ + public List getScheduleList(String fromDate, String toDate, String subCompanyId, String departmentId, String resourceId) throws Exception { + + List hrmSalaryList = new ArrayList<>(); + List> taxRateList = new LinkedList<>(); //居民税率台账 + List> taxRateNRList = new LinkedList<>(); //非居民税率台账 + RecordSet rs = new RecordSet(); + BaseBean bb = new BaseBean(); + Util_DataCache dataCache = new Util_DataCache(); + HrmTaxDiffBiz hrmTaxDiffBiz = new HrmTaxDiffBiz(); + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMM"); + LocalDate start = LocalDate.parse(fromDate, DateTimeFormatter.ofPattern("yyyy-MM-dd")); + String xzszny = formatter.format(start); + + //String sameDay = SalaryUtil.getSameDay(fromDate); + + String sqlwhere = "SELECT\n" + + " a.id,\n" + + " a.lastname,\n" + + " a.subcompanyid1,\n" + + " a.departmentid,\n" + + " a.workcode,\n" + + " a.birthday,\n" + + " a.companystartdate,\n" + + " a.status,\n" + + " a.dismissdate\n" + + " FROM\n" + + " hrmresource a\n" + + "WHERE\n" + + " (a.status < 4 or\n" + + " (a.status >= 4 and\n" + + " a.DISMISSDATE > '"+fromDate+"'))"; + + //String sqlwhere = "select id,lastname,subcompanyid1,departmentid,workcode,birthday,companystartdate,status from hrmresource where 1=1 "; + Map params = new HashMap<>(); + params.put("subcompanyid1",subCompanyId); + params.put("departmentid",departmentId); + params.put("id",resourceId); + //加班数据 + Map flowData = SalaryUtil.getFlowOverTimeDataNew(fromDate, toDate, params); + Map lastFlowData = SalaryUtil.getLastFlowOverTimeData(fromDate, toDate, params); + + //请假数据 + Map flowLeaveData = SalaryUtil.getFlowLeaveData(fromDate, toDate, params); + + boolean judgeHoliday = SalaryUtil.judgeHoliday(fromDate, toDate); + + //if (rs.getDBType().equalsIgnoreCase("sqlserver")){ + Map collect = params.entrySet().stream() + .filter(map -> !"".equals(map.getValue())) + .collect(Collectors.toMap(p -> p.getKey(), p -> p.getValue())); + + for (String key : collect.keySet()) { + sqlwhere += " and a."+key+" = "+collect.get(key); + } + //} + + rs.executeQuery(sqlwhere); + + while (rs.next()){ + String resourceid = Util.null2String(rs.getString("id")); + int status = Util.getIntValue(rs.getString("status")); + String place = SalaryUtil.getPlaceById(resourceid); + String departmentid = Util.null2String(rs.getString("departmentid")); + String costcode = SalaryUtil.getCostcodeById(resourceid); + String workcode = Util.null2String(rs.getString("workcode")); + + String companystartdate = Util.null2String(rs.getString("companystartdate")); + String dismissdate = Util.null2String(rs.getString("dismissdate")); + + + String taxid = SalaryUtil.getTaxidById(resourceid); + + Map welfareMap = SalaryUtil.welfareTable(workcode); + Map bonusMap = SalaryUtil.bonusTable(workcode); + Map reduceMap = SalaryUtil.reduceTable(workcode); + Map kqMap = SalaryUtil.getKqInfo(fromDate,toDate,resourceid); + Map ipMap = SalaryUtil.getInsuranceAndProvident(workcode, xzszny); + + + Context context = new Context(); + context.setSalaryStrategy(new AddSalaryStrategy()); + + //中国农业银行账户 + String bankAccount = SalaryUtil.getBankAccount(resourceid); + + //薪资项目 + double basicSalary = SalaryUtil.getBasicSalary(resourceid); + double overtimePay = SalaryUtil.getOvertimePay(resourceid); + + //本月 + double workingDayOvertime_nonleave = SalaryUtil.getDoubleValue(Util.null2String(flowData.get(resourceid+"|workingDayOvertime_nonleave")),0.00); + double restDayOvertime_nonleave = SalaryUtil.getDoubleValue(Util.null2String(flowData.get(resourceid+"|restDayOvertime_nonleave")),0.00); + double holidayOvertime__nonleave = SalaryUtil.getDoubleValue(Util.null2String(flowData.get(resourceid+"|holidayOvertime__nonleave")),0.00); + + //上个月 + double workingDayOvertime_nonleave_last = SalaryUtil.getDoubleValue(Util.null2String(lastFlowData.get(resourceid+"|workingDayOvertime_nonleave")),0.00); + double restDayOvertime_nonleave_last = SalaryUtil.getDoubleValue(Util.null2String(lastFlowData.get(resourceid+"|restDayOvertime_nonleave")),0.00); + double holidayOvertime__nonleave_last = SalaryUtil.getDoubleValue(Util.null2String(lastFlowData.get(resourceid+"|holidayOvertime__nonleave")),0.00); + + double overtimePayG1 = SalaryUtil.overTimeWorkMoney(basicSalary,String.valueOf(context.execute(workingDayOvertime_nonleave,workingDayOvertime_nonleave_last)),"1.5"); + double overtimePayG2 = SalaryUtil.overTimeWorkMoney(basicSalary,String.valueOf(context.execute(restDayOvertime_nonleave,restDayOvertime_nonleave_last)),"2"); + double overtimePayG3 = SalaryUtil.overTimeWorkMoney(basicSalary,String.valueOf(context.execute(holidayOvertime__nonleave,holidayOvertime__nonleave_last)),"3"); + + + + //福利项目 + String birthday = Util.null2String(rs.getString("birthday")); + double birthdayCashgift = DEFAULTVALUE; + if (status < 4 && SalaryUtil.dateInterval(fromDate,toDate,birthday) && SalaryUtil.localDateIsBefore(birthday,companystartdate)){ + birthdayCashgift = welfareMap.getOrDefault("birthdayCashgift",0.00); + }else if(status > 4 ) { + if (SalaryUtil.dateInterval(fromDate,toDate,dismissdate) && SalaryUtil.localDateIsBefore(dismissdate,birthday)) { + birthdayCashgift = welfareMap.getOrDefault("birthdayCashgift",0.00); + } + } + + double merryCashgift = welfareMap.getOrDefault("merryCashgift",0.00); + double funeralCashgift = welfareMap.getOrDefault("funeralCashgift",0.00); + double festivalCashgift = DEFAULTVALUE; + if (status < 4 && judgeHoliday ) { + festivalCashgift = welfareMap.getOrDefault("festivalCashgift",0.00); + } + + int monthValue = start.getMonthValue(); + boolean flag = SalaryUtil.dateInterval(fromDate,toDate,companystartdate); + double preventHeatAllowance = DEFAULTVALUE; //防暑补贴 + double highTemperatureSubsidy = DEFAULTVALUE; //高温补贴 + if (monthValue >= 6 && monthValue <= 9) { + preventHeatAllowance = welfareMap.getOrDefault("preventHeatAllowance",0.00); + highTemperatureSubsidy = welfareMap.getOrDefault("highTemperatureSubsidy",0.00); + if (flag || status >= 4) { + preventHeatAllowance = SalaryUtil.heatAndTemperatureAllowance(kqMap.getOrDefault("attendancedays",0.00),preventHeatAllowance); + highTemperatureSubsidy = SalaryUtil.heatAndTemperatureAllowance(kqMap.getOrDefault("attendancedays",0.00),highTemperatureSubsidy); + } + } + + double communicatySubsidy = welfareMap.getOrDefault("communicatySubsidy",0.00); + double shiftAllowance = welfareMap.getOrDefault("shiftAllowance",0.00); //轮班补贴 + double standAllowance = welfareMap.getOrDefault("standAllowance",0.00); + double achievementonus = welfareMap.getOrDefault("achievementonus",0.00); + double abroadInsuranceSubsidy = welfareMap.getOrDefault("abroadInsuranceSubsidy",0.00); + double otherItem1 = welfareMap.getOrDefault("otherItem1",0.00); + double otherItem2 = welfareMap.getOrDefault("otherItem2",0.00); + double houseSubsidy = welfareMap.getOrDefault("houseSubsidy",0.00); + + double welfareSum = context.execute(birthdayCashgift,merryCashgift,funeralCashgift,festivalCashgift, + preventHeatAllowance,highTemperatureSubsidy,communicatySubsidy,shiftAllowance,standAllowance, + achievementonus,abroadInsuranceSubsidy,otherItem1,houseSubsidy); + + //奖金 + double specialAward = bonusMap.getOrDefault("specialAward",0.00); + double signMoney = bonusMap.getOrDefault("signMoney",0.00); + double meritsPay = bonusMap.getOrDefault("meritsPay",0.00); + double annualBonus = bonusMap.getOrDefault("annualBonus",0.00); + double ompensation = bonusMap.getOrDefault("ompensation",0.00); + + double awardSum = context.execute(specialAward,signMoney,meritsPay,annualBonus); + + //扣除项 + double otherDeduction = reduceMap.getOrDefault("otherDeduction",0.00); + double costWithhold = reduceMap.getOrDefault("costWithhold",0.00); + double mealWithhold = reduceMap.getOrDefault("mealWithhold",0.00); + + //考勤扣款 + Double workdays = kqMap.getOrDefault("workdays",0.00); + Double attendancedays = kqMap.getOrDefault("attendancedays",0.00); + if (workdays > attendancedays) { + //attendancedays = context.execute(attendancedays,SalaryUtil.conversionLeave(flowLeaveData,resourceid)); + //实际出勤天数 += 请假归档数据换算 + (旷工天数-迟到早退天数 ) + attendancedays = context.execute(attendancedays, + SalaryUtil.conversionLeave(flowLeaveData,resourceid),kqMap.getOrDefault("leavedays",0.00)); + } + + double salaryMoney = context.execute(basicSalary,overtimePay); + //判断是否当月入职离职人员 + if (SalaryUtil.dateInterval(fromDate,toDate,companystartdate) || SalaryUtil.dateInterval(fromDate,toDate,dismissdate)) { + Context contextTest = new Context(); + contextTest.setSalaryStrategy(new DivisionSalaryStrategy()); + double money = contextTest.execute(salaryMoney, 21.75); + contextTest.setSalaryStrategy(new MultiplySalaryStrategy()); + salaryMoney = contextTest.execute(money,workdays); + } + + double attendanceDeduction = attendancedays > 0 ? SalaryUtil.attendanceDeduction(salaryMoney,workdays,attendancedays):salaryMoney; + double salarySum = context.execute(salaryMoney,overtimePayG1,overtimePayG2,overtimePayG3); + + + double deducteSum = context.execute(otherDeduction,attendanceDeduction); + double addSum = context.execute(salarySum,welfareSum,awardSum); + + //加上未扣税数据 + double addSumNew = context.execute(addSum,otherItem2,ompensation); + + //应纳税额 + context.setSalaryStrategy(new SubtractionSalaryStrategy()); + double taxable = context.execute(addSum,deducteSum); + + //应发总额 + double shouldSendTotal = context.execute(addSumNew, deducteSum); + double endowmentInsurance = ipMap.getOrDefault("ylgr16",0.00); //养老保险 + + double medicalInsurance = ipMap.getOrDefault("ylgr2",0.00); //医疗保险 + + double unemploymentInsurance = ipMap.getOrDefault("sygr03",0.00); //失业保险 + + double houseProvident = ipMap.getOrDefault("gjjgr5",0.00); //住房公积金 + + //个税计算 + double dndividualIncomeTax = 0; + //bb.writeLog(String.format("taxId: %s || resourceid:%s",taxid,resourceid)); + if("0".equals(taxid)){ + Map> taxToDosByJm = hrmTaxDiffBiz.getTaxToDosByJm(fromDate, resourceid, workcode, taxable,ipMap); + if (taxToDosByJm.get("taxRate").size()>0){ + dndividualIncomeTax = (Double) taxToDosByJm.get("taxRate").get(24); + dndividualIncomeTax = dndividualIncomeTax<0?0:dndividualIncomeTax; + taxRateList.add(taxToDosByJm.get("taxRate")); + } + }else if("1".equals(taxid)){ + Map> taxToDosByFjm = hrmTaxDiffBiz.getTaxToDosByFjm(fromDate, resourceid, workcode, taxable, ipMap); + if(taxToDosByFjm.get("taxRateNR").size()>0){ + dndividualIncomeTax = (Double) taxToDosByFjm.get("taxRateNR").get(14); + dndividualIncomeTax = dndividualIncomeTax<0?0:dndividualIncomeTax; + taxRateNRList.add(taxToDosByFjm.get("taxRateNR")); + } + + } + + //实发总额 + double actuallySendTotal = context.execute(shouldSendTotal,costWithhold,mealWithhold,endowmentInsurance, + medicalInsurance,unemploymentInsurance,houseProvident,dndividualIncomeTax); + + HrmSalaryEntity hrmSalaryEntity = Builder.of(HrmSalaryEntity::new) + .with(HrmSalaryEntity::setPlace, place) + .with(HrmSalaryEntity::setDeptId, departmentid) + .with(HrmSalaryEntity::setCostcode, costcode) + .with(HrmSalaryEntity::setWorkcode, workcode) + .with(HrmSalaryEntity::setUserid, resourceid) + .with(HrmSalaryEntity::setCompanystartdate, companystartdate) + .with(HrmSalaryEntity::setDismissdate, dismissdate) + .with(HrmSalaryEntity::setBankAccount, bankAccount) + .with(HrmSalaryEntity::setTaxId, taxid) + .with(HrmSalaryEntity::setRealBasicSalary, basicSalary) + .with(HrmSalaryEntity::setRealOvertimePay, overtimePay) + .with(HrmSalaryEntity::setOvertimePayG1, overtimePayG1) + .with(HrmSalaryEntity::setOvertimePayG2, overtimePayG2) + .with(HrmSalaryEntity::setOvertimePayG3, overtimePayG3) + .with(HrmSalaryEntity::setBirthdayCashgift, birthdayCashgift) + .with(HrmSalaryEntity::setMerryCashgift, merryCashgift) + .with(HrmSalaryEntity::setFuneralCashgift, funeralCashgift) + .with(HrmSalaryEntity::setFestivalCashgift, festivalCashgift) + .with(HrmSalaryEntity::setPreventHeatAllowance, preventHeatAllowance) + .with(HrmSalaryEntity::setHighTemperatureSubsidy, highTemperatureSubsidy) + .with(HrmSalaryEntity::setCommunicatySubsidy, communicatySubsidy) + .with(HrmSalaryEntity::setShiftAllowance, shiftAllowance) + .with(HrmSalaryEntity::setStandAllowance, standAllowance) + .with(HrmSalaryEntity::setAchievementonus, achievementonus) + .with(HrmSalaryEntity::setAbroadInsuranceSubsidy, abroadInsuranceSubsidy) + .with(HrmSalaryEntity::setOtherItem1, otherItem1) + .with(HrmSalaryEntity::setOtherItem2, otherItem2) + .with(HrmSalaryEntity::setHouseSubsidy, houseSubsidy) + .with(HrmSalaryEntity::setSpecialAward, specialAward) + .with(HrmSalaryEntity::setSignMoney, signMoney) + .with(HrmSalaryEntity::setMeritsPay, meritsPay) + .with(HrmSalaryEntity::setAnnualBonus, annualBonus) + .with(HrmSalaryEntity::setOmpensation, ompensation) + .with(HrmSalaryEntity::setAttendanceDeduction, attendanceDeduction) + .with(HrmSalaryEntity::setOtherDeduction, otherDeduction) + .with(HrmSalaryEntity::setShouldSendTotal, shouldSendTotal) + .with(HrmSalaryEntity::setTaxable,taxable) + .with(HrmSalaryEntity::setCostWithhold, costWithhold) + .with(HrmSalaryEntity::setMealWithhold, mealWithhold) + .with(HrmSalaryEntity::setEndowmentInsurance, endowmentInsurance) + .with(HrmSalaryEntity::setMedicalInsurance, medicalInsurance) + .with(HrmSalaryEntity::setUnemploymentInsurance, unemploymentInsurance) + .with(HrmSalaryEntity::setHouseProvident, houseProvident) + .with(HrmSalaryEntity::setIndividualIncomeTax, dndividualIncomeTax) + .with(HrmSalaryEntity::setActuallySendTotal, actuallySendTotal) + .build(); + + hrmSalaryList.add(hrmSalaryEntity); + } + + //保存税率台账 + saveTaxTable(taxRateList,xzszny); + saveTaxTableNoR(taxRateNRList,xzszny); + + //缓存记录工作报表 + dataCache.setObjValWithEh("salaryScheduleList",hrmSalaryList); + + + return hrmSalaryList; + } + + /** + * 保存税率台账居民 + * @param list + * @param xzszny + */ + public void saveTaxTable(List> list,String xzszny){ + RecordSetTrans rst = new RecordSetTrans(); + try { + rst.setAutoCommit(false); + + rst.executeQuery("select count(1) as count from uf_grsds where xzszny = ?",xzszny); + rst.next(); + int count = Util.getIntValue(rst.getString("count")); + if (count > 0) return; + rst.executeBatchSql("insert into uf_grsds(xm,gh,xzszny,yfze,\n" + + " gjgdtyjmje,gsqzd,sb,gjj,zxfjkc,yfqddqtkc,ynssd,ljsr,ljmssrgjtyjmje,ljjcfy,\n" + + " ljzxkcsb,ljzxkcgjj,ljzxfjkc,ljyfqddqtkc,ljykyjynssde,sl,sskcs,ljjmsecjr80s,ljyykyjse,bqyykyjse,bqyykyjsedyyj,formmodeid) " + + " values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)",list); + + rst.commit(); + }catch (Exception e) { + rst.rollback(); + e.printStackTrace(); + } + } + + /** + * 保存税率台账非居民 + * @param list + * @param xzszny + */ + public void saveTaxTableNoR(List> list,String xzszny){ + RecordSetTrans rst = new RecordSetTrans(); + try { + rst.setAutoCommit(false); + + rst.executeQuery("select count(1) as count from uf_grsds_fjm where xzszny = ?",xzszny); + rst.next(); + int count = Util.getIntValue(rst.getString("count")); + if (count > 0) return; + rst.executeBatchSql("insert into uf_grsds_fjm(xm,gh,xzszny,yfgz,\n" + + " jbylbxj,zfgjj,qtmssd,yssre,\n" + + " fykcbz,ynssde,sl,sskcs,ynse,jmse,sjynse,shyx,formmodeid) " + + " values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)",list); + + rst.commit(); + }catch (Exception e) { + rst.rollback(); + e.printStackTrace(); + } + } + +} diff --git a/src/com/engine/qdhx/biz/HrmTaxDiffBiz.java b/src/com/engine/qdhx/biz/HrmTaxDiffBiz.java new file mode 100644 index 0000000..9c65fa5 --- /dev/null +++ b/src/com/engine/qdhx/biz/HrmTaxDiffBiz.java @@ -0,0 +1,212 @@ +package com.engine.qdhx.biz; + +import com.engine.qdhx.entity.Context; +import com.engine.qdhx.entity.TaxTableEntity; +import com.engine.qdhx.entity.TaxTableNoResidentEntity; +import com.engine.qdhx.service.impl.AddSalaryStrategy; +import com.engine.qdhx.service.impl.MultiplySalaryStrategy; +import com.engine.qdhx.service.impl.SubtractionSalaryStrategy; +import com.engine.qdhx.util.SalaryUtil; +import com.engine.qdhx.util.TaxRateUtil; +import weaver.conn.RecordSet; + +import java.time.LocalDate; +import java.time.format.DateTimeFormatter; +import java.util.*; + +/** + * @Author weaver_cl + * @Description: TODO 税率台账自动生成本月的个税 + * @Date 2022/3/2 + * @Version V1.0 + **/ +public class HrmTaxDiffBiz { + + private final double MONEY = 5000; //非居民费用扣除标准 + + private final double ZERO = 0; + + private final int JMFORMMODEID = 18; + + private final int FJMFORMMODEID = 28; + + //税率表获取(居民) + private final List taxTable = TaxRateUtil.getTaxTable(); + //非居民 + private final List taxTableNoResident = TaxRateUtil.getTaxTableNR(); + + private DateTimeFormatter formatter1 = DateTimeFormatter.ofPattern("yyyyMM"); + + + /** + * 计算居民个税 + * @param fromDate + * @param workcode + * @param shouldSendTotal + * @return + */ + public Map getTaxToDosByJm(String fromDate,String resourceid,String workcode,double shouldSendTotal,Map ipMap) { + Map> datas = new HashMap<>(); + try { + RecordSet rs = new RecordSet(); + Context context = new Context(); + context.setSalaryStrategy(new AddSalaryStrategy()); + Context context1 = new Context(); + context1.setSalaryStrategy(new SubtractionSalaryStrategy()); + Context context2 = new Context(); + context2.setSalaryStrategy(new MultiplySalaryStrategy()); + LocalDate start = LocalDate.parse(fromDate, DateTimeFormatter.ofPattern("yyyy-MM-dd")); + Integer month = start.getMonthValue(); + + //薪资所属年月 + String xzszny = formatter1.format(start); + //个人所得税自定义项目 + Map customMap = TaxRateUtil.customTable(workcode, xzszny); + + //国家规定统一减免金额 + double gjgdtyjmje = customMap.getOrDefault("gjgdtyjmje",0.00); + //个税起征点 + double gsqzd = taxTable.get(0).getQzd(); + //社保 + double sb = context.execute(ipMap.getOrDefault("ylgr16",0.00),ipMap.getOrDefault("sygr03",0.00),ipMap.getOrDefault("ylgr2",0.00)); + //公积金 + double gjj = ipMap.getOrDefault("gjjgr5",0.00); + //专项附加扣除 + double zxfjkc = customMap.getOrDefault("zxfjkc",0.00); + //依法确定的其他扣除 + double yfqddqtkc = customMap.getOrDefault("yfqddqtkc",0.00); + + //应纳税所得 + double ynssd = context1.execute(shouldSendTotal,gjgdtyjmje,gsqzd,sb,gjj,yfqddqtkc); + + rs.executeQuery("select sum(yfze) as ljsr, sum(gjgdtyjmje) as ljmssrgjtyjmje, sum(gsqzd) as ljjcfy," + + " sum(sb) as ljzxkcsb,sum(gjj) as ljzxkcgjj,sum(yfqddqtkc) as ljyfqddqtkc,sum(bqyykyjsedyyj) as ljyykyjse from uf_grsds where gh = ? and " + + " xzszny < ?",workcode,xzszny); + + rs.next(); + + double ljsr = SalaryUtil.getDoubleValue(rs.getString("ljsr"),0.00); + ljsr = context.execute(ljsr,shouldSendTotal); //累计收入 + + //累计免税收入 + double ljmssrgjtyjmje = SalaryUtil.getDoubleValue(rs.getString("ljmssrgjtyjmje"),0.00); + ljmssrgjtyjmje = context.execute(ljmssrgjtyjmje,gjgdtyjmje); + //累加减除费用 + double ljjcfy = SalaryUtil.getDoubleValue(rs.getString("ljjcfy"),0.00); + ljjcfy = context.execute(ljjcfy,gsqzd); + //累计专项扣除(社保) + double ljzxkcsb = SalaryUtil.getDoubleValue(rs.getString("ljzxkcsb"),0.00); + ljzxkcsb = context.execute(ljzxkcsb,sb); + //累计专项扣除(公积金) + double ljzxkcgjj = SalaryUtil.getDoubleValue(rs.getString("ljzxkcgjj"),0.00); + ljzxkcgjj = context.execute(ljzxkcgjj,gjj); + //累计专项附加扣除 + double ljzxfjkc = context2.execute(zxfjkc,month); + //累计依法确定的其他扣除 + double ljyfqddqtkc = SalaryUtil.getDoubleValue(rs.getString("ljyfqddqtkc"),0.00); + ljyfqddqtkc = context.execute(ljyfqddqtkc,yfqddqtkc); + //累计预扣预缴应纳税所得额 + double ljykyjynssde = context1.execute(ljsr,ljmssrgjtyjmje,ljjcfy,ljzxkcsb,ljzxkcgjj,ljzxfjkc,ljyfqddqtkc); + + //税率 + double sl = ZERO; + //速算扣除数 + double sskcs = ZERO; + //累计减免税额 (残疾人80%税) + double ljjmsecjr80s = ZERO; + //累计已预扣预缴税额 + double ljyykyjse = ZERO; + //本期应预扣预缴税额 + double bqyykjse = ZERO; + //本期应预扣预缴税额 (当月预计) + double bqyykyjsedyyj = ZERO; + if(ljykyjynssde <= 0) { + }else { + Integer side = TaxRateUtil.getTaxSide(ljsr,"0"); + TaxTableEntity taxTableEntity = taxTable.stream().filter(item -> item.getLjykyjynssde() == side).findAny().orElse(null); + sl = taxTableEntity.getYsl(); + sskcs = taxTableEntity.getSskcs(); + ljyykyjse = SalaryUtil.getDoubleValue(rs.getString("ljyykyjse"),0.00); + bqyykjse = context1.execute(context2.execute(ljykyjynssde,sl),sskcs,ljjmsecjr80s,ljyykyjse); + bqyykyjsedyyj = bqyykjse; + + } + + + List list = Arrays.asList(resourceid,workcode,xzszny,shouldSendTotal, + gjgdtyjmje,gsqzd,sb,gjj,zxfjkc,yfqddqtkc,ynssd,ljsr,ljmssrgjtyjmje,ljjcfy, + ljzxkcsb,ljzxkcgjj,ljzxfjkc,ljyfqddqtkc,ljykyjynssde,sl,sskcs,ljjmsecjr80s,ljyykyjse,bqyykjse,bqyykyjsedyyj,JMFORMMODEID); + + datas.put("taxRate",list); + + + }catch (Exception e){ + e.printStackTrace(); + } + return datas; + + } + + + /** + * 计算非居民个税 + * @param fromDate + * @param workcode + * @param shouldSendTotal + * @return + */ + public Map getTaxToDosByFjm(String fromDate,String resourceid,String workcode,double shouldSendTotal,Map ipMap) { + Map> datas = new HashMap<>(); + try{ + Context context = new Context(); + context.setSalaryStrategy(new SubtractionSalaryStrategy()); + Context context1 = new Context(); + context1.setSalaryStrategy(new MultiplySalaryStrategy()); + LocalDate start = LocalDate.parse(fromDate, DateTimeFormatter.ofPattern("yyyy-MM-dd")); + //薪资所属年月 + String xzszny = formatter1.format(start); + //基本养老保险金 + double jbylbxj = ZERO; + //公积金 + double zfgjj = ZERO; + //其他免税所得 + double qtmssd = ZERO; + //应税收入额 + double yssre = context.execute(shouldSendTotal,jbylbxj,zfgjj,qtmssd); + double fykcbz = MONEY; //费用扣除标准 + double ynssde = context.execute(yssre,fykcbz); //应纳税所得额 + + double sl = ZERO; //税率 + double sskcs = ZERO; //速算扣除数 + double ynse = ZERO; //应纳税额 + double jmse = ZERO; //减免税额 + double sjynse = ZERO; //实际应纳税额 + + if (ynssde <= 0) { + }else { + Integer side = TaxRateUtil.getTaxSide(shouldSendTotal,"1"); + TaxTableNoResidentEntity taxTableNoResidentEntity = taxTableNoResident.stream().filter(item -> item.getYnssde() == side).findAny().orElse(null); + sl = taxTableNoResidentEntity.getSl(); + sskcs = taxTableNoResidentEntity.getSskcs(); + ynse = context.execute(context1.execute(ynssde,sl),sskcs); + sjynse = context.execute(ynse,jmse); + //new BaseBean().writeLog(String.format("side: %s || taxTableNoResident %s",side,taxTableNoResident.toString())); + } + + + double shyx = context.execute(shouldSendTotal,jbylbxj,zfgjj,sjynse); //税后月薪 + + List list = Arrays.asList(resourceid,workcode,xzszny,shouldSendTotal,jbylbxj,zfgjj,qtmssd,yssre, + fykcbz,ynssde,sl,sskcs,ynse,jmse,sjynse,shyx,FJMFORMMODEID); + + datas.put("taxRateNR",list); + + + }catch (Exception e) { + e.printStackTrace(); + } + + + return datas; + } +} diff --git a/src/com/engine/qdhx/cmd/HrmSalaryDiffReportCmd.java b/src/com/engine/qdhx/cmd/HrmSalaryDiffReportCmd.java new file mode 100644 index 0000000..1b5df7f --- /dev/null +++ b/src/com/engine/qdhx/cmd/HrmSalaryDiffReportCmd.java @@ -0,0 +1,412 @@ +package com.engine.qdhx.cmd; + +import com.engine.common.biz.AbstractCommonCommand; +import com.engine.common.entity.BizLogContext; +import com.engine.core.interceptor.CommandContext; +import com.engine.qdhx.biz.HrmSalaryDiffReportBiz; +import com.engine.qdhx.entity.HrmSalaryEntity; +import com.engine.qdhx.util.SalaryUtil; +import org.slf4j.Logger; +import weaver.general.BaseBean; +import weaver.general.TimeUtil; +import weaver.general.Util; +import weaver.hrm.User; +import weaver.hrm.company.DepartmentComInfo; +import weaver.hrm.report.schedulediff.HrmScheduleDiffManager; +import weaver.hrm.resource.ResourceComInfo; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +/** + * @Author weaver_cl + * @Description: TODO + * @Date 2022/2/16 + * @Version V1.0 + **/ +public class HrmSalaryDiffReportCmd extends AbstractCommonCommand> { + + + public HrmSalaryDiffReportCmd(User user, Map params) { + this.user = user; + this.params = params; + } + + + @Override + public BizLogContext getLogContext() { + return null; + } + + @Override + public Map execute(CommandContext commandContext) { + Map apidatas = new HashMap<>(); + + if (null == user){ + apidatas.put("hasRight", false); + return apidatas; + } + + try { + Map reportdata = new HashMap<>(); + ResourceComInfo resourceComInfo = new ResourceComInfo(); + DepartmentComInfo departmentComInfo = new DepartmentComInfo(); + + String typeselect = Util.null2String(params.get("typeselect")); //时间范围 + String viewscope = Util.null2String(params.get("viewscope")); //查看范围 + String subCompanyId = Util.null2String(params.get("subCompanyId")); + String departmentId = Util.null2String(params.get("departmentId")); + String resourceId = Util.null2String(params.get("resourceId")); + + String fromDate = ""; + String toDate = ""; + + if ("1".equals(typeselect) || "".equals(typeselect)) { + fromDate = TimeUtil.getLastMonthBeginDay(); + toDate = TimeUtil.getLastMonthEndDay(); + }else { + fromDate = TimeUtil.getMonthBeginDay(); + toDate = TimeUtil.getMonthEndDay(); + } + + + + String fileName = fromDate+" "+ "至"+" "+toDate+" "+"薪资情况统计"; + + reportdata.put("title", fileName); + List titleRows = new ArrayList(); + List titleRow = null; + Map titleCell = null; + + titleRow = new ArrayList<>(); + + List rowlist = Stream.of("处","部","费用代码","工号","姓名","入职日期","离职日期","中国农业银行账户","税务身份").collect(Collectors.toList()); + + for (String rowvalue : rowlist) { + titleCell = new HashMap<>(); + titleCell.put("rowspan", "3"); + titleCell.put("value", rowvalue); + titleRow.add(titleCell); + } + + titleCell = new HashMap<>(); + titleCell.put("colspan", "5"); + titleCell.put("rowspan", "1"); + titleCell.put("value", "薪资项目"); + titleRow.add(titleCell); + + titleCell = new HashMap<>(); + titleCell.put("colspan", "14"); + titleCell.put("rowspan", "1"); + titleCell.put("value", "福利项目"); + titleRow.add(titleCell); + + titleCell = new HashMap<>(); + titleCell.put("colspan", "4"); + titleCell.put("rowspan", "1"); + titleCell.put("value", "奖金"); + titleRow.add(titleCell); + + List rowlist1 = Stream.of("一次性补偿金(税后)","考勤扣款(减项)","其他减项","应纳税额","应发总额").collect(Collectors.toList()); + + for (String rowvalue : rowlist1) { + titleCell = new HashMap<>(); + titleCell.put("rowspan", "3"); + titleCell.put("value", rowvalue); + titleRow.add(titleCell); + } + + titleCell = new HashMap<>(); + titleCell.put("colspan", "2"); + titleCell.put("rowspan", "1"); + titleCell.put("value", "其他减项"); + titleRow.add(titleCell); + + titleCell = new HashMap<>(); + titleCell.put("colspan", "4"); + titleCell.put("rowspan", "1"); + titleCell.put("value", "五险一金代扣代缴款"); + titleRow.add(titleCell); + + titleCell = new HashMap<>(); + titleCell.put("rowspan", "3"); + titleCell.put("value", "个人所得税"); + titleRow.add(titleCell); + + titleCell = new HashMap<>(); + titleCell.put("rowspan", "3"); + titleCell.put("value", "实发总额"); + titleRow.add(titleCell); + titleRows.add(titleRow); //第一列 + + + titleRow = new ArrayList<>(); + List salaryTypelist = Stream.of("实发基本工资","实发固定加班费").collect(Collectors.toList()); + for (String rowvalue : salaryTypelist) { + titleCell = new HashMap<>(); + titleCell.put("rowspan", "2"); + titleCell.put("value", rowvalue); + titleRow.add(titleCell); + } + + titleCell = new HashMap<>(); + titleCell.put("rowspan", "1"); + titleCell.put("colspan", "3"); + titleCell.put("value", "加班费"); + titleRow.add(titleCell); + + + List welfareTypelist = Stream.of("生日礼金","结婚礼金","丧葬礼金","节日礼金", + "防暑津贴","高温补贴","通讯补贴","轮班津贴","站别津贴","生产绩效奖金","境外保险补贴","其他加项1","其他加项2(税后)","住房补贴").collect(Collectors.toList()); + for (String rowvalue : welfareTypelist) { + titleCell = new HashMap<>(); + titleCell.put("rowspan", "2"); + titleCell.put("value", rowvalue); + titleRow.add(titleCell); + } + + + List bonusTypelist = Stream.of("特别奖励金","签约金","绩效奖","年终奖","住宿水电物业费代扣","餐费代扣").collect(Collectors.toList()); + for (String rowvalue : bonusTypelist) { + titleCell = new HashMap<>(); + titleCell.put("rowspan", "2"); + titleCell.put("value", rowvalue); + titleRow.add(titleCell); + } + + + List insuranceTypelist = Stream.of("养老保险","医疗保险","失业保险","住房公积金").collect(Collectors.toList()); + for (String rowvalue : insuranceTypelist) { + titleCell = new HashMap<>(); + titleCell.put("rowspan", "2"); + titleCell.put("value", rowvalue); + titleRow.add(titleCell); + } + titleRows.add(titleRow); //第二列 + + titleRow = new ArrayList<>(); + List workTimeTypelist = Stream.of("G1","G2","G3").collect(Collectors.toList()); + for (String rowvalue : workTimeTypelist) { + titleCell = new HashMap<>(); + titleCell.put("rowspan", "1"); + titleCell.put("value", rowvalue); + titleRow.add(titleCell); + } + titleRows.add(titleRow); //第三列 + + + reportdata.put("titlerows", titleRows); + List datarows = new ArrayList<>(); + List row = null; + Map cell = null; + HrmSalaryDiffReportBiz salaryDiffReportBiz = new HrmSalaryDiffReportBiz(); + + List scheduleList = salaryDiffReportBiz.getScheduleList(fromDate,toDate,subCompanyId,departmentId,resourceId); + HrmSalaryEntity hrmSalaryEntity = null; + for(int i=0; i(); + datarows.add(row); + + cell = new HashMap<>(); + cell.put("value", Util.null2String(departmentComInfo.getDepartmentName(hrmSalaryEntity.getPlace()))); + row.add(cell); + + cell = new HashMap<>(); + cell.put("value", Util.null2String(departmentComInfo.getDepartmentName(hrmSalaryEntity.getDeptId()))); + row.add(cell); + + cell = new HashMap<>(); + cell.put("value", Util.null2String(hrmSalaryEntity.getCostcode())); + row.add(cell); + + cell = new HashMap<>(); + cell.put("value", Util.null2String(hrmSalaryEntity.getWorkcode())); + row.add(cell); + + cell = new HashMap<>(); + cell.put("value", Util.null2String(resourceComInfo.getLastname(hrmSalaryEntity.getUserid()))); + row.add(cell); + + cell = new HashMap<>(); + cell.put("value", Util.null2String(hrmSalaryEntity.getCompanystartdate())); + row.add(cell); + + cell = new HashMap<>(); + cell.put("value", Util.null2String(hrmSalaryEntity.getDismissdate())); + row.add(cell); + + cell = new HashMap<>(); + cell.put("value", Util.null2String(hrmSalaryEntity.getBankAccount())); + row.add(cell); + + cell = new HashMap<>(); + cell.put("value", Util.null2String(SalaryUtil.getTaxName(hrmSalaryEntity.getTaxId()))); + row.add(cell); + + cell = new HashMap<>(); + cell.put("value", Util.null2String(hrmSalaryEntity.getRealBasicSalary())); + row.add(cell); + + + cell = new HashMap<>(); + cell.put("value", Util.null2String(hrmSalaryEntity.getRealOvertimePay())); + row.add(cell); + + cell = new HashMap<>(); + cell.put("value", Util.null2String(hrmSalaryEntity.getOvertimePayG1())); + row.add(cell); + + cell = new HashMap<>(); + cell.put("value", Util.null2String(hrmSalaryEntity.getOvertimePayG2())); + row.add(cell); + + cell = new HashMap<>(); + cell.put("value", Util.null2String(hrmSalaryEntity.getOvertimePayG3())); + row.add(cell); + + cell = new HashMap<>(); + cell.put("value", Util.null2String(hrmSalaryEntity.getBirthdayCashgift())); + row.add(cell); + + cell = new HashMap<>(); + cell.put("value", Util.null2String(hrmSalaryEntity.getMerryCashgift())); + row.add(cell); + + cell = new HashMap<>(); + cell.put("value", Util.null2String(hrmSalaryEntity.getFuneralCashgift())); + row.add(cell); + + cell = new HashMap<>(); + cell.put("value", Util.null2String(hrmSalaryEntity.getFestivalCashgift())); + row.add(cell); + + cell = new HashMap<>(); + cell.put("value", Util.null2String(hrmSalaryEntity.getPreventHeatAllowance())); + row.add(cell); + + cell = new HashMap<>(); + cell.put("value", Util.null2String(hrmSalaryEntity.getHighTemperatureSubsidy())); + row.add(cell); + + cell = new HashMap<>(); + cell.put("value", Util.null2String(hrmSalaryEntity.getCommunicatySubsidy())); + row.add(cell); + + cell = new HashMap<>(); + cell.put("value", Util.null2String(hrmSalaryEntity.getShiftAllowance())); + row.add(cell); + + cell = new HashMap<>(); + cell.put("value", Util.null2String(hrmSalaryEntity.getStandAllowance())); + row.add(cell); + + + cell = new HashMap<>(); + cell.put("value", Util.null2String(hrmSalaryEntity.getAchievementonus())); + row.add(cell); + + cell = new HashMap<>(); + cell.put("value", Util.null2String(hrmSalaryEntity.getAbroadInsuranceSubsidy())); + row.add(cell); + + cell = new HashMap<>(); + cell.put("value", Util.null2String(hrmSalaryEntity.getOtherItem1())); + row.add(cell); + + cell = new HashMap<>(); + cell.put("value", Util.null2String(hrmSalaryEntity.getOtherItem2())); + row.add(cell); + + cell = new HashMap<>(); + cell.put("value", Util.null2String(hrmSalaryEntity.getHouseSubsidy())); + row.add(cell); + + cell = new HashMap<>(); + cell.put("value", Util.null2String(hrmSalaryEntity.getSpecialAward())); + row.add(cell); + + cell = new HashMap<>(); + cell.put("value", Util.null2String(hrmSalaryEntity.getSignMoney())); + row.add(cell); + + cell = new HashMap<>(); + cell.put("value", Util.null2String(hrmSalaryEntity.getMeritsPay())); + row.add(cell); + + cell = new HashMap<>(); + cell.put("value", Util.null2String(hrmSalaryEntity.getAnnualBonus())); + row.add(cell); + + cell = new HashMap<>(); + cell.put("value", Util.null2String(hrmSalaryEntity.getOmpensation())); + row.add(cell); + + cell = new HashMap<>(); + cell.put("value", Util.null2String(hrmSalaryEntity.getAttendanceDeduction())); + row.add(cell); + + cell = new HashMap<>(); + cell.put("value", Util.null2String(hrmSalaryEntity.getOtherDeduction())); + row.add(cell); + + cell = new HashMap<>(); + cell.put("value", Util.null2String(hrmSalaryEntity.getTaxable())); + row.add(cell); + + cell = new HashMap<>(); + cell.put("value", Util.null2String(hrmSalaryEntity.getShouldSendTotal())); + row.add(cell); + + + cell = new HashMap<>(); + cell.put("value", Util.null2String(hrmSalaryEntity.getCostWithhold())); + row.add(cell); + + cell = new HashMap<>(); + cell.put("value", Util.null2String(hrmSalaryEntity.getMealWithhold())); + row.add(cell); + + cell = new HashMap<>(); + cell.put("value", Util.null2String(hrmSalaryEntity.getEndowmentInsurance())); + row.add(cell); + + + cell = new HashMap<>(); + cell.put("value", Util.null2String(hrmSalaryEntity.getMedicalInsurance())); + row.add(cell); + + cell = new HashMap<>(); + cell.put("value", Util.null2String(hrmSalaryEntity.getUnemploymentInsurance())); + row.add(cell); + + cell = new HashMap<>(); + cell.put("value", Util.null2String(hrmSalaryEntity.getHouseProvident())); + row.add(cell); + + cell = new HashMap<>(); + cell.put("value", Util.null2String(hrmSalaryEntity.getIndividualIncomeTax())); + row.add(cell); + + cell = new HashMap<>(); + cell.put("value", Util.null2String(hrmSalaryEntity.getActuallySendTotal())); + row.add(cell); + + } + reportdata.put("datarows", datarows); + apidatas.put("reportdata", reportdata); + apidatas.put("fromDate", fromDate); + apidatas.put("toDate", toDate); + + + + }catch (Exception e){ + e.printStackTrace(); + } + return apidatas; + } +} diff --git a/src/com/engine/qdhx/cmd/HrmSalaryDiffReportConditionCmd.java b/src/com/engine/qdhx/cmd/HrmSalaryDiffReportConditionCmd.java new file mode 100644 index 0000000..97b03c8 --- /dev/null +++ b/src/com/engine/qdhx/cmd/HrmSalaryDiffReportConditionCmd.java @@ -0,0 +1,40 @@ +package com.engine.qdhx.cmd; + +import com.engine.common.biz.AbstractCommonCommand; +import com.engine.common.entity.BizLogContext; +import com.engine.core.interceptor.CommandContext; +import weaver.hrm.User; + +import java.util.HashMap; +import java.util.Map; + +/** + * @Author weaver_cl + * @Description: TODO + * @Date 2022/2/17 + * @Version V1.0 + **/ +public class HrmSalaryDiffReportConditionCmd extends AbstractCommonCommand> { + + public HrmSalaryDiffReportConditionCmd(User user, Map params) { + this.user = user; + this.params = params; + } + + @Override + public BizLogContext getLogContext() { + return null; + } + + @Override + public Map execute(CommandContext commandContext) { + Map apidatas = new HashMap(); + try { + + }catch (Exception e) { + e.printStackTrace(); + } + + return apidatas; + } +} diff --git a/src/com/engine/qdhx/cmd/HrmSalarySaveReportCmd.java b/src/com/engine/qdhx/cmd/HrmSalarySaveReportCmd.java new file mode 100644 index 0000000..886f292 --- /dev/null +++ b/src/com/engine/qdhx/cmd/HrmSalarySaveReportCmd.java @@ -0,0 +1,157 @@ +package com.engine.qdhx.cmd; + +import com.cloudstore.dev.api.util.Util_DataCache; +import com.engine.common.biz.AbstractCommonCommand; +import com.engine.common.entity.BizLogContext; +import com.engine.core.interceptor.CommandContext; +import com.engine.qdhx.entity.HrmSalaryEntity; +import com.weaver.general.TimeUtil; +import weaver.conn.RecordSet; +import weaver.conn.RecordSetTrans; +import weaver.general.Util; +import weaver.hrm.User; + +import java.time.LocalDate; +import java.time.format.DateTimeFormatter; +import java.util.*; + +/** + * @Author weaver_cl + * @Description: TODO + * @Date 2022/2/22 + * @Version V1.0 + **/ +public class HrmSalarySaveReportCmd extends AbstractCommonCommand> { + + private static final int FORMMODEID = 6; + + public HrmSalarySaveReportCmd(User user, Map params) { + this.user = user; + this.params = params; + } + + @Override + public BizLogContext getLogContext() { + return null; + } + + @Override + public Map execute(CommandContext commandContext) { + Map apidatas = new HashMap<>(); + RecordSet rs = new RecordSet(); + RecordSetTrans rst = new RecordSetTrans(); + try { + rst.setAutoCommit(false); + int userid = user.getUID(); + //查看范围(总部 分部 部门只做插入 人员可更新数据) + String viewscope = Util.null2String(params.get("viewscope")); + String fromDate = Util.null2String(params.get("fromDate")); + LocalDate start = LocalDate.parse(fromDate, DateTimeFormatter.ofPattern("yyyy-MM-dd")); + int year = start.getYear(); + int month = start.getMonthValue(); + + rs.executeQuery("select count(1) as count from uf_xztz where year = ? and month = ?",year,month); + rs.next(); + int count = Util.getIntValue(rs.getString("count")); + + if (count >= 1 ){ + if ("0".equals(viewscope)) { + //保存总部数据时先删除台账数据 + rs.executeUpdate("delete from uf_xztz where year = ? and month = ?",year,month); + }else { + apidatas.put("message", "台账数据已存在"); + return apidatas; + } + } + + List scheduleList = null; + Util_DataCache dataCache = new Util_DataCache(); + + String currentDateString = TimeUtil.getCurrentDateString(); + String currentTimeString = TimeUtil.getOnlyCurrentTimeString(); + + List> list = new LinkedList<>(); + + scheduleList = (List) dataCache.getObjValWithEh("salaryScheduleList"); + scheduleList.forEach(value -> { + HrmSalaryEntity hrmSalaryEntity = (HrmSalaryEntity)value; + List hrmSalaryEntityList = Arrays.asList(hrmSalaryEntity.getPlace(), + hrmSalaryEntity.getDeptId(), + hrmSalaryEntity.getCostcode(), + hrmSalaryEntity.getWorkcode(), + hrmSalaryEntity.getUserid(), + hrmSalaryEntity.getCompanystartdate(), + hrmSalaryEntity.getDismissdate(), + hrmSalaryEntity.getBankAccount(), + hrmSalaryEntity.getTaxId(), + hrmSalaryEntity.getRealBasicSalary(), + hrmSalaryEntity.getRealOvertimePay(), + hrmSalaryEntity.getOvertimePayG1(), + hrmSalaryEntity.getOvertimePayG2(), + hrmSalaryEntity.getOvertimePayG3(), + hrmSalaryEntity.getBirthdayCashgift(), + hrmSalaryEntity.getMerryCashgift(), + hrmSalaryEntity.getFuneralCashgift(), + hrmSalaryEntity.getFestivalCashgift(), + hrmSalaryEntity.getPreventHeatAllowance(), + hrmSalaryEntity.getHighTemperatureSubsidy(), + hrmSalaryEntity.getCommunicatySubsidy(), + hrmSalaryEntity.getShiftAllowance(), + hrmSalaryEntity.getStandAllowance(), + hrmSalaryEntity.getAchievementonus(), + hrmSalaryEntity.getAbroadInsuranceSubsidy(), + hrmSalaryEntity.getOtherItem1(), + hrmSalaryEntity.getOtherItem2(), + hrmSalaryEntity.getHouseSubsidy(), + hrmSalaryEntity.getSpecialAward(), + hrmSalaryEntity.getSignMoney(), + hrmSalaryEntity.getMeritsPay(), + hrmSalaryEntity.getAnnualBonus(), + hrmSalaryEntity.getOmpensation(), + hrmSalaryEntity.getAttendanceDeduction(), + hrmSalaryEntity.getOtherDeduction(), + hrmSalaryEntity.getTaxable(), + hrmSalaryEntity.getShouldSendTotal(), + hrmSalaryEntity.getCostWithhold(), + hrmSalaryEntity.getMealWithhold(), + hrmSalaryEntity.getEndowmentInsurance(), + hrmSalaryEntity.getMedicalInsurance(), + hrmSalaryEntity.getUnemploymentInsurance(), + hrmSalaryEntity.getHouseProvident(), + hrmSalaryEntity.getIndividualIncomeTax(), + hrmSalaryEntity.getActuallySendTotal(), + year, + month, + userid, + currentDateString, + currentTimeString, + FORMMODEID); + list.add(hrmSalaryEntityList); + }); + + if (count == 1 && "3".equals(viewscope)){ //人员数据更新 + apidatas.put("message","台账数据更新成功"); + + }else { + rst.executeBatchSql("insert into uf_xztz(place,deptId,costcode,workcode," + + "lastname,companystartdate,dismissdate,bankAccount,taxId,realBasicSalary,realOvertimePay,overtimePayG1," + + "overtimePayG2,overtimePayG3,birthdayCashgift,merryCashgift," + + "funeralCashgift,festivalCashgift,preventHeatAllowance,highTemperatureSubsidy," + + "communicatySubsidy,shiftAllowance,StandAllowance,achievementonus,abroadInsuranceSubsidy," + + "otherItem1,otherItem2,houseSubsidy,specialAward,signMoney,meritsPay,annualBonus," + + "ompensation,attendanceDeduction,otherDeduction,taxable,shouldSendTotal,costWithhold,mealWithhold," + + "endowmentInsurance,medicalInsurance,unemploymentInsurance,houseProvident,individualIncomeTax," + + "actuallySendTotal,year,month,modedatacreater,modedatacreatedate,modedatacreatetime,formmodeid) values(?,?,?,?,?,?," + + "?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?," + + "?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)",list); + apidatas.put("message","台账数据插入成功"); + } + + rst.commit(); + }catch (Exception e){ + rst.rollback(); + e.printStackTrace(); + } + return apidatas; + } +} diff --git a/src/com/engine/qdhx/entity/Builder.java b/src/com/engine/qdhx/entity/Builder.java new file mode 100644 index 0000000..f12d620 --- /dev/null +++ b/src/com/engine/qdhx/entity/Builder.java @@ -0,0 +1,132 @@ +package com.engine.qdhx.entity; + +import java.util.ArrayList; +import java.util.List; +import java.util.function.Consumer; +import java.util.function.Supplier; + +/** + * + * @param + */ +public class Builder { + + private final Supplier instantiator; + + private List> modifiers = new ArrayList<>(); + + public Builder(Supplier instant) { + this.instantiator = instant; + } + + public static Builder of(Supplier instant) { + return new Builder<>(instant); + } + + public Builder with(Consumer1 consumer, P1 p1) { + Consumer c = instance -> consumer.accept(instance, p1); + modifiers.add(c); + return this; + } + + public Builder with(Consumer2 consumer, P1 p1, P2 p2) { + Consumer c = instance -> consumer.accept(instance, p1, p2); + modifiers.add(c); + return this; + } + + public Builder with(Consumer3 consumer, P1 p1, P2 p2, P3 p3) { + Consumer c = instance -> consumer.accept(instance, p1, p2, p3); + modifiers.add(c); + return this; + } + + public Builder with(Consumer4 consumer, P1 p1, P2 p2, P3 p3,P4 p4) { + Consumer c = instance -> consumer.accept(instance, p1, p2, p3,p4); + modifiers.add(c); + return this; + } + + public Builder with(Consumer5 consumer, P1 p1, P2 p2, P3 p3,P4 p4,P5 p5) { + Consumer c = instance -> consumer.accept(instance, p1, p2, p3,p4,p5); + modifiers.add(c); + return this; + } + + public T build() { + T value = instantiator.get(); + modifiers.forEach(modifier -> modifier.accept(value)); + modifiers.clear(); + return value; + } + + + /** + * 1 参数 Consumer + */ + @FunctionalInterface + public interface Consumer1 { + /** + * 接收参数方法 + * @param t 对象 + * @param p1 参数二 + */ + void accept(T t, P1 p1); + } + + /** + * 2 参数 Consumer + */ + @FunctionalInterface + public interface Consumer2 { + /** + * 接收参数方法 + * @param t 对象 + * @param p1 参数一 + * @param p2 参数二 + */ + void accept(T t, P1 p1, P2 p2); + } + + /** + * 3 参数 Consumer + */ + @FunctionalInterface + public interface Consumer3 { + /** + * 接收参数方法 + * @param t 对象 + * @param p1 参数一 + * @param p2 参数二 + * @param p3 参数三 + */ + void accept(T t, P1 p1, P2 p2, P3 p3); + } + + @FunctionalInterface + public interface Consumer4{ + /** + * 接收参数方法 + * @param t 对象 + * @param p1 参数一 + * @param p2 参数二 + * @param p3 参数三 + * @param p4 参数四 + */ + void accept(T t,P1 p1,P2 p2,P3 p3,P4 p4); + } + + @FunctionalInterface + public interface Consumer5{ + /** + * 接收参数方法 + * @param t 对象 + * @param p1 参数一 + * @param p2 参数二 + * @param p3 参数三 + * @param p4 参数四 + * @param p5 参数五 + */ + void accept(T t,P1 p1,P2 p2,P3 p3,P4 p4,P5 p5); + } +} \ No newline at end of file diff --git a/src/com/engine/qdhx/entity/Context.java b/src/com/engine/qdhx/entity/Context.java new file mode 100644 index 0000000..d2a7de7 --- /dev/null +++ b/src/com/engine/qdhx/entity/Context.java @@ -0,0 +1,33 @@ +package com.engine.qdhx.entity; + +import com.engine.qdhx.service.SalaryStrategy; +import com.engine.qdhx.service.impl.AddSalaryStrategy; + +/** + * @Author weaver_cl + * @Description: TODO + * @Date 2022/2/25 + * @Version V1.0 + **/ +public class Context { + + private SalaryStrategy salaryStrategy; + + + public Context() { + salaryStrategy = new AddSalaryStrategy(); + } + + public double execute(double ...num) { + return salaryStrategy.doSalaryDiff(num); + + } + + public SalaryStrategy getSalaryStrategy() { + return salaryStrategy; + } + + public void setSalaryStrategy(SalaryStrategy salaryStrategy) { + this.salaryStrategy = salaryStrategy; + } +} diff --git a/src/com/engine/qdhx/entity/HrmSalaryEntity.java b/src/com/engine/qdhx/entity/HrmSalaryEntity.java new file mode 100644 index 0000000..b2a80c7 --- /dev/null +++ b/src/com/engine/qdhx/entity/HrmSalaryEntity.java @@ -0,0 +1,461 @@ +package com.engine.qdhx.entity; + + +/** + * @author weaver_cl + * @Description: TODO 薪资报表 + * @Date 2022/2/21 + * @Version V1.0 + **/ +public class HrmSalaryEntity { + + private String place; //处 + + private String deptId; + + private String costcode; //费用代码 + + private String workcode; + + private String userid; + + private String companystartdate; //入职日期 + + private String dismissdate; //离职日期 + + private String bankAccount; //中国农业银行账号 + + private String taxId; //税务身份 + + private double realBasicSalary; //实发基本工资 + + private double realOvertimePay; //实发固定加班费 + + private double overtimePayG1; //G1; + + private double overtimePayG2; //G2; + + private double overtimePayG3; //G3; + + private double birthdayCashgift; //生日礼金 + + private double merryCashgift; //结婚礼金 + + private double funeralCashgift; //丧葬礼金 + + private double festivalCashgift; //节日礼金 + + private double preventHeatAllowance; //防暑津贴 + + private double highTemperatureSubsidy; //高温补贴 + + private double communicatySubsidy; //通讯补贴 + + private double shiftAllowance; //轮班津贴 + + private double standAllowance; //站别津贴 + + private double achievementonus; //绩效奖金 + + private double abroadInsuranceSubsidy; //境外保险补贴 + + private double otherItem1; //其他加项1 + + private double otherItem2; //其他加项2 + + private double houseSubsidy; //住房补贴 + + private double specialAward; //特别奖励金 + + private double signMoney; //签约金 + + private double meritsPay; //绩效奖 + + private double annualBonus; //年终奖 + + private double ompensation; //一次性补偿金 + + private double attendanceDeduction; //考勤扣款 + + private double otherDeduction; //其他减项 + + private double Taxable; //应纳税额 + + private double shouldSendTotal; //应发总额 + + private double costWithhold; //住宿水电物业费代扣 + + private double mealWithhold; //餐费代扣 + + private double endowmentInsurance; //养老保险 + + private double medicalInsurance; //医疗保险 + + private double unemploymentInsurance; //失业保险 + + private double houseProvident; //住房公积金 + + private double individualIncomeTax; //个人所得税 + + private double actuallySendTotal; //实发总额 + + public String getPlace() { + return place; + } + + public void setPlace(String place) { + this.place = place; + } + + public String getDeptId() { + return deptId; + } + + public void setDeptId(String deptId) { + this.deptId = deptId; + } + + public String getCostcode() { + return costcode; + } + + public void setCostcode(String costcode) { + this.costcode = costcode; + } + + public String getWorkcode() { + return workcode; + } + + public void setWorkcode(String workcode) { + this.workcode = workcode; + } + + public String getUserid() { + return userid; + } + + public void setUserid(String userid) { + this.userid = userid; + } + + public String getCompanystartdate() { + return companystartdate; + } + + public void setCompanystartdate(String companystartdate) { + this.companystartdate = companystartdate; + } + + public String getDismissdate() { + return dismissdate; + } + + public void setDismissdate(String dismissdate) { + this.dismissdate = dismissdate; + } + + public String getBankAccount() { + return bankAccount; + } + + public void setBankAccount(String bankAccount) { + this.bankAccount = bankAccount; + } + + public String getTaxId() { + return taxId; + } + + public void setTaxId(String taxId) { + this.taxId = taxId; + } + + public double getRealBasicSalary() { + return realBasicSalary; + } + + public void setRealBasicSalary(double realBasicSalary) { + this.realBasicSalary = realBasicSalary; + } + + public double getRealOvertimePay() { + return realOvertimePay; + } + + public void setRealOvertimePay(double realOvertimePay) { + this.realOvertimePay = realOvertimePay; + } + + public double getOvertimePayG1() { + return overtimePayG1; + } + + public void setOvertimePayG1(double overtimePayG1) { + this.overtimePayG1 = overtimePayG1; + } + + public double getOvertimePayG2() { + return overtimePayG2; + } + + public void setOvertimePayG2(double overtimePayG2) { + this.overtimePayG2 = overtimePayG2; + } + + public double getOvertimePayG3() { + return overtimePayG3; + } + + public void setOvertimePayG3(double overtimePayG3) { + this.overtimePayG3 = overtimePayG3; + } + + public double getBirthdayCashgift() { + return birthdayCashgift; + } + + public void setBirthdayCashgift(double birthdayCashgift) { + this.birthdayCashgift = birthdayCashgift; + } + + public double getMerryCashgift() { + return merryCashgift; + } + + public void setMerryCashgift(double merryCashgift) { + this.merryCashgift = merryCashgift; + } + + public double getFuneralCashgift() { + return funeralCashgift; + } + + public void setFuneralCashgift(double funeralCashgift) { + this.funeralCashgift = funeralCashgift; + } + + public double getFestivalCashgift() { + return festivalCashgift; + } + + public void setFestivalCashgift(double festivalCashgift) { + this.festivalCashgift = festivalCashgift; + } + + public double getPreventHeatAllowance() { + return preventHeatAllowance; + } + + public void setPreventHeatAllowance(double preventHeatAllowance) { + this.preventHeatAllowance = preventHeatAllowance; + } + + public double getHighTemperatureSubsidy() { + return highTemperatureSubsidy; + } + + public void setHighTemperatureSubsidy(double highTemperatureSubsidy) { + this.highTemperatureSubsidy = highTemperatureSubsidy; + } + + public double getCommunicatySubsidy() { + return communicatySubsidy; + } + + public void setCommunicatySubsidy(double communicatySubsidy) { + this.communicatySubsidy = communicatySubsidy; + } + + public double getShiftAllowance() { + return shiftAllowance; + } + + public void setShiftAllowance(double shiftAllowance) { + this.shiftAllowance = shiftAllowance; + } + + public double getStandAllowance() { + return standAllowance; + } + + public void setStandAllowance(double standAllowance) { + this.standAllowance = standAllowance; + } + + public double getAchievementonus() { + return achievementonus; + } + + public void setAchievementonus(double achievementonus) { + this.achievementonus = achievementonus; + } + + public double getAbroadInsuranceSubsidy() { + return abroadInsuranceSubsidy; + } + + public void setAbroadInsuranceSubsidy(double abroadInsuranceSubsidy) { + this.abroadInsuranceSubsidy = abroadInsuranceSubsidy; + } + + public double getOtherItem1() { + return otherItem1; + } + + public void setOtherItem1(double otherItem1) { + this.otherItem1 = otherItem1; + } + + public double getOtherItem2() { + return otherItem2; + } + + public void setOtherItem2(double otherItem2) { + this.otherItem2 = otherItem2; + } + + public double getHouseSubsidy() { + return houseSubsidy; + } + + public void setHouseSubsidy(double houseSubsidy) { + this.houseSubsidy = houseSubsidy; + } + + public double getSpecialAward() { + return specialAward; + } + + public void setSpecialAward(double specialAward) { + this.specialAward = specialAward; + } + + public double getSignMoney() { + return signMoney; + } + + public void setSignMoney(double signMoney) { + this.signMoney = signMoney; + } + + public double getMeritsPay() { + return meritsPay; + } + + public void setMeritsPay(double meritsPay) { + this.meritsPay = meritsPay; + } + + public double getAnnualBonus() { + return annualBonus; + } + + public void setAnnualBonus(double annualBonus) { + this.annualBonus = annualBonus; + } + + public double getOmpensation() { + return ompensation; + } + + public void setOmpensation(double ompensation) { + this.ompensation = ompensation; + } + + public double getAttendanceDeduction() { + return attendanceDeduction; + } + + public void setAttendanceDeduction(double attendanceDeduction) { + this.attendanceDeduction = attendanceDeduction; + } + + public double getOtherDeduction() { + return otherDeduction; + } + + public void setOtherDeduction(double otherDeduction) { + this.otherDeduction = otherDeduction; + } + + public double getTaxable() { + return Taxable; + } + + public void setTaxable(double taxable) { + Taxable = taxable; + } + + public double getShouldSendTotal() { + return shouldSendTotal; + } + + public void setShouldSendTotal(double shouldSendTotal) { + this.shouldSendTotal = shouldSendTotal; + } + + public double getCostWithhold() { + return costWithhold; + } + + public void setCostWithhold(double costWithhold) { + this.costWithhold = costWithhold; + } + + public double getMealWithhold() { + return mealWithhold; + } + + public void setMealWithhold(double mealWithhold) { + this.mealWithhold = mealWithhold; + } + + public double getEndowmentInsurance() { + return endowmentInsurance; + } + + public void setEndowmentInsurance(double endowmentInsurance) { + this.endowmentInsurance = endowmentInsurance; + } + + public double getMedicalInsurance() { + return medicalInsurance; + } + + public void setMedicalInsurance(double medicalInsurance) { + this.medicalInsurance = medicalInsurance; + } + + public double getUnemploymentInsurance() { + return unemploymentInsurance; + } + + public void setUnemploymentInsurance(double unemploymentInsurance) { + this.unemploymentInsurance = unemploymentInsurance; + } + + public double getHouseProvident() { + return houseProvident; + } + + public void setHouseProvident(double houseProvident) { + this.houseProvident = houseProvident; + } + + public double getIndividualIncomeTax() { + return individualIncomeTax; + } + + public void setIndividualIncomeTax(double individualIncomeTax) { + this.individualIncomeTax = individualIncomeTax; + } + + public double getActuallySendTotal() { + return actuallySendTotal; + } + + public void setActuallySendTotal(double actuallySendTotal) { + this.actuallySendTotal = actuallySendTotal; + } +} diff --git a/src/com/engine/qdhx/entity/TaxRateEntity.java b/src/com/engine/qdhx/entity/TaxRateEntity.java new file mode 100644 index 0000000..5face10 --- /dev/null +++ b/src/com/engine/qdhx/entity/TaxRateEntity.java @@ -0,0 +1,260 @@ +package com.engine.qdhx.entity; + +/** + * @Author weaver_cl + * @Description: TODO + * @Date 2022/3/1 + * @Version V1.0 + **/ +public class TaxRateEntity { + + private Integer id; + + private String workcode; + + private String xzszny; //薪资所属年月 + + private double yfze; //应付总额 + + private double gjgdtyjmje; //国家规定统一减免金额 + + private double gsqzd; //个税起征点 + + private double sb; //社保 + + private double gjj; //公积金 + + private double zxfjkc; //专项附加扣除 + + private double yfqddqtkc; //依法确定的其他扣除 + + private double ynssd; //应纳税所得 + + private double ljsr; //累计收入 + + private double ljmssrgjtyjmje; //累计免税收入 + + private double ljjcfy; //累加减除费用 + + private double ljzxkcsb; //累计专项扣除sb + + private double ljzxkcgjj; //累计专项扣除gjj + + private double ljzxfjkc; //累计专项附加扣除 + + private double ljyfqddqtkc; //累计依法确定的其他扣除 + + private double ljykyjynssde; //累计预扣预缴应纳税所得额 + + private double sl; //税率 + + private double sskcs; //速算扣除数 + + private double ljjmsecjr80s; //累计减免税额 (残疾人80%税) + + private double ljyykyjse; //累计已预扣预缴税额 + + private double bqyykyjse; //本期应预扣预缴税额 + + private double bqyykyjsedyyj; //本期应预扣预缴税额 (当月预计) + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getWorkcode() { + return workcode; + } + + public void setWorkcode(String workcode) { + this.workcode = workcode; + } + + public String getXzszny() { + return xzszny; + } + + public void setXzszny(String xzszny) { + this.xzszny = xzszny; + } + + public double getYfze() { + return yfze; + } + + public void setYfze(double yfze) { + this.yfze = yfze; + } + + public double getGjgdtyjmje() { + return gjgdtyjmje; + } + + public void setGjgdtyjmje(double gjgdtyjmje) { + this.gjgdtyjmje = gjgdtyjmje; + } + + public double getGsqzd() { + return gsqzd; + } + + public void setGsqzd(double gsqzd) { + this.gsqzd = gsqzd; + } + + public double getSb() { + return sb; + } + + public void setSb(double sb) { + this.sb = sb; + } + + public double getGjj() { + return gjj; + } + + public void setGjj(double gjj) { + this.gjj = gjj; + } + + public double getZxfjkc() { + return zxfjkc; + } + + public void setZxfjkc(double zxfjkc) { + this.zxfjkc = zxfjkc; + } + + public double getYfqddqtkc() { + return yfqddqtkc; + } + + public void setYfqddqtkc(double yfqddqtkc) { + this.yfqddqtkc = yfqddqtkc; + } + + public double getYnssd() { + return ynssd; + } + + public void setYnssd(double ynssd) { + this.ynssd = ynssd; + } + + public double getLjsr() { + return ljsr; + } + + public void setLjsr(double ljsr) { + this.ljsr = ljsr; + } + + public double getLjmssrgjtyjmje() { + return ljmssrgjtyjmje; + } + + public void setLjmssrgjtyjmje(double ljmssrgjtyjmje) { + this.ljmssrgjtyjmje = ljmssrgjtyjmje; + } + + public double getLjjcfy() { + return ljjcfy; + } + + public void setLjjcfy(double ljjcfy) { + this.ljjcfy = ljjcfy; + } + + public double getLjzxkcsb() { + return ljzxkcsb; + } + + public void setLjzxkcsb(double ljzxkcsb) { + this.ljzxkcsb = ljzxkcsb; + } + + public double getLjzxkcgjj() { + return ljzxkcgjj; + } + + public void setLjzxkcgjj(double ljzxkcgjj) { + this.ljzxkcgjj = ljzxkcgjj; + } + + public double getLjzxfjkc() { + return ljzxfjkc; + } + + public void setLjzxfjkc(double ljzxfjkc) { + this.ljzxfjkc = ljzxfjkc; + } + + public double getLjyfqddqtkc() { + return ljyfqddqtkc; + } + + public void setLjyfqddqtkc(double ljyfqddqtkc) { + this.ljyfqddqtkc = ljyfqddqtkc; + } + + public double getLjykyjynssde() { + return ljykyjynssde; + } + + public void setLjykyjynssde(double ljykyjynssde) { + this.ljykyjynssde = ljykyjynssde; + } + + public double getSl() { + return sl; + } + + public void setSl(double sl) { + this.sl = sl; + } + + public double getSskcs() { + return sskcs; + } + + public void setSskcs(double sskcs) { + this.sskcs = sskcs; + } + + public double getLjjmsecjr80s() { + return ljjmsecjr80s; + } + + public void setLjjmsecjr80s(double ljjmsecjr80s) { + this.ljjmsecjr80s = ljjmsecjr80s; + } + + public double getLjyykyjse() { + return ljyykyjse; + } + + public void setLjyykyjse(double ljyykyjse) { + this.ljyykyjse = ljyykyjse; + } + + public double getBqyykjse() { + return bqyykyjse; + } + + public void setBqyykjse(double bqyykjse) { + this.bqyykyjse = bqyykjse; + } + + public double getBqyykyjsedyyj() { + return bqyykyjsedyyj; + } + + public void setBqyykyjsedyyj(double bqyykyjsedyyj) { + this.bqyykyjsedyyj = bqyykyjsedyyj; + } +} diff --git a/src/com/engine/qdhx/entity/TaxRateNoResidentEntity.java b/src/com/engine/qdhx/entity/TaxRateNoResidentEntity.java new file mode 100644 index 0000000..873c6df --- /dev/null +++ b/src/com/engine/qdhx/entity/TaxRateNoResidentEntity.java @@ -0,0 +1,189 @@ +package com.engine.qdhx.entity; + +/** + * @Author weaver_cl + * @Description: TODO + * @Date 2022/3/3 + * @Version V1.0 + **/ +public class TaxRateNoResidentEntity { + + private Integer id; + + private String workcode; + + private String xzszny; //薪资所属年月 + + private double yfgz; // 应发工资 + + private double jbylbxj; //基本养老保险金 + + private double zfgjj; //住房公积金 + + private double qtmssd; //其他免税所得 + + private double yssre; //应税收入额 + + private double fykcbz; //费用扣除标准 + + private double ynssde; //应纳税所得额 + + private double sl; //税率 + + private double sskcs; //速算扣除数 + + private double ynse; //应纳税额 + + private double jmse; //减免税额 + + private double sjynse; //实际应纳税额 + + private double shyx; //税后月薪 + + public TaxRateNoResidentEntity(Integer id, String workcode, String xzszny, double yfgz, double jbylbxj, double zfgjj, double qtmssd, double yssre, double fykcbz, double ynssde, double sl, double sskcs, double ynse, double jmse, double sjynse, double shyx) { + this.id = id; + this.workcode = workcode; + this.xzszny = xzszny; + this.yfgz = yfgz; + this.jbylbxj = jbylbxj; + this.zfgjj = zfgjj; + this.qtmssd = qtmssd; + this.yssre = yssre; + this.fykcbz = fykcbz; + this.ynssde = ynssde; + this.sl = sl; + this.sskcs = sskcs; + this.ynse = ynse; + this.jmse = jmse; + this.sjynse = sjynse; + this.shyx = shyx; + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getWorkcode() { + return workcode; + } + + public void setWorkcode(String workcode) { + this.workcode = workcode; + } + + public String getXzszny() { + return xzszny; + } + + public void setXzszny(String xzszny) { + this.xzszny = xzszny; + } + + public double getYfgz() { + return yfgz; + } + + public void setYfgz(double yfgz) { + this.yfgz = yfgz; + } + + public double getJbylbxj() { + return jbylbxj; + } + + public void setJbylbxj(double jbylbxj) { + this.jbylbxj = jbylbxj; + } + + public double getZfgjj() { + return zfgjj; + } + + public void setZfgjj(double zfgjj) { + this.zfgjj = zfgjj; + } + + public double getQtmssd() { + return qtmssd; + } + + public void setQtmssd(double qtmssd) { + this.qtmssd = qtmssd; + } + + public double getYssre() { + return yssre; + } + + public void setYssre(double yssre) { + this.yssre = yssre; + } + + public double getFykcbz() { + return fykcbz; + } + + public void setFykcbz(double fykcbz) { + this.fykcbz = fykcbz; + } + + public double getYnssde() { + return ynssde; + } + + public void setYnssde(double ynssde) { + this.ynssde = ynssde; + } + + public double getSl() { + return sl; + } + + public void setSl(double sl) { + this.sl = sl; + } + + public double getSskcs() { + return sskcs; + } + + public void setSskcs(double sskcs) { + this.sskcs = sskcs; + } + + public double getYnse() { + return ynse; + } + + public void setYnse(double ynse) { + this.ynse = ynse; + } + + public double getJmse() { + return jmse; + } + + public void setJmse(double jmse) { + this.jmse = jmse; + } + + public double getSjynse() { + return sjynse; + } + + public void setSjynse(double sjynse) { + this.sjynse = sjynse; + } + + public double getShyx() { + return shyx; + } + + public void setShyx(double shyx) { + this.shyx = shyx; + } +} diff --git a/src/com/engine/qdhx/entity/TaxTableEntity.java b/src/com/engine/qdhx/entity/TaxTableEntity.java new file mode 100644 index 0000000..eb81367 --- /dev/null +++ b/src/com/engine/qdhx/entity/TaxTableEntity.java @@ -0,0 +1,94 @@ +package com.engine.qdhx.entity; + +/** + * @Author weaver_cl + * @Description: TODO + * @Date 2022/3/2 + * @Version V1.0 + **/ +public class TaxTableEntity { + + private double qzd; //起征点 + + private int ljykyjynssde; //累加预扣预缴应纳税所得额 + + private double ysl; //预税率(%) + + private double sskcs; //速算扣除数 + + private int sxzt; //生效状态 + + private String bz; //备注 + + public TaxTableEntity() { + } + + public TaxTableEntity(double qzd, Integer ljykyjynssde, double ysl, double sskcs, Integer sxzt, String bz) { + this.qzd = qzd; + this.ljykyjynssde = ljykyjynssde; + this.ysl = ysl; + this.sskcs = sskcs; + this.sxzt = sxzt; + this.bz = bz; + } + + public double getQzd() { + return qzd; + } + + public void setQzd(double qzd) { + this.qzd = qzd; + } + + public int getLjykyjynssde() { + return ljykyjynssde; + } + + public void setLjykyjynssde(int ljykyjynssde) { + this.ljykyjynssde = ljykyjynssde; + } + + public double getYsl() { + return ysl; + } + + public void setYsl(double ysl) { + this.ysl = ysl; + } + + public double getSskcs() { + return sskcs; + } + + public void setSskcs(double sskcs) { + this.sskcs = sskcs; + } + + public int getSxzt() { + return sxzt; + } + + public void setSxzt(int sxzt) { + this.sxzt = sxzt; + } + + public String getBz() { + return bz; + } + + public void setBz(String bz) { + this.bz = bz; + } + + @Override + public String toString() { + return "TaxTableEntity{" + + "qzd=" + qzd + + ", ljykyjynssde=" + ljykyjynssde + + ", ysl=" + ysl + + ", sskcs=" + sskcs + + ", sxzt=" + sxzt + + ", bz='" + bz + '\'' + + '}'; + } +} diff --git a/src/com/engine/qdhx/entity/TaxTableNoResidentEntity.java b/src/com/engine/qdhx/entity/TaxTableNoResidentEntity.java new file mode 100644 index 0000000..871e668 --- /dev/null +++ b/src/com/engine/qdhx/entity/TaxTableNoResidentEntity.java @@ -0,0 +1,56 @@ +package com.engine.qdhx.entity; + +/** + * @Author weaver_cl + * @Description: TODO + * @Date 2022/3/3 + * @Version V1.0 + **/ +public class TaxTableNoResidentEntity { + + private int ynssde; + + private double sl; + + private double sskcs; + + + public TaxTableNoResidentEntity(int ynssde, double sl, double sskcs) { + this.ynssde = ynssde; + this.sl = sl; + this.sskcs = sskcs; + } + + public int getYnssde() { + return ynssde; + } + + public void setYnssde(int ynssde) { + this.ynssde = ynssde; + } + + public double getSl() { + return sl; + } + + public void setSl(double sl) { + this.sl = sl; + } + + public double getSskcs() { + return sskcs; + } + + public void setSskcs(double sskcs) { + this.sskcs = sskcs; + } + + @Override + public String toString() { + return "TaxTableNoResidentEntity{" + + "ynssde=" + ynssde + + ", sl=" + sl + + ", sskcs=" + sskcs + + '}'; + } +} diff --git a/src/com/engine/qdhx/enums/DateTypeEnum.java b/src/com/engine/qdhx/enums/DateTypeEnum.java new file mode 100644 index 0000000..7a83848 --- /dev/null +++ b/src/com/engine/qdhx/enums/DateTypeEnum.java @@ -0,0 +1,14 @@ +package com.engine.qdhx.enums; + + +/** + * @Author weaver_cl + * @Description: TODO + * @Date 2022/3/2 + * @Version V1.0 + **/ +public enum DateTypeEnum { + + THISYEAR,LASTYEAR,THISMONTH,LASTMONTH + +} diff --git a/src/com/engine/qdhx/service/HrmSalaryDiffReportService.java b/src/com/engine/qdhx/service/HrmSalaryDiffReportService.java new file mode 100644 index 0000000..2372e23 --- /dev/null +++ b/src/com/engine/qdhx/service/HrmSalaryDiffReportService.java @@ -0,0 +1,36 @@ +package com.engine.qdhx.service; + + +import java.util.Map; + +/** + * @Author weaver_cl + * @Description: TODO + * @Date 2022/2/16 + * @Version V1.0 + **/ + +public interface HrmSalaryDiffReportService { + + + /** + * 查询条件 + * @param params + * @return + */ + Map getSearchCondition(Map params); + + /** + * 获取报表数据 + * @param params + * @return + */ + Map getReportData(Map params); + + /** + * 保存报表数据 + * @param request2Map + * @return + */ + Map saveReportData(Map request2Map); +} diff --git a/src/com/engine/qdhx/service/Impl/AddSalaryStrategy.java b/src/com/engine/qdhx/service/Impl/AddSalaryStrategy.java new file mode 100644 index 0000000..a58490b --- /dev/null +++ b/src/com/engine/qdhx/service/Impl/AddSalaryStrategy.java @@ -0,0 +1,22 @@ +package com.engine.qdhx.service.impl; + +import com.engine.qdhx.service.SalaryStrategy; + +import java.math.BigDecimal; + +/** + * @Author weaver_cl + * @Description: TODO + * @Date 2022/2/21 + * @Version V1.0 + **/ +public class AddSalaryStrategy implements SalaryStrategy { + @Override + public double doSalaryDiff(double ...num) { + double sum = 0; + for (double value : num ) { + sum = new BigDecimal(Double.toString(sum)).add(new BigDecimal(Double.toString(value))).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); + } + return sum; + } +} diff --git a/src/com/engine/qdhx/service/Impl/DivisionSalaryStrategy.java b/src/com/engine/qdhx/service/Impl/DivisionSalaryStrategy.java new file mode 100644 index 0000000..fc4a657 --- /dev/null +++ b/src/com/engine/qdhx/service/Impl/DivisionSalaryStrategy.java @@ -0,0 +1,22 @@ +package com.engine.qdhx.service.impl; + +import com.engine.qdhx.service.SalaryStrategy; + +import java.math.BigDecimal; + +/** + * @Author weaver_cl + * @Description: TODO + * @Date 2022/2/28 + * @Version V1.0 + **/ +public class DivisionSalaryStrategy implements SalaryStrategy { + @Override + public double doSalaryDiff(double... num) { + double sum = num[0]; + for(int i = 1; i < num.length; i++) { + sum = new BigDecimal(Double.toString(sum)).divide(new BigDecimal(Double.toString(num[i])),20,BigDecimal.ROUND_HALF_UP).setScale(2,BigDecimal.ROUND_HALF_UP).doubleValue(); + } + return sum; + } +} diff --git a/src/com/engine/qdhx/service/Impl/HrmSalaryDiffReportServiceImpl.java b/src/com/engine/qdhx/service/Impl/HrmSalaryDiffReportServiceImpl.java new file mode 100644 index 0000000..de1f805 --- /dev/null +++ b/src/com/engine/qdhx/service/Impl/HrmSalaryDiffReportServiceImpl.java @@ -0,0 +1,36 @@ +package com.engine.qdhx.service.impl; + + +import com.engine.core.impl.Service; +import com.engine.qdhx.cmd.HrmSalaryDiffReportCmd; +import com.engine.qdhx.cmd.HrmSalaryDiffReportConditionCmd; +import com.engine.qdhx.cmd.HrmSalarySaveReportCmd; +import com.engine.qdhx.service.HrmSalaryDiffReportService; + +import java.util.Map; + +/** + * @Author weaver_cl + * @Description: TODO + * @Date 2022/2/16 + * @Version V1.0 + **/ +public class HrmSalaryDiffReportServiceImpl extends Service implements HrmSalaryDiffReportService { + + + + @Override + public Map getSearchCondition(Map params) { + return commandExecutor.execute(new HrmSalaryDiffReportConditionCmd(user,params)); + } + + @Override + public Map getReportData(Map params) { + return commandExecutor.execute(new HrmSalaryDiffReportCmd(user,params)); + } + + @Override + public Map saveReportData(Map params) { + return commandExecutor.execute(new HrmSalarySaveReportCmd(user,params)); + } +} diff --git a/src/com/engine/qdhx/service/Impl/MultiplySalaryStrategy.java b/src/com/engine/qdhx/service/Impl/MultiplySalaryStrategy.java new file mode 100644 index 0000000..072112e --- /dev/null +++ b/src/com/engine/qdhx/service/Impl/MultiplySalaryStrategy.java @@ -0,0 +1,22 @@ +package com.engine.qdhx.service.impl; + +import com.engine.qdhx.service.SalaryStrategy; + +import java.math.BigDecimal; + +/** + * @Author weaver_cl + * @Description: TODO + * @Date 2022/2/28 + * @Version V1.0 + **/ +public class MultiplySalaryStrategy implements SalaryStrategy { + @Override + public double doSalaryDiff(double... num) { + double sum = num[0]; + for(int i = 1; i < num.length; i++) { + sum = new BigDecimal(Double.toString(sum)).multiply(new BigDecimal(Double.toString(num[i]))).setScale(2,BigDecimal.ROUND_HALF_UP).doubleValue(); + } + return sum; + } +} diff --git a/src/com/engine/qdhx/service/Impl/SubtractionSalaryStrategy.java b/src/com/engine/qdhx/service/Impl/SubtractionSalaryStrategy.java new file mode 100644 index 0000000..1f4ee14 --- /dev/null +++ b/src/com/engine/qdhx/service/Impl/SubtractionSalaryStrategy.java @@ -0,0 +1,23 @@ +package com.engine.qdhx.service.impl; + +import com.engine.qdhx.service.SalaryStrategy; + +import java.math.BigDecimal; + +/** + * @Author weaver_cl + * @Description: TODO + * @Date 2022/2/21 + * @Version V1.0 + **/ +public class SubtractionSalaryStrategy implements SalaryStrategy { + + @Override + public double doSalaryDiff(double ...num) { + double sum = num[0]; + for(int i = 1; i < num.length; i++) { + sum = new BigDecimal(Double.toString(sum)).subtract(new BigDecimal(Double.toString(num[i]))).setScale(2,BigDecimal.ROUND_HALF_UP).doubleValue(); + } + return sum; + } +} diff --git a/src/com/engine/qdhx/service/SalaryStrategy.java b/src/com/engine/qdhx/service/SalaryStrategy.java new file mode 100644 index 0000000..ee62bd1 --- /dev/null +++ b/src/com/engine/qdhx/service/SalaryStrategy.java @@ -0,0 +1,13 @@ +package com.engine.qdhx.service; + +/** + * @Author weaver_cl + * @Description: TODO 策略计算 + * @Date 2022/2/21 + * @Version V1.0 + **/ +public interface SalaryStrategy { + + double doSalaryDiff(double ...num); + +} diff --git a/src/com/engine/qdhx/util/SalaryUtil.java b/src/com/engine/qdhx/util/SalaryUtil.java new file mode 100644 index 0000000..c33f5b7 --- /dev/null +++ b/src/com/engine/qdhx/util/SalaryUtil.java @@ -0,0 +1,737 @@ +package com.engine.qdhx.util; + +import com.engine.kq.biz.KQLeaveRulesComInfo; +import com.engine.kq.biz.KQOvertimeRulesBiz; +import com.engine.kq.enums.KqSplitFlowTypeEnum; +import com.engine.kq.util.KQDurationCalculatorUtil; +import com.engine.qdhx.entity.Context; +import com.engine.qdhx.service.impl.AddSalaryStrategy; +import com.engine.qdhx.service.impl.DivisionSalaryStrategy; +import com.engine.qdhx.service.impl.MultiplySalaryStrategy; +import com.engine.qdhx.service.impl.SubtractionSalaryStrategy; +import lombok.SneakyThrows; +import weaver.conn.RecordSet; +import weaver.general.BaseBean; +import weaver.general.Util; + +import java.math.BigDecimal; +import java.text.DecimalFormat; +import java.text.SimpleDateFormat; +import java.time.LocalDate; +import java.time.format.DateTimeFormatter; +import java.util.*; +import java.util.stream.Collectors; +import java.util.stream.Stream; + + +/** + * @Author weaver_cl + * @Description: TODO + * @Date 2022/2/21 + * @Version V1.0 + **/ +public class SalaryUtil extends BaseBean { + + private static final String SCOPE = "HrmCustomFieldByInfoType"; + + private static final Integer SCOPEID = -1; + + private static final Integer SCOPEID2 = 1; + + private static final Integer TAXFIELDID = 4; + + private static final double AVERAGE = 21.75; + + private static DecimalFormat df = new DecimalFormat("0.00"); + + + + /** + * 获取处名称 + * @param id + * @return + */ + public static String getPlaceById(String id) { + RecordSet rs = new RecordSet(); + rs.executeQuery("select field1 from cus_fielddata where " + + "scope = ? and scopeid = ? and id = ?",SCOPE,SCOPEID,id); + + return rs.next()?Util.null2String(rs.getString("field1")):""; + + } + + /** + * 获取费用代码 + * @param id + * @return + */ + public static String getCostcodeById(String id) { + RecordSet rs = new RecordSet(); + rs.executeQuery("select field3 from cus_fielddata where " + + "scope = ? and scopeid = ? and id = ?",SCOPE,SCOPEID,id); + + return rs.next()?Util.null2String(rs.getString("field3")):""; + + } + + /** + * 获取税务身份 + * @param id + * @return + */ + public static String getTaxidById(String id) { + RecordSet rs = new RecordSet(); + rs.executeQuery("select field4 from cus_fielddata where " + + "scope = ? and scopeid = ? and id = ?",SCOPE,SCOPEID2,id); + + return rs.next()?rs.getString("field4"):""; + } + + + /** + * 获取税务身份真实值 + * @param selectvalue + * @return + */ + public static String getTaxName(String selectvalue) { + RecordSet rs = new RecordSet(); + rs.executeQuery("select selectname from cus_selectitem where fieldid = ?" + + " and selectvalue = ?",TAXFIELDID,selectvalue); + String selectname = ""; + if (rs.next()) { + selectname = Util.null2String(rs.getString("selectname")); + } + return selectname; + } + + + /** + * 获取基本工资 + * @param id + * @return + */ + public static Double getBasicSalary(String id) { + RecordSet rs = new RecordSet(); + rs.executeQuery("select field6 from cus_fielddata where " + + "scope = ? and scopeid = ? and id = ?",SCOPE,SCOPEID2,id); + rs.next(); + return getDoubleValue(rs.getString("field6"),0.00); + } + + /** + * 获取固定加班费 + * @param id + * @return + */ + public static Double getOvertimePay(String id) { + RecordSet rs = new RecordSet(); + rs.executeQuery("select field5 from cus_fielddata where " + + "scope = ? and scopeid = ? and id = ?",SCOPE,SCOPEID2,id); + rs.next(); + return getDoubleValue(rs.getString("field5"),0.00); + } + + /** + * 获取中国农业银行账户 + * @param id + * @return + */ + public static String getBankAccount(String id) { + RecordSet rs = new RecordSet(); + rs.executeQuery("select field29 from cus_fielddata where " + + "scope = ? and scopeid = ? and id = ?",SCOPE,SCOPEID2,id); + String bankAccount = ""; + if(rs.next()) { + bankAccount = Util.null2String(rs.getString("field29")); + } + return bankAccount; + } + + /** + * 判断日期存在日期区间 + * @param startDate + * @param endDate + * @param date + * @return + */ + public static boolean dateInterval(String startDate,String endDate,String date){ + try { + if (date.length()<=0){ + return false; + } + LocalDate start = LocalDate.parse(startDate, DateTimeFormatter.ofPattern("yyyy-MM-dd")); + LocalDate end = LocalDate.parse(endDate, DateTimeFormatter.ofPattern("yyyy-MM-dd")); + LocalDate now = LocalDate.parse(date, DateTimeFormatter.ofPattern("yyyy-MM-dd")); + return now.isAfter(start) && now.isBefore(end); + }catch (Exception e) { + e.printStackTrace(); + return false; + } + } + + + + /** + * 获取建模(uf_flxm)福利项目数据 + * @param workcode + * @return + */ + public static Map welfareTable(String workcode){ + RecordSet cube = new RecordSet(); + Map welfare = new HashMap<>(); + cube.executeQuery("select birthdayCashgift,merryCashgift,funeralCashgift,festivalCashgift,preventHeatAllowance," + + " highTemperatureSubsidy,communicatySubsidy,shiftAllowance,standAllowance," + + " achievementonus,abroadInsuranceSubsidy,otherItem1,otherItem2,houseSubsidy from uf_flxm where workcode = ?",workcode); + + List welfareList = Stream.of("birthdayCashgift","merryCashgift","funeralCashgift","festivalCashgift", + "preventHeatAllowance","highTemperatureSubsidy","communicatySubsidy","shiftAllowance", + "standAllowance","achievementonus","abroadInsuranceSubsidy","otherItem1","otherItem2","houseSubsidy").collect(Collectors.toList()); + if (cube.next()){ + welfareList.forEach(field -> { + welfare.put(field,getDoubleValue(cube.getString(field),0.00)); + }); + } + + return welfare; + } + + + /** + * 高温和防暑补贴 + * @param day + * @param money + * @return + */ + public static double heatAndTemperatureAllowance (double day,double money){ + Context context = new Context(); + context.setSalaryStrategy(new DivisionSalaryStrategy()); + money = context.execute(money,AVERAGE); + context.setSalaryStrategy( new MultiplySalaryStrategy()); + double value = context.execute(money,day); + return value; + } + + /** + * 获取建模(uf_jj)奖金数据 + * @param workcode + * @return + */ + public static Map bonusTable(String workcode){ + RecordSet cube = new RecordSet(); + Map bonus = new HashMap<>(); + cube.executeQuery("select specialAward,signMoney,meritsPay,annualBonus,ompensation from uf_jj where workcode = ?",workcode); + if (cube.next()){ + List bonusList = Stream.of("specialAward","signMoney","meritsPay","annualBonus","ompensation").collect(Collectors.toList()); + bonusList.forEach(field -> { + bonus.put(field,getDoubleValue(cube.getString(field),0.00)); + }); + } + + return bonus; + } + + /** + * 获取建模(uf_gzjx)扣款数据 + * @param workcode + * @return + */ + public static Map reduceTable(String workcode){ + RecordSet cube = new RecordSet(); + Map reduce = new HashMap<>(); + cube.executeQuery("select otherDeduction,costWithhold,mealWithhold from uf_gzjx where workcode = ?",workcode); + if(cube.next()) { + List reduceList = Stream.of("otherDeduction","costWithhold","mealWithhold").collect(Collectors.toList()); + reduceList.forEach(field -> { + reduce.put(field,getDoubleValue(cube.getString(field),0.00)); + }); + } + + return reduce; + } + + /** + * 判断端午中秋是否在指定日期 + * @param startDate + * @param endDate + * @return + */ + public static boolean judgeHoliday(String startDate,String endDate) { + RecordSet rs = new RecordSet(); + boolean result = false; + List linkList = new LinkedList<>(); + rs.executeQuery("select MIN(holidayDate) as holidaydate,holidayDesc from KQ_HolidaySet where holidaydesc in ('端午节','中秋节') group by holidaydesc"); + while (rs.next()) { + String holidaydate = Util.null2String(rs.getString("holidaydate")); + linkList.add(holidaydate); + } + for(String date : linkList){ + result = dateInterval(startDate,endDate,date); + if (result) break; + } + return result; + } + + /** + * 加班金额计算 G1(工作日)=加班时数*人民币基本工资/21.75/8*1.5 + * @param basicSalary + * @param hour + * @param type + * @return + */ + public static double overTimeWorkMoney(double basicSalary, String hour,String type) { + BigDecimal salary = new BigDecimal(String.valueOf(basicSalary)); + BigDecimal day = new BigDecimal("21.75"); + BigDecimal hours = new BigDecimal("8"); + BigDecimal hourBig = new BigDecimal(hour); + BigDecimal times = new BigDecimal(type); + return (hourBig.multiply(salary.divide(day,20,BigDecimal.ROUND_HALF_UP) + .divide(hours,20,BigDecimal.ROUND_HALF_UP).multiply(times))).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); + } + + + /** + * 获取考勤信息 + * @param startDate + * @param endDate + * @param resourceid + * @return + */ + public static Map getKqInfo(String startDate,String endDate,String resourceid){ + RecordSet rs = new RecordSet(); + Map kqMap = new HashMap<>(); + rs.executeQuery("select sum(workdays) as workdays, sum(attendancedays) as attendancedays," + + " sum(absenteeismmins) as absenteeismmins," + + " sum(belatemins) as belatemins,sum(leaveearlymins) as leaveearlymins from kq_format_total where " + + " resourceid = ? and kqdate >= ? and kqdate <= ?",resourceid,startDate,endDate); + if (rs.next()){ + double workdays = getDoubleValue(rs.getString("workdays"),0); + double attendancedays = getDoubleValue(rs.getString("attendancedays"),0); + //旷工时长 (分钟) + double absenteeismmins = getDoubleValue(rs.getString("absenteeismmins"),0); + //迟到时长(分钟) + double belatemins = getDoubleValue(rs.getString("belatemins"),0); + //早退时长 (分钟) + double leaveearlymins = getDoubleValue(rs.getString("leaveearlymins"),0); + + Context context = new Context(); + //context.setSalaryStrategy(new SubtractionSalaryStrategy()); + //double mins = context.execute(absenteeismmins,belatemins,leaveearlymins); + context.setSalaryStrategy(new DivisionSalaryStrategy()); + + //请假未归档天数(不扣款) --换算成天 + double leavedays = context.execute(absenteeismmins,480); + + kqMap.put("workdays",workdays); + kqMap.put("attendancedays",attendancedays); + kqMap.put("leavedays",leavedays); + } + + + return kqMap; + } + + + /** + * 考勤扣款(缺勤天数*日薪) + * @param money + * @param workdays + * @param attendancedays + * @return + */ + public static double attendanceDeduction(double money,double workdays,double attendancedays) { + if (new BigDecimal(workdays).equals(BigDecimal.ZERO)){ + return 0; + } + Context context = new Context(); + context.setSalaryStrategy(new SubtractionSalaryStrategy()); + double day = context.execute(workdays,attendancedays); + day = day>0?day:0; + context.setSalaryStrategy(new DivisionSalaryStrategy()); + money = context.execute(money,workdays); + context.setSalaryStrategy(new MultiplySalaryStrategy()); + money = context.execute(money,day); + return money; + } + + /** + * 获取加班时长(工作日,双休,节假日) (薪资月) + * @param fromDate + * @param toDate + * @param params + * @return + */ + public static Map getFlowOverTimeDataNew(String fromDate,String toDate,Map params) { + Map overTime = new HashMap<>(); + BaseBean bb = new BaseBean(); + RecordSet rst = new RecordSet(); + try { + KQOvertimeRulesBiz kqOvertimeRulesBiz = new KQOvertimeRulesBiz(); + + String sqlWhere = " "; + if(params.get("subcompanyid1").length()>0){ + sqlWhere +=" and a.subcompanyid1 in("+params.get("subcompanyid1")+") "; + } + + if(params.get("departmentid").length()>0){ + sqlWhere +=" and a.departmentid in("+params.get("departmentid")+") "; + } + + if(params.get("id").length()>0){ + sqlWhere +=" and a.id in("+params.get("id")+") "; + } + + int uintType = KQOvertimeRulesBiz.getMinimumUnit();//当前加班单位 + double hoursToDay = KQOvertimeRulesBiz.getHoursToDay();//当前天跟小时计算关系 + + String sql = " select resourceid,changeType, sum(cast(duration_min as decimal(18,4))) as val,paidLeaveEnable "+ + " from hrmresource a, kq_flow_overtime b "+ + " where a.id = b.resourceid and belongdate >='"+fromDate+"' and belongdate <='"+toDate+"' " +sqlWhere+ + " group by resourceid,changeType,paidLeaveEnable"; + rst.executeQuery(sql); + while (rst.next()) { + String resourceid = rst.getString("resourceid"); + String paidLeaveEnable = rst.getString("paidLeaveEnable"); + int changeType =rst.getInt("changeType");//1-节假日、2-工作日、3-休息日 + double value = rst.getDouble("val")<0?0:rst.getDouble("val"); + if(uintType==3 || uintType== 5 || uintType== 6){//按小时计算 + value = Util.getDoubleValue(KQDurationCalculatorUtil.getDurationRound(value/(60.0)+"")); + }else{//按天计算 + value = Util.getDoubleValue(KQDurationCalculatorUtil.getDurationRound(value/(60.0*hoursToDay)+"")); + } + String flowType = ""; + if(changeType==1){ + flowType = "holidayOvertime"; + }else if(changeType==2){ + flowType = "workingDayOvertime"; + }else if(changeType==3){ + flowType = "restDayOvertime"; + } + if("1".equalsIgnoreCase(paidLeaveEnable)){ + //1表示关联调休 + flowType += "_4leave"; + }else{ + //0表示不关联调休 + flowType += "_nonleave"; + } + String key = resourceid+"|"+flowType; + //df.format 默认是不四舍五入的 0.125这样的就会直接变成0.12了 + df.setMaximumFractionDigits(5); + if(overTime.containsKey(key)){ + double tmpVal = Util.getDoubleValue(Util.null2String(overTime.get(key)),0.0); + tmpVal += value; + overTime.put(key,df.format(tmpVal)); + }else{ + overTime.put(key,df.format(value)); + } + + } + + }catch (Exception e) { + e.printStackTrace(); + } + + + return overTime; + } + + /** + * 获取加班时长(工作日,双休,节假日) (薪资上月未结算的加班) + * @param fromDate + * @param toDate + * @param params + * @return + */ + public static Map getLastFlowOverTimeData(String fromDate,String toDate,Map params) { + Map overTime = new HashMap<>(); + RecordSet rst = new RecordSet(); + try { + KQOvertimeRulesBiz kqOvertimeRulesBiz = new KQOvertimeRulesBiz(); + fromDate = getSameDay(fromDate); + toDate = getSameDay(toDate); + DateTimeFormatter fmt = DateTimeFormatter.ofPattern("yyyy-MM-dd"); + LocalDate start = LocalDate.parse(fromDate, DateTimeFormatter.ofPattern("yyyy-MM-dd")); + //薪资结算日期 + String settlementDate = LocalDate.of(start.getYear(), start.getMonth(), 6).format(fmt); + + String sqlWhere = " "; + if(params.get("subcompanyid1").length()>0){ + sqlWhere +=" and a.subcompanyid1 in("+params.get("subcompanyid1")+") "; + } + + if(params.get("departmentid").length()>0){ + sqlWhere +=" and a.departmentid in("+params.get("departmentid")+") "; + } + + if(params.get("id").length()>0){ + sqlWhere +=" and a.id in("+params.get("id")+") "; + } + + int uintType = kqOvertimeRulesBiz.getMinimumUnit();//当前加班单位 + double hoursToDay = kqOvertimeRulesBiz.getHoursToDay();//当前天跟小时计算关系 + + String sql = "SELECT b.requestid,b.resourceid,b.changeType,sum(cast(b.duration_min AS DECIMAL ( 18, 4 ))) AS val,b.paidLeaveEnable " + + " FROM kq_flow_overtime b " + + " INNER JOIN hrmresource a ON a.id = b.resourceid and b.belongdate >='"+fromDate+"' and b.belongdate <='"+toDate+"' " +sqlWhere+ + " LEFT JOIN workflow_requestbase c on b.requestid = c.requestid and c.currentnodetype = 3" + + " and c.lastoperatedate >= '"+settlementDate+"'" + + " group by resourceid,changeType,paidLeaveEnable,b.requestid"; + rst.executeQuery(sql); + while (rst.next()) { + String resourceid = rst.getString("resourceid"); + String paidLeaveEnable = rst.getString("paidLeaveEnable"); + int changeType =rst.getInt("changeType");//1-节假日、2-工作日、3-休息日 + double value = rst.getDouble("val")<0?0:rst.getDouble("val"); + if(uintType==3 || uintType== 5 || uintType== 6){//按小时计算 + value = Util.getDoubleValue(KQDurationCalculatorUtil.getDurationRound(value/(60.0)+"")); + }else{//按天计算 + value = Util.getDoubleValue(KQDurationCalculatorUtil.getDurationRound(value/(60.0*hoursToDay)+"")); + } + String flowType = ""; + if(changeType==1){ + flowType = "holidayOvertime"; + }else if(changeType==2){ + flowType = "workingDayOvertime"; + }else if(changeType==3){ + flowType = "restDayOvertime"; + } + if("1".equalsIgnoreCase(paidLeaveEnable)){ + //1表示关联调休 + flowType += "_4leave"; + }else{ + //0表示不关联调休 + flowType += "_nonleave"; + } + String key = resourceid+"|"+flowType; + //df.format 默认是不四舍五入的 0.125这样的就会直接变成0.12了 + df.setMaximumFractionDigits(5); + if(overTime.containsKey(key)){ + double tmpVal = Util.getDoubleValue(Util.null2String(overTime.get(key)),0.0); + tmpVal += value; + overTime.put(key,df.format(tmpVal)); + }else{ + overTime.put(key,df.format(value)); + } + + } + + }catch (Exception e) { + e.printStackTrace(); + } + + + return overTime; + } + + + /** + * 获取请假数据 + * @param params + * @return + */ + public static Map getFlowLeaveData(String fromDate,String toDate,Map params){ + Map datas = new HashMap<>(); + RecordSet rs = new RecordSet(); + String sql = ""; + String sqlWhere = " "; + try{ + KQLeaveRulesComInfo kqLeaveRulesComInfo = new KQLeaveRulesComInfo(); + if(params.get("subcompanyid1").length()>0){ + sqlWhere +=" and a.subcompanyid1 in("+params.get("subcompanyid1")+") "; + } + + if(params.get("departmentid").length()>0){ + sqlWhere +=" and a.departmentid in("+params.get("departmentid")+") "; + } + + if(params.get("id").length()>0){ + sqlWhere +=" and a.id in("+params.get("id")+") "; + } + sql = " select resourceid, newleavetype, durationrule, sum(duration) as val from hrmresource a, "+ KqSplitFlowTypeEnum.LEAVE.getTablename()+" b "+ + " where a.id = b.resourceid and belongdate >='"+fromDate+"' and belongdate <='"+toDate+"' " +sqlWhere + + " group by resourceid, newleavetype, durationrule "; + rs.execute(sql); + while (rs.next()) { + String resourceid = rs.getString("resourceid"); + String newleavetype = rs.getString("newleavetype"); + String durationrule = rs.getString("durationrule"); + double value = rs.getDouble("val")<0?0:rs.getDouble("val"); + + double proportion = Util.getDoubleValue(kqLeaveRulesComInfo.getProportion(newleavetype)); +// if(isLeaveHour(newleavetype, kqLeaveRulesComInfo)){//按小时 +// if(!isLeaveHour(durationrule)){ +// if(proportion>0) value = value*proportion; +// } +// }else{//按天 +// if(isLeaveHour(durationrule)){ +// if(proportion>0) value = value/proportion; +// } +// } + + if (isLeaveHour(newleavetype,kqLeaveRulesComInfo)) { //按小时 + if (proportion>0) value = value/proportion; + } + + String key = resourceid+"|leaveType_"+newleavetype; + if(datas.containsKey(key)){ + value += Util.getDoubleValue(Util.null2String(datas.get(key))); + } + //df.format 默认是不四舍五入的 0.125这样的就会直接变成0.12了 + df.setMaximumFractionDigits(5); + datas.put(key,df.format(value)); + } + }catch (Exception e){ + e.printStackTrace(); + } + return datas; + } + + /** + * 请假数据换算工资 + * @param leaveData + * @param resourceid + * @return + */ + public static double conversionLeave(Map leaveData,String resourceid) { + double result = 0.00; + BaseBean bb = new BaseBean(); + //bb.writeLog(String.format("leave data %s",leaveData.toString())); + Context context = new Context(); + context.setSalaryStrategy(new AddSalaryStrategy()); + Context context1 = new Context(); + context.setSalaryStrategy(new MultiplySalaryStrategy()); + //leaveData.get(resourceid + "|leaveType_2");//事假无薪资 + //病假 70%薪资 医疗期 60% 薪资 剩余假期类型 全薪资 + result = context.execute(result,context1.execute(getDoubleValue(leaveData.get(resourceid + "|leaveType_3"),0),0.7), + context1.execute(getDoubleValue(leaveData.get(resourceid + "|leaveType_11"),0),0.6), + getDoubleValue(leaveData.get(resourceid + "|leaveType_4"),0), + getDoubleValue(leaveData.get(resourceid + "|leaveType_5"),0), + getDoubleValue(leaveData.get(resourceid + "|leaveType_6"),0), + getDoubleValue(leaveData.get(resourceid + "|leaveType_7"),0), + getDoubleValue(leaveData.get(resourceid + "|leaveType_8"),0), + getDoubleValue(leaveData.get(resourceid + "|leaveType_9"),0), + getDoubleValue(leaveData.get(resourceid + "|leaveType_10"),0), + getDoubleValue(leaveData.get(resourceid + "|leaveType_12"),0), + getDoubleValue(leaveData.get(resourceid + "|leaveType_13"),0), + getDoubleValue(leaveData.get(resourceid + "|leaveType_14"),0), + getDoubleValue(leaveData.get(resourceid + "|leaveType_15"),0), + getDoubleValue(leaveData.get(resourceid + "|leaveType_16"),0), + getDoubleValue(leaveData.get(resourceid + "|leaveType_17"),0), + getDoubleValue(leaveData.get(resourceid + "|leaveType_18"),0)); + + return result; + } + + /** + * 根据单位类型 判断请假是否是小时为单位 + * @param durationrule + * @return + */ + public static boolean isLeaveHour(String durationrule){ + if((durationrule.equals("2") || durationrule.equals("3") || durationrule.equals("9") + || durationrule.equals("11") || durationrule.equals("12") || durationrule.equals("14") + || durationrule.equals("16"))){ + return true; + } + return false; + } + + /** + * 根据请假类型 判断请假是否是小时为单位 + * @param newleavetype + * @param kqLeaveRulesComInfo + * @return + */ + public static boolean isLeaveHour(String newleavetype,KQLeaveRulesComInfo kqLeaveRulesComInfo){ + String durationrule = kqLeaveRulesComInfo.getMinimumUnit(newleavetype); + return isLeaveHour(durationrule); + } + + + + + + /** + * 获取double值 + * @param v + * @param def + * @return + */ + public static double getDoubleValue(String v, double def) { + try { + if (v != null && v.length()>0){ + return Double.parseDouble(v); + }else { + return def; + } + } catch (Exception e) { + return def; + } + } + + + /** + * 获取社保公积金 + * @param workcode + * @param xzszny + * @return + */ + public static Map getInsuranceAndProvident(String workcode,String xzszny){ + RecordSet cube = new RecordSet(); + Map insurance = new HashMap<>(); + cube.executeQuery("select ylgr16,sygr03,ylgr2,gjjgr5 from uf_wxyjftb where gh = ? and ny = ?",workcode,xzszny); + if (cube.next()) { + List reduceList = Stream.of("ylgr16","sygr03","ylgr2","gjjgr5").collect(Collectors.toList()); + reduceList.forEach(field -> { + insurance.put(field,getDoubleValue(cube.getString(field),0.00)); + }); + } + + return insurance; + } + + + + /** + * 比较第一个日期是否大于第二个日期 + * @param firstDate 第一个日期 + * @param secondDate 第二个日期 + * @return true-大于;false-不大于 + */ + public static boolean localDateIsBefore(String firstDate, String secondDate) { + if (secondDate.length()<=0 || "".equals(secondDate)){ + return false; + } + LocalDate first = LocalDate.parse(firstDate, DateTimeFormatter.ofPattern("yyyy-MM-dd")); + LocalDate second = LocalDate.parse(secondDate, DateTimeFormatter.ofPattern("yyyy-MM-dd")); + return first.isBefore(second); + } + + + /** + * 获取离职日期(作废) + * @param id + * @return + */ + public static String getDismissDate(String id) { + RecordSet rs = new RecordSet(); + rs.executeQuery("select dismissdate from bill_hrmdismiss where resource_n = ?",id); + rs.next(); + return Util.null2String(rs.getString("dismissdate")); + } + + /** + * 获取上个月同一天 + * @param date + * @return + */ + @SneakyThrows + public static String getSameDay(String date) { + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); + Calendar calendar = Calendar.getInstance(); + Date lastDate = dateFormat.parse(date); + calendar.setTime(lastDate); // 设置为当前时间 + calendar.set(Calendar.MONTH, calendar.get(Calendar.MONTH) - 1); // 设置为上一个月 + return dateFormat.format(calendar.getTime()); + } + +} diff --git a/src/com/engine/qdhx/util/TaxRateUtil.java b/src/com/engine/qdhx/util/TaxRateUtil.java new file mode 100644 index 0000000..b3d5b3f --- /dev/null +++ b/src/com/engine/qdhx/util/TaxRateUtil.java @@ -0,0 +1,121 @@ +package com.engine.qdhx.util; + +import com.engine.qdhx.entity.TaxTableEntity; +import com.engine.qdhx.entity.TaxTableNoResidentEntity; +import weaver.conn.RecordSet; +import weaver.general.Util; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +/** + * @Author weaver_cl + * @Description: TODO + * @Date 2022/3/2 + * @Version V1.0 + **/ +public class TaxRateUtil { + + //税率范围下拉框(居民) + private static final String FIELDID = "8190"; + //税率范围下拉框(非居民) + private static final String FIELDID1 = "8268"; + + + + /** + * 税率表获取(居民) + * @return + */ + public static List getTaxTable(){ + RecordSet rs = new RecordSet(); + List list = new ArrayList<>(); + rs.executeQuery("select qzd,ljykyjynssde,ysl,sskcs,sxzt,bz from uf_jmslb where sxzt = 0"); + while (rs.next()) { + double qzd = SalaryUtil.getDoubleValue(rs.getString("qzd"),0.00); + int ljykyjynssde = Util.getIntValue(rs.getString("ljykyjynssde")); + double ysl = Util.getDoubleValue(rs.getString("ysl")); + double sskcs = SalaryUtil.getDoubleValue(rs.getString("sskcs"),0.00); + int sxzt = Util.getIntValue(rs.getString("sxzt")); + String bz = Util.null2String(rs.getString("bz")); + TaxTableEntity taxTableEntity = new TaxTableEntity(qzd,ljykyjynssde,ysl,sskcs,sxzt,bz); + list.add(taxTableEntity); + } + return list; + } + + /** + * 税率表获取(非居民) + * @return + */ + public static List getTaxTableNR(){ + RecordSet rs = new RecordSet(); + List list = new ArrayList<>(); + rs.executeQuery("select ynssde,sl,sskcs from uf_fjmslb"); + while (rs.next()) { + int ynssde = Util.getIntValue(rs.getString("ynssde")); + double sl = Util.getDoubleValue(rs.getString("sl")); + double sskcs = SalaryUtil.getDoubleValue(rs.getString("sskcs"),0.00); + TaxTableNoResidentEntity taxTableNoResidentEntity = new TaxTableNoResidentEntity(ynssde,sl,sskcs); + list.add(taxTableNoResidentEntity); + } + return list; + } + + + + + /** + * 个人所得税自定义项目 + * @param workcode + * @param xzszny + * @return + */ + public static Map customTable(String workcode, String xzszny){ + RecordSet rs = new RecordSet(); + Map custom = new HashMap<>(); + rs.executeQuery("select gjgdtyjmje,zxfjkc,yfqddqtkc from uf_grsdszdy where gh = ? and szny = ?",workcode,xzszny); + rs.next(); + List bonusList = Stream.of("gjgdtyjmje","zxfjkc","yfqddqtkc","annualBonus","ompensation").collect(Collectors.toList()); + bonusList.forEach(field -> { + custom.put(field,SalaryUtil.getDoubleValue(rs.getString(field),0.00)); + }); + + return custom; + } + + /** + * 获取税率表范围 + * @param ljsr + * @return + */ + public static int getTaxSide(double ljsr,String taxId){ + RecordSet rs = new RecordSet(); + String fieldId = "0".equals(taxId) ? FIELDID : FIELDID1; + int side = 0; + rs.executeQuery("select selectvalue,selectname from workflow_SelectItem where fieldid = ?",fieldId); + while (rs.next()) { + int selectvalue = Util.getIntValue(rs.getString("selectvalue")); + String selectname = Util.null2String(rs.getString("selectname")); + if (selectname.contains("-")){ + double min = Double.valueOf(selectname.split("-")[0]); + double max = Double.valueOf(selectname.split("-")[1]); + if (ljsr>min && ljsr value){ + side = selectvalue; + break; + } + } + } + return side; + } +} diff --git a/src/com/engine/qdhx/web/HrmSalaryDiffReportAction.java b/src/com/engine/qdhx/web/HrmSalaryDiffReportAction.java new file mode 100644 index 0000000..a336a72 --- /dev/null +++ b/src/com/engine/qdhx/web/HrmSalaryDiffReportAction.java @@ -0,0 +1,106 @@ +package com.engine.qdhx.web; + +import com.alibaba.fastjson.JSONObject; +import com.alibaba.fastjson.serializer.SerializerFeature; +import com.engine.common.util.ParamUtil; +import com.engine.common.util.ServiceUtil; +import com.engine.qdhx.service.HrmSalaryDiffReportService; +import com.engine.qdhx.service.impl.HrmSalaryDiffReportServiceImpl; +import weaver.general.BaseBean; +import weaver.hrm.HrmUserVarify; +import weaver.hrm.User; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.MediaType; +import java.util.HashMap; +import java.util.Map; + +/** + * @Author weaver_cl + * @Description: TODO + * @Date 2022/2/16 + * @Version V1.0 + **/ +public class HrmSalaryDiffReportAction extends BaseBean { + + private HrmSalaryDiffReportService getService(User user) { + return (HrmSalaryDiffReportServiceImpl) ServiceUtil.getService(HrmSalaryDiffReportServiceImpl.class, user); + } + + /** + * 查询条件 + * @param request + * @param response + * @return + */ + @POST + @Path("/getSearchCondition") + @Produces(MediaType.TEXT_PLAIN) + public String getSearchCondition(@Context HttpServletRequest request, @Context HttpServletResponse response){ + Map apidatas = new HashMap(); + try { + User user = HrmUserVarify.getUser(request, response); + apidatas.putAll(getService(user).getSearchCondition(ParamUtil.request2Map(request))); + apidatas.put("api_status", true); + } catch (Exception e) { + e.printStackTrace(); + apidatas.put("api_status", false); + apidatas.put("api_errormsg", "catch exception : " + e.getMessage()); + } + return JSONObject.toJSONString(apidatas, SerializerFeature.DisableCircularReferenceDetect); + } + + + /** + * 获取薪资报表 + * @param request + * @param response + * @return + */ + @POST + @Path("/getReportData") + @Produces({MediaType.TEXT_PLAIN}) + public String getReportData(@Context HttpServletRequest request, @Context HttpServletResponse response){ + Map apidatas = new HashMap(); + try { + User user = HrmUserVarify.getUser(request, response); + apidatas.putAll(getService(user).getReportData(ParamUtil.request2Map(request))); + apidatas.put("api_status", true); + } catch (Exception e) { + e.printStackTrace(); + apidatas.put("api_status", false); + apidatas.put("api_errormsg", "catch exception : " + e.getMessage()); + } + return JSONObject.toJSONString(apidatas, SerializerFeature.DisableCircularReferenceDetect); + } + + + /** + * 保存薪资报表 + * @param request + * @param response + * @return + */ + @POST + @Path("/saveReportData") + @Produces({MediaType.TEXT_PLAIN}) + public String saveReportData(@Context HttpServletRequest request, @Context HttpServletResponse response){ + Map apidatas = new HashMap(); + try { + User user = HrmUserVarify.getUser(request, response); + apidatas.putAll(getService(user).saveReportData(ParamUtil.request2Map(request))); + apidatas.put("api_status", true); + } catch (Exception e) { + e.printStackTrace(); + apidatas.put("api_status", false); + apidatas.put("api_errormsg", "catch exception : " + e.getMessage()); + } + return JSONObject.toJSONString(apidatas); + } + +} diff --git a/src/com/interface/HrmSalaryDiffReportExcelE9.jsp b/src/com/interface/HrmSalaryDiffReportExcelE9.jsp new file mode 100644 index 0000000..2e896aa --- /dev/null +++ b/src/com/interface/HrmSalaryDiffReportExcelE9.jsp @@ -0,0 +1,176 @@ +<%@ page language="java" contentType="application/vnd.ms-excel; charset=UTF-8" %> +<%@ page import="weaver.systeminfo.*,java.util.*,weaver.hrm.*" %> +<%@ page import="weaver.general.Util,weaver.hrm.common.*" %> +<%@ page import="weaver.hrm.attendance.domain.*"%> +<%@page import="weaver.hrm.report.schedulediff.HrmScheduleDiffManager"%> +<%@page import="java.net.URLEncoder"%> +<%@ page import="weaver.general.TimeUtil" %> + + + + + + + + + + + + + + + + + + + + + + +<% + User user = HrmUserVarify.getUser (request , response) ; + if(user == null) return ; + response.setContentType("application/vnd.ms-excel"); + + Calendar today = Calendar.getInstance (); + + + + + + String viewscope = Util.null2String(request.getParameter("viewscope")); //时间范围 + String typeselect = Util.null2String(request.getParameter("typeselect")); //查看范围 + String subCompanyId = Util.null2String(request.getParameter("subCompanyId")); + String departmentId = Util.null2String(request.getParameter("departmentId")); + String resourceId = Util.null2String(request.getParameter("resourceId")); + + String fromDate = ""; + String toDate = ""; + + if ("0".equals(typeselect) || "".equals(typeselect)) { + fromDate = TimeUtil.getMonthBeginDay(); + toDate = TimeUtil.getMonthEndDay(); + }else { + fromDate = TimeUtil.getLastMonthBeginDay(); + toDate = TimeUtil.getLastMonthEndDay(); + } + + + String fileName = fromDate+" "+ "至"+" "+toDate+" "+"薪资情况统计"; + String agent = request.getHeader("user-agent"); + if((agent.contains("Firefox")||agent.contains(" Chrome")||agent.contains("Safari") )&& !agent.contains("Edge")) + response.setHeader("content-disposition", "attachment; filename*=UTF-8''" + URLEncoder.encode(fileName.replaceAll("<", "").replaceAll(">", "").replaceAll("<", "").replaceAll(">", ""),"UTF-8").replaceAll("\\+", "%20").replaceAll("%28", "(").replaceAll("%29", ")")+".xls"); + else + response.setHeader("content-disposition", "attachment; filename="+URLEncoder.encode(fileName.replaceAll("<", "").replaceAll(">", "").replaceAll("<", "").replaceAll(">", ""),"UTF-8").replaceAll("\\+", "%20").replaceAll("%28", "(").replaceAll("%29", ")")+".xls"); +%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
<%=fileName%>
费用代码工号姓名税务身份薪资项目福利项目奖金一次性补偿金考勤扣款(减项)其他项目应发总额其他减项五险一金代扣代缴款个人所得税实发总额
实发基本工资实发固定加班费加班费生日礼金结婚礼金丧葬礼金节日礼金防暑津贴高温补贴通讯补贴轮班津贴站别津贴生产绩效奖金境外保险补贴其他加项1其他加项2住房补贴特别奖励金签约金绩效奖年终奖住宿水电物业费代扣餐费代扣养老保险医疗保险失业保险住房公积金
G1G2G3
行政管理部cx_003徐平-c00.0行政管理部cx_003徐平-c00.0行政管理部cx_003徐平-c00.0
diff --git a/src/com/test/TestMain.java b/src/com/test/TestMain.java new file mode 100644 index 0000000..76f7078 --- /dev/null +++ b/src/com/test/TestMain.java @@ -0,0 +1,40 @@ +package com.test; + + +import weaver.general.TimeUtil; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * @Author weaver_cl + * @Description: TODO + * @Date 2022/2/17 + * @Version V1.0 + **/ +public class TestMain { + public static void main(String[] args) { + Map apidatas = new HashMap<>(); + List lsCondition = new ArrayList(); + String[] options = null; + String[] selectLinkageDatas = null; + + //时间范围 + Map timeScope = new HashMap<>(); + options = new String[]{"1,本月,true","2,指定日期范围"}; + List timeDomkey = new ArrayList(); + Map selectLinks = new HashMap(); + + timeDomkey.add("typeselect"); + timeScope.put("label","时间范围"); + timeScope.put("options",options); + timeScope.put("domkey", timeDomkey); + + + + + } + +}