feat:免密支付
This commit is contained in:
1 parent
5b2463cba0
commit
5dc6a1ebbd
31 files changed
+776
-281
No files matched your search
@@ -104,12 +104,17 @@
|
||||
<groupId>com.bsd</groupId>
|
||||
<artifactId>pjcloud-common-swagger</artifactId>
|
||||
</dependency>
|
||||
<!-- 引入分布式事务-->
|
||||
<!-- 引入分布式事务 -->
|
||||
<dependency>
|
||||
<groupId>com.bsd</groupId>
|
||||
<artifactId>pjcloud-common-seata</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 支付宝SDK -->
|
||||
<dependency>
|
||||
<groupId>com.alipay.sdk</groupId>
|
||||
<artifactId>alipay-sdk-java</artifactId>
|
||||
<version>4.40.251.ALL</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<profiles>
|
||||
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
package com.bsd.pjcloud.app.config;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 支付宝支付配置
|
||||
*/
|
||||
@Component
|
||||
@ConfigurationProperties(prefix = "mini-ali-pay")
|
||||
@Data
|
||||
public class MiniAlipayConf {
|
||||
|
||||
/**
|
||||
* 应用ID
|
||||
*/
|
||||
private String appId;
|
||||
|
||||
/**
|
||||
* 私钥
|
||||
*/
|
||||
private String privateKey;
|
||||
|
||||
/**
|
||||
* 公钥
|
||||
*/
|
||||
private String publicKey;
|
||||
|
||||
/**
|
||||
* 支付宝公钥
|
||||
*/
|
||||
private String alipayPublicKey;
|
||||
|
||||
/**
|
||||
* 回调地址
|
||||
*/
|
||||
private String callbackUrl;
|
||||
|
||||
}
|
||||
+68
-82
@@ -28,6 +28,8 @@ import com.bsd.pjcloud.common.excel.annotation.ResponseExcel;
|
||||
import com.bsd.pjcloud.common.log.annotation.SysLog;
|
||||
import com.bsd.pjcloud.common.security.annotation.HasPermission;
|
||||
import com.bsd.pjcloud.common.security.annotation.Inner;
|
||||
import com.bsd.pjcloud.common.security.service.PjcloudUser;
|
||||
import com.bsd.pjcloud.common.security.util.SecurityUtils;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.Valid;
|
||||
@@ -45,95 +47,79 @@ import java.util.List;
|
||||
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
|
||||
public class AppSocialDetailsController {
|
||||
|
||||
private final AppSocialDetailsService appSocialDetailsService;
|
||||
private final AppSocialDetailsService appSocialDetailsService;
|
||||
|
||||
/**
|
||||
* 社交登录账户简单分页查询
|
||||
* @param page 分页对象
|
||||
* @param appSocialDetails 社交登录
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/page")
|
||||
public R getSocialDetailsPage(Page page, AppSocialDetails appSocialDetails) {
|
||||
return R.ok(appSocialDetailsService.page(page, Wrappers.query(appSocialDetails)));
|
||||
}
|
||||
/**
|
||||
* 社交登录账户简单分页查询
|
||||
*/
|
||||
@GetMapping("/page")
|
||||
public R getSocialDetailsPage(Page page, AppSocialDetails appSocialDetails) {
|
||||
return R.ok(appSocialDetailsService.page(page, Wrappers.query(appSocialDetails)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 信息
|
||||
* @param id id
|
||||
* @return R
|
||||
*/
|
||||
@GetMapping("/{id}")
|
||||
public R getinfo(@PathVariable("id") Long id) {
|
||||
return R.ok(appSocialDetailsService.getById(id));
|
||||
}
|
||||
/**
|
||||
* 信息
|
||||
*/
|
||||
@GetMapping("/{id}")
|
||||
public R getinfo(@PathVariable("id") Long id) {
|
||||
return R.ok(appSocialDetailsService.getById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存
|
||||
* @param appSocialDetails
|
||||
* @return R
|
||||
*/
|
||||
@SysLog("保存三方信息")
|
||||
@PostMapping
|
||||
@HasPermission("app_social_details_add")
|
||||
public R save(@Valid @RequestBody AppSocialDetails appSocialDetails) {
|
||||
return R.ok(appSocialDetailsService.save(appSocialDetails));
|
||||
}
|
||||
/**
|
||||
* 保存
|
||||
*/
|
||||
@SysLog("保存三方信息")
|
||||
@PostMapping
|
||||
@HasPermission("app_social_details_add")
|
||||
public R save(@Valid @RequestBody AppSocialDetails appSocialDetails) {
|
||||
return R.ok(appSocialDetailsService.save(appSocialDetails));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
* @param appSocialDetails
|
||||
* @return R
|
||||
*/
|
||||
@SysLog("修改三方信息")
|
||||
@PutMapping
|
||||
@HasPermission("app_social_details_edit")
|
||||
public R updateById(@Validated({ ValidGroup.Update.class }) @RequestBody AppSocialDetails appSocialDetails) {
|
||||
appSocialDetailsService.updateById(appSocialDetails);
|
||||
return R.ok(Boolean.TRUE);
|
||||
}
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
@SysLog("修改三方信息")
|
||||
@PutMapping
|
||||
@HasPermission("app_social_details_edit")
|
||||
public R updateById(@Validated({ValidGroup.Update.class}) @RequestBody AppSocialDetails appSocialDetails) {
|
||||
appSocialDetailsService.updateById(appSocialDetails);
|
||||
return R.ok(Boolean.TRUE);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
* @param ids
|
||||
* @return R
|
||||
*/
|
||||
@SysLog("删除三方信息")
|
||||
@DeleteMapping
|
||||
@HasPermission("app_social_details_del")
|
||||
public R removeById(@RequestBody Long[] ids) {
|
||||
return R.ok(appSocialDetailsService.removeBatchByIds(CollUtil.toList(ids)));
|
||||
}
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
@SysLog("删除三方信息")
|
||||
@DeleteMapping
|
||||
@HasPermission("app_social_details_del")
|
||||
public R removeById(@RequestBody Long[] ids) {
|
||||
return R.ok(appSocialDetailsService.removeBatchByIds(CollUtil.toList(ids)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过社交账号、手机号查询用户、角色信息
|
||||
* @param inStr appid@code
|
||||
* @return
|
||||
*/
|
||||
@Inner
|
||||
@GetMapping("/info/{inStr}")
|
||||
public R getUserInfo(@PathVariable String inStr) {
|
||||
return R.ok(appSocialDetailsService.getUserInfo(inStr));
|
||||
}
|
||||
/**
|
||||
* 通过社交账号、手机号查询用户、角色信息
|
||||
*/
|
||||
@Inner
|
||||
@GetMapping("/info/{inStr}")
|
||||
public R getUserInfo(@PathVariable String inStr) {
|
||||
return R.ok(appSocialDetailsService.getUserInfo(inStr));
|
||||
}
|
||||
|
||||
/**
|
||||
* 绑定社交账号
|
||||
* @param state 类型
|
||||
* @param code code
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/bind")
|
||||
public R bindSocial(String state, String code) {
|
||||
return R.ok(appSocialDetailsService.bindSocial(state, code));
|
||||
}
|
||||
/**
|
||||
* 绑定社交账号
|
||||
*/
|
||||
@PostMapping("/bind")
|
||||
public R bindSocial(String state, String code) {
|
||||
return R.ok(appSocialDetailsService.bindSocial(state, code));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出
|
||||
*/
|
||||
@GetMapping("/export")
|
||||
@ResponseExcel
|
||||
public List<AppSocialDetails> export(AppSocialDetails appSocialDetails) {
|
||||
return appSocialDetailsService.list(Wrappers.query(appSocialDetails));
|
||||
}
|
||||
/**
|
||||
* 导出
|
||||
*/
|
||||
@GetMapping("/export")
|
||||
@ResponseExcel
|
||||
public List<AppSocialDetails> export(AppSocialDetails appSocialDetails) {
|
||||
return appSocialDetailsService.list(Wrappers.query(appSocialDetails));
|
||||
}
|
||||
|
||||
}
|
||||
+93
-147
@@ -22,6 +22,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.bsd.pjcloud.admin.api.dto.UserInfo;
|
||||
import com.bsd.pjcloud.admin.api.feign.RemoteUserService;
|
||||
import com.bsd.pjcloud.app.api.dto.AppUserDTO;
|
||||
import com.bsd.pjcloud.app.api.dto.AppUserInfo;
|
||||
import com.bsd.pjcloud.app.api.entity.AppUser;
|
||||
import com.bsd.pjcloud.app.api.feign.RemoteAppUserService;
|
||||
import com.bsd.pjcloud.app.api.vo.AppUserExcelVO;
|
||||
@@ -61,155 +62,100 @@ import java.util.List;
|
||||
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
|
||||
public class AppUserController {
|
||||
|
||||
private final AppUserService appUserService;
|
||||
|
||||
|
||||
@Inner
|
||||
@GetMapping("/info/{username}")
|
||||
public R info(@PathVariable String username) {
|
||||
AppUser user = appUserService.getOne(Wrappers.<AppUser>query()
|
||||
.lambda()
|
||||
.eq(AppUser::getUsername, username)
|
||||
.or()
|
||||
.eq(AppUser::getPhone, username));
|
||||
if (user == null) {
|
||||
return R.failed(MsgUtils.getMessage(ErrorCodes.APP_USER_USERINFO_EMPTY, username));
|
||||
}
|
||||
return R.ok(appUserService.findUserInfo(user));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前用户全部信息
|
||||
* @return 用户信息
|
||||
*/
|
||||
@GetMapping(value = { "/info" })
|
||||
public R info() {
|
||||
String username = SecurityUtils.getUser().getUsername();
|
||||
AppUser user = appUserService.getOne(Wrappers.<AppUser>query().lambda().eq(AppUser::getUsername, username));
|
||||
if (user == null) {
|
||||
return R.failed(MsgUtils.getMessage(ErrorCodes.SYS_USER_QUERY_ERROR));
|
||||
}
|
||||
return R.ok(appUserService.findUserInfo(user));
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param page 分页对象
|
||||
* @param appUserDTO app用户表
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "分页查询", description = "分页查询")
|
||||
@GetMapping("/page")
|
||||
public R getAppUserPage(Page page, AppUserDTO appUserDTO) {
|
||||
return R.ok(appUserService.getUsersWithRolePage(page, appUserDTO));
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询app用户表
|
||||
* @param userId id
|
||||
* @return R
|
||||
*/
|
||||
@Operation(summary = "通过id查询", description = "通过id查询")
|
||||
@GetMapping("/details/{userId}")
|
||||
public R getById(@PathVariable("userId") Long userId) {
|
||||
return R.ok(appUserService.selectUserVoById(userId));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return R
|
||||
*/
|
||||
@Operation(summary = "通过userName查询", description = "通过userName查询")
|
||||
@GetMapping("/details")
|
||||
public R getByUserName(AppUser user) {
|
||||
AppUser one = appUserService.getOne(Wrappers.query(user), false);
|
||||
return R.ok(one == null ? null : CommonConstants.SUCCESS);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增app用户表
|
||||
* @param appUser app用户表
|
||||
* @return R
|
||||
*/
|
||||
// @Operation(summary = "新增app用户表", description = "新增app用户表")
|
||||
// @SysLog("新增app用户表")
|
||||
// @PostMapping
|
||||
// @HasPermission("app_appuser_add")
|
||||
// public R save(@RequestBody AppUserDTO appUser) {
|
||||
// appUserService.saveUser(appUser);
|
||||
// return R.ok();
|
||||
// }
|
||||
|
||||
/**
|
||||
* 修改app用户表
|
||||
* @param appUser app用户表
|
||||
* @return R
|
||||
*/
|
||||
@Operation(summary = "修改app用户表", description = "修改app用户表")
|
||||
@SysLog("修改app用户表")
|
||||
@PutMapping
|
||||
@HasPermission("app_appuser_edit")
|
||||
public R updateById(@RequestBody AppUserDTO appUser) {
|
||||
return R.ok(appUserService.updateUser(appUser));
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除app用户表
|
||||
* @param ids userIds
|
||||
* @return R
|
||||
*/
|
||||
@Operation(summary = "通过ids删除app用户表", description = "通过ids删除app用户表")
|
||||
@SysLog("通过id删除app用户表")
|
||||
@DeleteMapping
|
||||
@HasPermission("app_appuser_del")
|
||||
public R removeById(@RequestBody Long[] ids) {
|
||||
return R.ok(appUserService.deleteAppUserByIds(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel 表格
|
||||
// * @param appUser 查询条件
|
||||
* @return excel 文件流
|
||||
*/
|
||||
// @ResponseExcel
|
||||
// @GetMapping("/export")
|
||||
// @HasPermission("app_appuser_export")
|
||||
// public List<AppUserExcelVO> export(AppUserDTO appUser) {
|
||||
// return appUserService.listUser(appUser);
|
||||
// }
|
||||
|
||||
@SysLog("修改个人信息")
|
||||
@PutMapping("/edit")
|
||||
public R updateUserInfo(@Valid @RequestBody AppUserDTO userDto) {
|
||||
if (UserTypeEnum.TOC.getStatus().equals(SecurityUtils.getUser().getUserType())) {
|
||||
userDto.setUserId(SecurityUtils.getUser().getId());
|
||||
// TOC 以手机号为key
|
||||
userDto.setUsername(SecurityUtils.getUser().getUsername());
|
||||
}
|
||||
return appUserService.updateUserInfo(userDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入用户
|
||||
* @param excelVOList 用户列表
|
||||
* @param bindingResult 错误信息列表
|
||||
* @return R
|
||||
*/
|
||||
// @PostMapping("/import")
|
||||
// @HasPermission("app_appuser_export")
|
||||
// public R importUser(@RequestExcel List<AppUserExcelVO> excelVOList, BindingResult bindingResult) {
|
||||
// return appUserService.importUser(excelVOList, bindingResult);
|
||||
// }
|
||||
|
||||
// @Operation(summary = "注册app用户表", description = "注册app用户表")
|
||||
// @SysLog("注册app用户表")
|
||||
// @Inner(value = false)
|
||||
// @PostMapping("/register")
|
||||
// public R register(@RequestBody AppUserDTO appUser) {
|
||||
// return appUserService.registerAppUser(appUser);
|
||||
// }
|
||||
|
||||
private final AppUserService appUserService;
|
||||
|
||||
/* ************************************* start app start ************************************* */
|
||||
|
||||
/**
|
||||
* 获取当前用户全部信息
|
||||
*/
|
||||
@GetMapping(value = {"/info"})
|
||||
public R<AppUserInfo> info() {
|
||||
Long userId = SecurityUtils.getUser().getId();
|
||||
AppUser user = appUserService.getOne(Wrappers.<AppUser>query().lambda().eq(AppUser::getUserId, userId));
|
||||
if (user == null) {
|
||||
return R.failed(MsgUtils.getMessage(ErrorCodes.SYS_USER_QUERY_ERROR));
|
||||
}
|
||||
return R.ok(appUserService.findUserInfo(user));
|
||||
}
|
||||
|
||||
/* ************************************* end app end ************************************* */
|
||||
|
||||
@Inner
|
||||
@GetMapping("/info/{username}")
|
||||
public R info(@PathVariable String username) {
|
||||
AppUser user = appUserService.getOne(Wrappers.<AppUser>query()
|
||||
.lambda()
|
||||
.eq(AppUser::getUsername, username)
|
||||
.or()
|
||||
.eq(AppUser::getPhone, username));
|
||||
if (user == null) {
|
||||
return R.failed(MsgUtils.getMessage(ErrorCodes.APP_USER_USERINFO_EMPTY, username));
|
||||
}
|
||||
return R.ok(appUserService.findUserInfo(user));
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*/
|
||||
@Operation(summary = "分页查询", description = "分页查询")
|
||||
@GetMapping("/page")
|
||||
public R getAppUserPage(Page page, AppUserDTO appUserDTO) {
|
||||
return R.ok(appUserService.getUsersWithRolePage(page, appUserDTO));
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询app用户表
|
||||
*/
|
||||
@Operation(summary = "通过id查询", description = "通过id查询")
|
||||
@GetMapping("/details/{userId}")
|
||||
public R getById(@PathVariable("userId") Long userId) {
|
||||
return R.ok(appUserService.selectUserVoById(userId));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return R
|
||||
*/
|
||||
@Operation(summary = "通过userName查询", description = "通过userName查询")
|
||||
@GetMapping("/details")
|
||||
public R getByUserName(AppUser user) {
|
||||
AppUser one = appUserService.getOne(Wrappers.query(user), false);
|
||||
return R.ok(one == null ? null : CommonConstants.SUCCESS);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改app用户表
|
||||
*/
|
||||
@Operation(summary = "修改app用户表", description = "修改app用户表")
|
||||
@SysLog("修改app用户表")
|
||||
@PutMapping
|
||||
@HasPermission("app_appuser_edit")
|
||||
public R updateById(@RequestBody AppUserDTO appUser) {
|
||||
return R.ok(appUserService.updateUser(appUser));
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除app用户表
|
||||
*/
|
||||
@Operation(summary = "通过ids删除app用户表", description = "通过ids删除app用户表")
|
||||
@SysLog("通过id删除app用户表")
|
||||
@DeleteMapping
|
||||
@HasPermission("app_appuser_del")
|
||||
public R removeById(@RequestBody Long[] ids) {
|
||||
return R.ok(appUserService.deleteAppUserByIds(ids));
|
||||
}
|
||||
|
||||
|
||||
@SysLog("修改个人信息")
|
||||
@PutMapping("/edit")
|
||||
public R updateUserInfo(@Valid @RequestBody AppUserDTO userDto) {
|
||||
if (UserTypeEnum.TOC.getStatus().equals(SecurityUtils.getUser().getUserType())) {
|
||||
userDto.setUserId(SecurityUtils.getUser().getId());
|
||||
// TOC 以手机号为key
|
||||
userDto.setUsername(SecurityUtils.getUser().getUsername());
|
||||
}
|
||||
return appUserService.updateUserInfo(userDto);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+138
@@ -0,0 +1,138 @@
|
||||
package com.bsd.pjcloud.app.handler;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alipay.api.AlipayClient;
|
||||
import com.alipay.api.AlipayConfig;
|
||||
import com.alipay.api.DefaultAlipayClient;
|
||||
import com.alipay.api.request.AlipaySystemOauthTokenRequest;
|
||||
import com.alipay.api.response.AlipaySystemOauthTokenResponse;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.bsd.pjcloud.app.api.dto.AppUserInfo;
|
||||
import com.bsd.pjcloud.app.api.entity.AppUser;
|
||||
import com.bsd.pjcloud.app.config.MiniAlipayConf;
|
||||
import com.bsd.pjcloud.app.mapper.AppSocialDetailsMapper;
|
||||
import com.bsd.pjcloud.app.service.AppUserService;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 支付宝小程序
|
||||
*/
|
||||
@Slf4j
|
||||
@Component("MINI_ALIPAY")
|
||||
@AllArgsConstructor
|
||||
public class MiniAlipayLoginHandler extends AbstractLoginHandler {
|
||||
|
||||
private final MiniAlipayConf miniAlipayConf;
|
||||
|
||||
private final AppUserService appUserService;
|
||||
|
||||
private final AppSocialDetailsMapper appSocialDetailsMapper;
|
||||
|
||||
static private AlipayClient alipayClient = null;
|
||||
|
||||
public AlipayClient getAlipay() {
|
||||
if (ObjectUtil.isNotEmpty(miniAlipayConf)) return getAlipayClient();
|
||||
return getAlipayClient();
|
||||
}
|
||||
|
||||
private synchronized AlipayClient getAlipayClient() {
|
||||
if (alipayClient == null) {
|
||||
try {
|
||||
alipayClient = new DefaultAlipayClient(getAlipayConfig());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("初始化支付宝客户端失败error:{}", e.getMessage());
|
||||
}
|
||||
}
|
||||
return alipayClient;
|
||||
}
|
||||
|
||||
private AlipayConfig getAlipayConfig() {
|
||||
AlipayConfig alipayConfig = new AlipayConfig();
|
||||
alipayConfig.setServerUrl("https://openapi.alipay.com/gateway.do");
|
||||
alipayConfig.setAppId(miniAlipayConf.getAppId());
|
||||
alipayConfig.setPrivateKey(miniAlipayConf.getPrivateKey());
|
||||
alipayConfig.setFormat("json");
|
||||
alipayConfig.setAlipayPublicKey(miniAlipayConf.getAlipayPublicKey());
|
||||
alipayConfig.setCharset("UTF-8");
|
||||
alipayConfig.setSignType("RSA2");
|
||||
return alipayConfig;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取支付宝openId
|
||||
*/
|
||||
public AlipaySystemOauthTokenResponse getOpenId(String code, String refreshToken) {
|
||||
AlipaySystemOauthTokenRequest request = new AlipaySystemOauthTokenRequest();
|
||||
// 设置刷新令牌
|
||||
if (ObjectUtil.isNotEmpty(refreshToken)) {
|
||||
request.setRefreshToken(refreshToken);
|
||||
request.setGrantType("refresh_token");
|
||||
}
|
||||
// 设置授权码
|
||||
if (ObjectUtil.isNotEmpty(code)) {
|
||||
request.setCode(code);
|
||||
request.setGrantType("authorization_code");
|
||||
}
|
||||
try {
|
||||
AlipaySystemOauthTokenResponse response = getAlipay().execute(request);
|
||||
if (!response.isSuccess()) {
|
||||
log.error("|获取支付宝openId|错误error:{}", response.getSubMsg());
|
||||
}
|
||||
return response;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("|获取支付宝openId|意外的错误error:{}", e.getMessage());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过用户传入获取唯一标识
|
||||
*/
|
||||
@Override
|
||||
public String identify(String loginStr) {
|
||||
AlipaySystemOauthTokenResponse res = getOpenId(loginStr, null);
|
||||
if (ObjectUtil.isEmpty(res) || ObjectUtil.isEmpty(res.getOpenId())) {
|
||||
return null;
|
||||
}
|
||||
return res.getOpenId();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户信息
|
||||
*/
|
||||
@Override
|
||||
public AppUserInfo info(String openId) {
|
||||
AppUser user = appUserService.getOne(Wrappers.<AppUser>query().lambda().eq(AppUser::getWxOpenid, openId));
|
||||
if (ObjectUtil.isEmpty(user)) {
|
||||
log.info("支付宝小程序openId:{},创建新的用户", openId);
|
||||
String name = "支付宝游客-" + openId;
|
||||
AppUser appUser = new AppUser();
|
||||
appUser.setWxOpenid(openId);
|
||||
appUser.setUsername(name);
|
||||
appUser.setName(name);
|
||||
appUser.setCreateBy(openId);
|
||||
appUser.setUpdateBy(openId);
|
||||
appUserService.saveOrUpdate(appUser);
|
||||
AppUserInfo appUserDTO = new AppUserInfo();
|
||||
appUserDTO.setAppUser(appUser);
|
||||
return appUserDTO;
|
||||
}
|
||||
return appUserService.findUserInfo(user);
|
||||
}
|
||||
|
||||
/**
|
||||
* 绑定逻辑
|
||||
*/
|
||||
@Override
|
||||
public Boolean bind(AppUser user, String identify) {
|
||||
user.setWxOpenid(identify);
|
||||
appUserService.updateById(user);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+2
-5
@@ -36,15 +36,12 @@ import org.springframework.stereotype.Component;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @author pjcloud
|
||||
* @date 2019年11月02日
|
||||
* <p>
|
||||
* 微信小程序
|
||||
*/
|
||||
@Slf4j
|
||||
@Component("APP-MINI")
|
||||
@Component("MINI_WECHAT")
|
||||
@AllArgsConstructor
|
||||
public class MiniAppLoginHandler extends AbstractLoginHandler {
|
||||
public class MiniWechatLoginHandler extends AbstractLoginHandler {
|
||||
|
||||
private final AppUserService appUserService;
|
||||
|
||||
@@ -16,3 +16,11 @@ spring:
|
||||
import:
|
||||
- optional:nacos:application-@profiles.active@.yml
|
||||
- optional:nacos:${spring.application.name}-@profiles.active@.yml
|
||||
|
||||
mini-ali-pay:
|
||||
app-id: 2021005197658445
|
||||
private-key: MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCTYHY0AW2cjbHoOinD8f4CKMKasDmbRw4CEMasG5IzckmeuTqut3GmxxRRls62zlXRVOCDYgnGhzEhD/nMYx0TMBX2mYo+fH9XUMtZMKY+p2rPTXTlPnGfbQ4edUYofR0tq1ug+wHOD5/jxuwO1zPfB7t8dX3gNa4M43fTPK2mPDeo/UiRB45DPjUWvbMX59ltYYMgmAW0TAbXmRAGKFxrmX3HddJK0jSwEpTcHaRV3C6FrYV48vWHEliviVBUsLRIpwv3T3FYZm0a19LcGQtybeThXaaCYrj7Lwoffk8v8DL2g28IAeiFtjjkWbPFKKMCsSe/LVkvdQTuhncuDayTAgMBAAECggEAJvreiMbP7RZ1Nc0cet0op/2L60otEmrqw5UYVzE7rCvQWRD4+nk+sDP7pdDTf/p3LFTcxSNLHp1nWy1UjsCwUgDn7j+SFxDqxXdzMXXyoqO5VndQMcogV2CK2Xd/RPpCm2+1XpDFW3E6gw58JTi6WYU8C6Ev1/uau4H2kYJ9E3h2W0P0PyY+Q9QNHEpG2hLQdiWLHz3xzmSNSDXiknEg/Whew7IMVKNgxg5VVEBTerwCH5Grvn56CKx6acb6JlU+VFsmW3J1tMYLgxVhJWVVAK6NltmxE5apIxTkG3wEOMuuBCZHQ1Lm0rrGKJh8WmYRs6ho5wSjHYG3hyKRm/0TEQKBgQDcDDPyOWw/o9ZqB3N7qxUi63V7wU7X8QL/CmQO4tu/ng/4Drm8QESjk+ib3O3pCC7xwcte/U1Otw3AmSSj1CWvT8a0yLJM9GVOJwZFVyzy6yVFPyn6l4ndRdargyFokM2lgVTgEHo4WSMbLQsA8/KTB3anqo6bYLjqjsBgY49fpQKBgQCrdLMh5ayJOUK9UeBHXr0c/OLDzwoSUVMyNLfX3pIBC21meFxigNMiy+UKpslM2QMH1yyfwsUKv/i7y1kRFj9Go7pYU0HxglfHecllqXPunWJYuSm38x8WWAG/oqcLPGSlJjHYhU6IAkDuHHaW5DKLxr0x2DkZ/c4TcyYal9Ol1wKBgD4Lls4S0On02W1WIoLZT4FkIOE/NWsAAxdEp8fmwY17FQedp1NkT7ZL60efeNm/O/Vg7mYfSCAMz2ziAYnMNMAE34N0H4pBUxtBN6xvkzX/hafL0ptdBTuGCKydsdrZEZM8L2FqY/vlbleoULT5FAnPDe7i0YkQMbO5gpbrG68dAoGAFv+tc7OSREn5CNotwoUTywqlBG0GRdTA2zA1JPDHFvrIbwFgKxpqt/UvwREEWZmWjXuwkbGXqsx7ef1Z8i/QxxH5UhXA97trOOe+OzPSyEQ2R/52eSVUmzOs8F7KF3i/a2PHNesT0Ky0tvv8cFsl6Jf9Eu2VI0ZnWTaN+u04x7sCgYEAlhpr3RSJk2EnLPR3BxKboTxSGsK/2U4xz/WqX96B+lQ5h7NSMJC35vZJ5dm2vHtLcucHaK49YNsJdq+nzhhwxDz+Dd/5rcIp7AcdHqDsVLHYIN7JWxa9QiC3gvrnWsij1DShydOLpGMYveFz0LyRIUDW4CTs55oDFsIR4HdwtM0=
|
||||
public-key: MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAk2B2NAFtnI2x6Dopw/H+AijCmrA5m0cOAhDGrBuSM3JJnrk6rrdxpscUUZbOts5V0VTgg2IJxocxIQ/5zGMdEzAV9pmKPnx/V1DLWTCmPqdqz0105T5xn20OHnVGKH0dLatboPsBzg+f48bsDtcz3we7fHV94DWuDON30zytpjw3qP1IkQeOQz41Fr2zF+fZbWGDIJgFtEwG15kQBihca5l9x3XSStI0sBKU3B2kVdwuha2FePL1hxJYr4lQVLC0SKcL909xWGZtGtfS3BkLcm3k4V2mgmK4+y8KH35PL/Ay9oNvCAHohbY45FmzxSijArEnvy1ZL3UE7oZ3Lg2skwIDAQAB
|
||||
alipay-public-key: MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqnCB+N172m5gxf1Rolfx5LErSiVwQCh0XQdDrVy6aTuVF5EtdqahSHtADyEPsBWudMBhzCfqpoZvfnvH7a+PED6uZ3DoXt7ETh8TmNM5yc+WTnD8pSphQvuHDJ3zMks489KNxiX6sXag71k9H1MXklJGPOUaljHqy/QlRn2ZLT7pFgaFH9LEcVoQBPIOurUn95078h848RFD30jZFW3fakxUGAGVVZaHH62z5OEWOmcA+CwxsEDMa1XMt02RGXgAAq4WOj+BqOGiFmhM8rnrUMchTyvx4umOzGvbF2Y9irN3aBZ5lfg+bzYcJpIOMzlM/V00LnEWzCblJzXNyH4hJQIDAQAB
|
||||
callback-url: https://rj4jv5rwqs.by.takin.cc/hard/hard-ali-pay/callback
|
||||
# callback-url: https://stgl.pj.gov.cn/api/hard/hard-ali-pay/callback
|
||||
+10
@@ -250,6 +250,16 @@ public interface SecurityConstants {
|
||||
*/
|
||||
String APP = "mobile";
|
||||
|
||||
/**
|
||||
* 游客登录(微信,小程序)
|
||||
*/
|
||||
String VISITOR = "visitor";
|
||||
|
||||
/**
|
||||
* 游客登录(微信,小程序) openId
|
||||
*/
|
||||
String VISITOR_OPEN_ID = "openId";
|
||||
|
||||
/**
|
||||
* 用户信息
|
||||
*/
|
||||
|
||||
+18
-9
@@ -1,22 +1,31 @@
|
||||
package com.bsd.pjcloud.common.core.constant.enums;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum UserTypeEnum {
|
||||
|
||||
TOB("0", "面向后台应用"), TOC("1", "面向小程序");
|
||||
TOB("0", "面向后台应用"),
|
||||
TOC("1", "面向小程序");
|
||||
|
||||
/**
|
||||
* 类型
|
||||
*/
|
||||
private final String status;
|
||||
/**
|
||||
* 类型
|
||||
*/
|
||||
private final String status;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private final String description;
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private final String description;
|
||||
|
||||
public static UserTypeEnum valueOfByStatus(String status) {
|
||||
if (ObjectUtil.isEmpty(status)) return null;
|
||||
return Arrays.stream(values()).filter(v -> ObjectUtil.equals(status, v.getStatus())).findFirst().orElse(null);
|
||||
}
|
||||
|
||||
}
|
||||
+1
@@ -15,6 +15,7 @@ import java.util.Arrays;
|
||||
public enum HardAuthTypeEnum {
|
||||
|
||||
HARD_DDOR_AUTH("10", "智能柜授权"),
|
||||
HARD_DDOR_TOC_AUTH("20", "TOC用户智能柜授权"),
|
||||
;
|
||||
private final String type;
|
||||
private final String description;
|
||||
|
||||
+1
@@ -20,6 +20,7 @@ public enum HardOrderTypeEnum {
|
||||
ZY("5", "正元公务餐"),
|
||||
LB("6", "宁波银行(美好生活)"),
|
||||
FARMER("7", "共富商城(助农)"),
|
||||
TOC_VISITOR("8", "toc访客购买(不记名用户)"),
|
||||
;
|
||||
private final String type;
|
||||
private final String description;
|
||||
|
||||
+6
@@ -1,5 +1,6 @@
|
||||
package com.bsd.pjcloud.hard.api.dto;
|
||||
|
||||
import com.bsd.pjcloud.common.core.constant.enums.UserTypeEnum;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
@@ -12,6 +13,11 @@ public class HardAuthAppDto {
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 用户类型
|
||||
*/
|
||||
private UserTypeEnum userType;
|
||||
|
||||
/**
|
||||
* 授权id
|
||||
*/
|
||||
|
||||
+6
@@ -1,5 +1,6 @@
|
||||
package com.bsd.pjcloud.hard.api.dto;
|
||||
|
||||
import com.bsd.pjcloud.common.core.constant.enums.UserTypeEnum;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
@@ -12,6 +13,11 @@ public class HardGetAuthAppDto {
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 用户类型
|
||||
*/
|
||||
private UserTypeEnum userType;
|
||||
|
||||
/**
|
||||
* 智能柜设备id
|
||||
*/
|
||||
|
||||
+6
@@ -37,6 +37,12 @@ public class HardDoorFlowEntity extends Model<HardDoorFlowEntity> {
|
||||
@Schema(description = "用户编号")
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 用户类型
|
||||
*/
|
||||
@Schema(description = "用户类型")
|
||||
private String userType;
|
||||
|
||||
/**
|
||||
* 业务类型
|
||||
*/
|
||||
|
||||
+12
@@ -78,6 +78,18 @@ public class HardDoorCabinetEntity extends Model<HardDoorCabinetEntity> {
|
||||
@Schema(description = "url二维码")
|
||||
private String urlQrCode;
|
||||
|
||||
/**
|
||||
* 支付宝小程序二维码
|
||||
*/
|
||||
@Schema(description = "支付宝小程序二维码")
|
||||
private String urlAlipayQrCode;
|
||||
|
||||
/**
|
||||
* 微信小程序二维码
|
||||
*/
|
||||
@Schema(description = "微信小程序二维码")
|
||||
private String urlWechatQrCode;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package com.bsd.pjcloud.hard.api.vo.order;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class HardAppCreateThirdDoorOrderVo {
|
||||
|
||||
private Long authId;
|
||||
|
||||
/**
|
||||
* 支付宝订单号
|
||||
*/
|
||||
private String alipayOrderStr;
|
||||
}
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
package com.bsd.pjcloud.hard.config;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 支付宝支付配置
|
||||
*/
|
||||
@Component
|
||||
@ConfigurationProperties(prefix = "mini-ali-pay")
|
||||
@Data
|
||||
public class MiniAlipayConf {
|
||||
|
||||
/**
|
||||
* 应用ID
|
||||
*/
|
||||
private String appId;
|
||||
|
||||
/**
|
||||
* 商户号
|
||||
*/
|
||||
private String merchantId;
|
||||
|
||||
/**
|
||||
* 商户账号
|
||||
*/
|
||||
private String merchantAccount;
|
||||
|
||||
/**
|
||||
* 冻结金额
|
||||
*/
|
||||
private String freezeAmount;
|
||||
|
||||
/**
|
||||
* 私钥
|
||||
*/
|
||||
private String privateKey;
|
||||
|
||||
/**
|
||||
* 公钥
|
||||
*/
|
||||
private String publicKey;
|
||||
|
||||
/**
|
||||
* 支付宝公钥
|
||||
*/
|
||||
private String alipayPublicKey;
|
||||
|
||||
}
|
||||
+14
-1
@@ -4,6 +4,7 @@ import cn.hutool.core.util.ArrayUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.bsd.pjcloud.common.core.constant.enums.UserTypeEnum;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.common.idempotent.annotation.Idempotent;
|
||||
@@ -14,6 +15,7 @@ import com.bsd.pjcloud.hard.api.dto.*;
|
||||
import com.bsd.pjcloud.hard.api.entity.HardAuthEntity;
|
||||
import com.bsd.pjcloud.hard.api.vo.HardAuthVo;
|
||||
import com.bsd.pjcloud.hard.api.vo.HardGetAuthAppVo;
|
||||
import com.bsd.pjcloud.hard.api.vo.order.HardAppCreateThirdDoorOrderVo;
|
||||
import com.bsd.pjcloud.hard.service.HardAuthService;
|
||||
import jakarta.validation.Valid;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
@@ -48,17 +50,28 @@ public class HardAuthController {
|
||||
public R<HardGetAuthAppVo> appGetAuthHardDoor(@Valid @RequestBody HardGetAuthAppDto dto) {
|
||||
PjcloudUser user = SecurityUtils.getUser();
|
||||
dto.setUserId(user.getId());
|
||||
dto.setUserType(UserTypeEnum.valueOfByStatus(user.getUserType()));
|
||||
return R.ok(hardAuthService.appGetAuthHardDoor(dto));
|
||||
}
|
||||
|
||||
@Operation(summary = "app智能柜授权", description = "app智能柜授权")
|
||||
@PostMapping("/app/auth-hard-door")
|
||||
public R appAuthHardDoor(@Valid @RequestBody HardAuthAppDto dto) {
|
||||
public R<Long> appAuthHardDoor(@Valid @RequestBody HardAuthAppDto dto) {
|
||||
PjcloudUser user = SecurityUtils.getUser();
|
||||
dto.setUserId(user.getId());
|
||||
dto.setUserType(UserTypeEnum.valueOfByStatus(user.getUserType()));
|
||||
return R.ok(hardAuthService.appAuthHardDoor(dto));
|
||||
}
|
||||
|
||||
@Operation(summary = "app创建第三方免密支付", description = "app创建第三方免密支付")
|
||||
@PostMapping("/app/auth-create-third-door-order")
|
||||
public R<HardAppCreateThirdDoorOrderVo> appCreateThirdDoorOrder(@Valid @RequestBody HardAuthAppDto dto) {
|
||||
PjcloudUser user = SecurityUtils.getUser();
|
||||
dto.setUserId(user.getId());
|
||||
dto.setUserType(UserTypeEnum.valueOfByStatus(user.getUserType()));
|
||||
return R.ok(hardAuthService.appCreateThirdDoorOrder(dto));
|
||||
}
|
||||
|
||||
/* ************************************* end app end ************************************* */
|
||||
|
||||
@Operation(summary = "流程错误手动处理", description = "流程错误手动处理")
|
||||
|
||||
+7
@@ -10,6 +10,7 @@ import com.bsd.pjcloud.hard.api.dto.HardGetAuthAppDto;
|
||||
import com.bsd.pjcloud.hard.api.entity.HardAuthEntity;
|
||||
import com.bsd.pjcloud.hard.api.vo.HardAuthVo;
|
||||
import com.bsd.pjcloud.hard.api.vo.HardGetAuthAppVo;
|
||||
import com.bsd.pjcloud.hard.api.vo.order.HardAppCreateThirdDoorOrderVo;
|
||||
import jakarta.validation.Valid;
|
||||
|
||||
public interface HardAuthService extends IService<HardAuthEntity> {
|
||||
@@ -26,6 +27,11 @@ public interface HardAuthService extends IService<HardAuthEntity> {
|
||||
*/
|
||||
Long appAuthHardDoor(HardAuthAppDto dto);
|
||||
|
||||
/**
|
||||
* app创建第三方免密支付
|
||||
*/
|
||||
HardAppCreateThirdDoorOrderVo appCreateThirdDoorOrder(@Valid HardAuthAppDto dto);
|
||||
|
||||
/**
|
||||
* 判断当前用户信誉
|
||||
*/
|
||||
@@ -35,4 +41,5 @@ public interface HardAuthService extends IService<HardAuthEntity> {
|
||||
* 流程错误手动处理
|
||||
*/
|
||||
void errorChange(HardAuthErrorChangeDto dto, Long userId);
|
||||
|
||||
}
|
||||
+2
-1
@@ -2,6 +2,7 @@ package com.bsd.pjcloud.hard.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.bsd.pjcloud.common.core.constant.enums.UserTypeEnum;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.hard.api.dto.HardDoorFlowDto;
|
||||
import com.bsd.pjcloud.hard.api.dto.HardDoorFlowOpenDto;
|
||||
@@ -40,7 +41,7 @@ public interface HardDoorFlowService extends IService<HardDoorFlowEntity> {
|
||||
/**
|
||||
* 购买开门
|
||||
*/
|
||||
void openDoorPay(HardDoorFlowOpenDto dto, HardDoorManagerVo hardDoorDetail);
|
||||
void openDoorPay(HardDoorFlowOpenDto dto, HardDoorManagerVo hardDoorDetail, UserTypeEnum userType);
|
||||
|
||||
/**
|
||||
* 上架开门
|
||||
|
||||
+2
-1
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.bsd.pjcloud.admin.api.dto.UserInfo;
|
||||
import com.bsd.pjcloud.admin.api.entity.SysUser;
|
||||
import com.bsd.pjcloud.common.core.constant.enums.UserTypeEnum;
|
||||
import com.bsd.pjcloud.common.core.constant.enums.YesNoEnum;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.common.security.service.PjcloudUser;
|
||||
@@ -90,7 +91,7 @@ public interface HardOrderService extends IService<HardOrderEntity> {
|
||||
/**
|
||||
* 创建智能柜订单
|
||||
*/
|
||||
Long createHardDoorOrder(Long userId, Long hardId);
|
||||
Long createHardDoorOrder(Long userId, UserTypeEnum userType, Long hardId);
|
||||
|
||||
/**
|
||||
* 结算智能柜订单
|
||||
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
package com.bsd.pjcloud.hard.service;
|
||||
|
||||
|
||||
import com.alipay.api.response.AlipayFundAuthOrderAppFreezeResponse;
|
||||
|
||||
public interface MiniAlipayService {
|
||||
|
||||
/**
|
||||
* 获取智能柜小程序二维码
|
||||
*/
|
||||
String getDoorMiniQrCode(String hardDoorId, String cabinetNo);
|
||||
|
||||
/**
|
||||
* 支付宝冻结金额
|
||||
*/
|
||||
AlipayFundAuthOrderAppFreezeResponse freezeAmount(Long authId);
|
||||
}
|
||||
+39
-7
@@ -1,12 +1,14 @@
|
||||
package com.bsd.pjcloud.hard.service.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alipay.api.response.AlipayFundAuthOrderAppFreezeResponse;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.bsd.pjcloud.admin.api.feign.RemoteUserService;
|
||||
import com.bsd.pjcloud.admin.api.utils.DataUtil;
|
||||
import com.bsd.pjcloud.admin.api.vo.UserVO;
|
||||
import com.bsd.pjcloud.common.core.constant.enums.UserTypeEnum;
|
||||
import com.bsd.pjcloud.common.core.constant.enums.YesNoEnum;
|
||||
import com.bsd.pjcloud.common.core.util.CollectionUtils;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
@@ -23,12 +25,11 @@ import com.bsd.pjcloud.hard.api.utils.HardUtil;
|
||||
import com.bsd.pjcloud.hard.api.vo.HardAuthVo;
|
||||
import com.bsd.pjcloud.hard.api.vo.HardGetAuthAppVo;
|
||||
import com.bsd.pjcloud.hard.api.vo.manager.HardDoorManagerVo;
|
||||
import com.bsd.pjcloud.hard.api.vo.order.HardAppCreateThirdDoorOrderVo;
|
||||
import com.bsd.pjcloud.hard.mapper.HardAuthMapper;
|
||||
import com.bsd.pjcloud.hard.mapper.manager.HardManagerMapper;
|
||||
import com.bsd.pjcloud.hard.service.HardAuthService;
|
||||
import com.bsd.pjcloud.hard.service.HardDoorFlowService;
|
||||
import com.bsd.pjcloud.hard.service.HardDoorManagerService;
|
||||
import com.bsd.pjcloud.hard.service.HardOrderService;
|
||||
import com.bsd.pjcloud.hard.service.*;
|
||||
import com.bsd.pjcloud.hard.service.impl.ali.MiniAlipayServiceImpl;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -51,6 +52,7 @@ public class HardAuthServiceImpl extends ServiceImpl<HardAuthMapper, HardAuthEnt
|
||||
private final HardDoorManagerService hardDoorManagerService;
|
||||
private final HardDoorFlowService hardDoorFlowService;
|
||||
private final HardOrderService hardOrderService;
|
||||
private final MiniAlipayService miniAlipayService;
|
||||
|
||||
private final HardManagerMapper hardManagerMapper;
|
||||
|
||||
@@ -73,11 +75,15 @@ public class HardAuthServiceImpl extends ServiceImpl<HardAuthMapper, HardAuthEnt
|
||||
if (ObjectUtil.isEmpty(hardDoorDetail)) {
|
||||
throw new RuntimeException("获取智能柜授权信息错误");
|
||||
}
|
||||
String authType = HardAuthTypeEnum.HARD_DDOR_AUTH.getType();
|
||||
if (ObjectUtil.equals(UserTypeEnum.TOC, dto.getUserType())) {
|
||||
authType = HardAuthTypeEnum.HARD_DDOR_TOC_AUTH.getType();
|
||||
}
|
||||
HardAuthEntity insetObj = HardAuthEntity.builder()
|
||||
.userId(dto.getUserId())
|
||||
.hardId(hardDoorDetail.getHardId())
|
||||
.cabinetNo(dto.getCabinetNo())
|
||||
.authType(HardAuthTypeEnum.HARD_DDOR_AUTH.getType())
|
||||
.authType(authType)
|
||||
.authStatus(YesNoEnum.NO.getCode())
|
||||
.isDone(YesNoEnum.NO.getCode())
|
||||
.build();
|
||||
@@ -99,7 +105,7 @@ public class HardAuthServiceImpl extends ServiceImpl<HardAuthMapper, HardAuthEnt
|
||||
if (ObjectUtil.isEmpty(authEntity)) throw new RuntimeException("授权信息不存在");
|
||||
// 查询设备信息
|
||||
HardDoorManagerVo hardDoorDetail = hardDoorManagerService.getByHardId(authEntity.getHardId());
|
||||
if (ObjectUtil.isEmpty(hardDoorDetail)) throw new RuntimeException("授权信息不存在");
|
||||
if (ObjectUtil.isEmpty(hardDoorDetail)) throw new RuntimeException("设备信息不存在");
|
||||
HardAuthEntity updateObj = HardAuthEntity.builder().id(dto.getAuthId()).authStatus(dto.getAuthStatus()).authTime(LocalDateTime.now()).build();
|
||||
baseMapper.updateById(updateObj);
|
||||
if (ObjectUtil.equals(dto.getAuthStatus(), YesNoEnum.YES.getCode())) {
|
||||
@@ -111,11 +117,37 @@ public class HardAuthServiceImpl extends ServiceImpl<HardAuthMapper, HardAuthEnt
|
||||
openDoorDto.setOpenType(HardDoorOpenTypeEnum.RECORD_VIDEO);
|
||||
openDoorDto.setUserId(dto.getUserId());
|
||||
openDoorDto.setAuthId(dto.getAuthId());
|
||||
hardDoorFlowService.openDoorPay(openDoorDto, hardDoorDetail);
|
||||
hardDoorFlowService.openDoorPay(openDoorDto, hardDoorDetail, dto.getUserType());
|
||||
}
|
||||
return dto.getAuthId();
|
||||
}
|
||||
|
||||
/**
|
||||
* app创建第三方免密支付
|
||||
*/
|
||||
@Override
|
||||
public HardAppCreateThirdDoorOrderVo appCreateThirdDoorOrder(HardAuthAppDto dto) {
|
||||
// 查询授权信息
|
||||
HardAuthEntity authEntity = baseMapper.selectById(dto.getAuthId());
|
||||
if (ObjectUtil.isEmpty(authEntity)) throw new RuntimeException("授权信息不存在");
|
||||
// 查询设备信息
|
||||
HardDoorManagerVo hardDoorDetail = hardDoorManagerService.getByHardId(authEntity.getHardId());
|
||||
if (ObjectUtil.isEmpty(hardDoorDetail)) throw new RuntimeException("设备信息不存在");
|
||||
|
||||
if (ObjectUtil.equals(dto.getAuthStatus(), YesNoEnum.NO.getCode())) {
|
||||
throw new RuntimeException("请先授权");
|
||||
}
|
||||
|
||||
HardAppCreateThirdDoorOrderVo res = new HardAppCreateThirdDoorOrderVo();
|
||||
|
||||
AlipayFundAuthOrderAppFreezeResponse alipayRes = miniAlipayService.freezeAmount(authEntity.getId());
|
||||
if (ObjectUtil.isEmpty(alipayRes)) {
|
||||
throw new RuntimeException("创建支付宝免密订单失败");
|
||||
}
|
||||
res.setAlipayOrderStr(alipayRes.getOrderStr());
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断当前用户信誉
|
||||
*/
|
||||
|
||||
+18
-11
@@ -11,6 +11,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.bsd.pjcloud.admin.api.feign.RemoteUserService;
|
||||
import com.bsd.pjcloud.admin.api.utils.DataUtil;
|
||||
import com.bsd.pjcloud.admin.api.vo.UserVO;
|
||||
import com.bsd.pjcloud.common.core.constant.enums.UserTypeEnum;
|
||||
import com.bsd.pjcloud.common.core.constant.enums.YesNoEnum;
|
||||
import com.bsd.pjcloud.common.core.util.CollectionUtils;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
@@ -125,8 +126,8 @@ public class HardDoorFlowServiceImpl extends ServiceImpl<HardDoorFlowMapper, Har
|
||||
* 开门
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Long openDoor(HardDoorFlowOpenDto dto, HardDoorManagerVo hardDoorVo) {
|
||||
HardDoorFlowEntity saveObj = HardDoorFlowEntity.builder().flowStatus(HardDoorFlowEnum.FLOW_AUTH.getType()).userId(dto.getUserId()).bizType(dto.getFlowType().getType()).isOpen(YesNoEnum.NO.getCode()).build();
|
||||
public Long openDoor(HardDoorFlowOpenDto dto, HardDoorManagerVo hardDoorVo, UserTypeEnum userType) {
|
||||
HardDoorFlowEntity saveObj = HardDoorFlowEntity.builder().flowStatus(HardDoorFlowEnum.FLOW_AUTH.getType()).userId(dto.getUserId()).userType(userType.getStatus()).bizType(dto.getFlowType().getType()).isOpen(YesNoEnum.NO.getCode()).build();
|
||||
baseMapper.insert(saveObj);
|
||||
hardDoorManagerService.refresh(hardDoorVo.getDeviceCode());
|
||||
// 校验设备和货柜编号
|
||||
@@ -161,7 +162,7 @@ public class HardDoorFlowServiceImpl extends ServiceImpl<HardDoorFlowMapper, Har
|
||||
public void openDoorAccess(HardDoorFlowOpenDto dto) {
|
||||
// 查询智能柜
|
||||
HardDoorManagerVo doorDetail = hardDoorManagerService.checkDeviceAndCabinet(dto.getHardDoorId(), dto.getCabinetNo());
|
||||
getSelf().openDoor(dto, doorDetail);
|
||||
getSelf().openDoor(dto, doorDetail, UserTypeEnum.TOB);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -188,14 +189,16 @@ public class HardDoorFlowServiceImpl extends ServiceImpl<HardDoorFlowMapper, Har
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void openDoorPay(HardDoorFlowOpenDto dto, HardDoorManagerVo hardDoorDetail) {
|
||||
public void openDoorPay(HardDoorFlowOpenDto dto, HardDoorManagerVo hardDoorDetail, UserTypeEnum userType) {
|
||||
if (ObjectUtil.isNotEmpty(dto.getHardDoorFlowId()) || ObjectUtil.isEmpty(hardDoorDetail)) {
|
||||
return;
|
||||
}
|
||||
// 查看用户消费钱包余额
|
||||
String walletErrorMsg = remoteWalletService.innserIsUseDoor(dto.getUserId()).getData();
|
||||
if (ObjectUtil.isNotEmpty(walletErrorMsg)) {
|
||||
throw new RuntimeException(walletErrorMsg);
|
||||
if (ObjectUtil.equals(userType, UserTypeEnum.TOB)) {
|
||||
// 查看用户消费钱包余额
|
||||
String walletErrorMsg = remoteWalletService.innserIsUseDoor(dto.getUserId()).getData();
|
||||
if (ObjectUtil.isNotEmpty(walletErrorMsg)) {
|
||||
throw new RuntimeException(walletErrorMsg);
|
||||
}
|
||||
}
|
||||
// 查看用户信誉
|
||||
boolean userCredit = hardAuthService.judgeUserCredit(dto.getUserId());
|
||||
@@ -213,7 +216,7 @@ public class HardDoorFlowServiceImpl extends ServiceImpl<HardDoorFlowMapper, Har
|
||||
// 查询货柜是否配置spu信息
|
||||
List<HardSpuJoinVo> spuList = hardSpuJoinService.getSpuList(hardDoorDetail.getId(), dto.getCabinetNo());
|
||||
if (ObjectUtil.isEmpty(spuList) || spuList.isEmpty()) throw new RuntimeException("货柜商品信息为空,请上架");
|
||||
getSelf().openDoor(dto, hardDoorDetail);
|
||||
getSelf().openDoor(dto, hardDoorDetail, userType);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -223,7 +226,7 @@ public class HardDoorFlowServiceImpl extends ServiceImpl<HardDoorFlowMapper, Har
|
||||
public Long openDoorRepertory(HardDoorFlowOpenDto dto) {
|
||||
// 查询智能柜
|
||||
HardDoorManagerVo doorDetail = hardDoorManagerService.checkDeviceAndCabinet(dto.getHardDoorId(), dto.getCabinetNo());
|
||||
return getSelf().openDoor(dto, doorDetail);
|
||||
return getSelf().openDoor(dto, doorDetail, UserTypeEnum.TOB);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -240,7 +243,11 @@ public class HardDoorFlowServiceImpl extends ServiceImpl<HardDoorFlowMapper, Har
|
||||
// 如果是购买的话
|
||||
if (ObjectUtil.equals(flowDetail.getBizType(), HardDoorFlowBizEnum.PAY_OPEN.getType())) {
|
||||
// 创建订单
|
||||
Long orderId = hardOrderService.createHardDoorOrder(flowDetail.getUserId(), flowDetail.getHardId());
|
||||
UserTypeEnum userType = UserTypeEnum.TOB;
|
||||
if (ObjectUtil.isNotEmpty(flowDetail.getUserType())) {
|
||||
userType = UserTypeEnum.valueOfByStatus(flowDetail.getUserType());
|
||||
}
|
||||
Long orderId = hardOrderService.createHardDoorOrder(flowDetail.getUserId(), userType, flowDetail.getHardId());
|
||||
updateObj.setOrderId(orderId);
|
||||
}
|
||||
baseMapper.updateById(updateObj);
|
||||
|
||||
+116
@@ -0,0 +1,116 @@
|
||||
package com.bsd.pjcloud.hard.service.impl.ali;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alipay.api.AlipayClient;
|
||||
import com.alipay.api.AlipayConfig;
|
||||
import com.alipay.api.DefaultAlipayClient;
|
||||
import com.alipay.api.domain.AlipayFundAuthOrderAppFreezeModel;
|
||||
import com.alipay.api.domain.AlipayOpenAppQrcodeCreateModel;
|
||||
import com.alipay.api.request.AlipayFundAuthOrderAppFreezeRequest;
|
||||
import com.alipay.api.request.AlipayOpenAppQrcodeCreateRequest;
|
||||
import com.alipay.api.response.AlipayFundAuthOrderAppFreezeResponse;
|
||||
import com.alipay.api.response.AlipayOpenAppQrcodeCreateResponse;
|
||||
import com.bsd.pjcloud.hard.config.MiniAlipayConf;
|
||||
import com.bsd.pjcloud.hard.service.MiniAlipayService;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 支付宝小程序支付
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
@Slf4j
|
||||
public class MiniAlipayServiceImpl implements MiniAlipayService {
|
||||
|
||||
private final MiniAlipayConf conf;
|
||||
|
||||
static private AlipayClient client = null;
|
||||
|
||||
private void initClient() {
|
||||
AlipayConfig alipayConfig = new AlipayConfig();
|
||||
alipayConfig.setServerUrl("https://openapi.alipay.com/gateway.do");
|
||||
alipayConfig.setAppId(conf.getAppId());
|
||||
alipayConfig.setPrivateKey(conf.getPrivateKey());
|
||||
alipayConfig.setFormat("json");
|
||||
alipayConfig.setCharset("UTF-8");
|
||||
alipayConfig.setAlipayPublicKey(conf.getAlipayPublicKey());
|
||||
alipayConfig.setSignType("RSA2");
|
||||
try {
|
||||
MiniAlipayServiceImpl.client = new DefaultAlipayClient(alipayConfig);
|
||||
} catch (Exception e) {
|
||||
log.error("初始化支付宝客户端异常", e);
|
||||
}
|
||||
}
|
||||
|
||||
private AlipayClient getClient() {
|
||||
if (ObjectUtil.isEmpty(MiniAlipayServiceImpl.client)) initClient();
|
||||
return MiniAlipayServiceImpl.client;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取智能柜小程序二维码
|
||||
*/
|
||||
@Override
|
||||
public String getDoorMiniQrCode(String hardDoorId, String cabinetNo) {
|
||||
AlipayOpenAppQrcodeCreateRequest request = new AlipayOpenAppQrcodeCreateRequest();
|
||||
AlipayOpenAppQrcodeCreateModel model = new AlipayOpenAppQrcodeCreateModel();
|
||||
model.setUrlParam("pages/tabbar/login");
|
||||
model.setQueryParam(String.format("action=scan&path=%s&hardDoorId=%s&cabinetNo=%s", "pages/tabbar/login", hardDoorId, cabinetNo));
|
||||
model.setDescribe("支付宝智能柜二维码");
|
||||
request.setBizModel(model);
|
||||
try {
|
||||
AlipayOpenAppQrcodeCreateResponse response = getClient().execute(request);
|
||||
if (!response.isSuccess()) {
|
||||
log.error("|获取小程序二维码|失败,json|{}", response.getBody());
|
||||
return null;
|
||||
}
|
||||
return response.getQrCodeUrlCircleBlue();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("|获取小程序二维码|异常", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 支付宝冻结金额
|
||||
*/
|
||||
@Override
|
||||
public AlipayFundAuthOrderAppFreezeResponse freezeAmount(Long authId) {
|
||||
AlipayFundAuthOrderAppFreezeRequest request = new AlipayFundAuthOrderAppFreezeRequest();
|
||||
AlipayFundAuthOrderAppFreezeModel model = new AlipayFundAuthOrderAppFreezeModel();
|
||||
// 商户授权资金订单号(订单id)
|
||||
model.setOutOrderNo(String.valueOf(authId));
|
||||
// 商户本次资金操作的请求流水号,用于标示请求流水的唯一性(流程id)
|
||||
model.setOutRequestNo(String.valueOf(authId));
|
||||
// 订单标题
|
||||
model.setOrderTitle("浦江智能柜押金");
|
||||
// 设置需要冻结的金额(元)
|
||||
model.setAmount(conf.getFreezeAmount());
|
||||
// 设置销售产品码,商家和支付宝签约的产品码(固定)
|
||||
model.setProductCode("PREAUTH_PAY");
|
||||
// 设置收款账户的支付宝用户号
|
||||
model.setPayeeUserId(conf.getMerchantId());
|
||||
// 设置收款账户的支付宝登录号(email或手机号)
|
||||
model.setPayeeLogonId(conf.getMerchantAccount());
|
||||
// 设置预授权订单相对超时时间
|
||||
model.setTimeoutExpress("2d");
|
||||
request.setBizModel(model);
|
||||
try {
|
||||
AlipayFundAuthOrderAppFreezeResponse response = getClient().sdkExecute(request);
|
||||
if (!response.isSuccess()) {
|
||||
log.error("|支付宝冻结金额|失败,json|{}", response.getBody());
|
||||
return null;
|
||||
}
|
||||
log.info("|支付宝冻结金额|成功,json|{}", response.getBody());
|
||||
return response;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("|支付宝冻结金额|意外的错误", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+9
@@ -16,6 +16,7 @@ import com.bsd.pjcloud.hard.api.vo.manager.HardDoorCabinetCodeVo;
|
||||
import com.bsd.pjcloud.hard.api.vo.manager.HardDoorCabinetVo;
|
||||
import com.bsd.pjcloud.hard.mapper.manager.HardDoorCabinetMapper;
|
||||
import com.bsd.pjcloud.hard.service.HardDoorCabinetService;
|
||||
import com.bsd.pjcloud.hard.service.MiniAlipayService;
|
||||
import com.bsd.pjcloud.thirdparty.vo.door.DoorStatusVo;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -40,6 +41,8 @@ public class HardDoorCabinetServiceImpl extends ServiceImpl<HardDoorCabinetMappe
|
||||
|
||||
private static final String TAG = "智能柜货柜";
|
||||
|
||||
private final MiniAlipayService miniAlipayService;
|
||||
|
||||
private final RemoteFileService remoteFileService;
|
||||
|
||||
@Override
|
||||
@@ -105,6 +108,12 @@ public class HardDoorCabinetServiceImpl extends ServiceImpl<HardDoorCabinetMappe
|
||||
updateObj.setId(cabinetDetail.getId());
|
||||
updateObj.setQrCode(qrCode);
|
||||
updateObj.setUrlQrCode(urlQrCode);
|
||||
// 刷新支付宝二维码
|
||||
String doorMiniQrCode = miniAlipayService.getDoorMiniQrCode(String.valueOf(cabinetDetail.getHardDoorId()), String.valueOf(cabinetDetail.getCabinetNo()));
|
||||
if (ObjectUtil.isNotEmpty(doorMiniQrCode)) {
|
||||
updateObj.setUrlAlipayQrCode(doorMiniQrCode);
|
||||
}
|
||||
// 刷新微信小程序
|
||||
baseMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
|
||||
+24
-9
@@ -25,6 +25,7 @@ import com.bsd.pjcloud.common.core.constant.CacheConstants;
|
||||
import com.bsd.pjcloud.common.core.constant.CommonConstants;
|
||||
import com.bsd.pjcloud.common.core.constant.CommonRoleConstant;
|
||||
import com.bsd.pjcloud.common.core.constant.enums.MerchantTypeEnum;
|
||||
import com.bsd.pjcloud.common.core.constant.enums.UserTypeEnum;
|
||||
import com.bsd.pjcloud.common.core.constant.enums.YesNoEnum;
|
||||
import com.bsd.pjcloud.common.core.util.BeanUtils;
|
||||
import com.bsd.pjcloud.common.core.util.CollectionUtils;
|
||||
@@ -869,10 +870,21 @@ public class HardOrderServiceImpl extends ServiceImpl<HardOrderMapper, HardOrder
|
||||
* 创建智能柜订单
|
||||
*/
|
||||
@Override
|
||||
public Long createHardDoorOrder(Long userId, Long hardId) {
|
||||
// 查询用户
|
||||
UserInfo userDetail = userService.getInnerByUserId(userId).getData();
|
||||
if (ObjectUtil.isEmpty(userDetail)) throw new RuntimeException("创建智能柜订单失败,用户不存在");
|
||||
public Long createHardDoorOrder(Long userId, UserTypeEnum userType, Long hardId) {
|
||||
Long currentUserId = null;
|
||||
Long currentUserDeptId = null;
|
||||
Long currentWalletId = null;
|
||||
// 查询TOB用户
|
||||
if (ObjectUtil.equals(userType, UserTypeEnum.TOB)) {
|
||||
UserInfo userDetail = userService.getInnerByUserId(userId).getData();
|
||||
if (ObjectUtil.isEmpty(userDetail)) throw new RuntimeException("创建智能柜订单失败,用户不存在");
|
||||
currentUserId = userDetail.getSysUser().getUserId();
|
||||
currentUserDeptId = userDetail.getSysUser().getDeptId();
|
||||
}
|
||||
// 查询TOC用户
|
||||
else {
|
||||
|
||||
}
|
||||
// 查询设备
|
||||
HardManagerVo hard = hardManagerService.getByHardId(hardId);
|
||||
if (ObjectUtil.isEmpty(hard)) throw new RuntimeException("创建智能柜订单失败,设备不存在");
|
||||
@@ -880,16 +892,19 @@ public class HardOrderServiceImpl extends ServiceImpl<HardOrderMapper, HardOrder
|
||||
MchManageVo mch = remoteMchService.getById(hard.getMerchantId()).getData();
|
||||
if (ObjectUtil.isEmpty(hard)) throw new RuntimeException("创建智能柜订单失败,商户不存在");
|
||||
// 默认超市钱包
|
||||
WalletManageEntity wallet = remoteWalletService.getWallet(userId, WalletTypeEnum.PAY).getData();
|
||||
if (ObjectUtil.isEmpty(wallet)) throw new RuntimeException("创建智能柜订单失败,用户消费钱包不存在");
|
||||
if (ObjectUtil.equals(userType, UserTypeEnum.TOB)) {
|
||||
WalletManageEntity wallet = remoteWalletService.getWallet(userId, WalletTypeEnum.PAY).getData();
|
||||
if (ObjectUtil.isEmpty(wallet)) throw new RuntimeException("创建智能柜订单失败,用户消费钱包不存在");
|
||||
currentWalletId = wallet.getId();
|
||||
}
|
||||
HardOrderEntity orderObj = HardOrderEntity.builder()
|
||||
.walletId(wallet.getId())
|
||||
.walletId(currentWalletId)
|
||||
.hardId(hardId)
|
||||
.merchantType(mch.getTypes())
|
||||
.merchantId(mch.getId())
|
||||
.merchantDeptId(mch.getDeptId())
|
||||
.userId(userDetail.getSysUser().getUserId())
|
||||
.userDeptId(userDetail.getSysUser().getDeptId())
|
||||
.userId(currentUserId)
|
||||
.userDeptId(currentUserDeptId)
|
||||
.sysType(HardTypeEnum.DOOR.getType())
|
||||
.orderStatus(HardOrderStatusEnum.CREATE.getType())
|
||||
.orderType(HardOrderTypeEnum.BELOW.getType())
|
||||
|
||||
@@ -40,4 +40,14 @@ spring:
|
||||
# public-key: MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA2thnpmLBNBxMQ1/LRLu5Ld3FT5D8iT4GZJZMjJqSNbkwbAPKnCgaEvPH3g/0Pn97OnrRqAcU4pZ97wVWQTBhsKS/G3MRrtSC3HmvDwTrCn3URResDeA7C7VS/ujtpCvUgzqmZELf2xFRN7V5Y8bUPooFNK2mViEkF1gsHpMs4OAkC3zAaCY9PyReGaYsNnWLwUSoBJ0fB+6cwgESbjewdxuDVq38kchZ+vovqA5hXMA9nsMEPIF/R3u5qoJ/v3Ii0YJv8odKKyinxAhX0FB97WVVufUFO2AF7cj3aUxgqbWZDOaa4fWwhlSqDp+0tORUclCcUQ/XRHp/KclTDoUjEQIDAQAB
|
||||
# alipay-public-key: MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqnCB+N172m5gxf1Rolfx5LErSiVwQCh0XQdDrVy6aTuVF5EtdqahSHtADyEPsBWudMBhzCfqpoZvfnvH7a+PED6uZ3DoXt7ETh8TmNM5yc+WTnD8pSphQvuHDJ3zMks489KNxiX6sXag71k9H1MXklJGPOUaljHqy/QlRn2ZLT7pFgaFH9LEcVoQBPIOurUn95078h848RFD30jZFW3fakxUGAGVVZaHH62z5OEWOmcA+CwxsEDMa1XMt02RGXgAAq4WOj+BqOGiFmhM8rnrUMchTyvx4umOzGvbF2Y9irN3aBZ5lfg+bzYcJpIOMzlM/V00LnEWzCblJzXNyH4hJQIDAQAB
|
||||
# callback-url: https://rj4jv5rwqs.by.takin.cc/hard/hard-ali-pay/callback
|
||||
# # callback-url: https://stgl.pj.gov.cn/api/hard/hard-ali-pay/callback
|
||||
# # callback-url: https://stgl.pj.gov.cn/api/hard/hard-ali-pay/callback
|
||||
mini-ali-pay:
|
||||
app-id: 2021005197658445
|
||||
merchant-id: 2088570073831141
|
||||
merchant-account: 1472871899@qq.com
|
||||
freeze-amount: 100
|
||||
private-key: MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCTYHY0AW2cjbHoOinD8f4CKMKasDmbRw4CEMasG5IzckmeuTqut3GmxxRRls62zlXRVOCDYgnGhzEhD/nMYx0TMBX2mYo+fH9XUMtZMKY+p2rPTXTlPnGfbQ4edUYofR0tq1ug+wHOD5/jxuwO1zPfB7t8dX3gNa4M43fTPK2mPDeo/UiRB45DPjUWvbMX59ltYYMgmAW0TAbXmRAGKFxrmX3HddJK0jSwEpTcHaRV3C6FrYV48vWHEliviVBUsLRIpwv3T3FYZm0a19LcGQtybeThXaaCYrj7Lwoffk8v8DL2g28IAeiFtjjkWbPFKKMCsSe/LVkvdQTuhncuDayTAgMBAAECggEAJvreiMbP7RZ1Nc0cet0op/2L60otEmrqw5UYVzE7rCvQWRD4+nk+sDP7pdDTf/p3LFTcxSNLHp1nWy1UjsCwUgDn7j+SFxDqxXdzMXXyoqO5VndQMcogV2CK2Xd/RPpCm2+1XpDFW3E6gw58JTi6WYU8C6Ev1/uau4H2kYJ9E3h2W0P0PyY+Q9QNHEpG2hLQdiWLHz3xzmSNSDXiknEg/Whew7IMVKNgxg5VVEBTerwCH5Grvn56CKx6acb6JlU+VFsmW3J1tMYLgxVhJWVVAK6NltmxE5apIxTkG3wEOMuuBCZHQ1Lm0rrGKJh8WmYRs6ho5wSjHYG3hyKRm/0TEQKBgQDcDDPyOWw/o9ZqB3N7qxUi63V7wU7X8QL/CmQO4tu/ng/4Drm8QESjk+ib3O3pCC7xwcte/U1Otw3AmSSj1CWvT8a0yLJM9GVOJwZFVyzy6yVFPyn6l4ndRdargyFokM2lgVTgEHo4WSMbLQsA8/KTB3anqo6bYLjqjsBgY49fpQKBgQCrdLMh5ayJOUK9UeBHXr0c/OLDzwoSUVMyNLfX3pIBC21meFxigNMiy+UKpslM2QMH1yyfwsUKv/i7y1kRFj9Go7pYU0HxglfHecllqXPunWJYuSm38x8WWAG/oqcLPGSlJjHYhU6IAkDuHHaW5DKLxr0x2DkZ/c4TcyYal9Ol1wKBgD4Lls4S0On02W1WIoLZT4FkIOE/NWsAAxdEp8fmwY17FQedp1NkT7ZL60efeNm/O/Vg7mYfSCAMz2ziAYnMNMAE34N0H4pBUxtBN6xvkzX/hafL0ptdBTuGCKydsdrZEZM8L2FqY/vlbleoULT5FAnPDe7i0YkQMbO5gpbrG68dAoGAFv+tc7OSREn5CNotwoUTywqlBG0GRdTA2zA1JPDHFvrIbwFgKxpqt/UvwREEWZmWjXuwkbGXqsx7ef1Z8i/QxxH5UhXA97trOOe+OzPSyEQ2R/52eSVUmzOs8F7KF3i/a2PHNesT0Ky0tvv8cFsl6Jf9Eu2VI0ZnWTaN+u04x7sCgYEAlhpr3RSJk2EnLPR3BxKboTxSGsK/2U4xz/WqX96B+lQ5h7NSMJC35vZJ5dm2vHtLcucHaK49YNsJdq+nzhhwxDz+Dd/5rcIp7AcdHqDsVLHYIN7JWxa9QiC3gvrnWsij1DShydOLpGMYveFz0LyRIUDW4CTs55oDFsIR4HdwtM0=
|
||||
public-key: MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAk2B2NAFtnI2x6Dopw/H+AijCmrA5m0cOAhDGrBuSM3JJnrk6rrdxpscUUZbOts5V0VTgg2IJxocxIQ/5zGMdEzAV9pmKPnx/V1DLWTCmPqdqz0105T5xn20OHnVGKH0dLatboPsBzg+f48bsDtcz3we7fHV94DWuDON30zytpjw3qP1IkQeOQz41Fr2zF+fZbWGDIJgFtEwG15kQBihca5l9x3XSStI0sBKU3B2kVdwuha2FePL1hxJYr4lQVLC0SKcL909xWGZtGtfS3BkLcm3k4V2mgmK4+y8KH35PL/Ay9oNvCAHohbY45FmzxSijArEnvy1ZL3UE7oZ3Lg2skwIDAQAB
|
||||
alipay-public-key: MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqnCB+N172m5gxf1Rolfx5LErSiVwQCh0XQdDrVy6aTuVF5EtdqahSHtADyEPsBWudMBhzCfqpoZvfnvH7a+PED6uZ3DoXt7ETh8TmNM5yc+WTnD8pSphQvuHDJ3zMks489KNxiX6sXag71k9H1MXklJGPOUaljHqy/QlRn2ZLT7pFgaFH9LEcVoQBPIOurUn95078h848RFD30jZFW3fakxUGAGVVZaHH62z5OEWOmcA+CwxsEDMa1XMt02RGXgAAq4WOj+BqOGiFmhM8rnrUMchTyvx4umOzGvbF2Y9irN3aBZ5lfg+bzYcJpIOMzlM/V00LnEWzCblJzXNyH4hJQIDAQAB
|
||||
callback-url: https://rj4jv5rwqs.by.takin.cc/hard/hard-ali-pay/callback
|
||||
# callback-url: https://stgl.pj.gov.cn/api/hard/hard-ali-pay/callback
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
package com.bsd.pjcloud.admin.api.constant.visitor;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* 访客类型
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public enum VisitorBizEnum {
|
||||
|
||||
WECHAT("10", "微信小程序"),
|
||||
ALIPAY("20", "支付宝小程序"),
|
||||
;
|
||||
private final String type;
|
||||
private final String description;
|
||||
|
||||
public static VisitorBizEnum valueOfByType(String type) {
|
||||
if (ObjectUtil.isEmpty(type)) return null;
|
||||
return Arrays.stream(values()).filter(v -> ObjectUtil.equals(type, v.getType())).findFirst().get();
|
||||
}
|
||||
|
||||
}
|
||||
+3
@@ -545,6 +545,9 @@ public class WalletManageServiceImpl extends ServiceImpl<WalletManageMapper, Wal
|
||||
@Override
|
||||
public String isUseDoor(Long userId) {
|
||||
WalletManageEntity wallet = getWallet(userId, WalletTypeEnum.PAY);
|
||||
if (ObjectUtil.isEmpty(wallet)) {
|
||||
return "用户没有钱包";
|
||||
}
|
||||
if (wallet.getBalance() >= 100 * 100) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -16,7 +16,9 @@
|
||||
~ this software without specific prior written permission.
|
||||
~ Author: pjcloud
|
||||
~
|
||||
--><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
-->
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>com.bsd</groupId>
|
||||
@@ -116,16 +118,16 @@
|
||||
<module>pjcloud-common</module>
|
||||
<module>pjcloud-flow</module>
|
||||
<module>pjcloud-visual</module>
|
||||
<!-- <module>pjcloud-app-server</module>-->
|
||||
<module>pjcloud-app-server</module>
|
||||
<module>pjcloud-thirdparty</module>
|
||||
<module>pjcloud-canteen</module>
|
||||
<module>pjcloud-integrated</module>
|
||||
<module>pjcloud-wallet</module>
|
||||
<module>pjcloud-supermarket</module>
|
||||
<module>pjcloud-hardware</module>
|
||||
<module>pjcloud-mqtt</module>
|
||||
<module>pjcloud-pass</module>
|
||||
</modules>
|
||||
<module>pjcloud-mqtt</module>
|
||||
<module>pjcloud-pass</module>
|
||||
</modules>
|
||||
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
|
||||
Reference in new issue
Block a user