|
@@ -15,6 +15,7 @@ import org.jsoup.Jsoup;
|
|
import org.jsoup.nodes.Document;
|
|
import org.jsoup.nodes.Document;
|
|
import org.jsoup.nodes.Element;
|
|
import org.jsoup.nodes.Element;
|
|
import org.jsoup.select.Elements;
|
|
import org.jsoup.select.Elements;
|
|
|
|
+import org.springblade.common.utils.BaseUtils;
|
|
import org.springblade.common.utils.SnowFlakeUtil;
|
|
import org.springblade.common.utils.SnowFlakeUtil;
|
|
import org.springblade.core.mp.base.BaseServiceImpl;
|
|
import org.springblade.core.mp.base.BaseServiceImpl;
|
|
import org.springblade.core.tool.api.R;
|
|
import org.springblade.core.tool.api.R;
|
|
@@ -724,7 +725,7 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
local.add(new LocalVariable(index,f,variable));
|
|
local.add(new LocalVariable(index,f,variable));
|
|
}
|
|
}
|
|
if(local.size()>0){
|
|
if(local.size()>0){
|
|
- List<Object> values = slice(local,tec.constantMap,f);
|
|
|
|
|
|
+ List<Object> values = slice(local,f);
|
|
FormulaUtils.write(fd,values, !fd.getTableName().equals(checkTable));
|
|
FormulaUtils.write(fd,values, !fd.getTableName().equals(checkTable));
|
|
}
|
|
}
|
|
}else{
|
|
}else{
|
|
@@ -1284,10 +1285,11 @@ public List<ElementData> setScale(Integer scale,List<ElementData> data){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- public List<Object> slice(List<LocalVariable> local,Map<String,Object> constantMap,String formula){
|
|
|
|
|
|
+ public List<Object> slice(List<LocalVariable> local,String formula){
|
|
int min =0;
|
|
int min =0;
|
|
List<Object> result = new ArrayList<>();
|
|
List<Object> result = new ArrayList<>();
|
|
try {
|
|
try {
|
|
|
|
+ pretreatment(local,formula);
|
|
List<Object> r= local.stream().map(e-> Expression.parse(e.getFormula()).calculate(e.getCurrentMap())).collect(Collectors.toList());
|
|
List<Object> r= local.stream().map(e-> Expression.parse(e.getFormula()).calculate(e.getCurrentMap())).collect(Collectors.toList());
|
|
if(CollectionUtil.isNotEmpty(r)&&r.stream().anyMatch(StringUtils::isNotEmpty)){
|
|
if(CollectionUtil.isNotEmpty(r)&&r.stream().anyMatch(StringUtils::isNotEmpty)){
|
|
result.addAll(r);
|
|
result.addAll(r);
|
|
@@ -1298,6 +1300,25 @@ public List<ElementData> setScale(Integer scale,List<ElementData> data){
|
|
return result;
|
|
return result;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ public void pretreatment(List<LocalVariable> local,String formula){
|
|
|
|
+ formula=StringUtils.removeMultiSpace(formula);
|
|
|
|
+ if(formula.contains("LIST")){
|
|
|
|
+ Matcher m=RegexUtils.matcher("\\(([^)]*)\\)/LIST",formula);
|
|
|
|
+ while (m.find()){
|
|
|
|
+ List<String> codes=this.getCodeList(m.group(1).replaceAll("[+-]",","));
|
|
|
|
+ local=local.stream().peek(e->{
|
|
|
|
+ @SuppressWarnings("unckecked")
|
|
|
|
+ Map<String,Object> map = (Map<String, Object>) e.getCurrentMap().getOrDefault(E,new HashMap<>());
|
|
|
|
+ int listSize=(int)codes.stream().filter(c->StringUtils.isNotEmpty(map.get(c))).count();
|
|
|
|
+ if(listSize<=0||listSize>codes.size()){
|
|
|
|
+ listSize=codes.size();
|
|
|
|
+ }
|
|
|
|
+ map.put("LIST",listSize);
|
|
|
|
+ }).collect(Collectors.toList());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
|
|
public static void sort( List<FormData> list,int n){
|
|
public static void sort( List<FormData> list,int n){
|
|
/*System.out.println("剩余计算次数:"+n+"次");*/
|
|
/*System.out.println("剩余计算次数:"+n+"次");*/
|
|
@@ -1605,7 +1626,7 @@ public List<ElementData> setScale(Integer scale,List<ElementData> data){
|
|
if(StringUtils.isNotEmpty(codes)){
|
|
if(StringUtils.isNotEmpty(codes)){
|
|
String[] relyArr = codes.split(StringPool.COMMA);
|
|
String[] relyArr = codes.split(StringPool.COMMA);
|
|
List<Map<String,Object>> mapList =this.jdbcTemplate.queryForList("select CONCAT(a.tab_en_name,':',b.e_key) ekey,a.tab_ch_name tableName,b.e_name ename ,b.e_length elength,c.dict_value type f" +
|
|
List<Map<String,Object>> mapList =this.jdbcTemplate.queryForList("select CONCAT(a.tab_en_name,':',b.e_key) ekey,a.tab_ch_name tableName,b.e_name ename ,b.e_length elength,c.dict_value type f" +
|
|
- "rom m_table_info a JOIN m_wbs_form_element b on a.id=b.f_id " +
|
|
|
|
|
|
+ "rom m_table_info a JOIN m_wbs_form_element b on a.id=b.f_id and b.is_deleted=0 " +
|
|
"LEFT JOIN (select dict_key, dict_value from blade_dict where code ='data_type' and parent_id > 0 and is_sealed = 0 and is_deleted = 0 )c on b.e_type=c.dict_key" +
|
|
"LEFT JOIN (select dict_key, dict_value from blade_dict where code ='data_type' and parent_id > 0 and is_sealed = 0 and is_deleted = 0 )c on b.e_type=c.dict_key" +
|
|
" where a.tab_en_name in( "+ Arrays.stream(relyArr).map(e->e.split(StringPool.COLON)[0]).distinct().collect(Collectors.joining("','","'","'"))+")");
|
|
" where a.tab_en_name in( "+ Arrays.stream(relyArr).map(e->e.split(StringPool.COLON)[0]).distinct().collect(Collectors.joining("','","'","'"))+")");
|
|
if(ListUtils.isNotEmpty(mapList)){
|
|
if(ListUtils.isNotEmpty(mapList)){
|