|
@@ -1,13 +1,16 @@
|
|
|
package com.ruoyi.zdsz.service.impl;
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.ruoyi.common.core.domain.entity.SysDictData;
|
|
|
+import com.ruoyi.common.utils.StringUtils;
|
|
|
import com.ruoyi.common.utils.redis.RedisUtils;
|
|
|
import com.ruoyi.common.utils.spring.SpringUtils;
|
|
|
+import com.ruoyi.zdsz.domain.ZEngineeringMaterial;
|
|
|
import com.ruoyi.zdsz.domain.bo.ZEngineeringInfoBo;
|
|
|
import com.ruoyi.zdsz.domain.bo.ZEngineeringNodeBo;
|
|
|
import com.ruoyi.zdsz.domain.vo.*;
|
|
|
import com.ruoyi.zdsz.mapper.*;
|
|
|
-import com.ruoyi.zdsz.service.IZEngiineeringPhotoService;
|
|
|
import com.ruoyi.zdsz.service.IZEngineeringNodeService;
|
|
|
import com.ruoyi.zdsz.service.IZEngineeringWasteMaterialService;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
@@ -17,9 +20,12 @@ import org.springframework.web.context.request.RequestAttributes;
|
|
|
import org.springframework.web.context.request.RequestContextHolder;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
+import java.math.BigDecimal;
|
|
|
+import java.math.RoundingMode;
|
|
|
import java.util.*;
|
|
|
import java.util.concurrent.CompletableFuture;
|
|
|
import java.util.concurrent.ExecutionException;
|
|
|
+import java.util.concurrent.atomic.AtomicReference;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
@@ -45,13 +51,9 @@ public class ZEngineeringWasteMaterialServiceImpl implements IZEngineeringWasteM
|
|
|
private IZEngineeringNodeService izEngineeringNodeService;
|
|
|
|
|
|
@Resource
|
|
|
- private IZEngineeringNodeService nodeService;
|
|
|
-
|
|
|
- @Resource
|
|
|
- private IZEngiineeringPhotoService photoService;
|
|
|
-
|
|
|
+ private ZEngineeringMaterialMapper zEngineeringMaterialMapper;
|
|
|
@Resource
|
|
|
- private ZEngineeringCivilMapper zEngineeringCivilMapper;
|
|
|
+ private ZEnginMaterialQualityMapper zEnginMaterialQualityMapper;
|
|
|
|
|
|
/**
|
|
|
* 工业工程
|
|
@@ -135,12 +137,59 @@ public class ZEngineeringWasteMaterialServiceImpl implements IZEngineeringWasteM
|
|
|
nodeCheck.add(map);
|
|
|
}
|
|
|
zEngineeringWasteMaterialVo.setNodeCheck(nodeCheck);
|
|
|
-// for (int i = 0; i < zEngineeringNodeBos.size(); i++) {
|
|
|
-// ZEngineeringNodeBo nodeBo = zEngineeringNodeBos.get(i);
|
|
|
-// }
|
|
|
+ AtomicReference<Double> pesj = new AtomicReference<>(0.0);
|
|
|
+ AtomicReference<Double> gsj = new AtomicReference<>(0.0);
|
|
|
+ for (int i = 0; i < zEngineeringNodeBos.size(); i++) {
|
|
|
+ ZEngineeringNodeBo nodeBo = zEngineeringNodeBos.get(i);
|
|
|
+ for (ZEngineeringInfoBo info: nodeBo.getzEngineeringInfoBoList()) {
|
|
|
+ System.out.println(info.getzEngineeringMaterialBo());
|
|
|
+ LambdaQueryWrapper<ZEngineeringMaterial> lqw4 = Wrappers.lambdaQuery();
|
|
|
+ lqw4.eq(StringUtils.isNotBlank(info.getId()), ZEngineeringMaterial::getDetailsId, info.getId());
|
|
|
+ List<ZEngineeringMaterial> material= zEngineeringMaterialMapper.selectList(lqw4);
|
|
|
+ material.stream().forEach(item4->{
|
|
|
+ String type = zEnginMaterialQualityMapper.selectVoById(item4.getMaterialQuality()).getMaterialType();
|
|
|
+ if("0".equals(type)){
|
|
|
+ pesj.updateAndGet(v -> v + new BigDecimal(Double.toString(item4.getNumber())).doubleValue());
|
|
|
+ }else if("1".equals(type)){
|
|
|
+ gsj.updateAndGet(v -> v + new BigDecimal(Double.toString(item4.getNumber())).doubleValue());
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ Map pe = new HashMap(); // PE材料
|
|
|
+ pe.put("actuality", getRoundDouble(pesj.get(), 2)); // 实际
|
|
|
+ pe.put("anticipation", zEngineeringGYVo.getPePreset()); // 预计
|
|
|
+ pe.put("percentage", getRoundDouble(100 * pesj.get() / zEngineeringGYVo.getGcPreset(),2) + "%"); // 占比
|
|
|
+ Map iron = new HashMap(); // 钢材
|
|
|
+ iron.put("actuality", getRoundDouble(gsj.get(), 2)); // 实际
|
|
|
+ iron.put("anticipation", zEngineeringGYVo.getGcPreset()); // 预计
|
|
|
+ iron.put("percentage", getRoundDouble(100 * gsj.get() / zEngineeringGYVo.getGcPreset(),2) + "%"); // 占比
|
|
|
+ zEngineeringWasteMaterialVo.setMaterialPercentagePE(pe);
|
|
|
+ zEngineeringWasteMaterialVo.setMaterialPercentageIron(iron);
|
|
|
// zEngineeringWasteMaterialVo.setMaterialPercentagePE();
|
|
|
+
|
|
|
+
|
|
|
+// List<ZEngineeringInfo> info= zEngineeringInfoMapper.selectList(lqw3);
|
|
|
+// info.stream().forEach(item3->{
|
|
|
+// LambdaQueryWrapper<ZEngineeringMaterial> lqw4 = Wrappers.lambdaQuery();
|
|
|
+// lqw4.eq(StringUtils.isNotBlank(item3.getId()), ZEngineeringMaterial::getDetailsId, item3.getId());
|
|
|
+// List<ZEngineeringMaterial> material= zEngineeringMaterialMapper.selectList(lqw4);
|
|
|
+// material.stream().forEach(item4->{
|
|
|
+// String type = zEnginMaterialQualityMapper.selectVoById(item4.getMaterialQuality()).getMaterialType();
|
|
|
+// if("0".equals(type)){
|
|
|
+// item.setPesj(new BigDecimal(Double.toString(item.getPesj())).add(new BigDecimal(Double.toString(item4.getNumber()))).doubleValue());
|
|
|
+// }else if("1".equals(type)){
|
|
|
+// item.setGsj(new BigDecimal(Double.toString(item.getGsj())).add(new BigDecimal(Double.toString(item4.getNumber()))).doubleValue());
|
|
|
+// }
|
|
|
+// });
|
|
|
+// });
|
|
|
return zEngineeringWasteMaterialVo;
|
|
|
}
|
|
|
+
|
|
|
+ private double getRoundDouble(double d, int i){
|
|
|
+ return BigDecimal.valueOf(d).setScale(i, RoundingMode.HALF_UP).doubleValue();
|
|
|
+ }
|
|
|
+
|
|
|
private List<Map<String, Object>> ReViewGYList(List<ZEngineeringGYVo> list) {
|
|
|
Map<String, List<SysDictData>> sysDictMap = RedisUtils.getCacheMap("sys_dict");
|
|
|
IZEngineeringNodeService nodeService = SpringUtils.getBean(IZEngineeringNodeService.class);
|