mirror of
https://gitee.com/lab1024/smart-admin.git
synced 2025-10-17 17:43:42 +08:00
v1.0.9
This commit is contained in:
@@ -149,6 +149,10 @@ public class CodeGeneratorService {
|
||||
int targetIndex = StringUtils.indexOf(projectPath, targetDir);
|
||||
projectPath = projectPath.substring(0, targetIndex + targetDir.length() + 1);
|
||||
projectPath = projectPath.replace("target/", "").replaceFirst("/", "");
|
||||
|
||||
Velocity.setProperty("input.encoding", "UTF-8");
|
||||
Velocity.setProperty("output.encoding", "UTF-8");
|
||||
|
||||
for (Entry<String, String> entry : codeTemplates.entrySet()) {
|
||||
String template = entry.getKey();
|
||||
String filePath = projectPath + entry.getValue();
|
||||
|
@@ -21,7 +21,7 @@ public enum IdGeneratorEnum {
|
||||
|
||||
ORDER(1, "order");
|
||||
|
||||
private int id;
|
||||
private long id;
|
||||
private String keyName;
|
||||
|
||||
IdGeneratorEnum(int id, String keyName) {
|
||||
@@ -34,7 +34,7 @@ public enum IdGeneratorEnum {
|
||||
return "IdGeneratorEnum{" + "id=" + id + ", keyName='" + keyName + '\'' + '}';
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
|
@@ -115,16 +115,19 @@ public class PrivilegeEmployeeService {
|
||||
* @return
|
||||
*/
|
||||
public List<PrivilegeEntity> getPrivilegesByEmployeeId(Long employeeId) {
|
||||
List<PrivilegeEntity> privilegeEntities = null;
|
||||
// 如果是超管的话
|
||||
Boolean isSuperman = this.isSuperman(employeeId);
|
||||
if (isSuperman) {
|
||||
List<PrivilegeEntity> privilegeEntities = privilegeDao.selectAll();
|
||||
if (privilegeEntities == null) {
|
||||
return Lists.newArrayList();
|
||||
}
|
||||
return privilegeEntities;
|
||||
privilegeEntities = privilegeDao.selectAll();
|
||||
} else {
|
||||
privilegeEntities = loadPrivilegeFromDb(employeeId);
|
||||
}
|
||||
List<PrivilegeEntity> privilegeEntities = loadPrivilegeFromDb(employeeId);
|
||||
|
||||
if (privilegeEntities == null) {
|
||||
privilegeEntities = Lists.newArrayList();
|
||||
}
|
||||
|
||||
this.updateCachePrivilege(employeeId, privilegeEntities);
|
||||
return privilegeEntities;
|
||||
}
|
||||
|
@@ -8,6 +8,7 @@ import com.gangquan360.smartadmin.module.quartz.task.ITask;
|
||||
import com.gangquan360.smartadmin.third.SmartApplicationContext;
|
||||
import com.gangquan360.smartadmin.util.SmartIPUtil;
|
||||
import com.gangquan360.smartadmin.util.SmartQuartzUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.quartz.JobDetail;
|
||||
import org.quartz.JobExecutionContext;
|
||||
import org.quartz.JobExecutionException;
|
||||
@@ -28,6 +29,7 @@ import java.util.Date;
|
||||
* @date
|
||||
* @since JDK1.8
|
||||
*/
|
||||
@Slf4j
|
||||
public class QuartzTask extends QuartzJobBean {
|
||||
|
||||
@Override
|
||||
@@ -59,7 +61,7 @@ public class QuartzTask extends QuartzJobBean {
|
||||
ITask taskClass = (ITask) SmartApplicationContext.getBean(quartzTaskEntity.getTaskBean());
|
||||
taskClass.execute(paramsStr);
|
||||
taskLogEntity.setProcessStatus(TaskResultEnum.SUCCESS.getStatus());
|
||||
} catch (Exception e) {
|
||||
} catch (Throwable e) {
|
||||
StringWriter sw = new StringWriter();
|
||||
PrintWriter pw = new PrintWriter(sw, true);
|
||||
e.printStackTrace(pw);
|
||||
@@ -67,6 +69,7 @@ public class QuartzTask extends QuartzJobBean {
|
||||
sw.flush();
|
||||
taskLogEntity.setProcessStatus(TaskResultEnum.FAIL.getStatus());
|
||||
taskLogEntity.setProcessLog(sw.toString());
|
||||
log.error("",e);
|
||||
} finally {
|
||||
long times = System.currentTimeMillis() - startTime;
|
||||
taskLogEntity.setProcessDuration(times);
|
||||
|
@@ -82,6 +82,9 @@ public class SystemConfigService {
|
||||
* @return
|
||||
*/
|
||||
public ResponseDTO<PageResultDTO<SystemConfigVO>> getSystemConfigPage(SystemConfigQueryDTO queryDTO) {
|
||||
if(queryDTO.getKey() != null){
|
||||
queryDTO.setKey(queryDTO.getKey().toLowerCase());
|
||||
}
|
||||
Page page = SmartPaginationUtil.convert2PageQueryInfo(queryDTO);
|
||||
List<SystemConfigEntity> entityList = systemConfigDao.selectSystemSettingList(page, queryDTO);
|
||||
PageResultDTO<SystemConfigVO> pageResultDTO = SmartPaginationUtil.convert2PageResultDTO(page, entityList, SystemConfigVO.class);
|
||||
@@ -95,6 +98,9 @@ public class SystemConfigService {
|
||||
* @return
|
||||
*/
|
||||
public ResponseDTO<SystemConfigVO> selectByKey(String configKey) {
|
||||
if(configKey != null){
|
||||
configKey = configKey.toLowerCase();
|
||||
}
|
||||
SystemConfigEntity entity = systemConfigDao.getByKey(configKey);
|
||||
if (entity == null) {
|
||||
return ResponseDTO.wrap(SystemConfigResponseCodeConst.NOT_EXIST);
|
||||
@@ -112,6 +118,9 @@ public class SystemConfigService {
|
||||
* @return
|
||||
*/
|
||||
public <T> T selectByKey2Obj(String configKey, Class<T> clazz) {
|
||||
if(configKey != null){
|
||||
configKey = configKey.toLowerCase();
|
||||
}
|
||||
SystemConfigEntity entity = systemConfigDao.getByKey(configKey);
|
||||
if (entity == null) {
|
||||
return null;
|
||||
@@ -140,7 +149,7 @@ public class SystemConfigService {
|
||||
* @return
|
||||
*/
|
||||
public ResponseDTO<String> addSystemConfig(SystemConfigAddDTO configAddDTO) {
|
||||
SystemConfigEntity entity = systemConfigDao.getByKey(configAddDTO.getConfigKey());
|
||||
SystemConfigEntity entity = systemConfigDao.getByKey(configAddDTO.getConfigKey().toLowerCase());
|
||||
if (entity != null) {
|
||||
return ResponseDTO.wrap(SystemConfigResponseCodeConst.ALREADY_EXIST);
|
||||
}
|
||||
@@ -148,6 +157,7 @@ public class SystemConfigService {
|
||||
if(!valueValid.isSuccess()){
|
||||
return valueValid;
|
||||
}
|
||||
configAddDTO.setConfigKey(configAddDTO.getConfigKey().toLowerCase());
|
||||
SystemConfigEntity addEntity = SmartBeanUtil.copy(configAddDTO, SystemConfigEntity.class);
|
||||
addEntity.setIsUsing(JudgeEnum.YES.getValue());
|
||||
systemConfigDao.insert(addEntity);
|
||||
@@ -168,7 +178,7 @@ public class SystemConfigService {
|
||||
if (entity == null) {
|
||||
return ResponseDTO.wrap(SystemConfigResponseCodeConst.NOT_EXIST);
|
||||
}
|
||||
SystemConfigEntity alreadyEntity = systemConfigDao.getByKeyExcludeId(updateDTO.getConfigKey(), updateDTO.getId());
|
||||
SystemConfigEntity alreadyEntity = systemConfigDao.getByKeyExcludeId(updateDTO.getConfigKey().toLowerCase(), updateDTO.getId());
|
||||
if (alreadyEntity != null) {
|
||||
return ResponseDTO.wrap(SystemConfigResponseCodeConst.ALREADY_EXIST);
|
||||
}
|
||||
@@ -177,6 +187,7 @@ public class SystemConfigService {
|
||||
return valueValid;
|
||||
}
|
||||
entity = SmartBeanUtil.copy(updateDTO, SystemConfigEntity.class);
|
||||
updateDTO.setConfigKey(updateDTO.getConfigKey().toLowerCase());
|
||||
systemConfigDao.updateById(entity);
|
||||
|
||||
//刷新缓存
|
||||
|
Reference in New Issue
Block a user