yupeng
2025-02-10 18103fed365cae039826711f1b6848b672520214
feat:新增小程序账单列表接口
7个文件已修改
95 ■■■■ 已修改文件
ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/BankOutController.java 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/task/TbillTask.java 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-applet/src/main/java/com/ruoyi/web/controller/api/TBillController.java 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/dto/TBillDto.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/query/TBillQuery.java 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TPayOrderServiceImpl.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/resources/mapper/system/TBillMapper.xml 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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
@@ -1,6 +1,16 @@
package com.ruoyi.web.controller.api;
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.service.TBillService;
import org.springframework.beans.factory.annotation.Autowired;
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;
@@ -16,5 +26,18 @@
@RequestMapping("/t-bill")
public class TBillController {
    @Autowired
    TBillService tBillService;
    @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">
@@ -56,6 +58,9 @@
            <if test="query.contractNumber != null and query.contractNumber !=''">
                and b.contract_number = #{contractNumber}
            </if>
            <if test="query.userId != null and query.userId !=''">
                and b.contract_number = #{contractNumber}
            </if>
        </where>
    </select>
</mapper>