|
@@ -0,0 +1,63 @@
|
|
|
+package com.fdkankan.ucenter.controller.inner;
|
|
|
+
|
|
|
+import cn.hutool.core.bean.BeanUtil;
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.fdkankan.common.util.JwtUtil;
|
|
|
+import com.fdkankan.redis.constant.RedisKey;
|
|
|
+import com.fdkankan.redis.util.RedisUtil;
|
|
|
+import com.fdkankan.ucenter.common.BaseController;
|
|
|
+import com.fdkankan.ucenter.common.Result;
|
|
|
+import com.fdkankan.ucenter.entity.ScenePro;
|
|
|
+import com.fdkankan.ucenter.entity.User;
|
|
|
+import com.fdkankan.ucenter.service.ISceneProService;
|
|
|
+import com.fdkankan.ucenter.service.IUserService;
|
|
|
+import com.fdkankan.ucenter.util.WebUtil;
|
|
|
+import java.net.InetAddress;
|
|
|
+import java.net.UnknownHostException;
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.web.bind.annotation.GetMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
+/**
|
|
|
+ * <p>
|
|
|
+ * 内部接口控制器
|
|
|
+ * </p>
|
|
|
+ *
|
|
|
+ * @author dengsixing
|
|
|
+ * @since 2022/8/19
|
|
|
+ **/
|
|
|
+@RestController
|
|
|
+@RequestMapping("/inner")
|
|
|
+public class InnerController extends BaseController {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ISceneProService sceneProService;
|
|
|
+ @Autowired
|
|
|
+ private IUserService userService;
|
|
|
+ @Autowired
|
|
|
+ private RedisUtil redisUtil;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 下载全景图数据
|
|
|
+ */
|
|
|
+ @GetMapping("/createTokenByNum")
|
|
|
+ public Result createTokenByNum(String num) throws Exception{
|
|
|
+
|
|
|
+ ScenePro sceneProEntity = sceneProService.getByNum(num);
|
|
|
+ User user = userService.getById(sceneProEntity.getUserId());
|
|
|
+ String token = JwtUtil.createJWT(-1, user.getUserName(), "user");
|
|
|
+ String redisKey = String.format(RedisKey.TOKEN_V3,token);
|
|
|
+ redisUtil.set(redisKey, JSON.toJSONString(user), RedisKey.EXPIRE_TIME_2_HOUR);
|
|
|
+
|
|
|
+ JSONObject object = new JSONObject();
|
|
|
+ object.put("token", token);
|
|
|
+
|
|
|
+ return Result.success(object);
|
|
|
+ }
|
|
|
+
|
|
|
+}
|