@@ -44,6 +44,20 @@ public class AflApPayOrder extends AbstractInsertTimeEntity { | |||
this.totalFee = totalFee; | |||
this.orderStatus = orderStatus; | |||
} | |||
public AflApPayOrder(String id,String orderNo, String subMchId, String openId, Integer idType, String idNum, String vehicleId, | |||
Integer quantity, Long totalFee, AflApPayOrderStatus orderStatus) { | |||
this.id=id; | |||
this.orderNo = orderNo; | |||
this.subMchId = subMchId; | |||
this.openId = openId; | |||
this.idType = idType; | |||
this.idNum = idNum; | |||
this.vehicleId = vehicleId; | |||
this.quantity = quantity; | |||
this.totalFee = totalFee; | |||
this.orderStatus = orderStatus; | |||
} | |||
@Column(name = "order_no") | |||
public String getOrderNo() { | |||
return orderNo; | |||
@@ -140,4 +154,21 @@ public class AflApPayOrder extends AbstractInsertTimeEntity { | |||
public void setOrderStatus(AflApPayOrderStatus orderStatus) { | |||
this.orderStatus = orderStatus; | |||
} | |||
@Override | |||
public String toString() { | |||
return "AflApPayOrder{" + | |||
"orderNo='" + orderNo + '\'' + | |||
", transactionId='" + transactionId + '\'' + | |||
", subMchId='" + subMchId + '\'' + | |||
", openId='" + openId + '\'' + | |||
", idType=" + idType + | |||
", idNum='" + idNum + '\'' + | |||
", vehicleId='" + vehicleId + '\'' + | |||
", quantity=" + quantity + | |||
", totalFee=" + totalFee + | |||
", payTime=" + payTime + | |||
", orderStatus=" + orderStatus + | |||
'}'; | |||
} | |||
} |
@@ -1,8 +1,12 @@ | |||
package com.qtzl.alterSales.dao.repo.jpa.primary; | |||
import com.qtzl.alterSales.dao.entity.primary.AflApPayOrder; | |||
import com.qtzl.alterSales.manager.enums.AflApPayOrderStatus; | |||
import org.springframework.data.jpa.repository.JpaRepository; | |||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor; | |||
import org.springframework.data.jpa.repository.Query; | |||
import java.util.List; | |||
/*** | |||
* <p> | |||
@@ -14,4 +18,6 @@ import org.springframework.data.jpa.repository.JpaSpecificationExecutor; | |||
public interface AflApPayOrderRepo extends JpaRepository<AflApPayOrder, String>, | |||
JpaSpecificationExecutor<AflApPayOrder> { | |||
@Query("SELECT new com.qtzl.alterSales.dao.entity.primary.AflApPayOrder(id,orderNo,subMchId,openId,idType,idNum,vehicleId,quantity,totalFee,orderStatus) FROM AflApPayOrder WHERE orderStatus =?1") | |||
List<AflApPayOrder> findByOrderStatus(AflApPayOrderStatus orderStatus); | |||
} |
@@ -0,0 +1,59 @@ | |||
package com.qtzl.alterSales.manager.quartz; | |||
import cn.com.taiji.common.manager.AbstractManager; | |||
import cn.com.taiji.common.manager.net.http.ServiceHandleException; | |||
import com.qtzl.alterSales.dao.entity.primary.AflApPayOrder; | |||
import com.qtzl.alterSales.manager.enums.AflApPayOrderStatus; | |||
import com.qtzl.alterSales.manager.service.AflApPayOrderService; | |||
import com.qtzl.alterSales.manager.service.ChoiceBillsOperationService; | |||
import org.slf4j.Logger; | |||
import org.slf4j.LoggerFactory; | |||
import org.springframework.scheduling.annotation.Scheduled; | |||
import org.springframework.stereotype.Component; | |||
import javax.annotation.Resource; | |||
import java.util.List; | |||
/** | |||
* 选装-补交微信支付订单定时任务 | |||
*/ | |||
@Component | |||
public class AflApPayOrderTask extends AbstractManager { | |||
private static final Logger log = LoggerFactory.getLogger(AflApPayOrderTask.class); | |||
@Resource | |||
private AflApPayOrderService aflApPayOrderService; | |||
@Resource | |||
private ChoiceBillsOperationService choiceBillsOperationService; | |||
/** | |||
* 定时查询order_status为TO_BE_PAID的订单 | |||
*/ | |||
@Scheduled(cron = "* */10 * * * ?") | |||
public void findByOrderStatus(){ | |||
List<AflApPayOrder> aflApPayOrders = aflApPayOrderService.findByOrderStatus(AflApPayOrderStatus.TO_BE_PAID, log); | |||
log.info("本次查询结果为:{}",aflApPayOrders); | |||
if (aflApPayOrders==null||aflApPayOrders.size()<1){ | |||
log.info("中国ETC小程序过户、取消订单本地订单处理没有需要处理的数据"); | |||
} | |||
log.info("本次需要处理的订单集合为:{}",aflApPayOrders.toString()); | |||
int indexSusses=0; | |||
int indexFail=0; | |||
for (AflApPayOrder aflApPayOrder : aflApPayOrders) { | |||
log.info("本次需要处理的订单为:{}",aflApPayOrder.toString()); | |||
try { | |||
choiceBillsOperationService.choiceBillsPayQuery(aflApPayOrder.getId()); | |||
} catch (ServiceHandleException e) { | |||
log.info("本次订单处理失败。订单为:{}",aflApPayOrder.toString()); | |||
indexFail++; | |||
continue; | |||
} | |||
indexSusses++; | |||
} | |||
log.info("本次订单处理成功数为:"+indexSusses +";失败数为:"+indexFail); | |||
log.info("中国ETC小程序过户、取消订单本地订单处理完成"); | |||
} | |||
} |
@@ -2,6 +2,10 @@ package com.qtzl.alterSales.manager.service; | |||
import cn.com.taiji.common.manager.net.http.ServiceHandleException; | |||
import com.qtzl.alterSales.dao.entity.primary.AflApPayOrder; | |||
import com.qtzl.alterSales.manager.enums.AflApPayOrderStatus; | |||
import org.slf4j.Logger; | |||
import java.util.List; | |||
/*** | |||
* <p> | |||
@@ -20,4 +24,5 @@ public interface AflApPayOrderService { | |||
*/ | |||
AflApPayOrder findById(String id) throws ServiceHandleException; | |||
List<AflApPayOrder> findByOrderStatus(AflApPayOrderStatus orderStatus, Logger log); | |||
} |
@@ -3,11 +3,14 @@ package com.qtzl.alterSales.manager.service; | |||
import cn.com.taiji.common.manager.net.http.ServiceHandleException; | |||
import com.qtzl.alterSales.dao.entity.primary.AflApPayOrder; | |||
import com.qtzl.alterSales.dao.repo.jpa.primary.AflApPayOrderRepo; | |||
import com.qtzl.alterSales.manager.enums.AflApPayOrderStatus; | |||
import com.qtzl.alterSales.manager.model.protocol.UcServiceError; | |||
import org.apache.commons.lang3.StringUtils; | |||
import org.slf4j.Logger; | |||
import org.springframework.stereotype.Service; | |||
import javax.annotation.Resource; | |||
import java.util.List; | |||
/*** | |||
* <p> | |||
@@ -33,4 +36,9 @@ public class AflApPayOrderServiceImpl implements AflApPayOrderService { | |||
} | |||
return payOrder; | |||
} | |||
@Override | |||
public List<AflApPayOrder> findByOrderStatus(AflApPayOrderStatus orderStatus, Logger log) { | |||
return aflApPayOrderRepo.findByOrderStatus(orderStatus); | |||
} | |||
} |