From ba88d5bda12d4158935303151a696296a4e83507 Mon Sep 17 00:00:00 2001 From: cun-nan <19819293608@163.com> Date: Fri, 10 May 2024 11:54:12 +0800 Subject: [PATCH] bug --- .../api/fuyou/controller/FyPayController.java | 58 +++++++ .../com/fuint/api/fuyou/entity/Builder.java | 35 +++++ .../com/fuint/api/fuyou/entity/Const.java | 10 +- .../api/fuyou/entity/ReceiveParameterPos.java | 42 +++++ .../fuint/api/fuyou/service/FyPayService.java | 17 ++ .../fuyou/service/impl/FyPayServiceImpl.java | 146 ++++++++++++++++++ .../order/mapper/AllOrderInfoMapper.java | 7 + .../order/mapper/xml/AllOrderInfoMapper.xml | 28 ++++ .../order/service/OilOrderService.java | 16 ++ .../service/impl/OilOrderServiceImpl.java | 57 +++++++ .../fuint/common/shiroConfig/ShiroConfig.java | 2 + gasStation-uni/pages/index/index.vue | 80 ++++++++-- 12 files changed, 481 insertions(+), 17 deletions(-) create mode 100644 fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/entity/ReceiveParameterPos.java 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 66100f40b..0dea7e961 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,7 @@ import cn.hutool.core.util.ObjectUtil; import com.fasterxml.jackson.core.JsonProcessingException; import com.fuint.api.fuyou.entity.Const; import com.fuint.api.fuyou.entity.MerchantConfig; +import com.fuint.api.fuyou.entity.ReceiveParameterPos; import com.fuint.api.fuyou.service.FyPayService; import com.fuint.api.fuyou.service.MerchantConfigRecordService; import com.fuint.api.fuyou.service.MerchantConfigService; @@ -31,6 +32,9 @@ import java.util.concurrent.TimeUnit; @RestController @RequestMapping("/api/fyPay") public class FyPayController { + @Autowired + @Lazy + private FyPayService fyPayService; @Autowired @Lazy private OilOrderService orderService; @@ -109,4 +113,58 @@ public class FyPayController { cardFuelRecordService.fuleRechargeFinallDeal(orderNo); } } + + @GetMapping("/test") + public String test() throws Exception { + ReceiveParameterPos receiveParameterPos = new ReceiveParameterPos(); + receiveParameterPos.setPayType("WECHAT"); + receiveParameterPos.setContent("ceshi"); + receiveParameterPos.setOrderNo("20240509fdskjhv003"); + receiveParameterPos.setStoreId(141); + receiveParameterPos.setGoodsMoney(0.01); + fyPayService.mainScan(receiveParameterPos); + return "succse"; + } + + // 接收支付平台异步通知的接口 + @PostMapping("/notifyScan") + public String notifyUrlScan(HttpServletRequest request,HttpServletResponse response) throws Exception { + System.out.println("----------------收到支付回调--------"+request.getParameter("req")); + String notifyData = request.getParameter("req"); + String decode = URLDecoder.decode(notifyData, Const.charset); + Map reqMap = Utils.xmlStr2Map(decode); + if (reqMap.get("result_msg").equals("SUCCESS")){ + String orderNo = reqMap.get("mchnt_order_no"); + String transactionId = reqMap.get("transaction_id"); + String settleOrderAmt = reqMap.get("settle_order_amt"); + String orderLock = "orderLock_notify"+orderNo; + if (redisLock.tryLock(orderLock,5000, TimeUnit.MILLISECONDS)){ +// 业务逻辑 判断订单状态 +// AllOrderInfo allOrderInfo = allOrderInfoService.selectAllOrderInfoByOrderNo(orderNo); +// if (ObjectUtil.isNotEmpty(allOrderInfo)){ +// allOrderInfo.setPayMoney(Double.valueOf(settleOrderAmt)/100); +// allOrderInfo.setTransactionId(transactionId); +// allOrderInfo.setStatus("paid"); +// allOrderInfo.setPayTime(new Date()); +// allOrderInfoService.updateAllOrderInfo(allOrderInfo); +// +// // 修改配置收款账户余额信息 +// MerchantConfig merchantConfig = merchantConfigService.selectMeChByIdIsUse(allOrderInfo.getStoreId()); +// Double beforeAmount = merchantConfig.getAmount(); +// Double afterAmount = beforeAmount + allOrderInfo.getPayMoney(); +// merchantConfig.setAmount(afterAmount); +// merchantConfigService.updateMerch(merchantConfig); +// merchantConfigRecordService.updateMerchantConfigRecordByOrderNo(orderNo,"yes"); +// } +// +// updateOrderStatus(orderNo,allOrderInfo.getType()); +//// 修改订单支付状态 +// redisLock.unlock(orderLock); + } +// transaction_id 加锁 + return "1"; + }else { + return "0"; + } + } } 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 3537ea10d..64e78d110 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 @@ -146,4 +146,39 @@ public class Builder { return map; } + + /** + * 主扫 + * + * @return + */ + public static Map buildFuiou25() { + 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("order_type", Const.order_type); + map.put("goods_des", Const.goods_des); + map.put("goods_detail", ""); + map.put("addn_inf", ""); + SimpleDateFormat sdf_no = new SimpleDateFormat("yyyyMMddHHmmssSSS"); + Calendar calendar = Calendar.getInstance(); +// sdf_no.format(calendar.getTime()) + (int) (random.nextDouble() * 100000) + map.put("mchnt_order_no", ""); + map.put("curr_type", "CNY"); + map.put("order_amt", "1"); + map.put("term_ip", Const.term_ip); + SimpleDateFormat sdf_ts = new SimpleDateFormat("yyyyMMddHHmmss"); + map.put("txn_begin_ts", sdf_ts.format(calendar.getTime())); + map.put("goods_tag", ""); + map.put("notify_url", Const.notify_url_scan); + map.put("reserved_expire_minute", "5"); + + return map; + } + } \ No newline at end of file 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 c69471fc9..8f42126fd 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 @@ -48,11 +48,15 @@ public class Const { public static String INS_PUBLIC_KEYS="MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCj1SsMt4S9SMcNpXrcQ9ET4hHdX0UX/1RTdD9GzxzSDwTEsLQuUNaX0VP8NQ7NWvMdgCYnST74oV81ht0GQd3aax6fyXjDETYC5tq0sHkJxwtiynTcssPBjM2LipTeY6Sv8cUS1MPnvRX2Cs1RXkB8ZdUp9dCaNnTxFOPJGB1E4wIDAQAB"; public static String NOTIFY_PUBLIC_KEYS="MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCbBAl3xSB7YeUnze4yYZmnTeT7OtXZr0sP10TsDVRH2SY/VEjgS9KPmHMmVeKZT3+6xKsUvulgVyie46GGtZPrnoh+glF1gzsYAXJ7dvR/R5nYO5VvfwK/ChPFTiKhbTtO4OKtchgBZuqCbsemG+gFIiVJo37dY0Kg0zISmFHdOQIDAQAB"; - //异步通知(回调地址) + //小程序异步通知(回调地址) public static String notify_url = "https://www.tuofeng.cc/oilAdmin/api/fyPay/notify"; // public static String notify_url = "https://8q4f124343.yicp.fun/api/fyPay/notify"; - //下单 + //主扫异步通知(回调地址) +// public static String notify_url_scan = "https://www.tuofeng.cc/oilAdmin/api/fyPay/notifyScan"; + public static String notify_url_scan = "https://8q4f124343.yicp.fun/api/fyPay/notifyScan"; + + //主扫下单 public static String fuiou_21_url = "https://fundwx.fuiou.com/preCreate"; //扫码 public static String fuiou_22_url = "https://fundwx.fuiou.com/micropay"; @@ -79,4 +83,6 @@ public class Const { public static String fuiou_33_url = "https://spay-cloud.fuioupay.com/commonRefund"; //生产地址 查询 public static String fuiou_34_url = "https://spay-cloud.fuioupay.com/commonQuery"; + //主扫 + public static String fuiou_35_url = "https://spay-cloud.fuioupay.com/preCreate"; } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/entity/ReceiveParameterPos.java b/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/entity/ReceiveParameterPos.java new file mode 100644 index 000000000..1cf7534cc --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/entity/ReceiveParameterPos.java @@ -0,0 +1,42 @@ +package com.fuint.api.fuyou.entity; + +import lombok.Data; + +/** + * 接收的参数 + */ +@Data +public class ReceiveParameterPos { + /** + * 用户二维码code值 + */ + private String authCode; + /** + * 订单号(与业务表统一) + */ + private String orderNo; + /** + * 类型:1、油品;2、商品;3、储值卡;4、积分;5、囤油卡;6、油品加商品(收银台订单);7、挂账订单 + */ + private String type; + /** + * 店铺id + */ + private Integer storeId; + /** + * 原价 不需要做(*100)的处理 + */ + private Double goodsMoney; + /** + * 付款方式(数据字典) + */ + private String payType; + /** + * 用户id + */ + private Integer userId; + /** + * 订单描述 + */ + private String content; +} 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 80e577ba3..3ae68a5ae 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 @@ -1,6 +1,7 @@ package com.fuint.api.fuyou.service; import com.fuint.api.fuyou.entity.ReceiveParameter; +import com.fuint.api.fuyou.entity.ReceiveParameterPos; import java.util.Map; @@ -32,4 +33,20 @@ public interface FyPayService { * @throws Exception */ public Map refund(Map map) throws Exception; + + /** + * 条码支付pos端 + * @param receiveParameterPos + * @return + */ + public Map posPay(ReceiveParameterPos receiveParameterPos) throws Exception; + + /** + * 查询订单交易状态pos端 + * @return + * @throws Exception + */ + public Map queryOrderPos(ReceiveParameterPos receiveParameterPos,String insCd,String mchntCd) throws Exception; + + Map mainScan(ReceiveParameterPos receiveParameterPos) throws Exception; } 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 0723fab98..4a0ab0161 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 @@ -1,5 +1,6 @@ package com.fuint.api.fuyou.service.impl; +import cn.hutool.core.date.DateUtil; import cn.hutool.core.thread.ThreadUtil; import cn.hutool.core.util.ArrayUtil; import cn.hutool.core.util.ObjectUtil; @@ -621,4 +622,149 @@ public class FyPayServiceImpl implements FyPayService { return resMap; } + @Override + public Map posPay(ReceiveParameterPos receiveParameterPos) { + Map res = new HashMap<>(); + try { +// 查询商户配置信息 + MerchantConfig merchantConfig = merchantConfigService.selectMeChByIdIsUse(receiveParameterPos.getStoreId()); + if (ObjectUtil.isEmpty(merchantConfig)){ + res.put("code","error"); + res.put("msg","暂未配置商户信息"); + return res; + } + String publicKey = merchantConfig.getPublicKey(); + String privateKey = merchantConfig.getPrivateKey(); + Const.INS_PUBLIC_KEY = publicKey; + Const.INS_PRIVATE_KEY = privateKey; + String allAmount = String.valueOf(receiveParameterPos.getGoodsMoney()*100); + Map map = Builder.buildFuiou22(); + map.put("auth_code",receiveParameterPos.getAuthCode()); + map.put("mchnt_order_no",receiveParameterPos.getOrderNo()); + map.put("order_type",receiveParameterPos.getPayType()); + map.put("order_amt", allAmount); + map.put("ins_cd", merchantConfig.getInsCd()); + map.put("mchnt_cd", merchantConfig.getMchntCd()); + map.put("goods_des", receiveParameterPos.getContent()); + + +// 请求报文 + String reqBody = Message.requestMsg(map); +// 响应报文 + String rspXml = Message.responseMsg(reqBody,Const.fuiou_31_url); + + //响应报文验签 + Map resMap = Utils.xmlStr2Map(rspXml); + + String str = resMap.get("sign"); + String resultCode = resMap.get("result_code"); + if (!resultCode.equals("000000")){ + throw new RuntimeException(resMap.get("result_msg")); + } + if (Utils.verifySign(resMap, str)){ + ThreadUtil.execAsync(() -> { + Timer timer = new Timer(); + timer.schedule(new TimerTask() { + @Override + public void run() { + try { + Map orderQueryRes = queryOrderPos(receiveParameterPos,merchantConfig.getInsCd(),merchantConfig.getMchntCd()); + if(!orderQueryRes.get("msg").equals("unpaid")){ + timer.cancel(); + } + } catch (Exception e) { + throw new RuntimeException(e); + } + } + //定时器 不延时 立即开始 0.5s一次 + }, 0, 500); + Thread.currentThread().interrupt(); + }); + }else { + throw new Exception("验签失败,请联系管理员!"); + } + }catch (Exception e){ + e.printStackTrace(); + } + return null; + } + + @Override + public Map queryOrderPos(ReceiveParameterPos receiveParameterPos,String insCd,String mchntCd) { + Map resMap =new HashMap<>(); + resMap.put("msg","error"); + try { + Map map = Builder.buildFuiou30(); + map.put("mchnt_order_no",receiveParameterPos.getOrderNo()); + map.put("order_type",receiveParameterPos.getType()); + map.put("ins_cd", insCd); + map.put("mchnt_cd", mchntCd); + + // 请求报文 + String reqBody = Message.requestMsg(map); + // 响应报文 + String rspXml = Message.responseMsg(reqBody,Const.fuiou_34_url); + + //响应报文验签 + Map reqMap = Utils.xmlStr2Map(rspXml); + String str = reqMap.get("sign"); + if (Utils.verifySign(reqMap, str)){ + if (reqMap.get("trans_stat").equals("SUCCESS")){ + resMap.put("msg","success"); + }else if (reqMap.get("trans_stat").equals("USERPAYING")){ + resMap.put("msg","unpaid"); + }else { + resMap.put("msg","payFail"); + } + } + }catch (Exception e){ + e.printStackTrace(); + } + return null; + } + + @Override + public Map mainScan(ReceiveParameterPos receiveParameterPos) throws Exception { + Map res = new HashMap<>(); +// 查询商户配置信息 + MerchantConfig merchantConfig = merchantConfigService.selectMeChByIdIsUse(receiveParameterPos.getStoreId()); + if (ObjectUtil.isEmpty(merchantConfig)){ + res.put("code","error"); + res.put("msg","暂未配置商户信息"); + return res; + } + Map map = Builder.buildFuiou25(); + map.put("version", "1"); + map.put("ins_cd", merchantConfig.getInsCd()); + map.put("mchnt_cd", merchantConfig.getMchntCd()); + map.put("term_id", "88888888"); + map.put("mchnt_order_no",receiveParameterPos.getOrderNo()); + map.put("random_str", "orderNo"); + map.put("order_type",receiveParameterPos.getPayType()); + map.put("goods_des", receiveParameterPos.getContent()); + double amount = receiveParameterPos.getGoodsMoney() * 100; + map.put("order_amt", String.valueOf((int) amount)); + String nowtime = DateUtil.format(new Date(), "yyyyMMddHHmmss"); + map.put("txn_begin_ts",nowtime); + + String publicKey = merchantConfig.getPublicKey(); + String privateKey = merchantConfig.getPrivateKey(); + Const.INS_PUBLIC_KEY = publicKey; + Const.INS_PRIVATE_KEY = privateKey; + +// 请求报文 + String reqBody = Message.requestMsg(map); +// 响应报文 + String rspXml = Message.responseMsg(reqBody,Const.fuiou_35_url); + + //响应报文验签 + Map resMap = Utils.xmlStr2Map(rspXml); + + String str = resMap.get("sign"); + if (Utils.verifySign(resMap, str)){ + System.out.println(resMap); + } + return resMap; + } + } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/mapper/AllOrderInfoMapper.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/mapper/AllOrderInfoMapper.java index a8d85eec2..67b83a0e3 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/mapper/AllOrderInfoMapper.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/mapper/AllOrderInfoMapper.java @@ -20,4 +20,11 @@ public interface AllOrderInfoMapper extends BaseMapper { String sumPayMoney( @Param("allOrderInfo") AllOrderInfo allOrderInfo); // 根据storeId List查询总流水 BigDecimal allStream(@Param("list") List mtStoreList); + + /** + * 根据支付状态查询订单笔数 + * @param allOrderInfo + * @return + */ + Integer selectByPayStatusNum(AllOrderInfo allOrderInfo); } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/mapper/xml/AllOrderInfoMapper.xml b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/mapper/xml/AllOrderInfoMapper.xml index 4772a6536..4754c7611 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/mapper/xml/AllOrderInfoMapper.xml +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/mapper/xml/AllOrderInfoMapper.xml @@ -82,4 +82,32 @@ and date_format(pay_time,'%y%m%d') <= date_format(#{allOrderInfo.params.endTime},'%y%m%d') + \ No newline at end of file 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 866aa5b09..cfcf09fd8 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 @@ -190,4 +190,20 @@ public interface OilOrderService extends IService { void addGoodsSaleStatistic(Integer goodsId,Integer goodsNum,Integer storeId,Boolean isMember); OilOrderVo getInfoByTime(Date time,Integer tankId); + +// pos端 + + /** + * 添加订单信息 条码支付 + * @param oilOrderVo + * @return + */ + int addOrderPos(OilOrderVo oilOrderVo); + + /** + * 添加订单信息 主扫 + * @param oilOrderVo + * @return + */ + int addOrderPosScan(OilOrderVo oilOrderVo) throws Exception; } 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 5fe1a5aa6..5033967f9 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 @@ -12,6 +12,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.fuint.api.fuyou.entity.MerchantConfig; import com.fuint.api.fuyou.entity.ReceiveParameter; +import com.fuint.api.fuyou.entity.ReceiveParameterPos; import com.fuint.api.fuyou.service.FyPayService; import com.fuint.api.fuyou.service.MerchantConfigService; import com.fuint.api.fuyou.service.OilConfigService; @@ -1917,4 +1918,60 @@ return stringDoubleMap; List oilGuns = oilGunService.selectOilGunByTankId(tankId); return baseMapper.getInfoByTime(time,oilGuns); } + +// pos端 + + @Override + public int addOrderPos(OilOrderVo oilOrderVo) { + AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); + // 根据日期生成订单信息 + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss"); + String timestamp = dateFormat.format(new Date()); + String randomString = UUID.randomUUID().toString().replace("-","").substring(0,6); + String orderNo = "2345"+timestamp+randomString; + + oilOrderVo.setOrderNo(orderNo); + oilOrderVo.setStoreId(nowAccountInfo.getStoreId()); + oilOrderVo.setStaffId(nowAccountInfo.getStaffId()); + Double oilNum = oilOrderVo.getOrderAmount() / oilOrderVo.getOilPrice(); + oilOrderVo.setOilNum(oilNum); + oilOrderVo.setTerminal("POS"); + oilOrderVo.setOrderType("主订单"); + if (oilOrderVo.getPayType().equals("CASH")){ + oilOrderVo.setOrderStatus("paid"); + oilOrderVo.setPayTime(new Date()); + }else { + oilOrderVo.setOrderStatus("unpaid"); + } + int row = baseMapper.insert(oilOrderVo); + return row; + } + + @Override + public int addOrderPosScan(OilOrderVo oilOrderVo) throws Exception { + AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); + // 根据日期生成订单信息 + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss"); + String timestamp = dateFormat.format(new Date()); + String randomString = UUID.randomUUID().toString().replace("-","").substring(0,6); + String orderNo = "2345"+timestamp+randomString; + + oilOrderVo.setOrderNo(orderNo); + oilOrderVo.setStoreId(nowAccountInfo.getStoreId()); + oilOrderVo.setStaffId(nowAccountInfo.getStaffId()); + oilOrderVo.setTerminal("POS"); + oilOrderVo.setOrderStatus("unpaid"); + oilOrderVo.setOrderType("主订单"); + int row = baseMapper.insert(oilOrderVo); + ReceiveParameterPos receiveParameterPos = new ReceiveParameterPos(); + receiveParameterPos.setPayType(oilOrderVo.getPayType()); + receiveParameterPos.setType("1"); + receiveParameterPos.setContent("油品订单"); + receiveParameterPos.setOrderNo(orderNo); + receiveParameterPos.setStoreId(oilOrderVo.getStoreId()); + receiveParameterPos.setStoreId(oilOrderVo.getUserId()); + receiveParameterPos.setGoodsMoney(oilOrderVo.getPayAmount()); + Map mainScan = fyPayService.mainScan(receiveParameterPos); + return row; + } } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/common/shiroConfig/ShiroConfig.java b/fuintBackend/fuint-application/src/main/java/com/fuint/common/shiroConfig/ShiroConfig.java index 91e8593f5..5580e803b 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/common/shiroConfig/ShiroConfig.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/common/shiroConfig/ShiroConfig.java @@ -55,6 +55,8 @@ public class ShiroConfig { filterMap.put("/backendApi/store/loginVerification","anon"); //小程序支付回调地址 filterMap.put("/api/fyPay/notify","anon"); + //主扫支付回调地址 + filterMap.put("/api/fyPay/notifyScan","anon"); diff --git a/gasStation-uni/pages/index/index.vue b/gasStation-uni/pages/index/index.vue index 16ae4ef3a..fe0f1960a 100644 --- a/gasStation-uni/pages/index/index.vue +++ b/gasStation-uni/pages/index/index.vue @@ -272,6 +272,8 @@ await this.getTheJudgmentIsTheSame(); await this.isJoined() this.isRecharge() + // this.getAddress() + // this.getUserAuthority() // this.getIndexBanner() }, components: { @@ -406,27 +408,75 @@ let _this = this; // this.getAddress(); uni.getSetting({ - async success(res) { - if (!res.authSetting['scope.userLocation']) { - // uni.authorize({ - // scope: 'scope.userLocation', - // success() { - // // 用户同意获取位置信息 - // // _this.isExistStoreId() - // }, - // fail() { - // // 用户拒绝 - // } - // }) - await _this.getAddress(uni.getStorageSync("storeId")); + success(res) { + if (res.authSetting['scope.userLocation']==false) { + // uni.clearStorageSync(); + // _this.getStorageSize() + + _this.showRefuseLocationPermission() } else { // 用户同意获取位置信息 - // _this.isExistStoreId() - await _this.getAddress(uni.getStorageSync("storeId")); + _this.getAddress(uni.getStorageSync("storeId")); } }, fail(err) { + console.log('jujuel', err); + }, + complete(ress) { + }, + withSubscriptions(resx) { + console.log('4', resx); + } + + }) + }, + + // 用户拒绝授权的展示 + showRefuseLocationPermission() { + const that = this; + wx.showModal({ + title: "提示", + content: "需要获取用户位置权限", + confirmText: "前往设置", + showCancel: false, + success(res) { + if (res.confirm) { + uni.openSetting({ + success(res){ + console.log("打开设置成功", res); + if (res.authSetting['scope.userLocation']) { + console.log('成功授权userLocation') + that.getAddress() + } else { + console.log('用户未授权userLocation') + // 递归调用本函数,(函数套函数) + that.showRefuseLocationPermission() + } + }, + fail(err){ + console.log("打开设置失败", err) + } + }) + } + } + }) + }, + getStorageSize() { + let that = this; + uni.getStorageInfo({ + success(res) { + console.log(res) + console.log(res.keys); + console.log(res.limitSize); + let size = res.currentSize; + if (size < 1024) { + that.storageSize = size + ' B'; + } else if (size / 1024 >= 1 && size / 1024 / 1024 < 1) { + that.storageSize = Math.floor(size / 1024 * 100) / 100 + ' KB'; + } else if (size / 1024 / 1024 >= 1) { + that.storageSize = Math.floor(size / 1024 / 1024 * 100) / 100 + ' M'; + } } }) },