diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/controller/FyPayController.java b/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/controller/FyPayController.java index f230e517d..e439a5794 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/controller/FyPayController.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/controller/FyPayController.java @@ -4,6 +4,10 @@ import com.fuint.api.fuyou.service.FyPayService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.Enumeration; +import java.util.HashMap; import java.util.Map; @RestController @@ -37,6 +41,26 @@ public class FyPayController { return map; } + // 接收支付平台异步通知的接口 + @PostMapping("/notify") + public String notifyUrl(@RequestBody HttpServletRequest request,@RequestBody HttpServletResponse response) { + System.out.println(request+"111"); + System.out.println(response+"222"); +// Map paramMap = new HashMap<>(); +// Enumeration parameterNames = request.getParameterNames(); +// while(parameterNames.hasMoreElements()) { +// String parameterName = (String) parameterNames.nextElement(); +// paramMap.put(parameterName, request.getParameter(parameterName)); +// } +// boolean isSuccess = processNotify(paramMap); // 处理支付结果并返回成功或失败状态 +// if(isSuccess) { +// return "success"; // 返回成功状态,通知支付平台异步通知已成功接收 +// } else { +// return "fail"; // 返回失败状态,通知支付平台异步通知已失败 +// } + return "11111111"; + } + /** * 退款 成功 result_msg 显示success * result_code显示000000 diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/entity/Builder.java b/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/entity/Builder.java index 5bf01f022..b404a03e3 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/entity/Builder.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/entity/Builder.java @@ -38,7 +38,7 @@ public class Builder { Calendar calendar = Calendar.getInstance(); // sdf_no.format(calendar.getTime()) + (int) (random.nextDouble() * 100000) map.put("mchnt_order_no", ""); - map.put("curr_type", ""); + map.put("curr_type", "CNY"); map.put("order_amt", "1"); map.put("term_ip", Const.term_ip); SimpleDateFormat sdf_ts = new SimpleDateFormat("yyyyMMddHHmmss"); @@ -71,6 +71,49 @@ public class Builder { return map; } + /** + * 小程序 + * + * @return + */ + public static Map buildFuiou23() { + Map map = new HashMap<>(); + + map.put("version", Const.version); + map.put("ins_cd", Const.ins_cd); + map.put("mchnt_cd", Const.mchnt_cd); + map.put("term_id", Const.term_id); + map.put("random_str", randomNumberGenerator.nextBytes().toHex()); + map.put("sign", ""); + map.put("goods_des", Const.goods_des); + map.put("goods_detail", ""); + map.put("goods_tag", ""); + map.put("product_id", ""); + map.put("addn_inf", ""); + map.put("mchnt_order_no", ""); + map.put("curr_type", "CNY"); + map.put("openid", ""); + map.put("order_amt", "1"); + map.put("term_ip", Const.term_ip); + Calendar calendar = Calendar.getInstance(); + SimpleDateFormat sdf_ts = new SimpleDateFormat("yyyyMMddHHmmss"); + map.put("txn_begin_ts",sdf_ts.format(calendar.getTime())); + map.put("notify_url", Const.notify_url); + map.put("limit_pay", ""); + map.put("trade_type", Const.trade_type); + map.put("sub_openid", ""); + map.put("sub_appid", Const.sub_appid); + map.put("reserved_expire_minute", "1"); + map.put("reserved_fy_term_id", ""); + map.put("reserved_fy_term_type", ""); + map.put("reserved_txn_bonus", ""); + map.put("reserved_fy_term_sn", ""); + map.put("reserved_device_info", ""); + + return map; + } + + /** * 退款 * diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/entity/Const.java b/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/entity/Const.java index c013fb352..8fadcc7fb 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/entity/Const.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/entity/Const.java @@ -35,18 +35,23 @@ public class Const { public static String auth_code = ""; // 交易关闭时间 public static Integer reserved_expire_minute = 1; +// 小程序appid + public static String sub_appid = "wxba517a9bac38fe92"; +// 订单类型 小程序等 + public static String trade_type = "LETPAY"; //机构公钥 public static String INS_PUBLIC_KEY=""; //异步通知(回调地址) +// public static String notify_url = "https://www.fuint.cn/fuint-application/clientApi/pay/aliPayCallback"; public static String notify_url = "http://www.wrx.cn"; //下单 public static String fuiou_21_url = "https://fundwx.fuiou.com/preCreate"; //扫码 public static String fuiou_22_url = "https://fundwx.fuiou.com/micropay"; - //公众号/服务窗统一下单 + //公众号/服务窗/小程序统一下单 public static String fuiou_23_url = "https://fundwx.fuiou.com/wxPreCreate"; //退款 public static String fuiou_24_url = "https://fundwx.fuiou.com/commonRefund"; diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/service/FyPayService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/service/FyPayService.java index a06d749f6..d458fbeb0 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/service/FyPayService.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/service/FyPayService.java @@ -17,6 +17,13 @@ public interface FyPayService { */ public Map queryOrder(Map map) throws Exception; + /** + * 小程序 + * @return + * @throws Exception + */ + public Map applet(Map map) throws Exception; + /** * 退款 * @return diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/service/impl/FyPayServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/service/impl/FyPayServiceImpl.java index 8f3987ba9..2cb16708a 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/service/impl/FyPayServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/service/impl/FyPayServiceImpl.java @@ -11,6 +11,7 @@ import com.fuint.api.fuyou.entity.MerchantConfig; import com.fuint.api.fuyou.entity.Message; import com.fuint.api.fuyou.service.FyPayService; import com.fuint.api.fuyou.service.MerchantConfigService; +import com.fuint.api.fuyou.util.HttpUtils; import com.fuint.api.fuyou.util.Utils; import com.fuint.business.integral.service.IntegralOrdersService; import com.fuint.business.marketingActivity.cardFavorable.entity.CardFavorableRecord; @@ -19,14 +20,16 @@ import com.fuint.business.marketingActivity.cardFule.service.CardFuelRecordServi import com.fuint.business.marketingActivity.cardValue.service.CardValueRecordService; import com.fuint.business.order.entity.*; import com.fuint.business.order.service.*; -import com.fuint.common.dto.AccountInfo; -import com.fuint.common.util.TokenUtil; -import io.swagger.models.auth.In; import lombok.extern.slf4j.Slf4j; +import org.dom4j.Document; +import org.dom4j.DocumentHelper; +import org.dom4j.Element; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.net.URLDecoder; import javax.annotation.Resource; +import java.net.URLEncoder; import java.util.*; @Service @@ -297,6 +300,45 @@ public class FyPayServiceImpl implements FyPayService { return resMap; } + @Override + public Map applet(Map map1) throws Exception { + String publicKey = map1.get("publicKey"); + String privateKey = map1.get("privateKey"); + Const.INS_PUBLIC_KEY = publicKey; + Const.INS_PRIVATE_KEY = privateKey; + String orderNo = map1.get("orderNo"); + String payType = "WECHAT"; + String allAmount = map1.get("allAmount"); + String insCd = map1.get("insCd"); + String mchntCd = map1.get("mchntCd"); + String goodsDes = map1.get("goodsDes"); + Map map = Builder.buildFuiou23(); + map.put("mchnt_order_no",orderNo); + map.put("order_type",payType); + map.put("order_amt", allAmount); + map.put("ins_cd", insCd); + map.put("mchnt_cd", mchntCd); + map.put("goods_des", goodsDes); + map.put("openid", map1.get("openId")); + + // 请求报文 + String reqBody = Message.requestMsg(map); +// 响应报文 + String rspXml = Message.responseMsg(reqBody,Const.fuiou_23_url); + System.out.println("1+"+reqBody); + System.out.println("2+"+rspXml); + //响应报文验签 + Map resMap = Utils.xmlStr2Map(rspXml); + + String str = resMap.get("sign"); + if (Utils.verifySign(resMap, str)){ + + } + System.out.println(resMap); + + return resMap; + } + @Override public Map refund(Map map1) throws Exception { String orderNo = map1.get("orderNo"); diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/util/HttpUtils.java b/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/util/HttpUtils.java new file mode 100644 index 000000000..99a9a57dd --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/util/HttpUtils.java @@ -0,0 +1,79 @@ +package com.fuint.api.fuyou.util; + +import com.fuint.api.fuyou.entity.Const; +import org.apache.http.HttpEntity; +import org.apache.http.NameValuePair; +import org.apache.http.client.ClientProtocolException; +import org.apache.http.client.entity.UrlEncodedFormEntity; +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClients; +import org.apache.http.message.BasicNameValuePair; +import org.apache.http.util.EntityUtils; + +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +public class HttpUtils { + + /** + * 发送 post请求访问本地应用并根据传递参数不同返回不同结果 + */ + public void post(String url, Map map, StringBuffer result) { + // 创建默认的httpClient实例. + CloseableHttpClient httpclient = HttpClients.createDefault(); + // 创建httppost + HttpPost httppost = new HttpPost(url); + // 创建参数队列 + List formparams = new ArrayList<>(); + + Iterator it=map.keySet().iterator(); + while(it.hasNext()){ + String key; + String value; + key=it.next().toString(); + value=map.get(key); + + formparams.add(new BasicNameValuePair(key, value)); + } + + UrlEncodedFormEntity uefEntity; + try { + uefEntity = new UrlEncodedFormEntity(formparams, Const.charset); + httppost.setEntity(uefEntity); + + System.out.println("提交请求 " + httppost.getURI()); + CloseableHttpResponse response = httpclient.execute(httppost); + try { + HttpEntity entity = response.getEntity(); + + if (entity != null && result != null) { + result.append(EntityUtils.toString(entity, Const.charset)); + } + + // 打印响应状态 + System.out.println(response.getStatusLine()); + } finally { + response.close(); + } + } catch (ClientProtocolException e) { + e.printStackTrace(); + } catch (UnsupportedEncodingException e1) { + e1.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } finally { + // 关闭连接,释放资源 + try { + httpclient.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } +} \ No newline at end of file diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/api/rocketMQ/test/SyncProducer.java b/fuintBackend/fuint-application/src/main/java/com/fuint/api/rocketMQ/test/SyncProducer.java new file mode 100644 index 000000000..3d5ff2b58 --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/api/rocketMQ/test/SyncProducer.java @@ -0,0 +1,48 @@ +package com.fuint.api.rocketMQ.test; + +import org.apache.rocketmq.client.producer.DefaultMQProducer; +import org.apache.rocketmq.client.producer.SendResult; +import org.apache.rocketmq.client.producer.SendStatus; +import org.apache.rocketmq.common.message.Message; + +import java.util.concurrent.TimeUnit; + +/** + * 发送同步消息 + */ +public class SyncProducer { + + public static void main(String[] args) throws Exception { + //1.创建消息生产者producer,并制定生产者组名 + DefaultMQProducer producer = new DefaultMQProducer("group1"); + //2.指定Nameserver地址 + producer.setNamesrvAddr("39.104.58.101:9876"); + //3.启动producer + producer.start(); + + for (int i = 0; i < 10; i++) { + //4.创建消息对象,指定主题Topic、Tag和消息体 + /** + * 参数一:消息主题Topic + * 参数二:消息Tag + * 参数三:消息内容 + */ + Message msg = new Message("springboot-mq", "Tag1", ("Hello World" + i).getBytes()); + //5.发送消息 + SendResult result = producer.send(msg); + //发送状态 + SendStatus status = result.getSendStatus(); + + System.out.println("发送结果:" + result); + + //线程睡1秒 + TimeUnit.SECONDS.sleep(1); + } + + //6.关闭生产者producer + producer.shutdown(); + + } +} + + diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/controller/OilOrderController.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/controller/OilOrderController.java index 37a147b08..247b0385c 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/controller/OilOrderController.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/controller/OilOrderController.java @@ -74,6 +74,17 @@ public class OilOrderController extends BaseController { return getSuccessResult(order); } + /** + * 小程序支付接口 + * @param map + * @return + */ + @PostMapping("/appletPay") + public ResponseObject appletPay(@Validated @RequestBody Map map){ + orderService.appletPay(map); + return getSuccessResult("success"); + } + /** * 根据订单号查询订单信息 * @param map diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/entity/OilOrder.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/entity/OilOrder.java index fda551f4e..4e02d0665 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/entity/OilOrder.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/entity/OilOrder.java @@ -1,6 +1,7 @@ package com.fuint.business.order.entity; import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import com.fuint.framework.entity.BaseEntity; @@ -117,6 +118,10 @@ public class OilOrder extends BaseEntity implements Serializable { * 订单备注 */ private String remark; - + /** + * 油罐id + */ + @TableField(exist = false) + private Integer tankId; } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/OilOrderService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/OilOrderService.java index 29909d116..b9c19bf5b 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/OilOrderService.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/OilOrderService.java @@ -72,6 +72,12 @@ public interface OilOrderService extends IService { */ public String addOilOrder(OilOrder oilOrder); + /** + * 小程序订单支付 + * @param map + */ + public void appletPay(Map map); + /** * 添加油品跟踪信息 * @param oilOrder @@ -79,6 +85,13 @@ public interface OilOrderService extends IService { */ public void addOilTrack(JSONObject oilOrder, Integer storeId); + /** + * 添加油品跟踪信息 + * @param oilOrder + * @param storeId + */ + public void addOilTracks(OilOrder oilOrder,Integer storeId); + /** * 添加油品订单信息 * @param order diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/impl/OilOrderServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/impl/OilOrderServiceImpl.java index b470312ce..1d1782265 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/impl/OilOrderServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/impl/OilOrderServiceImpl.java @@ -18,11 +18,15 @@ import com.fuint.business.order.mapper.OilOrderMapper; import com.fuint.business.order.service.*; import com.fuint.business.order.vo.OilOrderVo; import com.fuint.business.petrolStationManagement.entity.OilName; +import com.fuint.business.petrolStationManagement.entity.OilNumber; import com.fuint.business.petrolStationManagement.entity.OilTank; import com.fuint.business.petrolStationManagement.entity.OilTracking; import com.fuint.business.petrolStationManagement.service.OilNameService; +import com.fuint.business.petrolStationManagement.service.OilNumberService; import com.fuint.business.petrolStationManagement.service.OilTankService; import com.fuint.business.petrolStationManagement.service.OilTrackingService; +import com.fuint.business.storeInformation.entity.LJStore; +import com.fuint.business.storeInformation.service.ILJStoreService; import com.fuint.business.userManager.entity.LJUser; import com.fuint.business.userManager.entity.LJUserGrade; import com.fuint.business.userManager.entity.UserBalance; @@ -146,7 +150,7 @@ public class OilOrderServiceImpl extends ServiceImpl i // 会员id userId = Integer.valueOf(map.get("userId")); - this.insertCardBalance(consumeAmount,userId); + this.insertCardBalance(consumeAmount,userId,storeId); } // 优惠券id Integer couponId = null; @@ -271,7 +275,7 @@ public class OilOrderServiceImpl extends ServiceImpl i } if (userId!=null){ - this.updateGrowthValue(oilActualPay, userId, Integer.valueOf(jsonObjects.get(i).get("oilName").toString()),refuelMoney); + this.updateGrowthValue(oilActualPay, userId, Integer.valueOf(jsonObjects.get(i).get("oilName").toString()),refuelMoney,storeId); } order.setStoreId(storeId); order.setUserId(userId); @@ -378,6 +382,64 @@ public class OilOrderServiceImpl extends ServiceImpl i return orderNo; } + @Override + public void appletPay(Map map) { + String orderNo = map.get("orderNo"); +// 支付金额 + Integer payAmount = (int) (Double.valueOf(map.get("payAmount"))*100); +// 优惠金额 + String discountAmount = map.get("discountAmount"); +// 囤油卡消费后的信息 + String oilCardAmount = map.get("oilCardAmount"); +// 储值卡消费金额 + String balanceAmount = map.get("balanceAmount"); + Integer tankId = Integer.valueOf(map.get("tankId")); + +// 根据订单号查询订单信息 + OilOrder oilOrder = this.selectOilOrderByOrderNo(orderNo); + oilOrder.setTankId(tankId); + if (!map.get("payAmount").equals("0")) { +// 调用支付接口 +// 判断是否开启支付规则 + List list = merchantConfigService.selectMeChByIsOpen(); + if (list.size() > 0) { + oilConfigService.oilRule(); + } + // 根据店铺id查询商户配置信息 + MerchantConfig merchantConfig = merchantConfigService.selectMeChByIsUse("1"); + LJUserVo userVo = userService.selectUserById(oilOrder.getUserId()); + // 处理支付需要的数据 + Map map1 = new HashMap<>(); + map1.put("allAmount", payAmount.toString()); + map1.put("orderNo", oilOrder.getOrderNo()); + map1.put("insCd", merchantConfig.getInsCd()); + map1.put("mchntCd", merchantConfig.getMchntCd()); + map1.put("goodsDes", oilOrder.getOils() + oilOrder.getOilGunNum()); + map1.put("publicKey", merchantConfig.getPublicKey()); + map1.put("privateKey", merchantConfig.getPrivateKey()); + map1.put("discountAmount", discountAmount); + map1.put("oilCardAmount", oilCardAmount); + map1.put("balanceAmount", balanceAmount); + map1.put("openId", userVo.getOpenId()); + + // 调用支付接口 + try { + fyPayService.applet(map1); + } catch (Exception e) { + e.printStackTrace(); + } + }else { + this.updateGrowthValue(Double.valueOf(payAmount),oilOrder.getUserId(), Integer.valueOf(oilOrder.getOils()),oilCardAmount,oilOrder.getStoreId()); + this.addOilTracks(oilOrder,oilOrder.getStoreId()); + this.insertCardBalance(Double.valueOf(balanceAmount),oilOrder.getUserId(),oilOrder.getStoreId()); + oilOrder.setPayAmount(Double.valueOf(payAmount)); + oilOrder.setDiscountAmount(Double.valueOf(discountAmount)); + oilOrder.setPayTime(new Date()); + oilOrder.setOrderStatus("paid"); + baseMapper.updateById(oilOrder); + } + } + @Autowired private OilTankService oilTankService; @Autowired @@ -411,6 +473,32 @@ public class OilOrderServiceImpl extends ServiceImpl i oilTankService.update(oilTank); } + /** + * 添加油品库存跟踪信息 + * @param oilOrder + */ + @Override + public void addOilTracks(OilOrder oilOrder,Integer storeId){ + OilTank oilTank = oilTankService.queryById(oilOrder.getTankId()); +// 添加库存跟踪信息 + OilTracking oilTracking = new OilTracking(); + oilTracking.setDocument("油品出售"); + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss"); + String timestamp = dateFormat.format(new Date()); + String randomString = UUID.randomUUID().toString().replace("-","").substring(0,6); + oilTracking.setOrderNumber(timestamp+randomString); + + oilTracking.setQuantityChange(-oilOrder.getOilNum()); + oilTracking.setStoreId(storeId); + oilTracking.setTankId(oilOrder.getTankId()); + oilTrackingService.insert(oilTracking); + +// 修改油罐容量 + Double storedQuantity = oilTank.getStoredQuantity(); + oilTank.setStoredQuantity(storedQuantity-oilOrder.getOilNum()); + oilTankService.update(oilTank); + } + @Override public int updateOilOrder(OilOrder order) { int row = baseMapper.updateById(order); @@ -423,19 +511,21 @@ public class OilOrderServiceImpl extends ServiceImpl i private LJUserService userService; @Autowired private LJUserGradeService userGradeService; + @Autowired + private ILJStoreService storeService; /** * 修改用户成长值信息 */ - private void updateGrowthValue(Double oilActualPay,Integer userid,Integer oilId,String refuelMoney){ + private void updateGrowthValue(Double oilActualPay,Integer userid,Integer oilId,String refuelMoney,Integer storeId){ if (oilId!=null){ OilName oilName = oilNameService.selectOilNameById(oilId); // 获取成长值增长数值 Integer gasGrowthValue = null; Integer dieselGrowthValue = null; Integer naturalGrowthValue = null; - AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); - UserBalance balance = userBalanceService.selectUserBalance(userid,nowAccountInfo.getStoreId()); + LJStore store = storeService.selectStoreByStoreId(storeId); + UserBalance balance = userBalanceService.selectUserBalance(userid,store.getChainStoreId()); int growth = balance.getGrowthValue(); balance.setRefuelMoney(refuelMoney); // 查询会员等级列表信息 @@ -492,10 +582,11 @@ public class OilOrderServiceImpl extends ServiceImpl i } } - private void insertCardBalance(Double amount,Integer userId){ + private void insertCardBalance(Double amount,Integer userId,Integer storeId){ AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); // 根据用户id查询用户余额信息 - UserBalance balance = userBalanceService.selectUserBalance(userId,nowAccountInfo.getStoreId()); + LJStore store = storeService.selectStoreByStoreId(storeId); + UserBalance balance = userBalanceService.selectUserBalance(userId,store.getChainStoreId()); // 修改余额信息 Double beforeBalance = balance.getCardBalance(); Double afterBalance = beforeBalance - amount; diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/mapper/xml/OilNumberMapper.xml b/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/mapper/xml/OilNumberMapper.xml index 1ea66db0c..e4095aef1 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/mapper/xml/OilNumberMapper.xml +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/mapper/xml/OilNumberMapper.xml @@ -132,7 +132,9 @@