snaker-core/src/main/java/org/snaker/engine/core/OrderService.java
public Order createOrder(Process process, String operator, Map<String, Object> args, 
			String parentId, String parentNodeName) {
		Order order = new Order();
		order.setId(StringHelper.getPrimaryKey());
		order.setParentId(parentId);
		order.setParentNodeName(parentNodeName);
		order.setCreateTime(DateHelper.getTime());
		order.setLastUpdateTime(order.getCreateTime());
		order.setCreator(operator);
		order.setLastUpdator(order.getCreator());
		order.setProcessId(process.getId());
		ProcessModel model = process.getModel();
		if(model != null && args != null) {
			if(StringHelper.isNotEmpty(model.getExpireTime())) {
				String expireTime = DateHelper.parseTime(args.get(model.getExpireTime()));
				order.setExpireTime(expireTime);
			}
            String orderNo = (String)args.get(SnakerEngine.ID);
            if(StringHelper.isNotEmpty(orderNo)) {
                order.setOrderNo(orderNo);
            } else {
                order.setOrderNo(model.getGenerator().generate(model));
            }
		}

		order.setVariable(JsonHelper.toJson(args));
		saveOrder(order);
		return order;
	}
public Order createOrder(Process process, String operator, Map<String, Object> args, 
			String parentId, String parentNodeName) {
		Order order = new Order();
		order.setId(StringHelper.getPrimaryKey());
		order.setParentId(parentId);
		order.setParentNodeName(parentNodeName);
		order.setCreateTime(DateHelper.getTime());
		order.setLastUpdateTime(order.getCreateTime());
		order.setCreator(operator);
		order.setLastUpdator(order.getCreator());
		order.setProcessId(process.getId());
		ProcessModel model = process.getModel();
		if(model != null && args != null) {
			if(StringHelper.isNotEmpty(model.getExpireTime())) {
				String expireTime = DateHelper.parseTime(args.get(model.getExpireTime()));
				order.setExpireTime(expireTime);
			}
            String orderNo = (String)args.get(SnakerEngine.ID);
            if(StringHelper.isNotEmpty(orderNo)) {
                order.setOrderNo(orderNo);
            } else {
                order.setOrderNo(model.getGenerator().generate(model));
            }
		}

		order.setVariable(JsonHelper.toJson(args));
		saveOrder(order);
		return order;
	}
public Order createOrder ( Process process , String operator , Map < String , Object > args , String parentId , String parentNodeName ) { Order order = new Order ( ) ; order . setId ( StringHelper . getPrimaryKey ( ) ) ; order . setParentId ( parentId ) ; order . setParentNodeName ( parentNodeName ) ; order . setCreateTime ( DateHelper . getTime ( ) ) ; order . setLastUpdateTime ( order . getCreateTime ( ) ) ; order . setCreator ( operator ) ; order . setLastUpdator ( order . getCreator ( ) ) ; order . setProcessId ( process . getId ( ) ) ; ProcessModel model = process . getModel ( ) ; if ( model != null && args != null ) { if ( StringHelper . isNotEmpty ( model . getExpireTime ( ) ) ) { String expireTime = DateHelper . parseTime ( args . get ( model . getExpireTime ( ) ) ) ; order . setExpireTime ( expireTime ) ; } String orderNo = ( String ) args . get ( SnakerEngine . ID ) ; if ( StringHelper . isNotEmpty ( orderNo ) ) { order . setOrderNo ( orderNo ) ; } else { order . setOrderNo ( model . getGenerator ( ) . generate ( model ) ) ; } } order . setVariable ( JsonHelper . toJson ( args ) ) ; saveOrder ( order ) ; return order ; }
创建活动实例
创建活动实例