From 86bf903b29ffb907f4e93b1cbf1396f64e2b07b7 Mon Sep 17 00:00:00 2001 From: du <1725534722@qq.com> Date: Fri, 11 Apr 2025 10:59:23 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E7=94=BB=E5=83=8F=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ruoyi/gysl/service/XmpjqdService.java | 2 +- .../gysl/service/impl/XmpjqdServiceImpl.java | 113 +++++++++++------- 2 files changed, 69 insertions(+), 46 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/gysl/service/XmpjqdService.java b/ruoyi-admin/src/main/java/com/ruoyi/gysl/service/XmpjqdService.java index 5a85514..f79cdca 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/gysl/service/XmpjqdService.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/gysl/service/XmpjqdService.java @@ -40,6 +40,6 @@ public interface XmpjqdService extends IService { * @param id 主键 * @return 单条数据 */ - List oneXmhx(Serializable id); + List oneXmhx(Long id); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/gysl/service/impl/XmpjqdServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/gysl/service/impl/XmpjqdServiceImpl.java index e96e9e2..0283212 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/gysl/service/impl/XmpjqdServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/gysl/service/impl/XmpjqdServiceImpl.java @@ -16,7 +16,6 @@ import com.ruoyi.gysl.service.XmpjqdService; import org.springframework.stereotype.Service; import javax.annotation.Resource; -import java.io.Serializable; import java.math.BigDecimal; import java.math.RoundingMode; import java.util.ArrayList; @@ -82,38 +81,47 @@ public class XmpjqdServiceImpl extends ServiceImpl impleme * @return 单条数据 */ @Override - public List oneXmhx(Serializable id) { + public List oneXmhx(Long id) { //返回体 List obj = new ArrayList<>(); //最大值 - BuildingInformation allMax = buildingInformationService.getAllMax(); + BuildingInformation allMax1 = buildingInformationService.getAllMax(); + BuildingInformation allMax = allMax1 == null ? new BuildingInformation() : allMax1; //本项目 - BuildingInformation th = buildingInformationService.getOneXmIdToMax((Long) id); + BuildingInformation th1 = buildingInformationService.getOneXmIdToMax(id); + BuildingInformation th = th1 == null ? new BuildingInformation() : th1; //查询所有的建筑信息,只保留是重要楼栋的max条 List ib = buildingInformationService.getImportantBuildings(); //获取项目评价配置数据 List list = pjpzService.list(); + //分类数据 + XmhxResponse xr1 = new XmhxResponse(); + xr1.setType(1); + List l1 = new ArrayList<>(); + XmhxResponse xr2 = new XmhxResponse(); + xr2.setType(2); + List l2 = new ArrayList<>(); + XmhxResponse xr3 = new XmhxResponse(); + xr3.setType(3); + List l3 = new ArrayList<>(); list.forEach(x -> { - XmhxResponse xr1 = new XmhxResponse(); - xr1.setType(1); - List l1 = new ArrayList<>(); - XmhxResponse xr2 = new XmhxResponse(); - xr2.setType(2); - List l2 = new ArrayList<>(); - XmhxResponse xr3 = new XmhxResponse(); - xr3.setType(3); - List l3 = new ArrayList<>(); - if (allMax != null && th != null) { - switch (x.getPjys()) { - case "总投资额": - l1.add(xmpjqdMapper.zdzZtze()); - l2.add(xmpjqdMapper.meZtze((Long) id)); + switch (x.getPjys()) { + case "总投资额": + l1.add(xmpjqdMapper.zdzZtze() == null ? new XmhxDetail("总投资额", "0") : xmpjqdMapper.zdzZtze()); + l2.add(xmpjqdMapper.meZtze(id) == null ? new XmhxDetail("总投资额", "0") : xmpjqdMapper.meZtze(id)); + if (xmpjqdMapper.zwsZtze() != null) { l3.add(getXmhxDetails(xmpjqdMapper.zwsZtze(), "总投资额")); - break; - case "层数": - l1.add(new XmhxDetail("层数", String.valueOf(allMax.getFloor()))); - l2.add(new XmhxDetail("层数", String.valueOf(th.getFloor()))); - //层数拿出来 + } else { + l3.add(new XmhxDetail("总投资额", "0")); + } + break; + case "层数": + l1.add(new XmhxDetail("层数", String.valueOf(allMax.getFloor() == null ? 0 : allMax.getFloor()))); + l2.add(new XmhxDetail("层数", String.valueOf(th.getFloor() == null ? 0 : th.getFloor()))); + //层数拿出来 + if (ib.isEmpty()) { + l3.add(new XmhxDetail("层数", "0")); + } else { List floor = ib.stream() .map(BuildingInformation::getFloor) .filter(Objects::nonNull) @@ -132,48 +140,63 @@ public class XmpjqdServiceImpl extends ServiceImpl impleme } } l3.add(new XmhxDetail("层数", s)); - break; - case "首层层高": - l1.add(new XmhxDetail("首层层高", String.valueOf(allMax.getScgd()))); - l2.add(new XmhxDetail("首层层高", String.valueOf(th.getScgd()))); + } + break; + case "首层层高": + l1.add(new XmhxDetail("首层层高", String.valueOf(allMax.getScgd() == null ? 0 : allMax.getScgd()))); + l2.add(new XmhxDetail("首层层高", String.valueOf(th.getScgd() == null ? 0 : th.getScgd()))); + if (ib.isEmpty()) { + l3.add(new XmhxDetail("首层层高", "0")); + } else { List sccg = ib.stream() .map(BuildingInformation::getScgd) .filter(Objects::nonNull) .sorted() .collect(Collectors.toList()); l3.add(getXmhxDetails(sccg, "首层层高")); - break; - case "二层及以上层高": - l1.add(new XmhxDetail("二层及以上层高", String.valueOf(allMax.getTwoAndFourCg()))); - l2.add(new XmhxDetail("二层及以上层高", String.valueOf(th.getTwoAndFourCg()))); + } + break; + case "二层及以上层高": + l1.add(new XmhxDetail("二层及以上层高", String.valueOf(allMax.getTwoAndFourCg() == null ? 0 : allMax.getTwoAndFourCg()))); + l2.add(new XmhxDetail("二层及以上层高", String.valueOf(th.getTwoAndFourCg() == null ? 0 : th.getTwoAndFourCg()))); + if (ib.isEmpty()) { + l3.add(new XmhxDetail("二层及以上层高", "0")); + } else { List ec = ib.stream() .map(BuildingInformation::getTwoAndFourCg) .filter(Objects::nonNull) .sorted() .collect(Collectors.toList()); l3.add(getXmhxDetails(ec, "二层及以上层高")); - break; - case "二层及以上楼面荷载": - l1.add(new XmhxDetail("二层及以上楼面荷载", String.valueOf(allMax.getTwoAndThreeLmhz()))); - l2.add(new XmhxDetail("二层及以上楼面荷载", String.valueOf(th.getTwoAndThreeLmhz()))); + } + break; + case "二层及以上楼面荷载": + l1.add(new XmhxDetail("二层及以上楼面荷载", String.valueOf(allMax.getTwoAndThreeLmhz() == null ? 0 : allMax.getTwoAndThreeLmhz()))); + l2.add(new XmhxDetail("二层及以上楼面荷载", String.valueOf(th.getTwoAndThreeLmhz() == null ? 0 : th.getTwoAndThreeLmhz()))); + if (ib.isEmpty()) { + l3.add(new XmhxDetail("二层及以上楼载荷", "0")); + } else { List zh = ib.stream() .map(BuildingInformation::getTwoAndThreeLmhz) .filter(Objects::nonNull) .sorted() .collect(Collectors.toList()); l3.add(getXmhxDetails(zh, "二层及以上楼载荷")); - break; - default: - l1.add(new XmhxDetail(x.getPjys(), null)); - l2.add(new XmhxDetail(x.getPjys(), null)); - l3.add(new XmhxDetail(x.getPjys(), null)); - break; - } + } + break; + default: + l1.add(new XmhxDetail(x.getPjys(), "0")); + l2.add(new XmhxDetail(x.getPjys(), "0")); + l3.add(new XmhxDetail(x.getPjys(), "0")); + break; } - xr1.setList(l1); - xr2.setList(l2); - xr3.setList(l3); }); + xr1.setList(l1); + xr2.setList(l2); + xr3.setList(l3); + obj.add(xr1); + obj.add(xr2); + obj.add(xr3); return obj; }