ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/BankOutController.java
@@ -1,5 +1,6 @@ package com.ruoyi.web.controller.api; import com.ruoyi.system.service.TBillService; import com.taxi591.bankapi.dto.CovertPayBackResult; import com.taxi591.bankapi.service.BankService; import org.springframework.beans.factory.annotation.Autowired; @@ -17,10 +18,12 @@ @Autowired BankService bankService; @Autowired TBillService tBillService; @PostMapping(value = "payCallback") public @ResponseBody String payCallback(HttpServletRequest request){ CovertPayBackResult result = bankService.covertPayCallBack(request, (billRequest) -> { String orderno = billRequest.getMessage().getInfo().getInput1(); return true; }); ruoyi-admin/src/main/java/com/ruoyi/web/task/TbillTask.java
@@ -1,6 +1,7 @@ package com.ruoyi.web.task; import com.ruoyi.common.basic.PageInfo; import com.ruoyi.system.dto.TBillDto; import com.ruoyi.system.model.TBill; import com.ruoyi.system.model.TContract; import com.ruoyi.system.query.TBillQuery; @@ -25,38 +26,6 @@ @Autowired TContractService tContractService; public void generateBill(){ try { int index = 1; int rows = 20; long pages = 0; TContractQuery query = new TContractQuery(); query.setPageSize(rows); query.setStatus(4); Calendar c = Calendar.getInstance(); Date time = c.getTime(); do { query.setPageNum(index); PageInfo<TContract> pageinfo = tContractService.contractList(query); if (pages==0){ pages = pageinfo.getPages(); } if (pageinfo.getRecords()!=null && pageinfo.getRecords().size()>0){ pageinfo.getRecords().forEach(tContract -> { //todo 生成账单 }); } index++; }while (index<=pages); }catch (Exception e){ log.error(""); } } /** * 判断账单是否到期 */ @@ -73,7 +42,7 @@ Date time = c.getTime(); do { query.setPageNum(index); PageInfo<TBill> pageinfo = tBillService.queryPage(query); PageInfo<TBillDto> pageinfo = tBillService.queryPage(query); if (pages==0){ pages = pageinfo.getPages(); } @@ -110,7 +79,7 @@ Date time = c.getTime(); do { query.setPageNum(index); PageInfo<TContract> pageinfo = tContractService.contractList(query); PageInfo<TBillDto> pageinfo = tBillService.queryPage(query); if (pages==0){ pages = pageinfo.getPages(); } ruoyi-applet/src/main/java/com/ruoyi/web/controller/api/TBillController.java
@@ -3,15 +3,12 @@ import com.ruoyi.common.basic.PageInfo; import com.ruoyi.common.core.domain.R; import com.ruoyi.common.exception.ServiceException; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.system.dto.TBillDto; import com.ruoyi.system.query.TBillQuery; import com.ruoyi.system.query.TTenantQuery; import com.ruoyi.system.service.TBillService; import com.ruoyi.system.vo.TBillVO; import com.ruoyi.system.vo.TenantVO; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; @@ -25,27 +22,21 @@ * @author xiaochen * @since 2025-01-17 */ @Api(tags = "租金账单管理") @RestController @RequestMapping("/t-bill") public class TBillController { private final TBillService billService; @Autowired public TBillController(TBillService billService) { this.billService = billService; } TBillService tBillService; /** * 获取账单列表 */ @ApiOperation(value = "获取账单列表") @PostMapping(value = "/pageList") public R<PageInfo<TBillVO>> pageList(@RequestBody TBillQuery query) { return R.ok(billService.pageList(query)); @PostMapping("list") public R<PageInfo<TBillDto>> list(@RequestBody TBillQuery query){ if (StringUtils.isEmpty(query.getUserId())){ throw new ServiceException("用户ID不能为空"); } PageInfo<TBillDto> pageInfo = tBillService.queryPage(query); return R.ok(pageInfo); } } ruoyi-system/src/main/java/com/ruoyi/system/dto/TBillDto.java
@@ -14,4 +14,6 @@ private String account; private String houseName; } ruoyi-system/src/main/java/com/ruoyi/system/query/TBillQuery.java
@@ -1,6 +1,7 @@ package com.ruoyi.system.query; import com.ruoyi.common.core.domain.BasePage; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @Data @@ -8,13 +9,20 @@ /** * 缴费状态 1=未缴费 2=待确认 3=已缴费 4=已逾期 */ @ApiModelProperty("缴费状态 1=未缴费 2=待确认 3=已缴费 4=已逾期") private Integer payFeesStatus; @ApiModelProperty("联系电话") private String phone; @ApiModelProperty("租户名称") private String residentName; @ApiModelProperty("合同编号") private String contractNumber; /** * 租户ID */ @ApiModelProperty("租户ID") private String userId; ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TPayOrderServiceImpl.java
@@ -47,10 +47,7 @@ public long caculateRentFee(TBill bill){ return bill.getPayableFeesMoney().add(bill.getPayableFeesPenalty()) .subtract(bill.getActualMoney()) .multiply(AmountConstant.b100) .setScale(0, RoundingMode.HALF_DOWN) return bill.getOutstandingMoney() .longValue(); } @@ -86,6 +83,7 @@ order.setAmount(dto.getAmount()); order.setUserId(user.getId()); order.setPhone(user.getPhone()); order.setOpenId(dto.getOpenId()); order.setUserName(user.getResidentName()); save(order); TOrderBill tOrderBill = new TOrderBill(); @@ -119,6 +117,7 @@ order.setAmount(dto.getAmount()); order.setUserId(user.getId()); order.setPhone(user.getPhone()); order.setOpenId(dto.getOpenId()); order.setUserName(user.getResidentName()); save(order); tOrderBillService.saveBatch(orderBills); ruoyi-system/src/main/resources/mapper/system/TBillMapper.xml
@@ -38,10 +38,12 @@ b.*, t.resident_name as residentName, t.phone, t.account t.account, h.house_name as houseName FROM t_bill b LEFT JOIN t_contract c ON c.contract_number = b.contract_number LEFT JOIN t_house h ON h.id = c.house_id LEFT JOIN t_tenant t ON t.id = c.tenant_id <where> <if test="query.payFeesStatus != null"> @@ -54,7 +56,10 @@ and t.resident_name like concat('%',#{query.residentName},'%') </if> <if test="query.contractNumber != null and query.contractNumber !=''"> and b.contract_number = #{contractNumber} and b.contract_number = #{query.contractNumber} </if> <if test="query.userId != null and query.userId !=''"> and t.id = #{query.userId} </if> </where> </select>