update 租赁系统1.1.0 新增登录系统,准备迁移该模块为独立模块
This commit is contained in:
@@ -2,6 +2,7 @@ package com.m2pool.lease.config;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.servlet.config.annotation.CorsRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
@@ -18,4 +19,21 @@ public class WebMvcConfig implements WebMvcConfigurer {
|
||||
registry.addInterceptor(loginInterceptor)
|
||||
.addPathPatterns("/**");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCorsMappings(CorsRegistry registry) {
|
||||
|
||||
// 设置允许跨域请求路径
|
||||
registry.addMapping("/**")
|
||||
// 设置允许跨域请求的域名
|
||||
.allowedOriginPatterns("*") //或.allowedOriginPatterns("http://www.baidu.com") 指定域名
|
||||
//是否允许cookie
|
||||
.allowCredentials(true)
|
||||
// 设置允许的请求方式
|
||||
.allowedMethods("GET", "POST", "PUT", "DELETE")
|
||||
// 设置允许的header属性
|
||||
.allowedHeaders("*")
|
||||
// 允许跨域时间
|
||||
.maxAge(3600);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,7 +49,6 @@ public class LeaseAuthController {
|
||||
}
|
||||
|
||||
@Decrypt
|
||||
@LoginRequired
|
||||
@PostMapping("/updatePassword")
|
||||
@ApiOperation(value = "修改密码")
|
||||
public Result<String> updatePassword(@RequestBody UserLoginVo userLoginVo){
|
||||
|
||||
@@ -70,7 +70,8 @@ public class LeaseMachineServiceImpl extends ServiceImpl<LeaseMachineMapper, Lea
|
||||
//获取到矿机
|
||||
Set<Long> shopIds = leaseMachineMapper.getShopIds();
|
||||
if (shopIds.isEmpty()){
|
||||
return PageResult.fail(new ArrayList<>(), "暂无商品");
|
||||
//店铺不存在商品
|
||||
return PageResult.success(new ArrayList<>());
|
||||
}
|
||||
PageHelper.startPage(productPageVo.getPageNum(), productPageVo.getPageSize());
|
||||
List<ShopInfoDto> existsMachineShop = leaseMachineMapper.getExistsMachineShop(shopIds, productPageVo.getCoin(), productPageVo.getAlgorithm());
|
||||
@@ -211,13 +212,15 @@ public class LeaseMachineServiceImpl extends ServiceImpl<LeaseMachineMapper, Lea
|
||||
public PageResult<SellerMachineInfoDto> getShopMachineListForSeller(SellerMachineVo sellerMachineVo) {
|
||||
LeaseShop leaseShop = getShopById();
|
||||
if (leaseShop == null){
|
||||
return PageResult.fail(new ArrayList<>(), "暂无店铺");
|
||||
//店铺未创建
|
||||
return PageResult.success(new ArrayList<>());
|
||||
}
|
||||
PageHelper.startPage(sellerMachineVo.getPageNum(), sellerMachineVo.getPageSize());
|
||||
List<SellerMachineInfoDto> machineInfoDtoList = leaseMachineMapper.getShopMachineListForSeller(sellerMachineVo,leaseShop.getId());
|
||||
PageInfo<SellerMachineInfoDto> pageInfo = new PageInfo<>(machineInfoDtoList);
|
||||
if (machineInfoDtoList.isEmpty()){
|
||||
return PageResult.fail(new ArrayList<>(), "暂无矿机");
|
||||
//不存在矿机
|
||||
return PageResult.success(new ArrayList<>());
|
||||
}
|
||||
PageResult<SellerMachineInfoDto> success = PageResult.success(machineInfoDtoList);
|
||||
//获取矿机配置信息
|
||||
|
||||
@@ -444,7 +444,7 @@ public class LeaseOrderInfoServiceImpl extends ServiceImpl<LeaseOrderInfoMapper,
|
||||
PageInfo<OrderInfoDto> pageInfo = new PageInfo<>(ordersByStatus);
|
||||
List<Long> ids = ordersByStatus.stream().map(OrderInfoDto::getId).collect(Collectors.toList());
|
||||
if (ids.isEmpty()){
|
||||
return PageResult.fail(new ArrayList<>(),"不存在订单");
|
||||
return PageResult.success(new ArrayList<>());
|
||||
}
|
||||
//获取订单对应的订单详情列表
|
||||
List<LeaseOrderItem> leaseOrderItems = leaseOrderItemMapper.selectList(new QueryWrapper<LeaseOrderItem>()
|
||||
@@ -467,13 +467,15 @@ public class LeaseOrderInfoServiceImpl extends ServiceImpl<LeaseOrderInfoMapper,
|
||||
LeaseShop leaseShop = leaseShopMapper.selectOne(new LambdaQueryWrapper<LeaseShop>()
|
||||
.eq(LeaseShop::getUserEmail, SecurityUtils.getUsername()));
|
||||
if (leaseShop == null){
|
||||
return PageResult.fail(new ArrayList<>(),"不存在商铺");
|
||||
//店铺不存在
|
||||
return PageResult.success(new ArrayList<>());
|
||||
}
|
||||
//查询到商铺的所有订单
|
||||
List<LeaseOrderItem> orderItemList = leaseOrderItemMapper.selectList(new LambdaQueryWrapper<LeaseOrderItem>()
|
||||
.eq(LeaseOrderItem::getShopId, leaseShop.getId()));
|
||||
if (orderItemList.isEmpty()){
|
||||
return PageResult.fail(new ArrayList<>(),"不存在订单");
|
||||
//订单不存在
|
||||
return PageResult.success(new ArrayList<>());
|
||||
}
|
||||
List<Long> orderInfoIds = orderItemList.stream().map(LeaseOrderItem::getOrderId).distinct().collect(Collectors.toList());
|
||||
PageHelper.startPage(orderInfoStateVo.getPageNum(), orderInfoStateVo.getPageSize());
|
||||
|
||||
@@ -251,7 +251,8 @@ public class LeaseProductServiceImpl extends ServiceImpl<LeaseProductMapper, Lea
|
||||
.eq(LeaseShop::getUserEmail, SecurityUtils.getUsername())
|
||||
.eq(LeaseShop::getDel, false));
|
||||
if (leaseShop == null){
|
||||
return Result.fail("店铺不存在");
|
||||
//店铺不存在
|
||||
return Result.success(null);
|
||||
}
|
||||
List<PayConfigDto> shopWalletInfo = leaseShopMapper.getShopWalletInfo(leaseShop.getId());
|
||||
return Result.success(shopWalletInfo);
|
||||
|
||||
@@ -186,7 +186,7 @@ public class LeaseShopServiceImpl extends ServiceImpl<LeaseShopMapper, LeaseShop
|
||||
.del(leaseShop.getDel())
|
||||
.build());
|
||||
}
|
||||
return Result.fail("未找到商铺,请创建商铺");
|
||||
return Result.success(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -290,14 +290,14 @@ public class LeaseUserServiceImpl extends ServiceImpl<LeaseUserMapper, LeaseUser
|
||||
//1.校验密码,邮箱等参数格式
|
||||
verifyParams(email,password);
|
||||
//2.验证码校验
|
||||
verifyCode(RedisAuthKey.getRegisterCodeKey(email),userLoginVo.getCode());
|
||||
verifyCode(RedisAuthKey.getUpdatePasswordCodeKey(email),userLoginVo.getCode());
|
||||
//3.修改密码
|
||||
LeaseUser user = getUser(email);
|
||||
if (CryptoUtils.matchesPassword(password, user.getPassword())){
|
||||
throw new AuthException("新密码不能与原密码一致");
|
||||
}
|
||||
String updatePasswordCodeKey = RedisAuthKey.getUpdatePasswordCodeKey(email);
|
||||
if ( redisService.hasKey(updatePasswordCodeKey)){
|
||||
if (redisService.hasKey(updatePasswordCodeKey)){
|
||||
Object o = redisService.getCacheObject(updatePasswordCodeKey);//user:emailCode:username
|
||||
EmailCodeValue emailCodeValue = JSON.parseObject(JSON.toJSONString(o), EmailCodeValue.class);
|
||||
if(updatePwdCode.equals(emailCodeValue.getEmailCode())){
|
||||
@@ -548,7 +548,6 @@ public class LeaseUserServiceImpl extends ServiceImpl<LeaseUserMapper, LeaseUser
|
||||
|
||||
// 发送邮件
|
||||
javaMailSender.send(message);
|
||||
System.out.println("发送邮件成功:"+sendMailer+"->"+to);
|
||||
} catch (Exception e) {
|
||||
System.out.println("发送失败原因"+e.getMessage());
|
||||
throw new AuthException("发送邮箱验证码失败,请稍后重试");
|
||||
@@ -654,7 +653,7 @@ public class LeaseUserServiceImpl extends ServiceImpl<LeaseUserMapper, LeaseUser
|
||||
List<UserWalletDataDto> collect = userWalletDataDto.stream().peek(item -> item.setBalance(item.getBalance().subtract(item.getBlockedBalance()))).collect(Collectors.toList());
|
||||
return Result.success(collect);
|
||||
}
|
||||
return Result.fail("未绑定钱包");
|
||||
return Result.success(null);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -812,7 +811,6 @@ public class LeaseUserServiceImpl extends ServiceImpl<LeaseUserMapper, LeaseUser
|
||||
public PageResult<PayWithdrawMessageDto> balanceWithdrawList(BalancePageVo balancePageVo) {
|
||||
|
||||
String userEmail = SecurityUtils.getUsername();
|
||||
System.out.println("用户"+userEmail+"提现列表");
|
||||
List<LeaseUserWalletData> walletList = leaseUserWalletDataMapper.selectList(new LambdaQueryWrapper<LeaseUserWalletData>()
|
||||
.eq(LeaseUserWalletData::getUserId,userEmail));
|
||||
PageHelper.startPage(balancePageVo.getPageNum(), balancePageVo.getPageSize());
|
||||
@@ -821,7 +819,6 @@ public class LeaseUserServiceImpl extends ServiceImpl<LeaseUserMapper, LeaseUser
|
||||
walletList,
|
||||
balancePageVo.getStatus());
|
||||
PageInfo<PayWithdrawMessageDto> pageInfo = new PageInfo<>(payWithdrawMessageDtos);
|
||||
System.out.println(userEmail + "用户提现" + payWithdrawMessageDtos);
|
||||
PageResult<PayWithdrawMessageDto> success = PageResult.success(payWithdrawMessageDtos);
|
||||
success.setTotal(pageInfo.getTotal());
|
||||
success.setTotalPage(pageInfo.getPages());
|
||||
@@ -849,13 +846,15 @@ public class LeaseUserServiceImpl extends ServiceImpl<LeaseUserMapper, LeaseUser
|
||||
//获取店铺信息
|
||||
LeaseShop leaseShop = leaseShopMapper.selectOne(new LambdaQueryWrapper<LeaseShop>().eq(LeaseShop::getUserEmail, SecurityUtils.getUsername()));
|
||||
if (leaseShop == null){
|
||||
return PageResult.fail(null,"查看交易信息失败");
|
||||
//不存在店铺
|
||||
return PageResult.success(new ArrayList<>());
|
||||
}
|
||||
//获取卖家的自定义钱包地址
|
||||
List<LeaseShopConfig> leaseShopConfigs = leaseShopConfigMapper.selectList(new LambdaQueryWrapper<LeaseShopConfig>()
|
||||
.eq(LeaseShopConfig::getShopId, leaseShop.getId()));
|
||||
if(leaseShopConfigs.isEmpty()){
|
||||
return PageResult.fail(null,"未绑定钱包,不存在交易流水");
|
||||
//交易流水为空
|
||||
return PageResult.success(new ArrayList<>());
|
||||
}
|
||||
PageHelper.startPage(balancePageVo.getPageNum(), balancePageVo.getPageSize());
|
||||
List<PayRecordMessageDto> payRecordMessageDtos = leasePayRecordMessageMapper.balancePayList(leaseShopConfigs,balancePageVo.getStatus());
|
||||
@@ -874,7 +873,8 @@ public class LeaseUserServiceImpl extends ServiceImpl<LeaseUserMapper, LeaseUser
|
||||
List<LeaseUserWalletData> walletList = leaseUserWalletDataMapper.selectList(new LambdaQueryWrapper<LeaseUserWalletData>()
|
||||
.eq(LeaseUserWalletData::getUserId, SecurityUtils.getUsername()));
|
||||
if (walletList.isEmpty()){
|
||||
return PageResult.fail(null,"未绑定钱包,不存在交易流水");
|
||||
//不存在钱包
|
||||
return PageResult.success(new ArrayList<>());
|
||||
}
|
||||
PageHelper.startPage(recordTypePageVo.getPageNum(), recordTypePageVo.getPageSize());
|
||||
List<TransactionRecordDto> transactionRecordDtoList = new ArrayList<>();
|
||||
@@ -903,8 +903,9 @@ public class LeaseUserServiceImpl extends ServiceImpl<LeaseUserMapper, LeaseUser
|
||||
public Result<List<RecentlyTransactionDto>> getRecentlyTransaction() {
|
||||
List<LeaseUserWalletData> walletList = leaseUserWalletDataMapper.selectList(new LambdaQueryWrapper<LeaseUserWalletData>()
|
||||
.eq(LeaseUserWalletData::getUserId, SecurityUtils.getUsername()));
|
||||
List<RecentlyTransactionDto> recentlyTransaction = new ArrayList<>();
|
||||
if (!walletList.isEmpty()){
|
||||
List<RecentlyTransactionDto> recentlyTransaction = leasePayRecordMessageMapper.getRecentlyTransaction(walletList);
|
||||
recentlyTransaction = leasePayRecordMessageMapper.getRecentlyTransaction(walletList);
|
||||
recentlyTransaction.addAll(leasePayWithdrawMessageMapper.getRecentlyTransaction(walletList)) ;
|
||||
recentlyTransaction.addAll(leasePayRechargeMessageMapper.getRecentlyTransaction(walletList));
|
||||
// 按 updateTime 倒序排序,并取前五个元素
|
||||
@@ -912,9 +913,8 @@ public class LeaseUserServiceImpl extends ServiceImpl<LeaseUserMapper, LeaseUser
|
||||
.sorted((dto1, dto2) -> dto2.getUpdateTime().compareTo(dto1.getUpdateTime()))
|
||||
.limit(5)
|
||||
.collect(Collectors.toList());
|
||||
return Result.success(recentlyTransaction);
|
||||
}
|
||||
return Result.fail("交易记录为空");
|
||||
return Result.success(recentlyTransaction);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user