diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/enums/ChargeTypeEnum.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/enums/ChargeTypeEnum.java new file mode 100644 index 00000000..b54c9402 --- /dev/null +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/enums/ChargeTypeEnum.java @@ -0,0 +1,30 @@ +package org.dromara.property.domain.enums; + +/** + * 收费类型枚举 + */ +public enum ChargeTypeEnum { + /** + * 房屋收费 + */ + HOUS_CHARGES("房屋收费", "1"), + /** + * 车辆收费 + */ + CARD_CHARGES("车辆收费", "2"); + private final String name; + private final String value; + + ChargeTypeEnum(String name, String value) { + this.name = name; + this.value = value; + } + + public String getName() { + return this.name; + } + + public String getValue() { + return this.value; + } +} diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/CostPayFeeAuditVo.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/CostPayFeeAuditVo.java index e7704979..45aabf19 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/CostPayFeeAuditVo.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/CostPayFeeAuditVo.java @@ -53,8 +53,12 @@ public class CostPayFeeAuditVo implements Serializable { /** * 房间号(如101,202) */ - @ExcelProperty(value = "房间号(如101,202)") + @ExcelProperty(value = "房间号") private String roomNumber; + /** + * 车牌号 + */ + private String carNumber; /** * 费用项目id diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/CostPayFeeAuditServiceImpl.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/CostPayFeeAuditServiceImpl.java index 807db09b..c2875629 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/CostPayFeeAuditServiceImpl.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/CostPayFeeAuditServiceImpl.java @@ -18,6 +18,7 @@ import org.dromara.property.domain.CostHouseCharge; import org.dromara.property.domain.CostPayFeeAudit; import org.dromara.property.domain.bo.CostPayFeeAuditBo; import org.dromara.property.domain.enums.ChargeStatusEnum; +import org.dromara.property.domain.enums.ChargeTypeEnum; import org.dromara.property.domain.vo.*; import org.dromara.property.mapper.*; import org.dromara.property.service.ICostPayFeeAuditService; @@ -59,7 +60,18 @@ public class CostPayFeeAuditServiceImpl implements ICostPayFeeAuditService { CostItemsVo costItemsVo = costItemsMapper.selectVoById(costPayFeeAuditVo.getItemId()); costPayFeeAuditVo.setChargeItem(ObjectUtil.isNotEmpty(costItemsVo) ? costItemsVo.getChargeItem() : null); costPayFeeAuditVo.setChargeCycle(ObjectUtil.isNotEmpty(costItemsVo) ? costItemsVo.getChargeCycle() : null); - //TbRoomVo roomVo = roomMapper.selectVoById(costPayFeeAuditVo.getChargeId()); + if (costPayFeeAuditVo.getChargeType().equals(ChargeTypeEnum.HOUS_CHARGES.getValue())) { + CostHouseCharge costHouseCharge = coinHouseChargeMapper.selectById(costPayFeeAuditVo.getChargeId()); + if (ObjectUtil.isNotEmpty(costHouseCharge)) { + String queryRoomName = roomMapper.queryRoomName(costHouseCharge.getRoomId()); + costPayFeeAuditVo.setRoomNumber(ObjectUtil.isNotEmpty(queryRoomName) ? queryRoomName : null); + } + } + if (costPayFeeAuditVo.getChargeType().equals(ChargeTypeEnum.CARD_CHARGES.getValue())) { + CostCarCharge costCarCharge = costCarChargeMapper.selectById(costPayFeeAuditVo.getChargeId()); + costPayFeeAuditVo.setCarNumber(ObjectUtil.isNotEmpty(costCarCharge) ? costCarCharge.getCarNumber() : null); + } + // TbRoomVo roomVo = roomMapper.selectVoById(costPayFeeAuditVo.getChargeId()); //costPayFeeAuditVo.setRoomNumber(ObjectUtil.isNotEmpty(roomVo)? roomVo.getRoomNumber() :null ); return costPayFeeAuditVo; } @@ -175,13 +187,13 @@ public class CostPayFeeAuditServiceImpl implements ICostPayFeeAuditService { private void validEntityBeforeUpdate(CostPayFeeAudit entity) { //TODO 做一些数据校验,如唯一约束 if (entity.getState().equals("1")) { - if (entity.getChargeType().equals("1")) { + if (entity.getChargeType().equals(ChargeTypeEnum.HOUS_CHARGES.getValue())) { CostHouseCharge costHouseCharge = coinHouseChargeMapper.selectById(entity.getChargeId()); Assert.isTrue(ObjectUtil.isNotEmpty(costHouseCharge), "该房屋收费项不存在!"); costHouseCharge.setChargeStatus(ChargeStatusEnum.THE_PAYMENT_WAS_APPROVED.getValue()); coinHouseChargeMapper.updateById(costHouseCharge); } - if (entity.getChargeType().equals("2")) { + if (entity.getChargeType().equals(ChargeTypeEnum.CARD_CHARGES.getValue())) { CostCarCharge costCarCharge = costCarChargeMapper.selectById(entity.getChargeId()); Assert.isTrue(ObjectUtil.isNotEmpty(costCarCharge), "该车辆收费项为空"); @@ -190,13 +202,13 @@ public class CostPayFeeAuditServiceImpl implements ICostPayFeeAuditService { } } if (entity.getState().equals("2")) { - if (entity.getChargeType().equals("1")) { + if (entity.getChargeType().equals(ChargeTypeEnum.HOUS_CHARGES.getValue())) { CostHouseCharge costHouseCharge = coinHouseChargeMapper.selectById(entity.getChargeId()); Assert.isTrue(ObjectUtil.isNotEmpty(costHouseCharge), "该房屋收费项为空"); costHouseCharge.setChargeStatus(ChargeStatusEnum.THE_PAYMENT_REVIEW_FAILED.getValue()); coinHouseChargeMapper.updateById(costHouseCharge); } - if (entity.getChargeType().equals("2")) { + if (entity.getChargeType().equals(ChargeTypeEnum.CARD_CHARGES.getValue())) { CostCarCharge costCarCharge = costCarChargeMapper.selectById(entity.getChargeId()); Assert.isTrue(ObjectUtil.isNotEmpty(costCarCharge), "该车辆收费项为空"); costCarCharge.setChargeStatus(ChargeStatusEnum.THE_PAYMENT_REVIEW_FAILED.getValue()); diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/MeetBookingServiceImpl.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/MeetBookingServiceImpl.java index e523081d..39f4e93b 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/MeetBookingServiceImpl.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/MeetBookingServiceImpl.java @@ -85,11 +85,13 @@ public class MeetBookingServiceImpl implements IMeetBookingService { public TableDataInfo queryPageList(MeetBookingBo bo, PageQuery pageQuery) { LambdaQueryWrapper lqw = buildQueryWrapper(bo); Page result = baseMapper.selectVoPage(pageQuery.build(), lqw); + List meetBookingVoList = new ArrayList<>(); + if(CollUtil.isNotEmpty(result.getRecords())){ List residentUnitVolist = residentUnitMapper.selectVoList(); List userId = result.getRecords().stream().map(vo -> vo.getPerson()).distinct().map(Long::parseLong).collect(Collectors.toList()); List remoteUserVos = residentPersonMapper.selectVoByIds(userId); // List remoteUserVos = remoteUserService.selectListByIds(userId); - List meetBookingVoList = new ArrayList<>(); + result.getRecords().stream().forEach(s -> { if (CollUtil.isNotEmpty(residentUnitVolist)) { ResidentUnitVo residentUnitVo = residentUnitVolist.stream() @@ -104,6 +106,7 @@ public class MeetBookingServiceImpl implements IMeetBookingService { } meetBookingVoList.add(s); }); + } return TableDataInfo.build(new Page().setRecords(meetBookingVoList).setTotal(result.getTotal())); } diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/MeetServiceImpl.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/MeetServiceImpl.java index 1f6eacf5..56a6e119 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/MeetServiceImpl.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/MeetServiceImpl.java @@ -1,8 +1,10 @@ package org.dromara.property.service.impl; import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.lang.Assert; import cn.hutool.core.util.ObjectUtil; import org.apache.dubbo.config.annotation.DubboReference; +import org.dromara.common.core.exception.ServiceException; import org.dromara.common.core.utils.MapstructUtils; import org.dromara.common.core.utils.StringUtils; import org.dromara.common.mybatis.core.page.TableDataInfo; @@ -12,11 +14,11 @@ 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.property.domain.MeetAttach; import org.dromara.property.domain.MeetBooking; +import org.dromara.property.domain.vo.MeetAttachVo; import org.dromara.property.domain.vo.ResidentPersonVo; -import org.dromara.property.mapper.MeetBookingMapper; -import org.dromara.property.mapper.ResidentPersonMapper; -import org.dromara.property.mapper.TbRoomMapper; +import org.dromara.property.mapper.*; import org.dromara.system.api.RemoteUserService; import org.dromara.system.api.domain.vo.RemoteUserVo; import org.springframework.stereotype.Service; @@ -24,7 +26,6 @@ import org.springframework.stereotype.Service; import org.dromara.property.domain.bo.MeetBo; import org.dromara.property.domain.vo.MeetVo; import org.dromara.property.domain.Meet; -import org.dromara.property.mapper.MeetMapper; import org.dromara.property.service.IMeetService; import org.springframework.transaction.annotation.Transactional; @@ -48,6 +49,7 @@ import java.util.stream.Collectors; public class MeetServiceImpl implements IMeetService { private final MeetMapper baseMapper; + private final MeetAttachMapper meetAttachMapper; private final ResidentPersonMapper residentPersonMapper; private final TbRoomMapper roomMapper; private final MeetBookingMapper meetbookMapper; @@ -63,7 +65,7 @@ public class MeetServiceImpl implements IMeetService { @Override public MeetVo queryById(Long id) { MeetVo meetVo = baseMapper.selectVoById(id); - // ResidentPersonVo residentPersonVo = residentPersonMapper.selectVoById(meetVo.getPrincipals()); + // ResidentPersonVo residentPersonVo = residentPersonMapper.selectVoById(meetVo.getPrincipals()); // if(ObjectUtil.isNotEmpty(residentPersonVo)){ // meetVo.setPrincipalsName(residentPersonVo.getUserName()); // meetVo.setPhoneNo(residentPersonVo.getPhone()); @@ -216,6 +218,10 @@ public class MeetServiceImpl implements IMeetService { public Boolean deleteWithValidByIds(Collection ids, Boolean isValid) { if (isValid) { //TODO 做一些业务上的校验,判断是否需要校验 + boolean exists = meetAttachMapper.exists(new LambdaQueryWrapper().in(MeetAttach::getMeetId, ids)); + Assert.isTrue(!exists, "会议室具有增值服务,不允许单独删除"); + boolean meetbookExists = meetbookMapper.exists(new LambdaQueryWrapper().in(MeetBooking::getMeetId, ids)); + Assert.isTrue(!meetbookExists, "会议室具有预约记录,不允许单独删除"); } return baseMapper.deleteByIds(ids) > 0; }