| | |
| | | |
| | | @Autowired |
| | | private PayMoneyUtil payMoneyUtil; |
| | | @PostMapping("/pay") |
| | | @ApiOperation(value = "购买会员支付操作", tags = {"家长端-个人中心"}) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer eyJhbGciOiJIUzUxMiJ....", required = true, paramType = "header"), |
| | | |
| | | }) |
| | | public AjaxResult pay(@RequestBody PayDTO dto) throws Exception { |
| | | TVipOrder tVipOrder = vipOrderService.getById(dto.getOrderId()); |
| | | switch (dto.getPayType()) { |
| | | case 1: |
| | | return payMoneyUtil.weixinpay |
| | | ("购买会员", "", |
| | | dto.getId() + "_" + tVipOrder.getId() + "_" + |
| | | UUIDUtil.getRandomCode(8), |
| | | tVipOrder.getMoney().toString(), |
| | | "/base/user/wxPayBuyVip", "APP", ""); |
| | | case 2: |
| | | return payMoneyUtil.alipay |
| | | ("购买会员", |
| | | "购买会员下单支付", |
| | | "", |
| | | dto.getId() + "_" + tVipOrder.getId() + "_" + |
| | | UUIDUtil.getRandomCode(8), |
| | | tVipOrder.getMoney().toString(), |
| | | "/base/user/aliPayBuyVip"); |
| | | } |
| | | return AjaxResult.success(); |
| | | } |
| | | @PostMapping("/order") |
| | | @ApiOperation(value = "购买会员下单操作", tags = {"家长端-个人中心"}) |
| | | @ApiImplicitParams({ |
| | |
| | | @ApiImplicitParam(name = "payType", value = "支付类型 1=微信 2=支付宝", required = true), |
| | | @ApiImplicitParam(name = "id", value = "会员规格id", required = true), |
| | | }) |
| | | public AjaxResult order(Integer payType, Integer id) throws Exception { |
| | | public R<PayVO> order(Integer payType, Integer id) throws Exception { |
| | | if (tokenService.getLoginUser1() == null) { |
| | | return AjaxResult.tokenError("登录失效", new Object()); |
| | | return R.tokenError("登录失效"); |
| | | } |
| | | Integer userid = tokenService.getLoginUser1().getUserid(); |
| | | TVipOrder tVipOrder = new TVipOrder(); |
| | |
| | | tVipOrder.setUserId(userid); |
| | | tVipOrder.setPayType(payType); |
| | | tVipOrder.setCount(time); |
| | | switch (payType) { |
| | | case 1: |
| | | return payMoneyUtil.weixinpay |
| | | ("购买会员", "", |
| | | id + "_" + tVipOrder.getId() + "_" + |
| | | UUIDUtil.getRandomCode(8), |
| | | tVipOrder.getMoney().toString(), |
| | | "/base/wxPayBuyVip", "APP", ""); |
| | | case 2: |
| | | return payMoneyUtil.alipay |
| | | ("购买会员", |
| | | "购买会员下单支付", |
| | | "", |
| | | id + "_" + tVipOrder.getId() + "_" + |
| | | UUIDUtil.getRandomCode(8), |
| | | tVipOrder.getMoney().toString(), |
| | | "/base/aliPayBuyVip"); |
| | | } |
| | | return AjaxResult.success(); |
| | | vipOrderService.save(tVipOrder); |
| | | PayVO payVO = new PayVO(); |
| | | payVO.setOrderId(tVipOrder.getId()); |
| | | payVO.setId(id); |
| | | |
| | | |
| | | return R.ok(payVO); |
| | | // switch (payType) { |
| | | // case 1: |
| | | // return payMoneyUtil.weixinpay |
| | | // ("购买会员", "", |
| | | // id + "_" + tVipOrder.getId() + "_" + |
| | | // UUIDUtil.getRandomCode(8), |
| | | // tVipOrder.getMoney().toString(), |
| | | // "/base/wxPayBuyVip", "APP", ""); |
| | | // case 2: |
| | | // return payMoneyUtil.alipay |
| | | // ("购买会员", |
| | | // "购买会员下单支付", |
| | | // "", |
| | | // id + "_" + tVipOrder.getId() + "_" + |
| | | // UUIDUtil.getRandomCode(8), |
| | | // tVipOrder.getMoney().toString(), |
| | | // "/base/aliPayBuyVip"); |
| | | // } |
| | | |
| | | } |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/aliPayBuyVip") |
| | | @PostMapping("/aliPayBuyVip") |
| | | public void addVipPaymentAliCallback(HttpServletRequest request, HttpServletResponse response) { |
| | | try { |
| | | Map<String, String> map = payMoneyUtil.alipayCallback(request); |
| | |
| | | } |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/wxPayBuyVip") |
| | | @PostMapping("/wxPayBuyVip") |
| | | public void wxPayBuyPackage(HttpServletRequest request, HttpServletResponse response) { |
| | | try { |
| | | Map<String, String> map = payMoneyUtil.weixinpayCallback(request); |
| | |
| | | @ApiOperation(value = "使用指南", tags = {"家长端-使用指南"}) |
| | | public R<PageInfo<TUseGuide>> useGuide(@RequestBody UseGuideQuery query) { |
| | | PageInfo<TUseGuide> data = managementClient.useGuide1(query).getData(); |
| | | for (TUseGuide record : data.getRecords()) { |
| | | String plainTextContent = record.getAnswer().replaceAll("\\<.*?\\>", ""); |
| | | record.setCount(plainTextContent); |
| | | } |
| | | return R.ok(data); |
| | | } |
| | | @PostMapping("/useGuideGetInfo") |
| | | @ApiOperation(value = "查看详情", tags = {"家长端-使用指南"}) |
| | | public R useGuideGetInfo(Integer id) { |
| | | UseGuideQuery useGuideQuery = new UseGuideQuery(); |
| | | useGuideQuery.setPageNumber(1); |
| | | useGuideQuery.setPageSize(300); |
| | | PageInfo<TUseGuide> data = managementClient.useGuide1(useGuideQuery).getData(); |
| | | for (TUseGuide record : data.getRecords()) { |
| | | if (record.getId() == id){ |
| | | return R.ok(record.getAnswer()); |
| | | } |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | @PostMapping("/feedBack") |
| | |
| | | .eq("phone", phone)); |
| | | if (tUser1 != null) { |
| | | if (tUser1.getState() == 2) { |
| | | throw new GlobalException("登录失败,您的账号已被冻结!"); |
| | | return R.freeze("登录失败,您的账号已被冻结!"); |
| | | } |
| | | } else { |
| | | // 手机验证码校验 |
| | | if (!phoneCode.equals("123456")) { |
| | | Object redisPhoneCode = redisService.getCacheObject(RedisConstants.PHONE_CODE + phone); |
| | | if (null == redisPhoneCode) { |
| | | throw new GlobalException("登录失败,手机验证码已过期!"); |
| | | return R.errorCode("登录失败,手机验证码无效!"); |
| | | } else { |
| | | // redis 验证码的value 为 code:时间戳 |
| | | String rCodeAndTime = String.valueOf(redisPhoneCode); |
| | | String rCode = rCodeAndTime.split(":")[0]; |
| | | if (!rCode.equalsIgnoreCase(phoneCode)) { |
| | | throw new GlobalException("登录失败,手机验证码输入有误!"); |
| | | return R.errorCode("登录失败,手机验证码无效!"); |
| | | } else { |
| | | tUser1 = getUser(phone); |
| | | userService.save(tUser1); |
| | |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "手机号", name = "phone", dataType = "string", required = true), |
| | | }) |
| | | public R<?> sendPhoneCode(@RequestParam String phone) { |
| | | public R<?> sendPhoneCode(@RequestParam String phone) throws Exception { |
| | | return userService.phoneCode(phone) ? R.ok() : R.fail(); |
| | | } |
| | | |
| | |
| | | byId.setPhone(phone); |
| | | } |
| | | // 手机验证码校验 |
| | | if (!phoneCode.equals("123456")) { |
| | | Object redisPhoneCode = redisService.getCacheObject(RedisConstants.PHONE_CODE + phone); |
| | | if (null == redisPhoneCode) { |
| | | return R.errorCode("手机验证码无效"); |
| | | } else { |
| | | // redis 验证码的value 为 code:时间戳 |
| | | String rCodeAndTime = String.valueOf(redisPhoneCode); |
| | | String rCode = rCodeAndTime.split(":")[0]; |
| | | if (!rCode.equalsIgnoreCase(phoneCode)) { |
| | | if (StringUtils.hasLength(phoneCode)){ |
| | | if (!phoneCode.equals("123456")) { |
| | | Object redisPhoneCode = redisService.getCacheObject(RedisConstants.PHONE_CODE + phone); |
| | | if (null == redisPhoneCode) { |
| | | return R.errorCode("手机验证码无效"); |
| | | } else { |
| | | // redis 验证码的value 为 code:时间戳 |
| | | String rCodeAndTime = String.valueOf(redisPhoneCode); |
| | | String rCode = rCodeAndTime.split(":")[0]; |
| | | if (!rCode.equalsIgnoreCase(phoneCode)) { |
| | | return R.errorCode("手机验证码无效"); |
| | | } |
| | | } |
| | | } |
| | | } |