Commit d285c2c7 authored by 赵啸非's avatar 赵啸非

修正redis 最大连接数

parent cc680dc6
...@@ -1295,6 +1295,11 @@ ...@@ -1295,6 +1295,11 @@
resolved "https://registry.nlark.com/@soda/get-current-script/download/@soda/get-current-script-1.0.2.tgz" resolved "https://registry.nlark.com/@soda/get-current-script/download/@soda/get-current-script-1.0.2.tgz"
integrity sha1-pTUV2yXYA4N0OBtzryC7Ty5QjYc= integrity sha1-pTUV2yXYA4N0OBtzryC7Ty5QjYc=
"@tweenjs/tween.js@^18.6.4":
version "18.6.4"
resolved "https://registry.npmmirror.com/@tweenjs/tween.js/-/tween.js-18.6.4.tgz#40a3d0a93647124872dec8e0fd1bd5926695b6ca"
integrity sha512-lB9lMjuqjtuJrx7/kOkqQBtllspPIN+96OvTCeJ2j5FEzinoAXTdAMFnDAQT1KVPRlnYfBrqxtqP66vDM40xxQ==
"@types/glob@^7.1.1": "@types/glob@^7.1.1":
version "7.1.4" version "7.1.4"
resolved "https://registry.nlark.com/@types/glob/download/@types/glob-7.1.4.tgz" resolved "https://registry.nlark.com/@types/glob/download/@types/glob-7.1.4.tgz"
...@@ -9076,10 +9081,15 @@ thread-loader@^2.1.3: ...@@ -9076,10 +9081,15 @@ thread-loader@^2.1.3:
loader-utils "^1.1.0" loader-utils "^1.1.0"
neo-async "^2.6.0" neo-async "^2.6.0"
three@^0.152.2: three-css2drender@^1.0.0:
version "0.152.2" version "1.0.0"
resolved "https://registry.npmmirror.com/three/-/three-0.152.2.tgz#2ee0f2c504d31a4bc29b45495c12bded9fda7bfc" resolved "https://registry.npmmirror.com/three-css2drender/-/three-css2drender-1.0.0.tgz#2065e64c9d117033c08bfdc957a78edfe4b6ed1b"
integrity sha512-Ff9zIpSfkkqcBcpdiFo2f35vA9ZucO+N8TNacJOqaEE6DrB0eufItVMib8bK8Pcju/ZNT6a7blE1GhTpkdsILw== integrity sha512-redDCSBDvgxiJIm6EDT8WO5WJTVg5gUEy/vjtAgJa/zX4peEUnZ8K+mXo6v94EudbnuI5h48/hQo9NExf04ENg==
three@^0.149.0:
version "0.149.0"
resolved "https://registry.npmmirror.com/three/-/three-0.149.0.tgz#a9cf78b17d02f063ffe6dfca1e300eff2eab2927"
integrity sha512-tohpUxPDht0qExRLDTM8sjRLc5d9STURNrdnK3w9A+V4pxaTBfKWWT/IqtiLfg23Vfc3Z+ImNfvRw1/0CtxrkQ==
throttle-debounce@^1.0.1: throttle-debounce@^1.0.1:
version "1.1.0" version "1.1.0"
......
...@@ -11,6 +11,7 @@ import org.springframework.context.annotation.Configuration; ...@@ -11,6 +11,7 @@ import org.springframework.context.annotation.Configuration;
import javax.sql.DataSource; import javax.sql.DataSource;
@Configuration @Configuration
//@AutoConfigureAfter(DataSourceAutoConfiguration.class) //@AutoConfigureAfter(DataSourceAutoConfiguration.class)
public class MybatisConfiguration extends AbstractMybatisConfiguration { public class MybatisConfiguration extends AbstractMybatisConfiguration {
......
...@@ -4,17 +4,7 @@ ...@@ -4,17 +4,7 @@
package com.mortals.xhx.base.system.task.service.impl; package com.mortals.xhx.base.system.task.service.impl;
import java.util.Calendar; import cn.hutool.core.net.NetUtil;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.mortals.framework.ap.GlobalSysInfo; import com.mortals.framework.ap.GlobalSysInfo;
import com.mortals.framework.common.code.ExcuteStatus; import com.mortals.framework.common.code.ExcuteStatus;
import com.mortals.framework.common.code.TaskExcuteStrategy; import com.mortals.framework.common.code.TaskExcuteStrategy;
...@@ -30,6 +20,12 @@ import com.mortals.xhx.base.system.task.dao.TaskDao; ...@@ -30,6 +20,12 @@ import com.mortals.xhx.base.system.task.dao.TaskDao;
import com.mortals.xhx.base.system.task.model.TaskEntity; import com.mortals.xhx.base.system.task.model.TaskEntity;
import com.mortals.xhx.base.system.task.model.TaskQuery; import com.mortals.xhx.base.system.task.model.TaskQuery;
import com.mortals.xhx.base.system.task.service.TaskService; import com.mortals.xhx.base.system.task.service.TaskService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.*;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
/** /**
* <p> * <p>
...@@ -155,6 +151,7 @@ public class TaskServiceImpl extends AbstractCRUDServiceImpl<TaskDao, TaskEntity ...@@ -155,6 +151,7 @@ public class TaskServiceImpl extends AbstractCRUDServiceImpl<TaskDao, TaskEntity
public void start() throws AppException { public void start() throws AppException {
final String localIp = SystemUtil.getLocalHostIp(); final String localIp = SystemUtil.getLocalHostIp();
log.info("任务执行线程启动...-->" + localIp); log.info("任务执行线程启动...-->" + localIp);
log.info("other get Ip...-->" + NetUtil.getLocalhostStr());
thread = new Thread(() -> { thread = new Thread(() -> {
// 将本机上次执行而未完成的任务状态变更 // 将本机上次执行而未完成的任务状态变更
try { try {
......
...@@ -49,8 +49,8 @@ public class DeviceComsumersRegisterService implements IApplicationStartedServic ...@@ -49,8 +49,8 @@ public class DeviceComsumersRegisterService implements IApplicationStartedServic
deviceService.find(new DeviceEntity()) deviceService.find(new DeviceEntity())
.stream() .stream()
.filter(f -> !ObjectUtils.isEmpty(platformService.getCache(f.getPlatformId().toString()))) .filter(f -> !ObjectUtils.isEmpty(platformService.getCache(f.getPlatformId()==null?"0":f.getPlatformId().toString())))
.filter(f -> !ObjectUtils.isEmpty(productService.getCache(f.getProductId().toString()))).forEach(item -> { .filter(f -> !ObjectUtils.isEmpty(productService.getCache(f.getProductId()==null?"0":f.getProductId().toString()))).forEach(item -> {
String uploadQueue = Constant.UPLOAD_TOPIC + item.getDeviceCode(); String uploadQueue = Constant.UPLOAD_TOPIC + item.getDeviceCode();
String downQueue = Constant.DOWN_TOPIC + item.getDeviceCode(); String downQueue = Constant.DOWN_TOPIC + item.getDeviceCode();
messageProducer.queueAddAndBinds(QueueKey.DEFAULT_EXCHANGE, uploadQueue, uploadQueue); messageProducer.queueAddAndBinds(QueueKey.DEFAULT_EXCHANGE, uploadQueue, uploadQueue);
......
...@@ -210,8 +210,8 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D ...@@ -210,8 +210,8 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
deviceEntity.setDeviceStatus(DeviceStatusEnum.离线.getValue()); deviceEntity.setDeviceStatus(DeviceStatusEnum.离线.getValue());
deviceEntity.setEnabled(EnabledEnum.启用.getValue()); deviceEntity.setEnabled(EnabledEnum.启用.getValue());
this.update(deviceEntity); this.update(deviceEntity);
PlatformEntity platformEntity = platformService.getCache(deviceEntity.getPlatformId().toString()); PlatformEntity platformEntity = platformService.getCache(deviceEntity.getPlatformId()==null?"-1":deviceEntity.getPlatformId().toString());
ProductEntity productEntity = productService.getCache(deviceEntity.getProductId().toString()); ProductEntity productEntity = productService.getCache(deviceEntity.getProductId()==null?"-1":deviceEntity.getProductId().toString());
if (!ObjectUtils.isEmpty(platformEntity) && !ObjectUtils.isEmpty(productEntity)) { if (!ObjectUtils.isEmpty(platformEntity) && !ObjectUtils.isEmpty(productEntity)) {
//注册rabbmit相关队列与绑定 //注册rabbmit相关队列与绑定
messageProducer.queueAddAndBinds(QueueKey.DEFAULT_EXCHANGE, Constant.UPLOAD_TOPIC + deviceCode, Constant.UPLOAD_TOPIC + deviceCode); messageProducer.queueAddAndBinds(QueueKey.DEFAULT_EXCHANGE, Constant.UPLOAD_TOPIC + deviceCode, Constant.UPLOAD_TOPIC + deviceCode);
...@@ -292,8 +292,8 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D ...@@ -292,8 +292,8 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
deviceEntity.setUpdateTime(new Date()); deviceEntity.setUpdateTime(new Date());
deviceEntity.setUpdateUserId(getContextUserId(context)); deviceEntity.setUpdateUserId(getContextUserId(context));
this.getDeviceDao().update(deviceEntity); this.getDeviceDao().update(deviceEntity);
ProductEntity productEntity = productService.getCache(deviceEntity.getProductId().toString()); PlatformEntity platformEntity = platformService.getCache(deviceEntity.getPlatformId() == null ? "-1" : deviceEntity.getPlatformId().toString());
PlatformEntity platformEntity = platformService.getCache(deviceEntity.getPlatformId().toString()); ProductEntity productEntity = productService.getCache(deviceEntity.getProductId() == null ? "-1" : deviceEntity.getProductId().toString());
if (enabled == YesNoEnum.YES.getValue()) { if (enabled == YesNoEnum.YES.getValue()) {
this.sendThirdParty(deviceEntity, productEntity, platformEntity, DeviceMethodEnum.ENABLED); this.sendThirdParty(deviceEntity, productEntity, platformEntity, DeviceMethodEnum.ENABLED);
} else { } else {
...@@ -306,8 +306,8 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D ...@@ -306,8 +306,8 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
DeviceEntity deviceEntity = this.get(id, context); DeviceEntity deviceEntity = this.get(id, context);
if (ObjectUtils.isEmpty(deviceEntity)) throw new AppException("当前设备不存在!"); if (ObjectUtils.isEmpty(deviceEntity)) throw new AppException("当前设备不存在!");
PlatformEntity platformEntity = platformService.getCache(deviceEntity.getPlatformId().toString()); PlatformEntity platformEntity = platformService.getCache(deviceEntity.getPlatformId() == null ? "-1" : deviceEntity.getPlatformId().toString());
ProductEntity productEntity = productService.getCache(deviceEntity.getProductId().toString()); ProductEntity productEntity = productService.getCache(deviceEntity.getProductId() == null ? "-1" : deviceEntity.getProductId().toString());
String exchangeName = platformEntity.getPlatformSn() + Constant.EXCHANGE_SPLIT + productEntity.getProductCode(); String exchangeName = platformEntity.getPlatformSn() + Constant.EXCHANGE_SPLIT + productEntity.getProductCode();
TopicPartitionInfo topicPartitionInfo = new TopicPartitionInfo(Constant.UPLOAD_TOPIC + deviceEntity.getDeviceCode(), null, exchangeName); TopicPartitionInfo topicPartitionInfo = new TopicPartitionInfo(Constant.UPLOAD_TOPIC + deviceEntity.getDeviceCode(), null, exchangeName);
...@@ -326,8 +326,8 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D ...@@ -326,8 +326,8 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
@Override @Override
protected void saveAfter(DeviceEntity entity, Context context) throws AppException { protected void saveAfter(DeviceEntity entity, Context context) throws AppException {
super.saveAfter(entity, context); super.saveAfter(entity, context);
PlatformEntity platformEntity = platformService.getCache(entity.getPlatformId().toString()); PlatformEntity platformEntity = platformService.getCache(entity.getPlatformId() == null ? "-1" : entity.getPlatformId().toString());
ProductEntity productEntity = productService.getCache(entity.getProductId().toString()); ProductEntity productEntity = productService.getCache(entity.getProductId() == null ? "0" : entity.getProductId().toString());
if (!ObjectUtils.isEmpty(platformEntity) && !ObjectUtils.isEmpty(productEntity)) { if (!ObjectUtils.isEmpty(platformEntity) && !ObjectUtils.isEmpty(productEntity)) {
//注册rabbmit相关队列与绑定 激活后才註冊綁定隊列 //注册rabbmit相关队列与绑定 激活后才註冊綁定隊列
// registerRabbitQueue(entity, platformEntity, productEntity); // registerRabbitQueue(entity, platformEntity, productEntity);
...@@ -339,8 +339,8 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D ...@@ -339,8 +339,8 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
@Override @Override
protected void updateAfter(DeviceEntity entity, Context context) throws AppException { protected void updateAfter(DeviceEntity entity, Context context) throws AppException {
super.updateAfter(entity, context); super.updateAfter(entity, context);
PlatformEntity platformEntity = platformService.getCache(entity.getPlatformId().toString()); PlatformEntity platformEntity = platformService.getCache(entity.getPlatformId() == null ? "-1" : entity.getPlatformId().toString());
ProductEntity productEntity = productService.getCache(entity.getProductId().toString()); ProductEntity productEntity = productService.getCache(entity.getProductId() == null ? "0" : entity.getProductId().toString());
if (!ObjectUtils.isEmpty(platformEntity) && !ObjectUtils.isEmpty(productEntity)) { if (!ObjectUtils.isEmpty(platformEntity) && !ObjectUtils.isEmpty(productEntity)) {
//新增设备通知第三方平台 激活后的设备才通知和更新 //新增设备通知第三方平台 激活后的设备才通知和更新
if (entity.getDeviceStatus() > 0) { if (entity.getDeviceStatus() > 0) {
...@@ -373,9 +373,9 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D ...@@ -373,9 +373,9 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
ApiResp<String> resp = messageService.sendThirdParty(UrlBuilder.of(phpInUrl).addPath(thirdPartyPath).build(), deviceReq); ApiResp<String> resp = messageService.sendThirdParty(UrlBuilder.of(phpInUrl).addPath(thirdPartyPath).build(), deviceReq);
log.info("sendThirty resp ==>{}", JSON.toJSONString(resp)); log.info("sendThirty resp ==>{}", JSON.toJSONString(resp));
if (!ObjectUtils.isEmpty(resp)&&resp.getCode() == YesNoEnum.YES.getValue()) { if (!ObjectUtils.isEmpty(resp) && resp.getCode() == YesNoEnum.YES.getValue()) {
return Rest.ok("成功!"); return Rest.ok("成功!");
}else { } else {
return Rest.fail("发送失败"); return Rest.fail("发送失败");
} }
} }
......
...@@ -403,6 +403,8 @@ public class DeviceController extends BaseCRUDJsonBodyMappingController<DeviceSe ...@@ -403,6 +403,8 @@ public class DeviceController extends BaseCRUDJsonBodyMappingController<DeviceSe
@Override @Override
protected void saveBefore(DeviceEntity entity, Map<String, Object> model, Context context) throws AppException { protected void saveBefore(DeviceEntity entity, Map<String, Object> model, Context context) throws AppException {
super.saveBefore(entity, model, context); super.saveBefore(entity, model, context);
if(ObjectUtils.isEmpty(entity.getProductId())) throw new AppException("所属产品ID不能为空!");
if(ObjectUtils.isEmpty(entity.getPlatformId())) throw new AppException("所属平台ID不能为空!");
//判断如果存在相同的 //判断如果存在相同的
DeviceEntity deviceEntity = this.service.selectOne(new DeviceQuery().deviceCode(entity.getDeviceCode())); DeviceEntity deviceEntity = this.service.selectOne(new DeviceQuery().deviceCode(entity.getDeviceCode()));
if(!ObjectUtils.isEmpty(deviceEntity)){ if(!ObjectUtils.isEmpty(deviceEntity)){
......
...@@ -74,7 +74,6 @@ public class SitestatController extends BaseCRUDJsonBodyMappingController<Sitest ...@@ -74,7 +74,6 @@ public class SitestatController extends BaseCRUDJsonBodyMappingController<Sitest
} else { } else {
Rest<SitePdu> resp = siteFeign.info(entity.getSiteId()); Rest<SitePdu> resp = siteFeign.info(entity.getSiteId());
if (resp.getCode() == YesNoEnum.YES.getValue()) { if (resp.getCode() == YesNoEnum.YES.getValue()) {
entity.setLng(resp.getData().getLongitude()); entity.setLng(resp.getData().getLongitude());
entity.setLat(resp.getData().getLatitude()); entity.setLat(resp.getData().getLatitude());
entity.setAddress(resp.getData().getDetailAddress()); entity.setAddress(resp.getData().getDetailAddress());
......
...@@ -28,10 +28,10 @@ spring: ...@@ -28,10 +28,10 @@ spring:
database: @profiles.redis.database@ database: @profiles.redis.database@
timeout: 30000 timeout: 30000
pool: pool:
max-idle: 30 max-idle: 100
min-idle: 0 min-idle: 50
max-active: 100 max-active: 500
max-wait: 1000 max-wait: 5000
# sentinel: # sentinel:
# master: mymaster # master: mymaster
# nodes: @profiles.redis.sentinel@ # nodes: @profiles.redis.sentinel@
......
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