Просмотр исходного кода

审批流修改生成流程图,优化短信模板逻辑

release_toaliyun_real
luozukai 7 лет назад
Родитель
Сommit
a4a4fcdb60
4 измененных файлов: 48 добавлений и 43 удалений
  1. +1
    -2
      mallinkAdmin/src/main/java/com/iformall/controller/WxFlowAbleController.java
  2. +1
    -1
      mallinkService/src/main/java/com/iformall/service/WxFlowService.java
  3. +45
    -39
      mallinkService/src/main/java/com/iformall/service/impl/WxFlowServiceImpl.java
  4. +1
    -1
      mallinkService/src/main/java/com/iformall/service/impl/WxMsgValidationcodeModelServiceImpl.java

+ 1
- 2
mallinkAdmin/src/main/java/com/iformall/controller/WxFlowAbleController.java Просмотреть файл

@@ -22,8 +22,7 @@ public class WxFlowAbleController extends BaseController {
@Autowired
private WxFlowService wxFlowService;


@ApiOperation(value = "启动流程",notes = "{\"businessId\":\"215315084967149568\",\"businessType\":1,\"remark\":\"意见意见。\",\"taskAssignee\":[{\"taskKey\":\"firstTaskUser\",\"assignee\":204398756307664896},{\"taskKey\":\"secondTaskUser\",\"assignee\":204398756307664896}]}")
@ApiOperation(value = "启动流程",notes = "{\"businessId\":\"215315084967149568\",\"businessType\":1,\"remark\":\"意见意见。\",\"taskAssignee\":[{\"taskKey\":\"firstTaskUser\",\"assignee\":\"204398756307664896\"},{\"taskKey\":\"secondTaskUser\",\"assignee\":\"204398756307664896\"}]}")
@PostMapping("/start")
public ResultData start(@RequestBody Map<String, Object> params) {
logger.debug("[" + getIpAddr() + "] FlowAbleController::start");


+ 1
- 1
mallinkService/src/main/java/com/iformall/service/WxFlowService.java Просмотреть файл

@@ -54,5 +54,5 @@ public interface WxFlowService {
* @param processInstanceId
* @throws Exception
*/
void genProcessDiagram(HttpServletResponse httpServletResponse, String processInstanceId) throws Exception;
void genProcessDiagram(HttpServletResponse httpServletResponse, String businessId) throws Exception;
}

+ 45
- 39
mallinkService/src/main/java/com/iformall/service/impl/WxFlowServiceImpl.java Просмотреть файл

@@ -355,49 +355,55 @@ public class WxFlowServiceImpl implements WxFlowService {


@Override
public void genProcessDiagram(HttpServletResponse httpServletResponse, String processInstanceId) throws Exception {
ProcessInstance pi = runtimeService.createProcessInstanceQuery().processInstanceId(processInstanceId).singleResult();

//流程走完的不显示图
if (pi == null) {
return;
}
Task task = taskService.createTaskQuery().processInstanceId(pi.getId()).singleResult();
//使用流程实例ID,查询正在执行的执行对象表,返回流程实例对象
String InstanceId = task.getProcessInstanceId();
List<Execution> executions = runtimeService
.createExecutionQuery()
.processInstanceId(InstanceId)
.list();

//得到正在执行的Activity的Id
List<String> activityIds = new ArrayList<>();
List<String> flows = new ArrayList<>();
for (Execution exe : executions) {
List<String> ids = runtimeService.getActiveActivityIds(exe.getId());
activityIds.addAll(ids);
}
public void genProcessDiagram(HttpServletResponse httpServletResponse,String businessId) throws Exception {
List<WxFlowRecord> result = wxFlowRecordService.findList(new WxFlowRecord(Long.parseLong(businessId)));
if(CollectionUtils.isNotEmpty(result)) {
String processInstanceId = result.get(0).getProcessInstanceId();
ProcessInstance pi = runtimeService.createProcessInstanceQuery().processInstanceId(processInstanceId).singleResult();

//获取流程图
BpmnModel bpmnModel = repositoryService.getBpmnModel(pi.getProcessDefinitionId());
ProcessEngineConfiguration engconf = processEngine.getProcessEngineConfiguration();
ProcessDiagramGenerator diagramGenerator = engconf.getProcessDiagramGenerator();
InputStream in = diagramGenerator.generateDiagram(bpmnModel, "png", activityIds, flows, engconf.getActivityFontName(), engconf.getLabelFontName(), engconf.getAnnotationFontName(), engconf.getClassLoader(), 1.0,true);
OutputStream out = null;
byte[] buf = new byte[1024];
int legth = 0;
try {
out = httpServletResponse.getOutputStream();
while ((legth = in.read(buf)) != -1) {
out.write(buf, 0, legth);
//流程走完的不显示图
if (pi == null) {
return;
}
} finally {
if (in != null) {
in.close();
Task task = taskService.createTaskQuery().processInstanceId(pi.getId()).singleResult();
//使用流程实例ID,查询正在执行的执行对象表,返回流程实例对象
String InstanceId = task.getProcessInstanceId();
List<Execution> executions = runtimeService
.createExecutionQuery()
.processInstanceId(InstanceId)
.list();

//得到正在执行的Activity的Id
List<String> activityIds = new ArrayList<>();
List<String> flows = new ArrayList<>();
for (Execution exe : executions) {
List<String> ids = runtimeService.getActiveActivityIds(exe.getId());
activityIds.addAll(ids);
}
if (out != null) {
out.close();

//获取流程图
BpmnModel bpmnModel = repositoryService.getBpmnModel(pi.getProcessDefinitionId());
ProcessEngineConfiguration engconf = processEngine.getProcessEngineConfiguration();
ProcessDiagramGenerator diagramGenerator = engconf.getProcessDiagramGenerator();
InputStream in = diagramGenerator.generateDiagram(bpmnModel, "png", activityIds, flows, engconf.getActivityFontName(), engconf.getLabelFontName(), engconf.getAnnotationFontName(), engconf.getClassLoader(), 1.0,true);
OutputStream out = null;
byte[] buf = new byte[1024];
int legth = 0;
try {
out = httpServletResponse.getOutputStream();
while ((legth = in.read(buf)) != -1) {
out.write(buf, 0, legth);
}
} finally {
if (in != null) {
in.close();
}
if (out != null) {
out.close();
}
}
}else{
throw new MallinkException(Result.ERROR, "找不到审批历史");
}
}



+ 1
- 1
mallinkService/src/main/java/com/iformall/service/impl/WxMsgValidationcodeModelServiceImpl.java Просмотреть файл

@@ -72,7 +72,7 @@ public class WxMsgValidationcodeModelServiceImpl implements WxMsgValidationcodeM
}

}
String result = WiwideUtil.addTemplate(secret, bid, wxMsgConfig.getPublickey(), signature, content, wxMsgConfig.getModelnotifyurl(),EnumVerifyCode.YES.getCode().toString());
String result = WiwideUtil.addTemplate(secret, bid, wxMsgConfig.getPublickey(), signature, content, wxMsgConfig.getVerifynotifyurl(),EnumVerifyCode.YES.getCode().toString());

JSONObject jsonObjectResult = JSONObject.parseObject(result);
String ret = jsonObjectResult.get("ret").toString();


Загрузка…
Отмена
Сохранить