|
@@ -1,5 +1,6 @@
|
|
|
package org.springblade.manager.service.impl;
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
@@ -47,8 +48,20 @@ public class MixProportionInfoServiceImpl extends BaseServiceImpl<MixProportionI
|
|
|
|
|
|
|
|
|
@Override
|
|
|
- public List<MixProportionInfo> designStrengthList(String searchValue,Long contractId) {
|
|
|
- return baseMapper.designStrengthList(searchValue,contractId);
|
|
|
+ public Map<String,Map<String,String>> designStrengthList(Long contractId,String key) {
|
|
|
+ //查询当前合同段所有的设计强度
|
|
|
+ List<String> list = baseMapper.designStrengthList(contractId);
|
|
|
+ if (list == null || list.size() <= 0){
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ Map<String,Map<String,String>> map = new HashMap<>();
|
|
|
+ //包装返回值
|
|
|
+ for (String l : list) {
|
|
|
+ Map<String,String> m = new HashMap<>();
|
|
|
+ m.put(key,l);
|
|
|
+ map.put(l,m);
|
|
|
+ }
|
|
|
+ return map;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -109,6 +122,9 @@ public class MixProportionInfoServiceImpl extends BaseServiceImpl<MixProportionI
|
|
|
*/
|
|
|
@Override
|
|
|
public R calculateWater(MoistureContentDTO dto) {
|
|
|
+ if (StringUtils.isBlank(dto.getDesignStrength())){
|
|
|
+ throw new ServiceException("请先选择设计强度");
|
|
|
+ }
|
|
|
//获取位置前缀后缀
|
|
|
String prefix= dto.getKey().replaceAll("__[\\d_]+", "");
|
|
|
String suffix = dto.getKey().replaceAll("key_\\d+__", "");
|
|
@@ -118,39 +134,56 @@ public class MixProportionInfoServiceImpl extends BaseServiceImpl<MixProportionI
|
|
|
//结果集
|
|
|
Map<String,BigDecimal> map = new HashMap<>();
|
|
|
//获取配合比信息
|
|
|
- MixProportionInfo info = this.getById(dto.getMixProportionId());
|
|
|
+ MixProportionInfo info = this.getOne(new LambdaQueryWrapper<MixProportionInfo>()
|
|
|
+ .eq(MixProportionInfo::getContractId,dto.getContractId())
|
|
|
+ .eq(MixProportionInfo::getDesignStrength,dto.getDesignStrength()));
|
|
|
if (info == null){
|
|
|
throw new ServiceException("获取配合比信息失败");
|
|
|
}
|
|
|
//含水量计算
|
|
|
+ BigDecimal sand = new BigDecimal(0);
|
|
|
+ BigDecimal macadamOne = new BigDecimal(0);
|
|
|
+ BigDecimal macadamTwo = new BigDecimal(0);
|
|
|
+ BigDecimal macadamThree = new BigDecimal(0);
|
|
|
//黄砂
|
|
|
- BigDecimal sand = dto.getSand().divide(new BigDecimal(100)).multiply(info.getSand());
|
|
|
+ if (dto.getSand() != null) {
|
|
|
+ sand = dto.getSand().divide(new BigDecimal(100)).multiply(info.getSand());
|
|
|
+ //黄砂
|
|
|
+ BigDecimal sand2 = info.getSand().add(sand);
|
|
|
+ map.put(prefix + "__" + s1 + "_" + (s2 + 1), sand2);
|
|
|
+ }
|
|
|
//碎石1
|
|
|
- BigDecimal macadamOne = dto.getMacadamOne().divide(new BigDecimal(100)).multiply(info.getMacadamOne());
|
|
|
+ if (dto.getMacadamOne() != null) {
|
|
|
+ macadamOne = dto.getMacadamOne().divide(new BigDecimal(100)).multiply(info.getMacadamOne());
|
|
|
+ //碎石1
|
|
|
+ BigDecimal macadamOne2 = info.getMacadamOne().add(macadamOne);
|
|
|
+ map.put(prefix + "__" +s1 + "_" +(s2+2),macadamOne2);
|
|
|
+ }
|
|
|
//碎石2
|
|
|
- BigDecimal macadamTwo = dto.getMacadamTwo().divide(new BigDecimal(100)).multiply(info.getMacadamTwo());
|
|
|
+ if (dto.getMacadamTwo() != null) {
|
|
|
+ macadamTwo = dto.getMacadamTwo().divide(new BigDecimal(100)).multiply(info.getMacadamTwo());
|
|
|
+ //碎石2
|
|
|
+ BigDecimal macadamTwo2 = info.getMacadamTwo().add(macadamTwo);
|
|
|
+ map.put(prefix + "__" +s1 + "_" +(s2+3),macadamTwo2);
|
|
|
+ }
|
|
|
//碎石3
|
|
|
- BigDecimal macadamThree = dto.getMacadamThree().divide(new BigDecimal(100)).multiply(info.getMacadamThree());
|
|
|
+ if (dto.getMacadamThree() != null) {
|
|
|
+ macadamThree = dto.getMacadamThree().divide(new BigDecimal(100)).multiply(info.getMacadamThree());
|
|
|
+ //碎石3
|
|
|
+ BigDecimal macadamThree2 = info.getMacadamThree().add(macadamThree);
|
|
|
+ map.put(prefix + "__" +s1 + "_" +(s2+4),macadamThree2);
|
|
|
+ }
|
|
|
|
|
|
//施工配合比计算
|
|
|
//水泥
|
|
|
BigDecimal cement = info.getCement();
|
|
|
map.put(prefix + "__" +s1 + "_" +(s2),cement);
|
|
|
- //黄砂
|
|
|
- BigDecimal sand2 = info.getSand().add(sand);
|
|
|
- map.put(prefix + "__" +s1 + "_" +(s2+1),sand2);
|
|
|
- //碎石1
|
|
|
- BigDecimal macadamOne2 = info.getMacadamOne().add(macadamOne);
|
|
|
- map.put(prefix + "__" +s1 + "_" +(s2+2),macadamOne2);
|
|
|
- //碎石2
|
|
|
- BigDecimal macadamTwo2 = info.getMacadamTwo().add(macadamTwo);
|
|
|
- map.put(prefix + "__" +s1 + "_" +(s2+3),macadamTwo2);
|
|
|
- //碎石3
|
|
|
- BigDecimal macadamThree2 = info.getMacadamThree().add(macadamThree);
|
|
|
- map.put(prefix + "__" +s1 + "_" +(s2+4),macadamThree2);
|
|
|
+
|
|
|
//水
|
|
|
- BigDecimal water = info.getWater().subtract(sand).subtract(macadamOne).subtract(macadamTwo).subtract(macadamThree);
|
|
|
- map.put(prefix + "__" +s1 + "_" +(s2+5),water);
|
|
|
+ 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);
|
|
|
+ map.put(prefix + "__" + s1 + "_" + (s2 + 5), water);
|
|
|
+ }
|
|
|
//掺加剂
|
|
|
BigDecimal admixture = info.getAdmixture();
|
|
|
map.put(prefix + "__" +s1 + "_" +(s2+6),admixture);
|