!88 2022-1-23 Carl

Merge pull request !88 from Admin/sit-Carl-V3
This commit is contained in:
Admin 2022-01-23 10:27:45 +00:00 committed by Gitee
commit 64e16eb673
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
10 changed files with 53 additions and 4 deletions

View File

@ -179,6 +179,8 @@ public class GoodController {
} else { } else {
int buyCountTotal = cartEntity.getBuyCount() + cartEntityFromDB.getBuyCount(); int buyCountTotal = cartEntity.getBuyCount() + cartEntityFromDB.getBuyCount();
cartEntityFromDB.setBuyCount(buyCountTotal); cartEntityFromDB.setBuyCount(buyCountTotal);
cartEntityFromDB.setBasePoint(cartEntity.getBasePoint());
cartEntityFromDB.setLeftAllotment(cartEntity.getLeftAllotment());
if (1 == cartService.updateInfo(cartEntityFromDB)) if (1 == cartService.updateInfo(cartEntityFromDB))
return ResponseDTO.succ(); return ResponseDTO.succ();
else else

View File

@ -212,6 +212,15 @@ public class OrderController {
wxpayService.orderCallBack(request,response); wxpayService.orderCallBack(request,response);
} }
@ApiOperation(value = "监听微信回调", notes = "监听微信回调")
@PostMapping(value = "royalcanin/monitorOrderNotify")
public ResponseDTO<String> monitorOrderNotify(@RequestParam String OrderNumber){
if ( 1 == orderService.checkNotify(OrderNumber))
return ResponseDTO.succMsg("SUCCESS");
else
return ResponseDTO.wrap(OrderResponseCodeConst.NOTIFY_ERROR);
}
@ApiOperation(value = "支付宝更新订单", notes = "支付宝更新订单") @ApiOperation(value = "支付宝更新订单", notes = "支付宝更新订单")
@RequestMapping(value = "royalcanin/updateOrderAlipay") @RequestMapping(value = "royalcanin/updateOrderAlipay")
public void updateOrderAlipay(HttpServletRequest request, HttpServletResponse response){ public void updateOrderAlipay(HttpServletRequest request, HttpServletResponse response){

View File

@ -12,8 +12,6 @@ public class OrderResponseCodeConst extends ResponseCodeConst {
public static final OrderResponseCodeConst GENERATE_FAIL = new OrderResponseCodeConst(9003, "数据生成失败!"); public static final OrderResponseCodeConst GENERATE_FAIL = new OrderResponseCodeConst(9003, "数据生成失败!");
public static final OrderResponseCodeConst CANCEL_FAIL = new OrderResponseCodeConst(9004, "数据删除失败!");
public static final OrderResponseCodeConst SMS_FAIL = new OrderResponseCodeConst(9005, " 短信校验失败!"); public static final OrderResponseCodeConst SMS_FAIL = new OrderResponseCodeConst(9005, " 短信校验失败!");
public static final OrderResponseCodeConst SMS_OVERTIME = new OrderResponseCodeConst(9006, "短信校验超时!"); public static final OrderResponseCodeConst SMS_OVERTIME = new OrderResponseCodeConst(9006, "短信校验超时!");
@ -22,6 +20,10 @@ public class OrderResponseCodeConst extends ResponseCodeConst {
public static final OrderResponseCodeConst GENERATE_ORDER_ERROR = new OrderResponseCodeConst(9008, "该订单数据有误,请联系管理员!"); public static final OrderResponseCodeConst GENERATE_ORDER_ERROR = new OrderResponseCodeConst(9008, "该订单数据有误,请联系管理员!");
public static final OrderResponseCodeConst NOTIFY_ERROR = new OrderResponseCodeConst(9009, "没有该订单回调数据!");
public OrderResponseCodeConst(int code, String msg) { public OrderResponseCodeConst(int code, String msg) {
super(code, msg); super(code, msg);
} }

View File

@ -27,4 +27,7 @@ public class CartEntity {
private int leftAllotment; private int leftAllotment;
private int basePoint;
} }

View File

@ -15,6 +15,7 @@ import net.lab1024.smartadmin.module.system.royalcanin.good.dao.OrdersDao;
import net.lab1024.smartadmin.module.system.royalcanin.good.model.OrderAddress; import net.lab1024.smartadmin.module.system.royalcanin.good.model.OrderAddress;
import net.lab1024.smartadmin.module.system.royalcanin.good.model.OrderEntity; import net.lab1024.smartadmin.module.system.royalcanin.good.model.OrderEntity;
import net.lab1024.smartadmin.module.system.royalcanin.good.model.OrdersEntity; import net.lab1024.smartadmin.module.system.royalcanin.good.model.OrdersEntity;
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.AddOrSaveEntity;
import net.lab1024.smartadmin.module.system.royalcanin.orderMaster.OrderCouponEntity; import net.lab1024.smartadmin.module.system.royalcanin.orderMaster.OrderCouponEntity;
import net.lab1024.smartadmin.module.system.royalcanin.orderMaster.QueryEntity; import net.lab1024.smartadmin.module.system.royalcanin.orderMaster.QueryEntity;
@ -42,6 +43,9 @@ public class OrderService {
@Autowired @Autowired
private OrdersDao ordersDao; private OrdersDao ordersDao;
@Autowired
private NotifyService notifyService;
private String url = "https://miniapp-test.royalcanin.com.cn/rcmini/h5/orderMaster/"; private String url = "https://miniapp-test.royalcanin.com.cn/rcmini/h5/orderMaster/";
@Transactional @Transactional
@ -99,6 +103,13 @@ public class OrderService {
} }
} }
public int checkNotify(String orderNumber){
if(notifyService.findNotifyByOrderNumber(orderNumber) != null)
return 1;
else
return 0;
}
public Boolean afterPaySucceedUpdateOrderStatus(String outTradeNo,String totalFee){ public Boolean afterPaySucceedUpdateOrderStatus(String outTradeNo,String totalFee){
int result = ordersDao.updateOrderStatus(outTradeNo,totalFee); int result = ordersDao.updateOrderStatus(outTradeNo,totalFee);

View File

@ -3,9 +3,13 @@ package net.lab1024.smartadmin.module.system.royalcanin.notify.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import net.lab1024.smartadmin.module.system.royalcanin.notify.model.NotifyEntity; import net.lab1024.smartadmin.module.system.royalcanin.notify.model.NotifyEntity;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@Mapper @Mapper
@Component @Component
public interface NotifyDao extends BaseMapper<NotifyEntity> { public interface NotifyDao extends BaseMapper<NotifyEntity> {
NotifyEntity findNotifyByOrderNumber(@Param("orderNumber")String orderNumber);
} }

View File

@ -12,7 +12,12 @@ public class NotifyService {
private NotifyDao notifyDao; private NotifyDao notifyDao;
public int insertProductCart(NotifyEntity notifyEntity){ public int insertNotify(NotifyEntity notifyEntity){
return notifyDao.insert(notifyEntity); return notifyDao.insert(notifyEntity);
} }
public NotifyEntity findNotifyByOrderNumber(String orderNumber){
return notifyDao.findNotifyByOrderNumber(orderNumber);
}
} }

View File

@ -113,7 +113,7 @@ public class WxpayService {
notifyEntity.setTradeType(sortedMap.get("trade_type")); notifyEntity.setTradeType(sortedMap.get("trade_type"));
notifyEntity.setFeeType(sortedMap.get("fee_type")); notifyEntity.setFeeType(sortedMap.get("fee_type"));
notifyEntity.setNonceStr(sortedMap.get("nonce_str")); notifyEntity.setNonceStr(sortedMap.get("nonce_str"));
notifyService.insertProductCart(notifyEntity); notifyService.insertNotify(notifyEntity);
if (orderService.afterPaySucceedUpdateOrderStatus(outTradeNo,totalFee)) { if (orderService.afterPaySucceedUpdateOrderStatus(outTradeNo,totalFee)) {
response.setContentType("text/xml"); response.setContentType("text/xml");
response.setContentType("content-type"); response.setContentType("content-type");

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="net.lab1024.smartadmin.module.system.royalcanin.notify.dao.NotifyDao">
<resultMap id="NotifyEntity"
type="net.lab1024.smartadmin.module.system.royalcanin.notify.model.NotifyEntity"></resultMap>
<select id="findNotifyByOrderNumber" resultMap="NotifyEntity">
select result_code from t_royalcanin_notify_operate_log WHERE out_trade_no = #{orderNumber}
</select>
</mapper>

View File

@ -1656,6 +1656,7 @@ CREATE TABLE IF NOT EXISTS `t_royalcanin_cart` (
`specifications` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `specifications` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`buy_count` int(20) DEFAULT NULL, `buy_count` int(20) DEFAULT NULL,
`left_allotment` int(20) DEFAULT NULL, `left_allotment` int(20) DEFAULT NULL,
`base_point` int(20) DEFAULT NULL,
`member_id` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `member_id` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`mobile` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `mobile` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,