公式检测

This commit is contained in:
钱涛 2023-08-31 14:39:58 +08:00
parent dbe659d81d
commit feeb3d21f2
3 changed files with 36 additions and 38 deletions

View File

@ -37,6 +37,12 @@ public class ExcelResult implements Serializable {
private String formulaId;
private String dataType;
/**
* 运行时间
*/
private double runTime;
public ExcelResult() {
}
@ -131,6 +137,14 @@ public class ExcelResult implements Serializable {
this.status = status;
}
public double getRunTime() {
return runTime;
}
public void setRunTime(double runTime) {
this.runTime = runTime;
}
@Override
public String toString() {
return "ExcelResult{" +

View File

@ -1,31 +0,0 @@
//package com.engine.salary.service;
//
//import com.engine.salary.entity.datacollection.DataCollectionEmployee;
//
//import java.util.Collection;
//
///**
// * @description: 薪资核算
// * @author: xiajun
// * @modified By: xiajun
// * @date: Created in 8/22/22 3:15 PM
// * @version:v1.0
// */
//public interface SalaryAcctCalcService {
//
// /**
// * 按薪资核算记录id进行核算
// *
// * @param salaryAcctRecordId
// * @param simpleEmployee
// */
// void calcByRecordId(Long salaryAcctRecordId, DataCollectionEmployee simpleEmployee) throws Exception;
//
// /**
// * 按薪资核算人员id进行核算
// *
// * @param salaryAcctEmployeeIds
// * @param simpleEmployee
// */
// void calcByEmployeeIds(Long salaryAcctRecordId, Collection<Long> salaryAcctEmployeeIds, DataCollectionEmployee simpleEmployee) throws Exception;
//}

View File

@ -19,6 +19,7 @@ import com.ql.util.express.ExpressRunner;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
import org.springframework.util.StopWatch;
import weaver.conn.RecordSet;
import weaver.conn.RecordSetDataSource;
import weaver.general.BaseBean;
@ -45,15 +46,29 @@ public class FormulaRunServiceImpl extends Service implements FormulaRunService
@Override
public ExcelResult run(ExpressFormula expressFormula, List<FormulaVar> formulaVars, DataCollectionEmployee simpleEmployee) {
if (ReferenceTypeEnum.parseByValue(expressFormula.getReferenceType()) == ReferenceTypeEnum.FORMULA) {
return runFormula(expressFormula, formulaVars);
}
if (ReferenceTypeEnum.parseByValue(expressFormula.getReferenceType()) == ReferenceTypeEnum.SQL) {
return runSQL(expressFormula, formulaVars);
ExcelResult result = new ExcelResult(false, "", "");
if (isLog) {
StopWatch stopWatch = new StopWatch();
stopWatch.start("run " + expressFormula.getName());
if (ReferenceTypeEnum.parseByValue(expressFormula.getReferenceType()) == ReferenceTypeEnum.FORMULA) {
result = runFormula(expressFormula, formulaVars);
}
if (ReferenceTypeEnum.parseByValue(expressFormula.getReferenceType()) == ReferenceTypeEnum.SQL) {
result = runSQL(expressFormula, formulaVars);
}
stopWatch.stop();
double totalTimeSeconds = stopWatch.getTotalTimeSeconds();
result.setRunTime(totalTimeSeconds);
} else {
if (ReferenceTypeEnum.parseByValue(expressFormula.getReferenceType()) == ReferenceTypeEnum.FORMULA) {
result = runFormula(expressFormula, formulaVars);
}
if (ReferenceTypeEnum.parseByValue(expressFormula.getReferenceType()) == ReferenceTypeEnum.SQL) {
result = runSQL(expressFormula, formulaVars);
}
}
log.error("express execute fail, {} not in ReferenceTypeEnum ", expressFormula.getReferenceType());
return new ExcelResult(false, "", "");
return result;
}
private ExcelResult runSQL(ExpressFormula expressFormula, List<FormulaVar> formulaVars) {