Commit 87482ed6 authored by chenhao's avatar chenhao

添加busenesskey 的方法

parent 1143bb28
package com.yeejoin.amos.boot.biz.common.service.impl;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.Random;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.service.IWorkflowExcuteService;
import com.yeejoin.amos.boot.biz.common.workflow.feign.WorkflowFeignService;
......@@ -25,6 +26,8 @@ public class WorkflowExcuteServiceImpl implements IWorkflowExcuteService {
@Override
public void startAndComplete(String key, String condition) throws Exception {
JSONObject body = new JSONObject();
String businessKey = buildOrderNo();
body.put("businessKey", businessKey);
body.put("processDefinitionKey", key);
JSONObject jsonObject = workflowFeignService.startByVariable(body);
if (jsonObject == null || jsonObject.getJSONObject("data") == null) {
......@@ -132,4 +135,14 @@ public class WorkflowExcuteServiceImpl implements IWorkflowExcuteService {
}
return true;
}
public static String buildOrderNo() {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String newDate = sdf.format(new Date());
String result = "";
Random random = new Random();
for (int i = 0; i < 3; i++) {
result += random.nextInt(10);
}
return newDate + result;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment