|
@@ -7,6 +7,10 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import javassist.runtime.DotClass;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
+import org.jsoup.Jsoup;
|
|
|
+import org.jsoup.nodes.Document;
|
|
|
+import org.jsoup.nodes.Element;
|
|
|
+import org.jsoup.select.Elements;
|
|
|
import org.springblade.common.utils.ForestNodeMergerEx;
|
|
|
import org.springblade.common.utils.SnowFlakeUtil;
|
|
|
import org.springblade.core.excel.util.ExcelUtil;
|
|
@@ -17,6 +21,8 @@ import org.springblade.core.tool.api.R;
|
|
|
import org.springblade.core.tool.constant.BladeConstant;
|
|
|
import org.springblade.core.tool.utils.BeanUtil;
|
|
|
import org.springblade.core.tool.utils.Func;
|
|
|
+import org.springblade.core.tool.utils.IoUtil;
|
|
|
+import org.springblade.core.tool.utils.ResourceUtil;
|
|
|
import org.springblade.manager.dto.ArchiveTreeContractAutoRuleMapDTO;
|
|
|
import org.springblade.manager.dto.ArchiveTreeDTO;
|
|
|
import org.springblade.manager.dto.ArchiveTreeSortDTO;
|
|
@@ -38,6 +44,9 @@ import org.springblade.manager.vo.WbsTreeVO2;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
+import java.io.File;
|
|
|
+import java.io.FileInputStream;
|
|
|
+import java.io.FileNotFoundException;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
@@ -121,13 +130,37 @@ public class MixProportionInfoServiceImpl extends BaseServiceImpl<MixProportionI
|
|
|
* @return
|
|
|
*/
|
|
|
@Override
|
|
|
- public R calculateWater(MoistureContentDTO dto) {
|
|
|
+ public R calculateWater(MoistureContentDTO dto) throws FileNotFoundException {
|
|
|
if (StringUtils.isBlank(dto.getDesignStrength())){
|
|
|
throw new ServiceException("请先选择设计强度");
|
|
|
}
|
|
|
+ //获取表单,获取配合比位置
|
|
|
+ String url = baseMapper.getExcelUrlByPKeyId(dto.getKeyId());
|
|
|
+ // 读取html页面信息
|
|
|
+ File file1 = ResourceUtil.getFile(url);
|
|
|
+// File file1 = ResourceUtil.getFile("C:\\Users\\泓创研发01\\Desktop\\privateUrl\\1694957051815395328.html");
|
|
|
+ FileInputStream inputStream = new FileInputStream(file1);
|
|
|
+ String htmlString = IoUtil.readToString(inputStream);
|
|
|
+ Document doc = Jsoup.parse(htmlString);
|
|
|
+ Element table = doc.select("table").first();
|
|
|
+ Elements td = table.select("td");
|
|
|
+ Boolean isFiled = false;
|
|
|
+ String key = "";
|
|
|
+ for (Element element : td) {
|
|
|
+ if (isFiled){
|
|
|
+ key = element.childNodes().get(1).attr("keyname");
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ if (com.baomidou.mybatisplus.core.toolkit.StringUtils.isNotBlank(element.text()) && element.text().equals("施工配合比")){
|
|
|
+ isFiled = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!isFiled){
|
|
|
+ return R.data(null);
|
|
|
+ }
|
|
|
//获取位置前缀后缀
|
|
|
- String prefix= dto.getKey().replaceAll("__[\\d_]+", "");
|
|
|
- String suffix = dto.getKey().replaceAll("key_\\d+__", "");
|
|
|
+ String prefix= key.replaceAll("__[\\d_]+", "");
|
|
|
+ String suffix = key.replaceAll("key_\\d+__", "");
|
|
|
String[] split = suffix.split("_");
|
|
|
String s1 = split[0];
|
|
|
Integer s2 = Integer.parseInt(split[1]);
|