Commit 2681c7c7 authored by yangyang's avatar yangyang

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

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