| | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.agentdriving.user.modular.system.model.AppUser; |
| | | import com.agentdriving.user.modular.system.model.SystemConfig; |
| | | import com.agentdriving.user.modular.system.service.*; |
| | | import com.agentdriving.user.modular.system.util.MallBook.model.InterfaceResponse; |
| | | import com.agentdriving.user.modular.system.util.MallBook.util.RSASignature; |
| | | import com.agentdriving.user.modular.system.util.PayMoneyUtil; |
| | | import com.agentdriving.user.modular.system.util.RedisUtil; |
| | | import com.agentdriving.user.modular.system.util.ResultUtil; |
| | | import com.agentdriving.user.modular.system.util.UUIDUtil; |
| | | import com.agentdriving.user.modular.system.util.huawei.OBSUtil; |
| | | import com.agentdriving.user.modular.system.util.huawei.SMSUtil; |
| | | import com.agentdriving.user.modular.system.warpper.*; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | |
| | | import java.io.InputStream; |
| | | import java.io.PrintWriter; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 用户控制器 |
| | |
| | | // @ServiceLog(name = "余额充值回调", url = "/base/appUser/rechargeBalanceCallback") |
| | | public void rechargeBalanceCallback(HttpServletRequest request, 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); |
| | | String merOrderId = jsonObject.getString("merOrderId"); |
| | | String orderId = jsonObject.getString("parameter1"); |
| | | appUserService.rechargeBalanceCallback(orderId, merOrderId); |
| | | response.setStatus(200); |
| | | 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("OK"); |
| | | out.print(result); |
| | | out.flush(); |
| | | out.close(); |
| | | } 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(); |
| | | } |
| | |
| | | } |
| | | try { |
| | | String numberRandom = UUIDUtil.getNumberRandom(5); |
| | | SMSUtil.send(phone, "1d0f0cbe5b214b0d8efa891730eb532a", "[\"" + numberRandom + "\"]"); |
| | | SMSUtil.send(phone, "4d18e74a95ca400d802755fe0f903589", "[\"" + numberRandom + "\"]"); |
| | | redisUtil.setStrValue(receiver + phone, numberRandom, 300);//5分钟有效期 |
| | | return ResponseWarpper.success(ResultUtil.success()); |
| | | }catch (Exception e){ |