Merge remote-tracking branch 'origin/dev' into dev

dev
ruyaxie 2024-10-10 10:30:21 +08:00
commit 37a42ccd3c
8 changed files with 4 additions and 206 deletions

View File

@ -25,7 +25,7 @@ public class TableDataInfo<T> implements Serializable {
/** /**
* *
*/ */
private Long total; private long total;
/** /**
* *

View File

@ -28,11 +28,6 @@
<groupId>org.eclipse.paho</groupId> <groupId>org.eclipse.paho</groupId>
<artifactId>org.eclipse.paho.client.mqttv3</artifactId> <artifactId>org.eclipse.paho.client.mqttv3</artifactId>
</dependency> </dependency>
<dependency>
<groupId>com.muyu</groupId>
<artifactId>enterpise-cache</artifactId>
</dependency>
<dependency> <dependency>
<groupId>com.muyu</groupId> <groupId>com.muyu</groupId>
<artifactId>cloud-common-caffeine</artifactId> <artifactId>cloud-common-caffeine</artifactId>

View File

@ -1,133 +0,0 @@
package com.muyu.data.controller;
import com.alibaba.fastjson2.JSONObject;
import com.muyu.common.caffeine.enums.CacheNameEnums;
import com.muyu.common.core.utils.uuid.UUID;
import com.muyu.common.iotdb.config.IotDBSessionConfig;
import com.muyu.common.kafka.constant.KafkaConstants;
import com.muyu.common.rabbit.constants.RabbitConstants;
import com.muyu.data.domain.Information;
import jakarta.annotation.Resource;
import lombok.extern.log4j.Log4j2;
import org.apache.kafka.clients.producer.KafkaProducer;
import org.apache.kafka.clients.producer.ProducerRecord;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.cache.Cache;
import org.springframework.cache.CacheManager;
import org.springframework.data.redis.core.RedisTemplate;
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;
/**
*
* @program: cloud-server
* @author: WangXin
* @create: 2024-09-28 14:55
**/
@RestController
@RequestMapping
@Log4j2
public class TestController {
@Resource
private KafkaProducer<String,JSONObject> kafkaProducer;
@Resource
private RabbitTemplate rabbitTemplate;
@Resource
private IotDBSessionConfig iotDBConfig;
@Resource
private RedisTemplate<String,String> redisTemplate;
// @Resource
// private CaffeineCacheUtils cacheUtils;
@Resource
private CacheManager cacheManager;
@GetMapping("/testKafka")
public void sendMsg() {
try {
// 测试数据
Information information = new Information();
JSONObject from = JSONObject.from(information);
ProducerRecord<String, JSONObject> producerRecord = new ProducerRecord<>(KafkaConstants.KafkaTopic, from);
kafkaProducer.send(producerRecord);
System.out.println("同步消息发送成功: " + from);
} catch (Exception e) {
e.printStackTrace();
System.out.println("同步消息发送失败");
}
}
@GetMapping("/testRabbit/GoOnline")
public void testRabbitGoOnline(@RequestParam("msg") String msg) {
rabbitTemplate.convertAndSend(RabbitConstants.GO_ONLINE_QUEUE, msg, message -> {
message.getMessageProperties().setMessageId(UUID.randomUUID().toString().replace("-",""));
return message;
});
}
@GetMapping("/testRabbit/Downline")
public void testRabbitDownline(@RequestParam("msg") String msg) {
rabbitTemplate.convertAndSend(RabbitConstants.DOWN_LINE_QUEUE, msg, message -> {
message.getMessageProperties().setMessageId(UUID.randomUUID().toString().replace("-",""));
return message;
});
}
@GetMapping("/insertData")
public void insertData(@RequestParam("deviceId") String deviceId, @RequestParam("time") Long time, @RequestParam("value") double value) throws Exception {
String sql = String.format("insert into root.one.%s(timestamp, temperature) values (%d, %f)", deviceId, time, value);
iotDBConfig.getSessionPool().executeNonQueryStatement(sql);
}
@GetMapping("/testSetRedis")
public void testSetRedis(@RequestParam("key") String key,@RequestParam("value") String value) {
redisTemplate.opsForValue().set(key,value);
}
@GetMapping("/testGetCache")
public void testGetCache(@RequestParam("cacheName") String cacheName,@RequestParam("key") String key) {
Cache cache = cacheManager.getCache(cacheName);
if (cache != null) {
String v = cache.get(key,String.class);
log.info("缓存值为: {}",v);
}else {
log.info("无缓存");
}
}
@GetMapping("/textSetCache")
public void textSetCache(
@RequestParam("cacheName") String cacheName,
@RequestParam("key") String key,
@RequestParam("value") String value) {
Cache cache = cacheManager.getCache(cacheName);
if (cache != null){
cache.put(key, value);
log.info("设置缓存成功");
}else {
log.info("无缓存");
}
}
@GetMapping("/testDelCache")
public void testDelCache(@RequestParam("cacheName") String cacheName) {
if (!CacheNameEnums.isCode(cacheName)){
log.info("缓存分区不存在");
return;
}
Cache cache = cacheManager.getCache(cacheName);
if (cache != null) {
cache.invalidate();
log.info("删除缓存成功");
}else{
log.info("无缓存");
}
}
}

View File

@ -1,10 +0,0 @@
package com.muyu.data.service;
/**
*
* @Author WangXin
* @Data 2024/10/3
* @Version 1.0.0
*/
public interface TestService {
}

View File

@ -1,20 +0,0 @@
package com.muyu.data.service.impl;
import com.muyu.data.service.TestService;
import org.springframework.stereotype.Service;
/**
* @author WangXIn
* @packagecom.muyu.event.service.impl
* @nameTestServiceImpl
* @date2024/9/29 21:00
*/
@Service
public class TestServiceImpl implements TestService {
}

View File

@ -1,35 +0,0 @@
package com.muyu.data.warn;
import com.muyu.enterprise.cache.SysCarCacheService;
import com.muyu.enterprise.cache.SysCarTypeCacheService;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
import javax.annotation.Resource;
/**
*
* @version 1.0
* @Author xie ya ru
* @Date 2024/10/6 15:21
* @
*/
@Component
public class WarningJudgment {
@Resource
private SysCarCacheService sysCarCacheService;
@Resource
private SysCarTypeCacheService sysCarTypeCacheService;
@PostConstruct
public void getCache(){
}
}

View File

@ -26,7 +26,7 @@ public class FileUploadUtils {
/** /**
* 50M * 50M
*/ */
public static final Long DEFAULT_MAX_SIZE = 50 * 1024 * 1024L; public static final long DEFAULT_MAX_SIZE = 50 * 1024 * 1024;
/** /**
* 100 * 100

View File

@ -105,7 +105,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
@Override @Override
public SysUser selectUserByUserName (String userName, Long firmId) { public SysUser selectUserByUserName (String userName, Long firmId) {
SysUser sysUser = null; SysUser sysUser = null;
sysUser.setFirmId(firmId);
if (firmId == 1){ if (firmId == 1){
sysUser = userMapper.selectUserByUserName(userName); sysUser = userMapper.selectUserByUserName(userName);
}else { }else {
@ -116,6 +116,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
List<SysRole> byUserIdAndFirmId = roleMapper.findByUserIdAndFirmId(sysUser.getUserId(), sysUser.getFirmId()); List<SysRole> byUserIdAndFirmId = roleMapper.findByUserIdAndFirmId(sysUser.getUserId(), sysUser.getFirmId());
sysUser.setRoles(byUserIdAndFirmId); sysUser.setRoles(byUserIdAndFirmId);
} }
sysUser.setFirmId(firmId);
return sysUser; return sysUser;
} }