From 12e6270e9fb0de04ac075c5c4a28c4151874f379 Mon Sep 17 00:00:00 2001 From: yupeng <roc__yu@163.com> Date: 星期三, 26 二月 2025 14:26:51 +0800 Subject: [PATCH] feat: 账单详情等 --- ruoyi-system/src/main/java/com/ruoyi/system/service/TBillDetailService.java | 6 +++ ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TBillController.java | 32 +++++++++++++-- ruoyi-system/src/main/java/com/ruoyi/system/mapper/TBillMapper.java | 2 ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TBillServiceImpl.java | 9 ++-- ruoyi-system/src/main/resources/mapper/system/TBillMapper.xml | 5 +- ruoyi-system/src/main/java/com/ruoyi/system/service/TBillService.java | 3 + ruoyi-system/src/main/java/com/ruoyi/system/dto/TBillDto.java | 22 +++++++++++ ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TBillDetailServiceImpl.java | 9 ++++ 8 files changed, 76 insertions(+), 12 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TBillController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TBillController.java index 9a91166..a7146f1 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TBillController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TBillController.java @@ -6,16 +6,18 @@ import com.ruoyi.common.exception.ServiceException; import com.ruoyi.system.dto.*; import com.ruoyi.system.model.TBill; +import com.ruoyi.system.model.TBillDetail; import com.ruoyi.system.query.TBillQuery; +import com.ruoyi.system.service.TBillDetailService; import com.ruoyi.system.service.TBillService; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; + +import javax.validation.constraints.NotEmpty; +import java.util.List; /** * <p> @@ -32,7 +34,8 @@ @Autowired TBillService tBillService; - + @Autowired + TBillDetailService tBillDetailService; @PreAuthorize("@ss.hasPermi('system:bill:list')") @@ -50,6 +53,22 @@ tBillService.saveBill(bill); return R.ok(); } + + @ApiOperation("通过ID查找详情") + @GetMapping("getDetailById") + public R<TBillDto> getDetailById(@Validated @NotEmpty String id){ + TBillDto dto = tBillService.getDetailByBillId(id); + if (dto.getBillType().equals("3")){ + List<TBillDetail> details = tBillDetailService.getByBillId(id); + for (TBillDetail detail : details) { + if (detail.getLiveType()==1)dto.setWater(detail); //水费 + else dto.setElect(detail); //电费 + } + } + return R.ok(dto); + } + + @PreAuthorize("@ss.hasPermi('system:bill:checkOfflinePay')") @ApiOperation("确认线下缴费") @PostMapping("checkOfflinePay") @@ -83,5 +102,8 @@ } + + + } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/dto/TBillDto.java b/ruoyi-system/src/main/java/com/ruoyi/system/dto/TBillDto.java index 45c2e41..6619889 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/dto/TBillDto.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/dto/TBillDto.java @@ -1,8 +1,10 @@ package com.ruoyi.system.dto; import com.ruoyi.system.model.TBill; +import com.ruoyi.system.model.TBillDetail; import lombok.Data; +import java.math.BigDecimal; import java.util.List; @Data @@ -17,6 +19,26 @@ private String account; private String houseName; + /** + * 合同信息 + */ + private String contractName; + private String partyTwoName; + + private BigDecimal totalYear; + + private String payType; + + private BigDecimal deposit; + + /** + * 水费 + */ + private TBillDetail water; + /** + * 电费 + */ + private TBillDetail elect; } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/TBillMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/TBillMapper.java index 6a447fb..45735ef 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/TBillMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/TBillMapper.java @@ -34,5 +34,5 @@ */ List<TBillDto> invoiceList(@Param("query")TBillQuery query, @Param("pageInfo")PageInfo<TBillDto> pageInfo); - TBillDto selectTenentByBillId(@Param("billId") String billId); + TBillDto selectDetailByBillId(@Param("billId") String billId); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/TBillDetailService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/TBillDetailService.java index 36d0bed..f5fdf98 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/TBillDetailService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/TBillDetailService.java @@ -3,6 +3,9 @@ import com.baomidou.mybatisplus.extension.service.IService; import com.ruoyi.system.model.TBillDetail; +import javax.validation.constraints.NotEmpty; +import java.util.List; + /** * <p> * 账单水电费子表 服务类 @@ -13,4 +16,7 @@ */ public interface TBillDetailService extends IService<TBillDetail> { + List<TBillDetail> getByBillId(@NotEmpty String billId); + + } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/TBillService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/TBillService.java index b561ecd..1a08a95 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/TBillService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/TBillService.java @@ -10,6 +10,7 @@ import com.ruoyi.system.query.TBillQuery; import com.taxi591.bankapi.dto.ChargeBillRequest; +import javax.validation.constraints.NotEmpty; import java.math.BigDecimal; import java.util.List; import java.util.function.Consumer; @@ -81,4 +82,6 @@ Integer sendSmsByBillIds(SmsByBillDto dto); Integer sendMailBatchByBillIds(SmsByBillDto dto); + + TBillDto getDetailByBillId(@NotEmpty String id); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TBillDetailServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TBillDetailServiceImpl.java index 44e6404..905e81b 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TBillDetailServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TBillDetailServiceImpl.java @@ -1,10 +1,15 @@ package com.ruoyi.system.service.impl; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.ruoyi.system.mapper.TBillDetailMapper; import com.ruoyi.system.model.TBillDetail; +import com.ruoyi.system.model.TOrderBill; import com.ruoyi.system.service.TBillDetailService; import org.springframework.stereotype.Service; + +import javax.validation.constraints.NotEmpty; +import java.util.List; /** * <p> @@ -17,4 +22,8 @@ @Service public class TBillDetailServiceImpl extends ServiceImpl<TBillDetailMapper, TBillDetail> implements TBillDetailService { + @Override + public List<TBillDetail> getByBillId(@NotEmpty String billId) { + return list(new LambdaQueryWrapper<TBillDetail>().eq(TBillDetail::getBillId,billId)); + } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TBillServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TBillServiceImpl.java index 88b06ed..a694c73 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TBillServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TBillServiceImpl.java @@ -30,6 +30,7 @@ import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; +import javax.validation.constraints.NotEmpty; import java.util.*; import java.util.stream.Collectors; import java.math.BigDecimal; @@ -359,7 +360,7 @@ public Integer sendSmsByBillIds(SmsByBillDto dto) { int failNum = 0; for (String billId : dto.getBillIds()) { - TBillDto bill = getTenentByBillId(billId); + TBillDto bill = getDetailByBillId(billId); if (bill.getSmsLastTime()!=null && (System.currentTimeMillis()-bill.getSmsLastTime().getTime()<smsUtil.getPro().getBillSmsDelayPeriod()*60*1000L)){ throw new ServiceException("有账单最近一次发送的时间是:"+DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS,bill.getSmsLastTime())); @@ -388,7 +389,7 @@ public Integer sendMailBatchByBillIds(SmsByBillDto dto) { int failNum = 0; for (String billId : dto.getBillIds()) { - TBillDto bill = getTenentByBillId(billId); + TBillDto bill = getDetailByBillId(billId); if (bill.getSmsLastTime()!=null && (System.currentTimeMillis()-bill.getSmsLastTime().getTime()<smsUtil.getPro().getBillMailDelayPeriod()*60*1000L)){ throw new ServiceException("有账单最近一次发送的时间是:"+DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS,bill.getSmsLastTime())); @@ -413,8 +414,8 @@ return failNum; } - private TBillDto getTenentByBillId(String billId) { - return getBaseMapper().selectTenentByBillId(billId); + public TBillDto getDetailByBillId(@NotEmpty String billId) { + return getBaseMapper().selectDetailByBillId(billId); } diff --git a/ruoyi-system/src/main/resources/mapper/system/TBillMapper.xml b/ruoyi-system/src/main/resources/mapper/system/TBillMapper.xml index 76763fd..5c90e07 100644 --- a/ruoyi-system/src/main/resources/mapper/system/TBillMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/TBillMapper.xml @@ -130,14 +130,15 @@ order by b.pay_fees_time </select> - <select id="selectTenentByBillId" resultType="com.ruoyi.system.dto.TBillDto"> + <select id="selectDetailByBillId" resultType="com.ruoyi.system.dto.TBillDto"> SELECT b.*, t.resident_name as residentName, t.email, t.phone, t.account, - h.house_name as houseName + h.house_name as houseName, + c.contract_name,c.pay_type,c.party_two_name,c.total_year,c.deposit FROM t_bill b LEFT JOIN t_contract c ON c.contract_number = b.contract_number and c.disabled=0 -- Gitblit v1.7.1