Prechádzať zdrojové kódy

更新标签synsencecode 取消不带参数

xiewenjie 3 rokov pred
rodič
commit
283cad5ac5

+ 6 - 0
pom.xml

@@ -343,6 +343,12 @@
                 <version>3.7.0</version>
             </dependency>
 
+            <dependency>
+                <groupId>com.alibaba</groupId>
+                <artifactId>fastjson</artifactId>
+                <version>1.2.68</version>
+            </dependency>
+
             <!-- 缓存 -->
             <dependency>
                 <groupId>net.oschina.j2cache</groupId>

+ 4 - 1
sxz-base/pom.xml

@@ -268,7 +268,10 @@
             <groupId>net.oschina.j2cache</groupId>
             <artifactId>j2cache-core</artifactId>
         </dependency>
-
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>fastjson</artifactId>
+        </dependency>
         <dependency>
             <groupId>com.github.houbb</groupId>
             <artifactId>sisyphus-springboot-starter</artifactId>

+ 10 - 3
sxz-core/src/main/java/com/fdkk/sxz/webApi/controller/SceneStyleController.java

@@ -205,7 +205,12 @@ public class SceneStyleController extends BaseController {
         //指明请求来源
         Map<String, String> header = new HashMap<>();
         header.put("token", request.getHeader("token"));
-        JSONObject jsonObject = JSON.parseObject(OkHttpUtils.httpGet(mainUrl + "api/scene/synsencecode?sceneNum=" + scene.getSceneNum() + "&vrsceneNum=" + scene.getVrsceneNum(), header));
+        String url = mainUrl + "api/scene/synsencecode?sceneNum=" + scene.getSceneNum();
+        if (styleEntity.getIsDecoration() == 1) {
+            url = url + "&vrsceneNum=" + scene.getVrsceneNum();
+        }
+        String res = OkHttpUtils.httpGet(url, header);
+        JSONObject jsonObject = JSON.parseObject(res);
         if (jsonObject.containsKey("code")) {
             if (jsonObject.getIntValue("code") == 0) {
                 LambdaUpdateWrapper<SceneStyleEntity> updateWrapper = Wrappers.lambdaUpdate();
@@ -215,8 +220,10 @@ public class SceneStyleController extends BaseController {
                         .eq(SceneStyleEntity::getIsDecoration, 1)
                         .set(SceneStyleEntity::getIsDecoration, 0);
                 sceneStyleService.update(updateWrapper);
-                styleEntity.setIsDecoration(1);
-                sceneStyleService.updateById(styleEntity);
+                if (styleEntity.getIsDecoration() == 0) {
+                    styleEntity.setIsDecoration(1);
+                    sceneStyleService.updateById(styleEntity);
+                }
                 return Result.success("成功");
             } else {
                 return Result.failure("失败");