|
@@ -1,5 +1,6 @@
|
|
package com.fdkankan.scene.service.impl;
|
|
package com.fdkankan.scene.service.impl;
|
|
|
|
|
|
|
|
+import cn.hutool.core.collection.CollUtil;
|
|
import cn.hutool.core.io.FileUtil;
|
|
import cn.hutool.core.io.FileUtil;
|
|
import cn.hutool.core.io.IoUtil;
|
|
import cn.hutool.core.io.IoUtil;
|
|
import cn.hutool.core.util.StrUtil;
|
|
import cn.hutool.core.util.StrUtil;
|
|
@@ -42,6 +43,7 @@ import java.io.InputStream;
|
|
import java.net.MalformedURLException;
|
|
import java.net.MalformedURLException;
|
|
import java.net.URL;
|
|
import java.net.URL;
|
|
import java.net.URLConnection;
|
|
import java.net.URLConnection;
|
|
|
|
+import java.util.HashMap;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
import java.util.Objects;
|
|
import java.util.Objects;
|
|
@@ -59,56 +61,20 @@ import java.util.stream.Collectors;
|
|
@Service
|
|
@Service
|
|
public class SceneServiceImpl extends ServiceImpl<SceneMapper, Scene> implements SceneService {
|
|
public class SceneServiceImpl extends ServiceImpl<SceneMapper, Scene> implements SceneService {
|
|
|
|
|
|
- @Value("${spring.cloud.nacos.discovery.access-key}")
|
|
|
|
- private String accessKey;
|
|
|
|
-
|
|
|
|
- @Value("${tieta.checkToken.syscode}")
|
|
|
|
- private String syscode;
|
|
|
|
- @Value("${gateway.key:6#dPz>3F}")
|
|
|
|
- private String gatewayKey;
|
|
|
|
-
|
|
|
|
@Autowired
|
|
@Autowired
|
|
private SceneFileMappingService sceneFileMappingService;
|
|
private SceneFileMappingService sceneFileMappingService;
|
|
@Autowired
|
|
@Autowired
|
|
private RedisClient redisClient;
|
|
private RedisClient redisClient;
|
|
@Resource
|
|
@Resource
|
|
- private TietaFeignClient tietaFeignClient;
|
|
|
|
- @Autowired
|
|
|
|
- private WS4AServiceClient ws4AServiceClient;
|
|
|
|
- @Resource
|
|
|
|
private CustomHttpClient customHttpClient;
|
|
private CustomHttpClient customHttpClient;
|
|
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public ResultData getSceneInfo(SceneInfoParamVO param) throws Exception {
|
|
public ResultData getSceneInfo(SceneInfoParamVO param) throws Exception {
|
|
-
|
|
|
|
- String token = param.getToken();
|
|
|
|
- String acctId = param.getAcctId();
|
|
|
|
-
|
|
|
|
- JSONObject checkProwadaTokenParam = new JSONObject();
|
|
|
|
- JSONObject params = new JSONObject();
|
|
|
|
- params.put("SYSCODE", syscode);
|
|
|
|
- params.put("ACCTID", acctId);
|
|
|
|
- params.put("TOKEN", token);
|
|
|
|
-
|
|
|
|
- String encode = ThreeDESUtil.encode(JSON.toJSONString(params), gatewayKey);
|
|
|
|
- checkProwadaTokenParam.put("args", encode);
|
|
|
|
-
|
|
|
|
-// JSONObject result = ws4AServiceClient.checkProwadaToken(checkProwadaTokenParam);
|
|
|
|
-// log.info("场景:{},4A校验token结果:{}", param.getNum(), result);
|
|
|
|
-// if("success".equals(result.getString("SUCCESS"))){
|
|
|
|
-// return ResultData.error(4000, "4A鉴权失败");
|
|
|
|
-// }
|
|
|
|
-// String data = result.getString("data");
|
|
|
|
-// JSONObject dataObj = JSONObject.parseObject(data);
|
|
|
|
-// if(!"0".equals(dataObj.getString("RSP"))){
|
|
|
|
-// return ResultData.error(4000, dataObj.getString("ERRDESC"));
|
|
|
|
-// }
|
|
|
|
-
|
|
|
|
String num = param.getNum();
|
|
String num = param.getNum();
|
|
SceneInfoVO sceneInfoVO = null;
|
|
SceneInfoVO sceneInfoVO = null;
|
|
String key = String.format(RedisKey.SCENE_JSON, num);
|
|
String key = String.format(RedisKey.SCENE_JSON, num);
|
|
- String sceneJson = redisClient.get(key);
|
|
|
|
|
|
+ String sceneJson = null;//redisClient.get(key);
|
|
if(StrUtil.isNotEmpty(sceneJson)){
|
|
if(StrUtil.isNotEmpty(sceneJson)){
|
|
sceneInfoVO = JSON.parseObject(sceneJson, SceneInfoVO.class);
|
|
sceneInfoVO = JSON.parseObject(sceneJson, SceneInfoVO.class);
|
|
sceneInfoVO.getControls().setShowRule(1);
|
|
sceneInfoVO.getControls().setShowRule(1);
|
|
@@ -116,10 +82,11 @@ public class SceneServiceImpl extends ServiceImpl<SceneMapper, Scene> implements
|
|
sceneInfoVO.getControls().setShowDollhouse(0);
|
|
sceneInfoVO.getControls().setShowDollhouse(0);
|
|
sceneInfoVO.setFloorLogo("2");
|
|
sceneInfoVO.setFloorLogo("2");
|
|
}else{
|
|
}else{
|
|
- Scene scene = this.getOne(new LambdaQueryWrapper<Scene>().eq(Scene::getNum, num));
|
|
|
|
- if(Objects.isNull(scene)){
|
|
|
|
|
|
+ List<Scene> list = this.list(new LambdaQueryWrapper<Scene>().eq(Scene::getNum, num).orderByDesc(Scene::getId));
|
|
|
|
+ if(CollUtil.isEmpty(list)){
|
|
return ResultData.error(ErrorCode.FAILURE_CODE_5005.code(), ErrorCode.FAILURE_CODE_5005.message());
|
|
return ResultData.error(ErrorCode.FAILURE_CODE_5005.code(), ErrorCode.FAILURE_CODE_5005.message());
|
|
}
|
|
}
|
|
|
|
+ Scene scene = list.get(0);
|
|
sceneInfoVO = new SceneInfoVO();
|
|
sceneInfoVO = new SceneInfoVO();
|
|
sceneInfoVO.setTitle(scene.getTitle());
|
|
sceneInfoVO.setTitle(scene.getTitle());
|
|
sceneInfoVO.setNum(scene.getNum());
|
|
sceneInfoVO.setNum(scene.getNum());
|
|
@@ -136,10 +103,14 @@ public class SceneServiceImpl extends ServiceImpl<SceneMapper, Scene> implements
|
|
redisClient.add(key, JSON.toJSONString(sceneInfoVO));
|
|
redisClient.add(key, JSON.toJSONString(sceneInfoVO));
|
|
}
|
|
}
|
|
|
|
|
|
- List<SceneFileMapping> mappingList = sceneFileMappingService.list(new LambdaQueryWrapper<SceneFileMapping>().eq(SceneFileMapping::getNum, num));
|
|
|
|
- Map<String, String> keyMap = mappingList.stream().collect(Collectors.toMap(SceneFileMapping::getKey, v->{
|
|
|
|
- return "service/scene/file?key=" + v.getKey();
|
|
|
|
- }));
|
|
|
|
|
|
+ List<SceneFileMapping> mappingList = sceneFileMappingService.list(new LambdaQueryWrapper<SceneFileMapping>().eq(SceneFileMapping::getNum, num).orderByAsc(SceneFileMapping::getId));
|
|
|
|
+ Map<String, String> keyMap = new HashMap<>();
|
|
|
|
+ for (SceneFileMapping sceneFileMapping : mappingList) {
|
|
|
|
+ keyMap.put(sceneFileMapping.getKey(), "service/scene/file?key=" + sceneFileMapping.getKey());
|
|
|
|
+ }
|
|
|
|
+// Map<String, String> keyMap = mappingList.stream().collect(Collectors.toMap(SceneFileMapping::getKey, v->{
|
|
|
|
+// return "service/scene/file?key=" + v.getKey();
|
|
|
|
+// }));
|
|
sceneInfoVO.setMapping(keyMap);
|
|
sceneInfoVO.setMapping(keyMap);
|
|
|
|
|
|
return ResultData.ok(sceneInfoVO);
|
|
return ResultData.ok(sceneInfoVO);
|
|
@@ -190,8 +161,8 @@ public class SceneServiceImpl extends ServiceImpl<SceneMapper, Scene> implements
|
|
|
|
|
|
JSONObject params2 = new JSONObject();
|
|
JSONObject params2 = new JSONObject();
|
|
params2.put("SERVICEID", "CHNTZCGL_ZCSZHGL");
|
|
params2.put("SERVICEID", "CHNTZCGL_ZCSZHGL");
|
|
- params2.put("LOGINACCOUNT", "wx-sunql3");
|
|
|
|
- params2.put("TOKEN", "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJSRVMiLCJpc3MiOiJXUzRBIiwiZXhwIjoxNzI3MTQ3NzYyLCJOQU5PU0VDT05EIjozNTg1Mjg3ODI1NDgzNzY1NH0.vY_MWgkiPazz6KPRlSVb2-WGiwhLnxTVhsCtNzxiTlY");
|
|
|
|
|
|
+ params2.put("LOGINACCOUNT", "yangqc");
|
|
|
|
+ params2.put("TOKEN", "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJSRVMiLCJpc3MiOiJXUzRBIiwiZXhwIjoxNzI3NTc3Mzc2LCJOQU5PU0VDT05EIjozNjI4MjQ5MTc2NjM4MDAzMX0.fbTCdbjMTOD6NywkuKGtsOnQdmFI7PiU4g8mEiLQ5wQ");
|
|
encode = ThreeDESUtil.encode(params2.toString(), "6#dPz>3F");
|
|
encode = ThreeDESUtil.encode(params2.toString(), "6#dPz>3F");
|
|
System.out.println(encode);
|
|
System.out.println(encode);
|
|
|
|
|