init
This commit is contained in:
@@ -171,5 +171,8 @@ spring:
|
|||||||
virtual-host: /cai
|
virtual-host: /cai
|
||||||
agora:
|
agora:
|
||||||
app-id: app
|
app-id: app
|
||||||
key: key
|
key: 627b8e17b0c616c1346cba2d87e10251
|
||||||
secret: secret
|
secret: c47628fe2538
|
||||||
|
yunxin:
|
||||||
|
app-key: 627b8e17b0c616c1346cba2d87e10251
|
||||||
|
app-secret: c47628fe2538
|
||||||
|
|||||||
@@ -176,3 +176,6 @@ agora:
|
|||||||
app-id: app
|
app-id: app
|
||||||
key: key
|
key: key
|
||||||
secret: secret
|
secret: secret
|
||||||
|
yunxin:
|
||||||
|
app-key: 627b8e17b0c616c1346cba2d87e10251
|
||||||
|
app-secret: c47628fe2538
|
||||||
|
|||||||
@@ -135,7 +135,9 @@ security:
|
|||||||
# swagger 文档配置
|
# swagger 文档配置
|
||||||
- /*/api-docs
|
- /*/api-docs
|
||||||
- /*/api-docs/**
|
- /*/api-docs/**
|
||||||
|
- /v3/api-docs/swagger-config
|
||||||
- /doc.html
|
- /doc.html
|
||||||
|
- /doc.html#/
|
||||||
- /swagger-resources/**
|
- /swagger-resources/**
|
||||||
- /webjars/**
|
- /webjars/**
|
||||||
# actuator 监控配置
|
# actuator 监控配置
|
||||||
|
|||||||
@@ -140,7 +140,7 @@ public class CaiLoginManager {
|
|||||||
}
|
}
|
||||||
String key = LockManager.getDealInviteLockKey(inviteId);
|
String key = LockManager.getDealInviteLockKey(inviteId);
|
||||||
RLock lock = redissonClient.getLock(key);
|
RLock lock = redissonClient.getLock(key);
|
||||||
if(!lock.isLocked()){
|
if(lock.isLocked()){
|
||||||
log.warn("点击太快了,等一等,dealInviteId");
|
log.warn("点击太快了,等一等,dealInviteId");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -191,7 +191,7 @@ public class CaiLoginManager {
|
|||||||
UserInfo userInfo = userInfoService.getById(user.getId());
|
UserInfo userInfo = userInfoService.getById(user.getId());
|
||||||
UserInfo update = new UserInfo();
|
UserInfo update = new UserInfo();
|
||||||
update.setUserId(user.getId());
|
update.setUserId(user.getId());
|
||||||
update.setLoginCount(userInfo.getLoginCount()+1);
|
update.setLoginCount(userInfo.getLoginCount()==null?0:userInfo.getLoginCount()+1);
|
||||||
update.setLastLoginIp(ip);
|
update.setLastLoginIp(ip);
|
||||||
update.setLastLoginTime(LocalDateTime.now());
|
update.setLastLoginTime(LocalDateTime.now());
|
||||||
update.setLastLocation(address);
|
update.setLastLocation(address);
|
||||||
@@ -239,7 +239,7 @@ public class CaiLoginManager {
|
|||||||
String usercode = userCodeGenService.getCodeGen();
|
String usercode = userCodeGenService.getCodeGen();
|
||||||
User add = new User();
|
User add = new User();
|
||||||
add.setUsercode(usercode);
|
add.setUsercode(usercode);
|
||||||
add.setNickname("蜜瓜"+usercode);
|
add.setNickname("用户"+usercode);
|
||||||
add.setType(0);
|
add.setType(0);
|
||||||
add.setPassword(BCrypt.hashpw(user.getPassword()));
|
add.setPassword(BCrypt.hashpw(user.getPassword()));
|
||||||
add.setMobile(user.getUsername());
|
add.setMobile(user.getUsername());
|
||||||
|
|||||||
@@ -3,19 +3,25 @@ package com.ruoyi.cai.auth;
|
|||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotEmpty;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@Schema(description = "注册模型")
|
@Schema(description = "注册模型")
|
||||||
public class CaiRegisterUser {
|
public class CaiRegisterUser {
|
||||||
@Schema(description = "手机号登录名")
|
@Schema(description = "手机号登录名")
|
||||||
|
@NotEmpty(message = "手机号不能为空")
|
||||||
private String username;
|
private String username;
|
||||||
@Schema(description = "密码")
|
@Schema(description = "密码")
|
||||||
|
@NotEmpty(message = "密码不能为空")
|
||||||
private String password;
|
private String password;
|
||||||
@Schema(description = "密码确认")
|
@Schema(description = "密码确认")
|
||||||
|
@NotEmpty(message = "密码确认不能为空")
|
||||||
private String passwordCheck;
|
private String passwordCheck;
|
||||||
@Schema(description = "验证码")
|
@Schema(description = "验证码")
|
||||||
|
@NotEmpty(message = "验证码不能为空")
|
||||||
private String code;
|
private String code;
|
||||||
@Schema(description = "邀请人ID")
|
@Schema(description = "邀请人ID")
|
||||||
private Long inviteId;
|
private Long inviteId;
|
||||||
@Schema(description = "性别")
|
@Schema(description = "性别")
|
||||||
private Integer gender;
|
private Integer gender = 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,11 +3,15 @@ package com.ruoyi.cai.auth;
|
|||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotEmpty;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@Schema(description = "登陆入参模型")
|
@Schema(description = "登陆入参模型")
|
||||||
public class LoginCaiUser {
|
public class LoginCaiUser {
|
||||||
@Schema(description = "用户")
|
@Schema(description = "用户")
|
||||||
|
@NotEmpty(message = "登录名不能为空")
|
||||||
private String username;
|
private String username;
|
||||||
@Schema(description = "密码")
|
@Schema(description = "密码")
|
||||||
|
@NotEmpty(message = "密码不能为空")
|
||||||
private String password;
|
private String password;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,10 @@ package com.ruoyi.cai.auth;
|
|||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotEmpty;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class RegisterCode {
|
public class RegisterCode {
|
||||||
|
@NotEmpty(message = "手机号不能为空")
|
||||||
private String mobile;
|
private String mobile;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ public class RedisConstant {
|
|||||||
public static final String DYNAMIC_TOTAL_CACHE_REDIS = REDIS_P + "synamicTotal:%s:%s";
|
public static final String DYNAMIC_TOTAL_CACHE_REDIS = REDIS_P + "synamicTotal:%s:%s";
|
||||||
public static final String CODE_REDIS = REDIS_P + "code:%s:%s";
|
public static final String CODE_REDIS = REDIS_P + "code:%s:%s";
|
||||||
public static final String USER_GREET_TOTAL_REDIS = REDIS_P + "userGreetTotal:%s:%s";
|
public static final String USER_GREET_TOTAL_REDIS = REDIS_P + "userGreetTotal:%s:%s";
|
||||||
|
public static final String USER_GREET_SEND_TIME_REDIS = REDIS_P + "userGreetSendTime:%s";
|
||||||
public static final String BLACK_REDIS = REDIS_P + "black:%s";
|
public static final String BLACK_REDIS = REDIS_P + "black:%s";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ public class SmsVerifyController extends BaseController {
|
|||||||
@SaCheckPermission("cai:smsVerify:list")
|
@SaCheckPermission("cai:smsVerify:list")
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public TableDataInfo<SmsVerify> list(SmsVerify bo, PageQuery pageQuery) {
|
public TableDataInfo<SmsVerify> list(SmsVerify bo, PageQuery pageQuery) {
|
||||||
Page<SmsVerify> page = smsVerifyService.page(pageQuery.build(), Wrappers.lambdaQuery(bo));
|
Page<SmsVerify> page = smsVerifyService.page(pageQuery.build(), Wrappers.lambdaQuery(bo).orderByDesc(SmsVerify::getCreateTime));
|
||||||
return TableDataInfo.build(page);
|
return TableDataInfo.build(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,13 +2,17 @@ package com.ruoyi.cai.controller.app;
|
|||||||
|
|
||||||
import cn.dev33.satoken.annotation.SaIgnore;
|
import cn.dev33.satoken.annotation.SaIgnore;
|
||||||
import com.ruoyi.cai.auth.*;
|
import com.ruoyi.cai.auth.*;
|
||||||
|
import com.ruoyi.cai.domain.User;
|
||||||
import com.ruoyi.cai.enums.CodeEnum;
|
import com.ruoyi.cai.enums.CodeEnum;
|
||||||
import com.ruoyi.cai.manager.CodeManager;
|
import com.ruoyi.cai.manager.CodeManager;
|
||||||
import com.ruoyi.cai.service.SmsVerifyService;
|
import com.ruoyi.cai.service.SmsVerifyService;
|
||||||
|
import com.ruoyi.cai.service.UserService;
|
||||||
import com.ruoyi.common.core.domain.R;
|
import com.ruoyi.common.core.domain.R;
|
||||||
|
import com.ruoyi.common.exception.ServiceException;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
@@ -21,16 +25,19 @@ import java.util.Map;
|
|||||||
@RequestMapping("/api/auth")
|
@RequestMapping("/api/auth")
|
||||||
@SaIgnore
|
@SaIgnore
|
||||||
@Tag(name = "权限相关接口,免鉴权")
|
@Tag(name = "权限相关接口,免鉴权")
|
||||||
|
@Validated
|
||||||
public class AuthAppController {
|
public class AuthAppController {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private CaiLoginManager caiLoginManager;
|
private CaiLoginManager caiLoginManager;
|
||||||
@Autowired
|
@Autowired
|
||||||
private SmsVerifyService smsVerifyService;
|
private SmsVerifyService smsVerifyService;
|
||||||
|
@Autowired
|
||||||
|
private UserService userService;
|
||||||
|
|
||||||
@PostMapping("/register")
|
@PostMapping("/register")
|
||||||
@Operation(summary = "注册")
|
@Operation(summary = "注册")
|
||||||
public R<Map<String, Object>> register(@RequestBody CaiRegisterUser caiUser){
|
public R<Map<String, Object>> register(@Validated @RequestBody CaiRegisterUser caiUser){
|
||||||
String token = caiLoginManager.register(caiUser);
|
String token = caiLoginManager.register(caiUser);
|
||||||
Map<String, Object> ajax = new HashMap<>();
|
Map<String, Object> ajax = new HashMap<>();
|
||||||
ajax.put("token",token);
|
ajax.put("token",token);
|
||||||
@@ -39,21 +46,25 @@ public class AuthAppController {
|
|||||||
|
|
||||||
@PostMapping("/register/code")
|
@PostMapping("/register/code")
|
||||||
@Operation(summary = "获取注册验证码")
|
@Operation(summary = "获取注册验证码")
|
||||||
public R<Map<String,String>> registerCode(@RequestBody RegisterCode code){
|
public R<Map<String,String>> registerCode(@Validated @RequestBody RegisterCode code){
|
||||||
smsVerifyService.put(CodeEnum.REGISTER,code.getMobile());
|
smsVerifyService.put(CodeEnum.REGISTER,code.getMobile());
|
||||||
return R.ok("发送成功");
|
return R.ok("发送成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/resetPassword/code")
|
@PostMapping("/resetPassword/code")
|
||||||
@Operation(summary = "获取重置密码验证码")
|
@Operation(summary = "获取重置密码验证码")
|
||||||
public R<Map<String,String>> resetPasswordCode(@RequestBody RegisterCode code){
|
public R<Map<String,String>> resetPasswordCode(@Validated @RequestBody RegisterCode code){
|
||||||
|
User user = userService.getByUsername(code.getMobile());
|
||||||
|
if(user == null){
|
||||||
|
throw new ServiceException("用户不存在");
|
||||||
|
}
|
||||||
smsVerifyService.put(CodeEnum.RESET_PASSWORD,code.getMobile());
|
smsVerifyService.put(CodeEnum.RESET_PASSWORD,code.getMobile());
|
||||||
return R.ok("发送成功");
|
return R.ok("发送成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/login")
|
@PostMapping("/login")
|
||||||
@Operation(summary = "登陆")
|
@Operation(summary = "登陆")
|
||||||
public R<Map<String,Object>> login(@RequestBody LoginCaiUser loginBody){
|
public R<Map<String,Object>> login(@Validated @RequestBody LoginCaiUser loginBody){
|
||||||
Map<String, Object> ajax = new HashMap<>();
|
Map<String, Object> ajax = new HashMap<>();
|
||||||
String token = caiLoginManager.login(loginBody.getUsername(), loginBody.getPassword());
|
String token = caiLoginManager.login(loginBody.getUsername(), loginBody.getPassword());
|
||||||
ajax.put("token",token);
|
ajax.put("token",token);
|
||||||
@@ -61,10 +72,10 @@ public class AuthAppController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/resetPassword")
|
@PostMapping("/resetPassword")
|
||||||
@Operation(summary = "获取充值密码验证码")
|
@Operation(summary = "重置密码")
|
||||||
public R<Boolean> resetPassword(@RequestBody ResetPasswordReq code){
|
public R<Boolean> resetPassword(@RequestBody ResetPasswordReq code){
|
||||||
caiLoginManager.resetPassword(code);
|
caiLoginManager.resetPassword(code);
|
||||||
return R.ok("发送成功");
|
return R.ok(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -28,8 +28,6 @@ public class SettingAppController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private ReportCateService reportCateService;
|
private ReportCateService reportCateService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private CitysService citysService;
|
|
||||||
@Autowired
|
|
||||||
private GiftService giftService;
|
private GiftService giftService;
|
||||||
|
|
||||||
@GetMapping("/goods")
|
@GetMapping("/goods")
|
||||||
@@ -57,12 +55,6 @@ public class SettingAppController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@GetMapping("/city")
|
|
||||||
@Operation(summary = "城市")
|
|
||||||
public R<Map<Long,String>> city(){
|
|
||||||
return R.ok(citysService.all());
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/gift")
|
@GetMapping("/gift")
|
||||||
@Operation(summary = "礼物配置")
|
@Operation(summary = "礼物配置")
|
||||||
public R<List<GiftVo>> gift(){
|
public R<List<GiftVo>> gift(){
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import com.ruoyi.common.helper.LoginHelper;
|
|||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -33,7 +34,7 @@ public class UserAppController {
|
|||||||
|
|
||||||
@PostMapping("/update")
|
@PostMapping("/update")
|
||||||
@Operation(summary = "修改当前用户信息")
|
@Operation(summary = "修改当前用户信息")
|
||||||
public R<Boolean> userUpdate(@RequestBody UserUpdateReq res){
|
public R<Boolean> userUpdate(@Validated @RequestBody UserUpdateReq res){
|
||||||
return R.ok(currentUserManager.userUpdate(res));
|
return R.ok(currentUserManager.userUpdate(res));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ public class UserBlackAppController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("black")
|
@PostMapping("black")
|
||||||
@Operation(summary = "拉黑操作 如果已经给拉黑则放开")
|
@Operation(summary = "拉黑操作")
|
||||||
public R<Boolean> black(@RequestBody BlackQuery query){
|
public R<Boolean> black(@RequestBody BlackQuery query){
|
||||||
Long userId = LoginHelper.getUserId();
|
Long userId = LoginHelper.getUserId();
|
||||||
boolean b = userBlacklistService.black(userId,query.getBlackUserId(),query.getActionType());
|
boolean b = userBlacklistService.black(userId,query.getBlackUserId(),query.getActionType());
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import com.ruoyi.common.utils.BeanConvertUtil;
|
|||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -39,9 +40,10 @@ public class UserGreetAppController {
|
|||||||
return R.ok(BeanConvertUtil.convertListTo(userGreet,UserGreetVo::new));
|
return R.ok(BeanConvertUtil.convertListTo(userGreet,UserGreetVo::new));
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/add")
|
@PostMapping("/add")
|
||||||
@Operation(summary = "新增群打招呼")
|
@Operation(summary = "新增群打招呼")
|
||||||
public R<Void> add(@RequestBody UserGreetAddReq req){
|
public R<Void> add(@Validated @RequestBody UserGreetAddReq req){
|
||||||
|
req.setUserId(LoginHelper.getUserId());
|
||||||
userGreetService.addUserGreet(req);
|
userGreetService.addUserGreet(req);
|
||||||
return R.ok();
|
return R.ok();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,14 +5,16 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|||||||
import com.ruoyi.cai.domain.AccountBankcard;
|
import com.ruoyi.cai.domain.AccountBankcard;
|
||||||
import com.ruoyi.cai.domain.AccountCash;
|
import com.ruoyi.cai.domain.AccountCash;
|
||||||
import com.ruoyi.cai.domain.AccountRecharge;
|
import com.ruoyi.cai.domain.AccountRecharge;
|
||||||
|
import com.ruoyi.cai.domain.RechargeOrder;
|
||||||
import com.ruoyi.cai.dto.app.query.AccountAliBankCardRes;
|
import com.ruoyi.cai.dto.app.query.AccountAliBankCardRes;
|
||||||
import com.ruoyi.cai.dto.app.query.WithdrawReq;
|
import com.ruoyi.cai.dto.app.query.WithdrawReq;
|
||||||
import com.ruoyi.cai.dto.app.vo.AccountCashVo;
|
import com.ruoyi.cai.dto.app.vo.AccountCashVo;
|
||||||
import com.ruoyi.cai.dto.app.vo.AccountRechargeVo;
|
import com.ruoyi.cai.dto.app.vo.RechargeOrderVo;
|
||||||
import com.ruoyi.cai.dto.app.vo.user.UserAccountVo;
|
import com.ruoyi.cai.dto.app.vo.user.UserAccountVo;
|
||||||
import com.ruoyi.cai.manager.CurrentUserManager;
|
import com.ruoyi.cai.manager.CurrentUserManager;
|
||||||
|
import com.ruoyi.cai.pay.PayStatusEnum;
|
||||||
import com.ruoyi.cai.service.AccountCashService;
|
import com.ruoyi.cai.service.AccountCashService;
|
||||||
import com.ruoyi.cai.service.AccountRechargeService;
|
import com.ruoyi.cai.service.RechargeOrderService;
|
||||||
import com.ruoyi.common.core.domain.PageQuery;
|
import com.ruoyi.common.core.domain.PageQuery;
|
||||||
import com.ruoyi.common.core.domain.R;
|
import com.ruoyi.common.core.domain.R;
|
||||||
import com.ruoyi.common.core.page.TableDataInfo;
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
@@ -32,7 +34,7 @@ public class WalletController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private AccountCashService accountCashService;
|
private AccountCashService accountCashService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private AccountRechargeService accountRechargeService;
|
private RechargeOrderService rechargeOrderService;
|
||||||
|
|
||||||
@GetMapping("/account")
|
@GetMapping("/account")
|
||||||
@Operation(summary = "快速获取当前用户账号余额信息")
|
@Operation(summary = "快速获取当前用户账号余额信息")
|
||||||
@@ -64,12 +66,14 @@ public class WalletController {
|
|||||||
|
|
||||||
@GetMapping("/recharge/log")
|
@GetMapping("/recharge/log")
|
||||||
@Operation(summary = "充值记录-分页")
|
@Operation(summary = "充值记录-分页")
|
||||||
public TableDataInfo<AccountRechargeVo> rechargeLog(PageQuery query){
|
public TableDataInfo<RechargeOrderVo> rechargeLog(PageQuery query){
|
||||||
Long userId = LoginHelper.getUserId();
|
Long userId = LoginHelper.getUserId();
|
||||||
Page<AccountRecharge> page = accountRechargeService.page(query.build(), Wrappers.lambdaQuery(AccountRecharge.class)
|
Page<RechargeOrder> page = rechargeOrderService.page(query.build(), Wrappers.lambdaQuery(RechargeOrder.class)
|
||||||
.eq(AccountRecharge::getUserId, userId)
|
.eq(RechargeOrder::getUserId, userId)
|
||||||
.orderByDesc(AccountRecharge::getCreateTime));
|
.eq(RechargeOrder::getAdmin,false)
|
||||||
return TableDataInfo.build(page,AccountRechargeVo::new);
|
.eq(RechargeOrder::getPayStatus, PayStatusEnum.PAY.getCode())
|
||||||
|
.orderByDesc(RechargeOrder::getCreateTime));
|
||||||
|
return TableDataInfo.build(page, RechargeOrderVo::new);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/cash/log")
|
@GetMapping("/cash/log")
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.ruoyi.cai.domain;
|
package com.ruoyi.cai.domain;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@@ -51,14 +52,17 @@ public class Gift implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* 礼物描述
|
* 礼物描述
|
||||||
*/
|
*/
|
||||||
|
@TableField("`desc`")
|
||||||
private String desc;
|
private String desc;
|
||||||
/**
|
/**
|
||||||
* 是否隐藏 0 不隐藏,可见 1 隐藏
|
* 是否隐藏 0 不隐藏,可见 1 隐藏
|
||||||
*/
|
*/
|
||||||
|
@TableField("`hide`")
|
||||||
private Integer hide;
|
private Integer hide;
|
||||||
/**
|
/**
|
||||||
* 排序
|
* 排序
|
||||||
*/
|
*/
|
||||||
|
@TableField("`sort`")
|
||||||
private Integer sort;
|
private Integer sort;
|
||||||
/**
|
/**
|
||||||
* 状态 0 可用 1 不可用
|
* 状态 0 可用 1 不可用
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ package com.ruoyi.cai.dto.app.query;
|
|||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@Schema(description = "赠送守护入参")
|
@Schema(description = "赠送守护入参")
|
||||||
public class GiveGuardReq {
|
public class GiveGuardReq {
|
||||||
|
|||||||
@@ -3,8 +3,11 @@ package com.ruoyi.cai.dto.app.query;
|
|||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class IdRes {
|
public class IdRes {
|
||||||
@Schema(description = "id")
|
@Schema(description = "id")
|
||||||
|
@NotNull(message = "参数异常")
|
||||||
private Long id;
|
private Long id;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.ruoyi.cai.dto.app.query;
|
|||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@@ -14,7 +15,7 @@ public class UserUpdateReq {
|
|||||||
@Schema(description = "昵称")
|
@Schema(description = "昵称")
|
||||||
private String nickname;
|
private String nickname;
|
||||||
@Schema(description = "生日")
|
@Schema(description = "生日")
|
||||||
private LocalDateTime birthday;
|
private LocalDate birthday;
|
||||||
@Schema(description = "性别")
|
@Schema(description = "性别")
|
||||||
private Integer gender;
|
private Integer gender;
|
||||||
@Schema(description = "头像")
|
@Schema(description = "头像")
|
||||||
|
|||||||
@@ -3,11 +3,15 @@ package com.ruoyi.cai.dto.app.query.user;
|
|||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotEmpty;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@Schema(description = "新增群达招呼")
|
@Schema(description = "新增群达招呼")
|
||||||
public class UserGreetAddReq {
|
public class UserGreetAddReq {
|
||||||
@Schema(accessMode = Schema.AccessMode.READ_ONLY)
|
@Schema(accessMode = Schema.AccessMode.READ_ONLY)
|
||||||
private Long userId;
|
private Long userId;
|
||||||
@Schema(description = "内容")
|
@Schema(description = "内容")
|
||||||
|
@NotEmpty(message = "打招呼内容不能为空")
|
||||||
private String title;
|
private String title;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ public class AccountCashVo {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Schema(description = "ID")
|
@Schema(description = "ID")
|
||||||
private Integer id;
|
private Long id;
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,74 +0,0 @@
|
|||||||
package com.ruoyi.cai.dto.app.vo;
|
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
@Schema(description = "充值记录")
|
|
||||||
public class AccountRechargeVo {
|
|
||||||
@Schema(description = "ID")
|
|
||||||
private Long id;
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
@Schema(description = "用户Id")
|
|
||||||
private Long userId;
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
@Schema(description = "充值ID")
|
|
||||||
private Long goodsId;
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
@Schema(description = "订单编号")
|
|
||||||
private String orderNo;
|
|
||||||
/**
|
|
||||||
* 订单名
|
|
||||||
*/
|
|
||||||
@Schema(description = "订单名称")
|
|
||||||
private String orderName;
|
|
||||||
/**
|
|
||||||
* 充值类型 0 手工充值 1 线上充值
|
|
||||||
*/
|
|
||||||
@Schema(description = "充值类型")
|
|
||||||
private Integer rechargeType;
|
|
||||||
/**
|
|
||||||
* 充值金额
|
|
||||||
*/
|
|
||||||
@Schema(description = "充值金额")
|
|
||||||
private BigDecimal rechargeMoney;
|
|
||||||
/**
|
|
||||||
* 充值的紫贝
|
|
||||||
*/
|
|
||||||
@Schema(description = "紫贝数量")
|
|
||||||
private Integer coinNum;
|
|
||||||
/**
|
|
||||||
* 充值平台类型
|
|
||||||
*/
|
|
||||||
@Schema(description = "平台")
|
|
||||||
private Long platformType;
|
|
||||||
/**
|
|
||||||
* 充值平台名称
|
|
||||||
*/
|
|
||||||
@Schema(description = "平台名称")
|
|
||||||
private String platformName;
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
private String payNo;
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
private String operateIp;
|
|
||||||
/**
|
|
||||||
* 类型: 0积分(默认),1会员
|
|
||||||
*/
|
|
||||||
@Schema(description = "0-充值 1-会员")
|
|
||||||
private Integer type;
|
|
||||||
@Schema(description = "充值时间")
|
|
||||||
private LocalDateTime createTime;
|
|
||||||
}
|
|
||||||
@@ -8,6 +8,9 @@ import java.math.BigDecimal;
|
|||||||
@Data
|
@Data
|
||||||
@Schema(description = "主播列表信息")
|
@Schema(description = "主播列表信息")
|
||||||
public class AnchorListVo {
|
public class AnchorListVo {
|
||||||
|
|
||||||
|
@Schema(description = "用户ID")
|
||||||
|
private String userId;
|
||||||
/**
|
/**
|
||||||
* 头像
|
* 头像
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -37,16 +37,9 @@ public class DynamicVo {
|
|||||||
*/
|
*/
|
||||||
@Schema(description = "是否有附件 0 没有 1 有")
|
@Schema(description = "是否有附件 0 没有 1 有")
|
||||||
private Integer isAttach;
|
private Integer isAttach;
|
||||||
/**
|
|
||||||
* 状态 0 审核中 1可用 2 不可用
|
@Schema(description = "审核状态")
|
||||||
*/
|
private Integer auditStatus;
|
||||||
@Schema(description = "状态 0 审核中 1可用 2 不可用")
|
|
||||||
private Integer status;
|
|
||||||
/**
|
|
||||||
* 排序字段
|
|
||||||
*/
|
|
||||||
@Schema(description = "排序字段")
|
|
||||||
private Long sort;
|
|
||||||
|
|
||||||
@Schema(description = "创建时间")
|
@Schema(description = "创建时间")
|
||||||
private LocalDateTime createTime;
|
private LocalDateTime createTime;
|
||||||
|
|||||||
@@ -1,30 +1,38 @@
|
|||||||
package com.ruoyi.cai.dto.app.vo;
|
package com.ruoyi.cai.dto.app.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.print.attribute.standard.Media;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class GiftVo implements Serializable {
|
public class GiftVo implements Serializable {
|
||||||
private Integer id;
|
@Schema(description = "礼物ID")
|
||||||
|
private Long id;
|
||||||
/**
|
/**
|
||||||
* 类型 0 普通礼物 1svga礼物
|
* 类型 0 普通礼物 1svga礼物
|
||||||
*/
|
*/
|
||||||
|
@Schema(hidden = true)
|
||||||
private Integer type;
|
private Integer type;
|
||||||
/**
|
/**
|
||||||
* 礼物名称
|
* 礼物名称
|
||||||
*/
|
*/
|
||||||
|
@Schema(description = "礼物名称")
|
||||||
private String name;
|
private String name;
|
||||||
/**
|
/**
|
||||||
* 礼物价格
|
* 礼物价格
|
||||||
*/
|
*/
|
||||||
|
@Schema(description = "礼物价格")
|
||||||
private Long price;
|
private Long price;
|
||||||
/**
|
/**
|
||||||
* 礼物图片地址
|
* 礼物图片地址
|
||||||
*/
|
*/
|
||||||
|
@Schema(description = "图片")
|
||||||
private String img;
|
private String img;
|
||||||
/**
|
/**
|
||||||
* svga地址
|
* svga地址
|
||||||
*/
|
*/
|
||||||
|
@Schema(description = "礼物SVGA")
|
||||||
private String svga;
|
private String svga;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,50 @@
|
|||||||
|
package com.ruoyi.cai.dto.app.vo;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Schema(description = "充值记录")
|
||||||
|
public class RechargeOrderVo {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户ID
|
||||||
|
*/
|
||||||
|
private Long userId;
|
||||||
|
/**
|
||||||
|
* 商品ID
|
||||||
|
*/
|
||||||
|
@Schema(description = "商品ID")
|
||||||
|
private Long rechargeId;
|
||||||
|
/**
|
||||||
|
* 商品名称
|
||||||
|
*/
|
||||||
|
@Schema(description = "商品名称")
|
||||||
|
private String rechargeName;
|
||||||
|
/**
|
||||||
|
* 充值紫贝
|
||||||
|
*/
|
||||||
|
@Schema(description = "充值紫贝")
|
||||||
|
private Long rechargeCoin;
|
||||||
|
/**
|
||||||
|
* 价格
|
||||||
|
*/
|
||||||
|
@Schema(description = "价格")
|
||||||
|
private BigDecimal price;
|
||||||
|
/**
|
||||||
|
* 订单号
|
||||||
|
*/
|
||||||
|
@Schema(description = "订单号")
|
||||||
|
private String orderNo;
|
||||||
|
@Schema(description = "状态 0-待支付 1-已支付 2-已退款 10-无需支付")
|
||||||
|
private Integer payStatus;
|
||||||
|
|
||||||
|
@Schema(description = "充值时间")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -19,6 +19,6 @@ public class UserGiftIndexVo {
|
|||||||
@Schema(description = "礼物价格")
|
@Schema(description = "礼物价格")
|
||||||
private String price;
|
private String price;
|
||||||
@Schema(description = "礼物数量")
|
@Schema(description = "礼物数量")
|
||||||
private Long count;
|
private Long giftCount;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,6 +22,4 @@ public class UserAccountVo {
|
|||||||
@Schema(description = "收益的紫贝")
|
@Schema(description = "收益的紫贝")
|
||||||
private Long incomeCoin;
|
private Long incomeCoin;
|
||||||
|
|
||||||
@Schema(description = "总数量")
|
|
||||||
private Long totalCoin;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ import lombok.Data;
|
|||||||
@Data
|
@Data
|
||||||
public class UserBaseVo {
|
public class UserBaseVo {
|
||||||
|
|
||||||
|
@Schema(description = "用户Id")
|
||||||
|
private Long userId;
|
||||||
/**
|
/**
|
||||||
* 头像
|
* 头像
|
||||||
*/
|
*/
|
||||||
@@ -24,7 +26,7 @@ public class UserBaseVo {
|
|||||||
@Schema(description = "城市ID")
|
@Schema(description = "城市ID")
|
||||||
private Integer cityId;
|
private Integer cityId;
|
||||||
@Schema(description = "城市")
|
@Schema(description = "城市")
|
||||||
private Integer city;
|
private String city;
|
||||||
/**
|
/**
|
||||||
* 昵称
|
* 昵称
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -17,12 +17,12 @@ public class UserGreetVo {
|
|||||||
/**
|
/**
|
||||||
* 标题
|
* 标题
|
||||||
*/
|
*/
|
||||||
@Schema(description = "标题")
|
@Schema(description = "内容")
|
||||||
private String title;
|
private String title;
|
||||||
/**
|
/**
|
||||||
* 审核状态
|
* 审核状态
|
||||||
*/
|
*/
|
||||||
@Schema(description = "审核状态 1 审核中, 2 审核通过, 3 审核不通过")
|
@Schema(description = "审核状态 1 审核中, 2 审核通过, 3 审核不通过")
|
||||||
private Integer status;
|
private Integer auditStatus;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,6 @@ import java.time.LocalDateTime;
|
|||||||
@Data
|
@Data
|
||||||
@Schema(description = "用户列表返回")
|
@Schema(description = "用户列表返回")
|
||||||
public class UserListVo extends UserBaseVo {
|
public class UserListVo extends UserBaseVo {
|
||||||
@Schema(description = "绑定时间")
|
@Schema(description = "最后活跃时间")
|
||||||
private LocalDateTime bindTime;
|
private LocalDateTime bindTime;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import lombok.Data;
|
|||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class UserStarOrVisitorList {
|
public class UserStarOrVisitorList extends UserBaseVo {
|
||||||
|
|
||||||
private LocalDateTime happenTime;
|
private LocalDateTime happenTime;
|
||||||
|
|
||||||
|
|||||||
@@ -52,8 +52,9 @@ public class CurrentUserManager {
|
|||||||
Long userId = LoginHelper.getUserId();
|
Long userId = LoginHelper.getUserId();
|
||||||
User user = userService.getById(userId);
|
User user = userService.getById(userId);
|
||||||
CurrentUserInfoVo res = BeanConvertUtil.convertTo(user, CurrentUserInfoVo::new);
|
CurrentUserInfoVo res = BeanConvertUtil.convertTo(user, CurrentUserInfoVo::new);
|
||||||
|
res.setUserId(userId);
|
||||||
Anchor anchor = anchorService.getByUserId(userId);
|
Anchor anchor = anchorService.getByUserId(userId);
|
||||||
res.setOpenVideoStatus(anchor.getOpenVideoStatus());
|
res.setOpenVideoStatus(anchor == null ? 1 : anchor.getOpenVideoStatus());
|
||||||
UserCount userCount = userCountService.getByUserId(userId);
|
UserCount userCount = userCountService.getByUserId(userId);
|
||||||
res.setUserCount(BeanConvertUtil.convertTo(userCount, UserCountVo::new));
|
res.setUserCount(BeanConvertUtil.convertTo(userCount, UserCountVo::new));
|
||||||
Account account = accountService.getByUserId(userId);
|
Account account = accountService.getByUserId(userId);
|
||||||
|
|||||||
@@ -14,12 +14,12 @@ import org.apache.ibatis.annotations.Param;
|
|||||||
*/
|
*/
|
||||||
public interface AccountMapper extends BaseMapper<Account> {
|
public interface AccountMapper extends BaseMapper<Account> {
|
||||||
|
|
||||||
long decrCoin(@Param("userId") Long userId, @Param("coin") Long coin);
|
boolean decrCoin(@Param("userId") Long userId, @Param("coin") Long coin);
|
||||||
|
|
||||||
long incsCoin(@Param("userId") Long userId, @Param("coin") Long coin);
|
boolean incsCoin(@Param("userId") Long userId, @Param("coin") Long coin);
|
||||||
|
|
||||||
void incsIncomeCoin(@Param("userId") Long userId, @Param("incomeCoin") Long incomeCoin);
|
boolean incsIncomeCoin(@Param("userId") Long userId, @Param("incomeCoin") Long incomeCoin);
|
||||||
long decrIncomeCoin(@Param("userId") Long userId, @Param("incomeCoin") Long incomeCoin);
|
boolean decrIncomeCoin(@Param("userId") Long userId, @Param("incomeCoin") Long incomeCoin);
|
||||||
|
|
||||||
Page<AccountAdminVo> pageAdmin(@Param("build") Page<Object> build, @Param("bo") AccountAdminVo bo);
|
Page<AccountAdminVo> pageAdmin(@Param("build") Page<Object> build, @Param("bo") AccountAdminVo bo);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import com.ruoyi.cai.util.NumCaUtil;
|
|||||||
import com.ruoyi.common.core.domain.PageQuery;
|
import com.ruoyi.common.core.domain.PageQuery;
|
||||||
import com.ruoyi.common.exception.ServiceException;
|
import com.ruoyi.common.exception.ServiceException;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.FactoryBean;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
@@ -55,18 +56,18 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
|||||||
throw new ServiceException("余额不足");
|
throw new ServiceException("余额不足");
|
||||||
}
|
}
|
||||||
boolean flag = false;
|
boolean flag = false;
|
||||||
long coin = account.getCoin();
|
long coin = -amount; // 消费余额
|
||||||
long incomeCoin = 0;
|
long incomeCoin = 0; // 消费收益
|
||||||
long diff = account.getCoin() - amount;
|
long diff = account.getCoin() - amount;
|
||||||
// 充值币够用
|
// 充值币够用
|
||||||
if(diff > 0){
|
if(diff > 0){
|
||||||
long l = baseMapper.decrCoin(userId, coin);
|
flag = baseMapper.decrCoin(userId, -coin);
|
||||||
flag = l > 0;
|
|
||||||
} else { // 充值币不够用
|
} else { // 充值币不够用
|
||||||
|
coin = -account.getCoin();
|
||||||
incomeCoin = diff;
|
incomeCoin = diff;
|
||||||
long decrCoin = baseMapper.decrCoin(userId, account.getCoin());
|
boolean decrCoin = baseMapper.decrCoin(userId, -coin);
|
||||||
long decrIncomeCoin = baseMapper.decrIncomeCoin(userId, -diff);
|
boolean decrIncomeCoin = baseMapper.decrIncomeCoin(userId, -diff);
|
||||||
if(decrCoin > 0 && decrIncomeCoin > 0){
|
if(decrCoin && decrIncomeCoin){
|
||||||
flag = true;
|
flag = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -88,8 +89,9 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
|||||||
if(incomeCoin != 0){
|
if(incomeCoin != 0){
|
||||||
accountChangeLogService.saveLogNoAdmin(userId,consumeLog.getSourceUsercode(), RechargeTypeEnum.COIN_INCOME,businessEnum.getSourceEnum(),incomeCoin,consumeLog.getTraceId());
|
accountChangeLogService.saveLogNoAdmin(userId,consumeLog.getSourceUsercode(), RechargeTypeEnum.COIN_INCOME,businessEnum.getSourceEnum(),incomeCoin,consumeLog.getTraceId());
|
||||||
}
|
}
|
||||||
|
// 记录接收方的流水
|
||||||
if(targetUserId != null){
|
if(targetUserId != null){
|
||||||
accountChangeLogService.saveLogNoAdmin(targetUserId,consumeLog.getTargetUsercode(), RechargeTypeEnum.COIN_INCOME,businessEnum.getTargetEnum(),incomeCoin,consumeLog.getTraceId());
|
accountChangeLogService.saveLogNoAdmin(targetUserId,consumeLog.getTargetUsercode(), RechargeTypeEnum.COIN_INCOME,businessEnum.getTargetEnum(),consumeLog.getAnchorAmount(),consumeLog.getTraceId());
|
||||||
}
|
}
|
||||||
// 获取分销的比例和用户
|
// 获取分销的比例和用户
|
||||||
consumeLogService.calculateInitFenxiao(consumeLog);
|
consumeLogService.calculateInitFenxiao(consumeLog);
|
||||||
@@ -108,8 +110,8 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
|||||||
if(account.getIncomeCoin() < incomeCoin){
|
if(account.getIncomeCoin() < incomeCoin){
|
||||||
throw new ServiceException("需"+incomeCoin+"紫贝才可提现");
|
throw new ServiceException("需"+incomeCoin+"紫贝才可提现");
|
||||||
}
|
}
|
||||||
long incs = baseMapper.decrIncomeCoin(userId, incomeCoin);
|
boolean incs = baseMapper.decrIncomeCoin(userId, incomeCoin);
|
||||||
if(incs <= 0){
|
if(!incs){
|
||||||
throw new ServiceException("需"+incomeCoin+"紫贝才可提现");
|
throw new ServiceException("需"+incomeCoin+"紫贝才可提现");
|
||||||
}
|
}
|
||||||
accountChangeLogService.saveLogNoAdmin(user.getId(),user.getUsercode(), RechargeTypeEnum.COIN_INCOME,AccountBusinessEnum.WITHDRAW.getSourceEnum(),incomeCoin,traceId);
|
accountChangeLogService.saveLogNoAdmin(user.getId(),user.getUsercode(), RechargeTypeEnum.COIN_INCOME,AccountBusinessEnum.WITHDRAW.getSourceEnum(),incomeCoin,traceId);
|
||||||
|
|||||||
@@ -114,6 +114,7 @@ public class ConsumeLogServiceImpl extends ServiceImpl<ConsumeLogMapper, Consume
|
|||||||
consumeLog.setOneAmount(NumCaUtil.coin(consumeLog.getAmount(),consumeLog.getOneRate()));
|
consumeLog.setOneAmount(NumCaUtil.coin(consumeLog.getAmount(),consumeLog.getOneRate()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
consumeLog.setCalculateStatus(true);
|
||||||
return consumeLog;
|
return consumeLog;
|
||||||
}
|
}
|
||||||
Long targetUserId = consumeLog.getTargetUserId();
|
Long targetUserId = consumeLog.getTargetUserId();
|
||||||
@@ -166,6 +167,7 @@ public class ConsumeLogServiceImpl extends ServiceImpl<ConsumeLogMapper, Consume
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
consumeLog.setCalculateStatus(true);
|
||||||
return consumeLog;
|
return consumeLog;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -153,11 +153,11 @@ public class RechargeOrderServiceImpl extends ServiceImpl<RechargeOrderMapper,Re
|
|||||||
if(account.getCoin() < -dto.getRechargeCoin()){
|
if(account.getCoin() < -dto.getRechargeCoin()){
|
||||||
throw new ServiceException("调整后余额为负数,无法调整");
|
throw new ServiceException("调整后余额为负数,无法调整");
|
||||||
}
|
}
|
||||||
long l = accountMapper.decrCoin(userId, -dto.getRechargeCoin());
|
boolean l = accountMapper.decrCoin(userId, -dto.getRechargeCoin());
|
||||||
accountChangeLogService.saveLogAdmin(user.getId(),user.getUsercode(),RechargeTypeEnum.COIN, AccountChangeEnum.SYSTEM_COIN_DECR,dto.getRechargeCoin(),traceId);
|
if(!l){
|
||||||
if(l == 0){
|
throw new ServiceException("调整后收益为负数,无法调整");
|
||||||
throw new ServiceException("调整后余额为负数,无法调整");
|
|
||||||
}
|
}
|
||||||
|
accountChangeLogService.saveLogAdmin(user.getId(),user.getUsercode(),RechargeTypeEnum.COIN, AccountChangeEnum.SYSTEM_COIN_DECR,dto.getRechargeCoin(),traceId);
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
if(dto.getRechargeCoin() > 0){
|
if(dto.getRechargeCoin() > 0){
|
||||||
@@ -167,11 +167,11 @@ public class RechargeOrderServiceImpl extends ServiceImpl<RechargeOrderMapper,Re
|
|||||||
if(account.getIncomeCoin() < -dto.getRechargeCoin()){
|
if(account.getIncomeCoin() < -dto.getRechargeCoin()){
|
||||||
throw new ServiceException("调整后收益为负数,无法调整");
|
throw new ServiceException("调整后收益为负数,无法调整");
|
||||||
}
|
}
|
||||||
long l = accountMapper.decrIncomeCoin(userId, -dto.getRechargeCoin());
|
boolean l = accountMapper.decrIncomeCoin(userId, -dto.getRechargeCoin());
|
||||||
accountChangeLogService.saveLogAdmin(user.getId(),user.getUsercode(),RechargeTypeEnum.COIN_INCOME, AccountChangeEnum.SYSTEM_INCOME_COIN_DECR,dto.getRechargeCoin(),traceId);
|
if(!l){
|
||||||
if(l == 0){
|
|
||||||
throw new ServiceException("调整后收益为负数,无法调整");
|
throw new ServiceException("调整后收益为负数,无法调整");
|
||||||
}
|
}
|
||||||
|
accountChangeLogService.saveLogAdmin(user.getId(),user.getUsercode(),RechargeTypeEnum.COIN_INCOME, AccountChangeEnum.SYSTEM_INCOME_COIN_DECR,dto.getRechargeCoin(),traceId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return order;
|
return order;
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import com.ruoyi.cai.domain.User;
|
|||||||
import com.ruoyi.cai.domain.UserGreet;
|
import com.ruoyi.cai.domain.UserGreet;
|
||||||
import com.ruoyi.cai.dto.admin.vo.UserGreetAdminVo;
|
import com.ruoyi.cai.dto.admin.vo.UserGreetAdminVo;
|
||||||
import com.ruoyi.cai.dto.app.query.user.UserGreetAddReq;
|
import com.ruoyi.cai.dto.app.query.user.UserGreetAddReq;
|
||||||
|
import com.ruoyi.cai.enums.AuditStatusEnum;
|
||||||
import com.ruoyi.cai.enums.SystemConfigEnum;
|
import com.ruoyi.cai.enums.SystemConfigEnum;
|
||||||
import com.ruoyi.cai.manager.LockManager;
|
import com.ruoyi.cai.manager.LockManager;
|
||||||
import com.ruoyi.cai.manager.SystemConfigManager;
|
import com.ruoyi.cai.manager.SystemConfigManager;
|
||||||
@@ -102,12 +103,12 @@ public class UserGreetServiceImpl extends ServiceImpl<UserGreetMapper,UserGreet>
|
|||||||
if(userGreet == null || !userGreet.getUserId().equals(userId)){
|
if(userGreet == null || !userGreet.getUserId().equals(userId)){
|
||||||
throw new ServiceException("请选择打招呼内容");
|
throw new ServiceException("请选择打招呼内容");
|
||||||
}
|
}
|
||||||
if(userGreet.getAuditStatus() != 1){
|
if(AuditStatusEnum.SUCCESS.getCode().equals(userGreet.getAuditStatus())){
|
||||||
throw new ServiceException("内容未通过审核");
|
throw new ServiceException("内容未通过审核");
|
||||||
}
|
}
|
||||||
String lockKey = LockManager.getSendGreetLock(userId);
|
String lockKey = LockManager.getSendGreetLock(userId);
|
||||||
RLock lock = redissonClient.getLock(lockKey);
|
RLock lock = redissonClient.getLock(lockKey);
|
||||||
if(!lock.isLocked()){
|
if(lock.isLocked()){
|
||||||
throw new ServiceException("操作太频繁");
|
throw new ServiceException("操作太频繁");
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
@@ -118,8 +119,8 @@ public class UserGreetServiceImpl extends ServiceImpl<UserGreetMapper,UserGreet>
|
|||||||
if(val != null && Long.parseLong(val) > max){
|
if(val != null && Long.parseLong(val) > max){
|
||||||
throw new ServiceException("您今天打招呼的次数已经用完了");
|
throw new ServiceException("您今天打招呼的次数已经用完了");
|
||||||
}
|
}
|
||||||
String sendGreetLock = LockManager.getSendGreetLock(userId);
|
String sendGreetCount = String.format(RedisConstant.USER_GREET_SEND_TIME_REDIS,userId);
|
||||||
String lastTime = stringRedisTemplate.opsForValue().getAndExpire(sendGreetLock, 1, TimeUnit.DAYS);
|
String lastTime = stringRedisTemplate.opsForValue().get(sendGreetCount);
|
||||||
if(StringUtils.isNotBlank(lastTime)){
|
if(StringUtils.isNotBlank(lastTime)){
|
||||||
Integer inter = systemConfigManager.getSystemConfigOfInt(SystemConfigEnum.GREET_INTERVAL_MIN);
|
Integer inter = systemConfigManager.getSystemConfigOfInt(SystemConfigEnum.GREET_INTERVAL_MIN);
|
||||||
long jiange = Long.parseLong(lastTime) - DateUtil.currentSeconds();
|
long jiange = Long.parseLong(lastTime) - DateUtil.currentSeconds();
|
||||||
@@ -140,7 +141,7 @@ public class UserGreetServiceImpl extends ServiceImpl<UserGreetMapper,UserGreet>
|
|||||||
if(!r.isSuccess()){
|
if(!r.isSuccess()){
|
||||||
throw new ServiceException("发送失败");
|
throw new ServiceException("发送失败");
|
||||||
}
|
}
|
||||||
stringRedisTemplate.opsForValue().set(sendGreetLock,DateUtil.currentSeconds()+"",1,TimeUnit.DAYS);
|
stringRedisTemplate.opsForValue().set(sendGreetCount,DateUtil.currentSeconds()+"",1,TimeUnit.DAYS);
|
||||||
stringRedisTemplate.opsForValue().increment(numKey);
|
stringRedisTemplate.opsForValue().increment(numKey);
|
||||||
stringRedisTemplate.expire(numKey,1,TimeUnit.DAYS);
|
stringRedisTemplate.expire(numKey,1,TimeUnit.DAYS);
|
||||||
}finally {
|
}finally {
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ public class UserInviteServiceImpl extends ServiceImpl<UserInviteMapper, UserInv
|
|||||||
InviteCountDTO inviteCount = baseMapper.countInviteAndReward(userId);
|
InviteCountDTO inviteCount = baseMapper.countInviteAndReward(userId);
|
||||||
vo.setTotalInvite(inviteCount.getTotalInvite());
|
vo.setTotalInvite(inviteCount.getTotalInvite());
|
||||||
vo.setTotalReward(inviteCount.getTotalReward());
|
vo.setTotalReward(inviteCount.getTotalReward());
|
||||||
return null;
|
return vo;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -3,14 +3,17 @@ package com.ruoyi.cai.service.impl;
|
|||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.ruoyi.cai.domain.User;
|
||||||
import com.ruoyi.cai.domain.UserVisitor;
|
import com.ruoyi.cai.domain.UserVisitor;
|
||||||
import com.ruoyi.cai.dto.app.query.StarOrVisitorReq;
|
import com.ruoyi.cai.dto.app.query.StarOrVisitorReq;
|
||||||
import com.ruoyi.cai.dto.app.query.VisitorQuery;
|
import com.ruoyi.cai.dto.app.query.VisitorQuery;
|
||||||
import com.ruoyi.cai.dto.app.vo.user.UserStarOrVisitorList;
|
import com.ruoyi.cai.dto.app.vo.user.UserStarOrVisitorList;
|
||||||
import com.ruoyi.cai.mapper.UserVisitorMapper;
|
import com.ruoyi.cai.mapper.UserVisitorMapper;
|
||||||
import com.ruoyi.cai.service.UserCountService;
|
import com.ruoyi.cai.service.UserCountService;
|
||||||
|
import com.ruoyi.cai.service.UserService;
|
||||||
import com.ruoyi.cai.service.UserVisitorService;
|
import com.ruoyi.cai.service.UserVisitorService;
|
||||||
import com.ruoyi.common.core.domain.PageQuery;
|
import com.ruoyi.common.core.domain.PageQuery;
|
||||||
|
import com.ruoyi.common.exception.ServiceException;
|
||||||
import com.ruoyi.common.helper.LoginHelper;
|
import com.ruoyi.common.helper.LoginHelper;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -29,8 +32,15 @@ import java.time.LocalDateTime;
|
|||||||
public class UserVisitorServiceImpl extends ServiceImpl<UserVisitorMapper, UserVisitor> implements UserVisitorService {
|
public class UserVisitorServiceImpl extends ServiceImpl<UserVisitorMapper, UserVisitor> implements UserVisitorService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private UserCountService userCountService;
|
private UserCountService userCountService;
|
||||||
|
@Autowired
|
||||||
|
private UserService userService;
|
||||||
@Override
|
@Override
|
||||||
public boolean visitor(StarOrVisitorReq starOrVisitorReq) {
|
public boolean visitor(StarOrVisitorReq starOrVisitorReq) {
|
||||||
|
User user = userService.getById(starOrVisitorReq.getToUserId());
|
||||||
|
if(user == null){
|
||||||
|
log.error("用户不存在");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
Long fromUserId = LoginHelper.getUserId();
|
Long fromUserId = LoginHelper.getUserId();
|
||||||
UserVisitor userVisitor = this.getOne(Wrappers.lambdaQuery(UserVisitor.class)
|
UserVisitor userVisitor = this.getOne(Wrappers.lambdaQuery(UserVisitor.class)
|
||||||
.eq(UserVisitor::getVisitorId, fromUserId)
|
.eq(UserVisitor::getVisitorId, fromUserId)
|
||||||
@@ -49,6 +59,9 @@ public class UserVisitorServiceImpl extends ServiceImpl<UserVisitorMapper, UserV
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<UserStarOrVisitorList> pageApp(PageQuery pageQuery, VisitorQuery query) {
|
public Page<UserStarOrVisitorList> pageApp(PageQuery pageQuery, VisitorQuery query) {
|
||||||
|
if(query.getType() == null || (query.getType() != 1 && query.getType() != 2)){
|
||||||
|
throw new ServiceException("参数异常");
|
||||||
|
}
|
||||||
query.setUserId(LoginHelper.getUserId());
|
query.setUserId(LoginHelper.getUserId());
|
||||||
return baseMapper.pageApp(pageQuery.build(),query);
|
return baseMapper.pageApp(pageQuery.build(),query);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,13 +22,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<update id="decrCoin">
|
<update id="decrCoin">
|
||||||
update cai_account
|
update cai_account
|
||||||
set coin = coin - #{coin}
|
set coin = coin - #{coin}
|
||||||
where user_id = #{userId} and (coin - #{coin}) > 0
|
where user_id = #{userId} and (coin - #{coin}) >= 0
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<update id="decrIncomeCoin">
|
<update id="decrIncomeCoin">
|
||||||
update cai_account
|
update cai_account
|
||||||
set income_coin = income_coin - #{incomeCoin}
|
set income_coin = income_coin - #{incomeCoin}
|
||||||
where user_id = #{userId} and (income_coin - #{incomeCoin}) > 0
|
where user_id = #{userId} and (income_coin - #{incomeCoin}) >= 0
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<update id="incsIncomeCoin">
|
<update id="incsIncomeCoin">
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
order by t1.create_time desc
|
order by t1.create_time desc
|
||||||
</select>
|
</select>
|
||||||
<select id="pageApp" resultType="com.ruoyi.cai.dto.app.vo.AnchorListVo">
|
<select id="pageApp" resultType="com.ruoyi.cai.dto.app.vo.AnchorListVo">
|
||||||
select t1.avatar,t1.gender,t1.city,t1.nickname,t1.usercode,t1.city_id,t1.city,t2.give_score
|
select t1.id as user_id,t1.avatar,t1.gender,t1.city,t1.nickname,t1.usercode,t1.city_id,t1.city,t2.give_score
|
||||||
from cai_user t1
|
from cai_user t1
|
||||||
join cai_anchor t2 on t1.id = t2.user_id
|
join cai_anchor t2 on t1.id = t2.user_id
|
||||||
join cai_user_online t3 on t1.id = t3.user_id
|
join cai_user_online t3 on t1.id = t3.user_id
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
and t3.id is not null
|
and t3.id is not null
|
||||||
</if>
|
</if>
|
||||||
<if test="query.type != null and query.type == 3">
|
<if test="query.type != null and query.type == 3">
|
||||||
and t1.city_id = #{query.city}
|
and t1.city_id = #{query.cityId}
|
||||||
</if>
|
</if>
|
||||||
order by t1.create_time desc
|
order by t1.create_time desc
|
||||||
</select>
|
</select>
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<result property="createTime" column="create_time"/>
|
<result property="createTime" column="create_time"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
<select id="pageApp" resultType="com.ruoyi.cai.dto.app.vo.user.UserListVo">
|
<select id="pageApp" resultType="com.ruoyi.cai.dto.app.vo.user.UserListVo">
|
||||||
select t2.avatar,t2.gender,t2.city,t2.nickname,t2.usercode,t2.age
|
select t2.id as user_id,t2.avatar,t2.gender,t2.city_id,t2.city,t2.nickname,t2.usercode,t2.age
|
||||||
from cai_user_blacklist t1
|
from cai_user_blacklist t1
|
||||||
join cai_user t2 on t1.user_id = t2.id
|
join cai_user t2 on t1.user_id = t2.id
|
||||||
where t1.user_id = #{userId}
|
where t1.user_id = #{userId}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
where invite_id = #{userId}
|
where invite_id = #{userId}
|
||||||
</select>
|
</select>
|
||||||
<select id="inviteUserPage" resultType="com.ruoyi.cai.dto.app.vo.user.UserListVo">
|
<select id="inviteUserPage" resultType="com.ruoyi.cai.dto.app.vo.user.UserListVo">
|
||||||
select t2.avatar,t2.gender,t2.city,t2.nickname,t2.usercode,t2.age, t1.create_time as bind_time
|
select t1.user_id,t2.avatar,t2.gender,t2.city,t2.nickname,t2.usercode,t2.age, t1.create_time as bind_time
|
||||||
from cai_user_invite t1
|
from cai_user_invite t1
|
||||||
join cai_user t2 on t1.user_id = t2.id
|
join cai_user t2 on t1.user_id = t2.id
|
||||||
where t1.invite_id = #{inviteId}
|
where t1.invite_id = #{inviteId}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
and t1.mobile = #{query.mobile}
|
and t1.mobile = #{query.mobile}
|
||||||
</if>
|
</if>
|
||||||
<if test="query.usercode != null and query.usercode != ''">
|
<if test="query.usercode != null and query.usercode != ''">
|
||||||
and t1.usercode like concat('%',#{query.usercode},'%')
|
and t1.usercode = #{query.usercode}
|
||||||
</if>
|
</if>
|
||||||
<if test="query.gender != null">
|
<if test="query.gender != null">
|
||||||
and t1.gender = #{query.gender}
|
and t1.gender = #{query.gender}
|
||||||
@@ -31,7 +31,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
order by t2.last_login_time desc
|
order by t2.last_login_time desc
|
||||||
</select>
|
</select>
|
||||||
<select id="pageApp" resultType="com.ruoyi.cai.dto.app.vo.user.UserListVo">
|
<select id="pageApp" resultType="com.ruoyi.cai.dto.app.vo.user.UserListVo">
|
||||||
select t1.avatar,t1.gender,t1.city,t1.city_id,t1.nickname,t1.usercode,t1.age,t2.last_live_time
|
select t1.avatar,t1.id as user_id,t1.gender,t1.city,t1.city_id,t1.nickname,t1.usercode,t1.age,t2.last_live_time as bind_time
|
||||||
from cai_user t1
|
from cai_user t1
|
||||||
join cai_user_online t2 on t1.id = t2.user_id
|
join cai_user_online t2 on t1.id = t2.user_id
|
||||||
where t1.status = 0
|
where t1.status = 0
|
||||||
@@ -47,7 +47,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
order by t2.last_live_time desc
|
order by t2.last_live_time desc
|
||||||
</select>
|
</select>
|
||||||
<select id="greetPageApp" resultType="com.ruoyi.cai.dto.app.vo.user.UserListVo">
|
<select id="greetPageApp" resultType="com.ruoyi.cai.dto.app.vo.user.UserListVo">
|
||||||
select t1.avatar,t1.gender,t1.city,t1.city_id,t1.nickname,t1.usercode,t1.age,t2.last_live_time
|
select t1.avatar,t1.id as user_id,t1.gender,t1.city,t1.city_id,t1.nickname,t1.usercode,t1.age,t2.last_live_time as bind_time
|
||||||
from cai_user t1
|
from cai_user t1
|
||||||
join cai_user_online t2 on t1.id = t2.user_id
|
join cai_user_online t2 on t1.id = t2.user_id
|
||||||
where t1.status = 0
|
where t1.status = 0
|
||||||
|
|||||||
@@ -14,7 +14,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<select id="pageApp" resultType="com.ruoyi.cai.dto.app.vo.user.UserStarOrVisitorList">
|
<select id="pageApp" resultType="com.ruoyi.cai.dto.app.vo.user.UserStarOrVisitorList">
|
||||||
select
|
select
|
||||||
t1.create_time as happen_time,t1.is_watch,
|
t1.create_time as happen_time,t1.is_watch,
|
||||||
t2.avatar,t2.gender,t2.city,t2.nickname,t2.usercode,t2.age
|
t2.id as user_id,
|
||||||
|
t2.avatar,t2.gender,t2.city_id,t2.city,t2.nickname,t2.usercode,t2.age
|
||||||
from cai_user_visitor t1
|
from cai_user_visitor t1
|
||||||
join cai_user t2 on t1.user_id = t2.id
|
join cai_user t2 on t1.user_id = t2.id
|
||||||
<where>
|
<where>
|
||||||
@@ -25,7 +26,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
and t1.user_id = #{query.userId}
|
and t1.user_id = #{query.userId}
|
||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
order by create_time desc
|
order by t1.create_time desc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -151,7 +151,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.github.xiaoymin</groupId>
|
<groupId>com.github.xiaoymin</groupId>
|
||||||
<artifactId>knife4j-openapi3-spring-boot-starter</artifactId>
|
<artifactId>knife4j-openapi3-spring-boot-starter</artifactId>
|
||||||
<version>4.1.0</version>
|
<version>4.2.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- 离线IP地址定位库 -->
|
<!-- 离线IP地址定位库 -->
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ public class PageQuery implements Serializable {
|
|||||||
* 分页大小
|
* 分页大小
|
||||||
*/
|
*/
|
||||||
@Schema(description = "分页大小")
|
@Schema(description = "分页大小")
|
||||||
private Integer pageSize;
|
private Integer pageSize = 20;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 当前页数
|
* 当前页数
|
||||||
@@ -58,7 +58,8 @@ public class PageQuery implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* 每页显示记录数 默认值 默认查全部
|
* 每页显示记录数 默认值 默认查全部
|
||||||
*/
|
*/
|
||||||
public static final int DEFAULT_PAGE_SIZE = Integer.MAX_VALUE;
|
// public static final int DEFAULT_PAGE_SIZE = Integer.MAX_VALUE;
|
||||||
|
public static final int DEFAULT_PAGE_SIZE = 20;
|
||||||
|
|
||||||
public <T> Page<T> build() {
|
public <T> Page<T> build() {
|
||||||
Integer pageNum = ObjectUtil.defaultIfNull(getPageNum(), DEFAULT_PAGE_NUM);
|
Integer pageNum = ObjectUtil.defaultIfNull(getPageNum(), DEFAULT_PAGE_NUM);
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ public class GlobalExceptionHandler {
|
|||||||
public R<Void> handleNotLoginException(NotLoginException e, HttpServletRequest request) {
|
public R<Void> handleNotLoginException(NotLoginException e, HttpServletRequest request) {
|
||||||
String requestURI = request.getRequestURI();
|
String requestURI = request.getRequestURI();
|
||||||
log.error("请求地址'{}',认证失败'{}',无法访问系统资源", requestURI, e.getMessage());
|
log.error("请求地址'{}',认证失败'{}',无法访问系统资源", requestURI, e.getMessage());
|
||||||
return R.fail(HttpStatus.HTTP_UNAUTHORIZED, "认证失败,无法访问系统资源");
|
return R.fail(HttpStatus.HTTP_UNAUTHORIZED, "认证失败,请登录");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -147,7 +147,7 @@ public class GlobalExceptionHandler {
|
|||||||
public R<Void> handleRuntimeException(RuntimeException e, HttpServletRequest request) {
|
public R<Void> handleRuntimeException(RuntimeException e, HttpServletRequest request) {
|
||||||
String requestURI = request.getRequestURI();
|
String requestURI = request.getRequestURI();
|
||||||
log.error("请求地址'{}',发生未知异常.", requestURI, e);
|
log.error("请求地址'{}',发生未知异常.", requestURI, e);
|
||||||
return R.fail(e.getMessage());
|
return R.fail("系统异常");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -157,7 +157,7 @@ public class GlobalExceptionHandler {
|
|||||||
public R<Void> handleException(Exception e, HttpServletRequest request) {
|
public R<Void> handleException(Exception e, HttpServletRequest request) {
|
||||||
String requestURI = request.getRequestURI();
|
String requestURI = request.getRequestURI();
|
||||||
log.error("请求地址'{}',发生系统异常.", requestURI, e);
|
log.error("请求地址'{}',发生系统异常.", requestURI, e);
|
||||||
return R.fail(e.getMessage());
|
return R.fail("系统异常");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import org.springframework.stereotype.Component;
|
|||||||
@Component
|
@Component
|
||||||
@ConfigurationProperties(prefix = "yunxin")
|
@ConfigurationProperties(prefix = "yunxin")
|
||||||
public class YunxinProperties {
|
public class YunxinProperties {
|
||||||
private String baseUrl = "https://api.netease.im/nimserver";
|
private String baseUrl = "https://api.netease.im";
|
||||||
private String appKey;
|
private String appKey;
|
||||||
private String appSecret;
|
private String appSecret;
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,8 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.security.MessageDigest;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Component
|
@Component
|
||||||
public class GlodonTokenInterceptor implements Interceptor {
|
public class GlodonTokenInterceptor implements Interceptor {
|
||||||
@@ -27,7 +29,7 @@ public class GlodonTokenInterceptor implements Interceptor {
|
|||||||
request.addHeader("AppKey",yunxinProperties.getAppKey());
|
request.addHeader("AppKey",yunxinProperties.getAppKey());
|
||||||
request.addHeader("Nonce", nonce);
|
request.addHeader("Nonce", nonce);
|
||||||
request.addHeader("CurTime", curTime);
|
request.addHeader("CurTime", curTime);
|
||||||
request.addHeader("CheckSum", yunxinProperties.getAppSecret()+nonce+curTime);
|
request.addHeader("CheckSum", getCheckSum(yunxinProperties.getAppSecret(),nonce,curTime));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -53,4 +55,36 @@ public class GlodonTokenInterceptor implements Interceptor {
|
|||||||
response.getContent());
|
response.getContent());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 计算并获取CheckSum
|
||||||
|
public static String getCheckSum(String appSecret, String nonce, String curTime) {
|
||||||
|
return encode("sha1", appSecret + nonce + curTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String encode(String algorithm, String value) {
|
||||||
|
if (value == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
MessageDigest messageDigest
|
||||||
|
= MessageDigest.getInstance(algorithm);
|
||||||
|
messageDigest.update(value.getBytes());
|
||||||
|
return getFormattedText(messageDigest.digest());
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String getFormattedText(byte[] bytes) {
|
||||||
|
int len = bytes.length;
|
||||||
|
StringBuilder buf = new StringBuilder(len * 2);
|
||||||
|
for (int j = 0; j < len; j++) {
|
||||||
|
buf.append(HEX_DIGITS[(bytes[j] >> 4) & 0x0f]);
|
||||||
|
buf.append(HEX_DIGITS[bytes[j] & 0x0f]);
|
||||||
|
}
|
||||||
|
return buf.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final char[] HEX_DIGITS = { '0', '1', '2', '3', '4', '5',
|
||||||
|
'6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user