瀏覽代碼

修改查询

xiewenjie 3 年之前
父節點
當前提交
0f15756ca6

+ 1 - 1
sxz-base/src/main/java/com/fdkk/sxz/util/OkHttpUtils.java

@@ -265,7 +265,7 @@ public class OkHttpUtils {
         } catch (IOException e) {
             throw new RuntimeException("同步http请求失败,url:" + url, e);
         }
-        return null;
+        return new JSONObject();
     }
 
     /**

+ 18 - 6
sxz-core/src/main/java/com/fdkk/sxz/webApi/controller/SceneStyleController.java

@@ -2,7 +2,6 @@ package com.fdkk.sxz.webApi.controller;
 
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.util.ObjectUtil;
-import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
@@ -198,8 +197,10 @@ public class SceneStyleController extends BaseController {
     @NoAuthentication
     @AroundLog(name = "根据场景码获取风格列表")
     public Result getIssueList(@RequestBody RequestSceneStyle style) {
+
         LambdaQueryWrapper<SceneStyleEntity> wrapper = Wrappers.lambdaQuery();
         wrapper.eq(SceneStyleEntity::getSceneNum, style.getSceneNum());
+        wrapper.ne(SceneStyleEntity::getSceneNum, style.getVrSceneNum());
         wrapper.eq(SceneStyleEntity::getIssue, 1);
         List<SceneStyleEntity> list = sceneStyleService.list(wrapper);
         List<ResponseSceneStyleIssue> collect = list.stream().map(a -> {
@@ -207,7 +208,17 @@ public class SceneStyleController extends BaseController {
             BeanUtil.copyProperties(a, vo);
             return vo;
         }).collect(Collectors.toList());
-        return Result.success(collect);
+
+        LambdaQueryWrapper<SceneStyleEntity> onewrapper = Wrappers.lambdaQuery();
+        onewrapper.eq(SceneStyleEntity::getStyleNum, style.getVrSceneNum());
+        onewrapper.eq(SceneStyleEntity::getIssue, 1);
+        onewrapper.orderByDesc(SceneStyleEntity::getNum);
+        SceneStyleEntity one = sceneStyleService.getOne(wrapper);
+        JSONObject res = new JSONObject();
+        res.put("title", one.getStyleName());
+        res.put("styleList", collect);
+
+        return Result.success(res);
     }
 
     /**
@@ -270,12 +281,13 @@ public class SceneStyleController extends BaseController {
         //指明请求来源
         Map<String, String> header = new HashMap<>();
         header.put("token", request.getHeader("token"));
-        String url = mainUrl + "api/scene/synsencecode?sceneNum=" + scene.getSceneNum();
+        JSONObject params = new JSONObject();
+        params.put("sceneNum", scene.getSceneNum());
         if (styleEntity.getIsDecoration() == 0) {
-            url = url + "&vrsceneNum=" + scene.getVrsceneNum() + "&thumb=" + styleEntity.getThumb();
+            params.put("vrSceneNum", scene.getVrsceneNum());
+            params.put("vrThumb", styleEntity.getThumb());
         }
-        String res = OkHttpUtils.httpGet(url, header);
-        JSONObject jsonObject = JSON.parseObject(res);
+        JSONObject jsonObject = OkHttpUtils.httpPostJson(mainUrl + "api/scene/synsencecode", params.toJSONString(), header);
         if (jsonObject.containsKey("code")) {
             if (jsonObject.getIntValue("code") == 0) {
                 LambdaUpdateWrapper<SceneStyleEntity> updateWrapper = Wrappers.lambdaUpdate();

+ 2 - 0
sxz-modules/src/main/java/com/fdkk/sxz/vo/request/RequestSceneStyle.java

@@ -16,4 +16,6 @@ public class RequestSceneStyle extends RequestBase {
     private String styleNum;
 
     private String styleName;
+
+    private String vrSceneNum;
 }