Search in sources :

Example 41 with Before

use of com.jfinal.aop.Before in project my_curd by qinyou.

the class ProcessDefineController method activateProcessDefine.

// 激活操作
@Before({ IdsRequired.class, Tx.class })
public void activateProcessDefine() {
    String ids = getPara("ids");
    RepositoryService service = ActivitiUtils.getRepositoryService();
    for (String id : ids.split(",")) {
        if (service.isProcessDefinitionSuspended(id)) {
            // 激活定义的同时激活流程实例
            service.activateProcessDefinitionById(id, true, null);
        }
    }
    renderSuccess("激活成功");
}
Also used : RepositoryService(org.activiti.engine.RepositoryService) Before(com.jfinal.aop.Before)

Example 42 with Before

use of com.jfinal.aop.Before in project my_curd by qinyou.

the class ProcessDefineController method suspendProcessDefine.

// 挂起操作
@Before({ IdsRequired.class, Tx.class })
public void suspendProcessDefine() {
    String ids = getPara("ids");
    RepositoryService service = ActivitiUtils.getRepositoryService();
    for (String id : ids.split(",")) {
        if (!service.isProcessDefinitionSuspended(id)) {
            // 挂起定义的同时 挂起流程实例
            service.suspendProcessDefinitionById(id, true, null);
        }
    }
    renderSuccess("挂起成功");
}
Also used : RepositoryService(org.activiti.engine.RepositoryService) Before(com.jfinal.aop.Before)

Example 43 with Before

use of com.jfinal.aop.Before in project my_curd by qinyou.

the class FormBaseController method createProcess.

/**
 * 发起流程
 *
 * @param processKey 流程 key
 * @param formId     业务表数据主键
 * @param formName   业务表名
 */
@NotAction
@Before(Tx.class)
protected void createProcess(String processKey, String formId, String formName, Date createTime) {
    ProcessDefinition definition = ActivitiUtils.getRepositoryService().createProcessDefinitionQuery().processDefinitionKey(processKey).latestVersion().singleResult();
    Optional.of(definition);
    String processInstanceName = definition.getName() + "(" + WebUtils.getSysUser(this).getRealName() + " - " + new DateTime(createTime).toString("yyyy/MM/dd HH:mm:ss") + ")";
    // 填充流程发起人参数
    Authentication.setAuthenticatedUserId(WebUtils.getSessionUsername(this));
    ProcessInstanceBuilder builder = ActivitiUtils.getRuntimeService().createProcessInstanceBuilder().processDefinitionKey(processKey).businessKey(formId).processInstanceName(processInstanceName).addVariable("businessForm", formName);
    // 此处如果抛出异常,代表 processKey 流程不存在
    builder.start();
}
Also used : ProcessInstanceBuilder(org.activiti.engine.runtime.ProcessInstanceBuilder) ProcessDefinition(org.activiti.engine.repository.ProcessDefinition) DateTime(org.joda.time.DateTime) Before(com.jfinal.aop.Before) NotAction(com.jfinal.core.NotAction)

Example 44 with Before

use of com.jfinal.aop.Before in project my_curd by qinyou.

the class SysMenuController method addButtonAction.

// 新增按钮 action
@Before(Tx.class)
public void addButtonAction() {
    SysButton sysButton = getBean(SysButton.class, "").setId(IdUtils.id()).setCreater(WebUtils.getSessionUsername(this)).setCreateTime(new Date());
    if (SysButton.dao.findUniqueByProperty("buttonCode", sysButton.getButtonCode()) != null) {
        renderFail(ADD_FAIL + " 编码已经存在");
        return;
    }
    SysMenu sysMenu = SysMenu.dao.findById(sysButton.getSysMenuId());
    if (sysMenu == null) {
        renderFail(ADD_FAIL);
        return;
    }
    sysButton.save();
    renderSuccess(ADD_SUCCESS);
}
Also used : SysMenu(com.github.qinyou.system.model.SysMenu) SysButton(com.github.qinyou.system.model.SysButton) Before(com.jfinal.aop.Before)

Example 45 with Before

use of com.jfinal.aop.Before in project my_curd by qinyou.

the class SysSettingController method exportExcel.

/**
 * 导出excel
 */
@Before(SearchSql.class)
public void exportExcel() {
    String where = getAttr(Constant.SEARCH_SQL);
    if (SysSetting.dao.findCountByWhere(where) > 50000) {
        setAttr("msg", "一次导出数据不可大于 5W 条,请修改查询条件。");
        render("common/card.ftl");
        return;
    }
    List<SysSetting> list = SysSetting.dao.findByWhere(where);
    Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams("系统设置项", "系统设置项"), SysSetting.class, list);
    render(ExcelRender.me(workbook).fileName("系统设置项.xls"));
}
Also used : ExportParams(cn.afterturn.easypoi.excel.entity.ExportParams) SysSetting(com.github.qinyou.system.model.SysSetting) Workbook(org.apache.poi.ss.usermodel.Workbook) Before(com.jfinal.aop.Before)

Aggregations

Before (com.jfinal.aop.Before)53 Date (java.util.Date)11 ActiveRecordException (com.jfinal.plugin.activerecord.ActiveRecordException)5 Record (com.jfinal.plugin.activerecord.Record)5 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)4 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)4 ToolString (com.hxkj.common.util.ToolString)4 ExportParams (cn.afterturn.easypoi.excel.entity.ExportParams)3 ExcelRdException (com.fruit.manage.util.excelRd.ExcelRdException)3 ActFormTpl (com.github.qinyou.process.model.ActFormTpl)3 SysOplog (com.hxkj.system.model.SysOplog)3 SysUser (com.hxkj.system.model.SysUser)3 IOException (java.io.IOException)3 InputStream (java.io.InputStream)3 HashMap (java.util.HashMap)3 BpmnModel (org.activiti.bpmn.model.BpmnModel)3 RepositoryService (org.activiti.engine.RepositoryService)3 HistoricProcessInstance (org.activiti.engine.history.HistoricProcessInstance)3 Model (org.activiti.engine.repository.Model)3 DateTime (org.joda.time.DateTime)3