Commit 1275ee93 authored by duanruiming's avatar duanruiming

Merge remote-tracking branch 'origin/master'

parents 2606fa8a 995045ea
package net.wanji.utc.hisense.cache;
import java.util.HashMap;
import java.util.Map;
/**
* 海信信号机特殊路口缓存
*
* @author Kent HAN
* @date 2023/7/6 15:43
*/
public class ComplexCrossCache {
private static final Map<String, Map<Integer, Integer>> cacheMap;
static {
cacheMap = new HashMap<>();
Map<Integer, Integer> innerMap1 = new HashMap<>();
innerMap1.put(2, 1);
innerMap1.put(6, 2);
innerMap1.put(14, 2);
innerMap1.put(15, 1);
cacheMap.put("13NI00B5RM0", innerMap1); // 旅游路与转山西路交叉口
}
public static Map<String, Map<Integer, Integer>> getCacheMap() {
return cacheMap;
}
}
......@@ -27,13 +27,13 @@ public enum PhaseLightColorEnum {
LIGHT_RED_YELLOW("6", "redYellow", "红黄灯");
private String dtLightColor;
private String hisenseLightColor;
private String wjLightColor;
private String message;
public static String getWjLightColor(String dtLightColor) {
public static String getWjLightColor(String hisenseLightColor) {
for (PhaseLightColorEnum value : PhaseLightColorEnum.values()) {
if (StringUtils.equals(dtLightColor, value.getDtLightColor())) {
if (StringUtils.equals(hisenseLightColor, value.getHisenseLightColor())) {
return value.getWjLightColor();
}
}
......
......@@ -3,6 +3,7 @@ package net.wanji.utc.hisense.service.controller.impl;
import net.wanji.databus.po.SignalStatusLogPO;
import net.wanji.databus.vo.LightsStatusVO;
import net.wanji.utc.hisense.cache.SignalDataCache;
import net.wanji.utc.hisense.cache.ComplexCrossCache;
import net.wanji.utc.hisense.common.enums.ControlModelEnum;
import net.wanji.utc.hisense.common.enums.PhaseLightColorEnum;
import net.wanji.utc.hisense.pojo.convert.RunningLightsStatusPojo;
......@@ -59,7 +60,18 @@ public class SignalStatusServiceImpl implements SignalStatusService {
Map<Integer, String> turnColorMap = new HashMap<>();
String lightsColor = String.valueOf(scs.get(i));
String wjLightColor = PhaseLightColorEnum.getWjLightColor(lightsColor);
Integer turn = CommonUtils.getTurnByLightsId(i);
Integer turn = null;
turn = CommonUtils.getTurnByLightsId(i);
// 复杂路口处理
Map<String, Map<Integer, Integer>> cacheMap = ComplexCrossCache.getCacheMap();
if (cacheMap.containsKey(crossId)) {
Map<Integer, Integer> innerMap = cacheMap.get(crossId);
if (innerMap.containsKey(i)) {
turn = innerMap.get(i);
}
}
turnColorMap.put(turn, wjLightColor);
String dir = String.valueOf(CommonUtils.getDirByLightsId(i));
if (dirLampGroupMap.isEmpty() || Objects.isNull(dirLampGroupMap.get(dir))) {
......
......@@ -5,25 +5,20 @@ spring:
datasource:
master:
type: com.alibaba.druid.pool.DruidDataSource
url: jdbc:mysql://106.120.201.126:14726/t_signal_utc_changsha?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&sessionVariables=sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'&useSSL=false&useCursorFetch=true
url: jdbc:mysql://localhost:3306/t_signal_utc_jinan?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&sessionVariables=sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'&useSSL=false&useCursorFetch=true
username: root
password: Wanji300552
password: d
driverClassName: com.mysql.cj.jdbc.Driver
slave:
type: com.alibaba.druid.pool.DruidDataSource
url: jdbc:mysql://106.120.201.126:14726/t_signal_utc_changsha?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&sessionVariables=sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'&useSSL=false&useCursorFetch=true
url: jdbc:mysql://localhost:3306/t_signal_utc_jinan?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&sessionVariables=sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'&useSSL=false&useCursorFetch=true
username: root
password: Wanji300552
password: d
driverClassName: com.mysql.cj.jdbc.Driver
webService:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://106.120.201.126:14726/t_signal?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&sessionVariables=sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'&useSSL=false&useCursorFetch=true
username: root
password: Wanji300552
type: com.alibaba.druid.pool.DruidDataSource
redis:
host: localhost
port: 6379
password: Wanji300552
jedis:
pool:
max-active: 200
......
......@@ -2,8 +2,8 @@ package net.wanji.utc.task;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.extern.slf4j.Slf4j;
import net.wanji.common.framework.rest.JsonViewObject;
import net.wanji.databus.dao.mapper.CrossInfoMapper;
......@@ -94,8 +94,10 @@ public class SignalStatusTask {
} else if (StringUtils.equals(BasicEnum.ManufacturerEnum.HISENSE.getCode(), manufacturerInfoPO.getCode())){
JsonViewObject jsonViewObject = utcHisenseFeignClients.lightStatus(crossId);
String content = (String) jsonViewObject.getContent();
lightsStatusVOS = JSON.parseObject(content, new TypeReference<List<LightsStatusVO>>() {});
ObjectMapper mapper = new ObjectMapper();
lightsStatusVOS = mapper.convertValue(jsonViewObject.getContent(),
new com.fasterxml.jackson.core.type.TypeReference<List<LightsStatusVO>>() {
});
}
long end = System.currentTimeMillis();
log.info("当前路口编号:{},海康返回灯态时间:{}ms", crossId, (end - start));
......
spring:
datasource:
dynamic:
primary: master
datasource:
master:
type: com.alibaba.druid.pool.DruidDataSource
url: jdbc:mysql://localhost:3306/t_signal_utc_jinan?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&sessionVariables=sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'&useSSL=false&useCursorFetch=true
username: root
password: d
driverClassName: com.mysql.cj.jdbc.Driver
slave:
type: com.alibaba.druid.pool.DruidDataSource
url: jdbc:mysql://localhost:3306/t_signal_utc_jinan?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&sessionVariables=sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'&useSSL=false&useCursorFetch=true
username: root
password: d
driverClassName: com.mysql.cj.jdbc.Driver
redis:
host: localhost
port: 6379
password: Wanji300552
jedis:
pool:
max-active: 200
max-wait: 5000
max-idle: 20
min-idle: 10
timeout: 5000
database: 5
mvc:
pathmatch:
matching-strategy: ant_path_matcher
main:
allow-circular-references: true
application:
name: utc
server:
port: 32000
servlet:
context-path: /utc
undertow:
url-charset: UTF-8
max-headers: -1
# 设置 HTTP POST 内容的最大长度,默认不做限制
# max-http-post-size: -1
max-http-post-size: 4MB
threads:
# 设置IO线程数, 它主要执行非阻塞的任务,它们会负责多个连接, 默认设置每个CPU核心一个线程
# 不要设置过大,如果过大,启动项目会报错:打开文件数过多
io: 8
# 阻塞任务线程池, 当执行类似servlet请求阻塞IO操作, undertow会从这个线程池中取得线程
# 它的值设置取决于系统线程执行任务的阻塞系数,默认值是IO线程数*8
worker: 256
# 以下的配置会影响buffer,这些buffer会用于服务器连接的IO操作,有点类似netty的池化内存管理
# 每块buffer的空间大小,越小的空间被利用越充分,不要设置太大,以免影响其他应用,合适即可
buffer-size: 1024
# 是否分配的直接内存(NIO直接分配的堆外内存)
direct-buffers: true
accesslog:
# 是否打开 undertow 日志,默认为 false
enabled: true
# 设置访问日志所在目录
dir: logs
mybatis-plus:
mapper-locations: classpath*:mapper/*.xml,classpath:mapper/*/*.xml
typeAliasesPackage: net.wanji.utc.entity
check-config-location: true
configuration:
#是否开启自动驼峰命名规则(camel case)映射
map-underscore-to-camel-case: true
#全局地开启或关闭配置文件中的所有映射器已经配置的任何缓存
cache-enabled: false
call-setters-on-nulls: true
#配置JdbcTypeForNull, oracle数据库必须配置
jdbc-type-for-null: 'null'
#MyBatis 自动映射时未知列或未知属性处理策略 NONE:不做任何处理 (默认值), WARNING:以日志的形式打印相关警告信息, FAILING:当作映射失败处理,并抛出异常和详细信息
auto-mapping-unknown-column-behavior: warning
#开启SQL打印
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
mybatis:
type-aliases-package: net.wanji.*.model
mapper-locations: classpath*:mapper/*.xml,classpath*:mapper/*/*.xml
configuration:
log-impl: org.apache.ibatis.logging.nologging.NoLoggingImpl
# PageHelper分页插件
pagehelper:
helperDialect: mysql
supportMethodsArguments: true
params: count=countSql
#线程池配置
threadPoolConfig:
threadPoolName: ${spring.application.name}-threadPool-thread-%d
coreSize: 8
maxSize: 16
queueCapacity: 200
keepAliveTime: 6000
allowCoreTimeOut: false
# 测试信号平台
signal:
# true测试不执行方案下发 重点
mock: false
# 厂商接口
manufacturer:
hk:
# 服务地址
artemisHost: 10.102.1.183
# 接口服务验证用户名
artemisAppKey: 20893705
# 接口服务验证密钥
artemisAppSecret: jwr6D6h8xcZbgjqiwe6G
# 海康能力开放平台的网站路径
artemisPath: /artemis
......@@ -18,6 +18,8 @@ public class AbnormalCrossListVO {
private String id;
@ApiModelProperty(value = "路口名称")
private String name;
@ApiModelProperty(value = "是否信控路口:1是;0否")
private Integer isSignal;
@ApiModelProperty(value = "失衡方向 如 1,2,3")
private String unbalanceDirs;
@ApiModelProperty(value = "拥堵方向 如 1,2,3")
......
......@@ -56,10 +56,10 @@
<select id="selectAbnormalCross" resultType="net.wanji.databus.vo.AbnormalCrossListVO">
select
t2.id, t2.name, t1.unbalance_dirs, t1.congestion_dirs, t1.spillover_dirs, t1.status as realtimeStatus,
t2.id, t2.name, t2.is_signal, t1.unbalance_dirs, t1.congestion_dirs, t1.spillover_dirs, t1.status as realtimeStatus,
t1.start_time, t1.duration, t2.location as locationStr, t1.is_unbalance, t1.is_spillover, t1.is_congestion
from t_cross_data_realtime t1 JOIN t_base_cross_info t2
ON t1.cross_id = t2.id
on t1.cross_id = t2.id
<where>
<if test="status != null">
and (t1.status = #{status}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment