@@ -40,9 +40,9 @@ public interface AflPaccountReceivableBillRepo extends JpaRepository<AflPaccount | |||
*/ | |||
@Query(value = "SELECT new com.qtzl.alterSales.dao.excelVO.AflPaccountReceivableBillDateGroupVO(a.accountDate, SUM(a.payAmount - a.refundAmount)) " + | |||
"FROM AflPaccountReceivableBill a " + | |||
"WHERE a.accountDate IN :accountDates " + | |||
"WHERE a.accountDate between :startDate and :endDate " + | |||
"GROUP BY a.accountDate") | |||
List<AflPaccountReceivableBillDateGroupVO> findMapByAccountDates(@Param("accountDates") List<Integer> accountDates); | |||
List<AflPaccountReceivableBillDateGroupVO> findMapByAccountDates(@Param("startDate") Integer startDate, @Param("endDate") Integer endDate); | |||
} |
@@ -24,6 +24,6 @@ public class AflExportPaccountReceivableBillHandler extends AbstractAfterSalesMa | |||
@Override | |||
public String handleInternal(String filename, AflPaccountReceivableBillExportRequest request) throws ServiceHandleException, IOException { | |||
return aflPaccountReceivableBillService.export(request.getAccountDates()); | |||
return aflPaccountReceivableBillService.export(request.getStartDate(), request.getEndDate()); | |||
} | |||
} |
@@ -6,16 +6,22 @@ import java.util.List; | |||
public class AflPaccountReceivableBillExportRequest extends BaseModel { | |||
/** | |||
* 需要导出的日期 格式为 [20241120,20241121,20241122,20241123,20241124] | |||
*/ | |||
private List<Integer> accountDates; | |||
private Integer startDate; | |||
private Integer endDate; | |||
public List<Integer> getAccountDates() { | |||
return accountDates; | |||
public Integer getStartDate() { | |||
return startDate; | |||
} | |||
public void setAccountDates(List<Integer> accountDates) { | |||
this.accountDates = accountDates; | |||
public void setStartDate(Integer startDate) { | |||
this.startDate = startDate; | |||
} | |||
public Integer getEndDate() { | |||
return endDate; | |||
} | |||
public void setEndDate(Integer endDate) { | |||
this.endDate = endDate; | |||
} | |||
} |
@@ -6,6 +6,6 @@ import java.util.List; | |||
public interface AflPaccountReceivableBillService { | |||
String export(List<Integer> accountDates) throws ServiceHandleException; | |||
String export(Integer startDate, Integer endDate) throws ServiceHandleException; | |||
} |
@@ -51,9 +51,12 @@ public class AflPaccountReceivableBillServiceImpl implements AflPaccountReceivab | |||
private final Random random = new Random(); | |||
@Override | |||
public String export(List<Integer> accountDates) throws ServiceHandleException { | |||
public String export(Integer startDate, Integer endDate) throws ServiceHandleException { | |||
log.info("【{}】开始导出数据", "通行费"); | |||
List<AflPaccountReceivableBillDateGroupVO> receivableBillDateGroupVOS = aflPaccountReceivableBillRepo.findMapByAccountDates(accountDates); | |||
if (null == startDate || null == endDate) { | |||
throw UcServiceError.BUSINESS_VALIDATE_ERR.toHandleException("请指定开始日期与结束日期查询"); | |||
} | |||
List<AflPaccountReceivableBillDateGroupVO> receivableBillDateGroupVOS = aflPaccountReceivableBillRepo.findMapByAccountDates(startDate, endDate); | |||
InputStream inputStream; | |||
try { | |||
@@ -109,7 +112,7 @@ public class AflPaccountReceivableBillServiceImpl implements AflPaccountReceivab | |||
// 删除本地临时文件 | |||
Boolean blnDeleteFile = reportExcelConfig.getBlnDeleteFile(); | |||
if(blnDeleteFile != null && blnDeleteFile) { | |||
if (blnDeleteFile != null && blnDeleteFile) { | |||
try { | |||
Files.delete(file.toPath()); | |||
} catch (IOException e) { |
@@ -196,12 +196,7 @@ public class ChoiceBillsOperationServiceImpl implements ChoiceBillsOperationServ | |||
throw UcServiceError.BUSINESS_VALIDATE_ERR.toHandleException(payOrder.getOrderStatus().getStatus()); | |||
} | |||
final List<String> payIds = payOrderRelRepo.getPayId((id)); | |||
for (String payId : payIds) { | |||
final Object redisData = redisUtils.get(REDIS_KEY + payId); | |||
if (!ObjectUtil.isEmpty(redisData)) { | |||
redisUtils.del(REDIS_KEY + payId); | |||
} | |||
} | |||
final Transaction transaction = jsapiV3Manager.jsApiQueryByOutTradeNo(payOrder.getOrderNo(), | |||
mchConfigManager.findBySubMchId(payOrder.getSubMchId())); | |||
if (Transaction.TradeStateEnum.PAYERROR.equals(transaction.getTradeState())) { | |||
@@ -209,6 +204,8 @@ public class ChoiceBillsOperationServiceImpl implements ChoiceBillsOperationServ | |||
payOrder.setTransactionId(transaction.getTransactionId()); | |||
payOrder.setOrderStatus(AflApPayOrderStatus.FAIL); | |||
payOrderRepo.save(payOrder); | |||
delRedisKey(payIds); | |||
throw UcServiceError.BUSINESS_VALIDATE_ERR.toHandleException(transaction.getTradeStateDesc()); | |||
} | |||
// 支付成功。 | |||
@@ -274,6 +271,16 @@ public class ChoiceBillsOperationServiceImpl implements ChoiceBillsOperationServ | |||
aflSmsSendManager.sendSmsOut(accountPayList.get(0)); | |||
} | |||
} | |||
delRedisKey(payIds); | |||
} | |||
private void delRedisKey(List<String> payIds){ | |||
for (String payId : payIds) { | |||
final Object redisData = redisUtils.get(REDIS_KEY + payId); | |||
if (!ObjectUtil.isEmpty(redisData)) { | |||
redisUtils.del(REDIS_KEY + payId); | |||
} | |||
} | |||
} | |||
private AflMchConfigVo getMchInfoEnum(String vehicleId) throws ServiceHandleException { |
@@ -1,21 +0,0 @@ | |||
import cn.hutool.json.JSONUtil; | |||
import com.qtzl.alterSales.manager.model.protocol.sales.AflPaccountReceivableBillExportRequest; | |||
import java.util.Arrays; | |||
import java.util.List; | |||
public class NoAppSimpleTest { | |||
public static void main(String[] args) { | |||
List<Integer> list = Arrays.asList(20241008, 20241025, 20241125, 20241124); | |||
AflPaccountReceivableBillExportRequest request = new AflPaccountReceivableBillExportRequest(); | |||
request.setAccountDates(list); | |||
System.out.println(JSONUtil.toJsonStr(request)); | |||
} | |||
} |