Commit 2681c7c7 authored by yangyang's avatar yangyang

feat(jyjc):新增工作流启动流程

parent 16eecf69
......@@ -81,7 +81,7 @@ public class JyjcOpeningApplication extends BaseEntity {
/**
* 申请时间
*/
@TableField(value = "rec_date", fill = FieldFill.INSERT)
@TableField(value = "apply_time", fill = FieldFill.INSERT)
protected Date applyTime;
/**
* 工作流执行角色
......
......@@ -40,7 +40,7 @@ public class JyjcOpeningApplicationController extends BaseController {
@PostMapping(value = "/save")
@ApiOperation(httpMethod = "POST", value = "新增", notes = "新增")
public ResponseModel<JyjcOpeningApplicationDto> save(@RequestBody JyjcOpeningApplicationDto model) {
model = jyjcOpeningApplicationServiceImpl.createWithModel(model);
model = jyjcOpeningApplicationServiceImpl.saveModel(model);
return ResponseHelper.buildResponse(model);
}
......
package com.yeejoin.amos.boot.module.jyjc.biz.service.impl;
import cn.hutool.core.map.MapBuilder;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.biz.common.bo.CompanyBo;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcOpeningApplication;
......@@ -8,16 +10,21 @@ import com.yeejoin.amos.boot.module.jyjc.api.mapper.JyjcBaseMapper;
import com.yeejoin.amos.boot.module.jyjc.api.mapper.JyjcOpeningApplicationMapper;
import com.yeejoin.amos.boot.module.jyjc.api.service.IJyjcOpeningApplicationService;
import com.yeejoin.amos.boot.module.jyjc.api.dto.JyjcOpeningApplicationDto;
import com.yeejoin.amos.boot.module.jyjc.biz.config.BaseException;
import com.yeejoin.amos.boot.module.jyjc.biz.config.CommonException;
import com.yeejoin.amos.boot.module.tcm.api.dto.TzBaseEnterpriseInfoDto;
import com.yeejoin.amos.boot.module.tcm.api.dto.TzBaseUnitLicenceDto;
import com.yeejoin.amos.boot.module.tcm.api.dto.TzsUserInfoDto;
import com.yeejoin.amos.boot.module.tcm.api.enums.CommonErrorEnum;
import com.yeejoin.amos.boot.module.tcm.api.enums.LicenceTypeEnum;
import com.yeejoin.amos.feign.workflow.Workflow;
import com.yeejoin.amos.feign.workflow.model.ActWorkflowStartDTO;
import com.yeejoin.amos.feign.workflow.model.AjaxResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.transaction.annotation.Transactional;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.springframework.stereotype.Service;
......@@ -35,6 +42,7 @@ import java.util.Map;
* @date 2023-12-13
*/
@Service
@Slf4j
public class JyjcOpeningApplicationServiceImpl extends BaseService<JyjcOpeningApplicationDto,JyjcOpeningApplication,JyjcOpeningApplicationMapper> implements IJyjcOpeningApplicationService {
@Autowired
CommonserviceImpl commonserviceImpl;
......@@ -45,24 +53,30 @@ public class JyjcOpeningApplicationServiceImpl extends BaseService<JyjcOpeningAp
@Resource(type = JyjcBaseMapper.class)
private JyjcBaseMapper baseMapper;
@Value("${process-definition-key}")
@Value("${process-definition-key.jyjc.openapplication:}")
private String processDefinitionKey;
public JyjcOpeningApplicationDto save(JyjcOpeningApplicationDto model) {
@Transactional(rollbackFor = {Exception.class, CommonException.class})
public JyjcOpeningApplicationDto saveModel(JyjcOpeningApplicationDto model) {
// 开启工作流 startProcess
JyjcOpeningApplicationDto dto = this.createWithModel(model);
return dto;
}
private String startProcess(HashMap<String, Object> dtoMap) throws Exception {
ActWorkflowStartDTO dto = new ActWorkflowStartDTO();
dto.setProcessDefinitionKey(processDefinitionKey);
dto.setBusinessKey("1");
dto.setVariables(dtoMap);
AjaxResult ajaxResult = Workflow.taskClient.startByVariable(dto);
String instanceId = ((Map) ajaxResult.get("data")).get("id").toString();
return instanceId;
try {
ActWorkflowStartDTO dto = new ActWorkflowStartDTO();
dto.setProcessDefinitionKey(processDefinitionKey);
dto.setBusinessKey("1");
AjaxResult ajaxResult = Workflow.taskClient.startByVariable(dto);
if (log.isDebugEnabled()) {
log.debug("工作流开始结果:{}", ajaxResult);
}
String instanceId = ((Map)ajaxResult.get("data")).get("id").toString();
JSONObject dataObject = JSON.parseObject(JSON.toJSONString(ajaxResult.get("data")));
// model.setWorkflowRole();
model.setStatus(!ValidationUtil.isEmpty(dataObject) && !ValidationUtil.isEmpty(dataObject.get("name")) ? String.valueOf(dataObject.get("name")) : "");
model.setWorkflowProstanceId(instanceId);
return this.createWithModel(model);
} catch (Exception e) {
log.error("saveModel: model={} error", model, e);
throw new BaseException(e.getMessage());
}
}
/**
......
......@@ -14,7 +14,7 @@ eureka.instance.ip-address=172.16.3.17
#redis properties:
spring.redis.database=1
spring.redis.host= 172.16.10.243
spring.redis.host=172.16.10.243
spring.redis.port=6379
spring.redis.password=yeejoin@2020
spring.redis.lettuce.pool.max-active=200
......@@ -34,4 +34,7 @@ emqx.client-id=${spring.application.name}-${random.int[1024,65536]}
emqx.broker=tcp://172.16.10.243:1883
emqx.client-user-name=super
emqx.client-password=123456
emqx.keepAliveInterval=1000
\ No newline at end of file
emqx.keepAliveInterval=1000
#检验检测流程KEY
process-definition-key.jyjc.openapplication=inspectionBusinessOpened
\ No newline at end of file
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