zsf 1 год назад
Родитель
Сommit
1099a4e4e7

+ 1 - 2
src/main/java/com/rf/psychological/filter/JWTInterceptorPublicConfig.java

@@ -37,9 +37,8 @@ public class JWTInterceptorPublicConfig implements WebMvcConfigurer {
                 "/subjectInfo/getSubjectByFlag/*","/subjectInfo/getSubjectByFlagV2/*","/scaleInfo/*","/record/getRecordByModelPhone","/api/orderInfo/queryOrderDetail/**","/scaleExternalSource/save"};
         String[] wxPay = new String[]{"/api/wx-pay/native/notify","/api/wx-pay/refunds/notify",
                 "/api/wx-pay/getPhone/*","/api/wx-pay/code2openid","/api/wx-pay/h5Pay",
-                "/api/wx-pay/code2openid2","/api/wx-pay/queryOrder/**","/api/promotionInfo/queryPromotionDetail/**","/getWeiboRecordById/**"};
+                "/api/wx-pay/code2openid2","/api/wx-pay/queryOrder/**","/api/promotionInfo/queryPromotionDetail/**","/record/getWeiboRecordById","/record/getWeiboRecordById/**"};
         String[] systemApi = new String[]{"/system/login","/system/loginH5","/system/forgotPassword","/system/registerUser","/system/temporaryUser"};
-        String[] temporarily = new String []{"/category/**","/api/wx-pay/**","/api/wx-pay/code2openid","/api/wx-pay/code2openid2"};
         registry.addInterceptor(jwtInterceptor)
                 .addPathPatterns("/**")
                 .excludePathPatterns("/", "/index**", "/error")

+ 5 - 25
src/main/java/com/rf/psychological/rest/ServerController.java

@@ -908,12 +908,16 @@ public class ServerController extends BaseController {
                 });
             }
             ScaleDetailsEntity scaleDetailsEntity = this.scaleDetailsService.getSubjectDetailsByFlag(flag);
+            if (CollectionUtils.isEmpty(subjectEntityList)){
+                return fail("量表信息不存在,请联系管理员!");
+            }
             scaleDetailsEntity.setTestNum(subjectEntityList.get(0).getTestNum());
             JSONObject jsonObject = new JSONObject();
             jsonObject.put("subjectEntityDto2List", subjectEntityDto2List);
             jsonObject.put("ScaleDetailsEntity", scaleDetailsEntity);
             return success(jsonObject);
         }catch (Exception e){
+            e.printStackTrace();
             log.error(e.getMessage());
             return fail("操作失败");
         }
@@ -1207,31 +1211,7 @@ public class ServerController extends BaseController {
         return success(result);
     }
 
-    /**
-     * 根据id查询测试详细信息
-     *
-     * @return
-     */
-    @SafetyProcess
-    @GetMapping("/getWeiboRecordById")
-    @ApiOperation(value = "根据id查询测试详细信息")
-    public Result getWeiboRecordById(String id) {
-        try {
-            log.info("获取记录开始时间==========================="+DateUtil.current());
-            //获取测试记录信息
-            UserRecordEntity userRecordEntity = this.userRecordService.getUserRecordById(id);
-            if (userRecordEntity == null){
-                return fail("参数错误");
-            }
-            JSONObject result = new JSONObject();
-            result.put("userRecordEntity", userRecordEntity);
-            log.info("获取记录结束时间==========================="+DateUtil.current());
-            return success(result);
-        }catch (Exception e){
-            log.error(e.getMessage());
-            return fail("操作失败");
-        }
-    }
+
 
     //@SafetyProcess
     @PostMapping("/importSubjectByJson")

+ 28 - 15
src/main/java/com/rf/psychological/scale/rest/UserRecordController.java

@@ -1,6 +1,5 @@
 package com.rf.psychological.scale.rest;
 
-import cn.hutool.core.date.DateUnit;
 import cn.hutool.core.date.DateUtil;
 import com.alibaba.fastjson.JSONObject;
 import com.rf.psychological.base.rest.BaseController;
@@ -9,26 +8,18 @@ import com.rf.psychological.scale.dao.model.UserRecordEntity;
 import com.rf.psychological.scale.service.UserRecordService;
 import com.rf.psychological.security.AesEncryptUtils;
 import com.rf.psychological.security.SafetyProcess;
-import com.rf.psychological.utils.Constant;
 import com.rf.psychological.utils.Result;
 import com.rf.psychological.wxpay.model.OrderInfo;
-import com.rf.psychological.wxpay.model.PromotionInfo;
 import com.rf.psychological.wxpay.service.OrderInfoService;
-import com.rf.psychological.wxpay.service.PromotionInfoService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
 import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
 import org.springframework.data.domain.Page;
 import org.springframework.web.bind.annotation.*;
 
-import java.util.List;
-
-import static cn.hutool.core.date.DatePattern.PURE_DATETIME_PATTERN;
-
 
 /**
  * @author zsy
@@ -46,15 +37,9 @@ public class UserRecordController extends BaseController {
     @Autowired
     private UserRecordService userRecordService;
 
-    @Autowired
-    private PromotionInfoService promotionInfoService;
-
     @Autowired
     private OrderInfoService orderInfoService;
 
-    @Value("${spring.profiles.active}")
-    private String profileValue;
-
     /**
      * 微博分享-通过手机号查询测试记录
      * @param jsonParam 参数
@@ -89,6 +74,34 @@ public class UserRecordController extends BaseController {
     }
 
 
+    /**
+     * 根据id查询测试详细信息
+     *
+     * @return
+     */
+    @SafetyProcess
+    @GetMapping("/getWeiboRecordById")
+    @ApiOperation(value = "根据id查询测试详细信息")
+    public Result getWeiboRecordById(@RequestParam(name = "id") String id) {
+        try {
+            log.info("获取记录开始时间==========================="+DateUtil.current());
+            //获取测试记录信息
+            UserRecordEntity userRecordEntity = this.userRecordService.getUserRecordById(id);
+            log.info("获取记录查询时间==========================="+DateUtil.current());
+            if (userRecordEntity == null){
+                return fail("参数错误");
+            }
+            JSONObject result = new JSONObject();
+            result.put("userRecordEntity", userRecordEntity);
+            log.info("获取记录结束时间==========================="+DateUtil.current());
+            return success(result);
+        }catch (Exception e){
+            log.error(e.getMessage());
+            return fail("操作失败");
+        }
+    }
+
+
 
 
 }

+ 1 - 1
src/main/java/com/rf/psychological/scale/service/impl/UserRecordServiceImpl.java

@@ -282,7 +282,7 @@ public class UserRecordServiceImpl implements UserRecordService {
      * @return
      */
     @Override
-    @Cacheable(value = "record", key = "#id")
+    @Cacheable(value = "record", key = "#id",unless = "#result == null ")
     public UserRecordEntity getUserRecordById(String id) {
         return this.userRecordRepository.findUserRecordEntitiesById(id);
     }