From 709a4a10be56952ead6340e4822fce41a66e47cd Mon Sep 17 00:00:00 2001 From: puzhibing <393733352@qq.com> Date: 星期三, 26 七月 2023 18:39:28 +0800 Subject: [PATCH] Merge branch '1.1' of http://120.76.84.145:10101/gitblit/r/java/SuperSaveDriving into dev --- user/guns-admin/src/main/java/com/supersavedriving/user/modular/api/AppUserController.java | 64 +++++++++++++++---------------- 1 files changed, 31 insertions(+), 33 deletions(-) diff --git a/user/guns-admin/src/main/java/com/supersavedriving/user/modular/api/AppUserController.java b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/api/AppUserController.java index 77ec4cf..d4c3aae 100644 --- a/user/guns-admin/src/main/java/com/supersavedriving/user/modular/api/AppUserController.java +++ b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/api/AppUserController.java @@ -16,16 +16,14 @@ import com.supersavedriving.user.modular.system.util.UUIDUtil; import com.supersavedriving.user.modular.system.util.huawei.OBSUtil; import com.supersavedriving.user.modular.system.util.huawei.SMSUtil; +import com.supersavedriving.user.modular.system.util.weChat.WeChatUtil; import com.supersavedriving.user.modular.system.warpper.*; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.ResponseBody; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; import javax.servlet.http.HttpServletRequest; @@ -66,6 +64,28 @@ @Autowired private RedisUtil redisUtil; + @Autowired + private WeChatUtil weChatUtil; + + + + @ResponseBody + @PostMapping("/base/appUser/getUrlLink") +// @ServiceLog(name = "获取跳转微信url_link", url = "/base/appUser/appUserLogin") + @ApiOperation(value = "获取跳转微信url_link", tags = {"用户端-首页"}, notes = "") + @ApiImplicitParams({ + @ApiImplicitParam(value = "跳转小程序路径", name = "path", required = true, dataType = "string"), + @ApiImplicitParam(value = "跳转的附带参数", name = "query", required = false, dataType = "string"), + }) + public ResponseWarpper<String> getUrlLink(String path, String query){ + try { + String urlLink = weChatUtil.getUrlLink(path, query, "release"); + return ResponseWarpper.success(urlLink); + }catch (Exception e){ + e.printStackTrace(); + return new ResponseWarpper(500, e.getMessage()); + } + } @@ -274,7 +294,7 @@ SystemConfig systemConfig = systemConfigService.selectOne(new EntityWrapper<SystemConfig>().eq("type", 6)); if(null != systemConfig){ JSONObject jsonObject = JSON.parseObject(systemConfig.getContent()); - return ResponseWarpper.success("充值满" + jsonObject.getDouble("num2") + "元,下单享9折优惠!"); + return ResponseWarpper.success("充值满" + jsonObject.getDouble("num2") + "元,下单享9.5折优惠!"); } return ResponseWarpper.success(); }catch (Exception e){ @@ -314,25 +334,16 @@ @ResponseBody @PostMapping("/base/appUser/rechargeBalanceCallback") // @ServiceLog(name = "余额充值回调", url = "/base/appUser/rechargeBalanceCallback") - public void rechargeBalanceCallback(HttpServletRequest request, HttpServletResponse response){ + public void rechargeBalanceCallback(@RequestBody InterfaceResponse interfaceResponse, HttpServletResponse response){ try { - String code = request.getParameter("code"); - String version = request.getParameter("version"); - String msg = request.getParameter("msg"); - String date = request.getParameter("date"); - String result = request.getParameter("result"); - String sign = request.getParameter("sign"); - InterfaceResponse interfaceResponse = new InterfaceResponse(); - interfaceResponse.setCode(code); - interfaceResponse.setVersion(version); - interfaceResponse.setMsg(msg); - interfaceResponse.setDate(date); - interfaceResponse.setResult(result); - interfaceResponse.setSign(sign); // 验签 boolean verify = RSASignature.validate(interfaceResponse.content(), interfaceResponse.getSign()); if (verify) {//验签成功业务处理逻辑 - JSONObject jsonObject = JSON.parseObject(result); + if(!"0000".equals(interfaceResponse.getCode())){ + System.err.println("充值回调异常:" + interfaceResponse.getMsg()); + return; + } + JSONObject jsonObject = JSON.parseObject(interfaceResponse.getResult()); String merOrderId = jsonObject.getString("merOrderId"); String orderId = jsonObject.getString("parameter1"); appUserService.rechargeBalanceCallback(orderId, merOrderId); @@ -344,19 +355,6 @@ } else {//验签失败业务处理逻辑 System.err.println("支付回调验签失败"); } - -// Map<String, String> map = payMoneyUtil.weixinpayCallback(request); -// if(null != map){ -// String out_trade_no = map.get("out_trade_no"); -// String transaction_id = map.get("transaction_id"); -// String result = map.get("result"); -// String orderId = out_trade_no.substring(17); -// appUserService.rechargeBalanceCallback(out_trade_no, transaction_id); -// PrintWriter out = response.getWriter(); -// out.print(result); -// out.flush(); -// out.close(); -// } }catch (Exception e){ e.printStackTrace(); } -- Gitblit v1.7.1