Procházet zdrojové kódy

Merge remote-tracking branch 'origin/master'

zsy před 1 rokem
rodič
revize
95a738db66

+ 2 - 0
src/main/java/com/rf/psychological/rest/ServerController.java

@@ -853,7 +853,9 @@ public class ServerController extends BaseController {
     @GetMapping("scaleInfo/{flag}")
     @ApiOperation("根据flag查询题目检测列表")
     public Result getScaleListByFlag(@PathVariable String flag) {
+        log.info("题目查询开始===================="+DateUtil.current());
         List<ScaleEntity> scaleEntityList = this.scaleService.getScaleByFlag(flag);
+        log.info("题目查询结束===================="+DateUtil.current());
         return success(scaleEntityList);
     }
 

+ 2 - 5
src/main/java/com/rf/psychological/scale/service/impl/ScaleDetailsServiceImpl.java

@@ -1,17 +1,13 @@
 package com.rf.psychological.scale.service.impl;
 
 
-import com.rf.psychological.dao.repository.CategoryRepository;
-import com.rf.psychological.scale.dao.model.CategoryEntity;
 import com.rf.psychological.scale.dao.model.ScaleDetailsEntity;
 import com.rf.psychological.scale.dao.repository.ScaleDetailsRepository;
-import com.rf.psychological.scale.service.CategoryService;
 import com.rf.psychological.scale.service.ScaleDetailsService;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.cache.annotation.Cacheable;
 import org.springframework.stereotype.Service;
 
-import java.util.List;
-
 /**
  * @author zsy
  * @description:量表类别信息管理
@@ -24,6 +20,7 @@ public class ScaleDetailsServiceImpl implements ScaleDetailsService {
     private ScaleDetailsRepository scaleDetailsRepository;
 
     @Override
+    @Cacheable(value = "detail", key = "#flag",unless = "#result == null ")
     public ScaleDetailsEntity getSubjectDetailsByFlag(String flag) {
         return this.scaleDetailsRepository.getSubjectDetailsByFlag(flag);
     }

+ 2 - 0
src/main/java/com/rf/psychological/scale/service/impl/SubjectServiceImpl.java

@@ -4,6 +4,7 @@ import com.rf.psychological.scale.dao.model.SubjectEntity;
 import com.rf.psychological.scale.dao.repository.SubjectRepository;
 import com.rf.psychological.scale.service.SubjectService;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.cache.annotation.Cacheable;
 import org.springframework.data.domain.Page;
 import org.springframework.data.domain.PageRequest;
 import org.springframework.data.jpa.domain.Specification;
@@ -157,6 +158,7 @@ public class SubjectServiceImpl implements SubjectService {
      * @return
      */
     @Override
+    @Cacheable(value = "subject", key = "#flag",unless = "#result == null ")
     public List<SubjectEntity> getSubjectByFlag(String flag) {
         return this.subjectRepository.getSubjectByFlag(flag);
     }

+ 1 - 3
src/main/java/com/rf/psychological/wxpay/controller/PromotionInfoController.java

@@ -7,7 +7,6 @@ import com.rf.psychological.dao.model.CognitiveTaskEntity;
 import com.rf.psychological.scale.dao.model.SubjectEntity;
 import com.rf.psychological.scale.dao.repository.CognitiveTaskRepository;
 import com.rf.psychological.scale.service.SubjectService;
-import com.rf.psychological.scale.service.UserRecordService;
 import com.rf.psychological.security.SafetyProcess;
 import com.rf.psychological.utils.Result;
 import com.rf.psychological.wxpay.model.PromotionInfo;
@@ -45,8 +44,7 @@ public class PromotionInfoController extends BaseController {
     @Autowired
     private SubjectService subjectService;
 
-    @Autowired
-    private UserRecordService userRecordService;
+
 
 
     @Autowired