mirror of
https://gitee.com/lab1024/smart-admin.git
synced 2025-11-22 18:36:52 +08:00
adding notify log
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
package net.lab1024.smartadmin.module.system.royalcanin.notify.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import net.lab1024.smartadmin.module.system.royalcanin.notify.model.NotifyEntity;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Mapper
|
||||
@Component
|
||||
public interface NotifyDao extends BaseMapper<NotifyEntity> {
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package net.lab1024.smartadmin.module.system.royalcanin.notify.model;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@TableName("t_royalcanin_notify_operate_log")
|
||||
public class NotifyEntity {
|
||||
|
||||
private String appId;
|
||||
|
||||
private String mchId;
|
||||
|
||||
private String sign;
|
||||
|
||||
private String resultCode;
|
||||
|
||||
private String errCode;
|
||||
|
||||
private String openid;
|
||||
|
||||
private String tradeType;
|
||||
|
||||
private String totalFee;
|
||||
|
||||
private String feeType;
|
||||
|
||||
private String outTradeNo;
|
||||
|
||||
private String timeEnd;
|
||||
|
||||
private String nonceStr;
|
||||
|
||||
private String remake;
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package net.lab1024.smartadmin.module.system.royalcanin.notify.service;
|
||||
|
||||
import net.lab1024.smartadmin.module.system.royalcanin.notify.dao.NotifyDao;
|
||||
import net.lab1024.smartadmin.module.system.royalcanin.notify.model.NotifyEntity;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class NotifyService {
|
||||
|
||||
@Autowired
|
||||
private NotifyDao notifyDao;
|
||||
|
||||
|
||||
public int insertProductCart(NotifyEntity notifyEntity){
|
||||
return notifyDao.insert(notifyEntity);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,9 @@
|
||||
package net.lab1024.smartadmin.module.system.wxpay;
|
||||
|
||||
import net.lab1024.smartadmin.module.system.royalcanin.domain.RoyalcaninOperateLogService;
|
||||
import net.lab1024.smartadmin.module.system.royalcanin.good.service.OrderService;
|
||||
import net.lab1024.smartadmin.module.system.royalcanin.notify.model.NotifyEntity;
|
||||
import net.lab1024.smartadmin.module.system.royalcanin.notify.service.NotifyService;
|
||||
import net.lab1024.smartadmin.module.system.royalcanin.orderMaster.AddOrSaveEntity;
|
||||
import net.lab1024.smartadmin.module.system.royalcanin.orderMaster.QueryEntity;
|
||||
import net.lab1024.smartadmin.module.system.wxpay.sdk.WXPay;
|
||||
@@ -33,6 +36,10 @@ public class WxpayService {
|
||||
@Autowired
|
||||
private OrderService orderService;
|
||||
|
||||
@Autowired
|
||||
private NotifyService notifyService;
|
||||
|
||||
|
||||
public String generateQRCode(WxPayEntity wxPayEntity) throws Exception {
|
||||
WXPay wxpay = new WXPay(config);
|
||||
InetAddress ip4 = Inet4Address.getLocalHost();
|
||||
@@ -73,12 +80,26 @@ public class WxpayService {
|
||||
Map<String, String> callBackMap = WXPayUtil.xmlToMap(stringBuffer.toString());
|
||||
SortedMap<String, String> sortedMap = WXPayUtil.getSortedMap(callBackMap);
|
||||
// 校验签名是否正确
|
||||
if (WXPayUtil.isCorrectSign(sortedMap, config.getKey())) {
|
||||
if (!WXPayUtil.isCorrectSign(sortedMap, config.getKey())) {
|
||||
System.out.println("签名校验成功!");
|
||||
// 更新订单状态
|
||||
if ("SUCCESS".equals(sortedMap.get("result_code"))) {
|
||||
String outTradeNo = sortedMap.get("out_trade_no"); // 流水号
|
||||
String totalFee = sortedMap.get("total_fee"); // 交易金额
|
||||
|
||||
NotifyEntity notifyEntity = new NotifyEntity();
|
||||
notifyEntity.setAppId(sortedMap.get("appid"));
|
||||
notifyEntity.setMchId(sortedMap.get("mch_id"));
|
||||
notifyEntity.setSign(sortedMap.get("sign"));
|
||||
notifyEntity.setResultCode(sortedMap.get("return_code"));
|
||||
notifyEntity.setOpenid(sortedMap.get("openid"));
|
||||
notifyEntity.setOutTradeNo(outTradeNo);
|
||||
notifyEntity.setTotalFee(totalFee);
|
||||
notifyEntity.setTimeEnd(sortedMap.get("time_end"));
|
||||
notifyEntity.setTradeType(sortedMap.get("trade_type"));
|
||||
notifyEntity.setFeeType(sortedMap.get("fee_type"));
|
||||
notifyEntity.setNonceStr(sortedMap.get("nonce_str"));
|
||||
notifyService.insertProductCart(notifyEntity);
|
||||
if (orderService.afterPaySucceedUpdateOrderStatus(outTradeNo,totalFee)) {
|
||||
response.setContentType("text/xml");
|
||||
response.setContentType("content-type");
|
||||
|
||||
Reference in New Issue
Block a user