Commit bbabec24 authored by zhuangzhuang's avatar zhuangzhuang

修改登录接口

parent 1f0a9cd3
Pipeline #223 passed with stage
in 0 seconds
......@@ -19,7 +19,9 @@ version = '0.0.1-SNAPSHOT'
sourceCompatibility = 1.8
repositories {
mavenCentral()
maven { url 'https://maven.aliyun.com/repository/public/' }
mavenLocal()
mavenCentral()
}
......
......@@ -83,7 +83,14 @@ public class UserService {
return null;
}
String token = DigestUtils.md5Hex(System.currentTimeMillis() + userVo.getUserName());
UserRedisVo redisVo = new UserRedisVo(userVo.getUserName(),userVo.getUserNumber(),userVo.getNickName(),userVo.getEmail(),userVo.getPhone(),userVo.getRoleName(),userVo.getCompanyNo(),userVo.getCompanyName());
UserRedisVo redisVo = new UserRedisVo(userVo.getUserName(),
userVo.getUserNumber(),
userVo.getNickName(),
userVo.getEmail(),
userVo.getPhone(),
userVo.getRoleName(),
userVo.getCompanyName(),
userVo.getCompanyNo());
//将用户数据保存到redis中
redisService.set("TOKEN_" + token, gson.toJson(redisVo), 60 * 30);
return token;
......
......@@ -70,21 +70,20 @@ public class LoginController {
return gson.toJson(fb);
}
try {
UserVo userVo=userService.getByUserName(loginUserVo.getUserName());
//生成token
String token = DigestUtils.md5Hex(System.currentTimeMillis() + userVo.getUserName());
UserRedisVo redisVo = new UserRedisVo(userVo.getUserName(),userVo.getUserNumber(),userVo.getNickName(),userVo.getEmail(),userVo.getPhone(),userVo.getRoleName(),userVo.getCompanyName(),userVo.getCompanyNo());
//将用户数据保存到redis中
userTokenService.setHash(userVo.getUserNumber(),"TOKEN_" + token,System.currentTimeMillis()+"",60*60*24);
tokenRedisService.set("TOKEN_" + token, gson.toJson(redisVo), 60 * 30);
String token = userService.getUser(loginUserVo);
if(token == null){
fb.setCode(0);
fb.setMessage(i18n.getMessage(request, "login"));
return gson.toJson(fb);
}
String ip = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest().getRemoteAddr();
int a=loginLogService.addLoginLog(new LoginLog(loginUserVo.getUserName(),System.currentTimeMillis(),ip));
if (a>0){
int a = loginLogService.addLoginLog(new LoginLog(loginUserVo.getUserName(), System.currentTimeMillis(), ip));
if (a > 0) {
fb.setCode(1);
fb.setMessage(token);
}else{
} else {
fb.setCode(0);
fb.setMessage(i18n.getMessage(request,"addLogFailure"));
fb.setMessage(i18n.getMessage(request, "addLogFailure"));
}
} catch (Exception e) {
e.printStackTrace();
......
......@@ -4,7 +4,6 @@ spring.datasource.username=witcloud
spring.datasource.password=Witcloud37774020
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
tdl.core.add =http://warehouse-herocore:8079/witium/addMount
tdl.core.delete =http://warehouse-herocore:8079/witium/delMount
......@@ -15,15 +14,15 @@ tdl.redis.password=Witium37774020
server.port=8092
# InfluxDB
spring.influxdb.url=https://ts-bp1q738i505oj79t7.influxdata.tsdb.aliyuncs.com:8086
spring.influxdb.username=witcloud
spring.influxdb.password=Witcloud37774020
spring.influxdb.database=warehouse_bosch
#spring.influxdb.url=http://witcloud-influxdb:8086
#spring.influxdb.username=admin
#spring.influxdb.password=37774020
#spring.influxdb.database=original
#spring.influxdb.url=https://ts-bp1q738i505oj79t7.influxdata.tsdb.aliyuncs.com:8086
#spring.influxdb.username=witcloud
#spring.influxdb.password=Witcloud37774020
#spring.influxdb.database=warehouse_bosch
spring.influxdb.url=http://witcloud-influxdb:8086
spring.influxdb.username=admin
spring.influxdb.password=37774020
spring.influxdb.database=original
# MQTT (Aliyun local IP address)
tdl.mqtt.url = ssl://192.168.1.124
......
......@@ -7,7 +7,7 @@ spring.datasource.driver-class-name=com.mysql.jdbc.Driver
threadpool.corepoolsize = 30
threadpool.maxpoolsize = 50
server.port=8092
server.port=8099
management.security.enabled=false
......@@ -51,15 +51,15 @@ tdl.mqtt.clientpwd =
# InfluxDB
spring.influxdb.username=witcloud
spring.influxdb.password=Witcloud37774020
spring.influxdb.url=https://ts-bp1q738i505oj79t7.influxdata.rds.aliyuncs.com:3242
spring.influxdb.database=logistics
#spring.influxdb.url=http://47.97.184.225:8086
#spring.influxdb.username=admin
#spring.influxdb.password=37774020
#spring.influxdb.database=original
#spring.influxdb.username=witcloud
#spring.influxdb.password=Witcloud37774020
#spring.influxdb.url=https://ts-bp1q738i505oj79t7.influxdata.rds.aliyuncs.com:3242
#spring.influxdb.database=logistics
spring.influxdb.url=http://47.97.184.225:8086
spring.influxdb.username=admin
spring.influxdb.password=37774020
spring.influxdb.database=original
spring.influxdb.retentionPolicy = tdl_policy
spring.influxdb.connent-timeout=10
spring.influxdb.read-timeout=30
......
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