diff --git a/resource/wiki/删除档案.txt b/resource/wiki/删除档案.txt index a5614d6c5..2ac8d7d2c 100644 --- a/resource/wiki/删除档案.txt +++ b/resource/wiki/删除档案.txt @@ -32,3 +32,14 @@ update hrsa_other_archives set delete_type=3 WHERE employee_id = ? and payment_ -- 删除薪资档案 update hrsa_salary_archive set delete_type=3 where employee_id = ? and tax_agent_id=? + + +update hrsa_salary_archive set delete_type=3; +update hrsa_insurance_base_info set delete_type=3; +update hrsa_social_archives set delete_type=3; +update hrsa_fund_archives set delete_type=3; +update hrsa_other_archives set delete_type=3; +update hrsa_tax_agent_emp set delete_type=3; + + + diff --git a/resource/wiki/常用查询.md b/resource/wiki/常用查询.md index 0bb9db9a6..51576d16d 100644 --- a/resource/wiki/常用查询.md +++ b/resource/wiki/常用查询.md @@ -8,3 +8,14 @@ left join hrsa_salary_acct_result result on record.id = result.salary_acct_recor left join hrsa_salary_item item on result.salary_item_id = item.id and item.delete_type = 0 left join hrsa_tax_agent agent on agent.id=sob.tax_agent_id and agent.delete_type=0 left join hrmresource e on e.id= result.employee_id + + +# 获取档案信息 + + select i.item_value from hrsa_salary_archive_item i + left join hrsa_salary_archive a on a.id = i.salary_archive_id + left join hrsa_salary_item c on c.id=i.salary_item_id + left join hrsa_tax_agent t on a.tax_agent_id=t.id + where a.delete_type=0 and i.delete_type=0 and t.delete_type=0 and c.delete_type=0 + and a.employee_id=$main.ygid$ and t.name='$main.dzqgskjywr$' + and effective_time <= now() and c.name='基本工资' order by effective_time desc \ No newline at end of file diff --git a/src/com/engine/salary/service/impl/SalaryAcctCalculateServiceImpl.java b/src/com/engine/salary/service/impl/SalaryAcctCalculateServiceImpl.java index c6469f75d..bf47e7e0e 100644 --- a/src/com/engine/salary/service/impl/SalaryAcctCalculateServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalaryAcctCalculateServiceImpl.java @@ -112,23 +112,23 @@ public class SalaryAcctCalculateServiceImpl extends Service implements SalaryAcc @Override public void calculate(SalaryAcctCalculateBO salaryAcctCalculateBO, DataCollectionEmployee simpleEmployee, List salarySobBackItems) { - StopWatch sw = new StopWatch(salaryAcctCalculateBO.getSalaryAcctRecordPO().getId()+""); + StopWatch sw = new StopWatch("核算耗时明细,id:"+salaryAcctCalculateBO.getSalaryAcctRecordPO().getId()+""); Date now = new Date(); try { // 数据库字段加密用 // 1、查询人员信息 - sw.start("核算耗时查询人员信息"); + sw.start("查询人员信息"); List employeeIds = SalaryEntityUtil.properties(salaryAcctCalculateBO.getSalaryAcctEmployeePOS(), SalaryAcctEmployeePO::getEmployeeId, Collectors.toList()); List simpleEmployees = getSalaryEmployeeService(user).getEmployeeByIdsAll(employeeIds); SalarySobCycleDTO salarySobCycleDTO = salaryAcctCalculateBO.getSalarySobCycleDTO(); Long taxAgentId = salaryAcctCalculateBO.getSalarySobPO().getTaxAgentId(); sw.stop(); // 2、查询薪资档案的数据 - sw.start("核算耗时查询薪资档案的数据"); + sw.start("查询薪资档案的数据"); List salaryArchiveData = getSalaryArchiveService(user).getSalaryArchiveData(salarySobCycleDTO.getSalaryCycle(), employeeIds, taxAgentId); sw.stop(); // 3、查询往期累计情况(查询的是上个税款所属期的的累计情况) - sw.start("核算耗时查询往期累计情况"); + sw.start("查询往期累计情况"); List addUpSituationPOS; if (salarySobCycleDTO.getTaxCycle().getMonth() == Month.JANUARY) { // 3.1、如果当前税款所属期是本年度第一个税款所属期,就不需要查询往期累计情况 @@ -138,28 +138,28 @@ public class SalaryAcctCalculateServiceImpl extends Service implements SalaryAcc } sw.stop(); // 4、查询累计专项附加扣除 - sw.start("核算耗时查询累计专项附加扣除"); + sw.start("查询累计专项附加扣除"); List addUpDeductionPOS = getAddUpDeductionService(user).getAddUpDeductionList(salarySobCycleDTO.getTaxCycle(), employeeIds, taxAgentId); sw.stop(); // 5、查询其他免税扣除 - sw.start("核算耗时查询其他免税扣除"); + sw.start("查询其他免税扣除"); List otherDeductionPOS = getOtherDeductionService(user).getOtherDeductionList(salarySobCycleDTO.getTaxCycle(), employeeIds, taxAgentId); sw.stop(); //6、查询社保福利 - sw.start("核算耗时查询社保福利"); + sw.start("查询社保福利"); List> welfareData = getSIAccountService(user).welfareData(salarySobCycleDTO.getSocialSecurityCycle().toString(), employeeIds, taxAgentId); sw.stop(); // 7、查询考勤数据 - sw.start("核算耗时查询考勤数据"); + sw.start("查询考勤数据"); List attendQuoteDataDTOS = getAttendQuoteDataService(user).getAttendQuoteData(salarySobCycleDTO.getSalaryMonth(), salarySobCycleDTO.getSalarySobId(), employeeIds); sw.stop(); // 8、查询薪资核算人员的薪资核算结果 - sw.start("核算耗时查询薪资核算人员的薪资核算结果"); + sw.start("查询薪资核算人员的薪资核算结果"); List salaryAcctEmployeeIds = SalaryEntityUtil.properties(salaryAcctCalculateBO.getSalaryAcctEmployeePOS(), SalaryAcctEmployeePO::getId, Collectors.toList()); List salaryAcctResultPOS = getSalaryAcctResultService(user).listBySalaryAcctEmployeeIds(salaryAcctEmployeeIds); sw.stop(); // 薪资回算时回算前的核算结果 (没有回算项) - sw.start("核算耗时查询薪资回算时回算前的核算结果"); + sw.start("查询薪资回算时回算前的核算结果"); Map> collect = salaryAcctResultPOS.stream().collect(Collectors.groupingBy(k -> k.getEmployeeId() + "-" + k.getTaxAgentId() + "-" + k.getSalaryItemId())); Map salaryAcctResultPOMap = new HashMap<>(); for (Map.Entry> et : collect.entrySet()) { @@ -170,22 +170,22 @@ public class SalaryAcctCalculateServiceImpl extends Service implements SalaryAcc List lockSalaryItemIds = ListUtils.emptyIfNull(salaryAcctCalculateBO.getLockSalaryItemIds()); sw.stop(); // 9、查询相同税款所属期内涉及合并计税的其他薪资核算结果 - sw.start("核算耗时查询相同税款所属期内涉及合并计税的其他薪资核算结果"); + sw.start("查询相同税款所属期内涉及合并计税的其他薪资核算结果"); Set otherSalaryAcctRecordIds = SalaryEntityUtil.properties(salaryAcctCalculateBO.getOtherSalaryAcctRecordPOS(), SalaryAcctRecordPO::getId); List otherSalaryAcctResultPOS = getSalaryAcctResultService(user).listBySalaryAcctRecordIdsAndEmployeeIds(otherSalaryAcctRecordIds, employeeIds); Map> otherSalaryAcctResultPOMap = SalaryEntityUtil.group2Map(otherSalaryAcctResultPOS, e -> e.getEmployeeId() + "_" + e.getTaxAgentId()); sw.stop(); // 9.1、查询相同税款所属期内设计合并计税的其他薪资核算人员 - sw.start("核算耗时查询相同税款所属期内设计合并计税的其他薪资核算人员"); + sw.start("查询相同税款所属期内设计合并计税的其他薪资核算人员"); List otherSalaryAcctEmployeePOS = getSalaryAcctEmployeeService(user).listBySalaryAcctRecordIdsAndEmployeeIds(otherSalaryAcctRecordIds, employeeIds); Map> otherSalaryAcctEmployeePOMap = SalaryEntityUtil.group2Map(otherSalaryAcctEmployeePOS, salaryAcctEmployeePO -> salaryAcctEmployeePO.getEmployeeId() + "_" + salaryAcctEmployeePO.getTaxAgentId()); sw.stop(); // 10、转换成公式编辑器中的变量 - sw.start("核算耗时转换成公式编辑器中的变量"); + sw.start("转换成公式编辑器中的变量"); CalculateFormulaVarBO calculateFormulaVarBO = new CalculateFormulaVarBO(simpleEmployees, salaryArchiveData, addUpSituationPOS, addUpDeductionPOS, otherDeductionPOS, welfareData, attendQuoteDataDTOS, salaryAcctResultPOS); Map> formulaVarMap = calculateFormulaVarBO.convert2FormulaVar(salaryAcctCalculateBO); sw.stop(); - sw.start("核算耗时数据结构准备"); + sw.start("数据结构准备"); // 本次薪资核算所用的薪资账套下的薪资项目 Map salaryItemIdKeySalarySobItemPOMap = SalaryEntityUtil.convert2Map(salaryAcctCalculateBO.getSalarySobItemPOS(), SalarySobItemPO::getSalaryItemId); // 本次薪资核算所用的公式 @@ -198,7 +198,7 @@ public class SalaryAcctCalculateServiceImpl extends Service implements SalaryAcc List salaryAcctResultTempPOS = Lists.newArrayList(); sw.stop(); // 开始核算 - sw.start("核算耗时核算耗时"); + sw.start("核算耗时"); StringBuffer noticeMsg = new StringBuffer(); for (SalaryAcctEmployeePO salaryAcctEmployeePO : salaryAcctCalculateBO.getSalaryAcctEmployeePOS()) { Long salaryAcctEmployeePOId = salaryAcctEmployeePO.getId(); @@ -290,7 +290,7 @@ public class SalaryAcctCalculateServiceImpl extends Service implements SalaryAcc } sw.stop(); // 保存新的薪资核算结果(临时存储) - sw.start("核算耗时保存新的薪资核算结果(临时存储)"); + sw.start("保存新的薪资核算结果(临时存储)"); getSalaryAcctResultTempService(user).batchSave(salaryAcctResultTempPOS); sw.stop(); // 更新薪资核算进度 @@ -300,7 +300,7 @@ public class SalaryAcctCalculateServiceImpl extends Service implements SalaryAcc noticeMsg.toString() ); sw.stop(); - log.info("核算耗时明细" + sw.prettyPrint()); + log.info(sw.prettyPrint()); // 记录子线程执行结果 salaryAcctCalculateBO.getResults().add(new SalaryAcctCalculateBO.Result(true, StringUtils.EMPTY)); } catch (Exception e) { diff --git a/src/com/engine/salary/service/impl/SalaryAcctResultServiceImpl.java b/src/com/engine/salary/service/impl/SalaryAcctResultServiceImpl.java index e63fcfaaf..e3bf9a3e5 100644 --- a/src/com/engine/salary/service/impl/SalaryAcctResultServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalaryAcctResultServiceImpl.java @@ -721,9 +721,9 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe @Override public void calculate(SalaryAcctCalculateParam calculateParam, DataCollectionEmployee simpleEmployee) { - StopWatch stopWatch = new StopWatch(calculateParam.getSalaryAcctRecordId() + ""); + StopWatch stopWatch = new StopWatch("总核算耗时,id:"+calculateParam.getSalaryAcctRecordId()); try { - stopWatch.start("核算总耗时数据准备"); + stopWatch.start("数据准备"); // 1、查询薪资核算记录 SalaryAcctRecordPO salaryAcctRecordPO = getSalaryAcctRecordService(user).getById(calculateParam.getSalaryAcctRecordId()); if (Objects.isNull(salaryAcctRecordPO)) { @@ -791,7 +791,7 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe } stopWatch.stop(); - stopWatch.start("核算完毕计时"); + stopWatch.start("核算耗时"); // 11.1、初始化进度 ProgressDTO initProgress = new ProgressDTO().setTitle(SalaryI18nUtil.getI18nLabel(97515, "核算中")).setTitleLabelId(97515L).setTotalQuantity(salaryAcctEmployeePOS.size() * 2 + 1).setCalculatedQuantity(0).setProgress(BigDecimal.ZERO).setStatus(true).setMessage(StringUtils.EMPTY); @@ -841,7 +841,7 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe childMonitor.await(); stopWatch.stop(); - stopWatch.start("核算入库计时"); + stopWatch.start("数据写入耗时"); // 14、判断子线程执行结果 boolean allSuccess = calculateResults.stream().allMatch(SalaryAcctCalculateBO.Result::isStatus); diff --git a/src/com/engine/salary/service/impl/SalarySendServiceImpl.java b/src/com/engine/salary/service/impl/SalarySendServiceImpl.java index 782317f9f..f89dbd954 100644 --- a/src/com/engine/salary/service/impl/SalarySendServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalarySendServiceImpl.java @@ -75,6 +75,7 @@ import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import weaver.common.MessageUtil; +import weaver.general.Util; import weaver.hrm.User; import weaver.hrm.company.SubCompanyComInfo; import weaver.hrm.resource.ResourceComInfo; @@ -957,7 +958,7 @@ public class SalarySendServiceImpl extends Service implements SalarySendService try { Method method = salaryFormulaEmployeeDTO.getClass().getMethod(getter); Object invoke = method.invoke(salaryFormulaEmployeeDTO); - e.setSalaryItemValue(invoke.toString()); + e.setSalaryItemValue(Util.null2String(invoke)); } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException ex) { log.error("no such method", e); } diff --git a/src/com/engine/salary/util/pdf/HtmlToPdf.java b/src/com/engine/salary/util/pdf/HtmlToPdf.java index 35e23da49..c0a52c5b7 100644 --- a/src/com/engine/salary/util/pdf/HtmlToPdf.java +++ b/src/com/engine/salary/util/pdf/HtmlToPdf.java @@ -3,7 +3,10 @@ package com.engine.salary.util.pdf; import com.engine.workflow.biz.requestForm.HtmlToPdfInterceptor; import lombok.extern.slf4j.Slf4j; +import java.io.BufferedInputStream; +import java.io.BufferedReader; import java.io.File; +import java.io.InputStreamReader; @Slf4j public class HtmlToPdf { @@ -11,9 +14,9 @@ public class HtmlToPdf { /** * html转pdf * - * @param toPdfTool 工具路径 - * @param srcPath html路径,可以是硬盘上的路径,也可以是网络路径 - * @param destPath pdf保存路径 + * @param toPdfTool 工具路径 + * @param srcPath html路径,可以是硬盘上的路径,也可以是网络路径 + * @param destPath pdf保存路径 * @return 转换成功返回true */ public static boolean convert(String toPdfTool, String srcPath, String destPath) { @@ -45,8 +48,26 @@ public class HtmlToPdf { HtmlToPdfInterceptor output = new HtmlToPdfInterceptor(proc.getInputStream()); error.start(); output.start(); - proc.waitFor(); + + BufferedInputStream err = new BufferedInputStream(proc.getErrorStream()); + BufferedReader errBr = new BufferedReader(new InputStreamReader(err)); + String lineStr = ""; + while ((lineStr = errBr.readLine()) != null) { + //检查命令是否执行失败。 + log.info("pdf转换执行中! {}", lineStr); + } + if (proc.waitFor() != 0) { + //p.exitValue()==0表示正常结束,1:非正常结束 + if (proc.exitValue() == 1) { + log.error("pdf转换命令执行失败!"); + } + } + } catch (InterruptedException e) { + log.error("pdf转换出错!", e); + e.printStackTrace(); + result = false; } catch (Exception e) { + log.error("pdf转换出错!", e); result = false; e.printStackTrace(); }