| | |
| | | import com.supersavedriving.user.modular.system.model.AppUser; |
| | | import com.supersavedriving.user.modular.system.model.SystemConfig; |
| | | import com.supersavedriving.user.modular.system.service.*; |
| | | import com.supersavedriving.user.modular.system.util.MallBook.model.InterfaceResponse; |
| | | import com.supersavedriving.user.modular.system.util.MallBook.util.RSASignature; |
| | | import com.supersavedriving.user.modular.system.util.PayMoneyUtil; |
| | | import com.supersavedriving.user.modular.system.util.RedisUtil; |
| | | import com.supersavedriving.user.modular.system.util.ResultUtil; |
| | |
| | | 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; |
| | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/appUser/queryNearbyDrivers") |
| | | // @ServiceLog(name = "获取附近的司机", url = "/base/appUser/queryNearbyDrivers") |
| | | @ServiceLog(name = "获取附近的司机", url = "/base/appUser/queryNearbyDrivers") |
| | | @ApiOperation(value = "获取附近的司机", tags = {"用户端-首页"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "经度", name = "lon", required = true, dataType = "string"), |
| | |
| | | @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 { |
| | | 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); |
| | | // 验签 |
| | | boolean verify = RSASignature.validate(interfaceResponse.content(), interfaceResponse.getSign()); |
| | | if (verify) {//验签成功业务处理逻辑 |
| | | 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); |
| | | response.setStatus(200); |
| | | PrintWriter out = response.getWriter(); |
| | | out.print(result); |
| | | out.print("OK"); |
| | | 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(); |
| | | } |
| | |
| | | phone = phone.indexOf("+86") < 0 ? "+86" + phone : phone; |
| | | String value = redisUtil.getValue(phone); |
| | | if(ToolUtil.isEmpty(value) || !value.equals(code)){ |
| | | resultUtil = ResultUtil.error("验证码无效"); |
| | | return ResponseWarpper.success(ResultUtil.error("验证码无效")); |
| | | } |
| | | redisUtil.remove(phone); |
| | | return ResponseWarpper.success(resultUtil); |