|
|
@@ -1,27 +1,25 @@
|
|
|
package com.mokamrp.privates.service.pangu.impl;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
-import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.mokamrp.privates.constant.RedisKey;
|
|
|
+import com.mokamrp.privates.entity.PostBasePageHandle;
|
|
|
import com.mokamrp.privates.entity.pangu.LoginStationHandle;
|
|
|
-import com.mokamrp.privates.mapper.pangu.pojo.FosterwxStation;
|
|
|
import com.mokamrp.privates.mapper.pangu.FosterwxStationMapper;
|
|
|
+import com.mokamrp.privates.mapper.pangu.pojo.FosterwxStation;
|
|
|
import com.mokamrp.privates.service.pangu.FosterwxStationService;
|
|
|
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.mokamrp.privates.utils.StringUtils;
|
|
|
import com.mokamrp.privates.utils.sign.Base64;
|
|
|
import com.mokamrp.privates.utils.sign.Md5Utils;
|
|
|
-import io.netty.util.internal.shaded.org.jctools.queues.MpscArrayQueue;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
-import com.mokamrp.privates.entity.PostBasePageHandle;
|
|
|
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.beans.factory.annotation.Value;
|
|
|
|
|
|
-import java.nio.charset.StandardCharsets;
|
|
|
-import java.util.*;
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
|
|
|
/**
|
|
|
* <p>
|
|
|
@@ -39,6 +37,7 @@ public class FosterwxStationServiceImpl extends ServiceImpl<FosterwxStationMappe
|
|
|
|
|
|
@Autowired
|
|
|
public StringRedisTemplate stringRedisTemplate;
|
|
|
+
|
|
|
/**
|
|
|
* 获取数据列表 支持分页
|
|
|
* @param handle
|
|
|
@@ -60,30 +59,30 @@ public class FosterwxStationServiceImpl extends ServiceImpl<FosterwxStationMappe
|
|
|
* @param loginStationHandle
|
|
|
* @return
|
|
|
*/
|
|
|
- public Map<String,Object>login(LoginStationHandle loginStationHandle){
|
|
|
+ public Map<String, Object> login(LoginStationHandle loginStationHandle) {
|
|
|
FosterwxStation fosterwxStation = this.getOne(new QueryWrapper<FosterwxStation>()
|
|
|
// .eq("id",loginStationHandle.getStationId())
|
|
|
- .eq("login_username",loginStationHandle.getUsername())
|
|
|
+ .eq("login_username", loginStationHandle.getUsername())
|
|
|
);
|
|
|
- Map<String,Object> res = new HashMap<>();
|
|
|
- res.put("msg","");
|
|
|
- res.put("data","");
|
|
|
- res.put("token","");
|
|
|
- if (fosterwxStation == null){
|
|
|
- res.put("msg","账户不存在");
|
|
|
+ Map<String, Object> res = new HashMap<>();
|
|
|
+ res.put("msg", "");
|
|
|
+ res.put("data", "");
|
|
|
+ res.put("token", "");
|
|
|
+ if (fosterwxStation == null) {
|
|
|
+ res.put("msg", "账户不存在");
|
|
|
return res;
|
|
|
}
|
|
|
- if (!loginStationHandle.getPassword().equals(fosterwxStation.getLoginPassword())){
|
|
|
- res.put("msg","密码不正确");
|
|
|
+ if (!loginStationHandle.getPassword().equals(fosterwxStation.getLoginPassword())) {
|
|
|
+ res.put("msg", "密码不正确");
|
|
|
return res;
|
|
|
}
|
|
|
String token = Md5Utils.hash(loginStationHandle.getUsername()) + StringUtils.getRandomString(6);
|
|
|
fosterwxStation.setLoginPassword("*********");
|
|
|
- res.put("data",fosterwxStation);
|
|
|
- res.put("msg","登录成功");
|
|
|
- res.put("token",token);
|
|
|
+ res.put("data", fosterwxStation);
|
|
|
+ res.put("msg", "登录成功");
|
|
|
+ res.put("token", token);
|
|
|
String jsonStr = JSON.toJSONString(fosterwxStation);
|
|
|
- stringRedisTemplate.opsForValue().set(RedisKey.PanStationToken+token,jsonStr);
|
|
|
+ stringRedisTemplate.opsForValue().set(RedisKey.PanStationToken + token, jsonStr);
|
|
|
return res;
|
|
|
}
|
|
|
|
|
|
@@ -92,12 +91,12 @@ public class FosterwxStationServiceImpl extends ServiceImpl<FosterwxStationMappe
|
|
|
* @param token
|
|
|
* @return
|
|
|
*/
|
|
|
- public FosterwxStation getAuthInfo(String token){
|
|
|
- String jsonStr = stringRedisTemplate.opsForValue().get(RedisKey.PanStationToken+token);
|
|
|
- if (jsonStr == null || jsonStr.isEmpty()){
|
|
|
+ public FosterwxStation getAuthInfo(String token) {
|
|
|
+ String jsonStr = stringRedisTemplate.opsForValue().get(RedisKey.PanStationToken + token);
|
|
|
+ if (jsonStr == null || jsonStr.isEmpty()) {
|
|
|
return null;
|
|
|
}
|
|
|
- FosterwxStation fosterwxStation = JSON.parseObject(jsonStr,FosterwxStation.class);
|
|
|
+ FosterwxStation fosterwxStation = JSON.parseObject(jsonStr, FosterwxStation.class);
|
|
|
return fosterwxStation;
|
|
|
}
|
|
|
|
|
|
@@ -107,10 +106,10 @@ public class FosterwxStationServiceImpl extends ServiceImpl<FosterwxStationMappe
|
|
|
* @param stationId
|
|
|
* @return
|
|
|
*/
|
|
|
- public String makeBoxShareUrl(String boxShareUrl,String stationId,String stationName){
|
|
|
- String key = StringUtils.getRandomString(10)+stationId+StringUtils.getRandomString(5);
|
|
|
+ public String makeBoxShareUrl(String stationId, String stationName) {
|
|
|
+ String key = StringUtils.getRandomString(10) + stationId + "-" + stationName + StringUtils.getRandomString(5);
|
|
|
byte[] keyB = key.getBytes();
|
|
|
- String newBoxShareUrl = boxShareUrl + "?station="+ Base64.encode(keyB)+"&stationName="+Base64.encode(stationName.getBytes(StandardCharsets.UTF_8));
|
|
|
- return newBoxShareUrl;
|
|
|
+ // String newBoxShareUrl = boxShareUrl + "?station=" + Base64.encode(keyB) + "&stationName=" + Base64.encode(stationName.getBytes(StandardCharsets.UTF_8));
|
|
|
+ return Base64.encode(keyB);
|
|
|
}
|
|
|
}
|