|
@@ -307,6 +307,24 @@ public class FormulaController {
|
|
|
return R.fail("无数据");
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ public static String TEMPLATE="{\n" +
|
|
|
+ "'type': 'radio',\n" +
|
|
|
+ "'info': {\n" +
|
|
|
+ "'label': '是否引用公式数据',\n" +
|
|
|
+ "'value': [\n" +
|
|
|
+ "{\n" +
|
|
|
+ "'label': '是',\n" +
|
|
|
+ "'value': 1\n" +
|
|
|
+ "},\n" +
|
|
|
+ "{\n" +
|
|
|
+ "'label': '否',\n" +
|
|
|
+ "'value': 0\n" +
|
|
|
+ "}\n" +
|
|
|
+ "]\n" +
|
|
|
+ "}\n" +
|
|
|
+ "}";
|
|
|
+
|
|
|
@GetMapping("/panel")
|
|
|
@ApiOperationSupport(order = 10)
|
|
|
@ApiOperation(value = "公式交互面板", notes = "公式交互面板")
|
|
@@ -326,43 +344,22 @@ public class FormulaController {
|
|
|
Formula formula = this.service.getById(keyMapper.getFormulaId());
|
|
|
/*临时处理,等确定数据结构在优化*/
|
|
|
if(formula.getFormula().contains(".option")){
|
|
|
- result.put("type","radio");
|
|
|
- result.put("scope",0);
|
|
|
- Map<String,Object> info = new LinkedHashMap<>();
|
|
|
- result.put("info",info);
|
|
|
+ JSONObject jo =JSON.parseObject(TEMPLATE);
|
|
|
+ jo.put("scope",0);
|
|
|
+ JSONObject info =jo.getJSONObject("info");
|
|
|
info.put("label","是否引用公式数据");
|
|
|
- List<Map<String,Object>> value = new ArrayList<>();
|
|
|
- info.put("value",value);
|
|
|
- Map<String,Object> y=new LinkedHashMap<>();
|
|
|
- Map<String,Object> n=new LinkedHashMap<>();
|
|
|
- value.add(y);
|
|
|
- value.add(n);
|
|
|
- y.put("label","是");
|
|
|
- y.put("value",1);
|
|
|
- n.put("label","否");
|
|
|
- n.put("value",0);
|
|
|
/*针对元素级别*/
|
|
|
List<Map<String,Object>> mapList=this.jdbcTemplate.queryForList("select id,parent_id parentId,table_id pKeyId,val value,e_key ekey,contract_id contractId,scope from m_formula_option where scope=0 and parent_id ="+fo.getParentId()+" and e_key='"+key+"' and contract_id="+fo.getContractId());
|
|
|
if(Func.isNotEmpty(mapList)){
|
|
|
- result.put("data",mapList.get(0));
|
|
|
+ info.put("data",mapList.get(0));
|
|
|
}
|
|
|
+ return R.data(jo);
|
|
|
}else if (StringUtils.isEquals("MILE",formula.getNumber())){
|
|
|
if(StringUtils.isEquals(key,formula.getRelyList().get(0).split(StringPool.COLON)[1])){
|
|
|
- result.put("type","radio");
|
|
|
- result.put("scope",1);
|
|
|
- Map<String,Object> info = new LinkedHashMap<>();
|
|
|
- result.put("info",info);
|
|
|
+ JSONObject jo =JSON.parseObject(TEMPLATE);
|
|
|
+ jo.put("scope",1);
|
|
|
+ JSONObject info =jo.getJSONObject("info");
|
|
|
info.put("label","竖直方向");
|
|
|
- List<Map<String,Object>> value = new ArrayList<>();
|
|
|
- info.put("value",value);
|
|
|
- Map<String,Object> y=new LinkedHashMap<>();
|
|
|
- Map<String,Object> n=new LinkedHashMap<>();
|
|
|
- value.add(y);
|
|
|
- value.add(n);
|
|
|
- y.put("label","是");
|
|
|
- y.put("value",1);
|
|
|
- n.put("label","否");
|
|
|
- n.put("value",0);
|
|
|
List<Map<String,Object>> mapList=this.jdbcTemplate.queryForList("select id,parent_id parentId,table_id pKeyId,val value,e_key ekey,contract_id contractId,scope from m_formula_option where scope=1 and table_id="+fo.getPKeyId()+" and parent_id ="+fo.getParentId()+" and e_key='"+key+"' and contract_id="+fo.getContractId());
|
|
|
if(Func.isNotEmpty(mapList)){
|
|
|
result.put("data",mapList.get(0));
|