|
|
@ -1,18 +1,29 @@ |
|
|
|
package com.ruoyi.applet.contoller; |
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.cyl.h5.pojo.request.OrderPayRequest; |
|
|
|
import com.cyl.h5.pojo.response.OrderPayResponse; |
|
|
|
import com.cyl.manager.ums.domain.Member; |
|
|
|
import com.cyl.wechat.WechatPayService; |
|
|
|
import com.ruoyi.common.constant.Constants; |
|
|
|
import com.ruoyi.common.core.domain.AjaxResult; |
|
|
|
import com.ruoyi.common.core.redis.RedisService; |
|
|
|
import com.ruoyi.common.utils.StringUtils; |
|
|
|
import com.ruoyi.framework.config.LocalDataUtil; |
|
|
|
import com.ruoyi.model.domain.AppUsers; |
|
|
|
import com.ruoyi.model.domain.AppletUsersTeacher; |
|
|
|
import com.ruoyi.model.service.IAppUsersService; |
|
|
|
import com.ruoyi.model.service.IAppletUsersTeacherService; |
|
|
|
import io.swagger.annotations.Api; |
|
|
|
import io.swagger.annotations.ApiOperation; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.http.ResponseEntity; |
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
|
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
@Slf4j |
|
|
|
@Api(description = "伴宠师-伴宠师认证") |
|
|
|
@RestController |
|
|
|
@RequestMapping("/applet/UserTeacher") |
|
|
@ -21,6 +32,10 @@ public class ApiAppletUserTeacherController { |
|
|
|
private IAppUsersService appUsersService; |
|
|
|
@Autowired |
|
|
|
private IAppletUsersTeacherService appletUsersTeacherService; |
|
|
|
@Autowired |
|
|
|
private WechatPayService wechatPayService; |
|
|
|
@Autowired |
|
|
|
private RedisService redisService; |
|
|
|
|
|
|
|
|
|
|
|
@ApiOperation("伴宠师工作台-伴宠师列表数据查询") |
|
|
@ -40,6 +55,8 @@ public class ApiAppletUserTeacherController { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ApiOperation("伴宠师工作台-伴宠师基本信息添加") |
|
|
|
@PostMapping("/insertUser") |
|
|
|
public AjaxResult insertUser(@RequestBody AppletUsersTeacher usersTeacher){ |
|
|
@ -69,6 +86,50 @@ public class ApiAppletUserTeacherController { |
|
|
|
return toAjax(appletUsersTeacherService.deleteAppletUsersTeacherById(id)); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//保证金缴纳 |
|
|
|
@ApiOperation("伴宠师工作台-伴宠师基本信息删除") |
|
|
|
@PostMapping("/payPrice") |
|
|
|
public ResponseEntity<OrderPayResponse> orderPay(@RequestBody OrderPayRequest req){ |
|
|
|
log.info("订单支付","提交的数据:"+ JSONObject.toJSONString(req)); |
|
|
|
String redisKey = "h5_oms_bcs_pay_"+req.getPayId(); |
|
|
|
String redisValue = req.getPayId()+"_"+System.currentTimeMillis(); |
|
|
|
try { |
|
|
|
redisService.lock(redisKey, redisValue, 60); |
|
|
|
AppUsers member = appUsersService.selectAppUsersByUserId(req.getMemberId()); |
|
|
|
String orderNo = ""; |
|
|
|
String desc = ""; |
|
|
|
Integer totalAmount = 1; |
|
|
|
String openId =member.getOpenid(); |
|
|
|
Long memberId = member.getUserId(); |
|
|
|
String appId = ""; |
|
|
|
String s = wechatPayService.jsapiPayForBCHSHI( |
|
|
|
orderNo, |
|
|
|
desc, |
|
|
|
totalAmount, |
|
|
|
openId, |
|
|
|
memberId, |
|
|
|
appId |
|
|
|
); |
|
|
|
return null; |
|
|
|
}catch (Exception e){ |
|
|
|
log.error("支付方法异常", e); |
|
|
|
throw new RuntimeException(e.getMessage()); |
|
|
|
}finally { |
|
|
|
try{ |
|
|
|
redisService.unLock(redisKey,redisValue); |
|
|
|
}catch (Exception e){ |
|
|
|
log.error("",e); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected AjaxResult toAjax(int rows) { |
|
|
|
return rows > 0 ? AjaxResult.success() : AjaxResult.error(); |
|
|
|
} |
|
|
|