Search in sources :

Example 1 with AgileValidateException

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;
}
Also used : AgileGeneratorTable(com.jeeagile.generator.entity.AgileGeneratorTable) AgileValidateException(com.jeeagile.core.exception.AgileValidateException) AgileGeneratorTableColumn(com.jeeagile.generator.entity.AgileGeneratorTableColumn)

Example 2 with AgileValidateException

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;
}
Also used : AgileGeneratorTableInfo(com.jeeagile.generator.vo.AgileGeneratorTableInfo) AgileValidateException(com.jeeagile.core.exception.AgileValidateException) AgileGeneratorTableColumn(com.jeeagile.generator.entity.AgileGeneratorTableColumn)

Example 3 with AgileValidateException

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("输入的老密码有误,请确认!");
    }
}
Also used : AgileValidateException(com.jeeagile.core.exception.AgileValidateException) AgileSysUser(com.jeeagile.system.entity.AgileSysUser) AgileBaseUser(com.jeeagile.core.security.user.AgileBaseUser)

Example 4 with 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);
}
Also used : AgileValidateException(com.jeeagile.core.exception.AgileValidateException) AgileSysDictType(com.jeeagile.system.entity.AgileSysDictType)

Aggregations

AgileValidateException (com.jeeagile.core.exception.AgileValidateException)4 AgileGeneratorTableColumn (com.jeeagile.generator.entity.AgileGeneratorTableColumn)2 AgileBaseUser (com.jeeagile.core.security.user.AgileBaseUser)1 AgileGeneratorTable (com.jeeagile.generator.entity.AgileGeneratorTable)1 AgileGeneratorTableInfo (com.jeeagile.generator.vo.AgileGeneratorTableInfo)1 AgileSysDictType (com.jeeagile.system.entity.AgileSysDictType)1 AgileSysUser (com.jeeagile.system.entity.AgileSysUser)1