@@ -105,6 +105,7 @@ dependencies { | |||
//transitive = false | |||
} | |||
implementation("org.springframework.boot:spring-boot-starter-amqp") | |||
} | |||
@@ -88,6 +88,10 @@ public class FssPaccountPay extends StringUUIDEntity { | |||
/*** 出站时间*/ | |||
private LocalDateTime exTime; | |||
private String agentId; | |||
/*** 入口站*/ | |||
private String enStationName; | |||
/*** 出口站*/ | |||
private String exStationName; | |||
@Column(name = "version") | |||
public String getVersion() { | |||
@@ -391,4 +395,22 @@ public class FssPaccountPay extends StringUUIDEntity { | |||
public void setAgentId(String agentId) { | |||
this.agentId = agentId; | |||
} | |||
@Column(name = "en_station_name") | |||
public String getEnStationName() { | |||
return enStationName; | |||
} | |||
public void setEnStationName(String enStationName) { | |||
this.enStationName = enStationName; | |||
} | |||
@Column(name = "ex_station_name") | |||
public String getExStationName() { | |||
return exStationName; | |||
} | |||
public void setExStationName(String exStationName) { | |||
this.exStationName = exStationName; | |||
} | |||
} |
@@ -0,0 +1,197 @@ | |||
package com.qtzl.alterSales.dao.entity.primary; | |||
import cn.com.taiji.common.entity.StringUUIDEntity; | |||
import javax.persistence.Column; | |||
import javax.persistence.Entity; | |||
import javax.persistence.Table; | |||
import java.time.LocalDateTime; | |||
/*** | |||
* <p> | |||
* 通行流水微信车主服务请款、扣款成功记录表 | |||
* </p> | |||
* @author hou yi | |||
* {@code @date} 2023/8/25 15:59 | |||
**/ | |||
@Entity | |||
@Table(name = "fss_wechat_bill_pay_success") | |||
public class WechatBillPaySuccess extends StringUUIDEntity { | |||
/*** 商户订单号 */ | |||
private String outTradeNo; | |||
/*** 微信支付订单号 */ | |||
private String transactionId; | |||
/*** 路网收费订单号*/ | |||
private String orderId; | |||
/*** 路网交易编号*/ | |||
private String payId; | |||
/*** 车辆ID*/ | |||
private String vehicleId; | |||
/*** 扣款金额 */ | |||
private Long totalFee; | |||
/*** 返回状态码 */ | |||
private String returnCode; | |||
/*** 业务结果 */ | |||
private String resultCode; | |||
/*** 交易状态 */ | |||
private String tradeState; | |||
/*** 支付完成时间 */ | |||
private String timeEnd; | |||
/*** 返回信息 */ | |||
private String returnMsg; | |||
/*** 付款银行 */ | |||
private String bankType; | |||
/*** 返回的结果数据 */ | |||
private String resultStr; | |||
/*** 结果通知时间 */ | |||
private LocalDateTime insertTime; | |||
public WechatBillPaySuccess() { | |||
} | |||
public WechatBillPaySuccess(String outTradeNo, String transactionId, String orderId, String payId, | |||
String vehicleId, Long totalFee, String returnCode, String resultCode, | |||
String tradeState, String timeEnd, String returnMsg, String bankType, | |||
String resultStr, LocalDateTime insertTime) { | |||
this.outTradeNo = outTradeNo; | |||
this.transactionId = transactionId; | |||
this.orderId = orderId; | |||
this.payId = payId; | |||
this.vehicleId = vehicleId; | |||
this.totalFee = totalFee; | |||
this.returnCode = returnCode; | |||
this.resultCode = resultCode; | |||
this.tradeState = tradeState; | |||
this.timeEnd = timeEnd; | |||
this.returnMsg = returnMsg; | |||
this.bankType = bankType; | |||
this.resultStr = resultStr; | |||
this.insertTime = insertTime; | |||
} | |||
@Column(name = "out_trade_no") | |||
public String getOutTradeNo() { | |||
return outTradeNo; | |||
} | |||
public void setOutTradeNo(String outTradeNo) { | |||
this.outTradeNo = outTradeNo; | |||
} | |||
@Column(name = "transaction_id") | |||
public String getTransactionId() { | |||
return transactionId; | |||
} | |||
public void setTransactionId(String transactionId) { | |||
this.transactionId = transactionId; | |||
} | |||
@Column(name = "order_id") | |||
public String getOrderId() { | |||
return orderId; | |||
} | |||
public void setOrderId(String orderId) { | |||
this.orderId = orderId; | |||
} | |||
@Column(name = "pay_id") | |||
public String getPayId() { | |||
return payId; | |||
} | |||
public void setPayId(String payId) { | |||
this.payId = payId; | |||
} | |||
@Column(name = "vehicle_id") | |||
public String getVehicleId() { | |||
return vehicleId; | |||
} | |||
public void setVehicleId(String vehicleId) { | |||
this.vehicleId = vehicleId; | |||
} | |||
@Column(name = "total_fee") | |||
public Long getTotalFee() { | |||
return totalFee; | |||
} | |||
public void setTotalFee(Long totalFee) { | |||
this.totalFee = totalFee; | |||
} | |||
@Column(name = "return_code") | |||
public String getReturnCode() { | |||
return returnCode; | |||
} | |||
public void setReturnCode(String returnCode) { | |||
this.returnCode = returnCode; | |||
} | |||
@Column(name = "result_code") | |||
public String getResultCode() { | |||
return resultCode; | |||
} | |||
public void setResultCode(String resultCode) { | |||
this.resultCode = resultCode; | |||
} | |||
@Column(name = "trade_state") | |||
public String getTradeState() { | |||
return tradeState; | |||
} | |||
public void setTradeState(String tradeState) { | |||
this.tradeState = tradeState; | |||
} | |||
@Column(name = "time_end") | |||
public String getTimeEnd() { | |||
return timeEnd; | |||
} | |||
public void setTimeEnd(String timeEnd) { | |||
this.timeEnd = timeEnd; | |||
} | |||
@Column(name = "return_msg") | |||
public String getReturnMsg() { | |||
return returnMsg; | |||
} | |||
public void setReturnMsg(String returnMsg) { | |||
this.returnMsg = returnMsg; | |||
} | |||
@Column(name = "bank_type") | |||
public String getBankType() { | |||
return bankType; | |||
} | |||
public void setBankType(String bankType) { | |||
this.bankType = bankType; | |||
} | |||
@Column(name = "result_str") | |||
public String getResultStr() { | |||
return resultStr; | |||
} | |||
public void setResultStr(String resultStr) { | |||
this.resultStr = resultStr; | |||
} | |||
@Column(name = "insert_time") | |||
public LocalDateTime getInsertTime() { | |||
return insertTime; | |||
} | |||
public void setInsertTime(LocalDateTime insertTime) { | |||
this.insertTime = insertTime; | |||
} | |||
} |
@@ -0,0 +1,30 @@ | |||
package com.qtzl.alterSales.dao.repo.jpa.primary; | |||
import com.qtzl.alterSales.dao.entity.primary.WechatBillPaySuccess; | |||
import org.springframework.data.jpa.repository.JpaRepository; | |||
/*** | |||
* <p> | |||
* 通行流水微信车主服务请款记录表 repo | |||
* </p> | |||
* @author hou yi | |||
* {@code @date} 2023/8/25 16:08 | |||
**/ | |||
public interface WechatBillPaySuccessRepo extends JpaRepository<WechatBillPaySuccess, String> { | |||
/*** | |||
* 根据订单号获取流水发起请款记录 | |||
* @param outTradeNo 商户订单号 | |||
* @return 、 | |||
*/ | |||
WechatBillPaySuccess findByOutTradeNo(String outTradeNo); | |||
/*** | |||
* 根据路网订单号查询正常的请款成功的记录 | |||
* @param orderId 路网订单号 | |||
* @return 、 | |||
*/ | |||
WechatBillPaySuccess findByOrderId(String orderId); | |||
} |
@@ -4,6 +4,7 @@ import cn.com.taiji.common.manager.AbstractManager; | |||
import cn.com.taiji.common.manager.net.http.ServiceHandleException; | |||
import cn.com.taiji.common.model.BaseModel; | |||
import cn.com.taiji.common.pub.json.JsonTools; | |||
import com.fasterxml.jackson.core.JsonProcessingException; | |||
import com.qtzl.alterSales.manager.enums.AfterSalesApiStatusCode; | |||
import com.qtzl.alterSales.manager.model.protocol.AbstractAfterSalesResponse; | |||
import com.txffp.api.core.manager.comm.ApiCmd; | |||
@@ -89,7 +90,7 @@ public abstract class AbstractAfterSalesManager<T extends BaseModel> extends Abs | |||
} | |||
} | |||
public abstract String handleInternal(String filename, T t) throws ServiceHandleException; | |||
public abstract String handleInternal(String filename, T t) throws ServiceHandleException, JsonProcessingException; | |||
private AbstractAfterSalesResponse toJsonResponse(String resJson) { | |||
AbstractAfterSalesResponse response = new AbstractAfterSalesResponse(); |
@@ -0,0 +1,58 @@ | |||
package com.qtzl.alterSales.manager.handler; | |||
import cn.com.taiji.common.manager.net.http.ServiceHandleException; | |||
import com.alibaba.fastjson.JSON; | |||
import com.fasterxml.jackson.core.JsonProcessingException; | |||
import com.fasterxml.jackson.databind.ObjectMapper; | |||
import com.qtzl.alterSales.dao.entity.second.AflAccessChannelInfo; | |||
import com.qtzl.alterSales.dao.repo.jpa.primary.FssPaccountPayRepo; | |||
import com.qtzl.alterSales.dao.repo.jpa.primary.WechatBillPayApplyRepo; | |||
import com.qtzl.alterSales.manager.abstracts.AbstractAfterSalesManager; | |||
import com.qtzl.alterSales.manager.model.protocol.UcServiceError; | |||
import com.qtzl.alterSales.manager.model.protocol.sales.AflAccessChannelInfoFindByIdRequest; | |||
import com.qtzl.alterSales.manager.model.protocol.sales.FssPaccountPayResultFindByPayIdRequest; | |||
import com.qtzl.alterSales.manager.model.protocol.sales.FssPaccountPayResultFindByPayIdResponse; | |||
import com.qtzl.alterSales.manager.service.AflAccessChannelInfoService; | |||
import com.qtzl.alterSales.manager.service.AfterSalesCmd; | |||
import com.qtzl.alterSales.manager.service.FssPaccountPayService; | |||
import com.qtzl.alterSales.manager.tools.JsonUtils; | |||
import com.txffp.api.core.manager.comm.annotation.ApiHandler; | |||
import org.hsqldb.lib.StringUtil; | |||
import org.springframework.stereotype.Service; | |||
import javax.annotation.Resource; | |||
/** | |||
* 根据payid查询通行流水请款结果 | |||
*/ | |||
@Service | |||
@ApiHandler | |||
public class FssPaccountPayResultFindByPayIdHandler extends AbstractAfterSalesManager<FssPaccountPayResultFindByPayIdRequest> { | |||
@Resource | |||
private FssPaccountPayService fssPaccountPayService; | |||
public FssPaccountPayResultFindByPayIdHandler() { | |||
super(AfterSalesCmd.FINDBYPAYIDPACCOUNTPAYRESULT, FssPaccountPayResultFindByPayIdRequest.class); | |||
} | |||
@Override | |||
public String handleInternal(String filename, FssPaccountPayResultFindByPayIdRequest request) throws ServiceHandleException, JsonProcessingException { | |||
try { | |||
logger.info("选装-渠道方主动查询通行流水结果,请求参数:{}", request.toJson(true)); | |||
if (StringUtil.isEmpty(request.getPayId())){ | |||
throw UcServiceError.BUSINESS_VALIDATE_ERR.toHandleException("请指定payId"); | |||
} | |||
FssPaccountPayResultFindByPayIdResponse findByPayIdResponse= | |||
fssPaccountPayService.findPaccountPayResultByPayId(request.getPayId()); | |||
return JsonUtils.toJsonStr(findByPayIdResponse); | |||
} catch (Exception e) { | |||
if (e instanceof ServiceHandleException) { | |||
throw e; | |||
} | |||
logger.error("选装-渠道方主动查询通行流水结果:{}", e.getMessage()); | |||
throw UcServiceError.BUSINESS_VALIDATE_ERR.toHandleException("操作失败"); | |||
} | |||
} | |||
} |
@@ -0,0 +1,20 @@ | |||
package com.qtzl.alterSales.manager.model.protocol.sales; | |||
import cn.com.taiji.common.model.BaseModel; | |||
import com.qtzl.alterSales.manager.service.AfterSalesCmd; | |||
import com.txffp.api.core.manager.comm.annotation.Api; | |||
@Api(cmdClazz = AfterSalesCmd.class, cmd = "FINDBYPAYIDPACCOUNTPAYRESULT") | |||
public class FssPaccountPayResultFindByPayIdRequest extends BaseModel { | |||
/*** 路网交易编号 */ | |||
private String payId; | |||
public String getPayId() { | |||
return payId; | |||
} | |||
public void setPayId(String payId) { | |||
this.payId = payId; | |||
} | |||
} |
@@ -0,0 +1,167 @@ | |||
package com.qtzl.alterSales.manager.model.protocol.sales; | |||
import cn.com.taiji.common.model.BaseModel; | |||
import com.qtzl.alterSales.manager.service.AfterSalesCmd; | |||
import com.txffp.api.core.manager.comm.annotation.Api; | |||
public class FssPaccountPayResultFindByPayIdResponse extends BaseModel { | |||
/*** 路网交易编号 */ | |||
private String payId; | |||
private String agreementNum; // 部签约协议号 | |||
private String vehicleId; // 车辆编号 | |||
private String orderId; // 路网收费订单号 | |||
private Integer receiptAmt; // 扣款金额 | |||
//真实请款结果 1 成功 2 失败 | |||
private Integer payStatus; | |||
private String payMsg; // 扣款描述 | |||
private String wxPayTime;//微信请款时间 请款成功必填 | |||
//微信扣款订单号 默认使用payId 重扣的生成新的UUID使用 | |||
private String wxOrderId; | |||
/*** 卡号*/ | |||
private String etcCardNum; | |||
/*** OBU id*/ | |||
private String obuNum; | |||
/*** 入口站*/ | |||
private String enStationName; | |||
/*** 入口时间*/ | |||
private String enTime; | |||
/*** 出口站*/ | |||
private String exStationName; | |||
/*** 出口时间*/ | |||
private String exTime; | |||
/*** 微信支付订单号,扣费成功必填*/ | |||
private String transactionId; | |||
public String getTransactionId() { | |||
return transactionId; | |||
} | |||
public void setTransactionId(String transactionId) { | |||
this.transactionId = transactionId; | |||
} | |||
public String getPayId() { | |||
return payId; | |||
} | |||
public void setPayId(String payId) { | |||
this.payId = payId; | |||
} | |||
public String getAgreementNum() { | |||
return agreementNum; | |||
} | |||
public void setAgreementNum(String agreementNum) { | |||
this.agreementNum = agreementNum; | |||
} | |||
public String getVehicleId() { | |||
return vehicleId; | |||
} | |||
public void setVehicleId(String vehicleId) { | |||
this.vehicleId = vehicleId; | |||
} | |||
public String getOrderId() { | |||
return orderId; | |||
} | |||
public void setOrderId(String orderId) { | |||
this.orderId = orderId; | |||
} | |||
public Integer getReceiptAmt() { | |||
return receiptAmt; | |||
} | |||
public void setReceiptAmt(Integer receiptAmt) { | |||
this.receiptAmt = receiptAmt; | |||
} | |||
public Integer getPayStatus() { | |||
return payStatus; | |||
} | |||
public void setPayStatus(Integer payStatus) { | |||
this.payStatus = payStatus; | |||
} | |||
public String getPayMsg() { | |||
return payMsg; | |||
} | |||
public void setPayMsg(String payMsg) { | |||
this.payMsg = payMsg; | |||
} | |||
public String getWxPayTime() { | |||
return wxPayTime; | |||
} | |||
public void setWxPayTime(String wxPayTime) { | |||
this.wxPayTime = wxPayTime; | |||
} | |||
public String getWxOrderId() { | |||
return wxOrderId; | |||
} | |||
public void setWxOrderId(String wxOrderId) { | |||
this.wxOrderId = wxOrderId; | |||
} | |||
public String getEtcCardNum() { | |||
return etcCardNum; | |||
} | |||
public void setEtcCardNum(String etcCardNum) { | |||
this.etcCardNum = etcCardNum; | |||
} | |||
public String getObuNum() { | |||
return obuNum; | |||
} | |||
public void setObuNum(String obuNum) { | |||
this.obuNum = obuNum; | |||
} | |||
public String getEnStationName() { | |||
return enStationName; | |||
} | |||
public void setEnStationName(String enStationName) { | |||
this.enStationName = enStationName; | |||
} | |||
public String getEnTime() { | |||
return enTime; | |||
} | |||
public void setEnTime(String enTime) { | |||
this.enTime = enTime; | |||
} | |||
public String getExStationName() { | |||
return exStationName; | |||
} | |||
public void setExStationName(String exStationName) { | |||
this.exStationName = exStationName; | |||
} | |||
public String getExTime() { | |||
return exTime; | |||
} | |||
public void setExTime(String exTime) { | |||
this.exTime = exTime; | |||
} | |||
} |
@@ -0,0 +1,50 @@ | |||
package com.qtzl.alterSales.manager.rabbit; | |||
import com.google.common.collect.Maps; | |||
import org.springframework.amqp.core.Binding; | |||
import org.springframework.amqp.core.BindingBuilder; | |||
import org.springframework.amqp.core.CustomExchange; | |||
import org.springframework.amqp.core.Queue; | |||
import org.springframework.beans.factory.annotation.Qualifier; | |||
import org.springframework.context.annotation.Bean; | |||
import org.springframework.context.annotation.Configuration; | |||
import org.springframework.core.annotation.Order; | |||
import java.util.Map; | |||
/*** | |||
* <p> | |||
* rabbit 延迟模型配置 | |||
* </p> | |||
* @author hou yi | |||
* {@code @date} 2023/8/29 16:02 | |||
**/ | |||
@Configuration | |||
@Order(1) | |||
public class RabbitDelayModelConfig { | |||
public static final String WECHAT_AFL_APPLY_EXCHANGE = "afl-running-water-exchange"; | |||
/*** 通行流水推送*/ | |||
public static final String FSS_PACCOUNTPAY_PUSH_QUEUE = "fss-paccountpay-push-queue"; | |||
public static final String AFL_PACCOUNTPAY_PUSH_QUEUE_ROUTING_KEY = "fss-paccountpay-push-queue-routing-key"; | |||
@Bean({"aflApplyExchange"}) | |||
public CustomExchange orderRefundApplyExchange() { | |||
Map<String, Object> arguments = Maps.newHashMap(); | |||
arguments.put("x-delayed-type", "direct"); | |||
return new CustomExchange(RabbitDelayModelConfig.WECHAT_AFL_APPLY_EXCHANGE, "x-delayed-message", true, false, arguments); | |||
} | |||
@Bean({"fssPaccountpayPushQueue"}) | |||
public Queue fssPaccountpayPushQueue() { | |||
return new Queue(RabbitDelayModelConfig.FSS_PACCOUNTPAY_PUSH_QUEUE); | |||
} | |||
@Bean | |||
public Binding runningFssPaccountpayPushQueueExchange(@Qualifier("fssPaccountpayPushQueue") Queue customQueue, @Qualifier( | |||
"aflApplyExchange") CustomExchange delayExchange) { | |||
return BindingBuilder.bind(customQueue).to(delayExchange).with(RabbitDelayModelConfig.AFL_PACCOUNTPAY_PUSH_QUEUE_ROUTING_KEY).noargs(); | |||
} | |||
} |
@@ -0,0 +1,29 @@ | |||
package com.qtzl.alterSales.manager.rabbit; | |||
import org.springframework.amqp.rabbit.core.RabbitTemplate; | |||
import org.springframework.stereotype.Component; | |||
import javax.annotation.Resource; | |||
/*** | |||
* <p> | |||
* rabbit MQ 统一生产 | |||
* </p> | |||
* @author hou yi | |||
* {@code @date} 2023/8/29 16:06 | |||
**/ | |||
@Component | |||
public class RabbitUnifiedProduction { | |||
@Resource | |||
private RabbitTemplate rabbitTemplate; | |||
public void delayFssPaccountpayPushQueue(String message, Integer ttlTime,Integer retryCount) { | |||
rabbitTemplate.convertAndSend(RabbitDelayModelConfig.WECHAT_AFL_APPLY_EXCHANGE, RabbitDelayModelConfig.AFL_PACCOUNTPAY_PUSH_QUEUE_ROUTING_KEY, | |||
message, (correlationData) -> { | |||
correlationData.getMessageProperties().setDelay(ttlTime); | |||
correlationData.getMessageProperties().setHeader("retryCount", retryCount); | |||
return correlationData; | |||
}); | |||
} | |||
} |
@@ -172,6 +172,7 @@ public enum AfterSalesCmd implements ApiCmd { | |||
REFRESHTOKEN("刷新用户authToken", UcServiceType.AFTERSALES), | |||
CERTIFICATION("实名认证", UcServiceType.AFTERSALES), | |||
USERINFO("获取用户手机、实名信息", UcServiceType.AFTERSALES), | |||
FINDBYPAYIDPACCOUNTPAYRESULT("查询-渠道方主动查询通行流水结果", UcServiceType.AFTERSALES), | |||
; | |||
private String value; |
@@ -20,6 +20,7 @@ import com.qtzl.alterSales.manager.enums.WechatAttachEnum; | |||
import com.qtzl.alterSales.manager.model.protocol.UcServiceError; | |||
import com.qtzl.alterSales.manager.model.protocol.sales.ChoiceBillsPayRequest; | |||
import com.qtzl.alterSales.manager.model.protocol.wechat.partnerpayments.JsapiV3Manager; | |||
import com.qtzl.alterSales.manager.rabbit.RabbitUnifiedProduction; | |||
import com.qtzl.alterSales.manager.tools.RedisUtils; | |||
import com.qtzl.alterSales.manager.vo.AflMchConfigVo; | |||
import com.qtzl.alterSales.manager.vo.ChoiceBillsPayVo; | |||
@@ -77,6 +78,8 @@ public class ChoiceBillsOperationServiceImpl implements ChoiceBillsOperationServ | |||
private AflWechatSignRepo aflWechatSignRepo; | |||
@Resource | |||
AflPaccountRefundCountService aflPaccountRefundCountService; | |||
@Resource | |||
private RabbitUnifiedProduction rabbitUnifiedProduction; | |||
// 请不要改这个key | |||
private static final String REDIS_KEY = "PAY_FAIL_"; | |||
@@ -220,7 +223,8 @@ public class ChoiceBillsOperationServiceImpl implements ChoiceBillsOperationServ | |||
pay.setWxPayStatus(1); | |||
pay.setWxPayTime(payTime); | |||
pay.setWxOrderId(payOrder.getOrderNo()); | |||
// | |||
//加入队列,等待扣款结果通知 | |||
rabbitUnifiedProduction.delayFssPaccountpayPushQueue(pay.getPayId(), 1000,0); | |||
supplementaryPayOrderService.paySuccessNotify(pay.getPayId(), payTime, payOrder.getOrderNo()); |
@@ -1,6 +1,7 @@ | |||
package com.qtzl.alterSales.manager.service; | |||
import cn.com.taiji.common.manager.net.http.ServiceHandleException; | |||
import com.qtzl.alterSales.manager.model.protocol.sales.FssPaccountPayResultFindByPayIdResponse; | |||
import com.qtzl.alterSales.manager.vo.VehicleAgreementNumBillsVo; | |||
import java.util.List; | |||
@@ -32,4 +33,10 @@ public interface FssPaccountPayService { | |||
void count(int day) throws ServiceHandleException; | |||
/** | |||
* 根据payId查询流水信息 | |||
* @param payId | |||
* @return FssPaccountPayResultFindByPayIdResponse | |||
*/ | |||
FssPaccountPayResultFindByPayIdResponse findPaccountPayResultByPayId(String payId) throws ServiceHandleException; | |||
} |
@@ -1,17 +1,22 @@ | |||
package com.qtzl.alterSales.manager.service; | |||
import cn.com.taiji.common.manager.net.http.ServiceHandleException; | |||
import cn.hutool.core.bean.BeanUtil; | |||
import com.alibaba.fastjson.JSON; | |||
import com.google.common.collect.Lists; | |||
import com.qtzl.alterSales.dao.entity.primary.FssPaccountPay; | |||
import com.qtzl.alterSales.dao.entity.primary.WechatBillPayApply; | |||
import com.qtzl.alterSales.dao.entity.primary.WechatBillPaySuccess; | |||
import com.qtzl.alterSales.dao.entity.second.AflPaccountRefundCount; | |||
import com.qtzl.alterSales.dao.repo.jpa.primary.AflSupplementaryPayOrderRepo; | |||
import com.qtzl.alterSales.dao.repo.jpa.primary.FssPaccountPayRepo; | |||
import com.qtzl.alterSales.dao.repo.jpa.primary.FssPaccountRefundRepo; | |||
import com.qtzl.alterSales.dao.repo.jpa.primary.WechatBillPayApplyRepo; | |||
import com.qtzl.alterSales.dao.repo.jpa.primary.WechatBillPaySuccessRepo; | |||
import com.qtzl.alterSales.dao.repo.jpa.second.AflPaccountRefundCountRepo; | |||
import com.qtzl.alterSales.manager.enums.VehiclePlateColorEnum; | |||
import com.qtzl.alterSales.manager.model.protocol.UcServiceError; | |||
import com.qtzl.alterSales.manager.model.protocol.sales.FssPaccountPayResultFindByPayIdResponse; | |||
import com.qtzl.alterSales.manager.vo.AflPaccountRefundCountFindVo; | |||
import com.qtzl.alterSales.manager.vo.VehicleAgreementNumBillsVo; | |||
import org.apache.commons.lang3.StringUtils; | |||
@@ -53,6 +58,10 @@ public class FssPaccountPayServiceImpl implements FssPaccountPayService { | |||
@Resource | |||
private WechatBillPayApplyRepo wechatBillPayApplyRepo; | |||
@Resource | |||
private WechatBillPaySuccessRepo successRepo; | |||
@Override | |||
public List<VehicleAgreementNumBillsVo> getAgreementBills(String plateNumber, Integer plateColor) throws ServiceHandleException { | |||
if (StringUtils.isEmpty(plateNumber) || null == plateColor) { | |||
@@ -64,7 +73,8 @@ public class FssPaccountPayServiceImpl implements FssPaccountPayService { | |||
} | |||
/* // 过滤掉已生成补缴单的流水 | |||
final List<String> payIds = agreementBills.stream().map(FssPaccountPay::getPayId).toList(); | |||
final List<AflSupplementaryPayOrder> orders = supplementaryPayOrderRepo.findAll((root, query, cb) -> query.where( | |||
final List<AflSupplementaryPayOrder> orders = supplementaryPayOrderRepo.findAll((root, query, cb) -> query | |||
.where( | |||
root.<String>get("payId").in(payIds) | |||
).getRestriction()); | |||
if (!CollectionUtils.isEmpty(orders)) { | |||
@@ -87,64 +97,68 @@ public class FssPaccountPayServiceImpl implements FssPaccountPayService { | |||
// 获取当前日期前一天的日期 | |||
LocalDate localDate = LocalDate.now().minusDays(day);//1代表提前多少天 | |||
String yesterday = localDate.toString(); | |||
System.out.println("当前导入记录日期="+yesterday); | |||
Integer i= aflPaccountRefundCountRepo.findByToDay(yesterday.replaceAll("-","")); | |||
if (i!=null&&i>0){ | |||
throw UcServiceError.BUSINESS_VALIDATE_ERR.toHandleException("当前n+"+day+"天记录已存在"); | |||
System.out.println("当前导入记录日期=" + yesterday); | |||
Integer i = aflPaccountRefundCountRepo.findByToDay(yesterday.replaceAll("-", "")); | |||
if (i != null && i > 0) { | |||
throw UcServiceError.BUSINESS_VALIDATE_ERR.toHandleException("当前n+" + day + "天记录已存在"); | |||
} | |||
List<Map<String, Object>> countTotal = paccountPayRepo.findCountTotal(yesterday+" 00:00:00",yesterday+" 23:59:59"); | |||
List<Map<String, Object>> countTotal = paccountPayRepo.findCountTotal(yesterday + " 00:00:00", yesterday + " " + | |||
"23:59:59"); | |||
List<AflPaccountRefundCountFindVo> list = new ArrayList<AflPaccountRefundCountFindVo>(); | |||
for (Map<String, Object> stringObjectMap : countTotal) { | |||
AflPaccountRefundCountFindVo aflPaccountRefundCountVo = JSON.parseObject(JSON.toJSONString(stringObjectMap), AflPaccountRefundCountFindVo.class); | |||
AflPaccountRefundCountFindVo aflPaccountRefundCountVo = | |||
JSON.parseObject(JSON.toJSONString(stringObjectMap), AflPaccountRefundCountFindVo.class); | |||
list.add(aflPaccountRefundCountVo); | |||
} | |||
if (list==null||list.size()<1){ | |||
throw UcServiceError.BUSINESS_VALIDATE_ERR.toHandleException("当前n+"+day+"天记录无数据"); | |||
if (list == null || list.size() < 1) { | |||
throw UcServiceError.BUSINESS_VALIDATE_ERR.toHandleException("当前n+" + day + "天记录无数据"); | |||
} | |||
log.info("本次处理数据:{}", JSON.toJSON(list)); | |||
AflPaccountRefundCount bydAflPaccountRefundCount = null; | |||
for (AflPaccountRefundCountFindVo aflPaccountRefundCountVo : list) { | |||
AflPaccountRefundCount aflPaccountRefundCount = new AflPaccountRefundCount(); | |||
Long refundMoney = fssPaccountRefundRepo.findByCountRefundMoney(aflPaccountRefundCountVo.getAgentId(),aflPaccountRefundCountVo.getAccountDate()); | |||
BeanUtils.copyProperties(aflPaccountRefundCountVo,aflPaccountRefundCount); | |||
Long refundMoney = fssPaccountRefundRepo.findByCountRefundMoney(aflPaccountRefundCountVo.getAgentId(), | |||
aflPaccountRefundCountVo.getAccountDate()); | |||
BeanUtils.copyProperties(aflPaccountRefundCountVo, aflPaccountRefundCount); | |||
aflPaccountRefundCount.setRefundMoney(refundMoney); | |||
if (!StringUtils.isEmpty(aflPaccountRefundCountVo.getAccountDate())){ | |||
String accountDate=aflPaccountRefundCountVo.getAccountDate().replaceAll("-",""); | |||
if (!StringUtils.isEmpty(aflPaccountRefundCountVo.getAccountDate())) { | |||
String accountDate = aflPaccountRefundCountVo.getAccountDate().replaceAll("-", ""); | |||
Integer newAccountDate = Integer.parseInt(accountDate); | |||
aflPaccountRefundCount.setAccountDate(newAccountDate); | |||
} | |||
if ("52010188999".equals(aflPaccountRefundCount.getAgentId())&&aflPaccountRefundCount.getAccountDate()!=null){ | |||
bydAflPaccountRefundCount=aflPaccountRefundCount; | |||
AflPaccountRefundCount bydNewAflPaccountRefundCount= aflPaccountRefundCountRepo.finByDateAndAgentId("52010188930",aflPaccountRefundCount.getAccountDate()); | |||
if (bydNewAflPaccountRefundCount!=null){ | |||
if (bydAflPaccountRefundCount.getMoneyTotal()!=null){ | |||
bydNewAflPaccountRefundCount.setMoneyTotal(bydNewAflPaccountRefundCount.getMoneyTotal()+bydAflPaccountRefundCount.getMoneyTotal()); | |||
if ("52010188999".equals(aflPaccountRefundCount.getAgentId()) && aflPaccountRefundCount.getAccountDate() != null) { | |||
bydAflPaccountRefundCount = aflPaccountRefundCount; | |||
AflPaccountRefundCount bydNewAflPaccountRefundCount = aflPaccountRefundCountRepo.finByDateAndAgentId( | |||
"52010188930", aflPaccountRefundCount.getAccountDate()); | |||
if (bydNewAflPaccountRefundCount != null) { | |||
if (bydAflPaccountRefundCount.getMoneyTotal() != null) { | |||
bydNewAflPaccountRefundCount.setMoneyTotal(bydNewAflPaccountRefundCount.getMoneyTotal() + bydAflPaccountRefundCount.getMoneyTotal()); | |||
} | |||
if (bydAflPaccountRefundCount.getRefundMoney()!=null){ | |||
bydNewAflPaccountRefundCount.setRefundMoney(bydNewAflPaccountRefundCount.getRefundMoney()+bydAflPaccountRefundCount.getRefundMoney()); | |||
if (bydAflPaccountRefundCount.getRefundMoney() != null) { | |||
bydNewAflPaccountRefundCount.setRefundMoney(bydNewAflPaccountRefundCount.getRefundMoney() + bydAflPaccountRefundCount.getRefundMoney()); | |||
} | |||
if (bydAflPaccountRefundCount.getCollectMoney()!=null){ | |||
bydNewAflPaccountRefundCount.setCollectMoney(bydNewAflPaccountRefundCount.getCollectMoney()+bydAflPaccountRefundCount.getCollectMoney()); | |||
if (bydAflPaccountRefundCount.getCollectMoney() != null) { | |||
bydNewAflPaccountRefundCount.setCollectMoney(bydNewAflPaccountRefundCount.getCollectMoney() + bydAflPaccountRefundCount.getCollectMoney()); | |||
} | |||
if (bydAflPaccountRefundCount.getNumberTotal()!=null){ | |||
bydNewAflPaccountRefundCount.setNumberTotal(bydNewAflPaccountRefundCount.getNumberTotal()+bydAflPaccountRefundCount.getNumberTotal()); | |||
if (bydAflPaccountRefundCount.getNumberTotal() != null) { | |||
bydNewAflPaccountRefundCount.setNumberTotal(bydNewAflPaccountRefundCount.getNumberTotal() + bydAflPaccountRefundCount.getNumberTotal()); | |||
} | |||
aflPaccountRefundCountRepo.save(bydNewAflPaccountRefundCount); | |||
} | |||
continue; | |||
} | |||
if ("52010188930".equals(aflPaccountRefundCount.getAgentId())&&bydAflPaccountRefundCount!=null){ | |||
if (bydAflPaccountRefundCount.getMoneyTotal()!=null){ | |||
aflPaccountRefundCount.setMoneyTotal(aflPaccountRefundCount.getMoneyTotal()+bydAflPaccountRefundCount.getMoneyTotal()); | |||
if ("52010188930".equals(aflPaccountRefundCount.getAgentId()) && bydAflPaccountRefundCount != null) { | |||
if (bydAflPaccountRefundCount.getMoneyTotal() != null) { | |||
aflPaccountRefundCount.setMoneyTotal(aflPaccountRefundCount.getMoneyTotal() + bydAflPaccountRefundCount.getMoneyTotal()); | |||
} | |||
if (bydAflPaccountRefundCount.getRefundMoney()!=null){ | |||
aflPaccountRefundCount.setRefundMoney(aflPaccountRefundCount.getRefundMoney()+bydAflPaccountRefundCount.getRefundMoney()); | |||
if (bydAflPaccountRefundCount.getRefundMoney() != null) { | |||
aflPaccountRefundCount.setRefundMoney(aflPaccountRefundCount.getRefundMoney() + bydAflPaccountRefundCount.getRefundMoney()); | |||
} | |||
if (bydAflPaccountRefundCount.getCollectMoney()!=null){ | |||
aflPaccountRefundCount.setCollectMoney(aflPaccountRefundCount.getCollectMoney()+bydAflPaccountRefundCount.getCollectMoney()); | |||
if (bydAflPaccountRefundCount.getCollectMoney() != null) { | |||
aflPaccountRefundCount.setCollectMoney(aflPaccountRefundCount.getCollectMoney() + bydAflPaccountRefundCount.getCollectMoney()); | |||
} | |||
if (bydAflPaccountRefundCount.getNumberTotal()!=null){ | |||
aflPaccountRefundCount.setCollectMoney(aflPaccountRefundCount.getCollectMoney()+bydAflPaccountRefundCount.getCollectMoney()); | |||
if (bydAflPaccountRefundCount.getNumberTotal() != null) { | |||
aflPaccountRefundCount.setCollectMoney(aflPaccountRefundCount.getCollectMoney() + bydAflPaccountRefundCount.getCollectMoney()); | |||
} | |||
} | |||
aflPaccountRefundCount.setId(UUID.randomUUID().toString().replace("-", "")); | |||
@@ -166,7 +180,8 @@ public class FssPaccountPayServiceImpl implements FssPaccountPayService { | |||
// 过滤掉没有// 过滤掉没有轮扣过的流水 | |||
continue; | |||
} | |||
billsVo = new VehicleAgreementNumBillsVo(bill.getPayId(), bill.getSceneTp(), bill.getReceiptAmt(), bill.getChargeTime()); | |||
billsVo = new VehicleAgreementNumBillsVo(bill.getPayId(), bill.getSceneTp(), bill.getReceiptAmt(), | |||
bill.getChargeTime()); | |||
// 处理车牌号、车牌颜色 | |||
if (!StringUtils.isEmpty(bill.getVehicleId()) && bill.getVehicleId().contains("_")) { | |||
final String[] vehicle = bill.getVehicleId().split("_"); | |||
@@ -192,4 +207,33 @@ public class FssPaccountPayServiceImpl implements FssPaccountPayService { | |||
} | |||
return billsVos; | |||
} | |||
@Override | |||
public FssPaccountPayResultFindByPayIdResponse findPaccountPayResultByPayId(String payId) throws ServiceHandleException { | |||
FssPaccountPay fssPaccountPay = paccountPayRepo.findByPayId(payId); | |||
if (fssPaccountPay == null) { | |||
throw UcServiceError.NOT_FOUND_DATA.toHandleException("未查询到数据"); | |||
} | |||
FssPaccountPayResultFindByPayIdResponse response = new FssPaccountPayResultFindByPayIdResponse(); | |||
BeanUtil.copyProperties(fssPaccountPay, response); | |||
response.setPayStatus(fssPaccountPay.getStatus()); | |||
// 请款中的数据,查看是否存在扣款失败原因 | |||
if (fssPaccountPay.getStatus().equals(2)) { | |||
final LocalDateTime firstInsertTime = wechatBillPayApplyRepo.getFirstInsertTime(payId); | |||
final WechatBillPayApply payApply = null == firstInsertTime ? | |||
null : wechatBillPayApplyRepo.findByPayIdAndInsertTime(payId, firstInsertTime); | |||
if (null != payApply) { | |||
response.setPayMsg(StringUtils.isEmpty(payApply.getErrCodeDes()) ? payApply.getResErrCodeDes() : | |||
payApply.getErrCodeDes()); | |||
} | |||
} | |||
//扣款成功,需返回微信支付订单号 | |||
if (fssPaccountPay.getStatus().equals(1) && StringUtils.isNotBlank(fssPaccountPay.getWxOrderId())) { | |||
WechatBillPaySuccess paySuccess = successRepo.findByOutTradeNo(fssPaccountPay.getWxOrderId()); | |||
if (null != paySuccess) { | |||
response.setTransactionId(paySuccess.getTransactionId()); | |||
} | |||
} | |||
return response; | |||
} | |||
} |
@@ -16,6 +16,24 @@ spring: | |||
max-wait: -1ms # 连接池最大阻塞等待时间(使用负值表示没有限制) | |||
max-idle: 50 # 连接池中的最大空闲连接 | |||
min-idle: 0 | |||
rabbitmq: | |||
host: 159.75.82.245 | |||
username: houyi | |||
password: houyi.. | |||
virtual-host: / | |||
port: 5672 | |||
#开启发送失败返回 | |||
publisher-returns: true | |||
#配置确认回调 | |||
publisher-confirm-type: correlated | |||
listener: | |||
simple: | |||
# 采用手动应答 | |||
acknowledge-mode: manual | |||
retry: | |||
# 是否支持重试 | |||
enabled: true | |||
datasource: | |||
druid: | |||
# 初始化大小,最小,最大 |
@@ -16,6 +16,18 @@ spring: | |||
max-wait: -1ms # 连接池最大阻塞等待时间(使用负值表示没有限制) | |||
max-idle: 50 # 连接池中的最大空闲连接 | |||
min-idle: 0 | |||
rabbitmq: | |||
host: ${MQ_SERVER:192.168.101.131} | |||
port: ${MQ_SERVER_PORT:5673} | |||
username: ${MQ_SERVER_NAME:qtzl_msg_query} | |||
password: ${MQ_SERVER_PWD:a448c2e71da14b34961Ee361B1687f1c} | |||
listener: | |||
simple: | |||
# 采用手动应答 | |||
acknowledge-mode: manual | |||
retry: | |||
# 是否支持重试 | |||
enabled: true | |||
datasource: | |||
druid: | |||
# 初始化大小,最小,最大 |
@@ -1,6 +1,6 @@ | |||
spring: | |||
profiles: | |||
active: prod | |||
active: dev | |||
# Redis数据源 | |||
# redis: | |||
# # Redis数据库索引(默认为0) |
@@ -7,8 +7,11 @@ import com.qtzl.alterSales.dao.entity.second.AflBydDashboard; | |||
import com.qtzl.alterSales.dao.repo.jpa.second.AflBydDashboardRepo; | |||
import com.qtzl.alterSales.dao.repo.jpa.third.EtcOrderVehicleInfoRepo; | |||
import com.qtzl.alterSales.manager.enums.AflBydDashboardPushStateEnum; | |||
import com.qtzl.alterSales.manager.handler.FssPaccountPayResultFindByPayIdHandler; | |||
import com.qtzl.alterSales.manager.model.protocol.sales.ChoiceBillsPayRequest; | |||
import com.qtzl.alterSales.manager.model.protocol.sales.FssPaccountPayResultFindByPayIdRequest; | |||
import com.qtzl.alterSales.manager.quartz.*; | |||
import com.qtzl.alterSales.manager.rabbit.RabbitUnifiedProduction; | |||
import com.qtzl.alterSales.manager.service.*; | |||
import com.qtzl.alterSales.manager.service.byd.BydService; | |||
import com.qtzl.alterSales.manager.service.byd.vo.BydDashBoardResponse; | |||
@@ -71,6 +74,12 @@ public class SaleTest { | |||
@Resource | |||
private ChoiceBillsOperationService choiceBillsOperationService; | |||
@Resource | |||
private RabbitUnifiedProduction rabbitUnifiedProduction; | |||
@Resource | |||
private FssPaccountPayResultFindByPayIdHandler fssPaccountPayResultFindByPayIdHandler; | |||
@Test | |||
public void djjjj() throws ServiceHandleException { | |||
final ChoiceBillsPayRequest request = new ChoiceBillsPayRequest(); | |||
@@ -158,5 +167,12 @@ public class SaleTest { | |||
System.out.println("====" + JSON.toJSONString(dataResult)); | |||
} | |||
@Test | |||
public void pushData() throws ServiceHandleException, JsonProcessingException { | |||
rabbitUnifiedProduction.delayFssPaccountpayPushQueue("116656285430005806001", 10000,0); | |||
FssPaccountPayResultFindByPayIdRequest request = new FssPaccountPayResultFindByPayIdRequest(); | |||
request.setPayId("2172649714248423833601"); | |||
String s = fssPaccountPayResultFindByPayIdHandler.handleInternal(null,request); | |||
System.out.println("===========" + s); | |||
} | |||
} |