master
管理员 8 months ago
parent 605c0bc184
commit 7d9141bcb6

@ -4,6 +4,7 @@ import cn.binarywang.wx.miniapp.api.WxMaService;
import cn.binarywang.wx.miniapp.bean.WxMaPhoneNumberInfo;
import cn.binarywang.wx.miniapp.util.WxMaConfigHolder;
import cn.dev33.satoken.annotation.SaIgnore;
import cn.dev33.satoken.context.SaHolder;
import cn.dev33.satoken.stp.StpUtil;
import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.StrUtil;
@ -30,6 +31,7 @@ import com.ruoyi.system.service.ISysUserService;
import com.ruoyi.system.service.SysLoginService;
import lombok.Data;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import me.chanjar.weixin.common.error.WxErrorException;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@ -48,6 +50,7 @@ import java.util.Map;
@Validated
@RequiredArgsConstructor
@RestController
@Slf4j
public class SysLoginController {
private final SysLoginService loginService;
@ -59,6 +62,7 @@ public class SysLoginController {
private final RuoYiConfig config;
private final ISysConfigService configService;
/**
*
*
@ -101,8 +105,10 @@ public class SysLoginController {
}
return ret;
}
/**
*
*
* @param username
* @param password 使RSA
* @return

@ -44,7 +44,7 @@ public class MongoGenerator {
public void generate() throws Exception {
// List<BaseInfo> entityList = scan(); //所有编写了@Info的实体类
List<BaseInfo> entityList = scan("DeviceWarn");//编写了@Info的实体类中的某些类
List<BaseInfo> entityList = scan("DeviceType");//编写了@Info的实体类中的某些类
System.out.println(new ObjectMapper().writerWithDefaultPrettyPrinter().writeValueAsString(entityList));
generate(entityList);
@ -64,6 +64,14 @@ public class MongoGenerator {
*/
File javaRoot = fs[1];
String rd = generate("README.md.vm", null, entityList);
FileUtil.writeString(rd, new File(root, "README-"+moduleName + ".md"), "UTF-8");
// if(true){
// return;
// }
for (BaseInfo entity : entityList) {

@ -0,0 +1,16 @@
#set($a = "#")
#set($b = 0)
#foreach($item in $list)
#set($b = $b + 1)
${a}${a}${a} 5.2.$b ${item.name} - mongodb
集合5.2.$b - ${item.name} - $item.toUpperName()
| **字段名** | **类型** | **说明** | **可为空** |
| -- | -- | ---| - |
#foreach($col in $item.all)
| ${col.toLowerName()} | ${col.clazz.getSimpleName()} | ${col.name} | #if($col.isId)Y #else N #end |
#end
#end

@ -46,7 +46,7 @@ public class ${entity.toUpperName()}Api {
* 获取${entity.name}的分页数据
* @param page 分页对象
* @param ${entity.toLowerName()} 完全匹配条件
* @param ${entity.toUpperName()}Query 其他条件
* @param query 其他条件
* @return ${entity.name}的分页数据
*/
@SaCheckPermission("${moduleName}:${entity.toSimpleLowerName()}:page")

@ -3,7 +3,7 @@ package com.ruoyi.common.event;
import org.springframework.context.ApplicationEvent;
/**
* base2024
* energy2
*/
public class QaEvent extends ApplicationEvent {

@ -11,8 +11,8 @@ public class DynConfigUtils {
* @return bean
* @param <T>
*/
public static <T> T toBean(T config) {
return (T)BeanUtil.toBean(config, config.getClass());
public static <T> T toBean(T config, Class<T> clazz) {
return (T)BeanUtil.toBean(config, clazz);
}
/**
@ -21,6 +21,6 @@ public class DynConfigUtils {
* @param config bean
*/
public static void setBean(Object bean, Object config) {
BeanUtil.copyProperties(bean,config, CopyOptions.create(config.getClass(),true));
BeanUtil.copyProperties(bean,config, CopyOptions.create(bean.getClass(),true));
}
}

@ -485,16 +485,19 @@ public class MongoUtil {
/**
* <pre>
* auto : Integer (increment),Long (increment),String(date_id)
* auto : Integer (increment),Long (snowflake),String(snowflake)
* increment : Integer,Long
* date_id : Long,String(date_id)
* uuid : String
* snowflake: Long String
* </pre>
*/
public static enum FillIdType {
auto, increment, date_id, uuid;
auto, increment, date_id, uuid, snowflake;
}
/**
@ -532,17 +535,21 @@ public class MongoUtil {
} else if (f.getType() == Long.class) {
if (type == FillIdType.date_id) {
ReflectUtil.setFieldValue(entity, f, IdUtils.nextDateIdLong(entity.getClass(), 17));
} else {
} else if(type == FillIdType.increment) {
if (!IdUtils.nextIdInit(entity.getClass())) {
IdUtils.nextIdInit(entity.getClass(), findMaxId(entity.getClass()));
}
ReflectUtil.setFieldValue(entity, f, IdUtils.nextId(entity.getClass()));
}else {
ReflectUtil.setFieldValue(entity, f, IdUtil.getSnowflakeNextId());
}
} else if (f.getType() == String.class) {
if (type == FillIdType.date_id) {
ReflectUtil.setFieldValue(entity, f, IdUtils.nextDateId(entity.getClass(), 17));
} else {
} else if(type == FillIdType.uuid) {
ReflectUtil.setFieldValue(entity, f, UUID.fastUUID().toString(true));
}else{
ReflectUtil.setFieldValue(entity, f, IdUtil.getSnowflakeNextIdStr());
}
}
return entity;

@ -11,8 +11,10 @@ import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.SchedulingConfigurer;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
import org.springframework.scheduling.config.ScheduledTaskRegistrar;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledThreadPoolExecutor;
@ -21,7 +23,7 @@ import java.util.concurrent.ThreadPoolExecutor;
/**
* 线
*
* @author Lion Li
* @author bing huang
**/
@Configuration
@Slf4j
@ -76,7 +78,7 @@ public class ThreadPoolConfig {
t.setPoolSize(core * 2 + 1); // 线程池大小
t.setThreadNamePrefix("t-"); // 线程名称
t.setAwaitTerminationSeconds(60); // 等待时长
t.setWaitForTasksToCompleteOnShutdown(true); // 调度器shutdown被调用时等待当前被调度的任务完成
t.setWaitForTasksToCompleteOnShutdown(false); // 调度器shutdown被调用时等待当前被调度的任务完成
t.initialize();
log.info("创建了自定义线程池{}*size:{}" , t.getThreadNamePrefix(), t.getPoolSize());
return t;

@ -115,7 +115,7 @@ public class GlobalExceptionHandler {
*/
@ExceptionHandler(RuntimeException.class)
public R<Void> handleRuntimeException(RuntimeException e, HttpServletRequest request, HttpServletResponse response) {
if (response.getContentType().contains("text/event-stream")) {
if (response.getContentType()!=null && response.getContentType().contains("text/event-stream")) {
return null;
}
String requestURI = request.getRequestURI();
@ -125,7 +125,7 @@ public class GlobalExceptionHandler {
@ExceptionHandler(AsyncRequestTimeoutException.class)
public R<Void> handleAsyncRequestTimeoutException(AsyncRequestTimeoutException e, HttpServletResponse response) {
if (response.getContentType().contains("text/event-stream")) {
if (response.getContentType()!=null && response.getContentType().contains("text/event-stream")) {
return null;
}
return R.fail(e.getMessage());
@ -136,7 +136,7 @@ public class GlobalExceptionHandler {
*/
@ExceptionHandler(Exception.class)
public R<Void> handleException(Exception e, HttpServletRequest request,HttpServletResponse response) {
if (response.getContentType().contains("text/event-stream")) {
if (response.getContentType()!=null && response.getContentType().contains("text/event-stream")) {
return null;
}
String requestURI = request.getRequestURI();

Loading…
Cancel
Save