Merge branch 'dev' of http://221.0.232.152:9393/ability-center/share-platform into dev
* 'dev' of http://221.0.232.152:9393/ability-center/share-platform: 同步知识库问题 。。。 user表新增字段 融合服务修改 修改获从金宏网获取用户信息,但是还是获取不到guid 同步知识库的优化 能力申请v3-bug fix ... ... 调整跨区判断 更新能力申请模型v3 接口开启gzip压缩 区、市监听器:修改表单字段获取逻辑 applyState 字段返回值不一致的问题fix npe fix # Conflicts: # renren-admin/src/main/java/io/renren/modules/sys/entity/SysUserEntity.java
This commit is contained in:
commit
951923b551
|
@ -239,9 +239,14 @@ public class AbilityCenterControllerV3 {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
List<TAbilityApplicationDTO> dtoList = temp.get(deptId);
|
List<TAbilityApplicationDTO> dtoList = temp.get(deptId);
|
||||||
|
dtoList = dtoList.stream().map(index -> {
|
||||||
|
index.setResourceOwnerDept(sysDeptDTO);
|
||||||
|
return index;
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
|
||||||
|
List<TAbilityApplicationDTO> finalDtoList = dtoList;
|
||||||
CompletableFuture.runAsync(() -> {
|
CompletableFuture.runAsync(() -> {
|
||||||
String[] sqls = dtoList.stream().map(index -> String.format("UPDATE t_ability_application SET resource_owner_dept = '%s' WHERE id = %s", JSON.toJSONString(sysDeptDTO), index.getId())).collect(Collectors.toList()).toArray(new String[dtoList.size()]);
|
String[] sqls = finalDtoList.stream().map(index -> String.format("UPDATE t_ability_application SET resource_owner_dept = '%s' WHERE id = %s", JSON.toJSONString(sysDeptDTO), index.getId())).collect(Collectors.toList()).toArray(new String[finalDtoList.size()]);
|
||||||
jdbcTemplate.batchUpdate(sqls); // 批量更新资源所属部门信息
|
jdbcTemplate.batchUpdate(sqls); // 批量更新资源所属部门信息
|
||||||
logger.info("批量更新申请的资源的部门信息完成");
|
logger.info("批量更新申请的资源的部门信息完成");
|
||||||
}, executor);
|
}, executor);
|
||||||
|
@ -280,10 +285,11 @@ public class AbilityCenterControllerV3 {
|
||||||
if (applyUserDeptType == 2) {
|
if (applyUserDeptType == 2) {
|
||||||
cityApply = Boolean.TRUE; // 市级部门发起申请
|
cityApply = Boolean.TRUE; // 市级部门发起申请
|
||||||
}
|
}
|
||||||
if (cityApply && resourceDeptType == 2) {
|
if (resourceDeptType == 2) {
|
||||||
cityApplyCity = Boolean.TRUE; // 市区申请市区
|
cityApplyCity = Boolean.TRUE; // 市区申请市区
|
||||||
}
|
}
|
||||||
if (!cityApply && (user.getDeptId() != sysDeptDTO.getId())) { // 非市申请且发起人与资源所属部门不一致
|
SysDeptDTO userDept = sysDeptService.get(user.getDeptId());
|
||||||
|
if (!cityApply && !userDept.getDistrict().equals(sysDeptDTO.getDistrict())) { // 非市申请且发起人与资源所属区县不一致
|
||||||
crossRegion = Boolean.TRUE; // 跨区
|
crossRegion = Boolean.TRUE; // 跨区
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -292,9 +298,10 @@ public class AbilityCenterControllerV3 {
|
||||||
Boolean finalCityApply = cityApply;
|
Boolean finalCityApply = cityApply;
|
||||||
Boolean finalCityApplyCity = cityApplyCity;
|
Boolean finalCityApplyCity = cityApplyCity;
|
||||||
Boolean finalCrossRegion = crossRegion;
|
Boolean finalCrossRegion = crossRegion;
|
||||||
|
List<TAbilityApplicationDTO> finalDtoList1 = dtoList;
|
||||||
variables.putAll(new HashMap<String, Object>() { // 流程内携带属性值
|
variables.putAll(new HashMap<String, Object>() { // 流程内携带属性值
|
||||||
{
|
{
|
||||||
put("tAbilityApplicationDTOList", dtoList); // 归属该部门的申请
|
put("tAbilityApplicationDTOList", finalDtoList1); // 归属该部门的申请
|
||||||
put("key", processStartDTO.getBusinessKey()); // 归属该部门申请的表单id
|
put("key", processStartDTO.getBusinessKey()); // 归属该部门申请的表单id
|
||||||
put("deptId", deptId); // 归属部门
|
put("deptId", deptId); // 归属部门
|
||||||
put("_id", applyFlag); //申请id
|
put("_id", applyFlag); //申请id
|
||||||
|
@ -306,6 +313,7 @@ public class AbilityCenterControllerV3 {
|
||||||
put("city_apply", finalCityApply); // 是否为市级部门发起申请
|
put("city_apply", finalCityApply); // 是否为市级部门发起申请
|
||||||
put("cross_region", finalCrossRegion); // 是否跨区
|
put("cross_region", finalCrossRegion); // 是否跨区
|
||||||
put("city_apply_city", finalCityApplyCity); // 是否为市区申请市区
|
put("city_apply_city", finalCityApplyCity); // 是否为市区申请市区
|
||||||
|
put("resource_dept", sysDeptDTO); // 同一审核单内部门信息
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -313,10 +321,11 @@ public class AbilityCenterControllerV3 {
|
||||||
ProcessInstanceDTO dto = actRunningService.startOfBusinessKey(processStartDTO);
|
ProcessInstanceDTO dto = actRunningService.startOfBusinessKey(processStartDTO);
|
||||||
|
|
||||||
// 仿照请求接口 /processForm/tabilityapplication/updateInstanceId
|
// 仿照请求接口 /processForm/tabilityapplication/updateInstanceId
|
||||||
|
List<TAbilityApplicationDTO> finalDtoList2 = dtoList;
|
||||||
CompletableFuture.runAsync(() -> {
|
CompletableFuture.runAsync(() -> {
|
||||||
if (dto.getBusinessKey() != null) {
|
if (dto.getBusinessKey() != null) {
|
||||||
String[] sqls = dtoList.stream().map(i -> String.format("UPDATE t_ability_application SET instance_id = %s WHERE id = %s", dto.getProcessInstanceId(), i.getId()))
|
String[] sqls = finalDtoList2.stream().map(i -> String.format("UPDATE t_ability_application SET instance_id = %s WHERE id = %s", dto.getProcessInstanceId(), i.getId()))
|
||||||
.collect(Collectors.toList()).toArray(new String[dtoList.size()]);
|
.collect(Collectors.toList()).toArray(new String[finalDtoList2.size()]);
|
||||||
jdbcTemplate.batchUpdate(sqls);
|
jdbcTemplate.batchUpdate(sqls);
|
||||||
}
|
}
|
||||||
}, executor);
|
}, executor);
|
||||||
|
|
|
@ -19,6 +19,7 @@ import org.springframework.web.bind.annotation.*;
|
||||||
import springfox.documentation.annotations.ApiIgnore;
|
import springfox.documentation.annotations.ApiIgnore;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -61,6 +62,13 @@ 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("保存")
|
||||||
|
|
|
@ -4,6 +4,7 @@ import io.renren.common.service.CrudService;
|
||||||
import io.renren.modules.fuse.dto.TbFuseDTO;
|
import io.renren.modules.fuse.dto.TbFuseDTO;
|
||||||
import io.renren.modules.fuse.entity.TbFuseEntity;
|
import io.renren.modules.fuse.entity.TbFuseEntity;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -15,6 +16,8 @@ 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);
|
||||||
|
|
|
@ -154,35 +154,52 @@ public class TbFuseServiceImpl extends CrudServiceImpl<TbFuseDao, TbFuseEntity,
|
||||||
}).collect(Collectors.toList());
|
}).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
private Map<String, Map<String, Object>> getDataResource() {
|
public List<Map> getDataResource() {
|
||||||
Map<String, Map<String, Object>> result = new HashMap<>();
|
int pageNum=0;
|
||||||
|
int pageSize=getDataResourceCount();
|
||||||
|
List<Map> result = new ArrayList<>();
|
||||||
Optional<AbstractDataResourceService> factory = DataResourceFactory.build();
|
Optional<AbstractDataResourceService> factory = DataResourceFactory.build();
|
||||||
if (factory.isPresent()) {
|
if (factory.isPresent()) {
|
||||||
GetDataResourceListDto dto = new GetDataResourceListDto().setPageNum(0).setPageSize(30);
|
GetDataResourceListDto dto = new GetDataResourceListDto().setPageNum(pageNum).setPageSize(pageSize);
|
||||||
Map<String, Object> dataMap = (Map<String, Object>) factory.get().getDataResource(dto);
|
Map<String, Object> dataMap = (Map<String, Object>) factory.get().getDataResource(dto);
|
||||||
if (dataMap != null) {
|
if (dataMap != null) {
|
||||||
List<Map<String, Object>> list = (List<Map<String, Object>>) dataMap.get("data");
|
List<Map<String, Object>> list = (List<Map<String, Object>>) dataMap.get("data");
|
||||||
list.forEach(map -> {
|
list.forEach(map -> result.add(new HashMap() {{
|
||||||
if (map.containsKey("zyname")) {
|
if (map.containsKey("zyname")) {
|
||||||
result.put(map.get("guid").toString(), map);
|
put("id", map.get("guid"));
|
||||||
|
put("name", map.get("zyname"));
|
||||||
} else {
|
} else {
|
||||||
result.put(map.get("serviceId").toString(), map);
|
put("id", map.get("serviceId"));
|
||||||
|
put("name", map.get("serviceName"));
|
||||||
}
|
}
|
||||||
});
|
}}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
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) {
|
||||||
Map<String, Map<String, Object>> dataResourceMap = new HashMap<>();
|
List<Map> dataResourceMap = new ArrayList<>();
|
||||||
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.putAll(getDataResource());
|
dataResourceMap.addAll(getDataResource());
|
||||||
}
|
}
|
||||||
resourceMap.forEach((type, value) -> {
|
resourceMap.forEach((type, value) -> {
|
||||||
if ("组件服务".equals(type)) {
|
if ("组件服务".equals(type)) {
|
||||||
|
@ -198,7 +215,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.get(dto.getResourceId()));
|
dto.setResource(dataResourceMap.stream().filter(it->it.get("id").equals(dto.getResourceId())).findFirst());
|
||||||
return dto;
|
return dto;
|
||||||
}).collect(Collectors.toList()));
|
}).collect(Collectors.toList()));
|
||||||
} else if ("基础设施".equals(type)) {
|
} else if ("基础设施".equals(type)) {
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
package io.renren.modules.gateway.controller;
|
package io.renren.modules.gateway.controller;
|
||||||
|
|
||||||
|
|
||||||
import cn.hutool.core.net.URLEncoder;
|
|
||||||
import cn.hutool.core.util.URLUtil;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import io.renren.modules.gateway.service.MonitorServiceV2;
|
import io.renren.modules.gateway.service.MonitorServiceV2;
|
||||||
|
@ -15,19 +13,16 @@ import io.renren.modules.sys.dao.SysDeptDao;
|
||||||
import io.renren.modules.sys.entity.SysDeptEntity;
|
import io.renren.modules.sys.entity.SysDeptEntity;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import lombok.extern.log4j.Log4j;
|
|
||||||
import lombok.extern.log4j.Log4j2;
|
import lombok.extern.log4j.Log4j2;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
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.http.*;
|
import org.springframework.http.HttpEntity;
|
||||||
import org.springframework.http.converter.ByteArrayHttpMessageConverter;
|
import org.springframework.http.HttpHeaders;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.http.HttpMethod;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import org.springframework.web.client.HttpMessageConverterExtractor;
|
|
||||||
import org.springframework.web.client.RequestCallback;
|
|
||||||
import org.springframework.web.client.RestTemplate;
|
import org.springframework.web.client.RestTemplate;
|
||||||
|
|
||||||
import javax.servlet.ServletOutputStream;
|
import javax.servlet.ServletOutputStream;
|
||||||
|
@ -66,14 +61,14 @@ public class MonitorController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private MonitorServiceV2 monitorServiceV2;
|
private MonitorServiceV2 monitorServiceV2;
|
||||||
|
|
||||||
// @RequestMapping("/metrics/**")
|
// @RequestMapping("/metrics/**")
|
||||||
void forward(HttpServletRequest request, HttpServletResponse response) throws IOException {
|
void forward(HttpServletRequest request, HttpServletResponse response) throws IOException {
|
||||||
//类似nginx匹配前缀
|
//类似nginx匹配前缀
|
||||||
String location = "/juapi";
|
String location = "/juapi";
|
||||||
|
|
||||||
String requestURI = request.getRequestURI();
|
String requestURI = request.getRequestURI();
|
||||||
requestURI = requestURI.replace( context_path,"");
|
requestURI = requestURI.replace(context_path, "");
|
||||||
String url = gatewayDomain + location + requestURI ;
|
String url = gatewayDomain + location + requestURI;
|
||||||
if (StringUtils.isNotBlank(request.getQueryString())) {
|
if (StringUtils.isNotBlank(request.getQueryString())) {
|
||||||
url = url + "?" + request.getQueryString();
|
url = url + "?" + request.getQueryString();
|
||||||
}
|
}
|
||||||
|
@ -81,7 +76,7 @@ public class MonitorController {
|
||||||
|
|
||||||
HttpHeaders headers = new HttpHeaders();
|
HttpHeaders headers = new HttpHeaders();
|
||||||
Enumeration<String> headerNames = request.getHeaderNames();
|
Enumeration<String> headerNames = request.getHeaderNames();
|
||||||
while (headerNames.hasMoreElements()){
|
while (headerNames.hasMoreElements()) {
|
||||||
String element = headerNames.nextElement();
|
String element = headerNames.nextElement();
|
||||||
headers.add(element, request.getHeader(element));
|
headers.add(element, request.getHeader(element));
|
||||||
}
|
}
|
||||||
|
@ -89,17 +84,17 @@ public class MonitorController {
|
||||||
InputStream in = request.getInputStream();
|
InputStream in = request.getInputStream();
|
||||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||||
int len = 1024;
|
int len = 1024;
|
||||||
byte tmp [] = new byte[len];
|
byte tmp[] = new byte[len];
|
||||||
int i ;
|
int i;
|
||||||
while((i=in.read(tmp, 0, len))>0){
|
while ((i = in.read(tmp, 0, len)) > 0) {
|
||||||
baos.write(tmp, 0, i);
|
baos.write(tmp, 0, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
HttpEntity<byte[]> httpEntity = null;
|
HttpEntity<byte[]> httpEntity = null;
|
||||||
if (baos.size() > 0){
|
if (baos.size() > 0) {
|
||||||
|
|
||||||
httpEntity = new HttpEntity(baos.toByteArray(), headers);
|
httpEntity = new HttpEntity(baos.toByteArray(), headers);
|
||||||
}else {
|
} else {
|
||||||
httpEntity = new HttpEntity(headers);
|
httpEntity = new HttpEntity(headers);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -118,13 +113,13 @@ public class MonitorController {
|
||||||
|
|
||||||
@GetMapping("/metrics/**")
|
@GetMapping("/metrics/**")
|
||||||
@ApiOperation("前端访问图片请求转发")
|
@ApiOperation("前端访问图片请求转发")
|
||||||
public void ford(HttpServletRequest request, HttpServletResponse response){
|
public void ford(HttpServletRequest request, HttpServletResponse response) {
|
||||||
|
|
||||||
String location = "/juapi";
|
String location = "/juapi";
|
||||||
|
|
||||||
String requestURI = request.getRequestURI();
|
String requestURI = request.getRequestURI();
|
||||||
requestURI = requestURI.replace( context_path,"");
|
requestURI = requestURI.replace(context_path, "");
|
||||||
String fordUrl = gatewayDomain + location + requestURI ;
|
String fordUrl = gatewayDomain + location + requestURI;
|
||||||
if (StringUtils.isNotBlank(request.getQueryString())) {
|
if (StringUtils.isNotBlank(request.getQueryString())) {
|
||||||
fordUrl = fordUrl + "?" + request.getQueryString();
|
fordUrl = fordUrl + "?" + request.getQueryString();
|
||||||
}
|
}
|
||||||
|
@ -157,34 +152,34 @@ public class MonitorController {
|
||||||
len = inputStream.read(buffer);
|
len = inputStream.read(buffer);
|
||||||
}
|
}
|
||||||
inputStream.close();
|
inputStream.close();
|
||||||
}catch(Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/gateway-monitor/queryGroupByAbility")
|
@GetMapping("/gateway-monitor/queryGroupByAbility")
|
||||||
@ApiOperation("统计数据按能力归集")
|
@ApiOperation("统计数据按能力归集")
|
||||||
public Result queryGroupByAbility(String query, String time){
|
public Result queryGroupByAbility(String query, String time) {
|
||||||
String url = gatewayDomain + "/juapi/metrics/api/v1/query?query={query}" + "&time=" + time;
|
String url = gatewayDomain + "/juapi/metrics/api/v1/query?query={query}" + "&time=" + time;
|
||||||
ResponseEntity<HashMap> entity = restTemplate.getForEntity(url, HashMap.class, query);
|
ResponseEntity<HashMap> entity = restTemplate.getForEntity(url, HashMap.class, query);
|
||||||
HashMap body = entity.getBody();
|
HashMap body = entity.getBody();
|
||||||
HashMap data = (HashMap) body.get("data");
|
HashMap data = (HashMap) body.get("data");
|
||||||
if (data != null){
|
if (data != null) {
|
||||||
List<HashMap> result = (List) data.get("result");
|
List<HashMap> result = (List) data.get("result");
|
||||||
ArrayList<Map> results = new ArrayList<>();
|
ArrayList<Map> results = new ArrayList<>();
|
||||||
ArrayList<Long> abilityIds = new ArrayList<>();
|
ArrayList<Long> abilityIds = new ArrayList<>();
|
||||||
for (HashMap hashMap : result) {
|
for (HashMap hashMap : result) {
|
||||||
Map metric = (Map) hashMap.get("metric");
|
Map metric = (Map) hashMap.get("metric");
|
||||||
if (metric != null && metric.get("groupInfo") != null){
|
if (metric != null && metric.get("groupInfo") != null) {
|
||||||
List value = (List) hashMap.get("value");
|
List value = (List) hashMap.get("value");
|
||||||
if (value.size() == 2){
|
if (value.size() == 2) {
|
||||||
metric.put("count", value.get(1));
|
metric.put("count", value.get(1));
|
||||||
try{
|
try {
|
||||||
Long groupInfo = Long.valueOf((String) metric.get("groupInfo"));
|
Long groupInfo = Long.valueOf((String) metric.get("groupInfo"));
|
||||||
abilityIds.add(groupInfo);
|
abilityIds.add(groupInfo);
|
||||||
metric.put("groupInfo", groupInfo);
|
metric.put("groupInfo", groupInfo);
|
||||||
results.add(metric);
|
results.add(metric);
|
||||||
}catch (Exception e) {
|
} catch (Exception e) {
|
||||||
//忽略
|
//忽略
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -211,9 +206,9 @@ public class MonitorController {
|
||||||
map.put("type", resourceEntity.getType());
|
map.put("type", resourceEntity.getType());
|
||||||
map.put("apiUrl", resourceEntity.getApiUrl());
|
map.put("apiUrl", resourceEntity.getApiUrl());
|
||||||
LambdaQueryWrapper<AttrEntity> attrQueryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<AttrEntity> attrQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
attrQueryWrapper.select(AttrEntity::getAttrType,AttrEntity::getAttrValue)
|
attrQueryWrapper.select(AttrEntity::getAttrType, AttrEntity::getAttrValue)
|
||||||
.eq(AttrEntity::getDataResourceId,groupInfo)
|
.eq(AttrEntity::getDataResourceId, groupInfo)
|
||||||
.eq(AttrEntity::getAttrType,"服务商名")
|
.eq(AttrEntity::getAttrType, "服务商名")
|
||||||
.eq(AttrEntity::getDelFlag, 0);
|
.eq(AttrEntity::getDelFlag, 0);
|
||||||
AttrEntity attrEntity = attrDao.selectOne(attrQueryWrapper);
|
AttrEntity attrEntity = attrDao.selectOne(attrQueryWrapper);
|
||||||
if (attrEntity.getAttrValue() != null) {
|
if (attrEntity.getAttrValue() != null) {
|
||||||
|
@ -234,27 +229,27 @@ public class MonitorController {
|
||||||
|
|
||||||
@GetMapping("/gateway-monitor/queryGroupByDepartment")
|
@GetMapping("/gateway-monitor/queryGroupByDepartment")
|
||||||
@ApiOperation("统计数据按部门归集")
|
@ApiOperation("统计数据按部门归集")
|
||||||
public Result queryGroupByDepartment(String query, String time){
|
public Result queryGroupByDepartment(String query, String time) {
|
||||||
String url = gatewayDomain + "/juapi/metrics/api/v1/query?query={query}" + "&time=" + time;
|
String url = gatewayDomain + "/juapi/metrics/api/v1/query?query={query}" + "&time=" + time;
|
||||||
ResponseEntity<HashMap> entity = restTemplate.getForEntity(url, HashMap.class, query);
|
ResponseEntity<HashMap> entity = restTemplate.getForEntity(url, HashMap.class, query);
|
||||||
HashMap body = entity.getBody();
|
HashMap body = entity.getBody();
|
||||||
HashMap data = (HashMap) body.get("data");
|
HashMap data = (HashMap) body.get("data");
|
||||||
if (data != null){
|
if (data != null) {
|
||||||
List<HashMap> result = (List) data.get("result");
|
List<HashMap> result = (List) data.get("result");
|
||||||
ArrayList<Map> results = new ArrayList<>();
|
ArrayList<Map> results = new ArrayList<>();
|
||||||
ArrayList<Long> abilityIds = new ArrayList<>();
|
ArrayList<Long> abilityIds = new ArrayList<>();
|
||||||
for (HashMap hashMap : result) {
|
for (HashMap hashMap : result) {
|
||||||
Map metric = (Map) hashMap.get("metric");
|
Map metric = (Map) hashMap.get("metric");
|
||||||
if (metric != null && metric.get("deptInfo") != null){
|
if (metric != null && metric.get("deptInfo") != null) {
|
||||||
List value = (List) hashMap.get("value");
|
List value = (List) hashMap.get("value");
|
||||||
if (value.size() == 2){
|
if (value.size() == 2) {
|
||||||
metric.put("count", value.get(1));
|
metric.put("count", value.get(1));
|
||||||
try {
|
try {
|
||||||
Long groupInfo = Long.valueOf((String) metric.get("deptInfo"));
|
Long groupInfo = Long.valueOf((String) metric.get("deptInfo"));
|
||||||
abilityIds.add(groupInfo);
|
abilityIds.add(groupInfo);
|
||||||
metric.put("deptInfo", groupInfo);
|
metric.put("deptInfo", groupInfo);
|
||||||
results.add(metric);
|
results.add(metric);
|
||||||
}catch (Exception e) {
|
} catch (Exception e) {
|
||||||
//忽略
|
//忽略
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -264,7 +259,7 @@ public class MonitorController {
|
||||||
|
|
||||||
if (!results.isEmpty()) {
|
if (!results.isEmpty()) {
|
||||||
LambdaQueryWrapper<SysDeptEntity> queryWrapper = new QueryWrapper<SysDeptEntity>().lambda();
|
LambdaQueryWrapper<SysDeptEntity> queryWrapper = new QueryWrapper<SysDeptEntity>().lambda();
|
||||||
queryWrapper.select(SysDeptEntity::getName,SysDeptEntity::getId)
|
queryWrapper.select(SysDeptEntity::getName, SysDeptEntity::getId)
|
||||||
.in(SysDeptEntity::getId, abilityIds);
|
.in(SysDeptEntity::getId, abilityIds);
|
||||||
List<SysDeptEntity> entities = sysDeptDao.selectList(queryWrapper);
|
List<SysDeptEntity> entities = sysDeptDao.selectList(queryWrapper);
|
||||||
for (Map map : results) {
|
for (Map map : results) {
|
||||||
|
@ -287,7 +282,7 @@ public class MonitorController {
|
||||||
|
|
||||||
@GetMapping("/gateway-monitor/queryGroupByDeptInRange")
|
@GetMapping("/gateway-monitor/queryGroupByDeptInRange")
|
||||||
@ApiOperation("统计数据按部门显示趋势")
|
@ApiOperation("统计数据按部门显示趋势")
|
||||||
public Result queryGroupByDeptInRange(String query, String start, String end, String step){
|
public Result queryGroupByDeptInRange(String query, String start, String end, String step) {
|
||||||
String url = gatewayDomain + "/juapi/metrics/api/v1/query_range?query={query}" +
|
String url = gatewayDomain + "/juapi/metrics/api/v1/query_range?query={query}" +
|
||||||
"&start=" + start +
|
"&start=" + start +
|
||||||
"&end=" + end +
|
"&end=" + end +
|
||||||
|
@ -296,34 +291,32 @@ public class MonitorController {
|
||||||
ResponseEntity<HashMap> entity = restTemplate.getForEntity(url, HashMap.class, query);
|
ResponseEntity<HashMap> entity = restTemplate.getForEntity(url, HashMap.class, query);
|
||||||
HashMap body = entity.getBody();
|
HashMap body = entity.getBody();
|
||||||
HashMap data = (HashMap) body.get("data");
|
HashMap data = (HashMap) body.get("data");
|
||||||
if (data != null){
|
if (data != null) {
|
||||||
List<HashMap> result = (List) data.get("result");
|
List<HashMap> result = (List) data.get("result");
|
||||||
ArrayList<HashMap> results = new ArrayList<>(result.size());
|
ArrayList<HashMap> results = new ArrayList<>(result.size());
|
||||||
for (HashMap hashMap : result) {
|
for (HashMap hashMap : result) {
|
||||||
Map metric = (Map) hashMap.get("metric");
|
Map metric = (Map) hashMap.get("metric");
|
||||||
if (metric != null && metric.get("deptInfo") != null){
|
if (metric != null && metric.get("deptInfo") != null) {
|
||||||
try{
|
try {
|
||||||
Long filterId = Long.valueOf((String) metric.get("deptInfo"));
|
Long filterId = Long.valueOf((String) metric.get("deptInfo"));
|
||||||
SysDeptEntity sysDeptEntity = sysDeptDao.selectById(filterId);
|
SysDeptEntity sysDeptEntity = sysDeptDao.selectById(filterId);
|
||||||
if (sysDeptEntity != null && StringUtils.isNotBlank(sysDeptEntity.getName())){
|
if (sysDeptEntity != null && StringUtils.isNotBlank(sysDeptEntity.getName())) {
|
||||||
metric.put("name", sysDeptEntity.getName());
|
metric.put("name", sysDeptEntity.getName());
|
||||||
results.add(hashMap);
|
results.add(hashMap);
|
||||||
}
|
}
|
||||||
}catch (Exception e){
|
} catch (Exception e) {
|
||||||
log.warn("数据异常忽略", e);
|
log.warn("数据异常忽略:{}", e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return Result.success(results);
|
return Result.success(results);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Result.success(Collections.emptyList());
|
return Result.success(Collections.emptyList());
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/gateway-monitor/queryGroupCount")
|
@GetMapping("/gateway-monitor/queryGroupCount")
|
||||||
@ApiOperation("查询总api数量")
|
@ApiOperation("查询总api数量")
|
||||||
public Result queryGroupCount(){
|
public Result queryGroupCount() {
|
||||||
LambdaQueryWrapper<ResourceEntity> queryWrapper = new QueryWrapper<ResourceEntity>().lambda();
|
LambdaQueryWrapper<ResourceEntity> queryWrapper = new QueryWrapper<ResourceEntity>().lambda();
|
||||||
queryWrapper.isNotNull(ResourceEntity::getGroupId).eq(ResourceEntity::getDelFlag, 0);
|
queryWrapper.isNotNull(ResourceEntity::getGroupId).eq(ResourceEntity::getDelFlag, 0);
|
||||||
Integer selectCount = resourceDao.selectCount(queryWrapper);
|
Integer selectCount = resourceDao.selectCount(queryWrapper);
|
||||||
|
@ -332,23 +325,23 @@ public class MonitorController {
|
||||||
|
|
||||||
@GetMapping("/gateway-monitor/getCallCount")
|
@GetMapping("/gateway-monitor/getCallCount")
|
||||||
@ApiOperation("查询总api调用总量")
|
@ApiOperation("查询总api调用总量")
|
||||||
public Result getCallCount(){
|
public Result getCallCount() {
|
||||||
Long callCount = monitorServiceV2.getCallCount();
|
Long callCount = monitorServiceV2.getCallCount();
|
||||||
return Result.success(callCount);
|
return Result.success(callCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/gateway-monitor/test/get")
|
@GetMapping("/gateway-monitor/test/get")
|
||||||
public Result testGet(){
|
public Result testGet() {
|
||||||
return Result.success(null);
|
return Result.success(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/gateway-monitor/test/404")
|
@GetMapping("/gateway-monitor/test/404")
|
||||||
public void test404(HttpServletResponse response){
|
public void test404(HttpServletResponse response) {
|
||||||
response.setStatus(404);
|
response.setStatus(404);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/gateway-monitor/test/500")
|
@GetMapping("/gateway-monitor/test/500")
|
||||||
public void test500(HttpServletResponse response){
|
public void test500(HttpServletResponse response) {
|
||||||
response.setStatus(500);
|
response.setStatus(500);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,8 @@
|
||||||
package io.renren.modules.processForm.listener.v3;
|
package io.renren.modules.processForm.listener.v3;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import com.google.gson.Gson;
|
|
||||||
import com.google.gson.GsonBuilder;
|
|
||||||
import com.google.gson.JsonDeserializer;
|
|
||||||
import com.google.gson.JsonElement;
|
|
||||||
import io.renren.common.annotation.ActivitiNoticeOperation;
|
import io.renren.common.annotation.ActivitiNoticeOperation;
|
||||||
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;
|
||||||
|
@ -75,34 +71,41 @@ public class ApplyDistrictListener implements TaskListener, ExecutionListener, A
|
||||||
private void create(DelegateTask delegateTask) {
|
private void create(DelegateTask delegateTask) {
|
||||||
String assignee;
|
String assignee;
|
||||||
Map<String, Object> kv = delegateTask.getVariables();
|
Map<String, Object> kv = delegateTask.getVariables();
|
||||||
GsonBuilder builder = new GsonBuilder();
|
if (kv.containsKey("userId")) {
|
||||||
builder.registerTypeAdapter(Date.class, (JsonDeserializer<Date>) (json, typeOfT, context) -> new Date(json.getAsJsonPrimitive().getAsLong()));
|
Long applyUserId = Long.valueOf(kv.get("userId").toString());
|
||||||
|
SysDeptDTO deptDTO = sysDeptService.get(sysUserService.get(applyUserId).getDeptId());
|
||||||
|
|
||||||
Gson gson = builder.create();
|
String userId = null;
|
||||||
JsonElement jsonElement = gson.toJsonTree(kv);
|
if (deptDTO.getDistrict() != null) {
|
||||||
TAbilityApplicationDTO abilityApplicationDTO = gson.fromJson(jsonElement, TAbilityApplicationDTO.class);
|
SysRegionEntity regionEntity = sysRegionService.getByLevel(deptDTO.getDistrict(), RegionLevelEnum.THREE);
|
||||||
|
logger.error("regionEntityId:" + regionEntity.getId());
|
||||||
|
SysRoleDTO roleDTO = sysRoleService.getByName(roleName);
|
||||||
|
logger.error("roleDTOId:" + roleDTO.getId());
|
||||||
|
|
||||||
SysDeptDTO deptDTO = sysDeptService.get(sysUserService.get(Long.parseLong(abilityApplicationDTO.getUserId())).getDeptId());
|
List<SysUserEntity> userList = sysUserDao.getList(ImmutableMap.of("role_id", roleDTO.getId()));
|
||||||
|
Optional<SysUserEntity> userEntityOptional = userList.stream()
|
||||||
SysRegionEntity regionEntity = sysRegionService.getByLevel(deptDTO.getDistrict(), RegionLevelEnum.THREE);
|
.filter(user -> Objects.equals(regionEntity.getId(), sysRegionService.getByLevel(sysDeptService.get(user.getDeptId()).getDistrict(), RegionLevelEnum.THREE).getId())).findFirst();
|
||||||
logger.error("regionEntityId:" + regionEntity.getId());
|
if (userEntityOptional.isPresent()) {
|
||||||
SysRoleDTO roleDTO = sysRoleService.getByName(roleName);
|
userId = userEntityOptional.get().getId().toString();
|
||||||
logger.error("roleDTOId:" + roleDTO.getId());
|
}
|
||||||
|
}
|
||||||
List<SysUserEntity> userList = sysUserDao.getList(ImmutableMap.of("role_id", roleDTO.getId()));
|
if (userId != null) {
|
||||||
Optional<SysUserEntity> userEntityOptional = userList.stream()
|
logger.error("审批人id:" + userId);
|
||||||
.filter(user -> Objects.equals(regionEntity.getId(), sysRegionService.getByLevel(sysDeptService.get(user.getDeptId()).getDistrict(), RegionLevelEnum.THREE).getId())).findFirst();
|
taskService.setAssignee(delegateTask.getId(), userId);
|
||||||
|
assignee = userId;
|
||||||
if (userEntityOptional.isPresent()) {
|
} else {
|
||||||
logger.error("审批人id:" + userEntityOptional.get().getId());
|
logger.error("未查到 {} 对应 " + roleName, deptDTO.getName());
|
||||||
taskService.setAssignee(delegateTask.getId(), userEntityOptional.get().getId().toString());
|
taskService.setAssignee(delegateTask.getId(), defaultAssigneeRoleId);
|
||||||
assignee = userEntityOptional.get().getId().toString();
|
assignee = defaultAssigneeRoleId;
|
||||||
|
}
|
||||||
|
logger.error("分配的用户id为:{}", assignee);
|
||||||
} else {
|
} else {
|
||||||
logger.error("未查到 {} 对应 " + roleName, deptDTO.getName());
|
try {
|
||||||
taskService.setAssignee(delegateTask.getId(), defaultAssigneeRoleId);
|
logger.error("流程参数异常" + JSON.toJSONString(kv));
|
||||||
assignee = defaultAssigneeRoleId;
|
} catch (Exception exception) {
|
||||||
|
logger.error("流程参数异常", exception);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
logger.error("分配的用户id为:{}", assignee);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,12 +1,8 @@
|
||||||
package io.renren.modules.processForm.listener.v3;
|
package io.renren.modules.processForm.listener.v3;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import com.google.gson.Gson;
|
|
||||||
import com.google.gson.GsonBuilder;
|
|
||||||
import com.google.gson.JsonDeserializer;
|
|
||||||
import com.google.gson.JsonElement;
|
|
||||||
import io.renren.common.annotation.ActivitiNoticeOperation;
|
import io.renren.common.annotation.ActivitiNoticeOperation;
|
||||||
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;
|
||||||
|
@ -75,34 +71,42 @@ public class CityListener implements TaskListener, ExecutionListener, ActivitiEv
|
||||||
private void create(DelegateTask delegateTask) {
|
private void create(DelegateTask delegateTask) {
|
||||||
String assignee;
|
String assignee;
|
||||||
Map<String, Object> kv = delegateTask.getVariables();
|
Map<String, Object> kv = delegateTask.getVariables();
|
||||||
GsonBuilder builder = new GsonBuilder();
|
|
||||||
builder.registerTypeAdapter(Date.class, (JsonDeserializer<Date>) (json, typeOfT, context) -> new Date(json.getAsJsonPrimitive().getAsLong()));
|
|
||||||
|
|
||||||
Gson gson = builder.create();
|
if (kv.containsKey("userId")) {
|
||||||
JsonElement jsonElement = gson.toJsonTree(kv);
|
Long applyUserId = Long.valueOf(kv.get("userId").toString());
|
||||||
TAbilityApplicationDTO abilityApplicationDTO = gson.fromJson(jsonElement, TAbilityApplicationDTO.class);
|
SysDeptDTO deptDTO = sysDeptService.get(sysUserService.get(applyUserId).getDeptId());
|
||||||
|
|
||||||
SysDeptDTO deptDTO = sysDeptService.get(sysUserService.get(Long.parseLong(abilityApplicationDTO.getUserId())).getDeptId());
|
String userId = null;
|
||||||
|
if (deptDTO.getDistrict() != null) {
|
||||||
|
SysRegionEntity regionEntity = sysRegionService.getByLevel(deptDTO.getDistrict(), RegionLevelEnum.TWO);
|
||||||
|
logger.error("regionEntityId:" + regionEntity.getId());
|
||||||
|
SysRoleDTO roleDTO = sysRoleService.getByName(roleName);
|
||||||
|
logger.error("roleDTOId:" + roleDTO.getId());
|
||||||
|
|
||||||
SysRegionEntity regionEntity = sysRegionService.getByLevel(deptDTO.getDistrict(), RegionLevelEnum.TWO);
|
List<SysUserEntity> userList = sysUserDao.getList(ImmutableMap.of("role_id", roleDTO.getId()));
|
||||||
logger.error("regionEntityId:" + regionEntity.getId());
|
Optional<SysUserEntity> userEntityOptional = userList.stream()
|
||||||
SysRoleDTO roleDTO = sysRoleService.getByName(roleName);
|
.filter(user -> Objects.equals(regionEntity.getId(), sysRegionService.getByLevel(sysDeptService.get(user.getDeptId()).getDistrict(), RegionLevelEnum.TWO).getId())).findFirst();
|
||||||
logger.error("roleDTOId:" + roleDTO.getId());
|
if (userEntityOptional.isPresent()) {
|
||||||
|
userId = userEntityOptional.get().getId().toString();
|
||||||
List<SysUserEntity> userList = sysUserDao.getList(ImmutableMap.of("role_id", roleDTO.getId()));
|
}
|
||||||
Optional<SysUserEntity> userEntityOptional = userList.stream()
|
}
|
||||||
.filter(user -> Objects.equals(regionEntity.getId(), sysRegionService.getByLevel(sysDeptService.get(user.getDeptId()).getDistrict(), RegionLevelEnum.TWO).getId())).findFirst();
|
if (userId != null) {
|
||||||
|
logger.error("审批人id:" + userId);
|
||||||
if (userEntityOptional.isPresent()) {
|
taskService.setAssignee(delegateTask.getId(), userId);
|
||||||
logger.error("审批人id:" + userEntityOptional.get().getId());
|
assignee = userId;
|
||||||
taskService.setAssignee(delegateTask.getId(), userEntityOptional.get().getId().toString());
|
} else {
|
||||||
assignee = userEntityOptional.get().getId().toString();
|
logger.error("未查到 {} 对应 " + roleName, deptDTO.getName());
|
||||||
|
taskService.setAssignee(delegateTask.getId(), defaultAssigneeRoleId);
|
||||||
|
assignee = defaultAssigneeRoleId;
|
||||||
|
}
|
||||||
|
logger.error("分配的用户id为:{}", assignee);
|
||||||
} else {
|
} else {
|
||||||
logger.error("未查到 {} 对应 " + roleName, deptDTO.getName());
|
try {
|
||||||
taskService.setAssignee(delegateTask.getId(), defaultAssigneeRoleId);
|
logger.error("流程参数异常" + JSON.toJSONString(kv));
|
||||||
assignee = defaultAssigneeRoleId;
|
} catch (Exception exception) {
|
||||||
|
logger.error("流程参数异常", exception);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
logger.error("分配的用户id为:{}", assignee);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,12 +1,8 @@
|
||||||
package io.renren.modules.processForm.listener.v3;
|
package io.renren.modules.processForm.listener.v3;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import com.google.gson.Gson;
|
|
||||||
import com.google.gson.GsonBuilder;
|
|
||||||
import com.google.gson.JsonDeserializer;
|
|
||||||
import com.google.gson.JsonElement;
|
|
||||||
import io.renren.common.annotation.ActivitiNoticeOperation;
|
import io.renren.common.annotation.ActivitiNoticeOperation;
|
||||||
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;
|
||||||
|
@ -72,34 +68,41 @@ public class OwnerDistrictListener implements TaskListener, ExecutionListener, A
|
||||||
private void create(DelegateTask delegateTask) {
|
private void create(DelegateTask delegateTask) {
|
||||||
String assignee;
|
String assignee;
|
||||||
Map<String, Object> kv = delegateTask.getVariables();
|
Map<String, Object> kv = delegateTask.getVariables();
|
||||||
GsonBuilder builder = new GsonBuilder();
|
|
||||||
builder.registerTypeAdapter(Date.class, (JsonDeserializer<Date>) (json, typeOfT, context) -> new Date(json.getAsJsonPrimitive().getAsLong()));
|
|
||||||
|
|
||||||
Gson gson = builder.create();
|
if (kv.containsKey("deptId")) { // 存在部门id
|
||||||
JsonElement jsonElement = gson.toJsonTree(kv);
|
Long deptId = Long.valueOf(kv.get("deptId").toString());
|
||||||
TAbilityApplicationDTO abilityApplicationDTO = gson.fromJson(jsonElement, TAbilityApplicationDTO.class);
|
SysDeptDTO deptDTO = sysDeptService.get(deptId);
|
||||||
|
|
||||||
SysDeptDTO deptDTO = abilityApplicationDTO.getResourceOwnerDept();
|
String userId = null;
|
||||||
|
if (deptDTO.getDistrict() != null) {
|
||||||
SysRegionEntity regionEntity = sysRegionService.getByLevel(deptDTO.getDistrict(), RegionLevelEnum.THREE);
|
SysRegionEntity regionEntity = sysRegionService.getByLevel(deptDTO.getDistrict(), RegionLevelEnum.THREE);
|
||||||
logger.error("regionEntityId:" + regionEntity.getId());
|
logger.error("regionEntityId:" + regionEntity.getId());
|
||||||
SysRoleDTO roleDTO = sysRoleService.getByName(roleName);
|
SysRoleDTO roleDTO = sysRoleService.getByName(roleName);
|
||||||
logger.error("roleDTOId:" + roleDTO.getId());
|
logger.error("roleDTOId:" + roleDTO.getId());
|
||||||
|
List<SysUserEntity> userList = sysUserDao.getList(ImmutableMap.of("role_id", roleDTO.getId()));
|
||||||
List<SysUserEntity> userList = sysUserDao.getList(ImmutableMap.of("role_id", roleDTO.getId()));
|
Optional<SysUserEntity> userEntityOptional = userList.stream()
|
||||||
Optional<SysUserEntity> userEntityOptional = userList.stream()
|
.filter(user -> Objects.equals(regionEntity.getId(), sysRegionService.getByLevel(sysDeptService.get(user.getDeptId()).getDistrict(), RegionLevelEnum.THREE).getId())).findFirst();
|
||||||
.filter(user -> Objects.equals(regionEntity.getId(), sysRegionService.getByLevel(sysDeptService.get(user.getDeptId()).getDistrict(), RegionLevelEnum.THREE).getId())).findFirst();
|
if (userEntityOptional.isPresent()) {
|
||||||
|
userId = userEntityOptional.get().getId().toString();
|
||||||
if (userEntityOptional.isPresent()) {
|
}
|
||||||
logger.error("审批人id:" + userEntityOptional.get().getId());
|
}
|
||||||
taskService.setAssignee(delegateTask.getId(), userEntityOptional.get().getId().toString());
|
if (userId != null) {
|
||||||
assignee = userEntityOptional.get().getId().toString();
|
logger.error("审批人id:" + userId);
|
||||||
|
taskService.setAssignee(delegateTask.getId(), userId);
|
||||||
|
assignee = userId;
|
||||||
|
} else {
|
||||||
|
logger.error("未查到 {} 对应 " + roleName, deptDTO.getName());
|
||||||
|
taskService.setAssignee(delegateTask.getId(), defaultAssigneeRoleId);
|
||||||
|
assignee = defaultAssigneeRoleId;
|
||||||
|
}
|
||||||
|
logger.error("分配的用户id为:{}", assignee);
|
||||||
} else {
|
} else {
|
||||||
logger.error("未查到 {} 对应 " + roleName, deptDTO.getName());
|
try {
|
||||||
taskService.setAssignee(delegateTask.getId(), defaultAssigneeRoleId);
|
logger.error("流程参数异常" + JSON.toJSONString(kv));
|
||||||
assignee = defaultAssigneeRoleId;
|
} catch (Exception exception) {
|
||||||
|
logger.error("流程参数异常", exception);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
logger.error("分配的用户id为:{}", assignee);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1224,64 +1224,64 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
||||||
if (list.isEmpty() || list.size() < pageSize) {
|
if (list.isEmpty() || list.size() < pageSize) {
|
||||||
end.set(false);
|
end.set(false);
|
||||||
}
|
}
|
||||||
customThreadPool.submit(() -> {
|
customThreadPool.submit(() -> list.parallelStream().filter(resource -> {
|
||||||
list.parallelStream().filter(resource -> {
|
Map<String, Object> map = (Map<String, Object>) resource;
|
||||||
Map<String, Object> map = (Map<String, Object>) resource;
|
return !knowledgeUUID.contains(map.get("uuid").toString());
|
||||||
return !knowledgeUUID.contains(map.get("uuid").toString());
|
}).forEach(resource -> {
|
||||||
}).forEach(resource -> {
|
Map<String, Object> map = (Map<String, Object>) resource;
|
||||||
Map<String, Object> map = (Map<String, Object>) resource;
|
ResourceDTO dto = new ResourceDTO();
|
||||||
ResourceDTO dto = new ResourceDTO();
|
dto.setName(map.get("title").toString());
|
||||||
dto.setName(map.get("title").toString());
|
dto.setType("知识库");
|
||||||
dto.setType("知识库");
|
dto.setVisits(0L);
|
||||||
dto.setVisits(0L);
|
//所属部门暂时设为青岛市政府办公厅
|
||||||
//所属部门暂时设为青岛市政府办公厅
|
dto.setDeptId(1517116100113850370L);
|
||||||
dto.setDeptId(1517116100113850370L);
|
dto.setNote1(map.get("uuid").toString());
|
||||||
dto.setNote1(map.get("uuid").toString());
|
dto.setDelFlag(0);
|
||||||
dto.setDelFlag(0);
|
ArrayList<AttrEntity> infoList = new ArrayList<>();
|
||||||
ArrayList<AttrEntity> infoList = new ArrayList<>();
|
map.forEach((key, value) -> {
|
||||||
map.forEach((key, value) -> {
|
switch (key) {
|
||||||
switch (key) {
|
case "title":
|
||||||
case "title":
|
dto.setName(value.toString());
|
||||||
dto.setName(value.toString());
|
break;
|
||||||
break;
|
case "url":
|
||||||
case "url":
|
dto.setLink(value.toString());
|
||||||
dto.setLink(value.toString());
|
break;
|
||||||
break;
|
case "createtime":
|
||||||
case "createtime":
|
Date createDate = new Date(Long.parseLong(value.toString()));
|
||||||
Date createDate = new Date(Long.parseLong(value.toString()));
|
dto.setCreateDate(createDate);
|
||||||
dto.setCreateDate(createDate);
|
break;
|
||||||
break;
|
default:
|
||||||
default:
|
AttrEntity attrEntity = new AttrEntity();
|
||||||
AttrEntity attrEntity = new AttrEntity();
|
attrEntity.setDelFlag(0);
|
||||||
attrEntity.setDelFlag(0);
|
attrEntity.setAttrType(key);
|
||||||
attrEntity.setAttrType(key);
|
attrEntity.setAttrValue(value.toString());
|
||||||
attrEntity.setAttrValue(value.toString());
|
infoList.add(attrEntity);
|
||||||
infoList.add(attrEntity);
|
break;
|
||||||
break;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
AttrEntity attrEntity = new AttrEntity();
|
|
||||||
attrEntity.setDelFlag(0);
|
|
||||||
attrEntity.setAttrType("文件类型");
|
|
||||||
if ("f49561afc7204f008c4bb3cd821eb6ba".equals(index)) {
|
|
||||||
attrEntity.setAttrValue("政府公报");
|
|
||||||
} else {
|
|
||||||
attrEntity.setAttrValue("政策解读");
|
|
||||||
}
|
}
|
||||||
infoList.add(attrEntity);
|
|
||||||
dto.setInfoList(infoList);
|
|
||||||
this.insertWithAttrs(dto);
|
|
||||||
logger.info("插入:{}", dto.getName());
|
|
||||||
});
|
});
|
||||||
}).join();
|
AttrEntity attrEntity = new AttrEntity();
|
||||||
|
attrEntity.setDelFlag(0);
|
||||||
|
attrEntity.setAttrType("文件类型");
|
||||||
|
if ("f49561afc7204f008c4bb3cd821eb6ba".equals(index)) {
|
||||||
|
attrEntity.setAttrValue("政府公报");
|
||||||
|
} else {
|
||||||
|
attrEntity.setAttrValue("政策解读");
|
||||||
|
}
|
||||||
|
infoList.add(attrEntity);
|
||||||
|
dto.setInfoList(infoList);
|
||||||
|
this.insertWithAttrs(dto);
|
||||||
|
logger.info("插入:{}", dto.getName());
|
||||||
|
})).join();
|
||||||
customThreadPool.shutdown();
|
customThreadPool.shutdown();
|
||||||
}, executor));
|
}, executor));
|
||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Thread.sleep(100L); // 防止任务运行过快,无法跳出循环
|
Thread.sleep(100); // 防止任务运行过快,无法跳出循环
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
logger.info("知识库同步异常", e);
|
logger.info("知识库同步异常", e);
|
||||||
// throw new RuntimeException(e);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} while (end.get() || pageIndex.get() < maxPage.get());
|
} while (end.get() || pageIndex.get() < maxPage.get());
|
||||||
return task;
|
return task;
|
||||||
}).collect(Collectors.toList());
|
}).collect(Collectors.toList());
|
||||||
|
@ -1867,6 +1867,10 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
||||||
if (abilityApplicationDTO != null && org.apache.commons.lang3.StringUtils.isNotEmpty(abilityApplicationDTO.getSystem()) && org.apache.commons.lang3.StringUtils.isEmpty(his.getName())) {
|
if (abilityApplicationDTO != null && org.apache.commons.lang3.StringUtils.isNotEmpty(abilityApplicationDTO.getSystem()) && org.apache.commons.lang3.StringUtils.isEmpty(his.getName())) {
|
||||||
resourceIds.add(Long.parseLong(abilityApplicationDTO.getResourceId()));
|
resourceIds.add(Long.parseLong(abilityApplicationDTO.getResourceId()));
|
||||||
} else {
|
} else {
|
||||||
|
// TODO 有问题
|
||||||
|
if (his.getBusinessKey().startsWith("[") && his.getBusinessKey().endsWith("]")) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
TAbilityApplicationDTO abilityApplicationDTO1 = tAbilityApplicationService.getByBusinessKey(his.getBusinessKey());
|
TAbilityApplicationDTO abilityApplicationDTO1 = tAbilityApplicationService.getByBusinessKey(his.getBusinessKey());
|
||||||
if (abilityApplicationDTO1 != null) {
|
if (abilityApplicationDTO1 != null) {
|
||||||
resourceIds.add(Long.parseLong(abilityApplicationDTO1.getResourceId()));
|
resourceIds.add(Long.parseLong(abilityApplicationDTO1.getResourceId()));
|
||||||
|
|
|
@ -381,7 +381,8 @@ public class SysUserServiceImpl extends BaseServiceImpl<SysUserDao, SysUserEntit
|
||||||
if (m.get(("username")) != null) {
|
if (m.get(("username")) != null) {
|
||||||
String userName = m.get("username").toString();
|
String userName = m.get("username").toString();
|
||||||
SysUserEntity user = sysUserDao.getUserByName(userName);
|
SysUserEntity user = sysUserDao.getUserByName(userName);
|
||||||
if (user == null) {//用户表中没有该用户,插入
|
SysUserEntity userById = sysUserDao.getById(Long.valueOf(m.get("id").toString()));
|
||||||
|
if (user == null && userById == null) {//用户表中没有该用户,插入
|
||||||
SysUserEntity newUser = new SysUserEntity();
|
SysUserEntity newUser = new SysUserEntity();
|
||||||
newUser.setUsername(userName);
|
newUser.setUsername(userName);
|
||||||
newUser.setSuperAdmin(0);
|
newUser.setSuperAdmin(0);
|
||||||
|
@ -390,6 +391,7 @@ public class SysUserServiceImpl extends BaseServiceImpl<SysUserDao, SysUserEntit
|
||||||
newUser.setRealName(m.get("real_name") == null ? "" : m.get("real_name").toString());
|
newUser.setRealName(m.get("real_name") == null ? "" : m.get("real_name").toString());
|
||||||
newUser.setEmail(m.get("email") == null ? "" : m.get("email").toString());
|
newUser.setEmail(m.get("email") == null ? "" : m.get("email").toString());
|
||||||
newUser.setMobile(m.get("mobile") == null ? "" : m.get("mobile").toString());
|
newUser.setMobile(m.get("mobile") == null ? "" : m.get("mobile").toString());
|
||||||
|
newUser.setYwMobile(m.get("ywMobile") == null ? "" : m.get("ywMobile").toString());
|
||||||
newUser.setStatus(1);//账号状态 1正常 0停用
|
newUser.setStatus(1);//账号状态 1正常 0停用
|
||||||
//给dept_id赋值
|
//给dept_id赋值
|
||||||
String deptNames = m.get("distinguishedName") == null ? "" : m.get("distinguishedName").toString();
|
String deptNames = m.get("distinguishedName") == null ? "" : m.get("distinguishedName").toString();
|
||||||
|
|
|
@ -37,7 +37,9 @@ server:
|
||||||
session:
|
session:
|
||||||
cookie:
|
cookie:
|
||||||
http-only: true
|
http-only: true
|
||||||
|
compression:
|
||||||
|
enabled: true
|
||||||
|
mime-types: application/json
|
||||||
spring:
|
spring:
|
||||||
# 环境 dev|test|prod|show
|
# 环境 dev|test|prod|show
|
||||||
profiles:
|
profiles:
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1 @@
|
||||||
|
alter table sys_user add column yw_mobile varchar(100);
|
|
@ -116,7 +116,7 @@
|
||||||
sd.type AS "deptType",
|
sd.type AS "deptType",
|
||||||
sd.sort AS "deptSort",
|
sd.sort AS "deptSort",
|
||||||
sr.sort AS "regionSort",
|
sr.sort AS "regionSort",
|
||||||
IFNULL(taa2.approve_status, '未申请') AS "applyState",
|
IF( IFNULL(taa2.approve_status, 0) < 1, '未申请', '已申请' ) AS "applyState",
|
||||||
IFNULL(trs.score, 0 ) AS "score",
|
IFNULL(trs.score, 0 ) AS "score",
|
||||||
IFNULL(taa.applyCount, 0 ) AS "applyCount",
|
IFNULL(taa.applyCount, 0 ) AS "applyCount",
|
||||||
IFNULL(trc.collectCount, 0) AS "collectCount",
|
IFNULL(trc.collectCount, 0) AS "collectCount",
|
||||||
|
@ -412,7 +412,7 @@
|
||||||
sd.sort AS "deptSort",
|
sd.sort AS "deptSort",
|
||||||
sr.sort AS "regionSort",
|
sr.sort AS "regionSort",
|
||||||
IFNULL(trc2.isCollect, 'false') AS "isCollect",
|
IFNULL(trc2.isCollect, 'false') AS "isCollect",
|
||||||
IFNULL(taa2.approve_status, '未申请') AS "applyState",
|
IF( IFNULL(taa2.approve_status, 0) < 1, '未申请', '已申请' ) AS "applyState",
|
||||||
IF ( IFNULL( trcar.car, 0 ) > 0, TRUE, FALSE ) AS "isInShoppingCart",
|
IF ( IFNULL( trcar.car, 0 ) > 0, TRUE, FALSE ) AS "isInShoppingCart",
|
||||||
IF( IFNULL(taa3.approve_status, 0) < 1, '未通过', '通过' ) AS "approveStatus"
|
IF( IFNULL(taa3.approve_status, 0) < 1, '未通过', '通过' ) AS "approveStatus"
|
||||||
FROM
|
FROM
|
||||||
|
|
|
@ -100,14 +100,18 @@ public class JhlDAPTool {
|
||||||
user.put("email",next.get().toString());
|
user.put("email",next.get().toString());
|
||||||
}else if("telephoneNumber".equals(next.getID())){
|
}else if("telephoneNumber".equals(next.getID())){
|
||||||
user.put("mobile",next.get().toString());
|
user.put("mobile",next.get().toString());
|
||||||
|
}else if("mobile".equals(next.getID())){
|
||||||
|
user.put("ywMobile",next.get().toString());
|
||||||
}else if("distinguishedName".equals(next.getID())){
|
}else if("distinguishedName".equals(next.getID())){
|
||||||
user.put("distinguishedName",next.get().toString());
|
user.put("distinguishedName",next.get().toString());
|
||||||
}else if("objectGUID".equals(next.getID())){
|
}else if("objectGUID".equals(next.getID())){
|
||||||
String guidStr = next.getID().toString();
|
String guidStr = next.get().toString();
|
||||||
user.put("id",SingleID.getSingleID(guidStr));
|
//Object o = next.get(0);
|
||||||
String guid = guidStr.substring(1,guidStr.length()-1);
|
|
||||||
user.put("guid",guid);
|
|
||||||
|
|
||||||
|
|
||||||
|
String guid = guidObject2String((byte[]) next.get(0));
|
||||||
|
user.put("id",SingleID.getSingleID(guid));
|
||||||
|
user.put("guid",guid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
lm.add(user);
|
lm.add(user);
|
||||||
|
@ -125,6 +129,72 @@ public class JhlDAPTool {
|
||||||
return lm;
|
return lm;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String guidObject2String(byte[] b){
|
||||||
|
StringBuilder builder = new StringBuilder();
|
||||||
|
for (int i = 3; i >=0; i--)
|
||||||
|
{
|
||||||
|
String hex = Integer.toHexString(b[i] & 0xFF);
|
||||||
|
if (hex.length() == 1)
|
||||||
|
{
|
||||||
|
hex = '0' + hex;
|
||||||
|
}
|
||||||
|
builder.append(hex);
|
||||||
|
}
|
||||||
|
builder.append('-');
|
||||||
|
for (int i = 5; i >=4; i--)
|
||||||
|
{
|
||||||
|
String hex = Integer.toHexString(b[i] & 0xFF);
|
||||||
|
if (hex.length() == 1)
|
||||||
|
{
|
||||||
|
hex = '0' + hex;
|
||||||
|
}
|
||||||
|
builder.append(hex);
|
||||||
|
}
|
||||||
|
builder.append('-');
|
||||||
|
for (int i = 7; i >=6; i--)
|
||||||
|
{
|
||||||
|
String hex = Integer.toHexString(b[i] & 0xFF);
|
||||||
|
if (hex.length() == 1)
|
||||||
|
{
|
||||||
|
hex = '0' + hex;
|
||||||
|
}
|
||||||
|
builder.append(hex);
|
||||||
|
}
|
||||||
|
builder.append('-');
|
||||||
|
|
||||||
|
// for (int i = 8; i <9; i++)
|
||||||
|
// {
|
||||||
|
// String hex = Integer.toHexString(b[i] & 0xFF);
|
||||||
|
// if (hex.length() == 1)
|
||||||
|
// {
|
||||||
|
// hex = '0' + hex;
|
||||||
|
// }
|
||||||
|
// builder.append(hex);
|
||||||
|
// }
|
||||||
|
// builder.append('-');
|
||||||
|
for (int i = 8; i <10; i++)
|
||||||
|
{
|
||||||
|
String hex = Integer.toHexString(b[i] & 0xFF);
|
||||||
|
if (hex.length() == 1)
|
||||||
|
{
|
||||||
|
hex = '0' + hex;
|
||||||
|
}
|
||||||
|
builder.append(hex);
|
||||||
|
}
|
||||||
|
builder.append('-');
|
||||||
|
for (int i = 10; i <16; i++)
|
||||||
|
{
|
||||||
|
String hex = Integer.toHexString(b[i] & 0xFF);
|
||||||
|
if (hex.length() == 1)
|
||||||
|
{
|
||||||
|
hex = '0' + hex;
|
||||||
|
}
|
||||||
|
builder.append(hex);
|
||||||
|
}
|
||||||
|
|
||||||
|
return builder.toString().toUpperCase();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取管理部门信息
|
* 获取管理部门信息
|
||||||
* @param ctx
|
* @param ctx
|
||||||
|
|
Loading…
Reference in New Issue