Merge branch 'dev' of http://221.0.232.152:9393/ability-center/share-platform into dev
This commit is contained in:
commit
246bc4b4df
|
@ -62,13 +62,6 @@ public class FuseController {
|
||||||
return new Result<TbFuseDTO>().ok(tbFuseService.getFuseById(id));
|
return new Result<TbFuseDTO>().ok(tbFuseService.getFuseById(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("getDataResource")
|
|
||||||
@ApiOperation("获取资源数据")
|
|
||||||
@LogOperation("获取资源数据")
|
|
||||||
public Result<List<Map>> getDataResource() {
|
|
||||||
return new Result().ok(tbFuseService.getDataResource());
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping
|
@PostMapping
|
||||||
@ApiOperation("保存")
|
@ApiOperation("保存")
|
||||||
@LogOperation("保存")
|
@LogOperation("保存")
|
||||||
|
|
|
@ -16,8 +16,6 @@ public interface TbFuseService extends CrudService<TbFuseEntity, TbFuseDTO> {
|
||||||
|
|
||||||
TbFuseDTO getFuseById(Long id);
|
TbFuseDTO getFuseById(Long id);
|
||||||
|
|
||||||
List<Map> getDataResource();
|
|
||||||
|
|
||||||
Integer addFuse(TbFuseDTO dto);
|
Integer addFuse(TbFuseDTO dto);
|
||||||
|
|
||||||
Integer updateFuse(TbFuseDTO dto);
|
Integer updateFuse(TbFuseDTO dto);
|
||||||
|
|
|
@ -33,7 +33,11 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import javax.swing.text.html.Option;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.concurrent.*;
|
||||||
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -46,6 +50,10 @@ public class TbFuseServiceImpl extends CrudServiceImpl<TbFuseDao, TbFuseEntity,
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(ResourceServiceImpl.class);
|
private static final Logger logger = LoggerFactory.getLogger(ResourceServiceImpl.class);
|
||||||
|
|
||||||
|
private static final Integer CPU_NUM = Runtime.getRuntime().availableProcessors();
|
||||||
|
|
||||||
|
private static final ExecutorService executor = Executors.newWorkStealingPool(CPU_NUM * 3);
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private TbFuseDao fuseDao;
|
private TbFuseDao fuseDao;
|
||||||
@Autowired
|
@Autowired
|
||||||
|
@ -154,52 +162,49 @@ public class TbFuseServiceImpl extends CrudServiceImpl<TbFuseDao, TbFuseEntity,
|
||||||
}).collect(Collectors.toList());
|
}).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Map> getDataResource() {
|
private Map<String, List<Map>> getDataResource() {
|
||||||
int pageNum=0;
|
Map result=new ConcurrentHashMap();
|
||||||
int pageSize=getDataResourceCount();
|
final int pageSize = CPU_NUM * 10;
|
||||||
List<Map> result = new ArrayList<>();
|
AtomicInteger pageIndex = new AtomicInteger(1);
|
||||||
Optional<AbstractDataResourceService> factory = DataResourceFactory.build();
|
AtomicBoolean end = new AtomicBoolean(true);
|
||||||
if (factory.isPresent()) {
|
List<CompletableFuture> completableFutures=new CopyOnWriteArrayList<>();
|
||||||
GetDataResourceListDto dto = new GetDataResourceListDto().setPageNum(pageNum).setPageSize(pageSize);
|
while(end.get()){
|
||||||
Map<String, Object> dataMap = (Map<String, Object>) factory.get().getDataResource(dto);
|
completableFutures.add(CompletableFuture.supplyAsync(()->{
|
||||||
if (dataMap != null) {
|
Optional<AbstractDataResourceService> factory = DataResourceFactory.build();
|
||||||
List<Map<String, Object>> list = (List<Map<String, Object>>) dataMap.get("data");
|
if (factory.isPresent()) {
|
||||||
list.forEach(map -> result.add(new HashMap() {{
|
GetDataResourceListDto dto=new GetDataResourceListDto().setPageNum(pageIndex.get()).setPageSize(pageSize);
|
||||||
if (map.containsKey("zyname")) {
|
Map<String, Object> dataResource = (Map<String, Object>) factory.get().getDataResource(dto);
|
||||||
put("id", map.get("guid"));
|
if(!dataResource.isEmpty()){
|
||||||
put("name", map.get("zyname"));
|
List<Map<String, Object>> list = (List<Map<String, Object>>) dataResource.get("data");
|
||||||
} else {
|
pageIndex.getAndIncrement();
|
||||||
put("id", map.get("serviceId"));
|
return new HashMap(){{put( list.stream().map(map->{
|
||||||
put("name", map.get("serviceName"));
|
if (map.containsKey("zyname")) {
|
||||||
|
return map.get("guid");
|
||||||
|
} else {
|
||||||
|
return map.get("serviceId");
|
||||||
|
}
|
||||||
|
}), list);}};
|
||||||
}
|
}
|
||||||
}}));
|
}
|
||||||
}
|
return null;
|
||||||
|
}).thenAcceptAsync(map->{
|
||||||
|
if(map != null){
|
||||||
|
result.putAll(map);
|
||||||
|
}
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getDataResourceCount() {
|
|
||||||
int count=30;
|
|
||||||
Optional<AbstractDataResourceService> factory = DataResourceFactory.build();
|
|
||||||
if (factory.isPresent()) {
|
|
||||||
GetDataResourceListDto dto = new GetDataResourceListDto().setPageNum(0).setPageSize(30);
|
|
||||||
Map<String, Object> dataMap = (Map<String, Object>) factory.get().getDataResource(dto);
|
|
||||||
if (dataMap != null) {
|
|
||||||
count=Integer.parseInt(dataMap.get("rows").toString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return count;
|
|
||||||
}
|
|
||||||
|
|
||||||
private List<TbFuseResourceDTO> getFuseResourceByFuseId(Long fuseId) {
|
private List<TbFuseResourceDTO> getFuseResourceByFuseId(Long fuseId) {
|
||||||
List<Map> dataResourceMap = new ArrayList<>();
|
Map dataResourceMap = new HashMap();
|
||||||
List<TbFuseResourceDTO> result = new ArrayList();
|
List<TbFuseResourceDTO> result = new ArrayList();
|
||||||
QueryWrapper wrapper = new QueryWrapper();
|
QueryWrapper wrapper = new QueryWrapper();
|
||||||
wrapper.eq("fuse_id", fuseId);
|
wrapper.eq("fuse_id", fuseId);
|
||||||
List<TbFuseResourceEntity> list = fuseResourceDao.selectList(wrapper);
|
List<TbFuseResourceEntity> list = fuseResourceDao.selectList(wrapper);
|
||||||
Map<String, List<TbFuseResourceEntity>> resourceMap = list.stream().filter(index -> index.getType() != null).collect(Collectors.groupingBy(TbFuseResourceEntity::getType));
|
Map<String, List<TbFuseResourceEntity>> resourceMap = list.stream().filter(index -> index.getType() != null).collect(Collectors.groupingBy(TbFuseResourceEntity::getType));
|
||||||
if (resourceMap.containsKey("数据资源")) {
|
if (resourceMap.containsKey("数据资源")) {
|
||||||
dataResourceMap.addAll(getDataResource());
|
dataResourceMap.putAll(getDataResource());
|
||||||
}
|
}
|
||||||
resourceMap.forEach((type, value) -> {
|
resourceMap.forEach((type, value) -> {
|
||||||
if ("组件服务".equals(type)) {
|
if ("组件服务".equals(type)) {
|
||||||
|
@ -215,7 +220,7 @@ public class TbFuseServiceImpl extends CrudServiceImpl<TbFuseDao, TbFuseEntity,
|
||||||
result.addAll(value.stream().map(attr -> {
|
result.addAll(value.stream().map(attr -> {
|
||||||
TbFuseResourceDTO dto = new TbFuseResourceDTO();
|
TbFuseResourceDTO dto = new TbFuseResourceDTO();
|
||||||
BeanUtils.copyProperties(attr, dto);
|
BeanUtils.copyProperties(attr, dto);
|
||||||
dto.setResource(dataResourceMap.stream().filter(it->it.get("id").equals(dto.getResourceId())).findFirst());
|
dto.setResource(dataResourceMap.get(dto.getResourceId()));
|
||||||
return dto;
|
return dto;
|
||||||
}).collect(Collectors.toList()));
|
}).collect(Collectors.toList()));
|
||||||
} else if ("基础设施".equals(type)) {
|
} else if ("基础设施".equals(type)) {
|
||||||
|
|
|
@ -9,6 +9,7 @@ import io.renren.modules.gateway.dao.ApiCountHistoryDao;
|
||||||
import io.renren.modules.gateway.entity.ApiCountHistoryEntity;
|
import io.renren.modules.gateway.entity.ApiCountHistoryEntity;
|
||||||
import io.renren.modules.gateway.service.MonitorServiceV2;
|
import io.renren.modules.gateway.service.MonitorServiceV2;
|
||||||
import io.renren.modules.monitor.entity.Result;
|
import io.renren.modules.monitor.entity.Result;
|
||||||
|
import io.renren.modules.monitor.service.MonitorService;
|
||||||
import io.renren.modules.notice.dto.SysNoticeDTO;
|
import io.renren.modules.notice.dto.SysNoticeDTO;
|
||||||
import io.renren.modules.notice.service.impl.SysNoticeServiceImpl;
|
import io.renren.modules.notice.service.impl.SysNoticeServiceImpl;
|
||||||
import io.renren.modules.resource.dao.AttrDao;
|
import io.renren.modules.resource.dao.AttrDao;
|
||||||
|
@ -80,6 +81,8 @@ public class MonitorControllerV2 {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private SysNoticeServiceImpl sysNoticeService;
|
private SysNoticeServiceImpl sysNoticeService;
|
||||||
|
@Autowired
|
||||||
|
private MonitorService monitorService;
|
||||||
|
|
||||||
public List queryMetricCount(String queryFormat, Long start, Long end, String metricElement, int limit) throws InterruptedException, ExecutionException, TimeoutException {
|
public List queryMetricCount(String queryFormat, Long start, Long end, String metricElement, int limit) throws InterruptedException, ExecutionException, TimeoutException {
|
||||||
String url = gatewayDomain + "/juapi/metrics/api/v1/query?query={query}&time={time}";
|
String url = gatewayDomain + "/juapi/metrics/api/v1/query?query={query}&time={time}";
|
||||||
|
@ -332,11 +335,20 @@ public class MonitorControllerV2 {
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/sendMsg")
|
@GetMapping("/sendMsg")
|
||||||
@ApiOperation("查询总api调用总量")
|
|
||||||
public void sendMsg(){
|
public void sendMsg(){
|
||||||
SysNoticeDTO sysNoticeDTO = new SysNoticeDTO();
|
SysNoticeDTO sysNoticeDTO = new SysNoticeDTO();
|
||||||
sysNoticeDTO.setTitle("请审批yyyy的流程申请");
|
sysNoticeDTO.setTitle("请审批yyyy的流程申请");
|
||||||
sysNoticeService.sendToYaweiUser(sysNoticeDTO, Lists.newArrayList(1513432847327199233L));
|
sysNoticeService.sendToYaweiUser(sysNoticeDTO, Lists.newArrayList(1513432847327199233L));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/expireVideoToken")
|
||||||
|
public void expireVideoToken(){
|
||||||
|
monitorService.expireToken();
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/getVideoToken")
|
||||||
|
public String getVideoToken(String code) throws IOException {
|
||||||
|
return monitorService.fileCode(code);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,6 +41,7 @@ import java.awt.image.BufferedImage;
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.lang.ref.WeakReference;
|
||||||
import java.nio.charset.Charset;
|
import java.nio.charset.Charset;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
@ -118,6 +119,8 @@ public class MonitorService {
|
||||||
|
|
||||||
static int keepaliveCount = 16;
|
static int keepaliveCount = 16;
|
||||||
|
|
||||||
|
private WeakReference<Timer> weakTimer;
|
||||||
|
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
public CompletableFuture<String> init() {
|
public CompletableFuture<String> init() {
|
||||||
// 不要阻塞程序启动!!屮
|
// 不要阻塞程序启动!!屮
|
||||||
|
@ -133,6 +136,8 @@ public class MonitorService {
|
||||||
|
|
||||||
public String monitorLogin() {
|
public String monitorLogin() {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
String loginUrl = monitorDomain + "/videoService/accounts/authorize";
|
String loginUrl = monitorDomain + "/videoService/accounts/authorize";
|
||||||
HashMap<String, String> loginParam = new HashMap<>();
|
HashMap<String, String> loginParam = new HashMap<>();
|
||||||
loginParam.put("userName", userName);
|
loginParam.put("userName", userName);
|
||||||
|
@ -182,6 +187,8 @@ public class MonitorService {
|
||||||
|
|
||||||
MonitorService thatMonitorService = this;
|
MonitorService thatMonitorService = this;
|
||||||
|
|
||||||
|
weakTimer.get().cancel();
|
||||||
|
|
||||||
//会话保活
|
//会话保活
|
||||||
Timer timer = new Timer("monitor-capture-keepalive");
|
Timer timer = new Timer("monitor-capture-keepalive");
|
||||||
timer.scheduleAtFixedRate(new TimerTask() {
|
timer.scheduleAtFixedRate(new TimerTask() {
|
||||||
|
@ -215,8 +222,13 @@ public class MonitorService {
|
||||||
|
|
||||||
}
|
}
|
||||||
}, 0, duration * 1000);
|
}, 0, duration * 1000);
|
||||||
|
|
||||||
|
weakTimer = new WeakReference<Timer>(timer);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return token;
|
return token;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -772,10 +784,22 @@ public class MonitorService {
|
||||||
String url = monitorDomain + "/videoService/realmonitor/uri?scheme=HLS&channelId=" + code;
|
String url = monitorDomain + "/videoService/realmonitor/uri?scheme=HLS&channelId=" + code;
|
||||||
HttpHeaders headers = new HttpHeaders();
|
HttpHeaders headers = new HttpHeaders();
|
||||||
headers.add("X-Subject-Token", token);
|
headers.add("X-Subject-Token", token);
|
||||||
ResponseEntity<HashMap> forEntity = restTemplate.exchange(url, HttpMethod.GET, new HttpEntity(headers), HashMap.class);
|
int tryCount = 3;
|
||||||
HashMap body = forEntity.getBody();
|
while (tryCount-- > 0){
|
||||||
String file = (String) body.get("url");
|
try {
|
||||||
return file;
|
ResponseEntity<HashMap> forEntity = restTemplate.exchange(url, HttpMethod.GET, new HttpEntity(headers), HashMap.class);
|
||||||
|
HashMap body = forEntity.getBody();
|
||||||
|
String file = (String) body.get("url");
|
||||||
|
return file;
|
||||||
|
}catch (HttpClientErrorException.Unauthorized e){
|
||||||
|
log.error("token失效,重新登录");
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void videoService(String parentId, String path) throws InterruptedException {
|
public void videoService(String parentId, String path) throws InterruptedException {
|
||||||
|
@ -1515,6 +1539,10 @@ public class MonitorService {
|
||||||
}
|
}
|
||||||
return childs;
|
return childs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void expireToken(){
|
||||||
|
token = "expire";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,8 @@ package io.renren.modules.processForm.listener.v3;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import io.renren.common.annotation.ActivitiNoticeOperation;
|
import io.renren.common.annotation.ActivitiNoticeOperation;
|
||||||
|
import io.renren.modules.activiti.service.ActTaskService;
|
||||||
|
import io.renren.modules.processForm.dto.TAbilityApplicationDTO;
|
||||||
import io.renren.modules.sys.dao.SysUserDao;
|
import io.renren.modules.sys.dao.SysUserDao;
|
||||||
import io.renren.modules.sys.dto.SysDeptDTO;
|
import io.renren.modules.sys.dto.SysDeptDTO;
|
||||||
import io.renren.modules.sys.dto.SysRoleDTO;
|
import io.renren.modules.sys.dto.SysRoleDTO;
|
||||||
|
@ -17,6 +19,7 @@ import org.activiti.engine.TaskService;
|
||||||
import org.activiti.engine.delegate.*;
|
import org.activiti.engine.delegate.*;
|
||||||
import org.activiti.engine.delegate.event.ActivitiEvent;
|
import org.activiti.engine.delegate.event.ActivitiEvent;
|
||||||
import org.activiti.engine.delegate.event.ActivitiEventListener;
|
import org.activiti.engine.delegate.event.ActivitiEventListener;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
@ -98,6 +101,7 @@ public class ApplyDistrictListener implements TaskListener, ExecutionListener, A
|
||||||
taskService.setAssignee(delegateTask.getId(), defaultAssigneeRoleId);
|
taskService.setAssignee(delegateTask.getId(), defaultAssigneeRoleId);
|
||||||
assignee = defaultAssigneeRoleId;
|
assignee = defaultAssigneeRoleId;
|
||||||
}
|
}
|
||||||
|
mpComplete(delegateTask, assignee);
|
||||||
logger.error("分配的用户id为:{}", assignee);
|
logger.error("分配的用户id为:{}", assignee);
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
|
@ -108,6 +112,17 @@ public class ApplyDistrictListener implements TaskListener, ExecutionListener, A
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void mpComplete(DelegateTask delegateTask, final String assignee) { // 处理审批人为申请人
|
||||||
|
if (StringUtils.isNotEmpty(assignee)
|
||||||
|
&& StringUtils.isNotEmpty(delegateTask.getVariable("creator", String.class))
|
||||||
|
&& delegateTask.getVariable("creator", String.class).equals(assignee)) {
|
||||||
|
taskService.addComment(delegateTask.getId(), delegateTask.getProcessInstanceId(), "审批人为发起人,默认通过");
|
||||||
|
taskService.setVariable(delegateTask.getId(), ActTaskService.Task_HANDLE_STATE, ActTaskService.Task_HANDLE_STATE_AGREE);
|
||||||
|
taskService.setVariable(delegateTask.getId(), "backToFirst", Boolean.FALSE);
|
||||||
|
taskService.complete(delegateTask.getId(), delegateTask.getVariables());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void notify(DelegateExecution delegateExecution) throws Exception {
|
public void notify(DelegateExecution delegateExecution) throws Exception {
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@ package io.renren.modules.processForm.listener.v3;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import io.renren.common.annotation.ActivitiNoticeOperation;
|
import io.renren.common.annotation.ActivitiNoticeOperation;
|
||||||
|
import io.renren.modules.activiti.service.ActTaskService;
|
||||||
import io.renren.modules.sys.dao.SysUserDao;
|
import io.renren.modules.sys.dao.SysUserDao;
|
||||||
import io.renren.modules.sys.dto.SysDeptDTO;
|
import io.renren.modules.sys.dto.SysDeptDTO;
|
||||||
import io.renren.modules.sys.dto.SysRoleDTO;
|
import io.renren.modules.sys.dto.SysRoleDTO;
|
||||||
|
@ -17,6 +18,7 @@ import org.activiti.engine.TaskService;
|
||||||
import org.activiti.engine.delegate.*;
|
import org.activiti.engine.delegate.*;
|
||||||
import org.activiti.engine.delegate.event.ActivitiEvent;
|
import org.activiti.engine.delegate.event.ActivitiEvent;
|
||||||
import org.activiti.engine.delegate.event.ActivitiEventListener;
|
import org.activiti.engine.delegate.event.ActivitiEventListener;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
@ -99,6 +101,7 @@ public class CityListener implements TaskListener, ExecutionListener, ActivitiEv
|
||||||
taskService.setAssignee(delegateTask.getId(), defaultAssigneeRoleId);
|
taskService.setAssignee(delegateTask.getId(), defaultAssigneeRoleId);
|
||||||
assignee = defaultAssigneeRoleId;
|
assignee = defaultAssigneeRoleId;
|
||||||
}
|
}
|
||||||
|
mpComplete(delegateTask, assignee);
|
||||||
logger.error("分配的用户id为:{}", assignee);
|
logger.error("分配的用户id为:{}", assignee);
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
|
@ -109,6 +112,17 @@ public class CityListener implements TaskListener, ExecutionListener, ActivitiEv
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void mpComplete(DelegateTask delegateTask, final String assignee) { // 处理审批人为申请人
|
||||||
|
if (StringUtils.isNotEmpty(assignee)
|
||||||
|
&& StringUtils.isNotEmpty(delegateTask.getVariable("creator", String.class))
|
||||||
|
&& delegateTask.getVariable("creator", String.class).equals(assignee)) {
|
||||||
|
taskService.addComment(delegateTask.getId(), delegateTask.getProcessInstanceId(), "审批人为发起人,默认通过");
|
||||||
|
taskService.setVariable(delegateTask.getId(), ActTaskService.Task_HANDLE_STATE, ActTaskService.Task_HANDLE_STATE_AGREE);
|
||||||
|
taskService.setVariable(delegateTask.getId(), "backToFirst", Boolean.FALSE);
|
||||||
|
taskService.complete(delegateTask.getId(), delegateTask.getVariables());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void notify(DelegateExecution delegateExecution) throws Exception {
|
public void notify(DelegateExecution delegateExecution) throws Exception {
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@ package io.renren.modules.processForm.listener.v3;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import io.renren.common.annotation.ActivitiNoticeOperation;
|
import io.renren.common.annotation.ActivitiNoticeOperation;
|
||||||
|
import io.renren.modules.activiti.service.ActTaskService;
|
||||||
import io.renren.modules.sys.dao.SysUserDao;
|
import io.renren.modules.sys.dao.SysUserDao;
|
||||||
import io.renren.modules.sys.dto.SysDeptDTO;
|
import io.renren.modules.sys.dto.SysDeptDTO;
|
||||||
import io.renren.modules.sys.dto.SysRoleDTO;
|
import io.renren.modules.sys.dto.SysRoleDTO;
|
||||||
|
@ -16,6 +17,7 @@ import org.activiti.engine.TaskService;
|
||||||
import org.activiti.engine.delegate.*;
|
import org.activiti.engine.delegate.*;
|
||||||
import org.activiti.engine.delegate.event.ActivitiEvent;
|
import org.activiti.engine.delegate.event.ActivitiEvent;
|
||||||
import org.activiti.engine.delegate.event.ActivitiEventListener;
|
import org.activiti.engine.delegate.event.ActivitiEventListener;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
@ -95,6 +97,7 @@ public class OwnerDistrictListener implements TaskListener, ExecutionListener, A
|
||||||
taskService.setAssignee(delegateTask.getId(), defaultAssigneeRoleId);
|
taskService.setAssignee(delegateTask.getId(), defaultAssigneeRoleId);
|
||||||
assignee = defaultAssigneeRoleId;
|
assignee = defaultAssigneeRoleId;
|
||||||
}
|
}
|
||||||
|
mpComplete(delegateTask, assignee);
|
||||||
logger.error("分配的用户id为:{}", assignee);
|
logger.error("分配的用户id为:{}", assignee);
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
|
@ -104,6 +107,17 @@ public class OwnerDistrictListener implements TaskListener, ExecutionListener, A
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private void mpComplete(DelegateTask delegateTask, final String assignee) { // 处理审批人为申请人
|
||||||
|
if (StringUtils.isNotEmpty(assignee)
|
||||||
|
&& StringUtils.isNotEmpty(delegateTask.getVariable("creator", String.class))
|
||||||
|
&& delegateTask.getVariable("creator", String.class).equals(assignee)) {
|
||||||
|
taskService.addComment(delegateTask.getId(), delegateTask.getProcessInstanceId(), "审批人为发起人,默认通过");
|
||||||
|
taskService.setVariable(delegateTask.getId(), ActTaskService.Task_HANDLE_STATE, ActTaskService.Task_HANDLE_STATE_AGREE);
|
||||||
|
taskService.setVariable(delegateTask.getId(), "backToFirst", Boolean.FALSE);
|
||||||
|
taskService.complete(delegateTask.getId(), delegateTask.getVariables());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void notify(DelegateExecution delegateExecution) throws Exception {
|
public void notify(DelegateExecution delegateExecution) throws Exception {
|
||||||
|
|
Loading…
Reference in New Issue