|
@@ -38,10 +38,12 @@ import org.springblade.manager.vo.CurrentNode;
|
|
|
import org.springblade.manager.wrapper.FormulaWrapper;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.dao.EmptyResultDataAccessException;
|
|
|
+import org.springframework.http.HttpRequest;
|
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import springfox.documentation.annotations.ApiIgnore;
|
|
|
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
import javax.validation.constraints.NotNull;
|
|
|
import java.io.FileNotFoundException;
|
|
|
import java.net.UnknownHostException;
|
|
@@ -570,83 +572,7 @@ public class FormulaController {
|
|
|
return R.data(map);
|
|
|
}
|
|
|
|
|
|
- /* public R<Object> chartInit(@RequestBody ChartOption option){
|
|
|
- *//*1.获取公式配置,如果存在子公式,则一直查找到最终公式*//*
|
|
|
- *//*2.查找所有依赖元素的所有数据,按表单排序*//*
|
|
|
- *//*3.计算结果*//*
|
|
|
- *//*4.查找当前表对应返回配置模版结合计算结果生成option*//*
|
|
|
- Long pkeyId=option.getPkeyId();
|
|
|
- String id=option.getId();
|
|
|
- WbsTreePrivate wtp = this.wbsTreePrivateService.getOne(Wrappers.<WbsTreePrivate>lambdaQuery().eq(WbsTreePrivate::getPKeyId,pkeyId));
|
|
|
- if(wtp!=null&&Func.isNotEmpty(id)){
|
|
|
- *//*获取配置*//*
|
|
|
- List<Map<String,Object>> listMap= this.jdbcTemplate.queryForList("select content from m_formula_panel a join m_wbs_tree_private b on a.id=b.init_table_id where b.p_key_id="+pkeyId);
|
|
|
- if(Func.isNotEmpty(listMap)){
|
|
|
- JSONObject job = JSON.parseObject(listMap.get(0).get("content").toString());
|
|
|
- *//*获取关联数据*//*
|
|
|
- List<Map<String,Object>> configList= this.jdbcTemplate.queryForList("select d.rely ,b.e_key ekey from m_wbs_tree_private a join m_wbs_form_element b on a.init_table_id=b.f_id join m_element_formula_mapping c on b.id=c.element_id join m_formula d on c.formula_id=d.id where p_key_id="+wtp.getPKeyId()+" and b.is_deleted=0 and d.formula like 'FC.chart%' limit 1");
|
|
|
- if(Func.isNotEmpty(configList)){
|
|
|
- Map<String,Object> config =configList.get(0);
|
|
|
- String[] rely = Func.toStr(config.get("rely")).split(",");
|
|
|
- String ky=rely[0].split(":")[1];
|
|
|
- String kx=rely[1].split(":")[1];
|
|
|
- Map<String,Map<String,Object>> formMap = option.getData();
|
|
|
- List<Map<String,Object>> dataMap;
|
|
|
- if(formMap!=null&&formMap.size()>0){
|
|
|
- dataMap=new ArrayList<>();
|
|
|
- Map<String,Object> md= new HashMap<>();
|
|
|
- dataMap.add(md);
|
|
|
- StringBuilder sy= new StringBuilder();
|
|
|
- StringBuilder sx = new StringBuilder();
|
|
|
- formMap.forEach((o,t)->{
|
|
|
- t.forEach((k,v)->{
|
|
|
- String[] ka=k.split("__");
|
|
|
- if(ky.equals(ka[0])){
|
|
|
- sy.append(v).append("_^_").append(ka[1]).append("☆");
|
|
|
- }else if(kx.equals(ka[0])){
|
|
|
- sx.append(v).append("_^_").append(ka[1]).append("☆");
|
|
|
- }
|
|
|
- });
|
|
|
- });
|
|
|
- if(sy.length()>1){
|
|
|
- sy.deleteCharAt(sy.length()-1);
|
|
|
- }
|
|
|
- if(sx.length()>1){
|
|
|
- sx.deleteCharAt(sx.length()-1);
|
|
|
- }
|
|
|
- md.put(ky,sy.toString());
|
|
|
- md.put(kx,sx.toString());
|
|
|
- }else{
|
|
|
- dataMap= this.jdbcTemplate.queryForList("select "+ky+","+kx+" from "+wtp.getInitTableName() +" where group_id="+id+" and p_key_id ="+pkeyId);
|
|
|
- }
|
|
|
- if(Func.isNotEmpty(dataMap)){
|
|
|
- Map<String,Object> data = dataMap.get(0);
|
|
|
- String dy= Func.toStr(data.get(ky));
|
|
|
- String dx=Func.toStr(data.get(kx));
|
|
|
- if(dy.length()>0&&dx.length()>0){
|
|
|
- Map<String,String> coordsMap = FormulaUtils.getElementCell(wtp.getHtmlUrl());
|
|
|
- List<ElementData> ly = FormulaUtils.getElementDataList(coordsMap.get(ky),dy);
|
|
|
- List<ElementData> lx = FormulaUtils.getElementDataList(coordsMap.get(kx),dx);
|
|
|
- JSONArray jsonArray =new JSONArray();
|
|
|
- for(int i=0;i< Math.min(ly.size(),lx.size());i++){
|
|
|
- ElementData edy= ly.get(i);
|
|
|
- ElementData edx = lx.get(i);
|
|
|
- if(StringUtils.isNotEmpty(edy.stringValue(),edx.stringValue())){
|
|
|
- jsonArray.add(new JSONArray().fluentAdd(edx.numberValue()).fluentAdd(edy.numberValue()));;
|
|
|
- }
|
|
|
- }
|
|
|
- if(!jsonArray.isEmpty()){
|
|
|
- JSONObject chartData= job.getJSONArray("series").getJSONObject(0);
|
|
|
- chartData.put("data",jsonArray);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- return R.data(job);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- return R.data("{}");
|
|
|
- }*/
|
|
|
+
|
|
|
@PostMapping("/chart-init")
|
|
|
@ApiOperationSupport(order = 11)
|
|
|
public R<Object> chartInit(@RequestBody ChartOption option){
|
|
@@ -862,6 +788,7 @@ public class FormulaController {
|
|
|
return R.fail("失败");
|
|
|
}
|
|
|
|
|
|
+ /*按项目向m_wbs_tree_contract刷入is_type_private_pid字段*/
|
|
|
@GetMapping("/ref")
|
|
|
public R<Object> ref(Long projectId) {
|
|
|
if(!StringUtils.isNumber(projectId)){
|
|
@@ -938,6 +865,12 @@ public class FormulaController {
|
|
|
return this.service.evaluate(tablePkeyId);
|
|
|
}
|
|
|
|
|
|
+ /*根据p_key_id 获取各个元素的执行公式*/
|
|
|
+ @GetMapping("/formulaForNode")
|
|
|
+ public R<Object> formulaForNode(@NotNull Long pkeyId,String tableName,String elementName){
|
|
|
+ return R.data(this.service.formulasForNode(pkeyId,tableName, elementName));
|
|
|
+ }
|
|
|
+
|
|
|
@GetMapping("/test")
|
|
|
public R<Object> meter(Long contractId,Long periodId ,Integer type){
|
|
|
/* public List<ReportResult> execute3(Long contractId,Long periodId ,Integer type)*/
|
|
@@ -946,4 +879,5 @@ public class FormulaController {
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
}
|