This commit is contained in:
wangliwen 2022-04-25 09:58:12 +08:00
parent 453dc0a6d6
commit cd0aca28c8
6 changed files with 209 additions and 167 deletions

View File

@ -1,11 +1,13 @@
package io.renren.modules.demand.entity;
import io.swagger.annotations.ApiModelProperty;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import io.renren.common.entity.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import com.baomidou.mybatisplus.annotation.*;
import java.util.Date;
import io.renren.common.entity.BaseEntity;
/**
* 能力需求
@ -33,7 +35,6 @@ public class BsDemandEntity extends BaseEntity {
private String context;
/**
* 建议
*/
private String suggest;
/**
@ -64,7 +65,7 @@ public class BsDemandEntity extends BaseEntity {
private String files;
/**
* 状态
* */
*/
private String state;
/***
* 审核意见

View File

@ -53,6 +53,48 @@ public class CorrectionListener implements TaskListener, ExecutionListener, Acti
@Override
public void notify(DelegateTask delegateTask) {
logger.error("-------------------------进入部门动态审批人流程-------------------------------");
final String eventName = delegateTask.getEventName();
switch (eventName) {
case EVENTNAME_CREATE:
create(delegateTask);
break;
default:
}
logger.error("-------------------------结束部门动态审批人流程-------------------------------");
}
@Override
public void notify(DelegateExecution delegateExecution) throws Exception {
// logger.info("事件:" + delegateExecution.getEventName());
// delegateExecution.getVariableNames().stream().forEach(index -> logger.info("variable:" + index));
// delegateExecution.getVariables().values().stream().filter(index -> index != null).forEach(value -> logger.info(value.toString()));
// // taskService.setAssignee(delegateExecution.getProcessInstanceId(), "1516307964617076737");// 可以设置
//
// logger.info("修改审批人成功!" + delegateExecution.getCurrentActivityId() + " " + delegateExecution.getProcessInstanceId() + " " + delegateExecution.getProcessBusinessKey());
}
@Override
public void onEvent(ActivitiEvent activitiEvent) { // 事件回调
logger.info("事件类型:" + activitiEvent.getType().toString());
logger.info("" + activitiEvent.getProcessDefinitionId());
}
@Override
public boolean isFailOnException() {
return true;
}
@Override
public void execute(DelegateExecution delegateExecution) throws Exception {
logger.info("异常", delegateExecution);
}
/**
* 节点创建时动态分配资源部门审核人
*
* @param delegateTask
*/
private void create(DelegateTask delegateTask) {
Map<String, Object> kv = delegateTask.getVariables();
Gson gson = new Gson();
JsonElement jsonElement = gson.toJsonTree(kv);
@ -95,32 +137,5 @@ public class CorrectionListener implements TaskListener, ExecutionListener, Acti
logger.error("未查到该部门对应的 " + roleName);
taskService.setAssignee(delegateTask.getId(), "1513432847327199233");
}
logger.error("-------------------------结束部门动态审批人流程-------------------------------");
}
@Override
public void notify(DelegateExecution delegateExecution) throws Exception {
// logger.info("事件:" + delegateExecution.getEventName());
// delegateExecution.getVariableNames().stream().forEach(index -> logger.info("variable:" + index));
// delegateExecution.getVariables().values().stream().filter(index -> index != null).forEach(value -> logger.info(value.toString()));
// // taskService.setAssignee(delegateExecution.getProcessInstanceId(), "1516307964617076737");// 可以设置
//
// logger.info("修改审批人成功!" + delegateExecution.getCurrentActivityId() + " " + delegateExecution.getProcessInstanceId() + " " + delegateExecution.getProcessBusinessKey());
}
@Override
public void onEvent(ActivitiEvent activitiEvent) { // 事件回调
logger.info("事件类型:" + activitiEvent.getType().toString());
logger.info("" + activitiEvent.getProcessDefinitionId());
}
@Override
public boolean isFailOnException() {
return true;
}
@Override
public void execute(DelegateExecution delegateExecution) throws Exception {
logger.info("异常", delegateExecution);
}
}

View File

@ -53,6 +53,32 @@ public class DataCenterListener implements TaskListener, ExecutionListener, Acti
@Override
public void notify(DelegateTask delegateTask) {
logger.info("事件类型:" + delegateTask.getEventName());
final String eventName = delegateTask.getEventName();
switch (eventName) {
case EVENTNAME_CREATE:
createEvent(delegateTask);
break;
default:
logger.info("未处理该事件:" + eventName);
}
}
@Override
public void onEvent(ActivitiEvent activitiEvent) {
}
@Override
public boolean isFailOnException() {
return false;
}
/**
* 节点创建时动态分配大数据局审批人
*
* @param delegateTask
*/
private void createEvent(DelegateTask delegateTask) {
logger.info("大数据局名称:" + bigDateDeptName);
SysDeptDTO deptDTO = sysDeptService.getByName(bigDateDeptName);
logger.info("deptDTOId:" + deptDTO.getId());
@ -68,14 +94,4 @@ public class DataCenterListener implements TaskListener, ExecutionListener, Acti
logger.info("未查到该部门对应 " + roleName);
}
}
@Override
public void onEvent(ActivitiEvent activitiEvent) {
}
@Override
public boolean isFailOnException() {
return false;
}
}

View File

@ -128,7 +128,7 @@ public class ResourceController {
resourceService.insertWithAttrs(dto);
return new Result();
return new Result().ok(dto.getId() == null ? "" : dto.getId());
}
@PutMapping("/update")

View File

@ -80,6 +80,8 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
resourceEntity.setDelFlag(0);
resourceDao.insert(resourceEntity);
BeanUtils.copyProperties(resourceEntity, dto); // 将entity id 写入 dto
List<AttrEntity> attrEntities = dto.getInfoList();
attrEntities.forEach(item -> {
item.setDelFlag(0);

View File

@ -66,7 +66,39 @@ public class ResourceOwnerListener implements TaskListener, ExecutionListener, A
final String eventName = delegateTask.getEventName();
switch (eventName) {
case EVENTNAME_CREATE: // 创建当前审批节点事件
{
create(delegateTask, roleDTO);
break;
default:
logger.info("未处理该事件:" + eventName);
}
}
/**
* Called when an event has been fired
*
* @param event the event
*/
@Override
public void onEvent(ActivitiEvent event) {
}
/**
* @return whether or not the current operation should fail when this listeners execution
* throws an exception.
*/
@Override
public boolean isFailOnException() {
return false;
}
/**
* 节点创建时动态分配资源部门审核人
*
* @param delegateTask
* @param roleDTO
*/
private void create(DelegateTask delegateTask, final SysRoleDTO roleDTO) {
Map<String, Object> kv = delegateTask.getVariables();
Gson gson = new Gson();
JsonElement jsonElement = gson.toJsonTree(kv);
@ -97,33 +129,9 @@ public class ResourceOwnerListener implements TaskListener, ExecutionListener, A
logger.info("大数据审批人id:" + userDTO.getId());
taskService.setAssignee(delegateTask.getId(), userDTO.getId().toString());
} else {
delegateTask.setAssignee("1513432847327199233");
taskService.setAssignee(delegateTask.getId(), "1513432847327199233");
logger.info("未查到大数据部门对应 " + roleName);
}
}
}
break;
default:
logger.info("未处理该事件:" + eventName);
}
}
/**
* Called when an event has been fired
*
* @param event the event
*/
@Override
public void onEvent(ActivitiEvent event) {
}
/**
* @return whether or not the current operation should fail when this listeners execution
* throws an exception.
*/
@Override
public boolean isFailOnException() {
return false;
}
}