mirror of
https://gitee.com/lab1024/smart-admin.git
synced 2025-11-22 18:36:52 +08:00
搞定了,后台更新了以下几点:
1:getCartProductInfo 新增了“leftAllotment”字段 2:insertCartProductInfo 新增了“leftAllotment”字段 3:generateOrderWX 入参新增了“basePoint” 4:updateOrderWX微信回调方法,新增了自动增加该账户积分信息。
This commit is contained in:
@@ -48,6 +48,7 @@ public class OrderController {
|
||||
@Autowired
|
||||
private CartService cartService;
|
||||
|
||||
|
||||
@ApiOperation(value = "微信支付订单", notes = "生成订单")
|
||||
@PostMapping("royalcanin/generateOrderWX")
|
||||
public ResponseDTO<String> generateOrderWX(@RequestBody List<OrdersEntity> ordersEntityList) throws Exception {
|
||||
@@ -57,6 +58,7 @@ public class OrderController {
|
||||
String mobile = "";
|
||||
int buyCount = 0;
|
||||
double total_fee = 0 ;
|
||||
double basePoint = 0 ;
|
||||
WxPayEntity wxPayEntity = new WxPayEntity();
|
||||
JSONArray orderDatilListJson = new JSONArray();
|
||||
OrdersEntity ordersEntity = new OrdersEntity();
|
||||
@@ -79,6 +81,7 @@ public class OrderController {
|
||||
}else{
|
||||
total_fee = total_fee + Double.parseDouble(ordersEntitys.getPayAmount()) * ordersEntitys.getBuyCount() ;
|
||||
}
|
||||
basePoint = basePoint + ordersEntitys.getBasePoint();
|
||||
orderAddress.setAddressCityName(ordersEntitys.getOrderAddress().getAddressCityName());
|
||||
orderAddress.setAddressCountyName(ordersEntitys.getOrderAddress().getAddressCountyName());
|
||||
orderAddress.setAddressDetailInfo(ordersEntitys.getOrderAddress().getAddressDetailInfo());
|
||||
@@ -100,6 +103,7 @@ public class OrderController {
|
||||
ordersEntity.setBuyCount(buyCount);
|
||||
ordersEntity.setOrderNo(GenerateSequenceUtil.generateSequenceNo());
|
||||
ordersEntity.setOrderStatus("0");
|
||||
ordersEntity.setBasePoint(basePoint);
|
||||
|
||||
if(orderService.generateOrder(ordersEntity,orderDatilListJson) == 1){
|
||||
wxPayEntity.setProduct_id(ordersEntity.getProductCode());
|
||||
|
||||
@@ -25,4 +25,6 @@ public class CartEntity {
|
||||
|
||||
private String mobile;
|
||||
|
||||
private int leftAllotment;
|
||||
|
||||
}
|
||||
|
||||
@@ -41,5 +41,5 @@ public class OrderEntity {
|
||||
|
||||
private String payType="1";
|
||||
|
||||
|
||||
private String basePoint;
|
||||
}
|
||||
|
||||
@@ -41,4 +41,6 @@ public class OrdersEntity {
|
||||
|
||||
private OrderAddress orderAddress;
|
||||
|
||||
private Double basePoint;
|
||||
|
||||
}
|
||||
|
||||
@@ -21,17 +21,17 @@ public class MemberAccountChangeEntity {
|
||||
/**
|
||||
* 会员ID
|
||||
*/
|
||||
private int memberId;
|
||||
private String memberId;
|
||||
|
||||
/**
|
||||
* 积分变更类型
|
||||
*/
|
||||
private int changeTypeId;
|
||||
private String changeTypeId;
|
||||
|
||||
/**
|
||||
* 积分增加/减少数量
|
||||
*/
|
||||
private BigDecimal changeValue;
|
||||
private String changeValue;
|
||||
|
||||
/**
|
||||
* 积分明细
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
package net.lab1024.smartadmin.module.system.wxpay;
|
||||
|
||||
import net.lab1024.smartadmin.module.system.royalcanin.domain.RoyalcaninOperateLogService;
|
||||
import net.lab1024.smartadmin.module.system.royalcanin.MemberAccountService;
|
||||
import net.lab1024.smartadmin.module.system.royalcanin.good.model.OrderEntity;
|
||||
import net.lab1024.smartadmin.module.system.royalcanin.good.service.OrderService;
|
||||
import net.lab1024.smartadmin.module.system.royalcanin.memberAccount.MemberAccountChangeEntity;
|
||||
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;
|
||||
import net.lab1024.smartadmin.module.system.wxpay.sdk.WXPayUtil;
|
||||
@@ -40,6 +41,12 @@ public class WxpayService {
|
||||
private NotifyService notifyService;
|
||||
|
||||
|
||||
@Autowired
|
||||
private MemberAccountService memberAccountService;
|
||||
|
||||
|
||||
|
||||
|
||||
public String generateQRCode(WxPayEntity wxPayEntity) throws Exception {
|
||||
WXPay wxpay = new WXPay(config);
|
||||
InetAddress ip4 = Inet4Address.getLocalHost();
|
||||
@@ -86,6 +93,13 @@ public class WxpayService {
|
||||
if ("SUCCESS".equals(sortedMap.get("result_code"))) {
|
||||
String outTradeNo = sortedMap.get("out_trade_no"); // 流水号
|
||||
String totalFee = sortedMap.get("total_fee"); // 交易金额
|
||||
OrderEntity orderEntity = orderService.findByOrderId(outTradeNo);
|
||||
MemberAccountChangeEntity memberAccountChangeEntity = new MemberAccountChangeEntity();
|
||||
memberAccountChangeEntity.setChangeTypeId("1");
|
||||
memberAccountChangeEntity.setChangeValue(orderEntity.getBasePoint());
|
||||
memberAccountChangeEntity.setMemberId(orderEntity.getMemberId());
|
||||
memberAccountService.memberAccountChange(memberAccountChangeEntity);
|
||||
|
||||
|
||||
NotifyEntity notifyEntity = new NotifyEntity();
|
||||
notifyEntity.setAppId(sortedMap.get("appid"));
|
||||
|
||||
@@ -78,7 +78,8 @@ public class SmartJWTUtil {
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
String token = SmartJWTUtil.generateToken("844350");
|
||||
String token = SmartJWTUtil.generateToken("884234");
|
||||
System.out.println(token);
|
||||
System.out.println(SmartJWTUtil.decodeToken(token));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user