fix():修复admin账号为空的问题
parent
1c5fdc40bf
commit
7fb43bd5b9
|
@ -25,7 +25,7 @@ public class TableDataInfo<T> implements Serializable {
|
|||
/**
|
||||
* 总记录数
|
||||
*/
|
||||
private Long total;
|
||||
private long total;
|
||||
|
||||
/**
|
||||
* 列表数据
|
||||
|
|
|
@ -28,11 +28,6 @@
|
|||
<groupId>org.eclipse.paho</groupId>
|
||||
<artifactId>org.eclipse.paho.client.mqttv3</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>enterpise-cache</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>cloud-common-caffeine</artifactId>
|
||||
|
|
|
@ -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("无缓存");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
package com.muyu.data.service;
|
||||
|
||||
/**
|
||||
*
|
||||
* @Author WangXin
|
||||
* @Data 2024/10/3
|
||||
* @Version 1.0.0
|
||||
*/
|
||||
public interface TestService {
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
package com.muyu.data.service.impl;
|
||||
|
||||
import com.muyu.data.service.TestService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @author WangXIn
|
||||
* @package:com.muyu.event.service.impl
|
||||
* @name:TestServiceImpl
|
||||
* @date:2024/9/29 21:00
|
||||
*/
|
||||
@Service
|
||||
public class TestServiceImpl implements TestService {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -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(){
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -105,7 +105,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|||
@Override
|
||||
public SysUser selectUserByUserName (String userName, Long firmId) {
|
||||
SysUser sysUser = null;
|
||||
sysUser.setFirmId(firmId);
|
||||
|
||||
if (firmId == 1){
|
||||
sysUser = userMapper.selectUserByUserName(userName);
|
||||
}else {
|
||||
|
@ -116,6 +116,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|||
List<SysRole> byUserIdAndFirmId = roleMapper.findByUserIdAndFirmId(sysUser.getUserId(), sysUser.getFirmId());
|
||||
sysUser.setRoles(byUserIdAndFirmId);
|
||||
}
|
||||
sysUser.setFirmId(firmId);
|
||||
return sysUser;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue