xiangjincheng_branch
向金成 2 years ago
parent aad457d225
commit 0b609c9787

@ -0,0 +1,4 @@
{ java:S120"ZRename this package name to match the regular expression '^[a-z_]+(\.[a-z_][a-z0-9_]*)*$'.(³Ãôíþÿÿÿÿ8¼Šáó°1
V
java:S1128"9Remove this unused import 'org.apache.ibatis.type.Alias'.(’´´÷8¿Šáó°1

@ -1,16 +0,0 @@
t
java:S1104 "RMake status a static final constant or non-public and provide accessors if needed.(¥žß®üÿÿÿÿ8½Øî¿¦1
k
java:S1104 "NMake OK a static final constant or non-public and provide accessors if needed.(‹ç·Ï<38>ÑÒ¦1
l
java:S1104 "PMake FAIL a static final constant or non-public and provide accessors if needed.(ã¬V8<56><38>ÑÒ¦1
E
java:S1444 "(Make this "public static OK" field final(‹ç·Ï<38>ÑÒ¦1
F
java:S1444 "*Make this "public static FAIL" field final(ã¬V8Ž<38>ÑÒ¦1
u java:S120"ZRename this package name to match the regular expression '^[a-z_]+(\.[a-z_][a-z0-9_]*)*$'.(騦$8ÀØî¿¦1
j
java:S3008 "MRename this field "OK" to match the regular expression '^[a-z][a-zA-Z0-9]*$'.(‹ç·Ï8<><38>ÑÒ¦1
k
java:S3008 "ORename this field "FAIL" to match the regular expression '^[a-z][a-zA-Z0-9]*$'.(ã¬V8<56><38>ÑÒ¦1

@ -13,20 +13,14 @@ X
0train_cancer/train_model/data_gen/data_output.py,6\9\69a341fae4073fedbb8b01a3b078c3012c70ce5f
}
Mspringboot/src/main/java/com/xht/springboot/Control/GetSpiderInformation.java,6\a\6ae8bd6e0b13a9d9272e5cd44460d2d0a72091d9
r
Bspringboot/src/main/java/com/xht/springboot/Tip/RequestResult.java,8\a\8ac776bbbb6e77f29694ccc4476b533f9f4573da
C
springboot/mvnw.cmd,a\0\a027316d6320e979eb2d643acc8d7431b5899762
B
test_model/pom.xml,c\5\c5247f1a7a8da981f49c6fe2b5fc0ba5e9b426bb
q
Aspringboot/src/main/java/com/xht/springboot/Entity/UserLogin.java,1\3\139a0da36daad8c438a5607ee212d1f38a505779
r
Bspringboot/src/main/java/com/xht/springboot/Dao/WebHomeMapper.java,2\a\2ad2a1260dac6c01c8b352bb0e2ca62f513676a9
p
@springboot/src/main/java/com/xht/springboot/Entity/UserText.java,4\0\40a2343a36c9747fa26c52f19f82c0a493b5c2e0
s
Cspringboot/src/main/java/com/xht/springboot/Entity/UserComment.java,9\3\932ae6b8f9f42f924c25e69e48dc30fddd63ec28
q
Aspringboot/src/main/java/com/xht/springboot/Entity/UserReply.java,0\5\051eaf551b928a8ccf651611c070ebb2b8155264
l
@ -35,8 +29,6 @@ l
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
p
@springboot/src/main/java/com/xht/springboot/Entity/UserHome.java,0\b\0bf6f777ae20a7657065bc4a2b2a9f1f3b4876b1
B
springboot/pom.xml,e\4\e46aee6c7c512a7b48980a296fca0acf004a1907
w
@ -47,8 +39,6 @@ s
Cspringboot/src/main/java/com/xht/springboot/Config/RedisConfig.java,0\3\03febb48c6f14848416295ea77d17704b452f798
m
=springboot/src/main/java/com/xht/springboot/Utils/MyLock.java,d\6\d6d02a5bfa15e38571f6a2c3200cbaaebce3a1ae
{
Kspringboot/src/main/java/com/xht/springboot/Dao/LoginAndRegisterMapper.java,6\4\6455addaf8475c1ee66ddf019aba9934cde58b33

Yspringboot/src/main/java/com/xht/springboot/Utils/FuncInterFaces/InsertFunctionForDB.java,7\d\7d70f34e659e4d46090652b3abb110013fe4a496

@ -56,4 +46,30 @@ Yspringboot/src/main/java/com/xht/springboot/Utils/FuncInterFaces/DeleteFunction

Yspringboot/src/main/java/com/xht/springboot/Utils/FuncInterFaces/UpdateFunctionForDB.java,a\2\a208e939918d2caeb2c9b38f01b7b2b9a9c1c423
ˆ
Xspringboot/src/main/java/com/xht/springboot/Utils/FuncInterFaces/QueryFunctionForDB.java,5\b\5be6cb1ac1481aa1480b23c960b9102ff121b2c3
Xspringboot/src/main/java/com/xht/springboot/Utils/FuncInterFaces/QueryFunctionForDB.java,5\b\5be6cb1ac1481aa1480b23c960b9102ff121b2c3

Ospringboot/src/main/java/com/xht/springboot/Control/PersonalHomeController.java,b\e\be5bf7d32cedc052850e2cc0c99f2cf7357cac12
|
Lspringboot/src/main/java/com/xht/springboot/Service/PersonalHomeService.java,7\6\762bc359bc75ba7b3073e784c826f31f6c989305
z
Jspringboot/src/main/java/com/xht/springboot/Control/WebHomeController.java,e\d\edeacc9d294f3b307d4238fb3f381c6838218bb6
w
Gspringboot/src/main/java/com/xht/springboot/Service/WebHomeService.java,5\f\5feb9f75e1bc678660918562fd0ce2745899be29
s
Cspringboot/src/main/java/com/xht/springboot/Entity/UserComment.java,9\3\932ae6b8f9f42f924c25e69e48dc30fddd63ec28
p
@springboot/src/main/java/com/xht/springboot/Entity/UserHome.java,0\b\0bf6f777ae20a7657065bc4a2b2a9f1f3b4876b1
q
Aspringboot/src/main/java/com/xht/springboot/Entity/UserLogin.java,1\3\139a0da36daad8c438a5607ee212d1f38a505779
y
Ispringboot/src/main/java/com/xht/springboot/Entity/CancerInformation.java,b\5\b5e9edd6a873e8f600b989138d8c3c025f1b2893
y
Ispringboot/src/main/java/com/xht/springboot/Utils/RedisAndDbOpsUtils.java,2\e\2e88797485b4a9bb730c7a3ee47a6bf0fd5d7447
ƒ
Sspringboot/src/main/java/com/xht/springboot/Control/InformationQueryController.java,2\b\2b64f726d758544a03ab9287b407bfd77c4179b3

Pspringboot/src/main/java/com/xht/springboot/Service/InformationQueryService.java,3\e\3e8390fc18f553cd8e40f74084a3622827076137
{
Kspringboot/src/main/java/com/xht/springboot/Dao/InformationQueryMapper.java,0\f\0fcaad315f4a551d84b6b331d3458cf4bcdc6276
{
Kspringboot/src/main/java/com/xht/springboot/Dao/LoginAndRegisterMapper.java,6\4\6455addaf8475c1ee66ddf019aba9934cde58b33

@ -13,20 +13,14 @@ X
0train_cancer/train_model/data_gen/data_output.py,6\9\69a341fae4073fedbb8b01a3b078c3012c70ce5f
}
Mspringboot/src/main/java/com/xht/springboot/Control/GetSpiderInformation.java,6\a\6ae8bd6e0b13a9d9272e5cd44460d2d0a72091d9
r
Bspringboot/src/main/java/com/xht/springboot/Tip/RequestResult.java,8\a\8ac776bbbb6e77f29694ccc4476b533f9f4573da
C
springboot/mvnw.cmd,a\0\a027316d6320e979eb2d643acc8d7431b5899762
B
test_model/pom.xml,c\5\c5247f1a7a8da981f49c6fe2b5fc0ba5e9b426bb
q
Aspringboot/src/main/java/com/xht/springboot/Entity/UserLogin.java,1\3\139a0da36daad8c438a5607ee212d1f38a505779
r
Bspringboot/src/main/java/com/xht/springboot/Dao/WebHomeMapper.java,2\a\2ad2a1260dac6c01c8b352bb0e2ca62f513676a9
p
@springboot/src/main/java/com/xht/springboot/Entity/UserText.java,4\0\40a2343a36c9747fa26c52f19f82c0a493b5c2e0
s
Cspringboot/src/main/java/com/xht/springboot/Entity/UserComment.java,9\3\932ae6b8f9f42f924c25e69e48dc30fddd63ec28
q
Aspringboot/src/main/java/com/xht/springboot/Entity/UserReply.java,0\5\051eaf551b928a8ccf651611c070ebb2b8155264
l
@ -35,8 +29,6 @@ l
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
p
@springboot/src/main/java/com/xht/springboot/Entity/UserHome.java,0\b\0bf6f777ae20a7657065bc4a2b2a9f1f3b4876b1
B
springboot/pom.xml,e\4\e46aee6c7c512a7b48980a296fca0acf004a1907
w
@ -47,8 +39,6 @@ s
Cspringboot/src/main/java/com/xht/springboot/Config/RedisConfig.java,0\3\03febb48c6f14848416295ea77d17704b452f798
m
=springboot/src/main/java/com/xht/springboot/Utils/MyLock.java,d\6\d6d02a5bfa15e38571f6a2c3200cbaaebce3a1ae
{
Kspringboot/src/main/java/com/xht/springboot/Dao/LoginAndRegisterMapper.java,6\4\6455addaf8475c1ee66ddf019aba9934cde58b33

Yspringboot/src/main/java/com/xht/springboot/Utils/FuncInterFaces/InsertFunctionForDB.java,7\d\7d70f34e659e4d46090652b3abb110013fe4a496

@ -56,4 +46,30 @@ Yspringboot/src/main/java/com/xht/springboot/Utils/FuncInterFaces/DeleteFunction

Yspringboot/src/main/java/com/xht/springboot/Utils/FuncInterFaces/UpdateFunctionForDB.java,a\2\a208e939918d2caeb2c9b38f01b7b2b9a9c1c423
ˆ
Xspringboot/src/main/java/com/xht/springboot/Utils/FuncInterFaces/QueryFunctionForDB.java,5\b\5be6cb1ac1481aa1480b23c960b9102ff121b2c3
Xspringboot/src/main/java/com/xht/springboot/Utils/FuncInterFaces/QueryFunctionForDB.java,5\b\5be6cb1ac1481aa1480b23c960b9102ff121b2c3

Ospringboot/src/main/java/com/xht/springboot/Control/PersonalHomeController.java,b\e\be5bf7d32cedc052850e2cc0c99f2cf7357cac12
|
Lspringboot/src/main/java/com/xht/springboot/Service/PersonalHomeService.java,7\6\762bc359bc75ba7b3073e784c826f31f6c989305
z
Jspringboot/src/main/java/com/xht/springboot/Control/WebHomeController.java,e\d\edeacc9d294f3b307d4238fb3f381c6838218bb6
w
Gspringboot/src/main/java/com/xht/springboot/Service/WebHomeService.java,5\f\5feb9f75e1bc678660918562fd0ce2745899be29
s
Cspringboot/src/main/java/com/xht/springboot/Entity/UserComment.java,9\3\932ae6b8f9f42f924c25e69e48dc30fddd63ec28
p
@springboot/src/main/java/com/xht/springboot/Entity/UserHome.java,0\b\0bf6f777ae20a7657065bc4a2b2a9f1f3b4876b1
q
Aspringboot/src/main/java/com/xht/springboot/Entity/UserLogin.java,1\3\139a0da36daad8c438a5607ee212d1f38a505779
y
Ispringboot/src/main/java/com/xht/springboot/Utils/RedisAndDbOpsUtils.java,2\e\2e88797485b4a9bb730c7a3ee47a6bf0fd5d7447
y
Ispringboot/src/main/java/com/xht/springboot/Entity/CancerInformation.java,b\5\b5e9edd6a873e8f600b989138d8c3c025f1b2893

Pspringboot/src/main/java/com/xht/springboot/Service/InformationQueryService.java,3\e\3e8390fc18f553cd8e40f74084a3622827076137
{
Kspringboot/src/main/java/com/xht/springboot/Dao/InformationQueryMapper.java,0\f\0fcaad315f4a551d84b6b331d3458cf4bcdc6276
ƒ
Sspringboot/src/main/java/com/xht/springboot/Control/InformationQueryController.java,2\b\2b64f726d758544a03ab9287b407bfd77c4179b3
{
Kspringboot/src/main/java/com/xht/springboot/Dao/LoginAndRegisterMapper.java,6\4\6455addaf8475c1ee66ddf019aba9934cde58b33

@ -0,0 +1,24 @@
package com.xht.springboot.Config;
import com.xht.springboot.Interceptor.LoginInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration
public class InterceptorConfig implements WebMvcConfigurer {
@Autowired
private LoginInterceptor loginInterceptor;
@Override
public void addInterceptors(InterceptorRegistry registry) {
registry
.addInterceptor(loginInterceptor)
.addPathPatterns("/**")
.excludePathPatterns("/user/login");
}
}

@ -0,0 +1,26 @@
package com.xht.springboot.Control;
import com.xht.springboot.Entity.CancerInformation;
import com.xht.springboot.Service.InformationQueryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;
@Controller
@RequestMapping("/information")
public class InformationQueryController {
@Autowired
InformationQueryService informationQueryService;
@RequestMapping("/cancer")
@ResponseBody
public List<CancerInformation> getCancerInformation(String token){
return informationQueryService.queryCancerInformation(token);
}
}

@ -3,6 +3,7 @@ package com.xht.springboot.Control;
import com.xht.springboot.Dao.LoginAndRegisterMapper;
import com.xht.springboot.Entity.UserLogin;
import com.xht.springboot.Service.LoginAndRegisterService;
import com.xht.springboot.Tip.RequestResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
@ -17,39 +18,30 @@ import java.util.List;
@Controller
public class LoginAndRegisterController {
@Autowired
LoginAndRegisterMapper loginAndRegisterMapper;
@Autowired
RequestResult requestResult;
LoginAndRegisterService loginAndRegisterService;
@RequestMapping(value = "/findisrepeat",method = RequestMethod.POST)
@ResponseBody
public List<UserLogin> findIsRepeat(@RequestBody UserLogin userLogin){
return loginAndRegisterMapper.findIsRepeat(userLogin);
public RequestResult findIsRepeat(@RequestBody UserLogin userLogin){
return loginAndRegisterService.findIsRepeat(userLogin);
}
@RequestMapping(value = "/register",method = RequestMethod.POST)
@ResponseBody
public RequestResult register(@RequestBody UserLogin userLogin){
if(loginAndRegisterMapper.register(userLogin) >= 1){
requestResult.status = RequestResult.OK;
return requestResult;
}else {
requestResult.status = RequestResult.FAIL;
return requestResult;
}
return loginAndRegisterService.register(userLogin);
}
@RequestMapping(value = "/login",method = RequestMethod.POST)
@ResponseBody
public UserLogin login(@RequestBody UserLogin userLogin){
return loginAndRegisterMapper.find(userLogin);
public RequestResult login(@RequestBody UserLogin userLogin){
return loginAndRegisterService.login(userLogin);
}
@RequestMapping(value = "/forgetpassword",method = RequestMethod.POST)
@ResponseBody
public UserLogin getPassword(@RequestBody UserLogin userLogin){
return loginAndRegisterMapper.find(userLogin);
return loginAndRegisterService.getPwd(userLogin);
}
}

@ -0,0 +1,12 @@
package com.xht.springboot.Dao;
import com.xht.springboot.Entity.CancerInformation;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface InformationQueryMapper {
public List<CancerInformation> queryCancerInformation(String token);
}

@ -0,0 +1,19 @@
package com.xht.springboot.Entity;
import lombok.Data;
import lombok.ToString;
import org.springframework.stereotype.Component;
@Component
@Data
@ToString
public class CancerInformation {
private int id;
private String name;
private String impact;
private String summary;
private String symptom;
private String factor;
private String judge;
private String heal;
}

@ -0,0 +1,26 @@
package com.xht.springboot.Interceptor;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.HandlerInterceptor;
@Component
public class LoginInterceptor implements HandlerInterceptor {
@Autowired
RedisTemplate redisTemplate;
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
System.out.println(request.getRequestURI());
String token = request.getHeader("token");
String result = (String) redisTemplate.opsForValue().get(token);
if(result==null)
return false;
else
return true;
}
}

@ -0,0 +1,37 @@
package com.xht.springboot.Service;
import com.xht.springboot.Dao.InformationQueryMapper;
import com.xht.springboot.Entity.CancerInformation;
import com.xht.springboot.Utils.FuncInterFaces.QueryFunctionForDB;
import com.xht.springboot.Utils.RedisAndDbOpsUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class InformationQueryService {
@Autowired
InformationQueryMapper informationQueryMapper;
@Autowired
RedisAndDbOpsUtils redisAndDbOpsUtils;
String cancerInformationCacheName = "cancerInformationByToken::";
String cancerInformationLockName = "cancerInformationByTokenLock";
public List<CancerInformation> queryCancerInformation(String token){
QueryFunctionForDB<List<CancerInformation>> queryFunctionForDB = new QueryFunctionForDB<List<CancerInformation>>() {
@Override
public List<CancerInformation> queryForDB(String token) {
List<CancerInformation> results = informationQueryMapper.queryCancerInformation(token);
if(results.size()==0)
return null;
else
return results;
}
};
return redisAndDbOpsUtils.queryNoFilter(cancerInformationCacheName,token,cancerInformationLockName,queryFunctionForDB,token);
}
}

@ -0,0 +1,75 @@
package com.xht.springboot.Service;
import com.xht.springboot.Dao.LoginAndRegisterMapper;
import com.xht.springboot.Entity.UserLogin;
import com.xht.springboot.Tip.RequestResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
@Service
public class LoginAndRegisterService {
@Autowired
LoginAndRegisterMapper loginAndRegisterMapper;
@Autowired
RequestResult requestResult;
@Autowired
RedisTemplate redisTemplate;
public RequestResult findIsRepeat(UserLogin userLogin){
List<UserLogin> result = loginAndRegisterMapper.findIsRepeat(userLogin);
RequestResult requestResult = new RequestResult();
if(result.size()==0){
requestResult.status = RequestResult.OK;
requestResult.message = RequestResult.USER_NOT_REPEAT;
}else{
requestResult.status = RequestResult.FAIL;
requestResult.message = RequestResult.USER_REPEAT;
}
return requestResult;
}
public RequestResult register(UserLogin userLogin){
if(loginAndRegisterMapper.register(userLogin) >= 1){
requestResult.status = RequestResult.OK;
requestResult.message = RequestResult.USER_REGISTER_SUCCESS;
}else {
requestResult.status = RequestResult.FAIL;
requestResult.message = RequestResult.USER_REGISTER_FAILED;
}
return requestResult;
}
public RequestResult login(UserLogin userLogin){
UserLogin result = loginAndRegisterMapper.find(userLogin);
RequestResult requestResult = new RequestResult();
if(result==null){
requestResult.status = RequestResult.FAIL;
requestResult.message = RequestResult.USER_LOGIN_FAILED;
}
else{
String token = UUID.randomUUID().toString();//登录成功返回token
redisTemplate.opsForValue().set(token,"user_token",30, TimeUnit.MINUTES);//存入用户token
requestResult.status = RequestResult.OK;
requestResult.message = RequestResult.USER_LOGIN_SUCCESS;
requestResult.data = token;
}
return requestResult;
}
public UserLogin getPwd(UserLogin userLogin){
return loginAndRegisterMapper.find(userLogin);
}
}

@ -9,6 +9,14 @@ import org.springframework.stereotype.Component;
@ToString
public class RequestResult {
public int status;
public static int OK = 0;
public static int FAIL = 1;
public String message;
public String data;
public static int OK = 200;
public static int FAIL = 400;
public static String USER_LOGIN_FAILED = "user_login_failed";
public static String USER_LOGIN_SUCCESS = "user_login_success";
public static String USER_REGISTER_FAILED = "user_register_failed";
public static String USER_REGISTER_SUCCESS = "user_register_success";
public static String USER_REPEAT = "user_repeat";
public static String USER_NOT_REPEAT = "user_not_repeat";
}

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xht.springboot.Dao.InformationQueryMapper">
<select id="queryCancerInformation" parameterType="string" resultType="com.xht.springboot.Entity.CancerInformation">
select * from cancer_information where LOCATE(#{string},name)>=1 or LOCATE(#{string},impact)>=1
</select>
</mapper>
Loading…
Cancel
Save