|
@@ -1871,9 +1871,25 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
return Collections.emptyList();
|
|
|
}
|
|
|
|
|
|
- /*获取*/
|
|
|
- private void listForMeter(Long projectId,Long pkeyId){
|
|
|
-
|
|
|
+ /*获取计量公式,计量表是被动加载的,也不存在表单,所以需要根据计量类型获取*/
|
|
|
+ private void listForMeter(List<FormData> curFormDatas,String projectId,String parentId){
|
|
|
+ List<WbsTreePrivate> wtpList= this.wbsTreePrivateMapper.selectList(Wrappers.<WbsTreePrivate>lambdaQuery().eq(WbsTreePrivate::getParentId,parentId));
|
|
|
+ /*元素Id,节点id*/
|
|
|
+ List<Map<String,Object>> efMap= this.jdbcTemplate.queryForList("select element_id elementId,formula_id formulaId,scope " +
|
|
|
+ "from m_element_formula_mapping " +
|
|
|
+ "where element_id in(" + curFormDatas.stream().map(FormData::getId).distinct().map(Func::toStr).collect(Collectors.joining(",")) + ") " +
|
|
|
+ "and is_deleted=0 " + " and ( scope<2 or (scope =10 and project_id = " + projectId + ") or (scope=20 and project_id =" + projectId + " and node_id in ("+wtpList.stream().map(WbsTreePrivate::getId).map(Objects::toString).collect(Collectors.joining(","))+")))");
|
|
|
+ setFormula2(curFormDatas,efMap);
|
|
|
+ List<Long> formulaIds = curFormDatas.stream().map(FormData::getFormulaId).distinct().collect(Collectors.toList());
|
|
|
+ if(formulaIds.size()>0) {
|
|
|
+ List<Formula> formulaList = this.listByIds(formulaIds);
|
|
|
+ if (formulaList.size() > 0) {
|
|
|
+ Map<Long, Formula> idMap = formulaList.stream().collect(Collectors.toMap(Formula::getId, f -> f, (p, n) -> n));
|
|
|
+ for (FormData fd : curFormDatas) {
|
|
|
+ fd.setFormula(idMap.get(fd.getFormulaId()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|
|
@@ -1900,6 +1916,8 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
private void setFormula2(List<FormData> list,List<Map<String,Object>> efMap){
|
|
|
if(Func.isNotEmpty(efMap)){
|
|
|
Map<Long,List<Map<String,Object>>> efGroup= efMap.stream().collect(Collectors.groupingBy(e->Func.toLong(e.get("elementId"))));
|
|
@@ -2505,13 +2523,14 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
|
|
|
String[] tabArr=new String[]{"计量报表","动员预付款报表","材料预付款报表"};
|
|
|
@Override
|
|
|
- public void execute3(Long contractId,Long periodId ,Integer type) {
|
|
|
+ public List<ReportResult> execute3(Long contractId,Long periodId ,Integer type) {
|
|
|
/*封面、支付申请单、付款申请表*/
|
|
|
ContractInfo contractInfo = this.contractInfoService.getById(contractId);
|
|
|
- Map<String,String> parent= this.getSqlOne("select wbs_id wbsId,CONCAT(ancestors,',',id) path from m_wbs_tree_private a where a.node_name='?' and a.project_id=?",Map.class,tabArr[type],contractInfo.getPId());
|
|
|
+ Map<String,String> parent= this.getSqlOne("select id,wbs_id wbsId,CONCAT(ancestors,',',id) path from m_wbs_tree_private a where a.node_name='?' and a.project_id=?",Map.class,tabArr[type],contractInfo.getPId());
|
|
|
List<NodeTable> tableList= this.getSqlList("select p_key_id pkeyId, node_name nodeName ,init_table_name initTableName,html_url htmlUrl from m_wbs_tree_private where ancestors like '?%' and LENGTH(html_url)>0 and is_deleted=0 and project_id=? and wbs_id=?",NodeTable.class,parent.get("path"),contractInfo.getPId(),parent.get("wbsId"));
|
|
|
Map<String,Map<String,String>> coordinateMap=tableList.stream().collect(Collectors.toMap(NodeTable::getInitTableName,m->FormulaUtils.getElementCell(m.getHtmlUrl()),(v1,v2)->v2));
|
|
|
List<FormData> processFds = this.createFormDataByTableName(String.join(",", ""));
|
|
|
+ listForMeter(processFds,contractInfo.getPId(),parent.get("id"));
|
|
|
TableElementConverter tec = new TableElementConverter(processFds,coordinateMap,tableList);
|
|
|
tec.setProjectId(Long.parseLong(contractInfo.getPId()));
|
|
|
tec.setContractId(contractInfo.getId());
|
|
@@ -2530,8 +2549,15 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
formulaHandleChains.add(new ExecutorFormat(tec));
|
|
|
formulaHandleChains.forEach(FormulaHandleChain::handle);
|
|
|
tec.after();
|
|
|
+ return tec.getReportResults();
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
public Map<String,Object> getBussDataInfo(Long pkeyId, int type, Boolean isFormLoading) {
|
|
|
/*需要加载表单公式的时候isFormLoading==true*/
|
|
|
Document document=null;
|