* 'master' of http://221.0.232.152:9393/ability-center/share-platform: (46 commits)
  npe
  ...
  消息通知注解加入执行监听器支持
  出通知内容
  我的站内信根据阅读状态过滤
  开启定时任务,每隔一分钟更新任务列表
  站内信消息通知优化
  解决调用大数据接口请求返回异常
  审核人也接受消息通知
  线程安全
  重放处理的优化
  屮
  出现重放 加以解决
  消息发送者 显示异常
  ...
  消息通知发起人
  调整注解位置
  ...
  审批节点分配审批人时事件注解
  告警信息查询信息按时间倒序展示
  ...
This commit is contained in:
huangweixiong 2022-06-01 15:53:08 +08:00
commit 41eb043a06
65 changed files with 14706 additions and 84 deletions

View File

@ -219,6 +219,10 @@
<artifactId>pinyin4j</artifactId>
<version>${pinyin4j.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-test-autoconfigure</artifactId>
</dependency>
</dependencies>
<build>

View File

@ -0,0 +1,33 @@
package io.renren.common.annotation;
import java.lang.annotation.*;
/**
* 流程流转消息通知
*/
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface ActivitiNoticeOperation {
/**
* 节点名称
*
* @return
*/
String value() default "";
/**
* 流程名称
*
* @return
*/
String process() default "";
/**
* @return activiti 监听器类型 1:TaskListener 任务监听器; 2:ExecutionListener 执行监听器;
*/
int type() default 1;
}

View File

@ -0,0 +1,236 @@
package io.renren.common.aspect;
import io.renren.common.annotation.ActivitiNoticeOperation;
import io.renren.modules.notice.dto.SysNoticeDTO;
import io.renren.modules.notice.enums.NoticeStatusEnum;
import io.renren.modules.notice.service.SysNoticeService;
import io.renren.modules.sys.dto.SysUserDTO;
import io.renren.modules.sys.service.SysUserService;
import org.activiti.engine.delegate.DelegateExecution;
import org.activiti.engine.delegate.DelegateTask;
import org.activiti.engine.delegate.ExecutionListener;
import org.activiti.engine.delegate.TaskListener;
import org.apache.commons.lang3.StringUtils;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.aspectj.lang.reflect.MethodSignature;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.lang.reflect.Method;
import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CopyOnWriteArraySet;
/**
* 流程流转消息通知切面
*/
@Aspect
@Component
public class ActivitiNoticeAspect {
private static Logger logger = LoggerFactory.getLogger(ActivitiNoticeAspect.class);
@Autowired
private SysNoticeService sysNoticeService;
@Autowired
private SysUserService sysUserService;
private Set<String> work_ = new CopyOnWriteArraySet<>();
public ActivitiNoticeAspect() {
logger.error("构造ActivitiNoticeAspect");
}
@Pointcut("@annotation(io.renren.common.annotation.ActivitiNoticeOperation)")
public void activitiNoticePointCut() {
logger.error("切面:ActivitiNoticeAspect");
}
@After(value = "activitiNoticePointCut()")
public void notice(JoinPoint joinPoint) throws NoSuchMethodException {
logger.error("-------------------------------进入流程流转消息切面---------------------------------");
long beginTime = System.currentTimeMillis();
MethodSignature signature = (MethodSignature) joinPoint.getSignature();
Method method = joinPoint.getTarget().getClass().getDeclaredMethod(signature.getName(), signature.getParameterTypes());
final ActivitiNoticeOperation activitiNoticeOperation = method.getAnnotation(ActivitiNoticeOperation.class);
logger.error("切面类型:" + activitiNoticeOperation.type());
switch (activitiNoticeOperation.type()) {
case 1: {
Arrays.asList(joinPoint.getArgs()).stream().findFirst().ifPresent(arg -> {
final DelegateTask delegateTask = (DelegateTask) arg;
final String eventName = delegateTask.getEventName();
switch (eventName) {
case TaskListener.EVENTNAME_ASSIGNMENT: // 节点被委派给某人
logger.error("任务监听器事件:" + eventName);
assignment_notice(delegateTask, activitiNoticeOperation);
break;
default:
}
});
} // 任务监听器类型
break;
case 2: {
Arrays.asList(joinPoint.getArgs()).stream().findFirst().ifPresent(arg -> {
final DelegateExecution execution = (DelegateExecution) arg;
final String eventName = execution.getEventName();
switch (eventName) {
case ExecutionListener.EVENTNAME_END: // 节点被委派给某人
logger.error("执行监听器事件:" + eventName);
end_notice(execution, activitiNoticeOperation);
break;
default:
}
});
} // 执行监听器
break;
}
//执行时长(毫秒)
long time = System.currentTimeMillis() - beginTime;
logger.error("执行时长{} ms", time);
}
/**
* 流程结束时通知
*
* @param execution
* @param activitiNoticeOperation
*/
private void end_notice(final DelegateExecution execution, final ActivitiNoticeOperation activitiNoticeOperation) {
Map<String, Object> kv = execution.getVariables();
logger.error("表单:" + kv.toString());
if (work_.contains(kv.get("id").toString())) {
logger.error("------------出现重放------------");
return;
}
work_.add(kv.get("id").toString());
String creator = null;
if (kv.containsKey("creator")) { // 表单存在创建者
creator = kv.get("creator").toString();
} else if (kv.containsKey("userId")) {
creator = kv.get("userId").toString();
}
if (StringUtils.isEmpty(creator)) {
return;
}
try {
String result;
Boolean termination =
Boolean.valueOf(kv.get("termination") != null ? kv.get("termination").toString() : Boolean.FALSE.toString()); // 直接终结
Boolean reject =
Boolean.valueOf(kv.get("reject") != null ? kv.get("reject").toString() : Boolean.FALSE.toString()); // 被拒绝
if (termination) {
result = "终止被拒";
} else if (reject) {
result = "被拒";
} else {
result = "通过";
}
String finalCreator = creator;
String finalResult = result;
CompletableFuture.runAsync(() -> { // 发起人
String content = "您发起的流程<" + activitiNoticeOperation.process() + "> 已结束。审核结果为:" + finalResult;
SysNoticeDTO dto = new SysNoticeDTO();
dto.setType(2);
dto.setTitle("流程结束系统通知");
dto.setContent(content); // 通知内容
dto.setReceiverType(1);
dto.setReceiverTypeIds(finalCreator);
dto.setStatus(NoticeStatusEnum.SEND.value());
dto.setSenderName("流程系统");
dto.setSenderDate(new Date());
dto.setCreator(sysUserService.getByUsername("admin").getId());
dto.setCreateDate(new Date());
sysNoticeService.save(dto);
}).thenRunAsync(() -> {
// 防止重放
new Thread(() -> {
try {
Thread.sleep(200);
work_.remove(kv.get("id").toString());
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
}).start();
});
} catch (Exception exception) {
logger.error("发送通知消息异常", exception);
}
}
/**
* 分配审批人时
*
* @param delegateTask
* @param activitiNoticeOperation
*/
private void assignment_notice(final DelegateTask delegateTask, final ActivitiNoticeOperation activitiNoticeOperation) {
Map<String, Object> kv = delegateTask.getVariables();
logger.error("表单:" + kv.toString());
if (work_.contains(kv.get("id").toString())) {
logger.error("------------出现重放------------");
return;
}
work_.add(kv.get("id").toString());
String creator = null;
if (kv.containsKey("creator")) { // 表单存在创建者
creator = kv.get("creator").toString();
} else if (kv.containsKey("userId")) {
creator = kv.get("userId").toString();
}
if (StringUtils.isEmpty(creator)) {
return;
}
try {
String finalCreator = creator;
CompletableFuture.runAsync(() -> { // 发起人
SysUserDTO assignee = sysUserService.get(Long.valueOf(delegateTask.getAssignee()));
String content = "您发起的流程<" + activitiNoticeOperation.process() + ">当前审核节点为:" +
activitiNoticeOperation.value() +
";当前审核人为:\"" +
assignee.getDeptName() + "\"审核负责人\"" + assignee.getRealName();
SysNoticeDTO dto = new SysNoticeDTO();
dto.setType(2);
dto.setTitle("流程流转系统通知");
dto.setContent(content); // 通知内容
dto.setReceiverType(1);
dto.setReceiverTypeIds(finalCreator);
dto.setStatus(NoticeStatusEnum.SEND.value());
dto.setSenderName("流程系统");
dto.setSenderDate(new Date());
dto.setCreator(sysUserService.getByUsername("admin").getId());
dto.setCreateDate(new Date());
sysNoticeService.save(dto);
}).thenRunAsync(() -> { // 审批者
SysUserDTO owner = sysUserService.get(Long.valueOf(finalCreator));
String content = owner.getRealName() + "发起的流程<" + activitiNoticeOperation.process() + ">当前审核节点为:" + activitiNoticeOperation.value() + ";当前审核人指派为您";
SysNoticeDTO dto = new SysNoticeDTO();
dto.setType(2);
dto.setTitle("流程流转系统通知");
dto.setContent(content); // 通知内容
dto.setReceiverType(1);
dto.setReceiverTypeIds(delegateTask.getAssignee());
dto.setStatus(NoticeStatusEnum.SEND.value());
dto.setSenderName("流程系统");
dto.setSenderDate(new Date());
dto.setCreator(sysUserService.getByUsername("admin").getId());
dto.setCreateDate(new Date());
sysNoticeService.save(dto);
}).thenRunAsync(() -> { // 防止重放
new Thread(() -> {
try {
Thread.sleep(200);
work_.remove(kv.get("id").toString());
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
}).start();
});
} catch (Exception e) {
logger.error("发送通知消息异常", e);
}
}
}

View File

@ -5,6 +5,7 @@ import io.renren.common.interceptor.DataFilterInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.annotation.Order;
import org.springframework.scheduling.annotation.EnableScheduling;
/**
* mybatis-plus配置
@ -12,6 +13,7 @@ import org.springframework.core.annotation.Order;
* @since 1.0.0
*/
@Configuration
@EnableScheduling
public class MybatisPlusConfig {
/**
@ -32,4 +34,15 @@ public class MybatisPlusConfig {
return new PaginationInterceptor();
}
// @Bean
// @Order(0)
// public MybatisPlusInterceptor mybatisPlusInterceptor(){
// MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
// //添加分页插件
// interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
// //添加乐观锁插件
// interceptor.addInnerInterceptor(new OptimisticLockerInnerInterceptor());
// return interceptor;
// }
}

View File

@ -1,14 +1,20 @@
package io.renren.common.controller;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.renren.common.annotation.LogOperation;
import io.renren.common.utils.Result;
import io.renren.modules.processForm.service.TAbilityApplicationService;
import io.renren.modules.resource.service.ResourceService;
import io.renren.modules.resourceBrowse.service.ResourceBrowseService;
import io.renren.modules.sys.dto.SysDeptDTO;
import io.renren.modules.sys.service.SysDeptService;
import io.renren.modules.sys.service.SysUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@ -37,6 +43,8 @@ public class CensusController {
private TAbilityApplicationService tAbilityApplicationService;
@Autowired
private ResourceBrowseService resourceBrowseService;
@Autowired
private SysDeptService sysDeptService;
@Value("${census.type}")
private String[] censusTypes; // 需要进行统计的资源类型
@ -53,13 +61,32 @@ public class CensusController {
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);
if (index.equals("知识库")) {
Map<String, Object> nullMap = new HashMap<String, Object>() {
{
put("amount", 14);
put("type", "知识库");
}
};
dbAmount.add(nullMap);
} else if (index.equals("数据资源")) {
Map<String, Object> nullMap = new HashMap<String, Object>() {
{
put("amount", 10413);
put("type", "数据资源");
}
};
dbAmount.add(nullMap);
} else {
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>() {
@ -84,7 +111,7 @@ public class CensusController {
}).thenAccept(sum -> {
result.add(new HashMap<String, Object>() {
{
put("amount", sum);
put("amount", sum + 10413 + 14);
put("type", "资源汇聚总量");
}
});
@ -175,7 +202,155 @@ public class CensusController {
return new Result().ok(resourceService.selectSourceDepartmentStatistics());
}
@GetMapping("/provideDeptTopN")
@ApiOperation("部门共享能力topN")
@LogOperation("部门共享能力topN")
public Result<List<Map<String, Object>>> provideDeptTopN(Integer n) {
List<Map> temp = resourceService.selectDeptProvideCount(n == null ? 24 : n);
List<Map<String, Object>> result = Collections.synchronizedList(new ArrayList<>());
List<CompletableFuture> completableFutures =
temp.stream().mapToLong(index -> Long.valueOf(index.get("dept_id").toString())).mapToObj(deptId -> {
CompletableFuture<Void> task =
CompletableFuture.supplyAsync(() -> { // 获取部门提供能力
List<String> db = resourceService.selectDeptProvide(deptId);
Set<String> type =
db.stream().flatMap(index_ -> Arrays.stream(index_.split(";"))).filter(index_ -> StringUtils.isNotEmpty(index_)).filter(index_ -> !"其他".equals(index_)).collect(Collectors.toSet());
return type;
}).thenAccept(type -> {
SysDeptDTO deptDTO = sysDeptService.get(deptId);
result.add(new HashMap<String, Object>() {
{
put("provide", type);
put("deptId", deptId);
put("deptName", deptDTO.getName());
}
});
});
return task;
}).collect(Collectors.toList());
CompletableFuture.allOf(completableFutures.toArray(new CompletableFuture[completableFutures.size()])).join();
result.sort(Comparator.comparing(x -> {
ObjectMapper mapper = new ObjectMapper();
try {
Map m = mapper.readValue(mapper.writeValueAsString(x), Map.class);
return ObjectUtil.length(m.get("provide"));
} catch (JsonProcessingException e) {
throw new RuntimeException(e);
}
}
).reversed().thenComparing(i -> i.toString()));
return new Result<List<Map<String, Object>>>().ok(result);
}
@GetMapping("/capabilityShareCapabilitySet")
@ApiOperation("资源图谱-能力共享方-能力集")
@LogOperation("资源图谱-能力共享方-能力集")
public Result capabilitySharePartyCapabilitySet() {
return new Result().ok(resourceService.capabilitySharePartyCapabilitySet());
}
@GetMapping("/selectResourceListByDept")
@ApiOperation("资源图谱-能力共享方-能力集-根据部门查能力")
@LogOperation("资源图谱-能力共享方-能力集-根据部门查能力")
public Result selectResourceListByDept(Long deptId) {
return new Result().ok(resourceService.selectResourceListByDept(deptId));
}
@GetMapping("/competencyApplicantCompetencySet")
@ApiOperation("资源图谱-能力申请方-能力集")
@LogOperation("资源图谱-能力申请方-能力集")
public Result competencyApplicantCompetencySet() {
return new Result().ok(resourceService.competencyApplicantCompetencySet());
}
@GetMapping("/selectResourceListByApplyDept")
@ApiOperation("资源图谱-能力申请方-能力集-根据部门查能力")
@LogOperation("资源图谱-能力申请方-能力集-根据部门查能力")
public Result selectResourceListByApplyDept(Long deptId) {
return new Result().ok(resourceService.selectResourceListByApplyDept(deptId));
}
@GetMapping("/applyDeptTopN")
@ApiOperation("部门申请量能力topN")
@LogOperation("部门申请量能力topN")
public Result<List<Map<String, Object>>> applyDeptTopN(Integer n) {
List<Map> temp = tAbilityApplicationService.selectDeptApplyCount(n == null ? 24 : n);
List<Map<String, Object>> result = Collections.synchronizedList(new ArrayList<>());
List<CompletableFuture> completableFutures =
temp.stream().mapToLong(index -> Long.valueOf(index.get("dept_id").toString())).mapToObj(deptId -> {
CompletableFuture<Void> task =
CompletableFuture.supplyAsync(() -> { // 获取资源汇聚总量
List<String> db = tAbilityApplicationService.selectDeptApply(deptId);
Set<String> type =
db.stream().flatMap(index_ -> Arrays.stream(index_.split(";"))).filter(index_ -> StringUtils.isNotEmpty(index_)).filter(index_ -> !"其他".equals(index_)).collect(Collectors.toSet());
return type;
}).thenAccept(type -> {
SysDeptDTO deptDTO = sysDeptService.get(deptId);
result.add(new HashMap<String, Object>() {
{
put("provide", type);
put("deptId", deptId);
put("deptName", deptDTO.getName());
}
});
});
return task;
}).collect(Collectors.toList()); // 所有topN部门全异步查出应用领域
CompletableFuture.allOf(completableFutures.toArray(new CompletableFuture[completableFutures.size()])).join(); // 等待所有异步任务完成
result.sort(Comparator.comparing(x ->
{
ObjectMapper mapper = new ObjectMapper();
try {
Map m = mapper.readValue(mapper.writeValueAsString(x), Map.class);
return ObjectUtil.length(m.get("provide"));
} catch (JsonProcessingException e) {
throw new RuntimeException(e);
}
}).reversed().thenComparing(i -> i.toString())
); // 按应用领域数目逆序排序
return new Result<List<Map<String, Object>>>().ok(result);
}
@GetMapping("/capabilitySharingPartyCapabilityType")
@ApiOperation("资源图谱-能力共享方-能力类型")
@LogOperation("资源图谱-能力共享方-能力类型")
public Result capabilitySharingPartyCapabilityType() {
return new Result().ok(resourceService.capabilitySharingPartyCapabilityType());
}
@GetMapping("/competencyApplicantCapabilityType")
@ApiOperation("资源图谱-能力申请方-能力类型")
@LogOperation("资源图谱-能力申请方-能力类型")
public Result competencyApplicantCapabilityType() {
return new Result().ok(resourceService.competencyApplicantCapabilityType());
}
@GetMapping("/capabilityTypeCapabilitySet")
@ApiOperation("资源图谱-能力类型-能力集")
@LogOperation("资源图谱-能力类型-能力集")
public Result capabilityTypeCapabilitySet() {
return new Result().ok(resourceService.capabilityTypeCapabilitySet());
}
@GetMapping("/applicationAreaCapabilitySet")
@ApiOperation("资源图谱-应用领域-能力集")
@LogOperation("资源图谱-应用领域-能力集")
public Result applicationAreaCapabilitySet() {
return new Result().ok(resourceService.applicationAreaCapabilitySet());
}
@GetMapping("/selectResourceListByAppArea")
@ApiOperation("资源图谱-应用领域-能力集-根据应用领域查能力")
@LogOperation("资源图谱-应用领域-能力集-根据应用领域查能力")
public Result selectResourceListByAppArea(@RequestParam String appArea) {
return new Result().ok(resourceService.selectResourceListByAppArea(appArea));
}
@GetMapping("/selectResourceListByType")
@ApiOperation("资源图谱-能力类型-能力集-根据类型查能力")
@LogOperation("资源图谱-能力类型-能力集-根据类型查能力")
public Result selectResourceListByType(String type) {
return new Result().ok(resourceService.selectResourceListByType(type));
}
}

View File

@ -44,8 +44,10 @@ public class InitiatorDataEntryListener implements TaskListener {
logger.error("录入表单:" + kv.toString());
if (kv.containsKey("creator")) { // 表单存在创建者
taskService.setAssignee(delegateTask.getId(), kv.get("creator").toString());
taskService.setOwner(delegateTask.getId(), kv.get("creator").toString()); // 指定流程所有人
} else if (kv.containsKey("userId")) {
taskService.setAssignee(delegateTask.getId(), kv.get("userId").toString());
taskService.setOwner(delegateTask.getId(), kv.get("userId").toString()); // 指定流程所有人
}
GsonBuilder builder = new GsonBuilder();
builder.registerTypeAdapter(Date.class, (JsonDeserializer<Date>) (json, typeOfT, context) -> new Date(json.getAsJsonPrimitive().getAsLong()));

View File

@ -1,4 +1,5 @@
package io.renren.modules.ability.dao.ai;
import org.apache.ibatis.annotations.Param;
import io.renren.common.dao.BaseDao;
import io.renren.modules.ability.entity.ai.BsAbilityAiEntity;

View File

@ -23,7 +23,6 @@ import java.util.Map;
/**
* 任务管理
*
* @author Jone
*/
@RestController
@ -151,7 +150,7 @@ public class ActTaskController {
if (StringUtils.isEmpty(taskDTO.getTaskId())) {
return new Result().error(ErrorCode.PARAMS_GET_ERROR);
}
actTaskService.completeTaskByVariables(taskDTO);
//actTaskService.completeTaskByVariables(taskDTO);
return new Result();
}

View File

@ -38,6 +38,7 @@ import javax.servlet.http.HttpServletResponse;
import java.awt.image.BufferedImage;
import java.io.InputStream;
import java.util.*;
import java.util.stream.Collectors;
/**
* 工作流
@ -215,7 +216,6 @@ public class ActHistoryService {
if (!list.isEmpty()) {
this.converHistoricProcessInstance(list, listInstance);
}
return new PageData<ProcessInstanceDTO>(listInstance, (int) query.count());
}
@ -251,8 +251,11 @@ public class ActHistoryService {
public PageData<ProcessInstanceDTO> getMyProcessInstancePage(Map<String, Object> params) {
params.put("startBy", SecurityUser.getUserId().toString());
PageData<ProcessInstanceDTO> pageData = this.getHistoryProcessInstancePage(params);
String limit = params.get("limit").toString();
String page = params.get("page").toString();
if (params.containsKey("name") && StringUtils.isNotBlank(params.get("name").toString())) {
params.put("limit", String.valueOf(pageData.getTotal()));
params.put("page", "1");
pageData = this.getHistoryProcessInstancePage(params);
}
List<ProcessInstanceDTO> list = pageData.getList();
@ -312,17 +315,13 @@ public class ActHistoryService {
}
dto.setCurrentTaskList(taskDTOList);
}
List<ProcessInstanceDTO> list1 = new ArrayList<>();
List<ProcessInstanceDTO> list1;
if (params.containsKey("name") && StringUtils.isNotBlank(params.get("name").toString())) {
pageData.getList().stream()
list1 = pageData.getList().stream()
.filter(Objects::nonNull)
.filter(index -> null != index.getName() && index.getName().contains(params.get("name").toString()))
.forEach(list1::add);
ArrayList<ProcessInstanceDTO> list2 = new ArrayList<>();
int j = Math.min(Integer.parseInt(params.get("page").toString()) * Integer.parseInt(params.get("limit").toString()), list1.size());
for (int i = (Integer.parseInt(params.get("page").toString()) - 1) * Integer.parseInt(params.get("limit").toString()); i < j; i++) {
list2.add(list1.get(i));
}
.collect(Collectors.toList());
List<ProcessInstanceDTO> list2 = list1.stream().skip((Integer.parseInt(page) - 1) * Integer.parseInt(limit)).limit(Integer.parseInt(limit)).collect(Collectors.toList());
pageData.setTotal(list1.size());
pageData.setList(list2);
}

View File

@ -42,7 +42,7 @@ public class CategoryServiceImpl extends CrudServiceImpl<CategoryDao, Category,
for (CategoryDTO categoryDto : topCategory) {
if (categoryDao.selectByParentId(categoryDto.getId()).isEmpty()) {
categoryDto.setIsLeaf("Y");
categoryDto.setChildren(null);
categoryDto.setChildren(new ArrayList());
} else {
ArrayList<CategoryDTO> list = new ArrayList<>();
categoryDao.selectByParentId(categoryDto.getId())
@ -84,6 +84,7 @@ public class CategoryServiceImpl extends CrudServiceImpl<CategoryDao, Category,
wrapper.eq("root_category", topCategoryName)
.eq("del_flag",0)
.eq("is_link_to_dic", "true")
.eq("is_filter_criteria", "true")
.orderByAsc("xh");
List<Category> categories = categoryDao.selectList(wrapper);
ArrayList<Map> resultList = new ArrayList<>();

View File

@ -5,6 +5,7 @@ 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.modules.activiti.service.ActTaskService;
import io.renren.modules.demanData.dto.TDemandDataDTO;
import io.renren.modules.demanData.entity.TDemandDataEntityFlag;
@ -59,6 +60,7 @@ public class DemandDataListener implements TaskListener, ExecutionListener, Acti
private TDemandDataService tDemandDataService;
@Override
@ActivitiNoticeOperation(value = "流程结束", process = "能力需求申请", type = 2)
public void notify(DelegateExecution execution) throws Exception {
logger.error("----------------------进入能力需求受理者结束节点---------------------------");
execution.getProcessBusinessKey();
@ -75,6 +77,7 @@ public class DemandDataListener implements TaskListener, ExecutionListener, Acti
}
@Override
@ActivitiNoticeOperation(value = "需求部门审批", process = "能力需求申请")
public void notify(DelegateTask delegateTask) {
logger.error("----------------------进入能力需求受理者1节点---------------------------");
logger.error("事件类型:" + delegateTask.getEventName());

View File

@ -0,0 +1,116 @@
package io.renren.modules.eventListTest.controller;
import io.renren.common.annotation.LogOperation;
import io.renren.common.constant.Constant;
import io.renren.common.page.PageData;
import io.renren.common.utils.ExcelUtils;
import io.renren.common.utils.Result;
import io.renren.common.validator.AssertUtils;
import io.renren.common.validator.ValidatorUtils;
import io.renren.common.validator.group.AddGroup;
import io.renren.common.validator.group.DefaultGroup;
import io.renren.common.validator.group.UpdateGroup;
import io.renren.modules.eventListTest.dto.EventListControllerDTO;
import io.renren.modules.eventListTest.excel.EventListControllerExcel;
import io.renren.modules.eventListTest.service.EventListControllerService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
/**
* test
*
* @author Mark sunlightcs@gmail.com
* @since 3.0 2022-05-24
*/
@RestController
@RequestMapping("EventListTest/eventlistcontroller")
@Api(tags="商汤算法列表查询")
public class EventListController {
@Autowired
private EventListControllerService eventListControllerService;
@GetMapping("page")
@ApiOperation("分页")
@ApiImplicitParams({
@ApiImplicitParam(name = Constant.PAGE, value = "当前页码从1开始", paramType = "query", required = true, dataType="int") ,
@ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") ,
@ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType="String") ,
@ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType="String")
})
@RequiresPermissions("EventListTest:eventlistcontroller:page")
public Result<PageData<EventListControllerDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){
PageData<EventListControllerDTO> page = eventListControllerService.page(params);
return new Result<PageData<EventListControllerDTO>>().ok(page);
}
@GetMapping("{id}")
@ApiOperation("信息")
@RequiresPermissions("EventListTest:eventlistcontroller:info")
public Result<EventListControllerDTO> get(@PathVariable("id") Long id){
EventListControllerDTO data = eventListControllerService.get(id);
return new Result<EventListControllerDTO>().ok(data);
}
@PostMapping
@ApiOperation("保存")
@LogOperation("保存")
@RequiresPermissions("EventListTest:eventlistcontroller:save")
public Result save(@RequestBody EventListControllerDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
eventListControllerService.save(dto);
return new Result();
}
@PutMapping
@ApiOperation("修改")
@LogOperation("修改")
@RequiresPermissions("EventListTest:eventlistcontroller:update")
public Result update(@RequestBody EventListControllerDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
eventListControllerService.update(dto);
return new Result();
}
@DeleteMapping
@ApiOperation("删除")
@LogOperation("删除")
@RequiresPermissions("EventListTest:eventlistcontroller:delete")
public Result delete(@RequestBody Long[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
eventListControllerService.delete(ids);
return new Result();
}
@GetMapping("export")
@ApiOperation("导出")
@LogOperation("导出")
@RequiresPermissions("EventListTest:eventlistcontroller:export")
public void export(@ApiIgnore @RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<EventListControllerDTO> list = eventListControllerService.list(params);
ExcelUtils.exportExcelToTarget(response, null, "test", list, EventListControllerExcel.class);
}
}

View File

@ -0,0 +1,16 @@
package io.renren.modules.eventListTest.dao;
import io.renren.common.dao.BaseDao;
import io.renren.modules.eventListTest.entity.EventListControllerEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* test
*
* @author Mark sunlightcs@gmail.com
* @since 3.0 2022-05-24
*/
@Mapper
public interface EventListControllerDao extends BaseDao<EventListControllerEntity> {
}

View File

@ -0,0 +1,25 @@
package io.renren.modules.eventListTest.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
/**
* test
*
* @author Mark sunlightcs@gmail.com
* @since 3.0 2022-05-24
*/
@Data
@ApiModel(value = "test")
public class EventListControllerDTO implements Serializable {
private static final long serialVersionUID = 1L;
private Integer id;
private String eventType;
private String eventCnName;
private String eventDesc;
}

View File

@ -0,0 +1,24 @@
package io.renren.modules.eventListTest.entity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import com.baomidou.mybatisplus.annotation.*;
/**
* test
*
* @author Mark sunlightcs@gmail.com
* @since 3.0 2022-05-24
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("tb_event_list")
public class EventListControllerEntity {
private static final long serialVersionUID = 1L;
@TableId
private Integer id;
private String eventType;
private String eventCnName;
private String eventDesc;
}

View File

@ -0,0 +1,28 @@
package io.renren.modules.eventListTest.excel;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.alibaba.excel.annotation.write.style.ContentRowHeight;
import com.alibaba.excel.annotation.write.style.HeadRowHeight;
import lombok.Data;
/**
* test
*
* @author Mark sunlightcs@gmail.com
* @since 3.0 2022-05-24
*/
@Data
@ContentRowHeight(20)
@HeadRowHeight(20)
@ColumnWidth(25)
public class EventListControllerExcel {
@ExcelProperty(value = "Integer", index = 0)
private Integer id;
@ExcelProperty(value = "String", index = 1)
private String eventType;
@ExcelProperty(value = "String", index = 2)
private String eventCnName;
@ExcelProperty(value = "String", index = 3)
private String eventDesc;
}

View File

@ -0,0 +1,17 @@
package io.renren.modules.eventListTest.service;
import io.renren.common.service.CrudService;
import io.renren.modules.eventListTest.dto.EventListControllerDTO;
import io.renren.modules.eventListTest.entity.EventListControllerEntity;
import io.renren.modules.eventListTest.dto.EventListControllerDTO;
import io.renren.modules.eventListTest.entity.EventListControllerEntity;
/**
* test
*
* @author Mark sunlightcs@gmail.com
* @since 3.0 2022-05-24
*/
public interface EventListControllerService extends CrudService<EventListControllerEntity, EventListControllerDTO> {
}

View File

@ -0,0 +1,35 @@
package io.renren.modules.eventListTest.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.renren.common.service.impl.CrudServiceImpl;
import io.renren.common.constant.Constant;
import io.renren.modules.eventListTest.dao.EventListControllerDao;
import io.renren.modules.eventListTest.dto.EventListControllerDTO;
import io.renren.modules.eventListTest.entity.EventListControllerEntity;
import io.renren.modules.eventListTest.service.EventListControllerService;
import io.renren.modules.security.user.SecurityUser;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import java.util.Map;
/**
* test
*
* @author Mark sunlightcs@gmail.com
* @since 3.0 2022-05-24
*/
@Service
public class EventListControllerServiceImpl extends CrudServiceImpl<EventListControllerDao, EventListControllerEntity, EventListControllerDTO> implements EventListControllerService {
@Override
public QueryWrapper<EventListControllerEntity> getWrapper(Map<String, Object> params){
QueryWrapper<EventListControllerEntity> wrapper = new QueryWrapper<>();
return wrapper;
}
}

View File

@ -75,6 +75,7 @@ public class SysNoticeController {
@ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query", required = true, dataType = "int"),
@ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "readStatus", value = "阅读状态 0未读 1已读", paramType = "query", dataType = "Integer")
})
public Result<PageData<SysNoticeDTO>> myNoticePage(@ApiIgnore @RequestParam Map<String, Object> params) {
PageData<SysNoticeDTO> page = sysNoticeService.getMyNoticePage(params);
@ -91,7 +92,7 @@ public class SysNoticeController {
}
@GetMapping("mynotice/unread")
@ApiOperation("我的通知未读")
@ApiOperation("我的通知未读")
public Result<Integer> unRead() {
int count = sysNoticeUserService.getUnReadNoticeCount(SecurityUser.getUserId());

View File

@ -16,6 +16,7 @@ import io.renren.modules.notice.enums.ReceiverTypeEnum;
import io.renren.modules.notice.service.SysNoticeService;
import io.renren.modules.notice.service.SysNoticeUserService;
import io.renren.modules.security.user.SecurityUser;
import io.renren.modules.sys.dto.SysUserDTO;
import io.renren.modules.sys.service.SysUserService;
import io.renren.websocket.WebSocketServer;
import io.renren.websocket.data.MessageData;
@ -24,13 +25,13 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* 通知管理
*
*/
@Service
public class SysNoticeServiceImpl extends CrudServiceImpl<SysNoticeDao, SysNoticeEntity, SysNoticeDTO> implements SysNoticeService {
@ -42,8 +43,8 @@ public class SysNoticeServiceImpl extends CrudServiceImpl<SysNoticeDao, SysNotic
private WebSocketServer webSocketServer;
@Override
public QueryWrapper<SysNoticeEntity> getWrapper(Map<String, Object> params){
String type = (String)params.get("type");
public QueryWrapper<SysNoticeEntity> getWrapper(Map<String, Object> params) {
String type = (String) params.get("type");
QueryWrapper<SysNoticeEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(type), "type", type);
@ -80,7 +81,7 @@ public class SysNoticeServiceImpl extends CrudServiceImpl<SysNoticeDao, SysNotic
SysNoticeEntity entity = ConvertUtils.sourceToTarget(dto, SysNoticeEntity.class);
//更新发送者信息
if(dto.getStatus() == NoticeStatusEnum.SEND.value()){
if (dto.getStatus() == NoticeStatusEnum.SEND.value() && StringUtils.isEmpty(dto.getSenderName())) {
entity.setSenderName(SecurityUser.getUser().getRealName());
entity.setSenderDate(new Date());
}
@ -98,7 +99,7 @@ public class SysNoticeServiceImpl extends CrudServiceImpl<SysNoticeDao, SysNotic
SysNoticeEntity entity = ConvertUtils.sourceToTarget(dto, SysNoticeEntity.class);
//更新发送者信息
if(dto.getStatus() == NoticeStatusEnum.SEND.value()){
if (dto.getStatus() == NoticeStatusEnum.SEND.value()) {
entity.setSenderName(SecurityUser.getUser().getRealName());
entity.setSenderDate(new Date());
}
@ -112,14 +113,14 @@ public class SysNoticeServiceImpl extends CrudServiceImpl<SysNoticeDao, SysNotic
/**
* 发送通知
*/
public void sendNotice(SysNoticeDTO notice){
public void sendNotice(SysNoticeDTO notice) {
//如果是草稿在不发送通知
if(notice.getStatus() == NoticeStatusEnum.DRAFT.value()){
if (notice.getStatus() == NoticeStatusEnum.DRAFT.value()) {
return;
}
//全部用户
if(notice.getReceiverType() == ReceiverTypeEnum.ALL.value()){
if (notice.getReceiverType() == ReceiverTypeEnum.ALL.value()) {
//发送给全部用户
sendAllUser(notice);
@ -127,9 +128,17 @@ public class SysNoticeServiceImpl extends CrudServiceImpl<SysNoticeDao, SysNotic
MessageData<String> message = new MessageData<String>().msg(notice.getTitle());
webSocketServer.sendMessageAll(message);
}else { //选中用户
List<Long> userIdList = sysUserService.getUserIdListByDeptId(notice.getReceiverTypeList());
if(userIdList.size() == 0){
} else { //选中用户
List<Long> userIdList = new ArrayList<>();
SysUserDTO sysUserDTO =
sysUserService.get(Long.valueOf(notice.getReceiverTypeIds())); // 尝试直接查人员
if (sysUserDTO != null) {
userIdList.add(sysUserDTO.getId());
} else {
userIdList = sysUserService.getUserIdListByDeptId(notice.getReceiverTypeList());
}
if (userIdList.size() == 0) {
return;
}
@ -145,7 +154,7 @@ public class SysNoticeServiceImpl extends CrudServiceImpl<SysNoticeDao, SysNotic
/**
* 发送给全部用户
*/
public void sendAllUser(SysNoticeDTO notice){
public void sendAllUser(SysNoticeDTO notice) {
SysNoticeUserEntity noticeUser = new SysNoticeUserEntity()
.setNoticeId(notice.getId())
.setReadStatus(NoticeReadStatusEnum.UNREAD.value());
@ -155,7 +164,7 @@ public class SysNoticeServiceImpl extends CrudServiceImpl<SysNoticeDao, SysNotic
/**
* 发送给选中用户
*/
public void sendUser(SysNoticeDTO notice, List<Long> userIdList){
public void sendUser(SysNoticeDTO notice, List<Long> userIdList) {
userIdList.forEach(userId -> {
SysNoticeUserEntity noticeUser = new SysNoticeUserEntity()
.setNoticeId(notice.getId())

View File

@ -8,11 +8,11 @@ import java.util.List;
import java.util.Map;
/**
* 能力申请表单
*
* @author Mark sunlightcs@gmail.com
* @since 3.0 2022-04-13
*/
* 能力申请表单
*
* @author Mark sunlightcs@gmail.com
* @since 3.0 2022-04-13
*/
@Mapper
public interface TAbilityApplicationDao extends BaseDao<TAbilityApplicationEntity> {
void updateInstanceId(String instanceId, Long id);
@ -24,4 +24,14 @@ public interface TAbilityApplicationDao extends BaseDao<TAbilityApplicationEntit
Long countApplyAll();
List<Map<String, Object>> getAmountGroupByType();
/**
* 申请量前n位部门
*
* @param n
* @return
*/
List<Map> selectDeptApplyCount(Integer n);
List<String> selectDeptApply(Long deptId);
}

View File

@ -4,6 +4,7 @@ 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.modules.activiti.service.ActTaskService;
import io.renren.modules.processForm.dto.TAbilityApplicationDTO;
import io.renren.modules.processForm.service.ApiGatewayService;
@ -23,6 +24,7 @@ import org.activiti.engine.TaskService;
import org.activiti.engine.delegate.*;
import org.activiti.engine.delegate.event.ActivitiEvent;
import org.activiti.engine.delegate.event.ActivitiEventListener;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@ -65,6 +67,7 @@ public class CorrectionListener implements TaskListener, ExecutionListener, Acti
private TAbilityApplicationService tAbilityApplicationService;
@Override
@ActivitiNoticeOperation(value = "资源部门负责人审批", process = "能力申请流程")
public void notify(DelegateTask delegateTask) {
logger.error("-------------------------进入部门动态审批人流程-------------------------------");
final String eventName = delegateTask.getEventName();
@ -81,6 +84,7 @@ public class CorrectionListener implements TaskListener, ExecutionListener, Acti
}
@Override
@ActivitiNoticeOperation(value = "流程结束", process = "能力申请流程", type = 2)
public void notify(DelegateExecution delegateExecution) throws Exception {
logger.error("----------------------进入部门审批结束节点---------------------------");
delegateExecution.getProcessBusinessKey();
@ -198,7 +202,7 @@ public class CorrectionListener implements TaskListener, ExecutionListener, Acti
private void mpComplete(TAbilityApplicationDTO abilityApplicationDTO, DelegateTask delegateTask) {
Optional<ResourceDTO> resourceDTOOptional = Optional.ofNullable(resourceService.get(Long.valueOf(abilityApplicationDTO.getResourceId())));
resourceDTOOptional.ifPresent(resource -> {
if ("免批申请".equals(resource.getShareCondition())) { // 针对免批资源申请
if (StringUtils.contains(resource.getShareCondition(), "免批")) { // 针对免批资源申请
taskService.addComment(delegateTask.getId(), delegateTask.getProcessInstanceId(), "免批资源申请默认通过");
taskService.complete(delegateTask.getId(), delegateTask.getVariables());
return;

View File

@ -4,6 +4,7 @@ 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.modules.processForm.dto.TAbilityApplicationDTO;
import io.renren.modules.resource.dto.ResourceDTO;
import io.renren.modules.resource.service.ResourceService;
@ -18,6 +19,7 @@ import org.activiti.engine.TaskService;
import org.activiti.engine.delegate.*;
import org.activiti.engine.delegate.event.ActivitiEvent;
import org.activiti.engine.delegate.event.ActivitiEventListener;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@ -64,6 +66,7 @@ public class DataCenterListener implements TaskListener, ExecutionListener, Acti
}
@Override
@ActivitiNoticeOperation(value = "大数据局负责人审批", process = "能力申请流程")
public void notify(DelegateTask delegateTask) {
logger.error("事件类型:" + delegateTask.getEventName());
final String eventName = delegateTask.getEventName();
@ -119,7 +122,7 @@ public class DataCenterListener implements TaskListener, ExecutionListener, Acti
TAbilityApplicationDTO abilityApplicationDTO = gson.fromJson(jsonElement, TAbilityApplicationDTO.class);
Optional<ResourceDTO> resourceDTOOptional = Optional.ofNullable(resourceService.get(Long.valueOf(abilityApplicationDTO.getResourceId())));
resourceDTOOptional.ifPresent(resource -> {
if ("免批申请".equals(resource.getShareCondition())) { // 针对免批资源申请
if (StringUtils.contains(resource.getShareCondition(), "免批")) { // 针对免批资源申请
taskService.addComment(delegateTask.getId(), delegateTask.getProcessInstanceId(), "免批资源申请默认通过");
taskService.complete(delegateTask.getId(), delegateTask.getVariables());
return;

View File

@ -30,4 +30,8 @@ public interface TAbilityApplicationService extends CrudService<TAbilityApplicat
Long countApplyAll();
List<Map<String, Object>> getAmountGroupByType();
List<Map> selectDeptApplyCount(Integer n);
List<String> selectDeptApply(Long deptId);
}

View File

@ -63,5 +63,15 @@ public class TAbilityApplicationServiceImpl extends CrudServiceImpl<TAbilityAppl
return baseDao.getAmountGroupByType();
}
@Override
public List<Map> selectDeptApplyCount(Integer n) {
return baseDao.selectDeptApplyCount(n);
}
@Override
public List<String> selectDeptApply(Long deptId) {
return baseDao.selectDeptApply(deptId);
}
}

View File

@ -105,7 +105,9 @@ public class ResourceController {
@ApiOperation("查询热门能力")
@LogOperation("查询热门能力")
public Result selectMostPopular(@RequestBody JSONObject jsonObject) {
return new Result<>().ok(resourceService.selectMostPopular(jsonObject));
}
@GetMapping("/selectRecommend")
@ -186,11 +188,16 @@ public class ResourceController {
requestHeaders.set("SOAPAction", "http://tempuri.org/ZywMessagePort");
requestHeaders.setContentType(MediaType.TEXT_XML);
HttpEntity<String> requestEntity = new HttpEntity(parame, requestHeaders);
String body = restTemplate.postForEntity(url,requestEntity,String.class).getBody();
String json = body.substring(body.indexOf("{"), body.indexOf("}") + 1);
HashMap map = JSONObject.parseObject(json, HashMap.class);
try {
String body = restTemplate.postForEntity(url,requestEntity,String.class).getBody();
String json = body.substring(body.indexOf("{"), body.indexOf("}") + 1);
HashMap map = JSONObject.parseObject(json, HashMap.class);
return new Result().ok(map);
} catch (Exception e) {
e.printStackTrace();
return new Result().error();
}
return new Result().ok(map);
}
@GetMapping("algorithmPage")
@ -206,6 +213,7 @@ public class ResourceController {
public Result algorithmPage(@ApiIgnore@RequestParam Map<String, Object> params) {
return new Result().ok(resourceService.algorithmPage(params));
}
/*
@GetMapping("export")
@ApiOperation("导出")

View File

@ -1,10 +1,13 @@
package io.renren.modules.resource.dao;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import io.renren.common.dao.BaseDao;
import io.renren.modules.resource.entity.AttrEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.sql.SQLOutput;
import java.util.List;
/**
@ -17,5 +20,5 @@ import java.util.List;
public interface AttrDao extends BaseDao<AttrEntity> {
Integer delete4Resource(@Param("resourceIds") List<Long> idList);
}

View File

@ -68,4 +68,42 @@ public interface ResourceDao extends BaseDao<ResourceEntity> {
List<Map> selectDeptTypeCount();
List<Map> selectDeptTotalCount();
/**
* 查询前n 个能力类型多的部门
*
* @return
*/
List<Map> selectDeptProvideCount(Integer n);
List<String> selectDeptProvide(Long deptId);
List<Long> selectMaxDeptIds();
List<Map> selectByDeptId(@Param("deptId") Long deptId);
List<Map> selectDeptCountList();
List<Long> selectMaxApplyDeptIds();
List<Map> selectByApplyDeptId(Long aLong);
List<Map> selectApplyDeptCountList();
List<Map<String, Object>> selectDeptTypeCountList();
List<Map<String, Object>> selectApplyDeptTypeCountList();
List<String> selectMaxType();
List<Map> selectByType(@Param("type") String s);
List<Map> selectTypeCountList();
List<String> selectMaxAppArea();
List<Map> selectByAppArea(@Param("type") String s);
List<Map> selectAppAreaCountList();
}

View File

@ -5,6 +5,7 @@ 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.modules.resource.dto.ResourceDTO;
import io.renren.modules.resource.entity.ResourceEntityDelFlag;
import io.renren.modules.resource.service.ResourceService;
@ -54,6 +55,7 @@ public class ResourceUndercarriageListener implements TaskListener, ExecutionLis
private ResourceService resourceService;
@Override
@ActivitiNoticeOperation(value = "资源下线前资源所属部门审批人审批", process = "能力资源下架")
public void notify(DelegateTask delegateTask) {
logger.error("----------------------进入资源所有者节点---------------------------");
logger.error("事件类型:" + delegateTask.getEventName());
@ -72,6 +74,7 @@ public class ResourceUndercarriageListener implements TaskListener, ExecutionLis
}
@Override
@ActivitiNoticeOperation(value = "流程结束", process = "能力资源下架", type = 2)
public void notify(DelegateExecution execution) throws Exception {
logger.error("----------------------进入审批通过节点---------------------------");
logger.error("事件类型:" + execution.getEventName());

View File

@ -51,4 +51,27 @@ public interface ResourceService extends CrudService<ResourceEntity, ResourceDTO
Object selectSourceDepartmentStatistics();
List<Map> selectDeptProvideCount(Integer n);
List<String> selectDeptProvide(Long deptId);
Object capabilitySharePartyCapabilitySet();
Object selectResourceListByDept(Long deptId);
Object competencyApplicantCompetencySet();
Object selectResourceListByApplyDept(Long deptId);
Object capabilitySharingPartyCapabilityType();
Object competencyApplicantCapabilityType();
Object capabilityTypeCapabilitySet();
Object applicationAreaCapabilitySet();
Object selectResourceListByType(String type);
Object selectResourceListByAppArea(String appArea);
}

View File

@ -24,6 +24,7 @@ import io.renren.modules.resourceCollection.dao.ResourceCollectionDao;
import io.renren.modules.resourceScore.dao.ResourceScoreDao;
import io.renren.modules.security.user.SecurityUser;
import io.renren.modules.security.user.UserDetail;
import io.renren.modules.sys.dao.SysDeptDao;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -62,6 +63,9 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
@Autowired
private ResourceBrowseDao resourceBrowseDao;
@Autowired
private SysDeptDao sysDeptDao;
@Override
public QueryWrapper<ResourceEntity> getWrapper(Map<String, Object> params) {
QueryWrapper<ResourceEntity> wrapper = new QueryWrapper<>();
@ -264,7 +268,6 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
@Override
public Object selectRecommend() {
Long userId = SecurityUser.getUser().getId();
//根据用户收藏和申请数据查出应用领域排名在根据应用领域查询热门能力推荐给用户
List<Map> applyAreaList = resourceDao.selectApplyArea(userId);
@ -417,4 +420,126 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
resultMap.put("deptTotalCount", map1);
return resultMap;
}
@Override
public List<Map> selectDeptProvideCount(Integer n) {
return baseDao.selectDeptProvideCount(n);
}
@Override
public List<String> selectDeptProvide(Long deptId) {
return baseDao.selectDeptProvide(deptId);
}
@Override
public Object capabilitySharePartyCapabilitySet() {
HashMap<String, Object> resultMap = new HashMap<>();
List<Long> deptIds = resourceDao.selectMaxDeptIds();
List<Map> resourceList = resourceDao.selectByDeptId(deptIds.get(0));
HashMap<String, Object> maxdeptMap = new HashMap<>();
maxdeptMap.put("resourceList", resourceList);
maxdeptMap.put("deptName", sysDeptDao.selectById(deptIds.get(0)).getName());
maxdeptMap.put("deptId", deptIds.get(0));
resultMap.put("maxDept", maxdeptMap);
List<Map> deptList = resourceDao.selectDeptCountList();
resultMap.put("deptList", deptList);
return resultMap;
}
@Override
public Object selectResourceListByDept(Long deptId) {
return resourceDao.selectByDeptId(deptId);
}
@Override
public Object competencyApplicantCompetencySet() {
HashMap<String, Object> resultMap = new HashMap<>();
List<Long> deptIds = resourceDao.selectMaxApplyDeptIds();
List<Map> resourceList = resourceDao.selectByApplyDeptId(deptIds.get(0));
HashMap<String, Object> maxdeptMap = new HashMap<>();
maxdeptMap.put("resourceList", resourceList);
maxdeptMap.put("deptName", sysDeptDao.selectById(deptIds.get(0)).getName());
maxdeptMap.put("deptId", deptIds.get(0));
resultMap.put("maxDept", maxdeptMap);
List<Map> deptList = resourceDao.selectApplyDeptCountList();
resultMap.put("deptList", deptList);
return resultMap;
}
@Override
public Object selectResourceListByApplyDept(Long deptId) {
return resourceDao.selectByApplyDeptId(deptId);
}
@Override
public Object capabilitySharingPartyCapabilityType() {
List<Map<String, Object>> typeCountListByDept = resourceDao.selectDeptTypeCountList();
Map<String, List<Map<String, Object>>> typeCountListMap = typeCountListByDept.stream().collect(Collectors.groupingBy(m -> m.get("deptName").toString()));
ArrayList<Map> resultList = new ArrayList<>();
typeCountListMap.forEach((k, v) -> {
HashMap<Object, Object> map = new HashMap<>();
map.put("name", k);
v.forEach(item -> {
map.put(item.get("type").toString(), item.get("count"));
});
resultList.add(map);
});
return resultList;
}
@Override
public Object competencyApplicantCapabilityType() {
List<Map<String, Object>> typeCountListByApplyDept = resourceDao.selectApplyDeptTypeCountList();
Map<String, List<Map<String, Object>>> typeCountListMap = typeCountListByApplyDept.stream().collect(Collectors.groupingBy(m -> m.get("deptName").toString()));
ArrayList<Map> resultList = new ArrayList<>();
typeCountListMap.forEach((k, v) -> {
HashMap<Object, Object> map = new HashMap<>();
map.put("name", k);
v.forEach(item -> {
map.put(item.get("type").toString(), item.get("count"));
});
resultList.add(map);
});
return resultList;
}
@Override
public Object capabilityTypeCapabilitySet() {
HashMap<String, Object> resultMap = new HashMap<>();
List<String> types = resourceDao.selectMaxType();
List<Map> resourceList = resourceDao.selectByType(types.get(0));
HashMap<String, Object> maxdeptMap = new HashMap<>();
maxdeptMap.put("resourceList", resourceList);
maxdeptMap.put("typeName", types.get(0));
resultMap.put("maxDept", maxdeptMap);
List<Map> typeList = resourceDao.selectTypeCountList();
resultMap.put("typeList", typeList);
return resultMap;
}
@Override
public Object applicationAreaCapabilitySet() {
HashMap<String, Object> resultMap = new HashMap<>();
List<String> types = resourceDao.selectMaxAppArea();
List<Map> resourceList = resourceDao.selectByAppArea(types.get(0));
HashMap<String, Object> maxAppAreaMap = new HashMap<>();
maxAppAreaMap.put("resourceList", resourceList);
maxAppAreaMap.put("typeName", types.get(0));
resultMap.put("maxAppArea", maxAppAreaMap);
List<Map> appAreaList = resourceDao.selectAppAreaCountList();
resultMap.put("appAreaList", appAreaList);
return resultMap;
}
@Override
public Object selectResourceListByType(String type) {
return resourceDao.selectByType(type);
}
@Override
public Object selectResourceListByAppArea(String appArea) {
return resourceDao.selectByAppArea(appArea);
}
}

View File

@ -17,7 +17,7 @@ import java.util.Map;
@Mapper
public interface ResourceBrowseDao extends BaseDao<ResourceBrowseEntity> {
Integer selectDayAvg(@Param("days") Long days);
Long selectDayAvg(@Param("days") Long days);
Integer selectDayMax();

View File

@ -59,17 +59,17 @@ public class ResourceBrowseServiceImpl extends CrudServiceImpl<ResourceBrowseDao
Date startDay = DateUtils.parse(startDate, DateUtils.DATE_PATTERN);
Date endDay = DateUtils.parse(endDate, DateUtils.DATE_PATTERN);
ArrayList<String> dayList = new ArrayList<>();
while (startDay.before(endDay)) {
while (startDay.before(endDay) || startDay.compareTo(endDay) == 0) {
dayList.add(DateUtils.format(startDay, DateUtils.DATE_PATTERN));
startDay = DateUtils.addDateDays(startDay, 1);
}
ArrayList<Map<String, Integer>> resultMap = new ArrayList<>();
ArrayList<Map<String, Object>> resultMap = new ArrayList<>();
for (int i = 0; i < dayList.size(); i++) {
HashMap<String, Integer> dayMap = new HashMap<>();
HashMap<String, Object> dayMap = new HashMap<>();
dayMap.put(dayList.get(i), 0);
for (Map map : maps) {
if (dayList.get(i).equals(map.get("date"))) {
dayMap.put(dayList.get(i), (Integer) map.get("count"));
dayMap.put(dayList.get(i), map.get("count"));
}
}
resultMap.add(dayMap);

View File

@ -5,6 +5,7 @@ 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.modules.processForm.service.ApiGatewayService;
import io.renren.modules.resource.dto.ResourceDTO;
import io.renren.modules.resource.entity.ResourceEntityDelFlag;
@ -55,6 +56,7 @@ public class ResourceOwnerListener implements TaskListener, ExecutionListener, A
private ResourceService resourceService;
@Override
@ActivitiNoticeOperation(value = "流程结束", process = "能力资源上架", type = 2)
public void notify(DelegateExecution execution) throws Exception {
logger.error("----------------------进入审批通过节点---------------------------");
logger.error("事件类型:" + execution.getEventName());
@ -74,6 +76,7 @@ public class ResourceOwnerListener implements TaskListener, ExecutionListener, A
}
@Override
@ActivitiNoticeOperation(value = "资源所属部门审批人审批", process = "能力资源上架")
public void notify(DelegateTask delegateTask) {
logger.error("----------------------进入资源所有者节点---------------------------");
logger.error("事件类型:" + delegateTask.getEventName());

View File

@ -61,6 +61,7 @@ public class ShiroConfig {
filterMap.put("/druid/**", "anon");
filterMap.put("/login", "anon");
filterMap.put("/swagger/**", "anon");
filterMap.put("/STapi/project/receiveSubscribe", "anon");
filterMap.put("/v2/api-docs", "anon");
filterMap.put("/doc.html", "anon");
filterMap.put("/swagger-resources/**", "anon");

View File

@ -0,0 +1,102 @@
package io.renren.modules.taskList.controller;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import io.renren.modules.taskList.dao.TaskListControllerDao;
import io.renren.modules.taskList.entity.TaskListControllerEntity;
import io.renren.modules.taskList.service.ShangTangService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.log4j.Log4j2;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.Map;
@RestController
@RequestMapping("STapi/project")
@Api(tags = "事件")
@Log4j2
public class ShangTangController {
@Resource
private ShangTangService shangTangService;
@Resource
private TaskListControllerDao taskListControllerDao;
/**
* 事件模板分页查询接口
* @return
*/
@RequestMapping("tamplate")
@ApiOperation("事件模板分页查询接口")
public JSONObject tamplate(){
return shangTangService.template();
}
/**
* 定时插入场景任务列表
*
*/
@RequestMapping("insertTaskList")
@ApiOperation("场景任务列表插入")
@Scheduled(cron = "0 */1 * * * ?")
@Transactional
public void insertTaskList(){
taskListControllerDao.deleteAll();
JSONObject jobj = this.tamplate();
JSONObject datajobj = jobj.getJSONObject("data");
JSONArray tamplateList = datajobj.getJSONArray("dataList");
//JSONArray tamplateList = jobj.getJSONArray("data");//构建JSONArray数组
for (int i = 0 ; i < tamplateList.size();i++) {
Map<String, Object> key = (Map<String, Object>) tamplateList.get(i);
String eventType = (String) key.get("eventType");
String eventCnName = (String)key.get("eventCnName");
JSONObject taskListBody = shangTangService.tasklist(eventType);
if (taskListBody.size()>0){
JSONObject taskdatajobj = taskListBody.getJSONObject("data");
if (taskdatajobj!=null){
JSONArray taskdatajobjJSONArray = taskdatajobj.getJSONArray("dataList");
if (taskdatajobjJSONArray!=null){
for (int j = 0 ; j < taskdatajobjJSONArray.size();j++) {
Map<String, Object> key1 = (Map<String, Object>)taskdatajobjJSONArray.get(j);
String taskSerial = (String) key1.get("taskSerial");
Integer taskStatus = (Integer) key1.get("taskStatus");
JSONObject taskDetailObj = shangTangService.tasklistDetail(taskSerial);
JSONObject taskDetail = taskDetailObj.getJSONObject("data");
TaskListControllerEntity taskListobj = new TaskListControllerEntity();
if (taskDetail!=null){
String taskName = taskDetail.getString("taskName");
taskListobj .setTaskName(taskName);
}else{
taskListobj .setTaskName("任务停止");
}
taskListobj .setTaskSerial(taskSerial);
taskListobj.setTaskStatus(taskStatus);
taskListobj .setEventType(eventType);
taskListobj .setEventCnName(eventCnName);
taskListControllerDao.insert(taskListobj);
}
}
}
}
}
}
}

View File

@ -0,0 +1,163 @@
package io.renren.modules.taskList.controller;
import com.alibaba.druid.util.StringUtils;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.renren.common.annotation.LogOperation;
import io.renren.common.constant.Constant;
import io.renren.common.page.PageData;
import io.renren.common.utils.ExcelUtils;
import io.renren.common.utils.Result;
import io.renren.common.validator.AssertUtils;
import io.renren.common.validator.ValidatorUtils;
import io.renren.common.validator.group.AddGroup;
import io.renren.common.validator.group.DefaultGroup;
import io.renren.common.validator.group.UpdateGroup;
import io.renren.modules.taskList.dao.TaskListControllerDao;
import io.renren.modules.taskList.dto.TaskListControllerDTO;
import io.renren.modules.taskList.entity.TaskListControllerEntity;
import io.renren.modules.taskList.excel.TaskListControllerExcel;
import io.renren.modules.taskList.service.TaskListControllerService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import javax.servlet.http.HttpServletResponse;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* test
*
* @author Mark sunlightcs@gmail.com
* @since 3.0 2022-05-24
*/
@RestController
@RequestMapping("/taskList/tasklistcontroller")
@Api(tags="任务列表查询")
public class TaskListController {
@Autowired
private TaskListControllerService taskListControllerService;
@Autowired
private TaskListControllerDao taskListControllerDao;
@GetMapping("page")
@ApiOperation("分页")
@ApiImplicitParams({
@ApiImplicitParam(name = Constant.PAGE, value = "当前页码从1开始", paramType = "query", required = true, dataType="int") ,
@ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") ,
@ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType="String") ,
@ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType="String")
})
@RequiresPermissions("taskList:tasklistcontroller:page")
public Result<PageData<TaskListControllerDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){
PageData<TaskListControllerDTO> page = taskListControllerService.page(params);
return new Result<PageData<TaskListControllerDTO>>().ok(page);
}
@GetMapping("/selectTaskList")
@ApiOperation("根据分页以及任务名称状态查询数据")
// @RequiresPermissions("taskList:tasklistcontroller:info")
public Map<String,Object> get(
@RequestParam(value = "taskName",required = false) String taskName,
@RequestParam(value = "taskStatus",required = false) Integer taskStatus,
@RequestParam(value = "page",required = true,defaultValue = "1") Integer page,
@RequestParam(value = "pageSize",required = true,defaultValue = "10") Integer pageSize
){
Page<TaskListControllerEntity> page1 = new Page<>(page,pageSize);
QueryWrapper<TaskListControllerEntity> queryWrapper = new QueryWrapper<>();
if (taskName!=null){
if (!StringUtils.isEmpty(taskName)) {
//构建条件
//第一个为字段名称第二个值为模糊查询传递的值
queryWrapper.like("task_name",taskName);
}
}
if (taskStatus!=null){
if (!StringUtils.isEmpty(taskStatus.toString())) {
//构建条件
//第一个为字段名称第二个值为模糊查询传递的值
queryWrapper.eq("task_status",taskStatus);
}
}
taskListControllerDao.selectPage(page1,queryWrapper);
List<TaskListControllerEntity> taskEntityList = page1.getRecords();
long num = page1.getTotal();
Map<String,Object> map = new HashMap<>();
if (taskEntityList.size()>0){
map.put("msg",200);//查询成功
map.put("taskEntityList",taskEntityList);
map.put("num",num);
}else {
map.put("msg",501);//查询失败
}
return map;
}
@PostMapping
@ApiOperation("保存")
@LogOperation("保存")
@RequiresPermissions("taskList:tasklistcontroller:save")
public Result save(@RequestBody TaskListControllerDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
taskListControllerService.save(dto);
return new Result();
}
@PutMapping
@ApiOperation("修改")
@LogOperation("修改")
@RequiresPermissions("taskList:tasklistcontroller:update")
public Result update(@RequestBody TaskListControllerDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
taskListControllerService.update(dto);
return new Result();
}
@DeleteMapping
@ApiOperation("删除")
@LogOperation("删除")
@RequiresPermissions("taskList:tasklistcontroller:delete")
public Result delete(@RequestBody Long[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
taskListControllerService.delete(ids);
return new Result();
}
@GetMapping("export")
@ApiOperation("导出")
@LogOperation("导出")
@RequiresPermissions("taskList:tasklistcontroller:export")
public void export(@ApiIgnore @RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<TaskListControllerDTO> list = taskListControllerService.list(params);
ExcelUtils.exportExcelToTarget(response, null, "test", list, TaskListControllerExcel.class);
}
}

View File

@ -0,0 +1,22 @@
package io.renren.modules.taskList.dao;
import io.renren.common.dao.BaseDao;
import io.renren.modules.taskList.entity.TaskListControllerEntity;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository;
import javax.annotation.Resource;
/**
* test
*
* @author Mark sunlightcs@gmail.com
* @since 3.0 2022-05-24
*/
@Mapper
@Resource
@Repository
public interface TaskListControllerDao extends BaseDao<TaskListControllerEntity> {
void deleteAll();
}

View File

@ -0,0 +1,28 @@
package io.renren.modules.taskList.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
/**
* test
*
* @author Mark sunlightcs@gmail.com
* @since 3.0 2022-05-24
*/
@Data
@ApiModel(value = "test")
public class TaskListControllerDTO implements Serializable {
private static final long serialVersionUID = 1L;
private Integer id;
private String taskSerial;
private String taskName;
@ApiModelProperty(value = "1:运行中,2:已结束,3:异常,4:待启动,5:已停止")
private Integer taskStatus;
private String eventType;
private String eventCnName;
}

View File

@ -0,0 +1,29 @@
package io.renren.modules.taskList.entity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import com.baomidou.mybatisplus.annotation.*;
/**
* test
*
* @author Mark sunlightcs@gmail.com
* @since 3.0 2022-05-24
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("tb_task_list")
public class TaskListControllerEntity {
private static final long serialVersionUID = 1L;
@TableId(type = IdType.AUTO)
private Integer id;
private String taskSerial;
private String taskName;
/**
* :运行中,2:已结束,3:异常,4:待启动,5:已停止
*/
private Integer taskStatus;
private String eventType;
private String eventCnName;
}

View File

@ -0,0 +1,32 @@
package io.renren.modules.taskList.excel;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.alibaba.excel.annotation.write.style.ContentRowHeight;
import com.alibaba.excel.annotation.write.style.HeadRowHeight;
import lombok.Data;
/**
* test
*
* @author Mark sunlightcs@gmail.com
* @since 3.0 2022-05-24
*/
@Data
@ContentRowHeight(20)
@HeadRowHeight(20)
@ColumnWidth(25)
public class TaskListControllerExcel {
@ExcelProperty(value = "Integer", index = 0)
private Integer id;
@ExcelProperty(value = "String", index = 1)
private String taskSerial;
@ExcelProperty(value = "String", index = 2)
private String taskName;
@ExcelProperty(value = ":运行中,2:已结束,3:异常,4:待启动,5:已停止", index = 3)
private Integer taskStatus;
@ExcelProperty(value = "String", index = 4)
private String eventType;
@ExcelProperty(value = "String", index = 5)
private String eventCnName;
}

View File

@ -0,0 +1,151 @@
package io.renren.modules.taskList.service;
import com.alibaba.fastjson.JSONObject;
import lombok.extern.log4j.Log4j2;
import org.springframework.http.*;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;
@Service
@Log4j2
public class ShangTangService {
@Resource
private RestTemplate restTemplate;
//1.登录
//2.获取token
public String shangtangToken () {
String url = "http://10.132.191.54:10270/whale-open-api/tenant/token";
Map<String,Object> map = new HashMap<>();
map.put("accessKey","a1ddCV7z7Jhv0SBGx5O3hblO");
map.put("secretKey","glIixzORLgoFJz0VdF1aXICR");
ResponseEntity<JSONObject> responseEntity;
try {
responseEntity = restTemplate.postForEntity(url,map,JSONObject.class);
JSONObject body = responseEntity.getBody();
JSONObject data = body.getJSONObject("data");
String token = data.getString("token");
log.info("get token:{}", body.toJSONString());
return token;
} catch (Exception e) {
log.info("[shangtangToken] exception:{}", e.getMessage());
return null;
}
}
//订阅任务下发接口
public JSONObject subscribe(){
String token = this.shangtangToken();
String url = "https://10.132.191.54:10270/whale-open-api/subscribe";
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
headers.add("token", token);
headers.add("tid","default");
Map<String,Object> map = new HashMap<>();
map.put("callBackUrl","https://15.2.23.163:7010/STapi/project/receive");
// map.put("certPubKey","");
map.put("subscribeType",3);
// map.put("taskId","serial");
ResponseEntity<JSONObject> responseEntity;
HttpEntity<String> entity = new HttpEntity<>(JSONObject.toJSONString(map), headers);
try {
responseEntity = restTemplate.exchange(url, HttpMethod.POST,entity,JSONObject.class);
JSONObject body = responseEntity.getBody();
return body;
}catch (Exception e){
log.info( "[subscribe] exception:{}",e.getMessage());
return null;
}
}
//事件模板分页查询接口
public JSONObject template(){
String token = this.shangtangToken();
String url = "http://10.132.191.54:10270/whale-open-api/scenario/event/template?pageNum=1&pageSize=1000";
HttpHeaders headers = new HttpHeaders();
headers.add("token",token);
headers.add("tid","default");
ResponseEntity<JSONObject> responseEntity;
try {
responseEntity = restTemplate.exchange(url,HttpMethod.GET,new HttpEntity<>(headers),JSONObject.class);
JSONObject jsonObject = responseEntity.getBody();
return jsonObject;
} catch (Exception e) {
log.info("[template] exception:{}", e.getMessage());
return null;
}
}
//场景任务列表查询接口
public JSONObject tasklist(String eventType){
String token = this.shangtangToken();
String url = "http://10.132.191.54:10270/whale-open-api/scenario/event-task/list";
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
headers.add("token", token);
headers.add("tid","default");
//需要传的参数
// "eventType": "${appletId}-${eventType}", // 事件唯一标识
// "pageNum": "integer (int32)",
// "pageSize": "integer (int32)",
// "taskName": "string", //任务名称
// "taskSerial": "string", //任务serial
// "taskStatus": "1:运行中,2:已结束,3:异常,4:待启动,5:已停止"
Map<String,Object> map = new HashMap<>();
map.put("eventType",eventType);
map.put("pageNum",1);
map.put("pageSize",100);
ResponseEntity<JSONObject> responseEntity;
HttpEntity<String> entity = new HttpEntity<>(JSONObject.toJSONString(map), headers);
try {
responseEntity = restTemplate.exchange(url, HttpMethod.POST,entity,JSONObject.class);
JSONObject taskListBody = responseEntity.getBody();
return taskListBody;
}catch (Exception e){
log.info( "[tasklist] exception:{}",e.getMessage());
return null;
}
}
//场景任务详情查询接口
public JSONObject tasklistDetail(String taskSerial){
String token = this.shangtangToken();
String url = "http://10.132.191.54:10270/whale-open-api/scenario/event-task/"+taskSerial;
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
headers.add("token", token);
headers.add("tid","default");
ResponseEntity<JSONObject> responseEntity;
HttpEntity<String> entity = new HttpEntity<>( headers);
try {
responseEntity = restTemplate.exchange(url, HttpMethod.GET,entity,JSONObject.class);
JSONObject taskListDetailBody = responseEntity.getBody();
return taskListDetailBody;
}catch (Exception e){
log.info( "[tasklist] exception:{}",e.getMessage());
return null;
}
}
}

View File

@ -0,0 +1,16 @@
package io.renren.modules.taskList.service;
import io.renren.common.service.CrudService;
import io.renren.modules.taskList.dto.TaskListControllerDTO;
import io.renren.modules.taskList.entity.TaskListControllerEntity;
/**
* test
*
* @author Mark sunlightcs@gmail.com
* @since 3.0 2022-05-24
*/
public interface TaskListControllerService extends CrudService<TaskListControllerEntity, TaskListControllerDTO> {
}

View File

@ -0,0 +1,30 @@
package io.renren.modules.taskList.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.renren.common.service.impl.CrudServiceImpl;
import io.renren.modules.taskList.dao.TaskListControllerDao;
import io.renren.modules.taskList.dto.TaskListControllerDTO;
import io.renren.modules.taskList.entity.TaskListControllerEntity;
import io.renren.modules.taskList.service.TaskListControllerService;
import org.springframework.stereotype.Service;
import java.util.Map;
/**
* test
*
* @author Mark sunlightcs@gmail.com
* @since 3.0 2022-05-24
*/
@Service
public class TaskListControllerServiceImpl extends CrudServiceImpl<TaskListControllerDao, TaskListControllerEntity, TaskListControllerDTO> implements TaskListControllerService {
@Override
public QueryWrapper<TaskListControllerEntity> getWrapper(Map<String, Object> params){
QueryWrapper<TaskListControllerEntity> wrapper = new QueryWrapper<>();
return wrapper;
}
}

View File

@ -0,0 +1,111 @@
package io.renren.modules.warningList.controller;
import com.alibaba.fastjson.JSONObject;
import io.renren.modules.warningList.dao.WarningListControllerDao;
import io.renren.modules.warningList.entity.WarningListControllerEntity;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.log4j.Log4j2;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.servlet.ServletInputStream;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
@RestController
@RequestMapping("STapi/project")
@Api(tags = "订阅任务下发接口")
@Log4j2
public class ShangTangWarningController {
@Resource
WarningListControllerDao warningListControllerDao;
@PostMapping("receiveSubscribe")
@ApiOperation("订阅任务下发接口")
public void receiveSubscribe(HttpServletRequest request) throws IOException {
ServletInputStream ris = request.getInputStream();
StringBuilder content = new StringBuilder();
byte[] b = new byte[1024];
int lens = -1;
while ((lens = ris.read(b)) > 0) {
content.append(new String(b, 0, lens));
}
String strcont = content.toString();// 内容
System.out.println(strcont);
JSONObject jsonObject = JSONObject.parseObject(strcont);
WarningListControllerEntity event = new WarningListControllerEntity();
event.setEventCnName(jsonObject.getString("eventAlias"));
event.setEventSerial(jsonObject.getString("eventSerial"));
JSONObject attributes = jsonObject.getJSONObject("attributes");
if (attributes==null){
}else {
JSONObject text = attributes.getJSONObject("text");
if (text == null){
}else {
event.setVehicle(text.getString("valueDescription"));
}
JSONObject color = attributes.getJSONObject("color");
if (color == null) {
} else {
event.setColor(color.getString("valueDescription"));
}
JSONObject largeVehicle = attributes.getJSONObject("large_vehicle");
if (largeVehicle == null) {
} else {
event.setVehicle(largeVehicle.getString("valueDescription"));
}
JSONObject trainingVehicle = attributes.getJSONObject("training_vehicle");
if (trainingVehicle == null) {
} else {
event.setVehicle(trainingVehicle.getString("valueDescription"));
}
JSONObject smallVehicle = attributes.getJSONObject("small_vehicle");
if (smallVehicle == null) {
} else {
event.setVehicle(smallVehicle.getString("valueDescription"));
}
JSONObject aClass = attributes.getJSONObject("class");
if (aClass == null) {
} else {
event.setClasses(aClass.getString("valueDescription"));
}
}
JSONObject camera = jsonObject.getJSONObject("camera");
if(camera==null){
}else {
event.setCameraName(camera.getString("cameraName"));
event.setDistrict(camera.getString("district"));
event.setLatitude(camera.getBigDecimal("latitude"));
event.setLongitude(camera.getBigDecimal("longitude"));
}
JSONObject image = jsonObject.getJSONObject("image");
if(image==null){
}else{
String images = image.getString("imageUrl");
String all = images.replaceAll(images.substring(19, 26), "7:8070");
event.setImageUrl(all);
}
event.setTaskId(jsonObject.getString("taskId"));
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//要转换的时间格式
Date date;
try {
date = sdf.parse(jsonObject.getString("captureTime"));
event.setCaptureTime(date);
}catch (Exception e){
e.printStackTrace();
}
event.setTrackEvent(jsonObject.getString("trackEvent"));
warningListControllerDao.insert(event);
log.info(event);
}
}

View File

@ -0,0 +1,167 @@
package io.renren.modules.warningList.controller;
import com.alibaba.druid.util.StringUtils;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.renren.common.annotation.LogOperation;
import io.renren.common.constant.Constant;
import io.renren.common.page.PageData;
import io.renren.common.utils.ExcelUtils;
import io.renren.common.utils.Result;
import io.renren.common.validator.AssertUtils;
import io.renren.common.validator.ValidatorUtils;
import io.renren.common.validator.group.AddGroup;
import io.renren.common.validator.group.DefaultGroup;
import io.renren.common.validator.group.UpdateGroup;
import io.renren.modules.warningList.dao.WarningListControllerDao;
import io.renren.modules.warningList.dto.WarningListControllerDTO;
import io.renren.modules.warningList.entity.WarningListControllerEntity;
import io.renren.modules.warningList.excel.WarningListControllerExcel;
import io.renren.modules.warningList.service.WarningListControllerService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* test
*
* @author Mark sunlightcs@gmail.com
* @since 3.0 2022-05-24
*/
@RestController
@RequestMapping("warningList/warninglistcontroller")
@Api(tags="告警信息查询")
public class WarningListController {
@Autowired
private WarningListControllerService warningListControllerService;
@Resource
private WarningListControllerDao warningListControllerDao;
@GetMapping("page")
@ApiOperation("分页")
@ApiImplicitParams({
@ApiImplicitParam(name = Constant.PAGE, value = "当前页码从1开始", paramType = "query", required = true, dataType="int") ,
@ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") ,
@ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType="String") ,
@ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType="String")
})
@RequiresPermissions("warningList:warninglistcontroller:page")
public Result<PageData<WarningListControllerDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){
PageData<WarningListControllerDTO> page = warningListControllerService.page(params);
return new Result<PageData<WarningListControllerDTO>>().ok(page);
}
@GetMapping("selectWarningList")
@ApiOperation("查询告警信息")
//@RequiresPermissions("warningList:warninglistcontroller:info")
public Map<String, Object> get(
@RequestParam(value = "eventCnName",required = false) String eventCnName,
@RequestParam(value = "beginTime",required = false) String beginTime,
@RequestParam(value = "endTime",required = false) String endTime,
@RequestParam(value = "page",required = true,defaultValue = "1") Integer page,
@RequestParam(value = "pageSize",required = true,defaultValue = "10") Integer pageSize
) throws ParseException {
Page<WarningListControllerEntity> page1 = new Page<>(page,pageSize);
QueryWrapper<WarningListControllerEntity> queryWrapper = new QueryWrapper<>();
if (eventCnName!=null){
if (!StringUtils.isEmpty(eventCnName)) {
//构建条件
//第一个为字段名称第二个值为模糊查询传递的值
queryWrapper.like("event_cn_name",eventCnName);
}
}
if (beginTime!=null && endTime!=null){
if (!StringUtils.isEmpty(beginTime) && !StringUtils.isEmpty(endTime)) {
//构建条件
//第一个为字段名称第二个值为模糊查询传递的值
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");//要转换的时间格式
Date dateBegin = sdf.parse(beginTime);
Date dateEnd = sdf.parse(endTime);
queryWrapper.between("capture_time",dateBegin,dateEnd);
}
}
queryWrapper.orderByDesc("capture_time");
warningListControllerDao.selectPage(page1,queryWrapper);
List<WarningListControllerEntity> warningEntityList = page1.getRecords();
long num = page1.getTotal();
Map<String,Object> map = new HashMap<>();
if (warningEntityList.size()>0){
map.put("msg",200);//查询成功
map.put("num",num);
map.put("warningEntityList",warningEntityList);
}else {
map.put("msg",501);//查询失败
}
return map;
}
@PostMapping
@ApiOperation("保存")
@LogOperation("保存")
@RequiresPermissions("warningList:warninglistcontroller:save")
public Result save(@RequestBody WarningListControllerDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
warningListControllerService.save(dto);
return new Result();
}
@PutMapping
@ApiOperation("修改")
@LogOperation("修改")
@RequiresPermissions("warningList:warninglistcontroller:update")
public Result update(@RequestBody WarningListControllerDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
warningListControllerService.update(dto);
return new Result();
}
@DeleteMapping
@ApiOperation("删除")
@LogOperation("删除")
@RequiresPermissions("warningList:warninglistcontroller:delete")
public Result delete(@RequestBody Long[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
warningListControllerService.delete(ids);
return new Result();
}
@GetMapping("export")
@ApiOperation("导出")
@LogOperation("导出")
@RequiresPermissions("warningList:warninglistcontroller:export")
public void export(@ApiIgnore @RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<WarningListControllerDTO> list = warningListControllerService.list(params);
ExcelUtils.exportExcelToTarget(response, null, "test", list, WarningListControllerExcel.class);
}
}

View File

@ -0,0 +1,16 @@
package io.renren.modules.warningList.dao;
import io.renren.common.dao.BaseDao;
import io.renren.modules.warningList.entity.WarningListControllerEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* test
*
* @author Mark sunlightcs@gmail.com
* @since 3.0 2022-05-24
*/
@Mapper
public interface WarningListControllerDao extends BaseDao<WarningListControllerEntity> {
}

View File

@ -0,0 +1,44 @@
package io.renren.modules.warningList.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
* test
*
* @author Mark sunlightcs@gmail.com
* @since 3.0 2022-05-24
*/
@Data
@ApiModel(value = "test")
public class WarningListControllerDTO implements Serializable {
private static final long serialVersionUID = 1L;
private Long id;
@ApiModelProperty(value = "事件名称")
private String eventCnName;
private String eventSerial;
private String color;
@ApiModelProperty(value = "车牌")
private String vehicle;
private String classes;
@ApiModelProperty(value = "摄像头名称")
private String cameraName;
@ApiModelProperty(value = "位置")
private String district;
@ApiModelProperty(value = "经度")
private BigDecimal latitude;
@ApiModelProperty(value = "纬度")
private BigDecimal longitude;
@ApiModelProperty(value = "图片路径")
private String imageUrl;
private String taskId;
private Date captureTime;
private String trackEvent;
}

View File

@ -0,0 +1,55 @@
package io.renren.modules.warningList.entity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import com.baomidou.mybatisplus.annotation.*;
import java.math.BigDecimal;
import java.util.Date;
/**
* test
*
* @author Mark sunlightcs@gmail.com
* @since 3.0 2022-05-24
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("tb_warning_list")
public class WarningListControllerEntity {
private static final long serialVersionUID = 1L;
@TableId
private Long id;
private String eventCnName;//任务名称
private String eventSerial;//任务类型
private String color;//车辆颜色
/**
* 车牌
*/
private String vehicle;
private String classes;
/**
* 摄像头名称
*/
private String cameraName;
/**
* 位置
*/
private String district;
/**
* 经度
*/
private BigDecimal latitude;
/**
* 纬度
*/
private BigDecimal longitude;
/**
* 图片路径
*/
private String imageUrl;
private String taskId;
private Date captureTime;
private String trackEvent;
}

View File

@ -0,0 +1,50 @@
package io.renren.modules.warningList.excel;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.alibaba.excel.annotation.write.style.ContentRowHeight;
import com.alibaba.excel.annotation.write.style.HeadRowHeight;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
/**
* test
*
* @author Mark sunlightcs@gmail.com
* @since 3.0 2022-05-24
*/
@Data
@ContentRowHeight(20)
@HeadRowHeight(20)
@ColumnWidth(25)
public class WarningListControllerExcel {
@ExcelProperty(value = "Long", index = 0)
private Long id;
@ExcelProperty(value = "事件名称", index = 1)
private String eventCnName;
@ExcelProperty(value = "String", index = 2)
private String eventSerial;
@ExcelProperty(value = "String", index = 3)
private String color;
@ExcelProperty(value = "车牌", index = 4)
private String vehicle;
@ExcelProperty(value = "String", index = 5)
private String classes;
@ExcelProperty(value = "摄像头名称", index = 6)
private String cameraName;
@ExcelProperty(value = "位置", index = 7)
private String district;
@ExcelProperty(value = "经度", index = 8)
private BigDecimal latitude;
@ExcelProperty(value = "纬度", index = 9)
private BigDecimal longitude;
@ExcelProperty(value = "图片路径", index = 10)
private String imageUrl;
@ExcelProperty(value = "String", index = 11)
private String taskId;
@ExcelProperty(value = "Date", index = 12)
private Date captureTime;
@ExcelProperty(value = "String", index = 13)
private String trackEvent;
}

View File

@ -0,0 +1,15 @@
package io.renren.modules.warningList.service;
import io.renren.common.service.CrudService;
import io.renren.modules.warningList.dto.WarningListControllerDTO;
import io.renren.modules.warningList.entity.WarningListControllerEntity;
/**
* test
*
* @author Mark sunlightcs@gmail.com
* @since 3.0 2022-05-24
*/
public interface WarningListControllerService extends CrudService<WarningListControllerEntity, WarningListControllerDTO> {
}

View File

@ -0,0 +1,34 @@
package io.renren.modules.warningList.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.renren.common.service.impl.CrudServiceImpl;
import io.renren.common.constant.Constant;
import io.renren.modules.warningList.dao.WarningListControllerDao;
import io.renren.modules.warningList.dto.WarningListControllerDTO;
import io.renren.modules.warningList.entity.WarningListControllerEntity;
import io.renren.modules.warningList.service.WarningListControllerService;
import io.renren.modules.security.user.SecurityUser;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import java.util.Map;
/**
* test
*
* @author Mark sunlightcs@gmail.com
* @since 3.0 2022-05-24
*/
@Service
public class WarningListControllerServiceImpl extends CrudServiceImpl<WarningListControllerDao, WarningListControllerEntity, WarningListControllerDTO> implements WarningListControllerService {
@Override
public QueryWrapper<WarningListControllerEntity> getWrapper(Map<String, Object> params){
QueryWrapper<WarningListControllerEntity> wrapper = new QueryWrapper<>();
return wrapper;
}
}

View File

@ -4,10 +4,12 @@ spring:
datasource:
druid:
#MySQL
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://15.2.21.238:3310/share_platform?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&useSSL=false
username: root
password: Hisense2019
#Hisense2019
# #Oracle
# driver-class-name: oracle.jdbc.OracleDriver
# url: jdbc:oracle:thin:@192.168.10.10:1521:xe

View File

@ -0,0 +1,59 @@
server:
port: 8888
spring:
datasource:
druid:
#MySQL
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://127.0.0.1:3306/shangtangapi?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&useSSL=false
username: root
password: 123456
# driver-class-name: com.mysql.cj.jdbc.Driver
# url: jdbc:mysql://15.2.21.238:3310/share_platform?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&useSSL=false
# username: root
# password: Hisense2019
#Hisense2019
#上传的静态资源配置
initial-size: 10
max-active: 100
min-idle: 10
max-wait: 10
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: /home/yth/files/
devModelFilePath: /home/yth/files/devModelFile
# 大数据部门相关配置
big_date:
name: 青岛市大数据发展管理局
assignee_role_name: 部门审批人
hisense:
gateway:
url: http://devtest-security-app.hismarttv.com:8080

View File

@ -83,4 +83,4 @@ mybatis-plus:
#系统上线日期,用于统计能力浏览记录
system:
startDay: 2022-01-01
startDay: 2022-04-01

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<!--指定property属性变量-->
<property name="LOG_HOME" value="./logs/" />
<property name="LOG_HOME" value="./logs/"/>
<include resource="org/springframework/boot/logging/logback/base.xml"/>
<logger name="org.springframework.web" level="INFO"/>

View File

@ -207,4 +207,66 @@
</if>
order by tab.create_date desc
</select>
<insert id="insertSelective">
insert into bs_ability_ai
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="isDelete != null">is_delete,</if>
<if test="updater != null">updater,</if>
<if test="name != null">name,</if>
<if test="version != null">version,</if>
<if test="visitUrl != null">visit_url,</if>
<if test="subtext != null">subtext,</if>
<if test="context != null">context,</if>
<if test="imgurl != null">imgurl,</if>
<if test="type != null">type,</if>
<if test="shareType != null">share_type,</if>
<if test="goal != null">goal,</if>
<if test="shareForm != null">share_form,</if>
<if test="field != null">field,</if>
<if test="scene != null">scene,</if>
<if test="deptId != null">dept_id,</if>
<if test="onlineDate != null">online_date,</if>
<if test="content != null">content,</if>
<if test="rank != null">rank,</if>
<if test="useInfo != null">use_info,</if>
<if test="remarks != null">remarks,</if>
<if test="isUp != null">is_up,</if>
<if test="updateDate != null">update_date,</if>
<if test="contentImg != null">content_img,</if>
<if test="id != null">id,</if>
<if test="creator != null">creator,</if>
<if test="createDate != null">create_date,</if>
</trim>
values
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">#{id,jdbcType=NUMERIC},</if>
<if test="isDelete != null">#{isDelete,jdbcType=VARCHAR},</if>
<if test="updater != null">#{updater,jdbcType=VARCHAR},</if>
<if test="name != null">#{name,jdbcType=VARCHAR},</if>
<if test="version != null">#{version,jdbcType=VARCHAR},</if>
<if test="visitUrl != null">#{visitUrl,jdbcType=VARCHAR},</if>
<if test="subtext != null">#{subtext,jdbcType=VARCHAR},</if>
<if test="context != null">#{context,jdbcType=VARCHAR},</if>
<if test="imgurl != null">#{imgurl,jdbcType=VARCHAR},</if>
<if test="type != null">#{type,jdbcType=VARCHAR},</if>
<if test="shareType != null">#{shareType,jdbcType=VARCHAR},</if>
<if test="goal != null">#{goal,jdbcType=VARCHAR},</if>
<if test="shareForm != null">#{shareForm,jdbcType=VARCHAR},</if>
<if test="field != null">#{field,jdbcType=VARCHAR},</if>
<if test="scene != null">#{scene,jdbcType=VARCHAR},</if>
<if test="deptId != null">#{deptId,jdbcType=VARCHAR},</if>
<if test="onlineDate != null">#{onlineDate,jdbcType=VARCHAR},</if>
<if test="content != null">#{content,jdbcType=VARCHAR},</if>
<if test="rank != null">#{rank,jdbcType=VARCHAR},</if>
<if test="useInfo != null">#{useInfo,jdbcType=VARCHAR},</if>
<if test="remarks != null">#{remarks,jdbcType=VARCHAR},</if>
<if test="isUp != null">#{isUp,jdbcType=VARCHAR},</if>
<if test="updateDate != null">#{updateDate,jdbcType=VARCHAR},</if>
<if test="contentImg != null">#{contentImg,jdbcType=VARCHAR},</if>
<if test="id != null">#{id,jdbcType=NUMERIC},</if>
<if test="creator != null">#{creator,jdbcType=NUMERIC},</if>
<if test="createDate != null">#{createDate,jdbcType=TIMESTAMP},</if>
</trim>
</insert>
</mapper>

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="io.renren.modules.eventListTest.dao.EventListControllerDao">
<resultMap type="io.renren.modules.eventListTest.entity.EventListControllerEntity" id="eventListControllerMap">
<result property="id" column="id"/>
<result property="eventType" column="event_type"/>
<result property="eventCnName" column="event_cn_name"/>
<result property="eventDesc" column="event_desc"/>
</resultMap>
</mapper>

View File

@ -11,7 +11,11 @@
<!-- 获取我的通知列表 -->
<select id="getMyNoticeList" resultType="io.renren.modules.notice.entity.SysNoticeEntity">
select t2.id, t2.title, t2.type, t2.sender_name, t2.sender_date, t1.read_status from sys_notice_user t1, sys_notice t2
where t1.notice_id = t2.id and t1.receiver_id = #{receiverId} order by t2.create_date desc
select t2.id, t2.title, t2.type, t2.sender_name, t2.sender_date, t1.read_status, t2.content from sys_notice_user t1, sys_notice t2
where t1.notice_id = t2.id and t1.receiver_id = #{receiverId}
<if test="readStatus != null">
AND read_status = #{readStatus}
</if>
order by t2.create_date desc
</select>
</mapper>

View File

@ -44,4 +44,62 @@
GROUP BY
tbr.type
</select>
<select id="selectDeptApplyCount" resultType="java.util.Map">
SELECT
COUNT(
DISTINCT any_value (
SUBSTRING_INDEX( SUBSTRING_INDEX( tda.attr_value, ';', b.help_topic_id + 1 ), ';',- 1 ))) AS value_,
any_value ( temp.dept_id ) dept_id
FROM
(
SELECT
sys_user.dept_id,
t_ability_application.`user`,
t_ability_application.resource_id,
t_ability_application.approve_status,
t_ability_application.id
FROM
t_ability_application,
tb_data_resource,
sys_user
WHERE
t_ability_application.resource_id = tb_data_resource.id
AND sys_user.id = t_ability_application.user_id
AND sys_user.dept_id IS NOT NULL
) temp
INNER JOIN tb_data_attr tda ON temp.resource_id = tda.data_resource_id
AND tda.attr_type = '应用领域'
AND tda.del_flag = 0
AND temp.approve_status = '通过'
JOIN mysql.help_topic b ON b.help_topic_id &lt; ( LENGTH( tda.attr_value ) - LENGTH( REPLACE ( tda.attr_value, ';', '' ) ) + 1 )
GROUP BY
temp.dept_id
LIMIT #{n}
</select>
<select id="selectDeptApply" resultType="java.lang.String">
SELECT DISTINCT
( tda.attr_value )
FROM
(
SELECT
sys_user.dept_id,
t_ability_application.`user`,
t_ability_application.resource_id,
t_ability_application.approve_status,
t_ability_application.id
FROM
t_ability_application,
tb_data_resource,
sys_user
WHERE
t_ability_application.resource_id = tb_data_resource.id
AND sys_user.id = t_ability_application.user_id
AND sys_user.dept_id IS NOT NULL
AND t_ability_application.approve_status = '通过'
AND sys_user.dept_id = #{deptId}
) temp
INNER JOIN tb_data_attr tda ON temp.resource_id = tda.data_resource_id
AND tda.attr_type = '应用领域'
AND tda.del_flag = 0
</select>
</mapper>

View File

@ -466,32 +466,32 @@
<select id="selectDeptCount" resultType="java.lang.Integer">
SELECT
COUNT( 1 )
COUNT( 1 )
FROM
( SELECT DISTINCT dept_id FROM tb_data_resource WHERE 1 = 1 AND del_flag = 0 AND dept_id IS NOT NULL ) temp
( SELECT DISTINCT dept_id FROM tb_data_resource WHERE 1 = 1 AND del_flag = 0 AND dept_id IS NOT NULL ) temp
</select>
<select id="selectDeptTypeCount" resultType="java.util.Map">
SELECT IFNULL(COUNT(deptId),0) AS "count",
type
type
FROM (
SELECT DISTINCT
tbr.dept_id AS "deptId",
(CASE sd.type
WHEN 1 THEN
'省级'
WHEN 2 THEN
'市级'
WHEN 3 THEN
'区级'
WHEN 4 THEN
'企业' ELSE '其他'
END ) AS "type"
SELECT DISTINCT
tbr.dept_id AS "deptId",
(CASE sd.type
WHEN 1 THEN
'省级'
WHEN 2 THEN
'市级'
WHEN 3 THEN
'区级'
WHEN 4 THEN
'企业' ELSE '其他'
END ) AS "type"
FROM
sys_dept sd
RIGHT JOIN tb_data_resource tbr ON tbr.dept_id = sd.id
sys_dept sd
RIGHT JOIN tb_data_resource tbr ON tbr.dept_id = sd.id
WHERE
1 = 1
1 = 1
AND del_flag = 0
AND dept_id IS NOT NULL) temp GROUP BY type
</select>
@ -505,14 +505,14 @@
SELECT
(
CASE
WHEN ( COUNT( id ) BETWEEN 0 AND 5 ) THEN
'0'
WHEN ( COUNT( id ) BETWEEN 5 AND 10 ) THEN
'5'
WHEN ( COUNT( id ) BETWEEN 10 AND 15 ) THEN
'10'
WHEN ( COUNT( id ) BETWEEN 15 AND 20 ) THEN
'15' ELSE '20'
WHEN ( COUNT( id ) BETWEEN 0 AND 5 ) THEN
'0'
WHEN ( COUNT( id ) BETWEEN 5 AND 10 ) THEN
'5'
WHEN ( COUNT( id ) BETWEEN 10 AND 15 ) THEN
'10'
WHEN ( COUNT( id ) BETWEEN 15 AND 20 ) THEN
'15' ELSE '20'
END
) AS "type"
FROM
@ -526,5 +526,343 @@
GROUP BY
type
</select>
<select id="selectDeptProvideCount" resultType="java.util.Map">
SELECT
COUNT( DISTINCT temp.value_ ) count,
any_value ( tdr.dept_id ) dept_id
FROM
(
SELECT
SUBSTRING_INDEX( SUBSTRING_INDEX( tdav.attr_value, ';', b.help_topic_id + 1 ), ';',- 1 ) AS value_,
tdav.data_resource_id AS resourceId
FROM
tb_data_attr tdav
JOIN mysql.help_topic b ON b.help_topic_id &lt; ( LENGTH( tdav.attr_value ) - LENGTH( REPLACE ( tdav.attr_value, ';', '' ) ) + 1 )
WHERE
1 = 1
AND tdav.attr_type = '应用领域'
AND tdav.del_flag = 0
) temp
INNER JOIN tb_data_resource tdr ON temp.resourceId = tdr.id
AND tdr.dept_id IS NOT NULL
GROUP BY
tdr.dept_id
ORDER BY
count DESC
LIMIT #{n}
</select>
<select id="selectDeptProvide" resultType="java.lang.String">
SELECT DISTINCT
tda.attr_value
FROM
tb_data_attr tda
INNER JOIN tb_data_resource tdr ON tda.data_resource_id = tdr.id
AND tdr.dept_id = #{deptId}
WHERE
tda.attr_type = '应用领域'
</select>
<select id="selectMaxDeptIds" resultType="java.lang.Long">
SELECT
dept_id
FROM
(
SELECT
COUNT( id ) AS "count",
dept_id
FROM
tb_data_resource
WHERE
1 = 1
AND del_flag = 0
AND dept_id IS NOT NULL
GROUP BY
dept_id
) temp1
WHERE
temp1.count = (
SELECT
MAX( count ) AS "total"
FROM
(
SELECT
COUNT( id ) AS "count",
dept_id
FROM
tb_data_resource
WHERE
1 = 1
AND del_flag = 0
AND dept_id IS NOT NULL
GROUP BY
dept_id
) temp2
)
</select>
<select id="selectByDeptId" resultType="java.util.Map">
SELECT id,
name
FROM tb_data_resource
WHERE 1 = 1
AND del_flag = 0
AND dept_id = #{deptId}
</select>
<select id="selectDeptCountList" resultType="java.util.Map">
SELECT
sd.id AS "deptId",
sd.NAME AS "deptName",
COUNT( tdr.id ) AS "total"
FROM
tb_data_resource tdr,
sys_dept sd
WHERE
1 = 1
AND tdr.del_flag = 0
AND tdr.dept_id = sd.id
GROUP BY tdr.dept_id
ORDER BY total DESC
</select>
<select id="selectMaxApplyDeptIds" resultType="java.lang.Long">
SELECT
dept_id
FROM
(
SELECT
COUNT( taa.id ) AS "count",
su.dept_id
FROM
t_ability_application taa,
sys_user su
WHERE
1 = 1
AND taa.user_id = su.id
AND taa.user_id IS NOT NULL
GROUP BY
su.dept_id
) temp1
WHERE
temp1.count = (
SELECT
MAX( count ) AS "total"
FROM
(
SELECT
COUNT( taa.id ) AS "count",
su.dept_id
FROM
t_ability_application taa,
sys_user su
WHERE
1 = 1
AND taa.user_id = su.id
AND taa.user_id IS NOT NULL
GROUP BY
su.dept_id
) temp2
)
</select>
<select id="selectByApplyDeptId" resultType="java.util.Map">
SELECT tdr.id,
tdr.name
FROM t_ability_application taa, tb_data_resource tdr, sys_user su
WHERE 1 = 1
AND tdr.del_flag = 0
AND su.id = taa.user_id
AND taa.resource_id = tdr.id
AND su.dept_id = #{deptId}
</select>
<select id="selectApplyDeptCountList" resultType="java.util.Map">
SELECT
sd.id AS "deptId",
sd.NAME AS "deptName",
COUNT( taa.resource_id ) AS "total"
FROM
t_ability_application taa,
sys_user su,
sys_dept sd
WHERE
1 = 1
AND su.id = taa.user_id
AND su.dept_id = sd.id
GROUP BY
sd.id
ORDER BY
total DESC
</select>
<select id="selectDeptTypeCountList" resultType="java.util.Map">
SELECT
COUNT( tdr.id ) AS "count",
sd.NAME AS "deptName",
(CASE tdr.type
WHEN '应用资源' THEN 'yyzy'
WHEN '组件服务' THEN 'zjfw'
WHEN '基础设施' THEN 'jcss'
WHEN '知识库' THEN 'zsk'
WHEN '数据资源' THEN 'sjzy'
ELSE 'yyzy' END)AS "type"
FROM
tb_data_resource tdr,
sys_dept sd
WHERE
1 = 1
AND tdr.del_flag = 0
AND tdr.dept_id = sd.id
GROUP BY
tdr.dept_id,
tdr.type
</select>
<select id="selectApplyDeptTypeCountList" resultType="java.util.Map">
SELECT
COUNT( taa.resource_id ) AS "count",
sd.NAME AS "deptName",
(
CASE
tdr.type
WHEN '应用资源' THEN
'yyzy'
WHEN '组件服务' THEN
'zjfw'
WHEN '基础设施' THEN
'jcss'
WHEN '知识库' THEN
'zsk'
WHEN '数据资源' THEN
'sjzy' ELSE 'yyzy'
END
) AS "type"
FROM
tb_data_resource tdr,
sys_dept sd,
sys_user su,
t_ability_application taa
WHERE
1 = 1
AND tdr.del_flag = 0
AND taa.user_id = su.id
AND su.dept_id = sd.id
AND taa.resource_id = tdr.id
GROUP BY
sd.id,
tdr.type
</select>
<select id="selectMaxType" resultType="java.lang.String">
SELECT
type
FROM
( SELECT COUNT( id ) AS "count", type FROM tb_data_resource WHERE 1 = 1 AND del_flag = 0 GROUP BY type ) temp1
WHERE
temp1.count = (
SELECT
MAX( count ) AS "total"
FROM
( SELECT COUNT( id ) AS "count", type FROM tb_data_resource WHERE 1 = 1 AND del_flag = 0 GROUP BY type ) temp2
)
</select>
<select id="selectByType" resultType="java.util.Map">
SELECT id,
name
FROM tb_data_resource
WHERE 1 = 1
AND del_flag = 0
AND type = #{type}
</select>
<select id="selectTypeCountList" resultType="java.util.Map">
SELECT
tdr.type,
COUNT( tdr.id ) AS "total"
FROM
tb_data_resource tdr
WHERE
1 = 1
AND tdr.del_flag = 0
GROUP BY
tdr.type
ORDER BY
total DESC
</select>
<select id="selectMaxAppArea" resultType="java.lang.String">
SELECT
type
FROM
(
SELECT
SUBSTRING_INDEX( SUBSTRING_INDEX( tdav.attr_value, ';', b.help_topic_id + 1 ), ';',- 1 ) AS "type",
COUNT( tdav.data_resource_id ) AS "count"
FROM
tb_data_attr tdav
JOIN mysql.help_topic b ON b.help_topic_id &lt; ( LENGTH( tdav.attr_value ) - LENGTH( REPLACE ( tdav.attr_value, ';', '' ) ) + 1 )
WHERE
1 = 1
AND tdav.attr_type = '应用领域'
AND tdav.del_flag = 0
AND SUBSTRING_INDEX( SUBSTRING_INDEX( tdav.attr_value, ';', b.help_topic_id + 1 ), ';',- 1 ) != ''
GROUP BY
type
) temp1
WHERE
temp1.count = (
SELECT
MAX( count ) AS "total"
FROM
(
SELECT
SUBSTRING_INDEX( SUBSTRING_INDEX( tdav.attr_value, ';', b.help_topic_id + 1 ), ';',- 1 ) AS "type",
COUNT( tdav.data_resource_id ) AS "count"
FROM
tb_data_attr tdav
JOIN mysql.help_topic b ON b.help_topic_id &lt; ( LENGTH( tdav.attr_value ) - LENGTH( REPLACE ( tdav.attr_value, ';', '' ) ) + 1 )
WHERE
1 = 1
AND tdav.attr_type = '应用领域'
AND tdav.del_flag = 0
AND SUBSTRING_INDEX( SUBSTRING_INDEX( tdav.attr_value, ';', b.help_topic_id + 1 ), ';',- 1 ) != ''
GROUP BY
type
) temp2
)
</select>
<select id="selectByAppArea" resultType="java.util.Map">
SELECT
tdr.id,
tdr.name
FROM
tb_data_resource tdr,
tb_data_attr tda
WHERE
1 = 1
AND tdr.del_flag = 0
AND tda.del_flag = 0
AND tdr.id = tda.data_resource_id
AND attr_value LIKE CONCAT('%', #{type}, '%')
</select>
<select id="selectAppAreaCountList" resultType="java.util.Map">
SELECT
SUBSTRING_INDEX( SUBSTRING_INDEX( tdav.attr_value, ';', b.help_topic_id + 1 ), ';',- 1 ) AS "type",
COUNT( tdav.data_resource_id ) AS "total"
FROM
tb_data_attr tdav
JOIN mysql.help_topic b ON b.help_topic_id &lt; ( LENGTH( tdav.attr_value ) - LENGTH( REPLACE ( tdav.attr_value, ';', '' ) ) + 1 )
WHERE
1 = 1
AND tdav.attr_type = '应用领域'
AND tdav.del_flag = 0
AND SUBSTRING_INDEX( SUBSTRING_INDEX( tdav.attr_value, ';', b.help_topic_id + 1 ), ';',- 1 ) != ''
GROUP BY
type
</select>
</mapper>

View File

@ -16,7 +16,8 @@
<result property="note2" column="note2"/>
<result property="note3" column="note3"/>
</resultMap>
<select id="selectDayAvg" resultType="java.lang.Integer">
<select id="selectDayAvg" resultType="java.lang.Long">
SELECT IFNULL(COUNT(id), 0) / ${days}
FROM tb_resource_browse
WHERE 1 = 1
@ -46,7 +47,7 @@
WHERE
1 = 1
AND state = 0
AND create_date BETWEEN ${startDate} AND ${endDate}
AND SUBSTR(create_date, 1, 10) BETWEEN #{startDate} AND #{endDate}
GROUP BY
SUBSTR(create_date, 1, 10)
</select>

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="io.renren.modules.taskList.dao.TaskListControllerDao">
<resultMap type="io.renren.modules.taskList.entity.TaskListControllerEntity" id="taskListControllerMap">
<result property="id" column="id"/>
<result property="taskSerial" column="task_serial"/>
<result property="taskName" column="task_name"/>
<result property="taskStatus" column="task_status"/>
<result property="eventType" column="event_type"/>
<result property="eventCnName" column="event_cn_name"/>
</resultMap>
<delete id="deleteAll">
TRUNCATE TABLE tb_task_list
</delete>
</mapper>

View File

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="io.renren.modules.warningList.dao.WarningListControllerDao">
<resultMap type="io.renren.modules.warningList.entity.WarningListControllerEntity" id="warningListControllerMap">
<result property="id" column="id"/>
<result property="eventCnName" column="event_cn_name"/>
<result property="eventSerial" column="event_serial"/>
<result property="color" column="color"/>
<result property="vehicle" column="vehicle"/>
<result property="classes" column="classes"/>
<result property="cameraName" column="camera_name"/>
<result property="district" column="district"/>
<result property="latitude" column="latitude"/>
<result property="longitude" column="longitude"/>
<result property="imageUrl" column="image_url"/>
<result property="taskId" column="task_id"/>
<result property="captureTime" column="capture_time"/>
<result property="trackEvent" column="track_event"/>
</resultMap>
</mapper>