...
This commit is contained in:
parent
b05a371a0a
commit
3734453796
Binary file not shown.
|
@ -32,6 +32,12 @@
|
||||||
<renren.version>2.9.0</renren.version>
|
<renren.version>2.9.0</renren.version>
|
||||||
<groovy-all.version>2.4.17</groovy-all.version>
|
<groovy-all.version>2.4.17</groovy-all.version>
|
||||||
<pinyin4j.version>2.5.1</pinyin4j.version>
|
<pinyin4j.version>2.5.1</pinyin4j.version>
|
||||||
|
<spring-boot-starter-cache.version>2.4.4</spring-boot-starter-cache.version>
|
||||||
|
<fastjson.version>1.2.72</fastjson.version>
|
||||||
|
<ehcache.version>2.10.6</ehcache.version>
|
||||||
|
<javacv.version>1.5.7</javacv.version>
|
||||||
|
<system.linux-x86_64>linux-x86_64</system.linux-x86_64>
|
||||||
|
<ffmpeg.version>5.0</ffmpeg.version>
|
||||||
<java.version>1.8</java.version>
|
<java.version>1.8</java.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
|
@ -223,6 +229,43 @@
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-test-autoconfigure</artifactId>
|
<artifactId>spring-boot-test-autoconfigure</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba</groupId>
|
||||||
|
<artifactId>fastjson</artifactId>
|
||||||
|
<version>${fastjson.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<!--缓存-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-cache</artifactId>
|
||||||
|
<version>${spring-boot-starter-cache.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>net.sf.ehcache</groupId>
|
||||||
|
<artifactId>ehcache</artifactId>
|
||||||
|
<version>${ehcache.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- javacv+javacpp核心库-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.bytedeco</groupId>
|
||||||
|
<artifactId>javacv</artifactId>
|
||||||
|
<version>${javacv.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.bytedeco</groupId>
|
||||||
|
<artifactId>javacpp-platform</artifactId>
|
||||||
|
<version>${javacv.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<!-- ffmpeg最小依赖包,必须包含上面的javacv+javacpp核心库 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.bytedeco</groupId>
|
||||||
|
<artifactId>ffmpeg</artifactId>
|
||||||
|
<version>${ffmpeg.version}-${javacv.version}</version>
|
||||||
|
<classifier>${system.linux-x86_64}</classifier>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
@ -232,7 +275,7 @@
|
||||||
<directory>src/main/resources</directory>
|
<directory>src/main/resources</directory>
|
||||||
<excludes>
|
<excludes>
|
||||||
<!-- 排除生产环境配置 -->
|
<!-- 排除生产环境配置 -->
|
||||||
<exclude>application-prod.yml</exclude>
|
<!-- <exclude>application-prod.yml</exclude>-->
|
||||||
</excludes>
|
</excludes>
|
||||||
</resource>
|
</resource>
|
||||||
<resource>
|
<resource>
|
||||||
|
|
|
@ -1,9 +1,14 @@
|
||||||
package io.renren;
|
package io.renren;
|
||||||
|
|
||||||
|
import org.mybatis.spring.annotation.MapperScan;
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||||
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
|
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
|
||||||
|
import org.springframework.cache.annotation.EnableCaching;
|
||||||
|
import org.springframework.context.annotation.ComponentScan;
|
||||||
|
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||||
|
import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -14,10 +19,15 @@ import org.springframework.boot.web.servlet.support.SpringBootServletInitializer
|
||||||
org.activiti.spring.boot.SecurityAutoConfiguration.class,
|
org.activiti.spring.boot.SecurityAutoConfiguration.class,
|
||||||
org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration.class
|
org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration.class
|
||||||
})
|
})
|
||||||
|
@EnableSwagger2
|
||||||
|
//@MapperScan("io.renren.modules.monitor.mapper")
|
||||||
|
@EnableCaching
|
||||||
|
@EnableScheduling
|
||||||
public class AdminApplication extends SpringBootServletInitializer {
|
public class AdminApplication extends SpringBootServletInitializer {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
SpringApplication.run(AdminApplication.class, args);
|
SpringApplication.run(AdminApplication.class, args);
|
||||||
|
System.out.println("项目启动成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -5,7 +5,13 @@ import io.renren.common.annotation.ActivitiNoticeOperation;
|
||||||
import io.renren.modules.notice.dto.SysNoticeDTO;
|
import io.renren.modules.notice.dto.SysNoticeDTO;
|
||||||
import io.renren.modules.notice.enums.NoticeStatusEnum;
|
import io.renren.modules.notice.enums.NoticeStatusEnum;
|
||||||
import io.renren.modules.notice.service.SysNoticeService;
|
import io.renren.modules.notice.service.SysNoticeService;
|
||||||
|
import io.renren.modules.resource.dto.ResourceDTO;
|
||||||
|
import io.renren.modules.resource.service.ResourceService;
|
||||||
|
import io.renren.modules.sys.dto.SysDeptDTO;
|
||||||
|
import io.renren.modules.sys.dto.SysRoleDTO;
|
||||||
import io.renren.modules.sys.dto.SysUserDTO;
|
import io.renren.modules.sys.dto.SysUserDTO;
|
||||||
|
import io.renren.modules.sys.service.SysDeptService;
|
||||||
|
import io.renren.modules.sys.service.SysRoleService;
|
||||||
import io.renren.modules.sys.service.SysUserService;
|
import io.renren.modules.sys.service.SysUserService;
|
||||||
import org.activiti.engine.delegate.DelegateExecution;
|
import org.activiti.engine.delegate.DelegateExecution;
|
||||||
import org.activiti.engine.delegate.DelegateTask;
|
import org.activiti.engine.delegate.DelegateTask;
|
||||||
|
@ -20,6 +26,7 @@ import org.aspectj.lang.reflect.MethodSignature;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
|
@ -38,8 +45,19 @@ public class ActivitiNoticeAspect {
|
||||||
private SysNoticeService sysNoticeService;
|
private SysNoticeService sysNoticeService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private SysUserService sysUserService;
|
private SysUserService sysUserService;
|
||||||
|
@Autowired
|
||||||
|
private ResourceService resourceService;
|
||||||
|
@Autowired
|
||||||
|
private SysDeptService sysDeptService;
|
||||||
|
@Autowired
|
||||||
|
private SysRoleService sysRoleService;
|
||||||
private Set<String> work_ = new CopyOnWriteArraySet<>();
|
private Set<String> work_ = new CopyOnWriteArraySet<>();
|
||||||
|
|
||||||
|
@Value("${big_date.name}")
|
||||||
|
private String bigDateDeptName; // 大数据局名称
|
||||||
|
@Value("${big_date.assignee_role_name}")
|
||||||
|
private String roleName; // 具备审批的角色名称
|
||||||
|
|
||||||
public ActivitiNoticeAspect() {
|
public ActivitiNoticeAspect() {
|
||||||
logger.error("构造:ActivitiNoticeAspect");
|
logger.error("构造:ActivitiNoticeAspect");
|
||||||
}
|
}
|
||||||
|
@ -62,11 +80,14 @@ public class ActivitiNoticeAspect {
|
||||||
Arrays.asList(joinPoint.getArgs()).stream().findFirst().ifPresent(arg -> {
|
Arrays.asList(joinPoint.getArgs()).stream().findFirst().ifPresent(arg -> {
|
||||||
final DelegateTask delegateTask = (DelegateTask) arg;
|
final DelegateTask delegateTask = (DelegateTask) arg;
|
||||||
final String eventName = delegateTask.getEventName();
|
final String eventName = delegateTask.getEventName();
|
||||||
|
logger.error("任务监听器事件:" + eventName);
|
||||||
switch (eventName) {
|
switch (eventName) {
|
||||||
case TaskListener.EVENTNAME_ASSIGNMENT: // 节点被委派给某人
|
case TaskListener.EVENTNAME_ASSIGNMENT: // 节点被委派给某人
|
||||||
logger.error("任务监听器事件:" + eventName);
|
|
||||||
assignment_notice(delegateTask, activitiNoticeOperation);
|
assignment_notice(delegateTask, activitiNoticeOperation);
|
||||||
break;
|
break;
|
||||||
|
case TaskListener.EVENTNAME_COMPLETE: // 节点执行完成
|
||||||
|
task_complete_notice(delegateTask, activitiNoticeOperation);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -76,9 +97,9 @@ public class ActivitiNoticeAspect {
|
||||||
Arrays.asList(joinPoint.getArgs()).stream().findFirst().ifPresent(arg -> {
|
Arrays.asList(joinPoint.getArgs()).stream().findFirst().ifPresent(arg -> {
|
||||||
final DelegateExecution execution = (DelegateExecution) arg;
|
final DelegateExecution execution = (DelegateExecution) arg;
|
||||||
final String eventName = execution.getEventName();
|
final String eventName = execution.getEventName();
|
||||||
switch (eventName) {
|
|
||||||
case ExecutionListener.EVENTNAME_END: // 节点被委派给某人
|
|
||||||
logger.error("执行监听器事件:" + eventName);
|
logger.error("执行监听器事件:" + eventName);
|
||||||
|
switch (eventName) {
|
||||||
|
case ExecutionListener.EVENTNAME_END: // 流程完成
|
||||||
end_notice(execution, activitiNoticeOperation);
|
end_notice(execution, activitiNoticeOperation);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -92,6 +113,86 @@ public class ActivitiNoticeAspect {
|
||||||
logger.error("执行时长{} ms", time);
|
logger.error("执行时长{} ms", time);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 进行节点流转
|
||||||
|
*
|
||||||
|
* @param delegateTask
|
||||||
|
* @param activitiNoticeOperation
|
||||||
|
*/
|
||||||
|
private void task_complete_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 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(() -> { // 发起人
|
||||||
|
SysUserDTO userDTO = sysUserService.get(Long.valueOf(finalCreator));
|
||||||
|
Long resourceId = null;
|
||||||
|
if (kv.containsKey("resourceId")) {
|
||||||
|
resourceId = Long.valueOf(kv.get("resourceId").toString());
|
||||||
|
} else if (kv.containsKey("id")) {
|
||||||
|
resourceId = Long.valueOf(kv.get("id").toString());
|
||||||
|
}
|
||||||
|
Optional<ResourceDTO> resourceDTO = Optional.ofNullable(resourceService.get(resourceId));
|
||||||
|
kv.get("resourceId");
|
||||||
|
kv.get("id");
|
||||||
|
String content = "【通知】" + userDTO.getRealName() + ",您发起的" + (resourceDTO.isPresent() ? resourceDTO.get().getName() : "")
|
||||||
|
+ activitiNoticeOperation.process() + " " + activitiNoticeOperation.value() + "节点" + 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 e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 流程结束时通知
|
* 流程结束时通知
|
||||||
*
|
*
|
||||||
|
@ -130,8 +231,19 @@ public class ActivitiNoticeAspect {
|
||||||
}
|
}
|
||||||
String finalCreator = creator;
|
String finalCreator = creator;
|
||||||
String finalResult = result;
|
String finalResult = result;
|
||||||
|
Long resourceId = null;
|
||||||
|
if (kv.containsKey("resourceId")) {
|
||||||
|
resourceId = Long.valueOf(kv.get("resourceId").toString());
|
||||||
|
} else if (kv.containsKey("id")) {
|
||||||
|
resourceId = Long.valueOf(kv.get("id").toString());
|
||||||
|
}
|
||||||
|
Optional<ResourceDTO> resourceDTO = Optional.ofNullable(resourceService.get(resourceId));
|
||||||
CompletableFuture.runAsync(() -> { // 发起人
|
CompletableFuture.runAsync(() -> { // 发起人
|
||||||
String content = "您发起的流程<" + activitiNoticeOperation.process() + "> 已结束。审核结果为:" + finalResult;
|
SysUserDTO userDTO = sysUserService.get(Long.valueOf(finalCreator));
|
||||||
|
kv.get("resourceId");
|
||||||
|
kv.get("id");
|
||||||
|
String content = "【通知】" + userDTO.getRealName() + ",您发起的" + (resourceDTO.isPresent() ? resourceDTO.get().getName() : "")
|
||||||
|
+ activitiNoticeOperation.process() + "已完成,审核结果为:" + finalResult;
|
||||||
SysNoticeDTO dto = new SysNoticeDTO();
|
SysNoticeDTO dto = new SysNoticeDTO();
|
||||||
dto.setType(2);
|
dto.setType(2);
|
||||||
dto.setTitle("流程结束系统通知");
|
dto.setTitle("流程结束系统通知");
|
||||||
|
@ -144,6 +256,30 @@ public class ActivitiNoticeAspect {
|
||||||
dto.setCreator(sysUserService.getByUsername("admin").getId());
|
dto.setCreator(sysUserService.getByUsername("admin").getId());
|
||||||
dto.setCreateDate(new Date());
|
dto.setCreateDate(new Date());
|
||||||
sysNoticeService.save(dto);
|
sysNoticeService.save(dto);
|
||||||
|
}).thenRunAsync(() -> {
|
||||||
|
logger.error("大数据局名称:" + bigDateDeptName);
|
||||||
|
SysDeptDTO deptDTO = sysDeptService.getByName(bigDateDeptName);
|
||||||
|
logger.error("deptDTOId:" + deptDTO.getId());
|
||||||
|
SysRoleDTO roleDTO = sysRoleService.getByName(roleName);
|
||||||
|
logger.error("roleDTOId:" + roleDTO.getId());
|
||||||
|
Optional<SysUserDTO> userDTO = Optional.ofNullable(sysUserService.getByDeptIdAndRoleId(deptDTO.getId(), roleDTO.getId()));
|
||||||
|
userDTO.ifPresent(user -> {
|
||||||
|
SysUserDTO creatorDTO = sysUserService.get(Long.valueOf(finalCreator));
|
||||||
|
SysNoticeDTO dto = new SysNoticeDTO();
|
||||||
|
dto.setType(2);
|
||||||
|
dto.setTitle("流程结束系统通知");
|
||||||
|
String content = "【通知】" + user.getRealName() + "," + creatorDTO.getRealName() + "发起的" + (resourceDTO.isPresent() ? resourceDTO.get().getName() : "")
|
||||||
|
+ activitiNoticeOperation.process() + "已完成,审核结果为:" + finalResult;
|
||||||
|
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(() -> {
|
}).thenRunAsync(() -> {
|
||||||
// 防止重放
|
// 防止重放
|
||||||
new Thread(() -> {
|
new Thread(() -> {
|
||||||
|
|
|
@ -9,6 +9,9 @@ import org.springframework.http.converter.StringHttpMessageConverter;
|
||||||
import org.springframework.web.client.RestTemplate;
|
import org.springframework.web.client.RestTemplate;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.net.InetSocketAddress;
|
||||||
|
import java.net.Proxy;
|
||||||
|
import java.net.SocketAddress;
|
||||||
import java.nio.charset.Charset;
|
import java.nio.charset.Charset;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
|
||||||
|
@ -27,6 +30,10 @@ public class RestTemplateConfig {
|
||||||
SimpleClientHttpRequestFactory factory = new SimpleClientHttpRequestFactory();
|
SimpleClientHttpRequestFactory factory = new SimpleClientHttpRequestFactory();
|
||||||
factory.setReadTimeout(30000);//单位为ms
|
factory.setReadTimeout(30000);//单位为ms
|
||||||
factory.setConnectTimeout(30000);//单位为ms
|
factory.setConnectTimeout(30000);//单位为ms
|
||||||
|
|
||||||
|
// SocketAddress address = new InetSocketAddress("127.0.0.1", 8888);
|
||||||
|
// Proxy proxy = new Proxy(Proxy.Type.HTTP, address);
|
||||||
|
// factory.setProxy(proxy);
|
||||||
return factory;
|
return factory;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,112 +0,0 @@
|
||||||
package io.renren.common.interceptor;
|
|
||||||
|
|
||||||
import com.yawei.pso.PSORequest;
|
|
||||||
import com.yawei.pso.SSOResponse;
|
|
||||||
import com.yawei.pso.TicketManager;
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
import org.springframework.web.servlet.HandlerInterceptor;
|
|
||||||
import org.springframework.web.servlet.ModelAndView;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
import java.net.URLEncoder;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.Map.Entry;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 亚微 sso拦截
|
|
||||||
*/
|
|
||||||
@Component
|
|
||||||
public class IdentityInterceptor implements HandlerInterceptor {
|
|
||||||
private static Logger logger = LoggerFactory.getLogger(IdentityInterceptor.class);
|
|
||||||
|
|
||||||
public final static String SEESION_USER = "seesion_user";
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private YaweiSSOProperties yaweiSSOProperties;
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
|
|
||||||
logger.info("==============执行顺序: 1、preHandle================");
|
|
||||||
// 获取当前请求的url
|
|
||||||
String requestUri = request.getRequestURI();
|
|
||||||
|
|
||||||
Validator validator = Validator.getInstance();
|
|
||||||
|
|
||||||
String strResponse = request.getParameter(yaweiSSOProperties.getSsoKey());
|
|
||||||
if (StringUtils.isEmpty(strResponse)) {
|
|
||||||
TicketManager tm = new TicketManager();
|
|
||||||
if (!tm.LoadTicket(request)) {
|
|
||||||
PSORequest psoRequest = new PSORequest(request);
|
|
||||||
String requeststr = psoRequest.CreateHash();
|
|
||||||
|
|
||||||
String keeperUrl = yaweiSSOProperties.getKeeperUrl();
|
|
||||||
keeperUrl = keeperUrl + "?" + yaweiSSOProperties.getSsoKey() + "="
|
|
||||||
+ URLEncoder.encode(requeststr, "UTF-8");
|
|
||||||
response.addHeader("REDIRECT", keeperUrl);
|
|
||||||
response.sendRedirect(keeperUrl);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// 如果服务器端通过认证后,会返回后执行改操作,然后写入cookie
|
|
||||||
SSOResponse ssoResp = new SSOResponse(strResponse);
|
|
||||||
TicketManager tm = ssoResp.CreatePSOTicket();
|
|
||||||
if (tm == null) {
|
|
||||||
PSORequest psoRequest = new PSORequest(request);
|
|
||||||
String requeststr = psoRequest.CreateHash();
|
|
||||||
|
|
||||||
String keeperUrl = yaweiSSOProperties.getKeeperUrl();
|
|
||||||
keeperUrl = keeperUrl + "?" + yaweiSSOProperties.getSsoKey() + "="
|
|
||||||
+ URLEncoder.encode(requeststr, "UTF-8");
|
|
||||||
response.sendRedirect(keeperUrl);
|
|
||||||
} else {
|
|
||||||
String domainName = yaweiSSOProperties.getDomain();
|
|
||||||
tm.SaveTicket(response, domainName);
|
|
||||||
Iterator<Entry<String, String[]>> iterator = request
|
|
||||||
.getParameterMap().entrySet().iterator();
|
|
||||||
StringBuffer param = new StringBuffer();
|
|
||||||
int i = 0;
|
|
||||||
while (iterator.hasNext()) {
|
|
||||||
Entry<String, String[]> entry = (Entry<String, String[]>) iterator
|
|
||||||
.next();
|
|
||||||
if (entry.getKey().equals(yaweiSSOProperties.getSsoKey()))
|
|
||||||
continue;
|
|
||||||
else {
|
|
||||||
i++;
|
|
||||||
if (i == 1)
|
|
||||||
param.append("?").append(entry.getKey())
|
|
||||||
.append("=");
|
|
||||||
else
|
|
||||||
param.append("&").append(entry.getKey())
|
|
||||||
.append("=");
|
|
||||||
|
|
||||||
if (entry.getValue() instanceof String[]) {
|
|
||||||
param.append(((String[]) entry.getValue())[0]);
|
|
||||||
} else {
|
|
||||||
param.append(entry.getValue());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
response.sendRedirect(requestUri + param.toString());
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
validator.SetUserTicket(request);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
|
|
||||||
logger.info("==============执行顺序: 2、postHandle================");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
|
|
||||||
logger.info("==============执行顺序: 3、afterCompletion================");
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,83 +0,0 @@
|
||||||
package io.renren.common.interceptor;
|
|
||||||
|
|
||||||
import com.yawei.pso.TicketManager;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
import javax.servlet.http.HttpSession;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 验证器
|
|
||||||
*/
|
|
||||||
public class Validator {
|
|
||||||
private static Logger logger = LoggerFactory.getLogger(Validator.class);
|
|
||||||
private static ThreadLocal<Validator> validatorHolder = new ThreadLocal<Validator>() {
|
|
||||||
|
|
||||||
protected Validator initialValue() {
|
|
||||||
return new Validator();
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
// 当前请求的session
|
|
||||||
private HttpSession session = null;
|
|
||||||
|
|
||||||
// 当前的请求
|
|
||||||
private HttpServletRequest request = null;
|
|
||||||
|
|
||||||
private Validator() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Validator getInstance() {
|
|
||||||
return validatorHolder.get();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 执行初始化
|
|
||||||
*
|
|
||||||
* @param httpRequest
|
|
||||||
*/
|
|
||||||
public void init(HttpServletRequest httpRequest) {
|
|
||||||
this.request = httpRequest;
|
|
||||||
this.session = request.getSession();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 将凭证身份加入到session
|
|
||||||
*
|
|
||||||
* @param httpRequest
|
|
||||||
*/
|
|
||||||
public void SetUserTicket(HttpServletRequest httpRequest) {
|
|
||||||
try {
|
|
||||||
if (httpRequest.getSession()
|
|
||||||
.getAttribute(IdentityInterceptor.SEESION_USER) == null) {
|
|
||||||
TicketManager ticket = new TicketManager();
|
|
||||||
if (ticket.LoadTicket(httpRequest)) {
|
|
||||||
// 登录用户姓名
|
|
||||||
String userName = ticket.getUserName();
|
|
||||||
// 登录用户账号
|
|
||||||
String userAccount = ticket.getUserID();
|
|
||||||
// 登录用户标识
|
|
||||||
String userGuid = ticket.getADGUID();
|
|
||||||
logger.info("===userName===" + userName);
|
|
||||||
logger.info("===userAccount===" + userAccount);
|
|
||||||
logger.info("===userGuid===" + userGuid);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
|
|
||||||
}
|
|
||||||
} catch (Exception ex) {
|
|
||||||
logger.error("", ex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 清除session
|
|
||||||
*/
|
|
||||||
public void cancel() {
|
|
||||||
this.session = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -172,7 +172,7 @@ public class ActModelService {
|
||||||
BufferedImage bufferedImage = ImageIO.read(in);
|
BufferedImage bufferedImage = ImageIO.read(in);
|
||||||
ImageIO.write(bufferedImage, "png", response.getOutputStream());
|
ImageIO.write(bufferedImage, "png", response.getOutputStream());
|
||||||
} else {
|
} else {
|
||||||
response.getWriter().println("No image Info!");
|
response.getOutputStream().println("No image Info!");
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
package io.renren.modules.monitor.config;
|
||||||
|
|
||||||
|
import net.sf.ehcache.CacheManager;
|
||||||
|
import org.springframework.cache.annotation.EnableCaching;
|
||||||
|
import org.springframework.cache.ehcache.EhCacheCacheManager;
|
||||||
|
import org.springframework.cache.ehcache.EhCacheManagerFactoryBean;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.core.io.ClassPathResource;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author admin
|
||||||
|
* @version 1.0.0
|
||||||
|
* @ClassName CachingConfig.java
|
||||||
|
* @Description cache配置
|
||||||
|
* @createTime 2022年05月12日 09:45:00
|
||||||
|
*/
|
||||||
|
@Configuration
|
||||||
|
@EnableCaching
|
||||||
|
public class CachingConfig {
|
||||||
|
@Bean
|
||||||
|
public EhCacheCacheManager cacheManager(CacheManager cm) {
|
||||||
|
return new EhCacheCacheManager(cm);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public EhCacheManagerFactoryBean ehcache() {
|
||||||
|
EhCacheManagerFactoryBean cacheManagerFactoryBean = new EhCacheManagerFactoryBean();
|
||||||
|
cacheManagerFactoryBean.setConfigLocation(new ClassPathResource("ehcache.xml"));
|
||||||
|
return cacheManagerFactoryBean;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
package io.renren.modules.monitor.config;
|
||||||
|
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.web.cors.CorsConfiguration;
|
||||||
|
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
|
||||||
|
import org.springframework.web.filter.CorsFilter;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
public class GlobalCorsConfig {
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public CorsFilter corsFilter() {
|
||||||
|
//1. 添加 CORS配置信息
|
||||||
|
CorsConfiguration config = new CorsConfiguration();
|
||||||
|
//放行哪些原始域
|
||||||
|
config.addAllowedOrigin("*");
|
||||||
|
//是否发送 Cookie
|
||||||
|
config.setAllowCredentials(true);
|
||||||
|
//放行哪些请求方式
|
||||||
|
config.addAllowedMethod("*");
|
||||||
|
//放行哪些原始请求头部信息
|
||||||
|
config.addAllowedHeader("*");
|
||||||
|
//暴露哪些头部信息
|
||||||
|
config.addExposedHeader("*");
|
||||||
|
//2. 添加映射路径
|
||||||
|
UrlBasedCorsConfigurationSource corsConfigurationSource = new UrlBasedCorsConfigurationSource();
|
||||||
|
corsConfigurationSource.registerCorsConfiguration("/**",config);
|
||||||
|
//3. 返回新的CorsFilter
|
||||||
|
return new CorsFilter(corsConfigurationSource);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,58 @@
|
||||||
|
package io.renren.modules.monitor.controller;
|
||||||
|
|
||||||
|
import io.renren.modules.monitor.entity.BuildingRecords;
|
||||||
|
import io.renren.modules.monitor.entity.Result;
|
||||||
|
import io.renren.modules.monitor.service.BuildingRecordsService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author admin
|
||||||
|
* @version 1.0.0
|
||||||
|
* @ClassName BuildingController.java
|
||||||
|
* @Description 工地
|
||||||
|
* @createTime 2022年05月17日 15:26:00
|
||||||
|
*/
|
||||||
|
@Api(tags = "工地")
|
||||||
|
@RequestMapping("api/project/building")
|
||||||
|
@RestController
|
||||||
|
public class BuildingController {
|
||||||
|
@Autowired
|
||||||
|
private BuildingRecordsService buildingRecordsService;
|
||||||
|
|
||||||
|
@GetMapping("/getRecords")
|
||||||
|
@ApiOperation("测试,获取工地实时数据--调用接口")
|
||||||
|
public List<Map> getRecords(){
|
||||||
|
return buildingRecordsService.getRecords();
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/getAndSaveRecords")
|
||||||
|
@ApiOperation("获取工地实时数据并保存到表中--调用接口获取")
|
||||||
|
public Result getAndSaveRecords(){
|
||||||
|
boolean result = buildingRecordsService.getAndSaveRecords();
|
||||||
|
if(result){
|
||||||
|
return Result.success();
|
||||||
|
}else{
|
||||||
|
return Result.error(String.valueOf(result));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/listRecords")
|
||||||
|
@ApiOperation("获取工地实时数据列表-从t_building_records表中查询")
|
||||||
|
@ApiImplicitParam(name="pushTime",value="上传时间",paramType = "query",required = true,dataType = "string",example = "2022-01-01")
|
||||||
|
public List<BuildingRecords> listRecords(
|
||||||
|
@RequestParam(value="pushTime") String pushTime
|
||||||
|
){
|
||||||
|
return buildingRecordsService.listRecords(pushTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,565 @@
|
||||||
|
package io.renren.modules.monitor.controller;
|
||||||
|
|
||||||
|
import io.renren.modules.monitor.dto.*;
|
||||||
|
import io.renren.modules.monitor.entity.*;
|
||||||
|
import io.renren.modules.monitor.mapper.*;
|
||||||
|
import io.renren.modules.monitor.service.*;
|
||||||
|
import io.renren.modules.monitor.utils.LongLatUtil;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
|
import io.swagger.annotations.ApiImplicitParams;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("api/project")
|
||||||
|
@Api(tags="通用")
|
||||||
|
public class Controller {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ProjectMapper projectMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CameraMapper cameraMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ScenicMapper scenicMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private MonitorService monitorService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SedimentTrailService sedimentTrailService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CameraChannelMapper cameraChannelMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CameraOrgenizationMapper cameraOrgenMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private PassengerFlowService passengerFlowService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private TrailSanitationService trailSanitationService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RoadDataService roadDataService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CameraChannelService cameraChannelService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private BuildingSiteService buildingSitrService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private BuildingSiteMapper buildingSiteMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ChannelPictureMapper channelPictureMapper;
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping("all")
|
||||||
|
public Object all(){
|
||||||
|
List<Project> projects = projectMapper.selectList(null);
|
||||||
|
projects.forEach(project -> {
|
||||||
|
List<Picture> pics = cameraMapper.selectPicByProjectId(project.getId());
|
||||||
|
project.setPics(pics);
|
||||||
|
});
|
||||||
|
|
||||||
|
return projects;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 推送给城管接口用的
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("cameras")
|
||||||
|
public Result cameras(){
|
||||||
|
List<ChannelPictureDto> channelPictureDtos = channelPictureMapper.selectByProject();
|
||||||
|
Result success = Result.success(channelPictureDtos);
|
||||||
|
success.setCount(channelPictureDtos.size());
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 景区人流识别
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("scenicCamera")
|
||||||
|
public Result scenicCamera(){
|
||||||
|
List<ScenicCameraDto> scenicCameraDtos = scenicMapper.selectScenicCameras();
|
||||||
|
Result success = Result.success(scenicCameraDtos);
|
||||||
|
success.setCount(scenicCameraDtos.size());
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("capture")
|
||||||
|
public Object capture(){
|
||||||
|
monitorService.start();
|
||||||
|
|
||||||
|
return "finish capture";
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("startScenic")
|
||||||
|
public Object startScenic(){
|
||||||
|
monitorService.startScenic();
|
||||||
|
|
||||||
|
return "startScenic finish";
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("capture1")
|
||||||
|
public Object capture1(){
|
||||||
|
monitorService.listChannelPlayStates();
|
||||||
|
|
||||||
|
return "finish capture";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询所有摄像头
|
||||||
|
* @param
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("selectAll")
|
||||||
|
@ApiOperation("查询所有摄像头")
|
||||||
|
public String selectAll(){
|
||||||
|
return cameraChannelService.selectAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据channelCode查询摄像头详细信息
|
||||||
|
* @param channelCode
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("selectByChannelCode")
|
||||||
|
@ApiOperation("根据摄像头编号查询摄像头详细信息")
|
||||||
|
@ApiImplicitParam(name = "channelCode",value = "摄像头标识",required = true,dataType = "String")
|
||||||
|
public Result selectByChannelCode(String channelCode){
|
||||||
|
|
||||||
|
List<CameraChannelDto1> list = cameraChannelMapper.selectByChannelCode(channelCode);
|
||||||
|
|
||||||
|
Result success = Result.success(list);
|
||||||
|
|
||||||
|
return success;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据摄像头名字模糊查询摄像头
|
||||||
|
* @param channelName
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("selectByChannelName")
|
||||||
|
@ApiOperation("根据摄像头名字模糊查询摄像头")
|
||||||
|
@ApiImplicitParam(name = "channelName",value = "摄像头名称",required = true,dataType = "String")
|
||||||
|
public Result selectByChannelName(String channelName){
|
||||||
|
|
||||||
|
List<CameraChannel> labels = cameraChannelMapper.selectByChannelName(channelName);
|
||||||
|
|
||||||
|
Result success = Result.success(labels);
|
||||||
|
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据parentId和checkStatus查询摄像头
|
||||||
|
* @param parentId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("selectByParentId")
|
||||||
|
@ApiOperation("根据摄像头的组织Id和异常状态查询摄像头")
|
||||||
|
@ApiImplicitParams({
|
||||||
|
@ApiImplicitParam(name = "parentId",value = "摄像头的组织Id",required = true,dataType = "String"),
|
||||||
|
@ApiImplicitParam(name = "checkStatus",value = "异常状态 1正常,0异常",required = true,dataType = "String")
|
||||||
|
})
|
||||||
|
public Result selectByParentId(String parentId,String checkStatus){
|
||||||
|
|
||||||
|
List<CameraChannel> list = cameraChannelMapper.selectByParentId(parentId,checkStatus);
|
||||||
|
|
||||||
|
Result success = Result.success(list);
|
||||||
|
|
||||||
|
return success;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据标签查询对应摄像头
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("selectLabel")
|
||||||
|
@ApiOperation("根据标签查询对应摄像头")
|
||||||
|
@ApiImplicitParam(name = "labelCode",value = "标签号",required = true,dataType = "String")
|
||||||
|
public Result selectLabel(String labelCode){
|
||||||
|
|
||||||
|
List<ChannelLabelDto> channelLabelDtos = cameraChannelMapper.selectLabel(labelCode);
|
||||||
|
|
||||||
|
for (ChannelLabelDto channelLabelDto :channelLabelDtos) {
|
||||||
|
String nodeName = channelLabelDto.getNodeName();
|
||||||
|
String[] splits = nodeName.split("->");
|
||||||
|
String split = splits[1];
|
||||||
|
channelLabelDto.setNodeName(split);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return Result.success(channelLabelDtos);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据经纬度查询半径内所有的摄像头
|
||||||
|
* @param gpsX
|
||||||
|
* @param gpsY
|
||||||
|
* @param radius
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping ("selectAllByGps")
|
||||||
|
@ApiOperation("根据经纬度查询半径内所有的摄像头")
|
||||||
|
@ApiImplicitParams({
|
||||||
|
@ApiImplicitParam(name = "gpsX", value = "经度",required = true,dataType ="Double"),
|
||||||
|
@ApiImplicitParam(name = "gpsY", value = "纬度",required = true,dataType ="Double"),
|
||||||
|
@ApiImplicitParam(name = "radius", value = "半径,米",required = true,dataType ="Integer"),}
|
||||||
|
)
|
||||||
|
public Result selectAllByGps(Double gpsX,Double gpsY,Integer radius){
|
||||||
|
double[] around = LongLatUtil.getAround(gpsX, gpsY, radius);
|
||||||
|
List<CameraChannel> c = cameraChannelMapper.selectAllByGps(around[0], around[2], around[1], around[3]);
|
||||||
|
Result success = Result.success(c);
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询所有标签
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("selectAllLabel")
|
||||||
|
@ApiOperation("查询所有标签")
|
||||||
|
public Result selectAllLabel(){
|
||||||
|
|
||||||
|
List<Label> labels = cameraChannelMapper.selectAllLabel();
|
||||||
|
|
||||||
|
Result success = Result.success(labels);
|
||||||
|
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询city为1的标签
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("selectByLabelCity")
|
||||||
|
@ApiOperation("查询city为1的标签")
|
||||||
|
public Result selectByLabelCity(){
|
||||||
|
|
||||||
|
List<Label> labels = cameraChannelMapper.selectByLabelCity();
|
||||||
|
|
||||||
|
Result success = Result.success(labels);
|
||||||
|
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 根据标签名字模糊查询标签
|
||||||
|
* @param labelName
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("selectByLabelName")
|
||||||
|
@ApiOperation("根据标签名字模糊查询标签")
|
||||||
|
@ApiImplicitParam(name = "labelName",value = "标签名称",required = true,dataType = "String")
|
||||||
|
public Result selectByLabelName(String labelName){
|
||||||
|
|
||||||
|
List<Label> labels = cameraChannelMapper.selectByLabelName(labelName);
|
||||||
|
|
||||||
|
Result success = Result.success(labels);
|
||||||
|
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据parentId查询组织
|
||||||
|
* @param parentId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("selectSubOrgan")
|
||||||
|
@ApiOperation("根据上级组织id查询组织")
|
||||||
|
@ApiImplicitParam(name = "parentId",value = "上级组织id",required = true,dataType = "String")
|
||||||
|
public Result selectSubOrganization(String parentId){
|
||||||
|
if (parentId == null){
|
||||||
|
parentId = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
List<CameraOrganization> organs = cameraOrgenMapper.selectSubOrganization(parentId);
|
||||||
|
|
||||||
|
Result success = Result.success(organs);
|
||||||
|
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 提供给其他项目分页查询摄像头接口
|
||||||
|
* @param page
|
||||||
|
* @param pageSize
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("selectCamera")
|
||||||
|
@ApiOperation("提供给其他项目分页查询摄像头接口")
|
||||||
|
@ApiImplicitParams({
|
||||||
|
@ApiImplicitParam(name = "page",value = "页码",required = true,dataType = "Integer"),
|
||||||
|
@ApiImplicitParam(name = "pageSize",value = "页码大小",required = true,dataType = "Integer")
|
||||||
|
})
|
||||||
|
public Result selectNLAll(Integer page,Integer pageSize,String labelCode){
|
||||||
|
List<CameraChannelNLDto> selectNLAll = cameraChannelMapper.selectNLAll(page,pageSize);
|
||||||
|
if (labelCode != null && labelCode != ""){
|
||||||
|
List<CameraChannelNLDto> dtos = cameraChannelMapper.selectByLabel(page, pageSize);
|
||||||
|
Result success = Result.success(dtos);
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
Result success = Result.success(selectNLAll);
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
|
||||||
|
//查询视频点播巡检结果,只取异常的
|
||||||
|
// @RequestMapping("listChannelPlayStates")
|
||||||
|
// public Result listChannelPlayStates(
|
||||||
|
// @RequestParam(value="page",required = false,defaultValue = "1") Integer page,
|
||||||
|
// @RequestParam(value="pageSize",required = false,defaultValue = "20") Integer pageSize
|
||||||
|
// ){
|
||||||
|
// return monitorService.listChannelPlayStates();
|
||||||
|
// }
|
||||||
|
|
||||||
|
//道路统计数据与排名
|
||||||
|
@GetMapping("roadData")
|
||||||
|
@ApiOperation("道路统计数据与排名,根据后台dt调用接口")
|
||||||
|
public List<Map> roadData(){
|
||||||
|
return monitorService.roadData();
|
||||||
|
}
|
||||||
|
|
||||||
|
//启迪中台
|
||||||
|
//登录
|
||||||
|
@GetMapping("qidiToken")
|
||||||
|
@ApiOperation("启迪数据中台登录获取token")
|
||||||
|
public String qidiToken(){
|
||||||
|
return monitorService.qidiToken();
|
||||||
|
}
|
||||||
|
|
||||||
|
//渣土车轨迹数据
|
||||||
|
@GetMapping("resCatalogApplyZTYS")
|
||||||
|
@ApiOperation("获取渣土车轨迹数据,根据后台UPLOADTIME调用接口")
|
||||||
|
public List<Map> resCatalogApply(){
|
||||||
|
return monitorService.resCatalogApplyZTYS();
|
||||||
|
}
|
||||||
|
|
||||||
|
//环卫车轨迹数据
|
||||||
|
@GetMapping("resCatalogApplyHJWS")
|
||||||
|
@ApiOperation("环卫车轨迹数据,根据后台updatetime调用接口")
|
||||||
|
public List<Map> resCatalogApplyHJWS(){
|
||||||
|
return monitorService.resCatalogApplyHJWS();
|
||||||
|
}
|
||||||
|
|
||||||
|
//工地信息
|
||||||
|
@GetMapping("resCatalogApplyGDYS")
|
||||||
|
@ApiOperation("获取工地信息-表中获取")
|
||||||
|
public List<Map> resCatalogApplyGDYS(){
|
||||||
|
return monitorService.resCatalogApplyGDYS();
|
||||||
|
}
|
||||||
|
|
||||||
|
//环卫车辆数据1,基础
|
||||||
|
@GetMapping("resCatalogApplyHJWSBase")
|
||||||
|
@ApiOperation("环卫车辆数据1,基础--根据后台updatetime调用接口")
|
||||||
|
public List<Map> resCatalogApplyHJWSBase(){
|
||||||
|
return monitorService.resCatalogApplyHJWSBase();
|
||||||
|
}
|
||||||
|
//环卫车辆数据1,作业
|
||||||
|
@GetMapping("resCatalogApplyHJWSZY")
|
||||||
|
@ApiOperation("环卫车辆数据1,作业--根据后台ZYRQ调用接口")
|
||||||
|
public List<Map> resCatalogApplyHJWSZY(){
|
||||||
|
return monitorService.resCatalogApplyHJWSZY();
|
||||||
|
}
|
||||||
|
|
||||||
|
//环卫道路明细数据
|
||||||
|
@GetMapping("resCatalogApplyHJWSRoad")
|
||||||
|
@ApiOperation("环卫道路明细数据,根据后台updatetime调用接口")
|
||||||
|
public List<Map> resCatalogApplyHJWSRoad(){
|
||||||
|
return monitorService.resCatalogApplyHJWSRoad();
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取渣土车轨迹并保存到t_trail_sediment
|
||||||
|
@GetMapping(value = "saveResCatalogApplyZTYS")
|
||||||
|
@ApiOperation("取渣土车轨迹并保存到t_trail_sediment,根据后台UPLOADTIME调用接口")
|
||||||
|
public Result resCatalogApplyZTYS(){
|
||||||
|
|
||||||
|
boolean result = sedimentTrailService.batchSaveSedimentTrail();
|
||||||
|
if(result){
|
||||||
|
return Result.success();
|
||||||
|
}else{
|
||||||
|
return Result.error(String.valueOf(result));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//根据输入的经纬度和查询的半径(米)时间查询范围内的渣土车轨迹信息
|
||||||
|
@GetMapping(value = "listSedimentTrailByPoints")
|
||||||
|
@ApiOperation("渣土车轨迹信息,根据经纬度和半径从表中查询")
|
||||||
|
@ApiImplicitParams({
|
||||||
|
@ApiImplicitParam(name = "longitude", value = "经度", paramType = "query",required = true,dataType ="double"),
|
||||||
|
@ApiImplicitParam(name = "latitude", value = "纬度", paramType = "query",required = true,dataType ="double"),
|
||||||
|
@ApiImplicitParam(name = "radius", value = "半径,米", paramType = "query",required = true,dataType ="Integer"),
|
||||||
|
@ApiImplicitParam(name = "start", value = "开始时间,2021-08-03 10:17:23", paramType = "query",required = true,dataType ="string"),
|
||||||
|
@ApiImplicitParam(name = "end", value = "结束时间,2021-08-03 12:17:23", paramType = "query",required = true,dataType ="string")
|
||||||
|
})
|
||||||
|
public Result listSedimentTrailByPoints(
|
||||||
|
@RequestParam(value="longitude") double longitude,
|
||||||
|
@RequestParam(value="latitude") double latitude,
|
||||||
|
@RequestParam(value="radius") Integer radius,
|
||||||
|
@RequestParam(value="start") String start,
|
||||||
|
@RequestParam(value = "end") String end
|
||||||
|
){
|
||||||
|
Map<String,List<SedimentTrail>> map = sedimentTrailService.listSedimentTrailByPoints(longitude,latitude,radius,start,end);
|
||||||
|
return Result.success(map);
|
||||||
|
}
|
||||||
|
|
||||||
|
//测试获取最新的客流列表,从接口获取
|
||||||
|
@GetMapping("passengerFlow")
|
||||||
|
@ApiOperation("获取最新的客流列表,测试接口,调用接口获取")
|
||||||
|
public List<Map> passengerFlow(){
|
||||||
|
List<Map> list = passengerFlowService.passengerFlow();
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取最新的实时客流列表,从表获取
|
||||||
|
@GetMapping("listPassengerFlow")
|
||||||
|
@ApiOperation("获取最新的实时客流列表,从表获取,热力图")
|
||||||
|
@ApiImplicitParam(name="timeId",value = "时间点",required = false,paramType = "query",dataType = "string")
|
||||||
|
public List<PassengerFlow> listPassengerFlow(@RequestParam(value="timeId",required = false,defaultValue = "1970000000") String timeId){
|
||||||
|
List<PassengerFlow> list = passengerFlowService.listPassengerFlow(timeId);
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
//从表中获取最新的客流列表,并筛选出all_nums >=5000的
|
||||||
|
@GetMapping("listPassengerFlowByAllNums")
|
||||||
|
@ApiOperation("从表中获取最新的客流列表,并筛选出all_nums >=5000的")
|
||||||
|
public List<PassengerFlow> listPassengerFlowByAllNums(){
|
||||||
|
List<PassengerFlow> list = passengerFlowService.listPassengerFlowByAllNums();
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取实时客流并保存到表t_passenger_flow
|
||||||
|
@GetMapping("savePassengerFlow")
|
||||||
|
@ApiOperation("获取实时客流并保存到表t_passenger_flow,调用接口")
|
||||||
|
public Result savePassengerFlow(){
|
||||||
|
List<Map> list = passengerFlowService.passengerFlow();
|
||||||
|
boolean result = passengerFlowService.savePassengerFlow(list);
|
||||||
|
if(result){
|
||||||
|
return Result.success();
|
||||||
|
}else{
|
||||||
|
return Result.error(String.valueOf(result));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//根据输入的经纬度和查询的半径(米)和timeId查询游客总数
|
||||||
|
@GetMapping("getPassengerNum")
|
||||||
|
@ApiOperation("查询游客总数,根据经纬度和半径米、timeId从表中查询")
|
||||||
|
@ApiImplicitParams({
|
||||||
|
@ApiImplicitParam(name = "longitude", value = "经度", paramType = "query",required = false,dataType ="double"),
|
||||||
|
@ApiImplicitParam(name = "latitude", value = "纬度", paramType = "query",required = false,dataType ="double"),
|
||||||
|
@ApiImplicitParam(name = "radius", value = "半径,米", paramType = "query",required = false,dataType ="Integer"),
|
||||||
|
@ApiImplicitParam(name = "timeId", value = "时间点,202205101600", paramType = "query",required = true,dataType ="string"),
|
||||||
|
})
|
||||||
|
public Result getPassengerNum(
|
||||||
|
@RequestParam(value="longitude",required = false,defaultValue = "0.00") double longitude,
|
||||||
|
@RequestParam(value="latitude",required = false,defaultValue = "0.00") double latitude,
|
||||||
|
@RequestParam(value="radius",required = false,defaultValue = "0") Integer radius,
|
||||||
|
@RequestParam(value="timeId",required = true) String timeId
|
||||||
|
){
|
||||||
|
return Result.success(passengerFlowService.passengerNums(longitude,latitude,radius,timeId));
|
||||||
|
}
|
||||||
|
|
||||||
|
//查询并保存环卫车轨迹到表t_trail_sanitation
|
||||||
|
@GetMapping("saveTrailSanitation")
|
||||||
|
@ApiOperation("保存环卫车轨迹到表t_trail_sanitation,根据后台updatetime调用接口")
|
||||||
|
public Result saveTrailSanitation(){
|
||||||
|
boolean result = trailSanitationService.saveTrailSanitation();
|
||||||
|
if(result){
|
||||||
|
return Result.success();
|
||||||
|
}else{
|
||||||
|
return Result.error(String.valueOf(result));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//根据输入的经纬度和查询的半径(米)时间查询范围内的环卫车轨迹信息
|
||||||
|
@GetMapping(value = "listTrailSanitationByPoints")
|
||||||
|
@ApiOperation("查询范围内环卫车轨迹信息,根据经纬度、半径米,时间从表中查询")
|
||||||
|
@ApiImplicitParams({
|
||||||
|
@ApiImplicitParam(name = "longitude", value = "经度", paramType = "query",required = true,dataType ="double"),
|
||||||
|
@ApiImplicitParam(name = "latitude", value = "纬度", paramType = "query",required = true,dataType ="double"),
|
||||||
|
@ApiImplicitParam(name = "radius", value = "半径,米", paramType = "query",required = true,dataType ="Integer"),
|
||||||
|
@ApiImplicitParam(name = "start", value = "开始时间,2021-03-17 00:00:00", paramType = "query",required = true,dataType ="string"),
|
||||||
|
@ApiImplicitParam(name = "end", value = "结束时间,2021-03-22 00:00:00", paramType = "query",required = true,dataType ="string"),
|
||||||
|
})
|
||||||
|
public Result listTrailSanitationByPoints(
|
||||||
|
@RequestParam(value="longitude") double longitude,
|
||||||
|
@RequestParam(value="latitude") double latitude,
|
||||||
|
@RequestParam(value="radius") Integer radius,
|
||||||
|
@RequestParam(value="start") String start,
|
||||||
|
@RequestParam(value = "end") String end
|
||||||
|
){
|
||||||
|
List<TrailSanitation> list = trailSanitationService.listSedimentTrailByPoints(longitude,latitude,radius,start,end);
|
||||||
|
return Result.success(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
//查询道路污染数据
|
||||||
|
//输入参考:2022-05-10 00:00:00,只能查询当前日期前一天及以前的
|
||||||
|
@GetMapping(value="listRoadData")
|
||||||
|
@ApiOperation("查询道路污染数据,根据dt从表中查询,参考输入-2022-05-10 00:00:00,只能查询当前日期前一天及以前的")
|
||||||
|
@ApiImplicitParam(name="dt",value = "时间",paramType = "query",required = true,dataType = "string")
|
||||||
|
public Result listRoadData(@RequestParam(value="dt") String dt){
|
||||||
|
List<RoadData> list = roadDataService.listRoadData(dt);
|
||||||
|
return Result.success(list);
|
||||||
|
}
|
||||||
|
//根据输入的日期间隔查询道路污染数据(例如:2022-05-10 00:00:00至2022-05-11 00:00:00)
|
||||||
|
@GetMapping(value="listRoadDataByTimeRegion")
|
||||||
|
@ApiOperation("根据输入的日期间隔查询道路污染数据(例如:2022-05-10 00:00:00至2022-05-11 00:00:00)")
|
||||||
|
@ApiImplicitParams({
|
||||||
|
@ApiImplicitParam(name = "start", value = "开始日期", paramType = "query", dataType = "string", required = true),
|
||||||
|
@ApiImplicitParam(name = "end", value = "结束日期", paramType = "query", dataType = "string", required = true)
|
||||||
|
})
|
||||||
|
public Result listRoadDataByTimeRegion(
|
||||||
|
@RequestParam(value="start") String start,
|
||||||
|
@RequestParam(value="end") String end
|
||||||
|
){
|
||||||
|
List<RoadData> list = roadDataService.listRoadDataByTimeRegion(start,end);
|
||||||
|
return Result.success(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//查询工地信息,根据经纬度和半径查询
|
||||||
|
@GetMapping(value = "listBuildingSiteByPoints")
|
||||||
|
@ApiOperation("查询工地信息,根据经纬度和半径从表中查询")
|
||||||
|
@ApiImplicitParams({
|
||||||
|
@ApiImplicitParam(name="longitude",value = "经度",paramType = "query",required = true,dataType = "double"),
|
||||||
|
@ApiImplicitParam(name="longitude",value = "经度",paramType = "query",required = true,dataType = "double")
|
||||||
|
})
|
||||||
|
public Result listBuildingSiteByPoints(double longitude,double latitude,Integer radius){
|
||||||
|
List<BuildingSite> list = new ArrayList<>();
|
||||||
|
list = buildingSitrService.listBuildingSiteByPoints(longitude,latitude,radius);
|
||||||
|
return Result.success(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询全部工地信息
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("selectBuildSite")
|
||||||
|
@ApiOperation("查询全部工地信息")
|
||||||
|
public Result selectBuildSite(){
|
||||||
|
List<BuildingSite> buildingSites = buildingSiteMapper.selectBuildSite();
|
||||||
|
Result success = Result.success(buildingSites);
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,183 @@
|
||||||
|
package io.renren.modules.monitor.controller;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import io.renren.modules.monitor.entity.Event;
|
||||||
|
import io.renren.modules.monitor.entity.Result;
|
||||||
|
import io.renren.modules.monitor.mapper.EventMapper;
|
||||||
|
import io.renren.modules.monitor.service.EventService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.servlet.ServletInputStream;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("STapi/project")
|
||||||
|
@Api(tags = "事件")
|
||||||
|
@Log4j2
|
||||||
|
public class EventController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private EventService eventService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private EventMapper eventMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订阅任务下发接口
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("subscribe")
|
||||||
|
public JSONObject subscribe(){
|
||||||
|
return eventService.subscribe();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订阅任务下发接口
|
||||||
|
* @param request
|
||||||
|
* @return
|
||||||
|
* @throws IOException
|
||||||
|
*/
|
||||||
|
@PostMapping("receive")
|
||||||
|
@ApiOperation("订阅任务下发接口")
|
||||||
|
public Result receive(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();// 内容
|
||||||
|
|
||||||
|
JSONObject jsonObject = JSONObject.parseObject(strcont);
|
||||||
|
Event event = new Event();
|
||||||
|
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");
|
||||||
|
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");
|
||||||
|
event.setImageUrl(image.getString("imageUrl"));
|
||||||
|
event.setTaskId(jsonObject.getString("taskId"));
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//要转换的时间格式
|
||||||
|
Date date;
|
||||||
|
try {
|
||||||
|
date = sdf.parse(sdf.format(jsonObject.get("captureTime")));
|
||||||
|
event.setCaptureTime(sdf.format(date));
|
||||||
|
}catch (Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
event.setTrackEvent(jsonObject.getString("trackEvent"));
|
||||||
|
eventMapper.insert(event);
|
||||||
|
log.info(event);
|
||||||
|
return Result.success(strcont);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 事件模板分页查询接口
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("tamplate")
|
||||||
|
@ApiOperation("事件模板分页查询接口")
|
||||||
|
public JSONObject tamplate(){
|
||||||
|
return eventService.template();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询所有事件
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("selectEvent")
|
||||||
|
@ApiOperation("查询所有事件")
|
||||||
|
public Result selectEvent(){
|
||||||
|
|
||||||
|
List<Event> events = eventMapper.selectEvent();
|
||||||
|
|
||||||
|
Result success = Result.success(events);
|
||||||
|
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询当天事件
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("selectByTime")
|
||||||
|
@ApiOperation("查询当天事件")
|
||||||
|
public Result selectByTime(){
|
||||||
|
List<Event> byTime = eventMapper.selectByTime();
|
||||||
|
|
||||||
|
Result success = Result.success(byTime);
|
||||||
|
|
||||||
|
return success;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据事件名称查询事件
|
||||||
|
* @param eventCnName
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("selectByName")
|
||||||
|
@ApiOperation("根据事件名称查询事件")
|
||||||
|
@ApiImplicitParam(name = "eventCnName",value = "事件名称",required = true,dataType = "String")
|
||||||
|
public Result selectByName(String eventCnName){
|
||||||
|
List<Event> byName = eventMapper.selectByName(eventCnName);
|
||||||
|
|
||||||
|
Result success = Result.success(byName);
|
||||||
|
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,42 @@
|
||||||
|
package io.renren.modules.monitor.controller;
|
||||||
|
|
||||||
|
import io.renren.modules.monitor.entity.Result;
|
||||||
|
import io.renren.modules.monitor.service.MonitorService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("api/project")
|
||||||
|
@Api(tags="视频流")
|
||||||
|
public class FileController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private MonitorService monitorService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据摄像头标识获取视频流
|
||||||
|
* @param channelCode
|
||||||
|
* @return
|
||||||
|
* @throws IOException
|
||||||
|
*/
|
||||||
|
@GetMapping("file")
|
||||||
|
@ApiOperation("根据摄像头标识获取视频流")
|
||||||
|
public Result File(String channelCode)throws IOException {
|
||||||
|
String s = monitorService.fileCode(channelCode);
|
||||||
|
Result success = Result.success(s);
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("token")
|
||||||
|
public Result token( ) {
|
||||||
|
String s = monitorService.init();
|
||||||
|
Result success = Result.success(s);
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,55 @@
|
||||||
|
package io.renren.modules.monitor.controller;
|
||||||
|
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
|
||||||
|
import javax.servlet.ServletOutputStream;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.net.URLConnection;
|
||||||
|
|
||||||
|
@Controller
|
||||||
|
@Api(tags = "转发")
|
||||||
|
public class FordController {
|
||||||
|
|
||||||
|
@GetMapping("components/**")
|
||||||
|
@ApiOperation("前端访问图片请求转发")
|
||||||
|
public void ford(HttpServletRequest request, HttpServletResponse response){
|
||||||
|
|
||||||
|
String imageDomain = "http://10.132.191.48:30080";
|
||||||
|
|
||||||
|
String uri = request.getRequestURI();
|
||||||
|
String fordUrl = imageDomain + uri;
|
||||||
|
|
||||||
|
URLConnection con = null;
|
||||||
|
|
||||||
|
try {
|
||||||
|
URL url = new URL(fordUrl);
|
||||||
|
con = url.openConnection();
|
||||||
|
|
||||||
|
//允许写出
|
||||||
|
con.setDoOutput(true);
|
||||||
|
//允许读入
|
||||||
|
con.setDoInput(true);
|
||||||
|
//不使用缓存
|
||||||
|
con.setUseCaches(false);
|
||||||
|
//得到响应流
|
||||||
|
InputStream inputStream = con.getInputStream();
|
||||||
|
|
||||||
|
ServletOutputStream outputStream = response.getOutputStream();
|
||||||
|
byte[] buffer = new byte[1024];
|
||||||
|
int len = inputStream.read(buffer);
|
||||||
|
while (len != -1) {
|
||||||
|
outputStream.write(buffer, 0, len);
|
||||||
|
len = inputStream.read(buffer);
|
||||||
|
}
|
||||||
|
inputStream.close();
|
||||||
|
}catch(Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,54 @@
|
||||||
|
package io.renren.modules.monitor.controller;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import io.renren.modules.monitor.entity.CaseCityLaw;
|
||||||
|
import io.renren.modules.monitor.entity.Result;
|
||||||
|
import io.renren.modules.monitor.service.SJZTService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import io.swagger.annotations.ApiParam;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Api(tags = "数交中台-城市执法案件")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("api/project")
|
||||||
|
public class SJZTController {
|
||||||
|
@Autowired
|
||||||
|
private SJZTService sjztService;
|
||||||
|
|
||||||
|
//从接口获取案件数据
|
||||||
|
@GetMapping("listSJZTDatas")
|
||||||
|
@ApiOperation("获取案件数据,根据后台条件调用接口获取")
|
||||||
|
public List<Map> listSJZTDatas(){
|
||||||
|
return sjztService.listSJZTDatas();
|
||||||
|
}
|
||||||
|
|
||||||
|
//测试保存
|
||||||
|
@GetMapping("batchSaveSJZT")
|
||||||
|
@ApiOperation("测试保存,根据后台条件调用接口获取并保存到表,这个后台条件需要改动,也可能是做成自动任务调度")
|
||||||
|
public void batchSaveSJZT(){
|
||||||
|
sjztService.batchSave();
|
||||||
|
}
|
||||||
|
|
||||||
|
//从表中查询案件数据,需要根据要求增加条件
|
||||||
|
@GetMapping("listSJZTByDt")
|
||||||
|
@ApiOperation("获取案件数据,根据ajjlsj从表中获取")
|
||||||
|
@ApiImplicitParam(name="ajjlsj",value="案件建立时间,2021-01-01",paramType = "query",required = true,dataType = "string")
|
||||||
|
public List<CaseCityLaw> listSJZTByDt(
|
||||||
|
@RequestParam(value="ajjlsj") String ajjlsj
|
||||||
|
){
|
||||||
|
return sjztService.listSJZTByDt(ajjlsj);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("upStream")
|
||||||
|
@ApiOperation("案件上报,调用接口上报,暂时未测试")
|
||||||
|
public Result upStream(@ApiParam(value="data,直接以json字符串的形式传递",required = true) @RequestBody String data){
|
||||||
|
System.out.println("案件上报,调用接口上报");
|
||||||
|
return sjztService.upStream(JSONObject.parseObject(data));
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,44 @@
|
||||||
|
package io.renren.modules.monitor.controller;
|
||||||
|
|
||||||
|
import io.renren.modules.monitor.entity.Result;
|
||||||
|
import io.renren.modules.monitor.service.SanitationService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author admin
|
||||||
|
* @version 1.0.0
|
||||||
|
* @ClassName SanitationController.java
|
||||||
|
* @Description 环卫
|
||||||
|
* @createTime 2022年05月19日 11:22:00
|
||||||
|
*/
|
||||||
|
@Api(tags = "环卫")
|
||||||
|
@RequestMapping("api/project/santation")
|
||||||
|
@RestController
|
||||||
|
public class SanitationController {
|
||||||
|
@Autowired
|
||||||
|
private SanitationService sanitationService;
|
||||||
|
|
||||||
|
@GetMapping("/saveSantation")
|
||||||
|
@ApiOperation("测试获取环卫车辆基础数据并保存到表中")
|
||||||
|
public Result saveSantation(){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping("/saveSanitationRoad")
|
||||||
|
@ApiOperation("测试获取环卫道路数据并保存到表中")
|
||||||
|
public Result saveSanitationRoad(){
|
||||||
|
return sanitationService.saveSanitationRoad();
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("saveSanitationTask")
|
||||||
|
@ApiOperation("测试获取环卫车作业数据并保存到表中")
|
||||||
|
public Result saveSanitationTask(){
|
||||||
|
return sanitationService.saveSanitationTask();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,38 @@
|
||||||
|
package io.renren.modules.monitor.controller;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import io.renren.modules.monitor.entity.Camera;
|
||||||
|
import io.renren.modules.monitor.entity.Result;
|
||||||
|
import io.renren.modules.monitor.mapper.CameraMapper;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("api/static")
|
||||||
|
public class StaticController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CameraMapper cameraMapper;
|
||||||
|
|
||||||
|
@RequestMapping("all")
|
||||||
|
public Object all(){
|
||||||
|
HashMap<Object, Object> map = new HashMap<>();
|
||||||
|
//
|
||||||
|
Integer cameraCount = cameraMapper.selectCount(null);
|
||||||
|
map.put("cameraCount", cameraCount);
|
||||||
|
LambdaQueryWrapper<Camera> queryWrapper = new QueryWrapper<Camera>().lambda()
|
||||||
|
.gt(Camera::getCaptureTime, DateUtil.beginOfDay(new Date()));
|
||||||
|
Integer todayCount = cameraMapper.selectCount(queryWrapper);
|
||||||
|
map.put("todayCount", todayCount);
|
||||||
|
|
||||||
|
return Result.success(map);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
package io.renren.modules.monitor.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class CameraChannelDto {
|
||||||
|
|
||||||
|
private String channelCode;
|
||||||
|
|
||||||
|
private String gpsX;
|
||||||
|
|
||||||
|
private String gpsY;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
package io.renren.modules.monitor.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class CameraChannelDto1 {
|
||||||
|
private Long idtCameraChannel;
|
||||||
|
|
||||||
|
private String channelCode;
|
||||||
|
|
||||||
|
private String channelId;
|
||||||
|
|
||||||
|
private String channelName;
|
||||||
|
|
||||||
|
private String gpsX;
|
||||||
|
|
||||||
|
private String gpsY;
|
||||||
|
|
||||||
|
private Integer status;//1在线;0离线
|
||||||
|
|
||||||
|
private String nodeName;
|
||||||
|
|
||||||
|
private Integer checkStatus;//1正常;0异常
|
||||||
|
|
||||||
|
private String parentId;
|
||||||
|
|
||||||
|
private String picUrl;
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
package io.renren.modules.monitor.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class CameraChannelNLDto {
|
||||||
|
|
||||||
|
private String labelCode;
|
||||||
|
|
||||||
|
private String labelName;
|
||||||
|
|
||||||
|
private String channelCode;
|
||||||
|
|
||||||
|
private String channelId;
|
||||||
|
|
||||||
|
private String channelName;
|
||||||
|
|
||||||
|
private String gpsX;
|
||||||
|
|
||||||
|
private String gpsY;
|
||||||
|
|
||||||
|
private Integer status;//1在线;0离线
|
||||||
|
|
||||||
|
private String nodeName;
|
||||||
|
|
||||||
|
private Integer checkStatus;//1正常;0异常
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,23 @@
|
||||||
|
package io.renren.modules.monitor.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ChannelLabelDto {
|
||||||
|
|
||||||
|
private String channelCode;
|
||||||
|
|
||||||
|
private String channelName;
|
||||||
|
|
||||||
|
private String gpsX;
|
||||||
|
|
||||||
|
private String gpsY;
|
||||||
|
|
||||||
|
private String checkStatus;
|
||||||
|
|
||||||
|
private String nodeName;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
package io.renren.modules.monitor.dto;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ChannelPictureDto {
|
||||||
|
|
||||||
|
private String ssqh;
|
||||||
|
private String xmmc;
|
||||||
|
private String xmdz;
|
||||||
|
private String channelCode;
|
||||||
|
|
||||||
|
private String PicUrl;
|
||||||
|
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private Date insertTime;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
package io.renren.modules.monitor.dto;
|
||||||
|
|
||||||
|
|
||||||
|
import io.renren.modules.monitor.entity.Camera;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ChengguanDto extends Camera {
|
||||||
|
|
||||||
|
|
||||||
|
private String id;
|
||||||
|
private String xmdz;
|
||||||
|
private String xmmc;
|
||||||
|
}
|
|
@ -0,0 +1,33 @@
|
||||||
|
package io.renren.modules.monitor.dto;
|
||||||
|
|
||||||
|
|
||||||
|
import io.renren.modules.monitor.entity.Camera;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ScenicCameraDto extends Camera {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 景区编码
|
||||||
|
*/
|
||||||
|
private String id;
|
||||||
|
/**
|
||||||
|
* 摄像头名称
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 景区名
|
||||||
|
*/
|
||||||
|
private String jqmc;
|
||||||
|
/**
|
||||||
|
* 管理单位
|
||||||
|
*/
|
||||||
|
private String gldw;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 识别出来的人数
|
||||||
|
*/
|
||||||
|
private Integer personNum;
|
||||||
|
}
|
|
@ -0,0 +1,19 @@
|
||||||
|
package io.renren.modules.monitor.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@TableName("t_booth")
|
||||||
|
public class Booth {
|
||||||
|
private String serial;
|
||||||
|
private String area;
|
||||||
|
private String boothName;
|
||||||
|
private String location;
|
||||||
|
private String manageTime;
|
||||||
|
private String captureTime;
|
||||||
|
private String channelCode;
|
||||||
|
private String gpsX;
|
||||||
|
private String gpsY;
|
||||||
|
private String channelName;
|
||||||
|
}
|
|
@ -0,0 +1,43 @@
|
||||||
|
package io.renren.modules.monitor.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author admin
|
||||||
|
* @version 1.0.0
|
||||||
|
* @ClassName BuildingRecords.java
|
||||||
|
* @Description 工地实时信息类
|
||||||
|
* @createTime 2022年05月17日 15:28:00
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@TableName("t_building_records")
|
||||||
|
@ApiModel("工地实时数据")
|
||||||
|
public class BuildingRecords {
|
||||||
|
@TableId
|
||||||
|
@ApiModelProperty("id")
|
||||||
|
private Integer id;
|
||||||
|
@ApiModelProperty("项目名称")
|
||||||
|
private String projectName;
|
||||||
|
@ApiModelProperty("项目建筑批准编号")
|
||||||
|
private String buildLicense;
|
||||||
|
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
|
||||||
|
@ApiModelProperty("数据上传时间")
|
||||||
|
private LocalDateTime pushTime;
|
||||||
|
@ApiModelProperty("appid")
|
||||||
|
private String appid;
|
||||||
|
@ApiModelProperty("pm10值")
|
||||||
|
private double pm10;
|
||||||
|
@ApiModelProperty("噪音值")
|
||||||
|
private double noice;
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
package io.renren.modules.monitor.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author admin
|
||||||
|
* @version 1.0.0
|
||||||
|
* @ClassName BuildingSite.java
|
||||||
|
* @Description TODO
|
||||||
|
* @createTime 2022年05月12日 14:00:00
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@TableName("t_building_site")
|
||||||
|
public class BuildingSite {
|
||||||
|
@TableId
|
||||||
|
private Integer id;
|
||||||
|
private String gdmc;
|
||||||
|
private String sgwz;
|
||||||
|
private double jd;
|
||||||
|
private double wd;
|
||||||
|
private String ssdq;
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
package io.renren.modules.monitor.entity;
|
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@TableName("t_camera")
|
||||||
|
public class Camera {
|
||||||
|
|
||||||
|
@TableId
|
||||||
|
private String code;
|
||||||
|
private String name;
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
private String longitude;
|
||||||
|
private String latitude;
|
||||||
|
|
||||||
|
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
|
||||||
|
private Date captureTime;
|
||||||
|
private String pic;
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
package io.renren.modules.monitor.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@TableName("t_camera_channel")
|
||||||
|
public class CameraChannel {
|
||||||
|
|
||||||
|
@TableId
|
||||||
|
private Long idtCameraChannel;
|
||||||
|
|
||||||
|
private String channelCode;
|
||||||
|
|
||||||
|
private String channelId;
|
||||||
|
|
||||||
|
private String channelName;
|
||||||
|
|
||||||
|
private String gpsX;
|
||||||
|
|
||||||
|
private String gpsY;
|
||||||
|
|
||||||
|
private Integer status;//1在线;0离线
|
||||||
|
|
||||||
|
private String nodeName;
|
||||||
|
|
||||||
|
private Integer checkStatus;//1正常;0异常
|
||||||
|
|
||||||
|
private String parentId;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
package io.renren.modules.monitor.entity;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author admin
|
||||||
|
* @version 1.0.0
|
||||||
|
* @ClassName CameraCheck.java
|
||||||
|
* @Description 摄像头巡检类
|
||||||
|
* @createTime 2022年05月13日 20:57:00
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
public class CameraCheck {
|
||||||
|
private String cameraType;
|
||||||
|
private String channelCode;
|
||||||
|
// private String channelName;
|
||||||
|
// private String channelSn;
|
||||||
|
// private String channelType;
|
||||||
|
// private String deviceCode;
|
||||||
|
// private String deviceIp;
|
||||||
|
// private String deviceName;
|
||||||
|
// @JsonFormat(pattern="yyyyMMdd'T'HHmmss'Z'")
|
||||||
|
// private ZonedDateTime checkTime;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
package io.renren.modules.monitor.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@TableName("t_camera_organization")
|
||||||
|
public class CameraOrganization {
|
||||||
|
@TableId
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
private String parentId;
|
||||||
|
|
||||||
|
private Integer sort;
|
||||||
|
|
||||||
|
private Integer subCount;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
package io.renren.modules.monitor.entity;
|
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@TableName("t_camera_scenic")
|
||||||
|
public class CameraScenic {
|
||||||
|
|
||||||
|
@TableId
|
||||||
|
private String cameraId;
|
||||||
|
private Integer personNum;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,60 @@
|
||||||
|
package io.renren.modules.monitor.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author admin
|
||||||
|
* @version 1.0.0
|
||||||
|
* @ClassName CaseCityLaw.java
|
||||||
|
* @Description 城市执法案件类
|
||||||
|
* @createTime 2022年05月13日 15:32:00
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@TableName("t_case_cityLaw")
|
||||||
|
public class CaseCityLaw {
|
||||||
|
@TableId(type = IdType.ASSIGN_ID)
|
||||||
|
private Long id;
|
||||||
|
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
|
||||||
|
private LocalDateTime ajjlsj;
|
||||||
|
private String dzms;
|
||||||
|
private String wtms;
|
||||||
|
private String wtlybs;
|
||||||
|
private String wtlymc;
|
||||||
|
private String ajlxbs;
|
||||||
|
private String ajlxmc;
|
||||||
|
private String dlbs;
|
||||||
|
private String dlmc;
|
||||||
|
private String xlbs;
|
||||||
|
private String xlmc;
|
||||||
|
private String qbs;
|
||||||
|
private String qmc;
|
||||||
|
private String jdbs;
|
||||||
|
private String jdmc;
|
||||||
|
private String sqbs;
|
||||||
|
private String sqmc;
|
||||||
|
private String xzb;
|
||||||
|
private String yzb;
|
||||||
|
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
|
||||||
|
private LocalDateTime pqsj;
|
||||||
|
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
|
||||||
|
private LocalDateTime ajjssj;
|
||||||
|
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
|
||||||
|
private LocalDateTime ajzfsj;
|
||||||
|
private String czsxcqjaaqjacqwjayqja;
|
||||||
|
private String sbtpsl;
|
||||||
|
private String cztpsl;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,23 @@
|
||||||
|
package io.renren.modules.monitor.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@TableName("t_channel_picture")
|
||||||
|
public class ChannelPicture {
|
||||||
|
@TableId
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
private String channelCode;
|
||||||
|
|
||||||
|
private String PicUrl;
|
||||||
|
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private Date insertTime;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
package io.renren.modules.monitor.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@TableName("t_event")
|
||||||
|
public class Event {
|
||||||
|
@TableId
|
||||||
|
private String 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 String captureTime;
|
||||||
|
private String trackEvent;
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
package io.renren.modules.monitor.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@TableName("t_label")
|
||||||
|
public class Label {
|
||||||
|
@TableId
|
||||||
|
private Long id;
|
||||||
|
private String labelCode;
|
||||||
|
private String labelName;
|
||||||
|
private String capturePatternn;
|
||||||
|
private String city;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,30 @@
|
||||||
|
package io.renren.modules.monitor.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author admin
|
||||||
|
* @version 1.0.0
|
||||||
|
* @ClassName PassengerFlow.java
|
||||||
|
* @Description 实时客流
|
||||||
|
* @createTime 2022年05月10日 14:25:00
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@TableName("t_passenger_flow")
|
||||||
|
public class PassengerFlow {
|
||||||
|
@TableId
|
||||||
|
private Integer id;
|
||||||
|
private String hourId;
|
||||||
|
private String timeId;
|
||||||
|
private double longitude;
|
||||||
|
private double latitude;
|
||||||
|
private Integer allNums;
|
||||||
|
private Integer localNums;
|
||||||
|
private Integer nonlocalNums;
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
package io.renren.modules.monitor.entity;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class Picture {
|
||||||
|
|
||||||
|
@JsonFormat(pattern="yyyy-MM-dd mm:HH:ss",timezone = "GMT+8")
|
||||||
|
private Date captureTime;
|
||||||
|
private String pic;
|
||||||
|
}
|
|
@ -0,0 +1,30 @@
|
||||||
|
package io.renren.modules.monitor.entity;
|
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@TableName("t_project")
|
||||||
|
public class Project {
|
||||||
|
|
||||||
|
@TableId
|
||||||
|
private String id;
|
||||||
|
private String ssqh;
|
||||||
|
private String xmmc;
|
||||||
|
private String xmdz;
|
||||||
|
private String ghxkzbh;
|
||||||
|
private String fzsj;
|
||||||
|
private String xkmj;
|
||||||
|
private String lzs;
|
||||||
|
private String xmxz;
|
||||||
|
private String jsdw;
|
||||||
|
private String dwdz;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private List<Picture> pics;
|
||||||
|
}
|
|
@ -0,0 +1,35 @@
|
||||||
|
package io.renren.modules.monitor.entity;
|
||||||
|
|
||||||
|
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
public class Result<T> {
|
||||||
|
|
||||||
|
private int code;
|
||||||
|
private String message;
|
||||||
|
private T data;
|
||||||
|
private int count;
|
||||||
|
|
||||||
|
static public Result success(){
|
||||||
|
return Result.builder()
|
||||||
|
.code(1)
|
||||||
|
.message("success")
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
static public Result success(Object obj){
|
||||||
|
return Result.builder()
|
||||||
|
.code(1)
|
||||||
|
.message("success")
|
||||||
|
.data(obj)
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
static public Result error(String errMsg){
|
||||||
|
return Result.builder()
|
||||||
|
.code(0)
|
||||||
|
.message(errMsg)
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,42 @@
|
||||||
|
package io.renren.modules.monitor.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author admin
|
||||||
|
* @version 1.0.0
|
||||||
|
* @ClassName RoadData.java
|
||||||
|
* @Description 道路统计数据
|
||||||
|
* @createTime 2022年05月11日 11:10:00
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@TableName("t_road_data")
|
||||||
|
public class RoadData {
|
||||||
|
@TableId
|
||||||
|
private Integer id;
|
||||||
|
private String regionName;
|
||||||
|
private String streetName;
|
||||||
|
private String roadName;
|
||||||
|
private String start;
|
||||||
|
private String end;
|
||||||
|
private double lng;
|
||||||
|
private double lat;
|
||||||
|
private double pm10;
|
||||||
|
private double pm25;
|
||||||
|
private Integer descPm10Rank;
|
||||||
|
private Integer ascPm10Rank;
|
||||||
|
private Integer descPm25Rank;
|
||||||
|
private Integer ascPm25Rank;
|
||||||
|
private String points;
|
||||||
|
@JsonFormat(pattern="yyyy-MM-dd mm:HH:ss",timezone = "GMT+8")
|
||||||
|
private LocalDateTime dt;
|
||||||
|
}
|
|
@ -0,0 +1,66 @@
|
||||||
|
package io.renren.modules.monitor.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author admin
|
||||||
|
* @version 1.0.0
|
||||||
|
* @ClassName Sanitation.java
|
||||||
|
* @Description 环卫车基础信息类
|
||||||
|
* @createTime 2022年05月19日 11:24:00
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@TableName("t_sanitation_info")
|
||||||
|
@ApiModel("环卫车辆基础数据")
|
||||||
|
public class Sanitation {
|
||||||
|
@TableId
|
||||||
|
@ApiModelProperty("id")
|
||||||
|
private Integer id;
|
||||||
|
@ApiModelProperty("车牌号")
|
||||||
|
private String cph;
|
||||||
|
@ApiModelProperty("驾驶员")
|
||||||
|
private String jsy;
|
||||||
|
@JsonFormat(pattern="yyyy-MM-dd mm:HH:ss",timezone = "GMT+8")
|
||||||
|
@ApiModelProperty("购买日期")
|
||||||
|
private LocalDateTime gmri;
|
||||||
|
@ApiModelProperty("车辆类型")
|
||||||
|
private String cllx;
|
||||||
|
@ApiModelProperty("所属区域编号")
|
||||||
|
private String ssqybh;
|
||||||
|
@ApiModelProperty("所属环卫公司编号")
|
||||||
|
private String sshwgsbh;
|
||||||
|
@ApiModelProperty("备注")
|
||||||
|
private String bz;
|
||||||
|
@ApiModelProperty("是否考核")
|
||||||
|
private Integer sfkh;
|
||||||
|
@ApiModelProperty("车辆编号")
|
||||||
|
private String clbh;
|
||||||
|
@ApiModelProperty("吨数")
|
||||||
|
private String ds;
|
||||||
|
@ApiModelProperty("是否加装GPS并连入市监管平台")
|
||||||
|
private String sfjzgpsblrsjgpt;
|
||||||
|
@ApiModelProperty("简介")
|
||||||
|
private String jj;
|
||||||
|
@ApiModelProperty("车辆型号")
|
||||||
|
private String clxh;
|
||||||
|
@ApiModelProperty("车辆大类")
|
||||||
|
private String cldl;
|
||||||
|
@ApiModelProperty("是否机扫")
|
||||||
|
private Integer sfjs;
|
||||||
|
@ApiModelProperty("是否洒水")
|
||||||
|
private Integer sfss;
|
||||||
|
@ApiModelProperty("是否冲洗")
|
||||||
|
private Integer sfcx;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,70 @@
|
||||||
|
package io.renren.modules.monitor.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author admin
|
||||||
|
* @version 1.0.0
|
||||||
|
* @ClassName SanitationRoad.java
|
||||||
|
* @Description 环卫道路
|
||||||
|
* @createTime 2022年05月20日 09:57:00
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@TableName("t_sanitation_road")
|
||||||
|
@ApiModel("环卫道路数据")
|
||||||
|
public class SanitationRoad {
|
||||||
|
@TableField
|
||||||
|
private Integer id;
|
||||||
|
private String bh;
|
||||||
|
private String dlmc;
|
||||||
|
private String qdlkdlmc;
|
||||||
|
private String zdlkdlmc;
|
||||||
|
private String zcgdlxzc;
|
||||||
|
private String bjdj;
|
||||||
|
private double dlzd;
|
||||||
|
private double dlkd;
|
||||||
|
private double dlzmj;
|
||||||
|
private double cxdmj;
|
||||||
|
private double rxdmj;
|
||||||
|
private double jsmj;
|
||||||
|
private double ssmj;
|
||||||
|
private double gycxmj;
|
||||||
|
private Integer bjysl;
|
||||||
|
private Integer gpxsl;
|
||||||
|
private String ssqybh;
|
||||||
|
private String ssjdbsc;
|
||||||
|
private String sshwgsbh;
|
||||||
|
private String zbjh;
|
||||||
|
private String sfqy;
|
||||||
|
private String bz;
|
||||||
|
private String bh1;
|
||||||
|
private Integer dtdlhzkd;
|
||||||
|
private String zcgd;
|
||||||
|
private String jsqz;
|
||||||
|
private String cxqz;
|
||||||
|
private String jj;
|
||||||
|
private String tplj;
|
||||||
|
private String zbdfxbz0zx1fx;
|
||||||
|
private String fxzbxxid;
|
||||||
|
private String ys;
|
||||||
|
private double btmx;
|
||||||
|
private Integer jsts;
|
||||||
|
private String jspc;
|
||||||
|
private Integer sfjs0bjs1js;
|
||||||
|
private Integer sfss0bss1ss;
|
||||||
|
private Integer sfcx0bcx1cx;
|
||||||
|
private String sspc;
|
||||||
|
private String cxpc;
|
||||||
|
private Integer ssts;
|
||||||
|
private Integer cxts;
|
||||||
|
private String sfkh;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,69 @@
|
||||||
|
package io.renren.modules.monitor.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author admin
|
||||||
|
* @version 1.0.0
|
||||||
|
* @ClassName SanitationTask.java
|
||||||
|
* @Description 环卫车作业数据
|
||||||
|
* @createTime 2022年05月20日 13:33:00
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@TableName("t_sanitation_task")
|
||||||
|
@ApiModel("环卫车辆作业数据")
|
||||||
|
public class SanitationTask {
|
||||||
|
@TableId
|
||||||
|
@ApiModelProperty("id")
|
||||||
|
private Integer id;
|
||||||
|
@ApiModelProperty("道路名称")
|
||||||
|
private String dlmc;
|
||||||
|
@ApiModelProperty("开始道路")
|
||||||
|
private String ksdl;
|
||||||
|
@ApiModelProperty("终止道路")
|
||||||
|
private String zzdl;
|
||||||
|
@ApiModelProperty("所属区市")
|
||||||
|
private String ssqs;
|
||||||
|
@ApiModelProperty("车牌号")
|
||||||
|
private String cph;
|
||||||
|
@ApiModelProperty("作业完成率")
|
||||||
|
private double zywcl;
|
||||||
|
@JsonFormat(pattern="yyyy-MM-dd mm:HH:ss",timezone = "GMT+8")
|
||||||
|
@ApiModelProperty("作业日期")
|
||||||
|
private LocalDateTime zyrq;
|
||||||
|
@ApiModelProperty("作业类型")
|
||||||
|
private String zylx;
|
||||||
|
@ApiModelProperty("作业时间")
|
||||||
|
private String zysj;
|
||||||
|
@ApiModelProperty("作业趟数")
|
||||||
|
private double zyts;
|
||||||
|
@ApiModelProperty("作业频次")
|
||||||
|
private double zypc;
|
||||||
|
@ApiModelProperty("作业长度")
|
||||||
|
private double zyzd;
|
||||||
|
@ApiModelProperty("作业宽度")
|
||||||
|
private double zykd;
|
||||||
|
@ApiModelProperty("作业面积")
|
||||||
|
private double zymj;
|
||||||
|
@ApiModelProperty("未作业点数")
|
||||||
|
private double wzyds;
|
||||||
|
@ApiModelProperty("作业超速点数")
|
||||||
|
private double zycsds;
|
||||||
|
@ApiModelProperty("作业GPS点数")
|
||||||
|
private double zygpsds;
|
||||||
|
@JsonFormat(pattern="yyyy-MM-dd mm:HH:ss",timezone = "GMT+8")
|
||||||
|
@ApiModelProperty("上传时间")
|
||||||
|
private LocalDateTime updatetime;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,33 @@
|
||||||
|
package io.renren.modules.monitor.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description
|
||||||
|
* @Author huangweixiong
|
||||||
|
* @Date 2022-04-19
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@TableName("t_scenic" )
|
||||||
|
public class Scenic implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 4864551986417177990L;
|
||||||
|
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 景区名
|
||||||
|
*/
|
||||||
|
private String jqmc;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 管理单位
|
||||||
|
*/
|
||||||
|
private String gldw;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,41 @@
|
||||||
|
package io.renren.modules.monitor.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author admin
|
||||||
|
* @version 1.0.0
|
||||||
|
* @ClassName SedimentTrail.java
|
||||||
|
* @Description 渣土车轨迹
|
||||||
|
* @createTime 2022年05月09日 13:47:00
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@TableName("t_trail_sediment")
|
||||||
|
public class SedimentTrail{
|
||||||
|
@TableId
|
||||||
|
private Integer id;
|
||||||
|
private double speed;
|
||||||
|
private String simCardNum;
|
||||||
|
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
|
||||||
|
private LocalDateTime uploadtime;
|
||||||
|
private double coordinateX;
|
||||||
|
private double coordinateY;
|
||||||
|
private double longitude;
|
||||||
|
private double latitude;
|
||||||
|
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
|
||||||
|
private LocalDateTime recordTime;
|
||||||
|
private double angle;
|
||||||
|
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
|
||||||
|
private LocalDateTime updateTime;
|
||||||
|
private String status;
|
||||||
|
private double fuel;
|
||||||
|
}
|
|
@ -0,0 +1,45 @@
|
||||||
|
package io.renren.modules.monitor.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author admin
|
||||||
|
* @version 1.0.0
|
||||||
|
* @ClassName TrailSanitation.java
|
||||||
|
* @Description 环卫车轨迹类
|
||||||
|
* @createTime 2022年05月10日 16:29:00
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@TableName("t_trail_sanitation")
|
||||||
|
public class TrailSanitation {
|
||||||
|
@TableId
|
||||||
|
private Integer id;
|
||||||
|
private String simkh;
|
||||||
|
private String cph;
|
||||||
|
private String wz;
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
|
||||||
|
private LocalDateTime fssj;
|
||||||
|
private double jd;
|
||||||
|
private double wd;
|
||||||
|
private double sd;
|
||||||
|
private Integer fx;
|
||||||
|
private String zt;
|
||||||
|
private double yl;
|
||||||
|
private double lc;
|
||||||
|
private double yl2;
|
||||||
|
private Integer sfzx;
|
||||||
|
private Integer xh;
|
||||||
|
private String bjzt;
|
||||||
|
private double gd;
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
|
||||||
|
private LocalDateTime updatetime;
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
package io.renren.modules.monitor.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import io.renren.common.dao.BaseDao;
|
||||||
|
import io.renren.modules.monitor.entity.Booth;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Select;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface BoothMapper extends BaseDao<Booth> {
|
||||||
|
|
||||||
|
@Select("select * from t_booth where capture_time = #{captureTime}")
|
||||||
|
List<Booth> selectBooth(String captureTime);
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
package io.renren.modules.monitor.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import io.renren.common.dao.BaseDao;
|
||||||
|
import io.renren.modules.monitor.entity.BuildingRecords;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
import org.apache.ibatis.annotations.Select;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author admin
|
||||||
|
* @version 1.0.0
|
||||||
|
* @ClassName BuildingRecordsMapper.java
|
||||||
|
* @Description TODO
|
||||||
|
* @createTime 2022年05月17日 15:32:00
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface BuildingRecordsMapper extends BaseDao<BuildingRecords> {
|
||||||
|
public void batchSave(@Param("list") List<Map> list);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,23 @@
|
||||||
|
package io.renren.modules.monitor.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import io.renren.common.dao.BaseDao;
|
||||||
|
import io.renren.modules.monitor.entity.BuildingSite;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Select;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author admin
|
||||||
|
* @version 1.0.0
|
||||||
|
* @ClassName BuildingSiteMapper.java
|
||||||
|
* @Description TODO
|
||||||
|
* @createTime 2022年05月12日 13:59:00
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface BuildingSiteMapper extends BaseDao<BuildingSite> {
|
||||||
|
|
||||||
|
@Select("select * from t_building_site")
|
||||||
|
List<BuildingSite> selectBuildSite();
|
||||||
|
}
|
|
@ -0,0 +1,65 @@
|
||||||
|
package io.renren.modules.monitor.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import io.renren.common.dao.BaseDao;
|
||||||
|
import io.renren.modules.monitor.dto.CameraChannelDto;
|
||||||
|
import io.renren.modules.monitor.dto.CameraChannelDto1;
|
||||||
|
import io.renren.modules.monitor.dto.CameraChannelNLDto;
|
||||||
|
import io.renren.modules.monitor.dto.ChannelLabelDto;
|
||||||
|
import io.renren.modules.monitor.entity.CameraChannel;
|
||||||
|
import io.renren.modules.monitor.entity.Label;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
import org.apache.ibatis.annotations.Select;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface CameraChannelMapper extends BaseDao<CameraChannel> {
|
||||||
|
|
||||||
|
void updateCameraStatus(List<String> list);
|
||||||
|
|
||||||
|
List<CameraChannelDto> selectAll();
|
||||||
|
|
||||||
|
@Select("select cc.*,cp.pic_url from t_camera_channel cc LEFT JOIN t_channel_picture cp ON cc.channel_code=cp.channel_code where cc.channel_code = #{channelCode}")
|
||||||
|
List<CameraChannelDto1> selectByChannelCode(@Param("channelCode") String channelCode);
|
||||||
|
|
||||||
|
@Select("select * from t_camera_channel where parent_id = #{parentId} and check_status in (${checkStatus}) ")
|
||||||
|
List<CameraChannel> selectByParentId(@Param("parentId") String parentId,
|
||||||
|
@Param("checkStatus") String checkStatus);
|
||||||
|
|
||||||
|
@Select("select c.* from t_camera_channel c where channel_code in " +
|
||||||
|
"(select b.channel_code from t_channel_mtm_label b where b.label_code = #{labelCode}) ")
|
||||||
|
List<ChannelLabelDto> selectLabel(@Param("labelCode") String labelCode);
|
||||||
|
//@Update("update t_camera_channel set state = list")
|
||||||
|
void updateState(@Param("list") List list);
|
||||||
|
|
||||||
|
@Select("select * from t_label")
|
||||||
|
List<Label> selectAllLabel();
|
||||||
|
|
||||||
|
@Select("select * from t_label where city = 1 ")
|
||||||
|
List<Label> selectByLabelCity();
|
||||||
|
|
||||||
|
@Select("select * from t_label where label_name like concat('%',#{labelName},'%')")
|
||||||
|
List<Label> selectByLabelName(String labelName);
|
||||||
|
|
||||||
|
@Select("select * from t_camera_channel where channel_name like concat('%',#{channelName},'%')")
|
||||||
|
List<CameraChannel> selectByChannelName(String channelName);
|
||||||
|
|
||||||
|
@Select("select * from (select a.label_code,a.label_name,c.channel_code,c.channel_name from t_channel_mtm_label b JOIN t_label a JOIN t_camera_channel c " +
|
||||||
|
"ON a.label_code = b.label_code AND b.channel_code = c.channel_code where c.`status`!= 0) m where m.label_code in (${labelCode}) ")
|
||||||
|
List<ChannelLabelDto> selectLabelAndChannel(@Param("labelCode") String labelCode);
|
||||||
|
|
||||||
|
@Select("select cc.* from t_camera_channel cc " +
|
||||||
|
"where (gps_x between #{gpsX} and #{gpsX1}) and (gps_y between #{gpsY} and #{gpsY1} )")
|
||||||
|
List<CameraChannel> selectAllByGps(@Param("gpsX") Double gpsX,
|
||||||
|
@Param("gpsX1") Double gpsX1,
|
||||||
|
@Param("gpsY") Double gpsY,
|
||||||
|
@Param("gpsY1") Double gpsY1);
|
||||||
|
|
||||||
|
|
||||||
|
List<CameraChannelNLDto> selectNLAll(@Param("page") Integer page, @Param("pageSize") Integer pageSize);
|
||||||
|
|
||||||
|
List<CameraChannelNLDto> selectByLabel(@Param("page") Integer page,@Param("pageSize") Integer pageSize);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
package io.renren.modules.monitor.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import io.renren.common.dao.BaseDao;
|
||||||
|
import io.renren.modules.monitor.dto.ChengguanDto;
|
||||||
|
import io.renren.modules.monitor.entity.Camera;
|
||||||
|
import io.renren.modules.monitor.entity.Picture;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Select;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface CameraMapper extends BaseDao<Camera> {
|
||||||
|
|
||||||
|
@Select("SELECT tc.pic,tc.capture_time AS captureTime FROM t_project_mtm_camera pmc JOIN t_camera tc ON pmc.project_id = #{id} AND pmc.camera_id = tc.`code` AND tc.pic IS NOT NULL")
|
||||||
|
List<Picture> selectPicByProjectId(String id);
|
||||||
|
|
||||||
|
@Select("SELECT tp.*,tc.* FROM t_project_mtm_camera pmc JOIN t_camera tc JOIN t_project tp ON pmc.camera_id = tc.`code` AND pmc.project_id = tp.id")
|
||||||
|
List<ChengguanDto> selectCamera();
|
||||||
|
|
||||||
|
@Select("SELECT code FROM t_camera")
|
||||||
|
List<String> selectCameraCodes();
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
package io.renren.modules.monitor.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import io.renren.common.dao.BaseDao;
|
||||||
|
import io.renren.modules.monitor.entity.CameraOrganization;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
import org.apache.ibatis.annotations.Select;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface CameraOrgenizationMapper extends BaseDao<CameraOrganization> {
|
||||||
|
|
||||||
|
@Select("select * from t_camera_organization where parent_id = #{parentId}")
|
||||||
|
List<CameraOrganization> selectSubOrganization(@Param("parentId") String parentId);
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
package io.renren.modules.monitor.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import io.renren.common.dao.BaseDao;
|
||||||
|
import io.renren.modules.monitor.entity.CameraScenic;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface CameraScenicMapper extends BaseDao<CameraScenic> {
|
||||||
|
}
|
|
@ -0,0 +1,23 @@
|
||||||
|
package io.renren.modules.monitor.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import io.renren.common.dao.BaseDao;
|
||||||
|
import io.renren.modules.monitor.entity.CaseCityLaw;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author admin
|
||||||
|
* @version 1.0.0
|
||||||
|
* @ClassName CaseCityLawMapper.java
|
||||||
|
* @Description TODO
|
||||||
|
* @createTime 2022年05月13日 16:22:00
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface CaseCityLawMapper extends BaseDao<CaseCityLaw> {
|
||||||
|
//public void batchSave(List<Map> list);
|
||||||
|
public void batchSave(List<Map> list);
|
||||||
|
public void singleSave(Map map);
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
package io.renren.modules.monitor.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import io.renren.common.dao.BaseDao;
|
||||||
|
import io.renren.modules.monitor.dto.ChannelPictureDto;
|
||||||
|
import io.renren.modules.monitor.entity.ChannelPicture;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Select;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface ChannelPictureMapper extends BaseDao<ChannelPicture> {
|
||||||
|
|
||||||
|
@Select("select * from t_project p JOIN t_channel_picture cp JOIN t_project_mtm_camera pmc on p.id = pmc.project_id AND cp.channel_code = pmc.channel_code")
|
||||||
|
List<ChannelPictureDto> selectByProject();
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
package io.renren.modules.monitor.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import io.renren.common.dao.BaseDao;
|
||||||
|
import io.renren.modules.monitor.entity.Event;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
import org.apache.ibatis.annotations.Select;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface EventMapper extends BaseDao<Event> {
|
||||||
|
@Select("SELECT * FROM t_event where track_event = 'START'")
|
||||||
|
List<Event> selectEvent();
|
||||||
|
|
||||||
|
@Select("SELECT * FROM t_event where TO_DAYS(capture_time) = TO_DAYS(NOW()) AND track_event = 'START'")
|
||||||
|
List<Event> selectByTime();
|
||||||
|
|
||||||
|
@Select("select * from t_event where event_cn_name = #{eventCnName} and track_event = 'START'")
|
||||||
|
List<Event> selectByName(@Param("eventCnName") String eventCnName);
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
package io.renren.modules.monitor.mapper;
|
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import io.renren.common.dao.BaseDao;
|
||||||
|
import io.renren.modules.monitor.entity.PassengerFlow;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface PassengerFlowlMapper extends BaseDao<PassengerFlow> {
|
||||||
|
void batchSave(List<Map> list);
|
||||||
|
PassengerFlow getByMaxId();
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
package io.renren.modules.monitor.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import io.renren.common.dao.BaseDao;
|
||||||
|
import io.renren.modules.monitor.entity.Project;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface ProjectMapper extends BaseDao<Project> {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
package io.renren.modules.monitor.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import io.renren.common.dao.BaseDao;
|
||||||
|
import io.renren.modules.monitor.entity.RoadData;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author admin
|
||||||
|
* @version 1.0.0
|
||||||
|
* @ClassName RoadDataMapper.java
|
||||||
|
* @Description TODO
|
||||||
|
* @createTime 2022年05月11日 11:10:00
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface RoadDataMapper extends BaseDao<RoadData> {
|
||||||
|
public void batchSave(List<Map> list);
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
package io.renren.modules.monitor.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import io.renren.common.dao.BaseDao;
|
||||||
|
import io.renren.modules.monitor.entity.Sanitation;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author admin
|
||||||
|
* @version 1.0.0
|
||||||
|
* @ClassName SanitationMapper.java
|
||||||
|
* @Description TODO
|
||||||
|
* @createTime 2022年05月19日 11:24:00
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface SanitationMapper extends BaseDao<Sanitation> {
|
||||||
|
void batchSave(@Param("list") List<Map> list);
|
||||||
|
void batchSaveSanitationRoad(@Param("list") List<Map> list);
|
||||||
|
void batchSaveSanitationTask(@Param("list") List<Map> list);
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
package io.renren.modules.monitor.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import io.renren.common.dao.BaseDao;
|
||||||
|
import io.renren.modules.monitor.entity.SanitationTask;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author admin
|
||||||
|
* @version 1.0.0
|
||||||
|
* @ClassName sanitationTaskMapper.java
|
||||||
|
* @Description TODO
|
||||||
|
* @createTime 2022年05月20日 17:54:00
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface SanitationTaskMapper extends BaseDao<SanitationTask> {
|
||||||
|
}
|
|
@ -0,0 +1,23 @@
|
||||||
|
package io.renren.modules.monitor.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import io.renren.common.dao.BaseDao;
|
||||||
|
import io.renren.modules.monitor.dto.ScenicCameraDto;
|
||||||
|
import io.renren.modules.monitor.entity.Camera;
|
||||||
|
import io.renren.modules.monitor.entity.Scenic;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Select;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface ScenicMapper extends BaseDao<Scenic> {
|
||||||
|
|
||||||
|
//带去重
|
||||||
|
@Select("select cam.* from t_camera cam, (SELECT DISTINCT camera_id FROM t_scenic_mtm_camera) sc WHERE cam.`code` = sc.camera_id")
|
||||||
|
List<Camera> selectCamerasInScenic();
|
||||||
|
|
||||||
|
//不去重,按景区纬度提取摄像头
|
||||||
|
@Select("select ts.*,cam.*,cs.person_num from t_scenic_mtm_camera sc JOIN t_camera cam ON cam.`code` = sc.camera_id JOIN t_scenic ts ON ts.id = sc.scenic_id LEFT JOIN t_camera_scenic cs ON cam.`code` = cs.camera_id")
|
||||||
|
List<ScenicCameraDto> selectScenicCameras();
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
package io.renren.modules.monitor.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import io.renren.common.dao.BaseDao;
|
||||||
|
import io.renren.modules.monitor.entity.SedimentTrail;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author admin
|
||||||
|
* @version 1.0.0
|
||||||
|
* @ClassName sedimentTrailMapper.java
|
||||||
|
* @Description TODO
|
||||||
|
* @createTime 2022年05月09日 13:59:00
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface SedimentTrailMapper extends BaseDao<SedimentTrail> {
|
||||||
|
public void batchaSave(List<Map> list);
|
||||||
|
}
|
|
@ -0,0 +1,15 @@
|
||||||
|
package io.renren.modules.monitor.mapper;
|
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import io.renren.common.dao.BaseDao;
|
||||||
|
import io.renren.modules.monitor.entity.TrailSanitation;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface TrailSanitationMapper extends BaseDao<TrailSanitation> {
|
||||||
|
public void batchaSave(List<Map> list);
|
||||||
|
}
|
|
@ -0,0 +1,91 @@
|
||||||
|
package io.renren.modules.monitor.service;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
import io.renren.modules.monitor.entity.BuildingRecords;
|
||||||
|
import io.renren.modules.monitor.mapper.BuildingRecordsMapper;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.util.LinkedMultiValueMap;
|
||||||
|
import org.springframework.util.MultiValueMap;
|
||||||
|
import org.springframework.web.client.RestTemplate;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author admin
|
||||||
|
* @version 1.0.0
|
||||||
|
* @ClassName BuildingRecordsService.java
|
||||||
|
* @Description TODO
|
||||||
|
* @createTime 2022年05月17日 15:33:00
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Slf4j
|
||||||
|
public class BuildingRecordsService {
|
||||||
|
@Autowired
|
||||||
|
private BuildingRecordsMapper buildingRecordsMapper;
|
||||||
|
@Autowired
|
||||||
|
private RestTemplate restTemplate;
|
||||||
|
|
||||||
|
private String url = "http://scxjsw.qingdao.gov.cn/monitorData/real-time";
|
||||||
|
|
||||||
|
public List<Map> getRecords(){
|
||||||
|
Map<String,String> map = new HashMap<>();
|
||||||
|
map.put("appid","");
|
||||||
|
map.put("timestamp","");
|
||||||
|
map.put("sign","");
|
||||||
|
map.put("data","");
|
||||||
|
|
||||||
|
ResponseEntity<JSONObject> responseEntity;
|
||||||
|
List<Map> maps = new ArrayList<>();
|
||||||
|
try{
|
||||||
|
responseEntity = restTemplate.postForEntity(url,map,JSONObject.class);
|
||||||
|
if (responseEntity.getStatusCodeValue() == 200) {
|
||||||
|
JSONObject result = responseEntity.getBody();
|
||||||
|
if(result.getIntValue("code") == 0){
|
||||||
|
JSONArray jsonArray = result.getJSONArray("data");
|
||||||
|
if(jsonArray != null){
|
||||||
|
maps = JSONObject.parseArray(JSONArray.toJSONString(jsonArray),Map.class);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}catch (Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
log.error("[BuildingRecordsService-getRecords] Exception:"+e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
return maps;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getAndSaveRecords(){
|
||||||
|
List<Map> maps = this.getRecords();
|
||||||
|
boolean result = false;
|
||||||
|
|
||||||
|
if(maps.size() > 0){
|
||||||
|
List<List<Map>> lists = Lists.partition(maps,200);
|
||||||
|
try{
|
||||||
|
lists.forEach(l->buildingRecordsMapper.batchSave(l));
|
||||||
|
result = true;
|
||||||
|
}catch (Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
log.error("[BuildingRecordsService-getAndSaveRecords] Exception:"+e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<BuildingRecords> listRecords(String pushTime){
|
||||||
|
QueryWrapper<BuildingRecords> wrapper = new QueryWrapper<>();
|
||||||
|
wrapper.like("push_time",pushTime);
|
||||||
|
List<BuildingRecords> list = new ArrayList<>();
|
||||||
|
list = buildingRecordsMapper.selectList(wrapper);
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,39 @@
|
||||||
|
package io.renren.modules.monitor.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import io.renren.modules.monitor.entity.BuildingSite;
|
||||||
|
import io.renren.modules.monitor.mapper.BuildingSiteMapper;
|
||||||
|
import io.renren.modules.monitor.utils.LongLatUtil;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author admin
|
||||||
|
* @version 1.0.0
|
||||||
|
* @ClassName BuildingSitrService.java
|
||||||
|
* @Description TODO
|
||||||
|
* @createTime 2022年05月12日 13:58:00
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Slf4j
|
||||||
|
public class BuildingSiteService {
|
||||||
|
@Autowired
|
||||||
|
private BuildingSiteMapper buildingSiteMapper;
|
||||||
|
|
||||||
|
public List<BuildingSite> listBuildingSiteByPoints(double longitude, double latitude, Integer radius){
|
||||||
|
List<BuildingSite> list = new ArrayList<>();
|
||||||
|
try{
|
||||||
|
double[] points = LongLatUtil.getAround(longitude,latitude,radius);
|
||||||
|
QueryWrapper<BuildingSite> wrapper = new QueryWrapper();
|
||||||
|
wrapper.between("jd",points[0],points[2]).between("wd",points[1],points[3]);
|
||||||
|
list = buildingSiteMapper.selectList(wrapper);
|
||||||
|
}catch (Exception e){
|
||||||
|
log.error("[listBuildingSiteByPoints] Exception:"+e.getMessage());
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,41 @@
|
||||||
|
package io.renren.modules.monitor.service;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import io.renren.modules.monitor.dto.CameraChannelDto;
|
||||||
|
import io.renren.modules.monitor.mapper.CameraChannelMapper;
|
||||||
|
import io.renren.modules.monitor.utils.EhcacheUtil;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.cache.ehcache.EhCacheCacheManager;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author admin
|
||||||
|
* @version 1.0.0
|
||||||
|
* @ClassName CameraChannelService.java
|
||||||
|
* @Description TODO
|
||||||
|
* @createTime 2022年05月12日 09:19:00
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class CameraChannelService {
|
||||||
|
@Autowired
|
||||||
|
private CameraChannelMapper cameraChannelMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private EhCacheCacheManager ehCacheCacheManager;
|
||||||
|
|
||||||
|
//查询所有摄像头
|
||||||
|
//@Cacheable(value = "fillIn")
|
||||||
|
public String selectAll(){
|
||||||
|
String list = (String) EhcacheUtil.getInstance().get("fillIn", "allCameraList");
|
||||||
|
if(StringUtils.isEmpty(list)){
|
||||||
|
List<CameraChannelDto> cameraChannelDtos = cameraChannelMapper.selectAll();
|
||||||
|
list = JSONObject.toJSONString(cameraChannelDtos);
|
||||||
|
EhcacheUtil.getInstance().put("fillIn", "allCameraList",list);
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,93 @@
|
||||||
|
package io.renren.modules.monitor.service;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.http.*;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.web.client.RestTemplate;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@Log4j2
|
||||||
|
public class EventService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
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 = "http://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","http://15.2.23.205:7009/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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,283 @@
|
||||||
|
package io.renren.modules.monitor.service;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
import io.renren.modules.monitor.entity.PassengerFlow;
|
||||||
|
import io.renren.modules.monitor.mapper.PassengerFlowlMapper;
|
||||||
|
import io.renren.modules.monitor.utils.LongLatUtil;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
import org.springframework.util.DigestUtils;
|
||||||
|
import org.springframework.web.client.RestTemplate;
|
||||||
|
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
import java.time.temporal.ChronoUnit;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author admin
|
||||||
|
* @version 1.0.0
|
||||||
|
* @ClassName PassengerFlowService.java
|
||||||
|
* @Description 实时客流service
|
||||||
|
* @createTime 2022年05月10日 14:45:00
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Log4j2
|
||||||
|
public class PassengerFlowService {
|
||||||
|
@Autowired
|
||||||
|
private PassengerFlowlMapper passengerFlowMapper;
|
||||||
|
@Autowired
|
||||||
|
private RestTemplate restTemplate;
|
||||||
|
|
||||||
|
//实时客流相关参数
|
||||||
|
@Value("202204141052331249fcc8-046")
|
||||||
|
private String APIKEY;
|
||||||
|
@Value("apitest")
|
||||||
|
private String appId;
|
||||||
|
@Value("7eb78b134e0310904d46039ccea20c32")
|
||||||
|
private String appSecret;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 最新的实时客流
|
||||||
|
* @param
|
||||||
|
* @return List
|
||||||
|
*/
|
||||||
|
//{"APIKEY":"202204141052331249fcc8-046","ParamJson":{"data":"{\"appId\":\"apitest\",\"mac\":\"f51093001255129b88deba6c5045ee26\",\"timeStamp\":\"20220510152759\",\"hourId\":\"2022051013\",\"timeId\":\"202205101300\"}"}}
|
||||||
|
public List<Map> passengerFlow(){
|
||||||
|
//JSONObject map = new JSONObject();
|
||||||
|
Map<String,Object> map = new HashMap<>();
|
||||||
|
//MultiValueMap<String,Object> map = new LinkedMultiValueMap<>();
|
||||||
|
DateTimeFormatter dateTimeFormatter1 = DateTimeFormatter.ofPattern("yyyyMMddHHmmss");
|
||||||
|
|
||||||
|
LocalDateTime dateNow = LocalDateTime.now();
|
||||||
|
String timeStamp = dateNow.format(dateTimeFormatter1);//yyyyMMddHHmmss
|
||||||
|
String[] tt = this.newMinusMinutesStr(dateNow);
|
||||||
|
|
||||||
|
String url = "http://15.72.158.72:8081/getway/api/Proxy/HandleByKey/1249fcc8-0466-4897-87b4-d2111a9baf4f";
|
||||||
|
map.put("APIKEY",APIKEY);
|
||||||
|
JSONObject jsonObject = new JSONObject();
|
||||||
|
jsonObject.put("appId",appId);
|
||||||
|
//安全认证 MD5(appId+”-”+timeStamp+”-”+ appSecret)
|
||||||
|
String code = appId+"-"+timeStamp+"-"+ appSecret;
|
||||||
|
String md5Str = DigestUtils.md5DigestAsHex(code.getBytes(StandardCharsets.UTF_8));
|
||||||
|
jsonObject.put("mac",md5Str);
|
||||||
|
jsonObject.put("timeStamp",timeStamp);
|
||||||
|
jsonObject.put("hourId",tt[1]);
|
||||||
|
jsonObject.put("timeId",tt[0]);
|
||||||
|
//jsonObject.put("apiType","***");
|
||||||
|
JSONObject para = new JSONObject();
|
||||||
|
para.put("data",JSONObject.toJSONString(jsonObject));
|
||||||
|
map.put("ParamJson",para);
|
||||||
|
|
||||||
|
System.out.println("multimap->"+map.toString());
|
||||||
|
log.info("[passengerFlow] ->",map.toString());
|
||||||
|
ResponseEntity<String> responseEntity;
|
||||||
|
List<Map> list = new ArrayList<>();
|
||||||
|
try{
|
||||||
|
responseEntity = restTemplate.postForEntity(url,map,String.class);
|
||||||
|
//System.out.println(responseEntity.getStatusCodeValue());
|
||||||
|
if(responseEntity.getStatusCodeValue() == 200){
|
||||||
|
String result = responseEntity.getBody();
|
||||||
|
//System.out.println("passengerFlow ->"+result);
|
||||||
|
JSONObject jsonResult = JSONObject.parseObject(result);
|
||||||
|
System.out.println(jsonResult.keySet().toString());
|
||||||
|
if(jsonResult.getIntValue("code") == 0){
|
||||||
|
JSONArray jsonArray = jsonResult.getJSONArray("result");
|
||||||
|
list = JSONObject.parseArray(JSONObject.toJSONString(jsonArray),Map.class);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e){
|
||||||
|
log.error("[passengerFlow] Exception:"+e.getMessage());
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
//从表中获取最新的实时客流
|
||||||
|
public List<PassengerFlow> listPassengerFlow(String timeId){
|
||||||
|
List<PassengerFlow> lists = new ArrayList<>();
|
||||||
|
long longTimeId = Long.valueOf(timeId);
|
||||||
|
if(longTimeId == 1970000000){
|
||||||
|
PassengerFlow passengerFlow = passengerFlowMapper.getByMaxId();
|
||||||
|
timeId = passengerFlow.getTimeId();
|
||||||
|
}
|
||||||
|
QueryWrapper<PassengerFlow> wrapper = new QueryWrapper<>();
|
||||||
|
wrapper.eq("time_id",timeId);
|
||||||
|
lists = passengerFlowMapper.selectList(wrapper);
|
||||||
|
|
||||||
|
return lists;
|
||||||
|
}
|
||||||
|
//从表中获取获取最新的实时客流,并筛选出all_nums>=5000,并desc排序
|
||||||
|
public List<PassengerFlow> listPassengerFlowByAllNums(){
|
||||||
|
List<PassengerFlow> lists = new ArrayList<>();
|
||||||
|
String timeId = passengerFlowMapper.getByMaxId().getTimeId();
|
||||||
|
QueryWrapper<PassengerFlow> wrapper = new QueryWrapper<>();
|
||||||
|
wrapper.eq("time_id",timeId).ge("all_nums",5000).orderByDesc("all_nums");
|
||||||
|
lists = passengerFlowMapper.selectList(wrapper);
|
||||||
|
return lists;
|
||||||
|
|
||||||
|
}
|
||||||
|
@Scheduled(cron = "0 31 10-22/1 * * ? ")
|
||||||
|
//提供的接口能查到当前时间2个小时之前的数据,每隔15分钟一次,我们只取整点从早8点到晚8点的整点数据
|
||||||
|
//10:31 到晚上10:31,每小时的31分执行一次
|
||||||
|
public void passengerFlowSchedule(){
|
||||||
|
//JSONObject map = new JSONObject();
|
||||||
|
Map<String,Object> map = new HashMap<>();
|
||||||
|
//MultiValueMap<String,Object> map = new LinkedMultiValueMap<>();
|
||||||
|
DateTimeFormatter dateTimeFormatter1 = DateTimeFormatter.ofPattern("yyyyMMddHHmmss");
|
||||||
|
|
||||||
|
LocalDateTime dateNow = LocalDateTime.now();
|
||||||
|
String timeStamp = dateNow.format(dateTimeFormatter1);//yyyyMMddHHmmss
|
||||||
|
String[] tt = this.minusMinutesStr(dateNow,120);
|
||||||
|
|
||||||
|
String url = "http://15.72.158.72:8081/getway/api/Proxy/HandleByKey/1249fcc8-0466-4897-87b4-d2111a9baf4f";
|
||||||
|
map.put("APIKEY",APIKEY);
|
||||||
|
JSONObject jsonObject = new JSONObject();
|
||||||
|
jsonObject.put("appId",appId);
|
||||||
|
//安全认证 MD5(appId+”-”+timeStamp+”-”+ appSecret)
|
||||||
|
String code = appId+"-"+timeStamp+"-"+ appSecret;
|
||||||
|
String md5Str = DigestUtils.md5DigestAsHex(code.getBytes(StandardCharsets.UTF_8));
|
||||||
|
jsonObject.put("mac",md5Str);
|
||||||
|
jsonObject.put("timeStamp",timeStamp);
|
||||||
|
jsonObject.put("hourId",tt[1]);
|
||||||
|
jsonObject.put("timeId",tt[0]);
|
||||||
|
//jsonObject.put("apiType","***");
|
||||||
|
JSONObject para = new JSONObject();
|
||||||
|
para.put("data",JSONObject.toJSONString(jsonObject));
|
||||||
|
map.put("ParamJson",para);
|
||||||
|
|
||||||
|
System.out.println("multimap->"+map.toString());
|
||||||
|
ResponseEntity<String> responseEntity;
|
||||||
|
List<Map> list = new ArrayList<>();
|
||||||
|
try{
|
||||||
|
responseEntity = restTemplate.postForEntity(url,map,String.class);
|
||||||
|
//System.out.println(responseEntity.getStatusCodeValue());
|
||||||
|
if(responseEntity.getStatusCodeValue() == 200){
|
||||||
|
String result = responseEntity.getBody();
|
||||||
|
//System.out.println("passengerFlow ->"+result);
|
||||||
|
JSONObject jsonResult = JSONObject.parseObject(result);
|
||||||
|
System.out.println(jsonResult.keySet().toString());
|
||||||
|
if(jsonResult.getIntValue("code") == 0){
|
||||||
|
JSONArray jsonArray = jsonResult.getJSONArray("result");
|
||||||
|
list = JSONObject.parseArray(JSONObject.toJSONString(jsonArray),Map.class);
|
||||||
|
List<List<Map>> lists = Lists.partition(list,200);
|
||||||
|
lists.forEach(ll ->passengerFlowMapper.batchSave(ll));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e){
|
||||||
|
log.error("[passengerFlowSchedule] Exception:"+e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
//保存实时客流
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public boolean savePassengerFlow(List<Map> maps){
|
||||||
|
List<List<Map>> lists = Lists.partition(maps,200);
|
||||||
|
try{
|
||||||
|
lists.forEach(list ->passengerFlowMapper.batchSave(list));
|
||||||
|
return true;
|
||||||
|
}catch (Exception e){
|
||||||
|
log.error("[savePassengerFlow] Exception:"+e.getMessage());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//根据半径,一个经纬度和timeId查询游客总数
|
||||||
|
public JSONObject passengerNums(double longitude, double latitude, Integer radius,String timeId){
|
||||||
|
QueryWrapper<PassengerFlow> wrapper = new QueryWrapper<>();
|
||||||
|
if(Double.doubleToLongBits(longitude) == Double.doubleToLongBits(0.00) || Double.doubleToLongBits(latitude) == Double.doubleToLongBits(0.00)){
|
||||||
|
wrapper.eq("time_id",timeId);
|
||||||
|
}else{
|
||||||
|
double[] points = LongLatUtil.getAround(longitude,latitude,radius);
|
||||||
|
wrapper.eq("time_id",timeId).between("longitude",points[0],points[2]).between("latitude",points[1],points[3]);
|
||||||
|
}
|
||||||
|
|
||||||
|
int allCount = 0;
|
||||||
|
int localCount = 0;
|
||||||
|
int nonLocalCount = 0;
|
||||||
|
JSONObject result = new JSONObject();
|
||||||
|
|
||||||
|
try{
|
||||||
|
List<PassengerFlow> list = passengerFlowMapper.selectList(wrapper);
|
||||||
|
for(PassengerFlow p:list){
|
||||||
|
allCount+=p.getAllNums();
|
||||||
|
localCount+=p.getLocalNums();
|
||||||
|
nonLocalCount+=p.getNonlocalNums();
|
||||||
|
}
|
||||||
|
result.put("local_nums",localCount);
|
||||||
|
result.put("nonlocal_nums",nonLocalCount);
|
||||||
|
result.put("all_nums",allCount);
|
||||||
|
}catch (Exception e){
|
||||||
|
log.error("[passengerNums] Exception:"+e.getMessage());
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//当前时间减去固定的分钟数,然后分钟取30
|
||||||
|
private String[] minusMinutesStr(LocalDateTime datetime,long minutes){
|
||||||
|
String t1,t2;//t1 yyyyMMddHHmm t2 yyyyMMddHH
|
||||||
|
LocalDateTime minus = datetime.minus(minutes, ChronoUnit.MINUTES);
|
||||||
|
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyyMMddHHmm");
|
||||||
|
DateTimeFormatter dateTimeFormatter2 = DateTimeFormatter.ofPattern("yyyyMMddHH");
|
||||||
|
String time1 = minus.format(dateTimeFormatter);
|
||||||
|
System.out.println(time1);
|
||||||
|
String mm = time1.substring(time1.length() -2,time1.length());
|
||||||
|
System.out.println(mm);
|
||||||
|
if(0 < Integer.parseInt(mm) &&Integer.parseInt(mm)>=30){
|
||||||
|
t1 = time1.substring(0,time1.length() -2)+"00";
|
||||||
|
}else if(Integer.parseInt(mm)<30){
|
||||||
|
LocalDateTime lastHour = LocalDateTime.parse(time1,dateTimeFormatter).plus(1,ChronoUnit.HOURS);
|
||||||
|
t1 = lastHour.format(dateTimeFormatter2)+"00";
|
||||||
|
}else{
|
||||||
|
t1 = time1;
|
||||||
|
}
|
||||||
|
|
||||||
|
t2 = t1.substring(0,t1.length()-2);
|
||||||
|
System.out.println("t1->"+t1+"...t2->"+t2);
|
||||||
|
return new String[]{t1,t2};
|
||||||
|
}
|
||||||
|
|
||||||
|
//查询出最新有游客数据的时间点
|
||||||
|
private String[] newMinusMinutesStr(LocalDateTime datetime){
|
||||||
|
String t1,t2;//t1 yyyyMMddHHmm t2 yyyyMMddHH
|
||||||
|
LocalDateTime minus = datetime.minus(125, ChronoUnit.MINUTES);
|
||||||
|
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyyMMddHHmm");
|
||||||
|
DateTimeFormatter dateTimeFormatter2 = DateTimeFormatter.ofPattern("yyyyMMddHH");
|
||||||
|
String time1 = minus.format(dateTimeFormatter);
|
||||||
|
System.out.println(time1);
|
||||||
|
String mm = time1.substring(time1.length() -2,time1.length());
|
||||||
|
System.out.println(mm);
|
||||||
|
|
||||||
|
Integer i = Integer.parseInt(mm)/15;
|
||||||
|
if(i == 0){
|
||||||
|
t1 = time1.substring(0,time1.length() -2)+"00";
|
||||||
|
}else{
|
||||||
|
t1 = time1.substring(0,time1.length() -2)+String.valueOf(15*i);
|
||||||
|
}
|
||||||
|
// if(0 < Integer.parseInt(mm) &&Integer.parseInt(mm)<=30){
|
||||||
|
// t1 = time1.substring(0,time1.length() -2)+"00";
|
||||||
|
// }else if(Integer.parseInt(mm) > 30){
|
||||||
|
// LocalDateTime lastHour = LocalDateTime.parse(time1,dateTimeFormatter).plus(1,ChronoUnit.HOURS);
|
||||||
|
// t1 = lastHour.format(dateTimeFormatter2)+"30";
|
||||||
|
// }else{
|
||||||
|
// t1 = time1;
|
||||||
|
// }
|
||||||
|
|
||||||
|
t2 = t1.substring(0,t1.length()-2);
|
||||||
|
System.out.println("t1->"+t1+"...t2->"+t2);
|
||||||
|
return new String[]{t1,t2};
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,110 @@
|
||||||
|
package io.renren.modules.monitor.service;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
import io.renren.modules.monitor.entity.RoadData;
|
||||||
|
import io.renren.modules.monitor.mapper.RoadDataMapper;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.web.client.RestTemplate;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author admin
|
||||||
|
* @version 1.0.0
|
||||||
|
* @ClassName RoadDataService.java
|
||||||
|
* @Description 道路统计数据service,道路污染
|
||||||
|
* @createTime 2022年05月11日 11:09:00
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Slf4j
|
||||||
|
public class RoadDataService {
|
||||||
|
@Autowired
|
||||||
|
private RestTemplate restTemplate;
|
||||||
|
@Autowired
|
||||||
|
private RoadDataMapper roadDataMapper;
|
||||||
|
|
||||||
|
//道路统计数据与排名(道路污染),调用公开接口并保存到表t_road_data
|
||||||
|
@Scheduled(cron="0 0 8 * * ?")
|
||||||
|
public void saveRoadData(){
|
||||||
|
String url = "http://outerdata.novaecs.com/api/qingdaoData/roadData?groupId={groupId}&timeType={timeType}&dt={dt}";
|
||||||
|
|
||||||
|
Map<String,Object> map = new HashMap<>();
|
||||||
|
|
||||||
|
map.put("dt",this.dateTimeStr());
|
||||||
|
map.put("groupId",1);
|
||||||
|
map.put("timeType","日");
|
||||||
|
|
||||||
|
ResponseEntity<JSONObject> responseEntity;
|
||||||
|
List<Map> list = new ArrayList<>();
|
||||||
|
try {
|
||||||
|
responseEntity = restTemplate.getForEntity(url, JSONObject.class, map);
|
||||||
|
HttpStatus statusCode = responseEntity.getStatusCode();
|
||||||
|
if (statusCode.is2xxSuccessful()) {
|
||||||
|
JSONObject re = responseEntity.getBody();
|
||||||
|
if (re.getIntValue("status") == 0) {
|
||||||
|
JSONArray jsonArray = re.getJSONArray("data");
|
||||||
|
list = JSONArray.parseArray(JSONObject.toJSONString(jsonArray), Map.class);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.info("[roadData] exception:{}", e.getMessage());
|
||||||
|
}
|
||||||
|
if(list.size() > 0){
|
||||||
|
List<Map> maps = list.stream().map(l->{
|
||||||
|
l.put("points",JSONObject.toJSONString(l.get("points")));
|
||||||
|
l.put("dt",this.dateTimeStr());
|
||||||
|
return l;
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
List<List<Map>> lists = Lists.partition(maps,200);
|
||||||
|
lists.forEach(ll->roadDataMapper.batchSave(ll));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//根据日期查询道路污染数据
|
||||||
|
public List<RoadData> listRoadData(String dt){
|
||||||
|
QueryWrapper<RoadData> wrapper = new QueryWrapper<>();
|
||||||
|
wrapper.eq("dt",dt);
|
||||||
|
List<RoadData> list = roadDataMapper.selectList(wrapper);
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<RoadData> listRoadDataByTimeRegion(String start,String end){
|
||||||
|
QueryWrapper<RoadData> wrapper = new QueryWrapper<>();
|
||||||
|
wrapper.between("dt",start,end);
|
||||||
|
List<RoadData> list = roadDataMapper.selectList(wrapper);
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取当前日期的时间串,2022-05-08 00:00:00
|
||||||
|
private String dateTimeStr(){
|
||||||
|
LocalDate localDate = LocalDate.now();
|
||||||
|
LocalDate yestDay = localDate.minusDays(1);
|
||||||
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||||
|
LocalDateTime dateTime = LocalDateTime.of(yestDay.getYear(),yestDay.getMonth(),yestDay.getDayOfMonth(),0,0,0);
|
||||||
|
return dateTime.format(formatter);
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取当前日期的时间串,2022-05-08
|
||||||
|
private String dateStr(){
|
||||||
|
LocalDate localDate = LocalDate.now();
|
||||||
|
LocalDate yestDay = localDate.minusDays(1);
|
||||||
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||||
|
|
||||||
|
return yestDay.format(formatter);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,221 @@
|
||||||
|
package io.renren.modules.monitor.service;
|
||||||
|
|
||||||
|
import cn.hutool.crypto.SecureUtil;
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.incrementer.DefaultIdentifierGenerator;
|
||||||
|
import com.baomidou.mybatisplus.core.incrementer.IdentifierGenerator;
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
import io.renren.modules.monitor.entity.CaseCityLaw;
|
||||||
|
import io.renren.modules.monitor.entity.Result;
|
||||||
|
import io.renren.modules.monitor.mapper.CaseCityLawMapper;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.http.HttpEntity;
|
||||||
|
import org.springframework.http.HttpHeaders;
|
||||||
|
import org.springframework.http.HttpMethod;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.util.LinkedMultiValueMap;
|
||||||
|
import org.springframework.util.MultiValueMap;
|
||||||
|
import org.springframework.web.client.RestTemplate;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author admin
|
||||||
|
* @version 1.0.0
|
||||||
|
* @ClassName SJZTService.java
|
||||||
|
* @Description 数交中台service,城市执法
|
||||||
|
* @createTime 2022年05月12日 18:00:00
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Slf4j
|
||||||
|
public class SJZTService {
|
||||||
|
@Autowired
|
||||||
|
private RestTemplate restTemplate;
|
||||||
|
@Autowired
|
||||||
|
private CaseCityLawMapper caseCityLawMapper;
|
||||||
|
|
||||||
|
//数交中台
|
||||||
|
//1.登录
|
||||||
|
public String sjztToken () {
|
||||||
|
String url = "http://120.221.95.13:9090/apin/authorization/oauth/token";
|
||||||
|
HttpHeaders headers = new HttpHeaders();
|
||||||
|
headers.add("Authorization", "Basic dGVzdF9jbGllbnQ6ZTk4OWQ0NmZkYmMxYzM3NmMxOWE0M2FhZjg1MjI3YTQ=");
|
||||||
|
headers.add("Content-Type", "application/x-www-form-urlencoded");
|
||||||
|
|
||||||
|
MultiValueMap map = new LinkedMultiValueMap();
|
||||||
|
map.add("username", "qdsyn");
|
||||||
|
String sigin = SecureUtil.md5("Qdsyn123!");
|
||||||
|
map.add("password", sigin);//Qdsyn123!,需要MD5加密
|
||||||
|
map.add("scope", "read");
|
||||||
|
map.add("grant_type", "password");
|
||||||
|
map.add("vc", "NO");
|
||||||
|
|
||||||
|
HttpEntity<MultiValueMap<String, String>> request = new HttpEntity<>(map, headers);
|
||||||
|
ResponseEntity<JSONObject> responseEntity;
|
||||||
|
try {
|
||||||
|
responseEntity = restTemplate.exchange(url, HttpMethod.POST, request, JSONObject.class);
|
||||||
|
JSONObject jsonObject = responseEntity.getBody();
|
||||||
|
if (jsonObject.getBooleanValue("success") == true) {
|
||||||
|
JSONObject resultJson = jsonObject.getJSONObject("result");
|
||||||
|
return resultJson.getString("accessToken");
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.info("[qidiToken] exception:{}", e.getMessage());
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//从接口获取案件数据
|
||||||
|
public List<Map> listSJZTDatas() {
|
||||||
|
String token = this.sjztToken();
|
||||||
|
HttpHeaders headers = new HttpHeaders();
|
||||||
|
headers.add("Authorization", "Bearer " + token);
|
||||||
|
|
||||||
|
Map<String,Object> map = new HashMap<>();
|
||||||
|
JSONObject search = new JSONObject();
|
||||||
|
search.put("opt","LIKE");
|
||||||
|
search.put("key","WTLYMC");
|
||||||
|
// search.put("val",this.dateStr());
|
||||||
|
search.put("val","微信举报");
|
||||||
|
|
||||||
|
map.put("json",search);
|
||||||
|
int i = 1;
|
||||||
|
int roundCount = 0;
|
||||||
|
int count = 0;
|
||||||
|
List<Map> maps = new ArrayList<>();
|
||||||
|
do{
|
||||||
|
String url = "http://120.221.95.13:9090/catalog/resCatalogApply/getData/UC_QUERY_QDZWT_307013311122000064_1?pageSize=10000&pageNo={1}&search=[{2}]";
|
||||||
|
//String url = "http://120.221.95.13:9090/catalog/resCatalogApply/getData/UC_QUERY_QDZWT_307013311122000064_1?pageSize=1&pageNo=1&search={json}";
|
||||||
|
HttpEntity<Map> httpEntity = new HttpEntity<>(null, headers);
|
||||||
|
ResponseEntity<JSONObject> responseEntity;
|
||||||
|
try {
|
||||||
|
responseEntity = restTemplate.exchange(url, HttpMethod.GET, httpEntity, JSONObject.class,i,search);
|
||||||
|
|
||||||
|
JSONObject jsonObject = responseEntity.getBody();
|
||||||
|
count = jsonObject.getIntValue("count");
|
||||||
|
JSONArray jsonArray = jsonObject.getJSONArray("list");
|
||||||
|
maps.addAll(JSONObject.parseArray(JSONObject.toJSONString(jsonArray), Map.class));
|
||||||
|
i++;
|
||||||
|
roundCount = i*10000;
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.info("[listSJZTDatas] exception:{}", e.getMessage());
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
} while(roundCount <=count);
|
||||||
|
|
||||||
|
log.info("[listSJZTDatas] 返回数据的数量:{}",maps.size());
|
||||||
|
return maps;
|
||||||
|
}
|
||||||
|
|
||||||
|
//从接口获取案件数据并保存
|
||||||
|
public void batchSave(){
|
||||||
|
String token = this.sjztToken();
|
||||||
|
HttpHeaders headers = new HttpHeaders();
|
||||||
|
headers.add("Authorization", "Bearer " + token);
|
||||||
|
|
||||||
|
Map<String,Object> map = new HashMap<>();
|
||||||
|
JSONObject search = new JSONObject();
|
||||||
|
search.put("opt","LIKE");
|
||||||
|
search.put("key","AJJLSJ");
|
||||||
|
// search.put("val",this.dateStr());
|
||||||
|
search.put("val","2017");
|
||||||
|
|
||||||
|
map.put("json",search);
|
||||||
|
int i = 1;
|
||||||
|
int roundCount = 0;
|
||||||
|
int count = 0;
|
||||||
|
List<Map> mapList = new ArrayList<>();
|
||||||
|
do{
|
||||||
|
String url = "http://120.221.95.13:9090/catalog/resCatalogApply/getData/UC_QUERY_QDZWT_307013311122000064_1?pageSize=10000&pageNo={1}&search=[{2}]";
|
||||||
|
//String url = "http://120.221.95.13:9090/catalog/resCatalogApply/getData/UC_QUERY_QDZWT_307013311122000064_1?pageSize=1&pageNo=1&search={json}";
|
||||||
|
HttpEntity<Map> httpEntity = new HttpEntity<>(null, headers);
|
||||||
|
ResponseEntity<JSONObject> responseEntity;
|
||||||
|
try {
|
||||||
|
responseEntity = restTemplate.exchange(url, HttpMethod.GET, httpEntity, JSONObject.class,i,search);
|
||||||
|
|
||||||
|
JSONObject jsonObject = responseEntity.getBody();
|
||||||
|
count = jsonObject.getIntValue("count");
|
||||||
|
JSONArray jsonArray = jsonObject.getJSONArray("list");
|
||||||
|
mapList.addAll(JSONObject.parseArray(JSONObject.toJSONString(jsonArray), Map.class));
|
||||||
|
i++;
|
||||||
|
roundCount = i*10000;
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.info("[SJZTService-batchSave] exception:{}", e.getMessage());
|
||||||
|
}
|
||||||
|
} while(roundCount <=count);
|
||||||
|
System.out.println(mapList.size());
|
||||||
|
|
||||||
|
IdentifierGenerator identifierGenerator=new DefaultIdentifierGenerator();
|
||||||
|
mapList.forEach(m-> m.put("id",identifierGenerator.nextId(new Object())));//给id赋值
|
||||||
|
|
||||||
|
List<List<Map>> lists = Lists.partition(mapList,50);
|
||||||
|
try{
|
||||||
|
lists.forEach(l->caseCityLawMapper.batchSave(l));
|
||||||
|
}catch (Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
log.error("[SJZTService batchsave Exception]:",e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<CaseCityLaw> listSJZTByDt(String ajjlsj){
|
||||||
|
QueryWrapper<CaseCityLaw> wrapper = new QueryWrapper<>();
|
||||||
|
wrapper.like("ajjlsj",ajjlsj);
|
||||||
|
return caseCityLawMapper.selectList(wrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Result upStream(JSONObject data){
|
||||||
|
String url = "?actionType={1}&senderCode={2}&data={3}";
|
||||||
|
String senderCode = "";//发送方标识
|
||||||
|
String actionType = "UP_REC_REPORT";//调用方法,固定值
|
||||||
|
boolean result = false;
|
||||||
|
|
||||||
|
ResponseEntity<JSONObject> responseEntity;
|
||||||
|
try{
|
||||||
|
responseEntity = restTemplate.postForEntity(url, null, JSONObject.class,senderCode,actionType,data);
|
||||||
|
JSONObject responseJSON = responseEntity.getBody();
|
||||||
|
if(responseEntity.getStatusCodeValue() == 200){
|
||||||
|
if(responseJSON.getBooleanValue("success") && responseJSON.getIntValue("code") == 0){
|
||||||
|
return Result.success(responseJSON.get("data"));
|
||||||
|
}else{
|
||||||
|
return Result.error(responseJSON.getString("data"));
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
return Result.error(String.valueOf(responseEntity.getStatusCodeValue()));
|
||||||
|
}
|
||||||
|
}catch (Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
log.error("[SJZTService upStream] Exception:"+e.getMessage());
|
||||||
|
return Result.error(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取当前日期的时间串,2022-05-08 00:00:00
|
||||||
|
private String dateTimeStr(){
|
||||||
|
LocalDate localDate = LocalDate.now();
|
||||||
|
LocalDate yestDay = localDate.minusDays(1);
|
||||||
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||||
|
LocalDateTime dateTime = LocalDateTime.of(yestDay.getYear(),yestDay.getMonth(),yestDay.getDayOfMonth(),0,0,0);
|
||||||
|
return dateTime.format(formatter);
|
||||||
|
}
|
||||||
|
//获取当前日期的时间串,2022-05-08
|
||||||
|
private String dateStr(){
|
||||||
|
LocalDate localDate = LocalDate.now();
|
||||||
|
LocalDate yestDay = localDate.minusDays(1);
|
||||||
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||||
|
|
||||||
|
return yestDay.format(formatter);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,105 @@
|
||||||
|
package io.renren.modules.monitor.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
import io.renren.modules.monitor.entity.Result;
|
||||||
|
import io.renren.modules.monitor.entity.SanitationTask;
|
||||||
|
import io.renren.modules.monitor.mapper.SanitationMapper;
|
||||||
|
import io.renren.modules.monitor.mapper.SanitationTaskMapper;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.web.client.RestTemplate;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author admin
|
||||||
|
* @version 1.0.0
|
||||||
|
* @ClassName SanitationService.java
|
||||||
|
* @Description TODO
|
||||||
|
* @createTime 2022年05月19日 11:23:00
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Slf4j
|
||||||
|
public class SanitationService {
|
||||||
|
@Autowired
|
||||||
|
private SanitationMapper sanitationMapper;
|
||||||
|
@Autowired
|
||||||
|
private RestTemplate restTemplate;
|
||||||
|
@Autowired
|
||||||
|
private MonitorService monitorService;
|
||||||
|
@Autowired
|
||||||
|
private SanitationTaskMapper sanitationTaskMapper;
|
||||||
|
|
||||||
|
|
||||||
|
public Result saveSantation(){
|
||||||
|
List<Map> list = monitorService.resCatalogApplyHJWSBase();
|
||||||
|
if(list.size() > 0){
|
||||||
|
List<List<Map>> maps = Lists.partition(list,100);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Result saveSanitationRoad(){
|
||||||
|
List<Map> list = monitorService.resCatalogApplyHJWSRoad();
|
||||||
|
try{
|
||||||
|
if(list.size() > 0){
|
||||||
|
List<List<Map>> maps = Lists.partition(list,100);
|
||||||
|
maps.forEach(m->sanitationMapper.batchSaveSanitationRoad(m));
|
||||||
|
}
|
||||||
|
return Result.success();
|
||||||
|
}catch (Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
log.error("[SanitationService saveSanitationRoad] Exception:"+e.getMessage());
|
||||||
|
return Result.error(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Result saveSanitationTask(){
|
||||||
|
List<Map> list = monitorService.resCatalogApplyHJWSZY();
|
||||||
|
try{
|
||||||
|
if(list.size() > 0){
|
||||||
|
List<List<Map>> maps = Lists.partition(list,100);
|
||||||
|
maps.forEach(m->sanitationMapper.batchSaveSanitationTask(m));
|
||||||
|
}
|
||||||
|
return Result.success();
|
||||||
|
}catch (Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
log.error("[SanitationService saveSanitationTask] Exception:"+e.getMessage());
|
||||||
|
return Result.error(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//批量查询环卫车作业数据并保存,可以根据实际需求更改
|
||||||
|
@Scheduled(cron = "0 0 8 * * ?")
|
||||||
|
public void saveSanitationTaskScheduled(){
|
||||||
|
QueryWrapper<SanitationTask> wrapper = new QueryWrapper<>();
|
||||||
|
wrapper.orderByDesc("updatetime");
|
||||||
|
SanitationTask sanitationTask = sanitationTaskMapper.selectOne(wrapper);
|
||||||
|
List<Map> maps = new ArrayList<>();
|
||||||
|
|
||||||
|
try{
|
||||||
|
if(sanitationTask != null){
|
||||||
|
maps = monitorService.resCatalogApplyHJWSZY(String.valueOf(sanitationTask.getUpdatetime()));
|
||||||
|
|
||||||
|
}else{
|
||||||
|
maps = monitorService.resCatalogApplyHJWSZY();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(maps.size() > 0){
|
||||||
|
List<List<Map>> lists = Lists.partition(maps,100);
|
||||||
|
lists.forEach(list->sanitationMapper.batchSaveSanitationTask(list));
|
||||||
|
}
|
||||||
|
}catch (Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
log.error("[SanitationService saveSanitationTaskScheduled] Exception:"+e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,71 @@
|
||||||
|
package io.renren.modules.monitor.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
import io.renren.modules.monitor.entity.SedimentTrail;
|
||||||
|
import io.renren.modules.monitor.mapper.SedimentTrailMapper;
|
||||||
|
import io.renren.modules.monitor.utils.LongLatUtil;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
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.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author admin
|
||||||
|
* @version 1.0.0
|
||||||
|
* @ClassName SedimentTrailService.java
|
||||||
|
* @Description 渣土车service
|
||||||
|
* @createTime 2022年05月09日 14:01:00
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Slf4j
|
||||||
|
public class SedimentTrailService {
|
||||||
|
@Autowired
|
||||||
|
private SedimentTrailMapper sedimentTrailMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private MonitorService monitorService;
|
||||||
|
|
||||||
|
//获取渣土车轨迹并保存到表t_trail_sediment
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public boolean batchSaveSedimentTrail(){
|
||||||
|
try{
|
||||||
|
List<Map> maps = monitorService.resCatalogApplyZTYS();
|
||||||
|
Lists.partition(maps,200).forEach(
|
||||||
|
item-> sedimentTrailMapper.batchaSave(item)
|
||||||
|
);
|
||||||
|
return true;
|
||||||
|
}catch (Exception e){
|
||||||
|
log.error("[batchSaveSedimentTrail] exception:{}",e.getMessage());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据输入的经纬度和查询的半径(米)查询范围内的渣土车轨迹信息
|
||||||
|
* @param longitude(经度) latitude(纬度) radius(米) start(时间) end(时间)
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public Map<String,List<SedimentTrail>> listSedimentTrailByPoints(double longitude, double latitude, Integer radius, String start, String end){
|
||||||
|
double[] points = LongLatUtil.getAround(longitude,latitude,radius);
|
||||||
|
QueryWrapper<SedimentTrail> wrapper = new QueryWrapper<>();
|
||||||
|
wrapper.between("update_time",start,end).between("longitude",points[0],points[2]).between("latitude",points[1],points[3])
|
||||||
|
.orderByAsc("sim_card_num","record_time");
|
||||||
|
List<Map> maps = new ArrayList<>();
|
||||||
|
Map<String, List<SedimentTrail>> map = new HashMap<>();
|
||||||
|
try{
|
||||||
|
List<SedimentTrail> list = sedimentTrailMapper.selectList(wrapper);
|
||||||
|
map = list.stream().collect(Collectors.groupingBy(SedimentTrail::getSimCardNum));
|
||||||
|
|
||||||
|
}catch (Exception e){
|
||||||
|
log.error("[listSedimentTrailByPoints] Exception:",e.getMessage());
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,48 @@
|
||||||
|
package io.renren.modules.monitor.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
import io.renren.modules.monitor.entity.TrailSanitation;
|
||||||
|
import io.renren.modules.monitor.mapper.TrailSanitationMapper;
|
||||||
|
import io.renren.modules.monitor.utils.LongLatUtil;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@Log4j2
|
||||||
|
public class TrailSanitationService {
|
||||||
|
@Autowired
|
||||||
|
private TrailSanitationMapper trailSanitationMapper;
|
||||||
|
@Autowired
|
||||||
|
private MonitorService monitorService;
|
||||||
|
|
||||||
|
public boolean saveTrailSanitation(){
|
||||||
|
boolean result = false;
|
||||||
|
try{
|
||||||
|
List<Map> list = monitorService.resCatalogApplyHJWS();
|
||||||
|
List<List<Map>> lists = Lists.partition(list,200);
|
||||||
|
lists.forEach(l->trailSanitationMapper.batchaSave(l));
|
||||||
|
result = true;
|
||||||
|
}catch (Exception e){
|
||||||
|
log.error("[saveTrailSanitation] Exception:",e.getMessage());
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据输入的经纬度和查询的半径(米)查询范围内的环卫车轨迹信息
|
||||||
|
* @param longitude(经度) latitude(纬度) raidus(米) start(时间) end(时间)
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public List<TrailSanitation> listSedimentTrailByPoints(double longitude, double latitude, Integer radius, String start, String end){
|
||||||
|
double[] points = LongLatUtil.getAround(longitude,latitude,radius);
|
||||||
|
QueryWrapper<TrailSanitation> wrapper = new QueryWrapper<>();
|
||||||
|
wrapper.between("fssj",start,end).between("jd",points[0],points[2]).between("wd",points[1],points[3]);
|
||||||
|
return trailSanitationMapper.selectList(wrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,53 @@
|
||||||
|
package io.renren.modules.monitor.utils;
|
||||||
|
|
||||||
|
import net.sf.ehcache.Cache;
|
||||||
|
import net.sf.ehcache.CacheManager;
|
||||||
|
import net.sf.ehcache.Element;
|
||||||
|
|
||||||
|
import java.net.URL;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author admin
|
||||||
|
* @version 1.0.0
|
||||||
|
* @ClassName EhcacheUtil.java
|
||||||
|
* @Description TODO
|
||||||
|
* @createTime 2022年05月12日 10:20:00
|
||||||
|
*/
|
||||||
|
public class EhcacheUtil {
|
||||||
|
private static final String path = "/ehcache.xml";
|
||||||
|
private URL url;
|
||||||
|
private CacheManager manager;
|
||||||
|
private static EhcacheUtil ehCache;
|
||||||
|
private EhcacheUtil(String path) {
|
||||||
|
url = getClass().getResource(path);
|
||||||
|
manager = CacheManager.create(url);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static EhcacheUtil getInstance() {
|
||||||
|
if (ehCache== null) {
|
||||||
|
ehCache= new EhcacheUtil(path);
|
||||||
|
}
|
||||||
|
return ehCache;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void put(String cacheName, String key, Object value) {
|
||||||
|
Cache cache = manager.getCache(cacheName);
|
||||||
|
Element element = new Element(key, value);
|
||||||
|
cache.put(element);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object get(String cacheName, String key) {
|
||||||
|
Cache cache = manager.getCache(cacheName);
|
||||||
|
Element element = cache.get(key);
|
||||||
|
return element == null ? null : element.getObjectValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Cache get(String cacheName) {
|
||||||
|
return manager.getCache(cacheName);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void remove(String cacheName, String key) {
|
||||||
|
Cache cache = manager.getCache(cacheName);
|
||||||
|
cache.remove(key);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,63 @@
|
||||||
|
package io.renren.modules.monitor.utils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author admin
|
||||||
|
* @version 1.0.0
|
||||||
|
* @ClassName LongLatUtil.java
|
||||||
|
* @Description TODO
|
||||||
|
* @createTime 2022年05月09日 09:54:00
|
||||||
|
*/
|
||||||
|
public class LongLatUtil {
|
||||||
|
private static final double PI = 3.1415926;
|
||||||
|
/**
|
||||||
|
* 计算地球上任意两点(经纬度)距离
|
||||||
|
*
|
||||||
|
* @param long1 第一点经度
|
||||||
|
* @param lat1 第一点纬度
|
||||||
|
* @param long2 第二点经度
|
||||||
|
* @param lat2 第二点纬度
|
||||||
|
* @return 返回距离 单位:米
|
||||||
|
*/
|
||||||
|
public static double distanceByLongNLat(double long1, double lat1, double long2, double lat2) {
|
||||||
|
double a, b, R;
|
||||||
|
R = 6378137;//地球半径
|
||||||
|
lat1 = lat1 * Math.PI / 180.0;
|
||||||
|
lat2 = lat2 * Math.PI / 180.0;
|
||||||
|
a = lat1 - lat2;
|
||||||
|
b = (long1 - long2) * Math.PI / 180.0;
|
||||||
|
double d;
|
||||||
|
double sa2, sb2;
|
||||||
|
sa2 = Math.sin(a / 2.0);
|
||||||
|
sb2 = Math.sin(b / 2.0);
|
||||||
|
d = 2 * R * Math.asin(Math.sqrt(sa2 * sa2 + Math.cos(lat1) * Math.cos(lat2) * sb2 * sb2));
|
||||||
|
return d;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据经纬度和半径计算经纬度范围
|
||||||
|
*
|
||||||
|
* @param raidus 单位米
|
||||||
|
* @return minLat, minLng, maxLat, maxLng
|
||||||
|
*/
|
||||||
|
public static double[] getAround(double lon,double lat, int raidus) {
|
||||||
|
|
||||||
|
Double latitude = lat;
|
||||||
|
Double longitude = lon;
|
||||||
|
|
||||||
|
Double degree = (24901 * 1609) / 360.0;
|
||||||
|
double raidusMile = raidus;
|
||||||
|
|
||||||
|
Double dpmLat = 1 / degree;
|
||||||
|
Double radiusLat = dpmLat * raidusMile;
|
||||||
|
Double minLat = latitude - radiusLat;
|
||||||
|
Double maxLat = latitude + radiusLat;
|
||||||
|
|
||||||
|
Double mpdLng = degree * Math.cos(latitude * (PI / 180));
|
||||||
|
Double dpmLng = 1 / mpdLng;
|
||||||
|
Double radiusLng = dpmLng * raidusMile;
|
||||||
|
Double minLng = longitude - radiusLng;
|
||||||
|
Double maxLng = longitude + radiusLng;
|
||||||
|
return new double[]{minLng,minLat, maxLng, maxLat};
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,89 @@
|
||||||
|
package io.renren.modules.monitorCamera.service;
|
||||||
|
|
||||||
|
import io.renren.modules.resource.dto.ResourceDTO;
|
||||||
|
import io.renren.modules.resource.entity.AttrEntity;
|
||||||
|
import io.renren.modules.resource.service.ResourceService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.web.client.RestTemplate;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class CameraService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ResourceService resourceService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RestTemplate restTemplate;
|
||||||
|
|
||||||
|
public void syncCameraData(){
|
||||||
|
|
||||||
|
Integer page = 1;
|
||||||
|
final Integer pageSize = 50;
|
||||||
|
|
||||||
|
String[] attKeys = {"labelCode",
|
||||||
|
"labelName" ,
|
||||||
|
"channelCode" ,
|
||||||
|
"gpsX" ,
|
||||||
|
"gpsY" ,
|
||||||
|
"status" ,
|
||||||
|
"nodeName" ,
|
||||||
|
"checkStatus"};
|
||||||
|
|
||||||
|
String url = "http://15.72.183.90:7009/api/project/selectCamera?page={page}&pageSize={pageSize}";
|
||||||
|
while (true){
|
||||||
|
HashMap parame = new HashMap<>();
|
||||||
|
parame.put("page", page++);
|
||||||
|
parame.put("pageSize", pageSize);
|
||||||
|
|
||||||
|
ResponseEntity forEntity = restTemplate.getForEntity(url, HashMap.class, parame);
|
||||||
|
|
||||||
|
if (forEntity.hasBody()){
|
||||||
|
|
||||||
|
Map body = (Map) forEntity.getBody();
|
||||||
|
List<Map> datas = (List) body.get("data");
|
||||||
|
|
||||||
|
if (datas.size() <= 0) break;
|
||||||
|
|
||||||
|
for (Map<String,Object> obj : datas) {
|
||||||
|
|
||||||
|
ResourceDTO resourceDTO = new ResourceDTO();
|
||||||
|
resourceDTO.setName((String) obj.get("channelName"));
|
||||||
|
resourceDTO.setType("基础设施");
|
||||||
|
resourceDTO.setDelFlag(0);
|
||||||
|
|
||||||
|
List<AttrEntity> infoList = new ArrayList(pageSize);
|
||||||
|
for (String attKey : attKeys) {
|
||||||
|
AttrEntity attrEntity = new AttrEntity();
|
||||||
|
attrEntity.setAttrType(attKey);
|
||||||
|
Object value = obj.get(attKey);
|
||||||
|
String strValue = null;
|
||||||
|
if (value instanceof String){
|
||||||
|
strValue = (String) value;
|
||||||
|
}else if (value != null){
|
||||||
|
strValue = String.valueOf(value);
|
||||||
|
}else {
|
||||||
|
|
||||||
|
}
|
||||||
|
attrEntity.setAttrValue(strValue);
|
||||||
|
attrEntity.setDelFlag(0);
|
||||||
|
infoList.add(attrEntity);
|
||||||
|
}
|
||||||
|
resourceDTO.setInfoList(infoList);
|
||||||
|
resourceService.insertWithAttrs(resourceDTO);
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -21,7 +21,7 @@ import org.springframework.stereotype.Service;
|
||||||
import org.springframework.web.client.RestTemplate;
|
import org.springframework.web.client.RestTemplate;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Locale;
|
import java.util.Map;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ public class ApiGatewayService {
|
||||||
throw new IllegalArgumentException(String.format("未找到对应的资源id:%s", resourceId));
|
throw new IllegalArgumentException(String.format("未找到对应的资源id:%s", resourceId));
|
||||||
}
|
}
|
||||||
String apiUrl = resourceEntity.getApiUrl();
|
String apiUrl = resourceEntity.getApiUrl();
|
||||||
String methods = resourceEntity.getApiMethodType();
|
String methods = resourceEntity.getApiMethodType().toUpperCase();
|
||||||
|
|
||||||
if (StringUtils.isBlank(apiUrl) || StringUtils.isBlank(methods)){
|
if (StringUtils.isBlank(apiUrl) || StringUtils.isBlank(methods)){
|
||||||
String msg = String.format("注册api参数为空,跳过 apiUrl:%s, methods:%s, resourceId:%s", apiUrl, methods, resourceId);
|
String msg = String.format("注册api参数为空,跳过 apiUrl:%s, methods:%s, resourceId:%s", apiUrl, methods, resourceId);
|
||||||
|
@ -69,7 +69,7 @@ public class ApiGatewayService {
|
||||||
log.info(msg);
|
log.info(msg);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
methods = methods.toUpperCase(Locale.ROOT);
|
|
||||||
//建group
|
//建group
|
||||||
String domain = getIP(apiUrl);
|
String domain = getIP(apiUrl);
|
||||||
String uris = apiUrl.substring(apiUrl.indexOf(domain) + domain.length());
|
String uris = apiUrl.substring(apiUrl.indexOf(domain) + domain.length());
|
||||||
|
@ -83,6 +83,11 @@ public class ApiGatewayService {
|
||||||
groupEntity.put("stripPrefixPattern",String.format("^%s/(.*)", apiPrefix));
|
groupEntity.put("stripPrefixPattern",String.format("^%s/(.*)", apiPrefix));
|
||||||
groupEntity.put("serviceName",domain );
|
groupEntity.put("serviceName",domain );
|
||||||
|
|
||||||
|
//加这个才能code认证
|
||||||
|
Map plugins = new HashMap();
|
||||||
|
plugins.put("key-auth", new HashMap(0));
|
||||||
|
groupEntity.put("plugins", plugins);
|
||||||
|
|
||||||
String groupUrl = gatewayUrl + "/apiops/api/groups";
|
String groupUrl = gatewayUrl + "/apiops/api/groups";
|
||||||
ResponseEntity<HashMap> responseEntity = restTemplate.postForEntity(groupUrl, groupEntity, HashMap.class);
|
ResponseEntity<HashMap> responseEntity = restTemplate.postForEntity(groupUrl, groupEntity, HashMap.class);
|
||||||
if (responseEntity.getStatusCode() == HttpStatus.OK && responseEntity.hasBody()) {
|
if (responseEntity.getStatusCode() == HttpStatus.OK && responseEntity.hasBody()) {
|
||||||
|
|
|
@ -124,11 +124,11 @@ public class ResourceEntity extends BaseEntity {
|
||||||
/**
|
/**
|
||||||
* 下架理由
|
* 下架理由
|
||||||
*/
|
*/
|
||||||
private String undercarriageReason;
|
// private String undercarriageReason;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 提起下架人员
|
* 提起下架人员
|
||||||
*/
|
*/
|
||||||
private String undercarriageUserName;
|
// private String undercarriageUserName;
|
||||||
}
|
}
|
|
@ -4,7 +4,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import com.fasterxml.jackson.databind.module.SimpleModule;
|
import com.fasterxml.jackson.databind.module.SimpleModule;
|
||||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||||
import io.renren.common.interceptor.IdentityInterceptor;
|
|
||||||
import io.renren.common.utils.DateUtils;
|
import io.renren.common.utils.DateUtils;
|
||||||
import io.renren.modules.pay.Interceptor.AliPayInterceptor;
|
import io.renren.modules.pay.Interceptor.AliPayInterceptor;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
@ -27,9 +26,6 @@ import java.util.TimeZone;
|
||||||
@Configuration
|
@Configuration
|
||||||
public class WebMvcConfig implements WebMvcConfigurer {
|
public class WebMvcConfig implements WebMvcConfigurer {
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private IdentityInterceptor identityInterceptor;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addCorsMappings(CorsRegistry registry) {
|
public void addCorsMappings(CorsRegistry registry) {
|
||||||
registry.addMapping("/**")
|
registry.addMapping("/**")
|
||||||
|
|
|
@ -6,12 +6,13 @@ import io.renren.common.exception.RenException;
|
||||||
import io.renren.common.utils.IpUtils;
|
import io.renren.common.utils.IpUtils;
|
||||||
import io.renren.common.utils.Result;
|
import io.renren.common.utils.Result;
|
||||||
import io.renren.common.validator.AssertUtils;
|
import io.renren.common.validator.AssertUtils;
|
||||||
import io.renren.common.validator.ValidatorUtils;
|
|
||||||
import io.renren.modules.log.entity.SysLogLoginEntity;
|
import io.renren.modules.log.entity.SysLogLoginEntity;
|
||||||
import io.renren.modules.log.enums.LoginOperationEnum;
|
import io.renren.modules.log.enums.LoginOperationEnum;
|
||||||
import io.renren.modules.log.enums.LoginStatusEnum;
|
import io.renren.modules.log.enums.LoginStatusEnum;
|
||||||
import io.renren.modules.log.service.SysLogLoginService;
|
import io.renren.modules.log.service.SysLogLoginService;
|
||||||
import io.renren.modules.security.dto.LoginDTO;
|
import io.renren.modules.security.dto.LoginDTO;
|
||||||
|
import io.renren.modules.security.oauth2.Oauth2Filter;
|
||||||
|
import io.renren.modules.security.oauth2.YaWeiCookieManage;
|
||||||
import io.renren.modules.security.password.PasswordUtils;
|
import io.renren.modules.security.password.PasswordUtils;
|
||||||
import io.renren.modules.security.service.CaptchaService;
|
import io.renren.modules.security.service.CaptchaService;
|
||||||
import io.renren.modules.security.service.SysUserTokenService;
|
import io.renren.modules.security.service.SysUserTokenService;
|
||||||
|
@ -71,7 +72,7 @@ public class LoginController {
|
||||||
@ApiImplicitParam(name = "uuid", value = "UUID", paramType = "query",required = true, dataType="String"),
|
@ApiImplicitParam(name = "uuid", value = "UUID", paramType = "query",required = true, dataType="String"),
|
||||||
})
|
})
|
||||||
// public Result login(HttpServletRequest request, @RequestBody LoginDTO login) {
|
// public Result login(HttpServletRequest request, @RequestBody LoginDTO login) {
|
||||||
public Result login(HttpServletRequest request, @ApiIgnore @RequestParam Map<String, Object> params) {
|
public Result login(HttpServletRequest request, HttpServletResponse response, @ApiIgnore @RequestParam Map<String, Object> params) throws Exception {
|
||||||
|
|
||||||
LoginDTO login = new LoginDTO();
|
LoginDTO login = new LoginDTO();
|
||||||
login.setUsername(String.valueOf(params.get("username")));
|
login.setUsername(String.valueOf(params.get("username")));
|
||||||
|
@ -132,16 +133,21 @@ public class LoginController {
|
||||||
log.setCreatorName(user.getUsername());
|
log.setCreatorName(user.getUsername());
|
||||||
sysLogLoginService.save(log);
|
sysLogLoginService.save(log);
|
||||||
|
|
||||||
return sysUserTokenService.createToken(user.getId());
|
Result<Map> token = sysUserTokenService.createToken(user.getId());
|
||||||
|
request.setAttribute(Constant.TOKEN_HEADER, token.getData().get(Constant.TOKEN_HEADER));
|
||||||
|
new Oauth2Filter().login(request, response);
|
||||||
|
return token;
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("logout")
|
@PostMapping("logout")
|
||||||
@ApiOperation(value = "退出")
|
@ApiOperation(value = "退出")
|
||||||
public Result logout(HttpServletRequest request) {
|
public Result logout(HttpServletRequest request, HttpServletResponse response) {
|
||||||
UserDetail user = SecurityUser.getUser();
|
UserDetail user = SecurityUser.getUser();
|
||||||
|
|
||||||
//退出
|
//退出
|
||||||
sysUserTokenService.logout(user.getId());
|
sysUserTokenService.logout(user.getId());
|
||||||
|
//清理亚威登录状态
|
||||||
|
YaWeiCookieManage.clearnTicket(request, response);
|
||||||
|
|
||||||
//用户信息
|
//用户信息
|
||||||
SysLogLoginEntity log = new SysLogLoginEntity();
|
SysLogLoginEntity log = new SysLogLoginEntity();
|
||||||
|
|
|
@ -1,14 +1,19 @@
|
||||||
package io.renren.modules.security.oauth2;
|
package io.renren.modules.security.oauth2;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.yawei.pso.PSORequest;
|
import com.yawei.pso.PSORequest;
|
||||||
import com.yawei.pso.SSOResponse;
|
import com.yawei.pso.SSOResponse;
|
||||||
import com.yawei.pso.TicketManager;
|
import com.yawei.pso.TicketManager;
|
||||||
import io.renren.common.constant.Constant;
|
import io.renren.common.constant.Constant;
|
||||||
import io.renren.common.interceptor.Validator;
|
|
||||||
import io.renren.common.interceptor.YaweiSSOProperties;
|
import io.renren.common.interceptor.YaweiSSOProperties;
|
||||||
import io.renren.common.utils.HttpContextUtils;
|
import io.renren.common.utils.HttpContextUtils;
|
||||||
import io.renren.common.utils.Result;
|
import io.renren.common.utils.Result;
|
||||||
|
import io.renren.modules.security.service.SysUserTokenService;
|
||||||
|
import io.renren.modules.security.user.SecurityUser;
|
||||||
|
import io.renren.modules.sys.dao.SysUserDao;
|
||||||
|
import io.renren.modules.sys.entity.SysUserEntity;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.apache.http.HttpStatus;
|
import org.apache.http.HttpStatus;
|
||||||
import org.apache.shiro.authc.AuthenticationException;
|
import org.apache.shiro.authc.AuthenticationException;
|
||||||
|
@ -17,30 +22,34 @@ import org.apache.shiro.web.filter.authc.AuthenticatingFilter;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.web.bind.annotation.RequestMethod;
|
|
||||||
|
|
||||||
import javax.servlet.ServletRequest;
|
import javax.servlet.ServletRequest;
|
||||||
import javax.servlet.ServletResponse;
|
import javax.servlet.ServletResponse;
|
||||||
|
import javax.servlet.http.Cookie;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* oauth2过滤器
|
* oauth2过滤器
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
@Component()
|
@Component()
|
||||||
@Scope("prototype")
|
@Scope("prototype")
|
||||||
public class Oauth2Filter extends AuthenticatingFilter {
|
public class Oauth2Filter extends AuthenticatingFilter {
|
||||||
|
|
||||||
public final static String SEESION_USER = "seesion_user";
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private YaweiSSOProperties yaweiSSOProperties;
|
private YaweiSSOProperties yaweiSSOProperties;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SysUserTokenService sysUserTokenService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SysUserDao sysUserDao;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected AuthenticationToken createToken(ServletRequest request, ServletResponse response) throws Exception {
|
protected AuthenticationToken createToken(ServletRequest request, ServletResponse response) throws Exception {
|
||||||
//获取请求token
|
//获取请求token
|
||||||
|
@ -55,52 +64,84 @@ public class Oauth2Filter extends AuthenticatingFilter {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean isAccessAllowed(ServletRequest request, ServletResponse response, Object mappedValue) {
|
protected boolean isAccessAllowed(ServletRequest request, ServletResponse response, Object mappedValue) {
|
||||||
if (((HttpServletRequest) request).getMethod().equals(RequestMethod.OPTIONS.name())) {
|
// if(((HttpServletRequest) request).getMethod().equals(RequestMethod.OPTIONS.name())){
|
||||||
return true;
|
// return true;
|
||||||
}
|
// }
|
||||||
|
String currentToken = getRequestToken((HttpServletRequest) request);
|
||||||
|
if (StringUtils.isBlank(currentToken) || SecurityUser.getUser().getUsername() == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
//亚威没有测试环境,不验证他了
|
||||||
|
// if (currentToken == null || !(new TicketManager().LoadTicket((HttpServletRequest) request)))
|
||||||
|
// return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean onAccessDenied(ServletRequest request, ServletResponse response) throws Exception {
|
protected boolean onAccessDenied(ServletRequest request, ServletResponse response) throws Exception {
|
||||||
|
|
||||||
|
boolean yaweiHandle = yaweiHandle((HttpServletRequest) request, (HttpServletResponse) response);
|
||||||
|
if (yaweiHandle){
|
||||||
|
//处理成功肯定从cookie或写cookie拿到了认证信息
|
||||||
|
//亚威认证通过,为自己添加上token
|
||||||
|
TicketManager tm = new TicketManager();
|
||||||
|
String currentUser = null;
|
||||||
|
if (tm.LoadTicket((HttpServletRequest) request)) {
|
||||||
|
currentUser = tm.getUserID();
|
||||||
|
}else {
|
||||||
|
currentUser = getYaweiUserIdCookieInResponse((HttpServletResponse) response);
|
||||||
|
currentUser = tm.DecData(currentUser);
|
||||||
|
}
|
||||||
|
|
||||||
//获取请求token,如果token不存在,直接返回401
|
if (currentUser != null ) {
|
||||||
String token = getRequestToken((HttpServletRequest) request);
|
LambdaQueryWrapper<SysUserEntity> queryWrapper = new QueryWrapper<SysUserEntity>().lambda()
|
||||||
if (StringUtils.isBlank(token)) {
|
.eq(SysUserEntity::getUsername, currentUser);
|
||||||
|
SysUserEntity sysUserEntity = sysUserDao.selectOne(queryWrapper);
|
||||||
|
if (sysUserEntity != null) {
|
||||||
|
String currentToken = getRequestToken((HttpServletRequest) request);
|
||||||
|
HttpServletResponse httpresponse = (HttpServletResponse)response;
|
||||||
|
if (StringUtils.isBlank(currentToken)){
|
||||||
|
Result<Map> result = sysUserTokenService.createToken(sysUserEntity.getId());
|
||||||
|
Object token = result.getData().get(Constant.TOKEN_HEADER);
|
||||||
|
currentToken = (String) token;
|
||||||
|
Cookie cookie = new Cookie(Constant.TOKEN_HEADER, currentToken);
|
||||||
|
cookie.setPath("/");
|
||||||
|
httpresponse.addCookie(cookie);
|
||||||
|
httpresponse.addHeader(Constant.TOKEN_HEADER, currentToken);
|
||||||
|
httpresponse.addHeader("REDIRECT", ((HttpServletRequest) request).getHeader("REQUESTURI"));
|
||||||
|
}
|
||||||
|
|
||||||
yaweiHandle((HttpServletRequest) request, (HttpServletResponse) response);
|
request.setAttribute(Constant.TOKEN_HEADER, currentToken);
|
||||||
|
// return executeLogin(request, response);
|
||||||
|
boolean success = executeLogin(request, response);
|
||||||
|
return success;
|
||||||
|
}else {
|
||||||
|
send401Error((HttpServletResponse) response, "未找到用户");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// HttpServletResponse httpResponse = (HttpServletResponse) response;
|
}
|
||||||
// httpResponse.setContentType("application/json;charset=utf-8");
|
|
||||||
// httpResponse.setHeader("Access-Control-Allow-Credentials", "true");
|
send401Error((HttpServletResponse) response, "登录失败");
|
||||||
// httpResponse.setHeader("Access-Control-Allow-Origin", HttpContextUtils.getOrigin());
|
|
||||||
//
|
|
||||||
// String json = new Gson().toJson(new Result().error(ErrorCode.UNAUTHORIZED));
|
|
||||||
//
|
|
||||||
// httpResponse.getWriter().print(json);
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean executeLogin = executeLogin(request, response);
|
private String getYaweiUserIdCookieInResponse(HttpServletResponse response){
|
||||||
return executeLogin;
|
String userIdKey = "UserID=";
|
||||||
|
for (String header : response.getHeaders("set-cookie")) {
|
||||||
|
if (header.startsWith(userIdKey)) return header.substring(userIdKey.length());
|
||||||
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean onLoginFailure(AuthenticationToken token, AuthenticationException e, ServletRequest request, ServletResponse response) {
|
protected boolean onLoginFailure(AuthenticationToken token, AuthenticationException e, ServletRequest request, ServletResponse response) {
|
||||||
HttpServletResponse httpResponse = (HttpServletResponse) response;
|
|
||||||
httpResponse.setContentType("application/json;charset=utf-8");
|
|
||||||
httpResponse.setHeader("Access-Control-Allow-Credentials", "true");
|
|
||||||
httpResponse.setHeader("Access-Control-Allow-Origin", HttpContextUtils.getOrigin());
|
|
||||||
try {
|
try {
|
||||||
//处理登录失败的异常
|
//处理登录失败的异常
|
||||||
Throwable throwable = e.getCause() == null ? e : e.getCause();
|
send401Error((HttpServletResponse) response, e.getMessage());
|
||||||
Result r = new Result().error(HttpStatus.SC_UNAUTHORIZED, throwable.getMessage());
|
|
||||||
|
|
||||||
String json = new Gson().toJson(r);
|
|
||||||
httpResponse.getWriter().print(json);
|
|
||||||
} catch (IOException e1) {
|
} catch (IOException e1) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -108,6 +149,21 @@ public class Oauth2Filter extends AuthenticatingFilter {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void send401Error(HttpServletResponse response, String msg) throws IOException {
|
||||||
|
response.setContentType("application/json;charset=utf-8");
|
||||||
|
response.setHeader("Access-Control-Allow-Credentials", "true");
|
||||||
|
response.setHeader("Access-Control-Allow-Origin", HttpContextUtils.getOrigin());
|
||||||
|
response.setStatus(HttpStatus.SC_UNAUTHORIZED);
|
||||||
|
Result r = new Result().error(HttpStatus.SC_UNAUTHORIZED, msg);
|
||||||
|
|
||||||
|
String json = new Gson().toJson(r);
|
||||||
|
response.getOutputStream().print(json);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean login(HttpServletRequest request, HttpServletResponse response) throws Exception {
|
||||||
|
return executeLogin(request, response);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取请求的token
|
* 获取请求的token
|
||||||
*/
|
*/
|
||||||
|
@ -115,27 +171,76 @@ public class Oauth2Filter extends AuthenticatingFilter {
|
||||||
//从header中获取token
|
//从header中获取token
|
||||||
String token = httpRequest.getHeader(Constant.TOKEN_HEADER);
|
String token = httpRequest.getHeader(Constant.TOKEN_HEADER);
|
||||||
|
|
||||||
|
if(StringUtils.isBlank(token)){
|
||||||
|
token = (String) httpRequest.getAttribute(Constant.TOKEN_HEADER);
|
||||||
|
}
|
||||||
|
|
||||||
//如果header中不存在token,则从参数中获取token
|
//如果header中不存在token,则从参数中获取token
|
||||||
if(StringUtils.isBlank(token)){
|
if(StringUtils.isBlank(token)){
|
||||||
token = httpRequest.getParameter(Constant.TOKEN_HEADER);
|
token = httpRequest.getParameter(Constant.TOKEN_HEADER);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if(StringUtils.isBlank(token)){
|
||||||
|
Cookie[] cookies = httpRequest.getCookies();
|
||||||
|
if (cookies != null){
|
||||||
|
for (Cookie cookie : cookies) {
|
||||||
|
if (Constant.TOKEN_HEADER.equalsIgnoreCase(cookie.getName())) {
|
||||||
|
token = cookie.getValue();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
return token;
|
return token;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean yaweiHandle(HttpServletRequest request, HttpServletResponse response) throws Exception {
|
private boolean yaweiHandle(HttpServletRequest request, HttpServletResponse response) throws Exception {
|
||||||
// 获取当前请求的url
|
// 获取当前请求的url
|
||||||
String requestUri = request.getHeader("REQUESTURI");
|
String requestUri = request.getHeader("REQUESTURI");
|
||||||
if (requestUri == null){
|
if (requestUri == null){
|
||||||
requestUri = request.getRequestURI();
|
requestUri = request.getRequestURI();
|
||||||
}
|
}
|
||||||
|
|
||||||
Validator validator = Validator.getInstance();
|
|
||||||
|
|
||||||
String strResponse = request.getParameter(yaweiSSOProperties.getSsoKey());
|
String strResponse = request.getParameter(yaweiSSOProperties.getSsoKey());
|
||||||
|
|
||||||
|
if (strResponse == null && requestUri != null && requestUri.indexOf(yaweiSSOProperties.getSsoKey()) > 0) {
|
||||||
|
String ssoMatchKey = yaweiSSOProperties.getSsoKey() + "=";
|
||||||
|
int startIndex = requestUri.indexOf(ssoMatchKey) + ssoMatchKey.length();
|
||||||
|
int indexOf = requestUri.indexOf("&", startIndex);
|
||||||
|
|
||||||
|
strResponse = indexOf > 0 ? requestUri.substring(startIndex, indexOf) : requestUri.substring(startIndex);
|
||||||
|
}
|
||||||
if (org.apache.commons.lang.StringUtils.isEmpty(strResponse)) {
|
if (org.apache.commons.lang.StringUtils.isEmpty(strResponse)) {
|
||||||
TicketManager tm = new TicketManager();
|
TicketManager tm = new TicketManager();
|
||||||
if (!tm.LoadTicket(request)) {
|
if (!tm.LoadTicket(request)) {
|
||||||
|
redirectToYaweiLogin(request, response);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 如果服务器端通过认证后,会返回后执行改操作,然后写入cookie
|
||||||
|
SSOResponse ssoResp = new SSOResponse(strResponse);
|
||||||
|
TicketManager tm = ssoResp.CreatePSOTicket();
|
||||||
|
if (tm == null) {
|
||||||
|
redirectToYaweiLogin(request, response);
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
// String domainName = yaweiSSOProperties.getDomain();
|
||||||
|
// tm.SaveTicket(response, domainName);
|
||||||
|
YaWeiCookieManage.saveTicket(response, tm);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void redirectToYaweiLogin(HttpServletRequest request, HttpServletResponse response) throws IOException, IllegalAccessException, NoSuchFieldException {
|
||||||
|
String requestUri = request.getHeader("REQUESTURI");
|
||||||
|
if (requestUri == null){
|
||||||
|
requestUri = request.getRequestURI();
|
||||||
|
}
|
||||||
PSORequest psoRequest = new PSORequest(request);
|
PSORequest psoRequest = new PSORequest(request);
|
||||||
//不建新类了,直接反射解决
|
//不建新类了,直接反射解决
|
||||||
Field returnUrl = psoRequest.getClass().getDeclaredField("returnUrl");
|
Field returnUrl = psoRequest.getClass().getDeclaredField("returnUrl");
|
||||||
|
@ -148,60 +253,7 @@ public class Oauth2Filter extends AuthenticatingFilter {
|
||||||
+ URLEncoder.encode(requeststr, "UTF-8");
|
+ URLEncoder.encode(requeststr, "UTF-8");
|
||||||
response.addHeader("REDIRECT", keeperUrl);
|
response.addHeader("REDIRECT", keeperUrl);
|
||||||
response.setStatus(HttpStatus.SC_UNAUTHORIZED);
|
response.setStatus(HttpStatus.SC_UNAUTHORIZED);
|
||||||
response.getWriter().write(HttpStatus.SC_UNAUTHORIZED);
|
response.getOutputStream().write(HttpStatus.SC_UNAUTHORIZED);
|
||||||
return false;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// 如果服务器端通过认证后,会返回后执行改操作,然后写入cookie
|
|
||||||
SSOResponse ssoResp = new SSOResponse(strResponse);
|
|
||||||
TicketManager tm = ssoResp.CreatePSOTicket();
|
|
||||||
if (tm == null) {
|
|
||||||
PSORequest psoRequest = new PSORequest(request);
|
|
||||||
String requeststr = psoRequest.CreateHash();
|
|
||||||
|
|
||||||
String keeperUrl = yaweiSSOProperties.getKeeperUrl();
|
|
||||||
keeperUrl = keeperUrl + "?" + yaweiSSOProperties.getSsoKey() + "="
|
|
||||||
+ URLEncoder.encode(requeststr, "UTF-8");
|
|
||||||
response.sendRedirect(keeperUrl);
|
|
||||||
} else {
|
|
||||||
String domainName = yaweiSSOProperties.getDomain();
|
|
||||||
tm.SaveTicket(response, domainName);
|
|
||||||
|
|
||||||
//同时添加自己的token
|
|
||||||
// Cookie cookie = new Cookie(Constant.TOKEN_HEADER, createToken(request, response).toString());
|
|
||||||
// response.addCookie(cookie);
|
|
||||||
|
|
||||||
Iterator<Map.Entry<String, String[]>> iterator = request
|
|
||||||
.getParameterMap().entrySet().iterator();
|
|
||||||
StringBuffer param = new StringBuffer();
|
|
||||||
int i = 0;
|
|
||||||
while (iterator.hasNext()) {
|
|
||||||
Map.Entry<String, String[]> entry = (Map.Entry<String, String[]>) iterator
|
|
||||||
.next();
|
|
||||||
if (entry.getKey().equals(yaweiSSOProperties.getSsoKey()))
|
|
||||||
continue;
|
|
||||||
else {
|
|
||||||
i++;
|
|
||||||
if (i == 1)
|
|
||||||
param.append("?").append(entry.getKey())
|
|
||||||
.append("=");
|
|
||||||
else
|
|
||||||
param.append("&").append(entry.getKey())
|
|
||||||
.append("=");
|
|
||||||
|
|
||||||
if (entry.getValue() instanceof String[]) {
|
|
||||||
param.append(((String[]) entry.getValue())[0]);
|
|
||||||
} else {
|
|
||||||
param.append(entry.getValue());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
response.sendRedirect(requestUri + param.toString());
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
validator.SetUserTicket(request);
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,48 @@
|
||||||
|
package io.renren.modules.security.oauth2;
|
||||||
|
|
||||||
|
import com.yawei.pso.TicketManager;
|
||||||
|
|
||||||
|
import javax.servlet.http.Cookie;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.HashSet;
|
||||||
|
|
||||||
|
public class YaWeiCookieManage {
|
||||||
|
|
||||||
|
public final static HashSet<String> yaweCookieNames = new HashSet();
|
||||||
|
static {
|
||||||
|
String[] names = {"UserID","UserPass","ADGuid","UserName","TicketData","CreateDate","OrigGUID","OrigName"};
|
||||||
|
Collections.addAll(yaweCookieNames, names);
|
||||||
|
}
|
||||||
|
public static void saveTicket(HttpServletResponse response, TicketManager ticketManager){
|
||||||
|
|
||||||
|
for (String cookieName : yaweCookieNames) {
|
||||||
|
try {
|
||||||
|
Field declaredField = ticketManager.getClass().getDeclaredField(cookieName);
|
||||||
|
declaredField.setAccessible(true);
|
||||||
|
Cookie cookie = new Cookie(cookieName, (String) declaredField.get(ticketManager));
|
||||||
|
cookie.setPath("/");
|
||||||
|
response.addCookie(cookie);
|
||||||
|
} catch (Exception e) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void clearnTicket(HttpServletRequest request, HttpServletResponse response){
|
||||||
|
|
||||||
|
for (Cookie cookie : request.getCookies()) {
|
||||||
|
if (yaweCookieNames.contains(cookie.getName())){
|
||||||
|
cookie.setPath("/");
|
||||||
|
cookie.setMaxAge(0);
|
||||||
|
response.addCookie(cookie);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -55,6 +55,7 @@ spring:
|
||||||
#上传的静态资源配置
|
#上传的静态资源配置
|
||||||
resource:
|
resource:
|
||||||
root_url: 15.2.21.238
|
root_url: 15.2.21.238
|
||||||
|
pic-host: http://${resource.root_url}:${server.port}${server.servlet.context-path}
|
||||||
path: /home/yth/files/
|
path: /home/yth/files/
|
||||||
devModelFilePath: /home/yth/files/devModelFile
|
devModelFilePath: /home/yth/files/devModelFile
|
||||||
# 大数据部门相关配置
|
# 大数据部门相关配置
|
||||||
|
|
|
@ -37,6 +37,7 @@ spring:
|
||||||
#上传的静态资源配置
|
#上传的静态资源配置
|
||||||
resource:
|
resource:
|
||||||
root_url: 15.2.21.238
|
root_url: 15.2.21.238
|
||||||
|
pic-host: http://${resource.root_url}:${server.port}${server.servlet.context-path}
|
||||||
path: /data/services/nengli/files/
|
path: /data/services/nengli/files/
|
||||||
devModelFilePath: /data/services/nengli/files/devModelFile
|
devModelFilePath: /data/services/nengli/files/devModelFile
|
||||||
# 大数据部门相关配置
|
# 大数据部门相关配置
|
||||||
|
@ -56,3 +57,6 @@ logging:
|
||||||
impl:
|
impl:
|
||||||
persistence:
|
persistence:
|
||||||
entity: debug
|
entity: debug
|
||||||
|
mybatis-plus:
|
||||||
|
configuration:
|
||||||
|
# log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
|
@ -37,6 +37,7 @@ spring:
|
||||||
#上传的静态资源配置
|
#上传的静态资源配置
|
||||||
resource:
|
resource:
|
||||||
root_url: 15.72.183.90
|
root_url: 15.72.183.90
|
||||||
|
pic-host: http://${resource.root_url}:${server.port}${server.servlet.context-path}
|
||||||
path: /data/services/nengli/files/
|
path: /data/services/nengli/files/
|
||||||
devModelFilePath: /data/services/nengli/files/devModelFile
|
devModelFilePath: /data/services/nengli/files/devModelFile
|
||||||
# 大数据部门相关配置
|
# 大数据部门相关配置
|
||||||
|
@ -46,4 +47,4 @@ big_date:
|
||||||
|
|
||||||
hisense:
|
hisense:
|
||||||
gateway:
|
gateway:
|
||||||
url: http://devtest-security-app.hismarttv.com:8080
|
url: http://15.72.184.7:8080
|
|
@ -0,0 +1,33 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ehcache updateCheck="false" name="defaultCache">
|
||||||
|
<!-- 磁盘缓存位置 -->
|
||||||
|
<diskStore path="java.io.tmpdir/ehcache"/>
|
||||||
|
<!--
|
||||||
|
maxEntriesLocalHeap:堆内存中最大缓存对象数
|
||||||
|
eternal:对象是否永久有效,一但设置了,timeout将不起作用
|
||||||
|
overflowToDisk:当缓存达到maxElementsInMemory值是,是否允许溢出到磁盘
|
||||||
|
timeToIdleSeconds:当缓存闲置n秒后销毁
|
||||||
|
timeToLiveSeconds:当缓存存活n秒后销毁
|
||||||
|
maxEntriesLocalDisk:硬盘最大缓存个数
|
||||||
|
diskPersistent:磁盘缓存在JVM重新启动时是否保持
|
||||||
|
-->
|
||||||
|
<!-- 默认缓存 -->
|
||||||
|
<defaultCache
|
||||||
|
maxEntriesLocalHeap="10000"
|
||||||
|
eternal="false"
|
||||||
|
timeToIdleSeconds="600"
|
||||||
|
timeToLiveSeconds="600"
|
||||||
|
maxEntriesLocalDisk="10000000"
|
||||||
|
diskExpiryThreadIntervalSeconds="120"
|
||||||
|
memoryStoreEvictionPolicy="LRU"/>
|
||||||
|
|
||||||
|
<!-- fill-in缓存 -->
|
||||||
|
<cache name="fillIn"
|
||||||
|
maxElementsInMemory="10000"
|
||||||
|
eternal="false"
|
||||||
|
timeToIdleSeconds="600"
|
||||||
|
timeToLiveSeconds="600"
|
||||||
|
overflowToDisk="false"
|
||||||
|
memoryStoreEvictionPolicy="LRU"/>
|
||||||
|
|
||||||
|
</ehcache>
|
|
@ -0,0 +1,19 @@
|
||||||
|
<?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.monitor.mapper.BuildingRecordsMapper">
|
||||||
|
|
||||||
|
<insert id="batchSave" parameterType="java.util.List">
|
||||||
|
insert into t_building_records
|
||||||
|
(
|
||||||
|
project_name,build_license,push_time,appid,pm10,noice
|
||||||
|
)
|
||||||
|
values
|
||||||
|
<foreach collection="list" item="item" index="index" separator=",">
|
||||||
|
(
|
||||||
|
#{item.projectName},#{item.buildLicense},#{item.pushTime},#{item.appid},
|
||||||
|
#{item.pm10},#{item.noice}
|
||||||
|
)
|
||||||
|
</foreach>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
</mapper>
|
|
@ -0,0 +1,35 @@
|
||||||
|
<?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.monitor.mapper.CameraChannelMapper">
|
||||||
|
<!-- <update id="updateState" parameterType="java.util.List">-->
|
||||||
|
<!-- <foreach collection="list" item="item" index="index" open="begin" close=";end;" separator=";">-->
|
||||||
|
<!-- update CameraChannel set state =#{item.estAmount,jdbcType=NUMERIC}-->
|
||||||
|
<!-- where t.licai_id = #{item.licaiId,jdbcType=NUMERIC}-->
|
||||||
|
<!-- </foreach>-->
|
||||||
|
|
||||||
|
<!-- </update>-->
|
||||||
|
|
||||||
|
<select id="selectAll" resultType="io.renren.modules.monitor.dto.CameraChannelDto">
|
||||||
|
select c.* from t_camera_channel c
|
||||||
|
where (c.gps_x NOT IN('0.0','0','','-1000.0') OR c.gps_y NOT IN('0.0','0','','-1000.0'))
|
||||||
|
AND c.status != 0 AND c.check_status != 0
|
||||||
|
<!-- <bind name="page" value="(page-1)*pageSize"/>-->
|
||||||
|
<!-- limit #{page},#{pageSize}-->
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<update id="updateCameraStatus" parameterType="java.util.List">
|
||||||
|
<foreach collection="list" item="item" index="index" separator=";">
|
||||||
|
update t_camera_channel set check_status = 0
|
||||||
|
where channel_code = #{item,jdbcType=VARCHAR}
|
||||||
|
</foreach>
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<select id="selectNLAll" resultType="io.renren.modules.monitor.dto.CameraChannelNLDto">
|
||||||
|
SELECT a.label_name,d.* from t_label a RIGHT JOIN (select b.label_code,c.* from t_camera_channel c
|
||||||
|
LEFT JOIN t_channel_mtm_label b on c.channel_code = b.channel_code) d
|
||||||
|
on d.label_code = a.label_code
|
||||||
|
<bind name="page" value="(page-1)*pageSize"/>
|
||||||
|
limit #{page},#{pageSize}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</mapper>
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?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.monitor.mapper.CameraOrgenizationMapper">
|
||||||
|
|
||||||
|
</mapper>
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?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.monitor.mapper.CameraScenicMapper">
|
||||||
|
|
||||||
|
</mapper>
|
|
@ -0,0 +1,38 @@
|
||||||
|
<?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.monitor.mapper.CaseCityLawMapper">
|
||||||
|
|
||||||
|
<insert id="batchSave" parameterType="java.util.List">
|
||||||
|
INSERT INTO t_case_citylaw
|
||||||
|
(id,ajjlsj,dzms,wtms,wtlybs,wtlymc,ajlxbs,ajlxmc,dlbs,dlmc,xlbs,xlmc,qbs,qmc,jdbs,
|
||||||
|
jdmc,sqbs,sqmc,xzb,yzb,pqsj,ajjssj,ajzfsj,czsxcqjaaqjacqwjayqja,sbtpsl,cztpsl
|
||||||
|
)
|
||||||
|
VALUES
|
||||||
|
<foreach collection="list" item="item" separator="," >
|
||||||
|
(
|
||||||
|
#{item.id},#{item.AJJLSJ},#{item.DZMS},#{item.WTMS},#{item.WTLYBS},#{item.WTLYMC},
|
||||||
|
#{item.AJLXBS},#{item.AJLXMC},#{item.DLBS},#{item.DLMC},#{item.XLBS},
|
||||||
|
#{item.XLMC},#{item.QBS},#{item.QMC},#{item.JDBS},#{item.JDMC},#{item.SQBS},
|
||||||
|
#{item.SQMC},#{item.XZB},#{item.YZB},#{item.PQSJ},#{item.AJJSSJ},#{item.AJZFSJ},
|
||||||
|
#{item.CZSXCQJAAQJACQWJAYQJA},#{item.SBTPSL},#{item.CZTPSL}
|
||||||
|
)
|
||||||
|
</foreach>
|
||||||
|
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<insert id="singleSave" parameterType="java.util.Map">
|
||||||
|
INSERT INTO t_case_citylaw
|
||||||
|
(id,ajjlsj,dzms,wtms,wtlybs,wtlymc,ajlxbs,ajlxmc,dlbs,dlmc,xlbs,xlmc,qbs,qmc,jdbs,
|
||||||
|
jdmc,sqbs,sqmc,xzb,yzb,pqsj,ajjssj,ajzfsj,czsxcqjaaqjacqwjayqja,sbtpsl,cztpsl
|
||||||
|
)
|
||||||
|
VALUES
|
||||||
|
(
|
||||||
|
#{id},#{AJJLSJ},#{DZMS},#{WTMS},#{WTLYBS},#{WTLYMC},
|
||||||
|
#{AJLXBS},#{AJLXMC},#{DLBS},#{DLMC},#{XLBS},
|
||||||
|
#{XLMC},#{QBS},#{QMC},#{JDBS},#{JDMC},#{SQBS},
|
||||||
|
#{SQMC},#{XZB},#{YZB},#{PQSJ},#{AJJSSJ},#{AJZFSJ},
|
||||||
|
#{itCZSXCQJAAQJACQWJAYQJA},#{SBTPSL},#{CZTPSL}
|
||||||
|
)
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
</mapper>
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?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.monitor.mapper.ChannelPictureMapper">
|
||||||
|
|
||||||
|
</mapper>
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?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.monitor.mapper.EventMapper">
|
||||||
|
|
||||||
|
</mapper>
|
|
@ -0,0 +1,21 @@
|
||||||
|
<?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.monitor.mapper.PassengerFlowlMapper">
|
||||||
|
|
||||||
|
<insert id="batchSave" parameterType="java.util.List">
|
||||||
|
INSERT INTO t_passenger_flow
|
||||||
|
(hour_id,time_id,longitude,latitude,all_nums,local_nums,nonlocal_nums)
|
||||||
|
VALUES
|
||||||
|
<foreach collection="list" item="item" separator="," >
|
||||||
|
(
|
||||||
|
#{item.hour_id},#{item.time_id},#{item.longitude},#{item.latitude},#{item.all_nums},
|
||||||
|
#{item.local_nums},#{item.nonlocal_nums}
|
||||||
|
)
|
||||||
|
</foreach>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<select id="getByMaxId" resultType="io.renren.modules.monitor.entity.PassengerFlow">
|
||||||
|
select * from t_passenger_flow ORDer by id desc limit 1
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</mapper>
|
|
@ -0,0 +1,19 @@
|
||||||
|
<?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.monitor.mapper.RoadDataMapper">
|
||||||
|
|
||||||
|
<insert id="batchSave" parameterType="java.util.List">
|
||||||
|
INSERT INTO t_road_data
|
||||||
|
(region_name,street_name,road_name,start,end,lng,lat,pm10,pm25,desc_pm10_rank,asc_pm10_rank,
|
||||||
|
desc_pm25_rank,asc_pm25_rank,points)
|
||||||
|
VALUES
|
||||||
|
<foreach collection="list" item="item" separator="," >
|
||||||
|
(
|
||||||
|
#{item.regionName},#{item.streetName},#{item.roadName},#{item.start},#{item.end},
|
||||||
|
#{item.lng},#{item.lat},#{item.pm10},#{item.pm25},#{item.desc_pm10_rank},
|
||||||
|
#{item.asc_pm10_rank},#{item.desc_pm25_rank},#{item.asc_pm25_rank},#{item.points}
|
||||||
|
)
|
||||||
|
</foreach>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
</mapper>
|
|
@ -0,0 +1,53 @@
|
||||||
|
<?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.monitor.mapper.SanitationMapper">
|
||||||
|
<insert id="batchSave" parameterType="java.util.List">
|
||||||
|
insert into t_sanitation_info
|
||||||
|
(cph,jsy,gmri,cllx,ssqybh,sshwgsbh,bz,sfkh,clbh,ds,sfjzgpsblrsjgpt,jj,
|
||||||
|
clxh,cldl,sfjs,sfss,sfcx
|
||||||
|
)
|
||||||
|
values
|
||||||
|
<foreach collection="list" item="item" separator=",">
|
||||||
|
(
|
||||||
|
#{item.cph},#{item.cph},#{item.cph},#{item.cph},#{item.cph},#{item.cph},
|
||||||
|
#{item.cph},#{item.cph},#{item.cph},#{item.cph},#{item.cph},#{item.cph}
|
||||||
|
)
|
||||||
|
</foreach>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<insert id="batchSaveSanitationRoad" parameterType="java.util.List">
|
||||||
|
insert into t_sanitation_road
|
||||||
|
(bh,dlmc,qdlkdlmc,zdlkdlmc,zcgdlxzc,bjdj,dlzd,dlkd,dlzmj,cxdmj,rxdmj,jsmj,ssmj,
|
||||||
|
gycxmj,bjysl,gpxsl,ssqybh,ssjdbsc,sshwgsbh,zbjh,sfqy,bh1,dtdlhzkd,
|
||||||
|
zcgd,jsqz,cxqz,jj,tplj,zbdfxbz0zx1fx,fxzbxxid,ys,btmx,jsts,jspc,
|
||||||
|
sfjs0bjs1js,sfss0bss1ss,sfcx0bcx1cx,sspc,cxpc,ssts,cxts,sfkh
|
||||||
|
)
|
||||||
|
values
|
||||||
|
<foreach collection="list" item="item" separator=",">
|
||||||
|
(
|
||||||
|
#{item.BH},#{item.DLMC},#{item.QDLKDLMC},#{item.ZDLKDLMC},#{item.ZCGDLXZC},#{item.BJDJ},#{item.DLZD},
|
||||||
|
#{item.DLKD},#{item.DLZMJ},#{item.CXDMJ},#{item.RXDMJ},#{item.JSMJ},#{item.SSMJ},
|
||||||
|
#{item.GYCXMJ},#{item.BJYSL},#{item.GPXSL},#{item.SSQYBH},#{item.SSJDBSC},#{item.SSHWGSBH},
|
||||||
|
#{item.ZBJH},#{item.SFQY},#{item.BH1},#{item.DTDLHZKD},#{item.ZCGD},#{item.JSQZ},
|
||||||
|
#{item.CXQZ},#{item.JJ},#{item.TPLJ},#{item.ZBDFXBZ0ZX1FX},#{item.FXZBXXID},#{item.YS},
|
||||||
|
#{item.BTMX},#{item.JSTS},#{item.JSPC},#{item.SFJS0BJS1JS},#{item.SFSS0BSS1SS},#{item.SFCX0BCX1CX},
|
||||||
|
#{item.SSPC},#{item.CXPC},#{item.SSTS},#{item.CXTS},#{item.SFKH}
|
||||||
|
)
|
||||||
|
</foreach>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<insert id="batchSaveSanitationTask" parameterType="java.util.List">
|
||||||
|
insert into t_sanitation_task
|
||||||
|
(dlmc,ksdl,zzdl,ssqs,cph,zywcl,zyrq,zylx,zysj,zyts,zypc,zyzd,
|
||||||
|
zykd,zymj,wzyds,zycsds,zygpsds,updatetime
|
||||||
|
)
|
||||||
|
values
|
||||||
|
<foreach collection="list" item="item" separator=",">
|
||||||
|
(
|
||||||
|
#{item.DLMC},#{item.KSDL},#{item.ZZDL},#{item.SSQS},#{item.CPH},#{item.ZYWCL},
|
||||||
|
#{item.ZYRQ},#{item.ZYLX},#{item.ZYSJ},#{item.ZYTS},#{item.ZYPC},#{item.ZYZD},
|
||||||
|
#{item.ZYKD},#{item.ZYMJ},#{item.WZYDS},#{item.ZYCSDS},#{item.ZYGPSDS},#{item.updatetime}
|
||||||
|
)
|
||||||
|
</foreach>
|
||||||
|
</insert>
|
||||||
|
</mapper>
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue