BaseController 优化

v1.4.1
Parker 4 years ago
parent e6ad475ecf
commit a1d06f73f6

@ -16,6 +16,7 @@
package org.opsli.core.base.controller;
import cn.hutool.core.annotation.AnnotationUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.date.TimeInterval;
@ -197,7 +198,7 @@ public abstract class BaseRestController <T extends BaseEntity, E extends ApiWra
CoreMsg.EXCEL_FILE_NULL.getMessage());
}
ResultVo<?> resultVo;
String msgInfo = "";
String msgInfo;
try {
List<E> modelList = excelUtil.readExcel(files.get(0), modelClazz);
if(CollUtil.isNotEmpty(modelList)){
@ -263,7 +264,7 @@ public abstract class BaseRestController <T extends BaseEntity, E extends ApiWra
*
* @param fileName
* @param queryWrapper
* @param response
* @param response response
*/
protected void excelExport(String fileName, QueryWrapper<T> queryWrapper, HttpServletResponse response,
Method method){
@ -291,7 +292,7 @@ public abstract class BaseRestController <T extends BaseEntity, E extends ApiWra
// 计时器
TimeInterval timer = DateUtil.timer();
String msgInfo = "";
String msgInfo;
ResultVo<?> resultVo;
List<E> modelList = Lists.newArrayList();
try {
@ -359,15 +360,11 @@ public abstract class BaseRestController <T extends BaseEntity, E extends ApiWra
try {
this.modelClazz = IService.getModelClazz();
this.entityClazz = IService.getEntityClazz();
Class<?> serviceClazz = IService.getServiceClazz();
// 判断是否开启热点数据
if(serviceClazz != null){
EnableHotData annotation = serviceClazz.getAnnotation(EnableHotData.class);
if(annotation != null){
this.hotDataFlag = true;
}
if(IService != null){
// 判断Service 是否包含 热数据注解
this.hotDataFlag = AnnotationUtil.hasAnnotation(IService.getServiceClazz(),
EnableHotData.class);
}
}catch (Exception e){
log.error(e.getMessage(),e);
}

@ -207,7 +207,6 @@ public class #(data.model.tableName)RestController extends BaseRestController<#(
*
* @param request request
* @param response response
* @return ResultVo
*/
@ApiOperation(value = "导出Excel", notes = "导出Excel")
#if(data.subModuleName != null && data.subModuleName != "")
@ -246,7 +245,6 @@ public class #(data.model.tableName)RestController extends BaseRestController<#(
* #(data.codeTitleBrief) Excel
* RequiresPermissionsCus
* @param response response
* @return ResultVo
*/
@ApiOperation(value = "导出Excel模版", notes = "导出Excel模版")
#if(data.subModuleName != null && data.subModuleName != "")

@ -59,6 +59,7 @@ public enum SystemMsg implements BaseMsg {
EXCEPTION_ORG_NOT_NULL(20307,"组织不可为空"),
EXCEPTION_USER_ORG_ERROR(20308,"用户组织设置失败"),
EXCEPTION_USER_NULL(20309,"暂无该用户"),
EXCEPTION_USER_FILE_NULL(20310,"请选择文件"),
/**

@ -142,7 +142,7 @@ public class UserRestController extends BaseRestController<SysUser, UserModel, I
/**
*
* @param userId
* @param userId ID
* @return ResultVo
*/
@ApiOperation(value = "用户组织机构", notes = "用户组织机构")
@ -195,8 +195,8 @@ public class UserRestController extends BaseRestController<SysUser, UserModel, I
List<MultipartFile> files = request.getFiles(uploadedFile);
if (CollectionUtils.isEmpty(files)) {
// 请选择文件
return ResultVo.error(CoreMsg.EXCEL_FILE_NULL.getCode(),
CoreMsg.EXCEL_FILE_NULL.getMessage());
return ResultVo.error(SystemMsg.EXCEPTION_USER_FILE_NULL.getCode(),
SystemMsg.EXCEPTION_USER_FILE_NULL.getMessage());
}
try {
@ -411,7 +411,6 @@ public class UserRestController extends BaseRestController<SysUser, UserModel, I
* Excel
* @param request request
* @param response response
* @return ResultVo
*/
@ApiOperation(value = "导出Excel", notes = "导出Excel")
@RequiresPermissionsCus("system_user_export")
@ -440,7 +439,6 @@ public class UserRestController extends BaseRestController<SysUser, UserModel, I
/**
* Excel
* @param response response
* @return ResultVo
*/
@ApiOperation(value = "导出Excel模版", notes = "导出Excel模版")
@RequiresPermissionsCus("system_user_import")
@ -504,7 +502,7 @@ public class UserRestController extends BaseRestController<SysUser, UserModel, I
/**
*
* @param userId
* @param userId ID
* @return ResultVo
*/
@ApiOperation(value = "用户组织机构", notes = "用户组织机构")

@ -29,7 +29,6 @@ import java.util.Collection;
*
*/
@Service
// 开启热数据标示 不加不生效
@EnableHotData
public class TestServiceImpl extends CrudServiceImpl<TestMapper, TestEntity,TestModel > implements ITestService {

Loading…
Cancel
Save