|
@@ -231,9 +231,9 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
if (!StringUtils.isEquals("[]", fdb.getVal())) {
|
|
if (!StringUtils.isEquals("[]", fdb.getVal())) {
|
|
List<ElementBlock> elementBlockList = JSON.parseArray(fdb.getVal(), ElementBlock.class);
|
|
List<ElementBlock> elementBlockList = JSON.parseArray(fdb.getVal(), ElementBlock.class);
|
|
Map<String, Measurement> itemsMap = new HashMap<>();
|
|
Map<String, Measurement> itemsMap = new HashMap<>();
|
|
- this.formDataMap.values().forEach(e -> {
|
|
|
|
|
|
+ this.formDataMap.values().stream().filter(FormData::getIsCurrentNodeElement).forEach(e -> {
|
|
String eName = e.getEName();
|
|
String eName = e.getEName();
|
|
- if (eName.contains("实测") && !eName.contains("平均") && !eName.contains("率") && !eName.contains("判")) {
|
|
|
|
|
|
+ if (eName.contains("实测") && !eName.contains("平均") && !eName.contains("合格率") && !eName.contains("判")) {
|
|
String point = FormulaUtils.parseItemName(eName);
|
|
String point = FormulaUtils.parseItemName(eName);
|
|
/*评定匹配检验单的元素用相似匹配*/
|
|
/*评定匹配检验单的元素用相似匹配*/
|
|
Measurement measurement = itemsMap.computeIfAbsent(point, k -> new Measurement(point));
|
|
Measurement measurement = itemsMap.computeIfAbsent(point, k -> new Measurement(point));
|
|
@@ -242,11 +242,11 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
});
|
|
});
|
|
if (itemsMap.size() > 0) {
|
|
if (itemsMap.size() > 0) {
|
|
/*表内用同行匹配*/
|
|
/*表内用同行匹配*/
|
|
- List<FormData> primary = tec.getFormDataMap().values().stream().filter(v -> v.getEName().contains("率") || v.getEName().contains("判")).collect(Collectors.toList());
|
|
|
|
|
|
+ List<FormData> primary = tec.getFormDataMap().values().stream().filter(FormData::getIsCurrentNodeElement).filter(v -> v.getEName().contains("率") || v.getEName().contains("判")).collect(Collectors.toList());
|
|
itemsMap.values().forEach(i -> {
|
|
itemsMap.values().forEach(i -> {
|
|
FormData vf = i.getValue();
|
|
FormData vf = i.getValue();
|
|
primary.stream().filter(p -> vf.getMaxRow().equals(p.getMaxRow()) && vf.getTableName().equals(p.getTableName())).forEach(t -> {
|
|
primary.stream().filter(p -> vf.getMaxRow().equals(p.getMaxRow()) && vf.getTableName().equals(p.getTableName())).forEach(t -> {
|
|
- if (t.getEName().contains("率")) {
|
|
|
|
|
|
+ if (t.getEName().contains("合格率")) {
|
|
i.setPass(t);
|
|
i.setPass(t);
|
|
} else if (t.getEName().contains("判")) {
|
|
} else if (t.getEName().contains("判")) {
|
|
i.setJudge(t);
|
|
i.setJudge(t);
|
|
@@ -275,8 +275,9 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
if (g != null) {
|
|
if (g != null) {
|
|
List<ItemBlock> itemBlockList = g.getList();
|
|
List<ItemBlock> itemBlockList = g.getList();
|
|
int originSize = itemBlockList.size();
|
|
int originSize = itemBlockList.size();
|
|
- List<Long> ids = this.jdbcTemplate.queryForList("select b.p_key_id from m_wbs_tree_contract a join m_wbs_tree_contract b on (a.parent_id=b.parent_id and a.contract_id=b.contract_id) where a.p_key_id=" + tec.getCurrentNode().getPkId() + " and b.is_deleted=0 and b.node_type=6", Long.class);
|
|
|
|
- itemBlockList.removeIf(ik -> !ids.contains(ik.getPkeyId()));
|
|
|
|
|
|
+ /*过滤方法有问题*/
|
|
|
|
+// List<Long> ids = this.jdbcTemplate.queryForList("select b.p_key_id from m_wbs_tree_contract a join m_wbs_tree_contract b on (a.parent_id=b.parent_id and a.contract_id=b.contract_id) where a.p_key_id=" + tec.getCurrentNode().getPkId() + " and b.is_deleted=0 and b.node_type=6", Long.class);
|
|
|
|
+// itemBlockList.removeIf(ik -> !ids.contains(ik.getPkeyId()));
|
|
if (itemBlockList.size() > 0) {
|
|
if (itemBlockList.size() > 0) {
|
|
int total = itemBlockList.stream().mapToInt(ItemBlock::getSubTotal).sum();
|
|
int total = itemBlockList.stream().mapToInt(ItemBlock::getSubTotal).sum();
|
|
int passNum = itemBlockList.stream().mapToInt(ItemBlock::getSubPass).sum();
|
|
int passNum = itemBlockList.stream().mapToInt(ItemBlock::getSubPass).sum();
|
|
@@ -285,7 +286,7 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
if (passRate >= 60) {
|
|
if (passRate >= 60) {
|
|
FormulaUtils.write(t.getJudge(), "合格", false);
|
|
FormulaUtils.write(t.getJudge(), "合格", false);
|
|
}
|
|
}
|
|
- itemBlockList.sort(Comparator.comparingInt(a -> ids.indexOf(a.getPkeyId())));
|
|
|
|
|
|
+// itemBlockList.sort(Comparator.comparingInt(a -> ids.indexOf(a.getPkeyId())));
|
|
List<String> values = itemBlockList.stream().map(ItemBlock::getData).flatMap(v -> v.stream().flatMap(Collection::stream)).map(Object::toString).collect(Collectors.toList());
|
|
List<String> values = itemBlockList.stream().map(ItemBlock::getData).flatMap(v -> v.stream().flatMap(Collection::stream)).map(Object::toString).collect(Collectors.toList());
|
|
int scale = StringUtils.getScale(values);
|
|
int scale = StringUtils.getScale(values);
|
|
FormulaUtils.write(t.getValue(), values.stream().map(u -> StringUtils.number2String(u, scale)).collect(Collectors.toList()), true);
|
|
FormulaUtils.write(t.getValue(), values.stream().map(u -> StringUtils.number2String(u, scale)).collect(Collectors.toList()), true);
|
|
@@ -1212,7 +1213,11 @@ public List<ElementData> setScale(Integer scale,List<ElementData> data){
|
|
if(Func.isNotEmpty(listMap)){
|
|
if(Func.isNotEmpty(listMap)){
|
|
/*当前节点的某个元素存在多种作用域的公式,作用域范围越小优先级越高*/
|
|
/*当前节点的某个元素存在多种作用域的公式,作用域范围越小优先级越高*/
|
|
List<KeyMapper> list= listMap.stream().map(m->BeanUtil.toBean(m,KeyMapper.class)).collect(Collectors.toList());
|
|
List<KeyMapper> list= listMap.stream().map(m->BeanUtil.toBean(m,KeyMapper.class)).collect(Collectors.toList());
|
|
- String nodeIdStr=nodeIds.stream().map(Object::toString).collect(Collectors.joining(StringPool.COMMA));
|
|
|
|
|
|
+ String nodeIdStr=nodeIds.stream().map(Object::toString).distinct().collect(Collectors.joining(StringPool.COMMA));
|
|
|
|
+ if(Func.isBlank(nodeIdStr)){
|
|
|
|
+ /*暂时这么处理,严格上说要查找到项目级对应的节点*/
|
|
|
|
+ nodeIdStr="1";
|
|
|
|
+ }
|
|
List<Map<String,Object>> efMap= this.jdbcTemplate.queryForList("select element_id elementId,formula_id formulaId,scope " +
|
|
List<Map<String,Object>> efMap= this.jdbcTemplate.queryForList("select element_id elementId,formula_id formulaId,scope " +
|
|
"from m_element_formula_mapping " +
|
|
"from m_element_formula_mapping " +
|
|
"where element_id in(" + list.stream().map(KeyMapper::getFieldId).map(Func::toStr).collect(Collectors.joining(",")) + ") " +
|
|
"where element_id in(" + list.stream().map(KeyMapper::getFieldId).map(Func::toStr).collect(Collectors.joining(",")) + ") " +
|