From b53f977e0b6f48d3c1f962faa5c2e3f5fbc48d09 Mon Sep 17 00:00:00 2001 From: zcxlsm Date: Mon, 15 Sep 2025 19:42:22 +0800 Subject: [PATCH 1/2] =?UTF-8?q?feat(Property):=20=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E6=B0=B4=E7=94=B5=E6=B0=94=E8=B4=B9=E7=94=A8=E8=AE=A1=E7=AE=97?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../property/domain/bo/CostHouseChargeBo.java | 2 + .../impl/CostHouseChargeServiceImpl.java | 53 +++++++++++++++++-- .../ITbMeterRecordService.java | 2 +- 3 files changed, 52 insertions(+), 5 deletions(-) diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/bo/CostHouseChargeBo.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/bo/CostHouseChargeBo.java index e1f3a3f9..cf0cf572 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/bo/CostHouseChargeBo.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/bo/CostHouseChargeBo.java @@ -95,5 +95,7 @@ public class CostHouseChargeBo extends BaseEntity { private String remark; + private String chargeTime; + } diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/CostHouseChargeServiceImpl.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/CostHouseChargeServiceImpl.java index e5e6e491..81662af3 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/CostHouseChargeServiceImpl.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/CostHouseChargeServiceImpl.java @@ -2,7 +2,9 @@ package org.dromara.property.service.impl; import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.convert.Convert; import cn.hutool.core.lang.Assert; +import cn.hutool.core.lang.TypeReference; import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.RandomUtil; import org.apache.dubbo.config.annotation.DubboReference; @@ -25,6 +27,9 @@ import org.dromara.property.domain.vo.*; import org.dromara.property.domain.vo.residentVo.ResidentPersonVo; import org.dromara.property.domain.vo.residentVo.ResidentUnitVo; import org.dromara.property.mapper.*; +import org.dromara.property.service.ITbFloorService; +import org.dromara.property.service.ITbRoomService; +import org.dromara.property.service.smartDevicesService.ITbMeterRecordService; import org.dromara.system.api.RemoteDictService; import org.dromara.system.api.RemoteUserService; import org.dromara.system.api.domain.vo.RemoteDictDataVo; @@ -62,6 +67,10 @@ public class CostHouseChargeServiceImpl implements ICostHouseChargeService { @DubboReference private RemoteDictService remoteDictService; + private final ITbRoomService tbRoomService; + private final ITbFloorService tbFloorService; + private final ITbMeterRecordService tbMeterRecordService; + /** * 查询房屋收费 * @@ -185,7 +194,7 @@ public class CostHouseChargeServiceImpl implements ICostHouseChargeService { ResidentUnitVo residentUnitVo = residentUnitMapper.selectVoById(add.getResidentUnitId()); add.setResidentUnitId(residentUnitVo.getId()); add.setArea(residentUnitVo.getArea()); - BigDecimal area = new BigDecimal(add.getArea()); + BigDecimal area = BigDecimal.valueOf(add.getArea()); CostItemsVo costItemsVo = costItemsMapper.selectVoById(add.getCostItemsId()); BigDecimal unitPrice = costItemsVo.getUnitPrice(); // //向上取整 @@ -214,11 +223,11 @@ public class CostHouseChargeServiceImpl implements ICostHouseChargeService { } //类型为5,则为水费 if (Objects.equals(remoteDictDataVo.getDictValue(), "5")) { - - + add.setAmountReceivable(meterCharge(residentUnitVo.getLocation(), area, 2L, bo)); } //类型为6,则为电费 if (Objects.equals(remoteDictDataVo.getDictValue(), "6")) { + add.setAmountReceivable(meterCharge(residentUnitVo.getLocation(), area, 1L, bo)); } //类型为8,则为气费 if (Objects.equals(remoteDictDataVo.getDictValue(), "8")) { @@ -250,8 +259,44 @@ public class CostHouseChargeServiceImpl implements ICostHouseChargeService { /** * 水电气费计算 */ - private void meterCharge(){ + private BigDecimal meterCharge(String location, BigDecimal roomArea, Long meterType, CostHouseChargeBo bo) { + if (StringUtils.isNotBlank(location)) { + String[] roomIds = location.split(","); + Map floorData = new HashMap<>(); // 存储去重的楼层数据 + for (String item : roomIds) { + TbRoomVo roomVo = tbRoomService.queryById(Long.valueOf(item)); + if (roomVo != null) { + Long floorId = roomVo.getFloorId(); + // 保存楼层数据(如果尚未存在) + if (!floorData.containsKey(floorId)) { + // 假设您有获取楼层信息的方法,这里需要根据实际情况调整 + TbFloorVo floorVo = tbFloorService.queryById(floorId); + if (floorVo != null) { + floorData.put(floorId, floorVo); + } + } + } + } + + Float floorArea = 0f; + Float meterEnergy = 0f; + for (Map.Entry entry : floorData.entrySet()) { + floorArea += entry.getValue().getArea(); + Map meterRecord = tbMeterRecordService.getEnergyTrend(entry.getKey().toString(), null, meterType, null, bo.getChargeTime(), null); + Map resultMap = Convert.convert(new TypeReference<>() { + }, meterRecord.get("nowMonth")); + meterEnergy += Convert.convert(Float.class, resultMap.get("total")); + } + + BigDecimal floorAreaBD = Convert.toBigDecimal(floorArea); + BigDecimal meterEnergyBD = Convert.toBigDecimal(meterEnergy); + + return roomArea.divide(floorAreaBD, 10, RoundingMode.HALF_UP) + .multiply(meterEnergyBD) + .multiply(Convert.toBigDecimal(0.9)); + } + return BigDecimal.ZERO; } /** diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/smartDevicesService/ITbMeterRecordService.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/smartDevicesService/ITbMeterRecordService.java index 795ee91e..7714d315 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/smartDevicesService/ITbMeterRecordService.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/smartDevicesService/ITbMeterRecordService.java @@ -14,7 +14,7 @@ import java.util.Map; * 抄记录Service接口 * * @author lsm - * @date 2025-07-19 + * @since 2025-07-19 */ public interface ITbMeterRecordService { From fafc4fdda1f2e9aef112960d8c568ea8d33a94db Mon Sep 17 00:00:00 2001 From: dy <2389062315@qq.com> Date: Mon, 15 Sep 2025 19:46:14 +0800 Subject: [PATCH 2/2] =?UTF-8?q?bug=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/bo/InspectionTaskDetailBo.java | 6 ++++-- .../domain/vo/InspectionTaskDetailVo.java | 4 +++- .../CustomerContingenPlanServiceImpl.java | 21 ++++++++++++++++++- .../impl/InspectionTaskDetailServiceImpl.java | 18 ++++++++++++++-- 4 files changed, 43 insertions(+), 6 deletions(-) diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/bo/InspectionTaskDetailBo.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/bo/InspectionTaskDetailBo.java index b09e18b8..6a157c3b 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/bo/InspectionTaskDetailBo.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/bo/InspectionTaskDetailBo.java @@ -9,6 +9,8 @@ import lombok.Data; import lombok.EqualsAndHashCode; import jakarta.validation.constraints.*; import org.dromara.common.translation.annotation.Translation; + +import java.time.LocalDateTime; import java.util.Date; import com.fasterxml.jackson.annotation.JsonFormat; import org.dromara.common.translation.constant.TransConstant; @@ -60,7 +62,7 @@ public class InspectionTaskDetailBo extends BaseEntity { /** * 实际巡检时间 */ - private Date actualInspectionTime; + private LocalDateTime actualInspectionTime; /** * 实际签到状态(1已签到2.未签到) @@ -106,7 +108,7 @@ public class InspectionTaskDetailBo extends BaseEntity { /** * 实际巡检时间 */ - private Date inspectionTime; + private LocalDateTime inspectionTime; /** * 备注 diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/InspectionTaskDetailVo.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/InspectionTaskDetailVo.java index 73874903..1c54ba62 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/InspectionTaskDetailVo.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/InspectionTaskDetailVo.java @@ -1,6 +1,8 @@ package org.dromara.property.domain.vo; import org.dromara.common.translation.annotation.Translation; + +import java.time.LocalDateTime; import java.util.Date; import com.fasterxml.jackson.annotation.JsonFormat; import org.dromara.common.translation.constant.TransConstant; @@ -94,7 +96,7 @@ public class InspectionTaskDetailVo implements Serializable { * 实际巡检时间 */ @ExcelProperty(value = "实际巡检时间") - private Date actualInspectionTime; + private LocalDateTime actualInspectionTime; /** * 实际签到状态(1已签到2.未签到) diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/CustomerContingenPlanServiceImpl.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/CustomerContingenPlanServiceImpl.java index 303fba71..381d2f12 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/CustomerContingenPlanServiceImpl.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/CustomerContingenPlanServiceImpl.java @@ -11,6 +11,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.dromara.common.satoken.utils.LoginHelper; import org.dromara.property.domain.CustomerContingenPlan; import org.dromara.property.domain.CustomerContingenPlanRecord; import org.dromara.property.domain.entity.resident.ResidentPerson; @@ -21,12 +22,14 @@ import org.dromara.property.mapper.CustomerContingenPlanMapper; import org.dromara.property.mapper.CustomerContingenPlanRecordMapper; import org.dromara.property.mapper.ResidentPersonMapper; import org.dromara.property.service.ICustomerContingenPlanService; +import org.dromara.system.api.model.LoginUser; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.List; import java.util.Map; import java.util.Collection; +import java.util.Objects; /** * 客户服务-应急预案Service业务层处理 @@ -102,7 +105,23 @@ public class CustomerContingenPlanServiceImpl implements ICustomerContingenPlanS @Override public List queryList(CustomerContingenPlanBo bo) { LambdaQueryWrapper lqw = buildQueryWrapper(bo); - return baseMapper.selectVoList(lqw); + List customerContingenPlanVos = baseMapper.selectVoList(lqw); + customerContingenPlanVos.forEach(s -> { + if (Objects.equals(s.getContingenPlanType(), "0")) { + s.setContingenPlanType("自然灾害"); + } + if (Objects.equals(s.getContingenPlanType(), "1")) { + s.setContingenPlanType("事故灾难"); + } + if (Objects.equals(s.getContingenPlanType(), "2")) { + s.setContingenPlanType("公共卫生"); + } + if (Objects.equals(s.getContingenPlanType(), "3")) { + s.setContingenPlanType("社会安全"); + } + }); + + return customerContingenPlanVos; } private LambdaQueryWrapper buildQueryWrapper(CustomerContingenPlanBo bo) { diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/InspectionTaskDetailServiceImpl.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/InspectionTaskDetailServiceImpl.java index 69675b3d..ce3a7292 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/InspectionTaskDetailServiceImpl.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/InspectionTaskDetailServiceImpl.java @@ -26,6 +26,7 @@ import org.dromara.property.domain.enums.OrderReportingTypeEnum; import org.dromara.property.domain.enums.OrderTypeOperationEnum; import org.dromara.property.domain.enums.WorkOrderStatusEnum; import org.dromara.property.domain.vo.*; +import org.dromara.property.domain.vo.attendanceVo.AttendanceArrangementVo; import org.dromara.property.domain.vo.mobile.MInspectionTaskDetailVo; import org.dromara.property.domain.vo.mobile.MServiceWorkOrdersRecordVo; import org.dromara.property.domain.vo.mobile.MServiceWorkOrdersVo; @@ -39,6 +40,7 @@ import org.dromara.property.service.IInspectionTaskDetailService; import org.springframework.transaction.annotation.Transactional; import java.time.LocalDate; +import java.time.LocalDateTime; import java.util.*; import java.util.stream.Collectors; @@ -113,7 +115,17 @@ public class InspectionTaskDetailServiceImpl implements IInspectionTaskDetailSer }); } - return TableDataInfo.build(result); + Page inspectionTaskDetailVoPage = result.setRecords(result.getRecords().stream().map(vo -> { + LoginUser loginUser = LoginHelper.getLoginUser(); + vo.setActualInspectionPerson(loginUser.getNickname()); + vo.setPlanInspectionPerson(loginUser.getNickname()); + vo.setActualInspectionTime(LocalDateTime.now()); +// vo.setSignType(); + + return vo; + }).collect(Collectors.toList())); + + return TableDataInfo.build(inspectionTaskDetailVoPage); } private void disposeData(InspectionTaskDetailVo vo, Map taskNameMap, Map routeNameMap, Map planNameMap, Map pointNameMap) { @@ -311,7 +323,9 @@ public class InspectionTaskDetailServiceImpl implements IInspectionTaskDetailSer //当前登录用户id LoginUser loginUser = LoginHelper.getLoginUser(); Assert.isTrue(planInspectionPersonIds.contains(loginUser.getUserId()), "当前签到人不在计划巡检人列表内"); - bo.setActualInspectionPerson(loginUser.getUserId().toString()); + bo.setActualInspectionPerson(loginUser.getNickname()); +// bo.setActualInspectionTime(LocalDateTime.now()); + bo.setInspectionTime(LocalDateTime.now()); InspectionTaskDetail update = MapstructUtils.convert(bo, InspectionTaskDetail.class); boolean flag = baseMapper.updateById(update) > 0; if (flag) {