Merge remote-tracking branch 'origin/dev.saas.ylys' into dev.saas.ylys
commit
b4ae94baa8
|
@ -24,6 +24,6 @@ public class ServiceNameConstants {
|
||||||
/**
|
/**
|
||||||
* 车辆服务的serviceid
|
* 车辆服务的serviceid
|
||||||
*/
|
*/
|
||||||
public static final String ENTERPRISE_SERVICE = "cloud-enterprise";
|
public static final String ENTERPRISE_SERVICE = "cloud-saas";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,6 @@ public class TokenConstants {
|
||||||
/**
|
/**
|
||||||
* 令牌秘钥
|
* 令牌秘钥
|
||||||
*/
|
*/
|
||||||
public final static String SECRET = "abcdefghijklmnsalieopadfaqawefwerstuvwxyz";
|
public final static String SECRET = "abcdefghijklmnsalieopadfaqawefwerstuvxyryz";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@ public class ServiceException extends RuntimeException {
|
||||||
/**
|
/**
|
||||||
* 错误明细,内部调试错误
|
* 错误明细,内部调试错误
|
||||||
* <p>
|
* <p>
|
||||||
* 和 {@link CommonResult#getDetailMessage()} 一致的设计
|
* 和 {@link #()} 一致的设计
|
||||||
*/
|
*/
|
||||||
private String detailMessage;
|
private String detailMessage;
|
||||||
|
|
||||||
|
|
|
@ -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>
|
<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>
|
||||||
|
|
|
@ -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(){
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -30,6 +30,8 @@
|
||||||
<artifactId>cloud-common-cache</artifactId>
|
<artifactId>cloud-common-cache</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
package com.muyu.enterprise.cache;
|
package com.muyu.enterprise.cache;
|
||||||
|
|
||||||
|
import com.muyu.common.cache.CacheAbsBasic;
|
||||||
|
|
||||||
|
|
||||||
import com.muyu.common.cache.CacheAbsBasic;
|
import com.muyu.common.cache.CacheAbsBasic;
|
||||||
import com.muyu.enterprise.cache.domain.InformationData;
|
import com.muyu.enterprise.cache.domain.InformationData;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
|
@ -5,7 +5,7 @@ import com.muyu.domain.SysCarType;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 车辆类型缓存服务
|
* 车型缓存服务
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
* @Author xie ya ru
|
* @Author xie ya ru
|
||||||
* @Date 2024/9/30 11:18
|
* @Date 2024/9/30 11:18
|
||||||
|
|
|
@ -41,10 +41,9 @@
|
||||||
<artifactId>swagger-annotations-jakarta</artifactId>
|
<artifactId>swagger-annotations-jakarta</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.muyu</groupId>
|
|
||||||
<artifactId>cloud-common-system</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.muyu.remote;
|
package com.muyu.remote;
|
||||||
|
|
||||||
|
import com.muyu.common.core.constant.SecurityConstants;
|
||||||
import com.muyu.common.core.constant.ServiceNameConstants;
|
import com.muyu.common.core.constant.ServiceNameConstants;
|
||||||
import com.muyu.common.core.domain.Result;
|
import com.muyu.common.core.domain.Result;
|
||||||
import com.muyu.common.system.domain.SysUser;
|
import com.muyu.common.system.domain.SysUser;
|
||||||
|
@ -21,8 +22,8 @@ import java.util.List;
|
||||||
@FeignClient(contextId = "remoteMessageValueService", value = ServiceNameConstants.ENTERPRISE_SERVICE, fallbackFactory = RemoteMessageValueFallbackFactory.class,path = "messageValue")
|
@FeignClient(contextId = "remoteMessageValueService", value = ServiceNameConstants.ENTERPRISE_SERVICE, fallbackFactory = RemoteMessageValueFallbackFactory.class,path = "messageValue")
|
||||||
public interface RemoteFirmUserService {
|
public interface RemoteFirmUserService {
|
||||||
|
|
||||||
@GetMapping("/firmUser/info/{username}")
|
@GetMapping("/saas/firmUser/info/{username}")
|
||||||
public Result<SysUser> info(@PathVariable("username") String username);
|
public Result<SysUser> info(@PathVariable("username") String username, @RequestHeader(SecurityConstants.FIRM_KEY) String firmKey);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ public class RemoteFirmFallbackFactory implements FallbackFactory<RemoteFirmUser
|
||||||
return new RemoteFirmUserService() {
|
return new RemoteFirmUserService() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Result<SysUser> info(String username) {
|
public Result<SysUser> info(String username, String firmKey) {
|
||||||
return Result.error("查询数据失败:"+cause.getMessage());
|
return Result.error("查询数据失败:"+cause.getMessage());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.muyu</groupId>
|
<groupId>com.muyu</groupId>
|
||||||
<artifactId>enterpise-common</artifactId>
|
<artifactId>enterpise-common</artifactId>
|
||||||
|
<version>${muyu.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- SpringCloud Alibaba Nacos -->
|
<!-- SpringCloud Alibaba Nacos -->
|
||||||
|
@ -105,6 +106,11 @@
|
||||||
<groupId>com.muyu</groupId>
|
<groupId>com.muyu</groupId>
|
||||||
<artifactId>enterpise-cache</artifactId>
|
<artifactId>enterpise-cache</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<!-- saas公共-->
|
||||||
|
<!-- <dependency>-->
|
||||||
|
<!-- <groupId>com.muyu</groupId>-->
|
||||||
|
<!-- <artifactId>cloud-common-saas</artifactId>-->
|
||||||
|
<!-- </dependency>-->
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|
|
@ -49,8 +49,6 @@ spring:
|
||||||
shared-configs:
|
shared-configs:
|
||||||
# 系统共享配置
|
# 系统共享配置
|
||||||
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||||
# 系统环境Config共享配置
|
|
||||||
- application-config-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
|
||||||
# xxl-job 配置文件
|
# xxl-job 配置文件
|
||||||
- application-xxl-config-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
- application-xxl-config-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||||
|
|
||||||
|
|
|
@ -93,7 +93,7 @@ public class GenController extends BaseController<BaseEntity> {
|
||||||
TableDataInfo dataInfo = new TableDataInfo();
|
TableDataInfo dataInfo = new TableDataInfo();
|
||||||
List<GenTableColumn> list = genTableColumnService.selectGenTableColumnListByTableId(tableId);
|
List<GenTableColumn> list = genTableColumnService.selectGenTableColumnListByTableId(tableId);
|
||||||
dataInfo.setRows(list);
|
dataInfo.setRows(list);
|
||||||
dataInfo.setTotal(list.size());
|
dataInfo.setTotal((long) list.size());
|
||||||
return success(dataInfo);
|
return success(dataInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -74,11 +74,6 @@
|
||||||
<artifactId>cloud-common-api-doc</artifactId>
|
<artifactId>cloud-common-api-doc</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- XllJob定时任务 -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.muyu</groupId>
|
|
||||||
<artifactId>cloud-common-xxl</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- mqtt监控者 -->
|
<!-- mqtt监控者 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -91,11 +86,7 @@
|
||||||
<artifactId>lombok</artifactId>
|
<artifactId>lombok</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- 远调 -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.muyu</groupId>
|
|
||||||
<artifactId>enterpise-remote</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<!-- 实体类 -->
|
<!-- 实体类 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.muyu</groupId>
|
<groupId>com.muyu</groupId>
|
||||||
|
|
|
@ -7,7 +7,7 @@ nacos:
|
||||||
addr: 123.57.152.124:8848
|
addr: 123.57.152.124:8848
|
||||||
user-name: nacos
|
user-name: nacos
|
||||||
password: nacos
|
password: nacos
|
||||||
namespace: yan1
|
namespace: xyr
|
||||||
# SPRING_AMQP_DESERIALIZATION_TRUST_ALL=true spring.amqp.deserialization.trust.all
|
# SPRING_AMQP_DESERIALIZATION_TRUST_ALL=true spring.amqp.deserialization.trust.all
|
||||||
# Spring
|
# Spring
|
||||||
spring:
|
spring:
|
||||||
|
|
|
@ -9,6 +9,7 @@ import com.muyu.common.core.utils.StringUtils;
|
||||||
import com.muyu.common.core.utils.bean.BeanValidators;
|
import com.muyu.common.core.utils.bean.BeanValidators;
|
||||||
import com.muyu.common.datascope.annotation.DataScope;
|
import com.muyu.common.datascope.annotation.DataScope;
|
||||||
import com.muyu.common.security.utils.SecurityUtils;
|
import com.muyu.common.security.utils.SecurityUtils;
|
||||||
|
import com.muyu.common.system.domain.SysFirmDatasource;
|
||||||
import com.muyu.common.system.domain.SysRole;
|
import com.muyu.common.system.domain.SysRole;
|
||||||
import com.muyu.common.system.domain.SysUser;
|
import com.muyu.common.system.domain.SysUser;
|
||||||
import com.muyu.remote.RemoteFirmUserService;
|
import com.muyu.remote.RemoteFirmUserService;
|
||||||
|
@ -16,6 +17,7 @@ import com.muyu.system.domain.SysPost;
|
||||||
import com.muyu.system.domain.SysUserPost;
|
import com.muyu.system.domain.SysUserPost;
|
||||||
import com.muyu.system.domain.SysUserRole;
|
import com.muyu.system.domain.SysUserRole;
|
||||||
import com.muyu.system.mapper.*;
|
import com.muyu.system.mapper.*;
|
||||||
|
import com.muyu.system.service.SysFirmDatasourceService;
|
||||||
import com.muyu.system.service.SysUserService;
|
import com.muyu.system.service.SysUserService;
|
||||||
import com.muyu.system.service.SysConfigService;
|
import com.muyu.system.service.SysConfigService;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
|
@ -55,17 +57,18 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||||
private SysConfigService configService;
|
private SysConfigService configService;
|
||||||
@Resource
|
@Resource
|
||||||
private RemoteFirmUserService remoteFirmUserService;
|
private RemoteFirmUserService remoteFirmUserService;
|
||||||
|
@Resource
|
||||||
|
private SysFirmDatasourceService sysFirmDatasourceService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据条件分页查询用户列表
|
* 根据条件分页查询用户列表
|
||||||
*
|
*
|
||||||
* @param user 用户信息
|
* @param user 用户信息
|
||||||
*
|
|
||||||
* @return 用户信息集合信息
|
* @return 用户信息集合信息
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@DataScope(deptAlias = "d", userAlias = "u")
|
@DataScope(deptAlias = "d", userAlias = "u")
|
||||||
public List<SysUser> selectUserList (SysUser user) {
|
public List<SysUser> selectUserList(SysUser user) {
|
||||||
return userMapper.selectUserList(user);
|
return userMapper.selectUserList(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,12 +76,11 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||||
* 根据条件分页查询已分配用户角色列表
|
* 根据条件分页查询已分配用户角色列表
|
||||||
*
|
*
|
||||||
* @param user 用户信息
|
* @param user 用户信息
|
||||||
*
|
|
||||||
* @return 用户信息集合信息
|
* @return 用户信息集合信息
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@DataScope(deptAlias = "d", userAlias = "u")
|
@DataScope(deptAlias = "d", userAlias = "u")
|
||||||
public List<SysUser> selectAllocatedList (SysUser user) {
|
public List<SysUser> selectAllocatedList(SysUser user) {
|
||||||
return userMapper.selectAllocatedList(user);
|
return userMapper.selectAllocatedList(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,12 +88,11 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||||
* 根据条件分页查询未分配用户角色列表
|
* 根据条件分页查询未分配用户角色列表
|
||||||
*
|
*
|
||||||
* @param user 用户信息
|
* @param user 用户信息
|
||||||
*
|
|
||||||
* @return 用户信息集合信息
|
* @return 用户信息集合信息
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@DataScope(deptAlias = "d", userAlias = "u")
|
@DataScope(deptAlias = "d", userAlias = "u")
|
||||||
public List<SysUser> selectUnallocatedList (SysUser user) {
|
public List<SysUser> selectUnallocatedList(SysUser user) {
|
||||||
return userMapper.selectUnallocatedList(user);
|
return userMapper.selectUnallocatedList(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,19 +104,21 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||||
* @return 用户对象信息
|
* @return 用户对象信息
|
||||||
*/
|
*/
|
||||||
@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 {
|
||||||
Result<SysUser> result = remoteFirmUserService.info(userName);
|
SysFirmDatasource datasource = sysFirmDatasourceService.getById(firmId);
|
||||||
if (result.getCode() == Result.SUCCESS){
|
Result<SysUser> result = remoteFirmUserService.info(userName, datasource.getDatabaseName());
|
||||||
|
if (result.getCode() == Result.SUCCESS) {
|
||||||
sysUser = result.getData();
|
sysUser = result.getData();
|
||||||
}
|
}
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,11 +126,10 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||||
* 通过用户ID查询用户
|
* 通过用户ID查询用户
|
||||||
*
|
*
|
||||||
* @param userId 用户ID
|
* @param userId 用户ID
|
||||||
*
|
|
||||||
* @return 用户对象信息
|
* @return 用户对象信息
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public SysUser selectUserById (Long userId) {
|
public SysUser selectUserById(Long userId) {
|
||||||
return userMapper.selectUserById(userId);
|
return userMapper.selectUserById(userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -135,11 +137,10 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||||
* 查询用户所属角色组
|
* 查询用户所属角色组
|
||||||
*
|
*
|
||||||
* @param userName 用户名
|
* @param userName 用户名
|
||||||
*
|
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String selectUserRoleGroup (String userName) {
|
public String selectUserRoleGroup(String userName) {
|
||||||
List<SysRole> list = roleMapper.selectRolesByUserName(userName);
|
List<SysRole> list = roleMapper.selectRolesByUserName(userName);
|
||||||
if (CollectionUtils.isEmpty(list)) {
|
if (CollectionUtils.isEmpty(list)) {
|
||||||
return StringUtils.EMPTY;
|
return StringUtils.EMPTY;
|
||||||
|
@ -151,11 +152,10 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||||
* 查询用户所属岗位组
|
* 查询用户所属岗位组
|
||||||
*
|
*
|
||||||
* @param userName 用户名
|
* @param userName 用户名
|
||||||
*
|
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String selectUserPostGroup (String userName) {
|
public String selectUserPostGroup(String userName) {
|
||||||
List<SysPost> list = postMapper.selectPostsByUserName(userName);
|
List<SysPost> list = postMapper.selectPostsByUserName(userName);
|
||||||
if (CollectionUtils.isEmpty(list)) {
|
if (CollectionUtils.isEmpty(list)) {
|
||||||
return StringUtils.EMPTY;
|
return StringUtils.EMPTY;
|
||||||
|
@ -167,11 +167,10 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||||
* 校验用户名称是否唯一
|
* 校验用户名称是否唯一
|
||||||
*
|
*
|
||||||
* @param user 用户信息
|
* @param user 用户信息
|
||||||
*
|
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean checkUserNameUnique (SysUser user) {
|
public boolean checkUserNameUnique(SysUser user) {
|
||||||
Long userId = StringUtils.isNull(user.getUserId()) ? -1L : user.getUserId();
|
Long userId = StringUtils.isNull(user.getUserId()) ? -1L : user.getUserId();
|
||||||
SysUser info = userMapper.checkUserNameUnique(user.getUserName());
|
SysUser info = userMapper.checkUserNameUnique(user.getUserName());
|
||||||
if (StringUtils.isNotNull(info) && info.getUserId().longValue() != userId.longValue()) {
|
if (StringUtils.isNotNull(info) && info.getUserId().longValue() != userId.longValue()) {
|
||||||
|
@ -184,11 +183,10 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||||
* 校验手机号码是否唯一
|
* 校验手机号码是否唯一
|
||||||
*
|
*
|
||||||
* @param user 用户信息
|
* @param user 用户信息
|
||||||
*
|
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean checkPhoneUnique (SysUser user) {
|
public boolean checkPhoneUnique(SysUser user) {
|
||||||
Long userId = StringUtils.isNull(user.getUserId()) ? -1L : user.getUserId();
|
Long userId = StringUtils.isNull(user.getUserId()) ? -1L : user.getUserId();
|
||||||
SysUser info = userMapper.checkPhoneUnique(user.getPhonenumber());
|
SysUser info = userMapper.checkPhoneUnique(user.getPhonenumber());
|
||||||
if (StringUtils.isNotNull(info) && info.getUserId().longValue() != userId.longValue()) {
|
if (StringUtils.isNotNull(info) && info.getUserId().longValue() != userId.longValue()) {
|
||||||
|
@ -201,11 +199,10 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||||
* 校验email是否唯一
|
* 校验email是否唯一
|
||||||
*
|
*
|
||||||
* @param user 用户信息
|
* @param user 用户信息
|
||||||
*
|
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean checkEmailUnique (SysUser user) {
|
public boolean checkEmailUnique(SysUser user) {
|
||||||
Long userId = StringUtils.isNull(user.getUserId()) ? -1L : user.getUserId();
|
Long userId = StringUtils.isNull(user.getUserId()) ? -1L : user.getUserId();
|
||||||
SysUser info = userMapper.checkEmailUnique(user.getEmail());
|
SysUser info = userMapper.checkEmailUnique(user.getEmail());
|
||||||
if (StringUtils.isNotNull(info) && info.getUserId().longValue() != userId.longValue()) {
|
if (StringUtils.isNotNull(info) && info.getUserId().longValue() != userId.longValue()) {
|
||||||
|
@ -220,7 +217,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||||
* @param user 用户信息
|
* @param user 用户信息
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void checkUserAllowed (SysUser user) {
|
public void checkUserAllowed(SysUser user) {
|
||||||
if (StringUtils.isNotNull(user.getUserId()) && user.isAdmin()) {
|
if (StringUtils.isNotNull(user.getUserId()) && user.isAdmin()) {
|
||||||
throw new ServiceException("不允许操作超级管理员用户");
|
throw new ServiceException("不允许操作超级管理员用户");
|
||||||
}
|
}
|
||||||
|
@ -232,7 +229,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||||
* @param userId 用户id
|
* @param userId 用户id
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void checkUserDataScope (Long userId) {
|
public void checkUserDataScope(Long userId) {
|
||||||
if (!SysUser.isAdmin(SecurityUtils.getUserId())) {
|
if (!SysUser.isAdmin(SecurityUtils.getUserId())) {
|
||||||
SysUser user = new SysUser();
|
SysUser user = new SysUser();
|
||||||
user.setUserId(userId);
|
user.setUserId(userId);
|
||||||
|
@ -247,12 +244,11 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||||
* 新增保存用户信息
|
* 新增保存用户信息
|
||||||
*
|
*
|
||||||
* @param user 用户信息
|
* @param user 用户信息
|
||||||
*
|
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public int insertUser (SysUser user) {
|
public int insertUser(SysUser user) {
|
||||||
// 新增用户信息
|
// 新增用户信息
|
||||||
int rows = userMapper.insertUser(user);
|
int rows = userMapper.insertUser(user);
|
||||||
// 新增用户岗位关联
|
// 新增用户岗位关联
|
||||||
|
@ -266,11 +262,10 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||||
* 注册用户信息
|
* 注册用户信息
|
||||||
*
|
*
|
||||||
* @param user 用户信息
|
* @param user 用户信息
|
||||||
*
|
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean registerUser (SysUser user) {
|
public boolean registerUser(SysUser user) {
|
||||||
return userMapper.insertUser(user) > 0;
|
return userMapper.insertUser(user) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -278,12 +273,11 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||||
* 修改保存用户信息
|
* 修改保存用户信息
|
||||||
*
|
*
|
||||||
* @param user 用户信息
|
* @param user 用户信息
|
||||||
*
|
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public int updateUser (SysUser user) {
|
public int updateUser(SysUser user) {
|
||||||
Long userId = user.getUserId();
|
Long userId = user.getUserId();
|
||||||
// 删除用户与角色关联
|
// 删除用户与角色关联
|
||||||
userRoleMapper.deleteUserRoleByUserId(userId);
|
userRoleMapper.deleteUserRoleByUserId(userId);
|
||||||
|
@ -304,7 +298,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void insertUserAuth (Long userId, Long[] roleIds) {
|
public void insertUserAuth(Long userId, Long[] roleIds) {
|
||||||
userRoleMapper.deleteUserRoleByUserId(userId);
|
userRoleMapper.deleteUserRoleByUserId(userId);
|
||||||
insertUserRole(userId, roleIds);
|
insertUserRole(userId, roleIds);
|
||||||
}
|
}
|
||||||
|
@ -313,11 +307,10 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||||
* 修改用户状态
|
* 修改用户状态
|
||||||
*
|
*
|
||||||
* @param user 用户信息
|
* @param user 用户信息
|
||||||
*
|
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int updateUserStatus (SysUser user) {
|
public int updateUserStatus(SysUser user) {
|
||||||
return userMapper.updateUser(user);
|
return userMapper.updateUser(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -325,11 +318,10 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||||
* 修改用户基本信息
|
* 修改用户基本信息
|
||||||
*
|
*
|
||||||
* @param user 用户信息
|
* @param user 用户信息
|
||||||
*
|
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int updateUserProfile (SysUser user) {
|
public int updateUserProfile(SysUser user) {
|
||||||
return userMapper.updateUser(user);
|
return userMapper.updateUser(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -338,11 +330,10 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||||
*
|
*
|
||||||
* @param userName 用户名
|
* @param userName 用户名
|
||||||
* @param avatar 头像地址
|
* @param avatar 头像地址
|
||||||
*
|
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean updateUserAvatar (String userName, String avatar) {
|
public boolean updateUserAvatar(String userName, String avatar) {
|
||||||
return userMapper.updateUserAvatar(userName, avatar) > 0;
|
return userMapper.updateUserAvatar(userName, avatar) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -350,11 +341,10 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||||
* 重置用户密码
|
* 重置用户密码
|
||||||
*
|
*
|
||||||
* @param user 用户信息
|
* @param user 用户信息
|
||||||
*
|
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int resetPwd (SysUser user) {
|
public int resetPwd(SysUser user) {
|
||||||
return userMapper.updateUser(user);
|
return userMapper.updateUser(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -363,11 +353,10 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||||
*
|
*
|
||||||
* @param userName 用户名
|
* @param userName 用户名
|
||||||
* @param password 密码
|
* @param password 密码
|
||||||
*
|
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int resetUserPwd (String userName, String password) {
|
public int resetUserPwd(String userName, String password) {
|
||||||
return userMapper.resetUserPwd(userName, password);
|
return userMapper.resetUserPwd(userName, password);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -376,7 +365,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||||
*
|
*
|
||||||
* @param user 用户对象
|
* @param user 用户对象
|
||||||
*/
|
*/
|
||||||
public void insertUserRole (SysUser user) {
|
public void insertUserRole(SysUser user) {
|
||||||
this.insertUserRole(user.getUserId(), user.getRoleIds());
|
this.insertUserRole(user.getUserId(), user.getRoleIds());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -385,7 +374,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||||
*
|
*
|
||||||
* @param user 用户对象
|
* @param user 用户对象
|
||||||
*/
|
*/
|
||||||
public void insertUserPost (SysUser user) {
|
public void insertUserPost(SysUser user) {
|
||||||
Long[] posts = user.getPostIds();
|
Long[] posts = user.getPostIds();
|
||||||
if (StringUtils.isNotEmpty(posts)) {
|
if (StringUtils.isNotEmpty(posts)) {
|
||||||
// 新增用户与岗位管理
|
// 新增用户与岗位管理
|
||||||
|
@ -406,7 +395,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||||
* @param userId 用户ID
|
* @param userId 用户ID
|
||||||
* @param roleIds 角色组
|
* @param roleIds 角色组
|
||||||
*/
|
*/
|
||||||
public void insertUserRole (Long userId, Long[] roleIds) {
|
public void insertUserRole(Long userId, Long[] roleIds) {
|
||||||
if (StringUtils.isNotEmpty(roleIds)) {
|
if (StringUtils.isNotEmpty(roleIds)) {
|
||||||
// 新增用户与角色管理
|
// 新增用户与角色管理
|
||||||
List<SysUserRole> list = new ArrayList<SysUserRole>();
|
List<SysUserRole> list = new ArrayList<SysUserRole>();
|
||||||
|
@ -424,12 +413,11 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||||
* 通过用户ID删除用户
|
* 通过用户ID删除用户
|
||||||
*
|
*
|
||||||
* @param userId 用户ID
|
* @param userId 用户ID
|
||||||
*
|
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public int deleteUserById (Long userId) {
|
public int deleteUserById(Long userId) {
|
||||||
// 删除用户与角色关联
|
// 删除用户与角色关联
|
||||||
userRoleMapper.deleteUserRoleByUserId(userId);
|
userRoleMapper.deleteUserRoleByUserId(userId);
|
||||||
// 删除用户与岗位表
|
// 删除用户与岗位表
|
||||||
|
@ -441,12 +429,11 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||||
* 批量删除用户信息
|
* 批量删除用户信息
|
||||||
*
|
*
|
||||||
* @param userIds 需要删除的用户ID
|
* @param userIds 需要删除的用户ID
|
||||||
*
|
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public int deleteUserByIds (Long[] userIds) {
|
public int deleteUserByIds(Long[] userIds) {
|
||||||
for (Long userId : userIds) {
|
for (Long userId : userIds) {
|
||||||
checkUserAllowed(new SysUser(userId));
|
checkUserAllowed(new SysUser(userId));
|
||||||
checkUserDataScope(userId);
|
checkUserDataScope(userId);
|
||||||
|
@ -464,11 +451,10 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||||
* @param userList 用户数据列表
|
* @param userList 用户数据列表
|
||||||
* @param isUpdateSupport 是否更新支持,如果已存在,则进行更新数据
|
* @param isUpdateSupport 是否更新支持,如果已存在,则进行更新数据
|
||||||
* @param operName 操作用户
|
* @param operName 操作用户
|
||||||
*
|
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String importUser (List<SysUser> userList, Boolean isUpdateSupport, String operName) {
|
public String importUser(List<SysUser> userList, Boolean isUpdateSupport, String operName) {
|
||||||
if (StringUtils.isNull(userList) || userList.size() == 0) {
|
if (StringUtils.isNull(userList) || userList.size() == 0) {
|
||||||
throw new ServiceException("导入用户数据不能为空!");
|
throw new ServiceException("导入用户数据不能为空!");
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -9,7 +9,7 @@ const privateKey = 'MIIBVAIBADANBgkqhkiG9w0BAQEFAASCAT4wggE6AgEAAkEAqhHyZfSsYour
|
||||||
'7Nt+PrgrxkiA50efORdI5U5lsW79MmFnusUA355oaSXcLhu5xxB38SMSyP2KvuKN\n' +
|
'7Nt+PrgrxkiA50efORdI5U5lsW79MmFnusUA355oaSXcLhu5xxB38SMSyP2KvuKN\n' +
|
||||||
'PuH3owIDAQABAkAfoiLyL+Z4lf4Myxk6xUDgLaWGximj20CUf+5BKKnlrK+Ed8gA\n' +
|
'PuH3owIDAQABAkAfoiLyL+Z4lf4Myxk6xUDgLaWGximj20CUf+5BKKnlrK+Ed8gA\n' +
|
||||||
'kM0HqoTt2UZwA5E2MzS4EI2gjfQhz5X28uqxAiEA3wNFxfrCZlSZHb0gn2zDpWow\n' +
|
'kM0HqoTt2UZwA5E2MzS4EI2gjfQhz5X28uqxAiEA3wNFxfrCZlSZHb0gn2zDpWow\n' +
|
||||||
'cSxQAgiCstxGUoOqlW8CIQDDOerGKH5OmCJ4Z21v+F25WaHYPxCFMvwxpcw99Ecv\n' +
|
'cSxQAgiCstxGUoOqlW8CIQDDOerGKH5OmCJ4Z21v+F25WaHYPxCFMvxyrpcw99Ecv\n' +
|
||||||
'DQIgIdhDTIqD2jfYjPTY8Jj3EDGPbH2HHuffvflECt3Ek60CIQCFRlCkHpi7hthh\n' +
|
'DQIgIdhDTIqD2jfYjPTY8Jj3EDGPbH2HHuffvflECt3Ek60CIQCFRlCkHpi7hthh\n' +
|
||||||
'YhovyloRYsM+IS9h/0BzlEAuO0ktMQIgSPT3aFAgJYwKpqRYKlLDVcflZFCKY7u3\n' +
|
'YhovyloRYsM+IS9h/0BzlEAuO0ktMQIgSPT3aFAgJYwKpqRYKlLDVcflZFCKY7u3\n' +
|
||||||
'UP8iWi1Qw0Y='
|
'UP8iWi1Qw0Y='
|
||||||
|
|
|
@ -4,16 +4,16 @@ import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @className: WxApplication ️✈️
|
* @className: xyrApplication ️✈️
|
||||||
* @author: Yang 鹏 🦅
|
* @author: Yang 鹏 🦅
|
||||||
* @date: 2024/9/16 20:39 ⏰
|
* @date: 2024/9/16 20:39 ⏰
|
||||||
* @Version: 1.0
|
* @Version: 1.0
|
||||||
* @description:
|
* @description:
|
||||||
*/
|
*/
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
public class WxApplication {
|
public class xyrApplication {
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
System.out.println("微信服务启动成功");
|
System.out.println("微信服务启动成功");
|
||||||
SpringApplication.run(WxApplication.class);
|
SpringApplication.run(xyrApplication.class);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@ import jakarta.servlet.http.HttpServletRequest;
|
||||||
import lombok.extern.log4j.Log4j2;
|
import lombok.extern.log4j.Log4j2;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
import com.muyu.service.WxService;
|
import com.muyu.service.xyrService;
|
||||||
import com.muyu.util.WechatUtil;
|
import com.muyu.util.WechatUtil;
|
||||||
import io.micrometer.common.util.StringUtils;
|
import io.micrometer.common.util.StringUtils;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
@ -13,7 +13,7 @@ import java.security.NoSuchAlgorithmException;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @className: GetWxController ️✈️
|
* @className: GetxyrController ️✈️
|
||||||
* @author: Yang 鹏 🦅
|
* @author: Yang 鹏 🦅
|
||||||
* @date: 2024/9/16 20:38 ⏰
|
* @date: 2024/9/16 20:38 ⏰
|
||||||
* @Version: 1.0
|
* @Version: 1.0
|
||||||
|
@ -21,13 +21,13 @@ import java.util.*;
|
||||||
*/
|
*/
|
||||||
@Log4j2
|
@Log4j2
|
||||||
@RestController
|
@RestController
|
||||||
public class WxController {
|
public class xyrController {
|
||||||
|
|
||||||
// @Autowired
|
// @Autowired
|
||||||
// private RedisService redisService;
|
// private RedisService redisService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private WxService wxService;
|
private xyrService xyrService;
|
||||||
|
|
||||||
@GetMapping("/")
|
@GetMapping("/")
|
||||||
public String check(@RequestParam("signature") String signature,@RequestParam("timestamp") String timestamp ,
|
public String check(@RequestParam("signature") String signature,@RequestParam("timestamp") String timestamp ,
|
||||||
|
@ -71,7 +71,7 @@ public class WxController {
|
||||||
public String receiveMessage(HttpServletRequest request){
|
public String receiveMessage(HttpServletRequest request){
|
||||||
|
|
||||||
|
|
||||||
String message = wxService.handleMessage(request);
|
String message = xyrService.handleMessage(request);
|
||||||
|
|
||||||
return message;
|
return message;
|
||||||
}
|
}
|
||||||
|
@ -82,17 +82,17 @@ public class WxController {
|
||||||
|
|
||||||
String code = request.getParameter("code");
|
String code = request.getParameter("code");
|
||||||
|
|
||||||
return wxService.getSignUpUserInfo(code);
|
return xyrService.getSignUpUserInfo(code);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@GetMapping("/send")
|
@GetMapping("/send")
|
||||||
public void sendWxMsg(@RequestParam("toUser") String toUser,@RequestParam("content") String content) {
|
public void sendxyrMsg(@RequestParam("toUser") String toUser,@RequestParam("content") String content) {
|
||||||
WechatUtil.send(toUser,content);
|
WechatUtil.send(toUser,content);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// @GetMapping("/getWxUserList")
|
// @GetMapping("/getxyrUserList")
|
||||||
// public List getUserList(){
|
// public List getUserList(){
|
||||||
// String accessToken = TokenUtil.getAccessToken();
|
// String accessToken = TokenUtil.getAccessToken();
|
||||||
// String url="https://api.weixin.qq.com/cgi-bin/user/get?access_token="+accessToken;
|
// String url="https://api.weixin.qq.com/cgi-bin/user/get?access_token="+accessToken;
|
||||||
|
|
|
@ -4,7 +4,7 @@ import com.alibaba.fastjson2.JSONObject;
|
||||||
import com.muyu.domain.Message;
|
import com.muyu.domain.Message;
|
||||||
import com.muyu.domain.SubscribedUser;
|
import com.muyu.domain.SubscribedUser;
|
||||||
|
|
||||||
import com.muyu.service.WxService;
|
import com.muyu.service.xyrService;
|
||||||
import com.muyu.util.OkHttpUtils;
|
import com.muyu.util.OkHttpUtils;
|
||||||
import com.muyu.util.TokenUtil;
|
import com.muyu.util.TokenUtil;
|
||||||
import com.muyu.util.WechatUtil;
|
import com.muyu.util.WechatUtil;
|
||||||
|
@ -24,14 +24,14 @@ import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @className: WxServiceImpl ️✈️
|
* @className: xyrServiceImpl ️✈️
|
||||||
* @author: Yang 鹏 🦅
|
* @author: Yang 鹏 🦅
|
||||||
* @date: 2024/9/18 12:05 ⏰
|
* @date: 2024/9/18 12:05 ⏰
|
||||||
* @Version: 1.0
|
* @Version: 1.0
|
||||||
* @description:
|
* @description:
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class WxServiceImpl implements WxService {
|
public class xyrServiceImpl implements xyrService {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -3,13 +3,13 @@ package com.muyu.service;
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @className: WxService ️✈️
|
* @className: xyrService ️✈️
|
||||||
* @author: Yang 鹏 🦅
|
* @author: Yang 鹏 🦅
|
||||||
* @date: 2024/9/18 12:05 ⏰
|
* @date: 2024/9/18 12:05 ⏰
|
||||||
* @Version: 1.0
|
* @Version: 1.0
|
||||||
* @description:
|
* @description:
|
||||||
*/
|
*/
|
||||||
public interface WxService {
|
public interface xyrService {
|
||||||
String handleMessage(HttpServletRequest request);
|
String handleMessage(HttpServletRequest request);
|
||||||
|
|
||||||
String getSignUpUserInfo(String code);
|
String getSignUpUserInfo(String code);
|
||||||
|
|
|
@ -13,7 +13,7 @@ import org.springframework.stereotype.Component;
|
||||||
*/
|
*/
|
||||||
@Component
|
@Component
|
||||||
public class TokenUtil {
|
public class TokenUtil {
|
||||||
public final static String APP_ID = "wxa10c6f55da3c0553";
|
public final static String APP_ID = "xyra10c6f55da3c0553";
|
||||||
|
|
||||||
public final static String APP_SECRET ="72d285981f3f51274e79dcda5e498a81";
|
public final static String APP_SECRET ="72d285981f3f51274e79dcda5e498a81";
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ server:
|
||||||
#redirect:
|
#redirect:
|
||||||
# domain:123
|
# domain:123
|
||||||
##公众号appId和secret
|
##公众号appId和secret
|
||||||
#wx:
|
#xyr:
|
||||||
# appId:123
|
# appId:123
|
||||||
# secret:123
|
# secret:123
|
||||||
|
|
||||||
|
|
1
pom.xml
1
pom.xml
|
@ -355,7 +355,6 @@
|
||||||
<artifactId>cloud-common-saas</artifactId>
|
<artifactId>cloud-common-saas</artifactId>
|
||||||
<version>${muyu.version}</version>
|
<version>${muyu.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</dependencyManagement>
|
</dependencyManagement>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue