use of com.qlangtech.tis.manage.spring.aop.Func in project tis by qlangtech.
the class AppViewAction method doQueryApp.
@Func(value = PermissionConstant.PERMISSION_INDEX_QUERY, sideEffect = false)
public void doQueryApp(Context context) throws Exception {
final String appNameFuzzy = StringUtils.trimToEmpty(this.getString("query"));
final IAppsFetcher fetcher = UserUtils.getAppsFetcher(this.getRequest(), this);
final List<Application> appresult = fetcher.getApps((criteria) -> {
criteria.andProjectNameLike(StringUtils.startsWith(appNameFuzzy, "search4") ? (appNameFuzzy + "%") : ("%" + appNameFuzzy + "%"));
});
this.setBizResult(context, appresult);
}
use of com.qlangtech.tis.manage.spring.aop.Func in project tis by qlangtech.
the class GroupAction method doAddGroup.
/**
* 添加一个组
*
* @param context
* @throws Exception
*/
@Func(PermissionConstant.APP_SERVER_GROUP_SET)
public void doAddGroup(Context context) throws Exception {
RunEnvironment runtime = RunEnvironment.getEnum(this.getShort("runtime"));
Integer groupIndex = this.getInt("groupIndex");
Integer appid = this.getInt("appid");
if (groupIndex == null) {
this.addErrorMessage(context, "请填写组编号");
return;
}
if (runtime == null) {
this.addErrorMessage(context, "请选择运行环境");
return;
}
Integer publishSnapshotId = -1;
createGroup(runtime, groupIndex, appid, publishSnapshotId, this.getServerGroupDAO());
this.addActionMessage(context, "【" + runtime.getDescribe() + "】中新创建一条服务器组成功");
}
use of com.qlangtech.tis.manage.spring.aop.Func in project tis by qlangtech.
the class RoleAction method doUpdateRole.
/**
* 更新角色
*
* @param context
*/
@Func(PermissionConstant.AUTHORITY_ROLE_UPDATE)
public void doUpdateRole(Context context) {
// 用户选中的func功能集合
final List<Integer> funcids = Arrays.asList(this.getIntAry("funcid"));
final Role role = this.getRoleDAO().loadFromWriteDB(this.getInt("roleid"));
String roleName = this.getString("rolename");
role.setRoleName(roleName);
context.put("role", role);
context.put(selfuncidKEY, Collections.unmodifiableCollection(funcids));
if (StringUtils.isBlank(roleName)) {
this.addErrorMessage(context, "请添写角色名称");
return;
}
RoleCriteria criteria = new RoleCriteria();
criteria.createCriteria().andRoleNameEqualTo(roleName).andRIdNotEqualTo(role.getrId());
if (this.getRoleDAO().countByExample(criteria) > 0) {
this.addErrorMessage(context, "角色名称:“" + roleName + "”已经创建");
return;
}
if (funcids.size() < 1) {
this.addErrorMessage(context, "请为新添加的角色设置相应的功能");
return;
}
FuncRoleRelationCriteria fcriteria = new FuncRoleRelationCriteria();
fcriteria.createCriteria().andRIdEqualTo(role.getrId());
List<FuncRoleRelation> rellist = this.getFuncRoleRelationDAO().selectByExample(fcriteria);
List<Integer> orignfunclist = new ArrayList<Integer>();
for (FuncRoleRelation rel : rellist) {
orignfunclist.add(rel.getFuncId());
}
List<Integer> addfuncs = new ArrayList<Integer>();
// 需要删除的
for (Integer funcid : funcids) {
if (orignfunclist.contains(funcid)) {
orignfunclist.remove(funcid);
} else {
addfuncs.add(funcid);
}
}
for (Integer funcid : orignfunclist) {
fcriteria = new FuncRoleRelationCriteria();
fcriteria.createCriteria().andRIdEqualTo(role.getrId()).andFuncIdEqualTo(funcid);
this.getFuncRoleRelationDAO().deleteByExample(fcriteria);
}
Role update = new Role();
update.setRoleName(roleName);
RoleCriteria rcriteria = new RoleCriteria();
rcriteria.createCriteria().andRIdEqualTo(role.getrId());
this.getRoleDAO().updateByExampleSelective(update, rcriteria);
// 需要添加的
createRelation(addfuncs, role);
this.addActionMessage(context, "成功更新角色:“" + role.getRoleName() + "”");
}
use of com.qlangtech.tis.manage.spring.aop.Func in project tis by qlangtech.
the class RoleAction method doAddRole.
@Func(PermissionConstant.AUTHORITY_ROLE_ADD)
public void doAddRole(Context context) {
String roleName = this.getString("rolename");
final Integer[] funcids = (Integer[]) getSelfuncid().toArray();
if (StringUtils.isBlank(roleName)) {
this.addErrorMessage(context, "请添写角色名称");
return;
}
RoleCriteria criteria = new RoleCriteria();
criteria.createCriteria().andRoleNameEqualTo(roleName);
if (this.getRoleDAO().countByExample(criteria) > 0) {
this.addErrorMessage(context, "角色名称:“" + roleName + "”已经创建");
return;
}
if (funcids.length < 1) {
this.addErrorMessage(context, "请为新添加的角色设置相应的功能");
return;
}
Role role = new Role();
role.setGmtCreate(new Date());
role.setGmtModified(new Date());
role.setRoleName(roleName);
Integer newRoleId = this.getRoleDAO().insertSelective(role);
role.setrId(newRoleId);
createRelation(Arrays.asList(funcids), role);
this.addActionMessage(context, "成功添加角色:“" + roleName + "”");
}
use of com.qlangtech.tis.manage.spring.aop.Func in project tis by qlangtech.
the class UploadJarAction method doUploadJar.
/**
* 处理上传文件的请求
*/
@Func(PermissionConstant.CONFIG_UPLOAD)
public // @FormGroup(GROUP_NAME) UploadJarForm form,
void doUploadJar(Context context) throws Exception {
if (form.getSchema() == null || form.getConfig() == null) {
this.addErrorMessage(context, "您需要上传schema和solrconfig文件");
return;
}
Snapshot snapshot = parseSnapshot(context, this.form);
// 最后 创建snapshot对象
this.addActionMessage(context, "成功添加snapshotID:" + this.getSnapshotDAO().insertSelective(snapshot) + "的快照记录");
}
Aggregations