fix线下对比404
This commit is contained in:
parent
8abfb7631e
commit
01354b2be9
|
|
@ -27,6 +27,7 @@ alter table hrsa_acct_result_temp modify id bigint auto_increment;
|
|||
alter table hrsa_formula modify id bigint auto_increment;
|
||||
alter table hrsa_formula_var modify id bigint auto_increment;
|
||||
alter table hrsa_salary_acct_result modify id bigint auto_increment;
|
||||
alter table hrsa_excel_acct_result modify id bigint auto_increment;
|
||||
|
||||
|
||||
# 福利方案主键自增增加
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ import java.util.Date;
|
|||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
//hrsa_add_up_deduction
|
||||
public class AddUpDeduction {
|
||||
/**
|
||||
* 主键id
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ import java.util.Date;
|
|||
public class DataCollectionEmployee {
|
||||
|
||||
//员工id
|
||||
@SalaryFormulaVar(defaultLabel ="员工id", labelId = 86184, dataType = "string")
|
||||
private Long employeeId;
|
||||
|
||||
// 个税扣缴义务人
|
||||
|
|
|
|||
|
|
@ -24,6 +24,9 @@ import com.engine.salary.enums.SalaryFormulaReferenceEnum;
|
|||
import com.engine.salary.enums.SalaryValueTypeEnum;
|
||||
import com.engine.salary.service.*;
|
||||
import com.engine.salary.util.SalaryEntityUtil;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.google.common.collect.Lists;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
|
|
@ -264,25 +267,40 @@ public class SalaryAcctCalculateServiceImpl extends Service implements SalaryAcc
|
|||
// return StringUtils.EMPTY;
|
||||
}
|
||||
|
||||
|
||||
private static final ObjectMapper objectMapper = new ObjectMapper();
|
||||
private String runExpressSQL(ExpressFormula expressFormula, Map<String, String> formulaVarValueMap, DataCollectionEmployee simpleEmployee) {
|
||||
|
||||
RecordSet rs = new RecordSet();
|
||||
//select * from uf_test where epmid = {emp.id}
|
||||
String formulaRunScript = expressFormula.getFormulaRunScript();
|
||||
|
||||
|
||||
String extendParam = expressFormula.getExtendParam();
|
||||
String sqlReturnKey ="";
|
||||
try {
|
||||
JsonNode jsonNode = objectMapper.readTree(extendParam);
|
||||
JsonNode sqlReturnKeyNode = jsonNode.get("sqlReturnKey");
|
||||
if (sqlReturnKeyNode != null){
|
||||
sqlReturnKey = sqlReturnKeyNode.asText();
|
||||
}
|
||||
} catch (JsonProcessingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
// 给公式中的变量填入值
|
||||
List<FormulaVar> formulaVars = ExpressFormulaBO.buildFormulaVar4Accounting(expressFormula, formulaVarValueMap);
|
||||
String sql = formulaRunScript;
|
||||
for (int i = 0; i < formulaVars.size(); i++) {
|
||||
FormulaVar formulaVar = formulaVars.get(i);
|
||||
sql = formulaRunScript.replaceAll(formulaVar.getFieldId(), formulaVar.getContent());
|
||||
sql = formulaRunScript.replaceAll(formulaVar.getFieldId(), "'"+formulaVar.getContent()+"'");
|
||||
}
|
||||
|
||||
rs.execute("select id as a from hrsa_formula where id = '1650956615090'");
|
||||
rs.next();
|
||||
return rs.getString("a");
|
||||
|
||||
rs.execute(sql);
|
||||
rs.next();
|
||||
String string = rs.getString(sqlReturnKey);
|
||||
return string;
|
||||
// Object run = getFormulaRunService(user).run(expressFormula, formulaVars, simpleEmployee);
|
||||
// return run.toString();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -96,6 +96,10 @@ public class SalaryFormulaServiceImpl extends Service implements SalaryFormulaSe
|
|||
public FormulaPO save(SalaryFormulaSaveParam param) {
|
||||
ValidUtil.doValidator(param);
|
||||
|
||||
if ("sql".equals(param.getReferenceType())) {
|
||||
param.setFormula(param.getFormula().replaceAll("SELECT", "select"));
|
||||
}
|
||||
|
||||
//公式参数与公式内容是否相符
|
||||
// String paramFormula = param.getFormula();
|
||||
// int end = matchStr(paramFormula);
|
||||
|
|
@ -147,7 +151,7 @@ public class SalaryFormulaServiceImpl extends Service implements SalaryFormulaSe
|
|||
return formulaPO;
|
||||
}
|
||||
|
||||
private static int matchStr(String str){
|
||||
private static int matchStr(String str) {
|
||||
Pattern salaryPattern = SalaryFormulaFieldConstant.SALARY_PATTERN;
|
||||
Matcher m = salaryPattern.matcher(str);
|
||||
int count = 0;
|
||||
|
|
|
|||
Loading…
Reference in New Issue