use of com.jfinal.aop.Before in project my_curd by qinyou.
the class SysSettingController method importExcel.
/**
* 导入excel
*/
@Before(Tx.class)
public void importExcel() {
UploadFile uploadFile = getFile();
if (uploadFile == null) {
renderFail("上传文件不可为空");
return;
}
if (!FilenameUtils.getExtension(uploadFile.getFileName()).equals("xls")) {
FileUtils.deleteFile(uploadFile.getFile());
renderFail("上传文件后缀必须是xls");
return;
}
List<SysSetting> list;
try {
ImportParams params = new ImportParams();
params.setTitleRows(1);
params.setHeadRows(1);
list = ExcelImportUtil.importExcel(uploadFile.getFile(), SysSetting.class, params);
} catch (Exception e) {
log.error(e.getMessage(), e);
FileUtils.deleteFile(uploadFile.getFile());
renderFail("模板文件格式错误");
return;
}
for (SysSetting sysSetting : list) {
sysSetting.setId(IdUtils.id()).setUpdater(WebUtils.getSessionUsername(this)).setUpdateTime(new Date()).save();
}
FileUtils.deleteFile(uploadFile.getFile());
refreshSetting();
renderSuccess(IMPORT_SUCCESS);
}
use of com.jfinal.aop.Before in project my_curd by qinyou.
the class MyApplyController method deleteApply.
// 流程实例删除(仅运行结束实例、物理删除)
@Before(IdRequired.class)
public void deleteApply() {
HistoricProcessInstance instance = ActivitiUtils.getHistoryService().createHistoricProcessInstanceQuery().processInstanceId(// 流程实例id
get("id")).finished().singleResult();
if (instance == null) {
renderFail("已结束流程实例 不存在");
return;
}
ActivitiUtils.getHistoryService().deleteHistoricProcessInstance(instance.getId());
renderSuccess("删除流程 成功");
}
use of com.jfinal.aop.Before in project my_curd by qinyou.
the class MyApplyController method cancelApply.
// 流程实例取消 (仅未结束的流程、填充的作废原因)
@Before(IdRequired.class)
public void cancelApply() {
HistoricProcessInstance instance = ActivitiUtils.getHistoryService().createHistoricProcessInstanceQuery().processInstanceId(// 流程实例id
get("id")).unfinished().singleResult();
if (instance == null) {
renderFail("进行中流程实例 不存在");
return;
}
ActivitiUtils.getRuntimeService().deleteProcessInstance(instance.getId(), ActConst.DEL_USER_CANCEL);
renderSuccess("取消流程 成功");
}
use of com.jfinal.aop.Before in project my_curd by qinyou.
the class SysNoticeTypeController method addTypeRoleAction.
/**
* 增加 关联关系
*/
@Before(Tx.class)
public void addTypeRoleAction() {
String roleIds = getPara("roleIds");
String sysNoticeTypeId = getPara("sysNoticeTypeId");
SysNoticeTypeSysRole sysNTRoleOld;
for (String roleId : roleIds.split(",")) {
sysNTRoleOld = SysNoticeTypeSysRole.dao.findByIds(sysNoticeTypeId, roleId);
if (sysNTRoleOld != null) {
continue;
}
SysNoticeTypeSysRole sysNTRole = new SysNoticeTypeSysRole();
sysNTRole.setSysNoticeTypeId(sysNoticeTypeId).setSysRoleId(roleId).setCreater(WebUtils.getSessionUsername(this)).setCreateTime(new Date()).save();
}
renderSuccess("关联角色成功");
}
use of com.jfinal.aop.Before in project my_curd by qinyou.
the class MyTaskController method adjustApply.
// 调整申请表单
@Before(Tx.class)
public void adjustApply() {
String taskId = get("taskId");
if (StringUtils.isEmpty(taskId)) {
renderFail("参数缺失");
return;
}
TaskService service = ActivitiUtils.getTaskService();
Task task = service.createTaskQuery().taskId(taskId).singleResult();
if (task == null) {
renderFail("参数错误");
return;
}
String taskDefinitionKey = task.getTaskDefinitionKey();
if (!ActConst.ADJUST_APPLY_TASK_KEY.equals(taskDefinitionKey)) {
renderFail("当前节点禁止调整申请");
return;
}
String applyFormData = get("applyFormData");
// 设置流程实例 变量值
service.setVariable(taskId, ActConst.APPLY_FORM_DATA, applyFormData);
renderSuccess("调整申请成功");
}
Aggregations