xiangjincheng_branch
向金成 2 years ago
parent 7dd91c9310
commit 045afd2f75

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.15.2">
<CLASSES>
<root url="jar://$PROJECT_DIR$/../../../../Maven/repository/com/fasterxml/jackson/dataformat/jackson-dataformat-yaml/2.15.2/jackson-dataformat-yaml-2.15.2.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$PROJECT_DIR$/../../../../Maven/repository/com/fasterxml/jackson/dataformat/jackson-dataformat-yaml/2.15.2/jackson-dataformat-yaml-2.15.2-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$PROJECT_DIR$/../../../../Maven/repository/com/fasterxml/jackson/dataformat/jackson-dataformat-yaml/2.15.2/jackson-dataformat-yaml-2.15.2-sources.jar!/" />
</SOURCES>
</library>
</component>

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: com.google.code.findbugs:jsr305:3.0.2">
<CLASSES>
<root url="jar://$PROJECT_DIR$/../../../../Maven/repository/com/google/code/findbugs/jsr305/3.0.2/jsr305-3.0.2.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$PROJECT_DIR$/../../../../Maven/repository/com/google/code/findbugs/jsr305/3.0.2/jsr305-3.0.2-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$PROJECT_DIR$/../../../../Maven/repository/com/google/code/findbugs/jsr305/3.0.2/jsr305-3.0.2-sources.jar!/" />
</SOURCES>
</library>
</component>

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: com.google.errorprone:error_prone_annotations:2.3.4">
<CLASSES>
<root url="jar://$PROJECT_DIR$/../../../../Maven/repository/com/google/errorprone/error_prone_annotations/2.3.4/error_prone_annotations-2.3.4.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$PROJECT_DIR$/../../../../Maven/repository/com/google/errorprone/error_prone_annotations/2.3.4/error_prone_annotations-2.3.4-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$PROJECT_DIR$/../../../../Maven/repository/com/google/errorprone/error_prone_annotations/2.3.4/error_prone_annotations-2.3.4-sources.jar!/" />
</SOURCES>
</library>
</component>

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: com.google.guava:failureaccess:1.0.1">
<CLASSES>
<root url="jar://$PROJECT_DIR$/../../../../Maven/repository/com/google/guava/failureaccess/1.0.1/failureaccess-1.0.1.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$PROJECT_DIR$/../../../../Maven/repository/com/google/guava/failureaccess/1.0.1/failureaccess-1.0.1-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$PROJECT_DIR$/../../../../Maven/repository/com/google/guava/failureaccess/1.0.1/failureaccess-1.0.1-sources.jar!/" />
</SOURCES>
</library>
</component>

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: com.google.guava:guava:29.0-jre">
<CLASSES>
<root url="jar://$PROJECT_DIR$/../../../../Maven/repository/com/google/guava/guava/29.0-jre/guava-29.0-jre.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$PROJECT_DIR$/../../../../Maven/repository/com/google/guava/guava/29.0-jre/guava-29.0-jre-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$PROJECT_DIR$/../../../../Maven/repository/com/google/guava/guava/29.0-jre/guava-29.0-jre-sources.jar!/" />
</SOURCES>
</library>
</component>

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava">
<CLASSES>
<root url="jar://$PROJECT_DIR$/../../../../Maven/repository/com/google/guava/listenablefuture/9999.0-empty-to-avoid-conflict-with-guava/listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$PROJECT_DIR$/../../../../Maven/repository/com/google/guava/listenablefuture/9999.0-empty-to-avoid-conflict-with-guava/listenablefuture-9999.0-empty-to-avoid-conflict-with-guava-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$PROJECT_DIR$/../../../../Maven/repository/com/google/guava/listenablefuture/9999.0-empty-to-avoid-conflict-with-guava/listenablefuture-9999.0-empty-to-avoid-conflict-with-guava-sources.jar!/" />
</SOURCES>
</library>
</component>

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: com.google.j2objc:j2objc-annotations:1.3">
<CLASSES>
<root url="jar://$PROJECT_DIR$/../../../../Maven/repository/com/google/j2objc/j2objc-annotations/1.3/j2objc-annotations-1.3.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$PROJECT_DIR$/../../../../Maven/repository/com/google/j2objc/j2objc-annotations/1.3/j2objc-annotations-1.3-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$PROJECT_DIR$/../../../../Maven/repository/com/google/j2objc/j2objc-annotations/1.3/j2objc-annotations-1.3-sources.jar!/" />
</SOURCES>
</library>
</component>

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: io.netty:netty-codec-dns:4.1.94.Final">
<CLASSES>
<root url="jar://$PROJECT_DIR$/../../../../Maven/repository/io/netty/netty-codec-dns/4.1.94.Final/netty-codec-dns-4.1.94.Final.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$PROJECT_DIR$/../../../../Maven/repository/io/netty/netty-codec-dns/4.1.94.Final/netty-codec-dns-4.1.94.Final-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$PROJECT_DIR$/../../../../Maven/repository/io/netty/netty-codec-dns/4.1.94.Final/netty-codec-dns-4.1.94.Final-sources.jar!/" />
</SOURCES>
</library>
</component>

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: io.netty:netty-resolver-dns:4.1.94.Final">
<CLASSES>
<root url="jar://$PROJECT_DIR$/../../../../Maven/repository/io/netty/netty-resolver-dns/4.1.94.Final/netty-resolver-dns-4.1.94.Final.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$PROJECT_DIR$/../../../../Maven/repository/io/netty/netty-resolver-dns/4.1.94.Final/netty-resolver-dns-4.1.94.Final-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$PROJECT_DIR$/../../../../Maven/repository/io/netty/netty-resolver-dns/4.1.94.Final/netty-resolver-dns-4.1.94.Final-sources.jar!/" />
</SOURCES>
</library>
</component>

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: io.reactivex.rxjava3:rxjava:3.1.6">
<CLASSES>
<root url="jar://$PROJECT_DIR$/../../../../Maven/repository/io/reactivex/rxjava3/rxjava/3.1.6/rxjava-3.1.6.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$PROJECT_DIR$/../../../../Maven/repository/io/reactivex/rxjava3/rxjava/3.1.6/rxjava-3.1.6-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$PROJECT_DIR$/../../../../Maven/repository/io/reactivex/rxjava3/rxjava/3.1.6/rxjava-3.1.6-sources.jar!/" />
</SOURCES>
</library>
</component>

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: javax.cache:cache-api:1.1.1">
<CLASSES>
<root url="jar://$PROJECT_DIR$/../../../../Maven/repository/javax/cache/cache-api/1.1.1/cache-api-1.1.1.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$PROJECT_DIR$/../../../../Maven/repository/javax/cache/cache-api/1.1.1/cache-api-1.1.1-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$PROJECT_DIR$/../../../../Maven/repository/javax/cache/cache-api/1.1.1/cache-api-1.1.1-sources.jar!/" />
</SOURCES>
</library>
</component>

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.checkerframework:checker-qual:2.11.1">
<CLASSES>
<root url="jar://$PROJECT_DIR$/../../../../Maven/repository/org/checkerframework/checker-qual/2.11.1/checker-qual-2.11.1.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$PROJECT_DIR$/../../../../Maven/repository/org/checkerframework/checker-qual/2.11.1/checker-qual-2.11.1-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$PROJECT_DIR$/../../../../Maven/repository/org/checkerframework/checker-qual/2.11.1/checker-qual-2.11.1-sources.jar!/" />
</SOURCES>
</library>
</component>

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.jboss.marshalling:jboss-marshalling:2.0.10.Final">
<CLASSES>
<root url="jar://$PROJECT_DIR$/../../../../Maven/repository/org/jboss/marshalling/jboss-marshalling/2.0.10.Final/jboss-marshalling-2.0.10.Final.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$PROJECT_DIR$/../../../../Maven/repository/org/jboss/marshalling/jboss-marshalling/2.0.10.Final/jboss-marshalling-2.0.10.Final-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$PROJECT_DIR$/../../../../Maven/repository/org/jboss/marshalling/jboss-marshalling/2.0.10.Final/jboss-marshalling-2.0.10.Final-sources.jar!/" />
</SOURCES>
</library>
</component>

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.jboss.marshalling:jboss-marshalling-river:2.0.10.Final">
<CLASSES>
<root url="jar://$PROJECT_DIR$/../../../../Maven/repository/org/jboss/marshalling/jboss-marshalling-river/2.0.10.Final/jboss-marshalling-river-2.0.10.Final.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$PROJECT_DIR$/../../../../Maven/repository/org/jboss/marshalling/jboss-marshalling-river/2.0.10.Final/jboss-marshalling-river-2.0.10.Final-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$PROJECT_DIR$/../../../../Maven/repository/org/jboss/marshalling/jboss-marshalling-river/2.0.10.Final/jboss-marshalling-river-2.0.10.Final-sources.jar!/" />
</SOURCES>
</library>
</component>

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.jodd:jodd-bean:5.1.6">
<CLASSES>
<root url="jar://$PROJECT_DIR$/../../../../Maven/repository/org/jodd/jodd-bean/5.1.6/jodd-bean-5.1.6.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$PROJECT_DIR$/../../../../Maven/repository/org/jodd/jodd-bean/5.1.6/jodd-bean-5.1.6-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$PROJECT_DIR$/../../../../Maven/repository/org/jodd/jodd-bean/5.1.6/jodd-bean-5.1.6-sources.jar!/" />
</SOURCES>
</library>
</component>

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.jodd:jodd-core:5.1.6">
<CLASSES>
<root url="jar://$PROJECT_DIR$/../../../../Maven/repository/org/jodd/jodd-core/5.1.6/jodd-core-5.1.6.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$PROJECT_DIR$/../../../../Maven/repository/org/jodd/jodd-core/5.1.6/jodd-core-5.1.6-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$PROJECT_DIR$/../../../../Maven/repository/org/jodd/jodd-core/5.1.6/jodd-core-5.1.6-sources.jar!/" />
</SOURCES>
</library>
</component>

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.redisson:redisson:3.14.1">
<CLASSES>
<root url="jar://$PROJECT_DIR$/../../../../Maven/repository/org/redisson/redisson/3.14.1/redisson-3.14.1.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$PROJECT_DIR$/../../../../Maven/repository/org/redisson/redisson/3.14.1/redisson-3.14.1-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$PROJECT_DIR$/../../../../Maven/repository/org/redisson/redisson/3.14.1/redisson-3.14.1-sources.jar!/" />
</SOURCES>
</library>
</component>

@ -0,0 +1,5 @@
t java:S120"ZRename this package name to match the regular expression '^[a-z_]+(\.[a-z_][a-z0-9_]*)*$'.(³Ãôíþÿÿÿÿ
F
java:S1128
"+Remove this unused import 'java.util.List'.(Õë±Äøÿÿÿÿ

@ -0,0 +1,10 @@
t java:S120"ZRename this package name to match the regular expression '^[a-z_]+(\.[a-z_][a-z0-9_]*)*$'.(<28>Ž×Úýÿÿÿÿ
S java:S106"9Replace this use of System.out or System.err by a logger.(Îù—´þÿÿÿÿ
A
java:S1075"&Remove this hard-coded path-delimiter.(”™Œ‚þÿÿÿÿ
I
java:S1128"3Remove this unused import 'java.io.BufferedReader'.(€é²Å
L
java:S1128
"6Remove this unused import 'java.io.InputStreamReader'.(ãˆÎÉ

@ -0,0 +1,23 @@
J
java:S3740"/Provide the parametrized type for this generic.(£ü‰üÿÿÿÿÿ
t java:S120"ZRename this package name to match the regular expression '^[a-z_]+(\.[a-z_][a-z0-9_]*)*$'.(<28>Ž×Úýÿÿÿÿ
S
java:S2589<18>"7Remove this expression which always evaluates to "true"( äôóüÿÿÿÿ
S java:S106N"9Replace this use of System.out or System.err by a logger.(»œ¯µÿÿÿÿÿ
S java:S106O"9Replace this use of System.out or System.err by a logger.(˼ü™ûÿÿÿÿ
N java:S106]"9Replace this use of System.out or System.err by a logger.(ÁÞˆ<C39E>
N java:S106k"9Replace this use of System.out or System.err by a logger.(ÁÉã™
T java:S106<18>"9Replace this use of System.out or System.err by a logger.(‹žˆ¢úÿÿÿÿ
N java:S106"9Replace this use of System.out or System.err by a logger.(ÇÆ´7
T java:S106ž"9Replace this use of System.out or System.err by a logger.(㘘¨þÿÿÿÿ
O java:S106ª"9Replace this use of System.out or System.err by a logger.(¼‘œ
N java:S106»"9Replace this use of System.out or System.err by a logger.(Ü<>Å
T java:S106¼"9Replace this use of System.out or System.err by a logger.(£äЯùÿÿÿÿ
O java:S106É"9Replace this use of System.out or System.err by a logger.(žðíÔ
O java:S106Õ"9Replace this use of System.out or System.err by a logger.(³¦É‚
g
java:S1128 "LRemove this unused import 'org.springframework.cache.annotation.CacheEvict'.(½Á¨ˆøÿÿÿÿ
e
java:S1128
"JRemove this unused import 'org.springframework.cache.annotation.CachePut'.(ý≠þÿÿÿÿ

@ -1,2 +1,2 @@
{ java:S120"ZRename this package name to match the regular expression '^[a-z_]+(\.[a-z_][a-z0-9_]*)*$'.(±ÖÀ—úÿÿÿÿ8ã„Ñï¥1
{ java:S120"ZRename this package name to match the regular expression '^[a-z_]+(\.[a-z_][a-z0-9_]*)*$'.(±ÖÀ—úÿÿÿÿ8ó‹Ã©¯1

@ -0,0 +1,7 @@
t java:S120"ZRename this package name to match the regular expression '^[a-z_]+(\.[a-z_][a-z0-9_]*)*$'.(­œ¡ üÿÿÿÿ
a
java:S1128 "KRemove this unused import 'org.springframework.cache.annotation.Cacheable'.(ݺؓ
i
java:S1128
"NRemove this unused import 'org.springframework.data.redis.core.RedisTemplate'.(–ª¡Çøÿÿÿÿ

@ -1,6 +1,4 @@
w
Gspringboot/src/main/java/com/xht/springboot/Dao/PersonalHomeMapper.java,8\e\8ea61bcc473345da7a8363076b3ae562bc76fedc
z
Jspringboot/src/main/java/com/xht/springboot/pythonspider/PythonSpider.java,8\2\82d065e13dbb46b69838db763af0105eec47337f
{
@ -25,8 +23,6 @@ B
test_model/pom.xml,c\5\c5247f1a7a8da981f49c6fe2b5fc0ba5e9b426bb
q
Aspringboot/src/main/java/com/xht/springboot/Entity/UserLogin.java,1\3\139a0da36daad8c438a5607ee212d1f38a505779
B
springboot/pom.xml,e\4\e46aee6c7c512a7b48980a296fca0acf004a1907
r
Bspringboot/src/main/java/com/xht/springboot/Dao/WebHomeMapper.java,2\a\2ad2a1260dac6c01c8b352bb0e2ca62f513676a9
p
@ -37,3 +33,13 @@ q
Aspringboot/src/main/java/com/xht/springboot/Entity/UserReply.java,0\5\051eaf551b928a8ccf651611c070ebb2b8155264
l
<test_model/src/main/java/org/example/python/output_result.py,c\f\cf2b6f7a1e504e3a80407b7fb223ab50a8c9f4bf
z
Jspringboot/src/main/java/com/xht/springboot/Control/WebHomeController.java,e\d\edeacc9d294f3b307d4238fb3f381c6838218bb6
|
Lspringboot/src/main/java/com/xht/springboot/Service/CancerDetectService.java,5\a\5aa79857db1807fe40f0941af9e17d8a19d8bc97
w
Gspringboot/src/main/java/com/xht/springboot/Dao/PersonalHomeMapper.java,8\e\8ea61bcc473345da7a8363076b3ae562bc76fedc
w
Gspringboot/src/main/java/com/xht/springboot/Service/WebHomeService.java,5\f\5feb9f75e1bc678660918562fd0ce2745899be29
p
@springboot/src/main/java/com/xht/springboot/Entity/UserHome.java,0\b\0bf6f777ae20a7657065bc4a2b2a9f1f3b4876b1

@ -1,6 +1,4 @@
w
Gspringboot/src/main/java/com/xht/springboot/Dao/PersonalHomeMapper.java,8\e\8ea61bcc473345da7a8363076b3ae562bc76fedc
z
Jspringboot/src/main/java/com/xht/springboot/pythonspider/PythonSpider.java,8\2\82d065e13dbb46b69838db763af0105eec47337f
{
@ -25,8 +23,6 @@ B
test_model/pom.xml,c\5\c5247f1a7a8da981f49c6fe2b5fc0ba5e9b426bb
q
Aspringboot/src/main/java/com/xht/springboot/Entity/UserLogin.java,1\3\139a0da36daad8c438a5607ee212d1f38a505779
B
springboot/pom.xml,e\4\e46aee6c7c512a7b48980a296fca0acf004a1907
r
Bspringboot/src/main/java/com/xht/springboot/Dao/WebHomeMapper.java,2\a\2ad2a1260dac6c01c8b352bb0e2ca62f513676a9
p
@ -37,3 +33,13 @@ q
Aspringboot/src/main/java/com/xht/springboot/Entity/UserReply.java,0\5\051eaf551b928a8ccf651611c070ebb2b8155264
l
<test_model/src/main/java/org/example/python/output_result.py,c\f\cf2b6f7a1e504e3a80407b7fb223ab50a8c9f4bf
z
Jspringboot/src/main/java/com/xht/springboot/Control/WebHomeController.java,e\d\edeacc9d294f3b307d4238fb3f381c6838218bb6
|
Lspringboot/src/main/java/com/xht/springboot/Service/CancerDetectService.java,5\a\5aa79857db1807fe40f0941af9e17d8a19d8bc97
w
Gspringboot/src/main/java/com/xht/springboot/Dao/PersonalHomeMapper.java,8\e\8ea61bcc473345da7a8363076b3ae562bc76fedc
w
Gspringboot/src/main/java/com/xht/springboot/Service/WebHomeService.java,5\f\5feb9f75e1bc678660918562fd0ce2745899be29
p
@springboot/src/main/java/com/xht/springboot/Entity/UserHome.java,0\b\0bf6f777ae20a7657065bc4a2b2a9f1f3b4876b1

@ -56,6 +56,18 @@
<artifactId>spring-boot-starter-cache</artifactId>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>29.0-jre</version>
</dependency>
<dependency>
<groupId>org.redisson</groupId>
<artifactId>redisson</artifactId>
<version>3.14.1</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId>

@ -0,0 +1,31 @@
package com.xht.springboot.Config;
import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.redisson.config.SingleServerConfig;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class RedissionConfig {
/*@Value("#{spring.data.redis.host}")
String address;
@Value("#{spring.data.redis.port}")
String port;
@Value("#{spring.data.redis.password}")
String pwd;*/
@Bean
public RedissonClient redissonClient(){
Config config = new Config();
SingleServerConfig singleServerConfig = config.useSingleServer();
singleServerConfig.setAddress("redis://192.168.225.128:6390")
.setPassword("molong")
.setDatabase(0);
RedissonClient redissonClient = Redisson.create(config);
return redissonClient;
}
}

@ -7,6 +7,8 @@ import com.xht.springboot.Service.PersonalHomeService;
import com.xht.springboot.Tip.RequestResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
@ -23,10 +25,32 @@ public class PersonalHomeController {
@RequestMapping("/getuserhomedata")
@ResponseBody
public UserHome getPersonalHomeData(int uid){
public UserHome getUserHomeData(int uid){
return personalHomeService.getUserHomeData(uid);
}
@PostMapping("/postuserhomedata")
@ResponseBody
public RequestResult postUserHomeData(@RequestBody UserHome userHome){
RequestResult result = new RequestResult();
if(personalHomeService.postUserHomeData(userHome))
result.status = RequestResult.OK;
else
result.status = RequestResult.FAIL;
return result;
}
@PostMapping("/updateuserhomedata")
@ResponseBody
public RequestResult updateUserHomeData(@RequestBody UserHome userHome){
RequestResult result = new RequestResult();
if(personalHomeService.updateUserHomeData(userHome))
result.status = RequestResult.OK;
else
result.status = RequestResult.FAIL;
return result;
}
@RequestMapping("/getusertexts")
@ResponseBody
public List<UserText> getUserTexts(int uid){

@ -12,5 +12,9 @@ public interface PersonalHomeMapper {
//根据uid查询用户详情
public UserHome findById(int id);
public int postUserHomeData(UserHome userHome);
public int updateUserHomeData(UserHome userHome);
public List<UserText> findTexts(int id);
}

@ -4,12 +4,17 @@ package com.xht.springboot.Service;
import com.xht.springboot.Dao.PersonalHomeMapper;
import com.xht.springboot.Entity.UserHome;
import com.xht.springboot.Entity.UserText;
import com.xht.springboot.Utils.BloomFilterUtils;
import org.redisson.RedissonMultiLock;
import org.redisson.api.RLock;
import org.redisson.api.RedissonClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.concurrent.TimeUnit;
@Service
public class PersonalHomeService {
@ -17,31 +22,100 @@ public class PersonalHomeService {
PersonalHomeMapper personalHomeMapper;
@Autowired
RedisTemplate redisTemplate;
@Autowired
BloomFilterUtils bloomFilterUtils;
@Autowired
RedissonClient redissonClient;
String userHomeDataCacheName = "userData::";
String userTxtByUidCacheName = "userTxtByUid::";
String userHomeDataLockHome = "userHomeDataLock";
String userTxtByUidLockHome = "userTxtByUidLock";
//获得用户主页数据
public UserHome getUserHomeData(int uid){
if(!bloomFilterUtils.queryKey(userHomeDataCacheName+uid))//布隆过滤器先过滤
return null;
UserHome userHome = (UserHome) redisTemplate.opsForValue().get(userHomeDataCacheName + uid);
if(userHome!=null)
return userHome;
else{
synchronized (PersonalHomeService.class){
synchronized (PersonalHomeService.class){//双检加锁
userHome = (UserHome) redisTemplate.opsForValue().get(userHomeDataCacheName + uid);
if(userHome!=null)
return userHome;
else{
userHome = personalHomeMapper.findById(uid);
if(userHome!=null)
redisTemplate.opsForValue().set(userHomeDataCacheName+uid,userHome);
RLock lock = redissonClient.getLock(userHomeDataLockHome);
RedissonMultiLock redissonMultiLock = new RedissonMultiLock(lock);
redissonMultiLock.lock();//写缓存加锁
try {
if(userHome!=null)
redisTemplate.opsForValue().set(userHomeDataCacheName+uid,userHome);
else{//写回空值
redisTemplate.opsForValue().set(userHomeDataCacheName+uid,null,30, TimeUnit.SECONDS);
}
}catch (Exception e){
e.printStackTrace();
}finally {
redissonMultiLock.unlock();
}
return userHome;
}
}
}
}
public boolean postUserHomeData(UserHome userHome){//先更新数据库后删除缓存
if(personalHomeMapper.postUserHomeData(userHome)!=0){
RLock lock = redissonClient.getLock(userHomeDataLockHome);
RedissonMultiLock multiLock = new RedissonMultiLock(lock);
multiLock.lock();//写缓存加锁
try {
redisTemplate.delete(userHomeDataCacheName+userHome.getUid());
}catch (Exception exception){
exception.printStackTrace();
}finally {
multiLock.unlock();
}
bloomFilterUtils.putIntoBloomFilter(userHomeDataCacheName+userHome.getUid());//写入布隆过滤器
return true;
}
return false;
}
public boolean updateUserHomeData(UserHome userHome){
if(personalHomeMapper.updateUserHomeData(userHome)!=0){
RLock lock = redissonClient.getLock(userHomeDataLockHome);
RedissonMultiLock redissonMultiLock = new RedissonMultiLock(lock);
redissonMultiLock.lock();
try {
redisTemplate.delete(userHomeDataCacheName+userHome.getUid());
}catch (Exception exception){
exception.printStackTrace();
}finally {
redissonMultiLock.unlock();
}
return true;
}
return false;
}
public List<UserText> getUserTexts(int uid){
if(!bloomFilterUtils.queryKey(userTxtByUidCacheName+uid))
return null;
List<UserText> userTexts = (List<UserText>) redisTemplate.opsForValue().get(userTxtByUidCacheName + uid);
if(userTexts!=null)
return userTexts;
@ -52,8 +126,24 @@ public class PersonalHomeService {
return userTexts;
else{
userTexts = personalHomeMapper.findTexts(uid);
if(userTexts!=null)
redisTemplate.opsForValue().set(userTxtByUidCacheName+uid,userTexts);
RLock lock = redissonClient.getLock(userTxtByUidLockHome);
RedissonMultiLock redissonMultiLock = new RedissonMultiLock(lock);
redissonMultiLock.lock();
try {
if(userTexts!=null)
redisTemplate.opsForValue().set(userTxtByUidCacheName+uid,userTexts);
else
redisTemplate.opsForValue().set(userTxtByUidCacheName+uid,null,30,TimeUnit.SECONDS);
}catch (Exception e){
e.printStackTrace();
}finally {
redissonMultiLock.unlock();
}
return userTexts;
}
}

@ -105,7 +105,7 @@ public class WebHomeService {
rows = webHomeMapper.updateUserText(userText);
if(rows >= 1){
System.out.println("update text OK "+rows);
redisTemplate.opsForValue().getAndDelete(userTxtCacheName+userText.getTextid());//删除缓存中数据
redisTemplate.opsForValue().getAndDelete(userTxtCacheName+userText.getTextid());//删除缓存中数据
return true;
}else{
@ -152,12 +152,11 @@ public class WebHomeService {
}
public boolean deleteUserComment(UserComment userComment){
redisTemplate.opsForValue().getAndDelete(userCmtCacheName+userComment.getCommentid());
int rows=0;
rows = webHomeMapper.deleteUserComment(userComment);
if(rows >= 1){
System.out.println("delete comment OK "+rows);
redisTemplate.opsForValue().getAndDelete(userCmtCacheName+userComment.getCommentid());
return true;
}else{
return false;
@ -165,12 +164,11 @@ public class WebHomeService {
}
public boolean updateUserComment(UserComment userComment){
redisTemplate.opsForValue().getAndDelete(userCmtCacheName+userComment.getCommentid());
int rows=0;
rows = webHomeMapper.updateUserComment(userComment);
if(rows >= 1){
System.out.println("update comment OK "+rows);
redisTemplate.opsForValue().getAndDelete(userCmtCacheName+userComment.getCommentid());
return true;
}else{
return false;
@ -197,12 +195,11 @@ public class WebHomeService {
}
public boolean deleteUserReply(UserReply userReply){
redisTemplate.opsForValue().getAndDelete(userReplyCacheName+userReply.getReplyid());
int rows=0;
rows = webHomeMapper.deleteUserReply(userReply);
if(rows >= 1){
System.out.println("delete reply OK "+rows);
redisTemplate.opsForValue().getAndDelete(userReplyCacheName+userReply.getReplyid());
return true;
}else{
return false;
@ -210,12 +207,11 @@ public class WebHomeService {
}
public boolean updateUserReply(UserReply userReply){
redisTemplate.opsForValue().getAndDelete(userReplyCacheName+userReply.getReplyid());
int rows=0;
rows = webHomeMapper.updateUserReply(userReply);
if(rows >= 1){
System.out.println("update reply OK "+rows);
redisTemplate.opsForValue().getAndDelete(userReplyCacheName+userReply.getReplyid());
return true;
}else{
return false;

@ -1,18 +1,32 @@
package com.xht.springboot;
import com.xht.springboot.Utils.BloomFilterUtils;
import com.xht.springboot.pythonspider.PythonSpider;
import org.python.google.common.hash.BloomFilter;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.data.redis.core.RedisTemplate;
import java.util.ArrayList;
import java.util.Set;
@SpringBootApplication
@EnableCaching
public class SpringbootApplication {
public static void main(String[] args) {
SpringApplication.run(SpringbootApplication.class, args);
ConfigurableApplicationContext applicationContext = SpringApplication.run(SpringbootApplication.class, args);
BloomFilterUtils bloomFilterUtils = applicationContext.getBean(BloomFilterUtils.class);
RedisTemplate redisTemplate = (RedisTemplate) applicationContext.getBean("redisTemplate");
Set<String> keys = redisTemplate.keys("*");
System.out.println("BloomFilter: insert data");
for(String key : keys){
bloomFilterUtils.putIntoBloomFilter(key);
System.out.println(key);
}
}
}

@ -0,0 +1,22 @@
package com.xht.springboot.Utils;
import com.google.common.hash.BloomFilter;
import com.google.common.hash.Funnels;
import org.springframework.stereotype.Component;
import java.nio.charset.StandardCharsets;
@Component
public class BloomFilterUtils {
private int bloomFilterSize = 10000;
private double fpp = 0.3;
private BloomFilter<String> bloomFilter = BloomFilter.create(Funnels.stringFunnel(StandardCharsets.UTF_8),bloomFilterSize,fpp);
public boolean putIntoBloomFilter(String key){
return bloomFilter.put(key);
}
public boolean queryKey(String key){
return bloomFilter.mightContain(key);
}
}

@ -0,0 +1,4 @@
package com.xht.springboot.Utils;
public class MyLock {
}

@ -8,6 +8,23 @@
select * from userdetails where uid=#{uid}
</select>
<insert id="postUserHomeData" parameterType="com.xht.springboot.Entity.UserHome" useGeneratedKeys="true" keyColumn="uid" keyProperty="uid">
insert into userdetails(uid,registertime) values(#{uid},#{registertime})
</insert>
<update id="updateUserHomeData" parameterType="com.xht.springboot.Entity.UserHome">
update userdetails
<set>
<if test="textcounts!=0">
textcounts=#{textcounts},
</if>
<if test="diseases!=null">
diseases=#{diseases},
</if>
</set>
where uid=#{uid}
</update>
<select id="findTexts" parameterType="int" resultType="com.xht.springboot.Entity.UserText">
select * from userTexts where uid=#{uid}
</select>

Loading…
Cancel
Save