This commit is contained in:
parent
dcec31bf06
commit
38a4c524f3
Binary file not shown.
|
|
@ -1,11 +0,0 @@
|
|||
package com.engine.salary.entity.formula;
|
||||
|
||||
public class DataType {
|
||||
public static final String STRING = "string";
|
||||
public static final String NUMBER = "number";
|
||||
public static final String DATE = "date";
|
||||
public static final String OPTION = "option";
|
||||
public static final String BOOL = "boolean";
|
||||
public static final String FORM = "form";
|
||||
public static final String DATASOURCE = "dataSource";
|
||||
}
|
||||
|
|
@ -0,0 +1,283 @@
|
|||
package com.engine.salary.formlua.entity.parameter;
|
||||
|
||||
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @className:
|
||||
* @Description:
|
||||
* @Author:罗威
|
||||
* @date:
|
||||
*/
|
||||
public class DataType implements Serializable {
|
||||
public final static String STRING="string";
|
||||
public final static String NUMBER="number";
|
||||
public final static String DATE="date";
|
||||
public final static String OPTION="option";
|
||||
public final static String BOOL="boolean";
|
||||
public final static String FORM="form";
|
||||
public final static String DATASOURCE="dataSource";
|
||||
private static final long serialVersionUID = 4694252986617988427L;
|
||||
/**
|
||||
* 非COUNT函数使用
|
||||
*/
|
||||
private String fieldId;
|
||||
/**
|
||||
* 数据类型
|
||||
*/
|
||||
private String dataType;
|
||||
/**
|
||||
* 数据类型,表单可以直接从FormField中获取
|
||||
*/
|
||||
private String componentKey;
|
||||
/**
|
||||
* 模块标识,聚合函数使用
|
||||
*/
|
||||
private String module;
|
||||
/**
|
||||
* 人员参数
|
||||
*/
|
||||
private DataCollectionEmployee employee;
|
||||
/**
|
||||
* 表单ID,也可以是数据源ID,聚合函数、查找函数使用
|
||||
*/
|
||||
private Long formId;
|
||||
/**
|
||||
* 子表ID,聚合函数使用
|
||||
*/
|
||||
private Long subFormId;
|
||||
/**
|
||||
* 字段值,包括:数字类型、文本类型、日期类型、选项类型的ID等
|
||||
*/
|
||||
private Object content;
|
||||
/**
|
||||
* 富文本的值
|
||||
*/
|
||||
private String text;
|
||||
/**
|
||||
* 分数,表单控件中只有选项型控件有分数
|
||||
*/
|
||||
private Double score;
|
||||
/**
|
||||
* 标题
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 保留字段兼容老数据使用的
|
||||
*/
|
||||
private String aggCndKey;
|
||||
/**
|
||||
* 选项数据的文本内容
|
||||
*/
|
||||
private String optionContent;
|
||||
/**
|
||||
* 明细子表数据
|
||||
*/
|
||||
private List<DataType> subFormData;
|
||||
/**
|
||||
* 保留字段,兼容老数据使用
|
||||
*/
|
||||
// private FormField formField;
|
||||
/**
|
||||
* 高级搜索条件,由函数的逻辑操作符和逻辑函数构建,模块不需要处理
|
||||
*/
|
||||
// List<FormulaFilterData> formulaFilterDataList=null;
|
||||
private List<String> subLogic=new ArrayList<>();
|
||||
public static boolean checkType(String dataTypeL,String dataTypeR){
|
||||
if(returnType(dataTypeL).equalsIgnoreCase(dataTypeR)){
|
||||
return true;
|
||||
}else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
public static String returnType(String type){
|
||||
String finalType;
|
||||
switch (type){
|
||||
case "string":
|
||||
case "date":
|
||||
finalType="string";
|
||||
break;
|
||||
case "boolean":
|
||||
finalType="boolean";
|
||||
break;
|
||||
case "form":
|
||||
finalType="form";
|
||||
break;
|
||||
case "dataSource":
|
||||
case "option":
|
||||
finalType="option";
|
||||
break;
|
||||
case "number":
|
||||
finalType="number";
|
||||
break;
|
||||
default:
|
||||
finalType=type;
|
||||
break;
|
||||
}
|
||||
return finalType;
|
||||
}
|
||||
public DataType() {
|
||||
}
|
||||
public DataType(String dataType, Object content,String componentKey) {
|
||||
this.dataType = dataType;
|
||||
this.content = content;
|
||||
this.componentKey=componentKey;
|
||||
}
|
||||
public DataType(String dataType, Object content) {
|
||||
this.dataType = dataType;
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public DataType(String dataType, String module, DataCollectionEmployee employee, Long formId, Object content, String text, Double score) {
|
||||
this.dataType = dataType;
|
||||
this.module = module;
|
||||
this.employee = employee;
|
||||
this.formId = formId;
|
||||
this.content = content;
|
||||
this.text = text;
|
||||
this.score = score;
|
||||
}
|
||||
|
||||
public List<String> getSubLogic() {
|
||||
return subLogic;
|
||||
}
|
||||
|
||||
public void setSubLogic(List<String> subLogic) {
|
||||
this.subLogic = subLogic;
|
||||
}
|
||||
|
||||
public String getOptionContent() {
|
||||
return optionContent;
|
||||
}
|
||||
|
||||
public void setOptionContent(String optionContent) {
|
||||
this.optionContent = optionContent;
|
||||
}
|
||||
|
||||
public String getComponentKey() {
|
||||
return componentKey;
|
||||
}
|
||||
|
||||
public void setComponentKey(String componentKey) {
|
||||
this.componentKey = componentKey;
|
||||
}
|
||||
|
||||
public Long getSubFormId() {
|
||||
return subFormId;
|
||||
}
|
||||
|
||||
public void setSubFormId(Long subFormId) {
|
||||
this.subFormId = subFormId;
|
||||
}
|
||||
|
||||
// public FormField getFormField() {
|
||||
// return formField;
|
||||
// }
|
||||
//
|
||||
// public void setFormField(FormField formField) {
|
||||
// this.formField = formField;
|
||||
// }
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public DataCollectionEmployee getEmployee() {
|
||||
return employee;
|
||||
}
|
||||
|
||||
public void setEmployee(DataCollectionEmployee employee) {
|
||||
this.employee = employee;
|
||||
}
|
||||
|
||||
public String getModule() {
|
||||
return module;
|
||||
}
|
||||
|
||||
public void setModule(String module) {
|
||||
this.module = module;
|
||||
}
|
||||
|
||||
public static String getSTRING() {
|
||||
return STRING;
|
||||
}
|
||||
|
||||
public Long getFormId() {
|
||||
return formId;
|
||||
}
|
||||
|
||||
public void setFormId(Long formId) {
|
||||
this.formId = formId;
|
||||
}
|
||||
|
||||
public String getFieldId() {
|
||||
return fieldId;
|
||||
}
|
||||
|
||||
public void setFieldId(String fieldId) {
|
||||
this.fieldId = fieldId;
|
||||
}
|
||||
|
||||
public String getDataType() {
|
||||
return dataType;
|
||||
}
|
||||
|
||||
public void setDataType(String dataType) {
|
||||
this.dataType = dataType;
|
||||
}
|
||||
|
||||
public Object getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setContent(Object content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public String getText() {
|
||||
return text;
|
||||
}
|
||||
|
||||
public void setText(String text) {
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
public String getAggCndKey() {
|
||||
return aggCndKey;
|
||||
}
|
||||
|
||||
public void setAggCndKey(String aggCndKey) {
|
||||
this.aggCndKey = aggCndKey;
|
||||
}
|
||||
|
||||
public Double getScore() {
|
||||
return score;
|
||||
}
|
||||
|
||||
public void setScore(Double score) {
|
||||
this.score = score;
|
||||
}
|
||||
|
||||
public List<DataType> getSubFormData() {
|
||||
return subFormData;
|
||||
}
|
||||
|
||||
public void setSubFormData(List<DataType> subFormData) {
|
||||
this.subFormData = subFormData;
|
||||
}
|
||||
|
||||
// public List<FormulaFilterData> getFormulaFilterDataList() {
|
||||
// return formulaFilterDataList;
|
||||
// }
|
||||
//
|
||||
// public void setFormulaFilterDataList(List<FormulaFilterData> formulaFilterDataList) {
|
||||
// this.formulaFilterDataList = formulaFilterDataList;
|
||||
// }
|
||||
}
|
||||
|
|
@ -9,14 +9,14 @@ import com.engine.salary.entity.datacollection.AddUpSituation;
|
|||
import com.engine.salary.entity.datacollection.dto.AttendQuoteFieldListDTO;
|
||||
import com.engine.salary.entity.datacollection.param.AttendQuoteFieldQueryParam;
|
||||
import com.engine.salary.entity.datacollection.po.OtherDeductionPO;
|
||||
import com.engine.salary.entity.formula.DataType;
|
||||
import com.engine.salary.entity.salaryformula.po.FormulaVar;
|
||||
import com.engine.salary.entity.salaryformula.dto.SalaryFormulaEmployeeDTO;
|
||||
import com.engine.salary.entity.salaryformula.dto.SalaryFormulaTaxRateDTO;
|
||||
import com.engine.salary.entity.salaryformula.po.FormulaVar;
|
||||
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
|
||||
import com.engine.salary.entity.salarysob.po.SalarySobItemPO;
|
||||
import com.engine.salary.entity.taxrate.TaxRateBase;
|
||||
import com.engine.salary.enums.SalaryFormulaReferenceEnum;
|
||||
import com.engine.salary.formlua.entity.parameter.DataType;
|
||||
import com.engine.salary.mapper.datacollection.AttendQuoteFieldMapper;
|
||||
import com.engine.salary.service.*;
|
||||
import com.engine.salary.util.SalaryEntityUtil;
|
||||
|
|
|
|||
|
|
@ -96,13 +96,11 @@ public class SalaryFormulaServiceImpl extends Service implements SalaryFormulaSe
|
|||
ValidUtil.doValidator(param);
|
||||
|
||||
//公式参数与公式内容是否相符
|
||||
String paramFormula = param.getFormula();
|
||||
Pattern salaryPattern = SalaryFormulaFieldConstant.SALARY_PATTERN;
|
||||
Matcher matcher = salaryPattern.matcher(paramFormula);
|
||||
int end = matcher.end();
|
||||
if(!Objects.equals(end,param.getParameters())){
|
||||
throw new SalaryRunTimeException("参数不匹配");
|
||||
}
|
||||
// String paramFormula = param.getFormula();
|
||||
// int end = matchStr(paramFormula);
|
||||
// if(!Objects.equals(end,param.getParameters())){
|
||||
// throw new SalaryRunTimeException("参数不匹配");
|
||||
// }
|
||||
|
||||
FormulaPO formulaPO = new FormulaPO();
|
||||
String formula = param.getFormula();
|
||||
|
|
@ -146,6 +144,15 @@ public class SalaryFormulaServiceImpl extends Service implements SalaryFormulaSe
|
|||
return formulaPO;
|
||||
}
|
||||
|
||||
private static int matchStr(String str){
|
||||
Pattern salaryPattern = SalaryFormulaFieldConstant.SALARY_PATTERN;
|
||||
Matcher m = salaryPattern.matcher(str);
|
||||
int count = 0;
|
||||
while (m.find()) {
|
||||
count++;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FormulaPO update(SalaryFormulaSaveParam param) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue