xautlx / s2jh

A Java/J2EE development framework for enterprise system based on Struts/Spring/JPA/Hibernate and jquery/bootstrap
GNU Lesser General Public License v3.0
321 stars 242 forks source link

BUG报告 采购订单到了【订单编辑】提交时到不了采购订单环节的的问题 #90

Closed xiaolongyuan closed 10 years ago

xiaolongyuan commented 10 years ago

原因:流程里保存的entity【订单对象】 比库里面的要老,因此 每次取 【("提交时间") private Date submitDate;】都为空 所以,一直停在【订单编辑】任务 解决:

public void bpmUpdate(PurchaseOrder entity, String taskId, Map variables) { this.save(entity); variables.put("entity", entity); activitiService.completeTask(taskId, variables); }

/**
 * 完成任务
 * @param taskId
 * @param variables
 * @return
 */
public void completeTask(String taskId, Map<String, Object> variables) {
    identityService.setAuthenticatedUserId(AuthContextHolder.getAuthUserPin());
    if (variables != null && variables.size() > 0) {
        taskService.setVariablesLocal(taskId, variables);
    }

    BpmTrackable entity =(BpmTrackable) variables.get(BPM_ENTITY_VAR_NAME);
    if(entity==null){
         entity = (BpmTrackable) taskService.getVariable(taskId, BPM_ENTITY_VAR_NAME);
    }
    taskService.complete(taskId, variables);

    if (entity != null) {
        entity = entityManager.find(entity.getClass(), entity.getId());
        String activeTaskNames = findActiveTaskNames(entity.getBpmBusinessKey());
        entity.setActiveTaskName(activeTaskNames);
        entityManager.persist(entity);
    }
}