use of com.jeeagile.core.exception.AgileValidateException in project jeeagile by jeeagile.
the class AgileGeneratorTableServiceImpl method importTable.
@Override
public boolean importTable(List<String> tableNameList) {
for (String tableName : tableNameList) {
AgileGeneratorTable agileGeneratorTable = this.getBaseMapper().selectDbTableByTableName(tableName);
if (agileGeneratorTable == null || AgileStringUtil.isEmpty(agileGeneratorTable.getTableName())) {
throw new AgileValidateException("表(" + tableName + ")不存在!");
}
AgileGeneratorUtil.initGeneratorTable(agileGeneratorTable);
this.save(agileGeneratorTable);
List<AgileGeneratorTableColumn> agileGeneratorTableColumnList = this.getBaseMapper().selectDbTableColumnByTableName(tableName);
if (agileGeneratorTableColumnList != null && !agileGeneratorTableColumnList.isEmpty()) {
agileGeneratorTableColumnList.forEach(agileGeneratorTableColumn -> AgileGeneratorUtil.initColumnField(agileGeneratorTable, agileGeneratorTableColumn));
}
agileGeneratorTableColumnService.saveBatch(agileGeneratorTableColumnList);
}
return true;
}
use of com.jeeagile.core.exception.AgileValidateException in project jeeagile by jeeagile.
the class AgileGeneratorTableServiceImpl method syncTableById.
@Override
public boolean syncTableById(String agileGeneratorTableId) {
AgileGeneratorTableInfo tableInfo = this.selectTableInfoById(agileGeneratorTableId);
if (tableInfo != null) {
List<AgileGeneratorTableColumn> tableColumnList = tableInfo.getAgileGeneratorTableColumnList();
List<String> tableColumnNameList = tableColumnList.stream().map(AgileGeneratorTableColumn::getColumnName).collect(Collectors.toList());
List<AgileGeneratorTableColumn> dbTableColumnList = this.getBaseMapper().selectDbTableColumnByTableName(tableInfo.getTableName());
List<String> dbTableColumnNameList = dbTableColumnList.stream().map(AgileGeneratorTableColumn::getColumnName).collect(Collectors.toList());
for (AgileGeneratorTableColumn agileGeneratorTableColumn : dbTableColumnList) {
if (!tableColumnNameList.contains(agileGeneratorTableColumn.getColumnName())) {
AgileGeneratorUtil.initColumnField(tableInfo, agileGeneratorTableColumn);
agileGeneratorTableColumnService.save(agileGeneratorTableColumn);
}
}
List<String> deleteColumnIdList = tableColumnList.stream().filter(genTableColumn -> !dbTableColumnNameList.contains(genTableColumn.getColumnName())).map(AgileGeneratorTableColumn::getId).collect(Collectors.toList());
if (!CollectionUtils.isEmpty(deleteColumnIdList)) {
agileGeneratorTableColumnService.removeByIds(deleteColumnIdList);
}
} else {
throw new AgileValidateException("表生成信息已不存在无法同步!");
}
return true;
}
use of com.jeeagile.core.exception.AgileValidateException in project jeeagile by jeeagile.
the class AgileSysPersonServiceImpl method updatePersonPwd.
@Override
public boolean updatePersonPwd(AgileUpdatePwd agileUpdatePwd) {
AgileBaseUser userData = getCurrentUserData();
AgileSysUser oldSysUser = agileSysUserService.getById(userData.getUserId());
String oldUserPwd = AgileSecurityUtil.encryptPassword(agileUpdatePwd.getOldPwd());
String newUserPwd = AgileSecurityUtil.encryptPassword(agileUpdatePwd.getNewPwd());
if (oldSysUser.getUserPwd().equals(oldUserPwd)) {
AgileSysUser newSysUser = new AgileSysUser();
newSysUser.setId(oldSysUser.getId());
newSysUser.setUserPwd(newUserPwd);
return agileSysUserService.updateById(newSysUser);
} else {
throw new AgileValidateException("输入的老密码有误,请确认!");
}
}
use of com.jeeagile.core.exception.AgileValidateException in project jeeagile by jeeagile.
the class AgileSysDictTypeServiceImpl method deleteModel.
@Override
public boolean deleteModel(Serializable id) {
AgileSysDictType agileSysDictType = this.getById(id);
if (agileSysDictType.getSystemFlag().equals(AgileFlagEnum.YES.getCode())) {
throw new AgileValidateException("系统内置,不能删除!");
}
this.deleteDictData(agileSysDictType);
return this.removeById(id);
}
Aggregations