Quellcode durchsuchen

商户号分类查询/导出 新增字段

main
su vor 6 Monaten
Ursprung
Commit
2fc1d1f21f

+ 23
- 0
src/main/java/com/qtzl/alterSales/dao/entity/second/AflMchStatistics.java Datei anzeigen

@ExcelExport("退款总额") @ExcelExport("退款总额")
private BigDecimal totalRefundFee; private BigDecimal totalRefundFee;


@ExcelExport("渠道编号")
private String agentId;
@ExcelExport("渠道名称")
private String agentName;

@Column(name = "agent_id")
public String getAgentId() {
return agentId;
}

public void setAgentId(String agentId) {
this.agentId = agentId;
}

@Column(name = "agent_name")
public String getAgentName() {
return agentName;
}

public void setAgentName(String agentName) {
this.agentName = agentName;
}

/*** 统计日期 */ /*** 统计日期 */
@Column(name = "STATISTICAL_DATE") @Column(name = "STATISTICAL_DATE")
public Integer getStatisticalDate() { public Integer getStatisticalDate() {

+ 20
- 1
src/main/java/com/qtzl/alterSales/manager/handler/AflMchStatisticsPageHandler.java Datei anzeigen

if (request.getPageSize() > 100) { if (request.getPageSize() > 100) {
throw UcServiceError.BUSINESS_VALIDATE_ERR.toHandleException("请求每页数量过大 " + request.getPageSize()); throw UcServiceError.BUSINESS_VALIDATE_ERR.toHandleException("请求每页数量过大 " + request.getPageSize());
} }
return aflMchStatisticsRepo.findAll(((root, query, cb) -> {
Page<AflMchStatistics> mchStatisticsRepoAll = aflMchStatisticsRepo.findAll(((root, query, cb) -> {
List<Predicate> list = Lists.newArrayList(); List<Predicate> list = Lists.newArrayList();
if (!StringUtils.isEmpty(request.getSubMchId())) { if (!StringUtils.isEmpty(request.getSubMchId())) {
list.add(cb.equal(root.<String>get("subMchId"), request.getSubMchId())); list.add(cb.equal(root.<String>get("subMchId"), request.getSubMchId()));
if (null != request.getEndDate()) { if (null != request.getEndDate()) {
list.add(cb.lessThanOrEqualTo(root.<Integer>get("statisticalDate"), request.getEndDate())); list.add(cb.lessThanOrEqualTo(root.<Integer>get("statisticalDate"), request.getEndDate()));
} }

if (!StringUtils.isEmpty(request.getAgentId())) {
list.add(cb.equal(root.<String>get("agentId"), request.getAgentId()));
}
if (!StringUtils.isEmpty(request.getAgentName())) {
list.add(cb.equal(root.<String>get("agentName"), request.getAgentName()));
}
Predicate[] p = new Predicate[list.size()]; Predicate[] p = new Predicate[list.size()];
return cb.and(list.toArray(p)); return cb.and(list.toArray(p));
}), PageRequest.of(request.getPageNo() - 1, request.getPageSize(), }), PageRequest.of(request.getPageNo() - 1, request.getPageSize(),
Sort.by(Sort.Direction.DESC, "insertTime"))); Sort.by(Sort.Direction.DESC, "insertTime")));
mchStatisticsRepoAll.getContent().forEach(desc -> {
desc.setFeeType(formatFeeDescription(desc.getFeeType()));
});
logger.info(mchStatisticsRepoAll.getContent().toString());
return mchStatisticsRepoAll;
}

public String formatFeeDescription(String desc) {
if (desc.equals("其他")) return desc;
if (desc.contains("服务费")) return "服务费";
if (desc.contains("通行费")) return "通行费";
return desc;
} }
} }

+ 21
- 0
src/main/java/com/qtzl/alterSales/manager/model/protocol/sales/AflMchStatisticsPageRequest.java Datei anzeigen



private Integer endDate; private Integer endDate;


//渠道编码
private String agentId;
//渠道名称
private String agentName;

public String getAgentId() {
return agentId;
}

public void setAgentId(String agentId) {
this.agentId = agentId;
}

public String getAgentName() {
return agentName;
}

public void setAgentName(String agentName) {
this.agentName = agentName;
}

public String getSubMchId() { public String getSubMchId() {
return subMchId; return subMchId;
} }

+ 16
- 1
src/main/java/com/qtzl/alterSales/manager/service/AflMchStatisticsServiceImpl.java Datei anzeigen

@Override @Override
public String export(AflMchStatisticsPageRequest request) throws ServiceHandleException { public String export(AflMchStatisticsPageRequest request) throws ServiceHandleException {
final List<AflMchStatistics> statisticsList = aflMchStatisticsRepo.findAll(((root, query, cb) -> { final List<AflMchStatistics> statisticsList = aflMchStatisticsRepo.findAll(((root, query, cb) -> {
List<Predicate> list = Lists.newArrayList();
final List<Predicate> list = Lists.newArrayList();
if (!StringUtils.isEmpty(request.getSubMchId())) { if (!StringUtils.isEmpty(request.getSubMchId())) {
list.add(cb.equal(root.<String>get("subMchId"), request.getSubMchId())); list.add(cb.equal(root.<String>get("subMchId"), request.getSubMchId()));
} }
if (null != request.getEndDate()) { if (null != request.getEndDate()) {
list.add(cb.lessThanOrEqualTo(root.get(statisticalDate), request.getEndDate())); list.add(cb.lessThanOrEqualTo(root.get(statisticalDate), request.getEndDate()));
} }


if (!StringUtils.isEmpty(request.getAgentId())) {
list.add(cb.equal(root.<String>get("agentId"), request.getAgentId()));
}
if (!StringUtils.isEmpty(request.getAgentName())) {
list.add(cb.equal(root.<String>get("agentName"), request.getAgentName()));
}
Predicate[] p = new Predicate[list.size()]; Predicate[] p = new Predicate[list.size()];
return cb.and(list.toArray(p)); return cb.and(list.toArray(p));
})); }));
if (CollectionUtils.isEmpty(statisticsList)) { if (CollectionUtils.isEmpty(statisticsList)) {
throw UcServiceError.BUSINESS_VALIDATE_ERR.toHandleException("暂无可导出数据"); throw UcServiceError.BUSINESS_VALIDATE_ERR.toHandleException("暂无可导出数据");
} }
statisticsList.forEach(desc-> desc.setFeeType(formatFeeDescription(desc.getFeeType())));
String pathFile = ExcelUtils.export(null, "选装-商户号金额统计",constantConfig.getFilePath(), statisticsList, AflMchStatistics.class); String pathFile = ExcelUtils.export(null, "选装-商户号金额统计",constantConfig.getFilePath(), statisticsList, AflMchStatistics.class);
try { try {
return fmsService.uploadFile(constantConfig.getUploadFile(),pathFile, 90000); return fmsService.uploadFile(constantConfig.getUploadFile(),pathFile, 90000);
} }
} }


public String formatFeeDescription(String desc) {
if (desc.equals("其他")) return desc;
if (desc.contains("服务费")) return "服务费";
if (desc.contains("通行费")) return "通行费";
return desc;
}
@Override @Override
public Page<AflMchStatistics> findPage(Integer year, Integer month, String subMchId, Pageable pageable) { public Page<AflMchStatistics> findPage(Integer year, Integer month, String subMchId, Pageable pageable) {
return aflMchStatisticsRepo.findAll(getSpecification(year, month, subMchId, null), pageable); return aflMchStatisticsRepo.findAll(getSpecification(year, month, subMchId, null), pageable);

Laden…
Abbrechen
Speichern