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 @@ } } 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; } 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); } 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); } 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); } 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)); } } 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); } 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