|
@@ -139,33 +139,55 @@ public class MixProportionInfoServiceImpl extends BaseServiceImpl<MixProportionI
|
|
String url = baseMapper.getExcelUrlByPKeyId(dto.getKeyId());
|
|
String url = baseMapper.getExcelUrlByPKeyId(dto.getKeyId());
|
|
// 读取html页面信息
|
|
// 读取html页面信息
|
|
File file1 = ResourceUtil.getFile(url);
|
|
File file1 = ResourceUtil.getFile(url);
|
|
-// File file1 = ResourceUtil.getFile("C:\\Users\\泓创研发01\\Desktop\\privateUrl\\1694957051815395328.html");
|
|
|
|
|
|
+// File file1 = ResourceUtil.getFile("C:\\Users\\泓创研发01\\Desktop\\privateUrl\\1696079664109322240.html");
|
|
FileInputStream inputStream = new FileInputStream(file1);
|
|
FileInputStream inputStream = new FileInputStream(file1);
|
|
String htmlString = IoUtil.readToString(inputStream);
|
|
String htmlString = IoUtil.readToString(inputStream);
|
|
Document doc = Jsoup.parse(htmlString);
|
|
Document doc = Jsoup.parse(htmlString);
|
|
Element table = doc.select("table").first();
|
|
Element table = doc.select("table").first();
|
|
Elements td = table.select("td");
|
|
Elements td = table.select("td");
|
|
- Boolean isFiled = false;
|
|
|
|
- String key = "";
|
|
|
|
|
|
+ String key1 = "";
|
|
|
|
+ String key2 = "";
|
|
|
|
+ String key3 = "";
|
|
|
|
+ String key4 = "";
|
|
|
|
+ String key5 = "";
|
|
|
|
+ String key6 = "";
|
|
|
|
+ String key7 = "";
|
|
|
|
+ String key8 = "";
|
|
|
|
+ String key9 = "";
|
|
for (Element element : td) {
|
|
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 (element.childNodes().size() >= 2) {
|
|
|
|
+ String str = element.childNodes().get(1).attr("placeholder");
|
|
|
|
+ if (StringUtils.isNotBlank(str) && str.equals("施工配合比_每立方米混凝土材料用量(kg)_水泥")) {
|
|
|
|
+ key1 = element.childNodes().get(1).attr("keyname");
|
|
|
|
+ }
|
|
|
|
+ if (StringUtils.isNotBlank(str) && str.equals("施工配合比_每立方米混凝土材料用量(kg)_碎(卵)石1")) {
|
|
|
|
+ key2 = element.childNodes().get(1).attr("keyname");
|
|
|
|
+ }
|
|
|
|
+ if (StringUtils.isNotBlank(str) && str.equals("施工配合比_每立方米混凝土材料用量(kg)_碎(卵)石2")) {
|
|
|
|
+ key3 = element.childNodes().get(1).attr("keyname");
|
|
|
|
+ }
|
|
|
|
+ if (StringUtils.isNotBlank(str) && str.equals("施工配合比_每立方米混凝土材料用量(kg)_碎(卵)石3")) {
|
|
|
|
+ key4 = element.childNodes().get(1).attr("keyname");
|
|
|
|
+ }
|
|
|
|
+ if (StringUtils.isNotBlank(str) && str.equals("施工配合比_每立方米混凝土材料用量(kg)_砂")) {
|
|
|
|
+ key5 = element.childNodes().get(1).attr("keyname");
|
|
|
|
+ }
|
|
|
|
+ if (StringUtils.isNotBlank(str) && str.equals("施工配合比_每立方米混凝土材料用量(kg)_水")) {
|
|
|
|
+ key6 = element.childNodes().get(1).attr("keyname");
|
|
|
|
+ }
|
|
|
|
+ if (StringUtils.isNotBlank(str) && str.equals("施工配合比_每立方米混凝土材料用量(kg)_外掺(料)剂1")) {
|
|
|
|
+ key7 = element.childNodes().get(1).attr("keyname");
|
|
|
|
+ }
|
|
|
|
+ if (StringUtils.isNotBlank(str) && str.equals("施工配合比_每立方米混凝土材料用量(kg)_外掺(料)剂2")) {
|
|
|
|
+ key8 = element.childNodes().get(1).attr("keyname");
|
|
|
|
+ }
|
|
|
|
+ if (StringUtils.isNotBlank(str) && str.equals("施工配合比_每立方米混凝土材料用量(kg)_外掺(料)剂3")) {
|
|
|
|
+ key9 = element.childNodes().get(1).attr("keyname");
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+
|
|
}
|
|
}
|
|
- if (!isFiled){
|
|
|
|
- inputStream.close();
|
|
|
|
- return R.data(null);
|
|
|
|
- }
|
|
|
|
- //获取位置前缀后缀
|
|
|
|
- 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]);
|
|
|
|
|
|
+
|
|
//结果集
|
|
//结果集
|
|
Map<String,BigDecimal> map = new HashMap<>();
|
|
Map<String,BigDecimal> map = new HashMap<>();
|
|
//获取配合比信息
|
|
//获取配合比信息
|
|
@@ -186,49 +208,67 @@ public class MixProportionInfoServiceImpl extends BaseServiceImpl<MixProportionI
|
|
sand = dto.getSand().divide(new BigDecimal(100)).multiply(info.getSand());
|
|
sand = dto.getSand().divide(new BigDecimal(100)).multiply(info.getSand());
|
|
//黄砂
|
|
//黄砂
|
|
BigDecimal sand2 = info.getSand().add(sand);
|
|
BigDecimal sand2 = info.getSand().add(sand);
|
|
- map.put(prefix + "__" + s1 + "_" + (s2 + 1), sand2);
|
|
|
|
|
|
+ if (StringUtils.isNotBlank(key5)) {
|
|
|
|
+ map.put(key5, sand2);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
//碎石1
|
|
//碎石1
|
|
if (dto.getMacadamOne() != null) {
|
|
if (dto.getMacadamOne() != null) {
|
|
macadamOne = dto.getMacadamOne().divide(new BigDecimal(100)).multiply(info.getMacadamOne());
|
|
macadamOne = dto.getMacadamOne().divide(new BigDecimal(100)).multiply(info.getMacadamOne());
|
|
//碎石1
|
|
//碎石1
|
|
BigDecimal macadamOne2 = info.getMacadamOne().add(macadamOne);
|
|
BigDecimal macadamOne2 = info.getMacadamOne().add(macadamOne);
|
|
- map.put(prefix + "__" +s1 + "_" +(s2+2),macadamOne2);
|
|
|
|
|
|
+ if (StringUtils.isNotBlank(key2)) {
|
|
|
|
+ map.put(key2, macadamOne2);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
//碎石2
|
|
//碎石2
|
|
if (dto.getMacadamTwo() != null) {
|
|
if (dto.getMacadamTwo() != null) {
|
|
macadamTwo = dto.getMacadamTwo().divide(new BigDecimal(100)).multiply(info.getMacadamTwo());
|
|
macadamTwo = dto.getMacadamTwo().divide(new BigDecimal(100)).multiply(info.getMacadamTwo());
|
|
//碎石2
|
|
//碎石2
|
|
BigDecimal macadamTwo2 = info.getMacadamTwo().add(macadamTwo);
|
|
BigDecimal macadamTwo2 = info.getMacadamTwo().add(macadamTwo);
|
|
- map.put(prefix + "__" +s1 + "_" +(s2+3),macadamTwo2);
|
|
|
|
|
|
+ if (StringUtils.isNotBlank(key3)) {
|
|
|
|
+ map.put(key3, macadamTwo2);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
//碎石3
|
|
//碎石3
|
|
if (dto.getMacadamThree() != null) {
|
|
if (dto.getMacadamThree() != null) {
|
|
macadamThree = dto.getMacadamThree().divide(new BigDecimal(100)).multiply(info.getMacadamThree());
|
|
macadamThree = dto.getMacadamThree().divide(new BigDecimal(100)).multiply(info.getMacadamThree());
|
|
//碎石3
|
|
//碎石3
|
|
BigDecimal macadamThree2 = info.getMacadamThree().add(macadamThree);
|
|
BigDecimal macadamThree2 = info.getMacadamThree().add(macadamThree);
|
|
- map.put(prefix + "__" +s1 + "_" +(s2+4),macadamThree2);
|
|
|
|
|
|
+ if (StringUtils.isNotBlank(key4)) {
|
|
|
|
+ map.put(key4, macadamThree2);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
//施工配合比计算
|
|
//施工配合比计算
|
|
//水泥
|
|
//水泥
|
|
BigDecimal cement = info.getCement();
|
|
BigDecimal cement = info.getCement();
|
|
- map.put(prefix + "__" +s1 + "_" +(s2),cement);
|
|
|
|
|
|
+ if (StringUtils.isNotBlank(key1)) {
|
|
|
|
+ map.put(key1, cement);
|
|
|
|
+ }
|
|
|
|
|
|
//水
|
|
//水
|
|
if (dto.getSand() != null && dto.getMacadamOne() != null && dto.getMacadamTwo() != null && dto.getMacadamThree() != null) {
|
|
if (dto.getSand() != null && dto.getMacadamOne() != null && dto.getMacadamTwo() != null && dto.getMacadamThree() != null) {
|
|
BigDecimal water = info.getWater().subtract(sand).subtract(macadamOne).subtract(macadamTwo).subtract(macadamThree);
|
|
BigDecimal water = info.getWater().subtract(sand).subtract(macadamOne).subtract(macadamTwo).subtract(macadamThree);
|
|
- map.put(prefix + "__" + s1 + "_" + (s2 + 5), water);
|
|
|
|
|
|
+ if (StringUtils.isNotBlank(key6)) {
|
|
|
|
+ map.put(key6, water);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
//掺加剂
|
|
//掺加剂
|
|
BigDecimal admixture = info.getAdmixture();
|
|
BigDecimal admixture = info.getAdmixture();
|
|
- map.put(prefix + "__" +s1 + "_" +(s2+6),admixture);
|
|
|
|
|
|
+ if (StringUtils.isNotBlank(key7)) {
|
|
|
|
+ map.put(key7, admixture);
|
|
|
|
+ }
|
|
//粉煤灰
|
|
//粉煤灰
|
|
BigDecimal coalAsh = info.getCoalAsh();
|
|
BigDecimal coalAsh = info.getCoalAsh();
|
|
- map.put(prefix + "__" +s1 + "_" +(s2+7),coalAsh);
|
|
|
|
|
|
+ if (StringUtils.isNotBlank(key8)) {
|
|
|
|
+ map.put(key8, coalAsh);
|
|
|
|
+ }
|
|
//矿渣粉
|
|
//矿渣粉
|
|
BigDecimal slagPowder = info.getSlagPowder();
|
|
BigDecimal slagPowder = info.getSlagPowder();
|
|
- map.put(prefix + "__" +s1 + "_" +(s2+8),slagPowder);
|
|
|
|
|
|
+ if (StringUtils.isNotBlank(key9)) {
|
|
|
|
+ map.put(key9, slagPowder);
|
|
|
|
+ }
|
|
inputStream.close();
|
|
inputStream.close();
|
|
return R.data(map);
|
|
return R.data(map);
|
|
}
|
|
}
|