Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
20d8ceb860
|
@ -0,0 +1,137 @@
|
||||||
|
package io.renren.common.controller;
|
||||||
|
|
||||||
|
|
||||||
|
import io.renren.common.utils.Result;
|
||||||
|
import io.renren.modules.processForm.service.TAbilityApplicationService;
|
||||||
|
import io.renren.modules.resource.service.ResourceService;
|
||||||
|
import io.renren.modules.sys.service.SysUserService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 统计
|
||||||
|
*/
|
||||||
|
@Api(tags = "全局统计中心")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/census/center")
|
||||||
|
public class CensusController {
|
||||||
|
|
||||||
|
private static Logger logger = LoggerFactory.getLogger(CensusController.class);
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ResourceService resourceService;
|
||||||
|
@Autowired
|
||||||
|
private SysUserService sysUserService;
|
||||||
|
@Autowired
|
||||||
|
private TAbilityApplicationService tAbilityApplicationService;
|
||||||
|
|
||||||
|
@Value("${census.type}")
|
||||||
|
private String[] censusTypes; // 大数据局名称
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取各类资源数目
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping(value = "/resource_amount")
|
||||||
|
@ApiOperation("各类资源数目")
|
||||||
|
public Result<List<Map<String, Object>>> resourceAmount() {
|
||||||
|
List<Map<String, Object>> dbAmount = resourceService.getAmountGroupByType();
|
||||||
|
List<String> temp = dbAmount.stream().map(index -> index.get("type").toString()).collect(Collectors.toList());
|
||||||
|
Arrays.stream(censusTypes).filter(index -> !temp.contains(index)).forEach(index -> { // 数据库内不存在的资源类型
|
||||||
|
Map<String, Object> nullMap = new HashMap<String, Object>() {
|
||||||
|
{
|
||||||
|
put("amount", 0);
|
||||||
|
put("type", index);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
dbAmount.add(nullMap);
|
||||||
|
});
|
||||||
|
Long sum = dbAmount.stream().mapToLong(index -> Long.valueOf(index.get("amount").toString())).sum();
|
||||||
|
Map<String, Object> sumMap = new HashMap<String, Object>() {
|
||||||
|
{
|
||||||
|
put("amount", sum);
|
||||||
|
put("type", "资源汇聚总量");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
dbAmount.add(sumMap);
|
||||||
|
return new Result<List<Map<String, Object>>>().ok(dbAmount);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping(value = "/whole_amount")
|
||||||
|
@ApiOperation("平台整体情况")
|
||||||
|
public Result<List<Map<String, Object>>> wholeAmount() {
|
||||||
|
List<Map<String, Object>> result = Collections.synchronizedList(new ArrayList<>());
|
||||||
|
|
||||||
|
CompletableFuture<Void> resourceAmount = CompletableFuture.supplyAsync(() -> { // 获取资源汇聚总量
|
||||||
|
List<Map<String, Object>> dbAmount = resourceService.getAmountGroupByType();
|
||||||
|
Long sum = dbAmount.stream().mapToLong(index -> Long.valueOf(index.get("amount").toString())).sum();
|
||||||
|
return sum;
|
||||||
|
}).thenAccept(sum -> {
|
||||||
|
result.add(new HashMap<String, Object>() {
|
||||||
|
{
|
||||||
|
put("amount", sum);
|
||||||
|
put("type", "资源汇聚总量");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
CompletableFuture<Void> userAmount = CompletableFuture.supplyAsync(() -> { // 获取平台用户总数
|
||||||
|
return sysUserService.countAllUser();
|
||||||
|
}).thenAccept(sum -> {
|
||||||
|
result.add(new HashMap<String, Object>() {
|
||||||
|
{
|
||||||
|
put("amount", sum);
|
||||||
|
put("type", "用户量");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
CompletableFuture<Void> applyAmount = CompletableFuture.supplyAsync(() -> { // 资源申请量
|
||||||
|
return tAbilityApplicationService.countApplyAll();
|
||||||
|
}).thenAccept(sum -> {
|
||||||
|
result.add(new HashMap<String, Object>() {
|
||||||
|
{
|
||||||
|
put("amount", sum);
|
||||||
|
put("type", "资源申请量");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
CompletableFuture<Void> deptAmount = CompletableFuture.supplyAsync(() -> { // 覆盖部门量
|
||||||
|
return resourceService.countAllDept();
|
||||||
|
}).thenAccept(sum -> {
|
||||||
|
result.add(new HashMap<String, Object>() {
|
||||||
|
{
|
||||||
|
put("amount", sum);
|
||||||
|
put("type", "覆盖部门量");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
CompletableFuture<Void> pvAmount = CompletableFuture.supplyAsync(() -> { // 平台访问量
|
||||||
|
return 0;
|
||||||
|
}).thenAccept(sum -> {
|
||||||
|
result.add(new HashMap<String, Object>() {
|
||||||
|
{
|
||||||
|
put("amount", sum);
|
||||||
|
put("type", "平台访问量");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
CompletableFuture<Void> all = CompletableFuture.allOf(resourceAmount, userAmount, applyAmount, deptAmount, pvAmount);
|
||||||
|
all.join();
|
||||||
|
return new Result<List<Map<String, Object>>>().ok(result);
|
||||||
|
}
|
||||||
|
}
|
|
@ -151,6 +151,7 @@ public class ResourceMountController {
|
||||||
});
|
});
|
||||||
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
|
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
|
||||||
resourceService.update(dto);
|
resourceService.update(dto);
|
||||||
|
logger.error(resourceDTO.get().toString());
|
||||||
});
|
});
|
||||||
|
|
||||||
logger.info("-------------------1.保存申请表单成功--------------------------");
|
logger.info("-------------------1.保存申请表单成功--------------------------");
|
||||||
|
@ -159,7 +160,7 @@ public class ResourceMountController {
|
||||||
processStartDTO.setBusinessKey(resourceId.toString());
|
processStartDTO.setBusinessKey(resourceId.toString());
|
||||||
processStartDTO.setProcessDefinitionKey(undercarriage_key); // 限定资源下架
|
processStartDTO.setProcessDefinitionKey(undercarriage_key); // 限定资源下架
|
||||||
ObjectMapper oMapper = new ObjectMapper();
|
ObjectMapper oMapper = new ObjectMapper();
|
||||||
Map<String, Object> variables = oMapper.convertValue(resourceDTO, Map.class);
|
Map<String, Object> variables = oMapper.convertValue(resourceDTO.get(), Map.class);
|
||||||
processStartDTO.setVariables(variables);
|
processStartDTO.setVariables(variables);
|
||||||
ProcessInstanceDTO dto = actRunningService.startOfBusinessKey(processStartDTO);
|
ProcessInstanceDTO dto = actRunningService.startOfBusinessKey(processStartDTO);
|
||||||
logger.info("-------------------2.启动流程成功--------------------------");
|
logger.info("-------------------2.启动流程成功--------------------------");
|
||||||
|
|
|
@ -48,6 +48,7 @@ public class IdentityInterceptor implements HandlerInterceptor {
|
||||||
String keeperUrl = yaweiSSOProperties.getKeeperUrl();
|
String keeperUrl = yaweiSSOProperties.getKeeperUrl();
|
||||||
keeperUrl = keeperUrl + "?" + yaweiSSOProperties.getSsoKey() + "="
|
keeperUrl = keeperUrl + "?" + yaweiSSOProperties.getSsoKey() + "="
|
||||||
+ URLEncoder.encode(requeststr, "UTF-8");
|
+ URLEncoder.encode(requeststr, "UTF-8");
|
||||||
|
response.addHeader("REDIRECT", keeperUrl);
|
||||||
response.sendRedirect(keeperUrl);
|
response.sendRedirect(keeperUrl);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@Component
|
@Component
|
||||||
@PropertySource("classpath:/yaweisso.properties")
|
@PropertySource("classpath:yaweisso.properties")
|
||||||
@ConfigurationProperties(prefix = "sso")
|
@ConfigurationProperties(prefix = "sso")
|
||||||
public class YaweiSSOProperties {
|
public class YaweiSSOProperties {
|
||||||
private String domain;
|
private String domain;
|
||||||
|
|
|
@ -63,5 +63,8 @@ public class ProcessInstanceDTO {
|
||||||
@ApiModelProperty(value = "当前任务")
|
@ApiModelProperty(value = "当前任务")
|
||||||
private List<TaskDTO> currentTaskList;
|
private List<TaskDTO> currentTaskList;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "资源情况")
|
||||||
|
private int resourceStatus;
|
||||||
|
@ApiModelProperty(value = "资源情况")
|
||||||
|
private String resourceStatusTip;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,8 @@ import io.renren.modules.activiti.dto.ProcessInstanceDTO;
|
||||||
import io.renren.modules.activiti.dto.TaskDTO;
|
import io.renren.modules.activiti.dto.TaskDTO;
|
||||||
import io.renren.modules.processForm.dto.TAbilityApplicationDTO;
|
import io.renren.modules.processForm.dto.TAbilityApplicationDTO;
|
||||||
import io.renren.modules.processForm.service.TAbilityApplicationService;
|
import io.renren.modules.processForm.service.TAbilityApplicationService;
|
||||||
|
import io.renren.modules.resource.dto.ResourceDTO;
|
||||||
|
import io.renren.modules.resource.service.ResourceService;
|
||||||
import io.renren.modules.resourceMountApply.dto.TResourceMountApplyDTO;
|
import io.renren.modules.resourceMountApply.dto.TResourceMountApplyDTO;
|
||||||
import io.renren.modules.resourceMountApply.service.TResourceMountApplyService;
|
import io.renren.modules.resourceMountApply.service.TResourceMountApplyService;
|
||||||
import io.renren.modules.security.user.SecurityUser;
|
import io.renren.modules.security.user.SecurityUser;
|
||||||
|
@ -72,6 +74,8 @@ public class ActHistoryService {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private SysUserService sysUserService;
|
private SysUserService sysUserService;
|
||||||
|
@Autowired
|
||||||
|
private ResourceService resourceService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private TAbilityApplicationService tAbilityApplicationService;
|
private TAbilityApplicationService tAbilityApplicationService;
|
||||||
|
@ -252,7 +256,6 @@ public class ActHistoryService {
|
||||||
PageData<ProcessInstanceDTO> pageData = this.getHistoryProcessInstancePage(params);
|
PageData<ProcessInstanceDTO> pageData = this.getHistoryProcessInstancePage(params);
|
||||||
List<ProcessInstanceDTO> list = pageData.getList();
|
List<ProcessInstanceDTO> list = pageData.getList();
|
||||||
for (ProcessInstanceDTO dto : list) {
|
for (ProcessInstanceDTO dto : list) {
|
||||||
logger.info(dto.toString());
|
|
||||||
TAbilityApplicationDTO abilityApplicationDTO = tAbilityApplicationService.getByInstanceId(dto.getProcessInstanceId()); // 获取申请表单
|
TAbilityApplicationDTO abilityApplicationDTO = tAbilityApplicationService.getByInstanceId(dto.getProcessInstanceId()); // 获取申请表单
|
||||||
if (abilityApplicationDTO != null && StringUtils.isNotEmpty(abilityApplicationDTO.getSystem()) && StringUtils.isEmpty(dto.getName())) {
|
if (abilityApplicationDTO != null && StringUtils.isNotEmpty(abilityApplicationDTO.getSystem()) && StringUtils.isEmpty(dto.getName())) {
|
||||||
dto.setName(abilityApplicationDTO.getSystem());
|
dto.setName(abilityApplicationDTO.getSystem());
|
||||||
|
@ -267,9 +270,22 @@ public class ActHistoryService {
|
||||||
if (resourceMountApplyDTO != null) {
|
if (resourceMountApplyDTO != null) {
|
||||||
dto.setName(resourceMountApplyDTO.getResourceDTO().getName());
|
dto.setName(resourceMountApplyDTO.getResourceDTO().getName());
|
||||||
dto.setResourceId(resourceMountApplyDTO.getResourceDTO().getId().toString());
|
dto.setResourceId(resourceMountApplyDTO.getResourceDTO().getId().toString());
|
||||||
|
} else {
|
||||||
|
ResourceDTO resourceDTO = resourceService.get(Long.valueOf(dto.getBusinessKey()));
|
||||||
|
if (resourceDTO != null) {
|
||||||
|
dto.setName(resourceDTO.getName());
|
||||||
|
dto.setResourceId(resourceDTO.getId().toString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (dto.getResourceId() != null) {
|
||||||
|
ResourceDTO resourceDTO = resourceService.get(Long.valueOf(dto.getResourceId()));
|
||||||
|
if (resourceDTO != null) {
|
||||||
|
dto.setResourceStatus(resourceDTO.getDelFlag());
|
||||||
|
dto.setResourceStatusTip(resourceDTO.getDelFlagTip());
|
||||||
|
}
|
||||||
|
}
|
||||||
if (dto.isEnded()) { // 已结束
|
if (dto.isEnded()) { // 已结束
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,6 +55,13 @@ import java.util.*;
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class ActTaskService extends BaseServiceImpl {
|
public class ActTaskService extends BaseServiceImpl {
|
||||||
|
|
||||||
|
public static String Task_HANDLE_STATE = "handleState"; //任务节点处理状态key
|
||||||
|
public static String Task_HANDLE_STATE_AGREE = "agree"; //同意
|
||||||
|
public static String Task_HANDLE_STATE_REJECTED = "rejected"; //驳回
|
||||||
|
public static String Task_HANDLE_STATE_BACK = "back"; //回退
|
||||||
|
public static String Task_HANDLE_STATE_STOP = "stop"; //终止
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
protected TaskService taskService;
|
protected TaskService taskService;
|
||||||
@Autowired
|
@Autowired
|
||||||
|
@ -226,6 +233,7 @@ public class ActTaskService extends BaseServiceImpl {
|
||||||
if (StringUtils.isNotEmpty(comment)) {
|
if (StringUtils.isNotEmpty(comment)) {
|
||||||
taskService.addComment(taskId, task.getProcessInstanceId(), comment);
|
taskService.addComment(taskId, task.getProcessInstanceId(), comment);
|
||||||
}
|
}
|
||||||
|
taskService.setVariable(taskId, Task_HANDLE_STATE, Task_HANDLE_STATE_AGREE);
|
||||||
taskService.complete(taskId);
|
taskService.complete(taskId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -390,6 +398,7 @@ public class ActTaskService extends BaseServiceImpl {
|
||||||
if (StringUtils.isNotEmpty(comment)) {
|
if (StringUtils.isNotEmpty(comment)) {
|
||||||
commentMode += "[" + comment + "]";
|
commentMode += "[" + comment + "]";
|
||||||
}
|
}
|
||||||
|
taskService.setVariable(task.getId(), Task_HANDLE_STATE, Task_HANDLE_STATE_BACK);
|
||||||
taskService.addComment(task.getId(), task.getProcessInstanceId(), commentMode);
|
taskService.addComment(task.getId(), task.getProcessInstanceId(), commentMode);
|
||||||
taskService.complete(task.getId(), variables);
|
taskService.complete(task.getId(), variables);
|
||||||
}
|
}
|
||||||
|
@ -477,6 +486,7 @@ public class ActTaskService extends BaseServiceImpl {
|
||||||
String message = MessageUtils.getMessage(ErrorCode.END_PROCESS_MESSAGE);
|
String message = MessageUtils.getMessage(ErrorCode.END_PROCESS_MESSAGE);
|
||||||
comment = message + "[" + comment + "]";
|
comment = message + "[" + comment + "]";
|
||||||
taskService.addComment(task.getId(), task.getProcessInstanceId(), comment);
|
taskService.addComment(task.getId(), task.getProcessInstanceId(), comment);
|
||||||
|
taskService.setVariable(task.getId(), Task_HANDLE_STATE, Task_HANDLE_STATE_STOP);
|
||||||
taskService.complete(taskId);
|
taskService.complete(taskId);
|
||||||
pointActivity.getIncomingTransitions().remove(newTransition);
|
pointActivity.getIncomingTransitions().remove(newTransition);
|
||||||
List<PvmTransition> pvmTransitionListC = currActivity.getOutgoingTransitions();
|
List<PvmTransition> pvmTransitionListC = currActivity.getOutgoingTransitions();
|
||||||
|
@ -606,6 +616,7 @@ public class ActTaskService extends BaseServiceImpl {
|
||||||
this.setTaskVariable(taskDTO.getTaskId(), key, taskDTO.getParams().get(key));
|
this.setTaskVariable(taskDTO.getTaskId(), key, taskDTO.getParams().get(key));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
taskService.setVariable(taskDTO.getTaskId(), Task_HANDLE_STATE, Task_HANDLE_STATE_REJECTED);
|
||||||
this.completeTask(taskDTO.getTaskId(), taskDTO.getComment());
|
this.completeTask(taskDTO.getTaskId(), taskDTO.getComment());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,4 +17,6 @@ public interface TAbilityApplicationDao extends BaseDao<TAbilityApplicationEntit
|
||||||
TAbilityApplicationEntity getByInstanceId(String instanceId);
|
TAbilityApplicationEntity getByInstanceId(String instanceId);
|
||||||
|
|
||||||
TAbilityApplicationEntity getByBusinessKey(String businessKey);
|
TAbilityApplicationEntity getByBusinessKey(String businessKey);
|
||||||
|
|
||||||
|
Long countApplyAll();
|
||||||
}
|
}
|
|
@ -37,6 +37,7 @@ public class TAbilityApplicationEntity {
|
||||||
/**
|
/**
|
||||||
* 申请应用系统
|
* 申请应用系统
|
||||||
*/
|
*/
|
||||||
|
@TableField("`system`")
|
||||||
private String system;
|
private String system;
|
||||||
/**
|
/**
|
||||||
* 申请场景
|
* 申请场景
|
||||||
|
@ -81,4 +82,9 @@ public class TAbilityApplicationEntity {
|
||||||
* 附件
|
* 附件
|
||||||
*/
|
*/
|
||||||
private String enclosure;
|
private String enclosure;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 流程通过后api网关注册的认证code,用于三方接口调用
|
||||||
|
*/
|
||||||
|
private String gatewayCode;
|
||||||
}
|
}
|
|
@ -2,9 +2,12 @@ package io.renren.modules.processForm.listener;
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.JsonElement;
|
import com.google.gson.JsonElement;
|
||||||
|
import io.renren.modules.activiti.service.ActTaskService;
|
||||||
import io.renren.modules.processForm.dto.TAbilityApplicationDTO;
|
import io.renren.modules.processForm.dto.TAbilityApplicationDTO;
|
||||||
|
import io.renren.modules.processForm.service.ApiGatewayService;
|
||||||
import io.renren.modules.processForm.service.TAbilityApplicationService;
|
import io.renren.modules.processForm.service.TAbilityApplicationService;
|
||||||
import io.renren.modules.resource.dto.ResourceDTO;
|
import io.renren.modules.resource.dto.ResourceDTO;
|
||||||
|
import io.renren.modules.resource.entity.ResourceEntity;
|
||||||
import io.renren.modules.resource.service.ResourceService;
|
import io.renren.modules.resource.service.ResourceService;
|
||||||
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;
|
||||||
|
@ -13,6 +16,7 @@ import io.renren.modules.sys.service.SysDeptService;
|
||||||
import io.renren.modules.sys.service.SysRoleService;
|
import io.renren.modules.sys.service.SysRoleService;
|
||||||
import io.renren.modules.sys.service.SysRoleUserService;
|
import io.renren.modules.sys.service.SysRoleUserService;
|
||||||
import io.renren.modules.sys.service.SysUserService;
|
import io.renren.modules.sys.service.SysUserService;
|
||||||
|
import org.activiti.engine.ProcessEngines;
|
||||||
import org.activiti.engine.TaskService;
|
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;
|
||||||
|
@ -25,6 +29,7 @@ import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 部门动态审批人
|
* 部门动态审批人
|
||||||
|
@ -48,6 +53,8 @@ public class CorrectionListener implements TaskListener, ExecutionListener, Acti
|
||||||
private SysRoleUserService sysRoleUserService;
|
private SysRoleUserService sysRoleUserService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private SysDeptService sysDeptService;
|
private SysDeptService sysDeptService;
|
||||||
|
@Autowired
|
||||||
|
private ApiGatewayService apiGatewayService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ResourceService resourceService;
|
private ResourceService resourceService;
|
||||||
|
@ -62,6 +69,9 @@ public class CorrectionListener implements TaskListener, ExecutionListener, Acti
|
||||||
case EVENTNAME_CREATE:
|
case EVENTNAME_CREATE:
|
||||||
create(delegateTask);
|
create(delegateTask);
|
||||||
break;
|
break;
|
||||||
|
case EVENTNAME_COMPLETE:
|
||||||
|
complete(delegateTask);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
logger.error("-------------------------结束部门动态审批人流程-------------------------------");
|
logger.error("-------------------------结束部门动态审批人流程-------------------------------");
|
||||||
|
@ -140,6 +150,7 @@ public class CorrectionListener implements TaskListener, ExecutionListener, Acti
|
||||||
logger.error("第二级别审批仍然为 " + bigDateDeptName);
|
logger.error("第二级别审批仍然为 " + bigDateDeptName);
|
||||||
taskService.addComment(delegateTask.getId(), delegateTask.getProcessInstanceId(), "默认通过");
|
taskService.addComment(delegateTask.getId(), delegateTask.getProcessInstanceId(), "默认通过");
|
||||||
taskService.complete(delegateTask.getId(), delegateTask.getVariables());
|
taskService.complete(delegateTask.getId(), delegateTask.getVariables());
|
||||||
|
endTake(delegateTask.getVariables());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
logger.error("表单内单位名称:" + abilityApplicationDTO.getUnit());
|
logger.error("表单内单位名称:" + abilityApplicationDTO.getUnit());
|
||||||
|
@ -167,7 +178,51 @@ public class CorrectionListener implements TaskListener, ExecutionListener, Acti
|
||||||
if ("免批申请".equals(resource.getShareCondition())) { // 针对免批资源申请
|
if ("免批申请".equals(resource.getShareCondition())) { // 针对免批资源申请
|
||||||
taskService.addComment(delegateTask.getId(), delegateTask.getProcessInstanceId(), "免批资源申请默认通过");
|
taskService.addComment(delegateTask.getId(), delegateTask.getProcessInstanceId(), "免批资源申请默认通过");
|
||||||
taskService.complete(delegateTask.getId(), delegateTask.getVariables());
|
taskService.complete(delegateTask.getId(), delegateTask.getVariables());
|
||||||
|
endTake(delegateTask.getVariables());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void complete(DelegateTask delegateTask) {
|
||||||
|
Map<String, Object> kv = delegateTask.getVariables();
|
||||||
|
|
||||||
|
//如果有code说明已经注册过了,以及只有通过的流程申请
|
||||||
|
if (kv.get("gatewayCode") != null ||
|
||||||
|
!ActTaskService.Task_HANDLE_STATE_AGREE.equals(kv.get(ActTaskService.Task_HANDLE_STATE))) return;
|
||||||
|
|
||||||
|
Gson gson = new Gson();
|
||||||
|
JsonElement jsonElement = gson.toJsonTree(kv);
|
||||||
|
TAbilityApplicationDTO abilityApplicationDTO = gson.fromJson(jsonElement, TAbilityApplicationDTO.class);
|
||||||
|
applyCode(delegateTask, abilityApplicationDTO);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 审批通过,申请code
|
||||||
|
*
|
||||||
|
* @param delegateTask
|
||||||
|
* @param abilityApplicationDTO
|
||||||
|
*/
|
||||||
|
private void applyCode(DelegateTask delegateTask, TAbilityApplicationDTO abilityApplicationDTO) {
|
||||||
|
|
||||||
|
logger.info("-------能力申请code-------");
|
||||||
|
ResourceEntity resourceEntity = resourceService.selectById(abilityApplicationDTO.getResourceId());
|
||||||
|
|
||||||
|
//没有groupid当做没有接口,直接跳过
|
||||||
|
if (resourceEntity.getGroupId() == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
String code = UUID.randomUUID().toString();
|
||||||
|
apiGatewayService.subscribeCode(String.valueOf(abilityApplicationDTO.getId()), code);
|
||||||
|
|
||||||
|
delegateTask.setVariable("gatewayCode", code);
|
||||||
|
|
||||||
|
String apiPrefix = "/juapi/" + abilityApplicationDTO.getResourceId();
|
||||||
|
TaskService taskService = ProcessEngines.getDefaultProcessEngine().getTaskService();
|
||||||
|
String msg = String.format("您的能力申请已通过,接口认证code为:%s, 接口公共前缀为:%s", code, apiPrefix);
|
||||||
|
taskService.addComment(delegateTask.getId(), delegateTask.getProcessInstanceId(), msg);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,14 @@
|
||||||
package io.renren.modules.processForm.service;
|
package io.renren.modules.processForm.service;
|
||||||
|
|
||||||
|
|
||||||
|
import cn.hutool.core.lang.UUID;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||||
|
import io.renren.modules.processForm.dao.TAbilityApplicationDao;
|
||||||
|
import io.renren.modules.processForm.entity.TAbilityApplicationEntity;
|
||||||
import io.renren.modules.resource.dao.ResourceDao;
|
import io.renren.modules.resource.dao.ResourceDao;
|
||||||
import io.renren.modules.resource.entity.ResourceEntity;
|
import io.renren.modules.resource.entity.ResourceEntity;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
@ -21,40 +26,60 @@ import java.util.regex.Pattern;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@Slf4j
|
@Slf4j
|
||||||
|
/**
|
||||||
|
* 聚好看网关对接相关
|
||||||
|
*
|
||||||
|
*/
|
||||||
public class ApiGatewayService {
|
public class ApiGatewayService {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ResourceDao resourceDao;
|
private ResourceDao resourceDao;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private TAbilityApplicationDao abilityApplicationDao;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private RestTemplate restTemplate;
|
private RestTemplate restTemplate;
|
||||||
|
|
||||||
@Value("${hisense.gateway.url:http://devtest-security-app.hismarttv.com:8080}")
|
@Value("${hisense.gateway.url}")
|
||||||
private String gatewayUrl;
|
private String gatewayUrl;
|
||||||
|
|
||||||
/**
|
/** 将api注册到网关
|
||||||
|
* 注册流程:创建group -> 创建路由(api)并关联到group下,未来可多个api关联
|
||||||
* @param resourceId 能力资源的id
|
* @param resourceId 能力资源的id
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public void registerApi2Gateway(String resourceId){
|
public void registerApi2Gateway(String resourceId){
|
||||||
|
|
||||||
if (resourceId == null) {
|
if (resourceId == null) {
|
||||||
log.warn("传入resourceId为空");
|
throw new IllegalArgumentException("传入resourceId为空");
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ResourceEntity resourceEntity = resourceDao.selectById(resourceId);
|
ResourceEntity resourceEntity = resourceDao.selectById(resourceId);
|
||||||
|
if (resourceEntity == null) {
|
||||||
|
throw new IllegalArgumentException(String.format("未找到对应的资源id:%s", resourceId));
|
||||||
|
}
|
||||||
String apiUrl = resourceEntity.getApiUrl();
|
String apiUrl = resourceEntity.getApiUrl();
|
||||||
|
String methods = resourceEntity.getApiMethodType().toUpperCase();
|
||||||
|
|
||||||
if (apiUrl == null || !apiUrl.startsWith("http")){
|
if (StringUtils.isBlank(apiUrl) || StringUtils.isBlank(methods)){
|
||||||
log.warn("非法apiurl!! apiUrl:{} resourceId:{}",apiUrl, resourceId);
|
String msg = String.format("注册api参数为空,跳过 apiUrl:%s, methods:%s, resourceId:%s", apiUrl, methods, resourceId);
|
||||||
|
//重要参数没有当成不需要注册
|
||||||
|
log.info(msg);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//建group
|
//建group
|
||||||
String domain = getIP(apiUrl);
|
String domain = getIP(apiUrl);
|
||||||
|
String uris = apiUrl.substring(apiUrl.indexOf(domain) + domain.length());
|
||||||
|
if (StringUtils.isBlank(uris)) {
|
||||||
|
uris = "/";
|
||||||
|
}
|
||||||
|
String apiPrefix = "/juapi/" + resourceId;
|
||||||
HashMap groupEntity = new HashMap();
|
HashMap groupEntity = new HashMap();
|
||||||
|
groupEntity.put("id", resourceId);
|
||||||
groupEntity.put("name", resourceEntity.getName());
|
groupEntity.put("name", resourceEntity.getName());
|
||||||
|
groupEntity.put("stripPrefixPattern",String.format("^%s/(.*)", apiPrefix));
|
||||||
groupEntity.put("serviceName",domain );
|
groupEntity.put("serviceName",domain );
|
||||||
|
|
||||||
String groupUrl = gatewayUrl + "/apiops/api/groups";
|
String groupUrl = gatewayUrl + "/apiops/api/groups";
|
||||||
|
@ -63,17 +88,17 @@ public class ApiGatewayService {
|
||||||
HashMap body = responseEntity.getBody();
|
HashMap body = responseEntity.getBody();
|
||||||
String id = (String) body.get("id");
|
String id = (String) body.get("id");
|
||||||
if (StringUtils.isBlank(id)){
|
if (StringUtils.isBlank(id)){
|
||||||
log.error("创建group时id为空 {} body:{}", JSON.toJSONString(groupEntity), body);
|
String error = String.format("创建group时id为空 request:%s body:%s", JSON.toJSONString(groupEntity), body);
|
||||||
return;
|
throw new RuntimeException(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
//建路由(接口url)
|
//建路由(接口url)
|
||||||
String routeUrl = gatewayUrl + "apiops/api/routers";
|
String routeUrl = gatewayUrl + "/apiops/api/routers";
|
||||||
HashMap routeEntity = new HashMap();
|
HashMap routeEntity = new HashMap();
|
||||||
routeEntity.put("name", "api:1:" + resourceEntity.getName());
|
routeEntity.put("name", "api:1:" + resourceEntity.getName());
|
||||||
routeEntity.put("group", id);
|
routeEntity.put("group", id);
|
||||||
routeEntity.put("methods", resourceEntity.getApiMethodType().toUpperCase());
|
routeEntity.put("methods", methods);
|
||||||
routeEntity.put("uris", apiUrl.substring(apiUrl.indexOf(domain) + domain.length()));
|
routeEntity.put("uris", apiPrefix + uris);
|
||||||
ResponseEntity<HashMap> routeResEntity = restTemplate.postForEntity(routeUrl, routeEntity, HashMap.class);
|
ResponseEntity<HashMap> routeResEntity = restTemplate.postForEntity(routeUrl, routeEntity, HashMap.class);
|
||||||
if (routeResEntity.getStatusCode() != HttpStatus.OK || !responseEntity.hasBody()){
|
if (routeResEntity.getStatusCode() != HttpStatus.OK || !responseEntity.hasBody()){
|
||||||
//失败则删除group
|
//失败则删除group
|
||||||
|
@ -89,6 +114,55 @@ public class ApiGatewayService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将code关联到group,api这希望code由我们来生成
|
||||||
|
* 关联流程:创建消费者 -> 订阅接口传入code关联消费者与group
|
||||||
|
* @param formId
|
||||||
|
* @param code
|
||||||
|
*/
|
||||||
|
public void subscribeCode( String formId, String code){
|
||||||
|
|
||||||
|
if ( StringUtils.isBlank(formId) || StringUtils.isBlank(code)) {
|
||||||
|
throw new IllegalArgumentException(String.format("关键参数不能为空 formId:%s code:%s", formId, code));
|
||||||
|
}
|
||||||
|
|
||||||
|
TAbilityApplicationEntity applicationEntity = abilityApplicationDao.selectById(formId);
|
||||||
|
ResourceEntity resourceEntity = resourceDao.selectById(applicationEntity.getResourceId());
|
||||||
|
String groupId = resourceEntity.getGroupId();
|
||||||
|
if (resourceEntity == null){
|
||||||
|
throw new RuntimeException(String.format("找不到资源类 groupId:%s", groupId));
|
||||||
|
}
|
||||||
|
|
||||||
|
//注册消费者,一个表单关联一个消费者
|
||||||
|
HashMap consumerEntity = new HashMap();
|
||||||
|
consumerEntity.put("id", formId);
|
||||||
|
consumerEntity.put("name", resourceEntity.getName() + "-concumer");
|
||||||
|
|
||||||
|
String consumerUrl = gatewayUrl + "/apiops/api/consumers";
|
||||||
|
HashMap consumerResponse = restTemplate.postForEntity(consumerUrl, consumerEntity, HashMap.class).getBody();
|
||||||
|
if (consumerResponse == null || !formId.equals(consumerResponse.get("id"))){
|
||||||
|
throw new RuntimeException(String.format("消费者创建失败 response: %s", consumerResponse));
|
||||||
|
}
|
||||||
|
|
||||||
|
//订阅
|
||||||
|
HashMap subscribeEntity = new HashMap();
|
||||||
|
subscribeEntity.put("consumerId", formId);
|
||||||
|
subscribeEntity.put("routerId", groupId);
|
||||||
|
subscribeEntity.put("routerType","group");
|
||||||
|
subscribeEntity.put("code", code);
|
||||||
|
|
||||||
|
String subscribeUrl = gatewayUrl + "/apiops/api/subscribers";
|
||||||
|
HashMap body = restTemplate.postForEntity(subscribeUrl, subscribeEntity, HashMap.class).getBody();
|
||||||
|
if (body == null || StringUtils.isBlank((String) body.get("consumerId"))){
|
||||||
|
throw new RuntimeException(String.format("订阅失败 response: %s", body));
|
||||||
|
}
|
||||||
|
|
||||||
|
LambdaUpdateWrapper<TAbilityApplicationEntity> updateWrapper = new UpdateWrapper<TAbilityApplicationEntity>().lambda()
|
||||||
|
.eq(TAbilityApplicationEntity::getId, formId)
|
||||||
|
.set(TAbilityApplicationEntity::getGatewayCode, code);
|
||||||
|
abilityApplicationDao.update(null, updateWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
private String getIP(String url) {
|
private String getIP(String url) {
|
||||||
String re = "((http|ftp|https)://)(([a-zA-Z0-9._-]+)|([0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}))(([a-zA-Z]{2,6})|(:[0-9]{1,4})?)";
|
String re = "((http|ftp|https)://)(([a-zA-Z0-9._-]+)|([0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}))(([a-zA-Z]{2,6})|(:[0-9]{1,4})?)";
|
||||||
String str = "";
|
String str = "";
|
||||||
|
|
|
@ -14,10 +14,15 @@ public interface TAbilityApplicationService extends CrudService<TAbilityApplicat
|
||||||
|
|
||||||
void updateInstanceId(String instanceId, Long id);
|
void updateInstanceId(String instanceId, Long id);
|
||||||
|
|
||||||
/** 根据instanceId 获取申请内容
|
/**
|
||||||
|
* 根据instanceId 获取申请内容
|
||||||
|
*
|
||||||
* @param instanceId
|
* @param instanceId
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
TAbilityApplicationDTO getByInstanceId(String instanceId);
|
TAbilityApplicationDTO getByInstanceId(String instanceId);
|
||||||
|
|
||||||
TAbilityApplicationDTO getByBusinessKey(String businessKey);
|
TAbilityApplicationDTO getByBusinessKey(String businessKey);
|
||||||
|
|
||||||
|
Long countApplyAll();
|
||||||
}
|
}
|
|
@ -52,5 +52,10 @@ public class TAbilityApplicationServiceImpl extends CrudServiceImpl<TAbilityAppl
|
||||||
return ConvertUtils.sourceToTarget(entity, TAbilityApplicationDTO.class);
|
return ConvertUtils.sourceToTarget(entity, TAbilityApplicationDTO.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long countApplyAll() {
|
||||||
|
return baseDao.countApplyAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -50,7 +50,9 @@ public class ResourceController {
|
||||||
@ApiImplicitParam(name = "creator", value = "创建者用户id", paramType = "query", dataType = "String")
|
@ApiImplicitParam(name = "creator", value = "创建者用户id", paramType = "query", dataType = "String")
|
||||||
})
|
})
|
||||||
public Result<PageData<ResourceDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params) {
|
public Result<PageData<ResourceDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params) {
|
||||||
params.put("del_flag", 0);
|
if (!params.containsKey("del_flag")) {
|
||||||
|
params.put("del_flag", 0);
|
||||||
|
}
|
||||||
PageData<ResourceDTO> page = resourceService.page(params);
|
PageData<ResourceDTO> page = resourceService.page(params);
|
||||||
page.getList().forEach(item -> {
|
page.getList().forEach(item -> {
|
||||||
item.setInfoList(resourceService.selectAttrsByResourceId(item.getId()));
|
item.setInfoList(resourceService.selectAttrsByResourceId(item.getId()));
|
||||||
|
|
|
@ -3,6 +3,7 @@ package io.renren.modules.resource.dao;
|
||||||
import io.renren.common.dao.BaseDao;
|
import io.renren.common.dao.BaseDao;
|
||||||
import io.renren.modules.resource.dto.ResourceDTO;
|
import io.renren.modules.resource.dto.ResourceDTO;
|
||||||
import io.renren.modules.resource.entity.ResourceEntity;
|
import io.renren.modules.resource.entity.ResourceEntity;
|
||||||
|
import org.apache.ibatis.annotations.MapKey;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
@ -10,11 +11,11 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 资源表
|
* 资源表
|
||||||
*
|
*
|
||||||
* @author dg
|
* @author dg
|
||||||
* @since 1.0 2022-04-13
|
* @since 1.0 2022-04-13
|
||||||
*/
|
*/
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface ResourceDao extends BaseDao<ResourceEntity> {
|
public interface ResourceDao extends BaseDao<ResourceEntity> {
|
||||||
|
|
||||||
|
@ -28,13 +29,27 @@ public interface ResourceDao extends BaseDao<ResourceEntity> {
|
||||||
|
|
||||||
List<ResourceDTO> selectMostPopular(Map<String, Object> selectMap);
|
List<ResourceDTO> selectMostPopular(Map<String, Object> selectMap);
|
||||||
|
|
||||||
ResourceDTO selectDTOById(@Param("id") Long id,@Param("userId") Long userId);
|
ResourceDTO selectDTOById(@Param("id") Long id, @Param("userId") Long userId);
|
||||||
|
|
||||||
List<ResourceDTO> selectDTOPage(@Param("dto")ResourceDTO resourceDTO,
|
List<ResourceDTO> selectDTOPage(@Param("dto") ResourceDTO resourceDTO,
|
||||||
@Param("pageNum") Integer pageNum,
|
@Param("pageNum") Integer pageNum,
|
||||||
@Param("pageSize") Integer pageSize,
|
@Param("pageSize") Integer pageSize,
|
||||||
@Param("orderField")String orderField,
|
@Param("orderField") String orderField,
|
||||||
@Param("orderType") String orderType);
|
@Param("orderType") String orderType);
|
||||||
|
|
||||||
List<Map> selectApplyArea(Long userId);
|
List<Map> selectApplyArea(Long userId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取各类资源数目
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@MapKey("type")
|
||||||
|
List<Map<String, Object>> getAmountGroupByType();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 介入部门数目
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Long countAllDept();
|
||||||
}
|
}
|
|
@ -72,23 +72,29 @@ public class ResourceUndercarriageListener implements TaskListener, ExecutionLis
|
||||||
logger.error("----------------------进入审批通过节点---------------------------");
|
logger.error("----------------------进入审批通过节点---------------------------");
|
||||||
logger.error("事件类型:" + execution.getEventName());
|
logger.error("事件类型:" + execution.getEventName());
|
||||||
final String eventName = execution.getEventName();
|
final String eventName = execution.getEventName();
|
||||||
|
|
||||||
switch (eventName) {
|
switch (eventName) {
|
||||||
case EVENTNAME_END: {
|
case EVENTNAME_END: {
|
||||||
endTake(execution.getVariables());
|
endTake(execution.getVariables());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
logger.error("----------------------结束审批通过节点---------------------------");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 下架审核通过
|
||||||
|
*
|
||||||
|
* @param kv
|
||||||
|
*/
|
||||||
private void endTake(Map<String, Object> kv) { // 进入最后结束节点
|
private void endTake(Map<String, Object> kv) { // 进入最后结束节点
|
||||||
Gson gson = new Gson();
|
Gson gson = new Gson();
|
||||||
JsonElement jsonElement = gson.toJsonTree(kv);
|
JsonElement jsonElement = gson.toJsonTree(kv);
|
||||||
ResourceDTO re = gson.fromJson(jsonElement, ResourceDTO.class);
|
ResourceDTO re = gson.fromJson(jsonElement, ResourceDTO.class);
|
||||||
if (re != null) {
|
if (re != null) {
|
||||||
|
logger.error(kv.toString());
|
||||||
re.setDelFlag(ResourceEntityDelFlag.UNDERCARRIAGE.getFlag());
|
re.setDelFlag(ResourceEntityDelFlag.UNDERCARRIAGE.getFlag());
|
||||||
resourceService.update(re);
|
resourceService.update(re);
|
||||||
logger.error("审批通过!资源id:" + re.getId());
|
logger.error("下架审批通过 资源id:" + re.getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,11 +7,12 @@ import io.renren.modules.resource.entity.AttrEntity;
|
||||||
import io.renren.modules.resource.entity.ResourceEntity;
|
import io.renren.modules.resource.entity.ResourceEntity;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 资源表
|
* 资源表
|
||||||
*
|
*
|
||||||
* @author dg
|
* @author dg
|
||||||
* @since 1.0 2022-04-13
|
* @since 1.0 2022-04-13
|
||||||
*/
|
*/
|
||||||
public interface ResourceService extends CrudService<ResourceEntity, ResourceDTO> {
|
public interface ResourceService extends CrudService<ResourceEntity, ResourceDTO> {
|
||||||
|
@ -38,4 +39,7 @@ public interface ResourceService extends CrudService<ResourceEntity, ResourceDTO
|
||||||
|
|
||||||
Object selectRecommend();
|
Object selectRecommend();
|
||||||
|
|
||||||
|
List<Map<String, Object>> getAmountGroupByType();
|
||||||
|
|
||||||
|
Long countAllDept();
|
||||||
}
|
}
|
|
@ -265,4 +265,15 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
||||||
return this.pageWithAttrs(jsonObject);
|
return this.pageWithAttrs(jsonObject);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Map<String, Object>> getAmountGroupByType() {
|
||||||
|
List<Map<String, Object>> amountInfo = resourceDao.getAmountGroupByType();
|
||||||
|
return amountInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long countAllDept() {
|
||||||
|
return baseDao.countAllDept();
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -80,6 +80,9 @@ public class ResourceOwnerListener implements TaskListener, ExecutionListener, A
|
||||||
case EVENTNAME_CREATE: // 创建当前审批节点事件
|
case EVENTNAME_CREATE: // 创建当前审批节点事件
|
||||||
create(delegateTask, roleDTO);
|
create(delegateTask, roleDTO);
|
||||||
break;
|
break;
|
||||||
|
case EVENTNAME_COMPLETE:
|
||||||
|
complete(delegateTask);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
logger.error("未处理该事件:" + eventName);
|
logger.error("未处理该事件:" + eventName);
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,8 +9,10 @@ import org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSource
|
||||||
import org.apache.shiro.spring.web.ShiroFilterFactoryBean;
|
import org.apache.shiro.spring.web.ShiroFilterFactoryBean;
|
||||||
import org.apache.shiro.web.mgt.DefaultWebSecurityManager;
|
import org.apache.shiro.web.mgt.DefaultWebSecurityManager;
|
||||||
import org.apache.shiro.web.session.mgt.DefaultWebSessionManager;
|
import org.apache.shiro.web.session.mgt.DefaultWebSessionManager;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import javax.servlet.Filter;
|
import javax.servlet.Filter;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
@ -23,6 +25,9 @@ import java.util.Map;
|
||||||
@Configuration
|
@Configuration
|
||||||
public class ShiroConfig {
|
public class ShiroConfig {
|
||||||
|
|
||||||
|
// @Autowired
|
||||||
|
// private Oauth2Filter oauth2Filter;
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public DefaultWebSessionManager sessionManager() {
|
public DefaultWebSessionManager sessionManager() {
|
||||||
DefaultWebSessionManager sessionManager = new DefaultWebSessionManager();
|
DefaultWebSessionManager sessionManager = new DefaultWebSessionManager();
|
||||||
|
@ -42,13 +47,13 @@ public class ShiroConfig {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean("shiroFilter")
|
@Bean("shiroFilter")
|
||||||
public ShiroFilterFactoryBean shirFilter(SecurityManager securityManager) {
|
public ShiroFilterFactoryBean shirFilter(SecurityManager securityManager, Oauth2Filter oauth2Filter) {
|
||||||
ShiroFilterFactoryBean shiroFilter = new ShiroFilterFactoryBean();
|
ShiroFilterFactoryBean shiroFilter = new ShiroFilterFactoryBean();
|
||||||
shiroFilter.setSecurityManager(securityManager);
|
shiroFilter.setSecurityManager(securityManager);
|
||||||
|
|
||||||
//oauth过滤
|
//oauth过滤
|
||||||
Map<String, Filter> filters = new HashMap<>();
|
Map<String, Filter> filters = new HashMap<>();
|
||||||
filters.put("oauth2", new Oauth2Filter());
|
filters.put("oauth2", oauth2Filter);
|
||||||
shiroFilter.setFilters(filters);
|
shiroFilter.setFilters(filters);
|
||||||
|
|
||||||
Map<String, String> filterMap = new LinkedHashMap<>();
|
Map<String, String> filterMap = new LinkedHashMap<>();
|
||||||
|
@ -77,6 +82,7 @@ public class ShiroConfig {
|
||||||
*/
|
*/
|
||||||
filterMap.put("/upload", "anon");
|
filterMap.put("/upload", "anon");
|
||||||
filterMap.put("/upload/**", "anon");
|
filterMap.put("/upload/**", "anon");
|
||||||
|
filterMap.put("/census/center/**", "anon"); // 全局各类统计
|
||||||
|
|
||||||
filterMap.put("/**", "oauth2");
|
filterMap.put("/**", "oauth2");
|
||||||
shiroFilter.setFilterChainDefinitionMap(filterMap);
|
shiroFilter.setFilterChainDefinitionMap(filterMap);
|
||||||
|
|
|
@ -4,8 +4,10 @@ import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import com.fasterxml.jackson.databind.module.SimpleModule;
|
import com.fasterxml.jackson.databind.module.SimpleModule;
|
||||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||||
|
import io.renren.common.interceptor.IdentityInterceptor;
|
||||||
import io.renren.common.utils.DateUtils;
|
import io.renren.common.utils.DateUtils;
|
||||||
import io.renren.modules.pay.Interceptor.AliPayInterceptor;
|
import io.renren.modules.pay.Interceptor.AliPayInterceptor;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.http.converter.ByteArrayHttpMessageConverter;
|
import org.springframework.http.converter.ByteArrayHttpMessageConverter;
|
||||||
|
@ -25,6 +27,9 @@ import java.util.TimeZone;
|
||||||
@Configuration
|
@Configuration
|
||||||
public class WebMvcConfig implements WebMvcConfigurer {
|
public class WebMvcConfig implements WebMvcConfigurer {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IdentityInterceptor identityInterceptor;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addCorsMappings(CorsRegistry registry) {
|
public void addCorsMappings(CorsRegistry registry) {
|
||||||
registry.addMapping("/**")
|
registry.addMapping("/**")
|
||||||
|
@ -37,7 +42,7 @@ public class WebMvcConfig implements WebMvcConfigurer {
|
||||||
@Override
|
@Override
|
||||||
public void addInterceptors(InterceptorRegistry registry) {
|
public void addInterceptors(InterceptorRegistry registry) {
|
||||||
registry.addInterceptor(new AliPayInterceptor()).addPathPatterns("/pay/alipay/**");
|
registry.addInterceptor(new AliPayInterceptor()).addPathPatterns("/pay/alipay/**");
|
||||||
// registry.addInterceptor(new IdentityInterceptor());
|
// registry.addInterceptor(identityInterceptor);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,8 +1,13 @@
|
||||||
package io.renren.modules.security.oauth2;
|
package io.renren.modules.security.oauth2;
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
|
import com.yawei.pso.PSORequest;
|
||||||
|
import com.yawei.pso.SSOResponse;
|
||||||
|
import com.yawei.pso.TicketManager;
|
||||||
import io.renren.common.constant.Constant;
|
import io.renren.common.constant.Constant;
|
||||||
import io.renren.common.exception.ErrorCode;
|
import io.renren.common.exception.ErrorCode;
|
||||||
|
import io.renren.common.interceptor.Validator;
|
||||||
|
import io.renren.common.interceptor.YaweiSSOProperties;
|
||||||
import io.renren.common.utils.HttpContextUtils;
|
import io.renren.common.utils.HttpContextUtils;
|
||||||
import io.renren.common.utils.Result;
|
import io.renren.common.utils.Result;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
@ -10,20 +15,38 @@ import org.apache.http.HttpStatus;
|
||||||
import org.apache.shiro.authc.AuthenticationException;
|
import org.apache.shiro.authc.AuthenticationException;
|
||||||
import org.apache.shiro.authc.AuthenticationToken;
|
import org.apache.shiro.authc.AuthenticationToken;
|
||||||
import org.apache.shiro.web.filter.authc.AuthenticatingFilter;
|
import org.apache.shiro.web.filter.authc.AuthenticatingFilter;
|
||||||
|
import org.apache.shiro.web.servlet.ShiroHttpServletRequest;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.context.annotation.Lazy;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.web.bind.annotation.RequestMethod;
|
import org.springframework.web.bind.annotation.RequestMethod;
|
||||||
|
|
||||||
import javax.servlet.ServletRequest;
|
import javax.servlet.ServletRequest;
|
||||||
import javax.servlet.ServletResponse;
|
import javax.servlet.ServletResponse;
|
||||||
|
import javax.servlet.http.Cookie;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
import java.net.URLEncoder;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* oauth2过滤器
|
* oauth2过滤器
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@Component()
|
||||||
|
@Scope("prototype")
|
||||||
public class Oauth2Filter extends AuthenticatingFilter {
|
public class Oauth2Filter extends AuthenticatingFilter {
|
||||||
|
|
||||||
|
public final static String SEESION_USER = "seesion_user";
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private YaweiSSOProperties yaweiSSOProperties;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected AuthenticationToken createToken(ServletRequest request, ServletResponse response) throws Exception {
|
protected AuthenticationToken createToken(ServletRequest request, ServletResponse response) throws Exception {
|
||||||
//获取请求token
|
//获取请求token
|
||||||
|
@ -47,22 +70,28 @@ public class Oauth2Filter extends AuthenticatingFilter {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean onAccessDenied(ServletRequest request, ServletResponse response) throws Exception {
|
protected boolean onAccessDenied(ServletRequest request, ServletResponse response) throws Exception {
|
||||||
|
|
||||||
|
|
||||||
//获取请求token,如果token不存在,直接返回401
|
//获取请求token,如果token不存在,直接返回401
|
||||||
String token = getRequestToken((HttpServletRequest) request);
|
String token = getRequestToken((HttpServletRequest) request);
|
||||||
if(StringUtils.isBlank(token)){
|
if(StringUtils.isBlank(token)){
|
||||||
HttpServletResponse httpResponse = (HttpServletResponse) response;
|
|
||||||
httpResponse.setContentType("application/json;charset=utf-8");
|
|
||||||
httpResponse.setHeader("Access-Control-Allow-Credentials", "true");
|
|
||||||
httpResponse.setHeader("Access-Control-Allow-Origin", HttpContextUtils.getOrigin());
|
|
||||||
|
|
||||||
String json = new Gson().toJson(new Result().error(ErrorCode.UNAUTHORIZED));
|
yaweiHandle((HttpServletRequest)request, (HttpServletResponse)response);
|
||||||
|
|
||||||
httpResponse.getWriter().print(json);
|
// HttpServletResponse httpResponse = (HttpServletResponse) response;
|
||||||
|
// httpResponse.setContentType("application/json;charset=utf-8");
|
||||||
|
// httpResponse.setHeader("Access-Control-Allow-Credentials", "true");
|
||||||
|
// httpResponse.setHeader("Access-Control-Allow-Origin", HttpContextUtils.getOrigin());
|
||||||
|
//
|
||||||
|
// String json = new Gson().toJson(new Result().error(ErrorCode.UNAUTHORIZED));
|
||||||
|
//
|
||||||
|
// httpResponse.getWriter().print(json);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return executeLogin(request, response);
|
boolean executeLogin = executeLogin(request, response);
|
||||||
|
return executeLogin;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -100,4 +129,86 @@ public class Oauth2Filter extends AuthenticatingFilter {
|
||||||
return token;
|
return token;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean yaweiHandle(HttpServletRequest request, HttpServletResponse response) throws Exception {
|
||||||
|
// 获取当前请求的url
|
||||||
|
String requestUri = request.getHeader("REQUESTURI");
|
||||||
|
if (requestUri == null){
|
||||||
|
requestUri = request.getRequestURI();
|
||||||
|
}
|
||||||
|
|
||||||
|
Validator validator = Validator.getInstance();
|
||||||
|
|
||||||
|
String strResponse = request.getParameter(yaweiSSOProperties.getSsoKey());
|
||||||
|
if (org.apache.commons.lang.StringUtils.isEmpty(strResponse)) {
|
||||||
|
TicketManager tm = new TicketManager();
|
||||||
|
if (!tm.LoadTicket(request)) {
|
||||||
|
PSORequest psoRequest = new PSORequest(request);
|
||||||
|
//不建新类了,直接反射解决
|
||||||
|
Field returnUrl = psoRequest.getClass().getDeclaredField("returnUrl");
|
||||||
|
returnUrl.setAccessible(true);
|
||||||
|
returnUrl.set(psoRequest, requestUri);
|
||||||
|
String requeststr = psoRequest.CreateHash();
|
||||||
|
|
||||||
|
String keeperUrl = yaweiSSOProperties.getKeeperUrl();
|
||||||
|
keeperUrl = keeperUrl + "?" + yaweiSSOProperties.getSsoKey() + "="
|
||||||
|
+ URLEncoder.encode(requeststr, "UTF-8");
|
||||||
|
response.addHeader("REDIRECT", keeperUrl);
|
||||||
|
response.setStatus(HttpStatus.SC_UNAUTHORIZED);
|
||||||
|
response.getWriter().write(HttpStatus.SC_UNAUTHORIZED);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 如果服务器端通过认证后,会返回后执行改操作,然后写入cookie
|
||||||
|
SSOResponse ssoResp = new SSOResponse(strResponse);
|
||||||
|
TicketManager tm = ssoResp.CreatePSOTicket();
|
||||||
|
if (tm == null) {
|
||||||
|
PSORequest psoRequest = new PSORequest(request);
|
||||||
|
String requeststr = psoRequest.CreateHash();
|
||||||
|
|
||||||
|
String keeperUrl = yaweiSSOProperties.getKeeperUrl();
|
||||||
|
keeperUrl = keeperUrl + "?" + yaweiSSOProperties.getSsoKey() + "="
|
||||||
|
+ URLEncoder.encode(requeststr, "UTF-8");
|
||||||
|
response.sendRedirect(keeperUrl);
|
||||||
|
} else {
|
||||||
|
String domainName = yaweiSSOProperties.getDomain();
|
||||||
|
tm.SaveTicket(response, domainName);
|
||||||
|
|
||||||
|
//同时添加自己的token
|
||||||
|
// Cookie cookie = new Cookie(Constant.TOKEN_HEADER, createToken(request, response).toString());
|
||||||
|
// response.addCookie(cookie);
|
||||||
|
|
||||||
|
Iterator<Map.Entry<String, String[]>> iterator = request
|
||||||
|
.getParameterMap().entrySet().iterator();
|
||||||
|
StringBuffer param = new StringBuffer();
|
||||||
|
int i = 0;
|
||||||
|
while (iterator.hasNext()) {
|
||||||
|
Map.Entry<String, String[]> entry = (Map.Entry<String, String[]>) iterator
|
||||||
|
.next();
|
||||||
|
if (entry.getKey().equals(yaweiSSOProperties.getSsoKey()))
|
||||||
|
continue;
|
||||||
|
else {
|
||||||
|
i++;
|
||||||
|
if (i == 1)
|
||||||
|
param.append("?").append(entry.getKey())
|
||||||
|
.append("=");
|
||||||
|
else
|
||||||
|
param.append("&").append(entry.getKey())
|
||||||
|
.append("=");
|
||||||
|
|
||||||
|
if (entry.getValue() instanceof String[]) {
|
||||||
|
param.append(((String[]) entry.getValue())[0]);
|
||||||
|
} else {
|
||||||
|
param.append(entry.getValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
response.sendRedirect(requestUri + param.toString());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
validator.SetUserTicket(request);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -39,4 +39,6 @@ public interface SysUserDao extends BaseDao<SysUserEntity> {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
SysUserEntity getByDeptIdAndRoleId(@Param("deptId") Long deptId, @Param("roleId") Long roleId);
|
SysUserEntity getByDeptIdAndRoleId(@Param("deptId") Long deptId, @Param("roleId") Long roleId);
|
||||||
|
|
||||||
|
Long countAllUser();
|
||||||
}
|
}
|
|
@ -48,4 +48,11 @@ public interface SysUserService extends BaseService<SysUserEntity> {
|
||||||
|
|
||||||
SysUserDTO getByDeptIdAndRoleId(Long deptId, Long roleId);
|
SysUserDTO getByDeptIdAndRoleId(Long deptId, Long roleId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 统计所有有效的用户
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Long countAllUser();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -167,4 +167,14 @@ public class SysUserServiceImpl extends BaseServiceImpl<SysUserDao, SysUserEntit
|
||||||
return ConvertUtils.sourceToTarget(entity, SysUserDTO.class);
|
return ConvertUtils.sourceToTarget(entity, SysUserDTO.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 统计所有有效的用户
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Long countAllUser() {
|
||||||
|
return baseDao.countAllUser();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,58 @@
|
||||||
|
server:
|
||||||
|
port: 8000
|
||||||
|
spring:
|
||||||
|
datasource:
|
||||||
|
druid:
|
||||||
|
#MySQL
|
||||||
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
|
url: jdbc:mysql://127.0.0.1:3306/share_platform?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true
|
||||||
|
username: root
|
||||||
|
password: 123456
|
||||||
|
initial-size: 10
|
||||||
|
max-active: 100
|
||||||
|
min-idle: 10
|
||||||
|
max-wait: 3000
|
||||||
|
pool-prepared-statements: true
|
||||||
|
max-pool-prepared-statement-per-connection-size: 20
|
||||||
|
time-between-eviction-runs-millis: 60000
|
||||||
|
min-evictable-idle-time-millis: 300000
|
||||||
|
#Oracle需要打开注释
|
||||||
|
validation-query: SELECT 1
|
||||||
|
test-while-idle: true
|
||||||
|
test-on-borrow: false
|
||||||
|
test-on-return: false
|
||||||
|
stat-view-servlet:
|
||||||
|
enabled: true
|
||||||
|
url-pattern: /druid/*
|
||||||
|
#login-username: admin
|
||||||
|
#login-password: admin
|
||||||
|
filter:
|
||||||
|
stat:
|
||||||
|
log-slow-sql: true
|
||||||
|
slow-sql-millis: 1000
|
||||||
|
merge-sql: false
|
||||||
|
wall:
|
||||||
|
config:
|
||||||
|
multi-statement-allow: true
|
||||||
|
#上传的静态资源配置
|
||||||
|
resource:
|
||||||
|
root_url: 15.2.21.238
|
||||||
|
path: /data/services/nengli/files/
|
||||||
|
devModelFilePath: /data/services/nengli/files/devModelFile
|
||||||
|
# 大数据部门相关配置
|
||||||
|
big_date:
|
||||||
|
name: 青岛市大数据发展管理局
|
||||||
|
assignee_role_name: 部门审批人
|
||||||
|
|
||||||
|
hisense:
|
||||||
|
gateway:
|
||||||
|
# url: http://15.72.184.7:8080
|
||||||
|
url: http://devtest-security-app.hismarttv.com:8080
|
||||||
|
logging:
|
||||||
|
level:
|
||||||
|
org:
|
||||||
|
activiti:
|
||||||
|
engine:
|
||||||
|
impl:
|
||||||
|
persistence:
|
||||||
|
entity: debug
|
|
@ -42,4 +42,8 @@ resource:
|
||||||
# 大数据部门相关配置
|
# 大数据部门相关配置
|
||||||
big_date:
|
big_date:
|
||||||
name: 青岛市大数据发展管理局
|
name: 青岛市大数据发展管理局
|
||||||
assignee_role_name: 部门审批人
|
assignee_role_name: 部门审批人
|
||||||
|
|
||||||
|
hisense:
|
||||||
|
gateway:
|
||||||
|
url: http://devtest-security-app.hismarttv.com:8080
|
|
@ -2,6 +2,9 @@
|
||||||
big_date:
|
big_date:
|
||||||
name: 青岛市大数据发展管理局
|
name: 青岛市大数据发展管理局
|
||||||
assignee_role_name: 部门审批人
|
assignee_role_name: 部门审批人
|
||||||
|
# 需要进行统计数目的资源 type
|
||||||
|
census:
|
||||||
|
type: 组件服务,应用资源,基础设施,数据资源,知识库
|
||||||
# Tomcat
|
# Tomcat
|
||||||
server:
|
server:
|
||||||
tomcat:
|
tomcat:
|
||||||
|
|
|
@ -24,4 +24,12 @@
|
||||||
WHERE
|
WHERE
|
||||||
t1.id = #{businessKey}
|
t1.id = #{businessKey}
|
||||||
</select>
|
</select>
|
||||||
|
<select id="countApplyAll" resultType="java.lang.Long">
|
||||||
|
SELECT
|
||||||
|
COUNT( id )
|
||||||
|
FROM
|
||||||
|
t_ability_application
|
||||||
|
WHERE
|
||||||
|
approve_status = '通过'
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
|
@ -89,7 +89,7 @@
|
||||||
SET del_flag = 1,
|
SET del_flag = 1,
|
||||||
update_date = NOW()
|
update_date = NOW()
|
||||||
WHERE 1 = 1
|
WHERE 1 = 1
|
||||||
AND id IN
|
AND id IN
|
||||||
<foreach collection="ids" item="item" open="(" separator="," close=")">
|
<foreach collection="ids" item="item" open="(" separator="," close=")">
|
||||||
#{item}
|
#{item}
|
||||||
</foreach>
|
</foreach>
|
||||||
|
@ -104,14 +104,19 @@
|
||||||
IFNULL(trc.collectCount, 0) AS "collectCount",
|
IFNULL(trc.collectCount, 0) AS "collectCount",
|
||||||
IFNULL(sd.name, '暂无部门信息') AS "deptName",
|
IFNULL(sd.name, '暂无部门信息') AS "deptName",
|
||||||
IFNULL(trc2.isCollect, 'false') AS "isCollect",
|
IFNULL(trc2.isCollect, 'false') AS "isCollect",
|
||||||
(IFNULL(tdr.visits / 100, 0) + IFNULL(trs.score, 0) + IFNULL(taa.applyCount, 0)+ IFNULL(trc.collectCount, 0)) AS total
|
(IFNULL(tdr.visits / 100, 0) + IFNULL(trs.score, 0) + IFNULL(taa.applyCount, 0)+ IFNULL(trc.collectCount, 0)) AS
|
||||||
|
total
|
||||||
FROM
|
FROM
|
||||||
tb_data_resource tdr
|
tb_data_resource tdr
|
||||||
LEFT JOIN tb_data_attr tda ON tdr.id = tda.data_resource_id
|
LEFT JOIN tb_data_attr tda ON tdr.id = tda.data_resource_id
|
||||||
LEFT JOIN ( SELECT resource_id, AVG(score) AS "score" FROM tb_resource_score WHERE 1 = 1 AND del_flag = 0 GROUP BY resource_id ) trs ON tdr.id = trs.resource_id
|
LEFT JOIN ( SELECT resource_id, AVG(score) AS "score" FROM tb_resource_score WHERE 1 = 1 AND del_flag = 0 GROUP
|
||||||
LEFT JOIN ( SELECT resource_id, COUNT(id) AS "applyCount" FROM t_ability_application WHERE 1 = 1 AND del_flag = 0 GROUP BY resource_id ) taa ON tdr.id = taa.resource_id
|
BY resource_id ) trs ON tdr.id = trs.resource_id
|
||||||
LEFT JOIN ( SELECT resource_id, COUNT(id) AS "collectCount" FROM tb_resource_collection WHERE 1 = 1 AND del_flag = 0 GROUP BY resource_id ) trc ON tdr.id = trc.resource_id
|
LEFT JOIN ( SELECT resource_id, COUNT(id) AS "applyCount" FROM t_ability_application WHERE 1 = 1 AND del_flag =
|
||||||
LEFT JOIN ( SELECT resource_id, user_id, ( CASE COUNT( id ) WHEN 1 THEN 'true' ELSE 'false' END ) AS "isCollect" FROM tb_resource_collection WHERE
|
0 GROUP BY resource_id ) taa ON tdr.id = taa.resource_id
|
||||||
|
LEFT JOIN ( SELECT resource_id, COUNT(id) AS "collectCount" FROM tb_resource_collection WHERE 1 = 1 AND del_flag
|
||||||
|
= 0 GROUP BY resource_id ) trc ON tdr.id = trc.resource_id
|
||||||
|
LEFT JOIN ( SELECT resource_id, user_id, ( CASE COUNT( id ) WHEN 1 THEN 'true' ELSE 'false' END ) AS "isCollect"
|
||||||
|
FROM tb_resource_collection WHERE
|
||||||
1 = 1
|
1 = 1
|
||||||
AND del_flag = 0
|
AND del_flag = 0
|
||||||
AND user_id = #{dto.creator}
|
AND user_id = #{dto.creator}
|
||||||
|
@ -121,18 +126,18 @@
|
||||||
WHERE 1 = 1
|
WHERE 1 = 1
|
||||||
AND tdr.type = #{dto.type}
|
AND tdr.type = #{dto.type}
|
||||||
AND tdr.del_flag = 0
|
AND tdr.del_flag = 0
|
||||||
<if test="dto.name != null and dto.name != ''" >
|
<if test="dto.name != null and dto.name != ''">
|
||||||
AND tdr.name like CONCAT('%',#{dto.name},'%')
|
AND tdr.name like CONCAT('%',#{dto.name},'%')
|
||||||
</if>
|
</if>
|
||||||
<if test="dto.districtId != null and dto.districtId != ''" >
|
<if test="dto.districtId != null and dto.districtId != ''">
|
||||||
AND tdr.district_id = #{dto.districtId}
|
AND tdr.district_id = #{dto.districtId}
|
||||||
</if>
|
</if>
|
||||||
<if test="dto.deptId != null and dto.deptId != ''" >
|
<if test="dto.deptId != null and dto.deptId != ''">
|
||||||
AND tdr.dept_id = #{dto.deptId}
|
AND tdr.dept_id = #{dto.deptId}
|
||||||
</if>
|
</if>
|
||||||
<if test="dto.infoList.size > 0">
|
<if test="dto.infoList.size > 0">
|
||||||
AND
|
AND
|
||||||
tda.data_resource_id IN (
|
tda.data_resource_id IN (
|
||||||
SELECT data_resource_id
|
SELECT data_resource_id
|
||||||
FROM (
|
FROM (
|
||||||
SELECT tb.data_resource_id
|
SELECT tb.data_resource_id
|
||||||
|
@ -153,102 +158,115 @@
|
||||||
|
|
||||||
<select id="selectTypeCount" resultType="java.util.Map">
|
<select id="selectTypeCount" resultType="java.util.Map">
|
||||||
SELECT
|
SELECT
|
||||||
type,
|
type,
|
||||||
count(id) AS "count"
|
count(id) AS "count"
|
||||||
FROM tb_data_resource
|
FROM tb_data_resource
|
||||||
WHERE 1 = 1
|
WHERE 1 = 1
|
||||||
AND del_flag = 0
|
AND del_flag = 0
|
||||||
<if test="deptId != null and deptId != ''">
|
<if test="deptId != null and deptId != ''">
|
||||||
AND dept_id = #{deptId}
|
AND dept_id = #{deptId}
|
||||||
</if>
|
</if>
|
||||||
GROUP BY type
|
GROUP BY type
|
||||||
ORDER BY type
|
ORDER BY type
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectMostPopular" resultType="io.renren.modules.resource.dto.ResourceDTO">
|
<select id="selectMostPopular" resultType="io.renren.modules.resource.dto.ResourceDTO">
|
||||||
SELECT
|
SELECT
|
||||||
tdr.*,
|
tdr.*,
|
||||||
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",
|
||||||
(IFNULL(visits / 100, 0) + IFNULL(trs.score, 0) + IFNULL(applyCount,0)+ IFNULL(collectCount,0)) AS total
|
(IFNULL(visits / 100, 0) + IFNULL(trs.score, 0) + IFNULL(applyCount,0)+ IFNULL(collectCount,0)) AS total
|
||||||
FROM
|
FROM
|
||||||
tb_data_resource tdr
|
tb_data_resource tdr
|
||||||
LEFT JOIN ( SELECT resource_id, SUM(score) AS "score" FROM tb_resource_score WHERE 1 = 1 AND del_flag = 0 GROUP BY resource_id ) trs ON tdr.id = trs.resource_id
|
LEFT JOIN ( SELECT resource_id, SUM(score) AS "score" FROM tb_resource_score WHERE 1 = 1 AND del_flag = 0 GROUP
|
||||||
LEFT JOIN ( SELECT resource_id, COUNT(id) AS "applyCount" FROM t_ability_application WHERE 1 = 1 AND del_flag = 0 GROUP BY resource_id ) taa ON tdr.id = taa.resource_id
|
BY resource_id ) trs ON tdr.id = trs.resource_id
|
||||||
LEFT JOIN ( SELECT resource_id, COUNT(id) AS "collectCount" FROM tb_resource_collection WHERE 1 = 1 AND del_flag = 0 GROUP BY resource_id ) trc ON tdr.id = trc.resource_id
|
LEFT JOIN ( SELECT resource_id, COUNT(id) AS "applyCount" FROM t_ability_application WHERE 1 = 1 AND del_flag =
|
||||||
|
0 GROUP BY resource_id ) taa ON tdr.id = taa.resource_id
|
||||||
|
LEFT JOIN ( SELECT resource_id, COUNT(id) AS "collectCount" FROM tb_resource_collection WHERE 1 = 1 AND del_flag
|
||||||
|
= 0 GROUP BY resource_id ) trc ON tdr.id = trc.resource_id
|
||||||
WHERE
|
WHERE
|
||||||
1 = 1
|
1 = 1
|
||||||
AND tdr.del_flag = 0
|
AND tdr.del_flag = 0
|
||||||
<if test="type != null and type != ''">
|
<if test="type != null and type != ''">
|
||||||
AND tdr.type = #{type}
|
AND tdr.type = #{type}
|
||||||
</if>
|
</if>
|
||||||
<if test="name != null and name != ''">
|
<if test="name != null and name != ''">
|
||||||
AND tdr.name LIKE CONCAT('%',#{name},'%')
|
AND tdr.name LIKE CONCAT('%',#{name},'%')
|
||||||
</if>
|
</if>
|
||||||
ORDER BY ${orderFiled} ${orderType}
|
ORDER BY ${orderFiled} ${orderType}
|
||||||
LIMIT ${pageNum}, ${pageSize}
|
LIMIT ${pageNum}, ${pageSize}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectDTOById" resultMap="resourceDTO">
|
<select id="selectDTOById" resultMap="resourceDTO">
|
||||||
SELECT
|
SELECT
|
||||||
tdr.*,
|
tdr.*,
|
||||||
tda.*,
|
tda.*,
|
||||||
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",
|
||||||
sd.name as "deptName",
|
sd.name as "deptName",
|
||||||
IFNULL(trc2.isCollect, 'false') AS "isCollect",
|
IFNULL(trc2.isCollect, 'false') AS "isCollect",
|
||||||
IFNULL(taa2.applyState, 'false') AS "applyState"
|
IFNULL(taa2.applyState, 'false') AS "applyState"
|
||||||
FROM
|
FROM
|
||||||
tb_data_resource tdr
|
tb_data_resource tdr
|
||||||
LEFT JOIN tb_data_attr tda ON tdr.id = tda.data_resource_id
|
LEFT JOIN tb_data_attr tda ON tdr.id = tda.data_resource_id
|
||||||
LEFT JOIN ( SELECT resource_id, AVG(score) AS "score" FROM tb_resource_score WHERE 1 = 1 AND del_flag = 0 GROUP BY resource_id ) trs ON tdr.id = trs.resource_id
|
LEFT JOIN ( SELECT resource_id, AVG(score) AS "score" FROM tb_resource_score WHERE 1 = 1 AND del_flag = 0 GROUP
|
||||||
LEFT JOIN ( SELECT resource_id, COUNT(id) AS "applyCount" FROM t_ability_application WHERE 1 = 1 AND del_flag = 0 GROUP BY resource_id ) taa ON tdr.id = taa.resource_id
|
BY resource_id ) trs ON tdr.id = trs.resource_id
|
||||||
LEFT JOIN ( SELECT resource_id, COUNT(id) AS "collectCount" FROM tb_resource_collection WHERE 1 = 1 AND del_flag = 0 GROUP BY resource_id ) trc ON tdr.id = trc.resource_id
|
LEFT JOIN ( SELECT resource_id, COUNT(id) AS "applyCount" FROM t_ability_application WHERE 1 = 1 AND del_flag =
|
||||||
LEFT JOIN ( SELECT resource_id, user_id, ( CASE COUNT( id ) WHEN 1 THEN 'true' ELSE 'false' END ) AS "isCollect" FROM tb_resource_collection WHERE
|
0 GROUP BY resource_id ) taa ON tdr.id = taa.resource_id
|
||||||
1 = 1 AND del_flag = 0 AND user_id = #{userId}
|
LEFT JOIN ( SELECT resource_id, COUNT(id) AS "collectCount" FROM tb_resource_collection WHERE 1 = 1 AND del_flag
|
||||||
GROUP BY resource_id) trc2 ON tdr.id = trc2.resource_id
|
= 0 GROUP BY resource_id ) trc ON tdr.id = trc.resource_id
|
||||||
LEFT JOIN ( SELECT resource_id, user_id, ( CASE approve_status WHEN '通过' THEN 'true' ELSE 'false' END ) AS "applyState" FROM t_ability_application WHERE
|
LEFT JOIN ( SELECT resource_id, user_id, ( CASE COUNT( id ) WHEN 1 THEN 'true' ELSE 'false' END ) AS "isCollect"
|
||||||
1 = 1 AND del_flag = 0 AND user_id = #{userId}
|
FROM tb_resource_collection WHERE
|
||||||
GROUP BY id) taa2 ON tdr.id = taa2.resource_id
|
1 = 1 AND del_flag = 0 AND user_id = #{userId}
|
||||||
LEFT JOIN sys_dept sd ON tdr.dept_id = sd.id
|
GROUP BY resource_id) trc2 ON tdr.id = trc2.resource_id
|
||||||
|
LEFT JOIN ( SELECT resource_id, user_id, ( CASE approve_status WHEN '通过' THEN 'true' ELSE 'false' END ) AS
|
||||||
|
"applyState" FROM t_ability_application WHERE
|
||||||
|
1 = 1 AND del_flag = 0 AND user_id = #{userId}
|
||||||
|
GROUP BY id) taa2 ON tdr.id = taa2.resource_id
|
||||||
|
LEFT JOIN sys_dept sd ON tdr.dept_id = sd.id
|
||||||
WHERE 1 = 1
|
WHERE 1 = 1
|
||||||
<!-- AND tdr.del_flag = 0-->
|
<!-- AND tdr.del_flag = 0-->
|
||||||
AND tdr.id = #{id}
|
AND tdr.id = #{id}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectDTOPage" resultType="io.renren.modules.resource.dto.ResourceDTO">
|
<select id="selectDTOPage" resultType="io.renren.modules.resource.dto.ResourceDTO">
|
||||||
SELECT
|
SELECT
|
||||||
tdr.*,
|
tdr.*,
|
||||||
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",
|
||||||
sd.name AS "deptName",
|
sd.name AS "deptName",
|
||||||
IFNULL(trc2.isCollect, 'false') AS "isCollect",
|
IFNULL(trc2.isCollect, 'false') AS "isCollect",
|
||||||
IFNULL(taa2.applyState, 'false') AS "applyState",
|
IFNULL(taa2.applyState, 'false') AS "applyState",
|
||||||
(IFNULL(visits / 100, 0) + IFNULL(trs.score, 0) + IFNULL(applyCount,0)+ IFNULL(collectCount,0)) AS total
|
(IFNULL(visits / 100, 0) + IFNULL(trs.score, 0) + IFNULL(applyCount,0)+ IFNULL(collectCount,0)) AS total
|
||||||
FROM
|
FROM
|
||||||
tb_data_resource tdr
|
tb_data_resource tdr
|
||||||
LEFT JOIN ( SELECT resource_id, AVG(score) AS "score" FROM tb_resource_score WHERE 1 = 1 AND del_flag = 0 GROUP BY resource_id ) trs ON tdr.id = trs.resource_id
|
LEFT JOIN ( SELECT resource_id, AVG(score) AS "score" FROM tb_resource_score WHERE 1 = 1 AND del_flag = 0 GROUP
|
||||||
LEFT JOIN ( SELECT resource_id, COUNT(id) AS "applyCount" FROM t_ability_application WHERE 1 = 1 AND del_flag = 0 GROUP BY resource_id ) taa ON tdr.id = taa.resource_id
|
BY resource_id ) trs ON tdr.id = trs.resource_id
|
||||||
LEFT JOIN ( SELECT resource_id, COUNT(id) AS "collectCount" FROM tb_resource_collection WHERE 1 = 1 AND del_flag = 0 GROUP BY resource_id ) trc ON tdr.id = trc.resource_id
|
LEFT JOIN ( SELECT resource_id, COUNT(id) AS "applyCount" FROM t_ability_application WHERE 1 = 1 AND del_flag =
|
||||||
LEFT JOIN ( SELECT resource_id, user_id, ( CASE COUNT( id ) WHEN 1 THEN 'true' ELSE 'false' END ) AS "isCollect" FROM tb_resource_collection WHERE
|
0 GROUP BY resource_id ) taa ON tdr.id = taa.resource_id
|
||||||
1 = 1 AND del_flag = 0 AND user_id = #{dto.creator}
|
LEFT JOIN ( SELECT resource_id, COUNT(id) AS "collectCount" FROM tb_resource_collection WHERE 1 = 1 AND del_flag
|
||||||
GROUP BY resource_id) trc2 ON tdr.id = trc2.resource_id
|
= 0 GROUP BY resource_id ) trc ON tdr.id = trc.resource_id
|
||||||
LEFT JOIN ( SELECT resource_id, user_id, ( CASE approve_status WHEN '通过' THEN 'true' ELSE 'false' END ) AS "applyState" FROM t_ability_application WHERE
|
LEFT JOIN ( SELECT resource_id, user_id, ( CASE COUNT( id ) WHEN 1 THEN 'true' ELSE 'false' END ) AS "isCollect"
|
||||||
1 = 1 AND del_flag = 0 AND user_id = #{dto.creator}
|
FROM tb_resource_collection WHERE
|
||||||
GROUP BY id) taa2 ON tdr.id = taa2.resource_id
|
1 = 1 AND del_flag = 0 AND user_id = #{dto.creator}
|
||||||
LEFT JOIN sys_dept sd ON tdr.dept_id = sd.id
|
GROUP BY resource_id) trc2 ON tdr.id = trc2.resource_id
|
||||||
|
LEFT JOIN ( SELECT resource_id, user_id, ( CASE approve_status WHEN '通过' THEN 'true' ELSE 'false' END ) AS
|
||||||
|
"applyState" FROM t_ability_application WHERE
|
||||||
|
1 = 1 AND del_flag = 0 AND user_id = #{dto.creator}
|
||||||
|
GROUP BY id) taa2 ON tdr.id = taa2.resource_id
|
||||||
|
LEFT JOIN sys_dept sd ON tdr.dept_id = sd.id
|
||||||
WHERE 1 = 1
|
WHERE 1 = 1
|
||||||
AND tdr.del_flag = 0
|
AND tdr.del_flag = 0
|
||||||
<if test="dto.name != null and dto.name != ''" >
|
<if test="dto.name != null and dto.name != ''">
|
||||||
AND tdr.name LIKE CONCAT('%',#{dto.name},'%')
|
AND tdr.name LIKE CONCAT('%',#{dto.name},'%')
|
||||||
</if>
|
</if>
|
||||||
<if test="dto.type != null and dto.type != ''" >
|
<if test="dto.type != null and dto.type != ''">
|
||||||
AND tdr.type = #{dto.type}
|
AND tdr.type = #{dto.type}
|
||||||
</if>
|
</if>
|
||||||
<if test="dto.districtId != null and dto.districtId != ''" >
|
<if test="dto.districtId != null and dto.districtId != ''">
|
||||||
AND tdr.district_id = #{dto.districtId}
|
AND tdr.district_id = #{dto.districtId}
|
||||||
</if>
|
</if>
|
||||||
ORDER BY ${orderField} ${orderType}
|
ORDER BY ${orderField} ${orderType}
|
||||||
|
@ -257,35 +275,55 @@
|
||||||
|
|
||||||
<select id="selectApplyArea" resultType="java.util.Map">
|
<select id="selectApplyArea" resultType="java.util.Map">
|
||||||
SELECT
|
SELECT
|
||||||
*
|
*
|
||||||
FROM
|
FROM
|
||||||
(
|
(
|
||||||
SELECT
|
SELECT
|
||||||
attr_value,
|
attr_value,
|
||||||
IFNULL( COUNT( trc.id ), 0 ) AS "colCount",
|
IFNULL( COUNT( trc.id ), 0 ) AS "colCount",
|
||||||
IFNULL( COUNT( taa.id ), 0 ) AS "aplCount",
|
IFNULL( COUNT( taa.id ), 0 ) AS "aplCount",
|
||||||
(
|
(
|
||||||
IFNULL( COUNT( trc.id ), 0 ) + IFNULL( COUNT( taa.id ), 0 )) AS total
|
IFNULL( COUNT( trc.id ), 0 ) + IFNULL( COUNT( taa.id ), 0 )) AS total
|
||||||
FROM
|
FROM
|
||||||
tb_data_attr tda
|
tb_data_attr tda
|
||||||
LEFT JOIN tb_resource_collection trc ON tda.data_resource_id = trc.resource_id
|
LEFT JOIN tb_resource_collection trc ON tda.data_resource_id = trc.resource_id
|
||||||
AND trc.del_flag = 0
|
AND trc.del_flag = 0
|
||||||
AND trc.user_id = #{userId}
|
AND trc.user_id = #{userId}
|
||||||
LEFT JOIN t_ability_application taa ON tda.data_resource_id = taa.resource_id
|
LEFT JOIN t_ability_application taa ON tda.data_resource_id = taa.resource_id
|
||||||
AND taa.del_flag = 0
|
AND taa.del_flag = 0
|
||||||
AND taa.user_id = #{userId}
|
AND taa.user_id = #{userId}
|
||||||
|
|
||||||
WHERE
|
|
||||||
1 = 1
|
|
||||||
AND tda.attr_type = '应用领域'
|
|
||||||
AND tda.del_flag = 0
|
|
||||||
AND ( attr_value != '' AND attr_value IS NOT NULL )
|
|
||||||
GROUP BY
|
|
||||||
attr_value
|
|
||||||
ORDER BY
|
|
||||||
total DESC
|
|
||||||
) temp
|
|
||||||
WHERE
|
WHERE
|
||||||
temp.total != 0
|
1 = 1
|
||||||
|
AND tda.attr_type = '应用领域'
|
||||||
|
AND tda.del_flag = 0
|
||||||
|
AND ( attr_value != '' AND attr_value IS NOT NULL )
|
||||||
|
GROUP BY
|
||||||
|
attr_value
|
||||||
|
ORDER BY
|
||||||
|
total DESC
|
||||||
|
) temp
|
||||||
|
WHERE
|
||||||
|
temp.total != 0
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="getAmountGroupByType" resultType="java.util.Map">
|
||||||
|
SELECT
|
||||||
|
COUNT( id ) AS amount,
|
||||||
|
type AS type
|
||||||
|
FROM
|
||||||
|
tb_data_resource
|
||||||
|
WHERE
|
||||||
|
del_flag = 0
|
||||||
|
GROUP BY
|
||||||
|
type
|
||||||
|
</select>
|
||||||
|
<select id="countAllDept" resultType="java.lang.Long">
|
||||||
|
SELECT
|
||||||
|
COUNT( DISTINCT dept_id )
|
||||||
|
FROM
|
||||||
|
tb_data_resource
|
||||||
|
WHERE
|
||||||
|
del_flag = 0
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
|
@ -6,10 +6,10 @@
|
||||||
<select id="getList" resultType="io.renren.modules.sys.entity.SysUserEntity">
|
<select id="getList" resultType="io.renren.modules.sys.entity.SysUserEntity">
|
||||||
select t1.*, (select t2.name from sys_dept t2 where t2.id=t1.dept_id) deptName
|
select t1.*, (select t2.name from sys_dept t2 where t2.id=t1.dept_id) deptName
|
||||||
from sys_user t1
|
from sys_user t1
|
||||||
<if test = "postId != null and postId.trim() != '' ">
|
<if test="postId != null and postId.trim() != '' ">
|
||||||
left join sys_user_post t3 on t1.id = t3.user_id
|
left join sys_user_post t3 on t1.id = t3.user_id
|
||||||
</if>
|
</if>
|
||||||
where t1.super_admin = 0
|
where t1.super_admin = 0
|
||||||
<if test="username != null and username.trim() != ''">
|
<if test="username != null and username.trim() != ''">
|
||||||
and t1.username like #{username}
|
and t1.username like #{username}
|
||||||
</if>
|
</if>
|
||||||
|
@ -65,5 +65,13 @@
|
||||||
AND t2.dept_id = #{deptId}
|
AND t2.dept_id = #{deptId}
|
||||||
LIMIT 1
|
LIMIT 1
|
||||||
</select>
|
</select>
|
||||||
|
<select id="countAllUser" resultType="java.lang.Long">
|
||||||
|
SELECT
|
||||||
|
COUNT( id )
|
||||||
|
FROM
|
||||||
|
sys_user
|
||||||
|
WHERE
|
||||||
|
`status` = 1
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
|
@ -1,3 +1,3 @@
|
||||||
sso.domain=yw.com.cn
|
sso.domain=127.0.0.1:8080
|
||||||
sso.ssoKey=SSOToken
|
sso.ssoKey=SSOToken
|
||||||
sso.keeperUrl=http://127.0.0.1:9090/renren-admin/sys/user/123
|
sso.keeperUrl=http://jhoa.qd.gov.cn
|
|
@ -1,5 +1,6 @@
|
||||||
package io.renren;
|
package io.renren;
|
||||||
|
|
||||||
|
import cn.hutool.core.lang.UUID;
|
||||||
import io.renren.common.redis.RedisUtils;
|
import io.renren.common.redis.RedisUtils;
|
||||||
import io.renren.modules.processForm.service.ApiGatewayService;
|
import io.renren.modules.processForm.service.ApiGatewayService;
|
||||||
import io.renren.modules.sys.entity.SysUserEntity;
|
import io.renren.modules.sys.entity.SysUserEntity;
|
||||||
|
@ -17,8 +18,14 @@ public class ApiGatewayServiceTest {
|
||||||
private ApiGatewayService apiGatewayService;
|
private ApiGatewayService apiGatewayService;
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void contextLoads() {
|
public void registerApi2Gateway() {
|
||||||
apiGatewayService.registerApi2Gateway("1519505145602723841");
|
apiGatewayService.registerApi2Gateway("1522550194523152385");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void registerCode2Group() {
|
||||||
|
String code = UUID.randomUUID().toString();
|
||||||
|
apiGatewayService.subscribeCode("1523913824099762177", code);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue