this.totalFee = totalFee; | this.totalFee = totalFee; | ||||
this.orderStatus = orderStatus; | 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") | @Column(name = "order_no") | ||||
public String getOrderNo() { | public String getOrderNo() { | ||||
return orderNo; | return orderNo; | ||||
public void setOrderStatus(AflApPayOrderStatus orderStatus) { | public void setOrderStatus(AflApPayOrderStatus orderStatus) { | ||||
this.orderStatus = 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 + | |||||
'}'; | |||||
} | |||||
} | } |
package com.qtzl.alterSales.dao.repo.jpa.primary; | package com.qtzl.alterSales.dao.repo.jpa.primary; | ||||
import com.qtzl.alterSales.dao.entity.primary.AflApPayOrder; | 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.JpaRepository; | ||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor; | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; | ||||
import org.springframework.data.jpa.repository.Query; | |||||
import java.util.List; | |||||
/*** | /*** | ||||
* <p> | * <p> | ||||
public interface AflApPayOrderRepo extends JpaRepository<AflApPayOrder, String>, | public interface AflApPayOrderRepo extends JpaRepository<AflApPayOrder, String>, | ||||
JpaSpecificationExecutor<AflApPayOrder> { | 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); | |||||
} | } |
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小程序过户、取消订单本地订单处理完成"); | |||||
} | |||||
} |
import cn.com.taiji.common.manager.net.http.ServiceHandleException; | import cn.com.taiji.common.manager.net.http.ServiceHandleException; | ||||
import com.qtzl.alterSales.dao.entity.primary.AflApPayOrder; | import com.qtzl.alterSales.dao.entity.primary.AflApPayOrder; | ||||
import com.qtzl.alterSales.manager.enums.AflApPayOrderStatus; | |||||
import org.slf4j.Logger; | |||||
import java.util.List; | |||||
/*** | /*** | ||||
* <p> | * <p> | ||||
*/ | */ | ||||
AflApPayOrder findById(String id) throws ServiceHandleException; | AflApPayOrder findById(String id) throws ServiceHandleException; | ||||
List<AflApPayOrder> findByOrderStatus(AflApPayOrderStatus orderStatus, Logger log); | |||||
} | } |
import cn.com.taiji.common.manager.net.http.ServiceHandleException; | import cn.com.taiji.common.manager.net.http.ServiceHandleException; | ||||
import com.qtzl.alterSales.dao.entity.primary.AflApPayOrder; | import com.qtzl.alterSales.dao.entity.primary.AflApPayOrder; | ||||
import com.qtzl.alterSales.dao.repo.jpa.primary.AflApPayOrderRepo; | 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 com.qtzl.alterSales.manager.model.protocol.UcServiceError; | ||||
import org.apache.commons.lang3.StringUtils; | import org.apache.commons.lang3.StringUtils; | ||||
import org.slf4j.Logger; | |||||
import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
import javax.annotation.Resource; | import javax.annotation.Resource; | ||||
import java.util.List; | |||||
/*** | /*** | ||||
* <p> | * <p> | ||||
} | } | ||||
return payOrder; | return payOrder; | ||||
} | } | ||||
@Override | |||||
public List<AflApPayOrder> findByOrderStatus(AflApPayOrderStatus orderStatus, Logger log) { | |||||
return aflApPayOrderRepo.findByOrderStatus(orderStatus); | |||||
} | |||||
} | } |