|
@@ -0,0 +1,510 @@
|
|
|
|
+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.IZEngineeringNodeService;
|
|
|
|
+import com.ruoyi.zdsz.service.IZEngineeringWasteMaterialService;
|
|
|
|
+import lombok.RequiredArgsConstructor;
|
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
|
+import org.springframework.util.ObjectUtils;
|
|
|
|
+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;
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * 四大工程 耗材统计
|
|
|
|
+ *
|
|
|
|
+ * @author ruoyi
|
|
|
|
+ * @date 2024-01-02
|
|
|
|
+ */
|
|
|
|
+@RequiredArgsConstructor
|
|
|
|
+@Service
|
|
|
|
+public class ZEngineeringWasteMaterialServiceImpl implements IZEngineeringWasteMaterialService {
|
|
|
|
+
|
|
|
|
+ @Resource
|
|
|
|
+ private final ZEngineeringGYMapper gyMapper;
|
|
|
|
+ @Resource
|
|
|
|
+ private final ZEngineeringIndustryMapper baseMapper;
|
|
|
|
+ @Resource
|
|
|
|
+ private final ZEngineeringPipeJackingMapper pipeJackingMapper;
|
|
|
|
+ @Resource
|
|
|
|
+ private final ZTouchOperationEngineeringMapper touchOperationMapper;
|
|
|
|
+
|
|
|
|
+ @Resource
|
|
|
|
+ private IZEngineeringNodeService izEngineeringNodeService;
|
|
|
|
+
|
|
|
|
+ @Resource
|
|
|
|
+ private ZEngineeringMaterialMapper zEngineeringMaterialMapper;
|
|
|
|
+ @Resource
|
|
|
|
+ private ZEnginMaterialQualityMapper zEnginMaterialQualityMapper;
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 工业工程
|
|
|
|
+ * 工程分类 engin_classification
|
|
|
|
+ * 节点类型 gy_tyg 调压柜
|
|
|
|
+ * engineeringIndustry
|
|
|
|
+ */
|
|
|
|
+
|
|
|
|
+ public ZEngineeringWasteMaterialVo queryEngineeringIndustry2(String id) {
|
|
|
|
+ ZEngineeringGYVo zEngineeringGYVo = gyMapper.selectVoById(id);
|
|
|
|
+ List list = new ArrayList();
|
|
|
|
+ list.add(zEngineeringGYVo);
|
|
|
|
+ List<Map<String, Object>> aaa = ReViewGYList(list);
|
|
|
|
+ return new ZEngineeringWasteMaterialVo();
|
|
|
|
+ }
|
|
|
|
+ @Override
|
|
|
|
+ public ZEngineeringWasteMaterialVo queryEngineeringIndustry(String id) {
|
|
|
|
+ ZEngineeringGYVo zEngineeringGYVo = gyMapper.selectVoById(id);
|
|
|
|
+ ZEngineeringNodeBo zEngineeringNodeBo = new ZEngineeringNodeBo();
|
|
|
|
+ zEngineeringNodeBo.setCivliId(id);
|
|
|
|
+ zEngineeringNodeBo.setCreateTime(zEngineeringGYVo.getCreateTime());
|
|
|
|
+ List<ZEngineeringNodeBo> zEngineeringNodeBos = izEngineeringNodeService.queryListDetails(zEngineeringNodeBo);
|
|
|
|
+// zEngineeringIndustryVo.setZEngineeringNodeBoList(zEngineeringNodeBos);
|
|
|
|
+// List<SysDictData> dictList = sysDictMap.get("engin_classification");
|
|
|
|
+// for (SysDictData dict : dictList) {
|
|
|
|
+// if(dict.getDictValue().equals(zEngineeringIndustryVo.getEnginClassification())){
|
|
|
|
+//
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
+ String enginClassification = zEngineeringGYVo.getEnginClassification();
|
|
|
|
+ String dictType;
|
|
|
|
+ switch (enginClassification){
|
|
|
|
+ case "调压柜":{
|
|
|
|
+ dictType = "gy_tyg";
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ case "室内管线":{
|
|
|
|
+ dictType = "gy_inner";
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ case "室外管线":{
|
|
|
|
+ dictType = "gy_out";
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ default:{
|
|
|
|
+ dictType = null;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ Map<String, List<SysDictData>> sysDictMap = RedisUtils.getCacheMap("sys_dict");
|
|
|
|
+ List<SysDictData> dictDataList = sysDictMap.get(dictType);
|
|
|
|
+ ZEngineeringWasteMaterialVo zEngineeringWasteMaterialVo = new ZEngineeringWasteMaterialVo();
|
|
|
|
+ List nodeCheck = new ArrayList<>();
|
|
|
|
+ for (SysDictData dictData : dictDataList) {
|
|
|
|
+ boolean flag = false;
|
|
|
|
+ for (ZEngineeringNodeBo nodeBo : zEngineeringNodeBos) {
|
|
|
|
+ if(nodeBo.getType().equals(dictData.getDictValue())){
|
|
|
|
+ flag = true;
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ Map map = new HashMap();
|
|
|
|
+ map.put("name", dictData.getDictLabel());
|
|
|
|
+ if(flag){
|
|
|
|
+ for (ZEngineeringNodeBo nodeBo : zEngineeringNodeBos) {
|
|
|
|
+ if(nodeBo.getType().equals(dictData.getDictValue())){
|
|
|
|
+ if(nodeBo.getzEngineeringInfoBoList().size() == 0){
|
|
|
|
+ map.put("value", "未上传"); // 上传过 创建过节点 后来删了工程信息 但是节点数据依然在
|
|
|
|
+ }else if (nodeBo.getzEngineeringInfoBoList().stream().anyMatch(ele -> "0".equals(ele.getState()))) {
|
|
|
|
+ map.put("value", "未通过");
|
|
|
|
+ } else if (nodeBo.getzEngineeringInfoBoList().stream().allMatch(ele -> "1".equals(ele.getState()))) {
|
|
|
|
+ map.put("value", "通过");
|
|
|
|
+ } else {
|
|
|
|
+ map.put("value", "未审核");
|
|
|
|
+ }
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }else {
|
|
|
|
+ map.put("value", "未上传"); // 未创建过节点
|
|
|
|
+ }
|
|
|
|
+ nodeCheck.add(map);
|
|
|
|
+ }
|
|
|
|
+ zEngineeringWasteMaterialVo.setNodeCheck(nodeCheck);
|
|
|
|
+ AtomicReference<BigDecimal> pesj = new AtomicReference<>(new BigDecimal(0));
|
|
|
|
+ AtomicReference<BigDecimal> gsj = new AtomicReference<>(new BigDecimal(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.add(new BigDecimal(Double.toString(item4.getNumber()))) );
|
|
|
|
+
|
|
|
|
+// pesj = pesj.get().add(new BigDecimal(Double.toString(item4.getNumber())));
|
|
|
|
+ }else if("1".equals(type)){
|
|
|
|
+// gsj.updateAndGet(v -> new BigDecimal(Double.toString(item4.getNumber())));
|
|
|
|
+ gsj.updateAndGet(v ->v.add(new BigDecimal(Double.toString(item4.getNumber()))) );
|
|
|
|
+
|
|
|
|
+// 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()); // 预计 divide zEngineeringGYVo.getGcPreset()
|
|
|
|
+ pe.put("percentage", getRoundDouble((pesj.get().multiply(new BigDecimal(100))).divide(BigDecimal.valueOf(zEngineeringGYVo.getPePreset())),2) + "%"); // 占比
|
|
|
|
+ Map iron = new HashMap(); // 钢材
|
|
|
|
+ iron.put("actuality", getRoundDouble(gsj.get(), 2)); // 实际
|
|
|
|
+ iron.put("anticipation", zEngineeringGYVo.getGcPreset()); // 预计
|
|
|
|
+ iron.put("percentage", getRoundDouble((gsj.get().multiply(new BigDecimal(100))).divide(BigDecimal.valueOf(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 double getRoundDouble(BigDecimal d, int i){
|
|
|
|
+ return 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);
|
|
|
|
+ RequestAttributes attributes = RequestContextHolder.getRequestAttributes();
|
|
|
|
+
|
|
|
|
+ List<CompletableFuture<LinkedHashMap<String, Object>>> futures = list.stream()
|
|
|
|
+ .map(one -> CompletableFuture.supplyAsync(() -> {
|
|
|
|
+ RequestContextHolder.setRequestAttributes(attributes);
|
|
|
|
+
|
|
|
|
+ LinkedHashMap<String, Object> objectLinkedHashMap = new LinkedHashMap<>();
|
|
|
|
+ objectLinkedHashMap.put("id", one.getId());
|
|
|
|
+ List<SysDictData> dictData = new ArrayList<>();
|
|
|
|
+ if (one.getEnginClassification().equals("室内管线")) {
|
|
|
|
+ dictData = sysDictMap.get("gy_inner");
|
|
|
|
+ } else if (one.getEnginClassification().equals("室外管线")) {
|
|
|
|
+ dictData = sysDictMap.get("gy_out");
|
|
|
|
+ } else if (one.getEnginClassification().equals("调压柜")) {
|
|
|
|
+ dictData = sysDictMap.get("gy_tyg");
|
|
|
|
+ }
|
|
|
|
+ List<LinkedHashMap<String, Object>> status = new ArrayList<>();
|
|
|
|
+ objectLinkedHashMap.put("status", status);
|
|
|
|
+ for (SysDictData dict : dictData) {
|
|
|
|
+ ZEngineeringNodeBo bo = new ZEngineeringNodeBo();
|
|
|
|
+ bo.setCreateTime(one.getCreateTime());
|
|
|
|
+ bo.setCivliId(one.getId());
|
|
|
|
+ bo.setType(dict.getDictLabel());
|
|
|
|
+ ZEngineeringNodeBo nodeBo = nodeService.query(bo);
|
|
|
|
+ LinkedHashMap<String, Object> linkedHashMap = new LinkedHashMap<>();
|
|
|
|
+ linkedHashMap.put("type", bo.getType());
|
|
|
|
+ if (!ObjectUtils.isEmpty(nodeBo) && !ObjectUtils.isEmpty(nodeBo.getzEngineeringInfoBoList())) {
|
|
|
|
+ if (nodeBo.getzEngineeringInfoBoList().stream().anyMatch(ele -> "0".equals(ele.getState()))) {
|
|
|
|
+ linkedHashMap.put("status", "0");
|
|
|
|
+ } else if (nodeBo.getzEngineeringInfoBoList().stream().allMatch(ele -> "1".equals(ele.getState()))) {
|
|
|
|
+ linkedHashMap.put("status", "1");
|
|
|
|
+ } else {
|
|
|
|
+ linkedHashMap.put("status", "2");
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ linkedHashMap.put("status", "3");
|
|
|
|
+ }
|
|
|
|
+ status.add(linkedHashMap);
|
|
|
|
+ }
|
|
|
|
+ return objectLinkedHashMap;
|
|
|
|
+ }))
|
|
|
|
+ .collect(Collectors.toList());
|
|
|
|
+
|
|
|
|
+ CompletableFuture<Void> allOf = CompletableFuture.allOf(futures.toArray(new CompletableFuture[0]));
|
|
|
|
+
|
|
|
|
+ try {
|
|
|
|
+ allOf.get(); // 等待所有 CompletableFuture 完成
|
|
|
|
+ } catch (InterruptedException | ExecutionException e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return futures.stream()
|
|
|
|
+ .map(CompletableFuture::join) // 获取每个 CompletableFuture 的结果
|
|
|
|
+ .collect(Collectors.toList());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 市政工程
|
|
|
|
+ * municipal_node_types
|
|
|
|
+ * engineeringMunicipal
|
|
|
|
+ */
|
|
|
|
+ @Override
|
|
|
|
+ public ZEngineeringWasteMaterialVo queryEngineeringMunicipal(String id) {
|
|
|
|
+ ZEngineeringIndustryVo zEngineeringIndustryVo = baseMapper.selectVoById(id);
|
|
|
|
+ ZEngineeringNodeBo zEngineeringNodeBo = new ZEngineeringNodeBo();
|
|
|
|
+ zEngineeringNodeBo.setCivliId(id);
|
|
|
|
+ zEngineeringNodeBo.setCreateTime(zEngineeringIndustryVo.getCreateTime());
|
|
|
|
+ List<ZEngineeringNodeBo> zEngineeringNodeBos = izEngineeringNodeService.queryListDetails(zEngineeringNodeBo);
|
|
|
|
+// zEngineeringIndustryVo.setZEngineeringNodeBoList(zEngineeringNodeBos);
|
|
|
|
+ Map<String, List<SysDictData>> sysDictMap = RedisUtils.getCacheMap("sys_dict");
|
|
|
|
+ List<SysDictData> dictDataList = sysDictMap.get("municipal_node_types");
|
|
|
|
+ ZEngineeringWasteMaterialVo zEngineeringWasteMaterialVo = new ZEngineeringWasteMaterialVo();
|
|
|
|
+ List nodeCheck = new ArrayList<>();
|
|
|
|
+ for (SysDictData dictData : dictDataList) {
|
|
|
|
+ boolean flag = false;
|
|
|
|
+ for (ZEngineeringNodeBo nodeBo : zEngineeringNodeBos) {
|
|
|
|
+ if(nodeBo.getType().equals(dictData.getDictValue())){
|
|
|
|
+ flag = true;
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ Map map = new HashMap();
|
|
|
|
+ map.put("name", dictData.getDictLabel());
|
|
|
|
+ if(flag){
|
|
|
|
+ for (ZEngineeringNodeBo nodeBo : zEngineeringNodeBos) {
|
|
|
|
+ if(nodeBo.getType().equals(dictData.getDictValue())){
|
|
|
|
+ if(nodeBo.getzEngineeringInfoBoList().size() == 0){
|
|
|
|
+ map.put("value", "未上传"); // 上传过 创建过节点 后来删了工程信息 但是节点数据依然在
|
|
|
|
+ }else if (nodeBo.getzEngineeringInfoBoList().stream().anyMatch(ele -> "0".equals(ele.getState()))) {
|
|
|
|
+ map.put("value", "未通过");
|
|
|
|
+ } else if (nodeBo.getzEngineeringInfoBoList().stream().allMatch(ele -> "1".equals(ele.getState()))) {
|
|
|
|
+ map.put("value", "通过");
|
|
|
|
+ } else {
|
|
|
|
+ map.put("value", "未审核");
|
|
|
|
+ }
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }else {
|
|
|
|
+ map.put("value", "未上传");
|
|
|
|
+ }
|
|
|
|
+ nodeCheck.add(map);
|
|
|
|
+ }
|
|
|
|
+ zEngineeringWasteMaterialVo.setNodeCheck(nodeCheck);
|
|
|
|
+// for (int i = 0; i < zEngineeringNodeBos.size(); i++) {
|
|
|
|
+// ZEngineeringNodeBo nodeBo = zEngineeringNodeBos.get(i);
|
|
|
|
+// }
|
|
|
|
+// zEngineeringWasteMaterialVo.setMaterialPercentagePE();
|
|
|
|
+ AtomicReference<BigDecimal> pesj = new AtomicReference<>(new BigDecimal(0));
|
|
|
|
+ AtomicReference<BigDecimal> gsj = new AtomicReference<>(new BigDecimal(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.add(new BigDecimal(Double.toString(item4.getNumber()))));
|
|
|
|
+ }else if("1".equals(type)){
|
|
|
|
+ gsj.updateAndGet(v ->v.add(new BigDecimal(Double.toString(item4.getNumber()))));
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ Map pe = new HashMap(); // PE材料
|
|
|
|
+ pe.put("actuality", getRoundDouble(pesj.get(), 2)); // 实际
|
|
|
|
+ pe.put("anticipation", zEngineeringIndustryVo.getPePreset()); // 预计
|
|
|
|
+ pe.put("percentage", getRoundDouble((pesj.get().multiply(new BigDecimal(100))).divide(BigDecimal.valueOf(zEngineeringIndustryVo.getPePreset())),2) + "%"); // 占比
|
|
|
|
+ Map iron = new HashMap(); // 钢材
|
|
|
|
+ iron.put("actuality", getRoundDouble(gsj.get(), 2)); // 实际
|
|
|
|
+ iron.put("anticipation", zEngineeringIndustryVo.getGcPreset()); // 预计
|
|
|
|
+ iron.put("percentage", getRoundDouble((gsj.get().multiply(new BigDecimal(100))).divide(BigDecimal.valueOf(zEngineeringIndustryVo.getGcPreset())),2) + "%"); // 占比
|
|
|
|
+ zEngineeringWasteMaterialVo.setMaterialPercentagePE(pe);
|
|
|
|
+ zEngineeringWasteMaterialVo.setMaterialPercentageIron(iron);
|
|
|
|
+ return zEngineeringWasteMaterialVo;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 顶管工程
|
|
|
|
+ * pipe_jack
|
|
|
|
+ * engineeringPipeJacking
|
|
|
|
+ */
|
|
|
|
+ @Override
|
|
|
|
+ public ZEngineeringWasteMaterialVo queryEngineeringPipeJacking(String id) {
|
|
|
|
+ ZEngineeringPipeJackingVo zEngineeringPipeJackingVo = pipeJackingMapper.selectVoById(id);
|
|
|
|
+ ZEngineeringNodeBo zEngineeringNodeBo = new ZEngineeringNodeBo();
|
|
|
|
+ zEngineeringNodeBo.setCivliId(id);
|
|
|
|
+ zEngineeringNodeBo.setCreateTime(zEngineeringPipeJackingVo.getCreateTime());
|
|
|
|
+ List<ZEngineeringNodeBo> zEngineeringNodeBos = izEngineeringNodeService.queryListDetails(zEngineeringNodeBo);
|
|
|
|
+// zEngineeringIndustryVo.setZEngineeringNodeBoList(zEngineeringNodeBos);
|
|
|
|
+ Map<String, List<SysDictData>> sysDictMap = RedisUtils.getCacheMap("sys_dict");
|
|
|
|
+ List<SysDictData> dictDataList = sysDictMap.get("pipe_jack");
|
|
|
|
+ ZEngineeringWasteMaterialVo zEngineeringWasteMaterialVo = new ZEngineeringWasteMaterialVo();
|
|
|
|
+ List nodeCheck = new ArrayList<>();
|
|
|
|
+ for (SysDictData dictData : dictDataList) {
|
|
|
|
+ boolean flag = false;
|
|
|
|
+ for (ZEngineeringNodeBo nodeBo : zEngineeringNodeBos) {
|
|
|
|
+ if(nodeBo.getType().equals(dictData.getDictValue())){
|
|
|
|
+ flag = true;
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ Map map = new HashMap();
|
|
|
|
+ map.put("name", dictData.getDictLabel());
|
|
|
|
+ if(flag){
|
|
|
|
+ for (ZEngineeringNodeBo nodeBo : zEngineeringNodeBos) {
|
|
|
|
+ if(nodeBo.getType().equals(dictData.getDictValue())){
|
|
|
|
+ if(nodeBo.getzEngineeringInfoBoList().size() == 0){
|
|
|
|
+ map.put("value", "未上传"); // 上传过 创建过节点 后来删了工程信息 但是节点数据依然在
|
|
|
|
+ }else if (nodeBo.getzEngineeringInfoBoList().stream().anyMatch(ele -> "0".equals(ele.getState()))) {
|
|
|
|
+ map.put("value", "未通过");
|
|
|
|
+ } else if (nodeBo.getzEngineeringInfoBoList().stream().allMatch(ele -> "1".equals(ele.getState()))) {
|
|
|
|
+ map.put("value", "通过");
|
|
|
|
+ } else {
|
|
|
|
+ map.put("value", "未审核");
|
|
|
|
+ }
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }else {
|
|
|
|
+ map.put("value", "未上传");
|
|
|
|
+ }
|
|
|
|
+ nodeCheck.add(map);
|
|
|
|
+ }
|
|
|
|
+ zEngineeringWasteMaterialVo.setNodeCheck(nodeCheck);
|
|
|
|
+// for (int i = 0; i < zEngineeringNodeBos.size(); i++) {
|
|
|
|
+// ZEngineeringNodeBo nodeBo = zEngineeringNodeBos.get(i);
|
|
|
|
+// }
|
|
|
|
+// zEngineeringWasteMaterialVo.setMaterialPercentagePE();
|
|
|
|
+ AtomicReference<BigDecimal> pesj = new AtomicReference<>(new BigDecimal(0));
|
|
|
|
+ AtomicReference<BigDecimal> gsj = new AtomicReference<>(new BigDecimal(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.add(new BigDecimal(Double.toString(item4.getNumber()))));
|
|
|
|
+ }else if("1".equals(type)){
|
|
|
|
+ gsj.updateAndGet(v ->v.add(new BigDecimal(Double.toString(item4.getNumber()))));
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ Map pe = new HashMap(); // PE材料
|
|
|
|
+ pe.put("actuality", getRoundDouble(pesj.get(), 2)); // 实际
|
|
|
|
+ pe.put("anticipation", zEngineeringPipeJackingVo.getPePreset()); // 预计
|
|
|
|
+ pe.put("percentage", getRoundDouble((pesj.get().multiply(new BigDecimal(100))).divide(BigDecimal.valueOf(zEngineeringPipeJackingVo.getPePreset())),2) + "%"); // 占比
|
|
|
|
+ Map iron = new HashMap(); // 钢材
|
|
|
|
+ iron.put("actuality", getRoundDouble(gsj.get(), 2)); // 实际
|
|
|
|
+ iron.put("anticipation", zEngineeringPipeJackingVo.getGcPreset()); // 预计
|
|
|
|
+ iron.put("percentage", getRoundDouble((gsj.get().multiply(new BigDecimal(100))).divide(BigDecimal.valueOf(zEngineeringPipeJackingVo.getGcPreset())),2) + "%"); // 占比
|
|
|
|
+ zEngineeringWasteMaterialVo.setMaterialPercentagePE(pe);
|
|
|
|
+ zEngineeringWasteMaterialVo.setMaterialPercentageIron(iron);
|
|
|
|
+ return zEngineeringWasteMaterialVo;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 碰口作业
|
|
|
|
+ * tapping_operation
|
|
|
|
+ * touchOperationEngineering
|
|
|
|
+ */
|
|
|
|
+ @Override
|
|
|
|
+ public ZEngineeringWasteMaterialVo queryTouchOperationEngineering(String id) {
|
|
|
|
+ ZTouchOperationEngineeringVo zTouchOperationEngineeringVo = touchOperationMapper.selectVoById(id);
|
|
|
|
+ ZEngineeringNodeBo zEngineeringNodeBo = new ZEngineeringNodeBo();
|
|
|
|
+ zEngineeringNodeBo.setCivliId(id);
|
|
|
|
+ zEngineeringNodeBo.setCreateTime(zTouchOperationEngineeringVo.getCreateTime());
|
|
|
|
+ List<ZEngineeringNodeBo> zEngineeringNodeBos = izEngineeringNodeService.queryListDetails(zEngineeringNodeBo);
|
|
|
|
+// zEngineeringIndustryVo.setZEngineeringNodeBoList(zEngineeringNodeBos);
|
|
|
|
+ String modeOperation = zTouchOperationEngineeringVo.getModeOperation();
|
|
|
|
+ String dictType;
|
|
|
|
+ switch (modeOperation){
|
|
|
|
+ case "地埋扳孔":{
|
|
|
|
+ dictType = "bury_the_wrench_hole";
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ case "架空扳孔":{
|
|
|
|
+ dictType = "aerial_wrench_hole";
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ case "停气作业":{
|
|
|
|
+ dictType = "shutdown_operation";
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ case "PE 封堵":{
|
|
|
|
+ dictType = "pe_plugging";
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ case "钢管带气封堵":{
|
|
|
|
+ dictType = "the_steel_pipe_sealed_with_gas";
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ default:{
|
|
|
|
+ dictType = null;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ Map<String, List<SysDictData>> sysDictMap = RedisUtils.getCacheMap("sys_dict");
|
|
|
|
+ List<SysDictData> dictDataList = sysDictMap.get(dictType);
|
|
|
|
+ ZEngineeringWasteMaterialVo zEngineeringWasteMaterialVo = new ZEngineeringWasteMaterialVo();
|
|
|
|
+ List nodeCheck = new ArrayList<>();
|
|
|
|
+ for (SysDictData dictData : dictDataList) {
|
|
|
|
+ boolean flag = false;
|
|
|
|
+ for (ZEngineeringNodeBo nodeBo : zEngineeringNodeBos) {
|
|
|
|
+ if(nodeBo.getType().equals(dictData.getDictValue())){
|
|
|
|
+ flag = true;
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ Map map = new HashMap();
|
|
|
|
+ map.put("name", dictData.getDictLabel());
|
|
|
|
+ if(flag){
|
|
|
|
+ for (ZEngineeringNodeBo nodeBo : zEngineeringNodeBos) {
|
|
|
|
+ if(nodeBo.getType().equals(dictData.getDictValue())){
|
|
|
|
+ if(nodeBo.getzEngineeringInfoBoList().size() == 0){
|
|
|
|
+ map.put("value", "未上传"); // 上传过 创建过节点 后来删了工程信息 但是节点数据依然在
|
|
|
|
+ }else if (nodeBo.getzEngineeringInfoBoList().stream().anyMatch(ele -> "0".equals(ele.getState()))) {
|
|
|
|
+ map.put("value", "未通过");
|
|
|
|
+ } else if (nodeBo.getzEngineeringInfoBoList().stream().allMatch(ele -> "1".equals(ele.getState()))) {
|
|
|
|
+ map.put("value", "通过");
|
|
|
|
+ } else {
|
|
|
|
+ map.put("value", "未审核");
|
|
|
|
+ }
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }else {
|
|
|
|
+ map.put("value", "未上传");
|
|
|
|
+ }
|
|
|
|
+ nodeCheck.add(map);
|
|
|
|
+ }
|
|
|
|
+ zEngineeringWasteMaterialVo.setNodeCheck(nodeCheck);
|
|
|
|
+// for (int i = 0; i < zEngineeringNodeBos.size(); i++) {
|
|
|
|
+// ZEngineeringNodeBo nodeBo = zEngineeringNodeBos.get(i);
|
|
|
|
+// }
|
|
|
|
+// zEngineeringWasteMaterialVo.setMaterialPercentagePE();
|
|
|
|
+ return zEngineeringWasteMaterialVo;
|
|
|
|
+ }
|
|
|
|
+}
|