|
@@ -50,10 +50,7 @@ import org.springblade.manager.mapper.FormulaMapper;
|
|
|
import org.springblade.manager.mapper.WbsTreeContractMapper;
|
|
|
import org.springblade.manager.mapper.WbsTreePrivateMapper;
|
|
|
import org.springblade.manager.service.*;
|
|
|
-import org.springblade.manager.utils.AmountToChineseConverter;
|
|
|
-import org.springblade.manager.utils.FileUtils;
|
|
|
-import org.springblade.manager.utils.PeriodContractUtil;
|
|
|
-import org.springblade.manager.utils.RandomNumberHolder;
|
|
|
+import org.springblade.manager.utils.*;
|
|
|
import org.springblade.manager.vo.*;
|
|
|
import org.springblade.meter.entity.*;
|
|
|
import org.springblade.meter.feign.*;
|
|
@@ -95,6 +92,8 @@ import java.util.stream.Collectors;
|
|
|
import java.util.stream.IntStream;
|
|
|
import java.util.stream.Stream;
|
|
|
|
|
|
+import static org.springblade.manager.utils.TableCoordinates.*;
|
|
|
+
|
|
|
/**
|
|
|
* @author yangyj
|
|
|
* @Date 2022/6/9 14:29
|
|
@@ -335,7 +334,7 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
if (tec.getTableAll().stream().anyMatch(e -> StringUtils.isEquals(e.getTableType(), 5))) {
|
|
|
/*评定节点*/
|
|
|
FormulaDataBlock fdb = findFdb(tec);
|
|
|
- if (!StringUtils.isEquals("[]", fdb.getVal())) {
|
|
|
+ if (!StringUtils.isEquals("[]", fdb.getVal())) { //不等于[]
|
|
|
List<ElementBlock> elementBlockList = JSON.parseArray(fdb.getVal(), ElementBlock.class);
|
|
|
Map<String, Map<String, Set<Long>>> traceMap = new HashMap<>();
|
|
|
Map<String, List<ElementBlock>> tableElementMap = new HashMap<>();
|
|
@@ -5444,8 +5443,8 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
if (StringUtils.isNumber(pkeyId)) {
|
|
|
/*节点信息*/
|
|
|
WtcEva wtcEva = this.getSqlOne(
|
|
|
- "select b.tree_code treeCode ,a.contract_id contractId,a.init_table_name initTableName,a.html_url htmlUrl ,a.node_name nodeName ,a.parent_id parentId " +
|
|
|
- "from m_wbs_tree_contract a join m_wbs_tree_contract b on (a.parent_id=b.id and a.contract_id=b.contract_id) where a.p_key_id ="
|
|
|
+ "select b.p_id as PId,b.tree_code treeCode ,a.contract_id contractId,a.init_table_name initTableName,a.html_url htmlUrl ,a.node_name nodeName ,a.parent_id parentId " +
|
|
|
+ "from m_wbs_tree_contract a join m_wbs_tree_contract b on (a.p_id=b.p_key_id and a.contract_id=b.contract_id) where a.p_key_id ="
|
|
|
+ pkeyId, WtcEva.class);
|
|
|
try {
|
|
|
if (wtcEva.isEva()) {
|
|
@@ -5456,11 +5455,13 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
FB02 fb02 = new FB02(processFds);
|
|
|
if (fb02.checked()) {
|
|
|
/*swId是分项评定的父节点Id*/
|
|
|
- List<FormulaDataBlock> formulaDataBlocks = this.getSqlList("select a.id,a.type,a.sw_id swId,a.contract_id contractId,a.val from m_formula_data_block a join (select parent_id from m_wbs_tree_contract where tree_code like '" + treeCode.getLast() + "%' and contract_id =" + wtcEva.getContractId() + " and major_data_type=2 and is_deleted=0 ORDER BY tree_code)b on a.sw_id=b.parent_id ", FormulaDataBlock.class);
|
|
|
- if (formulaDataBlocks != null && formulaDataBlocks.size() > 0) {
|
|
|
|
|
|
- /*就是分项工程节点的父节点名称*/
|
|
|
+ /// List<FormulaDataBlock> formulaDataBlocks = this.getSqlList("select DISTINCT a.id,a.type,a.sw_id swId,a.contract_id contractId,a.val from m_formula_data_block a,m_wbs_tree_contract b where a.sw_id=b.parent_id and b.contract_id ="+wtcEva.getContractId()+" and b.major_data_type=2 and b.is_deleted=0 and b.ancestors_p_id like '%"+wtcEva.getPId()+"%' ORDER BY b.sort ", FormulaDataBlock.class);
|
|
|
|
|
|
+ // 每次需要依赖于treeCode值
|
|
|
+ // List<FormulaDataBlock> formulaDataBlocks = this.getSqlList("select DISTINCT a.id,a.type,a.sw_id swId,a.contract_id contractId,a.val from m_formula_data_block a join (select parent_id from m_wbs_tree_contract where tree_code like '" + treeCode.getLast() + "%' and contract_id =" + wtcEva.getContractId() + " and major_data_type=2 and is_deleted=0 ORDER BY tree_code)b on a.sw_id=b.parent_id ", FormulaDataBlock.class);
|
|
|
+ /*if (formulaDataBlocks != null && formulaDataBlocks.size() > 0) {
|
|
|
+ *//*就是分项工程节点的父节点名称*//*
|
|
|
String swIds = formulaDataBlocks.stream().map(FormulaDataBlock::getSwId).map(Objects::toString).collect(Collectors.joining(","));
|
|
|
List<Map<String, Object>> listMaps = this.jdbcTemplate.queryForList("select id ,node_name nodeName,full_name fullName from m_wbs_tree_contract where is_deleted =0 and contract_id=" + wtcEva.getContractId() + " and id in(" + swIds + ")");
|
|
|
Map<String, String> swNameMap = new HashMap<>();
|
|
@@ -5468,10 +5469,11 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
swNameMap.putAll(listMaps.stream().collect(Collectors.toMap(m -> m.get("id").toString(), m -> m.get("fullName").toString(), (v1, v2) -> v2)));
|
|
|
}
|
|
|
fb02.source(formulaDataBlocks, swNameMap);
|
|
|
+
|
|
|
if (fb02.getDatas().size() > 0) {
|
|
|
Map<String, String> tableKeysCoordsMap = FormulaUtils.getElementCell(wtcEva.getHtmlUrl());
|
|
|
if (fb02.initFdCoords(tableKeysCoordsMap)) {
|
|
|
- /*根据数据长度,增减页数*/
|
|
|
+ *//*根据数据长度,增减页数*//*
|
|
|
List<WbsTreeContract> wtcList = this.adjustPageSize(fb02.getPageNum(), wtcEva, processFds);
|
|
|
if (fb02.flush(wtcList)) {
|
|
|
this.jdbcTemplate.batchUpdate(fb02.getSql(), fb02.getParams());
|
|
@@ -5479,7 +5481,86 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ }*/
|
|
|
+
|
|
|
+ // 重新优化
|
|
|
+ // String contSql = "SELECT p_key_id as pKeyId,node_name as fullName,init_table_name as initTableName,html_url as htmlUrl from m_wbs_tree_contract a where a.p_id in( select p_key_id from m_wbs_tree_contract b where b.contract_id ="+wtcEva.getContractId()+" and b.major_data_type=2 and b.is_deleted=0 and b.ancestors_p_id like '%"+wtcEva.getPId()+"%' ) and a.type=2 and node_name not like '%附表%' and LENGTH(a.html_url)>=10 and init_table_name is not null ";
|
|
|
+ String contSql = "SELECT p_key_id as pKeyId,p_id as pId,IFNULL(if(length(trim(full_name))>0, full_name, node_name), node_name) AS fullName,init_table_name as partitionCode,html_url as oldId,type,major_data_type as majorDataType from m_wbs_tree_contract where is_deleted=0 and ancestors_p_id like '%"+wtcEva.getPId()+"%' and contract_id ="+wtcEva.getContractId()+" ORDER BY sort ,full_name ";
|
|
|
+ List<WbsTreeContractLazyVO> allNode = this.getSqlList(contSql, WbsTreeContractLazyVO.class);
|
|
|
+ List<WbsTreeContractLazyVO> conNode= getAllChildNodesWithStream(wtcEva.getPId()+"",allNode);
|
|
|
+ //将conNode 转成Map对象
|
|
|
+ Map<Long, WbsTreeContractLazyVO> map = conNode.stream().collect(Collectors.toMap(WbsTreeContractLazyVO::getPKeyId, WbsTreeContractLazyVO -> WbsTreeContractLazyVO));
|
|
|
+ List<WbsTreeContractLazyVO> tableInfo = new ArrayList<>();
|
|
|
+ // String nodeName = "";
|
|
|
+ for (WbsTreeContractLazyVO info : conNode) {
|
|
|
+ /*if(info.getType()==1 && (info.getPId()+"").equals(wtcEva.getPId()+"") ){
|
|
|
+ nodeName=info.getFullName();
|
|
|
+ }*/
|
|
|
+ if(info.getType()==2){
|
|
|
+ WbsTreeContractLazyVO wbsTreeContractLazyVO = map.get(info.getPId());
|
|
|
+ // if(wbsTreeContractLazyVO!=null && wbsTreeContractLazyVO.getMajorDataType()!=null && wbsTreeContractLazyVO.getMajorDataType()==2 && info.getFullName().indexOf("附表")<0 && (info.getPKeyId()+"").equals("1861674943318589443")){
|
|
|
+ if(wbsTreeContractLazyVO!=null && wbsTreeContractLazyVO.getMajorDataType()!=null && wbsTreeContractLazyVO.getMajorDataType()==2 && info.getFullName().indexOf("附表")<0 ){
|
|
|
+ WbsTreeContractLazyVO wbsTreeC = map.get(wbsTreeContractLazyVO.getPId());
|
|
|
+ info.setTitle(wbsTreeC.getFullName());
|
|
|
+ tableInfo.add(info);
|
|
|
+ // System.out.println("---------"+nodeName+" "+info.getFullName());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // System.out.println(info.getFullName());
|
|
|
+ }
|
|
|
+ System.out.println("tableInfo:"+tableInfo);
|
|
|
+ for (WbsTreeContractLazyVO info : tableInfo) {
|
|
|
+ String htmlUrl = info.getOldId();
|
|
|
+ String tableName = info.getPartitionCode();
|
|
|
+ String pkeId = info.getPKeyId()+"";
|
|
|
+ Map<String, String> datainfo = getTableDataInfo(pkeId, tableName);
|
|
|
+ TableCoordinates data = new TableCoordinates();
|
|
|
+ if(pkeId.equals("1861674943318589443")){
|
|
|
+ System.out.println("123");
|
|
|
+ }
|
|
|
+ System.out.println("-------"+htmlUrl);
|
|
|
+ List<String> datt = data.getHtmlDataInfo(htmlUrl);
|
|
|
+
|
|
|
+ for (String d : datt) {
|
|
|
+ String[] split = d.split("_\\*_");
|
|
|
+ String hekey = split[0];
|
|
|
+ String name = split[1];
|
|
|
+ String hegezhi = split[3];
|
|
|
+ String hevalue = datainfo.get(hekey);
|
|
|
+ Item02 xm = new Item02();
|
|
|
+ xm.setName(name);
|
|
|
+ xm.setSubItem(info.getTitle());
|
|
|
+
|
|
|
+ if(name.contains("△")){
|
|
|
+ xm.setWeight(2);
|
|
|
+ }else{
|
|
|
+ xm.setWeight(1);
|
|
|
+ }
|
|
|
+ String fsValue = datainfo.get(hegezhi);
|
|
|
+ if( Func.isNotEmpty(fsValue) && fsValue.length()>=1){
|
|
|
+ xm.setPassRate(Func.toDouble(fsValue));
|
|
|
+ }
|
|
|
+
|
|
|
+ if( Func.isNotEmpty(hevalue) && hevalue.equals("合格")){
|
|
|
+ fb02.getDatas().add(xm);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ System.out.println(hevalue);
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
+ if (fb02.getDatas().size() > 0) {
|
|
|
+ Map<String, String> tableKeysCoordsMap = FormulaUtils.getElementCell(wtcEva.getHtmlUrl());
|
|
|
+ if (fb02.initFdCoords(tableKeysCoordsMap)) { /*根据数据长度,增减页数*/
|
|
|
+ List<WbsTreeContract> wtcList = this.adjustPageSize(fb02.getPageNum(), wtcEva, processFds);
|
|
|
+ if (fb02.flush(wtcList)) {
|
|
|
+ this.jdbcTemplate.batchUpdate(fb02.getSql(), fb02.getParams());
|
|
|
+ return R.success("成功");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
} else if (FB01.TABLE_NAME.equals(wtcEva.getInitTableName())) {
|
|
|
FB01 fb01 = new FB01(processFds);
|
|
@@ -5638,6 +5719,44 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
return R.fail("无数据");
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ // 获取所有子节点
|
|
|
+ public List<WbsTreeContractLazyVO> getAllChildNodesWithStream(String parentId, List<WbsTreeContractLazyVO> allNodes) {
|
|
|
+ List<WbsTreeContractLazyVO> children = new ArrayList<>();
|
|
|
+
|
|
|
+ // 筛选直接子节点
|
|
|
+ List<WbsTreeContractLazyVO> directChildren = allNodes.stream()
|
|
|
+ .filter(node -> parentId.equals(node.getPId()+""))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ // 递归处理每个子节点
|
|
|
+ for (WbsTreeContractLazyVO child : directChildren) {
|
|
|
+ children.add(child);
|
|
|
+ children.addAll(getAllChildNodesWithStream(child.getPKeyId()+"", allNodes));
|
|
|
+ }
|
|
|
+
|
|
|
+ return children;
|
|
|
+ }
|
|
|
+
|
|
|
+ public Map<String, String> getTableDataInfo(String PkeyId,String tableName) {
|
|
|
+ String sql = "select * from " + tableName +" where p_key_id="+PkeyId;
|
|
|
+ List<Map<String, Object>> mapList = jdbcTemplate.queryForList(sql);
|
|
|
+ Map<String, String> remap = new HashMap<>();
|
|
|
+ for (Map<String, Object> map : mapList) {
|
|
|
+ for (String key : map.keySet()) {
|
|
|
+ String[] keyData = (map.get(key)+"").split("☆");
|
|
|
+ if(keyData!=null && keyData.length>=1){
|
|
|
+ for(String keyData1:keyData){
|
|
|
+ if(keyData1.indexOf("_^_")>=0){
|
|
|
+ String[] keyData2 = keyData1.split("_\\^_");
|
|
|
+ remap.put(key+"__"+keyData2[1], keyData2[0]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return remap;
|
|
|
+ }
|
|
|
public Map<String, String> getWtpParent(String meterType, String projectId) {
|
|
|
Map<String, Object> map = this.jdbcTemplate.queryForMap("select id,wbs_id wbsId,CONCAT(ancestors,',',p_key_id) path from m_wbs_tree_private a where a.node_name=? and a.project_id=?", meterType, projectId);
|
|
|
Map<String, String> result = new HashMap<>();
|
|
@@ -6497,4 +6616,5 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
}
|
|
|
return wbsTreeContract;
|
|
|
}
|
|
|
+
|
|
|
}
|