package com.qtzl.alterSales.manager.handler; | |||||
import cn.com.taiji.common.manager.net.http.ServiceHandleException; | |||||
import cn.com.taiji.common.pub.BeanTools; | |||||
import cn.hutool.core.collection.CollectionUtil; | |||||
import cn.hutool.core.date.DateUtil; | |||||
import cn.hutool.core.util.ObjectUtil; | |||||
import com.google.common.collect.Lists; | |||||
import com.qtzl.alterSales.dao.entity.second.AflServerFeeRefund; | |||||
import com.qtzl.alterSales.dao.repo.jpa.second.AflServerFeeRefundRepo; | |||||
import com.qtzl.alterSales.manager.abstracts.AbstractAfterSalesManager; | |||||
import com.qtzl.alterSales.manager.model.protocol.UcServiceError; | |||||
import com.qtzl.alterSales.manager.model.protocol.sales.AflServerFeeRefundPageRequest; | |||||
import com.qtzl.alterSales.manager.service.AfterSalesCmd; | |||||
import com.qtzl.alterSales.manager.service.third.ConstantConfig; | |||||
import com.qtzl.alterSales.manager.service.third.FmsService; | |||||
import com.qtzl.alterSales.manager.tools.ExcelUtils; | |||||
import com.qtzl.alterSales.manager.vo.AflServerFeeRefundExportVo; | |||||
import com.txffp.api.core.manager.comm.annotation.ApiHandler; | |||||
import org.apache.commons.lang3.StringUtils; | |||||
import org.springframework.stereotype.Service; | |||||
import org.springframework.util.CollectionUtils; | |||||
import javax.annotation.Resource; | |||||
import javax.persistence.criteria.Predicate; | |||||
import java.time.format.DateTimeFormatter; | |||||
import java.time.temporal.TemporalAccessor; | |||||
import java.util.ArrayList; | |||||
import java.util.List; | |||||
/*** | |||||
* <p> | |||||
* 服务费退款明细导出 | |||||
* </p> | |||||
* @author shuiqilin | |||||
* {@code @date} 2024/6/23 13:03 | |||||
**/ | |||||
@Service | |||||
@ApiHandler | |||||
public class AflServerFeeRefundExportHandler extends AbstractAfterSalesManager<AflServerFeeRefundPageRequest> { | |||||
@Resource | |||||
private AflServerFeeRefundRepo aflServerFeeRefundRepo; | |||||
@Resource | |||||
private ConstantConfig constantConfig; | |||||
@Resource | |||||
private FmsService fmsService; | |||||
public AflServerFeeRefundExportHandler() { | |||||
super(AfterSalesCmd.SERVERFEEREFUNDEXPORT, AflServerFeeRefundPageRequest.class); | |||||
} | |||||
@Override | |||||
public String handleInternal(String filename, AflServerFeeRefundPageRequest request) throws ServiceHandleException { | |||||
try { | |||||
return export(request); | |||||
} catch (Exception e) { | |||||
if (e instanceof ServiceHandleException) { | |||||
throw e; | |||||
} | |||||
logger.error("服务费退款明细导出:{}", e.getMessage()); | |||||
throw UcServiceError.BUSINESS_VALIDATE_ERR.toHandleException("服务费退款明细导出失败"); | |||||
} | |||||
} | |||||
public String export(AflServerFeeRefundPageRequest request) throws ServiceHandleException { | |||||
final List<AflServerFeeRefund> serverFeeRefundList = aflServerFeeRefundRepo.findAll(((root, query, cb) -> { | |||||
List<Predicate> list = Lists.newArrayList(); | |||||
if (!StringUtils.isEmpty(request.getPlateNum())) { | |||||
list.add(cb.equal(root.<String>get("plateNum"), request.getPlateNum())); | |||||
} | |||||
if (!StringUtils.isEmpty(request.getOutTradeNo())) { | |||||
list.add(cb.equal(root.<String>get("outTradeNo"), request.getOutTradeNo())); | |||||
} | |||||
if (!CollectionUtil.isEmpty(request.getPayDates()) || ObjectUtil.isNotNull(request.getPayDates())) { | |||||
list.add(root.<String>get("payDate").in(request.getPayDates())); | |||||
} | |||||
if (!CollectionUtil.isEmpty(request.getRefundDate()) || ObjectUtil.isNotNull(request.getRefundDate())) { | |||||
list.add(root.<String>get("refundDate").in(request.getRefundDate())); | |||||
} | |||||
Predicate[] p = new Predicate[list.size()]; | |||||
return cb.and(list.toArray(p)); | |||||
})); | |||||
if (CollectionUtils.isEmpty(serverFeeRefundList)) { | |||||
throw UcServiceError.BUSINESS_VALIDATE_ERR.toHandleException("暂无可导出数据"); | |||||
} | |||||
ArrayList<AflServerFeeRefundExportVo> aflServerFeeRefundExportVos = new ArrayList<>(); | |||||
for (int i = 0; i < serverFeeRefundList.size(); i++) { | |||||
AflServerFeeRefund refundStats = serverFeeRefundList.get(i); | |||||
AflServerFeeRefundExportVo model = new AflServerFeeRefundExportVo(); | |||||
BeanTools.copyProperties(refundStats, model); | |||||
model.setRefundTimeStr(DateUtil.format(refundStats.getRefundTime(), "yyyy年M月d日")); | |||||
model.setNo(i + 1); | |||||
aflServerFeeRefundExportVos.add(model); | |||||
} | |||||
String pathFile = ExcelUtils.export(null, "选装-服务费退款明细", | |||||
constantConfig.getFilePath(), aflServerFeeRefundExportVos, AflServerFeeRefundExportVo.class); | |||||
try { | |||||
return fmsService.uploadFile(constantConfig.getUploadFile(), pathFile, 90000); | |||||
} catch (ServiceHandleException e) { | |||||
throw UcServiceError.BUSINESS_VALIDATE_ERR.toHandleException(e.getMessage()); | |||||
} | |||||
} | |||||
} |
if (!StringUtils.isEmpty(request.getOutTradeNo())) { | if (!StringUtils.isEmpty(request.getOutTradeNo())) { | ||||
list.add(cb.equal(root.<String>get("outTradeNo"), request.getOutTradeNo())); | list.add(cb.equal(root.<String>get("outTradeNo"), request.getOutTradeNo())); | ||||
} | } | ||||
if (CollectionUtil.isEmpty(request.getPayDates())) { | |||||
if (!CollectionUtil.isEmpty(request.getPayDates())) { | |||||
list.add(root.<String>get("payDate").in(request.getPayDates())); | list.add(root.<String>get("payDate").in(request.getPayDates())); | ||||
} | } | ||||
if (CollectionUtil.isEmpty(request.getRefundDate())) { | |||||
if (!CollectionUtil.isEmpty(request.getRefundDate())) { | |||||
list.add(root.<String>get("refundDate").in(request.getRefundDate())); | list.add(root.<String>get("refundDate").in(request.getRefundDate())); | ||||
} | } | ||||
Predicate[] p = new Predicate[list.size()]; | Predicate[] p = new Predicate[list.size()]; |
SERVERFEEREFUNDPAGE("服务费退费明细分页查询", UcServiceType.AFTERSALES), | SERVERFEEREFUNDPAGE("服务费退费明细分页查询", UcServiceType.AFTERSALES), | ||||
AFLAPPLYINFOFINDBYID("根据ID查询申办时OCR信息", UcServiceType.AFTERSALES), | AFLAPPLYINFOFINDBYID("根据ID查询申办时OCR信息", UcServiceType.AFTERSALES), | ||||
AFLAPPLYINFOPAGE("根据ID查询申办时OCR信息-分页查询", UcServiceType.AFTERSALES), | AFLAPPLYINFOPAGE("根据ID查询申办时OCR信息-分页查询", UcServiceType.AFTERSALES), | ||||
SERVERFEEREFUNDEXPORT("服务费退费明细导出", UcServiceType.AFTERSALES), | |||||
; | ; | ||||
private String value; | private String value; |
package com.qtzl.alterSales.manager.vo; | |||||
import com.qtzl.alterSales.manager.model.protocol.center.excel.ExcelExport; | |||||
import java.math.BigDecimal; | |||||
/*** | |||||
* <p> | |||||
* 服务费退费明细表 | |||||
* </p> | |||||
* @author hou yi | |||||
* {@code @date} 2024/11/16 14:37 | |||||
**/ | |||||
public class AflServerFeeRefundExportVo { | |||||
/*** 商户订单号 */ | |||||
@ExcelExport(value = "商户订单号", sort = 9) | |||||
private String outTradeNo; | |||||
/*** 支付时间 */ | |||||
@ExcelExport(value = "充值时间", sort = 7) | |||||
private String payDate; | |||||
@ExcelExport(value = "收款方账号", sort = 2) | |||||
private String subMchId; | |||||
/*** 退款时间 */ | |||||
@ExcelExport(value = "车牌号", sort = 11) | |||||
private String plateNum; | |||||
/*** 退款金额 */ | |||||
@ExcelExport(value = "付款金额(元)", sort = 4) | |||||
private BigDecimal refundFee; | |||||
/*** 收款方名称 */ | |||||
@ExcelExport(value = "收款方名称", sort = 1) | |||||
private String payeeName; | |||||
/*** 收款方开户行 */ | |||||
@ExcelExport(value = "收款方开户行", sort = 3) | |||||
private String payeeOpeningBank; | |||||
/*** 付款账号 */ | |||||
@ExcelExport(value = "付款账号", sort = 5) | |||||
private String paymentAccount; | |||||
/*** 付款银行 */ | |||||
@ExcelExport(value = "付款银行", sort = 6) | |||||
private String paymentBank; | |||||
/*** ETC卡号 */ | |||||
@ExcelExport(value = "ETC卡号", sort = 8) | |||||
private String etcCardNo; | |||||
/*** 备注 */ | |||||
@ExcelExport(value = "备注",sort = 10) | |||||
private String remarks; | |||||
@ExcelExport(value = "退费时间", sort = 12) | |||||
private String refundTimeStr; | |||||
@ExcelExport(value = "序号", sort = 0) | |||||
private Integer No; | |||||
public String getRefundTimeStr() { | |||||
return refundTimeStr; | |||||
} | |||||
public void setRefundTimeStr(String refundTimeStr) { | |||||
this.refundTimeStr = refundTimeStr; | |||||
} | |||||
public Integer getNo() { | |||||
return No; | |||||
} | |||||
public void setNo(Integer no) { | |||||
No = no; | |||||
} | |||||
public String getOutTradeNo() { | |||||
return outTradeNo; | |||||
} | |||||
public void setOutTradeNo(String outTradeNo) { | |||||
this.outTradeNo = outTradeNo; | |||||
} | |||||
public String getPayDate() { | |||||
return payDate; | |||||
} | |||||
public void setPayDate(String payDate) { | |||||
this.payDate = payDate; | |||||
} | |||||
public String getSubMchId() { | |||||
return subMchId; | |||||
} | |||||
public void setSubMchId(String subMchId) { | |||||
this.subMchId = subMchId; | |||||
} | |||||
public String getPlateNum() { | |||||
return plateNum; | |||||
} | |||||
public void setPlateNum(String plateNum) { | |||||
this.plateNum = plateNum; | |||||
} | |||||
public BigDecimal getRefundFee() { | |||||
return refundFee; | |||||
} | |||||
public void setRefundFee(BigDecimal refundFee) { | |||||
this.refundFee = refundFee; | |||||
} | |||||
public String getPayeeName() { | |||||
return payeeName; | |||||
} | |||||
public void setPayeeName(String payeeName) { | |||||
this.payeeName = payeeName; | |||||
} | |||||
public String getPayeeOpeningBank() { | |||||
return payeeOpeningBank; | |||||
} | |||||
public void setPayeeOpeningBank(String payeeOpeningBank) { | |||||
this.payeeOpeningBank = payeeOpeningBank; | |||||
} | |||||
public String getPaymentAccount() { | |||||
return paymentAccount; | |||||
} | |||||
public void setPaymentAccount(String paymentAccount) { | |||||
this.paymentAccount = paymentAccount; | |||||
} | |||||
public String getPaymentBank() { | |||||
return paymentBank; | |||||
} | |||||
public void setPaymentBank(String paymentBank) { | |||||
this.paymentBank = paymentBank; | |||||
} | |||||
public String getEtcCardNo() { | |||||
return etcCardNo; | |||||
} | |||||
public void setEtcCardNo(String etcCardNo) { | |||||
this.etcCardNo = etcCardNo; | |||||
} | |||||
public String getRemarks() { | |||||
return remarks; | |||||
} | |||||
public void setRemarks(String remarks) { | |||||
this.remarks = remarks; | |||||
} | |||||
} |
# enableDrds: true | # enableDrds: true | ||||
# dialect: org.hibernate.dialect.Oracle10gDialect | # dialect: org.hibernate.dialect.Oracle10gDialect | ||||
# # 填写你数据库的url、登录名、密码和数据库名 allowMultiQueries=true nj-cdb-m52p6dj5.sql.tencentcdb.com 63865 !@#$%QWERTasdfg hypt_smp | # # 填写你数据库的url、登录名、密码和数据库名 allowMultiQueries=true nj-cdb-m52p6dj5.sql.tencentcdb.com 63865 !@#$%QWERTasdfg hypt_smp | ||||
# # url: jdbc:oracle:thin:@192.168.101.21:5016:ORCL | |||||
# jdbc-url: jdbc:oracle:thin:@10.52.0.159:1521:QTKDB1 | |||||
# jdbc-url: jdbc:oracle:thin:@192.168.101.21:5016:ORCL | |||||
## jdbc-url: jdbc:oracle:thin:@10.52.0.159:1521:QTKDB1 | |||||
# username: qtk | # username: qtk | ||||
# password: QWERTasdfg12345ZXCVB | |||||
# password: QWERTasdfgZXCVB12345 | |||||
initial-size: 5 | initial-size: 5 | ||||
max-active: 100 | max-active: 100 | ||||
# 配置一个连接在池中最小生存的时间,单位是毫秒 | # 配置一个连接在池中最小生存的时间,单位是毫秒 |
spring: | spring: | ||||
profiles: | profiles: | ||||
active: prod | |||||
active: dev | |||||
# Redis数据源 | # Redis数据源 | ||||
# redis: | # redis: | ||||
# # Redis数据库索引(默认为0) | # # Redis数据库索引(默认为0) |
import com.qtzl.alterSales.manager.enums.BlackListReson; | import com.qtzl.alterSales.manager.enums.BlackListReson; | ||||
import com.qtzl.alterSales.manager.enums.BlacklistOpType; | import com.qtzl.alterSales.manager.enums.BlacklistOpType; | ||||
import com.qtzl.alterSales.manager.handler.ActivateDataModelVoFindByDayHandler; | import com.qtzl.alterSales.manager.handler.ActivateDataModelVoFindByDayHandler; | ||||
import com.qtzl.alterSales.manager.handler.AflServerFeeRefundExportHandler; | |||||
import com.qtzl.alterSales.manager.handler.FssPaccountPayResultFindByPayIdHandler; | import com.qtzl.alterSales.manager.handler.FssPaccountPayResultFindByPayIdHandler; | ||||
import com.qtzl.alterSales.manager.model.protocol.sales.ActivateDataFindByDayRequest; | import com.qtzl.alterSales.manager.model.protocol.sales.ActivateDataFindByDayRequest; | ||||
import com.qtzl.alterSales.manager.model.protocol.sales.AflServerFeeRefundPageRequest; | |||||
import com.qtzl.alterSales.manager.model.protocol.sales.ChoiceBillsPayRequest; | import com.qtzl.alterSales.manager.model.protocol.sales.ChoiceBillsPayRequest; | ||||
import com.qtzl.alterSales.manager.model.protocol.sales.FssPaccountPayResultFindByPayIdRequest; | import com.qtzl.alterSales.manager.model.protocol.sales.FssPaccountPayResultFindByPayIdRequest; | ||||
import com.qtzl.alterSales.manager.quartz.AflCancelOrderTask; | import com.qtzl.alterSales.manager.quartz.AflCancelOrderTask; | ||||
import java.text.ParseException; | import java.text.ParseException; | ||||
import java.text.SimpleDateFormat; | import java.text.SimpleDateFormat; | ||||
import java.time.LocalDateTime; | import java.time.LocalDateTime; | ||||
import java.util.ArrayList; | |||||
import java.util.Arrays; | import java.util.Arrays; | ||||
import java.util.List; | import java.util.List; | ||||
@Resource | @Resource | ||||
private AflBlackInfoManager blackInfoManager; | private AflBlackInfoManager blackInfoManager; | ||||
@Resource | |||||
private AflServerFeeRefundExportHandler serverFeeRefundExportHandler; | |||||
@Test | @Test | ||||
public void black() { | public void black() { | ||||
activateDataFindByDayRequest.setQueryDay("2024-04-20"); | activateDataFindByDayRequest.setQueryDay("2024-04-20"); | ||||
String s = activateDataModelVoFindByDayHandler.handleInternal(null, activateDataFindByDayRequest); | String s = activateDataModelVoFindByDayHandler.handleInternal(null, activateDataFindByDayRequest); | ||||
System.out.println("=====" + s); | System.out.println("=====" + s); | ||||
} @Test | |||||
public void test1() throws ServiceHandleException, IOException { | |||||
AflServerFeeRefundPageRequest aflServerFeeRefundPageRequest = new AflServerFeeRefundPageRequest(); | |||||
// aflServerFeeRefundPageRequest.setPlateNum("陕AAQ5133"); | |||||
// aflServerFeeRefundPageRequest.setOutTradeNo("52010188930022024101611490019090"); | |||||
// ArrayList<String> strings = new ArrayList<>(); | |||||
// strings.add("20241016"); | |||||
// strings.add("20241014"); | |||||
// aflServerFeeRefundPageRequest.setPayDates(strings); | |||||
ArrayList<String> strings1 = new ArrayList<>(); | |||||
strings1.add("2024-11-25"); | |||||
strings1.add("2024-11-26"); | |||||
aflServerFeeRefundPageRequest.setRefundDate(strings1); | |||||
String export = serverFeeRefundExportHandler.export(aflServerFeeRefundPageRequest); | |||||
System.out.println("=====" + export); | |||||
} | } | ||||
} | } |