Merge remote-tracking branch 'origin/test' into test

This commit is contained in:
张松
2024-12-30 23:55:30 +08:00
10 changed files with 83 additions and 57 deletions

View File

@@ -13,6 +13,7 @@ import com.sqx.modules.app.annotation.LoginUser;
import com.sqx.modules.app.entity.UserEntity; import com.sqx.modules.app.entity.UserEntity;
import com.sqx.modules.app.service.AppService; import com.sqx.modules.app.service.AppService;
import com.sqx.modules.app.service.UserService; import com.sqx.modules.app.service.UserService;
import com.sqx.modules.common.service.CommonInfoService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.apache.commons.codec.digest.DigestUtils; import org.apache.commons.codec.digest.DigestUtils;
@@ -33,6 +34,8 @@ public class AppController {
private UserService userService; private UserService userService;
@Autowired @Autowired
private AppService appService; private AppService appService;
@Autowired
private CommonInfoService commonRepository;
@PostMapping("/authenticationRegister") @PostMapping("/authenticationRegister")
@ApiOperation("认证创建账号") @ApiOperation("认证创建账号")
@@ -80,8 +83,8 @@ public class AppController {
if (StrUtil.isEmpty(zhiFuBao) || StrUtil.isEmpty(zhiFuBaoName)) { if (StrUtil.isEmpty(zhiFuBao) || StrUtil.isEmpty(zhiFuBaoName)) {
return Result.error("支付宝账户及姓名不能为空!"); return Result.error("支付宝账户及姓名不能为空!");
} }
if (!DataLimitUtil.isAccessAllowed(zhiFuBao+zhiFuBaoName, 1, "month")) { if (!DataLimitUtil.isAccessAllowed(zhiFuBao+zhiFuBaoName, Integer.parseInt(commonRepository.findOne(924).getValue()), "month")) {
return Result.error("修改失败,相同支付宝账号每月可绑定"); return Result.error("修改失败,相同支付宝账号每月可绑定次数已用完");
} }
int count = userService.count(new QueryWrapper<UserEntity>() int count = userService.count(new QueryWrapper<UserEntity>()
.ne("user_id", userId) .ne("user_id", userId)
@@ -91,8 +94,8 @@ public class AppController {
if (count > 0) { if (count > 0) {
return Result.error("一个支付宝账号仅可绑定一个用户"); return Result.error("一个支付宝账号仅可绑定一个用户");
} }
if (!ApiAccessLimitUtil.isAccessAllowed(userId.toString(), "updateZFB", 3, "month")) { if (!ApiAccessLimitUtil.isAccessAllowed(userId.toString(), "updateZFB", Integer.parseInt(commonRepository.findOne(925).getValue()), "month")) {
return Result.error("每月仅支持修改三次,请联系管理员"); return Result.error("每月可修改次数已用完,请联系管理员");
} }
UserEntity old = userService.getById(userId); UserEntity old = userService.getById(userId);
String accountNo = old.getZhiFuBao(); String accountNo = old.getZhiFuBao();

View File

@@ -19,7 +19,7 @@ public interface BannerDao extends BaseMapper<Banner> {
List<Banner> selectLists(@Param("classify") Integer classify); List<Banner> selectLists(@Param("classify") Integer classify);
List<Banner> selectList(@Param("classify") Integer classify); // List<Banner> selectList(@Param("classify") Integer classify);
IPage<Banner> selectBannerPage(Page<Banner> page,@Param("classify") Integer classify); IPage<Banner> selectBannerPage(Page<Banner> page,@Param("classify") Integer classify);

View File

@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sqx.common.utils.PageUtils; import com.sqx.common.utils.PageUtils;
import com.sqx.common.utils.Result; import com.sqx.common.utils.Result;
import com.sqx.modules.banner.dao.BannerDao; import com.sqx.modules.banner.dao.BannerDao;
import com.sqx.modules.banner.entity.Activity;
import com.sqx.modules.banner.entity.Banner; import com.sqx.modules.banner.entity.Banner;
import com.sqx.modules.banner.service.BannerService; import com.sqx.modules.banner.service.BannerService;
import com.sqx.modules.course.dao.CourseDao; import com.sqx.modules.course.dao.CourseDao;
@@ -40,7 +41,7 @@ public class BannerServiceImpl extends ServiceImpl<BannerDao, Banner> implements
@Override @Override
@Cacheable(key = "#classify") @Cacheable(key = "#classify")
public List<Banner> selectBannerList(Integer classify) { public List<Banner> selectBannerList(Integer classify) {
return bannerDao.selectList(classify); return bannerDao.selectList(new QueryWrapper<Banner>().eq("classify", classify).eq("state", 1).orderByDesc("sort"));
} }

View File

@@ -21,7 +21,7 @@ public class UserIntegralServiceImpl extends ServiceImpl<UserIntegralDao, UserIn
@Override @Override
public UserIntegral selectById(Long id) { public UserIntegral selectById(Long id) {
UserIntegral userIntegral = userIntegralDao.selectById(id); UserIntegral userIntegral = baseMapper.selectById(id);
if (userIntegral == null) { if (userIntegral == null) {
userIntegral = new UserIntegral(); userIntegral = new UserIntegral();
userIntegral.setUserId(id); userIntegral.setUserId(id);

View File

@@ -28,7 +28,7 @@ public class SpinningTask3 {
private Logger logger = LoggerFactory.getLogger(getClass()); private Logger logger = LoggerFactory.getLogger(getClass());
@Scheduled(cron = "0 0/2 * * * ? ") @Scheduled(cron = "0 0/5 * * * ? ")
public void record() { public void record() {
record("1"); record("1");
} }
@@ -41,8 +41,8 @@ public class SpinningTask3 {
params = "1"; params = "1";
} }
// 获取五分钟前的时间 // 获取五分钟前的时间
Date fiveMinutesAgo = DateUtil.offsetMinute(now, Integer.valueOf(params) * -5); Date fiveMinutesAgo = DateUtil.offsetMinute(now, Integer.valueOf(params) * -6);
Date tenMinutesAgo = DateUtil.offsetMinute(now, (Integer.valueOf(params) * -5) - 5); Date tenMinutesAgo = DateUtil.offsetMinute(now, (Integer.valueOf(params) * -6) - 6);
// 将五分钟前的时间转换为指定格式的时间字符串,这里采用常见的"yyyy-MM-dd HH:mm:ss"格式 // 将五分钟前的时间转换为指定格式的时间字符串,这里采用常见的"yyyy-MM-dd HH:mm:ss"格式
String fiveMinutesAgoStr = DateUtil.format(fiveMinutesAgo, "yyyy-MM-dd HH:mm:ss"); String fiveMinutesAgoStr = DateUtil.format(fiveMinutesAgo, "yyyy-MM-dd HH:mm:ss");
String tenMinutesAgoStr = DateUtil.format(tenMinutesAgo, "yyyy-MM-dd HH:mm:ss"); String tenMinutesAgoStr = DateUtil.format(tenMinutesAgo, "yyyy-MM-dd HH:mm:ss");

View File

@@ -29,6 +29,7 @@ import com.sqx.modules.sys.entity.SysUserEntity;
import com.sqx.modules.sys.service.SysUserService; import com.sqx.modules.sys.service.SysUserService;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@@ -71,11 +72,13 @@ public class TempOrdersTask {
private Logger logger = LoggerFactory.getLogger(getClass()); private Logger logger = LoggerFactory.getLogger(getClass());
public void run(String params) {
@Scheduled(cron = "0 0/10 * * * ? ")
public void order() {
logger.info("订单表数据处理开始"); logger.info("订单表数据处理开始");
List<Orders> orders = ordersDao.selectList(Wrappers.<Orders>lambdaQuery() List<Orders> orders = ordersDao.selectList(Wrappers.<Orders>lambdaQuery()
.eq(Orders::getStatus, 0) .eq(Orders::getStatus, 0)
.lt(Orders::getCreateTime, DateUtil.offsetMinute(DateUtil.date(), -5))); .lt(Orders::getCreateTime, DateUtil.offsetMinute(DateUtil.date(), -15)));
if (CollUtil.isEmpty(orders)) { if (CollUtil.isEmpty(orders)) {
return; return;
} }

View File

@@ -16,7 +16,7 @@ import java.util.Map;
@Mapper @Mapper
public interface PayDetailsDao extends BaseMapper<PayDetails> { public interface PayDetailsDao extends BaseMapper<PayDetails> {
PayDetails selectById(@Param("id") Long id); // PayDetails selectById(@Param("id") Long id);
PayDetails selectByRemark(@Param("remark") String remark); PayDetails selectByRemark(@Param("remark") String remark);

View File

@@ -1,37 +1,56 @@
spring: # 数据源的一些配置
datasource:
type: com.alibaba.druid.pool.DruidDataSource
druid:
driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://rm-gc7xx913734hv5w5q.mysql.cn-chengdu.rds.aliyuncs.com/duanju?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=CTT # 最小空闲连接默认值10小于0或大于maximum-pool-size都会重置为maximum-pool-size
minimum-idle: 5
# 最大连接数小于等于0会被重置为默认值10大于零小于1会被重置为minimum-idle的值
maximum-pool-size: 15
# 空闲连接超时时间默认值60000010分钟大于等于max-lifetime且max-lifetime>0会被重置为0不等于0且小于10秒会被重置为10秒。
idle-timeout: 30000
# 连接最大存活时间.不等于0且小于30秒会被重置为默认值30分钟.设置应该比mysql设置的超时时间短
max-lifetime: 30000
# 连接超时时间:毫秒小于250毫秒否则被重置为默认值30秒
connection-timeout: 30000
spring:
# sharding-jdbc 配置
shardingsphere:
center-tables-data-node: duanju.%s
# 显示sharding-jdbc改写的sql语句
show-sql: false
# 数据源名称
datasource:
# 数据源配置begin
master-0:
driver-class-name: ${driver-class-name}
jdbc-url: jdbc:mysql://rm-gc7xx913734hv5w5q.mysql.cn-chengdu.rds.aliyuncs.com/duanju?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=CTT
username: video_user username: video_user
password: VideoUser@1 password: VideoUser@1
initial-size: 50 minimum-idle: ${minimum-idle}
max-active: 200 maximum-pool-size: ${maximum-pool-size}
min-idle: 50 idle-timeout: ${idle-timeout}
max-wait: 60000 max-lifetime: ${max-lifetime}
pool-prepared-statements: true connection-timeout: ${connection-timeout}
max-pool-prepared-statement-per-connection-size: 20 slave-0:
time-between-eviction-runs-millis: 60000 driver-class-name: ${driver-class-name}
min-evictable-idle-time-millis: 300000 jdbc-url: jdbc:mysql://localhost:3306/duanju?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=CTT
#Oracle需要打开注释 username: root
#validation-query: SELECT 1 FROM DUAL password: acddb0c84a192ada
test-while-idle: true minimum-idle: ${minimum-idle}
test-on-borrow: false maximum-pool-size: ${maximum-pool-size}
test-on-return: false idle-timeout: ${idle-timeout}
stat-view-servlet: max-lifetime: ${max-lifetime}
enabled: true connection-timeout: ${connection-timeout}
url-pattern: /druid/* # 数据源配置end
#login-username: admin
#login-password: admin # 读写分离配置begin
filter: master-slave-rules:
stat: #数据源
log-slow-sql: true duanju:
slow-sql-millis: 1000 master-data-source-name: master-0
merge-sql: false slave-data-source-names: slave-0
wall: # - master-0
config: # - slave-0
multi-statement-allow: true
swagger: swagger:
enabled: false enabled: false
pay: pay:

View File

@@ -3,11 +3,11 @@
<mapper namespace="com.sqx.modules.banner.dao.BannerDao"> <mapper namespace="com.sqx.modules.banner.dao.BannerDao">
<select id="selectList" resultType="com.sqx.modules.banner.entity.Banner"> <!-- <select id="selectList" resultType="com.sqx.modules.banner.entity.Banner">-->
select * from banner <!-- select * from banner-->
where classify=#{classify} and `state`=1 <!-- where classify=#{classify} and `state`=1-->
order by `sort` desc <!-- order by `sort` desc-->
</select> <!-- </select>-->
<select id="selectLists" resultType="com.sqx.modules.banner.entity.Banner"> <select id="selectLists" resultType="com.sqx.modules.banner.entity.Banner">
select * from banner select * from banner

View File

@@ -3,9 +3,9 @@
<mapper namespace="com.sqx.modules.pay.dao.PayDetailsDao"> <mapper namespace="com.sqx.modules.pay.dao.PayDetailsDao">
<select id="selectById" resultType="com.sqx.modules.pay.entity.PayDetails"> <!-- <select id="selectById" resultType="com.sqx.modules.pay.entity.PayDetails">-->
select * from pay_details d where d.id=#{id} <!-- select * from pay_details d where d.id=#{id}-->
</select> <!-- </select>-->
<select id="selectByRemark" resultType="com.sqx.modules.pay.entity.PayDetails"> <select id="selectByRemark" resultType="com.sqx.modules.pay.entity.PayDetails">
select * from pay_details d where d.remark=#{remark} select * from pay_details d where d.remark=#{remark}