|
@@ -316,7 +316,7 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
}
|
|
|
}
|
|
|
public FormData createFormDataFast(String name,String code,String values){
|
|
|
- if(StringUtils.isNotEmpty(code,values)){
|
|
|
+ if(StringUtils.isNotEmpty(code,name)){
|
|
|
String[] arr=code.split(":");
|
|
|
String coords = tec.getCoordinateMap().get(arr[0]).get(arr[1]);
|
|
|
List<Coords> coordsList = Stream.of(coords).flatMap(s -> Arrays.stream(s.split(";"))).map(s -> {
|
|
@@ -347,8 +347,10 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ }else{
|
|
|
+ eds =coordsList.stream().map(c->new ElementData(0,0,null,c.getX(),c.getY())).collect(Collectors.toList());
|
|
|
}
|
|
|
- FormData one= new FormData(code,eds, null,StringPool.EMPTY);
|
|
|
+ FormData one= new FormData(code,eds, null,coords);
|
|
|
one.setEName(name);
|
|
|
return one;
|
|
|
}
|
|
@@ -545,7 +547,7 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
}
|
|
|
if(local.size()>0){
|
|
|
List<Object> values = slice(local,this.constantMap,f);
|
|
|
- write(fd,values);
|
|
|
+ FormulaUtils.write(fd,values,true);
|
|
|
}
|
|
|
}else{
|
|
|
Map<String,Object> em = (Map<String, Object>) currentMap.computeIfAbsent(E,(k)-> new HashMap<>());
|
|
@@ -589,7 +591,7 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
List<AppWbsTreeContractVO> subTabList = this.tec.getTableAll().stream().filter(e -> e.getNodeName().contains("附表")).collect(Collectors.toList());
|
|
|
if (subTabList.size() == 0) {
|
|
|
boolean pd=tec.getTableAll().stream().anyMatch(e->e.getNodeName().contains("评定表")||e.getFullName().contains("评定表"));
|
|
|
- WbsTreePrivate sub = wbsTreePrivateService.getOne(Wrappers.<WbsTreePrivate>lambdaQuery().and(e->e.eq(WbsTreePrivate::getNodeName, pd?"质量检验评定表(附表)":"质量检验表(附表)").or().eq(WbsTreePrivate::getFullName, pd?"质量检验评定表(附表)":"质量检验表(附表)")).eq(WbsTreePrivate::getProjectId, tec.getProjectId()));
|
|
|
+ WbsTreePrivate sub = wbsTreePrivateService.getOne(Wrappers.<WbsTreePrivate>lambdaQuery().and(e->e.eq(WbsTreePrivate::getNodeName, pd?"质量检验评定表(附表)":"质量检验表(附表)").or().eq(WbsTreePrivate::getFullName, pd?"质量检验评定表(附表)":"质量检验表(附表)")).eq(WbsTreePrivate::getProjectId, tec.getProjectId()).eq(WbsTreePrivate::getIsLinkTable,2));
|
|
|
if (sub == null) {
|
|
|
this.tec.getLog().append("该项目没有挂有附表信息");
|
|
|
} else {
|
|
@@ -597,6 +599,9 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
AppWbsTreeContractVO one = this.tec.getTableAll().get(0);
|
|
|
WbsTreeContract wtc = this.wbsTreeContractService.getOne(Wrappers.<WbsTreeContract>lambdaQuery().eq(WbsTreeContract::getParentId, one.getParentId()).eq(WbsTreeContract::getWbsId, one.getWbsId()).and(e->e.eq(WbsTreeContract::getNodeName, pd?"质量检验评定表(附表)":"质量检验表(附表)").or().eq(WbsTreeContract::getFullName, pd?"质量检验评定表(附表)":"质量检验表(附表)")));
|
|
|
if (wtc != null) {
|
|
|
+ /*附表的顺序在检验单或者评定表之后*/
|
|
|
+ int sort=this.tec.getTableAll().stream().filter(e -> e.getNodeName().contains("检验单") || e.getNodeName().contains("评定表")).map(AppWbsTreeContractVO::getSort).max(Integer::compareTo).orElse(30);
|
|
|
+ this.wbsTreeContractService.update(Wrappers.<WbsTreeContract>lambdaUpdate().set(WbsTreeContract::getSort,++sort).eq(WbsTreeContract::getPKeyId,wtc.getPKeyId()));
|
|
|
/*只需要挂载一张*/
|
|
|
AppWbsTreeContractVO obj = BeanUtil.copy(wtc, AppWbsTreeContractVO.class);
|
|
|
this.tec.getTableAll().add(obj);
|
|
@@ -616,6 +621,15 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
dataArray.add(data1);
|
|
|
}
|
|
|
List<TableInfo> subTableInfo = FormulaUtils.getTableInfoList(dataArray);
|
|
|
+ TableInfo example = tec.getTableInfoList().get(0);
|
|
|
+ subTableInfo.forEach(e -> {
|
|
|
+ e.setToBeUpdated(true);
|
|
|
+ e.setBusinessId(null);
|
|
|
+ e.setContractId(example.getContractId());
|
|
|
+ e.setClassify(example.getClassify());
|
|
|
+ e.setProjectId(example.getProjectId());
|
|
|
+ e.setGroupId(example.getGroupId());
|
|
|
+ });
|
|
|
tec.getTableInfoList().addAll(subTableInfo);
|
|
|
/*获取附表元素定位集*/
|
|
|
tec.getCoordinateMap().put(subTabList.get(0).getInitTableName(), CustomFunction.getElementCell(first.getHtmlUrl()));
|
|
@@ -649,7 +663,8 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
List<FormData> subTableFds=this.formDataMap.values().stream().filter(e->StringUtils.isEquals(first.getInitTableName(),e.getTableName())).collect(Collectors.toList());
|
|
|
/*初始化附表对象*/
|
|
|
SubTable sta=new SubTable(subTableFds);
|
|
|
-
|
|
|
+ /*根据行号排序*/
|
|
|
+ inspectionList.sort(Comparator.comparingInt(e->e.getCoordsList().get(0).getY()));
|
|
|
inspectionList.forEach(f -> {
|
|
|
/*检验单或者评定表存的超页数据汇总到附表对象*/
|
|
|
List<ElementData> overList = f.getValues().stream().skip(f.getCoordsList().size()).collect(Collectors.toList());
|
|
@@ -660,9 +675,9 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
/*同项目*/
|
|
|
Optional<FormData> designFdOp= this.formDataMap.values().stream().filter(o->o.getTableName().equals(f.getTableName())&&StringUtils.isEquals(itemName,FormulaUtils.parseItemName(o.getEName()))&&o.getEName().contains("设计值")&&!o.getEName().contains("判定")).findAny();
|
|
|
if(designFdOp.isPresent()){
|
|
|
- key+="@"+designFdOp.get().getValues().stream().map(ElementData::stringValue).filter(StringUtils::isNotEmpty).findAny().orElse("");
|
|
|
+ key+="@"+designFdOp.get().getValues().stream().map(ElementData::getValue).filter(StringUtils::isNotEmpty).findAny().orElse("");
|
|
|
}
|
|
|
- sta.put(key,overList);
|
|
|
+ sta.put(key,setScale(2,overList));
|
|
|
});
|
|
|
if(sta.checked()){
|
|
|
/*把附表数据刷入对应的附表元素对象*/
|
|
@@ -745,7 +760,13 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
+public List<ElementData> setScale(Integer scale,List<ElementData> data){
|
|
|
+ if(scale==null){
|
|
|
+ scale=2;
|
|
|
+ }
|
|
|
+ Integer finalScale = scale;
|
|
|
+ return data.stream().peek(e->{if(StringUtils.isDouble(e.getValue())){e.setValue(StringUtils.number2String(e.getValue(),finalScale));}}).collect(Collectors.toList());
|
|
|
+}
|
|
|
|
|
|
@Override
|
|
|
public void format() {
|
|
@@ -753,14 +774,15 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
for(FormData fd:this.formDataList){
|
|
|
if(fd.verify()){
|
|
|
/*保留小数位*/
|
|
|
- if(!fd.empty()&&fd.getValues().stream().map(ElementData::getValue).anyMatch(StringUtils::isDouble)){
|
|
|
+ if(fd.getFormula()!=null&&!fd.empty()&&fd.getValues().stream().map(ElementData::getValue).anyMatch(StringUtils::isDouble)){
|
|
|
Formula f = fd.getFormula();
|
|
|
- Integer scale =f.getScale();
|
|
|
- if(scale==null){
|
|
|
- scale=2;
|
|
|
- }
|
|
|
- Integer finalScale = scale;
|
|
|
- fd.setValues(fd.getValues().stream().peek(e->{if(StringUtils.isDouble(e.getValue())){e.setValue(StringUtils.number2String(e.getValue(),finalScale));}}).collect(Collectors.toList()));
|
|
|
+ fd.setValues(setScale(f.getScale(),fd.getValues()));
|
|
|
+// Integer scale =f.getScale();
|
|
|
+// if(scale==null){
|
|
|
+// scale=2;
|
|
|
+// }
|
|
|
+// Integer finalScale = scale;
|
|
|
+// fd.setValues(fd.getValues().stream().peek(e->{if(StringUtils.isDouble(e.getValue())){e.setValue(StringUtils.number2String(e.getValue(),finalScale));}}).collect(Collectors.toList()));
|
|
|
}
|
|
|
}
|
|
|
}
|