Merge branch 'test' into dev
This commit is contained in:
@@ -34,8 +34,9 @@ public class ApiAccessLimitUtil {
|
||||
|
||||
/**
|
||||
* 默认 当月5次
|
||||
* @param id 唯一值
|
||||
* @param key 接口名称 sys:limit:接口名称
|
||||
*
|
||||
* @param id 唯一值
|
||||
* @param key 接口名称 sys:limit:接口名称
|
||||
* @return
|
||||
*/
|
||||
public static boolean isAccessAllowed(String id, String key) {
|
||||
@@ -58,9 +59,10 @@ public class ApiAccessLimitUtil {
|
||||
|
||||
/**
|
||||
* 默认月 month/月/自然月
|
||||
* @param id 唯一值
|
||||
* @param key 接口名称 sys:limit:接口名称
|
||||
* @param count 次数限制
|
||||
*
|
||||
* @param id 唯一值
|
||||
* @param key 接口名称 sys:limit:接口名称
|
||||
* @param count 次数限制
|
||||
* @return
|
||||
*/
|
||||
public static boolean isAccessAllowed(String id, String key, Integer count) {
|
||||
@@ -82,9 +84,10 @@ public class ApiAccessLimitUtil {
|
||||
|
||||
/**
|
||||
* 默认 5次
|
||||
*
|
||||
* @param id 唯一值
|
||||
* @param key 接口名称 sys:limit:接口名称
|
||||
* @param timeFormat day/天/自然天 week/周/本周日 month/月/自然月 year/年/自然年
|
||||
* @param timeFormat day/天/自然天 week/周/本周日 month/月/自然月 year/年/自然年
|
||||
* @return
|
||||
*/
|
||||
public static boolean isAccessAllowed(String id, String key, String timeFormat) {
|
||||
@@ -108,7 +111,7 @@ public class ApiAccessLimitUtil {
|
||||
* @param id 唯一值
|
||||
* @param key 接口名称 sys:limit:接口名称
|
||||
* @param count 次数限制
|
||||
* @param timeFormat day/天/自然天 week/周/本周日 month/月/自然月 year/年/自然年
|
||||
* @param timeFormat day/天/自然天 week/周/本周日 month/月/自然月 year/年/自然年
|
||||
* @return
|
||||
*/
|
||||
public static boolean isAccessAllowed(String id, String key, Integer count, String timeFormat) {
|
||||
@@ -118,7 +121,7 @@ public class ApiAccessLimitUtil {
|
||||
long expireAt;
|
||||
if (StrUtil.isBlank(timeFormat)) {
|
||||
expireAt = count;
|
||||
}else {
|
||||
} else {
|
||||
// 根据不同时间周期设置过期时间并初始化访问次数为1
|
||||
expireAt = calculateExpireAt(timeFormat);
|
||||
}
|
||||
@@ -133,14 +136,40 @@ public class ApiAccessLimitUtil {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean getCertAuthIsAccessAllowed(String id, String key, Integer count) {
|
||||
String redisKey = "app:updateLimit:auth:" + key + ":" + id;
|
||||
Object countObj = redisUtils.get(redisKey);
|
||||
if (countObj == null) {
|
||||
return true;
|
||||
}
|
||||
return Integer.parseInt(countObj.toString()) < count;
|
||||
}
|
||||
|
||||
public static void setCertAuthIsAccessAllowed(String id, String key, Integer count, String timeFormat) {
|
||||
String redisKey = "app:updateLimit:auth:" + key + ":" + id;
|
||||
Object countObj = redisUtils.get(redisKey);
|
||||
if (countObj == null) {
|
||||
long expireAt;
|
||||
if (StrUtil.isBlank(timeFormat)) {
|
||||
expireAt = count;
|
||||
} else {
|
||||
// 根据不同时间周期设置过期时间并初始化访问次数为1
|
||||
expireAt = calculateExpireAt(timeFormat);
|
||||
}
|
||||
redisUtils.set(redisKey, 1, expireAt);
|
||||
} else {
|
||||
redisUtils.incr(redisKey);
|
||||
}
|
||||
}
|
||||
|
||||
public static void removeKey(String id, String key) {
|
||||
String redisKey = generateRedisKey(key, id);
|
||||
redisUtils.delete(redisKey);
|
||||
}
|
||||
|
||||
|
||||
public static<T> T runFunAndCheckKey(Supplier<T> supplier, String lockKey, Integer seconds) {
|
||||
try{
|
||||
public static <T> T runFunAndCheckKey(Supplier<T> supplier, String lockKey, Integer seconds) {
|
||||
try {
|
||||
// 创建线程id, 用作判断
|
||||
String clientId = UUID.randomUUID().toString();
|
||||
// 设置分布式锁
|
||||
@@ -154,12 +183,12 @@ public class ApiAccessLimitUtil {
|
||||
lock = Boolean.TRUE.equals(redisUtils.setIfAbsent(lockKey, clientId, seconds));
|
||||
}
|
||||
return supplier.get();
|
||||
} catch (RuntimeException e){
|
||||
} catch (RuntimeException e) {
|
||||
log.error("执行出错", e);
|
||||
throw e;
|
||||
} catch (InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
} finally{
|
||||
} finally {
|
||||
redisUtils.delete(lockKey);
|
||||
}
|
||||
}
|
||||
@@ -189,7 +218,7 @@ public class ApiAccessLimitUtil {
|
||||
Date now = DateUtil.beginOfDay(DateUtil.date());
|
||||
Date expireDate = null;
|
||||
if ("day".equals(timePeriod)) {
|
||||
expireDate = DateUtil.endOfDay(now);
|
||||
expireDate = DateUtil.endOfDay(now);
|
||||
} else if ("week".equals(timePeriod)) {
|
||||
expireDate = DateUtil.endOfWeek(now);
|
||||
} else if ("month".equals(timePeriod)) {
|
||||
|
||||
@@ -37,9 +37,6 @@ import java.util.*;
|
||||
@ConfigurationProperties(prefix = "spring.shardingsphere")
|
||||
public class ShardingConfig {
|
||||
|
||||
@Value("${spring.profiles.active}")
|
||||
private String activeProfile;
|
||||
|
||||
/**
|
||||
* 读取数据源信息
|
||||
*/
|
||||
|
||||
@@ -9,7 +9,6 @@ import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.sqx.common.annotation.Debounce;
|
||||
import com.sqx.common.exception.SqxException;
|
||||
import com.sqx.common.utils.ApiAccessLimitUtil;
|
||||
import com.sqx.common.utils.DataLimitUtil;
|
||||
import com.sqx.common.utils.Result;
|
||||
@@ -33,6 +32,7 @@ import java.util.Map;
|
||||
|
||||
/**
|
||||
* APP登录授权
|
||||
* @author mac
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/app/user")
|
||||
@@ -104,83 +104,75 @@ public class AppController {
|
||||
UserInfo userInfo = userInfoService.getByUserId(userId);
|
||||
UserEntity userEntity = userService.getById(userId);
|
||||
|
||||
String errMsg = null;
|
||||
if (StrUtil.isNotBlank(zhiFuBao) && !zhiFuBao.equals(userEntity.getZhiFuBao())) {
|
||||
if (StrUtil.isNotBlank(zhiFuBao) && (!zhiFuBao.equals(userEntity.getZhiFuBao())) || !certName.equals(userEntity.getZhiFuBaoName())) {
|
||||
int count = userService.count(new QueryWrapper<UserEntity>()
|
||||
.ne("user_id", userId)
|
||||
.eq("zhi_fu_bao_name", certName)
|
||||
.eq("zhi_fu_bao", zhiFuBao));
|
||||
if (count > 0) {
|
||||
errMsg = "支付宝信息修改失败: 一个支付宝账号仅可绑定一个用户";
|
||||
return Result.error("支付宝信息修改失败: 此支付宝账号已被绑定");
|
||||
}
|
||||
if (errMsg == null && StrUtil.isNotBlank(userInfo.getCertName()) && !certName.equals(userInfo.getCertName())) {
|
||||
errMsg = "支付宝信息修改失败: 姓名与实名认证信息不相符";
|
||||
if (StrUtil.isNotBlank(userInfo.getCertName()) && !certName.equals(userInfo.getCertName())) {
|
||||
return Result.error("支付宝信息修改失败: 姓名与实名认证信息不相符");
|
||||
}
|
||||
|
||||
if (errMsg == null && !DataLimitUtil.isAccessAllowed(zhiFuBao+certName, Integer.parseInt(commonRepository.findOne(924).getValue()), "month")) {
|
||||
errMsg = "支付宝信息修改失败: 相同支付宝账号每月可绑定次数已用完";
|
||||
if (!DataLimitUtil.isAccessAllowed(zhiFuBao + certName, Integer.parseInt(commonRepository.findOne(924).getValue()), "month")) {
|
||||
return Result.error("支付宝信息修改失败: 相同支付宝账号每月可绑定次数已用完");
|
||||
}
|
||||
|
||||
if (errMsg == null && !ApiAccessLimitUtil.isAccessAllowed(userId.toString(), "updateZFB", Integer.parseInt(commonRepository.findOne(925).getValue()), "month")) {
|
||||
errMsg = "支付宝信息修改失败: 每月可修改次数已用完,请联系管理员";
|
||||
if (!ApiAccessLimitUtil.isAccessAllowed(userId.toString(), "updateZFB", Integer.parseInt(commonRepository.findOne(925).getValue()), "month")) {
|
||||
return Result.error("支付宝信息修改失败: 每月可修改次数已用完,请联系管理员");
|
||||
}
|
||||
|
||||
if (errMsg == null) {
|
||||
userEntity.setZhiFuBao(zhiFuBao);
|
||||
userEntity.setZhiFuBaoName(certName);
|
||||
userService.update(userEntity, new LambdaQueryWrapper<UserEntity>().eq(UserEntity::getUserId, userId));
|
||||
}
|
||||
userEntity.setZhiFuBao(zhiFuBao);
|
||||
userEntity.setZhiFuBaoName(certName);
|
||||
userService.update(userEntity, new LambdaQueryWrapper<UserEntity>().eq(UserEntity::getUserId, userId));
|
||||
}
|
||||
|
||||
if (StrUtil.isBlank(certNum)) {
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
String authErrMsg = null;
|
||||
if (StrUtil.isNotBlank(certNum) && !certNum.equals(userInfo.getCertNo())) {
|
||||
if (!certNum.equals(userInfo.getCertNo()) || !certName.equals(userInfo.getCertName())) {
|
||||
if (StrUtil.isNotBlank(userEntity.getZhiFuBaoName()) && !certName.equals(userEntity.getZhiFuBaoName())) {
|
||||
authErrMsg = "实名修改失败: 姓名与绑定支付宝信息不相符";
|
||||
return Result.error("实名修改失败: 姓名与绑定支付宝信息不相符");
|
||||
}
|
||||
if (authErrMsg == null && !IdcardUtil.isValidCard(certNum)) {
|
||||
authErrMsg = "实名修改失败: 身份证号码有误";
|
||||
if (!IdcardUtil.isValidCard(certNum)) {
|
||||
return Result.error("实名修改失败: 身份证号码有误");
|
||||
}
|
||||
|
||||
if (authErrMsg == null) {
|
||||
Integer idCount = userInfoService.countCertCount(certName, certNum);
|
||||
if (idCount > 1) {
|
||||
authErrMsg = "实名修改失败: 此实名信息已存在";
|
||||
}
|
||||
}
|
||||
|
||||
if (authErrMsg == null && !ApiAccessLimitUtil.isAccessAllowed(String.valueOf(userId), "updateAuthCertInfo", 1, "month")) {
|
||||
authErrMsg = "实名修改失败: 账号每月可修改次数已用完,请联系管理员";
|
||||
}
|
||||
|
||||
if (authErrMsg == null && !ApiAccessLimitUtil.isAccessAllowed(certNum, "updateAuthCertInfoByIdCard", 1, "month")) {
|
||||
authErrMsg = "实名修改失败: 此身份证信息次月已绑定过,请联系管理员";
|
||||
}
|
||||
|
||||
if (authErrMsg == null) {
|
||||
try {
|
||||
aliService.authCertNo(certName, certNum);
|
||||
userInfo.setCertName(certName);
|
||||
userInfo.setCertNo(certNum);
|
||||
userInfo.setUpdateTime(DateUtil.date());
|
||||
userInfoService.update(userInfo, new LambdaQueryWrapper<UserInfo>().eq(UserInfo::getUserId, userId));
|
||||
}catch (Exception e) {
|
||||
ApiAccessLimitUtil.removeKey(String.valueOf(userId), "updateAuthCertInfo");
|
||||
ApiAccessLimitUtil.removeKey(certNum, "updateAuthCertInfoByIdCard");
|
||||
authErrMsg = "实名修改失败: 身份证信息不匹配";
|
||||
Integer idCount = userInfoService.countCertCount(certName, certNum);
|
||||
if (idCount >= 1) {
|
||||
return Result.error("实名修改失败: 此身份证信息已绑定过");
|
||||
}
|
||||
|
||||
if (!ApiAccessLimitUtil.getCertAuthIsAccessAllowed(String.valueOf(userId), "updateAuthCertInfo", 1)) {
|
||||
return Result.error("实名修改失败: 每月可修改次数已用完,请联系管理员");
|
||||
}
|
||||
|
||||
if (!ApiAccessLimitUtil.getCertAuthIsAccessAllowed(certNum, "updateAuthCertInfoByIdCard", 1)) {
|
||||
return Result.error("实名修改失败: 每月可修改次数已用完,请联系管理员");
|
||||
}
|
||||
|
||||
try {
|
||||
aliService.authCertNo(certName, certNum);
|
||||
userInfo.setCertName(certName);
|
||||
userInfo.setCertNo(certNum);
|
||||
userInfo.setUpdateTime(DateUtil.date());
|
||||
boolean update = userInfoService.update(userInfo, new LambdaQueryWrapper<UserInfo>().eq(UserInfo::getUserId, userId).eq(UserInfo::getId, userInfo.getId()));
|
||||
if (!update) {
|
||||
return Result.error("实名修改失败: 请稍后重试");
|
||||
}
|
||||
ApiAccessLimitUtil.setCertAuthIsAccessAllowed(String.valueOf(userId), "updateAuthCertInfo", 1, "month");
|
||||
ApiAccessLimitUtil.setCertAuthIsAccessAllowed(certNum, "updateAuthCertInfoByIdCard", 1, "month");
|
||||
return Result.success();
|
||||
} catch (Exception e) {
|
||||
return Result.error("实名修改失败: 身份证信息不匹配");
|
||||
}
|
||||
}
|
||||
|
||||
if (errMsg != null || authErrMsg != null) {
|
||||
authErrMsg = authErrMsg == null ? "" : authErrMsg;
|
||||
return Result.error(errMsg == null ? authErrMsg : errMsg + " " + authErrMsg);
|
||||
}
|
||||
return Result.success();
|
||||
// 去除首绑支付宝奖励
|
||||
// if (bool && isFirstBind) {
|
||||
// userService.firstBindAwardsMoney(old);
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
@@ -194,22 +186,6 @@ public class AppController {
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
/*@Login
|
||||
@RequestMapping(value = "/updateUsers", method = RequestMethod.POST)
|
||||
@ApiOperation("用户修改个人信息")
|
||||
@ResponseBody
|
||||
public Result updateUsers(@RequestAttribute("userId") Long userId,String userName,String avatar,String phone) {
|
||||
UserEntity userEntity=new UserEntity();
|
||||
userEntity.setUserId(userId);
|
||||
userEntity.setUserName(userName);
|
||||
userEntity.setAvatar(avatar);
|
||||
userEntity.setPhone(phone);
|
||||
userService.updateById(userEntity);
|
||||
return Result.success();
|
||||
}*/
|
||||
|
||||
|
||||
@Login
|
||||
@RequestMapping(value = "/updateUserImageUrl", method = RequestMethod.POST)
|
||||
@ApiOperation("用户修改头像")
|
||||
|
||||
@@ -167,16 +167,6 @@ public class AppLoginController {
|
||||
return userService.sendMsg(phone, state,null);
|
||||
}
|
||||
|
||||
@Login
|
||||
@Debounce(value = "#authCertNoDTO.idNum")
|
||||
@PostMapping("/authCertNo")
|
||||
public Result authCertNo(@RequestBody @Validated AuthCertNoDTO authCertNoDTO, @RequestAttribute("userId") long userId) {
|
||||
if (!ApiAccessLimitUtil.isAccessAllowed(String.valueOf(userId), "updateAuthCertInfo", 1, "month")) {
|
||||
return Result.error("每月可修改次数已用完,请联系管理员");
|
||||
}
|
||||
return Result.success().put("data", userService.authCertNo(userId, authCertNoDTO));
|
||||
}
|
||||
|
||||
@ApiOperation("解密手机号")
|
||||
@RequestMapping(value = "/selectPhone",method = RequestMethod.POST)
|
||||
public Result getPhoneNumberBeanS5(@RequestBody WxPhone wxPhone) {
|
||||
|
||||
@@ -7,6 +7,7 @@ import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 用户
|
||||
@@ -35,7 +36,7 @@ public interface UserDao extends BaseMapper<UserEntity> {
|
||||
|
||||
int insertUser(UserEntity userEntity);
|
||||
|
||||
List<UserEntity> selectInviteUserList(String userName,String phone);
|
||||
List<UserEntity> selectInviteUserList(@Param("queryUserIdList") Set<Long> queryUserIdList);
|
||||
|
||||
int selectUserOnLineCount(String qdCode);
|
||||
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.sqx.modules.app.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 用户黑名单
|
||||
* @author tankaikai
|
||||
* @since 2025-01-07 12:56
|
||||
*/
|
||||
@Data
|
||||
@TableName(value ="tb_user_blacklist")
|
||||
public class TbUserBlacklist implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(type=IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
private String idCardNo;
|
||||
|
||||
private String realName;
|
||||
|
||||
}
|
||||
@@ -61,6 +61,18 @@ public class UserEntity implements Serializable {
|
||||
@ApiModelProperty("性别 1男 2女")
|
||||
private Integer sex;
|
||||
|
||||
/**
|
||||
* 姓名
|
||||
*/
|
||||
@TableField("cert_name")
|
||||
private String certName;
|
||||
|
||||
/**
|
||||
* 身份证号码
|
||||
*/
|
||||
@TableField("cert_no")
|
||||
private String certNo;
|
||||
|
||||
/**
|
||||
* 微信小程序openid
|
||||
*/
|
||||
|
||||
@@ -2,13 +2,17 @@ package com.sqx.modules.app.interceptor;
|
||||
|
||||
|
||||
import cn.hutool.core.thread.ThreadUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.sqx.common.exception.CzgException;
|
||||
import com.sqx.common.exception.SqxException;
|
||||
import com.sqx.common.utils.DateUtils;
|
||||
import com.sqx.common.utils.IPUtils;
|
||||
import com.sqx.modules.app.annotation.Login;
|
||||
import com.sqx.modules.app.entity.TbUserBlacklist;
|
||||
import com.sqx.modules.app.entity.UserEntity;
|
||||
import com.sqx.modules.app.mapper.TbUserBlacklistMapper;
|
||||
import com.sqx.modules.app.service.UserService;
|
||||
import com.sqx.modules.app.utils.JwtUtils;
|
||||
import com.sqx.modules.redisService.RedisService;
|
||||
@@ -36,6 +40,8 @@ public class AuthorizationInterceptor extends HandlerInterceptorAdapter {
|
||||
private JwtUtils jwtUtils;
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
@Autowired
|
||||
private TbUserBlacklistMapper tbUserBlacklistMapper;
|
||||
|
||||
private final RedisService redisService;
|
||||
|
||||
@@ -91,9 +97,9 @@ public class AuthorizationInterceptor extends HandlerInterceptorAdapter {
|
||||
throw new CzgException("ip跳动过于频繁,请联系管理员解封");
|
||||
}
|
||||
|
||||
ThreadUtil.execAsync(() -> {
|
||||
redisService.recordUrlVisitCountWithIp(userId, request.getRequestURI(), ip);
|
||||
});
|
||||
// ThreadUtil.execAsync(() -> {
|
||||
// redisService.recordUrlVisitCountWithIp(userId, request.getRequestURI(), ip);
|
||||
// });
|
||||
|
||||
// 设置 userId 到 request 里,后续根据 userId 获取用户信息
|
||||
UserEntity user = userService.selectUserById(userId);
|
||||
@@ -101,6 +107,13 @@ public class AuthorizationInterceptor extends HandlerInterceptorAdapter {
|
||||
throw new CzgException("异常行为用户: {}" + user.getUserId());
|
||||
}
|
||||
|
||||
if (StrUtil.isNotBlank(user.getCertNo())) {
|
||||
TbUserBlacklist blacklist = tbUserBlacklistMapper.selectOne(Wrappers.<TbUserBlacklist>lambdaQuery().eq(TbUserBlacklist::getIdCardNo, user.getCertNo()));
|
||||
if (blacklist != null) {
|
||||
throw new CzgException(StrUtil.format("黑名单用户,禁止访问:{} / {}", blacklist.getRealName(), blacklist.getIdCardNo()));
|
||||
}
|
||||
}
|
||||
|
||||
if (redisService.isRecordUserOnLineTime(userId)) {
|
||||
ThreadUtil.execAsync(() -> {
|
||||
// 记录用户最后一次调用接口的时间
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.sqx.modules.app.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.sqx.modules.app.entity.TbUserBlacklist;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 支付宝黑名单 Mapper
|
||||
* @author tankaikai
|
||||
* @since 2025-01-07 12:56
|
||||
*/
|
||||
@Mapper
|
||||
public interface TbUserBlacklistMapper extends BaseMapper<TbUserBlacklist> {
|
||||
}
|
||||
@@ -20,7 +20,6 @@ import com.aliyuncs.profile.DefaultProfile;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.getui.push.v2.sdk.ApiHelper;
|
||||
import com.getui.push.v2.sdk.GtApiConfiguration;
|
||||
@@ -34,6 +33,7 @@ import com.getui.push.v2.sdk.dto.req.message.android.GTNotification;
|
||||
import com.getui.push.v2.sdk.dto.req.message.ios.Alert;
|
||||
import com.getui.push.v2.sdk.dto.req.message.ios.Aps;
|
||||
import com.getui.push.v2.sdk.dto.req.message.ios.IosDTO;
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.github.qcloudsms.SmsSingleSenderResult;
|
||||
@@ -126,8 +126,6 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
|
||||
private final UserVipDao userVipDao;
|
||||
private final InviteAchievementService inviteAchievementService;
|
||||
|
||||
@Value("${spring.profiles.active}")
|
||||
private String profiles;
|
||||
|
||||
private ReentrantReadWriteLock reentrantReadWriteLock = new ReentrantReadWriteLock(true);
|
||||
|
||||
@@ -1525,19 +1523,50 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
|
||||
|
||||
@Override
|
||||
public Result selectInviteUserList(Integer page, Integer limit, String userName, String phone) {
|
||||
PageHelper.startPage(page,limit);
|
||||
List<UserEntity> userEntities = baseMapper.selectInviteUserList(userName, phone);
|
||||
if (!userEntities.isEmpty()) {
|
||||
Set<Long> userIdList = userEntities.stream().map(UserEntity::getUserId).collect(Collectors.toSet());
|
||||
LambdaQueryWrapper<UserEntity> queryWrapper = new LambdaQueryWrapper<>();
|
||||
if(StrUtil.isNotBlank(userName)) {
|
||||
queryWrapper.like(UserEntity::getUserName, userName);
|
||||
}
|
||||
|
||||
if (StrUtil.isNotBlank(phone)) {
|
||||
queryWrapper.like(UserEntity::getPhone, phone);
|
||||
}
|
||||
|
||||
Set<Long> queryUserIdList = null;
|
||||
if (!queryWrapper.isEmptyOfWhere()) {
|
||||
queryUserIdList = list(queryWrapper.select(UserEntity::getUserId)).stream().map(UserEntity::getUserId).collect(Collectors.toSet());
|
||||
}
|
||||
|
||||
PageHelper.startPage(page, limit);
|
||||
List<UserEntity> inviteList = baseMapper.selectInviteUserList(queryUserIdList);
|
||||
|
||||
List<UserEntity> userInfoList = new ArrayList<>();
|
||||
if (!inviteList.isEmpty()) {
|
||||
Map<String, Integer> countInfoMap = new HashMap<>();
|
||||
ArrayList<String> inviteCodeList = new ArrayList<>();
|
||||
inviteList.forEach(item -> {
|
||||
countInfoMap.put(item.getInviterCode(), item.getCounts());
|
||||
inviteCodeList.add(item.getInviterCode());
|
||||
});
|
||||
|
||||
userInfoList = list(new LambdaQueryWrapper<UserEntity>().in(UserEntity::getInvitationCode, inviteCodeList));
|
||||
|
||||
Set<Long> useridList = userInfoList.stream().map(UserEntity::getUserId).collect(Collectors.toSet());
|
||||
Map<Long, UserMoney> infoMap = userMoneyService.list(new LambdaQueryWrapper<UserMoney>()
|
||||
.in(UserMoney::getUserId, userIdList))
|
||||
.in(UserMoney::getUserId, useridList))
|
||||
.stream().collect(Collectors.toMap(UserMoney::getUserId, item -> item));
|
||||
userEntities.forEach(item -> {
|
||||
userInfoList.forEach(item -> {
|
||||
UserMoney userMoney = infoMap.get(item.getUserId());
|
||||
item.setMoney(userMoney == null ? BigDecimal.ZERO : userMoney.getInviteIncomeMoney());
|
||||
Integer i = countInfoMap.get(item.getInvitationCode());
|
||||
item.setCounts(i == null ? 0 : i);
|
||||
});
|
||||
}
|
||||
return Result.success().put("data", PageUtils.page(new PageInfo<>(userEntities),true));
|
||||
|
||||
userInfoList = userInfoList.stream()
|
||||
.sorted((u1, u2) -> Integer.compare(u2.getCounts(), u1.getCounts())) // 按 counts 降序
|
||||
.collect(Collectors.toList());
|
||||
return Result.success().put("data", PageUtils.page(new PageInfo<>(userInfoList),true));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -29,7 +29,7 @@ public class AppCourseController extends AbstractController {
|
||||
@Autowired
|
||||
private RedisUtils redisUtils;
|
||||
|
||||
@Login
|
||||
// @Login
|
||||
@GetMapping("/selectCourse")
|
||||
@ApiOperation("查询短剧信息")
|
||||
public Result selectCourse(@ApiParam("页") Integer page, @ApiParam("条") Integer limit, @ApiParam("分类id") Long classifyId,
|
||||
|
||||
@@ -20,4 +20,5 @@ public interface CourseCollectDao extends BaseMapper<CourseCollect> {
|
||||
|
||||
|
||||
List<Course> selectClassify1In3(@Param("userId") Long userId);
|
||||
List<Course> selectClassify1ByUserId(@Param("userId") Long userId);
|
||||
}
|
||||
|
||||
@@ -132,10 +132,16 @@ public class CourseCollectServiceImpl extends ServiceImpl<CourseCollectDao, Cour
|
||||
@CachePut(value = "app:courseCollect", key = "#userId")
|
||||
public Result selectByUserId(Integer page, Integer limit, Long userId, Integer classify) {
|
||||
PageHelper.startPage(page, limit);
|
||||
//查 收藏记录
|
||||
List<Course> courses = baseMapper.selectClassify1In3(userId);
|
||||
List<Course> courses = new ArrayList<>();
|
||||
//收藏
|
||||
if (classify.equals(1)) {
|
||||
//查 收藏记录
|
||||
courses = baseMapper.selectClassify1In3(userId);
|
||||
} else {
|
||||
courses = baseMapper.selectClassify1ByUserId(userId);
|
||||
}
|
||||
if (CollectionUtil.isEmpty(courses)) {
|
||||
return Result.success();
|
||||
return Result.success().put("data", PageUtils.page(new PageInfo<>(courses), true));
|
||||
}
|
||||
//剧id
|
||||
Set<Long> courseIdList = new HashSet<>();
|
||||
@@ -151,7 +157,8 @@ public class CourseCollectServiceImpl extends ServiceImpl<CourseCollectDao, Cour
|
||||
List<CourseDetails> courseDetails1 = courseIdList.isEmpty() ? new ArrayList<>() :
|
||||
courseDetailsService.list(new LambdaQueryWrapper<CourseDetails>().in(CourseDetails::getCourseDetailsId, courseDetailIds));
|
||||
Map<Long, CourseDetails> courseDetailsMap = courseDetails1.stream().collect(Collectors.toMap(CourseDetails::getCourseId, item -> item));
|
||||
Map<Long, Integer> countMap = courseDetailsDao.countByCourseId(courseIdList).stream()
|
||||
List<CourseDetails> courseDetails2 = courseDetailsDao.countByCourseId(courseIdList);
|
||||
Map<Long, Integer> countMap = courseDetails2.stream()
|
||||
.collect(Collectors.toMap(CourseDetails::getCourseId, CourseDetails::getCourseDetailsCount));
|
||||
|
||||
if (CollectionUtil.isNotEmpty(courseList)) {
|
||||
|
||||
@@ -10,6 +10,7 @@ import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Profile;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -20,6 +21,7 @@ import java.util.List;
|
||||
|
||||
@Component
|
||||
@EnableScheduling
|
||||
@Profile({"prod"})
|
||||
public class SpinningTask3 {
|
||||
|
||||
@Resource
|
||||
@@ -27,16 +29,11 @@ public class SpinningTask3 {
|
||||
@Resource
|
||||
private DiscSpinningRecordService recordService;
|
||||
|
||||
@Value("${spring.profiles.active}")
|
||||
private String profiles;
|
||||
|
||||
private Logger logger = LoggerFactory.getLogger(getClass());
|
||||
|
||||
@Scheduled(cron = "0 0/5 * * * ? ")
|
||||
@Scheduled(cron = "0 0/1 * * * ? ")
|
||||
public void record() {
|
||||
if (!"prod".equals(profiles)) {
|
||||
return;
|
||||
}
|
||||
record("1");
|
||||
}
|
||||
|
||||
|
||||
@@ -2,12 +2,14 @@ package com.sqx.modules.job.task;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.sqx.modules.pay.dao.CashOutDao;
|
||||
import com.sqx.modules.pay.entity.CashOut;
|
||||
import com.sqx.modules.pay.wuyou.BaseResp;
|
||||
import com.sqx.modules.pay.wuyou.WuyouPay;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
@@ -23,19 +25,32 @@ public class TempCashOutTask{
|
||||
|
||||
private Logger logger = LoggerFactory.getLogger(getClass());
|
||||
|
||||
public void run(String params) {
|
||||
@Scheduled(cron = "0 0/8 * * * ? ")
|
||||
public void run() {
|
||||
logger.info("提现开始");
|
||||
List<CashOut> cashOuts = cashOutDao.selectTemp();
|
||||
List<CashOut> cashOuts = cashOutDao.selectTemp(DateUtil.offsetMinute(DateUtil.date(), 5));
|
||||
for (CashOut cashOut : cashOuts) {
|
||||
BaseResp baseResp = wuyouPay.queryExtractOrder(cashOut.getOrderNumber(), cashOut.getUserId(), cashOut.getUserType() != 2, cashOut.getMoney());
|
||||
logger.info("baseResp:{} ", JSONUtil.toJsonStr(baseResp));
|
||||
if (baseResp.getStatus() != null && (baseResp.getStatus().equals(2) || baseResp.getStatus().equals(10000))){
|
||||
logger.info("success:{} ", cashOut.getOrderNumber());
|
||||
cashOut.setState(1);
|
||||
cashOut.setOutAt(DateUtil.now());
|
||||
cashOut.setRefund(null);
|
||||
cashOut.setOutAt(DateUtil.now());
|
||||
cashOutDao.updateById(cashOut);
|
||||
try {
|
||||
BaseResp baseResp;
|
||||
if (DateUtil.parse(cashOut.getCreateAt()).compareTo(DateUtil.parse("2025-01-06 16:50:00")) < 0) {
|
||||
baseResp = wuyouPay.queryExtractOrder(cashOut.getOrderNumber(), cashOut.getUserId(), cashOut.getUserType() != 2, cashOut.getMoney());
|
||||
}else {
|
||||
baseResp = wuyouPay.queryExtractOrder(cashOut.getOrderNumber(), cashOut.getMoney());
|
||||
}
|
||||
logger.info("baseResp:{} ", JSONUtil.toJsonStr(baseResp));
|
||||
if (baseResp.getStatus() != null && (baseResp.getStatus().equals(2) || baseResp.getStatus().equals(10000))){
|
||||
logger.info("success:{} ", cashOut.getOrderNumber());
|
||||
cashOut.setState(1);
|
||||
cashOut.setOutAt(DateUtil.now());
|
||||
cashOut.setRefund(null);
|
||||
cashOut.setOutAt(DateUtil.now());
|
||||
cashOutDao.update(cashOut, new LambdaQueryWrapper<CashOut>().eq(CashOut::getUserId, cashOut.getUserId()).eq(CashOut::getId, cashOut.getId()));
|
||||
}else if (baseResp.getStatus() != null && baseResp.getStatus().equals(3)) {
|
||||
cashOut.setState(2);
|
||||
cashOutDao.update(cashOut, new LambdaQueryWrapper<CashOut>().eq(CashOut::getUserId, cashOut.getUserId()).eq(CashOut::getId, cashOut.getId()));
|
||||
}
|
||||
}catch (Exception e) {
|
||||
logger.error("体现定时任务查询出错", e);
|
||||
}
|
||||
}
|
||||
logger.info("提现结束");
|
||||
|
||||
@@ -7,8 +7,6 @@ import cn.hutool.json.JSONUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.sqx.common.utils.DateUtils;
|
||||
import com.sqx.modules.app.entity.InviteAchievement;
|
||||
import com.sqx.modules.app.entity.UserEntity;
|
||||
@@ -23,7 +21,6 @@ import com.sqx.modules.complet.entity.CompletAward;
|
||||
import com.sqx.modules.complet.service.CompletAwardService;
|
||||
import com.sqx.modules.course.service.CourseService;
|
||||
import com.sqx.modules.invite.dao.InviteDao;
|
||||
import com.sqx.modules.invite.entity.Invite;
|
||||
import com.sqx.modules.invite.service.InviteService;
|
||||
import com.sqx.modules.orders.dao.OrdersDao;
|
||||
import com.sqx.modules.orders.entity.Orders;
|
||||
@@ -160,6 +157,7 @@ public class TempOrdersTask {
|
||||
order.setPayWay(9);
|
||||
order.setStatus(1);
|
||||
order.setPayTime(DateUtils.format(new Date()));
|
||||
ordersService.fillSysUserId(order);
|
||||
|
||||
ordersService.update(order, new LambdaQueryWrapper<Orders>()
|
||||
.eq(Orders::getOrdersId, order.getOrdersId()).eq(Orders::getUserId, order.getUserId()));
|
||||
|
||||
@@ -53,7 +53,7 @@ public class AppMessageController {
|
||||
@RequestMapping(value = "/selectMessage", method = RequestMethod.GET)
|
||||
@ApiOperation("查询用户消息")
|
||||
@ResponseBody
|
||||
@Login
|
||||
// @Login
|
||||
public Result selectMessage(int page, int limit,Integer state){
|
||||
Map<String,Object> map=new HashMap<>();
|
||||
map.put("page",page);
|
||||
|
||||
@@ -65,4 +65,9 @@ public interface OrdersService extends IService<Orders> {
|
||||
Integer countOrderNum(Long userId, String time);
|
||||
|
||||
|
||||
/**
|
||||
* 填充渠道用户id
|
||||
* @param orders
|
||||
*/
|
||||
void fillSysUserId(Orders orders);
|
||||
}
|
||||
|
||||
@@ -15,10 +15,7 @@ import com.github.pagehelper.PageInfo;
|
||||
import com.sqx.common.utils.DateUtils;
|
||||
import com.sqx.common.utils.PageUtils;
|
||||
import com.sqx.common.utils.Result;
|
||||
import com.sqx.modules.app.entity.UserMoney;
|
||||
import com.sqx.modules.app.entity.UserMoneyDetails;
|
||||
import com.sqx.modules.app.entity.UserVip;
|
||||
import com.sqx.modules.app.entity.VipDetails;
|
||||
import com.sqx.modules.app.entity.*;
|
||||
import com.sqx.modules.app.service.*;
|
||||
import com.sqx.modules.common.service.CommonInfoService;
|
||||
import com.sqx.modules.course.dao.CourseDao;
|
||||
@@ -37,6 +34,8 @@ import com.sqx.modules.orders.service.OrdersService;
|
||||
import com.sqx.modules.pay.controller.app.AliPayController;
|
||||
import com.sqx.modules.pay.service.DyService;
|
||||
import com.sqx.modules.pay.service.WxService;
|
||||
import com.sqx.modules.sys.dao.SysUserDao;
|
||||
import com.sqx.modules.sys.entity.SysUserEntity;
|
||||
import com.sqx.modules.utils.AliPayOrderUtil;
|
||||
import com.sqx.modules.utils.InvitationCodeUtil;
|
||||
import com.sqx.modules.utils.TimeCompleteUtils;
|
||||
@@ -88,6 +87,9 @@ public class OrdersServiceImpl extends ServiceImpl<OrdersDao, Orders> implements
|
||||
@Autowired
|
||||
private CourseDetailsDao courseDetailsDao;
|
||||
|
||||
@Autowired
|
||||
private SysUserDao sysUserDao;
|
||||
|
||||
private ReentrantReadWriteLock reentrantReadWriteLock = new ReentrantReadWriteLock(true);
|
||||
|
||||
|
||||
@@ -319,7 +321,8 @@ public class OrdersServiceImpl extends ServiceImpl<OrdersDao, Orders> implements
|
||||
orders.setCreateTime(df.format(new Date()));
|
||||
//设置订单种类
|
||||
orders.setOrdersType(1);
|
||||
|
||||
// 填充系统用户id
|
||||
fillSysUserId(orders);
|
||||
//不是会员或会员过期直接生成订单直接生成订单
|
||||
int count = baseMapper.insert(orders);
|
||||
result.put("flag", 2);
|
||||
@@ -435,7 +438,7 @@ public class OrdersServiceImpl extends ServiceImpl<OrdersDao, Orders> implements
|
||||
orders.setCreateTime(df.format(new Date()));
|
||||
//设置订单种类
|
||||
orders.setOrdersType(1);
|
||||
|
||||
fillSysUserId(orders);
|
||||
//不是会员或会员过期直接生成订单直接生成订单
|
||||
int count = baseMapper.insert(orders);
|
||||
result.put("flag", 2);
|
||||
@@ -483,6 +486,7 @@ public class OrdersServiceImpl extends ServiceImpl<OrdersDao, Orders> implements
|
||||
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
//设置创建时间
|
||||
orders.setCreateTime(df.format(new Date()));
|
||||
fillSysUserId(orders);
|
||||
//插入到订单表中
|
||||
baseMapper.insert(orders);
|
||||
return Result.success().put("data", orders);
|
||||
@@ -563,6 +567,7 @@ public class OrdersServiceImpl extends ServiceImpl<OrdersDao, Orders> implements
|
||||
// orders.setSysUserId(Long.parseLong(String.valueOf(sysUserId)));
|
||||
// orders.setQdMoney(new BigDecimal(String.valueOf(map.get("qdMoney"))));
|
||||
// }
|
||||
fillSysUserId(orders);
|
||||
baseMapper.updateById(orders);
|
||||
insertOrders(orders);
|
||||
return Result.success();
|
||||
@@ -669,7 +674,7 @@ public class OrdersServiceImpl extends ServiceImpl<OrdersDao, Orders> implements
|
||||
List<Orders> orders = baseMapper.selectOrdersByOrdersNo(ordersNo, status, userId, courseId,
|
||||
flag, time, userName, ordersType, TimeCompleteUtils.completeStartTime(startTime), TimeCompleteUtils.completeEndTime(endTime), sysUserId, qdCode, sysUserName);
|
||||
Set<Long> courseIds = orders.stream().map(Orders::getCourseId).collect(Collectors.toSet());
|
||||
if(CollUtil.isNotEmpty(courseIds)) {
|
||||
if (CollUtil.isNotEmpty(courseIds)) {
|
||||
List<Course> courses = courseDao.selectBatchIds(courseIds);
|
||||
Map<Long, String> map = courses.stream().collect(Collectors.toMap(Course::getCourseId, Course::getTitle));
|
||||
orders.parallelStream().forEach(s -> {
|
||||
@@ -779,4 +784,25 @@ public class OrdersServiceImpl extends ServiceImpl<OrdersDao, Orders> implements
|
||||
public Integer countOrderNum(Long userId, String time) {
|
||||
return baseMapper.countOrderNum(userId, time);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fillSysUserId(Orders orders) {
|
||||
if (orders.getSysUserId() != null) {
|
||||
return;
|
||||
}
|
||||
orders.setSysUserId(1L);
|
||||
UserEntity userEntity = userService.selectUserById(orders.getUserId());
|
||||
if (userEntity == null) {
|
||||
return;
|
||||
}
|
||||
String qdCode = userEntity.getQdCode();
|
||||
if (StrUtil.isBlank(qdCode)) {
|
||||
return;
|
||||
}
|
||||
SysUserEntity sysUserEntity = sysUserDao.selectOne(Wrappers.<SysUserEntity>lambdaQuery().eq(SysUserEntity::getQdCode, qdCode).last("LIMIT 1"));
|
||||
if (sysUserEntity == null) {
|
||||
return;
|
||||
}
|
||||
orders.setSysUserId(sysUserEntity.getSysUserId());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.sqx.modules.pay.dao;
|
||||
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.sqx.modules.pay.entity.CashOut;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
@@ -22,7 +23,7 @@ public interface CashOutDao extends BaseMapper<CashOut> {
|
||||
|
||||
List<CashOut> selectYesterday();
|
||||
|
||||
List<CashOut> selectTemp();
|
||||
List<CashOut> selectTemp(@Param("time")DateTime time);
|
||||
|
||||
Double selectCashOutSum(@Param("userId") Long userId, @Param("startTime") Date startTime, @Param("endTime") Date endTime);
|
||||
|
||||
|
||||
@@ -115,25 +115,23 @@ public class CashOutServiceImpl extends ServiceImpl<CashOutDao, CashOut> impleme
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageUtils selectCashOutList(Integer page, Integer limit, CashOut cashOut,@Param("isApp") boolean isApp) {
|
||||
public PageUtils selectCashOutList(Integer page, Integer limit, CashOut cashOut, @Param("isApp") boolean isApp) {
|
||||
|
||||
LambdaQueryWrapper<CashOut> queryWrapper = new LambdaQueryWrapper<>();
|
||||
if (isApp) {
|
||||
queryWrapper.eq(CashOut::getUserId, cashOut.getUserId())
|
||||
.eq(CashOut::getUserType, 1);
|
||||
}else {
|
||||
if (cashOut.getSysUserId() != null) {
|
||||
} else {
|
||||
if (cashOut.getSysUserId() == null) {
|
||||
return PageUtils.page(new PageInfo<>());
|
||||
}else {
|
||||
queryWrapper.eq(CashOut::getUserId, cashOut.getSysUserId())
|
||||
.eq(CashOut::getUserType, 2);
|
||||
}
|
||||
}
|
||||
|
||||
if (!isApp && cashOut.getUserId() != null) {
|
||||
queryWrapper.eq(CashOut::getUserId, cashOut.getUserId());
|
||||
}
|
||||
|
||||
PageHelper.startPage(page, limit);
|
||||
List<CashOut> cashOutList = list(queryWrapper.eq(CashOut::getUserType, 1).orderByDesc(CashOut::getCreateAt));
|
||||
List<CashOut> cashOutList = list(queryWrapper.orderByDesc(CashOut::getCreateAt));
|
||||
|
||||
if (!isApp) {
|
||||
ArrayList<Long> userIdList = new ArrayList<>();
|
||||
@@ -662,9 +660,9 @@ public class CashOutServiceImpl extends ServiceImpl<CashOutDao, CashOut> impleme
|
||||
|
||||
if (StrUtil.isNotBlank(cashOut.getStartTime()) && StrUtil.isNotBlank(cashOut.getEndTime())) {
|
||||
queryWrapper.between(CashOut::getCreateAt, cashOut.getStartTime(), cashOut.getEndTime());
|
||||
}else if (StrUtil.isNotBlank(cashOut.getStartTime())) {
|
||||
} else if (StrUtil.isNotBlank(cashOut.getStartTime())) {
|
||||
queryWrapper.ge(CashOut::getCreateAt, cashOut.getStartTime());
|
||||
}else if (StrUtil.isNotBlank(cashOut.getEndTime())) {
|
||||
} else if (StrUtil.isNotBlank(cashOut.getEndTime())) {
|
||||
queryWrapper.le(CashOut::getCreateAt, cashOut.getEndTime());
|
||||
}
|
||||
|
||||
|
||||
@@ -412,6 +412,7 @@ public class DyServiceImpl implements DyService {
|
||||
orders.setPayWay(7);
|
||||
orders.setStatus(1);
|
||||
orders.setPayTime(DateUtils.format(new Date()));
|
||||
ordersService.fillSysUserId(orders);
|
||||
ordersService.updateById(orders);
|
||||
UserEntity user = userService.selectUserById(orders.getUserId());
|
||||
UserEntity byUser = userService.queryByInvitationCode(user.getInviterCode());
|
||||
@@ -431,6 +432,7 @@ public class DyServiceImpl implements DyService {
|
||||
orders.setSysUserId(Long.parseLong(String.valueOf(sysUserId)));
|
||||
orders.setQdMoney(new BigDecimal(String.valueOf(map.get("qdMoney"))));
|
||||
}
|
||||
ordersService.fillSysUserId(orders);
|
||||
ordersService.insertOrders(orders);
|
||||
}else{
|
||||
String remark = payDetails.getRemark();
|
||||
@@ -502,6 +504,7 @@ public class DyServiceImpl implements DyService {
|
||||
if(StringUtils.isNotEmpty(currency) && "DIAMOND".equals(currency)){
|
||||
orders.setDiamond(1);
|
||||
}
|
||||
ordersService.fillSysUserId(orders);
|
||||
ordersService.updateById(orders);
|
||||
UserEntity user = userService.selectUserById(orders.getUserId());
|
||||
UserEntity byUser = userService.queryByInvitationCode(user.getInviterCode());
|
||||
@@ -521,6 +524,7 @@ public class DyServiceImpl implements DyService {
|
||||
orders.setSysUserId(Long.parseLong(String.valueOf(sysUserId)));
|
||||
orders.setQdMoney(new BigDecimal(String.valueOf(map.get("qdMoney"))));
|
||||
}
|
||||
ordersService.fillSysUserId(orders);
|
||||
ordersService.insertOrders(orders);
|
||||
}else{
|
||||
if(StringUtils.isNotEmpty(currency) && "DIAMOND".equals(currency)){
|
||||
@@ -615,5 +619,4 @@ public class DyServiceImpl implements DyService {
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -188,6 +188,7 @@ public class KsServiceImpl implements KsService {
|
||||
orders.setPayWay(8);
|
||||
orders.setStatus(1);
|
||||
orders.setPayTime(DateUtils.format(new Date()));
|
||||
ordersService.fillSysUserId(orders);
|
||||
ordersService.updateById(orders);
|
||||
UserEntity user = userService.selectUserById(orders.getUserId());
|
||||
UserEntity byUser = userService.queryByInvitationCode(user.getInviterCode());
|
||||
@@ -207,6 +208,7 @@ public class KsServiceImpl implements KsService {
|
||||
orders.setSysUserId(Long.parseLong(String.valueOf(sysUserId)));
|
||||
orders.setQdMoney(new BigDecimal(String.valueOf(map.get("qdMoney"))));
|
||||
}
|
||||
ordersService.fillSysUserId(orders);
|
||||
ordersService.insertOrders(orders);
|
||||
}else{
|
||||
userMoneyService.updateMoney(1,payDetails.getUserId(),payDetails.getMoney());
|
||||
|
||||
@@ -10,9 +10,11 @@ import com.sqx.modules.pay.dao.PayDetailsDao;
|
||||
import com.sqx.modules.pay.entity.PayDetails;
|
||||
import com.sqx.modules.pay.service.PayDetailsService;
|
||||
import com.sqx.modules.utils.TimeCompleteUtils;
|
||||
import org.apache.shardingsphere.api.hint.HintManager;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@@ -303,6 +303,7 @@ public class WxServiceImpl implements WxService {
|
||||
orders.setSysUserId(Long.parseLong(String.valueOf(sysUserId)));
|
||||
orders.setQdMoney(new BigDecimal(String.valueOf(map.get("qdMoney"))));
|
||||
}
|
||||
ordersService.fillSysUserId(orders);
|
||||
ordersService.updateById(orders);
|
||||
ordersService.insertOrders(orders);
|
||||
}else{
|
||||
@@ -383,6 +384,7 @@ public class WxServiceImpl implements WxService {
|
||||
orders.setSysUserId(Long.parseLong(String.valueOf(sysUserId)));
|
||||
orders.setQdMoney(new BigDecimal(String.valueOf(map.get("qdMoney"))));
|
||||
}
|
||||
ordersService.fillSysUserId(orders);
|
||||
ordersService.updateById(orders);
|
||||
ordersService.insertOrders(orders);
|
||||
}else{
|
||||
|
||||
@@ -127,6 +127,7 @@ spring:
|
||||
- qrtz_cron_triggers
|
||||
- qrtz_calendars
|
||||
- qrtz_blob_triggers
|
||||
- tb_user_blacklist
|
||||
|
||||
# 日志配置
|
||||
logging:
|
||||
|
||||
@@ -299,22 +299,16 @@
|
||||
|
||||
|
||||
<select id="selectInviteUserList" resultType="com.sqx.modules.app.entity.UserEntity">
|
||||
SELECT
|
||||
u.*,
|
||||
IFNULL( b.counts, 0 ) AS counts,
|
||||
0 AS money
|
||||
FROM
|
||||
tb_user u
|
||||
LEFT JOIN ( SELECT inviter_code, COUNT(*) AS counts FROM tb_user u1 GROUP BY inviter_code ) AS b ON u.invitation_code = b.inviter_code
|
||||
WHERE
|
||||
1 = 1
|
||||
<if test="userName!=null and userName!=''">
|
||||
and user_name like concat('%',#{userName},'%')
|
||||
SELECT any_value(inviter_code) as inviterCode, COUNT(*) AS counts
|
||||
FROM tb_user
|
||||
<if test="queryUserIdList != null">
|
||||
where user_id in
|
||||
<foreach collection="queryUserIdList" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="phone!=null and phone!=''">
|
||||
and phone like concat('%',#{phone},'%')
|
||||
</if>
|
||||
order by money desc,counts desc
|
||||
|
||||
GROUP BY inviter_code order by counts desc
|
||||
</select>
|
||||
|
||||
<select id="selectUserOnLineCount" resultType="Integer">
|
||||
|
||||
@@ -40,5 +40,15 @@
|
||||
WHERE
|
||||
c1.classify = 3
|
||||
AND c1.user_id = #{userId}
|
||||
order by c1.create_time desc
|
||||
</select>
|
||||
|
||||
<select id="selectClassify1ByUserId" resultType="com.sqx.modules.course.entity.Course">
|
||||
SELECT c1.course_id as courseId,
|
||||
c1.course_details_id as courseDetailsId
|
||||
FROM `course_collect` c1
|
||||
WHERE c1.classify = 3
|
||||
AND c1.user_id = #{userId}
|
||||
order by c1.create_time desc
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -108,7 +108,7 @@
|
||||
SELECT course_id as courseId,
|
||||
COUNT(*) AS courseDetailsCount
|
||||
FROM course_details
|
||||
where course_details_id in
|
||||
where course_id in
|
||||
<foreach collection="courseIdList" item="ids" open="(" separator="," close=")">
|
||||
#{ids}
|
||||
</foreach>
|
||||
|
||||
@@ -183,7 +183,7 @@
|
||||
|
||||
<select id="selectOrdersCount" resultType="Integer">
|
||||
select count(*) from orders where 1=1
|
||||
<if test="sysUserId!=null">
|
||||
<if test="sysUserId!=null and sysUserId != 1">
|
||||
and sys_user_id=#{sysUserId}
|
||||
</if>
|
||||
<if test="status!=null">
|
||||
@@ -206,7 +206,7 @@
|
||||
<select id="selectOrdersMoney" resultType="Double">
|
||||
select sum(pay_money) from orders
|
||||
where 1=1
|
||||
<if test="sysUserId!=null">
|
||||
<if test="sysUserId!=null and sysUserId != 1">
|
||||
and sys_user_id=#{sysUserId}
|
||||
</if>
|
||||
<if test="status!=null">
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
<select id="selectTemp" resultType="com.sqx.modules.pay.entity.CashOut">
|
||||
SELECT * FROM cash_out
|
||||
WHERE
|
||||
state = 0 and order_number is not null and order_number != ''
|
||||
(state = 0 or state=4) and order_number is not null and order_number != '' and create_at < #{time}
|
||||
</select>
|
||||
|
||||
<select id="selectCashOutSum" resultType="Double">
|
||||
@@ -26,7 +26,12 @@
|
||||
</select>
|
||||
|
||||
<select id="selectSysUserCashOutSum" resultType="Double">
|
||||
select sum(money) from cash_out where state = 1 and sys_user_id=#{sysUserId} and create_at > #{time}
|
||||
select sum(money) from cash_out where state = 1
|
||||
<if test="sysUserId != null">
|
||||
and user_id=#{sysUserId}
|
||||
</if>
|
||||
and user_type = 2
|
||||
and create_at > #{time}
|
||||
</select>
|
||||
|
||||
<select id="sumMoney" resultType="Double">
|
||||
|
||||
@@ -56,7 +56,6 @@
|
||||
<if test="state==null or state==-1">
|
||||
and s.state!=-1
|
||||
</if>
|
||||
group by s.id
|
||||
order by s.create_time desc
|
||||
</select>
|
||||
|
||||
|
||||
@@ -1,19 +1,9 @@
|
||||
package com.sqx;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import cn.hutool.poi.excel.ExcelUtil;
|
||||
import cn.hutool.poi.excel.ExcelWriter;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.aliyun.credentials.provider.StaticCredentialsProvider;
|
||||
import com.aliyun.tea.TeaException;
|
||||
import com.aliyun.teaopenapi.models.Config;
|
||||
import com.aliyun.dytnsapi20200217.Client;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.sqx.modules.app.dao.UserDao;
|
||||
import com.sqx.modules.app.dao.UserMoneyDao;
|
||||
import com.sqx.modules.app.dao.UserMoneyDetailsDao;
|
||||
@@ -25,26 +15,21 @@ import com.sqx.modules.app.service.InviteAchievementService;
|
||||
import com.sqx.modules.app.service.UserService;
|
||||
import com.sqx.modules.job.task.TempOrdersTask;
|
||||
import com.sqx.modules.orders.service.OrdersService;
|
||||
import com.sqx.modules.pay.controller.app.WuyouController;
|
||||
import com.sqx.modules.pay.dao.PayDetailsDao;
|
||||
import com.sqx.modules.pay.entity.PayDetails;
|
||||
import com.sqx.modules.pay.service.PayDetailsService;
|
||||
import com.sqx.modules.pay.wuyou.BaseResp;
|
||||
import com.sqx.modules.sys.service.SysUserService;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.test.context.ActiveProfiles;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@ActiveProfiles("pay")
|
||||
@@ -76,14 +61,14 @@ public class Tets {
|
||||
@Autowired
|
||||
private OrdersService ordersService;
|
||||
|
||||
@Test
|
||||
//@Test
|
||||
public void test4() {
|
||||
UserEntity userEntity = userDao.selectById(1072962203591784209L);
|
||||
UserEntity userEntity2 = userDao.selectById(1072640875319932689L);
|
||||
tempOrdersTask.activities(userEntity, userEntity2);
|
||||
}
|
||||
|
||||
@Test
|
||||
//@Test
|
||||
public void test3() {
|
||||
List<UserMoneyDetails> userMoneyDetails = userMoneyDetailsDao.selectList(new LambdaQueryWrapper<UserMoneyDetails>().in(UserMoneyDetails::getClassify, 6, 1).isNotNull(UserMoneyDetails::getUserId).groupBy(UserMoneyDetails::getUserId).select(UserMoneyDetails::getUserId));
|
||||
Set<Long> useridList = userMoneyDetails.stream().map(UserMoneyDetails::getUserId).collect(Collectors.toSet());
|
||||
@@ -100,12 +85,12 @@ public class Tets {
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
//@Test
|
||||
public void test2() {
|
||||
inviteAchievementService.remove(new LambdaQueryWrapper<>());
|
||||
|
||||
List<UserEntity> userinfoList = userService.list();
|
||||
|
||||
//Wrappers.<UserEntity>lambdaQuery().apply("create_time >= str_to_date({0}, '%Y-%m-%d %H:%i:%s')", "2025-01-01 00:00:00");
|
||||
List<UserEntity> userinfoList = userService.list(Wrappers.emptyWrapper());
|
||||
System.out.println(userinfoList.size());
|
||||
userinfoList.parallelStream().forEach((userEntity -> {
|
||||
if (StrUtil.isBlank(userEntity.getInviterCode())) return;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user