Search in sources :

Example 11 with Before

use of com.jfinal.aop.Before in project fruit-manage by liuzhaozhao.

the class OrderDetail method update.

/**
 * 推荐
 */
@Before(Tx.class)
public boolean update(UserTypeConstant type, Integer uid, String orderId, Integer productId, Integer productStandardId, Integer beforeNum, Integer afterNum) {
    super.setUpdateTime(new Date());
    super.update();
    return getOrderLog(type, uid, orderId, productId, productStandardId, afterNum - beforeNum).save();
}
Also used : Date(java.util.Date) Before(com.jfinal.aop.Before)

Example 12 with Before

use of com.jfinal.aop.Before in project fruit-manage by liuzhaozhao.

the class OrderDetail method update.

@Deprecated
@Override
@Before(Tx.class)
public boolean update() {
    OrderDetail orderDetail = OrderDetail.dao.findById(super.getId());
    super.update();
    return getOrderLog(orderDetail.getOrderId(), orderDetail.getProductId(), orderDetail.getProductStandardId(), super.getNum() - orderDetail.getNum()).save();
}
Also used : BaseOrderDetail(com.fruit.manage.model.base.BaseOrderDetail) Before(com.jfinal.aop.Before)

Example 13 with Before

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

the class ProxyGenerator method hasInterceptor.

/**
 * 当前 method 是否存在有效拦截器
 * 1:如果存在 method 级拦截器,则 return true
 * 2:否则结合 method 级的 @Clear 考察 global、class 两层拦截器的留存
 *    global、class 两层拦截器已作为参数 methodUpperInters 被传入
 *    methodUpperInters 中的拦截器已结合 class 级 @Clear 处理过
 */
protected boolean hasInterceptor(List<Class<?>> methodUpperInters, ProxyClass proxyClass, Method method) {
    // 如果 method 存在拦截器,可断定 hasInterceptor 为真,因为 @Clear 不能清除 method 级拦截器
    Before beforeOnMethod = method.getAnnotation(Before.class);
    if (beforeOnMethod != null && beforeOnMethod.value().length != 0) {
        return true;
    }
    // method 级拦截器不存在的情况,只需考虑察 global、class 级拦截器结合 method 级 @Clear 的留存情况
    List<Class<?>> ret;
    Clear clearOnMethod = method.getAnnotation(Clear.class);
    if (clearOnMethod != null) {
        Class<?>[] clearIntersOnMethod = clearOnMethod.value();
        if (clearIntersOnMethod.length != 0) {
            // 复制一份 methodUpperInters,以免 removeInterceptorClass 操作影响下次迭代
            ret = copyInterceptors(methodUpperInters);
            removeInterceptor(ret, clearIntersOnMethod);
        } else {
            ret = null;
        }
    } else {
        ret = methodUpperInters;
    }
    return ret != null && ret.size() > 0;
}
Also used : Before(com.jfinal.aop.Before) Clear(com.jfinal.aop.Clear)

Example 14 with Before

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

the class ActFormTplController method viewModel.

/**
 * 预览
 */
@Before(IdRequired.class)
public void viewModel() {
    String id = get("id");
    ActFormTpl formTpl = ActFormTpl.dao.findById(id);
    setAttr("tplRemark", formTpl.getRemark());
    setAttr("plugins", formTpl.getPlugins());
    setAttr("template", formTpl.getTemplate());
    render("process/actFormTpl_preview.ftl");
}
Also used : ActFormTpl(com.github.qinyou.process.model.ActFormTpl) Before(com.jfinal.aop.Before)

Example 15 with Before

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

the class ActFormTplController method downloadHtml.

// 模板文件下载
@Before(IdRequired.class)
public void downloadHtml() {
    String id = get("id");
    ActFormTpl formTpl = ActFormTpl.dao.findById(id);
    if (formTpl == null) {
        renderFail("id 参数错误");
        return;
    }
    render(StringAsFileRender.me(formTpl.getTemplate()).fileName(formTpl.getFormKey() + "-v" + formTpl.getFormVersion() + ".html"));
}
Also used : ActFormTpl(com.github.qinyou.process.model.ActFormTpl) 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