| | |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.system.model.TBankFlow; |
| | | import com.ruoyi.system.model.TFlowManagement; |
| | | import com.ruoyi.system.query.TBankFlowQuery; |
| | | import com.ruoyi.system.query.TFlowManagementQuery; |
| | | import com.ruoyi.system.service.TBankFlowService; |
| | | import com.ruoyi.system.service.TFlowManagementService; |
| | | import com.ruoyi.system.vo.TBankFlowStatisticsVo; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | |
| | | public R<PageInfo<TBankFlow>> list(@RequestBody TBankFlowQuery query) { |
| | | return R.ok(flowService.pageList(query)); |
| | | } |
| | | |
| | | @ApiOperation(value = "根据支付方式统计流水金额") |
| | | @PostMapping("/getPaymentStats") |
| | | public R<TBankFlowStatisticsVo> getPaymentStats(@RequestBody TBankFlowQuery query){ |
| | | return R.ok(flowService.getPaymentStats(query)); |
| | | } |
| | | } |
| | | |
| | |
| | | import com.ruoyi.system.model.TFlowManagement; |
| | | import com.ruoyi.system.query.TFlowManagementQuery; |
| | | import com.ruoyi.system.service.TFlowManagementService; |
| | | import com.ruoyi.system.vo.TFlowManagementStatisticsVo; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | |
| | | return R.ok(flowService.pageList(query)); |
| | | } |
| | | |
| | | @ApiOperation(value = "根据支付方式统计流水金额") |
| | | @PostMapping("/getPaymentStats") |
| | | public R<TFlowManagementStatisticsVo> getPaymentStats(@RequestBody TFlowManagementQuery query){ |
| | | return R.ok(flowService.getPaymentStats(query)); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | @ApiOperation(value = "关联账单信息") |
| | | @GetMapping(value = "/getBillByInvoiceId") |
| | | public R<PageInfo<TBill>> getBillByInvoiceId(String invoiceId){ |
| | | @GetMapping(value = "/getBillByInvoiceId/{invoiceId}") |
| | | public R<PageInfo<TBill>> getBillByInvoiceId(@PathVariable String invoiceId){ |
| | | return R.ok(tBillService.getBillByInvoiceId(invoiceId)); |
| | | } |
| | | |
| | |
| | | TInvoice tInvoice = new TInvoice(); |
| | | tInvoice.setId(query.getId()); |
| | | tInvoice.setInvoiceVoucher(query.getInvoiceVoucher()); |
| | | tInvoice.setInvoiceVoucherName(query.getInvoiceVoucherName()); |
| | | tInvoice.setInvoiceTime(query.getInvoiceTime()); |
| | | tInvoice.setStatus(2); |
| | | return R.ok(invoiceService.updateById(tInvoice)); |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.system.model.TBankFlow; |
| | | import com.ruoyi.system.query.TBankFlowQuery; |
| | | import com.ruoyi.system.vo.TBankFlowStatisticsVo; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | * @since 2025-02-07 |
| | | */ |
| | | public interface TBankFlowMapper extends BaseMapper<TBankFlow> { |
| | | TBankFlowStatisticsVo getPaymentStats(@Param("req") TBankFlowQuery query); |
| | | |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.system.model.TFlowManagement; |
| | | import com.ruoyi.system.query.TFlowManagementQuery; |
| | | import com.ruoyi.system.vo.TFlowManagementStatisticsVo; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | * @since 2025-01-17 |
| | | */ |
| | | public interface TFlowManagementMapper extends BaseMapper<TFlowManagement> { |
| | | |
| | | TFlowManagementStatisticsVo getPaymentStats(@Param("req") TFlowManagementQuery query); |
| | | } |
| | |
| | | @TableField("contract_number") |
| | | private String contractNumber; |
| | | |
| | | @ApiModelProperty(value = "开票文件名称") |
| | | @TableField("invoice_voucher_name") |
| | | private String invoiceVoucherName; |
| | | |
| | | |
| | | } |
| | |
| | | package com.ruoyi.system.query; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.common.core.domain.BasePage; |
| | | import io.swagger.annotations.ApiModel; |
| | |
| | | @ApiModelProperty(value = "开票结束日期") |
| | | private String invoiceEndTime; |
| | | |
| | | @ApiModelProperty(value = "开票文件名称") |
| | | private String invoiceVoucherName; |
| | | |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.system.model.TBankFlow; |
| | | import com.ruoyi.system.model.TFlowManagement; |
| | | import com.ruoyi.system.query.TBankFlowQuery; |
| | | import com.ruoyi.system.query.TFlowManagementQuery; |
| | | import com.ruoyi.system.vo.TBankFlowStatisticsVo; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | |
| | | PageInfo<TBankFlow> pageList(TBankFlowQuery query); |
| | | List<TBankFlow> makeQuery(TBankFlowQuery query); |
| | | TBankFlowStatisticsVo getPaymentStats( TBankFlowQuery query); |
| | | |
| | | List<TBankFlow> searchByBankSerialNumber(String bankSerialNumber); |
| | | |
| | | |
| | | } |
| | |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.system.model.TFlowManagement; |
| | | import com.ruoyi.system.query.TFlowManagementQuery; |
| | | import com.ruoyi.system.vo.TFlowManagementStatisticsVo; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | public interface TFlowManagementService extends IService<TFlowManagement> { |
| | | PageInfo<TFlowManagement> pageList(TFlowManagementQuery query); |
| | | List<TFlowManagement> makeQuery(TFlowManagementQuery query); |
| | | TFlowManagementStatisticsVo getPaymentStats(TFlowManagementQuery req); |
| | | |
| | | |
| | | |
| | |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.system.mapper.TBankFlowMapper; |
| | | import com.ruoyi.system.model.TBankFlow; |
| | | import com.ruoyi.system.model.TFlowManagement; |
| | | import com.ruoyi.system.query.TBankFlowQuery; |
| | | import com.ruoyi.system.service.TBankFlowService; |
| | | import com.ruoyi.system.vo.TBankFlowStatisticsVo; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | |
| | | pageInfo.setTotal(list.size()); |
| | | return pageInfo; |
| | | } |
| | | |
| | | @Override |
| | | public List<TBankFlow> makeQuery(TBankFlowQuery query) { |
| | | LambdaQueryWrapper<TBankFlow> queryWrapper = new LambdaQueryWrapper<>(); |
| | |
| | | ; |
| | | return this.baseMapper.selectList(queryWrapper); |
| | | } |
| | | |
| | | @Override |
| | | public TBankFlowStatisticsVo getPaymentStats(TBankFlowQuery query) { |
| | | return this.baseMapper.getPaymentStats(query); |
| | | } |
| | | |
| | | /** |
| | | * 根据银行流水号模糊查询 |
| | | * @param bankSerialNumber |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<TBankFlow> searchByBankSerialNumber(String bankSerialNumber) { |
| | | LambdaQueryWrapper<TBankFlow> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.like(StringUtils.isNotEmpty(bankSerialNumber),TBankFlow::getBankSerialNumber,bankSerialNumber); |
| | | return this.baseMapper.selectList(queryWrapper); |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.system.query.TFlowManagementQuery; |
| | | import com.ruoyi.system.service.TFlowManagementService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.system.vo.TFlowManagementStatisticsVo; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | |
| | | ; |
| | | return this.baseMapper.selectList(queryWrapper); |
| | | } |
| | | |
| | | @Override |
| | | public TFlowManagementStatisticsVo getPaymentStats(TFlowManagementQuery query) { |
| | | return this.baseMapper.getPaymentStats(query); |
| | | } |
| | | } |
| | |
| | | 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.common.basic.PageInfo; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.system.mapper.TInvoiceMapper; |
| | | import com.ruoyi.system.model.TBill; |
| | | import com.ruoyi.system.model.TInvoice; |
| | | import com.ruoyi.system.model.TInvoiceToBill; |
| | | import com.ruoyi.system.query.TInvoiceQuery; |
| | | import com.ruoyi.system.query.TInvoiceToBillQuery; |
| | | import com.ruoyi.system.service.TBillService; |
| | | import com.ruoyi.system.service.TInvoiceService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.sun.org.apache.regexp.internal.RE; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | package com.ruoyi.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.system.model.TInvoice; |
| | | import com.ruoyi.system.model.TInvoiceToBill; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.system.mapper.TInvoiceToBillMapper; |
| | | import com.ruoyi.system.model.TInvoiceToBill; |
| | | import com.ruoyi.system.query.TInvoiceToBillQuery; |
| | | import com.ruoyi.system.service.TInvoiceToBillService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.system.mapper.TInvoiceToBillMapper; |
| | | import com.ruoyi.system.model.TInvoiceToBill; |
| | | import com.ruoyi.system.service.TInvoiceToBillService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
New file |
| | |
| | | package com.ruoyi.system.vo; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * @author 64502 |
| | | */ |
| | | @Data |
| | | @ApiModel(value = "系统流水统计VO") |
| | | public class TBankFlowStatisticsVo { |
| | | @ApiModelProperty(value = "流水总额") |
| | | private BigDecimal totalFlowMoney; |
| | | |
| | | @ApiModelProperty(value = "已抵扣金额") |
| | | private BigDecimal totalDeductionMoney; |
| | | |
| | | @ApiModelProperty(value = "剩余未抵扣") |
| | | private BigDecimal totalRemainingMoney; |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.system.vo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * @author 64502 |
| | | */ |
| | | @Data |
| | | @ApiModel(value = "系统流水统计VO") |
| | | public class TFlowManagementStatisticsVo { |
| | | @ApiModelProperty(value = "系统流水总额") |
| | | private BigDecimal totalAmount; |
| | | |
| | | @ApiModelProperty(value = "微信") |
| | | private BigDecimal wechatAmount; |
| | | |
| | | @ApiModelProperty(value = "支付宝") |
| | | private BigDecimal alipayAmount; |
| | | |
| | | @ApiModelProperty(value = "线下支付") |
| | | private BigDecimal offlineAmount; |
| | | } |
| | |
| | | id, bank_serial_number, flow_money, deduction_money, remaining_money, pay_time, payer, flow_status, pay_type, payment_bill_id, create_time, update_time, create_by, update_by, disabled |
| | | </sql> |
| | | |
| | | |
| | | <!-- 定义结果映射 --> |
| | | <resultMap id="PaymentStatsResultMap" type="com.ruoyi.system.vo.TBankFlowStatisticsVo"> |
| | | <result property="totalFlowMoney" column="totalFlowMoney" /> |
| | | <result property="totalDeductionMoney" column="totalDeductionMoney" /> |
| | | <result property="totalRemainingMoney" column="totalRemainingMoney" /> |
| | | </resultMap> |
| | | |
| | | <!-- 统计总额和微信支付金额 --> |
| | | <select id="getPaymentStats" resultMap="PaymentStatsResultMap"> |
| | | SELECT |
| | | SUM(flow_money) AS totalFlowMoney, |
| | | SUM(deduction_money) AS totalDeductionMoney, |
| | | SUM(remaining_money) AS totalRemainingMoney |
| | | FROM |
| | | t_bank_flow |
| | | <where> |
| | | <if test="req.bankSerialNumber != null and req.bankSerialNumber != ''"> |
| | | and bank_serial_number = #{req.bankSerialNumber} |
| | | </if> |
| | | <if test="req.payer != null and req.payer != ''"> |
| | | and payer like concat('%', #{req.payer}, '%') |
| | | </if> |
| | | <if test="req.flowStatus != null and req.flowStatus != ''"> |
| | | and flow_status = #{req.flowStatus} |
| | | </if> |
| | | <if test="req.payStartTime != null and req.payStartTime != ''"> |
| | | and pay_time >= #{req.payStartTime} |
| | | </if> |
| | | <if test="req.payEndTime != null and req.payEndTime != ''"> |
| | | and pay_time <= #{req.payEndTime} |
| | | </if> |
| | | AND disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()} |
| | | </where> |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | id, sys_serial_number, bank_serial_number, flow_money, deduction_money, remaining_money, pay_time, payer, flow_status, flow_type, pay_type, payment_bill_id, create_time, update_time, create_by, update_by, disabled |
| | | </sql> |
| | | |
| | | |
| | | <!-- 定义结果映射 --> |
| | | <resultMap id="PaymentStatsResultMap" type="com.ruoyi.system.vo.TFlowManagementStatisticsVo"> |
| | | <result property="totalAmount" column="total_amount" /> |
| | | <result property="wechatAmount" column="wechat_amount" /> |
| | | <result property="alipayAmount" column="alipay_amount" /> |
| | | <result property="offlineAmount" column="offline_amount" /> |
| | | </resultMap> |
| | | |
| | | <!-- 统计总额和微信支付金额 --> |
| | | <select id="getPaymentStats" resultMap="PaymentStatsResultMap"> |
| | | SELECT SUM(flow_money) AS total_amount, |
| | | SUM(CASE WHEN pay_type = 1 THEN flow_money ELSE 0 END ) AS wechat_amount, |
| | | SUM(CASE WHEN pay_type = 2 THEN flow_money ELSE 0 END ) AS alipay_amount, |
| | | SUM(CASE WHEN pay_type = 3 THEN flow_money ELSE 0 END ) AS offline_amount |
| | | FROM |
| | | t_flow_management |
| | | <where> |
| | | <if test="req.sysSerialNumber != null and req.sysSerialNumber != ''"> |
| | | and sys_serial_number = #{req.sysSerialNumber} |
| | | </if> |
| | | <if test="req.bankSerialNumber != null and req.bankSerialNumber != ''"> |
| | | and bank_serial_number = #{req.bankSerialNumber} |
| | | </if> |
| | | <if test="req.payer != null and req.payer != ''"> |
| | | and payer like concat('%', #{req.payer}, '%') |
| | | </if> |
| | | <if test="req.payType != null and req.payType != ''"> |
| | | and pay_type = #{req.payType} |
| | | </if> |
| | | <if test="req.payStartTime != null and req.payStartTime != ''"> |
| | | and pay_time >= #{req.payStartTime} |
| | | </if> |
| | | <if test="req.payEndTime != null and req.payEndTime != ''"> |
| | | and pay_time <= #{req.payEndTime} |
| | | </if> |
| | | AND disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()} |
| | | </where> |
| | | </select> |
| | | |
| | | |
| | | |
| | | </mapper> |