Rule handler generating order numbers with optional prefix and timestamp, used in form filling.
// Source: https://github.com/jeecgboot/JeecgBoot | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
// Provided via justclaw.it.com; keep this notice with the code.
package org.jeecg.modules.system.rule;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.math.RandomUtils;
import org.jeecg.common.handler.IFillRuleHandler;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
* 填值规则Demo:生成订单号
* 【测试示例】
*/
public class OrderNumberRule implements IFillRuleHandler {
@Override
public Object execute(JSONObject params, JSONObject formData) {
String prefix = "CN";
//订单前缀默认为CN 如果规则参数不为空,则取自定义前缀
if (params != null) {
Object obj = params.
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key