Переглянути джерело

新增: 补缴统计表、退费统计表

master
jiangsongz 1 день тому
джерело
коміт
842d60be07
16 змінених файлів з 728 додано та 0 видалено
  1. 42
    0
      zhywpt-app-settlew/src/main/java/cn/com/taiji/settlew/api/payment/BackPaymentCollectionController.java
  2. 44
    0
      zhywpt-app-settlew/src/main/java/cn/com/taiji/settlew/api/refund/RefundCollectionController.java
  3. 19
    0
      zhywpt-app-settlew/src/main/java/cn/com/taiji/settlew/dao/jdbc/refund/RefundCollectionDao.java
  4. 58
    0
      zhywpt-app-settlew/src/main/java/cn/com/taiji/settlew/dao/jdbc/refund/RefundCollectionJdbcDao.java
  5. 43
    0
      zhywpt-app-settlew/src/main/java/cn/com/taiji/settlew/dto/payment/BackPaymentCollectionDTO.java
  6. 36
    0
      zhywpt-app-settlew/src/main/java/cn/com/taiji/settlew/dto/refund/RefundCollectionDTO.java
  7. 29
    0
      zhywpt-app-settlew/src/main/java/cn/com/taiji/settlew/manager/payment/BackPaymentCollectionManager.java
  8. 110
    0
      zhywpt-app-settlew/src/main/java/cn/com/taiji/settlew/manager/payment/BackPaymentCollectionManagerImpl.java
  9. 19
    0
      zhywpt-app-settlew/src/main/java/cn/com/taiji/settlew/manager/refund/RefundCollectionManager.java
  10. 119
    0
      zhywpt-app-settlew/src/main/java/cn/com/taiji/settlew/manager/refund/RefundCollectionManagerImpl.java
  11. 25
    0
      zhywpt-app-settlew/src/main/java/cn/com/taiji/settlew/model/payment/BackPaymentCollectionPageRequestDTO.java
  12. 28
    0
      zhywpt-app-settlew/src/main/java/cn/com/taiji/settlew/model/refund/RefundCollectionPageRequestDTO.java
  13. 33
    0
      zhywpt-app-settlew/src/main/java/cn/com/taiji/settlew/repo/jpa/request/payment/BackPaymentCollectionPageRequest.java
  14. 36
    0
      zhywpt-app-settlew/src/main/java/cn/com/taiji/settlew/repo/jpa/request/refund/RefundCollectionPageRequest.java
  15. 48
    0
      zhywpt-app-settlew/src/main/java/cn/com/taiji/settlew/vo/payment/BackPaymentCollectionVo.java
  16. 39
    0
      zhywpt-app-settlew/src/main/java/cn/com/taiji/settlew/vo/refund/RefundCollectionVo.java

+ 42
- 0
zhywpt-app-settlew/src/main/java/cn/com/taiji/settlew/api/payment/BackPaymentCollectionController.java Переглянути файл

@@ -0,0 +1,42 @@
package cn.com.taiji.settlew.api.payment;

import cn.com.taiji.common.manager.ManagerException;
import cn.com.taiji.common.model.dao.Pagination;
import cn.com.taiji.common.web.ApiResponse;
import cn.com.taiji.settlew.api.MyApiValidController;
import cn.com.taiji.settlew.manager.payment.BackPaymentCollectionManager;
import cn.com.taiji.settlew.model.CommonExportResponse;
import cn.com.taiji.settlew.model.payment.BackPaymentCollectionPageRequestDTO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
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;

/**
* 补缴统计报表
* @Author jiangsong
* @create 2025/9/25
*/
@Api(tags = {"补缴统计表"})
@RestController
@RequestMapping("/backpayment/report")
public class BackPaymentCollectionController extends MyApiValidController {
@Autowired
private BackPaymentCollectionManager manager;

@ApiOperation("查询")
@PostMapping("/pageQuery")
public ApiResponse<Pagination> pageQuery(@Validated @RequestBody BackPaymentCollectionPageRequestDTO req){
return ApiResponse.of(manager.query(req));
}
@ApiOperation("导出")
@PostMapping("/export")
public ApiResponse<CommonExportResponse> exportExcel(@Validated @RequestBody BackPaymentCollectionPageRequestDTO req) throws ManagerException {
return ApiResponse.of(manager.export(req));
}

}

+ 44
- 0
zhywpt-app-settlew/src/main/java/cn/com/taiji/settlew/api/refund/RefundCollectionController.java Переглянути файл

@@ -0,0 +1,44 @@
package cn.com.taiji.settlew.api.refund;

import cn.com.taiji.common.manager.ManagerException;
import cn.com.taiji.common.model.dao.Pagination;
import cn.com.taiji.common.web.ApiResponse;
import cn.com.taiji.settlew.api.MyValidController;
import cn.com.taiji.settlew.manager.refund.RefundCollectionManager;
import cn.com.taiji.settlew.model.CommonExportResponse;
import cn.com.taiji.settlew.model.refund.RefundCollectionPageRequestDTO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
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;

/**
* 退费统计报表 接口
* @Author jiangsong
* @create 2025/9/25
*/
@Api(tags = {"退费统计表"})
@RestController
@RequestMapping("/refund/refundCollection")
public class RefundCollectionController extends MyValidController {

@Autowired
private RefundCollectionManager manager;

@ApiOperation("查询")
@PostMapping("/pageQuery")
public ApiResponse<Pagination> pageQuery(@Validated @RequestBody RefundCollectionPageRequestDTO req) throws ManagerException {
return ApiResponse.of(manager.query(req));
}
@ApiOperation("导出")
@PostMapping("/export")
public ApiResponse<CommonExportResponse> exportExcel(@Validated @RequestBody RefundCollectionPageRequestDTO req) throws ManagerException {
return ApiResponse.of(manager.export(req));
}


}

+ 19
- 0
zhywpt-app-settlew/src/main/java/cn/com/taiji/settlew/dao/jdbc/refund/RefundCollectionDao.java Переглянути файл

@@ -0,0 +1,19 @@
package cn.com.taiji.settlew.dao.jdbc.refund;

import cn.com.taiji.settlew.dto.refund.RefundCollectionDTO;
import cn.com.taiji.settlew.model.refund.RefundCollectionPageRequestDTO;

import java.util.List;

/**
*
* 退费统计
* @Author jiangsong
* @create 2025/9/25
*/
public interface RefundCollectionDao {


List<RefundCollectionDTO> queryRefundCollectionList(RefundCollectionPageRequestDTO page);

}

+ 58
- 0
zhywpt-app-settlew/src/main/java/cn/com/taiji/settlew/dao/jdbc/refund/RefundCollectionJdbcDao.java Переглянути файл

@@ -0,0 +1,58 @@
package cn.com.taiji.settlew.dao.jdbc.refund;

import cn.com.taiji.common.dao.jdbc.EntityRowMapper;
import cn.com.taiji.settlew.dao.jdbc.BaseDataTemplate;
import cn.com.taiji.settlew.dto.refund.RefundCollectionDTO;
import cn.com.taiji.settlew.model.refund.RefundCollectionPageRequestDTO;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.stereotype.Service;

import java.sql.Timestamp;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;

/**
* 退费统计查询
* @Author jiangsong
* @create 2025/9/25
*/
@Service
public class RefundCollectionJdbcDao extends BaseDataTemplate implements RefundCollectionDao{

// 退费统计
private static final RowMapper<RefundCollectionDTO> REFUND_COLLECTION_DTO_MAPPER =
new EntityRowMapper<>(RefundCollectionDTO.class);


@Override
public List<RefundCollectionDTO> queryRefundCollectionList(RefundCollectionPageRequestDTO page) {
LocalDateTime refundDateStart = page.getRefundDateStart();
LocalDateTime refundDateEnd = page.getRefundDateEnd();
StringBuilder sql = new StringBuilder();
List<Object> paramList = new ArrayList<>();
buildRefundCollectionReportSql(sql,paramList,refundDateStart,refundDateEnd);
// 转换参数
Object[] paramObj = paramList.toArray();
return this.query(sql.toString(), paramObj, REFUND_COLLECTION_DTO_MAPPER);
}


private void buildRefundCollectionReportSql(StringBuilder sql, List<Object> paramList,LocalDateTime refundDateStart,LocalDateTime refundDateEnd) {
sql.append(" SELECT REFUND_TYPE," +
" COUNT(REFUND_TYPE) REFUND_COUNT," + // 退费数量
" SUM(REFUND_AMOUNT) REFUND_AMOUNT " + // 退费金额
" from SETTLE_REFUND_COLLECTION where 1=1");

if (refundDateStart != null) {
sql.append(" AND REFUND_DATE >= ? ");
// 显式转换,更清晰
paramList.add(Timestamp.valueOf(refundDateStart));
}
if (refundDateEnd != null) {
sql.append(" AND REFUND_DATE <= ? ");
paramList.add(Timestamp.valueOf(refundDateEnd));
}
sql.append(" GROUP BY REFUND_TYPE ORDER BY REFUND_TYPE ");
}
}

+ 43
- 0
zhywpt-app-settlew/src/main/java/cn/com/taiji/settlew/dto/payment/BackPaymentCollectionDTO.java Переглянути файл

@@ -0,0 +1,43 @@
package cn.com.taiji.settlew.dto.payment;

import cn.com.taiji.common.model.BaseDTO;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
* 补缴统计
* @Author jiangsong
* @create 2025/9/25
*/
@Data
public class BackPaymentCollectionDTO extends BaseDTO {

@ApiModelProperty(value = "结算周期")
private String settlementDate;
@ApiModelProperty(value = "渠道")
private String agencyName;
@ApiModelProperty(value = "用户应补")
private Long shouldPay;
@ApiModelProperty(value = "用户实补")

private Long actualPay;
@ApiModelProperty(value = "商户号到账")
private Long shArrivedPay;
@ApiModelProperty(value = "渠道费")
private Long agencyFee;
@ApiModelProperty(value = "实际到账")
private Long actualArrivedPay;
// 实际到账 = 商户号到账 - 渠道费
public Long getActualArrivedPay() {
return (actualArrivedPay == null ? 0L : actualArrivedPay) - (agencyFee == null ? 0L : agencyFee);
}

@ApiModelProperty(value = "小计")
private Long subTotal;
@ApiModelProperty(value = "注销退款重复退费补缴")
private Long preRefundPay;
@ApiModelProperty(value = "合计")
private Long total;
@ApiModelProperty(value = "到账盈亏款项(盈-亏+)")
private Long proLossPay;
}

+ 36
- 0
zhywpt-app-settlew/src/main/java/cn/com/taiji/settlew/dto/refund/RefundCollectionDTO.java Переглянути файл

@@ -0,0 +1,36 @@
package cn.com.taiji.settlew.dto.refund;

import cn.com.taiji.common.model.BaseDTO;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.persistence.Column;

/**
* 退费统计
* @Author jiangsong
* @create 2025/9/25
*/
@Data
public class RefundCollectionDTO extends BaseDTO {
@ApiModelProperty(value = "序号",hidden = true)
private Integer orderNum;
@ApiModelProperty(value = "退费类型")
@Column(name = "REFUND_TYPE")
private String refundType;
@ApiModelProperty(value = "退费类型名称")
private String refundTypeName;
public String getRefundTypeName() {
// FIXME 未来是计算出来的
return refundType;
}

@ApiModelProperty(value = "退费数量")
@Column(name = "REFUND_COUNT")
private Long refundCount= 0L;
@ApiModelProperty(value = "退费金额")
@Column(name = "REFUND_AMOUNT")
private Long refundAmount= 0L;
@ApiModelProperty(value = "退费时间")
private String refundDate;
}

+ 29
- 0
zhywpt-app-settlew/src/main/java/cn/com/taiji/settlew/manager/payment/BackPaymentCollectionManager.java Переглянути файл

@@ -0,0 +1,29 @@
package cn.com.taiji.settlew.manager.payment;

import cn.com.taiji.common.manager.ManagerException;
import cn.com.taiji.common.manager.net.http.ServiceHandleException;
import cn.com.taiji.common.model.dao.Pagination;
import cn.com.taiji.settlew.model.CommonExportResponse;
import cn.com.taiji.settlew.model.payment.BackPaymentCollectionPageRequestDTO;

/**
* @description: 补缴报表
* @author: wangyan
* @date Created in 2025/04/29 14:12
*/
public interface BackPaymentCollectionManager {
/**
* 查询补缴记录
* @param pageRequest
* @return
*/
Pagination query(BackPaymentCollectionPageRequestDTO pageRequest);

/**
* 导出补缴
* @param req
* @return
* @throws ServiceHandleException
*/
CommonExportResponse export(BackPaymentCollectionPageRequestDTO req) throws ManagerException;
}

+ 110
- 0
zhywpt-app-settlew/src/main/java/cn/com/taiji/settlew/manager/payment/BackPaymentCollectionManagerImpl.java Переглянути файл

@@ -0,0 +1,110 @@
package cn.com.taiji.settlew.manager.payment;

import cn.com.taiji.common.manager.AbstractManager;
import cn.com.taiji.common.manager.ManagerException;
import cn.com.taiji.common.manager.net.http.ServiceHandleException;
import cn.com.taiji.common.manager.pub.FileHelper;
import cn.com.taiji.common.model.dao.Pagination;
import cn.com.taiji.common.pub.AppEnv;
import cn.com.taiji.common.pub.BeanTools;
import cn.com.taiji.common.pub.LambdaTools;
import cn.com.taiji.core.entity.dict.BucketFileBus;
import cn.com.taiji.core.entity.settle.payment.BackPaymentCollection;
import cn.com.taiji.core.manager.tools.minio.MinioUtil;
import cn.com.taiji.core.repo.jpa.settle.payment.BackPaymentCollectionRepo;
import cn.com.taiji.settlew.dto.payment.BackPaymentCollectionDTO;
import cn.com.taiji.settlew.model.CommonExportResponse;
import cn.com.taiji.settlew.model.payment.BackPaymentCollectionPageRequestDTO;
import cn.com.taiji.settlew.repo.jpa.request.payment.BackPaymentCollectionPageRequest;
import cn.com.taiji.settlew.util.NumberConvert;
import cn.com.taiji.settlew.vo.payment.BackPaymentCollectionVo;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.ExcelWriter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.io.File;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.List;

/**
* 补缴统计
* @Author jiangsong
* @create 2025/9/25
*/
@Service
public class BackPaymentCollectionManagerImpl extends AbstractManager implements BackPaymentCollectionManager {

@Autowired
private BackPaymentCollectionRepo backPaymentCollectionRepo;
@Autowired
private MinioUtil minioUtil;

@Override
public Pagination query(BackPaymentCollectionPageRequestDTO dto) {
BackPaymentCollectionPageRequest pageRequest = new BackPaymentCollectionPageRequest();
BeanTools.copyProperties(dto, pageRequest);
return backPaymentCollectionRepo.page(pageRequest).convertResult(this::convertDTO);
}

@Override
public CommonExportResponse export(BackPaymentCollectionPageRequestDTO req) throws ManagerException {
CommonExportResponse response = new CommonExportResponse();
BackPaymentCollectionPageRequest pageRequest = new BackPaymentCollectionPageRequest();
BeanTools.copyProperties(req, pageRequest);
//FIXME 需要检查 lis 是否 能查询所有结果
List<BackPaymentCollection> result = backPaymentCollectionRepo.list(pageRequest);
List<BackPaymentCollectionVo> voList = LambdaTools.doMap(result,this::convertVo);
// 获取模板
File templateFile = new File(AppEnv.getDataPath() + "backpaymentExportExcel.xlsx");
DateTimeFormatter formatter= DateTimeFormatter.ofPattern("yyyy-MM-dd");
String fileName = LocalDateTime.now().format(formatter)+"补缴统计表.xlsx";
// 创建输出文件
File targetFile = new File(AppEnv.getTmpPath() + fileName);
// 填充数据
try (ExcelWriter excelWriter = EasyExcel.write(targetFile).withTemplate(templateFile).build()) {
excelWriter.fill(voList, EasyExcel.writerSheet("sheet1").build());
}
// 上传minio
String url = minioUtil.fileUploadHttp(targetFile, BucketFileBus.SETTLEW);
// 删除文件
FileHelper.deleteFile(targetFile);
response.setUrl(url);
return response;
}



private BackPaymentCollectionDTO convertDTO(BackPaymentCollection from) {
BackPaymentCollectionDTO to = new BackPaymentCollectionDTO();
BeanTools.copyProperties(from, to);
return to;
}

private BackPaymentCollectionVo convertVo(BackPaymentCollection from) {

BackPaymentCollectionVo to = new BackPaymentCollectionVo();
BeanTools.copyProperties(from, to);
//用户应补
to.setShouldPay(NumberConvert.fenToYuan(from.getShouldPay()));
//用户实补
to.setActualPay(NumberConvert.fenToYuan(from.getActualPay()));
//商户号到账
to.setShArrivedPay(NumberConvert.fenToYuan(from.getShArrivedPay()));
//渠道费
to.setAgencyFee(NumberConvert.fenToYuan(from.getAgencyFee()));
//小计
to.setSubTotal(NumberConvert.fenToYuan(from.getSubTotal()));
//注销退款重复退费补缴
to.setPreRefundPay(NumberConvert.fenToYuan(from.getPreRefundPay()));
//合计
to.setTotal(NumberConvert.fenToYuan(from.getTotal()));
//到账盈亏款项(盈-亏+)
to.setProLossPay(NumberConvert.fenToYuan(from.getProLossPay()));

return to;
}


}

+ 19
- 0
zhywpt-app-settlew/src/main/java/cn/com/taiji/settlew/manager/refund/RefundCollectionManager.java Переглянути файл

@@ -0,0 +1,19 @@
package cn.com.taiji.settlew.manager.refund;

import cn.com.taiji.common.manager.ManagerException;
import cn.com.taiji.common.manager.net.http.ServiceHandleException;
import cn.com.taiji.common.model.dao.Pagination;
import cn.com.taiji.settlew.model.CommonExportResponse;
import cn.com.taiji.settlew.model.refund.RefundCollectionPageRequestDTO;

/**
* @description: 退费统计
* @author: wangyan
* @date Created in 2025/04/29 10:18
*/
public interface RefundCollectionManager {

Pagination query(RefundCollectionPageRequestDTO pageRequest);

CommonExportResponse export(RefundCollectionPageRequestDTO req) throws ManagerException;
}

+ 119
- 0
zhywpt-app-settlew/src/main/java/cn/com/taiji/settlew/manager/refund/RefundCollectionManagerImpl.java Переглянути файл

@@ -0,0 +1,119 @@
package cn.com.taiji.settlew.manager.refund;

import cn.com.taiji.common.manager.AbstractManager;
import cn.com.taiji.common.manager.ManagerException;
import cn.com.taiji.common.manager.net.http.ServiceHandleException;
import cn.com.taiji.common.manager.pub.FileHelper;
import cn.com.taiji.common.model.dao.Pagination;
import cn.com.taiji.common.pub.AppEnv;
import cn.com.taiji.common.pub.BeanTools;
import cn.com.taiji.core.entity.dict.BucketFileBus;
import cn.com.taiji.core.entity.settle.refund.RefundCollection;
import cn.com.taiji.core.manager.tools.minio.MinioUtil;
import cn.com.taiji.core.repo.jpa.settle.refund.RefundCollectionRepo;
import cn.com.taiji.settlew.dao.jdbc.refund.RefundCollectionDao;
import cn.com.taiji.settlew.dto.refund.RefundCollectionDTO;
import cn.com.taiji.settlew.model.CommonExportResponse;
import cn.com.taiji.settlew.model.refund.RefundCollectionPageRequestDTO;
import cn.com.taiji.settlew.repo.jpa.request.refund.RefundCollectionPageRequest;
import cn.com.taiji.settlew.util.NumberConvert;
import cn.com.taiji.settlew.vo.refund.RefundCollectionVo;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.ExcelWriter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.io.File;
import java.math.BigDecimal;
import java.time.format.DateTimeFormatter;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
import java.util.stream.IntStream;

/**
* 退费统计
* @Author jiangsong
* @create 2025/9/25
*/
@Service
public class RefundCollectionManagerImpl extends AbstractManager implements RefundCollectionManager{

@Autowired
private RefundCollectionRepo reportRepo;
@Autowired
private RefundCollectionDao refundCollectionDao;
@Autowired
private MinioUtil minioUtil;

@Override
public Pagination query(RefundCollectionPageRequestDTO dto) {
RefundCollectionPageRequest pageRequest = new RefundCollectionPageRequest();
BeanTools.copyProperties(dto, pageRequest);
return reportRepo.page(pageRequest).convertResult(this::convertDTO);
}

@Override
public CommonExportResponse export(RefundCollectionPageRequestDTO dto) throws ManagerException {
CommonExportResponse response = new CommonExportResponse();
// 永远保证不为 NULL
List<RefundCollectionDTO> list = Optional.ofNullable(refundCollectionDao.queryRefundCollectionList(dto))
.orElse(Collections.emptyList());
// 转换为 Vo , 用于excel 导出
List<RefundCollectionVo> voList= IntStream.range(0, list.size()).mapToObj(
i->dtoConvertVo(list.get(i),i+1)
).collect(Collectors.toList());
// 在导出数据集结尾追加 合计
if(!voList.isEmpty()){
// 计算合计 数量
Long totalCount = voList.stream()
.mapToLong(item -> item.getRefundCount() != null ? item.getRefundCount() : 0L)
.sum();
// 计算合计 金额
BigDecimal totalAmount = voList.stream()
.map(item -> item.getRefundAmount() != null ? item.getRefundAmount() : BigDecimal.ZERO)
.reduce(BigDecimal.ZERO, BigDecimal::add);
RefundCollectionVo sunVo = new RefundCollectionVo();
sunVo.setRefundTypeName("合计");
sunVo.setRefundCount(totalCount);
sunVo.setRefundAmount(totalAmount);
voList.add(sunVo);
}
// 获取模板
File templateFile = new File(AppEnv.getDataPath() + "refundCollectionExportExcel.xlsx");
DateTimeFormatter formatter= DateTimeFormatter.ofPattern("yyyy-MM-dd");
String fileName = dto.getRefundDateStart().format(formatter) + "-" + dto.getRefundDateEnd().format(formatter) +"退费统计表.xlsx";
// 创建输出文件
File targetFile = new File(AppEnv.getTmpPath() + fileName);
// 填充数据
try (ExcelWriter excelWriter = EasyExcel.write(targetFile).withTemplate(templateFile).build()) {
excelWriter.fill(voList, EasyExcel.writerSheet("sheet1").build());
}
// 上传minio
String url = minioUtil.fileUploadHttp(targetFile, BucketFileBus.SETTLEW);
// 删除文件
FileHelper.deleteFile(targetFile);
response.setUrl(url);
return response;
}


private RefundCollectionDTO convertDTO(RefundCollection from) {
RefundCollectionDTO dto = new RefundCollectionDTO();
BeanTools.copyProperties(from,dto);
return dto;
}

private RefundCollectionVo dtoConvertVo(RefundCollectionDTO from,int index) {
RefundCollectionVo to = new RefundCollectionVo();
BeanTools.copyProperties(from,to);
to.setOrderNum(index);
to.setRefundAmount(NumberConvert.fenToYuan(from.getRefundAmount()));
return to;
}




}

+ 25
- 0
zhywpt-app-settlew/src/main/java/cn/com/taiji/settlew/model/payment/BackPaymentCollectionPageRequestDTO.java Переглянути файл

@@ -0,0 +1,25 @@
package cn.com.taiji.settlew.model.payment;

import cn.com.taiji.common.valid.ViolationValidator;
import cn.com.taiji.core.dto.AbstractStaffBizPageRequestDTO;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
* @description:
* @author: wangyan
* @date Created in 2025/04/29 14:14
*/
@Data
public class BackPaymentCollectionPageRequestDTO extends AbstractStaffBizPageRequestDTO {

@ApiModelProperty(value="结算周期开始时间 YYYY-MM")
private String settlementDateStart;
@ApiModelProperty(value="结算周期结束时间 YYYY-MM")
private String settlementDateEnd;

@Override
protected void validate(ViolationValidator validator) {

}
}

+ 28
- 0
zhywpt-app-settlew/src/main/java/cn/com/taiji/settlew/model/refund/RefundCollectionPageRequestDTO.java Переглянути файл

@@ -0,0 +1,28 @@
package cn.com.taiji.settlew.model.refund;

import cn.com.taiji.common.valid.ViolationValidator;
import cn.com.taiji.core.dto.AbstractStaffBizPageRequestDTO;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.time.LocalDateTime;

/**
* 退费统计
* @Author jiangsong
* @create 2025/9/25
*/
@Data
public class RefundCollectionPageRequestDTO extends AbstractStaffBizPageRequestDTO {

@ApiModelProperty(value="退费统计开始时间 YYYY-MM-DD")
private LocalDateTime refundDateStart;
@ApiModelProperty(value="退费统计结束时间 YYYY-MM-DD")
private LocalDateTime refundDateEnd;

@Override
protected void validate(ViolationValidator validator) {

}

}

+ 33
- 0
zhywpt-app-settlew/src/main/java/cn/com/taiji/settlew/repo/jpa/request/payment/BackPaymentCollectionPageRequest.java Переглянути файл

@@ -0,0 +1,33 @@
package cn.com.taiji.settlew.repo.jpa.request.payment;

import cn.com.taiji.common.pub.dao.HqlBuilder;
import cn.com.taiji.common.repo.request.jpa.JpaPageableDataRequest;
import cn.com.taiji.core.entity.settle.payment.BackPaymentCollection;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
* @description:
* @author: wangyan
* @date Created in 2025/04/29 14:14
*/
@Data
public class BackPaymentCollectionPageRequest extends JpaPageableDataRequest<BackPaymentCollection> {

@ApiModelProperty(value="结算周期开始时间 YYYY-MM")
private String settlementDateStart;
@ApiModelProperty(value="结算周期结束时间 YYYY-MM")
private String settlementDateEnd;

public BackPaymentCollectionPageRequest(){
this.orderBy = "settlementDate";
this.desc = true;
}
@Override
public HqlBuilder toSelectHql() {
HqlBuilder hql = new HqlBuilder("from BackPaymentCollectionReport where 1=1");
hql.append(" and settlementDate >= :settlementDateStart",settlementDateStart);
hql.append(" and settlementDate <= :settlementDateEnd",settlementDateEnd);
return hql;
}
}

+ 36
- 0
zhywpt-app-settlew/src/main/java/cn/com/taiji/settlew/repo/jpa/request/refund/RefundCollectionPageRequest.java Переглянути файл

@@ -0,0 +1,36 @@
package cn.com.taiji.settlew.repo.jpa.request.refund;

import cn.com.taiji.common.pub.dao.HqlBuilder;
import cn.com.taiji.common.repo.request.jpa.JpaPageableDataRequest;
import cn.com.taiji.core.entity.settle.refund.RefundCollection;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.time.LocalDateTime;

/**
* 退费统计
* @Author jiangsong
* @create 2025/9/25
*/
@Data
public class RefundCollectionPageRequest extends JpaPageableDataRequest<RefundCollection> {

@ApiModelProperty(value="退费统计开始时间 YYYY-MM-DD")
private LocalDateTime refundDateStart;
@ApiModelProperty(value="退费统计结束时间 YYYY-MM-DD")
private LocalDateTime refundDateEnd;


public RefundCollectionPageRequest(){
this.orderBy = "refundDate";
this.desc = true;
}
@Override
public HqlBuilder toSelectHql() {
HqlBuilder hql = new HqlBuilder("from RefundCollection where 1=1");
hql.append(" and refundDate >= :refundDateStart",refundDateStart);
hql.append(" and refundDate <= :refundDateEnd",refundDateEnd);
return hql;
}
}

+ 48
- 0
zhywpt-app-settlew/src/main/java/cn/com/taiji/settlew/vo/payment/BackPaymentCollectionVo.java Переглянути файл

@@ -0,0 +1,48 @@
package cn.com.taiji.settlew.vo.payment;

import cn.com.taiji.common.model.BaseDTO;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.math.BigDecimal;

/**
*
* 补缴统计
* @Author jiangsong
* @create 2025/9/25
*/
@Data
public class BackPaymentCollectionVo extends BaseDTO {

@ApiModelProperty(value = "结算周期")
private String settlementDate;
@ApiModelProperty(value = "渠道")
private String agencyName;
@ApiModelProperty(value = "用户应补")
private BigDecimal shouldPay;
@ApiModelProperty(value = "用户实补")
private BigDecimal actualPay;
@ApiModelProperty(value = "商户号到账")
private BigDecimal shArrivedPay;
@ApiModelProperty(value = "渠道费")
private BigDecimal agencyFee;
@ApiModelProperty(value = "实际到账")
private BigDecimal actualArrivedPay;
// 实际到账 = 商户号到账 - 渠道费
public BigDecimal getActualArrivedPay() {
return BigDecimal.ZERO.
add(actualArrivedPay == null ? BigDecimal.ZERO : actualArrivedPay)
.subtract(agencyFee == null ? BigDecimal.ZERO : agencyFee);
}

@ApiModelProperty(value = "小计")
private BigDecimal subTotal;
@ApiModelProperty(value = "注销退款重复退费补缴")
private BigDecimal preRefundPay;
@ApiModelProperty(value = "合计")
private BigDecimal total;
@ApiModelProperty(value = "到账盈亏款项(盈-亏+)")
private BigDecimal proLossPay;

}

+ 39
- 0
zhywpt-app-settlew/src/main/java/cn/com/taiji/settlew/vo/refund/RefundCollectionVo.java Переглянути файл

@@ -0,0 +1,39 @@
package cn.com.taiji.settlew.vo.refund;

import cn.com.taiji.common.model.BaseDTO;
import cn.com.taiji.settlew.util.StringUtils;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.math.BigDecimal;

/**
* 退费统计
* @Author jiangsong
* @create 2025/9/25
*/
@Data
public class RefundCollectionVo extends BaseDTO {
@ApiModelProperty(value = "序号",hidden = true)
private Integer orderNum;
@ApiModelProperty(value = "退费类型")
private String refundType;

private String refundTypeName;

public String getRefundTypeName() {
if(StringUtils.isEmpty(refundTypeName)) {
//FIXME 未来从字典中加载
return refundType.toLowerCase();
}else{
return refundTypeName;
}
}

@ApiModelProperty(value = "退费数量")
private Long refundCount = 0L;
@ApiModelProperty(value = "退费金额")
private BigDecimal refundAmount;
@ApiModelProperty(value = "退费时间")
private String refundDate;
}

Завантаження…
Відмінити
Зберегти